var config,messaging;!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(n=n||self).firebase=t()}(this,function(){"use strict";function lt(n,t){return n(t={exports:{}},t.exports),t.exports}function de(){}function i(n){if(!(this instanceof i))throw new TypeError("Promises must be constructed via new");if("function"!=typeof n)throw new TypeError("not a function");this._state=0;this._handled=!1;this._value=void 0;this._deferreds=[];pu(n,this)}function yu(n,t){for(;3===n._state;)n=n._value;0!==n._state?(n._handled=!0,i._immediateFn(function(){var i=1===n._state?t.onFulfilled:t.onRejected,r;if(null!==i){try{r=i(n._value)}catch(i){return void at(t.promise,i)}di(t.promise,r)}else(1===n._state?di:at)(t.promise,n._value)})):n._deferreds.push(t)}function di(n,t){var r,u,f;try{if(t===n)throw new TypeError("A promise cannot be resolved with itself.");if(t&&("object"==typeof t||"function"==typeof t)){if(r=t.then,t instanceof i)return n._state=3,n._value=t,void gi(n);if("function"==typeof r)return void pu((u=r,f=t,function(){u.apply(f,arguments)}),n)}n._state=1;n._value=t;gi(n)}catch(t){at(n,t)}}function at(n,t){n._state=2;n._value=t;gi(n)}function gi(n){2===n._state&&0===n._deferreds.length&&i._immediateFn(function(){n._handled||i._unhandledRejectionFn(n._value)});for(var t=0,r=n._deferreds.length;t<r;t++)yu(n,n._deferreds[t]);n._deferreds=null}function ge(n,t,i){this.onFulfilled="function"==typeof n?n:null;this.onRejected="function"==typeof t?t:null;this.promise=i}function pu(n,t){var i=!1;try{n(function(n){i||(i=!0,di(t,n))},function(n){i||(i=!0,at(t,n))})}catch(n){if(i)return;i=!0;at(t,n)}}function st(n,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===n&&(n={});break;case Array:n=[];break;default:return t}for(var i in t)t.hasOwnProperty(i)&&(n[i]=st(n[i],t[i]));return n}function ve(n,t,i){n[t]=i}function ws(n,t){var i=new we(n,t);return i.subscribe.bind(i)}function lu(){}function ct(n,t){throw ke.create(n,t);}var ri,vu,nr,iu,ru,uu,fu,d,eu,su,hu,ae,bi,we,ke,au;!function(n){function u(n){if("string"!=typeof n&&(n=String(n)),/[^a-z0-9\-#$%&'*+.\^_`|~]/i.test(n))throw new TypeError("Invalid character in header field name");return n.toLowerCase()}function y(n){return"string"!=typeof n&&(n=String(n)),n}function o(n){var t={next:function(){var t=n.shift();return{done:void 0===t,value:t}}};return c&&(t[Symbol.iterator]=function(){return t}),t}function t(n){this.map={};n instanceof t?n.forEach(function(n,t){this.append(t,n)},this):Array.isArray(n)?n.forEach(function(n){this.append(n[0],n[1])},this):n&&Object.getOwnPropertyNames(n).forEach(function(t){this.append(t,n[t])},this)}function s(n){if(n.bodyUsed)return Promise.reject(new TypeError("Already read"));n.bodyUsed=!0}function p(n){return new Promise(function(t,i){n.onload=function(){t(n.result)};n.onerror=function(){i(n.error)}})}function nt(n){var t=new FileReader,i=p(t);return t.readAsArrayBuffer(n),i}function w(n){if(n.slice)return n.slice(0);var t=new Uint8Array(n.byteLength);return t.set(new Uint8Array(n)),t.buffer}function b(){return this.bodyUsed=!1,this._initBody=function(n){if(this._bodyInit=n)if("string"==typeof n)this._bodyText=n;else if(f&&Blob.prototype.isPrototypeOf(n))this._bodyBlob=n;else if(l&&FormData.prototype.isPrototypeOf(n))this._bodyFormData=n;else if(h&&URLSearchParams.prototype.isPrototypeOf(n))this._bodyText=n.toString();else if(e&&f&&d(n))this._bodyArrayBuffer=w(n.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer]);else{if(!e||!ArrayBuffer.prototype.isPrototypeOf(n)&&!g(n))throw new Error("unsupported BodyInit type");this._bodyArrayBuffer=w(n)}else this._bodyText="";this.headers.get("content-type")||("string"==typeof n?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):h&&URLSearchParams.prototype.isPrototypeOf(n)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},f&&(this.blob=function(){var n=s(this);if(n)return n;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))},this.arrayBuffer=function(){return this._bodyArrayBuffer?s(this)||Promise.resolve(this._bodyArrayBuffer):this.blob().then(nt)}),this.text=function(){var t,n,i,r=s(this);if(r)return r;if(this._bodyBlob)return t=this._bodyBlob,n=new FileReader,i=p(n),n.readAsText(t),i;if(this._bodyArrayBuffer)return Promise.resolve(function(n){for(var i=new Uint8Array(n),r=new Array(i.length),t=0;t<i.length;t++)r[t]=String.fromCharCode(i[t]);return r.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},l&&(this.formData=function(){return this.text().then(tt)}),this.json=function(){return this.text().then(JSON.parse)},this}function r(n,i){var f,e,u=(i=i||{}).body;if(n instanceof r){if(n.bodyUsed)throw new TypeError("Already read");this.url=n.url;this.credentials=n.credentials;i.headers||(this.headers=new t(n.headers));this.method=n.method;this.mode=n.mode;u||null==n._bodyInit||(u=n._bodyInit,n.bodyUsed=!0)}else this.url=String(n);if(this.credentials=i.credentials||this.credentials||"omit",!i.headers&&this.headers||(this.headers=new t(i.headers)),this.method=(f=i.method||this.method||"GET",e=f.toUpperCase(),-1<a.indexOf(e)?e:f),this.mode=i.mode||this.mode||null,this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&u)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(u)}function tt(n){var t=new FormData;return n.trim().split("&").forEach(function(n){if(n){var i=n.split("="),r=i.shift().replace(/\+/g," "),u=i.join("=").replace(/\+/g," ");t.append(decodeURIComponent(r),decodeURIComponent(u))}}),t}function i(n,i){i||(i={});this.type="default";this.status=void 0===i.status?200:i.status;this.ok=200<=this.status&&this.status<300;this.statusText="statusText"in i?i.statusText:"OK";this.headers=new t(i.headers);this.url=i.url||"";this._initBody(n)}var a,v;if(!n.fetch){var h="URLSearchParams"in n,c="Symbol"in n&&"iterator"in Symbol,f="FileReader"in n&&"Blob"in n&&function(){try{return new Blob,!0}catch(n){return!1}}(),l="FormData"in n,e="ArrayBuffer"in n;if(e)var k=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],d=function(n){return n&&DataView.prototype.isPrototypeOf(n)},g=ArrayBuffer.isView||function(n){return n&&-1<k.indexOf(Object.prototype.toString.call(n))};t.prototype.append=function(n,t){n=u(n);t=y(t);var i=this.map[n];this.map[n]=i?i+","+t:t};t.prototype.delete=function(n){delete this.map[u(n)]};t.prototype.get=function(n){return n=u(n),this.has(n)?this.map[n]:null};t.prototype.has=function(n){return this.map.hasOwnProperty(u(n))};t.prototype.set=function(n,t){this.map[u(n)]=y(t)};t.prototype.forEach=function(n,t){for(var i in this.map)this.map.hasOwnProperty(i)&&n.call(t,this.map[i],i,this)};t.prototype.keys=function(){var n=[];return this.forEach(function(t,i){n.push(i)}),o(n)};t.prototype.values=function(){var n=[];return this.forEach(function(t){n.push(t)}),o(n)};t.prototype.entries=function(){var n=[];return this.forEach(function(t,i){n.push([i,t])}),o(n)};c&&(t.prototype[Symbol.iterator]=t.prototype.entries);a=["DELETE","GET","HEAD","OPTIONS","POST","PUT"];r.prototype.clone=function(){return new r(this,{body:this._bodyInit})};b.call(r.prototype);b.call(i.prototype);i.prototype.clone=function(){return new i(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new t(this.headers),url:this.url})};i.error=function(){var n=new i(null,{status:0,statusText:""});return n.type="error",n};v=[301,302,303,307,308];i.redirect=function(n,t){if(-1===v.indexOf(t))throw new RangeError("Invalid status code");return new i(null,{status:t,headers:{location:n}})};n.Headers=t;n.Request=r;n.Response=i;n.fetch=function(n,u){return new Promise(function(e,o){var h=new r(n,u),s=new XMLHttpRequest;s.onload=function(){var u,n,r={status:s.status,statusText:s.statusText,headers:(u=s.getAllResponseHeaders()||"",n=new t,u.replace(/\r?\n[\t ]+/g," ").split(/\r?\n/).forEach(function(t){var i=t.split(":"),r=i.shift().trim(),u;r&&(u=i.join(":").trim(),n.append(r,u))}),n)},f;r.url="responseURL"in s?s.responseURL:r.headers.get("X-Request-URL");f="response"in s?s.response:s.responseText;e(new i(f,r))};s.onerror=function(){o(new TypeError("Network request failed"))};s.ontimeout=function(){o(new TypeError("Network request failed"))};s.open(h.method,h.url,!0);"include"===h.credentials?s.withCredentials=!0:"omit"===h.credentials&&(s.withCredentials=!1);"responseType"in s&&f&&(s.responseType="blob");h.headers.forEach(function(n,t){s.setRequestHeader(t,n)});s.send(void 0===h._bodyInit?null:h._bodyInit)})};n.fetch.polyfill=!0}}("undefined"!=typeof self?self:void 0);ri="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};vu=setTimeout;i.prototype.catch=function(n){return this.then(null,n)};i.prototype.then=function(n,t){var i=new this.constructor(de);return yu(this,new ge(n,t,i)),i};i.prototype.finally=function(n){var t=this.constructor;return this.then(function(i){return t.resolve(n()).then(function(){return i})},function(i){return t.resolve(n()).then(function(){return t.reject(i)})})};i.all=function(n){return new i(function(t,i){function e(n,u){try{if(u&&("object"==typeof u||"function"==typeof u)){var o=u.then;if("function"==typeof o)return void o.call(u,function(t){e(n,t)},i)}r[n]=u;0==--f&&t(r)}catch(u){i(u)}}var r,f,u;if(!n||void 0===n.length)throw new TypeError("Promise.all accepts an array");if(r=Array.prototype.slice.call(n),0===r.length)return t([]);for(f=r.length,u=0;u<r.length;u++)e(u,r[u])})};i.resolve=function(n){return n&&"object"==typeof n&&n.constructor===i?n:new i(function(t){t(n)})};i.reject=function(n){return new i(function(t,i){i(n)})};i.race=function(n){return new i(function(t,i){for(var r=0,u=n.length;r<u;r++)n[r].then(t,i)})};i._immediateFn="function"==typeof setImmediate&&function(n){setImmediate(n)}||function(n){vu(n,0)};i._unhandledRejectionFn=function(n){"undefined"!=typeof console&&console&&console.warn("Possible Unhandled Promise Rejection:",n)};nr=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==ri)return ri;throw new Error("unable to locate global object");}();nr.Promise||(nr.Promise=i);var r=lt(function(n){var t=n.exports="undefined"!=typeof window&&window.Math==Math?window:"undefined"!=typeof self&&self.Math==Math?self:Function("return this")();"number"==typeof __g&&(__g=t)}),e=lt(function(n){var t=n.exports={version:"2.5.5"};"number"==typeof __e&&(__e=t)}),l=(e.version,function(n){return"object"==typeof n?null!==n:"function"==typeof n}),w=function(n){if(!l(n))throw TypeError(n+" is not an object!");return n},nt=function(n){try{return!!n()}catch(n){return!0}},y=!nt(function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}),tr=r.document,no=l(tr)&&l(tr.createElement),wu=function(n){return no?tr.createElement(n):{}},bu=!y&&!nt(function(){return 7!=Object.defineProperty(wu("div"),"a",{get:function(){return 7}}).a}),vt=function(n,t){if(!l(n))return n;var i,r;if(t&&"function"==typeof(i=n.toString)&&!l(r=i.call(n))||"function"==typeof(i=n.valueOf)&&!l(r=i.call(n))||!t&&"function"==typeof(i=n.toString)&&!l(r=i.call(n)))return r;throw TypeError("Can't convert object to primitive value");},to=Object.defineProperty,b={f:y?Object.defineProperty:function(n,t,i){if(w(n),t=vt(t,!0),w(i),bu)try{return to(n,t,i)}catch(n){}if("get"in i||"set"in i)throw TypeError("Accessors not supported!");return"value"in i&&(n[t]=i.value),n}},tt=function(n,t){return{enumerable:!(1&n),configurable:!(2&n),writable:!(4&n),value:t}},h=y?function(n,t,i){return b.f(n,t,tt(1,i))}:function(n,t,i){return n[t]=i,n},io={}.hasOwnProperty,t=function(n,t){return io.call(n,t)},ro=0,uo=Math.random(),yt=function(n){return"Symbol(".concat(void 0===n?"":n,")_",(++ro+uo).toString(36))},it=lt(function(n){var i=yt("src"),u="toString",f=Function[u],o=(""+f).split(u);e.inspectSource=function(n){return f.call(n)};(n.exports=function(n,u,f,e){var s="function"==typeof f;s&&(t(f,"name")||h(f,"name",u));n[u]!==f&&(s&&(t(f,i)||h(f,i,n[u]?""+n[u]:o.join(String(u)))),n===r?n[u]=f:e?n[u]?n[u]=f:h(n,u,f):(delete n[u],h(n,u,f)))})(Function.prototype,u,function(){return"function"==typeof this&&this[i]||f.call(this)})}),ir=function(n,t,i){if(function(n){if("function"!=typeof n)throw TypeError(n+" is not a function!");}(n),void 0===t)return n;switch(i){case 1:return function(i){return n.call(t,i)};case 2:return function(i,r){return n.call(t,i,r)};case 3:return function(i,r,u){return n.call(t,i,r,u)}}return function(){return n.apply(t,arguments)}},rr="prototype",f=function(n,t,i){var o,a,u,v,w=n&f.F,l=n&f.G,b=n&f.S,y=n&f.P,k=n&f.B,s=l?r:b?r[t]||(r[t]={}):(r[t]||{})[rr],c=l?e:e[t]||(e[t]={}),p=c[rr]||(c[rr]={});for(o in l&&(i=t),i)u=((a=!w&&s&&void 0!==s[o])?s:i)[o],v=k&&a?ir(u,r):y&&"function"==typeof u?ir(Function.call,u):u,s&&it(s,o,u,n&f.U),c[o]!=u&&h(c,o,v),y&&p[o]!=u&&(p[o]=u)};r.core=e;f.F=1;f.G=2;f.S=4;f.P=8;f.B=16;f.W=32;f.U=64;f.R=128;var n=f,fo={}.toString,rt=function(n){return fo.call(n).slice(8,-1)},ur=Object("z").propertyIsEnumerable(0)?Object:function(n){return"String"==rt(n)?n.split(""):Object(n)},pt=function(n){if(null==n)throw TypeError("Can't call method on  "+n);return n},fr=function(n){return Object(pt(n))},eo=Math.ceil,oo=Math.floor,ui=function(n){return isNaN(n=+n)?0:(0<n?oo:eo)(n)},so=Math.min,er=function(n){return 0<n?so(ui(n),9007199254740991):0},or=Array.isArray||function(n){return"Array"==rt(n)},ku="__core-js_shared__",du=r[ku]||(r[ku]={}),wt=function(n){return du[n]||(du[n]={})},u=lt(function(n){var t=wt("wks"),i=r.Symbol,u="function"==typeof i;(n.exports=function(n){return t[n]||(t[n]=u&&i[n]||(u?i:yt)("Symbol."+n))}).store=t}),ho=u("species"),co=function(n,t){return or(r=n)&&("function"!=typeof(i=r.constructor)||i!==Array&&!or(i.prototype)||(i=void 0),l(i)&&null===(i=i[ho])&&(i=void 0)),new(void 0===i?Array:i)(t);var r,i},gu=function(n,t){var r=1==n,e=2==n,o=3==n,i=4==n,u=6==n,s=5==n||u,f=t||co;return function(t,h,c){for(var a,v,w=fr(t),y=ur(w),k=ir(h,c,3),b=er(y.length),l=0,p=r?f(t,b):e?f(t,0):void 0;l<b;l++)if((s||l in y)&&(v=k(a=y[l],l,w),n))if(r)p[l]=v;else if(v)switch(n){case 3:return!0;case 5:return a;case 6:return l;case 2:p.push(a)}else if(i)return!1;return u?-1:o||i?i:p}},sr=u("unscopables"),hr=Array.prototype;null==hr[sr]&&h(hr,sr,{});var bt=function(n){hr[sr][n]=!0},lo=gu(5),cr="find",nf=!0;cr in[]&&Array(1)[cr](function(){nf=!1});n(n.P+n.F*nf,"Array",{find:function(n){return lo(this,n,1<arguments.length?arguments[1]:void 0)}});bt(cr);e.Array.find;var ao=gu(6),lr="findIndex",tf=!0;lr in[]&&Array(1)[lr](function(){tf=!1});n(n.P+n.F*tf,"Array",{findIndex:function(n){return ao(this,n,1<arguments.length?arguments[1]:void 0)}});bt(lr);e.Array.findIndex;var kt,a=function(n){return ur(pt(n))},vo=Math.max,yo=Math.min,rf=wt("keys"),ar=function(n){return rf[n]||(rf[n]=yt(n))},po=(kt=!1,function(n,t,i){var u,e,s,f=a(n),o=er(f.length),r=(e=o,(u=ui(u=i))<0?vo(u+e,0):yo(u,e));if(kt&&t!=t){for(;r<o;)if((s=f[r++])!=s)return!0}else for(;r<o;r++)if((kt||r in f)&&f[r]===t)return kt||r||0;return!kt&&-1}),wo=ar("IE_PROTO"),uf=function(n,i){var r,f=a(n),e=0,u=[];for(r in f)r!=wo&&t(f,r)&&u.push(r);for(;i.length>e;)t(f,r=i[e++])&&(~po(u,r)||u.push(r));return u},fi="constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf".split(","),ut=Object.keys||function(n){return uf(n,fi)},vr={f:Object.getOwnPropertySymbols},ei={f:{}.propertyIsEnumerable},oi=Object.assign,bo=!oi||nt(function(){var n={},t={},i=Symbol(),r="abcdefghijklmnopqrst";return n[i]=7,r.split("").forEach(function(n){t[n]=n}),7!=oi({},n)[i]||Object.keys(oi({},t)).join("")!=r})?function(n){for(var r=fr(n),s=arguments.length,u=1,f=vr.f,h=ei.f;u<s;)for(var i,t=ur(arguments[u++]),e=f?ut(t).concat(f(t)):ut(t),c=e.length,o=0;o<c;)h.call(t,i=e[o++])&&(r[i]=t[i]);return r}:oi;n(n.S+n.F,"Object",{assign:bo});e.Object.assign;var ko=u("match"),go=function(n,t,i){if(l(r=t)&&(void 0!==(u=r[ko])?u:"RegExp"==rt(r)))throw TypeError("String#"+i+" doesn't accept regex!");var r,u;return String(pt(n))},ns=u("match"),yr="startsWith",ff=""[yr];n(n.P+n.F*function(n){var t=/./;try{"/./"[n](t)}catch(i){try{return t[ns]=!1,!"/./"[n](t)}catch(i){}}return!0}(yr),"String",{startsWith:function(n){var t=go(this,n,yr),i=er(Math.min(1<arguments.length?arguments[1]:void 0,t.length)),r=String(n);return ff?ff.call(t,r,i):t.slice(i,i+r.length)===r}});e.String.startsWith;n(n.P,"String",{repeat:function(n){var i=String(pt(this)),r="",t=ui(n);if(t<0||t==1/0)throw RangeError("Count can't be negative");for(;0<t;(t>>>=1)&&(i+=i))1&t&&(r+=i);return r}});e.String.repeat;var ft=lt(function(n){var i=yt("meta"),f=b.f,e=0,r=Object.isExtensible||function(){return!0},o=!nt(function(){return r(Object.preventExtensions({}))}),u=function(n){f(n,i,{value:{i:"O"+ ++e,w:{}}})},s=n.exports={KEY:i,NEED:!1,fastKey:function(n,f){if(!l(n))return"symbol"==typeof n?n:("string"==typeof n?"S":"P")+n;if(!t(n,i)){if(!r(n))return"F";if(!f)return"E";u(n)}return n[i].i},getWeak:function(n,f){if(!t(n,i)){if(!r(n))return!0;if(!f)return!1;u(n)}return n[i].w},onFreeze:function(n){return o&&s.NEED&&r(n)&&!t(n,i)&&u(n),n}}}),ts=(ft.KEY,ft.NEED,ft.fastKey,ft.getWeak,ft.onFreeze,b.f),ef=u("toStringTag"),dt=function(n,i,r){n&&!t(n=r?n:n.prototype,ef)&&ts(n,ef,{configurable:!0,value:i})},pr={f:u},is=b.f,wr=function(n){var t=e.Symbol||(e.Symbol=r.Symbol||{});"_"==n.charAt(0)||n in t||is(t,n,{value:pr.f(n)})},rs=y?Object.defineProperties:function(n,t){w(n);for(var i,r=ut(t),f=r.length,u=0;u<f;)b.f(n,i=r[u++],t[i]);return n},of=r.document,us=of&&of.documentElement,fs=ar("IE_PROTO"),br=function(){},kr="prototype",si=function(){var n,t=wu("iframe"),i=fi.length;for(t.style.display="none",us.appendChild(t),t.src="javascript:",(n=t.contentWindow.document).open(),n.write("<script>document.F=Object<\/script>"),n.close(),si=n.F;i--;)delete si[kr][fi[i]];return si()},et=Object.create||function(n,t){var i;return null!==n?(br[kr]=w(n),i=new br,br[kr]=null,i[fs]=n):i=si(),void 0===t?i:rs(i,t)},es=fi.concat("length","prototype"),sf={f:Object.getOwnPropertyNames||function(n){return uf(n,es)}},hf=sf.f,os={}.toString,cf="object"==typeof window&&window&&Object.getOwnPropertyNames?Object.getOwnPropertyNames(window):[],lf={f:function(n){return cf&&"[object Window]"==os.call(n)?function(n){try{return hf(n)}catch(n){return cf.slice()}}(n):hf(a(n))}},af=Object.getOwnPropertyDescriptor,vf={f:y?af:function(n,i){if(n=a(n),i=vt(i,!0),bu)try{return af(n,i)}catch(n){}if(t(n,i))return tt(!ei.f.call(n,i),n[i])}},ss=ft.KEY,yf=vf.f,k=b.f,pf=lf.f,s=r.Symbol,hi=r.JSON,ci=hi&&hi.stringify,p="prototype",o=u("_hidden"),wf=u("toPrimitive"),hs={}.propertyIsEnumerable,gt=wt("symbol-registry"),v=wt("symbols"),ni=wt("op-symbols"),c=Object[p],ot="function"==typeof s,dr=r.QObject,gr=!dr||!dr[p]||!dr[p].findChild,nu=y&&nt(function(){return 7!=et(k({},"a",{get:function(){return k(this,"a",{value:7}).a}})).a})?function(n,t,i){var r=yf(c,t);r&&delete c[t];k(n,t,i);r&&n!==c&&k(c,t,r)}:k,bf=function(n){var t=v[n]=et(s[p]);return t._k=n,t},tu=ot&&"symbol"==typeof s.iterator?function(n){return"symbol"==typeof n}:function(n){return n instanceof s},li=function(n,i,r){return n===c&&li(ni,i,r),w(n),i=vt(i,!0),w(r),t(v,i)?(r.enumerable?(t(n,o)&&n[o][i]&&(n[o][i]=!1),r=et(r,{enumerable:tt(0,!1)})):(t(n,o)||k(n,o,tt(1,{})),n[o][i]=!0),nu(n,i,r)):k(n,i,r)},kf=function(n,t){w(n);for(var i,r=function(n){var t=ut(n),i=vr.f;if(i)for(var r,u=i(n),e=ei.f,f=0;u.length>f;)e.call(n,r=u[f++])&&t.push(r);return t}(t=a(t)),u=0,f=r.length;u<f;)li(n,i=r[u++],t[i]);return n},df=function(n){var i=hs.call(this,n=vt(n,!0));return!(this===c&&t(v,n)&&!t(ni,n))&&(!(i||!t(this,n)||!t(v,n)||t(this,o)&&this[o][n])||i)},gf=function(n,i){if(n=a(n),i=vt(i,!0),n!==c||!t(v,i)||t(ni,i)){var r=yf(n,i);return!r||!t(v,i)||t(n,o)&&n[o][i]||(r.enumerable=!0),r}},ne=function(n){for(var i,r=pf(a(n)),u=[],f=0;r.length>f;)t(v,i=r[f++])||i==o||i==ss||u.push(i);return u},te=function(n){for(var i,r=n===c,u=pf(r?ni:a(n)),f=[],e=0;u.length>e;)t(v,i=u[e++])&&(!r||t(c,i))&&f.push(v[i]);return f};for(ot||(it((s=function(){if(this instanceof s)throw TypeError("Symbol is not a constructor!");var n=yt(0<arguments.length?arguments[0]:void 0),i=function(r){this===c&&i.call(ni,r);t(this,o)&&t(this[o],n)&&(this[o][n]=!1);nu(this,n,tt(1,r))};return y&&gr&&nu(c,n,{configurable:!0,set:i}),bf(n)})[p],"toString",function(){return this._k}),vf.f=gf,b.f=li,sf.f=lf.f=ne,ei.f=df,vr.f=te,y&&it(c,"propertyIsEnumerable",df,!0),pr.f=function(n){return bf(u(n))}),n(n.G+n.W+n.F*!ot,{Symbol:s}),iu="hasInstance,isConcatSpreadable,iterator,match,replace,search,species,split,toPrimitive,toStringTag,unscopables".split(","),ru=0;iu.length>ru;)u(iu[ru++]);for(uu=ut(u.store),fu=0;uu.length>fu;)wr(uu[fu++]);n(n.S+n.F*!ot,"Symbol",{"for":function(n){return t(gt,n+="")?gt[n]:gt[n]=s(n)},keyFor:function(n){if(!tu(n))throw TypeError(n+" is not a symbol!");for(var t in gt)if(gt[t]===n)return t},useSetter:function(){gr=!0},useSimple:function(){gr=!1}});n(n.S+n.F*!ot,"Object",{create:function(n,t){return void 0===t?et(n):kf(et(n),t)},defineProperty:li,defineProperties:kf,getOwnPropertyDescriptor:gf,getOwnPropertyNames:ne,getOwnPropertySymbols:te});hi&&n(n.S+n.F*(!ot||nt(function(){var n=s();return"[null]"!=ci([n])||"{}"!=ci({a:n})||"{}"!=ci(Object(n))})),"JSON",{stringify:function(n){for(var t,r,i=[n],u=1;arguments.length>u;)i.push(arguments[u++]);if(r=t=i[1],(l(t)||void 0!==n)&&!tu(n))return or(t)||(t=function(n,t){if("function"==typeof r&&(t=r.call(this,n,t)),!tu(t))return t}),i[1]=t,ci.apply(hi,i)}});s[p][wf]||h(s[p],wf,s[p].valueOf);dt(s,"Symbol");dt(Math,"Math",!0);dt(r.JSON,"JSON",!0);var cs=u("toStringTag"),ls="Arguments"==rt(function(){return arguments}()),ie={};ie[u("toStringTag")]="z";ie+""!="[object z]"&&it(Object.prototype,"toString",function(){return"[object "+(void 0===(t=this)?"Undefined":null===t?"Null":"string"==typeof(i=function(n,t){try{return n[t]}catch(n){}}(n=Object(t),cs))?i:ls?rt(n):"Object"==(r=rt(n))&&"function"==typeof n.callee?"Arguments":r)+"]";var t,n,i,r},!0);wr("asyncIterator");wr("observable");e.Symbol;d={};eu={};h(eu,u("iterator"),function(){return this});var ai,re=ar("IE_PROTO"),as=Object.prototype,vs=Object.getPrototypeOf||function(n){return n=fr(n),t(n,re)?n[re]:"function"==typeof n.constructor&&n instanceof n.constructor?n.constructor.prototype:n instanceof Object?as:null},ti=u("iterator"),ou=!([].keys&&"next"in[].keys()),vi="values",ue=function(){return this},fe=function(t,i,r,u,f,e,o){var k,g,nt;g=i;nt=u;(k=r).prototype=et(eu,{next:tt(1,nt)});dt(k,g+" Iterator");var l,y,a,p=function(n){if(!ou&&n in s)return s[n];switch(n){case"keys":case vi:return function(){return new r(this,n)}}return function(){return new r(this,n)}},rt=i+" Iterator",w=f==vi,b=!1,s=t.prototype,v=s[ti]||s["@@iterator"]||f&&s[f],c=v||p(f),ft=f?w?p("entries"):c:void 0,ut="Array"==i&&s.entries||v;if(ut&&(a=vs(ut.call(new t)))!==Object.prototype&&a.next&&(dt(a,rt,!0),"function"!=typeof a[ti]&&h(a,ti,ue)),w&&v&&v.name!==vi&&(b=!0,c=function(){return v.call(this)}),(ou||b||!s[ti])&&h(s,ti,c),d[i]=c,d[rt]=ue,f)if(l={values:w?c:p(vi),keys:e?c:p("keys"),entries:ft},o)for(y in l)y in s||it(s,y,l[y]);else n(n.P+n.F*(ou||b),i,l);return l},ys=(ai=!0,function(n,t){var u,f,r=String(pt(n)),i=ui(t),e=r.length;return i<0||e<=i?ai?"":void 0:(u=r.charCodeAt(i))<55296||56319<u||i+1===e||(f=r.charCodeAt(i+1))<56320||57343<f?ai?r.charAt(i):u:ai?r.slice(i,i+2):f-56320+(u-55296<<10)+65536});fe(String,"String",function(n){this._t=String(n);this._i=0},function(){var n,t=this._t,i=this._i;return i>=t.length?{value:void 0,done:!0}:(n=ys(t,i),this._i+=n.length,{value:n,done:!1})});su=function(n,t){return{value:t,done:!!n}};hu=fe(Array,"Array",function(n,t){this._t=a(n);this._i=0;this._k=t},function(){var t=this._t,i=this._k,n=this._i++;return!t||n>=t.length?(this._t=void 0,su(1)):su(0,"keys"==i?n:"values"==i?t[n]:[n,t[n]])},"values");d.Arguments=d.Array;bt("keys");bt("values");bt("entries");for(var ee=u("iterator"),oe=u("toStringTag"),se=d.Array,he={CSSRuleList:!0,CSSStyleDeclaration:!1,CSSValueList:!1,ClientRectList:!1,DOMRectList:!1,DOMStringList:!1,DOMTokenList:!0,DataTransferItemList:!1,FileList:!1,HTMLAllCollection:!1,HTMLCollection:!1,HTMLFormElement:!1,HTMLSelectElement:!1,MediaList:!0,MimeTypeArray:!1,NamedNodeMap:!1,NodeList:!0,PaintRequestList:!1,Plugin:!1,PluginArray:!1,SVGLengthList:!1,SVGNumberList:!1,SVGPathSegList:!1,SVGPointList:!1,SVGStringList:!1,SVGTransformList:!1,SourceBufferList:!1,StyleSheetList:!0,TextTrackCueList:!1,TextTrackList:!1,TouchList:!1},ce=ut(he),cu=0;cu<ce.length;cu++){var yi,pi=ce[cu],ps=he[pi],le=r[pi],g=le&&le.prototype;if(g&&(g[ee]||h(g,ee,se),g[oe]||h(g,oe,pi),d[pi]=se,ps))for(yi in hu)g[yi]||it(g,yi,hu[yi],!0)}pr.f("iterator");ae=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};var ye="FirebaseError",pe=Error.captureStackTrace,wi=function(n,t){if(this.code=n,this.message=t,pe)pe(this,bi.prototype.create);else try{throw Error.apply(this,arguments);}catch(n){this.name=ye;Object.defineProperty(this,"stack",{get:function(){return n.stack}})}};wi.prototype=Object.create(Error.prototype);(wi.prototype.constructor=wi).prototype.name=ye;bi=function(){function n(n,t,i){this.service=n;this.serviceName=t;this.errors=i;this.pattern=/\{\$([^}]+)}/g}return n.prototype.create=function(n,t){var r,u,f,e,i;void 0===t&&(t={});u=this.errors[n];f=this.service+"/"+n;r=void 0===u?"Error":u.replace(this.pattern,function(n,i){var r=t[i];return void 0!==r?r.toString():"<"+i+"?>"});r=this.serviceName+": "+r+" ("+f+").";e=new wi(f,r);for(i in t)t.hasOwnProperty(i)&&"_"!==i.slice(-1)&&(e[i]=t[i]);return e},n}();!function(n){function t(){var t=n.call(this)||this,i;for(t.chain_=[],t.buf_=[],t.W_=[],t.pad_=[],t.inbuf_=0,t.total_=0,t.blockSize=64,t.pad_[0]=128,i=1;i<t.blockSize;++i)t.pad_[i]=0;return t.reset(),t}(function(n,t){function i(){this.constructor=n}ae(n,t);n.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)})(t,n);t.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};t.prototype.compress_=function(n,t){var r,i,o;if(t||(t=0),r=this.W_,"string"==typeof n)for(i=0;i<16;i++)r[i]=n.charCodeAt(t)<<24|n.charCodeAt(t+1)<<16|n.charCodeAt(t+2)<<8|n.charCodeAt(t+3),t+=4;else for(i=0;i<16;i++)r[i]=n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3],t+=4;for(i=16;i<80;i++)o=r[i-3]^r[i-8]^r[i-14]^r[i-16],r[i]=4294967295&(o<<1|o>>>31);var s,l,h=this.chain_[0],u=this.chain_[1],f=this.chain_[2],e=this.chain_[3],c=this.chain_[4];for(i=0;i<80;i++)l=i<40?i<20?(s=e^u&(f^e),1518500249):(s=u^f^e,1859775393):i<60?(s=u&f|e&(u|f),2400959708):(s=u^f^e,3395469782),o=(h<<5|h>>>27)+s+c+l+r[i]&4294967295,c=e,e=f,f=4294967295&(u<<30|u>>>2),u=h,h=o;this.chain_[0]=this.chain_[0]+h&4294967295;this.chain_[1]=this.chain_[1]+u&4294967295;this.chain_[2]=this.chain_[2]+f&4294967295;this.chain_[3]=this.chain_[3]+e&4294967295;this.chain_[4]=this.chain_[4]+c&4294967295};t.prototype.update=function(n,t){if(null!=n){void 0===t&&(t=n.length);for(var f=t-this.blockSize,i=0,u=this.buf_,r=this.inbuf_;i<t;){if(0==r)for(;i<=f;)this.compress_(n,i),i+=this.blockSize;if("string"==typeof n){for(;i<t;)if(u[r]=n.charCodeAt(i),++i,++r==this.blockSize){this.compress_(u);r=0;break}}else for(;i<t;)if(u[r]=n[i],++i,++r==this.blockSize){this.compress_(u);r=0;break}}this.inbuf_=r;this.total_+=t}};t.prototype.digest=function(){var r=[],u=8*this.total_,n,i,t;for(this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56)),n=this.blockSize-1;56<=n;n--)this.buf_[n]=255&u,u/=256;for(this.compress_(this.buf_),i=0,n=0;n<5;n++)for(t=24;0<=t;t-=8)r[i]=this.chain_[n]>>t&255,++i;return r}}(function(){this.blockSize=-1});we=function(){function n(n,t){var i=this;this.observers=[];this.unsubscribes=[];this.observerCount=0;this.task=Promise.resolve();this.finalized=!1;this.onNoObservers=t;this.task.then(function(){n(i)}).catch(function(n){i.error(n)})}return n.prototype.next=function(n){this.forEachObserver(function(t){t.next(n)})},n.prototype.error=function(n){this.forEachObserver(function(t){t.error(n)});this.close(n)},n.prototype.complete=function(){this.forEachObserver(function(n){n.complete()});this.close()},n.prototype.subscribe=function(n,t,i){var r,u=this,f;if(void 0===n&&void 0===t&&void 0===i)throw new Error("Missing Observer.");return void 0===(r=function(n,t){var i,r,u;if("object"!=typeof n||null===n)return!1;for(i=0,r=t;i<r.length;i++)if(u=r[i],u in n&&"function"==typeof n[u])return!0;return!1}(n,["next","error","complete"])?n:{next:n,error:t,complete:i}).next&&(r.next=lu),void 0===r.error&&(r.error=lu),void 0===r.complete&&(r.complete=lu),f=this.unsubscribeOne.bind(this,this.observers.length),this.finalized&&this.task.then(function(){try{u.finalError?r.error(u.finalError):r.complete()}catch(n){}}),this.observers.push(r),f},n.prototype.unsubscribeOne=function(n){void 0!==this.observers&&void 0!==this.observers[n]&&(delete this.observers[n],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},n.prototype.forEachObserver=function(n){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,n)},n.prototype.sendOne=function(n,t){var i=this;this.task.then(function(){if(void 0!==i.observers&&void 0!==i.observers[n])try{t(i.observers[n])}catch(n){"undefined"!=typeof console&&console.error&&console.error(n)}})},n.prototype.close=function(n){var t=this;this.finalized||(this.finalized=!0,void 0!==n&&(this.finalError=n),this.task.then(function(){t.observers=void 0;t.onNoObservers=void 0}))},n}();var be=function(n,t){return Object.prototype.hasOwnProperty.call(n,t)},ki="[DEFAULT]",ii=[],ht=function(){function n(n,t,i){this.firebase_=i;this.isDeleted_=!1;this.services_={};this.name_=t.name;this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled||!1;this.options_=st(void 0,n);this.INTERNAL={getUid:function(){return null},getToken:function(){return Promise.resolve(null)},addAuthTokenListener:function(n){ii.push(n);setTimeout(function(){return n(null)},0)},removeAuthTokenListener:function(n){ii=ii.filter(function(t){return t!==n})}}}return Object.defineProperty(n.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this._automaticDataCollectionEnabled},set:function(n){this.checkDestroyed_();this._automaticDataCollectionEnabled=n},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!0,configurable:!0}),n.prototype.delete=function(){var n=this;return new Promise(function(t){n.checkDestroyed_();t()}).then(function(){n.firebase_.INTERNAL.removeApp(n.name_);var t=[];return Object.keys(n.services_).forEach(function(i){Object.keys(n.services_[i]).forEach(function(r){t.push(n.services_[i][r])})}),Promise.all(t.map(function(n){return n.INTERNAL.delete()}))}).then(function(){n.isDeleted_=!0;n.services_={}})},n.prototype._getService=function(n,t){if(void 0===t&&(t=ki),this.checkDestroyed_(),this.services_[n]||(this.services_[n]={}),!this.services_[n][t]){var i=t!==ki?t:void 0,r=this.firebase_.INTERNAL.factories[n](this,this.extendApp.bind(this),i);this.services_[n][t]=r}return this.services_[n][t]},n.prototype.extendApp=function(n){var t=this;st(this,n);n.INTERNAL&&n.INTERNAL.addAuthTokenListener&&(ii.forEach(function(n){t.INTERNAL.addAuthTokenListener(n)}),ii=[])},n.prototype.checkDestroyed_=function(){this.isDeleted_&&ct("app-deleted",{name:this.name_})},n}();ht.prototype.name&&ht.prototype.options||ht.prototype.delete||console.log("dc");ke=new bi("app","Firebase",{"no-app":"No Firebase App '{$name}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$name}","duplicate-app":"Firebase App named '{$name}' already exists","app-deleted":"Firebase App named '{$name}' already deleted","duplicate-service":"Firebase service named '{$name}' already registered","sa-not-supported":"Initializing the Firebase SDK with a service account is only allowed in a Node.js environment. On client devices, you should instead initialize the SDK with an api key and auth domain","invalid-app-argument":"firebase.{$name}() takes either no argument or a Firebase App instance."});au=!1;try{au="[object process]"===Object.prototype.toString.call(global.process)}catch(ri){}return au&&console.warn('\nWarning: This is a browser-targeted Firebase bundle but it appears it is being\nrun in a Node environment.  If running in a Node environment, make sure you\nare using the bundle specified by the "main" field in package.json.\n\nIf you are using Webpack, you can specify "main" as the first item in\n"resolve.mainFields":\nhttps://webpack.js.org/configuration/resolve/#resolvemainfields\n\nIf using Rollup, use the rollup-plugin-node-resolve plugin and set "module"\nto false and "main" to true:\nhttps://github.com/rollup/rollup-plugin-node-resolve\n'),function ri(){function u(t){return be(n,t=t||ki)||ct("no-app",{name:t}),n[t]}function f(){return Object.keys(n).map(function(t){return n[t]})}function e(n,t){Object.keys(i).forEach(function(i){var u=o(n,i);null!==u&&r[u]&&r[u](t,n)})}function o(n,t){if("serverAuth"===t)return null;var i=t;return n.options,i}var n={},i={},r={},t={__esModule:!0,initializeApp:function(i,r){var s,f,u,o;return(void 0===r&&(r={}),"object"!=typeof r||null===r)&&(s=r,r={name:s}),f=r,void 0===f.name&&(f.name=ki),u=f.name,"string"==typeof u&&u||ct("bad-app-name",{name:u+""}),be(n,u)&&ct("duplicate-app",{name:u}),o=new ht(i,f,t),e(n[u]=o,"create"),o},app:u,apps:null,Promise:Promise,SDK_VERSION:"5.8.6",INTERNAL:{registerService:function(n,e,o,s,h){i[n]&&ct("duplicate-service",{name:n});i[n]=e;s&&(r[n]=s,f().forEach(function(n){s("create",n)}));var c=function(t){return void 0===t&&(t=u()),"function"!=typeof t[n]&&ct("invalid-app-argument",{name:n}),t[n]()};return void 0!==o&&st(c,o),t[n]=c,ht.prototype[n]=function(){for(var i=[],t=0;t<arguments.length;t++)i[t]=arguments[t];return this._getService.bind(this,n).apply(this,h?i:[])},c},createFirebaseNamespace:ri,extendNamespace:function(n){st(t,n)},createSubscribe:ws,ErrorFactory:bi,removeApp:function(t){e(n[t],"delete");delete n[t]},factories:i,useAsService:o,Promise:Promise,deepExtend:st}};return ve(t,"default",t),Object.defineProperty(t,"apps",{get:f}),ve(u,"App",ht),t}()});!function(n,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app"],t):t((n=n||self).firebase)}(this,function(n){"use strict";try{(function(){function c(n,t){function i(){this.constructor=n}wt(n,t);n.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)}function r(n,t,i,r){return new(i||(i=Promise))(function(u,f){function o(n){try{e(r.next(n))}catch(n){f(n)}}function s(n){try{e(r.throw(n))}catch(n){f(n)}}function e(n){n.done?u(n.value):new i(function(t){t(n.value)}).then(o,s)}e((r=r.apply(n,t||[])).next())})}function u(n,t){function o(e){return function(o){return function(e){if(f)throw new TypeError("Generator is already executing.");for(;r;)try{if(f=1,u&&(i=u[2&e[0]?"return":e[0]?"throw":"next"])&&!(i=i.call(u,e[1])).done)return i;switch(u=0,i&&(e=[0,i.value]),e[0]){case 0:case 1:i=e;break;case 4:return r.label++,{value:e[1],done:!1};case 5:r.label++;u=e[1];e=[0];continue;case 7:e=r.ops.pop();r.trys.pop();continue;default:if(!(i=0<(i=r.trys).length&&i[i.length-1])&&(6===e[0]||2===e[0])){r=0;continue}if(3===e[0]&&(!i||e[1]>i[0]&&e[1]<i[3])){r.label=e[1];break}if(6===e[0]&&r.label<i[1]){r.label=i[1];i=e;break}if(i&&r.label<i[2]){r.label=i[2];r.ops.push(e);break}i[2]&&r.ops.pop();r.trys.pop();continue}e=t.call(n,r)}catch(o){e=[6,o];u=0}finally{f=i=0}if(5&e[0])throw e[1];return{value:e[0]?e[1]:void 0,done:!0}}([e,o])}}var f,u,i,e,r={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return e={next:o(0),"throw":o(1),"return":o(2)},"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e}function or(n,t){var i="function"==typeof Symbol&&n[Symbol.iterator],r,f,u,e;if(!i)return n;u=i.call(n);e=[];try{for(;(void 0===t||0<t--)&&!(r=u.next()).done;)e.push(r.value)}catch(n){f={error:n}}finally{try{r&&!r.done&&(i=u.return)&&i.call(u)}finally{if(f)throw f.error;}}return e}function dt(n,t){var i=new gt(n,t);return i.subscribe.bind(i)}function tt(){}function a(n,t){if(null==n||null==t)return!1;if(n===t)return!0;if(n.byteLength!==t.byteLength)return!1;for(var r=new DataView(n),u=new DataView(t),i=0;i<n.byteLength;i++)if(r.getUint8(i)!==u.getUint8(i))return!1;return!0}function cr(n){var t=new Uint8Array(n);return btoa(String.fromCharCode.apply(String,function(){for(var n=[],t=0;t<arguments.length;t++)n=n.concat(or(arguments[t]));return n}(t)))}function h(n){return cr(n).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function d(n){for(var u=(n+"=".repeat((4-n.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),i=atob(u),r=new Uint8Array(i.length),t=0;t<i.length;++t)r[t]=i.charCodeAt(t);return r}function lr(){var n=indexedDB.open(ct);n.onerror=function(){};n.onsuccess=function(){!function(n){if(n.objectStoreNames.contains(g)){var i=n.transaction(g).objectStore(g),r=new ht,t=i.openCursor();t.onerror=function(n){console.warn("Unable to cleanup old IDB.",n)};t.onsuccess=function(){var u=t.result,i;u?(i=u.value,r.deleteToken(i.fcmSenderId,i.fcmToken,i.fcmPushSet),u.continue()):(n.close(),indexedDB.deleteDatabase(ct))}}}(n.result)}}function at(n){if(n.fcmToken&&("string"!=typeof n.fcmToken||0===n.fcmToken.length))throw t.create(b);if(n.swScope&&("string"!=typeof n.swScope||0===n.swScope.length))throw t.create(s);if(n.vapidKey&&(!(n.vapidKey instanceof Uint8Array)||65!==n.vapidKey.length))throw t.create(w);if(n.endpoint&&("string"!=typeof n.endpoint||0===n.endpoint.length))throw t.create(l);if(n.auth&&!(n.auth instanceof ArrayBuffer))throw t.create(l);if(n.p256dh&&!(n.p256dh instanceof ArrayBuffer))throw t.create(l);if(n.fcmSenderId&&("string"!=typeof n.fcmSenderId||0===n.fcmSenderId.length))throw t.create(p);if(n.fcmPushSet&&("string"!=typeof n.fcmPushSet||0===n.fcmPushSet.length))throw t.create(ot);}function pt(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function rr(n,t){var i;return(i={})[f.TYPE_OF_MSG]=n,i[f.DATA]=t,i}function er(){return self&&"ServiceWorkerGlobalScope"in self?"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey"):navigator.cookieEnabled&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}var wt,v,nt,i,gt,ht,ct,g,lt,tr,ur,fr;n=n&&n.hasOwnProperty("default")?n.default:n;wt=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,t){n.__proto__=t}||function(n,t){for(var i in t)t.hasOwnProperty(i)&&(n[i]=t[i])};v=Object.assign||function(n){for(var r,i,t=1,u=arguments.length;t<u;t++)for(i in r=arguments[t])Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i]);return n};var bt="FirebaseError",kt=Error.captureStackTrace,y=function(n,t){if(this.code=n,this.message=t,kt)kt(this,nt.prototype.create);else try{throw Error.apply(this,arguments);}catch(n){this.name=bt;Object.defineProperty(this,"stack",{get:function(){return n.stack}})}};y.prototype=Object.create(Error.prototype);(y.prototype.constructor=y).prototype.name=bt;nt=function(){function n(n,t,i){this.service=n;this.serviceName=t;this.errors=i;this.pattern=/\{\$([^}]+)}/g}return n.prototype.create=function(n,t){var r,u,f,e,i;void 0===t&&(t={});u=this.errors[n];f=this.service+"/"+n;r=void 0===u?"Error":u.replace(this.pattern,function(n,i){var r=t[i];return void 0!==r?r.toString():"<"+i+"?>"});r=this.serviceName+": "+r+" ("+f+").";e=new y(f,r);for(i in t)t.hasOwnProperty(i)&&"_"!==i.slice(-1)&&(e[i]=t[i]);return e},n}();!function(n){function t(){var t=n.call(this)||this,i;for(t.chain_=[],t.buf_=[],t.W_=[],t.pad_=[],t.inbuf_=0,t.total_=0,t.blockSize=64,t.pad_[0]=128,i=1;i<t.blockSize;++i)t.pad_[i]=0;return t.reset(),t}c(t,n);t.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};t.prototype.compress_=function(n,t){var r,i,o;if(t||(t=0),r=this.W_,"string"==typeof n)for(i=0;i<16;i++)r[i]=n.charCodeAt(t)<<24|n.charCodeAt(t+1)<<16|n.charCodeAt(t+2)<<8|n.charCodeAt(t+3),t+=4;else for(i=0;i<16;i++)r[i]=n[t]<<24|n[t+1]<<16|n[t+2]<<8|n[t+3],t+=4;for(i=16;i<80;i++)o=r[i-3]^r[i-8]^r[i-14]^r[i-16],r[i]=4294967295&(o<<1|o>>>31);var s,l,h=this.chain_[0],u=this.chain_[1],f=this.chain_[2],e=this.chain_[3],c=this.chain_[4];for(i=0;i<80;i++)l=i<40?i<20?(s=e^u&(f^e),1518500249):(s=u^f^e,1859775393):i<60?(s=u&f|e&(u|f),2400959708):(s=u^f^e,3395469782),o=(h<<5|h>>>27)+s+c+l+r[i]&4294967295,c=e,e=f,f=4294967295&(u<<30|u>>>2),u=h,h=o;this.chain_[0]=this.chain_[0]+h&4294967295;this.chain_[1]=this.chain_[1]+u&4294967295;this.chain_[2]=this.chain_[2]+f&4294967295;this.chain_[3]=this.chain_[3]+e&4294967295;this.chain_[4]=this.chain_[4]+c&4294967295};t.prototype.update=function(n,t){if(null!=n){void 0===t&&(t=n.length);for(var f=t-this.blockSize,i=0,u=this.buf_,r=this.inbuf_;i<t;){if(0==r)for(;i<=f;)this.compress_(n,i),i+=this.blockSize;if("string"==typeof n){for(;i<t;)if(u[r]=n.charCodeAt(i),++i,++r==this.blockSize){this.compress_(u);r=0;break}}else for(;i<t;)if(u[r]=n[i],++i,++r==this.blockSize){this.compress_(u);r=0;break}}this.inbuf_=r;this.total_+=t}};t.prototype.digest=function(){var r=[],u=8*this.total_,n,i,t;for(this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56)),n=this.blockSize-1;56<=n;n--)this.buf_[n]=255&u,u/=256;for(this.compress_(this.buf_),i=0,n=0;n<5;n++)for(t=24;0<=t;t-=8)r[i]=this.chain_[n]>>t&255,++i;return r}}(function(){this.blockSize=-1});gt=function(){function n(n,t){var i=this;this.observers=[];this.unsubscribes=[];this.observerCount=0;this.task=Promise.resolve();this.finalized=!1;this.onNoObservers=t;this.task.then(function(){n(i)}).catch(function(n){i.error(n)})}return n.prototype.next=function(n){this.forEachObserver(function(t){t.next(n)})},n.prototype.error=function(n){this.forEachObserver(function(t){t.error(n)});this.close(n)},n.prototype.complete=function(){this.forEachObserver(function(n){n.complete()});this.close()},n.prototype.subscribe=function(n,t,i){var r,u=this,f;if(void 0===n&&void 0===t&&void 0===i)throw new Error("Missing Observer.");return void 0===(r=function(n,t){var i,r,u;if("object"!=typeof n||null===n)return!1;for(i=0,r=t;i<r.length;i++)if(u=r[i],u in n&&"function"==typeof n[u])return!0;return!1}(n,["next","error","complete"])?n:{next:n,error:t,complete:i}).next&&(r.next=tt),void 0===r.error&&(r.error=tt),void 0===r.complete&&(r.complete=tt),f=this.unsubscribeOne.bind(this,this.observers.length),this.finalized&&this.task.then(function(){try{u.finalError?r.error(u.finalError):r.complete()}catch(n){}}),this.observers.push(r),f},n.prototype.unsubscribeOne=function(n){void 0!==this.observers&&void 0!==this.observers[n]&&(delete this.observers[n],this.observerCount-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},n.prototype.forEachObserver=function(n){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,n)},n.prototype.sendOne=function(n,t){var i=this;this.task.then(function(){if(void 0!==i.observers&&void 0!==i.observers[n])try{t(i.observers[n])}catch(n){"undefined"!=typeof console&&console.error&&console.error(n)}})},n.prototype.close=function(n){var t=this;this.finalized||(this.finalized=!0,void 0!==n&&(this.finalError=n),this.task.then(function(){t.observers=void 0;t.onNoObservers=void 0}))},n}();var f,ni,e,ti,o="only-available-in-window",ii="only-available-in-sw",p="bad-sender-id",ri="incorrect-gcm-sender-id",ui="permission-default",fi="permission-blocked",ei="unsupported-browser",oi="notifications-blocked",si="failed-serviceworker-registration",it="sw-registration-expected",rt="sw-reg-redundant",ut="token-subscribe-failed",hi="token-subscribe-no-token",ci="token-subscribe-no-push-set",ft="token-unsubscribe-failed",et="token-update-failed",li="token-update-no-token",ai="use-sw-before-get-token",vi="invalid-delete-token",yi="delete-token-not-found",pi="delete-scope-not-found",wi="bg-handler-function-expected",bi="no-window-client-to-msg",ki="unable-to-resubscribe",di="no-sw-in-reg",s="bad-scope",w="bad-vapid-key",l="bad-subscription",b="bad-token",ot="bad-push-set",gi="invalid-public-vapid-key",sr="use-public-key-before-get-token",nr="public-vapid-key-decryption-failed",hr=((i={})[o]="This method is available in a Window context.",i[ii]="This method is available in a service worker context.",i["should-be-overriden"]="This method should be overriden by extended classes.",i[p]="Please ensure that 'messagingSenderId' is set correctly in the options passed into firebase.initializeApp().",i[ui]="The required permissions were not granted and dismissed instead.",i[fi]="The required permissions were not granted and blocked instead.",i[ei]="This browser doesn't support the API's required to use the firebase SDK.",i[oi]="Notifications have been blocked.",i[si]="We are unable to register the default service worker. {$browserErrorMessage}",i[it]="A service worker registration was the expected input.",i["get-subscription-failed"]="There was an error when trying to get any existing Push Subscriptions.",i["invalid-saved-token"]="Unable to access details of the saved token.",i[rt]="The service worker being used for push was made redundant.",i[ut]="A problem occured while subscribing the user to FCM: {$message}",i[hi]="FCM returned no token when subscribing the user to push.",i[ci]="FCM returned an invalid response when getting an FCM token.",i[ft]="A problem occured while unsubscribing the user from FCM: {$message}",i[et]="A problem occured while updating the user from FCM: {$message}",i[li]="FCM returned no token when updating the user to push.",i[ai]="The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.",i[vi]="You must pass a valid token into deleteToken(), i.e. the token from getToken().",i[yi]="The deletion attempt for token could not be performed as the token was not found.",i[pi]="The deletion attempt for service worker scope could not be performed as the scope was not found.",i[wi]="The input to setBackgroundMessageHandler() must be a function.",i[bi]="An attempt was made to message a non-existant window client.",i[ki]="There was an error while re-subscribing the FCM token for push messaging. Will have to resubscribe the user on next visit. {$message}",i["no-fcm-token-for-resubscribe"]="Could not find an FCM token and as a result, unable to resubscribe. Will have to resubscribe the user on next visit.",i["failed-to-delete-token"]="Unable to delete the currently saved token.",i[di]="Even though the service worker registration was successful, there was a problem accessing the service worker itself.",i[ri]="Please change your web app manifest's 'gcm_sender_id' value to '103953800507' to use Firebase messaging.",i[s]="The service worker scope must be a string with at least one character.",i[w]="The public VAPID key is not a Uint8Array with 65 bytes.",i[l]="The subscription must be a valid PushSubscription.",i[b]="The FCM Token used for storage / lookup was not a valid token string.",i[ot]="The FCM push set used for storage / lookup was not not a valid push set string.",i["failed-delete-vapid-key"]="The VAPID key could not be deleted.",i[gi]="The public VAPID key must be a string.",i[nr]="The public VAPID key did not equal 65 bytes when decrypted.",i),t=new nt("messaging","Messaging",hr),k=new Uint8Array([4,51,148,247,223,161,235,177,220,3,162,94,21,113,219,72,211,46,237,237,178,52,219,183,71,58,12,143,196,204,225,111,60,140,132,223,171,182,102,62,242,12,212,139,254,227,249,118,47,20,28,99,8,106,111,45,177,26,149,176,206,55,192,156,110]),st="https://fcm.googleapis.com";(ni=f||(f={})).TYPE_OF_MSG="firebase-messaging-msg-type";ni.DATA="firebase-messaging-msg-data";(ti=e||(e={})).PUSH_MSG_RECEIVED="push-msg-received";ti.NOTIFICATION_CLICKED="notification-clicked";ht=function(){function n(){}return n.prototype.getToken=function(n,i,f){return r(this,void 0,void 0,function(){var o,s,e,c,l,v,r,y;return u(this,function(u){switch(u.label){case 0:o=h(i.getKey("p256dh"));s=h(i.getKey("auth"));e="authorized_entity="+n+"&endpoint="+i.endpoint+"&encryption_key="+o+"&encryption_auth="+s;a(f.buffer,k.buffer)||(c=h(f),e+="&application_pub_key="+c);(l=new Headers).append("Content-Type","application/x-www-form-urlencoded");v={method:"POST",headers:l,body:e};u.label=1;case 1:return u.trys.push([1,4,,5]),[4,fetch(st+"/fcm/connect/subscribe",v)];case 2:return[4,u.sent().json()];case 3:return r=u.sent(),[3,5];case 4:throw u.sent(),t.create(ut);case 5:if(r.error)throw y=r.error.message,t.create(ut,{message:y});if(!r.token)throw t.create(hi);if(!r.pushSet)throw t.create(ci);return[2,{token:r.token,pushSet:r.pushSet}]}})})},n.prototype.updateToken=function(n,i,f,e,o){return r(this,void 0,void 0,function(){var c,l,s,v,y,p,r,w;return u(this,function(u){switch(u.label){case 0:c=h(e.getKey("p256dh"));l=h(e.getKey("auth"));s="push_set="+f+"&token="+i+"&authorized_entity="+n+"&endpoint="+e.endpoint+"&encryption_key="+c+"&encryption_auth="+l;a(o.buffer,k.buffer)||(v=h(o),s+="&application_pub_key="+v);(y=new Headers).append("Content-Type","application/x-www-form-urlencoded");p={method:"POST",headers:y,body:s};u.label=1;case 1:return u.trys.push([1,4,,5]),[4,fetch(st+"/fcm/connect/subscribe",p)];case 2:return[4,u.sent().json()];case 3:return r=u.sent(),[3,5];case 4:throw u.sent(),t.create(et);case 5:if(r.error)throw w=r.error.message,t.create(et,{message:w});if(!r.token)throw t.create(li);return[2,r.token]}})})},n.prototype.deleteToken=function(n,i,f){return r(this,void 0,void 0,function(){var r,e,o,s,h;return u(this,function(u){switch(u.label){case 0:r="authorized_entity="+n+"&token="+i+"&pushSet="+f;(e=new Headers).append("Content-Type","application/x-www-form-urlencoded");o={method:"POST",headers:e,body:r};u.label=1;case 1:return u.trys.push([1,4,,5]),[4,fetch(st+"/fcm/connect/unsubscribe",o)];case 2:return[4,u.sent().json()];case 3:if((s=u.sent()).error)throw h=s.error.message,t.create(ft,{message:h});return[3,5];case 4:throw u.sent(),t.create(ft);case 5:return[2]}})})},n}();ct="undefined";g="fcm_token_object_Store";lt=function(){function n(){this.dbPromise=null}return n.prototype.get=function(n){return this.createTransaction(function(t){return t.get(n)})},n.prototype.getIndex=function(n,t){return this.createTransaction(function(i){return i.index(n).get(t)})},n.prototype.put=function(n){return this.createTransaction(function(t){return t.put(n)},"readwrite")},n.prototype.delete=function(n){return this.createTransaction(function(t){return t.delete(n)},"readwrite")},n.prototype.closeDatabase=function(){return r(this,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return this.dbPromise?[4,this.dbPromise]:[3,2];case 1:n.sent().close();this.dbPromise=null;n.label=2;case 2:return[2]}})})},n.prototype.createTransaction=function(n,t){return void 0===t&&(t="readonly"),r(this,void 0,void 0,function(){var r,i,f,e;return u(this,function(u){switch(u.label){case 0:return[4,this.getDb()];case 1:return r=u.sent(),i=r.transaction(this.objectStoreName,t),f=i.objectStore(this.objectStoreName),[4,(o=n(f),new Promise(function(n,t){o.onsuccess=function(){n(o.result)};o.onerror=function(){t(o.error)}}))];case 2:return e=u.sent(),[2,new Promise(function(n,t){i.oncomplete=function(){n(e)};i.onerror=function(){t(i.error)}})]}var o})})},n.prototype.getDb=function(){var n=this;return this.dbPromise||(this.dbPromise=new Promise(function(t,i){var r=indexedDB.open(n.dbName,n.dbVersion);r.onsuccess=function(){t(r.result)};r.onerror=function(){n.dbPromise=null;i(r.error)};r.onupgradeneeded=function(t){return n.onDbUpgrade(r,t)}})),this.dbPromise},n}();tr=function(n){function i(){var t=null!==n&&n.apply(this,arguments)||this;return t.dbName="fcm_token_details_db",t.dbVersion=3,t.objectStoreName="fcm_token_object_Store",t}return c(i,n),i.prototype.onDbUpgrade=function(n,t){var u=n.result,i,r;switch(t.oldVersion){case 0:(i=u.createObjectStore(this.objectStoreName,{keyPath:"swScope"})).createIndex("fcmSenderId","fcmSenderId",{unique:!1});i.createIndex("fcmToken","fcmToken",{unique:!0});case 1:lr();case 2:r=(i=n.transaction.objectStore(this.objectStoreName)).openCursor();r.onsuccess=function(){var i=r.result,n,t;i&&(n=i.value,t=v({},n),n.createTime||(t.createTime=Date.now()),"string"==typeof n.vapidKey&&(t.vapidKey=d(n.vapidKey)),"string"==typeof n.auth&&(t.auth=d(n.auth).buffer),"string"==typeof n.auth&&(t.p256dh=d(n.p256dh).buffer),i.update(t),i.continue())}}},i.prototype.getTokenDetailsFromToken=function(n){return r(this,void 0,void 0,function(){return u(this,function(){if(!n)throw t.create(b);return at({fcmToken:n}),[2,this.getIndex("fcmToken",n)]})})},i.prototype.getTokenDetailsFromSWScope=function(n){return r(this,void 0,void 0,function(){return u(this,function(){if(!n)throw t.create(s);return at({swScope:n}),[2,this.get(n)]})})},i.prototype.saveTokenDetails=function(n){return r(this,void 0,void 0,function(){return u(this,function(){if(!n.swScope)throw t.create(s);if(!n.vapidKey)throw t.create(w);if(!n.endpoint||!n.auth||!n.p256dh)throw t.create(l);if(!n.fcmSenderId)throw t.create(p);if(!n.fcmToken)throw t.create(b);if(!n.fcmPushSet)throw t.create(ot);return at(n),[2,this.put(n)]})})},i.prototype.deleteToken=function(n){return r(this,void 0,void 0,function(){var i;return u(this,function(r){switch(r.label){case 0:return"string"!=typeof n||0===n.length?[2,Promise.reject(t.create(vi))]:[4,this.getTokenDetailsFromToken(n)];case 1:if(!(i=r.sent()))throw t.create(yi);return[4,this.delete(i.swScope)];case 2:return r.sent(),[2,i]}})})},i}(lt);var ar=function(n){function i(){var t=null!==n&&n.apply(this,arguments)||this;return t.dbName="fcm_vapid_details_db",t.dbVersion=1,t.objectStoreName="fcm_vapid_object_Store",t}return c(i,n),i.prototype.onDbUpgrade=function(n){n.result.createObjectStore(this.objectStoreName,{keyPath:"swScope"})},i.prototype.getVapidFromSWScope=function(n){return r(this,void 0,void 0,function(){var i;return u(this,function(r){switch(r.label){case 0:if("string"!=typeof n||0===n.length)throw t.create(s);return[4,this.get(n)];case 1:return[2,(i=r.sent())?i.vapidKey:void 0]}})})},i.prototype.saveVapidDetails=function(n,i){return r(this,void 0,void 0,function(){var r;return u(this,function(){if("string"!=typeof n||0===n.length)throw t.create(s);if(null===i||65!==i.length)throw t.create(w);return r={swScope:n,vapidKey:i},[2,this.put(r)]})})},i.prototype.deleteVapidDetails=function(n){return r(this,void 0,void 0,function(){var i;return u(this,function(r){switch(r.label){case 0:return[4,this.getVapidFromSWScope(n)];case 1:if(!(i=r.sent()))throw t.create(pi);return[4,this.delete(n)];case 2:return r.sent(),[2,i]}})})},i}(lt),vt="messagingSenderId",ir=function(){function n(n){var i=this;if(!n.options[vt]||"string"!=typeof n.options[vt])throw t.create(p);this.messagingSenderId=n.options[vt];this.tokenDetailsModel=new tr;this.vapidDetailsModel=new ar;this.iidModel=new ht;this.app=n;this.INTERNAL={"delete":function(){return i.delete()}}}return n.prototype.getToken=function(){return r(this,void 0,void 0,function(){var f,n,i,r,e;return u(this,function(u){switch(u.label){case 0:if("denied"===(f=this.getNotificationPermission_()))throw t.create(oi);return"granted"!==f?[2,null]:[4,this.getSWRegistration_()];case 1:return n=u.sent(),[4,this.getPublicVapidKey_()];case 2:return i=u.sent(),[4,this.getPushSubscription(n,i)];case 3:return r=u.sent(),[4,this.tokenDetailsModel.getTokenDetailsFromSWScope(n.scope)];case 4:return(e=u.sent())?[2,this.manageExistingToken(n,r,i,e)]:[2,this.getNewToken(n,r,i)]}})})},n.prototype.manageExistingToken=function(n,t,i,f){return r(this,void 0,void 0,function(){return u(this,function(r){switch(r.label){case 0:return function(n,t,i){if(!i.vapidKey||!a(t.buffer,i.vapidKey.buffer))return!1;var r=n.endpoint===i.endpoint,u=a(n.getKey("auth"),i.auth),f=a(n.getKey("p256dh"),i.p256dh);return r&&u&&f}(t,i,f)?Date.now()<f.createTime+6048e5?[2,f.fcmToken]:[2,this.updateToken(n,t,i,f)]:[4,this.deleteTokenFromDB(f.fcmToken)];case 1:return r.sent(),[2,this.getNewToken(n,t,i)]}})})},n.prototype.updateToken=function(n,t,i,f){return r(this,void 0,void 0,function(){var r,e,o;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,4,,6]),[4,this.iidModel.updateToken(this.messagingSenderId,f.fcmToken,f.fcmPushSet,t,i)];case 1:return r=u.sent(),e={swScope:n.scope,vapidKey:i,fcmSenderId:this.messagingSenderId,fcmToken:r,fcmPushSet:f.fcmPushSet,createTime:Date.now(),endpoint:t.endpoint,auth:t.getKey("auth"),p256dh:t.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(e)];case 2:return u.sent(),[4,this.vapidDetailsModel.saveVapidDetails(n.scope,i)];case 3:return u.sent(),[2,r];case 4:return o=u.sent(),[4,this.deleteToken(f.fcmToken)];case 5:throw u.sent(),o;case 6:return[2]}})})},n.prototype.getNewToken=function(n,t,i){return r(this,void 0,void 0,function(){var r,f;return u(this,function(u){switch(u.label){case 0:return[4,this.iidModel.getToken(this.messagingSenderId,t,i)];case 1:return r=u.sent(),f={swScope:n.scope,vapidKey:i,fcmSenderId:this.messagingSenderId,fcmToken:r.token,fcmPushSet:r.pushSet,createTime:Date.now(),endpoint:t.endpoint,auth:t.getKey("auth"),p256dh:t.getKey("p256dh")},[4,this.tokenDetailsModel.saveTokenDetails(f)];case 2:return u.sent(),[4,this.vapidDetailsModel.saveVapidDetails(n.scope,i)];case 3:return u.sent(),[2,r.token]}})})},n.prototype.deleteToken=function(n){return r(this,void 0,void 0,function(){var t,i;return u(this,function(r){switch(r.label){case 0:return[4,this.deleteTokenFromDB(n)];case 1:return r.sent(),[4,this.getSWRegistration_()];case 2:return(t=r.sent())?[4,t.pushManager.getSubscription()]:[3,4];case 3:if(i=r.sent())return[2,i.unsubscribe()];r.label=4;case 4:return[2,!0]}})})},n.prototype.deleteTokenFromDB=function(n){return r(this,void 0,void 0,function(){var t;return u(this,function(i){switch(i.label){case 0:return[4,this.tokenDetailsModel.deleteToken(n)];case 1:return t=i.sent(),[4,this.iidModel.deleteToken(t.fcmSenderId,t.fcmToken,t.fcmPushSet)];case 2:return i.sent(),[2]}})})},n.prototype.getPushSubscription=function(n,t){return n.pushManager.getSubscription().then(function(i){return i||n.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:t})})},n.prototype.requestPermission=function(){throw t.create(o);},n.prototype.useServiceWorker=function(){throw t.create(o);},n.prototype.usePublicVapidKey=function(){throw t.create(o);},n.prototype.onMessage=function(){throw t.create(o);},n.prototype.onTokenRefresh=function(){throw t.create(o);},n.prototype.setBackgroundMessageHandler=function(){throw t.create(ii);},n.prototype.delete=function(){return r(this,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return[4,Promise.all([this.tokenDetailsModel.closeDatabase(),this.vapidDetailsModel.closeDatabase()])];case 1:return n.sent(),[2]}})})},n.prototype.getNotificationPermission_=function(){return Notification.permission},n.prototype.getTokenDetailsModel=function(){return this.tokenDetailsModel},n.prototype.getVapidDetailsModel=function(){return this.vapidDetailsModel},n.prototype.getIidModel=function(){return this.iidModel},n}(),yt="FCM_MSG",vr=function(n){function i(t){var i=n.call(this,t)||this;return i.bgMessageHandler=null,self.addEventListener("push",function(n){i.onPush(n)}),self.addEventListener("pushsubscriptionchange",function(n){i.onSubChange(n)}),self.addEventListener("notificationclick",function(n){i.onNotificationClick(n)}),i}return c(i,n),i.prototype.onPush=function(n){n.waitUntil(this.onPush_(n))},i.prototype.onSubChange=function(n){n.waitUntil(this.onSubChange_(n))},i.prototype.onNotificationClick=function(n){n.waitUntil(this.onNotificationClick_(n))},i.prototype.onPush_=function(n){return r(this,void 0,void 0,function(){var t,i,e,o,f,r;return u(this,function(u){switch(u.label){case 0:if(!n.data)return[2];try{t=n.data.json()}catch(u){return[2]}return[4,this.hasVisibleClients_()];case 1:return u.sent()?[2,this.sendMessageToWindowClients_(t)]:(i=this.getNotificationData_(t))?(e=i.title||"",[4,this.getSWRegistration_()]):[3,3];case 2:return o=u.sent(),f=i.actions,r=Notification.maxActions,f&&r&&f.length>r&&console.warn("This browser only supports "+r+" actions.The remaining actions will not be displayed."),[2,o.showNotification(e,i)];case 3:return this.bgMessageHandler?[4,this.bgMessageHandler(t)]:[3,5];case 4:return u.sent(),[2];case 5:return[2]}})})},i.prototype.onSubChange_=function(){return r(this,void 0,void 0,function(){var n,r,i,f;return u(this,function(u){switch(u.label){case 0:return u.trys.push([0,2,,3]),[4,this.getSWRegistration_()];case 1:return n=u.sent(),[3,3];case 2:throw r=u.sent(),t.create(ki,{message:r});case 3:return u.trys.push([3,5,,8]),[4,n.pushManager.getSubscription()];case 4:return u.sent(),[3,8];case 5:return i=u.sent(),[4,this.getTokenDetailsModel().getTokenDetailsFromSWScope(n.scope)];case 6:if(!(f=u.sent()))throw i;return[4,this.deleteToken(f.fcmToken)];case 7:throw u.sent(),i;case 8:return[2]}})})},i.prototype.onNotificationClick_=function(n){return r(this,void 0,void 0,function(){var t,r,i,f;return u(this,function(u){switch(u.label){case 0:return n.notification&&n.notification.data&&n.notification.data[yt]?n.action?[2]:(n.stopImmediatePropagation(),n.notification.close(),(t=n.notification.data[yt]).notification&&(r=t.fcmOptions&&t.fcmOptions.link||t.notification.click_action)?[4,this.getWindowClient_(r)]:[2]):[2];case 1:return(i=u.sent())?[3,3]:[4,self.clients.openWindow(r)];case 2:return i=u.sent(),[3,5];case 3:return[4,i.focus()];case 4:i=u.sent();u.label=5;case 5:return i?(delete t.notification,delete t.fcmOptions,f=rr(e.NOTIFICATION_CLICKED,t),[2,this.attemptToMessageClient_(i,f)]):[2]}})})},i.prototype.getNotificationData_=function(n){var i,t;if(n&&"object"==typeof n.notification)return t=v({},n.notification),t.data=v({},n.notification.data,((i={})[yt]=n,i)),t},i.prototype.setBackgroundMessageHandler=function(n){if(!n||"function"!=typeof n)throw t.create(wi);this.bgMessageHandler=n},i.prototype.getWindowClient_=function(n){return r(this,void 0,void 0,function(){var f,i,r,t;return u(this,function(u){switch(u.label){case 0:return f=new URL(n,self.location.href).href,[4,pt()];case 1:for(i=u.sent(),r=null,t=0;t<i.length;t++)if(new URL(i[t].url,self.location.href).href===f){r=i[t];break}return[2,r]}})})},i.prototype.attemptToMessageClient_=function(n,i){return r(this,void 0,void 0,function(){return u(this,function(){if(!n)throw t.create(bi);return n.postMessage(i),[2]})})},i.prototype.hasVisibleClients_=function(){return r(this,void 0,void 0,function(){return u(this,function(n){switch(n.label){case 0:return[4,pt()];case 1:return[2,n.sent().some(function(n){return"visible"===n.visibilityState})]}})})},i.prototype.sendMessageToWindowClients_=function(n){return r(this,void 0,void 0,function(){var t,i,r=this;return u(this,function(u){switch(u.label){case 0:return[4,pt()];case 1:return t=u.sent(),i=rr(e.PUSH_MSG_RECEIVED,n),[4,Promise.all(t.map(function(n){return r.attemptToMessageClient_(n,i)}))];case 2:return u.sent(),[2]}})})},i.prototype.getSWRegistration_=function(){return r(this,void 0,void 0,function(){return u(this,function(){return[2,self.registration]})})},i.prototype.getPublicVapidKey_=function(){return r(this,void 0,void 0,function(){var n,i;return u(this,function(r){switch(r.label){case 0:return[4,this.getSWRegistration_()];case 1:if(!(n=r.sent()))throw t.create(it);return[4,this.getVapidDetailsModel().getVapidFromSWScope(n.scope)];case 2:return null==(i=r.sent())?[2,k]:[2,i]}})})},i}(ir);fr=function(n){function i(t){var i=n.call(this,t)||this;return i.registrationToUse=null,i.publicVapidKeyToUse=null,i.manifestCheckPromise=null,i.messageObserver=null,i.tokenRefreshObserver=null,i.onMessageInternal=dt(function(n){i.messageObserver=n}),i.onTokenRefreshInternal=dt(function(n){i.tokenRefreshObserver=n}),i.setupSWMessageListener_(),i}return c(i,n),i.prototype.getToken=function(){return r(this,void 0,void 0,function(){return u(this,function(i){switch(i.label){case 0:return this.manifestCheckPromise||(this.manifestCheckPromise=function(){return r(this,void 0,void 0,function(){var i,n;return u(this,function(r){switch(r.label){case 0:if(!(i=document.querySelector('link[rel="manifest"]')))return[2];r.label=1;case 1:return r.trys.push([1,4,,5]),[4,fetch(i.href)];case 2:return[4,r.sent().json()];case 3:return n=r.sent(),[3,5];case 4:return r.sent(),[2];case 5:if(!n||!n.gcm_sender_id)return[2];if("103953800507"!==n.gcm_sender_id)throw t.create(ri);return[2]}})})}()),[4,this.manifestCheckPromise];case 1:return i.sent(),[2,n.prototype.getToken.call(this)]}})})},i.prototype.requestPermission=function(){return r(this,void 0,void 0,function(){var n;return u(this,function(i){switch(i.label){case 0:return"granted"===this.getNotificationPermission_()?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(n=i.sent()))return[2];throw"denied"===n?t.create(fi):t.create(ui);}})})},i.prototype.useServiceWorker=function(n){if(!(n instanceof ServiceWorkerRegistration))throw t.create(it);if(null!=this.registrationToUse)throw t.create(ai);this.registrationToUse=n},i.prototype.usePublicVapidKey=function(n){if("string"!=typeof n)throw t.create(gi);if(null!=this.publicVapidKeyToUse)throw t.create(sr);var i=d(n);if(65!==i.length)throw t.create(nr);this.publicVapidKeyToUse=i},i.prototype.onMessage=function(n,t,i){return"function"==typeof n?this.onMessageInternal(n,t,i):this.onMessageInternal(n)},i.prototype.onTokenRefresh=function(n,t,i){return"function"==typeof n?this.onTokenRefreshInternal(n,t,i):this.onTokenRefreshInternal(n)},i.prototype.waitForRegistrationToActivate_=function(n){var i=n.installing||n.waiting||n.active;return new Promise(function(r,u){if(i)if("activated"!==i.state)if("redundant"!==i.state){var f=function(){if("activated"===i.state)r(n);else{if("redundant"!==i.state)return;u(t.create(rt))}i.removeEventListener("statechange",f)};i.addEventListener("statechange",f)}else u(t.create(rt));else r(n);else u(t.create(di))})},i.prototype.getSWRegistration_=function(){var n=this;return this.registrationToUse?this.waitForRegistrationToActivate_(this.registrationToUse):(this.registrationToUse=null,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}).catch(function(n){throw t.create(si,{browserErrorMessage:n.message});}).then(function(t){return n.waitForRegistrationToActivate_(t).then(function(){return(n.registrationToUse=t).update(),t})}))},i.prototype.getPublicVapidKey_=function(){return r(this,void 0,void 0,function(){return u(this,function(){return this.publicVapidKeyToUse?[2,this.publicVapidKeyToUse]:[2,k]})})},i.prototype.setupSWMessageListener_=function(){var n=this;navigator.serviceWorker.addEventListener("message",function(t){var i,r;if(t.data&&t.data[f.TYPE_OF_MSG]){i=t.data;switch(i[f.TYPE_OF_MSG]){case e.PUSH_MSG_RECEIVED:case e.NOTIFICATION_CLICKED:r=i[f.DATA];n.messageObserver&&n.messageObserver.next(r)}}},!1)},i}(ir);ur={isSupported:er};n.INTERNAL.registerService("messaging",function(n){if(!er())throw t.create(ei);return self&&"ServiceWorkerGlobalScope"in self?new vr(n):new fr(n)},ur)}).apply(this,arguments)}catch(t){throw console.error(t),new Error("Cannot instantiate firebase-messaging - be sure to load firebase-app.js first.");}});"serviceWorker"in navigator?(config={apiKey:"AIzaSyDJuuzEjOzBBo-hR_LEsL2YAswL6biw-lQ",authDomain:"api-project-763980943412.firebaseapp.com",databaseURL:"https://api-project-763980943412.firebaseio.com",projectId:"api-project-763980943412",storageBucket:"api-project-763980943412.appspot.com",messagingSenderId:"763980943412"},firebase.initializeApp(config),messaging=firebase.messaging(),navigator.serviceWorker.register("/Scripts/firebase-messaging-sw.js").then(function(n){if(n.update(),messaging.useServiceWorker(n),$("#course-listing").length>0&&document.cookie.replace(/(?:(?:^|.*;\s*)requestNotificationPermission\s*\=\s*([^;]*).*$)|^.*$/,"$1")!=="true"){var t=new Date;t.setTime(t.getTime()+864e5);document.cookie="requestNotificationPermission=true; expires="+t.toGMTString()+";path=/";messaging.requestPermission().then(function(){messaging.getToken().then(function(n){$.ajax({url:"/Learning/SaveFcmToken",method:"post",data:{token:n},dataType:"text",success:function(){var t=new Date;t.setTime(t.getTime()+31536e6);document.cookie="fcmToken="+n+"; expires="+t.toGMTString()+";path=/"},error:function(){}})})}).catch(function(){})}messaging.onMessage(function(t){var i=t.data.title,r={body:t.data.messageBody,icon:"/images/web-notification-icon.png",actions:[],data:{clickUrl:t.data.url,contentId:t.data.content_id,clientId:t.data.client_id}};n.showNotification(i,r)})}).catch(function(){})):console.log("Service Worker is not supported in your browser.")