Rev 182 |
Blame |
Compare with Previous |
Last modification |
View Log
| Download
| RSS feed
!function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,e),i.l=!0,i.exports}var n={};e.m=t,e.c=n,e.d=function(t,n,r){e.o(t,n)||Object.defineProperty(t,n,{configurable:!1,enumerable:!0,get:r})},e.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return e.d(n,"a",n),n},e.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},e.p="/push-notification-demo/",e(e.s=14)}([function(t,e,n){"use strict";function r(){function t(t){f(d[t],"delete"),delete d[t]}function e(t){return t=t||s,a(d,t)||i("no-app",{name:t}),d[t]}function n(t,e){if(void 0===e&&(e={}),"object"!==typeof e||null===e){e={name:e}}var n=e;void 0===n.name&&(n.name=s);var r=n.name;"string"===typeof r&&r||i("bad-app-name",{name:r+""}),a(d,r)&&i("duplicate-app",{name:r});var o=new c(t,n,g);return d[r]=o,f(o,"create"),o}function u(){return Object.keys(d).map(function(t){return d[t]})}function l(t,n,r,a,s){y[t]&&i("duplicate-service",{name:t}),y[t]=n,a&&(m[t]=a,u().forEach(function(t){a("create",t)}));var l=function(n){return void 0===n&&(n=e()),"function"!==typeof n[t]&&i("invalid-app-argument",{name:t}),n[t]()};return void 0!==r&&o.deepExtend(l,r),g[t]=l,c.prototype[t]=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];return this._getService.bind(this,t).apply(this,s?e:[])},l}function h(t){o.deepExtend(g,t)}function f(t,e){Object.keys(y).forEach(function(n){var r=p(t,n);null!==r&&m[r]&&m[r](e,t)})}function p(t,e){if("serverAuth"===e)return null;var n=e;t.options;return n}var d={},y={},m={},g={__esModule:!0,initializeApp:n,app:e,apps:null,Promise:Promise,SDK_VERSION:"5.0.4",INTERNAL:{registerService:l,createFirebaseNamespace:r,extendNamespace:h,createSubscribe:o.createSubscribe,ErrorFactory:o.ErrorFactory,removeApp:t,factories:y,useAsService:p,Promise:Promise,deepExtend:o.deepExtend}};return o.patchProperty(g,"default",g),Object.defineProperty(g,"apps",{get:u}),o.patchProperty(e,"App",c),g}function i(t,e){throw h.create(t,e)}Object.defineProperty(e,"__esModule",{value:!0});var o=n(5),a=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},s="[DEFAULT]",u=[],c=function(){function t(t,e,n){this.firebase_=n,this.isDeleted_=!1,this.services_={},this.name_=e.name,this._automaticDataCollectionEnabled=e.automaticDataCollectionEnabled||!1,this.options_=o.deepCopy(t),this.INTERNAL={getUid:function(){return null},getToken:function(){return Promise.resolve(null)},addAuthTokenListener:function(t){u.push(t),setTimeout(function(){return t(null)},0)},removeAuthTokenListener:function(t){u=u.filter(function(e){return e!==t})}}}return Object.defineProperty(t.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this._automaticDataCollectionEnabled},set:function(t){this.checkDestroyed_(),this._automaticDataCollectionEnabled=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!0,configurable:!0}),t.prototype.delete=function(){var t=this;return new Promise(function(e){t.checkDestroyed_(),e()}).then(function(){t.firebase_.INTERNAL.removeApp(t.name_);var e=[];return Object.keys(t.services_).forEach(function(n){Object.keys(t.services_[n]).forEach(function(r){e.push(t.services_[n][r])})}),Promise.all(e.map(function(t){return t.INTERNAL.delete()}))}).then(function(){t.isDeleted_=!0,t.services_={}})},t.prototype._getService=function(t,e){if(void 0===e&&(e=s),this.checkDestroyed_(),this.services_[t]||(this.services_[t]={}),!this.services_[t][e]){var n=e!==s?e:void 0,r=this.firebase_.INTERNAL.factories[t](this,this.extendApp.bind(this),n);this.services_[t][e]=r}return this.services_[t][e]},t.prototype.extendApp=function(t){var e=this;o.deepExtend(this,t),t.INTERNAL&&t.INTERNAL.addAuthTokenListener&&(u.forEach(function(t){e.INTERNAL.addAuthTokenListener(t)}),u=[])},t.prototype.checkDestroyed_=function(){this.isDeleted_&&i("app-deleted",{name:this.name_})},t}();c.prototype.name&&c.prototype.options||c.prototype.delete||console.log("dc");var l={"no-app":"No Firebase App '{$name}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$name}","duplicate-app":"Firebase App named '{$name}' already exists","app-deleted":"Firebase App named '{$name}' already deleted","duplicate-service":"Firebase service named '{$name}' already registered","sa-not-supported":"Initializing the Firebase SDK with a service account is only allowed in a Node.js environment. On client devices, you should instead initialize the SDK with an api key and auth domain","invalid-app-argument":"firebase.{$name}() takes either no argument or a Firebase App instance."},h=new o.ErrorFactory("app","Firebase",l),f=r();e.firebase=f,e.default=f},function(t,e){var n;n=function(){return this}();try{n=n||Function("return this")()||(0,eval)("this")}catch(t){"object"===typeof window&&(n=window)}t.exports=n},function(t,e,n){"use strict";function r(t,e){function n(){this.constructor=t}w(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}function i(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols)for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&(n[r[i]]=t[r[i]]);return n}function o(t,e,n,r){var i,o=arguments.length,a=o<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,n):r;if("object"===typeof Reflect&&"function"===typeof Reflect.decorate)a=Reflect.decorate(t,e,n,r);else for(var s=t.length-1;s>=0;s--)(i=t[s])&&(a=(o<3?i(a):o>3?i(e,n,a):i(e,n))||a);return o>3&&a&&Object.defineProperty(e,n,a),a}function a(t,e){return function(n,r){e(n,r,t)}}function s(t,e){if("object"===typeof Reflect&&"function"===typeof Reflect.metadata)return Reflect.metadata(t,e)}function u(t,e,n,r){return new(n||(n=Promise))(function(i,o){function a(t){try{u(r.next(t))}catch(t){o(t)}}function s(t){try{u(r.throw(t))}catch(t){o(t)}}function u(t){t.done?i(t.value):new n(function(e){e(t.value)}).then(a,s)}u((r=r.apply(t,e||[])).next())})}function c(t,e){function n(t){return function(e){return r([t,e])}}function r(n){if(i)throw new TypeError("Generator is already executing.");for(;u;)try{if(i=1,o&&(a=o[2&n[0]?"return":n[0]?"throw":"next"])&&!(a=a.call(o,n[1])).done)return a;switch(o=0,a&&(n=[0,a.value]),n[0]){case 0:case 1:a=n;break;case 4:return u.label++,{value:n[1],done:!1};case 5:u.label++,o=n[1],n=[0];continue;case 7:n=u.ops.pop(),u.trys.pop();continue;default:if(a=u.trys,!(a=a.length>0&&a[a.length-1])&&(6===n[0]||2===n[0])){u=0;continue}if(3===n[0]&&(!a||n[1]>a[0]&&n[1]<a[3])){u.label=n[1];break}if(6===n[0]&&u.label<a[1]){u.label=a[1],a=n;break}if(a&&u.label<a[2]){u.label=a[2],u.ops.push(n);break}a[2]&&u.ops.pop(),u.trys.pop();continue}n=e.call(t,u)}catch(t){n=[6,t],o=0}finally{i=a=0}if(5&n[0])throw n[1];return{value:n[0]?n[1]:void 0,done:!0}}var i,o,a,s,u={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return s={next:n(0),throw:n(1),return:n(2)},"function"===typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s}function l(t,e){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}function h(t){var e="function"===typeof Symbol&&t[Symbol.iterator],n=0;return e?e.call(t):{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}}}function f(t,e){var n="function"===typeof Symbol&&t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),a=[];try{for(;(void 0===e||e-- >0)&&!(r=o.next()).done;)a.push(r.value)}catch(t){i={error:t}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function p(){for(var t=[],e=0;e<arguments.length;e++)t=t.concat(f(arguments[e]));return t}function d(t){return this instanceof d?(this.v=t,this):new d(t)}function y(t,e,n){function r(t){l[t]&&(c[t]=function(e){return new Promise(function(n,r){h.push([t,e,n,r])>1||i(t,e)})})}function i(t,e){try{o(l[t](e))}catch(t){u(h[0][3],t)}}function o(t){t.value instanceof d?Promise.resolve(t.value.v).then(a,s):u(h[0][2],t)}function a(t){i("next",t)}function s(t){i("throw",t)}function u(t,e){t(e),h.shift(),h.length&&i(h[0][0],h[0][1])}if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var c,l=n.apply(t,e||[]),h=[];return c={},r("next"),r("throw"),r("return"),c[Symbol.asyncIterator]=function(){return this},c}function m(t){function e(e,i){t[e]&&(n[e]=function(n){return(r=!r)?{value:d(t[e](n)),done:"return"===e}:i?i(n):n})}var n,r;return n={},e("next"),e("throw",function(t){throw t}),e("return"),n[Symbol.iterator]=function(){return this},n}function g(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator];return e?e.call(t):"function"===typeof h?h(t):t[Symbol.iterator]()}function v(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}function b(t){if(t&&t.__esModule)return t;var e={};if(null!=t)for(var n in t)Object.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e.default=t,e}function _(t){return t&&t.__esModule?t:{default:t}}Object.defineProperty(e,"__esModule",{value:!0}),e.__extends=r,n.d(e,"__assign",function(){return E}),e.__rest=i,e.__decorate=o,e.__param=a,e.__metadata=s,e.__awaiter=u,e.__generator=c,e.__exportStar=l,e.__values=h,e.__read=f,e.__spread=p,e.__await=d,e.__asyncGenerator=y,e.__asyncDelegator=m,e.__asyncValues=g,e.__makeTemplateObject=v,e.__importStar=b,e.__importDefault=_;var w=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])},E=Object.assign||function(t){for(var e,n=1,r=arguments.length;n<r;n++){e=arguments[n];for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t}},function(t,e,n){"use strict";function r(t){if(null===t||void 0===t)throw new TypeError("Object.assign cannot be called with null or undefined");return Object(t)}var i=Object.getOwnPropertySymbols,o=Object.prototype.hasOwnProperty,a=Object.prototype.propertyIsEnumerable;t.exports=function(){try{if(!Object.assign)return!1;var t=new String("abc");if(t[5]="de","5"===Object.getOwnPropertyNames(t)[0])return!1;for(var e={},n=0;n<10;n++)e["_"+String.fromCharCode(n)]=n;if("0123456789"!==Object.getOwnPropertyNames(e).map(function(t){return e[t]}).join(""))return!1;var r={};return"abcdefghijklmnopqrst".split("").forEach(function(t){r[t]=t}),"abcdefghijklmnopqrst"===Object.keys(Object.assign({},r)).join("")}catch(t){return!1}}()?Object.assign:function(t,e){for(var n,s,u=r(t),c=1;c<arguments.length;c++){n=Object(arguments[c]);for(var l in n)o.call(n,l)&&(u[l]=n[l]);if(i){s=i(n);for(var h=0;h<s.length;h++)a.call(n,s[h])&&(u[s[h]]=n[s[h]])}}return u}},function(t,e,n){"use strict";t.exports=n(20)},function(t,e,n){"use strict";function r(t){return i(void 0,t)}function i(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:var n=e;return new Date(n.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var r in e)e.hasOwnProperty(r)&&(t[r]=i(t[r],e[r]));return t}function o(t,e,n){t[e]=n}function a(t){var e=D;return D=t,e}function s(t){return JSON.parse(t)}function u(t){return JSON.stringify(t)}function c(t,e){var n=new it(t,e);return n.subscribe.bind(n)}function l(t,e){return function(){for(var n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];Promise.resolve(!0).then(function(){t.apply(void 0,n)}).catch(function(t){e&&e(t)})}}function h(t,e){if("object"!==typeof t||null===t)return!1;for(var n=0,r=e;n<r.length;n++){var i=r[n];if(i in t&&"function"===typeof t[i])return!0}return!1}function f(){}function p(t,e,n){var r="";switch(e){case 1:r=n?"first":"First";break;case 2:r=n?"second":"Second";break;case 3:r=n?"third":"Third";break;case 4:r=n?"fourth":"Fourth";break;default:throw new Error("errorPrefix called with argumentNumber > 4. Need to update it?")}var i=t+" failed: ";return i+=r+" argument "}function d(t,e,n,r){if((!r||n)&&"string"!==typeof n)throw new Error(p(t,e,r)+"must be a valid firebase namespace.")}function y(t,e,n,r){if((!r||n)&&"function"!==typeof n)throw new Error(p(t,e,r)+"must be a valid function.")}function m(t,e,n,r){if((!r||n)&&("object"!==typeof n||null===n))throw new Error(p(t,e,r)+"must be a valid context object.")}Object.defineProperty(e,"__esModule",{value:!0});var g=n(2),v={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},b=function(t,e){if(!t)throw _(e)},_=function(t){return new Error("Firebase Database ("+v.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},w=function(t){for(var e=[],n=0,r=0;r<t.length;r++){var i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&t.charCodeAt(++r)),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},E=function(t){for(var e=[],n=0,r=0;n<t.length;){var i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){var o=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){var o=t[n++],a=t[n++],s=t[n++],u=((7&i)<<18|(63&o)<<12|(63&a)<<6|63&s)-65536;e[r++]=String.fromCharCode(55296+(u>>10)),e[r++]=String.fromCharCode(56320+(1023&u))}else{var o=t[n++],a=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&a)}}return e.join("")},T={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(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i<t.length;i+=3){var o=t[i],a=i+1<t.length,s=a?t[i+1]:0,u=i+2<t.length,c=u?t[i+2]:0,l=o>>2,h=(3&o)<<4|s>>4,f=(15&s)<<2|c>>6,p=63&c;u||(p=64,a||(f=64)),r.push(n[l],n[h],n[f],n[p])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(w(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):E(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i<t.length;){var o=n[t.charAt(i++)],a=i<t.length,s=a?n[t.charAt(i)]:0;++i;var u=i<t.length,c=u?n[t.charAt(i)]:64;++i;var l=i<t.length,h=l?n[t.charAt(i)]:64;if(++i,null==o||null==s||null==c||null==h)throw Error();var f=o<<2|s>>4;if(r.push(f),64!=c){var p=s<<4&240|c>>2;if(r.push(p),64!=h){var d=c<<6&192|h;r.push(d)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},S=function(t){var e=w(t);return T.encodeByteArray(e,!0)},C=function(t){try{return T.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null},I=function(){function t(){var t=this;this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})}return t.prototype.wrapCallback=function(t){var e=this;return function(n,r){n?e.reject(n):e.resolve(r),"function"===typeof t&&(e.promise.catch(function(){}),1===t.length?t(n):t(n,r))}},t}(),N=function(){return"undefined"!==typeof navigator&&"string"===typeof navigator.userAgent?navigator.userAgent:""},k=function(){return"undefined"!==typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(N())},A=function(){return"object"===typeof navigator&&"ReactNative"===navigator.product},R=function(){return!0===v.NODE_CLIENT||!0===v.NODE_ADMIN},O="FirebaseError",D=Error.captureStackTrace,P=function(){function t(t,e){if(this.code=t,this.message=e,D)D(this,x.prototype.create);else try{throw Error.apply(this,arguments)}catch(t){this.name=O,Object.defineProperty(this,"stack",{get:function(){return t.stack}})}}return t}();P.prototype=Object.create(Error.prototype),P.prototype.constructor=P,P.prototype.name=O;var x=function(){function t(t,e,n){this.service=t,this.serviceName=e,this.errors=n,this.pattern=/\{\$([^}]+)}/g}return t.prototype.create=function(t,e){void 0===e&&(e={});var n,r=this.errors[t],i=this.service+"/"+t;n=void 0===r?"Error":r.replace(this.pattern,function(t,n){var r=e[n];return void 0!==r?r.toString():"<"+n+"?>"}),n=this.serviceName+": "+n+" ("+i+").";var o=new P(i,n);for(var a in e)e.hasOwnProperty(a)&&"_"!==a.slice(-1)&&(o[a]=e[a]);return o},t}(),L=function(t){var e={},n={},r={},i="";try{var o=t.split(".");e=s(C(o[0])||""),n=s(C(o[1])||""),i=o[2],r=n.d||{},delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}},M=function(t){var e,n,r=L(t).claims,i=Math.floor((new Date).getTime()/1e3);return"object"===typeof r&&(r.hasOwnProperty("nbf")?e=r.nbf:r.hasOwnProperty("iat")&&(e=r.iat),n=r.hasOwnProperty("exp")?r.exp:e+86400),i&&e&&n&&i>=e&&i<=n},F=function(t){var e=L(t).claims;return"object"===typeof e&&e.hasOwnProperty("iat")?e.iat:null},U=function(t){var e=L(t),n=e.claims;return!!e.signature&&!!n&&"object"===typeof n&&n.hasOwnProperty("iat")},B=function(t){var e=L(t).claims;return"object"===typeof e&&!0===e.admin},V=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},j=function(t,e){if(Object.prototype.hasOwnProperty.call(t,e))return t[e]},q=function(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])},W=function(t,e){return q(e,function(e,n){t[e]=n}),t},K=function(t){return W({},t)},H=function(t){return"object"===typeof t&&null!==t},G=function(t){for(var e in t)return!1;return!0},Q=function(t){var e=0;for(var n in t)e++;return e},z=function(t,e,n){var r={};for(var i in t)r[i]=e.call(n,t[i],i,t);return r},Y=function(t,e,n){for(var r in t)if(e.call(n,t[r],r,t))return r},X=function(t,e,n){var r=Y(t,e,n);return r&&t[r]},J=function(t){for(var e in t)return e},$=function(t){var e=[],n=0;for(var r in t)e[n++]=t[r];return e},Z=function(t,e){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)&&!e(n,t[n]))return!1;return!0},tt=function(t){var e=[];return q(t,function(t,n){Array.isArray(n)?n.forEach(function(n){e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))}),e.length?"&"+e.join("&"):""},et=function(t){var e={};return t.replace(/^\?/,"").split("&").forEach(function(t){if(t){var n=t.split("=");e[n[0]]=n[1]}}),e},nt=function(){function t(){this.blockSize=-1}return t}(),rt=function(t){function e(){var e=t.call(this)||this;e.chain_=[],e.buf_=[],e.W_=[],e.pad_=[],e.inbuf_=0,e.total_=0,e.blockSize=64,e.pad_[0]=128;for(var n=1;n<e.blockSize;++n)e.pad_[n]=0;return e.reset(),e}return g.__extends(e,t),e.prototype.reset=function(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0},e.prototype.compress_=function(t,e){e||(e=0);var n=this.W_;if("string"===typeof t)for(var r=0;r<16;r++)n[r]=t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|t.charCodeAt(e+3),e+=4;else for(var r=0;r<16;r++)n[r]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],e+=4;for(var r=16;r<80;r++){var i=n[r-3]^n[r-8]^n[r-14]^n[r-16];n[r]=4294967295&(i<<1|i>>>31)}for(var o,a,s=this.chain_[0],u=this.chain_[1],c=this.chain_[2],l=this.chain_[3],h=this.chain_[4],r=0;r<80;r++){r<40?r<20?(o=l^u&(c^l),a=1518500249):(o=u^c^l,a=1859775393):r<60?(o=u&c|l&(u|c),a=2400959708):(o=u^c^l,a=3395469782);var i=(s<<5|s>>>27)+o+h+a+n[r]&4294967295;h=l,l=c,c=4294967295&(u<<30|u>>>2),u=s,s=i}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+u&4294967295,this.chain_[2]=this.chain_[2]+c&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295},e.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r<e;){if(0==o)for(;r<=n;)this.compress_(t,r),r+=this.blockSize;if("string"===typeof t){for(;r<e;)if(i[o]=t.charCodeAt(r),++o,++r,o==this.blockSize){this.compress_(i),o=0;break}}else for(;r<e;)if(i[o]=t[r],++o,++r,o==this.blockSize){this.compress_(i),o=0;break}}this.inbuf_=o,this.total_+=e}},e.prototype.digest=function(){var t=[],e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(var n=this.blockSize-1;n>=56;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);for(var r=0,n=0;n<5;n++)for(var i=24;i>=0;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t},e}(nt),it=function(){function t(t,e){var n=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=e,this.task.then(function(){t(n)}).catch(function(t){n.error(t)})}return t.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},t.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},t.prototype.complete=function(){this.forEachObserver(function(t){t.complete()}),this.close()},t.prototype.subscribe=function(t,e,n){var r,i=this;if(void 0===t&&void 0===e&&void 0===n)throw new Error("Missing Observer.");r=h(t,["next","error","complete"])?t:{next:t,error:e,complete:n},void 0===r.next&&(r.next=f),void 0===r.error&&(r.error=f),void 0===r.complete&&(r.complete=f);var o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?r.error(i.finalError):r.complete()}catch(t){}}),this.observers.push(r),o},t.prototype.unsubscribeOne=function(t){void 0!==this.observers&&void 0!==this.observers[t]&&(delete this.observers[t],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},t.prototype.forEachObserver=function(t){if(!this.finalized)for(var e=0;e<this.observers.length;e++)this.sendOne(e,t)},t.prototype.sendOne=function(t,e){var n=this;this.task.then(function(){if(void 0!==n.observers&&void 0!==n.observers[t])try{e(n.observers[t])}catch(t){"undefined"!==typeof console&&console.error&&console.error(t)}})},t.prototype.close=function(t){var e=this;this.finalized||(this.finalized=!0,void 0!==t&&(this.finalError=t),this.task.then(function(){e.observers=void 0,e.onNoObservers=void 0}))},t}(),ot=function(t,e,n,r){var i;if(r<e?i="at least "+e:r>n&&(i=0===n?"none":"no more than "+n),i){var o=t+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".";throw new Error(o)}},at=function(t){for(var e=[],n=0,r=0;r<t.length;r++){var i=t.charCodeAt(r);if(i>=55296&&i<=56319){var o=i-55296;r++,b(r<t.length,"Surrogate pair missing trail surrogate.");i=65536+(o<<10)+(t.charCodeAt(r)-56320)}i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=63&i|128):i<65536?(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=63&i|128):(e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=63&i|128)}return e},st=function(t){for(var e=0,n=0;n<t.length;n++){var r=t.charCodeAt(n);r<128?e++:r<2048?e+=2:r>=55296&&r<=56319?(e+=4,n++):e+=3}return e};e.assert=b,e.assertionError=_,e.base64=T,e.base64Decode=C,e.base64Encode=S,e.CONSTANTS=v,e.deepCopy=r,e.deepExtend=i,e.patchProperty=o,e.Deferred=I,e.getUA=N,e.isMobileCordova=k,e.isNodeSdk=R,e.isReactNative=A,e.ErrorFactory=x,e.FirebaseError=P,e.patchCapture=a,e.jsonEval=s,e.stringify=u,e.decode=L,e.isAdmin=B,e.issuedAtTime=F,e.isValidFormat=U,e.isValidTimestamp=M,e.clone=K,e.contains=V,e.every=Z,e.extend=W,e.findKey=Y,e.findValue=X,e.forEach=q,e.getAnyKey=J,e.getCount=Q,e.getValues=$,e.isEmpty=G,e.isNonNullObject=H,e.map=z,e.safeGet=j,e.querystring=tt,e.querystringDecode=et,e.Sha1=rt,e.async=l,e.createSubscribe=c,e.errorPrefix=p,e.validateArgCount=ot,e.validateCallback=y,e.validateContextObject=m,e.validateNamespace=d,e.stringLength=st,e.stringToByteArray=at},function(t,e,n){"use strict";function r(){}function i(t){try{return t.then}catch(t){return g=t,v}}function o(t,e){try{return t(e)}catch(t){return g=t,v}}function a(t,e,n){try{t(e,n)}catch(t){return g=t,v}}function s(t){if("object"!==typeof this)throw new TypeError("Promises must be constructed via new");if("function"!==typeof t)throw new TypeError("Promise constructor's argument is not a function");this._75=0,this._83=0,this._18=null,this._38=null,t!==r&&y(t,this)}function u(t,e,n){return new t.constructor(function(i,o){var a=new s(r);a.then(i,o),c(t,new d(e,n,a))})}function c(t,e){for(;3===t._83;)t=t._18;if(s._47&&s._47(t),0===t._83)return 0===t._75?(t._75=1,void(t._38=e)):1===t._75?(t._75=2,void(t._38=[t._38,e])):void t._38.push(e);l(t,e)}function l(t,e){m(function(){var n=1===t._83?e.onFulfilled:e.onRejected;if(null===n)return void(1===t._83?h(e.promise,t._18):f(e.promise,t._18));var r=o(n,t._18);r===v?f(e.promise,g):h(e.promise,r)})}function h(t,e){if(e===t)return f(t,new TypeError("A promise cannot be resolved with itself."));if(e&&("object"===typeof e||"function"===typeof e)){var n=i(e);if(n===v)return f(t,g);if(n===t.then&&e instanceof s)return t._83=3,t._18=e,void p(t);if("function"===typeof n)return void y(n.bind(e),t)}t._83=1,t._18=e,p(t)}function f(t,e){t._83=2,t._18=e,s._71&&s._71(t,e),p(t)}function p(t){if(1===t._75&&(c(t,t._38),t._38=null),2===t._75){for(var e=0;e<t._38.length;e++)c(t,t._38[e]);t._38=null}}function d(t,e,n){this.onFulfilled="function"===typeof t?t:null,this.onRejected="function"===typeof e?e:null,this.promise=n}function y(t,e){var n=!1,r=a(t,function(t){n||(n=!0,h(e,t))},function(t){n||(n=!0,f(e,t))});n||r!==v||(n=!0,f(e,g))}var m=n(17),g=null,v={};t.exports=s,s._47=null,s._71=null,s._44=r,s.prototype.then=function(t,e){if(this.constructor!==s)return u(this,t,e);var n=new s(r);return c(this,new d(t,e,n)),n}},function(t,e){!function(t){"use strict";function e(t){if("string"!==typeof t&&(t=String(t)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(t))throw new TypeError("Invalid character in header field name");return t.toLowerCase()}function n(t){return"string"!==typeof t&&(t=String(t)),t}function r(t){var e={next:function(){var e=t.shift();return{done:void 0===e,value:e}}};return g.iterable&&(e[Symbol.iterator]=function(){return e}),e}function i(t){this.map={},t instanceof i?t.forEach(function(t,e){this.append(e,t)},this):Array.isArray(t)?t.forEach(function(t){this.append(t[0],t[1])},this):t&&Object.getOwnPropertyNames(t).forEach(function(e){this.append(e,t[e])},this)}function o(t){if(t.bodyUsed)return Promise.reject(new TypeError("Already read"));t.bodyUsed=!0}function a(t){return new Promise(function(e,n){t.onload=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function s(t){var e=new FileReader,n=a(e);return e.readAsArrayBuffer(t),n}function u(t){var e=new FileReader,n=a(e);return e.readAsText(t),n}function c(t){for(var e=new Uint8Array(t),n=new Array(e.length),r=0;r<e.length;r++)n[r]=String.fromCharCode(e[r]);return n.join("")}function l(t){if(t.slice)return t.slice(0);var e=new Uint8Array(t.byteLength);return e.set(new Uint8Array(t)),e.buffer}function h(){return this.bodyUsed=!1,this._initBody=function(t){if(this._bodyInit=t,t)if("string"===typeof t)this._bodyText=t;else if(g.blob&&Blob.prototype.isPrototypeOf(t))this._bodyBlob=t;else if(g.formData&&FormData.prototype.isPrototypeOf(t))this._bodyFormData=t;else if(g.searchParams&&URLSearchParams.prototype.isPrototypeOf(t))this._bodyText=t.toString();else if(g.arrayBuffer&&g.blob&&b(t))this._bodyArrayBuffer=l(t.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!g.arrayBuffer||!ArrayBuffer.prototype.isPrototypeOf(t)&&!_(t))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=l(t)}else this._bodyText="";this.headers.get("content-type")||("string"===typeof t?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):g.searchParams&&URLSearchParams.prototype.isPrototypeOf(t)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},g.blob&&(this.blob=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?o(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(s)}),this.text=function(){var t=o(this);if(t)return t;if(this._bodyBlob)return u(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(c(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},g.formData&&(this.formData=function(){return this.text().then(d)}),this.json=function(){return this.text().then(JSON.parse)},this}function f(t){var e=t.toUpperCase();return w.indexOf(e)>-1?e:t}function p(t,e){e=e||{};var n=e.body;if(t instanceof p){if(t.bodyUsed)throw new TypeError("Already read");this.url=t.url,this.credentials=t.credentials,e.headers||(this.headers=new i(t.headers)),this.method=t.method,this.mode=t.mode,n||null==t._bodyInit||(n=t._bodyInit,t.bodyUsed=!0)}else this.url=String(t);if(this.credentials=e.credentials||this.credentials||"omit",!e.headers&&this.headers||(this.headers=new i(e.headers)),this.method=f(e.method||this.method||"GET"),this.mode=e.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&n)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(n)}function d(t){var e=new FormData;return t.trim().split("&").forEach(function(t){if(t){var n=t.split("="),r=n.shift().replace(/\+/g," "),i=n.join("=").replace(/\+/g," ");e.append(decodeURIComponent(r),decodeURIComponent(i))}}),e}function y(t){var e=new i;return t.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var n=t.split(":"),r=n.shift().trim();if(r){var i=n.join(":").trim();e.append(r,i)}}),e}function m(t,e){e||(e={}),this.type="default",this.status=void 0===e.status?200:e.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in e?e.statusText:"OK",this.headers=new i(e.headers),this.url=e.url||"",this._initBody(t)}if(!t.fetch){var g={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(t){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(g.arrayBuffer)var v=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],b=function(t){return t&&DataView.prototype.isPrototypeOf(t)},_=ArrayBuffer.isView||function(t){return t&&v.indexOf(Object.prototype.toString.call(t))>-1};i.prototype.append=function(t,r){t=e(t),r=n(r);var i=this.map[t];this.map[t]=i?i+","+r:r},i.prototype.delete=function(t){delete this.map[e(t)]},i.prototype.get=function(t){return t=e(t),this.has(t)?this.map[t]:null},i.prototype.has=function(t){return this.map.hasOwnProperty(e(t))},i.prototype.set=function(t,r){this.map[e(t)]=n(r)},i.prototype.forEach=function(t,e){for(var n in this.map)this.map.hasOwnProperty(n)&&t.call(e,this.map[n],n,this)},i.prototype.keys=function(){var t=[];return this.forEach(function(e,n){t.push(n)}),r(t)},i.prototype.values=function(){var t=[];return this.forEach(function(e){t.push(e)}),r(t)},i.prototype.entries=function(){var t=[];return this.forEach(function(e,n){t.push([n,e])}),r(t)},g.iterable&&(i.prototype[Symbol.iterator]=i.prototype.entries);var w=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];p.prototype.clone=function(){return new p(this,{body:this._bodyInit})},h.call(p.prototype),h.call(m.prototype),m.prototype.clone=function(){return new m(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new i(this.headers),url:this.url})},m.error=function(){var t=new m(null,{status:0,statusText:""});return t.type="error",t};var E=[301,302,303,307,308];m.redirect=function(t,e){if(-1===E.indexOf(e))throw new RangeError("Invalid status code");return new m(null,{status:e,headers:{location:t}})},t.Headers=i,t.Request=p,t.Response=m,t.fetch=function(t,e){return new Promise(function(n,r){var i=new p(t,e),o=new XMLHttpRequest;o.onload=function(){var t={status:o.status,statusText:o.statusText,headers:y(o.getAllResponseHeaders()||"")};t.url="responseURL"in o?o.responseURL:t.headers.get("X-Request-URL");var e="response"in o?o.response:o.responseText;n(new m(e,t))},o.onerror=function(){r(new TypeError("Network request failed"))},o.ontimeout=function(){r(new TypeError("Network request failed"))},o.open(i.method,i.url,!0),"include"===i.credentials?o.withCredentials=!0:"omit"===i.credentials&&(o.withCredentials=!1),"responseType"in o&&g.blob&&(o.responseType="blob"),i.headers.forEach(function(t,e){o.setRequestHeader(e,t)}),o.send("undefined"===typeof i._bodyInit?null:i._bodyInit)})},t.fetch.polyfill=!0}}("undefined"!==typeof self?self:this)},function(t,e,n){"use strict";function r(t,e,n,r,o,a,s,u){if(i(e),!t){var c;if(void 0===e)c=new Error("Minified exception occurred; use the non-minified dev environment for the full error message and additional helpful warnings.");else{var l=[n,r,o,a,s,u],h=0;c=new Error(e.replace(/%s/g,function(){return l[h++]})),c.name="Invariant Violation"}throw c.framesToPop=1,c}}var i=function(t){};t.exports=r},function(t,e,n){"use strict";var r={};t.exports=r},function(t,e,n){"use strict";function r(t){return function(){return t}}var i=function(){};i.thatReturns=r,i.thatReturnsFalse=r(!1),i.thatReturnsTrue=r(!0),i.thatReturnsNull=r(null),i.thatReturnsThis=function(){return this},i.thatReturnsArgument=function(t){return t},t.exports=i},function(t,e,n){"use strict";function r(t){return function(){var e=t.apply(this,arguments);return new Promise(function(t,n){function r(i,o){try{var a=e[i](o),s=a.value}catch(t){return void n(t)}if(!a.done)return Promise.resolve(s).then(function(t){r("next",t)},function(t){r("throw",t)});t(s)}return r("next")})}}n.d(e,"a",function(){return c}),n.d(e,"b",function(){return l});var i=n(33),o=n.n(i),a=n(36),s=n.n(a),u=this,c=function(){s.a.initializeApp({messagingSenderId:"777608841115"}),navigator.serviceWorker.register("https://leocardoso94.github.io/push-notification-demo/firebase-messaging-sw.js").then(function(t){s.a.messaging().useServiceWorker(t)}).catch(console.error)},l=function(){var t=r(o.a.mark(function t(){var e,n;return o.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.prev=0,e=s.a.messaging(),t.next=4,e.requestPermission();case 4:return t.next=6,e.getToken();case 6:return n=t.sent,console.log("token do usu\xe1rio: ",n),t.abrupt("return",n);case 11:t.prev=11,t.t0=t.catch(0),console.error(t.t0);case 14:case"end":return t.stop()}},t,u,[[0,11]])}));return function(){return t.apply(this,arguments)}}()},function(t,e){function n(){throw new Error("setTimeout has not been defined")}function r(){throw new Error("clearTimeout has not been defined")}function i(t){if(l===setTimeout)return setTimeout(t,0);if((l===n||!l)&&setTimeout)return l=setTimeout,setTimeout(t,0);try{return l(t,0)}catch(e){try{return l.call(null,t,0)}catch(e){return l.call(this,t,0)}}}function o(t){if(h===clearTimeout)return clearTimeout(t);if((h===r||!h)&&clearTimeout)return h=clearTimeout,clearTimeout(t);try{return h(t)}catch(e){try{return h.call(null,t)}catch(e){return h.call(this,t)}}}function a(){y&&p&&(y=!1,p.length?d=p.concat(d):m=-1,d.length&&s())}function s(){if(!y){var t=i(a);y=!0;for(var e=d.length;e;){for(p=d,d=[];++m<e;)p&&p[m].run();m=-1,e=d.length}p=null,y=!1,o(t)}}function u(t,e){this.fun=t,this.array=e}function c(){}var l,h,f=t.exports={};!function(){try{l="function"===typeof setTimeout?setTimeout:n}catch(t){l=n}try{h="function"===typeof clearTimeout?clearTimeout:r}catch(t){h=r}}();var p,d=[],y=!1,m=-1;f.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)e[n-1]=arguments[n];d.push(new u(t,e)),1!==d.length||y||i(s)},u.prototype.run=function(){this.fun.apply(null,this.array)},f.title="browser",f.browser=!0,f.env={},f.argv=[],f.version="",f.versions={},f.on=c,f.addListener=c,f.once=c,f.off=c,f.removeListener=c,f.removeAllListeners=c,f.emit=c,f.prependListener=c,f.prependOnceListener=c,f.listeners=function(t){return[]},f.binding=function(t){throw new Error("process.binding is not supported")},f.cwd=function(){return"/"},f.chdir=function(t){throw new Error("process.chdir is not supported")},f.umask=function(){return 0}},function(t,e,n){"use strict";function r(t){o.forEach(function(e){e.logLevel=t})}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"setLogLevel",function(){return r}),n.d(e,"Logger",function(){return u}),n.d(e,"LogLevel",function(){return i});var i,o=[];!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(i||(i={}));var a=i.INFO,s=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(e<t.logLevel)){var o=(new Date).toISOString();switch(e){case i.DEBUG:case i.VERBOSE:console.log.apply(console,["["+o+"] "+t.name+":"].concat(n));break;case i.INFO:console.info.apply(console,["["+o+"] "+t.name+":"].concat(n));break;case i.WARN:console.warn.apply(console,["["+o+"] "+t.name+":"].concat(n));break;case i.ERROR:console.error.apply(console,["["+o+"] "+t.name+":"].concat(n));break;default:throw new Error("Attempted to log a message with an invalid logType (value: "+e+")")}}},u=function(){function t(t){this.name=t,this._logLevel=a,this._logHandler=s,o.push(this)}return Object.defineProperty(t.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in i))throw new TypeError("Invalid value assigned to `logLevel`");this._logLevel=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"logHandler",{get:function(){return this._logHandler},set:function(t){if("function"!==typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t},enumerable:!0,configurable:!0}),t.prototype.debug=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,i.DEBUG].concat(t))},t.prototype.log=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,i.VERBOSE].concat(t))},t.prototype.info=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,i.INFO].concat(t))},t.prototype.warn=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,i.WARN].concat(t))},t.prototype.error=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];this._logHandler.apply(this,[this,i.ERROR].concat(t))},t}()},function(t,e,n){n(15),t.exports=n(19)},function(t,e,n){"use strict";"undefined"===typeof Promise&&(n(16).enable(),window.Promise=n(18)),n(7),Object.assign=n(3)},function(t,e,n){"use strict";function r(){c=!1,s._47=null,s._71=null}function i(t){function e(e){(t.allRejections||a(h[e].error,t.whitelist||u))&&(h[e].displayId=l++,t.onUnhandled?(h[e].logged=!0,t.onUnhandled(h[e].displayId,h[e].error)):(h[e].logged=!0,o(h[e].displayId,h[e].error)))}function n(e){h[e].logged&&(t.onHandled?t.onHandled(h[e].displayId,h[e].error):h[e].onUnhandled||(console.warn("Promise Rejection Handled (id: "+h[e].displayId+"):"),console.warn(' This means you can ignore any previous messages of the form "Possible Unhandled Promise Rejection" with id '+h[e].displayId+".")))}t=t||{},c&&r(),c=!0;var i=0,l=0,h={};s._47=function(t){2===t._83&&h[t._56]&&(h[t._56].logged?n(t._56):clearTimeout(h[t._56].timeout),delete h[t._56])},s._71=function(t,n){0===t._75&&(t._56=i++,h[t._56]={displayId:null,error:n,timeout:setTimeout(e.bind(null,t._56),a(n,u)?100:2e3),logged:!1})}}function o(t,e){console.warn("Possible Unhandled Promise Rejection (id: "+t+"):"),((e&&(e.stack||e))+"").split("\n").forEach(function(t){console.warn(" "+t)})}function a(t,e){return e.some(function(e){return t instanceof e})}var s=n(6),u=[ReferenceError,TypeError,RangeError],c=!1;e.disable=r,e.enable=i},function(t,e,n){"use strict";(function(e){function n(t){a.length||(o(),s=!0),a[a.length]=t}function r(){for(;u<a.length;){var t=u;if(u+=1,a[t].call(),u>c){for(var e=0,n=a.length-u;e<n;e++)a[e]=a[e+u];a.length-=u,u=0}}a.length=0,u=0,s=!1}function i(t){return function(){function e(){clearTimeout(n),clearInterval(r),t()}var n=setTimeout(e,0),r=setInterval(e,50)}}t.exports=n;var o,a=[],s=!1,u=0,c=1024,l="undefined"!==typeof e?e:self,h=l.MutationObserver||l.WebKitMutationObserver;o="function"===typeof h?function(t){var e=1,n=new h(t),r=document.createTextNode("");return n.observe(r,{characterData:!0}),function(){e=-e,r.data=e}}(r):i(r),n.requestFlush=o,n.makeRequestCallFromTimer=i}).call(e,n(1))},function(t,e,n){"use strict";function r(t){var e=new i(i._44);return e._83=1,e._18=t,e}var i=n(6);t.exports=i;var o=r(!0),a=r(!1),s=r(null),u=r(void 0),c=r(0),l=r("");i.resolve=function(t){if(t instanceof i)return t;if(null===t)return s;if(void 0===t)return u;if(!0===t)return o;if(!1===t)return a;if(0===t)return c;if(""===t)return l;if("object"===typeof t||"function"===typeof t)try{var e=t.then;if("function"===typeof e)return new i(e.bind(t))}catch(t){return new i(function(e,n){n(t)})}return r(t)},i.all=function(t){var e=Array.prototype.slice.call(t);return new i(function(t,n){function r(a,s){if(s&&("object"===typeof s||"function"===typeof s)){if(s instanceof i&&s.then===i.prototype.then){for(;3===s._83;)s=s._18;return 1===s._83?r(a,s._18):(2===s._83&&n(s._18),void s.then(function(t){r(a,t)},n))}var u=s.then;if("function"===typeof u){return void new i(u.bind(s)).then(function(t){r(a,t)},n)}}e[a]=s,0===--o&&t(e)}if(0===e.length)return t([]);for(var o=e.length,a=0;a<e.length;a++)r(a,e[a])})},i.reject=function(t){return new i(function(e,n){n(t)})},i.race=function(t){return new i(function(e,n){t.forEach(function(t){i.resolve(t).then(e,n)})})},i.prototype.catch=function(t){return this.then(null,t)}},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),i=n.n(r),o=n(21),a=n.n(o),s=n(29),u=(n.n(s),n(30)),c=n(47),l=n(11);a.a.render(i.a.createElement(u.a,null),document.getElementById("root")),Object(c.a)(),Object(l.a)()},function(t,e,n){"use strict";function r(t){for(var e=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=0;r<e;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);v(!1,"Minified React error #"+t+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}function i(t,e,n){this.props=t,this.context=e,this.refs=b,this.updater=n||D}function o(){}function a(t,e,n){this.props=t,this.context=e,this.refs=b,this.updater=n||D}function s(t,e,n){var r=void 0,i={},o=null,a=null;if(null!=e)for(r in void 0!==e.ref&&(a=e.ref),void 0!==e.key&&(o=""+e.key),e)L.call(e,r)&&!M.hasOwnProperty(r)&&(i[r]=e[r]);var s=arguments.length-2;if(1===s)i.children=n;else if(1<s){for(var u=Array(s),c=0;c<s;c++)u[c]=arguments[c+2];i.children=u}if(t&&t.defaultProps)for(r in s=t.defaultProps)void 0===i[r]&&(i[r]=s[r]);return{$$typeof:E,type:t,key:o,ref:a,props:i,_owner:x.current}}function u(t){return"object"===typeof t&&null!==t&&t.$$typeof===E}function c(t){var e={"=":"=0",":":"=2"};return"$"+(""+t).replace(/[=:]/g,function(t){return e[t]})}function l(t,e,n,r){if(U.length){var i=U.pop();return i.result=t,i.keyPrefix=e,i.func=n,i.context=r,i.count=0,i}return{result:t,keyPrefix:e,func:n,context:r,count:0}}function h(t){t.result=null,t.keyPrefix=null,t.func=null,t.context=null,t.count=0,10>U.length&&U.push(t)}function f(t,e,n,i){var o=typeof t;"undefined"!==o&&"boolean"!==o||(t=null);var a=!1;if(null===t)a=!0;else switch(o){case"string":case"number":a=!0;break;case"object":switch(t.$$typeof){case E:case T:a=!0}}if(a)return n(i,t,""===e?"."+p(t,0):e),1;if(a=0,e=""===e?".":e+":",Array.isArray(t))for(var s=0;s<t.length;s++){o=t[s];var u=e+p(o,s);a+=f(o,u,n,i)}else if(null===t||"undefined"===typeof t?u=null:(u=O&&t[O]||t["@@iterator"],u="function"===typeof u?u:null),"function"===typeof u)for(t=u.call(t),s=0;!(o=t.next()).done;)o=o.value,u=e+p(o,s++),a+=f(o,u,n,i);else"object"===o&&(n=""+t,r("31","[object Object]"===n?"object with keys {"+Object.keys(t).join(", ")+"}":n,""));return a}function p(t,e){return"object"===typeof t&&null!==t&&null!=t.key?c(t.key):e.toString(36)}function d(t,e){t.func.call(t.context,e,t.count++)}function y(t,e,n){var r=t.result,i=t.keyPrefix;t=t.func.call(t.context,e,t.count++),Array.isArray(t)?m(t,r,n,_.thatReturnsArgument):null!=t&&(u(t)&&(e=i+(!t.key||e&&e.key===t.key?"":(""+t.key).replace(F,"$&/")+"/")+n,t={$$typeof:E,type:t.type,key:e,ref:t.ref,props:t.props,_owner:t._owner}),r.push(t))}function m(t,e,n,r,i){var o="";null!=n&&(o=(""+n).replace(F,"$&/")+"/"),e=l(e,o,r,i),null==t||f(t,"",y,e),h(e)}var g=n(3),v=n(8),b=n(9),_=n(10),w="function"===typeof Symbol&&Symbol.for,E=w?Symbol.for("react.element"):60103,T=w?Symbol.for("react.portal"):60106,S=w?Symbol.for("react.fragment"):60107,C=w?Symbol.for("react.strict_mode"):60108,I=w?Symbol.for("react.profiler"):60114,N=w?Symbol.for("react.provider"):60109,k=w?Symbol.for("react.context"):60110,A=w?Symbol.for("react.async_mode"):60111,R=w?Symbol.for("react.forward_ref"):60112;w&&Symbol.for("react.timeout");var O="function"===typeof Symbol&&Symbol.iterator,D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}};i.prototype.isReactComponent={},i.prototype.setState=function(t,e){"object"!==typeof t&&"function"!==typeof t&&null!=t&&r("85"),this.updater.enqueueSetState(this,t,e,"setState")},i.prototype.forceUpdate=function(t){this.updater.enqueueForceUpdate(this,t,"forceUpdate")},o.prototype=i.prototype;var P=a.prototype=new o;P.constructor=a,g(P,i.prototype),P.isPureReactComponent=!0;var x={current:null},L=Object.prototype.hasOwnProperty,M={key:!0,ref:!0,__self:!0,__source:!0},F=/\/+/g,U=[],B={Children:{map:function(t,e,n){if(null==t)return t;var r=[];return m(t,r,null,e,n),r},forEach:function(t,e,n){if(null==t)return t;e=l(null,null,e,n),null==t||f(t,"",d,e),h(e)},count:function(t){return null==t?0:f(t,"",_.thatReturnsNull,null)},toArray:function(t){var e=[];return m(t,e,null,_.thatReturnsArgument),e},only:function(t){return u(t)||r("143"),t}},createRef:function(){return{current:null}},Component:i,PureComponent:a,createContext:function(t,e){return void 0===e&&(e=null),t={$$typeof:k,_calculateChangedBits:e,_defaultValue:t,_currentValue:t,_currentValue2:t,_changedBits:0,_changedBits2:0,Provider:null,Consumer:null},t.Provider={$$typeof:N,_context:t},t.Consumer=t},forwardRef:function(t){return{$$typeof:R,render:t}},Fragment:S,StrictMode:C,unstable_AsyncMode:A,unstable_Profiler:I,createElement:s,cloneElement:function(t,e,n){(null===t||void 0===t)&&r("267",t);var i=void 0,o=g({},t.props),a=t.key,s=t.ref,u=t._owner;if(null!=e){void 0!==e.ref&&(s=e.ref,u=x.current),void 0!==e.key&&(a=""+e.key);var c=void 0;t.type&&t.type.defaultProps&&(c=t.type.defaultProps);for(i in e)L.call(e,i)&&!M.hasOwnProperty(i)&&(o[i]=void 0===e[i]&&void 0!==c?c[i]:e[i])}if(1===(i=arguments.length-2))o.children=n;else if(1<i){c=Array(i);for(var l=0;l<i;l++)c[l]=arguments[l+2];o.children=c}return{$$typeof:E,type:t.type,key:a,ref:s,props:o,_owner:u}},createFactory:function(t){var e=s.bind(null,t);return e.type=t,e},isValidElement:u,version:"16.4.0",__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{ReactCurrentOwner:x,assign:g}},V={default:B},j=V&&B||V;t.exports=j.default?j.default:j},function(t,e,n){"use strict";function r(){if("undefined"!==typeof __REACT_DEVTOOLS_GLOBAL_HOOK__&&"function"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE)try{__REACT_DEVTOOLS_GLOBAL_HOOK__.checkDCE(r)}catch(t){console.error(t)}}r(),t.exports=n(22)},function(t,e,n){"use strict";function r(t){for(var e=arguments.length-1,n="https://reactjs.org/docs/error-decoder.html?invariant="+t,r=0;r<e;r++)n+="&args[]="+encodeURIComponent(arguments[r+1]);Pr(!1,"Minified React error #"+t+"; visit %s for the full message or use the non-minified dev environment for full errors and additional helpful warnings. ",n)}function i(t,e,n,r,i,o,a,s,u){this._hasCaughtError=!1,this._caughtError=null;var c=Array.prototype.slice.call(arguments,3);try{e.apply(n,c)}catch(t){this._caughtError=t,this._hasCaughtError=!0}}function o(){if(qr._hasRethrowError){var t=qr._rethrowError;throw qr._rethrowError=null,qr._hasRethrowError=!1,t}}function a(){if(Wr)for(var t in Kr){var e=Kr[t],n=Wr.indexOf(t);if(-1<n||r("96",t),!Hr[n]){e.extractEvents||r("97",t),Hr[n]=e,n=e.eventTypes;for(var i in n){var o=void 0,a=n[i],u=e,c=i;Gr.hasOwnProperty(c)&&r("99",c),Gr[c]=a;var l=a.phasedRegistrationNames;if(l){for(o in l)l.hasOwnProperty(o)&&s(l[o],u,c);o=!0}else a.registrationName?(s(a.registrationName,u,c),o=!0):o=!1;o||r("98",i,t)}}}}function s(t,e,n){Qr[t]&&r("100",t),Qr[t]=e,zr[t]=e.eventTypes[n].dependencies}function u(t){Wr&&r("101"),Wr=Array.prototype.slice.call(t),a()}function c(t){var e,n=!1;for(e in t)if(t.hasOwnProperty(e)){var i=t[e];Kr.hasOwnProperty(e)&&Kr[e]===i||(Kr[e]&&r("102",e),Kr[e]=i,n=!0)}n&&a()}function l(t,e,n,r){e=t.type||"unknown-event",t.currentTarget=$r(r),qr.invokeGuardedCallbackAndCatchFirstError(e,n,void 0,t),t.currentTarget=null}function h(t,e){return null==e&&r("30"),null==t?e:Array.isArray(t)?Array.isArray(e)?(t.push.apply(t,e),t):(t.push(e),t):Array.isArray(e)?[t].concat(e):[t,e]}function f(t,e,n){Array.isArray(t)?t.forEach(e,n):t&&e.call(n,t)}function p(t,e){if(t){var n=t._dispatchListeners,r=t._dispatchInstances;if(Array.isArray(n))for(var i=0;i<n.length&&!t.isPropagationStopped();i++)l(t,e,n[i],r[i]);else n&&l(t,e,n,r);t._dispatchListeners=null,t._dispatchInstances=null,t.isPersistent()||t.constructor.release(t)}}function d(t){return p(t,!0)}function y(t){return p(t,!1)}function m(t,e){var n=t.stateNode;if(!n)return null;var i=Xr(n);if(!i)return null;n=i[e];t:switch(e){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":(i=!i.disabled)||(t=t.type,i=!("button"===t||"input"===t||"select"===t||"textarea"===t)),t=!i;break t;default:t=!1}return t?null:(n&&"function"!==typeof n&&r("231",e,typeof n),n)}function g(t,e){null!==t&&(Zr=h(Zr,t)),t=Zr,Zr=null,t&&(e?f(t,d):f(t,y),Zr&&r("95"),qr.rethrowCaughtError())}function v(t,e,n,r){for(var i=null,o=0;o<Hr.length;o++){var a=Hr[o];a&&(a=a.extractEvents(t,e,n,r))&&(i=h(i,a))}g(i,!1)}function b(t){if(t[ri])return t[ri];for(;!t[ri];){if(!t.parentNode)return null;t=t.parentNode}return t=t[ri],5===t.tag||6===t.tag?t:null}function _(t){if(5===t.tag||6===t.tag)return t.stateNode;r("33")}function w(t){return t[ii]||null}function E(t){do{t=t.return}while(t&&5!==t.tag);return t||null}function T(t,e,n){for(var r=[];t;)r.push(t),t=E(t);for(t=r.length;0<t--;)e(r[t],"captured",n);for(t=0;t<r.length;t++)e(r[t],"bubbled",n)}function S(t,e,n){(e=m(t,n.dispatchConfig.phasedRegistrationNames[e]))&&(n._dispatchListeners=h(n._dispatchListeners,e),n._dispatchInstances=h(n._dispatchInstances,t))}function C(t){t&&t.dispatchConfig.phasedRegistrationNames&&T(t._targetInst,S,t)}function I(t){if(t&&t.dispatchConfig.phasedRegistrationNames){var e=t._targetInst;e=e?E(e):null,T(e,S,t)}}function N(t,e,n){t&&n&&n.dispatchConfig.registrationName&&(e=m(t,n.dispatchConfig.registrationName))&&(n._dispatchListeners=h(n._dispatchListeners,e),n._dispatchInstances=h(n._dispatchInstances,t))}function k(t){t&&t.dispatchConfig.registrationName&&N(t._targetInst,null,t)}function A(t){f(t,C)}function R(t,e,n,r){if(n&&r)t:{for(var i=n,o=r,a=0,s=i;s;s=E(s))a++;s=0;for(var u=o;u;u=E(u))s++;for(;0<a-s;)i=E(i),a--;for(;0<s-a;)o=E(o),s--;for(;a--;){if(i===o||i===o.alternate)break t;i=E(i),o=E(o)}i=null}else i=null;for(o=i,i=[];n&&n!==o&&(null===(a=n.alternate)||a!==o);)i.push(n),n=E(n);for(n=[];r&&r!==o&&(null===(a=r.alternate)||a!==o);)n.push(r),r=E(r);for(r=0;r<i.length;r++)N(i[r],"bubbled",t);for(t=n.length;0<t--;)N(n[t],"captured",e)}function O(t,e){var n={};return n[t.toLowerCase()]=e.toLowerCase(),n["Webkit"+t]="webkit"+e,n["Moz"+t]="moz"+e,n["ms"+t]="MS"+e,n["O"+t]="o"+e.toLowerCase(),n}function D(t){if(ui[t])return ui[t];if(!si[t])return t;var e,n=si[t];for(e in n)if(n.hasOwnProperty(e)&&e in ci)return ui[t]=n[e];return t}function P(){return!yi&&Lr.canUseDOM&&(yi="textContent"in document.documentElement?"textContent":"innerText"),yi}function x(){if(mi._fallbackText)return mi._fallbackText;var t,e,n=mi._startText,r=n.length,i=L(),o=i.length;for(t=0;t<r&&n[t]===i[t];t++);var a=r-t;for(e=1;e<=a&&n[r-e]===i[o-e];e++);return mi._fallbackText=i.slice(t,1<e?1-e:void 0),mi._fallbackText}function L(){return"value"in mi._root?mi._root.value:mi._root[P()]}function M(t,e,n,r){this.dispatchConfig=t,this._targetInst=e,this.nativeEvent=n,t=this.constructor.Interface;for(var i in t)t.hasOwnProperty(i)&&((e=t[i])?this[i]=e(n):"target"===i?this.target=r:this[i]=n[i]);return this.isDefaultPrevented=(null!=n.defaultPrevented?n.defaultPrevented:!1===n.returnValue)?Fr.thatReturnsTrue:Fr.thatReturnsFalse,this.isPropagationStopped=Fr.thatReturnsFalse,this}function F(t,e,n,r){if(this.eventPool.length){var i=this.eventPool.pop();return this.call(i,t,e,n,r),i}return new this(t,e,n,r)}function U(t){t instanceof this||r("223"),t.destructor(),10>this.eventPool.length&&this.eventPool.push(t)}function B(t){t.eventPool=[],t.getPooled=F,t.release=U}function V(t,e){switch(t){case"keyup":return-1!==wi.indexOf(e.keyCode);case"keydown":return 229!==e.keyCode;case"keypress":case"mousedown":case"blur":return!0;default:return!1}}function j(t){return t=t.detail,"object"===typeof t&&"data"in t?t.data:null}function q(t,e){switch(t){case"compositionend":return j(e);case"keypress":return 32!==e.which?null:(ki=!0,Ii);case"textInput":return t=e.data,t===Ii&&ki?null:t;default:return null}}function W(t,e){if(Ai)return"compositionend"===t||!Ei&&V(t,e)?(t=x(),mi._root=null,mi._startText=null,mi._fallbackText=null,Ai=!1,t):null;switch(t){case"paste":return null;case"keypress":if(!(e.ctrlKey||e.altKey||e.metaKey)||e.ctrlKey&&e.altKey){if(e.char&&1<e.char.length)return e.char;if(e.which)return String.fromCharCode(e.which)}return null;case"compositionend":return Ci?null:e.data;default:return null}}function K(t){if(t=Jr(t)){Oi&&"function"===typeof Oi.restoreControlledState||r("194");var e=Xr(t.stateNode);Oi.restoreControlledState(t.stateNode,t.type,e)}}function H(t){Pi?xi?xi.push(t):xi=[t]:Pi=t}function G(){return null!==Pi||null!==xi}function Q(){if(Pi){var t=Pi,e=xi;if(xi=Pi=null,K(t),e)for(t=0;t<e.length;t++)K(e[t])}}function z(t,e){return t(e)}function Y(t,e,n){return t(e,n)}function X(){}function J(t,e){if(Mi)return t(e);Mi=!0;try{return z(t,e)}finally{Mi=!1,G()&&(X(),Q())}}function $(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return"input"===e?!!Fi[t.type]:"textarea"===e}function Z(t){return t=t.target||window,t.correspondingUseElement&&(t=t.correspondingUseElement),3===t.nodeType?t.parentNode:t}function tt(t,e){return!(!Lr.canUseDOM||e&&!("addEventListener"in document))&&(t="on"+t,e=t in document,e||(e=document.createElement("div"),e.setAttribute(t,"return;"),e="function"===typeof e[t]),e)}function et(t){var e=t.type;return(t=t.nodeName)&&"input"===t.toLowerCase()&&("checkbox"===e||"radio"===e)}function nt(t){var e=et(t)?"checked":"value",n=Object.getOwnPropertyDescriptor(t.constructor.prototype,e),r=""+t[e];if(!t.hasOwnProperty(e)&&"undefined"!==typeof n&&"function"===typeof n.get&&"function"===typeof n.set){var i=n.get,o=n.set;return Object.defineProperty(t,e,{configurable:!0,get:function(){return i.call(this)},set:function(t){r=""+t,o.call(this,t)}}),Object.defineProperty(t,e,{enumerable:n.enumerable}),{getValue:function(){return r},setValue:function(t){r=""+t},stopTracking:function(){t._valueTracker=null,delete t[e]}}}}function rt(t){t._valueTracker||(t._valueTracker=nt(t))}function it(t){if(!t)return!1;var e=t._valueTracker;if(!e)return!0;var n=e.getValue(),r="";return t&&(r=et(t)?t.checked?"true":"false":t.value),(t=r)!==n&&(e.setValue(t),!0)}function ot(t){return null===t||"undefined"===typeof t?null:(t=Xi&&t[Xi]||t["@@iterator"],"function"===typeof t?t:null)}function at(t){var e=t.type;if("function"===typeof e)return e.displayName||e.name;if("string"===typeof e)return e;switch(e){case Qi:return"AsyncMode";case Gi:return"Context.Consumer";case qi:return"ReactFragment";case ji:return"ReactPortal";case Ki:return"Profiler("+t.pendingProps.id+")";case Hi:return"Context.Provider";case Wi:return"StrictMode";case Yi:return"Timeout"}if("object"===typeof e&&null!==e)switch(e.$$typeof){case zi:return t=e.render.displayName||e.render.name||"",""!==t?"ForwardRef("+t+")":"ForwardRef"}return null}function st(t){var e="";do{t:switch(t.tag){case 0:case 1:case 2:case 5:var n=t._debugOwner,r=t._debugSource,i=at(t),o=null;n&&(o=at(n)),n=r,i="\n in "+(i||"Unknown")+(n?" (at "+n.fileName.replace(/^.*[\\\/]/,"")+":"+n.lineNumber+")":o?" (created by "+o+")":"");break t;default:i=""}e+=i,t=t.return}while(t);return e}function ut(t){return!!Zi.hasOwnProperty(t)||!$i.hasOwnProperty(t)&&(Ji.test(t)?Zi[t]=!0:($i[t]=!0,!1))}function ct(t,e,n,r){if(null!==n&&0===n.type)return!1;switch(typeof e){case"function":case"symbol":return!0;case"boolean":return!r&&(null!==n?!n.acceptsBooleans:"data-"!==(t=t.toLowerCase().slice(0,5))&&"aria-"!==t);default:return!1}}function lt(t,e,n,r){if(null===e||"undefined"===typeof e||ct(t,e,n,r))return!0;if(r)return!1;if(null!==n)switch(n.type){case 3:return!e;case 4:return!1===e;case 5:return isNaN(e);case 6:return isNaN(e)||1>e}return!1}function ht(t,e,n,r,i){this.acceptsBooleans=2===e||3===e||4===e,this.attributeName=r,this.attributeNamespace=i,this.mustUseProperty=n,this.propertyName=t,this.type=e}function ft(t){return t[1].toUpperCase()}function pt(t,e,n,r){var i=to.hasOwnProperty(e)?to[e]:null;(null!==i?0===i.type:!r&&(2<e.length&&("o"===e[0]||"O"===e[0])&&("n"===e[1]||"N"===e[1])))||(lt(e,n,i,r)&&(n=null),r||null===i?ut(e)&&(null===n?t.removeAttribute(e):t.setAttribute(e,""+n)):i.mustUseProperty?t[i.propertyName]=null===n?3!==i.type&&"":n:(e=i.attributeName,r=i.attributeNamespace,null===n?t.removeAttribute(e):(i=i.type,n=3===i||4===i&&!0===n?"":""+n,r?t.setAttributeNS(r,e,n):t.setAttribute(e,n))))}function dt(t,e){var n=e.checked;return Mr({},e,{defaultChecked:void 0,defaultValue:void 0,value:void 0,checked:null!=n?n:t._wrapperState.initialChecked})}function yt(t,e){var n=null==e.defaultValue?"":e.defaultValue,r=null!=e.checked?e.checked:e.defaultChecked;n=_t(null!=e.value?e.value:n),t._wrapperState={initialChecked:r,initialValue:n,controlled:"checkbox"===e.type||"radio"===e.type?null!=e.checked:null!=e.value}}function mt(t,e){null!=(e=e.checked)&&pt(t,"checked",e,!1)}function gt(t,e){mt(t,e);var n=_t(e.value);null!=n&&("number"===e.type?(0===n&&""===t.value||t.value!=n)&&(t.value=""+n):t.value!==""+n&&(t.value=""+n)),e.hasOwnProperty("value")?bt(t,e.type,n):e.hasOwnProperty("defaultValue")&&bt(t,e.type,_t(e.defaultValue)),null==e.checked&&null!=e.defaultChecked&&(t.defaultChecked=!!e.defaultChecked)}function vt(t,e){(e.hasOwnProperty("value")||e.hasOwnProperty("defaultValue"))&&(""===t.value&&(t.value=""+t._wrapperState.initialValue),t.defaultValue=""+t._wrapperState.initialValue),e=t.name,""!==e&&(t.name=""),t.defaultChecked=!t.defaultChecked,t.defaultChecked=!t.defaultChecked,""!==e&&(t.name=e)}function bt(t,e,n){"number"===e&&t.ownerDocument.activeElement===t||(null==n?t.defaultValue=""+t._wrapperState.initialValue:t.defaultValue!==""+n&&(t.defaultValue=""+n))}function _t(t){switch(typeof t){case"boolean":case"number":case"object":case"string":case"undefined":return t;default:return""}}function wt(t,e,n){return t=M.getPooled(no.change,t,e,n),t.type="change",H(n),A(t),t}function Et(t){g(t,!1)}function Tt(t){if(it(_(t)))return t}function St(t,e){if("change"===t)return e}function Ct(){ro&&(ro.detachEvent("onpropertychange",It),io=ro=null)}function It(t){"value"===t.propertyName&&Tt(io)&&(t=wt(io,t,Z(t)),J(Et,t))}function Nt(t,e,n){"focus"===t?(Ct(),ro=e,io=n,ro.attachEvent("onpropertychange",It)):"blur"===t&&Ct()}function kt(t){if("selectionchange"===t||"keyup"===t||"keydown"===t)return Tt(io)}function At(t,e){if("click"===t)return Tt(e)}function Rt(t,e){if("input"===t||"change"===t)return Tt(e)}function Ot(t){var e=this.nativeEvent;return e.getModifierState?e.getModifierState(t):!!(t=uo[t])&&!!e[t]}function Dt(){return Ot}function Pt(t){var e=t;if(t.alternate)for(;e.return;)e=e.return;else{if(0!==(2&e.effectTag))return 1;for(;e.return;)if(e=e.return,0!==(2&e.effectTag))return 1}return 3===e.tag?2:3}function xt(t){2!==Pt(t)&&r("188")}function Lt(t){var e=t.alternate;if(!e)return e=Pt(t),3===e&&r("188"),1===e?null:t;for(var n=t,i=e;;){var o=n.return,a=o?o.alternate:null;if(!o||!a)break;if(o.child===a.child){for(var s=o.child;s;){if(s===n)return xt(o),t;if(s===i)return xt(o),e;s=s.sibling}r("188")}if(n.return!==i.return)n=o,i=a;else{s=!1;for(var u=o.child;u;){if(u===n){s=!0,n=o,i=a;break}if(u===i){s=!0,i=o,n=a;break}u=u.sibling}if(!s){for(u=a.child;u;){if(u===n){s=!0,n=a,i=o;break}if(u===i){s=!0,i=a,n=o;break}u=u.sibling}s||r("189")}}n.alternate!==i&&r("190")}return 3!==n.tag&&r("188"),n.stateNode.current===n?t:e}function Mt(t){if(!(t=Lt(t)))return null;for(var e=t;;){if(5===e.tag||6===e.tag)return e;if(e.child)e.child.return=e,e=e.child;else{if(e===t)break;for(;!e.sibling;){if(!e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}}return null}function Ft(t){if(!(t=Lt(t)))return null;for(var e=t;;){if(5===e.tag||6===e.tag)return e;if(e.child&&4!==e.tag)e.child.return=e,e=e.child;else{if(e===t)break;for(;!e.sibling;){if(!e.return||e.return===t)return null;e=e.return}e.sibling.return=e.return,e=e.sibling}}return null}function Ut(t){var e=t.keyCode;return"charCode"in t?0===(t=t.charCode)&&13===e&&(t=13):t=e,10===t&&(t=13),32<=t||13===t?t:0}function Bt(t,e){var n=t[0];t=t[1];var r="on"+(t[0].toUpperCase()+t.slice(1));e={phasedRegistrationNames:{bubbled:r,captured:r+"Capture"},dependencies:[n],isInteractive:e},Co[t]=e,Io[n]=e}function Vt(t){var e=t.targetInst;do{if(!e){t.ancestors.push(e);break}var n;for(n=e;n.return;)n=n.return;if(!(n=3!==n.tag?null:n.stateNode.containerInfo))break;t.ancestors.push(e),e=b(n)}while(e);for(n=0;n<t.ancestors.length;n++)e=t.ancestors[n],v(t.topLevelType,e,t.nativeEvent,Z(t.nativeEvent))}function jt(t){Ro=!!t}function qt(t,e){if(!e)return null;var n=(ko(t)?Kt:Ht).bind(null,t);e.addEventListener(t,n,!1)}function Wt(t,e){if(!e)return null;var n=(ko(t)?Kt:Ht).bind(null,t);e.addEventListener(t,n,!0)}function Kt(t,e){Y(Ht,t,e)}function Ht(t,e){if(Ro){var n=Z(e);if(n=b(n),null===n||"number"!==typeof n.tag||2===Pt(n)||(n=null),Ao.length){var r=Ao.pop();r.topLevelType=t,r.nativeEvent=e,r.targetInst=n,t=r}else t={topLevelType:t,nativeEvent:e,targetInst:n,ancestors:[]};try{J(Vt,t)}finally{t.topLevelType=null,t.nativeEvent=null,t.targetInst=null,t.ancestors.length=0,10>Ao.length&&Ao.push(t)}}}function Gt(t){return Object.prototype.hasOwnProperty.call(t,xo)||(t[xo]=Po++,Do[t[xo]]={}),Do[t[xo]]}function Qt(t){for(;t&&t.firstChild;)t=t.firstChild;return t}function zt(t,e){var n=Qt(t);t=0;for(var r;n;){if(3===n.nodeType){if(r=t+n.textContent.length,t<=e&&r>=e)return{node:n,offset:e-t};t=r}t:{for(;n;){if(n.nextSibling){n=n.nextSibling;break t}n=n.parentNode}n=void 0}n=Qt(n)}}function Yt(t){var e=t&&t.nodeName&&t.nodeName.toLowerCase();return e&&("input"===e&&"text"===t.type||"textarea"===e||"true"===t.contentEditable)}function Xt(t,e){if(Vo||null==Fo||Fo!==Ur())return null;var n=Fo;return"selectionStart"in n&&Yt(n)?n={start:n.selectionStart,end:n.selectionEnd}:window.getSelection?(n=window.getSelection(),n={anchorNode:n.anchorNode,anchorOffset:n.anchorOffset,focusNode:n.focusNode,focusOffset:n.focusOffset}):n=void 0,Bo&&Br(Bo,n)?null:(Bo=n,t=M.getPooled(Mo.select,Uo,t,e),t.type="select",t.target=Fo,A(t),t)}function Jt(t){var e="";return xr.Children.forEach(t,function(t){null==t||"string"!==typeof t&&"number"!==typeof t||(e+=t)}),e}function $t(t,e){return t=Mr({children:void 0},e),(e=Jt(e.children))&&(t.children=e),t}function Zt(t,e,n,r){if(t=t.options,e){e={};for(var i=0;i<n.length;i++)e["$"+n[i]]=!0;for(n=0;n<t.length;n++)i=e.hasOwnProperty("$"+t[n].value),t[n].selected!==i&&(t[n].selected=i),i&&r&&(t[n].defaultSelected=!0)}else{for(n=""+n,e=null,i=0;i<t.length;i++){if(t[i].value===n)return t[i].selected=!0,void(r&&(t[i].defaultSelected=!0));null!==e||t[i].disabled||(e=t[i])}null!==e&&(e.selected=!0)}}function te(t,e){var n=e.value;t._wrapperState={initialValue:null!=n?n:e.defaultValue,wasMultiple:!!e.multiple}}function ee(t,e){return null!=e.dangerouslySetInnerHTML&&r("91"),Mr({},e,{value:void 0,defaultValue:void 0,children:""+t._wrapperState.initialValue})}function ne(t,e){var n=e.value;null==n&&(n=e.defaultValue,e=e.children,null!=e&&(null!=n&&r("92"),Array.isArray(e)&&(1>=e.length||r("93"),e=e[0]),n=""+e),null==n&&(n="")),t._wrapperState={initialValue:""+n}}function re(t,e){var n=e.value;null!=n&&(n=""+n,n!==t.value&&(t.value=n),null==e.defaultValue&&(t.defaultValue=n)),null!=e.defaultValue&&(t.defaultValue=e.defaultValue)}function ie(t){var e=t.textContent;e===t._wrapperState.initialValue&&(t.value=e)}function oe(t){switch(t){case"svg":return"http://www.w3.org/2000/svg";case"math":return"http://www.w3.org/1998/Math/MathML";default:return"http://www.w3.org/1999/xhtml"}}function ae(t,e){return null==t||"http://www.w3.org/1999/xhtml"===t?oe(e):"http://www.w3.org/2000/svg"===t&&"foreignObject"===e?"http://www.w3.org/1999/xhtml":t}function se(t,e){if(e){var n=t.firstChild;if(n&&n===t.lastChild&&3===n.nodeType)return void(n.nodeValue=e)}t.textContent=e}function ue(t,e){t=t.style;for(var n in e)if(e.hasOwnProperty(n)){var r=0===n.indexOf("--"),i=n,o=e[n];i=null==o||"boolean"===typeof o||""===o?"":r||"number"!==typeof o||0===o||ca.hasOwnProperty(i)&&ca[i]?(""+o).trim():o+"px","float"===n&&(n="cssFloat"),r?t.setProperty(n,i):t[n]=i}}function ce(t,e,n){e&&(ha[t]&&(null!=e.children||null!=e.dangerouslySetInnerHTML)&&r("137",t,n()),null!=e.dangerouslySetInnerHTML&&(null!=e.children&&r("60"),"object"===typeof e.dangerouslySetInnerHTML&&"__html"in e.dangerouslySetInnerHTML||r("61")),null!=e.style&&"object"!==typeof e.style&&r("62",n()))}function le(t,e){if(-1===t.indexOf("-"))return"string"===typeof e.is;switch(t){case"annotation-xml":case"color-profile":case"font-face":case"font-face-src":case"font-face-uri":case"font-face-format":case"font-face-name":case"missing-glyph":return!1;default:return!0}}function he(t,e){t=9===t.nodeType||11===t.nodeType?t:t.ownerDocument;var n=Gt(t);e=zr[e];for(var r=0;r<e.length;r++){var i=e[r];if(!n.hasOwnProperty(i)||!n[i]){switch(i){case"scroll":Wt("scroll",t);break;case"focus":case"blur":Wt("focus",t),Wt("blur",t),n.blur=!0,n.focus=!0;break;case"cancel":case"close":tt(i,!0)&&Wt(i,t);break;case"invalid":case"submit":case"reset":break;default:-1===di.indexOf(i)&&qt(i,t)}n[i]=!0}}}function fe(t,e,n,r){return n=9===n.nodeType?n:n.ownerDocument,r===aa.html&&(r=oe(t)),r===aa.html?"script"===t?(t=n.createElement("div"),t.innerHTML="<script><\/script>",t=t.removeChild(t.firstChild)):t="string"===typeof e.is?n.createElement(t,{is:e.is}):n.createElement(t):t=n.createElementNS(r,t),t}function pe(t,e){return(9===e.nodeType?e:e.ownerDocument).createTextNode(t)}function de(t,e,n,r){var i=le(e,n);switch(e){case"iframe":case"object":qt("load",t);var o=n;break;case"video":case"audio":for(o=0;o<di.length;o++)qt(di[o],t);o=n;break;case"source":qt("error",t),o=n;break;case"img":case"image":case"link":qt("error",t),qt("load",t),o=n;break;case"form":qt("reset",t),qt("submit",t),o=n;break;case"details":qt("toggle",t),o=n;break;case"input":yt(t,n),o=dt(t,n),qt("invalid",t),he(r,"onChange");break;case"option":o=$t(t,n);break;case"select":te(t,n),o=Mr({},n,{value:void 0}),qt("invalid",t),he(r,"onChange");break;case"textarea":ne(t,n),o=ee(t,n),qt("invalid",t),he(r,"onChange");break;default:o=n}ce(e,o,fa);var a,s=o;for(a in s)if(s.hasOwnProperty(a)){var u=s[a];"style"===a?ue(t,u,fa):"dangerouslySetInnerHTML"===a?null!=(u=u?u.__html:void 0)&&ua(t,u):"children"===a?"string"===typeof u?("textarea"!==e||""!==u)&&se(t,u):"number"===typeof u&&se(t,""+u):"suppressContentEditableWarning"!==a&&"suppressHydrationWarning"!==a&&"autoFocus"!==a&&(Qr.hasOwnProperty(a)?null!=u&&he(r,a):null!=u&&pt(t,a,u,i))}switch(e){case"input":rt(t),vt(t,n);break;case"textarea":rt(t),ie(t,n);break;case"option":null!=n.value&&t.setAttribute("value",n.value);break;case"select":t.multiple=!!n.multiple,e=n.value,null!=e?Zt(t,!!n.multiple,e,!1):null!=n.defaultValue&&Zt(t,!!n.multiple,n.defaultValue,!0);break;default:"function"===typeof o.onClick&&(t.onclick=Fr)}}function ye(t,e,n,r,i){var o=null;switch(e){case"input":n=dt(t,n),r=dt(t,r),o=[];break;case"option":n=$t(t,n),r=$t(t,r),o=[];break;case"select":n=Mr({},n,{value:void 0}),r=Mr({},r,{value:void 0}),o=[];break;case"textarea":n=ee(t,n),r=ee(t,r),o=[];break;default:"function"!==typeof n.onClick&&"function"===typeof r.onClick&&(t.onclick=Fr)}ce(e,r,fa),e=t=void 0;var a=null;for(t in n)if(!r.hasOwnProperty(t)&&n.hasOwnProperty(t)&&null!=n[t])if("style"===t){var s=n[t];for(e in s)s.hasOwnProperty(e)&&(a||(a={}),a[e]="")}else"dangerouslySetInnerHTML"!==t&&"children"!==t&&"suppressContentEditableWarning"!==t&&"suppressHydrationWarning"!==t&&"autoFocus"!==t&&(Qr.hasOwnProperty(t)?o||(o=[]):(o=o||[]).push(t,null));for(t in r){var u=r[t];if(s=null!=n?n[t]:void 0,r.hasOwnProperty(t)&&u!==s&&(null!=u||null!=s))if("style"===t)if(s){for(e in s)!s.hasOwnProperty(e)||u&&u.hasOwnProperty(e)||(a||(a={}),a[e]="");for(e in u)u.hasOwnProperty(e)&&s[e]!==u[e]&&(a||(a={}),a[e]=u[e])}else a||(o||(o=[]),o.push(t,a)),a=u;else"dangerouslySetInnerHTML"===t?(u=u?u.__html:void 0,s=s?s.__html:void 0,null!=u&&s!==u&&(o=o||[]).push(t,""+u)):"children"===t?s===u||"string"!==typeof u&&"number"!==typeof u||(o=o||[]).push(t,""+u):"suppressContentEditableWarning"!==t&&"suppressHydrationWarning"!==t&&(Qr.hasOwnProperty(t)?(null!=u&&he(i,t),o||s===u||(o=[])):(o=o||[]).push(t,u))}return a&&(o=o||[]).push("style",a),o}function me(t,e,n,r,i){"input"===n&&"radio"===i.type&&null!=i.name&&mt(t,i),le(n,r),r=le(n,i);for(var o=0;o<e.length;o+=2){var a=e[o],s=e[o+1];"style"===a?ue(t,s,fa):"dangerouslySetInnerHTML"===a?ua(t,s):"children"===a?se(t,s):pt(t,a,s,r)}switch(n){case"input":gt(t,i);break;case"textarea":re(t,i);break;case"select":t._wrapperState.initialValue=void 0,e=t._wrapperState.wasMultiple,t._wrapperState.wasMultiple=!!i.multiple,n=i.value,null!=n?Zt(t,!!i.multiple,n,!1):e!==!!i.multiple&&(null!=i.defaultValue?Zt(t,!!i.multiple,i.defaultValue,!0):Zt(t,!!i.multiple,i.multiple?[]:"",!1))}}function ge(t,e,n,r,i){switch(e){case"iframe":case"object":qt("load",t);break;case"video":case"audio":for(r=0;r<di.length;r++)qt(di[r],t);break;case"source":qt("error",t);break;case"img":case"image":case"link":qt("error",t),qt("load",t);break;case"form":qt("reset",t),qt("submit",t);break;case"details":qt("toggle",t);break;case"input":yt(t,n),qt("invalid",t),he(i,"onChange");break;case"select":te(t,n),qt("invalid",t),he(i,"onChange");break;case"textarea":ne(t,n),qt("invalid",t),he(i,"onChange")}ce(e,n,fa),r=null;for(var o in n)if(n.hasOwnProperty(o)){var a=n[o];"children"===o?"string"===typeof a?t.textContent!==a&&(r=["children",a]):"number"===typeof a&&t.textContent!==""+a&&(r=["children",""+a]):Qr.hasOwnProperty(o)&&null!=a&&he(i,o)}switch(e){case"input":rt(t),vt(t,n);break;case"textarea":rt(t),ie(t,n);break;case"select":case"option":break;default:"function"===typeof n.onClick&&(t.onclick=Fr)}return r}function ve(t,e){return t.nodeValue!==e}function be(t,e){switch(t){case"button":case"input":case"select":case"textarea":return!!e.autoFocus}return!1}function _e(t,e){return"textarea"===t||"string"===typeof e.children||"number"===typeof e.children||"object"===typeof e.dangerouslySetInnerHTML&&null!==e.dangerouslySetInnerHTML&&"string"===typeof e.dangerouslySetInnerHTML.__html}function we(t){for(t=t.nextSibling;t&&1!==t.nodeType&&3!==t.nodeType;)t=t.nextSibling;return t}function Ee(t){for(t=t.firstChild;t&&1!==t.nodeType&&3!==t.nodeType;)t=t.nextSibling;return t}function Te(t){return{current:t}}function Se(t){0>_a||(t.current=ba[_a],ba[_a]=null,_a--)}function Ce(t,e){_a++,ba[_a]=t.current,t.current=e}function Ie(t){return ke(t)?Ta:wa.current}function Ne(t,e){var n=t.type.contextTypes;if(!n)return jr;var r=t.stateNode;if(r&&r.__reactInternalMemoizedUnmaskedChildContext===e)return r.__reactInternalMemoizedMaskedChildContext;var i,o={};for(i in n)o[i]=e[i];return r&&(t=t.stateNode,t.__reactInternalMemoizedUnmaskedChildContext=e,t.__reactInternalMemoizedMaskedChildContext=o),o}function ke(t){return 2===t.tag&&null!=t.type.childContextTypes}function Ae(t){ke(t)&&(Se(Ea,t),Se(wa,t))}function Re(t){Se(Ea,t),Se(wa,t)}function Oe(t,e,n){wa.current!==jr&&r("168"),Ce(wa,e,t),Ce(Ea,n,t)}function De(t,e){var n=t.stateNode,i=t.type.childContextTypes;if("function"!==typeof n.getChildContext)return e;n=n.getChildContext();for(var o in n)o in i||r("108",at(t)||"Unknown",o);return Mr({},e,n)}function Pe(t){if(!ke(t))return!1;var e=t.stateNode;return e=e&&e.__reactInternalMemoizedMergedChildContext||jr,Ta=wa.current,Ce(wa,e,t),Ce(Ea,Ea.current,t),!0}function xe(t,e){var n=t.stateNode;if(n||r("169"),e){var i=De(t,Ta);n.__reactInternalMemoizedMergedChildContext=i,Se(Ea,t),Se(wa,t),Ce(wa,i,t)}else Se(Ea,t);Ce(Ea,e,t)}function Le(t,e,n,r){this.tag=t,this.key=n,this.sibling=this.child=this.return=this.stateNode=this.type=null,this.index=0,this.ref=null,this.pendingProps=e,this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=r,this.effectTag=0,this.lastEffect=this.firstEffect=this.nextEffect=null,this.expirationTime=0,this.alternate=null}function Me(t,e,n){var r=t.alternate;return null===r?(r=new Le(t.tag,e,t.key,t.mode),r.type=t.type,r.stateNode=t.stateNode,r.alternate=t,t.alternate=r):(r.pendingProps=e,r.effectTag=0,r.nextEffect=null,r.firstEffect=null,r.lastEffect=null),r.expirationTime=n,r.child=t.child,r.memoizedProps=t.memoizedProps,r.memoizedState=t.memoizedState,r.updateQueue=t.updateQueue,r.sibling=t.sibling,r.index=t.index,r.ref=t.ref,r}function Fe(t,e,n){var i=t.type,o=t.key;if(t=t.props,"function"===typeof i)var a=i.prototype&&i.prototype.isReactComponent?2:0;else if("string"===typeof i)a=5;else switch(i){case qi:return Ue(t.children,e,n,o);case Qi:a=11,e|=3;break;case Wi:a=11,e|=2;break;case Ki:return i=new Le(15,t,o,4|e),i.type=Ki,i.expirationTime=n,i;case Yi:a=16,e|=2;break;default:t:{switch("object"===typeof i&&null!==i?i.$$typeof:null){case Hi:a=13;break t;case Gi:a=12;break t;case zi:a=14;break t;default:r("130",null==i?i:typeof i,"")}a=void 0}}return e=new Le(a,t,o,e),e.type=i,e.expirationTime=n,e}function Ue(t,e,n,r){return t=new Le(10,t,r,e),t.expirationTime=n,t}function Be(t,e,n){return t=new Le(6,t,null,e),t.expirationTime=n,t}function Ve(t,e,n){return e=new Le(4,null!==t.children?t.children:[],t.key,e),e.expirationTime=n,e.stateNode={containerInfo:t.containerInfo,pendingChildren:null,implementation:t.implementation},e}function je(t,e,n){return e=new Le(3,null,null,e?3:0),t={current:e,containerInfo:t,pendingChildren:null,earliestPendingTime:0,latestPendingTime:0,earliestSuspendedTime:0,latestSuspendedTime:0,latestPingedTime:0,pendingCommitExpirationTime:0,finishedWork:null,context:null,pendingContext:null,hydrate:n,remainingExpirationTime:0,firstBatch:null,nextScheduledRoot:null},e.stateNode=t}function qe(t){return function(e){try{return t(e)}catch(t){}}}function We(t){if("undefined"===typeof __REACT_DEVTOOLS_GLOBAL_HOOK__)return!1;var e=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(e.isDisabled||!e.supportsFiber)return!0;try{var n=e.inject(t);Sa=qe(function(t){return e.onCommitFiberRoot(n,t)}),Ca=qe(function(t){return e.onCommitFiberUnmount(n,t)})}catch(t){}return!0}function Ke(t){"function"===typeof Sa&&Sa(t)}function He(t){"function"===typeof Ca&&Ca(t)}function Ge(t){return{expirationTime:0,baseState:t,firstUpdate:null,lastUpdate:null,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function Qe(t){return{expirationTime:t.expirationTime,baseState:t.baseState,firstUpdate:t.firstUpdate,lastUpdate:t.lastUpdate,firstCapturedUpdate:null,lastCapturedUpdate:null,firstEffect:null,lastEffect:null,firstCapturedEffect:null,lastCapturedEffect:null}}function ze(t){return{expirationTime:t,tag:0,payload:null,callback:null,next:null,nextEffect:null}}function Ye(t,e,n){null===t.lastUpdate?t.firstUpdate=t.lastUpdate=e:(t.lastUpdate.next=e,t.lastUpdate=e),(0===t.expirationTime||t.expirationTime>n)&&(t.expirationTime=n)}function Xe(t,e,n){var r=t.alternate;if(null===r){var i=t.updateQueue,o=null;null===i&&(i=t.updateQueue=Ge(t.memoizedState))}else i=t.updateQueue,o=r.updateQueue,null===i?null===o?(i=t.updateQueue=Ge(t.memoizedState),o=r.updateQueue=Ge(r.memoizedState)):i=t.updateQueue=Qe(o):null===o&&(o=r.updateQueue=Qe(i));null===o||i===o?Ye(i,e,n):null===i.lastUpdate||null===o.lastUpdate?(Ye(i,e,n),Ye(o,e,n)):(Ye(i,e,n),o.lastUpdate=e)}function Je(t,e,n){var r=t.updateQueue;r=null===r?t.updateQueue=Ge(t.memoizedState):$e(t,r),null===r.lastCapturedUpdate?r.firstCapturedUpdate=r.lastCapturedUpdate=e:(r.lastCapturedUpdate.next=e,r.lastCapturedUpdate=e),(0===r.expirationTime||r.expirationTime>n)&&(r.expirationTime=n)}function $e(t,e){var n=t.alternate;return null!==n&&e===n.updateQueue&&(e=t.updateQueue=Qe(e)),e}function Ze(t,e,n,r,i,o){switch(n.tag){case 1:return t=n.payload,"function"===typeof t?t.call(o,r,i):t;case 3:t.effectTag=-1025&t.effectTag|64;case 0:if(t=n.payload,null===(i="function"===typeof t?t.call(o,r,i):t)||void 0===i)break;return Mr({},r,i);case 2:Ia=!0}return r}function tn(t,e,n,r,i){if(Ia=!1,!(0===e.expirationTime||e.expirationTime>i)){e=$e(t,e);for(var o=e.baseState,a=null,s=0,u=e.firstUpdate,c=o;null!==u;){var l=u.expirationTime;l>i?(null===a&&(a=u,o=c),(0===s||s>l)&&(s=l)):(c=Ze(t,e,u,c,n,r),null!==u.callback&&(t.effectTag|=32,u.nextEffect=null,null===e.lastEffect?e.firstEffect=e.lastEffect=u:(e.lastEffect.nextEffect=u,e.lastEffect=u))),u=u.next}for(l=null,u=e.firstCapturedUpdate;null!==u;){var h=u.expirationTime;h>i?(null===l&&(l=u,null===a&&(o=c)),(0===s||s>h)&&(s=h)):(c=Ze(t,e,u,c,n,r),null!==u.callback&&(t.effectTag|=32,u.nextEffect=null,null===e.lastCapturedEffect?e.firstCapturedEffect=e.lastCapturedEffect=u:(e.lastCapturedEffect.nextEffect=u,e.lastCapturedEffect=u))),u=u.next}null===a&&(e.lastUpdate=null),null===l?e.lastCapturedUpdate=null:t.effectTag|=32,null===a&&null===l&&(o=c),e.baseState=o,e.firstUpdate=a,e.firstCapturedUpdate=l,e.expirationTime=s,t.memoizedState=c}}function en(t,e){"function"!==typeof t&&r("191",t),t.call(e)}function nn(t,e,n){for(null!==e.firstCapturedUpdate&&(null!==e.lastUpdate&&(e.lastUpdate.next=e.firstCapturedUpdate,e.lastUpdate=e.lastCapturedUpdate),e.firstCapturedUpdate=e.lastCapturedUpdate=null),t=e.firstEffect,e.firstEffect=e.lastEffect=null;null!==t;){var r=t.callback;null!==r&&(t.callback=null,en(r,n)),t=t.nextEffect}for(t=e.firstCapturedEffect,e.firstCapturedEffect=e.lastCapturedEffect=null;null!==t;)e=t.callback,null!==e&&(t.callback=null,en(e,n)),t=t.nextEffect}function rn(t,e){return{value:t,source:e,stack:st(e)}}function on(t){var e=t.type._context;Ce(Aa,e._changedBits,t),Ce(ka,e._currentValue,t),Ce(Na,t,t),e._currentValue=t.pendingProps.value,e._changedBits=t.stateNode}function an(t){var e=Aa.current,n=ka.current;Se(Na,t),Se(ka,t),Se(Aa,t),t=t.type._context,t._currentValue=n,t._changedBits=e}function sn(t){return t===Ra&&r("174"),t}function un(t,e){Ce(Pa,e,t),Ce(Da,t,t),Ce(Oa,Ra,t);var n=e.nodeType;switch(n){case 9:case 11:e=(e=e.documentElement)?e.namespaceURI:ae(null,"");break;default:n=8===n?e.parentNode:e,e=n.namespaceURI||null,n=n.tagName,e=ae(e,n)}Se(Oa,t),Ce(Oa,e,t)}function cn(t){Se(Oa,t),Se(Da,t),Se(Pa,t)}function ln(t){Da.current===t&&(Se(Oa,t),Se(Da,t))}function hn(t,e,n){var r=t.memoizedState;e=e(n,r),r=null===e||void 0===e?r:Mr({},r,e),t.memoizedState=r,null!==(t=t.updateQueue)&&0===t.expirationTime&&(t.baseState=r)}function fn(t,e,n,r,i,o){var a=t.stateNode;return t=t.type,"function"===typeof a.shouldComponentUpdate?a.shouldComponentUpdate(n,i,o):!t.prototype||!t.prototype.isPureReactComponent||(!Br(e,n)||!Br(r,i))}function pn(t,e,n,r){t=e.state,"function"===typeof e.componentWillReceiveProps&&e.componentWillReceiveProps(n,r),"function"===typeof e.UNSAFE_componentWillReceiveProps&&e.UNSAFE_componentWillReceiveProps(n,r),e.state!==t&&xa.enqueueReplaceState(e,e.state,null)}function dn(t,e){var n=t.type,r=t.stateNode,i=t.pendingProps,o=Ie(t);r.props=i,r.state=t.memoizedState,r.refs=jr,r.context=Ne(t,o),o=t.updateQueue,null!==o&&(tn(t,o,i,r,e),r.state=t.memoizedState),o=t.type.getDerivedStateFromProps,"function"===typeof o&&(hn(t,o,i),r.state=t.memoizedState),"function"===typeof n.getDerivedStateFromProps||"function"===typeof r.getSnapshotBeforeUpdate||"function"!==typeof r.UNSAFE_componentWillMount&&"function"!==typeof r.componentWillMount||(n=r.state,"function"===typeof r.componentWillMount&&r.componentWillMount(),"function"===typeof r.UNSAFE_componentWillMount&&r.UNSAFE_componentWillMount(),n!==r.state&&xa.enqueueReplaceState(r,r.state,null),null!==(o=t.updateQueue)&&(tn(t,o,i,r,e),r.state=t.memoizedState)),"function"===typeof r.componentDidMount&&(t.effectTag|=4)}function yn(t,e,n){if(null!==(t=n.ref)&&"function"!==typeof t&&"object"!==typeof t){if(n._owner){n=n._owner;var i=void 0;n&&(2!==n.tag&&r("110"),i=n.stateNode),i||r("147",t);var o=""+t;return null!==e&&null!==e.ref&&"function"===typeof e.ref&&e.ref._stringRef===o?e.ref:(e=function(t){var e=i.refs===jr?i.refs={}:i.refs;null===t?delete e[o]:e[o]=t},e._stringRef=o,e)}"string"!==typeof t&&r("148"),n._owner||r("254",t)}return t}function mn(t,e){"textarea"!==t.type&&r("31","[object Object]"===Object.prototype.toString.call(e)?"object with keys {"+Object.keys(e).join(", ")+"}":e,"")}function gn(t){function e(e,n){if(t){var r=e.lastEffect;null!==r?(r.nextEffect=n,e.lastEffect=n):e.firstEffect=e.lastEffect=n,n.nextEffect=null,n.effectTag=8}}function n(n,r){if(!t)return null;for(;null!==r;)e(n,r),r=r.sibling;return null}function i(t,e){for(t=new Map;null!==e;)null!==e.key?t.set(e.key,e):t.set(e.index,e),e=e.sibling;return t}function o(t,e,n){return t=Me(t,e,n),t.index=0,t.sibling=null,t}function a(e,n,r){return e.index=r,t?null!==(r=e.alternate)?(r=r.index,r<n?(e.effectTag=2,n):r):(e.effectTag=2,n):n}function s(e){return t&&null===e.alternate&&(e.effectTag=2),e}function u(t,e,n,r){return null===e||6!==e.tag?(e=Be(n,t.mode,r),e.return=t,e):(e=o(e,n,r),e.return=t,e)}function c(t,e,n,r){return null!==e&&e.type===n.type?(r=o(e,n.props,r),r.ref=yn(t,e,n),r.return=t,r):(r=Fe(n,t.mode,r),r.ref=yn(t,e,n),r.return=t,r)}function l(t,e,n,r){return null===e||4!==e.tag||e.stateNode.containerInfo!==n.containerInfo||e.stateNode.implementation!==n.implementation?(e=Ve(n,t.mode,r),e.return=t,e):(e=o(e,n.children||[],r),e.return=t,e)}function h(t,e,n,r,i){return null===e||10!==e.tag?(e=Ue(n,t.mode,r,i),e.return=t,e):(e=o(e,n,r),e.return=t,e)}function f(t,e,n){if("string"===typeof e||"number"===typeof e)return e=Be(""+e,t.mode,n),e.return=t,e;if("object"===typeof e&&null!==e){switch(e.$$typeof){case Vi:return n=Fe(e,t.mode,n),n.ref=yn(t,null,e),n.return=t,n;case ji:return e=Ve(e,t.mode,n),e.return=t,e}if(La(e)||ot(e))return e=Ue(e,t.mode,n,null),e.return=t,e;mn(t,e)}return null}function p(t,e,n,r){var i=null!==e?e.key:null;if("string"===typeof n||"number"===typeof n)return null!==i?null:u(t,e,""+n,r);if("object"===typeof n&&null!==n){switch(n.$$typeof){case Vi:return n.key===i?n.type===qi?h(t,e,n.props.children,r,i):c(t,e,n,r):null;case ji:return n.key===i?l(t,e,n,r):null}if(La(n)||ot(n))return null!==i?null:h(t,e,n,r,null);mn(t,n)}return null}function d(t,e,n,r,i){if("string"===typeof r||"number"===typeof r)return t=t.get(n)||null,u(e,t,""+r,i);if("object"===typeof r&&null!==r){switch(r.$$typeof){case Vi:return t=t.get(null===r.key?n:r.key)||null,r.type===qi?h(e,t,r.props.children,i,r.key):c(e,t,r,i);case ji:return t=t.get(null===r.key?n:r.key)||null,l(e,t,r,i)}if(La(r)||ot(r))return t=t.get(n)||null,h(e,t,r,i,null);mn(e,r)}return null}function y(r,o,s,u){for(var c=null,l=null,h=o,y=o=0,m=null;null!==h&&y<s.length;y++){h.index>y?(m=h,h=null):m=h.sibling;var g=p(r,h,s[y],u);if(null===g){null===h&&(h=m);break}t&&h&&null===g.alternate&&e(r,h),o=a(g,o,y),null===l?c=g:l.sibling=g,l=g,h=m}if(y===s.length)return n(r,h),c;if(null===h){for(;y<s.length;y++)(h=f(r,s[y],u))&&(o=a(h,o,y),null===l?c=h:l.sibling=h,l=h);return c}for(h=i(r,h);y<s.length;y++)(m=d(h,r,y,s[y],u))&&(t&&null!==m.alternate&&h.delete(null===m.key?y:m.key),o=a(m,o,y),null===l?c=m:l.sibling=m,l=m);return t&&h.forEach(function(t){return e(r,t)}),c}function m(o,s,u,c){var l=ot(u);"function"!==typeof l&&r("150"),null==(u=l.call(u))&&r("151");for(var h=l=null,y=s,m=s=0,g=null,v=u.next();null!==y&&!v.done;m++,v=u.next()){y.index>m?(g=y,y=null):g=y.sibling;var b=p(o,y,v.value,c);if(null===b){y||(y=g);break}t&&y&&null===b.alternate&&e(o,y),s=a(b,s,m),null===h?l=b:h.sibling=b,h=b,y=g}if(v.done)return n(o,y),l;if(null===y){for(;!v.done;m++,v=u.next())null!==(v=f(o,v.value,c))&&(s=a(v,s,m),null===h?l=v:h.sibling=v,h=v);return l}for(y=i(o,y);!v.done;m++,v=u.next())null!==(v=d(y,o,m,v.value,c))&&(t&&null!==v.alternate&&y.delete(null===v.key?m:v.key),s=a(v,s,m),null===h?l=v:h.sibling=v,h=v);return t&&y.forEach(function(t){return e(o,t)}),l}return function(t,i,a,u){"object"===typeof a&&null!==a&&a.type===qi&&null===a.key&&(a=a.props.children);var c="object"===typeof a&&null!==a;if(c)switch(a.$$typeof){case Vi:t:{var l=a.key;for(c=i;null!==c;){if(c.key===l){if(10===c.tag?a.type===qi:c.type===a.type){n(t,c.sibling),i=o(c,a.type===qi?a.props.children:a.props,u),i.ref=yn(t,c,a),i.return=t,t=i;break t}n(t,c);break}e(t,c),c=c.sibling}a.type===qi?(i=Ue(a.props.children,t.mode,u,a.key),i.return=t,t=i):(u=Fe(a,t.mode,u),u.ref=yn(t,i,a),u.return=t,t=u)}return s(t);case ji:t:{for(c=a.key;null!==i;){if(i.key===c){if(4===i.tag&&i.stateNode.containerInfo===a.containerInfo&&i.stateNode.implementation===a.implementation){n(t,i.sibling),i=o(i,a.children||[],u),i.return=t,t=i;break t}n(t,i);break}e(t,i),i=i.sibling}i=Ve(a,t.mode,u),i.return=t,t=i}return s(t)}if("string"===typeof a||"number"===typeof a)return a=""+a,null!==i&&6===i.tag?(n(t,i.sibling),i=o(i,a,u),i.return=t,t=i):(n(t,i),i=Be(a,t.mode,u),i.return=t,t=i),s(t);if(La(a))return y(t,i,a,u);if(ot(a))return m(t,i,a,u);if(c&&mn(t,a),"undefined"===typeof a)switch(t.tag){case 2:case 1:u=t.type,r("152",u.displayName||u.name||"Component")}return n(t,i)}}function vn(t,e){var n=new Le(5,null,null,0);n.type="DELETED",n.stateNode=e,n.return=t,n.effectTag=8,null!==t.lastEffect?(t.lastEffect.nextEffect=n,t.lastEffect=n):t.firstEffect=t.lastEffect=n}function bn(t,e){switch(t.tag){case 5:var n=t.type;return null!==(e=1!==e.nodeType||n.toLowerCase()!==e.nodeName.toLowerCase()?null:e)&&(t.stateNode=e,!0);case 6:return null!==(e=""===t.pendingProps||3!==e.nodeType?null:e)&&(t.stateNode=e,!0);default:return!1}}function _n(t){if(Va){var e=Ba;if(e){var n=e;if(!bn(t,e)){if(!(e=we(n))||!bn(t,e))return t.effectTag|=2,Va=!1,void(Ua=t);vn(Ua,n)}Ua=t,Ba=Ee(e)}else t.effectTag|=2,Va=!1,Ua=t}}function wn(t){for(t=t.return;null!==t&&5!==t.tag&&3!==t.tag;)t=t.return;Ua=t}function En(t){if(t!==Ua)return!1;if(!Va)return wn(t),Va=!0,!1;var e=t.type;if(5!==t.tag||"head"!==e&&"body"!==e&&!_e(e,t.memoizedProps))for(e=Ba;e;)vn(t,e),e=we(e);return wn(t),Ba=Ua?we(t.stateNode):null,!0}function Tn(){Ba=Ua=null,Va=!1}function Sn(t,e,n){Cn(t,e,n,e.expirationTime)}function Cn(t,e,n,r){e.child=null===t?Fa(e,null,n,r):Ma(e,t.child,n,r)}function In(t,e){var n=e.ref;(null===t&&null!==n||null!==t&&t.ref!==n)&&(e.effectTag|=128)}function Nn(t,e,n,r,i){In(t,e);var o=0!==(64&e.effectTag);if(!n&&!o)return r&&xe(e,!1),On(t,e);n=e.stateNode,Ui.current=e;var a=o?null:n.render();return e.effectTag|=1,o&&(Cn(t,e,null,i),e.child=null),Cn(t,e,a,i),e.memoizedState=n.state,e.memoizedProps=n.props,r&&xe(e,!0),e.child}function kn(t){var e=t.stateNode;e.pendingContext?Oe(t,e.pendingContext,e.pendingContext!==e.context):e.context&&Oe(t,e.context,!1),un(t,e.containerInfo)}function An(t,e,n,r){var i=t.child;for(null!==i&&(i.return=t);null!==i;){switch(i.tag){case 12:var o=0|i.stateNode;if(i.type===e&&0!==(o&n)){for(o=i;null!==o;){var a=o.alternate;if(0===o.expirationTime||o.expirationTime>r)o.expirationTime=r,null!==a&&(0===a.expirationTime||a.expirationTime>r)&&(a.expirationTime=r);else{if(null===a||!(0===a.expirationTime||a.expirationTime>r))break;a.expirationTime=r}o=o.return}o=null}else o=i.child;break;case 13:o=i.type===t.type?null:i.child;break;default:o=i.child}if(null!==o)o.return=i;else for(o=i;null!==o;){if(o===t){o=null;break}if(null!==(i=o.sibling)){i.return=o.return,o=i;break}o=o.return}i=o}}function Rn(t,e,n){var r=e.type._context,i=e.pendingProps,o=e.memoizedProps,a=!0;if(Ea.current)a=!1;else if(o===i)return e.stateNode=0,on(e),On(t,e);var s=i.value;if(e.memoizedProps=i,null===o)s=1073741823;else if(o.value===i.value){if(o.children===i.children&&a)return e.stateNode=0,on(e),On(t,e);s=0}else{var u=o.value;if(u===s&&(0!==u||1/u===1/s)||u!==u&&s!==s){if(o.children===i.children&&a)return e.stateNode=0,on(e),On(t,e);s=0}else if(s="function"===typeof r._calculateChangedBits?r._calculateChangedBits(u,s):1073741823,0===(s|=0)){if(o.children===i.children&&a)return e.stateNode=0,on(e),On(t,e)}else An(e,r,s,n)}return e.stateNode=s,on(e),Sn(t,e,i.children),e.child}function On(t,e){if(null!==t&&e.child!==t.child&&r("153"),null!==e.child){t=e.child;var n=Me(t,t.pendingProps,t.expirationTime);for(e.child=n,n.return=e;null!==t.sibling;)t=t.sibling,n=n.sibling=Me(t,t.pendingProps,t.expirationTime),n.return=e;n.sibling=null}return e.child}function Dn(t,e,n){if(0===e.expirationTime||e.expirationTime>n){switch(e.tag){case 3:kn(e);break;case 2:Pe(e);break;case 4:un(e,e.stateNode.containerInfo);break;case 13:on(e)}return null}switch(e.tag){case 0:null!==t&&r("155");var i=e.type,o=e.pendingProps,a=Ie(e);return a=Ne(e,a),i=i(o,a),e.effectTag|=1,"object"===typeof i&&null!==i&&"function"===typeof i.render&&void 0===i.$$typeof?(a=e.type,e.tag=2,e.memoizedState=null!==i.state&&void 0!==i.state?i.state:null,a=a.getDerivedStateFromProps,"function"===typeof a&&hn(e,a,o),o=Pe(e),i.updater=xa,e.stateNode=i,i._reactInternalFiber=e,dn(e,n),t=Nn(t,e,!0,o,n)):(e.tag=1,Sn(t,e,i),e.memoizedProps=o,t=e.child),t;case 1:return o=e.type,n=e.pendingProps,Ea.current||e.memoizedProps!==n?(i=Ie(e),i=Ne(e,i),o=o(n,i),e.effectTag|=1,Sn(t,e,o),e.memoizedProps=n,t=e.child):t=On(t,e),t;case 2:if(o=Pe(e),null===t)if(null===e.stateNode){var s=e.pendingProps,u=e.type;i=Ie(e);var c=2===e.tag&&null!=e.type.contextTypes;a=c?Ne(e,i):jr,s=new u(s,a),e.memoizedState=null!==s.state&&void 0!==s.state?s.state:null,s.updater=xa,e.stateNode=s,s._reactInternalFiber=e,c&&(c=e.stateNode,c.__reactInternalMemoizedUnmaskedChildContext=i,c.__reactInternalMemoizedMaskedChildContext=a),dn(e,n),i=!0}else{u=e.type,i=e.stateNode,c=e.memoizedProps,a=e.pendingProps,i.props=c;var l=i.context;s=Ie(e),s=Ne(e,s);var h=u.getDerivedStateFromProps;(u="function"===typeof h||"function"===typeof i.getSnapshotBeforeUpdate)||"function"!==typeof i.UNSAFE_componentWillReceiveProps&&"function"!==typeof i.componentWillReceiveProps||(c!==a||l!==s)&&pn(e,i,a,s),Ia=!1;var f=e.memoizedState;l=i.state=f;var p=e.updateQueue;null!==p&&(tn(e,p,a,i,n),l=e.memoizedState),c!==a||f!==l||Ea.current||Ia?("function"===typeof h&&(hn(e,h,a),l=e.memoizedState),(c=Ia||fn(e,c,a,f,l,s))?(u||"function"!==typeof i.UNSAFE_componentWillMount&&"function"!==typeof i.componentWillMount||("function"===typeof i.componentWillMount&&i.componentWillMount(),"function"===typeof i.UNSAFE_componentWillMount&&i.UNSAFE_componentWillMount()),"function"===typeof i.componentDidMount&&(e.effectTag|=4)):("function"===typeof i.componentDidMount&&(e.effectTag|=4),e.memoizedProps=a,e.memoizedState=l),i.props=a,i.state=l,i.context=s,i=c):("function"===typeof i.componentDidMount&&(e.effectTag|=4),i=!1)}else u=e.type,i=e.stateNode,a=e.memoizedProps,c=e.pendingProps,i.props=a,l=i.context,s=Ie(e),s=Ne(e,s),h=u.getDerivedStateFromProps,(u="function"===typeof h||"function"===typeof i.getSnapshotBeforeUpdate)||"function"!==typeof i.UNSAFE_componentWillReceiveProps&&"function"!==typeof i.componentWillReceiveProps||(a!==c||l!==s)&&pn(e,i,c,s),Ia=!1,l=e.memoizedState,f=i.state=l,p=e.updateQueue,null!==p&&(tn(e,p,c,i,n),f=e.memoizedState),a!==c||l!==f||Ea.current||Ia?("function"===typeof h&&(hn(e,h,c),f=e.memoizedState),(h=Ia||fn(e,a,c,l,f,s))?(u||"function"!==typeof i.UNSAFE_componentWillUpdate&&"function"!==typeof i.componentWillUpdate||("function"===typeof i.componentWillUpdate&&i.componentWillUpdate(c,f,s),"function"===typeof i.UNSAFE_componentWillUpdate&&i.UNSAFE_componentWillUpdate(c,f,s)),"function"===typeof i.componentDidUpdate&&(e.effectTag|=4),"function"===typeof i.getSnapshotBeforeUpdate&&(e.effectTag|=256)):("function"!==typeof i.componentDidUpdate||a===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=4),"function"!==typeof i.getSnapshotBeforeUpdate||a===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=256),e.memoizedProps=c,e.memoizedState=f),i.props=c,i.state=f,i.context=s,i=h):("function"!==typeof i.componentDidUpdate||a===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=4),"function"!==typeof i.getSnapshotBeforeUpdate||a===t.memoizedProps&&l===t.memoizedState||(e.effectTag|=256),i=!1);return Nn(t,e,i,o,n);case 3:return kn(e),o=e.updateQueue,null!==o?(i=e.memoizedState,i=null!==i?i.element:null,tn(e,o,e.pendingProps,null,n),(o=e.memoizedState.element)===i?(Tn(),t=On(t,e)):(i=e.stateNode,(i=(null===t||null===t.child)&&i.hydrate)&&(Ba=Ee(e.stateNode.containerInfo),Ua=e,i=Va=!0),i?(e.effectTag|=2,e.child=Fa(e,null,o,n)):(Tn(),Sn(t,e,o)),t=e.child)):(Tn(),t=On(t,e)),t;case 5:return sn(Pa.current),o=sn(Oa.current),i=ae(o,e.type),o!==i&&(Ce(Da,e,e),Ce(Oa,i,e)),null===t&&_n(e),o=e.type,c=e.memoizedProps,i=e.pendingProps,a=null!==t?t.memoizedProps:null,Ea.current||c!==i||((c=1&e.mode&&!!i.hidden)&&(e.expirationTime=1073741823),c&&1073741823===n)?(c=i.children,_e(o,i)?c=null:a&&_e(o,a)&&(e.effectTag|=16),In(t,e),1073741823!==n&&1&e.mode&&i.hidden?(e.expirationTime=1073741823,e.memoizedProps=i,t=null):(Sn(t,e,c),e.memoizedProps=i,t=e.child)):t=On(t,e),t;case 6:return null===t&&_n(e),e.memoizedProps=e.pendingProps,null;case 16:return null;case 4:return un(e,e.stateNode.containerInfo),o=e.pendingProps,Ea.current||e.memoizedProps!==o?(null===t?e.child=Ma(e,null,o,n):Sn(t,e,o),e.memoizedProps=o,t=e.child):t=On(t,e),t;case 14:return o=e.type.render,n=e.pendingProps,i=e.ref,Ea.current||e.memoizedProps!==n||i!==(null!==t?t.ref:null)?(o=o(n,i),Sn(t,e,o),e.memoizedProps=n,t=e.child):t=On(t,e),t;case 10:return n=e.pendingProps,Ea.current||e.memoizedProps!==n?(Sn(t,e,n),e.memoizedProps=n,t=e.child):t=On(t,e),t;case 11:return n=e.pendingProps.children,Ea.current||null!==n&&e.memoizedProps!==n?(Sn(t,e,n),e.memoizedProps=n,t=e.child):t=On(t,e),t;case 15:return n=e.pendingProps,e.memoizedProps===n?t=On(t,e):(Sn(t,e,n.children),e.memoizedProps=n,t=e.child),t;case 13:return Rn(t,e,n);case 12:t:if(i=e.type,a=e.pendingProps,c=e.memoizedProps,o=i._currentValue,s=i._changedBits,Ea.current||0!==s||c!==a){if(e.memoizedProps=a,u=a.unstable_observedBits,void 0!==u&&null!==u||(u=1073741823),e.stateNode=u,0!==(s&u))An(e,i,s,n);else if(c===a){t=On(t,e);break t}n=a.children,n=n(o),e.effectTag|=1,Sn(t,e,n),t=e.child}else t=On(t,e);return t;default:r("156")}}function Pn(t){t.effectTag|=4}function xn(t,e){var n=e.pendingProps;switch(e.tag){case 1:return null;case 2:return Ae(e),null;case 3:cn(e),Re(e);var i=e.stateNode;return i.pendingContext&&(i.context=i.pendingContext,i.pendingContext=null),null!==t&&null!==t.child||(En(e),e.effectTag&=-3),ja(e),null;case 5:ln(e),i=sn(Pa.current);var o=e.type;if(null!==t&&null!=e.stateNode){var a=t.memoizedProps,s=e.stateNode,u=sn(Oa.current);s=ye(s,o,a,n,i),qa(t,e,s,o,a,n,i,u),t.ref!==e.ref&&(e.effectTag|=128)}else{if(!n)return null===e.stateNode&&r("166"),null;if(t=sn(Oa.current),En(e))n=e.stateNode,o=e.type,a=e.memoizedProps,n[ri]=e,n[ii]=a,i=ge(n,o,a,t,i),e.updateQueue=i,null!==i&&Pn(e);else{t=fe(o,n,i,t),t[ri]=e,t[ii]=n;t:for(a=e.child;null!==a;){if(5===a.tag||6===a.tag)t.appendChild(a.stateNode);else if(4!==a.tag&&null!==a.child){a.child.return=a,a=a.child;continue}if(a===e)break;for(;null===a.sibling;){if(null===a.return||a.return===e)break t;a=a.return}a.sibling.return=a.return,a=a.sibling}de(t,o,n,i),be(o,n)&&Pn(e),e.stateNode=t}null!==e.ref&&(e.effectTag|=128)}return null;case 6:if(t&&null!=e.stateNode)Wa(t,e,t.memoizedProps,n);else{if("string"!==typeof n)return null===e.stateNode&&r("166"),null;i=sn(Pa.current),sn(Oa.current),En(e)?(i=e.stateNode,n=e.memoizedProps,i[ri]=e,ve(i,n)&&Pn(e)):(i=pe(n,i),i[ri]=e,e.stateNode=i)}return null;case 14:case 16:case 10:case 11:case 15:return null;case 4:return cn(e),ja(e),null;case 13:return an(e),null;case 12:return null;case 0:r("167");default:r("156")}}function Ln(t,e){var n=e.source;null===e.stack&&null!==n&&st(n),null!==n&&at(n),e=e.value,null!==t&&2===t.tag&&at(t);try{e&&e.suppressReactErrorLogging||console.error(e)}catch(t){t&&t.suppressReactErrorLogging||console.error(t)}}function Mn(t){var e=t.ref;if(null!==e)if("function"===typeof e)try{e(null)}catch(e){Xn(t,e)}else e.current=null}function Fn(t){switch("function"===typeof He&&He(t),t.tag){case 2:Mn(t);var e=t.stateNode;if("function"===typeof e.componentWillUnmount)try{e.props=t.memoizedProps,e.state=t.memoizedState,e.componentWillUnmount()}catch(e){Xn(t,e)}break;case 5:Mn(t);break;case 4:Vn(t)}}function Un(t){return 5===t.tag||3===t.tag||4===t.tag}function Bn(t){t:{for(var e=t.return;null!==e;){if(Un(e)){var n=e;break t}e=e.return}r("160"),n=void 0}var i=e=void 0;switch(n.tag){case 5:e=n.stateNode,i=!1;break;case 3:case 4:e=n.stateNode.containerInfo,i=!0;break;default:r("161")}16&n.effectTag&&(se(e,""),n.effectTag&=-17);t:e:for(n=t;;){for(;null===n.sibling;){if(null===n.return||Un(n.return)){n=null;break t}n=n.return}for(n.sibling.return=n.return,n=n.sibling;5!==n.tag&&6!==n.tag;){if(2&n.effectTag)continue e;if(null===n.child||4===n.tag)continue e;n.child.return=n,n=n.child}if(!(2&n.effectTag)){n=n.stateNode;break t}}for(var o=t;;){if(5===o.tag||6===o.tag)if(n)if(i){var a=e,s=o.stateNode,u=n;8===a.nodeType?a.parentNode.insertBefore(s,u):a.insertBefore(s,u)}else e.insertBefore(o.stateNode,n);else i?(a=e,s=o.stateNode,8===a.nodeType?a.parentNode.insertBefore(s,a):a.appendChild(s)):e.appendChild(o.stateNode);else if(4!==o.tag&&null!==o.child){o.child.return=o,o=o.child;continue}if(o===t)break;for(;null===o.sibling;){if(null===o.return||o.return===t)return;o=o.return}o.sibling.return=o.return,o=o.sibling}}function Vn(t){for(var e=t,n=!1,i=void 0,o=void 0;;){if(!n){n=e.return;t:for(;;){switch(null===n&&r("160"),n.tag){case 5:i=n.stateNode,o=!1;break t;case 3:case 4:i=n.stateNode.containerInfo,o=!0;break t}n=n.return}n=!0}if(5===e.tag||6===e.tag){t:for(var a=e,s=a;;)if(Fn(s),null!==s.child&&4!==s.tag)s.child.return=s,s=s.child;else{if(s===a)break;for(;null===s.sibling;){if(null===s.return||s.return===a)break t;s=s.return}s.sibling.return=s.return,s=s.sibling}o?(a=i,s=e.stateNode,8===a.nodeType?a.parentNode.removeChild(s):a.removeChild(s)):i.removeChild(e.stateNode)}else if(4===e.tag?i=e.stateNode.containerInfo:Fn(e),null!==e.child){e.child.return=e,e=e.child;continue}if(e===t)break;for(;null===e.sibling;){if(null===e.return||e.return===t)return;e=e.return,4===e.tag&&(n=!1)}e.sibling.return=e.return,e=e.sibling}}function jn(t,e){switch(e.tag){case 2:break;case 5:var n=e.stateNode;if(null!=n){var i=e.memoizedProps;t=null!==t?t.memoizedProps:i;var o=e.type,a=e.updateQueue;e.updateQueue=null,null!==a&&(n[ii]=i,me(n,a,o,t,i))}break;case 6:null===e.stateNode&&r("162"),e.stateNode.nodeValue=e.memoizedProps;break;case 3:case 15:case 16:break;default:r("163")}}function qn(t,e,n){n=ze(n),n.tag=3,n.payload={element:null};var r=e.value;return n.callback=function(){dr(r),Ln(t,e)},n}function Wn(t,e,n){n=ze(n),n.tag=3;var r=t.stateNode;return null!==r&&"function"===typeof r.componentDidCatch&&(n.callback=function(){null===is?is=new Set([this]):is.add(this);var n=e.value,r=e.stack;Ln(t,e),this.componentDidCatch(n,{componentStack:null!==r?r:""})}),n}function Kn(t,e,n,r,i,o){n.effectTag|=512,n.firstEffect=n.lastEffect=null,r=rn(r,n),t=e;do{switch(t.tag){case 3:return t.effectTag|=1024,r=qn(t,r,o),void Je(t,r,o);case 2:if(e=r,n=t.stateNode,0===(64&t.effectTag)&&null!==n&&"function"===typeof n.componentDidCatch&&(null===is||!is.has(n)))return t.effectTag|=1024,r=Wn(t,e,o),void Je(t,r,o)}t=t.return}while(null!==t)}function Hn(t){switch(t.tag){case 2:Ae(t);var e=t.effectTag;return 1024&e?(t.effectTag=-1025&e|64,t):null;case 3:return cn(t),Re(t),e=t.effectTag,1024&e?(t.effectTag=-1025&e|64,t):null;case 5:return ln(t),null;case 16:return e=t.effectTag,1024&e?(t.effectTag=-1025&e|64,t):null;case 4:return cn(t),null;case 13:return an(t),null;default:return null}}function Gn(){if(null!==Xa)for(var t=Xa.return;null!==t;){var e=t;switch(e.tag){case 2:Ae(e);break;case 3:cn(e),Re(e);break;case 5:ln(e);break;case 4:cn(e);break;case 13:an(e)}t=t.return}Ja=null,$a=0,Za=-1,ts=!1,Xa=null,rs=!1}function Qn(t){for(;;){var e=t.alternate,n=t.return,r=t.sibling;if(0===(512&t.effectTag)){e=xn(e,t,$a);var i=t;if(1073741823===$a||1073741823!==i.expirationTime){var o=0;switch(i.tag){case 3:case 2:var a=i.updateQueue;null!==a&&(o=a.expirationTime)}for(a=i.child;null!==a;)0!==a.expirationTime&&(0===o||o>a.expirationTime)&&(o=a.expirationTime),a=a.sibling;i.expirationTime=o}if(null!==e)return e;if(null!==n&&0===(512&n.effectTag)&&(null===n.firstEffect&&(n.firstEffect=t.firstEffect),null!==t.lastEffect&&(null!==n.lastEffect&&(n.lastEffect.nextEffect=t.firstEffect),n.lastEffect=t.lastEffect),1<t.effectTag&&(null!==n.lastEffect?n.lastEffect.nextEffect=t:n.firstEffect=t,n.lastEffect=t)),null!==r)return r;if(null===n){rs=!0;break}t=n}else{if(null!==(t=Hn(t,ts,$a)))return t.effectTag&=511,t;if(null!==n&&(n.firstEffect=n.lastEffect=null,n.effectTag|=512),null!==r)return r;if(null===n)break;t=n}}return null}function zn(t){var e=Dn(t.alternate,t,$a);return null===e&&(e=Qn(t)),Ui.current=null,e}function Yn(t,e,n){Ya&&r("243"),Ya=!0,e===$a&&t===Ja&&null!==Xa||(Gn(),Ja=t,$a=e,Za=-1,Xa=Me(Ja.current,null,$a),t.pendingCommitExpirationTime=0);var i=!1;for(ts=!n||$a<=Ha;;){try{if(n)for(;null!==Xa&&!pr();)Xa=zn(Xa);else for(;null!==Xa;)Xa=zn(Xa)}catch(e){if(null===Xa)i=!0,dr(e);else{null===Xa&&r("271"),n=Xa;var o=n.return;if(null===o){i=!0,dr(e);break}Kn(t,o,n,e,ts,$a,Ga),Xa=Qn(n)}}break}if(Ya=!1,i)return null;if(null===Xa){if(rs)return t.pendingCommitExpirationTime=e,t.current.alternate;ts&&r("262"),0<=Za&&setTimeout(function(){var e=t.current.expirationTime;0!==e&&(0===t.remainingExpirationTime||t.remainingExpirationTime<e)&&ir(t,e)},Za),yr(t.current.expirationTime)}return null}function Xn(t,e){var n;t:{for(Ya&&!ns&&r("263"),n=t.return;null!==n;){switch(n.tag){case 2:var i=n.stateNode;if("function"===typeof n.type.getDerivedStateFromCatch||"function"===typeof i.componentDidCatch&&(null===is||!is.has(i))){t=rn(e,t),t=Wn(n,t,1),Xe(n,t,1),Zn(n,1),n=void 0;break t}break;case 3:t=rn(e,t),t=qn(n,t,1),Xe(n,t,1),Zn(n,1),n=void 0;break t}n=n.return}3===t.tag&&(n=rn(e,t),n=qn(t,n,1),Xe(t,n,1),Zn(t,1)),n=void 0}return n}function Jn(){var t=2+25*(1+((tr()-2+500)/25|0));return t<=Qa&&(t=Qa+1),Qa=t}function $n(t,e){return t=0!==za?za:Ya?ns?1:$a:1&e.mode?bs?2+10*(1+((t-2+15)/10|0)):2+25*(1+((t-2+500)/25|0)):1,bs&&(0===fs||t>fs)&&(fs=t),t}function Zn(t,e){for(;null!==t;){if((0===t.expirationTime||t.expirationTime>e)&&(t.expirationTime=e),null!==t.alternate&&(0===t.alternate.expirationTime||t.alternate.expirationTime>e)&&(t.alternate.expirationTime=e),null===t.return){if(3!==t.tag)break;var n=t.stateNode;!Ya&&0!==$a&&e<$a&&Gn();var i=n.current.expirationTime;Ya&&!ns&&Ja===n||ir(n,i),Es>ws&&r("185")}t=t.return}}function tr(){return Ga=ma()-Ka,Ha=2+(Ga/10|0)}function er(t){var e=za;za=2+25*(1+((tr()-2+500)/25|0));try{return t()}finally{za=e}}function nr(t,e,n,r,i){var o=za;za=1;try{return t(e,n,r,i)}finally{za=o}}function rr(t){if(0!==ss){if(t>ss)return;va(us)}var e=ma()-Ka;ss=t,us=ga(ar,{timeout:10*(t-2)-e})}function ir(t,e){if(null===t.nextScheduledRoot)t.remainingExpirationTime=e,null===as?(os=as=t,t.nextScheduledRoot=t):(as=as.nextScheduledRoot=t,as.nextScheduledRoot=os);else{var n=t.remainingExpirationTime;(0===n||e<n)&&(t.remainingExpirationTime=e)}cs||(gs?vs&&(ls=t,hs=1,hr(t,1,!1)):1===e?sr():rr(e))}function or(){var t=0,e=null;if(null!==as)for(var n=as,i=os;null!==i;){var o=i.remainingExpirationTime;if(0===o){if((null===n||null===as)&&r("244"),i===i.nextScheduledRoot){os=as=i.nextScheduledRoot=null;break}if(i===os)os=o=i.nextScheduledRoot,as.nextScheduledRoot=o,i.nextScheduledRoot=null;else{if(i===as){as=n,as.nextScheduledRoot=os,i.nextScheduledRoot=null;break}n.nextScheduledRoot=i.nextScheduledRoot,i.nextScheduledRoot=null}i=n.nextScheduledRoot}else{if((0===t||o<t)&&(t=o,e=i),i===as)break;n=i,i=i.nextScheduledRoot}}n=ls,null!==n&&n===e&&1===t?Es++:Es=0,ls=e,hs=t}function ar(t){ur(0,!0,t)}function sr(){ur(1,!1,null)}function ur(t,e,n){if(ms=n,or(),e)for(;null!==ls&&0!==hs&&(0===t||t>=hs)&&(!ps||tr()>=hs);)tr(),hr(ls,hs,!ps),or();else for(;null!==ls&&0!==hs&&(0===t||t>=hs);)hr(ls,hs,!1),or();null!==ms&&(ss=0,us=-1),0!==hs&&rr(hs),ms=null,ps=!1,lr()}function cr(t,e){cs&&r("253"),ls=t,hs=e,hr(t,e,!1),sr(),lr()}function lr(){if(Es=0,null!==_s){var t=_s;_s=null;for(var e=0;e<t.length;e++){var n=t[e];try{n._onComplete()}catch(t){ds||(ds=!0,ys=t)}}}if(ds)throw t=ys,ys=null,ds=!1,t}function hr(t,e,n){cs&&r("245"),cs=!0,n?(n=t.finishedWork,null!==n?fr(t,n,e):(t.finishedWork=null,null!==(n=Yn(t,e,!0))&&(pr()?t.finishedWork=n:fr(t,n,e)))):(n=t.finishedWork,null!==n?fr(t,n,e):(t.finishedWork=null,null!==(n=Yn(t,e,!1))&&fr(t,n,e))),cs=!1}function fr(t,e,n){var i=t.firstBatch;if(null!==i&&i._expirationTime<=n&&(null===_s?_s=[i]:_s.push(i),i._defer))return t.finishedWork=e,void(t.remainingExpirationTime=0);if(t.finishedWork=null,ns=Ya=!0,n=e.stateNode,n.current===e&&r("177"),i=n.pendingCommitExpirationTime,0===i&&r("261"),n.pendingCommitExpirationTime=0,tr(),Ui.current=null,1<e.effectTag)if(null!==e.lastEffect){e.lastEffect.nextEffect=e;var o=e.firstEffect}else o=e;else o=e.firstEffect;da=Ro;var a=Ur();if(Yt(a)){if("selectionStart"in a)var s={start:a.selectionStart,end:a.selectionEnd};else t:{var u=window.getSelection&&window.getSelection();if(u&&0!==u.rangeCount){s=u.anchorNode;var c=u.anchorOffset,l=u.focusNode;u=u.focusOffset;try{s.nodeType,l.nodeType}catch(t){s=null;break t}var h=0,f=-1,p=-1,d=0,y=0,m=a,g=null;e:for(;;){for(var v;m!==s||0!==c&&3!==m.nodeType||(f=h+c),m!==l||0!==u&&3!==m.nodeType||(p=h+u),3===m.nodeType&&(h+=m.nodeValue.length),null!==(v=m.firstChild);)g=m,m=v;for(;;){if(m===a)break e;if(g===s&&++d===c&&(f=h),g===l&&++y===u&&(p=h),null!==(v=m.nextSibling))break;m=g,g=m.parentNode}m=v}s=-1===f||-1===p?null:{start:f,end:p}}else s=null}s=s||{start:0,end:0}}else s=null;for(ya={focusedElem:a,selectionRange:s},jt(!1),es=o;null!==es;){a=!1,s=void 0;try{for(;null!==es;){if(256&es.effectTag){var b=es.alternate;switch(c=es,c.tag){case 2:if(256&c.effectTag&&null!==b){var _=b.memoizedProps,w=b.memoizedState,E=c.stateNode;E.props=c.memoizedProps,E.state=c.memoizedState;var T=E.getSnapshotBeforeUpdate(_,w);E.__reactInternalSnapshotBeforeUpdate=T}break;case 3:case 5:case 6:case 4:break;default:r("163")}}es=es.nextEffect}}catch(t){a=!0,s=t}a&&(null===es&&r("178"),Xn(es,s),null!==es&&(es=es.nextEffect))}for(es=o;null!==es;){b=!1,_=void 0;try{for(;null!==es;){var S=es.effectTag;if(16&S&&se(es.stateNode,""),128&S){var C=es.alternate;if(null!==C){var I=C.ref;null!==I&&("function"===typeof I?I(null):I.current=null)}}switch(14&S){case 2:Bn(es),es.effectTag&=-3;break;case 6:Bn(es),es.effectTag&=-3,jn(es.alternate,es);break;case 4:jn(es.alternate,es);break;case 8:w=es,Vn(w),w.return=null,w.child=null,w.alternate&&(w.alternate.child=null,w.alternate.return=null)}es=es.nextEffect}}catch(t){b=!0,_=t}b&&(null===es&&r("178"),Xn(es,_),null!==es&&(es=es.nextEffect))}if(I=ya,C=Ur(),S=I.focusedElem,b=I.selectionRange,C!==S&&Vr(document.documentElement,S)){Yt(S)&&(C=b.start,I=b.end,void 0===I&&(I=C),"selectionStart"in S?(S.selectionStart=C,S.selectionEnd=Math.min(I,S.value.length)):window.getSelection&&(C=window.getSelection(),_=S[P()].length,I=Math.min(b.start,_),b=void 0===b.end?I:Math.min(b.end,_),!C.extend&&I>b&&(_=b,b=I,I=_),_=zt(S,I),w=zt(S,b),_&&w&&(1!==C.rangeCount||C.anchorNode!==_.node||C.anchorOffset!==_.offset||C.focusNode!==w.node||C.focusOffset!==w.offset)&&(E=document.createRange(),E.setStart(_.node,_.offset),C.removeAllRanges(),I>b?(C.addRange(E),C.extend(w.node,w.offset)):(E.setEnd(w.node,w.offset),C.addRange(E))))),C=[];for(I=S;I=I.parentNode;)1===I.nodeType&&C.push({element:I,left:I.scrollLeft,top:I.scrollTop});for(S.focus(),S=0;S<C.length;S++)I=C[S],I.element.scrollLeft=I.left,I.element.scrollTop=I.top}for(ya=null,jt(da),da=null,n.current=e,es=o;null!==es;){o=!1,S=void 0;try{for(C=i;null!==es;){var N=es.effectTag;if(36&N){var k=es.alternate;switch(I=es,b=C,I.tag){case 2:var A=I.stateNode;if(4&I.effectTag)if(null===k)A.props=I.memoizedProps,A.state=I.memoizedState,A.componentDidMount();else{var R=k.memoizedProps,O=k.memoizedState;A.props=I.memoizedProps,A.state=I.memoizedState,A.componentDidUpdate(R,O,A.__reactInternalSnapshotBeforeUpdate)}var D=I.updateQueue;null!==D&&(A.props=I.memoizedProps,A.state=I.memoizedState,nn(I,D,A,b));break;case 3:var x=I.updateQueue;if(null!==x){if(_=null,null!==I.child)switch(I.child.tag){case 5:_=I.child.stateNode;break;case 2:_=I.child.stateNode}nn(I,x,_,b)}break;case 5:var L=I.stateNode;null===k&&4&I.effectTag&&be(I.type,I.memoizedProps)&&L.focus();break;case 6:case 4:case 15:case 16:break;default:r("163")}}if(128&N){I=void 0;var M=es.ref;if(null!==M){var F=es.stateNode;switch(es.tag){case 5:I=F;break;default:I=F}"function"===typeof M?M(I):M.current=I}}var U=es.nextEffect;es.nextEffect=null,es=U}}catch(t){o=!0,S=t}o&&(null===es&&r("178"),Xn(es,S),null!==es&&(es=es.nextEffect))}Ya=ns=!1,"function"===typeof Ke&&Ke(e.stateNode),e=n.current.expirationTime,0===e&&(is=null),t.remainingExpirationTime=e}function pr(){return!(null===ms||ms.timeRemaining()>Ts)&&(ps=!0)}function dr(t){null===ls&&r("246"),ls.remainingExpirationTime=0,ds||(ds=!0,ys=t)}function yr(t){null===ls&&r("246"),ls.remainingExpirationTime=t}function mr(t,e){var n=gs;gs=!0;try{return t(e)}finally{(gs=n)||cs||sr()}}function gr(t,e){if(gs&&!vs){vs=!0;try{return t(e)}finally{vs=!1}}return t(e)}function vr(t,e){cs&&r("187");var n=gs;gs=!0;try{return nr(t,e)}finally{gs=n,sr()}}function br(t){var e=gs;gs=!0;try{nr(t)}finally{(gs=e)||cs||ur(1,!1,null)}}function _r(t,e,n,i,o){var a=e.current;if(n){n=n._reactInternalFiber;var s;t:{for(2===Pt(n)&&2===n.tag||r("170"),s=n;3!==s.tag;){if(ke(s)){s=s.stateNode.__reactInternalMemoizedMergedChildContext;break t}(s=s.return)||r("171")}s=s.stateNode.context}n=ke(n)?De(n,s):s}else n=jr;return null===e.context?e.context=n:e.pendingContext=n,e=o,o=ze(i),o.payload={element:t},e=void 0===e?null:e,null!==e&&(o.callback=e),Xe(a,o,i),Zn(a,i),i}function wr(t){var e=t._reactInternalFiber;return void 0===e&&("function"===typeof t.render?r("188"):r("268",Object.keys(t))),t=Mt(e),null===t?null:t.stateNode}function Er(t,e,n,r){var i=e.current;return i=$n(tr(),i),_r(t,e,n,i,r)}function Tr(t){if(t=t.current,!t.child)return null;switch(t.child.tag){case 5:default:return t.child.stateNode}}function Sr(t){var e=t.findFiberByHostInstance;return We(Mr({},t,{findHostInstanceByFiber:function(t){return t=Mt(t),null===t?null:t.stateNode},findFiberByHostInstance:function(t){return e?e(t):null}}))}function Cr(t,e,n){var r=3<arguments.length&&void 0!==arguments[3]?arguments[3]:null;return{$$typeof:ji,key:null==r?null:""+r,children:t,containerInfo:e,implementation:n}}function Ir(t){this._expirationTime=Jn(),this._root=t,this._callbacks=this._next=null,this._hasChildren=this._didComplete=!1,this._children=null,this._defer=!0}function Nr(){this._callbacks=null,this._didCommit=!1,this._onCommit=this._onCommit.bind(this)}function kr(t,e,n){this._internalRoot=je(t,e,n)}function Ar(t){return!(!t||1!==t.nodeType&&9!==t.nodeType&&11!==t.nodeType&&(8!==t.nodeType||" react-mount-point-unstable "!==t.nodeValue))}function Rr(t,e){if(e||(e=t?9===t.nodeType?t.documentElement:t.firstChild:null,e=!(!e||1!==e.nodeType||!e.hasAttribute("data-reactroot"))),!e)for(var n;n=t.lastChild;)t.removeChild(n);return new kr(t,!1,e)}function Or(t,e,n,i,o){Ar(n)||r("200");var a=n._reactRootContainer;if(a){if("function"===typeof o){var s=o;o=function(){var t=Tr(a._internalRoot);s.call(t)}}null!=t?a.legacy_renderSubtreeIntoContainer(t,e,o):a.render(e,o)}else{if(a=n._reactRootContainer=Rr(n,i),"function"===typeof o){var u=o;o=function(){var t=Tr(a._internalRoot);u.call(t)}}gr(function(){null!=t?a.legacy_renderSubtreeIntoContainer(t,e,o):a.render(e,o)})}return Tr(a._internalRoot)}function Dr(t,e){var n=2<arguments.length&&void 0!==arguments[2]?arguments[2]:null;return Ar(e)||r("200"),Cr(t,e,null,n)}var Pr=n(8),xr=n(4),Lr=n(23),Mr=n(3),Fr=n(10),Ur=n(24),Br=n(25),Vr=n(26),jr=n(9);xr||r("227");var qr={_caughtError:null,_hasCaughtError:!1,_rethrowError:null,_hasRethrowError:!1,invokeGuardedCallback:function(t,e,n,r,o,a,s,u,c){i.apply(qr,arguments)},invokeGuardedCallbackAndCatchFirstError:function(t,e,n,r,i,o,a,s,u){if(qr.invokeGuardedCallback.apply(this,arguments),qr.hasCaughtError()){var c=qr.clearCaughtError();qr._hasRethrowError||(qr._hasRethrowError=!0,qr._rethrowError=c)}},rethrowCaughtError:function(){return o.apply(qr,arguments)},hasCaughtError:function(){return qr._hasCaughtError},clearCaughtError:function(){if(qr._hasCaughtError){var t=qr._caughtError;return qr._caughtError=null,qr._hasCaughtError=!1,t}r("198")}},Wr=null,Kr={},Hr=[],Gr={},Qr={},zr={},Yr={plugins:Hr,eventNameDispatchConfigs:Gr,registrationNameModules:Qr,registrationNameDependencies:zr,possibleRegistrationNames:null,injectEventPluginOrder:u,injectEventPluginsByName:c},Xr=null,Jr=null,$r=null,Zr=null,ti={injectEventPluginOrder:u,injectEventPluginsByName:c},ei={injection:ti,getListener:m,runEventsInBatch:g,runExtractedEventsInBatch:v},ni=Math.random().toString(36).slice(2),ri="__reactInternalInstance$"+ni,ii="__reactEventHandlers$"+ni,oi={precacheFiberNode:function(t,e){e[ri]=t},getClosestInstanceFromNode:b,getInstanceFromNode:function(t){return t=t[ri],!t||5!==t.tag&&6!==t.tag?null:t},getNodeFromInstance:_,getFiberCurrentPropsFromNode:w,updateFiberProps:function(t,e){t[ii]=e}},ai={accumulateTwoPhaseDispatches:A,accumulateTwoPhaseDispatchesSkipTarget:function(t){f(t,I)},accumulateEnterLeaveDispatches:R,accumulateDirectDispatches:function(t){f(t,k)}},si={animationend:O("Animation","AnimationEnd"),animationiteration:O("Animation","AnimationIteration"),animationstart:O("Animation","AnimationStart"),transitionend:O("Transition","TransitionEnd")},ui={},ci={};Lr.canUseDOM&&(ci=document.createElement("div").style,"AnimationEvent"in window||(delete si.animationend.animation,delete si.animationiteration.animation,delete si.animationstart.animation),"TransitionEvent"in window||delete si.transitionend.transition);var li=D("animationend"),hi=D("animationiteration"),fi=D("animationstart"),pi=D("transitionend"),di="abort canplay canplaythrough durationchange emptied encrypted ended error loadeddata loadedmetadata loadstart pause play playing progress ratechange seeked seeking stalled suspend timeupdate volumechange waiting".split(" "),yi=null,mi={_root:null,_startText:null,_fallbackText:null},gi="dispatchConfig _targetInst nativeEvent isDefaultPrevented isPropagationStopped _dispatchListeners _dispatchInstances".split(" "),vi={type:null,target:null,currentTarget:Fr.thatReturnsNull,eventPhase:null,bubbles:null,cancelable:null,timeStamp:function(t){return t.timeStamp||Date.now()},defaultPrevented:null,isTrusted:null};Mr(M.prototype,{preventDefault:function(){this.defaultPrevented=!0;var t=this.nativeEvent;t&&(t.preventDefault?t.preventDefault():"unknown"!==typeof t.returnValue&&(t.returnValue=!1),this.isDefaultPrevented=Fr.thatReturnsTrue)},stopPropagation:function(){var t=this.nativeEvent;t&&(t.stopPropagation?t.stopPropagation():"unknown"!==typeof t.cancelBubble&&(t.cancelBubble=!0),this.isPropagationStopped=Fr.thatReturnsTrue)},persist:function(){this.isPersistent=Fr.thatReturnsTrue},isPersistent:Fr.thatReturnsFalse,destructor:function(){var t,e=this.constructor.Interface;for(t in e)this[t]=null;for(e=0;e<gi.length;e++)this[gi[e]]=null}}),M.Interface=vi,M.extend=function(t){function e(){}function n(){return r.apply(this,arguments)}var r=this;e.prototype=r.prototype;var i=new e;return Mr(i,n.prototype),n.prototype=i,n.prototype.constructor=n,n.Interface=Mr({},r.Interface,t),n.extend=r.extend,B(n),n},B(M);var bi=M.extend({data:null}),_i=M.extend({data:null}),wi=[9,13,27,32],Ei=Lr.canUseDOM&&"CompositionEvent"in window,Ti=null;Lr.canUseDOM&&"documentMode"in document&&(Ti=document.documentMode);var Si=Lr.canUseDOM&&"TextEvent"in window&&!Ti,Ci=Lr.canUseDOM&&(!Ei||Ti&&8<Ti&&11>=Ti),Ii=String.fromCharCode(32),Ni={beforeInput:{phasedRegistrationNames:{bubbled:"onBeforeInput",captured:"onBeforeInputCapture"},dependencies:["compositionend","keypress","textInput","paste"]},compositionEnd:{phasedRegistrationNames:{bubbled:"onCompositionEnd",captured:"onCompositionEndCapture"},dependencies:"blur compositionend keydown keypress keyup mousedown".split(" ")},compositionStart:{phasedRegistrationNames:{bubbled:"onCompositionStart",captured:"onCompositionStartCapture"},dependencies:"blur compositionstart keydown keypress keyup mousedown".split(" ")},compositionUpdate:{phasedRegistrationNames:{bubbled:"onCompositionUpdate",captured:"onCompositionUpdateCapture"},dependencies:"blur compositionupdate keydown keypress keyup mousedown".split(" ")}},ki=!1,Ai=!1,Ri={eventTypes:Ni,extractEvents:function(t,e,n,r){var i=void 0,o=void 0;if(Ei)t:{switch(t){case"compositionstart":i=Ni.compositionStart;break t;case"compositionend":i=Ni.compositionEnd;break t;case"compositionupdate":i=Ni.compositionUpdate;break t}i=void 0}else Ai?V(t,n)&&(i=Ni.compositionEnd):"keydown"===t&&229===n.keyCode&&(i=Ni.compositionStart);return i?(Ci&&(Ai||i!==Ni.compositionStart?i===Ni.compositionEnd&&Ai&&(o=x()):(mi._root=r,mi._startText=L(),Ai=!0)),i=bi.getPooled(i,e,n,r),o?i.data=o:null!==(o=j(n))&&(i.data=o),A(i),o=i):o=null,(t=Si?q(t,n):W(t,n))?(e=_i.getPooled(Ni.beforeInput,e,n,r),e.data=t,A(e)):e=null,null===o?e:null===e?o:[o,e]}},Oi=null,Di={injectFiberControlledHostComponent:function(t){Oi=t}},Pi=null,xi=null,Li={injection:Di,enqueueStateRestore:H,needsStateRestore:G,restoreStateIfNeeded:Q},Mi=!1,Fi={color:!0,date:!0,datetime:!0,"datetime-local":!0,email:!0,month:!0,number:!0,password:!0,range:!0,search:!0,tel:!0,text:!0,time:!0,url:!0,week:!0},Ui=xr.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,Bi="function"===typeof Symbol&&Symbol.for,Vi=Bi?Symbol.for("react.element"):60103,ji=Bi?Symbol.for("react.portal"):60106,qi=Bi?Symbol.for("react.fragment"):60107,Wi=Bi?Symbol.for("react.strict_mode"):60108,Ki=Bi?Symbol.for("react.profiler"):60114,Hi=Bi?Symbol.for("react.provider"):60109,Gi=Bi?Symbol.for("react.context"):60110,Qi=Bi?Symbol.for("react.async_mode"):60111,zi=Bi?Symbol.for("react.forward_ref"):60112,Yi=Bi?Symbol.for("react.timeout"):60113,Xi="function"===typeof Symbol&&Symbol.iterator,Ji=/^[:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD][:A-Z_a-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\-.0-9\u00B7\u0300-\u036F\u203F-\u2040]*$/,$i={},Zi={},to={};"children dangerouslySetInnerHTML defaultValue defaultChecked innerHTML suppressContentEditableWarning suppressHydrationWarning style".split(" ").forEach(function(t){to[t]=new ht(t,0,!1,t,null)}),[["acceptCharset","accept-charset"],["className","class"],["htmlFor","for"],["httpEquiv","http-equiv"]].forEach(function(t){var e=t[0];to[e]=new ht(e,1,!1,t[1],null)}),["contentEditable","draggable","spellCheck","value"].forEach(function(t){to[t]=new ht(t,2,!1,t.toLowerCase(),null)}),["autoReverse","externalResourcesRequired","preserveAlpha"].forEach(function(t){to[t]=new ht(t,2,!1,t,null)}),"allowFullScreen async autoFocus autoPlay controls default defer disabled formNoValidate hidden loop noModule noValidate open playsInline readOnly required reversed scoped seamless itemScope".split(" ").forEach(function(t){to[t]=new ht(t,3,!1,t.toLowerCase(),null)}),["checked","multiple","muted","selected"].forEach(function(t){to[t]=new ht(t,3,!0,t.toLowerCase(),null)}),["capture","download"].forEach(function(t){to[t]=new ht(t,4,!1,t.toLowerCase(),null)}),["cols","rows","size","span"].forEach(function(t){to[t]=new ht(t,6,!1,t.toLowerCase(),null)}),["rowSpan","start"].forEach(function(t){to[t]=new ht(t,5,!1,t.toLowerCase(),null)});var eo=/[\-:]([a-z])/g;"accent-height alignment-baseline arabic-form baseline-shift cap-height clip-path clip-rule color-interpolation color-interpolation-filters color-profile color-rendering dominant-baseline enable-background fill-opacity fill-rule flood-color flood-opacity font-family font-size font-size-adjust font-stretch font-style font-variant font-weight glyph-name glyph-orientation-horizontal glyph-orientation-vertical horiz-adv-x horiz-origin-x image-rendering letter-spacing lighting-color marker-end marker-mid marker-start overline-position overline-thickness paint-order panose-1 pointer-events rendering-intent shape-rendering stop-color stop-opacity strikethrough-position strikethrough-thickness stroke-dasharray stroke-dashoffset stroke-linecap stroke-linejoin stroke-miterlimit stroke-opacity stroke-width text-anchor text-decoration text-rendering underline-position underline-thickness unicode-bidi unicode-range units-per-em v-alphabetic v-hanging v-ideographic v-mathematical vector-effect vert-adv-y vert-origin-x vert-origin-y word-spacing writing-mode xmlns:xlink x-height".split(" ").forEach(function(t){var e=t.replace(eo,ft);to[e]=new ht(e,1,!1,t,null)}),"xlink:actuate xlink:arcrole xlink:href xlink:role xlink:show xlink:title xlink:type".split(" ").forEach(function(t){var e=t.replace(eo,ft);to[e]=new ht(e,1,!1,t,"http://www.w3.org/1999/xlink")}),["xml:base","xml:lang","xml:space"].forEach(function(t){var e=t.replace(eo,ft);to[e]=new ht(e,1,!1,t,"http://www.w3.org/XML/1998/namespace")}),to.tabIndex=new ht("tabIndex",1,!1,"tabindex",null);var no={change:{phasedRegistrationNames:{bubbled:"onChange",captured:"onChangeCapture"},dependencies:"blur change click focus input keydown keyup selectionchange".split(" ")}},ro=null,io=null,oo=!1;Lr.canUseDOM&&(oo=tt("input")&&(!document.documentMode||9<document.documentMode));var ao={eventTypes:no,_isInputEventSupported:oo,extractEvents:function(t,e,n,r){var i=e?_(e):window,o=void 0,a=void 0,s=i.nodeName&&i.nodeName.toLowerCase();if("select"===s||"input"===s&&"file"===i.type?o=St:$(i)?oo?o=Rt:(o=kt,a=Nt):(s=i.nodeName)&&"input"===s.toLowerCase()&&("checkbox"===i.type||"radio"===i.type)&&(o=At),o&&(o=o(t,e)))return wt(o,n,r);a&&a(t,i,e),"blur"===t&&null!=e&&(t=e._wrapperState||i._wrapperState)&&t.controlled&&"number"===i.type&&bt(i,"number",i.value)}},so=M.extend({view:null,detail:null}),uo={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"},co=so.extend({screenX:null,screenY:null,clientX:null,clientY:null,pageX:null,pageY:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,getModifierState:Dt,button:null,buttons:null,relatedTarget:function(t){return t.relatedTarget||(t.fromElement===t.srcElement?t.toElement:t.fromElement)}}),lo=co.extend({pointerId:null,width:null,height:null,pressure:null,tiltX:null,tiltY:null,pointerType:null,isPrimary:null}),ho={mouseEnter:{registrationName:"onMouseEnter",dependencies:["mouseout","mouseover"]},mouseLeave:{registrationName:"onMouseLeave",dependencies:["mouseout","mouseover"]},pointerEnter:{registrationName:"onPointerEnter",dependencies:["pointerout","pointerover"]},pointerLeave:{registrationName:"onPointerLeave",dependencies:["pointerout","pointerover"]}},fo={eventTypes:ho,extractEvents:function(t,e,n,r){var i="mouseover"===t||"pointerover"===t,o="mouseout"===t||"pointerout"===t;if(i&&(n.relatedTarget||n.fromElement)||!o&&!i)return null;if(i=r.window===r?r:(i=r.ownerDocument)?i.defaultView||i.parentWindow:window,o?(o=e,e=(e=n.relatedTarget||n.toElement)?b(e):null):o=null,o===e)return null;var a=void 0,s=void 0,u=void 0,c=void 0;return"mouseout"===t||"mouseover"===t?(a=co,s=ho.mouseLeave,u=ho.mouseEnter,c="mouse"):"pointerout"!==t&&"pointerover"!==t||(a=lo,s=ho.pointerLeave,u=ho.pointerEnter,c="pointer"),t=null==o?i:_(o),i=null==e?i:_(e),s=a.getPooled(s,o,n,r),s.type=c+"leave",s.target=t,s.relatedTarget=i,n=a.getPooled(u,e,n,r),n.type=c+"enter",n.target=i,n.relatedTarget=t,R(s,n,o,e),[s,n]}},po=M.extend({animationName:null,elapsedTime:null,pseudoElement:null}),yo=M.extend({clipboardData:function(t){return"clipboardData"in t?t.clipboardData:window.clipboardData}}),mo=so.extend({relatedTarget:null}),go={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},vo={8:"Backspace",9:"Tab",12:"Clear",13:"Enter",16:"Shift",17:"Control",18:"Alt",19:"Pause",20:"CapsLock",27:"Escape",32:" ",33:"PageUp",34:"PageDown",35:"End",36:"Home",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",45:"Insert",46:"Delete",112:"F1",113:"F2",114:"F3",115:"F4",116:"F5",117:"F6",118:"F7",119:"F8",120:"F9",121:"F10",122:"F11",123:"F12",144:"NumLock",145:"ScrollLock",224:"Meta"},bo=so.extend({key:function(t){if(t.key){var e=go[t.key]||t.key;if("Unidentified"!==e)return e}return"keypress"===t.type?(t=Ut(t),13===t?"Enter":String.fromCharCode(t)):"keydown"===t.type||"keyup"===t.type?vo[t.keyCode]||"Unidentified":""},location:null,ctrlKey:null,shiftKey:null,altKey:null,metaKey:null,repeat:null,locale:null,getModifierState:Dt,charCode:function(t){return"keypress"===t.type?Ut(t):0},keyCode:function(t){return"keydown"===t.type||"keyup"===t.type?t.keyCode:0},which:function(t){return"keypress"===t.type?Ut(t):"keydown"===t.type||"keyup"===t.type?t.keyCode:0}}),_o=co.extend({dataTransfer:null}),wo=so.extend({touches:null,targetTouches:null,changedTouches:null,altKey:null,metaKey:null,ctrlKey:null,shiftKey:null,getModifierState:Dt}),Eo=M.extend({propertyName:null,elapsedTime:null,pseudoElement:null}),To=co.extend({deltaX:function(t){return"deltaX"in t?t.deltaX:"wheelDeltaX"in t?-t.wheelDeltaX:0},deltaY:function(t){return"deltaY"in t?t.deltaY:"wheelDeltaY"in t?-t.wheelDeltaY:"wheelDelta"in t?-t.wheelDelta:0},deltaZ:null,deltaMode:null}),So=[["abort","abort"],[li,"animationEnd"],[hi,"animationIteration"],[fi,"animationStart"],["canplay","canPlay"],["canplaythrough","canPlayThrough"],["drag","drag"],["dragenter","dragEnter"],["dragexit","dragExit"],["dragleave","dragLeave"],["dragover","dragOver"],["durationchange","durationChange"],["emptied","emptied"],["encrypted","encrypted"],["ended","ended"],["error","error"],["gotpointercapture","gotPointerCapture"],["load","load"],["loadeddata","loadedData"],["loadedmetadata","loadedMetadata"],["loadstart","loadStart"],["lostpointercapture","lostPointerCapture"],["mousemove","mouseMove"],["mouseout","mouseOut"],["mouseover","mouseOver"],["playing","playing"],["pointermove","pointerMove"],["pointerout","pointerOut"],["pointerover","pointerOver"],["progress","progress"],["scroll","scroll"],["seeking","seeking"],["stalled","stalled"],["suspend","suspend"],["timeupdate","timeUpdate"],["toggle","toggle"],["touchmove","touchMove"],[pi,"transitionEnd"],["waiting","waiting"],["wheel","wheel"]],Co={},Io={};[["blur","blur"],["cancel","cancel"],["click","click"],["close","close"],["contextmenu","contextMenu"],["copy","copy"],["cut","cut"],["dblclick","doubleClick"],["dragend","dragEnd"],["dragstart","dragStart"],["drop","drop"],["focus","focus"],["input","input"],["invalid","invalid"],["keydown","keyDown"],["keypress","keyPress"],["keyup","keyUp"],["mousedown","mouseDown"],["mouseup","mouseUp"],["paste","paste"],["pause","pause"],["play","play"],["pointercancel","pointerCancel"],["pointerdown","pointerDown"],["pointerup","pointerUp"],["ratechange","rateChange"],["reset","reset"],["seeked","seeked"],["submit","submit"],["touchcancel","touchCancel"],["touchend","touchEnd"],["touchstart","touchStart"],["volumechange","volumeChange"]].forEach(function(t){Bt(t,!0)}),So.forEach(function(t){Bt(t,!1)});var No={eventTypes:Co,isInteractiveTopLevelEventType:function(t){return void 0!==(t=Io[t])&&!0===t.isInteractive},extractEvents:function(t,e,n,r){var i=Io[t];if(!i)return null;switch(t){case"keypress":if(0===Ut(n))return null;case"keydown":case"keyup":t=bo;break;case"blur":case"focus":t=mo;break;case"click":if(2===n.button)return null;case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":t=co;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":t=_o;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":t=wo;break;case li:case hi:case fi:t=po;break;case pi:t=Eo;break;case"scroll":t=so;break;case"wheel":t=To;break;case"copy":case"cut":case"paste":t=yo;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":t=lo;break;default:t=M}return e=t.getPooled(i,e,n,r),A(e),e}},ko=No.isInteractiveTopLevelEventType,Ao=[],Ro=!0,Oo={get _enabled(){return Ro},setEnabled:jt,isEnabled:function(){return Ro},trapBubbledEvent:qt,trapCapturedEvent:Wt,dispatchEvent:Ht},Do={},Po=0,xo="_reactListenersID"+(""+Math.random()).slice(2),Lo=Lr.canUseDOM&&"documentMode"in document&&11>=document.documentMode,Mo={select:{phasedRegistrationNames:{bubbled:"onSelect",captured:"onSelectCapture"},dependencies:"blur contextmenu focus keydown keyup mousedown mouseup selectionchange".split(" ")}},Fo=null,Uo=null,Bo=null,Vo=!1,jo={eventTypes:Mo,extractEvents:function(t,e,n,r){var i,o=r.window===r?r.document:9===r.nodeType?r:r.ownerDocument;if(!(i=!o)){t:{o=Gt(o),i=zr.onSelect;for(var a=0;a<i.length;a++){var s=i[a];if(!o.hasOwnProperty(s)||!o[s]){o=!1;break t}}o=!0}i=!o}if(i)return null;switch(o=e?_(e):window,t){case"focus":($(o)||"true"===o.contentEditable)&&(Fo=o,Uo=e,Bo=null);break;case"blur":Bo=Uo=Fo=null;break;case"mousedown":Vo=!0;break;case"contextmenu":case"mouseup":return Vo=!1,Xt(n,r);case"selectionchange":if(Lo)break;case"keydown":case"keyup":return Xt(n,r)}return null}};ti.injectEventPluginOrder("ResponderEventPlugin SimpleEventPlugin TapEventPlugin EnterLeaveEventPlugin ChangeEventPlugin SelectEventPlugin BeforeInputEventPlugin".split(" ")),Xr=oi.getFiberCurrentPropsFromNode,Jr=oi.getInstanceFromNode,$r=oi.getNodeFromInstance,ti.injectEventPluginsByName({SimpleEventPlugin:No,EnterLeaveEventPlugin:fo,ChangeEventPlugin:ao,SelectEventPlugin:jo,BeforeInputEventPlugin:Ri});var qo=void 0;qo="object"===typeof performance&&"function"===typeof performance.now?function(){return performance.now()}:function(){return Date.now()};var Wo=void 0,Ko=void 0;if(Lr.canUseDOM){var Ho=[],Go=0,Qo={},zo=-1,Yo=!1,Xo=!1,Jo=0,$o=33,Zo=33,ta={didTimeout:!1,timeRemaining:function(){var t=Jo-qo();return 0<t?t:0}},ea=function(t,e){if(Qo[e])try{t(ta)}finally{delete Qo[e]}},na="__reactIdleCallback$"+Math.random().toString(36).slice(2);window.addEventListener("message",function(t){if(t.source===window&&t.data===na&&(Yo=!1,0!==Ho.length)){if(0!==Ho.length&&(t=qo(),!(-1===zo||zo>t))){zo=-1,ta.didTimeout=!0;for(var e=0,n=Ho.length;e<n;e++){var r=Ho[e],i=r.timeoutTime;-1!==i&&i<=t?ea(r.scheduledCallback,r.callbackId):-1!==i&&(-1===zo||i<zo)&&(zo=i)}}for(t=qo();0<Jo-t&&0<Ho.length;)t=Ho.shift(),ta.didTimeout=!1,ea(t.scheduledCallback,t.callbackId),t=qo();0<Ho.length&&!Xo&&(Xo=!0,requestAnimationFrame(ra))}},!1);var ra=function(t){Xo=!1;var e=t-Jo+Zo;e<Zo&&$o<Zo?(8>e&&(e=8),Zo=e<$o?$o:e):$o=e,Jo=t+Zo,Yo||(Yo=!0,window.postMessage(na,"*"))};Wo=function(t,e){var n=-1;return null!=e&&"number"===typeof e.timeout&&(n=qo()+e.timeout),(-1===zo||-1!==n&&n<zo)&&(zo=n),Go++,e=Go,Ho.push({scheduledCallback:t,callbackId:e,timeoutTime:n}),Qo[e]=!0,Xo||(Xo=!0,requestAnimationFrame(ra)),e},Ko=function(t){delete Qo[t]}}else{var ia=0,oa={};Wo=function(t){var e=ia++,n=setTimeout(function(){t({timeRemaining:function(){return 1/0},didTimeout:!1})});return oa[e]=n,e},Ko=function(t){var e=oa[t];delete oa[t],clearTimeout(e)}}var aa={html:"http://www.w3.org/1999/xhtml",mathml:"http://www.w3.org/1998/Math/MathML",svg:"http://www.w3.org/2000/svg"},sa=void 0,ua=function(t){return"undefined"!==typeof MSApp&&MSApp.execUnsafeLocalFunction?function(e,n,r,i){MSApp.execUnsafeLocalFunction(function(){return t(e,n)})}:t}(function(t,e){if(t.namespaceURI!==aa.svg||"innerHTML"in t)t.innerHTML=e;else{for(sa=sa||document.createElement("div"),sa.innerHTML="<svg>"+e+"</svg>",e=sa.firstChild;t.firstChild;)t.removeChild(t.firstChild);for(;e.firstChild;)t.appendChild(e.firstChild)}}),ca={animationIterationCount:!0,borderImageOutset:!0,borderImageSlice:!0,borderImageWidth:!0,boxFlex:!0,boxFlexGroup:!0,boxOrdinalGroup:!0,columnCount:!0,columns:!0,flex:!0,flexGrow:!0,flexPositive:!0,flexShrink:!0,flexNegative:!0,flexOrder:!0,gridRow:!0,gridRowEnd:!0,gridRowSpan:!0,gridRowStart:!0,gridColumn:!0,gridColumnEnd:!0,gridColumnSpan:!0,gridColumnStart:!0,fontWeight:!0,lineClamp:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,tabSize:!0,widows:!0,zIndex:!0,zoom:!0,fillOpacity:!0,floodOpacity:!0,stopOpacity:!0,strokeDasharray:!0,strokeDashoffset:!0,strokeMiterlimit:!0,strokeOpacity:!0,strokeWidth:!0},la=["Webkit","ms","Moz","O"];Object.keys(ca).forEach(function(t){la.forEach(function(e){e=e+t.charAt(0).toUpperCase()+t.substring(1),ca[e]=ca[t]})});var ha=Mr({menuitem:!0},{area:!0,base:!0,br:!0,col:!0,embed:!0,hr:!0,img:!0,input:!0,keygen:!0,link:!0,meta:!0,param:!0,source:!0,track:!0,wbr:!0}),fa=Fr.thatReturns(""),pa={createElement:fe,createTextNode:pe,setInitialProperties:de,diffProperties:ye,updateProperties:me,diffHydratedProperties:ge,diffHydratedText:ve,warnForUnmatchedText:function(){},warnForDeletedHydratableElement:function(){},warnForDeletedHydratableText:function(){},warnForInsertedHydratedElement:function(){},warnForInsertedHydratedText:function(){},restoreControlledState:function(t,e,n){switch(e){case"input":if(gt(t,n),e=n.name,"radio"===n.type&&null!=e){for(n=t;n.parentNode;)n=n.parentNode;for(n=n.querySelectorAll("input[name="+JSON.stringify(""+e)+'][type="radio"]'),e=0;e<n.length;e++){var i=n[e];if(i!==t&&i.form===t.form){var o=w(i);o||r("90"),it(i),gt(i,o)}}}break;case"textarea":re(t,n);break;case"select":null!=(e=n.value)&&Zt(t,!!n.multiple,e,!1)}}},da=null,ya=null,ma=qo,ga=Wo,va=Ko;new Set;var ba=[],_a=-1,wa=Te(jr),Ea=Te(!1),Ta=jr,Sa=null,Ca=null,Ia=!1,Na=Te(null),ka=Te(null),Aa=Te(0),Ra={},Oa=Te(Ra),Da=Te(Ra),Pa=Te(Ra),xa={isMounted:function(t){return!!(t=t._reactInternalFiber)&&2===Pt(t)},enqueueSetState:function(t,e,n){t=t._reactInternalFiber;var r=tr();r=$n(r,t);var i=ze(r);i.payload=e,void 0!==n&&null!==n&&(i.callback=n),Xe(t,i,r),Zn(t,r)},enqueueReplaceState:function(t,e,n){t=t._reactInternalFiber;var r=tr();r=$n(r,t);var i=ze(r);i.tag=1,i.payload=e,void 0!==n&&null!==n&&(i.callback=n),Xe(t,i,r),Zn(t,r)},enqueueForceUpdate:function(t,e){t=t._reactInternalFiber;var n=tr();n=$n(n,t);var r=ze(n);r.tag=2,void 0!==e&&null!==e&&(r.callback=e),Xe(t,r,n),Zn(t,n)}},La=Array.isArray,Ma=gn(!0),Fa=gn(!1),Ua=null,Ba=null,Va=!1,ja=void 0,qa=void 0,Wa=void 0;ja=function(){},qa=function(t,e,n){(e.updateQueue=n)&&Pn(e)},Wa=function(t,e,n,r){n!==r&&Pn(e)};var Ka=ma(),Ha=2,Ga=Ka,Qa=0,za=0,Ya=!1,Xa=null,Ja=null,$a=0,Za=-1,ts=!1,es=null,ns=!1,rs=!1,is=null,os=null,as=null,ss=0,us=-1,cs=!1,ls=null,hs=0,fs=0,ps=!1,ds=!1,ys=null,ms=null,gs=!1,vs=!1,bs=!1,_s=null,ws=1e3,Es=0,Ts=1,Ss={updateContainerAtExpirationTime:_r,createContainer:function(t,e,n){return je(t,e,n)},updateContainer:Er,flushRoot:cr,requestWork:ir,computeUniqueAsyncExpiration:Jn,batchedUpdates:mr,unbatchedUpdates:gr,deferredUpdates:er,syncUpdates:nr,interactiveUpdates:function(t,e,n){if(bs)return t(e,n);gs||cs||0===fs||(ur(fs,!1,null),fs=0);var r=bs,i=gs;gs=bs=!0;try{return t(e,n)}finally{bs=r,(gs=i)||cs||sr()}},flushInteractiveUpdates:function(){cs||0===fs||(ur(fs,!1,null),fs=0)},flushControlled:br,flushSync:vr,getPublicRootInstance:Tr,findHostInstance:wr,findHostInstanceWithNoPortals:function(t){return t=Ft(t),null===t?null:t.stateNode},injectIntoDevTools:Sr};Di.injectFiberControlledHostComponent(pa),Ir.prototype.render=function(t){this._defer||r("250"),this._hasChildren=!0,this._children=t;var e=this._root._internalRoot,n=this._expirationTime,i=new Nr;return _r(t,e,null,n,i._onCommit),i},Ir.prototype.then=function(t){if(this._didComplete)t();else{var e=this._callbacks;null===e&&(e=this._callbacks=[]),e.push(t)}},Ir.prototype.commit=function(){var t=this._root._internalRoot,e=t.firstBatch;if(this._defer&&null!==e||r("251"),this._hasChildren){var n=this._expirationTime;if(e!==this){this._hasChildren&&(n=this._expirationTime=e._expirationTime,this.render(this._children));for(var i=null,o=e;o!==this;)i=o,o=o._next;null===i&&r("251"),i._next=o._next,this._next=e,t.firstBatch=this}this._defer=!1,cr(t,n),e=this._next,this._next=null,e=t.firstBatch=e,null!==e&&e._hasChildren&&e.render(e._children)}else this._next=null,this._defer=!1},Ir.prototype._onComplete=function(){if(!this._didComplete){this._didComplete=!0;var t=this._callbacks;if(null!==t)for(var e=0;e<t.length;e++)(0,t[e])()}},Nr.prototype.then=function(t){if(this._didCommit)t();else{var e=this._callbacks;null===e&&(e=this._callbacks=[]),e.push(t)}},Nr.prototype._onCommit=function(){if(!this._didCommit){this._didCommit=!0;var t=this._callbacks;if(null!==t)for(var e=0;e<t.length;e++){var n=t[e];"function"!==typeof n&&r("191",n),n()}}},kr.prototype.render=function(t,e){var n=this._internalRoot,r=new Nr;return e=void 0===e?null:e,null!==e&&r.then(e),Er(t,n,null,r._onCommit),r},kr.prototype.unmount=function(t){var e=this._internalRoot,n=new Nr;return t=void 0===t?null:t,null!==t&&n.then(t),Er(null,e,null,n._onCommit),n},kr.prototype.legacy_renderSubtreeIntoContainer=function(t,e,n){var r=this._internalRoot,i=new Nr;return n=void 0===n?null:n,null!==n&&i.then(n),Er(e,r,t,i._onCommit),i},kr.prototype.createBatch=function(){var t=new Ir(this),e=t._expirationTime,n=this._internalRoot,r=n.firstBatch;if(null===r)n.firstBatch=t,t._next=null;else{for(n=null;null!==r&&r._expirationTime<=e;)n=r,r=r._next;t._next=r,null!==n&&(n._next=t)}return t},z=Ss.batchedUpdates,Y=Ss.interactiveUpdates,X=Ss.flushInteractiveUpdates;var Cs={createPortal:Dr,findDOMNode:function(t){return null==t?null:1===t.nodeType?t:wr(t)},hydrate:function(t,e,n){return Or(null,t,e,!0,n)},render:function(t,e,n){return Or(null,t,e,!1,n)},unstable_renderSubtreeIntoContainer:function(t,e,n,i){return(null==t||void 0===t._reactInternalFiber)&&r("38"),Or(t,e,n,!1,i)},unmountComponentAtNode:function(t){return Ar(t)||r("40"),!!t._reactRootContainer&&(gr(function(){Or(null,null,t,!1,function(){t._reactRootContainer=null})}),!0)},unstable_createPortal:function(){return Dr.apply(void 0,arguments)},unstable_batchedUpdates:mr,unstable_deferredUpdates:er,flushSync:vr,unstable_flushControlled:br,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:{EventPluginHub:ei,EventPluginRegistry:Yr,EventPropagators:ai,ReactControlledComponent:Li,ReactDOMComponentTree:oi,ReactDOMEventListener:Oo},unstable_createRoot:function(t,e){return new kr(t,!0,null!=e&&!0===e.hydrate)}};Sr({findFiberByHostInstance:b,bundleType:0,version:"16.4.0",rendererPackageName:"react-dom"});var Is={default:Cs},Ns=Is&&Cs||Is;t.exports=Ns.default?Ns.default:Ns},function(t,e,n){"use strict";var r=!("undefined"===typeof window||!window.document||!window.document.createElement),i={canUseDOM:r,canUseWorkers:"undefined"!==typeof Worker,canUseEventListeners:r&&!(!window.addEventListener&&!window.attachEvent),canUseViewport:r&&!!window.screen,isInWorker:!r};t.exports=i},function(t,e,n){"use strict";function r(t){if("undefined"===typeof(t=t||("undefined"!==typeof document?document:void 0)))return null;try{return t.activeElement||t.body}catch(e){return t.body}}t.exports=r},function(t,e,n){"use strict";function r(t,e){return t===e?0!==t||0!==e||1/t===1/e:t!==t&&e!==e}function i(t,e){if(r(t,e))return!0;if("object"!==typeof t||null===t||"object"!==typeof e||null===e)return!1;var n=Object.keys(t),i=Object.keys(e);if(n.length!==i.length)return!1;for(var a=0;a<n.length;a++)if(!o.call(e,n[a])||!r(t[n[a]],e[n[a]]))return!1;return!0}var o=Object.prototype.hasOwnProperty;t.exports=i},function(t,e,n){"use strict";function r(t,e){return!(!t||!e)&&(t===e||!i(t)&&(i(e)?r(t,e.parentNode):"contains"in t?t.contains(e):!!t.compareDocumentPosition&&!!(16&t.compareDocumentPosition(e))))}var i=n(27);t.exports=r},function(t,e,n){"use strict";function r(t){return i(t)&&3==t.nodeType}var i=n(28);t.exports=r},function(t,e,n){"use strict";function r(t){var e=t?t.ownerDocument||t:document,n=e.defaultView||window;return!(!t||!("function"===typeof n.Node?t instanceof n.Node:"object"===typeof t&&"number"===typeof t.nodeType&&"string"===typeof t.nodeName))}t.exports=r},function(t,e){},function(t,e,n){"use strict";var r=n(4),i=n.n(r),o=n(31),a=n.n(o),s=n(32),u=(n.n(s),n(11)),c=function(){return i.a.createElement("div",{className:"App"},i.a.createElement("header",{className:"App-header"},i.a.createElement("img",{src:a.a,className:"App-logo",alt:"icon"}),i.a.createElement("h1",{className:"App-title"},"Bem vindo a demo de push notification")),i.a.createElement("button",{onClick:u.b},"Clique aqui para receber notifica\xe7\xf5es"))};e.a=c},function(t,e,n){t.exports=n.p+"static/media/icon.18773506.png"},function(t,e){},function(t,e,n){t.exports=n(34)},function(t,e,n){var r=function(){return this}()||Function("return this")(),i=r.regeneratorRuntime&&Object.getOwnPropertyNames(r).indexOf("regeneratorRuntime")>=0,o=i&&r.regeneratorRuntime;if(r.regeneratorRuntime=void 0,t.exports=n(35),i)r.regeneratorRuntime=o;else try{delete r.regeneratorRuntime}catch(t){r.regeneratorRuntime=void 0}},function(t,e){!function(e){"use strict";function n(t,e,n,r){var o=e&&e.prototype instanceof i?e:i,a=Object.create(o.prototype),s=new p(r||[]);return a._invoke=c(t,n,s),a}function r(t,e,n){try{return{type:"normal",arg:t.call(e,n)}}catch(t){return{type:"throw",arg:t}}}function i(){}function o(){}function a(){}function s(t){["next","throw","return"].forEach(function(e){t[e]=function(t){return this._invoke(e,t)}})}function u(t){function e(n,i,o,a){var s=r(t[n],t,i);if("throw"!==s.type){var u=s.arg,c=u.value;return c&&"object"===typeof c&&v.call(c,"__await")?Promise.resolve(c.__await).then(function(t){e("next",t,o,a)},function(t){e("throw",t,o,a)}):Promise.resolve(c).then(function(t){u.value=t,o(u)},a)}a(s.arg)}function n(t,n){function r(){return new Promise(function(r,i){e(t,n,r,i)})}return i=i?i.then(r,r):r()}var i;this._invoke=n}function c(t,e,n){var i=C;return function(o,a){if(i===N)throw new Error("Generator is already running");if(i===k){if("throw"===o)throw a;return y()}for(n.method=o,n.arg=a;;){var s=n.delegate;if(s){var u=l(s,n);if(u){if(u===A)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===C)throw i=k,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=N;var c=r(t,e,n);if("normal"===c.type){if(i=n.done?k:I,c.arg===A)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=k,n.method="throw",n.arg=c.arg)}}}function l(t,e){var n=t.iterator[e.method];if(n===m){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=m,l(t,e),"throw"===e.method))return A;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return A}var i=r(n,t.iterator,e.arg);if("throw"===i.type)return e.method="throw",e.arg=i.arg,e.delegate=null,A;var o=i.arg;return o?o.done?(e[t.resultName]=o.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=m),e.delegate=null,A):o:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,A)}function h(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function f(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function p(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(h,this),this.reset(!0)}function d(t){if(t){var e=t[_];if(e)return e.call(t);if("function"===typeof t.next)return t;if(!isNaN(t.length)){var n=-1,r=function e(){for(;++n<t.length;)if(v.call(t,n))return e.value=t[n],e.done=!1,e;return e.value=m,e.done=!0,e};return r.next=r}}return{next:y}}function y(){return{value:m,done:!0}}var m,g=Object.prototype,v=g.hasOwnProperty,b="function"===typeof Symbol?Symbol:{},_=b.iterator||"@@iterator",w=b.asyncIterator||"@@asyncIterator",E=b.toStringTag||"@@toStringTag",T="object"===typeof t,S=e.regeneratorRuntime;if(S)return void(T&&(t.exports=S));S=e.regeneratorRuntime=T?t.exports:{},S.wrap=n;var C="suspendedStart",I="suspendedYield",N="executing",k="completed",A={},R={};R[_]=function(){return this};var O=Object.getPrototypeOf,D=O&&O(O(d([])));D&&D!==g&&v.call(D,_)&&(R=D);var P=a.prototype=i.prototype=Object.create(R);o.prototype=P.constructor=a,a.constructor=o,a[E]=o.displayName="GeneratorFunction",S.isGeneratorFunction=function(t){var e="function"===typeof t&&t.constructor;return!!e&&(e===o||"GeneratorFunction"===(e.displayName||e.name))},S.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,a):(t.__proto__=a,E in t||(t[E]="GeneratorFunction")),t.prototype=Object.create(P),t},S.awrap=function(t){return{__await:t}},s(u.prototype),u.prototype[w]=function(){return this},S.AsyncIterator=u,S.async=function(t,e,r,i){var o=new u(n(t,e,r,i));return S.isGeneratorFunction(e)?o:o.next().then(function(t){return t.done?t.value:o.next()})},s(P),P[E]="Generator",P[_]=function(){return this},P.toString=function(){return"[object Generator]"},S.keys=function(t){var e=[];for(var n in t)e.push(n);return e.reverse(),function n(){for(;e.length;){var r=e.pop();if(r in t)return n.value=r,n.done=!1,n}return n.done=!0,n}},S.values=d,p.prototype={constructor:p,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=m,this.done=!1,this.delegate=null,this.method="next",this.arg=m,this.tryEntries.forEach(f),!t)for(var e in this)"t"===e.charAt(0)&&v.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=m)},stop:function(){this.done=!0;var t=this.tryEntries[0],e=t.completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(t){function e(e,r){return o.type="throw",o.arg=t,n.next=e,r&&(n.method="next",n.arg=m),!!r}if(this.done)throw t;for(var n=this,r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r],o=i.completion;if("root"===i.tryLoc)return e("end");if(i.tryLoc<=this.prev){var a=v.call(i,"catchLoc"),s=v.call(i,"finallyLoc");if(a&&s){if(this.prev<i.catchLoc)return e(i.catchLoc,!0);if(this.prev<i.finallyLoc)return e(i.finallyLoc)}else if(a){if(this.prev<i.catchLoc)return e(i.catchLoc,!0)}else{if(!s)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return e(i.finallyLoc)}}}},abrupt:function(t,e){for(var n=this.tryEntries.length-1;n>=0;--n){var r=this.tryEntries[n];if(r.tryLoc<=this.prev&&v.call(r,"finallyLoc")&&this.prev<r.finallyLoc){var i=r;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var o=i?i.completion:{};return o.type=t,o.arg=e,i?(this.method="next",this.next=i.finallyLoc,A):this.complete(o)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),A},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.finallyLoc===t)return this.complete(n.completion,n.afterLoc),f(n),A}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var n=this.tryEntries[e];if(n.tryLoc===t){var r=n.completion;if("throw"===r.type){var i=r.arg;f(n)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,n){return this.delegate={iterator:d(t),resultName:e,nextLoc:n},"next"===this.method&&(this.arg=m),A}}}(function(){return this}()||Function("return this")())},function(t,e,n){"use strict";n(37);var r=function(t){return t&&"object"===typeof t&&"default"in t?t.default:t}(n(0));n(40),n(41),n(42),n(44),n(45),n(46),console.warn("\nIt looks like you're using the development build of the Firebase JS SDK.\nWhen deploying Firebase apps to production, it is advisable to only import\nthe individual SDK components you intend to use.\n\nFor the module builds, these are available in the following manner\n(replace <PACKAGE> with the name of a component - i.e. auth, database, etc):\n\nCommonJS Modules:\nconst firebase = require('firebase/app');\nrequire('firebase/<PACKAGE>');\n\nES Modules:\nimport firebase from 'firebase/app';\nimport 'firebase/<PACKAGE>';\n"),t.exports=r},function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t,e){function r(){}function i(t,e){return function(){t.apply(e,arguments)}}function o(t){if(!(this instanceof o))throw new TypeError("Promises must be constructed via new");if("function"!==typeof t)throw new TypeError("not a function");this._state=0,this._handled=!1,this._value=void 0,this._deferreds=[],h(t,this)}function a(t,e){for(;3===t._state;)t=t._value;if(0===t._state)return void t._deferreds.push(e);t._handled=!0,o._immediateFn(function(){var n=1===t._state?e.onFulfilled:e.onRejected;if(null===n)return void(1===t._state?s:u)(e.promise,t._value);var r;try{r=n(t._value)}catch(t){return void u(e.promise,t)}s(e.promise,r)})}function s(t,e){try{if(e===t)throw new TypeError("A promise cannot be resolved with itself.");if(e&&("object"===typeof e||"function"===typeof e)){var n=e.then;if(e instanceof o)return t._state=3,t._value=e,void c(t);if("function"===typeof n)return void h(i(n,e),t)}t._state=1,t._value=e,c(t)}catch(e){u(t,e)}}function u(t,e){t._state=2,t._value=e,c(t)}function c(t){2===t._state&&0===t._deferreds.length&&o._immediateFn(function(){t._handled||o._unhandledRejectionFn(t._value)});for(var e=0,n=t._deferreds.length;e<n;e++)a(t,t._deferreds[e]);t._deferreds=null}function l(t,e,n){this.onFulfilled="function"===typeof t?t:null,this.onRejected="function"===typeof e?e:null,this.promise=n}function h(t,e){var n=!1;try{t(function(t){n||(n=!0,s(e,t))},function(t){n||(n=!0,u(e,t))})}catch(t){if(n)return;n=!0,u(e,t)}}function f(t,e){return e={exports:{}},t(e,e.exports),e.exports}var p=n(7),d=(n.n(p),setTimeout);o.prototype.catch=function(t){return this.then(null,t)},o.prototype.then=function(t,e){var n=new this.constructor(r);return a(this,new l(t,e,n)),n},o.prototype.finally=function(t){var e=this.constructor;return this.then(function(n){return e.resolve(t()).then(function(){return n})},function(n){return e.resolve(t()).then(function(){return e.reject(n)})})},o.all=function(t){return new o(function(e,n){function r(t,a){try{if(a&&("object"===typeof a||"function"===typeof a)){var s=a.then;if("function"===typeof s)return void s.call(a,function(e){r(t,e)},n)}i[t]=a,0===--o&&e(i)}catch(t){n(t)}}if(!t||"undefined"===typeof t.length)throw new TypeError("Promise.all accepts an array");var i=Array.prototype.slice.call(t);if(0===i.length)return e([]);for(var o=i.length,a=0;a<i.length;a++)r(a,i[a])})},o.resolve=function(t){return t&&"object"===typeof t&&t.constructor===o?t:new o(function(e){e(t)})},o.reject=function(t){return new o(function(e,n){n(t)})},o.race=function(t){return new o(function(e,n){for(var r=0,i=t.length;r<i;r++)t[r].then(e,n)})},o._immediateFn="function"===typeof t&&function(e){t(e)}||function(t){d(t,0)},o._unhandledRejectionFn=function(t){"undefined"!==typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",t)};var y=function(){if("undefined"!==typeof self)return self;if("undefined"!==typeof window)return window;if("undefined"!==typeof e)return e;throw new Error("unable to locate global object")}();y.Promise||(y.Promise=o);var m=f(function(t){var e=t.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=e)}),g=f(function(t){var e=t.exports={version:"2.5.5"};"number"==typeof __e&&(__e=e)}),v=(g.version,function(t){return"object"===typeof t?null!==t:"function"===typeof t}),b=function(t){if(!v(t))throw TypeError(t+" is not an object!");return t},_=function(t){try{return!!t()}catch(t){return!0}},w=!_(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),E=m.document,T=v(E)&&v(E.createElement),S=function(t){return T?E.createElement(t):{}},C=!w&&!_(function(){return 7!=Object.defineProperty(S("div"),"a",{get:function(){return 7}}).a}),I=function(t,e){if(!v(t))return t;var n,r;if(e&&"function"==typeof(n=t.toString)&&!v(r=n.call(t)))return r;if("function"==typeof(n=t.valueOf)&&!v(r=n.call(t)))return r;if(!e&&"function"==typeof(n=t.toString)&&!v(r=n.call(t)))return r;throw TypeError("Can't convert object to primitive value")},N=Object.defineProperty,k=w?Object.defineProperty:function(t,e,n){if(b(t),e=I(e,!0),b(n),C)try{return N(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported!");return"value"in n&&(t[e]=n.value),t},A={f:k},R=function(t,e){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:e}},O=w?function(t,e,n){return A.f(t,e,R(1,n))}:function(t,e,n){return t[e]=n,t},D={}.hasOwnProperty,P=function(t,e){return D.call(t,e)},x=0,L=Math.random(),M=function(t){return"Symbol(".concat(void 0===t?"":t,")_",(++x+L).toString(36))},F=f(function(t){var e=M("src"),n=Function.toString,r=(""+n).split("toString");g.inspectSource=function(t){return n.call(t)},(t.exports=function(t,n,i,o){var a="function"==typeof i;a&&(P(i,"name")||O(i,"name",n)),t[n]!==i&&(a&&(P(i,e)||O(i,e,t[n]?""+t[n]:r.join(String(n)))),t===m?t[n]=i:o?t[n]?t[n]=i:O(t,n,i):(delete t[n],O(t,n,i)))})(Function.prototype,"toString",function(){return"function"==typeof this&&this[e]||n.call(this)})}),U=function(t){if("function"!=typeof t)throw TypeError(t+" is not a function!");return t},B=function(t,e,n){if(U(t),void 0===e)return t;switch(n){case 1:return function(n){return t.call(e,n)};case 2:return function(n,r){return t.call(e,n,r)};case 3:return function(n,r,i){return t.call(e,n,r,i)}}return function(){return t.apply(e,arguments)}},V=function(t,e,n){var r,i,o,a,s=t&V.F,u=t&V.G,c=t&V.S,l=t&V.P,h=t&V.B,f=u?m:c?m[e]||(m[e]={}):(m[e]||{}).prototype,p=u?g:g[e]||(g[e]={}),d=p.prototype||(p.prototype={});u&&(n=e);for(r in n)i=!s&&f&&void 0!==f[r],o=(i?f:n)[r],a=h&&i?B(o,m):l&&"function"==typeof o?B(Function.call,o):o,f&&F(f,r,o,t&V.U),p[r]!=o&&O(p,r,a),l&&d[r]!=o&&(d[r]=o)};m.core=g,V.F=1,V.G=2,V.S=4,V.P=8,V.B=16,V.W=32,V.U=64,V.R=128;var j=V,q={}.toString,W=function(t){return q.call(t).slice(8,-1)},K=Object("z").propertyIsEnumerable(0)?Object:function(t){return"String"==W(t)?t.split(""):Object(t)},H=function(t){if(void 0==t)throw TypeError("Can't call method on "+t);return t},G=function(t){return Object(H(t))},Q=Math.ceil,z=Math.floor,Y=function(t){return isNaN(t=+t)?0:(t>0?z:Q)(t)},X=Math.min,J=function(t){return t>0?X(Y(t),9007199254740991):0},$=Array.isArray||function(t){return"Array"==W(t)},Z=m["__core-js_shared__"]||(m["__core-js_shared__"]={}),tt=function(t){return Z[t]||(Z[t]={})},et=f(function(t){var e=tt("wks"),n=m.Symbol,r="function"==typeof n;(t.exports=function(t){return e[t]||(e[t]=r&&n[t]||(r?n:M)("Symbol."+t))}).store=e}),nt=et("species"),rt=function(t){var e;return $(t)&&(e=t.constructor,"function"!=typeof e||e!==Array&&!$(e.prototype)||(e=void 0),v(e)&&null===(e=e[nt])&&(e=void 0)),void 0===e?Array:e},it=function(t,e){return new(rt(t))(e)},ot=function(t,e){var n=1==t,r=2==t,i=3==t,o=4==t,a=6==t,s=5==t||a,u=e||it;return function(e,c,l){for(var h,f,p=G(e),d=K(p),y=B(c,l,3),m=J(d.length),g=0,v=n?u(e,m):r?u(e,0):void 0;m>g;g++)if((s||g in d)&&(h=d[g],f=y(h,g,p),t))if(n)v[g]=f;else if(f)switch(t){case 3:return!0;case 5:return h;case 6:return g;case 2:v.push(h)}else if(o)return!1;return a?-1:i||o?o:v}},at=et("unscopables"),st=Array.prototype;void 0==st[at]&&O(st,at,{});var ut=function(t){st[at][t]=!0},ct=ot(5),lt=!0;"find"in[]&&Array(1).find(function(){lt=!1}),j(j.P+j.F*lt,"Array",{find:function(t){return ct(this,t,arguments.length>1?arguments[1]:void 0)}}),ut("find");var ht=(g.Array.find,ot(6)),ft=!0;"findIndex"in[]&&Array(1).findIndex(function(){ft=!1}),j(j.P+j.F*ft,"Array",{findIndex:function(t){return ht(this,t,arguments.length>1?arguments[1]:void 0)}}),ut("findIndex");var pt=(g.Array.findIndex,function(t){return K(H(t))}),dt=Math.max,yt=Math.min,mt=function(t,e){return t=Y(t),t<0?dt(t+e,0):yt(t,e)},gt=tt("keys"),vt=function(t){return gt[t]||(gt[t]=M(t))},bt=function(t){return function(e,n,r){var i,o=pt(e),a=J(o.length),s=mt(r,a);if(t&&n!=n){for(;a>s;)if((i=o[s++])!=i)return!0}else for(;a>s;s++)if((t||s in o)&&o[s]===n)return t||s||0;return!t&&-1}}(!1),_t=vt("IE_PROTO"),wt=function(t,e){var n,r=pt(t),i=0,o=[];for(n in r)n!=_t&&P(r,n)&&o.push(n);for(;e.length>i;)P(r,n=e[i++])&&(~bt(o,n)||o.push(n));return o},Et="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),Tt=Object.keys||function(t){return wt(t,Et)},St=Object.getOwnPropertySymbols,Ct={f:St},It={}.propertyIsEnumerable,Nt={f:It},kt=Object.assign,At=!kt||_(function(){var t={},e={},n=Symbol(),r="abcdefghijklmnopqrst";return t[n]=7,r.split("").forEach(function(t){e[t]=t}),7!=kt({},t)[n]||Object.keys(kt({},e)).join("")!=r})?function(t,e){for(var n=G(t),r=arguments.length,i=1,o=Ct.f,a=Nt.f;r>i;)for(var s,u=K(arguments[i++]),c=o?Tt(u).concat(o(u)):Tt(u),l=c.length,h=0;l>h;)a.call(u,s=c[h++])&&(n[s]=u[s]);return n}:kt;j(j.S+j.F,"Object",{assign:At});var Rt=(g.Object.assign,et("match")),Ot=function(t){var e;return v(t)&&(void 0!==(e=t[Rt])?!!e:"RegExp"==W(t))},Dt=function(t,e,n){if(Ot(e))throw TypeError("String#"+n+" doesn't accept regex!");return String(H(t))},Pt=et("match"),xt="".startsWith;j(j.P+j.F*function(t){var e=/./;try{"/./"[t](e)}catch(n){try{return e[Pt]=!1,!"/./"[t](e)}catch(t){}}return!0}("startsWith"),"String",{startsWith:function(t){var e=Dt(this,t,"startsWith"),n=J(Math.min(arguments.length>1?arguments[1]:void 0,e.length)),r=String(t);return xt?xt.call(e,r,n):e.slice(n,n+r.length)===r}});var Lt=(g.String.startsWith,function(t){var e=String(H(this)),n="",r=Y(t);if(r<0||r==1/0)throw RangeError("Count can't be negative");for(;r>0;(r>>>=1)&&(e+=e))1&r&&(n+=e);return n});j(j.P,"String",{repeat:Lt});var Mt=(g.String.repeat,f(function(t){var e=M("meta"),n=A.f,r=0,i=Object.isExtensible||function(){return!0},o=!_(function(){return i(Object.preventExtensions({}))}),a=function(t){n(t,e,{value:{i:"O"+ ++r,w:{}}})},s=function(t,n){if(!v(t))return"symbol"==typeof t?t:("string"==typeof t?"S":"P")+t;if(!P(t,e)){if(!i(t))return"F";if(!n)return"E";a(t)}return t[e].i},u=function(t,n){if(!P(t,e)){if(!i(t))return!0;if(!n)return!1;a(t)}return t[e].w},c=function(t){return o&&l.NEED&&i(t)&&!P(t,e)&&a(t),t},l=t.exports={KEY:e,NEED:!1,fastKey:s,getWeak:u,onFreeze:c}})),Ft=(Mt.KEY,Mt.NEED,Mt.fastKey,Mt.getWeak,Mt.onFreeze,A.f),Ut=et("toStringTag"),Bt=function(t,e,n){t&&!P(t=n?t:t.prototype,Ut)&&Ft(t,Ut,{configurable:!0,value:e})},Vt=et,jt={f:Vt},qt=A.f,Wt=function(t){var e=g.Symbol||(g.Symbol=m.Symbol||{});"_"==t.charAt(0)||t in e||qt(e,t,{value:jt.f(t)})},Kt=function(t){var e=Tt(t),n=Ct.f;if(n)for(var r,i=n(t),o=Nt.f,a=0;i.length>a;)o.call(t,r=i[a++])&&e.push(r);return e},Ht=w?Object.defineProperties:function(t,e){b(t);for(var n,r=Tt(e),i=r.length,o=0;i>o;)A.f(t,n=r[o++],e[n]);return t},Gt=m.document,Qt=Gt&&Gt.documentElement,zt=vt("IE_PROTO"),Yt=function(){},Xt=function(){var t,e=S("iframe"),n=Et.length;for(e.style.display="none",Qt.appendChild(e),e.src="javascript:",t=e.contentWindow.document,t.open(),t.write("<script>document.F=Object<\/script>"),t.close(),Xt=t.F;n--;)delete Xt.prototype[Et[n]];return Xt()},Jt=Object.create||function(t,e){var n;return null!==t?(Yt.prototype=b(t),n=new Yt,Yt.prototype=null,n[zt]=t):n=Xt(),void 0===e?n:Ht(n,e)},$t=Et.concat("length","prototype"),Zt=Object.getOwnPropertyNames||function(t){return wt(t,$t)},te={f:Zt},ee=te.f,ne={}.toString,re="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],ie=function(t){try{return ee(t)}catch(t){return re.slice()}},oe=function(t){return re&&"[object Window]"==ne.call(t)?ie(t):ee(pt(t))},ae={f:oe},se=Object.getOwnPropertyDescriptor,ue=w?se:function(t,e){if(t=pt(t),e=I(e,!0),C)try{return se(t,e)}catch(t){}if(P(t,e))return R(!Nt.f.call(t,e),t[e])},ce={f:ue},le=Mt.KEY,he=ce.f,fe=A.f,pe=ae.f,de=m.Symbol,ye=m.JSON,me=ye&&ye.stringify,ge=et("_hidden"),ve=et("toPrimitive"),be={}.propertyIsEnumerable,_e=tt("symbol-registry"),we=tt("symbols"),Ee=tt("op-symbols"),Te=Object.prototype,Se="function"==typeof de,Ce=m.QObject,Ie=!Ce||!Ce.prototype||!Ce.prototype.findChild,Ne=w&&_(function(){return 7!=Jt(fe({},"a",{get:function(){return fe(this,"a",{value:7}).a}})).a})?function(t,e,n){var r=he(Te,e);r&&delete Te[e],fe(t,e,n),r&&t!==Te&&fe(Te,e,r)}:fe,ke=function(t){var e=we[t]=Jt(de.prototype);return e._k=t,e},Ae=Se&&"symbol"==typeof de.iterator?function(t){return"symbol"==typeof t}:function(t){return t instanceof de},Re=function(t,e,n){return t===Te&&Re(Ee,e,n),b(t),e=I(e,!0),b(n),P(we,e)?(n.enumerable?(P(t,ge)&&t[ge][e]&&(t[ge][e]=!1),n=Jt(n,{enumerable:R(0,!1)})):(P(t,ge)||fe(t,ge,R(1,{})),t[ge][e]=!0),Ne(t,e,n)):fe(t,e,n)},Oe=function(t,e){b(t);for(var n,r=Kt(e=pt(e)),i=0,o=r.length;o>i;)Re(t,n=r[i++],e[n]);return t},De=function(t,e){return void 0===e?Jt(t):Oe(Jt(t),e)},Pe=function(t){var e=be.call(this,t=I(t,!0));return!(this===Te&&P(we,t)&&!P(Ee,t))&&(!(e||!P(this,t)||!P(we,t)||P(this,ge)&&this[ge][t])||e)},xe=function(t,e){if(t=pt(t),e=I(e,!0),t!==Te||!P(we,e)||P(Ee,e)){var n=he(t,e);return!n||!P(we,e)||P(t,ge)&&t[ge][e]||(n.enumerable=!0),n}},Le=function(t){for(var e,n=pe(pt(t)),r=[],i=0;n.length>i;)P(we,e=n[i++])||e==ge||e==le||r.push(e);return r},Me=function(t){for(var e,n=t===Te,r=pe(n?Ee:pt(t)),i=[],o=0;r.length>o;)!P(we,e=r[o++])||n&&!P(Te,e)||i.push(we[e]);return i};Se||(de=function(){if(this instanceof de)throw TypeError("Symbol is not a constructor!");var t=M(arguments.length>0?arguments[0]:void 0),e=function(n){this===Te&&e.call(Ee,n),P(this,ge)&&P(this[ge],t)&&(this[ge][t]=!1),Ne(this,t,R(1,n))};return w&&Ie&&Ne(Te,t,{configurable:!0,set:e}),ke(t)},F(de.prototype,"toString",function(){return this._k}),ce.f=xe,A.f=Re,te.f=ae.f=Le,Nt.f=Pe,Ct.f=Me,w&&F(Te,"propertyIsEnumerable",Pe,!0),jt.f=function(t){return ke(et(t))}),j(j.G+j.W+j.F*!Se,{Symbol:de});for(var Fe="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),Ue=0;Fe.length>Ue;)et(Fe[Ue++]);for(var Be=Tt(et.store),Ve=0;Be.length>Ve;)Wt(Be[Ve++]);j(j.S+j.F*!Se,"Symbol",{for:function(t){return P(_e,t+="")?_e[t]:_e[t]=de(t)},keyFor:function(t){if(!Ae(t))throw TypeError(t+" is not a symbol!");for(var e in _e)if(_e[e]===t)return e},useSetter:function(){Ie=!0},useSimple:function(){Ie=!1}}),j(j.S+j.F*!Se,"Object",{create:De,defineProperty:Re,defineProperties:Oe,getOwnPropertyDescriptor:xe,getOwnPropertyNames:Le,getOwnPropertySymbols:Me}),ye&&j(j.S+j.F*(!Se||_(function(){var t=de();return"[null]"!=me([t])||"{}"!=me({a:t})||"{}"!=me(Object(t))})),"JSON",{stringify:function(t){for(var e,n,r=[t],i=1;arguments.length>i;)r.push(arguments[i++]);if(n=e=r[1],(v(e)||void 0!==t)&&!Ae(t))return $(e)||(e=function(t,e){if("function"==typeof n&&(e=n.call(this,t,e)),!Ae(e))return e}),r[1]=e,me.apply(ye,r)}}),de.prototype[ve]||O(de.prototype,ve,de.prototype.valueOf),Bt(de,"Symbol"),Bt(Math,"Math",!0),Bt(m.JSON,"JSON",!0);var je=et("toStringTag"),qe="Arguments"==W(function(){return arguments}()),We=function(t,e){try{return t[e]}catch(t){}},Ke=function(t){var e,n,r;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(n=We(e=Object(t),je))?n:qe?W(e):"Object"==(r=W(e))&&"function"==typeof e.callee?"Arguments":r},He={};He[et("toStringTag")]="z",He+""!="[object z]"&&F(Object.prototype,"toString",function(){return"[object "+Ke(this)+"]"},!0),Wt("asyncIterator"),Wt("observable");var Ge=(g.Symbol,{}),Qe={};O(Qe,et("iterator"),function(){return this});var ze=function(t,e,n){t.prototype=Jt(Qe,{next:R(1,n)}),Bt(t,e+" Iterator")},Ye=vt("IE_PROTO"),Xe=Object.prototype,Je=Object.getPrototypeOf||function(t){return t=G(t),P(t,Ye)?t[Ye]:"function"==typeof t.constructor&&t instanceof t.constructor?t.constructor.prototype:t instanceof Object?Xe:null},$e=et("iterator"),Ze=!([].keys&&"next"in[].keys()),tn=function(){return this},en=function(t,e,n,r,i,o,a){ze(n,e,r);var s,u,c,l=function(t){if(!Ze&&t in d)return d[t];switch(t){case"keys":case"values":return function(){return new n(this,t)}}return function(){return new n(this,t)}},h=e+" Iterator",f="values"==i,p=!1,d=t.prototype,y=d[$e]||d["@@iterator"]||i&&d[i],m=y||l(i),g=i?f?l("entries"):m:void 0,v="Array"==e?d.entries||y:y;if(v&&(c=Je(v.call(new t)))!==Object.prototype&&c.next&&(Bt(c,h,!0),"function"!=typeof c[$e]&&O(c,$e,tn)),f&&y&&"values"!==y.name&&(p=!0,m=function(){return y.call(this)}),(Ze||p||!d[$e])&&O(d,$e,m),Ge[e]=m,Ge[h]=tn,i)if(s={values:f?m:l("values"),keys:o?m:l("keys"),entries:g},a)for(u in s)u in d||F(d,u,s[u]);else j(j.P+j.F*(Ze||p),e,s);return s},nn=function(t){return function(e,n){var r,i,o=String(H(e)),a=Y(n),s=o.length;return a<0||a>=s?t?"":void 0:(r=o.charCodeAt(a),r<55296||r>56319||a+1===s||(i=o.charCodeAt(a+1))<56320||i>57343?t?o.charAt(a):r:t?o.slice(a,a+2):i-56320+(r-55296<<10)+65536)}}(!0);en(String,"String",function(t){this._t=String(t),this._i=0},function(){var t,e=this._t,n=this._i;return n>=e.length?{value:void 0,done:!0}:(t=nn(e,n),this._i+=t.length,{value:t,done:!1})});var rn=function(t,e){return{value:e,done:!!t}},on=en(Array,"Array",function(t,e){this._t=pt(t),this._i=0,this._k=e},function(){var t=this._t,e=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,rn(1)):"keys"==e?rn(0,n):"values"==e?rn(0,t[n]):rn(0,[n,t[n]])},"values");Ge.Arguments=Ge.Array,ut("keys"),ut("values"),ut("entries");for(var an=et("iterator"),sn=et("toStringTag"),un=Ge.Array,cn={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},ln=Tt(cn),hn=0;hn<ln.length;hn++){var fn,pn=ln[hn],dn=cn[pn],yn=m[pn],mn=yn&&yn.prototype;if(mn&&(mn[an]||O(mn,an,un),mn[sn]||O(mn,sn,pn),Ge[pn]=un,dn))for(fn in on)mn[fn]||F(mn,fn,on[fn],!0)}jt.f("iterator")}.call(e,n(38).setImmediate,n(1))},function(t,e,n){(function(t){function r(t,e){this._id=t,this._clearFn=e}var i="undefined"!==typeof t&&t||"undefined"!==typeof self&&self||window,o=Function.prototype.apply;e.setTimeout=function(){return new r(o.call(setTimeout,i,arguments),clearTimeout)},e.setInterval=function(){return new r(o.call(setInterval,i,arguments),clearInterval)},e.clearTimeout=e.clearInterval=function(t){t&&t.close()},r.prototype.unref=r.prototype.ref=function(){},r.prototype.close=function(){this._clearFn.call(i,this._id)},e.enroll=function(t,e){clearTimeout(t._idleTimeoutId),t._idleTimeout=e},e.unenroll=function(t){clearTimeout(t._idleTimeoutId),t._idleTimeout=-1},e._unrefActive=e.active=function(t){clearTimeout(t._idleTimeoutId);var e=t._idleTimeout;e>=0&&(t._idleTimeoutId=setTimeout(function(){t._onTimeout&&t._onTimeout()},e))},n(39),e.setImmediate="undefined"!==typeof self&&self.setImmediate||"undefined"!==typeof t&&t.setImmediate||this&&this.setImmediate,e.clearImmediate="undefined"!==typeof self&&self.clearImmediate||"undefined"!==typeof t&&t.clearImmediate||this&&this.clearImmediate}).call(e,n(1))},function(t,e,n){(function(t,e){!function(t,n){"use strict";function r(t){"function"!==typeof t&&(t=new Function(""+t));for(var e=new Array(arguments.length-1),n=0;n<e.length;n++)e[n]=arguments[n+1];var r={callback:t,args:e};return c[u]=r,s(u),u++}function i(t){delete c[t]}function o(t){var e=t.callback,r=t.args;switch(r.length){case 0:e();break;case 1:e(r[0]);break;case 2:e(r[0],r[1]);break;case 3:e(r[0],r[1],r[2]);break;default:e.apply(n,r)}}function a(t){if(l)setTimeout(a,0,t);else{var e=c[t];if(e){l=!0;try{o(e)}finally{i(t),l=!1}}}}if(!t.setImmediate){var s,u=1,c={},l=!1,h=t.document,f=Object.getPrototypeOf&&Object.getPrototypeOf(t);f=f&&f.setTimeout?f:t,"[object process]"==={}.toString.call(t.process)?function(){s=function(t){e.nextTick(function(){a(t)})}}():function(){if(t.postMessage&&!t.importScripts){var e=!0,n=t.onmessage;return t.onmessage=function(){e=!1},t.postMessage("","*"),t.onmessage=n,e}}()?function(){var e="setImmediate$"+Math.random()+"$",n=function(n){n.source===t&&"string"===typeof n.data&&0===n.data.indexOf(e)&&a(+n.data.slice(e.length))};t.addEventListener?t.addEventListener("message",n,!1):t.attachEvent("onmessage",n),s=function(n){t.postMessage(e+n,"*")}}():t.MessageChannel?function(){var t=new MessageChannel;t.port1.onmessage=function(t){a(t.data)},s=function(e){t.port2.postMessage(e)}}():h&&"onreadystatechange"in h.createElement("script")?function(){var t=h.documentElement;s=function(e){var n=h.createElement("script");n.onreadystatechange=function(){a(e),n.onreadystatechange=null,t.removeChild(n),n=null},t.appendChild(n)}}():function(){s=function(t){setTimeout(a,0,t)}}(),f.setImmediate=r,f.clearImmediate=i}}("undefined"===typeof self?"undefined"===typeof t?this:t:self)}).call(e,n(1),n(12))},function(t,e,n){(function(t){(function(){function t(t){return"string"==typeof t}function e(t){return"boolean"==typeof t}function r(){}function i(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&"undefined"!=typeof t.splice&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||"undefined"!=typeof t.call&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&"undefined"==typeof t.call)return"object";return e}function o(t){return null===t}function a(t){return"array"==i(t)}function s(t){var e=i(t);return"array"==e||"object"==e&&"number"==typeof t.length}function u(t){return"function"==i(t)}function c(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}function l(t,e,n){return t.call.apply(t.bind,arguments)}function h(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function f(t,e,n){return f=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?l:h,f.apply(null,arguments)}function p(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function d(t,e){function n(){}n.prototype=e.prototype,t.lb=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.cd=function(t,n,r){for(var i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];return e.prototype[n].apply(t,i)}}function y(t){t.prototype.then=t.prototype.then,t.prototype.$goog_Thenable=!0}function m(t){if(!t)return!1;try{return!!t.$goog_Thenable}catch(t){return!1}}function g(t){if(Error.captureStackTrace)Error.captureStackTrace(this,g);else{var e=Error().stack;e&&(this.stack=e)}t&&(this.message=String(t))}function v(t,e){t=t.split("%s");for(var n="",r=t.length-1,i=0;i<r;i++)n+=t[i]+(i<e.length?e[i]:"%s");g.call(this,n+t[r])}function b(t,e){throw new v("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1))}function _(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function w(t,e){t.f(e),100>t.b&&(t.b++,e.next=t.a,t.a=e)}function E(){this.b=this.a=null}function T(){var t=Yu,e=null;return t.a&&(e=t.a,t.a=t.a.next,t.a||(t.b=null),e.next=null),e}function S(){this.next=this.b=this.a=null}function C(e,n){var r=e.length,i=t(e)?e.split(""):e;for(--r;0<=r;--r)r in i&&n.call(void 0,i[r],r,e)}function I(e){t:{for(var n=Hr,r=e.length,i=t(e)?e.split(""):e,o=0;o<r;o++)if(o in i&&n.call(void 0,i[o],o,e)){n=o;break t}n=-1}return 0>n?null:t(e)?e.charAt(n):e[n]}function N(t,e){return 0<=Ou(t,e)}function k(t,e){e=Ou(t,e);var n;return(n=0<=e)&&Array.prototype.splice.call(t,e,1),n}function A(t,e){var n=0;C(t,function(r,i){e.call(void 0,r,i,t)&&1==Array.prototype.splice.call(t,i,1).length&&n++})}function R(t){return Array.prototype.concat.apply([],arguments)}function O(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function D(t,e){for(var n=t.split("%s"),r="",i=Array.prototype.slice.call(arguments,1);i.length&&1<n.length;)r+=n.shift()+i.shift();return r+n.join("%s")}function P(t){return qu.test(t)?(-1!=t.indexOf("&")&&(t=t.replace(Mu,"&")),-1!=t.indexOf("<")&&(t=t.replace(Fu,"<")),-1!=t.indexOf(">")&&(t=t.replace(Uu,">")),-1!=t.indexOf('"')&&(t=t.replace(Bu,""")),-1!=t.indexOf("'")&&(t=t.replace(Vu,"'")),-1!=t.indexOf("\0")&&(t=t.replace(ju,"�")),t):t}function x(t,e){return-1!=t.indexOf(e)}function L(t,e){return t<e?-1:t>e?1:0}function M(t){return x(Ru,t)}function F(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function U(t){for(var e in t)return!1;return!0}function B(t){var e,n={};for(e in t)n[e]=t[e];return n}function V(t,e){for(var n,r,i=1;i<arguments.length;i++){r=arguments[i];for(n in r)t[n]=r[n];for(var o=0;o<Qu.length;o++)n=Qu[o],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function j(t){Cu.setTimeout(function(){throw t},0)}function q(){var t=Cu.MessageChannel;if("undefined"===typeof t&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!M("Presto")&&(t=function(){var t=document.createElement("IFRAME");t.style.display="none",t.src="",document.documentElement.appendChild(t);var e=t.contentWindow;t=e.document,t.open(),t.write(""),t.close();var n="callImmediate"+Math.random(),r="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host;t=f(function(t){"*"!=r&&t.origin!=r||t.data!=n||this.port1.onmessage()},this),e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,r)}}}),"undefined"!==typeof t&&!M("Trident")&&!M("MSIE")){var e=new t,n={},r=n;return e.port1.onmessage=function(){if(void 0!==n.next){n=n.next;var t=n.tb;n.tb=null,t()}},function(t){r.next={tb:t},r=r.next,e.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(t){var e=document.createElement("SCRIPT");e.onreadystatechange=function(){e.onreadystatechange=null,e.parentNode.removeChild(e),e=null,t(),t=null},document.documentElement.appendChild(e)}:function(t){Cu.setTimeout(t,0)}}function W(t,e){Gu||K(),zu||(Gu(),zu=!0),Yu.add(t,e)}function K(){if(Cu.Promise&&Cu.Promise.resolve){var t=Cu.Promise.resolve(void 0);Gu=function(){t.then(H)}}else Gu=function(){var t=H;!u(Cu.setImmediate)||Cu.Window&&Cu.Window.prototype&&!M("Edge")&&Cu.Window.prototype.setImmediate==Cu.setImmediate?(Hu||(Hu=q()),Hu(t)):Cu.setImmediate(t)}}function H(){for(var t;t=T();){try{t.a.call(t.b)}catch(t){j(t)}w(Au,t)}zu=!1}function G(t,e){if(this.a=Xu,this.i=void 0,this.f=this.b=this.c=null,this.g=this.h=!1,t!=r)try{var n=this;t.call(e,function(t){rt(n,Ju,t)},function(t){if(!(t instanceof ht))try{if(t instanceof Error)throw t;throw Error("Promise rejected.")}catch(t){}rt(n,$u,t)})}catch(t){rt(this,$u,t)}}function Q(){this.next=this.f=this.b=this.g=this.a=null,this.c=!1}function z(t,e,n){var r=Zu.get();return r.g=t,r.b=e,r.f=n,r}function Y(t){if(t instanceof G)return t;var e=new G(r);return rt(e,Ju,t),e}function X(t){return new G(function(e,n){n(t)})}function J(t,e,n){it(t,e,n,null)||W(p(e,t))}function $(t){return new G(function(e,n){var r=t.length,i=[];if(r)for(var o,a=function(t,n){r--,i[t]=n,0==r&&e(i)},s=function(t){n(t)},u=0;u<t.length;u++)o=t[u],J(o,p(a,u),s);else e(i)})}function Z(t){return new G(function(e){var n=t.length,r=[];if(n)for(var i,o=function(t,i,o){n--,r[t]=i?{Zb:!0,value:o}:{Zb:!1,reason:o},0==n&&e(r)},a=0;a<t.length;a++)i=t[a],J(i,p(o,a,!0),p(o,a,!1));else e(r)})}function tt(t,e){if(t.a==Xu)if(t.c){var n=t.c;if(n.b){for(var r=0,i=null,o=null,a=n.b;a&&(a.c||(r++,a.a==t&&(i=a),!(i&&1<r)));a=a.next)i||(o=a);i&&(n.a==Xu&&1==r?tt(n,e):(o?(r=o,r.next==n.f&&(n.f=r),r.next=r.next.next):st(n),ut(n,i,$u,e)))}t.c=null}else rt(t,$u,e)}function et(t,e){t.b||t.a!=Ju&&t.a!=$u||at(t),t.f?t.f.next=e:t.b=e,t.f=e}function nt(t,e,n,r){var i=z(null,null,null);return i.a=new G(function(t,o){i.g=e?function(n){try{var i=e.call(r,n);t(i)}catch(t){o(t)}}:t,i.b=n?function(e){try{var i=n.call(r,e);void 0===i&&e instanceof ht?o(e):t(i)}catch(t){o(t)}}:o}),i.a.c=t,et(t,i),i.a}function rt(t,e,n){t.a==Xu&&(t===n&&(e=$u,n=new TypeError("Promise cannot resolve to itself")),t.a=1,it(n,t.Lc,t.Mc,t)||(t.i=n,t.a=e,t.c=null,at(t),e!=$u||n instanceof ht||lt(t,n)))}function it(t,e,n,i){if(t instanceof G)return et(t,z(e||r,n||null,i)),!0;if(m(t))return t.then(e,n,i),!0;if(c(t))try{var o=t.then;if(u(o))return ot(t,o,e,n,i),!0}catch(t){return n.call(i,t),!0}return!1}function ot(t,e,n,r,i){function o(t){s||(s=!0,r.call(i,t))}function a(t){s||(s=!0,n.call(i,t))}var s=!1;try{e.call(t,a,o)}catch(t){o(t)}}function at(t){t.h||(t.h=!0,W(t.Ub,t))}function st(t){var e=null;return t.b&&(e=t.b,t.b=e.next,e.next=null),t.b||(t.f=null),e}function ut(t,e,n,r){if(n==$u&&e.b&&!e.c)for(;t&&t.g;t=t.c)t.g=!1;if(e.a)e.a.c=null,ct(e,n,r);else try{e.c?e.g.call(e.f):ct(e,n,r)}catch(t){tc.call(null,t)}w(Zu,e)}function ct(t,e,n){e==Ju?t.g.call(t.f,n):t.b&&t.b.call(t.f,n)}function lt(t,e){t.g=!0,W(function(){t.g&&tc.call(null,e)})}function ht(t){g.call(this,t)}function ft(){0!=ec&&(nc[this[Iu]||(this[Iu]=++Nu)]=this),this.pa=this.pa,this.ja=this.ja}function pt(t){if(!t.pa&&(t.pa=!0,t.ua(),0!=ec)){var e=t[Iu]||(t[Iu]=++Nu);if(0!=ec&&t.ja&&0<t.ja.length)throw Error(t+" did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.");delete nc[e]}}function dt(t){return dt[" "](t),t}function yt(t,e){var n=dc;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}function mt(){var t=Cu.document;return t?t.documentMode:void 0}function gt(t){return yt(t,function(){for(var e=0,n=Lu(String(rc)).split("."),r=Lu(String(t)).split("."),i=Math.max(n.length,r.length),o=0;0==e&&o<i;o++){var a=n[o]||"",s=r[o]||"";do{if(a=/(\d*)(\D*)(.*)/.exec(a)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],0==a[0].length&&0==s[0].length)break;e=L(0==a[1].length?0:parseInt(a[1],10),0==s[1].length?0:parseInt(s[1],10))||L(0==a[2].length,0==s[2].length)||L(a[2],s[2]),a=a[3],s=s[3]}while(0==e)}return 0<=e})}function vt(t,e){this.type=t,this.b=this.target=e,this.Gb=!0}function bt(e,n){if(vt.call(this,e?e.type:""),this.relatedTarget=this.b=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.pointerId=0,this.pointerType="",this.a=null,e){var r=this.type=e.type,i=e.changedTouches?e.changedTouches[0]:null;if(this.target=e.target||e.srcElement,this.b=n,n=e.relatedTarget){if(uc){t:{try{dt(n.nodeName);var o=!0;break t}catch(t){}o=!1}o||(n=null)}}else"mouseover"==r?n=e.fromElement:"mouseout"==r&&(n=e.toElement);this.relatedTarget=n,null===i?(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.clientX=void 0!==i.clientX?i.clientX:i.pageX,this.clientY=void 0!==i.clientY?i.clientY:i.pageY,this.screenX=i.screenX||0,this.screenY=i.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=t(e.pointerType)?e.pointerType:_c[e.pointerType]||"",this.a=e,e.defaultPrevented&&this.preventDefault()}}function _t(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.La=i,this.key=++Ec,this.na=this.Ia=!1}function wt(t){t.na=!0,t.listener=null,t.proxy=null,t.src=null,t.La=null}function Et(t){this.src=t,this.a={},this.b=0}function Tt(t,e){var n=e.type;n in t.a&&k(t.a[n],e)&&(wt(e),0==t.a[n].length&&(delete t.a[n],t.b--))}function St(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.na&&o.listener==e&&o.capture==!!n&&o.La==r)return i}return-1}function Ct(t,e,n,r,i){if(r&&r.once)kt(t,e,n,r,i);else if(a(e))for(var o=0;o<e.length;o++)Ct(t,e[o],n,r,i);else n=Mt(n),t&&t[wc]?Ut(t,e,n,c(r)?!!r.capture:!!r,i):It(t,e,n,!1,r,i)}function It(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var a=c(i)?!!i.capture:!!i,s=Lt(t);if(s||(t[Tc]=s=new Et(t)),n=s.add(e,n,r,a,o),!n.proxy){if(r=Nt(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)bc||(i=a),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(Ot(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}Cc++}}function Nt(){var t=xt,e=gc?function(n){return t.call(e.src,e.listener,n)}:function(n){if(!(n=t.call(e.src,e.listener,n)))return n};return e}function kt(t,e,n,r,i){if(a(e))for(var o=0;o<e.length;o++)kt(t,e[o],n,r,i);else n=Mt(n),t&&t[wc]?Bt(t,e,n,c(r)?!!r.capture:!!r,i):It(t,e,n,!0,r,i)}function At(t,e,n,r,i){if(a(e))for(var o=0;o<e.length;o++)At(t,e[o],n,r,i);else r=c(r)?!!r.capture:!!r,n=Mt(n),t&&t[wc]?(t=t.m,(e=String(e).toString())in t.a&&(o=t.a[e],-1<(n=St(o,n,r,i))&&(wt(o[n]),Array.prototype.splice.call(o,n,1),0==o.length&&(delete t.a[e],t.b--)))):t&&(t=Lt(t))&&(e=t.a[e.toString()],t=-1,e&&(t=St(e,n,r,i)),(n=-1<t?e[t]:null)&&Rt(n))}function Rt(t){if("number"!=typeof t&&t&&!t.na){var e=t.src;if(e&&e[wc])Tt(e.m,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(Ot(n),r):e.addListener&&e.removeListener&&e.removeListener(r),Cc--,(n=Lt(e))?(Tt(n,t),0==n.b&&(n.src=null,e[Tc]=null)):wt(t)}}}function Ot(t){return t in Sc?Sc[t]:Sc[t]="on"+t}function Dt(t,e,n,r){var i=!0;if((t=Lt(t))&&(e=t.a[e.toString()]))for(e=e.concat(),t=0;t<e.length;t++){var o=e[t];o&&o.capture==n&&!o.na&&(o=Pt(o,r),i=i&&!1!==o)}return i}function Pt(t,e){var n=t.listener,r=t.La||t.src;return t.Ia&&Rt(t),n.call(r,e)}function xt(t,e){if(t.na)return!0;if(!gc){if(!e)t:{e=["window","event"];for(var n=Cu,r=0;r<e.length;r++)if(null==(n=n[e[r]])){e=null;break t}e=n}if(r=e,e=new bt(r,this),n=!0,!(0>r.keyCode||void 0!=r.returnValue)){t:{var i=!1;if(0==r.keyCode)try{r.keyCode=-1;break t}catch(t){i=!0}(i||void 0==r.returnValue)&&(r.returnValue=!0)}for(r=[],i=e.b;i;i=i.parentNode)r.push(i);for(t=t.type,i=r.length-1;0<=i;i--){e.b=r[i];var o=Dt(r[i],t,!0,e);n=n&&o}for(i=0;i<r.length;i++)e.b=r[i],o=Dt(r[i],t,!1,e),n=n&&o}return n}return Pt(t,new bt(e,this))}function Lt(t){return t=t[Tc],t instanceof Et?t:null}function Mt(t){return u(t)?t:(t[Ic]||(t[Ic]=function(e){return t.handleEvent(e)}),t[Ic])}function Ft(){ft.call(this),this.m=new Et(this),this.Nb=this,this.Ua=null}function Ut(t,e,n,r,i){t.m.add(String(e),n,!1,r,i)}function Bt(t,e,n,r,i){t.m.add(String(e),n,!0,r,i)}function Vt(t,e,n,r){if(!(e=t.m.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var a=e[o];if(a&&!a.na&&a.capture==n){var s=a.listener,u=a.La||a.src;a.Ia&&Tt(t.m,a),i=!1!==s.call(u,r)&&i}}return i&&0!=r.Gb}function jt(t,e,n){if(u(t))n&&(t=f(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=f(t.handleEvent,t)}return 2147483647<Number(e)?-1:Cu.setTimeout(t,e||0)}function qt(t){var e=null;return new G(function(n,r){-1==(e=jt(function(){n(void 0)},t))&&r(Error("Failed to schedule timer."))}).s(function(t){throw Cu.clearTimeout(e),t})}function Wt(e){if(e.S&&"function"==typeof e.S)return e.S();if(t(e))return e.split("");if(s(e)){for(var n=[],r=e.length,i=0;i<r;i++)n.push(e[i]);return n}n=[],r=0;for(i in e)n[r++]=e[i];return n}function Kt(e){if(e.U&&"function"==typeof e.U)return e.U();if(!e.S||"function"!=typeof e.S){if(s(e)||t(e)){var n=[];e=e.length;for(var r=0;r<e;r++)n.push(r);return n}n=[],r=0;for(var i in e)n[r++]=i;return n}}function Ht(e,n){if(e.forEach&&"function"==typeof e.forEach)e.forEach(n,void 0);else if(s(e)||t(e))Du(e,n,void 0);else for(var r=Kt(e),i=Wt(e),o=i.length,a=0;a<o;a++)n.call(void 0,i[a],r&&r[a],e)}function Gt(t,e){this.b={},this.a=[],this.c=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof Gt)for(n=t.U(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function Qt(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];zt(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){var i={};for(n=e=0;e<t.a.length;)r=t.a[e],zt(i,r)||(t.a[n++]=r,i[r]=1),e++;t.a.length=n}}function zt(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function Yt(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var o=t[n].substring(0,r);i=t[n].substring(r+1)}else o=t[n];e(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}function Xt(t,e){if(this.b=this.m=this.c="",this.i=null,this.h=this.g="",this.f=!1,t instanceof Xt){this.f=void 0!==e?e:t.f,Jt(this,t.c),this.m=t.m,this.b=t.b,$t(this,t.i),this.g=t.g,e=t.a;var n=new se;n.c=e.c,e.a&&(n.a=new Gt(e.a),n.b=e.b),Zt(this,n),this.h=t.h}else t&&(n=String(t).match(Nc))?(this.f=!!e,Jt(this,n[1]||"",!0),this.m=ie(n[2]||""),this.b=ie(n[3]||"",!0),$t(this,n[4]),this.g=ie(n[5]||"",!0),Zt(this,n[6]||"",!0),this.h=ie(n[7]||"")):(this.f=!!e,this.a=new se(null,this.f))}function Jt(t,e,n){t.c=n?ie(e,!0):e,t.c&&(t.c=t.c.replace(/:$/,""))}function $t(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.i=e}else t.i=null}function Zt(t,e,n){e instanceof se?(t.a=e,de(t.a,t.f)):(n||(e=oe(e,Oc)),t.a=new se(e,t.f))}function te(t,e,n){t.a.set(e,n)}function ee(t,e){return t.a.get(e)}function ne(t){return t instanceof Xt?new Xt(t):new Xt(t,void 0)}function re(t,e){var n=new Xt(null,void 0);return Jt(n,"https"),t&&(n.b=t),e&&(n.g=e),n}function ie(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function oe(e,n,r){return t(e)?(e=encodeURI(e).replace(n,ae),r&&(e=e.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),e):null}function ae(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)}function se(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function ue(t){t.a||(t.a=new Gt,t.b=0,t.c&&Yt(t.c,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}function ce(t){var e=Kt(t);if("undefined"==typeof e)throw Error("Keys are undefined");var n=new se(null,void 0);t=Wt(t);for(var r=0;r<e.length;r++){var i=e[r],o=t[r];a(o)?fe(n,i,o):n.add(i,o)}return n}function le(t,e){ue(t),e=pe(t,e),zt(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,t=t.a,zt(t.b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&Qt(t)))}function he(t,e){return ue(t),e=pe(t,e),zt(t.a.b,e)}function fe(t,e,n){le(t,e),0<n.length&&(t.c=null,t.a.set(pe(t,e),O(n)),t.b+=n.length)}function pe(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function de(t,e){e&&!t.f&&(ue(t),t.c=null,t.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(le(this,e),fe(this,n,t))},t)),t.f=e}function ye(){this.a="",this.b=xc}function me(t){return t instanceof ye&&t.constructor===ye&&t.b===xc?t.a:(b("expected object of type Const, got '"+t+"'"),"type_error:Const")}function ge(t){var e=new ye;return e.a=t,e}function ve(){this.a="",this.b=Fc}function be(t){return t instanceof ve&&t.constructor===ve&&t.b===Fc?t.a:(b("expected object of type TrustedResourceUrl, got '"+t+"' of type "+i(t)),"type_error:TrustedResourceUrl")}function _e(t,e){var n=me(t);if(!Mc.test(n))throw Error("Invalid TrustedResourceUrl format: "+n);return t=n.replace(Lc,function(t,r){if(!Object.prototype.hasOwnProperty.call(e,r))throw Error('Found marker, "'+r+'", in format string, "'+n+'", but no valid label mapping found in args: '+JSON.stringify(e));return t=e[r],t instanceof ye?me(t):encodeURIComponent(String(t))}),we(t)}function we(t){var e=new ve;return e.a=t,e}function Ee(){this.a="",this.b=Bc}function Te(t){return t instanceof Ee&&t.constructor===Ee&&t.b===Bc?t.a:(b("expected object of type SafeUrl, got '"+t+"' of type "+i(t)),"type_error:SafeUrl")}function Se(t){return t instanceof Ee?t:(t=t.ma?t.la():String(t),Uc.test(t)||(t="about:invalid#zClosurez"),Ce(t))}function Ce(t){var e=new Ee;return e.a=t,e}function Ie(){this.a="",this.b=Vc}function Ne(t){return t instanceof Ie&&t.constructor===Ie&&t.b===Vc?t.a:(b("expected object of type SafeHtml, got '"+t+"' of type "+i(t)),"type_error:SafeHtml")}function ke(t){var e=new Ie;return e.a=t,e}function Ae(e){var n=document;return t(e)?n.getElementById(e):e}function Re(t,e){F(e,function(e,n){e&&e.ma&&(e=e.la()),"style"==n?t.style.cssText=e:"class"==n?t.className=e:"for"==n?t.htmlFor=e:jc.hasOwnProperty(n)?t.setAttribute(jc[n],e):0==n.lastIndexOf("aria-",0)||0==n.lastIndexOf("data-",0)?t.setAttribute(n,e):t[n]=e})}function Oe(e,n,r){var i=arguments,o=document,s=String(i[0]),u=i[1];if(!Pc&&u&&(u.name||u.type)){if(s=["<",s],u.name&&s.push(' name="',P(u.name),'"'),u.type){s.push(' type="',P(u.type),'"');var c={};V(c,u),delete c.type,u=c}s.push(">"),s=s.join("")}return s=o.createElement(s),u&&(t(u)?s.className=u:a(u)?s.className=u.join(" "):Re(s,u)),2<i.length&&De(o,s,i),s}function De(e,n,r){function i(r){r&&n.appendChild(t(r)?e.createTextNode(r):r)}for(var o=2;o<r.length;o++){var a=r[o];!s(a)||c(a)&&0<a.nodeType?i(a):Du(Pe(a)?O(a):a,i)}}function Pe(t){if(t&&"number"==typeof t.length){if(c(t))return"function"==typeof t.item||"string"==typeof t.item;if(u(t))return"function"==typeof t.item}return!1}function xe(t){var e=[];return Me(new Le,t,e),e.join("")}function Le(){}function Me(t,e,n){if(null==e)n.push("null");else{if("object"==typeof e){if(a(e)){var r=e;e=r.length,n.push("[");for(var i="",o=0;o<e;o++)n.push(i),Me(t,r[o],n),i=",";return void n.push("]")}if(!(e instanceof String||e instanceof Number||e instanceof Boolean)){n.push("{"),i="";for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&"function"!=typeof(o=e[r])&&(n.push(i),Fe(r,n),n.push(":"),Me(t,o,n),i=",");return void n.push("}")}e=e.valueOf()}switch(typeof e){case"string":Fe(e,n);break;case"number":n.push(isFinite(e)&&!isNaN(e)?String(e):"null");break;case"boolean":n.push(String(e));break;case"function":n.push("null");break;default:throw Error("Unknown type: "+typeof e)}}}function Fe(t,e){e.push('"',t.replace(Wc,function(t){var e=qc[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),qc[t]=e),e}),'"')}function Ue(){var t=rn();return oc&&!!pc&&11==pc||/Edge\/\d+/.test(t)}function Be(){return Cu.window&&Cu.window.location.href||self&&self.location&&self.location.href||""}function Ve(t,e){e=e||Cu.window;var n="about:blank";t&&(n=Te(Se(t))),e.location.href=n}function je(t,e){var n,r=[];for(n in t)n in e?typeof t[n]!=typeof e[n]?r.push(n):"object"==typeof t[n]&&null!=t[n]&&null!=e[n]?0<je(t[n],e[n]).length&&r.push(n):t[n]!==e[n]&&r.push(n):r.push(n);for(n in e)n in t||r.push(n);return r}function qe(){var t=rn();return!((t=en(t)!=Gc?null:(t=t.match(/\sChrome\/(\d+)/i))&&2==t.length?parseInt(t[1],10):null)&&30>t)&&(!oc||!pc||9<pc)}function We(t){return t=(t||rn()).toLowerCase(),!!(t.match(/android/)||t.match(/webos/)||t.match(/iphone|ipad|ipod/)||t.match(/blackberry/)||t.match(/windows phone/)||t.match(/iemobile/))}function Ke(t){t=t||Cu.window;try{t.close()}catch(t){}}function He(t,e,n){var r=Math.floor(1e9*Math.random()).toString();e=e||500,n=n||600;var i=(window.screen.availHeight-n)/2,o=(window.screen.availWidth-e)/2;e={width:e,height:n,top:0<i?i:0,left:0<o?o:0,location:!0,resizable:!0,statusbar:!0,toolbar:!1},n=rn().toLowerCase(),r&&(e.target=r,x(n,"crios/")&&(e.target="_blank")),en(rn())==Hc&&(t=t||"http://localhost",e.scrollbars=!0),n=t||"",(t=e)||(t={}),r=window,e=n instanceof Ee?n:Se("undefined"!=typeof n.href?n.href:String(n)),n=t.target||n.target,i=[];for(a in t)switch(a){case"width":case"height":case"top":case"left":i.push(a+"="+t[a]);break;case"target":case"noopener":case"noreferrer":break;default:i.push(a+"="+(t[a]?1:0))}var a=i.join(",");if((M("iPhone")&&!M("iPod")&&!M("iPad")||M("iPad")||M("iPod"))&&r.navigator&&r.navigator.standalone&&n&&"_self"!=n?(a=r.document.createElement("A"),e instanceof Ee||e instanceof Ee||(e=e.ma?e.la():String(e),Uc.test(e)||(e="about:invalid#zClosurez"),e=Ce(e)),a.href=Te(e),a.setAttribute("target",n),t.noreferrer&&a.setAttribute("rel","noreferrer"),t=document.createEvent("MouseEvent"),t.initMouseEvent("click",!0,!0,r,1),a.dispatchEvent(t),a={}):t.noreferrer?(a=r.open("",n,a),t=Te(e),a&&(sc&&x(t,";")&&(t="'"+t.replace(/'/g,"%27")+"'"),a.opener=null,ge("b/12014412, meta tag with sanitized URL"),t='<meta name="referrer" content="no-referrer"><meta http-equiv="refresh" content="0; url='+P(t)+'">',t=ke(t),a.document.write(Ne(t)),a.document.close())):(a=r.open(Te(e),n,a))&&t.noopener&&(a.opener=null),a)try{a.focus()}catch(t){}return a}function Ge(t){return new G(function(e){function n(){qt(2e3).then(function(){if(t&&!t.closed)return n();e()})}return n()})}function Qe(){var t=null;return new G(function(e){"complete"==Cu.document.readyState?e():(t=function(){e()},kt(window,"load",t))}).s(function(e){throw At(window,"load",t),e})}function ze(){return Ye(void 0)?Qe().then(function(){return new G(function(t,e){var n=Cu.document,r=setTimeout(function(){e(Error("Cordova framework is not ready."))},1e3);n.addEventListener("deviceready",function(){clearTimeout(r),t()},!1)})}):X(Error("Cordova must run in an Android or iOS file scheme."))}function Ye(t){return t=t||rn(),!("file:"!==cn()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function Xe(){var t=Cu.window;try{return!(!t||t==t.top)}catch(t){return!1}}function Je(){return"object"!==typeof Cu.window&&"function"===typeof Cu.importScripts}function $e(){return Tu.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":Tu.INTERNAL.hasOwnProperty("node")?"Node":Je()?"Worker":"Browser"}function Ze(){var t=$e();return"ReactNative"===t||"Node"===t}function tn(){for(var t=50,e=[];0<t;)e.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),t--;return e.join("")}function en(t){var e=t.toLowerCase();return x(e,"opera/")||x(e,"opr/")||x(e,"opios/")?"Opera":x(e,"iemobile")?"IEMobile":x(e,"msie")||x(e,"trident/")?"IE":x(e,"edge/")?"Edge":x(e,"firefox/")?Hc:x(e,"silk/")?"Silk":x(e,"blackberry")?"Blackberry":x(e,"webos")?"Webos":!x(e,"safari/")||x(e,"chrome/")||x(e,"crios/")||x(e,"android")?!x(e,"chrome/")&&!x(e,"crios/")||x(e,"edge/")?x(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":Gc:"Safari"}function nn(t,e){e=e||[];var n,r=[],i={};for(n in Qc)i[Qc[n]]=!0;for(n=0;n<e.length;n++)"undefined"!==typeof i[e[n]]&&(delete i[e[n]],r.push(e[n]));return r.sort(),e=r,e.length||(e=["FirebaseCore-web"]),r=$e(),"Browser"===r?(i=rn(),r=en(i)):"Worker"===r&&(i=rn(),r=en(i)+"-"+r),r+"/JsCore/"+t+"/"+e.join(",")}function rn(){return Cu.navigator&&Cu.navigator.userAgent||""}function on(t,e){t=t.split("."),e=e||Cu;for(var n=0;n<t.length&&"object"==typeof e&&null!=e;n++)e=e[t[n]];return n!=t.length&&(e=void 0),e}function an(){try{var t=Cu.localStorage,e=dn();if(t)return t.setItem(e,"1"),t.removeItem(e),!Ue()||!!Cu.indexedDB}catch(t){return Je()&&!!Cu.indexedDB}return!1}function sn(){return(un()||"chrome-extension:"===cn()||Ye())&&!Ze()&&an()&&!Je()}function un(){return"http:"===cn()||"https:"===cn()}function cn(){return Cu.location&&Cu.location.protocol||null}function ln(t){return t=t||rn(),!We(t)&&en(t)!=Hc}function hn(t){return"undefined"===typeof t?null:xe(t)}function fn(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&null!==t[e]&&void 0!==t[e]&&(n[e]=t[e]);return n}function pn(t){if(null!==t)return JSON.parse(t)}function dn(t){return t||Math.floor(1e9*Math.random()).toString()}function yn(t){return t=t||rn(),"Safari"!=en(t)&&!t.toLowerCase().match(/iphone|ipad|ipod/)}function mn(){var t=Cu.___jsl;if(t&&t.H)for(var e in t.H)if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=t.H[e].L.concat(),t.CP)for(var n=0;n<t.CP.length;n++)t.CP[n]=null}function gn(t,e){if(t>e)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=rn(),e=$e(),this.b=We(t)||"ReactNative"===e}function vn(){var t=Cu.document;return!t||"undefined"===typeof t.visibilityState||"visible"==t.visibilityState}function bn(){var t=Cu.document,e=null;return vn()||!t?Y():new G(function(n){e=function(){vn()&&(t.removeEventListener("visibilitychange",e,!1),n())},t.addEventListener("visibilitychange",e,!1)}).s(function(n){throw t.removeEventListener("visibilitychange",e,!1),n})}function _n(t){try{var e=new Date(parseInt(t,10));if(!isNaN(e.getTime())&&!/[^0-9]/.test(t))return e.toUTCString()}catch(t){}return null}function wn(){return!(!on("fireauth.oauthhelper",Cu)&&!on("fireauth.iframe",Cu))}function En(t){Yc[t]||(Yc[t]=!0,"undefined"!==typeof console&&"function"===typeof console.warn&&console.warn(t))}function Tn(t,e,n){zc?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function Sn(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&Tn(t,n,e[n])}function Cn(t){var e={};return Sn(e,t),e}function In(t){var e,n={};for(e in t)t.hasOwnProperty(e)&&(n[e]=t[e]);return n}function Nn(t,e){if(!e||!e.length)return!0;if(!t)return!1;for(var n=0;n<e.length;n++){var r=t[e[n]];if(void 0===r||null===r||""===r)return!1}return!0}function kn(t){var e=t;if("object"==typeof t&&null!=t){e="length"in t?[]:{};for(var n in t)Tn(e,n,kn(t[n]))}return e}function An(t){var e={},n=t[$c],r=t[Zc];if(!(t=t[tl])||t!=Jc&&!n)throw Error("Invalid provider user info!");e[nl]=r||null,e[el]=n||null,Tn(this,il,t),Tn(this,rl,kn(e))}function Rn(t,e){this.code=ol+t,this.message=e||al[t]||""}function On(t){var e=t&&t.code;return e?new Rn(e.substring(ol.length),t.message):null}function Dn(t){var e=t[ll];if("undefined"===typeof e)throw new Rn("missing-continue-uri");if("string"!==typeof e||"string"===typeof e&&!e.length)throw new Rn("invalid-continue-uri");this.h=e,this.b=this.a=null,this.g=!1;var n=t[sl];if(n&&"object"===typeof n){e=n[pl];var r=n[hl];if(n=n[fl],"string"===typeof e&&e.length){if(this.a=e,"undefined"!==typeof r&&"boolean"!==typeof r)throw new Rn("argument-error",hl+" property must be a boolean when specified.");if(this.g=!!r,"undefined"!==typeof n&&("string"!==typeof n||"string"===typeof n&&!n.length))throw new Rn("argument-error",fl+" property must be a non empty string when specified.");this.b=n||null}else{if("undefined"!==typeof e)throw new Rn("argument-error",pl+" property must be a non empty string when specified.");if("undefined"!==typeof r||"undefined"!==typeof n)throw new Rn("missing-android-pkg-name")}}else if("undefined"!==typeof n)throw new Rn("argument-error",sl+" property must be a non null object when specified.");if(this.f=null,(e=t[cl])&&"object"===typeof e){if("string"===typeof(e=e[dl])&&e.length)this.f=e;else if("undefined"!==typeof e)throw new Rn("argument-error",dl+" property must be a non empty string when specified.")}else if("undefined"!==typeof e)throw new Rn("argument-error",cl+" property must be a non null object when specified.");if("undefined"!==typeof(t=t[ul])&&"boolean"!==typeof t)throw new Rn("argument-error",ul+" property must be a boolean when specified.");this.c=!!t}function Pn(t){var e={};e.continueUrl=t.h,e.canHandleCodeInApp=t.c,(e.androidPackageName=t.a)&&(e.androidMinimumVersion=t.b,e.androidInstallApp=t.g),e.iOSBundleId=t.f;for(var n in e)null===e[n]&&delete e[n];return e}function xn(t){return Pu(t,function(t){return t=t.toString(16),1<t.length?t:"0"+t}).join("")}function Ln(t){var e="";return Mn(t,function(t){e+=String.fromCharCode(t)}),e}function Mn(t,e){function n(e){for(;r<t.length;){var n=t.charAt(r++),i=ml[n];if(null!=i)return i;if(!/^[\s\xa0]*$/.test(n))throw Error("Unknown base64 encoding at char: "+n)}return e}Fn();for(var r=0;;){var i=n(-1),o=n(0),a=n(64),s=n(64);if(64===s&&-1===i)break;e(i<<2|o>>4),64!=a&&(e(o<<4&240|a>>2),64!=s&&e(a<<6&192|s))}}function Fn(){if(!yl){yl={},ml={};for(var t=0;65>t;t++)yl[t]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(t),ml[yl[t]]=t,62<=t&&(ml["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(t)]=t)}}function Un(t){this.c=t.sub,ku(),this.a=t.provider_id||t.firebase&&t.firebase.sign_in_provider||null,this.b=!!t.is_anonymous||"anonymous"==this.a}function Bn(t){return(t=Vn(t))&&t.sub&&t.iss&&t.aud&&t.exp?new Un(t):null}function Vn(t){if(!t)return null;if(t=t.split("."),3!=t.length)return null;t=t[1];for(var e=(4-t.length%4)%4,n=0;n<e;n++)t+=".";try{return JSON.parse(Ln(t))}catch(t){}return null}function jn(t){for(var e in bl)if(bl[e].Na==t)return bl[e];return null}function qn(t){var e={};e["facebook.com"]=Hn,e["google.com"]=Qn,e["github.com"]=Gn,e["twitter.com"]=zn;var n=t&&t[wl];try{if(n)return e[n]?new e[n](t):new Kn(t);if("undefined"!==typeof t[_l])return new Wn(t)}catch(t){}return null}function Wn(t){var e=t[wl];if(!e&&t[_l]){var n=Bn(t[_l]);n&&n.a&&(e=n.a)}if(!e)throw Error("Invalid additional user info!");"anonymous"!=e&&"custom"!=e||(e=null),n=!1,"undefined"!==typeof t.isNewUser?n=!!t.isNewUser:"identitytoolkit#SignupNewUserResponse"===t.kind&&(n=!0),Tn(this,"providerId",e),Tn(this,"isNewUser",n)}function Kn(t){Wn.call(this,t),t=pn(t.rawUserInfo||"{}"),Tn(this,"profile",kn(t||{}))}function Hn(t){if(Kn.call(this,t),"facebook.com"!=this.providerId)throw Error("Invalid provider ID!")}function Gn(t){if(Kn.call(this,t),"github.com"!=this.providerId)throw Error("Invalid provider ID!");Tn(this,"username",this.profile&&this.profile.login||null)}function Qn(t){if(Kn.call(this,t),"google.com"!=this.providerId)throw Error("Invalid provider ID!")}function zn(t){if(Kn.call(this,t),"twitter.com"!=this.providerId)throw Error("Invalid provider ID!");Tn(this,"username",t.screenName||null)}function Yn(t){this.a=ne(t)}function Xn(t){var e=ne(t),n=ee(e,"link"),r=ee(ne(n),"link");return e=ee(e,"deep_link_id"),ee(ne(e),"link")||e||r||n||t}function Jn(t,e){return t.then(function(t){if(t[Vl]){var n=Bn(t[Vl]);if(!n||e!=n.c)throw new Rn("user-mismatch");return t}throw new Rn("user-mismatch")}).s(function(t){throw t&&t.code&&t.code==ol+"user-not-found"?new Rn("user-mismatch"):t})}function $n(t,e,n){if(e.idToken||e.accessToken)e.idToken&&Tn(this,"idToken",e.idToken),e.accessToken&&Tn(this,"accessToken",e.accessToken);else{if(!e.oauthToken||!e.oauthTokenSecret)throw new Rn("internal-error","failed to construct a credential");Tn(this,"accessToken",e.oauthToken),Tn(this,"secret",e.oauthTokenSecret)}Tn(this,"providerId",t),Tn(this,"signInMethod",n)}function Zn(t){var e={};return t.idToken&&(e.id_token=t.idToken),t.accessToken&&(e.access_token=t.accessToken),t.secret&&(e.oauth_token_secret=t.secret),e.providerId=t.providerId,{postBody:ce(e).toString(),requestUri:"http://localhost"}}function tr(t,e){this.Ac=e||[],Sn(this,{providerId:t,isOAuthProvider:!0}),this.vb={},this.$a=(jn(t)||{}).Ma||null,this.Ya=null}function er(t){tr.call(this,t,vl),this.a=[]}function nr(){er.call(this,"facebook.com")}function rr(t){if(!t)throw new Rn("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return c(t)&&(e=t.accessToken),(new nr).credential(null,e)}function ir(){er.call(this,"github.com")}function or(t){if(!t)throw new Rn("argument-error","credential failed: expected 1 argument (the OAuth access token).");var e=t;return c(t)&&(e=t.accessToken),(new ir).credential(null,e)}function ar(){er.call(this,"google.com"),this.ta("profile")}function sr(t,e){var n=t;return c(t)&&(n=t.idToken,e=t.accessToken),(new ar).credential(n,e)}function ur(){tr.call(this,"twitter.com",gl)}function cr(t,e){var n=t;if(c(n)||(n={oauthToken:t,oauthTokenSecret:e}),!n.oauthToken||!n.oauthTokenSecret)throw new Rn("argument-error","credential failed: expected 2 arguments (the OAuth access token and secret).");return new $n("twitter.com",n,"twitter.com")}function lr(t,e,n){this.a=t,this.b=e,Tn(this,"providerId","password"),Tn(this,"signInMethod",n===hr.EMAIL_LINK_SIGN_IN_METHOD?hr.EMAIL_LINK_SIGN_IN_METHOD:hr.EMAIL_PASSWORD_SIGN_IN_METHOD)}function hr(){Sn(this,{providerId:"password",isOAuthProvider:!1})}function fr(t,e){if(!(e=pr(e)))throw new Rn("argument-error","Invalid email link!");return new lr(t,e,hr.EMAIL_LINK_SIGN_IN_METHOD)}function pr(t){t=Xn(t),t=new Yn(t);var e=ee(t.a,"oobCode")||null;return"signIn"===(ee(t.a,"mode")||null)&&e?e:null}function dr(t){if(!(t.Sa&&t.Ra||t.Fa&&t.$))throw new Rn("internal-error");this.a=t,Tn(this,"providerId","phone"),Tn(this,"signInMethod","phone")}function yr(t){return t.a.Fa&&t.a.$?{temporaryProof:t.a.Fa,phoneNumber:t.a.$}:{sessionInfo:t.a.Sa,code:t.a.Ra}}function mr(t){try{this.a=t||Tu.auth()}catch(t){throw new Rn("argument-error","Either an instance of firebase.auth.Auth must be passed as an argument to the firebase.auth.PhoneAuthProvider constructor, or the default firebase App instance must be initialized via firebase.initializeApp().")}Sn(this,{providerId:"phone",isOAuthProvider:!1})}function gr(t,e){if(!t)throw new Rn("missing-verification-id");if(!e)throw new Rn("missing-verification-code");return new dr({Sa:t,Ra:e})}function vr(t){if(t.temporaryProof&&t.phoneNumber)return new dr({Fa:t.temporaryProof,$:t.phoneNumber});var e=t&&t.providerId;if(!e||"password"===e)return null;var n=t&&t.oauthAccessToken,r=t&&t.oauthTokenSecret;t=t&&t.oauthIdToken;try{switch(e){case"google.com":return sr(t,n);case"facebook.com":return rr(n);case"github.com":return or(n);case"twitter.com":return cr(n,r);default:return new er(e).credential(t,n)}}catch(t){return null}}function br(t){if(!t.isOAuthProvider)throw new Rn("invalid-oauth-provider")}function _r(t,e,n,r,i){if(this.b=t,this.c=e||null,this.f=n||null,this.g=r||null,this.a=i||null,!this.f&&!this.a)throw new Rn("invalid-auth-event");if(this.f&&this.a)throw new Rn("invalid-auth-event");if(this.f&&!this.g)throw new Rn("invalid-auth-event")}function wr(t){return t=t||{},t.type?new _r(t.type,t.eventId,t.urlResponse,t.sessionId,t.error&&On(t.error)):null}function Er(){this.b=null,this.a=[]}function Tr(t){var e="unauthorized-domain",n=void 0,r=ne(t);t=r.b,r=r.c,"chrome-extension"==r?n=D("This chrome extension ID (chrome-extension://%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):"http"==r||"https"==r?n=D("This domain (%s) is not authorized to run this operation. Add it to the OAuth redirect domains list in the Firebase console -> Auth section -> Sign in method tab.",t):e="operation-not-supported-in-this-environment",Rn.call(this,e,n)}function Sr(t,e,n){Rn.call(this,t,n),t=e||{},t.wb&&Tn(this,"email",t.wb),t.$&&Tn(this,"phoneNumber",t.$),t.credential&&Tn(this,"credential",t.credential)}function Cr(t){if(t.code){var e=t.code||"";0==e.indexOf(ol)&&(e=e.substring(ol.length));var n={credential:vr(t)};if(t.email)n.wb=t.email;else{if(!t.phoneNumber)return new Rn(e,t.message||void 0);n.$=t.phoneNumber}return new Sr(e,n,t.message)}return null}function Ir(){}function Nr(t){return t.c||(t.c=t.b())}function kr(){}function Ar(t){if(!t.f&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n<e.length;n++){var r=e[n];try{return new ActiveXObject(r),t.f=r}catch(t){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return t.f}function Rr(){}function Or(){this.a=new XDomainRequest,this.readyState=0,this.onreadystatechange=null,this.responseText="",this.status=-1,this.statusText="",this.a.onload=f(this.bc,this),this.a.onerror=f(this.Bb,this),this.a.onprogress=f(this.cc,this),this.a.ontimeout=f(this.fc,this)}function Dr(t,e){t.readyState=e,t.onreadystatechange&&t.onreadystatechange()}function Pr(t,e,n){this.reset(t,e,n,void 0,void 0)}function xr(t){this.f=t,this.b=this.c=this.a=null}function Lr(t,e){this.name=t,this.value=e}function Mr(t){return t.c?t.c:t.a?Mr(t.a):(b("Root logger has no level set."),null)}function Fr(t){Ol||(Ol=new xr(""),Rl[""]=Ol,Ol.c=kl);var e;if(!(e=Rl[t])){e=new xr(t);var n=t.lastIndexOf("."),r=t.substr(n+1);n=Fr(t.substr(0,n)),n.b||(n.b={}),n.b[r]=e,e.a=n,Rl[t]=e}return e}function Ur(t,e){t&&t.log(Al,e,void 0)}function Br(t){this.f=t}function Vr(t){Ft.call(this),this.i=t,this.readyState=Dl,this.status=0,this.responseText=this.statusText="",this.onreadystatechange=null,this.g=new Headers,this.b=null,this.h="GET",this.c="",this.a=!1,this.f=Fr("goog.net.FetchXmlHttp")}function jr(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function qr(t){Ft.call(this),this.headers=new Gt,this.C=t||null,this.c=!1,this.w=this.a=null,this.h=this.N=this.l="",this.f=this.I=this.i=this.G=!1,this.g=0,this.u=null,this.o=Pl,this.v=this.O=!1}function Wr(t,e,n,r,i){if(t.a)throw Error("[goog.net.XhrIo] Object is active with another request="+t.l+"; newUri="+e);n=n?n.toUpperCase():"GET",t.l=e,t.h="",t.N=n,t.G=!1,t.c=!0,t.a=t.C?t.C.a():Sl.a(),t.w=Nr(t.C?t.C:Sl),t.a.onreadystatechange=f(t.Fb,t);try{Ur(t.b,ti(t,"Opening Xhr")),t.I=!0,t.a.open(n,String(e),!0),t.I=!1}catch(e){return Ur(t.b,ti(t,"Error opening Xhr: "+e.message)),void Gr(t,e)}e=r||"";var o=new Gt(t.headers);i&&Ht(i,function(t,e){o.set(e,t)}),i=I(o.U()),r=Cu.FormData&&e instanceof Cu.FormData,!N(Ll,n)||i||r||o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach(function(t,e){this.a.setRequestHeader(e,t)},t),t.o&&(t.a.responseType=t.o),"withCredentials"in t.a&&t.a.withCredentials!==t.O&&(t.a.withCredentials=t.O);try{Xr(t),0<t.g&&(t.v=Kr(t.a),Ur(t.b,ti(t,"Will abort after "+t.g+"ms if incomplete, xhr2 "+t.v)),t.v?(t.a.timeout=t.g,t.a.ontimeout=f(t.Ga,t)):t.u=jt(t.Ga,t.g,t)),Ur(t.b,ti(t,"Sending request")),t.i=!0,t.a.send(e),t.i=!1}catch(e){Ur(t.b,ti(t,"Send error: "+e.message)),Gr(t,e)}}function Kr(t){return oc&>(9)&&"number"==typeof t.timeout&&void 0!==t.ontimeout}function Hr(t){return"content-type"==t.toLowerCase()}function Gr(t,e){t.c=!1,t.a&&(t.f=!0,t.a.abort(),t.f=!1),t.h=e,Qr(t),Yr(t)}function Qr(t){t.G||(t.G=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function zr(t){if(t.c&&"undefined"!=typeof Su)if(t.w[1]&&4==Jr(t)&&2==$r(t))Ur(t.b,ti(t,"Local request error detected and ignored"));else if(t.i&&4==Jr(t))jt(t.Fb,0,t);else if(t.dispatchEvent("readystatechange"),4==Jr(t)){Ur(t.b,ti(t,"Request complete")),t.c=!1;try{var e=$r(t);t:switch(e){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var n=!0;break t;default:n=!1}var r;if(!(r=n)){var i;if(i=0===e){var o=String(t.l).match(Nc)[1]||null;if(!o&&Cu.self&&Cu.self.location){var a=Cu.self.location.protocol;o=a.substr(0,a.length-1)}i=!xl.test(o?o.toLowerCase():"")}r=i}if(r)t.dispatchEvent("complete"),t.dispatchEvent("success");else{try{var s=2<Jr(t)?t.a.statusText:""}catch(e){Ur(t.b,"Can not get status: "+e.message),s=""}t.h=s+" ["+$r(t)+"]",Qr(t)}}finally{Yr(t)}}}function Yr(t,e){if(t.a){Xr(t);var n=t.a,i=t.w[0]?r:null;t.a=null,t.w=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=i}catch(e){(t=t.b)&&t.log(Il,"Problem encountered resetting onreadystatechange: "+e.message,void 0)}}}function Xr(t){t.a&&t.v&&(t.a.ontimeout=null),t.u&&(Cu.clearTimeout(t.u),t.u=null)}function Jr(t){return t.a?t.a.readyState:0}function $r(t){try{return 2<Jr(t)?t.a.status:-1}catch(t){return-1}}function Zr(t){try{return t.a?t.a.responseText:""}catch(e){return Ur(t.b,"Can not get responseText: "+e.message),""}}function ti(t,e){return e+" ["+t.N+" "+t.l+" "+$r(t)+"]"}function ei(t,e){this.g=[],this.v=t,this.u=e||null,this.f=this.a=!1,this.c=void 0,this.l=this.w=this.i=!1,this.h=0,this.b=null,this.m=0}function ni(t,e,n){t.a=!0,t.c=n,t.f=!e,si(t)}function ri(t){if(t.a){if(!t.l)throw new ui(t);t.l=!1}}function ii(t,e){oi(t,null,e,void 0)}function oi(t,e,n,r){t.g.push([e,n,r]),t.a&&si(t)}function ai(t){return xu(t.g,function(t){return u(t[1])})}function si(t){if(t.h&&t.a&&ai(t)){var e=t.h,n=Ml[e];n&&(Cu.clearTimeout(n.a),delete Ml[e]),t.h=0}t.b&&(t.b.m--,delete t.b),e=t.c;for(var r=n=!1;t.g.length&&!t.i;){var i=t.g.shift(),o=i[0],a=i[1];if(i=i[2],o=t.f?a:o)try{var s=o.call(i||t.u,e);void 0!==s&&(t.f=t.f&&(s==e||s instanceof Error),t.c=e=s),(m(e)||"function"===typeof Cu.Promise&&e instanceof Cu.Promise)&&(r=!0,t.i=!0)}catch(r){e=r,t.f=!0,ai(t)||(n=!0)}}t.c=e,r&&(s=f(t.o,t,!0),r=f(t.o,t,!1),e instanceof ei?(oi(e,s,r),e.w=!0):e.then(s,r)),n&&(e=new li(e),Ml[e.a]=e,t.h=e.a)}function ui(){g.call(this)}function ci(){g.call(this)}function li(t){this.a=Cu.setTimeout(f(this.c,this),0),this.b=t}function hi(t){var e={},n=e.document||document,r=be(t),i=document.createElement("SCRIPT"),o={Hb:i,Ga:void 0},a=new ei(pi,o),s=null,u=null!=e.timeout?e.timeout:5e3;return 0<u&&(s=window.setTimeout(function(){di(i,!0);var t=new yi(Ul,"Timeout reached for loading script "+r);ri(a),ni(a,!1,t)},u),o.Ga=s),i.onload=i.onreadystatechange=function(){i.readyState&&"loaded"!=i.readyState&&"complete"!=i.readyState||(di(i,e.dd||!1,s),a.C())},i.onerror=function(){di(i,!0,s);var t=new yi(Fl,"Error while loading script "+r);ri(a),ni(a,!1,t)},o=e.attributes||{},V(o,{type:"text/javascript",charset:"UTF-8"}),Re(i,o),i.src=be(t),fi(n).appendChild(i),a}function fi(t){var e;return(e=(t||document).getElementsByTagName("HEAD"))&&0!=e.length?e[0]:t.documentElement}function pi(){if(this&&this.Hb){var t=this.Hb;t&&"SCRIPT"==t.tagName&&di(t,!0,this.Ga)}}function di(t,e,n){null!=n&&Cu.clearTimeout(n),t.onload=r,t.onerror=r,t.onreadystatechange=r,e&&window.setTimeout(function(){t&&t.parentNode&&t.parentNode.removeChild(t)},0)}function yi(t,e){var n="Jsloader error (code #"+t+")";e&&(n+=": "+e),g.call(this,n),this.code=t}function mi(t){this.f=t}function gi(t,e,n){if(this.b=t,t=e||{},this.i=t.secureTokenEndpoint||"https://securetoken.googleapis.com/v1/token",this.m=t.secureTokenTimeout||jl,this.f=B(t.secureTokenHeaders||ql),this.g=t.firebaseEndpoint||"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",this.h=t.firebaseTimeout||Wl,this.a=B(t.firebaseHeaders||Kl),n&&(this.a["X-Client-Version"]=n,this.f["X-Client-Version"]=n),n="Node"==$e(),!(n=Cu.XMLHttpRequest||n&&Tu.INTERNAL.node&&Tu.INTERNAL.node.XMLHttpRequest)&&!Je())throw new Rn("internal-error","The XMLHttpRequest compatibility library was not found.");this.c=void 0,Je()?this.c=new Br(self):Ze()?this.c=new mi(n):this.c=new Rr}function vi(t,e){e?t.a["X-Firebase-Locale"]=e:delete t.a["X-Firebase-Locale"]}function bi(t,e){e?(t.a["X-Client-Version"]=e,t.f["X-Client-Version"]=e):(delete t.a["X-Client-Version"],delete t.f["X-Client-Version"])}function _i(t,e,n,r,i,o,a){qe()||Je()?t=f(t.o,t):(Bl||(Bl=new G(function(t,e){wi(t,e)})),t=f(t.l,t)),t(e,n,r,i,o,a)}function wi(t,e){if(((window.gapi||{}).client||{}).request)t();else{Cu[Gl]=function(){((window.gapi||{}).client||{}).request?t():e(Error("CORS_UNSUPPORTED"))};ii(hi(_e(Hl,{onload:Gl})),function(){e(Error("CORS_UNSUPPORTED"))})}}function Ei(t,e){return new G(function(n,r){"refresh_token"==e.grant_type&&e.refresh_token||"authorization_code"==e.grant_type&&e.code?_i(t,t.i+"?key="+encodeURIComponent(t.b),function(t){t?t.error?r(ji(t)):t.access_token&&t.refresh_token?n(t):r(new Rn("internal-error")):r(new Rn("network-request-failed"))},"POST",ce(e).toString(),t.f,t.m.get()):r(new Rn("internal-error"))})}function Ti(t,e,n,r,i,o){var a=ne(t.g+e);te(a,"key",t.b),o&&te(a,"cb",ku().toString());var s="GET"==n;if(s)for(var u in r)r.hasOwnProperty(u)&&te(a,u,r[u]);return new G(function(e,o){_i(t,a.toString(),function(t){t?t.error?o(ji(t,i||{})):e(t):o(new Rn("network-request-failed"))},n,s?void 0:xe(fn(r)),t.a,t.h.get())})}function Si(t){if(!Tl.test(t.email))throw new Rn("invalid-email")}function Ci(t){"email"in t&&Si(t)}function Ii(t,e){return Bi(t,$l,{identifier:e,continueUri:un()?Be():"http://localhost"}).then(function(t){return t.allProviders||[]})}function Ni(t,e){return Bi(t,$l,{identifier:e,continueUri:un()?Be():"http://localhost"}).then(function(t){return t.signinMethods||[]})}function ki(t){return Bi(t,sh,{}).then(function(t){return t.authorizedDomains||[]})}function Ai(t){if(!t[Vl])throw new Rn("internal-error")}function Ri(t){if(t.phoneNumber||t.temporaryProof){if(!t.phoneNumber||!t.temporaryProof)throw new Rn("internal-error")}else{if(!t.sessionInfo)throw new Rn("missing-verification-id");if(!t.code)throw new Rn("missing-verification-code")}}function Oi(t,e){return Bi(t,lh,e)}function Di(t,e,n){return Bi(t,th,{idToken:e,deleteProvider:n})}function Pi(t){if(!t.requestUri||!t.sessionId&&!t.postBody)throw new Rn("internal-error")}function xi(t){var e=null;if(t.needConfirmation?(t.code="account-exists-with-different-credential",e=Cr(t)):"FEDERATED_USER_ID_ALREADY_LINKED"==t.errorMessage?(t.code="credential-already-in-use",e=Cr(t)):"EMAIL_EXISTS"==t.errorMessage?(t.code="email-already-in-use",e=Cr(t)):t.errorMessage&&(e=Vi(t.errorMessage)),e)throw e;if(!t[Vl])throw new Rn("internal-error")}function Li(t,e){return e.returnIdpCredential=!0,Bi(t,dh,e)}function Mi(t,e){return e.returnIdpCredential=!0,Bi(t,mh,e)}function Fi(t,e){return e.returnIdpCredential=!0,e.autoCreate=!1,Bi(t,yh,e)}function Ui(t){if(!t.oobCode)throw new Rn("invalid-action-code")}function Bi(t,e,n){if(!Nn(n,e.T))return X(new Rn("internal-error"));var r,i=e.Eb||"POST";return Y(n).then(e.B).then(function(){return e.R&&(n.returnSecureToken=!0),Ti(t,e.endpoint,i,n,e.Tb,e.rb||!1)}).then(function(t){return r=t}).then(e.J).then(function(){if(!e.da)return r;if(!(e.da in r))throw new Rn("internal-error");return r[e.da]})}function Vi(t){return ji({error:{errors:[{message:t}],code:400,message:t}})}function ji(t,e){var n=(t.error&&t.error.errors&&t.error.errors[0]||{}).reason||"",r={keyInvalid:"invalid-api-key",ipRefererBlocked:"app-not-authorized"};if(n=r[n]?new Rn(r[n]):null)return n;n=t.error&&t.error.message||"",r={INVALID_CUSTOM_TOKEN:"invalid-custom-token",CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_EMAIL:"invalid-email",INVALID_PASSWORD:"wrong-password",USER_DISABLED:"user-disabled",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",INVALID_MESSAGE_PAYLOAD:"invalid-message-payload",INVALID_RECIPIENT_EMAIL:"invalid-recipient-email",INVALID_SENDER:"invalid-sender",EMAIL_NOT_FOUND:"user-not-found",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",CORS_UNSUPPORTED:"cors-unsupported",DYNAMIC_LINK_NOT_ACTIVATED:"dynamic-link-not-activated",INVALID_APP_ID:"invalid-app-id",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",WEAK_PASSWORD:"weak-password",OPERATION_NOT_ALLOWED:"operation-not-allowed",USER_CANCELLED:"user-cancelled",CAPTCHA_CHECK_FAILED:"captcha-check-failed",INVALID_APP_CREDENTIAL:"invalid-app-credential",INVALID_CODE:"invalid-verification-code",INVALID_PHONE_NUMBER:"invalid-phone-number",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_APP_CREDENTIAL:"missing-app-credential",MISSING_CODE:"missing-verification-code",MISSING_PHONE_NUMBER:"missing-phone-number",MISSING_SESSION_INFO:"missing-verification-id",QUOTA_EXCEEDED:"quota-exceeded",SESSION_EXPIRED:"code-expired",INVALID_CONTINUE_URI:"invalid-continue-uri",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",MISSING_IOS_BUNDLE_ID:"missing-ios-bundle-id",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",INVALID_CERT_HASH:"invalid-cert-hash"},V(r,e||{}),e=(e=n.match(/^[^\s]+\s*:\s*(.*)$/))&&1<e.length?e[1]:void 0;for(var i in r)if(0===n.indexOf(i))return new Rn(r[i],e);return!e&&t&&(e=hn(t)),new Rn("internal-error",e)}function qi(t){for(var e in Eh)if(Eh[e].id===t)return t=Eh[e],{firebaseEndpoint:t.Za,secureTokenEndpoint:t.fb};return null}function Wi(t){this.b=t,this.a=null,this.bb=Ki(this)}function Ki(t){return Qi().then(function(){return new G(function(e,n){on("gapi.iframes.getContext")().open({where:document.body,url:t.b,messageHandlersFilter:on("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"),attributes:{style:{position:"absolute",top:"-100px",width:"1px",height:"1px"}},dontclear:!0},function(r){function i(){clearTimeout(o),e()}t.a=r,t.a.restyle({setHideOnLeave:!1});var o=setTimeout(function(){n(Error("Network Error"))},Ch.get());r.ping(i).then(i,function(){n(Error("Network Error"))})})})})}function Hi(t,e){return t.bb.then(function(){return new G(function(n){t.a.send(e.type,e,n,on("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})})}function Gi(t,e){t.bb.then(function(){t.a.register("authEvent",e,on("gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER"))})}function Qi(){return Ih||(Ih=new G(function(t,e){function n(){mn(),on("gapi.load")("gapi.iframes",{callback:t,ontimeout:function(){mn(),e(Error("Network Error"))},timeout:Sh.get()})}if(on("gapi.iframes.Iframe"))t();else if(on("gapi.load"))n();else{var r="__iframefcb"+Math.floor(1e6*Math.random()).toString();Cu[r]=function(){on("gapi.load")?n():e(Error("Network Error"))},r=_e(Th,{onload:r}),Y(hi(r)).s(function(){e(Error("Network Error"))})}}).s(function(t){throw Ih=null,t}))}function zi(t,e,n){this.i=t,this.g=e,this.h=n,this.f=null,this.a=re(this.i,"/__/auth/iframe"),te(this.a,"apiKey",this.g),te(this.a,"appName",this.h),this.b=null,this.c=[]}function Yi(t,e,n,r,i){this.o=t,this.l=e,this.c=n,this.m=r,this.h=this.g=this.i=null,this.a=i,this.f=null}function Xi(t){try{return Tu.app(t).auth().xa()}catch(t){return[]}}function Ji(t,e,n,r,i){this.l=t,this.f=e,this.b=n,this.c=r||null,this.h=i||null,this.o=this.u=this.v=null,this.g=[],this.m=this.a=null}function $i(t){var e=Be();return ki(t).then(function(t){t:{var n=ne(e),r=n.c;n=n.b;for(var i=0;i<t.length;i++){var o=t[i],a=n,s=r;if(0==o.indexOf("chrome-extension://")?a=ne(o).b==a&&"chrome-extension"==s:"http"!=s&&"https"!=s?a=!1:Kc.test(o)?a=a==o:(o=o.split(".").join("\\."),a=new RegExp("^(.+\\."+o+"|"+o+")$","i").test(a)),a){t=!0;break t}}t=!1}if(!t)throw new Tr(Be())})}function Zi(t){return t.m?t.m:(t.m=Qe().then(function(){if(!t.u){var e=t.c,n=t.h,r=Xi(t.b),i=new zi(t.l,t.f,t.b);i.f=e,i.b=n,i.c=O(r||[]),t.u=i.toString()}t.i=new Wi(t.u),no(t)}),t.m)}function to(t){return t.o||(t.v=t.c?nn(t.c,Xi(t.b)):null,t.o=new gi(t.f,qi(t.h),t.v)),t.o}function eo(t,e,n,r,i,o,a,s,u,c){return t=new Yi(t,e,n,r,i),t.i=o,t.g=a,t.h=s,t.b=B(u||null),t.f=c,t.toString()}function no(t){if(!t.i)throw Error("IfcHandler must be initialized!");Gi(t.i,function(e){var n={};if(e&&e.authEvent){var r=!1;for(e=wr(e.authEvent),n=0;n<t.g.length;n++)r=t.g[n](e)||r;return n={},n.status=r?"ACK":"ERROR",Y(n)}return n.status="ERROR",Y(n)})}function ro(t){var e={type:"webStorageSupport"};return Zi(t).then(function(){return Hi(t.i,e)}).then(function(t){if(t&&t.length&&"undefined"!==typeof t[0].webStorageSupport)return t[0].webStorageSupport;throw Error()})}function io(t){if(this.a=t||Tu.INTERNAL.reactNative&&Tu.INTERNAL.reactNative.AsyncStorage,!this.a)throw new Rn("internal-error","The React Native compatibility library was not found.");this.type="asyncStorage"}function oo(){if(!co())throw new Rn("web-storage-unsupported");this.f={},this.a=[],this.b=0,this.g=Cu.indexedDB,this.type="indexedDB"}function ao(t){return new G(function(e,n){var r=t.g.deleteDatabase("firebaseLocalStorageDb");r.onsuccess=function(){e()},r.onerror=function(t){n(Error(t.target.error))}})}function so(t){return new G(function(e,n){var r=t.g.open("firebaseLocalStorageDb",1);r.onerror=function(t){try{t.preventDefault()}catch(t){}n(Error(t.target.error))},r.onupgradeneeded=function(t){t=t.target.result;try{t.createObjectStore("firebaseLocalStorage",{keyPath:"fbase_key"})}catch(t){n(t)}},r.onsuccess=function(r){r=r.target.result,r.objectStoreNames.contains("firebaseLocalStorage")?e(r):ao(t).then(function(){return so(t)}).then(function(t){e(t)}).s(function(t){n(t)})}})}function uo(t){return t.h||(t.h=so(t)),t.h}function co(){try{return!!Cu.indexedDB}catch(t){return!1}}function lo(t){return t.objectStore("firebaseLocalStorage")}function ho(t,e){return t.transaction(["firebaseLocalStorage"],e?"readwrite":"readonly")}function fo(t){return new G(function(e,n){t.onsuccess=function(t){t&&t.target?e(t.target.result):e()},t.onerror=function(t){n(Error(t.target.errorCode))}})}function po(t){function e(){return t.c=qt(800).then(f(t.Kc,t)).then(function(e){0<e.length&&Du(t.a,function(t){t(e)})}).then(e).s(function(t){"STOP_EVENT"!=t.message&&e()}),t.c}t.c&&t.c.cancel("STOP_EVENT"),e()}function yo(t){var e=this,n=null;this.a=[],this.type="indexedDB",this.c=t,this.b=Y().then(function(){return co()?(Nh||(Nh=new oo),n=Nh,n.set("__sak","!").then(function(){return n.get("__sak")}).then(function(t){if("!"!==t)throw Error("indexedDB not supported!");return n.P("__sak")}).then(function(){return n}).s(function(){return e.c})):e.c}).then(function(t){return e.type=t.type,t.Y(function(t){Du(e.a,function(e){e(t)})}),t})}function mo(){this.a={},this.type="inMemory"}function go(){if(!bo()){if("Node"==$e())throw new Rn("internal-error","The LocalStorage compatibility library was not found.");throw new Rn("web-storage-unsupported")}this.a=vo()||Tu.INTERNAL.node.localStorage,this.type="localStorage"}function vo(){try{var t=Cu.localStorage,e=dn();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function bo(){var t="Node"==$e();if(!(t=vo()||t&&Tu.INTERNAL.node&&Tu.INTERNAL.node.localStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}function _o(){this.type="nullStorage"}function wo(){if(!To()){if("Node"==$e())throw new Rn("internal-error","The SessionStorage compatibility library was not found.");throw new Rn("web-storage-unsupported")}this.a=Eo()||Tu.INTERNAL.node.sessionStorage,this.type="sessionStorage"}function Eo(){try{var t=Cu.sessionStorage,e=dn();return t&&(t.setItem(e,"1"),t.removeItem(e)),t}catch(t){return null}}function To(){var t="Node"==$e();if(!(t=Eo()||t&&Tu.INTERNAL.node&&Tu.INTERNAL.node.sessionStorage))return!1;try{return t.setItem("__sak","1"),t.removeItem("__sak"),!0}catch(t){return!1}}function So(){var t={};t.Browser=Rh,t.Node=Oh,t.ReactNative=Dh,t.Worker=Ph,this.a=t[$e()]}function Co(t){var e=new Rn("invalid-persistence-type"),n=new Rn("unsupported-persistence-type");t:{for(r in xh)if(xh[r]==t){var r=!0;break t}r=!1}if(!r||"string"!==typeof t)throw e;switch($e()){case"ReactNative":if("session"===t)throw n;break;case"Node":if("none"!==t)throw n;break;default:if(!an()&&"none"!==t)throw n}}function Io(){var t=!(yn(rn())||!Xe()),e=ln(),n=an();this.o=t,this.h=e,this.m=n,this.a={},kh||(kh=new So),t=kh;try{this.g=!Ue()&&wn()||!Cu.indexedDB?new t.a.A:new yo(Je()?new mo:new t.a.A)}catch(t){this.g=new mo,this.h=!0}try{this.i=new t.a.Qa}catch(t){this.i=new mo}this.l=new mo,this.f=f(this.Lb,this),this.b={}}function No(){return Ah||(Ah=new Io),Ah}function ko(t,e){switch(e){case"session":return t.i;case"none":return t.l;default:return t.g}}function Ao(t,e){return"firebase:"+t.name+(e?":"+e:"")}function Ro(t,e,n){var r=Ao(e,n),i=ko(t,e.A);return t.get(e,n).then(function(o){var a=null;try{a=pn(Cu.localStorage.getItem(r))}catch(t){}if(a&&!o)return Cu.localStorage.removeItem(r),t.set(e,a,n);a&&o&&"localStorage"!=i.type&&Cu.localStorage.removeItem(r)})}function Oo(t,e,n){return n=Ao(e,n),"local"==e.A&&(t.b[n]=null),ko(t,e.A).P(n)}function Do(t){Po(t),t.c=setInterval(function(){for(var e in t.a){var n=Cu.localStorage.getItem(e),r=t.b[e];n!=r&&(t.b[e]=n,n=new bt({type:"storage",key:e,target:window,oldValue:r,newValue:n,a:!0}),t.Lb(n))}},1e3)}function Po(t){t.c&&(clearInterval(t.c),t.c=null)}function xo(t){this.a=t,this.b=No()}function Lo(t){return t.b.get(Mh,t.a).then(function(t){return wr(t)})}function Mo(){this.a=No()}function Fo(){this.b=-1}function Uo(t,e){this.b=-1,this.b=Fh,this.f=Cu.Uint8Array?new Uint8Array(this.b):Array(this.b),this.g=this.c=0,this.a=[],this.i=t,this.h=e,this.m=Cu.Int32Array?new Int32Array(64):Array(64),void 0!==Lh||(Lh=Cu.Int32Array?new Int32Array(qh):qh),this.reset()}function Bo(t){for(var e=t.f,n=t.m,r=0,i=0;i<e.length;)n[r++]=e[i]<<24|e[i+1]<<16|e[i+2]<<8|e[i+3],i=4*r;for(e=16;64>e;e++){i=0|n[e-15],r=0|n[e-2];var o=(0|n[e-16])+((i>>>7|i<<25)^(i>>>18|i<<14)^i>>>3)|0,a=(0|n[e-7])+((r>>>17|r<<15)^(r>>>19|r<<13)^r>>>10)|0;n[e]=o+a|0}r=0|t.a[0],i=0|t.a[1];var s=0|t.a[2],u=0|t.a[3],c=0|t.a[4],l=0|t.a[5],h=0|t.a[6];for(o=0|t.a[7],e=0;64>e;e++){var f=((r>>>2|r<<30)^(r>>>13|r<<19)^(r>>>22|r<<10))+(r&i^r&s^i&s)|0;a=c&l^~c&h,o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0,a=a+(0|Lh[e])|0,a=o+(a+(0|n[e])|0)|0,o=h,h=l,l=c,c=u+a|0,u=s,s=i,i=r,r=a+f|0}t.a[0]=t.a[0]+r|0,t.a[1]=t.a[1]+i|0,t.a[2]=t.a[2]+s|0,t.a[3]=t.a[3]+u|0,t.a[4]=t.a[4]+c|0,t.a[5]=t.a[5]+l|0,t.a[6]=t.a[6]+h|0,t.a[7]=t.a[7]+o|0}function Vo(e,n,r){void 0===r&&(r=n.length);var i=0,o=e.c;if(t(n))for(;i<r;)e.f[o++]=n.charCodeAt(i++),o==e.b&&(Bo(e),o=0);else{if(!s(n))throw Error("message must be string or array");for(;i<r;){var a=n[i++];if(!("number"==typeof a&&0<=a&&255>=a&&a==(0|a)))throw Error("message must be a byte array");e.f[o++]=a,o==e.b&&(Bo(e),o=0)}}e.c=o,e.g+=r}function jo(){Uo.call(this,8,Wh)}function qo(t,e,n,r,i){this.l=t,this.i=e,this.m=n,this.o=r||null,this.u=i||null,this.h=e+":"+n,this.v=new Mo,this.g=new xo(this.h),this.f=null,this.b=[],this.a=this.c=null}function Wo(t){return new Rn("invalid-cordova-configuration",t)}function Ko(){for(var t=20,e=[];0<t;)e.push("1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".charAt(Math.floor(62*Math.random()))),t--;return e.join("")}function Ho(t){var e=new jo;Vo(e,t),t=[];var n=8*e.g;56>e.c?Vo(e,jh,56-e.c):Vo(e,jh,e.b-(e.c-56));for(var r=63;56<=r;r--)e.f[r]=255&n,n/=256;for(Bo(e),r=n=0;r<e.i;r++)for(var i=24;0<=i;i-=8)t[n++]=e.a[r]>>i&255;return xn(t)}function Go(t,e,n,r){var i=Ko(),o=new _r(e,r,null,i,new Rn("no-auth-event")),a=on("BuildInfo.packageName",Cu);if("string"!==typeof a)throw new Rn("invalid-cordova-configuration");var s=on("BuildInfo.displayName",Cu),u={};if(rn().toLowerCase().match(/iphone|ipad|ipod/))u.ibi=a;else{if(!rn().toLowerCase().match(/android/))return X(new Rn("operation-not-supported-in-this-environment"));u.apn=a}s&&(u.appDisplayName=s),i=Ho(i),u.sessionId=i;var c=eo(t.l,t.i,t.m,e,n,null,r,t.o,u,t.u);return t.ga().then(function(){var e=t.h;return t.v.a.set(Mh,o.D(),e)}).then(function(){var e=on("cordova.plugins.browsertab.isAvailable",Cu);if("function"!==typeof e)throw new Rn("invalid-cordova-configuration");var n=null;e(function(e){if(e){if("function"!==typeof(n=on("cordova.plugins.browsertab.openUrl",Cu)))throw new Rn("invalid-cordova-configuration");n(c)}else{if("function"!==typeof(n=on("cordova.InAppBrowser.open",Cu)))throw new Rn("invalid-cordova-configuration");e=rn(),e=!(!e.match(/(iPad|iPhone|iPod).*OS 7_\d/i)&&!e.match(/(iPad|iPhone|iPod).*OS 8_\d/i)),t.a=n(c,e?"_blank":"_system","location=yes")}})})}function Qo(t,e){for(var n=0;n<t.b.length;n++)try{t.b[n](e)}catch(t){}}function zo(t){return t.f||(t.f=t.ga().then(function(){return new G(function(e){function n(r){return e(r),t.Ka(n),!1}t.va(n),Xo(t)})})),t.f}function Yo(t){var e=null;return Lo(t.g).then(function(n){return e=n,n=t.g,Oo(n.b,Mh,n.a)}).then(function(){return e})}function Xo(t){function e(e){r=!0,i&&i.cancel(),Yo(t).then(function(r){var i=n;if(r&&e&&e.url){var o=null;i=Xn(e.url),-1!=i.indexOf("/__/auth/callback")&&(o=ne(i),o=pn(ee(o,"firebaseError")||null),o=(o="object"===typeof o?On(o):null)?new _r(r.b,r.c,null,null,o):new _r(r.b,r.c,i,r.g)),i=o||n}Qo(t,i)})}var n=new _r("unknown",null,null,null,new Rn("no-auth-event")),r=!1,i=qt(500).then(function(){return Yo(t).then(function(){r||Qo(t,n)})}),o=Cu.handleOpenURL;Cu.handleOpenURL=function(t){if(0==t.toLowerCase().indexOf(on("BuildInfo.packageName",Cu).toLowerCase()+"://")&&e({url:t}),"function"===typeof o)try{o(t)}catch(t){console.error(t)}},El||(El=new Er),El.subscribe(e)}function Jo(t){this.a=t,this.b=No()}function $o(t){return t.b.set(Kh,"pending",t.a)}function Zo(t){return Oo(t.b,Kh,t.a)}function ta(t){return t.b.get(Kh,t.a).then(function(t){return"pending"==t})}function ea(t,e,n){this.v=t,this.m=e,this.l=n,this.h=[],this.f=!1,this.i=f(this.o,this),this.c=new ua,this.u=new ya,this.g=new Jo(this.m+":"+this.l),this.b={},this.b.unknown=this.c,this.b.signInViaRedirect=this.c,this.b.linkViaRedirect=this.c,this.b.reauthViaRedirect=this.c,this.b.signInViaPopup=this.u,this.b.linkViaPopup=this.u,this.b.reauthViaPopup=this.u,this.a=na(this.v,this.m,this.l,zl)}function na(t,e,n,r){var i=Tu.SDK_VERSION||null;return Ye()?new qo(t,e,n,i,r):new Ji(t,e,n,i,r)}function ra(t){t.f||(t.f=!0,t.a.va(t.i));var e=t.a;return t.a.ga().s(function(n){throw t.a==e&&t.reset(),n})}function ia(t){t.a.Ib()&&ra(t).s(function(e){var n=new _r("unknown",null,null,null,new Rn("operation-not-supported-in-this-environment"));aa(e)&&t.o(n)}),t.a.Db()||ca(t.c)}function oa(t,e,n,r,i,o){return t.a.zb(e,n,r,function(){t.f||(t.f=!0,t.a.va(t.i))},function(){t.reset()},i,o)}function aa(t){return!(!t||"auth/cordova-not-ready"!=t.code)}function sa(t,e,n){var r=e+":"+n;return Qh[r]||(Qh[r]=new ea(t,e,n)),Qh[r]}function ua(){this.b=null,this.f=[],this.c=[],this.a=null,this.g=!1}function ca(t){t.g||(t.g=!0,pa(t,!1,null,null))}function la(t,e,n){n=n.wa(e.b,e.c);var r=e.f,i=e.g,o=!!e.b.match(/Redirect$/);n(r,i).then(function(e){pa(t,o,e,null)}).s(function(e){pa(t,o,null,e)})}function ha(t,e){if(t.b=function(){return X(e)},t.c.length)for(var n=0;n<t.c.length;n++)t.c[n](e)}function fa(t,e){if(t.b=function(){return Y(e)},t.f.length)for(var n=0;n<t.f.length;n++)t.f[n](e)}function pa(t,e,n,r){e?r?ha(t,r):fa(t,n):fa(t,{user:null}),t.f=[],t.c=[]}function da(t){var e=new Rn("timeout");t.a&&t.a.cancel(),t.a=qt(Gh.get()).then(function(){t.b||pa(t,!0,null,e)})}function ya(){}function ma(t,e){var n=t.c,r=t.b;e.wa(r,n)(t.f,t.g).then(function(t){e.ha(r,t,null,n)}).s(function(t){e.ha(r,null,t,n)})}function ga(){this.pb=!1,Object.defineProperty(this,"appVerificationDisabled",{get:function(){return this.pb},set:function(t){this.pb=t},enumerable:!1})}function va(t,e){this.a=e,Tn(this,"verificationId",t)}function ba(t,e,n,r){return new mr(t).Ta(e,n).then(function(t){return new va(t,r)})}function _a(t){var e=Vn(t);if(!(e&&e.exp&&e.auth_time&&e.iat))throw new Rn("internal-error","An internal error occurred. The token obtained by Firebase appears to be malformed. Please retry the operation.");Sn(this,{token:t,expirationTime:_n(1e3*e.exp),authTime:_n(1e3*e.auth_time),issuedAtTime:_n(1e3*e.iat),signInProvider:e.firebase&&e.firebase.sign_in_provider?e.firebase.sign_in_provider:null,claims:e})}function wa(t,e,n){if(this.h=t,this.i=e,this.g=n,this.c=3e4,this.f=96e4,this.b=null,this.a=this.c,this.f<this.c)throw Error("Proactive refresh lower bound greater than upper bound!")}function Ea(t,e){return e?(t.a=t.c,t.g()):(e=t.a,t.a*=2,t.a>t.f&&(t.a=t.f),e)}function Ta(t,e){t.stop(),t.b=qt(Ea(t,e)).then(function(){return bn()}).then(function(){return t.h()}).then(function(){Ta(t,!0)}).s(function(e){t.i(e)&&Ta(t,!1)})}function Sa(t){this.f=t,this.b=this.a=null,this.c=0}function Ca(t,e){var n=e[Vl],r=e.refreshToken;e=Na(e.expiresIn),t.b=n,t.c=e,t.a=r}function Ia(t,e){t.b=e.b,t.a=e.a,t.c=e.c}function Na(t){return ku()+1e3*parseInt(t,10)}function ka(t,e){return Ei(t.f,e).then(function(e){return t.b=e.access_token,t.c=Na(e.expires_in),t.a=e.refresh_token,{accessToken:t.b,expirationTime:t.c,refreshToken:t.a}}).s(function(e){throw"auth/user-token-expired"==e.code&&(t.a=null),e})}function Aa(t,e){this.a=t||null,this.b=e||null,Sn(this,{lastSignInTime:_n(e||null),creationTime:_n(t||null)})}function Ra(t){return new Aa(t.a,t.b)}function Oa(t,e,n,r,i,o){Sn(this,{uid:t,displayName:r||null,photoURL:i||null,email:n||null,phoneNumber:o||null,providerId:e})}function Da(t,e){vt.call(this,t);for(var n in e)this[n]=e[n]}function Pa(t,e,n){this.G=[],this.l=t.apiKey,this.o=t.appName,this.u=t.authDomain||null,t=Tu.SDK_VERSION?nn(Tu.SDK_VERSION):null,this.b=new gi(this.l,qi(zl),t),this.h=new Sa(this.b),ja(this,e[Vl]),Ca(this.h,e),Tn(this,"refreshToken",this.h.a),Ha(this,n||{}),Ft.call(this),this.I=!1,this.u&&sn()&&(this.a=sa(this.u,this.l,this.o)),this.N=[],this.i=null,this.w=Ua(this),this.V=f(this.Ha,this);var r=this;this.ka=null,this.sa=function(t){r.oa(t.g)},this.X=null,this.O=[],this.ra=function(t){La(r,t.c)},this.W=null}function xa(t,e){t.X&&At(t.X,"languageCodeChanged",t.sa),(t.X=e)&&Ct(e,"languageCodeChanged",t.sa)}function La(t,e){t.O=e,bi(t.b,Tu.SDK_VERSION?nn(Tu.SDK_VERSION,t.O):null)}function Ma(t,e){t.W&&At(t.W,"frameworkChanged",t.ra),(t.W=e)&&Ct(e,"frameworkChanged",t.ra)}function Fa(t){try{return Tu.app(t.o).auth()}catch(e){throw new Rn("internal-error","No firebase.auth.Auth instance is available for the Firebase App '"+t.o+"'!")}}function Ua(t){return new wa(function(){return t.F(!0)},function(t){return!(!t||"auth/network-request-failed"!=t.code)},function(){var e=t.h.c-ku()-3e5;return 0<e?e:0})}function Ba(t){t.C||t.w.b||(t.w.start(),At(t,"tokenChanged",t.V),Ct(t,"tokenChanged",t.V))}function Va(t){At(t,"tokenChanged",t.V),t.w.stop()}function ja(t,e){t.qa=e,Tn(t,"_lat",e)}function qa(t,e){A(t.N,function(t){return t==e})}function Wa(t){for(var e=[],n=0;n<t.N.length;n++)e.push(t.N[n](t));return Z(e).then(function(){return t})}function Ka(t){t.a&&!t.I&&(t.I=!0,t.a.subscribe(t))}function Ha(t,e){Sn(t,{uid:e.uid,displayName:e.displayName||null,photoURL:e.photoURL||null,email:e.email||null,emailVerified:e.emailVerified||!1,phoneNumber:e.phoneNumber||null,isAnonymous:e.isAnonymous||!1,metadata:new Aa(e.createdAt,e.lastLoginAt),providerData:[]})}function Ga(){}function Qa(t){return Y().then(function(){if(t.C)throw new Rn("app-deleted")})}function za(t){return Pu(t.providerData,function(t){return t.providerId})}function Ya(t,e){e&&(Xa(t,e.providerId),t.providerData.push(e))}function Xa(t,e){A(t.providerData,function(t){return t.providerId==e})}function Ja(t,e,n){("uid"!=e||n)&&t.hasOwnProperty(e)&&Tn(t,e,n)}function $a(t,e){t!=e&&(Sn(t,{uid:e.uid,displayName:e.displayName,photoURL:e.photoURL,email:e.email,emailVerified:e.emailVerified,phoneNumber:e.phoneNumber,isAnonymous:e.isAnonymous,providerData:[]}),e.metadata?Tn(t,"metadata",Ra(e.metadata)):Tn(t,"metadata",new Aa),Du(e.providerData,function(e){Ya(t,e)}),Ia(t.h,e.h),Tn(t,"refreshToken",t.h.a))}function Za(t){return t.F().then(function(e){var n=t.isAnonymous;return es(t,e).then(function(){return n||Ja(t,"isAnonymous",!1),e})})}function ts(t,e){e[Vl]&&t.qa!=e[Vl]&&(Ca(t.h,e),t.dispatchEvent(new Da("tokenChanged")),ja(t,e[Vl]),Ja(t,"refreshToken",t.h.a))}function es(t,e){return Bi(t.b,rh,{idToken:e}).then(f(t.uc,t))}function ns(t){return(t=t.providerUserInfo)&&t.length?Pu(t,function(t){return new Oa(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)}):[]}function rs(t,e){return Za(t).then(function(){if(N(za(t),e))return Wa(t).then(function(){throw new Rn("provider-already-linked")})})}function is(t,e,n){var r=vr(e);return e=qn(e),Cn({user:t,credential:r,additionalUserInfo:e,operationType:n})}function os(t,e){return ts(t,e),t.reload().then(function(){return t})}function as(t,e,n,r,i){if(!sn())return X(new Rn("operation-not-supported-in-this-environment"));if(t.i&&!i)return X(t.i);var o=jn(n.providerId),a=dn(t.uid+":::"),s=null;(!ln()||Xe())&&t.u&&n.isOAuthProvider&&(s=eo(t.u,t.l,t.o,e,n,null,a,Tu.SDK_VERSION||null));var u=He(s,o&&o.Ba,o&&o.Aa);return r=r().then(function(){if(us(t),!i)return t.F().then(function(){})}).then(function(){return oa(t.a,u,e,n,a,!!s)}).then(function(){return new G(function(n,r){t.ha(e,null,new Rn("cancelled-popup-request"),t.g||null),t.f=n,t.v=r,t.g=a,t.c=t.a.Ea(t,e,u,a)})}).then(function(t){return u&&Ke(u),t?Cn(t):null}).s(function(t){throw u&&Ke(u),t}),cs(t,r,i)}function ss(t,e,n,r,i){if(!sn())return X(new Rn("operation-not-supported-in-this-environment"));if(t.i&&!i)return X(t.i);var o=null,a=dn(t.uid+":::");return r=r().then(function(){if(us(t),!i)return t.F().then(function(){})}).then(function(){return t.aa=a,Wa(t)}).then(function(e){return t.ba&&(e=t.ba,e=e.b.set(zh,t.D(),e.a)),e}).then(function(){return t.a.Ca(e,n,a)}).s(function(e){if(o=e,t.ba)return ys(t.ba);throw o}).then(function(){if(o)throw o}),cs(t,r,i)}function us(t){if(!t.a||!t.I){if(t.a&&!t.I)throw new Rn("internal-error");throw new Rn("auth-domain-config-required")}}function cs(t,e,n){var r=ls(t,e,n);return t.G.push(r),r.ia(function(){k(t.G,r)}),r}function ls(t,e,n){return t.i&&!n?(e.cancel(),X(t.i)):e.s(function(e){throw!e||"auth/user-disabled"!=e.code&&"auth/user-token-expired"!=e.code||(t.i||t.dispatchEvent(new Da("userInvalidated")),t.i=e),e})}function hs(t){if(!t.apiKey)return null;var e={apiKey:t.apiKey,authDomain:t.authDomain,appName:t.appName},n={};if(!(t.stsTokenManager&&t.stsTokenManager.accessToken&&t.stsTokenManager.expirationTime))return null;n[Vl]=t.stsTokenManager.accessToken,n.refreshToken=t.stsTokenManager.refreshToken||null,n.expiresIn=(t.stsTokenManager.expirationTime-ku())/1e3;var r=new Pa(e,n,t);return t.providerData&&Du(t.providerData,function(t){t&&Ya(r,Cn(t))}),t.redirectEventId&&(r.aa=t.redirectEventId),r}function fs(t,e,n,r){var i=new Pa(t,e);return n&&(i.ba=n),r&&La(i,r),i.reload().then(function(){return i})}function ps(t,e,n,r){e=e||{apiKey:t.l,authDomain:t.u,appName:t.o};var i=t.h,o={};return o[Vl]=i.b,o.refreshToken=i.a,o.expiresIn=(i.c-ku())/1e3,e=new Pa(e,o),n&&(e.ba=n),r&&La(e,r),$a(e,t),e}function ds(t){this.a=t,this.b=No()}function ys(t){return Oo(t.b,zh,t.a)}function ms(t,e){return t.b.get(zh,t.a).then(function(t){return t&&e&&(t.authDomain=e),hs(t||{})})}function gs(t){this.a=t,this.b=No(),this.c=null,this.f=bs(this),this.b.addListener(_s("local"),this.a,f(this.g,this))}function vs(t,e){var n,r=[];for(n in xh)xh[n]!==e&&r.push(Oo(t.b,_s(xh[n]),t.a));return r.push(Oo(t.b,Yh,t.a)),$(r)}function bs(t){var e=_s("local"),n=_s("session"),r=_s("none");return Ro(t.b,e,t.a).then(function(){return t.b.get(n,t.a)}).then(function(i){return i?n:t.b.get(r,t.a).then(function(n){return n?r:t.b.get(e,t.a).then(function(n){return n?e:t.b.get(Yh,t.a).then(function(t){return t?_s(t):e})})})}).then(function(e){return t.c=e,vs(t,e.A)}).s(function(){t.c||(t.c=e)})}function _s(t){return{name:"authUser",A:t}}function ws(t){return Cs(t,function(){return t.b.set(Yh,t.c.A,t.a)})}function Es(t,e){return Cs(t,function(){return t.b.set(t.c,e.D(),t.a)})}function Ts(t){return Cs(t,function(){return Oo(t.b,t.c,t.a)})}function Ss(t,e){return Cs(t,function(){return t.b.get(t.c,t.a).then(function(t){return t&&e&&(t.authDomain=e),hs(t||{})})})}function Cs(t,e){return t.f=t.f.then(e,e),t.f}function Is(t){if(this.l=!1,Tn(this,"settings",new ga),Tn(this,"app",t),!Us(this).options||!Us(this).options.apiKey)throw new Rn("invalid-api-key");t=Tu.SDK_VERSION?nn(Tu.SDK_VERSION):null,this.b=new gi(Us(this).options&&Us(this).options.apiKey,qi(zl),t),this.N=[],this.o=[],this.I=[],this.Pb=Tu.INTERNAL.createSubscribe(f(this.ic,this)),this.O=void 0,this.Qb=Tu.INTERNAL.createSubscribe(f(this.jc,this)),Ps(this,null),this.h=new gs(Us(this).options.apiKey+":"+Us(this).name),this.w=new ds(Us(this).options.apiKey+":"+Us(this).name),this.V=Ws(this,Ls(this)),this.i=Ws(this,Ms(this)),this.X=!1,this.ka=f(this.Jc,this),this.Ha=f(this.Z,this),this.qa=f(this.Yb,this),this.ra=f(this.gc,this),this.sa=f(this.hc,this),Os(this),this.INTERNAL={},this.INTERNAL.delete=f(this.delete,this),this.INTERNAL.logFramework=f(this.qc,this),this.u=0,Ft.call(this),As(this),this.G=[]}function Ns(t){vt.call(this,"languageCodeChanged"),this.g=t}function ks(t){vt.call(this,"frameworkChanged"),this.c=t}function As(t){Object.defineProperty(t,"lc",{get:function(){return this.ea()},set:function(t){this.oa(t)},enumerable:!1}),t.W=null}function Rs(t){return t.Ob||X(new Rn("auth-domain-config-required"))}function Os(t){var e=Us(t).options.authDomain,n=Us(t).options.apiKey;e&&sn()&&(t.Ob=t.V.then(function(){if(!t.l){if(t.a=sa(e,n,Us(t).name),t.a.subscribe(t),Bs(t)&&Ka(Bs(t)),t.C){Ka(t.C);var r=t.C;r.oa(t.ea()),xa(r,t),r=t.C,La(r,t.G),Ma(r,t),t.C=null}return t.a}}))}function Ds(t,e){var n={};return n.apiKey=Us(t).options.apiKey,n.authDomain=Us(t).options.authDomain,n.appName=Us(t).name,t.V.then(function(){return fs(n,e,t.w,t.xa())}).then(function(e){return Bs(t)&&e.uid==Bs(t).uid?($a(Bs(t),e),t.Z(e)):(Ps(t,e),Ka(e),t.Z(e))}).then(function(){js(t)})}function Ps(t,e){Bs(t)&&(qa(Bs(t),t.Ha),At(Bs(t),"tokenChanged",t.qa),At(Bs(t),"userDeleted",t.ra),At(Bs(t),"userInvalidated",t.sa),Va(Bs(t))),e&&(e.N.push(t.Ha),Ct(e,"tokenChanged",t.qa),Ct(e,"userDeleted",t.ra),Ct(e,"userInvalidated",t.sa),0<t.u&&Ba(e)),Tn(t,"currentUser",e),e&&(e.oa(t.ea()),xa(e,t),La(e,t.G),Ma(e,t))}function xs(t){var e=ms(t.w,Us(t).options.authDomain).then(function(e){return(t.C=e)&&(e.ba=t.w),ys(t.w)});return Ws(t,e)}function Ls(t){var e=Us(t).options.authDomain,n=xs(t).then(function(){return Ss(t.h,e)}).then(function(e){return e?(e.ba=t.w,t.C&&(t.C.aa||null)==(e.aa||null)?e:e.reload().then(function(){return Es(t.h,e).then(function(){return e})}).s(function(n){return"auth/network-request-failed"==n.code?e:Ts(t.h)})):null}).then(function(e){Ps(t,e||null)});return Ws(t,n)}function Ms(t){return t.V.then(function(){return t.fa()}).s(function(){}).then(function(){if(!t.l)return t.ka()}).s(function(){}).then(function(){if(!t.l){t.X=!0;var e=t.h;e.b.addListener(_s("local"),e.a,t.ka)}})}function Fs(t,e){var n=null,r=null;return Ws(t,e.then(function(e){return n=vr(e),r=qn(e),Ds(t,e)}).then(function(){return Cn({user:Bs(t),credential:n,additionalUserInfo:r,operationType:"signIn"})}))}function Us(t){return t.app}function Bs(t){return t.currentUser}function Vs(t){return Bs(t)&&Bs(t)._lat||null}function js(t){if(t.X){for(var e=0;e<t.o.length;e++)t.o[e]&&t.o[e](Vs(t));if(t.O!==t.getUid()&&t.I.length)for(t.O=t.getUid(),e=0;e<t.I.length;e++)t.I[e]&&t.I[e](Vs(t))}}function qs(t,e){t.I.push(e),Ws(t,t.i.then(function(){!t.l&&N(t.I,e)&&t.O!==t.getUid()&&(t.O=t.getUid(),e(Vs(t)))}))}function Ws(t,e){return t.N.push(e),e.ia(function(){k(t.N,e)}),e}function Ks(){}function Hs(){this.a={},this.b=1e12}function Gs(t,e){return(e=Qs(e))?t.a[e]||null:null}function Qs(t){return(t="undefined"===typeof t?1e12:t)?t.toString():null}function zs(t,e){this.g=!1,this.c=e,this.a=this.b=null,this.h="invisible"!==this.c.size,this.f=Ae(t);var n=this;this.i=function(){n.execute()},this.h?this.execute():Ct(this.f,"click",this.i)}function Ys(t){if(t.g)throw Error("reCAPTCHA mock was already deleted!")}function Xs(){}function Js(){this.b=Cu.grecaptcha?1/0:0,this.f=null,this.a="__rcb"+Math.floor(1e6*Math.random()).toString()}function $s(t,e,n,r,i,o,a){if(Tn(this,"type","recaptcha"),this.c=this.f=null,this.C=!1,this.l=e,this.g=null,a?(Jh||(Jh=new Xs),a=Jh):(tf||(tf=new Js),a=tf),this.o=a,this.a=n||{theme:"light",type:"image"},this.h=[],this.a[rf])throw new Rn("argument-error","sitekey should not be provided for reCAPTCHA as one is automatically provisioned for the current project.");if(this.i="invisible"===this.a[of],!Cu.document)throw new Rn("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment with DOM support.");if(!Ae(e)||!this.i&&Ae(e).hasChildNodes())throw new Rn("argument-error","reCAPTCHA container is either not found or already contains inner elements!");this.u=new gi(t,o||null,i||null),this.v=r||function(){return null};var s=this;this.m=[];var u=this.a[ef];this.a[ef]=function(t){if(Zs(s,t),"function"===typeof u)u(t);else if("string"===typeof u){var e=on(u,Cu);"function"===typeof e&&e(t)}};var c=this.a[nf];this.a[nf]=function(){if(Zs(s,null),"function"===typeof c)c();else if("string"===typeof c){var t=on(c,Cu);"function"===typeof t&&t()}}}function Zs(t,e){for(var n=0;n<t.m.length;n++)try{t.m[n](e)}catch(t){}}function tu(t,e){A(t.m,function(t){return t==e})}function eu(t,e){return t.h.push(e),e.ia(function(){k(t.h,e)}),e}function nu(t){if(t.C)throw new Rn("internal-error","RecaptchaVerifier instance has been destroyed.")}function ru(t,e,n){var r=!1;try{this.b=n||Tu.app()}catch(t){throw new Rn("argument-error","No firebase.app.App instance is currently initialized.")}if(!this.b.options||!this.b.options.apiKey)throw new Rn("invalid-api-key");n=this.b.options.apiKey;var i=this,o=null;try{o=this.b.auth().xa()}catch(t){}try{r=this.b.auth().settings.appVerificationDisabledForTesting}catch(t){}o=Tu.SDK_VERSION?nn(Tu.SDK_VERSION,o):null,$s.call(this,n,t,e,function(){try{var t=i.b.auth().ea()}catch(e){t=null}return t},o,qi(zl),r)}function iu(t,e,n,r){t:{n=Array.prototype.slice.call(n);for(var i=0,o=!1,a=0;a<e.length;a++)if(e[a].optional)o=!0;else{if(o)throw new Rn("internal-error","Argument validator encountered a required argument after an optional argument.");i++}if(o=e.length,n.length<i||o<n.length)r="Expected "+(i==o?1==i?"1 argument":i+" arguments":i+"-"+o+" arguments")+" but got "+n.length+".";else{for(i=0;i<n.length;i++)if(o=e[i].optional&&void 0===n[i],!e[i].M(n[i])&&!o){if(e=e[i],0>i||i>=af.length)throw new Rn("internal-error","Argument validator received an unsupported number of arguments.");n=af[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.K+".";break t}r=null}}if(r)throw new Rn("argument-error",t+" failed: "+r)}function ou(e,n){return{name:e||"",K:"a valid string",optional:!!n,M:t}}function au(t,n){return{name:t||"",K:"a boolean",optional:!!n,M:e}}function su(t,e){return{name:t||"",K:"a valid object",optional:!!e,M:c}}function uu(t,e){return{name:t||"",K:"a function",optional:!!e,M:u}}function cu(t,e){return{name:t||"",K:"null",optional:!!e,M:o}}function lu(){return{name:"",K:"an HTML element",optional:!1,M:function(t){return!!(t&&t instanceof Element)}}}function hu(){return{name:"auth",K:"an instance of Firebase Auth",optional:!0,M:function(t){return!!(t&&t instanceof Is)}}}function fu(){return{name:"app",K:"an instance of Firebase App",optional:!0,M:function(t){return!!(t&&t instanceof Tu.app.App)}}}function pu(t){return{name:t?t+"Credential":"credential",K:t?"a valid "+t+" credential":"a valid credential",optional:!1,M:function(e){if(!e)return!1;var n=!t||e.providerId===t;return!(!e.ya||!n)}}}function du(){return{name:"authProvider",K:"a valid Auth provider",optional:!1,M:function(t){return!!(t&&t.providerId&&t.hasOwnProperty&&t.hasOwnProperty("isOAuthProvider"))}}}function yu(){return{name:"applicationVerifier",K:"an implementation of firebase.auth.ApplicationVerifier",optional:!1,M:function(e){return!!(e&&t(e.type)&&u(e.verify))}}}function mu(t,e,n,r){return{name:n||"",K:t.K+" or "+e.K,optional:!!r,M:function(n){return t.M(n)||e.M(n)}}}function gu(t,e){for(var n in e){var r=e[n].name;t[r]=_u(r,t[n],e[n].j)}}function vu(t,e){for(var n in e){var r=e[n].name;if(r!==n){var i=e[n].qb;Object.defineProperty(t,r,{get:function(){return this[n]},set:function(t){iu(r,[i],[t],!0),this[n]=t},enumerable:!0})}}}function bu(t,e,n,r){t[e]=_u(e,n,r)}function _u(t,e,n){function r(){var t=Array.prototype.slice.call(arguments);return iu(o,n,t),e.apply(this,t)}if(!n)return e;var i,o=wu(t);for(i in e)r[i]=e[i];for(i in e.prototype)r.prototype[i]=e.prototype[i];return r}function wu(t){return t=t.split("."),t[t.length-1]}var Eu,Tu=n(0).default,Su=Su||{},Cu=this,Iu="closure_uid_"+(1e9*Math.random()>>>0),Nu=0,ku=Date.now||function(){return+new Date};d(g,Error),g.prototype.name="CustomError",d(v,g),v.prototype.name="AssertionError",_.prototype.get=function(){if(0<this.b){this.b--;var t=this.a;this.a=t.next,t.next=null}else t=this.c();return t};var Au=new _(function(){return new S},function(t){t.reset()});E.prototype.add=function(t,e){var n=Au.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},S.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},S.prototype.reset=function(){this.next=this.b=this.a=null};var Ru,Ou=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(e,n){if(t(e))return t(n)&&1==n.length?e.indexOf(n,0):-1;for(var r=0;r<e.length;r++)if(r in e&&e[r]===n)return r;return-1},Du=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(e,n,r){for(var i=e.length,o=t(e)?e.split(""):e,a=0;a<i;a++)a in o&&n.call(r,o[a],a,e)},Pu=Array.prototype.map?function(t,e){return Array.prototype.map.call(t,e,void 0)}:function(e,n){for(var r=e.length,i=Array(r),o=t(e)?e.split(""):e,a=0;a<r;a++)a in o&&(i[a]=n.call(void 0,o[a],a,e));return i},xu=Array.prototype.some?function(t,e){return Array.prototype.some.call(t,e,void 0)}:function(e,n){for(var r=e.length,i=t(e)?e.split(""):e,o=0;o<r;o++)if(o in i&&n.call(void 0,i[o],o,e))return!0;return!1},Lu=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]},Mu=/&/g,Fu=/</g,Uu=/>/g,Bu=/"/g,Vu=/'/g,ju=/\x00/g,qu=/[\x00&<>"']/;t:{var Wu=Cu.navigator;if(Wu){var Ku=Wu.userAgent;if(Ku){Ru=Ku;break t}}Ru=""}var Hu,Gu,Qu="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),zu=!1,Yu=new E,Xu=0,Ju=2,$u=3;Q.prototype.reset=function(){this.f=this.b=this.g=this.a=null,this.c=!1};var Zu=new _(function(){return new Q},function(t){t.reset()});G.prototype.then=function(t,e,n){return nt(this,u(t)?t:null,u(e)?e:null,n)},y(G),Eu=G.prototype,Eu.ia=function(t,e){return t=z(t,t,e),t.c=!0,et(this,t),this},Eu.s=function(t,e){return nt(this,null,t,e)},Eu.cancel=function(t){this.a==Xu&&W(function(){tt(this,new ht(t))},this)},Eu.Lc=function(t){this.a=Xu,rt(this,Ju,t)},Eu.Mc=function(t){this.a=Xu,rt(this,$u,t)},Eu.Ub=function(){for(var t;t=st(this);)ut(this,t,this.a,this.i);this.h=!1};var tc=j;d(ht,g),ht.prototype.name="cancel";var ec=0,nc={};ft.prototype.pa=!1,ft.prototype.ua=function(){if(this.ja)for(;this.ja.length;)this.ja.shift()()},dt[" "]=r;var rc,ic=M("Opera"),oc=M("Trident")||M("MSIE"),ac=M("Edge"),sc=ac||oc,uc=M("Gecko")&&!(x(Ru.toLowerCase(),"webkit")&&!M("Edge"))&&!(M("Trident")||M("MSIE"))&&!M("Edge"),cc=x(Ru.toLowerCase(),"webkit")&&!M("Edge");t:{var lc="",hc=function(){var t=Ru;return uc?/rv:([^\);]+)(\)|;)/.exec(t):ac?/Edge\/([\d\.]+)/.exec(t):oc?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t):cc?/WebKit\/(\S+)/.exec(t):ic?/(?:Version)[ \/]?(\S+)/.exec(t):void 0}();if(hc&&(lc=hc?hc[1]:""),oc){var fc=mt();if(null!=fc&&fc>parseFloat(lc)){rc=String(fc);break t}}rc=lc}var pc,dc={},yc=Cu.document;pc=yc&&oc?mt()||("CSS1Compat"==yc.compatMode?parseInt(rc,10):5):void 0;var mc=Object.freeze||function(t){return t},gc=!oc||9<=Number(pc),vc=oc&&!gt("9"),bc=function(){if(!Cu.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});return Cu.addEventListener("test",r,e),Cu.removeEventListener("test",r,e),t}();vt.prototype.preventDefault=function(){this.Gb=!1},d(bt,vt);var _c=mc({2:"touch",3:"pen",4:"mouse"});bt.prototype.preventDefault=function(){bt.lb.preventDefault.call(this);var t=this.a;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,vc)try{(t.ctrlKey||112<=t.keyCode&&123>=t.keyCode)&&(t.keyCode=-1)}catch(t){}},bt.prototype.f=function(){return this.a};var wc="closure_listenable_"+(1e6*Math.random()|0),Ec=0;Et.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var a=St(t,e,r,i);return-1<a?(e=t[a],n||(e.Ia=!1)):(e=new _t(e,this.src,o,!!r,i),e.Ia=n,t.push(e)),e};var Tc="closure_lm_"+(1e6*Math.random()|0),Sc={},Cc=0,Ic="__closure_events_fn_"+(1e9*Math.random()>>>0);d(Ft,ft),Ft.prototype[wc]=!0,Ft.prototype.addEventListener=function(t,e,n,r){Ct(this,t,e,n,r)},Ft.prototype.removeEventListener=function(t,e,n,r){At(this,t,e,n,r)},Ft.prototype.dispatchEvent=function(e){var n,r=this.Ua;if(r)for(n=[];r;r=r.Ua)n.push(r);r=this.Nb;var i=e.type||e;if(t(e))e=new vt(e,r);else if(e instanceof vt)e.target=e.target||r;else{var o=e;e=new vt(i,r),V(e,o)}if(o=!0,n)for(var a=n.length-1;0<=a;a--){var s=e.b=n[a];o=Vt(s,i,!0,e)&&o}if(s=e.b=r,o=Vt(s,i,!0,e)&&o,o=Vt(s,i,!1,e)&&o,n)for(a=0;a<n.length;a++)s=e.b=n[a],o=Vt(s,i,!1,e)&&o;return o},Ft.prototype.ua=function(){if(Ft.lb.ua.call(this),this.m){var t,e=this.m,n=0;for(t in e.a){for(var r=e.a[t],i=0;i<r.length;i++)++n,wt(r[i]);delete e.a[t],e.b--}}this.Ua=null},Eu=Gt.prototype,Eu.S=function(){Qt(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},Eu.U=function(){return Qt(this),this.a.concat()},Eu.clear=function(){this.b={},this.c=this.a.length=0},Eu.get=function(t,e){return zt(this.b,t)?this.b[t]:e},Eu.set=function(t,e){zt(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},Eu.forEach=function(t,e){for(var n=this.U(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var Nc=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;Xt.prototype.toString=function(){var t=[],e=this.c;e&&t.push(oe(e,kc,!0),":");var n=this.b;return(n||"file"==e)&&(t.push("//"),(e=this.m)&&t.push(oe(e,kc,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.i)&&t.push(":",String(n))),(n=this.g)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(oe(n,"/"==n.charAt(0)?Rc:Ac,!0))),(n=this.a.toString())&&t.push("?",n),(n=this.h)&&t.push("#",oe(n,Dc)),t.join("")};var kc=/[#\/\?@]/g,Ac=/[#\?:]/g,Rc=/[#\?]/g,Oc=/[#\?@]/g,Dc=/#/g;Eu=se.prototype,Eu.add=function(t,e){ue(this),this.c=null,t=pe(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},Eu.clear=function(){this.a=this.c=null,this.b=0},Eu.forEach=function(t,e){ue(this),this.a.forEach(function(n,r){Du(n,function(n){t.call(e,n,r,this)},this)},this)},Eu.U=function(){ue(this);for(var t=this.a.S(),e=this.a.U(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},Eu.S=function(e){ue(this);var n=[];if(t(e))he(this,e)&&(n=R(n,this.a.get(pe(this,e))));else{e=this.a.S();for(var r=0;r<e.length;r++)n=R(n,e[r])}return n},Eu.set=function(t,e){return ue(this),this.c=null,t=pe(this,t),he(this,t)&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},Eu.get=function(t,e){return t=t?this.S(t):[],0<t.length?String(t[0]):e},Eu.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.U(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.S(r);for(var o=0;o<r.length;o++){var a=i;""!==r[o]&&(a+="="+encodeURIComponent(String(r[o]))),t.push(a)}}return this.c=t.join("&")};var Pc=!oc||9<=Number(pc);ye.prototype.ma=!0,ye.prototype.la=function(){return this.a},ye.prototype.toString=function(){return"Const{"+this.a+"}"};var xc={};ge(""),ve.prototype.ma=!0,ve.prototype.la=function(){return this.a},ve.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var Lc=/%{(\w+)}/g,Mc=/^(?:https:)?\/\/[0-9a-z.:[\]-]+\/|^\/[^\/\\]|^about:blank#/i,Fc={};Ee.prototype.ma=!0,Ee.prototype.la=function(){return this.a},Ee.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Uc=/^(?:(?:https?|mailto|ftp):|[^:\/?#]*(?:[\/?#]|$))/i,Bc={};Ce("about:blank"),Ie.prototype.ma=!0,Ie.prototype.la=function(){return this.a},Ie.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var Vc={};ke("<!DOCTYPE html>"),ke(""),ke("<br>");var jc={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"},qc={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},Wc=/\uffff/.test("\uffff")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g,Kc=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Hc="Firefox",Gc="Chrome",Qc={Sc:"FirebaseCore-web",Uc:"FirebaseUI-web"};gn.prototype.get=function(){var t=Cu.navigator;return(t&&"boolean"===typeof t.onLine&&(un()||"chrome-extension:"===cn()||"undefined"!==typeof t.connection)?t.onLine:1)?this.b?this.c:this.a:Math.min(5e3,this.a)};var zc,Yc={};try{var Xc={};Object.defineProperty(Xc,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(Xc,"abcd",{configurable:!0,enumerable:!0,value:2}),zc=2==Xc.abcd}catch(t){zc=!1}var Jc="EMAIL_SIGNIN",$c="email",Zc="newEmail",tl="requestType",el="email",nl="fromEmail",rl="data",il="operation";d(Rn,Error),Rn.prototype.D=function(){return{code:this.code,message:this.message}},Rn.prototype.toJSON=function(){return this.D()};var ol="auth/",al={"argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-already-in-use":"The email address is already in use by another account.","expired-action-code":"The action code has expired. ","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal error has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registed for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal error has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-email":"The email address is badly formatted.","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is malformed or has expired.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal error has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network error (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal error has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","user-cancelled":"User did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled."},sl="android",ul="handleCodeInApp",cl="iOS",ll="url",hl="installApp",fl="minimumVersion",pl="packageName",dl="bundleId",yl=null,ml=null;Un.prototype.f=function(){return this.b};var gl="oauth_consumer_key oauth_nonce oauth_signature oauth_signature_method oauth_timestamp oauth_token oauth_version".split(" "),vl=["client_id","response_type","scope","redirect_uri","state"],bl={Tc:{Ma:"locale",Ba:500,Aa:600,Na:"facebook.com",eb:vl},Vc:{Ma:null,Ba:500,Aa:620,Na:"github.com",eb:vl},Wc:{Ma:"hl",Ba:515,Aa:680,Na:"google.com",eb:vl},bd:{Ma:"lang",Ba:485,Aa:705,Na:"twitter.com",eb:gl}},_l="idToken",wl="providerId";d(Kn,Wn),d(Hn,Kn),d(Gn,Kn),d(Qn,Kn),d(zn,Kn),$n.prototype.ya=function(t){return Li(t,Zn(this))},$n.prototype.c=function(t,e){var n=Zn(this);return n.idToken=e,Mi(t,n)},$n.prototype.f=function(t,e){return Jn(Fi(t,Zn(this)),e)},$n.prototype.D=function(){var t={providerId:this.providerId,signInMethod:this.signInMethod};return this.idToken&&(t.oauthIdToken=this.idToken),this.accessToken&&(t.oauthAccessToken=this.accessToken),this.secret&&(t.oauthTokenSecret=this.secret),t},tr.prototype.Da=function(t){return this.vb=B(t),this},d(er,tr),er.prototype.ta=function(t){return N(this.a,t)||this.a.push(t),this},er.prototype.Ab=function(){return O(this.a)},er.prototype.credential=function(t,e){if(!t&&!e)throw new Rn("argument-error","credential failed: must provide the ID token and/or the access token.");return new $n(this.providerId,{idToken:t||null,accessToken:e||null},this.providerId)},d(nr,er),Tn(nr,"PROVIDER_ID","facebook.com"),Tn(nr,"FACEBOOK_SIGN_IN_METHOD","facebook.com"),d(ir,er),Tn(ir,"PROVIDER_ID","github.com"),Tn(ir,"GITHUB_SIGN_IN_METHOD","github.com"),d(ar,er),Tn(ar,"PROVIDER_ID","google.com"),Tn(ar,"GOOGLE_SIGN_IN_METHOD","google.com"),d(ur,tr),Tn(ur,"PROVIDER_ID","twitter.com"),Tn(ur,"TWITTER_SIGN_IN_METHOD","twitter.com"),lr.prototype.ya=function(t){return this.signInMethod==hr.EMAIL_LINK_SIGN_IN_METHOD?Bi(t,eh,{email:this.a,oobCode:this.b}):Bi(t,vh,{email:this.a,password:this.b})},lr.prototype.c=function(t,e){return this.signInMethod==hr.EMAIL_LINK_SIGN_IN_METHOD?Bi(t,nh,{idToken:e,email:this.a,oobCode:this.b}):Bi(t,fh,{idToken:e,email:this.a,password:this.b})},lr.prototype.f=function(t,e){return Jn(this.ya(t),e)},lr.prototype.D=function(){return{email:this.a,password:this.b,signInMethod:this.signInMethod}},Sn(hr,{PROVIDER_ID:"password"}),Sn(hr,{EMAIL_LINK_SIGN_IN_METHOD:"emailLink"}),Sn(hr,{EMAIL_PASSWORD_SIGN_IN_METHOD:"password"}),dr.prototype.ya=function(t){return t.Ta(yr(this))},dr.prototype.c=function(t,e){var n=yr(this);return n.idToken=e,Bi(t,_h,n)},dr.prototype.f=function(t,e){var n=yr(this);return n.operation="REAUTH",t=Bi(t,wh,n),Jn(t,e)},dr.prototype.D=function(){var t={providerId:"phone"};return this.a.Sa&&(t.verificationId=this.a.Sa),this.a.Ra&&(t.verificationCode=this.a.Ra),this.a.Fa&&(t.temporaryProof=this.a.Fa),this.a.$&&(t.phoneNumber=this.a.$),t},mr.prototype.Ta=function(e,n){var r=this.a.b;return Y(n.verify()).then(function(i){if(!t(i))throw new Rn("argument-error","An implementation of firebase.auth.ApplicationVerifier.prototype.verify() must return a firebase.Promise that resolves with a string.");switch(n.type){case"recaptcha":return Oi(r,{phoneNumber:e,recaptchaToken:i}).then(function(t){return"function"===typeof n.reset&&n.reset(),t},function(t){throw"function"===typeof n.reset&&n.reset(),t});default:throw new Rn("argument-error",'Only firebase.auth.ApplicationVerifiers with type="recaptcha" are currently supported.')}})},Sn(mr,{PROVIDER_ID:"phone"}),Sn(mr,{PHONE_SIGN_IN_METHOD:"phone"}),_r.prototype.D=function(){return{type:this.b,eventId:this.c,urlResponse:this.f,sessionId:this.g,error:this.a&&this.a.D()}};var El=null;Er.prototype.subscribe=function(t){var e=this;this.a.push(t),this.b||(this.b=function(t){for(var n=0;n<e.a.length;n++)e.a[n](t)},"function"===typeof(t=on("universalLinks.subscribe",Cu))&&t(null,this.b))},Er.prototype.unsubscribe=function(t){A(this.a,function(e){return e==t})},d(Tr,Rn),d(Sr,Rn),Sr.prototype.D=function(){var t={code:this.code,message:this.message};this.email&&(t.email=this.email),this.phoneNumber&&(t.phoneNumber=this.phoneNumber);var e=this.credential&&this.credential.D();return e&&V(t,e),t},Sr.prototype.toJSON=function(){return this.D()};var Tl=/^[+a-zA-Z0-9_.!#$%&'*\/=?^`{|}~-]+@([a-zA-Z0-9-]+\.)+[a-zA-Z0-9]{2,63}$/;Ir.prototype.c=null;var Sl;d(kr,Ir),kr.prototype.a=function(){var t=Ar(this);return t?new ActiveXObject(t):new XMLHttpRequest},kr.prototype.b=function(){var t={};return Ar(this)&&(t[0]=!0,t[1]=!0),t},Sl=new kr,d(Rr,Ir),Rr.prototype.a=function(){var t=new XMLHttpRequest;if("withCredentials"in t)return t;if("undefined"!=typeof XDomainRequest)return new Or;throw Error("Unsupported browser")},Rr.prototype.b=function(){return{}},Eu=Or.prototype,Eu.open=function(t,e,n){if(null!=n&&!n)throw Error("Only async requests are supported.");this.a.open(t,e)},Eu.send=function(t){if(t){if("string"!=typeof t)throw Error("Only string data is supported");this.a.send(t)}else this.a.send()},Eu.abort=function(){this.a.abort()},Eu.setRequestHeader=function(){},Eu.getResponseHeader=function(t){return"content-type"==t.toLowerCase()?this.a.contentType:""},Eu.bc=function(){this.status=200,this.responseText=this.a.responseText,Dr(this,4)},Eu.Bb=function(){this.status=500,this.responseText="",Dr(this,4)},Eu.fc=function(){this.Bb()},Eu.cc=function(){this.status=200,Dr(this,1)},Eu.getAllResponseHeaders=function(){return"content-type: "+this.a.contentType},Pr.prototype.a=null;var Cl=0;Pr.prototype.reset=function(t,e,n,r,i){"number"==typeof i||Cl++,r||ku(),delete this.a},Lr.prototype.toString=function(){return this.name};var Il=new Lr("SEVERE",1e3),Nl=new Lr("WARNING",900),kl=new Lr("CONFIG",700),Al=new Lr("FINE",500);xr.prototype.log=function(t,e,n){if(t.value>=Mr(this).value)for(u(e)&&(e=e()),t=new Pr(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var Rl={},Ol=null;d(Br,Ir),Br.prototype.a=function(){return new Vr(this.f)},Br.prototype.b=function(t){return function(){return t}}({}),d(Vr,Ft);var Dl=0;Eu=Vr.prototype,Eu.open=function(t,e){if(this.readyState!=Dl)throw this.abort(),Error("Error reopening a connection");this.h=t,this.c=e,this.readyState=1,jr(this)},Eu.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var e={headers:this.g,method:this.h,credentials:void 0,cache:void 0};t&&(e.body=t),this.i.fetch(new Request(this.c,e)).then(this.ec.bind(this),this.Cb.bind(this))},Eu.abort=function(){this.responseText="",this.g=new Headers,this.status=0,1<=this.readyState&&this.a&&4!=this.readyState&&(this.readyState=4,this.a=!1,jr(this)),this.readyState=Dl},Eu.ec=function(t){this.a&&(this.b||(this.b=t.headers,this.readyState=2,jr(this)),this.a&&(this.readyState=3,jr(this),this.a&&t.text().then(this.dc.bind(this,t),this.Cb.bind(this))))},Eu.dc=function(t,e){this.a&&(this.status=t.status,this.statusText=t.statusText,this.responseText=e,this.readyState=4,jr(this))},Eu.Cb=function(t){var e=this.f;e&&e.log(Nl,"Failed to fetch url "+this.c,t instanceof Error?t:Error(t)),this.a&&(this.readyState=4,jr(this))},Eu.setRequestHeader=function(t,e){this.g.append(t,e)},Eu.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.f)&&t.log(Nl,"Attempting to get response header but no headers have been received for url: "+this.c,void 0),"")},Eu.getAllResponseHeaders=function(){if(!this.b){var t=this.f;return t&&t.log(Nl,"Attempting to get all response headers but no headers have been received for url: "+this.c,void 0),""}t=[];for(var e=this.b.entries(),n=e.next();!n.done;)n=n.value,t.push(n[0]+": "+n[1]),n=e.next();return t.join("\r\n")},d(qr,Ft);var Pl="";qr.prototype.b=Fr("goog.net.XhrIo");var xl=/^https?$/i,Ll=["POST","PUT"];Eu=qr.prototype,Eu.Ga=function(){"undefined"!=typeof Su&&this.a&&(this.h="Timed out after "+this.g+"ms, aborting",Ur(this.b,ti(this,this.h)),this.dispatchEvent("timeout"),this.abort(8))},Eu.abort=function(){this.a&&this.c&&(Ur(this.b,ti(this,"Aborting")),this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.dispatchEvent("complete"),this.dispatchEvent("abort"),Yr(this))},Eu.ua=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),Yr(this,!0)),qr.lb.ua.call(this)},Eu.Fb=function(){this.pa||(this.I||this.i||this.f?zr(this):this.tc())},Eu.tc=function(){zr(this)},Eu.getResponse=function(){try{if(!this.a)return null;if("response"in this.a)return this.a.response;switch(this.o){case Pl:case"text":return this.a.responseText;case"arraybuffer":if("mozResponseArrayBuffer"in this.a)return this.a.mozResponseArrayBuffer}var t=this.b;return t&&t.log(Il,"Response type "+this.o+" is not supported on this browser",void 0),null}catch(t){return Ur(this.b,"Can not get response: "+t.message),null}},ei.prototype.cancel=function(t){if(this.a)this.c instanceof ei&&this.c.cancel();else{if(this.b){var e=this.b;delete this.b,t?e.cancel(t):0>=--e.m&&e.cancel()}this.v?this.v.call(this.u,this):this.l=!0,this.a||(t=new ci(this),ri(this),ni(this,!1,t))}},ei.prototype.o=function(t,e){this.i=!1,ni(this,t,e)},ei.prototype.C=function(){ri(this),ni(this,!0,null)},ei.prototype.then=function(t,e,n){var r,i,o=new G(function(t,e){r=t,i=e});return oi(this,r,function(t){t instanceof ci?o.cancel():i(t)}),o.then(t,e,n)},y(ei),d(ui,g),ui.prototype.message="Deferred has already fired",ui.prototype.name="AlreadyCalledError",d(ci,g),ci.prototype.message="Deferred was canceled",ci.prototype.name="CanceledError",li.prototype.c=function(){throw delete Ml[this.a],this.b};var Ml={},Fl=0,Ul=1;d(yi,g),d(mi,Ir),mi.prototype.a=function(){return new this.f},mi.prototype.b=function(){return{}};var Bl,Vl="idToken",jl=new gn(3e4,6e4),ql={"Content-Type":"application/x-www-form-urlencoded"},Wl=new gn(3e4,6e4),Kl={"Content-Type":"application/json"};gi.prototype.o=function(t,e,n,r,i,o){if(Je()&&("undefined"===typeof Cu.fetch||"undefined"===typeof Cu.Headers||"undefined"===typeof Cu.Request))throw new Rn("operation-not-supported-in-this-environment","fetch, Headers and Request native APIs or equivalent Polyfills must be available to support HTTP requests from a Worker environment.");var a=new qr(this.c);if(o){a.g=Math.max(0,o);var s=setTimeout(function(){a.dispatchEvent("timeout")},o)}Ut(a,"complete",function(){s&&clearTimeout(s);var t=null;try{t=JSON.parse(Zr(this))||null}catch(e){t=null}e&&e(t)}),Bt(a,"ready",function(){s&&clearTimeout(s),pt(this)}),Bt(a,"timeout",function(){s&&clearTimeout(s),pt(this),e&&e(null)}),Wr(a,t,n,r,i)};var Hl=ge("https://apis.google.com/js/client.js?onload=%{onload}"),Gl="__fcb"+Math.floor(1e6*Math.random()).toString();gi.prototype.l=function(t,e,n,r,i){var o=this;Bl.then(function(){window.gapi.client.setApiKey(o.b);var a=window.gapi.auth.getToken();window.gapi.auth.setToken(null),window.gapi.client.request({path:t,method:n,body:r,headers:i,authType:"none",callback:function(t){window.gapi.auth.setToken(a),e&&e(t)}})}).s(function(t){e&&e({error:{message:t&&t.message||"CORS_UNSUPPORTED"}})})},gi.prototype.Pa=function(){return Bi(this,ph,{})},gi.prototype.mb=function(t,e){return Bi(this,hh,{idToken:t,email:e})},gi.prototype.nb=function(t,e){return Bi(this,fh,{idToken:t,password:e})};var Ql={displayName:"DISPLAY_NAME",photoUrl:"PHOTO_URL"};Eu=gi.prototype,Eu.ob=function(t,e){var n={idToken:t},r=[];return F(Ql,function(t,i){var o=e[i];null===o?r.push(t):i in e&&(n[i]=o)}),r.length&&(n.deleteAttribute=r),Bi(this,hh,n)},Eu.hb=function(t,e){return t={requestType:"PASSWORD_RESET",email:t},V(t,e),Bi(this,ah,t)},Eu.ib=function(t,e){return t={requestType:"EMAIL_SIGNIN",email:t},V(t,e),Bi(this,ih,t)},Eu.gb=function(t,e){return t={requestType:"VERIFY_EMAIL",idToken:t},V(t,e),Bi(this,oh,t)},Eu.Ta=function(t){return Bi(this,bh,t)},Eu.Xa=function(t,e){return Bi(this,ch,{oobCode:t,newPassword:e})},Eu.Ja=function(t){return Bi(this,Xl,{oobCode:t})},Eu.Va=function(t){return Bi(this,Yl,{oobCode:t})};var zl,Yl={endpoint:"setAccountInfo",B:Ui,da:"email"},Xl={endpoint:"resetPassword",B:Ui,J:function(t){var e=t.requestType;if(!e||!t.email&&"EMAIL_SIGNIN"!=e)throw new Rn("internal-error")}},Jl={endpoint:"signupNewUser",B:function(t){if(Si(t),!t.password)throw new Rn("weak-password")},J:Ai,R:!0},$l={endpoint:"createAuthUri"},Zl={endpoint:"deleteAccount",T:["idToken"]},th={endpoint:"setAccountInfo",T:["idToken","deleteProvider"],B:function(t){if(!a(t.deleteProvider))throw new Rn("internal-error")}},eh={endpoint:"emailLinkSignin",T:["email","oobCode"],B:Si,J:Ai,R:!0},nh={endpoint:"emailLinkSignin",T:["idToken","email","oobCode"],B:Si,J:Ai,R:!0},rh={endpoint:"getAccountInfo"},ih={endpoint:"getOobConfirmationCode",T:["requestType"],B:function(t){if("EMAIL_SIGNIN"!=t.requestType)throw new Rn("internal-error");Si(t)},da:"email"},oh={endpoint:"getOobConfirmationCode",T:["idToken","requestType"],B:function(t){if("VERIFY_EMAIL"!=t.requestType)throw new Rn("internal-error")},da:"email"},ah={endpoint:"getOobConfirmationCode",T:["requestType"],B:function(t){if("PASSWORD_RESET"!=t.requestType)throw new Rn("internal-error");Si(t)},da:"email"},sh={rb:!0,endpoint:"getProjectConfig",Eb:"GET"},uh={rb:!0,endpoint:"getRecaptchaParam",Eb:"GET",J:function(t){if(!t.recaptchaSiteKey)throw new Rn("internal-error")}},ch={endpoint:"resetPassword",B:Ui,da:"email"},lh={endpoint:"sendVerificationCode",T:["phoneNumber","recaptchaToken"],da:"sessionInfo"},hh={endpoint:"setAccountInfo",T:["idToken"],B:Ci,R:!0},fh={endpoint:"setAccountInfo",T:["idToken"],B:function(t){if(Ci(t),!t.password)throw new Rn("weak-password")},J:Ai,R:!0},ph={endpoint:"signupNewUser",J:Ai,R:!0},dh={endpoint:"verifyAssertion",B:Pi,J:xi,R:!0},yh={endpoint:"verifyAssertion",B:Pi,J:function(t){if(t.errorMessage&&"USER_NOT_FOUND"==t.errorMessage)throw new Rn("user-not-found");if(t.errorMessage)throw Vi(t.errorMessage);if(!t[Vl])throw new Rn("internal-error")},R:!0},mh={endpoint:"verifyAssertion",B:function(t){if(Pi(t),!t.idToken)throw new Rn("internal-error")},J:xi,R:!0},gh={endpoint:"verifyCustomToken",B:function(t){if(!t.token)throw new Rn("invalid-custom-token")},J:Ai,R:!0},vh={endpoint:"verifyPassword",B:function(t){if(Si(t),!t.password)throw new Rn("wrong-password")},J:Ai,R:!0},bh={endpoint:"verifyPhoneNumber",B:Ri,J:Ai},_h={endpoint:"verifyPhoneNumber",B:function(t){if(!t.idToken)throw new Rn("internal-error");Ri(t)},J:function(t){if(t.temporaryProof)throw t.code="credential-already-in-use",Cr(t);Ai(t)}},wh={Tb:{USER_NOT_FOUND:"user-not-found"},endpoint:"verifyPhoneNumber",B:Ri,J:Ai},Eh={Yc:{Za:"https://www.googleapis.com/identitytoolkit/v3/relyingparty/",fb:"https://securetoken.googleapis.com/v1/token",id:"p"},$c:{Za:"https://staging-www.sandbox.googleapis.com/identitytoolkit/v3/relyingparty/",fb:"https://staging-securetoken.sandbox.googleapis.com/v1/token",id:"s"},ad:{Za:"https://www-googleapis-test.sandbox.google.com/identitytoolkit/v3/relyingparty/",fb:"https://test-securetoken.sandbox.googleapis.com/v1/token",id:"t"}};zl=qi("__EID__")?"__EID__":void 0;var Th=ge("https://apis.google.com/js/api.js?onload=%{onload}"),Sh=new gn(3e4,6e4),Ch=new gn(5e3,15e3),Ih=null;zi.prototype.toString=function(){return this.f?te(this.a,"v",this.f):le(this.a.a,"v"),this.b?te(this.a,"eid",this.b):le(this.a.a,"eid"),this.c.length?te(this.a,"fw",this.c.join(",")):le(this.a.a,"fw"),this.a.toString()},Yi.prototype.toString=function(){var t=re(this.o,"/__/auth/handler");if(te(t,"apiKey",this.l),te(t,"appName",this.c),te(t,"authType",this.m),this.a.isOAuthProvider){var e=this.a;try{var n=Tu.app(this.c).auth().ea()}catch(t){n=null}e.Ya=n,te(t,"providerId",this.a.providerId),e=this.a,n=fn(e.vb);for(var r in n)n[r]=n[r].toString();r=e.Ac,n=B(n);for(var i=0;i<r.length;i++){var o=r[i];o in n&&delete n[o]}e.$a&&e.Ya&&!n[e.$a]&&(n[e.$a]=e.Ya),U(n)||te(t,"customParameters",hn(n))}if("function"===typeof this.a.Ab&&(e=this.a.Ab(),e.length&&te(t,"scopes",e.join(","))),this.i?te(t,"redirectUrl",this.i):le(t.a,"redirectUrl"),this.g?te(t,"eventId",this.g):le(t.a,"eventId"),this.h?te(t,"v",this.h):le(t.a,"v"),this.b)for(var a in this.b)this.b.hasOwnProperty(a)&&!ee(t,a)&&te(t,a,this.b[a]);return this.f?te(t,"eid",this.f):le(t.a,"eid"),a=Xi(this.c),a.length&&te(t,"fw",a.join(",")),t.toString()},Eu=Ji.prototype,Eu.Ea=function(t,e,n){var r=new Rn("popup-closed-by-user"),i=new Rn("web-storage-unsupported"),o=this,a=!1;return this.ga().then(function(){ro(o).then(function(n){n||(t&&Ke(t),e(i),a=!0)})}).s(function(){}).then(function(){if(!a)return Ge(t)}).then(function(){if(!a)return qt(n).then(function(){e(r)})})},Eu.Ib=function(){var t=rn();return!ln(t)&&!yn(t)},Eu.Db=function(){return!1},Eu.zb=function(t,e,n,r,i,o,a){if(!t)return X(new Rn("popup-blocked"));if(a&&!ln())return this.ga().s(function(e){Ke(t),i(e)}),r(),Y();this.a||(this.a=$i(to(this)));var s=this;return this.a.then(function(){var e=s.ga().s(function(e){throw Ke(t),i(e),e});return r(),e}).then(function(){if(br(n),!a){Ve(eo(s.l,s.f,s.b,e,n,null,o,s.c,void 0,s.h),t)}}).s(function(t){throw"auth/network-request-failed"==t.code&&(s.a=null),t})},Eu.Ca=function(t,e,n){this.a||(this.a=$i(to(this)));var r=this;return this.a.then(function(){br(e),Ve(eo(r.l,r.f,r.b,t,e,Be(),n,r.c,void 0,r.h))}).s(function(t){throw"auth/network-request-failed"==t.code&&(r.a=null),t})},Eu.ga=function(){var t=this;return Zi(this).then(function(){return t.i.bb}).s(function(){throw t.a=null,new Rn("network-request-failed")})},Eu.Mb=function(){return!0},Eu.va=function(t){this.g.push(t)},Eu.Ka=function(t){A(this.g,function(e){return e==t})},Eu=io.prototype,Eu.get=function(t){return Y(this.a.getItem(t)).then(function(t){return t&&pn(t)})},Eu.set=function(t,e){return Y(this.a.setItem(t,hn(e)))},Eu.P=function(t){return Y(this.a.removeItem(t))},Eu.Y=function(){},Eu.ca=function(){};var Nh;Eu=oo.prototype,Eu.set=function(t,e){var n,r=!1,i=this;return uo(this).then(function(e){return n=e,e=lo(ho(n,!0)),fo(e.get(t))}).then(function(o){var a=lo(ho(n,!0));return o?(o.value=e,fo(a.put(o))):(i.b++,r=!0,o={},o.fbase_key=t,o.value=e,fo(a.add(o)))}).then(function(){i.f[t]=e}).ia(function(){r&&i.b--})},Eu.get=function(t){return uo(this).then(function(e){return fo(lo(ho(e,!1)).get(t))}).then(function(t){return t&&t.value})},Eu.P=function(t){var e=!1,n=this;return uo(this).then(function(r){return e=!0,n.b++,fo(lo(ho(r,!0)).delete(t))}).then(function(){delete n.f[t]}).ia(function(){e&&n.b--})},Eu.Kc=function(){var t=this;return uo(this).then(function(t){var e=lo(ho(t,!1));return e.getAll?fo(e.getAll()):new G(function(t,n){var r=[],i=e.openCursor();i.onsuccess=function(e){(e=e.target.result)?(r.push(e.value),e.continue()):t(r)},i.onerror=function(t){n(Error(t.target.errorCode))}})}).then(function(e){var n={},r=[];if(0==t.b){for(r=0;r<e.length;r++)n[e[r].fbase_key]=e[r].value;r=je(t.f,n),t.f=n}return r})},Eu.Y=function(t){0==this.a.length&&po(this),this.a.push(t)},Eu.ca=function(t){A(this.a,function(e){return e==t}),0==this.a.length&&this.c&&this.c.cancel("STOP_EVENT")},Eu=yo.prototype,Eu.get=function(t){return this.b.then(function(e){return e.get(t)})},Eu.set=function(t,e){return this.b.then(function(n){return n.set(t,e)})},Eu.P=function(t){return this.b.then(function(e){return e.P(t)})},Eu.Y=function(t){this.a.push(t)},Eu.ca=function(t){A(this.a,function(e){return e==t})},Eu=mo.prototype,Eu.get=function(t){return Y(this.a[t])},Eu.set=function(t,e){return this.a[t]=e,Y()},Eu.P=function(t){return delete this.a[t],Y()},Eu.Y=function(){},Eu.ca=function(){},Eu=go.prototype,Eu.get=function(t){var e=this;return Y().then(function(){return pn(e.a.getItem(t))})},Eu.set=function(t,e){var n=this;return Y().then(function(){var r=hn(e);null===r?n.P(t):n.a.setItem(t,r)})},Eu.P=function(t){var e=this;return Y().then(function(){e.a.removeItem(t)})},Eu.Y=function(t){Cu.window&&Ct(Cu.window,"storage",t)},Eu.ca=function(t){Cu.window&&At(Cu.window,"storage",t)},Eu=_o.prototype,Eu.get=function(){return Y(null)},Eu.set=function(){return Y()},Eu.P=function(){return Y()},Eu.Y=function(){},Eu.ca=function(){},Eu=wo.prototype,Eu.get=function(t){var e=this;return Y().then(function(){return pn(e.a.getItem(t))})},Eu.set=function(t,e){var n=this;return Y().then(function(){var r=hn(e);null===r?n.P(t):n.a.setItem(t,r)})},Eu.P=function(t){var e=this;return Y().then(function(){e.a.removeItem(t)})},Eu.Y=function(){},Eu.ca=function(){};var kh,Ah,Rh={A:go,Qa:wo},Oh={A:go,Qa:wo},Dh={A:io,Qa:_o},Ph={A:go,Qa:_o},xh={Xc:"local",NONE:"none",Zc:"session"};Eu=Io.prototype,Eu.get=function(t,e){return ko(this,t.A).get(Ao(t,e))},Eu.set=function(t,e,n){var r=Ao(t,n),i=this,o=ko(this,t.A);return o.set(r,e).then(function(){return o.get(r)}).then(function(e){"local"==t.A&&(i.b[r]=e)})},Eu.addListener=function(t,e,n){t=Ao(t,e),this.m&&(this.b[t]=Cu.localStorage.getItem(t)),U(this.a)&&(ko(this,"local").Y(this.f),this.h||(Ue()||!wn())&&Cu.indexedDB||!this.m||Do(this)),this.a[t]||(this.a[t]=[]),this.a[t].push(n)},Eu.removeListener=function(t,e,n){t=Ao(t,e),this.a[t]&&(A(this.a[t],function(t){return t==n}),0==this.a[t].length&&delete this.a[t]),U(this.a)&&(ko(this,"local").ca(this.f),Po(this))},Eu.Lb=function(t){if(t&&t.f){var e=t.a.key;if(null==e)for(var n in this.a){var r=this.b[n];"undefined"===typeof r&&(r=null);var i=Cu.localStorage.getItem(n);i!==r&&(this.b[n]=i,this.Wa(n))}else if(0==e.indexOf("firebase:")&&this.a[e]){if("undefined"!==typeof t.a.a?ko(this,"local").ca(this.f):Po(this),this.o)if(n=Cu.localStorage.getItem(e),(r=t.a.newValue)!==n)null!==r?Cu.localStorage.setItem(e,r):Cu.localStorage.removeItem(e);else if(this.b[e]===r&&"undefined"===typeof t.a.a)return;var o=this;n=function(){"undefined"===typeof t.a.a&&o.b[e]===Cu.localStorage.getItem(e)||(o.b[e]=Cu.localStorage.getItem(e),o.Wa(e))},oc&&pc&&10==pc&&Cu.localStorage.getItem(e)!==t.a.newValue&&t.a.newValue!==t.a.oldValue?setTimeout(n,10):n()}}else Du(t,f(this.Wa,this))},Eu.Wa=function(t){this.a[t]&&Du(this.a[t],function(t){t()})};var Lh,Mh={name:"authEvent",A:"local"};d(Uo,Fo);for(var Fh=64,Uh=Fh-1,Bh=[],Vh=0;Vh<Uh;Vh++)Bh[Vh]=0;var jh=R(128,Bh);Uo.prototype.reset=function(){this.g=this.c=0,this.a=Cu.Int32Array?new Int32Array(this.h):O(this.h)};var qh=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298];d(jo,Uo);var Wh=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];Eu=qo.prototype,Eu.ga=function(){return this.za?this.za:this.za=ze().then(function(){if("function"!==typeof on("universalLinks.subscribe",Cu))throw Wo("cordova-universal-links-plugin is not installed");if("undefined"===typeof on("BuildInfo.packageName",Cu))throw Wo("cordova-plugin-buildinfo is not installed");if("function"!==typeof on("cordova.plugins.browsertab.openUrl",Cu))throw Wo("cordova-plugin-browsertab is not installed");if("function"!==typeof on("cordova.InAppBrowser.open",Cu))throw Wo("cordova-plugin-inappbrowser is not installed")},function(){throw new Rn("cordova-not-ready")})},Eu.Ea=function(t,e){return e(new Rn("operation-not-supported-in-this-environment")),Y()},Eu.zb=function(){return X(new Rn("operation-not-supported-in-this-environment"))},Eu.Mb=function(){return!1},Eu.Ib=function(){return!0},Eu.Db=function(){return!0},Eu.Ca=function(t,e,n){if(this.c)return X(new Rn("redirect-operation-pending"));var r=this,i=Cu.document,o=null,a=null,s=null,u=null;return this.c=Y().then(function(){return br(e),zo(r)}).then(function(){return Go(r,t,e,n)}).then(function(){return new G(function(t,e){a=function(){var e=on("cordova.plugins.browsertab.close",Cu);return t(),"function"===typeof e&&e(),r.a&&"function"===typeof r.a.close&&(r.a.close(),r.a=null),!1},r.va(a),s=function(){o||(o=qt(2e3).then(function(){e(new Rn("redirect-cancelled-by-user"))}))},u=function(){vn()&&s()},i.addEventListener("resume",s,!1),rn().toLowerCase().match(/android/)||i.addEventListener("visibilitychange",u,!1)}).s(function(t){return Yo(r).then(function(){throw t})})}).ia(function(){s&&i.removeEventListener("resume",s,!1),u&&i.removeEventListener("visibilitychange",u,!1),o&&o.cancel(),a&&r.Ka(a),r.c=null})},Eu.va=function(t){this.b.push(t),zo(this).s(function(e){"auth/invalid-cordova-configuration"===e.code&&(e=new _r("unknown",null,null,null,new Rn("no-auth-event")),t(e))})},Eu.Ka=function(t){A(this.b,function(e){return e==t})};var Kh={name:"pendingRedirect",A:"session"};ea.prototype.reset=function(){this.f=!1,this.a.Ka(this.i),this.a=na(this.v,this.m,this.l)},ea.prototype.subscribe=function(t){if(N(this.h,t)||this.h.push(t),!this.f){var e=this;ta(this.g).then(function(t){t?Zo(e.g).then(function(){ra(e).s(function(t){var n=new _r("unknown",null,null,null,new Rn("operation-not-supported-in-this-environment"));aa(t)&&e.o(n)})}):ia(e)}).s(function(){ia(e)})}},ea.prototype.unsubscribe=function(t){A(this.h,function(e){return e==t})},ea.prototype.o=function(t){if(!t)throw new Rn("invalid-auth-event");for(var e=!1,n=0;n<this.h.length;n++){var r=this.h[n];if(r.sb(t.b,t.c)){(e=this.b[t.b])&&e.h(t,r),e=!0;break}}return ca(this.c),e};var Hh=new gn(2e3,1e4),Gh=new gn(3e4,6e4);ea.prototype.fa=function(){return this.c.fa()},ea.prototype.Ca=function(t,e,n){var r,i=this;return $o(this.g).then(function(){return i.a.Ca(t,e,n).s(function(t){if(aa(t))throw new Rn("operation-not-supported-in-this-environment");return r=t,Zo(i.g).then(function(){throw r})}).then(function(){return i.a.Mb()?new G(function(){}):Zo(i.g).then(function(){return i.fa()}).then(function(){}).s(function(){})})})},ea.prototype.Ea=function(t,e,n,r){return this.a.Ea(n,function(n){t.ha(e,null,n,r)},Hh.get())};var Qh={};ua.prototype.reset=function(){this.b=null,this.a&&(this.a.cancel(),this.a=null)},ua.prototype.h=function(t,e){if(t){this.reset(),this.g=!0;var n=t.b,r=t.c,i=t.a&&"auth/web-storage-unsupported"==t.a.code,o=t.a&&"auth/operation-not-supported-in-this-environment"==t.a.code;"unknown"!=n||i||o?t.a?(pa(this,!0,null,t.a),Y()):e.wa(n,r)?la(this,t,e):X(new Rn("invalid-auth-event")):(pa(this,!1,null,null),Y())}else X(new Rn("invalid-auth-event"))},ua.prototype.fa=function(){var t=this;return new G(function(e,n){t.b?t.b().then(e,n):(t.f.push(e),t.c.push(n),da(t))})},ya.prototype.h=function(t,e){if(t){var n=t.b,r=t.c;t.a?(e.ha(t.b,null,t.a,t.c),Y()):e.wa(n,r)?ma(t,e):X(new Rn("invalid-auth-event"))}else X(new Rn("invalid-auth-event"))},va.prototype.confirm=function(t){return t=gr(this.verificationId,t),this.a(t)},wa.prototype.start=function(){this.a=this.c,Ta(this,!0)},wa.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},Sa.prototype.D=function(){return{apiKey:this.f.b,refreshToken:this.a,accessToken:this.b,expirationTime:this.c}},Sa.prototype.getToken=function(t){return t=!!t,this.b&&!this.a?X(new Rn("user-token-expired")):t||!this.b||ku()>this.c-3e4?this.a?ka(this,{grant_type:"refresh_token",refresh_token:this.a}):Y(null):Y({accessToken:this.b,expirationTime:this.c,refreshToken:this.a})},Aa.prototype.D=function(){return{lastLoginAt:this.b,createdAt:this.a}},d(Da,vt),d(Pa,Ft),Pa.prototype.oa=function(t){this.ka=t,vi(this.b,t)},Pa.prototype.ea=function(){return this.ka},Pa.prototype.xa=function(){return O(this.O)},Pa.prototype.Ha=function(){this.w.b&&(this.w.stop(),this.w.start())},Tn(Pa.prototype,"providerId","firebase"),Eu=Pa.prototype,Eu.reload=function(){var t=this;return cs(this,Qa(this).then(function(){return Za(t).then(function(){return Wa(t)}).then(Ga)}))},Eu.ac=function(t){return this.F(t).then(function(t){return new _a(t)})},Eu.F=function(t){var e=this;return cs(this,Qa(this).then(function(){return e.h.getToken(t)}).then(function(t){if(!t)throw new Rn("internal-error");return t.accessToken!=e.qa&&(ja(e,t.accessToken),e.dispatchEvent(new Da("tokenChanged"))),Ja(e,"refreshToken",t.refreshToken),t.accessToken}))},Eu.uc=function(t){if(!(t=t.users)||!t.length)throw new Rn("internal-error");t=t[0],Ha(this,{uid:t.localId,displayName:t.displayName,photoURL:t.photoUrl,email:t.email,emailVerified:!!t.emailVerified,phoneNumber:t.phoneNumber,lastLoginAt:t.lastLoginAt,createdAt:t.createdAt});for(var e=ns(t),n=0;n<e.length;n++)Ya(this,e[n]);Ja(this,"isAnonymous",!(this.email&&t.passwordHash)&&!(this.providerData&&this.providerData.length))},Eu.cb=function(t){var e=this,n=null;return cs(this,t.f(this.b,this.uid).then(function(t){return ts(e,t),n=is(e,t,"reauthenticate"),e.i=null,e.reload()}).then(function(){return n}),!0)},Eu.vc=function(t){return En("firebase.User.prototype.reauthenticateWithCredential is deprecated. Please use firebase.User.prototype.reauthenticateAndRetrieveDataWithCredential instead."),this.cb(t).then(function(){})},Eu.ab=function(t){var e=this,n=null;return cs(this,rs(this,t.providerId).then(function(){return e.F()}).then(function(n){return t.c(e.b,n)}).then(function(t){return n=is(e,t,"link"),os(e,t)}).then(function(){return n}))},Eu.mc=function(t){return En("firebase.User.prototype.linkWithCredential is deprecated. Please use firebase.User.prototype.linkAndRetrieveDataWithCredential instead."),this.ab(t).then(function(t){return t.user})},Eu.nc=function(t,e){var n=this;return cs(this,rs(this,"phone").then(function(){return ba(Fa(n),t,e,f(n.ab,n))}))},Eu.wc=function(t,e){var n=this;return cs(this,Y().then(function(){return ba(Fa(n),t,e,f(n.cb,n))}),!0)},Eu.mb=function(t){var e=this;return cs(this,this.F().then(function(n){return e.b.mb(n,t)}).then(function(t){return ts(e,t),e.reload()}))},Eu.Pc=function(t){var e=this;return cs(this,this.F().then(function(n){return t.c(e.b,n)}).then(function(t){return ts(e,t),e.reload()}))},Eu.nb=function(t){var e=this;return cs(this,this.F().then(function(n){return e.b.nb(n,t)}).then(function(t){return ts(e,t),e.reload()}))},Eu.ob=function(t){if(void 0===t.displayName&&void 0===t.photoURL)return Qa(this);var e=this;return cs(this,this.F().then(function(n){return e.b.ob(n,{displayName:t.displayName,photoUrl:t.photoURL})}).then(function(t){return ts(e,t),Ja(e,"displayName",t.displayName||null),Ja(e,"photoURL",t.photoUrl||null),Du(e.providerData,function(t){"password"===t.providerId&&(Tn(t,"displayName",e.displayName),Tn(t,"photoURL",e.photoURL))}),Wa(e)}).then(Ga))},Eu.Nc=function(t){var e=this;return cs(this,Za(this).then(function(n){return N(za(e),t)?Di(e.b,n,[t]).then(function(t){var n={};return Du(t.providerUserInfo||[],function(t){n[t.providerId]=!0}),Du(za(e),function(t){n[t]||Xa(e,t)}),n[mr.PROVIDER_ID]||Tn(e,"phoneNumber",null),Wa(e)}):Wa(e).then(function(){throw new Rn("no-such-provider")})}))},Eu.delete=function(){var t=this;return cs(this,this.F().then(function(e){return Bi(t.b,Zl,{idToken:e})}).then(function(){t.dispatchEvent(new Da("userDeleted"))})).then(function(){for(var e=0;e<t.G.length;e++)t.G[e].cancel("app-deleted");xa(t,null),Ma(t,null),t.G=[],t.C=!0,Va(t),Tn(t,"refreshToken",null),t.a&&t.a.unsubscribe(t)})},Eu.sb=function(t,e){return!!("linkViaPopup"==t&&(this.g||null)==e&&this.f||"reauthViaPopup"==t&&(this.g||null)==e&&this.f||"linkViaRedirect"==t&&(this.aa||null)==e||"reauthViaRedirect"==t&&(this.aa||null)==e)},Eu.ha=function(t,e,n,r){"linkViaPopup"!=t&&"reauthViaPopup"!=t||r!=(this.g||null)||(n&&this.v?this.v(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.v)},Eu.wa=function(t,e){return"linkViaPopup"==t&&e==(this.g||null)?f(this.xb,this):"reauthViaPopup"==t&&e==(this.g||null)?f(this.yb,this):"linkViaRedirect"==t&&(this.aa||null)==e?f(this.xb,this):"reauthViaRedirect"==t&&(this.aa||null)==e?f(this.yb,this):null},Eu.oc=function(t){var e=this;return as(this,"linkViaPopup",t,function(){return rs(e,t.providerId).then(function(){return Wa(e)})},!1)},Eu.xc=function(t){return as(this,"reauthViaPopup",t,function(){return Y()},!0)},Eu.pc=function(t){var e=this;return ss(this,"linkViaRedirect",t,function(){return rs(e,t.providerId)},!1)},Eu.yc=function(t){return ss(this,"reauthViaRedirect",t,function(){return Y()},!0)},Eu.xb=function(t,e){var n=this;this.c&&(this.c.cancel(),this.c=null);var r=null;return cs(this,this.F().then(function(r){return Mi(n.b,{requestUri:t,sessionId:e,idToken:r})}).then(function(t){return r=is(n,t,"link"),os(n,t)}).then(function(){return r}))},Eu.yb=function(t,e){var n=this;this.c&&(this.c.cancel(),this.c=null);var r=null;return cs(this,Y().then(function(){return Jn(Fi(n.b,{requestUri:t,sessionId:e}),n.uid)}).then(function(t){return r=is(n,t,"reauthenticate"),ts(n,t),n.i=null,n.reload()}).then(function(){return r}),!0)},Eu.gb=function(t){var e=this,n=null;return cs(this,this.F().then(function(e){return n=e,"undefined"===typeof t||U(t)?{}:Pn(new Dn(t))}).then(function(t){return e.b.gb(n,t)}).then(function(t){if(e.email!=t)return e.reload()}).then(function(){}))},Eu.toJSON=function(){return this.D()},Eu.D=function(){var t={uid:this.uid,displayName:this.displayName,photoURL:this.photoURL,email:this.email,emailVerified:this.emailVerified,phoneNumber:this.phoneNumber,isAnonymous:this.isAnonymous,providerData:[],apiKey:this.l,appName:this.o,authDomain:this.u,stsTokenManager:this.h.D(),redirectEventId:this.aa||null};return this.metadata&&V(t,this.metadata.D()),Du(this.providerData,function(e){t.providerData.push(In(e))}),t};var zh={name:"redirectUser",A:"session"};gs.prototype.g=function(){var t=this,e=_s("local");Cs(this,function(){return Y().then(function(){return t.c&&"local"!=t.c.A?t.b.get(e,t.a):null}).then(function(n){if(n)return vs(t,"local").then(function(){t.c=e})})})};var Yh={name:"persistence",A:"session"};gs.prototype.jb=function(t){var e=null,n=this;return Co(t),Cs(this,function(){return t!=n.c.A?n.b.get(n.c,n.a).then(function(r){return e=r,vs(n,t)}).then(function(){if(n.c=_s(t),e)return n.b.set(n.c,e,n.a)}):Y()})},d(Is,Ft),d(Ns,vt),d(ks,vt),Eu=Is.prototype,Eu.jb=function(t){return t=this.h.jb(t),Ws(this,t)},Eu.oa=function(t){this.W===t||this.l||(this.W=t,vi(this.b,this.W),this.dispatchEvent(new Ns(this.ea())))},Eu.ea=function(){return this.W},Eu.Qc=function(){var t=Cu.navigator;this.oa(t?t.languages&&t.languages[0]||t.language||t.userLanguage||null:null)},Eu.qc=function(t){this.G.push(t),bi(this.b,Tu.SDK_VERSION?nn(Tu.SDK_VERSION,this.G):null),this.dispatchEvent(new ks(this.G))},Eu.xa=function(){return O(this.G)},Eu.toJSON=function(){return{apiKey:Us(this).options.apiKey,authDomain:Us(this).options.authDomain,appName:Us(this).name,currentUser:Bs(this)&&Bs(this).D()}},Eu.sb=function(t,e){switch(t){case"unknown":case"signInViaRedirect":return!0;case"signInViaPopup":return this.g==e&&!!this.f;default:return!1}},Eu.ha=function(t,e,n,r){"signInViaPopup"==t&&this.g==r&&(n&&this.v?this.v(n):e&&!n&&this.f&&this.f(e),this.c&&(this.c.cancel(),this.c=null),delete this.f,delete this.v)},Eu.wa=function(t,e){return"signInViaRedirect"==t||"signInViaPopup"==t&&this.g==e&&this.f?f(this.Xb,this):null},Eu.Xb=function(t,e){var n=this;t={requestUri:t,sessionId:e},this.c&&(this.c.cancel(),this.c=null);var r=null,i=null,o=Li(n.b,t).then(function(t){return r=vr(t),i=qn(t),t});return t=n.V.then(function(){return o}).then(function(t){return Ds(n,t)}).then(function(){return Cn({user:Bs(n),credential:r,additionalUserInfo:i,operationType:"signIn"})}),Ws(this,t)},Eu.Hc=function(t){if(!sn())return X(new Rn("operation-not-supported-in-this-environment"));var e=this,n=jn(t.providerId),r=dn(),i=null;(!ln()||Xe())&&Us(this).options.authDomain&&t.isOAuthProvider&&(i=eo(Us(this).options.authDomain,Us(this).options.apiKey,Us(this).name,"signInViaPopup",t,null,r,Tu.SDK_VERSION||null));var o=He(i,n&&n.Ba,n&&n.Aa);return n=Rs(this).then(function(e){return oa(e,o,"signInViaPopup",t,r,!!i)}).then(function(){return new G(function(t,n){e.ha("signInViaPopup",null,new Rn("cancelled-popup-request"),e.g),e.f=t,e.v=n,e.g=r,e.c=e.a.Ea(e,"signInViaPopup",o,r)})}).then(function(t){return o&&Ke(o),t?Cn(t):null}).s(function(t){throw o&&Ke(o),t}),Ws(this,n)},Eu.Ic=function(t){if(!sn())return X(new Rn("operation-not-supported-in-this-environment"));var e=this;return Ws(this,Rs(this).then(function(){return ws(e.h)}).then(function(){return e.a.Ca("signInViaRedirect",t)}))},Eu.fa=function(){if(!sn())return X(new Rn("operation-not-supported-in-this-environment"));var t=this;return Ws(this,Rs(this).then(function(){return t.a.fa()}).then(function(t){return t?Cn(t):null}))},Eu.Oc=function(t){if(!t)return X(new Rn("null-user"));var e=this,n={};n.apiKey=Us(this).options.apiKey,n.authDomain=Us(this).options.authDomain,n.appName=Us(this).name;var r=ps(t,n,e.w,e.xa());return Ws(this,this.i.then(function(){if(Us(e).options.apiKey!=t.l)return r.reload()}).then(function(){return Bs(e)&&t.uid==Bs(e).uid?($a(Bs(e),t),e.Z(t)):(Ps(e,r),Ka(r),e.Z(r))}).then(function(){js(e)}))},Eu.kb=function(){var t=this;return Ws(this,this.i.then(function(){return Bs(t)?(Ps(t,null),Ts(t.h).then(function(){js(t)})):Y()}))},Eu.Jc=function(){var t=this;return Ss(this.h,Us(this).options.authDomain).then(function(e){if(!t.l){var n;if(n=Bs(t)&&e){n=Bs(t).uid;var r=e.uid;n=void 0!==n&&null!==n&&""!==n&&void 0!==r&&null!==r&&""!==r&&n==r}if(n)return $a(Bs(t),e),Bs(t).F();(Bs(t)||e)&&(Ps(t,e),e&&(Ka(e),e.ba=t.w),t.a&&t.a.subscribe(t),js(t))}})},Eu.Z=function(t){return Es(this.h,t)},Eu.Yb=function(){js(this),this.Z(Bs(this))},Eu.gc=function(){this.kb()},Eu.hc=function(){this.kb()},Eu.ic=function(t){var e=this;this.addAuthTokenListener(function(){t.next(Bs(e))})},Eu.jc=function(t){var e=this;qs(this,function(){t.next(Bs(e))})},Eu.sc=function(t,e,n){var r=this;return this.X&&Tu.Promise.resolve().then(function(){u(t)?t(Bs(r)):u(t.next)&&t.next(Bs(r))}),this.Pb(t,e,n)},Eu.rc=function(t,e,n){var r=this;return this.X&&Tu.Promise.resolve().then(function(){r.O=r.getUid(),u(t)?t(Bs(r)):u(t.next)&&t.next(Bs(r))}),this.Qb(t,e,n)},Eu.$b=function(t){var e=this;return Ws(this,this.i.then(function(){return Bs(e)?Bs(e).F(t).then(function(t){return{accessToken:t}}):null}))},Eu.Jb=function(t){var e=this;return this.i.then(function(){return Fs(e,Bi(e.b,gh,{token:t}))}).then(function(t){var n=t.user;return Ja(n,"isAnonymous",!1),e.Z(n),t})},Eu.Bc=function(t){return En("firebase.auth.Auth.prototype.signInAndRetrieveDataWithCustomToken is deprecated. Please use firebase.auth.Auth.prototype.signInWithCustomToken instead."),this.Jb(t)},Eu.Cc=function(t,e){return En("firebase.auth.Auth.prototype.signInAndRetrieveDataWithEmailAndPassword is deprecated. Please use firebase.auth.Auth.prototype.signInWithEmailAndPassword instead."),this.Kb(t,e)},Eu.Kb=function(t,e){var n=this;return this.i.then(function(){return Fs(n,Bi(n.b,vh,{email:t,password:e}))})},Eu.ub=function(t,e){var n=this;return this.i.then(function(){return Fs(n,Bi(n.b,Jl,{email:t,password:e}))})},Eu.Sb=function(t,e){return En("firebase.auth.Auth.prototype.createUserAndRetrieveDataWithEmailAndPassword is deprecated. Please use firebase.auth.Auth.prototype.createUserWithEmailAndPassword instead."),this.ub(t,e)},Eu.Ec=function(t){return En("firebase.auth.Auth.prototype.signInWithCredential is deprecated. Please use firebase.auth.Auth.prototype.signInAndRetrieveDataWithCredential instead."),this.Oa(t).then(function(t){return t.user})},Eu.Oa=function(t){var e=this;return this.i.then(function(){return Fs(e,t.ya(e.b))})},Eu.Pa=function(){var t=this;return this.i.then(function(){var e=Bs(t);if(e&&e.isAnonymous){return Cn({user:e,credential:null,additionalUserInfo:Cn({providerId:null,isNewUser:!1}),operationType:"signIn"})}return Fs(t,t.b.Pa()).then(function(e){var n=e.user;return Ja(n,"isAnonymous",!0),t.Z(n),e})})},Eu.Dc=function(){return En("firebase.auth.Auth.prototype.signInAnonymouslyAndRetrieveData is deprecated. Please use firebase.auth.Auth.prototype.signInAnonymously instead."),this.Pa()},Eu.getUid=function(){return Bs(this)&&Bs(this).uid||null},Eu.Rb=function(t){this.addAuthTokenListener(t),0<++this.u&&Bs(this)&&Ba(Bs(this))},Eu.zc=function(t){var e=this;Du(this.o,function(n){n==t&&e.u--}),0>this.u&&(this.u=0),0==this.u&&Bs(this)&&Va(Bs(this)),this.removeAuthTokenListener(t)},Eu.addAuthTokenListener=function(t){var e=this;this.o.push(t),Ws(this,this.i.then(function(){e.l||N(e.o,t)&&t(Vs(e))}))},Eu.removeAuthTokenListener=function(t){A(this.o,function(e){return e==t})},Eu.delete=function(){this.l=!0;for(var t=0;t<this.N.length;t++)this.N[t].cancel("app-deleted");return this.N=[],this.h&&(t=this.h,t.b.removeListener(_s("local"),t.a,this.ka)),this.a&&this.a.unsubscribe(this),Tu.Promise.resolve()},Eu.Vb=function(t){return En("firebase.auth.Auth.prototype.fetchProvidersForEmail is deprecated. Please use firebase.auth.Auth.prototype.fetchSignInMethodsForEmail instead."),Ws(this,Ii(this.b,t))},Eu.Wb=function(t){return Ws(this,Ni(this.b,t))},Eu.kc=function(t){return!!pr(t)},Eu.ib=function(t,e){var n=this;return Ws(this,Y().then(function(){var t=new Dn(e);if(!t.c)throw new Rn("argument-error",ul+" must be true when sending sign in link to email");return Pn(t)}).then(function(e){return n.b.ib(t,e)}).then(function(){}))},Eu.Rc=function(t){return this.Ja(t).then(function(t){return t.data.email})},Eu.Xa=function(t,e){return Ws(this,this.b.Xa(t,e).then(function(){}))},Eu.Ja=function(t){return Ws(this,this.b.Ja(t).then(function(t){return new An(t)}))},Eu.Va=function(t){return Ws(this,this.b.Va(t).then(function(){}))},Eu.hb=function(t,e){var n=this;return Ws(this,Y().then(function(){return"undefined"===typeof e||U(e)?{}:Pn(new Dn(e))}).then(function(e){return n.b.hb(t,e)}).then(function(){}))},Eu.Gc=function(t,e){return Ws(this,ba(this,t,e,f(this.Oa,this)))},Eu.Fc=function(t,e){var n=this;return Ws(this,Y().then(function(){var r=fr(t,e||Be());return n.Oa(r)}))},Ks.prototype.render=function(){},Ks.prototype.reset=function(){},Ks.prototype.getResponse=function(){},Ks.prototype.execute=function(){};var Xh=null;Hs.prototype.render=function(t,e){return this.a[this.b.toString()]=new zs(t,e),this.b++},Hs.prototype.reset=function(t){var e=Gs(this,t);t=Qs(t),e&&t&&(e.delete(),delete this.a[t])},Hs.prototype.getResponse=function(t){return(t=Gs(this,t))?t.getResponse():null},Hs.prototype.execute=function(t){(t=Gs(this,t))&&t.execute()},zs.prototype.getResponse=function(){return Ys(this),this.b},zs.prototype.execute=function(){Ys(this);var t=this;this.a||(this.a=setTimeout(function(){t.b=tn();var e=t.c.callback,n=t.c["expired-callback"];if(e)try{e(t.b)}catch(t){}t.a=setTimeout(function(){if(t.a=null,t.b=null,n)try{n()}catch(t){}t.h&&t.execute()},6e4)},500))},zs.prototype.delete=function(){Ys(this),this.g=!0,clearTimeout(this.a),this.a=null,At(this.f,"click",this.i)},Xs.prototype.g=function(){return Xh||(Xh=new Hs),Y(Xh)},Xs.prototype.c=function(){};var Jh=null,$h=ge("https://www.google.com/recaptcha/api.js?onload=%{onload}&render=explicit&hl=%{hl}"),Zh=new gn(3e4,6e4);Js.prototype.g=function(t){var e=this;return new G(function(n,r){var i=setTimeout(function(){r(new Rn("network-request-failed"))},Zh.get());if(!Cu.grecaptcha||t!==e.f&&!e.b){Cu[e.a]=function(){if(Cu.grecaptcha){e.f=t;var o=Cu.grecaptcha.render;Cu.grecaptcha.render=function(t,n){return t=o(t,n),e.b++,t},clearTimeout(i),n(Cu.grecaptcha)}else clearTimeout(i),r(new Rn("internal-error"));delete Cu[e.a]};Y(hi(_e($h,{onload:e.a,hl:t||""}))).s(function(){clearTimeout(i),r(new Rn("internal-error","Unable to load external reCAPTCHA dependencies!"))})}else clearTimeout(i),n(Cu.grecaptcha)})},Js.prototype.c=function(){this.b--};var tf=null,ef="callback",nf="expired-callback",rf="sitekey",of="size";Eu=$s.prototype,Eu.za=function(){var t=this;return this.f?this.f:this.f=eu(this,Y().then(function(){if(un()&&!Je())return Qe();throw new Rn("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")}).then(function(){return t.o.g(t.v())}).then(function(e){return t.g=e,Bi(t.u,uh,{})}).then(function(e){t.a[rf]=e.recaptchaSiteKey}).s(function(e){throw t.f=null,e}))},Eu.render=function(){nu(this);var t=this;return eu(this,this.za().then(function(){if(null===t.c){var e=t.l;if(!t.i){var n=Ae(e);e=Oe("DIV"),n.appendChild(e)}t.c=t.g.render(e,t.a)}return t.c}))},Eu.verify=function(){nu(this);var t=this;return eu(this,this.render().then(function(e){return new G(function(n){var r=t.g.getResponse(e);if(r)n(r);else{var i=function(e){e&&(tu(t,i),n(e))};t.m.push(i),t.i&&t.g.execute(t.c)}})}))},Eu.reset=function(){nu(this),null!==this.c&&this.g.reset(this.c)},Eu.clear=function(){nu(this),this.C=!0,this.o.c();for(var t=0;t<this.h.length;t++)this.h[t].cancel("RecaptchaVerifier instance has been destroyed.");if(!this.i){t=Ae(this.l);for(var e;e=t.firstChild;)t.removeChild(e)}},d(ru,$s);var af="First Second Third Fourth Fifth Sixth Seventh Eighth Ninth".split(" ");gu(Is.prototype,{Va:{name:"applyActionCode",j:[ou("code")]},Ja:{name:"checkActionCode",j:[ou("code")]},Xa:{name:"confirmPasswordReset",j:[ou("code"),ou("newPassword")]},ub:{name:"createUserWithEmailAndPassword",j:[ou("email"),ou("password")]},Sb:{name:"createUserAndRetrieveDataWithEmailAndPassword",j:[ou("email"),ou("password")]},Vb:{name:"fetchProvidersForEmail",j:[ou("email")]},Wb:{name:"fetchSignInMethodsForEmail",j:[ou("email")]},fa:{name:"getRedirectResult",j:[]},kc:{name:"isSignInWithEmailLink",j:[ou("emailLink")]},rc:{name:"onAuthStateChanged",j:[mu(su(),uu(),"nextOrObserver"),uu("opt_error",!0),uu("opt_completed",!0)]},sc:{name:"onIdTokenChanged",j:[mu(su(),uu(),"nextOrObserver"),uu("opt_error",!0),uu("opt_completed",!0)]},hb:{name:"sendPasswordResetEmail",j:[ou("email"),mu(su("opt_actionCodeSettings",!0),cu(null,!0),"opt_actionCodeSettings",!0)]},ib:{name:"sendSignInLinkToEmail",j:[ou("email"),su("actionCodeSettings")]},jb:{name:"setPersistence",j:[ou("persistence")]},Oa:{name:"signInAndRetrieveDataWithCredential",j:[pu()]},Pa:{name:"signInAnonymously",j:[]},Dc:{name:"signInAnonymouslyAndRetrieveData",j:[]},Ec:{name:"signInWithCredential",j:[pu()]},Jb:{name:"signInWithCustomToken",j:[ou("token")]},Bc:{name:"signInAndRetrieveDataWithCustomToken",j:[ou("token")]},Kb:{name:"signInWithEmailAndPassword",j:[ou("email"),ou("password")]},Fc:{name:"signInWithEmailLink",j:[ou("email"),ou("emailLink",!0)]},Cc:{name:"signInAndRetrieveDataWithEmailAndPassword",j:[ou("email"),ou("password")]},Gc:{name:"signInWithPhoneNumber",j:[ou("phoneNumber"),yu()]},Hc:{name:"signInWithPopup",j:[du()]},Ic:{name:"signInWithRedirect",j:[du()]},Oc:{name:"updateCurrentUser",j:[mu(function(t){return{name:"user",K:"an instance of Firebase User",optional:!1,M:function(t){return!!(t&&t instanceof Pa)}}}(),cu(),"user")]},kb:{name:"signOut",j:[]},toJSON:{name:"toJSON",j:[ou(null,!0)]},Qc:{name:"useDeviceLanguage",j:[]},Rc:{name:"verifyPasswordResetCode",j:[ou("code")]}}),vu(Is.prototype,{lc:{name:"languageCode",qb:mu(ou(),cu(),"languageCode")}}),Is.Persistence=xh,Is.Persistence.LOCAL="local",Is.Persistence.SESSION="session",Is.Persistence.NONE="none",gu(Pa.prototype,{delete:{name:"delete",j:[]},ac:{name:"getIdTokenResult",j:[au("opt_forceRefresh",!0)]},F:{name:"getIdToken",j:[au("opt_forceRefresh",!0)]},ab:{name:"linkAndRetrieveDataWithCredential",j:[pu()]},mc:{name:"linkWithCredential",j:[pu()]},nc:{name:"linkWithPhoneNumber",j:[ou("phoneNumber"),yu()]},oc:{name:"linkWithPopup",j:[du()]},pc:{name:"linkWithRedirect",j:[du()]},cb:{name:"reauthenticateAndRetrieveDataWithCredential",j:[pu()]},vc:{name:"reauthenticateWithCredential",j:[pu()]},wc:{name:"reauthenticateWithPhoneNumber",j:[ou("phoneNumber"),yu()]},xc:{name:"reauthenticateWithPopup",j:[du()]},yc:{name:"reauthenticateWithRedirect",j:[du()]},reload:{name:"reload",j:[]},gb:{name:"sendEmailVerification",j:[mu(su("opt_actionCodeSettings",!0),cu(null,!0),"opt_actionCodeSettings",!0)]},toJSON:{name:"toJSON",j:[ou(null,!0)]},Nc:{name:"unlink",j:[ou("provider")]},mb:{name:"updateEmail",j:[ou("email")]},nb:{name:"updatePassword",j:[ou("password")]},Pc:{name:"updatePhoneNumber",j:[pu("phone")]},ob:{name:"updateProfile",j:[su("profile")]}}),gu(Hs.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),gu(Ks.prototype,{execute:{name:"execute"},render:{name:"render"},reset:{name:"reset"},getResponse:{name:"getResponse"}}),gu(G.prototype,{ia:{name:"finally"},s:{name:"catch"},then:{name:"then"}}),vu(ga.prototype,{appVerificationDisabled:{name:"appVerificationDisabledForTesting",qb:au("appVerificationDisabledForTesting")}}),gu(va.prototype,{confirm:{name:"confirm",j:[ou("verificationCode")]}}),bu(hr,"credential",function(t,e){return new lr(t,e)},[ou("email"),ou("password")]),gu(nr.prototype,{ta:{name:"addScope",j:[ou("scope")]},Da:{name:"setCustomParameters",j:[su("customOAuthParameters")]}}),bu(nr,"credential",rr,[mu(ou(),su(),"token")]),bu(hr,"credentialWithLink",fr,[ou("email"),ou("emailLink")]),gu(ir.prototype,{ta:{name:"addScope",j:[ou("scope")]},Da:{name:"setCustomParameters",j:[su("customOAuthParameters")]}}),bu(ir,"credential",or,[mu(ou(),su(),"token")]),gu(ar.prototype,{ta:{name:"addScope",j:[ou("scope")]},Da:{name:"setCustomParameters",j:[su("customOAuthParameters")]}}),bu(ar,"credential",sr,[mu(ou(),mu(su(),cu()),"idToken"),mu(ou(),cu(),"accessToken",!0)]),gu(ur.prototype,{Da:{name:"setCustomParameters",j:[su("customOAuthParameters")]}}),bu(ur,"credential",cr,[mu(ou(),su(),"token"),ou("secret",!0)]),gu(er.prototype,{ta:{name:"addScope",j:[ou("scope")]},credential:{name:"credential",j:[mu(ou(),cu(),"idToken",!0),mu(ou(),cu(),"accessToken",!0)]},Da:{name:"setCustomParameters",j:[su("customOAuthParameters")]}}),bu(mr,"credential",gr,[ou("verificationId"),ou("verificationCode")]),gu(mr.prototype,{Ta:{name:"verifyPhoneNumber",j:[ou("phoneNumber"),yu()]}}),gu(Rn.prototype,{toJSON:{name:"toJSON",j:[ou(null,!0)]}}),gu(Sr.prototype,{toJSON:{name:"toJSON",j:[ou(null,!0)]}}),gu(Tr.prototype,{toJSON:{name:"toJSON",j:[ou(null,!0)]}}),gu(ru.prototype,{clear:{name:"clear",j:[]},render:{name:"render",j:[]},verify:{name:"verify",j:[]}}),function(){if("undefined"===typeof Tu||!Tu.INTERNAL||!Tu.INTERNAL.registerService)throw Error("Cannot find the firebase namespace; be sure to include firebase-app.js before this library.");var t={Auth:Is,Error:Rn};bu(t,"EmailAuthProvider",hr,[]),bu(t,"FacebookAuthProvider",nr,[]),bu(t,"GithubAuthProvider",ir,[]),bu(t,"GoogleAuthProvider",ar,[]),bu(t,"TwitterAuthProvider",ur,[]),bu(t,"OAuthProvider",er,[ou("providerId")]),bu(t,"PhoneAuthProvider",mr,[hu()]),bu(t,"RecaptchaVerifier",ru,[mu(ou(),lu(),"recaptchaContainer"),su("recaptchaParameters",!0),fu()]),Tu.INTERNAL.registerService("auth",function(t,e){return t=new Is(t),e({INTERNAL:{getUid:f(t.getUid,t),getToken:f(t.$b,t),addAuthTokenListener:f(t.Rb,t),removeAuthTokenListener:f(t.zc,t)}}),t},t,function(t,e){if("create"===t)try{e.auth()}catch(t){}}),Tu.INTERNAL.extendNamespace({User:Pa})}()}).call("undefined"!==typeof t?t:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})}).call(e,n(1))},function(t,e,n){"use strict";(function(r){function i(t){for(var e="",n=t.split("/"),r=0;r<n.length;r++)if(n[r].length>0){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(t){}e+="/"+i}return e}function o(t){var e={};t.startsWith("?")&&(t=t.substring(1));for(var n=0,r=t.split("&");n<r.length;n++){var i=r[n];if(0!==i.length){var o=i.split("=");2===o.length?e[decodeURIComponent(o[0])]=decodeURIComponent(o[1]):F("Invalid query segment '"+i+"' in query '"+t+"'")}}return e}function a(t,e){return W(t.name,e.name)}function s(t,e){return W(t,e)}function u(t,e){if(void 0===e&&(e=null),null===t)return Yt.EMPTY_NODE;if("object"===typeof t&&".priority"in t&&(e=t[".priority"]),g.assert(null===e||"string"===typeof e||"number"===typeof e||"object"===typeof e&&".sv"in e,"Invalid priority type found: "+typeof e),"object"===typeof t&&".value"in t&&null!==t[".value"]&&(t=t[".value"]),"object"!==typeof t||".sv"in t){return new Ft(t,u(e))}if(t instanceof Array||!$t){var n=Yt.EMPTY_NODE,r=t;return g.forEach(r,function(t,e){if(g.contains(r,t)&&"."!==t.substring(0,1)){var i=u(e);!i.isLeafNode()&&i.isEmpty()||(n=n.updateImmediateChild(t,i))}}),n.updatePriority(u(e))}var i=[],o=!1,c=t;if(g.forEach(c,function(t,e){if("string"!==typeof t||"."!==t.substring(0,1)){var n=u(c[t]);n.isEmpty()||(o=o||!n.getPriority().isEmpty(),i.push(new Ot(t,n)))}}),0==i.length)return Yt.EMPTY_NODE;var l=Gt(i,a,function(t){return t.name},s);if(o){var h=Gt(i,Bt.getCompare());return new Yt(l,u(e),new zt({".priority":h},{".priority":Bt}))}return new Yt(l,u(e),zt.Default)}function c(e){var n=e.INTERNAL.registerService("database",function(t,e,n){return Cn.getInstance().databaseFromApp(t,n)},{Reference:_n,Query:ce,Database:In,enableLogging:D,INTERNAL:Mn,ServerValue:Hn,TEST_ACCESS:Kn},null,!0);g.isNodeSdk()&&(t.exports=n)}Object.defineProperty(e,"__esModule",{value:!0});var l,h,f,p,d,y,m,g=n(5),v=n(13),b=n(2),_=function(t){return t&&"object"===typeof t&&"default"in t?t.default:t}(n(0)),w=function(){function t(t){this.domStorage_=t,this.prefix_="firebase:"}return t.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),g.stringify(e))},t.prototype.get=function(t){var e=this.domStorage_.getItem(this.prefixedName_(t));return null==e?null:g.jsonEval(e)},t.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},t.prototype.prefixedName_=function(t){return this.prefix_+t},t.prototype.toString=function(){return this.domStorage_.toString()},t}(),E=function(){function t(){this.cache_={},this.isInMemoryStorage=!0}return t.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},t.prototype.get=function(t){return g.contains(this.cache_,t)?this.cache_[t]:null},t.prototype.remove=function(t){delete this.cache_[t]},t}(),T=function(t){try{if("undefined"!==typeof window&&"undefined"!==typeof window[t]){var e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new w(e)}}catch(t){}return new E},S=T("localStorage"),C=T("sessionStorage"),I=new v.Logger("@firebase/database"),N=function(){var t=1;return function(){return t++}}(),k=function(t){var e=g.stringToByteArray(t),n=new g.Sha1;n.update(e);var r=n.digest();return g.base64.encodeByteArray(r)},A=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];for(var n="",r=0;r<t.length;r++)Array.isArray(t[r])||t[r]&&"object"===typeof t[r]&&"number"===typeof t[r].length?n+=A.apply(null,t[r]):"object"===typeof t[r]?n+=g.stringify(t[r]):n+=t[r],n+=" ";return n},R=null,O=!0,D=function(t,e){g.assert(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(I.logLevel=v.LogLevel.VERBOSE,R=I.log.bind(I),e&&C.set("logging_enabled",!0)):"function"===typeof t?R=t:(R=null,C.remove("logging_enabled"))},P=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];if(!0===O&&(O=!1,null===R&&!0===C.get("logging_enabled")&&D(!0)),R){var n=A.apply(null,t);R(n)}},x=function(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];P.apply(void 0,[t].concat(e))}},L=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE INTERNAL ERROR: "+A.apply(void 0,t);I.error(n)},M=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE FATAL ERROR: "+A.apply(void 0,t);throw I.error(n),new Error(n)},F=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="FIREBASE WARNING: "+A.apply(void 0,t);I.warn(n)},U=function(){"undefined"!==typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&F("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().")},B=function(t){return"number"===typeof t&&(t!=t||t==Number.POSITIVE_INFINITY||t==Number.NEGATIVE_INFINITY)},V=function(t){if(g.isNodeSdk()||"complete"===document.readyState)t();else{var e=!1,n=function(){if(!document.body)return void setTimeout(n,Math.floor(10));e||(e=!0,t())};document.addEventListener?(document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",n,!1)):document.attachEvent&&(document.attachEvent("onreadystatechange",function(){"complete"===document.readyState&&n()}),window.attachEvent("onload",n))}},j="[MIN_NAME]",q="[MAX_NAME]",W=function(t,e){if(t===e)return 0;if(t===j||e===q)return-1;if(e===j||t===q)return 1;var n=tt(t),r=tt(e);return null!==n?null!==r?n-r==0?t.length-e.length:n-r:-1:null!==r?1:t<e?-1:1},K=function(t,e){return t===e?0:t<e?-1:1},H=function(t,e){if(e&&t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+g.stringify(e))},G=function(t){if("object"!==typeof t||null===t)return g.stringify(t);var e=[];for(var n in t)e.push(n);e.sort();for(var r="{",i=0;i<e.length;i++)0!==i&&(r+=","),r+=g.stringify(e[i]),r+=":",r+=G(t[e[i]]);return r+="}"},Q=function(t,e){var n=t.length;if(n<=e)return[t];for(var r=[],i=0;i<n;i+=e)i+e>n?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r},z=function(t,e){if(Array.isArray(t))for(var n=0;n<t.length;++n)e(n,t[n]);else g.forEach(t,function(t,n){return e(n,t)})},Y=function(t){g.assert(!B(t),"Invalid JSON number");var e,n,r,i,o,a,s;for(0===t?(n=0,r=0,e=1/t===-1/0?1:0):(e=t<0,t=Math.abs(t),t>=Math.pow(2,-1022)?(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023),n=i+1023,r=Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,r=Math.round(t/Math.pow(2,-1074)))),a=[],o=52;o;o-=1)a.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;o-=1)a.push(n%2?1:0),n=Math.floor(n/2);a.push(e?1:0),a.reverse(),s=a.join("");var u="";for(o=0;o<64;o+=8){var c=parseInt(s.substr(o,8),2).toString(16);1===c.length&&(c="0"+c),u+=c}return u.toLowerCase()},X=function(){return!("object"!==typeof window||!window.chrome||!window.chrome.extension||/^chrome/.test(window.location.href))},J=function(){return"object"===typeof Windows&&"object"===typeof Windows.UI},$=function(t,e){var n="Unknown Error";"too_big"===t?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"==t?n="Client doesn't have permission to access the desired data.":"unavailable"==t&&(n="The service is unavailable");var r=new Error(t+" at "+e.path.toString()+": "+n);return r.code=t.toUpperCase(),r},Z=new RegExp("^-?\\d{1,10}$"),tt=function(t){if(Z.test(t)){var e=Number(t);if(e>=-2147483648&&e<=2147483647)return e}return null},et=function(t){try{t()}catch(t){setTimeout(function(){var e=t.stack||"";throw F("Exception was thrown by user callback.",e),t},Math.floor(0))}},nt=function(){return("object"===typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0},rt=function(t,e){var n=setTimeout(t,e);return"object"===typeof n&&n.unref&&n.unref(),n},it=function(){function t(t,e){if(void 0===e){this.pieces_=t.split("/");for(var n=0,r=0;r<this.pieces_.length;r++)this.pieces_[r].length>0&&(this.pieces_[n]=this.pieces_[r],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=e}return Object.defineProperty(t,"Empty",{get:function(){return new t("")},enumerable:!0,configurable:!0}),t.prototype.getFront=function(){return this.pieceNum_>=this.pieces_.length?null:this.pieces_[this.pieceNum_]},t.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},t.prototype.popFront=function(){var e=this.pieceNum_;return e<this.pieces_.length&&e++,new t(this.pieces_,e)},t.prototype.getBack=function(){return this.pieceNum_<this.pieces_.length?this.pieces_[this.pieces_.length-1]:null},t.prototype.toString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+this.pieces_[e]);return t||"/"},t.prototype.toUrlEncodedString=function(){for(var t="",e=this.pieceNum_;e<this.pieces_.length;e++)""!==this.pieces_[e]&&(t+="/"+encodeURIComponent(String(this.pieces_[e])));return t||"/"},t.prototype.slice=function(t){return void 0===t&&(t=0),this.pieces_.slice(this.pieceNum_+t)},t.prototype.parent=function(){if(this.pieceNum_>=this.pieces_.length)return null;for(var e=[],n=this.pieceNum_;n<this.pieces_.length-1;n++)e.push(this.pieces_[n]);return new t(e,0)},t.prototype.child=function(e){for(var n=[],r=this.pieceNum_;r<this.pieces_.length;r++)n.push(this.pieces_[r]);if(e instanceof t)for(var r=e.pieceNum_;r<e.pieces_.length;r++)n.push(e.pieces_[r]);else for(var i=e.split("/"),r=0;r<i.length;r++)i[r].length>0&&n.push(i[r]);return new t(n,0)},t.prototype.isEmpty=function(){return this.pieceNum_>=this.pieces_.length},t.relativePath=function(e,n){var r=e.getFront(),i=n.getFront();if(null===r)return n;if(r===i)return t.relativePath(e.popFront(),n.popFront());throw new Error("INTERNAL ERROR: innerPath ("+n+") is not within outerPath ("+e+")")},t.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;i<n.length&&i<r.length;i++){var o=W(n[i],r[i]);if(0!==o)return o}return n.length===r.length?0:n.length<r.length?-1:1},t.prototype.equals=function(t){if(this.getLength()!==t.getLength())return!1;for(var e=this.pieceNum_,n=t.pieceNum_;e<=this.pieces_.length;e++,n++)if(this.pieces_[e]!==t.pieces_[n])return!1;return!0},t.prototype.contains=function(t){var e=this.pieceNum_,n=t.pieceNum_;if(this.getLength()>t.getLength())return!1;for(;e<this.pieces_.length;){if(this.pieces_[e]!==t.pieces_[n])return!1;++e,++n}return!0},t}(),ot=function(){function t(t,e){this.errorPrefix_=e,this.parts_=t.slice(),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n<this.parts_.length;n++)this.byteLength_+=g.stringLength(this.parts_[n]);this.checkValid_()}return Object.defineProperty(t,"MAX_PATH_DEPTH",{get:function(){return 32},enumerable:!0,configurable:!0}),Object.defineProperty(t,"MAX_PATH_LENGTH_BYTES",{get:function(){return 768},enumerable:!0,configurable:!0}),t.prototype.push=function(t){this.parts_.length>0&&(this.byteLength_+=1),this.parts_.push(t),this.byteLength_+=g.stringLength(t),this.checkValid_()},t.prototype.pop=function(){var t=this.parts_.pop();this.byteLength_-=g.stringLength(t),this.parts_.length>0&&(this.byteLength_-=1)},t.prototype.checkValid_=function(){if(this.byteLength_>t.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+t.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length>t.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+t.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},t.prototype.toErrorString=function(){return 0==this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},t}(),at="long_polling",st=function(){function t(t,e,n,r,i){void 0===i&&(i=""),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.persistenceKey=i,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=S.get("host:"+t)||this.host}return t.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()},t.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},t.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},t.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&&"firebaseio-demo.com"!==this.domain},t.prototype.updateHost=function(t){t!==this.internalHost&&(this.internalHost=t,this.isCacheableHost()&&S.set("host:"+this.host,this.internalHost))},t.prototype.connectionURL=function(t,e){g.assert("string"===typeof t,"typeof type must == string"),g.assert("object"===typeof e,"typeof params must == object");var n;if("websocket"===t)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(t!==at)throw new Error("Unknown connection type: "+t);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(e.ns=this.namespace);var r=[];return g.forEach(e,function(t,e){r.push(t+"="+e)}),n+r.join("&")},t.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&&(t+="<"+this.persistenceKey+">"),t},t.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},t}(),ut=function(t){var e=ct(t),n=e.subdomain;"firebase"===e.domain&&M(e.host+" is no longer supported. Please use <YOUR FIREBASE>.firebaseio.com instead"),n&&"undefined"!=n||"localhost"===e.domain||M("Cannot parse Firebase url. Please use https://<YOUR FIREBASE>.firebaseio.com"),e.secure||U();var r="ws"===e.scheme||"wss"===e.scheme;return{repoInfo:new st(e.host,e.secure,n,r),path:new it(e.pathString)}},ct=function(t){var e="",n="",r="",a="",s=!0,u="https",c=443;if("string"===typeof t){var l=t.indexOf("//");l>=0&&(u=t.substring(0,l-1),t=t.substring(l+2));var h=t.indexOf("/");-1===h&&(h=t.length);var f=t.indexOf("?");-1===f&&(f=t.length),e=t.substring(0,Math.min(h,f)),h<f&&(a=i(t.substring(h,f)));var p=o(t.substring(Math.min(t.length,f)));l=e.indexOf(":"),l>=0?(s="https"===u||"wss"===u,c=parseInt(e.substring(l+1),10)):l=t.length;var d=e.split(".");3===d.length?(n=d[1],r=d[0].toLowerCase()):2===d.length?n=d[0]:"localhost"===d[0].slice(0,l).toLowerCase()&&(n="localhost"),""===r&&"ns"in p&&(r=p.ns)}return{host:e,port:c,domain:n,subdomain:r,secure:s,scheme:u,pathString:a}},lt=/[\[\].#$\/\u0000-\u001F\u007F]/,ht=/[\[\].#$\u0000-\u001F\u007F]/,ft=function(t){return"string"===typeof t&&0!==t.length&&!lt.test(t)},pt=function(t){return"string"===typeof t&&0!==t.length&&!ht.test(t)},dt=function(t){return t&&(t=t.replace(/^\/*\.info(\/|$)/,"/")),pt(t)},yt=function(t){return null===t||"string"===typeof t||"number"===typeof t&&!B(t)||t&&"object"===typeof t&&g.contains(t,".sv")},mt=function(t,e,n,r,i){i&&void 0===n||gt(g.errorPrefix(t,e,i),n,r)},gt=function(t,e,n){var r=n instanceof it?new ot(n,t):n;if(void 0===e)throw new Error(t+"contains undefined "+r.toErrorString());if("function"===typeof e)throw new Error(t+"contains a function "+r.toErrorString()+" with contents = "+e.toString());if(B(e))throw new Error(t+"contains "+e.toString()+" "+r.toErrorString());if("string"===typeof e&&e.length>10485760/3&&g.stringLength(e)>10485760)throw new Error(t+"contains a string greater than 10485760 utf8 bytes "+r.toErrorString()+" ('"+e.substring(0,50)+"...')");if(e&&"object"===typeof e){var i=!1,o=!1;if(g.forEach(e,function(e,n){if(".value"===e)i=!0;else if(".priority"!==e&&".sv"!==e&&(o=!0,!ft(e)))throw new Error(t+" contains an invalid key ("+e+") "+r.toErrorString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');r.push(e),gt(t,n,r),r.pop()}),i&&o)throw new Error(t+' contains ".value" child '+r.toErrorString()+" in addition to actual children.")}},vt=function(t,e){var n,r;for(n=0;n<e.length;n++){r=e[n];for(var i=r.slice(),o=0;o<i.length;o++)if(".priority"===i[o]&&o===i.length-1);else if(!ft(i[o]))throw new Error(t+"contains an invalid key ("+i[o]+") in path "+r.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"')}e.sort(it.comparePaths);var a=null;for(n=0;n<e.length;n++){if(r=e[n],null!==a&&a.contains(r))throw new Error(t+"contains a path "+a.toString()+" that is ancestor of another path "+r.toString());a=r}},bt=function(t,e,n,r,i){if(!i||void 0!==n){var o=g.errorPrefix(t,e,i);if(!n||"object"!==typeof n||Array.isArray(n))throw new Error(o+" must be an object containing the children to replace.");var a=[];g.forEach(n,function(t,e){var n=new it(t);if(gt(o,e,r.child(n)),".priority"===n.getBack()&&!yt(e))throw new Error(o+"contains an invalid value for '"+n.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");a.push(n)}),vt(o,a)}},_t=function(t,e,n,r){if(!r||void 0!==n){if(B(n))throw new Error(g.errorPrefix(t,e,r)+"is "+n.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!yt(n))throw new Error(g.errorPrefix(t,e,r)+"must be a valid Firebase priority (a string, finite number, server value, or null).")}},wt=function(t,e,n,r){if(!r||void 0!==n)switch(n){case"value":case"child_added":case"child_removed":case"child_changed":case"child_moved":break;default:throw new Error(g.errorPrefix(t,e,r)+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}},Et=function(t,e,n,r){if((!r||void 0!==n)&&!ft(n))throw new Error(g.errorPrefix(t,e,r)+'was an invalid key = "'+n+'". Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')},Tt=function(t,e,n,r){if((!r||void 0!==n)&&!pt(n))throw new Error(g.errorPrefix(t,e,r)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')},St=function(t,e,n,r){n&&(n=n.replace(/^\/*\.info(\/|$)/,"/")),Tt(t,e,n,r)},Ct=function(t,e){if(".info"===e.getFront())throw new Error(t+" failed = Can't modify data under /.info/")},It=function(t,e,n){var r=n.path.toString();if("string"!==typeof n.repoInfo.host||0===n.repoInfo.host.length||!ft(n.repoInfo.namespace)&&"localhost"!==n.repoInfo.host.split(":")[0]||0!==r.length&&!dt(r))throw new Error(g.errorPrefix(t,e,!1)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')},Nt=function(t,e,n,r){if((!r||void 0!==n)&&"boolean"!==typeof n)throw new Error(g.errorPrefix(t,e,r)+"must be a boolean.")},kt=function(){function t(t,e){this.repo_=t,this.path_=e}return t.prototype.cancel=function(t){g.validateArgCount("OnDisconnect.cancel",0,1,arguments.length),g.validateCallback("OnDisconnect.cancel",1,t,!0);var e=new g.Deferred;return this.repo_.onDisconnectCancel(this.path_,e.wrapCallback(t)),e.promise},t.prototype.remove=function(t){g.validateArgCount("OnDisconnect.remove",0,1,arguments.length),Ct("OnDisconnect.remove",this.path_),g.validateCallback("OnDisconnect.remove",1,t,!0);var e=new g.Deferred;return this.repo_.onDisconnectSet(this.path_,null,e.wrapCallback(t)),e.promise},t.prototype.set=function(t,e){g.validateArgCount("OnDisconnect.set",1,2,arguments.length),Ct("OnDisconnect.set",this.path_),mt("OnDisconnect.set",1,t,this.path_,!1),g.validateCallback("OnDisconnect.set",2,e,!0);var n=new g.Deferred;return this.repo_.onDisconnectSet(this.path_,t,n.wrapCallback(e)),n.promise},t.prototype.setWithPriority=function(t,e,n){g.validateArgCount("OnDisconnect.setWithPriority",2,3,arguments.length),Ct("OnDisconnect.setWithPriority",this.path_),mt("OnDisconnect.setWithPriority",1,t,this.path_,!1),_t("OnDisconnect.setWithPriority",2,e,!1),g.validateCallback("OnDisconnect.setWithPriority",3,n,!0);var r=new g.Deferred;return this.repo_.onDisconnectSetWithPriority(this.path_,t,e,r.wrapCallback(n)),r.promise},t.prototype.update=function(t,e){if(g.validateArgCount("OnDisconnect.update",1,2,arguments.length),Ct("OnDisconnect.update",this.path_),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,F("Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}bt("OnDisconnect.update",1,t,this.path_,!1),g.validateCallback("OnDisconnect.update",2,e,!0);var i=new g.Deferred;return this.repo_.onDisconnectUpdate(this.path_,t,i.wrapCallback(e)),i.promise},t}(),At=function(){function t(t,e){this.committed=t,this.snapshot=e}return t.prototype.toJSON=function(){return g.validateArgCount("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},t}(),Rt=function(){var t="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",e=0,n=[];return function(r){var i=r===e;e=r;var o,a=new Array(8);for(o=7;o>=0;o--)a[o]=t.charAt(r%64),r=Math.floor(r/64);g.assert(0===r,"Cannot push at time == 0");var s=a.join("");if(i){for(o=11;o>=0&&63===n[o];o--)n[o]=0;n[o]++}else for(o=0;o<12;o++)n[o]=Math.floor(64*Math.random());for(o=0;o<12;o++)s+=t.charAt(n[o]);return g.assert(20===s.length,"nextPushId: Length should be 20."),s}}(),Ot=function(){function t(t,e){this.name=t,this.node=e}return t.Wrap=function(e,n){return new t(e,n)},t}(),Dt=function(){function t(){}return t.prototype.getCompare=function(){return this.compare.bind(this)},t.prototype.indexedValueChanged=function(t,e){var n=new Ot(j,t),r=new Ot(j,e);return 0!==this.compare(n,r)},t.prototype.minPost=function(){return Ot.MIN},t}(),Pt=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b.__extends(e,t),Object.defineProperty(e,"__EMPTY_NODE",{get:function(){return l},set:function(t){l=t},enumerable:!0,configurable:!0}),e.prototype.compare=function(t,e){return W(t.name,e.name)},e.prototype.isDefinedOn=function(t){throw g.assertionError("KeyIndex.isDefinedOn not expected to be called.")},e.prototype.indexedValueChanged=function(t,e){return!1},e.prototype.minPost=function(){return Ot.MIN},e.prototype.maxPost=function(){return new Ot(q,l)},e.prototype.makePost=function(t,e){return g.assert("string"===typeof t,"KeyIndex indexValue must always be a string."),new Ot(t,l)},e.prototype.toString=function(){return".key"},e}(Dt),xt=new Pt,Lt=function(t){return"number"===typeof t?"number:"+Y(t):"string:"+t},Mt=function(t){if(t.isLeafNode()){var e=t.val();g.assert("string"===typeof e||"number"===typeof e||"object"===typeof e&&g.contains(e,".sv"),"Priority must be a string or number.")}else g.assert(t===h||t.isEmpty(),"priority of unexpected type.");g.assert(t===h||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},Ft=function(){function t(e,n){void 0===n&&(n=t.__childrenNodeConstructor.EMPTY_NODE),this.value_=e,this.priorityNode_=n,this.lazyHash_=null,g.assert(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),Mt(this.priorityNode_)}return Object.defineProperty(t,"__childrenNodeConstructor",{get:function(){return f},set:function(t){f=t},enumerable:!0,configurable:!0}),t.prototype.isLeafNode=function(){return!0},t.prototype.getPriority=function(){return this.priorityNode_},t.prototype.updatePriority=function(e){return new t(this.value_,e)},t.prototype.getImmediateChild=function(e){return".priority"===e?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE},t.prototype.getChild=function(e){return e.isEmpty()?this:".priority"===e.getFront()?this.priorityNode_:t.__childrenNodeConstructor.EMPTY_NODE},t.prototype.hasChild=function(){return!1},t.prototype.getPredecessorChildName=function(t,e){return null},t.prototype.updateImmediateChild=function(e,n){return".priority"===e?this.updatePriority(n):n.isEmpty()&&".priority"!==e?this:t.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(e,n).updatePriority(this.priorityNode_)},t.prototype.updateChild=function(e,n){var r=e.getFront();return null===r?n:n.isEmpty()&&".priority"!==r?this:(g.assert(".priority"!==r||1===e.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(r,t.__childrenNodeConstructor.EMPTY_NODE.updateChild(e.popFront(),n)))},t.prototype.isEmpty=function(){return!1},t.prototype.numChildren=function(){return 0},t.prototype.forEachChild=function(t,e){return!1},t.prototype.val=function(t){return t&&!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},t.prototype.hash=function(){if(null===this.lazyHash_){var t="";this.priorityNode_.isEmpty()||(t+="priority:"+Lt(this.priorityNode_.val())+":");var e=typeof this.value_;t+=e+":",t+="number"===e?Y(this.value_):this.value_,this.lazyHash_=k(t)}return this.lazyHash_},t.prototype.getValue=function(){return this.value_},t.prototype.compareTo=function(e){return e===t.__childrenNodeConstructor.EMPTY_NODE?1:e instanceof t.__childrenNodeConstructor?-1:(g.assert(e.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(e))},t.prototype.compareToLeafNode_=function(e){var n=typeof e.value_,r=typeof this.value_,i=t.VALUE_TYPE_ORDER.indexOf(n),o=t.VALUE_TYPE_ORDER.indexOf(r);return g.assert(i>=0,"Unknown leaf type: "+n),g.assert(o>=0,"Unknown leaf type: "+r),i===o?"object"===r?0:this.value_<e.value_?-1:this.value_===e.value_?0:1:o-i},t.prototype.withIndex=function(){return this},t.prototype.isIndexed=function(){return!0},t.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode()){var e=t;return this.value_===e.value_&&this.priorityNode_.equals(e.priorityNode_)}return!1},t.VALUE_TYPE_ORDER=["object","boolean","number","string"],t}(),Ut=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b.__extends(e,t),e.prototype.compare=function(t,e){var n=t.node.getPriority(),r=e.node.getPriority(),i=n.compareTo(r);return 0===i?W(t.name,e.name):i},e.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},e.prototype.indexedValueChanged=function(t,e){return!t.getPriority().equals(e.getPriority())},e.prototype.minPost=function(){return Ot.MIN},e.prototype.maxPost=function(){return new Ot(q,new Ft("[PRIORITY-POST]",d))},e.prototype.makePost=function(t,e){var n=p(t);return new Ot(e,new Ft("[PRIORITY-POST]",n))},e.prototype.toString=function(){return".priority"},e}(Dt),Bt=new Ut,Vt=function(){function t(t,e,n,r,i){void 0===i&&(i=null),this.isReverse_=r,this.resultGenerator_=i,this.nodeStack_=[];for(var o=1;!t.isEmpty();)if(t=t,o=e?n(t.key,e):1,r&&(o*=-1),o<0)t=this.isReverse_?t.left:t.right;else{if(0===o){this.nodeStack_.push(t);break}this.nodeStack_.push(t),t=this.isReverse_?t.right:t.left}}return t.prototype.getNext=function(){if(0===this.nodeStack_.length)return null;var t,e=this.nodeStack_.pop();if(t=this.resultGenerator_?this.resultGenerator_(e.key,e.value):{key:e.key,value:e.value},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},t.prototype.hasNext=function(){return this.nodeStack_.length>0},t.prototype.peek=function(){if(0===this.nodeStack_.length)return null;var t=this.nodeStack_[this.nodeStack_.length-1];return this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value}},t}(),jt=function(){function t(e,n,r,i,o){this.key=e,this.value=n,this.color=null!=r?r:t.RED,this.left=null!=i?i:Wt.EMPTY_NODE,this.right=null!=o?o:Wt.EMPTY_NODE}return t.prototype.copy=function(e,n,r,i,o){return new t(null!=e?e:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},t.prototype.count=function(){return this.left.count()+1+this.right.count()},t.prototype.isEmpty=function(){return!1},t.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},t.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},t.prototype.minKey=function(){return this.min_().key},t.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},t.prototype.insert=function(t,e,n){var r,i;return i=this,r=n(t,i.key),i=r<0?i.copy(null,null,null,i.left.insert(t,e,n),null):0===r?i.copy(null,e,null,null,null):i.copy(null,null,null,null,i.right.insert(t,e,n)),i.fixUp_()},t.prototype.removeMin_=function(){if(this.left.isEmpty())return Wt.EMPTY_NODE;var t=this;return t.left.isRed_()||t.left.left.isRed_()||(t=t.moveRedLeft_()),t=t.copy(null,null,null,t.left.removeMin_(),null),t.fixUp_()},t.prototype.remove=function(t,e){var n,r;if(n=this,e(t,n.key)<0)n.left.isEmpty()||n.left.isRed_()||n.left.left.isRed_()||(n=n.moveRedLeft_()),n=n.copy(null,null,null,n.left.remove(t,e),null);else{if(n.left.isRed_()&&(n=n.rotateRight_()),n.right.isEmpty()||n.right.isRed_()||n.right.left.isRed_()||(n=n.moveRedRight_()),0===e(t,n.key)){if(n.right.isEmpty())return Wt.EMPTY_NODE;r=n.right.min_(),n=n.copy(r.key,r.value,null,null,n.right.removeMin_())}n=n.copy(null,null,null,null,n.right.remove(t,e))}return n.fixUp_()},t.prototype.isRed_=function(){return this.color},t.prototype.fixUp_=function(){var t=this;return t.right.isRed_()&&!t.left.isRed_()&&(t=t.rotateLeft_()),t.left.isRed_()&&t.left.left.isRed_()&&(t=t.rotateRight_()),t.left.isRed_()&&t.right.isRed_()&&(t=t.colorFlip_()),t},t.prototype.moveRedLeft_=function(){var t=this.colorFlip_();return t.right.left.isRed_()&&(t=t.copy(null,null,null,null,t.right.rotateRight_()),t=t.rotateLeft_(),t=t.colorFlip_()),t},t.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t.left.left.isRed_()&&(t=t.rotateRight_(),t=t.colorFlip_()),t},t.prototype.rotateLeft_=function(){var e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},t.prototype.rotateRight_=function(){var e=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},t.prototype.colorFlip_=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},t.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)<=this.count()+1},t.prototype.check_=function(){var t;if(this.isRed_()&&this.left.isRed_())throw new Error("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed_())throw new Error("Right child of ("+this.key+","+this.value+") is red");if((t=this.left.check_())!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)},t.RED=!0,t.BLACK=!1,t}(),qt=function(){function t(){}return t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.insert=function(t,e,n){return new jt(t,e,null)},t.prototype.remove=function(t,e){return this},t.prototype.count=function(){return 0},t.prototype.isEmpty=function(){return!0},t.prototype.inorderTraversal=function(t){return!1},t.prototype.reverseTraversal=function(t){return!1},t.prototype.minKey=function(){return null},t.prototype.maxKey=function(){return null},t.prototype.check_=function(){return 0},t.prototype.isRed_=function(){return!1},t}(),Wt=function(){function t(e,n){void 0===n&&(n=t.EMPTY_NODE),this.comparator_=e,this.root_=n}return t.prototype.insert=function(e,n){return new t(this.comparator_,this.root_.insert(e,n,this.comparator_).copy(null,null,jt.BLACK,null,null))},t.prototype.remove=function(e){return new t(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,jt.BLACK,null,null))},t.prototype.get=function(t){for(var e,n=this.root_;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key)))return n.value;e<0?n=n.left:e>0&&(n=n.right)}return null},t.prototype.getPredecessorKey=function(t){for(var e,n=this.root_,r=null;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key))){if(n.left.isEmpty())return r?r.key:null;for(n=n.left;!n.right.isEmpty();)n=n.right;return n.key}e<0?n=n.left:e>0&&(r=n,n=n.right)}throw new Error("Attempted to find predecessor key for a nonexistent key. What gives?")},t.prototype.isEmpty=function(){return this.root_.isEmpty()},t.prototype.count=function(){return this.root_.count()},t.prototype.minKey=function(){return this.root_.minKey()},t.prototype.maxKey=function(){return this.root_.maxKey()},t.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},t.prototype.getIterator=function(t){return new Vt(this.root_,null,this.comparator_,!1,t)},t.prototype.getIteratorFrom=function(t,e){return new Vt(this.root_,t,this.comparator_,!1,e)},t.prototype.getReverseIteratorFrom=function(t,e){return new Vt(this.root_,t,this.comparator_,!0,e)},t.prototype.getReverseIterator=function(t){return new Vt(this.root_,null,this.comparator_,!0,t)},t.EMPTY_NODE=new qt,t}(),Kt=Math.log(2),Ht=function(){function t(t){this.count=function(t){return parseInt(Math.log(t)/Kt,10)}(t+1),this.current_=this.count-1;var e=function(t){return parseInt(Array(t+1).join("1"),2)}(this.count);this.bits_=t+1&e}return t.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<<this.current_);return this.current_--,t},t}(),Gt=function(t,e,n,r){t.sort(e);var i=function(e,r){var o,a,s=r-e;if(0==s)return null;if(1==s)return o=t[e],a=n?n(o):o,new jt(a,o.node,jt.BLACK,null,null);var u=parseInt(s/2,10)+e,c=i(e,u),l=i(u+1,r);return o=t[u],a=n?n(o):o,new jt(a,o.node,jt.BLACK,c,l)},o=new Ht(t.length),a=function(e){for(var r=null,o=null,a=t.length,s=function(e,r){var o=a-e,s=a;a-=e;var c=i(o+1,s),l=t[o],h=n?n(l):l;u(new jt(h,l.node,r,null,c))},u=function(t){r?(r.left=t,r=t):(o=t,r=t)},c=0;c<e.count;++c){var l=e.nextBitIsOne(),h=Math.pow(2,e.count-(c+1));l?s(h,jt.BLACK):(s(h,jt.BLACK),s(h,jt.RED))}return o}(o);return new Wt(r||e,a)},Qt={},zt=function(){function t(t,e){this.indexes_=t,this.indexSet_=e}return Object.defineProperty(t,"Default",{get:function(){return g.assert(Qt&&Bt,"ChildrenNode.ts has not been loaded"),y=y||new t({".priority":Qt},{".priority":Bt})},enumerable:!0,configurable:!0}),t.prototype.get=function(t){var e=g.safeGet(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e===Qt?null:e},t.prototype.hasIndex=function(t){return g.contains(this.indexSet_,t.toString())},t.prototype.addIndex=function(e,n){g.assert(e!==xt,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var r=[],i=!1,o=n.getIterator(Ot.Wrap),a=o.getNext();a;)i=i||e.isDefinedOn(a.node),r.push(a),a=o.getNext();var s;s=i?Gt(r,e.getCompare()):Qt;var u=e.toString(),c=g.clone(this.indexSet_);c[u]=e;var l=g.clone(this.indexes_);return l[u]=s,new t(l,c)},t.prototype.addToIndexes=function(e,n){var r=this;return new t(g.map(this.indexes_,function(t,i){var o=g.safeGet(r.indexSet_,i);if(g.assert(o,"Missing index implementation for "+i),t===Qt){if(o.isDefinedOn(e.node)){for(var a=[],s=n.getIterator(Ot.Wrap),u=s.getNext();u;)u.name!=e.name&&a.push(u),u=s.getNext();return a.push(e),Gt(a,o.getCompare())}return Qt}var c=n.get(e.name),l=t;return c&&(l=l.remove(new Ot(e.name,c))),l.insert(e,e.node)}),this.indexSet_)},t.prototype.removeFromIndexes=function(e,n){return new t(g.map(this.indexes_,function(t){if(t===Qt)return t;var r=n.get(e.name);return r?t.remove(new Ot(e.name,r)):t}),this.indexSet_)},t}(),Yt=function(){function t(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&&Mt(this.priorityNode_),this.children_.isEmpty()&&g.assert(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}return Object.defineProperty(t,"EMPTY_NODE",{get:function(){return m||(m=new t(new Wt(s),null,zt.Default))},enumerable:!0,configurable:!0}),t.prototype.isLeafNode=function(){return!1},t.prototype.getPriority=function(){return this.priorityNode_||m},t.prototype.updatePriority=function(e){return this.children_.isEmpty()?this:new t(this.children_,e,this.indexMap_)},t.prototype.getImmediateChild=function(t){if(".priority"===t)return this.getPriority();var e=this.children_.get(t);return null===e?m:e},t.prototype.getChild=function(t){var e=t.getFront();return null===e?this:this.getImmediateChild(e).getChild(t.popFront())},t.prototype.hasChild=function(t){return null!==this.children_.get(t)},t.prototype.updateImmediateChild=function(e,n){if(g.assert(n,"We should always be passing snapshot nodes"),".priority"===e)return this.updatePriority(n);var r=new Ot(e,n),i=void 0,o=void 0,a=void 0;return n.isEmpty()?(i=this.children_.remove(e),o=this.indexMap_.removeFromIndexes(r,this.children_)):(i=this.children_.insert(e,n),o=this.indexMap_.addToIndexes(r,this.children_)),a=i.isEmpty()?m:this.priorityNode_,new t(i,a,o)},t.prototype.updateChild=function(t,e){var n=t.getFront();if(null===n)return e;g.assert(".priority"!==t.getFront()||1===t.getLength(),".priority must be the last token in a path");var r=this.getImmediateChild(n).updateChild(t.popFront(),e);return this.updateImmediateChild(n,r)},t.prototype.isEmpty=function(){return this.children_.isEmpty()},t.prototype.numChildren=function(){return this.children_.count()},t.prototype.val=function(e){if(this.isEmpty())return null;var n={},r=0,i=0,o=!0;if(this.forEachChild(Bt,function(a,s){n[a]=s.val(e),r++,o&&t.INTEGER_REGEXP_.test(a)?i=Math.max(i,Number(a)):o=!1}),!e&&o&&i<2*r){var a=[];for(var s in n)a[s]=n[s];return a}return e&&!this.getPriority().isEmpty()&&(n[".priority"]=this.getPriority().val()),n},t.prototype.hash=function(){if(null===this.lazyHash_){var t="";this.getPriority().isEmpty()||(t+="priority:"+Lt(this.getPriority().val())+":"),this.forEachChild(Bt,function(e,n){var r=n.hash();""!==r&&(t+=":"+e+":"+r)}),this.lazyHash_=""===t?"":k(t)}return this.lazyHash_},t.prototype.getPredecessorChildName=function(t,e,n){var r=this.resolveIndex_(n);if(r){var i=r.getPredecessorKey(new Ot(t,e));return i?i.name:null}return this.children_.getPredecessorKey(t)},t.prototype.getFirstChildName=function(t){var e=this.resolveIndex_(t);if(e){var n=e.minKey();return n&&n.name}return this.children_.minKey()},t.prototype.getFirstChild=function(t){var e=this.getFirstChildName(t);return e?new Ot(e,this.children_.get(e)):null},t.prototype.getLastChildName=function(t){var e=this.resolveIndex_(t);if(e){var n=e.maxKey();return n&&n.name}return this.children_.maxKey()},t.prototype.getLastChild=function(t){var e=this.getLastChildName(t);return e?new Ot(e,this.children_.get(e)):null},t.prototype.forEachChild=function(t,e){var n=this.resolveIndex_(t);return n?n.inorderTraversal(function(t){return e(t.name,t.node)}):this.children_.inorderTraversal(e)},t.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},t.prototype.getIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getIteratorFrom(t,function(t){return t});for(var r=this.children_.getIteratorFrom(t.name,Ot.Wrap),i=r.peek();null!=i&&e.compare(i,t)<0;)r.getNext(),i=r.peek();return r},t.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},t.prototype.getReverseIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getReverseIteratorFrom(t,function(t){return t});for(var r=this.children_.getReverseIteratorFrom(t.name,Ot.Wrap),i=r.peek();null!=i&&e.compare(i,t)>0;)r.getNext(),i=r.peek();return r},t.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===Jt?-1:0},t.prototype.withIndex=function(e){if(e===xt||this.indexMap_.hasIndex(e))return this;var n=this.indexMap_.addIndex(e,this.children_);return new t(this.children_,this.priorityNode_,n)},t.prototype.isIndexed=function(t){return t===xt||this.indexMap_.hasIndex(t)},t.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode())return!1;var e=t;if(this.getPriority().equals(e.getPriority())){if(this.children_.count()===e.children_.count()){for(var n=this.getIterator(Bt),r=e.getIterator(Bt),i=n.getNext(),o=r.getNext();i&&o;){if(i.name!==o.name||!i.node.equals(o.node))return!1;i=n.getNext(),o=r.getNext()}return null===i&&null===o}return!1}return!1},t.prototype.resolveIndex_=function(t){return t===xt?null:this.indexMap_.get(t.toString())},t.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,t}(),Xt=function(t){function e(){return t.call(this,new Wt(s),Yt.EMPTY_NODE,zt.Default)||this}return b.__extends(e,t),e.prototype.compareTo=function(t){return t===this?0:1},e.prototype.equals=function(t){return t===this},e.prototype.getPriority=function(){return this},e.prototype.getImmediateChild=function(t){return Yt.EMPTY_NODE},e.prototype.isEmpty=function(){return!1},e}(Yt),Jt=new Xt;Object.defineProperties(Ot,{MIN:{value:new Ot(j,Yt.EMPTY_NODE)},MAX:{value:new Ot(q,Jt)}}),Pt.__EMPTY_NODE=Yt.EMPTY_NODE,Ft.__childrenNodeConstructor=Yt,function(t){h=t}(Jt),function(t){d=t}(Jt);var $t=!0;!function(t){p=t}(u);var Zt,te,ee=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return b.__extends(e,t),e.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?W(t.name,e.name):n},e.prototype.isDefinedOn=function(t){return!0},e.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},e.prototype.minPost=function(){return Ot.MIN},e.prototype.maxPost=function(){return Ot.MAX},e.prototype.makePost=function(t,e){var n=u(t);return new Ot(e,n)},e.prototype.toString=function(){return".value"},e}(Dt),ne=new ee,re=function(t){function e(e){var n=t.call(this)||this;return n.indexPath_=e,g.assert(!e.isEmpty()&&".priority"!==e.getFront(),"Can't create PathIndex with empty path or .priority key"),n}return b.__extends(e,t),e.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},e.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},e.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),i=n.compareTo(r);return 0===i?W(t.name,e.name):i},e.prototype.makePost=function(t,e){var n=u(t),r=Yt.EMPTY_NODE.updateChild(this.indexPath_,n);return new Ot(e,r)},e.prototype.maxPost=function(){var t=Yt.EMPTY_NODE.updateChild(this.indexPath_,Jt);return new Ot(q,t)},e.prototype.toString=function(){return this.indexPath_.slice().join("/")},e}(Dt),ie=function(){function t(t,e,n){this.node_=t,this.ref_=e,this.index_=n}return t.prototype.val=function(){return g.validateArgCount("DataSnapshot.val",0,0,arguments.length),this.node_.val()},t.prototype.exportVal=function(){return g.validateArgCount("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},t.prototype.toJSON=function(){return g.validateArgCount("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},t.prototype.exists=function(){return g.validateArgCount("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},t.prototype.child=function(e){g.validateArgCount("DataSnapshot.child",0,1,arguments.length),e=String(e),Tt("DataSnapshot.child",1,e,!1);var n=new it(e),r=this.ref_.child(n);return new t(this.node_.getChild(n),r,Bt)},t.prototype.hasChild=function(t){g.validateArgCount("DataSnapshot.hasChild",1,1,arguments.length),Tt("DataSnapshot.hasChild",1,t,!1);var e=new it(t);return!this.node_.getChild(e).isEmpty()},t.prototype.getPriority=function(){return g.validateArgCount("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},t.prototype.forEach=function(e){var n=this;return g.validateArgCount("DataSnapshot.forEach",1,1,arguments.length),g.validateCallback("DataSnapshot.forEach",1,e,!1),!this.node_.isLeafNode()&&!!this.node_.forEachChild(this.index_,function(r,i){return e(new t(i,n.ref_.child(r),Bt))})},t.prototype.hasChildren=function(){return g.validateArgCount("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&&!this.node_.isEmpty()},Object.defineProperty(t.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!0,configurable:!0}),t.prototype.numChildren=function(){return g.validateArgCount("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},t.prototype.getRef=function(){return g.validateArgCount("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),t}(),oe=function(){function t(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}return t.prototype.getPath=function(){var t=this.snapshot.getRef();return"value"===this.eventType?t.path:t.getParent().path},t.prototype.getEventType=function(){return this.eventType},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+g.stringify(this.snapshot.exportVal())},t}(),ae=function(){function t(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}return t.prototype.getPath=function(){return this.path},t.prototype.getEventType=function(){return"cancel"},t.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},t.prototype.toString=function(){return this.path.toString()+":cancel"},t}(),se=function(){function t(t,e,n){this.callback_=t,this.cancelCallback_=e,this.context_=n}return t.prototype.respondsTo=function(t){return"value"===t},t.prototype.createEvent=function(t,e){var n=e.getQueryParams().getIndex();return new oe("value",this,new ie(t.snapshotNode,e.getRef(),n))},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){g.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callback_;return function(){r.call(e,t.snapshot)}},t.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new ae(this,t,e):null},t.prototype.matches=function(e){return e instanceof t&&(!e.callback_||!this.callback_||e.callback_===this.callback_&&e.context_===this.context_)},t.prototype.hasAnyCallback=function(){return null!==this.callback_},t}(),ue=function(){function t(t,e,n){this.callbacks_=t,this.cancelCallback_=e,this.context_=n}return t.prototype.respondsTo=function(t){var e="children_added"===t?"child_added":t;return e="children_removed"===e?"child_removed":e,g.contains(this.callbacks_,e)},t.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new ae(this,t,e):null},t.prototype.createEvent=function(t,e){g.assert(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),r=e.getQueryParams().getIndex();return new oe(t.type,this,new ie(t.snapshotNode,n,r),t.prevName)},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){g.assert(this.cancelCallback_,"Raising a cancel event on a listener with no cancel callback");var n=this.cancelCallback_;return function(){n.call(e,t.error)}}var r=this.callbacks_[t.eventType];return function(){r.call(e,t.snapshot,t.prevName)}},t.prototype.matches=function(e){if(e instanceof t){if(!this.callbacks_||!e.callbacks_)return!0;if(this.context_===e.context_){var n=g.getCount(e.callbacks_);if(n===g.getCount(this.callbacks_)){if(1===n){var r=g.getAnyKey(e.callbacks_),i=g.getAnyKey(this.callbacks_);return i===r&&(!e.callbacks_[r]||!this.callbacks_[i]||e.callbacks_[r]===this.callbacks_[i])}return g.every(this.callbacks_,function(t,n){return e.callbacks_[t]===n})}}}return!1},t.prototype.hasAnyCallback=function(){return null!==this.callbacks_},t}(),ce=function(){function t(t,e,n,r){this.repo=t,this.path=e,this.queryParams_=n,this.orderByCalled_=r}return Object.defineProperty(t,"__referenceConstructor",{get:function(){return g.assert(Zt,"Reference.ts has not been loaded"),Zt},set:function(t){Zt=t},enumerable:!0,configurable:!0}),t.validateQueryEndpoints_=function(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===xt){var r="Query: When ordering by key, you may only pass one argument to startAt(), endAt(), or equalTo().",i="Query: When ordering by key, the argument passed to startAt(), endAt(),or equalTo() must be a string.";if(t.hasStart()){if(t.getIndexStartName()!=j)throw new Error(r);if("string"!==typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!=q)throw new Error(r);if("string"!==typeof n)throw new Error(i)}}else if(t.getIndex()===Bt){if(null!=e&&!yt(e)||null!=n&&!yt(n))throw new Error("Query: When ordering by priority, the first argument passed to startAt(), endAt(), or equalTo() must be a valid priority value (null, a number, or a string).")}else if(g.assert(t.getIndex()instanceof re||t.getIndex()===ne,"unknown index type."),null!=e&&"object"===typeof e||null!=n&&"object"===typeof n)throw new Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},t.validateLimit_=function(t){if(t.hasStart()&&t.hasEnd()&&t.hasLimit()&&!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},t.prototype.validateNoPreviousOrderByCall_=function(t){if(!0===this.orderByCalled_)throw new Error(t+": You can't combine multiple orderBy calls.")},t.prototype.getQueryParams=function(){return this.queryParams_},t.prototype.getRef=function(){return g.validateArgCount("Query.ref",0,0,arguments.length),new t.__referenceConstructor(this.repo,this.path)},t.prototype.on=function(e,n,r,i){g.validateArgCount("Query.on",2,4,arguments.length),wt("Query.on",1,e,!1),g.validateCallback("Query.on",2,n,!1);var o=t.getCancelAndContextArgs_("Query.on",r,i);if("value"===e)this.onValueEvent(n,o.cancel,o.context);else{var a={};a[e]=n,this.onChildEvent(a,o.cancel,o.context)}return n},t.prototype.onValueEvent=function(t,e,n){var r=new se(t,e||null,n||null);this.repo.addEventCallbackForQuery(this,r)},t.prototype.onChildEvent=function(t,e,n){var r=new ue(t,e,n);this.repo.addEventCallbackForQuery(this,r)},t.prototype.off=function(t,e,n){g.validateArgCount("Query.off",0,3,arguments.length),wt("Query.off",1,t,!0),g.validateCallback("Query.off",2,e,!0),g.validateContextObject("Query.off",3,n,!0);var r=null,i=null;if("value"===t){r=new se(e||null,null,n||null)}else t&&(e&&(i={},i[t]=e),r=new ue(i,null,n||null));this.repo.removeEventCallbackForQuery(this,r)},t.prototype.once=function(e,n,r,i){var o=this;g.validateArgCount("Query.once",1,4,arguments.length),wt("Query.once",1,e,!1),g.validateCallback("Query.once",2,n,!0);var a=t.getCancelAndContextArgs_("Query.once",r,i),s=!0,u=new g.Deferred;u.promise.catch(function(){});var c=function(t){s&&(s=!1,o.off(e,c),n&&n.bind(a.context)(t),u.resolve(t))};return this.on(e,c,function(t){o.off(e,c),a.cancel&&a.cancel.bind(a.context)(t),u.reject(t)}),u.promise},t.prototype.limitToFirst=function(e){if(g.validateArgCount("Query.limitToFirst",1,1,arguments.length),"number"!==typeof e||Math.floor(e)!==e||e<=0)throw new Error("Query.limitToFirst: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToFirst: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new t(this.repo,this.path,this.queryParams_.limitToFirst(e),this.orderByCalled_)},t.prototype.limitToLast=function(e){if(g.validateArgCount("Query.limitToLast",1,1,arguments.length),"number"!==typeof e||Math.floor(e)!==e||e<=0)throw new Error("Query.limitToLast: First argument must be a positive integer.");if(this.queryParams_.hasLimit())throw new Error("Query.limitToLast: Limit was already set (by another call to limit, limitToFirst, or limitToLast).");return new t(this.repo,this.path,this.queryParams_.limitToLast(e),this.orderByCalled_)},t.prototype.orderByChild=function(e){if(g.validateArgCount("Query.orderByChild",1,1,arguments.length),"$key"===e)throw new Error('Query.orderByChild: "$key" is invalid. Use Query.orderByKey() instead.');if("$priority"===e)throw new Error('Query.orderByChild: "$priority" is invalid. Use Query.orderByPriority() instead.');if("$value"===e)throw new Error('Query.orderByChild: "$value" is invalid. Use Query.orderByValue() instead.');Tt("Query.orderByChild",1,e,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");var n=new it(e);if(n.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");var r=new re(n),i=this.queryParams_.orderBy(r);return t.validateQueryEndpoints_(i),new t(this.repo,this.path,i,!0)},t.prototype.orderByKey=function(){g.validateArgCount("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var e=this.queryParams_.orderBy(xt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByPriority=function(){g.validateArgCount("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var e=this.queryParams_.orderBy(Bt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByValue=function(){g.validateArgCount("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var e=this.queryParams_.orderBy(ne);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.startAt=function(e,n){void 0===e&&(e=null),g.validateArgCount("Query.startAt",0,2,arguments.length),mt("Query.startAt",1,e,this.path,!0),Et("Query.startAt",2,n,!0);var r=this.queryParams_.startAt(e,n);if(t.validateLimit_(r),t.validateQueryEndpoints_(r),this.queryParams_.hasStart())throw new Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return void 0===e&&(e=null,n=null),new t(this.repo,this.path,r,this.orderByCalled_)},t.prototype.endAt=function(e,n){void 0===e&&(e=null),g.validateArgCount("Query.endAt",0,2,arguments.length),mt("Query.endAt",1,e,this.path,!0),Et("Query.endAt",2,n,!0);var r=this.queryParams_.endAt(e,n);if(t.validateLimit_(r),t.validateQueryEndpoints_(r),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new t(this.repo,this.path,r,this.orderByCalled_)},t.prototype.equalTo=function(t,e){if(g.validateArgCount("Query.equalTo",1,2,arguments.length),mt("Query.equalTo",1,t,this.path,!1),Et("Query.equalTo",2,e,!0),this.queryParams_.hasStart())throw new Error("Query.equalTo: Starting point was already set (by another call to startAt or equalTo).");if(this.queryParams_.hasEnd())throw new Error("Query.equalTo: Ending point was already set (by another call to endAt or equalTo).");return this.startAt(t,e).endAt(t,e)},t.prototype.toString=function(){return g.validateArgCount("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},t.prototype.toJSON=function(){return g.validateArgCount("Query.toJSON",0,1,arguments.length),this.toString()},t.prototype.queryObject=function(){return this.queryParams_.getQueryObject()},t.prototype.queryIdentifier=function(){var t=this.queryObject(),e=G(t);return"{}"===e?"default":e},t.prototype.isEqual=function(e){if(g.validateArgCount("Query.isEqual",1,1,arguments.length),!(e instanceof t)){throw new Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.")}var n=this.repo===e.repo,r=this.path.equals(e.path),i=this.queryIdentifier()===e.queryIdentifier();return n&&r&&i},t.getCancelAndContextArgs_=function(t,e,n){var r={cancel:null,context:null};if(e&&n)r.cancel=e,g.validateCallback(t,3,r.cancel,!0),r.context=n,g.validateContextObject(t,4,r.context,!0);else if(e)if("object"===typeof e&&null!==e)r.context=e;else{if("function"!==typeof e)throw new Error(g.errorPrefix(t,3,!0)+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!0,configurable:!0}),t}(),le=function(){function t(){this.set={}}return t.prototype.add=function(t,e){this.set[t]=null===e||e},t.prototype.contains=function(t){return g.contains(this.set,t)},t.prototype.get=function(t){return this.contains(t)?this.set[t]:void 0},t.prototype.remove=function(t){delete this.set[t]},t.prototype.clear=function(){this.set={}},t.prototype.isEmpty=function(){return g.isEmpty(this.set)},t.prototype.count=function(){return g.getCount(this.set)},t.prototype.each=function(t){g.forEach(this.set,function(e,n){return t(e,n)})},t.prototype.keys=function(){var t=[];return g.forEach(this.set,function(e){t.push(e)}),t},t}(),he=function(){function t(){this.value_=null,this.children_=null}return t.prototype.find=function(t){if(null!=this.value_)return this.value_.getChild(t);if(t.isEmpty()||null==this.children_)return null;var e=t.getFront();if(t=t.popFront(),this.children_.contains(e)){return this.children_.get(e).find(t)}return null},t.prototype.remember=function(e,n){if(e.isEmpty())this.value_=n,this.children_=null;else if(null!==this.value_)this.value_=this.value_.updateChild(e,n);else{null==this.children_&&(this.children_=new le);var r=e.getFront();this.children_.contains(r)||this.children_.add(r,new t);var i=this.children_.get(r);e=e.popFront(),i.remember(e,n)}},t.prototype.forget=function(t){if(t.isEmpty())return this.value_=null,this.children_=null,!0;if(null!==this.value_){if(this.value_.isLeafNode())return!1;var e=this.value_;this.value_=null;var n=this;return e.forEachChild(Bt,function(t,e){n.remember(new it(t),e)}),this.forget(t)}if(null!==this.children_){var r=t.getFront();if(t=t.popFront(),this.children_.contains(r)){this.children_.get(r).forget(t)&&this.children_.remove(r)}return!!this.children_.isEmpty()&&(this.children_=null,!0)}return!0},t.prototype.forEachTree=function(t,e){null!==this.value_?e(t,this.value_):this.forEachChild(function(n,r){var i=new it(t.toString()+"/"+n);r.forEachTree(i,e)})},t.prototype.forEachChild=function(t){null!==this.children_&&this.children_.each(function(e,n){t(e,n)})},t}(),fe=function(t){return t=t||{},t.timestamp=t.timestamp||(new Date).getTime(),t},pe=function(t,e){return t&&"object"===typeof t?(g.assert(".sv"in t,"Unexpected leaf node or priority contents"),e[t[".sv"]]):t},de=function(t,e){var n=new he;return t.forEachTree(new it(""),function(t,r){n.remember(t,ye(r,e))}),n},ye=function(t,e){var n,r=t.getPriority().val(),i=pe(r,e);if(t.isLeafNode()){var o=t,a=pe(o.getValue(),e);return a!==o.getValue()||i!==o.getPriority().val()?new Ft(a,u(i)):t}var s=t;return n=s,i!==s.getPriority().val()&&(n=n.updatePriority(new Ft(i))),s.forEachChild(Bt,function(t,r){var i=ye(r,e);i!==r&&(n=n.updateImmediateChild(t,i))}),n};!function(t){t[t.OVERWRITE=0]="OVERWRITE",t[t.MERGE=1]="MERGE",t[t.ACK_USER_WRITE=2]="ACK_USER_WRITE",t[t.LISTEN_COMPLETE=3]="LISTEN_COMPLETE"}(te||(te={}));var me,ge,ve=function(){function t(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,g.assert(!r||e,"Tagged queries must be from server.")}return t.User=new t(!0,!1,null,!1),t.Server=new t(!1,!0,null,!1),t.forServerTaggedQuery=function(e){return new t(!1,!0,e,!0)},t}(),be=function(){function t(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=te.ACK_USER_WRITE,this.source=ve.User}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return g.assert(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var n=this.affectedTree.subtree(new it(e));return new t(it.Empty,n,this.revert)}return g.assert(this.path.getFront()===e,"operationForChild called for unrelated child."),new t(this.path.popFront(),this.affectedTree,this.revert)},t}(),_e=function(){return me||(me=new Wt(K)),me},we=function(){function t(t,e){void 0===e&&(e=_e()),this.value=t,this.children=e}return t.fromObject=function(e){var n=t.Empty;return g.forEach(e,function(t,e){n=n.set(new it(t),e)}),n},t.prototype.isEmpty=function(){return null===this.value&&this.children.isEmpty()},t.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&&e(this.value))return{path:it.Empty,value:this.value};if(t.isEmpty())return null;var n=t.getFront(),r=this.children.get(n);if(null!==r){var i=r.findRootMostMatchingPathAndValue(t.popFront(),e);if(null!=i){return{path:new it(n).child(i.path),value:i.value}}return null}return null},t.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,function(){return!0})},t.prototype.subtree=function(e){if(e.isEmpty())return this;var n=e.getFront(),r=this.children.get(n);return null!==r?r.subtree(e.popFront()):t.Empty},t.prototype.set=function(e,n){if(e.isEmpty())return new t(n,this.children);var r=e.getFront(),i=this.children.get(r)||t.Empty,o=i.set(e.popFront(),n),a=this.children.insert(r,o);return new t(this.value,a)},t.prototype.remove=function(e){if(e.isEmpty())return this.children.isEmpty()?t.Empty:new t(null,this.children);var n=e.getFront(),r=this.children.get(n);if(r){var i=r.remove(e.popFront()),o=void 0;return o=i.isEmpty()?this.children.remove(n):this.children.insert(n,i),null===this.value&&o.isEmpty()?t.Empty:new t(this.value,o)}return this},t.prototype.get=function(t){if(t.isEmpty())return this.value;var e=t.getFront(),n=this.children.get(e);return n?n.get(t.popFront()):null},t.prototype.setTree=function(e,n){if(e.isEmpty())return n;var r=e.getFront(),i=this.children.get(r)||t.Empty,o=i.setTree(e.popFront(),n),a=void 0;return a=o.isEmpty()?this.children.remove(r):this.children.insert(r,o),new t(this.value,a)},t.prototype.fold=function(t){return this.fold_(it.Empty,t)},t.prototype.fold_=function(t,e){var n={};return this.children.inorderTraversal(function(r,i){n[r]=i.fold_(t.child(r),e)}),e(t,this.value,n)},t.prototype.findOnPath=function(t,e){return this.findOnPath_(t,it.Empty,e)},t.prototype.findOnPath_=function(t,e,n){var r=!!this.value&&n(e,this.value);if(r)return r;if(t.isEmpty())return null;var i=t.getFront(),o=this.children.get(i);return o?o.findOnPath_(t.popFront(),e.child(i),n):null},t.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,it.Empty,e)},t.prototype.foreachOnPath_=function(e,n,r){if(e.isEmpty())return this;this.value&&r(n,this.value);var i=e.getFront(),o=this.children.get(i);return o?o.foreachOnPath_(e.popFront(),n.child(i),r):t.Empty},t.prototype.foreach=function(t){this.foreach_(it.Empty,t)},t.prototype.foreach_=function(t,e){this.children.inorderTraversal(function(n,r){r.foreach_(t.child(n),e)}),this.value&&e(t,this.value)},t.prototype.foreachChild=function(t){this.children.inorderTraversal(function(e,n){n.value&&t(e,n.value)})},t.Empty=new t(null),t}(),Ee=function(){function t(t,e){this.source=t,this.path=e,this.type=te.LISTEN_COMPLETE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,it.Empty):new t(this.source,this.path.popFront())},t}(),Te=function(){function t(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=te.OVERWRITE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,it.Empty,this.snap.getImmediateChild(e)):new t(this.source,this.path.popFront(),this.snap)},t}(),Se=function(){function t(t,e,n){this.source=t,this.path=e,this.children=n,this.type=te.MERGE}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){var n=this.children.subtree(new it(e));return n.isEmpty()?null:n.value?new Te(this.source,it.Empty,n.value):new t(this.source,it.Empty,n)}return g.assert(this.path.getFront()===e,"Can't get a merge for a child not on the path of the operation"),new t(this.source,this.path.popFront(),this.children)},t.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},t}(),Ce=function(){function t(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}return t.prototype.isFullyInitialized=function(){return this.fullyInitialized_},t.prototype.isFiltered=function(){return this.filtered_},t.prototype.isCompleteForPath=function(t){if(t.isEmpty())return this.isFullyInitialized()&&!this.filtered_;var e=t.getFront();return this.isCompleteForChild(e)},t.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&&!this.filtered_||this.node_.hasChild(t)},t.prototype.getNode=function(){return this.node_},t}(),Ie=function(){function t(t,e){this.eventCache_=t,this.serverCache_=e}return t.prototype.updateEventSnap=function(e,n,r){return new t(new Ce(e,n,r),this.serverCache_)},t.prototype.updateServerSnap=function(e,n,r){return new t(this.eventCache_,new Ce(e,n,r))},t.prototype.getEventCache=function(){return this.eventCache_},t.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},t.prototype.getServerCache=function(){return this.serverCache_},t.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},t.Empty=new t(new Ce(Yt.EMPTY_NODE,!1,!1),new Ce(Yt.EMPTY_NODE,!1,!1)),t}(),Ne=function(){function t(t,e,n,r,i){this.type=t,this.snapshotNode=e,this.childName=n,this.oldSnap=r,this.prevName=i}return t.valueChange=function(e){return new t(t.VALUE,e)},t.childAddedChange=function(e,n){return new t(t.CHILD_ADDED,n,e)},t.childRemovedChange=function(e,n){return new t(t.CHILD_REMOVED,n,e)},t.childChangedChange=function(e,n,r){return new t(t.CHILD_CHANGED,n,e,r)},t.childMovedChange=function(e,n){return new t(t.CHILD_MOVED,n,e)},t.CHILD_ADDED="child_added",t.CHILD_REMOVED="child_removed",t.CHILD_CHANGED="child_changed",t.CHILD_MOVED="child_moved",t.VALUE="value",t}(),ke=function(){function t(t){this.index_=t}return t.prototype.updateChild=function(t,e,n,r,i,o){g.assert(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");var a=t.getImmediateChild(e);return a.getChild(r).equals(n.getChild(r))&&a.isEmpty()==n.isEmpty()?t:(null!=o&&(n.isEmpty()?t.hasChild(e)?o.trackChildChange(Ne.childRemovedChange(e,a)):g.assert(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):a.isEmpty()?o.trackChildChange(Ne.childAddedChange(e,n)):o.trackChildChange(Ne.childChangedChange(e,n,a))),t.isLeafNode()&&n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},t.prototype.updateFullNode=function(t,e,n){return null!=n&&(t.isLeafNode()||t.forEachChild(Bt,function(t,r){e.hasChild(t)||n.trackChildChange(Ne.childRemovedChange(t,r))}),e.isLeafNode()||e.forEachChild(Bt,function(e,r){if(t.hasChild(e)){var i=t.getImmediateChild(e);i.equals(r)||n.trackChildChange(Ne.childChangedChange(e,r,i))}else n.trackChildChange(Ne.childAddedChange(e,r))})),e.withIndex(this.index_)},t.prototype.updatePriority=function(t,e){return t.isEmpty()?Yt.EMPTY_NODE:t.updatePriority(e)},t.prototype.filtersNodes=function(){return!1},t.prototype.getIndexedFilter=function(){return this},t.prototype.getIndex=function(){return this.index_},t}(),Ae=function(){function t(){this.changeMap_={}}return t.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;g.assert(e==Ne.CHILD_ADDED||e==Ne.CHILD_CHANGED||e==Ne.CHILD_REMOVED,"Only child changes supported for tracking"),g.assert(".priority"!==n,"Only non-priority child changes can be tracked.");var r=g.safeGet(this.changeMap_,n);if(r){var i=r.type;if(e==Ne.CHILD_ADDED&&i==Ne.CHILD_REMOVED)this.changeMap_[n]=Ne.childChangedChange(n,t.snapshotNode,r.snapshotNode);else if(e==Ne.CHILD_REMOVED&&i==Ne.CHILD_ADDED)delete this.changeMap_[n];else if(e==Ne.CHILD_REMOVED&&i==Ne.CHILD_CHANGED)this.changeMap_[n]=Ne.childRemovedChange(n,r.oldSnap);else if(e==Ne.CHILD_CHANGED&&i==Ne.CHILD_ADDED)this.changeMap_[n]=Ne.childAddedChange(n,t.snapshotNode);else{if(e!=Ne.CHILD_CHANGED||i!=Ne.CHILD_CHANGED)throw g.assertionError("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap_[n]=Ne.childChangedChange(n,t.snapshotNode,r.oldSnap)}}else this.changeMap_[n]=t},t.prototype.getChanges=function(){return g.getValues(this.changeMap_)},t}(),Re=function(){function t(){}return t.prototype.getCompleteChild=function(t){return null},t.prototype.getChildAfterChild=function(t,e,n){return null},t}(),Oe=new Re,De=function(){function t(t,e,n){void 0===n&&(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}return t.prototype.getCompleteChild=function(t){var e=this.viewCache_.getEventCache();if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);var n=null!=this.optCompleteServerCache_?new Ce(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(t,n)},t.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:this.viewCache_.getCompleteServerSnap(),i=this.writes_.calcIndexedSlice(r,e,1,n,t);return 0===i.length?null:i[0]},t}(),Pe=function(){function t(t,e){this.viewCache=t,this.changes=e}return t}(),xe=function(){function t(t){this.filter_=t}return t.prototype.assertIndexed=function(t){g.assert(t.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),g.assert(t.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},t.prototype.applyOperation=function(e,n,r,i){var o,a,s=new Ae;if(n.type===te.OVERWRITE){var u=n;u.source.fromUser?o=this.applyUserOverwrite_(e,u.path,u.snap,r,i,s):(g.assert(u.source.fromServer,"Unknown source."),a=u.source.tagged||e.getServerCache().isFiltered()&&!u.path.isEmpty(),o=this.applyServerOverwrite_(e,u.path,u.snap,r,i,a,s))}else if(n.type===te.MERGE){var c=n;c.source.fromUser?o=this.applyUserMerge_(e,c.path,c.children,r,i,s):(g.assert(c.source.fromServer,"Unknown source."),a=c.source.tagged||e.getServerCache().isFiltered(),o=this.applyServerMerge_(e,c.path,c.children,r,i,a,s))}else if(n.type===te.ACK_USER_WRITE){var l=n;o=l.revert?this.revertUserWrite_(e,l.path,r,i,s):this.ackUserWrite_(e,l.path,l.affectedTree,r,i,s)}else{if(n.type!==te.LISTEN_COMPLETE)throw g.assertionError("Unknown operation type: "+n.type);o=this.listenComplete_(e,n.path,r,s)}var h=s.getChanges();return t.maybeAddValueEvent_(e,o,h),new Pe(o,h)},t.maybeAddValueEvent_=function(t,e,n){var r=e.getEventCache();if(r.isFullyInitialized()){var i=r.getNode().isLeafNode()||r.getNode().isEmpty(),o=t.getCompleteEventSnap();(n.length>0||!t.getEventCache().isFullyInitialized()||i&&!r.getNode().equals(o)||!r.getNode().getPriority().equals(o.getPriority()))&&n.push(Ne.valueChange(e.getCompleteEventSnap()))}},t.prototype.generateEventCacheAfterServerEvent_=function(t,e,n,r,i){var o=t.getEventCache();if(null!=n.shadowingWrite(e))return t;var a=void 0,s=void 0;if(e.isEmpty())if(g.assert(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()){var u=t.getCompleteServerSnap(),c=u instanceof Yt?u:Yt.EMPTY_NODE,l=n.calcCompleteEventChildren(c);a=this.filter_.updateFullNode(t.getEventCache().getNode(),l,i)}else{var h=n.calcCompleteEventCache(t.getCompleteServerSnap());a=this.filter_.updateFullNode(t.getEventCache().getNode(),h,i)}else{var f=e.getFront();if(".priority"==f){g.assert(1==e.getLength(),"Can't have a priority with additional path components");var p=o.getNode();s=t.getServerCache().getNode();var d=n.calcEventCacheAfterServerOverwrite(e,p,s);a=null!=d?this.filter_.updatePriority(p,d):o.getNode()}else{var y=e.popFront(),m=void 0;if(o.isCompleteForChild(f)){s=t.getServerCache().getNode();var v=n.calcEventCacheAfterServerOverwrite(e,o.getNode(),s);m=null!=v?o.getNode().getImmediateChild(f).updateChild(y,v):o.getNode().getImmediateChild(f)}else m=n.calcCompleteChild(f,t.getServerCache());a=null!=m?this.filter_.updateChild(o.getNode(),f,m,y,r,i):o.getNode()}}return t.updateEventSnap(a,o.isFullyInitialized()||e.isEmpty(),this.filter_.filtersNodes())},t.prototype.applyServerOverwrite_=function(t,e,n,r,i,o,a){var s,u=t.getServerCache(),c=o?this.filter_:this.filter_.getIndexedFilter();if(e.isEmpty())s=c.updateFullNode(u.getNode(),n,null);else if(c.filtersNodes()&&!u.isFiltered()){var l=u.getNode().updateChild(e,n);s=c.updateFullNode(u.getNode(),l,null)}else{var h=e.getFront();if(!u.isCompleteForPath(e)&&e.getLength()>1)return t;var f=e.popFront(),p=u.getNode().getImmediateChild(h),d=p.updateChild(f,n);s=".priority"==h?c.updatePriority(u.getNode(),d):c.updateChild(u.getNode(),h,d,f,Oe,null)}var y=t.updateServerSnap(s,u.isFullyInitialized()||e.isEmpty(),c.filtersNodes()),m=new De(r,y,i);return this.generateEventCacheAfterServerEvent_(y,e,r,m,a)},t.prototype.applyUserOverwrite_=function(t,e,n,r,i,o){var a,s,u=t.getEventCache(),c=new De(r,t,i);if(e.isEmpty())s=this.filter_.updateFullNode(t.getEventCache().getNode(),n,o),a=t.updateEventSnap(s,!0,this.filter_.filtersNodes());else{var l=e.getFront();if(".priority"===l)s=this.filter_.updatePriority(t.getEventCache().getNode(),n),a=t.updateEventSnap(s,u.isFullyInitialized(),u.isFiltered());else{var h=e.popFront(),f=u.getNode().getImmediateChild(l),p=void 0;if(h.isEmpty())p=n;else{var d=c.getCompleteChild(l);p=null!=d?".priority"===h.getBack()&&d.getChild(h.parent()).isEmpty()?d:d.updateChild(h,n):Yt.EMPTY_NODE}if(f.equals(p))a=t;else{var y=this.filter_.updateChild(u.getNode(),l,p,h,c,o);a=t.updateEventSnap(y,u.isFullyInitialized(),this.filter_.filtersNodes())}}}return a},t.cacheHasChild_=function(t,e){return t.getEventCache().isCompleteForChild(e)},t.prototype.applyUserMerge_=function(e,n,r,i,o,a){var s=this,u=e;return r.foreach(function(r,c){var l=n.child(r);t.cacheHasChild_(e,l.getFront())&&(u=s.applyUserOverwrite_(u,l,c,i,o,a))}),r.foreach(function(r,c){var l=n.child(r);t.cacheHasChild_(e,l.getFront())||(u=s.applyUserOverwrite_(u,l,c,i,o,a))}),u},t.prototype.applyMerge_=function(t,e){return e.foreach(function(e,n){t=t.updateChild(e,n)}),t},t.prototype.applyServerMerge_=function(t,e,n,r,i,o,a){var s=this;if(t.getServerCache().getNode().isEmpty()&&!t.getServerCache().isFullyInitialized())return t;var u,c=t;u=e.isEmpty()?n:we.Empty.setTree(e,n);var l=t.getServerCache().getNode();return u.children.inorderTraversal(function(e,n){if(l.hasChild(e)){var u=t.getServerCache().getNode().getImmediateChild(e),h=s.applyMerge_(u,n);c=s.applyServerOverwrite_(c,new it(e),h,r,i,o,a)}}),u.children.inorderTraversal(function(e,n){var u=!t.getServerCache().isCompleteForChild(e)&&null==n.value;if(!l.hasChild(e)&&!u){var h=t.getServerCache().getNode().getImmediateChild(e),f=s.applyMerge_(h,n);c=s.applyServerOverwrite_(c,new it(e),f,r,i,o,a)}}),c},t.prototype.ackUserWrite_=function(t,e,n,r,i,o){if(null!=r.shadowingWrite(e))return t;var a=t.getServerCache().isFiltered(),s=t.getServerCache();if(null!=n.value){if(e.isEmpty()&&s.isFullyInitialized()||s.isCompleteForPath(e))return this.applyServerOverwrite_(t,e,s.getNode().getChild(e),r,i,a,o);if(e.isEmpty()){var u=we.Empty;return s.getNode().forEachChild(xt,function(t,e){u=u.set(new it(t),e)}),this.applyServerMerge_(t,e,u,r,i,a,o)}return t}var c=we.Empty;return n.foreach(function(t,n){var r=e.child(t);s.isCompleteForPath(r)&&(c=c.set(t,s.getNode().getChild(r)))}),this.applyServerMerge_(t,e,c,r,i,a,o)},t.prototype.listenComplete_=function(t,e,n,r){var i=t.getServerCache(),o=t.updateServerSnap(i.getNode(),i.isFullyInitialized()||e.isEmpty(),i.isFiltered());return this.generateEventCacheAfterServerEvent_(o,e,n,Oe,r)},t.prototype.revertUserWrite_=function(t,e,n,r,i){var o;if(null!=n.shadowingWrite(e))return t;var a=new De(n,t,r),s=t.getEventCache().getNode(),u=void 0;if(e.isEmpty()||".priority"===e.getFront()){var c=void 0;if(t.getServerCache().isFullyInitialized())c=n.calcCompleteEventCache(t.getCompleteServerSnap());else{var l=t.getServerCache().getNode();g.assert(l instanceof Yt,"serverChildren would be complete if leaf node"),c=n.calcCompleteEventChildren(l)}c=c,u=this.filter_.updateFullNode(s,c,i)}else{var h=e.getFront(),f=n.calcCompleteChild(h,t.getServerCache());null==f&&t.getServerCache().isCompleteForChild(h)&&(f=s.getImmediateChild(h)),u=null!=f?this.filter_.updateChild(s,h,f,e.popFront(),a,i):t.getEventCache().getNode().hasChild(h)?this.filter_.updateChild(s,h,Yt.EMPTY_NODE,e.popFront(),a,i):s,u.isEmpty()&&t.getServerCache().isFullyInitialized()&&(o=n.calcCompleteEventCache(t.getCompleteServerSnap()),o.isLeafNode()&&(u=this.filter_.updateFullNode(u,o,i)))}return o=t.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(it.Empty),t.updateEventSnap(u,o,this.filter_.filtersNodes())},t}(),Le=function(){function t(t){this.query_=t,this.index_=this.query_.getQueryParams().getIndex()}return t.prototype.generateEventsForChanges=function(t,e,n){var r=this,i=[],o=[];return t.forEach(function(t){t.type===Ne.CHILD_CHANGED&&r.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(Ne.childMovedChange(t.childName,t.snapshotNode))}),this.generateEventsForType_(i,Ne.CHILD_REMOVED,t,n,e),this.generateEventsForType_(i,Ne.CHILD_ADDED,t,n,e),this.generateEventsForType_(i,Ne.CHILD_MOVED,o,n,e),this.generateEventsForType_(i,Ne.CHILD_CHANGED,t,n,e),this.generateEventsForType_(i,Ne.VALUE,t,n,e),i},t.prototype.generateEventsForType_=function(t,e,n,r,i){var o=this,a=n.filter(function(t){return t.type===e});a.sort(this.compareChanges_.bind(this)),a.forEach(function(e){var n=o.materializeSingleChange_(e,i);r.forEach(function(r){r.respondsTo(e.type)&&t.push(r.createEvent(n,o.query_))})})},t.prototype.materializeSingleChange_=function(t,e){return"value"===t.type||"child_removed"===t.type?t:(t.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.index_),t)},t.prototype.compareChanges_=function(t,e){if(null==t.childName||null==e.childName)throw g.assertionError("Should only compare child_ events.");var n=new Ot(t.childName,t.snapshotNode),r=new Ot(e.childName,e.snapshotNode);return this.index_.compare(n,r)},t}(),Me=function(){function t(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new ke(n.getIndex()),i=n.getNodeFilter();this.processor_=new xe(i);var o=e.getServerCache(),a=e.getEventCache(),s=r.updateFullNode(Yt.EMPTY_NODE,o.getNode(),null),u=i.updateFullNode(Yt.EMPTY_NODE,a.getNode(),null),c=new Ce(s,o.isFullyInitialized(),r.filtersNodes()),l=new Ce(u,a.isFullyInitialized(),i.filtersNodes());this.viewCache_=new Ie(l,c),this.eventGenerator_=new Le(this.query_)}return t.prototype.getQuery=function(){return this.query_},t.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},t.prototype.getCompleteServerCache=function(t){var e=this.viewCache_.getCompleteServerSnap();return e&&(this.query_.getQueryParams().loadsAllData()||!t.isEmpty()&&!e.getImmediateChild(t.getFront()).isEmpty())?e.getChild(t):null},t.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},t.prototype.addEventRegistration=function(t){this.eventRegistrations_.push(t)},t.prototype.removeEventRegistration=function(t,e){var n=[];if(e){g.assert(null==t,"A cancel should cancel all event registrations.");var r=this.query_.path;this.eventRegistrations_.forEach(function(t){e=e;var i=t.createCancelEvent(e,r);i&&n.push(i)})}if(t){for(var i=[],o=0;o<this.eventRegistrations_.length;++o){var a=this.eventRegistrations_[o];if(a.matches(t)){if(t.hasAnyCallback()){i=i.concat(this.eventRegistrations_.slice(o+1));break}}else i.push(a)}this.eventRegistrations_=i}else this.eventRegistrations_=[];return n},t.prototype.applyOperation=function(t,e,n){t.type===te.MERGE&&null!==t.source.queryId&&(g.assert(this.viewCache_.getCompleteServerSnap(),"We should always have a full cache before handling merges"),g.assert(this.viewCache_.getCompleteEventSnap(),"Missing event cache, even though we have a server cache"));var r=this.viewCache_,i=this.processor_.applyOperation(r,t,e,n);return this.processor_.assertIndexed(i.viewCache),g.assert(i.viewCache.getServerCache().isFullyInitialized()||!r.getServerCache().isFullyInitialized(),"Once a server snap is complete, it should never go back"),this.viewCache_=i.viewCache,this.generateEventsForChanges_(i.changes,i.viewCache.getEventCache().getNode(),null)},t.prototype.getInitialEvents=function(t){var e=this.viewCache_.getEventCache(),n=[];if(!e.getNode().isLeafNode()){e.getNode().forEachChild(Bt,function(t,e){n.push(Ne.childAddedChange(t,e))})}return e.isFullyInitialized()&&n.push(Ne.valueChange(e.getNode())),this.generateEventsForChanges_(n,e.getNode(),t)},t.prototype.generateEventsForChanges_=function(t,e,n){var r=n?[n]:this.eventRegistrations_;return this.eventGenerator_.generateEventsForChanges(t,e,r)},t}(),Fe=function(){function t(){this.views_={}}return Object.defineProperty(t,"__referenceConstructor",{get:function(){return g.assert(ge,"Reference.ts has not been loaded"),ge},set:function(t){g.assert(!ge,"__referenceConstructor has already been defined"),ge=t},enumerable:!0,configurable:!0}),t.prototype.isEmpty=function(){return g.isEmpty(this.views_)},t.prototype.applyOperation=function(t,e,n){var r=t.source.queryId;if(null!==r){var i=g.safeGet(this.views_,r);return g.assert(null!=i,"SyncTree gave us an op for an invalid query."),i.applyOperation(t,e,n)}var o=[];return g.forEach(this.views_,function(r,i){o=o.concat(i.applyOperation(t,e,n))}),o},t.prototype.addEventRegistration=function(t,e,n,r,i){var o=t.queryIdentifier(),a=g.safeGet(this.views_,o);if(!a){var s=n.calcCompleteEventCache(i?r:null),u=!1;s?u=!0:r instanceof Yt?(s=n.calcCompleteEventChildren(r),u=!1):(s=Yt.EMPTY_NODE,u=!1);var c=new Ie(new Ce(s,u,!1),new Ce(r,i,!1));a=new Me(t,c),this.views_[o]=a}return a.addEventRegistration(e),a.getInitialEvents(e)},t.prototype.removeEventRegistration=function(e,n,r){var i=e.queryIdentifier(),o=[],a=[],s=this.hasCompleteView();if("default"===i){var u=this;g.forEach(this.views_,function(t,e){a=a.concat(e.removeEventRegistration(n,r)),e.isEmpty()&&(delete u.views_[t],e.getQuery().getQueryParams().loadsAllData()||o.push(e.getQuery()))})}else{var c=g.safeGet(this.views_,i);c&&(a=a.concat(c.removeEventRegistration(n,r)),c.isEmpty()&&(delete this.views_[i],c.getQuery().getQueryParams().loadsAllData()||o.push(c.getQuery())))}return s&&!this.hasCompleteView()&&o.push(new t.__referenceConstructor(e.repo,e.path)),{removed:o,events:a}},t.prototype.getQueryViews=function(){var t=this;return Object.keys(this.views_).map(function(e){return t.views_[e]}).filter(function(t){return!t.getQuery().getQueryParams().loadsAllData()})},t.prototype.getCompleteServerCache=function(t){var e=null;return g.forEach(this.views_,function(n,r){e=e||r.getCompleteServerCache(t)}),e},t.prototype.viewForQuery=function(t){if(t.getQueryParams().loadsAllData())return this.getCompleteView();var e=t.queryIdentifier();return g.safeGet(this.views_,e)},t.prototype.viewExistsForQuery=function(t){return null!=this.viewForQuery(t)},t.prototype.hasCompleteView=function(){return null!=this.getCompleteView()},t.prototype.getCompleteView=function(){return g.findValue(this.views_,function(t){return t.getQuery().getQueryParams().loadsAllData()})||null},t}(),Ue=function(){function t(t){this.writeTree_=t}return t.prototype.addWrite=function(e,n){if(e.isEmpty())return new t(new we(n));var r=this.writeTree_.findRootMostValueAndPath(e);if(null!=r){var i=r.path,o=r.value,a=it.relativePath(i,e);return o=o.updateChild(a,n),new t(this.writeTree_.set(i,o))}var s=new we(n);return new t(this.writeTree_.setTree(e,s))},t.prototype.addWrites=function(t,e){var n=this;return g.forEach(e,function(e,r){n=n.addWrite(t.child(e),r)}),n},t.prototype.removeWrite=function(e){return e.isEmpty()?t.Empty:new t(this.writeTree_.setTree(e,we.Empty))},t.prototype.hasCompleteWrite=function(t){return null!=this.getCompleteNode(t)},t.prototype.getCompleteNode=function(t){var e=this.writeTree_.findRootMostValueAndPath(t);return null!=e?this.writeTree_.get(e.path).getChild(it.relativePath(e.path,t)):null},t.prototype.getCompleteChildren=function(){var t=[],e=this.writeTree_.value;return null!=e?e.isLeafNode()||e.forEachChild(Bt,function(e,n){t.push(new Ot(e,n))}):this.writeTree_.children.inorderTraversal(function(e,n){null!=n.value&&t.push(new Ot(e,n.value))}),t},t.prototype.childCompoundWrite=function(e){if(e.isEmpty())return this;var n=this.getCompleteNode(e);return new t(null!=n?new we(n):this.writeTree_.subtree(e))},t.prototype.isEmpty=function(){return this.writeTree_.isEmpty()},t.prototype.apply=function(e){return t.applySubtreeWrite_(it.Empty,this.writeTree_,e)},t.Empty=new t(new we(null)),t.applySubtreeWrite_=function(e,n,r){if(null!=n.value)return r.updateChild(e,n.value);var i=null;return n.children.inorderTraversal(function(n,o){".priority"===n?(g.assert(null!==o.value,"Priority writes must always be leaf nodes"),i=o.value):r=t.applySubtreeWrite_(e.child(n),o,r)}),r.getChild(e).isEmpty()||null===i||(r=r.updateChild(e.child(".priority"),i)),r},t}(),Be=function(){function t(){this.visibleWrites_=Ue.Empty,this.allWrites_=[],this.lastWriteId_=-1}return t.prototype.childWrites=function(t){return new Ve(t,this)},t.prototype.addOverwrite=function(t,e,n,r){g.assert(n>this.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===r&&(r=!0),this.allWrites_.push({path:t,snap:e,writeId:n,visible:r}),r&&(this.visibleWrites_=this.visibleWrites_.addWrite(t,e)),this.lastWriteId_=n},t.prototype.addMerge=function(t,e,n){g.assert(n>this.lastWriteId_,"Stacking an older merge on top of newer ones"),this.allWrites_.push({path:t,children:e,writeId:n,visible:!0}),this.visibleWrites_=this.visibleWrites_.addWrites(t,e),this.lastWriteId_=n},t.prototype.getWrite=function(t){for(var e=0;e<this.allWrites_.length;e++){var n=this.allWrites_[e];if(n.writeId===t)return n}return null},t.prototype.removeWrite=function(t){var e=this,n=this.allWrites_.findIndex(function(e){return e.writeId===t});g.assert(n>=0,"removeWrite called with nonexistent writeId.");var r=this.allWrites_[n];this.allWrites_.splice(n,1);for(var i=r.visible,o=!1,a=this.allWrites_.length-1;i&&a>=0;){var s=this.allWrites_[a];s.visible&&(a>=n&&this.recordContainsPath_(s,r.path)?i=!1:r.path.contains(s.path)&&(o=!0)),a--}if(i){if(o)return this.resetTree_(),!0;if(r.snap)this.visibleWrites_=this.visibleWrites_.removeWrite(r.path);else{var u=r.children;g.forEach(u,function(t){e.visibleWrites_=e.visibleWrites_.removeWrite(r.path.child(t))})}return!0}return!1},t.prototype.getCompleteWriteData=function(t){return this.visibleWrites_.getCompleteNode(t)},t.prototype.calcCompleteEventCache=function(e,n,r,i){if(r||i){var o=this.visibleWrites_.childCompoundWrite(e);if(!i&&o.isEmpty())return n;if(i||null!=n||o.hasCompleteWrite(it.Empty)){var a=function(t){return(t.visible||i)&&(!r||!~r.indexOf(t.writeId))&&(t.path.contains(e)||e.contains(t.path))},s=t.layerTree_(this.allWrites_,a,e),u=n||Yt.EMPTY_NODE;return s.apply(u)}return null}var c=this.visibleWrites_.getCompleteNode(e);if(null!=c)return c;var l=this.visibleWrites_.childCompoundWrite(e);if(l.isEmpty())return n;if(null!=n||l.hasCompleteWrite(it.Empty)){var u=n||Yt.EMPTY_NODE;return l.apply(u)}return null},t.prototype.calcCompleteEventChildren=function(t,e){var n=Yt.EMPTY_NODE,r=this.visibleWrites_.getCompleteNode(t);if(r)return r.isLeafNode()||r.forEachChild(Bt,function(t,e){n=n.updateImmediateChild(t,e)}),n;if(e){var i=this.visibleWrites_.childCompoundWrite(t);return e.forEachChild(Bt,function(t,e){var r=i.childCompoundWrite(new it(t)).apply(e);n=n.updateImmediateChild(t,r)}),i.getCompleteChildren().forEach(function(t){n=n.updateImmediateChild(t.name,t.node)}),n}return this.visibleWrites_.childCompoundWrite(t).getCompleteChildren().forEach(function(t){n=n.updateImmediateChild(t.name,t.node)}),n},t.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n,r){g.assert(n||r,"Either existingEventSnap or existingServerSnap must exist");var i=t.child(e);if(this.visibleWrites_.hasCompleteWrite(i))return null;var o=this.visibleWrites_.childCompoundWrite(i);return o.isEmpty()?r.getChild(e):o.apply(r.getChild(e))},t.prototype.calcCompleteChild=function(t,e,n){var r=t.child(e),i=this.visibleWrites_.getCompleteNode(r);if(null!=i)return i;if(n.isCompleteForChild(e)){return this.visibleWrites_.childCompoundWrite(r).apply(n.getNode().getImmediateChild(e))}return null},t.prototype.shadowingWrite=function(t){return this.visibleWrites_.getCompleteNode(t)},t.prototype.calcIndexedSlice=function(t,e,n,r,i,o){var a,s=this.visibleWrites_.childCompoundWrite(t),u=s.getCompleteNode(it.Empty);if(null!=u)a=u;else{if(null==e)return[];a=s.apply(e)}if(a=a.withIndex(o),a.isEmpty()||a.isLeafNode())return[];for(var c=[],l=o.getCompare(),h=i?a.getReverseIteratorFrom(n,o):a.getIteratorFrom(n,o),f=h.getNext();f&&c.length<r;)0!==l(f,n)&&c.push(f),f=h.getNext();return c},t.prototype.recordContainsPath_=function(t,e){return t.snap?t.path.contains(e):!!g.findKey(t.children,function(n,r){return t.path.child(r).contains(e)})},t.prototype.resetTree_=function(){this.visibleWrites_=t.layerTree_(this.allWrites_,t.DefaultFilter_,it.Empty),this.allWrites_.length>0?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},t.DefaultFilter_=function(t){return t.visible},t.layerTree_=function(t,e,n){for(var r=Ue.Empty,i=0;i<t.length;++i){var o=t[i];if(e(o)){var a=o.path,s=void 0;if(o.snap)n.contains(a)?(s=it.relativePath(n,a),r=r.addWrite(s,o.snap)):a.contains(n)&&(s=it.relativePath(a,n),r=r.addWrite(it.Empty,o.snap.getChild(s)));else{if(!o.children)throw g.assertionError("WriteRecord should have .snap or .children");if(n.contains(a))s=it.relativePath(n,a),r=r.addWrites(s,o.children);else if(a.contains(n))if(s=it.relativePath(a,n),s.isEmpty())r=r.addWrites(it.Empty,o.children);else{var u=g.safeGet(o.children,s.getFront());if(u){var c=u.getChild(s.popFront());r=r.addWrite(it.Empty,c)}}}}}return r},t}(),Ve=function(){function t(t,e){this.treePath_=t,this.writeTree_=e}return t.prototype.calcCompleteEventCache=function(t,e,n){return this.writeTree_.calcCompleteEventCache(this.treePath_,t,e,n)},t.prototype.calcCompleteEventChildren=function(t){return this.writeTree_.calcCompleteEventChildren(this.treePath_,t)},t.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n){return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_,t,e,n)},t.prototype.shadowingWrite=function(t){return this.writeTree_.shadowingWrite(this.treePath_.child(t))},t.prototype.calcIndexedSlice=function(t,e,n,r,i){return this.writeTree_.calcIndexedSlice(this.treePath_,t,e,n,r,i)},t.prototype.calcCompleteChild=function(t,e){return this.writeTree_.calcCompleteChild(this.treePath_,t,e)},t.prototype.child=function(e){return new t(this.treePath_.child(e),this.writeTree_)},t}(),je=function(){function t(t){this.listenProvider_=t,this.syncPointTree_=we.Empty,this.pendingWriteTree_=new Be,this.tagToQueryMap_={},this.queryToTagMap_={}}return t.prototype.applyUserOverwrite=function(t,e,n,r){return this.pendingWriteTree_.addOverwrite(t,e,n,r),r?this.applyOperationToSyncPoints_(new Te(ve.User,t,e)):[]},t.prototype.applyUserMerge=function(t,e,n){this.pendingWriteTree_.addMerge(t,e,n);var r=we.fromObject(e);return this.applyOperationToSyncPoints_(new Se(ve.User,t,r))},t.prototype.ackUserWrite=function(t,e){void 0===e&&(e=!1);var n=this.pendingWriteTree_.getWrite(t);if(this.pendingWriteTree_.removeWrite(t)){var r=we.Empty;return null!=n.snap?r=r.set(it.Empty,!0):g.forEach(n.children,function(t,e){r=r.set(new it(t),e)}),this.applyOperationToSyncPoints_(new be(n.path,r,e))}return[]},t.prototype.applyServerOverwrite=function(t,e){return this.applyOperationToSyncPoints_(new Te(ve.Server,t,e))},t.prototype.applyServerMerge=function(t,e){var n=we.fromObject(e);return this.applyOperationToSyncPoints_(new Se(ve.Server,t,n))},t.prototype.applyListenComplete=function(t){return this.applyOperationToSyncPoints_(new Ee(ve.Server,t))},t.prototype.applyTaggedQueryOverwrite=function(e,n,r){var i=this.queryKeyForTag_(r);if(null!=i){var o=t.parseQueryKey_(i),a=o.path,s=o.queryId,u=it.relativePath(a,e),c=new Te(ve.forServerTaggedQuery(s),u,n);return this.applyTaggedOperation_(a,c)}return[]},t.prototype.applyTaggedQueryMerge=function(e,n,r){var i=this.queryKeyForTag_(r);if(i){var o=t.parseQueryKey_(i),a=o.path,s=o.queryId,u=it.relativePath(a,e),c=we.fromObject(n),l=new Se(ve.forServerTaggedQuery(s),u,c);return this.applyTaggedOperation_(a,l)}return[]},t.prototype.applyTaggedListenComplete=function(e,n){var r=this.queryKeyForTag_(n);if(r){var i=t.parseQueryKey_(r),o=i.path,a=i.queryId,s=it.relativePath(o,e),u=new Ee(ve.forServerTaggedQuery(a),s);return this.applyTaggedOperation_(o,u)}return[]},t.prototype.addEventRegistration=function(e,n){var r=e.path,i=null,o=!1;this.syncPointTree_.foreachOnPath(r,function(t,e){var n=it.relativePath(t,r);i=i||e.getCompleteServerCache(n),o=o||e.hasCompleteView()});var a=this.syncPointTree_.get(r);a?(o=o||a.hasCompleteView(),i=i||a.getCompleteServerCache(it.Empty)):(a=new Fe,this.syncPointTree_=this.syncPointTree_.set(r,a));var s;if(null!=i)s=!0;else{s=!1,i=Yt.EMPTY_NODE;this.syncPointTree_.subtree(r).foreachChild(function(t,e){var n=e.getCompleteServerCache(it.Empty);n&&(i=i.updateImmediateChild(t,n))})}var u=a.viewExistsForQuery(e);if(!u&&!e.getQueryParams().loadsAllData()){var c=t.makeQueryKey_(e);g.assert(!(c in this.queryToTagMap_),"View does not exist, but we have a tag");var l=t.getNextQueryTag_();this.queryToTagMap_[c]=l,this.tagToQueryMap_["_"+l]=c}var h=this.pendingWriteTree_.childWrites(r),f=a.addEventRegistration(e,n,h,i,s);if(!u&&!o){var p=a.viewForQuery(e);f=f.concat(this.setupListener_(e,p))}return f},t.prototype.removeEventRegistration=function(e,n,r){var i=this,o=e.path,a=this.syncPointTree_.get(o),s=[];if(a&&("default"===e.queryIdentifier()||a.viewExistsForQuery(e))){var u=a.removeEventRegistration(e,n,r);a.isEmpty()&&(this.syncPointTree_=this.syncPointTree_.remove(o));var c=u.removed;s=u.events;var l=-1!==c.findIndex(function(t){return t.getQueryParams().loadsAllData()}),h=this.syncPointTree_.findOnPath(o,function(t,e){return e.hasCompleteView()});if(l&&!h){var f=this.syncPointTree_.subtree(o);if(!f.isEmpty())for(var p=this.collectDistinctViewsForSubTree_(f),d=0;d<p.length;++d){var y=p[d],m=y.getQuery(),g=this.createListenerForView_(y);this.listenProvider_.startListening(t.queryForListening_(m),this.tagForQuery_(m),g.hashFn,g.onComplete)}}if(!h&&c.length>0&&!r)if(l){this.listenProvider_.stopListening(t.queryForListening_(e),null)}else c.forEach(function(e){var n=i.queryToTagMap_[t.makeQueryKey_(e)];i.listenProvider_.stopListening(t.queryForListening_(e),n)});this.removeTags_(c)}return s},t.prototype.calcCompleteEventCache=function(t,e){var n=this.pendingWriteTree_,r=this.syncPointTree_.findOnPath(t,function(e,n){var r=it.relativePath(e,t),i=n.getCompleteServerCache(r);if(i)return i});return n.calcCompleteEventCache(t,r,e,!0)},t.prototype.collectDistinctViewsForSubTree_=function(t){return t.fold(function(t,e,n){if(e&&e.hasCompleteView()){return[e.getCompleteView()]}var r=[];return e&&(r=e.getQueryViews()),g.forEach(n,function(t,e){r=r.concat(e)}),r})},t.prototype.removeTags_=function(e){for(var n=0;n<e.length;++n){var r=e[n];if(!r.getQueryParams().loadsAllData()){var i=t.makeQueryKey_(r),o=this.queryToTagMap_[i];delete this.queryToTagMap_[i],delete this.tagToQueryMap_["_"+o]}}},t.queryForListening_=function(t){return t.getQueryParams().loadsAllData()&&!t.getQueryParams().isDefault()?t.getRef():t},t.prototype.setupListener_=function(e,n){var r=e.path,i=this.tagForQuery_(e),o=this.createListenerForView_(n),a=this.listenProvider_.startListening(t.queryForListening_(e),i,o.hashFn,o.onComplete),s=this.syncPointTree_.subtree(r);if(i)g.assert(!s.value.hasCompleteView(),"If we're adding a query, it shouldn't be shadowed");else for(var u=s.fold(function(t,e,n){if(!t.isEmpty()&&e&&e.hasCompleteView())return[e.getCompleteView().getQuery()];var r=[];return e&&(r=r.concat(e.getQueryViews().map(function(t){return t.getQuery()}))),g.forEach(n,function(t,e){r=r.concat(e)}),r}),c=0;c<u.length;++c){var l=u[c];this.listenProvider_.stopListening(t.queryForListening_(l),this.tagForQuery_(l))}return a},t.prototype.createListenerForView_=function(t){var e=this,n=t.getQuery(),r=this.tagForQuery_(n);return{hashFn:function(){return(t.getServerCache()||Yt.EMPTY_NODE).hash()},onComplete:function(t){if("ok"===t)return r?e.applyTaggedListenComplete(n.path,r):e.applyListenComplete(n.path);var i=$(t,n);return e.removeEventRegistration(n,null,i)}}},t.makeQueryKey_=function(t){return t.path.toString()+"$"+t.queryIdentifier()},t.parseQueryKey_=function(t){var e=t.indexOf("$");return g.assert(-1!==e&&e<t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new it(t.substr(0,e))}},t.prototype.queryKeyForTag_=function(t){return this.tagToQueryMap_["_"+t]},t.prototype.tagForQuery_=function(e){var n=t.makeQueryKey_(e);return g.safeGet(this.queryToTagMap_,n)},t.getNextQueryTag_=function(){return t.nextQueryTag_++},t.prototype.applyTaggedOperation_=function(t,e){var n=this.syncPointTree_.get(t);g.assert(n,"Missing sync point for query tag that we're tracking");var r=this.pendingWriteTree_.childWrites(t);return n.applyOperation(e,r,null)},t.prototype.applyOperationToSyncPoints_=function(t){return this.applyOperationHelper_(t,this.syncPointTree_,null,this.pendingWriteTree_.childWrites(it.Empty))},t.prototype.applyOperationHelper_=function(t,e,n,r){if(t.path.isEmpty())return this.applyOperationDescendantsHelper_(t,e,n,r);var i=e.get(it.Empty);null==n&&null!=i&&(n=i.getCompleteServerCache(it.Empty));var o=[],a=t.path.getFront(),s=t.operationForChild(a),u=e.children.get(a);if(u&&s){var c=n?n.getImmediateChild(a):null,l=r.child(a);o=o.concat(this.applyOperationHelper_(s,u,c,l))}return i&&(o=o.concat(i.applyOperation(t,r,n))),o},t.prototype.applyOperationDescendantsHelper_=function(t,e,n,r){var i=this,o=e.get(it.Empty);null==n&&null!=o&&(n=o.getCompleteServerCache(it.Empty));var a=[];return e.children.inorderTraversal(function(e,o){var s=n?n.getImmediateChild(e):null,u=r.child(e),c=t.operationForChild(e);c&&(a=a.concat(i.applyOperationDescendantsHelper_(c,o,s,u)))}),o&&(a=a.concat(o.applyOperation(t,r,n))),a},t.nextQueryTag_=1,t}(),qe=function(){function t(){this.rootNode_=Yt.EMPTY_NODE}return t.prototype.getNode=function(t){return this.rootNode_.getChild(t)},t.prototype.updateSnapshot=function(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)},t}(),We=function(){function t(t){this.app_=t}return t.prototype.getToken=function(t){return this.app_.INTERNAL.getToken(t).then(null,function(t){return t&&"auth/token-not-initialized"===t.code?(P("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(t)})},t.prototype.addTokenChangeListener=function(t){this.app_.INTERNAL.addAuthTokenListener(t)},t.prototype.removeTokenChangeListener=function(t){this.app_.INTERNAL.removeAuthTokenListener(t)},t.prototype.notifyForInvalidToken=function(){var t='Provided authentication credentials for the app named "'+this.app_.name+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.app_.options?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.app_.options?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',F(t)},t}(),Ke=function(){function t(){this.counters_={}}return t.prototype.incrementCounter=function(t,e){void 0===e&&(e=1),g.contains(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},t.prototype.get=function(){return g.deepCopy(this.counters_)},t}(),He=function(){function t(){}return t.getCollection=function(t){var e=t.toString();return this.collections_[e]||(this.collections_[e]=new Ke),this.collections_[e]},t.getOrCreateReporter=function(t,e){var n=t.toString();return this.reporters_[n]||(this.reporters_[n]=e()),this.reporters_[n]},t.collections_={},t.reporters_={},t}(),Ge=function(){function t(t){this.collection_=t,this.last_=null}return t.prototype.get=function(){var t=this.collection_.get(),e=g.clone(t);return this.last_&&g.forEach(this.last_,function(t,n){e[t]=e[t]-n}),this.last_=t,e},t}(),Qe=1e4,ze=3e4,Ye=function(){function t(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new Ge(t);var n=Qe+(ze-Qe)*Math.random();rt(this.reportStats_.bind(this),Math.floor(n))}return t.prototype.includeStat=function(t){this.statsToReport_[t]=!0},t.prototype.reportStats_=function(){var t=this,e=this.statsListener_.get(),n={},r=!1;g.forEach(e,function(e,i){i>0&&g.contains(t.statsToReport_,e)&&(n[e]=i,r=!0)}),r&&this.server_.reportStats(n),rt(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},t}(),Xe=function(){function t(){this.eventLists_=[],this.recursionDepth_=0}return t.prototype.queueEvents=function(t){for(var e=null,n=0;n<t.length;n++){var r=t[n],i=r.getPath();null===e||i.equals(e.getPath())||(this.eventLists_.push(e),e=null),null===e&&(e=new Je(i)),e.add(r)}e&&this.eventLists_.push(e)},t.prototype.raiseEventsAtPath=function(t,e){this.queueEvents(e),this.raiseQueuedEventsMatchingPredicate_(function(e){return e.equals(t)})},t.prototype.raiseEventsForChangedPath=function(t,e){this.queueEvents(e),this.raiseQueuedEventsMatchingPredicate_(function(e){return e.contains(t)||t.contains(e)})},t.prototype.raiseQueuedEventsMatchingPredicate_=function(t){this.recursionDepth_++;for(var e=!0,n=0;n<this.eventLists_.length;n++){var r=this.eventLists_[n];if(r){t(r.getPath())?(this.eventLists_[n].raise(),this.eventLists_[n]=null):e=!1}}e&&(this.eventLists_=[]),this.recursionDepth_--},t}(),Je=function(){function t(t){this.path_=t,this.events_=[]}return t.prototype.add=function(t){this.events_.push(t)},t.prototype.raise=function(){for(var t=0;t<this.events_.length;t++){var e=this.events_[t];if(null!==e){this.events_[t]=null;var n=e.getEventRunner();R&&P("event: "+e.toString()),et(n)}}},t.prototype.getPath=function(){return this.path_},t}(),$e=function(){function t(t){this.allowedEvents_=t,this.listeners_={},g.assert(Array.isArray(t)&&t.length>0,"Requires a non-empty array")}return t.prototype.trigger=function(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(Array.isArray(this.listeners_[t]))for(var r=this.listeners_[t].slice(),i=0;i<r.length;i++)r[i].callback.apply(r[i].context,e)},t.prototype.on=function(t,e,n){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:e,context:n});var r=this.getInitialEvent(t);r&&e.apply(n,r)},t.prototype.off=function(t,e,n){this.validateEventType_(t);for(var r=this.listeners_[t]||[],i=0;i<r.length;i++)if(r[i].callback===e&&(!n||n===r[i].context))return void r.splice(i,1)},t.prototype.validateEventType_=function(t){g.assert(this.allowedEvents_.find(function(e){return e===t}),"Unknown event: "+t)},t}(),Ze=function(t){function e(){var e,n,r=t.call(this,["visible"])||this;return"undefined"!==typeof document&&"undefined"!==typeof document.addEventListener&&("undefined"!==typeof document.hidden?(n="visibilitychange",e="hidden"):"undefined"!==typeof document.mozHidden?(n="mozvisibilitychange",e="mozHidden"):"undefined"!==typeof document.msHidden?(n="msvisibilitychange",e="msHidden"):"undefined"!==typeof document.webkitHidden&&(n="webkitvisibilitychange",e="webkitHidden")),r.visible_=!0,n&&document.addEventListener(n,function(){var t=!document[e];t!==r.visible_&&(r.visible_=t,r.trigger("visible",t))},!1),r}return b.__extends(e,t),e.getInstance=function(){return new e},e.prototype.getInitialEvent=function(t){return g.assert("visible"===t,"Unknown event type: "+t),[this.visible_]},e}($e),tn=function(t){function e(){var e=t.call(this,["online"])||this;return e.online_=!0,"undefined"===typeof window||"undefined"===typeof window.addEventListener||g.isMobileCordova()||(window.addEventListener("online",function(){e.online_||(e.online_=!0,e.trigger("online",!0))},!1),window.addEventListener("offline",function(){e.online_&&(e.online_=!1,e.trigger("online",!1))},!1)),e}return b.__extends(e,t),e.getInstance=function(){return new e},e.prototype.getInitialEvent=function(t){return g.assert("online"===t,"Unknown event type: "+t),[this.online_]},e.prototype.currentlyOnline=function(){return this.online_},e}($e),en=function(){function t(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}return t.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse<this.currentResponseNum&&(this.onClose(),this.onClose=null)},t.prototype.handleResponse=function(t,e){var n=this;this.pendingResponses[t]=e;for(var r=this;this.pendingResponses[this.currentResponseNum];){if("break"===function(){var t=r.pendingResponses[r.currentResponseNum];delete r.pendingResponses[r.currentResponseNum];for(var e=0;e<t.length;++e)!function(e){t[e]&&et(function(){n.onMessage_(t[e])})}(e);if(r.currentResponseNum===r.closeAfterResponse)return r.onClose&&(r.onClose(),r.onClose=null),"break";r.currentResponseNum++}())break}},t}(),nn="pLPCommand",rn="pRTLPCB",on=function(){function t(t,e,n,r){this.connId=t,this.repoInfo=e,this.transportSessionId=n,this.lastSessionId=r,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=x(t),this.stats_=He.getCollection(e),this.urlFn=function(t){return e.connectionURL(at,t)}}return t.prototype.open=function(t,e){var n=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new en(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout(function(){n.log_("Timed out trying to connect."),n.onClosed_(),n.connectTimeoutTimer_=null},Math.floor(3e4)),V(function(){if(!n.isClosed_){n.scriptTagHolder=new an(function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[0],i=t[1],o=t[2];if(n.incrementIncomingBytes_(t),n.scriptTagHolder)if(n.connectTimeoutTimer_&&(clearTimeout(n.connectTimeoutTimer_),n.connectTimeoutTimer_=null),n.everConnected_=!0,"start"==r)n.id=i,n.password=o;else{if("close"!==r)throw new Error("Unrecognized command received: "+r);i?(n.scriptTagHolder.sendNewPolls=!1,n.myPacketOrderer.closeAfter(i,function(){n.onClosed_()})):n.onClosed_()}},function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=t[0],i=t[1];n.incrementIncomingBytes_(t),n.myPacketOrderer.handleResponse(r,i)},function(){n.onClosed_()},n.urlFn);var t={};t.start="t",t.ser=Math.floor(1e8*Math.random()),n.scriptTagHolder.uniqueCallbackIdentifier&&(t.cb=n.scriptTagHolder.uniqueCallbackIdentifier),t.v="5",n.transportSessionId&&(t.s=n.transportSessionId),n.lastSessionId&&(t.ls=n.lastSessionId),!g.isNodeSdk()&&"undefined"!==typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(t.r="f");var e=n.urlFn(t);n.log_("Connecting via long-poll to "+e),n.scriptTagHolder.addTag(e,function(){})}})},t.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},t.forceAllow=function(){t.forceAllow_=!0},t.forceDisallow=function(){t.forceDisallow_=!0},t.isAvailable=function(){return t.forceAllow_||!t.forceDisallow_&&"undefined"!==typeof document&&null!=document.createElement&&!X()&&!J()&&!g.isNodeSdk()},t.prototype.markConnectionHealthy=function(){},t.prototype.shutdown_=function(){this.isClosed_=!0,this.scriptTagHolder&&(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&&(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&&(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)},t.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&&(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},t.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},t.prototype.send=function(t){var e=g.stringify(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);for(var n=g.base64Encode(e),r=Q(n,1840),i=0;i<r.length;i++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,r.length,r[i]),this.curSegmentNum++},t.prototype.addDisconnectPingFrame=function(t,e){if(!g.isNodeSdk()){this.myDisconnFrame=document.createElement("iframe");var n={};n.dframe="t",n.id=t,n.pw=e,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)}},t.prototype.incrementIncomingBytes_=function(t){var e=g.stringify(t).length;this.bytesReceived+=e,this.stats_.incrementCounter("bytes_received",e)},t}(),an=function(){function t(e,n,r,i){if(this.onDisconnect=r,this.urlFn=i,this.outstandingRequests=new le,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0,g.isNodeSdk())this.commandCB=e,this.onMessageCB=n;else{this.uniqueCallbackIdentifier=N(),window[nn+this.uniqueCallbackIdentifier]=e,window[rn+this.uniqueCallbackIdentifier]=n,this.myIFrame=t.createIFrame_();var o="";if(this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length)){o='<script>document.domain="'+document.domain+'";<\/script>'}var a="<html><body>"+o+"</body></html>";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(a),this.myIFrame.doc.close()}catch(t){P("frame writing exception"),t.stack&&P(t.stack),P(t)}}}return t.createIFrame_=function(){var t=document.createElement("iframe");if(t.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(t);try{t.contentWindow.document||P("No IE domain setting required")}catch(n){var e=document.domain;t.src="javascript:void((function(){document.open();document.domain='"+e+"';document.close();})())"}return t.contentDocument?t.doc=t.contentDocument:t.contentWindow?t.doc=t.contentWindow.document:t.document&&(t.doc=t.document),t},t.prototype.close=function(){var e=this;if(this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout(function(){null!==e.myIFrame&&(document.body.removeChild(e.myIFrame),e.myIFrame=null)},Math.floor(0))),g.isNodeSdk()&&this.myID){var n={};n.disconn="t",n.id=this.myID,n.pw=this.myPW;var r=this.urlFn(n);t.nodeRestRequest(r)}var i=this.onDisconnect;i&&(this.onDisconnect=null,i())},t.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},t.prototype.newRequest_=function(){if(this.alive&&this.sendNewPolls&&this.outstandingRequests.count()<(this.pendingSegs.length>0?2:1)){this.currentSerial++;var t={};t.id=this.myID,t.pw=this.myPW,t.ser=this.currentSerial;for(var e=this.urlFn(t),n="",r=0;this.pendingSegs.length>0;){if(!(this.pendingSegs[0].d.length+30+n.length<=1870))break;var i=this.pendingSegs.shift();n=n+"&seg"+r+"="+i.seg+"&ts"+r+"="+i.ts+"&d"+r+"="+i.d,r++}return e+=n,this.addLongPollTag_(e,this.currentSerial),!0}return!1},t.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&&this.newRequest_()},t.prototype.addLongPollTag_=function(t,e){var n=this;this.outstandingRequests.add(e,1);var r=function(){n.outstandingRequests.remove(e),n.newRequest_()},i=setTimeout(r,Math.floor(25e3)),o=function(){clearTimeout(i),r()};this.addTag(t,o)},t.prototype.addTag=function(t,e){var n=this;g.isNodeSdk()?this.doNodeLongPoll(t,e):setTimeout(function(){try{if(!n.sendNewPolls)return;var r=n.myIFrame.doc.createElement("script");r.type="text/javascript",r.async=!0,r.src=t,r.onload=r.onreadystatechange=function(){var t=r.readyState;t&&"loaded"!==t&&"complete"!==t||(r.onload=r.onreadystatechange=null,r.parentNode&&r.parentNode.removeChild(r),e())},r.onerror=function(){P("Long-poll script failed to load: "+t),n.sendNewPolls=!1,n.close()},n.myIFrame.doc.body.appendChild(r)}catch(t){}},Math.floor(1))},t}(),sn=null;"undefined"!==typeof MozWebSocket?sn=MozWebSocket:"undefined"!==typeof WebSocket&&(sn=WebSocket);var un=function(){function t(e,n,r,i){this.connId=e,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=x(this.connId),this.stats_=He.getCollection(n),this.connURL=t.connectionURL_(n,r,i)}return t.connectionURL_=function(t,e,n){var r={};return r.v="5",!g.isNodeSdk()&&"undefined"!==typeof location&&location.href&&-1!==location.href.indexOf("firebaseio.com")&&(r.r="f"),e&&(r.s=e),n&&(r.ls=n),t.connectionURL("websocket",r)},t.prototype.open=function(t,e){var n=this;this.onDisconnect=e,this.onMessage=t,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,S.set("previous_websocket_failure",!0);try{if(g.isNodeSdk()){var i=g.CONSTANTS.NODE_ADMIN?"AdminNode":"Node",o={headers:{"User-Agent":"Firebase/5/"+_.SDK_VERSION+"/"+r.platform+"/"+i}},a=Object({NODE_ENV:"production",PUBLIC_URL:"/push-notification-demo"}),s=0==this.connURL.indexOf("wss://")?a.HTTPS_PROXY||a.https_proxy:a.HTTP_PROXY||a.http_proxy;s&&(o.proxy={origin:s}),this.mySock=new sn(this.connURL,[],o)}else this.mySock=new sn(this.connURL)}catch(t){this.log_("Error instantiating WebSocket.");var u=t.message||t.data;return u&&this.log_(u),void this.onClosed_()}this.mySock.onopen=function(){n.log_("Websocket connected."),n.everConnected_=!0},this.mySock.onclose=function(){n.log_("Websocket connection was disconnected."),n.mySock=null,n.onClosed_()},this.mySock.onmessage=function(t){n.handleIncomingFrame(t)},this.mySock.onerror=function(t){n.log_("WebSocket error. Closing connection.");var e=t.message||t.data;e&&n.log_(e),n.onClosed_()}},t.prototype.start=function(){},t.forceDisallow=function(){t.forceDisallow_=!0},t.isAvailable=function(){var e=!1;if("undefined"!==typeof navigator&&navigator.userAgent){var n=/Android ([0-9]{0,}\.[0-9]{0,})/,r=navigator.userAgent.match(n);r&&r.length>1&&parseFloat(r[1])<4.4&&(e=!0)}return!e&&null!==sn&&!t.forceDisallow_},t.previouslyFailed=function(){return S.isInMemoryStorage||!0===S.get("previous_websocket_failure")},t.prototype.markConnectionHealthy=function(){S.remove("previous_websocket_failure")},t.prototype.appendFrame_=function(t){if(this.frames.push(t),this.frames.length==this.totalFrames){var e=this.frames.join("");this.frames=null;var n=g.jsonEval(e);this.onMessage(n)}},t.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},t.prototype.extractFrameCount_=function(t){if(g.assert(null===this.frames,"We already have a frame buffer"),t.length<=6){var e=Number(t);if(!isNaN(e))return this.handleNewFrameCount_(e),null}return this.handleNewFrameCount_(1),t},t.prototype.handleIncomingFrame=function(t){if(null!==this.mySock){var e=t.data;if(this.bytesReceived+=e.length,this.stats_.incrementCounter("bytes_received",e.length),this.resetKeepAlive(),null!==this.frames)this.appendFrame_(e);else{var n=this.extractFrameCount_(e);null!==n&&this.appendFrame_(n)}}},t.prototype.send=function(t){this.resetKeepAlive();var e=g.stringify(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);var n=Q(e,16384);n.length>1&&this.sendString_(String(n.length));for(var r=0;r<n.length;r++)this.sendString_(n[r])},t.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&&(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&&(this.mySock.close(),this.mySock=null)},t.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&&(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},t.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},t.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval(function(){t.mySock&&t.sendString_("0"),t.resetKeepAlive()},Math.floor(45e3))},t.prototype.sendString_=function(t){try{this.mySock.send(t)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}},t.responsesRequiredToBeHealthy=2,t.healthyTimeout=3e4,t}(),cn=function(){function t(t){this.initTransports_(t)}return Object.defineProperty(t,"ALL_TRANSPORTS",{get:function(){return[on,un]},enumerable:!0,configurable:!0}),t.prototype.initTransports_=function(e){var n=un&&un.isAvailable(),r=n&&!un.previouslyFailed();if(e.webSocketOnly&&(n||F("wss:// URL used, but browser isn't known to support websockets. Trying anyway."),r=!0),r)this.transports_=[un];else{var i=this.transports_=[];z(t.ALL_TRANSPORTS,function(t,e){e&&e.isAvailable()&&i.push(e)})}},t.prototype.initialTransport=function(){if(this.transports_.length>0)return this.transports_[0];throw new Error("No transports available")},t.prototype.upgradeTransport=function(){return this.transports_.length>1?this.transports_[1]:null},t}(),ln=function(){function t(t,e,n,r,i,o,a){this.id=t,this.repoInfo_=e,this.onMessage_=n,this.onReady_=r,this.onDisconnect_=i,this.onKill_=o,this.lastSessionId=a,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=x("c:"+this.id+":"),this.transportManager_=new cn(e),this.log_("Connection created"),this.start_()}return t.prototype.start_=function(){var t=this,e=this.transportManager_.initialTransport();this.conn_=new e(this.nextTransportId_(),this.repoInfo_,void 0,this.lastSessionId),this.primaryResponsesRequired_=e.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.conn_),r=this.disconnReceiver_(this.conn_);this.tx_=this.conn_,this.rx_=this.conn_,this.secondaryConn_=null,this.isHealthy_=!1,setTimeout(function(){t.conn_&&t.conn_.open(n,r)},Math.floor(0));var i=e.healthyTimeout||0;i>0&&(this.healthyTimeout_=rt(function(){t.healthyTimeout_=null,t.isHealthy_||(t.conn_&&t.conn_.bytesReceived>102400?(t.log_("Connection exceeded healthy timeout but has received "+t.conn_.bytesReceived+" bytes. Marking connection healthy."),t.isHealthy_=!0,t.conn_.markConnectionHealthy()):t.conn_&&t.conn_.bytesSent>10240?t.log_("Connection exceeded healthy timeout but has sent "+t.conn_.bytesSent+" bytes. Leaving connection alive."):(t.log_("Closing unhealthy connection after timeout."),t.close()))},Math.floor(i)))},t.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},t.prototype.disconnReceiver_=function(t){var e=this;return function(n){t===e.conn_?e.onConnectionLost_(n):t===e.secondaryConn_?(e.log_("Secondary connection lost."),e.onSecondaryConnectionLost_()):e.log_("closing an old connection")}},t.prototype.connReceiver_=function(t){var e=this;return function(n){2!=e.state_&&(t===e.rx_?e.onPrimaryMessageReceived_(n):t===e.secondaryConn_?e.onSecondaryMessageReceived_(n):e.log_("message on old connection"))}},t.prototype.sendRequest=function(t){var e={t:"d",d:t};this.sendData_(e)},t.prototype.tryCleanupConnection=function(){this.tx_===this.secondaryConn_&&this.rx_===this.secondaryConn_&&(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)},t.prototype.onSecondaryControl_=function(t){if("t"in t){var e=t.t;"a"===e?this.upgradeIfSecondaryHealthy_():"r"===e?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&&this.rx_!==this.secondaryConn_||this.close()):"o"===e&&(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_())}},t.prototype.onSecondaryMessageReceived_=function(t){var e=H("t",t),n=H("d",t);if("c"==e)this.onSecondaryControl_(n);else{if("d"!=e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(n)}},t.prototype.upgradeIfSecondaryHealthy_=function(){this.secondaryResponsesRequired_<=0?(this.log_("Secondary connection is healthy."),this.isHealthy_=!0,this.secondaryConn_.markConnectionHealthy(),this.proceedWithUpgrade_()):(this.log_("sending ping on secondary."),this.secondaryConn_.send({t:"c",d:{t:"p",d:{}}}))},t.prototype.proceedWithUpgrade_=function(){this.secondaryConn_.start(),this.log_("sending client ack on secondary"),this.secondaryConn_.send({t:"c",d:{t:"a",d:{}}}),this.log_("Ending transmission on primary"),this.conn_.send({t:"c",d:{t:"n",d:{}}}),this.tx_=this.secondaryConn_,this.tryCleanupConnection()},t.prototype.onPrimaryMessageReceived_=function(t){var e=H("t",t),n=H("d",t);"c"==e?this.onControl_(n):"d"==e&&this.onDataMessage_(n)},t.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},t.prototype.onPrimaryResponse_=function(){this.isHealthy_||--this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy())},t.prototype.onControl_=function(t){var e=H("t",t);if("d"in t){var n=t.d;if("h"===e)this.onHandshake_(n);else if("n"===e){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var r=0;r<this.pendingDataMessages.length;++r)this.onDataMessage_(this.pendingDataMessages[r]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===e?this.onConnectionShutdown_(n):"r"===e?this.onReset_(n):"e"===e?L("Server Error: "+n):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):L("Unknown control packet command: "+e)}},t.prototype.onHandshake_=function(t){var e=t.ts,n=t.v,r=t.h;this.sessionId=t.s,this.repoInfo_.updateHost(r),0==this.state_&&(this.conn_.start(),this.onConnectionEstablished_(this.conn_,e),"5"!==n&&F("Protocol version mismatch detected"),this.tryStartUpgrade_())},t.prototype.tryStartUpgrade_=function(){var t=this.transportManager_.upgradeTransport();t&&this.startUpgrade_(t)},t.prototype.startUpgrade_=function(t){var e=this;this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.secondaryConn_),r=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,r),rt(function(){e.secondaryConn_&&(e.log_("Timed out trying to upgrade."),e.secondaryConn_.close())},Math.floor(6e4))},t.prototype.onReset_=function(t){this.log_("Reset packet received. New host: "+t),this.repoInfo_.updateHost(t),1===this.state_?this.close():(this.closeConnections_(),this.start_())},t.prototype.onConnectionEstablished_=function(t,e){var n=this;this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&&(this.onReady_(e,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):rt(function(){n.sendPingOnPrimaryIfNecessary_()},Math.floor(5e3))},t.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},t.prototype.onSecondaryConnectionLost_=function(){var t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&&this.rx_!==t||this.close()},t.prototype.onConnectionLost_=function(t){this.conn_=null,t||0!==this.state_?1===this.state_&&this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&&(S.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()},t.prototype.onConnectionShutdown_=function(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&&(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()},t.prototype.sendData_=function(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)},t.prototype.close=function(){2!==this.state_&&(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&&(this.onDisconnect_(),this.onDisconnect_=null))},t.prototype.closeConnections_=function(){this.log_("Shutting down all connections"),this.conn_&&(this.conn_.close(),this.conn_=null),this.secondaryConn_&&(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&&(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)},t}(),hn=function(){function t(){}return t.prototype.put=function(t,e,n,r){},t.prototype.merge=function(t,e,n,r){},t.prototype.refreshAuthToken=function(t){},t.prototype.onDisconnectPut=function(t,e,n){},t.prototype.onDisconnectMerge=function(t,e,n){},t.prototype.onDisconnectCancel=function(t,e){},t.prototype.reportStats=function(t){},t}(),fn=1e3,pn=3e5,dn=function(t){function e(n,r,i,o,a,s){var u=t.call(this)||this;if(u.repoInfo_=n,u.onDataUpdate_=r,u.onConnectStatus_=i,u.onServerInfoUpdate_=o,u.authTokenProvider_=a,u.authOverride_=s,u.id=e.nextPersistentConnectionId_++,u.log_=x("p:"+u.id+":"),u.interruptReasons_={},u.listens_={},u.outstandingPuts_=[],u.outstandingPutCount_=0,u.onDisconnectRequestQueue_=[],u.connected_=!1,u.reconnectDelay_=fn,u.maxReconnectDelay_=pn,u.securityDebugCallback_=null,u.lastSessionId=null,u.establishConnectionTimer_=null,u.visible_=!1,u.requestCBHash_={},u.requestNumber_=0,u.realtime_=null,u.authToken_=null,u.forceTokenRefresh_=!1,u.invalidAuthTokenCount_=0,u.firstConnection_=!0,u.lastConnectionAttemptTime_=null,u.lastConnectionEstablishedTime_=null,s&&!g.isNodeSdk())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");return u.scheduleConnect_(0),Ze.getInstance().on("visible",u.onVisible_,u),-1===n.host.indexOf("fblocal")&&tn.getInstance().on("online",u.onOnline_,u),u}return b.__extends(e,t),e.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,i={r:r,a:t,b:e};this.log_(g.stringify(i)),g.assert(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(i),n&&(this.requestCBHash_[r]=n)},e.prototype.listen=function(t,e,n,r){var i=t.queryIdentifier(),o=t.path.toString();this.log_("Listen called for "+o+" "+i),this.listens_[o]=this.listens_[o]||{},g.assert(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),g.assert(!this.listens_[o][i],"listen() called twice for same path/queryId.");var a={onComplete:r,hashFn:e,query:t,tag:n};this.listens_[o][i]=a,this.connected_&&this.sendListen_(a)},e.prototype.sendListen_=function(t){var n=this,r=t.query,i=r.path.toString(),o=r.queryIdentifier();this.log_("Listen on "+i+" for "+o);var a={p:i};t.tag&&(a.q=r.queryObject(),a.t=t.tag),a.h=t.hashFn(),this.sendRequest("q",a,function(a){var s=a.d,u=a.s;e.warnOnListenWarnings_(s,r),(n.listens_[i]&&n.listens_[i][o])===t&&(n.log_("listen response",a),"ok"!==u&&n.removeListen_(i,o),t.onComplete&&t.onComplete(u,s))})},e.warnOnListenWarnings_=function(t,e){if(t&&"object"===typeof t&&g.contains(t,"w")){var n=g.safeGet(t,"w");if(Array.isArray(n)&&~n.indexOf("no_index")){var r='".indexOn": "'+e.getQueryParams().getIndex().toString()+'"',i=e.path.toString();F("Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding "+r+" at "+i+" to your security rules for better performance.")}}},e.prototype.refreshAuthToken=function(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&&this.sendRequest("unauth",{},function(){}),this.reduceReconnectDelayIfAdminCredential_(t)},e.prototype.reduceReconnectDelayIfAdminCredential_=function(t){(t&&40===t.length||g.isAdmin(t))&&(this.log_("Admin auth credential detected. Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},e.prototype.tryAuth=function(){var t=this;if(this.connected_&&this.authToken_){var e=this.authToken_,n=g.isValidFormat(e)?"auth":"gauth",r={cred:e};null===this.authOverride_?r.noauth=!0:"object"===typeof this.authOverride_&&(r.authvar=this.authOverride_),this.sendRequest(n,r,function(n){var r=n.s,i=n.d||"error";t.authToken_===e&&("ok"===r?t.invalidAuthTokenCount_=0:t.onAuthRevoked_(r,i))})}},e.prototype.unlisten=function(t,e){var n=t.path.toString(),r=t.queryIdentifier();this.log_("Unlisten called for "+n+" "+r),g.assert(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,r)&&this.connected_&&this.sendUnlisten_(n,r,t.queryObject(),e)},e.prototype.sendUnlisten_=function(t,e,n,r){this.log_("Unlisten on "+t+" for "+e);var i={p:t};r&&(i.q=n,i.t=r),this.sendRequest("n",i)},e.prototype.onDisconnectPut=function(t,e,n){this.connected_?this.sendOnDisconnect_("o",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:e,onComplete:n})},e.prototype.onDisconnectMerge=function(t,e,n){this.connected_?this.sendOnDisconnect_("om",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:e,onComplete:n})},e.prototype.onDisconnectCancel=function(t,e){this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},e.prototype.sendOnDisconnect_=function(t,e,n,r){var i={p:e,d:n};this.log_("onDisconnect "+t,i),this.sendRequest(t,i,function(t){r&&setTimeout(function(){r(t.s,t.d)},Math.floor(0))})},e.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},e.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},e.prototype.putInternal=function(t,e,n,r,i){var o={p:e,d:n};void 0!==i&&(o.h=i),this.outstandingPuts_.push({action:t,request:o,onComplete:r}),this.outstandingPutCount_++;var a=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(a):this.log_("Buffering put: "+e)},e.prototype.sendPut_=function(t){var e=this,n=this.outstandingPuts_[t].action,r=this.outstandingPuts_[t].request,i=this.outstandingPuts_[t].onComplete;this.outstandingPuts_[t].queued=this.connected_,this.sendRequest(n,r,function(r){e.log_(n+" response",r),delete e.outstandingPuts_[t],e.outstandingPutCount_--,0===e.outstandingPutCount_&&(e.outstandingPuts_=[]),i&&i(r.s,r.d)})},e.prototype.reportStats=function(t){var e=this;if(this.connected_){var n={c:t};this.log_("reportStats",n),this.sendRequest("s",n,function(t){if("ok"!==t.s){var n=t.d;e.log_("reportStats","Error sending stats: "+n)}})}},e.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+g.stringify(t));var e=t.r,n=this.requestCBHash_[e];n&&(delete this.requestCBHash_[e],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&&this.onDataPush_(t.a,t.b)}},e.prototype.onDataPush_=function(t,e){this.log_("handleServerMessage",t,e),"d"===t?this.onDataUpdate_(e.p,e.d,!1,e.t):"m"===t?this.onDataUpdate_(e.p,e.d,!0,e.t):"c"===t?this.onListenRevoked_(e.p,e.q):"ac"===t?this.onAuthRevoked_(e.s,e.d):"sd"===t?this.onSecurityDebugPacket_(e):L("Unrecognized action received from server: "+g.stringify(t)+"\nAre you using the latest client?")},e.prototype.onReady_=function(t,e){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=(new Date).getTime(),this.handleTimestamp_(t),this.lastSessionId=e,this.firstConnection_&&this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)},e.prototype.scheduleConnect_=function(t){var e=this;g.assert(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&&clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout(function(){e.establishConnectionTimer_=null,e.establishConnection_()},Math.floor(t))},e.prototype.onVisible_=function(t){t&&!this.visible_&&this.reconnectDelay_===this.maxReconnectDelay_&&(this.log_("Window became visible. Reducing delay."),this.reconnectDelay_=fn,this.realtime_||this.scheduleConnect_(0)),this.visible_=t},e.prototype.onOnline_=function(t){t?(this.log_("Browser went online."),this.reconnectDelay_=fn,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline. Killing connection."),this.realtime_&&this.realtime_.close())},e.prototype.onRealtimeDisconnect_=function(){if(this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()){if(this.visible_){if(this.lastConnectionEstablishedTime_){var t=(new Date).getTime()-this.lastConnectionEstablishedTime_;t>3e4&&(this.reconnectDelay_=fn),this.lastConnectionEstablishedTime_=null}}else this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime();var e=(new Date).getTime()-this.lastConnectionAttemptTime_,n=Math.max(0,this.reconnectDelay_-e);n=Math.random()*n,this.log_("Trying to reconnect in "+n+"ms"),this.scheduleConnect_(n),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)},e.prototype.establishConnection_=function(){if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;var t=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+e.nextConnectionId_++,o=this,a=this.lastSessionId,s=!1,u=null,c=function(){u?u.close():(s=!0,r())},l=function(t){g.assert(u,"sendRequest call when we're not connected not allowed."),u.sendRequest(t)};this.realtime_={close:c,sendRequest:l};var h=this.forceTokenRefresh_;this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(h).then(function(e){s?P("getToken() completed but was canceled"):(P("getToken() completed. Creating connection."),o.authToken_=e&&e.accessToken,u=new ln(i,o.repoInfo_,t,n,r,function(t){F(t+" ("+o.repoInfo_.toString()+")"),o.interrupt("server_kill")},a))}).then(null,function(t){o.log_("Failed to get token: "+t),s||(g.CONSTANTS.NODE_ADMIN&&F(t),c())})}},e.prototype.interrupt=function(t){P("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&&(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&&this.onRealtimeDisconnect_())},e.prototype.resume=function(t){P("Resuming connection for reason: "+t),delete this.interruptReasons_[t],g.isEmpty(this.interruptReasons_)&&(this.reconnectDelay_=fn,this.realtime_||this.scheduleConnect_(0))},e.prototype.handleTimestamp_=function(t){var e=t-(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:e})},e.prototype.cancelSentTransactions_=function(){for(var t=0;t<this.outstandingPuts_.length;t++){var e=this.outstandingPuts_[t];e&&"h"in e.request&&e.queued&&(e.onComplete&&e.onComplete("disconnect"),delete this.outstandingPuts_[t],this.outstandingPutCount_--)}0===this.outstandingPutCount_&&(this.outstandingPuts_=[])},e.prototype.onListenRevoked_=function(t,e){var n;n=e?e.map(function(t){return G(t)}).join("$"):"default";var r=this.removeListen_(t,n);r&&r.onComplete&&r.onComplete("permission_denied")},e.prototype.removeListen_=function(t,e){var n,r=new it(t).toString();return void 0!==this.listens_[r]?(n=this.listens_[r][e],delete this.listens_[r][e],0===g.getCount(this.listens_[r])&&delete this.listens_[r]):n=void 0,n},e.prototype.onAuthRevoked_=function(t,e){P("Auth token revoked: "+t+"/"+e),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),"invalid_token"!==t&&"permission_denied"!==t||++this.invalidAuthTokenCount_>=3&&(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken())},e.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&&console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},e.prototype.restoreState_=function(){var t=this;this.tryAuth(),g.forEach(this.listens_,function(e,n){g.forEach(n,function(e,n){t.sendListen_(n)})});for(var e=0;e<this.outstandingPuts_.length;e++)this.outstandingPuts_[e]&&this.sendPut_(e);for(;this.onDisconnectRequestQueue_.length;){var n=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(n.action,n.pathString,n.data,n.onComplete)}},e.prototype.sendConnectStats_=function(){var t={},e="js";g.CONSTANTS.NODE_ADMIN?e="admin_node":g.CONSTANTS.NODE_CLIENT&&(e="node"),t["sdk."+e+"."+_.SDK_VERSION.replace(/\./g,"-")]=1,g.isMobileCordova()?t["framework.cordova"]=1:g.isReactNative()&&(t["framework.reactnative"]=1),this.reportStats(t)},e.prototype.shouldReconnect_=function(){var t=tn.getInstance().currentlyOnline();return g.isEmpty(this.interruptReasons_)&&t},e.nextPersistentConnectionId_=0,e.nextConnectionId_=0,e}(hn),yn=function(t){function e(e,n,r){var i=t.call(this)||this;return i.repoInfo_=e,i.onDataUpdate_=n,i.authTokenProvider_=r,i.log_=x("p:rest:"),i.listens_={},i}return b.__extends(e,t),e.prototype.reportStats=function(t){throw new Error("Method not implemented.")},e.getListenId_=function(t,e){return void 0!==e?"tag$"+e:(g.assert(t.getQueryParams().isDefault(),"should have a tag if it's not a default query."),t.path.toString())},e.prototype.listen=function(t,n,r,i){var o=this,a=t.path.toString();this.log_("Listen called for "+a+" "+t.queryIdentifier());var s=e.getListenId_(t,r),u={};this.listens_[s]=u;var c=t.getQueryParams().toRestQueryStringParameters();this.restRequest_(a+".json",c,function(t,e){var n=e;if(404===t&&(n=null,t=null),null===t&&o.onDataUpdate_(a,n,!1,r),g.safeGet(o.listens_,s)===u){var c;c=t?401==t?"permission_denied":"rest_error:"+t:"ok",i(c,null)}})},e.prototype.unlisten=function(t,n){var r=e.getListenId_(t,n);delete this.listens_[r]},e.prototype.refreshAuthToken=function(t){},e.prototype.restRequest_=function(t,e,n){var r=this;void 0===e&&(e={}),e.format="export",this.authTokenProvider_.getToken(!1).then(function(i){var o=i&&i.accessToken;o&&(e.auth=o);var a=(r.repoInfo_.secure?"https://":"http://")+r.repoInfo_.host+t+"?"+g.querystring(e);r.log_("Sending REST request for "+a);var s=new XMLHttpRequest;s.onreadystatechange=function(){if(n&&4===s.readyState){r.log_("REST Response for "+a+" received. status:",s.status,"response:",s.responseText);var t=null;if(s.status>=200&&s.status<300){try{t=g.jsonEval(s.responseText)}catch(t){F("Failed to parse JSON response for "+a+": "+s.responseText)}n(null,t)}else 401!==s.status&&404!==s.status&&F("Got unsuccessful REST response for "+a+" Status: "+s.status),n(s.status);n=null}},s.open("GET",a,!0),s.send()})},e}(hn),mn=function(){function t(t,e,n){var r=this;this.repoInfo_=t,this.app=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Xe,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new he,this.persistentConnection_=null;var i=new We(n);if(this.stats_=He.getCollection(t),e||nt())this.server_=new yn(this.repoInfo_,this.onDataUpdate_.bind(this),i),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var o=n.options.databaseAuthVariableOverride;if("undefined"!==typeof o&&null!==o){if("object"!==typeof o)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{g.stringify(o)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}this.persistentConnection_=new dn(this.repoInfo_,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),i,o),this.server_=this.persistentConnection_}i.addTokenChangeListener(function(t){r.server_.refreshAuthToken(t)}),this.statsReporter_=He.getOrCreateReporter(t,function(){return new Ye(r.stats_,r.server_)}),this.transactions_init_(),this.infoData_=new qe,this.infoSyncTree_=new je({startListening:function(t,e,n,i){var o=[],a=r.infoData_.getNode(t.path);return a.isEmpty()||(o=r.infoSyncTree_.applyServerOverwrite(t.path,a),setTimeout(function(){i("ok")},0)),o},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new je({startListening:function(t,e,n,i){return r.server_.listen(t,n,e,function(e,n){var o=i(e,n);r.eventQueue_.raiseEventsForChangedPath(t.path,o)}),[]},stopListening:function(t,e){r.server_.unlisten(t,e)}})}return t.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},t.prototype.name=function(){return this.repoInfo_.namespace},t.prototype.serverTime=function(){var t=this.infoData_.getNode(new it(".info/serverTimeOffset")),e=t.val()||0;return(new Date).getTime()+e},t.prototype.generateServerValues=function(){return fe({timestamp:this.serverTime()})},t.prototype.onDataUpdate_=function(t,e,n,r){this.dataUpdateCount++;var i=new it(t);e=this.interceptServerDataCallback_?this.interceptServerDataCallback_(t,e):e;var o=[];if(r)if(n){var a=g.map(e,function(t){return u(t)});o=this.serverSyncTree_.applyTaggedQueryMerge(i,a,r)}else{var s=u(e);o=this.serverSyncTree_.applyTaggedQueryOverwrite(i,s,r)}else if(n){var c=g.map(e,function(t){return u(t)});o=this.serverSyncTree_.applyServerMerge(i,c)}else{var l=u(e);o=this.serverSyncTree_.applyServerOverwrite(i,l)}var h=i;o.length>0&&(h=this.rerunTransactions_(i)),this.eventQueue_.raiseEventsForChangedPath(h,o)},t.prototype.interceptServerData_=function(t){this.interceptServerDataCallback_=t},t.prototype.onConnectStatus_=function(t){this.updateInfo_("connected",t),!1===t&&this.runOnDisconnectEvents_()},t.prototype.onServerInfoUpdate_=function(t){var e=this;z(t,function(t,n){e.updateInfo_(n,t)})},t.prototype.updateInfo_=function(t,e){var n=new it("/.info/"+t),r=u(e);this.infoData_.updateSnapshot(n,r);var i=this.infoSyncTree_.applyServerOverwrite(n,r);this.eventQueue_.raiseEventsForChangedPath(n,i)},t.prototype.getNextWriteId_=function(){return this.nextWriteId_++},t.prototype.setWithPriority=function(t,e,n,r){var i=this;this.log_("set",{path:t.toString(),value:e,priority:n});var o=this.generateServerValues(),a=u(e,n),s=ye(a,o),c=this.getNextWriteId_(),l=this.serverSyncTree_.applyUserOverwrite(t,s,c,!0);this.eventQueue_.queueEvents(l),this.server_.put(t.toString(),a.val(!0),function(e,n){var o="ok"===e;o||F("set at "+t+" failed: "+e);var a=i.serverSyncTree_.ackUserWrite(c,!o);i.eventQueue_.raiseEventsForChangedPath(t,a),i.callOnCompleteCallback(r,e,n)});var h=this.abortTransactions_(t);this.rerunTransactions_(h),this.eventQueue_.raiseEventsForChangedPath(h,[])},t.prototype.update=function(t,e,n){var r=this;this.log_("update",{path:t.toString(),value:e});var i=!0,o=this.generateServerValues(),a={};if(g.forEach(e,function(t,e){i=!1;var n=u(e);a[t]=ye(n,o)}),i)P("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(n,"ok");else{var s=this.getNextWriteId_(),c=this.serverSyncTree_.applyUserMerge(t,a,s);this.eventQueue_.queueEvents(c),this.server_.merge(t.toString(),e,function(e,i){var o="ok"===e;o||F("update at "+t+" failed: "+e);var a=r.serverSyncTree_.ackUserWrite(s,!o),u=a.length>0?r.rerunTransactions_(t):t;r.eventQueue_.raiseEventsForChangedPath(u,a),r.callOnCompleteCallback(n,e,i)}),g.forEach(e,function(e){var n=r.abortTransactions_(t.child(e));r.rerunTransactions_(n)}),this.eventQueue_.raiseEventsForChangedPath(t,[])}},t.prototype.runOnDisconnectEvents_=function(){var t=this;this.log_("onDisconnectEvents");var e=this.generateServerValues(),n=de(this.onDisconnect_,e),r=[];n.forEachTree(it.Empty,function(e,n){r=r.concat(t.serverSyncTree_.applyServerOverwrite(e,n));var i=t.abortTransactions_(e);t.rerunTransactions_(i)}),this.onDisconnect_=new he,this.eventQueue_.raiseEventsForChangedPath(it.Empty,r)},t.prototype.onDisconnectCancel=function(t,e){var n=this;this.server_.onDisconnectCancel(t.toString(),function(r,i){"ok"===r&&n.onDisconnect_.forget(t),n.callOnCompleteCallback(e,r,i)})},t.prototype.onDisconnectSet=function(t,e,n){var r=this,i=u(e);this.server_.onDisconnectPut(t.toString(),i.val(!0),function(e,o){"ok"===e&&r.onDisconnect_.remember(t,i),r.callOnCompleteCallback(n,e,o)})},t.prototype.onDisconnectSetWithPriority=function(t,e,n,r){var i=this,o=u(e,n);this.server_.onDisconnectPut(t.toString(),o.val(!0),function(e,n){"ok"===e&&i.onDisconnect_.remember(t,o),i.callOnCompleteCallback(r,e,n)})},t.prototype.onDisconnectUpdate=function(t,e,n){var r=this;if(g.isEmpty(e))return P("onDisconnect().update() called with empty data. Don't do anything."),void this.callOnCompleteCallback(n,"ok");this.server_.onDisconnectMerge(t.toString(),e,function(i,o){"ok"===i&&g.forEach(e,function(e,n){var i=u(n);r.onDisconnect_.remember(t.child(e),i)}),r.callOnCompleteCallback(n,i,o)})},t.prototype.addEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.addEventRegistration(t,e):this.serverSyncTree_.addEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},t.prototype.removeEventCallbackForQuery=function(t,e){var n;n=".info"===t.path.getFront()?this.infoSyncTree_.removeEventRegistration(t,e):this.serverSyncTree_.removeEventRegistration(t,e),this.eventQueue_.raiseEventsAtPath(t.path,n)},t.prototype.interrupt=function(){this.persistentConnection_&&this.persistentConnection_.interrupt("repo_interrupt")},t.prototype.resume=function(){this.persistentConnection_&&this.persistentConnection_.resume("repo_interrupt")},t.prototype.stats=function(t){if(void 0===t&&(t=!1),"undefined"!==typeof console){var e;t?(this.statsListener_||(this.statsListener_=new Ge(this.stats_)),e=this.statsListener_.get()):e=this.stats_.get();var n=Object.keys(e).reduce(function(t,e){return Math.max(e.length,t)},0);g.forEach(e,function(t,e){for(var r=t.length;r<n+2;r++)t+=" ";console.log(t+e)})}},t.prototype.statsIncrementCounter=function(t){this.stats_.incrementCounter(t),this.statsReporter_.includeStat(t)},t.prototype.log_=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n="";this.persistentConnection_&&(n=this.persistentConnection_.id+":"),P.apply(void 0,[n].concat(t))},t.prototype.callOnCompleteCallback=function(t,e,n){t&&et(function(){if("ok"==e)t(null);else{var r=(e||"error").toUpperCase(),i=r;n&&(i+=": "+n);var o=new Error(i);o.code=r,t(o)}})},Object.defineProperty(t.prototype,"database",{get:function(){return this.__database||(this.__database=new In(this))},enumerable:!0,configurable:!0}),t}(),gn=function(){function t(e){this.indexedFilter_=new ke(e.getIndex()),this.index_=e.getIndex(),this.startPost_=t.getStartPost_(e),this.endPost_=t.getEndPost_(e)}return t.prototype.getStartPost=function(){return this.startPost_},t.prototype.getEndPost=function(){return this.endPost_},t.prototype.matches=function(t){return this.index_.compare(this.getStartPost(),t)<=0&&this.index_.compare(t,this.getEndPost())<=0},t.prototype.updateChild=function(t,e,n,r,i,o){return this.matches(new Ot(e,n))||(n=Yt.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,r,i,o)},t.prototype.updateFullNode=function(t,e,n){e.isLeafNode()&&(e=Yt.EMPTY_NODE);var r=e.withIndex(this.index_);r=r.updatePriority(Yt.EMPTY_NODE);var i=this;return e.forEachChild(Bt,function(t,e){i.matches(new Ot(t,e))||(r=r.updateImmediateChild(t,Yt.EMPTY_NODE))}),this.indexedFilter_.updateFullNode(t,r,n)},t.prototype.updatePriority=function(t,e){return t},t.prototype.filtersNodes=function(){return!0},t.prototype.getIndexedFilter=function(){return this.indexedFilter_},t.prototype.getIndex=function(){return this.index_},t.getStartPost_=function(t){if(t.hasStart()){var e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()},t.getEndPost_=function(t){if(t.hasEnd()){var e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()},t}(),vn=function(){function t(t){this.rangedFilter_=new gn(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft()}return t.prototype.updateChild=function(t,e,n,r,i,o){return this.rangedFilter_.matches(new Ot(e,n))||(n=Yt.EMPTY_NODE),t.getImmediateChild(e).equals(n)?t:t.numChildren()<this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(t,e,n,r,i,o):this.fullLimitUpdateChild_(t,e,n,i,o)},t.prototype.updateFullNode=function(t,e,n){var r;if(e.isLeafNode()||e.isEmpty())r=Yt.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_<e.numChildren()&&e.isIndexed(this.index_)){r=Yt.EMPTY_NODE.withIndex(this.index_);var i=void 0;i=this.reverse_?e.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):e.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);for(var o=0;i.hasNext()&&o<this.limit_;){var a=i.getNext(),s=void 0;if(!(s=this.reverse_?this.index_.compare(this.rangedFilter_.getStartPost(),a)<=0:this.index_.compare(a,this.rangedFilter_.getEndPost())<=0))break;r=r.updateImmediateChild(a.name,a.node),o++}}else{r=e.withIndex(this.index_),r=r.updatePriority(Yt.EMPTY_NODE);var u=void 0,c=void 0,l=void 0,i=void 0;if(this.reverse_){i=r.getReverseIterator(this.index_),u=this.rangedFilter_.getEndPost(),c=this.rangedFilter_.getStartPost();var h=this.index_.getCompare();l=function(t,e){return h(e,t)}}else i=r.getIterator(this.index_),u=this.rangedFilter_.getStartPost(),c=this.rangedFilter_.getEndPost(),l=this.index_.getCompare();for(var o=0,f=!1;i.hasNext();){var a=i.getNext();!f&&l(u,a)<=0&&(f=!0);var s=f&&o<this.limit_&&l(a,c)<=0;s?o++:r=r.updateImmediateChild(a.name,Yt.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,r,n)},t.prototype.updatePriority=function(t,e){return t},t.prototype.filtersNodes=function(){return!0},t.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},t.prototype.getIndex=function(){return this.index_},t.prototype.fullLimitUpdateChild_=function(t,e,n,r,i){var o;if(this.reverse_){var a=this.index_.getCompare();o=function(t,e){return a(e,t)}}else o=this.index_.getCompare();var s=t;g.assert(s.numChildren()==this.limit_,"");var u=new Ot(e,n),c=this.reverse_?s.getFirstChild(this.index_):s.getLastChild(this.index_),l=this.rangedFilter_.matches(u);if(s.hasChild(e)){for(var h=s.getImmediateChild(e),f=r.getChildAfterChild(this.index_,c,this.reverse_);null!=f&&(f.name==e||s.hasChild(f.name));)f=r.getChildAfterChild(this.index_,f,this.reverse_);var p=null==f?1:o(f,u);if(l&&!n.isEmpty()&&p>=0)return null!=i&&i.trackChildChange(Ne.childChangedChange(e,n,h)),s.updateImmediateChild(e,n);null!=i&&i.trackChildChange(Ne.childRemovedChange(e,h));var d=s.updateImmediateChild(e,Yt.EMPTY_NODE);return null!=f&&this.rangedFilter_.matches(f)?(null!=i&&i.trackChildChange(Ne.childAddedChange(f.name,f.node)),d.updateImmediateChild(f.name,f.node)):d}return n.isEmpty()?t:l&&o(c,u)>=0?(null!=i&&(i.trackChildChange(Ne.childRemovedChange(c.name,c.node)),i.trackChildChange(Ne.childAddedChange(e,n))),s.updateImmediateChild(e,n).updateImmediateChild(c.name,Yt.EMPTY_NODE)):t},t}(),bn=function(){function t(){this.limitSet_=!1,this.startSet_=!1,this.startNameSet_=!1,this.endSet_=!1,this.endNameSet_=!1,this.limit_=0,this.viewFrom_="",this.indexStartValue_=null,this.indexStartName_="",this.indexEndValue_=null,this.indexEndName_="",this.index_=Bt}return t.prototype.hasStart=function(){return this.startSet_},t.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},t.prototype.getIndexStartValue=function(){return g.assert(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},t.prototype.getIndexStartName=function(){return g.assert(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:j},t.prototype.hasEnd=function(){return this.endSet_},t.prototype.getIndexEndValue=function(){return g.assert(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},t.prototype.getIndexEndName=function(){return g.assert(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:q},t.prototype.hasLimit=function(){return this.limitSet_},t.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},t.prototype.getLimit=function(){return g.assert(this.limitSet_,"Only valid if limit has been set"),this.limit_},t.prototype.getIndex=function(){return this.index_},t.prototype.copy_=function(){var e=new t;return e.limitSet_=this.limitSet_,e.limit_=this.limit_,e.startSet_=this.startSet_,e.indexStartValue_=this.indexStartValue_,e.startNameSet_=this.startNameSet_,e.indexStartName_=this.indexStartName_,e.endSet_=this.endSet_,e.indexEndValue_=this.indexEndValue_,e.endNameSet_=this.endNameSet_,e.indexEndName_=this.indexEndName_,e.index_=this.index_,e.viewFrom_=this.viewFrom_,e},t.prototype.limit=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_="",e},t.prototype.limitToFirst=function(e){var n=this.copy_();return n.limitSet_=!0,n.limit_=e,n.viewFrom_=t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,n},t.prototype.limitToLast=function(e){var n=this.copy_();return n.limitSet_=!0,n.limit_=e,n.viewFrom_=t.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,n},t.prototype.startAt=function(t,e){var n=this.copy_();return n.startSet_=!0,void 0===t&&(t=null),n.indexStartValue_=t,null!=e?(n.startNameSet_=!0,n.indexStartName_=e):(n.startNameSet_=!1,n.indexStartName_=""),n},t.prototype.endAt=function(t,e){var n=this.copy_();return n.endSet_=!0,void 0===t&&(t=null),n.indexEndValue_=t,void 0!==e?(n.endNameSet_=!0,n.indexEndName_=e):(n.endNameSet_=!1,n.indexEndName_=""),n},t.prototype.orderBy=function(t){var e=this.copy_();return e.index_=t,e},t.prototype.getQueryObject=function(){var e=t.WIRE_PROTOCOL_CONSTANTS_,n={};if(this.startSet_&&(n[e.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&&(n[e.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&&(n[e.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&&(n[e.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_){n[e.LIMIT]=this.limit_;var r=this.viewFrom_;""===r&&(r=this.isViewFromLeft()?e.VIEW_FROM_LEFT:e.VIEW_FROM_RIGHT),n[e.VIEW_FROM]=r}return this.index_!==Bt&&(n[e.INDEX]=this.index_.toString()),n},t.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},t.prototype.isDefault=function(){return this.loadsAllData()&&this.index_==Bt},t.prototype.getNodeFilter=function(){return this.loadsAllData()?new ke(this.getIndex()):this.hasLimit()?new vn(this):new gn(this)},t.prototype.toRestQueryStringParameters=function(){var e=t.REST_QUERY_CONSTANTS_,n={};if(this.isDefault())return n;var r;return this.index_===Bt?r=e.PRIORITY_INDEX:this.index_===ne?r=e.VALUE_INDEX:this.index_===xt?r=e.KEY_INDEX:(g.assert(this.index_ instanceof re,"Unrecognized index type!"),r=this.index_.toString()),n[e.ORDER_BY]=g.stringify(r),this.startSet_&&(n[e.START_AT]=g.stringify(this.indexStartValue_),this.startNameSet_&&(n[e.START_AT]+=","+g.stringify(this.indexStartName_))),this.endSet_&&(n[e.END_AT]=g.stringify(this.indexEndValue_),this.endNameSet_&&(n[e.END_AT]+=","+g.stringify(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?n[e.LIMIT_TO_FIRST]=this.limit_:n[e.LIMIT_TO_LAST]=this.limit_),n},t.WIRE_PROTOCOL_CONSTANTS_={INDEX_START_VALUE:"sp",INDEX_START_NAME:"sn",INDEX_END_VALUE:"ep",INDEX_END_NAME:"en",LIMIT:"l",VIEW_FROM:"vf",VIEW_FROM_LEFT:"l",VIEW_FROM_RIGHT:"r",INDEX:"i"},t.REST_QUERY_CONSTANTS_={ORDER_BY:"orderBy",PRIORITY_INDEX:"$priority",VALUE_INDEX:"$value",KEY_INDEX:"$key",START_AT:"startAt",END_AT:"endAt",LIMIT_TO_FIRST:"limitToFirst",LIMIT_TO_LAST:"limitToLast"},t.DEFAULT=new t,t}(),_n=function(t){function e(e,n){if(!(e instanceof mn))throw new Error("new Reference() no longer supported - use app.database().");return t.call(this,e,n,bn.DEFAULT,!1)||this}return b.__extends(e,t),e.prototype.getKey=function(){return g.validateArgCount("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},e.prototype.child=function(t){return g.validateArgCount("Reference.child",1,1,arguments.length),"number"===typeof t?t=String(t):t instanceof it||(null===this.path.getFront()?St("Reference.child",1,t,!1):Tt("Reference.child",1,t,!1)),new e(this.repo,this.path.child(t))},e.prototype.getParent=function(){g.validateArgCount("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new e(this.repo,t)},e.prototype.getRoot=function(){g.validateArgCount("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},e.prototype.databaseProp=function(){return this.repo.database},e.prototype.set=function(t,e){g.validateArgCount("Reference.set",1,2,arguments.length),Ct("Reference.set",this.path),mt("Reference.set",1,t,this.path,!1),g.validateCallback("Reference.set",2,e,!0);var n=new g.Deferred;return this.repo.setWithPriority(this.path,t,null,n.wrapCallback(e)),n.promise},e.prototype.update=function(t,e){if(g.validateArgCount("Reference.update",1,2,arguments.length),Ct("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r<t.length;++r)n[""+r]=t[r];t=n,F("Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}bt("Reference.update",1,t,this.path,!1),g.validateCallback("Reference.update",2,e,!0);var i=new g.Deferred;return this.repo.update(this.path,t,i.wrapCallback(e)),i.promise},e.prototype.setWithPriority=function(t,e,n){if(g.validateArgCount("Reference.setWithPriority",2,3,arguments.length),Ct("Reference.setWithPriority",this.path),mt("Reference.setWithPriority",1,t,this.path,!1),_t("Reference.setWithPriority",2,e,!1),g.validateCallback("Reference.setWithPriority",3,n,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.setWithPriority failed: "+this.getKey()+" is a read-only object.";var r=new g.Deferred;return this.repo.setWithPriority(this.path,t,e,r.wrapCallback(n)),r.promise},e.prototype.remove=function(t){return g.validateArgCount("Reference.remove",0,1,arguments.length),Ct("Reference.remove",this.path),g.validateCallback("Reference.remove",1,t,!0),this.set(null,t)},e.prototype.transaction=function(t,e,n){if(g.validateArgCount("Reference.transaction",1,3,arguments.length),Ct("Reference.transaction",this.path),g.validateCallback("Reference.transaction",1,t,!1),g.validateCallback("Reference.transaction",2,e,!0),Nt("Reference.transaction",3,n,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.transaction failed: "+this.getKey()+" is a read-only object.";void 0===n&&(n=!0);var r=new g.Deferred;"function"===typeof e&&r.promise.catch(function(){});var i=function(t,n,i){t?r.reject(t):r.resolve(new At(n,i)),"function"===typeof e&&e(t,n,i)};return this.repo.startTransaction(this.path,t,i,n),r.promise},e.prototype.setPriority=function(t,e){g.validateArgCount("Reference.setPriority",1,2,arguments.length),Ct("Reference.setPriority",this.path),_t("Reference.setPriority",1,t,!1),g.validateCallback("Reference.setPriority",2,e,!0);var n=new g.Deferred;return this.repo.setWithPriority(this.path.child(".priority"),t,null,n.wrapCallback(e)),n.promise},e.prototype.push=function(t,e){g.validateArgCount("Reference.push",0,2,arguments.length),Ct("Reference.push",this.path),mt("Reference.push",1,t,this.path,!0),g.validateCallback("Reference.push",2,e,!0);var n,r=this.repo.serverTime(),i=Rt(r),o=this.child(i),a=this.child(i);return n=null!=t?o.set(t,e).then(function(){return a}):Promise.resolve(a),o.then=n.then.bind(n),o.catch=n.then.bind(n,void 0),"function"===typeof e&&n.catch(function(){}),o},e.prototype.onDisconnect=function(){return Ct("Reference.onDisconnect",this.path),new kt(this.repo,this.path)},Object.defineProperty(e.prototype,"database",{get:function(){return this.databaseProp()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"key",{get:function(){return this.getKey()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){return this.getParent()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"root",{get:function(){return this.getRoot()},enumerable:!0,configurable:!0}),e}(ce);ce.__referenceConstructor=_n,Fe.__referenceConstructor=_n;var wn,En=function(){function t(){this.children={},this.childCount=0,this.value=null}return t}(),Tn=function(){function t(t,e,n){void 0===t&&(t=""),void 0===e&&(e=null),void 0===n&&(n=new En),this.name_=t,this.parent_=e,this.node_=n}return t.prototype.subTree=function(e){for(var n,r=e instanceof it?e:new it(e),i=this;null!==(n=r.getFront());){i=new t(n,i,g.safeGet(i.node_.children,n)||new En),r=r.popFront()}return i},t.prototype.getValue=function(){return this.node_.value},t.prototype.setValue=function(t){g.assert("undefined"!==typeof t,"Cannot set value to undefined"),this.node_.value=t,this.updateParents_()},t.prototype.clear=function(){this.node_.value=null,this.node_.children={},this.node_.childCount=0,this.updateParents_()},t.prototype.hasChildren=function(){return this.node_.childCount>0},t.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},t.prototype.forEachChild=function(e){var n=this;g.forEach(this.node_.children,function(r,i){e(new t(r,n,i))})},t.prototype.forEachDescendant=function(t,e,n){e&&!n&&t(this),this.forEachChild(function(e){e.forEachDescendant(t,!0,n)}),e&&n&&t(this)},t.prototype.forEachAncestor=function(t,e){for(var n=e?this:this.parent();null!==n;){if(t(n))return!0;n=n.parent()}return!1},t.prototype.forEachImmediateDescendantWithValue=function(t){this.forEachChild(function(e){null!==e.getValue()?t(e):e.forEachImmediateDescendantWithValue(t)})},t.prototype.path=function(){return new it(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)},t.prototype.name=function(){return this.name_},t.prototype.parent=function(){return this.parent_},t.prototype.updateParents_=function(){null!==this.parent_&&this.parent_.updateChild_(this.name_,this)},t.prototype.updateChild_=function(t,e){var n=e.isEmpty(),r=g.contains(this.node_.children,t);n&&r?(delete this.node_.children[t],this.node_.childCount--,this.updateParents_()):n||r||(this.node_.children[t]=e.node_,this.node_.childCount++,this.updateParents_())},t}();!function(t){t[t.RUN=0]="RUN",t[t.SENT=1]="SENT",t[t.COMPLETED=2]="COMPLETED",t[t.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",t[t.NEEDS_ABORT=4]="NEEDS_ABORT"}(wn||(wn={})),mn.MAX_TRANSACTION_RETRIES_=25,mn.prototype.transactions_init_=function(){this.transactionQueueTree_=new Tn},mn.prototype.startTransaction=function(t,e,n,r){this.log_("transaction on "+t);var i=function(){},o=new _n(this,t);o.on("value",i);var a=function(){o.off("value",i)},s={path:t,update:e,onComplete:n,status:null,order:N(),applyLocally:r,retryCount:0,unwatcher:a,abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},c=this.getLatestState_(t);s.currentInputSnapshot=c;var l=s.update(c.val());if(void 0===l){if(s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete){var h=new ie(s.currentInputSnapshot,new _n(this,s.path),Bt);s.onComplete(null,!1,h)}}else{gt("transaction failed: Data returned ",l,s.path),s.status=wn.RUN;var f=this.transactionQueueTree_.subTree(t),p=f.getValue()||[];p.push(s),f.setValue(p);var d=void 0;if("object"===typeof l&&null!==l&&g.contains(l,".priority"))d=g.safeGet(l,".priority"),g.assert(yt(d),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.");else{d=(this.serverSyncTree_.calcCompleteEventCache(t)||Yt.EMPTY_NODE).getPriority().val()}d=d;var y=this.generateServerValues(),m=u(l,d),v=ye(m,y);s.currentOutputSnapshotRaw=m,s.currentOutputSnapshotResolved=v,s.currentWriteId=this.getNextWriteId_();var b=this.serverSyncTree_.applyUserOverwrite(t,v,s.currentWriteId,s.applyLocally);this.eventQueue_.raiseEventsForChangedPath(t,b),this.sendReadyTransactions_()}},mn.prototype.getLatestState_=function(t,e){return this.serverSyncTree_.calcCompleteEventCache(t,e)||Yt.EMPTY_NODE},mn.prototype.sendReadyTransactions_=function(t){var e=this;if(void 0===t&&(t=this.transactionQueueTree_),t||this.pruneCompletedTransactionsBelowNode_(t),null!==t.getValue()){var n=this.buildTransactionQueue_(t);g.assert(n.length>0,"Sending zero length transaction queue");n.every(function(t){return t.status===wn.RUN})&&this.sendTransactionQueue_(t.path(),n)}else t.hasChildren()&&t.forEachChild(function(t){e.sendReadyTransactions_(t)})},mn.prototype.sendTransactionQueue_=function(t,e){for(var n=this,r=e.map(function(t){return t.currentWriteId}),i=this.getLatestState_(t,r),o=i,a=i.hash(),s=0;s<e.length;s++){var u=e[s];g.assert(u.status===wn.RUN,"tryToSendTransactionQueue_: items in queue should all be run."),u.status=wn.SENT,u.retryCount++;var c=it.relativePath(t,u.path);o=o.updateChild(c,u.currentOutputSnapshotRaw)}var l=o.val(!0),h=t;this.server_.put(h.toString(),l,function(r){n.log_("transaction put response",{path:h.toString(),status:r});var i=[];if("ok"===r){for(var o=[],a=0;a<e.length;a++){if(e[a].status=wn.COMPLETED,i=i.concat(n.serverSyncTree_.ackUserWrite(e[a].currentWriteId)),e[a].onComplete){var s=e[a].currentOutputSnapshotResolved,u=new _n(n,e[a].path),c=new ie(s,u,Bt);o.push(e[a].onComplete.bind(null,null,!0,c))}e[a].unwatcher()}n.pruneCompletedTransactionsBelowNode_(n.transactionQueueTree_.subTree(t)),n.sendReadyTransactions_(),n.eventQueue_.raiseEventsForChangedPath(t,i);for(var a=0;a<o.length;a++)et(o[a])}else{if("datastale"===r)for(var a=0;a<e.length;a++)e[a].status===wn.SENT_NEEDS_ABORT?e[a].status=wn.NEEDS_ABORT:e[a].status=wn.RUN;else{F("transaction at "+h.toString()+" failed: "+r);for(var a=0;a<e.length;a++)e[a].status=wn.NEEDS_ABORT,e[a].abortReason=r}n.rerunTransactions_(t)}},a)},mn.prototype.rerunTransactions_=function(t){var e=this.getAncestorTransactionNode_(t),n=e.path(),r=this.buildTransactionQueue_(e);return this.rerunTransactionQueue_(r,n),n},mn.prototype.rerunTransactionQueue_=function(t,e){if(0!==t.length){for(var n=[],r=[],i=t.filter(function(t){return t.status===wn.RUN}),o=i.map(function(t){return t.currentWriteId}),a=0;a<t.length;a++){var s=t[a],c=it.relativePath(e,s.path),l=!1,h=void 0;if(g.assert(null!==c,"rerunTransactionsUnderNode_: relativePath should not be null."),s.status===wn.NEEDS_ABORT)l=!0,h=s.abortReason,r=r.concat(this.serverSyncTree_.ackUserWrite(s.currentWriteId,!0));else if(s.status===wn.RUN)if(s.retryCount>=mn.MAX_TRANSACTION_RETRIES_)l=!0,h="maxretry",r=r.concat(this.serverSyncTree_.ackUserWrite(s.currentWriteId,!0));else{var f=this.getLatestState_(s.path,o);s.currentInputSnapshot=f;var p=t[a].update(f.val());if(void 0!==p){gt("transaction failed: Data returned ",p,s.path);var d=u(p),y="object"===typeof p&&null!=p&&g.contains(p,".priority");y||(d=d.updatePriority(f.getPriority()));var m=s.currentWriteId,v=this.generateServerValues(),b=ye(d,v);s.currentOutputSnapshotRaw=d,s.currentOutputSnapshotResolved=b,s.currentWriteId=this.getNextWriteId_(),o.splice(o.indexOf(m),1),r=r.concat(this.serverSyncTree_.applyUserOverwrite(s.path,b,s.currentWriteId,s.applyLocally)),r=r.concat(this.serverSyncTree_.ackUserWrite(m,!0))}else l=!0,h="nodata",r=r.concat(this.serverSyncTree_.ackUserWrite(s.currentWriteId,!0))}if(this.eventQueue_.raiseEventsForChangedPath(e,r),r=[],l&&(t[a].status=wn.COMPLETED,function(t){setTimeout(t,Math.floor(0))}(t[a].unwatcher),t[a].onComplete))if("nodata"===h){var _=new _n(this,t[a].path),w=t[a].currentInputSnapshot,E=new ie(w,_,Bt);n.push(t[a].onComplete.bind(null,null,!1,E))}else n.push(t[a].onComplete.bind(null,new Error(h),!1,null))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(var a=0;a<n.length;a++)et(n[a]);this.sendReadyTransactions_()}},mn.prototype.getAncestorTransactionNode_=function(t){for(var e,n=this.transactionQueueTree_;null!==(e=t.getFront())&&null===n.getValue();)n=n.subTree(e),t=t.popFront();return n},mn.prototype.buildTransactionQueue_=function(t){var e=[];return this.aggregateTransactionQueuesForNode_(t,e),e.sort(function(t,e){return t.order-e.order}),e},mn.prototype.aggregateTransactionQueuesForNode_=function(t,e){var n=this,r=t.getValue();if(null!==r)for(var i=0;i<r.length;i++)e.push(r[i]);t.forEachChild(function(t){n.aggregateTransactionQueuesForNode_(t,e)})},mn.prototype.pruneCompletedTransactionsBelowNode_=function(t){var e=this,n=t.getValue();if(n){for(var r=0,i=0;i<n.length;i++)n[i].status!==wn.COMPLETED&&(n[r]=n[i],r++);n.length=r,t.setValue(n.length>0?n:null)}t.forEachChild(function(t){e.pruneCompletedTransactionsBelowNode_(t)})},mn.prototype.abortTransactions_=function(t){var e=this,n=this.getAncestorTransactionNode_(t).path(),r=this.transactionQueueTree_.subTree(t);return r.forEachAncestor(function(t){e.abortTransactionsOnNode_(t)}),this.abortTransactionsOnNode_(r),r.forEachDescendant(function(t){e.abortTransactionsOnNode_(t)}),n},mn.prototype.abortTransactionsOnNode_=function(t){var e=t.getValue();if(null!==e){for(var n=[],r=[],i=-1,o=0;o<e.length;o++)if(e[o].status===wn.SENT_NEEDS_ABORT);else if(e[o].status===wn.SENT)g.assert(i===o-1,"All SENT items should be at beginning of queue."),i=o,e[o].status=wn.SENT_NEEDS_ABORT,e[o].abortReason="set";else if(g.assert(e[o].status===wn.RUN,"Unexpected transaction status in abort"),e[o].unwatcher(),r=r.concat(this.serverSyncTree_.ackUserWrite(e[o].currentWriteId,!0)),e[o].onComplete){n.push(e[o].onComplete.bind(null,new Error("set"),!1,null))}-1===i?t.setValue(null):e.length=i+1,this.eventQueue_.raiseEventsForChangedPath(t.path(),r);for(var o=0;o<n.length;o++)et(n[o])}};var Sn,Cn=function(){function t(){this.repos_={},this.useRestClient_=!1}return t.getInstance=function(){return Sn||(Sn=new t),Sn},t.prototype.interrupt=function(){for(var t in this.repos_)for(var e in this.repos_[t])this.repos_[t][e].interrupt()},t.prototype.resume=function(){for(var t in this.repos_)for(var e in this.repos_[t])this.repos_[t][e].resume()},t.prototype.databaseFromApp=function(t,e){var n=e||t.options.databaseURL;void 0===n&&M("Can't determine Firebase Database URL. Be sure to include databaseURL option when calling firebase.initializeApp().");var r=ut(n),i=r.repoInfo;return It("Invalid Firebase Database URL",1,r),r.path.isEmpty()||M("Database URL must point to the root of a Firebase Database (not including a child path)."),this.createRepo(i,t).database},t.prototype.deleteRepo=function(t){var e=g.safeGet(this.repos_,t.app.name);e&&g.safeGet(e,t.repoInfo_.toURLString())===t||M("Database "+t.app.name+"("+t.repoInfo_+") has already been deleted."),t.interrupt(),delete e[t.repoInfo_.toURLString()]},t.prototype.createRepo=function(t,e){var n=g.safeGet(this.repos_,e.name);n||(n={},this.repos_[e.name]=n);var r=g.safeGet(n,t.toURLString());return r&&M("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),r=new mn(t,this.useRestClient_,e),n[t.toURLString()]=r,r},t.prototype.forceRestClient=function(t){this.useRestClient_=t},t}(),In=function(){function t(t){this.repo_=t,t instanceof mn||M("Don't call new Database() directly - please use firebase.database()."),this.root_=new _n(t,it.Empty),this.INTERNAL=new Nn(this)}return Object.defineProperty(t.prototype,"app",{get:function(){return this.repo_.app},enumerable:!0,configurable:!0}),t.prototype.ref=function(t){return this.checkDeleted_("ref"),g.validateArgCount("database.ref",0,1,arguments.length),t instanceof _n?this.refFromURL(t.toString()):void 0!==t?this.root_.child(t):this.root_},t.prototype.refFromURL=function(t){var e="database.refFromURL";this.checkDeleted_(e),g.validateArgCount(e,1,1,arguments.length);var n=ut(t);It(e,1,n);var r=n.repoInfo;return r.host!==this.repo_.repoInfo_.host&&M(e+": Host name does not match the current database: (found "+r.host+" but expected "+this.repo_.repoInfo_.host+")"),this.ref(n.path.toString())},t.prototype.checkDeleted_=function(t){null===this.repo_&&M("Cannot call "+t+" on a deleted database.")},t.prototype.goOffline=function(){g.validateArgCount("database.goOffline",0,0,arguments.length),this.checkDeleted_("goOffline"),this.repo_.interrupt()},t.prototype.goOnline=function(){g.validateArgCount("database.goOnline",0,0,arguments.length),this.checkDeleted_("goOnline"),this.repo_.resume()},t.ServerValue={TIMESTAMP:{".sv":"timestamp"}},t}(),Nn=function(){function t(t){this.database=t}return t.prototype.delete=function(){return b.__awaiter(this,void 0,void 0,function(){return b.__generator(this,function(t){return this.database.checkDeleted_("delete"),Cn.getInstance().deleteRepo(this.database.repo_),this.database.repo_=null,this.database.root_=null,this.database.INTERNAL=null,this.database=null,[2]})})},t}(),kn=function(){un.forceDisallow(),on.forceAllow()},An=function(){on.forceDisallow()},Rn=function(){return un.isAvailable()},On=function(t,e){t.repo.persistentConnection_.securityDebugCallback_=e},Dn=function(t,e){t.repo.stats(e)},Pn=function(t,e){t.repo.statsIncrementCounter(e)},xn=function(t){return t.repo.dataUpdateCount},Ln=function(t,e){return t.repo.interceptServerData_(e)},Mn=Object.freeze({forceLongPolling:kn,forceWebSockets:An,isWebSocketsAvailable:Rn,setSecurityDebugCallback:On,stats:Dn,statsIncrementCounter:Pn,dataUpdateCount:xn,interceptServerData:Ln}),Fn=dn;dn.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},dn.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};var Un=ln,Bn=function(t){var e=dn.prototype.put;return dn.prototype.put=function(n,r,i,o){void 0!==o&&(o=t()),e.call(this,n,r,i,o)},function(){dn.prototype.put=e}},Vn=st,jn=function(t){return t.queryIdentifier()},qn=function(t){return t.repo.persistentConnection_.listens_},Wn=function(t){Cn.getInstance().forceRestClient(t)},Kn=Object.freeze({DataConnection:Fn,RealTimeConnection:Un,hijackHash:Bn,ConnectionTarget:Vn,queryIdentifier:jn,listens:qn,forceRestClient:Wn}),Hn=In.ServerValue;c(_),e.registerDatabase=c,e.Database=In,e.Query=ce,e.Reference=_n,e.enableLogging=D,e.ServerValue=Hn,e.DataSnapshot=ie,e.OnDisconnect=kt}).call(e,n(12))},function(t,e,n){"use strict";function r(){return ae.logLevel===ne.LogLevel.DEBUG?te.DEBUG:ae.logLevel===ne.LogLevel.SILENT?te.SILENT:te.ERROR}function i(t){switch(t){case te.DEBUG:ae.logLevel=ne.LogLevel.DEBUG;break;case te.ERROR:ae.logLevel=ne.LogLevel.ERROR;break;case te.SILENT:ae.logLevel=ne.LogLevel.SILENT;break;default:ae.error("Firestore ("+oe+"): Invalid value passed to `setLogLevel`")}}function o(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(ae.logLevel<=ne.LogLevel.DEBUG){var i=n.map(s);ae.debug.apply(ae,["Firestore ("+oe+") ["+t+"]: "+e].concat(i))}}function a(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(ae.logLevel<=ne.LogLevel.ERROR){var r=e.map(s);ae.error.apply(ae,["Firestore ("+oe+"): "+t].concat(r))}}function s(t){if("string"===typeof t)return t;var e=se.getPlatform();try{return e.formatJSON(t)}catch(e){return t}}function u(t){var e="FIRESTORE ("+oe+") INTERNAL ASSERTION FAILED: "+t;throw a(e),new Error(e)}function c(t,e){t||u(e)}function l(){return se.getPlatform().emptyByteString}function h(t,e){function n(){var t="This constructor is private.";throw e&&(t+=" ",t+=e),new ce(ue.INVALID_ARGUMENT,t)}n.prototype=t.prototype;for(var r in t)t.hasOwnProperty(r)&&(n[r]=t[r]);return n}function f(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function p(t,e){return void 0!==t?t:e}function d(t,e){for(var n in t)if(Object.prototype.hasOwnProperty.call(t,n)){var r=Number(n);isNaN(r)||e(r,t[n])}}function y(t,e){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e(n,t[n])}function m(t){c(null!=t&&"object"===typeof t,"isEmpty() expects object parameter.");for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function g(t){c(t&&"object"===typeof t,"shallowCopy() expects object parameter.");var e={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}function v(t,e,n){if(e.length!==n)throw new ce(ue.INVALID_ARGUMENT,"Function "+t+"() requires "+U(n,"argument")+", but was called with "+U(e.length,"argument")+".")}function b(t,e,n){if(e.length<n)throw new ce(ue.INVALID_ARGUMENT,"Function "+t+"() requires at least "+U(n,"argument")+", but was called with "+U(e.length,"argument")+".")}function _(t,e,n,r){if(e.length<n||e.length>r)throw new ce(ue.INVALID_ARGUMENT,"Function "+t+"() requires between "+n+" and "+r+" arguments, but was called with "+U(e.length,"argument")+".")}function w(t,e,n,r){if(!(e instanceof Array)||e.length<r)throw new ce(ue.INVALID_ARGUMENT,"Function "+t+"() requires its "+n+" argument to be an array with at least "+U(r,"element")+".")}function E(t,e,n,r){R(t,e,F(n)+" argument",r)}function T(t,e,n,r){void 0!==r&&E(t,e,n,r)}function S(t,e,n,r){R(t,e,n+" option",r)}function C(t,e,n,r){void 0!==r&&S(t,e,n,r)}function I(t,e,n,r,i){if(!(r instanceof Array))throw new ce(ue.INVALID_ARGUMENT,"Function "+t+"() requires its "+e+" option to be an array, but it was: "+D(r));for(var o=0;o<r.length;++o)if(!i(r[o]))throw new ce(ue.INVALID_ARGUMENT,"Function "+t+"() requires all "+e+" elements to be "+n+", but the value at index "+o+" was: "+D(r[o]))}function N(t,e,n,r,i){void 0!==r&&I(t,e,n,r,i)}function k(t,e,n,r,i){for(var o=[],a=0,s=i;a<s.length;a++){var u=s[a];if(u===r)return;o.push(D(u))}var c=D(r);throw new ce(ue.INVALID_ARGUMENT,"Invalid value "+c+" provided to function "+t+'() for option "'+n+'". Acceptable values: '+o.join(", "))}function A(t,e,n,r,i){void 0!==r&&k(t,e,n,r,i)}function R(t,e,n,r){if(typeof r!==e||"object"===e&&!O(r)){var i=D(r);throw new ce(ue.INVALID_ARGUMENT,"Function "+t+"() requires its "+n+" to be of type "+e+", but it was: "+i)}}function O(t){return"object"===typeof t&&null!==t&&(Object.getPrototypeOf(t)===Object.prototype||null===Object.getPrototypeOf(t))}function D(t){if(void 0===t)return"undefined";if(null===t)return"null";if("string"===typeof t)return t.length>20&&(t=t.substring(0,20)+"..."),JSON.stringify(t);if("number"===typeof t||"boolean"===typeof t)return""+t;if("object"===typeof t){if(t instanceof Array)return"an array";var e=P(t);return e?"a custom "+e+" object":"an object"}return"function"===typeof t?"a function":u("Unknown wrong type: "+typeof t)}function P(t){if(t.constructor){var e=/function\s+([^\s(]+)\s*\(/,n=e.exec(t.constructor.toString());if(n&&n.length>1)return n[1]}return null}function x(t,e,n){if(void 0===n)throw new ce(ue.INVALID_ARGUMENT,"Function "+t+"() requires a valid "+F(e)+" argument, but it was undefined.")}function L(t,e,n){y(e,function(e,r){if(n.indexOf(e)<0)throw new ce(ue.INVALID_ARGUMENT,"Unknown option '"+e+"' passed to function "+t+"(). Available options: "+n.join(", "))})}function M(t,e,n,r){var i=D(r);return new ce(ue.INVALID_ARGUMENT,"Function "+t+"() requires its "+F(n)+" argument to be a "+e+", but it was: "+i)}function F(t){switch(t){case 1:return"first";case 2:return"second";case 3:return"third";default:return t+"th"}}function U(t,e){return t+" "+e+(1===t?"":"s")}function B(t,e){return t<e?-1:t>e?1:0}function V(t,e){return null!==t&&void 0!==t?!(!e||!t.isEqual(e)):t===e}function j(t,e){if(t.length!==e.length)return!1;for(var n=0;n<t.length;n++)if(!t[n].isEqual(e[n]))return!1;return!0}function q(t){var e=t.length-1;return 0===t.length?"":"\0"===t.charAt(e)?t.substring(0,e):t.substring(0,e)+String.fromCharCode(t.charCodeAt(e)-1)}function W(t){return t+"\0"}function K(){if("undefined"===typeof Uint8Array)throw new ce(ue.UNIMPLEMENTED,"Uint8Arrays are not available in this environment.")}function H(){if(!se.getPlatform().base64Available)throw new ce(ue.UNIMPLEMENTED,"Blobs are unavailable in Firestore in this environment.")}function G(t,e){return t<e?-1:t>e?1:t===e?0:isNaN(t)?isNaN(e)?0:-1:1}function Q(t,e){return t===e?0!==t||1/t===1/e:t!==t&&e!==e}function z(t){return null===t||void 0===t}function Y(t){return Xe(t)&&t<=Ye&&t>=ze}function X(t,e,n){if(n.isEqual(xe.INSTANCE)){if(e!==$e.EQUAL)throw new ce(ue.INVALID_ARGUMENT,"Invalid query. You can only perform equals comparisons on null.");return new tn(t)}if(n.isEqual(Ue.NAN)){if(e!==$e.EQUAL)throw new ce(ue.INVALID_ARGUMENT,"Invalid query. You can only perform equals comparisons on NaN.");return new en(t)}return new Ze(t,e,n)}function J(t){switch(t){case ue.OK:return u("Treated status OK as error");case ue.CANCELLED:case ue.UNKNOWN:case ue.DEADLINE_EXCEEDED:case ue.RESOURCE_EXHAUSTED:case ue.INTERNAL:case ue.UNAVAILABLE:case ue.UNAUTHENTICATED:return!1;case ue.INVALID_ARGUMENT:case ue.NOT_FOUND:case ue.ALREADY_EXISTS:case ue.PERMISSION_DENIED:case ue.FAILED_PRECONDITION:case ue.ABORTED:case ue.OUT_OF_RANGE:case ue.UNIMPLEMENTED:case ue.DATA_LOSS:return!0;default:return u("Unknown status code: "+t)}}function $(t){var e=dn[t];if(void 0!==e)return Z(e)}function Z(t){if(void 0===t)return a("GRPC error has no .code"),ue.UNKNOWN;switch(t){case dn.OK:return ue.OK;case dn.CANCELLED:return ue.CANCELLED;case dn.UNKNOWN:return ue.UNKNOWN;case dn.DEADLINE_EXCEEDED:return ue.DEADLINE_EXCEEDED;case dn.RESOURCE_EXHAUSTED:return ue.RESOURCE_EXHAUSTED;case dn.INTERNAL:return ue.INTERNAL;case dn.UNAVAILABLE:return ue.UNAVAILABLE;case dn.UNAUTHENTICATED:return ue.UNAUTHENTICATED;case dn.INVALID_ARGUMENT:return ue.INVALID_ARGUMENT;case dn.NOT_FOUND:return ue.NOT_FOUND;case dn.ALREADY_EXISTS:return ue.ALREADY_EXISTS;case dn.PERMISSION_DENIED:return ue.PERMISSION_DENIED;case dn.FAILED_PRECONDITION:return ue.FAILED_PRECONDITION;case dn.ABORTED:return ue.ABORTED;case dn.OUT_OF_RANGE:return ue.OUT_OF_RANGE;case dn.UNIMPLEMENTED:return ue.UNIMPLEMENTED;case dn.DATA_LOSS:return ue.DATA_LOSS;default:return u("Unknown status code: "+t)}}function tt(t){if(void 0===t)return dn.OK;switch(t){case ue.OK:return dn.OK;case ue.CANCELLED:return dn.CANCELLED;case ue.UNKNOWN:return dn.UNKNOWN;case ue.DEADLINE_EXCEEDED:return dn.DEADLINE_EXCEEDED;case ue.RESOURCE_EXHAUSTED:return dn.RESOURCE_EXHAUSTED;case ue.INTERNAL:return dn.INTERNAL;case ue.UNAVAILABLE:return dn.UNAVAILABLE;case ue.UNAUTHENTICATED:return dn.UNAUTHENTICATED;case ue.INVALID_ARGUMENT:return dn.INVALID_ARGUMENT;case ue.NOT_FOUND:return dn.NOT_FOUND;case ue.ALREADY_EXISTS:return dn.ALREADY_EXISTS;case ue.PERMISSION_DENIED:return dn.PERMISSION_DENIED;case ue.FAILED_PRECONDITION:return dn.FAILED_PRECONDITION;case ue.ABORTED:return dn.ABORTED;case ue.OUT_OF_RANGE:return dn.OUT_OF_RANGE;case ue.UNIMPLEMENTED:return dn.UNIMPLEMENTED;case ue.DATA_LOSS:return dn.DATA_LOSS;default:return u("Unknown status code: "+t)}}function et(t){switch(t){case 200:return ue.OK;case 400:return ue.INVALID_ARGUMENT;case 401:return ue.UNAUTHENTICATED;case 403:return ue.PERMISSION_DENIED;case 404:return ue.NOT_FOUND;case 409:return ue.ABORTED;case 416:return ue.OUT_OF_RANGE;case 429:return ue.RESOURCE_EXHAUSTED;case 499:return ue.CANCELLED;case 500:return ue.UNKNOWN;case 501:return ue.UNIMPLEMENTED;case 503:return ue.UNAVAILABLE;case 504:return ue.DEADLINE_EXCEEDED;default:return t>=200&&t<300?ue.OK:t>=400&&t<500?ue.FAILED_PRECONDITION:t>=500&&t<600?ue.INTERNAL:ue.UNKNOWN}}function nt(){return Sn}function rt(){return Cn}function it(){return In}function ot(){return Nn}function at(t,e){e.length>0&&(t.resumeToken=e)}function st(t){return t instanceof Ge?t.internalValue.slice():[]}function ut(t,e){c(!z(t),e+" is missing")}function ct(t){return"number"===typeof t?t:"string"===typeof t?Number(t):u("can't parse "+t)}function lt(t,e,n){return e===n||!e&&n in t}function ht(t){if(t.search(ir)>=0)throw new ce(ue.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not contain '~', '*', '/', '[', or ']'");try{return new(rr.bind.apply(rr,[void 0].concat(t.split("."))))}catch(e){throw new ce(ue.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'")}}function ft(t,e){var n=function(t){switch(t){case or.Added:return 1;case or.Modified:case or.Metadata:return 2;case or.Removed:return 0;default:return u("Unknown ChangeType: "+t)}};return n(t)-n(e)}function pt(t){for(var e="",n=0;n<t.length;n++)e.length>0&&(e=yt(e)),e=dt(t.get(n),e);return yt(e)}function dt(t,e){for(var n=e,r=t.length,i=0;i<r;i++){var o=t.charAt(i);switch(o){case"\0":n+=Or+Pr;break;case Or:n+=Or+xr;break;default:n+=o}}return n}function yt(t){return t+Or+Dr}function mt(t){var e=t.length;if(c(e>=2,"Invalid path "+t),2===e)return c(t.charAt(0)===Or&&t.charAt(1)===Dr,"Non-empty path "+t+" had length 2"),be.EMPTY_PATH;for(var n=e-2,r=[],i="",o=0;o<e;){var a=t.indexOf(Or,o);(a<0||a>n)&&u('Invalid encoded resource path: "'+t+'"');switch(t.charAt(a+1)){case Dr:var s=t.substring(o,a),l=void 0;0===i.length?l=s:(i+=s,l=i,i=""),r.push(l);break;case Pr:i+=t.substring(o,a),i+="\0";break;case xr:i+=t.substring(o,a+1);break;default:u('Invalid encoded resource path: "'+t+'"')}o=a+2}return new be(r)}function gt(t,e,n,r){c(n<r&&n>=0&&r<=2,"Unexpected schema upgrade from v${fromVersion} to v{toVersion}."),n<1&&r>=1&&(vt(t),bt(t),wt(t),_t(t));var i=yr.resolve();return n<2&&r>=2&&(i=Tt(e).next(function(t){return Et(e,t)})),i}function vt(t){t.createObjectStore(Mr.store)}function bt(t){t.createObjectStore(Fr.store,{keyPath:Fr.keyPath}),t.createObjectStore(Ur.store,{keyPath:Ur.keyPath}),t.createObjectStore(Br.store)}function _t(t){t.createObjectStore(jr.store)}function wt(t){t.createObjectStore(Wr.store,{keyPath:Wr.keyPath}).createIndex(Wr.documentTargetsIndex,Wr.documentTargetsKeyPath,{unique:!0}),t.createObjectStore(qr.store,{keyPath:qr.keyPath}).createIndex(qr.queryTargetsIndexName,qr.queryTargetsKeyPath,{unique:!0}),t.createObjectStore(Kr.store)}function Et(t,e){var n=t.store(Kr.store);return t.store(qr.store).count().next(function(t){return e.targetCount=t,n.put(Kr.key,e)})}function Tt(t){var e=t.store(Kr.store);return e.get(Kr.key).next(function(t){return null!=t?yr.resolve(t):(t=new Kr(0,0,un.MIN.toTimestamp(),0),e.put(Kr.key,t).next(function(){return t}))})}function St(t){return new yr(function(e,n){t.onsuccess=function(t){var n=t.target.result;e(n)},t.onerror=function(t){n(t.target.error)}})}function Ct(t){return t instanceof Uint8Array?(c("YES"===Object({NODE_ENV:"production",PUBLIC_URL:"/push-notification-demo"}).USE_MOCK_PERSISTENCE,"Persisting non-string stream tokens is only supported with mock persistence ."),t.toString()):t}function It(t){return At(t,Ur.store)}function Nt(t){return At(t,Br.store)}function kt(t){return At(t,Fr.store)}function At(t,e){return t instanceof Yr?t.store(e):u("Invalid transaction object provided!")}function Rt(t){return Pt(t,qr.store)}function Ot(t){return Pt(t,Kr.store)}function Dt(t){return Pt(t,Wr.store)}function Pt(t,e){return t instanceof Yr?t.store(e):u("Invalid transaction object provided!")}function xt(t){return t instanceof Yr?t.store(jr.store):u("Invalid transaction object provided!")}function Lt(t){return t.path.toArray()}function Mt(t){return void 0!==t.documents}function Ft(t){if(!t)return new Di;switch(t.type){case"gapi":return new Li(t.client,t.sessionIndex||"0");case"provider":return t.client;default:throw new ce(ue.INVALID_ARGUMENT,"makeCredentialsProvider failed due to invalid credential type")}}function Ut(t){return Bt(t,["next","error","complete"])}function Bt(t,e){if("object"!==typeof t||null===t)return!1;for(var n=t,r=0,i=e;r<i.length;r++){var o=i[r];if(o in n&&"function"===typeof n[o])return!0}return!1}function Vt(t){switch(t){case gi.Set:case gi.MergeSet:case gi.Update:return!0;case gi.Argument:return!1;default:throw u("Unexpected case for UserDataSource: "+t)}}function jt(t){return"object"===typeof t&&null!==t&&!(t instanceof Array)&&!(t instanceof Date)&&!(t instanceof de)&&!(t instanceof pe)&&!(t instanceof he)&&!(t instanceof Gi)&&!(t instanceof Mi)}function qt(t,e,n){if(!jt(n)||!O(n)){var r=D(n);throw"an object"===r?e.createError(t+" a custom object"):e.createError(t+" "+r)}}function Wt(t,e){if(e instanceof rr)return e._internalPath;if("string"===typeof e)return Kt(t,e);throw new ce(ue.INVALID_ARGUMENT,"Function "+t+"() called with invalid data. Field path arguments must be of type string or FieldPath.")}function Kt(t,e){try{return ht(e)._internalPath}catch(e){var n=Ht(e);throw new ce(ue.INVALID_ARGUMENT,"Function "+t+"() called with invalid data. "+n)}}function Ht(t){return t instanceof Error?t.message:t.toString()}function Gt(){throw new ce(ue.INVALID_ARGUMENT,'QuerySnapshot.docChanges has been changed from a property into a method, so usages like "querySnapshot.docChanges" should become "querySnapshot.docChanges()"')}function Qt(t,e){if(void 0===e)return{merge:!1};if(L(t,e,["merge","mergeFields"]),C(t,"boolean","merge",e.merge),N(t,"mergeFields","a string or a FieldPath",e.mergeFields,function(t){return"string"===typeof t||t instanceof rr}),void 0!==e.mergeFields&&void 0!==e.merge)throw new ce(ue.INVALID_ARGUMENT,"Invalid options passed to function "+t+'(): You cannot specify both "merge" and "mergeFields".');return e}function zt(t,e){return void 0===e?{}:(L(t,e,["serverTimestamps"]),A(t,"options","serverTimestamps",e.serverTimestamps,["estimate","previous","none"]),e)}function Yt(t,e,n){if(e instanceof no){if(e.firestore!==n)throw new ce(ue.INVALID_ARGUMENT,"Provided document reference is from a different Firestore instance.");return e}throw M(t,"DocumentReference",1,e)}function Xt(t,e,n){if(n.oldDocs.isEmpty()){var r,i=0;return n.docChanges.map(function(e){var o=new oo(t,e.doc.key,e.doc,n.fromCache);return c(e.type===or.Added,"Invalid event type for first snapshot"),c(!r||n.query.docComparator(r,e.doc)<0,"Got added events in wrong order"),r=e.doc,{type:"added",doc:o,oldIndex:-1,newIndex:i++}})}var o=n.oldDocs;return n.docChanges.filter(function(t){return e||t.type!==or.Metadata}).map(function(e){var r=new oo(t,e.doc.key,e.doc,n.fromCache),i=-1,a=-1;return e.type!==or.Added&&(i=o.indexOf(e.doc.key),c(i>=0,"Index for document not found"),o=o.delete(e.doc.key)),e.type!==or.Removed&&(o=o.add(e.doc),a=o.indexOf(e.doc.key)),{type:Jt(e.type),doc:r,oldIndex:i,newIndex:a}})}function Jt(t){switch(t){case or.Added:return"added";case or.Modified:case or.Metadata:return"modified";case or.Removed:return"removed";default:return u("Unknown change type: "+t)}}function $t(t){t.INTERNAL.registerService("firestore",function(t){return new Zi(t)},g(bo))}function Zt(t){$t(t)}Object.defineProperty(e,"__esModule",{value:!0});var te,ee=function(t){return t&&"object"===typeof t&&"default"in t?t.default:t}(n(0)),ne=n(13),re=n(2),ie=n(43),oe=ee.SDK_VERSION,ae=new ne.Logger("@firebase/firestore");!function(t){t[t.DEBUG=0]="DEBUG",t[t.ERROR=1]="ERROR",t[t.SILENT=2]="SILENT"}(te||(te={}));var se=function(){function t(){}return t.setPlatform=function(e){t.platform&&u("Platform already defined"),t.platform=e},t.getPlatform=function(){return t.platform||u("Platform not set"),t.platform},t}(),ue={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"},ce=function(t){function e(e,n){var r=t.call(this,n)||this;return r.code=e,r.message=n,r.name="FirebaseError",r.toString=function(){return r.name+": [code="+r.code+"]: "+r.message},r}return re.__extends(e,t),e}(Error),le=function(){function t(){}return t.newId=function(){for(var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",e="",n=0;n<20;n++)e+=t.charAt(Math.floor(Math.random()*t.length));return c(20===e.length,"Invalid auto ID: "+e),e},t}(),he=function(){function t(t){H(),this._binaryString=t}return t.fromBase64String=function(e){v("Blob.fromBase64String",arguments,1),E("Blob.fromBase64String","string",1,e),H();try{return new t(se.getPlatform().atob(e))}catch(t){throw new ce(ue.INVALID_ARGUMENT,"Failed to construct Blob from Base64 string: "+t)}},t.fromUint8Array=function(e){if(v("Blob.fromUint8Array",arguments,1),K(),!(e instanceof Uint8Array))throw M("Blob.fromUint8Array","Uint8Array",1,e);return new t(Array.prototype.map.call(e,function(t){return String.fromCharCode(t)}).join(""))},t.prototype.toBase64=function(){return v("Blob.toBase64",arguments,0),H(),se.getPlatform().btoa(this._binaryString)},t.prototype.toUint8Array=function(){v("Blob.toUint8Array",arguments,0),K();for(var t=new Uint8Array(this._binaryString.length),e=0;e<this._binaryString.length;e++)t[e]=this._binaryString.charCodeAt(e);return t},t.prototype.toString=function(){return"Blob(base64: "+this.toBase64()+")"},t.prototype.isEqual=function(t){return this._binaryString===t._binaryString},t.prototype._compareTo=function(t){return B(this._binaryString,t._binaryString)},t}(),fe=h(he,"Use Blob.fromUint8Array() or Blob.fromBase64String() instead."),pe=function(){function t(t,e){if(v("GeoPoint",arguments,2),E("GeoPoint","number",1,t),E("GeoPoint","number",2,e),!isFinite(t)||t<-90||t>90)throw new ce(ue.INVALID_ARGUMENT,"Latitude must be a number between -90 and 90, but was: "+t);if(!isFinite(e)||e<-180||e>180)throw new ce(ue.INVALID_ARGUMENT,"Longitude must be a number between -180 and 180, but was: "+e);this._lat=t,this._long=e}return Object.defineProperty(t.prototype,"latitude",{get:function(){return this._lat},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"longitude",{get:function(){return this._long},enumerable:!0,configurable:!0}),t.prototype.isEqual=function(t){return this._lat===t._lat&&this._long===t._long},t.prototype._compareTo=function(t){return B(this._lat,t._lat)||B(this._long,t._long)},t}(),de=function(){function t(t,e){if(this.seconds=t,this.nanoseconds=e,e<0)throw new ce(ue.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(e>=1e9)throw new ce(ue.INVALID_ARGUMENT,"Timestamp nanoseconds out of range: "+e);if(t<-62135596800)throw new ce(ue.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t);if(t>=253402300800)throw new ce(ue.INVALID_ARGUMENT,"Timestamp seconds out of range: "+t)}return t.now=function(){return t.fromMillis(Date.now())},t.fromDate=function(e){return t.fromMillis(e.getTime())},t.fromMillis=function(e){var n=Math.floor(e/1e3);return new t(n,1e6*(e-1e3*n))},t.prototype.toDate=function(){return new Date(this.toMillis())},t.prototype.toMillis=function(){return 1e3*this.seconds+this.nanoseconds/1e6},t.prototype._compareTo=function(t){return this.seconds===t.seconds?B(this.nanoseconds,t.nanoseconds):B(this.seconds,t.seconds)},t.prototype.isEqual=function(t){return t.seconds===this.seconds&&t.nanoseconds===this.nanoseconds},t.prototype.toString=function(){return"Timestamp(seconds="+this.seconds+", nanoseconds="+this.nanoseconds+")"},t}(),ye=function(){function t(t,e,n,r){this.databaseId=t,this.persistenceKey=e,this.host=n,this.ssl=r}return t}(),me="(default)",ge=function(){function t(t,e){this.projectId=t,this.database=e||me}return Object.defineProperty(t.prototype,"isDefaultDatabase",{get:function(){return this.database===me},enumerable:!0,configurable:!0}),t.prototype.isEqual=function(e){return e instanceof t&&e.projectId===this.projectId&&e.database===this.database},t.prototype.compareTo=function(t){return B(this.projectId,t.projectId)||B(this.database,t.database)},t}(),ve=function(){function t(t,e,n){this.init(t,e,n)}return t.prototype.init=function(t,e,n){void 0===e?e=0:e>t.length&&u("offset "+e+" out of range "+t.length),void 0===n?n=t.length-e:n>t.length-e&&u("length "+n+" out of range "+(t.length-e)),this.segments=t,this.offset=e,this.len=n},t.prototype.construct=function(t,e,n){var r=Object.create(Object.getPrototypeOf(this));return r.init(t,e,n),r},Object.defineProperty(t.prototype,"length",{get:function(){return this.len},enumerable:!0,configurable:!0}),t.prototype.isEqual=function(e){return 0===t.comparator(this,e)},t.prototype.child=function(e){var n=this.segments.slice(this.offset,this.limit());return e instanceof t?e.forEach(function(t){n.push(t)}):"string"===typeof e?n.push(e):u("Unknown parameter type for Path.child(): "+e),this.construct(n)},t.prototype.limit=function(){return this.offset+this.length},t.prototype.popFirst=function(t){return t=void 0===t?1:t,c(this.length>=t,"Can't call popFirst() with less segments"),this.construct(this.segments,this.offset+t,this.length-t)},t.prototype.popLast=function(){return c(!this.isEmpty(),"Can't call popLast() on empty path"),this.construct(this.segments,this.offset,this.length-1)},t.prototype.firstSegment=function(){return c(!this.isEmpty(),"Can't call firstSegment() on empty path"),this.segments[this.offset]},t.prototype.lastSegment=function(){return c(!this.isEmpty(),"Can't call lastSegment() on empty path"),this.segments[this.limit()-1]},t.prototype.get=function(t){return c(t<this.length,"Index out of range"),this.segments[this.offset+t]},t.prototype.isEmpty=function(){return 0===this.length},t.prototype.isPrefixOf=function(t){if(t.length<this.length)return!1;for(var e=0;e<this.length;e++)if(this.get(e)!==t.get(e))return!1;return!0},t.prototype.forEach=function(t){for(var e=this.offset,n=this.limit();e<n;e++)t(this.segments[e])},t.prototype.toArray=function(){return this.segments.slice(this.offset,this.limit())},t.comparator=function(t,e){for(var n=Math.min(t.length,e.length),r=0;r<n;r++){var i=t.get(r),o=e.get(r);if(i<o)return-1;if(i>o)return 1}return t.length<e.length?-1:t.length>e.length?1:0},t}(),be=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return re.__extends(e,t),e.prototype.canonicalString=function(){return this.toArray().join("/")},e.prototype.toString=function(){return this.canonicalString()},e.fromString=function(t){if(t.indexOf("//")>=0)throw new ce(ue.INVALID_ARGUMENT,"Invalid path ("+t+"). Paths must not contain // in them.");return new e(t.split("/").filter(function(t){return t.length>0}))},e.EMPTY_PATH=new e([]),e}(ve),_e=/^[_a-zA-Z][_a-zA-Z0-9]*$/,we=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return re.__extends(e,t),e.isValidIdentifier=function(t){return _e.test(t)},e.prototype.canonicalString=function(){return this.toArray().map(function(t){return t=t.replace("\\","\\\\").replace("`","\\`"),e.isValidIdentifier(t)||(t="`"+t+"`"),t}).join(".")},e.prototype.toString=function(){return this.canonicalString()},e.prototype.isKeyField=function(){return 1===this.length&&"__name__"===this.get(0)},e.keyField=function(){return new e(["__name__"])},e.fromServerFormat=function(t){for(var n=[],r="",i=0,o=function(){if(0===r.length)throw new ce(ue.INVALID_ARGUMENT,"Invalid field path ("+t+"). Paths must not be empty, begin with '.', end with '.', or contain '..'");n.push(r),r=""},a=!1;i<t.length;){var s=t[i];if("\\"===s){if(i+1===t.length)throw new ce(ue.INVALID_ARGUMENT,"Path has trailing escape character: "+t);var u=t[i+1];if("\\"!==u&&"."!==u&&"`"!==u)throw new ce(ue.INVALID_ARGUMENT,"Path has invalid escape sequence: "+t);r+=u,i+=2}else"`"===s?(a=!a,i++):"."!==s||a?(r+=s,i++):(o(),i++)}if(o(),a)throw new ce(ue.INVALID_ARGUMENT,"Unterminated ` in path: "+t);return new e(n)},e.EMPTY_PATH=new e([]),e}(ve),Ee=function(){function t(e){this.path=e,c(t.isDocumentKey(e),"Invalid DocumentKey with an odd number of segments: "+e.toArray().join("/"))}return t.prototype.isEqual=function(t){return null!==t&&0===be.comparator(this.path,t.path)},t.prototype.toString=function(){return this.path.toString()},t.comparator=function(t,e){return be.comparator(t.path,e.path)},t.isDocumentKey=function(t){return t.length%2===0},t.fromSegments=function(e){return new t(new be(e.slice()))},t.fromPathString=function(e){return new t(be.fromString(e))},t.EMPTY=new t(new be([])),t}(),Te=function(){function t(t,e,n,r){this.key=t,this.version=e,this.data=n,this.hasLocalMutations=r.hasLocalMutations}return t.prototype.field=function(t){return this.data.field(t)},t.prototype.fieldValue=function(t){var e=this.field(t);return e?e.value():void 0},t.prototype.value=function(){return this.data.value()},t.prototype.isEqual=function(e){return e instanceof t&&this.key.isEqual(e.key)&&this.version.isEqual(e.version)&&this.data.isEqual(e.data)&&this.hasLocalMutations===e.hasLocalMutations},t.prototype.toString=function(){return"Document("+this.key+", "+this.version+", "+this.data.toString()+", {hasLocalMutations: "+this.hasLocalMutations+"})"},t.compareByKey=function(t,e){return Ee.comparator(t.key,e.key)},t.compareByField=function(t,e,n){var r=e.field(t),i=n.field(t);return void 0!==r&&void 0!==i?r.compareTo(i):u("Trying to compare documents on fields that don't exist")},t}(),Se=function(){function t(t,e){this.key=t,this.version=e}return t.prototype.toString=function(){return"NoDocument("+this.key+", "+this.version+")"},t.prototype.isEqual=function(t){return t&&t.version.isEqual(this.version)&&t.key.isEqual(this.key)},t.compareByKey=function(t,e){return Ee.comparator(t.key,e.key)},t}(),Ce=function(){function t(t,e){this.comparator=t,this.root=e||Ne.EMPTY}return t.prototype.insert=function(e,n){return new t(this.comparator,this.root.insert(e,n,this.comparator).copy(null,null,Ne.BLACK,null,null))},t.prototype.remove=function(e){return new t(this.comparator,this.root.remove(e,this.comparator).copy(null,null,Ne.BLACK,null,null))},t.prototype.get=function(t){for(var e=this.root;!e.isEmpty();){var n=this.comparator(t,e.key);if(0===n)return e.value;n<0?e=e.left:n>0&&(e=e.right)}return null},t.prototype.indexOf=function(t){for(var e=0,n=this.root;!n.isEmpty();){var r=this.comparator(t,n.key);if(0===r)return e+n.left.size;r<0?n=n.left:(e+=n.left.size+1,n=n.right)}return-1},t.prototype.isEmpty=function(){return this.root.isEmpty()},Object.defineProperty(t.prototype,"size",{get:function(){return this.root.size},enumerable:!0,configurable:!0}),t.prototype.minKey=function(){return this.root.minKey()},t.prototype.maxKey=function(){return this.root.maxKey()},t.prototype.inorderTraversal=function(t){return this.root.inorderTraversal(t)},t.prototype.forEach=function(t){this.inorderTraversal(function(e,n){return t(e,n),!1})},t.prototype.reverseTraversal=function(t){return this.root.reverseTraversal(t)},t.prototype.getIterator=function(){return new Ie(this.root,null,this.comparator,!1)},t.prototype.getIteratorFrom=function(t){return new Ie(this.root,t,this.comparator,!1)},t.prototype.getReverseIterator=function(){return new Ie(this.root,null,this.comparator,!0)},t.prototype.getReverseIteratorFrom=function(t){return new Ie(this.root,t,this.comparator,!0)},t}(),Ie=function(){function t(t,e,n,r){this.isReverse=r,this.nodeStack=[];for(var i=1;!t.isEmpty();)if(i=e?n(t.key,e):1,r&&(i*=-1),i<0)t=this.isReverse?t.left:t.right;else{if(0===i){this.nodeStack.push(t);break}this.nodeStack.push(t),t=this.isReverse?t.right:t.left}}return t.prototype.getNext=function(){c(this.nodeStack.length>0,"getNext() called on iterator when hasNext() is false.");var t=this.nodeStack.pop(),e={key:t.key,value:t.value};if(this.isReverse)for(t=t.left;!t.isEmpty();)this.nodeStack.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack.push(t),t=t.left;return e},t.prototype.hasNext=function(){return this.nodeStack.length>0},t.prototype.peek=function(){if(0===this.nodeStack.length)return null;var t=this.nodeStack[this.nodeStack.length-1];return{key:t.key,value:t.value}},t}(),Ne=function(){function t(e,n,r,i,o){this.key=e,this.value=n,this.color=null!=r?r:t.RED,this.left=null!=i?i:t.EMPTY,this.right=null!=o?o:t.EMPTY,this.size=this.left.size+1+this.right.size}return t.prototype.copy=function(e,n,r,i,o){return new t(null!=e?e:this.key,null!=n?n:this.value,null!=r?r:this.color,null!=i?i:this.left,null!=o?o:this.right)},t.prototype.isEmpty=function(){return!1},t.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||t(this.key,this.value)||this.right.inorderTraversal(t)},t.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},t.prototype.min=function(){return this.left.isEmpty()?this:this.left.min()},t.prototype.minKey=function(){return this.min().key},t.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},t.prototype.insert=function(t,e,n){var r=this,i=n(t,r.key);return r=i<0?r.copy(null,null,null,r.left.insert(t,e,n),null):0===i?r.copy(null,e,null,null,null):r.copy(null,null,null,null,r.right.insert(t,e,n)),r.fixUp()},t.prototype.removeMin=function(){if(this.left.isEmpty())return t.EMPTY;var e=this;return e.left.isRed()||e.left.left.isRed()||(e=e.moveRedLeft()),e=e.copy(null,null,null,e.left.removeMin(),null),e.fixUp()},t.prototype.remove=function(e,n){var r,i=this;if(n(e,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(e,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(e,i.key)){if(i.right.isEmpty())return t.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(e,n))}return i.fixUp()},t.prototype.isRed=function(){return this.color},t.prototype.fixUp=function(){var t=this;return t.right.isRed()&&!t.left.isRed()&&(t=t.rotateLeft()),t.left.isRed()&&t.left.left.isRed()&&(t=t.rotateRight()),t.left.isRed()&&t.right.isRed()&&(t=t.colorFlip()),t},t.prototype.moveRedLeft=function(){var t=this.colorFlip();return t.right.left.isRed()&&(t=t.copy(null,null,null,null,t.right.rotateRight()),t=t.rotateLeft(),t=t.colorFlip()),t},t.prototype.moveRedRight=function(){var t=this.colorFlip();return t.left.left.isRed()&&(t=t.rotateRight(),t=t.colorFlip()),t},t.prototype.rotateLeft=function(){var e=this.copy(null,null,t.RED,null,this.right.left);return this.right.copy(null,null,this.color,e,null)},t.prototype.rotateRight=function(){var e=this.copy(null,null,t.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,e)},t.prototype.colorFlip=function(){var t=this.left.copy(null,null,!this.left.color,null,null),e=this.right.copy(null,null,!this.right.color,null,null);return this.copy(null,null,!this.color,t,e)},t.prototype.checkMaxDepth=function(){var t=this.check();return Math.pow(2,t)<=this.size+1},t.prototype.check=function(){if(this.isRed()&&this.left.isRed())throw u("Red node has red child("+this.key+","+this.value+")");if(this.right.isRed())throw u("Right child of ("+this.key+","+this.value+") is red");var t=this.left.check();if(t!==this.right.check())throw u("Black depths differ");return t+(this.isRed()?0:1)},t.EMPTY=null,t.RED=!0,t.BLACK=!1,t}(),ke=function(){function t(){this.size=0}return t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.insert=function(t,e,n){return new Ne(t,e)},t.prototype.remove=function(t,e){return this},t.prototype.isEmpty=function(){return!0},t.prototype.inorderTraversal=function(t){return!1},t.prototype.reverseTraversal=function(t){return!1},t.prototype.minKey=function(){return null},t.prototype.maxKey=function(){return null},t.prototype.isRed=function(){return!1},t.prototype.checkMaxDepth=function(){return!0},t.prototype.check=function(){return 0},t}();Ne.EMPTY=new ke;var Ae;!function(t){t[t.NullValue=0]="NullValue",t[t.BooleanValue=1]="BooleanValue",t[t.NumberValue=2]="NumberValue",t[t.TimestampValue=3]="TimestampValue",t[t.StringValue=4]="StringValue",t[t.BlobValue=5]="BlobValue",t[t.RefValue=6]="RefValue",t[t.GeoPointValue=7]="GeoPointValue",t[t.ArrayValue=8]="ArrayValue",t[t.ObjectValue=9]="ObjectValue"}(Ae||(Ae={}));var Re;!function(t){t[t.Default=0]="Default",t[t.Estimate=1]="Estimate",t[t.Previous=2]="Previous"}(Re||(Re={}));var Oe,De=function(){function t(t,e){this.serverTimestampBehavior=t,this.timestampsInSnapshots=e}return t.fromSnapshotOptions=function(e,n){switch(e.serverTimestamps){case"estimate":return new t(Re.Estimate,n);case"previous":return new t(Re.Previous,n);case"none":case void 0:return new t(Re.Default,n);default:return u("fromSnapshotOptions() called with invalid options.")}},t}(),Pe=function(){function t(){}return t.prototype.toString=function(){var t=this.value();return null===t?"null":t.toString()},t.prototype.defaultCompareTo=function(t){return c(this.typeOrder!==t.typeOrder,"Default compareTo should not be used for values of same type."),B(this.typeOrder,t.typeOrder)},t}(),xe=function(t){function e(){var e=t.call(this)||this;return e.typeOrder=Ae.NullValue,e.internalValue=null,e}return re.__extends(e,t),e.prototype.value=function(t){return null},e.prototype.isEqual=function(t){return t instanceof e},e.prototype.compareTo=function(t){return t instanceof e?0:this.defaultCompareTo(t)},e.INSTANCE=new e,e}(Pe),Le=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=Ae.BooleanValue,n}return re.__extends(e,t),e.prototype.value=function(t){return this.internalValue},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue===t.internalValue},e.prototype.compareTo=function(t){return t instanceof e?B(this,t):this.defaultCompareTo(t)},e.of=function(t){return t?e.TRUE:e.FALSE},e.TRUE=new e(!0),e.FALSE=new e(!1),e}(Pe),Me=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=Ae.NumberValue,n}return re.__extends(e,t),e.prototype.value=function(t){return this.internalValue},e.prototype.compareTo=function(t){return t instanceof e?G(this.internalValue,t.internalValue):this.defaultCompareTo(t)},e}(Pe),Fe=function(t){function e(e){return t.call(this,e)||this}return re.__extends(e,t),e.prototype.isEqual=function(t){return t instanceof e&&Q(this.internalValue,t.internalValue)},e}(Me),Ue=function(t){function e(e){var n=t.call(this,e)||this;return n.internalValue=e,n}return re.__extends(e,t),e.prototype.isEqual=function(t){return t instanceof e&&Q(this.internalValue,t.internalValue)},e.NAN=new e(NaN),e.POSITIVE_INFINITY=new e(1/0),e.NEGATIVE_INFINITY=new e(-1/0),e}(Me),Be=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=Ae.StringValue,n}return re.__extends(e,t),e.prototype.value=function(t){return this.internalValue},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue===t.internalValue},e.prototype.compareTo=function(t){return t instanceof e?B(this.internalValue,t.internalValue):this.defaultCompareTo(t)},e}(Pe),Ve=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=Ae.TimestampValue,n}return re.__extends(e,t),e.prototype.value=function(t){return t&&t.timestampsInSnapshots?this.internalValue:this.internalValue.toDate()},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue.isEqual(t.internalValue)},e.prototype.compareTo=function(t){return t instanceof e?this.internalValue._compareTo(t.internalValue):t instanceof je?-1:this.defaultCompareTo(t)},e}(Pe),je=function(t){function e(e,n){var r=t.call(this)||this;return r.localWriteTime=e,r.previousValue=n,r.typeOrder=Ae.TimestampValue,r}return re.__extends(e,t),e.prototype.value=function(t){return t&&t.serverTimestampBehavior===Re.Estimate?new Ve(this.localWriteTime).value(t):t&&t.serverTimestampBehavior===Re.Previous&&this.previousValue?this.previousValue.value(t):null},e.prototype.isEqual=function(t){return t instanceof e&&this.localWriteTime.isEqual(t.localWriteTime)},e.prototype.compareTo=function(t){return t instanceof e?this.localWriteTime._compareTo(t.localWriteTime):t instanceof Ve?1:this.defaultCompareTo(t)},e.prototype.toString=function(){return"<ServerTimestamp localTime="+this.localWriteTime.toString()+">"},e}(Pe),qe=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=Ae.BlobValue,n}return re.__extends(e,t),e.prototype.value=function(t){return this.internalValue},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue.isEqual(t.internalValue)},e.prototype.compareTo=function(t){return t instanceof e?this.internalValue._compareTo(t.internalValue):this.defaultCompareTo(t)},e}(Pe),We=function(t){function e(e,n){var r=t.call(this)||this;return r.databaseId=e,r.key=n,r.typeOrder=Ae.RefValue,r}return re.__extends(e,t),e.prototype.value=function(t){return this.key},e.prototype.isEqual=function(t){return t instanceof e&&(this.key.isEqual(t.key)&&this.databaseId.isEqual(t.databaseId))},e.prototype.compareTo=function(t){if(t instanceof e){var n=this.databaseId.compareTo(t.databaseId);return 0!==n?n:Ee.comparator(this.key,t.key)}return this.defaultCompareTo(t)},e}(Pe),Ke=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=Ae.GeoPointValue,n}return re.__extends(e,t),e.prototype.value=function(t){return this.internalValue},e.prototype.isEqual=function(t){return t instanceof e&&this.internalValue.isEqual(t.internalValue)},e.prototype.compareTo=function(t){return t instanceof e?this.internalValue._compareTo(t.internalValue):this.defaultCompareTo(t)},e}(Pe),He=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=Ae.ObjectValue,n}return re.__extends(e,t),e.prototype.value=function(t){var e={};return this.internalValue.inorderTraversal(function(n,r){e[n]=r.value(t)}),e},e.prototype.forEach=function(t){this.internalValue.inorderTraversal(t)},e.prototype.isEqual=function(t){if(t instanceof e){for(var n=this.internalValue.getIterator(),r=t.internalValue.getIterator();n.hasNext()&&r.hasNext();){var i=n.getNext(),o=r.getNext();if(i.key!==o.key||!i.value.isEqual(o.value))return!1}return!n.hasNext()&&!r.hasNext()}return!1},e.prototype.compareTo=function(t){if(t instanceof e){for(var n=this.internalValue.getIterator(),r=t.internalValue.getIterator();n.hasNext()&&r.hasNext();){var i=n.getNext(),o=r.getNext(),a=B(i.key,o.key)||i.value.compareTo(o.value);if(a)return a}return B(n.hasNext(),r.hasNext())}return this.defaultCompareTo(t)},e.prototype.set=function(t,n){if(c(!t.isEmpty(),"Cannot set field for empty path on ObjectValue"),1===t.length)return this.setChild(t.firstSegment(),n);var r=this.child(t.firstSegment());r instanceof e||(r=e.EMPTY);var i=r.set(t.popFirst(),n);return this.setChild(t.firstSegment(),i)},e.prototype.delete=function(t){if(c(!t.isEmpty(),"Cannot delete field for empty path on ObjectValue"),1===t.length)return new e(this.internalValue.remove(t.firstSegment()));var n=this.child(t.firstSegment());if(n instanceof e){var r=n.delete(t.popFirst());return new e(this.internalValue.insert(t.firstSegment(),r))}return this},e.prototype.contains=function(t){return void 0!==this.field(t)},e.prototype.field=function(t){c(!t.isEmpty(),"Can't get field of empty path");var n=this;return t.forEach(function(t){n=n instanceof e?n.internalValue.get(t)||void 0:void 0}),n},e.prototype.toString=function(){return JSON.stringify(this.value())},e.prototype.child=function(t){return this.internalValue.get(t)||void 0},e.prototype.setChild=function(t,n){return new e(this.internalValue.insert(t,n))},e.EMPTY=new e(new Ce(B)),e}(Pe),Ge=function(t){function e(e){var n=t.call(this)||this;return n.internalValue=e,n.typeOrder=Ae.ArrayValue,n}return re.__extends(e,t),e.prototype.value=function(t){return this.internalValue.map(function(e){return e.value(t)})},e.prototype.forEach=function(t){this.internalValue.forEach(t)},e.prototype.isEqual=function(t){if(t instanceof e){if(this.internalValue.length!==t.internalValue.length)return!1;for(var n=0;n<this.internalValue.length;n++)if(!this.internalValue[n].isEqual(t.internalValue[n]))return!1;return!0}return!1},e.prototype.compareTo=function(t){if(t instanceof e){for(var n=Math.min(this.internalValue.length,t.internalValue.length),r=0;r<n;r++){var i=this.internalValue[r].compareTo(t.internalValue[r]);if(i)return i}return B(this.internalValue.length,t.internalValue.length)}return this.defaultCompareTo(t)},e.prototype.toString=function(){return JSON.stringify(this.value())},e}(Pe),Qe=Number,ze=Qe.MIN_SAFE_INTEGER||-(Math.pow(2,53)-1),Ye=Qe.MAX_SAFE_INTEGER||Math.pow(2,53)-1,Xe=Qe.isInteger||function(t){return"number"===typeof t&&isFinite(t)&&Math.floor(t)===t},Je=function(){function t(t,e,n,r,i,o){void 0===e&&(e=[]),void 0===n&&(n=[]),void 0===r&&(r=null),void 0===i&&(i=null),void 0===o&&(o=null),this.path=t,this.explicitOrderBy=e,this.filters=n,this.limit=r,this.startAt=i,this.endAt=o,this.memoizedCanonicalId=null,this.memoizedOrderBy=null,this.startAt&&this.assertValidBound(this.startAt),this.endAt&&this.assertValidBound(this.endAt)}return t.atPath=function(e){return new t(e)},Object.defineProperty(t.prototype,"orderBy",{get:function(){if(null===this.memoizedOrderBy){var t=this.getInequalityFilterField(),e=this.getFirstOrderByField();if(null!==t&&null===e)t.isKeyField()?this.memoizedOrderBy=[an]:this.memoizedOrderBy=[new on(t),an];else{c(null===t||null!==e&&t.isEqual(e),"First orderBy should match inequality field."),this.memoizedOrderBy=[];for(var n=!1,r=0,i=this.explicitOrderBy;r<i.length;r++){var o=i[r];this.memoizedOrderBy.push(o),o.field.isKeyField()&&(n=!0)}if(!n){var a=this.explicitOrderBy.length>0?this.explicitOrderBy[this.explicitOrderBy.length-1].dir:nn.ASCENDING;this.memoizedOrderBy.push(a===nn.ASCENDING?an:sn)}}}return this.memoizedOrderBy},enumerable:!0,configurable:!0}),t.prototype.addFilter=function(e){c(null==this.getInequalityFilterField()||!(e instanceof Ze)||!e.isInequality()||e.field.isEqual(this.getInequalityFilterField()),"Query must only have one inequality field."),c(!Ee.isDocumentKey(this.path),"No filtering allowed for document query");var n=this.filters.concat([e]);return new t(this.path,this.explicitOrderBy.slice(),n,this.limit,this.startAt,this.endAt)},t.prototype.addOrderBy=function(e){c(!Ee.isDocumentKey(this.path),"No ordering allowed for document query"),c(!this.startAt&&!this.endAt,"Bounds must be set after orderBy");var n=this.explicitOrderBy.concat([e]);return new t(this.path,n,this.filters.slice(),this.limit,this.startAt,this.endAt)},t.prototype.withLimit=function(e){return new t(this.path,this.explicitOrderBy.slice(),this.filters.slice(),e,this.startAt,this.endAt)},t.prototype.withStartAt=function(e){return new t(this.path,this.explicitOrderBy.slice(),this.filters.slice(),this.limit,e,this.endAt)},t.prototype.withEndAt=function(e){return new t(this.path,this.explicitOrderBy.slice(),this.filters.slice(),this.limit,this.startAt,e)},t.prototype.canonicalId=function(){if(null===this.memoizedCanonicalId){var t=this.path.canonicalString();t+="|f:";for(var e=0,n=this.filters;e<n.length;e++){t+=n[e].canonicalId(),t+=","}t+="|ob:";for(var r=0,i=this.orderBy;r<i.length;r++){t+=i[r].canonicalId(),t+=","}z(this.limit)||(t+="|l:",t+=this.limit),this.startAt&&(t+="|lb:",t+=this.startAt.canonicalId()),this.endAt&&(t+="|ub:",t+=this.endAt.canonicalId()),this.memoizedCanonicalId=t}return this.memoizedCanonicalId},t.prototype.toString=function(){var t="Query("+this.path.canonicalString();return this.filters.length>0&&(t+=", filters: ["+this.filters.join(", ")+"]"),z(this.limit)||(t+=", limit: "+this.limit),this.explicitOrderBy.length>0&&(t+=", orderBy: ["+this.explicitOrderBy.join(", ")+"]"),this.startAt&&(t+=", startAt: "+this.startAt.canonicalId()),this.endAt&&(t+=", endAt: "+this.endAt.canonicalId()),t+")"},t.prototype.isEqual=function(t){if(this.limit!==t.limit)return!1;if(this.orderBy.length!==t.orderBy.length)return!1;for(var e=0;e<this.orderBy.length;e++)if(!this.orderBy[e].isEqual(t.orderBy[e]))return!1;if(this.filters.length!==t.filters.length)return!1;for(var e=0;e<this.filters.length;e++)if(!this.filters[e].isEqual(t.filters[e]))return!1;return!!this.path.isEqual(t.path)&&(!(null!==this.startAt?!this.startAt.isEqual(t.startAt):null!==t.startAt)&&(null!==this.endAt?this.endAt.isEqual(t.endAt):null===t.endAt))},t.prototype.docComparator=function(t,e){for(var n=!1,r=0,i=this.orderBy;r<i.length;r++){var o=i[r],a=o.compare(t,e);if(0!==a)return a;n=n||o.field.isKeyField()}return c(n,"orderBy used that doesn't compare on key field"),0},t.prototype.matches=function(t){return this.matchesAncestor(t)&&this.matchesOrderBy(t)&&this.matchesFilters(t)&&this.matchesBounds(t)},t.prototype.hasLimit=function(){return!z(this.limit)},t.prototype.getFirstOrderByField=function(){return this.explicitOrderBy.length>0?this.explicitOrderBy[0].field:null},t.prototype.getInequalityFilterField=function(){for(var t=0,e=this.filters;t<e.length;t++){var n=e[t];if(n instanceof Ze&&n.isInequality())return n.field}return null},t.prototype.hasArrayContainsFilter=function(){return void 0!==this.filters.find(function(t){return t instanceof Ze&&t.op===$e.ARRAY_CONTAINS})},t.prototype.isDocumentQuery=function(){return Ee.isDocumentKey(this.path)&&0===this.filters.length},t.prototype.matchesAncestor=function(t){var e=t.key.path;return Ee.isDocumentKey(this.path)?this.path.isEqual(e):this.path.isPrefixOf(e)&&this.path.length===e.length-1},t.prototype.matchesOrderBy=function(t){for(var e=0,n=this.explicitOrderBy;e<n.length;e++){var r=n[e];if(!r.field.isKeyField()&&void 0===t.field(r.field))return!1}return!0},t.prototype.matchesFilters=function(t){for(var e=0,n=this.filters;e<n.length;e++){if(!n[e].matches(t))return!1}return!0},t.prototype.matchesBounds=function(t){return!(this.startAt&&!this.startAt.sortsBeforeDocument(this.orderBy,t))&&(!this.endAt||!this.endAt.sortsBeforeDocument(this.orderBy,t))},t.prototype.assertValidBound=function(t){c(t.position.length<=this.orderBy.length,"Bound is longer than orderBy")},t}(),$e=function(){function t(t){this.name=t}return t.fromString=function(e){switch(e){case"<":return t.LESS_THAN;case"<=":return t.LESS_THAN_OR_EQUAL;case"==":return t.EQUAL;case">=":return t.GREATER_THAN_OR_EQUAL;case">":return t.GREATER_THAN;case"array-contains":return t.ARRAY_CONTAINS;default:return u("Unknown relation: "+e)}},t.prototype.toString=function(){return this.name},t.prototype.isEqual=function(t){return this.name===t.name},t.LESS_THAN=new t("<"),t.LESS_THAN_OR_EQUAL=new t("<="),t.EQUAL=new t("=="),t.GREATER_THAN=new t(">"),t.GREATER_THAN_OR_EQUAL=new t(">="),t.ARRAY_CONTAINS=new t("array-contains"),t}(),Ze=function(){function t(t,e,n){this.field=t,this.op=e,this.value=n}return t.prototype.matches=function(t){if(this.field.isKeyField()){c(this.value instanceof We,"Comparing on key, but filter value not a RefValue"),c(this.op!==$e.ARRAY_CONTAINS,"array-contains queries don't make sense on document keys.");var e=this.value,n=Ee.comparator(t.key,e.key);return this.matchesComparison(n)}var r=t.field(this.field);return void 0!==r&&this.matchesValue(r)},t.prototype.matchesValue=function(t){var e=this;return this.op===$e.ARRAY_CONTAINS?t instanceof Ge&&void 0!==t.internalValue.find(function(t){return t.isEqual(e.value)}):this.value.typeOrder===t.typeOrder&&this.matchesComparison(t.compareTo(this.value))},t.prototype.matchesComparison=function(t){switch(this.op){case $e.LESS_THAN:return t<0;case $e.LESS_THAN_OR_EQUAL:return t<=0;case $e.EQUAL:return 0===t;case $e.GREATER_THAN:return t>0;case $e.GREATER_THAN_OR_EQUAL:return t>=0;default:return u("Unknown relation op"+this.op)}},t.prototype.isInequality=function(){return this.op!==$e.EQUAL&&this.op!==$e.ARRAY_CONTAINS},t.prototype.canonicalId=function(){return this.field.canonicalString()+this.op.toString()+this.value.toString()},t.prototype.isEqual=function(e){return e instanceof t&&(this.op.isEqual(e.op)&&this.field.isEqual(e.field)&&this.value.isEqual(e.value))},t.prototype.toString=function(){return this.field.canonicalString()+" "+this.op+" "+this.value.value()},t}(),tn=function(){function t(t){this.field=t}return t.prototype.matches=function(t){var e=t.field(this.field);return void 0!==e&&null===e.value()},t.prototype.canonicalId=function(){return this.field.canonicalString()+" IS null"},t.prototype.toString=function(){return this.field.canonicalString()+" IS null"},t.prototype.isEqual=function(e){return e instanceof t&&this.field.isEqual(e.field)},t}(),en=function(){function t(t){this.field=t}return t.prototype.matches=function(t){var e=t.field(this.field).value();return"number"===typeof e&&isNaN(e)},t.prototype.canonicalId=function(){return this.field.canonicalString()+" IS NaN"},t.prototype.toString=function(){return this.field.canonicalString()+" IS NaN"},t.prototype.isEqual=function(e){return e instanceof t&&this.field.isEqual(e.field)},t}(),nn=function(){function t(t){this.name=t}return t.prototype.toString=function(){return this.name},t.ASCENDING=new t("asc"),t.DESCENDING=new t("desc"),t}(),rn=function(){function t(t,e){this.position=t,this.before=e}return t.prototype.canonicalId=function(){for(var t=this.before?"b:":"a:",e=0,n=this.position;e<n.length;e++){t+=n[e].toString()}return t},t.prototype.sortsBeforeDocument=function(t,e){c(this.position.length<=t.length,"Bound has more components than query's orderBy");for(var n=0,r=0;r<this.position.length;r++){var i=t[r],o=this.position[r];if(i.field.isKeyField())c(o instanceof We,"Bound has a non-key value where the key path is being used."),n=Ee.comparator(o.key,e.key);else{var a=e.field(i.field);c(void 0!==a,"Field should exist since document matched the orderBy already."),n=o.compareTo(a)}if(i.dir===nn.DESCENDING&&(n*=-1),0!==n)break}return this.before?n<=0:n<0},t.prototype.isEqual=function(t){if(null===t)return!1;if(this.before!==t.before||this.position.length!==t.position.length)return!1;for(var e=0;e<this.position.length;e++){var n=this.position[e],r=t.position[e];return n.isEqual(r)}return!0},t}(),on=function(){function t(t,e){this.field=t,void 0===e&&(e=nn.ASCENDING),this.dir=e,this.isKeyOrderBy=t.isKeyField()}return t.prototype.compare=function(t,e){var n=this.isKeyOrderBy?Te.compareByKey(t,e):Te.compareByField(this.field,t,e);switch(this.dir){case nn.ASCENDING:return n;case nn.DESCENDING:return-1*n;default:return u("Unknown direction: "+this.dir)}},t.prototype.canonicalId=function(){return this.field.canonicalString()+this.dir.toString()},t.prototype.toString=function(){return this.field.canonicalString()+" ("+this.dir+")"},t.prototype.isEqual=function(t){return this.dir===t.dir&&this.field.isEqual(t.field)},t}(),an=new on(we.keyField(),nn.ASCENDING),sn=new on(we.keyField(),nn.DESCENDING),un=function(){function t(t){this.timestamp=t}return t.fromMicroseconds=function(e){var n=Math.floor(e/1e6);return new t(new de(n,e%1e6*1e3))},t.fromTimestamp=function(e){return new t(e)},t.forDeletedDoc=function(){return t.MIN},t.prototype.compareTo=function(t){return this.timestamp._compareTo(t.timestamp)},t.prototype.isEqual=function(t){return this.timestamp.isEqual(t.timestamp)},t.prototype.toMicroseconds=function(){return 1e6*this.timestamp.seconds+this.timestamp.nanoseconds/1e3},t.prototype.toString=function(){return"SnapshotVersion("+this.timestamp.toString()+")"},t.prototype.toTimestamp=function(){return this.timestamp},t.MIN=new t(new de(0,0)),t}();!function(t){t[t.Listen=0]="Listen",t[t.ExistenceFilterMismatch=1]="ExistenceFilterMismatch",t[t.LimboResolution=2]="LimboResolution"}(Oe||(Oe={}));var cn,ln=function(){function t(t,e,n,r,i){void 0===r&&(r=un.MIN),void 0===i&&(i=l()),this.query=t,this.targetId=e,this.purpose=n,this.snapshotVersion=r,this.resumeToken=i}return t.prototype.update=function(e){return new t(this.query,this.targetId,this.purpose,e.snapshotVersion,e.resumeToken)},t.prototype.isEqual=function(t){return this.targetId===t.targetId&&this.purpose===t.purpose&&this.snapshotVersion.isEqual(t.snapshotVersion)&&this.resumeToken===t.resumeToken&&this.query.isEqual(t.query)},t}(),hn=function(){function t(t){this.fields=t}return t.prototype.covers=function(t){for(var e=0,n=this.fields;e<n.length;e++){if(n[e].isPrefixOf(t))return!0}return!1},t.prototype.isEqual=function(t){return j(this.fields,t.fields)},t}(),fn=function(){function t(t,e){this.field=t,this.transform=e}return t.prototype.isEqual=function(t){return this.field.isEqual(t.field)&&this.transform.isEqual(t.transform)},t}(),pn=function(){function t(t,e){this.version=t,this.transformResults=e}return t}();!function(t){t[t.Set=0]="Set",t[t.Patch=1]="Patch",t[t.Transform=2]="Transform",t[t.Delete=3]="Delete"}(cn||(cn={}));var dn,yn=function(){function t(t,e){this.updateTime=t,this.exists=e,c(void 0===t||void 0===e,'Precondition can specify "exists" or "updateTime" but not both')}return t.exists=function(e){return new t(void 0,e)},t.updateTime=function(e){return new t(e)},Object.defineProperty(t.prototype,"isNone",{get:function(){return void 0===this.updateTime&&void 0===this.exists},enumerable:!0,configurable:!0}),t.prototype.isValidFor=function(t){return void 0!==this.updateTime?t instanceof Te&&t.version.isEqual(this.updateTime):void 0!==this.exists?this.exists?t instanceof Te:null===t||t instanceof Se:(c(this.isNone,"Precondition should be empty"),!0)},t.prototype.isEqual=function(t){return V(this.updateTime,t.updateTime)&&this.exists===t.exists},t.NONE=new t,t}(),mn=function(){function t(){}return t.prototype.verifyKeyMatches=function(t){null!=t&&c(t.key.isEqual(this.key),"Can only apply a mutation to a document with the same key")},t.getPostMutationVersion=function(t){return t instanceof Te?t.version:un.MIN},t}(),gn=function(t){function e(e,n,r){var i=t.call(this)||this;return i.key=e,i.value=n,i.precondition=r,i.type=cn.Set,i}return re.__extends(e,t),e.prototype.applyToRemoteDocument=function(t,e){this.verifyKeyMatches(t),c(null==e.transformResults,"Transform results received by SetMutation.");var n=mn.getPostMutationVersion(t);return new Te(this.key,n,this.value,{hasLocalMutations:!1})},e.prototype.applyToLocalView=function(t,e,n){if(this.verifyKeyMatches(t),!this.precondition.isValidFor(t))return t;var r=mn.getPostMutationVersion(t);return new Te(this.key,r,this.value,{hasLocalMutations:!0})},e.prototype.isEqual=function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.value.isEqual(t.value)&&this.precondition.isEqual(t.precondition)},e}(mn),vn=function(t){function e(e,n,r,i){var o=t.call(this)||this;return o.key=e,o.data=n,o.fieldMask=r,o.precondition=i,o.type=cn.Patch,o}return re.__extends(e,t),e.prototype.applyToRemoteDocument=function(t,e){if(this.verifyKeyMatches(t),c(null==e.transformResults,"Transform results received by PatchMutation."),!this.precondition.isValidFor(t))return t;var n=mn.getPostMutationVersion(t),r=this.patchDocument(t);return new Te(this.key,n,r,{hasLocalMutations:!1})},e.prototype.applyToLocalView=function(t,e,n){if(this.verifyKeyMatches(t),!this.precondition.isValidFor(t))return t;var r=mn.getPostMutationVersion(t),i=this.patchDocument(t);return new Te(this.key,r,i,{hasLocalMutations:!0})},e.prototype.isEqual=function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.fieldMask.isEqual(t.fieldMask)&&this.precondition.isEqual(t.precondition)},e.prototype.patchDocument=function(t){var e;return e=t instanceof Te?t.data:He.EMPTY,this.patchObject(e)},e.prototype.patchObject=function(t){for(var e=0,n=this.fieldMask.fields;e<n.length;e++){var r=n[e],i=this.data.field(r);t=void 0!==i?t.set(r,i):t.delete(r)}return t},e}(mn),bn=function(t){function e(e,n){var r=t.call(this)||this;return r.key=e,r.fieldTransforms=n,r.type=cn.Transform,r.precondition=yn.exists(!0),r}return re.__extends(e,t),e.prototype.applyToRemoteDocument=function(t,e){if(this.verifyKeyMatches(t),c(null!=e.transformResults,"Transform results missing for TransformMutation."),!this.precondition.isValidFor(t))return t;var n=this.requireDocument(t),r=this.serverTransformResults(t,e.transformResults),i=this.transformObject(n.data,r);return new Te(this.key,n.version,i,{hasLocalMutations:!1})},e.prototype.applyToLocalView=function(t,e,n){if(this.verifyKeyMatches(t),!this.precondition.isValidFor(t))return t;var r=this.requireDocument(t),i=this.localTransformResults(n,e),o=this.transformObject(r.data,i);return new Te(this.key,r.version,o,{hasLocalMutations:!0})},e.prototype.isEqual=function(t){return t instanceof e&&this.key.isEqual(t.key)&&j(this.fieldTransforms,t.fieldTransforms)&&this.precondition.isEqual(t.precondition)},e.prototype.requireDocument=function(t){c(t instanceof Te,"Unknown MaybeDocument type "+t);var e=t;return c(e.key.isEqual(this.key),"Can only transform a document with the same key"),e},e.prototype.serverTransformResults=function(t,e){var n=[];c(this.fieldTransforms.length===e.length,"server transform result count ("+e.length+") should match field transform count ("+this.fieldTransforms.length+")");for(var r=0;r<e.length;r++){var i=this.fieldTransforms[r],o=i.transform,a=null;t instanceof Te&&(a=t.field(i.field)||null),n.push(o.applyToRemoteDocument(a,e[r]))}return n},e.prototype.localTransformResults=function(t,e){for(var n=[],r=0,i=this.fieldTransforms;r<i.length;r++){var o=i[r],a=o.transform,s=null;e instanceof Te&&(s=e.field(o.field)||null),n.push(a.applyToLocalView(s,t))}return n},e.prototype.transformObject=function(t,e){c(e.length===this.fieldTransforms.length,"TransformResults length mismatch.");for(var n=0;n<this.fieldTransforms.length;n++){var r=this.fieldTransforms[n],i=r.field;t=t.set(i,e[n])}return t},e}(mn),_n=function(t){function e(e,n){var r=t.call(this)||this;return r.key=e,r.precondition=n,r.type=cn.Delete,r}return re.__extends(e,t),e.prototype.applyToRemoteDocument=function(t,e){return this.verifyKeyMatches(t),c(null==e.transformResults,"Transform results received by DeleteMutation."),new Se(this.key,un.MIN)},e.prototype.applyToLocalView=function(t,e,n){return this.verifyKeyMatches(t),this.precondition.isValidFor(t)?(t&&c(t.key.isEqual(this.key),"Can only apply mutation to document with same key"),new Se(this.key,un.forDeletedDoc())):t},e.prototype.isEqual=function(t){return t instanceof e&&this.key.isEqual(t.key)&&this.precondition.isEqual(t.precondition)},e}(mn),wn=function(){function t(t){this.count=t}return t.prototype.isEqual=function(t){return t&&t.count===this.count},t}();!function(t){t[t.OK=0]="OK",t[t.CANCELLED=1]="CANCELLED",t[t.UNKNOWN=2]="UNKNOWN",t[t.INVALID_ARGUMENT=3]="INVALID_ARGUMENT",t[t.DEADLINE_EXCEEDED=4]="DEADLINE_EXCEEDED",t[t.NOT_FOUND=5]="NOT_FOUND",t[t.ALREADY_EXISTS=6]="ALREADY_EXISTS",t[t.PERMISSION_DENIED=7]="PERMISSION_DENIED",t[t.UNAUTHENTICATED=16]="UNAUTHENTICATED",t[t.RESOURCE_EXHAUSTED=8]="RESOURCE_EXHAUSTED",t[t.FAILED_PRECONDITION=9]="FAILED_PRECONDITION",t[t.ABORTED=10]="ABORTED",t[t.OUT_OF_RANGE=11]="OUT_OF_RANGE",t[t.UNIMPLEMENTED=12]="UNIMPLEMENTED",t[t.INTERNAL=13]="INTERNAL",t[t.UNAVAILABLE=14]="UNAVAILABLE",t[t.DATA_LOSS=15]="DATA_LOSS"}(dn||(dn={}));var En,Tn=function(){function t(t){this.comparator=t,this.data=new Ce(this.comparator)}return t.fromMapKeys=function(e){var n=new t(e.comparator);return e.forEach(function(t){n=n.add(t)}),n},t.prototype.has=function(t){return null!==this.data.get(t)},t.prototype.first=function(){return this.data.minKey()},t.prototype.last=function(){return this.data.maxKey()},Object.defineProperty(t.prototype,"size",{get:function(){return this.data.size},enumerable:!0,configurable:!0}),t.prototype.indexOf=function(t){return this.data.indexOf(t)},t.prototype.forEach=function(t){this.data.inorderTraversal(function(e,n){return t(e),!1})},t.prototype.forEachInRange=function(t,e){for(var n=this.data.getIteratorFrom(t[0]);n.hasNext();){var r=n.getNext();if(this.comparator(r.key,t[1])>=0)return;e(r.key)}},t.prototype.forEachWhile=function(t,e){var n;for(n=void 0!==e?this.data.getIteratorFrom(e):this.data.getIterator();n.hasNext();){if(!t(n.getNext().key))return}},t.prototype.firstAfterOrEqual=function(t){var e=this.data.getIteratorFrom(t);return e.hasNext()?e.getNext().key:null},t.prototype.add=function(t){return this.copy(this.data.remove(t).insert(t,!0))},t.prototype.delete=function(t){return this.has(t)?this.copy(this.data.remove(t)):this},t.prototype.isEmpty=function(){return this.data.isEmpty()},t.prototype.unionWith=function(t){var e=this;return t.forEach(function(t){e=e.add(t)}),e},t.prototype.isEqual=function(e){if(!(e instanceof t))return!1;if(this.size!==e.size)return!1;for(var n=this.data.getIterator(),r=e.data.getIterator();n.hasNext();){var i=n.getNext().key,o=r.getNext().key;if(0!==this.comparator(i,o))return!1}return!0},t.prototype.toString=function(){var t=[];return this.forEach(function(e){return t.push(e)}),"SortedSet("+t.toString()+")"},t.prototype.copy=function(e){var n=new t(this.comparator);return n.data=e,n},t}(),Sn=new Ce(Ee.comparator),Cn=new Ce(Ee.comparator),In=new Ce(Ee.comparator),Nn=new Tn(Ee.comparator),kn=function(){function t(t,e,n,r){this.snapshotVersion=t,this.targetChanges=e,this.documentUpdates=n,this.limboDocuments=r}return t.prototype.addDocumentUpdate=function(t){this.documentUpdates=this.documentUpdates.insert(t.key,t)},t.prototype.handleExistenceFilterMismatch=function(t){this.targetChanges[t]={mapping:new On,snapshotVersion:un.MIN,currentStatusUpdate:En.MarkNotCurrent,resumeToken:l()}},t.prototype.synthesizeDeleteForLimboTargetChange=function(t,e){t.currentStatusUpdate!==En.MarkCurrent||this.documentUpdates.get(e)||(this.documentUpdates=this.documentUpdates.insert(e,new Se(e,this.snapshotVersion)),this.limboDocuments=this.limboDocuments.add(e))},t}();!function(t){t[t.None=0]="None",t[t.MarkNotCurrent=1]="MarkNotCurrent",t[t.MarkCurrent=2]="MarkCurrent"}(En||(En={}));var An,Rn=ot(),On=function(){function t(){this.docs=Rn}return Object.defineProperty(t.prototype,"documents",{get:function(){return this.docs},enumerable:!0,configurable:!0}),t.prototype.add=function(t){this.docs=this.docs.add(t)},t.prototype.delete=function(t){this.docs=this.docs.delete(t)},t.prototype.isEqual=function(t){return null!==t&&this.docs.isEqual(t.docs)},t.prototype.filterUpdates=function(t){},t}(),Dn=function(){function t(){this.addedDocuments=Rn,this.removedDocuments=Rn}return t.prototype.applyToKeySet=function(t){var e=t;return this.addedDocuments.forEach(function(t){return e=e.add(t)}),this.removedDocuments.forEach(function(t){return e=e.delete(t)}),e},t.prototype.add=function(t){this.addedDocuments=this.addedDocuments.add(t),this.removedDocuments=this.removedDocuments.delete(t)},t.prototype.delete=function(t){this.addedDocuments=this.addedDocuments.delete(t),this.removedDocuments=this.removedDocuments.add(t)},t.prototype.isEqual=function(t){return null!==t&&this.addedDocuments.isEqual(t.addedDocuments)&&this.removedDocuments.isEqual(t.removedDocuments)},t.prototype.filterUpdates=function(t){var e=this.addedDocuments;this.addedDocuments.forEach(function(n){t.has(n)&&(e=e.delete(n))}),this.addedDocuments=e},t}(),Pn=function(){function t(t,e,n,r){this.updatedTargetIds=t,this.removedTargetIds=e,this.key=n,this.newDoc=r}return t}(),xn=function(){function t(t,e){this.targetId=t,this.existenceFilter=e}return t}();!function(t){t[t.NoChange=0]="NoChange",t[t.Added=1]="Added",t[t.Removed=2]="Removed",t[t.Current=3]="Current",t[t.Reset=4]="Reset"}(An||(An={}));var Ln=function(){function t(t,e,n,r){void 0===n&&(n=l()),void 0===r&&(r=null),this.state=t,this.targetIds=e,this.resumeToken=n,this.cause=r}return t}(),Mn=function(){function t(t,e,n){this.snapshotVersion=t,this.listenTargets=e,this.existenceFilters={},this.targetChanges={},this.documentUpdates=nt(),this.frozen=!1,this.limboDocuments=ot(),this.pendingTargetResponses=g(n)}return t.prototype.add=function(t){c(!this.frozen,"Trying to modify frozen WatchChangeAggregator."),t instanceof Pn?this.addDocumentChange(t):t instanceof Ln?this.addTargetChange(t):t instanceof xn?this.addExistenceFilterChange(t):u("Unknown watch change: "+t)},t.prototype.addChanges=function(t){var e=this;c(!this.frozen,"Trying to modify frozen WatchChangeAggregator."),t.forEach(function(t){return e.add(t)})},t.prototype.createRemoteEvent=function(){var t=this,e=this.targetChanges;return d(this.targetChanges,function(n){t.isActiveTarget(n)||delete e[n]}),this.frozen=!0,new kn(this.snapshotVersion,e,this.documentUpdates,this.limboDocuments)},t.prototype.ensureTargetChange=function(t){var e=this.targetChanges[t];return e||(e={currentStatusUpdate:En.None,snapshotVersion:this.snapshotVersion,mapping:new Dn,resumeToken:l()},this.targetChanges[t]=e),e},t.prototype.queryDataForActiveTarget=function(t){var e=this.listenTargets[t];return e&&!f(this.pendingTargetResponses,t)?e:null},t.prototype.isActiveTarget=function(t){return null!==this.queryDataForActiveTarget(t)},t.prototype.updateLimboDocuments=function(t,e,n){return!!n&&(this.documentUpdates.get(t)?e.purpose===Oe.LimboResolution||(this.limboDocuments=this.limboDocuments.delete(t),!1):e.purpose===Oe.LimboResolution&&(this.limboDocuments=this.limboDocuments.add(t),!0))},t.prototype.addDocumentChange=function(t){for(var e=!1,n=!0,r=0,i=t.updatedTargetIds;r<i.length;r++){var o=i[r],a=this.queryDataForActiveTarget(o);if(a){var s=this.ensureTargetChange(o);n=this.updateLimboDocuments(t.key,a,n),s.mapping.add(t.key),e=!0}}for(var u=0,c=t.removedTargetIds;u<c.length;u++){var o=c[u],a=this.queryDataForActiveTarget(o);if(a){var s=this.ensureTargetChange(o);n=this.updateLimboDocuments(t.key,a,n),s.mapping.delete(t.key),e=!0}}t.newDoc&&e&&(this.documentUpdates=this.documentUpdates.insert(t.key,t.newDoc))},t.prototype.addTargetChange=function(t){var e=this;t.targetIds.forEach(function(n){var r=e.ensureTargetChange(n);switch(t.state){case An.NoChange:e.isActiveTarget(n)&&at(r,t.resumeToken);break;case An.Added:e.recordTargetResponse(n),f(e.pendingTargetResponses,n)||(r.mapping=new Dn,r.currentStatusUpdate=En.None,delete e.existenceFilters[n]),at(r,t.resumeToken);break;case An.Removed:e.recordTargetResponse(n),c(!t.cause,"WatchChangeAggregator does not handle errored targets");break;case An.Current:e.isActiveTarget(n)&&(r.currentStatusUpdate=En.MarkCurrent,at(r,t.resumeToken));break;case An.Reset:e.isActiveTarget(n)&&(r.mapping=new On,at(r,t.resumeToken));break;default:u("Unknown target watch change state: "+t.state)}})},t.prototype.recordTargetResponse=function(t){var e=(this.pendingTargetResponses[t]||0)-1;0===e?delete this.pendingTargetResponses[t]:this.pendingTargetResponses[t]=e},t.prototype.addExistenceFilterChange=function(t){this.isActiveTarget(t.targetId)&&(this.existenceFilters[t.targetId]=t.existenceFilter)},t}(),Fn=function(){function t(){}return t.prototype.applyToLocalView=function(t,e){return new je(e,t)},t.prototype.applyToRemoteDocument=function(t,e){return e},t.prototype.isEqual=function(e){return e instanceof t},t.instance=new t,t}(),Un=function(){function t(t){this.elements=t}return t.prototype.applyToLocalView=function(t,e){return this.apply(t)},t.prototype.applyToRemoteDocument=function(t,e){return this.apply(t)},t.prototype.apply=function(t){for(var e=st(t),n=0,r=this.elements;n<r.length;n++){var i=r[n];!function(t){e.find(function(e){return e.isEqual(t)})||e.push(t)}(i)}return new Ge(e)},t.prototype.isEqual=function(e){return e instanceof t&&j(e.elements,this.elements)},t}(),Bn=function(){function t(t){this.elements=t}return t.prototype.applyToLocalView=function(t,e){return this.apply(t)},t.prototype.applyToRemoteDocument=function(t,e){return this.apply(t)},t.prototype.apply=function(t){for(var e=st(t),n=0,r=this.elements;n<r.length;n++){var i=r[n];!function(t){e=e.filter(function(e){return!e.isEqual(t)})}(i)}return new Ge(e)},t.prototype.isEqual=function(e){return e instanceof t&&j(e.elements,this.elements)},t}(),Vn=function(){var t={};return t[nn.ASCENDING.name]="ASCENDING",t[nn.DESCENDING.name]="DESCENDING",t}(),jn=function(){var t={};return t[$e.LESS_THAN.name]="LESS_THAN",t[$e.LESS_THAN_OR_EQUAL.name]="LESS_THAN_OR_EQUAL",t[$e.GREATER_THAN.name]="GREATER_THAN",t[$e.GREATER_THAN_OR_EQUAL.name]="GREATER_THAN_OR_EQUAL",t[$e.EQUAL.name]="EQUAL",t[$e.ARRAY_CONTAINS.name]="ARRAY_CONTAINS",t}(),qn=new RegExp(/^\d{4}-\d\d-\d\dT\d\d:\d\d:\d\d(?:\.(\d+))?Z$/),Wn=function(){function t(t,e){this.databaseId=t,this.options=e}return t.prototype.emptyByteString=function(){return this.options.useProto3Json?"":new Uint8Array(0)},t.prototype.unsafeCastProtoByteString=function(t){return t},t.prototype.fromRpcStatus=function(t){var e=void 0===t.code?ue.UNKNOWN:Z(t.code);return new ce(e,t.message||"")},t.prototype.toInt32Value=function(t){return z(t)?void 0:{value:t}},t.prototype.fromInt32Value=function(t){var e;return e="object"===typeof t?t.value:t,z(e)?null:e},t.prototype.toTimestamp=function(t){return{seconds:t.seconds,nanos:t.nanoseconds}},t.prototype.fromTimestamp=function(t){if("string"===typeof t)return this.fromIso8601String(t);c(!!t,"Cannot deserialize null or undefined timestamp.");var e=ct(t.seconds||"0"),n=t.nanos||0;return new de(e,n)},t.prototype.fromIso8601String=function(t){var e=0,n=qn.exec(t);if(c(!!n,"invalid timestamp: "+t),n[1]){var r=n[1];r=(r+"000000000").substr(0,9),e=Number(r)}var i=new Date(t),o=Math.floor(i.getTime()/1e3);return new de(o,e)},t.prototype.toBytes=function(t){return this.options.useProto3Json?t.toBase64():this.unsafeCastProtoByteString(t.toUint8Array())},t.prototype.fromBlob=function(t){return"string"===typeof t?(c(this.options.useProto3Json,"Expected bytes to be passed in as Uint8Array, but got a string instead."),he.fromBase64String(t)):(c(!this.options.useProto3Json,"Expected bytes to be passed in as string, but got something else instead."),he.fromUint8Array(t))},t.prototype.toVersion=function(t){return this.toTimestamp(t.toTimestamp())},t.prototype.fromVersion=function(t){return c(!!t,"Trying to deserialize version that isn't set"),un.fromTimestamp(this.fromTimestamp(t))},t.prototype.toResourceName=function(t,e){return this.fullyQualifiedPrefixPath(t).child("documents").child(e).canonicalString()},t.prototype.fromResourceName=function(t){var e=be.fromString(t);return c(this.isValidResourceName(e),"Tried to deserialize invalid key "+e.toString()),e},t.prototype.toName=function(t){return this.toResourceName(this.databaseId,t.path)},t.prototype.fromName=function(t){var e=this.fromResourceName(t);return c(e.get(1)===this.databaseId.projectId,"Tried to deserialize key from different project: "+e.get(1)+" vs "+this.databaseId.projectId),c(!e.get(3)&&!this.databaseId.database||e.get(3)===this.databaseId.database,"Tried to deserialize key from different database: "+e.get(3)+" vs "+this.databaseId.database),new Ee(this.extractLocalPathFromResourceName(e))},t.prototype.toQueryPath=function(t){return 0===t.length?this.encodedDatabaseId:this.toResourceName(this.databaseId,t)},t.prototype.fromQueryPath=function(t){var e=this.fromResourceName(t);return 4===e.length?be.EMPTY_PATH:this.extractLocalPathFromResourceName(e)},Object.defineProperty(t.prototype,"encodedDatabaseId",{get:function(){return new be(["projects",this.databaseId.projectId,"databases",this.databaseId.database]).canonicalString()},enumerable:!0,configurable:!0}),t.prototype.fullyQualifiedPrefixPath=function(t){return new be(["projects",t.projectId,"databases",t.database])},t.prototype.extractLocalPathFromResourceName=function(t){return c(t.length>4&&"documents"===t.get(4),"tried to deserialize invalid key "+t.toString()),t.popFirst(5)},t.prototype.isValidResourceName=function(t){return t.length>=4&&"projects"===t.get(0)&&"databases"===t.get(2)},t.prototype.toValue=function(t){if(t instanceof xe)return{nullValue:"NULL_VALUE"};if(t instanceof Le)return{booleanValue:t.value()};if(t instanceof Fe)return{integerValue:""+t.value()};if(t instanceof Ue){var e=t.value();if(this.options.useProto3Json){if(isNaN(e))return{doubleValue:"NaN"};if(e===1/0)return{doubleValue:"Infinity"};if(e===-1/0)return{doubleValue:"-Infinity"}}return{doubleValue:t.value()}}return t instanceof Be?{stringValue:t.value()}:t instanceof He?{mapValue:this.toMapValue(t)}:t instanceof Ge?{arrayValue:this.toArrayValue(t)}:t instanceof Ve?{timestampValue:this.toTimestamp(t.internalValue)}:t instanceof Ke?{geoPointValue:{latitude:t.value().latitude,longitude:t.value().longitude}}:t instanceof qe?{bytesValue:this.toBytes(t.value())}:t instanceof We?{referenceValue:this.toResourceName(t.databaseId,t.key.path)}:u("Unknown FieldValue "+JSON.stringify(t))},t.prototype.fromValue=function(t){var e=this,n=t.value_type;if(lt(t,n,"nullValue"))return xe.INSTANCE;if(lt(t,n,"booleanValue"))return Le.of(t.booleanValue);if(lt(t,n,"integerValue"))return new Fe(ct(t.integerValue));if(lt(t,n,"doubleValue")){if(this.options.useProto3Json){if("NaN"===t.doubleValue)return Ue.NAN;if("Infinity"===t.doubleValue)return Ue.POSITIVE_INFINITY;if("-Infinity"===t.doubleValue)return Ue.NEGATIVE_INFINITY}return new Ue(t.doubleValue)}if(lt(t,n,"stringValue"))return new Be(t.stringValue);if(lt(t,n,"mapValue"))return this.fromFields(t.mapValue.fields||{});if(lt(t,n,"arrayValue")){ut(t.arrayValue,"arrayValue");var r=t.arrayValue.values||[];return new Ge(r.map(function(t){return e.fromValue(t)}))}if(lt(t,n,"timestampValue"))return ut(t.timestampValue,"timestampValue"),new Ve(this.fromTimestamp(t.timestampValue));if(lt(t,n,"geoPointValue")){ut(t.geoPointValue,"geoPointValue");var i=t.geoPointValue.latitude||0,o=t.geoPointValue.longitude||0;return new Ke(new pe(i,o))}if(lt(t,n,"bytesValue")){ut(t.bytesValue,"bytesValue");var a=this.fromBlob(t.bytesValue);return new qe(a)}if(lt(t,n,"referenceValue")){ut(t.referenceValue,"referenceValue");var s=this.fromResourceName(t.referenceValue),c=new ge(s.get(1),s.get(3)),l=new Ee(this.extractLocalPathFromResourceName(s));return new We(c,l)}return u("Unknown Value proto "+JSON.stringify(t))},t.prototype.toMutationDocument=function(t,e){return{name:this.toName(t),fields:this.toFields(e)}},t.prototype.toDocument=function(t){return c(!t.hasLocalMutations,"Can't serialize documents with mutations."),{name:this.toName(t.key),fields:this.toFields(t.data),updateTime:this.toTimestamp(t.version.toTimestamp())}},t.prototype.fromDocument=function(t){return new Te(this.fromName(t.name),this.fromVersion(t.updateTime),this.fromFields(t.fields||{}),{hasLocalMutations:!1})},t.prototype.toFields=function(t){var e=this,n={};return t.forEach(function(t,r){n[t]=e.toValue(r)}),n},t.prototype.fromFields=function(t){var e=this,n=t,r=He.EMPTY;return y(n,function(t,n){r=r.set(new we([t]),e.fromValue(n))}),r},t.prototype.toMapValue=function(t){return{fields:this.toFields(t)}},t.prototype.toArrayValue=function(t){var e=this,n=[];return t.forEach(function(t){n.push(e.toValue(t))}),{values:n}},t.prototype.fromFound=function(t){c(!!t.found,"Tried to deserialize a found document from a missing document."),ut(t.found.name,"doc.found.name"),ut(t.found.updateTime,"doc.found.updateTime");var e=this.fromName(t.found.name),n=this.fromVersion(t.found.updateTime),r=this.fromFields(t.found.fields||{});return new Te(e,n,r,{hasLocalMutations:!1})},t.prototype.fromMissing=function(t){c(!!t.missing,"Tried to deserialize a missing document from a found document."),c(!!t.readTime,"Tried to deserialize a missing document without a read time.");var e=this.fromName(t.missing),n=this.fromVersion(t.readTime);return new Se(e,n)},t.prototype.fromMaybeDocument=function(t){var e=t.result;return lt(t,e,"found")?this.fromFound(t):lt(t,e,"missing")?this.fromMissing(t):u("invalid batch get response: "+JSON.stringify(t))},t.prototype.toWatchTargetChangeState=function(t){switch(t){case An.Added:return"ADD";case An.Current:return"CURRENT";case An.NoChange:return"NO_CHANGE";case An.Removed:return"REMOVE";case An.Reset:return"RESET";default:return u("Unknown WatchTargetChangeState: "+t)}},t.prototype.toTestWatchChange=function(t){if(t instanceof xn)return{filter:{count:t.existenceFilter.count,targetId:t.targetId}};if(t instanceof Pn){if(t.newDoc instanceof Te){var e=t.newDoc;return{documentChange:{document:{name:this.toName(e.key),fields:this.toFields(e.data),updateTime:this.toVersion(e.version)},targetIds:t.updatedTargetIds,removedTargetIds:t.removedTargetIds}}}if(t.newDoc instanceof Se){var e=t.newDoc;return{documentDelete:{document:this.toName(e.key),readTime:this.toVersion(e.version),removedTargetIds:t.removedTargetIds}}}if(null===t.newDoc)return{documentRemove:{document:this.toName(t.key),removedTargetIds:t.removedTargetIds}}}if(t instanceof Ln){var n=void 0;return t.cause&&(n={code:tt(t.cause.code),message:t.cause.message}),{targetChange:{targetChangeType:this.toWatchTargetChangeState(t.state),targetIds:t.targetIds,resumeToken:this.unsafeCastProtoByteString(t.resumeToken),cause:n}}}return u("Unrecognized watch change: "+JSON.stringify(t))},t.prototype.fromWatchChange=function(t){var e,n=t.response_type;if(lt(t,n,"targetChange")){ut(t.targetChange,"targetChange");var r=this.fromWatchTargetChangeState(t.targetChange.targetChangeType||"NO_CHANGE"),i=t.targetChange.targetIds||[],o=t.targetChange.resumeToken||this.emptyByteString(),a=t.targetChange.cause,s=a&&this.fromRpcStatus(a);e=new Ln(r,i,o,s||null)}else if(lt(t,n,"documentChange")){ut(t.documentChange,"documentChange"),ut(t.documentChange.document,"documentChange.name"),ut(t.documentChange.document.name,"documentChange.document.name"),ut(t.documentChange.document.updateTime,"documentChange.document.updateTime");var c=t.documentChange,l=this.fromName(c.document.name),h=this.fromVersion(c.document.updateTime),f=this.fromFields(c.document.fields||{}),p=new Te(l,h,f,{hasLocalMutations:!1}),d=c.targetIds||[],y=c.removedTargetIds||[];e=new Pn(d,y,p.key,p)}else if(lt(t,n,"documentDelete")){ut(t.documentDelete,"documentDelete"),ut(t.documentDelete.document,"documentDelete.document");var m=t.documentDelete,l=this.fromName(m.document),h=m.readTime?this.fromVersion(m.readTime):un.forDeletedDoc(),p=new Se(l,h),y=m.removedTargetIds||[];e=new Pn([],y,p.key,p)}else if(lt(t,n,"documentRemove")){ut(t.documentRemove,"documentRemove"),ut(t.documentRemove.document,"documentRemove");var g=t.documentRemove,l=this.fromName(g.document),y=g.removedTargetIds||[];e=new Pn([],y,l,null)}else{if(!lt(t,n,"filter"))return u("Unknown change type "+JSON.stringify(t));ut(t.filter,"filter"),ut(t.filter.targetId,"filter.targetId");var v=t.filter,b=v.count||0,_=new wn(b),w=v.targetId;e=new xn(w,_)}return e},t.prototype.fromWatchTargetChangeState=function(t){return"NO_CHANGE"===t?An.NoChange:"ADD"===t?An.Added:"REMOVE"===t?An.Removed:"CURRENT"===t?An.Current:"RESET"===t?An.Reset:u("Got unexpected TargetChange.state: "+t)},t.prototype.versionFromListenResponse=function(t){if(!lt(t,t.response_type,"targetChange"))return un.MIN;var e=t.targetChange;return e.targetIds&&e.targetIds.length?un.MIN:e.readTime?this.fromVersion(e.readTime):un.MIN},t.prototype.toMutation=function(t){var e,n=this;if(t instanceof gn)e={update:this.toMutationDocument(t.key,t.value)};else if(t instanceof _n)e={delete:this.toName(t.key)};else if(t instanceof vn)e={update:this.toMutationDocument(t.key,t.data),updateMask:this.toDocumentMask(t.fieldMask)};else{if(!(t instanceof bn))return u("Unknown mutation type "+t.type);e={transform:{document:this.toName(t.key),fieldTransforms:t.fieldTransforms.map(function(t){return n.toFieldTransform(t)})}}}return t.precondition.isNone||(e.currentDocument=this.toPrecondition(t.precondition)),e},t.prototype.fromMutation=function(t){var e=this,n=t.currentDocument?this.fromPrecondition(t.currentDocument):yn.NONE;if(t.update){ut(t.update.name,"name");var r=this.fromName(t.update.name),i=this.fromFields(t.update.fields||{});if(t.updateMask){var o=this.fromDocumentMask(t.updateMask);return new vn(r,i,o,n)}return new gn(r,i,n)}if(t.delete){var r=this.fromName(t.delete);return new _n(r,n)}if(t.transform){var r=this.fromName(t.transform.document),a=t.transform.fieldTransforms.map(function(t){return e.fromFieldTransform(t)});return c(!0===n.exists,'Transforms only support precondition "exists == true"'),new bn(r,a)}return u("unknown mutation proto: "+JSON.stringify(t))},t.prototype.toPrecondition=function(t){return c(!t.isNone,"Can't serialize an empty precondition"),void 0!==t.updateTime?{updateTime:this.toVersion(t.updateTime)}:void 0!==t.exists?{exists:t.exists}:u("Unknown precondition")},t.prototype.fromPrecondition=function(t){return void 0!==t.updateTime?yn.updateTime(this.fromVersion(t.updateTime)):void 0!==t.exists?yn.exists(t.exists):yn.NONE},t.prototype.fromWriteResult=function(t){var e=this,n=t.updateTime?this.fromVersion(t.updateTime):null,r=null;return t.transformResults&&t.transformResults.length>0&&(r=t.transformResults.map(function(t){return e.fromValue(t)})),new pn(n,r)},t.prototype.fromWriteResults=function(t){var e=this;return(t||[]).map(function(t){return e.fromWriteResult(t)})},t.prototype.toFieldTransform=function(t){var e=this,n=t.transform;return n instanceof Fn?{fieldPath:t.field.canonicalString(),setToServerValue:"REQUEST_TIME"}:n instanceof Un?{fieldPath:t.field.canonicalString(),appendMissingElements:{values:n.elements.map(function(t){return e.toValue(t)})}}:n instanceof Bn?{fieldPath:t.field.canonicalString(),removeAllFromArray:{values:n.elements.map(function(t){return e.toValue(t)})}}:void u("Unknown transform: "+t.transform)},t.prototype.fromFieldTransform=function(t){var e=this,n=t.transform_type,r=null;if(lt(t,n,"setToServerValue"))c("REQUEST_TIME"===t.setToServerValue,"Unknown server value transform proto: "+JSON.stringify(t)),r=Fn.instance;else if(lt(t,n,"appendMissingElements")){var i=t.appendMissingElements.values||[];r=new Un(i.map(function(t){return e.fromValue(t)}))}else if(lt(t,n,"removeAllFromArray")){var i=t.removeAllFromArray.values||[];r=new Bn(i.map(function(t){return e.fromValue(t)}))}else u("Unknown transform proto: "+JSON.stringify(t));var o=we.fromServerFormat(t.fieldPath);return new fn(o,r)},t.prototype.toDocumentsTarget=function(t){return{documents:[this.toQueryPath(t.path)]}},t.prototype.fromDocumentsTarget=function(t){var e=t.documents.length;c(1===e,"DocumentsTarget contained other than 1 document: "+e);var n=t.documents[0];return Je.atPath(this.fromQueryPath(n))},t.prototype.toQueryTarget=function(t){var e={structuredQuery:{}};if(t.path.isEmpty())e.parent=this.toQueryPath(be.EMPTY_PATH);else{var n=t.path;c(n.length%2!==0,"Document queries with filters are not supported."),e.parent=this.toQueryPath(n.popLast()),e.structuredQuery.from=[{collectionId:n.lastSegment()}]}var r=this.toFilter(t.filters);r&&(e.structuredQuery.where=r);var i=this.toOrder(t.orderBy);i&&(e.structuredQuery.orderBy=i);var o=this.toInt32Value(t.limit);return void 0!==o&&(e.structuredQuery.limit=o),t.startAt&&(e.structuredQuery.startAt=this.toCursor(t.startAt)),t.endAt&&(e.structuredQuery.endAt=this.toCursor(t.endAt)),e},t.prototype.fromQueryTarget=function(t){var e=this.fromQueryPath(t.parent),n=t.structuredQuery,r=n.from?n.from.length:0;if(r>0){c(1===r,"StructuredQuery.from with more than one collection is not supported.");var i=n.from[0];e=e.child(i.collectionId)}var o=[];n.where&&(o=this.fromFilter(n.where));var a=[];n.orderBy&&(a=this.fromOrder(n.orderBy));var s=null;n.limit&&(s=this.fromInt32Value(n.limit));var u=null;n.startAt&&(u=this.fromCursor(n.startAt));var l=null;return n.endAt&&(l=this.fromCursor(n.endAt)),new Je(e,a,o,s,u,l)},t.prototype.toListenRequestLabels=function(t){var e=this.toLabel(t.purpose);return null==e?null:{"goog-listen-tags":e}},t.prototype.toLabel=function(t){switch(t){case Oe.Listen:return null;case Oe.ExistenceFilterMismatch:return"existence-filter-mismatch";case Oe.LimboResolution:return"limbo-document";default:return u("Unrecognized query purpose: "+t)}},t.prototype.toTarget=function(t){var e,n=t.query;return e=n.isDocumentQuery()?{documents:this.toDocumentsTarget(n)}:{query:this.toQueryTarget(n)},e.targetId=t.targetId,t.resumeToken.length>0&&(e.resumeToken=this.unsafeCastProtoByteString(t.resumeToken)),e},t.prototype.toFilter=function(t){var e=this;if(0!==t.length){var n=t.map(function(t){return t instanceof Ze?e.toRelationFilter(t):e.toUnaryFilter(t)});return 1===n.length?n[0]:{compositeFilter:{op:"AND",filters:n}}}},t.prototype.fromFilter=function(t){var e=this;return t?void 0!==t.unaryFilter?[this.fromUnaryFilter(t)]:void 0!==t.fieldFilter?[this.fromRelationFilter(t)]:void 0!==t.compositeFilter?t.compositeFilter.filters.map(function(t){return e.fromFilter(t)}).reduce(function(t,e){return t.concat(e)}):u("Unknown filter: "+JSON.stringify(t)):[]},t.prototype.toOrder=function(t){var e=this;if(0!==t.length)return t.map(function(t){return e.toPropertyOrder(t)})},t.prototype.fromOrder=function(t){var e=this;return t.map(function(t){return e.fromPropertyOrder(t)})},t.prototype.toCursor=function(t){var e=this;return{before:t.before,values:t.position.map(function(t){return e.toValue(t)})}},t.prototype.fromCursor=function(t){var e=this,n=!!t.before,r=t.values.map(function(t){return e.fromValue(t)});return new rn(r,n)},t.prototype.toDirection=function(t){return Vn[t.name]},t.prototype.fromDirection=function(t){switch(t){case"ASCENDING":return nn.ASCENDING;case"DESCENDING":return nn.DESCENDING;default:return}},t.prototype.toOperatorName=function(t){return jn[t.name]},t.prototype.fromOperatorName=function(t){switch(t){case"EQUAL":return $e.EQUAL;case"GREATER_THAN":return $e.GREATER_THAN;case"GREATER_THAN_OR_EQUAL":return $e.GREATER_THAN_OR_EQUAL;case"LESS_THAN":return $e.LESS_THAN;case"LESS_THAN_OR_EQUAL":return $e.LESS_THAN_OR_EQUAL;case"ARRAY_CONTAINS":return $e.ARRAY_CONTAINS;case"OPERATOR_UNSPECIFIED":return u("Unspecified relation");default:return u("Unknown relation")}},t.prototype.toFieldPathReference=function(t){return{fieldPath:t.canonicalString()}},t.prototype.fromFieldPathReference=function(t){return we.fromServerFormat(t.fieldPath)},t.prototype.toPropertyOrder=function(t){return{field:this.toFieldPathReference(t.field),direction:this.toDirection(t.dir)}},t.prototype.fromPropertyOrder=function(t){return new on(this.fromFieldPathReference(t.field),this.fromDirection(t.direction))},t.prototype.toRelationFilter=function(t){return t instanceof Ze?{fieldFilter:{field:this.toFieldPathReference(t.field),op:this.toOperatorName(t.op),value:this.toValue(t.value)}}:u("Unrecognized filter: "+JSON.stringify(t))},t.prototype.fromRelationFilter=function(t){return new Ze(this.fromFieldPathReference(t.fieldFilter.field),this.fromOperatorName(t.fieldFilter.op),this.fromValue(t.fieldFilter.value))},t.prototype.toUnaryFilter=function(t){return t instanceof en?{unaryFilter:{field:this.toFieldPathReference(t.field),op:"IS_NAN"}}:t instanceof tn?{unaryFilter:{field:this.toFieldPathReference(t.field),op:"IS_NULL"}}:u("Unrecognized filter: "+JSON.stringify(t))},t.prototype.fromUnaryFilter=function(t){switch(t.unaryFilter.op){case"IS_NAN":var e=this.fromFieldPathReference(t.unaryFilter.field);return new en(e);case"IS_NULL":var n=this.fromFieldPathReference(t.unaryFilter.field);return new tn(n);case"OPERATOR_UNSPECIFIED":return u("Unspecified filter");default:return u("Unknown filter")}},t.prototype.toDocumentMask=function(t){return{fieldPaths:t.fields.map(function(t){return t.canonicalString()})}},t.prototype.fromDocumentMask=function(t){var e=t.fieldPaths||[],n=e.map(function(t){return we.fromServerFormat(t)});return new hn(n)},t}(),Kn=function(){return"object"===typeof navigator&&"ReactNative"===navigator.product},Hn="FirebaseError",Gn=Error.captureStackTrace,Qn=function(){function t(t,e){if(this.code=t,this.message=e,Gn)Gn(this,zn.prototype.create);else try{throw Error.apply(this,arguments)}catch(t){this.name=Hn,Object.defineProperty(this,"stack",{get:function(){return t.stack}})}}return t}();Qn.prototype=Object.create(Error.prototype),Qn.prototype.constructor=Qn,Qn.prototype.name=Hn;var zn=function(){function t(t,e,n){this.service=t,this.serviceName=e,this.errors=n,this.pattern=/\{\$([^}]+)}/g}return t.prototype.create=function(t,e){void 0===e&&(e={});var n,r=this.errors[t],i=this.service+"/"+t;n=void 0===r?"Error":r.replace(this.pattern,function(t,n){var r=e[n];return void 0!==r?r.toString():"<"+n+"?>"}),n=this.serviceName+": "+n+" ("+i+").";var o=new Qn(i,n);for(var a in e)e.hasOwnProperty(a)&&"_"!==a.slice(-1)&&(o[a]=e[a]);return o},t}(),Yn=function(){function t(){this.blockSize=-1}return t}(),Xn=(function(t){function e(){var e=t.call(this)||this;e.chain_=[],e.buf_=[],e.W_=[],e.pad_=[],e.inbuf_=0,e.total_=0,e.blockSize=64,e.pad_[0]=128;for(var n=1;n<e.blockSize;++n)e.pad_[n]=0;return e.reset(),e}re.__extends(e,t),e.prototype.reset=function(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0},e.prototype.compress_=function(t,e){e||(e=0);var n=this.W_;if("string"===typeof t)for(var r=0;r<16;r++)n[r]=t.charCodeAt(e)<<24|t.charCodeAt(e+1)<<16|t.charCodeAt(e+2)<<8|t.charCodeAt(e+3),e+=4;else for(var r=0;r<16;r++)n[r]=t[e]<<24|t[e+1]<<16|t[e+2]<<8|t[e+3],e+=4;for(var r=16;r<80;r++){var i=n[r-3]^n[r-8]^n[r-14]^n[r-16];n[r]=4294967295&(i<<1|i>>>31)}for(var o,a,s=this.chain_[0],u=this.chain_[1],c=this.chain_[2],l=this.chain_[3],h=this.chain_[4],r=0;r<80;r++){r<40?r<20?(o=l^u&(c^l),a=1518500249):(o=u^c^l,a=1859775393):r<60?(o=u&c|l&(u|c),a=2400959708):(o=u^c^l,a=3395469782);var i=(s<<5|s>>>27)+o+h+a+n[r]&4294967295;h=l,l=c,c=4294967295&(u<<30|u>>>2),u=s,s=i}this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+u&4294967295,this.chain_[2]=this.chain_[2]+c&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295},e.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r<e;){if(0==o)for(;r<=n;)this.compress_(t,r),r+=this.blockSize;if("string"===typeof t){for(;r<e;)if(i[o]=t.charCodeAt(r),++o,++r,o==this.blockSize){this.compress_(i),o=0;break}}else for(;r<e;)if(i[o]=t[r],++o,++r,o==this.blockSize){this.compress_(i),o=0;break}}this.inbuf_=o,this.total_+=e}},e.prototype.digest=function(){var t=[],e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(var n=this.blockSize-1;n>=56;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);for(var r=0,n=0;n<5;n++)for(var i=24;i>=0;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t}}(Yn),function(){function t(t){this.sendFn=t.sendFn,this.closeFn=t.closeFn}return t.prototype.onOpen=function(t){c(!this.wrappedOnOpen,"Called onOpen on stream twice!"),this.wrappedOnOpen=t},t.prototype.onClose=function(t){c(!this.wrappedOnClose,"Called onClose on stream twice!"),this.wrappedOnClose=t},t.prototype.onMessage=function(t){c(!this.wrappedOnMessage,"Called onMessage on stream twice!"),this.wrappedOnMessage=t},t.prototype.close=function(){this.closeFn()},t.prototype.send=function(t){this.sendFn(t)},t.prototype.callOnOpen=function(){c(void 0!==this.wrappedOnOpen,"Cannot call onOpen because no callback was set"),this.wrappedOnOpen()},t.prototype.callOnClose=function(t){c(void 0!==this.wrappedOnClose,"Cannot call onClose because no callback was set"),this.wrappedOnClose(t)},t.prototype.callOnMessage=function(t){c(void 0!==this.wrappedOnMessage,"Cannot call onMessage because no callback was set"),this.wrappedOnMessage(t)},t}()),Jn="Connection",$n={BatchGetDocuments:"batchGet",Commit:"commit"},Zn="gl-js/ fire/"+oe,tr=function(){function t(t){this.databaseId=t.databaseId,this.pool=new ie.XhrIoPool;var e=t.ssl?"https":"http";this.baseUrl=e+"://"+t.host}return t.prototype.modifyHeadersForRequest=function(t,e){if(e)for(var n in e.authHeaders)e.authHeaders.hasOwnProperty(n)&&(t[n]=e.authHeaders[n]);t["X-Goog-Api-Client"]=Zn},t.prototype.invokeRPC=function(t,e,n){var r=this,i=this.makeUrl(t);return new Promise(function(a,s){r.pool.getObject(function(c){c.listenOnce(ie.EventType.COMPLETE,function(){try{switch(c.getLastErrorCode()){case ie.ErrorCode.NO_ERROR:var e=c.getResponseJson();o(Jn,"XHR received:",JSON.stringify(e)),a(e);break;case ie.ErrorCode.TIMEOUT:o(Jn,'RPC "'+t+'" timed out'),s(new ce(ue.DEADLINE_EXCEEDED,"Request time out"));break;case ie.ErrorCode.HTTP_ERROR:var n=c.getStatus();o(Jn,'RPC "'+t+'" failed with status:',n,"response text:",c.getResponseText()),n>0?s(new ce(et(n),"Server responded with status "+c.getStatusText())):(o(Jn,'RPC "'+t+'" failed'),s(new ce(ue.UNAVAILABLE,"Connection failed.")));break;default:u('RPC "'+t+'" failed with unanticipated webchannel error '+c.getLastErrorCode()+": "+c.getLastError()+", giving up.")}}finally{o(Jn,'RPC "'+t+'" completed.'),r.pool.releaseObject(c)}});var l=JSON.stringify(e);o(Jn,"XHR sending: ",i+" "+l);var h={"Content-Type":"text/plain"};r.modifyHeadersForRequest(h,n),c.send(i,"POST",l,h,15)})})},t.prototype.invokeStreamingRPC=function(t,e,n){return this.invokeRPC(t,e,n)},t.prototype.openStream=function(t,e){var n=[this.baseUrl,"/","google.firestore.v1beta1.Firestore","/",t,"/channel"],r=ie.createWebChannelTransport(),i={backgroundChannelTest:!0,httpSessionIdParam:"gsessionid",initMessageHeaders:{},messageUrlParams:{database:"projects/"+this.databaseId.projectId+"/databases/"+this.databaseId.database},sendRawJson:!0,supportsCrossDomainXhr:!0};this.modifyHeadersForRequest(i.initMessageHeaders,e),Kn()||(i.httpHeadersOverwriteParam="$httpHeaders");var a=n.join("");o(Jn,"Creating WebChannel: "+a+" "+i);var s=r.createWebChannel(a,i),u=!1,l=!1,h=new Xn({sendFn:function(t){l?o(Jn,"Not sending because WebChannel is closed:",t):(u||(o(Jn,"Opening WebChannel transport."),s.open(),u=!0),o(Jn,"WebChannel sending:",t),s.send(t))},closeFn:function(){return s.close()}}),f=function(t,e){s.listen(t,function(t){try{e(t)}catch(t){setTimeout(function(){throw t},0)}})};return f(ie.WebChannel.EventType.OPEN,function(){l||o(Jn,"WebChannel transport opened.")}),f(ie.WebChannel.EventType.CLOSE,function(){l||(l=!0,o(Jn,"WebChannel transport closed"),h.callOnClose())}),f(ie.WebChannel.EventType.ERROR,function(t){l||(l=!0,o(Jn,"WebChannel transport errored:",t),h.callOnClose(new ce(ue.UNAVAILABLE,"The operation could not be completed")))}),f(ie.WebChannel.EventType.MESSAGE,function(t){if(!l){var e=t.data[0];c(!!e,"Got a webchannel message without data.");var n=e.error||e[0]&&e[0].error;if(n){o(Jn,"WebChannel received error:",n);var r=n.status,i=$(r),a=n.message;void 0===i&&(i=ue.INTERNAL,a="Unknown error status: "+r+" with message "+n.message),l=!0,h.callOnClose(new ce(i,a)),s.close()}else o(Jn,"WebChannel received:",e),h.callOnMessage(e)}}),setTimeout(function(){h.callOnOpen()},0),h},t.prototype.makeUrl=function(t){var e=$n[t];c(void 0!==e,"Unknown REST mapping for: "+t);var n=[this.baseUrl,"/","v1beta1"];return n.push("/projects/"),n.push(this.databaseId.projectId),n.push("/databases/"),n.push(this.databaseId.database),n.push("/documents"),n.push(":"),n.push(e),n.join("")},t}(),er=function(){function t(){this.emptyByteString="",this.base64Available="undefined"!==typeof atob}return t.prototype.loadConnection=function(t){return Promise.resolve(new tr(t))},t.prototype.newSerializer=function(t){return new Wn(t,{useProto3Json:!0})},t.prototype.formatJSON=function(t){return JSON.stringify(t)},t.prototype.atob=function(t){return atob(t)},t.prototype.btoa=function(t){return btoa(t)},t}();se.setPlatform(new er);var nr,rr=function(){function t(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];w("FieldPath",t,"fieldNames",1);for(var n=0;n<t.length;++n)if(E("FieldPath","string",n,t[n]),0===t[n].length)throw new ce(ue.INVALID_ARGUMENT,"Invalid field name at argument $(i + 1). Field names must not be empty.");this._internalPath=new we(t)}return t.documentId=function(){return t._DOCUMENT_ID},t.prototype.isEqual=function(e){if(!(e instanceof t))throw M("isEqual","FieldPath",1,e);return this._internalPath.isEqual(e._internalPath)},t._DOCUMENT_ID=new t(we.keyField().canonicalString()),t}(),ir=new RegExp("[~\\*/\\[\\]]");!function(t){t[t.Unknown=0]="Unknown",t[t.Online=1]="Online",t[t.Offline=2]="Offline"}(nr||(nr={}));var or;!function(t){t[t.Added=0]="Added",t[t.Removed=1]="Removed",t[t.Modified=2]="Modified",t[t.Metadata=3]="Metadata"}(or||(or={}));var ar;!function(t){t[t.Local=0]="Local",t[t.Synced=1]="Synced"}(ar||(ar={}));var sr,ur=function(){function t(){this.changeMap=new Ce(Ee.comparator)}return t.prototype.track=function(t){var e=t.doc.key,n=this.changeMap.get(e);if(!n)return void(this.changeMap=this.changeMap.insert(e,t));t.type!==or.Added&&n.type===or.Metadata?this.changeMap=this.changeMap.insert(e,t):t.type===or.Metadata&&n.type!==or.Removed?this.changeMap=this.changeMap.insert(e,{type:n.type,doc:t.doc}):t.type===or.Modified&&n.type===or.Modified?this.changeMap=this.changeMap.insert(e,{type:or.Modified,doc:t.doc}):t.type===or.Modified&&n.type===or.Added?this.changeMap=this.changeMap.insert(e,{type:or.Added,doc:t.doc}):t.type===or.Removed&&n.type===or.Added?this.changeMap=this.changeMap.remove(e):t.type===or.Removed&&n.type===or.Modified?this.changeMap=this.changeMap.insert(e,{type:or.Removed,doc:n.doc}):t.type===or.Added&&n.type===or.Removed?this.changeMap=this.changeMap.insert(e,{type:or.Modified,doc:t.doc}):u("unsupported combination of changes: "+JSON.stringify(t)+" after "+JSON.stringify(n))},t.prototype.getChanges=function(){var t=[];return this.changeMap.inorderTraversal(function(e,n){t.push(n)}),t},t}(),cr=function(){function t(t,e,n,r,i,o,a,s){this.query=t,this.docs=e,this.oldDocs=n,this.docChanges=r,this.fromCache=i,this.hasPendingWrites=o,this.syncStateChanged=a,this.excludesMetadataChanges=s}return t.prototype.isEqual=function(t){if(this.fromCache!==t.fromCache||this.hasPendingWrites!==t.hasPendingWrites||this.syncStateChanged!==t.syncStateChanged||!this.query.isEqual(t.query)||!this.docs.isEqual(t.docs)||!this.oldDocs.isEqual(t.oldDocs))return!1;var e=this.docChanges,n=t.docChanges;if(e.length!==n.length)return!1;for(var r=0;r<e.length;r++)if(e[r].type!==n[r].type||!e[r].doc.isEqual(n[r].doc))return!1;return!0},t}(),lr=function(){function t(t){this.comparator=t?function(e,n){return t(e,n)||Ee.comparator(e.key,n.key)}:function(t,e){return Ee.comparator(t.key,e.key)},this.keyedMap=rt(),this.sortedSet=new Ce(this.comparator)}return t.emptySet=function(e){return new t(e.comparator)},t.prototype.has=function(t){return null!=this.keyedMap.get(t)},t.prototype.get=function(t){return this.keyedMap.get(t)},t.prototype.first=function(){return this.sortedSet.minKey()},t.prototype.last=function(){return this.sortedSet.maxKey()},t.prototype.isEmpty=function(){return this.sortedSet.isEmpty()},t.prototype.indexOf=function(t){var e=this.keyedMap.get(t);return e?this.sortedSet.indexOf(e):-1},Object.defineProperty(t.prototype,"size",{get:function(){return this.sortedSet.size},enumerable:!0,configurable:!0}),t.prototype.forEach=function(t){this.sortedSet.inorderTraversal(function(e,n){return t(e),!1})},t.prototype.add=function(t){var e=this.delete(t.key);return e.copy(e.keyedMap.insert(t.key,t),e.sortedSet.insert(t,null))},t.prototype.delete=function(t){var e=this.get(t);return e?this.copy(this.keyedMap.remove(t),this.sortedSet.remove(e)):this},t.prototype.isEqual=function(e){if(!(e instanceof t))return!1;if(this.size!==e.size)return!1;for(var n=this.sortedSet.getIterator(),r=e.sortedSet.getIterator();n.hasNext();){var i=n.getNext().key,o=r.getNext().key;if(!i.isEqual(o))return!1}return!0},t.prototype.toString=function(){var t=[];return this.forEach(function(e){t.push(e.toString())}),0===t.length?"DocumentSet ()":"DocumentSet (\n "+t.join(" \n")+"\n)"},t.prototype.copy=function(e,n){var r=new t;return r.comparator=this.comparator,r.keyedMap=e,r.sortedSet=n,r},t}(),hr=function(){function t(t){this.mapKeyFn=t,this.inner={}}return t.prototype.get=function(t){var e=this.mapKeyFn(t),n=this.inner[e];if(void 0!==n)for(var r=0,i=n;r<i.length;r++){var o=i[r],a=o[0],s=o[1];if(a.isEqual(t))return s}},t.prototype.has=function(t){return void 0!==this.get(t)},t.prototype.set=function(t,e){var n=this.mapKeyFn(t),r=this.inner[n];if(void 0===r)return void(this.inner[n]=[[t,e]]);for(var i=0;i<r.length;i++)if(r[i][0].isEqual(t))return void(r[i]=[t,e]);r.push([t,e])},t.prototype.delete=function(t){var e=this.mapKeyFn(t),n=this.inner[e];if(void 0===n)return!1;for(var r=0;r<n.length;r++)if(n[r][0].isEqual(t))return 1===n.length?delete this.inner[e]:n.splice(r,1),!0;return!1},t.prototype.forEach=function(t){y(this.inner,function(e,n){for(var r=0,i=n;r<i.length;r++){var o=i[r],a=o[0],s=o[1];t(a,s)}})},t.prototype.isEmpty=function(){return m(this.inner)},t}(),fr=function(){function t(){this.listeners=[]}return t}(),pr=function(){function t(t){this.syncEngine=t,this.queries=new hr(function(t){return t.canonicalId()}),this.onlineState=nr.Unknown,this.syncEngine.subscribe(this.onChange.bind(this),this.onError.bind(this))}return t.prototype.listen=function(t){var e=t.query,n=!1,r=this.queries.get(e);return r||(n=!0,r=new fr,this.queries.set(e,r)),r.listeners.push(t),t.applyOnlineStateChange(this.onlineState),r.viewSnap&&t.onViewSnapshot(r.viewSnap),n?this.syncEngine.listen(e).then(function(t){return r.targetId=t,t}):Promise.resolve(r.targetId)},t.prototype.unlisten=function(t){return re.__awaiter(this,void 0,void 0,function(){var e,n,r,i;return re.__generator(this,function(o){return e=t.query,n=!1,r=this.queries.get(e),r&&(i=r.listeners.indexOf(t))>=0&&(r.listeners.splice(i,1),n=0===r.listeners.length),n?(this.queries.delete(e),[2,this.syncEngine.unlisten(e)]):[2]})})},t.prototype.onChange=function(t){for(var e=0,n=t;e<n.length;e++){var r=n[e],i=r.query,o=this.queries.get(i);if(o){for(var a=0,s=o.listeners;a<s.length;a++){s[a].onViewSnapshot(r)}o.viewSnap=r}}},t.prototype.onError=function(t,e){var n=this.queries.get(t);if(n)for(var r=0,i=n.listeners;r<i.length;r++){var o=i[r];o.onError(e)}this.queries.delete(t)},t.prototype.applyOnlineStateChange=function(t){this.onlineState=t,this.queries.forEach(function(e,n){for(var r=0,i=n.listeners;r<i.length;r++){i[r].applyOnlineStateChange(t)}})},t}(),dr=function(){function t(t,e,n){this.query=t,this.queryObserver=e,this.raisedInitialEvent=!1,this.onlineState=nr.Unknown,this.options=n||{}}return t.prototype.onViewSnapshot=function(t){if(c(t.docChanges.length>0||t.syncStateChanged,"We got a new snapshot with no changes?"),!this.options.includeMetadataChanges){for(var e=[],n=0,r=t.docChanges;n<r.length;n++){var i=r[n];i.type!==or.Metadata&&e.push(i)}t=new cr(t.query,t.docs,t.oldDocs,e,t.fromCache,t.hasPendingWrites,t.syncStateChanged,!0)}this.raisedInitialEvent?this.shouldRaiseEvent(t)&&this.queryObserver.next(t):this.shouldRaiseInitialEvent(t,this.onlineState)&&this.raiseInitialEvent(t),this.snap=t},t.prototype.onError=function(t){this.queryObserver.error(t)},t.prototype.applyOnlineStateChange=function(t){this.onlineState=t,this.snap&&!this.raisedInitialEvent&&this.shouldRaiseInitialEvent(this.snap,t)&&this.raiseInitialEvent(this.snap)},t.prototype.shouldRaiseInitialEvent=function(t,e){if(c(!this.raisedInitialEvent,"Determining whether to raise first event but already had first event"),!t.fromCache)return!0;var n=e!==nr.Offline;return this.options.waitForSyncWhenOnline&&n?(c(t.fromCache,"Waiting for sync, but snapshot is not from cache"),!1):!t.docs.isEmpty()||e===nr.Offline},t.prototype.shouldRaiseEvent=function(t){if(t.docChanges.length>0)return!0;var e=this.snap&&this.snap.hasPendingWrites!==t.hasPendingWrites;return!(!t.syncStateChanged&&!e)&&!0===this.options.includeMetadataChanges},t.prototype.raiseInitialEvent=function(e){c(!this.raisedInitialEvent,"Trying to raise initial events for second time"),e=new cr(e.query,e.docs,lr.emptySet(e.docs),t.getInitialViewChanges(e),e.fromCache,e.hasPendingWrites,!0,!1),this.raisedInitialEvent=!0,this.queryObserver.next(e)},t.getInitialViewChanges=function(t){var e=[];return t.docs.forEach(function(t){e.push({type:or.Added,doc:t})}),e},t}(),yr=function(){function t(t){var e=this;this.nextCallback=null,this.catchCallback=null,this.result=void 0,this.error=void 0,this.isDone=!1,this.callbackAttached=!1,t(function(t){e.isDone=!0,e.result=t,e.nextCallback&&e.nextCallback(t)},function(t){e.isDone=!0,e.error=t,e.catchCallback&&e.catchCallback(t)})}return t.prototype.catch=function(t){return this.next(void 0,t)},t.prototype.next=function(e,n){var r=this;return this.callbackAttached&&u("Called next() or catch() twice for PersistencePromise"),this.callbackAttached=!0,this.isDone?this.error?this.wrapFailure(n,this.error):this.wrapSuccess(e,this.result):new t(function(t,i){r.nextCallback=function(n){r.wrapSuccess(e,n).next(t,i)},r.catchCallback=function(e){r.wrapFailure(n,e).next(t,i)}})},t.prototype.toPromise=function(){var t=this;return new Promise(function(e,n){t.next(e,n)})},t.prototype.wrapUserFunction=function(e){try{var n=e();return n instanceof t?n:t.resolve(n)}catch(e){return t.reject(e)}},t.prototype.wrapSuccess=function(e,n){return e?this.wrapUserFunction(function(){return e(n)}):t.resolve(n)},t.prototype.wrapFailure=function(e,n){return e?this.wrapUserFunction(function(){return e(n)}):t.reject(n)},t.resolve=function(e){return new t(function(t,n){t(e)})},t.reject=function(e){return new t(function(t,n){n(e)})},t.waitFor=function(e){var n=e.length;if(0===n)return t.resolve();var r=0;return new t(function(t,i){for(var o=0,a=e;o<a.length;o++){a[o].next(function(){++r===n&&t()},function(t){return i(t)})}})},t.map=function(e){for(var n=[],r=[],i=0;i<e.length;++i)!function(t){r[t]=e[t].next(function(e){n[t]=e})}(i);return t.waitFor(r).next(function(){return n})},t}(),mr=function(){function t(){this.isEager=!0,this.sources=[],this.potentialGarbage=ot()}return t.prototype.addGarbageSource=function(t){this.sources.push(t),t.setGarbageCollector(this)},t.prototype.removeGarbageSource=function(t){this.sources.splice(this.sources.indexOf(t),1),t.setGarbageCollector(null)},t.prototype.addPotentialGarbageKey=function(t){this.potentialGarbage=this.potentialGarbage.add(t)},t.prototype.collectGarbage=function(t){var e=this,n=[],r=ot();return this.potentialGarbage.forEach(function(i){var o=e.documentHasAnyReferences(t,i);n.push(o.next(function(t){return t||(r=r.add(i)),yr.resolve()}))}),this.potentialGarbage=ot(),yr.waitFor(n).next(function(){return r})},t.prototype.documentHasAnyReferences=function(t,e){var n=yr.resolve(!1);return this.sources.map(function(n){return function(){return n.containsKey(t,e)}}).reduce(function(t,e){return t.next(function(t){return t?yr.resolve(!0):e()})},n)},t}(),gr=function(){function t(t,e,n){this.query=t,this.addedKeys=e,this.removedKeys=n}return t.fromSnapshot=function(e){for(var n=ot(),r=ot(),i=0,o=e.docChanges;i<o.length;i++){var a=o[i];switch(a.type){case or.Added:n=n.add(a.doc.key);break;case or.Removed:r=r.add(a.doc.key)}}return new t(e.query,n,r)},t}(),vr=function(){function t(){this.refsByKey=new Tn(br.compareByKey),this.refsByTarget=new Tn(br.compareByTargetId),this.garbageCollector=null}return t.prototype.isEmpty=function(){return this.refsByKey.isEmpty()},t.prototype.addReference=function(t,e){var n=new br(t,e);this.refsByKey=this.refsByKey.add(n),this.refsByTarget=this.refsByTarget.add(n)},t.prototype.addReferences=function(t,e){var n=this;t.forEach(function(t){return n.addReference(t,e)})},t.prototype.removeReference=function(t,e){this.removeRef(new br(t,e))},t.prototype.removeReferences=function(t,e){var n=this;t.forEach(function(t){return n.removeReference(t,e)})},t.prototype.removeReferencesForId=function(t){var e=this,n=Ee.EMPTY,r=new br(n,t),i=new br(n,t+1);this.refsByTarget.forEachInRange([r,i],function(t){e.removeRef(t)})},t.prototype.removeAllReferences=function(){var t=this;this.refsByKey.forEach(function(e){return t.removeRef(e)})},t.prototype.removeRef=function(t){this.refsByKey=this.refsByKey.delete(t),this.refsByTarget=this.refsByTarget.delete(t),null!==this.garbageCollector&&this.garbageCollector.addPotentialGarbageKey(t.key)},t.prototype.referencesForId=function(t){var e=Ee.EMPTY,n=new br(e,t),r=new br(e,t+1),i=ot();return this.refsByTarget.forEachInRange([n,r],function(t){i=i.add(t.key)}),i},t.prototype.setGarbageCollector=function(t){this.garbageCollector=t},t.prototype.containsKey=function(t,e){var n=new br(e,0),r=this.refsByKey.firstAfterOrEqual(n);return yr.resolve(null!==r&&e.isEqual(r.key))},t}(),br=function(){function t(t,e){this.key=t,this.targetOrBatchId=e}return t.compareByKey=function(t,e){return Ee.comparator(t.key,e.key)||B(t.targetOrBatchId,e.targetOrBatchId)},t.compareByTargetId=function(t,e){return B(t.targetOrBatchId,e.targetOrBatchId)||Ee.comparator(t.key,e.key)},t}(),_r=1;!function(t){t[t.LocalStore=0]="LocalStore",t[t.SyncEngine=1]="SyncEngine"}(sr||(sr={}));var wr,Er=function(){function t(t,e){void 0===e&&(e=0),this.generatorId=t;var n=e>>_r<<_r,r=e-n;this.previousId=r>=t?n|this.generatorId:(n|this.generatorId)-(1<<_r)}return t.prototype.next=function(){return this.previousId+=1<<_r,this.previousId},t.forLocalStore=function(e){return void 0===e&&(e=0),new t(sr.LocalStore,e)},t.forSyncEngine=function(){return new t(sr.SyncEngine)},t}(),Tr=function(){function t(t){this.key=t}return t}(),Sr=function(){function t(t){this.key=t}return t}(),Cr=function(){function t(t,e){this.query=t,this._syncedDocuments=e,this.syncState=null,this.current=!1,this.limboDocuments=ot(),this.mutatedKeys=ot(),this.documentSet=new lr(t.docComparator.bind(t))}return Object.defineProperty(t.prototype,"syncedDocuments",{get:function(){return this._syncedDocuments},enumerable:!0,configurable:!0}),t.prototype.computeDocChanges=function(t,e){var n=this,r=e?e.changeSet:new ur,i=e?e.documentSet:this.documentSet,o=e?e.mutatedKeys:this.mutatedKeys,a=i,s=!1,u=this.query.hasLimit()&&i.size===this.query.limit?i.last():null;if(t.inorderTraversal(function(t,e){var l=i.get(t),h=e instanceof Te?e:null;if(h&&(c(t.isEqual(h.key),"Mismatching keys found in document changes: "+t+" != "+h.key),h=n.query.matches(h)?h:null),h?(a=a.add(h),o=h.hasLocalMutations?o.add(t):o.delete(t)):(a=a.delete(t),o=o.delete(t)),l&&h){var f=l.data.isEqual(h.data);f&&l.hasLocalMutations===h.hasLocalMutations||(f?r.track({type:or.Metadata,doc:h}):r.track({type:or.Modified,doc:h}),u&&n.query.docComparator(h,u)>0&&(s=!0))}else!l&&h?r.track({type:or.Added,doc:h}):l&&!h&&(r.track({type:or.Removed,doc:l}),u&&(s=!0))}),this.query.hasLimit())for(;a.size>this.query.limit;){var l=a.last();a=a.delete(l.key),r.track({type:or.Removed,doc:l})}return c(!s||!e,"View was refilled using docs that themselves needed refilling."),{documentSet:a,changeSet:r,needsRefill:s,mutatedKeys:o}},t.prototype.applyChanges=function(t,e){var n=this;c(!t.needsRefill,"Cannot apply changes that need a refill");var r=this.documentSet;this.documentSet=t.documentSet,this.mutatedKeys=t.mutatedKeys;var i=t.changeSet.getChanges();i.sort(function(t,e){return ft(t.type,e.type)||n.query.docComparator(t.doc,e.doc)}),this.applyTargetChange(e);var o=this.updateLimboDocuments(),a=0===this.limboDocuments.size&&this.current,s=a?ar.Synced:ar.Local,u=s!==this.syncState;if(this.syncState=s,0!==i.length||u){return{snapshot:new cr(this.query,t.documentSet,r,i,s===ar.Local,!t.mutatedKeys.isEmpty(),u,!1),limboChanges:o}}return{limboChanges:o}},t.prototype.applyOnlineStateChange=function(t){return this.current&&t===nr.Offline?(this.current=!1,this.applyChanges({documentSet:this.documentSet,changeSet:new ur,mutatedKeys:this.mutatedKeys,needsRefill:!1})):{limboChanges:[]}},t.prototype.shouldBeInLimbo=function(t){return!this._syncedDocuments.has(t)&&(!!this.documentSet.has(t)&&!this.documentSet.get(t).hasLocalMutations)},t.prototype.applyTargetChange=function(t){if(t){var e=t.mapping;switch(e instanceof On?this._syncedDocuments=e.documents:e instanceof Dn&&(this._syncedDocuments=e.applyToKeySet(this._syncedDocuments)),t.currentStatusUpdate){case En.MarkCurrent:this.current=!0;break;case En.MarkNotCurrent:this.current=!1;break;case En.None:break;default:u("Unknown current status update: "+t.currentStatusUpdate)}}},t.prototype.updateLimboDocuments=function(){var t=this;if(!this.current)return[];var e=this.limboDocuments;this.limboDocuments=ot(),this.documentSet.forEach(function(e){t.shouldBeInLimbo(e.key)&&(t.limboDocuments=t.limboDocuments.add(e.key))});var n=[];return e.forEach(function(e){t.limboDocuments.has(e)||n.push(new Sr(e))}),this.limboDocuments.forEach(function(t){e.has(t)||n.push(new Tr(t))}),n},t}(),Ir=function(){function t(t,e,n,r){this.query=t,this.targetId=e,this.resumeToken=n,this.view=r}return t}(),Nr=function(){function t(t,e,n){this.localStore=t,this.remoteStore=e,this.currentUser=n,this.viewHandler=null,this.errorHandler=null,this.queryViewsByQuery=new hr(function(t){return t.canonicalId()}),this.queryViewsByTarget={},this.limboTargetsByKey=new Ce(Ee.comparator),this.limboKeysByTarget={},this.limboDocumentRefs=new vr,this.limboCollector=new mr,this.mutationUserCallbacks={},this.targetIdGenerator=Er.forSyncEngine()}return t.prototype.subscribe=function(t,e){c(null!==t&&null!==e,"View and error handlers cannot be null"),c(null===this.viewHandler&&null===this.errorHandler,"SyncEngine already has a subscriber."),this.viewHandler=t,this.errorHandler=e,this.limboCollector.addGarbageSource(this.limboDocumentRefs)},t.prototype.listen=function(t){var e=this;return this.assertSubscribed("listen()"),c(!this.queryViewsByQuery.has(t),"We already listen to the query: "+t),this.localStore.allocateQuery(t).then(function(n){return e.localStore.executeQuery(t).then(function(r){return e.localStore.remoteDocumentKeys(n.targetId).then(function(i){var o=new Cr(t,i),a=o.computeDocChanges(r),s=o.applyChanges(a);c(0===s.limboChanges.length,"View returned limbo docs before target ack from the server."),c(!!s.snapshot,"applyChanges for new view should always return a snapshot");var u=new Ir(t,n.targetId,n.resumeToken,o);e.queryViewsByQuery.set(t,u),e.queryViewsByTarget[n.targetId]=u,e.viewHandler([s.snapshot]),e.remoteStore.listen(n)})}).then(function(){return n.targetId})})},t.prototype.unlisten=function(t){var e=this;this.assertSubscribed("unlisten()");var n=this.queryViewsByQuery.get(t);return c(!!n,"Trying to unlisten on query not found:"+t),this.localStore.releaseQuery(t).then(function(){return e.remoteStore.unlisten(n.targetId),e.removeAndCleanupQuery(n).then(function(){return e.localStore.collectGarbage()})})},t.prototype.write=function(t,e){var n=this;return this.assertSubscribed("write()"),this.localStore.localWrite(t).then(function(t){return n.addMutationCallback(t.batchId,e),n.emitNewSnapsAndNotifyLocalStore(t.changes)}).then(function(){return n.remoteStore.fillWritePipeline()})},t.prototype.wrapUpdateFunctionError=function(t){return t},t.prototype.runTransaction=function(t,e){var n=this;void 0===e&&(e=5),c(e>=0,"Got negative number of retries for transaction.");var r=this.remoteStore.createTransaction();return function(){try{var e=t(r);return!z(e)&&e.catch&&e.then?e.catch(function(t){return Promise.reject(n.wrapUpdateFunctionError(t))}):Promise.reject(Error("Transaction callback must return a Promise"))}catch(t){return Promise.reject(n.wrapUpdateFunctionError(t))}}().then(function(i){return r.commit().then(function(){return i}).catch(function(r){return 0===e?Promise.reject(r):n.runTransaction(t,e-1)})})},t.prototype.applyRemoteEvent=function(t){var e=this;return this.assertSubscribed("applyRemoteEvent()"),d(t.targetChanges,function(n,r){var i=e.limboKeysByTarget[n];if(i)t.synthesizeDeleteForLimboTargetChange(r,i);else{var o=e.queryViewsByTarget[n];c(!!o,"Missing QueryView for non-limbo query: "+n),r.mapping.filterUpdates(o.view.syncedDocuments)}}),this.localStore.applyRemoteEvent(t).then(function(n){return e.emitNewSnapsAndNotifyLocalStore(n,t)})},t.prototype.applyOnlineStateChange=function(t){var e=[];this.queryViewsByQuery.forEach(function(n,r){var i=r.view.applyOnlineStateChange(t);c(0===i.limboChanges.length,"OnlineState should not affect limbo documents."),i.snapshot&&e.push(i.snapshot)}),this.viewHandler(e)},t.prototype.rejectListen=function(t,e){var n=this;this.assertSubscribed("rejectListens()");var r=this.limboKeysByTarget[t];if(r){this.limboTargetsByKey=this.limboTargetsByKey.remove(r),delete this.limboKeysByTarget[t];var i=new Ce(Ee.comparator);i=i.insert(r,new Se(r,un.forDeletedDoc()));var o=ot().add(r),a=new kn(un.MIN,{},i,o);return this.applyRemoteEvent(a)}var s=this.queryViewsByTarget[t];return c(!!s,"Unknown targetId: "+t),this.localStore.releaseQuery(s.query).then(function(){return n.removeAndCleanupQuery(s).then(function(){n.errorHandler(s.query,e)})})},t.prototype.applySuccessfulWrite=function(t){var e=this;return this.assertSubscribed("applySuccessfulWrite()"),this.processUserCallback(t.batch.batchId,null),this.localStore.acknowledgeBatch(t).then(function(t){return e.emitNewSnapsAndNotifyLocalStore(t)})},t.prototype.rejectFailedWrite=function(t,e){var n=this;return this.assertSubscribed("rejectFailedWrite()"),this.processUserCallback(t,e),this.localStore.rejectBatch(t).then(function(t){return n.emitNewSnapsAndNotifyLocalStore(t)})},t.prototype.addMutationCallback=function(t,e){var n=this.mutationUserCallbacks[this.currentUser.toKey()];n||(n=new Ce(B)),n=n.insert(t,e),this.mutationUserCallbacks[this.currentUser.toKey()]=n},t.prototype.processUserCallback=function(t,e){var n=this.mutationUserCallbacks[this.currentUser.toKey()];if(n){var r=n.get(t);r&&(c(t===n.minKey(),"Mutation callbacks processed out-of-order?"),e?r.reject(e):r.resolve(),n=n.remove(t)),this.mutationUserCallbacks[this.currentUser.toKey()]=n}},t.prototype.removeAndCleanupQuery=function(t){return this.queryViewsByQuery.delete(t.query),delete this.queryViewsByTarget[t.targetId],this.limboDocumentRefs.removeReferencesForId(t.targetId),this.gcLimboDocuments()},t.prototype.updateTrackedLimbos=function(t,e){for(var n=0,r=e;n<r.length;n++){var i=r[n];i instanceof Tr?(this.limboDocumentRefs.addReference(i.key,t),this.trackLimboChange(i)):i instanceof Sr?(o("SyncEngine","Document no longer in limbo: "+i.key),this.limboDocumentRefs.removeReference(i.key,t)):u("Unknown limbo change: "+JSON.stringify(i))}return this.gcLimboDocuments()},t.prototype.trackLimboChange=function(t){var e=t.key;if(!this.limboTargetsByKey.get(e)){o("SyncEngine","New document in limbo: "+e);var n=this.targetIdGenerator.next(),r=Je.atPath(e.path);this.limboKeysByTarget[n]=e,this.remoteStore.listen(new ln(r,n,Oe.Listen)),this.limboTargetsByKey=this.limboTargetsByKey.insert(e,n)}},t.prototype.gcLimboDocuments=function(){var t=this;return this.limboCollector.collectGarbage(null).next(function(e){e.forEach(function(e){var n=t.limboTargetsByKey.get(e);null!==n&&(t.remoteStore.unlisten(n),t.limboTargetsByKey=t.limboTargetsByKey.remove(e),delete t.limboKeysByTarget[n])})}).toPromise()},t.prototype.currentLimboDocs=function(){return this.limboTargetsByKey},t.prototype.emitNewSnapsAndNotifyLocalStore=function(t,e){var n=this,r=[],i=[],o=[];return this.queryViewsByQuery.forEach(function(a,s){o.push(Promise.resolve().then(function(){var e=s.view.computeDocChanges(t);return e.needsRefill?n.localStore.executeQuery(s.query).then(function(t){return s.view.computeDocChanges(t,e)}):e}).then(function(t){var o=e&&e.targetChanges[s.targetId],a=s.view.applyChanges(t,o);return n.updateTrackedLimbos(s.targetId,a.limboChanges).then(function(){if(a.snapshot){r.push(a.snapshot);var t=gr.fromSnapshot(a.snapshot);i.push(t)}})}))}),Promise.all(o).then(function(){return n.viewHandler(r),n.localStore.notifyLocalViewChanges(i)}).then(function(){return n.localStore.collectGarbage()})},t.prototype.assertSubscribed=function(t){c(null!==this.viewHandler&&null!==this.errorHandler,"Trying to call "+t+" before calling subscribe().")},t.prototype.handleUserChange=function(t){var e=this;return this.currentUser=t,this.localStore.handleUserChange(t).then(function(t){return e.emitNewSnapsAndNotifyLocalStore(t)}).then(function(){return e.remoteStore.handleUserChange(t)})},t}(),kr=-1,Ar=function(){function t(t,e,n){this.batchId=t,this.localWriteTime=e,this.mutations=n}return t.prototype.applyToRemoteDocument=function(t,e,n){e&&c(e.key.isEqual(t),"applyToRemoteDocument: key "+t+" should match maybeDoc key\n "+e.key);var r=n.mutationResults;c(r.length===this.mutations.length,"Mismatch between mutations length\n ("+this.mutations.length+") and mutation results length\n ("+r.length+").");for(var i=0;i<this.mutations.length;i++){var o=this.mutations[i];if(o.key.isEqual(t)){var a=r[i];e=o.applyToRemoteDocument(e,a)}}return e},t.prototype.applyToLocalView=function(t,e){e&&c(e.key.isEqual(t),"applyToLocalDocument: key "+t+" should match maybeDoc key\n "+e.key);for(var n=e,r=0;r<this.mutations.length;r++){var i=this.mutations[r];i.key.isEqual(t)&&(e=i.applyToLocalView(e,n,this.localWriteTime))}return e},t.prototype.keys=function(){for(var t=ot(),e=0,n=this.mutations;e<n.length;e++){var r=n[e];t=t.add(r.key)}return t},t.prototype.isEqual=function(t){return this.batchId===t.batchId&&j(this.mutations,t.mutations)},t.prototype.isTombstone=function(){return 0===this.mutations.length},t.prototype.toTombstone=function(){return new t(this.batchId,this.localWriteTime,[])},t}(),Rr=function(){function t(t,e,n,r,i){this.batch=t,this.commitVersion=e,this.mutationResults=n,this.streamToken=r,this.docVersions=i}return t.from=function(e,n,r,i){c(e.mutations.length===r.length,"Mutations sent "+e.mutations.length+" must equal results received "+r.length);for(var o=it(),a=e.mutations,s=0;s<a.length;s++){var u=r[s].version;null===u&&(u=n),o=o.insert(a[s].key,u)}return new t(e,n,r,i,o)},t}(),Or="\x01",Dr="\x01",Pr="\x10",xr="\x11",Lr=function(){function t(t,e){this.seconds=t,this.nanoseconds=e}return t}(),Mr=function(){function t(t,e){this.ownerId=t,this.leaseTimestampMs=e}return t.store="owner",t}(),Fr=function(){function t(t,e,n){this.userId=t,this.lastAcknowledgedBatchId=e,this.lastStreamToken=n}return t.store="mutationQueues",t.keyPath="userId",t}(),Ur=function(){function t(t,e,n,r){this.userId=t,this.batchId=e,this.localWriteTimeMs=n,this.mutations=r}return t.store="mutations",t.keyPath=["userId","batchId"],t}(),Br=function(){function t(){}return t.prefixForUser=function(t){return[t]},t.prefixForPath=function(t,e){return[t,pt(e)]},t.key=function(t,e,n){return[t,pt(e),n]},t.store="documentMutations",t.PLACEHOLDER=new t,t}(),Vr=function(){function t(t,e){this.path=t,this.readTime=e}return t}(),jr=function(){function t(t,e){this.noDocument=t,this.document=e}return t.store="remoteDocuments",t}(),qr=function(){function t(t,e,n,r,i,o){this.targetId=t,this.canonicalId=e,this.readTime=n,this.resumeToken=r,this.lastListenSequenceNumber=i,this.query=o}return t.store="targets",t.keyPath="targetId",t.queryTargetsIndexName="queryTargetsIndex",t.queryTargetsKeyPath=["canonicalId","targetId"],t}(),Wr=function(){function t(t,e){this.targetId=t,this.path=e}return t.store="targetDocuments",t.keyPath=["targetId","path"],t.documentTargetsIndex="documentTargetsIndex",t.documentTargetsKeyPath=["path","targetId"],t}(),Kr=function(){function t(t,e,n,r){this.highestTargetId=t,this.highestListenSequenceNumber=e,this.lastRemoteSnapshotVersion=n,this.targetCount=r}return t.key="targetGlobalKey",t.store="targetGlobal",t}(),Hr=[Fr.store,Ur.store,Br.store,jr.store,qr.store,Mr.store,Kr.store,Wr.store],Gr=function(){function t(){var t=this;this.promise=new Promise(function(e,n){t.resolve=e,t.reject=n})}return t}(),Qr=function(){function t(t){this.db=t}return t.openOrCreate=function(e,n,r){return c(t.isAvailable(),"IndexedDB not supported in current environment."),o("SimpleDb","Opening database:",e),new yr(function(i,a){var s=window.indexedDB.open(e,n);s.onsuccess=function(e){var n=e.target.result;i(new t(n))},s.onerror=function(t){a(t.target.error)},s.onupgradeneeded=function(t){o("SimpleDb",'Database "'+e+'" requires upgrade from version:',t.oldVersion);var n=t.target.result,i=new Yr(s.transaction);r(n,i,t.oldVersion,2).next(function(){o("SimpleDb","Database upgrade to version 2 complete")})}}).toPromise()},t.delete=function(t){return o("SimpleDb","Removing database:",t),St(window.indexedDB.deleteDatabase(t)).toPromise()},t.isAvailable=function(){if("undefined"===typeof window||null==window.indexedDB)return!1;if(void 0===window.navigator)return"YES"===Object({NODE_ENV:"production",PUBLIC_URL:"/push-notification-demo"}).USE_MOCK_PERSISTENCE;var t=window.navigator.userAgent;return!(t.indexOf("MSIE ")>0||t.indexOf("Trident/")>0||t.indexOf("Edge/")>0)},t.prototype.runTransaction=function(t,e,n){var r=Yr.open(this.db,t,e),i=n(r).catch(function(t){r.abort(t)}).toPromise();return r.completionPromise.then(function(){return i})},t.prototype.close=function(){this.db.close()},t}(),zr=function(){function t(t){this.dbCursor=t,this.shouldStop=!1,this.nextKey=null}return Object.defineProperty(t.prototype,"isDone",{get:function(){return this.shouldStop},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"skipToKey",{get:function(){return this.nextKey},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"cursor",{set:function(t){this.dbCursor=t},enumerable:!0,configurable:!0}),t.prototype.done=function(){this.shouldStop=!0},t.prototype.skip=function(t){this.nextKey=t},t.prototype.delete=function(){return St(this.dbCursor.delete())},t}(),Yr=function(){function t(t){var e=this;this.transaction=t,this.aborted=!1,this.completionDeferred=new Gr,this.transaction.oncomplete=function(){e.completionDeferred.resolve()},this.transaction.onabort=function(){t.error?e.completionDeferred.reject(t.error):e.completionDeferred.resolve()},this.transaction.onerror=function(t){e.completionDeferred.reject(t.target.error)}}return t.open=function(e,n,r){return new t(e.transaction(r,n))},Object.defineProperty(t.prototype,"completionPromise",{get:function(){return this.completionDeferred.promise},enumerable:!0,configurable:!0}),t.prototype.abort=function(t){t&&this.completionDeferred.reject(t),this.aborted||(o("SimpleDb","Aborting transaction: %s",t?t.message:"Client-initiated abort"),this.aborted=!0,this.transaction.abort())},t.prototype.store=function(t){var e=this.transaction.objectStore(t);return c(!!e,"Object store not part of transaction: "+t),new Xr(e)},t}(),Xr=function(){function t(t){this.store=t}return t.prototype.put=function(t,e){var n;return void 0!==e?(o("SimpleDb","PUT",this.store.name,t,e),n=this.store.put(e,t)):(o("SimpleDb","PUT",this.store.name,"<auto-key>",t),n=this.store.put(t)),St(n)},t.prototype.get=function(t){var e=this;return St(this.store.get(t)).next(function(n){return void 0===n&&(n=null),o("SimpleDb","GET",e.store.name,t,n),n})},t.prototype.delete=function(t){return o("SimpleDb","DELETE",this.store.name,t),St(this.store.delete(t))},t.prototype.count=function(){return o("SimpleDb","COUNT",this.store.name),St(this.store.count())},t.prototype.loadAll=function(t,e){var n=this.cursor(this.options(t,e)),r=[];return this.iterateCursor(n,function(t,e){r.push(e)}).next(function(){return r})},t.prototype.deleteAll=function(t,e){o("SimpleDb","DELETE ALL",this.store.name);var n=this.options(t,e);n.keysOnly=!1;var r=this.cursor(n);return this.iterateCursor(r,function(t,e,n){return n.delete()})},t.prototype.iterate=function(t,e){var n;e?n=t:(n={},e=t);var r=this.cursor(n);return this.iterateCursor(r,e)},t.prototype.iterateCursor=function(t,e){var n=[];return new yr(function(r,i){t.onerror=function(t){i(t.target.error)},t.onsuccess=function(t){var i=t.target.result;if(!i)return void r();var o=new zr(i),a=e(i.primaryKey,i.value,o);a instanceof yr&&n.push(a),o.isDone?r():null===o.skipToKey?i.continue():i.continue(o.skipToKey)}}).next(function(){return yr.waitFor(n)})},t.prototype.options=function(t,e){var n=void 0;return void 0!==t&&("string"===typeof t?n=t:(c(void 0===e,"3rd argument must not be defined if 2nd is a range."),e=t)),{index:n,range:e}},t.prototype.cursor=function(t){var e="next";if(t.reverse&&(e="prev"),t.index){var n=this.store.index(t.index);return t.keysOnly?n.openKeyCursor(t.range,e):n.openCursor(t.range,e)}return this.store.openCursor(t.range,e)},t}(),Jr=function(){function t(t,e){this.userId=t,this.serializer=e,this.garbageCollector=null}return t.forUser=function(e,n){return c(""!==e.uid,"UserID must not be an empty string."),new t(e.isAuthenticated()?e.uid:"",n)},t.prototype.start=function(e){var n=this;return t.loadNextBatchIdFromDb(e).next(function(t){return n.nextBatchId=t,kt(e).get(n.userId)}).next(function(t){return t||(t=new Fr(n.userId,kr,"")),n.metadata=t,n.metadata.lastAcknowledgedBatchId>=n.nextBatchId?n.checkEmpty(e).next(function(t){return c(t,"Reset nextBatchID is only possible when the queue is empty"),n.metadata.lastAcknowledgedBatchId=kr,kt(e).put(n.metadata)}):yr.resolve()})},t.loadNextBatchIdFromDb=function(t){var e=kr;return It(t).iterate({reverse:!0},function(t,n,r){var i=t[0];if(t[1]>e&&(e=n.batchId),""===i)r.done();else{var o=q(i);r.skip([o])}}).next(function(){return e+1})},t.prototype.checkEmpty=function(t){var e=!0,n=IDBKeyRange.bound(this.keyForBatchId(Number.NEGATIVE_INFINITY),this.keyForBatchId(Number.POSITIVE_INFINITY));return It(t).iterate({range:n},function(t,n,r){e=!1,r.done()}).next(function(){return e})},t.prototype.getNextBatchId=function(t){return yr.resolve(this.nextBatchId)},t.prototype.getHighestAcknowledgedBatchId=function(t){return yr.resolve(this.metadata.lastAcknowledgedBatchId)},t.prototype.acknowledgeBatch=function(t,e,n){var r=e.batchId;return c(r>this.metadata.lastAcknowledgedBatchId,"Mutation batchIDs must be acknowledged in order"),this.metadata.lastAcknowledgedBatchId=r,this.metadata.lastStreamToken=Ct(n),kt(t).put(this.metadata)},t.prototype.getLastStreamToken=function(t){return yr.resolve(this.metadata.lastStreamToken)},t.prototype.setLastStreamToken=function(t,e){return this.metadata.lastStreamToken=Ct(e),kt(t).put(this.metadata)},t.prototype.addMutationBatch=function(t,e,n){var r=this,i=this.nextBatchId;this.nextBatchId++;var o=new Ar(i,e,n),a=this.serializer.toDbMutationBatch(this.userId,o);return It(t).put(a).next(function(){for(var e=[],o=0,a=n;o<a.length;o++){var s=a[o],u=Br.key(r.userId,s.key.path,i);e.push(Nt(t).put(u,Br.PLACEHOLDER))}return yr.waitFor(e)}).next(function(){return o})},t.prototype.lookupMutationBatch=function(t,e){var n=this;return It(t).get(this.keyForBatchId(e)).next(function(t){return t?n.serializer.fromDbMutationBatch(t):null})},t.prototype.getNextMutationBatchAfterBatchId=function(t,e){var n=this,r=Math.max(e,this.metadata.lastAcknowledgedBatchId)+1,i=IDBKeyRange.lowerBound(this.keyForBatchId(r)),o=null;return It(t).iterate({range:i},function(t,e,i){e.userId===n.userId&&(c(e.batchId>=r,"Should have found mutation after "+r),o=n.serializer.fromDbMutationBatch(e)),i.done()}).next(function(){return o})},t.prototype.getAllMutationBatches=function(t){var e=this,n=IDBKeyRange.bound(this.keyForBatchId(kr),this.keyForBatchId(Number.POSITIVE_INFINITY));return It(t).loadAll(n).next(function(t){return t.map(function(t){return e.serializer.fromDbMutationBatch(t)})})},t.prototype.getAllMutationBatchesThroughBatchId=function(t,e){var n=this,r=IDBKeyRange.bound(this.keyForBatchId(kr),this.keyForBatchId(e));return It(t).loadAll(r).next(function(t){return t.map(function(t){return n.serializer.fromDbMutationBatch(t)})})},t.prototype.getAllMutationBatchesAffectingDocumentKey=function(t,e){var n=this,r=Br.prefixForPath(this.userId,e.path),i=IDBKeyRange.lowerBound(r),o=[];return Nt(t).iterate({range:i},function(r,i,a){var s=r[0],c=r[1],l=r[2],h=mt(c);if(s!==n.userId||!e.path.isEqual(h))return void a.done();var f=n.keyForBatchId(l);return It(t).get(f).next(function(t){null===t&&u("Dangling document-mutation reference found: "+r+" which points to "+f),o.push(n.serializer.fromDbMutationBatch(t))})}).next(function(){return o})},t.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var n=this;c(!e.isDocumentQuery(),"Document queries shouldn't go down this path");var r=e.path,i=r.length+1,o=Br.prefixForPath(this.userId,r),a=IDBKeyRange.lowerBound(o),s=new Tn(B);return Nt(t).iterate({range:a},function(t,e,o){var a=t[0],u=t[1],c=t[2],l=mt(u);if(a!==n.userId||!r.isPrefixOf(l))return void o.done();l.length===i&&(s=s.add(c))}).next(function(){var e=[],r=[];return s.forEach(function(i){var o=n.keyForBatchId(i);r.push(It(t).get(o).next(function(t){null===t&&u("Dangling document-mutation reference found, which points to "+o),e.push(n.serializer.fromDbMutationBatch(t))}))}),yr.waitFor(r).next(function(){return e})})},t.prototype.removeMutationBatches=function(t,e){for(var n=It(t),r=Nt(t),i=[],o=this,a=0,s=e;a<s.length;a++){var u=s[a];!function(t){var e=IDBKeyRange.only(o.keyForBatchId(t.batchId)),a=0,s=n.iterate({range:e},function(t,e,n){return a++,n.delete()});i.push(s.next(function(){c(1===a,"Dangling document-mutation reference found: Missing batch "+t.batchId)}));for(var u=0,l=t.mutations;u<l.length;u++){var h=l[u],f=Br.key(o.userId,h.key.path,t.batchId);i.push(r.delete(f)),null!==o.garbageCollector&&o.garbageCollector.addPotentialGarbageKey(h.key)}}(u)}return yr.waitFor(i)},t.prototype.performConsistencyCheck=function(t){var e=this;return this.checkEmpty(t).next(function(n){if(!n)return yr.resolve();var r=IDBKeyRange.lowerBound(Br.prefixForUser(e.userId)),i=[];return Nt(t).iterate({range:r},function(t,n,r){if(t[0]!==e.userId)return void r.done();var o=mt(t[1]);i.push(o)}).next(function(){c(0===i.length,"Document leak -- detected dangling mutation references when queue is empty. Dangling keys: "+i.map(function(t){return t.canonicalString()}))})})},t.prototype.setGarbageCollector=function(t){this.garbageCollector=t},t.prototype.containsKey=function(t,e){var n=this,r=Br.prefixForPath(this.userId,e.path),i=r[1],o=IDBKeyRange.lowerBound(r),a=!1;return Nt(t).iterate({range:o,keysOnly:!0},function(t,e,r){var o=t[0],s=t[1];t[2];o===n.userId&&s===i&&(a=!0),r.done()}).next(function(){return a})},t.prototype.keyForBatchId=function(t){return[this.userId,t]},t}(),$r=function(){function t(t){this.serializer=t,this.lastRemoteSnapshotVersion=un.MIN,this.metadata=null,this.garbageCollector=null}return t.prototype.start=function(t){var e=this;return Ot(t).get(Kr.key).next(function(t){c(null!==t,"Missing metadata row that should be added by schema migration."),e.metadata=t;var n=t.lastRemoteSnapshotVersion;return e.lastRemoteSnapshotVersion=un.fromTimestamp(new de(n.seconds,n.nanoseconds)),yr.resolve()})},t.prototype.getHighestTargetId=function(){return this.metadata.highestTargetId},t.prototype.getLastRemoteSnapshotVersion=function(){return this.lastRemoteSnapshotVersion},t.prototype.setLastRemoteSnapshotVersion=function(t,e){return this.lastRemoteSnapshotVersion=e,this.metadata.lastRemoteSnapshotVersion=e.toTimestamp(),Ot(t).put(Kr.key,this.metadata)},t.prototype.addQueryData=function(t,e){var n=this;return this.saveQueryData(t,e).next(function(){return n.metadata.targetCount+=1,n.updateMetadataFromQueryData(e),n.saveMetadata(t)})},t.prototype.updateQueryData=function(t,e){var n=this;return this.saveQueryData(t,e).next(function(){return n.updateMetadataFromQueryData(e)?n.saveMetadata(t):yr.resolve()})},t.prototype.removeQueryData=function(t,e){var n=this;return c(this.metadata.targetCount>0,"Removing from an empty query cache"),this.removeMatchingKeysForTargetId(t,e.targetId).next(function(){return Rt(t).delete(e.targetId)}).next(function(){return n.metadata.targetCount-=1,n.saveMetadata(t)})},t.prototype.saveMetadata=function(t){return Ot(t).put(Kr.key,this.metadata)},t.prototype.saveQueryData=function(t,e){return Rt(t).put(this.serializer.toDbTarget(e))},t.prototype.updateMetadataFromQueryData=function(t){var e=!1;return t.targetId>this.metadata.highestTargetId&&(this.metadata.highestTargetId=t.targetId,e=!0),e},Object.defineProperty(t.prototype,"count",{get:function(){return this.metadata.targetCount},enumerable:!0,configurable:!0}),t.prototype.getQueryData=function(t,e){var n=this,r=e.canonicalId(),i=IDBKeyRange.bound([r,Number.NEGATIVE_INFINITY],[r,Number.POSITIVE_INFINITY]),o=null;return Rt(t).iterate({range:i,index:qr.queryTargetsIndexName},function(t,r,i){var a=n.serializer.fromDbTarget(r);e.isEqual(a.query)&&(o=a,i.done())}).next(function(){return o})},t.prototype.addMatchingKeys=function(t,e,n){var r=[],i=Dt(t);return e.forEach(function(t){var e=pt(t.path);r.push(i.put(new Wr(n,e)))}),yr.waitFor(r)},t.prototype.removeMatchingKeys=function(t,e,n){var r=this,i=[],o=Dt(t);return e.forEach(function(t){var e=pt(t.path);i.push(o.delete([n,e])),null!==r.garbageCollector&&r.garbageCollector.addPotentialGarbageKey(t)}),yr.waitFor(i)},t.prototype.removeMatchingKeysForTargetId=function(t,e){var n=Dt(t),r=IDBKeyRange.bound([e],[e+1],!1,!0);return this.notifyGCForRemovedKeys(t,r).next(function(){return n.delete(r)})},t.prototype.notifyGCForRemovedKeys=function(t,e){var n=this,r=Dt(t);return null!==this.garbageCollector&&this.garbageCollector.isEager?r.iterate({range:e,keysOnly:!0},function(t,e,r){var i=mt(t[1]),o=new Ee(i);c(null!==n.garbageCollector,"GarbageCollector for query cache set to null during key removal."),n.garbageCollector.addPotentialGarbageKey(o)}):yr.resolve()},t.prototype.getMatchingKeysForTargetId=function(t,e){var n=IDBKeyRange.bound([e],[e+1],!1,!0),r=Dt(t),i=ot();return r.iterate({range:n,keysOnly:!0},function(t,e,n){var r=mt(t[1]),o=new Ee(r);i=i.add(o)}).next(function(){return i})},t.prototype.setGarbageCollector=function(t){this.garbageCollector=t},t.prototype.containsKey=function(t,e){c(null!==t,"Persistence Transaction cannot be null for query cache containsKey");var n=pt(e.path),r=IDBKeyRange.bound([n],[W(n)],!1,!0),i=0;return Dt(t).iterate({index:Wr.documentTargetsIndex,keysOnly:!0,range:r},function(t,e,n){i++,n.done()}).next(function(){return i>0})},t}(),Zr=function(){function t(t){this.serializer=t}return t.prototype.addEntry=function(t,e){return xt(t).put(Lt(e.key),this.serializer.toDbRemoteDocument(e))},t.prototype.removeEntry=function(t,e){return xt(t).delete(Lt(e))},t.prototype.getEntry=function(t,e){var n=this;return xt(t).get(Lt(e)).next(function(t){return t?n.serializer.fromDbRemoteDocument(t):null})},t.prototype.getDocumentsMatchingQuery=function(t,e){var n=this,r=rt(),i=e.path.toArray(),o=IDBKeyRange.lowerBound(i);return xt(t).iterate({range:o},function(t,i,o){var a=n.serializer.fromDbRemoteDocument(i);e.path.isPrefixOf(a.key.path)?a instanceof Te&&e.matches(a)&&(r=r.insert(a.key,a)):o.done()}).next(function(){return r})},t}(),ti=function(){function t(t){this.remoteSerializer=t}return t.prototype.fromDbRemoteDocument=function(t){if(t.document)return this.remoteSerializer.fromDocument(t.document);if(t.noDocument){var e=Ee.fromSegments(t.noDocument.path),n=t.noDocument.readTime,r=new de(n.seconds,n.nanoseconds);return new Se(e,un.fromTimestamp(r))}return u("Unexpected DbRemoteDocument")},t.prototype.toDbRemoteDocument=function(t){if(t instanceof Te){var e=this.remoteSerializer.toDocument(t);return new jr(null,e)}var n=t.key.path.toArray(),r=t.version.toTimestamp(),i=new Lr(r.seconds,r.nanoseconds);return new jr(new Vr(n,i),null)},t.prototype.toDbMutationBatch=function(t,e){var n=this,r=e.mutations.map(function(t){return n.remoteSerializer.toMutation(t)});return new Ur(t,e.batchId,e.localWriteTime.toMillis(),r)},t.prototype.fromDbMutationBatch=function(t){var e=this,n=t.mutations.map(function(t){return e.remoteSerializer.fromMutation(t)}),r=de.fromMillis(t.localWriteTimeMs);return new Ar(t.batchId,r,n)},t.prototype.fromDbTarget=function(t){var e,n=new de(t.readTime.seconds,t.readTime.nanoseconds),r=un.fromTimestamp(n);return e=Mt(t.query)?this.remoteSerializer.fromDocumentsTarget(t.query):this.remoteSerializer.fromQueryTarget(t.query),new ln(e,t.targetId,Oe.Listen,r,t.resumeToken)},t.prototype.toDbTarget=function(t){c(Oe.Listen===t.purpose,"Only queries with purpose "+Oe.Listen+" may be stored, got "+t.purpose);var e,n=t.snapshotVersion.toTimestamp(),r=new Lr(n.seconds,n.nanoseconds);e=t.query.isDocumentQuery()?this.remoteSerializer.toDocumentsTarget(t.query):this.remoteSerializer.toQueryTarget(t.query);var i;return t.resumeToken instanceof Uint8Array?(c("YES"===Object({NODE_ENV:"production",PUBLIC_URL:"/push-notification-demo"}).USE_MOCK_PERSISTENCE,"Persisting non-string stream tokens is only supported with mock persistence ."),i=t.resumeToken.toString()):i=t.resumeToken,new qr(t.targetId,t.query.canonicalId(),r,i,0,e)},t}(),ei="IndexedDbPersistence",ni="There is another tab open with offline persistence enabled. Only one such tab is allowed at a time. The other tab must be closed or persistence must be disabled.",ri=function(){function t(e,n){this.ownerId=this.generateOwnerId(),this.dbName=e+t.MAIN_DATABASE,this.serializer=new ti(n),this.localStoragePrefix=e}return t.prototype.start=function(){var e=this;return t.isAvailable()?(c(!this.started,"IndexedDbPersistence double-started!"),this.started=!0,Qr.openOrCreate(this.dbName,2,gt).then(function(t){e.simpleDb=t}).then(function(){return e.tryAcquireOwnerLease()}).then(function(){e.scheduleOwnerLeaseRefreshes(),e.attachWindowUnloadHook()})):(this.persistenceError=new ce(ue.UNIMPLEMENTED,"This platform is either missing IndexedDB or is known to have an incomplete implementation. Offline persistence has been disabled."),Promise.reject(this.persistenceError))},t.prototype.shutdown=function(t){var e=this;return c(this.started,"IndexedDbPersistence shutdown without start!"),this.started=!1,this.detachWindowUnloadHook(),this.stopOwnerLeaseRefreshes(),this.releaseOwnerLease().then(function(){if(e.simpleDb.close(),t)return Qr.delete(e.dbName)})},t.prototype.getMutationQueue=function(t){return Jr.forUser(t,this.serializer)},t.prototype.getQueryCache=function(){return new $r(this.serializer)},t.prototype.getRemoteDocumentCache=function(){return new Zr(this.serializer)},t.prototype.runTransaction=function(t,e){var n=this;return this.persistenceError?Promise.reject(this.persistenceError):(o(ei,"Starting transaction:",t),this.simpleDb.runTransaction("readwrite",Hr,function(t){return n.ensureOwnerLease(t).next(function(){return e(t)})}))},t.isAvailable=function(){return Qr.isAvailable()},t.buildStoragePrefix=function(t){var e=t.databaseId.projectId;return t.databaseId.isDefaultDatabase||(e+="."+t.databaseId.database),"firestore/"+t.persistenceKey+"/"+e+"/"},t.prototype.tryAcquireOwnerLease=function(){var t=this;return this.simpleDb.runTransaction("readwrite",[Mr.store],function(e){var n=e.store(Mr.store);return n.get("owner").next(function(e){if(t.validOwner(e))return o(ei,"Valid owner already. Failing. Current owner:",e),t.persistenceError=new ce(ue.FAILED_PRECONDITION,ni),yr.reject(t.persistenceError);var r=new Mr(t.ownerId,Date.now());return o(ei,"No valid owner. Acquiring owner lease. Current owner:",e,"New owner:",r),n.put("owner",r)})})},t.prototype.releaseOwnerLease=function(){var t=this;return this.simpleDb.runTransaction("readwrite",[Mr.store],function(e){var n=e.store(Mr.store);return n.get("owner").next(function(e){return null!==e&&e.ownerId===t.ownerId?(o(ei,"Releasing owner lease."),n.delete("owner")):yr.resolve()})})},t.prototype.ensureOwnerLease=function(t){var e=this;return t.store(Mr.store).get("owner").next(function(t){return null===t||t.ownerId!==e.ownerId?(e.persistenceError=new ce(ue.FAILED_PRECONDITION,ni),yr.reject(e.persistenceError)):yr.resolve()})},t.prototype.validOwner=function(t){var e=Date.now(),n=e-5e3,r=e;return null!==t&&(!(t.leaseTimestampMs<n)&&(t.leaseTimestampMs>r?(a("Persistence owner-lease is in the future. Discarding.",t),!1):t.ownerId!==this.getZombiedOwnerId()))},t.prototype.scheduleOwnerLeaseRefreshes=function(){var t=this;this.ownerLeaseRefreshHandle=setInterval(function(){t.runTransaction("Refresh owner timestamp",function(e){return e.store(Mr.store).put("owner",new Mr(t.ownerId,Date.now()))}).catch(function(e){a(e),t.stopOwnerLeaseRefreshes()})},4e3)},t.prototype.stopOwnerLeaseRefreshes=function(){this.ownerLeaseRefreshHandle&&(clearInterval(this.ownerLeaseRefreshHandle),this.ownerLeaseRefreshHandle=null)},t.prototype.attachWindowUnloadHook=function(){var t=this;"object"===typeof window&&"function"===typeof window.addEventListener&&(this.windowUnloadHandler=function(){t.setZombiedOwnerId(t.ownerId),t.shutdown()},window.addEventListener("unload",this.windowUnloadHandler))},t.prototype.detachWindowUnloadHook=function(){this.windowUnloadHandler&&(c("object"===typeof window&&"function"===typeof window.removeEventListener,"Expected 'window.removeEventListener' to be a function"),window.removeEventListener("unload",this.windowUnloadHandler),this.windowUnloadHandler=null)},t.prototype.getZombiedOwnerId=function(){try{var t=window.localStorage.getItem(this.zombiedOwnerLocalStorageKey());return o(ei,"Zombied ownerID from LocalStorage:",t),t}catch(t){return a("Failed to get zombie owner id.",t),null}},t.prototype.setZombiedOwnerId=function(t){try{null===t?window.localStorage.removeItem(this.zombiedOwnerLocalStorageKey()):window.localStorage.setItem(this.zombiedOwnerLocalStorageKey(),t)}catch(t){a("Failed to set zombie owner id.",t)}},t.prototype.zombiedOwnerLocalStorageKey=function(){return this.localStoragePrefix+"zombiedOwnerId"},t.prototype.generateOwnerId=function(){return le.newId()},t.MAIN_DATABASE="main",t}(),ii=function(){function t(t,e){this.remoteDocumentCache=t,this.mutationQueue=e}return t.prototype.getDocument=function(t,e){var n=this;return this.remoteDocumentCache.getEntry(t,e).next(function(r){return n.computeLocalDocument(t,e,r)})},t.prototype.getDocuments=function(t,e){var n=this,r=[],i=nt();return e.forEach(function(e){r.push(n.getDocument(t,e).next(function(t){t||(t=new Se(e,un.forDeletedDoc())),i=i.insert(e,t)}))}),yr.waitFor(r).next(function(){return i})},t.prototype.getDocumentsMatchingQuery=function(t,e){return Ee.isDocumentKey(e.path)?this.getDocumentsMatchingDocumentQuery(t,e.path):this.getDocumentsMatchingCollectionQuery(t,e)},t.prototype.getDocumentsMatchingDocumentQuery=function(t,e){return this.getDocument(t,new Ee(e)).next(function(t){var e=rt();return t instanceof Te&&(e=e.insert(t.key,t)),e})},t.prototype.getDocumentsMatchingCollectionQuery=function(t,e){var n,r=this;return this.remoteDocumentCache.getDocumentsMatchingQuery(t,e).next(function(e){return r.computeLocalDocuments(t,e)}).next(function(i){return n=i,r.mutationQueue.getAllMutationBatchesAffectingQuery(t,e)}).next(function(e){for(var i=ot(),o=0,a=e;o<a.length;o++)for(var s=a[o],u=0,c=s.mutations;u<c.length;u++){var l=c[u];n.get(l.key)||(i=i.add(l.key))}var h=[];return i.forEach(function(e){h.push(r.getDocument(t,e).next(function(t){t instanceof Te&&(n=n.insert(t.key,t))}))}),yr.waitFor(h)}).next(function(){return n.forEach(function(t,r){e.matches(r)||(n=n.remove(t))}),n})},t.prototype.computeLocalDocument=function(t,e,n){return this.mutationQueue.getAllMutationBatchesAffectingDocumentKey(t,e).next(function(t){for(var r=0,i=t;r<i.length;r++){var o=i[r];n=o.applyToLocalView(e,n)}return n})},t.prototype.computeLocalDocuments=function(t,e){var n=this,r=[];return e.forEach(function(i,o){r.push(n.computeLocalDocument(t,i,o).next(function(t){t instanceof Te?e=e.insert(t.key,t):t instanceof Se?e=e.remove(t.key):u("Unknown MaybeDocument: "+t)}))}),yr.waitFor(r).next(function(){return e})},t}(),oi=function(){function t(t){this.remoteDocumentCache=t,this.changes=nt()}return t.prototype.addEntry=function(t){var e=this.assertChanges();this.changes=e.insert(t.key,t)},t.prototype.getEntry=function(t,e){var n=this.assertChanges(),r=n.get(e);return r?yr.resolve(r):this.remoteDocumentCache.getEntry(t,e)},t.prototype.apply=function(t){var e=this,n=this.assertChanges(),r=[];return n.forEach(function(n,i){r.push(e.remoteDocumentCache.addEntry(t,i))}),this.changes=null,yr.waitFor(r)},t.prototype.assertChanges=function(){return c(null!==this.changes,"Changes have already been applied."),this.changes},t}(),ai=function(){function t(t,e,n){this.persistence=t,this.garbageCollector=n,this.localViewReferences=new vr,this.targetIds={},this.targetIdGenerator=Er.forLocalStore(),this.heldBatchResults=[],this.mutationQueue=t.getMutationQueue(e),this.remoteDocuments=t.getRemoteDocumentCache(),this.queryCache=t.getQueryCache(),this.localDocuments=new ii(this.remoteDocuments,this.mutationQueue),this.garbageCollector.addGarbageSource(this.localViewReferences),this.garbageCollector.addGarbageSource(this.queryCache),this.garbageCollector.addGarbageSource(this.mutationQueue)}return t.prototype.start=function(){var t=this;return this.persistence.runTransaction("Start LocalStore",function(e){return t.startMutationQueue(e).next(function(){return t.startQueryCache(e)})})},t.prototype.handleUserChange=function(t){var e=this;return this.persistence.runTransaction("Handle user change",function(n){var r;return e.mutationQueue.getAllMutationBatches(n).next(function(i){return r=i,e.garbageCollector.removeGarbageSource(e.mutationQueue),e.mutationQueue=e.persistence.getMutationQueue(t),e.garbageCollector.addGarbageSource(e.mutationQueue),e.startMutationQueue(n)}).next(function(){return e.localDocuments=new ii(e.remoteDocuments,e.mutationQueue),e.mutationQueue.getAllMutationBatches(n)}).next(function(t){for(var i=ot(),o=0,a=[r,t];o<a.length;o++)for(var s=a[o],u=0,c=s;u<c.length;u++)for(var l=c[u],h=0,f=l.mutations;h<f.length;h++){var p=f[h];i=i.add(p.key)}return e.localDocuments.getDocuments(n,i)})})},t.prototype.startQueryCache=function(t){var e=this;return this.queryCache.start(t).next(function(){var t=e.queryCache.getHighestTargetId();e.targetIdGenerator=Er.forLocalStore(t)})},t.prototype.startMutationQueue=function(t){var e=this;return this.mutationQueue.start(t).next(function(){return e.heldBatchResults=[],e.mutationQueue.getHighestAcknowledgedBatchId(t)}).next(function(n){return n!==kr?e.mutationQueue.getAllMutationBatchesThroughBatchId(t,n):yr.resolve([])}).next(function(n){return n.length>0?e.mutationQueue.removeMutationBatches(t,n):yr.resolve()})},t.prototype.localWrite=function(t){var e=this;return this.persistence.runTransaction("Locally write mutations",function(n){var r,i=de.now();return e.mutationQueue.addMutationBatch(n,i,t).next(function(t){r=t;var i=r.keys();return e.localDocuments.getDocuments(n,i)}).next(function(t){return{batchId:r.batchId,changes:t}})})},t.prototype.acknowledgeBatch=function(t){var e=this;return this.persistence.runTransaction("Acknowledge batch",function(n){var r;return e.mutationQueue.acknowledgeBatch(n,t.batch,t.streamToken).next(function(){if(e.shouldHoldBatchResult(t.commitVersion))return e.heldBatchResults.push(t),r=ot(),yr.resolve();var i=new oi(e.remoteDocuments);return e.releaseBatchResults(n,[t],i).next(function(t){return r=t,i.apply(n)})}).next(function(){return e.mutationQueue.performConsistencyCheck(n)}).next(function(){return e.localDocuments.getDocuments(n,r)})})},t.prototype.rejectBatch=function(t){var e=this;return this.persistence.runTransaction("Reject batch",function(n){var r,i;return e.mutationQueue.lookupMutationBatch(n,t).next(function(i){return c(null!=i,"Attempt to reject nonexistent batch!"),r=i,e.mutationQueue.getHighestAcknowledgedBatchId(n).next(function(e){return c(t>e,"Acknowledged batches can't be rejected."),r})}).next(function(){return e.removeMutationBatch(n,r)}).next(function(t){return i=t,e.mutationQueue.performConsistencyCheck(n)}).next(function(){return e.localDocuments.getDocuments(n,i)})})},t.prototype.getLastStreamToken=function(){var t=this;return this.persistence.runTransaction("Get last stream token",function(e){return t.mutationQueue.getLastStreamToken(e)})},t.prototype.setLastStreamToken=function(t){var e=this;return this.persistence.runTransaction("Set last stream token",function(n){return e.mutationQueue.setLastStreamToken(n,t)})},t.prototype.getLastRemoteSnapshotVersion=function(){return this.queryCache.getLastRemoteSnapshotVersion()},t.prototype.applyRemoteEvent=function(t){var e=this,n=new oi(this.remoteDocuments);return this.persistence.runTransaction("Apply remote event",function(r){var i=[];d(t.targetChanges,function(t,n){var o=e.targetIds[t];if(o){var a=n.mapping;if(a)if(a instanceof On)i.push(e.queryCache.removeMatchingKeysForTargetId(r,t).next(function(){return e.queryCache.addMatchingKeys(r,a.documents,t)}));else{if(!(a instanceof Dn))return u("Unknown mapping type: "+JSON.stringify(a));i.push(e.queryCache.removeMatchingKeys(r,a.removedDocuments,t).next(function(){return e.queryCache.addMatchingKeys(r,a.addedDocuments,t)}))}var s=n.resumeToken;s.length>0&&(o=o.update({resumeToken:s,snapshotVersion:n.snapshotVersion}),e.targetIds[t]=o,i.push(e.queryCache.updateQueryData(r,o)))}});var a=ot();t.documentUpdates.forEach(function(t,s){a=a.add(t),i.push(n.getEntry(r,t).next(function(r){null==r||s.version.isEqual(un.MIN)||s.version.compareTo(r.version)>=0?n.addEntry(s):o("LocalStore","Ignoring outdated watch update for ",t,". Current version:",r.version," Watch version:",s.version),e.garbageCollector.addPotentialGarbageKey(t)}))});var s=e.queryCache.getLastRemoteSnapshotVersion(),l=t.snapshotVersion;l.isEqual(un.MIN)||(c(l.compareTo(s)>=0,"Watch stream reverted to previous snapshot?? "+l+" < "+s),i.push(e.queryCache.setLastRemoteSnapshotVersion(r,l)));var h;return yr.waitFor(i).next(function(){return e.releaseHeldBatchResults(r,n)}).next(function(t){return h=t,n.apply(r)}).next(function(){return e.localDocuments.getDocuments(r,a.unionWith(h))})})},t.prototype.notifyLocalViewChanges=function(t){var e=this;return this.persistence.runTransaction("Notify local view changes",function(n){for(var r=[],i=0,o=t;i<o.length;i++){var a=o[i];!function(t){r.push(e.queryCache.getQueryData(n,t.query).next(function(n){c(null!==n,"Local view changes contain unallocated query.");var r=n.targetId;e.localViewReferences.addReferences(t.addedKeys,r),e.localViewReferences.removeReferences(t.removedKeys,r)}))}(a)}return yr.waitFor(r)})},t.prototype.nextMutationBatch=function(t){var e=this;return this.persistence.runTransaction("Get next mutation batch",function(n){return void 0===t&&(t=kr),e.mutationQueue.getNextMutationBatchAfterBatchId(n,t)})},t.prototype.readDocument=function(t){var e=this;return this.persistence.runTransaction("read document",function(n){return e.localDocuments.getDocument(n,t)})},t.prototype.allocateQuery=function(t){var e=this;return this.persistence.runTransaction("Allocate query",function(n){var r;return e.queryCache.getQueryData(n,t).next(function(i){if(i)return r=i,yr.resolve();var o=e.targetIdGenerator.next();return r=new ln(t,o,Oe.Listen),e.queryCache.addQueryData(n,r)}).next(function(){return c(!e.targetIds[r.targetId],"Tried to allocate an already allocated query: "+t),e.targetIds[r.targetId]=r,r})})},t.prototype.releaseQuery=function(t){var e=this;return this.persistence.runTransaction("Release query",function(n){return e.queryCache.getQueryData(n,t).next(function(r){return c(null!=r,"Tried to release nonexistent query: "+t),e.localViewReferences.removeReferencesForId(r.targetId),delete e.targetIds[r.targetId],e.garbageCollector.isEager?e.queryCache.removeQueryData(n,r):yr.resolve()}).next(function(){if(m(e.targetIds)){var t=new oi(e.remoteDocuments);return e.releaseHeldBatchResults(n,t).next(function(){t.apply(n)})}return yr.resolve()})})},t.prototype.executeQuery=function(t){var e=this;return this.persistence.runTransaction("Execute query",function(n){return e.localDocuments.getDocumentsMatchingQuery(n,t)})},t.prototype.remoteDocumentKeys=function(t){var e=this;return this.persistence.runTransaction("Remote document keys",function(n){return e.queryCache.getMatchingKeysForTargetId(n,t)})},t.prototype.collectGarbage=function(){var t=this;return this.persistence.runTransaction("Garbage collection",function(e){return t.garbageCollector.collectGarbage(e).next(function(n){var r=[];return n.forEach(function(n){r.push(t.remoteDocuments.removeEntry(e,n))}),yr.waitFor(r)})})},t.prototype.releaseHeldBatchResults=function(t,e){for(var n=[],r=0,i=this.heldBatchResults;r<i.length;r++){var o=i[r];if(!this.isRemoteUpToVersion(o.commitVersion))break;n.push(o)}return 0===n.length?yr.resolve(ot()):(this.heldBatchResults.splice(0,n.length),this.releaseBatchResults(t,n,e))},t.prototype.isRemoteUpToVersion=function(t){var e=this.queryCache.getLastRemoteSnapshotVersion();return t.compareTo(e)<=0||m(this.targetIds)},t.prototype.shouldHoldBatchResult=function(t){return!this.isRemoteUpToVersion(t)||this.heldBatchResults.length>0},t.prototype.releaseBatchResults=function(t,e,n){for(var r=this,i=yr.resolve(),o=0,a=e;o<a.length;o++){var s=a[o];!function(e){i=i.next(function(){return r.applyWriteToRemoteDocuments(t,e,n)})}(s)}return i.next(function(){return r.removeMutationBatches(t,e.map(function(t){return t.batch}))})},t.prototype.removeMutationBatch=function(t,e){return this.removeMutationBatches(t,[e])},t.prototype.removeMutationBatches=function(t,e){for(var n=ot(),r=0,i=e;r<i.length;r++)for(var o=i[r],a=0,s=o.mutations;a<s.length;a++){var u=s[a],c=u.key;n=n.add(c)}return this.mutationQueue.removeMutationBatches(t,e).next(function(){return n})},t.prototype.applyWriteToRemoteDocuments=function(t,e,n){var r=e.batch,i=r.keys(),o=yr.resolve();return i.forEach(function(i){o=o.next(function(){return n.getEntry(t,i)}).next(function(t){var o=t,a=e.docVersions.get(i);c(null!==a,"ackVersions should contain every doc in the write."),(!o||o.version.compareTo(a)<0)&&(o=r.applyToRemoteDocument(i,o,e),o?n.addEntry(o):c(!t,"Mutation batch "+r+" applied to document "+t+" resulted in null"))})}),o},t}(),si=function(){function t(){this.mutationQueue=[],this.nextBatchId=1,this.highestAcknowledgedBatchId=kr,this.lastStreamToken=l(),this.garbageCollector=null,this.batchesByDocumentKey=new Tn(br.compareByKey)}return t.prototype.start=function(t){return 0===this.mutationQueue.length&&(this.nextBatchId=1,this.highestAcknowledgedBatchId=kr),c(this.highestAcknowledgedBatchId<this.nextBatchId,"highestAcknowledgedBatchId must be less than the nextBatchId"),yr.resolve()},t.prototype.checkEmpty=function(t){return yr.resolve(0===this.mutationQueue.length)},t.prototype.getNextBatchId=function(t){return yr.resolve(this.nextBatchId)},t.prototype.getHighestAcknowledgedBatchId=function(t){return yr.resolve(this.highestAcknowledgedBatchId)},t.prototype.acknowledgeBatch=function(t,e,n){var r=e.batchId;c(r>this.highestAcknowledgedBatchId,"Mutation batchIDs must be acknowledged in order");var i=this.indexOfExistingBatchId(r,"acknowledged"),o=this.mutationQueue[i];return c(r===o.batchId,"Queue ordering failure: expected batch "+r+", got batch "+o.batchId),c(!o.isTombstone(),"Can't acknowledge a previously removed batch"),this.highestAcknowledgedBatchId=r,this.lastStreamToken=n,yr.resolve()},t.prototype.getLastStreamToken=function(t){return yr.resolve(this.lastStreamToken)},t.prototype.setLastStreamToken=function(t,e){return this.lastStreamToken=e,yr.resolve()},t.prototype.addMutationBatch=function(t,e,n){c(0!==n.length,"Mutation batches should not be empty");var r=this.nextBatchId;if(this.nextBatchId++,this.mutationQueue.length>0){c(this.mutationQueue[this.mutationQueue.length-1].batchId<r,"Mutation batchIDs must be monotonically increasing order")}var i=new Ar(r,e,n);this.mutationQueue.push(i);for(var o=0,a=n;o<a.length;o++){var s=a[o];this.batchesByDocumentKey=this.batchesByDocumentKey.add(new br(s.key,r))}return yr.resolve(i)},t.prototype.lookupMutationBatch=function(t,e){return yr.resolve(this.findMutationBatch(e))},t.prototype.getNextMutationBatchAfterBatchId=function(t,e){for(var n=this.mutationQueue.length,r=Math.max(e,this.highestAcknowledgedBatchId)+1,i=this.indexOfBatchId(r),o=i<0?0:i;o<n;o++){var a=this.mutationQueue[o];if(!a.isTombstone())return yr.resolve(a)}return yr.resolve(null)},t.prototype.getAllMutationBatches=function(t){return yr.resolve(this.getAllLiveMutationBatchesBeforeIndex(this.mutationQueue.length))},t.prototype.getAllMutationBatchesThroughBatchId=function(t,e){var n=this.mutationQueue.length,r=this.indexOfBatchId(e);return r<0?r=0:r>=n?r=n:r++,yr.resolve(this.getAllLiveMutationBatchesBeforeIndex(r))},t.prototype.getAllMutationBatchesAffectingDocumentKey=function(t,e){var n=this,r=new br(e,0),i=new br(e,Number.POSITIVE_INFINITY),o=[];return this.batchesByDocumentKey.forEachInRange([r,i],function(t){c(e.isEqual(t.key),"Should only iterate over a single key's batches");var r=n.findMutationBatch(t.targetOrBatchId);c(null!==r,"Batches in the index must exist in the main table"),o.push(r)}),yr.resolve(o)},t.prototype.getAllMutationBatchesAffectingQuery=function(t,e){var n=this,r=e.path,i=r.length+1,o=r;Ee.isDocumentKey(o)||(o=o.child(""));var a=new br(new Ee(o),0),s=new Tn(B);this.batchesByDocumentKey.forEachWhile(function(t){var e=t.key.path;return!!r.isPrefixOf(e)&&(e.length===i&&(s=s.add(t.targetOrBatchId)),!0)},a);var u=[];return s.forEach(function(t){var e=n.findMutationBatch(t);null!==e&&u.push(e)}),yr.resolve(u)},t.prototype.removeMutationBatches=function(t,e){var n=e.length;c(n>0,"Should not remove mutations when none exist.");var r=e[0].batchId,i=this.mutationQueue.length,o=this.indexOfExistingBatchId(r,"removed");c(this.mutationQueue[o].batchId===r,"Removed batches must exist in the queue");for(var a=1,s=o+1;a<n&&s<i;){var u=this.mutationQueue[s];u.isTombstone()?s++:(c(u.batchId===e[a].batchId,"Removed batches must be contiguous in the queue"),a++,s++)}if(0===o){for(;s<i;s++){var u=this.mutationQueue[s];if(!u.isTombstone())break}var l=s-o;this.mutationQueue.splice(o,l)}else for(var h=o;h<s;h++)this.mutationQueue[h]=this.mutationQueue[h].toTombstone();for(var f=this.batchesByDocumentKey,p=0,d=e;p<d.length;p++)for(var u=d[p],y=u.batchId,m=0,g=u.mutations;m<g.length;m++){var v=g[m],b=v.key;null!==this.garbageCollector&&this.garbageCollector.addPotentialGarbageKey(b);var _=new br(b,y);f=f.delete(_)}return this.batchesByDocumentKey=f,yr.resolve()},t.prototype.setGarbageCollector=function(t){this.garbageCollector=t},t.prototype.containsKey=function(t,e){var n=new br(e,0),r=this.batchesByDocumentKey.firstAfterOrEqual(n);return yr.resolve(e.isEqual(r&&r.key))},t.prototype.performConsistencyCheck=function(t){return 0===this.mutationQueue.length&&c(this.batchesByDocumentKey.isEmpty(),"Document leak -- detected dangling mutation references when queue is empty."),yr.resolve()},t.prototype.getAllLiveMutationBatchesBeforeIndex=function(t){for(var e=[],n=0;n<t;n++){var r=this.mutationQueue[n];r.isTombstone()||e.push(r)}return e},t.prototype.indexOfExistingBatchId=function(t,e){var n=this.indexOfBatchId(t);return c(n>=0&&n<this.mutationQueue.length,"Batches must exist to be "+e),n},t.prototype.indexOfBatchId=function(t){return 0===this.mutationQueue.length?0:t-this.mutationQueue[0].batchId},t.prototype.findMutationBatch=function(t){var e=this.indexOfBatchId(t);if(e<0||e>=this.mutationQueue.length)return null;var n=this.mutationQueue[e];return c(n.batchId===t,"If found batch must match"),n.isTombstone()?null:n},t}(),ui=function(){function t(){this.queries=new hr(function(t){return t.canonicalId()}),this.lastRemoteSnapshotVersion=un.MIN,this.highestTargetId=0,this.references=new vr,this.targetCount=0}return t.prototype.start=function(t){return yr.resolve()},t.prototype.getLastRemoteSnapshotVersion=function(){return this.lastRemoteSnapshotVersion},t.prototype.getHighestTargetId=function(){return this.highestTargetId},t.prototype.setLastRemoteSnapshotVersion=function(t,e){return this.lastRemoteSnapshotVersion=e,yr.resolve()},t.prototype.saveQueryData=function(t){this.queries.set(t.query,t);var e=t.targetId;e>this.highestTargetId&&(this.highestTargetId=e)},t.prototype.addQueryData=function(t,e){return c(!this.queries.has(e.query),"Adding a query that already exists"),this.saveQueryData(e),this.targetCount+=1,yr.resolve()},t.prototype.updateQueryData=function(t,e){return c(this.queries.has(e.query),"Updating a non-existent query"),this.saveQueryData(e),yr.resolve()},t.prototype.removeQueryData=function(t,e){return c(this.targetCount>0,"Removing a target from an empty cache"),c(this.queries.has(e.query),"Removing a non-existent target from the cache"),this.queries.delete(e.query),this.references.removeReferencesForId(e.targetId),this.targetCount-=1,yr.resolve()},Object.defineProperty(t.prototype,"count",{get:function(){return this.targetCount},enumerable:!0,configurable:!0}),t.prototype.getQueryData=function(t,e){var n=this.queries.get(e)||null;return yr.resolve(n)},t.prototype.addMatchingKeys=function(t,e,n){return this.references.addReferences(e,n),yr.resolve()},t.prototype.removeMatchingKeys=function(t,e,n){return this.references.removeReferences(e,n),yr.resolve()},t.prototype.removeMatchingKeysForTargetId=function(t,e){return this.references.removeReferencesForId(e),yr.resolve()},t.prototype.getMatchingKeysForTargetId=function(t,e){var n=this.references.referencesForId(e);return yr.resolve(n)},t.prototype.setGarbageCollector=function(t){this.references.setGarbageCollector(t)},t.prototype.containsKey=function(t,e){return this.references.containsKey(t,e)},t}(),ci=function(){function t(){this.docs=nt()}return t.prototype.addEntry=function(t,e){return this.docs=this.docs.insert(e.key,e),yr.resolve()},t.prototype.removeEntry=function(t,e){return this.docs=this.docs.remove(e),yr.resolve()},t.prototype.getEntry=function(t,e){return yr.resolve(this.docs.get(e))},t.prototype.getDocumentsMatchingQuery=function(t,e){for(var n=rt(),r=new Ee(e.path.child("")),i=this.docs.getIteratorFrom(r);i.hasNext();){var o=i.getNext(),a=o.key,s=o.value;if(!e.path.isPrefixOf(a.path))break;s instanceof Te&&e.matches(s)&&(n=n.insert(s.key,s))}return yr.resolve(n)},t}(),li=function(){function t(){this.mutationQueues={},this.remoteDocumentCache=new ci,this.queryCache=new ui,this.started=!1}return t.prototype.start=function(){return re.__awaiter(this,void 0,void 0,function(){return re.__generator(this,function(t){return c(!this.started,"MemoryPersistence double-started!"),this.started=!0,[2]})})},t.prototype.shutdown=function(t){return re.__awaiter(this,void 0,void 0,function(){return re.__generator(this,function(t){return c(this.started,"MemoryPersistence shutdown without start!"),this.started=!1,[2]})})},t.prototype.getMutationQueue=function(t){var e=this.mutationQueues[t.toKey()];return e||(e=new si,this.mutationQueues[t.toKey()]=e),e},t.prototype.getQueryCache=function(){return this.queryCache},t.prototype.getRemoteDocumentCache=function(){return this.remoteDocumentCache},t.prototype.runTransaction=function(t,e){return o("MemoryPersistence","Starting transaction:",t),e(new hi).toPromise()},t}(),hi=function(){function t(){}return t}(),fi=function(){function t(){this.isEager=!1}return t.prototype.addGarbageSource=function(t){},t.prototype.removeGarbageSource=function(t){},t.prototype.addPotentialGarbageKey=function(t){},t.prototype.collectGarbage=function(t){return yr.resolve(ot())},t}();!function(t){t.All="all",t.ListenStreamIdle="listen_stream_idle",t.ListenStreamConnectionBackoff="listen_stream_connection_backoff",t.WriteStreamIdle="write_stream_idle",t.WriteStreamConnectionBackoff="write_stream_connection_backoff",t.OnlineStateTimeout="online_state_timeout"}(wr||(wr={}));var pi,di=function(){function t(t,e,n,r,i){this.asyncQueue=t,this.timerId=e,this.targetTimeMs=n,this.op=r,this.removalCallback=i,this.deferred=new Gr,this.then=this.deferred.promise.then.bind(this.deferred.promise),this.catch=this.deferred.promise.catch.bind(this.deferred.promise),this.deferred.promise.catch(function(t){})}return t.createAndSchedule=function(e,n,r,i,o){var a=Date.now()+r,s=new t(e,n,a,i,o);return s.start(r),s},t.prototype.start=function(t){var e=this;this.timerHandle=setTimeout(function(){return e.handleDelayElapsed()},t)},t.prototype.skipDelay=function(){return this.handleDelayElapsed()},t.prototype.cancel=function(t){null!==this.timerHandle&&(this.clearTimeout(),this.deferred.reject(new ce(ue.CANCELLED,"Operation cancelled"+(t?": "+t:""))))},t.prototype.handleDelayElapsed=function(){var t=this;this.asyncQueue.enqueue(function(){return null!==t.timerHandle?(t.clearTimeout(),t.op().then(function(e){return t.deferred.resolve(e)})):Promise.resolve()})},t.prototype.clearTimeout=function(){null!==this.timerHandle&&(this.removalCallback(this),clearTimeout(this.timerHandle),this.timerHandle=null)},t}(),yi=function(){function t(){this.tail=Promise.resolve(),this.delayedOperations=[],this.operationInProgress=!1}return t.prototype.enqueue=function(t){var e=this;this.verifyNotFailed();var n=this.tail.then(function(){return e.operationInProgress=!0,t().catch(function(t){e.failure=t,e.operationInProgress=!1;var n=t.stack||t.message||"";throw a("INTERNAL UNHANDLED ERROR: ",n),n.indexOf("Firestore Test Simulated Error")<0&&setTimeout(function(){throw t},0),t}).then(function(t){return e.operationInProgress=!1,t})});return this.tail=n,n},t.prototype.enqueueAfterDelay=function(t,e,n){var r=this;this.verifyNotFailed(),c(!this.containsDelayedOperation(t),"Attempted to schedule multiple operations with timer id "+t+".");var i=di.createAndSchedule(this,t,e,n,function(t){return r.removeDelayedOperation(t)});return this.delayedOperations.push(i),i},t.prototype.verifyNotFailed=function(){this.failure&&u("AsyncQueue is already failed: "+(this.failure.stack||this.failure.message))},t.prototype.verifyOperationInProgress=function(){c(this.operationInProgress,"verifyOpInProgress() called when no op in progress on this queue.")},t.prototype.drain=function(){return this.enqueue(function(){return Promise.resolve()})},t.prototype.containsDelayedOperation=function(t){return this.delayedOperations.findIndex(function(e){return e.timerId===t})>=0},t.prototype.runDelayedOperationsEarly=function(t){var e=this;return this.drain().then(function(){c(t===wr.All||e.containsDelayedOperation(t),"Attempted to drain to missing operation "+t),e.delayedOperations.sort(function(t,e){return t.targetTimeMs-e.targetTimeMs});for(var n=0,r=e.delayedOperations;n<r.length;n++){var i=r[n];if(i.skipDelay(),t!==wr.All&&i.timerId===t)break}return e.drain()})},t.prototype.removeDelayedOperation=function(t){var e=this.delayedOperations.indexOf(t);c(e>=0,"Delayed operation not found."),this.delayedOperations.splice(e,1)},t}(),mi=function(){function t(t,e,n,r,i){this.queue=t,this.timerId=e,this.initialDelayMs=n,this.backoffFactor=r,this.maxDelayMs=i,this.timerPromise=null,this.reset()}return t.prototype.reset=function(){this.currentBaseMs=0},t.prototype.resetToMax=function(){this.currentBaseMs=this.maxDelayMs},t.prototype.backoffAndRun=function(t){this.cancel();var e=this.currentBaseMs+this.jitterDelayMs();this.currentBaseMs>0&&o("ExponentialBackoff","Backing off for "+e+" ms (base delay: "+this.currentBaseMs+" ms)"),this.timerPromise=this.queue.enqueueAfterDelay(this.timerId,e,t),this.currentBaseMs*=this.backoffFactor,this.currentBaseMs<this.initialDelayMs&&(this.currentBaseMs=this.initialDelayMs),this.currentBaseMs>this.maxDelayMs&&(this.currentBaseMs=this.maxDelayMs)},t.prototype.cancel=function(){null!==this.timerPromise&&(this.timerPromise.cancel(),this.timerPromise=null)},t.prototype.jitterDelayMs=function(){return(Math.random()-.5)*this.currentBaseMs},t}();!function(t){t[t.Initial=0]="Initial",t[t.Auth=1]="Auth",t[t.Open=2]="Open",t[t.Error=3]="Error",t[t.Backoff=4]="Backoff",t[t.Stopped=5]="Stopped"}(pi||(pi={}));var gi,vi=1e3,bi=6e4,_i=1.5,wi=function(){function t(t,e,n,r,i){this.queue=t,this.idleTimerId=n,this.connection=r,this.credentialsProvider=i,this.inactivityTimerPromise=null,this.stream=null,this.listener=null,this.backoff=new mi(t,e,vi,_i,bi),this.state=pi.Initial}return t.prototype.isStarted=function(){return this.state===pi.Backoff||this.state===pi.Auth||this.state===pi.Open},t.prototype.isOpen=function(){return this.state===pi.Open},t.prototype.start=function(t){if(this.state===pi.Error)return void this.performBackoff(t);c(this.state===pi.Initial,"Already started"),this.listener=t,this.auth()},t.prototype.stop=function(){this.isStarted()&&this.close(pi.Stopped)},t.prototype.inhibitBackoff=function(){c(!this.isStarted(),"Can only inhibit backoff in a stopped state"),this.state=pi.Initial,this.backoff.reset()},t.prototype.markIdle=function(){var t=this;this.isOpen()&&null===this.inactivityTimerPromise&&(this.inactivityTimerPromise=this.queue.enqueueAfterDelay(this.idleTimerId,6e4,function(){return t.handleIdleCloseTimer()}))},t.prototype.sendRequest=function(t){this.cancelIdleCheck(),this.stream.send(t)},t.prototype.handleIdleCloseTimer=function(){return re.__awaiter(this,void 0,void 0,function(){return re.__generator(this,function(t){return this.isOpen()?[2,this.close(pi.Initial)]:[2]})})},t.prototype.cancelIdleCheck=function(){this.inactivityTimerPromise&&(this.inactivityTimerPromise.cancel(),this.inactivityTimerPromise=null)},t.prototype.close=function(t,e){return re.__awaiter(this,void 0,void 0,function(){var n;return re.__generator(this,function(r){return c(t===pi.Error||z(e),"Can't provide an error when not in an error state."),this.cancelIdleCheck(),this.backoff.cancel(),t!==pi.Error?this.backoff.reset():e&&e.code===ue.RESOURCE_EXHAUSTED&&(a(e.toString()),a("Using maximum backoff delay to prevent overloading the backend."),this.backoff.resetToMax()),null!==this.stream&&(this.tearDown(),this.stream.close(),this.stream=null),this.state=t,n=this.listener,this.listener=null,t!==pi.Stopped?[2,n.onClose(e)]:[2]})})},t.prototype.tearDown=function(){},t.prototype.auth=function(){var t=this;c(this.state===pi.Initial,"Must be in initial state to auth"),this.state=pi.Auth,this.credentialsProvider.getToken(!1).then(function(e){t.startStream(e)},function(e){t.queue.enqueue(function(){return re.__awaiter(t,void 0,void 0,function(){var t;return re.__generator(this,function(n){return this.state!==pi.Stopped?(t=new ce(ue.UNKNOWN,"Fetching auth token failed: "+e.message),[2,this.handleStreamClose(t)]):[2]})})})})},t.prototype.startStream=function(t){var e=this;if(this.state!==pi.Stopped){c(this.state===pi.Auth,"Trying to start stream in a non-auth state");var n=function(t,n){e.queue.enqueue(function(){return re.__awaiter(e,void 0,void 0,function(){return re.__generator(this,function(e){return this.stream===t?[2,n()]:[2]})})})};if(null!==this.listener){var r=this.startRpc(t);this.stream=r,this.stream.onOpen(function(){n(r,function(){return c(e.state===pi.Auth,"Expected stream to be in state auth, but was "+e.state),e.state=pi.Open,e.listener.onOpen()})}),this.stream.onClose(function(t){n(r,function(){return e.handleStreamClose(t)})}),this.stream.onMessage(function(t){n(r,function(){return e.onMessage(t)})})}}},t.prototype.performBackoff=function(t){var e=this;c(this.state===pi.Error,"Should only perform backoff in an error case"),this.state=pi.Backoff,this.backoff.backoffAndRun(function(){return re.__awaiter(e,void 0,void 0,function(){return re.__generator(this,function(e){return this.state===pi.Stopped?[2]:(this.state=pi.Initial,this.start(t),c(this.isStarted(),"PersistentStream should have started"),[2])})})})},t.prototype.handleStreamClose=function(t){return c(this.isStarted(),"Can't handle server close on non-started stream"),o("PersistentStream","close with error: "+t),this.stream=null,this.close(pi.Error,t)},t}(),Ei=function(t){function e(e,n,r,i){var o=t.call(this,e,wr.ListenStreamConnectionBackoff,wr.ListenStreamIdle,n,r)||this;return o.serializer=i,o}return re.__extends(e,t),e.prototype.startRpc=function(t){return this.connection.openStream("Listen",t)},e.prototype.onMessage=function(t){this.backoff.reset();var e=this.serializer.fromWatchChange(t),n=this.serializer.versionFromListenResponse(t);return this.listener.onWatchChange(e,n)},e.prototype.watch=function(t){var e={};e.database=this.serializer.encodedDatabaseId,e.addTarget=this.serializer.toTarget(t);var n=this.serializer.toListenRequestLabels(t);n&&(e.labels=n),this.sendRequest(e)},e.prototype.unwatch=function(t){var e={};e.database=this.serializer.encodedDatabaseId,e.removeTarget=t,this.sendRequest(e)},e}(wi),Ti=function(t){function e(e,n,r,i){var o=t.call(this,e,wr.WriteStreamConnectionBackoff,wr.WriteStreamIdle,n,r)||this;return o.serializer=i,o.handshakeComplete_=!1,o}return re.__extends(e,t),Object.defineProperty(e.prototype,"handshakeComplete",{get:function(){return this.handshakeComplete_},enumerable:!0,configurable:!0}),e.prototype.start=function(e){this.handshakeComplete_=!1,t.prototype.start.call(this,e)},e.prototype.tearDown=function(){this.handshakeComplete_&&this.writeMutations([])},e.prototype.startRpc=function(t){return this.connection.openStream("Write",t)},e.prototype.onMessage=function(t){if(c(!!t.streamToken,"Got a write response without a stream token"),this.lastStreamToken=t.streamToken,this.handshakeComplete_){this.backoff.reset();var e=this.serializer.fromWriteResults(t.writeResults),n=this.serializer.fromVersion(t.commitTime);return this.listener.onMutationResult(n,e)}return c(!t.writeResults||0===t.writeResults.length,"Got mutation results for handshake"),this.handshakeComplete_=!0,this.listener.onHandshakeComplete()},e.prototype.writeHandshake=function(){c(this.isOpen(),"Writing handshake requires an opened stream"),c(!this.handshakeComplete_,"Handshake already completed");var t={};t.database=this.serializer.encodedDatabaseId,this.sendRequest(t)},e.prototype.writeMutations=function(t){var e=this;c(this.isOpen(),"Writing mutations requires an opened stream"),c(this.handshakeComplete_,"Handshake must be complete before writing mutations"),c(this.lastStreamToken.length>0,"Trying to write mutation without a token");var n={streamToken:this.lastStreamToken,writes:t.map(function(t){return e.serializer.toMutation(t)})};this.sendRequest(n)},e}(wi),Si=function(){function t(t,e,n,r){this.queue=t,this.connection=e,this.credentials=n,this.serializer=r}return t.prototype.newPersistentWriteStream=function(){return new Ti(this.queue,this.connection,this.credentials,this.serializer)},t.prototype.newPersistentWatchStream=function(){return new Ei(this.queue,this.connection,this.credentials,this.serializer)},t.prototype.commit=function(t){var e=this,n={database:this.serializer.encodedDatabaseId,writes:t.map(function(t){return e.serializer.toMutation(t)})};return this.invokeRPC("Commit",n).then(function(t){return e.serializer.fromWriteResults(t.writeResults)})},t.prototype.lookup=function(t){var e=this,n={database:this.serializer.encodedDatabaseId,documents:t.map(function(t){return e.serializer.toName(t)})};return this.invokeStreamingRPC("BatchGetDocuments",n).then(function(n){var r=nt();n.forEach(function(t){var n=e.serializer.fromMaybeDocument(t);r=r.insert(n.key,n)});var i=[];return t.forEach(function(t){var e=r.get(t);c(!!e,"Missing entity in write response for "+t),i.push(e)}),i})},t.prototype.invokeRPC=function(t,e){var n=this;return this.credentials.getToken(!1).then(function(r){return n.connection.invokeRPC(t,e,r)})},t.prototype.invokeStreamingRPC=function(t,e){var n=this;return this.credentials.getToken(!1).then(function(r){return n.connection.invokeStreamingRPC(t,e,r)})},t}(),Ci=function(){function t(t){this.datastore=t,this.readVersions=it(),this.mutations=[],this.committed=!1}return t.prototype.recordVersion=function(t){var e=t.version;t instanceof Se&&(e=un.forDeletedDoc());var n=this.readVersions.get(t.key);if(null!==n){if(!e.isEqual(n))throw new ce(ue.ABORTED,"Document version changed between two reads.")}else this.readVersions=this.readVersions.insert(t.key,e)},t.prototype.lookup=function(t){var e=this;return this.committed?Promise.reject("Transaction has already completed."):this.mutations.length>0?Promise.reject("Transactions lookups are invalid after writes."):this.datastore.lookup(t).then(function(t){return t.forEach(function(t){return e.recordVersion(t)}),t})},t.prototype.write=function(t){if(this.committed)throw new ce(ue.FAILED_PRECONDITION,"Transaction has already completed.");this.mutations=this.mutations.concat(t)},t.prototype.precondition=function(t){var e=this.readVersions.get(t);return e?yn.updateTime(e):yn.NONE},t.prototype.preconditionForUpdate=function(t){var e=this.readVersions.get(t);if(e&&e.isEqual(un.forDeletedDoc()))throw new ce(ue.FAILED_PRECONDITION,"Can't update a document that doesn't exist.");return e?yn.updateTime(e):yn.exists(!0)},t.prototype.set=function(t,e){this.write(e.toMutations(t,this.precondition(t)))},t.prototype.update=function(t,e){this.write(e.toMutations(t,this.preconditionForUpdate(t)))},t.prototype.delete=function(t){this.write([new _n(t,this.precondition(t))]),this.readVersions=this.readVersions.insert(t,un.forDeletedDoc())},t.prototype.commit=function(){var t=this,e=this.readVersions;return this.mutations.forEach(function(t){e=e.remove(t.key)}),e.isEmpty()?this.datastore.commit(this.mutations).then(function(){t.committed=!0}):Promise.reject(Error("Every document read in a transaction must also be written."))},t}(),Ii=function(){function t(t,e){this.asyncQueue=t,this.onlineStateHandler=e,this.state=nr.Unknown,this.watchStreamFailures=0,this.onlineStateTimer=null,this.shouldWarnClientIsOffline=!0}return t.prototype.handleWatchStreamStart=function(){var t=this;0===this.watchStreamFailures&&(this.setAndBroadcast(nr.Unknown),c(null===this.onlineStateTimer,"onlineStateTimer shouldn't be started yet"),this.onlineStateTimer=this.asyncQueue.enqueueAfterDelay(wr.OnlineStateTimeout,1e4,function(){return t.onlineStateTimer=null,c(t.state===nr.Unknown,"Timer should be canceled if we transitioned to a different state."),t.logClientOfflineWarningIfNecessary("Backend didn't respond within 10 seconds."),t.setAndBroadcast(nr.Offline),Promise.resolve()}))},t.prototype.handleWatchStreamFailure=function(t){this.state===nr.Online?(this.setAndBroadcast(nr.Unknown),c(0===this.watchStreamFailures,"watchStreamFailures must be 0"),c(null===this.onlineStateTimer,"onlineStateTimer must be null")):++this.watchStreamFailures>=2&&(this.clearOnlineStateTimer(),this.logClientOfflineWarningIfNecessary("Connection failed 2 times. Most recent error: "+t.toString()),this.setAndBroadcast(nr.Offline))},t.prototype.set=function(t){this.clearOnlineStateTimer(),this.watchStreamFailures=0,t===nr.Online&&(this.shouldWarnClientIsOffline=!1),this.setAndBroadcast(t)},t.prototype.setAndBroadcast=function(t){t!==this.state&&(this.state=t,this.onlineStateHandler(t))},t.prototype.logClientOfflineWarningIfNecessary=function(t){var e="Could not reach Cloud Firestore backend. "+t+"\nThis typically indicates that your device does not have a healthy Internet connection at the moment. The client will operate in offline mode until it is able to successfully connect to the backend.";this.shouldWarnClientIsOffline?(a(e),this.shouldWarnClientIsOffline=!1):o("OnlineStateTracker",e)},t.prototype.clearOnlineStateTimer=function(){null!==this.onlineStateTimer&&(this.onlineStateTimer.cancel(),this.onlineStateTimer=null)},t}(),Ni=function(){function t(t,e,n,r){this.localStore=t,this.datastore=e,this.pendingWrites=[],this.lastBatchSeen=kr,this.listenTargets={},this.pendingTargetResponses={},this.accumulatedWatchChanges=[],this.watchStream=null,this.writeStream=null,this.onlineStateTracker=new Ii(n,r)}return t.prototype.start=function(){return this.enableNetwork()},t.prototype.isNetworkEnabled=function(){return c(null==this.watchStream===(null==this.writeStream),"WatchStream and WriteStream should both be null or non-null"),null!=this.watchStream},t.prototype.enableNetwork=function(){var t=this;return this.isNetworkEnabled()?Promise.resolve():(this.watchStream=this.datastore.newPersistentWatchStream(),this.writeStream=this.datastore.newPersistentWriteStream(),this.localStore.getLastStreamToken().then(function(e){return t.writeStream.lastStreamToken=e,t.shouldStartWatchStream()?t.startWatchStream():t.onlineStateTracker.set(nr.Unknown),t.fillWritePipeline()}))},t.prototype.disableNetwork=function(){return re.__awaiter(this,void 0,void 0,function(){return re.__generator(this,function(t){return this.disableNetworkInternal(),this.onlineStateTracker.set(nr.Offline),[2]})})},t.prototype.disableNetworkInternal=function(){this.isNetworkEnabled()&&(this.watchStream.stop(),this.writeStream.stop(),this.cleanUpWatchStreamState(),this.cleanUpWriteStreamState(),this.writeStream=null,this.watchStream=null)},t.prototype.shutdown=function(){return o("RemoteStore","RemoteStore shutting down."),this.disableNetworkInternal(),this.onlineStateTracker.set(nr.Unknown),Promise.resolve()},t.prototype.listen=function(t){c(!f(this.listenTargets,t.targetId),"listen called with duplicate targetId!"),this.listenTargets[t.targetId]=t,this.shouldStartWatchStream()?this.startWatchStream():this.isNetworkEnabled()&&this.watchStream.isOpen()&&this.sendWatchRequest(t)},t.prototype.unlisten=function(t){c(f(this.listenTargets,t),"unlisten called without assigned target ID!"),delete this.listenTargets[t],this.isNetworkEnabled()&&this.watchStream.isOpen()&&(this.sendUnwatchRequest(t),m(this.listenTargets)&&this.watchStream.markIdle())},t.prototype.sendWatchRequest=function(t){this.recordPendingTargetRequest(t.targetId),this.watchStream.watch(t)},t.prototype.sendUnwatchRequest=function(t){this.recordPendingTargetRequest(t),this.watchStream.unwatch(t)},t.prototype.recordPendingTargetRequest=function(t){this.pendingTargetResponses[t]=(this.pendingTargetResponses[t]||0)+1},t.prototype.startWatchStream=function(){c(this.shouldStartWatchStream(),"startWriteStream() called when shouldStartWatchStream() is false."),this.watchStream.start({onOpen:this.onWatchStreamOpen.bind(this),onClose:this.onWatchStreamClose.bind(this),onWatchChange:this.onWatchStreamChange.bind(this)}),this.onlineStateTracker.handleWatchStreamStart()},t.prototype.shouldStartWatchStream=function(){return this.isNetworkEnabled()&&!this.watchStream.isStarted()&&!m(this.listenTargets)},t.prototype.cleanUpWatchStreamState=function(){this.accumulatedWatchChanges=[],this.pendingTargetResponses={}},t.prototype.onWatchStreamOpen=function(){return re.__awaiter(this,void 0,void 0,function(){var t=this;return re.__generator(this,function(e){return d(this.listenTargets,function(e,n){t.sendWatchRequest(n)}),[2]})})},t.prototype.onWatchStreamClose=function(t){return re.__awaiter(this,void 0,void 0,function(){return re.__generator(this,function(e){return c(this.isNetworkEnabled(),"onWatchStreamClose() should only be called when the network is enabled"),this.cleanUpWatchStreamState(),this.shouldStartWatchStream()?(t&&this.onlineStateTracker.handleWatchStreamFailure(t),this.startWatchStream()):this.onlineStateTracker.set(nr.Unknown),[2]})})},t.prototype.onWatchStreamChange=function(t,e){return re.__awaiter(this,void 0,void 0,function(){var n;return re.__generator(this,function(r){return this.onlineStateTracker.set(nr.Online),t instanceof Ln&&t.state===An.Removed&&t.cause?[2,this.handleTargetError(t)]:(this.accumulatedWatchChanges.push(t),!e.isEqual(un.MIN)&&e.compareTo(this.localStore.getLastRemoteSnapshotVersion())>=0?(n=this.accumulatedWatchChanges,this.accumulatedWatchChanges=[],[2,this.handleWatchChangeBatch(e,n)]):[2])})})},t.prototype.handleWatchChangeBatch=function(t,e){var n=this,r=new Mn(t,this.listenTargets,this.pendingTargetResponses);r.addChanges(e);var i=r.createRemoteEvent();this.pendingTargetResponses=r.pendingTargetResponses;var o=[];return d(r.existenceFilters,function(e,r){var a=n.listenTargets[e];if(a){var s=a.query;if(s.isDocumentQuery())if(0===r.count){var u=new Ee(s.path),l=new Se(u,t);i.addDocumentUpdate(l)}else c(1===r.count,"Single document existence filter with count: "+r.count);else{var h=n.localStore.remoteDocumentKeys(e).then(function(t){if(i.targetChanges[e]){var o=i.targetChanges[e].mapping;null!==o&&(o instanceof Dn?t=o.applyToKeySet(t):(c(o instanceof On,"Expected either reset or update mapping but got something else: "+o),t=o.documents))}if(t.size!==r.count){i.handleExistenceFilterMismatch(e);var u=new ln(s,e,a.purpose);n.listenTargets[e]=u,n.sendUnwatchRequest(e);var l=new ln(s,e,Oe.ExistenceFilterMismatch);n.sendWatchRequest(l)}});o.push(h)}}}),Promise.all(o).then(function(){return d(i.targetChanges,function(t,e){if(e.resumeToken.length>0){var r=n.listenTargets[t];r&&(n.listenTargets[t]=r.update({resumeToken:e.resumeToken,snapshotVersion:e.snapshotVersion}))}}),n.syncEngine.applyRemoteEvent(i)})},t.prototype.handleTargetError=function(t){var e=this;c(!!t.cause,"Handling target error without a cause");var n=t.cause,r=Promise.resolve();return t.targetIds.forEach(function(t){r=r.then(function(){return re.__awaiter(e,void 0,void 0,function(){return re.__generator(this,function(e){return f(this.listenTargets,t)?(delete this.listenTargets[t],[2,this.syncEngine.rejectListen(t,n)]):[2]})})})}),r},t.prototype.cleanUpWriteStreamState=function(){this.lastBatchSeen=kr,o("RemoteStore","Stopping write stream with "+this.pendingWrites.length+" pending writes"),this.pendingWrites=[]},t.prototype.fillWritePipeline=function(){return re.__awaiter(this,void 0,void 0,function(){var t=this;return re.__generator(this,function(e){return this.canWriteMutations()?[2,this.localStore.nextMutationBatch(this.lastBatchSeen).then(function(e){if(null!==e)return t.commit(e),t.fillWritePipeline();0===t.pendingWrites.length&&t.writeStream.markIdle()})]:[2]})})},t.prototype.canWriteMutations=function(){return this.isNetworkEnabled()&&this.pendingWrites.length<10},t.prototype.outstandingWrites=function(){return this.pendingWrites.length},t.prototype.commit=function(t){c(this.canWriteMutations(),"commit called when batches can't be written"),this.lastBatchSeen=t.batchId,this.pendingWrites.push(t),this.shouldStartWriteStream()?this.startWriteStream():this.isNetworkEnabled()&&this.writeStream.handshakeComplete&&this.writeStream.writeMutations(t.mutations)},t.prototype.shouldStartWriteStream=function(){return this.isNetworkEnabled()&&!this.writeStream.isStarted()&&this.pendingWrites.length>0},t.prototype.startWriteStream=function(){c(this.shouldStartWriteStream(),"startWriteStream() called when shouldStartWriteStream() is false."),this.writeStream.start({onOpen:this.onWriteStreamOpen.bind(this),onClose:this.onWriteStreamClose.bind(this),onHandshakeComplete:this.onWriteHandshakeComplete.bind(this),onMutationResult:this.onMutationResult.bind(this)})},t.prototype.onWriteStreamOpen=function(){return re.__awaiter(this,void 0,void 0,function(){return re.__generator(this,function(t){return this.writeStream.writeHandshake(),[2]})})},t.prototype.onWriteHandshakeComplete=function(){var t=this;return this.localStore.setLastStreamToken(this.writeStream.lastStreamToken).then(function(){for(var e=0,n=t.pendingWrites;e<n.length;e++){var r=n[e];t.writeStream.writeMutations(r.mutations)}})},t.prototype.onMutationResult=function(t,e){var n=this;c(this.pendingWrites.length>0,"Got result for empty pending writes");var r=this.pendingWrites.shift(),i=Rr.from(r,t,e,this.writeStream.lastStreamToken);return this.syncEngine.applySuccessfulWrite(i).then(function(){return n.fillWritePipeline()})},t.prototype.onWriteStreamClose=function(t){return re.__awaiter(this,void 0,void 0,function(){var e,n=this;return re.__generator(this,function(r){return c(this.isNetworkEnabled(),"onWriteStreamClose() should only be called when the network is enabled"),t&&this.pendingWrites.length>0?(c(!!t,"We have pending writes, but the write stream closed without an error"),e=void 0,e=this.writeStream.handshakeComplete?this.handleWriteError(t):this.handleHandshakeError(t),[2,e.then(function(){n.shouldStartWriteStream()&&n.startWriteStream()})]):[2]})})},t.prototype.handleHandshakeError=function(t){return re.__awaiter(this,void 0,void 0,function(){return re.__generator(this,function(e){return J(t.code)||t.code===ue.ABORTED?(o("RemoteStore","RemoteStore error before completed handshake; resetting stream token: ",this.writeStream.lastStreamToken),this.writeStream.lastStreamToken=l(),[2,this.localStore.setLastStreamToken(l())]):[2]})})},t.prototype.handleWriteError=function(t){return re.__awaiter(this,void 0,void 0,function(){var e,n=this;return re.__generator(this,function(r){return J(t.code)?(e=this.pendingWrites.shift(),this.writeStream.inhibitBackoff(),[2,this.syncEngine.rejectFailedWrite(e.batchId,t).then(function(){return n.fillWritePipeline()})]):[2]})})},t.prototype.createTransaction=function(){return new Ci(this.datastore)},t.prototype.handleUserChange=function(t){if(o("RemoteStore","RemoteStore changing users: uid=",t.uid),this.isNetworkEnabled())return this.disableNetworkInternal(),this.onlineStateTracker.set(nr.Unknown),this.enableNetwork()},t}(),ki=function(){function t(t,e,n,r){this.platform=t,this.databaseInfo=e,this.credentials=n,this.asyncQueue=r}return t.prototype.start=function(t){var e=this,n=new Gr,r=new Gr,i=!1;return this.credentials.setUserChangeListener(function(o){i?e.asyncQueue.enqueue(function(){return e.handleUserChange(o)}):(i=!0,e.initializePersistence(t,r).then(function(){return e.initializeRest(o)}).then(n.resolve,n.reject))}),this.asyncQueue.enqueue(function(){return n.promise}),r.promise},t.prototype.enableNetwork=function(){var t=this;return this.asyncQueue.enqueue(function(){return t.remoteStore.enableNetwork()})},t.prototype.initializePersistence=function(t,e){var n=this;return t?this.startIndexedDbPersistence().then(e.resolve).catch(function(t){return e.reject(t),n.canFallback(t)?(console.warn("Error enabling offline storage. Falling back to storage disabled: "+t),n.startMemoryPersistence()):Promise.reject(t)}):(e.resolve(),this.startMemoryPersistence())},t.prototype.canFallback=function(t){return t instanceof ce?t.code===ue.FAILED_PRECONDITION||t.code===ue.UNIMPLEMENTED:!("undefined"!==typeof DOMException&&t instanceof DOMException)||(22===t.code||20===t.code)},t.prototype.startIndexedDbPersistence=function(){this.garbageCollector=new fi;var t=ri.buildStoragePrefix(this.databaseInfo),e=new Wn(this.databaseInfo.databaseId,{useProto3Json:!0});return this.persistence=new ri(t,e),this.persistence.start()},t.prototype.startMemoryPersistence=function(){return this.garbageCollector=new mr,this.persistence=new li,this.persistence.start()},t.prototype.initializeRest=function(t){var e=this;return this.platform.loadConnection(this.databaseInfo).then(function(n){e.localStore=new ai(e.persistence,t,e.garbageCollector);var r=e.platform.newSerializer(e.databaseInfo.databaseId),i=new Si(e.asyncQueue,n,e.credentials,r),o=function(t){e.syncEngine.applyOnlineStateChange(t),e.eventMgr.applyOnlineStateChange(t)};return e.remoteStore=new Ni(e.localStore,i,e.asyncQueue,o),e.syncEngine=new Nr(e.localStore,e.remoteStore,t),e.remoteStore.syncEngine=e.syncEngine,e.eventMgr=new pr(e.syncEngine),e.localStore.start()}).then(function(){return e.remoteStore.start()})},t.prototype.handleUserChange=function(t){return this.asyncQueue.verifyOperationInProgress(),o("FirestoreClient","User Changed: "+t.uid),this.syncEngine.handleUserChange(t)},t.prototype.disableNetwork=function(){var t=this;return this.asyncQueue.enqueue(function(){return t.remoteStore.disableNetwork()})},t.prototype.shutdown=function(t){var e=this;return this.asyncQueue.enqueue(function(){return e.credentials.removeUserChangeListener(),e.remoteStore.shutdown()}).then(function(){return e.persistence.shutdown(t&&t.purgePersistenceWithDataLoss)})},t.prototype.listen=function(t,e,n){var r=this,i=new dr(t,e,n);return this.asyncQueue.enqueue(function(){return r.eventMgr.listen(i)}),i},t.prototype.unlisten=function(t){var e=this;this.asyncQueue.enqueue(function(){return e.eventMgr.unlisten(t)})},t.prototype.getDocumentFromLocalCache=function(t){var e=this;return this.asyncQueue.enqueue(function(){return e.localStore.readDocument(t)}).then(function(t){if(t instanceof Te)return t;throw new ce(ue.UNAVAILABLE,"Failed to get document from cache. (However, this document may exist on the server. Run again without setting 'source' in the GetOptions to attempt to retrieve the document from the server.)")})},t.prototype.getDocumentsFromLocalCache=function(t){var e=this;return this.asyncQueue.enqueue(function(){return e.localStore.executeQuery(t)}).then(function(e){var n=ot(),r=new Cr(t,n),i=r.computeDocChanges(e);return r.applyChanges(i).snapshot})},t.prototype.write=function(t){var e=this,n=new Gr;return this.asyncQueue.enqueue(function(){return e.syncEngine.write(t,n)}),n.promise},t.prototype.databaseId=function(){return this.databaseInfo.databaseId},t.prototype.transaction=function(t){var e=this;return this.asyncQueue.enqueue(function(){return re.__awaiter(e,void 0,void 0,function(){return re.__generator(this,function(t){return[2]})})}).then(function(){return e.syncEngine.runTransaction(t)})},t}(),Ai=function(){function t(t){this.observer=t,this.muted=!1}return t.prototype.next=function(t){this.scheduleEvent(this.observer.next,t)},t.prototype.error=function(t){this.scheduleEvent(this.observer.error,t)},t.prototype.mute=function(){this.muted=!0},t.prototype.scheduleEvent=function(t,e){var n=this;this.muted||setTimeout(function(){n.muted||t(e)},0)},t}(),Ri=function(){function t(t){this.uid=t}return t.prototype.isAuthenticated=function(){return null!=this.uid},t.prototype.toKey=function(){return this.isAuthenticated()?"uid:"+this.uid:"anonymous-user"},t.prototype.isEqual=function(t){return t.uid===this.uid},t.UNAUTHENTICATED=new t(null),t.GOOGLE_CREDENTIALS=new t("google-credentials-uid"),t.FIRST_PARTY=new t("first-party-uid"),t}(),Oi=function(){function t(t,e){this.user=e,this.type="OAuth",this.authHeaders={Authorization:"Bearer "+t}}return t}(),Di=function(){function t(){this.userListener=null}return t.prototype.getToken=function(t){return Promise.resolve(null)},t.prototype.setUserChangeListener=function(t){c(!this.userListener,"Can only call setUserChangeListener() once."),this.userListener=t,t(Ri.UNAUTHENTICATED)},t.prototype.removeUserChangeListener=function(){c(null!==this.userListener,"removeUserChangeListener() when no listener registered"),this.userListener=null},t}(),Pi=function(){function t(t){var e=this;this.app=t,this.tokenListener=null,this.userCounter=0,this.userListener=null,this.tokenListener=function(){var t=e.getUser();e.currentUser&&t.isEqual(e.currentUser)||(e.currentUser=t,e.userCounter++,e.userListener&&e.userListener(e.currentUser))},this.userCounter=0,this.app.INTERNAL.addAuthTokenListener(this.tokenListener)}return t.prototype.getToken=function(t){var e=this;c(null!=this.tokenListener,"getToken cannot be called after listener removed.");var n=this.userCounter;return this.app.INTERNAL.getToken(t).then(function(t){if(e.userCounter!==n)throw new ce(ue.ABORTED,"getToken aborted due to uid change.");return t?(c("string"===typeof t.accessToken,"Invalid tokenData returned from getToken():"+t),new Oi(t.accessToken,e.currentUser)):null})},t.prototype.setUserChangeListener=function(t){c(!this.userListener,"Can only call setUserChangeListener() once."),this.userListener=t,this.currentUser&&t(this.currentUser)},t.prototype.removeUserChangeListener=function(){c(null!=this.tokenListener,"removeUserChangeListener() called twice"),c(null!==this.userListener,"removeUserChangeListener() called when no listener registered"),this.app.INTERNAL.removeAuthTokenListener(this.tokenListener),this.tokenListener=null,this.userListener=null},t.prototype.getUser=function(){"function"!==typeof this.app.INTERNAL.getUid&&u("This version of the Firestore SDK requires at least version 3.7.0 of firebase.js.");var t=this.app.INTERNAL.getUid();return c(null===t||"string"===typeof t,"Received invalid UID: "+t),new Ri(t)},t}(),xi=function(){function t(t,e){this.gapi=t,this.sessionIndex=e,this.type="FirstParty",this.user=Ri.FIRST_PARTY,c(this.gapi&&this.gapi.auth&&this.gapi.auth.getAuthHeaderValueForFirstParty,"unexpected gapi interface")}return Object.defineProperty(t.prototype,"authHeaders",{get:function(){return{Authorization:this.gapi.auth.getAuthHeaderValueForFirstParty([]),"X-Goog-AuthUser":this.sessionIndex}},enumerable:!0,configurable:!0}),t}(),Li=function(){function t(t,e){this.gapi=t,this.sessionIndex=e,c(this.gapi&&this.gapi.auth&&this.gapi.auth.getAuthHeaderValueForFirstParty,"unexpected gapi interface")}return t.prototype.getToken=function(t){return Promise.resolve(new xi(this.gapi,this.sessionIndex))},t.prototype.setUserChangeListener=function(t){t(Ri.FIRST_PARTY)},t.prototype.removeUserChangeListener=function(){},t}(),Mi=function(){function t(t){this.methodName=t}return t.delete=function(){return Fi.instance},t.serverTimestamp=function(){return Ui.instance},t._arrayUnion=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return b("FieldValue.arrayUnion",arguments,1),new Bi(t)},t._arrayRemove=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return b("FieldValue.arrayRemove",arguments,1),new Vi(t)},t.prototype.isEqual=function(t){return this===t},t}(),Fi=function(t){function e(){return t.call(this,"FieldValue.delete")||this}return re.__extends(e,t),e.instance=new e,e}(Mi),Ui=function(t){function e(){return t.call(this,"FieldValue.serverTimestamp")||this}return re.__extends(e,t),e.instance=new e,e}(Mi),Bi=function(t){function e(e){var n=t.call(this,"FieldValue.arrayUnion")||this;return n._elements=e,n}return re.__extends(e,t),e}(Mi),Vi=function(t){function e(e){var n=t.call(this,"FieldValue.arrayRemove")||this;return n._elements=e,n}return re.__extends(e,t),e}(Mi),ji=h(Mi,"Use FieldValue.<field>() instead."),qi=/^__.*__$/,Wi=function(){function t(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}return t.prototype.toMutations=function(t,e){var n=[];return null!==this.fieldMask?n.push(new vn(t,this.data,this.fieldMask,e)):n.push(new gn(t,this.data,e)),this.fieldTransforms.length>0&&n.push(new bn(t,this.fieldTransforms)),n},t}(),Ki=function(){function t(t,e,n){this.data=t,this.fieldMask=e,this.fieldTransforms=n}return t.prototype.toMutations=function(t,e){var n=[new vn(t,this.data,this.fieldMask,e)];return this.fieldTransforms.length>0&&n.push(new bn(t,this.fieldTransforms)),n},t}();!function(t){t[t.Set=0]="Set",t[t.Update=1]="Update",t[t.MergeSet=2]="MergeSet",t[t.Argument=3]="Argument"}(gi||(gi={}));var Hi=function(){function t(t,e,n,r,i,o){this.dataSource=t,this.methodName=e,this.path=n,this.arrayElement=r,void 0===i&&this.validatePath(),this.arrayElement=void 0!==r&&r,this.fieldTransforms=i||[],this.fieldMask=o||[]}return t.prototype.childContextForField=function(e){var n=null==this.path?null:this.path.child(e),r=new t(this.dataSource,this.methodName,n,!1,this.fieldTransforms,this.fieldMask);return r.validatePathSegment(e),r},t.prototype.childContextForFieldPath=function(e){var n=null==this.path?null:this.path.child(e),r=new t(this.dataSource,this.methodName,n,!1,this.fieldTransforms,this.fieldMask);return r.validatePath(),r},t.prototype.childContextForArray=function(e){return new t(this.dataSource,this.methodName,null,!0,this.fieldTransforms,this.fieldMask)},t.prototype.createError=function(t){var e=null===this.path||this.path.isEmpty()?"":" (found in field "+this.path.toString()+")";return new ce(ue.INVALID_ARGUMENT,"Function "+this.methodName+"() called with invalid data. "+t+e)},t.prototype.validatePath=function(){if(null!==this.path)for(var t=0;t<this.path.length;t++)this.validatePathSegment(this.path.get(t))},t.prototype.validatePathSegment=function(t){if(Vt(this.dataSource)&&qi.test(t))throw this.createError("Document fields cannot begin and end with __")},t}(),Gi=function(){function t(t,e){this.databaseId=t,this.key=e}return t}(),Qi=function(){function t(t){this.preConverter=t}return t.prototype.parseSetData=function(t,e){var n=new Hi(gi.Set,t,we.EMPTY_PATH);qt("Data must be an object, but it was:",n,e);var r=this.parseData(e,n);return new Wi(r,null,n.fieldTransforms)},t.prototype.parseMergeData=function(t,e,n){var r=new Hi(gi.MergeSet,t,we.EMPTY_PATH);qt("Data must be an object, but it was:",r,e);var i,o,a=this.parseData(e,r);if(n){for(var s=[],c=0,l=n;c<l.length;c++){var h=l[c],f=void 0;if(h instanceof rr?f=h:"string"===typeof h?f=Kt(t,h):u("Expected stringOrFieldPath to be a string or a FieldPath"),!a.contains(f))throw new ce(ue.INVALID_ARGUMENT,"Field '"+f+"' is specified in your field mask but missing from your input data.");s.push(f)}i=new hn(s),o=r.fieldTransforms.filter(function(t){return i.covers(t.field)})}else i=new hn(r.fieldMask),o=r.fieldTransforms;return new Wi(a,i,o)},t.prototype.parseUpdateData=function(t,e){var n=this,r=new Hi(gi.Update,t,we.EMPTY_PATH);qt("Data must be an object, but it was:",r,e);var i=[],o=He.EMPTY;y(e,function(e,a){var s=Kt(t,e),u=r.childContextForFieldPath(s);if((a=n.runPreConverter(a,u))instanceof Fi)i.push(s);else{var c=n.parseData(a,u);null!=c&&(i.push(s),o=o.set(s,c))}});var a=new hn(i);return new Ki(o,a,r.fieldTransforms)},t.prototype.parseUpdateVarargs=function(t,e,n,r){var i=new Hi(gi.Update,t,we.EMPTY_PATH),o=[Wt(t,e)],a=[n];if(r.length%2!==0)throw new ce(ue.INVALID_ARGUMENT,"Function "+t+"() needs to be called with an even number of arguments that alternate between field names and values.");for(var s=0;s<r.length;s+=2)o.push(Wt(t,r[s])),a.push(r[s+1]);for(var u=[],c=He.EMPTY,s=0;s<o.length;++s){var l=o[s],h=i.childContextForFieldPath(l),f=this.runPreConverter(a[s],h);if(f instanceof Fi)u.push(l);else{var p=this.parseData(f,h);null!=p&&(u.push(l),c=c.set(l,p))}}var d=new hn(u);return new Ki(c,d,i.fieldTransforms)},t.prototype.parseQueryValue=function(t,e){var n=new Hi(gi.Argument,t,we.EMPTY_PATH),r=this.parseData(e,n);return c(null!=r,"Parsed data should not be null."),c(0===n.fieldTransforms.length,"Field transforms should have been disallowed."),r},t.prototype.runPreConverter=function(t,e){try{return this.preConverter(t)}catch(t){var n=Ht(t);throw e.createError(n)}},t.prototype.parseData=function(t,e){if(t=this.runPreConverter(t,e),jt(t))return qt("Unsupported field value:",e,t),this.parseObject(t,e);if(t instanceof Mi)return this.parseSentinelFieldValue(t,e),null;if(e.path&&e.fieldMask.push(e.path),t instanceof Array){if(e.arrayElement)throw e.createError("Nested arrays are not supported");return this.parseArray(t,e)}return this.parseScalarValue(t,e)},t.prototype.parseObject=function(t,e){var n=this,r=new Ce(B);return y(t,function(t,i){var o=n.parseData(i,e.childContextForField(t));null!=o&&(r=r.insert(t,o))}),new He(r)},t.prototype.parseArray=function(t,e){for(var n=[],r=0,i=0,o=t;i<o.length;i++){var a=o[i],s=this.parseData(a,e.childContextForArray(r));null==s&&(s=xe.INSTANCE),n.push(s),r++}return new Ge(n)},t.prototype.parseSentinelFieldValue=function(t,e){if(!Vt(e.dataSource))throw e.createError(t.methodName+"() can only be used with update() and set()");if(null===e.path)throw e.createError(t.methodName+"() is not currently supported inside arrays");if(t instanceof Fi){if(e.dataSource!==gi.MergeSet)throw e.dataSource===gi.Update?(c(e.path.length>0,"FieldValue.delete() at the top level should have already been handled."),e.createError("FieldValue.delete() can only appear at the top level of your update data")):e.createError("FieldValue.delete() cannot be used with set() unless you pass {merge:true}");e.fieldMask.push(e.path)}else if(t instanceof Ui)e.fieldTransforms.push(new fn(e.path,Fn.instance));else if(t instanceof Bi){var n=this.parseArrayTransformElements(t.methodName,t._elements),r=new Un(n);e.fieldTransforms.push(new fn(e.path,r))}else if(t instanceof Vi){var n=this.parseArrayTransformElements(t.methodName,t._elements),i=new Bn(n);e.fieldTransforms.push(new fn(e.path,i))}else u("Unknown FieldValue type: "+t)},t.prototype.parseScalarValue=function(t,e){if(null===t)return xe.INSTANCE;if("number"===typeof t)return Y(t)?new Fe(t):new Ue(t);if("boolean"===typeof t)return Le.of(t);if("string"===typeof t)return new Be(t);if(t instanceof Date)return new Ve(de.fromDate(t));if(t instanceof de)return new Ve(new de(t.seconds,1e3*Math.floor(t.nanoseconds/1e3)));if(t instanceof pe)return new Ke(t);if(t instanceof he)return new qe(t);if(t instanceof Gi)return new We(t.databaseId,t.key);throw e.createError("Unsupported field value: "+D(t))},t.prototype.parseArrayTransformElements=function(t,e){var n=this;return e.map(function(e,r){var i=new Hi(gi.Argument,t,we.EMPTY_PATH);return n.parseData(e,i.childContextForArray(r))})},t}(),zi="firestore.googleapis.com",Yi=!0,Xi=!1,Ji=function(){function t(t){if(void 0===t.host){if(void 0!==t.ssl)throw new ce(ue.INVALID_ARGUMENT,"Can't provide ssl option if host option is not set");this.host=zi,this.ssl=Yi}else S("settings","string","host",t.host),this.host=t.host,C("settings","boolean","ssl",t.ssl),this.ssl=p(t.ssl,Yi);L("settings",t,["host","ssl","credentials","timestampsInSnapshots"]),C("settings","object","credentials",t.credentials),this.credentials=t.credentials,C("settings","boolean","timestampsInSnapshots",t.timestampsInSnapshots),this.timestampsInSnapshots=p(t.timestampsInSnapshots,Xi)}return t.prototype.isEqual=function(t){return this.host===t.host&&this.ssl===t.ssl&&this.timestampsInSnapshots===t.timestampsInSnapshots&&this.credentials===t.credentials},t}(),$i=function(){function t(){}return t}(),Zi=function(){function t(e){var n=this;this._queue=new yi,this.INTERNAL={delete:function(t){return re.__awaiter(n,void 0,void 0,function(){return re.__generator(this,function(e){return this._firestoreClient?[2,this._firestoreClient.shutdown(t)]:[2]})})}};var r=new $i;if("object"===typeof e.options){var i=e;r.firebaseApp=i,r.databaseId=t.databaseIdFromApp(i),r.persistenceKey=r.firebaseApp.name,r.credentials=new Pi(i)}else{var o=e;if(!o.projectId)throw new ce(ue.INVALID_ARGUMENT,"Must provide projectId");r.databaseId=new ge(o.projectId,o.database),r.persistenceKey="[DEFAULT]",r.credentials=new Di}r.settings=new Ji({}),this._config=r,this._databaseId=r.databaseId}return t.prototype.settings=function(t){if(v("Firestore.settings",arguments,1),E("Firestore.settings","object",1,t),f(t,"persistence"))throw new ce(ue.INVALID_ARGUMENT,'"persistence" is now specified with a separate call to firestore.enablePersistence().');var e=new Ji(t);if(this._firestoreClient&&!this._config.settings.isEqual(e))throw new ce(ue.FAILED_PRECONDITION,"Firestore has already been started and its settings can no longer be changed. You can only call settings() before calling any other methods on a Firestore object.");this._config.settings=e,void 0!==e.credentials&&(this._config.credentials=Ft(e.credentials))},t.prototype.enableNetwork=function(){return this.ensureClientConfigured(),this._firestoreClient.enableNetwork()},t.prototype.disableNetwork=function(){return this.ensureClientConfigured(),this._firestoreClient.disableNetwork()},t.prototype.enablePersistence=function(){if(this._firestoreClient)throw new ce(ue.FAILED_PRECONDITION,"Firestore has already been started and persistence can no longer be enabled. You can only call enablePersistence() before calling any other methods on a Firestore object.");return this.configureClient(!0)},t.prototype.ensureClientConfigured=function(){return this._firestoreClient||this.configureClient(!1),this._firestoreClient},t.prototype.configureClient=function(t){var e=this;c(!!this._config.settings.host,"FirestoreSettings.host cannot be falsey"),this._config.settings.timestampsInSnapshots||a("\nThe behavior for Date objects stored in Firestore is going to change\nAND YOUR APP MAY BREAK.\nTo hide this warning and ensure your app does not break, you need to add the\nfollowing code to your app before calling any other Cloud Firestore methods:\n\n const firestore = firebase.firestore();\n const settings = {/* your settings... */ timestampsInSnapshots: true};\n firestore.settings(settings);\n\nWith this change, timestamps stored in Cloud Firestore will be read back as\nFirebase Timestamp objects instead of as system Date objects. So you will also\nneed to update code expecting a Date to instead expect a Timestamp. For example:\n\n // Old:\n const date = snapshot.get('created_at');\n // New:\n const timestamp = snapshot.get('created_at');\n const date = timestamp.toDate();\n\nPlease audit all existing usages of Date when you enable the new behavior. In a\nfuture release, the behavior will change to the new behavior, so if you do not\nfollow these steps, YOUR APP MAY BREAK."),c(!this._firestoreClient,"configureClient() called multiple times");var n=new ye(this._config.databaseId,this._config.persistenceKey,this._config.settings.host,this._config.settings.ssl),r=function(t){if(t instanceof no){var n=e._config.databaseId,r=t.firestore._config.databaseId;if(!r.isEqual(n))throw new ce(ue.INVALID_ARGUMENT,"Document reference is for database "+r.projectId+"/"+r.database+" but should be for database "+n.projectId+"/"+n.database);return new Gi(e._config.databaseId,t._key)}return t};return this._dataConverter=new Qi(r),this._firestoreClient=new ki(se.getPlatform(),n,this._config.credentials,this._queue),this._firestoreClient.start(t)},t.databaseIdFromApp=function(t){var e=t.options;if(!f(e,"projectId")){if(f(e,"firestoreId"))throw new ce(ue.INVALID_ARGUMENT,'"firestoreId" is now specified as "projectId" in firebase.initializeApp.');throw new ce(ue.INVALID_ARGUMENT,'"projectId" not provided in firebase.initializeApp.')}if(f(e,"firestoreOptions"))throw new ce(ue.INVALID_ARGUMENT,'"firestoreOptions" values are now specified with Firestore.settings()');var n=e.projectId;if(!n||"string"!==typeof n)throw new ce(ue.INVALID_ARGUMENT,"projectId must be a string in FirebaseApp.options");return new ge(n)},Object.defineProperty(t.prototype,"app",{get:function(){if(!this._config.firebaseApp)throw new ce(ue.FAILED_PRECONDITION,"Firestore was not initialized using the Firebase SDK. 'app' is not available");return this._config.firebaseApp},enumerable:!0,configurable:!0}),t.prototype.collection=function(t){if(v("Firestore.collection",arguments,1),E("Firestore.collection","string",1,t),!t)throw new ce(ue.INVALID_ARGUMENT,"Must provide a non-empty collection path to collection()");return this.ensureClientConfigured(),new uo(be.fromString(t),this)},t.prototype.doc=function(t){if(v("Firestore.doc",arguments,1),E("Firestore.doc","string",1,t),!t)throw new ce(ue.INVALID_ARGUMENT,"Must provide a non-empty document path to doc()");return this.ensureClientConfigured(),no.forPath(be.fromString(t),this)},t.prototype.runTransaction=function(t){var e=this;return v("Firestore.runTransaction",arguments,1),E("Firestore.runTransaction","function",1,t),this.ensureClientConfigured().transaction(function(n){return t(new to(e,n))})},t.prototype.batch=function(){return this.ensureClientConfigured(),new eo(this)},Object.defineProperty(t,"logLevel",{get:function(){switch(r()){case te.DEBUG:return"debug";case te.ERROR:return"error";case te.SILENT:return"silent";default:return u("Unknown log level: "+r())}},enumerable:!0,configurable:!0}),t.setLogLevel=function(t){switch(v("Firestore.setLogLevel",arguments,1),E("Firestore.setLogLevel","string",1,t),t){case"debug":i(te.DEBUG);break;case"error":i(te.ERROR);break;case"silent":i(te.SILENT);break;default:throw new ce(ue.INVALID_ARGUMENT,"Invalid log level: "+t)}},t.prototype._areTimestampsInSnapshotsEnabled=function(){return this._config.settings.timestampsInSnapshots},t}(),to=function(){function t(t,e){this._firestore=t,this._transaction=e}return t.prototype.get=function(t){var e=this;v("Transaction.get",arguments,1);var n=Yt("Transaction.get",t,this._firestore);return this._transaction.lookup([n._key]).then(function(t){if(!t||1!==t.length)return u("Mismatch in docs returned from document lookup.");var r=t[0];return r instanceof Se?new io(e._firestore,n._key,null,!1):new io(e._firestore,n._key,r,!1)})},t.prototype.set=function(t,e,n){_("Transaction.set",arguments,2,3);var r=Yt("Transaction.set",t,this._firestore);n=Qt("Transaction.set",n);var i=n.merge||n.mergeFields?this._firestore._dataConverter.parseMergeData("Transaction.set",e,n.mergeFields):this._firestore._dataConverter.parseSetData("Transaction.set",e);return this._transaction.set(r._key,i),this},t.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];var o,a;return"string"===typeof e||e instanceof rr?(b("Transaction.update",arguments,3),o=Yt("Transaction.update",t,this._firestore),a=this._firestore._dataConverter.parseUpdateVarargs("Transaction.update",e,n,r)):(v("Transaction.update",arguments,2),o=Yt("Transaction.update",t,this._firestore),a=this._firestore._dataConverter.parseUpdateData("Transaction.update",e)),this._transaction.update(o._key,a),this},t.prototype.delete=function(t){v("Transaction.delete",arguments,1);var e=Yt("Transaction.delete",t,this._firestore);return this._transaction.delete(e._key),this},t}(),eo=function(){function t(t){this._firestore=t,this._mutations=[],this._committed=!1}return t.prototype.set=function(t,e,n){_("WriteBatch.set",arguments,2,3),this.verifyNotCommitted();var r=Yt("WriteBatch.set",t,this._firestore);n=Qt("WriteBatch.set",n);var i=n.merge||n.mergeFields?this._firestore._dataConverter.parseMergeData("WriteBatch.set",e,n.mergeFields):this._firestore._dataConverter.parseSetData("WriteBatch.set",e);return this._mutations=this._mutations.concat(i.toMutations(r._key,yn.NONE)),this},t.prototype.update=function(t,e,n){for(var r=[],i=3;i<arguments.length;i++)r[i-3]=arguments[i];this.verifyNotCommitted();var o,a;return"string"===typeof e||e instanceof rr?(b("WriteBatch.update",arguments,3),o=Yt("WriteBatch.update",t,this._firestore),a=this._firestore._dataConverter.parseUpdateVarargs("WriteBatch.update",e,n,r)):(v("WriteBatch.update",arguments,2),o=Yt("WriteBatch.update",t,this._firestore),a=this._firestore._dataConverter.parseUpdateData("WriteBatch.update",e)),this._mutations=this._mutations.concat(a.toMutations(o._key,yn.exists(!0))),this},t.prototype.delete=function(t){v("WriteBatch.delete",arguments,1),this.verifyNotCommitted();var e=Yt("WriteBatch.delete",t,this._firestore);return this._mutations=this._mutations.concat(new _n(e._key,yn.NONE)),this},t.prototype.commit=function(){return re.__awaiter(this,void 0,void 0,function(){return re.__generator(this,function(t){return this.verifyNotCommitted(),this._committed=!0,this._mutations.length>0?[2,this._firestore.ensureClientConfigured().write(this._mutations)]:[2]})})},t.prototype.verifyNotCommitted=function(){if(this._committed)throw new ce(ue.FAILED_PRECONDITION,"A write batch can no longer be used after commit() has been called.")},t}(),no=function(){function t(t,e){this._key=t,this.firestore=e,this._firestoreClient=this.firestore.ensureClientConfigured()}return t.forPath=function(e,n){if(e.length%2!==0)throw new ce(ue.INVALID_ARGUMENT,"Invalid document reference. Document references must have an even number of segments, but "+e.canonicalString()+" has "+e.length);return new t(new Ee(e),n)},Object.defineProperty(t.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"parent",{get:function(){return new uo(this._key.path.popLast(),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"path",{get:function(){return this._key.path.canonicalString()},enumerable:!0,configurable:!0}),t.prototype.collection=function(t){if(v("DocumentReference.collection",arguments,1),E("DocumentReference.collection","string",1,t),!t)throw new ce(ue.INVALID_ARGUMENT,"Must provide a non-empty collection name to collection()");var e=be.fromString(t);return new uo(this._key.path.child(e),this.firestore)},t.prototype.isEqual=function(e){if(!(e instanceof t))throw M("isEqual","DocumentReference",1,e);return this.firestore===e.firestore&&this._key.isEqual(e._key)},t.prototype.set=function(t,e){_("DocumentReference.set",arguments,1,2),e=Qt("DocumentReference.set",e);var n=e.merge||e.mergeFields?this.firestore._dataConverter.parseMergeData("DocumentReference.set",t,e.mergeFields):this.firestore._dataConverter.parseSetData("DocumentReference.set",t);return this._firestoreClient.write(n.toMutations(this._key,yn.NONE))},t.prototype.update=function(t,e){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i;return"string"===typeof t||t instanceof rr?(b("DocumentReference.update",arguments,2),i=this.firestore._dataConverter.parseUpdateVarargs("DocumentReference.update",t,e,n)):(v("DocumentReference.update",arguments,1),i=this.firestore._dataConverter.parseUpdateData("DocumentReference.update",t)),this._firestoreClient.write(i.toMutations(this._key,yn.exists(!0)))},t.prototype.delete=function(){return v("DocumentReference.delete",arguments,0),this._firestoreClient.write([new _n(this._key,yn.NONE)])},t.prototype.onSnapshot=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];_("DocumentReference.onSnapshot",arguments,1,4);var n,r={includeMetadataChanges:!1},i=0;"object"!==typeof t[i]||Ut(t[i])||(r=t[i],L("DocumentReference.onSnapshot",r,["includeMetadataChanges"]),C("DocumentReference.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++);var o={includeMetadataChanges:r.includeMetadataChanges};return Ut(t[i])?n=t[i]:(E("DocumentReference.onSnapshot","function",i,t[i]),T("DocumentReference.onSnapshot","function",i+1,t[i+1]),T("DocumentReference.onSnapshot","function",i+2,t[i+2]),n={next:t[i],error:t[i+1],complete:t[i+2]}),this.onSnapshotInternal(o,n)},t.prototype.onSnapshotInternal=function(t,e){var n=this,r=function(t){console.error("Uncaught Error in onSnapshot:",t)};e.error&&(r=e.error.bind(e));var i=new Ai({next:function(t){if(e.next){c(t.docs.size<=1,"Too many documents returned on a document query");var r=t.docs.get(n._key);e.next(new io(n.firestore,n._key,r,t.fromCache))}},error:r}),o=this._firestoreClient.listen(Je.atPath(this._key.path),i,t);return function(){i.mute(),n._firestoreClient.unlisten(o)}},t.prototype.get=function(t){var e=this;return L("DocumentReference.get",t,["source"]),t&&A("DocumentReference.get","options","source",t.source,["default","server","cache"]),new Promise(function(n,r){t&&"cache"===t.source?e.firestore.ensureClientConfigured().getDocumentFromLocalCache(e._key).then(function(t){n(new io(e.firestore,e._key,t,!0))},r):e.getViaSnapshotListener(n,r,t)})},t.prototype.getViaSnapshotListener=function(t,e,n){var r=this.onSnapshotInternal({includeMetadataChanges:!0,waitForSyncWhenOnline:!0},{next:function(i){r(),!i.exists&&i.metadata.fromCache?e(new ce(ue.UNAVAILABLE,"Failed to get document because the client is offline.")):i.exists&&i.metadata.fromCache&&n&&"server"===n.source?e(new ce(ue.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.)')):t(i)},error:e})},t}(),ro=function(){function t(t,e){this.hasPendingWrites=t,this.fromCache=e}return t.prototype.isEqual=function(t){return this.hasPendingWrites===t.hasPendingWrites&&this.fromCache===t.fromCache},t}(),io=function(){function t(t,e,n,r){this._firestore=t,this._key=e,this._document=n,this._fromCache=r}return t.prototype.data=function(t){return _("DocumentSnapshot.data",arguments,0,1),t=zt("DocumentSnapshot.data",t),this._document?this.convertObject(this._document.data,De.fromSnapshotOptions(t,this._firestore._areTimestampsInSnapshotsEnabled())):void 0},t.prototype.get=function(t,e){if(_("DocumentSnapshot.get",arguments,1,2),e=zt("DocumentSnapshot.get",e),this._document){var n=this._document.data.field(Wt("DocumentSnapshot.get",t));if(void 0!==n)return this.convertValue(n,De.fromSnapshotOptions(e,this._firestore._areTimestampsInSnapshotsEnabled()))}},Object.defineProperty(t.prototype,"id",{get:function(){return this._key.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"ref",{get:function(){return new no(this._key,this._firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"exists",{get:function(){return null!==this._document},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"metadata",{get:function(){return new ro(null!==this._document&&this._document.hasLocalMutations,this._fromCache)},enumerable:!0,configurable:!0}),t.prototype.isEqual=function(e){if(!(e instanceof t))throw M("isEqual","DocumentSnapshot",1,e);return this._firestore===e._firestore&&this._fromCache===e._fromCache&&this._key.isEqual(e._key)&&(null===this._document?null===e._document:this._document.isEqual(e._document))},t.prototype.convertObject=function(t,e){var n=this,r={};return t.forEach(function(t,i){r[t]=n.convertValue(i,e)}),r},t.prototype.convertValue=function(t,e){if(t instanceof He)return this.convertObject(t,e);if(t instanceof Ge)return this.convertArray(t,e);if(t instanceof We){var n=t.value(e),r=this._firestore.ensureClientConfigured().databaseId();return t.databaseId.isEqual(r)||a("Document "+this._key.path+" contains a document reference within a different database ("+t.databaseId.projectId+"/"+t.databaseId.database+") which is not supported. It will be treated as a reference in the current database ("+r.projectId+"/"+r.database+") instead."),new no(n,this._firestore)}return t.value(e)},t.prototype.convertArray=function(t,e){var n=this;return t.internalValue.map(function(t){return n.convertValue(t,e)})},t}(),oo=function(t){function e(e,n,r,i){return t.call(this,e,n,r,i)||this}return re.__extends(e,t),e.prototype.data=function(e){var n=t.prototype.data.call(this,e);return c("object"===typeof n,"Document in a QueryDocumentSnapshot should exist"),n},e}(io),ao=function(){function t(t,e){this._query=t,this.firestore=e}return t.prototype.where=function(e,n,r){v("Query.where",arguments,3),E("Query.where","string",2,n),x("Query.where",3,r);var i,o=Wt("Query.where",e),a=$e.fromString(n);if(o.isKeyField()){if(a===$e.ARRAY_CONTAINS)throw new ce(ue.INVALID_ARGUMENT,"Invalid Query. You can't perform array-contains queries on FieldPath.documentId() since document IDs are not arrays.");if("string"===typeof r){if(-1!==r.indexOf("/"))throw new ce(ue.INVALID_ARGUMENT,"Function Query.where() requires its third parameter to be a valid document ID if the first parameter is FieldPath.documentId(), but it contains a slash.");if(""===r)throw new ce(ue.INVALID_ARGUMENT,"Function Query.where() requires its third parameter to be a valid document ID if the first parameter is FieldPath.documentId(), but it was an empty string.");var s=this._query.path.child(new be([r]));c(s.length%2===0,"Path should be a document key"),i=new We(this.firestore._databaseId,new Ee(s))}else{if(!(r instanceof no))throw new ce(ue.INVALID_ARGUMENT,"Function Query.where() requires its third parameter to be a string or a DocumentReference if the first parameter is FieldPath.documentId(), but it was: "+D(r)+".");var u=r;i=new We(this.firestore._databaseId,u._key)}}else i=this.firestore._dataConverter.parseQueryValue("Query.where",r);var l=X(o,a,i);return this.validateNewFilter(l),new t(this._query.addFilter(l),this.firestore)},t.prototype.orderBy=function(e,n){_("Query.orderBy",arguments,1,2),T("Query.orderBy","string",2,n);var r;if(void 0===n||"asc"===n)r=nn.ASCENDING;else{if("desc"!==n)throw new ce(ue.INVALID_ARGUMENT,"Function Query.orderBy() has unknown direction '"+n+"', expected 'asc' or 'desc'.");r=nn.DESCENDING}if(null!==this._query.startAt)throw new ce(ue.INVALID_ARGUMENT,"Invalid query. You must not call Query.startAt() or Query.startAfter() before calling Query.orderBy().");if(null!==this._query.endAt)throw new ce(ue.INVALID_ARGUMENT,"Invalid query. You must not call Query.endAt() or Query.endBefore() before calling Query.orderBy().");var i=Wt("Query.orderBy",e),o=new on(i,r);return this.validateNewOrderBy(o),new t(this._query.addOrderBy(o),this.firestore)},t.prototype.limit=function(e){if(v("Query.limit",arguments,1),E("Query.limit","number",1,e),e<=0)throw new ce(ue.INVALID_ARGUMENT,"Invalid Query. Query limit ("+e+") is invalid. Limit must be positive.");return new t(this._query.withLimit(e),this.firestore)},t.prototype.startAt=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];b("Query.startAt",arguments,1);var i=this.boundFromDocOrFields("Query.startAt",e,n,!0);return new t(this._query.withStartAt(i),this.firestore)},t.prototype.startAfter=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];b("Query.startAfter",arguments,1);var i=this.boundFromDocOrFields("Query.startAfter",e,n,!1);return new t(this._query.withStartAt(i),this.firestore)},t.prototype.endBefore=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];b("Query.endBefore",arguments,1);var i=this.boundFromDocOrFields("Query.endBefore",e,n,!0);return new t(this._query.withEndAt(i),this.firestore)},t.prototype.endAt=function(e){for(var n=[],r=1;r<arguments.length;r++)n[r-1]=arguments[r];b("Query.endAt",arguments,1);var i=this.boundFromDocOrFields("Query.endAt",e,n,!1);return new t(this._query.withEndAt(i),this.firestore)},t.prototype.isEqual=function(e){if(!(e instanceof t))throw M("isEqual","Query",1,e);return this.firestore===e.firestore&&this._query.isEqual(e._query)},t.prototype.boundFromDocOrFields=function(t,e,n,r){if(x(t,1,e),e instanceof io){if(n.length>0)throw new ce(ue.INVALID_ARGUMENT,"Too many arguments provided to "+t+"().");var i=e;if(!i.exists)throw new ce(ue.NOT_FOUND,"Can't use a DocumentSnapshot that doesn't exist for "+t+"().");return this.boundFromDocument(t,i._document,r)}var o=[e].concat(n);return this.boundFromFields(t,o,r)},t.prototype.boundFromDocument=function(t,e,n){for(var r=[],i=0,o=this._query.orderBy;i<o.length;i++){var a=o[i];if(a.field.isKeyField())r.push(new We(this.firestore._databaseId,e.key));else{var s=e.field(a.field);if(void 0===s){var u=a.field.canonicalString();throw new ce(ue.INVALID_ARGUMENT,"Invalid query. You are trying to start or end a query using a document for which the field '"+u+"' (used as the orderBy) does not exist.")}r.push(s)}}return new rn(r,n)},t.prototype.boundFromFields=function(t,e,n){var r=this._query.explicitOrderBy;if(e.length>r.length)throw new ce(ue.INVALID_ARGUMENT,"Too many arguments provided to "+t+"(). The number of arguments must be less than or equal to the number of Query.orderBy() clauses");for(var i=[],o=0;o<e.length;o++){var a=e[o];if(r[o].field.isKeyField()){if("string"!==typeof a)throw new ce(ue.INVALID_ARGUMENT,"Invalid query. Expected a string for document ID in "+t+"(), but got a "+typeof a);if(-1!==a.indexOf("/"))throw new ce(ue.INVALID_ARGUMENT,"Invalid query. Document ID '"+a+"' contains a slash in "+t+"()");var s=new Ee(this._query.path.child(a));i.push(new We(this.firestore._databaseId,s))}else{var u=this.firestore._dataConverter.parseQueryValue(t,a);i.push(u)}}return new rn(i,n)},t.prototype.onSnapshot=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];_("Query.onSnapshot",arguments,1,4);var n,r={},i=0;return"object"!==typeof t[i]||Ut(t[i])||(r=t[i],L("Query.onSnapshot",r,["includeMetadataChanges"]),C("Query.onSnapshot","boolean","includeMetadataChanges",r.includeMetadataChanges),i++),Ut(t[i])?n=t[i]:(E("Query.onSnapshot","function",i,t[i]),T("Query.onSnapshot","function",i+1,t[i+1]),T("Query.onSnapshot","function",i+2,t[i+2]),n={next:t[i],error:t[i+1],complete:t[i+2]}),this.onSnapshotInternal(r,n)},t.prototype.onSnapshotInternal=function(t,e){var n=this,r=function(t){console.error("Uncaught Error in onSnapshot:",t)};e.error&&(r=e.error.bind(e));var i=new Ai({next:function(t){e.next&&e.next(new so(n.firestore,n._query,t))},error:r}),o=this.firestore.ensureClientConfigured(),a=o.listen(this._query,i,t);return function(){i.mute(),o.unlisten(a)}},t.prototype.get=function(t){var e=this;return _("Query.get",arguments,0,1),new Promise(function(n,r){t&&"cache"===t.source?e.firestore.ensureClientConfigured().getDocumentsFromLocalCache(e._query).then(function(t){n(new so(e.firestore,e._query,t))},r):e.getViaSnapshotListener(n,r,t)})},t.prototype.getViaSnapshotListener=function(t,e,n){var r=this.onSnapshotInternal({includeMetadataChanges:!0,waitForSyncWhenOnline:!0},{next:function(i){r(),i.metadata.fromCache&&n&&"server"===n.source?e(new ce(ue.UNAVAILABLE,'Failed to get documents from server. (However, these documents may exist in the local cache. Run again without setting source to "server" to retrieve the cached documents.)')):t(i)},error:e})},t.prototype.validateNewFilter=function(t){if(t instanceof Ze)if(t.isInequality()){var e=this._query.getInequalityFilterField();if(null!==e&&!e.isEqual(t.field))throw new ce(ue.INVALID_ARGUMENT,"Invalid query. All where filters with an inequality (<, <=, >, or >=) must be on the same field. But you have inequality filters on '"+e.toString()+"' and '"+t.field.toString()+"'");var n=this._query.getFirstOrderByField();null!==n&&this.validateOrderByAndInequalityMatch(t.field,n)}else if(t.op===$e.ARRAY_CONTAINS&&this._query.hasArrayContainsFilter())throw new ce(ue.INVALID_ARGUMENT,"Invalid query. Queries only support a single array-contains filter.")},t.prototype.validateNewOrderBy=function(t){if(null===this._query.getFirstOrderByField()){var e=this._query.getInequalityFilterField();null!==e&&this.validateOrderByAndInequalityMatch(e,t.field)}},t.prototype.validateOrderByAndInequalityMatch=function(t,e){if(!e.isEqual(t))throw new ce(ue.INVALID_ARGUMENT,"Invalid query. You have a where filter with an inequality (<, <=, >, or >=) on field '"+t.toString()+"' and so you must also use '"+t.toString()+"' as your first Query.orderBy(), but your first Query.orderBy() is on field '"+e.toString()+"' instead.")},t}(),so=function(){function t(t,e,n){this._firestore=t,this._originalQuery=e,this._snapshot=n,this._cachedChanges=null,this._cachedChangesIncludeMetadataChanges=null,this.metadata=new ro(n.hasPendingWrites,n.fromCache)}return Object.defineProperty(t.prototype,"docs",{get:function(){var t=[];return this.forEach(function(e){return t.push(e)}),t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"empty",{get:function(){return this._snapshot.docs.isEmpty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"size",{get:function(){return this._snapshot.docs.size},enumerable:!0,configurable:!0}),t.prototype.forEach=function(t,e){var n=this;_("QuerySnapshot.forEach",arguments,1,2),E("QuerySnapshot.forEach","function",1,t),this._snapshot.docs.forEach(function(r){t.call(e,n.convertToDocumentImpl(r))})},Object.defineProperty(t.prototype,"query",{get:function(){return new ao(this._originalQuery,this._firestore)},enumerable:!0,configurable:!0}),t.prototype.docChanges=function(t){L("QuerySnapshot.docChanges",t,["includeMetadataChanges"]),t&&C("QuerySnapshot.docChanges","boolean","includeMetadataChanges",t.includeMetadataChanges);var e=t&&t.includeMetadataChanges;if(e&&this._snapshot.excludesMetadataChanges)throw new ce(ue.INVALID_ARGUMENT,"To include metadata changes with your document changes, you must also pass { includeMetadataChanges:true } to onSnapshot().");return this._cachedChanges&&this._cachedChangesIncludeMetadataChanges===e||(this._cachedChanges=Xt(this._firestore,e,this._snapshot),this._cachedChangesIncludeMetadataChanges=e),this._cachedChanges},t.prototype.isEqual=function(e){if(!(e instanceof t))throw M("isEqual","QuerySnapshot",1,e);return this._firestore===e._firestore&&this._originalQuery.isEqual(e._originalQuery)&&this._snapshot.isEqual(e._snapshot)},t.prototype.convertToDocumentImpl=function(t){return new oo(this._firestore,t.key,t,this.metadata.fromCache)},t}();["length","forEach","map"].concat("undefined"!==typeof Symbol?[Symbol.iterator]:[]).forEach(function(t){try{Object.defineProperty(so.prototype.docChanges,t,{get:function(){return Gt()}})}catch(t){}});var uo=function(t){function e(e,n){var r=t.call(this,Je.atPath(e),n)||this;if(e.length%2!==1)throw new ce(ue.INVALID_ARGUMENT,"Invalid collection reference. Collection references must have an odd number of segments, but "+e.canonicalString()+" has "+e.length);return r}return re.__extends(e,t),Object.defineProperty(e.prototype,"id",{get:function(){return this._query.path.lastSegment()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"parent",{get:function(){var t=this._query.path.popLast();return t.isEmpty()?null:new no(new Ee(t),this.firestore)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"path",{get:function(){return this._query.path.canonicalString()},enumerable:!0,configurable:!0}),e.prototype.doc=function(t){if(_("CollectionReference.doc",arguments,0,1),0===arguments.length&&(t=le.newId()),E("CollectionReference.doc","string",1,t),""===t)throw new ce(ue.INVALID_ARGUMENT,"Document path must be a non-empty string");var e=be.fromString(t);return no.forPath(this._query.path.child(e),this.firestore)},e.prototype.add=function(t){v("CollectionReference.add",arguments,1),E("CollectionReference.add","object",1,t);var e=this.doc();return e.set(t).then(function(){return e})},e}(ao),co=h(Zi,"Use firebase.firestore() instead."),lo=h(to,"Use firebase.firestore().runTransaction() instead."),ho=h(eo,"Use firebase.firestore().batch() instead."),fo=h(no,"Use firebase.firestore().doc() instead."),po=h(io),yo=h(oo),mo=h(ao),go=h(so),vo=h(uo,"Use firebase.firestore().collection() instead."),bo={Firestore:co,GeoPoint:pe,Timestamp:de,Blob:fe,Transaction:lo,WriteBatch:ho,DocumentReference:fo,DocumentSnapshot:po,Query:mo,QueryDocumentSnapshot:yo,QuerySnapshot:go,CollectionReference:vo,FieldPath:rr,FieldValue:ji,setLogLevel:Zi.setLogLevel};Zt(ee),e.registerFirestore=Zt},function(module,exports,__webpack_require__){(function(global){(function(){function l(t){return"string"==typeof t}function n(t,e){t=t.split("."),e=e||k;for(var n=0;n<t.length;n++)if(null==(e=e[t[n]]))return null;return e}function aa(){}function ba(t){var e=typeof t;if("object"==e){if(!t)return"null";if(t instanceof Array)return"array";if(t instanceof Object)return e;var n=Object.prototype.toString.call(t);if("[object Window]"==n)return"object";if("[object Array]"==n||"number"==typeof t.length&&"undefined"!=typeof t.splice&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("splice"))return"array";if("[object Function]"==n||"undefined"!=typeof t.call&&"undefined"!=typeof t.propertyIsEnumerable&&!t.propertyIsEnumerable("call"))return"function"}else if("function"==e&&"undefined"==typeof t.call)return"object";return e}function p(t){return"array"==ba(t)}function ca(t){var e=ba(t);return"array"==e||"object"==e&&"number"==typeof t.length}function da(t){return"function"==ba(t)}function ea(t){var e=typeof t;return"object"==e&&null!=t||"function"==e}function ha(t,e,n){return t.call.apply(t.bind,arguments)}function ia(t,e,n){if(!t)throw Error();if(2<arguments.length){var r=Array.prototype.slice.call(arguments,2);return function(){var n=Array.prototype.slice.call(arguments);return Array.prototype.unshift.apply(n,r),t.apply(e,n)}}return function(){return t.apply(e,arguments)}}function r(t,e,n){return r=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ha:ia,r.apply(null,arguments)}function ja(t,e){var n=Array.prototype.slice.call(arguments,1);return function(){var e=n.slice();return e.push.apply(e,arguments),t.apply(this,e)}}function u(t,e){function n(){}n.prototype=e.prototype,t.H=e.prototype,t.prototype=new n,t.prototype.constructor=t,t.Ib=function(t,n,r){for(var i=Array(arguments.length-2),o=2;o<arguments.length;o++)i[o-2]=arguments[o];return e.prototype[n].apply(t,i)}}function ka(t){if(Error.captureStackTrace)Error.captureStackTrace(this,ka);else{var e=Error().stack;e&&(this.stack=e)}t&&(this.message=String(t))}function la(t,e){t=t.split("%s");for(var n="",r=t.length-1,i=0;i<r;i++)n+=t[i]+(i<e.length?e[i]:"%s");ka.call(this,n+t[r])}function ma(t,e){throw new la("Failure"+(t?": "+t:""),Array.prototype.slice.call(arguments,1))}function w(){0!=na&&(pa[this[q]||(this[q]=++fa)]=this),this.i=this.i,this.m=this.m}function sa(t){t:{for(var e=ta,n=t.length,r=l(t)?t.split(""):t,i=0;i<n;i++)if(i in r&&e.call(void 0,r[i],i,t)){e=i;break t}e=-1}return 0>e?null:l(t)?t.charAt(e):t[e]}function ua(t){if(!p(t))for(var e=t.length-1;0<=e;e--)delete t[e];t.length=0}function va(t){return Array.prototype.concat.apply([],arguments)}function wa(t){var e=t.length;if(0<e){for(var n=Array(e),r=0;r<e;r++)n[r]=t[r];return n}return[]}function xa(t){return/^[\s\xa0]*$/.test(t)}function za(t,e){return t<e?-1:t>e?1:0}function y(t){return-1!=x.indexOf(t)}function Ca(t,e,n){for(var r in t)e.call(n,t[r],r,t)}function Da(t){var e,n=[],r=0;for(e in t)n[r++]=t[e];return n}function Ea(t){var e,n=[],r=0;for(e in t)n[r++]=e;return n}function Fa(t){var e,n={};for(e in t)n[e]=t[e];return n}function Ha(t,e){for(var n,r,i=1;i<arguments.length;i++){r=arguments[i];for(n in r)t[n]=r[n];for(var o=0;o<Ga.length;o++)n=Ga[o],Object.prototype.hasOwnProperty.call(r,n)&&(t[n]=r[n])}}function Ia(t){return Ia[" "](t),t}function Ja(t,e){var n=Ka;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}function Qa(){var t=k.document;return t?t.documentMode:void 0}function Va(t){return Ja(t,function(){for(var e=0,n=ya(String(Ra)).split("."),r=ya(String(t)).split("."),i=Math.max(n.length,r.length),o=0;0==e&&o<i;o++){var a=n[o]||"",s=r[o]||"";do{if(a=/(\d*)(\D*)(.*)/.exec(a)||["","","",""],s=/(\d*)(\D*)(.*)/.exec(s)||["","","",""],0==a[0].length&&0==s[0].length)break;e=za(0==a[1].length?0:parseInt(a[1],10),0==s[1].length?0:parseInt(s[1],10))||za(0==a[2].length,0==s[2].length)||za(a[2],s[2]),a=a[3],s=s[3]}while(0==e)}return 0<=e})}function A(t,e){this.type=t,this.a=this.target=e,this.Ra=!0}function bb(t,e){if(A.call(this,t?t.type:""),this.relatedTarget=this.a=this.target=null,this.button=this.screenY=this.screenX=this.clientY=this.clientX=0,this.key="",this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1,this.pointerId=0,this.pointerType="",this.c=null,t){var n=this.type=t.type,r=t.changedTouches?t.changedTouches[0]:null;if(this.target=t.target||t.srcElement,this.a=e,e=t.relatedTarget){if(Oa){t:{try{Ia(e.nodeName);var i=!0;break t}catch(t){}i=!1}i||(e=null)}}else"mouseover"==n?e=t.fromElement:"mouseout"==n&&(e=t.toElement);this.relatedTarget=e,null===r?(this.clientX=void 0!==t.clientX?t.clientX:t.pageX,this.clientY=void 0!==t.clientY?t.clientY:t.pageY,this.screenX=t.screenX||0,this.screenY=t.screenY||0):(this.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.button=t.button,this.key=t.key||"",this.ctrlKey=t.ctrlKey,this.altKey=t.altKey,this.shiftKey=t.shiftKey,this.metaKey=t.metaKey,this.pointerId=t.pointerId||0,this.pointerType=l(t.pointerType)?t.pointerType:cb[t.pointerType]||"",this.c=t,t.defaultPrevented&&this.b()}}function fb(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.ga=i,this.key=++eb,this.Z=this.ba=!1}function gb(t){t.Z=!0,t.listener=null,t.proxy=null,t.src=null,t.ga=null}function hb(t){this.src=t,this.a={},this.b=0}function jb(t,e){var n=e.type;if(n in t.a){var r,i=t.a[n],o=qa(i,e);(r=0<=o)&&Array.prototype.splice.call(i,o,1),r&&(gb(e),0==t.a[n].length&&(delete t.a[n],t.b--))}}function ib(t,e,n,r){for(var i=0;i<t.length;++i){var o=t[i];if(!o.Z&&o.listener==e&&o.capture==!!n&&o.ga==r)return i}return-1}function nb(t,e,n,r,i){if(r&&r.once)return ob(t,e,n,r,i);if(p(e)){for(var o=0;o<e.length;o++)nb(t,e[o],n,r,i);return null}return n=pb(n),t&&t[db]?t.Ia(e,n,ea(r)?!!r.capture:!!r,i):qb(t,e,n,!1,r,i)}function qb(t,e,n,r,i,o){if(!e)throw Error("Invalid event type");var a=ea(i)?!!i.capture:!!i,s=rb(t);if(s||(t[kb]=s=new hb(t)),n=s.add(e,n,r,a,o),n.proxy)return n;if(r=sb(),n.proxy=r,r.src=t,r.listener=n,t.addEventListener)ab||(i=a),void 0===i&&(i=!1),t.addEventListener(e.toString(),r,i);else if(t.attachEvent)t.attachEvent(tb(e.toString()),r);else{if(!t.addListener||!t.removeListener)throw Error("addEventListener and attachEvent are unavailable.");t.addListener(r)}return mb++,n}function sb(){var t=ub,e=Za?function(n){return t.call(e.src,e.listener,n)}:function(n){if(!(n=t.call(e.src,e.listener,n)))return n};return e}function ob(t,e,n,r,i){if(p(e)){for(var o=0;o<e.length;o++)ob(t,e[o],n,r,i);return null}return n=pb(n),t&&t[db]?t.Ja(e,n,ea(r)?!!r.capture:!!r,i):qb(t,e,n,!0,r,i)}function vb(t,e,n,r,i){if(p(e))for(var o=0;o<e.length;o++)vb(t,e[o],n,r,i);else r=ea(r)?!!r.capture:!!r,n=pb(n),t&&t[db]?(t=t.f,(e=String(e).toString())in t.a&&(o=t.a[e],-1<(n=ib(o,n,r,i))&&(gb(o[n]),Array.prototype.splice.call(o,n,1),0==o.length&&(delete t.a[e],t.b--)))):t&&(t=rb(t))&&(e=t.a[e.toString()],t=-1,e&&(t=ib(e,n,r,i)),(n=-1<t?e[t]:null)&&wb(n))}function wb(t){if("number"!=typeof t&&t&&!t.Z){var e=t.src;if(e&&e[db])jb(e.f,t);else{var n=t.type,r=t.proxy;e.removeEventListener?e.removeEventListener(n,r,t.capture):e.detachEvent?e.detachEvent(tb(n),r):e.addListener&&e.removeListener&&e.removeListener(r),mb--,(n=rb(e))?(jb(n,t),0==n.b&&(n.src=null,e[kb]=null)):gb(t)}}}function tb(t){return t in lb?lb[t]:lb[t]="on"+t}function xb(t,e,n,r){var i=!0;if((t=rb(t))&&(e=t.a[e.toString()]))for(e=e.concat(),t=0;t<e.length;t++){var o=e[t];o&&o.capture==n&&!o.Z&&(o=yb(o,r),i=i&&!1!==o)}return i}function yb(t,e){var n=t.listener,r=t.ga||t.src;return t.ba&&wb(t),n.call(r,e)}function ub(t,e){if(t.Z)return!0;if(!Za){var r=e||n("window.event");e=new bb(r,this);var i=!0;if(!(0>r.keyCode||void 0!=r.returnValue)){t:{var o=!1;if(0==r.keyCode)try{r.keyCode=-1;break t}catch(t){o=!0}(o||void 0==r.returnValue)&&(r.returnValue=!0)}for(r=[],o=e.a;o;o=o.parentNode)r.push(o);for(t=t.type,o=r.length-1;0<=o;o--){e.a=r[o];var a=xb(r[o],t,!0,e);i=i&&a}for(o=0;o<r.length;o++)e.a=r[o],a=xb(r[o],t,!1,e),i=i&&a}return i}return yb(t,new bb(e,this))}function rb(t){return t=t[kb],t instanceof hb?t:null}function pb(t){return da(t)?t:(t[zb]||(t[zb]=function(e){return t.handleEvent(e)}),t[zb])}function B(){w.call(this),this.f=new hb(this),this.N=this,this.J=null}function Ab(t,e,n,r){if(!(e=t.f.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;o<e.length;++o){var a=e[o];if(a&&!a.Z&&a.capture==n){var s=a.listener,u=a.ga||a.src;a.ba&&jb(t.f,a),i=!1!==s.call(u,r)&&i}}return i&&0!=r.Ra}function Bb(t){return!/^\s*$/.test(t)&&/^[\],:{}\s\u2028\u2029]*$/.test(t.replace(/\\["\\\/bfnrtu]/g,"@").replace(/(?:"[^"\\\n\r\u2028\u2029\x00-\x08\x0a-\x1f]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?)[\s\u2028\u2029]*(?=:|,|]|}|$)/g,"]").replace(/(?:^|:|,)(?:[\s\u2028\u2029]*\[)+/g,""))}function Cb(a){if(a=String(a),Bb(a))try{return eval("("+a+")")}catch(t){}throw Error("Invalid JSON string: "+a)}function Db(t){var e=[];return Eb(new Fb,t,e),e.join("")}function Fb(){}function Eb(t,e,n){if(null==e)n.push("null");else{if("object"==typeof e){if(p(e)){var r=e;e=r.length,n.push("[");for(var i="",o=0;o<e;o++)n.push(i),Eb(t,r[o],n),i=",";return void n.push("]")}if(!(e instanceof String||e instanceof Number||e instanceof Boolean)){n.push("{"),i="";for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&"function"!=typeof(o=e[r])&&(n.push(i),Gb(r,n),n.push(":"),Eb(t,o,n),i=",");return void n.push("}")}e=e.valueOf()}switch(typeof e){case"string":Gb(e,n);break;case"number":n.push(isFinite(e)&&!isNaN(e)?String(e):"null");break;case"boolean":n.push(String(e));break;case"function":n.push("null");break;default:throw Error("Unknown type: "+typeof e)}}}function Gb(t,e){e.push('"',t.replace(Ib,function(t){var e=Hb[t];return e||(e="\\u"+(65536|t.charCodeAt(0)).toString(16).substr(1),Hb[t]=e),e}),'"')}function Jb(t,e){this.c=t,this.f=e,this.b=0,this.a=null}function Kb(){this.b=this.a=null}function Ob(){var t=Pb,e=null;return t.a&&(e=t.a,t.a=t.a.next,t.a||(t.b=null),e.next=null),e}function Lb(){this.next=this.b=this.a=null}function Qb(t){k.setTimeout(function(){throw t},0)}function Sb(){var t=k.MessageChannel;if("undefined"===typeof t&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!y("Presto")&&(t=function(){var t=document.createElement("IFRAME");t.style.display="none",t.src="",document.documentElement.appendChild(t);var e=t.contentWindow;t=e.document,t.open(),t.write(""),t.close();var n="callImmediate"+Math.random(),i="file:"==e.location.protocol?"*":e.location.protocol+"//"+e.location.host;t=r(function(t){"*"!=i&&t.origin!=i||t.data!=n||this.port1.onmessage()},this),e.addEventListener("message",t,!1),this.port1={},this.port2={postMessage:function(){e.postMessage(n,i)}}}),"undefined"!==typeof t&&!y("Trident")&&!y("MSIE")){var e=new t,n={},i=n;return e.port1.onmessage=function(){if(void 0!==n.next){n=n.next;var t=n.za;n.za=null,t()}},function(t){i.next={za:t},i=i.next,e.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?function(t){var e=document.createElement("SCRIPT");e.onreadystatechange=function(){e.onreadystatechange=null,e.parentNode.removeChild(e),e=null,t(),t=null},document.documentElement.appendChild(e)}:function(t){k.setTimeout(t,0)}}function Ub(){if(-1!=String(k.Promise).indexOf("[native code]")){var t=k.Promise.resolve(void 0);Tb=function(){t.then(Vb)}}else Tb=function(){var t=Vb;!da(k.setImmediate)||k.Window&&k.Window.prototype&&!y("Edge")&&k.Window.prototype.setImmediate==k.setImmediate?(Rb||(Rb=Sb()),Rb(t)):k.setImmediate(t)}}function Vb(){for(var t;t=Ob();){try{t.a.call(t.b)}catch(t){Qb(t)}var e=Nb;e.f(t),100>e.b&&(e.b++,t.next=e.a,e.a=t)}Wb=!1}function Xb(e,n){B.call(this),this.b=e||1,this.a=n||k,this.c=r(this.qb,this),this.g=t()}function Yb(t){t.ea=!1,t.O&&(t.a.clearTimeout(t.O),t.O=null)}function Zb(t,e,n){if(da(t))n&&(t=r(t,n));else{if(!t||"function"!=typeof t.handleEvent)throw Error("Invalid listener argument");t=r(t.handleEvent,t)}return 2147483647<Number(e)?-1:k.setTimeout(t,e||0)}function $b(t,e,n){w.call(this),this.f=null!=n?r(t,n):t,this.c=e,this.b=r(this.kb,this),this.a=[]}function ac(t){t.Y=Zb(t.b,t.c),t.f.apply(null,t.a)}function bc(t){w.call(this),this.b=t,this.a={}}function dc(t,e,n,r){p(n)||(n&&(cc[0]=n.toString()),n=cc);for(var i=0;i<n.length;i++){var o=nb(e,n[i],r||t.handleEvent,!1,t.b||t);if(!o)break;t.a[o.key]=o}}function ec(t){Ca(t.a,function(t,e){this.a.hasOwnProperty(e)&&wb(t)},t),t.a={}}function fc(t,e,n){this.reset(t,e,n,void 0,void 0)}function hc(t){this.f=t,this.b=this.c=this.a=null}function C(t,e){this.name=t,this.value=e}function nc(t){return t.c?t.c:t.a?nc(t.a):(ma("Root logger has no level set."),null)}function qc(t){pc||(pc=new hc(""),oc[""]=pc,pc.c=lc);var e;if(!(e=oc[t])){e=new hc(t);var n=t.lastIndexOf("."),r=t.substr(n+1);n=qc(t.substr(0,n)),n.b||(n.b={}),n.b[r]=e,e.a=n,oc[t]=e}return e}function D(t,e){t&&t.log(jc,e,void 0)}function rc(t,e){t&&t.log(kc,e,void 0)}function E(t,e){t&&t.log(mc,e,void 0)}function sc(){this.a=qc("goog.labs.net.webChannel.WebChannelDebug"),this.b=!0}function tc(t,e,n,r,i,o){F(t,function(){if(t.b)if(o)for(var a="",s=o.split("&"),u=0;u<s.length;u++){var c=s[u].split("=");if(1<c.length){var l=c[0];c=c[1];var h=l.split("_");a=2<=h.length&&"type"==h[1]?a+(l+"=")+c+"&":a+(l+"=redacted&")}}else a=null;else a=o;return"XMLHTTP REQ ("+r+") [attempt "+i+"]: "+e+"\n"+n+"\n"+a})}function uc(t,e,n,r,i,o,a){F(t,function(){return"XMLHTTP RESP ("+r+") [ attempt "+i+"]: "+e+"\n"+n+"\n"+o+" "+a})}function G(t,e,n,r){F(t,function(){return"XMLHTTP TEXT ("+e+"): "+vc(t,n)+(r?" "+r:"")})}function wc(t,e){F(t,function(){return"TIMEOUT: "+e})}function H(t,e){E(t.a,e)}function xc(t,e,n){(t=t.a)&&t.log(ic,n||"Exception",e)}function F(t,e){rc(t.a,e)}function J(t,e){(t=t.a)&&t.log(ic,e,void 0)}function vc(t,e){if(!t.b)return e;if(!e)return null;try{var n=JSON.parse(e);if(n)for(var r=0;r<n.length;r++)if(p(n[r])){var i=n[r];if(!(2>i.length)){var o=i[1];if(p(o)&&!(1>o.length)){var a=o[0];if("noop"!=a&&"stop"!=a&&"close"!=a)for(var s=1;s<o.length;s++)o[s]=""}}}return Db(n)}catch(n){return H(t,"Exception parsing expected JS array - probably was not JS"),e}}function zc(t){A.call(this,"serverreachability",t)}function Ac(t){yc.dispatchEvent(new zc(yc,t))}function Bc(t){A.call(this,"statevent",t)}function K(t){yc.dispatchEvent(new Bc(yc,t))}function Cc(t){A.call(this,"timingevent",t)}function Dc(t,e,n){yc.dispatchEvent(new Cc(yc,t,e,n))}function Ec(t,e){if(!da(t))throw Error("Fn must not be null and must be a function");return k.setTimeout(function(){t()},e)}function Hc(){}function Ic(t){var e;return(e=t.a)||(e={},Jc(t)&&(e[0]=!0,e[1]=!0),e=t.a=e),e}function Kc(){}function Mc(){A.call(this,"d")}function Nc(){A.call(this,"c")}function Pc(){}function Qc(t){return(t=Jc(t))?new ActiveXObject(t):new XMLHttpRequest}function Jc(t){if(!t.b&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var e=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],n=0;n<e.length;n++){var r=e[n];try{return new ActiveXObject(r),t.b=r}catch(t){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed")}return t.b}function L(t,e,n,r){this.i=t,this.b=e,this.c=n,this.T=r||1,this.L=new bc(this),this.R=Rc,t=Na?125:void 0,this.S=new Xb(t),this.j=null,this.f=!1,this.l=this.g=this.h=this.J=this.D=this.U=this.s=null,this.u=[],this.a=null,this.G=0,this.m=this.o=null,this.C=-1,this.B=!1,this.N=0,this.I=null,this.v=this.X=this.K=!1}function Sc(t,e){switch(t){case 0:return"Non-200 return code ("+e+")";case 1:return"XMLHTTP failure (no data)";case 2:return"HttpConnection timeout";default:return"Unknown error"}}function Vc(t,e,n){t.J=1,t.h=Wc(M(e)),t.l=n,t.K=!0,Xc(t,null)}function Yc(t,e,n,r){t.J=1,t.h=Wc(M(e)),t.l=null,t.K=n,Xc(t,r)}function Xc(e,n){e.D=t(),Zc(e),e.g=M(e.h),$c(e.g,"t",e.T),e.G=0,e.a=e.i.ca(e.i.ia()?n:null),0<e.N&&(e.I=new $b(r(e.Sa,e,e.a),e.N)),dc(e.L,e.a,"readystatechange",e.nb),n=e.j?Fa(e.j):{},e.l?(e.o||(e.o="POST"),n["Content-Type"]="application/x-www-form-urlencoded",e.a.fa(e.g,e.o,e.l,n)):(e.o="GET",e.a.fa(e.g,e.o,null,n)),Ac(1),tc(e.b,e.o,e.g,e.c,e.T,e.l)}function ad(t){var e=N(t.a),n=t.a.Ga(),r=t.a.W();if(!(3>e||3==e&&!Na&&!t.a.V())){t.B||4!=e||7==n||Ac(8==n||0>=r?3:2),bd(t);var i=t.a.W();t.C=i,(n=t.a.V())||H(t.b,function(){return"No response text for uri "+t.g+" status "+i}),t.f=200==i,uc(t.b,t.o,t.g,t.c,t.T,e,i),t.f?((r=cd(t))&&(G(t.b,t.c,r,"Initial handshake response via X-HTTP-Initial-Response"),t.v=!0,dd(t,r)),t.K?(ed(t,e,n),Na&&t.f&&3==e&&fd(t)):(G(t.b,t.c,n,null),dd(t,n)),4==e&&gd(t),t.f&&!t.B&&(4==e?t.i.ta(t):(t.f=!1,Zc(t)))):(400==i&&0<n.indexOf("Unknown SID")?(t.m=3,K(12),D(t.b.a,"XMLHTTP Unknown SID ("+t.c+")")):(t.m=0,K(13),D(t.b.a,"XMLHTTP Bad status "+i+" ("+t.c+")")),gd(t),hd(t))}}function cd(t){return!t.X||t.v?null:t.a&&(t=id(t.a,"X-HTTP-Initial-Response"))&&!xa(t)?t:null}function ed(t,e,n){for(var r=!0;!t.B&&t.G<n.length;){var i=jd(t,n);if(i==Uc){4==e&&(t.m=4,K(14),r=!1),G(t.b,t.c,null,"[Incomplete Response]");break}if(i==Tc){t.m=4,K(15),G(t.b,t.c,n,"[Invalid Chunk]"),r=!1;break}G(t.b,t.c,i,null),dd(t,i)}4==e&&0==n.length&&(t.m=1,K(16),r=!1),t.f=t.f&&r,r||(G(t.b,t.c,n,"[Invalid Chunked Response]"),gd(t),hd(t))}function fd(t){dc(t.L,t.S,"tick",t.mb),t.S.start()}function jd(t,e){var n=t.G,r=e.indexOf("\n",n);return-1==r?Uc:(n=Number(e.substring(n,r)),isNaN(n)?Tc:(r+=1)+n>e.length?Uc:(e=e.substr(r,n),t.G=r+n,e))}function Zc(e){e.U=t()+e.R,kd(e,e.R)}function kd(t,e){if(null!=t.s)throw Error("WatchDog timer not null");t.s=Ec(r(t.lb,t),e)}function bd(t){t.s&&(k.clearTimeout(t.s),t.s=null)}function hd(t){t.i.La()||t.B||t.i.ta(t)}function gd(t){bd(t);var e=t.I;e&&"function"==typeof e.$&&e.$(),t.I=null,Yb(t.S),ec(t.L),t.a&&(e=t.a,t.a=null,e.abort(),e.$())}function dd(t,e){try{t.i.Oa(t,e),Ac(4)}catch(e){xc(t.b,e,"Error in httprequest callback")}}function ld(t){if(t.A&&"function"==typeof t.A)return t.A();if(l(t))return t.split("");if(ca(t)){for(var e=[],n=t.length,r=0;r<n;r++)e.push(t[r]);return e}return Da(t)}function md(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(ca(t)||l(t))ra(t,e,void 0);else{if(t.M&&"function"==typeof t.M)var n=t.M();else if(t.A&&"function"==typeof t.A)n=void 0;else if(ca(t)||l(t)){n=[];for(var r=t.length,i=0;i<r;i++)n.push(i)}else n=Ea(t);r=ld(t),i=r.length;for(var o=0;o<i;o++)e.call(void 0,r[o],n&&n[o],t)}}function O(t,e){this.b={},this.a=[],this.c=0;var n=arguments.length;if(1<n){if(n%2)throw Error("Uneven number of arguments");for(var r=0;r<n;r+=2)this.set(arguments[r],arguments[r+1])}else if(t)if(t instanceof O)for(n=t.M(),r=0;r<n.length;r++)this.set(n[r],t.get(n[r]));else for(r in t)this.set(r,t[r])}function od(t){t.b={},t.a.length=0,t.c=0}function pd(t,e){return!!P(t.b,e)&&(delete t.b[e],t.c--,t.a.length>2*t.c&&nd(t),!0)}function nd(t){if(t.c!=t.a.length){for(var e=0,n=0;e<t.a.length;){var r=t.a[e];P(t.b,r)&&(t.a[n++]=r),e++}t.a.length=n}if(t.c!=t.a.length){var i={};for(n=e=0;e<t.a.length;)r=t.a[e],P(i,r)||(t.a[n++]=r,i[r]=1),e++;t.a.length=n}}function P(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function rd(t,e){if(t){t=t.split("&");for(var n=0;n<t.length;n++){var r=t[n].indexOf("="),i=null;if(0<=r){var o=t[n].substring(0,r);i=t[n].substring(r+1)}else o=t[n];e(o,i?decodeURIComponent(i.replace(/\+/g," ")):"")}}}function Q(t,e){this.b=this.j=this.f="",this.i=null,this.g=this.a="",this.h=!1;var n;t instanceof Q?(this.h=void 0!==e?e:t.h,sd(this,t.f),this.j=t.j,td(this,t.b),ud(this,t.i),this.a=t.a,vd(this,wd(t.c)),this.g=t.g):t&&(n=String(t).match(qd))?(this.h=!!e,sd(this,n[1]||"",!0),this.j=xd(n[2]||""),td(this,n[3]||"",!0),ud(this,n[4]),this.a=xd(n[5]||"",!0),vd(this,n[6]||"",!0),this.g=xd(n[7]||"")):(this.h=!!e,this.c=new yd(null,this.h))}function M(t){return new Q(t)}function sd(t,e,n){t.f=n?xd(e,!0):e,t.f&&(t.f=t.f.replace(/:$/,""))}function td(t,e,n){t.b=n?xd(e,!0):e}function ud(t,e){if(e){if(e=Number(e),isNaN(e)||0>e)throw Error("Bad port number "+e);t.i=e}else t.i=null}function vd(t,e,n){e instanceof yd?(t.c=e,Ed(t.c,t.h)):(n||(e=zd(e,Fd)),t.c=new yd(e,t.h))}function R(t,e,n){t.c.set(e,n)}function $c(t,e,n){p(n)||(n=[String(n)]),Gd(t.c,e,n)}function Wc(e){return R(e,"zx",Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^t()).toString(36)),e}function Hd(t){return t instanceof Q?M(t):new Q(t,void 0)}function Id(t,e,n,r){var i=new Q(null,void 0);return t&&sd(i,t),e&&td(i,e),n&&ud(i,n),r&&(i.a=r),i}function xd(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function zd(t,e,n){return l(t)?(t=encodeURI(t).replace(e,Jd),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Jd(t){return t=t.charCodeAt(0),"%"+(t>>4&15).toString(16)+(15&t).toString(16)}function yd(t,e){this.b=this.a=null,this.c=t||null,this.f=!!e}function S(t){t.a||(t.a=new O,t.b=0,t.c&&rd(t.c,function(e,n){t.add(decodeURIComponent(e.replace(/\+/g," ")),n)}))}function Ld(t,e){S(t),e=Kd(t,e),P(t.a.b,e)&&(t.c=null,t.b-=t.a.get(e).length,pd(t.a,e))}function Md(t,e){return S(t),e=Kd(t,e),P(t.a.b,e)}function Gd(t,e,n){Ld(t,e),0<n.length&&(t.c=null,t.a.set(Kd(t,e),wa(n)),t.b+=n.length)}function wd(t){var e=new yd;return e.c=t.c,t.a&&(e.a=new O(t.a),e.b=t.b),e}function Kd(t,e){return e=String(e),t.f&&(e=e.toLowerCase()),e}function Ed(t,e){e&&!t.f&&(S(t),t.c=null,t.a.forEach(function(t,e){var n=e.toLowerCase();e!=n&&(Ld(this,e),Gd(this,n,t))},t)),t.f=e}function Nd(){this.a=t()}function Pd(){Od||(Od=new Nd)}function Qd(){Od||(Od=new Nd)}function Rd(t,e){this.a=t,this.b=e,this.c=this.i=null,this.h=!1,this.m=null,this.f=-1,this.l=this.g=null}function Sd(t){H(t.b,"TestConnection: starting stage 2");var e=t.a.I.a;if(null!=e)H(t.b,function(){return"Buffered"}),K(4),e?(K(10),Td(t.a,t,!1)):(K(11),Td(t.a,t,!0));else{t.c=new L(t,t.b,void 0,void 0),t.c.j=t.i;var n=Ud(t.a,t.g,t.m);K(4),$c(n,"TYPE","xmlhttp");var r=t.a.j,i=t.a.K;r&&i&&R(n,r,i),Yc(t.c,n,!1,t.g)}}function Wd(){this.a=this.b=null}function Xd(){this.a=new O}function Yd(t){var e=typeof t;return"object"==e&&t||"function"==e?"o"+(t[q]||(t[q]=++fa)):e.charAt(0)+t}function Zd(t,e){this.a=t,this.b=e}function $d(t){this.g=t||ae,k.PerformanceNavigationTiming?(t=k.performance.getEntriesByType("navigation"),t=0<t.length&&("hq"==t[0].nextHopProtocol||"h2"==t[0].nextHopProtocol)):t=!!(k.oa&&k.oa.Ma&&k.oa.Ma()&&k.oa.Ma().Jb),this.f=t?this.g:1,this.a=null,1<this.f&&(this.a=new Xd),this.b=null,this.c=[]}function be(t,e){t.a||-1==e.indexOf("spdy")&&-1==e.indexOf("quic")&&-1==e.indexOf("h2")||(t.f=t.g,t.a=new Xd,t.b&&(ce(t,t.b),t.b=null))}function de(t){return!!t.b||!!t.a&&t.a.a.c>=t.f}function ee(t,e){return t.b?t=t.b==e:t.a?(e=Yd(e),t=P(t.a.a.b,e)):t=!1,t}function ce(t,e){t.a?t.a.add(e):t.b=e}function fe(t,e){if(t.b&&t.b==e)t.b=null;else{var n;(n=t.a)&&(n=Yd(e),n=P(t.a.a.b,n)),n&&pd(t.a.a,Yd(e))}}function ge(t){if(null!=t.b)return t.c.concat(t.b.u);if(null!=t.a&&0!=t.a.a.c){var e=t.c;return ra(t.a.A(),function(t){e=e.concat(t.u)}),e}return wa(t.c)}function he(t,e){t.c=t.c.concat(e)}function ie(){}function je(){this.a=new ie}function ke(t,e,n){var r=n||"";try{md(t,function(t,n){var i=t;ea(t)&&(i=Db(t)),e.push(r+n+"="+encodeURIComponent(i))})}catch(t){throw e.push(r+"type="+encodeURIComponent("_badmap")),t}}function le(t,e){var n=new sc;H(n,"TestLoadImage: loading "+t);var r=new Image;r.onload=ja(me,n,r,"TestLoadImage: loaded",!0,e),r.onerror=ja(me,n,r,"TestLoadImage: error",!1,e),r.onabort=ja(me,n,r,"TestLoadImage: abort",!1,e),r.ontimeout=ja(me,n,r,"TestLoadImage: timeout",!1,e),k.setTimeout(function(){r.ontimeout&&r.ontimeout()},1e4),r.src=t}function me(t,e,n,r,i){try{H(t,n),e.onload=null,e.onerror=null,e.onabort=null,e.ontimeout=null,i(r)}catch(e){xc(t,e)}}function T(t){B.call(this),this.headers=new O,this.s=t||null,this.c=!1,this.D=this.a=null,this.K=this.B="",this.j=0,this.g="",this.h=this.I=this.u=this.G=!1,this.l=0,this.C=null,this.L=ne,this.v=this.o=!1}function se(t){return z&&Va(9)&&"number"==typeof t.timeout&&void 0!==t.ontimeout}function ta(t){return"content-type"==t.toLowerCase()}function qe(t,e){t.c=!1,t.a&&(t.h=!0,t.a.abort(),t.h=!1),t.g=e,t.j=5,te(t),ue(t)}function te(t){t.G||(t.G=!0,t.dispatchEvent("complete"),t.dispatchEvent("error"))}function ve(t){if(t.c&&"undefined"!=typeof goog)if(t.D[1]&&4==N(t)&&2==t.W())E(t.b,U(t,"Local request error detected and ignored"));else if(t.u&&4==N(t))Zb(t.Na,0,t);else if(t.dispatchEvent("readystatechange"),4==N(t)){E(t.b,U(t,"Request complete")),t.c=!1;try{var e=t.W();t:switch(e){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var n=!0;break t;default:n=!1}var r;if(!(r=n)){var i;if(i=0===e){var o=String(t.B).match(qd)[1]||null;if(!o&&k.self&&k.self.location){var a=k.self.location.protocol;o=a.substr(0,a.length-1)}i=!oe.test(o?o.toLowerCase():"")}r=i}r?(t.dispatchEvent("complete"),t.dispatchEvent("success")):(t.j=6,t.g=t.Ha()+" ["+t.W()+"]",te(t))}finally{ue(t)}}}function ue(t,e){if(t.a){re(t);var n=t.a,r=t.D[0]?aa:null;t.a=null,t.D=null,e||t.dispatchEvent("ready");try{n.onreadystatechange=r}catch(e){(t=t.b)&&t.log(ic,"Problem encountered resetting onreadystatechange: "+e.message,void 0)}}}function re(t){t.a&&t.v&&(t.a.ontimeout=null),t.C&&(k.clearTimeout(t.C),t.C=null)}function N(t){return t.a?t.a.readyState:0}function id(t,e){return t.a?t.a.getResponseHeader(e):null}function U(t,e){return e+" ["+t.K+" "+t.B+" "+t.W()+"]"}function we(t){var e="";return Ca(t,function(t,n){e+=n,e+=":",e+=t,e+="\r\n"}),e}function xe(t,e,n){t:{for(r in n){var r=!1;break t}r=!0}if(r)return t;if(n=we(n),l(t)){if(e=encodeURIComponent(String(e)),n=null!=n?"="+encodeURIComponent(String(n)):"",e+=n){if(n=t.indexOf("#"),0>n&&(n=t.length),0>(r=t.indexOf("?"))||r>n){r=n;var i=""}else i=t.substring(r+1,n);t=[t.substr(0,r),i,t.substr(n)],n=t[1],t[1]=e?n?n+"&"+e:e:n,t=t[0]+(t[1]?"?"+t[1]:"")+t[2]}return t}return R(t,e,n),t}function ye(t){this.ya=0,this.g=[],this.a=new sc,this.I=new Wd,this.X=this.ua=this.D=this.ja=this.b=this.K=this.j=this.U=this.h=this.L=this.i=null,this.Za=this.R=0,this.Xa=!!n("internalChannelParams.failFast",t),this.ka=this.C=this.s=this.l=this.m=this.f=null,this.u=this.xa=this.N=-1,this.T=this.B=this.v=0,this.Wa=n("internalChannelParams.baseRetryDelayMs",t)||5e3,this.$a=n("internalChannelParams.retryDelaySeedMs",t)||1e4,this.Ya=n("internalChannelParams.forwardChannelMaxRetries",t)||2,this.wa=n("internalChannelParams.forwardChannelRequestTimeoutMs",t)||2e4,this.Ta=t&&t.Kb||void 0,this.G=void 0,this.S=t&&t.supportsCrossDomainXhr||!1,this.J="",this.c=new $d(t&&t.concurrentRequestLimit),this.la=new je,this.o=!t||void 0===t.backgroundChannelTest||t.backgroundChannelTest,(this.va=t&&t.fastHandshake||!1)&&!this.o&&(D(this.a.a,"Force backgroundChannelTest when fastHandshake is enabled."),this.o=!0),t&&t.Fa&&this.a.Fa()}function ze(e){if(H(e.a,"disconnect()"),Ae(e),3==e.F){var n=e.R++,r=M(e.D);R(r,"SID",e.J),R(r,"RID",n),R(r,"TYPE","terminate"),Be(e,r),n=new L(e,e.a,n,void 0),n.J=2,n.h=Wc(M(r)),r=!1,k.navigator&&k.navigator.sendBeacon&&(r=k.navigator.sendBeacon(n.h.toString(),"")),!r&&k.Image&&((new Image).src=n.h,r=!0),r||(n.a=n.i.ca(null),n.a.fa(n.h)),n.D=t(),Zc(n)}Ce(e)}function Ae(t){t.C&&(t.C.abort(),t.C=null),t.b&&(t.b.cancel(),t.b=null),t.l&&(k.clearTimeout(t.l),t.l=null),De(t),t.c.cancel(),t.m&&(k.clearTimeout(t.m),t.m=null)}function Ee(t,e){1e3==t.g.length&&J(t.a,function(){return"Already have 1000 queued maps upon queueing "+Db(e)}),t.g.push(new Zd(t.Za++,e)),3==t.F&&Fe(t)}function Fe(t){de(t.c)||t.m||(t.m=Ec(r(t.Qa,t),0),t.v=0)}function Ge(t,e){var n=t.c;return(n.b?1:n.a?n.a.a.c:0)>=t.c.f-(t.m?1:0)?(J(t.a,"Unexpected retry request is scheduled."),!1):t.m?(H(t.a,"Use the retry request that is already scheduled."),t.g=e.u.concat(t.g),!0):!(1==t.F||2==t.F||t.v>=(t.Xa?0:t.Ya))&&(H(t.a,"Going to retry POST"),t.m=Ec(r(t.Qa,t,e),He(t,t.v)),t.v++,!0)}function Je(t,e){var n;n=e?e.c:t.R++;var r=M(t.D);R(r,"SID",t.J),R(r,"RID",n),R(r,"AID",t.N),Be(t,r),t.h&&t.i&&xe(r,t.h,t.i),n=new L(t,t.a,n,t.v+1),null===t.h&&(n.j=t.i),e&&(t.g=e.u.concat(t.g)),e=Ie(t,n),n.setTimeout(Math.round(.5*t.wa)+Math.round(.5*t.wa*Math.random())),ce(t.c,n),Vc(n,r,e)}function Be(t,e){t.f&&md({},function(t,n){R(e,n,t)})}function Ie(t,e){var n=Math.min(t.g.length,1e3),i=t.f?r(t.f.ab,t.f,t):null;t:for(var o=t.g,a=-1;;){var s=["count="+n];-1==a?0<n?(a=o[0].a,s.push("ofs="+a)):a=0:s.push("ofs="+a);for(var u=!0,c=0;c<n;c++){var l=o[c].a,h=o[c].b;if(0>(l-=a))a=Math.max(0,o[c].a-100),u=!1;else try{ke(h,s,"req"+l+"_")}catch(t){i&&i(h)}}if(u){i=s.join("&");break t}}return t=t.g.splice(0,n),e.u=t,i}function Ke(t){if(!t.b&&!t.l){t.T=1;var e=t.Pa;Tb||Ub(),Wb||(Tb(),Wb=!0),Pb.add(e,t),t.B=0}}function Le(t){return t.b||t.l?(J(t.a,"Request already in progress"),!1):!(3<=t.B)&&(H(t.a,"Going to retry GET"),t.T++,t.l=Ec(r(t.Pa,t),He(t,t.B)),t.B++,!0)}function Td(t,e,n){H(t.a,"Test Connection Finished");var r=e.l;r&&be(t.c,r),t.ka=n,t.u=e.f,H(t.a,"connectChannel_()"),t.D=Me(t,t.ja),Fe(t)}function Vd(t,e){H(t.a,"Test Connection Failed"),t.u=e.f,V(t,2)}function De(t){null!=t.s&&(k.clearTimeout(t.s),t.s=null)}function He(t,e){var n=t.Wa+Math.floor(Math.random()*t.$a);return t.qa()||(H(t.a,"Inactive channel"),n*=2),n*e}function V(t,e){if(F(t.a,"Error code "+e),2==e){var n=null;t.f&&(n=null);var i=r(t.pb,t);n||(n=new Q("//www.google.com/images/cleardot.gif"),k.location&&"http"==k.location.protocol||sd(n,"https"),Wc(n)),le(n.toString(),i)}else K(2);H(t.a,"HttpChannel: error - "+e),t.F=0,t.f&&t.f.Ba(e),Ce(t),Ae(t)}function Ce(t){if(t.F=0,t.u=-1,t.f){var e=ge(t.c);0==e.length&&0==t.g.length||(H(t.a,function(){return"Number of undelivered maps, pending: "+e.length+", outgoing: "+t.g.length}),t.c.c.length=0,wa(t.g),t.g.length=0),t.f.Aa()}}function Me(t,e){return e=Ne(t,null,e),H(t.a,"GetForwardChannelUri: "+e),e}function Ud(t,e,n){return e=Ne(t,t.ia()?e:null,n),H(t.a,"GetBackChannelUri: "+e),e}function Ne(t,e,n){var r=Hd(n);if(""!=r.b)e&&td(r,e+"."+r.b),ud(r,r.i);else{var i,o=k.location;i=e?e+"."+o.hostname:o.hostname,r=Id(o.protocol,i,o.port,n)}return t.U&&Ca(t.U,function(t,e){R(r,e,t)}),e=t.j,n=t.K,e&&n&&R(r,e,n),R(r,"VER",t.na),Be(t,r),r}function Oe(){}function Pe(t){for(var e=arguments[0],n=1;n<arguments.length;n++){var r=arguments[n];if(0==r.lastIndexOf("/",0))e=r;else{var i;(i=""==e)||(i=e.length-1,i=0<=i&&e.indexOf("/",i)==i),e+=i?r:"/"+r}}return e}function Qe(){if(z&&!(10<=Number(Wa)))throw Error("Environmental error: no available transport.")}function W(t,e){B.call(this),this.a=new ye(e),this.b=t,this.o=e&&e.testUrl?e.testUrl:Pe(this.b,"test"),this.c=qc("goog.labs.net.webChannel.WebChannelBaseTransport"),this.g=e&&e.messageUrlParams||null,t=e&&e.messageHeaders||null,e&&e.clientProtocolHeaderRequired&&(t?t["X-Client-Protocol"]="webchannel":t={"X-Client-Protocol":"webchannel"}),this.a.i=t,t=e&&e.initMessageHeaders||null,e&&e.messageContentType&&(t?t["X-WebChannel-Content-Type"]=e.messageContentType:t={"X-WebChannel-Content-Type":e.messageContentType}),e&&e.Ea&&(t?t["X-WebChannel-Client-Profile"]=e.Ea:t={"X-WebChannel-Client-Profile":e.Ea}),this.a.L=t,(t=e&&e.httpHeadersOverwriteParam)&&!xa(t)&&(this.a.h=t),this.l=e&&e.supportsCrossDomainXhr||!1,this.j=e&&e.sendRawJson||!1,(e=e&&e.httpSessionIdParam)&&!xa(e)&&(this.a.j=e,null!==(t=this.g)&&e in t&&(t=this.g,e in t&&delete t[e],D(this.c,"Ignore httpSessionIdParam also specified with messageUrlParams: "+e))),this.h=new Re(this)}function Se(t){Mc.call(this);var e=t.__sm__;if(e){t:{for(var n in e){t=n;break t}t=void 0}(this.c=t)?(t=this.c,this.data=null!==e&&t in e?e[t]:void 0):this.data=e}else this.data=t}function Te(){Nc.call(this),this.status=1}function Re(t){this.a=t}function Ve(){this.b=[],this.a=[]}function We(t){return 0==t.b.length&&(t.b=t.a,t.b.reverse(),t.a=[]),t.b.pop()}function Xe(t){return t.b.length+t.a.length}function Ye(t,e){if(w.call(this),this.h=t||0,this.c=e||10,this.h>this.c)throw Error(Ze);this.a=new Ve,this.b=new Xd,this.g=null,this.aa()}function af(t){if("function"==typeof t.$)t.$();else for(var e in t)t[e]=null}function $e(t){return Xe(t.a)+t.b.a.c}function bf(t,e){this.a=t,this.b=e}function cf(t){if(this.a=[],t)t:{if(t instanceof cf){var e=t.M();if(t=t.A(),0>=this.a.length){for(var n=this.a,r=0;r<e.length;r++)n.push(new bf(e[r],t[r]));break t}}else e=Ea(t),t=Da(t);for(r=0;r<e.length;r++)df(this,e[r],t[r])}}function df(t,e,n){var r=t.a;for(r.push(new bf(e,n)),e=r.length-1,t=t.a,n=t[e];0<e&&(r=e-1>>1,t[r].a>n.a);)t[e]=t[r],e=r;t[e]=n}function ef(){cf.call(this)}function Y(t,e){this.f=new ef,Ye.call(this,t,e)}function Z(t,e,n,r){this.l=t,this.j=!!r,Y.call(this,e,n)}var g,goog=goog||{},k=this,q="closure_uid_"+(1e9*Math.random()>>>0),fa=0,t=Date.now||function(){return+new Date};u(ka,Error),ka.prototype.name="CustomError",u(la,ka),la.prototype.name="AssertionError";var na=0,pa={};w.prototype.i=!1,w.prototype.$=function(){if(!this.i&&(this.i=!0,this.w(),0!=na)){var t=this[q]||(this[q]=++fa);if(0!=na&&this.m&&0<this.m.length)throw Error(this+" did not empty its onDisposeCallbacks queue. This probably means it overrode dispose() or disposeInternal() without calling the superclass' method.");delete pa[t]}},w.prototype.w=function(){if(this.m)for(;this.m.length;)this.m.shift()()};var qa=Array.prototype.indexOf?function(t,e){return Array.prototype.indexOf.call(t,e,void 0)}:function(t,e){if(l(t))return l(e)&&1==e.length?t.indexOf(e,0):-1;for(var n=0;n<t.length;n++)if(n in t&&t[n]===e)return n;return-1},ra=Array.prototype.forEach?function(t,e,n){Array.prototype.forEach.call(t,e,n)}:function(t,e,n){for(var r=t.length,i=l(t)?t.split(""):t,o=0;o<r;o++)o in i&&e.call(n,i[o],o,t)},ya=String.prototype.trim?function(t){return t.trim()}:function(t){return/^[\s\xa0]*([\s\S]*?)[\s\xa0]*$/.exec(t)[1]},x;t:{var Aa=k.navigator;if(Aa){var Ba=Aa.userAgent;if(Ba){x=Ba;break t}}x=""}var Ga="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");Ia[" "]=aa;var La=y("Opera"),z=y("Trident")||y("MSIE"),Ma=y("Edge"),Na=Ma||z,Oa=y("Gecko")&&!(-1!=x.toLowerCase().indexOf("webkit")&&!y("Edge"))&&!(y("Trident")||y("MSIE"))&&!y("Edge"),Pa=-1!=x.toLowerCase().indexOf("webkit")&&!y("Edge"),Ra;t:{var Sa="",Ta=function(){var t=x;return Oa?/rv:([^\);]+)(\)|;)/.exec(t):Ma?/Edge\/([\d\.]+)/.exec(t):z?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(t):Pa?/WebKit\/(\S+)/.exec(t):La?/(?:Version)[ \/]?(\S+)/.exec(t):void 0}();if(Ta&&(Sa=Ta?Ta[1]:""),z){var Ua=Qa();if(null!=Ua&&Ua>parseFloat(Sa)){Ra=String(Ua);break t}}Ra=Sa}var Ka={},Wa,Xa=k.document;Wa=Xa&&z?Qa()||("CSS1Compat"==Xa.compatMode?parseInt(Ra,10):5):void 0;var Ya=Object.freeze||function(t){return t},Za=!z||9<=Number(Wa),$a=z&&!Va("9"),ab=function(){if(!k.addEventListener||!Object.defineProperty)return!1;var t=!1,e=Object.defineProperty({},"passive",{get:function(){t=!0}});return k.addEventListener("test",aa,e),k.removeEventListener("test",aa,e),t}();A.prototype.b=function(){this.Ra=!1},u(bb,A);var cb=Ya({2:"touch",3:"pen",4:"mouse"});bb.prototype.b=function(){bb.H.b.call(this);var t=this.c;if(t.preventDefault)t.preventDefault();else if(t.returnValue=!1,$a)try{(t.ctrlKey||112<=t.keyCode&&123>=t.keyCode)&&(t.keyCode=-1)}catch(t){}};var db="closure_listenable_"+(1e6*Math.random()|0),eb=0;hb.prototype.add=function(t,e,n,r,i){var o=t.toString();(t=this.a[o])||(t=this.a[o]=[],this.b++);var a=ib(t,e,r,i);return-1<a?(e=t[a],n||(e.ba=!1)):(e=new fb(e,this.src,o,!!r,i),e.ba=n,t.push(e)),e};var kb="closure_lm_"+(1e6*Math.random()|0),lb={},mb=0,zb="__closure_events_fn_"+(1e9*Math.random()>>>0);u(B,w),B.prototype[db]=!0,g=B.prototype,g.addEventListener=function(t,e,n,r){nb(this,t,e,n,r)},g.removeEventListener=function(t,e,n,r){vb(this,t,e,n,r)},g.dispatchEvent=function(t){var e,n=this.J;if(n)for(e=[];n;n=n.J)e.push(n);n=this.N;var r=t.type||t;if(l(t))t=new A(t,n);else if(t instanceof A)t.target=t.target||n;else{var i=t;t=new A(r,n),Ha(t,i)}if(i=!0,e)for(var o=e.length-1;0<=o;o--){var a=t.a=e[o];i=Ab(a,r,!0,t)&&i}if(a=t.a=n,i=Ab(a,r,!0,t)&&i,i=Ab(a,r,!1,t)&&i,e)for(o=0;o<e.length;o++)a=t.a=e[o],i=Ab(a,r,!1,t)&&i;return i},g.w=function(){if(B.H.w.call(this),this.f){var t,e=this.f,n=0;for(t in e.a){for(var r=e.a[t],i=0;i<r.length;i++)++n,gb(r[i]);delete e.a[t],e.b--}}this.J=null},g.Ia=function(t,e,n,r){return this.f.add(String(t),e,!1,n,r)},g.Ja=function(t,e,n,r){return this.f.add(String(t),e,!0,n,r)};var Hb={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\v":"\\u000b"},Ib=/\uffff/.test("\uffff")?/[\\"\x00-\x1f\x7f-\uffff]/g:/[\\"\x00-\x1f\x7f-\xff]/g;Jb.prototype.get=function(){if(0<this.b){this.b--;var t=this.a;this.a=t.next,t.next=null}else t=this.c();return t};var Nb=new Jb(function(){return new Lb},function(t){t.reset()});Kb.prototype.add=function(t,e){var n=Nb.get();n.set(t,e),this.b?this.b.next=n:this.a=n,this.b=n},Lb.prototype.set=function(t,e){this.a=t,this.b=e,this.next=null},Lb.prototype.reset=function(){this.next=this.b=this.a=null};var Rb,Tb,Wb=!1,Pb=new Kb;u(Xb,B),g=Xb.prototype,g.ea=!1,g.O=null,g.qb=function(){if(this.ea){var e=t()-this.g;0<e&&e<.8*this.b?this.O=this.a.setTimeout(this.c,this.b-e):(this.O&&(this.a.clearTimeout(this.O),this.O=null),this.dispatchEvent("tick"),this.ea&&(this.O=this.a.setTimeout(this.c,this.b),this.g=t()))}},g.start=function(){this.ea=!0,this.O||(this.O=this.a.setTimeout(this.c,this.b),this.g=t())},g.w=function(){Xb.H.w.call(this),Yb(this),delete this.a},u($b,w),g=$b.prototype,g.ha=!1,g.Y=null,g.cb=function(t){this.a=arguments,this.Y?this.ha=!0:ac(this)},g.w=function(){$b.H.w.call(this),this.Y&&(k.clearTimeout(this.Y),this.Y=null,this.ha=!1,this.a=[])},g.kb=function(){this.Y=null,this.ha&&(this.ha=!1,ac(this))},u(bc,w);var cc=[];bc.prototype.w=function(){bc.H.w.call(this),ec(this)},bc.prototype.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented")},fc.prototype.a=null;var gc=0;fc.prototype.reset=function(e,n,r,i,o){"number"==typeof o||gc++,i||t(),delete this.a},C.prototype.toString=function(){return this.name};var ic=new C("SEVERE",1e3),jc=new C("WARNING",900),kc=new C("INFO",800),lc=new C("CONFIG",700),mc=new C("FINE",500);hc.prototype.log=function(t,e,n){if(t.value>=nc(this).value)for(da(e)&&(e=e()),t=new fc(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var oc={},pc=null;sc.prototype.Fa=function(){this.b=!1};var yc=new B;u(zc,A),u(Bc,A),u(Cc,A);var Fc={NO_ERROR:0,rb:1,yb:2,xb:3,ub:4,wb:5,zb:6,Ua:7,TIMEOUT:8,Cb:9},Gc={tb:"complete",Gb:"success",Va:"error",Ua:"abort",Eb:"ready",Fb:"readystatechange",TIMEOUT:"timeout",Ab:"incrementaldata",Db:"progress",vb:"downloadprogress",Hb:"uploadprogress"};Hc.prototype.a=null;var Lc={OPEN:"a",sb:"b",Va:"c",Bb:"d"};u(Mc,A),u(Nc,A);var Oc;u(Pc,Hc),Oc=new Pc;var Rc=45e3,Tc={},Uc={};g=L.prototype,g.setTimeout=function(t){this.R=t},g.nb=function(t){t=t.target;var e=this.I;e&&3==N(t)?(H(this.b,"Throttling readystatechange."),e.cb()):this.Sa(t)},g.Sa=function(t){try{t==this.a?ad(this):D(this.b.a,"Called back with an unexpected xmlhttp")}catch(t){if(H(this.b,"Failed call to OnXmlHttpReadyStateChanged_"),this.a&&this.a.V()){var e=this;xc(this.b,t,function(){return"ResponseText: "+e.a.V()})}else xc(this.b,t,"No response text")}},g.mb=function(){if(this.a){var t=N(this.a),e=this.a.V();this.G<e.length&&(bd(this),ed(this,t,e),this.f&&4!=t&&Zc(this))}},g.cancel=function(){this.B=!0,gd(this)},g.lb=function(){this.s=null;var e=t();0<=e-this.U?(this.f&&J(this.b,"Received watchdog timeout even though request loaded successfully"),wc(this.b,this.g),2!=this.J&&(Ac(3),K(17)),gd(this),this.m=2,hd(this)):(D(this.b.a,"WatchDog timer called too early"),kd(this,this.U-e))},g=O.prototype,g.A=function(){nd(this);for(var t=[],e=0;e<this.a.length;e++)t.push(this.b[this.a[e]]);return t},g.M=function(){return nd(this),this.a.concat()},g.get=function(t,e){return P(this.b,t)?this.b[t]:e},g.set=function(t,e){P(this.b,t)||(this.c++,this.a.push(t)),this.b[t]=e},g.forEach=function(t,e){for(var n=this.M(),r=0;r<n.length;r++){var i=n[r],o=this.get(i);t.call(e,o,i,this)}};var qd=/^(?:([^:\/?#.]+):)?(?:\/\/(?:([^\/?#]*)@)?([^\/#?]*?)(?::([0-9]+))?(?=[\/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/;Q.prototype.toString=function(){var t=[],e=this.f;e&&t.push(zd(e,Ad,!0),":");var n=this.b;return(n||"file"==e)&&(t.push("//"),(e=this.j)&&t.push(zd(e,Ad,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.i)&&t.push(":",String(n))),(n=this.a)&&(this.b&&"/"!=n.charAt(0)&&t.push("/"),t.push(zd(n,"/"==n.charAt(0)?Bd:Cd,!0))),(n=this.c.toString())&&t.push("?",n),(n=this.g)&&t.push("#",zd(n,Dd)),t.join("")},Q.prototype.resolve=function(t){var e=M(this),n=!!t.f;n?sd(e,t.f):n=!!t.j,n?e.j=t.j:n=!!t.b,n?td(e,t.b):n=null!=t.i;var r=t.a;if(n)ud(e,t.i);else if(n=!!t.a){if("/"!=r.charAt(0))if(this.b&&!this.a)r="/"+r;else{var i=e.a.lastIndexOf("/");-1!=i&&(r=e.a.substr(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(-1!=i.indexOf("./")||-1!=i.indexOf("/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var o=[],a=0;a<i.length;){var s=i[a++];"."==s?r&&a==i.length&&o.push(""):".."==s?((1<o.length||1==o.length&&""!=o[0])&&o.pop(),r&&a==i.length&&o.push("")):(o.push(s),r=!0)}r=o.join("/")}else r=i}return n?e.a=r:n=""!==t.c.toString(),n?vd(e,wd(t.c)):n=!!t.g,n&&(e.g=t.g),e};var Ad=/[#\/\?@]/g,Cd=/[#\?:]/g,Bd=/[#\?]/g,Fd=/[#\?@]/g,Dd=/#/g;g=yd.prototype,g.add=function(t,e){S(this),this.c=null,t=Kd(this,t);var n=this.a.get(t);return n||this.a.set(t,n=[]),n.push(e),this.b+=1,this},g.forEach=function(t,e){S(this),this.a.forEach(function(n,r){ra(n,function(n){t.call(e,n,r,this)},this)},this)},g.M=function(){S(this);for(var t=this.a.A(),e=this.a.M(),n=[],r=0;r<e.length;r++)for(var i=t[r],o=0;o<i.length;o++)n.push(e[r]);return n},g.A=function(t){S(this);var e=[];if(l(t))Md(this,t)&&(e=va(e,this.a.get(Kd(this,t))));else{t=this.a.A();for(var n=0;n<t.length;n++)e=va(e,t[n])}return e},g.set=function(t,e){return S(this),this.c=null,t=Kd(this,t),Md(this,t)&&(this.b-=this.a.get(t).length),this.a.set(t,[e]),this.b+=1,this},g.get=function(t,e){return t=t?this.A(t):[],0<t.length?String(t[0]):e},g.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var t=[],e=this.a.M(),n=0;n<e.length;n++){var r=e[n],i=encodeURIComponent(String(r));r=this.A(r);for(var o=0;o<r.length;o++){var a=i;""!==r[o]&&(a+="="+encodeURIComponent(String(r[o]))),t.push(a)}}return this.c=t.join("&")};var Od=null;Nd.prototype.set=function(t){this.a=t},Nd.prototype.reset=function(){this.set(t())},Nd.prototype.get=function(){return this.a},u(Qd,Pd),g=Rd.prototype,g.P=null,g.ca=function(t){return this.a.ca(t)},g.abort=function(){this.c&&(this.c.cancel(),this.c=null),this.f=-1},g.La=function(){return!1},g.Oa=function(t,e){if(this.f=t.C,0==this.P){if(H(this.b,"TestConnection: Got data for stage 1"),!this.a.o&&(t=t.a)){var n=id(t,"X-Client-Wire-Protocol");this.l=n||null,this.a.j&&((t=id(t,"X-HTTP-Session-Id"))?this.a.K=t:D(this.b.a,"Missing X_HTTP_SESSION_ID in the handshake response"))}if(e){try{var r=this.a.la.a.parse(e)}catch(t){return xc(this.b,t),void Vd(this.a,this)}this.g=r[0]}else H(this.b,"TestConnection: Null responseText"),Vd(this.a,this)}else 1==this.P&&(this.h?K(6):"11111"==e?(K(5),this.h=!0,(!z||10<=Number(Wa))&&(this.f=200,this.c.cancel(),H(this.b,"Test connection succeeded; using streaming connection"),K(11),Td(this.a,this,!0))):(K(7),this.h=!1))},g.ta=function(){this.f=this.c.C,this.c.f?0==this.P?(this.P=1,H(this.b,"TestConnection: request complete for initial check"),Sd(this)):1==this.P&&(H(this.b,"TestConnection: request complete for stage 2"),this.h?(H(this.b,"Test connection succeeded; using streaming connection"),K(11),Td(this.a,this,!0)):(H(this.b,"Test connection failed; not using streaming"),K(10),Td(this.a,this,!1))):(H(this.b,"TestConnection: request failed, in state "+this.P),0==this.P?K(8):1==this.P&&K(9),Vd(this.a,this))},g.ia=function(){return this.a.ia()},g.qa=function(){return this.a.qa()},Xd.prototype.add=function(t){this.a.set(Yd(t),t)},Xd.prototype.A=function(){return this.a.A()};var ae=10;$d.prototype.cancel=function(){this.c=ge(this),this.b?(this.b.cancel(),this.b=null):this.a&&0!=this.a.a.c&&(ra(this.a.A(),function(t){t.cancel()}),od(this.a.a))},ie.prototype.stringify=function(t){return k.JSON.stringify(t,void 0)},ie.prototype.parse=function(t){return k.JSON.parse(t,void 0)},u(T,B);var ne="";T.prototype.b=qc("goog.net.XhrIo");var oe=/^https?$/i,pe=["POST","PUT"];g=T.prototype,g.fa=function(t,e,n,i){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.B+"; newUri="+t);e=e?e.toUpperCase():"GET",this.B=t,this.g="",this.j=0,this.K=e,this.G=!1,this.c=!0,this.a=Qc(this.s?this.s:Oc),this.D=Ic(this.s?this.s:Oc),this.a.onreadystatechange=r(this.Na,this);try{E(this.b,U(this,"Opening Xhr")),this.I=!0,this.a.open(e,String(t),!0),this.I=!1}catch(t){return E(this.b,U(this,"Error opening Xhr: "+t.message)),void qe(this,t)}t=n||"";var o=new O(this.headers);i&&md(i,function(t,e){o.set(e,t)}),i=sa(o.M()),n=k.FormData&&t instanceof k.FormData,!(0<=qa(pe,e))||i||n||o.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8"),o.forEach(function(t,e){this.a.setRequestHeader(e,t)},this),this.L&&(this.a.responseType=this.L),"withCredentials"in this.a&&this.a.withCredentials!==this.o&&(this.a.withCredentials=this.o);try{re(this),0<this.l&&(this.v=se(this.a),E(this.b,U(this,"Will abort after "+this.l+"ms if incomplete, xhr2 "+this.v)),this.v?(this.a.timeout=this.l,this.a.ontimeout=r(this.Ka,this)):this.C=Zb(this.Ka,this.l,this)),E(this.b,U(this,"Sending request")),this.u=!0,this.a.send(t),this.u=!1}catch(t){E(this.b,U(this,"Send error: "+t.message)),qe(this,t)}},g.Ka=function(){"undefined"!=typeof goog&&this.a&&(this.g="Timed out after "+this.l+"ms, aborting",this.j=8,E(this.b,U(this,this.g)),this.dispatchEvent("timeout"),this.abort(8))},g.abort=function(t){this.a&&this.c&&(E(this.b,U(this,"Aborting")),this.c=!1,this.h=!0,this.a.abort(),this.h=!1,this.j=t||7,this.dispatchEvent("complete"),this.dispatchEvent("abort"),ue(this))},g.w=function(){this.a&&(this.c&&(this.c=!1,this.h=!0,this.a.abort(),this.h=!1),ue(this,!0)),T.H.w.call(this)},g.Na=function(){this.i||(this.I||this.u||this.h?ve(this):this.jb())},g.jb=function(){ve(this)},g.W=function(){try{return 2<N(this)?this.a.status:-1}catch(t){return-1}},g.Ha=function(){try{return 2<N(this)?this.a.statusText:""}catch(t){return E(this.b,"Can not get status: "+t.message),""}},g.V=function(){try{return this.a?this.a.responseText:""}catch(t){return E(this.b,"Can not get responseText: "+t.message),""}},g.eb=function(t){if(this.a){var e=this.a.responseText;t&&0==e.indexOf(t)&&(e=e.substring(t.length));t:{if(t=e,k.JSON)try{var n=k.JSON.parse(t);break t}catch(t){}n=Cb(t)}return n}},g.Ga=function(){return this.j},g.hb=function(){return l(this.g)?this.g:String(this.g)},g=ye.prototype,g.na=8,g.F=1,g.La=function(){return 0==this.F},g.Qa=function(t){if(this.m=null,H(this.a,"startForwardChannel_"),1==this.F)if(t)J(this.a,"Not supposed to retry the open");else{H(this.a,"open_()"),this.R=Math.floor(1e5*Math.random()),t=this.R++;var e=new L(this,this.a,t,void 0),n=this.i;this.L&&(n?(n=Fa(n),Ha(n,this.L)):n=this.L),null===this.h&&(e.j=n);var r=Ie(this,e),i=M(this.D);R(i,"RID",t),R(i,"CVER",22),this.o&&this.j&&R(i,"X-HTTP-Session-Id",this.j),Be(this,i),this.h&&n&&xe(i,this.h,n),ce(this.c,e),this.va?(R(i,"$req",r),R(i,"SID","null"),e.X=!0,Vc(e,i,null)):Vc(e,i,r),this.F=2}else 3==this.F&&(t?Je(this,t):0==this.g.length?H(this.a,"startForwardChannel_ returned: nothing to send"):de(this.c)?J(this.a,"startForwardChannel_ returned: connection already in progress"):(Je(this),H(this.a,"startForwardChannel_ finished, sent request")))},g.Pa=function(){this.l=null,H(this.a,"Creating new HttpRequest"),this.b=new L(this,this.a,"rpc",this.T),null===this.h&&(this.b.j=this.i),this.b.N=0;var t=M(this.ua);R(t,"RID","rpc"),R(t,"SID",this.J),R(t,"CI",this.ka?"0":"1"),R(t,"AID",this.N),Be(this,t),R(t,"TYPE","xmlhttp"),this.h&&this.i&&xe(t,this.h,this.i),this.G&&this.b.setTimeout(this.G),Yc(this.b,t,!0,this.X),H(this.a,"New Request created")},g.Oa=function(t,e){if(0!=this.F&&(this.b==t||ee(this.c,t)))if(this.u=t.C,!t.v&&ee(this.c,t)&&3==this.F){try{var n=this.la.a.parse(e)}catch(t){n=null}if(p(n)&&3==n.length)if(e=n,0==e[0])t:if(H(this.a,"Server claims our backchannel is missing."),this.l)H(this.a,"But we are currently starting the request.");else{if(this.b){if(!(this.b.D+3e3<t.D))break t;De(this),this.b.cancel(),this.b=null}else D(this.a.a,"We do not have a BackChannel established");Le(this),K(18)}else this.xa=e[1],0<(t=this.xa-this.N)&&(e=e[2],H(this.a,e+" bytes (in "+t+" arrays) are outstanding on the BackChannel"),37500>e&&this.ka&&0==this.B&&!this.s&&(this.s=Ec(r(this.ib,this),6e3)));else H(this.a,"Bad POST response data returned"),V(this,11)}else if((t.v||this.b==t)&&De(this),!xa(e))for(e=n=this.la.a.parse(e),n=0;n<e.length;n++){var i=e[n];if(this.N=i[0],i=i[1],2==this.F)if("c"==i[0]){this.J=i[1],this.X=i[2];var o=i[3];null!=o&&(this.na=o,F(this.a,"VER="+this.na)),o=i[4],null!=o&&(this.ya=o,F(this.a,"SVER="+this.ya)),i=i[5],null!=i&&"number"==typeof i&&0<i&&(this.G=i*=1.5,F(this.a,"backChannelRequestTimeoutMs_="+i)),this.o&&(i=t.a)&&((o=id(i,"X-Client-Wire-Protocol"))&&be(this.c,o),this.j&&((i=id(i,"X-HTTP-Session-Id"))?(this.K=i,R(this.D,this.j,i)):D(this.a.a,"Missing X_HTTP_SESSION_ID in the handshake response"))),this.F=3,this.f&&this.f.Da(),i=t,this.ua=Ud(this,this.X,this.ja),i.v?(H(this.a,"Upgrade the handshake request to a backchannel."),fe(this.c,i),(o=this.G)&&i.setTimeout(o),i.s&&(bd(i),Zc(i)),this.b=i):Ke(this)}else"stop"!=i[0]&&"close"!=i[0]||V(this,7);else 3==this.F&&("stop"==i[0]||"close"==i[0]?"stop"==i[0]?V(this,7):ze(this):"noop"!=i[0]&&this.f&&this.f.Ca(i),this.B=0)}},g.ib=function(){null!=this.s&&(this.s=null,this.b.cancel(),this.b=null,Le(this),K(19))},g.ta=function(e){H(this.a,"Request complete");var n=null;if(this.b==e){De(this),this.b=null;var r=2}else{if(!ee(this.c,e))return;n=e.u,fe(this.c,e),r=1}if(this.u=e.C,0!=this.F)if(e.f)1==r?(Dc(e.l?e.l.length:0,t()-e.D,this.v),Fe(this)):Ke(this);else{var i=e.m;if(3==i||0==i&&0<this.u)H(this.a,"Not retrying due to error type");else{var o=this;if(H(this.a,function(){return"Maybe retrying, last error: "+Sc(i,o.u)}),1==r&&Ge(this,e)||2==r&&Le(this))return;H(this.a,"Exceeded max number of retries")}switch(n&&0<n.length&&he(this.c,n),H(this.a,"Error: HTTP request failed"),i){case 1:V(this,5);break;case 4:V(this,10);break;case 3:V(this,6);break;default:V(this,2)}}},g.pb=function(t){t?(F(this.a,"Successfully pinged google.com"),K(2)):(F(this.a,"Failed to ping google.com"),K(1))},g.ca=function(t){if(t&&!this.S)throw Error("Can't create secondary domain capable XhrIo object.");return t=new T(this.Ta),t.o=this.S,t},g.qa=function(){return!!this.f&&!0},g.ia=function(){return this.S},new Qd,g=Oe.prototype,g.Da=function(){},g.Ca=function(){},g.Ba=function(){},g.Aa=function(){},g.ab=function(){},Qe.prototype.a=function(t,e){return new W(t,e)},u(W,B),g=W.prototype,g.addEventListener=function(t,e,n,r){W.H.addEventListener.call(this,t,e,n,r)},g.removeEventListener=function(t,e,n,r){W.H.removeEventListener.call(this,t,e,n,r)},g.fb=function(){this.a.f=this.h,this.l&&(this.a.S=!0);var t=this.a,e=this.o,n=this.b,r=this.g||void 0;H(t.a,"connect()"),K(0),t.ja=n,t.U=r||{},t.o&&(H(t.a,"connect() bypassed channel-test."),t.I.b=[],t.I.a=!1),H(t.a,"connectTest_()"),t.C=new Rd(t,t.a),null===t.h&&(t.C.i=t.i),n=e,t.h&&t.i&&(n=xe(e,t.h,t.i)),t=t.C,t.m=n,e=Me(t.a,t.m),K(3),n=t.a.I.b,null!=n?(t.g=n[0],t.P=1,Sd(t)):($c(e,"MODE","init"),!t.a.o&&t.a.j&&$c(e,"X-HTTP-Session-Id",t.a.j),t.c=new L(t,t.b,void 0,void 0),t.c.j=t.i,Yc(t.c,e,!1,null),t.P=0)},g.close=function(){ze(this.a)},g.gb=function(t){if(l(t)){var e={};e.__data__=t,Ee(this.a,e)}else this.j?(e={},e.__data__=Db(t),Ee(this.a,e)):Ee(this.a,t)},g.w=function(){this.a.f=null,delete this.h,ze(this.a),delete this.a,W.H.w.call(this)},u(Se,Mc),u(Te,Nc),u(Re,Oe),Re.prototype.Da=function(){rc(this.a.c,"WebChannel opened on "+this.a.b),this.a.dispatchEvent("a")},Re.prototype.Ca=function(t){this.a.dispatchEvent(new Se(t))},Re.prototype.Ba=function(t){rc(this.a.c,"WebChannel aborted on "+this.a.b+" due to channel error: "+t),this.a.dispatchEvent(new Te(t))},Re.prototype.Aa=function(){rc(this.a.c,"WebChannel closed on "+this.a.b),this.a.dispatchEvent("b")};var Ue=ja(function(t,e){function n(){}n.prototype=t.prototype;var r=new n;return t.apply(r,Array.prototype.slice.call(arguments,1)),r},Qe);Ve.prototype.A=function(){for(var t=[],e=this.b.length-1;0<=e;--e)t.push(this.b[e]);var n=this.a.length;for(e=0;e<n;++e)t.push(this.a[e]);return t},u(Ye,w);var Ze="[goog.structs.Pool] Min can not be greater than max";g=Ye.prototype,g.da=function(){var e=t();if(!(null!=this.g&&0>e-this.g)){for(var n;0<Xe(this.a)&&(n=We(this.a),!this.sa(n));)this.aa();return!n&&$e(this)<this.c&&(n=this.pa()),n&&(this.g=e,this.b.add(n)),n}},g.ob=function(t){return!!pd(this.b.a,Yd(t))&&(this.ma(t),!0)},g.ma=function(t){pd(this.b.a,Yd(t)),this.sa(t)&&$e(this)<this.c?this.a.a.push(t):af(t)},g.aa=function(){for(var t=this.a;$e(this)<this.h;){var e=this.pa();t.a.push(e)}for(;$e(this)>this.c&&0<Xe(this.a);)af(We(t))},g.pa=function(){return{}},g.sa=function(t){return"function"!=typeof t.bb||t.bb()},g.w=function(){if(Ye.H.w.call(this),0<this.b.a.c)throw Error("[goog.structs.Pool] Objects not released");delete this.b;for(var t=this.a;0!=t.b.length||0!=t.a.length;)af(We(t));delete this.a},cf.prototype.A=function(){for(var t=this.a,e=[],n=t.length,r=0;r<n;r++)e.push(t[r].b);return e},cf.prototype.M=function(){for(var t=this.a,e=[],n=t.length,r=0;r<n;r++)e.push(t[r].a);return e},u(ef,cf),u(Y,Ye),g=Y.prototype,g.da=function(t,e){if(!t)return Y.H.da.call(this);df(this.f,void 0!==e?e:100,t),this.ra()},g.ra=function(){for(var t=this.f;0<t.a.length;){var e=this.da();if(!e)break;var n=t,r=n.a,i=r.length,o=r[0];if(0>=i)o=void 0;else{if(1==i)ua(r);else{r[0]=r.pop(),r=0,n=n.a,i=n.length;for(var a=n[r];r<i>>1;){var s=2*r+1,u=2*r+2;if(s=u<i&&n[u].a<n[s].a?u:s,n[s].a>a.a)break;n[r]=n[s],r=s}n[r]=a}o=o.b}o.apply(this,[e])}},g.ma=function(t){Y.H.ma.call(this,t),this.ra()},g.aa=function(){Y.H.aa.call(this),this.ra()},g.w=function(){Y.H.w.call(this),k.clearTimeout(void 0),ua(this.f.a),this.f=null},u(Z,Y),Z.prototype.pa=function(){var t=new T,e=this.l;return e&&e.forEach(function(e,n){t.headers.set(n,e)}),this.j&&(t.o=!0),t},Z.prototype.sa=function(t){return!t.i&&!t.a},Qe.prototype.createWebChannel=Qe.prototype.a,W.prototype.send=W.prototype.gb,W.prototype.open=W.prototype.fb,W.prototype.close=W.prototype.close,Fc.NO_ERROR=0,Fc.TIMEOUT=8,Fc.HTTP_ERROR=6,Gc.COMPLETE="complete",Kc.EventType=Lc,Lc.OPEN="a",Lc.CLOSE="b",Lc.ERROR="c",Lc.MESSAGE="d",B.prototype.listen=B.prototype.Ia,Z.prototype.getObject=Z.prototype.da,Z.prototype.releaseObject=Z.prototype.ob,T.prototype.listenOnce=T.prototype.Ja,T.prototype.getLastError=T.prototype.hb,T.prototype.getLastErrorCode=T.prototype.Ga,T.prototype.getStatus=T.prototype.W,T.prototype.getStatusText=T.prototype.Ha,T.prototype.getResponseJson=T.prototype.eb,T.prototype.getResponseText=T.prototype.V,T.prototype.getResponseText=T.prototype.V,T.prototype.send=T.prototype.fa,module.exports={createWebChannelTransport:Ue,ErrorCode:Fc,EventType:Gc,WebChannel:Kc,XhrIoPool:Z}}).call("undefined"!==typeof global?global:"undefined"!==typeof self?self:"undefined"!==typeof window?window:{})}).call(exports,__webpack_require__(1))},function(t,e,n){"use strict";function r(t){if(t>=200&&t<300)return"ok";switch(t){case 0:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 500:return"internal";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}function i(t,e,n){var i=r(t),o=i,a=void 0;try{var s=e.error;if(s){var u=s.status;if("string"===typeof u){if(!l[u])return new h("internal","internal");i=l[u]}o=u;var c=s.message;"string"===typeof c&&(o=c),a=s.details,void 0!==a&&(a=n.decode(a))}}catch(t){}return"ok"===i?null:new h(i,o,a)}function o(t,e){var n={};for(var r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}function a(t,e,n){return new d(t,n)}function s(t){var e={Functions:d};t.INTERNAL.registerService(y,a,e,void 0,!0)}Object.defineProperty(e,"__esModule",{value:!0});var u=n(2),c=function(t){return t&&"object"===typeof t&&"default"in t?t.default:t}(n(0)),l={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"},h=function(t){function e(n,r,i){var o=t.call(this,r)||this;return Object.setPrototypeOf(o,e.prototype),o.code=n,o.details=i,o}return u.__extends(e,t),e}(Error),f=function(){function t(t){this.app=t}return t.prototype.getAuthToken=function(){return u.__awaiter(this,void 0,void 0,function(){var t,e;return u.__generator(this,function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.app.INTERNAL.getToken()];case 1:return t=n.sent(),t?[2,t.accessToken]:[2,void 0];case 2:return e=n.sent(),[2,void 0];case 3:return[2]}})})},t.prototype.getInstanceIdToken=function(){return u.__awaiter(this,void 0,void 0,function(){var t,e,n;return u.__generator(this,function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),this.app.messaging?(t=this.app.messaging(),[4,t.getToken()]):[2,void 0];case 1:return e=r.sent(),e?[2,e]:[2,void 0];case 2:return n=r.sent(),[2,void 0];case 3:return[2]}})})},t.prototype.getContext=function(){return u.__awaiter(this,void 0,void 0,function(){var t,e;return u.__generator(this,function(n){switch(n.label){case 0:return[4,this.getAuthToken()];case 1:return t=n.sent(),[4,this.getInstanceIdToken()];case 2:return e=n.sent(),[2,{authToken:t,instanceIdToken:e}]}})})},t}(),p=function(){function t(){}return t.prototype.encode=function(t){var e=this;if(null===t||void 0===t)return null;if(t instanceof Number&&(t=t.valueOf()),"number"===typeof t&&isFinite(t))return t;if(!0===t||!1===t)return t;if("[object String]"===Object.prototype.toString.call(t))return t;if(Array.isArray(t))return t.map(function(t){return e.encode(t)});if("function"===typeof t||"object"===typeof t)return o(t,function(t){return e.encode(t)});throw new Error("Data cannot be encoded in JSON: "+t)},t.prototype.decode=function(t){var e=this;if(null===t)return t;if(t["@type"])switch(t["@type"]){case"type.googleapis.com/google.protobuf.Int64Value":case"type.googleapis.com/google.protobuf.UInt64Value":var n=parseFloat(t.value);if(isNaN(n))throw new Error("Data cannot be decoded from JSON: "+t);return n;default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map(function(t){return e.decode(t)}):"function"===typeof t||"object"===typeof t?o(t,function(t){return e.decode(t)}):t},t}(),d=function(){function t(t,e){void 0===e&&(e="us-central1"),this.app_=t,this.region_=e,this.serializer=new p,this.contextProvider=new f(t)}return Object.defineProperty(t.prototype,"app",{get:function(){return this.app_},enumerable:!0,configurable:!0}),t.prototype._url=function(t){var e=this.app_.options.projectId;return"https://"+this.region_+"-"+e+".cloudfunctions.net/"+t},t.prototype.httpsCallable=function(t){var e=this;return function(n){return e.call(t,n)}},t.prototype.postJSON=function(t,e,n){return u.__awaiter(this,void 0,void 0,function(){var r,i,o,a;return u.__generator(this,function(s){switch(s.label){case 0:n.append("Content-Type","application/json"),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,fetch(t,{method:"POST",body:JSON.stringify(e),headers:n})];case 2:return r=s.sent(),[3,4];case 3:return i=s.sent(),[2,{status:0,json:null}];case 4:o=null,s.label=5;case 5:return s.trys.push([5,7,,8]),[4,r.json()];case 6:return o=s.sent(),[3,8];case 7:return a=s.sent(),[3,8];case 8:return[2,{status:r.status,json:o}]}})})},t.prototype.call=function(t,e){return u.__awaiter(this,void 0,void 0,function(){var n,r,o,a,s,c,l,f;return u.__generator(this,function(u){switch(u.label){case 0:return n=this._url(t),e=this.serializer.encode(e),r={data:e},o=new Headers,[4,this.contextProvider.getContext()];case 1:return a=u.sent(),a.authToken&&o.append("Authorization","Bearer "+a.authToken),a.instanceIdToken&&o.append("Firebase-Instance-ID-Token",a.instanceIdToken),[4,this.postJSON(n,r,o)];case 2:if(s=u.sent(),c=i(s.status,s.json,this.serializer))throw c;if(!s.json)throw new h("internal","Response is not valid JSON object.");if(l=s.json.data,"undefined"===typeof l&&(l=s.json.result),"undefined"===typeof l)throw new h("internal","Response is missing data field.");return f=this.serializer.decode(l),[2,{data:f}]}})})},t}(),y="functions";s(c),e.registerFunctions=s},function(t,e,n){"use strict";function r(t,e){if(null==t||null==e)return!1;if(t===e)return!0;if(t.byteLength!==e.byteLength)return!1;for(var n=new DataView(t),r=new DataView(e),i=0;i<t.byteLength;i++)if(n.getUint8(i)!==r.getUint8(i))return!1;return!0}function i(t){var e=new Uint8Array(t);return btoa(String.fromCharCode.apply(null,e))}function o(t){return i(t).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function a(t){for(var e="=".repeat((4-t.length%4)%4),n=(t+e).replace(/\-/g,"+").replace(/_/g,"/"),r=atob(n),i=new Uint8Array(r.length),o=0;o<r.length;++o)i[o]=r.charCodeAt(o);return i}function s(t){if(t.objectStoreNames.contains(P)){var e=t.transaction(P),n=e.objectStore(P),r=new O,i=n.openCursor();i.onerror=function(t){console.warn("Unable to cleanup old IDB.",t)},i.onsuccess=function(){var e=i.result;if(e){var n=e.value;r.deleteToken(n.fcmSenderId,n.fcmToken,n.fcmPushSet),e.continue()}else t.close(),indexedDB.deleteDatabase(D)}}}function u(){var t=indexedDB.open(D);t.onerror=function(t){},t.onsuccess=function(e){s(t.result)}}function c(t){return new Promise(function(e,n){t.onsuccess=function(){e(t.result)},t.onerror=function(){n(t.error)}})}function l(t){if(t.fcmToken&&("string"!==typeof t.fcmToken||0===t.fcmToken.length))throw N.create(C.BAD_TOKEN);if(t.swScope&&("string"!==typeof t.swScope||0===t.swScope.length))throw N.create(C.BAD_SCOPE);if(t.vapidKey&&(!(t.vapidKey instanceof Uint8Array)||65!==t.vapidKey.length))throw N.create(C.BAD_VAPID_KEY);if(t.endpoint&&("string"!==typeof t.endpoint||0===t.endpoint.length))throw N.create(C.BAD_SUBSCRIPTION);if(t.auth&&!(t.auth instanceof ArrayBuffer))throw N.create(C.BAD_SUBSCRIPTION);if(t.p256dh&&!(t.p256dh instanceof ArrayBuffer))throw N.create(C.BAD_SUBSCRIPTION);if(t.fcmSenderId&&("string"!==typeof t.fcmSenderId||0===t.fcmSenderId.length))throw N.create(C.BAD_SENDER_ID);if(t.fcmPushSet&&("string"!==typeof t.fcmPushSet||0===t.fcmPushSet.length))throw N.create(C.BAD_PUSH_SET)}function h(t,e,n){if(!n.vapidKey||!r(e.buffer,n.vapidKey.buffer))return!1;var i=t.endpoint===n.endpoint,o=r(t.getKey("auth"),n.auth),a=r(t.getKey("p256dh"),n.p256dh);return i&&o&&a}function f(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function p(t,e){return n={},n[_.TYPE_OF_MSG]=t,n[_.DATA]=e,n;var n}function d(){return Object(E.__awaiter)(this,void 0,void 0,function(){var t,e,n,r;return Object(E.__generator)(this,function(i){switch(i.label){case 0:if(!(t=document.querySelector('link[rel="manifest"]')))return[2];i.label=1;case 1:return i.trys.push([1,4,,5]),[4,fetch(t.href)];case 2:return n=i.sent(),[4,n.json()];case 3:return e=i.sent(),[3,5];case 4:return r=i.sent(),[2];case 5:if(!e||!e.gcm_sender_id)return[2];if("103953800507"!==e.gcm_sender_id)throw N.create(C.INCORRECT_GCM_SENDER_ID);return[2]}})})}function y(t){var e=function(t){if(!m())throw N.create(C.UNSUPPORTED_BROWSER);return self&&"ServiceWorkerGlobalScope"in self?new B(t):new V(t)},n={isSupported:m};t.INTERNAL.registerService("messaging",e,n)}function m(){return self&&"ServiceWorkerGlobalScope"in self?v():g()}function g(){return"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}function v(){return"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"registerMessaging",function(){return y}),n.d(e,"isSupported",function(){return m});var b,_,w=n(5),E=(n.n(w),n(2)),T=n(0),S=n.n(T),C={AVAILABLE_IN_WINDOW:"only-available-in-window",AVAILABLE_IN_SW:"only-available-in-sw",SHOULD_BE_INHERITED:"should-be-overriden",BAD_SENDER_ID:"bad-sender-id",INCORRECT_GCM_SENDER_ID:"incorrect-gcm-sender-id",PERMISSION_DEFAULT:"permission-default",PERMISSION_BLOCKED:"permission-blocked",UNSUPPORTED_BROWSER:"unsupported-browser",NOTIFICATIONS_BLOCKED:"notifications-blocked",FAILED_DEFAULT_REGISTRATION:"failed-serviceworker-registration",SW_REGISTRATION_EXPECTED:"sw-registration-expected",GET_SUBSCRIPTION_FAILED:"get-subscription-failed",INVALID_SAVED_TOKEN:"invalid-saved-token",SW_REG_REDUNDANT:"sw-reg-redundant",TOKEN_SUBSCRIBE_FAILED:"token-subscribe-failed",TOKEN_SUBSCRIBE_NO_TOKEN:"token-subscribe-no-token",TOKEN_SUBSCRIBE_NO_PUSH_SET:"token-subscribe-no-push-set",TOKEN_UNSUBSCRIBE_FAILED:"token-unsubscribe-failed",TOKEN_UPDATE_FAILED:"token-update-failed",TOKEN_UPDATE_NO_TOKEN:"token-update-no-token",USE_SW_BEFORE_GET_TOKEN:"use-sw-before-get-token",INVALID_DELETE_TOKEN:"invalid-delete-token",DELETE_TOKEN_NOT_FOUND:"delete-token-not-found",DELETE_SCOPE_NOT_FOUND:"delete-scope-not-found",BG_HANDLER_FUNCTION_EXPECTED:"bg-handler-function-expected",NO_WINDOW_CLIENT_TO_MSG:"no-window-client-to-msg",UNABLE_TO_RESUBSCRIBE:"unable-to-resubscribe",NO_FCM_TOKEN_FOR_RESUBSCRIBE:"no-fcm-token-for-resubscribe",FAILED_TO_DELETE_TOKEN:"failed-to-delete-token",NO_SW_IN_REG:"no-sw-in-reg",BAD_SCOPE:"bad-scope",BAD_VAPID_KEY:"bad-vapid-key",BAD_SUBSCRIPTION:"bad-subscription",BAD_TOKEN:"bad-token",BAD_PUSH_SET:"bad-push-set",FAILED_DELETE_VAPID_KEY:"failed-delete-vapid-key",INVALID_PUBLIC_VAPID_KEY:"invalid-public-vapid-key",USE_PUBLIC_KEY_BEFORE_GET_TOKEN:"use-public-key-before-get-token",PUBLIC_KEY_DECRYPTION_FAILED:"public-vapid-key-decryption-failed"},I=(b={},b[C.AVAILABLE_IN_WINDOW]="This method is available in a Window context.",b[C.AVAILABLE_IN_SW]="This method is available in a service worker context.",b[C.SHOULD_BE_INHERITED]="This method should be overriden by extended classes.",b[C.BAD_SENDER_ID]="Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().",b[C.PERMISSION_DEFAULT]="The required permissions were not granted and dismissed instead.",b[C.PERMISSION_BLOCKED]="The required permissions were not granted and blocked instead.",b[C.UNSUPPORTED_BROWSER]="This browser doesn't support the API's required to use the firebase SDK.",b[C.NOTIFICATIONS_BLOCKED]="Notifications have been blocked.",b[C.FAILED_DEFAULT_REGISTRATION]="We are unable to register the default service worker. {$browserErrorMessage}",b[C.SW_REGISTRATION_EXPECTED]="A service worker registration was the expected input.",b[C.GET_SUBSCRIPTION_FAILED]="There was an error when trying to get any existing Push Subscriptions.",b[C.INVALID_SAVED_TOKEN]="Unable to access details of the saved token.",b[C.SW_REG_REDUNDANT]="The service worker being used for push was made redundant.",b[C.TOKEN_SUBSCRIBE_FAILED]="A problem occured while subscribing the user to FCM: {$message}",b[C.TOKEN_SUBSCRIBE_NO_TOKEN]="FCM returned no token when subscribing the user to push.",b[C.TOKEN_SUBSCRIBE_NO_PUSH_SET]="FCM returned an invalid response when getting an FCM token.",b[C.TOKEN_UNSUBSCRIBE_FAILED]="A problem occured while unsubscribing the user from FCM: {$message}",b[C.TOKEN_UPDATE_FAILED]="A problem occured while updating the user from FCM: {$message}",b[C.TOKEN_UPDATE_NO_TOKEN]="FCM returned no token when updating the user to push.",b[C.USE_SW_BEFORE_GET_TOKEN]="The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.",b[C.INVALID_DELETE_TOKEN]="You must pass a valid token into deleteToken(), i.e. the token from getToken().",b[C.DELETE_TOKEN_NOT_FOUND]="The deletion attempt for token could not be performed as the token was not found.",b[C.DELETE_SCOPE_NOT_FOUND]="The deletion attempt for service worker scope could not be performed as the scope was not found.",b[C.BG_HANDLER_FUNCTION_EXPECTED]="The input to setBackgroundMessageHandler() must be a function.",b[C.NO_WINDOW_CLIENT_TO_MSG]="An attempt was made to message a non-existant window client.",b[C.UNABLE_TO_RESUBSCRIBE]="There was an error while re-subscribing the FCM token for push messaging. Will have to resubscribe the user on next visit. {$message}",b[C.NO_FCM_TOKEN_FOR_RESUBSCRIBE]="Could not find an FCM token and as a result, unable to resubscribe. Will have to resubscribe the user on next visit.",b[C.FAILED_TO_DELETE_TOKEN]="Unable to delete the currently saved token.",b[C.NO_SW_IN_REG]="Even though the service worker registration was successful, there was a problem accessing the service worker itself.",b[C.INCORRECT_GCM_SENDER_ID]="Please change your web app manifest's 'gcm_sender_id' value to '103953800507' to use Firebase messaging.",b[C.BAD_SCOPE]="The service worker scope must be a string with at least one character.",b[C.BAD_VAPID_KEY]="The public VAPID key is not a Uint8Array with 65 bytes.",b[C.BAD_SUBSCRIPTION]="The subscription must be a valid PushSubscription.",b[C.BAD_TOKEN]="The FCM Token used for storage / lookup was not a valid token string.",b[C.BAD_PUSH_SET]="The FCM push set used for storage / lookup was not not a valid push set string.",b[C.FAILED_DELETE_VAPID_KEY]="The VAPID key could not be deleted.",b[C.INVALID_PUBLIC_VAPID_KEY]="The public VAPID key must be a string.",b[C.PUBLIC_KEY_DECRYPTION_FAILED]="The public VAPID key did not equal 65 bytes when decrypted.",b),N=new w.ErrorFactory("messaging","Messaging",I),k=new Uint8Array([4,51,148,247,223,161,235,177,220,3,162,94,21,113,219,72,211,46,237,237,178,52,219,183,71,58,12,143,196,204,225,111,60,140,132,223,171,182,102,62,242,12,212,139,254,227,249,118,47,20,28,99,8,106,111,45,177,26,149,176,206,55,192,156,110]),A="https://fcm.googleapis.com";!function(t){t.TYPE_OF_MSG="firebase-messaging-msg-type",t.DATA="firebase-messaging-msg-data"}(_||(_={}));var R;!function(t){t.PUSH_MSG_RECEIVED="push-msg-received",t.NOTIFICATION_CLICKED="notification-clicked"}(R||(R={}));var O=function(){function t(){}return t.prototype.getToken=function(t,e,n){return Object(E.__awaiter)(this,void 0,void 0,function(){var i,a,s,u,c,l,h,f,p,d;return Object(E.__generator)(this,function(y){switch(y.label){case 0:i=o(e.getKey("p256dh")),a=o(e.getKey("auth")),s="authorized_entity="+t+"&endpoint="+e.endpoint+"&encryption_key="+i+"&encryption_auth="+a,r(n.buffer,k.buffer)||(u=o(n),s+="&application_pub_key="+u),c=new Headers,c.append("Content-Type","application/x-www-form-urlencoded"),l={method:"POST",headers:c,body:s},y.label=1;case 1:return y.trys.push([1,4,,5]),[4,fetch(A+"/fcm/connect/subscribe",l)];case 2:return f=y.sent(),[4,f.json()];case 3:return h=y.sent(),[3,5];case 4:throw p=y.sent(),N.create(C.TOKEN_SUBSCRIBE_FAILED);case 5:if(h.error)throw d=h.error.message,N.create(C.TOKEN_SUBSCRIBE_FAILED,{message:d});if(!h.token)throw N.create(C.TOKEN_SUBSCRIBE_NO_TOKEN);if(!h.pushSet)throw N.create(C.TOKEN_SUBSCRIBE_NO_PUSH_SET);return[2,{token:h.token,pushSet:h.pushSet}]}})})},t.prototype.updateToken=function(t,e,n,i,a){return Object(E.__awaiter)(this,void 0,void 0,function(){var s,u,c,l,h,f,p,d,y,m;return Object(E.__generator)(this,function(g){switch(g.label){case 0:s=o(i.getKey("p256dh")),u=o(i.getKey("auth")),c="push_set="+n+"&token="+e+"&authorized_entity="+t+"&endpoint="+i.endpoint+"&encryption_key="+s+"&encryption_auth="+u,r(a.buffer,k.buffer)||(l=o(a),c+="&application_pub_key="+l),h=new Headers,h.append("Content-Type","application/x-www-form-urlencoded"),f={method:"POST",headers:h,body:c},g.label=1;case 1:return g.trys.push([1,4,,5]),[4,fetch(A+"/fcm/connect/subscribe",f)];case 2:return d=g.sent(),[4,d.json()];case 3:return p=g.sent(),[3,5];case 4:throw y=g.sent(),N.create(C.TOKEN_UPDATE_FAILED);case 5:if(p.error)throw m=p.error.message,N.create(C.TOKEN_UPDATE_FAILED,{message:m});if(!p.token)throw N.create(C.TOKEN_UPDATE_NO_TOKEN);return[2,p.token]}})})},t.prototype.deleteToken=function(t,e,n){return Object(E.__awaiter)(this,void 0,void 0,function(){var r,i,o,a,s,u,c;return Object(E.__generator)(this,function(l){switch(l.label){case 0:r="authorized_entity="+t+"&token="+e+"&pushSet="+n,i=new Headers,i.append("Content-Type","application/x-www-form-urlencoded"),o={method:"POST",headers:i,body:r},l.label=1;case 1:return l.trys.push([1,4,,5]),[4,fetch(A+"/fcm/connect/unsubscribe",o)];case 2:return a=l.sent(),[4,a.json()];case 3:if(s=l.sent(),s.error)throw u=s.error.message,N.create(C.TOKEN_UNSUBSCRIBE_FAILED,{message:u});return[3,5];case 4:throw c=l.sent(),N.create(C.TOKEN_UNSUBSCRIBE_FAILED);case 5:return[2]}})})},t}(),D="undefined",P="fcm_token_object_Store",x=function(){function t(){this.dbPromise=null}return t.prototype.get=function(t){return this.createTransaction(function(e){return e.get(t)})},t.prototype.getIndex=function(t,e){function n(n){return n.index(t).get(e)}return this.createTransaction(n)},t.prototype.put=function(t){return this.createTransaction(function(e){return e.put(t)},"readwrite")},t.prototype.delete=function(t){return this.createTransaction(function(e){return e.delete(t)},"readwrite")},t.prototype.closeDatabase=function(){return Object(E.__awaiter)(this,void 0,void 0,function(){var t;return Object(E.__generator)(this,function(e){switch(e.label){case 0:return this.dbPromise?[4,this.dbPromise]:[3,2];case 1:t=e.sent(),t.close(),this.dbPromise=null,e.label=2;case 2:return[2]}})})},t.prototype.createTransaction=function(t,e){return void 0===e&&(e="readonly"),Object(E.__awaiter)(this,void 0,void 0,function(){var n,r,i,o;return Object(E.__generator)(this,function(a){switch(a.label){case 0:return[4,this.getDb()];case 1:return n=a.sent(),r=n.transaction(this.objectStoreName,e),i=r.objectStore(this.objectStoreName),[4,c(t(i))];case 2:return o=a.sent(),[2,new Promise(function(t,e){r.oncomplete=function(){t(o)},r.onerror=function(){e(r.error)}})]}})})},t.prototype.getDb=function(){var t=this;return this.dbPromise||(this.dbPromise=new Promise(function(e,n){var r=indexedDB.open(t.dbName,t.dbVersion);r.onsuccess=function(){e(r.result)},r.onerror=function(){t.dbPromise=null,n(r.error)},r.onupgradeneeded=function(e){return t.onDbUpgrade(r,e)}})),this.dbPromise},t}(),L=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dbName="fcm_token_details_db",e.dbVersion=3,e.objectStoreName="fcm_token_object_Store",e}return Object(E.__extends)(e,t),e.prototype.onDbUpgrade=function(t,e){var n=t.result;switch(e.oldVersion){case 0:var r=n.createObjectStore(this.objectStoreName,{keyPath:"swScope"});r.createIndex("fcmSenderId","fcmSenderId",{unique:!1}),r.createIndex("fcmToken","fcmToken",{unique:!0});case 1:u();case 2:var r=t.transaction.objectStore(this.objectStoreName),i=r.openCursor();i.onsuccess=function(){var t=i.result;if(t){var e=t.value,n=Object(E.__assign)({},e);e.createTime||(n.createTime=Date.now()),"string"===typeof e.vapidKey&&(n.vapidKey=a(e.vapidKey)),"string"===typeof e.auth&&(n.auth=a(e.auth).buffer),"string"===typeof e.auth&&(n.p256dh=a(e.p256dh).buffer),t.update(n),t.continue()}}}},e.prototype.getTokenDetailsFromToken=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){return Object(E.__generator)(this,function(e){if(!t)throw N.create(C.BAD_TOKEN);return l({fcmToken:t}),[2,this.getIndex("fcmToken",t)]})})},e.prototype.getTokenDetailsFromSWScope=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){return Object(E.__generator)(this,function(e){if(!t)throw N.create(C.BAD_SCOPE);return l({swScope:t}),[2,this.get(t)]})})},e.prototype.saveTokenDetails=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){return Object(E.__generator)(this,function(e){if(!t.swScope)throw N.create(C.BAD_SCOPE);if(!t.vapidKey)throw N.create(C.BAD_VAPID_KEY);if(!t.endpoint||!t.auth||!t.p256dh)throw N.create(C.BAD_SUBSCRIPTION);if(!t.fcmSenderId)throw N.create(C.BAD_SENDER_ID);if(!t.fcmToken)throw N.create(C.BAD_TOKEN);if(!t.fcmPushSet)throw N.create(C.BAD_PUSH_SET);return l(t),[2,this.put(t)]})})},e.prototype.deleteToken=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){var e;return Object(E.__generator)(this,function(n){switch(n.label){case 0:return"string"!==typeof t||0===t.length?[2,Promise.reject(N.create(C.INVALID_DELETE_TOKEN))]:[4,this.getTokenDetailsFromToken(t)];case 1:if(!(e=n.sent()))throw N.create(C.DELETE_TOKEN_NOT_FOUND);return[4,this.delete(e.swScope)];case 2:return n.sent(),[2,e]}})})},e}(x),M=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.dbName="fcm_vapid_details_db",e.dbVersion=1,e.objectStoreName="fcm_vapid_object_Store",e}return Object(E.__extends)(e,t),e.prototype.onDbUpgrade=function(t){t.result.createObjectStore(this.objectStoreName,{keyPath:"swScope"})},e.prototype.getVapidFromSWScope=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){var e;return Object(E.__generator)(this,function(n){switch(n.label){case 0:if("string"!==typeof t||0===t.length)throw N.create(C.BAD_SCOPE);return[4,this.get(t)];case 1:return e=n.sent(),[2,e?e.vapidKey:void 0]}})})},e.prototype.saveVapidDetails=function(t,e){return Object(E.__awaiter)(this,void 0,void 0,function(){var n;return Object(E.__generator)(this,function(r){if("string"!==typeof t||0===t.length)throw N.create(C.BAD_SCOPE);if(null===e||65!==e.length)throw N.create(C.BAD_VAPID_KEY);return n={swScope:t,vapidKey:e},[2,this.put(n)]})})},e.prototype.deleteVapidDetails=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){var e;return Object(E.__generator)(this,function(n){switch(n.label){case 0:return[4,this.getVapidFromSWScope(t)];case 1:if(!(e=n.sent()))throw N.create(C.DELETE_SCOPE_NOT_FOUND);return[4,this.delete(t)];case 2:return n.sent(),[2,e]}})})},e}(x),F="messagingSenderId",U=function(){function t(t){var e=this;if(!t.options[F]||"string"!==typeof t.options[F])throw N.create(C.BAD_SENDER_ID);this.messagingSenderId=t.options[F],this.tokenDetailsModel=new L,this.vapidDetailsModel=new M,this.iidModel=new O,this.app=t,this.INTERNAL={delete:function(){return e.delete()}}}return t.prototype.getToken=function(){return Object(E.__awaiter)(this,void 0,void 0,function(){var t,e,n,r,i;return Object(E.__generator)(this,function(o){switch(o.label){case 0:if("denied"===(t=this.getNotificationPermission_()))throw N.create(C.NOTIFICATIONS_BLOCKED);return"granted"!==t?[2,null]:[4,this.getSWRegistration_()];case 1:return e=o.sent(),[4,this.getPublicVapidKey_()];case 2:return n=o.sent(),[4,this.getPushSubscription(e,n)];case 3:return r=o.sent(),[4,this.tokenDetailsModel.getTokenDetailsFromSWScope(e.scope)];case 4:return i=o.sent(),i?[2,this.manageExistingToken(e,r,n,i)]:[2,this.getNewToken(e,r,n)]}})})},t.prototype.manageExistingToken=function(t,e,n,r){return Object(E.__awaiter)(this,void 0,void 0,function(){var i,o;return Object(E.__generator)(this,function(a){switch(a.label){case 0:return i=h(e,n,r),i?(o=Date.now(),o<r.createTime+6048e5?[2,r.fcmToken]:[2,this.updateToken(t,e,n,r)]):[4,this.deleteTokenFromDB(r.fcmToken)];case 1:return a.sent(),[2,this.getNewToken(t,e,n)]}})})},t.prototype.updateToken=function(t,e,n,r){return Object(E.__awaiter)(this,void 0,void 0,function(){var i,o,a;return Object(E.__generator)(this,function(s){switch(s.label){case 0:return s.trys.push([0,4,,6]),[4,this.iidModel.updateToken(this.messagingSenderId,r.fcmToken,r.fcmPushSet,e,n)];case 1:return i=s.sent(),o={swScope:t.scope,vapidKey:n,fcmSenderId:this.messagingSenderId,fcmToken:i,fcmPushSet:r.fcmPushSet,createTime:Date.now(),endpoint:e.endpoint,auth:e.getKey("auth"),p256dh:e.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(o)];case 2:return s.sent(),[4,this.vapidDetailsModel.saveVapidDetails(t.scope,n)];case 3:return s.sent(),[2,i];case 4:return a=s.sent(),[4,this.deleteToken(r.fcmToken)];case 5:throw s.sent(),a;case 6:return[2]}})})},t.prototype.getNewToken=function(t,e,n){return Object(E.__awaiter)(this,void 0,void 0,function(){var r,i;return Object(E.__generator)(this,function(o){switch(o.label){case 0:return[4,this.iidModel.getToken(this.messagingSenderId,e,n)];case 1:return r=o.sent(),i={swScope:t.scope,vapidKey:n,fcmSenderId:this.messagingSenderId,fcmToken:r.token,fcmPushSet:r.pushSet,createTime:Date.now(),endpoint:e.endpoint,auth:e.getKey("auth"),p256dh:e.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(i)];case 2:return o.sent(),[4,this.vapidDetailsModel.saveVapidDetails(t.scope,n)];case 3:return o.sent(),[2,r.token]}})})},t.prototype.deleteToken=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){var e,n;return Object(E.__generator)(this,function(r){switch(r.label){case 0:return[4,this.deleteTokenFromDB(t)];case 1:return r.sent(),[4,this.getSWRegistration_()];case 2:return e=r.sent(),e?[4,e.pushManager.getSubscription()]:[3,4];case 3:if(n=r.sent())return[2,n.unsubscribe()];r.label=4;case 4:return[2,!0]}})})},t.prototype.deleteTokenFromDB=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){var e;return Object(E.__generator)(this,function(n){switch(n.label){case 0:return[4,this.tokenDetailsModel.deleteToken(t)];case 1:return e=n.sent(),[4,this.iidModel.deleteToken(e.fcmSenderId,e.fcmToken,e.fcmPushSet)];case 2:return n.sent(),[2]}})})},t.prototype.getPushSubscription=function(t,e){return t.pushManager.getSubscription().then(function(n){return n||t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e})})},t.prototype.requestPermission=function(){throw N.create(C.AVAILABLE_IN_WINDOW)},t.prototype.useServiceWorker=function(t){throw N.create(C.AVAILABLE_IN_WINDOW)},t.prototype.usePublicVapidKey=function(t){throw N.create(C.AVAILABLE_IN_WINDOW)},t.prototype.onMessage=function(t,e,n){throw N.create(C.AVAILABLE_IN_WINDOW)},t.prototype.onTokenRefresh=function(t,e,n){throw N.create(C.AVAILABLE_IN_WINDOW)},t.prototype.setBackgroundMessageHandler=function(t){throw N.create(C.AVAILABLE_IN_SW)},t.prototype.delete=function(){return Object(E.__awaiter)(this,void 0,void 0,function(){return Object(E.__generator)(this,function(t){switch(t.label){case 0:return[4,Promise.all([this.tokenDetailsModel.closeDatabase(),this.vapidDetailsModel.closeDatabase()])];case 1:return t.sent(),[2]}})})},t.prototype.getNotificationPermission_=function(){return Notification.permission},t.prototype.getTokenDetailsModel=function(){return this.tokenDetailsModel},t.prototype.getVapidDetailsModel=function(){return this.vapidDetailsModel},t.prototype.getIidModel=function(){return this.iidModel},t}(),B=function(t){function e(e){var n=t.call(this,e)||this;return n.bgMessageHandler=null,self.addEventListener("push",function(t){n.onPush(t)}),self.addEventListener("pushsubscriptionchange",function(t){n.onSubChange(t)}),self.addEventListener("notificationclick",function(t){n.onNotificationClick(t)}),n}return Object(E.__extends)(e,t),e.prototype.onPush=function(t){t.waitUntil(this.onPush_(t))},e.prototype.onSubChange=function(t){t.waitUntil(this.onSubChange_(t))},e.prototype.onNotificationClick=function(t){t.waitUntil(this.onNotificationClick_(t))},e.prototype.onPush_=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){var e,n,r,i,o,a,s;return Object(E.__generator)(this,function(u){switch(u.label){case 0:if(!t.data)return[2];try{e=t.data.json()}catch(t){return[2]}return[4,this.hasVisibleClients_()];case 1:return(n=u.sent())?[2,this.sendMessageToWindowClients_(e)]:(r=this.getNotificationData_(e))?(i=r.title||"",[4,this.getSWRegistration_()]):[3,3];case 2:return o=u.sent(),a=r.actions,s=Notification.maxActions,a&&s&&a.length>s&&console.warn("This browser only supports "+s+" actions.The remaining actions will not be displayed."),[2,o.showNotification(i,r)];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(e)]:[3,5];case 4:return u.sent(),[2];case 5:return[2]}})})},e.prototype.onSubChange_=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){var t,e,n,r,i;return Object(E.__generator)(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),[4,this.getSWRegistration_()];case 1:return t=o.sent(),[3,3];case 2:throw e=o.sent(),N.create(C.UNABLE_TO_RESUBSCRIBE,{message:e});case 3:return o.trys.push([3,5,,8]),[4,t.pushManager.getSubscription()];case 4:return o.sent(),[3,8];case 5:return n=o.sent(),r=this.getTokenDetailsModel(),[4,r.getTokenDetailsFromSWScope(t.scope)];case 6:if(!(i=o.sent()))throw n;return[4,this.deleteToken(i.fcmToken)];case 7:throw o.sent(),n;case 8:return[2]}})})},e.prototype.onNotificationClick_=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){var e,n,r,i;return Object(E.__generator)(this,function(o){switch(o.label){case 0:return t.notification&&t.notification.data&&t.notification.data.FCM_MSG?t.action?[2]:(t.stopImmediatePropagation(),t.notification.close(),e=t.notification.data.FCM_MSG,e.notification?(n=e.notification.click_action,n?[4,this.getWindowClient_(n)]:[2]):[2]):[2];case 1:return r=o.sent(),r?[3,3]:[4,self.clients.openWindow(n)];case 2:return r=o.sent(),[3,5];case 3:return[4,r.focus()];case 4:r=o.sent(),o.label=5;case 5:return r?(delete e.notification,i=p(R.NOTIFICATION_CLICKED,e),[2,this.attemptToMessageClient_(r,i)]):[2]}})})},e.prototype.getNotificationData_=function(t){if(t&&"object"===typeof t.notification){var e=Object(E.__assign)({},t.notification);return e.data=Object(E.__assign)({},t.notification.data,(n={},n.FCM_MSG=t,n)),e;var n}},e.prototype.setBackgroundMessageHandler=function(t){if(!t||"function"!==typeof t)throw N.create(C.BG_HANDLER_FUNCTION_EXPECTED);this.bgMessageHandler=t},e.prototype.getWindowClient_=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){var e,n,r,i,o;return Object(E.__generator)(this,function(a){switch(a.label){case 0:return e=new URL(t,self.location.href).href,[4,f()];case 1:for(n=a.sent(),r=null,i=0;i<n.length;i++)if((o=new URL(n[i].url,self.location.href).href)===e){r=n[i];break}return[2,r]}})})},e.prototype.attemptToMessageClient_=function(t,e){return Object(E.__awaiter)(this,void 0,void 0,function(){return Object(E.__generator)(this,function(n){if(!t)throw N.create(C.NO_WINDOW_CLIENT_TO_MSG);return t.postMessage(e),[2]})})},e.prototype.hasVisibleClients_=function(){return Object(E.__awaiter)(this,void 0,void 0,function(){var t;return Object(E.__generator)(this,function(e){switch(e.label){case 0:return[4,f()];case 1:return t=e.sent(),[2,t.some(function(t){return"visible"===t.visibilityState})]}})})},e.prototype.sendMessageToWindowClients_=function(t){return Object(E.__awaiter)(this,void 0,void 0,function(){var e,n,r=this;return Object(E.__generator)(this,function(i){switch(i.label){case 0:return[4,f()];case 1:return e=i.sent(),n=p(R.PUSH_MSG_RECEIVED,t),[4,Promise.all(e.map(function(t){return r.attemptToMessageClient_(t,n)}))];case 2:return i.sent(),[2]}})})},e.prototype.getSWRegistration_=function(){return Object(E.__awaiter)(this,void 0,void 0,function(){return Object(E.__generator)(this,function(t){return[2,self.registration]})})},e.prototype.getPublicVapidKey_=function(){return Object(E.__awaiter)(this,void 0,void 0,function(){var t,e;return Object(E.__generator)(this,function(n){switch(n.label){case 0:return[4,this.getSWRegistration_()];case 1:if(!(t=n.sent()))throw N.create(C.SW_REGISTRATION_EXPECTED);return[4,this.getVapidDetailsModel().getVapidFromSWScope(t.scope)];case 2:return e=n.sent(),null==e?[2,k]:[2,e]}})})},e}(U),V=function(t){function e(e){var n=t.call(this,e)||this;return n.registrationToUse=null,n.publicVapidKeyToUse=null,n.manifestCheckPromise=null,n.messageObserver=null,n.tokenRefreshObserver=null,n.onMessageInternal=Object(w.createSubscribe)(function(t){n.messageObserver=t}),n.onTokenRefreshInternal=Object(w.createSubscribe)(function(t){n.tokenRefreshObserver=t}),n.setupSWMessageListener_(),n}return Object(E.__extends)(e,t),e.prototype.getToken=function(){return Object(E.__awaiter)(this,void 0,void 0,function(){return Object(E.__generator)(this,function(e){switch(e.label){case 0:return this.manifestCheckPromise||(this.manifestCheckPromise=d()),[4,this.manifestCheckPromise];case 1:return e.sent(),[2,t.prototype.getToken.call(this)]}})})},e.prototype.requestPermission=function(){return Object(E.__awaiter)(this,void 0,void 0,function(){var t;return Object(E.__generator)(this,function(e){switch(e.label){case 0:return"granted"===this.getNotificationPermission_()?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(t=e.sent()))return[2];throw"denied"===t?N.create(C.PERMISSION_BLOCKED):N.create(C.PERMISSION_DEFAULT)}})})},e.prototype.useServiceWorker=function(t){if(!(t instanceof ServiceWorkerRegistration))throw N.create(C.SW_REGISTRATION_EXPECTED);if(null!=this.registrationToUse)throw N.create(C.USE_SW_BEFORE_GET_TOKEN);this.registrationToUse=t},e.prototype.usePublicVapidKey=function(t){if("string"!==typeof t)throw N.create(C.INVALID_PUBLIC_VAPID_KEY);if(null!=this.publicVapidKeyToUse)throw N.create(C.USE_PUBLIC_KEY_BEFORE_GET_TOKEN);var e=a(t);if(65!==e.length)throw N.create(C.PUBLIC_KEY_DECRYPTION_FAILED);this.publicVapidKeyToUse=e},e.prototype.onMessage=function(t,e,n){return"function"===typeof t?this.onMessageInternal(t,e,n):this.onMessageInternal(t)},e.prototype.onTokenRefresh=function(t,e,n){return"function"===typeof t?this.onTokenRefreshInternal(t,e,n):this.onTokenRefreshInternal(t)},e.prototype.waitForRegistrationToActivate_=function(t){var e=t.installing||t.waiting||t.active;return new Promise(function(n,r){if(!e)return void r(N.create(C.NO_SW_IN_REG));if("activated"===e.state)return void n(t);if("redundant"===e.state)return void r(N.create(C.SW_REG_REDUNDANT));var i=function(){if("activated"===e.state)n(t);else{if("redundant"!==e.state)return;r(N.create(C.SW_REG_REDUNDANT))}e.removeEventListener("statechange",i)};e.addEventListener("statechange",i)})},e.prototype.getSWRegistration_=function(){var t=this;return this.registrationToUse?this.waitForRegistrationToActivate_(this.registrationToUse):(this.registrationToUse=null,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}).catch(function(t){throw N.create(C.FAILED_DEFAULT_REGISTRATION,{browserErrorMessage:t.message})}).then(function(e){return t.waitForRegistrationToActivate_(e).then(function(){return t.registrationToUse=e,e.update(),e})}))},e.prototype.getPublicVapidKey_=function(){return Object(E.__awaiter)(this,void 0,void 0,function(){return Object(E.__generator)(this,function(t){return this.publicVapidKeyToUse?[2,this.publicVapidKeyToUse]:[2,k]})})},e.prototype.setupSWMessageListener_=function(){var t=this;navigator.serviceWorker.addEventListener("message",function(e){if(e.data&&e.data[_.TYPE_OF_MSG]){var n=e.data;switch(n[_.TYPE_OF_MSG]){case R.PUSH_MSG_RECEIVED:case R.NOTIFICATION_CLICKED:var r=n[_.DATA];t.messageObserver&&t.messageObserver.next(r)}}},!1)},e}(U);y(S.a)},function(t,e,n){"use strict";function r(t){return"storage/"+t}function i(){return new ie(oe.UNKNOWN,"An unknown error occurred, please check the error payload for server response.")}function o(t){return new ie(oe.OBJECT_NOT_FOUND,"Object '"+t+"' does not exist.")}function a(t){return new ie(oe.QUOTA_EXCEEDED,"Quota for bucket '"+t+"' exceeded, please view quota on https://firebase.google.com/pricing/.")}function s(){return new ie(oe.UNAUTHENTICATED,"User is not authenticated, please authenticate using Firebase Authentication and try again.")}function u(t){return new ie(oe.UNAUTHORIZED,"User does not have permission to access '"+t+"'.")}function c(){return new ie(oe.RETRY_LIMIT_EXCEEDED,"Max retry time for operation exceeded, please try again.")}function l(){return new ie(oe.CANCELED,"User canceled the upload/download.")}function h(t){return new ie(oe.INVALID_URL,"Invalid URL '"+t+"'.")}function f(t){return new ie(oe.INVALID_DEFAULT_BUCKET,"Invalid default bucket '"+t+"'.")}function p(){return new ie(oe.CANNOT_SLICE_BLOB,"Cannot slice blob for upload. Please retry the upload.")}function d(){return new ie(oe.SERVER_FILE_WRONG_SIZE,"Server recorded incorrect upload file size, please retry the upload.")}function y(){return new ie(oe.NO_DOWNLOAD_URL,"The given file does not have any download URLs.")}function m(t,e,n){return new ie(oe.INVALID_ARGUMENT,"Invalid argument in `"+e+"` at index "+t+": "+n)}function g(t,e,n,r){var i,o;return t===e?(i=t,o=1===t?"argument":"arguments"):(i="between "+t+" and "+e,o="arguments"),new ie(oe.INVALID_ARGUMENT_COUNT,"Invalid argument count in `"+n+"`: Expected "+i+" "+o+", received "+r+".")}function v(){return new ie(oe.APP_DELETED,"The Firebase app was deleted.")}function b(t){return new ie(oe.INVALID_ROOT_OPERATION,"The operation '"+t+"' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').")}function _(t,e){return new ie(oe.INVALID_FORMAT,"String does not match format '"+t+"': "+e)}function w(t){throw new ie(oe.INTERNAL_ERROR,"Internal error: "+t)}function E(t){switch(t){case ae.RAW:case ae.BASE64:case ae.BASE64URL:case ae.DATA_URL:return;default:throw"Expected one of the event types: ["+ae.RAW+", "+ae.BASE64+", "+ae.BASE64URL+", "+ae.DATA_URL+"]."}}function T(t,e){switch(t){case ae.RAW:return new se(S(e));case ae.BASE64:case ae.BASE64URL:return new se(I(t,e));case ae.DATA_URL:return new se(N(e),k(e))}throw i()}function S(t){for(var e=[],n=0;n<t.length;n++){var r=t.charCodeAt(n);if(r<=127)e.push(r);else if(r<=2047)e.push(192|r>>6,128|63&r);else if(55296==(64512&r)){var i=n<t.length-1&&56320==(64512&t.charCodeAt(n+1));if(i){var o=r,a=t.charCodeAt(++n);r=65536|(1023&o)<<10|1023&a,e.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|63&r)}else e.push(239,191,189)}else 56320==(64512&r)?e.push(239,191,189):e.push(224|r>>12,128|r>>6&63,128|63&r)}return new Uint8Array(e)}function C(t){var e;try{e=decodeURIComponent(t)}catch(t){throw _(ae.DATA_URL,"Malformed data URL.")}return S(e)}function I(t,e){switch(t){case ae.BASE64:var n=-1!==e.indexOf("-"),r=-1!==e.indexOf("_");if(n||r){var i=n?"-":"_";throw _(t,"Invalid character '"+i+"' found: is it base64url encoded?")}break;case ae.BASE64URL:var o=-1!==e.indexOf("+"),a=-1!==e.indexOf("/");if(o||a){var i=o?"+":"/";throw _(t,"Invalid character '"+i+"' found: is it base64 encoded?")}e=e.replace(/-/g,"+").replace(/_/g,"/")}var s;try{s=atob(e)}catch(e){throw _(t,"Invalid character found")}for(var u=new Uint8Array(s.length),c=0;c<s.length;c++)u[c]=s.charCodeAt(c);return u}function N(t){var e=new ue(t);return e.base64?I(ae.BASE64,e.rest):C(e.rest)}function k(t){return new ue(t).contentType}function A(t,e){return!!(t.length>=e.length)&&t.substring(t.length-e.length)===e}function R(t){switch(t){case le.RUNNING:case le.PAUSING:case le.CANCELING:return he.RUNNING;case le.PAUSED:return he.PAUSED;case le.SUCCESS:return he.SUCCESS;case le.CANCELED:return he.CANCELED;case le.ERROR:default:return he.ERROR}}function O(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function D(t,e){for(var n in t)O(t,n)&&e(n,t[n])}function P(t){if(null==t)return{};var e={};return D(t,function(t,n){e[t]=n}),e}function x(t){return new Promise(t)}function L(t){return Promise.resolve(t)}function M(t){return Promise.reject(t)}function F(t){return null!=t}function U(t){return void 0!==t}function B(t){return"function"===typeof t}function V(t){return"object"===typeof t}function j(t){return V(t)&&null!==t}function q(t){return V(t)&&!Array.isArray(t)}function W(t){return"string"===typeof t||t instanceof String}function K(t){return"number"===typeof t||t instanceof Number}function H(t){return G()&&t instanceof Blob}function G(){return"undefined"!==typeof Blob}function Q(t){var e;try{e=JSON.parse(t)}catch(t){return null}return q(e)?e:null}function z(t){if(0==t.length)return null;var e=t.lastIndexOf("/");return-1===e?"":t.slice(0,e)}function Y(t,e){var n=e.split("/").filter(function(t){return t.length>0}).join("/");return 0===t.length?n:t+"/"+n}function X(t){var e=t.lastIndexOf("/",t.length-2);return-1===e?t:t.slice(e+1)}function J(t){return Jt+Zt+t}function $(t){return $t+Zt+t}function Z(t){return Jt+te+t}function tt(t){var e=encodeURIComponent,n="?";return D(t,function(t,r){var i=e(t)+"="+e(r);n=n+i+"&"}),n=n.slice(0,-1)}function et(t,e){return e}function nt(t){return!W(t)||t.length<2?t:(t=t,X(t))}function rt(){function t(t,e){return nt(e)}function e(t,e){return F(e)?+e:e}if(me)return me;var n=[];n.push(new ye("bucket")),n.push(new ye("generation")),n.push(new ye("metageneration")),n.push(new ye("name","fullPath",!0));var r=new ye("name");r.xform=t,n.push(r);var i=new ye("size");return i.xform=e,n.push(i),n.push(new ye("timeCreated")),n.push(new ye("updated")),n.push(new ye("md5Hash",null,!0)),n.push(new ye("cacheControl",null,!0)),n.push(new ye("contentDisposition",null,!0)),n.push(new ye("contentEncoding",null,!0)),n.push(new ye("contentLanguage",null,!0)),n.push(new ye("contentType",null,!0)),n.push(new ye("metadata","customMetadata",!0)),me=n}function it(t,e){function n(){var n=t.bucket,r=t.fullPath,i=new de(n,r);return e.makeStorageReference(i)}Object.defineProperty(t,"ref",{get:n})}function ot(t,e,n){var r={};r.type="file";for(var i=n.length,o=0;o<i;o++){var a=n[o];r[a.local]=a.xform(r,e[a.server])}return it(r,t),r}function at(t,e,n){var r=Q(e);return null===r?null:ot(t,r,n)}function st(t,e){var n=Q(e);if(null===n)return null;if(!W(n.downloadTokens))return null;var r=n.downloadTokens;if(0===r.length)return null;var i=encodeURIComponent;return r.split(",").map(function(e){var n=t.bucket,r=t.fullPath;return $("/b/"+i(n)+"/o/"+i(r))+tt({alt:"media",token:e})})[0]}function ut(t,e){for(var n={},r=e.length,i=0;i<r;i++){var o=e[i];o.writable&&(n[o.server]=t[o.local])}return JSON.stringify(n)}function ct(t){if(!t||!V(t))throw"Expected Metadata object.";for(var e in t){var n=t[e];if("customMetadata"===e){if(!V(n))throw"Expected object for 'customMetadata' mapping."}else if(j(n))throw"Mapping for '"+e+"' cannot be an object."}}function lt(t,e,n){for(var r=e.length,i=e.length,o=0;o<e.length;o++)if(e[o].optional){r=o;break}if(!(r<=n.length&&n.length<=i))throw g(r,i,t,n.length);for(var o=0;o<n.length;o++)try{e[o].validator(n[o])}catch(e){throw e instanceof Error?m(o,t,e.message):m(o,t,e)}}function ht(t,e){return function(n){t(n),e(n)}}function ft(t,e){function n(t){if(!W(t))throw"Expected string."}var r;return r=t?ht(n,t):n,new ge(r,e)}function pt(){function t(t){if(!(t instanceof Uint8Array||t instanceof ArrayBuffer||G()&&t instanceof Blob))throw"Expected Blob or File."}return new ge(t)}function dt(t){return new ge(ct,t)}function yt(){function t(t){if(!(K(t)&&t>=0))throw"Expected a number 0 or greater."}return new ge(t)}function mt(t,e){function n(e){if(!(null===e||F(e)&&e instanceof Object))throw"Expected an Object.";void 0!==t&&null!==t&&t(e)}return new ge(n,e)}function gt(t){function e(t){if(null!==t&&!B(t))throw"Expected a Function."}return new ge(e,t)}function vt(){return"undefined"!==typeof BlobBuilder?BlobBuilder:"undefined"!==typeof WebKitBlobBuilder?WebKitBlobBuilder:void 0}function bt(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=vt();if(void 0!==n){for(var r=new n,i=0;i<t.length;i++)r.append(t[i]);return r.getBlob()}if(G())return new Blob(t);throw Error("This browser doesn't seem to support creating Blobs")}function _t(t,e,n){return t.webkitSlice?t.webkitSlice(e,n):t.mozSlice?t.mozSlice(e,n):t.slice?t.slice(e,n):null}function wt(t,e){return-1!==t.indexOf(e)}function Et(t){return Array.prototype.slice.call(t)}function Tt(t,e){var n=t.indexOf(e);-1!==n&&t.splice(n,1)}function St(t){if(!t)throw i()}function Ct(t,e){function n(n,r){var i=at(t,r,e);return St(null!==i),i}return n}function It(t,e){function n(n,r){var i=at(t,r,e);return St(null!==i),st(i,r)}return n}function Nt(t){function e(e,n){var r;return r=401===e.getStatus()?s():402===e.getStatus()?a(t.bucket):403===e.getStatus()?u(t.path):n,r.setServerResponseProp(n.serverResponseProp()),r}return e}function kt(t){function e(e,r){var i=n(e,r);return 404===e.getStatus()&&(i=o(t.path)),i.setServerResponseProp(r.serverResponseProp()),i}var n=Nt(t);return e}function At(t,e,n){var r=e.fullServerUrl(),i=J(r),o=t.maxOperationRetryTime(),a=new be(i,"GET",Ct(t,n),o);return a.errorHandler=kt(e),a}function Rt(t,e,n){var r=e.fullServerUrl(),i=J(r),o=t.maxOperationRetryTime(),a=new be(i,"GET",It(t,n),o);return a.errorHandler=kt(e),a}function Ot(t,e,n,r){var i=e.fullServerUrl(),o=J(i),a=ut(n,r),s={"Content-Type":"application/json; charset=utf-8"},u=t.maxOperationRetryTime(),c=new be(o,"PATCH",Ct(t,r),u);return c.headers=s,c.body=a,c.errorHandler=kt(e),c}function Dt(t,e){function n(t,e){}var r=e.fullServerUrl(),i=J(r),o=t.maxOperationRetryTime(),a=new be(i,"DELETE",n,o);return a.successCodes=[200,204],a.errorHandler=kt(e),a}function Pt(t,e){return t&&t.contentType||e&&e.type()||"application/octet-stream"}function xt(t,e,n){var r=P(n);return r.fullPath=t.path,r.size=e.size(),r.contentType||(r.contentType=Pt(null,e)),r}function Lt(t,e,n,r,i){var o=e.bucketOnlyServerUrl(),a={"X-Goog-Upload-Protocol":"multipart"},s=function(){for(var t="",e=0;e<2;e++)t+=Math.random().toString().slice(2);return t}();a["Content-Type"]="multipart/related; boundary="+s;var u=xt(e,r,i),c=ut(u,n),l="--"+s+"\r\nContent-Type: application/json; charset=utf-8\r\n\r\n"+c+"\r\n--"+s+"\r\nContent-Type: "+u.contentType+"\r\n\r\n",h="\r\n--"+s+"--",f=ve.getBlob(l,r,h);if(null===f)throw p();var d={name:u.fullPath},y=Z(o),m=t.maxUploadRetryTime(),g=new be(y,"POST",Ct(t,n),m);return g.urlParams=d,g.headers=a,g.body=f.uploadData(),g.errorHandler=Nt(e),g}function Mt(t,e){var n;try{n=t.getResponseHeader("X-Goog-Upload-Status")}catch(t){St(!1)}return St(wt(e||["active"],n)),n}function Ft(t,e,n,r,i){function o(t,e){Mt(t);var n;try{n=t.getResponseHeader("X-Goog-Upload-URL")}catch(t){St(!1)}return St(W(n)),n}var a=e.bucketOnlyServerUrl(),s=xt(e,r,i),u={name:s.fullPath},c=Z(a),l={"X-Goog-Upload-Protocol":"resumable","X-Goog-Upload-Command":"start","X-Goog-Upload-Header-Content-Length":r.size(),"X-Goog-Upload-Header-Content-Type":s.contentType,"Content-Type":"application/json; charset=utf-8"},h=ut(s,n),f=t.maxUploadRetryTime(),p=new be(c,"POST",o,f);return p.urlParams=u,p.headers=l,p.body=h,p.errorHandler=Nt(e),p}function Ut(t,e,n,r){function i(t,e){var n,i=Mt(t,["active","final"]);try{n=t.getResponseHeader("X-Goog-Upload-Size-Received")}catch(t){St(!1)}var o=parseInt(n,10);return St(!isNaN(o)),new _e(o,r.size(),"final"===i)}var o={"X-Goog-Upload-Command":"query"},a=t.maxUploadRetryTime(),s=new be(n,"POST",i,a);return s.headers=o,s.errorHandler=Nt(e),s}function Bt(t,e,n,r,i,o,a,s){function u(t,n){var i,a=Mt(t,["active","final"]),s=c.current+h,u=r.size();return i="final"===a?Ct(e,o)(t,n):null,new _e(s,u,"final"===a,i)}var c=new _e(0,0);if(a?(c.current=a.current,c.total=a.total):(c.current=0,c.total=r.size()),r.size()!==c.total)throw d();var l=c.total-c.current,h=l;i>0&&(h=Math.min(h,i));var f=c.current,y=f+h,m=h===l?"upload, finalize":"upload",g={"X-Goog-Upload-Command":m,"X-Goog-Upload-Offset":c.current},v=r.slice(f,y);if(null===v)throw p();var b=e.maxUploadRetryTime(),_=new be(n,"POST",u,b);return _.headers=g,_.body=v.uploadData(),_.progressCallback=s||null,_.errorHandler=Nt(t),_}function Vt(t){return function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];L(!0).then(function(){t.apply(null,e)})}}function jt(t,e,n){function r(){return 2===h}function i(){f||(f=!0,e.apply(null,arguments))}function o(e){c=setTimeout(function(){c=null,t(a,r())},e)}function a(t){for(var e=[],n=1;n<arguments.length;n++)e[n-1]=arguments[n];if(!f){if(t)return void i.apply(null,arguments);if(r()||l)return void i.apply(null,arguments);u<64&&(u*=2);var a;1===h?(h=2,a=0):a=1e3*(u+Math.random()),o(a)}}function s(t){p||(p=!0,f||(null!==c?(t||(h=2),clearTimeout(c),o(0)):t||(h=1)))}var u=1,c=null,l=!1,h=0,f=!1,p=!1;return o(0),setTimeout(function(){l=!0,s(!0)},n),s}function qt(t){t(!1)}function Wt(t,e){null!==e&&e.length>0&&(t.Authorization="Firebase "+e)}function Kt(t){var e="undefined"!==typeof Xt.a?Xt.a.SDK_VERSION:"AppManager";t["X-Firebase-Storage-Version"]="webjs/"+e}function Ht(t,e,n){var r=tt(t.urlParams),i=t.url+r,o=P(t.headers);return Wt(o,e),Kt(o),new ke(i,t.method,o,t.body,t.successCodes,t.additionalRetryCodes,t.handler,t.errorHandler,t.timeout,t.progressCallback,n)}function Gt(t,e,n){return new Re(t,new pe,n)}function Qt(t){var e={TaskState:he,TaskEvent:ce,StringFormat:ae,Storage:Re,Reference:Se};t.INTERNAL.registerService(De,Gt,e,void 0,!0)}Object.defineProperty(e,"__esModule",{value:!0}),n.d(e,"registerStorage",function(){return Qt});var zt,Yt=n(0),Xt=n.n(Yt),Jt="https://firebasestorage.googleapis.com",$t="https://firebasestorage.googleapis.com",Zt="/v0",te="/v0",ee=12e4,ne=6e4,re=-9007199254740991,ie=function(){function t(t,e){this.code_=r(t),this.message_="Firebase Storage: "+e,this.serverResponse_=null,this.name_="FirebaseError"}return t.prototype.codeProp=function(){return this.code},t.prototype.codeEquals=function(t){return r(t)===this.codeProp()},t.prototype.serverResponseProp=function(){return this.serverResponse_},t.prototype.setServerResponseProp=function(t){this.serverResponse_=t},Object.defineProperty(t.prototype,"name",{get:function(){return this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"code",{get:function(){return this.code_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"message",{get:function(){return this.message_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"serverResponse",{get:function(){return this.serverResponse_},enumerable:!0,configurable:!0}),t}(),oe={UNKNOWN:"unknown",OBJECT_NOT_FOUND:"object-not-found",BUCKET_NOT_FOUND:"bucket-not-found",PROJECT_NOT_FOUND:"project-not-found",QUOTA_EXCEEDED:"quota-exceeded",UNAUTHENTICATED:"unauthenticated",UNAUTHORIZED:"unauthorized",RETRY_LIMIT_EXCEEDED:"retry-limit-exceeded",INVALID_CHECKSUM:"invalid-checksum",CANCELED:"canceled",INVALID_EVENT_NAME:"invalid-event-name",INVALID_URL:"invalid-url",INVALID_DEFAULT_BUCKET:"invalid-default-bucket",NO_DEFAULT_BUCKET:"no-default-bucket",CANNOT_SLICE_BLOB:"cannot-slice-blob",SERVER_FILE_WRONG_SIZE:"server-file-wrong-size",NO_DOWNLOAD_URL:"no-download-url",INVALID_ARGUMENT:"invalid-argument",INVALID_ARGUMENT_COUNT:"invalid-argument-count",APP_DELETED:"app-deleted",INVALID_ROOT_OPERATION:"invalid-root-operation",INVALID_FORMAT:"invalid-format",INTERNAL_ERROR:"internal-error"},ae={RAW:"raw",BASE64:"base64",BASE64URL:"base64url",DATA_URL:"data_url"},se=function(){function t(t,e){this.data=t,this.contentType=e||null}return t}(),ue=function(){function t(t){this.base64=!1,this.contentType=null;var e=t.match(/^data:([^,]+)?,/);if(null===e)throw _(ae.DATA_URL,"Must be formatted 'data:[<mediatype>][;base64],<data>");var n=e[1]||null;null!=n&&(this.base64=A(n,";base64"),this.contentType=this.base64?n.substring(0,n.length-";base64".length):n),this.rest=t.substring(t.indexOf(",")+1)}return t}(),ce={STATE_CHANGED:"state_changed"},le={RUNNING:"running",PAUSING:"pausing",PAUSED:"paused",SUCCESS:"success",CANCELING:"canceling",CANCELED:"canceled",ERROR:"error"},he={RUNNING:"running",PAUSED:"paused",SUCCESS:"success",CANCELED:"canceled",ERROR:"error"};!function(t){t[t.NO_ERROR=0]="NO_ERROR",t[t.NETWORK_ERROR=1]="NETWORK_ERROR",t[t.ABORT=2]="ABORT"}(zt||(zt={}));var fe=function(){function t(){var t=this;this.sent_=!1,this.xhr_=new XMLHttpRequest,this.errorCode_=zt.NO_ERROR,this.sendPromise_=x(function(e,n){t.xhr_.addEventListener("abort",function(n){t.errorCode_=zt.ABORT,e(t)}),t.xhr_.addEventListener("error",function(n){t.errorCode_=zt.NETWORK_ERROR,e(t)}),t.xhr_.addEventListener("load",function(n){e(t)})})}return t.prototype.send=function(t,e,n,r){var i=this;if(this.sent_)throw w("cannot .send() more than once");if(this.sent_=!0,this.xhr_.open(e,t,!0),F(r)){D(r,function(t,e){i.xhr_.setRequestHeader(t,e.toString())})}return F(n)?this.xhr_.send(n):this.xhr_.send(),this.sendPromise_},t.prototype.getErrorCode=function(){if(!this.sent_)throw w("cannot .getErrorCode() before sending");return this.errorCode_},t.prototype.getStatus=function(){if(!this.sent_)throw w("cannot .getStatus() before sending");try{return this.xhr_.status}catch(t){return-1}},t.prototype.getResponseText=function(){if(!this.sent_)throw w("cannot .getResponseText() before sending");return this.xhr_.responseText},t.prototype.abort=function(){this.xhr_.abort()},t.prototype.getResponseHeader=function(t){return this.xhr_.getResponseHeader(t)},t.prototype.addUploadProgressListener=function(t){F(this.xhr_.upload)&&this.xhr_.upload.addEventListener("progress",t)},t.prototype.removeUploadProgressListener=function(t){F(this.xhr_.upload)&&this.xhr_.upload.removeEventListener("progress",t)},t}(),pe=function(){function t(){}return t.prototype.createXhrIo=function(){return new fe},t}(),de=function(){function t(t,e){this.bucket=t,this.path_=e}return Object.defineProperty(t.prototype,"path",{get:function(){return this.path_},enumerable:!0,configurable:!0}),t.prototype.fullServerUrl=function(){var t=encodeURIComponent;return"/b/"+t(this.bucket)+"/o/"+t(this.path)},t.prototype.bucketOnlyServerUrl=function(){return"/b/"+encodeURIComponent(this.bucket)+"/o"},t.makeFromBucketSpec=function(e){var n;try{n=t.makeFromUrl(e)}catch(n){return new t(e,"")}if(""===n.path)return n;throw f(e)},t.makeFromUrl=function(e){function n(t){"/"===t.path.charAt(t.path.length-1)&&(t.path_=t.path_.slice(0,-1))}function r(t){t.path_=decodeURIComponent(t.path)}for(var i=null,o=new RegExp("^gs://([A-Za-z0-9.\\-]+)(/(.*))?$","i"),a={bucket:1,path:3},s=new RegExp("^https?://firebasestorage\\.googleapis\\.com/v[A-Za-z0-9_]+/b/([A-Za-z0-9.\\-]+)/o(/([^?#]*).*)?$","i"),u={bucket:1,path:3},c=[{regex:o,indices:a,postModify:n},{regex:s,indices:u,postModify:r}],l=0;l<c.length;l++){var f=c[l],p=f.regex.exec(e);if(p){var d=p[f.indices.bucket],y=p[f.indices.path];y||(y=""),i=new t(d,y),f.postModify(i);break}}if(null==i)throw h(e);return i},t}(),ye=function(){function t(t,e,n,r){this.server=t,this.local=e||t,this.writable=!!n,this.xform=r||et}return t}(),me=null,ge=function(){function t(t,e){var n=this;this.validator=function(e){n.optional&&!U(e)||t(e)},this.optional=!!e}return t}(),ve=function(){function t(t,e){var n=0,r="";H(t)?(this.data_=t,n=t.size,r=t.type):t instanceof ArrayBuffer?(e?this.data_=new Uint8Array(t):(this.data_=new Uint8Array(t.byteLength),this.data_.set(new Uint8Array(t))),n=this.data_.length):t instanceof Uint8Array&&(e?this.data_=t:(this.data_=new Uint8Array(t.length),this.data_.set(t)),n=t.length),this.size_=n,this.type_=r}return t.prototype.size=function(){return this.size_},t.prototype.type=function(){return this.type_},t.prototype.slice=function(e,n){if(H(this.data_)){var r=this.data_,i=_t(r,e,n);return null===i?null:new t(i)}return new t(new Uint8Array(this.data_.buffer,e,n-e),!0)},t.getBlob=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];if(G()){var r=e.map(function(e){return e instanceof t?e.data_:e});return new t(bt.apply(null,r))}var i=e.map(function(t){return W(t)?T(ae.RAW,t).data:t.data_}),o=0;i.forEach(function(t){o+=t.byteLength});var a=new Uint8Array(o),s=0;return i.forEach(function(t){for(var e=0;e<t.length;e++)a[s++]=t[e]}),new t(a,!0)},t.prototype.uploadData=function(){return this.data_},t}(),be=function(){function t(t,e,n,r){this.url=t,this.method=e,this.handler=n,this.timeout=r,this.urlParams={},this.headers={},this.body=null,this.errorHandler=null,this.progressCallback=null,this.successCodes=[200],this.additionalRetryCodes=[]}return t}(),_e=function(){function t(t,e,n,r){this.current=t,this.total=e,this.finalized=!!n,this.metadata=r||null}return t}(),we=function(){function t(t,e,n){if(B(t)||F(e)||F(n))this.next=t,this.error=e||null,this.complete=n||null;else{var r=t;this.next=r.next||null,this.error=r.error||null,this.complete=r.complete||null}}return t}(),Ee=function(){function t(t,e,n,r,i,o){this.bytesTransferred=t,this.totalBytes=e,this.state=n,this.metadata=r,this.task=i,this.ref=o}return t}(),Te=function(){function t(t,e,n,r,i,o){void 0===o&&(o=null);var a=this;this.transferred_=0,this.needToFetchStatus_=!1,this.needToFetchMetadata_=!1,this.observers_=[],this.error_=null,this.uploadUrl_=null,this.request_=null,this.chunkMultiplier_=1,this.resolve_=null,this.reject_=null,this.ref_=t,this.authWrapper_=e,this.location_=n,this.blob_=i,this.metadata_=o,this.mappings_=r,this.resumable_=this.shouldDoResumable_(this.blob_),this.state_=le.RUNNING,this.errorHandler_=function(t){a.request_=null,a.chunkMultiplier_=1,t.codeEquals(oe.CANCELED)?(a.needToFetchStatus_=!0,a.completeTransitions_()):(a.error_=t,a.transition_(le.ERROR))},this.metadataErrorHandler_=function(t){a.request_=null,t.codeEquals(oe.CANCELED)?a.completeTransitions_():(a.error_=t,a.transition_(le.ERROR))},this.promise_=x(function(t,e){a.resolve_=t,a.reject_=e,a.start_()}),this.promise_.then(null,function(){})}return t.prototype.makeProgressCallback_=function(){var t=this,e=this.transferred_;return function(n,r){t.updateProgress_(e+n)}},t.prototype.shouldDoResumable_=function(t){return t.size()>262144},t.prototype.start_=function(){this.state_===le.RUNNING&&null===this.request_&&(this.resumable_?null===this.uploadUrl_?this.createResumable_():this.needToFetchStatus_?this.fetchStatus_():this.needToFetchMetadata_?this.fetchMetadata_():this.continueUpload_():this.oneShotUpload_())},t.prototype.resolveToken_=function(t){var e=this;this.authWrapper_.getAuthToken().then(function(n){switch(e.state_){case le.RUNNING:t(n);break;case le.CANCELING:e.transition_(le.CANCELED);break;case le.PAUSING:e.transition_(le.PAUSED)}})},t.prototype.createResumable_=function(){var t=this;this.resolveToken_(function(e){var n=Ft(t.authWrapper_,t.location_,t.mappings_,t.blob_,t.metadata_),r=t.authWrapper_.makeRequest(n,e);t.request_=r,r.getPromise().then(function(e){t.request_=null,t.uploadUrl_=e,t.needToFetchStatus_=!1,t.completeTransitions_()},t.errorHandler_)})},t.prototype.fetchStatus_=function(){var t=this,e=this.uploadUrl_;this.resolveToken_(function(n){var r=Ut(t.authWrapper_,t.location_,e,t.blob_),i=t.authWrapper_.makeRequest(r,n);t.request_=i,i.getPromise().then(function(e){e=e,t.request_=null,t.updateProgress_(e.current),t.needToFetchStatus_=!1,e.finalized&&(t.needToFetchMetadata_=!0),t.completeTransitions_()},t.errorHandler_)})},t.prototype.continueUpload_=function(){var t=this,e=262144*this.chunkMultiplier_,n=new _e(this.transferred_,this.blob_.size()),r=this.uploadUrl_;this.resolveToken_(function(i){var o;try{o=Bt(t.location_,t.authWrapper_,r,t.blob_,e,t.mappings_,n,t.makeProgressCallback_())}catch(e){return t.error_=e,void t.transition_(le.ERROR)}var a=t.authWrapper_.makeRequest(o,i);t.request_=a,a.getPromise().then(function(e){t.increaseMultiplier_(),t.request_=null,t.updateProgress_(e.current),e.finalized?(t.metadata_=e.metadata,t.transition_(le.SUCCESS)):t.completeTransitions_()},t.errorHandler_)})},t.prototype.increaseMultiplier_=function(){262144*this.chunkMultiplier_<33554432&&(this.chunkMultiplier_*=2)},t.prototype.fetchMetadata_=function(){var t=this;this.resolveToken_(function(e){var n=At(t.authWrapper_,t.location_,t.mappings_),r=t.authWrapper_.makeRequest(n,e);t.request_=r,r.getPromise().then(function(e){t.request_=null,t.metadata_=e,t.transition_(le.SUCCESS)},t.metadataErrorHandler_)})},t.prototype.oneShotUpload_=function(){var t=this;this.resolveToken_(function(e){var n=Lt(t.authWrapper_,t.location_,t.mappings_,t.blob_,t.metadata_),r=t.authWrapper_.makeRequest(n,e);t.request_=r,r.getPromise().then(function(e){t.request_=null,t.metadata_=e,t.updateProgress_(t.blob_.size()),t.transition_(le.SUCCESS)},t.errorHandler_)})},t.prototype.updateProgress_=function(t){var e=this.transferred_;this.transferred_=t,this.transferred_!==e&&this.notifyObservers_()},t.prototype.transition_=function(t){if(this.state_!==t)switch(t){case le.CANCELING:case le.PAUSING:this.state_=t,null!==this.request_&&this.request_.cancel();break;case le.RUNNING:var e=this.state_===le.PAUSED;this.state_=t,e&&(this.notifyObservers_(),this.start_());break;case le.PAUSED:this.state_=t,this.notifyObservers_();break;case le.CANCELED:this.error_=l(),this.state_=t,this.notifyObservers_();break;case le.ERROR:case le.SUCCESS:this.state_=t,this.notifyObservers_()}},t.prototype.completeTransitions_=function(){switch(this.state_){case le.PAUSING:this.transition_(le.PAUSED);break;case le.CANCELING:this.transition_(le.CANCELED);break;case le.RUNNING:this.start_()}},Object.defineProperty(t.prototype,"snapshot",{get:function(){var t=R(this.state_);return new Ee(this.transferred_,this.blob_.size(),t,this.metadata_,this,this.ref_)},enumerable:!0,configurable:!0}),t.prototype.on=function(t,e,n,r){function i(e){if(t!==ce.STATE_CHANGED)throw"Expected one of the event types: ["+ce.STATE_CHANGED+"]."}function o(t){try{return void c(t)}catch(t){}try{l(t);if(!(U(t.next)||U(t.error)||U(t.complete)))throw"";return}catch(t){throw u}}function a(t){function e(e,n,i){null!==t&<("on",t,arguments);var o=new we(e,n,r);return h.addObserver_(o),function(){h.removeObserver_(o)}}return e}function s(t){if(null===t)throw u;o(t)}void 0===e&&(e=void 0),void 0===n&&(n=void 0),void 0===r&&(r=void 0);var u="Expected a function or an Object with one of `next`, `error`, `complete` properties.",c=gt(!0).validator,l=mt(null,!0).validator;lt("on",[ft(i),mt(o,!0),gt(!0),gt(!0)],arguments);var h=this,f=[mt(s),gt(!0),gt(!0)];return U(e)||U(n)||U(r)?a(null)(e,n,r):a(f)},t.prototype.then=function(t,e){return this.promise_.then(t,e)},t.prototype.catch=function(t){return this.then(null,t)},t.prototype.addObserver_=function(t){this.observers_.push(t),this.notifyObserver_(t)},t.prototype.removeObserver_=function(t){Tt(this.observers_,t)},t.prototype.notifyObservers_=function(){var t=this;this.finishPromise_(),Et(this.observers_).forEach(function(e){t.notifyObserver_(e)})},t.prototype.finishPromise_=function(){if(null!==this.resolve_){var t=!0;switch(R(this.state_)){case he.SUCCESS:Vt(this.resolve_.bind(null,this.snapshot))();break;case he.CANCELED:case he.ERROR:Vt(this.reject_.bind(null,this.error_))();break;default:t=!1}t&&(this.resolve_=null,this.reject_=null)}},t.prototype.notifyObserver_=function(t){switch(R(this.state_)){case he.RUNNING:case he.PAUSED:null!==t.next&&Vt(t.next.bind(t,this.snapshot))();break;case he.SUCCESS:null!==t.complete&&Vt(t.complete.bind(t))();break;case he.CANCELED:case he.ERROR:null!==t.error&&Vt(t.error.bind(t,this.error_))();break;default:null!==t.error&&Vt(t.error.bind(t,this.error_))()}},t.prototype.resume=function(){lt("resume",[],arguments);var t=this.state_===le.PAUSED||this.state_===le.PAUSING;return t&&this.transition_(le.RUNNING),t},t.prototype.pause=function(){lt("pause",[],arguments);var t=this.state_===le.RUNNING;return t&&this.transition_(le.PAUSING),t},t.prototype.cancel=function(){lt("cancel",[],arguments);var t=this.state_===le.RUNNING||this.state_===le.PAUSING;return t&&this.transition_(le.CANCELING),t},t}(),Se=function(){function t(t,e){this.authWrapper=t,this.location=e instanceof de?e:de.makeFromUrl(e)}return t.prototype.toString=function(){return lt("toString",[],arguments),"gs://"+this.location.bucket+"/"+this.location.path},t.prototype.newRef=function(e,n){return new t(e,n)},t.prototype.mappings=function(){return rt()},t.prototype.child=function(t){lt("child",[ft()],arguments);var e=Y(this.location.path,t),n=new de(this.location.bucket,e);return this.newRef(this.authWrapper,n)},Object.defineProperty(t.prototype,"parent",{get:function(){var t=z(this.location.path);if(null===t)return null;var e=new de(this.location.bucket,t);return this.newRef(this.authWrapper,e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"root",{get:function(){var t=new de(this.location.bucket,"");return this.newRef(this.authWrapper,t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"bucket",{get:function(){return this.location.bucket},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fullPath",{get:function(){return this.location.path},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return X(this.location.path)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"storage",{get:function(){return this.authWrapper.service()},enumerable:!0,configurable:!0}),t.prototype.put=function(t,e){return void 0===e&&(e=null),lt("put",[pt(),dt(!0)],arguments),this.throwIfRoot_("put"),new Te(this,this.authWrapper,this.location,this.mappings(),new ve(t),e)},t.prototype.putString=function(t,e,n){void 0===e&&(e=ae.RAW),lt("putString",[ft(),ft(E,!0),dt(!0)],arguments),this.throwIfRoot_("putString");var r=T(e,t),i=P(n);return!F(i.contentType)&&F(r.contentType)&&(i.contentType=r.contentType),new Te(this,this.authWrapper,this.location,this.mappings(),new ve(r.data,!0),i)},t.prototype.delete=function(){lt("delete",[],arguments),this.throwIfRoot_("delete");var t=this;return this.authWrapper.getAuthToken().then(function(e){var n=Dt(t.authWrapper,t.location);return t.authWrapper.makeRequest(n,e).getPromise()})},t.prototype.getMetadata=function(){lt("getMetadata",[],arguments),this.throwIfRoot_("getMetadata");var t=this;return this.authWrapper.getAuthToken().then(function(e){var n=At(t.authWrapper,t.location,t.mappings());return t.authWrapper.makeRequest(n,e).getPromise()})},t.prototype.updateMetadata=function(t){lt("updateMetadata",[dt()],arguments),this.throwIfRoot_("updateMetadata");var e=this;return this.authWrapper.getAuthToken().then(function(n){var r=Ot(e.authWrapper,e.location,t,e.mappings());return e.authWrapper.makeRequest(r,n).getPromise()})},t.prototype.getDownloadURL=function(){lt("getDownloadURL",[],arguments),this.throwIfRoot_("getDownloadURL");var t=this;return this.authWrapper.getAuthToken().then(function(e){var n=Rt(t.authWrapper,t.location,t.mappings());return t.authWrapper.makeRequest(n,e).getPromise().then(function(t){if(null===t)throw y();return t})})},t.prototype.throwIfRoot_=function(t){if(""===this.location.path)throw b(t)},t}(),Ce=function(){function t(t){this.promise_=M(t)}return t.prototype.getPromise=function(){return this.promise_},t.prototype.cancel=function(t){void 0===t&&(t=!1)},t}(),Ie=function(){function t(){this.map_={},this.id_=re}return t.prototype.addRequest=function(t){function e(){delete r.map_[n]}var n=this.id_;this.id_++,this.map_[n]=t;var r=this;t.getPromise().then(e,e)},t.prototype.clear=function(){D(this.map_,function(t,e){e&&e.cancel(!0)}),this.map_={}},t}(),Ne=function(){function t(e,n,r,i,o){if(this.bucket_=null,this.deleted_=!1,this.app_=e,null!==this.app_){var a=this.app_.options;F(a)&&(this.bucket_=t.extractBucket_(a))}this.storageRefMaker_=n,this.requestMaker_=r,this.pool_=o,this.service_=i,this.maxOperationRetryTime_=ee,this.maxUploadRetryTime_=ne,this.requestMap_=new Ie}return t.extractBucket_=function(t){var e=t.storageBucket||null;return null==e?null:de.makeFromBucketSpec(e).bucket},t.prototype.getAuthToken=function(){return null!==this.app_&&F(this.app_.INTERNAL)&&F(this.app_.INTERNAL.getToken)?this.app_.INTERNAL.getToken().then(function(t){return null!==t?t.accessToken:null},function(t){return null}):L(null)},t.prototype.bucket=function(){if(this.deleted_)throw v();return this.bucket_},t.prototype.service=function(){return this.service_},t.prototype.makeStorageReference=function(t){return this.storageRefMaker_(this,t)},t.prototype.makeRequest=function(t,e){if(this.deleted_)return new Ce(v());var n=this.requestMaker_(t,e,this.pool_);return this.requestMap_.addRequest(n),n},t.prototype.deleteApp=function(){this.deleted_=!0,this.app_=null,this.requestMap_.clear()},t.prototype.maxUploadRetryTime=function(){return this.maxUploadRetryTime_},t.prototype.setMaxUploadRetryTime=function(t){this.maxUploadRetryTime_=t},t.prototype.maxOperationRetryTime=function(){return this.maxOperationRetryTime_},t.prototype.setMaxOperationRetryTime=function(t){this.maxOperationRetryTime_=t},t}(),ke=function(){function t(t,e,n,r,i,o,a,s,u,c,l){this.pendingXhr_=null,this.backoffId_=null,this.resolve_=null,this.reject_=null,this.canceled_=!1,this.appDelete_=!1,this.url_=t,this.method_=e,this.headers_=n,this.body_=r,this.successCodes_=i.slice(),this.additionalRetryCodes_=o.slice(),this.callback_=a,this.errorCallback_=s,this.progressCallback_=c,this.timeout_=u,this.pool_=l;var h=this;this.promise_=x(function(t,e){h.resolve_=t,h.reject_=e,h.start_()})}return t.prototype.start_=function(){function t(t,e){function r(t){var e=t.loaded,r=t.lengthComputable?t.total:-1;null!==n.progressCallback_&&n.progressCallback_(e,r)}if(e)return void t(!1,new Ae(!1,null,!0));var i=n.pool_.createXhrIo();n.pendingXhr_=i,null!==n.progressCallback_&&i.addUploadProgressListener(r),i.send(n.url_,n.method_,n.body_,n.headers_).then(function(e){null!==n.progressCallback_&&e.removeUploadProgressListener(r),n.pendingXhr_=null,e=e;var i=e.getErrorCode()===zt.NO_ERROR,o=e.getStatus();if(!i||n.isRetryStatusCode_(o)){var a=e.getErrorCode()===zt.ABORT;return void t(!1,new Ae(!1,null,a))}var s=wt(n.successCodes_,o);t(!0,new Ae(s,e))})}function e(t,e){var r=n.resolve_,o=n.reject_,a=e.xhr;if(e.wasSuccessCode)try{var s=n.callback_(a,a.getResponseText());U(s)?r(s):r()}catch(t){o(t)}else if(null!==a){var u=i();u.setServerResponseProp(a.getResponseText()),o(n.errorCallback_?n.errorCallback_(a,u):u)}else if(e.canceled){var u=n.appDelete_?v():l();o(u)}else{var u=c();o(u)}}var n=this;this.canceled_?e(!1,new Ae(!1,null,!0)):this.backoffId_=jt(t,e,this.timeout_)},t.prototype.getPromise=function(){return this.promise_},t.prototype.cancel=function(t){this.canceled_=!0,this.appDelete_=t||!1,null!==this.backoffId_&&qt(this.backoffId_),null!==this.pendingXhr_&&this.pendingXhr_.abort()},t.prototype.isRetryStatusCode_=function(t){var e=t>=500&&t<600,n=[408,429],r=wt(n,t),i=wt(this.additionalRetryCodes_,t);return e||r||i},t}(),Ae=function(){function t(t,e,n){this.wasSuccessCode=t,this.xhr=e,this.canceled=!!n}return t}(),Re=function(){function t(t,e,n){function r(t,e){return new Se(t,e)}if(this.bucket_=null,this.authWrapper_=new Ne(t,r,Ht,this,e),this.app_=t,null!=n)this.bucket_=de.makeFromBucketSpec(n);else{var i=this.authWrapper_.bucket();null!=i&&(this.bucket_=new de(i,""))}this.internals_=new Oe(this)}return t.prototype.ref=function(t){function e(t){if(/^[A-Za-z]+:\/\//.test(t))throw"Expected child path but got a URL, use refFromURL instead."}if(lt("ref",[ft(e,!0)],arguments),null==this.bucket_)throw new Error("No Storage Bucket defined in Firebase Options.");var n=new Se(this.authWrapper_,this.bucket_);return null!=t?n.child(t):n},t.prototype.refFromURL=function(t){function e(t){if(!/^[A-Za-z]+:\/\//.test(t))throw"Expected full URL but got a child path, use ref instead.";try{de.makeFromUrl(t)}catch(t){throw"Expected valid full URL but got an invalid one."}}return lt("refFromURL",[ft(e,!1)],arguments),new Se(this.authWrapper_,t)},Object.defineProperty(t.prototype,"maxUploadRetryTime",{get:function(){return this.authWrapper_.maxUploadRetryTime()},enumerable:!0,configurable:!0}),t.prototype.setMaxUploadRetryTime=function(t){lt("setMaxUploadRetryTime",[yt()],arguments),this.authWrapper_.setMaxUploadRetryTime(t)},Object.defineProperty(t.prototype,"maxOperationRetryTime",{get:function(){return this.authWrapper_.maxOperationRetryTime()},enumerable:!0,configurable:!0}),t.prototype.setMaxOperationRetryTime=function(t){lt("setMaxOperationRetryTime",[yt()],arguments),this.authWrapper_.setMaxOperationRetryTime(t)},Object.defineProperty(t.prototype,"app",{get:function(){return this.app_},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"INTERNAL",{get:function(){return this.internals_},enumerable:!0,configurable:!0}),t}(),Oe=function(){function t(t){this.service_=t}return t.prototype.delete=function(){return this.service_.authWrapper_.deleteApp(),L(void 0)},t}(),De="storage";Qt(Xt.a)},function(t,e,n){"use strict";function r(){if("serviceWorker"in navigator){if(new URL("/push-notification-demo",window.location).origin!==window.location.origin)return;window.addEventListener("load",function(){var t="/push-notification-demo/service-worker.js";a?(o(t),navigator.serviceWorker.ready.then(function(){console.log("This web app is being served cache-first by a service worker. To learn more, visit https://goo.gl/SC7cgQ")})):i(t)})}}function i(t){navigator.serviceWorker.register(t).then(function(t){t.onupdatefound=function(){var e=t.installing;e.onstatechange=function(){"installed"===e.state&&(navigator.serviceWorker.controller?console.log("New content is available; please refresh."):console.log("Content is cached for offline use."))}}}).catch(function(t){console.error("Error during service worker registration:",t)})}function o(t){fetch(t).then(function(e){404===e.status||-1===e.headers.get("content-type").indexOf("javascript")?navigator.serviceWorker.ready.then(function(t){t.unregister().then(function(){window.location.reload()})}):i(t)}).catch(function(){console.log("No internet connection found. App is running in offline mode.")})}e.a=r;var a=Boolean("localhost"===window.location.hostname||"[::1]"===window.location.hostname||window.location.hostname.match(/^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/))}]);
//# sourceMappingURL=main.4147225f.js.map