!function(e){var t={};function i(n){if(t[n])return t[n].exports;var o=t[n]={i:n,l:!1,exports:{}};return e[n].call(o.exports,o,o.exports,i),o.l=!0,o.exports}i.m=e,i.c=t,i.d=function(e,t,n){i.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},i.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},i.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return i.d(t,"a",t),t},i.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},i.p="",i(i.s=27)}([function(e,t,i){"use strict";i.d(t,"a",function(){return n});Object.setPrototypeOf||Array;Object.assign;function n(e,t,i,n){return new(i||(i=Promise))(function(o,s){function r(e){try{c(n.next(e))}catch(e){s(e)}}function a(e){try{c(n.throw(e))}catch(e){s(e)}}function c(e){e.done?o(e.value):new i(function(t){t(e.value)}).then(r,a)}c((n=n.apply(e,t||[])).next())})}},function(e,t,i){"use strict";i.d(t,"a",function(){return n});class n{static shouldLog(){try{if("undefined"==typeof window||void 0===window.localStorage)return!1;const e=window.localStorage.getItem("loglevel");return!(!e||"trace"!==e.toLowerCase())}catch(e){return!1}}static setLevel(e){if("undefined"!=typeof window&&void 0!==window.localStorage)try{window.localStorage.setItem("loglevel",e),n.proxyMethodsCreated=void 0,n.createProxyMethods()}catch(e){return}}static createProxyMethods(){if(void 0!==n.proxyMethodsCreated)return;n.proxyMethodsCreated=!0;const e={log:"debug",trace:"trace",info:"info",warn:"warn",error:"error"};for(const t of Object.keys(e)){const i=void 0!==console[t],o=e[t],s=i&&(n.shouldLog()||"error"===o);n[o]=s?console[t].bind(console):function(){}}}}n.createProxyMethods()},function(e,t,i){"use strict";i.d(t,"g",function(){return h}),i.d(t,"w",function(){return p}),i.d(t,"c",function(){return m}),i.d(t,"q",function(){return b}),i.d(t,"y",function(){return f}),i.d(t,"j",function(){return S}),i.d(t,"s",function(){return v}),i.d(t,"r",function(){return O}),i.d(t,"b",function(){return y}),i.d(t,"e",function(){return w}),i.d(t,"a",function(){return E}),i.d(t,"v",function(){return I}),i.d(t,"o",function(){return P}),i.d(t,"k",function(){return C}),i.d(t,"i",function(){return T}),i.d(t,"t",function(){return A}),i.d(t,"x",function(){return M}),i.d(t,"f",function(){return N}),i.d(t,"z",function(){return x}),i.d(t,"u",function(){return k}),i.d(t,"n",function(){return j}),i.d(t,"d",function(){return _}),i.d(t,"p",function(){return D}),i.d(t,"m",function(){return R}),i.d(t,"l",function(){return U}),i.d(t,"h",function(){return W});var n=i(0),o=i(4),s=i(6),r=(i(3),i(1)),a=i(8),c=i(17),l=i(22),d=i(5),u=i(9),g=i.n(u);function h(e){return l.a.decodeHtmlEntities(e)}function p(e){var t=document.querySelectorAll(e);if(t.length>0)for(let e=0;e{OneSignal.initialized?e():OneSignal.emitter.once(OneSignal.EVENTS.SDK_INITIALIZED,e)})})}function b(){return a.a.isUsingSubscriptionWorkaround()}function f(e=!1){return Object(n.a)(this,void 0,void 0,function*(){return c.a.triggerNotificationPermissionChanged(e)})}function S(e,...t){if(e)return e.apply(null,t)}function v(e,...t){return a.a.logMethodCall(e,...t)}function O(e){return!!e&&!!e.match(/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/)}function y(e,t,i){let n;if(!(n="string"==typeof e?document.querySelector(e):e))throw new Error(`${e} must be a CSS selector string or DOM Element object.`);n.insertAdjacentHTML(t,i)}function w(e){if("string"==typeof e){const t=document.querySelector(e);if(null===t)throw new Error(`Cannot find element with selector "${e}"`);for(;t.firstChild;)t.removeChild(t.firstChild)}else{if("object"!=typeof e)throw new Error(`${e} must be a CSS selector string or DOM Element object.`);for(;e.firstChild;)e.removeChild(e.firstChild)}}function E(e,t){if("string"==typeof e){const i=document.querySelector(e);if(null===i)throw new Error(`Cannot find element with selector "${e}"`);i.classList.add(t)}else{if("object"!=typeof e)throw new Error(`${e} must be a CSS selector string or DOM Element object.`);e.classList.add(t)}}function I(e,t){if("string"==typeof e){const i=document.querySelector(e);if(null===i)throw new Error(`Cannot find element with selector "${e}"`);i.classList.remove(t)}else{if("object"!=typeof e)throw new Error(`${e} must be a CSS selector string or DOM Element object.`);e.classList.remove(t)}}function P(e,t){if("string"==typeof e){const i=document.querySelector(e);if(null===i)throw new Error(`Cannot find element with selector "${e}"`);return i.classList.contains(t)}if("object"==typeof e)return e.classList.contains(t);throw new Error(`${e} must be a CSS selector string or DOM Element object.`)}function C(e){return d.a.getConsoleStyle(e)}function T(e){return new Promise(t=>{setTimeout(t,e)})}function A(){return Promise.resolve()}function M(e,t){return d.a.timeoutPromise(e,t)}function N(e,t){return d.a.contains(e,t)}function x(){return r.a.warn("OneSignal: Unsubscribing from push."),o.a.getWindowEnv()!==s.a.ServiceWorker?self.registration.pushManager.getSubscription().then(e=>{if(e)return e.unsubscribe();throw new Error("Cannot unsubscribe because not subscribed.")}):b()?new Promise((e,t)=>{r.a.debug("Unsubscribe from push got called, and we're going to remotely execute it in HTTPS iFrame."),OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_FROM_PUSH,null,i=>{r.a.debug("Unsubscribe from push succesfully remotely executed."),i.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?e():t("Failed to remotely unsubscribe from push.")})}):OneSignal.context.serviceWorkerManager.getRegistration().then(e=>e||Promise.resolve()).then(e=>e.pushManager).then(e=>e.getSubscription()).then(e=>e?e.unsubscribe():Promise.resolve())}function k(e,t,i,n=!1){if(t||r.a.error("Cannot call on() with no event: ",t),i||r.a.error("Cannot call on() with no task: ",i),"string"==typeof e){const n=document.querySelectorAll(e);if(n.length>0)for(let e=0;e{OneSignal.emitter.once(e,e=>{t(e)})})})}function D(){window.__oneSignalSdkLoadCount=j()+1}function R(e){return e?g.a.safari&&e.safari?e.safari:g.a.firefox&&e.firefox?e.firefox:e.chrome||e.firefox||e.safari||"default-icon":"default-icon"}function U(e){const t=document.querySelector(e);return t||(r.a.debug(`No instance of ${e} found. Returning stub.`),document.createElement("div"))}function W(e){return JSON.parse(JSON.stringify(e))}},function(e,t,i){"use strict";var n=i(0),o=i(18),s=i(24);class r{}class a{}var c,l,d=i(23),u=i(21),g=i(6),h=i(20),p=i(13),m=i(4),b=i(8),f=i(5),S=i(1),v=i(19);i.d(t,"a",function(){return O}),(l=c||(c={}))[l.SET=0]="SET";class O{constructor(e){this.databaseName=e,this.emitter=new o.a,this.database=new s.a(this.databaseName)}static resetInstance(){O.databaseInstance=null}static get singletonInstance(){return O.databaseInstanceName||(O.databaseInstanceName="ONE_SIGNAL_SDK_DB"),O.databaseInstance||(O.databaseInstance=new O(O.databaseInstanceName)),O.databaseInstance}static applyDbResultFilter(e,t,i){switch(e){case"Options":return i&&t?i.value:i&&!t?i:null;case"Ids":return i&&t?i.id:i&&!t?i:null;case"NotificationOpened":return i&&t?{data:i.data,timestamp:i.timestamp}:i&&!t?i:null;default:return i||null}}shouldUsePostmam(){return m.a.getWindowEnv()!==g.a.ServiceWorker&&b.b.isUsingSubscriptionWorkaround()&&m.a.getTestEnv()===u.a.None}get(e,t){return Object(n.a)(this,void 0,void 0,function*(){if(this.shouldUsePostmam())return yield new Promise(i=>Object(n.a)(this,void 0,void 0,function*(){OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_GET,[{table:e,key:t}],e=>{const t=e.data[0];i(t)})}));{const i=yield this.database.get(e,t);return O.applyDbResultFilter(e,t,i)}})}getAll(e){return Object(n.a)(this,void 0,void 0,function*(){if(this.shouldUsePostmam())return yield new Promise(t=>Object(n.a)(this,void 0,void 0,function*(){OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_GET_ALL,{table:e},e=>{const i=e.data;t(i)})}));return yield this.database.getAll(e)})}put(e,t){return Object(n.a)(this,void 0,void 0,function*(){yield new Promise((i,o)=>Object(n.a)(this,void 0,void 0,function*(){m.a.getWindowEnv()!==g.a.ServiceWorker&&b.b.isUsingSubscriptionWorkaround()&&m.a.getTestEnv()===u.a.None?OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_PUT,[{table:e,keypath:t}],n=>{n.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?i():o(`(Database) Attempted remote IndexedDB put(${e}, ${t}),`+"but did not get success response.")}):(yield this.database.put(e,t),i())})),this.emitter.emit(O.EVENTS.SET,t)})}remove(e,t){return m.a.getWindowEnv()!==g.a.ServiceWorker&&b.b.isUsingSubscriptionWorkaround()&&m.a.getTestEnv()===u.a.None?new Promise((i,n)=>{OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_REMOVE,[{table:e,keypath:t}],o=>{o.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?i():n(`(Database) Attempted remote IndexedDB remove(${e}, ${t}),`+"but did not get success response.")})}):this.database.remove(e,t)}getAppConfig(){return Object(n.a)(this,void 0,void 0,function*(){const e={},t=yield this.get("Ids","appId");return e.appId=t,e.subdomain=yield this.get("Options","subdomain"),e.vapidPublicKey=yield this.get("Options","vapidPublicKey"),e})}getExternalUserId(){return Object(n.a)(this,void 0,void 0,function*(){return yield this.get("Ids","externalUserId")})}getExternalUserIdAuthHash(){return Object(n.a)(this,void 0,void 0,function*(){return yield this.get("Ids","externalUserIdAuthHash")})}setExternalUserId(e,t){return Object(n.a)(this,void 0,void 0,function*(){const i=f.b.getValueOrDefault(e,""),n=f.b.getValueOrDefault(t,"");""===i?yield this.remove("Ids","externalUserId"):yield this.put("Ids",{type:"externalUserId",id:i}),""===n?yield this.remove("Ids","externalUserIdAuthHash"):yield this.put("Ids",{type:"externalUserIdAuthHash",id:n})})}setAppConfig(e){return Object(n.a)(this,void 0,void 0,function*(){e.appId&&(yield this.put("Ids",{type:"appId",id:e.appId})),e.subdomain&&(yield this.put("Options",{key:"subdomain",value:e.subdomain})),!0===e.httpUseOneSignalCom?yield this.put("Options",{key:"httpUseOneSignalCom",value:!0}):!1===e.httpUseOneSignalCom&&(yield this.put("Options",{key:"httpUseOneSignalCom",value:!1})),e.vapidPublicKey&&(yield this.put("Options",{key:"vapidPublicKey",value:e.vapidPublicKey}))})}getAppState(){return Object(n.a)(this,void 0,void 0,function*(){const e=new r;return e.defaultNotificationUrl=yield this.get("Options","defaultUrl"),e.defaultNotificationTitle=yield this.get("Options","defaultTitle"),e.lastKnownPushEnabled=yield this.get("Options","isPushEnabled"),e.clickedNotifications=yield this.get("NotificationOpened"),e})}setAppState(e){return Object(n.a)(this,void 0,void 0,function*(){if(e.defaultNotificationUrl&&(yield this.put("Options",{key:"defaultUrl",value:e.defaultNotificationUrl})),(e.defaultNotificationTitle||""===e.defaultNotificationTitle)&&(yield this.put("Options",{key:"defaultTitle",value:e.defaultNotificationTitle})),null!=e.lastKnownPushEnabled&&(yield this.put("Options",{key:"isPushEnabled",value:e.lastKnownPushEnabled})),e.clickedNotifications){const t=Object.keys(e.clickedNotifications);for(const i of t){const t=e.clickedNotifications[i];t?yield this.put("NotificationOpened",{url:i,data:t.data,timestamp:t.timestamp}):null===t&&(yield this.remove("NotificationOpened",i))}}})}getServiceWorkerState(){return Object(n.a)(this,void 0,void 0,function*(){const e=new a;return e.workerVersion=yield this.get("Ids","WORKER1_ONE_SIGNAL_SW_VERSION"),e})}setServiceWorkerState(e){return Object(n.a)(this,void 0,void 0,function*(){e.workerVersion&&(yield this.put("Ids",{type:"WORKER1_ONE_SIGNAL_SW_VERSION",id:e.workerVersion}))})}getSubscription(){return Object(n.a)(this,void 0,void 0,function*(){const e=new d.a;e.deviceId=yield this.get("Ids","userId"),e.subscriptionToken=yield this.get("Ids","registrationId");const t=yield this.get("Options","optedOut"),i=yield this.get("Options","subscription"),n=yield this.get("Options","subscriptionCreatedAt"),o=yield this.get("Options","subscriptionExpirationTime");return e.optedOut=null!=t?t:null!=i&&!i,e.createdAt=n,e.expirationTime=o,e})}setDeviceId(e){return Object(n.a)(this,void 0,void 0,function*(){yield this.put("Ids",{type:"userId",id:e})})}setSubscription(e){return Object(n.a)(this,void 0,void 0,function*(){e.deviceId&&(yield this.setDeviceId(e.deviceId)),void 0!==e.subscriptionToken&&(yield this.put("Ids",{type:"registrationId",id:e.subscriptionToken})),null!=e.optedOut&&(yield this.put("Options",{key:"optedOut",value:e.optedOut})),null!=e.createdAt&&(yield this.put("Options",{key:"subscriptionCreatedAt",value:e.createdAt})),null!=e.expirationTime?yield this.put("Options",{key:"subscriptionExpirationTime",value:e.expirationTime}):yield this.remove("Options","subscriptionExpirationTime")})}getEmailProfile(){return Object(n.a)(this,void 0,void 0,function*(){const e=yield this.get("Ids","emailProfile");return e?h.a.deserialize(e):new h.a})}setEmailProfile(e){return Object(n.a)(this,void 0,void 0,function*(){e&&(yield this.put("Ids",{type:"emailProfile",id:e.serialize()}))})}getSMSProfile(){return Object(n.a)(this,void 0,void 0,function*(){const e=yield this.get("Ids","smsProfile");return e?v.a.deserialize(e):new v.a})}setSMSProfile(e){return Object(n.a)(this,void 0,void 0,function*(){e&&(yield this.put("Ids",{type:"smsProfile",id:e.serialize()}))})}setProvideUserConsent(e){return Object(n.a)(this,void 0,void 0,function*(){yield this.put("Options",{key:"userConsent",value:e})})}getProvideUserConsent(){return Object(n.a)(this,void 0,void 0,function*(){return yield this.get("Options","userConsent")})}getSession(e){return Object(n.a)(this,void 0,void 0,function*(){return yield this.get("Sessions",e)})}setSession(e){return Object(n.a)(this,void 0,void 0,function*(){yield this.put("Sessions",e)})}removeSession(e){return Object(n.a)(this,void 0,void 0,function*(){yield this.remove("Sessions",e)})}getLastNotificationClicked(e){return Object(n.a)(this,void 0,void 0,function*(){let t=[];try{t=yield this.getAll("NotificationClicked")}catch(e){S.a.error("Database.getNotificationClickedByUrl",e)}return t.find(t=>t.appId===e)||null})}getNotificationClickedByUrl(e,t){return Object(n.a)(this,void 0,void 0,function*(){let i=[];try{i=yield this.getAll("NotificationClicked")}catch(e){S.a.error("Database.getNotificationClickedByUrl",e)}return i.find(i=>i.appId===t&&new URL(e).origin===new URL(i.url).origin)||null})}getNotificationClickedById(e){return Object(n.a)(this,void 0,void 0,function*(){return yield this.get("NotificationClicked",e)})}getNotificationReceivedById(e){return Object(n.a)(this,void 0,void 0,function*(){return yield this.get("NotificationReceived",e)})}removeNotificationClickedById(e){return Object(n.a)(this,void 0,void 0,function*(){yield this.remove("NotificationClicked",e)})}removeAllNotificationClicked(){return Object(n.a)(this,void 0,void 0,function*(){yield this.remove("NotificationClicked")})}resetSentUniqueOutcomes(){return Object(n.a)(this,void 0,void 0,function*(){const e=(yield this.getAll("SentUniqueOutcome")).map(e=>(e.sentDuringSession=null,O.put("SentUniqueOutcome",e)));yield Promise.all(e)})}static rebuild(){return Object(n.a)(this,void 0,void 0,function*(){return Promise.all([O.singletonInstance.remove("Ids"),O.singletonInstance.remove("NotificationOpened"),O.singletonInstance.remove("Options"),O.singletonInstance.remove("NotificationReceived"),O.singletonInstance.remove("NotificationClicked"),O.singletonInstance.remove("SentUniqueOutcome")])})}static on(...e){return Object(n.a)(this,void 0,void 0,function*(){return O.singletonInstance.emitter.on.apply(O.singletonInstance.emitter,e)})}static getCurrentSession(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getSession(p.a)})}static upsertSession(e){return Object(n.a)(this,void 0,void 0,function*(){yield O.singletonInstance.setSession(e)})}static cleanupCurrentSession(){return Object(n.a)(this,void 0,void 0,function*(){yield O.singletonInstance.removeSession(p.a)})}static setEmailProfile(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.setEmailProfile(e)})}static getEmailProfile(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getEmailProfile()})}static setSMSProfile(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.setSMSProfile(e)})}static getSMSProfile(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getSMSProfile()})}static setSubscription(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.setSubscription(e)})}static getSubscription(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getSubscription()})}static setProvideUserConsent(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.setProvideUserConsent(e)})}static getProvideUserConsent(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getProvideUserConsent()})}static setServiceWorkerState(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.setServiceWorkerState(e)})}static getServiceWorkerState(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getServiceWorkerState()})}static setAppState(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.setAppState(e)})}static getAppState(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getAppState()})}static setAppConfig(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.setAppConfig(e)})}static getAppConfig(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getAppConfig()})}static getExternalUserId(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getExternalUserId()})}static getExternalUserIdAuthHash(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getExternalUserIdAuthHash()})}static getLastNotificationClicked(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getLastNotificationClicked(e)})}static removeNotificationClickedById(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.removeNotificationClickedById(e)})}static removeAllNotificationClicked(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.removeAllNotificationClicked()})}static resetSentUniqueOutcomes(){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.resetSentUniqueOutcomes()})}static getNotificationClickedByUrl(e,t){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getNotificationClickedByUrl(e,t)})}static getNotificationClickedById(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getNotificationClickedById(e)})}static getNotificationReceivedById(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getNotificationReceivedById(e)})}static setExternalUserId(e,t){return Object(n.a)(this,void 0,void 0,function*(){yield O.singletonInstance.setExternalUserId(e,t)})}static setDeviceId(e){return Object(n.a)(this,void 0,void 0,function*(){yield O.singletonInstance.setDeviceId(e)})}static remove(e,t){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.remove(e,t)})}static put(e,t){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.put(e,t)})}static get(e,t){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.get(e,t)})}static getAll(e){return Object(n.a)(this,void 0,void 0,function*(){return yield O.singletonInstance.getAll(e)})}}O.EVENTS=c},function(e,t,i){"use strict";i.d(t,"a",function(){return m});var n=i(0),o=i(14),s=i(21),r=i(6),a=i(11),c=i(15),l=i(10),d=i(8);const u=4e3,g=3001,h=18080,p=["outcomes","on_focus"];class m{static getBuildEnv(){return o.a.Production}static getApiEnv(){return o.a.Production}static getIntegration(e){return Object(n.a)(this,void 0,void 0,function*(){if(l.a.useSafariLegacyPush())return c.a.Secure;const t=window===window.top,i="https:"===window.location.protocol;if(void 0===e){if("undefined"==typeof OneSignal||!OneSignal.context||!OneSignal.context.appConfig)throw new a.a("usingProxyOrigin",a.b.Empty);e=!!OneSignal.context.appConfig.subdomain}if(t)return i?e?c.a.SecureProxy:c.a.Secure:!d.b.isLocalhostAllowedAsSecureOrigin()||"localhost"!==location.hostname&&"127.0.0.1"!==location.hostname?c.a.InsecureProxy:c.a.Secure;if(i){return(yield m.isFrameContextInsecure())?c.a.InsecureProxy:e?c.a.SecureProxy:c.a.Secure}return c.a.InsecureProxy})}static isFrameContextInsecure(){return Object(n.a)(this,void 0,void 0,function*(){if(window===window.top||!("serviceWorker"in navigator)||void 0===navigator.serviceWorker.getRegistration)return!1;return!(yield OneSignal.context.serviceWorkerManager.getRegistration())})}static isInsecureOrigin(){return"http:"===window.location.protocol}static getOrigin(){return l.a.isBrowser()?window.location.origin:"undefined"!=typeof self&&"undefined"!=typeof ServiceWorkerGlobalScope?self.location.origin:"Unknown"}static getWindowEnv(){return"undefined"==typeof window?"undefined"!=typeof self&&"undefined"!=typeof ServiceWorkerGlobalScope?r.a.ServiceWorker:r.a.Unknown:window===window.top?-1!==location.href.indexOf("initOneSignal")||"/subscribe"===location.pathname&&""===location.search&&(location.hostname.endsWith(".onesignal.com")||location.hostname.endsWith(".os.tc")||-1!==location.hostname.indexOf(".localhost")&&m.getBuildEnv()===o.a.Development)?r.a.OneSignalSubscriptionPopup:r.a.Host:"/webPushIframe"===location.pathname?r.a.OneSignalProxyFrame:"/webPushModal"===location.pathname?r.a.OneSignalSubscriptionModal:r.a.CustomIframe}static getTestEnv(){return s.a.None}static getBuildEnvPrefix(e=m.getBuildEnv()){switch(e){case o.a.Development:return"Dev-";case o.a.Staging:return"Staging-";case o.a.Production:return"";default:throw new a.a("buildEnv",a.b.EnumOutOfRange)}}static getOneSignalApiUrl(e=m.getApiEnv(),t){switch(e){case o.a.Development:return m.isTurbineEndpoint(t)?new URL(`https://onesignal.com:${h}/api/v1`):new URL(`https://onesignal.com:${g}/api/v1`);case o.a.Staging:case o.a.Production:return new URL("https://onesignal.com/api/v1");default:throw new a.a("buildEnv",a.b.EnumOutOfRange)}}static getOneSignalStaticResourcesUrl(){return new URL("https://media.onesignal.com/web-sdk")}static getOneSignalResourceUrlPath(e=m.getBuildEnv()){let t;const i=u;switch(e){case o.a.Development:t=`http://localhost:${i}`;break;case o.a.Staging:t="https://localhost";break;case o.a.Production:t="https://onesignal.com";break;default:throw new a.a("buildEnv",a.b.EnumOutOfRange)}return new URL(`${t}/sdks`)}static getOneSignalCssFileName(e=m.getBuildEnv()){switch(e){case o.a.Development:return"Dev-OneSignalSDKStyles.css";case o.a.Staging:return"Staging-OneSignalSDKStyles.css";case o.a.Production:return"OneSignalSDKStyles.css";default:throw new a.a("buildEnv",a.b.EnumOutOfRange)}}static isTurbineEndpoint(e){return!!e&&p.some(t=>e.indexOf(t)>-1)}}},function(e,t,i){"use strict";var n=i(0),o=i(12);class s extends o.a{constructor(e="The asynchronous operation has timed out."){super(e),this.message=e,Object.setPrototypeOf(this,s.prototype)}}var r=i(16);i.d(t,"a",function(){return a});class a{static contains(e,t){return!!e&&-1!==e.indexOf(t)}static getConsoleStyle(e){return"code"==e?'padding: 0 1px 1px 5px;border: 1px solid #ddd;border-radius: 3px;font-family: Monaco,"DejaVu Sans Mono","Courier New",monospace;color: #444;':"bold"==e?"font-weight: 600;color: rgb(51, 51, 51);":"alert"==e?"font-weight: 600;color: red;":"event"==e?"color: green;":"postmessage"==e?"color: orange;":"serviceworkermessage"==e?"color: purple;":""}static trimUndefined(e){for(const t in e)e.hasOwnProperty(t)&&void 0===e[t]&&delete e[t];return e}static capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}static isNullOrUndefined(e){return void 0===e||null===e}static valueOrDefault(e,t){return void 0===e||null===e?t:e}static stringify(e){return JSON.stringify(e,(e,t)=>"function"==typeof t?"[Function]":t,4)}static encodeHashAsUriComponent(e){let t="";const i=Object.keys(e);for(const n of i){const i=e[n];t+=`${encodeURIComponent(n)}=${encodeURIComponent(i)}`}return t}static timeoutPromise(e,t){const i=new Promise((e,i)=>{setTimeout(()=>{i(new s)},t)});return Promise.race([e,i])}static getValueOrDefault(e,t){return void 0!==e&&null!==e?e:t}static padStart(e,t,i){let n=e;for(;n.length0&&a.contains(e.errors[0],"app_id not found")?new r.a(r.b.MissingAppId):e}})}static sortArrayOfObjects(e,t,i=!1,n=!0){const o=n?e:e.slice();return o.sort((e,n)=>{const o=t(e),s=t(n);return o>s?i?-1:1:o1&&i[1]||""}var n,o,s,r=i(/(ipod|iphone|ipad)/i).toLowerCase(),a=!/like android/i.test(t)&&/android/i.test(t),c=/nexus\s*[0-6]\s*/i.test(t),l=!c&&/nexus\s*[0-9]+/i.test(t),d=/CrOS/.test(t),u=/silk/i.test(t),g=/sailfish/i.test(t),h=/tizen/i.test(t),p=/(web|hpw)os/i.test(t),m=/windows phone/i.test(t),b=(/SamsungBrowser/i.test(t),!m&&/windows/i.test(t)),f=!r&&!u&&/macintosh/i.test(t),S=!a&&!g&&!h&&!p&&/linux/i.test(t),v=i(/edge\/(\d+(\.\d+)?)/i),O=i(/version\/(\d+(\.\d+)?)/i),y=/tablet/i.test(t)&&!/tablet pc/i.test(t),w=!y&&/[^-]mobi/i.test(t),E=/xbox/i.test(t);/opera/i.test(t)?n={name:"Opera",opera:e,version:O||i(/(?:opera|opr|opios)[\s\/](\d+(\.\d+)?)/i)}:/opr\/|opios/i.test(t)?n={name:"Opera",opera:e,version:i(/(?:opr|opios)[\s\/](\d+(\.\d+)?)/i)||O}:/SamsungBrowser/i.test(t)?n={name:"Samsung Internet for Android",samsungBrowser:e,version:O||i(/(?:SamsungBrowser)[\s\/](\d+(\.\d+)?)/i)}:/coast/i.test(t)?n={name:"Opera Coast",coast:e,version:O||i(/(?:coast)[\s\/](\d+(\.\d+)?)/i)}:/yabrowser/i.test(t)?n={name:"Yandex Browser",yandexbrowser:e,version:O||i(/(?:yabrowser)[\s\/](\d+(\.\d+)?)/i)}:/ucbrowser/i.test(t)?n={name:"UC Browser",ucbrowser:e,version:i(/(?:ucbrowser)[\s\/](\d+(?:\.\d+)+)/i)}:/mxios/i.test(t)?n={name:"Maxthon",maxthon:e,version:i(/(?:mxios)[\s\/](\d+(?:\.\d+)+)/i)}:/epiphany/i.test(t)?n={name:"Epiphany",epiphany:e,version:i(/(?:epiphany)[\s\/](\d+(?:\.\d+)+)/i)}:/puffin/i.test(t)?n={name:"Puffin",puffin:e,version:i(/(?:puffin)[\s\/](\d+(?:\.\d+)?)/i)}:/sleipnir/i.test(t)?n={name:"Sleipnir",sleipnir:e,version:i(/(?:sleipnir)[\s\/](\d+(?:\.\d+)+)/i)}:/k-meleon/i.test(t)?n={name:"K-Meleon",kMeleon:e,version:i(/(?:k-meleon)[\s\/](\d+(?:\.\d+)+)/i)}:m?(n={name:"Windows Phone",windowsphone:e},v?(n.msedge=e,n.version=v):(n.msie=e,n.version=i(/iemobile\/(\d+(\.\d+)?)/i))):/msie|trident/i.test(t)?n={name:"Internet Explorer",msie:e,version:i(/(?:msie |rv:)(\d+(\.\d+)?)/i)}:d?n={name:"Chrome",chromeos:e,chromeBook:e,chrome:e,version:i(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:/chrome.+? edge/i.test(t)?n={name:"Microsoft Edge",msedge:e,version:v}:/vivaldi/i.test(t)?n={name:"Vivaldi",vivaldi:e,version:i(/vivaldi\/(\d+(\.\d+)?)/i)||O}:g?n={name:"Sailfish",sailfish:e,version:i(/sailfish\s?browser\/(\d+(\.\d+)?)/i)}:/seamonkey\//i.test(t)?n={name:"SeaMonkey",seamonkey:e,version:i(/seamonkey\/(\d+(\.\d+)?)/i)}:/firefox|iceweasel|fxios/i.test(t)?(n={name:"Firefox",firefox:e,version:i(/(?:firefox|iceweasel|fxios)[ \/](\d+(\.\d+)?)/i)},/\((mobile|tablet);[^\)]*rv:[\d\.]+\)/i.test(t)&&(n.firefoxos=e)):u?n={name:"Amazon Silk",silk:e,version:i(/silk\/(\d+(\.\d+)?)/i)}:/phantom/i.test(t)?n={name:"PhantomJS",phantom:e,version:i(/phantomjs\/(\d+(\.\d+)?)/i)}:/slimerjs/i.test(t)?n={name:"SlimerJS",slimer:e,version:i(/slimerjs\/(\d+(\.\d+)?)/i)}:/blackberry|\bbb\d+/i.test(t)||/rim\stablet/i.test(t)?n={name:"BlackBerry",blackberry:e,version:O||i(/blackberry[\d]+\/(\d+(\.\d+)?)/i)}:p?(n={name:"WebOS",webos:e,version:O||i(/w(?:eb)?osbrowser\/(\d+(\.\d+)?)/i)},/touchpad\//i.test(t)&&(n.touchpad=e)):/bada/i.test(t)?n={name:"Bada",bada:e,version:i(/dolfin\/(\d+(\.\d+)?)/i)}:h?n={name:"Tizen",tizen:e,version:i(/(?:tizen\s?)?browser\/(\d+(\.\d+)?)/i)||O}:/qupzilla/i.test(t)?n={name:"QupZilla",qupzilla:e,version:i(/(?:qupzilla)[\s\/](\d+(?:\.\d+)+)/i)||O}:/chromium/i.test(t)?n={name:"Chromium",chromium:e,version:i(/(?:chromium)[\s\/](\d+(?:\.\d+)?)/i)||O}:/chrome|crios|crmo/i.test(t)?n={name:"Chrome",chrome:e,version:i(/(?:chrome|crios|crmo)\/(\d+(\.\d+)?)/i)}:a?n={name:"Android",version:O}:/safari|applewebkit/i.test(t)?(n={name:"Safari",safari:e},O&&(n.version=O)):r?(n={name:"iphone"==r?"iPhone":"ipad"==r?"iPad":"iPod"},O&&(n.version=O)):n=/googlebot/i.test(t)?{name:"Googlebot",googlebot:e,version:i(/googlebot\/(\d+(\.\d+))/i)||O}:{name:i(/^(.*)\/(.*) /),version:(o=/^(.*)\/(.*) /,s=t.match(o),s&&s.length>1&&s[2]||"")},!n.msedge&&/(apple)?webkit/i.test(t)?(/(apple)?webkit\/537\.36/i.test(t)?(n.name=n.name||"Blink",n.blink=e):(n.name=n.name||"Webkit",n.webkit=e),!n.version&&O&&(n.version=O)):!n.opera&&/gecko\//i.test(t)&&(n.name=n.name||"Gecko",n.gecko=e,n.version=n.version||i(/gecko\/(\d+(\.\d+)?)/i)),n.windowsphone||n.msedge||!a&&!n.silk?n.windowsphone||n.msedge||!r?f?n.mac=e:E?n.xbox=e:b?n.windows=e:S&&(n.linux=e):(n[r]=e,n.ios=e):n.android=e;var I="";n.windows?I=function(e){switch(e){case"NT":return"NT";case"XP":return"XP";case"NT 5.0":return"2000";case"NT 5.1":return"XP";case"NT 5.2":return"2003";case"NT 6.0":return"Vista";case"NT 6.1":return"7";case"NT 6.2":return"8";case"NT 6.3":return"8.1";case"NT 10.0":return"10";default:return}}(i(/Windows ((NT|XP)( \d\d?.\d)?)/i)):n.windowsphone?I=i(/windows phone (?:os)?\s?(\d+(\.\d+)*)/i):n.mac?I=(I=i(/Mac OS X (\d+([_\.\s]\d+)*)/i)).replace(/[_\s]/g,"."):r?I=(I=i(/os (\d+([_\s]\d+)*) like mac os x/i)).replace(/[_\s]/g,"."):a?I=i(/android[ \/-](\d+(\.\d+)*)/i):n.webos?I=i(/(?:web|hpw)os\/(\d+(\.\d+)*)/i):n.blackberry?I=i(/rim\stablet\sos\s(\d+(\.\d+)*)/i):n.bada?I=i(/bada\/(\d+(\.\d+)*)/i):n.tizen&&(I=i(/tizen[\/\s](\d+(\.\d+)*)/i)),I&&(n.osversion=I);var P=!n.windows&&I.split(".")[0];return y||l||"ipad"==r||a&&(3==P||P>=4&&!w)||n.silk?n.tablet=e:(w||"iphone"==r||"ipod"==r||a||c||n.blackberry||n.webos||n.bada)&&(n.mobile=e),n.msedge||n.msie&&n.version>=10||n.yandexbrowser&&n.version>=15||n.vivaldi&&n.version>=1||n.chrome&&n.version>=20||n.samsungBrowser&&n.version>=4||n.firefox&&n.version>=20||n.safari&&n.version>=6||n.opera&&n.version>=10||n.ios&&n.osversion&&n.osversion.split(".")[0]>=6||n.blackberry&&n.version>=10.1||n.chromium&&n.version>=20?n.a=e:n.msie&&n.version<10||n.chrome&&n.version<20||n.firefox&&n.version<20||n.safari&&n.version<6||n.opera&&n.version<10||n.ios&&n.osversion&&n.osversion.split(".")[0]<6||n.chromium&&n.version<20?n.c=e:n.x=e,n}var i=t("undefined"!=typeof navigator&&navigator.userAgent||"");function n(e){return e.split(".").length}function o(e,t){var i,n=[];if(Array.prototype.map)return Array.prototype.map.call(e,t);for(i=0;i=0;){if(i[0][t]>i[1][t])return 1;if(i[0][t]!==i[1][t])return-1;if(0===t)return 0}}function r(e,n,o){var r=i;"string"==typeof n&&(o=n,n=void 0),void 0===n&&(n=!1),o&&(r=t(o));var a=""+r.version;for(var c in e)if(e.hasOwnProperty(c)&&r[c]){if("string"!=typeof e[c])throw new Error("Browser version in the minVersion map should be a string: "+c+": "+String(e));return s([a,e[c]])<0}return n}return i.test=function(e){for(var t=0;t{let i=void 0;try{i=indexedDB.open(e,a)}catch(e){}if(!i)return null;i.onerror=this.onDatabaseOpenError,i.onblocked=this.onDatabaseOpenBlocked,i.onupgradeneeded=this.onDatabaseUpgradeNeeded,i.onsuccess=(()=>{this.database=i.result,this.database.onerror=this.onDatabaseError,this.database.onversionchange=this.onDatabaseVersionChange,t(this.database)})})}ensureDatabaseOpen(){return Object(n.a)(this,void 0,void 0,function*(){return this.openLock||(this.openLock=this.open(this.databaseName)),yield this.openLock})}onDatabaseOpenError(e){e.preventDefault();const t=e.target.error;r.b.contains(t.message,"The operation failed for reasons unrelated to the database itself and not covered by any other error code")||r.b.contains(t.message,"A mutation operation was attempted on a database that did not allow mutations")?s.a.warn("OneSignal: IndexedDb web storage is not available on this origin since this profile's IndexedDb schema has been upgraded in a newer version of Firefox. See: https://bugzilla.mozilla.org/show_bug.cgi?id=1236557#c6"):s.a.warn("OneSignal: Fatal error opening IndexedDb database:",t)}onDatabaseError(e){s.a.debug("IndexedDb: Generic database error",e.target.errorCode)}onDatabaseOpenBlocked(){s.a.debug("IndexedDb: Blocked event")}onDatabaseVersionChange(e){s.a.debug("IndexedDb: versionchange event")}onDatabaseUpgradeNeeded(e){s.a.debug("IndexedDb: Database is being rebuilt or upgraded (upgradeneeded event).");const t=e.target.result;e.oldVersion<1&&(t.createObjectStore("Ids",{keyPath:"type"}),t.createObjectStore("NotificationOpened",{keyPath:"url"}),t.createObjectStore("Options",{keyPath:"key"})),e.oldVersion<2&&(t.createObjectStore("Sessions",{keyPath:"sessionKey"}),t.createObjectStore("NotificationReceived",{keyPath:"notificationId"}),t.createObjectStore("NotificationClicked",{keyPath:"notificationId"})),e.oldVersion<3&&t.createObjectStore("SentUniqueOutcome",{keyPath:"outcomeName"}),"undefined"!=typeof OneSignal&&(OneSignal._isNewVisitor=!0)}get(e,t){return Object(n.a)(this,void 0,void 0,function*(){const i=yield this.ensureDatabaseOpen();return t?yield new Promise((n,o)=>{const s=i.transaction(e).objectStore(e).get(t);s.onsuccess=(()=>{n(s.result)}),s.onerror=(()=>{o(s.error)})}):yield new Promise((t,n)=>{const o={},s=i.transaction(e).objectStore(e).openCursor();s.onsuccess=(e=>{const i=e.target.result;if(i){const e=i.key;o[e]=i.value,i.continue()}else t(o)}),s.onerror=(()=>{n(s.error)})})})}getAll(e){return Object(n.a)(this,void 0,void 0,function*(){return yield new Promise((t,i)=>Object(n.a)(this,void 0,void 0,function*(){const n=(yield this.ensureDatabaseOpen()).transaction(e).objectStore(e).openCursor(),o=[];n.onsuccess=(e=>{const i=e.target.result;i?(o.push(i.value),i.continue()):t(o)}),n.onerror=(()=>{i(n.error)})}))})}put(e,t){return Object(n.a)(this,void 0,void 0,function*(){return yield this.ensureDatabaseOpen(),yield new Promise((i,n)=>{try{const o=this.database.transaction([e],"readwrite").objectStore(e).put(t);o.onsuccess=(()=>{i(t)}),o.onerror=(e=>{s.a.error("Database PUT Transaction Error:",e),n(e)})}catch(e){s.a.error("Database PUT Error:",e),n(e)}})})}remove(e,t){return Object(n.a)(this,void 0,void 0,function*(){const i=yield this.ensureDatabaseOpen();return new Promise((n,o)=>{try{const r=i.transaction([e],"readwrite").objectStore(e),a=t?r.delete(t):r.clear();a.onsuccess=(()=>{n(t)}),a.onerror=(e=>{s.a.error("Database REMOVE Transaction Error:",e),o(e)})}catch(e){s.a.error("Database REMOVE Error:",e),o(e)}})})}}},function(e,t,i){"use strict";function n(){return window.top!==window&&"Apple Computer, Inc."===navigator.vendor&&"MacIntel"===navigator.platform}function o(){return"undefined"!=typeof PushSubscriptionOptions&&PushSubscriptionOptions.prototype.hasOwnProperty("applicationServerKey")}i.d(t,"a",function(){return n}),i.d(t,"b",function(){return o})},function(e,t){e.exports=function(e,t,o){"function"==typeof t&&(o=t,t={});t||(t={});var s,r,a=t.prefix||"__jp",c=t.name||a+i++,l=t.param||"callback",d=null!=t.timeout?t.timeout:6e4,u=encodeURIComponent,g=document.getElementsByTagName("script")[0]||document.head;d&&(r=setTimeout(function(){h(),o&&o(new Error("Timeout"))},d));function h(){s.parentNode&&s.parentNode.removeChild(s),window[c]=n,r&&clearTimeout(r)}return window[c]=function(e){h(),o&&o(null,e)},e=(e+=(~e.indexOf("?")?"&":"?")+l+"="+u(c)).replace("?&","?"),(s=document.createElement("script")).src=e,g.parentNode.insertBefore(s,g),function(){window[c]&&h()}};var i=0;function n(){}},function(e,t,i){"use strict";i.r(t);var n=i(1),o=i(2);class s{static doReplay(e){e&&(Array.isArray(e)?s.processAsArray(e):e.constructor&&"OneSignalStubES6"===e.constructor.name?s.processAsES6Stub(e):n.a.error("window.OneSignal is an unexpected type! Should be an Array, OneSignalStubES6, or undefined."))}static processAsArray(e){for(const t of e)try{OneSignal.push(t)}catch(e){n.a.error(e)}}static processAsES6Stub(e){e.SERVICE_WORKER_PATH&&(OneSignal.SERVICE_WORKER_PATH=e.SERVICE_WORKER_PATH),e.currentLogLevel&&OneSignal.log.setLevel(e.currentLogLevel),e.SERVICE_WORKER_PARAM&&(OneSignal.SERVICE_WORKER_PARAM=e.SERVICE_WORKER_PARAM),e.preExistingArray&&s.processAsArray(e.preExistingArray);for(const t of e.directFunctionCallsArray){const e=OneSignal[t.functionName].apply(OneSignal,t.args);t.delayedPromise&&e instanceof Promise&&e.then(function(...e){t.delayedPromise&&t.delayedPromise.resolve&&t.delayedPromise.resolve.apply(null,e)}).catch(function(...e){t.delayedPromise&&t.delayedPromise.reject&&t.delayedPromise.reject.apply(null,e)})}}}"undefined"!=typeof window&&function(){if(Object(o.p)(),Object(o.n)()>1)return n.a.warn("OneSignal: The web push SDK is included more than once. For optimal performance, please include our SDK only once on your page."),void n.a.debug("OneSignal: Exiting from SDK initialization to prevent double-initialization errors. "+`Occurred ${Object(o.n)()} times.`);const e=window.OneSignal;window.OneSignal=i(28).default,s.doReplay(e)}()},function(e,t,i){"use strict";i.r(t);var n,o,s,r,a,c,l,d=i(0),u=i(9),g=i.n(u),h=i(10),InvalidArgumentError=i(11),p=i(12);!function(e){e[e.HttpsPermissionRequest="HTTPS permission request"]="HttpsPermissionRequest",e[e.FullscreenHttpPermissionMessage="fullscreen HTTP permission message"]="FullscreenHttpPermissionMessage",e[e.FullscreenHttpsPermissionMessage="fullscreen HTTPS permission message"]="FullscreenHttpsPermissionMessage",e[e.SlidedownPermissionMessage="slidedown permission message"]="SlidedownPermissionMessage",e[e.SubscriptionBell="subscription bell"]="SubscriptionBell"}(n||(n={})),(s=o||(o={}))[s.MissingAppId=0]="MissingAppId",s[s.RedundantPermissionMessage=1]="RedundantPermissionMessage",s[s.PushPermissionAlreadyGranted=2]="PushPermissionAlreadyGranted",s[s.UnsupportedEnvironment=3]="UnsupportedEnvironment",s[s.MissingDomElement=4]="MissingDomElement",s[s.ServiceWorkerNotActivated=5]="ServiceWorkerNotActivated",s[s.NoProxyFrame=6]="NoProxyFrame";class m extends p.a{constructor(e,t){let i;switch(e){case o.MissingAppId:i="Missing required app ID.";break;case o.RedundantPermissionMessage:let s="";t&&t.permissionPromptType&&(s=`(${n[t.permissionPromptType]})`),i=`Another permission message ${s} is being displayed.`;break;case o.PushPermissionAlreadyGranted:i="Push permission has already been granted.";break;case o.UnsupportedEnvironment:i="The current environment does not support this operation.";break;case o.ServiceWorkerNotActivated:i="The service worker must be activated first.";break;case o.NoProxyFrame:i="No proxy frame."}super(i),this.description=o[e],this.reason=e,Object.setPrototypeOf(this,m.prototype)}}(a=r||(r={}))[a.Unknown=0]="Unknown",a[a.NoDeviceId=1]="NoDeviceId",a[a.NoEmailSet=2]="NoEmailSet",a[a.NoSMSSet=3]="NoSMSSet",a[a.OptedOut=4]="OptedOut";class b extends p.a{constructor(e){let t;switch(e){case r.Unknown||r.NoDeviceId:t="This operation can only be performed after the user is subscribed.";break;case r.NoEmailSet:t="No email is currently set.";break;case r.NoSMSSet:t="No sms is currently set.";break;case r.OptedOut:t="The user has manually opted out of receiving of notifications. This operation can only be performed after the user is fully resubscribed."}super(t),this.reason=r[e],Object.setPrototypeOf(this,b.prototype)}}(l=c||(c={}))[l.InvalidAppId=0]="InvalidAppId",l[l.AppNotConfiguredForWebPush=1]="AppNotConfiguredForWebPush",l[l.MissingSubdomain=2]="MissingSubdomain",l[l.WrongSiteUrl=3]="WrongSiteUrl",l[l.MultipleInitialization=4]="MultipleInitialization",l[l.MissingSafariWebId=5]="MissingSafariWebId",l[l.Unknown=6]="Unknown";class f extends p.a{constructor(e,t){let i;switch(e){case c.InvalidAppId:i="OneSignal: This app ID does not match any existing app. Double check your app ID.";break;case c.AppNotConfiguredForWebPush:i="OneSignal: This app ID does not have any web platforms enabled. Double check your app ID, or see step 1 on our setup guide (https://tinyurl.com/2x5jzk83).";break;case c.MissingSubdomain:i="Non-HTTPS pages require the subdomainName parameter within the label set within the OneSignal Web configuration (https://tinyurl.com/ry39x7mk).";break;case c.WrongSiteUrl:i=t&&t.siteUrl?`OneSignal: This web push config can only be used on ${new URL(t.siteUrl).origin}.`+` Your current origin is ${location.origin}.`:"OneSignal: This web push config can not be used on the current site.";break;case c.MultipleInitialization:i="OneSignal: The OneSignal web SDK can only be initialized once. Extra initializations are ignored. Please remove calls initializing the SDK more than once.";break;case c.MissingSafariWebId:i="OneSignal: Safari browser support on Mac OS X requires the Safari web platform to be enabled. Please see the Safari Support steps in our web setup guide.";break;case c.Unknown:i="OneSignal: An unknown initialization error occurred."}super(i),this.reason=c[e],Object.setPrototypeOf(this,f.prototype)}}var S=i(7);class v{static put(e,t){return void 0===v.store[e]&&(v.store[e]=[null,null]),v.store[e].push(t),v.store[e].length==v.LIMIT+1&&v.store[e].shift(),v.store[e]}static get(e){return void 0===v.store[e]&&(v.store[e]=[null,null]),v.store[e]}static getFirst(e){return v.get(e)[0]}static getLast(e){return v.get(e)[1]}static remove(e){delete v.store[e]}static isEmpty(e){const t=v.get(e);return null===t[0]&&null===t[1]}}v.store={},v.LIMIT=2;var O,y,w=i(3),E=i(1),I=i(8),P=i(22);!function(e){e.Native="native",e.Push="push",e.Category="category",e.Sms="sms",e.Email="email",e.SmsAndEmail="smsAndEmail"}(O||(O={}));class C{static isCategorySlidedownConfigured(e){if(!e)return!1;const t=C.getFirstSlidedownPromptOptionsWithType(e,O.Category);return!!t&&(!!t.categories&&t.categories.length>0)}static isCategorySlidedownConfiguredVersion1(e){var t,i;return((null===(i=null===(t=null===e||void 0===e?void 0:e.categories)||void 0===t?void 0:t.tags)||void 0===i?void 0:i.length)||0)>0}static getFirstSlidedownPromptOptionsWithType(e,t){return e?e.filter(e=>e.type===t)[0]:void 0}static isSlidedownAutoPromptConfigured(e){if(!e)return!1;for(let t=0;t{OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION,{safariWebId:e},e=>{const i=e.data;t(i)})})})}isPermissionEnvironmentAmbiguous(e){return Object(d.a)(this,void 0,void 0,function*(){const t=I.b.redetectBrowserUserAgent();return!t.safari&&!t.firefox&&e===y.Denied&&(this.isCurrentFrameContextCrossOrigin()||(yield T.a.isFrameContextInsecure())||I.b.isUsingSubscriptionWorkaround())})}isCurrentFrameContextCrossOrigin(){let e;try{e=window.top.location.origin}catch(e){return!0}return window.top!==window&&e!==window.location.origin}getInterpretedAmbiguousPermission(e){return Object(d.a)(this,void 0,void 0,function*(){switch(e){case y.Denied:const t=this.getStoredPermission();return t||y.Default;default:return e}})}getStoredPermission(){return k.getStoredPermission()}setStoredPermission(e){k.setStoredPermission(e)}updateStoredPermission(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield this.getNotificationPermission();return this.setStoredPermission(e)})}}const M="isOptedOut",N="isPushNotificationsEnabled",x="os_pageViews";class k{static getIsOptedOut(){return"true"===localStorage.getItem(M)}static getIsPushNotificationsEnabled(){return"true"===localStorage.getItem(N)}static setIsOptedOut(e){localStorage.setItem(M,e.toString())}static setIsPushNotificationsEnabled(e){localStorage.setItem(N,e.toString())}static setStoredPermission(e){localStorage.setItem(A.STORED_PERMISSION_KEY,e)}static getStoredPermission(){switch(localStorage.getItem(A.STORED_PERMISSION_KEY)||"default"){case"granted":return y.Granted;case"denied":return y.Denied;default:return y.Default}}static setLocalPageViewCount(e){localStorage.setItem(x,e.toString())}static getLocalPageViewCount(){return Number(localStorage.getItem(x))}}const j={allowButton:"onesignal-slidedown-allow-button",body:"slidedown-body",buttonIndicatorHolder:"onesignal-button-indicator-holder",cancelButton:"onesignal-slidedown-cancel-button",container:"onesignal-slidedown-container",dialog:"onesignal-slidedown-dialog",footer:"slidedown-footer",reset:"onesignal-reset",savingStateButton:"onesignal-saving-state-button",slideUp:"slide-up",slideDown:"slide-down",closeSlidedown:"close-slidedown",icon:"slidedown-body-icon",message:"slidedown-body-message",defaultIcon:"default-icon",loadingContainer:"onesignal-loading-container",clearfix:"clearfix"},_={toastText:"onesignal-toast-text"},D={toastText:"onesignal-toast-text"},R={allowButton:"onesignal-slidedown-allow-button",body:"slidedown-body",buttonIndicatorHolder:"onesignal-button-indicator-holder",cancelButton:"onesignal-slidedown-cancel-button",container:"onesignal-slidedown-container",dialog:"onesignal-slidedown-dialog",footer:"slidedown-footer",normalSlidedown:"normal-slidedown",loadingContainer:"onesignal-loading-container"},U={alignRight:"align-right",primary:"primary",secondary:"secondary",slidedownButton:"slidedown-button"},W={categoryLabelInput:"onesignal-category-label-input",categoryLabelText:"onesignal-category-label-text",categoryLabel:"onesignal-category-label",checkmark:"onesignal-checkmark",taggingContainer:"tagging-container",taggingContainerCol:"tagging-container-col",loadingMessage:"onesignal-loading-message"},B={taggingContainer:"tagging-container"},L="data:image/svg+xml,%3Csvg fill='none' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 40 40'%3E%3Cg clip-path='url(%23clip0)'%3E%3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M33.232 28.434a2.5 2.5 0 001.768.733 1.667 1.667 0 010 3.333H5a1.667 1.667 0 110-3.333 2.5 2.5 0 002.5-2.5v-8.104A13.262 13.262 0 0118.333 5.122V1.667a1.666 1.666 0 113.334 0v3.455A13.262 13.262 0 0132.5 18.563v8.104a2.5 2.5 0 00.732 1.767zM16.273 35h7.454a.413.413 0 01.413.37 4.167 4.167 0 11-8.28 0 .417.417 0 01.413-.37z' fill='%23BDC4CB'/%3E%3C/g%3E%3Cdefs%3E%3CclipPath id='clip0'%3E%3Cpath fill='%23fff' d='M0 0h40v40H0z'/%3E%3C/clipPath%3E%3C/defs%3E%3C/svg%3E",V="data:image/svg+xml;charset=UTF-8,%3csvg width='16' height='16' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M7.98775 -0.00114406C5.85015 0.0338508 3.81219 0.908665 2.31442 2.43419C1.565 3.18031 0.973715 4.06987 0.575897 5.04969C0.17808 6.02952 -0.0180997 7.07949 -0.000914196 8.13686C-0.00214385 9.17005 0.200528 10.1933 0.595487 11.148C0.990446 12.1028 1.56993 12.9702 2.30072 13.7005C3.03151 14.4309 3.89925 15.0098 4.85421 15.4042C5.80916 15.7986 6.83256 16.0007 7.86575 15.9989H8.00842C10.1467 15.9769 12.1889 15.1075 13.6869 13.5816C15.185 12.0557 16.0165 9.99781 15.9991 7.85952C16.0015 6.8138 15.7949 5.77814 15.3913 4.81345C14.9876 3.84876 14.3952 2.97451 13.6488 2.24213C12.9023 1.50974 12.017 0.933994 11.0448 0.548751C10.0726 0.163508 9.03324 -0.0234551 7.98775 -0.00114406ZM6.99909 11.0269C6.99428 10.8961 7.01558 10.7658 7.06175 10.6434C7.10792 10.521 7.17803 10.4091 7.26797 10.3141C7.35792 10.2191 7.4659 10.143 7.58559 10.0903C7.70529 10.0375 7.8343 10.0092 7.96509 10.0069H7.98309C8.24616 10.0074 8.49882 10.1097 8.6881 10.2924C8.87739 10.4751 8.9886 10.724 8.99842 10.9869C9.00331 11.1176 8.98207 11.248 8.93594 11.3704C8.8898 11.4928 8.8197 11.6048 8.72974 11.6998C8.63978 11.7948 8.53176 11.8709 8.41202 11.9236C8.29229 11.9763 8.16323 12.0046 8.03242 12.0069H8.01442C7.75145 12.006 7.49897 11.9036 7.30976 11.721C7.12054 11.5383 7.00923 11.2896 6.99909 11.0269ZM7.33242 8.33219V4.33219C7.33242 4.15538 7.40266 3.98581 7.52768 3.86079C7.65271 3.73576 7.82227 3.66552 7.99909 3.66552C8.1759 3.66552 8.34547 3.73576 8.47049 3.86079C8.59551 3.98581 8.66575 4.15538 8.66575 4.33219V8.33219C8.66575 8.509 8.59551 8.67857 8.47049 8.80359C8.34547 8.92862 8.1759 8.99886 7.99909 8.99886C7.82227 8.99886 7.65271 8.92862 7.52768 8.80359C7.40266 8.67857 7.33242 8.509 7.33242 8.33219Z' fill='%23E54B4D'/%3e%3c/svg%3e",F={greyLoadingIndicator:"#95A1AC",whiteLoadingIndicator:"#FFFFFF"},H={fetchingPreferences:"Fetching your preferences"},$={channelCaptureContainer:"channel-capture-container",inputWithValidationElement:"input-with-validation-element",onesignalErrorInput:"onesignal-error-input",onesignalSmsInput:"iti-onesignal-sms-input",onesignalEmailInput:"onesignal-email-input",onesignalValidationElementHidden:"onesignal-validation-element-hidden",onesignalValidationElement:"onesignal-validation-element"},G={channelCaptureContainer:"channel-capture-container",smsInputWithValidationElement:"sms-input-with-validation-element",emailInputWithValidationElement:"email-input-with-validation-element",onesignalSmsInput:"iti-onesignal-sms-input",onesignalEmailInput:"onesignal-email-input",onesignalSmsValidationElement:"onesignal-sms-validation-element",onesignalEmailValidationElement:"onesignal-email-validation-element"},z={containerClass:"onesignal-customlink-container",subscribeClass:"onesignal-customlink-subscribe",explanationClass:"onesignal-customlink-explanation",resetClass:"onesignal-reset",hide:"hide",state:{subscribed:"state-subscribed",unsubscribed:"state-unsubscribed"}},q={containerSelector:`.${z.containerClass}`,subscribeSelector:`.${z.subscribeClass}`,explanationSelector:`.${z.explanationClass}`};var K=i(2);class Y{constructor(e){this.config=e}initialize(){return Object(d.a)(this,void 0,void 0,function*(){var e,t;if((null===(e=this.config)||void 0===e?void 0:e.enabled)&&(yield this.loadSdkStyles()))if(E.a.info("OneSignal: initializing customlink"),(null===(t=this.config)||void 0===t?void 0:t.unsubscribeEnabled)||!Y.isPushEnabled())for(let e=0;eObject(d.a)(this,void 0,void 0,function*(){E.a.info("CustomLink: subscribe clicked"),yield this.handleClick(t)})),e.appendChild(t)}}else E.a.error("CustomLink: required property 'text' is missing in the config")})}loadSdkStyles(){return Object(d.a)(this,void 0,void 0,function*(){return 0===(yield OneSignal.context.dynamicResourceLoader.loadSdkStylesheet())||(E.a.debug("Not initializing custom link button because styles failed to load."),!1)})}hideElement(e){Object(K.a)(e,z.hide)}hideCustomLinkContainers(){this.customlinkContainerElements.forEach(e=>{this.hideElement(e)})}handleClick(e){return Object(d.a)(this,void 0,void 0,function*(){var t,i;if(Y.isPushEnabled())yield OneSignal.setSubscription(!1),yield this.setTextFromPushStatus(e);else{if(!Y.isOptedOut()){const e={autoAccept:!OneSignal.environmentInfo.requiresUserInteraction};return yield OneSignal.registerForPushNotifications(e),void(!(null===(t=this.config)||void 0===t?void 0:t.unsubscribeEnabled)&&Y.isPushEnabled()&&this.hideCustomLinkContainers())}yield OneSignal.setSubscription(!0),!(null===(i=this.config)||void 0===i?void 0:i.unsubscribeEnabled)&&Y.isPushEnabled()&&this.hideCustomLinkContainers()}})}setTextFromPushStatus(e){return Object(d.a)(this,void 0,void 0,function*(){var t,i,n,o;(null===(i=null===(t=this.config)||void 0===t?void 0:t.text)||void 0===i?void 0:i.subscribe)&&(Y.isPushEnabled()||(e.textContent=this.config.text.subscribe)),(null===(o=null===(n=this.config)||void 0===n?void 0:n.text)||void 0===o?void 0:o.unsubscribe)&&Y.isPushEnabled()&&(e.textContent=this.config.text.unsubscribe)})}setCustomColors(e){var t,i,n,o,s,r,a;(null===(t=this.config)||void 0===t?void 0:t.color)&&this.config.color.text&&("button"===(null===(i=this.config)||void 0===i?void 0:i.style)&&(null===(n=this.config)||void 0===n?void 0:n.color.button)?(e.style.backgroundColor=null===(o=this.config)||void 0===o?void 0:o.color.button,e.style.color=null===(s=this.config)||void 0===s?void 0:s.color.text):"link"===(null===(r=this.config)||void 0===r?void 0:r.style)&&(e.style.color=null===(a=this.config)||void 0===a?void 0:a.color.text))}get customlinkContainerElements(){const e=document.querySelectorAll(q.containerSelector);return Array.prototype.slice.call(e)}static isPushEnabled(){return k.getIsPushNotificationsEnabled()}static isOptedOut(){return k.getIsOptedOut()}}class J{static onNotificationPermissionChange(){J.checkAndTriggerSubscriptionChanged()}static onInternalSubscriptionSet(e){return Object(d.a)(this,void 0,void 0,function*(){v.put("subscription.optedOut",e)})}static checkAndTriggerSubscriptionChanged(){return Object(d.a)(this,void 0,void 0,function*(){I.a.logMethodCall("checkAndTriggerSubscriptionChanged");const e=yield OneSignal.context.subscriptionManager.getSubscriptionState(),t=yield OneSignal.privateIsPushNotificationsEnabled(),i=yield w.a.getAppState(),{lastKnownPushEnabled:n}=i;(null===n||t!==n)&&(E.a.info("The user's subscription state changed from "+`${null===n?"(not stored)":n} ⟶ ${e.subscribed}`),k.setIsPushNotificationsEnabled(t),i.lastKnownPushEnabled=t,yield w.a.setAppState(i),J.triggerSubscriptionChanged(t))})}static _onSubscriptionChanged(e){return Object(d.a)(this,void 0,void 0,function*(){J.onSubscriptionChanged_showWelcomeNotification(e),J.onSubscriptionChanged_sendCategorySlidedownTags(e),J.onSubscriptionChanged_evaluateNotifyButtonDisplayPredicate(),J.onSubscriptionChanged_updateCustomLink()})}static onSubscriptionChanged_sendCategorySlidedownTags(e){return Object(d.a)(this,void 0,void 0,function*(){var t,i;if(!0!==e)return;const n=null===(i=null===(t=OneSignal.context.appConfig.userConfig.promptOptions)||void 0===t?void 0:t.slidedown)||void 0===i?void 0:i.prompts;C.isCategorySlidedownConfigured(n)&&(yield OneSignal.context.tagManager.sendTags(!1))})}static onSubscriptionChanged_showWelcomeNotification(e){return Object(d.a)(this,void 0,void 0,function*(){if(OneSignal.__doNotShowWelcomeNotification)return void E.a.debug("Not showing welcome notification because user has previously subscribed.");const t=OneSignal.config.userConfig.welcomeNotification;if(void 0!==t&&!0===t.disable)return;if(!0!==e)return;if(J.sendingOrSentWelcomeNotification)return;J.sendingOrSentWelcomeNotification=!0;let i=void 0!==t&&void 0!==t.title&&null!==t.title?t.title:"",n=void 0!==t&&void 0!==t.message&&null!==t.message&&t.message.length>0?t.message:"Thanks for subscribing!";const o=new URL(location.href).origin+"?_osp=do_not_open",s=t&&t.url&&t.url.length>0?t.url:o;i=P.a.decodeHtmlEntities(i),n=P.a.decodeHtmlEntities(n),E.a.debug("Sending welcome notification."),OneSignal.sendSelfNotification(i,n,s,void 0,{__isOneSignalWelcomeNotification:!0},void 0),S.a.trigger(OneSignal.EVENTS.WELCOME_NOTIFICATION_SENT,{title:i,message:n,url:s})})}static onSubscriptionChanged_evaluateNotifyButtonDisplayPredicate(){return Object(d.a)(this,void 0,void 0,function*(){if(!OneSignal.config.userConfig.notifyButton)return;const e=OneSignal.config.userConfig.notifyButton.displayPredicate;if(e&&"function"==typeof e&&OneSignal.notifyButton){!1!==(yield e())?(E.a.debug("Showing notify button because display predicate returned true."),OneSignal.notifyButton.launcher.show()):(E.a.debug("Hiding notify button because display predicate returned false."),OneSignal.notifyButton.launcher.hide())}})}static onSubscriptionChanged_updateCustomLink(){return Object(d.a)(this,void 0,void 0,function*(){OneSignal.config.userConfig.promptOptions&&new Y(OneSignal.config.userConfig.promptOptions.customlink).initialize()})}static triggerSubscriptionChanged(e){S.a.trigger(OneSignal.EVENTS.SUBSCRIPTION_CHANGED,e)}static fireStoredNotificationClicks(e=document.URL){return Object(d.a)(this,void 0,void 0,function*(){function t(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield w.a.getAppState();t.clickedNotifications[e.url]=null,yield w.a.setAppState(t);const{data:i,timestamp:n}=e;if(n){if((Date.now()-n)/1e3/60>5)return}S.a.trigger(OneSignal.EVENTS.NOTIFICATION_CLICKED,i)})}const i=yield w.a.getAppState();if("origin"===(yield w.a.get("Options","notificationClickHandlerMatch"))){for(const e of Object.keys(i.clickedNotifications))if(new URL(e).origin===location.origin){yield t(i.clickedNotifications[e])}}else{var n=i.clickedNotifications[e];if(n)yield t(n);else if(!n&&e.endsWith("/")){var o=e.substring(0,e.length-1);(n=i.clickedNotifications[o])&&(yield t(n))}}})}}J.sendingOrSentWelcomeNotification=!1;var Q,Z,X=i(6);class ee{static promiseStub(){return{then:ee.promiseStub,catch:ee.promiseStub}}static ensureBackwardsCompatibility(e){ee.environmentPolyfill(e),ee.postmams(e),e.syncHashedEmail=ee.promiseStub}static environmentPolyfill(e){e.environment={},e.environment.getEnv=function(){return""},e.environment.isPopup=function(){return T.a.getWindowEnv()===X.a.OneSignalSubscriptionPopup},e.environment.isIframe=function(){return T.a.getWindowEnv()===X.a.OneSignalProxyFrame}}static postmams(e){const t=function(){this.messenger.message.apply(this.messenger,arguments)},i=function(){this.messenger.postMessage.apply(this.messenger,arguments)};function n(e){e.message=t,e.postMessage=i}e.proxyFrame&&(e.iframePostmam=e.proxyFrame,n(e.iframePostmam)),e.subscriptionPopup&&(e.popupPostmam=e.subscriptionPopup,n(e.popupPostmam)),e.subscriptionModal&&(e.modalPostmam=e.subscriptionModal,n(e.modalPostmam))}}!function(e){e[e.Default=0]="Default",e[e.Subscribed=1]="Subscribed",e[e.MutedByApi=-2]="MutedByApi",e[e.NotSubscribed=-10]="NotSubscribed",e[e.TemporaryWebRecord=-20]="TemporaryWebRecord",e[e.PermissionRevoked=-21]="PermissionRevoked",e[e.PushSubscriptionRevoked=-22]="PushSubscriptionRevoked",e[e.ServiceWorkerStatus403=-23]="ServiceWorkerStatus403",e[e.ServiceWorkerStatus404=-24]="ServiceWorkerStatus404"}(Q||(Q={}));class te extends p.a{constructor(){super("This code is not implemented yet."),Object.setPrototypeOf(this,te.prototype)}}!function(e){e[e.ChromeLike=5]="ChromeLike",e[e.SafariLegacy=7]="SafariLegacy",e[e.Firefox=8]="Firefox",e[e.Email=11]="Email",e[e.Edge=12]="Edge",e[e.SMS=14]="SMS",e[e.SafariVapid=17]="SafariVapid"}(Z||(Z={}));class ie{constructor(){this.language=h.a.getLanguage(),this.timezone=-60*(new Date).getTimezoneOffset(),this.timezoneId=Intl.DateTimeFormat().resolvedOptions().timeZone;const e=parseInt(String(g.a.version),10);this.browserVersion=isNaN(e)?-1:e,this.deviceModel=navigator.platform,this.sdkVersion=h.a.version().toString(),this.deliveryPlatform=this.getDeliveryPlatform()}getDeliveryPlatform(){const e=I.a.redetectBrowserUserAgent();return h.a.useSafariLegacyPush()?Z.SafariLegacy:h.a.useSafariVapidPush()?Z.SafariVapid:e.firefox?Z.Firefox:e.msedge?Z.Edge:Z.ChromeLike}serialize(){const e={device_type:this.deliveryPlatform,language:this.language,timezone:this.timezone,timezone_id:this.timezoneId,device_os:this.browserVersion,device_model:this.deviceModel,sdk:this.sdkVersion,notification_types:this.subscriptionState};return this.appId&&(e.app_id=this.appId),this.externalUserId&&(e.external_user_id=this.externalUserId),this.externalUserIdAuthHash&&(e.external_user_id_auth_hash=this.externalUserIdAuthHash),e}deserialize(e){throw new te}}class ne extends ie{constructor(e){super(),this.subscription=e}serialize(){const e=super.serialize();return this.subscription&&(e.identifier=h.a.useSafariLegacyPush()?this.subscription.safariDeviceToken:this.subscription.w3cEndpoint?this.subscription.w3cEndpoint.toString():null,e.web_auth=this.subscription.w3cAuth,e.web_p256=this.subscription.w3cP256dh),e}static createFromPushSubscription(e,t,i){const n=new ne(t);return n.appId=e,n.subscriptionState=t?Q.Subscribed:Q.NotSubscribed,i&&(n.subscriptionState=i),n}deserialize(e){throw new te}}var oe,se,re=i(17),ae=i(5);(se=oe||(oe={}))[se.Blocked=0]="Blocked",se[se.Dismissed=1]="Dismissed",se[se.Default=2]="Default";class ce extends p.a{constructor(e){let t;switch(e){case oe.Dismissed:t="The user dismissed the permission prompt.";break;case oe.Blocked:t="Notification permissions are blocked.";break;case oe.Default:t="Notification permissions have not been granted yet."}super(t),this.reason=e,Object.setPrototypeOf(this,ce.prototype)}}class le{isNewSubscription(){return this.existingW3cPushSubscription?!!this.existingW3cPushSubscription.w3cEndpoint!=!!this.w3cEndpoint||(!(!this.existingW3cPushSubscription.w3cEndpoint||!this.w3cEndpoint||this.existingW3cPushSubscription.w3cEndpoint.toString()===this.w3cEndpoint.toString())||(this.existingW3cPushSubscription.w3cP256dh!==this.w3cP256dh||this.existingW3cPushSubscription.w3cAuth!==this.w3cAuth)):!this.existingSafariDeviceToken||this.existingSafariDeviceToken!==this.safariDeviceToken}static setFromW3cSubscription(e){const t=new le;if(e&&(t.w3cEndpoint=new URL(e.endpoint),e.getKey)){let i=null;try{i=e.getKey("p256dh")}catch(e){}let n=null;try{n=e.getKey("auth")}catch(e){}if(i){const e=btoa(String.fromCharCode.apply(null,new Uint8Array(i)));t.w3cP256dh=e}if(n){const e=btoa(String.fromCharCode.apply(null,new Uint8Array(n)));t.w3cAuth=e}}return t}setFromSafariSubscription(e){this.safariDeviceToken=e}serialize(){return{w3cEndpoint:this.w3cEndpoint?this.w3cEndpoint.toString():null,w3cP256dh:this.w3cP256dh,w3cAuth:this.w3cAuth,safariDeviceToken:this.safariDeviceToken,existingPushSubscription:this.existingW3cPushSubscription?this.existingW3cPushSubscription.serialize():null,existingSafariDeviceToken:this.existingSafariDeviceToken}}static deserialize(e){const t=new le;if(!e)return t;try{t.w3cEndpoint=new URL(e.w3cEndpoint)}catch(e){}return t.w3cP256dh=e.w3cP256dh,t.w3cAuth=e.w3cAuth,t.existingW3cPushSubscription=void 0,e.existingW3cPushSubscription?t.existingW3cPushSubscription=le.deserialize(e.existingW3cPushSubscription):e.existingPushSubscription&&(t.existingW3cPushSubscription=le.deserialize(e.existingPushSubscription)),t.safariDeviceToken=e.safariDeviceToken,t.existingSafariDeviceToken=e.existingSafariDeviceToken,t}}var de,ue=i(13);!function(e){e.Safari="safari",e.Firefox="firefox",e.Chrome="chrome",e.Opera="opera",e.Edge="edge",e.Other="other"}(de||(de={}));class ge{static registerForPush(){return Object(d.a)(this,void 0,void 0,function*(){const e=k.getIsPushNotificationsEnabled();return yield ge.internalRegisterForPush(e)})}static internalRegisterForPush(e){return Object(d.a)(this,void 0,void 0,function*(){const t=OneSignal.context;let i=null;if(e&&!t.pageViewManager.isFirstPageView()){E.a.debug("Not registering for push because the user is subscribed and this is not the first page view."),E.a.debug("But we want to rekindle their session.");const e=yield he.getDeviceId();if(e){const t=yield he.createDeviceRecord(OneSignal.config.appId,!0);yield OneSignal.context.sessionManager.upsertSession(e,t,ue.b.PageRefresh)}else E.a.error("Should have been impossible to have push as enabled but no device id.");return null}if("undefined"!=typeof OneSignal){if(OneSignal._isRegisteringForPush)return null;OneSignal._isRegisteringForPush=!0}switch(T.a.getWindowEnv()){case X.a.Host:case X.a.OneSignalSubscriptionModal:try{const e=yield t.subscriptionManager.subscribe(0);i=yield t.subscriptionManager.registerSubscription(e),t.pageViewManager.incrementPageViewCount(),yield re.a.triggerNotificationPermissionChanged(),yield J.checkAndTriggerSubscriptionChanged()}catch(e){E.a.info(e)}break;case X.a.OneSignalSubscriptionPopup:const e=opener||parent;let n;yield t.permissionManager.updateStoredPermission();try{n=yield t.subscriptionManager.subscribe(1),yield t.permissionManager.updateStoredPermission()}catch(i){if(yield t.permissionManager.updateStoredPermission(),i instanceof ce)switch(i.reason){case oe.Blocked:yield t.permissionManager.updateStoredPermission(),OneSignal.subscriptionPopup.message(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION_CHANGED,{permission:y.Denied,forceUpdatePermission:!1});break;case oe.Dismissed:OneSignal.subscriptionPopup.message(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION_CHANGED,{permission:y.Default,forceUpdatePermission:!0})}if(e)return window.close(),null}OneSignal.subscriptionPopup.message(OneSignal.POSTMAM_COMMANDS.FINISH_REMOTE_REGISTRATION,{rawPushSubscription:n.serialize()},t=>{!0===t.data.progress?(E.a.debug("Got message from host page that remote reg. is in progress, closing popup."),e&&window.close()):E.a.debug("Got message from host page that remote reg. could not be finished.")});break;default:throw"undefined"!=typeof OneSignal&&(OneSignal._isRegisteringForPush=!1),new m(o.UnsupportedEnvironment)}return"undefined"!=typeof OneSignal&&(OneSignal._isRegisteringForPush=!1),i})}static getRawPushSubscriptionForSafari(e){const t=new le,{deviceToken:i}=window.safari.pushNotification.permission(e);return t.existingSafariDeviceToken=i,t}static getRawPushSubscriptionFromServiceWorkerRegistration(e){return Object(d.a)(this,void 0,void 0,function*(){if(!e)return null;const t=yield e.pushManager.getSubscription();return t?le.setFromW3cSubscription(t):null})}static getRawPushSubscriptionWhenUsingSubscriptionWorkaround(){return Object(d.a)(this,void 0,void 0,function*(){return null})}static getRawPushSubscription(e,t){return Object(d.a)(this,void 0,void 0,function*(){if(e.browserType===de.Safari)return ge.getRawPushSubscriptionForSafari(t);if(e.isUsingSubscriptionWorkaround)return ge.getRawPushSubscriptionWhenUsingSubscriptionWorkaround();if(e.isBrowserAndSupportsServiceWorkers){const e=yield OneSignal.context.serviceWorkerManager.getRegistration();return yield ge.getRawPushSubscriptionFromServiceWorkerRegistration(e)}return null})}}class he{static getCurrentNotificationType(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield OneSignal.context.permissionManager.getNotificationPermission(OneSignal.context.appConfig.safariWebId);if(e===y.Default)return Q.Default;if(e===y.Denied)return I.a.isUsingSubscriptionWorkaround()?Q.Default:Q.NotSubscribed;const t=yield OneSignal.context.subscriptionManager.isAlreadyRegisteredWithOneSignal();if(e===y.Granted&&t){return(yield OneSignal.privateIsPushNotificationsEnabled())?Q.Subscribed:Q.MutedByApi}return Q.Default})}static getNotificationTypeFromOptIn(e){return 1==e||null==e?Q.Subscribed:Q.MutedByApi}static markHttpSlidedownShown(){sessionStorage.setItem("ONESIGNAL_HTTP_PROMPT_SHOWN","true")}static isHttpPromptAlreadyShown(){return"true"==sessionStorage.getItem("ONESIGNAL_HTTP_PROMPT_SHOWN")}static checkAndTriggerNotificationPermissionChanged(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield w.a.get("Options","notificationPermission"),t=yield OneSignal.getNotificationPermission();e!==t&&(yield re.a.triggerNotificationPermissionChanged(),yield w.a.put("Options",{key:"notificationPermission",value:t}))})}static getNotificationIcons(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield he.getAppId();if(!e)throw new m(o.MissingAppId);const t=`${T.a.getOneSignalApiUrl().toString()}/apps/${e}/icon`,i=yield(yield fetch(t)).json();if(i.errors)throw E.a.error(`API call %c${t}`,ae.a.getConsoleStyle("code"),"failed with:",i.errors),new Error("Failed to get notification icons.");return i})}static getSlidedownOptions(e){return ae.a.getValueOrDefault(e.slidedown,{prompts:[]})}static getFullscreenPermissionMessageOptions(e){return e?e.fullscreen?{autoAcceptTitle:e.fullscreen.autoAcceptTitle,actionMessage:e.fullscreen.actionMessage,exampleNotificationTitleDesktop:e.fullscreen.title,exampleNotificationTitleMobile:e.fullscreen.title,exampleNotificationMessageDesktop:e.fullscreen.message,exampleNotificationMessageMobile:e.fullscreen.message,exampleNotificationCaption:e.fullscreen.caption,acceptButton:e.fullscreen.acceptButton,cancelButton:e.fullscreen.cancelButton}:e:null}static getPromptOptionsQueryString(){let e="";if(he.getFullscreenPermissionMessageOptions(OneSignal.config.userConfig.promptOptions)){const t=he.getPromptOptionsPostHash();for(const i of Object.keys(t)){e+="&"+i+"="+t[i]}}return e}static getPromptOptionsPostHash(){const e=he.getFullscreenPermissionMessageOptions(OneSignal.config.userConfig.promptOptions);if(e){var t={exampleNotificationTitleDesktop:"exampleNotificationTitle",exampleNotificationMessageDesktop:"exampleNotificationMessage",exampleNotificationTitleMobile:"exampleNotificationTitle",exampleNotificationMessageMobile:"exampleNotificationMessage"};for(const i of Object.keys(t)){const n=t[i];e[i]&&(e[n]=e[i])}for(var i=["autoAcceptTitle","siteName","autoAcceptTitle","subscribeText","showGraphic","actionMessage","exampleNotificationTitle","exampleNotificationMessage","exampleNotificationCaption","acceptButton","cancelButton","timeout"],n={},o=0;o=0;e--){i[e]===t&&i.splice(e,1)}}}class ye{constructor(e,t=new Oe){this.context=e,this.replies=t}broadcast(e,t){return Object(d.a)(this,void 0,void 0,function*(){if(T.a.getWindowEnv()!==X.a.ServiceWorker)return;const i=yield self.clients.matchAll({type:"window",includeUncontrolled:!0});for(const n of i)E.a.debug(`[Worker Messenger] [SW -> Page] Broadcasting '${e.toString()}' to window client ${n.url}.`),n.postMessage({command:e,payload:t})})}unicast(e,t,i){return Object(d.a)(this,void 0,void 0,function*(){if(T.a.getWindowEnv()===X.a.ServiceWorker){if(!i)throw new InvalidArgumentError.a("windowClient",InvalidArgumentError.b.Empty);E.a.debug(`[Worker Messenger] [SW -> Page] Unicasting '${e.toString()}' to window client ${i.url}.`),i.postMessage({command:e,payload:t})}else E.a.debug(`[Worker Messenger] [Page -> SW] Unicasting '${e.toString()}' to service worker.`),this.directPostMessageToSW(e,t)})}directPostMessageToSW(e,t){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug(`[Worker Messenger] [Page -> SW] Direct command '${e.toString()}' to service worker.`);const i=yield this.context.serviceWorkerManager.getRegistration();if(!i)return void E.a.error("`[Worker Messenger] [Page -> SW] Could not get ServiceWorkerRegistration to postMessage!");const n=ve.getAvailableServiceWorker(i);n?n.postMessage({command:e,payload:t}):E.a.error("`[Worker Messenger] [Page -> SW] Could not get ServiceWorker to postMessage!")})}listen(){return Object(d.a)(this,void 0,void 0,function*(){if(!h.a.supportsServiceWorkers())return;T.a.getWindowEnv()===X.a.ServiceWorker?(self.addEventListener("message",this.onWorkerMessageReceivedFromPage.bind(this)),E.a.debug("[Worker Messenger] Service worker is now listening for messages.")):yield this.listenForPage()})}listenForPage(){return Object(d.a)(this,void 0,void 0,function*(){navigator.serviceWorker.addEventListener("message",this.onPageMessageReceivedFromServiceWorker.bind(this)),E.a.debug(`(${location.origin}) [Worker Messenger] Page is now listening for messages.`)})}onWorkerMessageReceivedFromPage(e){const t=e.data;if(!t||!t.command)return;const i=this.replies.findListenersForMessage(t.command),n=[],o=[];E.a.debug("[Worker Messenger] Service worker received message:",e.data);for(const e of i)e.onceListenerOnly&&n.push(e),o.push(e);for(let e=n.length-1;e>=0;e--){const i=n[e];this.replies.deleteListenerRecord(t.command,i)}for(const e of o)e.callback.apply(null,[t.payload])}onPageMessageReceivedFromServiceWorker(e){const t=e.data;if(!t||!t.command)return;const i=this.replies.findListenersForMessage(t.command),n=[],o=[];E.a.debug("[Worker Messenger] Page received message:",e.data);for(const e of i)e.onceListenerOnly&&n.push(e),o.push(e);for(let e=n.length-1;e>=0;e--){const i=n[e];this.replies.deleteListenerRecord(t.command,i)}for(const e of o)e.callback.apply(null,[t.payload])}on(e,t){this.replies.addListener(e,t,!1)}once(e,t){this.replies.addListener(e,t,!0)}off(e){e?this.replies.deleteListenerRecords(e):this.replies.deleteAllListenerRecords()}}class we{constructor(){this.cache={}}getCache(){return Object.assign({},this.cache)}loadSdkStylesheet(){return Object(d.a)(this,void 0,void 0,function*(){const e=T.a.getOneSignalResourceUrlPath(),t=T.a.getOneSignalCssFileName();return yield this.loadIfNew(0,new URL(`${e}/${t}?v=${h.a.getSdkStylesVersionHash()}`))})}loadFetchPolyfill(){return Object(d.a)(this,void 0,void 0,function*(){return yield this.loadIfNew(1,new URL("https://cdnjs.cloudflare.com/ajax/libs/fetch/2.0.3/fetch.min.js"))})}loadIfNew(e,t){return Object(d.a)(this,void 0,void 0,function*(){return this.cache[t.toString()]||(this.cache[t.toString()]=we.load(e,t)),yield this.cache[t.toString()]})}static load(e,t){return Object(d.a)(this,void 0,void 0,function*(){try{return yield new Promise((i,n)=>{switch(e){case 1:(o=document.createElement("script")).setAttribute("type","text/javascript"),o.setAttribute("async","async"),o.setAttribute("src",t.toString());break;case 0:var o;(o=document.createElement("link")).setAttribute("rel","stylesheet"),o.setAttribute("href",t.toString())}o.onerror=n,o.onload=i,document.querySelector("head").appendChild(o)}),0}catch(e){return 1}})}}var Ee,Ie,Pe,Ce=i(15),Te=i(23);class Ae{constructor(e,t,i,n="shown",o=["opacity","transform"],s,r=500){this.selector=e,this.showClass=t,this.hideClass=i,this.state=n,this.targetTransitionEvents=o,this.nestedContentSelector=s,this.transitionCheckTimeout=r}show(){return this.hidden?new Promise(e=>{this.state="showing",S.a.trigger(Ae.EVENTS.SHOWING,this);const t=this.element;if(t?(this.hideClass&&Object(K.v)(t,this.hideClass),this.showClass&&Object(K.a)(t,this.showClass)):E.a.error(`(show) could not find animated element with selector ${this.selector}`),0==this.targetTransitionEvents.length)return e(this);var i=setTimeout(()=>{E.a.debug(`Element did not completely show (state: ${this.state}).`)},this.transitionCheckTimeout);Object(K.u)(this.element,"transitionend",(t,n)=>{if(t.target===this.element&&Object(K.f)(this.targetTransitionEvents,t.propertyName))return clearTimeout(i),n(),this.state="shown",S.a.trigger(Ae.EVENTS.SHOWN,this),e(this)},!0)}):Promise.resolve(this)}hide(){return this.shown?new Promise(e=>{this.state="hiding",S.a.trigger(Ae.EVENTS.HIDING,this);const t=this.element;if(t?(this.showClass&&Object(K.v)(t,this.showClass),this.hideClass&&Object(K.a)(t,this.hideClass)):E.a.error(`(hide) could not find animated element with selector ${this.selector}`),0==this.targetTransitionEvents.length)return e(this);Object(K.u)(this.element,"transitionend",(t,i)=>{var n=setTimeout(()=>{E.a.debug(`Element did not completely hide (state: ${this.state}).`)},this.transitionCheckTimeout);if(t.target===this.element&&Object(K.f)(this.targetTransitionEvents,t.propertyName))return clearTimeout(n),i(),this.state="hidden",S.a.trigger(Ae.EVENTS.HIDDEN,this),e(this)},!0)}):Promise.resolve(this)}waitUntilShown(){return"shown"===this.state?Promise.resolve(this):new Promise(e=>{Bi.emitter.once(Ae.EVENTS.SHOWN,t=>{if(t===this)return e(this)})})}waitUntilHidden(){return"hidden"===this.state?Promise.resolve(this):new Promise(e=>{Bi.emitter.once(Ae.EVENTS.HIDDEN,t=>{if(t===this)return e(this)})})}static get EVENTS(){return{SHOWING:"animatedElementShowing",SHOWN:"animatedElementShown",HIDING:"animatedElementHiding",HIDDEN:"animatedElementHidden"}}get content(){if(!this.element)return"";if(this.nestedContentSelector){const e=this.element.querySelector(this.nestedContentSelector);return e?e.innerHTML:""}return this.element.innerHTML}set content(e){if(this.element)if(this.nestedContentSelector){const t=this.element.querySelector(this.nestedContentSelector);t&&(t.innerHTML=e)}else this.element.innerHTML=e}get element(){return document.querySelector(this.selector)}get showing(){return"showing"===this.state}get shown(){return"shown"===this.state}get hiding(){return"hiding"===this.state}get hidden(){return"hidden"===this.state}}class Me extends Ae{constructor(e,t,i,n,o,s="shown",r="active",a=["opacity","transform"],c){super(e,t,i,s,a),this.selector=e,this.showClass=t,this.hideClass=i,this.activeClass=n,this.inactiveClass=o,this.state=s,this.activeState=r,this.targetTransitionEvents=a,this.nestedContentSelector=c}activate(){return this.inactive&&this.shown?new Promise(e=>{this.activeState="activating",S.a.trigger(Me.EVENTS.ACTIVATING,this);const t=this.element;if(t?(this.inactiveClass&&Object(K.v)(t,this.inactiveClass),this.activeClass&&Object(K.a)(t,this.activeClass)):E.a.error("Could not find active animated element"),!this.shown)return E.a.debug("Ending activate() transition (alternative)."),this.activeState="active",S.a.trigger(Me.EVENTS.ACTIVE,this),e(this);if(0==this.targetTransitionEvents.length)return e(this);var i=setTimeout(()=>{E.a.debug(`Element did not completely activate (state: ${this.state}, activeState: ${this.activeState}).`)},this.transitionCheckTimeout);Object(K.u)(this.element,"transitionend",(t,n)=>{if(t.target===this.element&&Object(K.f)(this.targetTransitionEvents,t.propertyName))return clearTimeout(i),n(),this.activeState="active",S.a.trigger(Me.EVENTS.ACTIVE,this),e(this)},!0)}):Promise.resolve(this)}inactivate(){return this.active?new Promise(e=>{this.activeState="inactivating",S.a.trigger(Me.EVENTS.INACTIVATING,this);const t=this.element;if(t?(this.activeClass&&Object(K.v)(t,this.activeClass),this.inactiveClass&&Object(K.a)(t,this.inactiveClass)):E.a.error("Could not find active animated element"),!this.shown)return this.activeState="inactive",S.a.trigger(Me.EVENTS.INACTIVE,this),e(this);if(0==this.targetTransitionEvents.length)return e(this);var i=setTimeout(()=>{E.a.debug(`Element did not completely inactivate (state: ${this.state}, activeState: ${this.activeState}).`)},this.transitionCheckTimeout);Object(K.u)(this.element,"transitionend",(t,n)=>{if(t.target===this.element&&Object(K.f)(this.targetTransitionEvents,t.propertyName))return clearTimeout(i),n(),this.activeState="inactive",S.a.trigger(Me.EVENTS.INACTIVE,this),e(this)},!0)}):Promise.resolve(this)}waitUntilActive(){return this.active?Promise.resolve(this):new Promise(e=>{Bi.emitter.once(Me.EVENTS.ACTIVE,t=>{if(t===this)return e(this)})})}waitUntilInactive(){return this.inactive?Promise.resolve(this):new Promise(e=>{Bi.emitter.once(Me.EVENTS.INACTIVE,t=>{if(t===this)return e(this)})})}static get EVENTS(){return Object.assign(Object.assign({},Ae.EVENTS),{ACTIVATING:"activeAnimatedElementActivating",ACTIVE:"activeAnimatedElementActive",INACTIVATING:"activeAnimatedElementInactivating",INACTIVE:"activeAnimatedElementInactive"})}get activating(){return"activating"===this.activeState}get active(){return"active"===this.activeState}get inactivating(){return"inactivating"===this.activeState}get inactive(){return"inactive"===this.activeState}}class Ne extends Me{constructor(){super(".onesignal-bell-launcher-badge","onesignal-bell-launcher-badge-opened",null,"onesignal-bell-launcher-badge-active",null,"hidden")}increment(){if(!isNaN(this.content)){let e=+this.content;e+=1,this.content=e.toString()}}show(){const e=super.show();return OneSignal.notifyButton.setCustomColorsIfSpecified(),e}decrement(){if(!isNaN(this.content)){let e=+this.content;e-=1,this.content=e>0?e.toString():""}}}class xe extends Ae{constructor(e){super(".onesignal-bell-launcher-message","onesignal-bell-launcher-message-opened",void 0,"hidden",["opacity","transform"],".onesignal-bell-launcher-message-body"),this.bell=e,this.contentType="",this.queued=[]}static get TIMEOUT(){return 2500}static get TYPES(){return{TIP:"tip",MESSAGE:"message",QUEUED:"queued"}}display(e,t,i=0){return E.a.debug(`Calling %cdisplay(${e}, ${t}, ${i}).`,Object(K.k)("code")),(this.shown?this.hide():Object(K.t)()).then(()=>{this.content=Object(K.g)(t),this.contentType=e}).then(()=>this.show()).then(()=>Object(K.i)(i)).then(()=>this.hide()).then(()=>{this.content=this.getTipForState(),this.contentType="tip"})}getTipForState(){return this.bell.state===$e.STATES.UNSUBSCRIBED?this.bell.options.text["tip.state.unsubscribed"]:this.bell.state===$e.STATES.SUBSCRIBED?this.bell.options.text["tip.state.subscribed"]:this.bell.state===$e.STATES.BLOCKED?this.bell.options.text["tip.state.blocked"]:""}enqueue(e){return this.queued.push(Object(K.g)(e)),new Promise(e=>{this.bell.badge.shown?this.bell.badge.hide().then(()=>this.bell.badge.increment()).then(()=>this.bell.badge.show()).then(e):(this.bell.badge.increment(),this.bell.initialized?this.bell.badge.show().then(e):e())})}dequeue(e){const t=this.queued.pop(e);return new Promise(e=>{this.bell.badge.shown?this.bell.badge.hide().then(()=>this.bell.badge.decrement()).then(e=>e>0?this.bell.badge.show():Promise.resolve(this)).then(e(t)):(this.bell.badge.decrement(),e(t))})}}class ke extends Me{constructor(e){super(".onesignal-bell-launcher-button",void 0,void 0,"onesignal-bell-launcher-button-active",void 0,"shown",""),this.bell=e,this.events={mouse:"bell.launcher.button.mouse"};const t=this.element;t&&(t.addEventListener("touchstart",()=>{this.onHovering(),this.onTap()},{passive:!0}),t.addEventListener("mouseenter",()=>{this.onHovering()}),t.addEventListener("mouseleave",()=>{this.onHovered()}),t.addEventListener("touchmove",()=>{this.onHovered()},{passive:!0}),t.addEventListener("mousedown",()=>{this.onTap()}),t.addEventListener("mouseup",()=>{this.onEndTap()}),t.addEventListener("click",()=>{this.onHovered(),this.onClick()}))}onHovering(){(v.isEmpty(this.events.mouse)||"out"===v.getLast(this.events.mouse))&&S.a.trigger($e.EVENTS.HOVERING),v.put(this.events.mouse,"over")}onHovered(){v.put(this.events.mouse,"out"),S.a.trigger($e.EVENTS.HOVERED)}onTap(){this.pulse(),this.activate(),this.bell.badge.activate()}onEndTap(){this.inactivate(),this.bell.badge.inactivate()}onClick(){if(S.a.trigger($e.EVENTS.BELL_CLICK),S.a.trigger($e.EVENTS.LAUNCHER_CLICK),!this.bell.message.shown||this.bell.message.contentType!=xe.TYPES.MESSAGE){var e=v.getLast("subscription.optedOut");return this.bell.unsubscribed?e?this.bell.launcher.activateIfInactive().then(()=>{this.bell.showDialogProcedure()}):(Bi.registerForPushNotifications(),this.bell._ignoreSubscriptionState=!0,Bi.emitter.once(Bi.EVENTS.SUBSCRIPTION_CHANGED,()=>{this.bell.message.display(xe.TYPES.MESSAGE,this.bell.options.text["message.action.subscribed"],xe.TIMEOUT).then(()=>{this.bell._ignoreSubscriptionState=!1,this.bell.launcher.inactivate()})})):this.bell.subscribed?this.bell.launcher.activateIfInactive().then(()=>{this.bell.showDialogProcedure()}):this.bell.blocked&&(Object(K.q)()?Bi.registerForPushNotifications():this.bell.launcher.activateIfInactive().then(()=>{this.bell.showDialogProcedure()})),this.bell.message.hide()}}pulse(){Object(K.w)(".pulse-ring"),this.element&&Object(K.b)(this.element,"beforeend",'
'),this.bell.setCustomColorsIfSpecified()}}class je extends Ae{constructor(e){super(".onesignal-bell-launcher-dialog","onesignal-bell-launcher-dialog-opened",void 0,"hidden",["opacity","transform"],".onesignal-bell-launcher-dialog-body"),this.bell=e,this.subscribeButtonId="#onesignal-bell-container .onesignal-bell-launcher #subscribe-button",this.unsubscribeButtonId="#onesignal-bell-container .onesignal-bell-launcher #unsubscribe-button",this.notificationIcons=null}show(){return this.updateBellLauncherDialogBody().then(()=>super.show())}get subscribeButtonSelectorId(){return"subscribe-button"}get unsubscribeButtonSelectorId(){return"unsubscribe-button"}get subscribeButton(){return this.element?this.element.querySelector("#"+this.subscribeButtonSelectorId):null}get unsubscribeButton(){return this.element?this.element.querySelector("#"+this.unsubscribeButtonSelectorId):null}updateBellLauncherDialogBody(){return OneSignal.getSubscription().then(e=>{this.nestedContentSelector&&Object(K.e)(this.nestedContentSelector);let t="Nothing to show.";var i="";if(this.bell.options.showCredit&&(i='
Powered by OneSignal
'),this.bell.state===$e.STATES.SUBSCRIBED&&!0===e||this.bell.state===$e.STATES.UNSUBSCRIBED&&!1===e){let e="";const n=Object(K.m)(this.notificationIcons);e="default-icon"!=n?`
`:'
';let o="";o=this.bell.state!==$e.STATES.SUBSCRIBED?``:``,t=`

${this.bell.options.text["dialog.main.title"]}

${e}
${o}
${i}`}else if(this.bell.state===$e.STATES.BLOCKED){let e=null;g.a.chrome?g.a.mobile||g.a.tablet||(e="/bell/chrome-unblock.jpg"):g.a.firefox?e="/bell/firefox-unblock.jpg":g.a.safari?e="/bell/safari-unblock.jpg":g.a.msedge&&(e="/bell/edge-unblock.png");let n="";e&&(n=``),(g.a.mobile||g.a.tablet)&&g.a.chrome&&(n="
  1. Access Settings by tapping the three menu dots
  2. Click Site settings under Advanced.
  3. Click Notifications.
  4. Find and click this entry for this website.
  5. Click Notifications and set it to Allow.
"),t=`

${this.bell.options.text["dialog.blocked.title"]}

${this.bell.options.text["dialog.blocked.message"]}

${n}
${i}`}this.nestedContentSelector&&Object(K.b)(this.nestedContentSelector,"beforeend",t),this.subscribeButton&&this.subscribeButton.addEventListener("click",()=>{OneSignal.__doNotShowWelcomeNotification=!1,S.a.trigger($e.EVENTS.SUBSCRIBE_CLICK)}),this.unsubscribeButton&&this.unsubscribeButton.addEventListener("click",()=>S.a.trigger($e.EVENTS.UNSUBSCRIBE_CLICK)),this.bell.setCustomColorsIfSpecified()})}}class _e extends Me{constructor(e){super(".onesignal-bell-launcher","onesignal-bell-launcher-active",void 0,void 0,"onesignal-bell-launcher-inactive","hidden","active"),this.bell=e,this.wasInactive=!1}resize(e){return Object(d.a)(this,void 0,void 0,function*(){if(!this.element)throw new m(o.MissingDomElement);if("small"===e&&Object(K.o)(this.element,"onesignal-bell-launcher-sm")||"medium"===e&&Object(K.o)(this.element,"onesignal-bell-launcher-md")||"large"===e&&Object(K.o)(this.element,"onesignal-bell-launcher-lg"))return Promise.resolve(this);if(Object(K.v)(this.element,"onesignal-bell-launcher-sm"),Object(K.v)(this.element,"onesignal-bell-launcher-md"),Object(K.v)(this.element,"onesignal-bell-launcher-lg"),"small"===e)Object(K.a)(this.element,"onesignal-bell-launcher-sm");else if("medium"===e)Object(K.a)(this.element,"onesignal-bell-launcher-md");else{if("large"!==e)throw new Error("Invalid OneSignal bell size "+e);Object(K.a)(this.element,"onesignal-bell-launcher-lg")}return this.shown?yield new Promise(e=>{if(0==this.targetTransitionEvents.length)return e(this);var t=setTimeout(()=>{E.a.debug(`Launcher did not completely resize (state: ${this.state}, activeState: ${this.activeState}).`)},this.transitionCheckTimeout);Object(K.u)(this.element,"transitionend",(i,n)=>{if(i.target===this.element&&Object(K.f)(this.targetTransitionEvents,i.propertyName))return clearTimeout(t),n(),e(this)},!0)}):this})}activateIfInactive(){return this.inactive?(this.wasInactive=!0,this.activate()):Object(K.t)()}inactivateIfWasInactive(){return this.wasInactive?(this.wasInactive=!1,this.inactivate()):Object(K.t)()}clearIfWasInactive(){this.wasInactive=!1}inactivate(){return this.bell.message.hide().then(()=>this.bell.badge.content.length>0?this.bell.badge.hide().then(()=>Promise.all([super.inactivate(),this.resize("small")])).then(()=>this.bell.badge.show()):Promise.all([super.inactivate(),this.resize("small")]))}activate(){return this.bell.badge.content.length>0?this.bell.badge.hide().then(()=>Promise.all([super.activate(),this.resize(this.bell.options.size)])):Promise.all([super.activate(),this.resize(this.bell.options.size)])}}class De{static isLocalStorageSupported(){try{return"undefined"!=typeof localStorage&&(localStorage.getItem("test"),!0)}catch(e){return!1}}static setItem(e,t,i){if(!De.isLocalStorageSupported())return;const n=void 0!==i?60*i*1e3:0,o={value:JSON.stringify(t),timestamp:void 0!==i?(new Date).getTime()+n:void 0};localStorage.setItem(e,JSON.stringify(o))}static getItem(e){if(!De.isLocalStorageSupported())return null;const t=localStorage.getItem(e);let i;try{i=JSON.parse(t)}catch(e){return null}if(null===i)return null;if(i.timestamp&&(new Date).getTime()>=i.timestamp)return localStorage.removeItem(e),null;let n=i.value;try{n=JSON.parse(i.value)}catch(e){return n}return n}static removeItem(e){if(!De.isLocalStorageSupported())return null;localStorage.removeItem(e)}}!function(e){e.Push="push",e.NonPush="nonPush"}(Ee||(Ee={})),function(e){e.PromptDismissCount="promptDismissCount",e.NonPushPromptsDismissCount="nonPushPromptsDismissCount"}(Ie||(Ie={})),function(e){e.OneSignalNotificationPrompt="onesignal-notification-prompt",e.OneSignalNonPushPrompt="onesignal-non-push-prompt"}(Pe||(Pe={}));const Re={[Ee.Push]:Ie.PromptDismissCount,[Ee.NonPush]:Ie.NonPushPromptsDismissCount},Ue={[Ee.Push]:Pe.OneSignalNotificationPrompt,[Ee.NonPush]:Pe.OneSignalNonPushPrompt};class We{static markPromptDismissedWithType(e){return Object(d.a)(this,void 0,void 0,function*(){if(Object(K.q)())try{yield new Promise((e,t)=>{OneSignal.proxyFrameHost.message(OneSignal.POSTMAM_COMMANDS.MARK_PROMPT_DISMISSED,{},i=>{i.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE?e():t()})})}catch(e){E.a.debug("Proxy Frame possibly didn't not receive MARK_PROMPT_DISMISSED message",e||"")}const t=Re[e],i=Ue[e];let n=yield w.a.get("Options",t);n||(n=0),Object(K.q)()||(n+=1);let o=3;2==n?o=7:n>2&&(o=30),E.a.debug(`(${T.a.getWindowEnv().toString()}) OneSignal: User dismissed the ${e} `+`notification prompt; reprompt after ${o} days.`),yield w.a.put("Options",{key:t,value:n});const s=24*o*60;return De.setItem(i,"dismissed",s)})}static wasPromptOfTypeDismissed(e){switch(e){case Ee.Push:return"dismissed"===De.getItem(Pe.OneSignalNotificationPrompt);case Ee.NonPush:return"dismissed"===De.getItem(Pe.OneSignalNonPushPrompt)}return!1}}var Be,Le,Ve,Fe,He='';class $e{constructor(e,t){this.state=$e.STATES.UNINITIALIZED,this._ignoreSubscriptionState=!1,this.hovering=!1,this.initialized=!1,this.DEFAULT_SIZE="medium",this.DEFAULT_POSITION="bottom-right",this.DEFAULT_THEME="default",this.options={enable:e.enable||!1,size:e.size||this.DEFAULT_SIZE,position:e.position||this.DEFAULT_POSITION,theme:e.theme||this.DEFAULT_THEME,showLauncherAfter:e.showLauncherAfter||10,showBadgeAfter:e.showBadgeAfter||300,text:this.setDefaultTextOptions(e.text||{}),prenotify:e.prenotify,showCredit:e.showCredit,colors:e.colors,offset:e.offset},t&&(this._launcher=t),this.options.enable&&(this.validateOptions(this.options),this.state=$e.STATES.UNINITIALIZED,this._ignoreSubscriptionState=!1,this.installEventHooks(),this.updateState())}static get EVENTS(){return{STATE_CHANGED:"notifyButtonStateChange",LAUNCHER_CLICK:"notifyButtonLauncherClick",BELL_CLICK:"notifyButtonButtonClick",SUBSCRIBE_CLICK:"notifyButtonSubscribeClick",UNSUBSCRIBE_CLICK:"notifyButtonUnsubscribeClick",HOVERING:"notifyButtonHovering",HOVERED:"notifyButtonHover"}}static get STATES(){return{UNINITIALIZED:"uninitialized",SUBSCRIBED:"subscribed",UNSUBSCRIBED:"unsubscribed",BLOCKED:"blocked"}}static get TEXT_SUBS(){return{"prompt.native.grant":{default:"Allow",chrome:"Allow",firefox:"Always Receive Notifications",safari:"Allow"}}}showDialogProcedure(){this.dialog.shown||this.dialog.show().then(()=>{Object(K.u)(document,"click",(e,t)=>{this.dialog.element.contains(e.target)||(t(),this.dialog.shown&&this.dialog.hide().then(()=>{this.launcher.inactivateIfWasInactive()}))},!0)})}validateOptions(e){if(!e.size||!Object(K.f)(["small","medium","large"],e.size))throw new Error(`Invalid size ${e.size} for notify button. Choose among 'small', 'medium', or 'large'.`);if(!e.position||!Object(K.f)(["bottom-left","bottom-right"],e.position))throw new Error(`Invalid position ${e.position} for notify button. Choose either 'bottom-left', or 'bottom-right'.`);if(!e.theme||!Object(K.f)(["default","inverse"],e.theme))throw new Error(`Invalid theme ${e.theme} for notify button. Choose either 'default', or 'inverse'.`);if(!e.showLauncherAfter||e.showLauncherAfter<0)throw new Error(`Invalid delay duration of ${this.options.showLauncherAfter} for showing the notify button. Choose a value above 0.`);if(!e.showBadgeAfter||e.showBadgeAfter<0)throw new Error(`Invalid delay duration of ${this.options.showBadgeAfter} for showing the notify button's badge. Choose a value above 0.`)}setDefaultTextOptions(e){return{"tip.state.unsubscribed":e["tip.state.unsubscribed"]||"Subscribe to notifications","tip.state.subscribed":e["tip.state.subscribed"]||"You're subscribed to notifications","tip.state.blocked":e["tip.state.blocked"]||"You've blocked notifications","message.prenotify":e["message.prenotify"]||"Click to subscribe to notifications","message.action.subscribed":e["message.action.subscribed"]||"Thanks for subscribing!","message.action.resubscribed":e["message.action.resubscribed"]||"You're subscribed to notifications","message.action.subscribing":e["message.action.subscribing"]||"Click {{prompt.native.grant}} to receive notifications","message.action.unsubscribed":e["message.action.unsubscribed"]||"You won't receive notifications again","dialog.main.title":e["dialog.main.title"]||"Manage Site Notifications","dialog.main.button.subscribe":e["dialog.main.button.subscribe"]||"SUBSCRIBE","dialog.main.button.unsubscribe":e["dialog.main.button.unsubscribe"]||"UNSUBSCRIBE","dialog.blocked.title":e["dialog.blocked.title"]||"Unblock Notifications","dialog.blocked.message":e["dialog.blocked.message"]||"Follow these instructions to allow notifications:"}}installEventHooks(){Bi.emitter.on($e.EVENTS.SUBSCRIBE_CLICK,()=>{this.dialog.subscribeButton.disabled=!0,this._ignoreSubscriptionState=!0,Bi.setSubscription(!0).then(()=>(this.dialog.subscribeButton.disabled=!1,this.dialog.hide())).then(()=>this.message.display(xe.TYPES.MESSAGE,this.options.text["message.action.resubscribed"],xe.TIMEOUT)).then(()=>(this._ignoreSubscriptionState=!1,this.launcher.clearIfWasInactive(),this.launcher.inactivate())).then(()=>this.updateState())}),Bi.emitter.on($e.EVENTS.UNSUBSCRIBE_CLICK,()=>{this.dialog.unsubscribeButton.disabled=!0,Bi.setSubscription(!1).then(()=>(this.dialog.unsubscribeButton.disabled=!1,this.dialog.hide())).then(()=>(this.launcher.clearIfWasInactive(),this.launcher.activate())).then(()=>this.message.display(xe.TYPES.MESSAGE,this.options.text["message.action.unsubscribed"],xe.TIMEOUT)).then(()=>this.updateState())}),Bi.emitter.on($e.EVENTS.HOVERING,()=>{this.hovering=!0,this.launcher.activateIfInactive(),this.message.shown||this.dialog.shown?this.hovering=!1:this.message.contentType!==xe.TYPES.MESSAGE?new Promise(e=>{if(this.message.queued.length>0)return this.message.dequeue().then(t=>{this.message.content=t,this.message.contentType=xe.TYPES.QUEUED,e()});this.message.content=Object(K.g)(this.message.getTipForState()),this.message.contentType=xe.TYPES.TIP,e()}).then(()=>this.message.show()).then(()=>{this.hovering=!1}):this.hovering=!1}),Bi.emitter.on($e.EVENTS.HOVERED,()=>{this.message.contentType!==xe.TYPES.MESSAGE&&this.dialog.hidden&&(this.hovering&&(this.hovering=!1,this.message.waitUntilShown().then(()=>Object(K.i)(xe.TIMEOUT)).then(()=>this.message.hide()).then(()=>{this.launcher.wasInactive&&this.dialog.hidden&&(this.launcher.inactivate(),this.launcher.wasInactive=!1)})),this.message.shown&&this.message.hide().then(()=>{this.launcher.wasInactive&&this.dialog.hidden&&(this.launcher.inactivate(),this.launcher.wasInactive=!1)}))}),Bi.emitter.on(Bi.EVENTS.SUBSCRIPTION_CHANGED,e=>Object(d.a)(this,void 0,void 0,function*(){if(1==e&&(this.badge.shown&&this.options.prenotify&&this.badge.hide(),null===this.dialog.notificationIcons)){const e=yield he.getNotificationIcons();this.dialog.notificationIcons=e}Bi.getNotificationPermission(t=>{let i;i=e?$e.STATES.SUBSCRIBED:t===y.Denied?$e.STATES.BLOCKED:$e.STATES.UNSUBSCRIBED,this.setState(i,this._ignoreSubscriptionState)})})),Bi.emitter.on($e.EVENTS.STATE_CHANGED,e=>{this.launcher.element&&(e.to===$e.STATES.SUBSCRIBED?this.launcher.inactivate():(e.to===$e.STATES.UNSUBSCRIBED||$e.STATES.BLOCKED)&&this.launcher.activate())}),Bi.emitter.on(Bi.EVENTS.NATIVE_PROMPT_PERMISSIONCHANGED,()=>{this.updateState()})}addDefaultClasses(){const e=this.container;if("bottom-left"===this.options.position)e&&Object(K.a)(e,"onesignal-bell-container-bottom-left"),Object(K.a)(this.launcher.selector,"onesignal-bell-launcher-bottom-left");else{if("bottom-right"!==this.options.position)throw new Error("Invalid OneSignal notify button position "+this.options.position);e&&Object(K.a)(e,"onesignal-bell-container-bottom-right"),Object(K.a)(this.launcher.selector,"onesignal-bell-launcher-bottom-right")}if("default"===this.options.theme)Object(K.a)(this.launcher.selector,"onesignal-bell-launcher-theme-default");else{if("inverse"!==this.options.theme)throw new Error("Invalid OneSignal notify button theme "+this.options.theme);Object(K.a)(this.launcher.selector,"onesignal-bell-launcher-theme-inverse")}}create(){return Object(d.a)(this,void 0,void 0,function*(){if(!this.options.enable)return;if(0!==(yield Bi.context.dynamicResourceLoader.loadSdkStylesheet()))return void E.a.debug("Not showing notify button because styles failed to load.");this.container&&Object(K.w)("#onesignal-bell-container"),Object(K.b)("body","beforeend",'
'),this.container&&Object(K.b)(this.container,"beforeend",'
'),Object(K.b)(this.launcher.selector,"beforeend",'
'),Object(K.b)(this.launcher.selector,"beforeend",'
'),Object(K.b)(this.launcher.selector,"beforeend",'
'),Object(K.b)(this.message.selector,"beforeend",'
'),Object(K.b)(this.launcher.selector,"beforeend",'
'),Object(K.b)(this.dialog.selector,"beforeend",'
'),Object(K.b)(this.button.selector,"beforeend",He);const e=yield Bi.isPushNotificationsEnabled(),t=yield Bi.getSubscription(),i=We.wasPromptOfTypeDismissed(Ee.Push),n=e?"small":this.options.size||this.DEFAULT_SIZE;yield this.launcher.resize(n),this.addDefaultClasses(),this.applyOffsetIfSpecified(),this.setCustomColorsIfSpecified(),this.patchSafariSvgFilterBug(),E.a.info("Showing the notify button."),yield(e?this.launcher.inactivate():Object(K.t)()).then(()=>Bi.getSubscription()).then(t=>!e&&t||null!==this.dialog.notificationIcons?Object(K.t)():he.getNotificationIcons().then(e=>{this.dialog.notificationIcons=e})).then(()=>Object(K.i)(this.options.showLauncherAfter||0)).then(()=>Object(K.q)()&&t&&!0!==i&&!e&&!0===Bi.config.userConfig.promptOptions.autoPrompt&&!he.isHttpPromptAlreadyShown()?(E.a.debug("Not showing notify button because slidedown will be shown."),Object(K.t)()):this.launcher.show()).then(()=>Object(K.i)(this.options.showBadgeAfter||0)).then(()=>this.options.prenotify&&!e&&Bi._isNewVisitor?this.message.enqueue(this.options.text["message.prenotify"]).then(()=>this.badge.show()):Object(K.t)()).then(()=>this.initialized=!0)})}patchSafariSvgFilterBug(){if(!(g.a.safari&&Number(g.a.version)>=9.1)){const e="drop-shadow(0 2px 4px rgba(34,36,38,0.35));",t="drop-shadow(0 2px 4px rgba(34,36,38,0));",i="drop-shadow(0px 2px 2px rgba(34,36,38,.15));";this.graphic.setAttribute("style",`filter: ${e}; -webkit-filter: ${e};`),this.badge.element.setAttribute("style",`filter: ${t}; -webkit-filter: ${t};`),this.dialog.element.setAttribute("style",`filter: ${i}; -webkit-filter: ${i};`)}g.a.safari&&this.badge.element.setAttribute("style","display: none;")}applyOffsetIfSpecified(){const e=this.options.offset;if(e){const t=this.launcher.element;if(!t)return void E.a.error("Could not find bell dom element");t.style.cssText="",e.bottom&&(t.style.cssText+=`bottom: ${e.bottom};`),"bottom-right"===this.options.position?e.right&&(t.style.cssText+=`right: ${e.right};`):"bottom-left"===this.options.position&&e.left&&(t.style.cssText+=`left: ${e.left};`)}}setCustomColorsIfSpecified(){const e=this.dialog.element.querySelector("button.action"),t=this.button.element.querySelector(".pulse-ring");this.graphic.querySelector(".background").style.cssText="";const i=this.graphic.querySelectorAll(".foreground");for(let e=0;e{this.setState(e?$e.STATES.SUBSCRIBED:$e.STATES.UNSUBSCRIBED),t===y.Denied&&this.setState($e.STATES.BLOCKED)})}setState(e,t=!1){const i=this.state;this.state=e,i===e||t||S.a.trigger($e.EVENTS.STATE_CHANGED,{from:i,to:e})}get container(){return document.querySelector("#onesignal-bell-container")}get graphic(){return this.button.element.querySelector("svg")}get launcher(){return this._launcher||(this._launcher=new _e(this)),this._launcher}get button(){return this._button||(this._button=new ke(this)),this._button}get badge(){return this._badge||(this._badge=new Ne),this._badge}get message(){return this._message||(this._message=new xe(this)),this._message}get dialog(){return this._dialog||(this._dialog=new je(this)),this._dialog}get subscribed(){return this.state===$e.STATES.SUBSCRIBED}get unsubscribed(){return this.state===$e.STATES.UNSUBSCRIBED}get blocked(){return this.state===$e.STATES.BLOCKED}}class Ge{constructor(e,t){this.url=e,this.url.pathname="subscribe",this.options=t||{}}load(){const e=Object.assign(Object.assign({},he.getPromptOptionsPostHash()),{promptType:"popup",parentHostname:encodeURIComponent(location.hostname)});return this.options.autoAccept&&(e.autoAccept=!0),E.a.info(`Opening a popup to ${this.url.toString()} with POST data:`,e),this.popupWindow=this.openWindowViaPost(this.url.toString(),e,null),this.establishCrossOriginMessaging(),this.loadPromise={},this.loadPromise.promise=new Promise((e,t)=>{this.loadPromise.resolver=e,this.loadPromise.rejector=t}),this.loadPromise.promise}openWindowViaPost(e,t,i){var n=document.createElement("form");n.action=e,n.method="POST",n.target="onesignal-http-popup";var o=void 0!=window.screenLeft?window.screenLeft:screen.left,s=void 0!=window.screenTop?window.screenTop:screen.top,r=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,a=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height,c=OneSignal._windowWidth,l=OneSignal._windowHeight,d=r/2-c/2+o,u=a/2-l/2+s;i&&(i.childWidth&&(c=i.childWidth),i.childHeight&&(l=i.childHeight),i.left&&(d=i.left),i.top&&(u=i.top));const g=window.open("about:blank","onesignal-http-popup",`'scrollbars=yes, width=${c}, height=${l}, top=${u}, left=${d}`);if(t)for(var h in t){var p=document.createElement("textarea");p.name=h,p.value="object"==typeof t[h]?JSON.stringify(t[h]):t[h],n.appendChild(p)}return n.style.display="none",document.body.appendChild(n),n.submit(),document.body.removeChild(n),g}establishCrossOriginMessaging(){this.messenger=new fe(this.popupWindow,this.url.toString(),this.url.toString()),this.messenger.on(OneSignal.POSTMAM_COMMANDS.POPUP_BEGIN_MESSAGEPORT_COMMS,this.onBeginMessagePortCommunications.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_LOADED,this.onPopupLoaded.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_ACCEPTED,this.onPopupAccepted.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_REJECTED,this.onPopupRejected.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.POPUP_CLOSING,this.onPopupClosing.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.SET_SESSION_COUNT,this.onSetSessionCount.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.WINDOW_TIMEOUT,this.onWindowTimeout.bind(this)),this.messenger.once(OneSignal.POSTMAM_COMMANDS.FINISH_REMOTE_REGISTRATION,this.onFinishingRegistrationRemotely.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_RETRIGGER_EVENT,this.onRemoteRetriggerEvent.bind(this)),this.messenger.startPostMessageReceive()}dispose(){this.messenger.destroy()}onBeginMessagePortCommunications(e){return Object(d.a)(this,void 0,void 0,function*(){return E.a.debug(`(${T.a.getWindowEnv().toString()}) Successfully established cross-origin messaging with the popup window.`),this.messenger.connect(),!1})}onPopupLoaded(e){return Object(d.a)(this,void 0,void 0,function*(){this.loadPromise.resolver(),S.a.trigger("popupLoad")})}onPopupAccepted(e){return Object(d.a)(this,void 0,void 0,function*(){he.triggerCustomPromptClicked("granted")})}onPopupRejected(e){return Object(d.a)(this,void 0,void 0,function*(){he.triggerCustomPromptClicked("denied")})}onPopupClosing(e){return Object(d.a)(this,void 0,void 0,function*(){E.a.info("Popup window is closing, running cleanup events."),S.a.trigger(OneSignal.EVENTS.POPUP_CLOSING),this.dispose()})}onSetSessionCount(e){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug(T.a.getWindowEnv().toString()+" Marking current session as a continuing browsing session.");const{sessionCount:t}=e.data;OneSignal.context.pageViewManager.setPageViewCount(t)})}onWindowTimeout(e){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug(T.a.getWindowEnv().toString()+" Popup window timed out and was closed."),S.a.trigger(OneSignal.EVENTS.POPUP_WINDOW_TIMEOUT)})}onFinishingRegistrationRemotely(e){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug(location.origin,T.a.getWindowEnv().toString()+" Finishing HTTP popup registration inside the iFrame, sent from popup."),e.reply({progress:!0});const{rawPushSubscription:t}=e.data;this.messenger&&this.messenger.stopPostMessageReceive(),yield OneSignal.context.subscriptionManager.registerSubscription(t),yield J.checkAndTriggerSubscriptionChanged(),yield he.checkAndTriggerNotificationPermissionChanged()})}onRemoteRetriggerEvent(e){const{eventName:t,eventData:i}=e.data;return S.a.trigger(t,i,e.source),!1}message(){this.messenger&&this.messenger.message.apply(this.messenger,arguments)}}function ze(e){return btoa(encodeURIComponent(e).replace(/%([0-9A-F]{2})/g,function(e,t){return String.fromCharCode("0x"+t)}))}class qe{getPropertiesAsJson(){return{origin:location.origin,url:location.href,sdkVersion:h.a.version()}}}class Ke{}(Le=Be||(Be={})).HttpPermissionRequest="HttpPermissionRequest",Le.SyncHashedEmail="SyncHashedEmail";class Ye extends qe{constructor(e){super(),this.apiName=e}getEventName(){return"api-usage"}getPropertiesAsJson(){return Object.assign({api:this.apiName.toString()},super.getPropertiesAsJson())}}class Je extends Ke{constructor(){super()}getProfileName(){return"all_websites"}getDateUtc(){const e=new Date;return`${e.getUTCMonth()+1}_${e.getUTCDate()}_${e.getUTCFullYear()}`}getOperationData(){const e={$add:{},$ignore_time:!0};return e.$add[`pageview_${this.getDateUtc()}`]=1,e}}class Qe{constructor(e,t){this.isFeatureEnabled=e,this.mixpanelReportingToken=t}static get MIXPANEL_REPORTING_URL(){return"https://api.mixpanel.com"}isEnabled(){return this.isFeatureEnabled&&!!this.mixpanelReportingToken}reportEvent(e){if(!this.isEnabled())return Promise.resolve(null);const t={event:e.getEventName(),properties:Object.assign({token:this.mixpanelReportingToken},e.getPropertiesAsJson())},i=ze(JSON.stringify(t)),n={method:"GET",headers:new Headers,cache:"no-cache"};return fetch(`${Qe.MIXPANEL_REPORTING_URL}/track/?data=${i}`,n)}reportEngagement(e){if(!this.isEnabled())return Promise.resolve(null);let t={$token:this.mixpanelReportingToken,$distinct_id:e.getProfileName()};t=Object.assign(Object.assign({},t),e.getOperationData());const i=ze(JSON.stringify(t)),n={method:"GET",headers:new Headers,cache:"no-cache"};return fetch(`${Qe.MIXPANEL_REPORTING_URL}/engage/?data=${i}`,n)}shouldCollectPageView(){const e=new Date;return e.getUTCMonth()+1<=2&&e.getUTCDate()<=10&&e.getUTCFullYear()<=2018&&e.getUTCMonth()+1>=2&&e.getUTCDate()>=8&&e.getUTCFullYear()>=2018}reportPageView(){this.shouldCollectPageView()&&this.reportEngagement(new Je)}}(Fe=Ve||(Ve={}))[Fe.HttpPermissionRequest=0]="HttpPermissionRequest",Fe[Fe.SyncHashedEmail=1]="SyncHashedEmail";class Ze extends p.a{constructor(e){let t,i;switch(e){case Ve.HttpPermissionRequest:t="The HTTP permission request has been deprecated. Please remove any custom popups from your code.",i=Be.HttpPermissionRequest;break;case Ve.SyncHashedEmail:t="API syncHashedEmail() has been deprecated and will be removed in a future SDK release. Please remove any usages from your code.",i=Be.SyncHashedEmail}super(t),this.reportUsage(i),Object.setPrototypeOf(this,Ze.prototype)}reportUsage(e){"undefined"!=typeof OneSignal&&OneSignal.context&&OneSignal.context.metricsManager&&OneSignal.context.metricsManager.reportEvent(new Ye(e))}}class Xe{static internalInit(){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug("Called %cinternalInit()",Object(K.k)("code")),yield OneSignal.context.serviceWorkerManager.installWorker();const e=OneSignal.context.sessionManager;OneSignal.emitter.on(OneSignal.EVENTS.SESSION_STARTED,e.sendOnSessionUpdateFromPage.bind(e)),OneSignal.context.pageViewManager.incrementPageViewCount(),"visible"===document.visibilityState?yield Xe.sessionInit():Xe.postponeSessionInitUntilPageIsInFocus()})}static postponeSessionInitUntilPageIsInFocus(){Object(K.u)(document,"visibilitychange",(e,t)=>{"visible"===document.visibilityState&&(t(),Xe.sessionInit())},!0)}static sessionInit(){return Object(d.a)(this,void 0,void 0,function*(){if(E.a.debug("Called %csessionInit()",Object(K.k)("code")),OneSignal._sessionInitAlreadyRunning)return void E.a.debug("Returning from sessionInit because it has already been called.");OneSignal._sessionInitAlreadyRunning=!0;try{yield Xe.doInitialize()}catch(e){if(e instanceof f)return;throw e}const e=yield OneSignal.internalIsOptedOut();k.setIsOptedOut(!!e),I.a.isUsingSubscriptionWorkaround()||(yield Xe.handleAutoResubscribe(e));const t=yield OneSignal.privateIsPushNotificationsEnabled();k.setIsPushNotificationsEnabled(!!t),OneSignal.config.userConfig.promptOptions.autoPrompt&&!e&&OneSignal.context.promptsManager.spawnAutoPrompts(),OneSignal._sessionInitAlreadyRunning=!1,yield S.a.trigger(OneSignal.EVENTS.SDK_INITIALIZED)})}static registerForPushNotifications(e={}){return Object(d.a)(this,void 0,void 0,function*(){if(e&&e.modalPrompt)return OneSignal.subscriptionModalHost=new Se(OneSignal.config.appId,e),void(yield OneSignal.subscriptionModalHost.load());if(I.a.isUsingSubscriptionWorkaround())return e.httpPermissionRequest?void E.a.error(new Ze(Ve.HttpPermissionRequest)):void(yield Xe.loadSubscriptionPopup(e));k.getIsOptedOut()||(yield ge.registerForPush())})}static onSdkInitialized(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield Xe.processExpiringSubscriptions();(yield OneSignal.context.subscriptionManager.isAlreadyRegisteredWithOneSignal())?(OneSignal.context.sessionManager.setupSessionEventListeners(),e||(yield OneSignal.context.updateManager.sendOnSessionUpdate())):OneSignal.config.userConfig.promptOptions.autoPrompt||OneSignal.config.userConfig.autoResubscribe||(yield OneSignal.context.updateManager.sendOnSessionUpdate()),yield S.a.trigger(OneSignal.EVENTS.SDK_INITIALIZED_PUBLIC)})}static loadSubscriptionPopup(e){return Object(d.a)(this,void 0,void 0,function*(){OneSignal.subscriptionPopupHost=new Ge(OneSignal.proxyFrameHost.url,e),yield OneSignal.subscriptionPopupHost.load()})}static storeInitialValues(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield OneSignal.privateIsPushNotificationsEnabled(),t=yield OneSignal.privateGetNotificationPermission(),i=yield OneSignal.internalIsOptedOut();v.put("subscription.optedOut",i),yield w.a.put("Options",{key:"isPushEnabled",value:e}),yield w.a.put("Options",{key:"notificationPermission",value:t})})}static setWelcomeNotificationFlag(){return Object(d.a)(this,void 0,void 0,function*(){(yield OneSignal.context.permissionManager.getNotificationPermission(OneSignal.context.appConfig.safariWebId))===y.Granted&&(OneSignal.__doNotShowWelcomeNotification=!0)})}static establishServiceWorkerChannel(){return Object(d.a)(this,void 0,void 0,function*(){if(navigator.serviceWorker&&"https:"===window.location.protocol&&!(yield T.a.isFrameContextInsecure()))try{yield OneSignal.context.serviceWorkerManager.establishServiceWorkerChannel()}catch(e){E.a.error(e)}})}static processExpiringSubscriptions(){return Object(d.a)(this,void 0,void 0,function*(){const e=OneSignal.context;if(E.a.debug("Checking subscription expiration..."),!(yield e.subscriptionManager.isSubscriptionExpiring()))return E.a.debug("Subscription is not considered expired."),!1;const t=yield T.a.getIntegration(),i=T.a.getWindowEnv();switch(E.a.debug("Subscription is considered expiring. Current Integration:",t),t){case Ce.a.Secure:const n=yield e.subscriptionManager.subscribe(1);yield e.subscriptionManager.registerSubscription(n);break;case Ce.a.SecureProxy:if(i===X.a.OneSignalProxyFrame)yield this.registerSubscriptionInProxyFrame(e);else{yield OneSignal.proxyFrameHost.runCommand(OneSignal.POSTMAM_COMMANDS.PROCESS_EXPIRING_SUBSCRIPTIONS)}break;case Ce.a.InsecureProxy:yield w.a.remove("Ids","registrationId"),E.a.debug("Unsubscribed expiring HTTP subscription by removing registration ID.")}return!0})}static registerSubscriptionInProxyFrame(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield new Promise(t=>{e.workerMessenger.once(pe.SubscribeNew,e=>{t(Te.a.deserialize(e))}),e.workerMessenger.unicast(pe.SubscribeNew,e.appConfig)});return E.a.debug("Finished registering brand new subscription:",t),t})}static doInitialize(){return Object(d.a)(this,void 0,void 0,function*(){const e=[];e.push(Xe.storeInitialValues()),e.push(Xe.installNativePromptPermissionChangedHook()),e.push(Xe.setWelcomeNotificationFlag()),e.push(Xe.establishServiceWorkerChannel()),e.push(Xe.showNotifyButton()),e.push(Xe.showPromptsFromWebConfigEditor());try{yield Promise.all(e)}catch(e){throw E.a.error(e),new f(c.Unknown)}})}static showNotifyButton(){return Object(d.a)(this,void 0,void 0,function*(){if(h.a.isBrowser()&&!OneSignal.notifyButton){OneSignal.config.userConfig.notifyButton=OneSignal.config.userConfig.notifyButton||{},OneSignal.config.userConfig.bell&&(OneSignal.config.userConfig.bell=Object.assign(Object.assign({},OneSignal.config.userConfig.bell),OneSignal.config.userConfig.notifyButton),OneSignal.config.userConfig.notifyButton=Object.assign(Object.assign({},OneSignal.config.userConfig.notifyButton),OneSignal.config.userConfig.bell));const e=OneSignal.config.userConfig.notifyButton.displayPredicate;e&&"function"==typeof e?OneSignal.emitter.once(OneSignal.EVENTS.SDK_INITIALIZED,()=>Object(d.a)(this,void 0,void 0,function*(){!1!==(yield Promise.resolve(OneSignal.config.userConfig.notifyButton.displayPredicate()))?(OneSignal.notifyButton=new $e(OneSignal.config.userConfig.notifyButton),OneSignal.notifyButton.create()):E.a.debug("Notify button display predicate returned false so not showing the notify button.")})):(OneSignal.notifyButton=new $e(OneSignal.config.userConfig.notifyButton),OneSignal.notifyButton.create())}})}static showPromptsFromWebConfigEditor(){return Object(d.a)(this,void 0,void 0,function*(){const e=OneSignal.config;e.userConfig.promptOptions&&(yield new Y(e.userConfig.promptOptions.customlink).initialize())})}static installNativePromptPermissionChangedHook(){return Object(d.a)(this,void 0,void 0,function*(){try{if(navigator.permissions){(yield navigator.permissions.query({name:"notifications"})).onchange=function(){Object(K.y)()}}}catch(e){E.a.warn(`Could not install native prompt permission change hook w/ error: ${e}`)}})}static saveInitOptions(){return Object(d.a)(this,void 0,void 0,function*(){const e=[],t=OneSignal.config.userConfig.persistNotification;e.push(w.a.put("Options",{key:"persistNotification",value:null==t||t}));const i=OneSignal.config.userConfig.webhooks;return["notification.displayed","notification.clicked","notification.dismissed"].forEach(t=>{i&&i[t]?e.push(w.a.put("Options",{key:`webhooks.${t}`,value:i[t]})):e.push(w.a.put("Options",{key:`webhooks.${t}`,value:!1}))}),i&&i.cors?e.push(w.a.put("Options",{key:"webhooks.cors",value:!0})):e.push(w.a.put("Options",{key:"webhooks.cors",value:!1})),OneSignal.config.userConfig.notificationClickHandlerMatch?e.push(w.a.put("Options",{key:"notificationClickHandlerMatch",value:OneSignal.config.userConfig.notificationClickHandlerMatch})):e.push(w.a.put("Options",{key:"notificationClickHandlerMatch",value:"exact"})),OneSignal.config.userConfig.notificationClickHandlerAction?e.push(w.a.put("Options",{key:"notificationClickHandlerAction",value:OneSignal.config.userConfig.notificationClickHandlerAction})):e.push(w.a.put("Options",{key:"notificationClickHandlerAction",value:"navigate"})),Promise.all(e)})}static initSaveState(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield he.getAppId(),i=OneSignal.config;yield w.a.put("Ids",{type:"appId",id:t});const n=e||i.siteName||document.title||"Notification";yield w.a.put("Options",{key:"pageTitle",value:n}),E.a.info(`OneSignal: Set pageTitle to be '${n}'.`)})}static handleAutoResubscribe(e){return Object(d.a)(this,void 0,void 0,function*(){if(E.a.info("handleAutoResubscribe",{autoResubscribe:OneSignal.config.userConfig.autoResubscribe,isOptedOut:e}),OneSignal.config.userConfig.autoResubscribe&&!e){(yield OneSignal.context.permissionManager.getNotificationPermission(OneSignal.context.appConfig.safariWebId))==y.Granted&&(yield ge.registerForPush())}})}static polyfillSafariFetch(){return Object(d.a)(this,void 0,void 0,function*(){if(g.a.safari&&void 0===window.fetch){E.a.debug("Loading fetch polyfill for Safari..");try{yield(new we).loadFetchPolyfill(),E.a.debug("Done loading fetch polyfill.")}catch(e){E.a.debug("Error loading fetch polyfill:",e)}}})}static errorIfInitAlreadyCalled(){if(OneSignal._initCalled)throw new f(c.MultipleInitialization);OneSignal._initCalled=!0}}class et{constructor(){this.incrementedPageViewCount=!1}getPageViewCount(){try{const e=sessionStorage.getItem(et.SESSION_STORAGE_KEY_NAME),t=e?parseInt(e):0;return isNaN(t)?0:t}catch(e){return 0}}setPageViewCount(e){try{sessionStorage.setItem(et.SESSION_STORAGE_KEY_NAME,e.toString()),T.a.getWindowEnv()===X.a.OneSignalSubscriptionPopup&&OneSignal.subscriptionPopup&&OneSignal.subscriptionPopup.message(OneSignal.POSTMAM_COMMANDS.SET_SESSION_COUNT)}catch(e){}}incrementPageViewCount(){if(this.incrementedPageViewCount)return;const e=this.getPageViewCount()+1,t=this.getLocalPageViewCount()+1;this.setPageViewCount(e),this.setLocalPageViewCount(t),this.incrementedPageViewCount=!0,E.a.debug(`Incremented page view count: newCountSingleTab: ${e},\n newCountAccrossTabs: ${t}.`)}simulatePageNavigationOrRefresh(){this.incrementedPageViewCount=!1}isFirstPageView(){return 1===this.getPageViewCount()}getLocalPageViewCount(){return k.getLocalPageViewCount()}setLocalPageViewCount(e){k.setLocalPageViewCount(e)}}et.SESSION_STORAGE_KEY_NAME="onesignal-pageview-count";class tt{constructor(e){if(!e)throw new InvalidArgumentError.a("path",InvalidArgumentError.b.Empty);this.path=e.trim()}getQueryString(){const e=this.path.indexOf("?");return-1===e?null:this.path.length>e?this.path.substring(e+1):null}getWithoutQueryString(){return this.path.split(tt.QUERY_STRING)[0]}getFileName(){var e;return null===(e=this.getWithoutQueryString().split("\\").pop())||void 0===e?void 0:e.split("/").pop()}getFileNameWithQuery(){var e;return null===(e=this.path.split("\\").pop())||void 0===e?void 0:e.split("/").pop()}getFullPath(){return this.path}getPathWithoutFileName(){const e=this.getWithoutQueryString(),t=e.lastIndexOf(this.getFileName());let i=e.substring(0,t);return i=i.replace(/[\\\/]$/,"")}}tt.QUERY_STRING="?";class it extends p.a{constructor(e,t){super("Registration of a Service Worker failed."),this.status=e,this.statusText=t,Object.setPrototypeOf(this,it.prototype)}}var nt=it,ot=i(16);class st{static get(e,t,i){return st.call("GET",e,t,i)}static post(e,t,i){return st.call("POST",e,t,i)}static put(e,t,i){return st.call("PUT",e,t,i)}static delete(e,t,i){return st.call("DELETE",e,t,i)}static call(e,t,i,n){if("GET"===e){if(t.indexOf("players")>-1&&-1===t.indexOf("app_id="))return console.error("Calls to player api are not permitted without app_id"),Promise.reject(new ot.a(ot.b.MissingAppId))}else if(t.indexOf("players")>-1&&(!i||!i.app_id))return console.error("Calls to player api are not permitted without app_id"),Promise.reject(new ot.a(ot.b.MissingAppId));const o=new Headers;if(o.append("Origin",T.a.getOrigin()),o.append("SDK-Version",`onesignal/web/${h.a.version()}`),o.append("Content-Type","application/json;charset=UTF-8"),n)for(const e of Object.keys(n))o.append(e,n[e]);const s={method:e||"NO_METHOD_SPECIFIED",headers:o,cache:"no-cache"};let r;return i&&(s.body=JSON.stringify(i)),fetch(T.a.getOneSignalApiUrl(void 0,t).toString()+"/"+t,s).then(e=>(r=e.status,e.json())).then(e=>{if(r>=200&&r<300)return e;if("no-user-id-error"!==st.identifyError(e))return Promise.reject(e)}).catch(e=>(E.a.warn(`Could not complete request to /${t}`,e),Promise.reject(e)))}static identifyError(e){if(!e||!e.errors)return"no-error";const t=e.errors;return ae.a.contains(t,"No user with this id found")||ae.a.contains(t,"Could not find app_id for given player id.")?"no-user-id-error":"unknown-error"}}var rt,at=st;!function(e){e[e.Direct=1]="Direct",e[e.Indirect=2]="Indirect",e[e.Unattributed=3]="Unattributed",e[e.NotSupported=4]="NotSupported"}(rt||(rt={}));class ct{static downloadServerAppConfig(e){return Object(d.a)(this,void 0,void 0,function*(){return ae.a.enforceAppId(e),yield new Promise((t,i)=>{t(st.get(`sync/${e}/web`,null))})})}static getUserIdFromSubscriptionIdentifier(e,t,i){return ae.a.enforceAppId(e),st.post("players",{app_id:e,device_type:t,identifier:i,notification_types:Q.TemporaryWebRecord}).then(e=>e&&e.id?e.id:null).catch(e=>(E.a.debug("Error getting user ID from subscription identifier:",e),null))}static updatePlayer(e,t,i){return Object(d.a)(this,void 0,void 0,function*(){return yield ae.a.enforceAppIdAndPlayerId(e,t,()=>Object(d.a)(this,void 0,void 0,function*(){yield st.put(`players/${t}`,Object.assign({app_id:e},i))}))})}static updateUserSession(e,t){return Object(d.a)(this,void 0,void 0,function*(){return yield ae.a.enforceAppIdAndPlayerId(t.app_id,e,()=>Object(d.a)(this,void 0,void 0,function*(){const i=yield st.post(`players/${e}/on_session`,t);return i.id?i.id:e}))})}static sendSessionDuration(e,t,i,n,o){return Object(d.a)(this,void 0,void 0,function*(){ae.a.enforceAppIdAndPlayerId(e,t,()=>Object(d.a)(this,void 0,void 0,function*(){const s={app_id:e,type:1,state:"ping",active_time:i,device_type:n};switch(o.type){case rt.Direct:s.direct=!0,s.notification_ids=o.notificationIds;break;case rt.Indirect:s.direct=!1,s.notification_ids=o.notificationIds}yield st.post(`players/${t}/on_focus`,s)}))})}}var lt=ct;class dt{static debug(...e){self.shouldLog&&console.debug(...e)}static trace(...e){self.shouldLog&&console.trace(...e)}static info(...e){self.shouldLog&&console.info(...e)}static warn(...e){self.shouldLog&&console.warn(...e)}static error(...e){self.shouldLog&&console.error(...e)}}const ut="sendOutcome",gt="sendUniqueOutcome";class ht{constructor(e,t,i,n){this.outcomeName=i,this.config=t,this.appId=e,this.isUnique=n}getAttribution(){return Object(d.a)(this,void 0,void 0,function*(){return yield ht.getAttribution(this.config)})}beforeOutcomeSend(){return Object(d.a)(this,void 0,void 0,function*(){const e=this.isUnique?gt:ut;return Object(K.s)(e,this.outcomeName),this.config?this.outcomeName?(yield Object(K.c)(),!!(yield OneSignal.privateIsPushNotificationsEnabled())||(E.a.warn("Reporting outcomes is supported only for subscribed users."),!1)):(E.a.error("Outcome name is required"),!1):(E.a.debug("Outcomes feature not supported by main application yet."),!1)})}getAttributedNotifsByUniqueOutcomeName(){return Object(d.a)(this,void 0,void 0,function*(){return(yield w.a.getAll("SentUniqueOutcome")).filter(e=>e.outcomeName===this.outcomeName).reduce((e,t)=>{const i=t.notificationIds||[];return[...e,...i]},[])})}getNotifsToAttributeWithUniqueOutcome(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield this.getAttributedNotifsByUniqueOutcomeName();return e.filter(e=>-1===t.indexOf(e))})}shouldSendUnique(e,t){return e.type===rt.Unattributed||t.length>0}saveSentUniqueOutcome(e){return Object(d.a)(this,void 0,void 0,function*(){const t=this.outcomeName,i=yield w.a.get("SentUniqueOutcome",t),n=yield w.a.getCurrentSession(),o=[...i?i.notificationIds:[],...e],s=n?n.startTimestamp:null;yield w.a.put("SentUniqueOutcome",{outcomeName:t,notificationIds:o,sentDuringSession:s})})}wasSentDuringSession(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield w.a.get("SentUniqueOutcome",this.outcomeName);if(!e)return!1;const t=yield w.a.getCurrentSession(),i=t&&e.sentDuringSession===t.startTimestamp,n=!t&&!!e.sentDuringSession;return i||n})}send(e){return Object(d.a)(this,void 0,void 0,function*(){const{type:t,notificationIds:i,weight:n}=e;switch(t){case rt.Direct:return this.isUnique&&(yield this.saveSentUniqueOutcome(i)),void(yield OneSignal.context.updateManager.sendOutcomeDirect(this.appId,i,this.outcomeName,n));case rt.Indirect:return this.isUnique&&(yield this.saveSentUniqueOutcome(i)),void(yield OneSignal.context.updateManager.sendOutcomeInfluenced(this.appId,i,this.outcomeName,n));case rt.Unattributed:if(this.isUnique){if(yield this.wasSentDuringSession())return void E.a.warn("(Unattributed) unique outcome was already sent during this session");yield this.saveSentUniqueOutcome([])}return void(yield OneSignal.context.updateManager.sendOutcomeUnattributed(this.appId,this.outcomeName,n));default:return void E.a.warn("You are on a free plan. Please upgrade to use this functionality.")}})}static getAttribution(e){return Object(d.a)(this,void 0,void 0,function*(){if(e.direct&&e.direct.enabled){const e=yield w.a.getAll("NotificationClicked");if(e.length>0)return{type:rt.Direct,notificationIds:[e[0].notificationId]}}if(e.indirect&&e.indirect.enabled){const t=60*e.indirect.influencedTimePeriodMin*1e3,i=new Date((new Date).getTime()-t).getTime(),n=yield w.a.getAll("NotificationReceived");if(E.a.debug(`\tFound total of ${n.length} received notifications`),n.length>0){const t=e.indirect.influencedNotificationsLimit,o=ae.a.sortArrayOfObjects(n,e=>e.timestamp,!0,!1),s=o.filter(e=>e.timestamp>=i).slice(0,t).map(e=>e.notificationId);E.a.debug(`\tTotal of ${s.length} received notifications are within reporting window.`);const r=o.filter(e=>-1===s.indexOf(e.notificationId)).map(e=>e.notificationId);if(r.forEach(e=>w.a.remove("NotificationReceived",e)),E.a.debug(`\t${r.length} received notifications will be deleted.`),s.length>0)return{type:rt.Indirect,notificationIds:s}}}return e.unattributed&&e.unattributed.enabled?{type:rt.Unattributed,notificationIds:[]}:{type:rt.NotSupported,notificationIds:[]}})}}const pt=()=>{dt.debug("Do nothing")};function mt(e,t){const i=1e3*t;let n,o=void 0;const s=new Promise((t,s)=>{let r=!1;n=self.setTimeout(()=>Object(d.a)(this,void 0,void 0,function*(){r=!0;try{yield e(),t()}catch(e){dt.error("Failed to execute callback",e),s()}}),i),o=(()=>{dt.debug("Cancel called"),self.clearTimeout(n),r||t()})});return o?{promise:s,cancel:o}:(dt.warn("clearTimeoutHandle was not assigned."),{promise:s,cancel:pt})}class bt{constructor(){this._channels=[]}registerChannel(e){this._channels.push(e)}onSession(){return Object(d.a)(this,void 0,void 0,function*(){yield Promise.all(this._channels.map(e=>e.onSession()))})}onFocus(e){return Object(d.a)(this,void 0,void 0,function*(){yield Promise.all(this._channels.map(t=>t.onFocus(e)))})}setTags(e){return Object(d.a)(this,void 0,void 0,function*(){yield Promise.all(this._channels.map(t=>t.setTags(e)))})}setExternalUserId(e,t){return Object(d.a)(this,void 0,void 0,function*(){yield Promise.all(this._channels.map(i=>i.setExternalUserId(e,t)))})}}var ft=i(20),St=i(26),vt=i.n(St);class Ot{static getPlayer(e,t){return ae.b.enforceAppId(e),ae.b.enforcePlayerId(t),at.get(`players/${t}?app_id=${e}`)}static updatePlayer(e,t,i){return ae.b.enforceAppId(e),ae.b.enforcePlayerId(t),at.put(`players/${t}`,Object.assign({app_id:e},i))}static createUser(e){return Object(d.a)(this,void 0,void 0,function*(){const t=e.serialize();ae.b.enforceAppId(t.app_id);const i=yield at.post("players",t);return i&&i.success?i.id:null})}static logoutEmail(e,t,i){return Object(d.a)(this,void 0,void 0,function*(){ae.b.enforceAppId(e.appId),ae.b.enforcePlayerId(i);const n=yield at.post(`players/${i}/email_logout`,{app_id:e.appId,parent_player_id:t.subscriptionId,identifier_auth_hash:t.identifierAuthHash?t.identifierAuthHash:void 0});return!(!n||!n.success)})}static updateUserSession(e,t){return Object(d.a)(this,void 0,void 0,function*(){try{const i=t.serialize();ae.b.enforceAppId(i.app_id),ae.b.enforcePlayerId(e);const n=yield at.post(`players/${e}/on_session`,i);return n.id?n.id:e}catch(e){throw e&&Array.isArray(e.errors)&&e.errors.length>0&&ae.b.contains(e.errors[0],"app_id not found")?new ot.a(ot.b.MissingAppId):e}})}static sendOutcome(e){return Object(d.a)(this,void 0,void 0,function*(){E.a.info("Outcome payload:",e);try{yield at.post("outcomes/measure",e)}catch(e){E.a.error("sendOutcome",e)}})}}class yt{static getPlayer(e,t){return Ot.getPlayer(e,t)}static updatePlayer(e,t,i){return Ot.updatePlayer(e,t,i)}static jsonpLib(e,t){vt()(e,null,t)}static downloadServerAppConfig(e){return Object(d.a)(this,void 0,void 0,function*(){return T.a.getWindowEnv()!==X.a.ServiceWorker?yield new Promise((t,i)=>{yt.jsonpLib(`${T.a.getOneSignalApiUrl().toString()}/sync/${e}/web`,(e,n)=>{e?i(e):n.success?t(n):i(n)})}):yield lt.downloadServerAppConfig(e)})}static createUser(e){return Object(d.a)(this,void 0,void 0,function*(){return yield Ot.createUser(e)})}static logoutEmail(e,t,i){return Object(d.a)(this,void 0,void 0,function*(){return yield Ot.logoutEmail(e,t,i)})}static updateUserSession(e,t){return Object(d.a)(this,void 0,void 0,function*(){return yield Ot.updateUserSession(e,t)})}}class wt{constructor(e,t,i,n,o){this.secondaryChannelIdentifierUpdater=e,this.secondaryChannelExternalUserIdUpdater=t,this.secondaryChannelTagsUpdater=i,this.secondaryChannelSessionUpdater=n,this.secondaryChannelFocusUpdater=o}logout(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield w.a.getEmailProfile();if(!e.subscriptionId)return E.a.warn(new b(r.NoEmailSet)),!1;const{deviceId:t}=yield w.a.getSubscription();if(!t)return E.a.warn(new b(r.NoDeviceId)),!1;const i=yield w.a.getAppConfig();return(yield yt.logoutEmail(i,e,t))?(yield w.a.setEmailProfile(new ft.a),!0):(E.a.warn("Failed to logout email."),!1)})}setIdentifier(e,t){return Object(d.a)(this,void 0,void 0,function*(){const{profileProvider:i}=this.secondaryChannelIdentifierUpdater,n=yield i.getProfile(),o=yield this.secondaryChannelIdentifierUpdater.setIdentifier(e,t),s=o.subscriptionId;if(s){const t=i.newProfile(s,e);yield this.updatePushPlayersRelationToEmailPlayer(n,t)}return yield S.a.trigger(OneSignal.EVENTS.EMAIL_SUBSCRIPTION_CHANGED,{email:o.identifier}),s})}updatePushPlayersRelationToEmailPlayer(e,t){return Object(d.a)(this,void 0,void 0,function*(){const{deviceId:i}=yield w.a.getSubscription(),n=i,o=!!!e.subscriptionId||e.subscriptionId!==t.subscriptionId,s=!e.identifier||t.identifier!==e.identifier;if(i&&n&&(o||s)){const e=yield OneSignal.database.getExternalUserIdAuthHash(),n=yield w.a.getAppConfig();yield yt.updatePlayer(n.appId,i,{parent_player_id:t.subscriptionId,email:t.identifier,external_user_id_auth_hash:e})}})}onSession(){return Object(d.a)(this,void 0,void 0,function*(){yield this.secondaryChannelSessionUpdater.sendOnSession()})}onFocus(e){return Object(d.a)(this,void 0,void 0,function*(){yield this.secondaryChannelFocusUpdater.sendOnFocus(e)})}setTags(e){return Object(d.a)(this,void 0,void 0,function*(){yield this.secondaryChannelTagsUpdater.sendTags(e)})}setExternalUserId(e,t){return Object(d.a)(this,void 0,void 0,function*(){yield this.secondaryChannelExternalUserIdUpdater.setExternalUserId(e,t)})}}class Et{static addExternalUserIdToDeviceRecord(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield w.a.getExternalUserId();if(!t)return;e.externalUserId=t;const i=yield w.a.getExternalUserIdAuthHash();i&&(e.externalUserIdAuthHash=i)})}}class It extends ie{constructor(e,t,i,n){super(),this.deliveryPlatform=e,this.identifier=t,this.identifierAuthHash=i,this.pushDeviceRecordId=n}serialize(){const e=super.serialize();return this.identifier&&(e.identifier=this.identifier),this.identifierAuthHash&&(e.identifier_auth_hash=this.identifierAuthHash),this.pushDeviceRecordId&&(e.device_player_id=this.pushDeviceRecordId),e}deserialize(e){throw new te}}class Pt{constructor(e){this.profileProvider=e}setIdentifier(e,t){return Object(d.a)(this,void 0,void 0,function*(){const i=yield w.a.getAppConfig(),n=yield this.profileProvider.getProfile(),o=this.profileProvider.newProfile(n.subscriptionId,e,t);if(n.subscriptionId)yield yt.updatePlayer(i.appId,n.subscriptionId,{identifier:e,identifier_auth_hash:t});else{const{deviceId:e}=yield w.a.getSubscription(),t=new It(this.profileProvider.deviceType,o.identifier,o.identifierAuthHash,e);t.appId=i.appId,yield Et.addExternalUserIdToDeviceRecord(t),o.subscriptionId=yield yt.createUser(t)}return o.subscriptionId&&(yield this.profileProvider.setProfile(o)),o})}}class Ct{constructor(e){this.profileProvider=e}sendTags(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield this.profileProvider.getSubscriptionId(),{appId:i}=yield w.a.getAppConfig(),n=(yield this.profileProvider.getProfile()).identifierAuthHash,o={tags:e,identifier_auth_hash:n};yield yt.updatePlayer(i,t,o)})}}class Tt{constructor(e){this.profileProvider=e}setExternalUserId(e,t){return Object(d.a)(this,void 0,void 0,function*(){const i=yield this.profileProvider.getSubscriptionId(),{appId:n}=yield w.a.getAppConfig(),o={external_user_id:e,external_user_id_auth_hash:t};yield Ot.updatePlayer(n,i,o)})}}class At{constructor(e){this.profileProvider=e}sendOnFocus(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield this.profileProvider.getProfile();if(!t.subscriptionId)return;const i={app_id:(yield w.a.getAppConfig()).appId,type:1,state:"ping",active_time:e,device_type:this.profileProvider.deviceType};yield at.post(`players/${t.subscriptionId}/on_focus`,i)})}}class Mt{constructor(e){this.profileProvider=e}sendOnSession(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield this.profileProvider.getProfile();if(!e.subscriptionId)return;const t=new It(this.profileProvider.deviceType,e.identifier,e.identifierAuthHash),i=yield w.a.getAppConfig();t.appId=i.appId;const n=yield Ot.updateUserSession(e.subscriptionId,t);n!==e.subscriptionId&&(e.subscriptionId=n,yield this.profileProvider.setProfile(e))})}}class Nt{constructor(){this._pendingGetSubscriptionIdResolvers=[]}setProfile(e){return Object(d.a)(this,void 0,void 0,function*(){if(!e.subscriptionId)return;const t=e.subscriptionId;this._pendingGetSubscriptionIdResolvers.map(e=>{e(t)}),this._pendingGetSubscriptionIdResolvers=[]})}getSubscriptionId(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield this.getProfile();return e.subscriptionId?e.subscriptionId:new Promise(e=>{this._pendingGetSubscriptionIdResolvers.push(e)})})}}class xt extends Nt{constructor(){super(...arguments),this.deviceType=Z.Email}newProfile(e,t,i){return new ft.a(e,t,i)}getProfile(){return Object(d.a)(this,void 0,void 0,function*(){return yield w.a.getEmailProfile()})}setProfile(e){const t=Object.create(null,{setProfile:{get:()=>super.setProfile}});return Object(d.a)(this,void 0,void 0,function*(){yield w.a.setEmailProfile(e),yield t.setProfile.call(this,e)})}}var kt,jt,_t,Dt,Rt=i(19);class Ut extends Nt{constructor(){super(...arguments),this.deviceType=Z.SMS}newProfile(e,t,i){return new Rt.a(e,t,i)}getProfile(){return Object(d.a)(this,void 0,void 0,function*(){return yield w.a.getSMSProfile()})}setProfile(e){const t=Object.create(null,{setProfile:{get:()=>super.setProfile}});return Object(d.a)(this,void 0,void 0,function*(){yield w.a.setSMSProfile(e),yield t.setProfile.call(this,e)})}}class Wt{constructor(e,t,i,n,o){this.secondaryChannelIdentifierUpdater=e,this.secondaryChannelExternalUserIdUpdater=t,this.secondaryChannelTagsUpdater=i,this.secondaryChannelSessionUpdater=n,this.secondaryChannelFocusUpdater=o}logout(){return Object(d.a)(this,void 0,void 0,function*(){return(yield w.a.getSMSProfile()).subscriptionId?(yield w.a.setSMSProfile(new Rt.a),!0):(E.a.warn(new b(r.NoSMSSet)),!1)})}setIdentifier(e,t){return Object(d.a)(this,void 0,void 0,function*(){const i=yield this.secondaryChannelIdentifierUpdater.setIdentifier(e,t);return yield S.a.trigger(OneSignal.EVENTS.SMS_SUBSCRIPTION_CHANGED,{sms:i.identifier}),i.subscriptionId})}onSession(){return Object(d.a)(this,void 0,void 0,function*(){yield this.secondaryChannelSessionUpdater.sendOnSession()})}onFocus(e){return Object(d.a)(this,void 0,void 0,function*(){yield this.secondaryChannelFocusUpdater.sendOnFocus(e)})}setTags(e){return Object(d.a)(this,void 0,void 0,function*(){yield this.secondaryChannelTagsUpdater.sendTags(e)})}setExternalUserId(e,t){return Object(d.a)(this,void 0,void 0,function*(){yield this.secondaryChannelExternalUserIdUpdater.setExternalUserId(e,t)})}}class Bt{constructor(){this.synchronizer=new bt;const e=new xt,t=new wt(new Pt(e),new Tt(e),new Ct(e),new Mt(e),new At(e));this.email=t,this.synchronizer.registerChannel(t);const i=new Ut,n=new Wt(new Pt(i),new Tt(i),new Ct(i),new Mt(i),new At(i));this.sms=n,this.synchronizer.registerChannel(n)}}class Lt{static getServiceWorkerHref(e,t,i){return Lt.appendServiceWorkerParams(e.workerPath.getFullPath(),t,i)}static appendServiceWorkerParams(e,t,i){return`${new URL(e,I.a.getBaseUrl()).href}?${ae.b.encodeHashAsUriComponent({appId:t})}&${ae.b.encodeHashAsUriComponent({sdkVersion:i})}`}static upsertSession(e,t,i,n,o,s){return Object(d.a)(this,void 0,void 0,function*(){if(!n)return void dt.error("No deviceId provided for new session.");if(!i.app_id)return void dt.error("No appId provided for new session.");const r=yield w.a.getCurrentSession();if(!r){const e=i.app_id,t=Object(ue.d)({deviceId:n,appId:e,deviceType:i.device_type}),s=yield w.a.getLastNotificationClicked(e);return s&&(t.notificationId=s.notificationId),yield w.a.upsertSession(t),void(yield Lt.sendOnSessionCallIfNecessary(o,i,n,t))}if(r.status===ue.c.Active)return void dt.debug("Session already active",r);if(!r.lastDeactivatedTimestamp)return void dt.debug("Session is in invalid state",r);const a=(new Date).getTime();if(Lt.timeInSecondsBetweenTimestamps(a,r.lastDeactivatedTimestamp)<=e)return r.status=ue.c.Active,r.lastActivatedTimestamp=a,r.lastDeactivatedTimestamp=null,void(yield w.a.upsertSession(r));yield Lt.finalizeSession(r,t,s);const c=Object(ue.d)({deviceId:n,appId:i.app_id,deviceType:i.device_type});yield w.a.upsertSession(c),yield Lt.sendOnSessionCallIfNecessary(o,i,n,c)})}static deactivateSession(e,t,i){return Object(d.a)(this,void 0,void 0,function*(){const n=yield w.a.getCurrentSession();if(!n)return void dt.debug("No active session found. Cannot deactivate.");if(n.status===ue.c.Inactive)return mt(()=>Lt.finalizeSession(n,t,i),e);if(n.status!==ue.c.Active)return void dt.warn(`Session in invalid state ${n.status}. Cannot deactivate.`);const o=(new Date).getTime(),s=Lt.timeInSecondsBetweenTimestamps(o,n.lastActivatedTimestamp);n.lastDeactivatedTimestamp=o,n.accumulatedDuration+=s,n.status=ue.c.Inactive;const r=mt(()=>Lt.finalizeSession(n,t,i),e);return yield w.a.upsertSession(n),r})}static sendOnSessionCallIfNecessary(e,t,i,n){return Object(d.a)(this,void 0,void 0,function*(){if(e===ue.b.PlayerCreate)return;if(!t.identifier){const e=yield self.registration.pushManager.getSubscription();if(e){const i=le.setFromW3cSubscription(e),n=new ne(i).serialize();t.identifier=n.identifier}}const o=yield ct.updateUserSession(i,t);o!==i&&(n.deviceId=o,yield Promise.all([w.a.setDeviceId(o),w.a.upsertSession(n),w.a.resetSentUniqueOutcomes()])),yield(new Bt).synchronizer.onSession()})}static finalizeSession(e,t,i){return Object(d.a)(this,void 0,void 0,function*(){if(dt.debug("Finalize session",`started: ${new Date(e.startTimestamp)}`,`duration: ${e.accumulatedDuration}s`),t){dt.debug(`send on_focus reporting session duration -> ${e.accumulatedDuration}s`);const t=yield ht.getAttribution(i);dt.debug("send on_focus with attribution",t),yield ct.sendSessionDuration(e.appId,e.deviceId,e.accumulatedDuration,e.deviceType,t),yield(new Bt).synchronizer.onFocus(e.accumulatedDuration)}yield Promise.all([w.a.cleanupCurrentSession(),w.a.removeAllNotificationClicked()]),dt.debug("Finalize session finished",`started: ${new Date(e.startTimestamp)}`)})}static timeInSecondsBetweenTimestamps(e,t){return e<=t?0:Math.floor((e-t)/1e3)}}(jt=kt||(kt={})).OneSignalWorker="OneSignal Worker",jt.ThirdParty="3rd Party",jt.None="None",jt.Indeterminate="Indeterminate";class Vt{constructor(e,t){this.context=e,this.config=t}getRegistration(){return Object(d.a)(this,void 0,void 0,function*(){return yield ve.getRegistration(this.config.registrationOptions.scope)})}getActiveState(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield T.a.getIntegration();if(e===Ce.a.InsecureProxy)return kt.Indeterminate;if(e===Ce.a.SecureProxy){switch(T.a.getWindowEnv()){case X.a.Host:case X.a.CustomIframe:const e=OneSignal.proxyFrameHost;return e?yield e.runCommand(OneSignal.POSTMAM_COMMANDS.SERVICE_WORKER_STATE):kt.Indeterminate;case X.a.OneSignalSubscriptionPopup:break;case X.a.OneSignalSubscriptionModal:throw new te}}const t=yield this.context.serviceWorkerManager.getRegistration();if(!t)return kt.None;const i=Vt.activeSwFileName(t);return this.swActiveStateByFileName(i)})}static activeSwFileName(e){const t=ve.getAvailableServiceWorker(e);if(!t)return null;const i=new URL(t.scriptURL).pathname,n=new tt(i).getFileName();if("akam-sw.js"==n){const e=new URLSearchParams(new URL(t.scriptURL).search).get("othersw");if(e)return E.a.debug("Found a ServiceWorker under Akamai's akam-sw.js?othersw=",e),new tt(new URL(e).pathname).getFileName()}return n}swActiveStateByFileName(e){return e?e==this.config.workerPath.getFileName()?kt.OneSignalWorker:kt.ThirdParty:kt.None}getWorkerVersion(){return Object(d.a)(this,void 0,void 0,function*(){return new Promise(e=>Object(d.a)(this,void 0,void 0,function*(){if(I.b.isUsingSubscriptionWorkaround()){const t=OneSignal.proxyFrameHost;if(t){const i=yield t.runCommand(OneSignal.POSTMAM_COMMANDS.GET_WORKER_VERSION);e(i)}else e(NaN)}else this.context.workerMessenger.once(pe.WorkerVersion,t=>{e(t)}),yield this.context.workerMessenger.unicast(pe.WorkerVersion)}))})}shouldInstallWorker(){return Object(d.a)(this,void 0,void 0,function*(){if(!h.a.supportsServiceWorkers())return!1;if(!OneSignal.config)return!1;if(OneSignal.config.subdomain&&"safari"!==OneSignal.environmentInfo.browserType&&T.a.getWindowEnv()===X.a.Host)return!1;const e=yield this.getActiveState();if(E.a.debug("[shouldInstallWorker] workerState",e),e===kt.None||e===kt.ThirdParty){const e="granted"===(yield OneSignal.context.permissionManager.getNotificationPermission(OneSignal.config.safariWebId));return e&&E.a.info("[shouldInstallWorker] Notification Permissions enabled, will install ServiceWorker"),e}return!!(yield this.haveParamsChanged())||this.workerNeedsUpdate()})}haveParamsChanged(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield this.context.serviceWorkerManager.getRegistration();if(!e)return E.a.info("[changedServiceWorkerParams] workerRegistration not found at scope",this.config.registrationOptions.scope),!0;const t=new URL(e.scope).pathname,i=this.config.registrationOptions.scope;if(t!=i)return E.a.info("[changedServiceWorkerParams] ServiceWorker scope changing",{a_old:t,b_new:i}),!0;const n=ve.getAvailableServiceWorker(e),o=Lt.getServiceWorkerHref(this.config,this.context.appConfig.appId,h.a.version());return null===n||void 0===n||!n.scriptURL||o!==n.scriptURL&&(E.a.info("[changedServiceWorkerParams] ServiceWorker href changing:",{a_old:null===n||void 0===n?void 0:n.scriptURL,b_new:o}),!0)})}workerNeedsUpdate(){return Object(d.a)(this,void 0,void 0,function*(){let e;E.a.info("[Service Worker Update] Checking service worker version...");try{e=yield ae.a.timeoutPromise(this.getWorkerVersion(),2e3)}catch(e){return E.a.info("[Service Worker Update] Worker did not reply to version query; assuming older version and updating."),!0}return e!==h.a.version()?(E.a.info(`[Service Worker Update] Updating service worker from ${e} --\x3e ${h.a.version()}.`),!0):(E.a.info(`[Service Worker Update] Service worker version is current at ${e} (no update required).`),!1)})}establishServiceWorkerChannel(){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug("establishServiceWorkerChannel");const e=this.context.workerMessenger;e.off(),e.on(pe.NotificationDisplayed,e=>Object(d.a)(this,void 0,void 0,function*(){E.a.debug(location.origin,"Received notification display event from service worker."),yield S.a.trigger(OneSignal.EVENTS.NOTIFICATION_DISPLAYED,e)})),e.on(pe.NotificationClicked,e=>Object(d.a)(this,void 0,void 0,function*(){let t;if(0===(t=T.a.getWindowEnv()===X.a.OneSignalProxyFrame?yield new Promise(e=>{const t=OneSignal.proxyFrame;t&&t.messenger.message(OneSignal.POSTMAM_COMMANDS.GET_EVENT_LISTENER_COUNT,OneSignal.EVENTS.NOTIFICATION_CLICKED,t=>{const i=t.data;e(i)})}):OneSignal.emitter.numberOfListeners(OneSignal.EVENTS.NOTIFICATION_CLICKED))){E.a.debug("notification.clicked event received, but no event listeners; storing event in IndexedDb for later retrieval.");let t=e.url;e.url||(t=location.href),yield w.a.put("NotificationOpened",{url:t,data:e,timestamp:Date.now()})}else yield S.a.trigger(OneSignal.EVENTS.NOTIFICATION_CLICKED,e)})),e.on(pe.RedirectPage,e=>{E.a.debug(`${T.a.getWindowEnv().toString()} Picked up command.redirect to ${e}, forwarding to host page.`);const t=OneSignal.proxyFrame;t&&t.messenger.message(OneSignal.POSTMAM_COMMANDS.SERVICEWORKER_COMMAND_REDIRECT,e)}),e.on(pe.NotificationDismissed,e=>Object(d.a)(this,void 0,void 0,function*(){yield S.a.trigger(OneSignal.EVENTS.NOTIFICATION_DISMISSED,e)}));const t=I.b.isHttps(),i=I.b.isSafari();e.on(pe.AreYouVisible,n=>Object(d.a)(this,void 0,void 0,function*(){if(t&&i){const t={timestamp:n.timestamp,focused:document.hasFocus()};yield e.directPostMessageToSW(pe.AreYouVisibleResponse,t)}else{const e={timestamp:n.timestamp},t=OneSignal.proxyFrame;t&&t.messenger.message(OneSignal.POSTMAM_COMMANDS.ARE_YOU_VISIBLE_REQUEST,e)}}))})}installWorker(){return Object(d.a)(this,void 0,void 0,function*(){if(!(yield this.shouldInstallWorker()))return;E.a.info("Installing worker..."),(yield this.getActiveState())===kt.ThirdParty&&E.a.info("[Service Worker Installation] 3rd party service worker detected.");const e=Lt.getServiceWorkerHref(this.config,this.context.appConfig.appId,h.a.version()),t=`${I.b.getBaseUrl()}${this.config.registrationOptions.scope}`;E.a.info(`[Service Worker Installation] Installing service worker ${e} ${t}.`);try{yield navigator.serviceWorker.register(e,{scope:t})}catch(t){if(E.a.error(`[Service Worker Installation] Installing service worker failed ${t}`),T.a.getWindowEnv()===X.a.OneSignalSubscriptionPopup)throw t;const i=yield fetch(e);if(403===i.status||404===i.status)throw new nt(i.status,i.statusText);throw t}E.a.debug("[Service Worker Installation] Service worker installed."),yield this.establishServiceWorkerChannel()})}}(Dt=_t||(_t={}))[Dt.InvalidSafariSetup=0]="InvalidSafariSetup",Dt[Dt.Blocked=1]="Blocked",Dt[Dt.Dismissed=2]="Dismissed";class Ft extends p.a{constructor(e){let t;switch(e){case _t.InvalidSafariSetup:t="The Safari site URL, icon size, or push certificate is invalid, or Safari is in a private session.";break;case _t.Blocked:t="Notification permissions are blocked.";break;case _t.Dismissed:t="The notification permission prompt was dismissed."}super(t),Object.setPrototypeOf(this,Ft.prototype)}}class Ht{constructor(e,t){this.safariPermissionPromptFailed=!1,this.context=e,this.config=t}subscribe(e){return Object(d.a)(this,void 0,void 0,function*(){const t=T.a.getWindowEnv();switch(t){case X.a.CustomIframe:case X.a.Unknown:case X.a.OneSignalProxyFrame:throw new m(o.UnsupportedEnvironment)}let i;switch(t){case X.a.ServiceWorker:i=yield this.subscribeFcmFromWorker(e);break;case X.a.Host:case X.a.OneSignalSubscriptionModal:case X.a.OneSignalSubscriptionPopup:if((yield OneSignal.privateGetNotificationPermission())===y.Denied)throw new ce(oe.Blocked);if(h.a.useSafariLegacyPush()){i=yield this.subscribeSafari(),E.a.info("Installing SW on Safari");try{yield this.context.serviceWorkerManager.installWorker(),E.a.info("SW on Safari successfully installed")}catch(e){E.a.error("SW on Safari failed to install.")}}else i=yield this.subscribeFcmFromPage(e);break;default:throw new m(o.UnsupportedEnvironment)}return i})}registerSubscription(e,t){return Object(d.a)(this,void 0,void 0,function*(){e&&(e=le.deserialize(e));const i=ne.createFromPushSubscription(this.config.appId,e,t);let n=void 0;(yield this.isAlreadyRegisteredWithOneSignal())?yield this.context.updateManager.sendPushDeviceRecordUpdate(i):(n=yield this.context.updateManager.sendPlayerCreate(i))&&(yield this.associateSubscriptionWithEmail(n));const o=yield w.a.getSubscription();return o.deviceId=n,o.optedOut=!1,e?h.a.useSafariLegacyPush()?o.subscriptionToken=e.safariDeviceToken:o.subscriptionToken=e.w3cEndpoint?e.w3cEndpoint.toString():null:o.subscriptionToken=null,yield w.a.setSubscription(o),T.a.getWindowEnv()!==X.a.ServiceWorker&&S.a.trigger(OneSignal.EVENTS.REGISTERED),"undefined"!=typeof OneSignal&&(OneSignal._sessionInitAlreadyRunning=!1),o})}static requestPresubscribeNotificationPermission(){return Object(d.a)(this,void 0,void 0,function*(){return yield Ht.requestNotificationPermission()})}unsubscribe(e){return Object(d.a)(this,void 0,void 0,function*(){if(0===e)throw new te;if(1!==e)throw new te;if(T.a.getWindowEnv()!==X.a.ServiceWorker)throw new te;{const{deviceId:e}=yield w.a.getSubscription();yield Ot.updatePlayer(this.context.appConfig.appId,e,{notification_types:Q.MutedByApi}),yield w.a.put("Options",{key:"optedOut",value:!0})}})}static requestNotificationPermission(){return Object(d.a)(this,void 0,void 0,function*(){const e=yield window.Notification.requestPermission();return y[e]})}associateSubscriptionWithEmail(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield w.a.getEmailProfile();t.subscriptionId&&(yield Ot.updatePlayer(this.config.appId,e,{parent_player_id:t.subscriptionId,email:t.identifier}))})}isAlreadyRegisteredWithOneSignal(){return Object(d.a)(this,void 0,void 0,function*(){const{deviceId:e}=yield w.a.getSubscription();return!!e})}subscribeSafariPromptPermission(){return Object(d.a)(this,void 0,void 0,function*(){const e=e=>new Promise(t=>{window.safari.pushNotification.requestPermission(e,this.config.safariWebId,{app_id:this.config.appId},e=>{e&&e.deviceToken?t(e.deviceToken.toLowerCase()):t(null)})});return this.safariPermissionPromptFailed?e(`${T.a.getOneSignalApiUrl().toString()}/safari`):e(`${T.a.getOneSignalApiUrl().toString()}/safari/apps/${this.config.appId}`)})}subscribeSafari(){return Object(d.a)(this,void 0,void 0,function*(){const e=new le;if(!this.config.safariWebId)throw new f(c.MissingSafariWebId);const{deviceToken:t}=window.safari.pushNotification.permission(this.config.safariWebId);e.existingSafariDeviceToken=t,t||S.a.trigger(OneSignal.EVENTS.PERMISSION_PROMPT_DISPLAYED);const i=yield this.subscribeSafariPromptPermission();if(re.a.triggerNotificationPermissionChanged(),!i)throw this.safariPermissionPromptFailed=!0,new Ft(_t.InvalidSafariSetup);return e.setFromSafariSubscription(i),e})}subscribeFcmFromPage(e){return Object(d.a)(this,void 0,void 0,function*(){if(T.a.getWindowEnv()!==X.a.ServiceWorker&&Notification.permission===y.Default){yield S.a.trigger(OneSignal.EVENTS.PERMISSION_PROMPT_DISPLAYED);const e=yield Ht.requestPresubscribeNotificationPermission(),t=e===y.Default;switch(yield re.a.triggerNotificationPermissionChanged(t),e){case y.Default:throw E.a.debug("Exiting subscription and not registering worker because the permission was dismissed."),OneSignal._sessionInitAlreadyRunning=!1,OneSignal._isRegisteringForPush=!1,new ce(oe.Dismissed);case y.Denied:throw E.a.debug("Exiting subscription and not registering worker because the permission was blocked."),OneSignal._sessionInitAlreadyRunning=!1,OneSignal._isRegisteringForPush=!1,new ce(oe.Blocked)}}try{yield this.context.serviceWorkerManager.installWorker()}catch(e){throw e instanceof nt&&(403===e.status?yield this.context.subscriptionManager.registerFailedSubscription(Q.ServiceWorkerStatus403,this.context):404===e.status&&(yield this.context.subscriptionManager.registerFailedSubscription(Q.ServiceWorkerStatus404,this.context))),e}E.a.debug("[Subscription Manager] Getting OneSignal service Worker...");const t=yield this.context.serviceWorkerManager.getRegistration();if(!t)throw new Error("OneSignal service worker not found!");return E.a.debug("[Subscription Manager] Service worker is ready to continue subscribing."),yield this.subscribeWithVapidKey(t.pushManager,e)})}subscribeFcmFromWorker(e){return Object(d.a)(this,void 0,void 0,function*(){const t=self.registration;if(!t.active&&!g.a.firefox)throw new m(o.ServiceWorkerNotActivated);const i=yield t.pushManager.permissionState({userVisibleOnly:!0});if("denied"===i)throw new ce(oe.Blocked);if("prompt"===i)throw new ce(oe.Default);return yield this.subscribeWithVapidKey(t.pushManager,e)})}getVapidKeyForBrowser(){let e=void 0;return(e=g.a.firefox?this.config.onesignalVapidPublicKey:this.config.vapidPublicKey)?function(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),i=atob(t),n=new Uint8Array(i.length);for(let e=0;e=i}})}isSubscriptionExpiringForSecureIntegration(){return Object(d.a)(this,void 0,void 0,function*(){if((yield this.context.serviceWorkerManager.getActiveState())!==kt.OneSignalWorker)return!1;const e=yield this.context.serviceWorkerManager.getRegistration();if(!e)return!1;if(!e.pushManager)return!1;const t=yield e.pushManager.getSubscription();if(!t)return!1;if(!t.expirationTime)return!1;let{createdAt:i}=yield w.a.getSubscription();if(!i){const e=31536e6;i=(new Date).getTime()+e}const n=i+(t.expirationTime-i)/2;return!!t.expirationTime&&((new Date).getTime()>=t.expirationTime||(new Date).getTime()>=n)})}getSubscriptionState(){return Object(d.a)(this,void 0,void 0,function*(){if(h.a.useSafariLegacyPush())return this.getSubscriptionStateForSecure();const e=T.a.getWindowEnv();switch(e){case X.a.ServiceWorker:const t=yield self.registration.pushManager.getSubscription(),{optedOut:i}=yield w.a.getSubscription();return{subscribed:!!t,optedOut:!!i};default:switch(yield T.a.getIntegration()){case Ce.a.Secure:return this.getSubscriptionStateForSecure();case Ce.a.SecureProxy:switch(e){case X.a.OneSignalProxyFrame:case X.a.OneSignalSubscriptionPopup:case X.a.OneSignalSubscriptionModal:return this.getSubscriptionStateForSecure();default:return yield OneSignal.proxyFrameHost.runCommand(OneSignal.POSTMAM_COMMANDS.GET_SUBSCRIPTION_STATE)}case Ce.a.InsecureProxy:return yield this.getSubscriptionStateForInsecure();default:throw new m(o.UnsupportedEnvironment)}}})}getSubscriptionStateForSecure(){return Object(d.a)(this,void 0,void 0,function*(){const{deviceId:e,optedOut:t}=yield w.a.getSubscription();if(h.a.useSafariLegacyPush()){const i=window.safari.pushNotification.permission(this.config.safariWebId);return{subscribed:!("granted"!==i.permission||!i.deviceToken||!e),optedOut:!!t}}const i=yield this.context.serviceWorkerManager.getActiveState(),n=yield this.context.serviceWorkerManager.getRegistration(),o=yield this.context.permissionManager.getNotificationPermission(this.context.appConfig.safariWebId),s=i===kt.OneSignalWorker;return n?{subscribed:!(!e||o!==y.Granted||!s),optedOut:!!t}:{subscribed:!1,optedOut:!!t}})}getSubscriptionStateForInsecure(){return Object(d.a)(this,void 0,void 0,function*(){const{deviceId:e,subscriptionToken:t,optedOut:i}=yield w.a.getSubscription(),n=yield this.context.permissionManager.getNotificationPermission(this.context.appConfig.safariWebId);return{subscribed:!(!e||!t||n!==y.Granted),optedOut:!!i}})}registerFailedSubscription(e,t){return Object(d.a)(this,void 0,void 0,function*(){t.pageViewManager.isFirstPageView()&&(t.subscriptionManager.registerSubscription(new le,e),t.pageViewManager.incrementPageViewCount())})}}var $t=class{static getServiceWorkerManager(e){const t=e.appConfig,i=T.a.getBuildEnvPrefix(),n={workerPath:new tt(`/${i}OneSignalSDKWorker.js`),registrationOptions:{scope:"/"}};return t.userConfig&&(t.userConfig.path&&(n.workerPath=new tt(`${t.userConfig.path}${t.userConfig.serviceWorkerPath}`)),t.userConfig.serviceWorkerParam&&(n.registrationOptions=t.userConfig.serviceWorkerParam)),new Vt(e,n)}static getSubscriptionManager(e){const t=e.appConfig,i={safariWebId:t.safariWebId,appId:t.appId,vapidPublicKey:t.vapidPublicKey,onesignalVapidPublicKey:t.onesignalVapidPublicKey};return new Ht(e,i)}};class Gt{constructor(e){this.context=e,this.onSessionSent=e.pageViewManager.getPageViewCount()>1}isDeviceIdAvailable(){return Object(d.a)(this,void 0,void 0,function*(){return null!=(yield w.a.getSubscription()).deviceId})}getDeviceId(){return Object(d.a)(this,void 0,void 0,function*(){const{deviceId:e}=yield w.a.getSubscription();if(!e)throw new b(r.NoDeviceId);return e})}createDeviceRecord(){return Object(d.a)(this,void 0,void 0,function*(){return he.createDeviceRecord(this.context.appConfig.appId)})}sendPushDeviceRecordUpdate(e){return Object(d.a)(this,void 0,void 0,function*(){if(!(yield this.context.subscriptionManager.isAlreadyRegisteredWithOneSignal()))return void E.a.debug("Not sending the update because user is not registered with OneSignal (no device id)");const t=yield this.getDeviceId();e||(e=yield this.createDeviceRecord()),this.onSessionSent?yield Ot.updatePlayer(this.context.appConfig.appId,t,Object.assign({notification_types:Q.Subscribed},e.serialize())):yield this.sendOnSessionUpdate(e)})}sendOnSessionUpdate(e){return Object(d.a)(this,void 0,void 0,function*(){if(this.onSessionSent)return;if(!this.context.pageViewManager.isFirstPageView())return;if(!(yield this.context.subscriptionManager.isAlreadyRegisteredWithOneSignal()))return void E.a.debug("Not sending the on session because user is not registered with OneSignal (no device id)");const t=yield this.getDeviceId();if(e||(e=yield this.createDeviceRecord()),e.subscriptionState===Q.Subscribed||!0===OneSignal.config.enableOnSession)try{this.context.sessionManager.upsertSession(t,e,ue.b.PlayerOnSession),this.onSessionSent=!0}catch(e){E.a.error(`Failed to update user session. Error "${e.message}" ${e.stack}`)}})}sendPlayerCreate(e){return Object(d.a)(this,void 0,void 0,function*(){yield Et.addExternalUserIdToDeviceRecord(e);try{const t=yield Ot.createUser(e);return t?(E.a.info("Subscribed to web push and registered with OneSignal",e,t),this.onSessionSent=!0,this.context.sessionManager.upsertSession(t,e,ue.b.PlayerCreate),t):void E.a.error("Failed to create user.")}catch(e){return void E.a.error(`Failed to create user. Error "${e.message}" ${e.stack}`)}})}onSessionAlreadyCalled(){return this.onSessionSent}sendExternalUserIdUpdate(e,t){return Object(d.a)(this,void 0,void 0,function*(){t||(t=yield w.a.getExternalUserIdAuthHash());const i={external_user_id:ae.b.getValueOrDefault(e,""),external_user_id_auth_hash:ae.b.getValueOrDefault(t,void 0)};this.context.secondaryChannelManager.synchronizer.setExternalUserId(i.external_user_id,i.external_user_id_auth_hash);const n=this.sendPushPlayerUpdate(i);(yield this.isDeviceIdAvailable())&&(yield n)})}sendTagsUpdate(e){return Object(d.a)(this,void 0,void 0,function*(){this.context.secondaryChannelManager.synchronizer.setTags(e);const t={tags:e},i=yield w.a.getExternalUserIdAuthHash();i&&(t.external_user_id_auth_hash=i);const n=this.sendPushPlayerUpdate(t);(yield this.isDeviceIdAvailable())&&(yield n)})}sendPushPlayerUpdate(e){return Object(d.a)(this,void 0,void 0,function*(){let{deviceId:t}=yield w.a.getSubscription();if(t||(yield Object(K.d)(OneSignal.EVENTS.REGISTERED),({deviceId:t}=yield w.a.getSubscription())),t)return yield Ot.updatePlayer(this.context.appConfig.appId,t,e)})}sendOutcomeDirect(e,t,i,n){return Object(d.a)(this,void 0,void 0,function*(){Object(K.s)("sendOutcomeDirect");const o=yield this.createDeviceRecord(),s={app_id:e,id:i,device_type:o.deliveryPlatform,notification_ids:t,direct:!0};void 0!==n&&(s.weight=n),yield Ot.sendOutcome(s)})}sendOutcomeInfluenced(e,t,i,n){return Object(d.a)(this,void 0,void 0,function*(){Object(K.s)("sendOutcomeInfluenced");const o=yield this.createDeviceRecord(),s={app_id:e,id:i,device_type:o.deliveryPlatform,notification_ids:t,direct:!1};void 0!==n&&(s.weight=n),yield Ot.sendOutcome(s)})}sendOutcomeUnattributed(e,t,i){return Object(d.a)(this,void 0,void 0,function*(){Object(K.s)("sendOutcomeUnattributed");const n=yield this.createDeviceRecord(),o={app_id:e,id:t,device_type:n.deliveryPlatform};void 0!==i&&(o.weight=i),yield Ot.sendOutcome(o)})}}const zt={reportingThreshold:30,enableOnSessionForUnsubcribed:!1,enableOnFocus:!0},qt={pageViews:1,timeDelay:0},Kt={actionMessage:"We'd like to show you notifications for the latest news and updates.",acceptButton:"Allow",cancelButton:"Cancel",errorButton:"Try Again",categoryDefaults:{updateMessage:"Update your push notification subscription preferences.",positiveUpdateButton:"Save Preferences",negativeUpdateButton:"Cancel"},savingText:"Saving...",confirmMessage:"Thank You!"},Yt={type:O.Push,text:{actionMessage:Kt.actionMessage,acceptButton:Kt.acceptButton,cancelButton:Kt.cancelButton},autoPrompt:!1,delay:qt};function Jt(e){return` `}var Qt,Zt,Xt,ei;!function(e){e.Stylesheet="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/css/intlTelInput.min.css",e.Main="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/js/intlTelInput.min.js",e.Utils="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/17.0.12/js/utils.js"}(Qt||(Qt={})),function(e){e.Stylesheet="sha512-yye/u0ehQsrVrfSd6biT17t39Rg9kNc+vENcCXZuMz2a+LWFGvXUnYuWUW6pbfYj1jcBb/C39UZw2ciQvwDDvg==",e.Main="sha512-OnkjbJ4TwPpgSmjXACCb5J4cJwi880VRe+vWpPDlr8M38/L3slN5uUAeOeWU2jN+4vN0gImCXFGdJmc0wO4Mig==",e.Utils="sha512-bUcJxlqkiGA3cmoYPuZaLRsyc5ChG9APG4ajom2AXKSlBtOmx4kLV3c8uv/6uSz43FMjI4Q2QI21+D223rT76w=="}(Zt||(Zt={}));class ti{constructor(e){this.smsInputFieldIsValid=!0,this.emailInputFieldIsValid=!0,this.promptOptions=e}generateHtml(){const e=document.createElement("div");let t,i,n;switch(Object(K.a)(e,$.channelCaptureContainer),e.id=$.channelCaptureContainer,this.promptOptions.type){case O.Sms:t=this.promptOptions.text.smsLabel||"Phone Number",i=this.getInputWithValidationElement(O.Sms,t),e.appendChild(i);break;case O.Email:t=this.promptOptions.text.emailLabel||"Email",n=this.getInputWithValidationElement(O.Email,t),e.appendChild(n);break;case O.SmsAndEmail:t=this.promptOptions.text.emailLabel||"Email",n=this.getInputWithValidationElement(O.Email,t),e.appendChild(n),t=this.promptOptions.text.smsLabel||"Phone Number",i=this.getInputWithValidationElement(O.Sms,t),e.appendChild(i)}return e}getValidationElementWithMessage(e){const t=document.createElement("div"),i=document.createElement("img"),n=document.createElement("p");return n.innerText=e,i.setAttribute("src",V),t.appendChild(i),t.appendChild(n),t}getInputWithValidationElement(e,t){const i=this.getTypeSpecificVariablesForValidationElemGeneration(e),n=document.createElement("label"),o=document.createElement("input"),s=document.createElement("div"),r=document.createElement("div"),a=this.getValidationElementWithMessage(i.message),c=document.createElement("div");return s.setAttribute("style","clear:both"),r.setAttribute("style","clear:both"),Object(K.a)(a,$.onesignalValidationElementHidden),Object(K.a)(a,$.onesignalValidationElement),a.id=i.validationElementId,n.title=t,n.innerText=t,n.htmlFor=i.inputElementId,o.type=i.domElementType,o.id=i.inputElementId,o.tabIndex=i.tabIndex,Object(K.a)(o,i.inputClass),Object(K.a)(c,$.inputWithValidationElement),c.id=i.wrappingDivId,c.appendChild(n),c.appendChild(s),c.appendChild(o),c.appendChild(r),c.appendChild(a),c}getTypeSpecificVariablesForValidationElemGeneration(e){if(e===O.Email)return{message:"Please enter a valid email",domElementType:"email",validationElementId:G.onesignalEmailValidationElement,inputElementId:G.onesignalEmailInput,inputClass:$.onesignalEmailInput,wrappingDivId:G.emailInputWithValidationElement,tabIndex:1};if(e===O.Sms)return{message:"Please enter a valid phone number",domElementType:"tel",validationElementId:G.onesignalSmsValidationElement,inputElementId:G.onesignalSmsInput,inputClass:$.onesignalSmsInput,wrappingDivId:G.smsInputWithValidationElement,tabIndex:2};throw new Error("invalid channel type for input validation")}initializePhoneInputLibrary(){const e=Object(K.l)(`#${G.onesignalSmsInput}`);e&&window.intlTelInput?this.itiOneSignal=window.intlTelInput(e,{autoPlaceholder:"off",separateDialCode:!0}):E.a.error("OneSignal: there was a problem initializing International Telephone Input")}addSmsInputEventListeners(){const e=Object(K.l)(`#${G.onesignalSmsInput}`);e.addEventListener("keyup",t=>{var i,n;this.smsInputFieldIsValid=this.itiOneSignal.isValidNumber()||""===(null===(i=e)||void 0===i?void 0:i.value),"Enter"===t.key&&(null===(n=document.getElementById(R.allowButton))||void 0===n||n.click()),this.updateValidationOnSmsInputChange()}),e.addEventListener("blur",()=>{var t;this.smsInputFieldIsValid=this.itiOneSignal.isValidNumber()||""===(null===(t=e)||void 0===t?void 0:t.value),this.updateValidationOnSmsInputChange()})}addEmailInputEventListeners(){const e=Object(K.l)(`#${G.onesignalEmailInput}`);e.addEventListener("keyup",t=>{var i,n;const o=null===(i=e)||void 0===i?void 0:i.value;this.emailInputFieldIsValid=ti.validateEmailInputWithReturnVal(o),"Enter"===t.key&&(null===(n=document.getElementById(R.allowButton))||void 0===n||n.click()),this.updateValidationOnEmailInputChange()})}updateValidationOnSmsInputChange(){const e=Object(K.l)(`#${G.smsInputWithValidationElement}`),t=Object(K.l)(`#${G.onesignalSmsValidationElement}`);Object(K.v)(e,$.onesignalErrorInput),Object(K.a)(t,$.onesignalValidationElementHidden)}updateValidationOnEmailInputChange(){const e=Object(K.l)(`#${G.emailInputWithValidationElement}`),t=Object(K.l)(`#${G.onesignalEmailValidationElement}`);Object(K.v)(e,$.onesignalErrorInput),Object(K.a)(t,$.onesignalValidationElementHidden)}loadPhoneLibraryScripts(){return Object(d.a)(this,void 0,void 0,function*(){if(OneSignal._didLoadITILibrary)return;const e=document.createElement("script"),t=document.createElement("script"),i=document.createElement("link");e.src=Qt.Main,t.src=Qt.Utils,i.href=Qt.Stylesheet,i.rel="stylesheet",e.integrity=Zt.Main,t.integrity=Zt.Utils,i.integrity=Zt.Stylesheet,e.crossOrigin="anonymous",t.crossOrigin="anonymous",i.crossOrigin="anonymous",document.head.appendChild(e),document.head.appendChild(t),document.head.appendChild(i);const n=new Promise(t=>{e.onload=(()=>{t()})}),o=new Promise(e=>{t.onload=(()=>{e()})});yield Promise.all([n,o]),OneSignal._didLoadITILibrary=!0})}mount(){return Object(d.a)(this,void 0,void 0,function*(){const e=ti.isUsingSmsInputField(this.promptOptions.type),t=ti.isUsingEmailInputField(this.promptOptions.type);e&&(yield this.loadPhoneLibraryScripts());const i=this.generateHtml();Object(K.l)(`#${R.body}`).appendChild(i),e&&(this.initializePhoneInputLibrary(),this.addSmsInputEventListeners()),t&&this.addEmailInputEventListeners()})}isEmailInputFieldEmpty(){return""===this.getValueFromEmailInput()}isSmsInputFieldEmpty(){return""===this.getValueFromSmsInput()}getValueFromEmailInput(){var e;return(null===(e=Object(K.l)(`#${G.onesignalEmailInput}`))||void 0===e?void 0:e.value)||""}getValueFromSmsInput(){return this.itiOneSignal.getNumber(intlTelInputUtils.numberFormat.E164)||""}static showSmsInputError(e){const t=document.querySelector(`#${G.onesignalSmsValidationElement}`),i=document.querySelector(`#${G.smsInputWithValidationElement}`);t&&i?e?(t.classList.remove($.onesignalValidationElementHidden),i.classList.add($.onesignalErrorInput)):(t.classList.add($.onesignalValidationElementHidden),i.classList.remove($.onesignalErrorInput)):E.a.error("OneSignal: couldn't find slidedown validation element")}static showEmailInputError(e){const t=document.querySelector(`#${G.onesignalEmailValidationElement}`),i=document.querySelector(`#${G.emailInputWithValidationElement}`);t&&i?e?(t.classList.remove($.onesignalValidationElementHidden),i.classList.add($.onesignalErrorInput)):(t.classList.add($.onesignalValidationElementHidden),i.classList.remove($.onesignalErrorInput)):E.a.error("OneSignal: couldn't find slidedown validation element")}static resetInputErrorStates(e){switch(e){case O.Sms:ti.showSmsInputError(!1);break;case O.Email:ti.showEmailInputError(!1);break;case O.SmsAndEmail:ti.showSmsInputError(!1),ti.showEmailInputError(!1)}}static validateEmailInputWithReturnVal(e){return/^\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$/.test(e||"")||""===e}static isUsingSmsInputField(e){return e===O.Sms||e===O.SmsAndEmail}static isUsingEmailInputField(e){return e===O.Email||e===O.SmsAndEmail}}(ei=Xt||(Xt={}))[ei.InvalidSms=0]="InvalidSms",ei[ei.InvalidEmail=1]="InvalidEmail",ei[ei.InvalidEmailAndSms=2]="InvalidEmailAndSms";class ii extends p.a{constructor(e){let t;switch(e){case Xt.InvalidEmail:t="Invalid email";break;case Xt.InvalidSms:t="Invalid sms";break;case Xt.InvalidEmailAndSms:t="Invalid email & sms"}super(t),this.description=Xt[e],this.reason=e,Object.setPrototypeOf(this,ii.prototype)}}class ni{constructor(e){var t,i,n;switch(this.savingButton=Kt.savingText,this.errorButton=Kt.errorButton,this.options=e,this.options.text.actionMessage=e.text.actionMessage.substring(0,90),this.options.text.acceptButton=e.text.acceptButton.substring(0,16),this.options.text.cancelButton=e.text.cancelButton.substring(0,16),this.notificationIcons=null,this.channelCaptureContainer=null,this.isShowingFailureState=!1,e.type){case O.Category:this.negativeUpdateButton=null===(t=this.options.text.negativeUpdateButton)||void 0===t?void 0:t.substring(0,16),this.positiveUpdateButton=null===(i=this.options.text.positiveUpdateButton)||void 0===i?void 0:i.substring(0,16),this.updateMessage=null===(n=this.options.text.updateMessage)||void 0===n?void 0:n.substring(0,90),this.tagCategories=e.categories,this.errorButton=ae.a.getValueOrDefault(this.options.text.positiveUpdateButton,Kt.errorButton);break;case O.Sms:case O.Email:case O.SmsAndEmail:this.errorButton=ae.a.getValueOrDefault(this.options.text.acceptButton,Kt.errorButton)}}create(e){return Object(d.a)(this,void 0,void 0,function*(){if(null===this.notificationIcons){const t=yield he.getNotificationIcons();this.notificationIcons=t,this.container.className.includes(j.container)&&Object(K.w)(`#${R.container}`);const i=e&&this.tagCategories?this.positiveUpdateButton:this.options.text.acceptButton,n=e&&this.tagCategories?this.negativeUpdateButton:this.options.text.cancelButton,o=function(e){const{icon:t,messageText:i,positiveButtonText:n,negativeButtonText:o}=e,s=t===j.defaultIcon?L:t,r=t===j.defaultIcon?j.defaultIcon:"",a=document.createElement("div"),c=document.createElement("div"),l=document.createElement("div"),d=document.createElement("div"),u=document.createElement("div"),g=document.createElement("div"),h=document.createElement("button"),p=document.createElement("button"),m=document.createElement("div"),b=document.createElement("div"),f=document.createElement("img");return Object(K.a)(c,j.body),Object(K.a)(d,j.icon),Object(K.a)(l,j.message),Object(K.a)(g,j.footer),Object(K.a)(m,j.clearfix),Object(K.a)(b,j.clearfix),Object(K.a)(h,U.alignRight),Object(K.a)(h,U.primary),Object(K.a)(h,U.slidedownButton),Object(K.a)(p,U.alignRight),Object(K.a)(p,U.secondary),Object(K.a)(p,U.slidedownButton),a.id=R.normalSlidedown,c.id=R.body,u.id=R.loadingContainer,h.id=R.allowButton,p.id=R.cancelButton,g.id=R.footer,r&&Object(K.a)(f,r),f.setAttribute("alt","notification icon"),f.setAttribute("src",s||""),l.innerText=i||"",h.innerText=n||"",p.innerText=o||"",d.appendChild(f),c.appendChild(d),c.appendChild(l),c.appendChild(m),c.appendChild(u),g.appendChild(h),g.appendChild(p),g.appendChild(b),a.appendChild(c),a.appendChild(g),a}({messageText:e&&this.tagCategories?this.updateMessage:this.options.text.actionMessage,icon:this.options.icon||this.getPlatformNotificationIcon(),positiveButtonText:i,negativeButtonText:n}),s=document.createElement("div"),r=document.createElement("div");s.id=R.container,Object(K.a)(s,j.container),Object(K.a)(s,j.reset),Object(K.l)("body").appendChild(s),r.id=R.dialog,Object(K.a)(r,j.dialog),r.appendChild(o),this.container.appendChild(r),Object(K.a)(this.container,g.a.mobile?j.slideUp:j.slideDown),this.allowButton.addEventListener("click",this.onSlidedownAllowed.bind(this)),this.cancelButton.addEventListener("click",this.onSlidedownCanceled.bind(this))}})}static triggerSlidedownEvent(e){return Object(d.a)(this,void 0,void 0,function*(){yield S.a.trigger(e)})}onSlidedownAllowed(e){return Object(d.a)(this,void 0,void 0,function*(){yield ni.triggerSlidedownEvent(ni.EVENTS.ALLOW_CLICK)})}onSlidedownCanceled(e){ni.triggerSlidedownEvent(ni.EVENTS.CANCEL_CLICK),this.close(),ni.triggerSlidedownEvent(ni.EVENTS.CLOSED)}close(){Object(K.a)(this.container,j.closeSlidedown),Object(K.u)(this.dialog,"animationend",(e,t)=>{e.target!==this.dialog||"slideDownExit"!==e.animationName&&"slideUpExit"!==e.animationName||(Object(K.w)(`#${R.container}`),t())},!0)}setSaveState(){this.allowButton.disabled=!0,this.allowButton.textContent=null,this.allowButton.insertAdjacentElement("beforeend",this.getTextSpan(this.savingButton)),this.allowButton.insertAdjacentElement("beforeend",this.getIndicatorHolder()),Object(K.b)(this.buttonIndicatorHolder,"beforeend",Jt(F.whiteLoadingIndicator)),Object(K.a)(this.allowButton,"disabled"),Object(K.a)(this.allowButton,j.savingStateButton)}removeSaveState(){this.allowButton.textContent=this.positiveUpdateButton,Object(K.w)(`#${j.buttonIndicatorHolder}`),this.allowButton.disabled=!1,Object(K.v)(this.allowButton,"disabled"),Object(K.v)(this.allowButton,j.savingStateButton)}setFailureState(){this.allowButton.textContent=null,this.allowButton.insertAdjacentElement("beforeend",this.getTextSpan(this.errorButton)),this.options.type===O.Category&&(this.allowButton.insertAdjacentElement("beforeend",this.getIndicatorHolder()),Object(K.b)(this.buttonIndicatorHolder,"beforeend",function(e="#FFFFFF"){return``}()),Object(K.a)(this.allowButton,"onesignal-error-state-button")),this.isShowingFailureState=!0}setFailureStateForInvalidChannelInput(e){switch(e){case Xt.InvalidSms:ti.showSmsInputError(!0);break;case Xt.InvalidEmail:ti.showEmailInputError(!0);break;case Xt.InvalidEmailAndSms:ti.showSmsInputError(!0),ti.showEmailInputError(!0)}}removeFailureState(){Object(K.w)("#onesignal-button-indicator-holder"),Object(K.v)(this.allowButton,"onesignal-error-state-button"),C.isSlidedownPushDependent(this.options.type)||ti.resetInputErrorStates(this.options.type),this.isShowingFailureState=!1}getPlatformNotificationIcon(){return Object(K.m)(this.notificationIcons)}getIndicatorHolder(){const e=document.createElement("div");return e.id=R.buttonIndicatorHolder,Object(K.a)(e,j.buttonIndicatorHolder),e}getTextSpan(e){const t=document.createElement("span");return t.textContent=e,t}get container(){return Object(K.l)(`#${R.container}`)}get dialog(){return Object(K.l)(`#${R.dialog}`)}get allowButton(){return Object(K.l)(`#${R.allowButton}`)}get cancelButton(){return Object(K.l)(`#${R.cancelButton}`)}get buttonIndicatorHolder(){return Object(K.l)(`#${R.buttonIndicatorHolder}`)}get slidedownFooter(){return Object(K.l)(`#${R.footer}`)}static get EVENTS(){return{ALLOW_CLICK:"popoverAllowClick",CANCEL_CLICK:"popoverCancelClick",SHOWN:"popoverShown",CLOSED:"popoverClosed",QUEUED:"popoverQueued"}}}var oi,si,ri,ai,ci,li=i(25);class di{static getEnvironmentInfo(){return{browserType:this.getBrowser(),browserVersion:this.getBrowserVersion(),isHttps:this.isHttps(),isUsingSubscriptionWorkaround:this.isUsingSubscriptionWorkaround(),isBrowserAndSupportsServiceWorkers:this.supportsServiceWorkers(),requiresUserInteraction:this.requiresUserInteraction(),osVersion:this.getOsVersion(),canTalkToServiceWorker:this.canTalkToServiceWorker()}}static getBrowser(){return g.a.chrome?de.Chrome:g.a.msedge?de.Edge:g.a.opera?de.Opera:g.a.firefox?de.Firefox:this.isMacOSSafari()?de.Safari:de.Other}static isMacOSSafari(){return void 0!==window.safari||Object(li.a)()}static getBrowserVersion(){return ae.b.parseVersionString(g.a.version)}static isHttps(){return!!window&&(window.location&&"https:"===window.location.protocol)}static isUsingSubscriptionWorkaround(){return I.a.isUsingSubscriptionWorkaround()}static supportsServiceWorkers(){return window.navigator&&"serviceWorker"in window.navigator}static requiresUserInteraction(){return"firefox"===this.getBrowser()&&this.getBrowserVersion()>=72||"safari"===this.getBrowser()&&this.getBrowserVersion()>=12.1}static getOsVersion(){return g.a.osversion}static canTalkToServiceWorker(){return!!window.isSecureContext}}function ui(e){return new Promise(t=>setTimeout(t,e))}class gi{constructor(e){this.isNativePromptShowing=!1,this.context=e,this.eventHooksInstalled=!1}shouldForceSlidedownOverNative(){const{environmentInfo:e}=OneSignal,{browserType:t,browserVersion:i,requiresUserInteraction:n}=e;return"chrome"===t&&Number(i)>=63&&(g.a.tablet||g.a.mobile)||n}spawnAutoPrompts(){return Object(d.a)(this,void 0,void 0,function*(){var e,t;const i=OneSignal.config.userConfig.promptOptions,n=this.shouldForceSlidedownOverNative(),o=this.getDelayedPromptOptions(i,O.Native),s=this.isPageViewConditionMet(o),r=o.enabled&&s,a=n&&r;if(r&&!a)return void this.internalShowDelayedPrompt(O.Native,o.timeDelay||0);const c=!!C.getFirstSlidedownPromptOptionsWithType(null===(e=i.slidedown)||void 0===e?void 0:e.prompts,O.Push);a&&!c&&this.internalShowDelayedPrompt(O.Push,o.timeDelay||0);const l=null===(t=i.slidedown)||void 0===t?void 0:t.prompts;if(l&&(null===l||void 0===l?void 0:l.length)>0)for(let e=0;e0&&(yield ui(1e3*t)),e){case O.Native:yield this.internalShowNativePrompt();break;case O.Push:yield this.internalShowSlidedownPrompt(i);break;case O.Category:yield this.internalShowCategorySlidedown(i);break;case O.Sms:yield this.internalShowSmsSlidedown(i);break;case O.Email:yield this.internalShowEmailSlidedown(i);break;case O.SmsAndEmail:yield this.internalShowSmsAndEmailSlidedown(i);break;default:E.a.error("Invalid Delayed Prompt type")}})}internalShowNativePrompt(){return Object(d.a)(this,void 0,void 0,function*(){I.b.logMethodCall("internalShowNativePrompt"),this.isNativePromptShowing?E.a.debug("Already showing autoprompt. Abort showing a native prompt."):(this.isNativePromptShowing=!0,he.markHttpSlidedownShown(),yield Xe.registerForPushNotifications(),this.isNativePromptShowing=!1,We.markPromptDismissedWithType(Ee.Push))})}internalShowSlidedownPrompt(e={force:!1}){return Object(d.a)(this,void 0,void 0,function*(){I.b.logMethodCall("internalShowSlidedownPrompt"),e.slidedownPromptOptions||(e.slidedownPromptOptions=Yt),he.markHttpSlidedownShown(),0===(yield this.context.dynamicResourceLoader.loadSdkStylesheet())?(this.eventHooksInstalled||this.installEventHooksForSlidedown(),yield this.context.slidedownManager.createSlidedown(e)):E.a.debug("Not showing slidedown permission message because styles failed to load.")})}internalShowCategorySlidedown(e){return Object(d.a)(this,void 0,void 0,function*(){I.b.logMethodCall("internalShowCategorySlidedown"),yield this.internalShowParticularSlidedown(O.Category,e)})}internalShowSmsSlidedown(e){return Object(d.a)(this,void 0,void 0,function*(){I.b.logMethodCall("internalShowSmsSlidedown"),yield this.internalShowParticularSlidedown(O.Sms,e)})}internalShowEmailSlidedown(e){return Object(d.a)(this,void 0,void 0,function*(){I.b.logMethodCall("internalShowEmailSlidedown"),yield this.internalShowParticularSlidedown(O.Email,e)})}internalShowSmsAndEmailSlidedown(e){return Object(d.a)(this,void 0,void 0,function*(){I.b.logMethodCall("internalShowSmsAndEmailSlidedown"),yield this.internalShowParticularSlidedown(O.SmsAndEmail,e)})}internalShowParticularSlidedown(e,t){return Object(d.a)(this,void 0,void 0,function*(){var i,n;const o=null===(n=null===(i=this.context.appConfig.userConfig.promptOptions)||void 0===i?void 0:i.slidedown)||void 0===n?void 0:n.prompts,s=(null===t||void 0===t?void 0:t.slidedownPromptOptions)||C.getFirstSlidedownPromptOptionsWithType(o,e);if(!s){if(e!==O.Push)return void E.a.error(`OneSignal: slidedown of type '${e}' couldn't be shown. Check your configuration`+" on the OneSignal dashboard or your custom code initialization.");E.a.warn("The OneSignal 'push' slidedown will be shown with default text settings. To customize, see the OneSignal documentation.")}yield this.internalShowSlidedownPrompt(Object.assign(Object.assign({},t),{slidedownPromptOptions:s}))})}installEventHooksForSlidedown(){this.eventHooksInstalled=!0,OneSignal.emitter.on(ni.EVENTS.SHOWN,()=>{this.context.slidedownManager.setIsSlidedownShowing(!0)}),OneSignal.emitter.on(ni.EVENTS.CLOSED,()=>{this.context.slidedownManager.setIsSlidedownShowing(!1),this.context.slidedownManager.showQueued()}),OneSignal.emitter.on(ni.EVENTS.ALLOW_CLICK,()=>Object(d.a)(this,void 0,void 0,function*(){yield this.context.slidedownManager.handleAllowClick(),S.a.trigger(OneSignal.EVENTS.TEST_FINISHED_ALLOW_CLICK_HANDLING)})),OneSignal.emitter.on(ni.EVENTS.CANCEL_CLICK,()=>{const{type:e}=OneSignal.slidedown.options;switch(e){case O.Push:case O.Category:E.a.debug("Setting flag to not show the slidedown to the user again."),We.markPromptDismissedWithType(Ee.Push);break;default:E.a.debug("Setting flag to not show the slidedown to the user again."),We.markPromptDismissedWithType(Ee.NonPush)}})}isPageViewConditionMet(e){if(!e||void 0===e.pageViews)return!1;if(!e.autoPrompt||!e.enabled)return!1;return this.context.pageViewManager.getLocalPageViewCount()>=e.pageViews}getDelayedPromptOptions(e,t){var i,n,o,s;const r={enabled:!1,autoPrompt:!1,timeDelay:qt.timeDelay,pageViews:qt.pageViews};if(!e||!e.native||!e.slidedown)return r;switch(t){case O.Native:const a=e.native;return{enabled:null===a||void 0===a?void 0:a.enabled,autoPrompt:null===a||void 0===a?void 0:a.autoPrompt,timeDelay:null===a||void 0===a?void 0:a.timeDelay,pageViews:null===a||void 0===a?void 0:a.pageViews};case O.Push:case O.Category:case O.Email:case O.Sms:case O.SmsAndEmail:const{userConfig:c}=this.context.appConfig,l=C.getFirstSlidedownPromptOptionsWithType((null===(n=null===(i=c.promptOptions)||void 0===i?void 0:i.slidedown)||void 0===n?void 0:n.prompts)||[],t);return{enabled:!!l,autoPrompt:!!(null===l||void 0===l?void 0:l.autoPrompt),timeDelay:null===(o=null===l||void 0===l?void 0:l.delay)||void 0===o?void 0:o.timeDelay,pageViews:null===(s=null===l||void 0===l?void 0:l.delay)||void 0===s?void 0:s.pageViews};default:return r}}}class hi{constructor(e){this.onSessionSent=!1,this.context=e}notifySWToUpsertSession(e,t,i){return Object(d.a)(this,void 0,void 0,function*(){const n=I.a.isHttps(),o={deviceId:e,deviceRecord:t.serialize(),sessionThreshold:this.context.appConfig.sessionThreshold||0,enableSessionDuration:!!this.context.appConfig.enableSessionDuration,sessionOrigin:i,isHttps:n,isSafari:I.a.isSafari(),outcomesConfig:this.context.appConfig.userConfig.outcomes};this.context.environmentInfo.isBrowserAndSupportsServiceWorkers&&!this.context.environmentInfo.isUsingSubscriptionWorkaround?(E.a.debug("Notify SW to upsert session"),yield this.context.workerMessenger.unicast(pe.SessionUpsert,o)):this.context.environmentInfo.canTalkToServiceWorker&&this.context.environmentInfo.isUsingSubscriptionWorkaround?(E.a.debug("Notify iframe to notify SW to upsert session"),yield OneSignal.proxyFrameHost.runCommand(OneSignal.POSTMAM_COMMANDS.SESSION_UPSERT,o)):E.a.debug("Notify upsert: do nothing")})}notifySWToDeactivateSession(e,t,i){return Object(d.a)(this,void 0,void 0,function*(){const n=I.a.isHttps(),o={deviceId:e,deviceRecord:t?t.serialize():void 0,sessionThreshold:this.context.appConfig.sessionThreshold,enableSessionDuration:this.context.appConfig.enableSessionDuration,sessionOrigin:i,isHttps:n,isSafari:I.a.isSafari(),outcomesConfig:this.context.appConfig.userConfig.outcomes};this.context.environmentInfo.isBrowserAndSupportsServiceWorkers&&!this.context.environmentInfo.isUsingSubscriptionWorkaround?(E.a.debug("Notify SW to deactivate session"),yield this.context.workerMessenger.unicast(pe.SessionDeactivate,o)):this.context.environmentInfo.canTalkToServiceWorker&&this.context.environmentInfo.isUsingSubscriptionWorkaround?(E.a.debug("Notify SW to deactivate session"),yield OneSignal.proxyFrameHost.runCommand(OneSignal.POSTMAM_COMMANDS.SESSION_DEACTIVATE,o)):E.a.debug("Notify deactivate: do nothing")})}handleVisibilityChange(){return Object(d.a)(this,void 0,void 0,function*(){const e=document.visibilityState,[t,i]=yield Promise.all([he.getDeviceId(),he.createDeviceRecord(this.context.appConfig.appId,!0)]);if("visible"===e)return this.setupOnFocusAndOnBlurForSession(),E.a.debug("handleVisibilityChange","visible",`hasFocus: ${document.hasFocus()}`),void(document.hasFocus()&&(yield this.notifySWToUpsertSession(t,i,ue.b.VisibilityVisible)));if("hidden"!==e)E.a.warn("Unhandled visibility state happened",e);else{E.a.debug("handleVisibilityChange","hidden"),OneSignal.cache.focusHandler&&OneSignal.cache.isFocusEventSetup&&(window.removeEventListener("focus",OneSignal.cache.focusHandler,!0),OneSignal.cache.isFocusEventSetup=!1),OneSignal.cache.blurHandler&&OneSignal.cache.isBlurEventSetup&&(window.removeEventListener("blur",OneSignal.cache.blurHandler,!0),OneSignal.cache.isBlurEventSetup=!1);const[e,t]=yield Promise.all([he.getDeviceId(),he.createDeviceRecord(this.context.appConfig.appId)]);yield this.notifySWToDeactivateSession(e,t,ue.b.VisibilityHidden)}})}handleOnBeforeUnload(){return Object(d.a)(this,void 0,void 0,function*(){const e=I.a.isHttps(),t={sessionThreshold:this.context.appConfig.sessionThreshold,enableSessionDuration:this.context.appConfig.enableSessionDuration,sessionOrigin:ue.b.BeforeUnload,isHttps:e,isSafari:I.a.isSafari(),outcomesConfig:this.context.appConfig.userConfig.outcomes};e?(E.a.debug("Notify SW to deactivate session (beforeunload)"),this.context.workerMessenger.directPostMessageToSW(pe.SessionDeactivate,t)):(E.a.debug("Notify iframe to notify SW to deactivate session (beforeunload)"),yield OneSignal.proxyFrameHost.runCommand(OneSignal.POSTMAM_COMMANDS.SESSION_DEACTIVATE,t))})}handleOnFocus(e){return Object(d.a)(this,void 0,void 0,function*(){if(E.a.debug("handleOnFocus",e),e.target!==window)return;const[t,i]=yield Promise.all([he.getDeviceId(),he.createDeviceRecord(this.context.appConfig.appId,!0)]);yield this.notifySWToUpsertSession(t,i,ue.b.Focus)})}handleOnBlur(e){return Object(d.a)(this,void 0,void 0,function*(){if(E.a.debug("handleOnBlur",e),e.target!==window)return;const[t,i]=yield Promise.all([he.getDeviceId(),he.createDeviceRecord(this.context.appConfig.appId)]);yield this.notifySWToDeactivateSession(t,i,ue.b.Blur)})}upsertSession(e,t,i){return Object(d.a)(this,void 0,void 0,function*(){const n=this.notifySWToUpsertSession(e,t,i);this.context.environmentInfo.isBrowserAndSupportsServiceWorkers||this.context.environmentInfo.isUsingSubscriptionWorkaround?this.context.environmentInfo.canTalkToServiceWorker?this.setupSessionEventListeners():(this.onSessionSent=i===ue.b.PlayerCreate,OneSignal.emitter.emit(OneSignal.EVENTS.SESSION_STARTED)):this.context.environmentInfo.isBrowserAndSupportsServiceWorkers||this.context.environmentInfo.isUsingSubscriptionWorkaround||(this.onSessionSent=i===ue.b.PlayerCreate,OneSignal.emitter.emit(OneSignal.EVENTS.SESSION_STARTED)),yield n})}setupSessionEventListeners(){this.context.environmentInfo.isBrowserAndSupportsServiceWorkers||this.context.environmentInfo.isUsingSubscriptionWorkaround?this.context.environmentInfo.canTalkToServiceWorker?(this.setupOnFocusAndOnBlurForSession(),OneSignal.cache.isVisibilityChangeEventSetup||(document.addEventListener("visibilitychange",this.handleVisibilityChange.bind(this),!0),OneSignal.cache.isVisibilityChangeEventSetup=!0),OneSignal.cache.isBeforeUnloadEventSetup||(window.addEventListener("beforeunload",e=>{this.handleOnBeforeUnload(),delete e.returnValue},!0),OneSignal.cache.isBeforeUnloadEventSetup=!0)):E.a.debug("Not setting session event listeners. Can't talk to ServiceWorker due being hosted on an HTTP page."):E.a.debug("Not setting session event listeners. No service worker possible.")}setupOnFocusAndOnBlurForSession(){E.a.debug("setupOnFocusAndOnBlurForSession"),OneSignal.cache.focusHandler||(OneSignal.cache.focusHandler=this.handleOnFocus.bind(this)),OneSignal.cache.isFocusEventSetup||(window.addEventListener("focus",OneSignal.cache.focusHandler,!0),OneSignal.cache.isFocusEventSetup=!0),OneSignal.cache.blurHandler||(OneSignal.cache.blurHandler=this.handleOnBlur.bind(this)),OneSignal.cache.isBlurEventSetup||(window.addEventListener("blur",OneSignal.cache.blurHandler,!0),OneSignal.cache.isBlurEventSetup=!0)}static setupSessionEventListenersForHttp(){OneSignal.context&&OneSignal.context.sessionManager?OneSignal.context.sessionManager.setupSessionEventListeners():E.a.error("OneSignal.context not available for http to setup session event listeners.")}sendOnSessionUpdateFromPage(e){return Object(d.a)(this,void 0,void 0,function*(){if(this.onSessionSent)return;if(!this.context.pageViewManager.isFirstPageView())return;if(!(yield this.context.subscriptionManager.isAlreadyRegisteredWithOneSignal()))return void E.a.debug("Not sending the on session because user is not registered with OneSignal (no device id)");const t=yield he.getDeviceId();if(e||(e=yield he.createDeviceRecord(this.context.appConfig.appId)),e.subscriptionState===Q.Subscribed||!0===OneSignal.config.enableOnSession){try{const i=yield Ot.updateUserSession(t,e);if(this.onSessionSent=!0,i!==t){const e=yield w.a.getSubscription();e.deviceId=i,yield w.a.setSubscription(e)}}catch(e){E.a.error(`Failed to update user session. Error "${e.message}" ${e.stack}`)}yield this.context.secondaryChannelManager.synchronizer.onSession()}})}}class pi{static convertTagsApiToBooleans(e){const t={};return Object.keys(e).forEach(i=>{t[i]="1"===e[i]}),t}static convertTagsBooleansToApi(e){const t={};return Object.keys(e).forEach(i=>{t[i]=!0===e[i]?"1":"0"}),t}static getObjectDifference(e,t){const i={};return Object.keys(e).forEach(n=>{t[n]!==e[n]&&(i[n]=e[n])}),i}static markAllTagsAsSpecified(e,t){e.forEach(e=>{e.checked=t})}static isTagObjectEmpty(e){return 0===Object.keys(e).length}static getCheckedTagCategories(e,t){if(!t)return e;if(pi.isTagObjectEmpty(t)){const t=Object(K.h)(e);return pi.markAllTagsAsSpecified(t,!0),t}return Object(K.h)(e).map(e=>{const i=t[e.tag];return e.checked=pi.getCheckedStatusForTagValue(i),e})}static getCheckedStatusForTagValue(e){return void 0===e||e}static limitCategoriesToMaxCount(e,t){let i=Object(K.h)(e);return i=e.slice(0,t)}}class mi{constructor(e){this.tagsFromTaggingContainer={},this.remoteTags={},this.context=e}sendTags(){return Object(d.a)(this,void 0,void 0,function*(){E.a.info("Category Slidedown Local Tags:",this.tagsFromTaggingContainer);const e=pi.convertTagsBooleansToApi(this.tagsFromTaggingContainer),t=pi.getObjectDifference(e,this.remoteTags);return pi.isTagObjectEmpty(t)?(E.a.warn("OneSignal: no change detected in Category preferences. Skipping tag update."),t):yield OneSignal.sendTags(t)})}storeTagValuesToUpdate(e){this.tagsFromTaggingContainer=e}storeRemotePlayerTags(e){this.context.tagManager.remoteTags=e}}class bi{mount(e,t){const i=this.generateHtml(e,t);Object(K.l)(`#${R.body}`).appendChild(i),this.taggingContainer&&this.taggingContainer.addEventListener("change",this.toggleCheckedTag);const n=Object(K.l)(`#${R.allowButton}`);n.disabled=!1,Object(K.v)(n,"disabled"),Object(K.w)(`#${R.loadingContainer}`)}load(){const e=Object(K.l)(`#${R.loadingContainer}`),t=Object(K.l)(`#${R.allowButton}`),i=document.createElement("div");Object(K.a)(e,`${j.loadingContainer}`),Object(K.a)(i,W.loadingMessage),Object(K.a)(t,"disabled"),Object(K.b)(e,"beforeend",Jt(F.greyLoadingIndicator)),i.innerText=H.fetchingPreferences,e.appendChild(i),t.disabled=!0}generateHtml(e,t){const i=pi.getCheckedTagCategories(e,t),n=i.filter(e=>i.indexOf(e)%2==0),o=i.filter(e=>i.indexOf(e)%2),s=document.createElement("div"),r=document.createElement("div"),a=document.createElement("div");return Object(K.a)(s,W.taggingContainerCol),Object(K.a)(r,W.taggingContainerCol),Object(K.a)(a,W.taggingContainer),a.id=B.taggingContainer,n.forEach(e=>{s.appendChild(this.getCategoryLabelElement(e))}),o.forEach(e=>{r.appendChild(this.getCategoryLabelElement(e))}),a.appendChild(s),a.appendChild(r),a}getCategoryLabelElement(e){const{label:t}=e,i=document.createElement("label"),n=document.createElement("span"),o=document.createElement("input"),s=document.createElement("span"),r=document.createElement("div"),a=document.createElement("div");return Object(K.a)(i,W.categoryLabel),Object(K.a)(n,W.categoryLabelText),Object(K.a)(o,W.categoryLabelInput),Object(K.a)(s,W.checkmark),i.title=t,n.innerText=t,o.type="checkbox",o.value=e.tag,o.checked=!!e.checked,i.appendChild(n),i.appendChild(o),i.appendChild(s),r.setAttribute("style","clear:both"),a.appendChild(i),a.appendChild(r),a}get taggingContainer(){const e=`#${R.body} > div.${W.taggingContainer}`;return Object(K.l)(e)}toggleCheckedTag(e){const t=e.target;if(t&&"checkbox"===t.getAttribute("type")){const e=t.checked;t.setAttribute("checked",e.toString())}}static getValuesFromTaggingContainer(){const e=`#${R.body} > div.${W.taggingContainer}`+"> div > div > label > input[type=checkbox]",t={};return document.querySelectorAll(e).forEach(e=>{t[e.value]=e.checked}),t}}class fi extends p.a{constructor(e){super(`The permission message of type ${e||"unknown"} was previously dismissed.`),Object.setPrototypeOf(this,fi.prototype)}}class Si{constructor(e){this.message=e}show(){return Object(d.a)(this,void 0,void 0,function*(){const e=document.createElement("div"),t=document.createElement("p");t.innerText=this.message,e.appendChild(t);const i=document.createElement("div"),n=document.createElement("div");i.id=R.container,e.id=D.toastText,Object(K.a)(e,_.toastText),Object(K.a)(i,j.container),Object(K.a)(i,j.reset),Object(K.l)("body").appendChild(i),n.id=R.dialog,Object(K.a)(n,j.dialog),n.appendChild(e),this.container.appendChild(n),Object(K.a)(this.container,g.a.mobile?j.slideUp:j.slideDown),Si.triggerSlidedownEvent(Si.EVENTS.SHOWN)})}static triggerSlidedownEvent(e){return Object(d.a)(this,void 0,void 0,function*(){yield S.a.trigger(e)})}close(){Object(K.a)(this.container,j.closeSlidedown),Object(K.u)(this.dialog,"animationend",(e,t)=>{e.target!==this.dialog||"slideDownExit"!==e.animationName&&"slideUpExit"!==e.animationName||(Object(K.w)(`#${R.container}`),t())},!0)}get container(){return Object(K.l)(`#${R.container}`)}get dialog(){return Object(K.l)(`#${R.dialog}`)}static get EVENTS(){return{SHOWN:"toastShown",CLOSED:"toastClosed"}}}class vi extends p.a{constructor(){super("This operation can only be performed when the user is not subscribed."),Object.setPrototypeOf(this,vi.prototype)}}class Oi extends p.a{constructor(e){super(`This operation can only be performed when the channel '${e}' does not yet exist.`),Object.setPrototypeOf(this,Oi.prototype)}}class yi{constructor(e,t){this.secondaryChannelManager=t,this.context=e,this.slidedownQueue=[],this.isSlidedownShowing=!1}checkIfSlidedownShouldBeShown(e){return Object(d.a)(this,void 0,void 0,function*(){var t;const i=(yield OneSignal.privateGetNotificationPermission())===y.Denied,n=yield OneSignal.privateIsPushNotificationsEnabled(),o=yield OneSignal.privateGetSubscription();let s;const a=null===(t=e.slidedownPromptOptions)||void 0===t?void 0:t.type;let c=!1;if(a&&(c=C.isSlidedownPushDependent(a)),c){if(n)return!!e.isInUpdateMode||(E.a.info(new vi),!1);if(s=We.wasPromptOfTypeDismissed(Ee.Push),!o)throw new b(r.OptedOut);if(i)return E.a.info(new ce(oe.Blocked)),!1}else{if(!e.force){const e=!!(yield w.a.getSMSProfile()).subscriptionId,t=!!(yield w.a.getEmailProfile()).subscriptionId,i=e&&t;if(e&&a===O.Sms)return E.a.info(new Oi(O.Sms)),!1;if(t&&a===O.Email)return E.a.info(new Oi(O.Email)),!1;if(i&&a===O.SmsAndEmail)return E.a.info(new Oi(O.SmsAndEmail)),!1}s=We.wasPromptOfTypeDismissed(Ee.NonPush)}return!(s&&!e.force&&!e.isInUpdateMode)||(E.a.info(new fi(a)),!1)})}registerForPush(){const e={autoAccept:!OneSignal.environmentInfo.requiresUserInteraction,slidedown:!0};Xe.registerForPushNotifications(e)}handleAllowForCategoryType(){return Object(d.a)(this,void 0,void 0,function*(){const e=bi.getValuesFromTaggingContainer();this.context.tagManager.storeTagValuesToUpdate(e),k.getIsPushNotificationsEnabled()?(OneSignal.slidedown.setSaveState(),yield this.context.tagManager.sendTags(!0)):this.registerForPush()})}handleAllowForEmailType(){return Object(d.a)(this,void 0,void 0,function*(){const e=OneSignal.slidedown.channelCaptureContainer.emailInputFieldIsValid,t=OneSignal.slidedown.channelCaptureContainer.isEmailInputFieldEmpty();if(!e||t)throw new ii(Xt.InvalidEmail);const i=OneSignal.slidedown.channelCaptureContainer.getValueFromEmailInput();this.updateEmail(i)})}handleAllowForSmsType(){return Object(d.a)(this,void 0,void 0,function*(){const e=OneSignal.slidedown.channelCaptureContainer.smsInputFieldIsValid,t=OneSignal.slidedown.channelCaptureContainer.isSmsInputFieldEmpty();if(!e||t)throw new ii(Xt.InvalidSms);const i=OneSignal.slidedown.channelCaptureContainer.getValueFromSmsInput();this.updateSMS(i)})}handleAllowForSmsAndEmailType(){return Object(d.a)(this,void 0,void 0,function*(){const e=OneSignal.slidedown.channelCaptureContainer.smsInputFieldIsValid,t=OneSignal.slidedown.channelCaptureContainer.emailInputFieldIsValid,i=OneSignal.slidedown.channelCaptureContainer.isEmailInputFieldEmpty(),n=OneSignal.slidedown.channelCaptureContainer.isSmsInputFieldEmpty();if(!e&&!t||i&&n)throw new ii(Xt.InvalidEmailAndSms);const o=OneSignal.slidedown.channelCaptureContainer.getValueFromEmailInput(),s=OneSignal.slidedown.channelCaptureContainer.getValueFromSmsInput();if(!t)throw new ii(Xt.InvalidEmail);if(i||this.updateEmail(o),!e)throw new ii(Xt.InvalidSms);n||this.updateSMS(s)})}updateEmail(e){this.secondaryChannelManager.email.setIdentifier(e)}updateSMS(e){this.secondaryChannelManager.sms.setIdentifier(e)}showConfirmationToast(){return Object(d.a)(this,void 0,void 0,function*(){const{confirmMessage:e}=OneSignal.slidedown.options.text;yield ui(1e3);const t=new Si(e);yield t.show(),yield ui(5e3),t.close(),Si.triggerSlidedownEvent(Si.EVENTS.CLOSED)})}mountAuxiliaryContainers(e){return Object(d.a)(this,void 0,void 0,function*(){var t;switch(null===(t=e.slidedownPromptOptions)||void 0===t?void 0:t.type){case O.Category:this.mountTaggingContainer(e);break;case O.Email:case O.Sms:case O.SmsAndEmail:yield this.mountChannelCaptureContainer(e)}})}mountTaggingContainer(e){return Object(d.a)(this,void 0,void 0,function*(){var t;I.a.logMethodCall("mountTaggingContainer");try{let i={};const n=new bi,o=null===(t=e.slidedownPromptOptions)||void 0===t?void 0:t.categories;if(!o)throw new Error("Categories not defined");if(e.isInUpdateMode){n.load();const e=yield OneSignal.getTags();this.context.tagManager.storeRemotePlayerTags(e),i=pi.convertTagsApiToBooleans(e)}else pi.markAllTagsAsSpecified(o,!0);n.mount(o,i)}catch(e){E.a.error("OneSignal: Attempted to create tagging container with error",e)}})}mountChannelCaptureContainer(e){return Object(d.a)(this,void 0,void 0,function*(){I.a.logMethodCall("mountChannelCaptureContainer");try{if(e.slidedownPromptOptions){const t=new ti(e.slidedownPromptOptions);t.mount(),OneSignal.slidedown.channelCaptureContainer=t}}catch(e){E.a.error("OneSignal: Attempted to create channel capture container with error",e)}})}handleAllowClick(){return Object(d.a)(this,void 0,void 0,function*(){const{slidedown:e}=OneSignal,t=e.options.type;e.isShowingFailureState&&e.removeFailureState();try{switch(t){case O.Push:this.registerForPush();break;case O.Category:yield this.handleAllowForCategoryType();break;case O.Email:yield this.handleAllowForEmailType();break;case O.Sms:yield this.handleAllowForSmsType();break;case O.SmsAndEmail:yield this.handleAllowForSmsAndEmailType()}}catch(t){return E.a.warn("OneSignal Slidedown failed to update:",t),e.removeSaveState(),e.setFailureState(),void(void 0!==t.reason&&e.setFailureStateForInvalidChannelInput(t.reason))}switch(e&&(e.close(),C.isSlidedownPushDependent(t)||(yield this.showConfirmationToast()),yield ui(1e3),ni.triggerSlidedownEvent(ni.EVENTS.CLOSED)),t){case O.Push:case O.Category:E.a.debug("Setting flag to not show the slidedown to the user again."),We.markPromptDismissedWithType(Ee.Push);break;default:E.a.debug("Setting flag to not show the slidedown to the user again."),We.markPromptDismissedWithType(Ee.NonPush)}})}setIsSlidedownShowing(e){this.isSlidedownShowing=e}showQueued(){return Object(d.a)(this,void 0,void 0,function*(){if(this.slidedownQueue.length>0){const e=this.dequeue();e&&(yield this.createSlidedown(e))}})}enqueue(e){this.slidedownQueue.push(e),ni.triggerSlidedownEvent(ni.EVENTS.QUEUED)}dequeue(){return this.slidedownQueue.shift()}createSlidedown(e){return Object(d.a)(this,void 0,void 0,function*(){I.a.logMethodCall("createSlidedown");try{if(!(yield this.checkIfSlidedownShouldBeShown(e)))return}catch(e){return void E.a.warn("checkIfSlidedownShouldBeShown returned an error",e)}if(function(){const e=OneSignal.notifyButton;e&&e.options.enable&&"hidden"!==OneSignal.notifyButton.launcher.state&&OneSignal.notifyButton.launcher.waitUntilShown().then(()=>{OneSignal.notifyButton.launcher.hide()}),OneSignal.emitter.once(ni.EVENTS.CLOSED,()=>{OneSignal.notifyButton&&OneSignal.notifyButton.options.enable&&OneSignal.notifyButton.launcher.show()})}(),this.isSlidedownShowing)this.enqueue(e);else try{this.setIsSlidedownShowing(!0);const t=e.slidedownPromptOptions||Yt;OneSignal.slidedown=new ni(t),yield OneSignal.slidedown.create(e.isInUpdateMode),yield this.mountAuxiliaryContainers(e),E.a.debug("Showing OneSignal Slidedown"),ni.triggerSlidedownEvent(ni.EVENTS.SHOWN)}catch(e){E.a.error("There was an error showing the OneSignal Slidedown:",e),this.setIsSlidedownShowing(!1),OneSignal.slidedown.close()}})}}class wi{constructor(e){this.appConfig=e,"undefined"!=typeof OneSignal&&OneSignal.environmentInfo&&(this.environmentInfo=OneSignal.environmentInfo),this.secondaryChannelManager=new Bt,this.subscriptionManager=$t.getSubscriptionManager(this),this.serviceWorkerManager=$t.getServiceWorkerManager(this),this.pageViewManager=new et,this.permissionManager=new A,this.workerMessenger=new ye(this),this.updateManager=new Gt(this),this.sessionManager=new hi(this),this.tagManager=new mi(this),this.slidedownManager=new yi(this,this.secondaryChannelManager),this.promptsManager=new gi(this),this.dynamicResourceLoader=new we,this.metricsManager=new Qe(e.metrics.enable,e.metrics.mixpanelReportingToken)}}!function(e){e.TypicalSite="typical",e.WordPress="wordpress",e.Shopify="shopify",e.Blogger="blogger",e.Magento="magento",e.Drupal="drupal",e.SquareSpace="squarespace",e.Joomla="joomla",e.Weebly="weebly",e.Wix="wix",e.Custom="custom"}(oi||(oi={})),function(e){e.Exact="exact",e.Origin="origin"}(si||(si={})),function(e){e.Navigate="navigate",e.Focus="focus"}(ri||(ri={}));class Ei{static upgradeConfigToVersionTwo(e){var t,i,n;Ei.isPromptOptionsVersion0(e.promptOptions)&&(e.promptOptions=Ei.convertConfigToVersionOne(e.promptOptions)),Ei.isSlidedownConfigVersion1(null===(t=e.promptOptions)||void 0===t?void 0:t.slidedown)&&(null===(i=e.promptOptions)||void 0===i?void 0:i.slidedown)&&(e.promptOptions.slidedown=Ei.convertConfigToVersionTwo(null===(n=e.promptOptions)||void 0===n?void 0:n.slidedown))}static convertConfigToVersionOne(e){e.slidedown||(e.slidedown={});const{acceptButtonText:t,cancelButtonText:i,actionMessage:n}=e.slidedown,o=e.acceptButtonText||e.acceptButton,s=e.cancelButtonText||e.cancelButton;return e.slidedown.acceptButtonText=t||o,e.slidedown.cancelButtonText=i||s,e.slidedown.actionMessage=n||e.actionMessage,e}static convertConfigToVersionTwo(e){var t,i,n,o;const s=C.isCategorySlidedownConfiguredVersion1(e)?O.Category:O.Push;let r,a;return s===O.Category&&(r=null===(t=e.categories)||void 0===t?void 0:t.positiveUpdateButton,a=null===(i=e.categories)||void 0===i?void 0:i.negativeUpdateButton),{prompts:[...e.prompts||[],{type:s,autoPrompt:e.autoPrompt,text:{actionMessage:e.actionMessage,acceptButton:e.acceptButton||e.acceptButtonText,cancelButton:e.cancelButton||e.cancelButtonText,positiveUpdateButton:r,negativeUpdateButton:a,updateMessage:null===(n=null===e||void 0===e?void 0:e.categories)||void 0===n?void 0:n.updateMessage},delay:{pageViews:e.pageViews,timeDelay:e.timeDelay},categories:null===(o=null===e||void 0===e?void 0:e.categories)||void 0===o?void 0:o.tags}]}}static isPromptOptionsVersion0(e){if(e){const t=["acceptButtonText","cancelButtonText","actionMessage"];for(let i=0;i{var t,i,n,o,s,r,a,c,l;if(e.type=ae.b.getValueOrDefault(e.type,O.Push),e.type===O.Category&&(e.text=Object.assign(Object.assign({},e.text),{positiveUpdateButton:ae.b.getValueOrDefault(null===(t=e.text)||void 0===t?void 0:t.positiveUpdateButton,Kt.categoryDefaults.positiveUpdateButton),negativeUpdateButton:ae.b.getValueOrDefault(null===(i=e.text)||void 0===i?void 0:i.negativeUpdateButton,Kt.categoryDefaults.negativeUpdateButton),updateMessage:ae.b.getValueOrDefault(null===(n=e.text)||void 0===n?void 0:n.updateMessage,Kt.categoryDefaults.updateMessage)})),e.text=Object.assign(Object.assign({},e.text),{actionMessage:ae.b.getValueOrDefault(null===(o=e.text)||void 0===o?void 0:o.actionMessage,Kt.actionMessage),acceptButton:ae.b.getValueOrDefault(null===(s=e.text)||void 0===s?void 0:s.acceptButton,Kt.acceptButton),cancelButton:ae.b.getValueOrDefault(null===(r=e.text)||void 0===r?void 0:r.cancelButton,Kt.cancelButton),confirmMessage:ae.b.getValueOrDefault(null===(a=e.text)||void 0===a?void 0:a.confirmMessage,Kt.confirmMessage)}),e.autoPrompt=ae.b.getValueOrDefault(e.autoPrompt,!0),e.delay={pageViews:ae.b.getValueOrDefault(null===(c=e.delay)||void 0===c?void 0:c.pageViews,qt.pageViews),timeDelay:ae.b.getValueOrDefault(null===(l=e.delay)||void 0===l?void 0:l.timeDelay,qt.timeDelay)},e.categories){const{categories:t}=e;e.categories=pi.limitCategoriesToMaxCount(t,Ii)}return e}):(c.slidedown={prompts:[]},c.slidedown.prompts=[Yt]),c.native?(c.native.enabled=!!c.native.enabled,c.native.autoPrompt=c.native.hasOwnProperty("autoPrompt")?!!c.native.enabled&&!!c.native.autoPrompt:!!c.native.enabled,c.native.pageViews=ae.b.getValueOrDefault(c.native.pageViews,qt.pageViews),c.native.timeDelay=ae.b.getValueOrDefault(c.native.timeDelay,qt.timeDelay)):c.native={enabled:!1,autoPrompt:!1,pageViews:qt.pageViews,timeDelay:qt.timeDelay},!0===i.autoRegister)if(n){c.native.enabled=!1,c.native.autoPrompt=!1;const e={actionMessage:Kt.actionMessage,acceptButton:Kt.acceptButton,cancelButton:Kt.cancelButton};c.slidedown.prompts=[{type:O.Push,autoPrompt:!0,text:e}]}else c.native.enabled=!0,c.native.autoPrompt=!0;return c.autoPrompt=c.native.autoPrompt||C.isSlidedownAutoPromptConfigured(c.slidedown.prompts),c}static getPromptOptionsForDashboardConfiguration(e){const t=e.config.staticPrompts,i=t.native?{enabled:t.native.enabled,autoPrompt:t.native.enabled&&!1!==t.native.autoPrompt,pageViews:ae.b.getValueOrDefault(t.native.pageViews,qt.pageViews),timeDelay:ae.b.getValueOrDefault(t.native.timeDelay,qt.timeDelay)}:{enabled:!1,autoPrompt:!1,pageViews:qt.pageViews,timeDelay:qt.timeDelay},{prompts:n}=t.slidedown;return{autoPrompt:i.autoPrompt||C.isSlidedownAutoPromptConfigured(n),native:i,slidedown:{prompts:n},fullscreen:{enabled:t.fullscreen.enabled,actionMessage:t.fullscreen.actionMessage,acceptButton:t.fullscreen.acceptButton,cancelButton:t.fullscreen.cancelButton,title:t.fullscreen.title,message:t.fullscreen.message,caption:t.fullscreen.caption,autoAcceptTitle:t.fullscreen.autoAcceptTitle},customlink:this.getCustomLinkConfig(e)}}static getUserConfigForConfigIntegrationKind(e,t,i,n=!1){switch(this.getIntegrationCapabilities(e).configuration){case ai.Dashboard:return{appId:i.app_id,autoRegister:!1,autoResubscribe:i.config.autoResubscribe,path:i.config.serviceWorker.path,serviceWorkerPath:i.config.serviceWorker.workerName,serviceWorkerParam:{scope:i.config.serviceWorker.registrationScope},subdomainName:i.config.siteInfo.proxyOrigin,promptOptions:this.getPromptOptionsForDashboardConfiguration(i),welcomeNotification:{disable:!i.config.welcomeNotification.enable,title:i.config.welcomeNotification.title,message:i.config.welcomeNotification.message,url:i.config.welcomeNotification.url},notifyButton:{enable:i.config.staticPrompts.bell.enabled,displayPredicate:i.config.staticPrompts.bell.hideWhenSubscribed?()=>OneSignal.isPushNotificationsEnabled().then(e=>!e):null,size:i.config.staticPrompts.bell.size,position:i.config.staticPrompts.bell.location,showCredit:!1,offset:{bottom:`${i.config.staticPrompts.bell.offset.bottom}px`,left:`${i.config.staticPrompts.bell.offset.left}px`,right:`${i.config.staticPrompts.bell.offset.right}px`},colors:{"circle.background":i.config.staticPrompts.bell.color.main,"circle.foreground":i.config.staticPrompts.bell.color.accent,"badge.background":"black","badge.foreground":"white","badge.bordercolor":"black","pulse.color":i.config.staticPrompts.bell.color.accent,"dialog.button.background.hovering":i.config.staticPrompts.bell.color.main,"dialog.button.background.active":i.config.staticPrompts.bell.color.main,"dialog.button.background":i.config.staticPrompts.bell.color.main,"dialog.button.foreground":"white"},text:{"tip.state.unsubscribed":i.config.staticPrompts.bell.tooltip.unsubscribed,"tip.state.subscribed":i.config.staticPrompts.bell.tooltip.subscribed,"tip.state.blocked":i.config.staticPrompts.bell.tooltip.blocked,"message.prenotify":i.config.staticPrompts.bell.tooltip.unsubscribed,"message.action.subscribing":i.config.staticPrompts.bell.message.subscribing,"message.action.subscribed":i.config.staticPrompts.bell.message.subscribing,"message.action.resubscribed":i.config.staticPrompts.bell.message.subscribing,"message.action.unsubscribed":i.config.staticPrompts.bell.message.unsubscribing,"dialog.main.title":i.config.staticPrompts.bell.dialog.main.title,"dialog.main.button.subscribe":i.config.staticPrompts.bell.dialog.main.subscribeButton,"dialog.main.button.unsubscribe":i.config.staticPrompts.bell.dialog.main.unsubscribeButton,"dialog.blocked.title":i.config.staticPrompts.bell.dialog.blocked.title,"dialog.blocked.message":i.config.staticPrompts.bell.dialog.blocked.message}},persistNotification:i.config.notificationBehavior?i.config.notificationBehavior.display.persist:void 0,webhooks:{cors:i.config.webhooks.corsEnable,"notification.displayed":i.config.webhooks.notificationDisplayedHook,"notification.clicked":i.config.webhooks.notificationClickedHook,"notification.dismissed":i.config.webhooks.notificationDismissedHook},notificationClickHandlerMatch:i.config.notificationBehavior?i.config.notificationBehavior.click.match:void 0,notificationClickHandlerAction:i.config.notificationBehavior?i.config.notificationBehavior.click.action:void 0,allowLocalhostAsSecureOrigin:i.config.setupBehavior?i.config.setupBehavior.allowLocalhostAsSecureOrigin:void 0,requiresUserPrivacyConsent:t.requiresUserPrivacyConsent,outcomes:{direct:i.config.outcomes.direct,indirect:{enabled:i.config.outcomes.indirect.enabled,influencedTimePeriodMin:i.config.outcomes.indirect.notification_attribution.minutes_since_displayed,influencedNotificationsLimit:i.config.outcomes.indirect.notification_attribution.limit},unattributed:i.config.outcomes.unattributed}};case ai.JavaScript:const o="undefined"!=typeof OneSignal&&!!OneSignal.SERVICE_WORKER_PARAM,s="undefined"!=typeof OneSignal&&!!OneSignal.SERVICE_WORKER_PATH,r=o?OneSignal.SERVICE_WORKER_PARAM:{scope:"/"},a=s?OneSignal.SERVICE_WORKER_PATH:"OneSignalSDKWorker.js",c=Object.assign(Object.assign(Object.assign(Object.assign({},t),{promptOptions:this.injectDefaultsIntoPromptOptions(t.promptOptions,i.config.staticPrompts,t,n)}),{serviceWorkerParam:t.serviceWorkerParam?t.serviceWorkerParam:r,serviceWorkerPath:t.serviceWorkerPath?t.serviceWorkerPath:a,path:t.path?t.path:"/"}),{outcomes:{direct:i.config.outcomes.direct,indirect:{enabled:i.config.outcomes.indirect.enabled,influencedTimePeriodMin:i.config.outcomes.indirect.notification_attribution.minutes_since_displayed,influencedNotificationsLimit:i.config.outcomes.indirect.notification_attribution.limit},unattributed:i.config.outcomes.unattributed}});return t.hasOwnProperty("autoResubscribe")?c.autoResubscribe=!!t.autoResubscribe:t.hasOwnProperty("autoRegister")?c.autoResubscribe=!!t.autoRegister:c.autoResubscribe=!!i.config.autoResubscribe,c}}static getSubdomainForConfigIntegrationKind(e,t,i){const n=this.getIntegrationCapabilities(e),o=t.subdomainName;let s="";switch(n.configuration){case ai.Dashboard:s=i.config.siteInfo.proxyOriginEnabled?i.config.siteInfo.proxyOrigin:void 0;break;case ai.JavaScript:s=i.config.subdomain}return s&&!this.shouldUseServerConfigSubdomain(o,n)?void 0:s}static shouldUseServerConfigSubdomain(e,t){switch(t.configuration){case ai.Dashboard:return!0;case ai.JavaScript:switch(location.protocol){case"https:":return!!e;case"http:":return!0;default:return!1}}}}class Ci{getAppConfig(e){return Object(d.a)(this,void 0,void 0,function*(){return yield Pi.getAppConfig(e,yt.downloadServerAppConfig)})}getMergedConfig(e,t){return Pi.getMergedConfig(e,t)}}class Ti{constructor(e){this.options={appId:e.appId,subdomain:e.subdomainName,origin:e.origin,siteName:e.siteName,metrics:{enable:!1,mixpanelReportingToken:null},userConfig:{}}}initialize(){return Object(d.a)(this,void 0,void 0,function*(){if((window.opener||window.parent)==window)return document.write("OneSignal: This page cannot be directly opened, and must be opened as a result of a subscription call."),Promise.resolve();const e=Object.assign({},this.options);e.appId=e.appId,e.subdomainName=e.subdomain,e.origin=e.origin,OneSignal.config=e||{};const t=yield(new Ci).getAppConfig(e);return OneSignal.environmentInfo=di.getEnvironmentInfo(),OneSignal.context=new wi(t),OneSignal.context.workerMessenger.listen(!0),OneSignal.initialized=!0,this.loadPromise={},this.loadPromise.promise=new Promise((e,t)=>{this.loadPromise.resolver=e,this.loadPromise.rejector=t}),this.establishCrossOriginMessaging(),this.loadPromise.promise})}establishCrossOriginMessaging(){}dispose(){this.messenger.destroy()}finishInitialization(){this.loadPromise.resolver()}subscribe(){return Object(d.a)(this,void 0,void 0,function*(){const e=k.getIsPushNotificationsEnabled(),t=opener||parent;e?t&&window.close():ge.registerForPush()})}}class Ai extends Ti{initialize(){const e=super.initialize();return S.a.trigger("httpInitialize"),e}establishCrossOriginMessaging(){this.messenger&&this.messenger.destroy(),this.messenger=new fe(window,this.options.origin,this.options.origin),this.messenger.on(OneSignal.POSTMAM_COMMANDS.CONNECTED,this.onMessengerConnect.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.IFRAME_POPUP_INITIALIZE,this.onProxyFrameInitializing.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION,this.onRemoteNotificationPermission.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_GET,this.onRemoteDatabaseGet.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_GET_ALL,this.onRemoteDatabaseGetAll.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_PUT,this.onRemoteDatabasePut.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_DATABASE_REMOVE,this.onRemoteDatabaseRemove.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_FROM_PUSH,this.onUnsubscribeFromPush.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.MARK_PROMPT_DISMISSED,this.onMarkPromptDismissed.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.IS_SUBSCRIBED,this.onIsSubscribed.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_PROXY_FRAME,this.onUnsubscribeProxyFrame.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.SERVICE_WORKER_STATE,this.onServiceWorkerState.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.GET_WORKER_VERSION,this.onWorkerVersion.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.SUBSCRIPTION_EXPIRATION_STATE,this.onSubscriptionExpirationState.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.PROCESS_EXPIRING_SUBSCRIPTIONS,this.onProcessExpiringSubscriptions.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.GET_SUBSCRIPTION_STATE,this.onGetSubscriptionState.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.SESSION_UPSERT,this.onSessionUpsert.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.SESSION_DEACTIVATE,this.onSessionDeactivate.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.ARE_YOU_VISIBLE_REQUEST,this.onAreYouVisibleRequest.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.ARE_YOU_VISIBLE_RESPONSE,this.onAreYouVisibleResponse.bind(this)),this.messenger.listen()}retriggerRemoteEvent(e,t){this.messenger.message(OneSignal.POSTMAM_COMMANDS.REMOTE_RETRIGGER_EVENT,{eventName:e,eventData:t})}onMessengerConnect(e){return Object(d.a)(this,void 0,void 0,function*(){return E.a.debug(`(${T.a.getWindowEnv().toString()}) Successfully established cross-origin communication.`),this.finishInitialization(),!1})}onProxyFrameInitializing(e){return Object(d.a)(this,void 0,void 0,function*(){E.a.info(`(${T.a.getWindowEnv().toString()}) The iFrame has just received initOptions from the host page!`);const t=Object.assign(Object.assign(Object.assign({},e.data.hostInitOptions),OneSignal.config),{pageUrl:e.data.pageUrl});if(OneSignal.config=t,Xe.installNativePromptPermissionChangedHook(),(yield w.a.get("Options","defaultUrl"))||(yield w.a.put("Options",{key:"defaultUrl",value:new URL(OneSignal.config.pageUrl).origin})),yield w.a.put("Options",{key:"lastKnownHostUrl",value:OneSignal.config.pageUrl}),yield Xe.initSaveState(),yield Xe.storeInitialValues(),yield Xe.saveInitOptions(),navigator.serviceWorker&&"https:"===window.location.protocol)try{OneSignal.context.serviceWorkerManager.establishServiceWorkerChannel()}catch(e){E.a.error("Error interacting with Service Worker inside an HTTP-hosted iFrame:",e)}e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE)})}onRemoteNotificationPermission(e){return Object(d.a)(this,void 0,void 0,function*(){const t=OneSignal.context,i=yield t.permissionManager.getReportedNotificationPermission(t.appConfig.safariWebId);return e.reply(i),!1})}onRemoteDatabaseGet(e){return Object(d.a)(this,void 0,void 0,function*(){const t=e.data,i=[];for(const e of t){const{table:t,key:n}=e;i.push(w.a.get(t,n))}const n=yield Promise.all(i);return e.reply(n),!1})}onRemoteDatabaseGetAll(e){return Object(d.a)(this,void 0,void 0,function*(){const t=e.data.table,i=yield w.a.getAll(t);return e.reply(i),!1})}onRemoteDatabasePut(e){return Object(d.a)(this,void 0,void 0,function*(){const t=e.data,i=[];for(const e of t){const{table:t,keypath:n}=e;i.push(w.a.put(t,n))}return yield Promise.all(i),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),!1})}onRemoteDatabaseRemove(e){return Object(d.a)(this,void 0,void 0,function*(){const t=e.data,i=[];for(const e of t){const{table:t,keypath:n}=e;i.push(w.a.remove(t,n))}return yield Promise.all(i),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),!1})}onUnsubscribeFromPush(e){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug("(Reposted from iFrame -> Host) User unsubscribed but permission granted. Re-prompting the user for push.");try{yield Object(K.z)(),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE)}catch(e){E.a.debug("Failed to unsubscribe from push remotely:",e)}})}onMarkPromptDismissed(e){return Object(d.a)(this,void 0,void 0,function*(){return E.a.debug("(Reposted from iFrame -> Host) Marking prompt as dismissed."),yield We.markPromptDismissedWithType(Ee.Push),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),!1})}onIsSubscribed(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield OneSignal.isPushNotificationsEnabled();return e.reply(t),!1})}onUnsubscribeProxyFrame(e){return Object(d.a)(this,void 0,void 0,function*(){return(yield OneSignal.isPushNotificationsEnabled())&&(yield OneSignal.setSubscription(!1),yield OneSignal.database.rebuild()),e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),!1})}onServiceWorkerState(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield OneSignal.context.serviceWorkerManager.getActiveState();return e.reply(t),!1})}onWorkerVersion(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield OneSignal.context.serviceWorkerManager.getWorkerVersion();return e.reply(t),!1})}onSubscriptionExpirationState(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield OneSignal.context.subscriptionManager.isSubscriptionExpiring();return e.reply(t),!1})}onProcessExpiringSubscriptions(e){return Object(d.a)(this,void 0,void 0,function*(){OneSignal.context,yield Xe.processExpiringSubscriptions();return e.reply(OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE),!1})}onGetSubscriptionState(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield OneSignal.context.subscriptionManager.getSubscriptionState();return e.reply(t),!1})}onSessionUpsert(e){return Object(d.a)(this,void 0,void 0,function*(){const t=OneSignal.context,i=e.data;t.workerMessenger.directPostMessageToSW(pe.SessionUpsert,i),e.reply(!0)})}onSessionDeactivate(e){return Object(d.a)(this,void 0,void 0,function*(){const t=OneSignal.context,i=e.data;t.workerMessenger.directPostMessageToSW(pe.SessionDeactivate,i),e.reply(!0)})}onAreYouVisibleRequest(e){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug("onAreYouVisibleRequest iframe",e)})}onAreYouVisibleResponse(e){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug("onAreYouVisibleResponse iframe",e);const t=OneSignal.context,i=e.data;t.workerMessenger.directPostMessageToSW(pe.AreYouVisibleResponse,i),e.reply(!0)})}}class Mi extends Ti{constructor(e){super(e)}establishCrossOriginMessaging(){this.messenger&&this.messenger.destroy(),this.messenger=new fe(window.parent,this.options.origin,this.options.origin)}}class Ni extends Ti{constructor(e){super(e)}establishCrossOriginMessaging(){this.messenger=new fe(window.opener,this.options.origin,this.options.origin),this.messenger.once(OneSignal.POSTMAM_COMMANDS.CONNECTED,this.onMessengerConnected.bind(this)),this.messenger.postMessage(OneSignal.POSTMAM_COMMANDS.POPUP_BEGIN_MESSAGEPORT_COMMS,null),this.messenger.listen()}onMessengerConnected(e){E.a.debug(`(${T.a.getWindowEnv().toString()}) The host page is now ready to receive commands from the HTTP popup.`),this.finishInitialization()}}class xi{static initHttp(e){return Object(d.a)(this,void 0,void 0,function*(){switch(E.a.debug(`Called %cinitHttp(${JSON.stringify(e,null,4)})`,Object(K.k)("code")),T.a.getWindowEnv()){case X.a.OneSignalProxyFrame:OneSignal.proxyFrame=new Ai(e),yield OneSignal.proxyFrame.initialize(),ee.ensureBackwardsCompatibility(OneSignal);break;case X.a.OneSignalSubscriptionPopup:OneSignal.subscriptionPopup=new Ni(e),yield OneSignal.subscriptionPopup.initialize(),ee.ensureBackwardsCompatibility(OneSignal),S.a.trigger("httpInitialize");break;case X.a.OneSignalSubscriptionModal:OneSignal.subscriptionModal=new Mi(e),OneSignal.subscriptionModal.establishCrossOriginMessaging(),OneSignal.subscriptionModal.initialize(),ee.ensureBackwardsCompatibility(OneSignal),S.a.trigger("httpInitialize");break;default:E.a.error("Unsupported HTTP initialization branch.")}})}}var ki=i(14);class ji{constructor(e){this.url=e,this.url.pathname="webPushIframe"}static get LOAD_TIMEOUT_MS(){return 15e3}load(){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug("Opening an iFrame to",this.url.toString()),this.removeFrame();const e=document.createElement("iframe");return e.style.display="none",e.src=this.url.toString(),e.sandbox="allow-popups allow-popups-to-escape-sandbox allow-same-origin allow-scripts allow-top-navigation",this.loadPromise={},this.loadPromise.promise=new Promise((e,t)=>{this.loadPromise.resolver=e,this.loadPromise.rejector=t}),document.body.appendChild(e),e.onload=this.onFrameLoad.bind(this),this.element=e,Object(K.x)(this.loadPromise.promise,ji.LOAD_TIMEOUT_MS).catch(()=>{window===window.top&&E.a.warn(`OneSignal: Loading the required iFrame ${this.url.toString()} timed out. Check that the Site URL onesignal.com dashboard web config is ${location.origin}. Only the Site URL specified there is allowed to use load the iFrame.`)}),this.loadPromise.promise})}removeFrame(){if(!h.a.isBrowser())return;const e=document.querySelector(`iframe[src='${this.url.toString()}']`);e&&e.remove()}onFrameLoad(e){this.establishCrossOriginMessaging()}establishCrossOriginMessaging(){this.messenger&&this.messenger.destroy(),this.messenger=new fe(this.element.contentWindow,this.url.toString(),this.url.toString()),this.messenger.on(OneSignal.POSTMAM_COMMANDS.CONNECTED,this.onMessengerConnect.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_RETRIGGER_EVENT,this.onRemoteRetriggerEvent.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REMOTE_NOTIFICATION_PERMISSION_CHANGED,this.onRemoteNotificationPermissionChanged.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.REQUEST_HOST_URL,this.onRequestHostUrl.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.SERVICEWORKER_COMMAND_REDIRECT,this.onServiceWorkerCommandRedirect.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.GET_EVENT_LISTENER_COUNT,this.onGetEventListenerCount.bind(this)),this.messenger.on(OneSignal.POSTMAM_COMMANDS.ARE_YOU_VISIBLE_REQUEST,this.onAreYouVisibleRequest.bind(this)),this.messenger.connect()}dispose(){this.messenger&&this.messenger.destroy(),this.removeFrame()}onMessengerConnect(e){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug(`Successfully established cross-origin communication for iFrame at ${this.url.toString()}`),this.messenger.message(OneSignal.POSTMAM_COMMANDS.IFRAME_POPUP_INITIALIZE,{hostInitOptions:Object(K.h)(OneSignal.config),pageUrl:window.location.href},e=>(e.data===OneSignal.POSTMAM_COMMANDS.REMOTE_OPERATION_COMPLETE&&this.loadPromise.resolver(),!1))})}onRemoteRetriggerEvent(e){const{eventName:t,eventData:i}=e.data;return S.a.trigger(t,i,e.source),!1}onRemoteNotificationPermissionChanged(e){const{forceUpdatePermission:t}=e.data;return Object(K.y)(t),!1}onRequestHostUrl(e){return e.reply(location.href),!1}onServiceWorkerCommandRedirect(e){const t=e.data;return t&&t.startsWith("http")&&(window.location.href=t),!1}onGetEventListenerCount(e){const t=e.data;return E.a.debug("(Reposted from iFrame -> Host) Getting event listener count for ",t),e.reply(OneSignal.emitter.numberOfListeners(t)),!1}isSubscribed(){return new Promise(e=>{this.messenger.message(OneSignal.POSTMAM_COMMANDS.IS_SUBSCRIBED,null,t=>{e(t.data)})})}unsubscribeFromPush(){return new Promise(e=>{this.messenger.message(OneSignal.POSTMAM_COMMANDS.UNSUBSCRIBE_PROXY_FRAME,null,t=>{e()})})}getProxyServiceWorkerActiveState(){return new Promise((e,t)=>{this.message(OneSignal.POSTMAM_COMMANDS.SERVICE_WORKER_STATE,null,t=>{e(t.data)})})}runCommand(e,t=null){return Object(d.a)(this,void 0,void 0,function*(){return yield new Promise((i,n)=>{this.message(e,t,e=>{i(e.data)})})})}onAreYouVisibleRequest(e){E.a.debug("onAreYouVisibleRequest page",e);const t={timestamp:e.data.timestamp,focused:document.hasFocus()};this.message(OneSignal.POSTMAM_COMMANDS.ARE_YOU_VISIBLE_RESPONSE,t)}message(...e){this.messenger.message.apply(this.messenger,arguments)}}class _i{constructor(){}static discoverAltOrigin(e){return Object(d.a)(this,void 0,void 0,function*(){const t=_i.getOneSignalProxyIframeUrls(e),i=[];for(const e of t){const t=new ji(e);yield t.load(),i.push(t)}const n=yield _i.subscribedProxyFrameHosts(i);let o;yield _i.removeDuplicatedAltOriginSubscription(n),o=0===n.length?i[0]:n[0];for(const e of i)o!==e&&e.dispose();return o})}static subscribedProxyFrameHosts(e){return Object(d.a)(this,void 0,void 0,function*(){const t=[];for(const i of e)(yield i.isSubscribed())&&t.push(i);return t})}static removeDuplicatedAltOriginSubscription(e){return Object(d.a)(this,void 0,void 0,function*(){if(e.length<2)return;const t=e.slice(1);for(const e of t)yield e.unsubscribeFromPush()})}static getCanonicalSubscriptionUrls(e,t=T.a.getApiEnv()){const i=_i.getWildcardLegacySubscriptionDomain(t),n=new URL(`https://${e.subdomain}.${i}`);if(t!==ki.a.Production)return[n];const o=[new URL(`https://${e.subdomain}.os.tc`)];return e.httpUseOneSignalCom&&o.push(n),o}static getWildcardLegacySubscriptionDomain(e){const t=T.a.getOneSignalApiUrl(e);let i=2;return e===ki.a.Staging&&(i=3),ae.a.lastParts(t.host,".",i)}static getOneSignalProxyIframeUrls(e){const t=_i.getCanonicalSubscriptionUrls(e);for(const e of t)e.pathname="webPushIframe";return t}}var Di=i(24);class Ri{static isValidUrl(e,t){if(t&&t.allowNull&&null===e)return!0;if(t&&t.allowEmpty&&(null===e||void 0===e))return!0;try{const i=new URL(e);return!t||!t.requireHttps||"https:"===i.protocol}catch(e){return!1}}static isValidBoolean(e,t){return!(!t||!t.allowNull||null!==e)||(!0===e||!1===e)}static isValidArray(e,t){return!(!t||!t.allowNull||null!==e)||(!(!t||!t.allowEmpty||null!==e&&void 0!==e)||e instanceof Array)}}class Ui{static processItem(e,t){if("function"==typeof t)t();else{if(!Array.isArray(t))throw new p.a("Only accepts function and Array types!");{if(0==t.length)throw new p.a("Empty array is not valid!");const i=t.shift();if(null==i||void 0===i)throw new p.a("First element in array must be the OneSignal function name");const n=e[i.toString()];if("function"!=typeof n)throw new p.a(`No OneSignal function with the name '${i}'`);n.apply(e,t)}}}}class Wi{static throwIfInvalidAuthHashOptions(e,t){if(!e)return;const i=t.filter(t=>e.hasOwnProperty(t));if(i.length>1)throw E.a.error("More than one key provided, please only provide one!",i),new InvalidArgumentError.a("options",InvalidArgumentError.b.Malformed);const n=i[0],o=e[n];return o?(Wi.throwIfInvalidAuthHash(o,`options.${n}`),o):void 0}static throwIfInvalidAuthHash(e,t){if(e&&e.length!==Wi.VALID_AUTH_HASH_LENGTH)throw new InvalidArgumentError.a(t,InvalidArgumentError.b.Malformed)}}Wi.VALID_AUTH_HASH_LENGTH=64,i.d(t,"default",function(){return Bi});class Bi{static setDefaultNotificationUrl(e){return Object(d.a)(this,void 0,void 0,function*(){if(!Ri.isValidUrl(e,{allowNull:!0}))throw new InvalidArgumentError.a("url",InvalidArgumentError.b.Malformed);yield Object(K.c)(),Object(K.s)("setDefaultNotificationUrl",e);const t=yield w.a.getAppState();t.defaultNotificationUrl=e,yield w.a.setAppState(t)})}static setDefaultTitle(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),Object(K.s)("setDefaultTitle",e);const t=yield w.a.getAppState();t.defaultNotificationTitle=e,yield w.a.setAppState(t)})}static setEmail(e,t){return Object(d.a)(this,void 0,void 0,function*(){if(!e)throw new InvalidArgumentError.a("email",InvalidArgumentError.b.Empty);if(!Object(K.r)(e))throw new InvalidArgumentError.a("email",InvalidArgumentError.b.Malformed);const i=Wi.throwIfInvalidAuthHashOptions(t,["identifierAuthHash","emailAuthHash"]);return Object(K.s)("setEmail",e,t),yield Object(K.c)(),yield this.context.secondaryChannelManager.email.setIdentifier(e,i)})}static setSMSNumber(e,t){return Object(d.a)(this,void 0,void 0,function*(){if(!e)throw new InvalidArgumentError.a("smsNumber",InvalidArgumentError.b.Empty);const i=Wi.throwIfInvalidAuthHashOptions(t,["identifierAuthHash"]);return Object(K.s)("setSMSNumber",e,t),yield Object(K.c)(),yield this.context.secondaryChannelManager.sms.setIdentifier(e,i)})}static logoutEmail(){return Object(d.a)(this,void 0,void 0,function*(){return yield Object(K.c)(),yield this.context.secondaryChannelManager.email.logout()})}static logoutSMS(){return Object(d.a)(this,void 0,void 0,function*(){return yield Object(K.c)(),yield this.context.secondaryChannelManager.sms.logout()})}static isPushNotificationsSupported(){return Object(K.s)("isPushNotificationsSupported"),!0}static initializeConfig(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield(new Ci).getAppConfig(e);E.a.debug(`OneSignal: Final web app config: %c${JSON.stringify(t,null,4)}`,Object(K.k)("code")),Bi.config=t,Bi.environmentInfo=di.getEnvironmentInfo(),Bi.context=new wi(t),Bi.config=Bi.context.appConfig})}static init(e){return Object(d.a)(this,void 0,void 0,function*(){if(Object(K.s)("init"),yield Xe.polyfillSafariFetch(),Xe.errorIfInitAlreadyCalled(),yield Bi.initializeConfig(e),!Bi.config)throw new Error("OneSignal config not initialized!");if(!g.a.safari||Bi.config.safariWebId){if(Bi.config.userConfig.requiresUserPrivacyConsent){if(!(yield w.a.getProvideUserConsent()))return void(Bi.pendingInit=!0)}yield Bi.delayedInit()}else E.a.warn(new f(c.MissingSafariWebId))})}static delayedInit(){return Object(d.a)(this,void 0,void 0,function*(){function e(){return Object(d.a)(this,void 0,void 0,function*(){if(!Bi.__initAlreadyCalled){if(Bi.__initAlreadyCalled=!0,Bi.emitter.on(Bi.EVENTS.NATIVE_PROMPT_PERMISSIONCHANGED,J.onNotificationPermissionChange),Bi.emitter.on(Bi.EVENTS.SUBSCRIPTION_CHANGED,J._onSubscriptionChanged),Bi.emitter.on(Bi.EVENTS.SDK_INITIALIZED,Xe.onSdkInitialized),I.b.isUsingSubscriptionWorkaround()){if(!Bi.config||!Bi.config.subdomain)throw new f(c.MissingSubdomain);Bi.emitter.on(Bi.EVENTS.SESSION_STARTED,hi.setupSessionEventListenersForHttp),Bi.proxyFrameHost=yield _i.discoverAltOrigin(Bi.config)}window.addEventListener("focus",()=>{he.checkAndTriggerNotificationPermissionChanged()}),yield Xe.initSaveState(),yield Xe.saveInitOptions(),T.a.getWindowEnv()===X.a.CustomIframe?yield S.a.trigger(Bi.EVENTS.SDK_INITIALIZED):yield Xe.internalInit()}})}Bi.pendingInit=!1,Bi.context.workerMessenger.listen(),"complete"===document.readyState||"interactive"===document.readyState?yield e():(E.a.debug("OneSignal: Waiting for DOMContentLoaded or readyStateChange event before continuing initialization..."),window.addEventListener("DOMContentLoaded",()=>{e()}),document.onreadystatechange=(()=>{"complete"!==document.readyState&&"interactive"!==document.readyState||e()}))})}static provideUserConsent(e){return Object(d.a)(this,void 0,void 0,function*(){yield w.a.setProvideUserConsent(e),e&&Bi.pendingInit&&(yield Bi.delayedInit())})}static showHttpPermissionRequest(e){return Object(d.a)(this,void 0,void 0,function*(){E.a.debug("Called showHttpPermissionRequest(), redirecting to HTTP prompt."),Bi.showHttpPrompt(e).catch(e=>E.a.info(e))})}static showHttpPrompt(e){return Object(d.a)(this,void 0,void 0,function*(){yield Bi.showSlidedownPrompt(e)})}static showNativePrompt(){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),yield Bi.context.promptsManager.internalShowNativePrompt()})}static showSlidedownPrompt(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),yield Bi.context.promptsManager.internalShowParticularSlidedown(O.Push,e)})}static showCategorySlidedown(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)();const t=k.getIsPushNotificationsEnabled();yield Bi.context.promptsManager.internalShowCategorySlidedown(Object.assign(Object.assign({},e),{isInUpdateMode:t}))})}static showSmsSlidedown(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),yield Bi.context.promptsManager.internalShowSmsSlidedown(Object.assign({},e))})}static showEmailSlidedown(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),yield Bi.context.promptsManager.internalShowEmailSlidedown(Object.assign({},e))})}static showSmsAndEmailSlidedown(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),yield Bi.context.promptsManager.internalShowSmsAndEmailSlidedown(Object.assign({},e))})}static registerForPushNotifications(e){return Object(d.a)(this,void 0,void 0,function*(){if(Bi.initialized)return yield Xe.registerForPushNotifications(e);yield new Promise((t,i)=>{Bi.emitter.once(Bi.EVENTS.SDK_INITIALIZED,()=>Object(d.a)(this,void 0,void 0,function*(){return yield Xe.registerForPushNotifications(e),t()}))})})}static getNotificationPermission(e){return Object(d.a)(this,void 0,void 0,function*(){return yield Object(K.c)(),Bi.privateGetNotificationPermission(e)})}static privateGetNotificationPermission(e){return Object(d.a)(this,void 0,void 0,function*(){const t=yield Bi.context.permissionManager.getNotificationPermission(Bi.config.safariWebId);return e&&e(t),t})}static getTags(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),Object(K.s)("getTags",e);const{appId:t}=yield w.a.getAppConfig(),{deviceId:i}=yield w.a.getSubscription();if(!i)return E.a.info(new b(r.NoDeviceId)),null;const{tags:n}=yield yt.getPlayer(t,i);return Object(K.j)(e,n),n})}static sendTag(e,t,i){return Object(d.a)(this,void 0,void 0,function*(){const n={};return n[e]=t,yield Bi.sendTags(n,i)})}static sendTags(e,t){return Object(d.a)(this,void 0,void 0,function*(){return yield Object(K.c)(),Object(K.s)("sendTags",e,t),e&&0!==Object.keys(e).length?(Object.keys(e).forEach(t=>{!1===e[t]&&(e[t]="false")}),yield this.context.updateManager.sendTagsUpdate(e),Object(K.j)(t,e),e):(E.a.info(new InvalidArgumentError.a("tags",InvalidArgumentError.b.Empty)),null)})}static deleteTag(e){return Object(d.a)(this,void 0,void 0,function*(){return yield Bi.deleteTags([e])})}static deleteTags(e,t){return Object(d.a)(this,void 0,void 0,function*(){if(yield Object(K.c)(),Object(K.s)("deleteTags",e,t),!Ri.isValidArray(e))throw new InvalidArgumentError.a("tags",InvalidArgumentError.b.Malformed);0===e.length&&E.a.info(new InvalidArgumentError.a("tags",InvalidArgumentError.b.Empty));const i={};for(const t of e)i[t]="";const n=yield Bi.sendTags(i);if(n){const e=Object.keys(n);return Object(K.j)(t,e),e}return[]})}static setExternalUserId(e,t){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),Object(K.s)("setExternalUserId"),yield Bi.privateSetExternalUserId(e,t)})}static privateSetExternalUserId(e,t){return Object(d.a)(this,void 0,void 0,function*(){Wi.throwIfInvalidAuthHash(t,"authHash"),yield Bi.database.setExternalUserId(e,t),yield Bi.context.updateManager.sendExternalUserIdUpdate(e,t)})}static getExternalUserId(){return Object(d.a)(this,void 0,void 0,function*(){return yield Object(K.c)(),Object(K.s)("getExternalUserId"),yield Bi.database.getExternalUserId()})}static removeExternalUserId(){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),Object(K.s)("removeExternalUserId"),yield Bi.privateSetExternalUserId(void 0)})}static addListenerForNotificationOpened(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),Object(K.s)("addListenerForNotificationOpened",e),Bi.emitter.once(Bi.EVENTS.NOTIFICATION_CLICKED,t=>{Object(K.j)(e,t)}),Bi.config&&J.fireStoredNotificationClicks(Bi.config.pageUrl||Bi.config.userConfig.pageUrl)})}static getIdsAvailable(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),Object(K.s)("getIdsAvailable",e);const{deviceId:t,subscriptionToken:i}=yield w.a.getSubscription(),n={userId:t,registrationId:i};return Object(K.j)(e,n),n})}static isPushNotificationsEnabled(e){return Object(d.a)(this,void 0,void 0,function*(){return yield Object(K.c)(),Bi.privateIsPushNotificationsEnabled(e)})}static privateIsPushNotificationsEnabled(e){return Object(d.a)(this,void 0,void 0,function*(){Object(K.s)("isPushNotificationsEnabled",e);const t=yield Bi.context.subscriptionManager.getSubscriptionState();return Object(K.j)(e,t.subscribed&&!t.optedOut),t.subscribed&&!t.optedOut})}static setSubscription(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),Object(K.s)("setSubscription",e);const t=yield w.a.getAppConfig(),{appId:i}=t,n=yield w.a.getSubscription(),{deviceId:s}=n;if(!t.appId)throw new m(o.MissingAppId);if(!Ri.isValidBoolean(e))throw new InvalidArgumentError.a("newSubscription",InvalidArgumentError.b.Malformed);if(!s)return void E.a.info(new b(r.NoDeviceId));const a={notification_types:he.getNotificationTypeFromOptIn(e)},c=yield w.a.getExternalUserIdAuthHash();c&&(a.external_user_id_auth_hash=c),n.optedOut=!e,yield yt.updatePlayer(i,s,a),yield w.a.setSubscription(n),J.onInternalSubscriptionSet(n.optedOut),J.checkAndTriggerSubscriptionChanged()})}static isOptedOut(e){return Object(d.a)(this,void 0,void 0,function*(){return yield Object(K.c)(),Bi.internalIsOptedOut(e)})}static internalIsOptedOut(e){return Object(d.a)(this,void 0,void 0,function*(){Object(K.s)("isOptedOut",e);const{optedOut:t}=yield w.a.getSubscription();return Object(K.j)(e,t),t})}static optOut(e,t){return Object(d.a)(this,void 0,void 0,function*(){if(yield Object(K.c)(),Object(K.s)("optOut",e,t),!Ri.isValidBoolean(e))throw new InvalidArgumentError.a("doOptOut",InvalidArgumentError.b.Malformed);yield Bi.setSubscription(!e),Object(K.j)(t)})}static getEmailId(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),Object(K.s)("getEmailId",e);const t=(yield w.a.getEmailProfile()).subscriptionId;return Object(K.j)(e,t),t})}static getSMSId(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),Object(K.s)("getSMSId",e);const t=yield w.a.getSMSProfile(),{subscriptionId:i}=t;return Object(K.j)(e,i),i})}static getUserId(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),Object(K.s)("getUserId",e);const t=(yield w.a.getSubscription()).deviceId;return Object(K.j)(e,t),t})}static getRegistrationId(e){return Object(d.a)(this,void 0,void 0,function*(){yield Object(K.c)(),Object(K.s)("getRegistrationId",e);const t=(yield w.a.getSubscription()).subscriptionToken;return Object(K.j)(e,t),t})}static getSubscription(e){return Object(d.a)(this,void 0,void 0,function*(){return yield Object(K.c)(),yield Bi.privateGetSubscription(e)})}static privateGetSubscription(e){return Object(d.a)(this,void 0,void 0,function*(){Object(K.s)("getSubscription",e);const t=!(yield w.a.getSubscription()).optedOut;return Object(K.j)(e,t),t})}static sendSelfNotification(e="OneSignal Test Message",t="This is an example notification.",i=`${new URL(location.href).origin}?_osp=do_not_open`,n,s,a){return Object(d.a)(this,void 0,void 0,function*(){if(yield Object(K.c)(),Object(K.s)("sendSelfNotification",e,t,i,n,s,a),!(yield w.a.getAppConfig()).appId)throw new m(o.MissingAppId);if(!(yield Bi.isPushNotificationsEnabled()))throw new b(r.NoDeviceId);if(!Ri.isValidUrl(i))throw new InvalidArgumentError.a("url",InvalidArgumentError.b.Malformed);if(!Ri.isValidUrl(n,{allowEmpty:!0,requireHttps:!0}))throw new InvalidArgumentError.a("icon",InvalidArgumentError.b.Malformed);if(!n){const e=yield he.getNotificationIcons();n=Object(K.m)(e)}const c=e=>{const t=[];for(let i=0;iObject(d.a)(this,void 0,void 0,function*(){if(!i)return void E.a.error("Service worker registration not available.");const o={body:t,data:l,icon:n,actions:a?c(a):[]};i.showNotification(e,o)}))})}static push(e){Ui.processItem(Bi,e)}static on(e,t){return this.emitter.on(e,t)}static off(e,t){return this.emitter.off(e,t)}static once(e,t){return this.emitter.once(e,t)}static sendOutcome(e,t){return Object(d.a)(this,void 0,void 0,function*(){const i=Bi.config.userConfig.outcomes;if(!i)return void E.a.error(`Could not send ${e}. No outcomes config found.`);const n=new ht(Bi.config.appId,i,e,!1);if(void 0!==t&&"number"!=typeof t)return void E.a.error("Outcome weight can only be a number if present.");if(!(yield n.beforeOutcomeSend()))return;const o=yield n.getAttribution();yield n.send({type:o.type,notificationIds:o.notificationIds,weight:t})})}static sendUniqueOutcome(e){return Object(d.a)(this,void 0,void 0,function*(){const t=Bi.config.userConfig.outcomes;if(!t)return void E.a.error(`Could not send ${e}. No outcomes config found.`);const i=new ht(Bi.config.appId,t,e,!0);if(!(yield i.beforeOutcomeSend()))return;const n=yield i.getAttribution();if(n.type===rt.NotSupported)return void E.a.warn("You are on a free plan. Please upgrade to use this functionality.");const{notificationIds:o}=n,s=yield i.getNotifsToAttributeWithUniqueOutcome(o);i.shouldSendUnique(n,s)?yield i.send({type:n.type,notificationIds:s}):E.a.warn(`'${e}' was already reported for all notifications.`)})}}Bi.VERSION=h.a.version(),Bi._VERSION=h.a.version(),Bi.sdkEnvironment=T.a,Bi._notificationOpenedCallbacks=[],Bi._idsAvailable_callback=[],Bi._defaultLaunchURL=null,Bi.config=null,Bi._sessionInitAlreadyRunning=!1,Bi._isNotificationEnabledCallback=[],Bi._subscriptionSet=!0,Bi.modalUrl=null,Bi._windowWidth=650,Bi._windowHeight=568,Bi._isNewVisitor=!1,Bi._channel=null,Bi.timedLocalStorage=De,Bi.initialized=!1,Bi._didLoadITILibrary=!1,Bi.notifyButton=null,Bi.store=v,Bi.environment=h.a,Bi.database=w.a,Bi.event=S.a,Bi.browser=g.a,Bi.slidedown=null,Bi.log=E.a,Bi.api=yt,Bi.indexedDb=Di.a,Bi.mainHelper=he,Bi.subscriptionHelper=ge,Bi.httpHelper=xi,Bi.eventHelper=J,Bi.initHelper=Xe,Bi.pendingInit=!0,Bi.emitter=new be.a,Bi.cache={},Bi.SERVICE_WORKER_PATH="OneSignalSDKWorker.js",Bi.SERVICE_WORKER_PARAM={scope:"/"},Bi._LOGGING=!1,Bi.LOGGING=!1,Bi._initCalled=!1,Bi.__initAlreadyCalled=!1,Bi.checkAndWipeUserSubscription=function(){},Bi.DeviceRecord=ie,Bi.SecondaryChannelDeviceRecord=It,Bi.notificationPermission=y,Bi._initHttp=xi.initHttp,Bi._initPopup=(()=>Bi.subscriptionPopup.subscribe()),Bi.POSTMAM_COMMANDS={CONNECTED:"connect",REMOTE_NOTIFICATION_PERMISSION:"postmam.remoteNotificationPermission",REMOTE_DATABASE_GET:"postmam.remoteDatabaseGet",REMOTE_DATABASE_GET_ALL:"postmam.remoteDatabaseGetAll",REMOTE_DATABASE_PUT:"postmam.remoteDatabasePut",REMOTE_DATABASE_REMOVE:"postmam.remoteDatabaseRemove",REMOTE_OPERATION_COMPLETE:"postman.operationComplete",REMOTE_RETRIGGER_EVENT:"postmam.remoteRetriggerEvent",MODAL_LOADED:"postmam.modalPrompt.loaded",MODAL_PROMPT_ACCEPTED:"postmam.modalPrompt.accepted",MODAL_PROMPT_REJECTED:"postmam.modalPrompt.canceled",POPUP_LOADED:"postmam.popup.loaded",POPUP_ACCEPTED:"postmam.popup.accepted",POPUP_REJECTED:"postmam.popup.canceled",POPUP_CLOSING:"postman.popup.closing",REMOTE_NOTIFICATION_PERMISSION_CHANGED:"postmam.remoteNotificationPermissionChanged",IFRAME_POPUP_INITIALIZE:"postmam.iframePopupInitialize",UNSUBSCRIBE_FROM_PUSH:"postmam.unsubscribeFromPush",SET_SESSION_COUNT:"postmam.setSessionCount",REQUEST_HOST_URL:"postmam.requestHostUrl",WINDOW_TIMEOUT:"postmam.windowTimeout",FINISH_REMOTE_REGISTRATION:"postmam.finishRemoteRegistration",FINISH_REMOTE_REGISTRATION_IN_PROGRESS:"postmam.finishRemoteRegistrationInProgress",POPUP_BEGIN_MESSAGEPORT_COMMS:"postmam.beginMessagePortComms",SERVICEWORKER_COMMAND_REDIRECT:"postmam.command.redirect",MARK_PROMPT_DISMISSED:"postmam.markPromptDismissed",IS_SUBSCRIBED:"postmam.isSubscribed",UNSUBSCRIBE_PROXY_FRAME:"postman.unsubscribeProxyFrame",GET_EVENT_LISTENER_COUNT:"postmam.getEventListenerCount",SERVICE_WORKER_STATE:"postmam.serviceWorkerState",GET_WORKER_VERSION:"postmam.getWorkerVersion",SUBSCRIPTION_EXPIRATION_STATE:"postmam.subscriptionExpirationState",PROCESS_EXPIRING_SUBSCRIPTIONS:"postmam.processExpiringSubscriptions",GET_SUBSCRIPTION_STATE:"postmam.getSubscriptionState",SESSION_UPSERT:"postmam.sessionUpsert",SESSION_DEACTIVATE:"postmam.sessionDeactivate",ARE_YOU_VISIBLE_REQUEST:"postmam.areYouVisibleRequest",ARE_YOU_VISIBLE_RESPONSE:"postmam.areYouVisibleResponse"},Bi.EVENTS={CUSTOM_PROMPT_CLICKED:"customPromptClick",NATIVE_PROMPT_PERMISSIONCHANGED:"notificationPermissionChange",SUBSCRIPTION_CHANGED:"subscriptionChange",WELCOME_NOTIFICATION_SENT:"sendWelcomeNotification",NOTIFICATION_DISPLAYED:"notificationDisplay",NOTIFICATION_DISMISSED:"notificationDismiss",NOTIFICATION_CLICKED:"notificationClick",SDK_INITIALIZED:"initializeInternal",SDK_INITIALIZED_PUBLIC:"initialize",REGISTERED:"register",POPUP_CLOSING:"popupClose",PERMISSION_PROMPT_DISPLAYED:"permissionPromptDisplay",EMAIL_SUBSCRIPTION_CHANGED:"emailSubscriptionChanged",SMS_SUBSCRIPTION_CHANGED:"smsSubscriptionChanged",TEST_INIT_OPTION_DISABLED:"testInitOptionDisabled",TEST_WOULD_DISPLAY:"testWouldDisplay",TEST_FINISHED_ALLOW_CLICK_HANDLING:"testFinishedAllowClickHandling",POPUP_WINDOW_TIMEOUT:"popupWindowTimeout",SESSION_STARTED:"os.sessionStarted"},ee.ensureBackwardsCompatibility(Bi),E.a.info(`%cOneSignal Web SDK loaded (version ${Bi._VERSION},\n ${T.a.getWindowEnv().toString()} environment).`,Object(K.k)("bold")),E.a.debug(`Current Page URL: ${"undefined"==typeof location?"NodeJS":location.href}`),E.a.debug(`Browser Environment: ${g.a.name} ${g.a.version}`)},function(e,t){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(e){"object"==typeof window&&(i=window)}e.exports=i},function(e,t){e.exports=function(){throw new Error("define cannot be used indirect")}}]); //# sourceMappingURL=OneSignalPageSDKES6.js.map