!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(Ru){"use strict";try{!function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=e(Ru),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;na[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),a=[];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 s(e){try{return h.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}var u={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 ("+u.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)},h={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,a||(h=64)),r.push(n[o>>2],n[(3&o)<<4|s>>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++],a=e[n++],t[r++]=String.fromCharCode((15&s)<<12|(63&o)<<6|63&a))}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!==s&&(r.push(a<<4&240|s>>2),64!==u&&r.push(s<<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)}}};function c(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)&&d(r)&&(t[r]=e(t[r],n[r]));return t}(void 0,e)}function d(e){return"__proto__"!==e}var f=(v.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))}},v);function v(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(e,t){n.resolve=e,n.reject=t})}function w(){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 C(){return!0===u.NODE_ADMIN}var b,T="FirebaseError",E=(n(I,b=Error),I);function I(e,t,n){t=b.call(this,t)||this;return t.code=e,t.customData=n,t.name=T,Object.setPrototypeOf(t,I.prototype),Error.captureStackTrace&&Error.captureStackTrace(t,S.prototype.create),t}var S=(k.prototype.create=function(e){for(var t=[],n=1;n"})):"Error",e=this.serviceName+": "+e+" ("+o+").";return new E(o,e,i)},k);function k(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var P=/\{\$([^}]+)}/g;function N(e){return JSON.parse(e)}function x(e){return JSON.stringify(e)}function R(e){var t={},n={},r={},i="";try{var o=e.split("."),t=N(s(o[0])||""),n=N(s(o[1])||""),i=o[2],r=n.d||{};delete n.d}catch(e){}return{header:t,claims:n,data:r,signature:i}}function O(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function D(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}function A(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function L(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 M(e){for(var n=[],t=0,r=Object.entries(e);t>>31)}for(var o,a=this.chain_[0],s=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^s&(u^l),1518500249):(o=s^u^l,1859775393):r<60?(o=s&u|l&(s|u),2400959708):(o=s^u^l,3395469782),i=(a<<5|a>>>27)+o+h+c+n[r]&4294967295,h=l,l=u,u=4294967295&(s<<30|s>>>2),s=a,a=i;this.chain_[0]=this.chain_[0]+a&4294967295,this.chain_[1]=this.chain_[1]+s&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},q.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},q);function q(){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 F).update(t),e=e.digest(),h.encodeByteArray(e)}function pe(e,t){g(!t||!0===e||!1===e,"Can't turn on custom loggers persistently."),!0===e?(be.logLevel=$.VERBOSE,Ie=be.log.bind(be),t&&Ce.set("logging_enabled",!0)):"function"==typeof e?Ie=e:(Ie=null,Ce.remove("logging_enabled"))}function de(){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=[],a=52;a;--a)o.push(r%2?1:0),r=Math.floor(r/2);for(a=11;a;--a)o.push(n%2?1:0),n=Math.floor(n/2);o.push(t?1:0),o.reverse();var s=o.join(""),u="";for(a=0;a<64;a+=8){var l=parseInt(s.substr(a,8),2).toString(16);u+=l=1===l.length?"0"+l:l}return u.toLowerCase()}function Fe(e,t){return"object"==typeof(t=setTimeout(e,t))&&t.unref&&t.unref(),t}var qe=new RegExp("^-?(0*)\\d{1,10}$"),We=-2147483648,je=2147483647,Ue=function(e){if(qe.test(e)){e=Number(e);if(We<=e&&e<=je)return e}return null},Be=function(e){try{e()}catch(t){setTimeout(function(){var e=t.stack||"";throw xe("Exception was thrown by user callback.",e),t},Math.floor(0))}},Ve=(ze.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)})},ze.prototype.addTokenChangeListener=function(t){var e;null!==(e=this.appCheckProvider)&&void 0!==e&&e.get().then(function(e){return e.addTokenListener(t)})},ze.prototype.notifyForInvalidToken=function(){xe('Provided AppCheck credentials for the app named "'+this.appName_+'" are invalid. This usually indicates your app was not initialized correctly.')},ze);function ze(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 He=(Qe.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?(ke("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)})},Qe.prototype.addTokenChangeListener=function(t){this.auth_?this.auth_.addAuthTokenListener(t):this.authProvider_.get().then(function(e){return e.addAuthTokenListener(t)})},Qe.prototype.removeTokenChangeListener=function(t){this.authProvider_.get().then(function(e){return e.removeAuthTokenListener(t)})},Qe.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/.',xe(e)},Qe);function Qe(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 Ye=(Ke.prototype.getToken=function(e){return Promise.resolve({accessToken:this.accessToken})},Ke.prototype.addTokenChangeListener=function(e){e(this.accessToken)},Ke.prototype.removeTokenChangeListener=function(e){},Ke.prototype.notifyForInvalidToken=function(){},Ke.OWNER="owner",Ke);function Ke(e){this.accessToken=e}var Ge=/(console\.firebase|firebase-console-\w+\.corp|firebase\.corp)\.google\.com/,$e="websocket",Je="long_polling",Xe=(Ze.prototype.isCacheableHost=function(){return"s-"===this.internalHost.substr(0,2)},Ze.prototype.isCustomHost=function(){return"firebaseio.com"!==this._domain&&"firebaseio-demo.com"!==this._domain},Object.defineProperty(Ze.prototype,"host",{get:function(){return this._host},set:function(e){e!==this.internalHost&&(this.internalHost=e,this.isCacheableHost()&&we.set("host:"+this._host,this.internalHost))},enumerable:!1,configurable:!0}),Ze.prototype.toString=function(){var e=this.toURLString();return this.persistenceKey&&(e+="<"+this.persistenceKey+">"),e},Ze.prototype.toURLString=function(){var e=this.secure?"https://":"http://",t=this.includeNamespaceInQueryParams?"?ns="+this.namespace:"";return e+this.host+"/"+t},Ze);function Ze(e,t,n,r,i,o,a){void 0===i&&(i=!1),void 0===o&&(o=""),void 0===a&&(a=!1),this.secure=t,this.namespace=n,this.webSocketOnly=r,this.nodeAdmin=i,this.persistenceKey=o,this.includeNamespaceInQueryParams=a,this._host=e.toLowerCase(),this._domain=this._host.substr(this._host.indexOf(".")+1),this.internalHost=we.get("host:"+e)||this._host}function et(e,t,n){var r;if(g("string"==typeof t,"typeof type must == string"),g("object"==typeof n,"typeof params must == object"),t===$e)r=(e.secure?"wss://":"ws://")+e.internalHost+"/.ws?";else{if(t!==Je)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 Le(n,function(e,t){i.push(e+"="+t)}),r+i.join("&")}var tt=(nt.prototype.incrementCounter=function(e,t){void 0===t&&(t=1),O(this.counters_,e)||(this.counters_[e]=0),this.counters_[e]+=t},nt.prototype.get=function(){return c(this.counters_)},nt);function nt(){this.counters_={}}var rt={},it={};function ot(e){e=e.toString();return rt[e]||(rt[e]=new tt),rt[e]}var at=(st.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)?'