(()=>{"use strict";var t={321:function(t,e){var n=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{c(i.next(t))}catch(t){r(t)}}function a(t){try{c(i.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.keyValue=void 0;const i="AlertWise";let o;const r=(t,e)=>{console.info("onversionchange",e),t.close()},s=()=>(o||(o=new Promise(((t,e)=>{const n=indexedDB.open("ALERTWISE_SDK");n.onsuccess=e=>{const n=e.target.result;n.onversionchange=t=>r(n,t),t(n)},n.onerror=()=>{console.error("Error Occurred!!!!!!"),e(n.error)},n.onupgradeneeded=t=>{const e=t.target.result;e.onversionchange=t=>r(e,t),(t=>{t.objectStoreNames.contains(i)||t.createObjectStore(i,{keyPath:"key",autoIncrement:!0})})(e)}}))),o),a=t=>s().then((e=>new Promise(((n,i)=>t(e,n,i))))),c=(t,e,n,i)=>{let o;const r=()=>{clearTimeout(o),t()?n():e()?i():o=setTimeout(r,0)};r()};var p;e.keyValue=(p=i,{get:(t,e)=>a(((n,i,o)=>{const r=n.transaction(p).objectStore(p).get(t);let s=!1,a=!1;r.onsuccess=()=>s=!0,r.onerror=()=>a=!0,c((()=>s),(()=>a),(()=>i(r.result&&r.result.value||e)),(()=>o(r.error)))})),getAll:()=>a(((t,e,n)=>{const i={},o=t.transaction(p).objectStore(p).openCursor();let r=!1,s=!1;o.onsuccess=t=>{const e=t.target.result;e?(i[e.key]=e.value.value,e.continue()):r=!0},o.onerror=()=>s=!0,c((()=>r),(()=>s),(()=>e(i)),(()=>n(o.error)))})),extend(t,e){return n(this,void 0,void 0,(function*(){const n=yield this.get(t);yield this.set(t,Object.assign(Object.assign({},n),e))}))},set:(t,e)=>a(((n,i,o)=>{const r=n.transaction([p],"readwrite").objectStore(p).put({key:t,value:e});let s=!1,a=!1;r.onsuccess=()=>s=!0,r.onerror=()=>a=!0,c((()=>s),(()=>a),(()=>i(t)),(()=>o(r.error)))}))})},330:t=>{t.exports={version:"1.2.2"}},600:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{c(i.next(t))}catch(t){r(t)}}function a(t){try{c(i.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.DefaultPushService=void 0;const o=n(611),r=n(911),s=n(870),a=n(870),c=n(950),p=n(618);e.DefaultPushService=class{constructor(t,e=r.data){this.api=t,this.dataRef=e}getPermission(){return Notification.permission}checkIsPermissionDefault(){return this.getPermission()===s.PERMISSION_PROMPT}askPermission(){return i(this,void 0,void 0,(function*(){try{const t=yield Notification.requestPermission();console.debug(`Permission Status: ${t}`)}catch(t){console.error("Error while asking permission:",t)}}))}checkIsPermissionGranted(){return this.getPermission()===s.PERMISSION_GRANTED}subscribe(t){return i(this,void 0,void 0,(function*(){if(!this.checkIsPermissionGranted())return void console.error("You must have permission granted before subscribe!");const e=t||(yield this.trySubscribe()),{auth:n,p256dh:i}=e.toJSON().keys;if(!n||!i)throw new Error("Can't get subscription keys!");const o=yield this.dataRef.getIpInfo(),r=Object.assign(Object.assign({},o),{auth:n,p256dh:i,timeZone:o.timezone,appId:yield this.dataRef.getAppId(),endpoint:e.endpoint,browser:yield this.dataRef.getBrowser(),device:yield this.dataRef.getDeviceType(),os:yield this.dataRef.getOs(),language:yield this.dataRef.getLanguage(),tags:{},segments:(0,p.getSelectedSegments)(),timeZoneOffset:this.dataRef.getTimeZoneOffset()}),s=yield this.api.postSubscription(r);window.dispatchEvent(new CustomEvent(a.EVENT_ON_SUBSCRIBE,{detail:{subscriber:Object.assign(Object.assign({},s),{id:s._id}),subscription:e.toJSON()}})),window.dispatchEvent(new CustomEvent(a.EVENT_ON_SUBSCRIBE_CHANGE,{detail:{subscriberId:s._id}}))}))}unsubscribe(){return i(this,void 0,void 0,(function*(){const t=yield this.dataRef.getSubscriptionId();window.dispatchEvent(new CustomEvent(a.EVENT_ON_UNSUBSCRIBE,{detail:{subscriberId:t}}));const e=yield this.getSubscription();e&&(yield e.unsubscribe())}))}trySubscribe(){return i(this,void 0,void 0,(function*(){try{return yield this.subscribePushManager()}catch(t){return yield(0,c.logSDKFailure)(t),yield this.unsubscribe(),this.subscribePushManager()}}))}subscribePushManager(){return i(this,void 0,void 0,(function*(){const t=yield this.getServiceWorkerRegistration(),e=yield this.dataRef.getApplicationServerKey();return t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e?this.urlBase64ToUint8Array(e):null})}))}updateServiceWorkerRegistration(){return i(this,void 0,void 0,(function*(){yield this.getServiceWorkerRegistration()}))}getServiceWorkerRegistration(){return i(this,void 0,void 0,(function*(){var t;if(!this.registration){yield this.registerServiceWorker();const e=yield this.dataRef.getServiceWorkerUrl();this.registration=(yield navigator.serviceWorker.getRegistration(e))||void 0,yield null===(t=this.registration)||void 0===t?void 0:t.update(),yield this.waitForRegistrationActive()}if(!this.registration)throw new Error("Internal Error: Can't register service worker!");return this.registration}))}waitForRegistrationActive(){return i(this,void 0,void 0,(function*(){return new Promise(((t,e)=>{var n,i,o;const r=setTimeout((()=>e(new Error(`Service worker not registered after ${a.DEFAULT_REGISTRATION_TIMEOUT} ms`))),a.DEFAULT_REGISTRATION_TIMEOUT),s=(null===(n=this.registration)||void 0===n?void 0:n.installing)||(null===(i=this.registration)||void 0===i?void 0:i.waiting);(null===(o=this.registration)||void 0===o?void 0:o.active)?(clearTimeout(r),t()):s?s.onstatechange=e=>{var n;"activated"===(null===(n=e.target)||void 0===n?void 0:n.state)&&(s.onstatechange=null,clearTimeout(r),t())}:(clearTimeout(r),e(new Error("No incoming service worker found.")))}))}))}registerServiceWorker(){return i(this,void 0,void 0,(function*(){const t=yield this.dataRef.getServiceWorkerUrl(),e=yield this.dataRef.getServiceWorkerScope(),n=(yield this.dataRef.getSdkVersion())!==(yield this.dataRef.getServiceWorkerVersion())?`?cache_clean=${(0,o.v4)()}`:"";n&&console.debug("SDK version and SWVersion not same. Cleaning Cache!"),yield navigator.serviceWorker.register(`${t}${n}`,{scope:e})}))}checkIsNeedResubscribe(){return i(this,void 0,void 0,(function*(){const t=yield this.dataRef.getPushSubscription(),e=yield this.dataRef.getLastPermissionStatus(),n=this.getPermission();return!(!t||e===n)&&(console.debug("Resubscribe Required as Permission Changed"),yield this.dataRef.setLastPermissionStatus(n),!0)}))}getSubscription(){return i(this,void 0,void 0,(function*(){return(yield this.getServiceWorkerRegistration()).pushManager.getSubscription()}))}urlBase64ToUint8Array(t){const e=(t+"=".repeat((4-t.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),n=window.atob(e),i=new Uint8Array(n.length);for(let t=0;t
',i+=null===(n=t.segments)||void 0===n?void 0:n.map((t=>``)).join(""),i+="
"),i};e.getPopupHtml=t=>`\n \n
\n `;e.bellStyles=t=>`\n .aw-bell-container {\n position: absolute;\n bottom: 20px;\n z-index: 1000;\n border-radius: 50%;\n display: flex;\n cursor: pointer;\n box-shadow: 0 6px 12px rgba(0, 0, 0, 0.25);\n transition: all 0.3s;\n \n .aw-bell-circle {\n width: 50px;\n height: 50px;\n border-radius: 50%;\n display: flex;\n justify-content: center;\n align-items: center;\n transition: background-color 0.3s, transform 0.2s;\n background-color: ${t.buttonAcceptBackgroundColor};\n \n svg {\n width: 48px;\n height: 48px;\n fill: ${t.backgroundColor};\n }\n }\n }\n \n .aw-bell-container.bottom-left {\n margin-left: 16px;\n justify-self: flex-start;\n }\n \n .aw-bell-container.bottom-right {\n margin-right: 16px;\n justify-self: flex-end;\n }\n \n .aw-bell-container:hover .tooltip-message {\n justify-self: flex-end;\n }\n \n .aw-bell-container:hover .tooltip-message {\n visibility: visible;\n opacity: 1;\n }\n \n .tooltip-message {\n visibility: hidden;\n position: absolute;\n opacity: 0;\n transition: opacity 0.3s;\n background: black;\n color: white;\n padding: 6px;\n border-radius: 4px;\n width: max-content;\n max-width: 200px;\n z-index: 10;\n }\n \n .tooltip-message.bottom-right {\n right: 100%;\n top: 50%;\n transform: translateY(-50%);\n margin-right: 8px;\n }\n \n .tooltip-message.bottom-right::after {\n content: '';\n position: absolute;\n right: -12px;\n top: 50%;\n border: 6px solid transparent;\n border-left-color: black;\n transform: translateY(-50%);\n }\n \n .tooltip-message.bottom-left {\n left: 100%;\n top: 50%;\n transform: translateY(-50%);\n margin-left: 8px;\n }\n \n .tooltip-message.bottom-left::after {\n content: '';\n position: absolute;\n left: -12px;\n top: 50%;\n border: 6px solid transparent;\n border-right-color: black;\n transform: translateY(-50%);\n }\n \n .aw-popup-container {\n position: fixed;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n display: none;\n justify-content: center;\n align-items: center;\n background: rgba(0,0,0,0.2);\n z-index: 2147483649;\n \n .aw-popup-box {\n width: 90%;\n opacity: 1;\n max-width: 330px;\n border-radius: 12px;\n text-align: center;\n overflow: hidden;\n transform: scale(0.9);\n box-shadow: 0 6px 16px rgba(0, 0, 0, 0.15);\n background: ${t.backgroundColor};\n animation: fadeInScale 0.4s ease-out forwards;\n font-family: "Segoe UI", Arial, sans-serif;\n \n .aw-popup-header {\n padding: 10px;\n font-size: 15px;\n font-weight: bold;\n letter-spacing: 0.5px;\n color: ${t.backgroundColor};\n background: ${t.buttonAcceptBackgroundColor};\n }\n \n .aw-popup-content {\n padding: 16px 16px 8px 16px;\n \n img {\n max-width: 60px;\n margin-bottom: 12px;\n }\n \n p {\n font-size: 13px;\n color: #444;\n margin: 0;\n line-height: 1.4em;\n }\n }\n \n }\n \n @keyframes fadeInScale {\n to {\n opacity: 1;\n transform: scale(1);\n }\n }\n }\n .aw-popup-container-show {\n display: flex;\n }\n `,e.commonStyles="\n .aw__powered-by {\n font-size: 8px;\n height: 9px;\n line-height: 9px;\n cursor: pointer;\n font-weight: 500;\n background: none;\n opacity: .8;\n bottom: 5px\n }\n";e.buttonWidgetStyles=t=>`\n .aw-button-widget-container {\n position: absolute;\n display: flex;\n flex-direction: column;\n align-items: flex-end;\n \n .aw-button-close-button {\n position: absolute;\n top: -10px;\n width: 20px;\n height: 20px;\n background-color: white;\n color: #555;\n border: none;\n border-radius: 50%;\n box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);\n font-size: 20px;\n line-height: 1;\n cursor: pointer;\n display: flex;\n justify-content: center;\n align-items: center;\n opacity: 1;\n visibility: visible;\n transition: opacity 0.3s ease, visibility 0.3s ease;\n }\n button[class*=" left-"] {\n right: -10px;\n }\n button[class*=" right-"] {\n left: -10px;\n }\n .aw-button-widget {\n background-color: ${t.buttonAcceptBackgroundColor};\n color: ${t.backgroundColor};\n border: none;\n box-shadow: -2px 2px 15px rgba(0, 0, 0, 0.2);\n cursor: pointer;\n transition: background-color 0.3s ease;\n \n padding: 12px;\n font-size: 15px;\n font-weight: 600;\n text-align: center;\n \n writing-mode: vertical-lr;\n text-orientation: mixed;\n \n display: flex;\n flex-direction: column;\n align-items: flex-start;\n }\n \n .aw-button-widget .bell-icon {\n font-size: 16px;\n margin-top: 10px;\n transform: rotate(-90deg);\n }\n \n .aw-button-widget .main-text {\n transform: rotate(180deg);\n }\n \n .aw-button-widget-container:hover .aw-button-close-button {\n opacity: 1;\n visibility: visible;\n }\n }\n .left-top{ left:0; top:30px }\n .left-center{ left:0; transform: translateY(33vh) }\n .left-bottom{ left:0; bottom:30px }\n \n .right-top{ right:0; top:30px }\n .right-center{ right:0; transform: translateY(33vh) }\n .right-bottom{ right:0; bottom:30px }\n `;e.getStyles=t=>{const n=(t.isMobile?t.optInPlacementMobile:t.optInPlacementDesktop).toLowerCase().includes("bottom");return e.commonStyles+(0,e.buttonWidgetStyles)(t)+(0,e.bellStyles)(t)+`\n .aw-subscription-prompt {\n all: unset;\n letter-spacing: normal;\n word-spacing: normal;\n text-shadow: none;\n font-family: inherit;\n box-sizing: border-box;\n border: 0;\n vertical-align: initial;\n background-repeat: no-repeat;\n font-weight: normal;\n font-style: normal;\n line-height: normal;\n text-transform: initial;\n border-width: 0;\n border-style: none;\n margin: 0;\n padding: 0;\n text-align: left;\n direction: ltr;\n border-radius: 0px;\n left: 0;\n right: 0;\n top: ${n?"auto":"0"};\n bottom: ${n?"0":"auto"};\n display: none;\n position: fixed;\n color: black;\n z-index: 2147483648;\n }\n .aw-subscription-prompt.show { display: grid; }\n .aw-prompt-default {\n width: 420px;\n max-width: 95%;\n display: flex;\n padding: 16px 16px 8px 16px;\n position: relative;\n justify-self: center;\n box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);\n background: ${t.backgroundColor};\n }\n .aw-prompt-default.top,\n .aw-prompt-default.top-center {\n top: 0;\n border-radius: 0 0 12px 12px;\n }\n .aw-prompt-default.top-left {\n top: 0;\n justify-self: flex-start;\n border-radius: 0 0 12px 12px;\n }\n .aw-prompt-default.top-right {\n top: 0;\n justify-self: flex-end;\n border-radius: 0 0 12px 12px;\n }\n .aw-prompt-default.bottom {\n bottom: 0;\n top: auto;\n border-radius: 12px 12px 0 0;\n }\n .aw--icon {\n width: 60px;\n height: 60px;\n display: flex;\n justify-content: center;\n align-items: center;\n border-radius: 2px;\n flex-shrink: 0;\n }\n .aw--icon img {\n width: 60px;\n height: 60px;\n }\n .aw-prompt-content {\n margin-left: 16px;\n flex: 1;\n display: flex;\n flex-direction: column;\n }\n .aw-bar-content {\n margin-left: 16px;\n display: flex;\n align-items: center;\n justify-content: center;\n text-align: left;\n gap: 1rem;\n }\n .aw--title {\n line-height: 18px;\n p {\n margin-block-start: 0;\n word-wrap: break-word;\n overflow: hidden;\n font-size: 14px;\n font-style: normal;\n text-align: left;\n }\n }\n .aw-prompt-actions {\n display: flex;\n justify-content: flex-end;\n align-items: center;\n gap: 16px;\n margin-top: 16px;\n }\n .aw-prompt-actions .later {\n font-size: 14px;\n cursor: pointer;\n padding: 8px 16px;\n color: ${t.buttonAcceptBackgroundColor};\n }\n .aw-prompt-actions .subscribe {\n color: #fff;\n border: none;\n padding: 12px 16px;\n border-radius: 4px;\n font-size: 14px;\n cursor: pointer;\n min-width: 100px;\n transition: background 0.2s;\n background: ${t.buttonAcceptBackgroundColor};\n }\n \n .aw-subscription-prompt.large {\n top: 50%;\n transform: translateY(-50%);\n }\n .aw-prompt-default.large {\n align-items: center;\n border-radius: 12px;\n flex-direction: column;\n }\n .aw-checkbox-grid {\n display: grid;\n grid-template-columns: repeat(2, auto);\n gap: 1rem;\n align-items: center;\n margin-top: 0.2rem;\n }\n .aw-checkbox-item {\n gap: 0.5rem;\n display: flex;\n min-width: 0;\n align-items: center;\n }\n .aw-checkbox-item .checkbox-text {\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap; \n // flex: 1;\n min-width: 0;\n font-size: 13px;\n }\n input[type="checkbox"] {\n width: 15px;\n height: 15px;\n accent-color: ${t.buttonAcceptBackgroundColor};\n }\n @media (max-width: 480px) {\n .aw-subscription-prompt.show { display: block; }\n .aw-prompt-default {\n width: auto;\n padding: 12px 12px 6px 12px;\n }\n .aw--icon {\n width: 50px;\n height: 50px;\n }\n .aw--icon img {\n width: 50px;\n height: 50px;\n }\n \n .aw--title {\n line-height: 16px;\n p {\n font-size: 12px;\n }\n }\n \n .aw-prompt-actions {\n gap: 10px;\n margin-top: 10px;\n }\n .aw-prompt-actions .subscribe {\n font-size: 12px;\n padding: 9px 16px;\n }\n .aw-checkbox-item .checkbox-text {\n font-size: 11px;\n }\n .aw-bar-content {\n flex-direction: column;\n text-align: center;\n gap: 0;\n }\n }\n @supports (-moz-appearance: none) {\n @media (max-width: 480px) {\n .aw-subscription-prompt.show {\n display: grid;\n }\n }\n }\n `}},694:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{c(i.next(t))}catch(t){r(t)}}function a(t){try{c(i.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=n(870),r=n(729),s=n(911),a=n(950),c=n(784),p=n(600),l=new r.Api;self.addEventListener("push",(function(t){t.waitUntil(function(t){return i(this,void 0,void 0,(function*(){yield self.clients.claim();const e=t.data.json();console.log("payload : {}",e);const n=yield s.data.getAppId(),r=new c.default(e),a=r.getShowNotificationOptions().data,p={appId:n,deliveredAt:new Date,campaignId:a.campaignId,subscriberId:a.subscriberId,notificationId:a.notificationId};yield function(t){return i(this,void 0,void 0,(function*(){const e=yield t.getTitle(),n=t.getShowNotificationOptions();n.silent||(yield self.registration.showNotification(e,n))}))}(r).then((()=>l.postEvent(p).then((()=>console.log("Received Event posted to server!"))))).then((()=>self.dispatchEvent(new CustomEvent(o.EVENT_ON_NOTIFICATION_DISPLAYED,{detail:{title:r.getTitle()}}))))}))}(t).catch((e=>(0,a.onSWFailure)(e,t))))})),self.addEventListener("install",(function(t){return t.waitUntil(function(){return i(this,void 0,void 0,(function*(){console.log("Installing!!!!!!!!!!!!!!!!!!"),yield s.data.setServiceWorkerVersion(o.__VERSION__),yield self.skipWaiting()}))}().catch((e=>(0,a.onSWFailure)(e,t))))})),self.addEventListener("activate",(function(t){t.waitUntil(function(){return i(this,void 0,void 0,(function*(){yield self.clients.claim()}))}().catch((e=>(0,a.onSWFailure)(e,t))))})),self.addEventListener(o.EVENT_ON_SW_ERROR,a.sendLogMsgToRemoteServer),self.addEventListener("notificationclick",(function(t){console.log("Inside onClickNotificationEventHandler --------"),t.waitUntil(function(t){return i(this,void 0,void 0,(function*(){var e,n;yield self.clients.claim();const r=t.notification;console.log("notificationOptions :",r),t.notification.close();let a=r.data.targetUrl;r.actions&&"action1"===t.action?a=null===(e=r.data.buttons)||void 0===e?void 0:e[0].url:r.actions&&"action2"===t.action&&(a=null===(n=r.data.buttons)||void 0===n?void 0:n[1].url);const c=yield s.data.getAppId(),p=r.data,d={appId:c,clickedAt:new Date,campaignId:p.campaignId,subscriberId:p.subscriberId,notificationId:p.notificationId};yield l.postEvent(d).then((()=>console.log("Clicked Event posted to server!"))),self.dispatchEvent(new CustomEvent(o.EVENT_ON_NOTIFICATION_CLICK,{detail:{title:t.notification.title}})),a&&t.waitUntil(self.clients.matchAll({type:"window"}).then((t=>function(t,e){return i(this,void 0,void 0,(function*(){const{hostname:n,pathname:i}=new URL(e,self.location.origin),o=t.find((t=>{const{hostname:e,pathname:o}=new URL(t.url);return e===n&&o===i}));return o?(yield o.focus(),!1):(yield self.clients.openWindow(e).then((t=>{t&&t.focus()})),!0)}))}(t,a))))}))}(t).catch((e=>(0,a.onSWFailure)(e,t))))})),self.addEventListener("notificationclose",(function(t){console.log("Inside onCloseNotificationEventHandler!!!!!!!!!"),t.waitUntil(function(t){return i(this,void 0,void 0,(function*(){yield self.clients.claim(),t.notification.close(),self.dispatchEvent(new CustomEvent(o.EVENT_ON_NOTIFICATION_CLOSE,{detail:{title:t.notification.title}}))}))}(t).catch((e=>(0,a.onSWFailure)(e,t))))})),self.addEventListener("pushsubscriptionchange",(function(t){return i(this,void 0,void 0,(function*(){console.log("Inside *********onPushSubscriptionChange*********"),t.waitUntil(function(t){return i(this,void 0,void 0,(function*(){let e=t.newSubscription;if(!e&&(e=yield self.registration.pushManager.getSubscription(),!e))return;const n=new p.DefaultPushService(l);yield n.subscribe(e)}))}(t).catch((e=>(0,a.onSWFailure)(e,t))))}))}))},729:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{c(i.next(t))}catch(t){r(t)}}function a(t){try{c(i.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.Api=void 0;const o=n(911),r=n(870);e.Api=class{constructor(){this.dataRef=o.data}getAppSetting(){return i(this,void 0,void 0,(function*(){const t=yield this.dataRef.getAppId(),e=yield this.dataRef.getApiEntrypoint(),n=yield fetch(`${e}/app/${t}`,{method:"GET",headers:{"Content-Type":"application/json"}});if(!n.ok)throw new Error(r.APP_DOES_NOT_EXISTS);return n.json()}))}postEvent(t){return i(this,void 0,void 0,(function*(){const e=yield this.dataRef.getApiEntrypoint(),n=yield fetch(`${e}/event`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),i=yield n.json();return console.debug("Response json: {}",i),i}))}postSystemLog(t){return i(this,void 0,void 0,(function*(){const e=yield this.dataRef.getApiEntrypoint();yield fetch(`${e}/logs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)})}))}postSubscription(t){return i(this,void 0,void 0,(function*(){const e=yield this.dataRef.getApiEntrypoint(),n=yield fetch(`${e}/subscription`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),i=yield n.json();return console.debug("Response json: {}",i),i}))}updateSubscription(t,e){return i(this,void 0,void 0,(function*(){const n=yield this.dataRef.getApiEntrypoint(),i=yield fetch(`${n}/subscription/${t}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}),o=yield i.json();return console.debug("Response json: {}",o),o}))}deleteSubscription(t){return i(this,void 0,void 0,(function*(){if(!t)return;const e=yield this.dataRef.getApiEntrypoint(),n=yield fetch(`${e}/subscription/${t}`,{method:"DELETE"}),i=yield n.json();return console.debug("Response json: {}",i),i}))}addSegment(t){return i(this,void 0,void 0,(function*(){const e=yield this.dataRef.getApiEntrypoint(),n=yield fetch(`${e}/segments/addSubscribers`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),i=yield n.json();return console.debug("Response json: {}",i),i}))}removeSegment(t){return i(this,void 0,void 0,(function*(){const e=yield this.dataRef.getApiEntrypoint(),n=yield fetch(`${e}/segments/removeSubscribers`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),i=yield n.json();return console.debug("Response json: {}",i),i}))}sendTriggerEvent(t){return i(this,void 0,void 0,(function*(){const e=yield this.dataRef.getApiEntrypoint(),n=yield fetch(`${e}/trigger/events`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)}),i=yield n.json();return console.debug("Response json: {}",i),i}))}getIpInfo(){return i(this,void 0,void 0,(function*(){const t=yield this.dataRef.getApiEntrypoint(),e=yield fetch(`${t}/ipinfo`);if(!e.ok)throw new Error(r.IP_INFO_API_FAILED);return e.json()}))}communicateMessage(t){return i(this,void 0,void 0,(function*(){if(document.referrer){const e=new URL(document.referrer),n=new URL(yield this.dataRef.getAppUrl());e.host===n.host&&window.opener.postMessage(t,e.origin)}}))}}},784:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{c(i.next(t))}catch(t){r(t)}}function a(t){try{c(i.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0});const o=n(911);e.default=class{constructor(t){this.payload=t,this.dataRef=o.data}getTitle(){return i(this,void 0,void 0,(function*(){return this.payload.title||this.dataRef.getDefaultNotificationTitle()}))}getShowNotificationOptions(){return this.payload.actions=this.payload.data.buttons,this.payload}}},870:(t,e,n)=>{Object.defineProperty(e,"__esModule",{value:!0}),e.defaultPromptParams=e.IP_INFO_API_FAILED=e.APP_DOES_NOT_EXISTS=e.EVENT_ON_CLOSE_UNIVERSAL_SUB_PAGE=e.EVENT_ON_NOTIFICATION_DISPLAYED=e.EVENT_ON_NOTIFICATION_CLOSE=e.EVENT_ON_NOTIFICATION_CLICK=e.EVENT_ON_SUBSCRIBE_CHANGE=e.EVENT_ON_PERMISSION_GRANTED=e.EVENT_ON_PERMISSION_DEFAULT=e.EVENT_ON_PERMISSION_DENIED=e.EVENT_ON_PERMISSION_PROMPT=e.EVENT_ON_UNSUBSCRIBE=e.EVENT_ON_SUBSCRIBE=e.EVENT_ON_SW_ERROR=e.EVENT_ON_SDK_ERROR=e.EVENT_ON_READY=e.PERMISSION_PROMPT=e.PERMISSION_GRANTED=e.PERMISSION_DENIED=e.DELAY=e.SCROLL=e.DEFAULT_API_ENDPOINT=e.DEFAULT_NOTIFICATION_IMAGE=e.DEFAULT_NOTIFICATION_TITLE=e.DEFAULT_REGISTRATION_TIMEOUT=e.DEFAULT_SERVICE_WORKER_SCOPE=e.DEFAULT_SERVICE_WORKER_URL=e.PERIOD_SEND_APP_OPEN=e.__VERSION__=void 0,e.__VERSION__=n(330).version,e.PERIOD_SEND_APP_OPEN=9e5,e.DEFAULT_SERVICE_WORKER_URL="/service-worker.js",e.DEFAULT_SERVICE_WORKER_SCOPE="/",e.DEFAULT_REGISTRATION_TIMEOUT=1e4,e.DEFAULT_NOTIFICATION_TITLE="AlertWise Notification",e.DEFAULT_NOTIFICATION_IMAGE="https://cdn.alertwise.net/alertwise/img/bell.png",e.DEFAULT_API_ENDPOINT="https://api.alertwise.net",e.SCROLL="scroll",e.DELAY="delay",e.PERMISSION_DENIED="denied",e.PERMISSION_GRANTED="granted",e.PERMISSION_PROMPT="default",e.EVENT_ON_READY="AlertWise.onReady",e.EVENT_ON_SDK_ERROR="AlertWise.onSDKError",e.EVENT_ON_SW_ERROR="AlertWise.onSWError",e.EVENT_ON_SUBSCRIBE="AlertWise.onSubscribe",e.EVENT_ON_UNSUBSCRIBE="AlertWise.onUnsubscribe",e.EVENT_ON_PERMISSION_PROMPT="AlertWise.onPermissionPrompt",e.EVENT_ON_PERMISSION_DENIED="AlertWise.onPermissionDenied",e.EVENT_ON_PERMISSION_DEFAULT="AlertWise.onPermissionDefault",e.EVENT_ON_PERMISSION_GRANTED="AlertWise.onPermissionGranted",e.EVENT_ON_SUBSCRIBE_CHANGE="AlertWise.onSubscriptionChange",e.EVENT_ON_NOTIFICATION_CLICK="AlertWise.onNotificationClick",e.EVENT_ON_NOTIFICATION_CLOSE="AlertWise.onNotificationClose",e.EVENT_ON_NOTIFICATION_DISPLAYED="AlertWise.onNotificationDisplayed",e.EVENT_ON_CLOSE_UNIVERSAL_SUB_PAGE="AlertWise.onCloseUniversalSubPage",e.APP_DOES_NOT_EXISTS="AlertWise.APP_DOES_NOT_EXISTS",e.IP_INFO_API_FAILED="AlertWise.IP_INFO_API_FAILED",e.defaultPromptParams={iconUrl:"",headerText:"",backgroundColor:"#FFFFFF",optInPlacementDesktop:"Bottom Right",optInPlacementMobile:"Bottom Right",buttonAcceptBackgroundColor:"#1A72E8",buttonAcceptText:"Subscribe to notification",segments:[]}},911:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{c(i.next(t))}catch(t){r(t)}}function a(t){try{c(i.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.data=void 0;const o=n(321),r=n(870);e.data=new class{constructor(){this.store=o.keyValue,this.getTimeZoneOffset=()=>(new Date).getTimezoneOffset(),this.setSdkVersion=t=>this.store.set("params.sdkVersion",t),this.getSdkVersion=()=>this.store.get("params.sdkVersion"),this.setApplicationServerKey=t=>this.store.set("params.applicationServerKey",t),this.getApplicationServerKey=()=>this.store.get("params.applicationServerKey"),this.setLastOpenApplicationTime=t=>this.store.set("params.lastOpenApplicationTime",t),this.getLastOpenApplicationTime=()=>this.store.get("params.lastOpenApplicationTime",0),this.getAppId=()=>this.store.get("params.appId"),this.setAppId=t=>this.store.set("params.appId",t),this.setBrowser=t=>this.store.set("params.browser",t),this.getBrowser=()=>this.store.get("params.browser"),this.setOs=t=>this.store.set("params.os",t),this.getOs=()=>this.store.get("params.os"),this.setBrowserVersion=t=>this.store.set("params.browserVersion",t),this.getBrowserVersion=()=>this.store.get("params.browserVersion"),this.setDeviceType=t=>this.store.set("params.deviceType",t),this.getDeviceType=()=>this.store.get("params.deviceType"),this.setLanguage=t=>this.store.set("params.language",t),this.getLanguage=()=>this.store.get("params.language","en"),this.setApiEntrypoint=t=>this.store.set("params.apiEntrypoint",t),this.getApiEntrypoint=()=>this.store.get("params.apiEntrypoint",r.DEFAULT_API_ENDPOINT),this.setServiceWorkerVersion=t=>this.store.set("params.serviceWorkerVersion",t),this.getServiceWorkerVersion=()=>this.store.get("params.serviceWorkerVersion"),this.setDefaultNotificationImage=t=>this.store.set("params.defaultNotificationImage",t),this.getDefaultNotificationImage=()=>this.store.get("params.defaultNotificationImage",r.DEFAULT_NOTIFICATION_IMAGE),this.setServiceWorkerUrl=t=>this.store.set("params.serviceWorkerUrl",t),this.getServiceWorkerUrl=()=>this.store.get("params.serviceWorkerUrl",r.DEFAULT_SERVICE_WORKER_URL),this.setServiceWorkerScope=t=>t&&this.store.set("params.serviceWorkerScope",t),this.getServiceWorkerScope=()=>this.store.get("params.serviceWorkerScope",r.DEFAULT_SERVICE_WORKER_SCOPE),this.setLastPermissionStatus=t=>this.store.set("params.isLastPermissionStatus",t),this.getLastPermissionStatus=()=>this.store.get("params.isLastPermissionStatus"),this.setPromptDisplayCount=t=>this.store.set("params.promptDisplayCount",t),this.getPromptDisplayCount=()=>this.store.get("params.promptDisplayCount",0),this.setPromptLastSeenTime=t=>this.store.set("params.promptLastSeenTime",t),this.getPromptLastSeenTime=()=>this.store.get("params.promptLastSeenTime",0),this.setDefaultNotificationTitle=t=>this.store.set("params.defaultNotificationTitle",t),this.getDefaultNotificationTitle=()=>this.store.get("params.defaultNotificationTitle",r.DEFAULT_NOTIFICATION_TITLE),this.setPushSubscription=t=>this.store.set("params.pushSubscription",t),this.getPushSubscription=()=>this.store.get("params.pushSubscription"),this.setSubscriptionId=t=>this.store.set("params.subscriptionId",t),this.getSubscriptionId=()=>this.store.get("params.subscriptionId"),this.setSubscriber=t=>this.store.set("params.subscriber",t),this.getSubscriber=()=>this.store.get("params.subscriber"),this.setDisableBranding=t=>this.store.set("params.disableBranding",t),this.getDisableBranding=()=>this.store.get("params.disableBranding",!1),this.setSubscriptionOnSubDomain=t=>this.store.set("params.subscriptionOnSubDomain",t),this.isSubscriptionOnSubDomain=()=>this.store.get("params.subscriptionOnSubDomain",!1),this.setUniversalSubscriptionLink=t=>this.store.set("params.universalSubscriptionLink",t),this.isUniversalSubscriptionLink=()=>this.store.get("params.universalSubscriptionLink",!1),this.setIpInfo=t=>this.store.set("params.ipInfo",t),this.getIpInfo=()=>this.store.get("params.ipInfo"),this.setSubDomain=t=>this.store.set("params.subDomain",t),this.getSubDomain=()=>this.store.get("params.subDomain"),this.setAppUrl=t=>this.store.set("params.appUrl",t),this.getAppUrl=()=>this.store.get("params.appUrl"),this.setAppSettings=t=>this.store.set("params.appSettings",t),this.getAppSettings=()=>this.store.get("params.appSettings"),this.setManualUnSubscribed=t=>this.store.set("params.manualUnsubscribed",t),this.isManualUnSubscribed=()=>this.store.get("params.manualUnsubscribed",!1),this.setActivePrompt=t=>this.store.set("params.activePrompt",t),this.getActivePrompt=()=>this.store.get("params.activePrompt"),this.setSubWidget=t=>this.store.set("params.activeSubWidget",t),this.getSubWidget=()=>this.store.get("params.activeSubWidget"),this.setUnSubWidget=t=>this.store.set("params.activeUnSubWidget",t),this.getUnSubWidget=()=>this.store.get("params.activeUnSubWidget"),this.setPermissionWidget=t=>this.store.set("params.permissionResetWidget",t),this.getPermissionWidget=()=>this.store.get("params.permissionResetWidget"),this.setNativePrompt=t=>this.store.set("params.nativePrompt",t),this.getNativePrompt=()=>this.store.get("params.nativePrompt")}clearAll(){return i(this,void 0,void 0,(function*(){yield Promise.all(["params.os","params.appId","params.appUrl","params.ipInfo","params.language","params.browser","params.deviceType","params.subscriber","params.sdkVersion","params.apiEntrypoint","params.subscriptionId","params.browserVersion","params.disableBranding","params.pushSubscription","params.promptDisplayCount","params.promptLastSeenTime","params.manualUnsubscribed","params.applicationServerKey","params.isLastPermissionStatus","params.lastOpenApplicationTime","params.subscriptionOnSubDomain","params.defaultNotificationImage","params.defaultNotificationTitle","params.universalSubscriptionLink","params.subDomain","params.appSettings","params.serviceWorkerUrl","params.serviceWorkerScope","params.serviceWorkerVersion","params.activePrompt","params.nativePrompt","params.activeSubWidget","params.activeUnSubWidget","params.permissionResetWidget"].map((t=>this.store.set(t,void 0))))}))}}},950:function(t,e,n){var i=this&&this.__awaiter||function(t,e,n,i){return new(n||(n=Promise))((function(o,r){function s(t){try{c(i.next(t))}catch(t){r(t)}}function a(t){try{c(i.throw(t))}catch(t){r(t)}}function c(t){var e;t.done?o(t.value):(e=t.value,e instanceof n?e:new n((function(t){t(e)}))).then(s,a)}c((i=i.apply(t,e||[])).next())}))};Object.defineProperty(e,"__esModule",{value:!0}),e.onSWFailure=function(t,e){return i(this,void 0,void 0,(function*(){var n,i;const s=e.toString(),a=null===(i=null===(n=null==e?void 0:e.data)||void 0===n?void 0:n.json)||void 0===i?void 0:i.call(n),c=(null==e?void 0:e.notification)&&JSON.stringify(e.notification),p={logLevel:"ERROR",source:"SERVICE_WORKER",href:self.location.href,message:t.toString(),appId:yield o.data.getAppId(),browser:yield o.data.getBrowser(),cause:yield o.data.getServiceWorkerVersion(),subscriberId:yield o.data.getSubscriptionId(),sdkVersion:yield o.data.getServiceWorkerVersion(),stackTrace:c||a||s};self.dispatchEvent(new CustomEvent(r.EVENT_ON_SW_ERROR,{detail:{systemLog:p}}))}))},e.sendLogMsgToRemoteServer=function(t){return i(this,void 0,void 0,(function*(){const{systemLog:e}=t.detail;yield s.postSystemLog(e),console.error(JSON.stringify(e))}))},e.logSDKFailure=function(t){return i(this,void 0,void 0,(function*(){const e={logLevel:"ERROR",source:"WEB_SDK",href:self.location.href,message:t.toString(),appId:yield o.data.getAppId(),browser:yield o.data.getBrowser(),cause:yield o.data.getServiceWorkerVersion(),subscriberId:yield o.data.getSubscriptionId(),sdkVersion:yield o.data.getServiceWorkerVersion()};self.dispatchEvent(new CustomEvent(r.EVENT_ON_SDK_ERROR,{detail:{systemLog:e}}))}))};const o=n(911),r=n(870),s=new(n(729).Api)}},e={};function n(i){var o=e[i];if(void 0!==o)return o.exports;var r=e[i]={exports:{}};return t[i].call(r.exports,r,r.exports,n),r.exports}n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})};n(694)})();
\n
\n Website Notifications
\n \n
\n
\n ${t.headerText}
\n ${(0,e.buildSegmentCheckbox)(t)}\n\n \n ${t.buttonCancelText}\n
\n ${t.disableBranding?"":'\n \n Powered by AlertWise\n
\n '}\n