diff --git a/sh_backmate_theme_adv_enterprise/__manifest__.py b/sh_backmate_theme_adv_enterprise/__manifest__.py index 32b301287..b27af28ce 100644 --- a/sh_backmate_theme_adv_enterprise/__manifest__.py +++ b/sh_backmate_theme_adv_enterprise/__manifest__.py @@ -141,8 +141,8 @@ "sh_backmate_theme_adv_enterprise/static/src/xml/message.xml", "sh_backmate_theme_adv_enterprise/static/src/scss/discuss_chatter/discuss_chatter.scss", # #Firebase and bus Notification - "https://www.gstatic.com/firebasejs/8.4.3/firebase-app.js", - "https://www.gstatic.com/firebasejs/8.4.3/firebase-messaging.js", + "sh_backmate_theme_adv_enterprise/static/src/firebase-app.js", + "sh_backmate_theme_adv_enterprise/static/src/firebase-messaging.js", "sh_backmate_theme_adv_enterprise/static/src/js/firebase.js", # #multi tab "sh_backmate_theme_adv_enterprise/static/src/xml/navbar.xml", diff --git a/sh_backmate_theme_adv_enterprise/static/src/firebase-app.js b/sh_backmate_theme_adv_enterprise/static/src/firebase-app.js new file mode 100644 index 000000000..1a7a8e798 --- /dev/null +++ b/sh_backmate_theme_adv_enterprise/static/src/firebase-app.js @@ -0,0 +1,2 @@ +!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).firebase=t()}(this,function(){"use strict";var r=function(e,t){return(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};var i=function(){return(i=Object.assign||function(e){for(var t,n=1,r=arguments.length;na[0]&&t[1]=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function p(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||0"})):"Error",e=this.serviceName+": "+e+" ("+o+").";return new l(o,e,i)},v);function v(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var m=/\{\$([^}]+)}/g;function y(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function g(e,t){t=new b(e,t);return t.subscribe.bind(t)}var b=(w.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},w.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},w.prototype.complete=function(){this.forEachObserver(function(e){e.complete()}),this.close()},w.prototype.subscribe=function(e,t,n){var r,i=this;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");void 0===(r=function(e,t){if("object"!=typeof e||null===e)return!1;for(var n=0,r=t;n=(null!=o?o:e.logLevel)&&a({level:R[t].toLowerCase(),message:i,args:n,type:e.name})}}(n[e])}var x=((x={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",x["bad-app-name"]="Illegal App name: '{$appName}",x["duplicate-app"]="Firebase App named '{$appName}' already exists",x["app-deleted"]="Firebase App named '{$appName}' already deleted",x["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",x["invalid-log-argument"]="First argument to `onLog` must be null or a function.",x),B=new d("app","Firebase",x),V="@firebase/app",M="[DEFAULT]",U=((x={})[V]="fire-core",x["@firebase/analytics"]="fire-analytics",x["@firebase/auth"]="fire-auth",x["@firebase/database"]="fire-rtdb",x["@firebase/functions"]="fire-fn",x["@firebase/installations"]="fire-iid",x["@firebase/messaging"]="fire-fcm",x["@firebase/performance"]="fire-perf",x["@firebase/remote-config"]="fire-rc",x["@firebase/storage"]="fire-gcs",x["@firebase/firestore"]="fire-fst",x["fire-js"]="fire-js",x["firebase-wrapper"]="fire-js-all",x),W=new F("@firebase/app"),G=(Object.defineProperty($.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(e){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=e},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!1,configurable:!0}),Object.defineProperty($.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!1,configurable:!0}),$.prototype.delete=function(){var t=this;return new Promise(function(e){t.checkDestroyed_(),e()}).then(function(){return t.firebase_.INTERNAL.removeApp(t.name_),Promise.all(t.container.getProviders().map(function(e){return e.delete()}))}).then(function(){t.isDeleted_=!0})},$.prototype._getService=function(e,t){return void 0===t&&(t=M),this.checkDestroyed_(),this.container.getProvider(e).getImmediate({identifier:t})},$.prototype._removeServiceInstance=function(e,t){void 0===t&&(t=M),this.container.getProvider(e).clearInstance(t)},$.prototype._addComponent=function(t){try{this.container.addComponent(t)}catch(e){W.debug("Component "+t.name+" failed to register with FirebaseApp "+this.name,e)}},$.prototype._addOrOverwriteComponent=function(e){this.container.addOrOverwriteComponent(e)},$.prototype.toJSON=function(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}},$.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw B.create("app-deleted",{appName:this.name_})},$);function $(e,t,n){var r=this;this.firebase_=n,this.isDeleted_=!1,this.name_=t.name,this.automaticDataCollectionEnabled_=t.automaticDataCollectionEnabled||!1,this.options_=f(void 0,e),this.container=new S(t.name),this._addComponent(new E("app",function(){return r},"PUBLIC")),this.firebase_.INTERNAL.components.forEach(function(e){return r._addComponent(e)})}G.prototype.name&&G.prototype.options||G.prototype.delete||console.log("dc");var Y="8.4.3";function J(a){var s={},c=new Map,l={__esModule:!0,initializeApp:function(e,t){void 0===t&&(t={});"object"==typeof t&&null!==t||(t={name:t});var n=t;void 0===n.name&&(n.name=M);t=n.name;if("string"!=typeof t||!t)throw B.create("bad-app-name",{appName:String(t)});if(y(s,t))throw B.create("duplicate-app",{appName:t});n=new a(e,n,l);return s[t]=n},app:u,registerVersion:function(e,t,n){var r=null!==(i=U[e])&&void 0!==i?i:e;n&&(r+="-"+n);var i=r.match(/\s|\//),e=t.match(/\s|\//);if(i||e){n=['Unable to register library "'+r+'" with version "'+t+'":'];return i&&n.push('library name "'+r+'" contains illegal characters (whitespace or "/")'),i&&e&&n.push("and"),e&&n.push('version name "'+t+'" contains illegal characters (whitespace or "/")'),void W.warn(n.join(" "))}o(new E(r+"-version",function(){return{library:r,version:t}},"VERSION"))},setLogLevel:T,onLog:function(e,t){if(null!==e&&"function"!=typeof e)throw B.create("invalid-log-argument");H(e,t)},apps:null,SDK_VERSION:Y,INTERNAL:{registerComponent:o,removeApp:function(e){delete s[e]},components:c,useAsService:function(e,t){if("serverAuth"===t)return null;return t}}};function u(e){if(!y(s,e=e||M))throw B.create("no-app",{appName:e});return s[e]}function o(n){var e,r=n.name;if(c.has(r))return W.debug("There were multiple attempts to register component "+r+"."),"PUBLIC"===n.type?l[r]:null;c.set(r,n),"PUBLIC"===n.type&&(e=function(e){if("function"!=typeof(e=void 0===e?u():e)[r])throw B.create("invalid-app-argument",{appName:r});return e[r]()},void 0!==n.serviceProps&&f(e,n.serviceProps),l[r]=e,a.prototype[r]=function(){for(var e=[],t=0;ts[0]&&t[1]=e.length?void 0:e)&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function n(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),s=[];try{for(;(void 0===t||0"})):"Error",e=this.serviceName+": "+e+" ("+o+").";return new a(o,e,i)},f);function f(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var v=/\{\$([^}]+)}/g,g=(b.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},b.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},b.prototype.setServiceProps=function(e){return this.serviceProps=e,this},b.prototype.setInstanceCreatedCallback=function(e){return this.onInstanceCreated=e,this},b);function b(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}function y(n){return new Promise(function(e,t){n.onsuccess=function(){e(n.result)},n.onerror=function(){t(n.error)}})}function w(n,r,i){var o,e=new Promise(function(e,t){y(o=n[r].apply(n,i)).then(e,t)});return e.request=o,e}function m(e,n,t){t.forEach(function(t){Object.defineProperty(e.prototype,t,{get:function(){return this[n][t]},set:function(e){this[n][t]=e}})})}function k(t,n,r,e){e.forEach(function(e){e in r.prototype&&(t.prototype[e]=function(){return w(this[n],e,arguments)})})}function S(t,n,r,e){e.forEach(function(e){e in r.prototype&&(t.prototype[e]=function(){return this[n][e].apply(this[n],arguments)})})}function I(e,r,t,n){n.forEach(function(n){n in t.prototype&&(e.prototype[n]=function(){return e=this[r],(t=w(e,n,arguments)).then(function(e){if(e)return new T(e,t.request)});var e,t})})}function C(e){this._index=e}function T(e,t){this._cursor=e,this._request=t}function _(e){this._store=e}function P(n){this._tx=n,this.complete=new Promise(function(e,t){n.oncomplete=function(){e()},n.onerror=function(){t(n.error)},n.onabort=function(){t(n.error)}})}function D(e,t,n){this._db=e,this.oldVersion=t,this.transaction=new P(n)}function j(e){this._db=e}function O(e,t,n){var t=w(indexedDB,"open",[e,t]),r=t.request;return r&&(r.onupgradeneeded=function(e){n&&n(new D(r.result,e.oldVersion,r.transaction))}),t.then(function(e){return new j(e)})}function E(e){return w(indexedDB,"deleteDatabase",[e])}m(C,"_index",["name","keyPath","multiEntry","unique"]),k(C,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),I(C,"_index",IDBIndex,["openCursor","openKeyCursor"]),m(T,"_cursor",["direction","key","primaryKey","value"]),k(T,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(T.prototype[n]=function(){var t=this,e=arguments;return Promise.resolve().then(function(){return t._cursor[n].apply(t._cursor,e),y(t._request).then(function(e){if(e)return new T(e,t._request)})})})}),_.prototype.createIndex=function(){return new C(this._store.createIndex.apply(this._store,arguments))},_.prototype.index=function(){return new C(this._store.index.apply(this._store,arguments))},m(_,"_store",["name","keyPath","indexNames","autoIncrement"]),k(_,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),I(_,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),S(_,"_store",IDBObjectStore,["deleteIndex"]),P.prototype.objectStore=function(){return new _(this._tx.objectStore.apply(this._tx,arguments))},m(P,"_tx",["objectStoreNames","mode"]),S(P,"_tx",IDBTransaction,["abort"]),D.prototype.createObjectStore=function(){return new _(this._db.createObjectStore.apply(this._db,arguments))},m(D,"_db",["name","version","objectStoreNames"]),S(D,"_db",IDBDatabase,["deleteObjectStore","close"]),j.prototype.transaction=function(){return new P(this._db.transaction.apply(this._db,arguments))},m(j,"_db",["name","version","objectStoreNames"]),S(j,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach(function(i){[_,C].forEach(function(e){i in e.prototype&&(e.prototype[i.replace("open","iterate")]=function(){var e=(n=arguments,Array.prototype.slice.call(n)),t=e[e.length-1],n=this._store||this._index,r=n[i].apply(n,e.slice(0,-1));r.onsuccess=function(){t(r.result)}})})}),[C,_].forEach(function(e){e.prototype.getAll||(e.prototype.getAll=function(e,n){var r=this,i=[];return new Promise(function(t){r.iterateCursor(e,function(e){e?(i.push(e.value),void 0===n||i.length!=n?e.continue():t(i)):t(i)})})})});var M="0.4.25",K=1e4,x="w:"+M,N="FIS_v2",A="https://firebaseinstallations.googleapis.com/v1",q=36e5,R=((R={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',R["not-registered"]="Firebase Installation is not registered.",R["installation-not-found"]="Firebase Installation not found.",R["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',R["app-offline"]="Could not process request. Application offline.",R["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",R),B=new l("installations","Installations",R);function L(e){return e instanceof a&&e.code.includes("request-failed")}function V(e){e=e.projectId;return A+"/projects/"+e+"/installations"}function F(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}function U(n,r){return d(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,r.json()];case 1:return t=e.sent(),t=t.error,[2,B.create("request-failed",{requestName:n,serverCode:t.code,serverMessage:t.message,serverStatus:t.status})]}})})}function W(e){e=e.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function H(e,t){t=t.refreshToken,e=W(e);return e.append("Authorization",N+" "+t),e}function $(n){return d(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,n()];case 1:return 500<=(t=e.sent()).status&&t.status<600?[2,n()]:[2,t]}})})}function G(t){return new Promise(function(e){setTimeout(e,t)})}var z=/^[cdef][\w-]{21}$/,J="";function Y(){try{var e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;e=function(e){return btoa(String.fromCharCode.apply(String,i([],n(e)))).replace(/\+/g,"-").replace(/\//g,"_")}(e).substr(0,22);return z.test(e)?e:J}catch(e){return J}}function Z(e){return e.appName+"!"+e.appId}var Q=new Map;function X(e,t){e=Z(e);ee(e,t),function(e,t){var n=ne();n&&n.postMessage({key:e,fid:t});re()}(e,t)}function ee(e,t){var n,r,i=Q.get(e);if(i)try{for(var o=c(i),s=o.next();!s.done;s=o.next())(0,s.value)(t)}catch(e){n={error:e}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}var te=null;function ne(){return!te&&"BroadcastChannel"in self&&((te=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(e){ee(e.data.key,e.data.fid)}),te}function re(){0===Q.size&&te&&(te.close(),te=null)}var ie,oe="firebase-installations-database",se=1,ae="firebase-installations-store",ue=null;function ce(){return ue=ue||O(oe,se,function(e){0===e.oldVersion&&e.createObjectStore(ae)})}function le(o,s){return d(this,void 0,void 0,function(){var t,n,r,i;return h(this,function(e){switch(e.label){case 0:return t=Z(o),[4,ce()];case 1:return r=e.sent(),n=r.transaction(ae,"readwrite"),[4,(r=n.objectStore(ae)).get(t)];case 2:return i=e.sent(),[4,r.put(s,t)];case 3:return e.sent(),[4,n.complete];case 4:return e.sent(),i&&i.fid===s.fid||X(o,s.fid),[2,s]}})})}function fe(r){return d(this,void 0,void 0,function(){var t,n;return h(this,function(e){switch(e.label){case 0:return t=Z(r),[4,ce()];case 1:return n=e.sent(),[4,(n=n.transaction(ae,"readwrite")).objectStore(ae).delete(t)];case 2:return e.sent(),[4,n.complete];case 3:return e.sent(),[2]}})})}function pe(s,a){return d(this,void 0,void 0,function(){var t,n,r,i,o;return h(this,function(e){switch(e.label){case 0:return t=Z(s),[4,ce()];case 1:return r=e.sent(),n=r.transaction(ae,"readwrite"),[4,(r=n.objectStore(ae)).get(t)];case 2:return i=e.sent(),void 0!==(o=a(i))?[3,4]:[4,r.delete(t)];case 3:return e.sent(),[3,6];case 4:return[4,r.put(o,t)];case 5:e.sent(),e.label=6;case 6:return[4,n.complete];case 7:return e.sent(),!o||i&&i.fid===o.fid||X(s,o.fid),[2,o]}})})}function de(i){return d(this,void 0,void 0,function(){var t,n,r;return h(this,function(e){switch(e.label){case 0:return[4,pe(i,function(e){e=ve(e||{fid:Y(),registrationStatus:0}),e=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:function(i){return d(this,void 0,void 0,function(){var t,n,r;return h(this,function(e){switch(e.label){case 0:return[4,he(i)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.registrationStatus?[3,5]:[4,G(100)];case 3:return e.sent(),[4,he(i)];case 4:return t=e.sent(),[3,2];case 5:return 0!==t.registrationStatus?[3,7]:[4,de(i)];case 6:return r=e.sent(),n=r.installationEntry,(r=r.registrationPromise)?[2,r]:[2,n];case 7:return[2,t]}})})}(e)}:{installationEntry:t};if(!navigator.onLine){var n=Promise.reject(B.create("app-offline"));return{installationEntry:t,registrationPromise:n}}t={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},e=function(r,i){return d(this,void 0,void 0,function(){var t,n;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,7]),[4,function(s,e){var a=e.fid;return d(this,void 0,void 0,function(){var t,n,r,i,o;return h(this,function(e){switch(e.label){case 0:return t=V(s),n=W(s),o={fid:a,authVersion:N,appId:s.appId,sdkVersion:x},r={method:"POST",headers:n,body:JSON.stringify(o)},[4,$(function(){return fetch(t,r)})];case 1:return(i=e.sent()).ok?[4,i.json()]:[3,3];case 2:return o=e.sent(),[2,{fid:o.fid||a,registrationStatus:2,refreshToken:o.refreshToken,authToken:F(o.authToken)}];case 3:return[4,U("Create Installation",i)];case 4:throw e.sent()}})})}(r,i)];case 1:return t=e.sent(),[2,le(r,t)];case 2:return L(n=e.sent())&&409===n.customData.serverCode?[4,fe(r)]:[3,4];case 3:return e.sent(),[3,6];case 4:return[4,le(r,{fid:i.fid,registrationStatus:0})];case 5:e.sent(),e.label=6;case 6:throw n;case 7:return[2]}})})}(e,t);return{installationEntry:t,registrationPromise:e}}}(i,e);return t=e.registrationPromise,e.installationEntry})];case 1:return(n=e.sent()).fid!==J?[3,3]:(r={},[4,t]);case 2:return[2,(r.installationEntry=e.sent(),r)];case 3:return[2,{installationEntry:n,registrationPromise:t}]}})})}function he(e){return pe(e,function(e){if(!e)throw B.create("installation-not-found");return ve(e)})}function ve(e){return 1===(t=e).registrationStatus&&t.registrationTime+K=s.createTime+6048e5?[2,function(i,o,s){return d(this,void 0,void 0,function(){var t,n,r;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,5]),[4,function(o,s){return d(this,void 0,void 0,function(){var t,n,r,i;return h(this,function(e){switch(e.label){case 0:return[4,He(o)];case 1:t=e.sent(),n=$e(s.subscriptionOptions),n={method:"PATCH",headers:t,body:JSON.stringify(n)},e.label=2;case 2:return e.trys.push([2,5,,6]),[4,fetch(We(o.appConfig)+"/"+s.token,n)];case 3:return[4,e.sent().json()];case 4:return r=e.sent(),[3,6];case 5:throw i=e.sent(),Te.create("token-update-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,Te.create("token-update-failed",{errorInfo:i});if(!r.token)throw Te.create("token-update-no-token");return[2,r.token]}})})}(o,i)];case 1:return t=e.sent(),n=p(p({},i),{token:t,createTime:Date.now()}),[4,Ve(o,n)];case 2:return e.sent(),[2,t];case 3:return r=e.sent(),[4,ze(o,s)];case 4:throw e.sent(),r;case 5:return[2]}})})}({token:s.token,createTime:Date.now(),subscriptionOptions:a},c,l)]:[2,s.token];case 9:return[2]}var t,n,r,i,o})})}function ze(n,r){return d(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,Le(n)];case 1:return(t=e.sent())?[4,Ue(n,t.token)]:[3,4];case 2:return e.sent(),[4,function(r){return d(this,void 0,void 0,function(){var t,n;return h(this,function(e){switch(e.label){case 0:return t=Fe(r),[4,Be()];case 1:return n=e.sent(),[4,(n=n.transaction(qe,"readwrite")).objectStore(qe).delete(t)];case 2:return e.sent(),[4,n.complete];case 3:return e.sent(),[2]}})})}(n)];case 3:e.sent(),e.label=4;case 4:return[4,r.pushManager.getSubscription()];case 5:return(t=e.sent())?[2,t.unsubscribe()]:[2,!0]}})})}function Je(n,r){return d(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,function(o,s){return d(this,void 0,void 0,function(){var t,n,r,i;return h(this,function(e){switch(e.label){case 0:return[4,He(o)];case 1:t=e.sent(),n=$e(s),n={method:"POST",headers:t,body:JSON.stringify(n)},e.label=2;case 2:return e.trys.push([2,5,,6]),[4,fetch(We(o.appConfig),n)];case 3:return[4,e.sent().json()];case 4:return r=e.sent(),[3,6];case 5:throw i=e.sent(),Te.create("token-subscribe-failed",{errorInfo:i});case 6:if(r.error)throw i=r.error.message,Te.create("token-subscribe-failed",{errorInfo:i});if(!r.token)throw Te.create("token-subscribe-no-token");return[2,r.token]}})})}(n,r)];case 1:return t=e.sent(),t={token:t,createTime:Date.now(),subscriptionOptions:r},[4,Ve(n,t)];case 2:return e.sent(),[2,t.token]}})})}function Ye(e){var t={from:e.from,collapseKey:e.collapse_key};return function(e,t){if(!t.notification)return;e.notification={};var n=t.notification.title;n&&(e.notification.title=n);n=t.notification.body;n&&(e.notification.body=n);t=t.notification.image;t&&(e.notification.image=t)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){if(!t.fcmOptions)return;e.fcmOptions={};var n=t.fcmOptions.link;n&&(e.fcmOptions.link=n);t=t.fcmOptions.analytics_label;t&&(e.fcmOptions.analyticsLabel=t)}(t,e),t}function Ze(e){return"object"==typeof e&&e&&je in e}function Qe(t){return new Promise(function(e){setTimeout(e,t)})}var Xe=(Object.defineProperty(et.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),et.prototype.setBackgroundMessageHandler=function(e){if(this.isOnBackgroundMessageUsed=!1,!e||"function"!=typeof e)throw Te.create("invalid-bg-handler");this.bgMessageHandler=e},et.prototype.onBackgroundMessage=function(e){var t=this;return this.isOnBackgroundMessageUsed=!0,this.bgMessageHandler=e,function(){t.bgMessageHandler=null}},et.prototype.getToken=function(){var n;return d(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return this.vapidKey?[3,2]:[4,Le(this.firebaseDependencies)];case 1:t=e.sent(),this.vapidKey=null!==(n=null===(n=null==t?void 0:t.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==n?n:_e,e.label=2;case 2:return[2,Ge(this.firebaseDependencies,self.registration,this.vapidKey)]}})})},et.prototype.deleteToken=function(){return ze(this.firebaseDependencies,self.registration)},et.prototype.requestPermission=function(){throw Te.create("only-available-in-window")},et.prototype.usePublicVapidKey=function(e){if(null!==this.vapidKey)throw Te.create("use-vapid-key-after-get-token");if("string"!=typeof e||0===e.length)throw Te.create("invalid-vapid-key");this.vapidKey=e},et.prototype.useServiceWorker=function(){throw Te.create("only-available-in-window")},et.prototype.onMessage=function(){throw Te.create("only-available-in-window")},et.prototype.onTokenRefresh=function(){throw Te.create("only-available-in-window")},et.prototype.onPush=function(a){return d(this,void 0,void 0,function(){var i,o,s;return h(this,function(e){switch(e.label){case 0:return(s=function(e){var t=e.data;if(!t)return null;try{return t.json()}catch(e){return null}}(a))?[4,tt()]:(console.debug("FirebaseMessaging: failed to get parsed MessagePayload from the PushEvent. Skip handling the push."),[2]);case 1:return(i=e.sent(),i.some(function(e){return"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://")}))?[2,function(e,t){var n,r;t.isFirebaseMessaging=!0,t.messageType=Ce.PUSH_RECEIVED;try{for(var i=c(e),o=i.next();!o.done;o=i.next())o.value.postMessage(t)}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}}(i,s)]:(o=!1,s.notification?[4,function(e){var t=e.actions,n=Notification.maxActions;t&&n&&t.length>n&&console.warn("This browser only supports "+n+" actions. The remaining actions will not be displayed.");return self.registration.showNotification(null!==(n=e.title)&&void 0!==n?n:"",e)}(((r=p({},(t=s).notification)).data=((n={})[De]=t,n),r))]:[3,3]);case 2:e.sent(),o=!0,e.label=3;case 3:return!0===o&&!1===this.isOnBackgroundMessageUsed?[2]:(this.bgMessageHandler&&(s=Ye(s),"function"==typeof this.bgMessageHandler?this.bgMessageHandler(s):this.bgMessageHandler.next(s)),[4,Qe(1e3)]);case 4:return e.sent(),[2]}var t,n,r})})},et.prototype.onSubChange=function(n){var r;return d(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return n.newSubscription?[3,2]:[4,ze(this.firebaseDependencies,self.registration)];case 1:return e.sent(),[2];case 2:return[4,Le(this.firebaseDependencies)];case 3:return t=e.sent(),[4,ze(this.firebaseDependencies,self.registration)];case 4:return e.sent(),[4,Ge(this.firebaseDependencies,self.registration,null!==(r=null===(r=null==t?void 0:t.subscriptionOptions)||void 0===r?void 0:r.vapidKey)&&void 0!==r?r:_e)];case 5:return e.sent(),[2]}})})},et.prototype.onNotificationClick=function(s){var a;return d(this,void 0,void 0,function(){var t,n,r,i,o;return h(this,function(e){switch(e.label){case 0:return(t=null===(a=null===(a=s.notification)||void 0===a?void 0:a.data)||void 0===a?void 0:a[De])?s.action?[2]:(s.stopImmediatePropagation(),s.notification.close(),(n=function(e){var t,n=null!==(t=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==t?t:null===(n=e.notification)||void 0===n?void 0:n.click_action;if(n)return n;return Ze(e.data)?self.location.origin:null}(t))?(r=new URL(n,self.location.href),i=new URL(self.location.origin),r.host!==i.host?[2]:[4,function(u){return d(this,void 0,void 0,function(){var t,n,r,i,o,s,a;return h(this,function(e){switch(e.label){case 0:return[4,tt()];case 1:t=e.sent();try{for(n=c(t),r=n.next();!r.done;r=n.next())if(i=r.value,o=new URL(i.url,self.location.href),u.host===o.host)return[2,i]}catch(e){s={error:e}}finally{try{r&&!r.done&&(a=n.return)&&a.call(n)}finally{if(s)throw s.error}}return[2,null]}})})}(r)]):[2]):[2];case 1:return(o=e.sent())?[3,4]:[4,self.clients.openWindow(n)];case 2:return o=e.sent(),[4,Qe(3e3)];case 3:return e.sent(),[3,6];case 4:return[4,o.focus()];case 5:o=e.sent(),e.label=6;case 6:return o?(t.messageType=Ce.NOTIFICATION_CLICKED,t.isFirebaseMessaging=!0,[2,o.postMessage(t)]):[2]}})})},et);function et(e){var t=this;this.firebaseDependencies=e,this.isOnBackgroundMessageUsed=null,this.vapidKey=null,this.bgMessageHandler=null,self.addEventListener("push",function(e){e.waitUntil(t.onPush(e))}),self.addEventListener("pushsubscriptionchange",function(e){e.waitUntil(t.onSubChange(e))}),self.addEventListener("notificationclick",function(e){e.waitUntil(t.onNotificationClick(e))})}function tt(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}var nt=(Object.defineProperty(rt.prototype,"app",{get:function(){return this.firebaseDependencies.app},enumerable:!1,configurable:!0}),rt.prototype.messageEventListener=function(i){return d(this,void 0,void 0,function(){var n,r;return h(this,function(e){switch(e.label){case 0:return(n=i.data).isFirebaseMessaging?(this.onMessageCallback&&n.messageType===Ce.PUSH_RECEIVED&&("function"==typeof this.onMessageCallback?this.onMessageCallback((delete(t=Object.assign({},n)).messageType,delete t.isFirebaseMessaging,t)):this.onMessageCallback.next(Object.assign({},n))),Ze(r=n.data)&&"1"===r["google.c.a.e"]?[4,this.logEvent(n.messageType,r)]:[3,2]):[2];case 1:e.sent(),e.label=2;case 2:return[2]}var t})})},rt.prototype.getVapidKey=function(){return this.vapidKey},rt.prototype.getSwReg=function(){return this.swRegistration},rt.prototype.getToken=function(t){return d(this,void 0,void 0,function(){return h(this,function(e){switch(e.label){case 0:return"default"!==Notification.permission?[3,2]:[4,Notification.requestPermission()];case 1:e.sent(),e.label=2;case 2:if("granted"!==Notification.permission)throw Te.create("permission-blocked");return[4,this.updateVapidKey(null==t?void 0:t.vapidKey)];case 3:return e.sent(),[4,this.updateSwReg(null==t?void 0:t.serviceWorkerRegistration)];case 4:return e.sent(),[2,Ge(this.firebaseDependencies,this.swRegistration,this.vapidKey)]}})})},rt.prototype.updateVapidKey=function(t){return d(this,void 0,void 0,function(){return h(this,function(e){return t?this.vapidKey=t:this.vapidKey||(this.vapidKey=_e),[2]})})},rt.prototype.updateSwReg=function(t){return d(this,void 0,void 0,function(){return h(this,function(e){switch(e.label){case 0:return t||this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:e.sent(),e.label=2;case 2:if(!t&&this.swRegistration)return[2];if(!(t instanceof ServiceWorkerRegistration))throw Te.create("invalid-sw-registration");return this.swRegistration=t,[2]}})})},rt.prototype.registerDefaultSw=function(){return d(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),t=this,[4,navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"})];case 1:return t.swRegistration=e.sent(),this.swRegistration.update().catch(function(){}),[3,3];case 2:throw t=e.sent(),Te.create("failed-service-worker-registration",{browserErrorMessage:t.message});case 3:return[2]}})})},rt.prototype.deleteToken=function(){return d(this,void 0,void 0,function(){return h(this,function(e){switch(e.label){case 0:return this.swRegistration?[3,2]:[4,this.registerDefaultSw()];case 1:e.sent(),e.label=2;case 2:return[2,ze(this.firebaseDependencies,this.swRegistration)]}})})},rt.prototype.requestPermission=function(){return d(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return"granted"===Notification.permission?[2]:[4,Notification.requestPermission()];case 1:if("granted"===(t=e.sent()))return[2];throw"denied"===t?Te.create("permission-blocked"):Te.create("permission-default")}})})},rt.prototype.usePublicVapidKey=function(e){if(null!==this.vapidKey)throw Te.create("use-vapid-key-after-get-token");if("string"!=typeof e||0===e.length)throw Te.create("invalid-vapid-key");this.vapidKey=e},rt.prototype.useServiceWorker=function(e){if(!(e instanceof ServiceWorkerRegistration))throw Te.create("invalid-sw-registration");if(this.swRegistration)throw Te.create("use-sw-after-get-token");this.swRegistration=e},rt.prototype.onMessage=function(e){var t=this;return this.onMessageCallback=e,function(){t.onMessageCallback=null}},rt.prototype.setBackgroundMessageHandler=function(){throw Te.create("only-available-in-sw")},rt.prototype.onBackgroundMessage=function(){throw Te.create("only-available-in-sw")},rt.prototype.onTokenRefresh=function(){return function(){}},rt.prototype.logEvent=function(n,r){return d(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return t=function(e){switch(e){case Ce.NOTIFICATION_CLICKED:return"notification_open";case Ce.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(n),[4,this.firebaseDependencies.analyticsProvider.get()];case 1:return e.sent().logEvent(t,{message_id:r[je],message_name:r["google.c.a.c_l"],message_time:r["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)}),[2]}})})},rt);function rt(e){var t=this;this.firebaseDependencies=e,this.vapidKey=null,this.onMessageCallback=null,navigator.serviceWorker.addEventListener("message",function(e){return t.messageEventListener(e)})}function it(e){return Te.create("missing-app-config-values",{valueName:e})}R={isSupported:ot};function ot(){return self&&"ServiceWorkerGlobalScope"in self?"indexedDB"in self&&null!==indexedDB&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey"):"indexedDB"in window&&null!==indexedDB&&navigator.cookieEnabled&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}t.default.INTERNAL.registerComponent(new g("messaging",function(e){var t=e.getProvider("app").getImmediate(),e={app:t,appConfig:function(e){var t,n;if(!e||!e.options)throw it("App Configuration Object");if(!e.name)throw it("App Name");var r=e.options;try{for(var i=c(["projectId","apiKey","appId","messagingSenderId"]),o=i.next();!o.done;o=i.next()){var s=o.value;if(!r[s])throw it(s)}}catch(e){t={error:e}}finally{try{o&&!o.done&&(n=i.return)&&n.call(i)}finally{if(t)throw t.error}}return{appName:e.name,projectId:r.projectId,apiKey:r.apiKey,appId:r.appId,senderId:r.messagingSenderId}}(t),installations:e.getProvider("installations").getImmediate(),analyticsProvider:e.getProvider("analytics-internal")};if(!ot())throw Te.create("unsupported-browser");return new(self&&"ServiceWorkerGlobalScope"in self?Xe:nt)(e)},"PUBLIC").setServiceProps(R))}.apply(this,arguments)}catch(e){throw console.error(e),new Error("Cannot instantiate firebase-messaging.js - be sure to load firebase-app.js first.")}}); +//# sourceMappingURL=firebase-messaging.js.map