<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">function cf_callbody(){!function(e,t){"object"==typeof exports&amp;&amp;"undefined"!=typeof module?module.exports=t():"function"==typeof define&amp;&amp;define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).firebase=t()}(this,(function(){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&amp;&amp;(e[r]=t[r])})(e,t)};var o=function(){return(o=Object.assign||function(e){for(var t,r=1,n=arguments.length;r&lt;n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&amp;&amp;(e[i]=t[i]);return e}).apply(this,arguments)};function e(e,a,s,l){return new(s=s||Promise)((function(r,t){function n(e){try{o(l.next(e))}catch(e){t(e)}}function i(e){try{o(l.throw(e))}catch(e){t(e)}}function o(e){var t;e.done?r(e.value):((t=e.value)instanceof s?t:new s((function(e){e(t)}))).then(n,i)}o((l=l.apply(e,a||[])).next())}))}function n(r,n){var i,o,a,s={label:0,sent:function(){if(1&amp;a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&amp;&amp;(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&amp;&amp;(a=2&amp;t[0]?o.return:t[0]?o.throw||((a=o.return)&amp;&amp;a.call(o),0):o.next)&amp;&amp;!(a=a.call(o,t[1])).done)return a;switch(o=0,a&amp;&amp;(t=[2&amp;t[0],a.value]),t[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0&lt;(a=s.trys).length&amp;&amp;a[a.length-1])&amp;&amp;(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&amp;&amp;(!a||t[1]&gt;a[0]&amp;&amp;t[1]&lt;a[3])){s.label=t[1];break}if(6===t[0]&amp;&amp;s.label&lt;a[1]){s.label=a[1],a=t;break}if(a&amp;&amp;s.label&lt;a[2]){s.label=a[2],s.ops.push(t);break}a[2]&amp;&amp;s.ops.pop(),s.trys.pop();continue}t=n.call(r,s)}catch(e){t=[6,e],o=0}finally{i=a=0}if(5&amp;t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function h(e){var t="function"==typeof Symbol&amp;&amp;Symbol.iterator,r=t&amp;&amp;e[t],n=0;if(r)return r.call(e);if(e&amp;&amp;"number"==typeof e.length)return{next:function(){return e&amp;&amp;n&gt;=e.length&amp;&amp;(e=void 0),{value:e&amp;&amp;e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function u(e,t){var r="function"==typeof Symbol&amp;&amp;e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0&lt;t--)&amp;&amp;!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&amp;&amp;!n.done&amp;&amp;(r=o.return)&amp;&amp;r.call(o)}finally{if(i)throw i.error}}return a}function d(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&amp;&amp;(e={});break;case Array:e=[];break;default:return t}for(var r in t)t.hasOwnProperty(r)&amp;&amp;"__proto__"!==r&amp;&amp;(e[r]=d(e[r],t[r]));return e}var i=(t.prototype.wrapCallback=function(r){var n=this;return function(e,t){e?n.reject(e):n.resolve(t),"function"==typeof r&amp;&amp;(n.promise.catch((function(){})),1===r.length?r(e):r(e,t))}},t);function t(){var r=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise((function(e,t){r.resolve=e,r.reject=t}))}var a,s,l,c="FirebaseError",p=(a=Error,r(s=v,l=a),s.prototype=null===l?Object.create(l):(f.prototype=l.prototype,new f),v);function f(){this.constructor=s}function v(e,t,r){t=a.call(this,t)||this;return t.code=e,t.customData=r,t.name=c,Object.setPrototypeOf(t,v.prototype),Error.captureStackTrace&amp;&amp;Error.captureStackTrace(t,m.prototype.create),t}var m=(y.prototype.create=function(e){for(var t=[],r=1;r&lt;arguments.length;r++)t[r-1]=arguments[r];var n,i=t[0]||{},o=this.service+"/"+e,e=this.errors[e],e=e?(n=i,e.replace(g,(function(e,t){var r=n[t];return null!=r?String(r):"&lt;"+t+"?&gt;"}))):"Error",e=this.serviceName+": "+e+" ("+o+").";return new p(o,e,i)},y);function y(e,t,r){this.service=e,this.serviceName=t,this.errors=r}var g=/\{\$([^}]+)}/g;function b(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function w(e,t){t=new E(e,t);return t.subscribe.bind(t)}var E=(O.prototype.next=function(t){this.forEachObserver((function(e){e.next(t)}))},O.prototype.error=function(t){this.forEachObserver((function(e){e.error(t)})),this.close(t)},O.prototype.complete=function(){this.forEachObserver((function(e){e.complete()})),this.close()},O.prototype.subscribe=function(e,t,r){var n,i=this;if(void 0===e&amp;&amp;void 0===t&amp;&amp;void 0===r)throw new Error("Missing Observer.");void 0===(n=function(e,t){if("object"!=typeof e||null===e)return!1;for(var r=0,n=t;r&lt;n.length;r++){var i=n[r];if(i in e&amp;&amp;"function"==typeof e[i])return!0}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:r}).next&amp;&amp;(n.next=_),void 0===n.error&amp;&amp;(n.error=_),void 0===n.complete&amp;&amp;(n.complete=_);r=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&amp;&amp;this.task.then((function(){try{i.finalError?n.error(i.finalError):n.complete()}catch(e){}})),this.observers.push(n),r},O.prototype.unsubscribeOne=function(e){void 0!==this.observers&amp;&amp;void 0!==this.observers[e]&amp;&amp;(delete this.observers[e],--this.observerCount,0===this.observerCount&amp;&amp;void 0!==this.onNoObservers&amp;&amp;this.onNoObservers(this))},O.prototype.forEachObserver=function(e){if(!this.finalized)for(var t=0;t&lt;this.observers.length;t++)this.sendOne(t,e)},O.prototype.sendOne=function(e,t){var r=this;this.task.then((function(){if(void 0!==r.observers&amp;&amp;void 0!==r.observers[e])try{t(r.observers[e])}catch(e){"undefined"!=typeof console&amp;&amp;console.error&amp;&amp;console.error(e)}}))},O.prototype.close=function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&amp;&amp;(this.finalError=e),this.task.then((function(){t.observers=void 0,t.onNoObservers=void 0})))},O);function O(e,t){var r=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then((function(){e(r)})).catch((function(e){r.error(e)}))}function _(){}var I=(N.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},N.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},N.prototype.setServiceProps=function(e){return this.serviceProps=e,this},N);function N(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var L="[DEFAULT]",S=(R.prototype.get=function(e){void 0===e&amp;&amp;(e=L);var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){var r=new i;this.instancesDeferred.set(t,r);try{var n=this.getOrInitializeService(t);n&amp;&amp;r.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise},R.prototype.getImmediate=function(e){var t=o({identifier:L,optional:!1},e),e=t.identifier,r=t.optional,n=this.normalizeInstanceIdentifier(e);try{var i=this.getOrInitializeService(n);if(i)return i;if(r)return null;throw Error("Service "+this.name+" is not available")}catch(e){if(r)return null;throw e}},R.prototype.getComponent=function(){return this.component},R.prototype.setComponent=function(e){var t,r;if(e.name!==this.name)throw Error("Mismatching Component "+e.name+" for Provider "+this.name+".");if(this.component)throw Error("Component for "+this.name+" has already been provided");if("EAGER"===(this.component=e).instantiationMode)try{this.getOrInitializeService(L)}catch(e){}try{for(var n=h(this.instancesDeferred.entries()),i=n.next();!i.done;i=n.next()){var o=u(i.value,2),a=o[0],s=o[1],l=this.normalizeInstanceIdentifier(a);try{var c=this.getOrInitializeService(l);s.resolve(c)}catch(e){}}}catch(e){t={error:e}}finally{try{i&amp;&amp;!i.done&amp;&amp;(r=n.return)&amp;&amp;r.call(n)}finally{if(t)throw t.error}}},R.prototype.clearInstance=function(e){void 0===e&amp;&amp;(e=L),this.instancesDeferred.delete(e),this.instances.delete(e)},R.prototype.delete=function(){return e(this,void 0,void 0,(function(){var t;return n(this,(function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Promise.all(function(){for(var e=[],t=0;t&lt;arguments.length;t++)e=e.concat(u(arguments[t]));return e}(t.filter((function(e){return"INTERNAL"in e})).map((function(e){return e.INTERNAL.delete()})),t.filter((function(e){return"_delete"in e})).map((function(e){return e._delete()}))))];case 1:return e.sent(),[2]}}))}))},R.prototype.isComponentSet=function(){return null!=this.component},R.prototype.getOrInitializeService=function(e){var t,r=this.instances.get(e);return!r&amp;&amp;this.component&amp;&amp;(r=this.component.instanceFactory(this.container,(t=e)===L?void 0:t),this.instances.set(e,r)),r||null},R.prototype.normalizeInstanceIdentifier=function(e){return!this.component||this.component.multipleInstances?e:L},R);function R(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}var P=(A.prototype.addComponent=function(e){var t=this.getProvider(e.name);if(t.isComponentSet())throw new Error("Component "+e.name+" has already been registered with "+this.name);t.setComponent(e)},A.prototype.addOrOverwriteComponent=function(e){this.getProvider(e.name).isComponentSet()&amp;&amp;this.providers.delete(e.name),this.addComponent(e)},A.prototype.getProvider=function(e){if(this.providers.has(e))return this.providers.get(e);var t=new S(e,this);return this.providers.set(e,t),t},A.prototype.getProviders=function(){return Array.from(this.providers.values())},A);function A(e){this.name=e,this.providers=new Map}function C(){for(var e=0,t=0,r=arguments.length;t&lt;r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t&lt;r;t++)for(var o=arguments[t],a=0,s=o.length;a&lt;s;a++,i++)n[i]=o[a];return n}var j,D=[];(H=j=j||{})[H.DEBUG=0]="DEBUG",H[H.VERBOSE=1]="VERBOSE",H[H.INFO=2]="INFO",H[H.WARN=3]="WARN",H[H.ERROR=4]="ERROR",H[H.SILENT=5]="SILENT";function F(e,t){for(var r=[],n=2;n&lt;arguments.length;n++)r[n-2]=arguments[n];if(!(t&lt;e.logLevel)){var i=(new Date).toISOString(),o=x[t];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+t+")");console[o].apply(console,C(["["+i+"]  "+e.name+":"],r))}}var k={debug:j.DEBUG,verbose:j.VERBOSE,info:j.INFO,warn:j.WARN,error:j.ERROR,silent:j.SILENT},T=j.INFO,x=((V={})[j.DEBUG]="log",V[j.VERBOSE]="log",V[j.INFO]="info",V[j.WARN]="warn",V[j.ERROR]="error",V),H=(Object.defineProperty(z.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){if(!(e in j))throw new TypeError('Invalid value "'+e+'" assigned to `logLevel`');this._logLevel=e},enumerable:!1,configurable:!0}),z.prototype.setLogLevel=function(e){this._logLevel="string"==typeof e?k[e]:e},Object.defineProperty(z.prototype,"logHandler",{get:function(){return this._logHandler},set:function(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e},enumerable:!1,configurable:!0}),Object.defineProperty(z.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(e){this._userLogHandler=e},enumerable:!1,configurable:!0}),z.prototype.debug=function(){for(var e=[],t=0;t&lt;arguments.length;t++)e[t]=arguments[t];this._userLogHandler&amp;&amp;this._userLogHandler.apply(this,C([this,j.DEBUG],e)),this._logHandler.apply(this,C([this,j.DEBUG],e))},z.prototype.log=function(){for(var e=[],t=0;t&lt;arguments.length;t++)e[t]=arguments[t];this._userLogHandler&amp;&amp;this._userLogHandler.apply(this,C([this,j.VERBOSE],e)),this._logHandler.apply(this,C([this,j.VERBOSE],e))},z.prototype.info=function(){for(var e=[],t=0;t&lt;arguments.length;t++)e[t]=arguments[t];this._userLogHandler&amp;&amp;this._userLogHandler.apply(this,C([this,j.INFO],e)),this._logHandler.apply(this,C([this,j.INFO],e))},z.prototype.warn=function(){for(var e=[],t=0;t&lt;arguments.length;t++)e[t]=arguments[t];this._userLogHandler&amp;&amp;this._userLogHandler.apply(this,C([this,j.WARN],e)),this._logHandler.apply(this,C([this,j.WARN],e))},z.prototype.error=function(){for(var e=[],t=0;t&lt;arguments.length;t++)e[t]=arguments[t];this._userLogHandler&amp;&amp;this._userLogHandler.apply(this,C([this,j.ERROR],e)),this._logHandler.apply(this,C([this,j.ERROR],e))},z);function z(e){this.name=e,this._logLevel=T,this._logHandler=F,this._userLogHandler=null,D.push(this)}function B(t){D.forEach((function(e){e.setLogLevel(t)}))}var V=((V={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",V["bad-app-name"]="Illegal App name: '{$appName}",V["duplicate-app"]="Firebase App named '{$appName}' already exists",V["app-deleted"]="Firebase App named '{$appName}' already deleted",V["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",V["invalid-log-argument"]="First argument to `onLog` must be null or a function.",V),U=new m("app","Firebase",V),M="@firebase/app",W="[DEFAULT]",G=((V={})[M]="fire-core",V["@firebase/analytics"]="fire-analytics",V["@firebase/auth"]="fire-auth",V["@firebase/database"]="fire-rtdb",V["@firebase/functions"]="fire-fn",V["@firebase/installations"]="fire-iid",V["@firebase/messaging"]="fire-fcm",V["@firebase/performance"]="fire-perf",V["@firebase/remote-config"]="fire-rc",V["@firebase/storage"]="fire-gcs",V["@firebase/firestore"]="fire-fst",V["fire-js"]="fire-js",V["firebase-wrapper"]="fire-js-all",V),$=new H("@firebase/app"),Y=(Object.defineProperty(K.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(e){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=e},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty(K.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),K.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(e){return e.delete()})))})).then((function(){t.isDeleted_=!0}))},K.prototype._getService=function(e,t){return void 0===t&amp;&amp;(t=W),this.checkDestroyed_(),this.container.getProvider(e).getImmediate({identifier:t})},K.prototype._removeServiceInstance=function(e,t){void 0===t&amp;&amp;(t=W),this.container.getProvider(e).clearInstance(t)},K.prototype._addComponent=function(t){try{this.container.addComponent(t)}catch(e){$.debug("Component "+t.name+" failed to register with FirebaseApp "+this.name,e)}},K.prototype._addOrOverwriteComponent=function(e){this.container.addOrOverwriteComponent(e)},K.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw U.create("app-deleted",{appName:this.name_})},K);function K(e,t,r){var n,i,o=this;this.firebase_=r,this.isDeleted_=!1,this.name_=t.name,this.automaticDataCollectionEnabled_=t.automaticDataCollectionEnabled||!1,this.options_=d(void 0,e),this.container=new P(t.name),this._addComponent(new I("app",(function(){return o}),"PUBLIC"));try{for(var a=h(this.firebase_.INTERNAL.components.values()),s=a.next();!s.done;s=a.next()){var l=s.value;this._addComponent(l)}}catch(e){n={error:e}}finally{try{s&amp;&amp;!s.done&amp;&amp;(i=a.return)&amp;&amp;i.call(a)}finally{if(n)throw n.error}}}Y.prototype.name&amp;&amp;Y.prototype.options||Y.prototype.delete||console.log("dc");var J="8.2.1";function Z(l){var c={},u=new Map,p={__esModule:!0,initializeApp:function(e,t){void 0===t&amp;&amp;(t={});{"object"==typeof t&amp;&amp;null!==t||(t={name:t})}var r=t;void 0===r.name&amp;&amp;(r.name=W);t=r.name;if("string"!=typeof t||!t)throw U.create("bad-app-name",{appName:String(t)});if(b(c,t))throw U.create("duplicate-app",{appName:t});r=new l(e,r,p);return c[t]=r},app:f,registerVersion:function(e,t,r){var n=null!==(i=G[e])&amp;&amp;void 0!==i?i:e;r&amp;&amp;(n+="-"+r);var i=n.match(/\s|\//),e=t.match(/\s|\//);if(i||e){r=['Unable to register library "'+n+'" with version "'+t+'":'];return i&amp;&amp;r.push('library name "'+n+'" contains illegal characters (whitespace or "/")'),i&amp;&amp;e&amp;&amp;r.push("and"),e&amp;&amp;r.push('version name "'+t+'" contains illegal characters (whitespace or "/")'),void $.warn(r.join(" "))}o(new I(n+"-version",(function(){return{library:n,version:t}}),"VERSION"))},setLogLevel:B,onLog:function(e,t){if(null!==e&amp;&amp;"function"!=typeof e)throw U.create("invalid-log-argument",{appName:name});!function(a,t){for(var e=0,r=D;e&lt;r.length;e++){!function(e){var o=null;t&amp;&amp;t.level&amp;&amp;(o=k[t.level]),e.userLogHandler=null===a?null:function(e,t){for(var r=[],n=2;n&lt;arguments.length;n++)r[n-2]=arguments[n];var i=r.map((function(e){if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}})).filter((function(e){return e})).join(" ");t&gt;=(null!=o?o:e.logLevel)&amp;&amp;a({level:j[t].toLowerCase(),message:i,args:r,type:e.name})}}(r[e])}}(e,t)},apps:null,SDK_VERSION:J,INTERNAL:{registerComponent:o,removeApp:function(e){delete c[e]},components:u,useAsService:function(e,t){if("serverAuth"===t)return null;return t}}};function f(e){if(!b(c,e=e||W))throw U.create("no-app",{appName:e});return c[e]}function o(r){var t,e,n,i=r.name;if(u.has(i))return $.debug("There were multiple attempts to register component "+i+"."),"PUBLIC"===r.type?p[i]:null;u.set(i,r),"PUBLIC"===r.type&amp;&amp;(n=function(e){if(void 0===e&amp;&amp;(e=f()),"function"!=typeof e[i])throw U.create("invalid-app-argument",{appName:i});return e[i]()},void 0!==r.serviceProps&amp;&amp;d(n,r.serviceProps),p[i]=n,l.prototype[i]=function(){for(var e=[],t=0;t&lt;arguments.length;t++)e[t]=arguments[t];return this._getService.bind(this,i).apply(this,r.multipleInstances?e:[])});try{for(var o=h(Object.keys(c)),a=o.next();!a.done;a=o.next()){var s=a.value;c[s]._addComponent(r)}}catch(e){t={error:e}}finally{try{a&amp;&amp;!a.done&amp;&amp;(e=o.return)&amp;&amp;e.call(o)}finally{if(t)throw t.error}}return"PUBLIC"===r.type?p[i]:null}return p.default=p,Object.defineProperty(p,"apps",{get:function(){return Object.keys(c).map((function(e){return c[e]}))}}),f.App=l,p}var V=function e(){var t=Z(Y);return t.INTERNAL=o(o({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){d(t,e)},createSubscribe:w,ErrorFactory:m,deepExtend:d}),t}(),q=(Q.prototype.getPlatformInfoString=function(){return this.container.getProviders().map((function(e){if(function(e){e=e.getComponent();return"VERSION"===(null==e?void 0:e.type)}(e)){e=e.getImmediate();return e.library+"/"+e.version}return null})).filter((function(e){return e})).join(" ")},Q);function Q(e){this.container=e}"object"==typeof self&amp;&amp;self.self===self&amp;&amp;void 0!==self.firebase&amp;&amp;($.warn("\n    Warning: Firebase is already defined in the global scope. Please make sure\n    Firebase library is only loaded once.\n  "),(H=self.firebase.SDK_VERSION)&amp;&amp;0&lt;=H.indexOf("LITE")&amp;&amp;$.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 X=V.initializeApp;V.initializeApp=function(){for(var e=[],t=0;t&lt;arguments.length;t++)e[t]=arguments[t];return function(){try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return}}()&amp;&amp;$.warn('\n      Warning: This is a browser-targeted Firebase bundle but it appears it is being\n      run in a Node environment.  If running in a Node environment, make sure you\n      are using the bundle specified by the "main" field in package.json.\n      \n      If you are using Webpack, you can specify "main" as the first item in\n      "resolve.mainFields":\n      https://webpack.js.org/configuration/resolve/#resolvemainfields\n      \n      If using Rollup, use the @rollup/plugin-node-resolve plugin and specify "main"\n      as the first item in "mainFields", e.g. [\'main\', \'module\'].\n      https://github.com/rollup/@rollup/plugin-node-resolve\n      '),X.apply(void 0,e)};var ee,te,re=V;(ee=re).INTERNAL.registerComponent(new I("platform-logger",(function(e){return new q(e)}),"PRIVATE")),ee.registerVersion(M,"0.6.13",te),ee.registerVersion("fire-js","");return re.registerVersion("firebase","8.2.1","app"),re}));!function(t,e){"object"==typeof exports&amp;&amp;"undefined"!=typeof module?e(require("@firebase/app")):"function"==typeof define&amp;&amp;define.amd?define(["@firebase/app"],e):e((t="undefined"!=typeof globalThis?globalThis:t||self).firebase)}(this,(function(Zi){"use strict";try{(function(){function t(t){return t&amp;&amp;"object"==typeof t&amp;&amp;"default"in t?t:{default:t}}var e=t(Zi),r=function(t,e){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&amp;&amp;function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&amp;&amp;(t[n]=e[n])})(t,e)};function n(t,e){function n(){this.constructor=t}r(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}var l=function(){return(l=Object.assign||function(t){for(var e,n=1,r=arguments.length;n&lt;r;n++)for(var i in e=arguments[n])Object.prototype.hasOwnProperty.call(e,i)&amp;&amp;(t[i]=e[i]);return t}).apply(this,arguments)};function i(t,s,a,h){return new(a=a||Promise)((function(n,e){function r(t){try{o(h.next(t))}catch(t){e(t)}}function i(t){try{o(h.throw(t))}catch(t){e(t)}}function o(t){var e;t.done?n(t.value):((e=t.value)instanceof a?e:new a((function(t){t(e)}))).then(r,i)}o((h=h.apply(t,s||[])).next())}))}function o(n,r){var i,o,s,a={label:0,sent:function(){if(1&amp;s[0])throw s[1];return s[1]},trys:[],ops:[]},t={next:e(0),throw:e(1),return:e(2)};return"function"==typeof Symbol&amp;&amp;(t[Symbol.iterator]=function(){return this}),t;function e(e){return function(t){return function(e){if(i)throw new TypeError("Generator is already executing.");for(;a;)try{if(i=1,o&amp;&amp;(s=2&amp;e[0]?o.return:e[0]?o.throw||((s=o.return)&amp;&amp;s.call(o),0):o.next)&amp;&amp;!(s=s.call(o,e[1])).done)return s;switch(o=0,s&amp;&amp;(e=[2&amp;e[0],s.value]),e[0]){case 0:case 1:s=e;break;case 4:return a.label++,{value:e[1],done:!1};case 5:a.label++,o=e[1],e=[0];continue;case 7:e=a.ops.pop(),a.trys.pop();continue;default:if(!(s=0&lt;(s=a.trys).length&amp;&amp;s[s.length-1])&amp;&amp;(6===e[0]||2===e[0])){a=0;continue}if(3===e[0]&amp;&amp;(!s||e[1]&gt;s[0]&amp;&amp;e[1]&lt;s[3])){a.label=e[1];break}if(6===e[0]&amp;&amp;a.label&lt;s[1]){a.label=s[1],s=e;break}if(s&amp;&amp;a.label&lt;s[2]){a.label=s[2],a.ops.push(e);break}s[2]&amp;&amp;a.ops.pop(),a.trys.pop();continue}e=r.call(n,a)}catch(t){e=[6,t],o=0}finally{i=s=0}if(5&amp;e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,t])}}}function f(t){var e="function"==typeof Symbol&amp;&amp;Symbol.iterator,n=e&amp;&amp;t[e],r=0;if(n)return n.call(t);if(t&amp;&amp;"number"==typeof t.length)return{next:function(){return t&amp;&amp;r&gt;=t.length&amp;&amp;(t=void 0),{value:t&amp;&amp;t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function _(t,e){var n="function"==typeof Symbol&amp;&amp;t[Symbol.iterator];if(!n)return t;var r,i,o=n.call(t),s=[];try{for(;(void 0===e||0&lt;e--)&amp;&amp;!(r=o.next()).done;)s.push(r.value)}catch(t){i={error:t}}finally{try{r&amp;&amp;!r.done&amp;&amp;(n=o.return)&amp;&amp;n.call(o)}finally{if(i)throw i.error}}return s}function s(){for(var t=[],e=0;e&lt;arguments.length;e++)t=t.concat(_(arguments[e]));return t}function a(t){for(var e=[],n=0,r=0;r&lt;t.length;r++){var i=t.charCodeAt(r);i&lt;128?e[n++]=i:(i&lt;2048?e[n++]=i&gt;&gt;6|192:(55296==(64512&amp;i)&amp;&amp;r+1&lt;t.length&amp;&amp;56320==(64512&amp;t.charCodeAt(r+1))?(i=65536+((1023&amp;i)&lt;&lt;10)+(1023&amp;t.charCodeAt(++r)),e[n++]=i&gt;&gt;18|240,e[n++]=i&gt;&gt;12&amp;63|128):e[n++]=i&gt;&gt;12|224,e[n++]=i&gt;&gt;6&amp;63|128),e[n++]=63&amp;i|128)}return e}function h(t){try{return p.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}var u={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},y=function(t,e){if(!t)throw c(e)},c=function(t){return new Error("Firebase Database ("+u.SDK_VERSION+") INTERNAL ASSERT FAILED: "+t)},p={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&lt;t.length;i+=3){var o=t[i],s=i+1&lt;t.length,a=s?t[i+1]:0,h=i+2&lt;t.length,l=h?t[i+2]:0,u=o&gt;&gt;2,o=(3&amp;o)&lt;&lt;4|a&gt;&gt;4,a=(15&amp;a)&lt;&lt;2|l&gt;&gt;6,l=63&amp;l;h||(l=64,s||(a=64)),r.push(n[u],n[o],n[a],n[l])}return r.join("")},encodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&amp;&amp;!e?btoa(t):this.encodeByteArray(a(t),e)},decodeString:function(t,e){return this.HAS_NATIVE_SUPPORT&amp;&amp;!e?atob(t):function(t){for(var e=[],n=0,r=0;n&lt;t.length;){var i,o,s,a=t[n++];a&lt;128?e[r++]=String.fromCharCode(a):191&lt;a&amp;&amp;a&lt;224?(o=t[n++],e[r++]=String.fromCharCode((31&amp;a)&lt;&lt;6|63&amp;o)):239&lt;a&amp;&amp;a&lt;365?(i=((7&amp;a)&lt;&lt;18|(63&amp;(o=t[n++]))&lt;&lt;12|(63&amp;(s=t[n++]))&lt;&lt;6|63&amp;t[n++])-65536,e[r++]=String.fromCharCode(55296+(i&gt;&gt;10)),e[r++]=String.fromCharCode(56320+(1023&amp;i))):(o=t[n++],s=t[n++],e[r++]=String.fromCharCode((15&amp;a)&lt;&lt;12|(63&amp;o)&lt;&lt;6|63&amp;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&lt;t.length;){var o=n[t.charAt(i++)],s=i&lt;t.length?n[t.charAt(i)]:0,a=++i&lt;t.length?n[t.charAt(i)]:64,h=++i&lt;t.length?n[t.charAt(i)]:64;if(++i,null==o||null==s||null==a||null==h)throw Error();o=o&lt;&lt;2|s&gt;&gt;4;r.push(o),64!==a&amp;&amp;(s=s&lt;&lt;4&amp;240|a&gt;&gt;2,r.push(s),64!==h&amp;&amp;(h=a&lt;&lt;6&amp;192|h,r.push(h)))}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var t=0;t&lt;this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),(this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t)&gt;=this.ENCODED_VALS_BASE.length&amp;&amp;(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};function d(t){return function t(e,n){if(!(n instanceof Object))return n;switch(n.constructor){case Date:var r=n;return new Date(r.getTime());case Object:void 0===e&amp;&amp;(e={});break;case Array:e=[];break;default:return n}for(var i in n)n.hasOwnProperty(i)&amp;&amp;"__proto__"!==i&amp;&amp;(e[i]=t(e[i],n[i]));return e}(void 0,t)}var g=(v.prototype.wrapCallback=function(n){var r=this;return function(t,e){t?r.reject(t):r.resolve(e),"function"==typeof n&amp;&amp;(r.promise.catch((function(){})),1===n.length?n(t):n(t,e))}},v);function v(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise((function(t,e){n.resolve=t,n.reject=e}))}function m(){return"undefined"!=typeof window&amp;&amp;(window.cordova||window.phonegap||window.PhoneGap)&amp;&amp;/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test("undefined"!=typeof navigator&amp;&amp;"string"==typeof navigator.userAgent?navigator.userAgent:"")}function C(){return!0===u.NODE_ADMIN}var E,w="FirebaseError",b=(n(S,E=Error),S);function S(t,e,n){e=E.call(this,e)||this;return e.code=t,e.customData=n,e.name=w,Object.setPrototypeOf(e,S.prototype),Error.captureStackTrace&amp;&amp;Error.captureStackTrace(e,T.prototype.create),e}var T=(I.prototype.create=function(t){for(var e=[],n=1;n&lt;arguments.length;n++)e[n-1]=arguments[n];var r,i=e[0]||{},o=this.service+"/"+t,t=this.errors[t],t=t?(r=i,t.replace(N,(function(t,e){var n=r[e];return null!=n?String(n):"&lt;"+e+"?&gt;"}))):"Error",t=this.serviceName+": "+t+" ("+o+").";return new b(o,t,i)},I);function I(t,e,n){this.service=t,this.serviceName=e,this.errors=n}var N=/\{\$([^}]+)}/g;function R(t){return JSON.parse(t)}function P(t){return JSON.stringify(t)}function D(t){var e={},n={},r={},i="";try{var o=t.split("."),e=R(h(o[0])||""),n=R(h(o[1])||""),i=o[2],r=n.d||{};delete n.d}catch(t){}return{header:e,claims:n,data:r,signature:i}}function O(t,e){return Object.prototype.hasOwnProperty.call(t,e)}function x(t,e){return Object.prototype.hasOwnProperty.call(t,e)?t[e]:void 0}function k(t){for(var e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function A(t,e,n){var r,i={};for(r in t)Object.prototype.hasOwnProperty.call(t,r)&amp;&amp;(i[r]=e.call(n,t[r],r,t));return i}var F=(L.prototype.reset=function(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0},L.prototype.compress_=function(t,e){e=e||0;var n=this.W_;if("string"==typeof t)for(var r=0;r&lt;16;r++)n[r]=t.charCodeAt(e)&lt;&lt;24|t.charCodeAt(e+1)&lt;&lt;16|t.charCodeAt(e+2)&lt;&lt;8|t.charCodeAt(e+3),e+=4;else for(r=0;r&lt;16;r++)n[r]=t[e]&lt;&lt;24|t[e+1]&lt;&lt;16|t[e+2]&lt;&lt;8|t[e+3],e+=4;for(r=16;r&lt;80;r++){var i=n[r-3]^n[r-8]^n[r-14]^n[r-16];n[r]=4294967295&amp;(i&lt;&lt;1|i&gt;&gt;&gt;31)}for(var o,s,a=this.chain_[0],h=this.chain_[1],l=this.chain_[2],u=this.chain_[3],c=this.chain_[4],r=0;r&lt;80;r++){s=r&lt;40?r&lt;20?(o=u^h&amp;(l^u),1518500249):(o=h^l^u,1859775393):r&lt;60?(o=h&amp;l|u&amp;(h|l),2400959708):(o=h^l^u,3395469782);i=(a&lt;&lt;5|a&gt;&gt;&gt;27)+o+c+s+n[r]&amp;4294967295,c=u,u=l,l=4294967295&amp;(h&lt;&lt;30|h&gt;&gt;&gt;2),h=a,a=i}this.chain_[0]=this.chain_[0]+a&amp;4294967295,this.chain_[1]=this.chain_[1]+h&amp;4294967295,this.chain_[2]=this.chain_[2]+l&amp;4294967295,this.chain_[3]=this.chain_[3]+u&amp;4294967295,this.chain_[4]=this.chain_[4]+c&amp;4294967295},L.prototype.update=function(t,e){if(null!=t){void 0===e&amp;&amp;(e=t.length);for(var n=e-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r&lt;e;){if(0===o)for(;r&lt;=n;)this.compress_(t,r),r+=this.blockSize;if("string"==typeof t){for(;r&lt;e;)if(i[o]=t.charCodeAt(r),++r,++o===this.blockSize){this.compress_(i),o=0;break}}else for(;r&lt;e;)if(i[o]=t[r],++r,++o===this.blockSize){this.compress_(i),o=0;break}}this.inbuf_=o,this.total_+=e}},L.prototype.digest=function(){var t=[],e=8*this.total_;this.inbuf_&lt;56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(var n=this.blockSize-1;56&lt;=n;n--)this.buf_[n]=255&amp;e,e/=256;this.compress_(this.buf_);for(var r=0,n=0;n&lt;5;n++)for(var i=24;0&lt;=i;i-=8)t[r]=this.chain_[n]&gt;&gt;i&amp;255,++r;return t},L);function L(){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&lt;this.blockSize;++t)this.pad_[t]=0;this.reset()}function M(t,e,n,r){var i;if(r&lt;e?i="at least "+e:n&lt;r&amp;&amp;(i=0===n?"none":"no more than "+n),i)throw new Error(t+" failed: Was called with "+r+(1===r?" argument.":" arguments.")+" Expects "+i+".")}function W(t,e,n){var r="";switch(e){case 1:r=n?"first":"First";break;case 2:r=n?"second":"Second";break;case 3:r=n?"third":"Third";break;case 4:r=n?"fourth":"Fourth";break;default:throw new Error("errorPrefix called with argumentNumber &gt; 4.  Need to update it?")}t+=" failed: ";return t+=r+" argument "}function q(t,e,n,r){if((!r||n)&amp;&amp;"function"!=typeof n)throw new Error(W(t,e,r)+"must be a valid function.")}function Q(t,e,n,r){if((!r||n)&amp;&amp;("object"!=typeof n||null===n))throw new Error(W(t,e,r)+"must be a valid context object.")}function U(t){for(var e=0,n=0;n&lt;t.length;n++){var r=t.charCodeAt(n);r&lt;128?e++:r&lt;2048?e+=2:55296&lt;=r&amp;&amp;r&lt;=56319?(e+=4,n++):e+=3}return e}var V;function H(){for(var t=0,e=0,n=arguments.length;e&lt;n;e++)t+=arguments[e].length;for(var r=Array(t),i=0,e=0;e&lt;n;e++)for(var o=arguments[e],s=0,a=o.length;s&lt;a;s++,i++)r[i]=o[s];return r}(gt=V=V||{})[gt.DEBUG=0]="DEBUG",gt[gt.VERBOSE=1]="VERBOSE",gt[gt.INFO=2]="INFO",gt[gt.WARN=3]="WARN",gt[gt.ERROR=4]="ERROR",gt[gt.SILENT=5]="SILENT";function j(t,e){for(var n=[],r=2;r&lt;arguments.length;r++)n[r-2]=arguments[r];if(!(e&lt;t.logLevel)){var i=(new Date).toISOString(),o=K[e];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+e+")");console[o].apply(console,H(["["+i+"]  "+t.name+":"],n))}}var B={debug:V.DEBUG,verbose:V.VERBOSE,info:V.INFO,warn:V.WARN,error:V.ERROR,silent:V.SILENT},z=V.INFO,K=((Ce={})[V.DEBUG]="log",Ce[V.VERBOSE]="log",Ce[V.INFO]="info",Ce[V.WARN]="warn",Ce[V.ERROR]="error",Ce),Y=(Object.defineProperty(G.prototype,"logLevel",{get:function(){return this._logLevel},set:function(t){if(!(t in V))throw new TypeError('Invalid value "'+t+'" assigned to `logLevel`');this._logLevel=t},enumerable:!1,configurable:!0}),G.prototype.setLogLevel=function(t){this._logLevel="string"==typeof t?B[t]:t},Object.defineProperty(G.prototype,"logHandler",{get:function(){return this._logHandler},set:function(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t},enumerable:!1,configurable:!0}),Object.defineProperty(G.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(t){this._userLogHandler=t},enumerable:!1,configurable:!0}),G.prototype.debug=function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];this._userLogHandler&amp;&amp;this._userLogHandler.apply(this,H([this,V.DEBUG],t)),this._logHandler.apply(this,H([this,V.DEBUG],t))},G.prototype.log=function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];this._userLogHandler&amp;&amp;this._userLogHandler.apply(this,H([this,V.VERBOSE],t)),this._logHandler.apply(this,H([this,V.VERBOSE],t))},G.prototype.info=function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];this._userLogHandler&amp;&amp;this._userLogHandler.apply(this,H([this,V.INFO],t)),this._logHandler.apply(this,H([this,V.INFO],t))},G.prototype.warn=function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];this._userLogHandler&amp;&amp;this._userLogHandler.apply(this,H([this,V.WARN],t)),this._logHandler.apply(this,H([this,V.WARN],t))},G.prototype.error=function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];this._userLogHandler&amp;&amp;this._userLogHandler.apply(this,H([this,V.ERROR],t)),this._logHandler.apply(this,H([this,V.ERROR],t))},G);function G(t){this.name=t,this._logLevel=z,this._logHandler=j,this._userLogHandler=null}var X=($.prototype.setInstantiationMode=function(t){return this.instantiationMode=t,this},$.prototype.setMultipleInstances=function(t){return this.multipleInstances=t,this},$.prototype.setServiceProps=function(t){return this.serviceProps=t,this},$);function $(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var J="[DEFAULT]",Z=(tt.prototype.get=function(t){void 0===t&amp;&amp;(t=J);var e=this.normalizeInstanceIdentifier(t);if(!this.instancesDeferred.has(e)){var n=new g;this.instancesDeferred.set(e,n);try{var r=this.getOrInitializeService(e);r&amp;&amp;n.resolve(r)}catch(t){}}return this.instancesDeferred.get(e).promise},tt.prototype.getImmediate=function(t){var e=l({identifier:J,optional:!1},t),t=e.identifier,n=e.optional,r=this.normalizeInstanceIdentifier(t);try{var i=this.getOrInitializeService(r);if(i)return i;if(n)return null;throw Error("Service "+this.name+" is not available")}catch(t){if(n)return null;throw t}},tt.prototype.getComponent=function(){return this.component},tt.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("EAGER"===(this.component=t).instantiationMode)try{this.getOrInitializeService(J)}catch(t){}try{for(var r=f(this.instancesDeferred.entries()),i=r.next();!i.done;i=r.next()){var o=_(i.value,2),s=o[0],a=o[1],h=this.normalizeInstanceIdentifier(s);try{var l=this.getOrInitializeService(h);a.resolve(l)}catch(t){}}}catch(t){e={error:t}}finally{try{i&amp;&amp;!i.done&amp;&amp;(n=r.return)&amp;&amp;n.call(r)}finally{if(e)throw e.error}}},tt.prototype.clearInstance=function(t){void 0===t&amp;&amp;(t=J),this.instancesDeferred.delete(t),this.instances.delete(t)},tt.prototype.delete=function(){return i(this,void 0,void 0,(function(){var e;return o(this,(function(t){switch(t.label){case 0:return e=Array.from(this.instances.values()),[4,Promise.all(s(e.filter((function(t){return"INTERNAL"in t})).map((function(t){return t.INTERNAL.delete()})),e.filter((function(t){return"_delete"in t})).map((function(t){return t._delete()}))))];case 1:return t.sent(),[2]}}))}))},tt.prototype.isComponentSet=function(){return null!=this.component},tt.prototype.getOrInitializeService=function(t){var e,n=this.instances.get(t);return!n&amp;&amp;this.component&amp;&amp;(n=this.component.instanceFactory(this.container,(e=t)===J?void 0:e),this.instances.set(t,n)),n||null},tt.prototype.normalizeInstanceIdentifier=function(t){return!this.component||this.component.multipleInstances?t:J},tt);function tt(t,e){this.name=t,this.container=e,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}var et=(nt.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)},nt.prototype.addOrOverwriteComponent=function(t){this.getProvider(t.name).isComponentSet()&amp;&amp;this.providers.delete(t.name),this.addComponent(t)},nt.prototype.getProvider=function(t){if(this.providers.has(t))return this.providers.get(t);var e=new Z(t,this);return this.providers.set(t,e),e},nt.prototype.getProviders=function(){return Array.from(this.providers.values())},nt);function nt(t){this.name=t,this.providers=new Map}var rt=(it.prototype.set=function(t,e){null==e?this.domStorage_.removeItem(this.prefixedName_(t)):this.domStorage_.setItem(this.prefixedName_(t),P(e))},it.prototype.get=function(t){t=this.domStorage_.getItem(this.prefixedName_(t));return null==t?null:R(t)},it.prototype.remove=function(t){this.domStorage_.removeItem(this.prefixedName_(t))},it.prototype.prefixedName_=function(t){return this.prefix_+t},it.prototype.toString=function(){return this.domStorage_.toString()},it);function it(t){this.domStorage_=t,this.prefix_="firebase:"}var ot=(st.prototype.set=function(t,e){null==e?delete this.cache_[t]:this.cache_[t]=e},st.prototype.get=function(t){return O(this.cache_,t)?this.cache_[t]:null},st.prototype.remove=function(t){delete this.cache_[t]},st);function st(){this.cache_={},this.isInMemoryStorage=!0}function at(t){var e=function(t){for(var e=[],n=0,r=0;r&lt;t.length;r++){var i,o=t.charCodeAt(r);55296&lt;=o&amp;&amp;o&lt;=56319&amp;&amp;(i=o-55296,y(++r&lt;t.length,"Surrogate pair missing trail surrogate."),o=65536+(i&lt;&lt;10)+(t.charCodeAt(r)-56320)),o&lt;128?e[n++]=o:(o&lt;2048?e[n++]=o&gt;&gt;6|192:(o&lt;65536?e[n++]=o&gt;&gt;12|224:(e[n++]=o&gt;&gt;18|240,e[n++]=o&gt;&gt;12&amp;63|128),e[n++]=o&gt;&gt;6&amp;63|128),e[n++]=63&amp;o|128)}return e}(t);return(t=new F).update(e),t=t.digest(),p.encodeByteArray(t)}function ht(t,e){y(!e||!0===t||!1===t,"Can't turn on custom loggers persistently."),!0===t?(Ct.logLevel=V.VERBOSE,bt=Ct.log.bind(Ct),e&amp;&amp;mt.set("logging_enabled",!0)):"function"==typeof t?bt=t:(bt=null,mt.remove("logging_enabled"))}function lt(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];var n="FIREBASE INTERNAL ERROR: "+wt.apply(void 0,s(t));Ct.error(n)}function ut(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];var n="FIREBASE FATAL ERROR: "+wt.apply(void 0,s(t));throw Ct.error(n),new Error(n)}function ct(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];var n="FIREBASE WARNING: "+wt.apply(void 0,s(t));Ct.warn(n)}function pt(t){return"number"==typeof t&amp;&amp;(t!=t||t===Number.POSITIVE_INFINITY||t===Number.NEGATIVE_INFINITY)}function dt(t,e){return t===e?0:t&lt;e?-1:1}function ft(t,e){if(e&amp;&amp;t in e)return e[t];throw new Error("Missing required key ("+t+") in object: "+P(e))}function _t(t,e){var n=t.length;if(n&lt;=e)return[t];for(var r=[],i=0;i&lt;n;i+=e)n&lt;i+e?r.push(t.substring(i,n)):r.push(t.substring(i,i+e));return r}var yt,gt=function(t){try{if("undefined"!=typeof window&amp;&amp;void 0!==window[t]){var e=window[t];return e.setItem("firebase:sentinel","cache"),e.removeItem("firebase:sentinel"),new rt(e)}}catch(t){}return new ot},vt=gt("localStorage"),mt=gt("sessionStorage"),Ct=new Y("@firebase/database"),Et=(yt=1,function(){return yt++}),wt=function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];for(var n="",r=0;r&lt;t.length;r++){var i=t[r];Array.isArray(i)||i&amp;&amp;"object"==typeof i&amp;&amp;"number"==typeof i.length?n+=wt.apply(null,i):n+="object"==typeof i?P(i):i,n+=" "}return n},bt=null,St=!0,Tt=function(){for(var t,e=[],n=0;n&lt;arguments.length;n++)e[n]=arguments[n];!0===St&amp;&amp;(St=!1,null===bt&amp;&amp;!0===mt.get("logging_enabled")&amp;&amp;ht(!0)),bt&amp;&amp;(t=wt.apply(null,e),bt(t))},It=function(n){return function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];Tt.apply(void 0,s([n],t))}},Nt="[MIN_NAME]",Rt="[MAX_NAME]",Pt=function(t,e){if(t===e)return 0;if(t===Nt||e===Rt)return-1;if(e===Nt||t===Rt)return 1;var n=Lt(t),r=Lt(e);return null!==n?null!==r?n-r==0?t.length-e.length:n-r:-1:null===r&amp;&amp;t&lt;e?-1:1},Dt=function(t){if("object"!=typeof t||null===t)return P(t);var e,n=[];for(e in t)n.push(e);n.sort();for(var r="{",i=0;i&lt;n.length;i++)0!==i&amp;&amp;(r+=","),r+=P(n[i]),r+=":",r+=Dt(t[n[i]]);return r+="}"};function Ot(t,e){for(var n in t)t.hasOwnProperty(n)&amp;&amp;e(n,t[n])}function xt(t){var e,n,r,i;y(!pt(t),"Invalid JSON number"),0===t?e=1/t==-1/(r=n=0)?1:0:(e=t&lt;0,r=(t=Math.abs(t))&gt;=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(t)/Math.LN2),1023))+1023,Math.round(t*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,Math.round(t/Math.pow(2,-1074))));for(var o=[],s=52;s;--s)o.push(r%2?1:0),r=Math.floor(r/2);for(s=11;s;--s)o.push(n%2?1:0),n=Math.floor(n/2);o.push(e?1:0),o.reverse();var a=o.join(""),h="";for(s=0;s&lt;64;s+=8){var l=parseInt(a.substr(s,8),2).toString(16);1===l.length&amp;&amp;(l="0"+l),h+=l}return h.toLowerCase()}function kt(t){try{t()}catch(e){setTimeout((function(){var t=e.stack||"";throw ct("Exception was thrown by user callback.",t),e}),Math.floor(0))}}function At(t,e){return"object"==typeof(e=setTimeout(t,e))&amp;&amp;e.unref&amp;&amp;e.unref(),e}var Ft=new RegExp("^-?(0*)\\d{1,10}$"),Lt=function(t){if(Ft.test(t)){t=Number(t);if(-2147483648&lt;=t&amp;&amp;t&lt;=2147483647)return t}return null},Mt=(Object.defineProperty(Wt,"Empty",{get:function(){return new Wt("")},enumerable:!1,configurable:!0}),Wt.prototype.getFront=function(){return this.pieceNum_&gt;=this.pieces_.length?null:this.pieces_[this.pieceNum_]},Wt.prototype.getLength=function(){return this.pieces_.length-this.pieceNum_},Wt.prototype.popFront=function(){var t=this.pieceNum_;return t&lt;this.pieces_.length&amp;&amp;t++,new Wt(this.pieces_,t)},Wt.prototype.getBack=function(){return this.pieceNum_&lt;this.pieces_.length?this.pieces_[this.pieces_.length-1]:null},Wt.prototype.toString=function(){for(var t="",e=this.pieceNum_;e&lt;this.pieces_.length;e++)""!==this.pieces_[e]&amp;&amp;(t+="/"+this.pieces_[e]);return t||"/"},Wt.prototype.toUrlEncodedString=function(){for(var t="",e=this.pieceNum_;e&lt;this.pieces_.length;e++)""!==this.pieces_[e]&amp;&amp;(t+="/"+encodeURIComponent(String(this.pieces_[e])));return t||"/"},Wt.prototype.slice=function(t){return void 0===t&amp;&amp;(t=0),this.pieces_.slice(this.pieceNum_+t)},Wt.prototype.parent=function(){if(this.pieceNum_&gt;=this.pieces_.length)return null;for(var t=[],e=this.pieceNum_;e&lt;this.pieces_.length-1;e++)t.push(this.pieces_[e]);return new Wt(t,0)},Wt.prototype.child=function(t){for(var e=[],n=this.pieceNum_;n&lt;this.pieces_.length;n++)e.push(this.pieces_[n]);if(t instanceof Wt)for(n=t.pieceNum_;n&lt;t.pieces_.length;n++)e.push(t.pieces_[n]);else for(var r=t.split("/"),n=0;n&lt;r.length;n++)0&lt;r[n].length&amp;&amp;e.push(r[n]);return new Wt(e,0)},Wt.prototype.isEmpty=function(){return this.pieceNum_&gt;=this.pieces_.length},Wt.relativePath=function(t,e){var n=t.getFront(),r=e.getFront();if(null===n)return e;if(n===r)return Wt.relativePath(t.popFront(),e.popFront());throw new Error("INTERNAL ERROR: innerPath ("+e+") is not within outerPath ("+t+")")},Wt.comparePaths=function(t,e){for(var n=t.slice(),r=e.slice(),i=0;i&lt;n.length&amp;&amp;i&lt;r.length;i++){var o=Pt(n[i],r[i]);if(0!==o)return o}return n.length===r.length?0:n.length&lt;r.length?-1:1},Wt.prototype.equals=function(t){if(this.getLength()!==t.getLength())return!1;for(var e=this.pieceNum_,n=t.pieceNum_;e&lt;=this.pieces_.length;e++,n++)if(this.pieces_[e]!==t.pieces_[n])return!1;return!0},Wt.prototype.contains=function(t){var e=this.pieceNum_,n=t.pieceNum_;if(this.getLength()&gt;t.getLength())return!1;for(;e&lt;this.pieces_.length;){if(this.pieces_[e]!==t.pieces_[n])return!1;++e,++n}return!0},Wt);function Wt(t,e){if(void 0===e){this.pieces_=t.split("/");for(var n=0,r=0;r&lt;this.pieces_.length;r++)0&lt;this.pieces_[r].length&amp;&amp;(this.pieces_[n]=this.pieces_[r],n++);this.pieces_.length=n,this.pieceNum_=0}else this.pieces_=t,this.pieceNum_=e}var qt=(Object.defineProperty(Qt,"MAX_PATH_DEPTH",{get:function(){return 32},enumerable:!1,configurable:!0}),Object.defineProperty(Qt,"MAX_PATH_LENGTH_BYTES",{get:function(){return 768},enumerable:!1,configurable:!0}),Qt.prototype.push=function(t){0&lt;this.parts_.length&amp;&amp;(this.byteLength_+=1),this.parts_.push(t),this.byteLength_+=U(t),this.checkValid_()},Qt.prototype.pop=function(){var t=this.parts_.pop();this.byteLength_-=U(t),0&lt;this.parts_.length&amp;&amp;--this.byteLength_},Qt.prototype.checkValid_=function(){if(this.byteLength_&gt;Qt.MAX_PATH_LENGTH_BYTES)throw new Error(this.errorPrefix_+"has a key path longer than "+Qt.MAX_PATH_LENGTH_BYTES+" bytes ("+this.byteLength_+").");if(this.parts_.length&gt;Qt.MAX_PATH_DEPTH)throw new Error(this.errorPrefix_+"path specified exceeds the maximum depth that can be written ("+Qt.MAX_PATH_DEPTH+") or object contains a cycle "+this.toErrorString())},Qt.prototype.toErrorString=function(){return 0===this.parts_.length?"":"in property '"+this.parts_.join(".")+"'"},Qt);function Qt(t,e){this.errorPrefix_=e,this.parts_=t.slice(),this.byteLength_=Math.max(1,this.parts_.length);for(var n=0;n&lt;this.parts_.length;n++)this.byteLength_+=U(this.parts_[n]);this.checkValid_()}var Ut=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,Vt="websocket",Ht="long_polling",jt=(Bt.prototype.needsQueryParam=function(){return this.host!==this.internalHost||this.isCustomHost()||this.includeNamespaceInQueryParams},Bt.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},Bt.prototype.isDemoHost=function(){return"firebaseio-demo.com"===this.domain},Bt.prototype.isCustomHost=function(){return"firebaseio.com"!==this.domain&amp;&amp;"firebaseio-demo.com"!==this.domain},Bt.prototype.updateHost=function(t){t!==this.internalHost&amp;&amp;(this.internalHost=t,this.isCacheableHost()&amp;&amp;vt.set("host:"+this.host,this.internalHost))},Bt.prototype.connectionURL=function(t,e){var n;if(y("string"==typeof t,"typeof type must == string"),y("object"==typeof e,"typeof params must == object"),t===Vt)n=(this.secure?"wss://":"ws://")+this.internalHost+"/.ws?";else{if(t!==Ht)throw new Error("Unknown connection type: "+t);n=(this.secure?"https://":"http://")+this.internalHost+"/.lp?"}this.needsQueryParam()&amp;&amp;(e.ns=this.namespace);var r=[];return Ot(e,(function(t,e){r.push(t+"="+e)})),n+r.join("&amp;")},Bt.prototype.toString=function(){var t=this.toURLString();return this.persistenceKey&amp;&amp;(t+="&lt;"+this.persistenceKey+"&gt;"),t},Bt.prototype.toURLString=function(){return(this.secure?"https://":"http://")+this.host},Bt);function Bt(t,e,n,r,i,o,s){void 0===i&amp;&amp;(i=!1),void 0===o&amp;&amp;(o=""),void 0===s&amp;&amp;(s=!1),this.secure=e,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=o,this.includeNamespaceInQueryParams=s,this.host=t.toLowerCase(),this.domain=this.host.substr(this.host.indexOf(".")+1),this.internalHost=vt.get("host:"+t)||this.host}function zt(t,e){var n=ie(t),r=n.namespace;return"firebase.com"===n.domain&amp;&amp;ut(n.host+" is no longer supported. Please use &lt;YOUR FIREBASE&gt;.firebaseio.com instead"),r&amp;&amp;"undefined"!==r||"localhost"===n.domain||ut("Cannot parse Firebase url. Please use https://&lt;YOUR FIREBASE&gt;.firebaseio.com"),n.secure||"undefined"!=typeof window&amp;&amp;window.location&amp;&amp;window.location.protocol&amp;&amp;-1!==window.location.protocol.indexOf("https:")&amp;&amp;ct("Insecure Firebase access from a secure page. Please use https in calls to new Firebase()."),t="ws"===n.scheme||"wss"===n.scheme,{repoInfo:new jt(n.host,n.secure,r,e,t,"",r!==n.subdomain),path:new Mt(n.pathString)}}function Kt(t){return"string"==typeof t&amp;&amp;0!==t.length&amp;&amp;!oe.test(t)}function Yt(t){return"string"==typeof t&amp;&amp;0!==t.length&amp;&amp;!se.test(t)}function Gt(t){return null===t||"string"==typeof t||"number"==typeof t&amp;&amp;!pt(t)||t&amp;&amp;"object"==typeof t&amp;&amp;O(t,".sv")}function Xt(t,e,n,r,i){i&amp;&amp;void 0===n||he(W(t,e,i),n,r)}function $t(t,e,n,r,i){if(!i||void 0!==n){var o=W(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=[];Ot(n,(function(t,e){t=new Mt(t);if(he(o,e,r.child(t)),".priority"===t.getBack()&amp;&amp;!Gt(e))throw new Error(o+"contains an invalid value for '"+t.toString()+"', which must be a valid Firebase priority (a string, finite number, server value, or null).");s.push(t)})),function(t,e){for(var n,r=0;r&lt;e.length;r++)for(var i=(n=e[r]).slice(),o=0;o&lt;i.length;o++)if((".priority"!==i[o]||o!==i.length-1)&amp;&amp;!Kt(i[o]))throw new Error(t+"contains an invalid key ("+i[o]+") in path "+n.toString()+'. Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');e.sort(Mt.comparePaths);var s=null;for(r=0;r&lt;e.length;r++){if(n=e[r],null!==s&amp;&amp;s.contains(n))throw new Error(t+"contains a path "+s.toString()+" that is ancestor of another path "+n.toString());s=n}}(o,s)}}function Jt(t,e,n,r){if(!r||void 0!==n){if(pt(n))throw new Error(W(t,e,r)+"is "+n.toString()+", but must be a valid Firebase priority (a string, finite number, server value, or null).");if(!Gt(n))throw new Error(W(t,e,r)+"must be a valid Firebase priority (a string, finite number, server value, or null).")}}function Zt(t,e,n,r){if(!r||void 0!==n)switch(n){case"value":case"child_added":case"child_removed":case"child_changed":case"child_moved":break;default:throw new Error(W(t,e,r)+'must be a valid event type = "value", "child_added", "child_removed", "child_changed", or "child_moved".')}}function te(t,e,n,r){if(!(r&amp;&amp;void 0===n||Kt(n)))throw new Error(W(t,e,r)+'was an invalid key = "'+n+'".  Firebase keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]").')}function ee(t,e,n,r){if(!(r&amp;&amp;void 0===n||Yt(n)))throw new Error(W(t,e,r)+'was an invalid path = "'+n+'". Paths must be non-empty strings and can\'t contain ".", "#", "$", "[", or "]"')}function ne(t,e){if(".info"===e.getFront())throw new Error(t+" failed = Can't modify data under /.info/")}function re(t,e,n){var r=n.path.toString();if("string"!=typeof n.repoInfo.host||0===n.repoInfo.host.length||!Kt(n.repoInfo.namespace)&amp;&amp;"localhost"!==n.repoInfo.host.split(":")[0]||0!==r.length&amp;&amp;(r=(r=r)&amp;&amp;r.replace(/^\/*\.info(\/|$)/,"/"),!Yt(r)))throw new Error(W(t,e,!1)+'must be a valid firebase URL and the path can\'t contain ".", "#", "$", "[", or "]".')}var ie=function(t){var e,n,r,i="",o="",s="",a="",h="",l=!0,u="https",c=443;return"string"==typeof t&amp;&amp;(0&lt;=(r=t.indexOf("//"))&amp;&amp;(u=t.substring(0,r-1),t=t.substring(r+2)),-1===(e=t.indexOf("/"))&amp;&amp;(e=t.length),-1===(n=t.indexOf("?"))&amp;&amp;(n=t.length),i=t.substring(0,Math.min(e,n)),e&lt;n&amp;&amp;(a=function(t){for(var e="",n=t.split("/"),r=0;r&lt;n.length;r++)if(0&lt;n[r].length){var i=n[r];try{i=decodeURIComponent(i.replace(/\+/g," "))}catch(t){}e+="/"+i}return e}(t.substring(e,n))),n=function(t){var e,n,r={};"?"===t.charAt(0)&amp;&amp;(t=t.substring(1));try{for(var i=f(t.split("&amp;")),o=i.next();!o.done;o=i.next()){var s,a=o.value;0!==a.length&amp;&amp;(2===(s=a.split("=")).length?r[decodeURIComponent(s[0])]=decodeURIComponent(s[1]):ct("Invalid query segment '"+a+"' in query '"+t+"'"))}}catch(t){e={error:t}}finally{try{o&amp;&amp;!o.done&amp;&amp;(n=i.return)&amp;&amp;n.call(i)}finally{if(e)throw e.error}}return r}(t.substring(Math.min(t.length,n))),0&lt;=(r=i.indexOf(":"))?(l="https"===u||"wss"===u,c=parseInt(i.substring(r+1),10)):r=i.length,"localhost"===(r=i.slice(0,r)).toLowerCase()?o="localhost":r.split(".").length&lt;=2?o=r:(r=i.indexOf("."),s=i.substring(0,r).toLowerCase(),o=i.substring(r+1),h=s),"ns"in n&amp;&amp;(h=n.ns)),{host:i,port:c,domain:o,subdomain:s,secure:l,scheme:u,pathString:a,namespace:h}},oe=/[\[\].#$\/\u0000-\u001F\u007F]/,se=/[\[\].#$\u0000-\u001F\u007F]/,ae=10485760,he=function(n,t,e){var r=e instanceof Mt?new qt(e,n):e;if(void 0===t)throw new Error(n+"contains undefined "+r.toErrorString());if("function"==typeof t)throw new Error(n+"contains a function "+r.toErrorString()+" with contents = "+t.toString());if(pt(t))throw new Error(n+"contains "+t.toString()+" "+r.toErrorString());if("string"==typeof t&amp;&amp;t.length&gt;ae/3&amp;&amp;U(t)&gt;ae)throw new Error(n+"contains a string greater than "+ae+" utf8 bytes "+r.toErrorString()+" ('"+t.substring(0,50)+"...')");if(t&amp;&amp;"object"==typeof t){var i=!1,o=!1;if(Ot(t,(function(t,e){if(".value"===t)i=!0;else if(".priority"!==t&amp;&amp;".sv"!==t&amp;&amp;(o=!0,!Kt(t)))throw new Error(n+" contains an invalid key ("+t+") "+r.toErrorString()+'.  Keys must be non-empty strings and can\'t contain ".", "#", "$", "/", "[", or "]"');r.push(t),he(n,e,r),r.pop()})),i&amp;&amp;o)throw new Error(n+' contains ".value" child '+r.toErrorString()+" in addition to actual children.")}},le=(ue.prototype.cancel=function(t){M("OnDisconnect.cancel",0,1,arguments.length),q("OnDisconnect.cancel",1,t,!0);var e=new g;return this.repo_.onDisconnectCancel(this.path_,e.wrapCallback(t)),e.promise},ue.prototype.remove=function(t){M("OnDisconnect.remove",0,1,arguments.length),ne("OnDisconnect.remove",this.path_),q("OnDisconnect.remove",1,t,!0);var e=new g;return this.repo_.onDisconnectSet(this.path_,null,e.wrapCallback(t)),e.promise},ue.prototype.set=function(t,e){M("OnDisconnect.set",1,2,arguments.length),ne("OnDisconnect.set",this.path_),Xt("OnDisconnect.set",1,t,this.path_,!1),q("OnDisconnect.set",2,e,!0);var n=new g;return this.repo_.onDisconnectSet(this.path_,t,n.wrapCallback(e)),n.promise},ue.prototype.setWithPriority=function(t,e,n){M("OnDisconnect.setWithPriority",2,3,arguments.length),ne("OnDisconnect.setWithPriority",this.path_),Xt("OnDisconnect.setWithPriority",1,t,this.path_,!1),Jt("OnDisconnect.setWithPriority",2,e,!1),q("OnDisconnect.setWithPriority",3,n,!0);var r=new g;return this.repo_.onDisconnectSetWithPriority(this.path_,t,e,r.wrapCallback(n)),r.promise},ue.prototype.update=function(t,e){if(M("OnDisconnect.update",1,2,arguments.length),ne("OnDisconnect.update",this.path_),Array.isArray(t)){for(var n={},r=0;r&lt;t.length;++r)n[""+r]=t[r];t=n,ct("Passing an Array to firebase.database.onDisconnect().update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}$t("OnDisconnect.update",1,t,this.path_,!1),q("OnDisconnect.update",2,e,!0);var i=new g;return this.repo_.onDisconnectUpdate(this.path_,t,i.wrapCallback(e)),i.promise},ue);function ue(t,e){this.repo_=t,this.path_=e}var ce=(pe.prototype.toJSON=function(){return M("TransactionResult.toJSON",0,1,arguments.length),{committed:this.committed,snapshot:this.snapshot.toJSON()}},pe);function pe(t,e){this.committed=t,this.snapshot=e}var de,fe,_e,ye=(de="-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz",fe=0,_e=[],function(t){var e=t===fe;fe=t;for(var n=new Array(8),r=7;0&lt;=r;r--)n[r]=de.charAt(t%64),t=Math.floor(t/64);y(0===t,"Cannot push at time == 0");var i=n.join("");if(e){for(r=11;0&lt;=r&amp;&amp;63===_e[r];r--)_e[r]=0;_e[r]++}else for(r=0;r&lt;12;r++)_e[r]=Math.floor(64*Math.random());for(r=0;r&lt;12;r++)i+=de.charAt(_e[r]);return y(20===i.length,"nextPushId: Length should be 20."),i}),ge=(ve.Wrap=function(t,e){return new ve(t,e)},ve);function ve(t,e){this.name=t,this.node=e}var me,Ce=(Ee.prototype.getCompare=function(){return this.compare.bind(this)},Ee.prototype.indexedValueChanged=function(t,e){t=new ge(Nt,t),e=new ge(Nt,e);return 0!==this.compare(t,e)},Ee.prototype.minPost=function(){return ge.MIN},Ee);function Ee(){}var we,gt=(n(be,we=Ce),Object.defineProperty(be,"__EMPTY_NODE",{get:function(){return me},set:function(t){me=t},enumerable:!1,configurable:!0}),be.prototype.compare=function(t,e){return Pt(t.name,e.name)},be.prototype.isDefinedOn=function(t){throw c("KeyIndex.isDefinedOn not expected to be called.")},be.prototype.indexedValueChanged=function(t,e){return!1},be.prototype.minPost=function(){return ge.MIN},be.prototype.maxPost=function(){return new ge(Rt,me)},be.prototype.makePost=function(t,e){return y("string"==typeof t,"KeyIndex indexValue must always be a string."),new ge(t,me)},be.prototype.toString=function(){return".key"},be);function be(){return null!==we&amp;&amp;we.apply(this,arguments)||this}var Se,Te=new gt;function Ie(t){return"number"==typeof t?"number:"+xt(t):"string:"+t}var Ne,Re,Pe,De,Oe=function(t){var e;t.isLeafNode()?(e=t.val(),y("string"==typeof e||"number"==typeof e||"object"==typeof e&amp;&amp;O(e,".sv"),"Priority must be a string or number.")):y(t===Se||t.isEmpty(),"priority of unexpected type."),y(t===Se||t.getPriority().isEmpty(),"Priority nodes can't have a priority of their own.")},xe=(Object.defineProperty(ke,"__childrenNodeConstructor",{get:function(){return Ne},set:function(t){Ne=t},enumerable:!1,configurable:!0}),ke.prototype.isLeafNode=function(){return!0},ke.prototype.getPriority=function(){return this.priorityNode_},ke.prototype.updatePriority=function(t){return new ke(this.value_,t)},ke.prototype.getImmediateChild=function(t){return".priority"===t?this.priorityNode_:ke.__childrenNodeConstructor.EMPTY_NODE},ke.prototype.getChild=function(t){return t.isEmpty()?this:".priority"===t.getFront()?this.priorityNode_:ke.__childrenNodeConstructor.EMPTY_NODE},ke.prototype.hasChild=function(){return!1},ke.prototype.getPredecessorChildName=function(t,e){return null},ke.prototype.updateImmediateChild=function(t,e){return".priority"===t?this.updatePriority(e):e.isEmpty()&amp;&amp;".priority"!==t?this:ke.__childrenNodeConstructor.EMPTY_NODE.updateImmediateChild(t,e).updatePriority(this.priorityNode_)},ke.prototype.updateChild=function(t,e){var n=t.getFront();return null===n?e:e.isEmpty()&amp;&amp;".priority"!==n?this:(y(".priority"!==n||1===t.getLength(),".priority must be the last token in a path"),this.updateImmediateChild(n,ke.__childrenNodeConstructor.EMPTY_NODE.updateChild(t.popFront(),e)))},ke.prototype.isEmpty=function(){return!1},ke.prototype.numChildren=function(){return 0},ke.prototype.forEachChild=function(t,e){return!1},ke.prototype.val=function(t){return t&amp;&amp;!this.getPriority().isEmpty()?{".value":this.getValue(),".priority":this.getPriority().val()}:this.getValue()},ke.prototype.hash=function(){var t,e;return null===this.lazyHash_&amp;&amp;(t="",this.priorityNode_.isEmpty()||(t+="priority:"+Ie(this.priorityNode_.val())+":"),t+=(e=typeof this.value_)+":",t+="number"==e?xt(this.value_):this.value_,this.lazyHash_=at(t)),this.lazyHash_},ke.prototype.getValue=function(){return this.value_},ke.prototype.compareTo=function(t){return t===ke.__childrenNodeConstructor.EMPTY_NODE?1:t instanceof ke.__childrenNodeConstructor?-1:(y(t.isLeafNode(),"Unknown node type"),this.compareToLeafNode_(t))},ke.prototype.compareToLeafNode_=function(t){var e=typeof t.value_,n=typeof this.value_,r=ke.VALUE_TYPE_ORDER.indexOf(e),i=ke.VALUE_TYPE_ORDER.indexOf(n);return y(0&lt;=r,"Unknown leaf type: "+e),y(0&lt;=i,"Unknown leaf type: "+n),r===i?"object"==n?0:this.value_&lt;t.value_?-1:this.value_===t.value_?0:1:i-r},ke.prototype.withIndex=function(){return this},ke.prototype.isIndexed=function(){return!0},ke.prototype.equals=function(t){return t===this||!!t.isLeafNode()&amp;&amp;(this.value_===t.value_&amp;&amp;this.priorityNode_.equals(t.priorityNode_))},ke.VALUE_TYPE_ORDER=["object","boolean","number","string"],ke);function ke(t,e){void 0===e&amp;&amp;(e=ke.__childrenNodeConstructor.EMPTY_NODE),this.value_=t,this.priorityNode_=e,this.lazyHash_=null,y(void 0!==this.value_&amp;&amp;null!==this.value_,"LeafNode shouldn't be created with null/undefined value."),Oe(this.priorityNode_)}function Ae(){return null!==De&amp;&amp;De.apply(this,arguments)||this}var Fe=new(n(Ae,De=Ce),Ae.prototype.compare=function(t,e){var n=t.node.getPriority(),r=e.node.getPriority(),r=n.compareTo(r);return 0===r?Pt(t.name,e.name):r},Ae.prototype.isDefinedOn=function(t){return!t.getPriority().isEmpty()},Ae.prototype.indexedValueChanged=function(t,e){return!t.getPriority().equals(e.getPriority())},Ae.prototype.minPost=function(){return ge.MIN},Ae.prototype.maxPost=function(){return new ge(Rt,new xe("[PRIORITY-POST]",Pe))},Ae.prototype.makePost=function(t,e){t=Re(t);return new ge(e,new xe("[PRIORITY-POST]",t))},Ae.prototype.toString=function(){return".priority"},Ae),Le=(Me.prototype.getNext=function(){if(0===this.nodeStack_.length)return null;var t=this.nodeStack_.pop(),e=this.resultGenerator_?this.resultGenerator_(t.key,t.value):{key:t.key,value:t.value};if(this.isReverse_)for(t=t.left;!t.isEmpty();)this.nodeStack_.push(t),t=t.right;else for(t=t.right;!t.isEmpty();)this.nodeStack_.push(t),t=t.left;return e},Me.prototype.hasNext=function(){return 0&lt;this.nodeStack_.length},Me.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}},Me);function Me(t,e,n,r,i){void 0===i&amp;&amp;(i=null),this.isReverse_=r,this.resultGenerator_=i,this.nodeStack_=[];for(var o=1;!t.isEmpty();)if(o=e?n(t.key,e):1,r&amp;&amp;(o*=-1),o&lt;0)t=this.isReverse_?t.left:t.right;else{if(0===o){this.nodeStack_.push(t);break}this.nodeStack_.push(t),t=this.isReverse_?t.right:t.left}}var We=(qe.prototype.copy=function(t,e,n,r,i){return new qe(null!=t?t:this.key,null!=e?e:this.value,null!=n?n:this.color,null!=r?r:this.left,null!=i?i:this.right)},qe.prototype.count=function(){return this.left.count()+1+this.right.count()},qe.prototype.isEmpty=function(){return!1},qe.prototype.inorderTraversal=function(t){return this.left.inorderTraversal(t)||!!t(this.key,this.value)||this.right.inorderTraversal(t)},qe.prototype.reverseTraversal=function(t){return this.right.reverseTraversal(t)||t(this.key,this.value)||this.left.reverseTraversal(t)},qe.prototype.min_=function(){return this.left.isEmpty()?this:this.left.min_()},qe.prototype.minKey=function(){return this.min_().key},qe.prototype.maxKey=function(){return this.right.isEmpty()?this.key:this.right.maxKey()},qe.prototype.insert=function(t,e,n){var r=this,i=n(t,r.key);return(r=i&lt;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_()},qe.prototype.removeMin_=function(){if(this.left.isEmpty())return Ue.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_()},qe.prototype.remove=function(t,e){var n,r=this;if(e(t,r.key)&lt;0)r.left.isEmpty()||r.left.isRed_()||r.left.left.isRed_()||(r=r.moveRedLeft_()),r=r.copy(null,null,null,r.left.remove(t,e),null);else{if(r.left.isRed_()&amp;&amp;(r=r.rotateRight_()),r.right.isEmpty()||r.right.isRed_()||r.right.left.isRed_()||(r=r.moveRedRight_()),0===e(t,r.key)){if(r.right.isEmpty())return Ue.EMPTY_NODE;n=r.right.min_(),r=r.copy(n.key,n.value,null,null,r.right.removeMin_())}r=r.copy(null,null,null,null,r.right.remove(t,e))}return r.fixUp_()},qe.prototype.isRed_=function(){return this.color},qe.prototype.fixUp_=function(){var t=this;return t.right.isRed_()&amp;&amp;!t.left.isRed_()&amp;&amp;(t=t.rotateLeft_()),t.left.isRed_()&amp;&amp;t.left.left.isRed_()&amp;&amp;(t=t.rotateRight_()),t.left.isRed_()&amp;&amp;t.right.isRed_()&amp;&amp;(t=t.colorFlip_()),t},qe.prototype.moveRedLeft_=function(){var t=this.colorFlip_();return t.right.left.isRed_()&amp;&amp;(t=(t=(t=t.copy(null,null,null,null,t.right.rotateRight_())).rotateLeft_()).colorFlip_()),t},qe.prototype.moveRedRight_=function(){var t=this.colorFlip_();return t.left.left.isRed_()&amp;&amp;(t=(t=t.rotateRight_()).colorFlip_()),t},qe.prototype.rotateLeft_=function(){var t=this.copy(null,null,qe.RED,null,this.right.left);return this.right.copy(null,null,this.color,t,null)},qe.prototype.rotateRight_=function(){var t=this.copy(null,null,qe.RED,this.left.right,null);return this.left.copy(null,null,this.color,null,t)},qe.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)},qe.prototype.checkMaxDepth_=function(){var t=this.check_();return Math.pow(2,t)&lt;=this.count()+1},qe.prototype.check_=function(){if(this.isRed_()&amp;&amp;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)},qe.RED=!0,qe.BLACK=!1,qe);function qe(t,e,n,r,i){this.key=t,this.value=e,this.color=null!=n?n:qe.RED,this.left=null!=r?r:Ue.EMPTY_NODE,this.right=null!=i?i:Ue.EMPTY_NODE}Qe.prototype.copy=function(t,e,n,r,i){return this},Qe.prototype.insert=function(t,e,n){return new We(t,e,null)},Qe.prototype.remove=function(t,e){return this},Qe.prototype.count=function(){return 0},Qe.prototype.isEmpty=function(){return!0},Qe.prototype.inorderTraversal=function(t){return!1},Qe.prototype.reverseTraversal=function(t){return!1},Qe.prototype.minKey=function(){return null},Qe.prototype.maxKey=function(){return null},Qe.prototype.check_=function(){return 0},Qe.prototype.isRed_=function(){return!1},Y=Qe;function Qe(){}var Ue=(Ve.prototype.insert=function(t,e){return new Ve(this.comparator_,this.root_.insert(t,e,this.comparator_).copy(null,null,We.BLACK,null,null))},Ve.prototype.remove=function(t){return new Ve(this.comparator_,this.root_.remove(t,this.comparator_).copy(null,null,We.BLACK,null,null))},Ve.prototype.get=function(t){for(var e,n=this.root_;!n.isEmpty();){if(0===(e=this.comparator_(t,n.key)))return n.value;e&lt;0?n=n.left:0&lt;e&amp;&amp;(n=n.right)}return null},Ve.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&lt;0?n=n.left:0&lt;e&amp;&amp;(n=(r=n).right)}throw new Error("Attempted to find predecessor key for a nonexistent key.  What gives?")},Ve.prototype.isEmpty=function(){return this.root_.isEmpty()},Ve.prototype.count=function(){return this.root_.count()},Ve.prototype.minKey=function(){return this.root_.minKey()},Ve.prototype.maxKey=function(){return this.root_.maxKey()},Ve.prototype.inorderTraversal=function(t){return this.root_.inorderTraversal(t)},Ve.prototype.reverseTraversal=function(t){return this.root_.reverseTraversal(t)},Ve.prototype.getIterator=function(t){return new Le(this.root_,null,this.comparator_,!1,t)},Ve.prototype.getIteratorFrom=function(t,e){return new Le(this.root_,t,this.comparator_,!1,e)},Ve.prototype.getReverseIteratorFrom=function(t,e){return new Le(this.root_,t,this.comparator_,!0,e)},Ve.prototype.getReverseIterator=function(t){return new Le(this.root_,null,this.comparator_,!0,t)},Ve.EMPTY_NODE=new Y,Ve);function Ve(t,e){void 0===e&amp;&amp;(e=Ve.EMPTY_NODE),this.comparator_=t,this.root_=e}var He=Math.log(2),je=(Be.prototype.nextBitIsOne=function(){var t=!(this.bits_&amp;1&lt;&lt;this.current_);return this.current_--,t},Be);function Be(t){var e;this.count=(e=t+1,parseInt(Math.log(e)/He,10)),this.current_=this.count-1;var n,r=(n=this.count,parseInt(Array(n+1).join("1"),2));this.bits_=t+1&amp;r}var ze,Ke,Ye=function(l,t,u,e){l.sort(t);var c=function(t,e){var n=e-t;if(0==n)return null;if(1==n)return r=l[t],i=u?u(r):r,new We(i,r.node,We.BLACK,null,null);var n=parseInt(n/2,10)+t,t=c(t,n),e=c(n+1,e),r=l[n],i=u?u(r):r;return new We(i,r.node,We.BLACK,t,e)},n=function(t){for(var e=null,n=null,i=l.length,r=function(t,e){var n=i-t,r=i;i-=t;t=c(1+n,r),r=l[n],n=u?u(r):r;o(new We(n,r.node,e,null,t))},o=function(t){e=e?e.left=t:n=t},s=0;s&lt;t.count;++s){var a=t.nextBitIsOne(),h=Math.pow(2,t.count-(s+1));a?r(h,We.BLACK):(r(h,We.BLACK),r(h,We.RED))}return n}(new je(l.length));return new Ue(e||t,n)},Ge={},Xe=(Object.defineProperty($e,"Default",{get:function(){return y(Fe,"ChildrenNode.ts has not been loaded"),ze=ze||new $e({".priority":Ge},{".priority":Fe})},enumerable:!1,configurable:!0}),$e.prototype.get=function(t){var e=x(this.indexes_,t);if(!e)throw new Error("No index defined for "+t);return e instanceof Ue?e:null},$e.prototype.hasIndex=function(t){return O(this.indexSet_,t.toString())},$e.prototype.addIndex=function(t,e){y(t!==Te,"KeyIndex always exists and isn't meant to be added to the IndexMap.");for(var n,r=[],i=!1,o=e.getIterator(ge.Wrap),s=o.getNext();s;)i=i||t.isDefinedOn(s.node),r.push(s),s=o.getNext();n=i?Ye(r,t.getCompare()):Ge;var a=t.toString(),h=l({},this.indexSet_);h[a]=t;e=l({},this.indexes_);return e[a]=n,new $e(e,h)},$e.prototype.addToIndexes=function(s,a){var h=this;return new $e(A(this.indexes_,(function(t,e){var n=x(h.indexSet_,e);if(y(n,"Missing index implementation for "+e),t===Ge){if(n.isDefinedOn(s.node)){for(var r=[],i=a.getIterator(ge.Wrap),o=i.getNext();o;)o.name!==s.name&amp;&amp;r.push(o),o=i.getNext();return r.push(s),Ye(r,n.getCompare())}return Ge}n=a.get(s.name);return n&amp;&amp;(t=t.remove(new ge(s.name,n))),t.insert(s,s.node)})),this.indexSet_)},$e.prototype.removeFromIndexes=function(n,r){return new $e(A(this.indexes_,(function(t){if(t===Ge)return t;var e=r.get(n.name);return e?t.remove(new ge(n.name,e)):t})),this.indexSet_)},$e);function $e(t,e){this.indexes_=t,this.indexSet_=e}function Je(t,e){return Pt(t.name,e.name)}function Ze(t,e){return Pt(t,e)}var tn,en=(Object.defineProperty(nn,"EMPTY_NODE",{get:function(){return Ke=Ke||new nn(new Ue(Ze),null,Xe.Default)},enumerable:!1,configurable:!0}),nn.prototype.isLeafNode=function(){return!1},nn.prototype.getPriority=function(){return this.priorityNode_||Ke},nn.prototype.updatePriority=function(t){return this.children_.isEmpty()?this:new nn(this.children_,t,this.indexMap_)},nn.prototype.getImmediateChild=function(t){if(".priority"===t)return this.getPriority();t=this.children_.get(t);return null===t?Ke:t},nn.prototype.getChild=function(t){var e=t.getFront();return null===e?this:this.getImmediateChild(e).getChild(t.popFront())},nn.prototype.hasChild=function(t){return null!==this.children_.get(t)},nn.prototype.updateImmediateChild=function(t,e){if(y(e,"We should always be passing snapshot nodes"),".priority"===t)return this.updatePriority(e);var n=new ge(t,e),r=void 0,i=void 0,i=e.isEmpty()?(r=this.children_.remove(t),this.indexMap_.removeFromIndexes(n,this.children_)):(r=this.children_.insert(t,e),this.indexMap_.addToIndexes(n,this.children_)),n=r.isEmpty()?Ke:this.priorityNode_;return new nn(r,n,i)},nn.prototype.updateChild=function(t,e){var n=t.getFront();if(null===n)return e;y(".priority"!==t.getFront()||1===t.getLength(),".priority must be the last token in a path");e=this.getImmediateChild(n).updateChild(t.popFront(),e);return this.updateImmediateChild(n,e)},nn.prototype.isEmpty=function(){return this.children_.isEmpty()},nn.prototype.numChildren=function(){return this.children_.count()},nn.prototype.val=function(n){if(this.isEmpty())return null;var r={},i=0,o=0,s=!0;if(this.forEachChild(Fe,(function(t,e){r[t]=e.val(n),i++,s&amp;&amp;nn.INTEGER_REGEXP_.test(t)?o=Math.max(o,Number(t)):s=!1})),!n&amp;&amp;s&amp;&amp;o&lt;2*i){var t,e=[];for(t in r)e[t]=r[t];return e}return n&amp;&amp;!this.getPriority().isEmpty()&amp;&amp;(r[".priority"]=this.getPriority().val()),r},nn.prototype.hash=function(){var n;return null===this.lazyHash_&amp;&amp;(n="",this.getPriority().isEmpty()||(n+="priority:"+Ie(this.getPriority().val())+":"),this.forEachChild(Fe,(function(t,e){e=e.hash();""!==e&amp;&amp;(n+=":"+t+":"+e)})),this.lazyHash_=""===n?"":at(n)),this.lazyHash_},nn.prototype.getPredecessorChildName=function(t,e,n){n=this.resolveIndex_(n);if(n){e=n.getPredecessorKey(new ge(t,e));return e?e.name:null}return this.children_.getPredecessorKey(t)},nn.prototype.getFirstChildName=function(t){t=this.resolveIndex_(t);if(t){t=t.minKey();return t&amp;&amp;t.name}return this.children_.minKey()},nn.prototype.getFirstChild=function(t){t=this.getFirstChildName(t);return t?new ge(t,this.children_.get(t)):null},nn.prototype.getLastChildName=function(t){t=this.resolveIndex_(t);if(t){t=t.maxKey();return t&amp;&amp;t.name}return this.children_.maxKey()},nn.prototype.getLastChild=function(t){t=this.getLastChildName(t);return t?new ge(t,this.children_.get(t)):null},nn.prototype.forEachChild=function(t,e){t=this.resolveIndex_(t);return t?t.inorderTraversal((function(t){return e(t.name,t.node)})):this.children_.inorderTraversal(e)},nn.prototype.getIterator=function(t){return this.getIteratorFrom(t.minPost(),t)},nn.prototype.getIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getIteratorFrom(t,(function(t){return t}));for(var r=this.children_.getIteratorFrom(t.name,ge.Wrap),i=r.peek();null!=i&amp;&amp;e.compare(i,t)&lt;0;)r.getNext(),i=r.peek();return r},nn.prototype.getReverseIterator=function(t){return this.getReverseIteratorFrom(t.maxPost(),t)},nn.prototype.getReverseIteratorFrom=function(t,e){var n=this.resolveIndex_(e);if(n)return n.getReverseIteratorFrom(t,(function(t){return t}));for(var r=this.children_.getReverseIteratorFrom(t.name,ge.Wrap),i=r.peek();null!=i&amp;&amp;0&lt;e.compare(i,t);)r.getNext(),i=r.peek();return r},nn.prototype.compareTo=function(t){return this.isEmpty()?t.isEmpty()?0:-1:t.isLeafNode()||t.isEmpty()?1:t===on?-1:0},nn.prototype.withIndex=function(t){if(t===Te||this.indexMap_.hasIndex(t))return this;t=this.indexMap_.addIndex(t,this.children_);return new nn(this.children_,this.priorityNode_,t)},nn.prototype.isIndexed=function(t){return t===Te||this.indexMap_.hasIndex(t)},nn.prototype.equals=function(t){if(t===this)return!0;if(t.isLeafNode())return!1;if(this.getPriority().equals(t.getPriority())){if(this.children_.count()!==t.children_.count())return!1;for(var e=this.getIterator(Fe),n=t.getIterator(Fe),r=e.getNext(),i=n.getNext();r&amp;&amp;i;){if(r.name!==i.name||!r.node.equals(i.node))return!1;r=e.getNext(),i=n.getNext()}return null===r&amp;&amp;null===i}return!1},nn.prototype.resolveIndex_=function(t){return t===Te?null:this.indexMap_.get(t.toString())},nn.INTEGER_REGEXP_=/^(0|[1-9]\d*)$/,nn);function nn(t,e,n){this.children_=t,this.priorityNode_=e,this.indexMap_=n,this.lazyHash_=null,this.priorityNode_&amp;&amp;Oe(this.priorityNode_),this.children_.isEmpty()&amp;&amp;y(!this.priorityNode_||this.priorityNode_.isEmpty(),"An empty node cannot have a priority")}function rn(){return tn.call(this,new Ue(Ze),en.EMPTY_NODE,Xe.Default)||this}var on=new(n(rn,tn=en),rn.prototype.compareTo=function(t){return t===this?0:1},rn.prototype.equals=function(t){return t===this},rn.prototype.getPriority=function(){return this},rn.prototype.getImmediateChild=function(t){return en.EMPTY_NODE},rn.prototype.isEmpty=function(){return!1},rn);Object.defineProperties(ge,{MIN:{value:new ge(Nt,en.EMPTY_NODE)},MAX:{value:new ge(Rt,on)}}),gt.__EMPTY_NODE=en.EMPTY_NODE,xe.__childrenNodeConstructor=en,Se=on,Pe=on;var sn,an=!0;function hn(n,t){if(void 0===t&amp;&amp;(t=null),null===n)return en.EMPTY_NODE;if("object"==typeof n&amp;&amp;".priority"in n&amp;&amp;(t=n[".priority"]),y(null===t||"string"==typeof t||"number"==typeof t||"object"==typeof t&amp;&amp;".sv"in t,"Invalid priority type found: "+typeof t),"object"==typeof n&amp;&amp;".value"in n&amp;&amp;null!==n[".value"]&amp;&amp;(n=n[".value"]),"object"!=typeof n||".sv"in n)return new xe(n,hn(t));if(n instanceof Array||!an){var r=en.EMPTY_NODE;return Ot(n,(function(t,e){O(n,t)&amp;&amp;"."!==t.substring(0,1)&amp;&amp;(!(e=hn(e)).isLeafNode()&amp;&amp;e.isEmpty()||(r=r.updateImmediateChild(t,e)))})),r.updatePriority(hn(t))}var i=[],o=!1;if(Ot(n,(function(t,e){"."!==t.substring(0,1)&amp;&amp;((e=hn(e)).isEmpty()||(o=o||!e.getPriority().isEmpty(),i.push(new ge(t,e))))})),0===i.length)return en.EMPTY_NODE;var e=Ye(i,Je,(function(t){return t.name}),Ze);if(o){var s=Ye(i,Fe.getCompare());return new en(e,hn(t),new Xe({".priority":s},{".priority":Fe}))}return new en(e,hn(t),Xe.Default)}function ln(){return null!==sn&amp;&amp;sn.apply(this,arguments)||this}Re=hn;var un,cn=new(n(ln,sn=Ce),ln.prototype.compare=function(t,e){var n=t.node.compareTo(e.node);return 0===n?Pt(t.name,e.name):n},ln.prototype.isDefinedOn=function(t){return!0},ln.prototype.indexedValueChanged=function(t,e){return!t.equals(e)},ln.prototype.minPost=function(){return ge.MIN},ln.prototype.maxPost=function(){return ge.MAX},ln.prototype.makePost=function(t,e){t=hn(t);return new ge(e,t)},ln.prototype.toString=function(){return".value"},ln),pn=(n(dn,un=Ce),dn.prototype.extractChild=function(t){return t.getChild(this.indexPath_)},dn.prototype.isDefinedOn=function(t){return!t.getChild(this.indexPath_).isEmpty()},dn.prototype.compare=function(t,e){var n=this.extractChild(t.node),r=this.extractChild(e.node),r=n.compareTo(r);return 0===r?Pt(t.name,e.name):r},dn.prototype.makePost=function(t,e){t=hn(t),t=en.EMPTY_NODE.updateChild(this.indexPath_,t);return new ge(e,t)},dn.prototype.maxPost=function(){var t=en.EMPTY_NODE.updateChild(this.indexPath_,on);return new ge(Rt,t)},dn.prototype.toString=function(){return this.indexPath_.slice().join("/")},dn);function dn(t){var e=un.call(this)||this;return e.indexPath_=t,y(!t.isEmpty()&amp;&amp;".priority"!==t.getFront(),"Can't create PathIndex with empty path or .priority key"),e}var fn=(_n.prototype.val=function(){return M("DataSnapshot.val",0,0,arguments.length),this.node_.val()},_n.prototype.exportVal=function(){return M("DataSnapshot.exportVal",0,0,arguments.length),this.node_.val(!0)},_n.prototype.toJSON=function(){return M("DataSnapshot.toJSON",0,1,arguments.length),this.exportVal()},_n.prototype.exists=function(){return M("DataSnapshot.exists",0,0,arguments.length),!this.node_.isEmpty()},_n.prototype.child=function(t){M("DataSnapshot.child",0,1,arguments.length),t=String(t),ee("DataSnapshot.child",1,t,!1);var e=new Mt(t),t=this.ref_.child(e);return new _n(this.node_.getChild(e),t,Fe)},_n.prototype.hasChild=function(t){M("DataSnapshot.hasChild",1,1,arguments.length),ee("DataSnapshot.hasChild",1,t,!1);t=new Mt(t);return!this.node_.getChild(t).isEmpty()},_n.prototype.getPriority=function(){return M("DataSnapshot.getPriority",0,0,arguments.length),this.node_.getPriority().val()},_n.prototype.forEach=function(n){var r=this;return M("DataSnapshot.forEach",1,1,arguments.length),q("DataSnapshot.forEach",1,n,!1),!this.node_.isLeafNode()&amp;&amp;!!this.node_.forEachChild(this.index_,(function(t,e){return n(new _n(e,r.ref_.child(t),Fe))}))},_n.prototype.hasChildren=function(){return M("DataSnapshot.hasChildren",0,0,arguments.length),!this.node_.isLeafNode()&amp;&amp;!this.node_.isEmpty()},Object.defineProperty(_n.prototype,"key",{get:function(){return this.ref_.getKey()},enumerable:!1,configurable:!0}),_n.prototype.numChildren=function(){return M("DataSnapshot.numChildren",0,0,arguments.length),this.node_.numChildren()},_n.prototype.getRef=function(){return M("DataSnapshot.ref",0,0,arguments.length),this.ref_},Object.defineProperty(_n.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),_n);function _n(t,e,n){this.node_=t,this.ref_=e,this.index_=n}var yn=(gn.prototype.getPath=function(){var t=this.snapshot.getRef();return("value"===this.eventType?t:t.getParent()).path},gn.prototype.getEventType=function(){return this.eventType},gn.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},gn.prototype.toString=function(){return this.getPath().toString()+":"+this.eventType+":"+P(this.snapshot.exportVal())},gn);function gn(t,e,n,r){this.eventType=t,this.eventRegistration=e,this.snapshot=n,this.prevName=r}var vn=(mn.prototype.getPath=function(){return this.path},mn.prototype.getEventType=function(){return"cancel"},mn.prototype.getEventRunner=function(){return this.eventRegistration.getEventRunner(this)},mn.prototype.toString=function(){return this.path.toString()+":cancel"},mn);function mn(t,e,n){this.eventRegistration=t,this.error=e,this.path=n}var Cn=(En.prototype.respondsTo=function(t){return"value"===t},En.prototype.createEvent=function(t,e){var n=e.getQueryParams().getIndex();return new yn("value",this,new fn(t.snapshotNode,e.getRef(),n))},En.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){y(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)}},En.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new vn(this,t,e):null},En.prototype.matches=function(t){return t instanceof En&amp;&amp;(!t.callback_||!this.callback_||t.callback_===this.callback_&amp;&amp;t.context_===this.context_)},En.prototype.hasAnyCallback=function(){return null!==this.callback_},En);function En(t,e,n){this.callback_=t,this.cancelCallback_=e,this.context_=n}var wn,bn=(Sn.prototype.respondsTo=function(t){t="children_removed"===(t="children_added"===t?"child_added":t)?"child_removed":t;return O(this.callbacks_,t)},Sn.prototype.createCancelEvent=function(t,e){return this.cancelCallback_?new vn(this,t,e):null},Sn.prototype.createEvent=function(t,e){y(null!=t.childName,"Child events should have a childName.");var n=e.getRef().child(t.childName),e=e.getQueryParams().getIndex();return new yn(t.type,this,new fn(t.snapshotNode,n,e),t.prevName)},Sn.prototype.getEventRunner=function(t){var e=this.context_;if("cancel"===t.getEventType()){y(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)}},Sn.prototype.matches=function(e){var n=this;if(e instanceof Sn){if(!this.callbacks_||!e.callbacks_)return!0;if(this.context_===e.context_){var t=Object.keys(e.callbacks_),r=Object.keys(this.callbacks_),i=t.length;if(i===r.length){if(1!==i)return r.every((function(t){return e.callbacks_[t]===n.callbacks_[t]}));t=t[0],r=r[0];return!(r!==t||e.callbacks_[t]&amp;&amp;this.callbacks_[r]&amp;&amp;e.callbacks_[t]!==this.callbacks_[r])}}}return!1},Sn.prototype.hasAnyCallback=function(){return null!==this.callbacks_},Sn);function Sn(t,e,n){this.callbacks_=t,this.cancelCallback_=e,this.context_=n}var Tn=(Object.defineProperty(In,"__referenceConstructor",{get:function(){return y(wn,"Reference.ts has not been loaded"),wn},set:function(t){wn=t},enumerable:!1,configurable:!0}),In.validateQueryEndpoints_=function(t){var e=null,n=null;if(t.hasStart()&amp;&amp;(e=t.getIndexStartValue()),t.hasEnd()&amp;&amp;(n=t.getIndexEndValue()),t.getIndex()===Te){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()!==Nt)throw new Error(r);if("string"!=typeof e)throw new Error(i)}if(t.hasEnd()){if(t.getIndexEndName()!==Rt)throw new Error(r);if("string"!=typeof n)throw new Error(i)}}else if(t.getIndex()===Fe){if(null!=e&amp;&amp;!Gt(e)||null!=n&amp;&amp;!Gt(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(y(t.getIndex()instanceof pn||t.getIndex()===cn,"unknown index type."),null!=e&amp;&amp;"object"==typeof e||null!=n&amp;&amp;"object"==typeof n)throw new Error("Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.")},In.validateLimit_=function(t){if(t.hasStart()&amp;&amp;t.hasEnd()&amp;&amp;t.hasLimit()&amp;&amp;!t.hasAnchoredLimit())throw new Error("Query: Can't combine startAt(), endAt(), and limit(). Use limitToFirst() or limitToLast() instead.")},In.prototype.validateNoPreviousOrderByCall_=function(t){if(!0===this.orderByCalled_)throw new Error(t+": You can't combine multiple orderBy calls.")},In.prototype.getQueryParams=function(){return this.queryParams_},In.prototype.getRef=function(){return M("Query.ref",0,0,arguments.length),new In.__referenceConstructor(this.repo,this.path)},In.prototype.on=function(t,e,n,r){M("Query.on",2,4,arguments.length),Zt("Query.on",1,t,!1),q("Query.on",2,e,!1);n=In.getCancelAndContextArgs_("Query.on",n,r);return"value"===t?this.onValueEvent(e,n.cancel,n.context):((r={})[t]=e,this.onChildEvent(r,n.cancel,n.context)),e},In.prototype.onValueEvent=function(t,e,n){n=new Cn(t,e||null,n||null);this.repo.addEventCallbackForQuery(this,n)},In.prototype.onChildEvent=function(t,e,n){n=new bn(t,e,n);this.repo.addEventCallbackForQuery(this,n)},In.prototype.off=function(t,e,n){M("Query.off",0,3,arguments.length),Zt("Query.off",1,t,!0),q("Query.off",2,e,!0),Q("Query.off",3,n,!0);var r=null,i=null;"value"===t?r=new Cn(e||null,null,n||null):t&amp;&amp;(e&amp;&amp;((i={})[t]=e),r=new bn(i,null,n||null)),this.repo.removeEventCallbackForQuery(this,r)},In.prototype.get=function(){return this.repo.getValue(this)},In.prototype.once=function(e,n,t,r){var i=this;M("Query.once",1,4,arguments.length),Zt("Query.once",1,e,!1),q("Query.once",2,n,!0);var o=In.getCancelAndContextArgs_("Query.once",t,r),s=!0,a=new g;a.promise.catch((function(){}));var h=function(t){s&amp;&amp;(s=!1,i.off(e,h),n&amp;&amp;n.bind(o.context)(t),a.resolve(t))};return this.on(e,h,(function(t){i.off(e,h),o.cancel&amp;&amp;o.cancel.bind(o.context)(t),a.reject(t)})),a.promise},In.prototype.limitToFirst=function(t){if(M("Query.limitToFirst",1,1,arguments.length),"number"!=typeof t||Math.floor(t)!==t||t&lt;=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 In(this.repo,this.path,this.queryParams_.limitToFirst(t),this.orderByCalled_)},In.prototype.limitToLast=function(t){if(M("Query.limitToLast",1,1,arguments.length),"number"!=typeof t||Math.floor(t)!==t||t&lt;=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 In(this.repo,this.path,this.queryParams_.limitToLast(t),this.orderByCalled_)},In.prototype.orderByChild=function(t){if(M("Query.orderByChild",1,1,arguments.length),"$key"===t)throw new Error('Query.orderByChild: "$key" is invalid.  Use Query.orderByKey() instead.');if("$priority"===t)throw new Error('Query.orderByChild: "$priority" is invalid.  Use Query.orderByPriority() instead.');if("$value"===t)throw new Error('Query.orderByChild: "$value" is invalid.  Use Query.orderByValue() instead.');ee("Query.orderByChild",1,t,!1),this.validateNoPreviousOrderByCall_("Query.orderByChild");t=new Mt(t);if(t.isEmpty())throw new Error("Query.orderByChild: cannot pass in empty path.  Use Query.orderByValue() instead.");t=new pn(t),t=this.queryParams_.orderBy(t);return In.validateQueryEndpoints_(t),new In(this.repo,this.path,t,!0)},In.prototype.orderByKey=function(){M("Query.orderByKey",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByKey");var t=this.queryParams_.orderBy(Te);return In.validateQueryEndpoints_(t),new In(this.repo,this.path,t,!0)},In.prototype.orderByPriority=function(){M("Query.orderByPriority",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByPriority");var t=this.queryParams_.orderBy(Fe);return In.validateQueryEndpoints_(t),new In(this.repo,this.path,t,!0)},In.prototype.orderByValue=function(){M("Query.orderByValue",0,0,arguments.length),this.validateNoPreviousOrderByCall_("Query.orderByValue");var t=this.queryParams_.orderBy(cn);return In.validateQueryEndpoints_(t),new In(this.repo,this.path,t,!0)},In.prototype.startAt=function(t,e){void 0===t&amp;&amp;(t=null),M("Query.startAt",0,2,arguments.length),Xt("Query.startAt",1,t,this.path,!0),te("Query.startAt",2,e,!0);var n=this.queryParams_.startAt(t,e);if(In.validateLimit_(n),In.validateQueryEndpoints_(n),this.queryParams_.hasStart())throw new Error("Query.startAt: Starting point was already set (by another call to startAt or equalTo).");return void 0===t&amp;&amp;(e=t=null),new In(this.repo,this.path,n,this.orderByCalled_)},In.prototype.endAt=function(t,e){void 0===t&amp;&amp;(t=null),M("Query.endAt",0,2,arguments.length),Xt("Query.endAt",1,t,this.path,!0),te("Query.endAt",2,e,!0);e=this.queryParams_.endAt(t,e);if(In.validateLimit_(e),In.validateQueryEndpoints_(e),this.queryParams_.hasEnd())throw new Error("Query.endAt: Ending point was already set (by another call to endAt or equalTo).");return new In(this.repo,this.path,e,this.orderByCalled_)},In.prototype.equalTo=function(t,e){if(M("Query.equalTo",1,2,arguments.length),Xt("Query.equalTo",1,t,this.path,!1),te("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)},In.prototype.toString=function(){return M("Query.toString",0,0,arguments.length),this.repo.toString()+this.path.toUrlEncodedString()},In.prototype.toJSON=function(){return M("Query.toJSON",0,1,arguments.length),this.toString()},In.prototype.queryObject=function(){return this.queryParams_.getQueryObject()},In.prototype.queryIdentifier=function(){var t=this.queryObject(),t=Dt(t);return"{}"===t?"default":t},In.prototype.isEqual=function(t){if(M("Query.isEqual",1,1,arguments.length),!(t instanceof In)){throw new Error("Query.isEqual failed: First argument must be an instance of firebase.database.Query.")}var e=this.repo===t.repo,n=this.path.equals(t.path),t=this.queryIdentifier()===t.queryIdentifier();return e&amp;&amp;n&amp;&amp;t},In.getCancelAndContextArgs_=function(t,e,n){var r={cancel:null,context:null};if(e&amp;&amp;n)r.cancel=e,q(t,3,r.cancel,!0),r.context=n,Q(t,4,r.context,!0);else if(e)if("object"==typeof e&amp;&amp;null!==e)r.context=e;else{if("function"!=typeof e)throw new Error(W(t,3,!0)+" must either be a cancel callback or a context object.");r.cancel=e}return r},Object.defineProperty(In.prototype,"ref",{get:function(){return this.getRef()},enumerable:!1,configurable:!0}),In);function In(t,e,n,r){this.repo=t,this.path=e,this.queryParams_=n,this.orderByCalled_=r}var Nn=(Rn.prototype.getImmediateChild=function(t){return new Rn(this.node_.getImmediateChild(t))},Rn.prototype.node=function(){return this.node_},Rn);function Rn(t){this.node_=t}var Pn=(Dn.prototype.getImmediateChild=function(t){t=this.path_.child(t);return new Dn(this.syncTree_,t)},Dn.prototype.node=function(){return this.syncTree_.calcCompleteEventCache(this.path_)},Dn);function Dn(t,e){this.syncTree_=t,this.path_=e}function On(t,e,n,r){return Ln(e,new Pn(n,t),r)}function xn(t,e,n){return Ln(t,new Nn(e),n)}var kn=function(t,e,n){return t&amp;&amp;"object"==typeof t?(y(".sv"in t,"Unexpected leaf node or priority contents"),"string"==typeof t[".sv"]?An(t[".sv"],e,n):"object"==typeof t[".sv"]?Fn(t[".sv"],e):void y(!1,"Unexpected server value: "+JSON.stringify(t,null,2))):t},An=function(t,e,n){if("timestamp"===t)return n.timestamp;y(!1,"Unexpected server value: "+t)},Fn=function(t,e,n){t.hasOwnProperty("increment")||y(!1,"Unexpected server value: "+JSON.stringify(t,null,2));t=t.increment;"number"!=typeof t&amp;&amp;y(!1,"Unexpected increment value: "+t);e=e.node();if(y(null!=e,"Expected ChildrenNode.EMPTY_NODE for nulls"),!e.isLeafNode())return t;e=e.getValue();return"number"!=typeof e?t:e+t};function Ln(t,r,i){var e=t.getPriority().val(),n=kn(e,r.getImmediateChild(".priority"),i);if(t.isLeafNode()){var o=t,e=kn(o.getValue(),r,i);return e!==o.getValue()||n!==o.getPriority().val()?new xe(e,hn(n)):t}var t=t,s=t;return n!==t.getPriority().val()&amp;&amp;(s=s.updatePriority(new xe(n))),t.forEachChild(Fe,(function(t,e){var n=Ln(e,r.getImmediateChild(t),i);n!==e&amp;&amp;(s=s.updateImmediateChild(t,n))})),s}var Mn,Wn=(qn.prototype.find=function(t){if(null!=this.value)return this.value.getChild(t);if(!t.isEmpty()&amp;&amp;0&lt;this.children.size){var e=t.getFront();return t=t.popFront(),this.children.has(e)?this.children.get(e).find(t):null}return null},qn.prototype.remember=function(t,e){var n;t.isEmpty()?(this.value=e,this.children.clear()):null!==this.value?this.value=this.value.updateChild(t,e):(n=t.getFront(),this.children.has(n)||this.children.set(n,new qn),n=this.children.get(n),t=t.popFront(),n.remember(t,e))},qn.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(Fe,(function(t,e){n.remember(new Mt(t),e)})),this.forget(t)}if(0&lt;this.children.size){e=t.getFront();return t=t.popFront(),this.children.has(e)&amp;&amp;this.children.get(e).forget(t)&amp;&amp;this.children.delete(e),0===this.children.size}return!0},qn.prototype.forEachTree=function(n,r){null!==this.value?r(n,this.value):this.forEachChild((function(t,e){t=new Mt(n.toString()+"/"+t);e.forEachTree(t,r)}))},qn.prototype.forEachChild=function(n){this.children.forEach((function(t,e){n(e,t)}))},qn);function qn(){this.value=null,this.children=new Map}(Ce=Mn=Mn||{})[Ce.OVERWRITE=0]="OVERWRITE",Ce[Ce.MERGE=1]="MERGE",Ce[Ce.ACK_USER_WRITE=2]="ACK_USER_WRITE",Ce[Ce.LISTEN_COMPLETE=3]="LISTEN_COMPLETE";var Qn=(Un.User=new Un(!0,!1,null,!1),Un.Server=new Un(!1,!0,null,!1),Un.forServerTaggedQuery=function(t){return new Un(!1,!0,t,!0)},Un);function Un(t,e,n,r){this.fromUser=t,this.fromServer=e,this.queryId=n,this.tagged=r,y(!r||e,"Tagged queries must be from server.")}var Vn,Hn=(jn.prototype.operationForChild=function(t){if(this.path.isEmpty()){if(null!=this.affectedTree.value)return y(this.affectedTree.children.isEmpty(),"affectedTree should not have overlapping affected paths."),this;var e=this.affectedTree.subtree(new Mt(t));return new jn(Mt.Empty,e,this.revert)}return y(this.path.getFront()===t,"operationForChild called for unrelated child."),new jn(this.path.popFront(),this.affectedTree,this.revert)},jn);function jn(t,e,n){this.path=t,this.affectedTree=e,this.revert=n,this.type=Mn.ACK_USER_WRITE,this.source=Qn.User}var Bn=(zn.fromObject=function(t){var n=zn.Empty;return Ot(t,(function(t,e){n=n.set(new Mt(t),e)})),n},zn.prototype.isEmpty=function(){return null===this.value&amp;&amp;this.children.isEmpty()},zn.prototype.findRootMostMatchingPathAndValue=function(t,e){if(null!=this.value&amp;&amp;e(this.value))return{path:Mt.Empty,value:this.value};if(t.isEmpty())return null;var n=t.getFront(),r=this.children.get(n);if(null===r)return null;e=r.findRootMostMatchingPathAndValue(t.popFront(),e);return null==e?null:{path:new Mt(n).child(e.path),value:e.value}},zn.prototype.findRootMostValueAndPath=function(t){return this.findRootMostMatchingPathAndValue(t,(function(){return!0}))},zn.prototype.subtree=function(t){if(t.isEmpty())return this;var e=t.getFront(),e=this.children.get(e);return null!==e?e.subtree(t.popFront()):zn.Empty},zn.prototype.set=function(t,e){if(t.isEmpty())return new zn(e,this.children);var n=t.getFront(),e=(this.children.get(n)||zn.Empty).set(t.popFront(),e),e=this.children.insert(n,e);return new zn(this.value,e)},zn.prototype.remove=function(t){if(t.isEmpty())return this.children.isEmpty()?zn.Empty:new zn(null,this.children);var e=t.getFront(),n=this.children.get(e);if(n){n=n.remove(t.popFront()),t=void 0,t=n.isEmpty()?this.children.remove(e):this.children.insert(e,n);return null===this.value&amp;&amp;t.isEmpty()?zn.Empty:new zn(this.value,t)}return this},zn.prototype.get=function(t){if(t.isEmpty())return this.value;var e=t.getFront(),e=this.children.get(e);return e?e.get(t.popFront()):null},zn.prototype.setTree=function(t,e){if(t.isEmpty())return e;var n=t.getFront(),t=(this.children.get(n)||zn.Empty).setTree(t.popFront(),e),e=void 0,e=t.isEmpty()?this.children.remove(n):this.children.insert(n,t);return new zn(this.value,e)},zn.prototype.fold=function(t){return this.fold_(Mt.Empty,t)},zn.prototype.fold_=function(n,r){var i={};return this.children.inorderTraversal((function(t,e){i[t]=e.fold_(n.child(t),r)})),r(n,this.value,i)},zn.prototype.findOnPath=function(t,e){return this.findOnPath_(t,Mt.Empty,e)},zn.prototype.findOnPath_=function(t,e,n){var r=!!this.value&amp;&amp;n(e,this.value);if(r)return r;if(t.isEmpty())return null;var i=t.getFront(),r=this.children.get(i);return r?r.findOnPath_(t.popFront(),e.child(i),n):null},zn.prototype.foreachOnPath=function(t,e){return this.foreachOnPath_(t,Mt.Empty,e)},zn.prototype.foreachOnPath_=function(t,e,n){if(t.isEmpty())return this;this.value&amp;&amp;n(e,this.value);var r=t.getFront(),i=this.children.get(r);return i?i.foreachOnPath_(t.popFront(),e.child(r),n):zn.Empty},zn.prototype.foreach=function(t){this.foreach_(Mt.Empty,t)},zn.prototype.foreach_=function(n,r){this.children.inorderTraversal((function(t,e){e.foreach_(n.child(t),r)})),this.value&amp;&amp;r(n,this.value)},zn.prototype.foreachChild=function(n){this.children.inorderTraversal((function(t,e){e.value&amp;&amp;n(t,e.value)}))},zn.Empty=new zn(null),zn);function zn(t,e){void 0===e&amp;&amp;(e=Vn=Vn||new Ue(dt)),this.value=t,this.children=e}var Kn=(Yn.prototype.operationForChild=function(t){return this.path.isEmpty()?new Yn(this.source,Mt.Empty):new Yn(this.source,this.path.popFront())},Yn);function Yn(t,e){this.source=t,this.path=e,this.type=Mn.LISTEN_COMPLETE}var Gn=(Xn.prototype.operationForChild=function(t){return this.path.isEmpty()?new Xn(this.source,Mt.Empty,this.snap.getImmediateChild(t)):new Xn(this.source,this.path.popFront(),this.snap)},Xn);function Xn(t,e,n){this.source=t,this.path=e,this.snap=n,this.type=Mn.OVERWRITE}var $n=(Jn.prototype.operationForChild=function(t){if(this.path.isEmpty()){var e=this.children.subtree(new Mt(t));return e.isEmpty()?null:e.value?new Gn(this.source,Mt.Empty,e.value):new Jn(this.source,Mt.Empty,e)}return y(this.path.getFront()===t,"Can't get a merge for a child not on the path of the operation"),new Jn(this.source,this.path.popFront(),this.children)},Jn.prototype.toString=function(){return"Operation("+this.path+": "+this.source.toString()+" merge: "+this.children.toString()+")"},Jn);function Jn(t,e,n){this.source=t,this.path=e,this.children=n,this.type=Mn.MERGE}var Zn=(tr.prototype.isFullyInitialized=function(){return this.fullyInitialized_},tr.prototype.isFiltered=function(){return this.filtered_},tr.prototype.isCompleteForPath=function(t){if(t.isEmpty())return this.isFullyInitialized()&amp;&amp;!this.filtered_;t=t.getFront();return this.isCompleteForChild(t)},tr.prototype.isCompleteForChild=function(t){return this.isFullyInitialized()&amp;&amp;!this.filtered_||this.node_.hasChild(t)},tr.prototype.getNode=function(){return this.node_},tr);function tr(t,e,n){this.node_=t,this.fullyInitialized_=e,this.filtered_=n}var er=(nr.prototype.updateEventSnap=function(t,e,n){return new nr(new Zn(t,e,n),this.serverCache_)},nr.prototype.updateServerSnap=function(t,e,n){return new nr(this.eventCache_,new Zn(t,e,n))},nr.prototype.getEventCache=function(){return this.eventCache_},nr.prototype.getCompleteEventSnap=function(){return this.eventCache_.isFullyInitialized()?this.eventCache_.getNode():null},nr.prototype.getServerCache=function(){return this.serverCache_},nr.prototype.getCompleteServerSnap=function(){return this.serverCache_.isFullyInitialized()?this.serverCache_.getNode():null},nr.Empty=new nr(new Zn(en.EMPTY_NODE,!1,!1),new Zn(en.EMPTY_NODE,!1,!1)),nr);function nr(t,e){this.eventCache_=t,this.serverCache_=e}var rr=(ir.valueChange=function(t){return new ir(ir.VALUE,t)},ir.childAddedChange=function(t,e){return new ir(ir.CHILD_ADDED,e,t)},ir.childRemovedChange=function(t,e){return new ir(ir.CHILD_REMOVED,e,t)},ir.childChangedChange=function(t,e,n){return new ir(ir.CHILD_CHANGED,e,t,n)},ir.childMovedChange=function(t,e){return new ir(ir.CHILD_MOVED,e,t)},ir.CHILD_ADDED="child_added",ir.CHILD_REMOVED="child_removed",ir.CHILD_CHANGED="child_changed",ir.CHILD_MOVED="child_moved",ir.VALUE="value",ir);function ir(t,e,n,r,i){this.type=t,this.snapshotNode=e,this.childName=n,this.oldSnap=r,this.prevName=i}var or=(sr.prototype.updateChild=function(t,e,n,r,i,o){y(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))&amp;&amp;s.isEmpty()===n.isEmpty()?t:(null!=o&amp;&amp;(n.isEmpty()?t.hasChild(e)?o.trackChildChange(rr.childRemovedChange(e,s)):y(t.isLeafNode(),"A child remove without an old child only makes sense on a leaf node"):s.isEmpty()?o.trackChildChange(rr.childAddedChange(e,n)):o.trackChildChange(rr.childChangedChange(e,n,s))),t.isLeafNode()&amp;&amp;n.isEmpty()?t:t.updateImmediateChild(e,n).withIndex(this.index_))},sr.prototype.updateFullNode=function(r,n,i){return null!=i&amp;&amp;(r.isLeafNode()||r.forEachChild(Fe,(function(t,e){n.hasChild(t)||i.trackChildChange(rr.childRemovedChange(t,e))})),n.isLeafNode()||n.forEachChild(Fe,(function(t,e){var n;r.hasChild(t)?(n=r.getImmediateChild(t)).equals(e)||i.trackChildChange(rr.childChangedChange(t,e,n)):i.trackChildChange(rr.childAddedChange(t,e))}))),n.withIndex(this.index_)},sr.prototype.updatePriority=function(t,e){return t.isEmpty()?en.EMPTY_NODE:t.updatePriority(e)},sr.prototype.filtersNodes=function(){return!1},sr.prototype.getIndexedFilter=function(){return this},sr.prototype.getIndex=function(){return this.index_},sr);function sr(t){this.index_=t}var ar=(hr.prototype.trackChildChange=function(t){var e=t.type,n=t.childName;y(e===rr.CHILD_ADDED||e===rr.CHILD_CHANGED||e===rr.CHILD_REMOVED,"Only child changes supported for tracking"),y(".priority"!==n,"Only non-priority child changes can be tracked.");var r=this.changeMap.get(n);if(r){var i=r.type;if(e===rr.CHILD_ADDED&amp;&amp;i===rr.CHILD_REMOVED)this.changeMap.set(n,rr.childChangedChange(n,t.snapshotNode,r.snapshotNode));else if(e===rr.CHILD_REMOVED&amp;&amp;i===rr.CHILD_ADDED)this.changeMap.delete(n);else if(e===rr.CHILD_REMOVED&amp;&amp;i===rr.CHILD_CHANGED)this.changeMap.set(n,rr.childRemovedChange(n,r.oldSnap));else if(e===rr.CHILD_CHANGED&amp;&amp;i===rr.CHILD_ADDED)this.changeMap.set(n,rr.childAddedChange(n,t.snapshotNode));else{if(e!==rr.CHILD_CHANGED||i!==rr.CHILD_CHANGED)throw c("Illegal combination of changes: "+t+" occurred after "+r);this.changeMap.set(n,rr.childChangedChange(n,t.snapshotNode,r.oldSnap))}}else this.changeMap.set(n,t)},hr.prototype.getChanges=function(){return Array.from(this.changeMap.values())},hr);function hr(){this.changeMap=new Map}function lr(){}var ur=new(lr.prototype.getCompleteChild=function(t){return null},lr.prototype.getChildAfterChild=function(t,e,n){return null},lr),cr=(pr.prototype.getCompleteChild=function(t){var e=this.viewCache_.getEventCache();if(e.isCompleteForChild(t))return e.getNode().getImmediateChild(t);e=null!=this.optCompleteServerCache_?new Zn(this.optCompleteServerCache_,!0,!1):this.viewCache_.getServerCache();return this.writes_.calcCompleteChild(t,e)},pr.prototype.getChildAfterChild=function(t,e,n){var r=null!=this.optCompleteServerCache_?this.optCompleteServerCache_:this.viewCache_.getCompleteServerSnap(),t=this.writes_.calcIndexedSlice(r,e,1,n,t);return 0===t.length?null:t[0]},pr);function pr(t,e,n){void 0===n&amp;&amp;(n=null),this.writes_=t,this.viewCache_=e,this.optCompleteServerCache_=n}var dr=function(t,e){this.viewCache=t,this.changes=e},fr=(_r.prototype.assertIndexed=function(t){y(t.getEventCache().getNode().isIndexed(this.filter_.getIndex()),"Event snap not indexed"),y(t.getServerCache().getNode().isIndexed(this.filter_.getIndex()),"Server snap not indexed")},_r.prototype.applyOperation=function(t,e,n,r){var i=new ar;if(e.type===Mn.OVERWRITE)var o=e,s=o.source.fromUser?this.applyUserOverwrite_(t,o.path,o.snap,n,r,i):(y(o.source.fromServer,"Unknown source."),a=o.source.tagged||t.getServerCache().isFiltered()&amp;&amp;!o.path.isEmpty(),this.applyServerOverwrite_(t,o.path,o.snap,n,r,a,i));else if(e.type===Mn.MERGE){o=e;s=o.source.fromUser?this.applyUserMerge_(t,o.path,o.children,n,r,i):(y(o.source.fromServer,"Unknown source."),a=o.source.tagged||t.getServerCache().isFiltered(),this.applyServerMerge_(t,o.path,o.children,n,r,a,i))}else if(e.type===Mn.ACK_USER_WRITE){var a=e;s=a.revert?this.revertUserWrite_(t,a.path,n,r,i):this.ackUserWrite_(t,a.path,a.affectedTree,n,r,i)}else{if(e.type!==Mn.LISTEN_COMPLETE)throw c("Unknown operation type: "+e.type);s=this.listenComplete_(t,e.path,n,i)}i=i.getChanges();return _r.maybeAddValueEvent_(t,s,i),new dr(s,i)},_r.maybeAddValueEvent_=function(t,e,n){var r,i,o=e.getEventCache();o.isFullyInitialized()&amp;&amp;(r=o.getNode().isLeafNode()||o.getNode().isEmpty(),i=t.getCompleteEventSnap(),(0&lt;n.length||!t.getEventCache().isFullyInitialized()||r&amp;&amp;!o.getNode().equals(i)||!o.getNode().getPriority().equals(i.getPriority()))&amp;&amp;n.push(rr.valueChange(e.getCompleteEventSnap())))},_r.prototype.generateEventCacheAfterServerEvent_=function(t,e,n,r,i){var o=t.getEventCache();if(null!=n.shadowingWrite(e))return t;var s,a,h,l,u=void 0,c=void 0;return u=e.isEmpty()?(y(t.getServerCache().isFullyInitialized(),"If change path is empty, we must have complete server data"),t.getServerCache().isFiltered()?(s=(s=t.getCompleteServerSnap())instanceof en?s:en.EMPTY_NODE,s=n.calcCompleteEventChildren(s),this.filter_.updateFullNode(t.getEventCache().getNode(),s,i)):(a=n.calcCompleteEventCache(t.getCompleteServerSnap()),this.filter_.updateFullNode(t.getEventCache().getNode(),a,i))):".priority"===(a=e.getFront())?(y(1===e.getLength(),"Can't have a priority with additional path components"),h=o.getNode(),c=t.getServerCache().getNode(),null!=(l=n.calcEventCacheAfterServerOverwrite(e,h,c))?this.filter_.updatePriority(h,l):o.getNode()):(h=e.popFront(),l=void 0,null!=(l=o.isCompleteForChild(a)?(c=t.getServerCache().getNode(),null!=(c=n.calcEventCacheAfterServerOverwrite(e,o.getNode(),c))?o.getNode().getImmediateChild(a).updateChild(h,c):o.getNode().getImmediateChild(a)):n.calcCompleteChild(a,t.getServerCache()))?this.filter_.updateChild(o.getNode(),a,l,h,r,i):o.getNode()),t.updateEventSnap(u,o.isFullyInitialized()||e.isEmpty(),this.filter_.filtersNodes())},_r.prototype.applyServerOverwrite_=function(t,e,n,r,i,o,s){var a=t.getServerCache(),h=o?this.filter_:this.filter_.getIndexedFilter();if(e.isEmpty())u=h.updateFullNode(a.getNode(),n,null);else if(h.filtersNodes()&amp;&amp;!a.isFiltered())var l=a.getNode().updateChild(e,n),u=h.updateFullNode(a.getNode(),l,null);else{o=e.getFront();if(!a.isCompleteForPath(e)&amp;&amp;1&lt;e.getLength())return t;l=e.popFront(),n=a.getNode().getImmediateChild(o).updateChild(l,n);u=".priority"===o?h.updatePriority(a.getNode(),n):h.updateChild(a.getNode(),o,n,l,ur,null)}h=t.updateServerSnap(u,a.isFullyInitialized()||e.isEmpty(),h.filtersNodes()),i=new cr(r,h,i);return this.generateEventCacheAfterServerEvent_(h,e,r,i,s)},_r.prototype.applyUserOverwrite_=function(t,e,n,r,i,o){var s,a,h=t.getEventCache(),l=new cr(r,t,i);return e.isEmpty()?(a=this.filter_.updateFullNode(t.getEventCache().getNode(),n,o),t.updateEventSnap(a,!0,this.filter_.filtersNodes())):".priority"===(s=e.getFront())?(a=this.filter_.updatePriority(t.getEventCache().getNode(),n),t.updateEventSnap(a,h.isFullyInitialized(),h.isFiltered())):(r=e.popFront(),i=h.getNode().getImmediateChild(s),a=void 0,a=r.isEmpty()?n:null!=(e=l.getCompleteChild(s))?".priority"===r.getBack()&amp;&amp;e.getChild(r.parent()).isEmpty()?e:e.updateChild(r,n):en.EMPTY_NODE,i.equals(a)?t:(o=this.filter_.updateChild(h.getNode(),s,a,r,l,o),t.updateEventSnap(o,h.isFullyInitialized(),this.filter_.filtersNodes())))},_r.cacheHasChild_=function(t,e){return t.getEventCache().isCompleteForChild(e)},_r.prototype.applyUserMerge_=function(n,r,t,i,o,s){var a=this,h=n;return t.foreach((function(t,e){t=r.child(t);_r.cacheHasChild_(n,t.getFront())&amp;&amp;(h=a.applyUserOverwrite_(h,t,e,i,o,s))})),t.foreach((function(t,e){t=r.child(t);_r.cacheHasChild_(n,t.getFront())||(h=a.applyUserOverwrite_(h,t,e,i,o,s))})),h},_r.prototype.applyMerge_=function(n,t){return t.foreach((function(t,e){n=n.updateChild(t,e)})),n},_r.prototype.applyServerMerge_=function(r,t,e,i,o,s,a){var h=this;if(r.getServerCache().getNode().isEmpty()&amp;&amp;!r.getServerCache().isFullyInitialized())return r;var l=r,e=t.isEmpty()?e:Bn.Empty.setTree(t,e),u=r.getServerCache().getNode();return e.children.inorderTraversal((function(t,e){var n;u.hasChild(t)&amp;&amp;(n=r.getServerCache().getNode().getImmediateChild(t),e=h.applyMerge_(n,e),l=h.applyServerOverwrite_(l,new Mt(t),e,i,o,s,a))})),e.children.inorderTraversal((function(t,e){var n=!r.getServerCache().isCompleteForChild(t)&amp;&amp;null==e.value;u.hasChild(t)||n||(n=r.getServerCache().getNode().getImmediateChild(t),e=h.applyMerge_(n,e),l=h.applyServerOverwrite_(l,new Mt(t),e,i,o,s,a))})),l},_r.prototype.ackUserWrite_=function(t,r,e,n,i,o){if(null!=n.shadowingWrite(r))return t;var s=t.getServerCache().isFiltered(),a=t.getServerCache();if(null!=e.value){if(r.isEmpty()&amp;&amp;a.isFullyInitialized()||a.isCompleteForPath(r))return this.applyServerOverwrite_(t,r,a.getNode().getChild(r),n,i,s,o);if(r.isEmpty()){var h=Bn.Empty;return a.getNode().forEachChild(Te,(function(t,e){h=h.set(new Mt(t),e)})),this.applyServerMerge_(t,r,h,n,i,s,o)}return t}var l=Bn.Empty;return e.foreach((function(t,e){var n=r.child(t);a.isCompleteForPath(n)&amp;&amp;(l=l.set(t,a.getNode().getChild(n)))})),this.applyServerMerge_(t,r,l,n,i,s,o)},_r.prototype.listenComplete_=function(t,e,n,r){var i=t.getServerCache(),i=t.updateServerSnap(i.getNode(),i.isFullyInitialized()||e.isEmpty(),i.isFiltered());return this.generateEventCacheAfterServerEvent_(i,e,n,ur,r)},_r.prototype.revertUserWrite_=function(t,e,n,r,i){var o;if(null!=n.shadowingWrite(e))return t;var s,a,h=new cr(n,t,r),l=t.getEventCache().getNode(),r=void 0;return e.isEmpty()||".priority"===e.getFront()?(a=void 0,a=t.getServerCache().isFullyInitialized()?n.calcCompleteEventCache(t.getCompleteServerSnap()):(s=t.getServerCache().getNode(),y(s instanceof en,"serverChildren would be complete if leaf node"),n.calcCompleteEventChildren(s)),r=this.filter_.updateFullNode(l,a,i)):(s=e.getFront(),null==(a=n.calcCompleteChild(s,t.getServerCache()))&amp;&amp;t.getServerCache().isCompleteForChild(s)&amp;&amp;(a=l.getImmediateChild(s)),(r=null!=a?this.filter_.updateChild(l,s,a,e.popFront(),h,i):t.getEventCache().getNode().hasChild(s)?this.filter_.updateChild(l,s,en.EMPTY_NODE,e.popFront(),h,i):l).isEmpty()&amp;&amp;t.getServerCache().isFullyInitialized()&amp;&amp;(o=n.calcCompleteEventCache(t.getCompleteServerSnap())).isLeafNode()&amp;&amp;(r=this.filter_.updateFullNode(r,o,i))),o=t.getServerCache().isFullyInitialized()||null!=n.shadowingWrite(Mt.Empty),t.updateEventSnap(r,o,this.filter_.filtersNodes())},_r);function _r(t){this.filter_=t}var yr=(gr.prototype.generateEventsForChanges=function(t,e,n){var r=this,i=[],o=[];return t.forEach((function(t){t.type===rr.CHILD_CHANGED&amp;&amp;r.index_.indexedValueChanged(t.oldSnap,t.snapshotNode)&amp;&amp;o.push(rr.childMovedChange(t.childName,t.snapshotNode))})),this.generateEventsForType_(i,rr.CHILD_REMOVED,t,n,e),this.generateEventsForType_(i,rr.CHILD_ADDED,t,n,e),this.generateEventsForType_(i,rr.CHILD_MOVED,o,n,e),this.generateEventsForType_(i,rr.CHILD_CHANGED,t,n,e),this.generateEventsForType_(i,rr.VALUE,t,n,e),i},gr.prototype.generateEventsForType_=function(r,e,t,i,o){var s=this,t=t.filter((function(t){return t.type===e}));t.sort(this.compareChanges_.bind(this)),t.forEach((function(e){var n=s.materializeSingleChange_(e,o);i.forEach((function(t){t.respondsTo(e.type)&amp;&amp;r.push(t.createEvent(n,s.query_))}))}))},gr.prototype.materializeSingleChange_=function(t,e){return"value"===t.type||"child_removed"===t.type||(t.prevName=e.getPredecessorChildName(t.childName,t.snapshotNode,this.index_)),t},gr.prototype.compareChanges_=function(t,e){if(null==t.childName||null==e.childName)throw c("Should only compare child_ events.");t=new ge(t.childName,t.snapshotNode),e=new ge(e.childName,e.snapshotNode);return this.index_.compare(t,e)},gr);function gr(t){this.query_=t,this.index_=this.query_.getQueryParams().getIndex()}var vr,mr=(Cr.prototype.getQuery=function(){return this.query_},Cr.prototype.getServerCache=function(){return this.viewCache_.getServerCache().getNode()},Cr.prototype.getCompleteServerCache=function(t){var e=this.viewCache_.getCompleteServerSnap();return e&amp;&amp;(this.query_.getQueryParams().loadsAllData()||!t.isEmpty()&amp;&amp;!e.getImmediateChild(t.getFront()).isEmpty())?e.getChild(t):null},Cr.prototype.isEmpty=function(){return 0===this.eventRegistrations_.length},Cr.prototype.addEventRegistration=function(t){this.eventRegistrations_.push(t)},Cr.prototype.removeEventRegistration=function(t,e){var n,r=[];if(e&amp;&amp;(y(null==t,"A cancel should cancel all event registrations."),n=this.query_.path,this.eventRegistrations_.forEach((function(t){t=t.createCancelEvent(e,n);t&amp;&amp;r.push(t)}))),t){for(var i=[],o=0;o&lt;this.eventRegistrations_.length;++o){var s=this.eventRegistrations_[o];if(s.matches(t)){if(t.hasAnyCallback()){i=i.concat(this.eventRegistrations_.slice(o+1));break}}else i.push(s)}this.eventRegistrations_=i}else this.eventRegistrations_=[];return r},Cr.prototype.applyOperation=function(t,e,n){t.type===Mn.MERGE&amp;&amp;null!==t.source.queryId&amp;&amp;(y(this.viewCache_.getCompleteServerSnap(),"We should always have a full cache before handling merges"),y(this.viewCache_.getCompleteEventSnap(),"Missing event cache, even though we have a server cache"));var r=this.viewCache_,n=this.processor_.applyOperation(r,t,e,n);return this.processor_.assertIndexed(n.viewCache),y(n.viewCache.getServerCache().isFullyInitialized()||!r.getServerCache().isFullyInitialized(),"Once a server snap is complete, it should never go back"),this.viewCache_=n.viewCache,this.generateEventsForChanges_(n.changes,n.viewCache.getEventCache().getNode(),null)},Cr.prototype.getInitialEvents=function(t){var e=this.viewCache_.getEventCache(),n=[];return e.getNode().isLeafNode()||e.getNode().forEachChild(Fe,(function(t,e){n.push(rr.childAddedChange(t,e))})),e.isFullyInitialized()&amp;&amp;n.push(rr.valueChange(e.getNode())),this.generateEventsForChanges_(n,e.getNode(),t)},Cr.prototype.generateEventsForChanges_=function(t,e,n){n=n?[n]:this.eventRegistrations_;return this.eventGenerator_.generateEventsForChanges(t,e,n)},Cr);function Cr(t,e){this.query_=t,this.eventRegistrations_=[];var n=this.query_.getQueryParams(),r=new or(n.getIndex()),i=n.getNodeFilter();this.processor_=new fr(i);var o=e.getServerCache(),t=e.getEventCache(),n=r.updateFullNode(en.EMPTY_NODE,o.getNode(),null),e=i.updateFullNode(en.EMPTY_NODE,t.getNode(),null),r=new Zn(n,o.isFullyInitialized(),r.filtersNodes()),i=new Zn(e,t.isFullyInitialized(),i.filtersNodes());this.viewCache_=new er(i,r),this.eventGenerator_=new yr(this.query_)}var Er=(Object.defineProperty(wr,"__referenceConstructor",{get:function(){return y(vr,"Reference.ts has not been loaded"),vr},set:function(t){y(!vr,"__referenceConstructor has already been defined"),vr=t},enumerable:!1,configurable:!0}),wr.prototype.isEmpty=function(){return 0===this.views.size},wr.prototype.applyOperation=function(t,e,n){var r,i,o=t.source.queryId;if(null!==o){var s=this.views.get(o);return y(null!=s,"SyncTree gave us an op for an invalid query."),s.applyOperation(t,e,n)}var a=[];try{for(var h=f(this.views.values()),l=h.next();!l.done;l=h.next())s=l.value,a=a.concat(s.applyOperation(t,e,n))}catch(t){r={error:t}}finally{try{l&amp;&amp;!l.done&amp;&amp;(i=h.return)&amp;&amp;i.call(h)}finally{if(r)throw r.error}}return a},wr.prototype.addEventRegistration=function(t,e,n,r,i){var o,s,a=t.queryIdentifier(),h=this.views.get(a);return h||(s=!1,s=!!(o=n.calcCompleteEventCache(i?r:null))||(o=r instanceof en?n.calcCompleteEventChildren(r):en.EMPTY_NODE,!1),i=new er(new Zn(o,s,!1),new Zn(r,i,!1)),h=new mr(t,i),this.views.set(a,h)),h.addEventRegistration(e),h.getInitialEvents(e)},wr.prototype.removeEventRegistration=function(t,e,n){var r,i,o=t.queryIdentifier(),s=[],a=[],h=this.hasCompleteView();if("default"===o)try{for(var l=f(this.views.entries()),u=l.next();!u.done;u=l.next()){var c=_(u.value,2),p=c[0],d=c[1],a=a.concat(d.removeEventRegistration(e,n));d.isEmpty()&amp;&amp;(this.views.delete(p),d.getQuery().getQueryParams().loadsAllData()||s.push(d.getQuery()))}}catch(t){r={error:t}}finally{try{u&amp;&amp;!u.done&amp;&amp;(i=l.return)&amp;&amp;i.call(l)}finally{if(r)throw r.error}}else(d=this.views.get(o))&amp;&amp;(a=a.concat(d.removeEventRegistration(e,n)),d.isEmpty()&amp;&amp;(this.views.delete(o),d.getQuery().getQueryParams().loadsAllData()||s.push(d.getQuery())));return h&amp;&amp;!this.hasCompleteView()&amp;&amp;s.push(new wr.__referenceConstructor(t.repo,t.path)),{removed:s,events:a}},wr.prototype.getQueryViews=function(){var e,t,n=[];try{for(var r=f(this.views.values()),i=r.next();!i.done;i=r.next()){var o=i.value;o.getQuery().getQueryParams().loadsAllData()||n.push(o)}}catch(t){e={error:t}}finally{try{i&amp;&amp;!i.done&amp;&amp;(t=r.return)&amp;&amp;t.call(r)}finally{if(e)throw e.error}}return n},wr.prototype.getCompleteServerCache=function(t){var e,n,r=null;try{for(var i=f(this.views.values()),o=i.next();!o.done;o=i.next())var s=o.value,r=r||s.getCompleteServerCache(t)}catch(t){e={error:t}}finally{try{o&amp;&amp;!o.done&amp;&amp;(n=i.return)&amp;&amp;n.call(i)}finally{if(e)throw e.error}}return r},wr.prototype.viewForQuery=function(t){if(t.getQueryParams().loadsAllData())return this.getCompleteView();t=t.queryIdentifier();return this.views.get(t)},wr.prototype.viewExistsForQuery=function(t){return null!=this.viewForQuery(t)},wr.prototype.hasCompleteView=function(){return null!=this.getCompleteView()},wr.prototype.getCompleteView=function(){var e,t;try{for(var n=f(this.views.values()),r=n.next();!r.done;r=n.next()){var i=r.value;if(i.getQuery().getQueryParams().loadsAllData())return i}}catch(t){e={error:t}}finally{try{r&amp;&amp;!r.done&amp;&amp;(t=n.return)&amp;&amp;t.call(n)}finally{if(e)throw e.error}}return null},wr);function wr(){this.views=new Map}var br=(Sr.prototype.addWrite=function(t,e){if(t.isEmpty())return new Sr(new Bn(e));var n=this.writeTree_.findRootMostValueAndPath(t);if(null!=n){var r=n.path,i=n.value,n=Mt.relativePath(r,t),i=i.updateChild(n,e);return new Sr(this.writeTree_.set(r,i))}e=new Bn(e);return new Sr(this.writeTree_.setTree(t,e))},Sr.prototype.addWrites=function(n,t){var r=this;return Ot(t,(function(t,e){r=r.addWrite(n.child(t),e)})),r},Sr.prototype.removeWrite=function(t){return t.isEmpty()?Sr.Empty:new Sr(this.writeTree_.setTree(t,Bn.Empty))},Sr.prototype.hasCompleteWrite=function(t){return null!=this.getCompleteNode(t)},Sr.prototype.getCompleteNode=function(t){var e=this.writeTree_.findRootMostValueAndPath(t);return null!=e?this.writeTree_.get(e.path).getChild(Mt.relativePath(e.path,t)):null},Sr.prototype.getCompleteChildren=function(){var n=[],t=this.writeTree_.value;return null!=t?t.isLeafNode()||t.forEachChild(Fe,(function(t,e){n.push(new ge(t,e))})):this.writeTree_.children.inorderTraversal((function(t,e){null!=e.value&amp;&amp;n.push(new ge(t,e.value))})),n},Sr.prototype.childCompoundWrite=function(t){if(t.isEmpty())return this;var e=this.getCompleteNode(t);return new Sr(null!=e?new Bn(e):this.writeTree_.subtree(t))},Sr.prototype.isEmpty=function(){return this.writeTree_.isEmpty()},Sr.prototype.apply=function(t){return function n(r,t,i){{if(null!=t.value)return i.updateChild(r,t.value);var o=null;return t.children.inorderTraversal((function(t,e){".priority"===t?(y(null!==e.value,"Priority writes must always be leaf nodes"),o=e.value):i=n(r.child(t),e,i)})),i.getChild(r).isEmpty()||null===o||(i=i.updateChild(r.child(".priority"),o)),i}}(Mt.Empty,this.writeTree_,t)},Sr.Empty=new Sr(new Bn(null)),Sr);function Sr(t){this.writeTree_=t}var Tr=(Ir.prototype.childWrites=function(t){return new Nr(t,this)},Ir.prototype.addOverwrite=function(t,e,n,r){y(n&gt;this.lastWriteId_,"Stacking an older write on top of newer ones"),void 0===r&amp;&amp;(r=!0),this.allWrites_.push({path:t,snap:e,writeId:n,visible:r}),r&amp;&amp;(this.visibleWrites_=this.visibleWrites_.addWrite(t,e)),this.lastWriteId_=n},Ir.prototype.addMerge=function(t,e,n){y(n&gt;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},Ir.prototype.getWrite=function(t){for(var e=0;e&lt;this.allWrites_.length;e++){var n=this.allWrites_[e];if(n.writeId===t)return n}return null},Ir.prototype.removeWrite=function(e){var n=this,t=this.allWrites_.findIndex((function(t){return t.writeId===e}));y(0&lt;=t,"removeWrite called with nonexistent writeId.");var r=this.allWrites_[t];this.allWrites_.splice(t,1);for(var i=r.visible,o=!1,s=this.allWrites_.length-1;i&amp;&amp;0&lt;=s;){var a=this.allWrites_[s];a.visible&amp;&amp;(t&lt;=s&amp;&amp;this.recordContainsPath_(a,r.path)?i=!1:r.path.contains(a.path)&amp;&amp;(o=!0)),s--}return!!i&amp;&amp;(o?this.resetTree_():r.snap?this.visibleWrites_=this.visibleWrites_.removeWrite(r.path):Ot(r.children,(function(t){n.visibleWrites_=n.visibleWrites_.removeWrite(r.path.child(t))})),!0)},Ir.prototype.getCompleteWriteData=function(t){return this.visibleWrites_.getCompleteNode(t)},Ir.prototype.calcCompleteEventCache=function(e,t,n,r){if(n||r){var i=this.visibleWrites_.childCompoundWrite(e);if(!r&amp;&amp;i.isEmpty())return t;if(r||null!=t||i.hasCompleteWrite(Mt.Empty)){var o=Ir.layerTree_(this.allWrites_,(function(t){return(t.visible||r)&amp;&amp;(!n||!~n.indexOf(t.writeId))&amp;&amp;(t.path.contains(e)||e.contains(t.path))}),e),s=t||en.EMPTY_NODE;return o.apply(s)}return null}o=this.visibleWrites_.getCompleteNode(e);if(null!=o)return o;o=this.visibleWrites_.childCompoundWrite(e);if(o.isEmpty())return t;if(null!=t||o.hasCompleteWrite(Mt.Empty)){var s=t||en.EMPTY_NODE;return o.apply(s)}return null},Ir.prototype.calcCompleteEventChildren=function(t,e){var n=en.EMPTY_NODE,r=this.visibleWrites_.getCompleteNode(t);if(r)return r.isLeafNode()||r.forEachChild(Fe,(function(t,e){n=n.updateImmediateChild(t,e)})),n;if(e){var i=this.visibleWrites_.childCompoundWrite(t);return e.forEachChild(Fe,(function(t,e){e=i.childCompoundWrite(new Mt(t)).apply(e);n=n.updateImmediateChild(t,e)})),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},Ir.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n,r){y(n||r,"Either existingEventSnap or existingServerSnap must exist");t=t.child(e);if(this.visibleWrites_.hasCompleteWrite(t))return null;t=this.visibleWrites_.childCompoundWrite(t);return t.isEmpty()?r.getChild(e):t.apply(r.getChild(e))},Ir.prototype.calcCompleteChild=function(t,e,n){var r=t.child(e),t=this.visibleWrites_.getCompleteNode(r);return null!=t?t:n.isCompleteForChild(e)?this.visibleWrites_.childCompoundWrite(r).apply(n.getNode().getImmediateChild(e)):null},Ir.prototype.shadowingWrite=function(t){return this.visibleWrites_.getCompleteNode(t)},Ir.prototype.calcIndexedSlice=function(t,e,n,r,i,o){var s,a=this.visibleWrites_.childCompoundWrite(t),t=a.getCompleteNode(Mt.Empty);if(null!=t)s=t;else{if(null==e)return[];s=a.apply(e)}if((s=s.withIndex(o)).isEmpty()||s.isLeafNode())return[];for(var h=[],l=o.getCompare(),u=i?s.getReverseIteratorFrom(n,o):s.getIteratorFrom(n,o),c=u.getNext();c&amp;&amp;h.length&lt;r;)0!==l(c,n)&amp;&amp;h.push(c),c=u.getNext();return h},Ir.prototype.recordContainsPath_=function(t,e){if(t.snap)return t.path.contains(e);for(var n in t.children)if(t.children.hasOwnProperty(n)&amp;&amp;t.path.child(n).contains(e))return!0;return!1},Ir.prototype.resetTree_=function(){this.visibleWrites_=Ir.layerTree_(this.allWrites_,Ir.DefaultFilter_,Mt.Empty),0&lt;this.allWrites_.length?this.lastWriteId_=this.allWrites_[this.allWrites_.length-1].writeId:this.lastWriteId_=-1},Ir.DefaultFilter_=function(t){return t.visible},Ir.layerTree_=function(t,e,n){for(var r=br.Empty,i=0;i&lt;t.length;++i){var o=t[i];if(e(o)){var s=o.path,a=void 0;if(o.snap)n.contains(s)?(a=Mt.relativePath(n,s),r=r.addWrite(a,o.snap)):s.contains(n)&amp;&amp;(a=Mt.relativePath(s,n),r=r.addWrite(Mt.Empty,o.snap.getChild(a)));else{if(!o.children)throw c("WriteRecord should have .snap or .children");n.contains(s)?(a=Mt.relativePath(n,s),r=r.addWrites(a,o.children)):s.contains(n)&amp;&amp;((a=Mt.relativePath(s,n)).isEmpty()?r=r.addWrites(Mt.Empty,o.children):(o=x(o.children,a.getFront()))&amp;&amp;(a=o.getChild(a.popFront()),r=r.addWrite(Mt.Empty,a)))}}}return r},Ir);function Ir(){this.visibleWrites_=br.Empty,this.allWrites_=[],this.lastWriteId_=-1}var Nr=(Rr.prototype.calcCompleteEventCache=function(t,e,n){return this.writeTree_.calcCompleteEventCache(this.treePath_,t,e,n)},Rr.prototype.calcCompleteEventChildren=function(t){return this.writeTree_.calcCompleteEventChildren(this.treePath_,t)},Rr.prototype.calcEventCacheAfterServerOverwrite=function(t,e,n){return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_,t,e,n)},Rr.prototype.shadowingWrite=function(t){return this.writeTree_.shadowingWrite(this.treePath_.child(t))},Rr.prototype.calcIndexedSlice=function(t,e,n,r,i){return this.writeTree_.calcIndexedSlice(this.treePath_,t,e,n,r,i)},Rr.prototype.calcCompleteChild=function(t,e){return this.writeTree_.calcCompleteChild(this.treePath_,t,e)},Rr.prototype.child=function(t){return new Rr(this.treePath_.child(t),this.writeTree_)},Rr);function Rr(t,e){this.treePath_=t,this.writeTree_=e}var Pr=(Dr.prototype.applyUserOverwrite=function(t,e,n,r){return this.pendingWriteTree_.addOverwrite(t,e,n,r),r?this.applyOperationToSyncPoints_(new Gn(Qn.User,t,e)):[]},Dr.prototype.applyUserMerge=function(t,e,n){this.pendingWriteTree_.addMerge(t,e,n);e=Bn.fromObject(e);return this.applyOperationToSyncPoints_(new $n(Qn.User,t,e))},Dr.prototype.ackUserWrite=function(t,e){void 0===e&amp;&amp;(e=!1);var n=this.pendingWriteTree_.getWrite(t);if(this.pendingWriteTree_.removeWrite(t)){var r=Bn.Empty;return null!=n.snap?r=r.set(Mt.Empty,!0):Ot(n.children,(function(t,e){r=r.set(new Mt(t),e)})),this.applyOperationToSyncPoints_(new Hn(n.path,r,e))}return[]},Dr.prototype.applyServerOverwrite=function(t,e){return this.applyOperationToSyncPoints_(new Gn(Qn.Server,t,e))},Dr.prototype.applyServerMerge=function(t,e){e=Bn.fromObject(e);return this.applyOperationToSyncPoints_(new $n(Qn.Server,t,e))},Dr.prototype.applyListenComplete=function(t){return this.applyOperationToSyncPoints_(new Kn(Qn.Server,t))},Dr.prototype.applyTaggedQueryOverwrite=function(t,e,n){var r=this.queryKeyForTag_(n);if(null==r)return[];n=Dr.parseQueryKey_(r),r=n.path,n=n.queryId,t=Mt.relativePath(r,t),e=new Gn(Qn.forServerTaggedQuery(n),t,e);return this.applyTaggedOperation_(r,e)},Dr.prototype.applyTaggedQueryMerge=function(t,e,n){var r=this.queryKeyForTag_(n);if(r){n=Dr.parseQueryKey_(r),r=n.path,n=n.queryId,t=Mt.relativePath(r,t),e=Bn.fromObject(e),e=new $n(Qn.forServerTaggedQuery(n),t,e);return this.applyTaggedOperation_(r,e)}return[]},Dr.prototype.applyTaggedListenComplete=function(t,e){var n=this.queryKeyForTag_(e);if(n){e=Dr.parseQueryKey_(n),n=e.path,e=e.queryId,t=Mt.relativePath(n,t),t=new Kn(Qn.forServerTaggedQuery(e),t);return this.applyTaggedOperation_(n,t)}return[]},Dr.prototype.addEventRegistration=function(t,e){var n=t.path,r=null,i=!1;this.syncPointTree_.foreachOnPath(n,(function(t,e){t=Mt.relativePath(t,n);r=r||e.getCompleteServerCache(t),i=i||e.hasCompleteView()}));var o=this.syncPointTree_.get(n);o?(i=i||o.hasCompleteView(),r=r||o.getCompleteServerCache(Mt.Empty)):(o=new Er,this.syncPointTree_=this.syncPointTree_.set(n,o)),null!=r?l=!0:(l=!1,r=en.EMPTY_NODE,this.syncPointTree_.subtree(n).foreachChild((function(t,e){e=e.getCompleteServerCache(Mt.Empty);e&amp;&amp;(r=r.updateImmediateChild(t,e))})));var s,a=o.viewExistsForQuery(t);a||t.getQueryParams().loadsAllData()||(h=Dr.makeQueryKey_(t),y(!this.queryToTagMap.has(h),"View does not exist, but we have a tag"),s=Dr.getNextQueryTag_(),this.queryToTagMap.set(h,s),this.tagToQueryMap.set(s,h));var h=this.pendingWriteTree_.childWrites(n),l=o.addEventRegistration(t,e,h,r,l);return a||i||(o=o.viewForQuery(t),l=l.concat(this.setupListener_(t,o))),l},Dr.prototype.removeEventRegistration=function(t,e,n){var r=this,i=t.path,o=this.syncPointTree_.get(i),s=[];if(o&amp;&amp;("default"===t.queryIdentifier()||o.viewExistsForQuery(t))){var a=o.removeEventRegistration(t,e,n);o.isEmpty()&amp;&amp;(this.syncPointTree_=this.syncPointTree_.remove(i));e=a.removed,s=a.events,o=-1!==e.findIndex((function(t){return t.getQueryParams().loadsAllData()})),a=this.syncPointTree_.findOnPath(i,(function(t,e){return e.hasCompleteView()}));if(o&amp;&amp;!a){i=this.syncPointTree_.subtree(i);if(!i.isEmpty())for(var h=this.collectDistinctViewsForSubTree_(i),l=0;l&lt;h.length;++l){var u=h[l],c=u.getQuery(),u=this.createListenerForView_(u);this.listenProvider_.startListening(Dr.queryForListening_(c),this.tagForQuery_(c),u.hashFn,u.onComplete)}}!a&amp;&amp;0&lt;e.length&amp;&amp;!n&amp;&amp;(o?this.listenProvider_.stopListening(Dr.queryForListening_(t),null):e.forEach((function(t){var e=r.queryToTagMap.get(Dr.makeQueryKey_(t));r.listenProvider_.stopListening(Dr.queryForListening_(t),e)}))),this.removeTags_(e)}return s},Dr.prototype.calcCompleteEventCache=function(n,t){var e=this.pendingWriteTree_,r=this.syncPointTree_.findOnPath(n,(function(t,e){t=Mt.relativePath(t,n),t=e.getCompleteServerCache(t);if(t)return t}));return e.calcCompleteEventCache(n,r,t,!0)},Dr.prototype.collectDistinctViewsForSubTree_=function(t){return t.fold((function(t,e,n){if(e&amp;&amp;e.hasCompleteView())return[e.getCompleteView()];var r=[];return e&amp;&amp;(r=e.getQueryViews()),Ot(n,(function(t,e){r=r.concat(e)})),r}))},Dr.prototype.removeTags_=function(t){for(var e=0;e&lt;t.length;++e){var n,r=t[e];r.getQueryParams().loadsAllData()||(n=Dr.makeQueryKey_(r),r=this.queryToTagMap.get(n),this.queryToTagMap.delete(n),this.tagToQueryMap.delete(r))}},Dr.queryForListening_=function(t){return t.getQueryParams().loadsAllData()&amp;&amp;!t.getQueryParams().isDefault()?t.getRef():t},Dr.prototype.setupListener_=function(t,e){var n=t.path,r=this.tagForQuery_(t),e=this.createListenerForView_(e),e=this.listenProvider_.startListening(Dr.queryForListening_(t),r,e.hashFn,e.onComplete),n=this.syncPointTree_.subtree(n);if(r)y(!n.value.hasCompleteView(),"If we're adding a query, it shouldn't be shadowed");else for(var i=n.fold((function(t,e,n){if(!t.isEmpty()&amp;&amp;e&amp;&amp;e.hasCompleteView())return[e.getCompleteView().getQuery()];var r=[];return e&amp;&amp;(r=r.concat(e.getQueryViews().map((function(t){return t.getQuery()})))),Ot(n,(function(t,e){r=r.concat(e)})),r})),o=0;o&lt;i.length;++o){var s=i[o];this.listenProvider_.stopListening(Dr.queryForListening_(s),this.tagForQuery_(s))}return e},Dr.prototype.createListenerForView_=function(t){var e=this,n=t.getQuery(),r=this.tagForQuery_(n);return{hashFn:function(){return(t.getServerCache()||en.EMPTY_NODE).hash()},onComplete:function(t){if("ok"===t)return r?e.applyTaggedListenComplete(n.path,r):e.applyListenComplete(n.path);t=function(t,e){var n="Unknown Error";"too_big"===t?n="The data requested exceeds the maximum size that can be accessed with a single request.":"permission_denied"===t?n="Client doesn't have permission to access the desired data.":"unavailable"===t&amp;&amp;(n="The service is unavailable");n=new Error(t+" at "+e.path.toString()+": "+n);return n.code=t.toUpperCase(),n}(t,n);return e.removeEventRegistration(n,null,t)}}},Dr.makeQueryKey_=function(t){return t.path.toString()+"$"+t.queryIdentifier()},Dr.parseQueryKey_=function(t){var e=t.indexOf("$");return y(-1!==e&amp;&amp;e&lt;t.length-1,"Bad queryKey."),{queryId:t.substr(e+1),path:new Mt(t.substr(0,e))}},Dr.prototype.queryKeyForTag_=function(t){return this.tagToQueryMap.get(t)},Dr.prototype.tagForQuery_=function(t){t=Dr.makeQueryKey_(t);return this.queryToTagMap.get(t)},Dr.getNextQueryTag_=function(){return Dr.nextQueryTag_++},Dr.prototype.applyTaggedOperation_=function(t,e){var n=this.syncPointTree_.get(t);y(n,"Missing sync point for query tag that we're tracking");t=this.pendingWriteTree_.childWrites(t);return n.applyOperation(e,t,null)},Dr.prototype.applyOperationToSyncPoints_=function(t){return this.applyOperationHelper_(t,this.syncPointTree_,null,this.pendingWriteTree_.childWrites(Mt.Empty))},Dr.prototype.applyOperationHelper_=function(t,e,n,r){if(t.path.isEmpty())return this.applyOperationDescendantsHelper_(t,e,n,r);var i=e.get(Mt.Empty);null==n&amp;&amp;null!=i&amp;&amp;(n=i.getCompleteServerCache(Mt.Empty));var o=[],s=t.path.getFront(),a=t.operationForChild(s),h=e.children.get(s);return h&amp;&amp;a&amp;&amp;(e=n?n.getImmediateChild(s):null,s=r.child(s),o=o.concat(this.applyOperationHelper_(a,h,e,s))),i&amp;&amp;(o=o.concat(i.applyOperation(t,r,n))),o},Dr.prototype.applyOperationDescendantsHelper_=function(i,t,o,s){var a=this,e=t.get(Mt.Empty);null==o&amp;&amp;null!=e&amp;&amp;(o=e.getCompleteServerCache(Mt.Empty));var h=[];return t.children.inorderTraversal((function(t,e){var n=o?o.getImmediateChild(t):null,r=s.child(t),t=i.operationForChild(t);t&amp;&amp;(h=h.concat(a.applyOperationDescendantsHelper_(t,e,n,r)))})),e&amp;&amp;(h=h.concat(e.applyOperation(i,s,o))),h},Dr.nextQueryTag_=1,Dr);function Dr(t){this.listenProvider_=t,this.syncPointTree_=Bn.Empty,this.pendingWriteTree_=new Tr,this.tagToQueryMap=new Map,this.queryToTagMap=new Map}var Or=(xr.prototype.getNode=function(t){return this.rootNode_.getChild(t)},xr.prototype.updateSnapshot=function(t,e){this.rootNode_=this.rootNode_.updateChild(t,e)},xr);function xr(){this.rootNode_=en.EMPTY_NODE}var kr=(Ar.prototype.incrementCounter=function(t,e){void 0===e&amp;&amp;(e=1),O(this.counters_,t)||(this.counters_[t]=0),this.counters_[t]+=e},Ar.prototype.get=function(){return d(this.counters_)},Ar);function Ar(){this.counters_={}}var Fr=(Lr.getCollection=function(t){t=t.toString();return this.collections_[t]||(this.collections_[t]=new kr),this.collections_[t]},Lr.getOrCreateReporter=function(t,e){t=t.toString();return this.reporters_[t]||(this.reporters_[t]=e()),this.reporters_[t]},Lr.collections_={},Lr.reporters_={},Lr);function Lr(){}var Mr=(Wr.prototype.get=function(){var t=this.collection_.get(),n=l({},t);return this.last_&amp;&amp;Ot(this.last_,(function(t,e){n[t]=n[t]-e})),this.last_=t,n},Wr);function Wr(t){this.collection_=t,this.last_=null}var qr=(Qr.prototype.includeStat=function(t){this.statsToReport_[t]=!0},Qr.prototype.reportStats_=function(){var n=this,t=this.statsListener_.get(),r={},i=!1;Ot(t,(function(t,e){0&lt;e&amp;&amp;O(n.statsToReport_,t)&amp;&amp;(r[t]=e,i=!0)})),i&amp;&amp;this.server_.reportStats(r),At(this.reportStats_.bind(this),Math.floor(2*Math.random()*3e5))},Qr);function Qr(t,e){this.server_=e,this.statsToReport_={},this.statsListener_=new Mr(t);t=1e4+2e4*Math.random();At(this.reportStats_.bind(this),Math.floor(t))}var Ur=(Vr.prototype.queueEvents=function(t){for(var e=null,n=0;n&lt;t.length;n++){var r=t[n],i=r.getPath();null===e||i.equals(e.getPath())||(this.eventLists_.push(e),e=null),null===e&amp;&amp;(e=new Hr(i)),e.add(r)}e&amp;&amp;this.eventLists_.push(e)},Vr.prototype.raiseEventsAtPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_((function(t){return t.equals(e)}))},Vr.prototype.raiseEventsForChangedPath=function(e,t){this.queueEvents(t),this.raiseQueuedEventsMatchingPredicate_((function(t){return t.contains(e)||e.contains(t)}))},Vr.prototype.raiseQueuedEventsMatchingPredicate_=function(t){this.recursionDepth_++;for(var e=!0,n=0;n&lt;this.eventLists_.length;n++){var r=this.eventLists_[n];r&amp;&amp;(t(r.getPath())?(this.eventLists_[n].raise(),this.eventLists_[n]=null):e=!1)}e&amp;&amp;(this.eventLists_=[]),this.recursionDepth_--},Vr);function Vr(){this.eventLists_=[],this.recursionDepth_=0}var Hr=(jr.prototype.add=function(t){this.events_.push(t)},jr.prototype.raise=function(){for(var t=0;t&lt;this.events_.length;t++){var e,n=this.events_[t];null!==n&amp;&amp;(this.events_[t]=null,e=n.getEventRunner(),bt&amp;&amp;Tt("event: "+n.toString()),kt(e))}},jr.prototype.getPath=function(){return this.path_},jr);function jr(t){this.path_=t,this.events_=[]}Br.prototype.trigger=function(t){for(var e=[],n=1;n&lt;arguments.length;n++)e[n-1]=arguments[n];if(Array.isArray(this.listeners_[t]))for(var r=s(this.listeners_[t]),i=0;i&lt;r.length;i++)r[i].callback.apply(r[i].context,e)},Br.prototype.on=function(t,e,n){this.validateEventType_(t),this.listeners_[t]=this.listeners_[t]||[],this.listeners_[t].push({callback:e,context:n});t=this.getInitialEvent(t);t&amp;&amp;e.apply(n,t)},Br.prototype.off=function(t,e,n){this.validateEventType_(t);for(var r=this.listeners_[t]||[],i=0;i&lt;r.length;i++)if(r[i].callback===e&amp;&amp;(!n||n===r[i].context))return void r.splice(i,1)},Br.prototype.validateEventType_=function(e){y(this.allowedEvents_.find((function(t){return t===e})),"Unknown event: "+e)},Ce=Br;function Br(t){this.allowedEvents_=t,this.listeners_={},y(Array.isArray(t)&amp;&amp;0&lt;t.length,"Requires a non-empty array")}var zr,Kr=(n(Yr,zr=Ce),Yr.getInstance=function(){return new Yr},Yr.prototype.getInitialEvent=function(t){return y("visible"===t,"Unknown event type: "+t),[this.visible_]},Yr);function Yr(){var e,t,n=zr.call(this,["visible"])||this;return"undefined"!=typeof document&amp;&amp;void 0!==document.addEventListener&amp;&amp;(void 0!==document.hidden?(t="visibilitychange",e="hidden"):void 0!==document.mozHidden?(t="mozvisibilitychange",e="mozHidden"):void 0!==document.msHidden?(t="msvisibilitychange",e="msHidden"):void 0!==document.webkitHidden&amp;&amp;(t="webkitvisibilitychange",e="webkitHidden")),n.visible_=!0,t&amp;&amp;document.addEventListener(t,(function(){var t=!document[e];t!==n.visible_&amp;&amp;(n.visible_=t,n.trigger("visible",t))}),!1),n}var Gr,Xr=(n($r,Gr=Ce),$r.getInstance=function(){return new $r},$r.prototype.getInitialEvent=function(t){return y("online"===t,"Unknown event type: "+t),[this.online_]},$r.prototype.currentlyOnline=function(){return this.online_},$r);function $r(){var t=Gr.call(this,["online"])||this;return t.online_=!0,"undefined"==typeof window||void 0===window.addEventListener||m()||(window.addEventListener("online",(function(){t.online_||(t.online_=!0,t.trigger("online",!0))}),!1),window.addEventListener("offline",(function(){t.online_&amp;&amp;(t.online_=!1,t.trigger("online",!1))}),!1)),t}var Jr=(Zr.prototype.closeAfter=function(t,e){this.closeAfterResponse=t,this.onClose=e,this.closeAfterResponse&lt;this.currentResponseNum&amp;&amp;(this.onClose(),this.onClose=null)},Zr.prototype.handleResponse=function(t,e){var n=this;this.pendingResponses[t]=e;for(var r=this;this.pendingResponses[this.currentResponseNum];){if("break"===function(){var e=r.pendingResponses[r.currentResponseNum];delete r.pendingResponses[r.currentResponseNum];for(var t=0;t&lt;e.length;++t)!function(t){e[t]&amp;&amp;kt((function(){n.onMessage_(e[t])}))}(t);if(r.currentResponseNum===r.closeAfterResponse)return r.onClose&amp;&amp;(r.onClose(),r.onClose=null),"break";r.currentResponseNum++}())break}},Zr);function Zr(t){this.onMessage_=t,this.pendingResponses=[],this.currentResponseNum=0,this.closeAfterResponse=-1,this.onClose=null}var ti="pLPCommand",ei="pRTLPCB",ni=(ri.prototype.open=function(t,e){var n,r,i,s=this;this.curSegmentNum=0,this.onDisconnect_=e,this.myPacketOrderer=new Jr(t),this.isClosed_=!1,this.connectTimeoutTimer_=setTimeout((function(){s.log_("Timed out trying to connect."),s.onClosed_(),s.connectTimeoutTimer_=null}),Math.floor(3e4)),n=function(){var t;s.isClosed_||(s.scriptTagHolder=new ii((function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];var n=_(t,5),r=n[0],i=n[1],o=n[2];n[3],n[4];if(s.incrementIncomingBytes_(t),s.scriptTagHolder)if(s.connectTimeoutTimer_&amp;&amp;(clearTimeout(s.connectTimeoutTimer_),s.connectTimeoutTimer_=null),s.everConnected_=!0,"start"===r)s.id=i,s.password=o;else{if("close"!==r)throw new Error("Unrecognized command received: "+r);i?(s.scriptTagHolder.sendNewPolls=!1,s.myPacketOrderer.closeAfter(i,(function(){s.onClosed_()}))):s.onClosed_()}}),(function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];var n=_(t,2),r=n[0],n=n[1];s.incrementIncomingBytes_(t),s.myPacketOrderer.handleResponse(r,n)}),(function(){s.onClosed_()}),s.urlFn),(t={start:"t"}).ser=Math.floor(1e8*Math.random()),s.scriptTagHolder.uniqueCallbackIdentifier&amp;&amp;(t.cb=s.scriptTagHolder.uniqueCallbackIdentifier),t.v="5",s.transportSessionId&amp;&amp;(t.s=s.transportSessionId),s.lastSessionId&amp;&amp;(t.ls=s.lastSessionId),s.applicationId&amp;&amp;(t.p=s.applicationId),"undefined"!=typeof location&amp;&amp;location.hostname&amp;&amp;Ut.test(location.hostname)&amp;&amp;(t.r="f"),t=s.urlFn(t),s.log_("Connecting via long-poll to "+t),s.scriptTagHolder.addTag(t,(function(){})))},"complete"===document.readyState?n():(r=!1,i=function(){document.body?r||(r=!0,n()):setTimeout(i,Math.floor(10))},document.addEventListener?(document.addEventListener("DOMContentLoaded",i,!1),window.addEventListener("load",i,!1)):document.attachEvent&amp;&amp;(document.attachEvent("onreadystatechange",(function(){"complete"===document.readyState&amp;&amp;i()})),window.attachEvent("onload",i)))},ri.prototype.start=function(){this.scriptTagHolder.startLongPoll(this.id,this.password),this.addDisconnectPingFrame(this.id,this.password)},ri.forceAllow=function(){ri.forceAllow_=!0},ri.forceDisallow=function(){ri.forceDisallow_=!0},ri.isAvailable=function(){return!!ri.forceAllow_||!(ri.forceDisallow_||"undefined"==typeof document||null==document.createElement||"object"==typeof window&amp;&amp;window.chrome&amp;&amp;window.chrome.extension&amp;&amp;!/^chrome/.test(window.location.href)||"object"==typeof Windows&amp;&amp;"object"==typeof Windows.UI)},ri.prototype.markConnectionHealthy=function(){},ri.prototype.shutdown_=function(){this.isClosed_=!0,this.scriptTagHolder&amp;&amp;(this.scriptTagHolder.close(),this.scriptTagHolder=null),this.myDisconnFrame&amp;&amp;(document.body.removeChild(this.myDisconnFrame),this.myDisconnFrame=null),this.connectTimeoutTimer_&amp;&amp;(clearTimeout(this.connectTimeoutTimer_),this.connectTimeoutTimer_=null)},ri.prototype.onClosed_=function(){this.isClosed_||(this.log_("Longpoll is closing itself"),this.shutdown_(),this.onDisconnect_&amp;&amp;(this.onDisconnect_(this.everConnected_),this.onDisconnect_=null))},ri.prototype.close=function(){this.isClosed_||(this.log_("Longpoll is being closed."),this.shutdown_())},ri.prototype.send=function(t){t=P(t);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);for(var t=function(t){t=a(t);return p.encodeByteArray(t,!0)}(t),e=_t(t,1840),n=0;n&lt;e.length;n++)this.scriptTagHolder.enqueueSegment(this.curSegmentNum,e.length,e[n]),this.curSegmentNum++},ri.prototype.addDisconnectPingFrame=function(t,e){this.myDisconnFrame=document.createElement("iframe");var n={dframe:"t"};n.id=t,n.pw=e,this.myDisconnFrame.src=this.urlFn(n),this.myDisconnFrame.style.display="none",document.body.appendChild(this.myDisconnFrame)},ri.prototype.incrementIncomingBytes_=function(t){t=P(t).length;this.bytesReceived+=t,this.stats_.incrementCounter("bytes_received",t)},ri);function ri(t,e,n,r,i){this.connId=t,this.repoInfo=e,this.applicationId=n,this.transportSessionId=r,this.lastSessionId=i,this.bytesSent=0,this.bytesReceived=0,this.everConnected_=!1,this.log_=It(t),this.stats_=Fr.getCollection(e),this.urlFn=function(t){return e.connectionURL(Ht,t)}}var ii=(oi.createIFrame_=function(){var e=document.createElement("iframe");if(e.style.display="none",!document.body)throw"Document body has not initialized. Wait to initialize Firebase until after the document is ready.";document.body.appendChild(e);try{e.contentWindow.document||Tt("No IE domain setting required")}catch(t){var n=document.domain;e.src="javascript:void((function(){document.open();document.domain='"+n+"';document.close();})())"}return e.contentDocument?e.doc=e.contentDocument:e.contentWindow?e.doc=e.contentWindow.document:e.document&amp;&amp;(e.doc=e.document),e},oi.prototype.close=function(){var t=this;this.alive=!1,this.myIFrame&amp;&amp;(this.myIFrame.doc.body.innerHTML="",setTimeout((function(){null!==t.myIFrame&amp;&amp;(document.body.removeChild(t.myIFrame),t.myIFrame=null)}),Math.floor(0)));var e=this.onDisconnect;e&amp;&amp;(this.onDisconnect=null,e())},oi.prototype.startLongPoll=function(t,e){for(this.myID=t,this.myPW=e,this.alive=!0;this.newRequest_(););},oi.prototype.newRequest_=function(){if(this.alive&amp;&amp;this.sendNewPolls&amp;&amp;this.outstandingRequests.size&lt;(0&lt;this.pendingSegs.length?2:1)){this.currentSerial++;var t={};t.id=this.myID,t.pw=this.myPW,t.ser=this.currentSerial;for(var t=this.urlFn(t),e="",n=0;0&lt;this.pendingSegs.length;){if(!(this.pendingSegs[0].d.length+30+e.length&lt;=1870))break;var r=this.pendingSegs.shift(),e=e+"&amp;seg"+n+"="+r.seg+"&amp;ts"+n+"="+r.ts+"&amp;d"+n+"="+r.d;n++}return t+=e,this.addLongPollTag_(t,this.currentSerial),!0}return!1},oi.prototype.enqueueSegment=function(t,e,n){this.pendingSegs.push({seg:t,ts:e,d:n}),this.alive&amp;&amp;this.newRequest_()},oi.prototype.addLongPollTag_=function(t,e){var n=this;this.outstandingRequests.add(e);function r(){n.outstandingRequests.delete(e),n.newRequest_()}var i=setTimeout(r,Math.floor(25e3));this.addTag(t,(function(){clearTimeout(i),r()}))},oi.prototype.addTag=function(t,n){var r=this;setTimeout((function(){try{if(!r.sendNewPolls)return;var e=r.myIFrame.doc.createElement("script");e.type="text/javascript",e.async=!0,e.src=t,e.onload=e.onreadystatechange=function(){var t=e.readyState;t&amp;&amp;"loaded"!==t&amp;&amp;"complete"!==t||(e.onload=e.onreadystatechange=null,e.parentNode&amp;&amp;e.parentNode.removeChild(e),n())},e.onerror=function(){Tt("Long-poll script failed to load: "+t),r.sendNewPolls=!1,r.close()},r.myIFrame.doc.body.appendChild(e)}catch(t){}}),Math.floor(1))},oi);function oi(t,e,n,r){this.onDisconnect=n,this.urlFn=r,this.outstandingRequests=new Set,this.pendingSegs=[],this.currentSerial=Math.floor(1e8*Math.random()),this.sendNewPolls=!0,this.uniqueCallbackIdentifier=Et(),window[ti+this.uniqueCallbackIdentifier]=t,window[ei+this.uniqueCallbackIdentifier]=e,this.myIFrame=oi.createIFrame_();e="";this.myIFrame.src&amp;&amp;"javascript:"===this.myIFrame.src.substr(0,"javascript:".length)&amp;&amp;(e='&lt;script&gt;document.domain="'+document.domain+'";&lt;\/script&gt;');var i="&lt;html&gt;&lt;body&gt;"+e+"&lt;/body&gt;&lt;/html&gt;";try{this.myIFrame.doc.open(),this.myIFrame.doc.write(i),this.myIFrame.doc.close()}catch(t){Tt("frame writing exception"),t.stack&amp;&amp;Tt(t.stack),Tt(t)}}var si="";function ai(t){si=t}var hi=null;"undefined"!=typeof MozWebSocket?hi=MozWebSocket:"undefined"!=typeof WebSocket&amp;&amp;(hi=WebSocket);var li=(ui.connectionURL_=function(t,e,n){var r={v:"5"};return"undefined"!=typeof location&amp;&amp;location.hostname&amp;&amp;Ut.test(location.hostname)&amp;&amp;(r.r="f"),e&amp;&amp;(r.s=e),n&amp;&amp;(r.ls=n),t.connectionURL(Vt,r)},ui.prototype.open=function(e,t){var n,r=this;this.onDisconnect=t,this.onMessage=e,this.log_("Websocket connecting to "+this.connURL),this.everConnected_=!1,vt.set("previous_websocket_failure",!0);try{C()||(n={headers:{"X-Firebase-GMPID":this.applicationId||""}},this.mySock=new hi(this.connURL,[],n))}catch(t){this.log_("Error instantiating WebSocket.");e=t.message||t.data;return e&amp;&amp;this.log_(e),void this.onClosed_()}this.mySock.onopen=function(){r.log_("Websocket connected."),r.everConnected_=!0},this.mySock.onclose=function(){r.log_("Websocket connection was disconnected."),r.mySock=null,r.onClosed_()},this.mySock.onmessage=function(t){r.handleIncomingFrame(t)},this.mySock.onerror=function(t){r.log_("WebSocket error.  Closing connection.");t=t.message||t.data;t&amp;&amp;r.log_(t),r.onClosed_()}},ui.prototype.start=function(){},ui.forceDisallow=function(){ui.forceDisallow_=!0},ui.isAvailable=function(){var t,e=!1;return"undefined"!=typeof navigator&amp;&amp;navigator.userAgent&amp;&amp;((t=navigator.userAgent.match(/Android ([0-9]{0,}\.[0-9]{0,})/))&amp;&amp;1&lt;t.length&amp;&amp;parseFloat(t[1])&lt;4.4&amp;&amp;(e=!0)),!e&amp;&amp;null!==hi&amp;&amp;!ui.forceDisallow_},ui.previouslyFailed=function(){return vt.isInMemoryStorage||!0===vt.get("previous_websocket_failure")},ui.prototype.markConnectionHealthy=function(){vt.remove("previous_websocket_failure")},ui.prototype.appendFrame_=function(t){this.frames.push(t),this.frames.length===this.totalFrames&amp;&amp;(t=this.frames.join(""),this.frames=null,t=R(t),this.onMessage(t))},ui.prototype.handleNewFrameCount_=function(t){this.totalFrames=t,this.frames=[]},ui.prototype.extractFrameCount_=function(t){if(y(null===this.frames,"We already have a frame buffer"),t.length&lt;=6){var e=Number(t);if(!isNaN(e))return this.handleNewFrameCount_(e),null}return this.handleNewFrameCount_(1),t},ui.prototype.handleIncomingFrame=function(t){null!==this.mySock&amp;&amp;(t=t.data,this.bytesReceived+=t.length,this.stats_.incrementCounter("bytes_received",t.length),this.resetKeepAlive(),null!==this.frames?this.appendFrame_(t):null!==(t=this.extractFrameCount_(t))&amp;&amp;this.appendFrame_(t))},ui.prototype.send=function(t){this.resetKeepAlive();t=P(t);this.bytesSent+=t.length,this.stats_.incrementCounter("bytes_sent",t.length);var e=_t(t,16384);1&lt;e.length&amp;&amp;this.sendString_(String(e.length));for(var n=0;n&lt;e.length;n++)this.sendString_(e[n])},ui.prototype.shutdown_=function(){this.isClosed_=!0,this.keepaliveTimer&amp;&amp;(clearInterval(this.keepaliveTimer),this.keepaliveTimer=null),this.mySock&amp;&amp;(this.mySock.close(),this.mySock=null)},ui.prototype.onClosed_=function(){this.isClosed_||(this.log_("WebSocket is closing itself"),this.shutdown_(),this.onDisconnect&amp;&amp;(this.onDisconnect(this.everConnected_),this.onDisconnect=null))},ui.prototype.close=function(){this.isClosed_||(this.log_("WebSocket is being closed"),this.shutdown_())},ui.prototype.resetKeepAlive=function(){var t=this;clearInterval(this.keepaliveTimer),this.keepaliveTimer=setInterval((function(){t.mySock&amp;&amp;t.sendString_("0"),t.resetKeepAlive()}),Math.floor(45e3))},ui.prototype.sendString_=function(t){try{this.mySock.send(t)}catch(t){this.log_("Exception thrown from WebSocket.send():",t.message||t.data,"Closing connection."),setTimeout(this.onClosed_.bind(this),0)}},ui.responsesRequiredToBeHealthy=2,ui.healthyTimeout=3e4,ui);function ui(t,e,n,r,i){this.connId=t,this.applicationId=n,this.keepaliveTimer=null,this.frames=null,this.totalFrames=0,this.bytesSent=0,this.bytesReceived=0,this.log_=It(this.connId),this.stats_=Fr.getCollection(e),this.connURL=ui.connectionURL_(e,r,i),this.nodeAdmin=e.nodeAdmin}var ci=(Object.defineProperty(pi,"ALL_TRANSPORTS",{get:function(){return[ni,li]},enumerable:!1,configurable:!0}),pi.prototype.initTransports_=function(t){var e,n,r=li&amp;&amp;li.isAvailable(),i=r&amp;&amp;!li.previouslyFailed();if(t.webSocketOnly&amp;&amp;(r||ct("wss:// URL used, but browser isn't known to support websockets.  Trying anyway."),i=!0),i)this.transports_=[li];else{var o=this.transports_=[];try{for(var s=f(pi.ALL_TRANSPORTS),a=s.next();!a.done;a=s.next()){var h=a.value;h&amp;&amp;h.isAvailable()&amp;&amp;o.push(h)}}catch(t){e={error:t}}finally{try{a&amp;&amp;!a.done&amp;&amp;(n=s.return)&amp;&amp;n.call(s)}finally{if(e)throw e.error}}}},pi.prototype.initialTransport=function(){if(0&lt;this.transports_.length)return this.transports_[0];throw new Error("No transports available")},pi.prototype.upgradeTransport=function(){return 1&lt;this.transports_.length?this.transports_[1]:null},pi);function pi(t){this.initTransports_(t)}var di=(fi.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_&amp;&amp;t.conn_.open(n,r)}),Math.floor(0));e=e.healthyTimeout||0;0&lt;e&amp;&amp;(this.healthyTimeout_=At((function(){t.healthyTimeout_=null,t.isHealthy_||(t.conn_&amp;&amp;102400&lt;t.conn_.bytesReceived?(t.log_("Connection exceeded healthy timeout but has received "+t.conn_.bytesReceived+" bytes.  Marking connection healthy."),t.isHealthy_=!0,t.conn_.markConnectionHealthy()):t.conn_&amp;&amp;10240&lt;t.conn_.bytesSent?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(e)))},fi.prototype.nextTransportId_=function(){return"c:"+this.id+":"+this.connectionCount++},fi.prototype.disconnReceiver_=function(e){var n=this;return function(t){e===n.conn_?n.onConnectionLost_(t):e===n.secondaryConn_?(n.log_("Secondary connection lost."),n.onSecondaryConnectionLost_()):n.log_("closing an old connection")}},fi.prototype.connReceiver_=function(e){var n=this;return function(t){2!==n.state_&amp;&amp;(e===n.rx_?n.onPrimaryMessageReceived_(t):e===n.secondaryConn_?n.onSecondaryMessageReceived_(t):n.log_("message on old connection"))}},fi.prototype.sendRequest=function(t){t={t:"d",d:t};this.sendData_(t)},fi.prototype.tryCleanupConnection=function(){this.tx_===this.secondaryConn_&amp;&amp;this.rx_===this.secondaryConn_&amp;&amp;(this.log_("cleaning up and promoting a connection: "+this.secondaryConn_.connId),this.conn_=this.secondaryConn_,this.secondaryConn_=null)},fi.prototype.onSecondaryControl_=function(t){"t"in t&amp;&amp;("a"===(t=t.t)?this.upgradeIfSecondaryHealthy_():"r"===t?(this.log_("Got a reset on secondary, closing it"),this.secondaryConn_.close(),this.tx_!==this.secondaryConn_&amp;&amp;this.rx_!==this.secondaryConn_||this.close()):"o"===t&amp;&amp;(this.log_("got pong on secondary."),this.secondaryResponsesRequired_--,this.upgradeIfSecondaryHealthy_()))},fi.prototype.onSecondaryMessageReceived_=function(t){var e=ft("t",t),t=ft("d",t);if("c"===e)this.onSecondaryControl_(t);else{if("d"!==e)throw new Error("Unknown protocol layer: "+e);this.pendingDataMessages.push(t)}},fi.prototype.upgradeIfSecondaryHealthy_=function(){this.secondaryResponsesRequired_&lt;=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:{}}}))},fi.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()},fi.prototype.onPrimaryMessageReceived_=function(t){var e=ft("t",t),t=ft("d",t);"c"===e?this.onControl_(t):"d"===e&amp;&amp;this.onDataMessage_(t)},fi.prototype.onDataMessage_=function(t){this.onPrimaryResponse_(),this.onMessage_(t)},fi.prototype.onPrimaryResponse_=function(){this.isHealthy_||(this.primaryResponsesRequired_--,this.primaryResponsesRequired_&lt;=0&amp;&amp;(this.log_("Primary connection is healthy."),this.isHealthy_=!0,this.conn_.markConnectionHealthy()))},fi.prototype.onControl_=function(t){var e=ft("t",t);if("d"in t){t=t.d;if("h"===e)this.onHandshake_(t);else if("n"===e){this.log_("recvd end transmission on primary"),this.rx_=this.secondaryConn_;for(var n=0;n&lt;this.pendingDataMessages.length;++n)this.onDataMessage_(this.pendingDataMessages[n]);this.pendingDataMessages=[],this.tryCleanupConnection()}else"s"===e?this.onConnectionShutdown_(t):"r"===e?this.onReset_(t):"e"===e?lt("Server Error: "+t):"o"===e?(this.log_("got pong on primary."),this.onPrimaryResponse_(),this.sendPingOnPrimaryIfNecessary_()):lt("Unknown control packet command: "+e)}},fi.prototype.onHandshake_=function(t){var e=t.ts,n=t.v,r=t.h;this.sessionId=t.s,this.repoInfo_.updateHost(r),0===this.state_&amp;&amp;(this.conn_.start(),this.onConnectionEstablished_(this.conn_,e),"5"!==n&amp;&amp;ct("Protocol version mismatch detected"),this.tryStartUpgrade_())},fi.prototype.tryStartUpgrade_=function(){var t=this.transportManager_.upgradeTransport();t&amp;&amp;this.startUpgrade_(t)},fi.prototype.startUpgrade_=function(t){var e=this;this.secondaryConn_=new t(this.nextTransportId_(),this.repoInfo_,this.applicationId_,this.sessionId),this.secondaryResponsesRequired_=t.responsesRequiredToBeHealthy||0;var n=this.connReceiver_(this.secondaryConn_),t=this.disconnReceiver_(this.secondaryConn_);this.secondaryConn_.open(n,t),At((function(){e.secondaryConn_&amp;&amp;(e.log_("Timed out trying to upgrade."),e.secondaryConn_.close())}),Math.floor(6e4))},fi.prototype.onReset_=function(t){this.log_("Reset packet received.  New host: "+t),this.repoInfo_.updateHost(t),1===this.state_?this.close():(this.closeConnections_(),this.start_())},fi.prototype.onConnectionEstablished_=function(t,e){var n=this;this.log_("Realtime connection established."),this.conn_=t,this.state_=1,this.onReady_&amp;&amp;(this.onReady_(e,this.sessionId),this.onReady_=null),0===this.primaryResponsesRequired_?(this.log_("Primary connection is healthy."),this.isHealthy_=!0):At((function(){n.sendPingOnPrimaryIfNecessary_()}),Math.floor(5e3))},fi.prototype.sendPingOnPrimaryIfNecessary_=function(){this.isHealthy_||1!==this.state_||(this.log_("sending ping on primary."),this.sendData_({t:"c",d:{t:"p",d:{}}}))},fi.prototype.onSecondaryConnectionLost_=function(){var t=this.secondaryConn_;this.secondaryConn_=null,this.tx_!==t&amp;&amp;this.rx_!==t||this.close()},fi.prototype.onConnectionLost_=function(t){this.conn_=null,t||0!==this.state_?1===this.state_&amp;&amp;this.log_("Realtime connection lost."):(this.log_("Realtime connection failed."),this.repoInfo_.isCacheableHost()&amp;&amp;(vt.remove("host:"+this.repoInfo_.host),this.repoInfo_.internalHost=this.repoInfo_.host)),this.close()},fi.prototype.onConnectionShutdown_=function(t){this.log_("Connection shutdown command received. Shutting down..."),this.onKill_&amp;&amp;(this.onKill_(t),this.onKill_=null),this.onDisconnect_=null,this.close()},fi.prototype.sendData_=function(t){if(1!==this.state_)throw"Connection is not connected";this.tx_.send(t)},fi.prototype.close=function(){2!==this.state_&amp;&amp;(this.log_("Closing realtime connection."),this.state_=2,this.closeConnections_(),this.onDisconnect_&amp;&amp;(this.onDisconnect_(),this.onDisconnect_=null))},fi.prototype.closeConnections_=function(){this.log_("Shutting down all connections"),this.conn_&amp;&amp;(this.conn_.close(),this.conn_=null),this.secondaryConn_&amp;&amp;(this.secondaryConn_.close(),this.secondaryConn_=null),this.healthyTimeout_&amp;&amp;(clearTimeout(this.healthyTimeout_),this.healthyTimeout_=null)},fi);function fi(t,e,n,r,i,o,s,a){this.id=t,this.repoInfo_=e,this.applicationId_=n,this.onMessage_=r,this.onReady_=i,this.onDisconnect_=o,this.onKill_=s,this.lastSessionId=a,this.connectionCount=0,this.pendingDataMessages=[],this.state_=0,this.log_=It("c:"+this.id+":"),this.transportManager_=new ci(e),this.log_("Connection created"),this.start_()}_i.prototype.put=function(t,e,n,r){},_i.prototype.merge=function(t,e,n,r){},_i.prototype.refreshAuthToken=function(t){},_i.prototype.onDisconnectPut=function(t,e,n){},_i.prototype.onDisconnectMerge=function(t,e,n){},_i.prototype.onDisconnectCancel=function(t,e){},_i.prototype.reportStats=function(t){},Ce=_i;function _i(){}var yi,gi=1e3,vi=3e5,mi=(n(Ci,yi=Ce),Ci.prototype.sendRequest=function(t,e,n){var r=++this.requestNumber_,e={r:r,a:t,b:e};this.log_(P(e)),y(this.connected_,"sendRequest call when we're not connected not allowed."),this.realtime_.sendRequest(e),n&amp;&amp;(this.requestCBHash_[r]=n)},Ci.prototype.get=function(t){var n=this,r=new g,i={p:t.path.toString(),q:t.queryObject()},e={action:"g",request:i,onComplete:function(t){var e=t.d;"ok"===t.s?(n.onDataUpdate_(i.p,e,!1,null),r.resolve(e)):r.reject(e)}};this.outstandingGets_.push(e),this.outstandingGetCount_++;var o=this.outstandingGets_.length-1;return this.connected_||setTimeout((function(){var t=n.outstandingGets_[o];void 0!==t&amp;&amp;e===t&amp;&amp;(delete n.outstandingGets_[o],n.outstandingGetCount_--,0===n.outstandingGetCount_&amp;&amp;(n.outstandingGets_=[]),n.log_("get "+o+" timed out on connection"),r.reject(new Error("Client is offline.")))}),3e3),this.connected_&amp;&amp;this.sendGet_(o),r.promise},Ci.prototype.listen=function(t,e,n,r){var i=t.queryIdentifier(),o=t.path.toString();this.log_("Listen called for "+o+" "+i),this.listens.has(o)||this.listens.set(o,new Map),y(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"listen() called for non-default but complete query"),y(!this.listens.get(o).has(i),"listen() called twice for same path/queryId.");n={onComplete:r,hashFn:e,query:t,tag:n};this.listens.get(o).set(i,n),this.connected_&amp;&amp;this.sendListen_(n)},Ci.prototype.sendGet_=function(e){var n=this,r=this.outstandingGets_[e];this.sendRequest("g",r.request,(function(t){delete n.outstandingGets_[e],n.outstandingGetCount_--,0===n.outstandingGetCount_&amp;&amp;(n.outstandingGets_=[]),r.onComplete&amp;&amp;r.onComplete(t)}))},Ci.prototype.sendListen_=function(r){var i=this,o=r.query,s=o.path.toString(),a=o.queryIdentifier();this.log_("Listen on "+s+" for "+a);var t={p:s};r.tag&amp;&amp;(t.q=o.queryObject(),t.t=r.tag),t.h=r.hashFn(),this.sendRequest("q",t,(function(t){var e=t.d,n=t.s;Ci.warnOnListenWarnings_(e,o),(i.listens.get(s)&amp;&amp;i.listens.get(s).get(a))===r&amp;&amp;(i.log_("listen response",t),"ok"!==n&amp;&amp;i.removeListen_(s,a),r.onComplete&amp;&amp;r.onComplete(n,e))}))},Ci.warnOnListenWarnings_=function(t,e){t&amp;&amp;"object"==typeof t&amp;&amp;O(t,"w")&amp;&amp;(t=x(t,"w"),Array.isArray(t)&amp;&amp;~t.indexOf("no_index")&amp;&amp;(t='".indexOn": "'+e.getQueryParams().getIndex().toString()+'"',e=e.path.toString(),ct("Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding "+t+" at "+e+" to your security rules for better performance.")))},Ci.prototype.refreshAuthToken=function(t){this.authToken_=t,this.log_("Auth token refreshed"),this.authToken_?this.tryAuth():this.connected_&amp;&amp;this.sendRequest("unauth",{},(function(){})),this.reduceReconnectDelayIfAdminCredential_(t)},Ci.prototype.reduceReconnectDelayIfAdminCredential_=function(t){(t&amp;&amp;40===t.length||function(t){t=D(t).claims;return"object"==typeof t&amp;&amp;!0===t.admin}(t))&amp;&amp;(this.log_("Admin auth credential detected.  Reducing max reconnect time."),this.maxReconnectDelay_=3e4)},Ci.prototype.tryAuth=function(){var n,t,e,r=this;this.connected_&amp;&amp;this.authToken_&amp;&amp;(t=function(t){t=D(t).claims;return!!t&amp;&amp;"object"==typeof t&amp;&amp;t.hasOwnProperty("iat")}(n=this.authToken_)?"auth":"gauth",e={cred:n},null===this.authOverride_?e.noauth=!0:"object"==typeof this.authOverride_&amp;&amp;(e.authvar=this.authOverride_),this.sendRequest(t,e,(function(t){var e=t.s,t=t.d||"error";r.authToken_===n&amp;&amp;("ok"===e?r.invalidAuthTokenCount_=0:r.onAuthRevoked_(e,t))})))},Ci.prototype.unlisten=function(t,e){var n=t.path.toString(),r=t.queryIdentifier();this.log_("Unlisten called for "+n+" "+r),y(t.getQueryParams().isDefault()||!t.getQueryParams().loadsAllData(),"unlisten() called for non-default but complete query"),this.removeListen_(n,r)&amp;&amp;this.connected_&amp;&amp;this.sendUnlisten_(n,r,t.queryObject(),e)},Ci.prototype.sendUnlisten_=function(t,e,n,r){this.log_("Unlisten on "+t+" for "+e);t={p:t};r&amp;&amp;(t.q=n,t.t=r),this.sendRequest("n",t)},Ci.prototype.onDisconnectPut=function(t,e,n){this.connected_?this.sendOnDisconnect_("o",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"o",data:e,onComplete:n})},Ci.prototype.onDisconnectMerge=function(t,e,n){this.connected_?this.sendOnDisconnect_("om",t,e,n):this.onDisconnectRequestQueue_.push({pathString:t,action:"om",data:e,onComplete:n})},Ci.prototype.onDisconnectCancel=function(t,e){this.connected_?this.sendOnDisconnect_("oc",t,null,e):this.onDisconnectRequestQueue_.push({pathString:t,action:"oc",data:null,onComplete:e})},Ci.prototype.sendOnDisconnect_=function(t,e,n,r){n={p:e,d:n};this.log_("onDisconnect "+t,n),this.sendRequest(t,n,(function(t){r&amp;&amp;setTimeout((function(){r(t.s,t.d)}),Math.floor(0))}))},Ci.prototype.put=function(t,e,n,r){this.putInternal("p",t,e,n,r)},Ci.prototype.merge=function(t,e,n,r){this.putInternal("m",t,e,n,r)},Ci.prototype.putInternal=function(t,e,n,r,i){n={p:e,d:n};void 0!==i&amp;&amp;(n.h=i),this.outstandingPuts_.push({action:t,request:n,onComplete:r}),this.outstandingPutCount_++;r=this.outstandingPuts_.length-1;this.connected_?this.sendPut_(r):this.log_("Buffering put: "+e)},Ci.prototype.sendPut_=function(e){var n=this,r=this.outstandingPuts_[e].action,t=this.outstandingPuts_[e].request,i=this.outstandingPuts_[e].onComplete;this.outstandingPuts_[e].queued=this.connected_,this.sendRequest(r,t,(function(t){n.log_(r+" response",t),delete n.outstandingPuts_[e],n.outstandingPutCount_--,0===n.outstandingPutCount_&amp;&amp;(n.outstandingPuts_=[]),i&amp;&amp;i(t.s,t.d)}))},Ci.prototype.reportStats=function(t){var e=this;this.connected_&amp;&amp;(t={c:t},this.log_("reportStats",t),this.sendRequest("s",t,(function(t){"ok"!==t.s&amp;&amp;(t=t.d,e.log_("reportStats","Error sending stats: "+t))})))},Ci.prototype.onDataMessage_=function(t){if("r"in t){this.log_("from server: "+P(t));var e=t.r,n=this.requestCBHash_[e];n&amp;&amp;(delete this.requestCBHash_[e],n(t.b))}else{if("error"in t)throw"A server-side error has occurred: "+t.error;"a"in t&amp;&amp;this.onDataPush_(t.a,t.b)}},Ci.prototype.onDataPush_=function(t,e){this.log_("handleServerMessage",t,e),"d"===t?this.onDataUpdate_(e.p,e.d,!1,e.t):"m"===t?this.onDataUpdate_(e.p,e.d,!0,e.t):"c"===t?this.onListenRevoked_(e.p,e.q):"ac"===t?this.onAuthRevoked_(e.s,e.d):"sd"===t?this.onSecurityDebugPacket_(e):lt("Unrecognized action received from server: "+P(t)+"\nAre you using the latest client?")},Ci.prototype.onReady_=function(t,e){this.log_("connection ready"),this.connected_=!0,this.lastConnectionEstablishedTime_=(new Date).getTime(),this.handleTimestamp_(t),this.lastSessionId=e,this.firstConnection_&amp;&amp;this.sendConnectStats_(),this.restoreState_(),this.firstConnection_=!1,this.onConnectStatus_(!0)},Ci.prototype.scheduleConnect_=function(t){var e=this;y(!this.realtime_,"Scheduling a connect when we're already connected/ing?"),this.establishConnectionTimer_&amp;&amp;clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=setTimeout((function(){e.establishConnectionTimer_=null,e.establishConnection_()}),Math.floor(t))},Ci.prototype.onVisible_=function(t){t&amp;&amp;!this.visible_&amp;&amp;this.reconnectDelay_===this.maxReconnectDelay_&amp;&amp;(this.log_("Window became visible.  Reducing delay."),this.reconnectDelay_=gi,this.realtime_||this.scheduleConnect_(0)),this.visible_=t},Ci.prototype.onOnline_=function(t){t?(this.log_("Browser went online."),this.reconnectDelay_=gi,this.realtime_||this.scheduleConnect_(0)):(this.log_("Browser went offline.  Killing connection."),this.realtime_&amp;&amp;this.realtime_.close())},Ci.prototype.onRealtimeDisconnect_=function(){var t;this.log_("data client disconnected"),this.connected_=!1,this.realtime_=null,this.cancelSentTransactions_(),this.requestCBHash_={},this.shouldReconnect_()&amp;&amp;(this.visible_?this.lastConnectionEstablishedTime_&amp;&amp;(3e4&lt;(new Date).getTime()-this.lastConnectionEstablishedTime_&amp;&amp;(this.reconnectDelay_=gi),this.lastConnectionEstablishedTime_=null):(this.log_("Window isn't visible.  Delaying reconnect."),this.reconnectDelay_=this.maxReconnectDelay_,this.lastConnectionAttemptTime_=(new Date).getTime()),t=(new Date).getTime()-this.lastConnectionAttemptTime_,t=Math.max(0,this.reconnectDelay_-t),t=Math.random()*t,this.log_("Trying to reconnect in "+t+"ms"),this.scheduleConnect_(t),this.reconnectDelay_=Math.min(this.maxReconnectDelay_,1.3*this.reconnectDelay_)),this.onConnectStatus_(!1)},Ci.prototype.establishConnection_=function(){var e,n,r,i,o,s,a,h,l,t,u=this;this.shouldReconnect_()&amp;&amp;(this.log_("Making a connection attempt"),this.lastConnectionAttemptTime_=(new Date).getTime(),this.lastConnectionEstablishedTime_=null,e=this.onDataMessage_.bind(this),n=this.onReady_.bind(this),r=this.onRealtimeDisconnect_.bind(this),i=this.id+":"+Ci.nextConnectionId_++,s=(o=this).lastSessionId,a=!1,h=null,l=function(){h?h.close():(a=!0,r())},this.realtime_={close:l,sendRequest:function(t){y(h,"sendRequest call when we're not connected not allowed."),h.sendRequest(t)}},t=this.forceTokenRefresh_,this.forceTokenRefresh_=!1,this.authTokenProvider_.getToken(t).then((function(t){a?Tt("getToken() completed but was canceled"):(Tt("getToken() completed. Creating connection."),o.authToken_=t&amp;&amp;t.accessToken,h=new di(i,o.repoInfo_,o.applicationId_,e,n,r,(function(t){ct(t+" ("+o.repoInfo_.toString()+")"),o.interrupt("server_kill")}),s))})).then(null,(function(t){o.log_("Failed to get token: "+t),a||(u.repoInfo_.nodeAdmin&amp;&amp;ct(t),l())})))},Ci.prototype.interrupt=function(t){Tt("Interrupting connection for reason: "+t),this.interruptReasons_[t]=!0,this.realtime_?this.realtime_.close():(this.establishConnectionTimer_&amp;&amp;(clearTimeout(this.establishConnectionTimer_),this.establishConnectionTimer_=null),this.connected_&amp;&amp;this.onRealtimeDisconnect_())},Ci.prototype.resume=function(t){Tt("Resuming connection for reason: "+t),delete this.interruptReasons_[t],k(this.interruptReasons_)&amp;&amp;(this.reconnectDelay_=gi,this.realtime_||this.scheduleConnect_(0))},Ci.prototype.handleTimestamp_=function(t){t-=(new Date).getTime();this.onServerInfoUpdate_({serverTimeOffset:t})},Ci.prototype.cancelSentTransactions_=function(){for(var t=0;t&lt;this.outstandingPuts_.length;t++){var e=this.outstandingPuts_[t];e&amp;&amp;"h"in e.request&amp;&amp;e.queued&amp;&amp;(e.onComplete&amp;&amp;e.onComplete("disconnect"),delete this.outstandingPuts_[t],this.outstandingPutCount_--)}0===this.outstandingPutCount_&amp;&amp;(this.outstandingPuts_=[])},Ci.prototype.onListenRevoked_=function(t,e){e=e?e.map((function(t){return Dt(t)})).join("$"):"default",e=this.removeListen_(t,e);e&amp;&amp;e.onComplete&amp;&amp;e.onComplete("permission_denied")},Ci.prototype.removeListen_=function(t,e){var n,r=new Mt(t).toString();return this.listens.has(r)?(n=(t=this.listens.get(r)).get(e),t.delete(e),0===t.size&amp;&amp;this.listens.delete(r)):n=void 0,n},Ci.prototype.onAuthRevoked_=function(t,e){Tt("Auth token revoked: "+t+"/"+e),this.authToken_=null,this.forceTokenRefresh_=!0,this.realtime_.close(),"invalid_token"!==t&amp;&amp;"permission_denied"!==t||(this.invalidAuthTokenCount_++,3&lt;=this.invalidAuthTokenCount_&amp;&amp;(this.reconnectDelay_=3e4,this.authTokenProvider_.notifyForInvalidToken()))},Ci.prototype.onSecurityDebugPacket_=function(t){this.securityDebugCallback_?this.securityDebugCallback_(t):"msg"in t&amp;&amp;console.log("FIREBASE: "+t.msg.replace("\n","\nFIREBASE: "))},Ci.prototype.restoreState_=function(){var e,t,n,r;this.tryAuth();try{for(var i=f(this.listens.values()),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,f(s.values())),h=a.next();!h.done;h=a.next()){var l=h.value;this.sendListen_(l)}}catch(t){n={error:t}}finally{try{h&amp;&amp;!h.done&amp;&amp;(r=a.return)&amp;&amp;r.call(a)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{o&amp;&amp;!o.done&amp;&amp;(t=i.return)&amp;&amp;t.call(i)}finally{if(e)throw e.error}}for(var u=0;u&lt;this.outstandingPuts_.length;u++)this.outstandingPuts_[u]&amp;&amp;this.sendPut_(u);for(;this.onDisconnectRequestQueue_.length;){var c=this.onDisconnectRequestQueue_.shift();this.sendOnDisconnect_(c.action,c.pathString,c.data,c.onComplete)}for(u=0;u&lt;this.outstandingGets_.length;u++)this.outstandingGets_[u]&amp;&amp;this.sendGet_(u)},Ci.prototype.sendConnectStats_=function(){var t={};t["sdk.js."+si.replace(/\./g,"-")]=1,m()?t["framework.cordova"]=1:"object"==typeof navigator&amp;&amp;"ReactNative"===navigator.product&amp;&amp;(t["framework.reactnative"]=1),this.reportStats(t)},Ci.prototype.shouldReconnect_=function(){var t=Xr.getInstance().currentlyOnline();return k(this.interruptReasons_)&amp;&amp;t},Ci.nextPersistentConnectionId_=0,Ci.nextConnectionId_=0,Ci);function Ci(t,e,n,r,i,o,s){var a=yi.call(this)||this;if(a.repoInfo_=t,a.applicationId_=e,a.onDataUpdate_=n,a.onConnectStatus_=r,a.onServerInfoUpdate_=i,a.authTokenProvider_=o,a.authOverride_=s,a.id=Ci.nextPersistentConnectionId_++,a.log_=It("p:"+a.id+":"),a.interruptReasons_={},a.listens=new Map,a.outstandingPuts_=[],a.outstandingGets_=[],a.outstandingPutCount_=0,a.outstandingGetCount_=0,a.onDisconnectRequestQueue_=[],a.connected_=!1,a.reconnectDelay_=gi,a.maxReconnectDelay_=vi,a.securityDebugCallback_=null,a.lastSessionId=null,a.establishConnectionTimer_=null,a.visible_=!1,a.requestCBHash_={},a.requestNumber_=0,a.realtime_=null,a.authToken_=null,a.forceTokenRefresh_=!1,a.invalidAuthTokenCount_=0,a.firstConnection_=!0,a.lastConnectionAttemptTime_=null,a.lastConnectionEstablishedTime_=null,s&amp;&amp;!C())throw new Error("Auth override specified in options, but not supported on non Node.js platforms");return a.scheduleConnect_(0),Kr.getInstance().on("visible",a.onVisible_,a),-1===t.host.indexOf("fblocal")&amp;&amp;Xr.getInstance().on("online",a.onOnline_,a),a}var Ei,wi=(n(bi,Ei=Ce),bi.prototype.reportStats=function(t){throw new Error("Method not implemented.")},bi.getListenId_=function(t,e){return void 0!==e?"tag$"+e:(y(t.getQueryParams().isDefault(),"should have a tag if it's not a default query."),t.path.toString())},bi.prototype.listen=function(t,e,n,r){var i=this,o=t.path.toString();this.log_("Listen called for "+o+" "+t.queryIdentifier());var s=bi.getListenId_(t,n),a={};this.listens_[s]=a;t=t.getQueryParams().toRestQueryStringParameters();this.restRequest_(o+".json",t,(function(t,e){404===t&amp;&amp;(t=e=null),null===t&amp;&amp;i.onDataUpdate_(o,e,!1,n),x(i.listens_,s)===a&amp;&amp;r(t?401===t?"permission_denied":"rest_error:"+t:"ok",null)}))},bi.prototype.unlisten=function(t,e){e=bi.getListenId_(t,e);delete this.listens_[e]},bi.prototype.get=function(t){var n=this,e=t.getQueryParams().toRestQueryStringParameters(),r=t.path.toString(),i=new g;return this.restRequest_(r+".json",e,(function(t,e){404===t&amp;&amp;(t=e=null),null===t?(n.onDataUpdate_(r,e,!1,null),i.resolve(e)):i.reject(new Error(e))})),i.promise},bi.prototype.refreshAuthToken=function(t){},bi.prototype.restRequest_=function(r,i,o){var s=this;void 0===i&amp;&amp;(i={}),i.format="export",this.authTokenProvider_.getToken(!1).then((function(t){t=t&amp;&amp;t.accessToken;t&amp;&amp;(i.auth=t);var e=(s.repoInfo_.secure?"https://":"http://")+s.repoInfo_.host+r+"?ns="+s.repoInfo_.namespace+function(t){for(var n=[],e=0,r=Object.entries(t);e&lt;r.length;e++){var i=r[e];!function(e,t){Array.isArray(t)?t.forEach((function(t){n.push(encodeURIComponent(e)+"="+encodeURIComponent(t))})):n.push(encodeURIComponent(e)+"="+encodeURIComponent(t))}(i[0],i[1])}return n.length?"&amp;"+n.join("&amp;"):""}(i);s.log_("Sending REST request for "+e);var n=new XMLHttpRequest;n.onreadystatechange=function(){if(o&amp;&amp;4===n.readyState){s.log_("REST Response for "+e+" received. status:",n.status,"response:",n.responseText);var t=null;if(200&lt;=n.status&amp;&amp;n.status&lt;300){try{t=R(n.responseText)}catch(t){ct("Failed to parse JSON response for "+e+": "+n.responseText)}o(null,t)}else 401!==n.status&amp;&amp;404!==n.status&amp;&amp;ct("Got unsuccessful REST response for "+e+" Status: "+n.status),o(n.status);o=null}},n.open("GET",e,!0),n.send()}))},bi);function bi(t,e,n){var r=Ei.call(this)||this;return r.repoInfo_=t,r.onDataUpdate_=e,r.authTokenProvider_=n,r.log_=It("p:rest:"),r.listens_={},r}var Si="repo_interrupt",Ti=(Ii.prototype.start=function(){var s=this;if(this.stats_=Fr.getCollection(this.repoInfo_),this.forceRestClient_||0&lt;=("object"==typeof window&amp;&amp;window.navigator&amp;&amp;window.navigator.userAgent||"").search(/googlebot|google webmaster tools|bingbot|yahoo! slurp|baiduspider|yandexbot|duckduckbot/i))this.server_=new wi(this.repoInfo_,this.onDataUpdate_.bind(this),this.authTokenProvider_),setTimeout(this.onConnectStatus_.bind(this,!0),0);else{var t=this.app.options.databaseAuthVariableOverride;if(null!=t){if("object"!=typeof t)throw new Error("Only objects are supported for option databaseAuthVariableOverride");try{P(t)}catch(t){throw new Error("Invalid authOverride provided: "+t)}}this.persistentConnection_=new mi(this.repoInfo_,this.app.options.appId,this.onDataUpdate_.bind(this),this.onConnectStatus_.bind(this),this.onServerInfoUpdate_.bind(this),this.authTokenProvider_,t),this.server_=this.persistentConnection_}this.authTokenProvider_.addTokenChangeListener((function(t){s.server_.refreshAuthToken(t)})),this.statsReporter_=Fr.getOrCreateReporter(this.repoInfo_,(function(){return new qr(s.stats_,s.server_)})),this.transactionsInit_(),this.infoData_=new Or,this.infoSyncTree_=new Pr({startListening:function(t,e,n,r){var i=[],o=s.infoData_.getNode(t.path);return o.isEmpty()||(i=s.infoSyncTree_.applyServerOverwrite(t.path,o),setTimeout((function(){r("ok")}),0)),i},stopListening:function(){}}),this.updateInfo_("connected",!1),this.serverSyncTree_=new Pr({startListening:function(n,t,e,r){return s.server_.listen(n,e,t,(function(t,e){e=r(t,e);s.eventQueue_.raiseEventsForChangedPath(n.path,e)})),[]},stopListening:function(t,e){s.server_.unlisten(t,e)}})},Ii.prototype.toString=function(){return(this.repoInfo_.secure?"https://":"http://")+this.repoInfo_.host},Ii.prototype.name=function(){return this.repoInfo_.namespace},Ii.prototype.serverTime=function(){var t=this.infoData_.getNode(new Mt(".info/serverTimeOffset")).val()||0;return(new Date).getTime()+t},Ii.prototype.generateServerValues=function(){return(t=(t={timestamp:this.serverTime()})||{}).timestamp=t.timestamp||(new Date).getTime(),t;var t},Ii.prototype.onDataUpdate_=function(t,e,n,r){this.dataUpdateCount++;var i=new Mt(t);e=this.interceptServerDataCallback_?this.interceptServerDataCallback_(t,e):e;var o,s=[],t=i;0&lt;(s=r?n?(o=A(e,(function(t){return hn(t)})),this.serverSyncTree_.applyTaggedQueryMerge(i,o,r)):(o=hn(e),this.serverSyncTree_.applyTaggedQueryOverwrite(i,o,r)):n?(n=A(e,(function(t){return hn(t)})),this.serverSyncTree_.applyServerMerge(i,n)):(e=hn(e),this.serverSyncTree_.applyServerOverwrite(i,e))).length&amp;&amp;(t=this.rerunTransactions_(i)),this.eventQueue_.raiseEventsForChangedPath(t,s)},Ii.prototype.interceptServerData_=function(t){this.interceptServerDataCallback_=t},Ii.prototype.onConnectStatus_=function(t){this.updateInfo_("connected",t),!1===t&amp;&amp;this.runOnDisconnectEvents_()},Ii.prototype.onServerInfoUpdate_=function(t){var n=this;Ot(t,(function(t,e){n.updateInfo_(t,e)}))},Ii.prototype.updateInfo_=function(t,e){t=new Mt("/.info/"+t),e=hn(e);this.infoData_.updateSnapshot(t,e);e=this.infoSyncTree_.applyServerOverwrite(t,e);this.eventQueue_.raiseEventsForChangedPath(t,e)},Ii.prototype.getNextWriteId_=function(){return this.nextWriteId_++},Ii.prototype.getValue=function(n){var r=this;return this.server_.get(n).then((function(t){var e=hn(t),t=r.serverSyncTree_.applyServerOverwrite(n.path,e);return r.eventQueue_.raiseEventsAtPath(n.path,t),Promise.resolve(new fn(e,n.getRef(),n.getQueryParams().getIndex()))}),(function(t){r.log_("get for query "+P(n)+" falling back to cache after error: "+t);var e=r.serverSyncTree_.calcCompleteEventCache(n.path);return e.isEmpty()?Promise.reject(new Error(t)):Promise.resolve(new fn(e,n.getRef(),n.getQueryParams().getIndex()))}))},Ii.prototype.setWithPriority=function(r,t,e,i){var o=this;this.log_("set",{path:r.toString(),value:t,priority:e});var n=this.generateServerValues(),t=hn(t,e),e=this.serverSyncTree_.calcCompleteEventCache(r),n=xn(t,e,n),s=this.getNextWriteId_(),n=this.serverSyncTree_.applyUserOverwrite(r,n,s,!0);this.eventQueue_.queueEvents(n),this.server_.put(r.toString(),t.val(!0),(function(t,e){var n="ok"===t;n||ct("set at "+r+" failed: "+t);n=o.serverSyncTree_.ackUserWrite(s,!n);o.eventQueue_.raiseEventsForChangedPath(r,n),o.callOnCompleteCallback(i,t,e)}));t=this.abortTransactions_(r);this.rerunTransactions_(t),this.eventQueue_.raiseEventsForChangedPath(t,[])},Ii.prototype.update=function(i,t,o){var s=this;this.log_("update",{path:i.toString(),value:t});var a,e,n=!0,r=this.generateServerValues(),h={};Ot(t,(function(t,e){n=!1,h[t]=On(i.child(t),hn(e),s.serverSyncTree_,r)})),n?(Tt("update() called with empty data.  Don't do anything."),this.callOnCompleteCallback(o,"ok")):(a=this.getNextWriteId_(),e=this.serverSyncTree_.applyUserMerge(i,h,a),this.eventQueue_.queueEvents(e),this.server_.merge(i.toString(),t,(function(t,e){var n="ok"===t;n||ct("update at "+i+" failed: "+t);var r=s.serverSyncTree_.ackUserWrite(a,!n),n=0&lt;r.length?s.rerunTransactions_(i):i;s.eventQueue_.raiseEventsForChangedPath(n,r),s.callOnCompleteCallback(o,t,e)})),Ot(t,(function(t){t=s.abortTransactions_(i.child(t));s.rerunTransactions_(t)})),this.eventQueue_.raiseEventsForChangedPath(i,[]))},Ii.prototype.runOnDisconnectEvents_=function(){var n=this;this.log_("onDisconnectEvents");var r=this.generateServerValues(),i=new Wn;this.onDisconnect_.forEachTree(Mt.Empty,(function(t,e){e=On(t,e,n.serverSyncTree_,r);i.remember(t,e)}));var o=[];i.forEachTree(Mt.Empty,(function(t,e){o=o.concat(n.serverSyncTree_.applyServerOverwrite(t,e));t=n.abortTransactions_(t);n.rerunTransactions_(t)})),this.onDisconnect_=new Wn,this.eventQueue_.raiseEventsForChangedPath(Mt.Empty,o)},Ii.prototype.onDisconnectCancel=function(n,r){var i=this;this.server_.onDisconnectCancel(n.toString(),(function(t,e){"ok"===t&amp;&amp;i.onDisconnect_.forget(n),i.callOnCompleteCallback(r,t,e)}))},Ii.prototype.onDisconnectSet=function(n,t,r){var i=this,o=hn(t);this.server_.onDisconnectPut(n.toString(),o.val(!0),(function(t,e){"ok"===t&amp;&amp;i.onDisconnect_.remember(n,o),i.callOnCompleteCallback(r,t,e)}))},Ii.prototype.onDisconnectSetWithPriority=function(n,t,e,r){var i=this,o=hn(t,e);this.server_.onDisconnectPut(n.toString(),o.val(!0),(function(t,e){"ok"===t&amp;&amp;i.onDisconnect_.remember(n,o),i.callOnCompleteCallback(r,t,e)}))},Ii.prototype.onDisconnectUpdate=function(n,r,i){var o=this;if(k(r))return Tt("onDisconnect().update() called with empty data.  Don't do anything."),void this.callOnCompleteCallback(i,"ok");this.server_.onDisconnectMerge(n.toString(),r,(function(t,e){"ok"===t&amp;&amp;Ot(r,(function(t,e){e=hn(e);o.onDisconnect_.remember(n.child(t),e)})),o.callOnCompleteCallback(i,t,e)}))},Ii.prototype.addEventCallbackForQuery=function(t,e){e=(".info"===t.path.getFront()?this.infoSyncTree_:this.serverSyncTree_).addEventRegistration(t,e);this.eventQueue_.raiseEventsAtPath(t.path,e)},Ii.prototype.removeEventCallbackForQuery=function(t,e){e=(".info"===t.path.getFront()?this.infoSyncTree_:this.serverSyncTree_).removeEventRegistration(t,e);this.eventQueue_.raiseEventsAtPath(t.path,e)},Ii.prototype.interrupt=function(){this.persistentConnection_&amp;&amp;this.persistentConnection_.interrupt(Si)},Ii.prototype.resume=function(){this.persistentConnection_&amp;&amp;this.persistentConnection_.resume(Si)},Ii.prototype.stats=function(t){var i;void 0===t&amp;&amp;(t=!1),"undefined"!=typeof console&amp;&amp;(t=t?(this.statsListener_||(this.statsListener_=new Mr(this.stats_)),this.statsListener_.get()):this.stats_.get(),i=Object.keys(t).reduce((function(t,e){return Math.max(e.length,t)}),0),Ot(t,(function(t,e){for(var n=t,r=t.length;r&lt;i+2;r++)n+=" ";console.log(n+e)})))},Ii.prototype.statsIncrementCounter=function(t){this.stats_.incrementCounter(t),this.statsReporter_.includeStat(t)},Ii.prototype.log_=function(){for(var t=[],e=0;e&lt;arguments.length;e++)t[e]=arguments[e];var n="";this.persistentConnection_&amp;&amp;(n=this.persistentConnection_.id+":"),Tt.apply(void 0,s([n],t))},Ii.prototype.callOnCompleteCallback=function(n,r,i){n&amp;&amp;kt((function(){var t,e;"ok"===r?n(null):(e=t=(r||"error").toUpperCase(),i&amp;&amp;(e+=": "+i),(e=new Error(e)).code=t,n(e))}))},Object.defineProperty(Ii.prototype,"database",{get:function(){return this.__database||(this.__database=new Ki(this))},enumerable:!1,configurable:!0}),Ii);function Ii(t,e,n,r){this.repoInfo_=t,this.forceRestClient_=e,this.app=n,this.authTokenProvider_=r,this.dataUpdateCount=0,this.statsListener_=null,this.eventQueue_=new Ur,this.nextWriteId_=1,this.interceptServerDataCallback_=null,this.onDisconnect_=new Wn,this.persistentConnection_=null,this.key=this.repoInfo_.toURLString()}var Ni=(Ri.prototype.getStartPost=function(){return this.startPost_},Ri.prototype.getEndPost=function(){return this.endPost_},Ri.prototype.matches=function(t){return this.index_.compare(this.getStartPost(),t)&lt;=0&amp;&amp;this.index_.compare(t,this.getEndPost())&lt;=0},Ri.prototype.updateChild=function(t,e,n,r,i,o){return this.matches(new ge(e,n))||(n=en.EMPTY_NODE),this.indexedFilter_.updateChild(t,e,n,r,i,o)},Ri.prototype.updateFullNode=function(t,e,n){e.isLeafNode()&amp;&amp;(e=en.EMPTY_NODE);var r=(r=e.withIndex(this.index_)).updatePriority(en.EMPTY_NODE),i=this;return e.forEachChild(Fe,(function(t,e){i.matches(new ge(t,e))||(r=r.updateImmediateChild(t,en.EMPTY_NODE))})),this.indexedFilter_.updateFullNode(t,r,n)},Ri.prototype.updatePriority=function(t,e){return t},Ri.prototype.filtersNodes=function(){return!0},Ri.prototype.getIndexedFilter=function(){return this.indexedFilter_},Ri.prototype.getIndex=function(){return this.index_},Ri.getStartPost_=function(t){if(t.hasStart()){var e=t.getIndexStartName();return t.getIndex().makePost(t.getIndexStartValue(),e)}return t.getIndex().minPost()},Ri.getEndPost_=function(t){if(t.hasEnd()){var e=t.getIndexEndName();return t.getIndex().makePost(t.getIndexEndValue(),e)}return t.getIndex().maxPost()},Ri);function Ri(t){this.indexedFilter_=new or(t.getIndex()),this.index_=t.getIndex(),this.startPost_=Ri.getStartPost_(t),this.endPost_=Ri.getEndPost_(t)}var Pi=(Di.prototype.updateChild=function(t,e,n,r,i,o){return this.rangedFilter_.matches(new ge(e,n))||(n=en.EMPTY_NODE),t.getImmediateChild(e).equals(n)?t:t.numChildren()&lt;this.limit_?this.rangedFilter_.getIndexedFilter().updateChild(t,e,n,r,i,o):this.fullLimitUpdateChild_(t,e,n,i,o)},Di.prototype.updateFullNode=function(t,e,n){var r;if(e.isLeafNode()||e.isEmpty())r=en.EMPTY_NODE.withIndex(this.index_);else if(2*this.limit_&lt;e.numChildren()&amp;&amp;e.isIndexed(this.index_)){r=en.EMPTY_NODE.withIndex(this.index_);var i=void 0;i=this.reverse_?e.getReverseIteratorFrom(this.rangedFilter_.getEndPost(),this.index_):e.getIteratorFrom(this.rangedFilter_.getStartPost(),this.index_);for(var o=0;i.hasNext()&amp;&amp;o&lt;this.limit_;){var s=i.getNext();if(!(this.reverse_?this.index_.compare(this.rangedFilter_.getStartPost(),s)&lt;=0:this.index_.compare(s,this.rangedFilter_.getEndPost())&lt;=0))break;r=r.updateImmediateChild(s.name,s.node),o++}}else{r=(r=e.withIndex(this.index_)).updatePriority(en.EMPTY_NODE);var a,h=void 0,l=void 0,u=void 0,i=void 0;u=this.reverse_?(i=r.getReverseIterator(this.index_),h=this.rangedFilter_.getEndPost(),l=this.rangedFilter_.getStartPost(),a=this.index_.getCompare(),function(t,e){return a(e,t)}):(i=r.getIterator(this.index_),h=this.rangedFilter_.getStartPost(),l=this.rangedFilter_.getEndPost(),this.index_.getCompare());for(var o=0,c=!1;i.hasNext();){s=i.getNext();!c&amp;&amp;u(h,s)&lt;=0&amp;&amp;(c=!0),c&amp;&amp;o&lt;this.limit_&amp;&amp;u(s,l)&lt;=0?o++:r=r.updateImmediateChild(s.name,en.EMPTY_NODE)}}return this.rangedFilter_.getIndexedFilter().updateFullNode(t,r,n)},Di.prototype.updatePriority=function(t,e){return t},Di.prototype.filtersNodes=function(){return!0},Di.prototype.getIndexedFilter=function(){return this.rangedFilter_.getIndexedFilter()},Di.prototype.getIndex=function(){return this.index_},Di.prototype.fullLimitUpdateChild_=function(t,e,n,r,i){var o,s;s=this.reverse_?(o=this.index_.getCompare(),function(t,e){return o(e,t)}):this.index_.getCompare();var a=t;y(a.numChildren()===this.limit_,"");var h=new ge(e,n),l=this.reverse_?a.getFirstChild(this.index_):a.getLastChild(this.index_),u=this.rangedFilter_.matches(h);if(a.hasChild(e)){for(var c=a.getImmediateChild(e),p=r.getChildAfterChild(this.index_,l,this.reverse_);null!=p&amp;&amp;(p.name===e||a.hasChild(p.name));)p=r.getChildAfterChild(this.index_,p,this.reverse_);var d=null==p?1:s(p,h);if(u&amp;&amp;!n.isEmpty()&amp;&amp;0&lt;=d)return null!=i&amp;&amp;i.trackChildChange(rr.childChangedChange(e,n,c)),a.updateImmediateChild(e,n);null!=i&amp;&amp;i.trackChildChange(rr.childRemovedChange(e,c));c=a.updateImmediateChild(e,en.EMPTY_NODE);return null!=p&amp;&amp;this.rangedFilter_.matches(p)?(null!=i&amp;&amp;i.trackChildChange(rr.childAddedChange(p.name,p.node)),c.updateImmediateChild(p.name,p.node)):c}return!n.isEmpty()&amp;&amp;u&amp;&amp;0&lt;=s(l,h)?(null!=i&amp;&amp;(i.trackChildChange(rr.childRemovedChange(l.name,l.node)),i.trackChildChange(rr.childAddedChange(e,n))),a.updateImmediateChild(e,n).updateImmediateChild(l.name,en.EMPTY_NODE)):t},Di);function Di(t){this.rangedFilter_=new Ni(t),this.index_=t.getIndex(),this.limit_=t.getLimit(),this.reverse_=!t.isViewFromLeft()}var Oi=(xi.prototype.hasStart=function(){return this.startSet_},xi.prototype.isViewFromLeft=function(){return""===this.viewFrom_?this.startSet_:this.viewFrom_===xi.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT},xi.prototype.getIndexStartValue=function(){return y(this.startSet_,"Only valid if start has been set"),this.indexStartValue_},xi.prototype.getIndexStartName=function(){return y(this.startSet_,"Only valid if start has been set"),this.startNameSet_?this.indexStartName_:Nt},xi.prototype.hasEnd=function(){return this.endSet_},xi.prototype.getIndexEndValue=function(){return y(this.endSet_,"Only valid if end has been set"),this.indexEndValue_},xi.prototype.getIndexEndName=function(){return y(this.endSet_,"Only valid if end has been set"),this.endNameSet_?this.indexEndName_:Rt},xi.prototype.hasLimit=function(){return this.limitSet_},xi.prototype.hasAnchoredLimit=function(){return this.limitSet_&amp;&amp;""!==this.viewFrom_},xi.prototype.getLimit=function(){return y(this.limitSet_,"Only valid if limit has been set"),this.limit_},xi.prototype.getIndex=function(){return this.index_},xi.prototype.copy_=function(){var t=new xi;return t.limitSet_=this.limitSet_,t.limit_=this.limit_,t.startSet_=this.startSet_,t.indexStartValue_=this.indexStartValue_,t.startNameSet_=this.startNameSet_,t.indexStartName_=this.indexStartName_,t.endSet_=this.endSet_,t.indexEndValue_=this.indexEndValue_,t.endNameSet_=this.endNameSet_,t.indexEndName_=this.indexEndName_,t.index_=this.index_,t.viewFrom_=this.viewFrom_,t},xi.prototype.limit=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_="",e},xi.prototype.limitToFirst=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_=xi.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_LEFT,e},xi.prototype.limitToLast=function(t){var e=this.copy_();return e.limitSet_=!0,e.limit_=t,e.viewFrom_=xi.WIRE_PROTOCOL_CONSTANTS_.VIEW_FROM_RIGHT,e},xi.prototype.startAt=function(t,e){var n=this.copy_();return n.startSet_=!0,void 0===t&amp;&amp;(t=null),n.indexStartValue_=t,null!=e?(n.startNameSet_=!0,n.indexStartName_=e):(n.startNameSet_=!1,n.indexStartName_=""),n},xi.prototype.endAt=function(t,e){var n=this.copy_();return n.endSet_=!0,void 0===t&amp;&amp;(t=null),n.indexEndValue_=t,void 0!==e?(n.endNameSet_=!0,n.indexEndName_=e):(n.endNameSet_=!1,n.indexEndName_=""),n},xi.prototype.orderBy=function(t){var e=this.copy_();return e.index_=t,e},xi.prototype.getQueryObject=function(){var t,e=xi.WIRE_PROTOCOL_CONSTANTS_,n={};return this.startSet_&amp;&amp;(n[e.INDEX_START_VALUE]=this.indexStartValue_,this.startNameSet_&amp;&amp;(n[e.INDEX_START_NAME]=this.indexStartName_)),this.endSet_&amp;&amp;(n[e.INDEX_END_VALUE]=this.indexEndValue_,this.endNameSet_&amp;&amp;(n[e.INDEX_END_NAME]=this.indexEndName_)),this.limitSet_&amp;&amp;(n[e.LIMIT]=this.limit_,""===(t=this.viewFrom_)&amp;&amp;(t=this.isViewFromLeft()?e.VIEW_FROM_LEFT:e.VIEW_FROM_RIGHT),n[e.VIEW_FROM]=t),this.index_!==Fe&amp;&amp;(n[e.INDEX]=this.index_.toString()),n},xi.prototype.loadsAllData=function(){return!(this.startSet_||this.endSet_||this.limitSet_)},xi.prototype.isDefault=function(){return this.loadsAllData()&amp;&amp;this.index_===Fe},xi.prototype.getNodeFilter=function(){return this.loadsAllData()?new or(this.getIndex()):new(this.hasLimit()?Pi:Ni)(this)},xi.prototype.toRestQueryStringParameters=function(){var t,e=xi.REST_QUERY_CONSTANTS_,n={};return this.isDefault()||(t=this.index_===Fe?e.PRIORITY_INDEX:this.index_===cn?e.VALUE_INDEX:this.index_===Te?e.KEY_INDEX:(y(this.index_ instanceof pn,"Unrecognized index type!"),this.index_.toString()),n[e.ORDER_BY]=P(t),this.startSet_&amp;&amp;(n[e.START_AT]=P(this.indexStartValue_),this.startNameSet_&amp;&amp;(n[e.START_AT]+=","+P(this.indexStartName_))),this.endSet_&amp;&amp;(n[e.END_AT]=P(this.indexEndValue_),this.endNameSet_&amp;&amp;(n[e.END_AT]+=","+P(this.indexEndName_))),this.limitSet_&amp;&amp;(this.isViewFromLeft()?n[e.LIMIT_TO_FIRST]=this.limit_:n[e.LIMIT_TO_LAST]=this.limit_)),n},xi.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"},xi.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"},xi.DEFAULT=new xi,xi);function xi(){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_=Fe}var ki,Ai=(n(Fi,ki=Tn),Fi.prototype.getKey=function(){return M("Reference.key",0,0,arguments.length),this.path.isEmpty()?null:this.path.getBack()},Fi.prototype.child=function(t){var e,n,r,i;return M("Reference.child",1,1,arguments.length),"number"==typeof t?t=String(t):t instanceof Mt||(null===this.path.getFront()?(e="Reference.child",i=!(n=1),r=(r=t)&amp;&amp;r.replace(/^\/*\.info(\/|$)/,"/"),ee(e,n,r,i)):ee("Reference.child",1,t,!1)),new Fi(this.repo,this.path.child(t))},Fi.prototype.getParent=function(){M("Reference.parent",0,0,arguments.length);var t=this.path.parent();return null===t?null:new Fi(this.repo,t)},Fi.prototype.getRoot=function(){M("Reference.root",0,0,arguments.length);for(var t=this;null!==t.getParent();)t=t.getParent();return t},Fi.prototype.databaseProp=function(){return this.repo.database},Fi.prototype.set=function(t,e){M("Reference.set",1,2,arguments.length),ne("Reference.set",this.path),Xt("Reference.set",1,t,this.path,!1),q("Reference.set",2,e,!0);var n=new g;return this.repo.setWithPriority(this.path,t,null,n.wrapCallback(e)),n.promise},Fi.prototype.update=function(t,e){if(M("Reference.update",1,2,arguments.length),ne("Reference.update",this.path),Array.isArray(t)){for(var n={},r=0;r&lt;t.length;++r)n[""+r]=t[r];t=n,ct("Passing an Array to Firebase.update() is deprecated. Use set() if you want to overwrite the existing data, or an Object with integer keys if you really do want to only update some of the children.")}$t("Reference.update",1,t,this.path,!1),q("Reference.update",2,e,!0);var i=new g;return this.repo.update(this.path,t,i.wrapCallback(e)),i.promise},Fi.prototype.setWithPriority=function(t,e,n){if(M("Reference.setWithPriority",2,3,arguments.length),ne("Reference.setWithPriority",this.path),Xt("Reference.setWithPriority",1,t,this.path,!1),Jt("Reference.setWithPriority",2,e,!1),q("Reference.setWithPriority",3,n,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.setWithPriority failed: "+this.getKey()+" is a read-only object.";var r=new g;return this.repo.setWithPriority(this.path,t,e,r.wrapCallback(n)),r.promise},Fi.prototype.remove=function(t){return M("Reference.remove",0,1,arguments.length),ne("Reference.remove",this.path),q("Reference.remove",1,t,!0),this.set(null,t)},Fi.prototype.transaction=function(t,r,e){if(M("Reference.transaction",1,3,arguments.length),ne("Reference.transaction",this.path),q("Reference.transaction",1,t,!1),q("Reference.transaction",2,r,!0),function(t,e,n,r){if((!r||void 0!==n)&amp;&amp;"boolean"!=typeof n)throw new Error(W(t,e,r)+"must be a boolean.")}("Reference.transaction",3,e,!0),".length"===this.getKey()||".keys"===this.getKey())throw"Reference.transaction failed: "+this.getKey()+" is a read-only object.";void 0===e&amp;&amp;(e=!0);var i=new g;"function"==typeof r&amp;&amp;i.promise.catch((function(){}));return this.repo.startTransaction(this.path,t,(function(t,e,n){t?i.reject(t):i.resolve(new ce(e,n)),"function"==typeof r&amp;&amp;r(t,e,n)}),e),i.promise},Fi.prototype.setPriority=function(t,e){M("Reference.setPriority",1,2,arguments.length),ne("Reference.setPriority",this.path),Jt("Reference.setPriority",1,t,!1),q("Reference.setPriority",2,e,!0);var n=new g;return this.repo.setWithPriority(this.path.child(".priority"),t,null,n.wrapCallback(e)),n.promise},Fi.prototype.push=function(t,e){M("Reference.push",0,2,arguments.length),ne("Reference.push",this.path),Xt("Reference.push",1,t,this.path,!0),q("Reference.push",2,e,!0);var n=this.repo.serverTime(),r=ye(n),n=this.child(r),i=this.child(r),t=null!=t?n.set(t,e).then((function(){return i})):Promise.resolve(i);return n.then=t.then.bind(t),n.catch=t.then.bind(t,void 0),"function"==typeof e&amp;&amp;t.catch((function(){})),n},Fi.prototype.onDisconnect=function(){return ne("Reference.onDisconnect",this.path),new le(this.repo,this.path)},Object.defineProperty(Fi.prototype,"database",{get:function(){return this.databaseProp()},enumerable:!1,configurable:!0}),Object.defineProperty(Fi.prototype,"key",{get:function(){return this.getKey()},enumerable:!1,configurable:!0}),Object.defineProperty(Fi.prototype,"parent",{get:function(){return this.getParent()},enumerable:!1,configurable:!0}),Object.defineProperty(Fi.prototype,"root",{get:function(){return this.getRoot()},enumerable:!1,configurable:!0}),Fi);function Fi(t,e){if(!(t instanceof Ti))throw new Error("new Reference() no longer supported - use app.database().");return ki.call(this,t,e,Oi.DEFAULT,!1)||this}Tn.__referenceConstructor=Ai,Er.__referenceConstructor=Ai;var Li,Mi=function(){this.children={},this.childCount=0,this.value=null},Wi=(qi.prototype.subTree=function(t){for(var e=t instanceof Mt?t:new Mt(t),n=this,r=e.getFront();null!==r;)n=new qi(r,n,x(n.node_.children,r)||new Mi),r=(e=e.popFront()).getFront();return n},qi.prototype.getValue=function(){return this.node_.value},qi.prototype.setValue=function(t){y(void 0!==t,"Cannot set value to undefined"),this.node_.value=t,this.updateParents_()},qi.prototype.clear=function(){this.node_.value=null,this.node_.children={},this.node_.childCount=0,this.updateParents_()},qi.prototype.hasChildren=function(){return 0&lt;this.node_.childCount},qi.prototype.isEmpty=function(){return null===this.getValue()&amp;&amp;!this.hasChildren()},qi.prototype.forEachChild=function(n){var r=this;Ot(this.node_.children,(function(t,e){n(new qi(t,r,e))}))},qi.prototype.forEachDescendant=function(e,t,n){t&amp;&amp;!n&amp;&amp;e(this),this.forEachChild((function(t){t.forEachDescendant(e,!0,n)})),t&amp;&amp;n&amp;&amp;e(this)},qi.prototype.forEachAncestor=function(t,e){for(var n=e?this:this.parent();null!==n;){if(t(n))return!0;n=n.parent()}return!1},qi.prototype.forEachImmediateDescendantWithValue=function(e){this.forEachChild((function(t){null!==t.getValue()?e(t):t.forEachImmediateDescendantWithValue(e)}))},qi.prototype.path=function(){return new Mt(null===this.parent_?this.name_:this.parent_.path()+"/"+this.name_)},qi.prototype.name=function(){return this.name_},qi.prototype.parent=function(){return this.parent_},qi.prototype.updateParents_=function(){null!==this.parent_&amp;&amp;this.parent_.updateChild_(this.name_,this)},qi.prototype.updateChild_=function(t,e){var n=e.isEmpty(),r=O(this.node_.children,t);n&amp;&amp;r?(delete this.node_.children[t],this.node_.childCount--,this.updateParents_()):n||r||(this.node_.children[t]=e.node_,this.node_.childCount++,this.updateParents_())},qi);function qi(t,e,n){void 0===t&amp;&amp;(t=""),void 0===e&amp;&amp;(e=null),void 0===n&amp;&amp;(n=new Mi),this.name_=t,this.parent_=e,this.node_=n}(Ce=Li=Li||{})[Ce.RUN=0]="RUN",Ce[Ce.SENT=1]="SENT",Ce[Ce.COMPLETED=2]="COMPLETED",Ce[Ce.SENT_NEEDS_ABORT=3]="SENT_NEEDS_ABORT",Ce[Ce.NEEDS_ABORT=4]="NEEDS_ABORT",Ti.MAX_TRANSACTION_RETRIES_=25,Ti.prototype.transactionsInit_=function(){this.transactionQueueTree_=new Wi},Ti.prototype.startTransaction=function(t,e,n,r){this.log_("transaction on "+t);function i(){}var o=new Ai(this,t);o.on("value",i);var s={path:t,update:e,onComplete:n,status:null,order:Et(),applyLocally:r,retryCount:0,unwatcher:function(){o.off("value",i)},abortReason:null,currentWriteId:null,currentInputSnapshot:null,currentOutputSnapshotRaw:null,currentOutputSnapshotResolved:null},e=this.getLatestState_(t);s.currentInputSnapshot=e;var a,n=s.update(e.val());void 0===n?(s.unwatcher(),s.currentOutputSnapshotRaw=null,s.currentOutputSnapshotResolved=null,s.onComplete&amp;&amp;(a=new fn(s.currentInputSnapshot,new Ai(this,s.path),Fe),s.onComplete(null,!1,a))):(he("transaction failed: Data returned ",n,s.path),s.status=Li.RUN,(a=(r=this.transactionQueueTree_.subTree(t)).getValue()||[]).push(s),r.setValue(a),r=void 0,"object"==typeof n&amp;&amp;null!==n&amp;&amp;O(n,".priority")?(r=x(n,".priority"),y(Gt(r),"Invalid priority returned by transaction. Priority must be a valid string, finite number, server value, or null.")):r=(this.serverSyncTree_.calcCompleteEventCache(t)||en.EMPTY_NODE).getPriority().val(),a=this.generateServerValues(),r=hn(n,r),a=xn(r,e,a),s.currentOutputSnapshotRaw=r,s.currentOutputSnapshotResolved=a,s.currentWriteId=this.getNextWriteId_(),s=this.serverSyncTree_.applyUserOverwrite(t,a,s.currentWriteId,s.applyLocally),this.eventQueue_.raiseEventsForChangedPath(t,s),this.sendReadyTransactions_())},Ti.prototype.getLatestState_=function(t,e){return this.serverSyncTree_.calcCompleteEventCache(t,e)||en.EMPTY_NODE},Ti.prototype.sendReadyTransactions_=function(t){var e,n=this;void 0===t&amp;&amp;(t=this.transactionQueueTree_),t||this.pruneCompletedTransactionsBelowNode_(t),null!==t.getValue()?(e=this.buildTransactionQueue_(t),y(0&lt;e.length,"Sending zero length transaction queue"),e.every((function(t){return t.status===Li.RUN}))&amp;&amp;this.sendTransactionQueue_(t.path(),e)):t.hasChildren()&amp;&amp;t.forEachChild((function(t){n.sendReadyTransactions_(t)}))},Ti.prototype.sendTransactionQueue_=function(s,a){for(var h=this,t=a.map((function(t){return t.currentWriteId})),e=this.getLatestState_(s,t),n=e,t=e.hash(),r=0;r&lt;a.length;r++){var i=a[r];y(i.status===Li.RUN,"tryToSendTransactionQueue_: items in queue should all be run."),i.status=Li.SENT,i.retryCount++;var o=Mt.relativePath(s,i.path),n=n.updateChild(o,i.currentOutputSnapshotRaw)}var e=n.val(!0),l=s;this.server_.put(l.toString(),e,(function(t){h.log_("transaction put response",{path:l.toString(),status:t});var e=[];if("ok"===t){for(var n,r,i=[],o=0;o&lt;a.length;o++){a[o].status=Li.COMPLETED,e=e.concat(h.serverSyncTree_.ackUserWrite(a[o].currentWriteId)),a[o].onComplete&amp;&amp;(n=a[o].currentOutputSnapshotResolved,r=new Ai(h,a[o].path),r=new fn(n,r,Fe),i.push(a[o].onComplete.bind(null,null,!0,r))),a[o].unwatcher()}h.pruneCompletedTransactionsBelowNode_(h.transactionQueueTree_.subTree(s)),h.sendReadyTransactions_(),h.eventQueue_.raiseEventsForChangedPath(s,e);for(o=0;o&lt;i.length;o++)kt(i[o])}else{if("datastale"===t)for(o=0;o&lt;a.length;o++)a[o].status===Li.SENT_NEEDS_ABORT?a[o].status=Li.NEEDS_ABORT:a[o].status=Li.RUN;else{ct("transaction at "+l.toString()+" failed: "+t);for(o=0;o&lt;a.length;o++)a[o].status=Li.NEEDS_ABORT,a[o].abortReason=t}h.rerunTransactions_(s)}}),t)},Ti.prototype.rerunTransactions_=function(t){var e=this.getAncestorTransactionNode_(t),t=e.path(),e=this.buildTransactionQueue_(e);return this.rerunTransactionQueue_(e,t),t},Ti.prototype.rerunTransactionQueue_=function(t,e){if(0!==t.length){for(var n=[],r=[],i=t.filter((function(t){return t.status===Li.RUN})).map((function(t){return t.currentWriteId})),o=0;o&lt;t.length;o++){var s,a,h,l=t[o],u=Mt.relativePath(e,l.path),c=!1,p=void 0;y(null!==u,"rerunTransactionsUnderNode_: relativePath should not be null."),l.status===Li.NEEDS_ABORT?(c=!0,p=l.abortReason,r=r.concat(this.serverSyncTree_.ackUserWrite(l.currentWriteId,!0))):l.status===Li.RUN&amp;&amp;(r=l.retryCount&gt;=Ti.MAX_TRANSACTION_RETRIES_?(c=!0,p="maxretry",r.concat(this.serverSyncTree_.ackUserWrite(l.currentWriteId,!0))):(s=this.getLatestState_(l.path,i),l.currentInputSnapshot=s,void 0!==(h=t[o].update(s.val()))?(he("transaction failed: Data returned ",h,l.path),a=hn(h),"object"==typeof h&amp;&amp;null!=h&amp;&amp;O(h,".priority")||(a=a.updatePriority(s.getPriority())),u=l.currentWriteId,h=this.generateServerValues(),h=xn(a,s,h),l.currentOutputSnapshotRaw=a,l.currentOutputSnapshotResolved=h,l.currentWriteId=this.getNextWriteId_(),i.splice(i.indexOf(u),1),(r=r.concat(this.serverSyncTree_.applyUserOverwrite(l.path,h,l.currentWriteId,l.applyLocally))).concat(this.serverSyncTree_.ackUserWrite(u,!0))):(c=!0,p="nodata",r.concat(this.serverSyncTree_.ackUserWrite(l.currentWriteId,!0))))),this.eventQueue_.raiseEventsForChangedPath(e,r),r=[],c&amp;&amp;(t[o].status=Li.COMPLETED,l=t[o].unwatcher,setTimeout(l,Math.floor(0)),t[o].onComplete&amp;&amp;("nodata"===p?(c=new Ai(this,t[o].path),l=t[o].currentInputSnapshot,c=new fn(l,c,Fe),n.push(t[o].onComplete.bind(null,null,!1,c))):n.push(t[o].onComplete.bind(null,new Error(p),!1,null))))}this.pruneCompletedTransactionsBelowNode_(this.transactionQueueTree_);for(o=0;o&lt;n.length;o++)kt(n[o]);this.sendReadyTransactions_()}},Ti.prototype.getAncestorTransactionNode_=function(t){for(var e=this.transactionQueueTree_,n=t.getFront();null!==n&amp;&amp;null===e.getValue();)e=e.subTree(n),n=(t=t.popFront()).getFront();return e},Ti.prototype.buildTransactionQueue_=function(t){var e=[];return this.aggregateTransactionQueuesForNode_(t,e),e.sort((function(t,e){return t.order-e.order})),e},Ti.prototype.aggregateTransactionQueuesForNode_=function(t,e){var n=this,r=t.getValue();if(null!==r)for(var i=0;i&lt;r.length;i++)e.push(r[i]);t.forEachChild((function(t){n.aggregateTransactionQueuesForNode_(t,e)}))},Ti.prototype.pruneCompletedTransactionsBelowNode_=function(t){var e=this,n=t.getValue();if(n){for(var r=0,i=0;i&lt;n.length;i++)n[i].status!==Li.COMPLETED&amp;&amp;(n[r]=n[i],r++);n.length=r,t.setValue(0&lt;n.length?n:null)}t.forEachChild((function(t){e.pruneCompletedTransactionsBelowNode_(t)}))},Ti.prototype.abortTransactions_=function(t){var e=this,n=this.getAncestorTransactionNode_(t).path(),t=this.transactionQueueTree_.subTree(t);return t.forEachAncestor((function(t){e.abortTransactionsOnNode_(t)})),this.abortTransactionsOnNode_(t),t.forEachDescendant((function(t){e.abortTransactionsOnNode_(t)})),n},Ti.prototype.abortTransactionsOnNode_=function(t){var e=t.getValue();if(null!==e){for(var n=[],r=[],i=-1,o=0;o&lt;e.length;o++){e[o].status===Li.SENT_NEEDS_ABORT||(e[o].status===Li.SENT?(y(i===o-1,"All SENT items should be at beginning of queue."),e[i=o].status=Li.SENT_NEEDS_ABORT,e[o].abortReason="set"):(y(e[o].status===Li.RUN,"Unexpected transaction status in abort"),e[o].unwatcher(),r=r.concat(this.serverSyncTree_.ackUserWrite(e[o].currentWriteId,!0)),e[o].onComplete&amp;&amp;n.push(e[o].onComplete.bind(null,new Error("set"),!1,null))))}-1===i?t.setValue(null):e.length=i+1,this.eventQueue_.raiseEventsForChangedPath(t.path(),r);for(o=0;o&lt;n.length;o++)kt(n[o])}};var Qi=(Ui.prototype.getToken=function(t){return this.auth_?this.auth_.getToken(t).catch((function(t){return t&amp;&amp;"auth/token-not-initialized"===t.code?(Tt("Got auth/token-not-initialized error.  Treating as null token."),null):Promise.reject(t)})):Promise.resolve(null)},Ui.prototype.addTokenChangeListener=function(e){this.auth_?this.auth_.addAuthTokenListener(e):(setTimeout((function(){return e(null)}),0),this.authProvider_.get().then((function(t){return t.addAuthTokenListener(e)})))},Ui.prototype.removeTokenChangeListener=function(e){this.authProvider_.get().then((function(t){return t.removeAuthTokenListener(e)}))},Ui.prototype.notifyForInvalidToken=function(){var t='Provided authentication credentials for the app named "'+this.app_.name+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.app_.options?t+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.app_.options?t+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':t+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',ct(t)},Ui);function Ui(t,e){var n=this;this.app_=t,this.authProvider_=e,this.auth_=null,this.auth_=e.getImmediate({optional:!0}),this.auth_||e.get().then((function(t){return n.auth_=t}))}var Vi=(Hi.prototype.getToken=function(t){return Promise.resolve({accessToken:Hi.EMULATOR_AUTH_TOKEN})},Hi.prototype.addTokenChangeListener=function(t){t(Hi.EMULATOR_AUTH_TOKEN)},Hi.prototype.removeTokenChangeListener=function(t){},Hi.prototype.notifyForInvalidToken=function(){},Hi.EMULATOR_AUTH_TOKEN="owner",Hi);function Hi(){}var ji,Bi=(zi.getInstance=function(){return ji=ji||new zi},zi.prototype.interrupt=function(){var e,t,n,r;try{for(var i=f(Object.keys(this.repos_)),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,f(Object.keys(this.repos_[s]))),h=a.next();!h.done;h=a.next()){var l=h.value;this.repos_[s][l].interrupt()}}catch(t){n={error:t}}finally{try{h&amp;&amp;!h.done&amp;&amp;(r=a.return)&amp;&amp;r.call(a)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{o&amp;&amp;!o.done&amp;&amp;(t=i.return)&amp;&amp;t.call(i)}finally{if(e)throw e.error}}},zi.prototype.resume=function(){var e,t,n,r;try{for(var i=f(Object.keys(this.repos_)),o=i.next();!o.done;o=i.next()){var s=o.value;try{for(var a=(n=void 0,f(Object.keys(this.repos_[s]))),h=a.next();!h.done;h=a.next()){var l=h.value;this.repos_[s][l].resume()}}catch(t){n={error:t}}finally{try{h&amp;&amp;!h.done&amp;&amp;(r=a.return)&amp;&amp;r.call(a)}finally{if(n)throw n.error}}}}catch(t){e={error:t}}finally{try{o&amp;&amp;!o.done&amp;&amp;(t=i.return)&amp;&amp;t.call(i)}finally{if(e)throw e.error}}},zi.prototype.applyEmulatorSettings=function(t,e,n){t.repoInfo_=new jt(e+":"+n,!1,t.repoInfo_.namespace,t.repoInfo_.webSocketOnly,t.repoInfo_.nodeAdmin,t.repoInfo_.persistenceKey,t.repoInfo_.includeNamespaceInQueryParams),t.repoInfo_.nodeAdmin&amp;&amp;(t.authTokenProvider_=new Vi)},zi.prototype.databaseFromApp=function(t,e,n,r){var i=n||t.options.databaseURL;void 0===i&amp;&amp;(t.options.projectId||ut("Can't determine Firebase Database URL. Be sure to include  a Project ID when calling firebase.initializeApp()."),Tt("Using default host for project ",t.options.projectId),i=t.options.projectId+"-default-rtdb.firebaseio.com");var o,s=zt(i,r),a=s.repoInfo,n=void 0;"undefined"!=typeof process&amp;&amp;(n=process.env.FIREBASE_DATABASE_EMULATOR_HOST),n?(o=!0,i="http://"+n+"?ns="+a.namespace,a=(s=zt(i,r)).repoInfo):o=!s.repoInfo.secure;e=r&amp;&amp;o?new Vi:new Qi(t,e);return re("Invalid Firebase Database URL",1,s),s.path.isEmpty()||ut("Database URL must point to the root of a Firebase Database (not including a child path)."),this.createRepo(a,t,e).database},zi.prototype.deleteRepo=function(t){var e=x(this.repos_,t.app.name);e&amp;&amp;x(e,t.key)===t||ut("Database "+t.app.name+"("+t.repoInfo_+") has already been deleted."),t.interrupt(),delete e[t.key]},zi.prototype.createRepo=function(t,e,n){var r=x(this.repos_,e.name);r||(r={},this.repos_[e.name]=r);var i=x(r,t.toURLString());return i&amp;&amp;ut("Database initialized multiple times. Please make sure the format of the database URL matches with each database() call."),i=new Ti(t,this.useRestClient_,e,n),r[t.toURLString()]=i},zi.prototype.forceRestClient=function(t){this.useRestClient_=t},zi);function zi(){this.repos_={},this.useRestClient_=!1}var Ki=(Object.defineProperty(Yi.prototype,"repo_",{get:function(){return this.instanceStarted_||(this.repoInternal_.start(),this.instanceStarted_=!0),this.repoInternal_},enumerable:!1,configurable:!0}),Object.defineProperty(Yi.prototype,"root_",{get:function(){return this.rootInternal_||(this.rootInternal_=new Ai(this.repo_,Mt.Empty)),this.rootInternal_},enumerable:!1,configurable:!0}),Object.defineProperty(Yi.prototype,"app",{get:function(){return this.repo_.app},enumerable:!1,configurable:!0}),Yi.prototype.useEmulator=function(t,e){this.checkDeleted_("useEmulator"),this.instanceStarted_?ut("Cannot call useEmulator() after instance has already been initialized."):Bi.getInstance().applyEmulatorSettings(this.repoInternal_,t,e)},Yi.prototype.ref=function(t){return this.checkDeleted_("ref"),M("database.ref",0,1,arguments.length),t instanceof Ai?this.refFromURL(t.toString()):void 0!==t?this.root_.child(t):this.root_},Yi.prototype.refFromURL=function(t){var e="database.refFromURL";this.checkDeleted_(e),M(e,1,1,arguments.length);var n=zt(t,this.repo_.repoInfo_.nodeAdmin);re(e,1,n);t=n.repoInfo;return t.isCustomHost()||t.host===this.repo_.repoInfo_.host||ut(e+": Host name does not match the current database: (found "+t.host+" but expected "+this.repo_.repoInfo_.host+")"),this.ref(n.path.toString())},Yi.prototype.checkDeleted_=function(t){null===this.repoInternal_&amp;&amp;ut("Cannot call "+t+" on a deleted database.")},Yi.prototype.goOffline=function(){M("database.goOffline",0,0,arguments.length),this.checkDeleted_("goOffline"),this.repo_.interrupt()},Yi.prototype.goOnline=function(){M("database.goOnline",0,0,arguments.length),this.checkDeleted_("goOnline"),this.repo_.resume()},Yi.ServerValue={TIMESTAMP:{".sv":"timestamp"},increment:function(t){return{".sv":{increment:t}}}},Yi);function Yi(t){var e=this;this.repoInternal_=t,this.instanceStarted_=!1,this.INTERNAL={delete:function(){return i(e,void 0,void 0,(function(){return o(this,(function(t){return this.checkDeleted_("delete"),Bi.getInstance().deleteRepo(this.repo_),this.repoInternal_=null,this.rootInternal_=null,[2]}))}))}},t instanceof Ti||ut("Don't call new Database() directly - please use firebase.database().")}var Gi=Object.freeze({__proto__:null,forceLongPolling:function(){li.forceDisallow(),ni.forceAllow()},forceWebSockets:function(){ni.forceDisallow()},isWebSocketsAvailable:function(){return li.isAvailable()},setSecurityDebugCallback:function(t,e){t.repo.persistentConnection_.securityDebugCallback_=e},stats:function(t,e){t.repo.stats(e)},statsIncrementCounter:function(t,e){t.repo.statsIncrementCounter(e)},dataUpdateCount:function(t){return t.repo.dataUpdateCount},interceptServerData:function(t,e){return t.repo.interceptServerData_(e)},initStandalone:function(t){var e=t.app,n=t.url,r=t.version,i=t.customAuthImpl,o=t.namespace,t=void 0!==(t=t.nodeAdmin)&amp;&amp;t;return ai(r),(r=new Z("auth-internal",new et("database-standalone"))).setComponent(new X("auth-internal",(function(){return i}),"PRIVATE")),{instance:Bi.getInstance().databaseFromApp(e,r,n,t),namespace:o}}}),Ce=mi;mi.prototype.simpleListen=function(t,e){this.sendRequest("q",{p:t},e)},mi.prototype.echo=function(t,e){this.sendRequest("echo",{d:t},e)};var Xi,$i=Object.freeze({__proto__:null,DataConnection:Ce,RealTimeConnection:di,hijackHash:function(i){var o=mi.prototype.put;return mi.prototype.put=function(t,e,n,r){void 0!==r&amp;&amp;(r=i()),o.call(this,t,e,n,r)},function(){mi.prototype.put=o}},ConnectionTarget:jt,queryIdentifier:function(t){return t.queryIdentifier()},forceRestClient:function(t){Bi.getInstance().forceRestClient(t)}}),Ji=Ki.ServerValue;ai((Xi=e.default).SDK_VERSION),Xi.INTERNAL.registerComponent(new X("database",(function(t,e){var n=t.getProvider("app").getImmediate(),t=t.getProvider("auth-internal");return Bi.getInstance().databaseFromApp(n,t,e)}),"PUBLIC").setServiceProps({Reference:Ai,Query:Tn,Database:Ki,DataSnapshot:fn,enableLogging:ht,INTERNAL:Gi,ServerValue:Ji,TEST_ACCESS:$i}).setMultipleInstances(!0)),Xi.registerVersion("@firebase/database","0.8.1")}).apply(this,arguments)}catch(t){throw console.error(t),new Error("Cannot instantiate firebase-database.js - be sure to load firebase-app.js first.")}}));var cf_debugGen=false;var cf_finalDevId="dummy_devid";var cf_finalBrowserId="dummy_browserid";var cf_finalBrowserIdV2="dummy_browseridV2";var cf_browserIdStr="dummy_browseridStr";var cf_browserIdLogStr="dummy_browserIdLogStr";var cf_browserIdStrV2="dummy_browseridStrV2";var cf_browserIdStrV2part="dummy_cf_browserIdStrV2part";var cf_browserIndStr="dummy_browserIndStr";var cf_overallCookie="dummy_cookie";var cf_overallLocalStorage="dummy_localStorage";const cf_offersCartURL=["/checkout","/cart"];const cf_offersSerumURL=["serum"];const cf_offersMosturizerURL=["moisturi"];const cf_offersFacewashURL=["face-wash"];const cf_offersSunscreenURL=["sunscreen"];const cfhtml_emailId="billing_email";const cfhtml_userDetailsClass="woocommerce-billing-fields";const cfhtml_buyButtonClass="form-row place-order";const cfhtml_checkoutCartTableClass="shop_table woocommerce-checkout-review-order-table";const cfhtml_checkoutCartItemClass="cart_item";const cfhtml_discountCodeClass="cart-discount";const cfcookie_visitUrlListStr="cfcookie_visitUrlList";const cf_numTimesCouponShownStr="cf_numTimesCouponShown";const cf_couponRandomizedScoreStr="cf_couponRandomizedScore";const cf_numTimesCounterOnCheckoutActivatedStr="cf_numTimesCounterOnCheckoutActivated";const cfpersona_exploratoryVisitorUTM=true;const cf_referrerURLstring="google";const cfnudge_referrerTrafficStr="cfnudge_referrerTraffic";const cf_referrerURLstringList=["google","facebook","bing","duckduckgo","meta","instagram","twitter","yahoo","linkedin"];var cf_UTMstr="facebook_traffic_ads";var cf_prevVisitExists=false;var cf_couponidMoisturizerSerum="cf_lead_capture";var cf_couponidMultiSerum="cf_registration_redirect";var cf_couponidFreeSerum="cf_lead_capture_$350_Off";var cfnudge_modalIdMultiSerum="cfnudge_modalIdMultiSerum";var cfnudge_modalIdMoisturizerSerum="cfnudge_modalIdMoisturizerSerum";var cfnudge_modalIdFreeSerum="cfnudge_modalIdFreeSerum";var cfnudge_modalIdBannerOffer="cfnudge_modalIdBannerOffer";const cfnudge_modalIdsString="#cfnudge_modalIdMultiSerum, #cfnudge_modalIdMoisturizerSerum, #cfnudge_modalIdFreeSerum, #cfnudge_modalIdBannerOffer";var cf_nudgeMoisturizerSerum="cf_nudgeMoisturizerSerum";var cf_nudgeMultiSerum="cf_nudgeMultiSerum";var cf_nudgeFreeSerum="cf_nudgeFreeSerum";var cf_BannerOffer="cf_BannerOffer";var cf_itemsInCart=null;var cf_numItemsInCart=null;var cf_totalCartAmountUSD=null;var cf_couponRandomizedScore=null;var cf_numTimesCouponShown=null;var cf_numTimesCounterOnCheckoutActivated=null;var cf_nudgeCurrentlyInDisplay=false;var cf_useremail=null;var cf_userDetails=null;var cf_debounceTimer;const cfnudge_shown_firstTime_Str="cfnudge_shown_firstTime";const cfcookie_fhBookBtnClickedStr="cookie_fhBookBtnClicked";let fhBookBtnClicked=true;const cf_contactPageURL=["/contact-us"];const cf_userDetails_fnameLabel="first_name";const cf_userDetails_lnameLabel="last_name";const cf_userDetails_emailLabel="user_email";const cf_userDetails_phoneLabel="user_phone";const cf_userDetails_messageLabel="user_message";var cf_userDetails_dict={[cf_userDetails_fnameLabel]:"",[cf_userDetails_lnameLabel]:"",[cf_userDetails_emailLabel]:"",[cf_userDetails_phoneLabel]:"",[cf_userDetails_messageLabel]:""};const cfcookie_userFormDataStr="cfcookie_userFormData";const cfcookie_stateCountryStr="cfcookie_stateCountry";const cf_userIPStr="cf_userIP";const cf_userDeviceStr="cf_userDevice";const cfbanner_BookBtnClickedStr="cfbanner_BookBtnClicked";const cf_PersonaNudgeshownStr="cf_PersonaNudgeshown";var cf_nudge_expiry_timer_min=60;var actionOnNudgeTimeout="nudge_disappeared";function cf_initStore(){var cf_FBConfig={apiKey:"AIzaSyDnMF5xBz154rbzaLm9Kp3ExDLj5vii_ro",authDomain:"causalfunnel-21.firebaseapp.com",databaseURL:"https://causalfunnel-21-optimurotary-prodv1-2may2024.firebaseio.com/",projectId:"causalfunnel-21",storageBucket:"causalfunnel-21.appspot.com",messagingSenderId:"210366452701",appId:"1:210366452701:web:6f3882a8808f97a0585c34",measurementId:"G-3STGPJXGSY"};firebase.initializeApp(cf_FBConfig)}cf_initStore();function DummyBookBtnClicked(){const anchorLinks=document.querySelectorAll("a");anchorLinks.forEach((link=&gt;{if(link.href==="https://app.thestudiodirector.com/internationalballetacadem/portal.sd?page=Login"){link.addEventListener("click",(function(event){console.log("Link clicked:",link.href);cfnudge_storeGenericFBDB("fareharbor","fh_bookBtnClicked","Persona","1__fareharbor__1");let pageURL="?utm_dummy=book_now_clicked";cfnudge_storeGenericNewURLFBDB(pageURL,"fareharbor","fh_bookBtnClicked","Persona","1__fareharbor__1")}))}}))}function cf_checkIfPrevVisit(cf_finalDevId,cf_finalBrowserId){var database=firebase.database();var domainRef=database.ref("cronuploads");domainRef.child("devXbrowserId").child(cf_finalDevId).once("value",(snapshot=&gt;{if(snapshot.exists()&amp;&amp;snapshot.val()===cf_finalBrowserId){console.log("cf_prevVisitExists exists! ",snapshot.val());cf_prevVisitExists=true}else{console.log("cf_prevVisitExists DOES NOT exists!")}}))}Date.prototype.yyyymmdd=function(){var mm=this.getMonth()+1;var dd=this.getDate();return[this.getFullYear(),(mm&gt;9?"":"0")+mm,(dd&gt;9?"":"0")+dd].join("")};function clear_allNudgeCookies(){create_cookie("cfnudge_booknow","False");create_cookie("cfnudge_offersExplored","False");create_cookie("cfnudge_multiSerum","False");create_cookie(cfcookie_visitUrlListStr,"");create_cookie(cf_numTimesCounterOnCheckoutActivatedStr,"");cf_nudgeCurrentlyInDisplay=false}function create_cookie(name,value,days){var expires;if(days){var date=new Date;date.setTime(date.getTime()+days*24*60*60*1e3);expires="; expires="+date.toGMTString()}else{expires=""}document.cookie=name+"="+value+expires+"; path=/"}function get_specificCookie(c_name){if(document.cookie.length&gt;0){c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return""}function getcookie_valList(name){curr_valListStr=get_specificCookie(name);var curr_valList=[];if(curr_valListStr!==""&amp;&amp;curr_valListStr!==null){return JSON.parse(curr_valListStr)}return[]}function append_cookieValList(name,value,days){curr_valListStr=get_specificCookie(name);var curr_valList=[];if(curr_valListStr!==""&amp;&amp;curr_valListStr!==null){curr_valList=JSON.parse(curr_valListStr)}curr_valList.push(value);create_cookie(name,JSON.stringify(curr_valList),days)}append_cookieValList(cfcookie_visitUrlListStr,document.location.href);create_cookie(cf_numTimesCounterOnCheckoutActivatedStr,"");cf_numTimesCouponShown=parseInt(get_specificCookie(cf_numTimesCouponShownStr));cf_numTimesCounterOnCheckoutActivated=parseInt(get_specificCookie(cf_numTimesCounterOnCheckoutActivatedStr));cf_couponRandomizedScore=get_specificCookie(cf_couponRandomizedScoreStr);if(cf_couponRandomizedScore===""||cf_couponRandomizedScore===null){cf_couponRandomizedScore=Math.random();create_cookie(cf_couponRandomizedScoreStr,cf_couponRandomizedScore)}function check_referrerTraffic(){var url=document.referrer;for(var cf_referrerURLstring of cf_referrerURLstringList){if(url.indexOf(cf_referrerURLstring)!==-1){create_cookie(cfnudge_referrerTrafficStr,"True");return}}}check_referrerTraffic();console.log(cfcookie_visitUrlListStr,getcookie_valList(cfcookie_visitUrlListStr),cf_numTimesCouponShownStr,cf_numTimesCouponShown,cf_numTimesCounterOnCheckoutActivatedStr,cf_numTimesCounterOnCheckoutActivated);console.log("CF UTM Personas Loaded");var cfbanner_css=`\n    .cfbanner_text-content{\n      margin: 0;\n      padding: 8px 14px;\n      color: #1c3f97;\n      text-align: center;\n      font-size: 20px;\n      font-family: 'kings-caslon-display';\n    }\n\n    .cfbanner_book-now, .cfbanner_book-now:hover{\n      color: white;\n      background: #1c3f97;\n      border: 1px solid;\n      padding: 6px 16px;\n      border-radius: 6px;\n      font-weight: 600;\n      cursor: pointer;\n    }\n\n    #timer{\n      color: red;\n    }\n\n  `;var cfnudge_css=`\n      \n      /* The Modal (background) */\n      .cfnudge_modal {\n        display: none; /* Hidden by default */\n        position: fixed; /* Stay in place */\n        z-index: 9999999999999999; /* Sit on top */\n        padding-top: 100px; /* Location of the box */\n        left: 0;\n        top: 0;\n        width: 100%; /* Full width */\n        height: 100%; /* Full height */\n        overflow: auto; /* Enable scroll if needed */\n        background-color: rgb(0,0,0); /* Fallback color */\n        background-color: rgba(0,0,0,0.4); /* Black w/ opacity */\n        text-align: center;\n        font-size: 25px;\n      }\n      \n      /* Modal Content */\n      .cfnudge_modal-content {\n        background-color: #fefefe;\n        margin: auto;\n        padding: 19px 12px;\n        border: 2.5px solid #1c3f97;\n        box-shadow: 3px 3px 5px #535353;\n        width: 100%;\n        position: absolute;\n        left: 50%;\n        top: 30%;\n        transform: translate(-50%, -30%);\n        max-width: 475px;\n        line-height:1.5;\n        border-radius: 6px;\n      }\n\n      \n      /* The Close Button */\n      .cfnudge_close {\n        color: #1c3f97;\n        float: right;\n        font-size: 26px;\n        font-weight: 500;\n        margin-top: -26px;\n        margin-right: -7px;\n        font-family: Heebo, sans-serif;\n      }\n      \n\n      /* Coupon Code */\n        .cfnudge-coupon {\n          color: #c9a145;\n          border: 1px solid #9999; \n          background: #f5e8ca;\n          padding: 4px; \n          margin: 10px 20px; \n          font-family: Heebo, sans-serif;\n          font-size: 19px;\n          letter-spacing: 1.5px;\n          border-radius: 8px;\n          font-weight: 500;\n        }\n\n        .cfnudge-coupon-input {\n          color: #1c3f97;\n          border: 1px solid #9999;\n          border-color: #5e5e5e;\n          background: #fff;\n          padding: 8px;\n          font-family: Heebo, sans-serif;\n          width: 79% !important;\n          margin: 0 auto 14px !important;\n          text-align: center;\n          font-size: 18px;\n          border-radius: 6px;\n        }\n\n        /* Copy Footnote */\n        .cfnudge-footnote{\n          display: none;\n          font-family: Heebo, sans-serif; \n          font-size: 14px;\n          margin: -2px 0px 0px 0px;  \n        }\n\n        .form-sbmt-thanks-msg{\n          color: #1c3f97;\n        }\n        .form-sbmt-thanks-msg p{\n          font-size: 21px;\n          margin:0px;\n        }\n\n        .cfnudge-copy {\n          color: #fff;\n          text-transform: capitalize;\n          border: 1px solid #9999;\n          background: #1c3f97;\n          padding: 4px;\n          margin: 4px 45px;\n          font-family: Heebo, sans-serif;\n          font-size: 21px;\n          cursor: pointer;\n          font-weight: 500;\n          display: block;\n          border-radius: 6px;\n        }\n          .cfnudge-copy:hover{\n            color: #1c3f97;\n            background: white;\n            border: 1.5px solid #1c3f97;\n          }\n\n        .cfnudge_text-content {\n          margin-bottom: 0;\n          font-family: Heebo, sans-serif;\n          font-size: 25px;\n          margin: 18px 20px;\n          color: #1c3f97;\n          line-height: 30px;\n          font-weight: 500;\n        }\n\t\t\n\t\t.cfnudge_dropbtn {\n\t\t  color: #00a9a1;\n\t\t  padding: 2px;\n\t\t  border: none;\n\t\t  cursor: pointer;\n\t\t  text-decoration: underline;\n\t\t}\n\t\t\n\t\t.cfnudge_dropdown {\n\t\t  position: relative;\n\t\t  display: inline-block;\n\t\t}\n\t\t\n\t\t.cfnudge_dropdown-content {\n\t\t  display: none;\n\t\t  position: absolute;\n\t\t  background-color: #f9f9f9;\n\t\t  min-width: 160px;\n\t\t  box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);\n\t\t  z-index: 1;\n\t\t}\n\t\t\n\t\t.cfnudge_dropdown-content a {\n\t\t  color: black;\n\t\t  padding: 5px 0px;\n\t\t  text-decoration: underline;\n\t\t  display: block;\n\t\t}\n\t\t\n\t\t.cfnudge_dropdown-content a:hover {background-color: #f1f1f1}\n\t\t\n\t\t.cfnudge_dropdown:hover .cfnudge_dropdown-content {\n\t\t  display: block;\n\t\t}\n\t\t\n\t\t.cfnudge_dropdown:hover .cfnudge_dropbtn {\n\t\t  background-color: #f1f1f1;\n\t\t}\n\n\n      .cfnudge_close:hover,\n      .cfnudge_close:focus {\n        color: #000;\n        text-decoration: none;\n        cursor: pointer;\n      }\n\n      .cfnudge-offer-term {\n        font-family: Heebo, sans-serif;\n        font-size: 11px;\n        margin: 6px 0px 0px 0px;\n      }\n\n      .cfnudge-offerTitle{\n          font-family: 'Petit Formal Script', 'Petit Formal Script Fallback';\n          font-size: 30px;\n          font-weight: 600;\n          color: #1c3f97;\n          text-transform: uppercase;\n          margin: 10px;\n      }\n      .cfnudge-offerTitle_aftersubmit{\n          // text-shadow: rgba(0, 0, 0, 0.4) 0px 0px 15px;\n          color: #00000;\n          font-size: 30px;\n          display: initial;\n          font-family: 'Playfair Display', 'Playfair Display Fallback';\n          font-style: italic;\n      }\n      .cfnudge-offerTitle span{\n        text-decoration: underline;\n        margin : 0 4px;\n      }\n    `;cfnudge_modalContentBannerOffer=`\n  &lt;div class="cfbanner_modal-content"&gt;\n    &lt;p  class="cfbanner_text-content"&gt;\n    &lt;a class="cfbanner_book-now" href='https://www.gramercy-atelier.com/contact/?utm_source=CF_Banner'&gt;Book an appointment&lt;/a&gt; now and receive a complimentary Silk Scarf ($325) with your made-to-measure order.\n    &lt;/p&gt;\n  &lt;/div&gt;\n  `;cfnudge_modalContentFree=`\n    &lt;div class="cfnudge_modal-content"&gt;\n      &lt;span id="cfnudge_close_contentUtmId" class="cfnudge_close"&gt;&amp;times;&lt;/span&gt;\n      &lt;h3 class="cfnudge-offerTitle"&gt;** &lt;span&gt;Exclusive Offer&lt;/span&gt;**&lt;/h3&gt;\n      &lt;p  class="cfnudge_text-content"&gt;Book an appointment now and receive a complimentary $350 off with your order.&lt;/p&gt;\n      &lt;input class="cfnudge-coupon-input" type="text" placeholder="Enter your name" id="cfnudge-coupon-name"&gt;\n      &lt;input class="cfnudge-coupon-input" type="text" placeholder="Enter your email *" id="cfnudge-coupon-email"&gt;\n      &lt;input class="cfnudge-coupon-input" type="text" placeholder="Enter phone number *" id="cfnudge-coupon-phone"&gt;\n      &lt;p class="cfnudge-copy" onclick="cfnudge_copyDiscountCode()"&gt;BOOK APPOINTMENT&lt;/p&gt;\n      &lt;p class='cfnudge-footnote'&gt;(Paste it in discount code box and hit apply at checkout)&lt;/p&gt;\n\t  &lt;/div&gt;\n    `;cfnudge_modalContentValue=`\n    &lt;div class="cfnudge_modal-content"&gt;\n      &lt;span id="cfnudge_close_contentUtmId" class="cfnudge_close"&gt;&amp;times;&lt;/span&gt;\n      &lt;h3 class="cfnudge-offerTitle"&gt;** &lt;span&gt;Exclusive Offer&lt;/span&gt;**&lt;/h3&gt;\n      &lt;p  class="cfnudge_text-content"&gt;Get an exclusive 20% off if you sign up in the next &lt;span id="timer"&gt;&lt;strong&gt;60&lt;/strong&gt;&lt;/span&gt; minutes!&lt;/p&gt;\n      &lt;input class="cfnudge-coupon-input" type="text" placeholder="Enter your name" id="cfnudge-coupon-name"&gt;\n      &lt;input class="cfnudge-coupon-input" type="text" placeholder="Enter your email *" id="cfnudge-coupon-email"&gt;\n      &lt;input class="cfnudge-coupon-input" type="text" placeholder="Enter phone number *" id="cfnudge-coupon-phone"&gt;\n      &lt;p class="cfnudge-copy" onclick="cfnudge_copyDiscountCode()"&gt;GET MY DISCOUNT&lt;/p&gt;\n      &lt;p class='cfnudge-footnote'&gt;(Paste it in discount code box and hit apply at checkout)&lt;/p&gt;\n\t  &lt;/div&gt;\n    `;cfnudge_modalContentUtmExplorer=`\n    &lt;div class="cfnudge_modal-content"&gt;\n      &lt;span id="cfnudge_close_contentUtmId" class="cfnudge_close"&gt;&amp;times;&lt;/span&gt;\n      &lt;h3 class="cfnudge-offerTitle"&gt;** &lt;span&gt;Exclusive Offer&lt;/span&gt;**&lt;/h3&gt;\n      &lt;p  class="cfnudge_text-content"&gt;Book an appointment now and receive a complimentary Silk Scarf ($325) with your made-to-measure order.&lt;/p&gt;\n      &lt;input class="cfnudge-coupon-input" type="text" placeholder="Enter your name" id="cfnudge-coupon-name"&gt;\n      &lt;input class="cfnudge-coupon-input" type="text" placeholder="Enter your email *" id="cfnudge-coupon-email"&gt;\n      &lt;input class="cfnudge-coupon-input" type="text" placeholder="Enter phone number *" id="cfnudge-coupon-phone"&gt;\n      &lt;p class="cfnudge-copy" onclick="cfnudge_copyDiscountCode()"&gt;BOOK APPOINTMENT&lt;/p&gt;\n\n\n      &lt;p class='cfnudge-footnote'&gt;(Paste it in discount code box and hit apply at checkout)&lt;/p&gt;\n\t  &lt;/div&gt;\n    `;function setup_genericCFbanner(cfnudge_modalId,cfnudge_css,cfnudge_modalContent){var cfnudge_modalDiv=document.getElementById(cfnudge_modalId);if(cfnudge_modalDiv!==null){return cfnudge_modalDiv}var cfnudge_styleSheet=document.createElement("style");cfnudge_styleSheet.type="text/css";cfnudge_styleSheet.innerText=cfnudge_css;document.head.appendChild(cfnudge_styleSheet);var cfnudge_modalDiv=document.createElement("div");cfnudge_modalDiv.className="cfnudge_modal";cfnudge_modalDiv.id=cfnudge_modalId;cfnudge_modalDiv.innerHTML=cfnudge_modalContent;var body=document.querySelector(".content");body.insertBefore(cfnudge_modalDiv,body.firstChild);var cfnudge_spans=document.getElementsByClassName("cfnudge_close");var cfnudge_modalDivsArray=document.querySelectorAll(cfnudge_modalIdsString);for(let cfnudge_span of cfnudge_spans){cfnudge_span.onclick=function(){cfnudge_modalDiv.style.display="none";for(let local_cfnudge_modalDiv of cfnudge_modalDivsArray){local_cfnudge_modalDiv.style.display="none"}clear_allNudgeCookies()}}cfnudge_appendCouponCopyFn();return cfnudge_modalDiv}function setup_genericCFnudge(cfnudge_modalId,cfnudge_css,cfnudge_modalContent){var cfnudge_modalDiv=document.getElementById(cfnudge_modalId);if(cfnudge_modalDiv!==null){return cfnudge_modalDiv}var cfnudge_styleSheet=document.createElement("style");cfnudge_styleSheet.type="text/css";cfnudge_styleSheet.innerText=cfnudge_css;document.head.appendChild(cfnudge_styleSheet);var cfnudge_modalDiv=document.createElement("div");cfnudge_modalDiv.className="cfnudge_modal";cfnudge_modalDiv.id=cfnudge_modalId;cfnudge_modalDiv.innerHTML=cfnudge_modalContent;document.body.appendChild(cfnudge_modalDiv);var cfnudge_spans=document.getElementsByClassName("cfnudge_close");var cfnudge_modalDivsArray=document.querySelectorAll(cfnudge_modalIdsString);for(let cfnudge_span of cfnudge_spans){cfnudge_span.onclick=function(){cfnudge_modalDiv.style.display="none";for(let local_cfnudge_modalDiv of cfnudge_modalDivsArray){local_cfnudge_modalDiv.style.display="none"}clear_allNudgeCookies()}}cfnudge_appendCouponCopyFn();return cfnudge_modalDiv}function cfnudge_storeCouponActionFBDB(cookieDBstring,cf_nudgeType,cf_curr_couponID){curr_date=new Date;var database=firebase.database();var visitDateTime=[cf_nudgeType,cf_curr_couponID,curr_date.toLocaleDateString(),curr_date.toLocaleTimeString(),document.cookie].join("\t\t");var oldUser=false;encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);console.log("String to FBDB, ",cookieDBstring);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child("CouponActions").child(cookieDBstring).child(encodeURIComponent(curr_date).replace(/\./g,"%2E")).transaction((function(currentData){if(cf_debugGen)console.log("logging current time: ",visitDateTime);if(currentData===null){currentData=Array.of(visitDateTime);return currentData}currentData.push(visitDateTime);return currentData}),(function(error,committed,snapshot){if(error){}else if(!committed){console.log("Transaction not commited.")}else{if(cf_debugGen)console.log("curr_date with Cookies added!")}if(cf_debugGen)console.log("visitor's data: ",snapshot.val())}))}function cfnudge_appendCouponCopyFn(){var s=document.createElement("script");s.type="text/javascript";var code=`\n  function get_specificCookie(c_name) {\n    if (document.cookie.length &gt; 0) {\n      c_start = document.cookie.indexOf(c_name + "=");\n      if (c_start != -1) {\n        c_start = c_start + c_name.length + 1;\n        c_end = document.cookie.indexOf(";", c_start);\n        if (c_end == -1) {\n          c_end = document.cookie.length;\n        }\n        return unescape(document.cookie.substring(c_start, c_end));\n      }\n    }\n    return "";\n  }\n\n  function create_cookie(name, value, days) {\n    var expires;\n    if (days) {\n      var date = new Date();\n      date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));\n      expires = "; expires=" + date.toGMTString();\n    } else {\n      expires = "";\n    }\n    document.cookie = name + "=" + value + expires + "; path=/";\n  }\n\n  function getcookie_valList(name) {\n    curr_valListStr = get_specificCookie(name);\n    var curr_valList = []\n    if (curr_valListStr !== "" &amp;&amp; curr_valListStr !== null) { return JSON.parse(curr_valListStr); }\n    return [];\n  }\n\n  function cfnudge_callStore(){\n     \n      window.location.href = 'tel:' + '(877) 575-9994';\n      // document.cookie = "cf_phone_button_clicked" + "=" + "True" ;\n      // return;\n    }\n\n  function clear_allNudgeCookies() {\n    create_cookie("cfnudge_booknow", "False");\n    create_cookie("cfnudge_offersExplored", "False");\n    create_cookie("cfnudge_multiSerum", "False");\n    create_cookie("cfcookie_visitUrlList", "");\n    create_cookie("cf_numTimesCounterOnCheckoutActivated", "");\n    cf_nudgeCurrentlyInDisplay = false;\n  }\n\n\tfunction cfnudge_copyDiscountCode() {\n     console.log("book button clicked")\n     create_cookie("cf_PersonaNudgeshown", "true")\n     \t\tvar cfnudge_footnote = document.getElementsByClassName("cfnudge-footnote")[0];\n    \t  var cfnudge_copy_div = document.getElementsByClassName("cfnudge-copy")[0];\n        var customer_name = document.getElementById('cfnudge-coupon-name').value.trim();\n        // var preferred_date = document.getElementById('cfnudge-coupon-date').value.trim();\n        // console.log(customer_name, preferred_date);\n        var re_email = /S+@S+.S+/;\n        var customer_email = document.getElementById('cfnudge-coupon-email').value.trim();\n        if (customer_email.split()[0].split("@").length!==2) {\n             console.log("CF Nudge email: ", customer_email);\n             cfnudge_footnote.style.display = "block";\n             cfnudge_footnote.style.color = "red";\n             cfnudge_footnote.innerHTML = "Please enter a valid email!";\n             return;\n        }\n\n        var customer_phone = document.getElementById('cfnudge-coupon-phone').value.trim();\n        if (customer_phone.length&lt;10) {\n             console.log("CF Nudge phone: ", customer_phone);\n             cfnudge_footnote.style.display = "block";\n             cfnudge_footnote.style.color = "red";\n             cfnudge_footnote.innerHTML = "Please enter a valid phone number!";\n             return;\n        }\n\n\n    // sent email notification alert\n    let cf_visited_urls = getcookie_valList("cfcookie_visitUrlList");\n    let cf_user_ip = get_specificCookie("cf_userIP");\n    let cf_user_country = get_specificCookie("cfcookie_stateCountry");\n    let cf_user_device = get_specificCookie("cf_userDevice")\n    \n    let cf_PersonaNudgeshown = (get_specificCookie("cf_PersonaNudgeshown") === "true");\n    const payLoad = {\n      "cf_visited_urls": cf_visited_urls,\n      "cf_user_ip": cf_user_ip,\n      "cf_user_country": cf_user_country,\n      "cf_user_device": cf_user_device,\n      "store_owner_email": "hi@causalfunnel.com",\n      "cf_PersonaNudgeshown": cf_PersonaNudgeshown,\n      "user_email": customer_email,\n      "user_phone": customer_phone,\n      "user_name": customer_name,\n    }\n    console.log("--- &lt;payLoad&gt; ---", payLoad)\n      fetch('https://us-central1-causalfunnel-21.cloudfunctions.net/CF_optimurotary_LeadCapture_API', {\n      method: 'POST',\n      headers: {\n        'Content-Type': 'application/json'\n      },\n      body: JSON.stringify(payLoad)\n    })\n    .then(response =&gt; response.json())\n    .then(data =&gt; {\n      console.log("2nd API Calling Done",data);\n      window.location.href="https://www.dynamicsportgroup.com/contact-us?utm_source=CF_Nudge"\n      })\n    .catch(error =&gt; console.error('Error:', error));\n\n\n\t\tcfnudge_footnote.style.display = "none";\n\t\tcfnudge_copy_div.innerHTML = "Thanks For Sharing Your Info!";\n    cfnudge_footnote.style.color = "#1c3f97";\n    cfnudge_copy_div.style.pointerEvents = "none";\n\n\n    document.getElementById('cfnudge-coupon-email').style.pointerEvents = "none";\n    document.getElementById('cfnudge-coupon-phone').style.pointerEvents = "none";\n    document.cookie = "cfcookie_userEmail" + "=" + customer_email + "" + "; path=/";\n    document.cookie = "cfcookie_userPhone" + "=" + customer_phone + "" + "; path=/";\n    console.log("CF: Inside CFfetchLocationFromLatLong - customer_email, customer_phone: ", customer_email, customer_phone);\n\n        \n       \n  \t}\t\n\t`;try{s.appendChild(document.createTextNode(code));document.body.appendChild(s)}catch(e){s.text=code;document.body.appendChild(s)}}function handle_bookNowClicked(){create_cookie("cfnudge_booknow","True");console.log("CausalFunnel: Book Now button clicked.")}function show_nudgeModal(cf_nudgeType){if(cf_nudgeCurrentlyInDisplay)return false;if(cf_nudgeType===cf_nudgeMoisturizerSerum){cfnudge_modalDiv=setup_genericCFnudge(cfnudge_modalIdMoisturizerSerum,cfnudge_css,cfnudge_modalContentUtmExplorer);cf_curr_couponID=cf_couponidMoisturizerSerum;create_cookie(cf_PersonaNudgeshownStr,"true")}else if(cf_nudgeType===cf_nudgeMultiSerum){cfnudge_modalDiv=setup_genericCFnudge(cfnudge_modalIdMultiSerum,cfnudge_css,cfnudge_modalContentValue);cf_curr_couponID=cf_couponidMultiSerum;create_cookie(cf_PersonaNudgeshownStr,"true")}else if(cf_nudgeType===cf_nudgeFreeSerum){cfnudge_modalDiv=setup_genericCFnudge(cfnudge_modalIdFreeSerum,cfnudge_css,cfnudge_modalContentFree);cf_curr_couponID=cf_couponidFreeSerum;create_cookie(cf_PersonaNudgeshownStr,"true")}else if(cf_nudgeType===cf_BannerOffer){cfnudge_modalDiv=setup_genericCFbanner(cfnudge_modalIdBannerOffer,cfbanner_css,cfnudge_modalContentBannerOffer);cf_curr_couponID="CF_Banner_Offer"}console.log("CausalFunnel: Get 10% discount if you book within an hour!");cfnudge_modalDiv.style.display="block";cf_nudgeCurrentlyInDisplay=true;create_cookie(cf_numTimesCouponShownStr,1);cfnudge_storeCouponActionFBDB("CouponShown",cf_nudgeType,cf_curr_couponID);console.log("show_nudgeModal -- Nudge Expiry");let was_nudge_shown=get_specificCookie(cfnudge_shown_firstTime_Str);console.log("was_nudge_shown",was_nudge_shown,was_nudge_shown==="");if(was_nudge_shown===""){let time_now=new Date;create_cookie(cfnudge_shown_firstTime_Str,time_now);handle_nudge_timer_expiry()}else{handle_nudge_timer_expiry()}}var nudge_timer_setInterval_id;function handle_nudge_timer_expiry(){console.log("handle_nudge_timer_expiry() called ..");nudge_timer_setInterval_id=setInterval((()=&gt;{nudge_timer_update()}),1e3)}function nudge_timer_update(){let time_prev=new Date(get_specificCookie(cfnudge_shown_firstTime_Str));let time_now=new Date;let time_diff=Math.abs(time_now-time_prev);let time_diff_hours=Math.floor(time_diff/(1e3*60*60));let msec=time_diff-time_diff_hours*1e3*60*60;let time_diff_mins=Math.floor(msec/(1e3*60));msec-=time_diff_mins*1e3*60;let time_diff_secs=Math.floor(msec/1e3);let new_timer_html="";if(time_diff_mins&lt;cf_nudge_expiry_timer_min){new_timer_html=`&lt;strong&gt;${cf_nudge_expiry_timer_min-1-time_diff_mins}:${60-time_diff_secs}&lt;/strong&gt;`;document.querySelector(".cfnudge_modal #timer").innerHTML=new_timer_html}else{document.querySelector(".cfnudge_modal #timer").innerText="0";if(actionOnNudgeTimeout=="nudge_disappeared"){let nudgeModal=document.querySelector(".cfnudge_modal");if(nudgeModal)nudgeModal.style.display="none";clearInterval(nudge_timer_setInterval_id)}else if(actionOnNudgeTimeout=="nudge_timer_reset"){let time_now=new Date;create_cookie(cfnudge_shown_firstTime_Str,time_now)}console.log("Nudge Expired!")}}function send_toGoogleAnalytics(){console.log("CF: Sending to Google Analytics");ga("send","event","Web Application","CouponShown","Coupon shown to this user")}function check_multiSerumExplored(nudgeCookie_visitUrlList){var curr_serumUrl=null;for(var url of nudgeCookie_visitUrlList){if(url.indexOf(cf_offersSerumURL[0])!==-1){if(curr_serumUrl!==url){console.log("CF Found multiple Serum URLs");return true}curr_serumUrl=url}}return false}function check_ifNearCheckout(){for(var suburl of cf_offersCartURL){if(document.location.href.indexOf(suburl)!==-1){return true}}return false}function logNewVisitorsDesktop(){var fh_html=document.getElementsByTagName("html")[0];var observer=new MutationObserver((function(event){if(fh_html.className.indexOf("fareharbor-showing-lightframe")!==-1){console.log("CF Fareharbor book button clicked");cfnudge_storeGenericFBDB("fareharbor","fh_bookBtnClicked","Persona","1__fareharbor__1");let pageURL="?utm_dummy=book_now_clicked";cfnudge_storeGenericNewURLFBDB(pageURL,"fareharbor","fh_bookBtnClicked","Persona","1__fareharbor__1")}}));observer.observe(fh_html,{attributes:true,attributeFilter:["class"],childList:false,characterData:false})}logNewVisitorsDesktop();const pageURL=document.location.href;if(pageURL.includes("/contact"))setTimeout(callListenContactFields,1e3);function callListenContactFields(){listenToFirstNameField();listenToLastNameField();listenToEmailInputField();listenToTelephoneInput();listenToMessageInput();console.log("Calling listenToFormSendButton")}function listenToFirstNameField(){add_listenerInputField("#form-field-input-82c0a6c4-2d3c-4711-2e9b-afd2f1207ac0",cf_userDetails_fnameLabel)}function listenToLastNameField(){add_listenerInputField("#form-field-input-e19f8b32-daae-4c52-6322-c2e7a77e94d7",cf_userDetails_lnameLabel)}function listenToEmailInputField(){add_listenerInputField("#form-field-input-75e89bac-f416-4915-429e-180743359592",cf_userDetails_emailLabel)}function listenToTelephoneInput(){add_listenerInputField("#form-field-input-47a75787-18d6-4d2d-4e8a-2a5cdab2c62b",cf_userDetails_phoneLabel)}function listenToMessageInput(){add_listenerInputField("#form-field-input-6c28e837-12c0-4789-db82-0e7e7b35acc5",cf_userDetails_messageLabel)}function listenToSendButton(){add_listenerSentButton(".form-submit-button",cf_userDetails_dict)}function add_listenerSentButton(idString,fieldName){console.log("add_listenerSentButton() is executing ......");var sent_btn_element=document.querySelectorAll(idString)[0];if(sent_btn_element===undefined)return;sent_btn_element.addEventListener("click",(function(event){let isFormValid=true;let user_data="";for(const[key,val]of Object.entries(cf_userDetails_dict)){user_data+=`${key} = ${val}; `}console.log("user_data",user_data);const{first_name:first_name,last_name:last_name,user_email:user_email,user_phone:user_phone}=cf_userDetails_dict;console.log(cf_userDetails_dict);if(first_name&amp;&amp;last_name&amp;&amp;user_email&amp;&amp;user_phone){sendRequestServiceForm()}cfnudge_storeGenericFBDB("ContactForm","UserDetails",JSON.stringify(cf_userDetails_dict),"")}))}function add_listenerInputField(idString,fieldName){var field_input=document.querySelectorAll(idString)[0];if(field_input===undefined)return;field_input?.addEventListener("input",(function(event){clearTimeout(cf_debounceTimer);if(Boolean(field_input.value)){cf_debounceTimer=setTimeout((()=&gt;{cf_userDetails_dict[fieldName]=field_input.value;console.log("user_data ---\x3e ",cf_userDetails_dict);cfnudge_storeGenericFBDB("ContactForm","UserDetails",JSON.stringify(cf_userDetails_dict),"");create_cookie(cfcookie_userFormDataStr,JSON.stringify(cf_userDetails_dict))}),500)}}))}function waitForElementToDisplayByID(callback,checkFrequencyInMs,timeoutInMs,idString,idFieldName,submit=false){console.log("waitForElementToDisplayByID calling ...");var startTimeInMs=Date.now();(function loopSearch(){var prod_itemsTags=document.querySelectorAll(idString);console.log("prod_itemsTags",prod_itemsTags);if(prod_itemsTags!==null&amp;&amp;prod_itemsTags.length&gt;0){callback(idString,idFieldName);return}else{setTimeout((function(){if(timeoutInMs&amp;&amp;Date.now()-startTimeInMs&gt;timeoutInMs)return;loopSearch()}),checkFrequencyInMs)}})()}function check_showNudgeCookies(){if(document.readyState!=="complete"){return false}const pageURL=document.location.href;if(!pageURL.includes("?cf_debug")){console.log("Testing Mode");return false}for(let i=0;i&lt;cf_contactPageURL.length;i++){if(pageURL.includes(cf_contactPageURL[i]))return}let cf_PersonaNudgeshown=get_specificCookie(cf_PersonaNudgeshownStr)==="true";if(cf_PersonaNudgeshown){console.log("will not move to nudge checking, nudge already shown to user");return false}var nudgeCookie_visitUrlList=getcookie_valList(cfcookie_visitUrlListStr);console.log("CausalFunnel nudgeCookie_visitUrlList: ",nudgeCookie_visitUrlList);let exploratoryUser=get_specificCookie(cfnudge_referrerTrafficStr)==="True";console.log("exploratoryUser ? ",exploratoryUser);let cfnudge_time_prev=new Date(get_specificCookie(cfnudge_shown_firstTime_Str));let time_now=new Date;let time_diff=Math.abs(time_now-cfnudge_time_prev);let time_diff_hours=Math.floor(time_diff/1e3/60/60);if(time_diff_hours&gt;=1){console.log("Not showing Persona as coupon expired");return false}if(check_ifNearCheckout()){if(Boolean(cf_numTimesCounterOnCheckoutActivated)){cf_numTimesCounterOnCheckoutActivated+=1}else{cf_numTimesCounterOnCheckoutActivated=1}create_cookie(cf_numTimesCounterOnCheckoutActivatedStr,cf_numTimesCounterOnCheckoutActivated)}console.log(cf_numTimesCounterOnCheckoutActivatedStr,cf_numTimesCounterOnCheckoutActivated,cf_numTimesCouponShownStr,cf_numTimesCouponShown);let cf_defaultNudge=cf_nudgeMultiSerum;if(nudgeCookie_visitUrlList.length&gt;1&amp;&amp;!Boolean(cf_numTimesCouponShown)&amp;&amp;!check_ifNearCheckout()){show_nudgeModal(cf_defaultNudge);return true}else if(nudgeCookie_visitUrlList.length&gt;0&amp;&amp;check_ifNearCheckout()&amp;&amp;cf_numTimesCounterOnCheckoutActivated&gt;0&amp;&amp;cf_numTimesCounterOnCheckoutActivated%3==0){show_nudgeModal(cf_defaultNudge);return true}else if(!check_ifNearCheckout()&amp;&amp;cf_numTimesCouponShown&gt;0){show_nudgeModal(cf_defaultNudge);return true}return true}function makeApiCallToCloudFunction(){let cf_visited_urls=getcookie_valList(cfcookie_visitUrlListStr);let cf_user_ip=get_specificCookie(cf_userIPStr);let cf_user_country=get_specificCookie(cfcookie_stateCountryStr);let cf_user_device=get_specificCookie(cf_userDeviceStr);fetch("https://us-central1-causalfunnel-21.cloudfunctions.net/CF_NapaValleyChauffeurContact_FormSubmission",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cf_visited_urls:cf_visited_urls,cf_user_ip:cf_user_ip,cf_user_country:cf_user_country,cf_user_device:cf_user_device,store_owner_email:"hi@causalfunnel.com",formType:"Book_Button_Clicked"})}).then((response=&gt;response.json())).then((data=&gt;console.log("1st API Calling Done",data))).catch((error=&gt;console.error("Error:",error)))}function sendRequestServiceForm(){let cf_visited_urls=getcookie_valList(cfcookie_visitUrlListStr);let cf_user_ip=get_specificCookie(cf_userIPStr);let cf_user_country=get_specificCookie(cfcookie_stateCountryStr);let cf_user_device=get_specificCookie(cf_userDeviceStr);let cfcookie_userFormData=JSON.parse(get_specificCookie(cfcookie_userFormDataStr));let cf_PersonaNudgeshown=get_specificCookie(cf_PersonaNudgeshownStr)==="true";const payLoad={cf_visited_urls:cf_visited_urls,cf_user_ip:cf_user_ip,cf_user_country:cf_user_country,cf_user_device:cf_user_device,store_owner_email:"hi@causalfunnel.com",cf_PersonaNudgeshown:cf_PersonaNudgeshown,...cfcookie_userFormData};console.log("---payLoad---",payLoad);fetch("https://us-central1-causalfunnel-21.cloudfunctions.net/CF_NapaValleyChauffeurContact_FormSubmission",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(payLoad)}).then((response=&gt;response.json())).then((data=&gt;console.log("2nd API Calling Done",data))).catch((error=&gt;console.error("Error:",error)))}function CFgetLocationFromIP(cf_ip){console.log("inside CFgetLocationFromIP, cf_ip: ",cf_ip);var xhr=new XMLHttpRequest;var url="https://us-central1-causalfunnel-21.cloudfunctions.net/IP2GeoLocation";xhr.open("POST",url);xhr.setRequestHeader("Content-type","application/json");xhr.onreadystatechange=function(){if(xhr.readyState==4&amp;&amp;(xhr.status==204||xhr.status==200)){console.log(xhr.responseText);cfcookie_stateCountry=xhr.responseText;console.log("CF: ",cfcookie_stateCountry);create_cookie(cfcookie_stateCountryStr,cfcookie_stateCountry);cfnudge_storeGenericFBDB("GeolocationDetails","LatLongCityCountry","NOT CALCULATED",cfcookie_stateCountry)}};xhr.send(JSON.stringify({user_ip:cf_ip}))}function set_timer4Nudge(){var cfnudgeTimer;window.onload=resetTimer;window.onmousemove=resetTimer;window.onmousedown=resetTimer;window.ontouchstart=resetTimer;window.onclick=resetTimer;window.onkeydown=resetTimer;var events=["mousedown","mousemove","keypress","scroll","touchstart"];events.forEach((function(name){document.addEventListener(name,resetTimer,true)}));resetTimer();function resetTimer(){clearInterval(cfnudgeTimer);cfnudgeTimer=setInterval(check_showNudgeCookies,4e3)}}set_timer4Nudge();if(document.location.href.indexOf(cf_offersCartURL[0])!==-1){listenToEmailInput()}function listenToEmailInput(){waitForElementToDisplayByID(add_listenerCustomerEmail,1e3,1e4,"#billing_email")}function add_listenerCustomerEmail(){var email_input=document.getElementById("billing_email");console.log("CF Inside add_listenerCustomerEmail");email_input.addEventListener("keyup",(function(event){clearTimeout(cf_debounceTimer);if(Boolean(email_input.value)){cf_debounceTimer=setTimeout(extract_userDetailsWooCommerce,500)}}))}function extract_userDetailsWooCommerce(){console.log("CF inside extract_userDetails()");var user_email_elem=document.getElementById("billing_email");if(user_email_elem!==null){user_details_form=document.getElementsByClassName("woocommerce-billing-fields");user_detail_array=[];if(user_details_form.length&gt;0){user_detail_array.push(user_details_form[0].innerText)}var user_detail_str=user_detail_array.join("::");if(user_email_elem!==null&amp;&amp;user_email_elem.value!==cf_useremail){cf_useremail=user_email_elem.value;create_cookie("cf_useremail",cf_useremail);cfnudge_storeGenericFBDB("PersonalDetails","ShippingDetails",cf_useremail,user_detail_str)}else if(cf_userDetails!==user_detail_str){console.log("cf_useremail: ",cf_useremail);cf_userDetails=user_detail_str;create_cookie("cf_userDetails",cf_userDetails);cfnudge_storeGenericFBDB("PersonalDetails","ShippingDetails",cf_useremail,user_detail_str)}}}function waitForElementToDisplayByID(callback,checkFrequencyInMs,timeoutInMs,idString){var startTimeInMs=Date.now();(function loopSearch(){var prod_itemsTags=document.querySelectorAll(idString);if(prod_itemsTags!==null&amp;&amp;prod_itemsTags.length&gt;0){callback();return}else{setTimeout((function(){if(timeoutInMs&amp;&amp;Date.now()-startTimeInMs&gt;timeoutInMs)return;loopSearch()}),checkFrequencyInMs)}})()}function cfnudge_storeGenericNewURLFBDB(new_url,actionString,cookieDBstring,cf_applied_couponID,items_bought){curr_date=new Date;var database=firebase.database();var visitDateTime=[cf_applied_couponID,items_bought,curr_date.toLocaleDateString(),curr_date.toLocaleTimeString(),document.cookie].join("\t\t");var oldUser=false;encodedURI=encodeURIComponent(document.location.href+new_url).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);console.log("String to FBDB, ",cookieDBstring);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child(actionString).child(cookieDBstring).child(encodeURIComponent(curr_date).replace(/\./g,"%2E")).transaction((function(currentData){if(cf_debugGen)console.log("logging current time: ",visitDateTime);if(currentData===null){currentData=Array.of(visitDateTime);return currentData}currentData.push(visitDateTime);return currentData}),(function(error,committed,snapshot){if(error){}else if(!committed){console.log("Transaction not commited.")}else{if(cf_debugGen)console.log("curr_date with Cookies added!")}if(cf_debugGen)console.log("visitor's data: ",snapshot.val())}))}function cfnudge_storeGenericFBDB(actionString,cookieDBstring,cf_applied_couponID,items_bought){curr_date=new Date;var database=firebase.database();var visitDateTime=[cf_applied_couponID,items_bought,curr_date.toLocaleDateString(),curr_date.toLocaleTimeString(),document.cookie].join("\t\t");var oldUser=false;encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);console.log("String to FBDB, ",cookieDBstring);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child(actionString).child(cookieDBstring).child(encodeURIComponent(curr_date).replace(/\./g,"%2E")).transaction((function(currentData){if(cf_debugGen)console.log("logging current time: ",visitDateTime);if(currentData===null){currentData=Array.of(visitDateTime);return currentData}currentData.push(visitDateTime);return currentData}),(function(error,committed,snapshot){if(error){}else if(!committed){console.log("Transaction not commited.")}else{if(cf_debugGen)console.log("curr_date with Cookies added!")}if(cf_debugGen)console.log("visitor's data: ",snapshot.val())}))}function getCookie(c_name){if(document.cookie.length&gt;0){console.log("Inside getCookie: ");console.log(document.cookie)}return document.cookie}function checkNstoreCookie(){if(cf_overallCookie===document.cookie){return}else{cf_overallCookie=document.cookie;cf_storeCookiePerID("perIntervalCookie")}}function checkNstoreLocalStorage(){if(cf_overallLocalStorage===JSON.stringify(window.localStorage)){return}else{cf_overallLocalStorage=JSON.stringify(window.localStorage);cf_storeLocalStoragePerID("perIntervalLocalStorage")}}function recallNstoreCookiesNlocalStorage(){cf_overallCookie=document.cookie;cf_storeCookiePerID("startCookies");setInterval(checkNstoreCookie,60*1e3*2);window.addEventListener("beforeunload",(function(e){var confirmationMessage="o/";cf_storeCookiePerID("onCloseCookies")}))}function cf_getAddressCookieLocal(){var c_name="ymAddress";if(document.cookie.length&gt;0){console.log("Inside getAddressCookie: ");console.log(document.cookie);c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return null}function cf_getJobCookieLocal(){var c_name="ymJobs";if(document.cookie.length&gt;0){console.log("Inside getJobCookie: ");console.log(document.cookie);c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return null}function cf_getSpecificCookieLocal(cookieName){var c_name=cookieName;if(document.cookie.length&gt;0){console.log("Inside getJobCookie: ");console.log(document.cookie);c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1){c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1){c_end=document.cookie.length}return unescape(document.cookie.substring(c_start,c_end))}}return null}function cf_storeJobCookieFBDB(addressCookie){curr_date=new Date;var database=firebase.database();encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child("job").transaction((function(currentData){if(cf_debugGen)console.log("logging current time: ",addressCookie);if(currentData===null){currentData=Array.of(addressCookie);return currentData}console.log("User Cookie Job exists: ",addressCookie);currentData.push(addressCookie);return currentData}),(function(error,committed,snapshot){if(error){console.log("Transaction failed abnormally!",error)}else if(!committed){console.log("Transaction not commited.")}else{console.log("jobCookie added!")}if(cf_debugGen)console.log("visitor's data: ",snapshot.val())}))}function cf_storeSpecificCookieFBDB(addressCookie,cookieName){curr_date=new Date;var database=firebase.database();encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child(cookieName).transaction((function(currentData){if(cf_debugGen)console.log("logging current time: ",addressCookie);if(currentData===null){currentData=Array.of(addressCookie);return currentData}console.log("User Cookie ",cookieName," exists: ",addressCookie);currentData.push(addressCookie);return currentData}),(function(error,committed,snapshot){if(error){console.log("Transaction failed abnormally!",error)}else if(!committed){console.log("Transaction not commited.")}else{console.log(cookieName," added!")}if(cf_debugGen)console.log("visitor's data: ",snapshot.val())}))}function cf_setJobCookieLocal(){curr_date=new Date;var database=firebase.database();encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child("job");var addressCookie=null;domainRef.on("value",(function(snapshot){snapshot.forEach((function(userSnapshot){addressCookie=userSnapshot.val();console.log("inside fb db read snapshot Job: ",addressCookie)}));if(addressCookie!=null){console.log("setting local job cookie using remote DB: ",addressCookie);console.log("escape(jobCookie): ",escape(addressCookie));document.cookie="ymJobs="+escape(addressCookie)+"; expires=Session; path=/"}}))}function cf_setSpecificCookieLocal(cookieName){curr_date=new Date;var database=firebase.database();encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child(cookieName);var addressCookie=null;domainRef.on("value",(function(snapshot){snapshot.forEach((function(userSnapshot){addressCookie=userSnapshot.val();console.log("inside fb db read snapshot Job: ",addressCookie)}));if(addressCookie!=null){console.log("setting local job cookie using remote DB: ",addressCookie);console.log("escape("+cookieName+"): ",escape(addressCookie));document.cookie=cookieName+"="+escape(addressCookie)+"; expires=Session; path=/"}}))}function cf_storeAddressCookieFBDB(addressCookie){curr_date=new Date;var database=firebase.database();encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child("address").transaction((function(currentData){if(cf_debugGen)console.log("logging current time: ",addressCookie);if(currentData===null){currentData=Array.of(addressCookie);return currentData}console.log("User Cookie Address exists: ",addressCookie);currentData.push(addressCookie);return currentData}),(function(error,committed,snapshot){if(error){console.log("Transaction failed abnormally!",error)}else if(!committed){console.log("Transaction not commited.")}else{console.log("addressCookie added!")}if(cf_debugGen)console.log("visitor's data: ",snapshot.val())}))}function cf_setAddressCookieLocal(){curr_date=new Date;var database=firebase.database();encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child("address");var addressCookie=null;domainRef.on("value",(function(snapshot){snapshot.forEach((function(userSnapshot){addressCookie=userSnapshot.val();console.log("inside fb db read snapshot address: ",addressCookie)}));if(addressCookie!=null){console.log("setting local cookie using remote DB: ",addressCookie);console.log("escape(addressCookie): ",escape(addressCookie));document.cookie="ymAddress="+escape(addressCookie)+"; expires=Session; path=/"}}))}function cf_storeLocalStoragePerID(localStorageDBstring){curr_date=new Date;var database=firebase.database();var profile_val=null;if(window.localStorage.hasOwnProperty("profile")){profile_val=window.localStorage["profile"]}else{return}var localStorageStr=JSON.stringify(window.localStorage["profile"]);console.log(localStorageStr);var visitDateTime=[curr_date.toLocaleDateString(),curr_date.toLocaleTimeString(),localStorageStr].join("\t\t");var oldUser=false;encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child(localStorageDBstring).child(encodeURIComponent(curr_date).replace(/\./g,"%2E")).transaction((function(currentData){if(cf_debugGen)console.log("logging current time: ",visitDateTime);if(currentData===null){currentData=Array.of(visitDateTime);return currentData}currentData.push(visitDateTime);return currentData}),(function(error,committed,snapshot){if(error){}else if(!committed){console.log("Transaction not commited.")}else{if(cf_debugGen)console.log("curr_date with Cookies added!")}if(cf_debugGen)console.log("visitor's data: ",snapshot.val())}))}function cf_storeCookiePerID(cookieDBstring){curr_date=new Date;var database=firebase.database();var visitDateTime=[curr_date.toLocaleDateString(),curr_date.toLocaleTimeString(),document.cookie].join("\t\t");var oldUser=false;encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child(cookieDBstring).child(encodeURIComponent(curr_date).replace(/\./g,"%2E")).transaction((function(currentData){if(cf_debugGen)console.log("logging current time: ",visitDateTime);if(currentData===null){currentData=Array.of(visitDateTime);return currentData}currentData.push(visitDateTime);return currentData}),(function(error,committed,snapshot){if(error){}else if(!committed){console.log("Transaction not commited.")}else{if(cf_debugGen)console.log("curr_date with Cookies added!")}if(cf_debugGen)console.log("visitor's data: ",snapshot.val())}))}function cf_storeIDsPerUserName(){cf_inputFirstLastNameTxt=document.getElementById("cf_inputFirstLastName").value;cf_inputDeviceTxt=document.getElementById("cf_inputDevice").value;console.log("cf_inputFirstLastName.txt: ",cf_inputFirstLastNameTxt);console.log("cf_inputDevice.txt: ",cf_inputDeviceTxt);curr_date=new Date;var database=firebase.database();var visitDateTime=[curr_date.toLocaleDateString(),curr_date.toLocaleTimeString(),cf_browserIndStr].join("~~~");var oldUser=false;encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);domainRef.child(encodedURI).child(cf_inputFirstLastNameTxt).child(cf_inputDeviceTxt).child(cf_finalDevId).child(cf_finalBrowserId).child("visitTimes").transaction((function(currentData){if(cf_debugGen)console.log("logging current time: ",visitDateTime);if(currentData===null){if(cf_debugGen)console.log("No Existing Data: ",currentData);currentData=Array.of(visitDateTime);return currentData}if(cf_debugGen)console.log("User log exists: ",currentData);currentData.push(visitDateTime);return currentData}),(function(error,committed,snapshot){if(error){console.log("Transaction failed abnormally!",error)}else if(!committed){console.log("Transaction not commited.")}else{console.log("curr_date added!")}if(cf_debugGen)console.log("visitor's data: ",snapshot.val())}))}function cf_storeIDs(){curr_date=new Date;var database=firebase.database();var visitDateTime=[curr_date.toLocaleDateString(),curr_date.toLocaleTimeString(),cf_browserIdLogStr].join("~~~");cf_checkIfPrevVisit(cf_finalDevId,cf_finalBrowserId);var oldUser=false;encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child("visitTimesIdStr").transaction((function(currentData){if(cf_debugGen)console.log("logging current time: ",visitDateTime);if(currentData===null){if(cf_debugGen)console.log("No Existing Data: ",currentData);currentData=Array.of(visitDateTime);return currentData}if(cf_debugGen)console.log("User log exists: ",currentData);currentData.push(visitDateTime);return currentData}),(function(error,committed,snapshot){if(error){console.log("Transaction failed abnormally!",error)}else if(!committed){console.log("Transaction not commited.")}else{if(cf_debugGen)console.log("curr_date with ID added!")}if(cf_debugGen)console.log("visitor's data: ",snapshot.val())}))}function cf_storeIDversions(){curr_date=new Date;var database=firebase.database();var visitDateTime=[document.referrer,curr_date.toLocaleDateString(),curr_date.toLocaleTimeString(),cf_finalBrowserIdV2].join("~~~");var oldUser=false;encodedURI=encodeURIComponent(document.location.href).replace(/\./g,"%2E");var dateRef=curr_date.yyyymmdd();var domainRef=database.ref(dateRef);domainRef.child(encodedURI).child(cf_finalDevId).child(cf_finalBrowserId).child("cf_finalBrowserIdV2visitStr").transaction((function(currentData){if(cf_debugGen)console.log("logging current time: ",visitDateTime);if(currentData===null){if(cf_debugGen)console.log("No Existing Data: ",currentData);currentData=Array.of(visitDateTime);return currentData}if(cf_debugGen)console.log("User log exists: ",currentData);currentData.push(visitDateTime);return currentData}),(function(error,committed,snapshot){if(error){console.log("Transaction failed abnormally!",error)}else if(!committed){console.log("Transaction not commited.")}else{if(cf_debugGen)console.log("curr_date with ID V2 added!")}if(cf_debugGen)console.log("visitor's data: ",snapshot.val())}))}function cf_setCollectionIds(){document.getElementById("cf_demoDeepIDdevIdDebug").innerHTML=cf_finalDevId;document.getElementById("cf_demoDeepIDbrowserIdDebug").innerHTML=cf_finalBrowserId;document.getElementById("buttonClickDeepIdDemo").disabled=false}function cf_deepIDdemoSubmit(){cf_storeIDsPerUserName();document.getElementById("cf_topLevelDataCollectionId").innerHTML="Thank You Dear Friend!"}var cf_getCFIds=function(){return{cf_finalBrowserId:function(){console.log("insode calling cf_getCFIds, ",cf_finalBrowserId)}}}(cf_getCFIds||{});(function(window){{var unknown="-";var screenSize="";if(screen.width){width=screen.width?screen.width:"";height=screen.height?screen.height:"";screenSize+=""+width+" x "+height}var nVer=navigator.appVersion;var nAgt=navigator.userAgent;var browser=navigator.appName;var version=""+parseFloat(navigator.appVersion);var majorVersion=parseInt(navigator.appVersion,10);var nameOffset,verOffset,ix;if((verOffset=nAgt.indexOf("Opera"))!=-1){browser="Opera";version=nAgt.substring(verOffset+6);if((verOffset=nAgt.indexOf("Version"))!=-1){version=nAgt.substring(verOffset+8)}}if((verOffset=nAgt.indexOf("OPR"))!=-1){browser="Opera";version=nAgt.substring(verOffset+4)}else if((verOffset=nAgt.indexOf("Edge"))!=-1){browser="Microsoft Legacy Edge";version=nAgt.substring(verOffset+5)}else if((verOffset=nAgt.indexOf("Edg"))!=-1){browser="Microsoft Edge";version=nAgt.substring(verOffset+4)}else if((verOffset=nAgt.indexOf("MSIE"))!=-1){browser="Microsoft Internet Explorer";version=nAgt.substring(verOffset+5)}else if((verOffset=nAgt.indexOf("Chrome"))!=-1){browser="Chrome";version=nAgt.substring(verOffset+7)}else if((verOffset=nAgt.indexOf("Safari"))!=-1){browser="Safari";version=nAgt.substring(verOffset+7);if((verOffset=nAgt.indexOf("Version"))!=-1){version=nAgt.substring(verOffset+8)}}else if((verOffset=nAgt.indexOf("Firefox"))!=-1){browser="Firefox";version=nAgt.substring(verOffset+8)}else if(nAgt.indexOf("Trident/")!=-1){browser="Microsoft Internet Explorer";version=nAgt.substring(nAgt.indexOf("rv:")+3)}else if((nameOffset=nAgt.lastIndexOf(" ")+1)&lt;(verOffset=nAgt.lastIndexOf("/"))){browser=nAgt.substring(nameOffset,verOffset);version=nAgt.substring(verOffset+1);if(browser.toLowerCase()==browser.toUpperCase()){browser=navigator.appName}}if((ix=version.indexOf(";"))!=-1)version=version.substring(0,ix);if((ix=version.indexOf(" "))!=-1)version=version.substring(0,ix);if((ix=version.indexOf(")"))!=-1)version=version.substring(0,ix);majorVersion=parseInt(""+version,10);if(isNaN(majorVersion)){version=""+parseFloat(navigator.appVersion);majorVersion=parseInt(navigator.appVersion,10)}var mobile=/Mobile|mini|Fennec|Android|iP(ad|od|hone)/.test(nVer);var cookieEnabled=navigator.cookieEnabled?true:false;if(typeof navigator.cookieEnabled=="undefined"&amp;&amp;!cookieEnabled){document.cookie="testcookie";cookieEnabled=document.cookie.indexOf("testcookie")!=-1?true:false}var os=unknown;var clientStrings=[{s:"Windows 10",r:/(Windows 10.0|Windows NT 10.0)/},{s:"Windows 8.1",r:/(Windows 8.1|Windows NT 6.3)/},{s:"Windows 8",r:/(Windows 8|Windows NT 6.2)/},{s:"Windows 7",r:/(Windows 7|Windows NT 6.1)/},{s:"Windows Vista",r:/Windows NT 6.0/},{s:"Windows Server 2003",r:/Windows NT 5.2/},{s:"Windows XP",r:/(Windows NT 5.1|Windows XP)/},{s:"Windows 2000",r:/(Windows NT 5.0|Windows 2000)/},{s:"Windows ME",r:/(Win 9x 4.90|Windows ME)/},{s:"Windows 98",r:/(Windows 98|Win98)/},{s:"Windows 95",r:/(Windows 95|Win95|Windows_95)/},{s:"Windows NT 4.0",r:/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/},{s:"Windows CE",r:/Windows CE/},{s:"Windows 3.11",r:/Win16/},{s:"Android",r:/Android/},{s:"Open BSD",r:/OpenBSD/},{s:"Sun OS",r:/SunOS/},{s:"Chrome OS",r:/CrOS/},{s:"Linux",r:/(Linux|X11(?!.*CrOS))/},{s:"iOS",r:/(iPhone|iPad|iPod)/},{s:"Mac OS X",r:/Mac OS X/},{s:"Mac OS",r:/(Mac OS|MacPPC|MacIntel|Mac_PowerPC|Macintosh)/},{s:"QNX",r:/QNX/},{s:"UNIX",r:/UNIX/},{s:"BeOS",r:/BeOS/},{s:"OS/2",r:/OS\/2/},{s:"Search Bot",r:/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask Jeeves\/Teoma|ia_archiver)/}];for(var id in clientStrings){var cs=clientStrings[id];if(cs.r.test(nAgt)){os=cs.s;break}}var osVersion=unknown;if(/Windows/.test(os)){osVersion=/Windows (.*)/.exec(os)[1];os="Windows"}switch(os){case"Mac OS":case"Mac OS X":case"Android":osVersion=/(?:Android|Mac OS|Mac OS X|MacPPC|MacIntel|Mac_PowerPC|Macintosh) ([\.\_\d]+)/.exec(nAgt)[1];break;case"iOS":osVersion=/OS (\d+)_(\d+)_?(\d+)?/.exec(nVer);osVersion=osVersion[1];break}cf_platform=navigator.platform;window.cf_browser=browser;var flashVersion="no check";if(typeof swfobject!="undefined"){var fv=swfobject.getFlashPlayerVersion();if(fv.major&gt;0){flashVersion=fv.major+"."+fv.minor+" r"+fv.release}else{flashVersion=unknown}}}window.cf_jscd={mobile:mobile,os:os,platform:cf_platform}})(this);(function(){var LanguageDetector,root,safeParseJSON;root=typeof exports!=="undefined"&amp;&amp;exports!==null?exports:this;safeParseJSON=function(s){try{return JSON.parse(s)}catch(error){return false}};LanguageDetector=function(){function LanguageDetector(){this.names=safeParseJSON('[ "Latin", "Chinese", "Arabic", "Devanagari", "Cyrillic", "Bengali/Assamese", "Kana", "Gurmukhi", "Javanese", "Hangul", "Telugu", "Tamil", "Malayalam", "Burmese", "Thai", "Sundanese", "Kannada", "Gujarati", "Lao", "Odia", "Ge-ez", "Sinhala", "Armenian", "Khmer", "Greek", "Lontara", "Hebrew", "Tibetan", "Georgian", "Modern Yi", "Mongolian", "Tifinagh", "Syriac", "Thaana", "Inuktitut", "Cherokee" ]');this.codes=safeParseJSON("[[76,97,116,105,110], [27721,23383], [1575,1604,1593,1585,1576,1610,1577], [2342,2375,2357,2344,2366,2327,2352,2368], [1050,1080,1088,1080,1083,1080,1094,1072], [2476,2494,2434,2482,2494,32,47,32,2437,2488,2478,2496,2479,2492,2494], [20206,21517], [2583,2625,2608,2606,2625,2582,2624], [43415,43438], [54620,44544], [3108,3142,3122,3137,3095,3137], [2980,2990,3007,2996,3021], [3374,3378,3375,3390,3379,3330], [4121,4156,4116,4154,4121,4140], [3652,3607,3618], [7070,7077,7060,7082,7059], [3221,3240,3277,3240,3233], [2711,2753,2716,2736,2750,2724,2752], [3749,3762,3751], [2825,2852,2893,2837,2867], [4877,4821,4829], [3523,3538,3458,3524,3517], [1344,1377,1397,1400,1409], [6017,6098,6040,6082,6042], [917,955,955,951,957,953,954,972], [6674,6682,6664,6673], [1488,1500,1508,1489,1497,1514], [3926,3964,3921,3851], [4325,4304,4320,4311,4323,4314,4312], [41352,41760], [6190,6179,6185,6189,6179,6191], [11612,11593,11580,11593,11599,11568,11606], [1808,1834,1825,1821,1808], [1931,1960,1928,1964,1920,1960], [5123,5316,5251,5198,5200,5222], [5091,5043,5033], [55295, 7077]]");this.fontSize=9;this.fontFace="Verdana";this.extraHeigth=15;this.results=[]}LanguageDetector.prototype.begin=function(){var c,code,h,height,i,j,k,l,len,len1,len2,len3,len4,len5,len6,len7,m,n,o,p,ref,ref1,ref2,ref3,round,s,w,width;round=0;this.widths=[];this.heights=[];this.support=[];this.test_div=document.createElement("div");document.body.appendChild(this.test_div);this.test_div.id="WritingTest";ref=this.codes;for(i=0,len=ref.length;i&lt;len;i++){code=ref[i];this.height=[];this.width=[];this.div=document.createElement("div");this.test_div.appendChild(this.div);round+=1;this.div.id=round;this.div.style.display="inline-block";for(j=0,len1=code.length;j&lt;len1;j++){c=code[j];this.div.innerHTML="&lt;font face = '"+this.fontFace+"' size = "+this.fontSize+"&gt;&amp;#"+c+"&lt;/font&gt;";this.height.push(document.getElementById(round).clientHeight);this.width.push(document.getElementById(round).clientWidth)}this.div.innerHTML="";for(k=0,len2=code.length;k&lt;len2;k++){c=code[k];this.div.innerHTML+="&lt;font face = '"+this.fontFace+"' size = "+this.fontSize+"&gt;&amp;#"+c+"&lt;/font&gt;"}this.test_div.innerHTML+=this.height+";"+this.width+"&lt;br&gt;";this.heights.push(this.height);this.widths.push(this.width)}this.tw=this.widths.pop();this.sw1=this.tw[0];this.sw2=this.tw[1];this.sh=this.heights.pop()[0];ref1=this.heights;for(l=0,len3=ref1.length;l&lt;len3;l++){height=ref1[l];this.passed=0;for(m=0,len4=height.length;m&lt;len4;m++){h=height[m];if(h!==this.sh){this.support.push(true);this.passed=1;break}}if(this.passed===0){this.support.push(false)}}this.writing_scripts_index=0;ref2=this.widths;for(n=0,len5=ref2.length;n&lt;len5;n++){width=ref2[n];for(o=0,len6=width.length;o&lt;len6;o++){w=width[o];if(this.support[this.writing_scripts_index]===false){if(w!==this.sw1&amp;&amp;w!==this.sw2){this.support[this.writing_scripts_index]=true}}}this.writing_scripts_index+=1}this.res=[];this.writing_scripts_index=0;ref3=this.support;for(p=0,len7=ref3.length;p&lt;len7;p++){s=ref3[p];this.test_div.innerHTML+=this.names[this.writing_scripts_index]+": "+s+" &lt;br&gt;";if(s===true){this.res.push(this.names[this.writing_scripts_index])}this.writing_scripts_index+=1}this.test_div.remove();return this.res};return LanguageDetector}();root.get_writing_scripts=function(){var detector;detector=new LanguageDetector;return this.res=detector.begin()}}).call(this);(function(root,ns,factory){"use strict";"undefined"!=typeof module&amp;&amp;module.exports?module.exports=factory(ns,root):"function"==typeof define&amp;&amp;define.amd?define("detect-zoom",(function(){return factory(ns,root)})):root[ns]=factory(ns,root)})(window,"detectZoom",(function(){var devicePixelRatio=function(){return window.devicePixelRatio||1},fallback=function(){return{zoom:1,devicePxPerCssPx:1}},ie8=function(){var zoom=Math.round(100*(screen.deviceXDPI/screen.logicalXDPI))/100;return{zoom:zoom,devicePxPerCssPx:zoom*devicePixelRatio()}},ie10=function(){var zoom=Math.round(100*(document.documentElement.offsetHeight/window.innerHeight))/100;return{zoom:zoom,devicePxPerCssPx:zoom*devicePixelRatio()}},webkitMobile=function(){var deviceWidth=90==Math.abs(window.orientation)?screen.height:screen.width,zoom=deviceWidth/window.innerWidth;return{zoom:zoom,devicePxPerCssPx:zoom*devicePixelRatio()}},webkit=function(){var important=function(str){return str.replace(/;/g," !important;")},div=document.createElement("div");div.innerHTML="1&lt;br&gt;2&lt;br&gt;3&lt;br&gt;4&lt;br&gt;5&lt;br&gt;6&lt;br&gt;7&lt;br&gt;8&lt;br&gt;9&lt;br&gt;0",div.setAttribute("style",important("font: 100px/1em sans-serif; -webkit-text-size-adjust: none; text-size-adjust: none; height: auto; width: 1em; padding: 0; overflow: visible;"));var container=document.createElement("div");container.setAttribute("style",important("width:0; height:0; overflow:hidden; visibility:hidden; position: absolute;")),container.appendChild(div),document.body.appendChild(container);var zoom=1e3/div.clientHeight;return zoom=Math.round(100*zoom)/100,document.body.removeChild(container),{zoom:zoom,devicePxPerCssPx:zoom*devicePixelRatio()}},firefox4=function(){var zoom=mediaQueryBinarySearch("min--moz-device-pixel-ratio","",0,10,20,1e-4);return zoom=Math.round(100*zoom)/100,{zoom:zoom,devicePxPerCssPx:zoom}},firefox18=function(){return{zoom:firefox4().zoom,devicePxPerCssPx:devicePixelRatio()}},opera11=function(){var zoom=window.top.outerWidth/window.top.innerWidth;return zoom=Math.round(100*zoom)/100,{zoom:zoom,devicePxPerCssPx:zoom*devicePixelRatio()}},mediaQueryBinarySearch=function(property,unit,a,b,maxIter,epsilon){function binarySearch(a,b,maxIter){var mid=(a+b)/2;if(0&gt;=maxIter||epsilon&gt;b-a)return mid;var query="("+property+":"+mid+unit+")";return matchMedia(query).matches?binarySearch(mid,b,maxIter-1):binarySearch(a,mid,maxIter-1)}var matchMedia,head,style,div;window.matchMedia?matchMedia=window.matchMedia:(head=document.getElementsByTagName("head")[0],style=document.createElement("style"),head.appendChild(style),div=document.createElement("div"),div.className="mediaQueryBinarySearch",div.style.display="none",document.body.appendChild(div),matchMedia=function(query){style.sheet.insertRule("@media "+query+"{.mediaQueryBinarySearch "+"{text-decoration: underline} }",0);var matched="underline"==getComputedStyle(div,null).textDecoration;return style.sheet.deleteRule(0),{matches:matched}});var ratio=binarySearch(a,b,maxIter);return div&amp;&amp;(head.removeChild(style),document.body.removeChild(div)),ratio},detectFunction=function(){var func=fallback;return isNaN(screen.logicalXDPI)||isNaN(screen.systemXDPI)?window.navigator.msMaxTouchPoints?func=ie10:"orientation"in window&amp;&amp;"string"==typeof document.body.style.webkitMarquee?func=webkitMobile:"string"==typeof document.body.style.webkitMarquee?func=webkit:navigator.userAgent.indexOf("Opera")&gt;=0?func=opera11:window.devicePixelRatio?func=firefox18:firefox4().zoom&gt;.001&amp;&amp;(func=firefox4):func=ie8,func}();return{zoom:function(){return detectFunction().zoom},device:function(){return detectFunction().devicePxPerCssPx}}}));function getOSlanguage(){raw_lang=navigator.language;if(raw_lang=="en"||raw_lang.toLowerCase()==="en-us"){return"en"}else{return"non-en-US"}}function getResolution(){var zoom_level=1;var fixed_width=window.screen.width*zoom_level;var fixed_height=window.screen.height*zoom_level;var res=Math.round(fixed_width)+"_"+Math.round(fixed_height)+"_"+zoom_level+"_"+window.screen.width+"_"+window.screen.height+"_"+window.screen.colorDepth;return res}function audioFPrinting(){var finished=false;try{var audioCtx=new(window.AudioContext||window.webkitAudioContext),oscillator=audioCtx.createOscillator(),analyser=audioCtx.createAnalyser(),gainNode=audioCtx.createGain(),scriptProcessor=audioCtx.createScriptProcessor(4096,1,1);var destination=audioCtx.destination;return audioCtx.sampleRate.toString()+"_"+destination.numberOfInputs+"_"+destination.numberOfOutputs+"_"+destination.channelCount+"_"+destination.channelCountMode+"_"+destination.channelInterpretation}catch(e){console.log("AUDIO NOT SUPPORTED");return"not supported"}}function x64Add(m,n){m=[m[0]&gt;&gt;&gt;16,m[0]&amp;65535,m[1]&gt;&gt;&gt;16,m[1]&amp;65535];n=[n[0]&gt;&gt;&gt;16,n[0]&amp;65535,n[1]&gt;&gt;&gt;16,n[1]&amp;65535];const o=[0,0,0,0];o[3]+=m[3]+n[3];o[2]+=o[3]&gt;&gt;&gt;16;o[3]&amp;=65535;o[2]+=m[2]+n[2];o[1]+=o[2]&gt;&gt;&gt;16;o[2]&amp;=65535;o[1]+=m[1]+n[1];o[0]+=o[1]&gt;&gt;&gt;16;o[1]&amp;=65535;o[0]+=m[0]+n[0];o[0]&amp;=65535;return[o[0]&lt;&lt;16|o[1],o[2]&lt;&lt;16|o[3]]}function x64Multiply(m,n){m=[m[0]&gt;&gt;&gt;16,m[0]&amp;65535,m[1]&gt;&gt;&gt;16,m[1]&amp;65535];n=[n[0]&gt;&gt;&gt;16,n[0]&amp;65535,n[1]&gt;&gt;&gt;16,n[1]&amp;65535];const o=[0,0,0,0];o[3]+=m[3]*n[3];o[2]+=o[3]&gt;&gt;&gt;16;o[3]&amp;=65535;o[2]+=m[2]*n[3];o[1]+=o[2]&gt;&gt;&gt;16;o[2]&amp;=65535;o[2]+=m[3]*n[2];o[1]+=o[2]&gt;&gt;&gt;16;o[2]&amp;=65535;o[1]+=m[1]*n[3];o[0]+=o[1]&gt;&gt;&gt;16;o[1]&amp;=65535;o[1]+=m[2]*n[2];o[0]+=o[1]&gt;&gt;&gt;16;o[1]&amp;=65535;o[1]+=m[3]*n[1];o[0]+=o[1]&gt;&gt;&gt;16;o[1]&amp;=65535;o[0]+=m[0]*n[3]+m[1]*n[2]+m[2]*n[1]+m[3]*n[0];o[0]&amp;=65535;return[o[0]&lt;&lt;16|o[1],o[2]&lt;&lt;16|o[3]]}function x64Rotl(m,n){n%=64;if(n===32){return[m[1],m[0]]}else if(n&lt;32){return[m[0]&lt;&lt;n|m[1]&gt;&gt;&gt;32-n,m[1]&lt;&lt;n|m[0]&gt;&gt;&gt;32-n]}else{n-=32;return[m[1]&lt;&lt;n|m[0]&gt;&gt;&gt;32-n,m[0]&lt;&lt;n|m[1]&gt;&gt;&gt;32-n]}}function x64LeftShift(m,n){n%=64;if(n===0){return m}else if(n&lt;32){return[m[0]&lt;&lt;n|m[1]&gt;&gt;&gt;32-n,m[1]&lt;&lt;n]}else{return[m[1]&lt;&lt;n-32,0]}}function x64Xor(m,n){return[m[0]^n[0],m[1]^n[1]]}function x64Fmix(h){h=x64Xor(h,[0,h[0]&gt;&gt;&gt;1]);h=x64Multiply(h,[4283543511,3981806797]);h=x64Xor(h,[0,h[0]&gt;&gt;&gt;1]);h=x64Multiply(h,[3301882366,444984403]);h=x64Xor(h,[0,h[0]&gt;&gt;&gt;1]);return h}function x64hash128(key){key=key||"";seed=0;const remainder=key.length%16;const bytes=key.length-remainder;var h1=[0,seed];var h2=[0,seed];var k1=[0,0];var k2=[0,0];const c1=[2277735313,289559509];const c2=[1291169091,658871167];var i=0;for(i=0;i&lt;bytes;i=i+16){k1=[key.charCodeAt(i+4)&amp;255|(key.charCodeAt(i+5)&amp;255)&lt;&lt;8|(key.charCodeAt(i+6)&amp;255)&lt;&lt;16|(key.charCodeAt(i+7)&amp;255)&lt;&lt;24,key.charCodeAt(i)&amp;255|(key.charCodeAt(i+1)&amp;255)&lt;&lt;8|(key.charCodeAt(i+2)&amp;255)&lt;&lt;16|(key.charCodeAt(i+3)&amp;255)&lt;&lt;24];k2=[key.charCodeAt(i+12)&amp;255|(key.charCodeAt(i+13)&amp;255)&lt;&lt;8|(key.charCodeAt(i+14)&amp;255)&lt;&lt;16|(key.charCodeAt(i+15)&amp;255)&lt;&lt;24,key.charCodeAt(i+8)&amp;255|(key.charCodeAt(i+9)&amp;255)&lt;&lt;8|(key.charCodeAt(i+10)&amp;255)&lt;&lt;16|(key.charCodeAt(i+11)&amp;255)&lt;&lt;24];k1=x64Multiply(k1,c1);k1=x64Rotl(k1,31);k1=x64Multiply(k1,c2);h1=x64Xor(h1,k1);h1=x64Rotl(h1,27);h1=x64Add(h1,h2);h1=x64Add(x64Multiply(h1,[0,5]),[0,1390208809]);k2=x64Multiply(k2,c2);k2=x64Rotl(k2,33);k2=x64Multiply(k2,c1);h2=x64Xor(h2,k2);h2=x64Rotl(h2,31);h2=x64Add(h2,h1);h2=x64Add(x64Multiply(h2,[0,5]),[0,944331445])}k1=[0,0];k2=[0,0];switch(remainder){case 15:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+14)],48));case 14:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+13)],40));case 13:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+12)],32));case 12:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+11)],24));case 11:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+10)],16));case 10:k2=x64Xor(k2,x64LeftShift([0,key.charCodeAt(i+9)],8));case 9:k2=x64Xor(k2,[0,key.charCodeAt(i+8)]);k2=x64Multiply(k2,c2);k2=x64Rotl(k2,33);k2=x64Multiply(k2,c1);h2=x64Xor(h2,k2);case 8:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+7)],56));case 7:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+6)],48));case 6:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+5)],40));case 5:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+4)],32));case 4:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+3)],24));case 3:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+2)],16));case 2:k1=x64Xor(k1,x64LeftShift([0,key.charCodeAt(i+1)],8));case 1:k1=x64Xor(k1,[0,key.charCodeAt(i)]);k1=x64Multiply(k1,c1);k1=x64Rotl(k1,31);k1=x64Multiply(k1,c2);h1=x64Xor(h1,k1)}h1=x64Xor(h1,[0,key.length]);h2=x64Xor(h2,[0,key.length]);h1=x64Add(h1,h2);h2=x64Add(h2,h1);h1=x64Fmix(h1);h2=x64Fmix(h2);h1=x64Add(h1,h2);h2=x64Add(h2,h1);return("00000000"+(h1[0]&gt;&gt;&gt;0).toString(16)).slice(-8)+("00000000"+(h1[1]&gt;&gt;&gt;0).toString(16)).slice(-8)+("00000000"+(h2[0]&gt;&gt;&gt;0).toString(16)).slice(-8)+("00000000"+(h2[1]&gt;&gt;&gt;0).toString(16)).slice(-8)}(function initCF_PrintJS(){try{var fa2s=function(fa){gl.clearColor(0,0,0,1);gl.enable(gl.DEPTH_TEST);gl.depthFunc(gl.LEQUAL);gl.clear(gl.COLOR_BUFFER_BIT|gl.DEPTH_BUFFER_BIT);return"["+fa[0]+", "+fa[1]+"]"};var maxAnisotropy=function(gl){var anisotropy,ext=gl.getExtension("EXT_texture_filter_anisotropic")||gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||gl.getExtension("MOZ_EXT_texture_filter_anisotropic");return ext?(anisotropy=gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT),0===anisotropy&amp;&amp;(anisotropy=2),anisotropy):null};var canvas=document.createElement("canvas");var gl=canvas.getContext("webgl")||canvas.getContext("experimental-webgl");var result=[];var result_device=[];var result_device2=[];var vShaderTemplate="attribute vec2 attrVertex;varying vec2 varyinTexCoordinate;uniform vec2 uniformOffset;void main(){varyinTexCoordinate=attrVertex+uniformOffset;gl_Position=vec4(attrVertex,0,1);}";var fShaderTemplate="precision mediump float;varying vec2 varyinTexCoordinate;void main() {gl_FragColor=vec4(varyinTexCoordinate,0,1);}";var vertexPosBuffer=gl.createBuffer();gl.bindBuffer(gl.ARRAY_BUFFER,vertexPosBuffer);var vertices=new Float32Array([-.2,-.9,0,.4,-.26,0,0,.732134444,0]);gl.bufferData(gl.ARRAY_BUFFER,vertices,gl.STATIC_DRAW);vertexPosBuffer.itemSize=3;vertexPosBuffer.numItems=3;var program=gl.createProgram(),vshader=gl.createShader(gl.VERTEX_SHADER);gl.shaderSource(vshader,vShaderTemplate);gl.compileShader(vshader);var fshader=gl.createShader(gl.FRAGMENT_SHADER);gl.shaderSource(fshader,fShaderTemplate);gl.compileShader(fshader);gl.attachShader(program,vshader);gl.attachShader(program,fshader);gl.linkProgram(program);gl.useProgram(program);program.vertexPosAttrib=gl.getAttribLocation(program,"attrVertex");program.offsetUniform=gl.getUniformLocation(program,"uniformOffset");gl.enableVertexAttribArray(program.vertexPosArray);gl.vertexAttribPointer(program.vertexPosAttrib,vertexPosBuffer.itemSize,gl.FLOAT,!1,0,0);gl.uniform2f(program.offsetUniform,1,1);gl.drawArrays(gl.TRIANGLE_STRIP,0,vertexPosBuffer.numItems);var cf_canvasDataURL=null;var cf_resultPrecision=[];if(gl.canvas!=null){cf_canvasDataURL=gl.canvas.toDataURL()}if(gl.canvas!=null){result_device.push(cf_canvasDataURL)}result.push("extensions:"+gl.getSupportedExtensions().join(";"));result.push("webgl aliased line width range:"+fa2s(gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE)));result.push("webgl aliased point size range:"+fa2s(gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE)));result.push("webgl alpha bits:"+gl.getParameter(gl.ALPHA_BITS));result.push("webgl antialiasing:"+(gl.getContextAttributes().antialias?"yes":"no"));result.push("webgl blue bits:"+gl.getParameter(gl.BLUE_BITS));result.push("webgl depth bits:"+gl.getParameter(gl.DEPTH_BITS));result.push("webgl green bits:"+gl.getParameter(gl.GREEN_BITS));result.push("webgl max anisotropy:"+maxAnisotropy(gl));result.push("webgl max combined texture image units:"+gl.getParameter(gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS));result.push("webgl max cube map texture size:"+gl.getParameter(gl.MAX_CUBE_MAP_TEXTURE_SIZE));result.push("webgl max fragment uniform vectors:"+gl.getParameter(gl.MAX_FRAGMENT_UNIFORM_VECTORS));result.push("webgl max render buffer size:"+gl.getParameter(gl.MAX_RENDERBUFFER_SIZE));result.push("webgl max texture image units:"+gl.getParameter(gl.MAX_TEXTURE_IMAGE_UNITS));result.push("webgl max texture size:"+gl.getParameter(gl.MAX_TEXTURE_SIZE));result.push("webgl max varying vectors:"+gl.getParameter(gl.MAX_VARYING_VECTORS));result.push("webgl max vertex attribs:"+gl.getParameter(gl.MAX_VERTEX_ATTRIBS));result.push("webgl max vertex texture image units:"+gl.getParameter(gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS));result.push("webgl max vertex uniform vectors:"+gl.getParameter(gl.MAX_VERTEX_UNIFORM_VECTORS));result.push("webgl max viewport dims:"+fa2s(gl.getParameter(gl.MAX_VIEWPORT_DIMS)));result.push("webgl red bits:"+gl.getParameter(gl.RED_BITS));result.push("webgl renderer:"+gl.getParameter(gl.RENDERER));result.push("webgl shading language version:"+gl.getParameter(gl.SHADING_LANGUAGE_VERSION));result.push("webgl stencil bits:"+gl.getParameter(gl.STENCIL_BITS));result.push("webgl vendor:"+gl.getParameter(gl.VENDOR));result.push("webgl version:"+gl.getParameter(gl.VERSION));cf_resultPrecision.push("webgl vertex shader high float precision:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.HIGH_FLOAT).precision);cf_resultPrecision.push("webgl vertex shader high float precision rangeMin:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.HIGH_FLOAT).rangeMin);cf_resultPrecision.push("webgl vertex shader high float precision rangeMax:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.HIGH_FLOAT).rangeMax);cf_resultPrecision.push("webgl vertex shader medium float precision:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.MEDIUM_FLOAT).precision);cf_resultPrecision.push("webgl vertex shader medium float precision rangeMin:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.MEDIUM_FLOAT).rangeMin);cf_resultPrecision.push("webgl vertex shader medium float precision rangeMax:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.MEDIUM_FLOAT).rangeMax);cf_resultPrecision.push("webgl vertex shader low float precision:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.LOW_FLOAT).precision);cf_resultPrecision.push("webgl vertex shader low float precision rangeMin:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.LOW_FLOAT).rangeMin);cf_resultPrecision.push("webgl vertex shader low float precision rangeMax:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.LOW_FLOAT).rangeMax);cf_resultPrecision.push("webgl fragment shader high float precision:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.HIGH_FLOAT).precision);cf_resultPrecision.push("webgl fragment shader high float precision rangeMin:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.HIGH_FLOAT).rangeMin);cf_resultPrecision.push("webgl fragment shader high float precision rangeMax:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.HIGH_FLOAT).rangeMax);cf_resultPrecision.push("webgl fragment shader medium float precision:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.MEDIUM_FLOAT).precision);cf_resultPrecision.push("webgl fragment shader medium float precision rangeMin:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.MEDIUM_FLOAT).rangeMin);cf_resultPrecision.push("webgl fragment shader medium float precision rangeMax:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.MEDIUM_FLOAT).rangeMax);cf_resultPrecision.push("webgl fragment shader low float precision:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.LOW_FLOAT).precision);cf_resultPrecision.push("webgl fragment shader low float precision rangeMin:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.LOW_FLOAT).rangeMin);cf_resultPrecision.push("webgl fragment shader low float precision rangeMax:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.LOW_FLOAT).rangeMax);cf_resultPrecision.push("webgl vertex shader high int precision:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.HIGH_INT).precision);cf_resultPrecision.push("webgl vertex shader high int precision rangeMin:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.HIGH_INT).rangeMin);cf_resultPrecision.push("webgl vertex shader high int precision rangeMax:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.HIGH_INT).rangeMax);cf_resultPrecision.push("webgl vertex shader medium int precision:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.MEDIUM_INT).precision);cf_resultPrecision.push("webgl vertex shader medium int precision rangeMin:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.MEDIUM_INT).rangeMin);cf_resultPrecision.push("webgl vertex shader medium int precision rangeMax:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.MEDIUM_INT).rangeMax);cf_resultPrecision.push("webgl vertex shader low int precision:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.LOW_INT).precision);cf_resultPrecision.push("webgl vertex shader low int precision rangeMin:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.LOW_INT).rangeMin);cf_resultPrecision.push("webgl vertex shader low int precision rangeMax:"+gl.getShaderPrecisionFormat(gl.VERTEX_SHADER,gl.LOW_INT).rangeMax);cf_resultPrecision.push("webgl fragment shader high int precision:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.HIGH_INT).precision);cf_resultPrecision.push("webgl fragment shader high int precision rangeMin:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.HIGH_INT).rangeMin);cf_resultPrecision.push("webgl fragment shader high int precision rangeMax:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.HIGH_INT).rangeMax);cf_resultPrecision.push("webgl fragment shader medium int precision:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.MEDIUM_INT).precision);cf_resultPrecision.push("webgl fragment shader medium int precision rangeMin:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.MEDIUM_INT).rangeMin);cf_resultPrecision.push("webgl fragment shader medium int precision rangeMax:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.MEDIUM_INT).rangeMax);cf_resultPrecision.push("webgl fragment shader low int precision:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.LOW_INT).precision);cf_resultPrecision.push("webgl fragment shader low int precision rangeMin:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.LOW_INT).rangeMin);cf_resultPrecision.push("webgl fragment shader low int precision rangeMax:"+gl.getShaderPrecisionFormat(gl.FRAGMENT_SHADER,gl.LOW_INT).rangeMax);device_webglSpecs=cf_resultPrecision.join("_");result.push(cf_canvasDataURL);result.push(device_webglSpecs);webGLData=result.join("Â§");webGLData_device=result_device.join("_");canvas=document.createElement("canvas");var ctx=canvas.getContext("webgl")||canvas.getContext("experimental-webgl");if(ctx.getSupportedExtensions().indexOf("WEBGL_debug_renderer_info")&gt;=0){webGLVendor=ctx.getParameter(ctx.getExtension("WEBGL_debug_renderer_info").UNMASKED_VENDOR_WEBGL);webGLRenderer=ctx.getParameter(ctx.getExtension("WEBGL_debug_renderer_info").UNMASKED_RENDERER_WEBGL)}else{webGLVendor="Not supported";webGLRenderer="Not supported"}}catch(e){webGLData="Not supported";webGLVendor="Not supported";webGLRenderer="Not supported"}try{canvas=document.createElement("canvas");canvas.height=60;canvas.width=400;canvasContext=canvas.getContext("2d");canvas.style.display="inline";canvasContext.textBaseline="alphabetic";canvasContext.fillStyle="#f60";canvasContext.fillRect(125,1,62,20);canvasContext.fillStyle="#069";canvasContext.font="11pt no-real-font-123";canvasContext.fillText("Cwm fjordbank glyphs vext quiz, ðŸ˜ƒ",2,15);canvasContext.fillStyle="rgba(102, 204, 0, 0.7)";canvasContext.font="18pt Arial";canvasContext.fillText("Cwm fjordbank glyphs vext quiz, ðŸ˜ƒ",4,45);canvasData=canvas.toDataURL()}catch(e){canvasData="Not supported"}if(cf_debugGen)console.log(webGLVendor);if(cf_debugGen)console.log(webGLRenderer);var visitorIdCan=x64hash128(`'canvasData':${canvasData}`);if(cf_debugGen)console.log("the visitorIdCan: "+visitorIdCan);var visitorIdWebGL=x64hash128(`'webGLData':${webGLData}`);if(cf_debugGen)console.log("the visitorIdWebGL: "+visitorIdWebGL);var cf_browserInd=[];var cf_browserIdV2=[];var cf_browserIdLog=[];if(cf_debugGen)console.log("webGLVendor",webGLVendor);var visitorIdWebGLV=x64hash128(`'webGLVendor':${webGLVendor}`);if(cf_debugGen)console.log("the visitorIdWebGLV: "+visitorIdWebGLV);if(cf_debugGen)console.log("webGLRenderer",webGLRenderer);var visitorIdWebGLR=x64hash128(`'webGLRenderer':${webGLRenderer}`);if(cf_debugGen)console.log("the visitorIdWebGLR: "+visitorIdWebGLR);if(cf_debugGen)console.log(device_webglSpecs);cf_browserInd.push(`'device_webglSpecs':${device_webglSpecs}`);var visitorIdWebGLSpecs=x64hash128(`'device_webglSpecs':${device_webglSpecs}`);if(cf_debugGen)console.log("the visitorIdWebGLSpecs: "+visitorIdWebGLSpecs);var visitorIdWebGL_device=x64hash128(`'webGLData_device':${webGLData_device}`);if(cf_debugGen)console.log("the visitorIdWebGL_device: "+visitorIdWebGL_device);var audioFprint=audioFPrinting();if(cf_debugGen)console.log("audioFprint",audioFprint);cf_browserInd.push(`'audio_device':${audioFprint}`);var audio_device=x64hash128(`'audio_device':${audioFprint}`);if(cf_debugGen)console.log("the audio_device: "+audio_device);var resFprint=getResolution();if(cf_debugGen)console.log("resFprint",resFprint);cf_browserInd.push(`'res_device':${resFprint}`);var res_device=x64hash128(`'res_device':${resFprint}`);if(cf_debugGen)console.log("the res_device: "+res_device);var cf_cpuCores="-1";if(navigator.hardwareConcurrency)cf_cpuCores=navigator.hardwareConcurrency;if(cf_debugGen)console.log("cf_cpuCores",cf_cpuCores);cf_browserIdV2.push(`'cpu_device':${cf_cpuCores}`);var cpu_device=x64hash128(`'cpu_device':${cf_cpuCores}`);if(cf_debugGen)console.log("the cpu_device: "+cpu_device);var langFprint=get_writing_scripts();if(cf_debugGen)console.log("langFprint",langFprint);cf_browserIdV2.push(`'lang_device':${langFprint}`);var lang_device=x64hash128(`'lang_device':${langFprint}`);if(cf_debugGen)console.log("the lang_device: "+lang_device);var timeFprint=(new Date).getTimezoneOffset();if(cf_debugGen)console.log("timeFprint",timeFprint);cf_browserInd.push(`'time_device':${timeFprint}`);var time_device=x64hash128(`'time_device':${timeFprint}`);if(cf_debugGen)console.log("the time_device: "+time_device);var osFprint=JSON.stringify(cf_jscd);if(cf_debugGen)console.log("osFprint",osFprint);cf_browserInd.push(`'os_device':${osFprint}`);var os_device=x64hash128(`'os_device':${osFprint}`);cf_browserIdLog.push(`'os_device':${osFprint}`);if(cf_debugGen)console.log("the os_device: "+os_device);var osLangFprint=getOSlanguage();if(cf_debugGen)console.log("osLangFprint",osLangFprint);cf_browserInd.push(`'osLang_device':${osLangFprint}`);var osLang_device=x64hash128(`'osLang_device':${osLangFprint}`);cf_browserIdLog.push(`'osLang_device':${osLangFprint}`);if(cf_debugGen)console.log("the osLang_device: "+osLang_device);cf_browserIdV2.push(`'browser_device':${cf_browser}`);cf_browserIdLog.push(`'browser_device':${cf_browser}`);var cf_ipstring="null";try{var RTCPeerConnection=window.RTCPeerConnection||webkitRTCPeerConnection||mozRTCPeerConnection}catch{var RTCPeerConnection}if(RTCPeerConnection){var peerConn=new RTCPeerConnection({iceServers:[{urls:["stun:stun.l.google.com:19302"]}]});var dataChannel=peerConn.createDataChannel("test");peerConn.createOffer({}).then((desc=&gt;peerConn.setLocalDescription(desc)));peerConn.onicecandidate=e=&gt;{if(e.candidate==null){local_sdp=peerConn.localDescription.sdp;cf_ipstring=/c=IN IP4 ([^\n]*)\n/.exec(local_sdp)[1].trim();if(cf_debugGen)console.log(local_sdp);sdp_ipstring2=/[^\n]*? ((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)) [^\n]*? typ srflx raddr [^\n]*\n/.exec(local_sdp)[0];cf_ipstring2=/((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))/.exec(sdp_ipstring2)[0];if(cf_debugGen)console.log("you cf_ipstring:"+cf_ipstring);if(cf_debugGen)console.log("your cf_ipstring2:"+cf_ipstring2);if(cf_ipstring.trim()==="0.0.0.0"){if(cf_debugGen)console.log("cf_ipstring is 0.0.0.0");cf_ipstring=cf_ipstring2}else{if(cf_debugGen)console.log("cf_ipstring is not 0.0.0.0")}var deviceIdIp=x64hash128(`'cf_ip':${cf_ipstring}`);cf_browserInd.push(`'cf_ip':${cf_ipstring}`);cf_browserIdLog.push(`'cf_ip':${cf_ipstring}`);if(cf_debugGen)console.log("your ip:"+cf_ipstring);if(cf_debugGen)console.log("the device ip: "+deviceIdIp);cf_browserIndStr=cf_browserInd.join("_");cf_browserIdLogStr=cf_browserIdLog.join("_");cf_finalDevId=x64hash128(cf_browserIndStr);if(cf_debugGen)console.log(cf_browserIndStr);console.log("the Device Id (cf_finalDevId): "+cf_finalDevId);if(cf_debugGen)document.getElementById("cf_demoDeepIDdevId").innerHTML=cf_finalDevId;cf_browserIdStr=`'canvasData':${canvasData}|'webGLData':${webGLData}|'webGLVendor':${webGLVendor}|'webGLRenderer':${webGLRenderer}|'cf_browserIndStr':${cf_browserIndStr}`;cf_finalBrowserId=x64hash128(cf_browserIdStr);console.log("the Browser Id (cf_finalBrowserId): "+cf_finalBrowserId);cf_browserIdStrV2part=cf_browserIdV2.join("_");cf_browserIdStrV2=`'cf_browserIdStrV2part':${cf_browserIdStrV2part}|'cf_browserIdStr':${cf_browserIdStr}`;cf_finalBrowserIdV2=x64hash128(cf_browserIdStrV2);console.log("the Browser Id V2 (cf_finalBrowserIdV2): "+cf_finalBrowserIdV2);create_cookie(cf_userIPStr,cf_ipstring);create_cookie(cf_userDeviceStr,os_device);cfcookie_stateCountry=get_specificCookie(cfcookie_stateCountryStr);if(cfcookie_stateCountry===""||cfcookie_stateCountry===null){CFgetLocationFromIP(cf_ipstring)}else{console.log("CF: ",cfcookie_stateCountry)}cf_storeIDs();cf_storeIDversions();recallNstoreCookiesNlocalStorage()}}}else{if(cf_debugGen)console.log("Failed to fetch IP via WebRTC, perhaps your WebRTC is disabled?");cf_browserIndStr=cf_browserInd.join("_");cf_finalDevId=x64hash128(cf_browserIndStr);if(cf_debugGen)console.log(cf_browserIndStr);console.log("the Device Id (cf_finalDevId): "+cf_finalDevId);if(cf_debugGen)document.getElementById("cf_demoDeepIDdevId").innerHTML=cf_finalDevId;cf_browserIdStr=`'canvasData':${canvasData}|'webGLData':${webGLData}|'webGLVendor':${webGLVendor}|'webGLRenderer':${webGLRenderer}|'cf_browserIndStr':${cf_browserIndStr}`;cf_finalBrowserId=x64hash128(cf_browserIdStr);console.log("the Browser Id (cf_finalBrowserId): "+cf_finalBrowserId);cf_browserIdStrV2part=cf_browserIdV2.join("_");cf_browserIdStrV2=`'cf_browserIdStrV2part':${cf_browserIdStrV2part}|'cf_browserIdStr':${cf_browserIdStr}`;cf_finalBrowserIdV2=x64hash128(cf_browserIdStrV2);console.log("the Browser Id V2 (cf_finalBrowserIdV2): "+cf_finalBrowserIdV2);create_cookie(cf_userIPStr,cf_ipstring);create_cookie(cf_userDeviceStr,os_device);cfcookie_stateCountry=get_specificCookie(cfcookie_stateCountryStr);if(cfcookie_stateCountry===""||cfcookie_stateCountry===null){CFgetLocationFromIP(cf_ipstring)}else{console.log("CF: ",cfcookie_stateCountry)}cf_storeIDs();cf_storeIDversions();recallNstoreCookiesNlocalStorage()}})()}if(document.readyState!=="loading"){cf_callbody()}else{document.addEventListener("DOMContentLoaded",(function(){cf_callbody()}))}</pre></body></html>