!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase)}(this,function(Du){"use strict";try{!function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=e(Du),r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function n(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}var l=function(){return(l=Object.assign||function(e){for(var t,n=1,r=arguments.length;ns[0]&&t[1]=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function y(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||0>6|192:(55296==(64512&i)&&r+1>18|240,t[n++]=i>>12&63|128):t[n++]=i>>12|224,t[n++]=i>>6&63|128),t[n++]=63&i|128)}return t}function a(e){return e=o(e),c.encodeByteArray(e,!0)}function u(e){try{return c.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}var h={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},g=function(e,t){if(!e)throw m(t)},m=function(e){return new Error("Firebase Database ("+h.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)},c={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[],i=0;i>6,l=63&l;u||(l=64,s||(h=64)),r.push(n[o>>2],n[(3&o)<<4|a>>4],n[h],n[l])}return r.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(o(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],n=0,r=0;n>10)),t[r++]=String.fromCharCode(56320+(1023&i))):(o=e[n++],s=e[n++],t[r++]=String.fromCharCode((15&a)<<12|(63&o)<<6|63&s))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[],i=0;i>4),64!==a&&(r.push(s<<4&240|a>>2),64!==u&&r.push(a<<6&192|u))}return r},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var e=0;e=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},d=function(e){return a(e).replace(/\./g,"")};function f(e){return function e(t,n){if(!(n instanceof Object))return n;switch(n.constructor){case Date:return new Date(n.getTime());case Object:void 0===t&&(t={});break;case Array:t=[];break;default:return n}for(var r in n)n.hasOwnProperty(r)&&v(r)&&(t[r]=e(t[r],n[r]));return t}(void 0,e)}function v(e){return"__proto__"!==e}var w=(C.prototype.wrapCallback=function(n){var r=this;return function(e,t){e?r.reject(e):r.resolve(t),"function"==typeof n&&(r.promise.catch(function(){}),1===n.length?n(e):n(e,t))}},C);function C(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(e,t){n.resolve=e,n.reject=t})}function b(){return"undefined"!=typeof window&&(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test("undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:"")}function T(){return!0===h.NODE_ADMIN}var E,I="FirebaseError",S=(n(k,E=Error),k);function k(e,t,n){t=E.call(this,t)||this;return t.code=e,t.customData=n,t.name=I,Object.setPrototypeOf(t,k.prototype),Error.captureStackTrace&&Error.captureStackTrace(t,P.prototype.create),t}var P=(N.prototype.create=function(e){for(var t=[],n=1;n"})):"Error",e=this.serviceName+": "+e+" ("+o+").";return new S(o,e,i)},N);function N(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var x=/\{\$([^}]+)}/g;function R(e){return JSON.parse(e)}function O(e){return JSON.stringify(e)}function D(e){var t={},n={},r={},i="";try{var o=e.split("."),t=R(u(o[0])||""),n=R(u(o[1])||""),i=o[2],r=n.d||{};delete n.d}catch(e){}return{header:t,claims:n,data:r,signature:i}}function A(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function L(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}function M(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function F(e,t,n){var r,i={};for(r in e)Object.prototype.hasOwnProperty.call(e,r)&&(i[r]=t.call(n,e[r],r,e));return i}function q(e){for(var n=[],t=0,r=Object.entries(e);t>>31)}for(var o,s=this.chain_[0],a=this.chain_[1],u=this.chain_[2],l=this.chain_[3],h=this.chain_[4],r=0;r<80;r++)var c=r<40?r<20?(o=l^a&(u^l),1518500249):(o=a^u^l,1859775393):r<60?(o=a&u|l&(a|u),2400959708):(o=a^u^l,3395469782),i=(s<<5|s>>>27)+o+h+c+n[r]&4294967295,h=l,l=u,u=4294967295&(a<<30|a>>>2),a=s,s=i;this.chain_[0]=this.chain_[0]+s&4294967295,this.chain_[1]=this.chain_[1]+a&4294967295,this.chain_[2]=this.chain_[2]+u&4294967295,this.chain_[3]=this.chain_[3]+l&4294967295,this.chain_[4]=this.chain_[4]+h&4294967295},j.prototype.update=function(e,t){if(null!=e){for(var n=(t=void 0===t?e.length:t)-this.blockSize,r=0,i=this.buf_,o=this.inbuf_;r>i&255,++r;return e},j);function j(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(var e=1;e>6|192:(o<65536?t[n++]=o>>12|224:(t[n++]=o>>18|240,t[n++]=o>>12&63|128),t[n++]=o>>6&63|128),t[n++]=63&o|128)}return t}(e);return(e=new W).update(t),e=e.digest(),c.encodeByteArray(e)}function fe(e,t){g(!t||!0===e||!1===e,"Can't turn on custom loggers persistently."),!0===e?(Ee.logLevel=X.VERBOSE,ke=Ee.log.bind(Ee),t&&Te.set("logging_enabled",!0)):"function"==typeof e?ke=e:(ke=null,Te.remove("logging_enabled"))}function _e(){for(var e=[],t=0;t=Math.pow(2,-1022)?(n=(i=Math.min(Math.floor(Math.log(e)/Math.LN2),1023))+1023,Math.round(e*Math.pow(2,52-i)-Math.pow(2,52))):(n=0,Math.round(e/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(t?1:0),o.reverse();var a=o.join(""),u="";for(s=0;s<64;s+=8){var l=parseInt(a.substr(s,8),2).toString(16);u+=l=1===l.length?"0"+l:l}return u.toLowerCase()}function We(e,t){return"object"==typeof(t=setTimeout(e,t))&&t.unref&&t.unref(),t}var je=new RegExp("^-?(0*)\\d{1,10}$"),Ue=-2147483648,Be=2147483647,Ve=function(e){if(je.test(e)){e=Number(e);if(Ue<=e&&e<=Be)return e}return null},ze=function(e){try{e()}catch(t){setTimeout(function(){var e=t.stack||"";throw Oe("Exception was thrown by user callback.",e),t},Math.floor(0))}},He=(Qe.prototype.getToken=function(n){var r=this;return this.appCheck?this.appCheck.getToken(n):new Promise(function(e,t){setTimeout(function(){r.appCheck?r.getToken(n).then(e,t):e(null)},0)})},Qe.prototype.addTokenChangeListener=function(t){var e;null!==(e=this.appCheckProvider)&&void 0!==e&&e.get().then(function(e){return e.addTokenListener(t)})},Qe.prototype.notifyForInvalidToken=function(){Oe('Provided AppCheck credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly.')},Qe);function Qe(e,t){var n=this;this.appName_=e,this.appCheckProvider=t,this.appCheck=null==t?void 0:t.getImmediate({optional:!0}),this.appCheck||null!=t&&t.get().then(function(e){return n.appCheck=e})}var Ye=(Ke.prototype.getToken=function(n){var r=this;return this.auth_?this.auth_.getToken(n).catch(function(e){return e&&"auth/token-not-initialized"===e.code?(Ne("Got auth/token-not-initialized error. Treating as null token."),null):Promise.reject(e)}):new Promise(function(e,t){setTimeout(function(){r.auth_?r.getToken(n).then(e,t):e(null)},0)})},Ke.prototype.addTokenChangeListener=function(t){this.auth_?this.auth_.addAuthTokenListener(t):this.authProvider_.get().then(function(e){return e.addAuthTokenListener(t)})},Ke.prototype.removeTokenChangeListener=function(t){this.authProvider_.get().then(function(e){return e.removeAuthTokenListener(t)})},Ke.prototype.notifyForInvalidToken=function(){var e='Provided authentication credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly. ';"credential"in this.firebaseOptions_?e+='Make sure the "credential" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':"serviceAccount"in this.firebaseOptions_?e+='Make sure the "serviceAccount" property provided to initializeApp() is authorized to access the specified "databaseURL" and is from the correct project.':e+='Make sure the "apiKey" and "databaseURL" properties provided to initializeApp() match the values provided for your app at https://console.firebase.google.com/.',Oe(e)},Ke);function Ke(e,t,n){var r=this;this.appName_=e,this.firebaseOptions_=t,this.authProvider_=n,this.auth_=null,this.auth_=n.getImmediate({optional:!0}),this.auth_||n.onInit(function(e){return r.auth_=e})}var Ge=($e.prototype.getToken=function(e){return Promise.resolve({accessToken:this.accessToken})},$e.prototype.addTokenChangeListener=function(e){e(this.accessToken)},$e.prototype.removeTokenChangeListener=function(e){},$e.prototype.notifyForInvalidToken=function(){},$e.OWNER="owner",$e);function $e(e){this.accessToken=e}var Je=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,Xe="websocket",Ze="long_polling",et=(tt.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},tt.prototype.isCustomHost=function(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain},Object.defineProperty(tt.prototype,"host",{get:function(){return this._host},set:function(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&be.set("host:"+this._host,this.internalHost))},enumerable:!1,configurable:!0}),tt.prototype.toString=function(){var e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e},tt.prototype.toURLString=function(){var e=this.secure?"https://":"http://",t=this.includeNamespaceInQueryParams?"?ns="+this.namespace:"";return e+this.host+"/"+t},tt);function tt(e,t,n,r,i,o,s){void 0===i&&(i=!1),void 0===o&&(o=""),void 0===s&&(s=!1),this.secure=t,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=o,this.includeNamespaceInQueryParams=s,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=be.get("host:"+e)||this._host}function nt(e,t,n){var r;if(g("string"==typeof t,"typeof type must == string"),g("object"==typeof n,"typeof params must == object"),t===Xe)r=(e.secure?"wss://":"ws://")+e.internalHost+"/.ws?";else{if(t!==Ze)throw new Error("Unknown connection type: "+t);r=(e.secure?"https://":"http://")+e.internalHost+"/.lp?"}((t=e).host!==t.internalHost||t.isCustomHost()||t.includeNamespaceInQueryParams)&&(n.ns=e.namespace);var i=[];return Fe(n,function(e,t){i.push(e+"="+t)}),r+i.join("&")}var rt=(it.prototype.incrementCounter=function(e,t){void 0===t&&(t=1),A(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=t},it.prototype.get=function(){return f(this.counters_)},it);function it(){this.counters_={}}var ot={},st={};function at(e){e=e.toString();return ot[e]||(ot[e]=new rt),ot[e]}var ut=(lt.prototype.closeAfter=function(e,t){this.closeAfterResponse=e,this.onClose=t,this.closeAfterResponse"+(t=this.myIFrame.src&&"javascript:"===this.myIFrame.src.substr(0,"javascript:".length)?'