Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
(this.webpackJsonp=this.webpackJsonp||[]).push([[5],{1021:function(t,e,n){"use strict";n.d(e,"a",(function(){return o}));var r=n(307),i=n(33),o=function(){function t(){this.getFragmentDoc=Object(r.c)(i.o)}return t.prototype.recordOptimisticTransaction=function(t,e){this.performTransaction(t,e)},t.prototype.transformDocument=function(t){return t},t.prototype.identify=function(t){},t.prototype.gc=function(){return[]},t.prototype.modify=function(t){return!1},t.prototype.transformForLink=function(t){return t},t.prototype.readQuery=function(t,e){return void 0===e&&(e=!1),this.read({rootId:t.id||"ROOT_QUERY",query:t.query,variables:t.variables,optimistic:e})},t.prototype.readFragment=function(t,e){return void 0===e&&(e=!1),this.read({query:this.getFragmentDoc(t.fragment,t.fragmentName),variables:t.variables,rootId:t.id,optimistic:e})},t.prototype.writeQuery=function(t){return this.write({dataId:t.id||"ROOT_QUERY",result:t.data,query:t.query,variables:t.variables,broadcast:t.broadcast})},t.prototype.writeFragment=function(t){return this.write({dataId:t.id,result:t.data,variables:t.variables,query:this.getFragmentDoc(t.fragment,t.fragmentName),broadcast:t.broadcast})},t}()},1022:function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=function(t,e,n,r,i){this.message=t,this.path=e,this.query=n,this.clientOnly=r,this.variables=i}},1044:function(t,e,n){"use strict";n.d(e,"a",(function(){return c}));var r=n(4),i=n(59),o=n(159),a=n(168),s=n(33),u=function(){function t(t,e,n,r){this.observer=t,this.options=e,this.fetch=n,this.shouldFetch=r}return t.prototype.reobserve=function(t,e){t?this.updateOptions(t):this.updatePolling();var n=this.fetch(this.options,e);return this.concast&&this.concast.removeObserver(this.observer,!0),n.addObserver(this.observer),(this.concast=n).promise},t.prototype.updateOptions=function(t){return Object.assign(this.options,Object(s.j)(t)),this.updatePolling(),this},t.prototype.stop=function(){this.concast&&(this.concast.removeObserver(this.observer),delete this.concast),this.pollingInfo&&(clearTimeout(this.pollingInfo.timeout),this.options.pollInterval=0,this.updatePolling())},t.prototype.updatePolling=function(){var t=this,e=this.pollingInfo,n=this.options.pollInterval;if(n){if((!e||e.interval!==n)&&(Object(i.b)(n,20),!1!==this.shouldFetch)){(e||(this.pollingInfo={})).interval=n;var r=function(){t.pollingInfo&&(t.shouldFetch&&t.shouldFetch()?t.reobserve({fetchPolicy:"network-only",nextFetchPolicy:t.options.fetchPolicy||"cache-first"},a.a.poll).then(o,o):o())},o=function(){var e=t.pollingInfo;e&&(clearTimeout(e.timeout),e.timeout=setTimeout(r,e.interval))};o()}}else e&&(clearTimeout(e.timeout),delete this.pollingInfo)},t}(),c=function(t){function e(e){var n=e.queryManager,i=e.queryInfo,o=e.options,u=t.call(this,(function(t){return u.onSubscribe(t)}))||this;u.observers=new Set,u.subscriptions=new Set,u.observer={next:function(t){(u.lastError||u.isDifferentFromLastResult(t))&&(u.updateLastResult(t),Object(s.C)(u.observers,"next",t))},error:function(t){u.updateLastResult(Object(r.__assign)(Object(r.__assign)({},u.lastResult),{error:t,errors:t.graphQLErrors,networkStatus:a.a.error,loading:!1})),Object(s.C)(u.observers,"error",u.lastError=t)}},u.isTornDown=!1,u.options=o,u.queryId=n.generateQueryId();var c=Object(s.q)(o.query);return u.queryName=c&&c.name&&c.name.value,u.queryManager=n,u.queryInfo=i,u}return Object(r.__extends)(e,t),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise((function(e,n){var r={next:function(n){e(n),t.observers.delete(r),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout((function(){i.unsubscribe()}),0)},error:n},i=t.subscribe(r)}))},e.prototype.getCurrentResult=function(t){void 0===t&&(t=!0);var e=this.lastResult,n=this.queryInfo.networkStatus||e&&e.networkStatus||a.a.ready,i=Object(r.__assign)(Object(r.__assign)({},e),{loading:Object(a.b)(n),networkStatus:n});if(this.isTornDown)return i;var o=this.options.fetchPolicy,s=void 0===o?"cache-first":o;if("no-cache"===s||"network-only"===s)delete i.partial;else if(!i.data||!this.queryManager.transform(this.options.query).hasForcedResolvers){var u=this.queryInfo.getDiff();i.data=u.complete||this.options.returnPartialData?u.result:void 0,u.complete?(i.networkStatus!==a.a.loading||"cache-first"!==s&&"cache-only"!==s||(i.networkStatus=a.a.ready,i.loading=!1),delete i.partial):i.partial=!0}return t&&this.updateLastResult(i),i},e.prototype.isDifferentFromLastResult=function(t){return!Object(o.a)(this.lastResultSnapshot,t)},e.prototype.getLastResult=function(){return this.lastResult},e.prototype.getLastError=function(){return this.lastError},e.prototype.resetLastResults=function(){delete this.lastResult,delete this.lastResultSnapshot,delete this.lastError,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var e={pollInterval:0},n=this.options.fetchPolicy;return"no-cache"!==n&&"cache-and-network"!==n&&(e.fetchPolicy="network-only",e.nextFetchPolicy=n||"cache-first"),t&&!Object(o.a)(this.options.variables,t)&&(e.variables=this.options.variables=Object(r.__assign)(Object(r.__assign)({},this.options.variables),t)),this.newReobserver(!1).reobserve(e,a.a.refetch)},e.prototype.fetchMore=function(t){var e=this,n=Object(r.__assign)(Object(r.__assign)({},t.query?t:Object(r.__assign)(Object(r.__assign)(Object(r.__assign)({},this.options),t),{variables:Object(r.__assign)(Object(r.__assign)({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),i=this.queryManager.generateQueryId();return n.notifyOnNetworkStatusChange&&(this.queryInfo.networkStatus=a.a.fetchMore,this.observe()),this.queryManager.fetchQuery(i,n,a.a.fetchMore).then((function(r){var i=r.data,o=t.updateQuery;return o?e.updateQuery((function(t){return o(t,{fetchMoreResult:i,variables:n.variables})})):e.queryManager.cache.writeQuery({query:n.query,variables:n.variables,data:i}),r})).finally((function(){e.queryManager.stopQuery(i),e.reobserve()}))},e.prototype.subscribeToMore=function(t){var e=this,n=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(n){var r=t.updateQuery;r&&e.updateQuery((function(t,e){var i=e.variables;return r(t,{subscriptionData:n,variables:i})}))},error:function(e){t.onError&&t.onError(e)}});return this.subscriptions.add(n),function(){e.subscriptions.delete(n)&&n.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){if(Object(o.a)(this.variables,t))return this.observers.size?this.result():Promise.resolve();if(this.options.variables=t,!this.observers.size)return Promise.resolve();var e=this.options.fetchPolicy,n=void 0===e?"cache-first":e,r={fetchPolicy:n,variables:t};return"cache-first"!==n&&"no-cache"!==n&&"network-only"!==n&&(r.fetchPolicy="cache-and-network",r.nextFetchPolicy=n),this.reobserve(r,a.a.setVariables)},e.prototype.updateQuery=function(t){var e,n=this.queryManager,r=t(n.cache.diff({query:this.options.query,variables:this.variables,previousResult:null===(e=this.lastResult)||void 0===e?void 0:e.data,returnPartialData:!0,optimistic:!1}).result,{variables:this.variables});r&&(n.cache.writeQuery({query:this.options.query,data:r,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(t){this.getReobserver().updateOptions({pollInterval:t})},e.prototype.stopPolling=function(){this.reobserver&&this.reobserver.updateOptions({pollInterval:0})},e.prototype.updateLastResult=function(t){var e=this.lastResult;return this.lastResult=t,this.lastResultSnapshot=this.queryManager.assumeImmutableResults?t:Object(s.i)(t),Object(s.A)(t.errors)||delete this.lastError,e},e.prototype.onSubscribe=function(t){var e=this;if(t===this.observer)return function(){};try{var n=t._subscription._observer;n&&!n.error&&(n.error=l)}catch(t){}var r=!this.observers.size;return this.observers.add(t),this.lastError?t.error&&t.error(this.lastError):this.lastResult&&t.next&&t.next(this.lastResult),r&&this.reobserve().catch((function(t){})),function(){e.observers.delete(t)&&!e.observers.size&&e.tearDownQuery()}},e.prototype.getReobserver=function(){return this.reobserver||(this.reobserver=this.newReobserver(!0))},e.prototype.newReobserver=function(t){var e=this,n=this.queryManager,i=this.queryId;return n.setObservableQuery(this),new u(this.observer,t?this.options:Object(r.__assign)({},this.options),(function(t,r){return n.setObservableQuery(e),n.fetchQueryObservable(i,t,r)}),!n.ssrMode&&function(){return!Object(a.b)(e.queryInfo.networkStatus)})},e.prototype.reobserve=function(t,e){return this.isTornDown=!1,this.getReobserver().reobserve(t,e)},e.prototype.observe=function(){this.observer.next(this.getCurrentResult(!1))},e.prototype.tearDownQuery=function(){var t=this.queryManager;this.reobserver&&(this.reobserver.stop(),delete this.reobserver),this.isTornDown=!0,this.subscriptions.forEach((function(t){return t.unsubscribe()})),this.subscriptions.clear(),t.stopQuery(this.queryId),this.observers.clear()},e}(s.c);function l(t){}},1266:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r,i,o=n(4),a=n(1267),s=n(1687),u=n(1688),c=((r={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",r["bad-app-name"]="Illegal App name: '{$appName}",r["duplicate-app"]="Firebase App named '{$appName}' already exists",r["app-deleted"]="Firebase App named '{$appName}' already deleted",r["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",r["invalid-log-argument"]="First argument to `onLog` must be null or a function.",r),l=new a.ErrorFactory("app","Firebase",c),h=((i={})["@firebase/app"]="fire-core",i["@firebase/analytics"]="fire-analytics",i["@firebase/auth"]="fire-auth",i["@firebase/database"]="fire-rtdb",i["@firebase/functions"]="fire-fn",i["@firebase/installations"]="fire-iid",i["@firebase/messaging"]="fire-fcm",i["@firebase/performance"]="fire-perf",i["@firebase/remote-config"]="fire-rc",i["@firebase/storage"]="fire-gcs",i["@firebase/firestore"]="fire-fst",i["fire-js"]="fire-js",i["firebase-wrapper"]="fire-js-all",i),f=new u.Logger("@firebase/app"),p=function(){function t(t,e,n){var r,i,u=this;this.firebase_=n,this.isDeleted_=!1,this.name_=e.name,this.automaticDataCollectionEnabled_=e.automaticDataCollectionEnabled||!1,this.options_=a.deepCopy(t),this.container=new s.ComponentContainer(e.name),this._addComponent(new s.Component("app",(function(){return u}),"PUBLIC"));try{for(var c=o.__values(this.firebase_.INTERNAL.components.values()),l=c.next();!l.done;l=c.next()){var h=l.value;this._addComponent(h)}}catch(t){r={error:t}}finally{try{l&&!l.done&&(i=c.return)&&i.call(c)}finally{if(r)throw r.error}}}return Object.defineProperty(t.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(t){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=t},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),t.prototype.delete=function(){var t=this;return new Promise((function(e){t.checkDestroyed_(),e()})).then((function(){return t.firebase_.INTERNAL.removeApp(t.name_),Promise.all(t.container.getProviders().map((function(t){return t.delete()})))})).then((function(){t.isDeleted_=!0}))},t.prototype._getService=function(t,e){return void 0===e&&(e="[DEFAULT]"),this.checkDestroyed_(),this.container.getProvider(t).getImmediate({identifier:e})},t.prototype._removeServiceInstance=function(t,e){void 0===e&&(e="[DEFAULT]"),this.container.getProvider(t).clearInstance(e)},t.prototype._addComponent=function(t){try{this.container.addComponent(t)}catch(e){f.debug("Component "+t.name+" failed to register with FirebaseApp "+this.name,e)}},t.prototype._addOrOverwriteComponent=function(t){this.container.addOrOverwriteComponent(t)},t.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw l.create("app-deleted",{appName:this.name_})},t}();p.prototype.name&&p.prototype.options||p.prototype.delete||console.log("dc");var d=
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function t(){var e=
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
function(t){var e={},n=new Map,r={__esModule:!0,initializeApp:function(n,i){void 0===i&&(i={});if("object"!=typeof i||null===i){i={name:i}}var o=i;void 0===o.name&&(o.name="[DEFAULT]");var s=o.name;if("string"!=typeof s||!s)throw l.create("bad-app-name",{appName:String(s)});if(a.contains(e,s))throw l.create("duplicate-app",{appName:s});var u=new t(n,o,r);return e[s]=u,u},app:i,registerVersion:function(t,e,n){var r,i=null!==(r=h[t])&&void 0!==r?r:t;n&&(i+="-"+n);var o=i.match(/\s|\//),a=e.match(/\s|\//);if(o||a){var u=['Unable to register library "'+i+'" with version "'+e+'":'];return o&&u.push('library name "'+i+'" contains illegal characters (whitespace or "/")'),o&&a&&u.push("and"),a&&u.push('version name "'+e+'" contains illegal characters (whitespace or "/")'),void f.warn(u.join(" "))}c(new s.Component(i+"-version",(function(){return{library:i,version:e}}),"VERSION"))},setLogLevel:u.setLogLevel,onLog:function(t,e){if(null!==t&&"function"!=typeof t)throw l.create("invalid-log-argument",{appName:name});u.setUserLogHandler(t,e)},apps:null,SDK_VERSION:"7.20.0",INTERNAL:{registerComponent:c,removeApp:function(t){delete e[t]},components:n,useAsService:function(t,e){if("serverAuth"===e)return null;return e}}};function i(t){if(t=t||"[DEFAULT]",!a.contains(e,t))throw l.create("no-app",{appName:t});return e[t]}function c(s){var u,c,h=s.name;if(n.has(h))return f.debug("There were multiple attempts to register component "+h+"."),"PUBLIC"===s.type?r[h]:null;if(n.set(h,s),"PUBLIC"===s.type){var p=function(t){if(void 0===t&&(t=i()),"function"!=typeof t[h])throw l.create("invalid-app-argument",{appName:h});return t[h]()};void 0!==s.serviceProps&&a.deepExtend(p,s.serviceProps),r[h]=p,t.prototype[h]=function(){for(var t=[],e=0;e=0&&f.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n ")}var g=d.initializeApp;d.initializeApp=function(){for(var t=[],e=0;e>6|192,e[n++]=63&i|128):55296==(64512&i)&&r+1>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},u={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(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>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(s(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){for(var e=[],n=0,r=0;n191&&i<224){var o=t[n++];e[r++]=String.fromCharCode((31&i)<<6|63&o)}else if(i>239&&i<365){var a=((7&i)<<18|(63&(o=t[n++]))<<12|(63&(s=t[n++]))<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(a>>10)),e[r++]=String.fromCharCode(56320+(1023&a))}else{o=t[n++];var s=t[n++];e[r++]=String.fromCharCode((15&i)<<12|(63&o)<<6|63&s)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray:function(t,e){this.init_();for(var n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i>4;if(r.push(c),64!==s){var l=a<<4&240|s>>2;if(r.push(l),64!==u){var h=s<<6&192|u;r.push(h)}}}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var t=0;t=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},c=function(t){try{return u.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null};
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function l(t,e){if(!(e instanceof Object))return e;switch(e.constructor){case Date:return new Date(e.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return e}for(var n in e)e.hasOwnProperty(n)&&(t[n]=l(t[n],e[n]));return t}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var h=function(){function t(){var t=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise((function(e,n){t.resolve=e,t.reject=n}))}return t.prototype.wrapCallback=function(t){var e=this;return function(n,r){n?e.reject(n):e.resolve(r),"function"==typeof t&&(e.promise.catch((function(){})),1===t.length?t(n):t(n,r))}},t}();
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function f(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function p(){try{return"[object process]"===Object.prototype.toString.call(t.process)}catch(t){return!1}}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var d=function(t){function e(n,r){var i=t.call(this,r)||this;return i.code=n,i.name="FirebaseError",Object.setPrototypeOf(i,e.prototype),Error.captureStackTrace&&Error.captureStackTrace(i,v.prototype.create),i}return r.__extends(e,t),e}(Error),v=function(){function t(t,e,n){this.service=t,this.serviceName=e,this.errors=n}return t.prototype.create=function(t){for(var e=[],n=1;n"}))}var g=/\{\$([^}]+)}/g;
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function m(t){return JSON.parse(t)}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var b=function(t){var e={},n={},r={},i="";try{var o=t.split(".");e=m(c(o[0])||""),n=m(c(o[1])||""),i=o[2],r=n.d||{},delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}};
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var _=function(){function t(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(var t=1;t>>31)}var o,a,s=this.chain_[0],u=this.chain_[1],c=this.chain_[2],l=this.chain_[3],h=this.chain_[4];for(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);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},t.prototype.update=function(t,e){if(null!=t){void 0===e&&(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r=56;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);var r=0;for(n=0;n<5;n++)for(var i=24;i>=0;i-=8)t[r]=this.chain_[n]>>i&255,++r;return t},t}();var w=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.");void 0===(r=function(t,e){if("object"!=typeof t||null===t)return!1;for(var n=0,r=e;n 4. Need to update it?")}var i=t+" failed: ";return i+=r+" argument "}e.CONSTANTS=i,e.Deferred=h,e.ErrorFactory=v,e.FirebaseError=d,e.MAX_VALUE_MILLIS=144e5,e.RANDOM_FACTOR=.5,e.Sha1=_,e.areCookiesEnabled=function(){return!(!navigator||!navigator.cookieEnabled)},e.assert=o,e.assertionError=a,e.async=function(t,e){return function(){for(var n=[],r=0;r=0},e.isEmpty=function(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0},e.isIE=function(){var t=f();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0},e.isIndexedDBAvailable=function(){return"indexedDB"in self&&null!=indexedDB},e.isMobileCordova=function(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(f())},e.isNode=p,e.isNodeSdk=function(){return!0===i.NODE_CLIENT||!0===i.NODE_ADMIN},e.isReactNative=function(){return"object"==typeof navigator&&"ReactNative"===navigator.product},e.isSafari=function(){return!p()&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")},e.isUWP=function(){return f().indexOf("MSAppHost/")>=0},e.isValidFormat=function(t){var e=b(t).claims;return!!e&&"object"==typeof e&&e.hasOwnProperty("iat")},e.isValidTimestamp=function(t){var e=b(t).claims,n=Math.floor((new Date).getTime()/1e3),r=0,i=0;return"object"==typeof e&&(e.hasOwnProperty("nbf")?r=e.nbf:e.hasOwnProperty("iat")&&(r=e.iat),i=e.hasOwnProperty("exp")?e.exp:r+86400),!!n&&!!r&&!!i&&n>=r&&n<=i},e.issuedAtTime=function(t){var e=b(t).claims;return"object"==typeof e&&e.hasOwnProperty("iat")?e.iat:null},e.jsonEval=m,e.map=function(t,e,n){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&(r[i]=e.call(n,t[i],i,t));return r}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,e.querystring=function(t){for(var e=[],n=function(t,n){Array.isArray(n)?n.forEach((function(n){e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))})):e.push(encodeURIComponent(t)+"="+encodeURIComponent(n))},r=0,i=Object.entries(t);r=55296&&r<=56319?(e+=4,n++):e+=3}return e},e.stringToByteArray=function(t){for(var e=[],n=0,r=0;r=55296&&i<=56319){var a=i-55296;r++,o(r>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},e.stringify=function(t){return JSON.stringify(t)},e.validateArgCount=function(t,e,n,r){var i;if(rn&&(i=0===n?"none":"no more than "+n),i)throw new Error(t+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".")},e.validateCallback=function(t,e,n,r){if((!r||n)&&"function"!=typeof n)throw new Error(C(t,e,r)+"must be a valid function.")},e.validateContextObject=function(t,e,n,r){if((!r||n)&&("object"!=typeof n||null===n))throw new Error(C(t,e,r)+"must be a valid context object.")}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/,e.validateIndexedDBOpenable=function(){return new Promise((function(t,e){try{var n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=window.indexedDB.open(r);i.onsuccess=function(){i.result.close(),n||window.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=function(){n=!1},i.onerror=function(){var t;e((null===(t=i.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}}))},e.validateNamespace=function(t,e,n,r){if((!r||n)&&"string"!=typeof n)throw new Error(C(t,e,r)+"must be a valid firebase namespace.")}}).call(this,n(143))},1348:function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=n(398).a.empty},1351:function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=n(398).a.from},1352:function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=n(398).a.split},1353:function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=n(398).a.concat},1354:function(t,e,n){"use strict";n.d(e,"a",(function(){return r}));var r=n(398).a.execute},1355:function(t,e){},1357:function(t,e,n){"use strict";var r;n.d(e,"a",(function(){return r})),r||(r={})},1358:function(t,e){},1364:function(t,e,n){"use strict";n.r(e);var r=n(373);n.d(e,"ApolloProvider",(function(){return r.b})),n.d(e,"ApolloConsumer",(function(){return r.a})),n.d(e,"getApolloContext",(function(){return r.c})),n.d(e,"resetApolloContext",(function(){return r.d}));var i=n(1745);n.d(e,"useApolloClient",(function(){return i.a})),n.d(e,"useLazyQuery",(function(){return i.b})),n.d(e,"useMutation",(function(){return i.c})),n.d(e,"useQuery",(function(){return i.d})),n.d(e,"useSubscription",(function(){return i.f})),n.d(e,"useReactiveVar",(function(){return i.e}));var o=n(375);n.d(e,"DocumentType",(function(){return o.a})),n.d(e,"operationName",(function(){return o.b})),n.d(e,"parser",(function(){return o.c}));var a=n(1365);for(var s in a)["default","ApolloProvider","ApolloConsumer","getApolloContext","resetApolloContext","DocumentType","operationName","parser","useApolloClient","useLazyQuery","useMutation","useQuery","useSubscription","useReactiveVar"].indexOf(s)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(s)},1365:function(t,e){},155:function(t,e,n){"use strict";n.d(e,"c",(function(){return i})),n.d(e,"a",(function(){return o})),n.d(e,"b",(function(){return a})),n.d(e,"f",(function(){return s})),n.d(e,"g",(function(){return u})),n.d(e,"d",(function(){return c})),n.d(e,"e",(function(){return l}));var r=n(33),i=Object.prototype.hasOwnProperty;var o=/^[_a-z][_0-9a-z]*/i;function a(t){var e=t.match(o);return e?e[0]:t}function s(t,e,n){return!(!e||"object"!=typeof e)&&(Array.isArray(e)?e.every((function(e){return s(t,e,n)})):t.selections.every((function(t){if(Object(r.y)(t)&&Object(r.K)(t,n)){var o=Object(r.J)(t);return i.call(e,o)&&(!t.selectionSet||s(t.selectionSet,e[o],n))}return!0})))}function u(t){return null!==t&&"object"==typeof t&&!Object(r.B)(t)&&!Array.isArray(t)}function c(t){var e=t&&t.__field;return e&&Object(r.y)(e)}function l(){return new r.b(h)}var h=function(t,e,n){var r=t[n],i=e[n];return c(r)?(r.__value=this.merge(r.__value,c(i)?i.__value:i),r):c(i)?(i.__value=this.merge(r,i.__value),i):this.merge(r,i)}},168:function(t,e,n){"use strict";var r;function i(t){return!!t&&t<7}n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return i})),function(t){t[t.loading=1]="loading",t[t.setVariables=2]="setVariables",t[t.fetchMore=3]="fetchMore",t[t.refetch=4]="refetch",t[t.poll=6]="poll",t[t.ready=7]="ready",t[t.error=8]="error"}(r||(r={}))},1687:function(t,e,n){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=n(4),i=n(1267),o=function(){function t(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}return t.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},t.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},t.prototype.setServiceProps=function(t){return this.serviceProps=t,this},t}(),a=function(){function t(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}return t.prototype.get=function(t){void 0===t&&(t="[DEFAULT]");var e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){var n=new i.Deferred;this.instancesDeferred.set(e,n);try{var r=this.getOrInitializeService(e);r&&n.resolve(r)}catch(t){}}return this.instancesDeferred.get(e).promise},t.prototype.getImmediate=function(t){var e=r.__assign({identifier:"[DEFAULT]",optional:!1},t),n=e.identifier,i=e.optional,o=this.normalizeInstanceIdentifier(n);try{var a=this.getOrInitializeService(o);if(!a){if(i)return null;throw Error("Service "+this.name+" is not available")}return a}catch(t){if(i)return null;throw t}},t.prototype.getComponent=function(){return this.component},t.prototype.setComponent=function(t){var e,n;if(t.name!==this.name)throw Error("Mismatching Component "+t.name+" for Provider "+this.name+".");if(this.component)throw Error("Component for "+this.name+" has already been provided");if(this.component=t,function(t){return"EAGER"===t.instantiationMode}
/**
* @license
* Copyright 2019 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/(t))try{this.getOrInitializeService("[DEFAULT]")}catch(t){}try{for(var i=r.__values(this.instancesDeferred.entries()),o=i.next();!o.done;o=i.next()){var a=r.__read(o.value,2),s=a[0],u=a[1],c=this.normalizeInstanceIdentifier(s);try{var l=this.getOrInitializeService(c);u.resolve(l)}catch(t){}}}catch(t){e={error:t}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}},t.prototype.clearInstance=function(t){void 0===t&&(t="[DEFAULT]"),this.instancesDeferred.delete(t),this.instances.delete(t)},t.prototype.delete=function(){return r.__awaiter(this,void 0,void 0,(function(){var t;return r.__generator(this,(function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Promise.all(r.__spread(t.filter((function(t){return"INTERNAL"in t})).map((function(t){return t.INTERNAL.delete()})),t.filter((function(t){return"_delete"in t})).map((function(t){return t._delete()}))))];case 1:return e.sent(),[2]}}))}))},t.prototype.isComponentSet=function(){return null!=this.component},t.prototype.getOrInitializeService=function(t){var e=this.instances.get(t);return!e&&this.component&&(e=this.component.instanceFactory(this.container,function(t){return"[DEFAULT]"===t?void 0:t}(t)),this.instances.set(t,e)),e||null},t.prototype.normalizeInstanceIdentifier=function(t){return this.component?this.component.multipleInstances?t:"[DEFAULT]":t},t}();var s=function(){function t(t){this.name=t,this.providers=new Map}return t.prototype.addComponent=function(t){var e=this.getProvider(t.name);if(e.isComponentSet())throw new Error("Component "+t.name+" has already been registered with "+this.name);e.setComponent(t)},t.prototype.addOrOverwriteComponent=function(t){this.getProvider(t.name).isComponentSet()&&this.providers.delete(t.name),this.addComponent(t)},t.prototype.getProvider=function(t){if(this.providers.has(t))return this.providers.get(t);var e=new a(t,this);return this.providers.set(t,e),e},t.prototype.getProviders=function(){return Array.from(this.providers.values())},t}();e.Component=o,e.ComponentContainer=s,e.Provider=a},1688:function(t,e,n){"use strict";
/*! *****************************************************************************
Copyright (c) Microsoft Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
this file except in compliance with the License. You may obtain a copy of the
License at http://www.apache.org/licenses/LICENSE-2.0
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
MERCHANTABLITY OR NON-INFRINGEMENT.
See the Apache Version 2.0 License for specific language governing permissions
and limitations under the License.
***************************************************************************** */
function r(){for(var t=0,e=0,n=arguments.length;e=(null!=r?r:e.logLevel)&&t({level:o[n].toLowerCase(),message:s,args:i,type:e.name})}},r=0,i=a;r0&&(this.previousOptions.subscription!==this.getOptions().subscription||!Object(c.a)(this.previousOptions.variables,this.getOptions().variables)||this.previousOptions.skip!==this.getOptions().skip)&&(this.cleanup(),e=this.getLoadingResult()),this.initialize(this.getOptions()),this.startSubscription(),this.previousOptions=this.getOptions(),Object(u.__assign)(Object(u.__assign)({},e),{variables:this.getOptions().variables})},e.prototype.afterExecute=function(){this.isMounted=!0},e.prototype.cleanup=function(){this.endSubscription(),delete this.currentObservable.query},e.prototype.initialize=function(t){this.currentObservable.query||!0===this.getOptions().skip||(this.currentObservable.query=this.refreshClient().client.subscribe({query:t.subscription,variables:t.variables,fetchPolicy:t.fetchPolicy}))},e.prototype.startSubscription=function(){this.currentObservable.subscription||(this.currentObservable.subscription=this.currentObservable.query.subscribe({next:this.updateCurrentData.bind(this),error:this.updateError.bind(this),complete:this.completeSubscription.bind(this)}))},e.prototype.getLoadingResult=function(){return{loading:!0,error:void 0,data:void 0}},e.prototype.updateResult=function(t){this.isMounted&&this.setResult(t)},e.prototype.updateCurrentData=function(t){var e=this.getOptions().onSubscriptionData;this.updateResult({data:t.data,loading:!1,error:void 0}),e&&e({client:this.refreshClient().client,subscriptionData:t})},e.prototype.updateError=function(t){this.updateResult({error:t,loading:!1})},e.prototype.completeSubscription=function(){var t=this.getOptions().onSubscriptionComplete;t&&t(),this.endSubscription()},e.prototype.endSubscription=function(){this.currentObservable.subscription&&(this.currentObservable.subscription.unsubscribe(),delete this.currentObservable.subscription)},e}(h),p=n(328),d=n(33),v=function(t){function e(e){var n=e.options,r=e.context,i=e.result,o=e.setResult,a=t.call(this,n,r)||this;return a.runMutation=function(t){void 0===t&&(t={}),a.onMutationStart();var e=a.generateNewMutationId();return a.mutate(t).then((function(t){return a.onMutationCompleted(t,e),t})).catch((function(t){if(a.onMutationError(t,e),!a.getOptions().onError)throw t}))},a.verifyDocumentType(n.mutation,l.a.Mutation),a.result=i,a.setResult=o,a.mostRecentMutationId=0,a}return Object(u.__extends)(e,t),e.prototype.execute=function(t){return this.isMounted=!0,this.verifyDocumentType(this.getOptions().mutation,l.a.Mutation),[this.runMutation,Object(u.__assign)(Object(u.__assign)({},t),{client:this.refreshClient().client})]},e.prototype.afterExecute=function(){return this.isMounted=!0,this.unmount.bind(this)},e.prototype.cleanup=function(){},e.prototype.mutate=function(t){return this.refreshClient().client.mutate(Object(d.j)(this.getOptions(),t))},e.prototype.onMutationStart=function(){this.result.loading||this.getOptions().ignoreResults||this.updateResult({loading:!0,error:void 0,data:void 0,called:!0})},e.prototype.onMutationCompleted=function(t,e){var n=this.getOptions(),r=n.onCompleted,i=n.ignoreResults,o=t.data,a=t.errors,s=a&&a.length>0?new p.a({graphQLErrors:a}):void 0;this.isMostRecentMutation(e)&&!i&&this.updateResult({called:!0,loading:!1,data:o,error:s}),r&&r(o)},e.prototype.onMutationError=function(t,e){var n=this.getOptions().onError;this.isMostRecentMutation(e)&&this.updateResult({loading:!1,error:t,data:void 0,called:!0}),n&&n(t)},e.prototype.generateNewMutationId=function(){return++this.mostRecentMutationId},e.prototype.isMostRecentMutation=function(t){return this.mostRecentMutationId===t},e.prototype.updateResult=function(t){!this.isMounted||this.previousResult&&Object(c.a)(this.previousResult,t)||(this.setResult(t),this.previousResult=t)},e}(h),y=n(600),g=function(t){function e(e){var n=e.options,r=e.context,i=e.onNewData,o=t.call(this,n,r)||this;return o.previousData={},o.runLazy=!1,o.runLazyQuery=function(t){o.cleanup(),o.runLazy=!0,o.lazyOptions=t,o.onNewData()},o.getQueryResult=function(){var t=o.observableQueryFields(),e=o.getOptions();if(e.skip)t=Object(u.__assign)(Object(u.__assign)({},t),{data:void 0,error:void 0,loading:!1,called:!0});else if(o.currentObservable){var n=o.currentObservable.getCurrentResult(),r=n.data,i=n.loading,a=n.partial,s=n.networkStatus,c=n.errors,l=n.error;if(c&&c.length>0&&(l=new p.a({graphQLErrors:c})),t=Object(u.__assign)(Object(u.__assign)({},t),{data:r,loading:i,networkStatus:s,error:l,called:!0}),i);else if(l)Object.assign(t,{data:(o.currentObservable.getLastResult()||{}).data});else{var h=o.currentObservable.options.fetchPolicy;if(e.partialRefetch&&a&&(!r||0===Object.keys(r).length)&&"cache-only"!==h)return Object.assign(t,{loading:!0,networkStatus:y.NetworkStatus.loading}),t.refetch(),t}}return t.client=o.client,o.setOptions(e,!0),o.previousData.loading=o.previousData.result&&o.previousData.result.loading||!1,o.previousData.result=t,o.currentObservable&&o.currentObservable.resetQueryStoreErrors(),t},o.obsRefetch=function(t){return o.currentObservable.refetch(t)},o.obsFetchMore=function(t){return o.currentObservable.fetchMore(t)},o.obsUpdateQuery=function(t){return o.currentObservable.updateQuery(t)},o.obsStartPolling=function(t){var e;null===(e=o.currentObservable)||void 0===e||e.startPolling(t)},o.obsStopPolling=function(){var t;null===(t=o.currentObservable)||void 0===t||t.stopPolling()},o.obsSubscribeToMore=function(t){return o.currentObservable.subscribeToMore(t)},o.onNewData=i,o}return Object(u.__extends)(e,t),e.prototype.execute=function(){this.refreshClient();var t=this.getOptions(),e=t.skip,n=t.query;return(e||n!==this.previousData.query)&&(this.removeQuerySubscription(),this.previousData.query=n),this.updateObservableQuery(),this.isMounted&&this.startQuerySubscription(),this.getExecuteSsrResult()||this.getExecuteResult()},e.prototype.executeLazy=function(){return this.runLazy?[this.runLazyQuery,this.execute()]:[this.runLazyQuery,{loading:!1,networkStatus:y.NetworkStatus.ready,called:!1,data:void 0}]},e.prototype.fetchData=function(){var t=this,e=this.getOptions();return!e.skip&&!1!==e.ssr&&new Promise((function(e){return t.startQuerySubscription(e)}))},e.prototype.afterExecute=function(t){var e=(void 0===t?{}:t).lazy,n=void 0!==e&&e;return this.isMounted=!0,n&&!this.runLazy||this.handleErrorOrCompleted(),this.previousOptions=this.getOptions(),this.unmount.bind(this)},e.prototype.cleanup=function(){this.removeQuerySubscription(),delete this.currentObservable,delete this.previousData.result},e.prototype.getOptions=function(){var e=t.prototype.getOptions.call(this);return this.lazyOptions&&(e.variables=Object(u.__assign)(Object(u.__assign)({},e.variables),this.lazyOptions.variables),e.context=Object(u.__assign)(Object(u.__assign)({},e.context),this.lazyOptions.context)),this.runLazy&&delete e.skip,e},e.prototype.ssrInitiated=function(){return this.context&&this.context.renderPromises},e.prototype.getExecuteResult=function(){var t=this.getQueryResult();return this.startQuerySubscription(),t},e.prototype.getExecuteSsrResult=function(){var t,e=!1===this.getOptions().ssr,n=this.refreshClient().client.disableNetworkFetches,r=Object(u.__assign)({loading:!0,networkStatus:y.NetworkStatus.loading,called:!0,data:void 0,stale:!1,client:this.client},this.observableQueryFields());return e&&(this.ssrInitiated()||n)?(this.previousData.result=r,r):(this.ssrInitiated()&&(t=this.context.renderPromises.addQueryPromise(this,this.getQueryResult)||r),t)},e.prototype.prepareObservableQueryOptions=function(){var t=this.getOptions();this.verifyDocumentType(t.query,l.a.Query);var e=t.displayName||"Query";return!this.ssrInitiated()||"network-only"!==t.fetchPolicy&&"cache-and-network"!==t.fetchPolicy||(t.fetchPolicy="cache-first"),Object(u.__assign)(Object(u.__assign)({},t),{displayName:e,context:t.context})},e.prototype.initializeObservableQuery=function(){if(this.ssrInitiated()&&(this.currentObservable=this.context.renderPromises.getSSRObservable(this.getOptions())),!this.currentObservable){var t=this.prepareObservableQueryOptions();this.previousData.observableQueryOptions=Object(u.__assign)(Object(u.__assign)({},t),{children:null}),this.currentObservable=this.refreshClient().client.watchQuery(Object(u.__assign)({},t)),this.ssrInitiated()&&this.context.renderPromises.registerSSRObservable(this.currentObservable,t)}},e.prototype.updateObservableQuery=function(){if(this.currentObservable){if(!this.getOptions().skip){var t=Object(u.__assign)(Object(u.__assign)({},this.prepareObservableQueryOptions()),{children:null});Object(c.a)(t,this.previousData.observableQueryOptions)||(this.previousData.observableQueryOptions=t,this.currentObservable.setOptions(t).catch((function(){})))}}else this.initializeObservableQuery()},e.prototype.startQuerySubscription=function(t){var e=this;void 0===t&&(t=this.onNewData),this.currentSubscription||this.getOptions().skip||(this.currentSubscription=this.currentObservable.subscribe({next:function(n){var r=n.loading,i=n.networkStatus,o=n.data,a=e.previousData.result;a&&a.loading===r&&a.networkStatus===i&&Object(c.a)(a.data,o)||t()},error:function(n){if(e.resubscribeToQuery(),!n.hasOwnProperty("graphQLErrors"))throw n;var r=e.previousData.result;(r&&r.loading||!Object(c.a)(n,e.previousData.error))&&(e.previousData.error=n,t())}}))},e.prototype.resubscribeToQuery=function(){this.removeQuerySubscription();var t=this.currentObservable;if(t){var e=t.getLastError(),n=t.getLastResult();t.resetLastResults(),this.startQuerySubscription(),Object.assign(t,{lastError:e,lastResult:n})}},e.prototype.handleErrorOrCompleted=function(){if(this.currentObservable&&this.previousData.result){var t=this.previousData.result,e=t.data,n=t.loading,r=t.error;if(!n){var i=this.getOptions(),o=i.query,a=i.variables,s=i.onCompleted,u=i.onError,l=i.skip;if(this.previousOptions&&!this.previousData.loading&&Object(c.a)(this.previousOptions.query,o)&&Object(c.a)(this.previousOptions.variables,a))return;!s||r||l?u&&r&&u(r):s(e)}}},e.prototype.removeQuerySubscription=function(){this.currentSubscription&&(this.currentSubscription.unsubscribe(),delete this.currentSubscription)},e.prototype.observableQueryFields=function(){var t;return{variables:null===(t=this.currentObservable)||void 0===t?void 0:t.variables,refetch:this.obsRefetch,fetchMore:this.obsFetchMore,updateQuery:this.obsUpdateQuery,startPolling:this.obsStartPolling,stopPolling:this.obsStopPolling,subscribeToMore:this.obsSubscribeToMore}},e}(h);function m(t,e,n){void 0===n&&(n=!1);var i=Object(r.useContext)(Object(a.c)()),o=Object(r.useReducer)((function(t){return t+1}),0),s=o[0],l=o[1],h=e?Object(u.__assign)(Object(u.__assign)({},e),{query:t}):{query:t},f=Object(r.useRef)(),p=f.current||new g({options:h,context:i,onNewData:function(){p.ssrInitiated()?l():Promise.resolve().then(l)}});p.setOptions(h),p.context=i,p.ssrInitiated()&&!f.current&&(f.current=p);var d,v,y,m={options:Object(u.__assign)(Object(u.__assign)({},h),{onError:void 0,onCompleted:void 0}),context:i,tick:s},b=(d=function(){return n?p.executeLazy():p.execute()},v=m,(y=Object(r.useRef)()).current&&Object(c.a)(v,y.current.key)||(y.current={key:v,value:d()}),y.current.value),_=n?b[1]:b;return Object(r.useEffect)((function(){return f.current||(f.current=p),function(){return p.cleanup()}}),[]),Object(r.useEffect)((function(){return p.afterExecute({lazy:n})}),[_.loading,_.networkStatus,_.error,_.data]),b}function b(t,e){return m(t,e,!0)}function _(t,e){var n=Object(r.useContext)(Object(a.c)()),i=Object(r.useState)({called:!1,loading:!1}),o=i[0],s=i[1],c=e?Object(u.__assign)(Object(u.__assign)({},e),{mutation:t}):{mutation:t},l=Object(r.useRef)();var h=(l.current||(l.current=new v({options:c,context:n,result:o,setResult:s})),l.current);return h.setOptions(c),h.context=n,Object(r.useEffect)((function(){return h.afterExecute()})),h.execute(o)}function w(t,e){return m(t,e,!1)}function E(t,e){var n=Object(r.useContext)(Object(a.c)()),i=e?Object(u.__assign)(Object(u.__assign)({},e),{subscription:t}):{subscription:t},o=Object(r.useState)({loading:!i.skip,error:void 0,data:void 0}),s=o[0],c=o[1],l=Object(r.useRef)();var h=(l.current||(l.current=new f({options:i,context:n,setResult:c})),l.current);return h.setOptions(i,!0),h.context=n,Object(r.useEffect)((function(){return h.afterExecute()})),Object(r.useEffect)((function(){return h.cleanup.bind(h)}),[]),h.execute(s)}function C(t){var e=t(),n=t.onNextChange(Object(r.useState)(e)[1]);return Object(r.useEffect)((function(){return n}),[]),e}},1748:function(t,e,n){"use strict";n.d(e,"a",(function(){return C}));var r=n(4),i=n(59),o=n(401),a=n(33),s=n(824),u=n(159),c=n(328),l=function(){function t(){this.store={}}return t.prototype.getStore=function(){return this.store},t.prototype.get=function(t){return this.store[t]},t.prototype.initMutation=function(t,e,n){this.store[t]={mutation:e,variables:n||{},loading:!0,error:null}},t.prototype.markMutationError=function(t,e){var n=this.store[t];n&&(n.loading=!1,n.error=e)},t.prototype.markMutationResult=function(t){var e=this.store[t];e&&(e.loading=!1,e.error=null)},t.prototype.reset=function(){this.store={}},t}(),h=n(1044),f=n(168),p=n(383),d=n(481),v=function(){function t(t){var e=t.cache,n=t.client,r=t.resolvers,i=t.fragmentMatcher;this.cache=e,n&&(this.client=n),r&&this.addResolvers(r),i&&this.setFragmentMatcher(i)}return t.prototype.addResolvers=function(t){var e=this;this.resolvers=this.resolvers||{},Array.isArray(t)?t.forEach((function(t){e.resolvers=Object(a.F)(e.resolvers,t)})):this.resolvers=Object(a.F)(this.resolvers,t)},t.prototype.setResolvers=function(t){this.resolvers={},this.addResolvers(t)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(t){var e=t.document,n=t.remoteResult,i=t.context,o=t.variables,a=t.onlyRunForcedResolvers,s=void 0!==a&&a;return Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(t){return e?[2,this.resolveDocument(e,n.data,i,o,this.fragmentMatcher,s).then((function(t){return Object(r.__assign)(Object(r.__assign)({},n),{data:t.result})}))]:[2,n]}))}))},t.prototype.setFragmentMatcher=function(t){this.fragmentMatcher=t},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(t){return Object(a.x)(["client"],t)&&this.resolvers?t:null},t.prototype.serverQuery=function(t){return Object(a.H)(t)},t.prototype.prepareContext=function(t){var e=this.cache;return Object(r.__assign)(Object(r.__assign)({},t),{cache:e,getCacheKey:function(t){return e.identify(t)}})},t.prototype.addExportedVariables=function(t,e,n){return void 0===e&&(e={}),void 0===n&&(n={}),Object(r.__awaiter)(this,void 0,void 0,(function(){return Object(r.__generator)(this,(function(i){return t?[2,this.resolveDocument(t,this.buildRootValueFromCache(t,e)||{},this.prepareContext(n),e).then((function(t){return Object(r.__assign)(Object(r.__assign)({},e),t.exportedVariables)}))]:[2,Object(r.__assign)({},e)]}))}))},t.prototype.shouldForceResolvers=function(t){var e=!1;return Object(p.visit)(t,{Directive:{enter:function(t){if("client"===t.name.value&&t.arguments&&(e=t.arguments.some((function(t){return"always"===t.name.value&&"BooleanValue"===t.value.kind&&!0===t.value.value}))))return p.BREAK}}}),e},t.prototype.buildRootValueFromCache=function(t,e){return this.cache.diff({query:Object(a.g)(t),variables:e,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(t,e,n,i,o,s){return void 0===n&&(n={}),void 0===i&&(i={}),void 0===o&&(o=function(){return!0}),void 0===s&&(s=!1),Object(r.__awaiter)(this,void 0,void 0,(function(){var u,c,l,h,f,p,d,v,y;return Object(r.__generator)(this,(function(g){return u=Object(a.p)(t),c=Object(a.m)(t),l=Object(a.k)(c),h=u.operation,f=h?h.charAt(0).toUpperCase()+h.slice(1):"Query",d=(p=this).cache,v=p.client,y={fragmentMap:l,context:Object(r.__assign)(Object(r.__assign)({},n),{cache:d,client:v}),variables:i,fragmentMatcher:o,defaultOperationType:f,exportedVariables:{},onlyRunForcedResolvers:s},[2,this.resolveSelectionSet(u.selectionSet,e,y).then((function(t){return{result:t,exportedVariables:y.exportedVariables}}))]}))}))},t.prototype.resolveSelectionSet=function(t,e,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var o,s,u,c,l,h=this;return Object(r.__generator)(this,(function(f){return o=n.fragmentMap,s=n.context,u=n.variables,c=[e],l=function(t){return Object(r.__awaiter)(h,void 0,void 0,(function(){var l,h;return Object(r.__generator)(this,(function(r){return Object(a.K)(t,u)?Object(a.y)(t)?[2,this.resolveField(t,e,n).then((function(e){var n;void 0!==e&&c.push(((n={})[Object(a.J)(t)]=e,n))}))]:(Object(a.z)(t)?l=t:(l=o[t.name.value],Object(i.b)(l,11)),l&&l.typeCondition&&(h=l.typeCondition.name.value,n.fragmentMatcher(e,h,s))?[2,this.resolveSelectionSet(l.selectionSet,e,n).then((function(t){c.push(t)}))]:[2]):[2]}))}))},[2,Promise.all(t.selections.map(l)).then((function(){return Object(a.G)(c)}))]}))}))},t.prototype.resolveField=function(t,e,n){return Object(r.__awaiter)(this,void 0,void 0,(function(){var i,o,s,u,c,l,h,f,p,v=this;return Object(r.__generator)(this,(function(r){return i=n.variables,o=t.name.value,s=Object(a.J)(t),u=o!==s,c=e[s]||e[o],l=Promise.resolve(c),n.onlyRunForcedResolvers&&!this.shouldForceResolvers(t)||(h=e.__typename||n.defaultOperationType,(f=this.resolvers&&this.resolvers[h])&&(p=f[u?o:s])&&(l=Promise.resolve(d.cacheSlot.withValue(this.cache,p,[e,Object(a.e)(t,i),n.context,{field:t,fragmentMap:n.fragmentMap}])))),[2,l.then((function(e){return void 0===e&&(e=c),t.directives&&t.directives.forEach((function(t){"export"===t.name.value&&t.arguments&&t.arguments.forEach((function(t){"as"===t.name.value&&"StringValue"===t.value.kind&&(n.exportedVariables[t.value.value]=e)}))})),t.selectionSet?null==e?e:Array.isArray(e)?v.resolveSubSelectedArray(t,e,n):t.selectionSet?v.resolveSelectionSet(t.selectionSet,e,n):void 0:e}))]}))}))},t.prototype.resolveSubSelectedArray=function(t,e,n){var r=this;return Promise.all(e.map((function(e){return null===e?null:Array.isArray(e)?r.resolveSubSelectedArray(t,e,n):t.selectionSet?r.resolveSelectionSet(t.selectionSet,e,n):void 0})))},t}(),y=new(a.h?WeakMap:Map);function g(t,e){var n=t[e];"function"==typeof n&&(t[e]=function(){return y.set(t,(y.get(t)+1)%1e15),n.apply(this,arguments)})}var m=function(){function t(t){this.cache=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.dirty=!1,this.diff=null,this.observableQuery=null,y.has(t)||(y.set(t,0),g(t,"evict"),g(t,"modify"))}return t.prototype.init=function(t){var e=t.networkStatus||f.a.loading;return this.variables&&this.networkStatus!==f.a.loading&&!Object(u.a)(this.variables,t.variables)&&(e=f.a.setVariables),Object(u.a)(t.variables,this.variables)||(this.diff=null),Object.assign(this,{document:t.document,variables:t.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:e}),t.observableQuery&&this.setObservableQuery(t.observableQuery),t.lastRequestId&&(this.lastRequestId=t.lastRequestId),this},t.prototype.getDiff=function(t){return void 0===t&&(t=this.variables),this.diff&&Object(u.a)(t,this.variables)?this.diff:(this.updateWatch(this.variables=t),this.diff=this.cache.diff({query:this.document,variables:t,returnPartialData:!0,optimistic:!0}))},t.prototype.setDiff=function(t){var e=this,n=this.diff;this.diff=t,this.dirty||(t&&t.result)===(n&&n.result)||(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout((function(){return e.notify()}),0)))},t.prototype.setObservableQuery=function(t){var e=this;t!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=t,t?(t.queryInfo=this,this.listeners.add(this.oqListener=function(){e.getDiff().fromOptimisticTransaction?t.observe():t.reobserve()})):delete this.oqListener)},t.prototype.notify=function(){var t=this;this.notifyTimeout&&(clearTimeout(this.notifyTimeout),this.notifyTimeout=void 0),this.shouldNotify()&&this.listeners.forEach((function(e){return e(t)})),this.dirty=!1},t.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Object(f.b)(this.networkStatus)&&this.observableQuery){var t=this.observableQuery.options.fetchPolicy;if("cache-only"!==t&&"cache-and-network"!==t)return!1}return!0},t.prototype.stop=function(){this.cancel(),delete this.cancel;var t=this.observableQuery;t&&t.stopPolling()},t.prototype.cancel=function(){},t.prototype.updateWatch=function(t){var e=this;void 0===t&&(t=this.variables);var n=this.observableQuery;n&&"no-cache"===n.options.fetchPolicy||this.lastWatch&&this.lastWatch.query===this.document&&Object(u.a)(t,this.lastWatch.variables)||(this.cancel(),this.cancel=this.cache.watch(this.lastWatch={query:this.document,variables:t,optimistic:!0,callback:function(t){return e.setDiff(t)}}))},t.prototype.shouldWrite=function(t,e){var n=this.lastWrite;return!(n&&n.dmCount===y.get(this.cache)&&Object(u.a)(e,n.variables)&&Object(u.a)(t.data,n.result.data))},t.prototype.markResult=function(t,e,n){var r=this;this.graphQLErrors=Object(a.A)(t.errors)?t.errors:[],"no-cache"===e.fetchPolicy?this.diff={result:t.data,complete:!0}:n&&(b(t,e.errorPolicy)?this.cache.performTransaction((function(n){if(r.shouldWrite(t,e.variables))n.writeQuery({query:r.document,data:t.data,variables:e.variables}),r.lastWrite={result:t,variables:e.variables,dmCount:y.get(r.cache)};else if(r.diff&&r.diff.complete)return void(t.data=r.diff.result);var i=n.diff({query:r.document,variables:e.variables,returnPartialData:!0,optimistic:!0});r.updateWatch(e.variables),r.diff=i,i.complete&&(t.data=i.result)})):this.lastWrite=void 0)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=f.a.ready},t.prototype.markError=function(t){return this.networkStatus=f.a.error,this.lastWrite=void 0,t.graphQLErrors&&(this.graphQLErrors=t.graphQLErrors),t.networkError&&(this.networkError=t.networkError),t},t}();function b(t,e){void 0===e&&(e="none");var n="ignore"===e||"all"===e,r=!Object(a.v)(t);return!r&&n&&t.data&&(r=!0),r}var _=Object.prototype.hasOwnProperty,w=function(){function t(t){var e=t.cache,n=t.link,r=t.queryDeduplication,i=void 0!==r&&r,o=t.onBroadcast,s=void 0===o?function(){}:o,u=t.ssrMode,c=void 0!==u&&u,h=t.clientAwareness,f=void 0===h?{}:h,p=t.localState,d=t.assumeImmutableResults;this.mutationStore=new l,this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(a.h?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=e,this.link=n,this.queryDeduplication=i,this.onBroadcast=s,this.clientAwareness=f,this.localState=p||new v({cache:e}),this.ssrMode=c,this.assumeImmutableResults=!!d}return t.prototype.stop=function(){var t=this;this.queries.forEach((function(e,n){t.stopQueryNoBroadcast(n)})),this.cancelPendingFetches(new i.a(12))},t.prototype.cancelPendingFetches=function(t){this.fetchCancelFns.forEach((function(e){return e(t)})),this.fetchCancelFns.clear()},t.prototype.mutate=function(t){var e=t.mutation,n=t.variables,o=t.optimisticResponse,s=t.updateQueries,u=t.refetchQueries,l=void 0===u?[]:u,h=t.awaitRefetchQueries,f=void 0!==h&&h,p=t.update,d=t.errorPolicy,v=void 0===d?"none":d,y=t.fetchPolicy,g=t.context,m=void 0===g?{}:g;return Object(r.__awaiter)(this,void 0,void 0,(function(){var t,u,h,d,g=this;return Object(r.__generator)(this,(function(b){switch(b.label){case 0:return Object(i.b)(e,13),Object(i.b)(!y||"no-cache"===y,14),t=this.generateMutationId(),e=this.transform(e).document,n=this.getVariables(e,n),this.transform(e).hasClientExports?[4,this.localState.addExportedVariables(e,n,m)]:[3,2];case 1:n=b.sent(),b.label=2;case 2:return u=function(){var t={};return s&&g.queries.forEach((function(e,n){var r=e.observableQuery;if(r){var i=r.queryName;i&&_.call(s,i)&&(t[n]={updater:s[i],queryInfo:g.queries.get(n)})}})),t},this.mutationStore.initMutation(t,e,n),o&&(h="function"==typeof o?o(n):o,this.cache.recordOptimisticTransaction((function(r){try{E({mutationId:t,result:{data:h},document:e,variables:n,errorPolicy:v,queryUpdatersById:u(),update:p},r)}catch(t){}}),t)),this.broadcastQueries(),d=this,[2,new Promise((function(i,s){var h,g;d.getObservableFromLink(e,Object(r.__assign)(Object(r.__assign)({},m),{optimisticResponse:o}),n,!1).subscribe({next:function(r){if(Object(a.v)(r)&&"none"===v)g=new c.a({graphQLErrors:r.errors});else{if(d.mutationStore.markMutationResult(t),"no-cache"!==y)try{E({mutationId:t,result:r,document:e,variables:n,errorPolicy:v,queryUpdatersById:u(),update:p},d.cache)}catch(t){return void(g=new c.a({networkError:t}))}h=r}},error:function(e){d.mutationStore.markMutationError(t,e),o&&d.cache.removeOptimistic(t),d.broadcastQueries(),s(new c.a({networkError:e}))},complete:function(){if(g&&d.mutationStore.markMutationError(t,g),o&&d.cache.removeOptimistic(t),d.broadcastQueries(),g)s(g);else{"function"==typeof l&&(l=l(h));var e=[];Object(a.A)(l)&&l.forEach((function(t){if("string"==typeof t)d.queries.forEach((function(n){var r=n.observableQuery;r&&r.queryName===t&&e.push(r.refetch())}));else{var n={query:t.query,variables:t.variables,fetchPolicy:"network-only"};t.context&&(n.context=t.context),e.push(d.query(n))}})),Promise.all(f?e:[]).then((function(){"ignore"===v&&h&&Object(a.v)(h)&&delete h.errors,i(h)}),s)}}})}))]}}))}))},t.prototype.fetchQuery=function(t,e,n){return this.fetchQueryObservable(t,e,n).promise},t.prototype.getQueryStore=function(){var t=Object.create(null);return this.queries.forEach((function(e,n){t[n]={variables:e.variables,networkStatus:e.networkStatus,networkError:e.networkError,graphQLErrors:e.graphQLErrors}})),t},t.prototype.resetErrors=function(t){var e=this.queries.get(t);e&&(e.networkError=void 0,e.graphQLErrors=[])},t.prototype.transform=function(t){var e=this.transformCache;if(!e.has(t)){var n=this.cache.transformDocument(t),r=Object(a.I)(this.cache.transformForLink(n)),i=this.localState.clientQuery(n),o=r&&this.localState.serverQuery(r),s={document:n,hasClientExports:Object(a.w)(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:i,serverQuery:o,defaultVars:Object(a.l)(Object(a.q)(n))},u=function(t){t&&!e.has(t)&&e.set(t,s)};u(t),u(n),u(i),u(o)}return e.get(t)},t.prototype.getVariables=function(t,e){return Object(r.__assign)(Object(r.__assign)({},this.transform(t).defaultVars),e)},t.prototype.watchQuery=function(t){void 0===(t=Object(r.__assign)(Object(r.__assign)({},t),{variables:this.getVariables(t.query,t.variables)})).notifyOnNetworkStatusChange&&(t.notifyOnNetworkStatusChange=!1);var e=new m(this.cache),n=new h.a({queryManager:this,queryInfo:e,options:t});return this.queries.set(n.queryId,e),e.init({document:t.query,observableQuery:n,variables:t.variables}),n},t.prototype.query=function(t){var e=this;Object(i.b)(t.query,15),Object(i.b)("Document"===t.query.kind,16),Object(i.b)(!t.returnPartialData,17),Object(i.b)(!t.pollInterval,18);var n=this.generateQueryId();return this.fetchQuery(n,t).finally((function(){return e.stopQuery(n)}))},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(t){this.stopQueryInStoreNoBroadcast(t),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(t){var e=this.queries.get(t);e&&e.stop()},t.prototype.clearStore=function(){return this.cancelPendingFetches(new i.a(19)),this.queries.forEach((function(t){t.observableQuery?t.networkStatus=f.a.loading:t.stop()})),this.mutationStore.reset(),this.cache.reset()},t.prototype.resetStore=function(){var t=this;return this.clearStore().then((function(){return t.reFetchObservableQueries()}))},t.prototype.reFetchObservableQueries=function(t){var e=this;void 0===t&&(t=!1);var n=[];return this.queries.forEach((function(r,i){var o=r.observableQuery;if(o){var a=o.options.fetchPolicy;o.resetLastResults(),"cache-only"===a||!t&&"standby"===a||n.push(o.refetch()),e.getQuery(i).setDiff(null)}})),this.broadcastQueries(),Promise.all(n)},t.prototype.setObservableQuery=function(t){this.getQuery(t.queryId).setObservableQuery(t)},t.prototype.startGraphQLSubscription=function(t){var e=this,n=t.query,r=t.fetchPolicy,i=t.errorPolicy,o=t.variables,s=t.context,u=void 0===s?{}:s;n=this.transform(n).document,o=this.getVariables(n,o);var l=function(t){return e.getObservableFromLink(n,u,t,!1).map((function(o){if("no-cache"!==r&&(b(o,i)&&e.cache.write({query:n,result:o.data,dataId:"ROOT_SUBSCRIPTION",variables:t}),e.broadcastQueries()),Object(a.v)(o))throw new c.a({graphQLErrors:o.errors});return o}))};if(this.transform(n).hasClientExports){var h=this.localState.addExportedVariables(n,o,u).then(l);return new a.c((function(t){var e=null;return h.then((function(n){return e=n.subscribe(t)}),t.error),function(){return e&&e.unsubscribe()}}))}return l(o)},t.prototype.stopQuery=function(t){this.stopQueryNoBroadcast(t),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(t){this.stopQueryInStoreNoBroadcast(t),this.removeQuery(t)},t.prototype.removeQuery=function(t){this.fetchCancelFns.delete(t),this.getQuery(t).subscriptions.forEach((function(t){return t.unsubscribe()})),this.queries.delete(t)},t.prototype.broadcastQueries=function(){this.onBroadcast(),this.queries.forEach((function(t){return t.notify()}))},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(t,e,n,i){var s,u,c=this;void 0===i&&(i=null!==(s=null==e?void 0:e.queryDeduplication)&&void 0!==s?s:this.queryDeduplication);var l=this.transform(t).serverQuery;if(l){var h=this.inFlightLinkObservables,f=this.link,p={query:l,variables:n,operationName:Object(a.r)(l)||void 0,context:this.prepareContext(Object(r.__assign)(Object(r.__assign)({},e),{forceFetch:!i}))};if(e=p.context,i){var d=h.get(l)||new Map;h.set(l,d);var v=JSON.stringify(n);if(!(u=d.get(v))){var y=new a.a([Object(o.execute)(f,p)]);d.set(v,u=y),y.cleanup((function(){d.delete(v)&&d.size<1&&h.delete(l)}))}}else u=new a.a([Object(o.execute)(f,p)])}else u=new a.a([a.c.of({data:{}})]),e=this.prepareContext(e);var g=this.transform(t).clientQuery;return g&&(u=Object(a.f)(u,(function(t){return c.localState.runResolvers({document:g,remoteResult:t,context:e,variables:n})}))),u},t.prototype.getResultsFromLink=function(t,e,n){var r=t.lastRequestId;return Object(a.f)(this.getObservableFromLink(t.document,n.context,n.variables),(function(i){var o=Object(a.A)(i.errors);if(r>=t.lastRequestId){if(o&&"none"===n.errorPolicy)throw t.markError(new c.a({graphQLErrors:i.errors}));t.markResult(i,n,e),t.markReady()}var s={data:i.data,loading:!1,networkStatus:t.networkStatus||f.a.ready};return o&&"ignore"!==n.errorPolicy&&(s.errors=i.errors),s}),(function(e){var n=Object(c.b)(e)?e:new c.a({networkError:e});throw r>=t.lastRequestId&&t.markError(n),n}))},t.prototype.fetchQueryObservable=function(t,e,n){var r=this;void 0===n&&(n=f.a.loading);var i=this.transform(e.query).document,o=this.getVariables(i,e.variables),s=this.getQuery(t),u=s.networkStatus,c=e.fetchPolicy,l=void 0===c?"cache-first":c,h=e.errorPolicy,p=void 0===h?"none":h,d=e.returnPartialData,v=void 0!==d&&d,y=e.notifyOnNetworkStatusChange,g=void 0!==y&&y,m=e.context,b=void 0===m?{}:m;("cache-first"===l||"cache-and-network"===l||"network-only"===l||"no-cache"===l)&&g&&"number"==typeof u&&u!==n&&Object(f.b)(n)&&("cache-first"!==l&&(l="cache-and-network"),v=!0);var _=Object.assign({},e,{query:i,variables:o,fetchPolicy:l,errorPolicy:p,returnPartialData:v,notifyOnNetworkStatusChange:g,context:b}),w=function(t){return _.variables=t,r.fetchQueryByPolicy(s,_,n)};this.fetchCancelFns.set(t,(function(t){Promise.resolve().then((function(){return E.cancel(t)}))}));var E=new a.a(this.transform(_.query).hasClientExports?this.localState.addExportedVariables(_.query,_.variables,_.context).then(w):w(_.variables));return E.cleanup((function(){r.fetchCancelFns.delete(t);var n=e.nextFetchPolicy;n&&(e.nextFetchPolicy=void 0,e.fetchPolicy="function"==typeof n?n.call(e,e.fetchPolicy||"cache-first"):n)})),E},t.prototype.fetchQueryByPolicy=function(t,e,n){var i=this,o=e.query,s=e.variables,u=e.fetchPolicy,c=e.errorPolicy,l=e.returnPartialData,h=e.context;t.init({document:o,variables:s,lastRequestId:this.generateRequestId(),networkStatus:n});var p=function(){return t.getDiff(s)},d=function(e,n){void 0===n&&(n=t.networkStatus||f.a.loading);var u=e.result;var c=function(t){return a.c.of(Object(r.__assign)({data:t,loading:Object(f.b)(n),networkStatus:n},e.complete?null:{partial:!0}))};return i.transform(o).hasForcedResolvers?i.localState.runResolvers({document:o,remoteResult:{data:u},context:h,variables:s,onlyRunForcedResolvers:!0}).then((function(t){return c(t.data)})):c(u)},v=function(e){return i.getResultsFromLink(t,e,{variables:s,context:h,fetchPolicy:u,errorPolicy:c})};switch(u){default:case"cache-first":return(y=p()).complete?[d(y,t.markReady())]:l?[d(y),v(!0)]:[v(!0)];case"cache-and-network":var y;return(y=p()).complete||l?[d(y),v(!0)]:[v(!0)];case"cache-only":return[d(p(),t.markReady())];case"network-only":return[v(!0)];case"no-cache":return[v(!1)];case"standby":return[]}},t.prototype.getQuery=function(t){return t&&!this.queries.has(t)&&this.queries.set(t,new m(this.cache)),this.queries.get(t)},t.prototype.prepareContext=function(t){void 0===t&&(t={});var e=this.localState.prepareContext(t);return Object(r.__assign)(Object(r.__assign)({},e),{clientAwareness:this.clientAwareness})},t}();function E(t,e){if(b(t.result,t.errorPolicy)){var n=[{result:t.result.data,dataId:"ROOT_MUTATION",query:t.document,variables:t.variables}],r=t.queryUpdatersById;r&&Object.keys(r).forEach((function(i){var o=r[i],s=o.updater,u=o.queryInfo,c=u.document,l=u.variables,h=e.diff({query:c,variables:l,returnPartialData:!0,optimistic:!1}),f=h.result;if(h.complete&&f){var p=s(f,{mutationResult:t.result,queryName:Object(a.r)(c)||void 0,queryVariables:l});p&&n.push({result:p,dataId:"ROOT_QUERY",query:c,variables:l})}})),e.performTransaction((function(e){n.forEach((function(t){return e.write(t)}));var r=t.update;r&&r(e,t.result)}),null)}}var C=function(){function t(t){var e=this;this.defaultOptions={},this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=t.uri,r=t.credentials,a=t.headers,u=t.cache,c=t.ssrMode,l=void 0!==c&&c,h=t.ssrForceFetchDelay,f=void 0===h?0:h,p=t.connectToDevTools,d=t.queryDeduplication,y=void 0===d||d,g=t.defaultOptions,m=t.assumeImmutableResults,b=void 0!==m&&m,_=t.resolvers,E=t.typeDefs,C=t.fragmentMatcher,O=t.name,S=t.version,I=t.link;if(I||(I=n?new s.HttpLink({uri:n,credentials:r,headers:a}):o.ApolloLink.empty()),!u)throw new i.a(9);this.link=I,this.cache=u,this.disableNetworkFetches=l||f>0,this.queryDeduplication=y,this.defaultOptions=g||{},this.typeDefs=E,f&&setTimeout((function(){return e.disableNetworkFetches=!1}),f),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this);void 0!==p&&(p&&"undefined"!=typeof window)&&(window.__APOLLO_CLIENT__=this),this.version="local",this.localState=new v({cache:u,client:this,resolvers:_,fragmentMatcher:C}),this.queryManager=new w({cache:this.cache,link:this.link,queryDeduplication:y,ssrMode:l,clientAwareness:{name:O,version:S},localState:this.localState,assumeImmutableResults:b,onBroadcast:function(){e.devToolsHookCb&&e.devToolsHookCb({action:{},state:{queries:e.queryManager.getQueryStore(),mutations:e.queryManager.mutationStore.getStore()},dataWithOptimisticResults:e.cache.extract(!0)})}})}return t.prototype.stop=function(){this.queryManager.stop()},t.prototype.watchQuery=function(t){return this.defaultOptions.watchQuery&&(t=Object(a.j)(this.defaultOptions.watchQuery,t)),!this.disableNetworkFetches||"network-only"!==t.fetchPolicy&&"cache-and-network"!==t.fetchPolicy||(t=Object(r.__assign)(Object(r.__assign)({},t),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(t)},t.prototype.query=function(t){return this.defaultOptions.query&&(t=Object(a.j)(this.defaultOptions.query,t)),Object(i.b)("cache-and-network"!==t.fetchPolicy,10),this.disableNetworkFetches&&"network-only"===t.fetchPolicy&&(t=Object(r.__assign)(Object(r.__assign)({},t),{fetchPolicy:"cache-first"})),this.queryManager.query(t)},t.prototype.mutate=function(t){return this.defaultOptions.mutate&&(t=Object(a.j)(this.defaultOptions.mutate,t)),this.queryManager.mutate(t)},t.prototype.subscribe=function(t){return this.queryManager.startGraphQLSubscription(t)},t.prototype.readQuery=function(t,e){return void 0===e&&(e=!1),this.cache.readQuery(t,e)},t.prototype.readFragment=function(t,e){return void 0===e&&(e=!1),this.cache.readFragment(t,e)},t.prototype.writeQuery=function(t){this.cache.writeQuery(t),this.queryManager.broadcastQueries()},t.prototype.writeFragment=function(t){this.cache.writeFragment(t),this.queryManager.broadcastQueries()},t.prototype.__actionHookForDevTools=function(t){this.devToolsHookCb=t},t.prototype.__requestRaw=function(t){return Object(o.execute)(this.link,t)},t.prototype.resetStore=function(){var t=this;return Promise.resolve().then((function(){return t.queryManager.clearStore()})).then((function(){return Promise.all(t.resetStoreCallbacks.map((function(t){return t()})))})).then((function(){return t.reFetchObservableQueries()}))},t.prototype.clearStore=function(){var t=this;return Promise.resolve().then((function(){return t.queryManager.clearStore()})).then((function(){return Promise.all(t.clearStoreCallbacks.map((function(t){return t()})))}))},t.prototype.onResetStore=function(t){var e=this;return this.resetStoreCallbacks.push(t),function(){e.resetStoreCallbacks=e.resetStoreCallbacks.filter((function(e){return e!==t}))}},t.prototype.onClearStore=function(t){var e=this;return this.clearStoreCallbacks.push(t),function(){e.clearStoreCallbacks=e.clearStoreCallbacks.filter((function(e){return e!==t}))}},t.prototype.reFetchObservableQueries=function(t){return this.queryManager.reFetchObservableQueries(t)},t.prototype.extract=function(t){return this.cache.extract(t)},t.prototype.restore=function(t){return this.cache.restore(t)},t.prototype.addResolvers=function(t){this.localState.addResolvers(t)},t.prototype.setResolvers=function(t){this.localState.setResolvers(t)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(t){this.localState.setFragmentMatcher(t)},t.prototype.setLink=function(t){this.link=this.queryManager.link=t},t}()},1750:function(t,e,n){"use strict";n.d(e,"a",(function(){return k}));var r,i,o=n(4),a=(n(1835),n(307)),s=n(1021),u=n(33),c=n(59),l=n(159),h=n(155),f=Object.create(null),p=function(){return f},d=Object.create(null),v=function(){function t(t,e){var n=this;this.policies=t,this.group=e,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(t,e){return Object(u.E)(Object(u.B)(t)?n.get(t.__ref,e):t&&t[e])},this.canRead=function(t){return Object(u.B)(t)?n.has(t.__ref):"object"==typeof t},this.toReference=function(t,e){if("string"==typeof t)return Object(u.D)(t);if(Object(u.B)(t))return t;var r=n.policies.identify(t)[0];if(r){var i=Object(u.D)(r);return e&&n.merge(r,t),i}}}return t.prototype.toObject=function(){return Object(o.__assign)({},this.data)},t.prototype.has=function(t){return void 0!==this.lookup(t,!0)},t.prototype.get=function(t,e){if(this.group.depend(t,e),h.c.call(this.data,t)){var n=this.data[t];if(n&&h.c.call(n,e))return n[e]}return"__typename"===e&&h.c.call(this.policies.rootTypenamesById,t)?this.policies.rootTypenamesById[t]:this instanceof m?this.parent.get(t,e):void 0},t.prototype.lookup=function(t,e){return e&&this.group.depend(t,"__exists"),h.c.call(this.data,t)?this.data[t]:this instanceof m?this.parent.lookup(t,e):void 0},t.prototype.merge=function(t,e){var n=this,r=this.lookup(t),i=new u.b(b).merge(r,e);if(this.data[t]=i,i!==r&&(delete this.refs[t],this.group.caching)){var o=Object.create(null);r||(o.__exists=1),Object.keys(e).forEach((function(t){r&&r[t]===i[t]||(o[Object(h.b)(t)]=1,void 0!==i[t]||n instanceof m||delete i[t])})),Object.keys(o).forEach((function(e){return n.group.dirty(t,e)}))}},t.prototype.modify=function(t,e){var n=this,r=this.lookup(t);if(r){var i=Object.create(null),a=!1,s=!0,c={DELETE:f,INVALIDATE:d,isReference:u.B,toReference:this.toReference,canRead:this.canRead,readField:function(e,r){return n.policies.readField("string"==typeof e?{fieldName:e,from:r||Object(u.D)(t)}:e,{store:n})}};if(Object.keys(r).forEach((function(l){var v=Object(h.b)(l),y=r[l];if(void 0!==y){var g="function"==typeof e?e:e[l]||e[v];if(g){var m=g===p?f:g(Object(u.E)(y),Object(o.__assign)(Object(o.__assign)({},c),{fieldName:v,storeFieldName:l,storage:n.getStorage(t,l)}));m===d?n.group.dirty(t,l):(m===f&&(m=void 0),m!==y&&(i[l]=m,a=!0,y=m))}void 0!==y&&(s=!1)}})),a)return this.merge(t,i),s&&(this instanceof m?this.data[t]=void 0:delete this.data[t],this.group.dirty(t,"__exists")),!0}return!1},t.prototype.delete=function(t,e,n){var r,i=this.lookup(t);if(i){var o=this.getFieldValue(i,"__typename"),a=e&&n?this.policies.getStoreFieldName({typename:o,fieldName:e,args:n}):e;return this.modify(t,a?((r={})[a]=p,r):p)}return!1},t.prototype.evict=function(t){var e=!1;return t.id&&(h.c.call(this.data,t.id)&&(e=this.delete(t.id,t.fieldName,t.args)),this instanceof m&&(e=this.parent.evict(t)||e),(t.fieldName||e)&&this.group.dirty(t.id,t.fieldName||"__exists")),e},t.prototype.clear=function(){this.replace(null)},t.prototype.replace=function(t){var e=this;Object.keys(this.data).forEach((function(n){t&&h.c.call(t,n)||e.delete(n)})),t&&Object.keys(t).forEach((function(n){e.merge(n,t[n])}))},t.prototype.retain=function(t){return this.rootIds[t]=(this.rootIds[t]||0)+1},t.prototype.release=function(t){if(this.rootIds[t]>0){var e=--this.rootIds[t];return e||delete this.rootIds[t],e}return 0},t.prototype.getRootIdSet=function(t){return void 0===t&&(t=new Set),Object.keys(this.rootIds).forEach(t.add,t),this instanceof m&&this.parent.getRootIdSet(t),t},t.prototype.gc=function(){var t=this,e=this.getRootIdSet(),n=this.toObject();e.forEach((function(r){h.c.call(n,r)&&(Object.keys(t.findChildRefIds(r)).forEach(e.add,e),delete n[r])}));var r=Object.keys(n);if(r.length){for(var i=this;i instanceof m;)i=i.parent;r.forEach((function(t){return i.delete(t)}))}return r},t.prototype.findChildRefIds=function(t){if(!h.c.call(this.refs,t)){var e=this.refs[t]=Object.create(null),n=new Set([this.data[t]]),r=function(t){return null!==t&&"object"==typeof t};n.forEach((function(t){Object(u.B)(t)?e[t.__ref]=!0:r(t)&&Object.values(t).filter(r).forEach(n.add,n)}))}return this.refs[t]},t.prototype.makeCacheKey=function(){for(var t=[],e=0;e0;if(f&&!c)throw h.missing[0];return{result:h.result,missing:h.missing,complete:!f}},t.prototype.isFresh=function(t,e,n,r){if(_(r.store)&&this.knownResults.get(t)===n){var i=this.executeSelectionSet.peek(n,e,r);if(i&&t===i.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(t){var e=this,n=t.selectionSet,r=t.objectOrReference,i=t.context;if(Object(u.B)(r)&&!i.policies.rootTypenamesById[r.__ref]&&!i.store.has(r.__ref))return{result:{},missing:[E(new c.a(4),i)]};var o=i.variables,a=i.policies,s=i.store,l=[],h={result:null},f=s.getFieldValue(r,"__typename");function p(){return h.missing||(h.missing=[])}function d(t){var e;return t.missing&&(e=p()).push.apply(e,t.missing),t.result}this.config.addTypename&&"string"==typeof f&&!a.rootIdsByTypename[f]&&l.push({__typename:f});var v=new Set(n.selections);return v.forEach((function(t){var n;if(Object(u.K)(t,o))if(Object(u.y)(t)){var s=a.readField({fieldName:t.name.value,field:t,variables:i.variables,from:r},i),h=Object(u.J)(t);i.path.push(h);var y=i.clientOnly;i.clientOnly=y||!(!t.directives||!t.directives.some((function(t){return"client"===t.name.value}))),void 0===s?u.d.added(t)||p().push(E(new c.a(5),i)):Array.isArray(s)?s=d(e.executeSubSelectedArray({field:t,array:s,context:i})):t.selectionSet&&null!=s&&(s=d(e.executeSelectionSet({selectionSet:t.selectionSet,objectOrReference:s,context:i}))),void 0!==s&&l.push(((n={})[h]=s,n)),i.clientOnly=y,Object(c.b)(i.path.pop()===h)}else{var g=Object(u.n)(t,i.fragmentMap);g&&a.fragmentMatches(g,f)&&g.selectionSet.selections.forEach(v.add,v)}})),h.result=Object(u.G)(l),this.knownResults.set(h.result,n),h},t.prototype.execSubSelectedArrayImpl=function(t){var e,n=this,r=t.field,i=t.array,o=t.context;function a(t,n){return t.missing&&(e=e||[]).push.apply(e,t.missing),Object(c.b)(o.path.pop()===n),t.result}return r.selectionSet&&(i=i.filter(o.store.canRead)),{result:i=i.map((function(t,e){return null===t?null:(o.path.push(e),Array.isArray(t)?a(n.executeSubSelectedArray({field:r,array:t,context:o}),e):r.selectionSet?a(n.executeSelectionSet({selectionSet:r.selectionSet,objectOrReference:t,context:o}),e):(Object(c.b)(o.path.pop()===e),t))})),missing:e}},t}();var O=function(){function t(t,e){this.cache=t,this.reader=e}return t.prototype.writeToStore=function(t){var e=t.query,n=t.result,r=t.dataId,i=t.store,a=t.variables,s=Object(u.q)(e),l=Object(h.e)();a=Object(o.__assign)(Object(o.__assign)({},Object(u.l)(s)),a);var f=this.processSelectionSet({result:n||Object.create(null),dataId:r,selectionSet:s.selectionSet,context:{store:i,written:Object.create(null),merge:function(t,e){return l.merge(t,e)},variables:a,varString:JSON.stringify(a),fragmentMap:Object(u.k)(Object(u.m)(e))}});if(!Object(u.B)(f))throw new c.a(7);return i.retain(f.__ref),f},t.prototype.processSelectionSet=function(t){var e=this,n=t.dataId,r=t.result,i=t.selectionSet,o=t.context,a=t.out,s=void 0===a?{shouldApplyMerges:!1}:a,l=this.cache.policies,h=l.identify(r,i,o.fragmentMap),f=h[0],p=h[1];if("string"==typeof(n=n||f)){var d=o.written[n]||(o.written[n]=[]),v=Object(u.D)(n);if(d.indexOf(i)>=0)return v;if(d.push(i),this.reader&&this.reader.isFresh(r,v,i,o))return v}var y=Object.create(null);p&&(y=o.merge(y,p));var g=n&&l.rootTypenamesById[n]||Object(u.u)(r,i,o.fragmentMap)||n&&o.store.get(n,"__typename");"string"==typeof g&&(y.__typename=g);var m=new Set(i.selections);if(m.forEach((function(t){var n;if(Object(u.K)(t,o.variables))if(Object(u.y)(t)){var i=Object(u.J)(t),a=r[i];if(void 0!==a){var h=l.getStoreFieldName({typename:g,fieldName:t.name.value,field:t,variables:o.variables}),f=e.processFieldValue(a,t,o,s);l.hasMergeFunction(g,t.name.value)&&(f={__field:t,__typename:g,__value:f},s.shouldApplyMerges=!0),y=o.merge(y,((n={})[h]=f,n))}else if(l.usingPossibleTypes&&!Object(u.x)(["defer","client"],t))throw new c.a(8)}else{var p=Object(u.n)(t,o.fragmentMap);p&&l.fragmentMatches(p,g,r,o.variables)&&p.selectionSet.selections.forEach(m.add,m)}})),"string"==typeof n){var b=Object(u.D)(n);return s.shouldApplyMerges&&(y=l.applyMerges(b,y,o)),o.store.merge(n,y),b}return y},t.prototype.processFieldValue=function(t,e,n,r){var i=this;return e.selectionSet&&null!==t?Array.isArray(t)?t.map((function(t){return i.processFieldValue(t,e,n,r)})):this.processSelectionSet({result:t,selectionSet:e.selectionSet,context:n,out:r}):t},t}();new Set;var S=n(596),I=n(826),T={dataIdFromObject:I.b,addTypename:!0,resultCaching:!0,typePolicies:{}},k=function(t){function e(e){void 0===e&&(e={});var n=t.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=S.b,n.txCount=0,n.maybeBroadcastWatch=Object(a.c)((function(t,e){return n.broadcastWatch.call(n,t,!!e)}),{makeCacheKey:function(t){var e=t.optimistic?n.optimisticData:n.data;if(_(e)){var r=t.optimistic,i=t.rootId,o=t.variables;return e.makeCacheKey(t.query,t.callback,JSON.stringify({optimistic:r,rootId:i,variables:o}))}}}),n.watchDep=Object(a.b)(),n.config=Object(o.__assign)(Object(o.__assign)({},T),e),n.addTypename=!!n.config.addTypename,n.policies=new I.a({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.data=new v.Root({policies:n.policies,resultCaching:n.config.resultCaching}),n.optimisticData=n.data,n.storeWriter=new O(n,n.storeReader=new C({cache:n,addTypename:n.addTypename})),n}return Object(o.__extends)(e,t),e.prototype.restore=function(t){return t&&this.data.replace(t),this},e.prototype.extract=function(t){return void 0===t&&(t=!1),(t?this.optimisticData:this.data).toObject()},e.prototype.read=function(t){var e=t.optimistic?this.optimisticData:this.data;return("string"!=typeof t.rootId||e.has(t.rootId))&&this.storeReader.diffQueryAgainstStore({store:e,query:t.query,variables:t.variables,rootId:t.rootId,config:this.config,returnPartialData:!1}).result||null},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore({store:this.data,query:t.query,result:t.result,dataId:t.dataId,variables:t.variables})}finally{--this.txCount||!1===t.broadcast||this.broadcastWatches()}},e.prototype.modify=function(t){if(h.c.call(t,"id")&&!t.id)return!1;var e=t.optimistic?this.optimisticData:this.data;try{return++this.txCount,e.modify(t.id||"ROOT_QUERY",t.fields)}finally{--this.txCount||!1===t.broadcast||this.broadcastWatches()}},e.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore({store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",query:t.query,variables:t.variables,returnPartialData:t.returnPartialData,config:this.config})},e.prototype.watch=function(t){var e=this;return this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){e.watches.delete(t)}},e.prototype.gc=function(){return this.optimisticData.gc()},e.prototype.retain=function(t,e){return(e?this.optimisticData:this.data).retain(t)},e.prototype.release=function(t,e){return(e?this.optimisticData:this.data).release(t)},e.prototype.identify=function(t){return Object(u.B)(t)?t.__ref:this.policies.identify(t)[0]},e.prototype.evict=function(t){if(!t.id){if(h.c.call(t,"id"))return!1;t=Object(o.__assign)(Object(o.__assign)({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t)}finally{--this.txCount||!1===t.broadcast||this.broadcastWatches()}},e.prototype.reset=function(){return this.data.clear(),this.optimisticData=this.data,this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var e=this.optimisticData.removeLayer(t);e!==this.optimisticData&&(this.optimisticData=e,this.broadcastWatches())},e.prototype.performTransaction=function(t,e){var n=this,r=function(e){var r=n,i=r.data,o=r.optimisticData;++n.txCount,e&&(n.data=n.optimisticData=e);try{t(n)}finally{--n.txCount,n.data=i,n.optimisticData=o}},i=!1;"string"==typeof e?(this.optimisticData=this.optimisticData.addLayer(e,r),i=!0):null===e?r(this.data):r(),this.broadcastWatches(i)},e.prototype.transformDocument=function(t){if(this.addTypename){var e=this.typenameDocumentCache.get(t);return e||(e=Object(u.d)(t),this.typenameDocumentCache.set(t,e),this.typenameDocumentCache.set(e,e)),e}return t},e.prototype.broadcastWatches=function(t){var e=this;this.txCount||this.watches.forEach((function(n){return e.maybeBroadcastWatch(n,t)}))},e.prototype.broadcastWatch=function(t,e){this.watchDep.dirty(t),this.watchDep(t);var n=this.diff({query:t.query,variables:t.variables,optimistic:t.optimistic});t.optimistic&&e&&(n.fromOptimisticTransaction=!0),t.callback(n)},e}(s.a)},1757:function(t,e,n){"use strict";function r(t){var e,n=t.Symbol;if("function"==typeof n)if(n.observable)e=n.observable;else{e=n.for("https://github.com/benlesh/symbol-observable");try{n.observable=e}catch(t){}}else e="@@observable";return e}n.d(e,"a",(function(){return r}))},1833:function(t,e,n){"use strict";(function(t,e){var r,i=n(1757);r="undefined"!=typeof self?self:"undefined"!=typeof window?window:void 0!==t?t:e;Object(i.a)(r)}).call(this,n(143),n(387)(t))},1834:function(t,e,n){"use strict";(function(t){}).call(this,n(313))},1835:function(t,e){},321:function(t,e,n){"use strict";n.d(e,"b",(function(){return i})),n.d(e,"e",(function(){return a})),n.d(e,"c",(function(){return s})),n.d(e,"d",(function(){return u})),n.d(e,"g",(function(){return c})),n.d(e,"a",(function(){return h})),n.d(e,"f",(function(){return f}));var r=n(33);function i(t){return new r.c((function(e){e.error(t)}))}var o=n(59);function a(t){var e=!1;return new Promise((function(n,r){t.subscribe({next:function(t){e||(e=!0,n(t))},error:r})}))}function s(t){return new r.c((function(e){t.then((function(t){e.next(t),e.complete()})).catch(e.error.bind(e))}))}var u=function(t,e,n){var r=new Error(n);throw r.name="ServerError",r.response=t,r.statusCode=t.status,r.result=e,r};function c(t){for(var e=["query","operationName","variables","extensions","context"],n=0,r=Object.keys(t);n-1}))}function s(t){return t&&a(["client"],t)&&a(["export"],t)}var u=n(4);function c(t,e){var n=e,r=[];return t.definitions.forEach((function(t){if("OperationDefinition"===t.kind)throw new i.a(42);"FragmentDefinition"===t.kind&&r.push(t)})),void 0===n&&(Object(i.b)(1===r.length,43),n=r[0].name.value),Object(u.__assign)(Object(u.__assign)({},t),{definitions:Object(u.__spreadArrays)([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:n}}]}}],t.definitions)})}function l(t){void 0===t&&(t=[]);var e={};return t.forEach((function(t){e[t.name.value]=t})),e}function h(t,e){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":var n=e&&e[t.name.value];return Object(i.b)(n,44),n;default:return null}}var f=n(1756),p=n.n(f);function d(t){return{__ref:String(t)}}function v(t){return Boolean(t&&"object"==typeof t&&"string"==typeof t.__ref)}function y(t,e,n,r){if(function(t){return"IntValue"===t.kind}(n)||function(t){return"FloatValue"===t.kind}(n))t[e.value]=Number(n.value);else if(function(t){return"BooleanValue"===t.kind}(n)||function(t){return"StringValue"===t.kind}(n))t[e.value]=n.value;else if(function(t){return"ObjectValue"===t.kind}(n)){var o={};n.fields.map((function(t){return y(o,t.name,t.value,r)})),t[e.value]=o}else if(function(t){return"Variable"===t.kind}(n)){var a=(r||{})[n.name.value];t[e.value]=a}else if(function(t){return"ListValue"===t.kind}(n))t[e.value]=n.values.map((function(t){var n={};return y(n,e,t,r),n[e.value]}));else if(function(t){return"EnumValue"===t.kind}(n))t[e.value]=n.value;else{if(!function(t){return"NullValue"===t.kind}(n))throw new i.a(53);t[e.value]=null}}function g(t,e){var n=null;t.directives&&(n={},t.directives.forEach((function(t){n[t.name.value]={},t.arguments&&t.arguments.forEach((function(r){var i=r.name,o=r.value;return y(n[t.name.value],i,o,e)}))})));var r=null;return t.arguments&&t.arguments.length&&(r={},t.arguments.forEach((function(t){var n=t.name,i=t.value;return y(r,n,i,e)}))),b(t.name.value,r,n)}var m=["connection","include","skip","client","rest","export"];function b(t,e,n){if(e&&n&&n.connection&&n.connection.key){if(n.connection.filter&&n.connection.filter.length>0){var r=n.connection.filter?n.connection.filter:[];r.sort();var i={};return r.forEach((function(t){i[t]=e[t]})),n.connection.key+"("+JSON.stringify(i)+")"}return n.connection.key}var o=t;if(e){var a=p()(e);o+="("+a+")"}return n&&Object.keys(n).forEach((function(t){-1===m.indexOf(t)&&(n[t]&&Object.keys(n[t]).length?o+="@"+t+"("+JSON.stringify(n[t])+")":o+="@"+t)})),o}function _(t,e){if(t.arguments&&t.arguments.length){var n={};return t.arguments.forEach((function(t){var r=t.name,i=t.value;return y(n,r,i,e)})),n}return null}function w(t){return t.alias?t.alias.value:t.name.value}function E(t,e,n){if("string"==typeof t.__typename)return t.__typename;for(var r=0,i=e.selections;r1)for(var r=new Y,i=1;i0}function it(t){return t.errors&&t.errors.length>0||!1}"function"==typeof Symbol&&Symbol.species&&Object.defineProperty(nt,Symbol.species,{value:W.a});var ot="function"==typeof WeakMap&&!("object"==typeof navigator&&"ReactNative"===navigator.product);function at(){for(var t=[],e=0;e>>0),b=0;function _(t,e,n){return t.call.apply(t.bind,arguments)}function w(t,e,n){if(!t)throw Error();if(2t.b&&(t.b++,e.next=t.a,t.a=e)}function q(){this.b=this.a=null}k=P("__EID__")?"__EID__":void 0,S(x,Error),x.prototype.name="CustomError",S(j,x),j.prototype.name="AssertionError",F.prototype.get=function(){if(0/g,it=/"/g,ot=/'/g,at=/\x00/g,st=/[\x00&<>"']/;function ut(t,e){return-1!=t.indexOf(e)}function ct(t,e){return te?1:0}t:{var lt=c.navigator;if(lt){var ht=lt.userAgent;if(ht){Z=ht;break t}}Z=""}function ft(t){return ut(Z,t)}function pt(t,e){for(var n in t)e.call(void 0,t[n],n,t)}function dt(t){for(var e in t)return!1;return!0}function vt(t){var e,n={};for(e in t)n[e]=t[e];return n}var yt="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function gt(t,e){for(var n,r,i=1;i"}else o=void 0===t?"undefined":null===t?"null":typeof t;L("Argument is not a %s (or a non-Element, non-Location mock); got: %s",e,o)}}function bt(t,e){this.a=t===Et&&e||"",this.b=wt}function _t(t){return t instanceof bt&&t.constructor===bt&&t.b===wt?t.a:(L("expected object of type Const, got '"+t+"'"),"type_error:Const")}bt.prototype.sa=!0,bt.prototype.ra=function(){return this.a},bt.prototype.toString=function(){return"Const{"+this.a+"}"};var wt={},Et={},Ct=new bt(Et,"");function Ot(t,e){this.a=t===At&&e||"",this.b=Nt}function St(t){return t instanceof Ot&&t.constructor===Ot&&t.b===Nt?t.a:(L("expected object of type TrustedResourceUrl, got '"+t+"' of type "+p(t)),"type_error:TrustedResourceUrl")}function It(t,e){var n=_t(t);if(!kt.test(n))throw Error("Invalid TrustedResourceUrl format: "+n);return t=n.replace(Tt,(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])instanceof bt?_t(t):encodeURIComponent(String(t))})),new Ot(At,t)}Ot.prototype.sa=!0,Ot.prototype.ra=function(){return this.a.toString()},Ot.prototype.toString=function(){return"TrustedResourceUrl{"+this.a+"}"};var Tt=/%{(\w+)}/g,kt=/^((https:)?\/\/[0-9a-z.:[\]-]+\/|\/[^/\\]|[^:/\\%]+\/|[^:/\\%]*[?#]|about:blank#)/i,Nt={},At={};function Rt(t,e){this.a=t===Lt&&e||"",this.b=jt}function Pt(t){return t instanceof Rt&&t.constructor===Rt&&t.b===jt?t.a:(L("expected object of type SafeUrl, got '"+t+"' of type "+p(t)),"type_error:SafeUrl")}Rt.prototype.sa=!0,Rt.prototype.ra=function(){return this.a.toString()},Rt.prototype.toString=function(){return"SafeUrl{"+this.a+"}"};var Dt=/^(?:(?:https?|mailto|ftp):|[^:/?#]*(?:[/?#]|$))/i;function xt(t){return t instanceof Rt?t:(t="object"==typeof t&&t.sa?t.ra():String(t),Dt.test(t)||(t="about:invalid#zClosurez"),new Rt(Lt,t))}var jt={},Lt={};function Ft(){this.a="",this.b=qt}function Mt(t){return t instanceof Ft&&t.constructor===Ft&&t.b===qt?t.a:(L("expected object of type SafeHtml, got '"+t+"' of type "+p(t)),"type_error:SafeHtml")}Ft.prototype.sa=!0,Ft.prototype.ra=function(){return this.a.toString()},Ft.prototype.toString=function(){return"SafeHtml{"+this.a+"}"};var qt={};function Vt(t){var e=new Ft;return e.a=t,e}Vt("");var Ut=Vt("");function Qt(t,e){for(var n=t.split("%s"),r="",i=Array.prototype.slice.call(arguments,1);i.length&&1")&&(t=t.replace(rt,">")),-1!=t.indexOf('"')&&(t=t.replace(it,""")),-1!=t.indexOf("'")&&(t=t.replace(ot,"'")),-1!=t.indexOf("\0")&&(t=t.replace(at,""))),t}function Ht(t){return Ht[" "](t),t}Vt(" "),Ht[" "]=f;var Bt,Kt,zt=ft("Opera"),Gt=ft("Trident")||ft("MSIE"),Yt=ft("Edge"),Xt=Yt||Gt,Jt=ft("Gecko")&&!(ut(Z.toLowerCase(),"webkit")&&!ft("Edge"))&&!(ft("Trident")||ft("MSIE"))&&!ft("Edge"),$t=ut(Z.toLowerCase(),"webkit")&&!ft("Edge");function Zt(){var t=c.document;return t?t.documentMode:void 0}t:{var te="",ee=(Kt=Z,Jt?/rv:([^\);]+)(\)|;)/.exec(Kt):Yt?/Edge\/([\d\.]+)/.exec(Kt):Gt?/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(Kt):$t?/WebKit\/(\S+)/.exec(Kt):zt?/(?:Version)[ \/]?(\S+)/.exec(Kt):void 0);if(ee&&(te=ee?ee[1]:""),Gt){var ne=Zt();if(null!=ne&&ne>parseFloat(te)){Bt=String(ne);break t}}Bt=te}var re,ie={};function oe(t){return function(t,e){var n=ie;return Object.prototype.hasOwnProperty.call(n,t)?n[t]:n[t]=e(t)}(t,(function(){for(var e=0,n=tt(String(Bt)).split("."),r=tt(String(t)).split("."),i=Math.max(n.length,r.length),o=0;0==e&&o=t.keyCode)&&(t.keyCode=-1)}catch(t){}},Je.prototype.g=function(){return this.a};var Ze="closure_listenable_"+(1e6*Math.random()|0),tn=0;function en(t,e,n,r,i){this.listener=t,this.proxy=null,this.src=e,this.type=n,this.capture=!!r,this.Ua=i,this.key=++tn,this.va=this.Oa=!1}function nn(t){t.va=!0,t.listener=null,t.proxy=null,t.src=null,t.Ua=null}function rn(t){this.src=t,this.a={},this.b=0}function on(t,e){var n=e.type;n in t.a&&Y(t.a[n],e)&&(nn(e),0==t.a[n].length&&(delete t.a[n],t.b--))}function an(t,e,n,r){for(var i=0;ir.keyCode||null!=r.returnValue)){t:{var i=!1;if(0==r.keyCode)try{r.keyCode=-1;break t}catch(t){i=!0}(i||null==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=vn(r[i],t,!0,e);n=n&&o}for(i=0;i>>0);function _n(t){return v(t)?t:(t[bn]||(t[bn]=function(e){return t.handleEvent(e)}),t[bn])}function wn(){Qe.call(this),this.v=new rn(this),this.$b=this,this.fb=null}function En(t,e,n,r,i){t.v.add(String(e),n,!1,r,i)}function Cn(t,e,n,r,i){t.v.add(String(e),n,!0,r,i)}function On(t,e,n,r){if(!(e=t.v.a[String(e)]))return!0;e=e.concat();for(var i=!0,o=0;oe)throw Error("Bad port number "+e);t.g=e}else t.g=null}function Ln(t,e,n){e instanceof Yn?(t.b=e,function(t,e){e&&!t.f&&(Xn(t),t.c=null,t.a.forEach((function(t,e){var n=e.toLowerCase();e!=n&&($n(this,e),tr(this,n,t))}),t)),t.f=e}(t.b,t.i)):(n||(e=Qn(e,zn)),t.b=new Yn(e,t.i))}function Fn(t,e,n){t.b.set(e,n)}function Mn(t,e){return t.b.get(e)}function qn(t){return t instanceof Dn?new Dn(t):new Dn(t,void 0)}function Vn(t,e,n,r){var i=new Dn(null,void 0);return t&&xn(i,t),e&&(i.a=e),n&&jn(i,n),r&&(i.c=r),i}function Un(t,e){return t?e?decodeURI(t.replace(/%25/g,"%2525")):decodeURIComponent(t):""}function Qn(t,e,n){return"string"==typeof t?(t=encodeURI(t).replace(e,Wn),n&&(t=t.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),t):null}function Wn(t){return"%"+((t=t.charCodeAt(0))>>4&15).toString(16)+(15&t).toString(16)}Dn.prototype.toString=function(){var t=[],e=this.f;e&&t.push(Qn(e,Hn,!0),":");var n=this.a;return(n||"file"==e)&&(t.push("//"),(e=this.l)&&t.push(Qn(e,Hn,!0),"@"),t.push(encodeURIComponent(String(n)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),null!=(n=this.g)&&t.push(":",String(n))),(n=this.c)&&(this.a&&"/"!=n.charAt(0)&&t.push("/"),t.push(Qn(n,"/"==n.charAt(0)?Kn:Bn,!0))),(n=this.b.toString())&&t.push("?",n),(n=this.h)&&t.push("#",Qn(n,Gn)),t.join("")},Dn.prototype.resolve=function(t){var e=new Dn(this),n=!!t.f;n?xn(e,t.f):n=!!t.l,n?e.l=t.l:n=!!t.a,n?e.a=t.a:n=null!=t.g;var r=t.c;if(n)jn(e,t.g);else if(n=!!t.c){if("/"!=r.charAt(0))if(this.a&&!this.c)r="/"+r;else{var i=e.c.lastIndexOf("/");-1!=i&&(r=e.c.substr(0,i+1)+r)}if(".."==(i=r)||"."==i)r="";else if(ut(i,"./")||ut(i,"/.")){r=0==i.lastIndexOf("/",0),i=i.split("/");for(var o=[],a=0;a2*t.c&&An(t)))}function Zn(t,e){return Xn(t),e=nr(t,e),Rn(t.a.b,e)}function tr(t,e,n){$n(t,e),0'),r=a.document)&&(r.write(Mt(t)),r.close())):(a=r.open(Pt(e),n,a))&&t.noopener&&(a.opener=null),a)try{a.focus()}catch(t){}return a}var dr=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,vr=/^[^@]+@[^@]+$/;function yr(){var t=null;return new we((function(e){"complete"==c.document.readyState?e():(t=function(){e()},hn(window,"load",t))})).s((function(e){throw fn(window,"load",t),e}))}function gr(t){return t=t||Tr(),!("file:"!==Pr()&&"ionic:"!==Pr()||!t.toLowerCase().match(/iphone|ipad|ipod|android/))}function mr(){var t=c.window;try{return!(!t||t==t.top)}catch(t){return!1}}function br(){return void 0!==c.WorkerGlobalScope&&"function"==typeof c.importScripts}function _r(){return r.INTERNAL.hasOwnProperty("reactNative")?"ReactNative":r.INTERNAL.hasOwnProperty("node")?"Node":br()?"Worker":"Browser"}function wr(){var t=_r();return"ReactNative"===t||"Node"===t}var Er="Firefox",Cr="Chrome";function Or(t){var e=t.toLowerCase();return ut(e,"opera/")||ut(e,"opr/")||ut(e,"opios/")?"Opera":ut(e,"iemobile")?"IEMobile":ut(e,"msie")||ut(e,"trident/")?"IE":ut(e,"edge/")?"Edge":ut(e,"firefox/")?Er:ut(e,"silk/")?"Silk":ut(e,"blackberry")?"Blackberry":ut(e,"webos")?"Webos":!ut(e,"safari/")||ut(e,"chrome/")||ut(e,"crios/")||ut(e,"android")?!ut(e,"chrome/")&&!ut(e,"crios/")||ut(e,"edge/")?ut(e,"android")?"Android":(t=t.match(/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/))&&2==t.length?t[1]:"Other":Cr:"Safari"}var Sr={ld:"FirebaseCore-web",nd:"FirebaseUI-web"};function Ir(t,e){e=e||[];var n,r=[],i={};for(n in Sr)i[Sr[n]]=!0;for(n=0;ne)throw Error("Short delay should be less than long delay!");this.a=t,this.c=e,t=Tr(),e=_r(),this.b=hr(t)||"ReactNative"===e}function Ur(){var t=c.document;return!t||void 0===t.visibilityState||"visible"==t.visibilityState}function Qr(t){"undefined"!=typeof console&&"function"==typeof console.warn&&console.warn(t)}function Wr(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 Hr(){return!(!kr("fireauth.oauthhelper",c)&&!kr("fireauth.iframe",c))}Vr.prototype.get=function(){var t=c.navigator;return!t||"boolean"!=typeof t.onLine||!Rr()&&"chrome-extension:"!==Pr()&&void 0===t.connection||t.onLine?this.b?this.c:this.a:Math.min(5e3,this.a)};var Br,Kr={};function zr(t){Kr[t]||(Kr[t]=!0,Qr(t))}try{var Gr={};Object.defineProperty(Gr,"abcd",{configurable:!0,enumerable:!0,value:1}),Object.defineProperty(Gr,"abcd",{configurable:!0,enumerable:!0,value:2}),Br=2==Gr.abcd}catch(Kt){Br=!1}function Yr(t,e,n){Br?Object.defineProperty(t,e,{configurable:!0,enumerable:!0,value:n}):t[e]=n}function Xr(t,e){if(e)for(var n in e)e.hasOwnProperty(n)&&Yr(t,n,e[n])}function Jr(t){var e={};return Xr(e,t),e}function $r(t){var e=t;if("object"==typeof t&&null!=t)for(var n in e="length"in t?[]:{},t)Yr(e,n,$r(t[n]));return e}function Zr(t){var e=t&&(t[ii]?"phone":null);if(!(e&&t&&t[ri]))throw new I("internal-error","Internal assert: invalid MultiFactorInfo object");Yr(this,"uid",t[ri]),Yr(this,"displayName",t[ei]||null);var n=null;t[ni]&&(n=new Date(t[ni]).toUTCString()),Yr(this,"enrollmentTime",n),Yr(this,"factorId",e)}function ti(t){try{var e=new oi(t)}catch(t){e=null}return e}Zr.prototype.w=function(){return{uid:this.uid,displayName:this.displayName,factorId:this.factorId,enrollmentTime:this.enrollmentTime}};var ei="displayName",ni="enrolledAt",ri="mfaEnrollmentId",ii="phoneInfo";function oi(t){Zr.call(this,t),Yr(this,"phoneNumber",t[ii])}function ai(t){var e={},n=t[li],r=t[fi],i=t[pi];if(t=ti(t[hi]),!i||i!=ui&&i!=ci&&!n||i==ci&&!r||i==si&&!t)throw Error("Invalid checkActionCode response!");i==ci?(e[vi]=n||null,e[gi]=n||null,e[di]=r):(e[vi]=r||null,e[gi]=r||null,e[di]=n||null),e[yi]=t||null,Yr(this,bi,i),Yr(this,mi,$r(e))}S(oi,Zr),oi.prototype.w=function(){var t=oi.$a.w.call(this);return t.phoneNumber=this.phoneNumber,t};var si="REVERT_SECOND_FACTOR_ADDITION",ui="EMAIL_SIGNIN",ci="VERIFY_AND_CHANGE_EMAIL",li="email",hi="mfaInfo",fi="newEmail",pi="requestType",di="email",vi="fromEmail",yi="multiFactorInfo",gi="previousEmail",mi="data",bi="operation";function _i(t){var e=Mn(t=qn(t),wi)||null,n=Mn(t,Ei)||null,r=Mn(t,Si)||null;if(r=r&&Ti[r]||null,!e||!n||!r)throw new I("argument-error",wi+", "+Ei+"and "+Si+" are required in a valid action code URL.");Xr(this,{apiKey:e,operation:r,code:n,continueUrl:Mn(t,Ci)||null,languageCode:Mn(t,Oi)||null,tenantId:Mn(t,Ii)||null})}var wi="apiKey",Ei="oobCode",Ci="continueUrl",Oi="languageCode",Si="mode",Ii="tenantId",Ti={recoverEmail:"RECOVER_EMAIL",resetPassword:"PASSWORD_RESET",revertSecondFactorAddition:si,signIn:ui,verifyAndChangeEmail:ci,verifyEmail:"VERIFY_EMAIL"};function ki(t){try{return new _i(t)}catch(t){return null}}function Ni(t){var e=t[xi];if(void 0===e)throw new I("missing-continue-uri");if("string"!=typeof e||"string"==typeof e&&!e.length)throw new I("invalid-continue-uri");this.h=e,this.b=this.a=null,this.g=!1;var n=t[Ai];if(n&&"object"==typeof n){e=n[Fi];var r=n[ji];if(n=n[Li],"string"==typeof e&&e.length){if(this.a=e,void 0!==r&&"boolean"!=typeof r)throw new I("argument-error",ji+" property must be a boolean when specified.");if(this.g=!!r,void 0!==n&&("string"!=typeof n||"string"==typeof n&&!n.length))throw new I("argument-error",Li+" property must be a non empty string when specified.");this.b=n||null}else{if(void 0!==e)throw new I("argument-error",Fi+" property must be a non empty string when specified.");if(void 0!==r||void 0!==n)throw new I("missing-android-pkg-name")}}else if(void 0!==n)throw new I("argument-error",Ai+" property must be a non null object when specified.");if(this.f=null,(e=t[Di])&&"object"==typeof e){if("string"==typeof(e=e[Mi])&&e.length)this.f=e;else if(void 0!==e)throw new I("argument-error",Mi+" property must be a non empty string when specified.")}else if(void 0!==e)throw new I("argument-error",Di+" property must be a non null object when specified.");if(void 0!==(e=t[Pi])&&"boolean"!=typeof e)throw new I("argument-error",Pi+" property must be a boolean when specified.");if(this.c=!!e,void 0!==(t=t[Ri])&&("string"!=typeof t||"string"==typeof t&&!t.length))throw new I("argument-error",Ri+" property must be a non empty string when specified.");this.i=t||null}var Ai="android",Ri="dynamicLinkDomain",Pi="handleCodeInApp",Di="iOS",xi="url",ji="installApp",Li="minimumVersion",Fi="packageName",Mi="bundleId";function qi(t){var e={};for(var n in e.continueUrl=t.h,e.canHandleCodeInApp=t.c,(e.androidPackageName=t.a)&&(e.androidMinimumVersion=t.b,e.androidInstallApp=t.g),e.iOSBundleId=t.f,e.dynamicLinkDomain=t.i,e)null===e[n]&&delete e[n];return e}var Vi=null;function Ui(t){var e="";return function(t,e){function n(e){for(;rn;n++)for(var r=t.concat(e[n].split("")),i=0;i>4),64!=a&&(e(o<<4&240|a>>2),64!=s&&e(a<<6&192|s))}}(t,(function(t){e+=String.fromCharCode(t)})),e}function Qi(t){var e=Hi(t);if(!(e&&e.sub&&e.iss&&e.aud&&e.exp))throw Error("Invalid JWT");this.g=t,this.c=e.exp,this.h=e.sub,O(),this.a=e.provider_id||e.firebase&&e.firebase.sign_in_provider||null,this.f=e.firebase&&e.firebase.tenant||null,this.b=!!e.is_anonymous||"anonymous"==this.a}function Wi(t){try{return new Qi(t)}catch(t){return null}}function Hi(t){if(!t)return null;if(3!=(t=t.split(".")).length)return null;for(var e=(4-(t=t[1]).length%4)%4,n=0;n Auth section -> Sign in method tab.",t):"http"==r||"https"==r?n=Qt("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",I.call(this,e,n)}function Ko(t,e,n){I.call(this,t,n),(t=e||{}).Ib&&Yr(this,"email",t.Ib),t.ea&&Yr(this,"phoneNumber",t.ea),t.credential&&Yr(this,"credential",t.credential),t.Yb&&Yr(this,"tenantId",t.Yb)}function zo(t){if(t.code){var e=t.code||"";0==e.indexOf(N)&&(e=e.substring(N.length));var n={credential:Mo(t),Yb:t.tenantId};if(t.email)n.Ib=t.email;else if(t.phoneNumber)n.ea=t.phoneNumber;else if(!n.credential)return new I(e,t.message||void 0);return new Ko(e,n,t.message)}return null}function Go(){}function Yo(t){return t.c||(t.c=t.b())}function Xo(){}function Jo(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=function t(e){return e.c?e.c:e.a?t(e.a):(L("Root logger has no level set."),null)}(this).value)for(v(e)&&(e=e()),t=new ea(t,String(e),this.f),n&&(t.a=n),n=this;n;)n=n.a};var ua={},ca=null;function la(t){var e;if(ca||(ca=new na(""),ua[""]=ca,ca.c=aa),!(e=ua[t])){e=new na(t);var n=t.lastIndexOf("."),r=t.substr(n+1);(n=la(t.substr(0,n))).b||(n.b={}),n.b[r]=e,e.a=n,ua[t]=e}return e}function ha(t,e){t&&t.log(sa,e,void 0)}function fa(t){this.f=t}function pa(t){wn.call(this),this.o=t,this.readyState=da,this.status=0,this.responseType=this.responseText=this.response=this.statusText="",this.onreadystatechange=null,this.i=new Headers,this.b=null,this.m="GET",this.g="",this.a=!1,this.h=la("goog.net.FetchXmlHttp"),this.l=this.c=this.f=null}S(fa,Go),fa.prototype.a=function(){return new pa(this.f)},fa.prototype.b=function(t){return function(){return t}}({}),S(pa,wn);var da=0;function va(t){t.c.read().then(t.oc.bind(t)).catch(t.Ta.bind(t))}function ya(t,e){e&&t.f&&(t.status=t.f.status,t.statusText=t.f.statusText),t.readyState=4,t.f=null,t.c=null,t.l=null,ga(t)}function ga(t){t.onreadystatechange&&t.onreadystatechange.call(t)}function ma(t){wn.call(this),this.headers=new Nn,this.O=t||null,this.c=!1,this.A=this.a=null,this.h=this.P=this.l="",this.f=this.N=this.i=this.G=!1,this.g=0,this.o=null,this.m=ba,this.u=this.R=!1}(e=pa.prototype).open=function(t,e){if(this.readyState!=da)throw this.abort(),Error("Error reopening a connection");this.m=t,this.g=e,this.readyState=1,ga(this)},e.send=function(t){if(1!=this.readyState)throw this.abort(),Error("need to call open() first. ");this.a=!0;var e={headers:this.i,method:this.m,credentials:void 0,cache:void 0};t&&(e.body=t),this.o.fetch(new Request(this.g,e)).then(this.tc.bind(this),this.Ta.bind(this))},e.abort=function(){this.response=this.responseText="",this.i=new Headers,this.status=0,this.c&&this.c.cancel("Request was aborted."),1<=this.readyState&&this.a&&4!=this.readyState&&(this.a=!1,ya(this,!1)),this.readyState=da},e.tc=function(t){this.a&&(this.f=t,this.b||(this.b=t.headers,this.readyState=2,ga(this)),this.a&&(this.readyState=3,ga(this),this.a&&("arraybuffer"===this.responseType?t.arrayBuffer().then(this.rc.bind(this),this.Ta.bind(this)):void 0!==c.ReadableStream&&"body"in t?(this.response=this.responseText="",this.c=t.body.getReader(),this.l=new TextDecoder,va(this)):t.text().then(this.sc.bind(this),this.Ta.bind(this)))))},e.oc=function(t){if(this.a){var e=this.l.decode(t.value?t.value:new Uint8Array(0),{stream:!t.done});e&&(this.response=this.responseText+=e),t.done?ya(this,!0):ga(this),3==this.readyState&&va(this)}},e.sc=function(t){this.a&&(this.response=this.responseText=t,ya(this,!0))},e.rc=function(t){this.a&&(this.response=t,ya(this,!0))},e.Ta=function(t){var e=this.h;e&&e.log(oa,"Failed to fetch url "+this.g,t instanceof Error?t:Error(t)),this.a&&ya(this,!0)},e.setRequestHeader=function(t,e){this.i.append(t,e)},e.getResponseHeader=function(t){return this.b?this.b.get(t.toLowerCase())||"":((t=this.h)&&t.log(oa,"Attempting to get response header but no headers have been received for url: "+this.g,void 0),"")},e.getAllResponseHeaders=function(){if(!this.b){var t=this.h;return t&&t.log(oa,"Attempting to get all response headers but no headers have been received for url: "+this.g,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")},S(ma,wn);var ba="";ma.prototype.b=la("goog.net.XhrIo");var _a=/^https?$/i,wa=["POST","PUT"];function Ea(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.P=n,t.G=!1,t.c=!0,t.a=t.O?t.O.a():Wo.a(),t.A=t.O?Yo(t.O):Yo(Wo),t.a.onreadystatechange=E(t.Ub,t);try{ha(t.b,Ra(t,"Opening Xhr")),t.N=!0,t.a.open(n,String(e),!0),t.N=!1}catch(e){return ha(t.b,Ra(t,"Error opening Xhr: "+e.message)),void Oa(t,e)}e=r||"";var o=new Nn(t.headers);i&&function(t,e){if(t.forEach&&"function"==typeof t.forEach)t.forEach(e,void 0);else if(d(t)||"string"==typeof t)H(t,e,void 0);else for(var n=kn(t),r=Tn(t),i=r.length,o=0;oe?null:"string"==typeof t?t.charAt(e):t[e]}(o.Y()),r=c.FormData&&e instanceof c.FormData,!G(wa,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.m&&(t.a.responseType=t.m),"withCredentials"in t.a&&t.a.withCredentials!==t.R&&(t.a.withCredentials=t.R);try{ka(t),0=e.l&&e.cancel())}this.u?this.u.call(this.o,this):this.m=!0,this.a||(t=new qa(this),xa(this),Da(this,!1,t))}},Pa.prototype.v=function(t,e){this.i=!1,Da(this,t,e)},Pa.prototype.then=function(t,e,n){var r,i,o=new we((function(t,e){r=t,i=e}));return ja(this,r,(function(t){t instanceof qa?o.cancel():i(t)})),o.then(t,e,n)},Pa.prototype.$goog_Thenable=!0,S(Ma,x),Ma.prototype.message="Deferred has already fired",Ma.prototype.name="AlreadyCalledError",S(qa,x),qa.prototype.message="Deferred was canceled",qa.prototype.name="CanceledError",Va.prototype.c=function(){throw delete Ua[this.a],this.b};var Ua={};function Qa(t){var e={},n=e.document||document,r=St(t).toString(),i=pe(document,"SCRIPT"),o={Vb:i,Ma:void 0},a=new Pa(o),s=null,u=null!=e.timeout?e.timeout:5e3;return 0t)&&(!Gt||!re||9e;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=(o=o+((c>>>6|c<<26)^(c>>>11|c<<21)^(c>>>25|c<<7))|0)+((a=(a=c&l^~c&h)+(0|oc[e])|0)+(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 vc(t,e,n){void 0===n&&(n=e.length);var r=0,i=t.c;if("string"==typeof e)for(;r=o&&o==(0|o)))throw Error("message must be a byte array");t.f[i++]=o,i==t.b&&(dc(t),i=0)}}t.c=i,t.g+=n}uc.prototype.reset=function(){this.g=this.c=0,this.a=c.Int32Array?new Int32Array(this.h):$(this.h)};var yc=[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];function gc(){uc.call(this,8,mc)}S(gc,uc);var mc=[1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225];function bc(t,e,n,r,i,o){this.m=t,this.i=e,this.l=n,this.v=r||null,this.u=i||null,this.o=o,this.h=e+":"+n,this.A=new sc,this.g=new ic(this.h),this.f=null,this.b=[],this.a=this.c=null}function _c(t){return new I("invalid-cordova-configuration",t)}function wc(t){var e=new gc;vc(e,t),t=[];var n=8*e.g;56>e.c?vc(e,pc,56-e.c):vc(e,pc,e.b-(e.c-56));for(var r=63;56<=r;r--)e.f[r]=255&n,n/=256;for(dc(e),r=n=0;r>i&255;return function(t){return K(t,(function(t){return 1<(t=t.toString(16)).length?t:"0"+t})).join("")}(t)}function Ec(t,e){for(var n=0;nt.f&&(t.a=t.f),e)}(e,n)).then((function(){return function(){var t=c.document,e=null;return Ur()||!t?ke():new we((function(n){e=function(){Ur()&&(t.removeEventListener("visibilitychange",e,!1),n())},t.addEventListener("visibilitychange",e,!1)})).s((function(n){throw t.removeEventListener("visibilitychange",e,!1),n}))}()})).then((function(){return e.h()})).then((function(){t(e,!0)})).s((function(n){e.i(n)&&t(e,!1)}))}(this,!0)},ll.prototype.stop=function(){this.b&&(this.b.cancel(),this.b=null)},hl.prototype.w=function(){return{apiKey:this.c.c,refreshToken:this.a,accessToken:this.b&&this.b.toString(),expirationTime:fl(this)}},hl.prototype.getToken=function(t){return t=!!t,this.b&&!this.a?Ne(new I("user-token-expired")):t||!this.b||O()>fl(this)-3e4?this.a?dl(this,{grant_type:"refresh_token",refresh_token:this.a}):ke(null):ke({accessToken:this.b.toString(),refreshToken:this.a})},vl.prototype.w=function(){return{lastLoginAt:this.b,createdAt:this.a}},S(gl,wn),gl.prototype.wa=function(t){this.pa=t,ns(this.a,t)},gl.prototype.ka=function(){return this.pa},gl.prototype.Ga=function(){return $(this.X)},gl.prototype.gb=function(){this.u.b&&(this.u.stop(),this.u.start())},Yr(gl.prototype,"providerId","firebase"),(e=gl.prototype).reload=function(){var t=this;return Hl(this,Al(this).then((function(){return Ll(t).then((function(){return Il(t)})).then(Nl)})))},e.nc=function(t){return this.I(t).then((function(t){return new $c(t)}))},e.I=function(t){var e=this;return Hl(this,Al(this).then((function(){return e.b.getToken(t)})).then((function(t){if(!t)throw new I("internal-error");return t.accessToken!=e.ya&&(Sl(e,t.accessToken),e.dispatchEvent(new sl("tokenChanged"))),xl(e,"refreshToken",t.refreshToken),t.accessToken})))},e.Jc=function(t){if(!(t=t.users)||!t.length)throw new I("internal-error");kl(this,{uid:(t=t[0]).localId,displayName:t.displayName,photoURL:t.photoUrl,email:t.email,emailVerified:!!t.emailVerified,phoneNumber:t.phoneNumber,lastLoginAt:t.lastLoginAt,createdAt:t.createdAt,tenantId:t.tenantId});for(var e=function(t){return(t=t.providerUserInfo)&&t.length?K(t,(function(t){return new yl(t.rawId,t.providerId,t.email,t.displayName,t.photoUrl,t.phoneNumber)})):[]}(t),n=0;nthis.A&&(this.A=0),0==this.A&&ph(this)&&Ol(ph(this)),this.removeAuthTokenListener(t)},e.addAuthTokenListener=function(t){var e=this;this.u.push(t),yh(this,this.i.then((function(){e.m||G(e.u,t)&&t(dh(e))})))},e.removeAuthTokenListener=function(t){X(this.u,(function(e){return e==t}))},e.delete=function(){this.m=!0;for(var t=0;ti||i>=Uh.length)throw new I("internal-error","Argument validator received an unsupported number of arguments.");n=Uh[i],r=(r?"":n+" argument ")+(e.name?'"'+e.name+'" ':"")+"must be "+e.J+".";break t}r=null}}if(r)throw new I("argument-error",t+" failed: "+r)}(e=Rh.prototype).Ia=function(){var t=this;return this.f?this.f:this.f=Fh(this,ke().then((function(){if(Rr()&&!br())return yr();throw new I("operation-not-supported-in-this-environment","RecaptchaVerifier is only supported in a browser HTTP/HTTPS environment.")})).then((function(){return t.v.g(t.u())})).then((function(e){return t.g=e,nu(t.o,qs,{})})).then((function(e){t.a[xh]=e.recaptchaSiteKey})).s((function(e){throw t.f=null,e})))},e.render=function(){Mh(this);var t=this;return Fh(this,this.Ia().then((function(){if(null===t.c){var e=t.m;if(!t.i){var n=se(e);e=function(t,e,n){var r=arguments,i=document,o=String(r[0]),a=r[1];if(!ae&&a&&(a.name||a.type)){if(o=["<",o],a.name&&o.push(' name="',Wt(a.name),'"'),a.type){o.push(' type="',Wt(a.type),'"');var s={};gt(s,a),delete s.type,a=s}o.push(">"),o=o.join("")}return o=pe(i,o),a&&("string"==typeof a?o.className=a:Array.isArray(a)?o.className=a.join(" "):ue(o,a)),2n?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r};
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/function F(t,e){for(var n in t)t.hasOwnProperty(n)&&e(n,t[n])}var M=function(t){a.assert(!N(t),"Invalid JSON number");var e,n,r,i,o;0===t?(n=0,r=0,e=1/t==-1/0?1:0):(e=t<0,(t=Math.abs(t))>=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023))+1023,r=Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,r=Math.round(t/Math.pow(2,-1074))));var s=[];for(o=52;o;o-=1)s.push(r%2?1:0),r=Math.floor(r/2);for(o=11;o;o-=1)s.push(n%2?1:0),n=Math.floor(n/2);s.push(e?1:0),s.reverse();var u=s.join(""),c="";for(o=0;o<64;o+=8){var l=parseInt(u.substr(o,8),2).toString(16);1===l.length&&(l="0"+l),c+=l}return c.toLowerCase()},q=new RegExp("^-?(0*)\\d{1,10}$"),V=function(t){if(q.test(t)){var e=Number(t);if(e>=-2147483648&&e<=2147483647)return e}return null},U=function(t){try{t()}catch(t){setTimeout((function(){var e=t.stack||"";throw k("Exception was thrown by user callback.",e),t}),Math.floor(0))}},Q=function(t,e){var n=setTimeout(t,e);return"object"==typeof n&&n.unref&&n.unref(),n},W=function(){function t(t,e){if(void 0===e){this.pieces_=t.split("/");for(var n=0,r=0;r0&&(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:!1,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)return null;for(var e=[],n=this.pieceNum_;n0&&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;it.getLength())return!1;for(;e0&&(this.byteLength_+=1),this.parts_.push(t),this.byteLength_+=a.stringLength(t),this.checkValid_()},t.prototype.pop=function(){var t=this.parts_.pop();this.byteLength_-=a.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}(),B=function(){function t(t,e,n,r,i,o,a){void 0===i&&(i=!1),void 0===o&&(o=""),void 0===a&&(a=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=o,this.includeNamespaceInQueryParams=a,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=v.get("host:"+t)||this.host}return t.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()||this.includeNamespaceInQueryParams},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()&&v.set("host:"+this.host,this.internalHost))},t.prototype.connectionURL=function(t,e){var n;if(a.assert("string"==typeof t,"typeof type must == string"),a.assert("object"==typeof e,"typeof params must == object"),"websocket"===t)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if("long_polling"!==t)throw new Error("Unknown connection type: "+t);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&&(e.ns=this.namespace);var r=[];return F(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}();var K,z,G,Y,X,J=function(t,e){var n=$(t),r=n.namespace;"firebase.com"===n.domain&&T(n.host+" is no longer supported. Please use .firebaseio.com instead"),r&&"undefined"!==r||"localhost"===n.domain||T("Cannot parse Firebase url. Please use https://.firebaseio.com"),n.secure||"undefined"!=typeof window&&window.location&&window.location.protocol&&-1!==window.location.protocol.indexOf("https:")&&k("Insecure Firebase access from a secure page. Please use https in calls to new Firebase().");var i="ws"===n.scheme||"wss"===n.scheme;return{repoInfo:new B(n.host,n.secure,r,e,i,"",r!==n.subdomain),path:new W(n.pathString)}},$=function(t){var e="",n="",r="",i="",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)),h0){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(t){}e+="/"+i}return e}(t.substring(h,f)));var p=function(t){var e,n,r={};"?"===t.charAt(0)&&(t=t.substring(1));try{for(var i=o.__values(t.split("&")),a=i.next();!a.done;a=i.next()){var s=a.value;if(0!==s.length){var u=s.split("=");2===u.length?r[decodeURIComponent(u[0])]=decodeURIComponent(u[1]):k("Invalid query segment '"+s+"' in query '"+t+"'")}}}catch(t){e={error:t}}finally{try{a&&!a.done&&(n=i.return)&&n.call(i)}finally{if(e)throw e.error}}return r}(t.substring(Math.min(t.length,f)));(l=e.indexOf(":"))>=0?(s="https"===u||"wss"===u,c=parseInt(e.substring(l+1),10)):l=e.length;var d=e.slice(0,l);if("localhost"===d.toLowerCase())n="localhost";else if(d.split(".").length<=2)n=d;else{var v=e.indexOf(".");r=e.substring(0,v).toLowerCase(),n=e.substring(v+1),a=r}"ns"in p&&(a=p.ns)}return{host:e,port:c,domain:n,subdomain:r,secure:s,scheme:u,pathString:i,namespace:a}},Z=/[\[\].#$\/\u0000-\u001F\u007F]/,tt=/[\[\].#$\u0000-\u001F\u007F]/,et=function(t){return"string"==typeof t&&0!==t.length&&!Z.test(t)},nt=function(t){return"string"==typeof t&&0!==t.length&&!tt.test(t)},rt=function(t){return null===t||"string"==typeof t||"number"==typeof t&&!N(t)||t&&"object"==typeof t&&a.contains(t,".sv")},it=function(t,e,n,r,i){i&&void 0===n||ot(a.errorPrefix(t,e,i),n,r)},ot=function(t,e,n){var r=n instanceof W?new H(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(N(e))throw new Error(t+"contains "+e.toString()+" "+r.toErrorString());if("string"==typeof e&&e.length>10485760/3&&a.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(F(e,(function(e,n){if(".value"===e)i=!0;else if(".priority"!==e&&".sv"!==e&&(o=!0,!et(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),ot(t,n,r),r.pop()})),i&&o)throw new Error(t+' contains ".value" child '+r.toErrorString()+" in addition to actual children.")}},at=function(t,e,n,r,i){if(!i||void 0!==n){var o=a.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 s=[];F(n,(function(t,e){var n=new W(t);if(ot(o,e,r.child(n)),".priority"===n.getBack()&&!rt(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).");s.push(n)})),function(t,e){var n,r;for(n=0;n=0;e--)r[e]=K.charAt(t%64),t=Math.floor(t/64);a.assert(0===t,"Cannot push at time == 0");var i=r.join("");if(n){for(e=11;e>=0&&63===G[e];e--)G[e]=0;G[e]++}else for(e=0;e<12;e++)G[e]=Math.floor(64*Math.random());for(e=0;e<12;e++)i+=K.charAt(G[e]);return a.assert(20===i.length,"nextPushId: Length should be 20."),i}),mt=function(){function t(t,e){this.name=t,this.node=e}return t.Wrap=function(e,n){return new t(e,n)},t}(),bt=function(){function t(){}return t.prototype.getCompare=function(){return this.compare.bind(this)},t.prototype.indexedValueChanged=function(t,e){var n=new mt(A,t),r=new mt(A,e);return 0!==this.compare(n,r)},t.prototype.minPost=function(){return mt.MIN},t}(),_t=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o.__extends(e,t),Object.defineProperty(e,"__EMPTY_NODE",{get:function(){return Y},set:function(t){Y=t},enumerable:!1,configurable:!0}),e.prototype.compare=function(t,e){return P(t.name,e.name)},e.prototype.isDefinedOn=function(t){throw a.assertionError("KeyIndex.isDefinedOn not expected to be called.")},e.prototype.indexedValueChanged=function(t,e){return!1},e.prototype.minPost=function(){return mt.MIN},e.prototype.maxPost=function(){return new mt(R,Y)},e.prototype.makePost=function(t,e){return a.assert("string"==typeof t,"KeyIndex indexValue must always be a string."),new mt(t,Y)},e.prototype.toString=function(){return".key"},e}(bt),wt=new _t;var Et,Ct,Ot,St=function(t){return"number"==typeof t?"number:"+M(t):"string:"+t},It=function(t){if(t.isLeafNode()){var e=t.val();a.assert("string"==typeof e||"number"==typeof e||"object"==typeof e&&a.contains(e,".sv"),"Priority must be a string or number.")}else a.assert(t===X||t.isEmpty(),"priority of unexpected type.");a.assert(t===X||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},Tt=function(){function t(e,n){void 0===n&&(n=t.__childrenNodeConstructor.EMPTY_NODE),this.value_=e,this.priorityNode_=n,this.lazyHash_=null,a.assert(void 0!==this.value_&&null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),It(this.priorityNode_)}return Object.defineProperty(t,"__childrenNodeConstructor",{get:function(){return Et},set:function(t){Et=t},enumerable:!1,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:(a.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:"+St(this.priorityNode_.val())+":");var e=typeof this.value_;t+=e+":",t+="number"===e?M(this.value_):this.value_,this.lazyHash_=b(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:(a.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 a.assert(i>=0,"Unknown leaf type: "+n),a.assert(o>=0,"Unknown leaf type: "+r),i===o?"object"===r?0:this.value_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}(),Pt=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:xt.EMPTY_NODE,this.right=null!=o?o:xt.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=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))).fixUp_()},t.prototype.removeMin_=function(){if(this.left.isEmpty())return xt.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)).fixUp_()},t.prototype.remove=function(t,e){var n,r;if(e(t,(n=this).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 xt.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=(t=t.copy(null,null,null,null,t.right.rotateRight_())).rotateLeft_()).colorFlip_()),t},t.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t.left.left.isRed_()&&(t=(t=t.rotateRight_()).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(){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");var t=this.left.check_();if(t!==this.right.check_())throw new Error("Black depths differ");return t+(this.isRed_()?0:1)},t.RED=!0,t.BLACK=!1,t}(),Dt=function(){function t(){}return t.prototype.copy=function(t,e,n,r,i){return this},t.prototype.insert=function(t,e,n){return new Pt(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}(),xt=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,Pt.BLACK,null,null))},t.prototype.remove=function(e){return new t(this.comparator_,this.root_.remove(e,this.comparator_).copy(null,null,Pt.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 Rt(this.root_,null,this.comparator_,!1,t)},t.prototype.getIteratorFrom=function(t,e){return new Rt(this.root_,t,this.comparator_,!1,e)},t.prototype.getReverseIteratorFrom=function(t,e){return new Rt(this.root_,t,this.comparator_,!0,e)},t.prototype.getReverseIterator=function(t){return new Rt(this.root_,null,this.comparator_,!0,t)},t.EMPTY_NODE=new Dt,t}(),jt=Math.log(2),Lt=function(){function t(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/jt,10)),this.current_=this.count-1;var n,r=(n=this.count,parseInt(Array(n+1).join("1"),2));this.bits_=t+1&r}return t.prototype.nextBitIsOne=function(){var t=!(this.bits_&1<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===Wt?-1:0},t.prototype.withIndex=function(e){if(e===wt||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===wt||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(At),r=e.getIterator(At),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===wt?null:this.indexMap_.get(t.toString())},t.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,t}(),Wt=new(function(t){function e(){return t.call(this,new xt(Ut),Qt.EMPTY_NODE,qt.Default)||this}return o.__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 Qt.EMPTY_NODE},e.prototype.isEmpty=function(){return!1},e}(Qt));Object.defineProperties(mt,{MIN:{value:new mt(A,Qt.EMPTY_NODE)},MAX:{value:new mt(R,Wt)}}),_t.__EMPTY_NODE=Qt.EMPTY_NODE,Tt.__childrenNodeConstructor=Qt,X=Wt,function(t){Ot=t}(Wt);function Ht(t,e){if(void 0===e&&(e=null),null===t)return Qt.EMPTY_NODE;if("object"==typeof t&&".priority"in t&&(e=t[".priority"]),a.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 Tt(t,Ht(e));if(t instanceof Array){var n=Qt.EMPTY_NODE;return F(t,(function(e,r){if(a.contains(t,e)&&"."!==e.substring(0,1)){var i=Ht(r);!i.isLeafNode()&&i.isEmpty()||(n=n.updateImmediateChild(e,i))}})),n.updatePriority(Ht(e))}var r=[],i=!1;if(F(t,(function(t,e){if("."!==t.substring(0,1)){var n=Ht(e);n.isEmpty()||(i=i||!n.getPriority().isEmpty(),r.push(new mt(t,n)))}})),0===r.length)return Qt.EMPTY_NODE;var o=Ft(r,Vt,(function(t){return t.name}),Ut);if(i){var s=Ft(r,At.getCompare());return new Qt(o,Ht(e),new qt({".priority":s},{".priority":At}))}return new Qt(o,Ht(e),qt.Default)}!function(t){Ct=t}(Ht);
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Bt,Kt=new(function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return o.__extends(e,t),e.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?P(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 mt.MIN},e.prototype.maxPost=function(){return mt.MAX},e.prototype.makePost=function(t,e){var n=Ht(t);return new mt(e,n)},e.prototype.toString=function(){return".value"},e}(bt)),zt=function(t){function e(e){var n=t.call(this)||this;return n.indexPath_=e,a.assert(!e.isEmpty()&&".priority"!==e.getFront(),"Can't create PathIndex with empty path or .priority key"),n}return o.__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?P(t.name,e.name):i},e.prototype.makePost=function(t,e){var n=Ht(t),r=Qt.EMPTY_NODE.updateChild(this.indexPath_,n);return new mt(e,r)},e.prototype.maxPost=function(){var t=Qt.EMPTY_NODE.updateChild(this.indexPath_,Wt);return new mt(R,t)},e.prototype.toString=function(){return this.indexPath_.slice().join("/")},e}(bt),Gt=function(){function t(t,e,n){this.node_=t,this.ref_=e,this.index_=n}return t.prototype.val=function(){return a.validateArgCount("DataSnapshot.val",0,0,arguments.length),this.node_.val()},t.prototype.exportVal=function(){return a.validateArgCount("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},t.prototype.toJSON=function(){return a.validateArgCount("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},t.prototype.exists=function(){return a.validateArgCount("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},t.prototype.child=function(e){a.validateArgCount("DataSnapshot.child",0,1,arguments.length),e=String(e),lt("DataSnapshot.child",1,e,!1);var n=new W(e),r=this.ref_.child(n);return new t(this.node_.getChild(n),r,At)},t.prototype.hasChild=function(t){a.validateArgCount("DataSnapshot.hasChild",1,1,arguments.length),lt("DataSnapshot.hasChild",1,t,!1);var e=new W(t);return!this.node_.getChild(e).isEmpty()},t.prototype.getPriority=function(){return a.validateArgCount("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},t.prototype.forEach=function(e){var n=this;if(a.validateArgCount("DataSnapshot.forEach",1,1,arguments.length),a.validateCallback("DataSnapshot.forEach",1,e,!1),this.node_.isLeafNode())return!1;var r=this.node_;return!!r.forEachChild(this.index_,(function(r,i){return e(new t(i,n.ref_.child(r),At))}))},t.prototype.hasChildren=function(){return a.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:!1,configurable:!0}),t.prototype.numChildren=function(){return a.validateArgCount("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},t.prototype.getRef=function(){return a.validateArgCount("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(t.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),t}(),Yt=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+":"+a.stringify(this.snapshot.exportVal())},t}(),Xt=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}(),Jt=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 Yt("value",this,new Gt(t.snapshotNode,e.getRef(),n))},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){a.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 Xt(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}(),$t=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,a.contains(this.callbacks_,e)},t.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new Xt(this,t,e):null},t.prototype.createEvent=function(t,e){a.assert(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),r=e.getQueryParams().getIndex();return new Yt(t.type,this,new Gt(t.snapshotNode,n,r),t.prevName)},t.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){a.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){var n=this;if(e instanceof t){if(!this.callbacks_||!e.callbacks_)return!0;if(this.context_===e.context_){var r=Object.keys(e.callbacks_),i=Object.keys(this.callbacks_),o=r.length;if(o===i.length){if(1===o){var a=r[0],s=i[0];return!(s!==a||e.callbacks_[a]&&this.callbacks_[s]&&e.callbacks_[a]!==this.callbacks_[s])}return i.every((function(t){return e.callbacks_[t]===n.callbacks_[t]}))}}}return!1},t.prototype.hasAnyCallback=function(){return null!==this.callbacks_},t}(),Zt=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 a.assert(Bt,"Reference.ts has not been loaded"),Bt},set:function(t){Bt=t},enumerable:!1,configurable:!0}),t.validateQueryEndpoints_=function(t){var e=null,n=null;if(t.hasStart()&&(e=t.getIndexStartValue()),t.hasEnd()&&(n=t.getIndexEndValue()),t.getIndex()===wt){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()!==A)throw new Error(r);if("string"!=typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!==R)throw new Error(r);if("string"!=typeof n)throw new Error(i)}}else if(t.getIndex()===At){if(null!=e&&!rt(e)||null!=n&&!rt(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(a.assert(t.getIndex()instanceof zt||t.getIndex()===Kt,"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 a.validateArgCount("Query.ref",0,0,arguments.length),new t.__referenceConstructor(this.repo,this.path)},t.prototype.on=function(e,n,r,i){a.validateArgCount("Query.on",2,4,arguments.length),ut("Query.on",1,e,!1),a.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 s={};s[e]=n,this.onChildEvent(s,o.cancel,o.context)}return n},t.prototype.onValueEvent=function(t,e,n){var r=new Jt(t,e||null,n||null);this.repo.addEventCallbackForQuery(this,r)},t.prototype.onChildEvent=function(t,e,n){var r=new $t(t,e,n);this.repo.addEventCallbackForQuery(this,r)},t.prototype.off=function(t,e,n){a.validateArgCount("Query.off",0,3,arguments.length),ut("Query.off",1,t,!0),a.validateCallback("Query.off",2,e,!0),a.validateContextObject("Query.off",3,n,!0);var r=null,i=null;if("value"===t){var o=e||null;r=new Jt(o,null,n||null)}else t&&(e&&((i={})[t]=e),r=new $t(i,null,n||null));this.repo.removeEventCallbackForQuery(this,r)},t.prototype.once=function(e,n,r,i){var o=this;a.validateArgCount("Query.once",1,4,arguments.length),ut("Query.once",1,e,!1),a.validateCallback("Query.once",2,n,!0);var s=t.getCancelAndContextArgs_("Query.once",r,i),u=!0,c=new a.Deferred;c.promise.catch((function(){}));var l=function(t){u&&(u=!1,o.off(e,l),n&&n.bind(s.context)(t),c.resolve(t))};return this.on(e,l,(function(t){o.off(e,l),s.cancel&&s.cancel.bind(s.context)(t),c.reject(t)})),c.promise},t.prototype.limitToFirst=function(e){if(a.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(a.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(a.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.');lt("Query.orderByChild",1,e,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");var n=new W(e);if(n.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path. Use Query.orderByValue() instead.");var r=new zt(n),i=this.queryParams_.orderBy(r);return t.validateQueryEndpoints_(i),new t(this.repo,this.path,i,!0)},t.prototype.orderByKey=function(){a.validateArgCount("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var e=this.queryParams_.orderBy(wt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByPriority=function(){a.validateArgCount("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var e=this.queryParams_.orderBy(At);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.orderByValue=function(){a.validateArgCount("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var e=this.queryParams_.orderBy(Kt);return t.validateQueryEndpoints_(e),new t(this.repo,this.path,e,!0)},t.prototype.startAt=function(e,n){void 0===e&&(e=null),a.validateArgCount("Query.startAt",0,2,arguments.length),it("Query.startAt",1,e,this.path,!0),ct("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),a.validateArgCount("Query.endAt",0,2,arguments.length),it("Query.endAt",1,e,this.path,!0),ct("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(a.validateArgCount("Query.equalTo",1,2,arguments.length),it("Query.equalTo",1,t,this.path,!1),ct("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 a.validateArgCount("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},t.prototype.toJSON=function(){return a.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=j(t);return"{}"===e?"default":e},t.prototype.isEqual=function(e){if(a.validateArgCount("Query.isEqual",1,1,arguments.length),!(e instanceof t)){var n="Query.isEqual failed: First argument must be an instance of firebase.database.Query.";throw new Error(n)}var r=this.repo===e.repo,i=this.path.equals(e.path),o=this.queryIdentifier()===e.queryIdentifier();return r&&i&&o},t.getCancelAndContextArgs_=function(t,e,n){var r={cancel:null,context:null};if(e&&n)r.cancel=e,a.validateCallback(t,3,r.cancel,!0),r.context=n,a.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(a.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:!1,configurable:!0}),t}(),te=function(){function t(t){this.node_=t}return t.prototype.getImmediateChild=function(e){return new t(this.node_.getImmediateChild(e))},t.prototype.node=function(){return this.node_},t}(),ee=function(){function t(t,e){this.syncTree_=t,this.path_=e}return t.prototype.getImmediateChild=function(e){var n=this.path_.child(e);return new t(this.syncTree_,n)},t.prototype.node=function(){return this.syncTree_.calcCompleteEventCache(this.path_)},t}(),ne=function(t,e,n){return t&&"object"==typeof t?(a.assert(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?re(t[".sv"],e,n):"object"==typeof t[".sv"]?ie(t[".sv"],e):void a.assert(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},re=function(t,e,n){switch(t){case"timestamp":return n.timestamp;default:a.assert(!1,"Unexpected server value: "+t)}},ie=function(t,e,n){t.hasOwnProperty("increment")||a.assert(!1,"Unexpected server value: "+JSON.stringify(t,null,2));var r=t.increment;"number"!=typeof r&&a.assert(!1,"Unexpected increment value: "+r);var i=e.node();if(a.assert(null!=i,"Expected ChildrenNode.EMPTY_NODE for nulls"),!i.isLeafNode())return r;var o=i.getValue();return"number"!=typeof o?r:o+r},oe=function(t,e,n,r){return se(e,new ee(n,t),r)},ae=function(t,e,n){return se(t,new te(e),n)};function se(t,e,n){var r,i=t.getPriority().val(),o=ne(i,e.getImmediateChild(".priority"),n);if(t.isLeafNode()){var a=t,s=ne(a.getValue(),e,n);return s!==a.getValue()||o!==a.getPriority().val()?new Tt(s,Ht(o)):t}var u=t;return r=u,o!==u.getPriority().val()&&(r=r.updatePriority(new Tt(o))),u.forEachChild(At,(function(t,i){var o=se(i,e.getImmediateChild(t),n);o!==i&&(r=r.updateImmediateChild(t,o))})),r}
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/var ue,ce=function(){function t(){this.value=null,this.children=new Map}return t.prototype.find=function(t){if(null!=this.value)return this.value.getChild(t);if(!t.isEmpty()&&this.children.size>0){var e=t.getFront();return t=t.popFront(),this.children.has(e)?this.children.get(e).find(t):null}return null},t.prototype.remember=function(e,n){if(e.isEmpty())this.value=n,this.children.clear();else if(null!==this.value)this.value=this.value.updateChild(e,n);else{var r=e.getFront();this.children.has(r)||this.children.set(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.clear(),!0;if(null!==this.value){if(this.value.isLeafNode())return!1;var e=this.value;this.value=null;var n=this;return e.forEachChild(At,(function(t,e){n.remember(new W(t),e)})),this.forget(t)}if(this.children.size>0){var r=t.getFront();if(t=t.popFront(),this.children.has(r))this.children.get(r).forget(t)&&this.children.delete(r);return 0===this.children.size}return!0},t.prototype.forEachTree=function(t,e){null!==this.value?e(t,this.value):this.forEachChild((function(n,r){var i=new W(t.toString()+"/"+n);r.forEachTree(i,e)}))},t.prototype.forEachChild=function(t){this.children.forEach((function(e,n){t(n,e)}))},t}();
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/!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"}(ue||(ue={}));var le,he,fe=function(){function t(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,a.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}(),pe=function(){function t(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=ue.ACK_USER_WRITE,this.source=fe.User}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return a.assert(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var n=this.affectedTree.subtree(new W(e));return new t(W.Empty,n,this.revert)}return a.assert(this.path.getFront()===e,"operationForChild called for unrelated child."),new t(this.path.popFront(),this.affectedTree,this.revert)},t}(),de=function(){function t(t,e){void 0===e&&(le||(le=new xt(D)),e=le),this.value=t,this.children=e}return t.fromObject=function(e){var n=t.Empty;return F(e,(function(t,e){n=n.set(new W(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:W.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);return null!=i?{path:new W(n).child(i.path),value:i.value}: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).set(e.popFront(),n),o=this.children.insert(r,i);return new t(this.value,o)},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).setTree(e.popFront(),n),o=void 0;return o=i.isEmpty()?this.children.remove(r):this.children.insert(r,i),new t(this.value,o)},t.prototype.fold=function(t){return this.fold_(W.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,W.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,W.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_(W.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}(),ve=function(){function t(t,e){this.source=t,this.path=e,this.type=ue.LISTEN_COMPLETE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,W.Empty):new t(this.source,this.path.popFront())},t}(),ye=function(){function t(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=ue.OVERWRITE}return t.prototype.operationForChild=function(e){return this.path.isEmpty()?new t(this.source,W.Empty,this.snap.getImmediateChild(e)):new t(this.source,this.path.popFront(),this.snap)},t}(),ge=function(){function t(t,e,n){this.source=t,this.path=e,this.children=n,this.type=ue.MERGE}return t.prototype.operationForChild=function(e){if(this.path.isEmpty()){var n=this.children.subtree(new W(e));return n.isEmpty()?null:n.value?new ye(this.source,W.Empty,n.value):new t(this.source,W.Empty,n)}return a.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}(),me=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}(),be=function(){function t(t,e){this.eventCache_=t,this.serverCache_=e}return t.prototype.updateEventSnap=function(e,n,r){return new t(new me(e,n,r),this.serverCache_)},t.prototype.updateServerSnap=function(e,n,r){return new t(this.eventCache_,new me(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 me(Qt.EMPTY_NODE,!1,!1),new me(Qt.EMPTY_NODE,!1,!1)),t}(),_e=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}(),we=function(){function t(t){this.index_=t}return t.prototype.updateChild=function(t,e,n,r,i,o){a.assert(t.isIndexed(this.index_),"A node must be indexed if only a child is updated");var s=t.getImmediateChild(e);return s.getChild(r).equals(n.getChild(r))&&s.isEmpty()===n.isEmpty()?t:(null!=o&&(n.isEmpty()?t.hasChild(e)?o.trackChildChange(_e.childRemovedChange(e,s)):a.assert(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?o.trackChildChange(_e.childAddedChange(e,n)):o.trackChildChange(_e.childChangedChange(e,n,s))),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(At,(function(t,r){e.hasChild(t)||n.trackChildChange(_e.childRemovedChange(t,r))})),e.isLeafNode()||e.forEachChild(At,(function(e,r){if(t.hasChild(e)){var i=t.getImmediateChild(e);i.equals(r)||n.trackChildChange(_e.childChangedChange(e,r,i))}else n.trackChildChange(_e.childAddedChange(e,r))}))),e.withIndex(this.index_)},t.prototype.updatePriority=function(t,e){return t.isEmpty()?Qt.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}(),Ee=function(){function t(){this.changeMap=new Map}return t.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;a.assert(e===_e.CHILD_ADDED||e===_e.CHILD_CHANGED||e===_e.CHILD_REMOVED,"Only child changes supported for tracking"),a.assert(".priority"!==n,"Only non-priority child changes can be tracked.");var r=this.changeMap.get(n);if(r){var i=r.type;if(e===_e.CHILD_ADDED&&i===_e.CHILD_REMOVED)this.changeMap.set(n,_e.childChangedChange(n,t.snapshotNode,r.snapshotNode));else if(e===_e.CHILD_REMOVED&&i===_e.CHILD_ADDED)this.changeMap.delete(n);else if(e===_e.CHILD_REMOVED&&i===_e.CHILD_CHANGED)this.changeMap.set(n,_e.childRemovedChange(n,r.oldSnap));else if(e===_e.CHILD_CHANGED&&i===_e.CHILD_ADDED)this.changeMap.set(n,_e.childAddedChange(n,t.snapshotNode));else{if(e!==_e.CHILD_CHANGED||i!==_e.CHILD_CHANGED)throw a.assertionError("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap.set(n,_e.childChangedChange(n,t.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,t)},t.prototype.getChanges=function(){return Array.from(this.changeMap.values())},t}(),Ce=new(function(){function t(){}return t.prototype.getCompleteChild=function(t){return null},t.prototype.getChildAfterChild=function(t,e,n){return null},t}()),Oe=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 me(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}(),Se=function(t,e){this.viewCache=t,this.changes=e},Ie=function(){function t(t){this.filter_=t}return t.prototype.assertIndexed=function(t){a.assert(t.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),a.assert(t.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},t.prototype.applyOperation=function(e,n,r,i){var o,s,u=new Ee;if(n.type===ue.OVERWRITE){var c=n;c.source.fromUser?o=this.applyUserOverwrite_(e,c.path,c.snap,r,i,u):(a.assert(c.source.fromServer,"Unknown source."),s=c.source.tagged||e.getServerCache().isFiltered()&&!c.path.isEmpty(),o=this.applyServerOverwrite_(e,c.path,c.snap,r,i,s,u))}else if(n.type===ue.MERGE){var l=n;l.source.fromUser?o=this.applyUserMerge_(e,l.path,l.children,r,i,u):(a.assert(l.source.fromServer,"Unknown source."),s=l.source.tagged||e.getServerCache().isFiltered(),o=this.applyServerMerge_(e,l.path,l.children,r,i,s,u))}else if(n.type===ue.ACK_USER_WRITE){var h=n;o=h.revert?this.revertUserWrite_(e,h.path,r,i,u):this.ackUserWrite_(e,h.path,h.affectedTree,r,i,u)}else{if(n.type!==ue.LISTEN_COMPLETE)throw a.assertionError("Unknown operation type: "+n.type);o=this.listenComplete_(e,n.path,r,u)}var f=u.getChanges();return t.maybeAddValueEvent_(e,o,f),new Se(o,f)},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(_e.valueChange(e.getCompleteEventSnap()))}},t.prototype.generateEventCacheAfterServerEvent_=function(t,e,n,r,i){var o=t.getEventCache();if(null!=n.shadowingWrite(e))return t;var s=void 0,u=void 0;if(e.isEmpty())if(a.assert(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()){var c=t.getCompleteServerSnap(),l=c instanceof Qt?c:Qt.EMPTY_NODE,h=n.calcCompleteEventChildren(l);s=this.filter_.updateFullNode(t.getEventCache().getNode(),h,i)}else{var f=n.calcCompleteEventCache(t.getCompleteServerSnap());s=this.filter_.updateFullNode(t.getEventCache().getNode(),f,i)}else{var p=e.getFront();if(".priority"===p){a.assert(1===e.getLength(),"Can't have a priority with additional path components");var d=o.getNode();u=t.getServerCache().getNode();var v=n.calcEventCacheAfterServerOverwrite(e,d,u);s=null!=v?this.filter_.updatePriority(d,v):o.getNode()}else{var y=e.popFront(),g=void 0;if(o.isCompleteForChild(p)){u=t.getServerCache().getNode();var m=n.calcEventCacheAfterServerOverwrite(e,o.getNode(),u);g=null!=m?o.getNode().getImmediateChild(p).updateChild(y,m):o.getNode().getImmediateChild(p)}else g=n.calcCompleteChild(p,t.getServerCache());s=null!=g?this.filter_.updateChild(o.getNode(),p,g,y,r,i):o.getNode()}}return t.updateEventSnap(s,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).updateChild(f,n);s=".priority"===h?c.updatePriority(u.getNode(),p):c.updateChild(u.getNode(),h,p,f,Ce,null)}var d=t.updateServerSnap(s,u.isFullyInitialized()||e.isEmpty(),c.filtersNodes()),v=new Oe(r,d,i);return this.generateEventCacheAfterServerEvent_(d,e,r,v,a)},t.prototype.applyUserOverwrite_=function(t,e,n,r,i,o){var a,s,u=t.getEventCache(),c=new Oe(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):Qt.EMPTY_NODE}if(f.equals(p))a=t;else{var v=this.filter_.updateChild(u.getNode(),l,p,h,c,o);a=t.updateEventSnap(v,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:de.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 W(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 W(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=de.Empty;return s.getNode().forEachChild(wt,(function(t,e){u=u.set(new W(t),e)})),this.applyServerMerge_(t,e,u,r,i,a,o)}return t}var c=de.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,Ce,r)},t.prototype.revertUserWrite_=function(t,e,n,r,i){var o;if(null!=n.shadowingWrite(e))return t;var s=new Oe(n,t,r),u=t.getEventCache().getNode(),c=void 0;if(e.isEmpty()||".priority"===e.getFront()){var l=void 0;if(t.getServerCache().isFullyInitialized())l=n.calcCompleteEventCache(t.getCompleteServerSnap());else{var h=t.getServerCache().getNode();a.assert(h instanceof Qt,"serverChildren would be complete if leaf node"),l=n.calcCompleteEventChildren(h)}l=l,c=this.filter_.updateFullNode(u,l,i)}else{var f=e.getFront(),p=n.calcCompleteChild(f,t.getServerCache());null==p&&t.getServerCache().isCompleteForChild(f)&&(p=u.getImmediateChild(f)),(c=null!=p?this.filter_.updateChild(u,f,p,e.popFront(),s,i):t.getEventCache().getNode().hasChild(f)?this.filter_.updateChild(u,f,Qt.EMPTY_NODE,e.popFront(),s,i):u).isEmpty()&&t.getServerCache().isFullyInitialized()&&(o=n.calcCompleteEventCache(t.getCompleteServerSnap())).isLeafNode()&&(c=this.filter_.updateFullNode(c,o,i))}return o=t.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(W.Empty),t.updateEventSnap(c,o,this.filter_.filtersNodes())},t}(),Te=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===_e.CHILD_CHANGED&&r.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&&o.push(_e.childMovedChange(t.childName,t.snapshotNode))})),this.generateEventsForType_(i,_e.CHILD_REMOVED,t,n,e),this.generateEventsForType_(i,_e.CHILD_ADDED,t,n,e),this.generateEventsForType_(i,_e.CHILD_MOVED,o,n,e),this.generateEventsForType_(i,_e.CHILD_CHANGED,t,n,e),this.generateEventsForType_(i,_e.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.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.index_)),t},t.prototype.compareChanges_=function(t,e){if(null==t.childName||null==e.childName)throw a.assertionError("Should only compare child_ events.");var n=new mt(t.childName,t.snapshotNode),r=new mt(e.childName,e.snapshotNode);return this.index_.compare(n,r)},t}(),ke=function(){function t(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new we(n.getIndex()),i=n.getNodeFilter();this.processor_=new Ie(i);var o=e.getServerCache(),a=e.getEventCache(),s=r.updateFullNode(Qt.EMPTY_NODE,o.getNode(),null),u=i.updateFullNode(Qt.EMPTY_NODE,a.getNode(),null),c=new me(s,o.isFullyInitialized(),r.filtersNodes()),l=new me(u,a.isFullyInitialized(),i.filtersNodes());this.viewCache_=new be(l,c),this.eventGenerator_=new Te(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){a.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;othis.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){a.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=0,"removeWrite called with nonexistent writeId.");var r=this.allWrites_[n];this.allWrites_.splice(n,1);for(var i=r.visible,o=!1,s=this.allWrites_.length-1;i&&s>=0;){var u=this.allWrites_[s];u.visible&&(s>=n&&this.recordContainsPath_(u,r.path)?i=!1:r.path.contains(u.path)&&(o=!0)),s--}if(i){if(o)return this.resetTree_(),!0;r.snap?this.visibleWrites_=this.visibleWrites_.removeWrite(r.path):F(r.children,(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(W.Empty)){var a=t.layerTree_(this.allWrites_,(function(t){return(t.visible||i)&&(!r||!~r.indexOf(t.writeId))&&(t.path.contains(e)||e.contains(t.path))}),e);c=n||Qt.EMPTY_NODE;return a.apply(c)}return null}var s=this.visibleWrites_.getCompleteNode(e);if(null!=s)return s;var u=this.visibleWrites_.childCompoundWrite(e);if(u.isEmpty())return n;if(null!=n||u.hasCompleteWrite(W.Empty)){var c=n||Qt.EMPTY_NODE;return u.apply(c)}return null},t.prototype.calcCompleteEventChildren=function(t,e){var n=Qt.EMPTY_NODE,r=this.visibleWrites_.getCompleteNode(t);if(r)return r.isLeafNode()||r.forEachChild(At,(function(t,e){n=n.updateImmediateChild(t,e)})),n;if(e){var i=this.visibleWrites_.childCompoundWrite(t);return e.forEachChild(At,(function(t,e){var r=i.childCompoundWrite(new W(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){a.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);return null!=i?i:n.isCompleteForChild(e)?this.visibleWrites_.childCompoundWrite(r).apply(n.getNode().getImmediateChild(e)):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(W.Empty);if(null!=u)a=u;else{if(null==e)return[];a=s.apply(e)}if((a=a.withIndex(o)).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.length0?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=Ae.Empty,i=0;i0&&!r)if(l){this.listenProvider_.stopListening(t.queryForListening_(e),null)}else c.forEach((function(e){var n=i.queryToTagMap.get(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=W.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()),F(n,(function(t,e){r=r.concat(e)})),r}))},t.prototype.removeTags_=function(e){for(var n=0;n0&&a.contains(t.statsToReport_,e)&&(n[e]=i,r=!0)})),r&&this.server_.reportStats(n),Q(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},t}(),qe=function(){function t(){this.eventLists_=[],this.recursionDepth_=0}return t.prototype.queueEvents=function(t){for(var e=null,n=0;n0,"Requires a non-empty array")}return t.prototype.trigger=function(t){for(var e=[],n=1;ndocument.domain="'+document.domain+'";<\/script>';var s=""+o+"";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(s),this.myIFrame.doc.close()}catch(t){O("frame writing exception"),t.stack&&O(t.stack),O(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||O("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 t=this;this.alive=!1,this.myIFrame&&(this.myIFrame.doc.body.innerHTML="",setTimeout((function(){null!==t.myIFrame&&(document.body.removeChild(t.myIFrame),t.myIFrame=null)}),Math.floor(0)));var e=this.onDisconnect;e&&(this.onDisconnect=null,e())},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.size<(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);var r=function(){n.outstandingRequests.delete(e),n.newRequest_()},i=setTimeout(r,Math.floor(25e3));this.addTag(t,(function(){clearTimeout(i),r()}))},t.prototype.addTag=function(t,e){var n=this;a.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(){O("Long-poll script failed to load: "+t),n.sendNewPolls=!1,n.close()},n.myIFrame.doc.body.appendChild(r)}catch(t){}}),Math.floor(1))},t}(),ze="";
/**
* @license
* Copyright 2017 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
var Ge=null;"undefined"!=typeof MozWebSocket?Ge=MozWebSocket:"undefined"!=typeof WebSocket&&(Ge=WebSocket);var Ye=function(){function t(e,n,r,i,o){this.connId=e,this.applicationId=r,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=S(this.connId),this.stats_=Le.getCollection(n),this.connURL=t.connectionURL_(n,i,o),this.nodeAdmin=n.nodeAdmin}return t.connectionURL_=function(t,e,n){var r={v:"5"};return!a.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,v.set("previous_websocket_failure",!0);try{if(a.isNodeSdk()){var i=this.nodeAdmin?"AdminNode":"Node",o={headers:{"User-Agent":"Firebase/5/"+ze+"/"+r.platform+"/"+i,"X-Firebase-GMPID":this.applicationId||""}},s=Object({NODE_ENV:"production"}),u=0===this.connURL.indexOf("wss://")?s.HTTPS_PROXY||s.https_proxy:s.HTTP_PROXY||s.http_proxy;u&&(o.proxy={origin:u}),this.mySock=new Ge(this.connURL,[],o)}else{o={headers:{"X-Firebase-GMPID":this.applicationId||""}};this.mySock=new Ge(this.connURL,[],o)}}catch(t){this.log_("Error instantiating WebSocket.");var c=t.message||t.data;return c&&this.log_(c),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=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/);n&&n.length>1&&parseFloat(n[1])<4.4&&(e=!0)}return!e&&null!==Ge&&!t.forceDisallow_},t.previouslyFailed=function(){return v.isInMemoryStorage||!0===v.get("previous_websocket_failure")},t.prototype.markConnectionHealthy=function(){v.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=a.jsonEval(e);this.onMessage(n)}},t.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},t.prototype.extractFrameCount_=function(t){if(a.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=a.stringify(t);this.bytesSent+=e.length,this.stats_.incrementCounter("bytes_sent",e.length);var n=L(e,16384);n.length>1&&this.sendString_(String(n.length));for(var r=0;r0)return this.transports_[0];throw new Error("No transports available")},t.prototype.upgradeTransport=function(){return this.transports_.length>1?this.transports_[1]:null},t}(),Je=function(){function t(t,e,n,r,i,o,a,s){this.id=t,this.repoInfo_=e,this.applicationId_=n,this.onMessage_=r,this.onReady_=i,this.onDisconnect_=o,this.onKill_=a,this.lastSessionId=s,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=S("c:"+this.id+":"),this.transportManager_=new Xe(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_,this.applicationId_,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_=Q((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=x("t",t),n=x("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=x("t",t),n=x("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_--,this.primaryResponsesRequired_<=0&&(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},t.prototype.onControl_=function(t){var e=x("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;r3e4&&(this.reconnectDelay_=1e3),this.lastConnectionEstablishedTime_=null}}else this.log_("Window isn't visible. Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime();var t=(new Date).getTime()-this.lastConnectionAttemptTime_,e=Math.max(0,this.reconnectDelay_-t);e=Math.random()*e,this.log_("Trying to reconnect in "+e+"ms"),this.scheduleConnect_(e),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)}this.onConnectStatus_(!1)},e.prototype.establishConnection_=function(){var t=this;if(this.shouldReconnect_()){this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null;var n=this.onDataMessage_.bind(this),r=this.onReady_.bind(this),i=this.onRealtimeDisconnect_.bind(this),o=this.id+":"+e.nextConnectionId_++,s=this,u=this.lastSessionId,c=!1,l=null,h=function(){l?l.close():(c=!0,i())};this.realtime_={close:h,sendRequest:function(t){a.assert(l,"sendRequest call when we're not connected not allowed."),l.sendRequest(t)}};var f=this.forceTokenRefresh_;this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(f).then((function(t){c?O("getToken() completed but was canceled"):(O("getToken() completed. Creating connection."),s.authToken_=t&&t.accessToken,l=new Je(o,s.repoInfo_,s.applicationId_,n,r,i,(function(t){k(t+" ("+s.repoInfo_.toString()+")"),s.interrupt("server_kill")}),u))})).then(null,(function(e){s.log_("Failed to get token: "+e),c||(t.repoInfo_.nodeAdmin&&k(e),h())}))}},e.prototype.interrupt=function(t){O("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){O("Resuming connection for reason: "+t),delete this.interruptReasons_[t],a.isEmpty(this.interruptReasons_)&&(this.reconnectDelay_=1e3,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=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,e,n,r;this.tryAuth();try{for(var i=o.__values(this.listens.values()),a=i.next();!a.done;a=i.next()){var s=a.value;try{for(var u=(n=void 0,o.__values(s.values())),c=u.next();!c.done;c=u.next()){var l=c.value;this.sendListen_(l)}}catch(t){n={error:t}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=i.return)&&e.call(i)}finally{if(t)throw t.error}}for(var h=0;h=200&&u.status<300){try{t=a.jsonEval(u.responseText)}catch(t){k("Failed to parse JSON response for "+s+": "+u.responseText)}n(null,t)}else 401!==u.status&&404!==u.status&&k("Got unsuccessful REST response for "+s+" Status: "+u.status),n(u.status);n=null}},u.open("GET",s,!0),u.send()}))},e}($e),en=function(){function t(t,e,n,r){var i=this;if(this.repoInfo_=t,this.app=n,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new qe,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new ce,this.persistentConnection_=null,this.stats_=Le.getCollection(t),e||("object"==typeof window&&window.navigator&&window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i)>=0)this.server_=new tn(this.repoInfo_,this.onDataUpdate_.bind(this),r),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var o=n.options.databaseAuthVariableOverride;if(null!=o){if("object"!=typeof o)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{a.stringify(o)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}this.persistentConnection_=new Ze(this.repoInfo_,n.options.appId,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),r,o),this.server_=this.persistentConnection_}r.addTokenChangeListener((function(t){i.server_.refreshAuthToken(t)})),this.statsReporter_=Le.getOrCreateReporter(t,(function(){return new Me(i.stats_,i.server_)})),this.transactionsInit_(),this.infoData_=new xe,this.infoSyncTree_=new De({startListening:function(t,e,n,r){var o=[],a=i.infoData_.getNode(t.path);return a.isEmpty()||(o=i.infoSyncTree_.applyServerOverwrite(t.path,a),setTimeout((function(){r("ok")}),0)),o},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new De({startListening:function(t,e,n,r){return i.server_.listen(t,n,e,(function(e,n){var o=r(e,n);i.eventQueue_.raiseEventsForChangedPath(t.path,o)})),[]},stopListening:function(t,e){i.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 W(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t},t.prototype.generateServerValues=function(){return(t=(t={timestamp:this.serverTime()})||{}).timestamp=t.timestamp||(new Date).getTime(),t;var t},t.prototype.onDataUpdate_=function(t,e,n,r){this.dataUpdateCount++;var i=new W(t);e=this.interceptServerDataCallback_?this.interceptServerDataCallback_(t,e):e;var o=[];if(r)if(n){var s=a.map(e,(function(t){return Ht(t)}));o=this.serverSyncTree_.applyTaggedQueryMerge(i,s,r)}else{var u=Ht(e);o=this.serverSyncTree_.applyTaggedQueryOverwrite(i,u,r)}else if(n){var c=a.map(e,(function(t){return Ht(t)}));o=this.serverSyncTree_.applyServerMerge(i,c)}else{var l=Ht(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;F(t,(function(t,n){e.updateInfo_(t,n)}))},t.prototype.updateInfo_=function(t,e){var n=new W("/.info/"+t),r=Ht(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=Ht(e,n),s=this.serverSyncTree_.calcCompleteEventCache(t),u=ae(a,s,o),c=this.getNextWriteId_(),l=this.serverSyncTree_.applyUserOverwrite(t,u,c,!0);this.eventQueue_.queueEvents(l),this.server_.put(t.toString(),a.val(!0),(function(e,n){var o="ok"===e;o||k("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(F(e,(function(e,n){i=!1,a[e]=oe(t.child(e),Ht(n),r.serverSyncTree_,o)})),i)O("update() called with empty data. Don't do anything."),this.callOnCompleteCallback(n,"ok");else{var s=this.getNextWriteId_(),u=this.serverSyncTree_.applyUserMerge(t,a,s);this.eventQueue_.queueEvents(u),this.server_.merge(t.toString(),e,(function(e,i){var o="ok"===e;o||k("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)})),F(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=new ce;this.onDisconnect_.forEachTree(W.Empty,(function(r,i){var o=oe(r,i,t.serverSyncTree_,e);n.remember(r,o)}));var r=[];n.forEachTree(W.Empty,(function(e,n){r=r.concat(t.serverSyncTree_.applyServerOverwrite(e,n));var i=t.abortTransactions_(e);t.rerunTransactions_(i)})),this.onDisconnect_=new ce,this.eventQueue_.raiseEventsForChangedPath(W.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=Ht(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=Ht(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(a.isEmpty(e))return O("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&&F(e,(function(e,n){var i=Ht(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 Fe(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);F(e,(function(t,e){for(var r=t,i=t.length;i=0)return null!=i&&i.trackChildChange(_e.childChangedChange(e,n,f)),u.updateImmediateChild(e,n);null!=i&&i.trackChildChange(_e.childRemovedChange(e,f));var v=u.updateImmediateChild(e,Qt.EMPTY_NODE);return null!=p&&this.rangedFilter_.matches(p)?(null!=i&&i.trackChildChange(_e.childAddedChange(p.name,p.node)),v.updateImmediateChild(p.name,p.node)):v}return n.isEmpty()?t:h&&o(l,c)>=0?(null!=i&&(i.trackChildChange(_e.childRemovedChange(l.name,l.node)),i.trackChildChange(_e.childAddedChange(e,n))),u.updateImmediateChild(e,n).updateImmediateChild(l.name,Qt.EMPTY_NODE)):t},t}(),on=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_=At}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 a.assert(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},t.prototype.getIndexStartName=function(){return a.assert(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:A},t.prototype.hasEnd=function(){return this.endSet_},t.prototype.getIndexEndValue=function(){return a.assert(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},t.prototype.getIndexEndName=function(){return a.assert(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:R},t.prototype.hasLimit=function(){return this.limitSet_},t.prototype.hasAnchoredLimit=function(){return this.limitSet_&&""!==this.viewFrom_},t.prototype.getLimit=function(){return a.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_!==At&&(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_===At},t.prototype.getNodeFilter=function(){return this.loadsAllData()?new we(this.getIndex()):this.hasLimit()?new rn(this):new nn(this)},t.prototype.toRestQueryStringParameters=function(){var e,n=t.REST_QUERY_CONSTANTS_,r={};return this.isDefault()||(this.index_===At?e=n.PRIORITY_INDEX:this.index_===Kt?e=n.VALUE_INDEX:this.index_===wt?e=n.KEY_INDEX:(a.assert(this.index_ instanceof zt,"Unrecognized index type!"),e=this.index_.toString()),r[n.ORDER_BY]=a.stringify(e),this.startSet_&&(r[n.START_AT]=a.stringify(this.indexStartValue_),this.startNameSet_&&(r[n.START_AT]+=","+a.stringify(this.indexStartName_))),this.endSet_&&(r[n.END_AT]=a.stringify(this.indexEndValue_),this.endNameSet_&&(r[n.END_AT]+=","+a.stringify(this.indexEndName_))),this.limitSet_&&(this.isViewFromLeft()?r[n.LIMIT_TO_FIRST]=this.limit_:r[n.LIMIT_TO_LAST]=this.limit_)),r},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}(),an=function(t){function e(e,n){if(!(e instanceof en))throw new Error("new Reference() no longer supported - use app.database().");return t.call(this,e,n,on.DEFAULT,!1)||this}return o.__extends(e,t),e.prototype.getKey=function(){return a.validateArgCount("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},e.prototype.child=function(t){return a.validateArgCount("Reference.child",1,1,arguments.length),"number"==typeof t?t=String(t):t instanceof W||(null===this.path.getFront()?ht("Reference.child",1,t,!1):lt("Reference.child",1,t,!1)),new e(this.repo,this.path.child(t))},e.prototype.getParent=function(){a.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(){a.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){a.validateArgCount("Reference.set",1,2,arguments.length),ft("Reference.set",this.path),it("Reference.set",1,t,this.path,!1),a.validateCallback("Reference.set",2,e,!0);var n=new a.Deferred;return this.repo.setWithPriority(this.path,t,null,n.wrapCallback(e)),n.promise},e.prototype.update=function(t,e){if(a.validateArgCount("Reference.update",1,2,arguments.length),ft("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r0},t.prototype.isEmpty=function(){return null===this.getValue()&&!this.hasChildren()},t.prototype.forEachChild=function(e){var n=this;F(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 W(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=a.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"}(sn||(sn={})),en.MAX_TRANSACTION_RETRIES_=25,en.prototype.transactionsInit_=function(){this.transactionQueueTree_=new cn},en.prototype.startTransaction=function(t,e,n,r){this.log_("transaction on "+t);var i=function(){},o=new an(this,t);o.on("value",i);var s={path:t,update:e,onComplete:n,status:null,order:m(),applyLocally:r,retryCount:0,unwatcher:function(){o.off("value",i)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},u=this.getLatestState_(t);s.currentInputSnapshot=u;var c=s.update(u.val());if(void 0===c){if(s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete){var l=new Gt(s.currentInputSnapshot,new an(this,s.path),At);s.onComplete(null,!1,l)}}else{ot("transaction failed: Data returned ",c,s.path),s.status=sn.RUN;var h=this.transactionQueueTree_.subTree(t),f=h.getValue()||[];f.push(s),h.setValue(f);var p=void 0;if("object"==typeof c&&null!==c&&a.contains(c,".priority"))p=a.safeGet(c,".priority"),a.assert(rt(p),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.");else p=(this.serverSyncTree_.calcCompleteEventCache(t)||Qt.EMPTY_NODE).getPriority().val();p=p;var d=this.generateServerValues(),v=Ht(c,p),y=ae(v,u,d);s.currentOutputSnapshotRaw=v,s.currentOutputSnapshotResolved=y,s.currentWriteId=this.getNextWriteId_();var g=this.serverSyncTree_.applyUserOverwrite(t,y,s.currentWriteId,s.applyLocally);this.eventQueue_.raiseEventsForChangedPath(t,g),this.sendReadyTransactions_()}},en.prototype.getLatestState_=function(t,e){return this.serverSyncTree_.calcCompleteEventCache(t,e)||Qt.EMPTY_NODE},en.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);a.assert(n.length>0,"Sending zero length transaction queue"),n.every((function(t){return t.status===sn.RUN}))&&this.sendTransactionQueue_(t.path(),n)}else t.hasChildren()&&t.forEachChild((function(t){e.sendReadyTransactions_(t)}))},en.prototype.sendTransactionQueue_=function(t,e){for(var n=this,r=e.map((function(t){return t.currentWriteId})),i=this.getLatestState_(t,r),o=i,s=i.hash(),u=0;u=en.MAX_TRANSACTION_RETRIES_)l=!0,h="maxretry",i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0));else{var f=this.getLatestState_(u.path,o);u.currentInputSnapshot=f;var p=t[s].update(f.val());if(void 0!==p){ot("transaction failed: Data returned ",p,u.path);var d=Ht(p);"object"==typeof p&&null!=p&&a.contains(p,".priority")||(d=d.updatePriority(f.getPriority()));var v=u.currentWriteId,y=this.generateServerValues(),g=ae(d,f,y);u.currentOutputSnapshotRaw=d,u.currentOutputSnapshotResolved=g,u.currentWriteId=this.getNextWriteId_(),o.splice(o.indexOf(v),1),i=(i=i.concat(this.serverSyncTree_.applyUserOverwrite(u.path,g,u.currentWriteId,u.applyLocally))).concat(this.serverSyncTree_.ackUserWrite(v,!0))}else l=!0,h="nodata",i=i.concat(this.serverSyncTree_.ackUserWrite(u.currentWriteId,!0))}if(this.eventQueue_.raiseEventsForChangedPath(e,i),i=[],l&&(t[s].status=sn.COMPLETED,n=t[s].unwatcher,setTimeout(n,Math.floor(0)),t[s].onComplete))if("nodata"===h){var m=new an(this,t[s].path),b=t[s].currentInputSnapshot,_=new Gt(b,m,At);r.push(t[s].onComplete.bind(null,null,!1,_))}else r.push(t[s].onComplete.bind(null,new Error(h),!1,null))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(s=0;s0?n:null)}t.forEachChild((function(t){e.pruneCompletedTransactionsBelowNode_(t)}))},en.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},en.prototype.abortTransactionsOnNode_=function(t){var e=t.getValue();if(null!==e){for(var n=[],r=[],i=-1,o=0;oo?e:(o=e.indexOf("#"),-1!==o&&i>o?e:"javascript:void(0)")}var o=n(0),a=n.n(o),s=n(3713),u=n(3715),c=n(1794),l=n(3712),h=n(20),f=n.n(h),p=n(1120),d=n(1123);function v(t){if(t.allowedElements&&t.disallowedElements)throw new TypeError("Only one of `allowedElements` and `disallowedElements` should be defined");if(t.allowedElements||t.disallowedElements||t.allowElement)return e=>{Object(d.a)(e,"element",(e,n,r)=>{const i=r;let o;if(t.allowedElements?o=!t.allowedElements.includes(e.tagName):t.disallowedElements&&(o=t.disallowedElements.includes(e.tagName)),!o&&t.allowElement&&"number"==typeof n&&(o=!t.allowElement(e,n,i)),o&&"number"==typeof n)return t.unwrapDisallowed&&e.children?i.children.splice(n,1,...e.children):i.children.splice(n,1),n})}}var y=n(850),g=n.n(y),m=n(1776),b=n(1570),_=n(1571),w=n(1778),E=n(1777),C=n(1775),O=n.n(C);const S={}.hasOwnProperty,I=new Set(["table","thead","tbody","tfoot","tr"]);function T(t,e){const n=[];let r,i=-1;for(;++iString(t)).join("")),!v&&i.rawSourcePos&&(u.sourcePosition=e.position),!v&&i.includeElementIndex&&(u.index=N(r,e),u.siblingCount=N(r)),v||(u.node=e),h.length>0?a.a.createElement(d,u,h):a.a.createElement(d,u)}function N(t,e){let n=-1,r=0;for(;++n for more info)`),delete D[e]}const e=Object(u.a)().use(c.a).use(t.remarkPlugins||[]).use(l.a,{...t.remarkRehypeOptions,allowDangerousHtml:!0}).use(t.rehypePlugins||[]).use(v,t),n=new s.a;"string"==typeof t.children?n.value=t.children:void 0!==t.children&&null!==t.children&&console.warn(`[react-markdown] Warning: please pass a string as \`children\` (not: \`${t.children}\`)`);const r=e.runSync(e.parse(n),n);if("root"!==r.type)throw new TypeError("Expected a `root` node");let i=a.a.createElement(a.a.Fragment,{},T({options:t,schema:p.a,listDepth:0},r));return t.className&&(i=a.a.createElement("div",{className:t.className},i)),i}x.defaultProps={transformLinkUri:i},x.propTypes={children:f.a.string,className:f.a.string,allowElement:f.a.func,allowedElements:f.a.arrayOf(f.a.string),disallowedElements:f.a.arrayOf(f.a.string),unwrapDisallowed:f.a.bool,remarkPlugins:f.a.arrayOf(f.a.oneOfType([f.a.object,f.a.func,f.a.arrayOf(f.a.oneOfType([f.a.object,f.a.func]))])),rehypePlugins:f.a.arrayOf(f.a.oneOfType([f.a.object,f.a.func,f.a.arrayOf(f.a.oneOfType([f.a.object,f.a.func]))])),sourcePos:f.a.bool,rawSourcePos:f.a.bool,skipHtml:f.a.bool,includeElementIndex:f.a.bool,transformLinkUri:f.a.oneOfType([f.a.func,f.a.bool]),linkTarget:f.a.oneOfType([f.a.func,f.a.string]),transformImageUri:f.a.func,components:f.a.object}},373:function(t,e,n){"use strict";n.d(e,"a",(function(){return c})),n.d(e,"d",(function(){return s})),n.d(e,"c",(function(){return u})),n.d(e,"b",(function(){return l}));var r=n(0),i=n.n(r),o=n(59),a="function"==typeof Symbol&&Symbol.for?Symbol.for("__APOLLO_CONTEXT__"):"__APOLLO_CONTEXT__";function s(){Object.defineProperty(i.a,a,{value:i.a.createContext({}),enumerable:!1,configurable:!0,writable:!1})}function u(){return i.a[a]||s(),i.a[a]}var c=function(t){var e=u();return i.a.createElement(e.Consumer,null,(function(e){return Object(o.b)(e&&e.client,27),t.children(e.client)}))},l=function(t){var e=t.client,n=t.children,r=u();return i.a.createElement(r.Consumer,null,(function(t){return void 0===t&&(t={}),e&&t.client!==e&&(t=Object.assign({},t,{client:e})),Object(o.b)(t.client,28),i.a.createElement(r.Provider,{value:t},n)}))}},375:function(t,e,n){"use strict";n.d(e,"a",(function(){return r})),n.d(e,"b",(function(){return a})),n.d(e,"c",(function(){return s}));var r,i=n(59);!function(t){t[t.Query=0]="Query",t[t.Mutation=1]="Mutation",t[t.Subscription=2]="Subscription"}(r||(r={}));var o=new Map;function a(t){var e;switch(t){case r.Query:e="Query";break;case r.Mutation:e="Mutation";break;case r.Subscription:e="Subscription"}return e}function s(t){var e,n,a=o.get(t);if(a)return a;Object(i.b)(!!t&&!!t.kind,34);var s=t.definitions.filter((function(t){return"FragmentDefinition"===t.kind})),u=t.definitions.filter((function(t){return"OperationDefinition"===t.kind&&"query"===t.operation})),c=t.definitions.filter((function(t){return"OperationDefinition"===t.kind&&"mutation"===t.operation})),l=t.definitions.filter((function(t){return"OperationDefinition"===t.kind&&"subscription"===t.operation}));Object(i.b)(!s.length||u.length||c.length||l.length,35),Object(i.b)(u.length+c.length+l.length<=1,36),n=u.length?r.Query:r.Mutation,u.length||c.length||(n=r.Subscription);var h=u.length?u:c.length?c:l;Object(i.b)(1===h.length,37);var f=h[0];e=f.variableDefinitions||[];var p={name:f.name&&"Name"===f.name.kind?f.name.value:"data",type:n,variables:e};return o.set(t,p),p}},398:function(t,e,n){"use strict";n.d(e,"a",(function(){return l}));var r=n(4),i=n(59),o=n(33),a=n(321);function s(t,e){return e?e(t):o.c.of()}function u(t){return"function"==typeof t?new l(t):t}function c(t){return t.request.length<=1}!function(t){function e(e,n){var r=t.call(this,e)||this;return r.link=n,r}Object(r.__extends)(e,t)}(Error);var l=function(){function t(t){t&&(this.request=t)}return t.empty=function(){return new t((function(){return o.c.of()}))},t.from=function(e){return 0===e.length?t.empty():e.map(u).reduce((function(t,e){return t.concat(e)}))},t.split=function(e,n,r){var i=u(n),a=u(r||new t(s));return c(i)&&c(a)?new t((function(t){return e(t)?i.request(t)||o.c.of():a.request(t)||o.c.of()})):new t((function(t,n){return e(t)?i.request(t,n)||o.c.of():a.request(t,n)||o.c.of()}))},t.execute=function(t,e){return t.request(Object(a.a)(e.context,Object(a.f)(Object(a.g)(e))))||o.c.of()},t.concat=function(e,n){var r=u(e);if(c(r))return r;var i=u(n);return c(i)?new t((function(t){return r.request(t,(function(t){return i.request(t)||o.c.of()}))||o.c.of()})):new t((function(t,e){return r.request(t,(function(t){return i.request(t,e)||o.c.of()}))||o.c.of()}))},t.prototype.split=function(e,n,r){return this.concat(t.split(e,n,r||new t(s)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(t,e){throw new i.a(21)},t.prototype.onError=function(t){throw t},t.prototype.setOnError=function(t){return this.onError=t,this},t}()},401:function(t,e,n){"use strict";n.r(e);var r=n(1348);n.d(e,"empty",(function(){return r.a}));var i=n(1351);n.d(e,"from",(function(){return i.a}));var o=n(1352);n.d(e,"split",(function(){return o.a}));var a=n(1353);n.d(e,"concat",(function(){return a.a}));var s=n(1354);n.d(e,"execute",(function(){return s.a}));var u=n(398);n.d(e,"ApolloLink",(function(){return u.a}));var c=n(1355);for(var l in c)["default","empty","from","split","concat","execute","ApolloLink"].indexOf(l)<0&&function(t){n.d(e,t,(function(){return c[t]}))}(l)},481:function(t,e,n){"use strict";var r=n(1021);n.d(e,"ApolloCache",(function(){return r.a}));var i=n(1357);n.d(e,"Cache",(function(){return i.a}));var o=n(1022);n.d(e,"MissingFieldError",(function(){return o.a}));n(33);var a=n(1750);n.d(e,"InMemoryCache",(function(){return a.a}));var s=n(596);n.d(e,"makeVar",(function(){return s.b})),n.d(e,"cacheSlot",(function(){return s.a}));var u=n(826);n.d(e,"defaultDataIdFromObject",(function(){return u.b}));n(864)},596:function(t,e,n){"use strict";n.d(e,"a",(function(){return a})),n.d(e,"b",(function(){return u}));var r=n(482),i=n(307),o=Object(i.b)(),a=new r.a;function s(t,e){var n=[];t.forEach((function(t){return n.push(t)})),t.clear(),n.forEach(e)}function u(t){var e=new Set,n=new Set,r=function(i){if(arguments.length>0)t!==i&&(t=i,o.dirty(r),e.forEach(c),s(n,(function(e){return e(t)})));else{var u=a.getValue();u&&e.add(u),o(r)}return t};return r.onNextChange=function(t){return n.add(t),function(){n.delete(t)}},r}function c(t){t.broadcastWatches&&t.broadcastWatches()}},600:function(t,e,n){"use strict";n.r(e),n.d(e,"resetCaches",(function(){return g})),n.d(e,"disableFragmentWarnings",(function(){return m})),n.d(e,"enableExperimentalFragmentVariables",(function(){return b})),n.d(e,"disableExperimentalFragmentVariables",(function(){return _}));var r=n(1748);n.d(e,"ApolloClient",(function(){return r.a}));var i=n(1044);n.d(e,"ObservableQuery",(function(){return i.a}));var o=n(168);n.d(e,"NetworkStatus",(function(){return o.a}));var a=n(1358);for(var s in a)["default","ApolloClient","ObservableQuery","NetworkStatus","isApolloError","ApolloError","Cache","ApolloCache","InMemoryCache","MissingFieldError","defaultDataIdFromObject","makeVar","fromError","toPromise","fromPromise","throwServerError","Observable","isReference","makeReference","resetCaches","disableFragmentWarnings","enableExperimentalFragmentVariables","disableExperimentalFragmentVariables","gql"].indexOf(s)<0&&function(t){n.d(e,t,(function(){return a[t]}))}(s);var u=n(328);n.d(e,"isApolloError",(function(){return u.b})),n.d(e,"ApolloError",(function(){return u.a}));var c=n(481);n.d(e,"Cache",(function(){return c.Cache})),n.d(e,"ApolloCache",(function(){return c.ApolloCache})),n.d(e,"InMemoryCache",(function(){return c.InMemoryCache})),n.d(e,"MissingFieldError",(function(){return c.MissingFieldError})),n.d(e,"defaultDataIdFromObject",(function(){return c.defaultDataIdFromObject})),n.d(e,"makeVar",(function(){return c.makeVar}));var l=n(864);for(var s in l)["default","ApolloClient","ObservableQuery","NetworkStatus","isApolloError","ApolloError","Cache","ApolloCache","InMemoryCache","MissingFieldError","defaultDataIdFromObject","makeVar","fromError","toPromise","fromPromise","throwServerError","Observable","isReference","makeReference","resetCaches","disableFragmentWarnings","enableExperimentalFragmentVariables","disableExperimentalFragmentVariables","gql"].indexOf(s)<0&&function(t){n.d(e,t,(function(){return l[t]}))}(s);var h=n(401);for(var s in h)["default","ApolloClient","ObservableQuery","NetworkStatus","isApolloError","ApolloError","Cache","ApolloCache","InMemoryCache","MissingFieldError","defaultDataIdFromObject","makeVar","fromError","toPromise","fromPromise","throwServerError","Observable","isReference","makeReference","resetCaches","disableFragmentWarnings","enableExperimentalFragmentVariables","disableExperimentalFragmentVariables","gql"].indexOf(s)<0&&function(t){n.d(e,t,(function(){return h[t]}))}(s);var f=n(824);n.d(e,"parseAndCheckHttpResponse",(function(){return f.parseAndCheckHttpResponse})),n.d(e,"serializeFetchParameter",(function(){return f.serializeFetchParameter})),n.d(e,"fallbackHttpConfig",(function(){return f.fallbackHttpConfig})),n.d(e,"selectHttpOptionsAndBody",(function(){return f.selectHttpOptionsAndBody})),n.d(e,"checkFetcher",(function(){return f.checkFetcher})),n.d(e,"createSignalIfSupported",(function(){return f.createSignalIfSupported})),n.d(e,"selectURI",(function(){return f.selectURI})),n.d(e,"createHttpLink",(function(){return f.createHttpLink})),n.d(e,"HttpLink",(function(){return f.HttpLink})),n.d(e,"rewriteURIForGET",(function(){return f.rewriteURIForGET}));var p=n(321);n.d(e,"fromError",(function(){return p.b})),n.d(e,"toPromise",(function(){return p.e})),n.d(e,"fromPromise",(function(){return p.c})),n.d(e,"throwServerError",(function(){return p.d}));var d=n(33);n.d(e,"Observable",(function(){return d.c})),n.d(e,"isReference",(function(){return d.B})),n.d(e,"makeReference",(function(){return d.D}));var v=n(749),y=n.n(v);n.d(e,"gql",(function(){return y.a}));var g=y.a.resetCaches,m=y.a.disableFragmentWarnings,b=y.a.enableExperimentalFragmentVariables,_=y.a.disableExperimentalFragmentVariables},768:function(t,e,n){"use strict";n.r(e);var r=n(600);for(var i in r)["default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return r[t]}))}(i);var o=n(1364);for(var i in o)["default"].indexOf(i)<0&&function(t){n.d(e,t,(function(){return o[t]}))}(i)},824:function(t,e,n){"use strict";n.r(e),n.d(e,"parseAndCheckHttpResponse",(function(){return o})),n.d(e,"serializeFetchParameter",(function(){return s})),n.d(e,"fallbackHttpConfig",(function(){return l})),n.d(e,"selectHttpOptionsAndBody",(function(){return h})),n.d(e,"checkFetcher",(function(){return f})),n.d(e,"createSignalIfSupported",(function(){return p})),n.d(e,"selectURI",(function(){return d})),n.d(e,"createHttpLink",(function(){return m})),n.d(e,"HttpLink",(function(){return b})),n.d(e,"rewriteURIForGET",(function(){return g}));var r=n(321),i=Object.prototype.hasOwnProperty;function o(t){return function(e){return e.text().then((function(t){try{return JSON.parse(t)}catch(r){var n=r;throw n.name="ServerParseError",n.response=e,n.statusCode=e.status,n.bodyText=t,n}})).then((function(n){return e.status>=300&&Object(r.d)(e,n,"Response not successful: Received status code "+e.status),Array.isArray(n)||i.call(n,"data")||i.call(n,"errors")||Object(r.d)(e,n,"Server response was missing for query '"+(Array.isArray(t)?t.map((function(t){return t.operationName})):t.operationName)+"'."),n}))}}var a=n(59),s=function(t,e){var n;try{n=JSON.stringify(t)}catch(t){var r=new a.a(23);throw r.parseError=t,r}return n},u=n(4),c=n(1758),l={http:{includeQuery:!0,includeExtensions:!1},headers:{accept:"*/*","content-type":"application/json"},options:{method:"POST"}},h=function(t,e){for(var n=[],r=2;r