UNPKG

zego-zpns-web

Version:

ZEGO Push SDK for Web

1 lines 52.9 kB
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i,n=t();for(i in n)("object"==typeof exports?exports:e)[i]=n[i]}}("undefined"!=typeof self?self:this,(function(){return t=[function(e,t,i){"use strict";(function(e){i.d(t,"a",(function(){return s})),i.d(t,"b",(function(){return u})),i.d(t,"c",(function(){return p})),i.d(t,"d",(function(){return d})),i.d(t,"e",(function(){return r})),i.d(t,"f",(function(){return f})),i.d(t,"g",(function(){return g})),i.d(t,"h",(function(){return o})),i.d(t,"i",(function(){return c}));const n=function(e){const t=[];let i=0;for(let n=0;n<e.length;n++){let a=e.charCodeAt(n);a<128?t[i++]=a:(a<2048?t[i++]=a>>6|192:(55296==(64512&a)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(a=65536+((1023&a)<<10)+(1023&e.charCodeAt(++n)),t[i++]=a>>18|240,t[i++]=a>>12&63|128):t[i++]=a>>12|224,t[i++]=a>>6&63|128),t[i++]=63&a|128)}return t},a={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(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();var i=t?this.byteToCharMapWebSafe_:this.byteToCharMap_;const n=[];for(let t=0;t<e.length;t+=3){var a=e[t],r=t+1<e.length,s=r?e[t+1]:0,o=t+2<e.length,c=o?e[t+2]:0;let d=(15&s)<<2|c>>6,p=63&c;o||(p=64,r||(d=64)),n.push(i[a>>2],i[(3&a)<<4|s>>4],i[d],i[p])}return n.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(n(e),t)},decodeString(e,t){if(this.HAS_NATIVE_SUPPORT&&!t)return atob(e);{var i=this.decodeStringToByteArray(e,t);const o=[];let c=0,d=0;for(;c<i.length;){var n,a,r,s=i[c++];s<128?o[d++]=String.fromCharCode(s):191<s&&s<224?(n=i[c++],o[d++]=String.fromCharCode((31&s)<<6|63&n)):239<s&&s<365?(n=((7&s)<<18|(63&i[c++])<<12|(63&i[c++])<<6|63&i[c++])-65536,o[d++]=String.fromCharCode(55296+(n>>10)),o[d++]=String.fromCharCode(56320+(1023&n))):(a=i[c++],r=i[c++],o[d++]=String.fromCharCode((15&s)<<12|(63&a)<<6|63&r))}return o.join("")}},decodeStringToByteArray(e,t){this.init_();var i=t?this.charToByteMapWebSafe_:this.charToByteMap_;const n=[];for(let t=0;t<e.length;){var a=i[e.charAt(t++)],r=t<e.length?i[e.charAt(t)]:0,s=++t<e.length?i[e.charAt(t)]:64,o=++t<e.length?i[e.charAt(t)]:64;if(++t,null==a||null==r||null==s||null==o)throw Error();n.push(a<<2|r>>4),64!==s&&(n.push(r<<4&240|s>>2),64!==o&&n.push(s<<6&192|o))}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),(this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},r=function(e){return function(e){return e=n(e),a.encodeByteArray(e,!0)}(e).replace(/\./g,"")};class s{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,i)=>{t?this.reject(t):this.resolve(i),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,i))}}}function o(){return"object"==typeof indexedDB}function c(){return new Promise((e,t)=>{try{let i=!0;const n="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(n);a.onsuccess=()=>{a.result.close(),i||self.indexedDB.deleteDatabase(n),e(!0)},a.onupgradeneeded=()=>{i=!1},a.onerror=()=>{var e;t((null==(e=a.error)?void 0:e.message)||"")}}catch(e){t(e)}})}function d(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class p extends Error{constructor(e,t,i){super(t),this.code=e,this.customData=i,this.name="FirebaseError",Object.setPrototypeOf(this,p.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,u.prototype.create)}}class u{constructor(e,t,i){this.service=e,this.serviceName=t,this.errors=i}create(e,...t){t=t[0]||{};var i,n=this.service+"/"+e;e=(e=this.errors[e])?(i=t,e.replace(l,(e,t)=>{var n=i[t];return null!=n?String(n):`<${t}?>`})):"Error",e=this.serviceName+`: ${e} (${n}).`;return new p(n,e,t)}}const l=/\{\$([^}]+)}/g;function f(e,t){if(e===t)return!0;const i=Object.keys(e),n=Object.keys(t);for(const s of i){if(!n.includes(s))return!1;var a=e[s],r=t[s];if(h(a)&&h(r)){if(!f(a,r))return!1}else if(a!==r)return!1}for(const e of n)if(!i.includes(e))return!1;return!0}function h(e){return null!==e&&"object"==typeof e}function g(e){return e&&e._delegate?e._delegate:e}}).call(this,i(5))},function(e,t,i){"use strict";i.d(t,"a",(function(){return v})),i.d(t,"b",(function(){return w})),i.d(t,"c",(function(){return k})),i.d(t,"d",(function(){return S})),i.d(t,"e",(function(){return x}));var n,a=i(2);const r=[],s=((t=n=n||{})[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT",{debug:n.DEBUG,verbose:n.VERBOSE,info:n.INFO,warn:n.WARN,error:n.ERROR,silent:n.SILENT}),o=n.INFO,c={[n.DEBUG]:"log",[n.VERBOSE]:"log",[n.INFO]:"info",[n.WARN]:"warn",[n.ERROR]:"error"},d=(e,t)=>{if(!(t<e.logLevel||((new Date).toISOString(),e=c[t])))throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`)};var p=i(0),u=i(3);class l{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>function(e){return"VERSION"===(null==(e=e.getComponent())?void 0:e.type)}(e)?(e=e.getImmediate()).library+"/"+e.version:null).filter(e=>e).join(" ")}}const f="@firebase/app",h=new class{constructor(e){this.name=e,this._logLevel=o,this._logHandler=d,this._userLogHandler=null,r.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in n))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?s[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,n.DEBUG,...e),this._logHandler(this,n.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,n.VERBOSE,...e),this._logHandler(this,n.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,n.INFO,...e),this._logHandler(this,n.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,n.WARN,...e),this._logHandler(this,n.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,n.ERROR,...e),this._logHandler(this,n.ERROR,...e)}}("@firebase/app"),g="[DEFAULT]",m={"@firebase/app":"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},b=new Map,y=new Map;function w(e){var t=e.name;if(y.has(t))return h.debug(`There were multiple attempts to register component ${t}.`),!1;y.set(t,e);for(const t of b.values()){i=void 0;var i=t,n=e;try{i.container.addComponent(n)}catch(e){h.debug(`Component ${n.name} failed to register with FirebaseApp `+i.name,e)}}return!0}function v(e,t){const i=e.container.getProvider("heartbeat").getImmediate({optional:!0});return i&&i.triggerHeartbeat(),e.container.getProvider(t)}const j=new p.b("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","storage-open":"Error thrown when opening storage. Original error: {$originalErrorMessage}.","storage-get":"Error thrown when reading from storage. Original error: {$originalErrorMessage}.","storage-set":"Error thrown when writing to storage. Original error: {$originalErrorMessage}.","storage-delete":"Error thrown when deleting from storage. Original error: {$originalErrorMessage}."});class I{constructor(e,t,i){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=i,this.container.addComponent(new a.a("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw j.create("app-deleted",{appName:this._name})}}function S(e,t={}){if("object"!=typeof t){t={name:t}}const i=(t=Object.assign({name:g,automaticDataCollectionEnabled:!1},t)).name;if("string"!=typeof i||!i)throw j.create("bad-app-name",{appName:String(i)});var n=b.get(i);if(n){if(Object(p.f)(e,n.options)&&Object(p.f)(t,n.config))return n;throw j.create("duplicate-app",{appName:i})}const r=new a.b(i);for(const e of y.values())r.addComponent(e);return n=new I(e,t,r),b.set(i,n),n}function k(e=g){var t=b.get(e);if(t)return t;throw j.create("no-app",{appName:e})}function x(e,t,i){let n=null!=(r=m[e])?r:e;i&&(n+="-"+i);var r=n.match(/\s|\//);e=t.match(/\s|\//);if(r||e){const i=[`Unable to register library "${n}" with version "${t}":`];return r&&i.push(`library name "${n}" contains illegal characters (whitespace or "/")`),r&&e&&i.push("and"),e&&i.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void h.warn(i.join(" "))}w(new a.a(n+"-version",()=>({library:n,version:t}),"VERSION"))}const C="firebase-heartbeat-store";let _=null;function E(){return _=_||Object(u.b)("firebase-heartbeat-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(C)}}).catch(e=>{throw j.create("storage-open",{originalErrorMessage:e.message})})}async function O(e,t){try{const i=(await E()).transaction(C,"readwrite"),n=i.objectStore(C);return await n.put(t,D(e)),i.done}catch(e){throw j.create("storage-set",{originalErrorMessage:null==(t=e)?void 0:t.message})}}function D(e){return e.name+"!"+e.options.appId}class T{constructor(e){this.container=e,this._heartbeatsCache=null,e=this.container.getProvider("app").getImmediate(),this._storage=new P(e),this._heartbeatsCachePromise=this._storage.read().then(e=>this._heartbeatsCache=e)}async triggerHeartbeat(){var e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString();const t=A();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==t&&!this._heartbeatsCache.heartbeats.some(e=>e.date===t))return this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(e=>(e=new Date(e.date).valueOf(),Date.now()-e<=2592e6)),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";var e=A(),{heartbeatsToSend:t,unsentEntries:i}=function(e,t=1024){const i=[];let n=e.slice();for(const a of e){const e=i.find(e=>e.agent===a.agent);if(e){if(e.dates.push(a.date),N(i)>t){e.dates.pop();break}}else if(i.push({agent:a.agent,dates:[a.date]}),N(i)>t){i.pop();break}n=n.slice(1)}return{heartbeatsToSend:i,unsentEntries:n}}(this._heartbeatsCache.heartbeats),t=Object(p.e)(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,0<i.length?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),t}}function A(){return(new Date).toISOString().substring(0,10)}class P{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!Object(p.h)()&&Object(p.i)().then(()=>!0).catch(()=>!1)}async read(){return await this._canUseIndexedDBPromise&&await async function(e){try{return(await E()).transaction(C).objectStore(C).get(D(e))}catch(t){throw j.create("storage-get",{originalErrorMessage:null==(e=t)?void 0:e.message})}}(this.app)||{heartbeats:[]}}async overwrite(e){var t,i;if(await this._canUseIndexedDBPromise)return i=await this.read(),O(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}async add(e){var t,i;if(await this._canUseIndexedDBPromise)return i=await this.read(),O(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}}function N(e){return Object(p.e)(JSON.stringify({version:2,heartbeats:e})).length}t="",w(new a.a("platform-logger",e=>new l(e),"PRIVATE")),w(new a.a("heartbeat",e=>new T(e),"PRIVATE")),x(f,"0.7.28",t),x(f,"0.7.28","esm2017"),x("fire-js","")},function(e,t,i){"use strict";i.d(t,"a",(function(){return a})),i.d(t,"b",(function(){return o}));var n=i(0);class a{constructor(e,t,i){this.name=e,this.instanceFactory=t,this.type=i,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const r="[DEFAULT]";class s{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){if(e=this.normalizeInstanceIdentifier(e),!this.instancesDeferred.has(e)){const i=new n.a;if(this.instancesDeferred.set(e,i),this.isInitialized(e)||this.shouldAutoInitialize())try{var t=this.getOrInitializeService({instanceIdentifier:e});t&&i.resolve(t)}catch(e){}}return this.instancesDeferred.get(e).promise}getImmediate(e){var t=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier);e=null!=(e=null==e?void 0:e.optional)&&e;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(e)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(t){if(e)return null;throw t}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:r})}catch(e){}for(var[t,i]of this.instancesDeferred.entries()){t=this.normalizeInstanceIdentifier(t);try{var n=this.getOrInitializeService({instanceIdentifier:t});i.resolve(n)}catch(e){}}}}clearInstance(e=r){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=r){return this.instances.has(e)}getOptions(e=r){return this.instancesOptions.get(e)||{}}initialize(e={}){var{options:t={}}=e,i=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(i))throw Error(this.name+`(${i}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);var n,a,r=this.getOrInitializeService({instanceIdentifier:i,options:t});for([n,a]of this.instancesDeferred.entries())i===this.normalizeInstanceIdentifier(n)&&a.resolve(r);return r}onInit(e,t){t=this.normalizeInstanceIdentifier(t);const i=null!=(n=this.onInitCallbacks.get(t))?n:new Set;i.add(e),this.onInitCallbacks.set(t,i);var n=this.instances.get(t);return n&&e(n,t),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){var i=this.onInitCallbacks.get(t);if(i)for(const n of i)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let i=this.instances.get(e);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e)===r?void 0:n,options:t}),this.instances.set(e,i),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(i,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,i)}catch(e){}var n;return i||null}normalizeInstanceIdentifier(e=r){return!this.component||this.component.multipleInstances?e:r}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class o{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with `+this.name);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);var t=new s(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}},function(e,t,i){"use strict";i.d(t,"a",(function(){return g})),i.d(t,"b",(function(){return h}));let n,a;const r=new WeakMap,s=new WeakMap,o=new WeakMap,c=new WeakMap,d=new WeakMap;let p={get(e,t,i){if(e instanceof IDBTransaction){if("done"===t)return s.get(e);if("objectStoreNames"===t)return e.objectStoreNames||o.get(e);if("store"===t)return i.objectStoreNames[1]?void 0:i.objectStore(i.objectStoreNames[0])}return l(e[t])},set:(e,t,i)=>(e[t]=i,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function u(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(a=a||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(e)?function(...t){return e.apply(f(this),t),l(r.get(this))}:function(...t){return l(e.apply(f(this),t))}:function(t,...i){return i=e.call(f(this),t,...i),o.set(i,t.sort?t.sort():[t]),l(i)}}function l(e){if(e instanceof IDBRequest){var t=e;const i=new Promise((e,i)=>{const n=()=>{t.removeEventListener("success",a),t.removeEventListener("error",r)},a=()=>{e(l(t.result)),n()},r=()=>{i(t.error),n()};t.addEventListener("success",a),t.addEventListener("error",r)});return i.then(e=>{e instanceof IDBCursor&&r.set(e,t)}).catch(()=>{}),d.set(i,t),i}if(c.has(e))return c.get(e);var i=function(e){return"function"==typeof e?u(e):(e instanceof IDBTransaction&&(t=e,s.has(t)||(i=new Promise((e,i)=>{const n=()=>{t.removeEventListener("complete",a),t.removeEventListener("error",r),t.removeEventListener("abort",r)},a=()=>{e(),n()},r=()=>{i(t.error||new DOMException("AbortError","AbortError")),n()};t.addEventListener("complete",a),t.addEventListener("error",r),t.addEventListener("abort",r)}),s.set(t,i))),((e,t)=>t.some(t=>e instanceof t))(e,n=n||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])?new Proxy(e,p):e);var t,i}(e);return i!==e&&(c.set(e,i),d.set(i,e)),i}const f=e=>d.get(e);function h(e,t,{blocked:i,upgrade:n,blocking:a,terminated:r}={}){const s=indexedDB.open(e,t),o=l(s);return n&&s.addEventListener("upgradeneeded",e=>{n(l(s.result),e.oldVersion,e.newVersion,l(s.transaction))}),i&&s.addEventListener("blocked",()=>i()),o.then(e=>{r&&e.addEventListener("close",()=>r()),a&&e.addEventListener("versionchange",()=>a())}).catch(()=>{}),o}function g(e,{blocked:t}={}){const i=indexedDB.deleteDatabase(e);return t&&i.addEventListener("blocked",()=>t()),l(i).then(()=>{})}const m=["get","getKey","getAll","getAllKeys","count"],b=["put","add","delete","clear"],y=new Map;function w(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(y.get(t))return y.get(t);const i=t.replace(/FromIndex$/,""),n=t!==i,a=b.includes(i);return i in(n?IDBIndex:IDBObjectStore).prototype&&(a||m.includes(i))?(e=async function(e,...t){let r=(e=this.transaction(e,a?"readwrite":"readonly")).store;return n&&(r=r.index(t.shift())),(await Promise.all([r[i](...t),a&&e.done]))[0]},y.set(t,e),e):void 0}}var v;p={...v=p,get:(e,t,i)=>w(e,t)||v.get(e,t,i),has:(e,t)=>!!w(e,t)||v.has(e,t)}},function(e,t,i){"use strict";var n=i(1);i.d(t,"a",(function(){return n.d})),Object(n.e)("firebase","9.9.0","app")},function(e,t){var i=function(){return this}();try{i=i||new Function("return this")()}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t,i){"use strict";var n=i(1),a=i(2),r=i(0),s=i(3),o=(i="@firebase/installations","0.5.12");const c="w:"+o,d="FIS_v2",p=new r.b("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function u(e){return e instanceof r.c&&e.code.includes("request-failed")}function l({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function f(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}async function h(e,t){return t=(await t.json()).error,p.create("request-failed",{requestName:e,serverCode:t.code,serverMessage:t.message,serverStatus:t.status})}function g({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function m(e,{refreshToken:t}){const i=g(e);return i.append("Authorization",d+" "+(e=t)),i}async function b(e){var t=await e();return 500<=t.status&&t.status<600?e():t}function y(e){return new Promise(t=>{setTimeout(t,e)})}const w=/^[cdef][\w-]{21}$/;function v(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;var e=function(e){return function(e){return btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_")}(e).substr(0,22)}(t);return w.test(e)?e:""}catch(e){return""}}function j(e){return e.appName+"!"+e.appId}const I=new Map;function S(e,t){k(e=j(e),t);{const i=(!x&&"BroadcastChannel"in self&&((x=new BroadcastChannel("[Firebase] FID Change")).onmessage=e=>{k(e.data.key,e.data.fid)}),x);return i&&i.postMessage({key:e,fid:t}),void(0===I.size&&x&&(x.close(),x=null))}}function k(e,t){if(e=I.get(e))for(const i of e)i(t)}let x=null;const C="firebase-installations-store";let _=null;function E(){return _=_||Object(s.b)("firebase-installations-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(C)}})}async function O(e,t){var i=j(e);const n=(await E()).transaction(C,"readwrite"),a=n.objectStore(C);var r=await a.get(i);return await a.put(t,i),await n.done,r&&r.fid===t.fid||S(e,t.fid),t}async function D(e){e=j(e);const t=(await E()).transaction(C,"readwrite");await t.objectStore(C).delete(e),await t.done}async function T(e,t){var i=j(e);const n=(await E()).transaction(C,"readwrite"),a=n.objectStore(C);var r=await a.get(i);return void 0===(t=t(r))?await a.delete(i):await a.put(t,i),await n.done,!t||r&&r.fid===t.fid||S(e,t.fid),t}async function A(e){let t;var i=await T(e.appConfig,i=>(i=function(e){return N(e=e||{fid:v(),registrationStatus:0})}(i),i=function(e,t){if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:async function(e){let t=await P(e.appConfig);for(;1===t.registrationStatus;)await y(100),t=await P(e.appConfig);if(0!==t.registrationStatus)return t;var{installationEntry:i,registrationPromise:n}=await A(e);return n||i}(e)}:{installationEntry:t};if(!navigator.onLine)return{installationEntry:t,registrationPromise:i=Promise.reject(p.create("app-offline"))};var i={fid:t.fid,registrationStatus:1,registrationTime:Date.now()};return{installationEntry:i,registrationPromise:t=async function(e,t){try{var i=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:i}){const n=l(e),a=g(e),r=t.getImmediate({optional:!0}),s=(r&&(t=await r.getHeartbeatsHeader())&&a.append("x-firebase-client",t),t={fid:i,authVersion:d,appId:e.appId,sdkVersion:c},{method:"POST",headers:a,body:JSON.stringify(t)}),o=await b(()=>fetch(n,s));if(o.ok)return{fid:(e=await o.json()).fid||i,registrationStatus:2,refreshToken:e.refreshToken,authToken:f(e.authToken)};throw await h("Create Installation",o)}(e,t);return O(e.appConfig,i)}catch(i){throw u(i)&&409===i.customData.serverCode?await D(e.appConfig):await O(e.appConfig,{fid:t.fid,registrationStatus:0}),i}}(e,i)}}(e,i),t=i.registrationPromise,i.installationEntry));return""===i.fid?{installationEntry:await t}:{installationEntry:i,registrationPromise:t}}function P(e){return T(e,e=>{if(e)return N(e);throw p.create("installation-not-found")})}function N(e){return 1===(t=e).registrationStatus&&t.registrationTime+1e4<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function M(e,t=!1){let i;var n=await T(e.appConfig,n=>{if(!L(n))throw p.create("not-registered");var a,r=n.authToken;if(t||2!==(a=r).requestStatus||function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+36e5}(a)){if(1===r.requestStatus)return i=async function(e,t){let i=await B(e.appConfig);for(;1===i.authToken.requestStatus;)await y(100),i=await B(e.appConfig);var n=i.authToken;return 0===n.requestStatus?M(e,t):n}(e,t),n;if(!navigator.onLine)throw p.create("app-offline");return a=n,r={requestStatus:1,requestTime:Date.now()},r=Object.assign(Object.assign({},a),{authToken:r}),i=async function(e,t){try{var i=await async function({appConfig:e,heartbeatServiceProvider:t},i){[a,o]=[e,i.fid];const n=l(a)+`/${o}/authTokens:generate`;var a;const r=m(e,i),s=t.getImmediate({optional:!0});s&&(a=await s.getHeartbeatsHeader())&&r.append("x-firebase-client",a);var o={installation:{sdkVersion:c,appId:e.appId}};const d={method:"POST",headers:r,body:JSON.stringify(o)},p=await b(()=>fetch(n,d));if(p.ok)return f(await p.json());throw await h("Generate Auth Token",p)}(e,t),n=Object.assign(Object.assign({},t),{authToken:i});return await O(e.appConfig,n),i}catch(i){throw!u(i)||401!==i.customData.serverCode&&404!==i.customData.serverCode?(n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}}),await O(e.appConfig,n)):await D(e.appConfig),i}}(e,r),r}return n});return i?await i:n.authToken}function B(e){return T(e,e=>{if(!L(e))throw p.create("not-registered");var t=e.authToken;return 1===(t=t).requestStatus&&t.requestTime+1e4<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e})}function L(e){return void 0!==e&&2===e.registrationStatus}function R(e){return p.create("missing-app-config-values",{valueName:e})}const H="installations";Object(n.b)(new a.a(H,e=>({app:e=e.getProvider("app").getImmediate(),appConfig:function(e){if(!e||!e.options)throw R("App Configuration");if(!e.name)throw R("App Name");for(const t of["projectId","apiKey","appId"])if(!e.options[t])throw R(t);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(e),heartbeatServiceProvider:Object(n.a)(e,"heartbeat"),_delete:()=>Promise.resolve()}),"PUBLIC")),Object(n.b)(new a.a("installations-internal",e=>{e=e.getProvider("app").getImmediate();const t=Object(n.a)(e,H).getImmediate();return{getId:()=>async function(e){const{installationEntry:t,registrationPromise:i}=await A(e);return(i||M(e)).catch(console.error),t.fid}(t),getToken:e=>async function(e,t=!1){var i=e;return(i=(await A(i)).registrationPromise)&&await i,await 0,(await M(e,t)).token}(t,e)}},"PRIVATE")),Object(n.e)(i,o),Object(n.e)(i,o,"esm2017")},function(e){e.exports=JSON.parse('{"name":"firebase","version":"9.9.0","description":"Firebase JavaScript library for web and Node.js","author":"Firebase <firebase-support@google.com> (https://firebase.google.com/)","license":"Apache-2.0","homepage":"https://firebase.google.com/","keywords":["authentication","database","Firebase","firebase","realtime","storage","performance","remote-config"],"files":["**/dist/","**/package.json","/firebase*.js","/firebase*.map","compat/index.d.ts"],"exports":{"./analytics":{"types":"./analytics/dist/analytics/index.d.ts","node":{"require":"./analytics/dist/index.cjs.js","import":"./analytics/dist/index.mjs"},"default":"./analytics/dist/index.esm.js"},"./app":{"types":"./app/dist/app/index.d.ts","node":{"require":"./app/dist/index.cjs.js","import":"./app/dist/index.mjs"},"default":"./app/dist/index.esm.js"},"./app-check":{"types":"./app-check/dist/app-check/index.d.ts","node":{"require":"./app-check/dist/index.cjs.js","import":"./app-check/dist/index.mjs"},"default":"./app-check/dist/index.esm.js"},"./auth":{"types":"./auth/dist/auth/index.d.ts","node":{"require":"./auth/dist/index.cjs.js","import":"./auth/dist/index.mjs"},"default":"./auth/dist/index.esm.js"},"./auth/cordova":{"types":"./auth/cordova/dist/auth/cordova/index.d.ts","node":{"require":"./auth/cordova/dist/index.cjs.js","import":"./auth/cordova/dist/index.mjs"},"default":"./auth/cordova/dist/index.esm.js"},"./auth/react-native":{"types":"./auth/react-native/dist/auth/react-native/index.d.ts","node":{"require":"./auth/react-native/dist/index.cjs.js","import":"./auth/react-native/dist/index.mjs"},"default":"./auth/react-native/dist/index.esm.js"},"./database":{"types":"./database/dist/database/index.d.ts","node":{"require":"./database/dist/index.cjs.js","import":"./database/dist/index.mjs"},"default":"./database/dist/index.esm.js"},"./firestore":{"types":"./firestore/dist/firestore/index.d.ts","node":{"require":"./firestore/dist/index.cjs.js","import":"./firestore/dist/index.mjs"},"default":"./firestore/dist/index.esm.js"},"./firestore/lite":{"types":"./firestore/lite/dist/firestore/lite/index.d.ts","node":{"require":"./firestore/lite/dist/index.cjs.js","import":"./firestore/lite/dist/index.mjs"},"default":"./firestore/lite/dist/index.esm.js"},"./functions":{"types":"./functions/dist/functions/index.d.ts","node":{"require":"./functions/dist/index.cjs.js","import":"./functions/dist/index.mjs"},"default":"./functions/dist/index.esm.js"},"./installations":{"types":"./installations/dist/installations/index.d.ts","node":{"require":"./installations/dist/index.cjs.js","import":"./installations/dist/index.mjs"},"default":"./installations/dist/index.esm.js"},"./messaging":{"types":"./messaging/dist/messaging/index.d.ts","node":{"require":"./messaging/dist/index.cjs.js","import":"./messaging/dist/index.mjs"},"default":"./messaging/dist/index.esm.js"},"./messaging/sw":{"types":"./messaging/sw/dist/messaging/sw/index.d.ts","node":{"require":"./messaging/sw/dist/index.cjs.js","import":"./messaging/sw/dist/index.mjs"},"default":"./messaging/sw/dist/index.esm.js"},"./performance":{"types":"./performance/dist/performance/index.d.ts","node":{"require":"./performance/dist/index.cjs.js","import":"./performance/dist/index.mjs"},"default":"./performance/dist/index.esm.js"},"./remote-config":{"types":"./remote-config/dist/remote-config/index.d.ts","node":{"require":"./remote-config/dist/index.cjs.js","import":"./remote-config/dist/index.mjs"},"default":"./remote-config/dist/index.esm.js"},"./storage":{"types":"./storage/dist/storage/index.d.ts","node":{"require":"./storage/dist/index.cjs.js","import":"./storage/dist/index.mjs"},"default":"./storage/dist/index.esm.js"},"./compat/analytics":{"types":"./compat/analytics/dist/compat/analytics/index.d.ts","node":{"require":"./compat/analytics/dist/index.cjs.js","import":"./compat/analytics/dist/index.mjs"},"default":"./compat/analytics/dist/index.esm.js"},"./compat/app":{"types":"./compat/app/dist/compat/app/index.d.ts","node":{"require":"./compat/app/dist/index.cjs.js","import":"./compat/app/dist/index.mjs"},"default":"./compat/app/dist/index.esm.js"},"./compat/app-check":{"types":"./compat/app-check/dist/compat/app-check/index.d.ts","node":{"require":"./compat/app-check/dist/index.cjs.js","import":"./compat/app-check/dist/index.mjs"},"default":"./compat/app-check/dist/index.esm.js"},"./compat/auth":{"types":"./compat/auth/dist/compat/auth/index.d.ts","node":{"require":"./compat/auth/dist/index.cjs.js","import":"./compat/auth/dist/index.mjs"},"default":"./compat/auth/dist/index.esm.js"},"./compat/database":{"types":"./compat/database/dist/compat/database/index.d.ts","node":{"require":"./compat/database/dist/index.cjs.js","import":"./compat/database/dist/index.mjs"},"default":"./compat/database/dist/index.esm.js"},"./compat/firestore":{"types":"./compat/firestore/dist/compat/firestore/index.d.ts","node":{"require":"./compat/firestore/dist/index.cjs.js","import":"./compat/firestore/dist/index.mjs"},"default":"./compat/firestore/dist/index.esm.js"},"./compat/functions":{"types":"./compat/functions/dist/compat/functions/index.d.ts","node":{"require":"./compat/functions/dist/index.cjs.js","import":"./compat/functions/dist/index.mjs"},"default":"./compat/functions/dist/index.esm.js"},"./compat/installations":{"types":"./compat/installations/dist/compat/installations/index.d.ts","node":{"require":"./compat/installations/dist/index.cjs.js","import":"./compat/installations/dist/index.mjs"},"default":"./compat/installations/dist/index.esm.js"},"./compat/messaging":{"types":"./compat/messaging/dist/compat/messaging/index.d.ts","node":{"require":"./compat/messaging/dist/index.cjs.js","import":"./compat/messaging/dist/index.mjs"},"default":"./compat/messaging/dist/index.esm.js"},"./compat/performance":{"types":"./compat/performance/dist/compat/performance/index.d.ts","node":{"require":"./compat/performance/dist/index.cjs.js","import":"./compat/performance/dist/index.mjs"},"default":"./compat/performance/dist/index.esm.js"},"./compat/remote-config":{"types":"./compat/remote-config/dist/compat/remote-config/index.d.ts","node":{"require":"./compat/remote-config/dist/index.cjs.js","import":"./compat/remote-config/dist/index.mjs"},"default":"./compat/remote-config/dist/index.esm.js"},"./compat/storage":{"types":"./compat/storage/dist/compat/storage/index.d.ts","node":{"require":"./compat/storage/dist/index.cjs.js","import":"./compat/storage/dist/index.mjs"},"default":"./compat/storage/dist/index.esm.js"},"./package.json":"./package.json"},"repository":{"type":"git","url":"https://github.com/firebase/firebase-js-sdk.git"},"scripts":{"build":"rollup -c && gulp cdn-type-module-path && yarn build:compat","build:compat":"rollup -c compat/rollup.config.js","dev":"rollup -c -w","test":"echo \'No test suite for firebase wrapper\'","test:ci":"echo \'No test suite for firebase wrapper\'"},"dependencies":{"@firebase/app":"0.7.28","@firebase/app-compat":"0.1.29","@firebase/app-types":"0.7.0","@firebase/auth":"0.20.5","@firebase/auth-compat":"0.2.18","@firebase/database":"0.13.3","@firebase/database-compat":"0.2.3","@firebase/firestore":"3.4.12","@firebase/firestore-compat":"0.1.21","@firebase/functions":"0.8.4","@firebase/functions-compat":"0.2.4","@firebase/installations":"0.5.12","@firebase/installations-compat":"0.1.12","@firebase/messaging":"0.9.16","@firebase/messaging-compat":"0.1.16","@firebase/polyfill":"0.3.36","@firebase/storage":"0.9.9","@firebase/storage-compat":"0.1.17","@firebase/performance":"0.5.12","@firebase/performance-compat":"0.1.12","@firebase/remote-config":"0.3.11","@firebase/remote-config-compat":"0.1.12","@firebase/analytics":"0.8.0","@firebase/analytics-compat":"0.1.13","@firebase/app-check":"0.5.11","@firebase/app-check-compat":"0.2.11","@firebase/util":"1.6.3"},"devDependencies":{"rollup":"2.72.1","@rollup/plugin-commonjs":"21.1.0","@rollup/plugin-node-resolve":"13.3.0","rollup-plugin-sourcemaps":"0.6.3","rollup-plugin-terser":"7.0.2","rollup-plugin-typescript2":"0.31.2","rollup-plugin-uglify":"6.0.4","gulp":"4.0.2","gulp-sourcemaps":"3.0.0","gulp-replace":"1.1.3","typescript":"4.2.2"},"components":["analytics","app","app-check","auth","auth/cordova","auth/react-native","functions","firestore","firestore/lite","installations","storage","performance","remote-config","messaging","messaging/sw","database"],"typings":"empty.d.ts"}')},function(e,t,i){"use strict";i.r(t),i.d(t,"ZPNs",(function(){return M}));var n,a,r=i(4),s=(t=(i(6),i(2)),i(3)),o=i(0),c=i(1);const d="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",p="google.c.a.c_id";function u(e){e=new Uint8Array(e);return btoa(String.fromCharCode(...e)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}(a=n=n||{}).PUSH_RECEIVED="push-received",a.NOTIFICATION_CLICKED="notification-clicked";const l="fcm_token_details_db",f="fcm_token_object_Store";const h="firebase-messaging-store";let g=null;function m(){return g=g||Object(s.b)("firebase-messaging-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(h)}})}async function b(e){var t=w(e);const i=await m();return(t=await i.transaction(h).objectStore(h).get(t))?t:(t=await async function(e){if("databases"in indexedDB){if(!(await indexedDB.databases()).map(e=>e.name).includes(l))return null}let t=null;return(await Object(s.b)(l,5,{upgrade:async(i,n,a,r)=>{if(!(n<2)&&i.objectStoreNames.contains(f)){const a=r.objectStore(f);var s;i=await a.index("fcmSenderId").get(e);await a.clear(),i&&(2===n?(r=i).auth&&r.p256dh&&r.endpoint&&(t={token:r.fcmToken,createTime:null!=(s=r.createTime)?s:Date.now(),subscriptionOptions:{auth:r.auth,p256dh:r.p256dh,endpoint:r.endpoint,swScope:r.swScope,vapidKey:"string"==typeof r.vapidKey?r.vapidKey:u(r.vapidKey)}}):3===n?t={token:(s=i).fcmToken,createTime:s.createTime,subscriptionOptions:{auth:u(s.auth),p256dh:u(s.p256dh),endpoint:s.endpoint,swScope:s.swScope,vapidKey:u(s.vapidKey)}}:4===n&&(t={token:(r=i).fcmToken,createTime:r.createTime,subscriptionOptions:{auth:u(r.auth),p256dh:u(r.p256dh),endpoint:r.endpoint,swScope:r.swScope,vapidKey:u(r.vapidKey)}}))}}})).close(),await Object(s.a)(l),await Object(s.a)("fcm_vapid_details_db"),await Object(s.a)("undefined"),function(e){if(e&&e.subscriptionOptions){var t=e.subscriptionOptions;return"number"==typeof e.createTime&&0<e.createTime&&"string"==typeof e.token&&0<e.token.length&&"string"==typeof t.auth&&0<t.auth.length&&"string"==typeof t.p256dh&&0<t.p256dh.length&&"string"==typeof t.endpoint&&0<t.endpoint.length&&"string"==typeof t.swScope&&0<t.swScope.length&&"string"==typeof t.vapidKey&&0<t.vapidKey.length}}(t)?t:null}(e.appConfig.senderId))?(await y(e,t),t):void 0}async function y(e,t){e=w(e);const i=(await m()).transaction(h,"readwrite");return await i.objectStore(h).put(t,e),await i.done,t}function w({appConfig:e}){return e.appId}const v=new o.b("messaging","Messaging",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."});async function j(e,t){var i={method:"DELETE",headers:await S(e)};try{const r=await fetch(I(e.appConfig)+"/"+t,i);var n,a=await r.json();if(a.error)throw n=a.error.message,v.create("token-unsubscribe-failed",{errorInfo:n})}catch(t){throw v.create("token-unsubscribe-failed",{errorInfo:null==(e=t)?void 0:e.toString()})}}function I({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function S({appConfig:e,installations:t}){return t=await t.getToken(),new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":"FIS "+t})}function k({p256dh:e,auth:t,endpoint:i,vapidKey:n}){const a={web:{endpoint:i,auth:t,p256dh:e}};return n!==d&&(a.web.applicationPubKey=n),a}async function x(e){const t=await async function(e,t){var i=await e.pushManager.getSubscription();return i||e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:function(e){e=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/");const t=atob(e),i=new Uint8Array(t.length);for(let e=0;e<t.length;++e)i[e]=t.charCodeAt(e);return i}(t)})}(e.swRegistration,e.vapidKey);var i,n,a,r,s,o={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:u(t.getKey("auth")),p256dh:u(t.getKey("p256dh"))},c=await b(e.firebaseDependencies);if(c){if(i=c.subscriptionOptions,a=o.vapidKey===i.vapidKey,r=o.endpoint===i.endpoint,s=o.auth===i.auth,n=o.p256dh===i.p256dh,a&&r&&s&&n)return Date.now()>=c.createTime+6048e5?async function(e,t){try{var i=await async function(e,t){var i=await S(e),n=k(t.subscriptionOptions);i={method:"PATCH",headers:i,body:JSON.stringify(n)};let a;try{const n=await fetch(I(e.appConfig)+"/"+t.token,i);a=await n.json()}catch(e){throw v.create("token-update-failed",{errorInfo:null==(n=e)?void 0:n.toString()})}if(a.error)throw e=a.error.message,v.create("token-update-failed",{errorInfo:e});if(a.token)return a.token;throw v.create("token-update-no-token")}(e.firebaseDependencies,t),n=Object.assign(Object.assign({},t),{token:i,createTime:Date.now()});return await y(e.firebaseDependencies,n),i}catch(t){throw await async function(e){var t=await b(e.firebaseDependencies);if(t){await j(e.firebaseDependencies,t.token);{t=w(t=e.firebaseDependencies);const i=(await m()).transaction(h,"readwrite");await i.objectStore(h).delete(t),await i.done}await 0}const i=await e.swRegistration.pushManager.getSubscription();return!i||i.unsubscribe()}(e),t}}(e,{token:c.token,createTime:Date.now(),subscriptionOptions:o}):c.token;try{await j(e.firebaseDependencies,c.token)}catch(e){}return C(e.firebaseDependencies,o)}return C(e.firebaseDependencies,o)}async function C(e,t){return t={token:await async function(e,t){var i=await S(e);t=k(t),i={method:"POST",headers:i,body:JSON.stringify(t)};let n;try{const t=await fetch(I(e.appConfig),i);n=await t.json()}catch(e){throw v.create("token-subscribe-failed",{errorInfo:null==(t=e)?void 0:t.toString()})}if(n.error)throw e=n.error.message,v.create("token-subscribe-failed",{errorInfo:e});if(n.token)return n.token;throw v.create("token-subscribe-no-token")}(e,t),createTime:Date.now(),subscriptionOptions:t},await y(e,t),t.token}function _(e){var t,i,n,a,r={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return t=r,(n=e).notification&&(t.notification={},(i=n.notification.title)&&(t.notification.title=i),(i=n.notification.body)&&(t.notification.body=i),(i=n.notification.image)&&(t.notification.image=i)),n=r,(t=e).data&&(n.data=t.data),i=r,((n=e).fcmOptions||null!=(a=n.notification)&&a.click_action)&&(i.fcmOptions={},(a=null!=(a=null==(a=n.fcmOptions)?void 0:a.link)?a:null==(a=n.notification)?void 0:a.click_action)&&(i.fcmOptions.link=a),(n=null==(a=n.fcmOptions)?void 0:a.analytics_label)&&(i.fcmOptions.analyticsLabel=n)),r}function E(e,t){const i=[];for(let n=0;n<e.length;n++)i.push(e.charAt(n)),n<t.length&&i.push(t.charAt(n));i.join("")}function O(e){return v.create("missing-app-config-values",{valueName:e})}E("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),E("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class D{constructor(e,t,i){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;var n=function(e){if(!e||!e.options)throw O("App Configuration Object");if(!e.name)throw O("App Name");var t=e.options;for(const e of["projectId","apiKey","appId","messagingSenderId"])if(!t[e])throw O(e);return{appName:e.name,projectId:t.projectId,apiKey:t.apiKey,appId:t.appId,senderId:t.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:n,installations:t,analyticsProvider:i}}_delete(){return Promise.resolve()}}async function T(e,t){if(!navigator)throw v.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw v.create("permission-blocked");n=e,await!((i=null==t?void 0:t.vapidKey)?n.vapidKey=i:n.vapidKey||(n.vapidKey=d));var i=e,n=null==t?void 0:t.serviceWorkerRegistration;if(n||i.swRegistration||await async function(e){try{e.swRegistration=await navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}),e.swRegistration.update().catch(()=>{})}catch(t){throw v.create("failed-service-worker-registration",{browserErrorMessage:null==(e=t)?void 0:e.message})}}(i),n||!i.swRegistration){if(!(n instanceof ServiceWorkerRegistration))throw v.create("invalid-sw-registration");i.swRegistration=n}return await 0,x(e)}async function A(e,t){var i,a;(t=t.data).isFirebaseMessaging&&(e.onMessageHandler&&t.messageType===n.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(_(t)):e.onMessageHandler.next(_(t))),"object"==typeof(a=i=t.data)&&a&&p in a&&"1"===i["google.c.a.e"]&&await async function(e,t,i){t=function(e){switch(e){case n.NOTIFICATION_CLICKED:return"notification_open";case n.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t),(await e.firebaseDependencies.analyticsProvider.get()).logEvent(t,{message_id:i[p],message_name:i["google.c.a.c_l"],message_time:i["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}(e,t.messageType,i))}const P="@firebase/messaging";function N(e=Object(c.c)()){return async function(){try{await Object(o.i)()}catch(e){return!1}return"undefined"!=typeof window&&Object(o.h)()&&Object(o.d)()&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}().then(e=>{if(!e)throw v.create("unsupported-browser")},e=>{throw v.create("indexed-db-unsupported")}),Object(c.a)(Object(o.g)(e),"messaging").getImmediate()}Object(c.b)(new t.a("messaging",e=>{const t=new D(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>A(t,e)),t},"PUBLIC")),Object(c.b)(new t.a("messaging-internal",e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>T(t,e)}},"PRIVATE")),Object(c.e)(P,"0.9.16"),Object(c.e)(P,"0.9.16","esm2017");var M=(B.getVersion=function(){return"2.5.0"},B.getInstance=function(){return this._instance||(this._instance=new B)},B.prototype.register=function(e,t){var n,a,s,c=this;!this.isRegisted&&e&&(n=i(7).version,a=B.getVersion(),this.isRegisted=!0,s=N(Object(r.a)(e)),navigator.serviceWorker.addEventListener("message",(function(e){c.log("log",{action:"Received service wor