web-push-notifications 3.57.0 → 3.58.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/npm.js +1 -1
- package/package.json +2 -2
- package/service-worker.js +1 -1
- package/widget-web-popups.js +2 -0
- package/widget-web-popups.js.map +1 -0
package/npm.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var a in s)("object"==typeof exports?exports:t)[a]=s[a]}}(this,()=>(()=>{"use strict";var t={d:(e,s)=>{for(var a in s)t.o(s,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:s[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Pushwoosh:()=>gt});const s="/pushwoosh-service-worker.js",a="deviceRegistrationStatus",i="registered",r="unregistered",n="denied",o="granted",c="default",u="onReady",h="onSubscribe",d="onUnsubscribe",g="onRegister",l="onPermissionPrompt",p="onPermissionDenied",m="onPermissionGranted",w="onSWInitError",b="onPushDelivery",v="onNotificationClick",y="onNotificationClose",f="onChangeCommunicationEnabled",S="onPutNewMessageToInboxStore",P="onUpdateInboxMessages",C="onShowNotificationPermissionDialog",k="onHideNotificationPermissionDialog",I="onShowSubscriptionWidget",E="onHideSubscriptionWidget",D="PW_SiteOpened",x={autoSubscribe:!0,serviceWorkerUrl:s};function M(){return globalThis}function T(){return crypto.randomUUID?.()||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}const _=t=>"function"==typeof t,W={[g]:{name:"register"},[h]:{name:"subscribe"},[d]:{name:"unsubscribe"},[w]:{name:"initialize-service-worker-error",prop:"error"},[b]:{name:"receive-push",prop:"notification"},[v]:{name:"open-notification",prop:"notification"},[y]:{name:"hide-notification",prop:"notification"},[f]:{name:"change-enabled-communication",prop:"isEnabled"},[S]:{name:"receive-inbox-message",prop:"message"},[P]:{name:"update-inbox-messages",prop:"messages"},[C]:{name:"show-notification-permission-dialog"},[k]:{name:"hide-notification-permission-dialog",prop:"permission"},[I]:{name:"show-subscription-widget"},[E]:{name:"hide-subscription-widget"},[p]:{name:"permission-denied"},[l]:{name:"permission-default"},[m]:{name:"permission-granted"}},A="keyValue",R="messages",N="log",L="inboxMessages";function O(t,e){return function(s){s.objectStoreNames.contains(t)||e(s)}}const q=[O(A,function(t){t.createObjectStore(A,{keyPath:"key"})}),O(N,function(t){const e=t.createObjectStore(N,{keyPath:"id",autoIncrement:!0});e.createIndex("environment","environment",{unique:!1}),e.createIndex("date","date",{unique:!1}),e.createIndex("type","type",{unique:!1})}),O(R,function(t){t.createObjectStore(R,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),O(L,function(t){const e="status",s=t.createObjectStore(L,{keyPath:"inbox_id",autoIncrement:!1});s.createIndex(e,e,{unique:!1,multiEntry:!0}),s.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class U{get all(){return q}}class B{constructor(t,e=new U){this.db=t,this.migrationsBuilder=e}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(t){t.forEach(t=>{t(this.db)})}}function F(t,e){console.info("onversionchange",e),t.close()}let V;function j(){return V||(V=new Promise((t,e)=>{const s=indexedDB.open("PUSHWOOSH_SDK_STORE",7);s.onsuccess=s=>{const a=s.target.result;a.onversionchange=F.bind(null,a,e),t(a)},s.onerror=()=>e(s.error),s.onupgradeneeded=t=>{const s=t.target.result;s.onversionchange=F.bind(null,s,e);new B(s).applyMigrations()}})),V}function $(t){return j().then(e=>new Promise((s,a)=>t(e,s,a)))}class H{_add(t){return $((e,s,a)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).add(t);i.onsuccess=()=>{s(t)},i.onerror=()=>{a(i.error)}}).then(t=>this.getAll().then(e=>{if(Array.isArray(e)){const s=e.map(t=>t.id).sort((t,e)=>t==e?0:t<e?1:-1);if(s.length>this.maxItems)return Promise.all(s.slice(this.maxItems).map(t=>this.delete(t))).then(()=>t)}return t}))}delete(t){return $((e,s,a)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).delete(t);i.onsuccess=()=>{s(i.result)},i.onerror=()=>{a(i.error)}})}getAll(){return $((t,e,s)=>{const a=[],i=t.transaction(this.name).objectStore(this.name).openCursor();i.onsuccess=t=>{const s=t.target.result;s?(s.value&&a.push(s.value),s.continue()):e(a)},i.onerror=()=>{s(i.error)}})}}const K=(z=A,{get:(t,e)=>$((s,a,i)=>{const r=s.transaction(z).objectStore(z).get(t);let n,o=!1,c=!1;const u=()=>{clearTimeout(n),o?a(r.result?.value||e):c?i(r.error):n=setTimeout(u,0)};r.onsuccess=()=>o=!0,r.onerror=()=>c=!0,u()}),getAll:()=>$((t,e,s)=>{const a={},i=t.transaction(z).objectStore(z).openCursor();let r,n=!1,o=!1;const c=()=>{clearTimeout(r),n?e(a):o?s(i.error):r=setTimeout(c,0)};i.onsuccess=t=>{const e=t.target.result;e?(a[e.key]=e.value.value,e.continue()):n=!0},i.onerror=()=>o=!0,c()}),async extend(t,e){const s=await this.get(t),{...a}=e;await this.set(t,{...s,...a})},set:(t,e)=>$((s,a,i)=>{const r=s.transaction([z],"readwrite").objectStore(z).put({key:t,value:e});let n,o=!1,c=!1;const u=()=>{clearTimeout(n),o?a(t):c?i(r.error):n=setTimeout(u,0)};r.onsuccess=()=>o=!0,r.onerror=()=>c=!0,u()})});var z;const G=new class extends H{constructor(){super(...arguments),this.name=N,this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(t,e,s){const a={type:t,environment:this.environment,message:`${e}`,date:new Date};return e instanceof Error&&(a.stack=e.stack),s&&(a.additional=s),this._add(a)}},J=new class extends H{constructor(){super(...arguments),this.name=R,this.maxItems=25}add(t){return this._add({...t,date:new Date})}},Y={error:1,info:2,debug:3};let Q=3;const X={setLevel(t){Y[t]||(t="error"),Q=Y[t]},write(t,e,s){return"error"===t?this.error(e):this.info(e),G.add(t,e,s)}};Object.keys(Y).forEach(t=>{const e=Y[t];X[t]=(...s)=>{e<=Q&&(console.groupCollapsed(t),console.info("",...s),console.trace("trace"),console.groupEnd())}});class Z{constructor(){this.addEventHandler=(t,e)=>{let s=this.handlers[t];s||(s=[]),s.push(e),this.handlers[t]=s},this.removeEventHandler=(t,e)=>{const s=this.handlers[t];s&&(this.handlers[t]=s.filter(t=>t!==e))},this.dispatchEvent=(t,e)=>{const s=e.eventId||T(),a=this.handlers[t];return a?(a.forEach(t=>{_(t)&&setTimeout(()=>{t({...e,eventId:s})},0)}),s):s},this.handlers={}}}class tt{constructor(t=new Date){this._date=t}set date(t){this._date=t}get date(){return this._date}getUtcTimestamp(){return Math.floor((this.date.getTime()+60*this.date.getTimezoneOffset()*1e3)/1e3)}getTimestamp(){return Math.round(this.date.getTime()/1e3)}setLocal(){const t=this._date.getTime()-60*this.date.getTimezoneOffset()*1e3;this._date=new Date(t)}addDays(t){const e=this._date.getTime()+24*t*60*60*1e3;this._date=new Date(e)}getInboxFakeOrder(){return(100*this._date.getTime()+9e9).toString()}}class et{constructor(t,e,s,a=new tt){this.data=t,this.api=e,this.inboxModel=s,this.dateModule=a,this.publicMessageBuilder=this.publicMessageBuilder.bind(this)}messageTypeFactory(t,e){let s=0;return 2===t?s=1:"l"in e&&null!=e.l&&(s=e.l.startsWith("http")?2:3),s}async updateMessagesStatusWithCodes(t,e,s){const a=[],i=[];e.forEach(async e=>{-1!==t.indexOf(e.inbox_id)&&(e.status=s,a.push(e),i.push(this.api.inboxStatus(e.order,e.status)))}),await this.inboxModel.putBulkMessages(a),await Promise.all(i)}async publicMessageBuilder({action_type:t,action_params:e,image:s,title:a,send_date:i,inbox_id:r,text:n,status:o}){const c=s||await this.data.getDefaultNotificationImage(),u=a||await this.data.getDefaultNotificationTitle(),h=JSON.parse(e);return this.dateModule.date=new Date(1e3*parseInt(i)),this.dateModule.setLocal(),{title:u,imageUrl:c,code:r,message:n,sendDate:this.dateModule.date.toISOString(),type:this.messageTypeFactory(t,h),link:h?.l||"/",isRead:2===o||3===o,isActionPerformed:3===o}}messagesWithNoActionPerformedCount(){return this.inboxModel.getDeliveredReadMessagesCount()}unreadMessagesCount(){return this.inboxModel.getDeliveredMessagesCount()}messagesCount(){return this.inboxModel.messagesCount()}async loadMessages(){const t=[...await this.inboxModel.getReadOpenMessages(),...await this.inboxModel.getDeliveredMessages()].sort((t,e)=>parseInt(e.send_date,10)-parseInt(t.send_date,10)).sort((t,e)=>parseInt(e.order||"0",10)-parseInt(t.order||"0",10)).map(this.publicMessageBuilder);return Promise.all(t)}async readMessagesWithCodes(t){const e=await this.inboxModel.getDeliveredMessages();await this.updateMessagesStatusWithCodes(t,e,2)}async performActionForMessageWithCode(t){const e=await this.inboxModel.getMessage(t),s=JSON.parse(e.action_params),a=this.messageTypeFactory(e.action_type,s);2===a&&null!=s.l?document.location.href=s.l:3===a&&null!=s.l&&window.history.go(s.l),e.status=3,await this.inboxModel.putMessage(e),await this.api.inboxStatus(e.order,e.status)}async deleteMessagesWithCodes(t){const e=await this.inboxModel.getReadOpenMessages(),s=await this.inboxModel.getDeliveredMessages();await this.updateMessagesStatusWithCodes(t,[...e,...s],4)}async syncMessages(){await this.inboxModel.updateMessages()}}class st{constructor(t,e){this.name=e,this.store=t.transaction(this.name,"readwrite").objectStore(this.name)}set index(t){this.store.indexNames.contains(t)?this._index=this.store.index(t):console.warn(`Index "${t}" in `)}writeRequestPromise(t,e){return new Promise((s,a)=>{t.onsuccess=()=>{s(e)},t.onerror=()=>{a(t.error)}})}readRequestPromise(t,e){return new Promise((s,a)=>{t.onsuccess=t=>{const a=t.target;s(a.result||e)},t.onerror=()=>{a(t.error)}})}put(t,e){const s=this.store.put(t,e);return this.writeRequestPromise(s,e)}add(t,e){return this.put(t,e)}delete(t){const e=this.store.delete(t);return this.writeRequestPromise(e)}get(t,e){const s=this.store.get(t);return this.readRequestPromise(s,e)}getAll(){const t=this.store.openCursor(),e=[];return new Promise((s,a)=>{t.onsuccess=t=>{const a=t.target.result;a?(e.push(a.value),a.continue()):s(e)},t.onerror=()=>{a(t.error)}})}count(t){const e=this.store.count(t);return this.readRequestPromise(e,0)}countByIndex(t){const e=this._index.count(t);return this.readRequestPromise(e,0)}}class at{getDB(){return j()}async put(t,e,s){const a=await this.getDB();return new st(a,t).put(e,s)}async delete(t,e){const s=await this.getDB();return new st(s,t).delete(e)}async get(t,e,s){const a=await this.getDB();return new st(a,t).get(e,s)}async getAll(t){const e=await this.getDB(),s=new st(e,t);return await s.getAll()||[]}async count(t,e){const s=await this.getDB();return new st(s,t).count(e)}async countByIndex(t,e,s){const a=await this.getDB(),i=new st(a,t);return i.index=e,i.countByIndex(s)}}class it{constructor(t,e,s,a=new at,i=new tt){this.eventBus=t,this.data=e,this.api=s,this.storage=a,this.storeName="inboxMessages",this.dateModule=i}async getInboxMessages(){const t=await this.api.getInboxMessages();return await this.storeGetInboxMessagesRequestParams(t.next,t.new_inbox),t}async storeGetInboxMessagesRequestParams(t,e){this.dateModule.date=new Date,await this.data.setInboxLastRequestTime(this.dateModule.getUtcTimestamp()),await this.data.setInboxLastRequestCode(t),await this.data.setInboxNewMessagesCount(e)}async putServerMessages(t){const e=t.map(async t=>{const e=await this.storage.get(this.storeName,t.inbox_id,{});return"status"in e&&(t.status=e.status),this.putMessage(t)});return Promise.all(e)}putMessage(t){return this.storage.put(this.storeName,t)}putBulkMessages(t){const e=t.map(t=>this.putMessage(t));return Promise.all(e)}deleteMessages(t){const e=t.map(t=>this.storage.delete(this.storeName,t));return Promise.all(e)}async deleteExpiredMessages(){this.dateModule.date=new Date;const t=this.dateModule.getTimestamp().toString(),e=(await this.storage.getAll(this.storeName)).filter(e=>e.rt<t).map(t=>t.inbox_id);return this.deleteMessages(e)}getMessage(t){return this.storage.get(this.storeName,t)}async getReadOpenMessages(){return(await this.storage.getAll(this.storeName)).filter(t=>2===t.status||3===t.status)}async getDeliveredMessages(){return(await this.storage.getAll(this.storeName)).filter(t=>1===t.status)}async messagesCount(){return this.storage.count(this.storeName)}async getDeliveredMessagesCount(){return this.storage.countByIndex(this.storeName,"status",1)}async getReadMessagesCount(){return this.storage.countByIndex(this.storeName,"status",2)}async getDeliveredReadMessagesCount(){const[t,e]=[2,3],s=IDBKeyRange.bound(t,e);return this.storage.countByIndex(this.storeName,"status",s)}async updateMessages(){const t=await this.getInboxMessages();await this.deleteExpiredMessages(),t.deleted&&await this.deleteMessages(t.deleted),await this.putServerMessages(t.messages),this.eventBus.dispatchEvent("update-inbox-messages",{messages:new et(this.data,this.api,this)})}}const rt=t=>`params.${t}`;class nt{constructor(t=K){this.store=t}async clearAll(){const t=["applicationCode","apiToken","hwid","deviceType","deviceModel","language","languageWasChanged","apiEntrypoint","tokens","applicationServerKey","isVapidChanged","webSitePushId","defaultNotificationImage","defaultNotificationTitle","userId","userIdWasChanged","email","emailWasChanged","isLastPermissionStatus","isManualUnsubscribed","isCommunicationDisabled","communicationEnabled","isDropAllData","sdkVersion","serviceWorkerVersion","serviceWorkerUrl","serviceWorkerScope","lastOpenMessage","lastOpenApplicationTime","features","init","inbox.lastRequestCode","inbox.lastRequestTime","inbox.newMessagesCount","delayedEvent","promptDisplayCount","promptLastSeenTime","logLevel","shownWebPopups","isRecurringVisitor"];for(const e of t)await this.store.set(rt(e),void 0)}async setApplicationCode(t){await this.store.set(rt("applicationCode"),t)}async getApplicationCode(){return this.store.get(rt("applicationCode"))}async setApiToken(t){return await this.store.set(rt("apiToken"),t)}async getApiToken(){return this.store.get(rt("apiToken"))}async setHwid(t){await this.store.set(rt("hwid"),t)}async getHwid(){return this.store.get(rt("hwid"))}async setDeviceType(t){await this.store.set(rt("deviceType"),t)}async getDeviceType(){return this.store.get(rt("deviceType"))}async setFormFactor(t){await this.store.set(rt("formFactor"),t)}async getFormFactor(){return this.store.get(rt("formFactor"))}async setDeviceModel(t){await this.store.set(rt("deviceModel"),t)}async getDeviceModel(){return this.store.get(rt("deviceModel"))}async setLanguage(t){await this.store.set(rt("language"),t)}async getLanguage(){return this.store.get(rt("language"),"en")}async setStatusLanguageWasChanged(t){await this.store.set(rt("languageWasChanged"),t)}async getStatusLanguageWasChanged(){return this.store.get(rt("languageWasChanged"),!1)}async setApiEntrypoint(t){await this.store.set(rt("apiEntrypoint"),t)}async getApiEntrypoint(){return this.store.get(rt("apiEntrypoint"),"https://api.pushwoosh.com/json/1.3/")}async setTokens(t){await this.store.set(rt("tokens"),t)}getTokens(){return this.store.get(rt("tokens"))}async setApplicationServerKey(t){await this.store.set(rt("applicationServerKey"),t)}async getApplicationServerKey(){return this.store.get(rt("applicationServerKey"))}async setIsVapidChanged(t){await this.store.set(rt("isVapidChanged"),t)}async getIsVapidChanged(){return this.store.get(rt("isVapidChanged"),!1)}async setWebSitePushId(t){await this.store.set(rt("webSitePushId"),t)}async getWebSitePushId(){return this.store.get(rt("webSitePushId"))}async setDefaultNotificationImage(t){await this.store.set(rt("defaultNotificationImage"),t)}async getDefaultNotificationImage(){return this.store.get(rt("defaultNotificationImage"),"https://cp.pushwoosh.com/img/logo-medium.png")}async setDefaultNotificationTitle(t){await this.store.set(rt("defaultNotificationTitle"),t)}async getDefaultNotificationTitle(){return this.store.get(rt("defaultNotificationTitle"),"Pushwoosh notification")}async setUserId(t){await this.store.set(rt("userId"),t?`${t}`:void 0)}async getUserId(){return this.store.get(rt("userId"))}async setStatusUserIdWasChanged(t){await this.store.set(rt("userIdWasChanged"),t)}async getStatusUserIdWasChanged(){return this.store.get(rt("userIdWasChanged"),!1)}async setEmail(t){await this.store.set(rt("email"),t?`${t}`:void 0)}async getEmail(){return this.store.get(rt("email"))}async setStatusEmailWasChanged(t){await this.store.set(rt("emailWasChanged"),t)}async getStatusEmailWasChanged(){return this.store.get(rt("emailWasChanged"),!1)}async setSmsNumber(t){await this.store.set(rt("smsNumber"),t?`${t}`:void 0)}async getSmsNumber(){return this.store.get(rt("smsNumber"))}async setStatusSmsNumberWasChanged(t){await this.store.set(rt("smsNumberWasChanged"),t)}async getStatusSmsNumberWasChanged(){return this.store.get(rt("smsNumberWasChanged"),!1)}async setWhatsAppNumber(t){await this.store.set(rt("whatsAppNumber"),t?`${t}`:void 0)}async getWhatsAppNumber(){return this.store.get(rt("whatsAppNumber"))}async setStatusWhatsAppNumberWasChanged(t){await this.store.set(rt("whatsAppNumberWasChanged"),t)}async getStatusWhatsAppNumberWasChanged(){return this.store.get(rt("whatsAppNumberWasChanged"),!1)}async setLastPermissionStatus(t){await this.store.set(rt("isLastPermissionStatus"),t)}async getLastPermissionStatus(){return this.store.get(rt("isLastPermissionStatus"))}async setStatusManualUnsubscribed(t){await this.store.set(rt("isManualUnsubscribed"),t)}getStatusManualUnsubscribed(){return this.store.get(rt("isManualUnsubscribed"),!1)}async setStatusCommunicationDisabled(t){await this.store.set(rt("isCommunicationDisabled"),t)}getStatusCommunicationDisabled(){return this.store.get(rt("isCommunicationDisabled"),!1)}async setCommunicationEnabled(t){await this.store.set(rt("communicationEnabled"),t)}getCommunicationEnabled(){return this.store.get(rt("communicationEnabled"))}async setStatusDropAllData(t){await this.store.set(rt("isDropAllData"),t)}getStatusDropAllData(){return this.store.get(rt("isDropAllData"),!1)}async setSdkVersion(t){await this.store.set(rt("sdkVersion"),t)}async getSdkVersion(){return this.store.get(rt("sdkVersion"))}async setServiceWorkerVersion(t){await this.store.set(rt("serviceWorkerVersion"),t)}getServiceWorkerVersion(){return this.store.get(rt("serviceWorkerVersion"))}async setServiceWorkerUrl(t){t&&await this.store.set(rt("serviceWorkerUrl"),t)}async getServiceWorkerUrl(){return this.store.get(rt("serviceWorkerUrl"),s)}async setServiceWorkerScope(t){t&&await this.store.set(rt("serviceWorkerScope"),t)}async getServiceWorkerScope(){return this.store.get(rt("serviceWorkerScope"))}async setLastOpenMessage(t){await this.store.set(rt("lastOpenMessage"),t)}getLastOpenMessage(){return this.store.get(rt("lastOpenMessage"))}async setLastOpenApplicationTime(t){await this.store.set(rt("lastOpenApplicationTime"),t)}async getLastOpenApplicationTime(){return this.store.get(rt("lastOpenApplicationTime"))}async setFeatures(t){await this.store.set(rt("features"),t)}async getFeatures(){return this.store.get(rt("features"))}async setInitParams(t){await this.store.set(rt("init"),t)}async getInitParams(){return this.store.get(rt("init"))}async setInboxLastRequestCode(t){await this.store.set(rt("inbox.lastRequestCode"),t)}async getInboxLastRequestCode(){return this.store.get(rt("inbox.lastRequestCode"),"")}async setInboxLastRequestTime(t){await this.store.set(rt("inbox.lastRequestTime"),t)}async getInboxLastRequestTime(){return this.store.get(rt("inbox.lastRequestTime"),0)}async setInboxNewMessagesCount(t){await this.store.set(rt("inbox.newMessagesCount"),t)}async getInboxNewMessagesCount(){return this.store.get(rt("inbox.newMessagesCount"),0)}async setDelayedEvent(t){await this.store.set(rt("delayedEvent"),t)}getDelayedEvent(){return this.store.get(rt("delayedEvent"))}async setPromptDisplayCount(t){await this.store.set(rt("promptDisplayCount"),t)}async getPromptDisplayCount(){return this.store.get(rt("promptDisplayCount"),0)}async setPromptLastSeenTime(t){await this.store.set(rt("promptLastSeenTime"),t)}async getPromptLastSeenTime(){return this.store.get(rt("promptLastSeenTime"),0)}async setLogLevel(t){await this.store.set(rt("logLevel"),t)}async getLogLevel(){return this.store.get(rt("logLevel"),"error")}async getShownWebPopups(){return this.store.get(rt("shownWebPopups"),[])}async addShownWebPopup(t){const e=await this.getShownWebPopups();e.includes(t)||(e.push(t),await this.store.set(rt("shownWebPopups"),e))}async setIsRecurringVisitor(t){await this.store.set(rt("isRecurringVisitor"),t)}async getIsRecurringVisitor(){return this.store.get(rt("isRecurringVisitor"),!1)}}class ot{constructor(t=new nt,e=X){this.data=t,this.logger=e}checkDevice(t){return this.createRequest("checkDevice",t)}getConfig(t){return this.createRequest("getConfig",t)}getPopupFormContent(t){return this.createRequest("getPopupFormContent",t)}recordPopupFormEvent(t){return this.createRequest("recordPopupFormEvent",t)}applicationOpen(t){return this.createRequest("applicationOpen",t)}registerDevice(t){return this.createRequest("registerDevice",t)}unregisterDevice(t){return this.createRequest("unregisterDevice",t)}deleteDevice(t){return this.createRequest("deleteDevice",t)}messageDeliveryEvent(t){return this.createRequest("messageDeliveryEvent",t)}pushStat(t){return this.createRequest("pushStat",t)}setTags(t){return this.createRequest("setTags",t)}getTags(t){return this.createRequest("getTags",t)}registerUser(t){return this.createRequest("registerUser",t)}registerEmail(t){return this.createRequest("registerEmail",t)}registerEmailUser(t){return this.createRequest("registerEmailUser",t)}setEmailTags(t){return this.createRequest("setEmailTags",t)}postEvent(t){return this.createRequest("postEvent",t)}getInboxMessages(t){return this.createRequest("getInboxMessages",t)}inboxStatus(t){return this.createRequest("inboxStatus",t)}pageVisit(t,e){return this.createRequest("pageVisit",t,e)}setPurchase(t){return this.createRequest("setPurchase",t)}multiRegisterDevice(t){return this.createRequest("multiRegisterDevice",t)}async createRequest(t,e,s){const a=await this.data.getApiEntrypoint(),i=await this.data.getApiToken(),r=s||a+t,n=i?{headers:{Authorization:`Token ${i}`,"Content-Type":"text/plain;charset=UTF-8",Origin:M().location.origin},credentials:"include"}:{},o=await fetch(r,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify({request:e}),...n}),c=await this.checkResponse(o);return c.base_url&&await this.data.setApiEntrypoint(c.base_url),await this.logger.write("apirequest",`${t} call with arguments: ${JSON.stringify(e)} to Pushwoosh has been successful. Result: ${JSON.stringify(c.response)}`),c.response}async checkResponse(t){if(200!==t.status){let e=`status: ${t.status}. statusText: ${t.statusText}.`;try{const s=await t.json();s&&s.status_message&&(e+=` status_code: ${s.status_code}. status_message: ${s.status_message}.`)}catch(t){}throw new Error(e)}const e=await t.json();if(200!==e.status_code)throw new Error(`Error code: ${e.status_code}. Error text: ${e.status_message}`);return e}}class ct{constructor(t,e=new nt,s=new ot,a=()=>!1){this.eventBus=t,this.data=e,this.apiClient=s,this.getIsCommunicationDisabled=a}async checkDevice(){const t=await this.getRequestParams();return await this.apiClient.checkDevice(t)}async checkDeviceSubscribeForPushNotifications(t=!0){let e=localStorage.getItem(a);if(void 0===e||!t){const{exist:t,push_token_exist:s}=await this.checkDevice();localStorage.setItem(a,t&&s?i:r),e=localStorage.getItem(a)}return e===i}async getConfig(t){const e=await this.getRequestParams();return this.apiClient.getConfig({...e,features:t})}async applicationOpen(){const t=await this.getRequestParams();return await this.data.setLastOpenApplicationTime(Date.now()),this.apiClient.applicationOpen(t)}async registerDevice(){if(await this.data.getStatusCommunicationDisabled())throw new Error("Can't register device: Communication is disabled!");const t=await this.getRequestParams(),e=await this.data.getTokens();if(!e.pushToken)throw new Error("Can't register device: pushToken is not exist!");const s=await this.apiClient.registerDevice({...t,push_token:e.pushToken,auth_token:e.authToken,public_key:e.publicKey});return await this.data.setStatusManualUnsubscribed(!1),localStorage.setItem(a,i),this.eventBus.dispatchEvent("register",{}),s}async unregisterDevice(){const t=await this.getRequestParams(),e=await this.apiClient.unregisterDevice(t);return localStorage.setItem(a,r),this.eventBus.dispatchEvent("unsubscribe",{}),e}async deleteDevice(){const t=await this.getRequestParams(),e=await this.apiClient.deleteDevice(t);return await this.data.setStatusManualUnsubscribed(!0),localStorage.setItem(a,r),this.eventBus.dispatchEvent("unsubscribe",{}),e}async messageDeliveryEvent(t,e,s={}){const a=await this.getRequestParams();return await this.apiClient.messageDeliveryEvent({...a,hash:t,metaData:s})}async pushStat(t,e,s={}){const a=await this.getRequestParams();return await this.apiClient.pushStat({...a,hash:t,metaData:s})}async setTags(t){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const{hwid:e,device_type:s,...a}=await this.getRequestParams(),i=await this.data.getEmail();return i&&await this.apiClient.setEmailTags({...a,email:i,tags:t}),this.apiClient.setTags({...a,hwid:e,device_type:s,tags:t})}async getTags(){const t=await this.getRequestParams();return this.apiClient.getTags(t)}async setLanguage(t){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):(await this.data.setLanguage(t),await this.data.setStatusLanguageWasChanged(!0),this.setTags({Language:t}))}async registerUser(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const{hwid:s,device_type:a,...i}=await this.getRequestParams(),r=await this.data.getDeviceType(),n=`${t}`,o=await this.apiClient.registerUser({...i,hwid:s,userId:n,ts_offset:60*-(new Date).getTimezoneOffset(),device_type:r});return await this.data.setUserId(n),e&&await this.data.setStatusUserIdWasChanged(!0),o}async registerEmail(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^\S+@\S+\.\S+$/.test(t))return Promise.reject(new Error("Invalid Email format"));const{hwid:s,device_type:a,...i}=await this.getRequestParams(),r=await this.apiClient.registerEmail({...i,email:t,ts_offset:60*-(new Date).getTimezoneOffset()});return await this.data.setEmail(t),e&&await this.data.setStatusEmailWasChanged(!0),r}async registerSmsNumber(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^\+?[0-9]+$/.test(t))return Promise.reject(new Error("Invalid Phone number format: +1234567890"));const{application:s,userId:a}=await this.getRequestParams(),i=await this.apiClient.registerDevice({application:s,userId:a,hwid:t,device_type:18});return await this.data.setSmsNumber(t),e&&await this.data.setStatusSmsNumberWasChanged(!0),i}async registerWhatsappNumber(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^(whatsapp:)?\+?[0-9]+$/.test(t))return Promise.reject(new Error("Invalid WhatsApp number format: +1234567890"));const{application:s,userId:a}=await this.getRequestParams(),i=await this.apiClient.registerDevice({application:s,userId:a,hwid:t,device_type:21});return await this.data.setWhatsAppNumber(t),e&&await this.data.setStatusWhatsAppNumberWasChanged(!0),i}async getPopupFormContent(t){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):this.apiClient.getPopupFormContent({...await this.getRequestParams(),code:t})}async recordPopupFormEvent(t,e){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):this.apiClient.recordPopupFormEvent({...await this.getRequestParams(),code:t,event:e})}async postEvent(t,e){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const s=await this.getRequestParams(),a=new Date,i=a.getTime(),r=Math.floor(i/1e3),n=r-a.getTimezoneOffset()/60*3600,o=await this.data.getLastOpenMessage();if(o&&o.expiry>Date.now()){if(e.msgHash)return Promise.reject(new Error("attribute msgHash already defined"));e={...e,msgHash:o.messageHash}}await this.data.setLastOpenMessage(void 0);const c=await this.apiClient.postEvent({...s,event:t,timestampUTC:r,timestampCurrent:n,attributes:e});return c&&c.code&&this.eventBus.dispatchEvent("receive-in-app-code",{code:c.code}),c}async getInboxMessages(t=0){const e=await this.getRequestParams(),s=await this.data.getInboxLastRequestCode(),a=await this.data.getInboxLastRequestTime();return this.apiClient.getInboxMessages({...e,count:t,last_code:s,last_request_time:a})}async inboxStatus(t,e){const s=await this.getRequestParams();return this.apiClient.inboxStatus({...s,inbox_code:t,status:e,time:(new Date).getTime()})}async pageVisit(t){const e=await this.getRequestParams(),s=await this.data.getFeatures(),a=s&&s.page_visit&&s.page_visit.entrypoint;if(a)return this.apiClient.pageVisit({...e,...t},a)}async setPurchase(t){const e=await this.getRequestParams();return this.apiClient.setPurchase({...e,...t})}async multiRegisterDevice(t){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const e=await this.data.getApplicationCode(),s=await this.data.getDeviceModel(),r=await this.data.getDeviceType(),n=await this.data.getLanguage(),o=await this.data.getSdkVersion(),c=await this.data.getTokens(),u=await this.data.getHwid(),h={application:e,...t};if(t.user_id){h.user_id=String(t.user_id);await this.data.getUserId()!==h.user_id&&(await this.data.setUserId(h.user_id),await this.data.setStatusUserIdWasChanged(!0))}if(t.email){if(!/^\S+@\S+\.\S+$/.test(t.email))return Promise.reject(new Error("Invalid Email format"));await this.data.getEmail()!==t.email&&(await this.data.setEmail(t.email),await this.data.setStatusEmailWasChanged(!0))}if(t.sms_phone_number){if(!/^\+?[0-9]+$/.test(t.sms_phone_number))return Promise.reject(new Error("Invalid Phone number format: +1234567890"));await this.data.getSmsNumber()!==t.sms_phone_number&&(await this.data.setSmsNumber(t.sms_phone_number),await this.data.setStatusSmsNumberWasChanged(!0))}if(t.whatsapp_phone_number){if(!/^(whatsapp:)?\+?[0-9]+$/.test(t.whatsapp_phone_number))return Promise.reject(new Error("Invalid WhatsApp number format: +1234567890"));await this.data.getWhatsAppNumber()!==t.whatsapp_phone_number&&(await this.data.setWhatsAppNumber(t.whatsapp_phone_number),await this.data.setStatusWhatsAppNumberWasChanged(!0))}if(h.language?(await this.data.setLanguage(h.language),await this.data.setStatusLanguageWasChanged(!0)):h.language=n,!h.timezone){const t=60*-(new Date).getTimezoneOffset();h.timezone=String(t)}if(!h.push_devices&&c.pushToken){const t={hwid:u,platform:r,push_token:c.pushToken,sdk_version:o};if(c.publicKey||c.authToken||s){const e={};c.publicKey&&(e.public_key=c.publicKey),c.authToken&&(e.auth_token=c.authToken),s&&(e.browser=s),t.platformData=e}h.push_devices=[t]}const d=await this.apiClient.multiRegisterDevice(h);return h.push_devices?.length&&(await this.data.setStatusManualUnsubscribed(!1),localStorage.setItem(a,i),this.eventBus.dispatchEvent("register",{})),d}async getParams(){return{applicationCode:await this.data.getApplicationCode(),hwid:await this.data.getHwid(),...await this.data.getTokens(),...await this.data.getInitParams()}}async getRequestParams(){const t=await this.data.getApplicationCode(),e=await this.data.getHwid(),s=await this.data.getUserId(),a=await this.data.getDeviceType(),i=await this.data.getDeviceModel(),r=await this.data.getLanguage(),n=await this.data.getSdkVersion();return{application:t,hwid:e,userId:s||e,device_type:a,device_model:i,timezone:60*-(new Date).getTimezoneOffset(),language:r,v:n}}}class ut{constructor(t){this.global=t,this._isSafari=this.isSafariBrowser(),this._isOpera=this.isOperaBrowser(),this._isEdge=this.isEdgeBrowser(),this._isFirefox=this.isFirefoxBrowser(),this._isChrome=this.isChromeBrowser(),this._isMacOS=this.isMacOS(),this._isAvailableServiceWorker=this.canUseServiceWorkers(),this._isAvailableNotifications=this.canReceiveNotifications(),this._platform=this.getPlatformType(),this._browserVersion=this.getBrowserVersion(),this._formFactor=this.getFormFactor()}get isEdge(){return this._isEdge}get isSafari(){return this._isSafari}get isOpera(){return this._isOpera}get isAvailableServiceWorker(){return this._isAvailableServiceWorker}get isAvailableNotifications(){return this._isAvailableNotifications}get platform(){return this._platform}get browserVersion(){return this._browserVersion}get formFactor(){return this._formFactor}get isMobile(){return"MOBILE"===this._formFactor}get isDesktop(){return"DESKTOP"===this._formFactor}isSafariBrowser(){return"safari"in this.global&&navigator.userAgent.indexOf("Safari")>-1}isOperaBrowser(){return-1!==navigator.userAgent.indexOf("Opera")||-1!==navigator.userAgent.indexOf("OPR")}isEdgeBrowser(){return navigator.userAgent.indexOf("Edge")>-1}isFirefoxBrowser(){return-1!==navigator.userAgent.toLowerCase().indexOf("firefox")}isChromeBrowser(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)&&!this._isOpera&&!this._isEdge}isMacOS(){return"platform"in navigator&&-1!==navigator.platform.toLowerCase().indexOf("mac")}canUseServiceWorkers(){return!!navigator.serviceWorker&&"PushManager"in this.global&&"Notification"in this.global}canReceiveNotifications(){return this._isSafari&&this._isMacOS||this._isAvailableServiceWorker&&!this._isEdge}getPlatformType(){let t=11;switch(!0){case this._isSafari:t=10;break;case this._isOpera||this._isChrome:t=11;break;case this._isFirefox:t=12;break;case this._isEdge:t=150}return t}getFormFactor(){const t=navigator.userAgentData;if(t&&"boolean"==typeof t.mobile)return t.mobile?"MOBILE":"DESKTOP";return/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"MOBILE":"DESKTOP"}getBrowserVersion(){const{userAgent:t}=navigator,e=t.match(/\bOPR\/(\d+)/);if(null!==e)return`Opera ${e[1]}`;const s=t.match(/\bEdge\/(\d+)/);if(null!==s)return`Edge ${s[1]}`;const a=t.match(/\bEdg\/(\d+)/);if(null!==a)return`Edge ${a[1]}`;let i=t.match(/(opera|chrome|safari|firefox(?=\/))\/?\s*(\d+)/i)||[];const[,r=""]=i;i=i[2]?[r,i[2]]:[navigator.appName,navigator.appVersion,"-?"];const n=t.match(/version\/([.\d]+)/i);return null!==n&&i.splice(1,1,n[1]),i.join(" ")}}class ht{constructor(t,e,s){this.api=t,this.data=e,this.config=s}getPermission(){return Notification.permission}checkIsPermissionGranted(){return this.getPermission()===o}checkIsPermissionDefault(){return this.getPermission()===c}async checkIsManualUnsubscribed(){return this.data.getStatusManualUnsubscribed()}async askPermission(){await Notification.requestPermission()}async getTokens(){return this.data.getTokens()}async subscribe(t){const e=t||await this.trySubscribe();if(!this.checkIsPermissionGranted())return void X.error("You must have permission granted before subscribe!");const s=this.getPushToken(e),a=e.getKey("p256dh"),i=e.getKey("auth");if(!a||!i)throw new Error("Can't get subscription keys!");const r=btoa(String.fromCharCode.apply(String,new Uint8Array(a))),n=btoa(String.fromCharCode.apply(String,new Uint8Array(i)));await this.data.setTokens({publicKey:r,pushToken:s,authToken:n,endpoint:e.endpoint}),await this.api.registerDevice()}async unsubscribe(){const t=await this.getServiceWorkerRegistration(),e=await t.pushManager.getSubscription();await this.data.setTokens({}),await this.data.setStatusManualUnsubscribed(!0),await this.api.unregisterDevice(),e&&await e.unsubscribe()}async checkIsRegister(){return this.api.checkDeviceSubscribeForPushNotifications()}async checkIsNeedResubscribe(){const t=await this.data.getLastPermissionStatus(),e=this.getPermission();if(t!==e)return await this.data.setLastPermissionStatus(e),!0;const s=await this.getCredentials(),a=this.getPushToken(s),i=await this.data.getTokens(),r=a===(i&&i.pushToken||""),n=await this.data.getIsVapidChanged();return!r||n}async getServiceWorkerRegistration(){if(!this.registration){await this.registerServiceWorker();const t=await this.data.getServiceWorkerUrl();this.registration=await navigator.serviceWorker.getRegistration(t),await this.registration.update()}if(!this.registration)throw new Error("Internal Error: Can't register service worker!");return this.registration}async registerServiceWorker(){const t=await this.data.getServiceWorkerUrl(),e=await this.data.getServiceWorkerScope();let s="";await this.data.getSdkVersion()!==await this.data.getServiceWorkerVersion()&&(s=`?cache_clean=${T()}`),await navigator.serviceWorker.register(`${t}${s}`,{scope:e})}async trySubscribe(){try{return await this.subscribePushManager()}catch(t){return console.error(t),await this.unsubscribe(),this.subscribePushManager()}}async subscribePushManager(){const t=await this.getServiceWorkerRegistration(),e=await this.getApplicationServerKey();return t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e?this.urlBase64ToUint8Array(e):null})}async getCredentials(){const t=await this.getServiceWorkerRegistration();return await t.pushManager.getSubscription()}getPushToken(t){return t?t.endpoint:""}async getApplicationServerKey(){return await this.data.getApplicationServerKey()}urlBase64ToUint8Array(t){const e=(t+"=".repeat((4-t.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),s=atob(e),a=new Uint8Array(s.length);for(let t=0;t<s.length;++t)a[t]=s.charCodeAt(t);return a}}class dt{constructor(t,e,s){this.api=t,this.config=s,this.data=e}getPermission(){const{permission:t}=this.getPermissionInfo();return t}checkIsPermissionGranted(){return this.getPermission()===o}checkIsPermissionDefault(){return this.getPermission()===c}async checkIsManualUnsubscribed(){return await this.data.getStatusManualUnsubscribed()}async askPermission(){const t={application:await this.data.getApplicationCode(),hwid:await this.data.getHwid()};return new Promise(e=>{safari.pushNotification.requestPermission(this.config.entrypoint||"https://cp.pushwoosh.com/json/1.3/safari",this.config.webSitePushId,t,()=>e())})}getTokens(){return this.data.getTokens()}async subscribe(){if(!this.checkIsPermissionGranted())return void X.error("You must have permission granted before subscribe!");const{deviceToken:t}=this.getPermissionInfo();await this.data.setTokens({pushToken:t}),await this.api.registerDevice()}async unsubscribe(){await this.data.setTokens({}),await this.data.setStatusManualUnsubscribed(!0),await this.api.unregisterDevice()}async checkIsRegister(){return this.api.checkDeviceSubscribeForPushNotifications()}async checkIsNeedResubscribe(){const t=await this.data.getWebSitePushId(),e=void 0!==t&&this.config.webSitePushId!==t;await this.data.setWebSitePushId(this.config.webSitePushId);const s=await this.data.getLastPermissionStatus(),a=this.getPermission();return s!==a?(await this.data.setLastPermissionStatus(a),!0):e}getPermissionInfo(){return safari.pushNotification.permission(this.config.webSitePushId)}}class gt{constructor(){this.ready=!1,this.moduleRegistry={},this.addEventHandler=(t,e)=>this.eventBus.addEventHandler(t,e),this.removeEventHandler=(t,e)=>this.eventBus.removeEventHandler(t,e),this.dispatchEvent=(t,e)=>this.eventBus.dispatchEvent(t,e),this.debug={async showLog(){const t=await G.getAll();console.log(t)},async showKeyValues(){const t=await K.getAll();console.log(t)},async showMessages(){(await J.getAll()).forEach(t=>console.log(t))}},this.eventBus=new Z,this.data=new nt,this.apiClient=new ot(this.data),this.api=new ct(this.eventBus,this.data,this.apiClient,()=>this.isCommunicationDisabled),this.platformChecker=new ut(M()),this.inboxModel=new it(this.eventBus,this.data,this.api),this.pwinbox=new et(this.data,this.api,this.inboxModel)}push(t){if(_(t))this.subscribeToLegacyEvents(u,t);else{if(!Array.isArray(t))throw new Error("Invalid command!");if("init"===t[0])this.initialize(t[1]).catch(t=>{console.error("Pushwoosh: Error during initialization",t)});else if(!this.subscribeToLegacyEvents(t[0],t[1]))throw console.log("Pushwoosh: Unknown command",t),new Error("Unknown command!")}}async subscribe(t=!0){if(this.isCommunicationDisabled)throw new Error("Communication is disabled!");if(this.driver.checkIsPermissionDefault()){this.eventBus.dispatchEvent("show-notification-permission-dialog",{}),await this.driver.askPermission();const t=this.driver.getPermission();this.eventBus.dispatchEvent("hide-notification-permission-dialog",{permission:t})}const e=this.driver.getPermission(),s=await this.data.getStatusManualUnsubscribed(),a=await this.api.checkDeviceSubscribeForPushNotifications(!1);if(e===o){this.eventBus.dispatchEvent("permission-granted",{});return(!a&&!s||t)&&await this.driver.subscribe(),void this.eventBus.dispatchEvent("subscribe",{})}if(e===n)return this.eventBus.dispatchEvent("permission-denied",{}),void(a&&await this.driver.unsubscribe())}async unsubscribe(){try{await this.driver.unsubscribe()}catch(t){throw X.error(t,"Error occurred during the unsubscribe"),t}}async forceSubscribe(){await this.subscribe(!0)}isDeviceRegistered(){return localStorage.getItem(a)===i}isDeviceUnregistered(){return localStorage.getItem(a)===r}async isSubscribed(){return this.api.checkDeviceSubscribeForPushNotifications()}async isCommunicationEnabled(){return!await this.data.getStatusCommunicationDisabled()}async setCommunicationEnabled(t=!0){if(await this.data.setCommunicationEnabled(t),t){this.isCommunicationDisabled=!1,await this.data.setStatusDropAllData(!1),await this.finishInit();this.driver.checkIsPermissionGranted()&&(await this.api.registerDevice(),await this.sendData())}else await this.api.unregisterDevice();this.eventBus.dispatchEvent("change-enabled-communication",{isEnabled:t});const e=await this.data.getDeviceType();await this.api.postEvent("GDPRConsent",{channel:t,device_type:e})}async removeAllDeviceData(){const t=await this.data.getDeviceType();await this.api.postEvent("GDPRDelete",{status:!0,device_type:t}),await this.api.deleteDevice(),await this.data.clearAll(),await this.data.setStatusDropAllData(!0)}async getHWID(){return await this.data.getHwid()}async getPushToken(){const{pushToken:t}=await this.data.getTokens();return t}async getUserId(){return await this.data.getUserId()}async getParams(){return await this.api.getParams()}isAvailableNotifications(){return this.platformChecker.isAvailableNotifications}async sendStatisticsVisitedPage(){const{document:{title:t},location:{origin:e,pathname:s,href:a}}=window;await this.api.pageVisit({title:t,url_path:`${e}${s}`,url:a})}async initialize(t){this.initParams={...x,...t};const e=localStorage.getItem("PW_SET_LOGGER_LEVEL");if(X.setLevel(e||t.logLevel||"error"),t.logLevel&&await this.data.setLogLevel(t.logLevel),!this.isAvailableNotifications())return;if(!t.applicationCode)throw new Error("Can't find application code!");const s=!1===t.communicationEnabled,a=await this.data.getCommunicationEnabled(),i=await this.data.getStatusCommunicationDisabled();(s&&!0!==a||!1===a||i)&&(this.isCommunicationDisabled=!0);const r=await this.data.getApplicationCode(),n=await this.isUserIdChanged();(!r||r!==t.applicationCode||n)&&(await this.data.setHwid(""),await this.data.setUserId(),await this.data.setEmail(),await this.data.setStatusLanguageWasChanged(!1)),await this.data.setApplicationCode(t.applicationCode);const o=t.unifiedPlatform?11:this.platformChecker.getPlatformType();await this.data.setDeviceType(o),await this.data.setFormFactor(this.platformChecker.formFactor),await this.data.setDeviceModel(this.platformChecker.getBrowserVersion());if(await this.data.getStatusLanguageWasChanged()||await this.data.setLanguage(t.tags?.Language||navigator.language),await this.data.setApiEntrypoint(t.pushwooshUrl||""),await this.data.setApiToken(t.apiToken||""),await this.data.setSdkVersion("3.57.0"),this.isCommunicationDisabled)this.eventBus.dispatchEvent("communication-disabled",{});else{await this.finishInit();try{await this.inboxModel.updateMessages()}catch(t){X.write("error",t)}const e=await this.data.getDelayedEvent();if(e){const{type:t,payload:s}=e;this.emitLegacyEventsFromServiceWorker(t,s),await this.data.setDelayedEvent(null)}if(this.platformChecker.isSafari&&!t.unifiedPlatform){const t=/#P(.*)/,e=decodeURIComponent(document.location.hash);t.test(e)&&this.api.pushStat(t.exec(e)[1]).then(()=>history.pushState(null,"","#"))}}}async finishInit(){await this.ensureHwid(),await this.loadConfig(),await this.open(),await this.sendData();await this.data.getApplicationServerKey()?await this.initPushNotifications(this.initParams):X.error("Pushwoosh: No vapid key found! Please, check your application settings in Pushwoosh dashboard."),this.ready=!0,this.eventBus.dispatchEvent("ready",{}),"serviceWorker"in navigator&&(navigator.serviceWorker.onmessage=t=>this.onServiceWorkerMessage(t)),localStorage.setItem("pushwoosh-websdk-status","init"),document.dispatchEvent(new CustomEvent("pushwoosh.initialized",{detail:{pw:this}}))}async ensureHwid(t=!1){await this.data.getHwid()&&!t||await this.data.setHwid(this.initParams.applicationCode+"_"+T())}async isUserIdChanged(){const{userId:t}=this.initParams,e=await this.data.getUserId(),s=await this.data.getStatusUserIdWasChanged();return!!t&&"user_id"!==t&&t!==e&&!s}async defaultProcess(){const t=this.driver.getPermission();"granted"===t&&await this.data.setLastPermissionStatus(t);const e=await this.data.getStatusCommunicationDisabled(),s=await this.data.getStatusDropAllData(),a=await this.driver.checkIsNeedResubscribe();if(e||s)return void await this.unsubscribe();a&&(await this.unsubscribe(),await this.data.setStatusManualUnsubscribed(!1),await this.data.setIsVapidChanged(!1));const i=await this.data.getStatusManualUnsubscribed(),r=await this.api.checkDeviceSubscribeForPushNotifications(!1);switch(t){case c:this.eventBus.dispatchEvent("permission-default",{}),r&&await this.unsubscribe();break;case n:this.eventBus.dispatchEvent("permission-denied",{}),r&&await this.unsubscribe();break;case o:this.eventBus.dispatchEvent("permission-granted",{}),i&&r&&await this.unsubscribe(),(!r&&!i||a)&&await this.subscribe(!0)}}onServiceWorkerMessage(t){const{data:e={}}=t||{},{type:s="",payload:a={}}=e||{};this.emitLegacyEventsFromServiceWorker(s,a)}async open(t){let e=await this.data.getLastOpenApplicationTime();const s=Date.now();e||(e=0);(t||!(s-e<36e5))&&(await this.data.setLastOpenApplicationTime(s),await this.api.applicationOpen())}async sendData(){const t=this.initParams,e=await this.data.getUserId();t.userId&&"user_id"!==t.userId&&t.userId!==e&&await this.api.registerUser(t.userId,!1);const s=[{test:async()=>{if(await this.data.getStatusEmailWasChanged())return!1;const e=await this.data.getEmail();return!!t.email&&t.email!==e},task:async()=>{await this.api.registerEmail(t.email,!1)}},{test:async()=>{if(await this.data.getStatusSmsNumberWasChanged())return!1;const e=await this.data.getSmsNumber();return!!t.smsNumber&&t.smsNumber!==e},task:async()=>{await this.api.registerSmsNumber(t.smsNumber,!1)}},{test:async()=>{if(await this.data.getStatusWhatsAppNumberWasChanged())return!1;const e=await this.data.getWhatsAppNumber();return!!t.whatsAppNumber&&t.whatsAppNumber!==e},task:async()=>{await this.api.registerWhatsappNumber(t.whatsAppNumber,!1)}},{test:async()=>!!t.tags||await this.data.getStatusLanguageWasChanged(),task:async()=>{const e=await this.data.getLanguage(),s={...t.tags||{},Language:e};await this.api.setTags(s)}}];await Promise.all(s.map(async t=>{try{await t.test()&&await t.task()}catch(t){console.error("Pushwoosh: Error during data registration",t)}}))}async loadConfig(){const t=await this.api.getConfig(["page_visit","vapid_key","web_in_apps","events","subscription_prompt","popup_forms"]),e=t&&t.features;if(await this.data.setFeatures(e),e){if(e.page_visit&&e.page_visit.enabled&&(await K.set("PAGE_VISITED_URL",e.page_visit.entrypoint),this.sendStatisticsVisitedPage()),e.events&&e.events.length){e.events.some(t=>t===D)&&this.sendPostEventVisitedPage()}if(e.vapid_key){const t=await this.data.getApplicationServerKey();await this.data.setApplicationServerKey(e.vapid_key),t!==e.vapid_key&&await this.data.setIsVapidChanged(!0)}}}async initPushNotifications(t){await this.data.setDefaultNotificationImage(t.defaultNotificationImage),await this.data.setDefaultNotificationTitle(t.defaultNotificationTitle),await this.data.setServiceWorkerUrl(t.serviceWorkerUrl),await this.data.setServiceWorkerScope(t.scope),await this.data.setInitParams(t),await this.initDriver();try{await this.defaultProcess()}catch(t){X.error(t,"Internal error: defaultProcess fail")}}async initDriver(){if(this.platformChecker.isSafari&&!this.initParams.unifiedPlatform){const{safariWebsitePushID:t}=await this.data.getInitParams();return t?void(this.driver=new dt(this.api,this.data,{webSitePushId:t})):void X.info("For work with Safari Push Notification add safariWebsitePushID to initParams!")}X.info({isAvailableServiceWorker:this.platformChecker.isAvailableServiceWorker}),this.platformChecker.isAvailableServiceWorker&&(this.driver=new ht(this.api,this.data,{}))}async sendPostEventVisitedPage(){const{document:{title:t},location:{href:e}}=window,s=await this.data.getDeviceType();this.api.postEvent(D,{url:e,title:t,device_type:s})}subscribeToLegacyEvents(t,e){let s=!0;switch(!0){case"onLoad"===t:e();break;case t===u:if(this.ready){e(this.api);break}this.eventBus.addEventHandler("ready",()=>e(this.api));break;case t in W:this.eventBus.addEventHandler(W[t].name,s=>{const{prop:a}=W[t];e(this.api,a?s[a]:void 0)});break;default:s=!1}return s}emitLegacyEventsFromServiceWorker(t,e){switch(t){case b:this.eventBus.dispatchEvent("receive-push",{notification:e});break;case v:this.eventBus.dispatchEvent("open-notification",{notification:e});break;case y:this.eventBus.dispatchEvent("hide-notification",{notification:e});break;case S:this.eventBus.dispatchEvent("receive-inbox-message",{message:e})}}}return e})());
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var a in s)("object"==typeof exports?exports:t)[a]=s[a]}}(this,()=>(()=>{"use strict";var t={d:(e,s)=>{for(var a in s)t.o(s,a)&&!t.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:s[a]})},o:(t,e)=>Object.prototype.hasOwnProperty.call(t,e),r:t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})}},e={};t.r(e),t.d(e,{Pushwoosh:()=>gt});const s="/pushwoosh-service-worker.js",a="deviceRegistrationStatus",i="registered",r="unregistered",n="denied",o="granted",c="default",u="onReady",h="onSubscribe",d="onUnsubscribe",g="onRegister",l="onPermissionPrompt",p="onPermissionDenied",m="onPermissionGranted",w="onSWInitError",b="onPushDelivery",v="onNotificationClick",y="onNotificationClose",f="onChangeCommunicationEnabled",S="onPutNewMessageToInboxStore",P="onUpdateInboxMessages",C="onShowNotificationPermissionDialog",k="onHideNotificationPermissionDialog",I="onShowSubscriptionWidget",E="onHideSubscriptionWidget",D="PW_SiteOpened",x={autoSubscribe:!0,serviceWorkerUrl:s};function M(){return globalThis}function T(){return crypto.randomUUID?.()||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}const _=t=>"function"==typeof t,W={[g]:{name:"register"},[h]:{name:"subscribe"},[d]:{name:"unsubscribe"},[w]:{name:"initialize-service-worker-error",prop:"error"},[b]:{name:"receive-push",prop:"notification"},[v]:{name:"open-notification",prop:"notification"},[y]:{name:"hide-notification",prop:"notification"},[f]:{name:"change-enabled-communication",prop:"isEnabled"},[S]:{name:"receive-inbox-message",prop:"message"},[P]:{name:"update-inbox-messages",prop:"messages"},[C]:{name:"show-notification-permission-dialog"},[k]:{name:"hide-notification-permission-dialog",prop:"permission"},[I]:{name:"show-subscription-widget"},[E]:{name:"hide-subscription-widget"},[p]:{name:"permission-denied"},[l]:{name:"permission-default"},[m]:{name:"permission-granted"}},A="keyValue",R="messages",N="log",L="inboxMessages";function O(t,e){return function(s){s.objectStoreNames.contains(t)||e(s)}}const q=[O(A,function(t){t.createObjectStore(A,{keyPath:"key"})}),O(N,function(t){const e=t.createObjectStore(N,{keyPath:"id",autoIncrement:!0});e.createIndex("environment","environment",{unique:!1}),e.createIndex("date","date",{unique:!1}),e.createIndex("type","type",{unique:!1})}),O(R,function(t){t.createObjectStore(R,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),O(L,function(t){const e="status",s=t.createObjectStore(L,{keyPath:"inbox_id",autoIncrement:!1});s.createIndex(e,e,{unique:!1,multiEntry:!0}),s.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class U{get all(){return q}}class B{constructor(t,e=new U){this.db=t,this.migrationsBuilder=e}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(t){t.forEach(t=>{t(this.db)})}}function F(t,e){console.info("onversionchange",e),t.close()}let V;function j(){return V||(V=new Promise((t,e)=>{const s=indexedDB.open("PUSHWOOSH_SDK_STORE",7);s.onsuccess=s=>{const a=s.target.result;a.onversionchange=F.bind(null,a,e),t(a)},s.onerror=()=>e(s.error),s.onupgradeneeded=t=>{const s=t.target.result;s.onversionchange=F.bind(null,s,e);new B(s).applyMigrations()}})),V}function $(t){return j().then(e=>new Promise((s,a)=>t(e,s,a)))}class H{_add(t){return $((e,s,a)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).add(t);i.onsuccess=()=>{s(t)},i.onerror=()=>{a(i.error)}}).then(t=>this.getAll().then(e=>{if(Array.isArray(e)){const s=e.map(t=>t.id).sort((t,e)=>t==e?0:t<e?1:-1);if(s.length>this.maxItems)return Promise.all(s.slice(this.maxItems).map(t=>this.delete(t))).then(()=>t)}return t}))}delete(t){return $((e,s,a)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).delete(t);i.onsuccess=()=>{s(i.result)},i.onerror=()=>{a(i.error)}})}getAll(){return $((t,e,s)=>{const a=[],i=t.transaction(this.name).objectStore(this.name).openCursor();i.onsuccess=t=>{const s=t.target.result;s?(s.value&&a.push(s.value),s.continue()):e(a)},i.onerror=()=>{s(i.error)}})}}const K=(z=A,{get:(t,e)=>$((s,a,i)=>{const r=s.transaction(z).objectStore(z).get(t);let n,o=!1,c=!1;const u=()=>{clearTimeout(n),o?a(r.result?.value||e):c?i(r.error):n=setTimeout(u,0)};r.onsuccess=()=>o=!0,r.onerror=()=>c=!0,u()}),getAll:()=>$((t,e,s)=>{const a={},i=t.transaction(z).objectStore(z).openCursor();let r,n=!1,o=!1;const c=()=>{clearTimeout(r),n?e(a):o?s(i.error):r=setTimeout(c,0)};i.onsuccess=t=>{const e=t.target.result;e?(a[e.key]=e.value.value,e.continue()):n=!0},i.onerror=()=>o=!0,c()}),async extend(t,e){const s=await this.get(t),{...a}=e;await this.set(t,{...s,...a})},set:(t,e)=>$((s,a,i)=>{const r=s.transaction([z],"readwrite").objectStore(z).put({key:t,value:e});let n,o=!1,c=!1;const u=()=>{clearTimeout(n),o?a(t):c?i(r.error):n=setTimeout(u,0)};r.onsuccess=()=>o=!0,r.onerror=()=>c=!0,u()})});var z;const G=new class extends H{constructor(){super(...arguments),this.name=N,this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(t,e,s){const a={type:t,environment:this.environment,message:`${e}`,date:new Date};return e instanceof Error&&(a.stack=e.stack),s&&(a.additional=s),this._add(a)}},J=new class extends H{constructor(){super(...arguments),this.name=R,this.maxItems=25}add(t){return this._add({...t,date:new Date})}},Y={error:1,info:2,debug:3};let Q=3;const X={setLevel(t){Y[t]||(t="error"),Q=Y[t]},write(t,e,s){return"error"===t?this.error(e):this.info(e),G.add(t,e,s)}};Object.keys(Y).forEach(t=>{const e=Y[t];X[t]=(...s)=>{e<=Q&&(console.groupCollapsed(t),console.info("",...s),console.trace("trace"),console.groupEnd())}});class Z{constructor(){this.addEventHandler=(t,e)=>{let s=this.handlers[t];s||(s=[]),s.push(e),this.handlers[t]=s},this.removeEventHandler=(t,e)=>{const s=this.handlers[t];s&&(this.handlers[t]=s.filter(t=>t!==e))},this.dispatchEvent=(t,e)=>{const s=e.eventId||T(),a=this.handlers[t];return a?(a.forEach(t=>{_(t)&&setTimeout(()=>{t({...e,eventId:s})},0)}),s):s},this.handlers={}}}class tt{constructor(t=new Date){this._date=t}set date(t){this._date=t}get date(){return this._date}getUtcTimestamp(){return Math.floor((this.date.getTime()+60*this.date.getTimezoneOffset()*1e3)/1e3)}getTimestamp(){return Math.round(this.date.getTime()/1e3)}setLocal(){const t=this._date.getTime()-60*this.date.getTimezoneOffset()*1e3;this._date=new Date(t)}addDays(t){const e=this._date.getTime()+24*t*60*60*1e3;this._date=new Date(e)}getInboxFakeOrder(){return(100*this._date.getTime()+9e9).toString()}}class et{constructor(t,e,s,a=new tt){this.data=t,this.api=e,this.inboxModel=s,this.dateModule=a,this.publicMessageBuilder=this.publicMessageBuilder.bind(this)}messageTypeFactory(t,e){let s=0;return 2===t?s=1:"l"in e&&null!=e.l&&(s=e.l.startsWith("http")?2:3),s}async updateMessagesStatusWithCodes(t,e,s){const a=[],i=[];e.forEach(async e=>{-1!==t.indexOf(e.inbox_id)&&(e.status=s,a.push(e),i.push(this.api.inboxStatus(e.order,e.status)))}),await this.inboxModel.putBulkMessages(a),await Promise.all(i)}async publicMessageBuilder({action_type:t,action_params:e,image:s,title:a,send_date:i,inbox_id:r,text:n,status:o}){const c=s||await this.data.getDefaultNotificationImage(),u=a||await this.data.getDefaultNotificationTitle(),h=JSON.parse(e);return this.dateModule.date=new Date(1e3*parseInt(i)),this.dateModule.setLocal(),{title:u,imageUrl:c,code:r,message:n,sendDate:this.dateModule.date.toISOString(),type:this.messageTypeFactory(t,h),link:h?.l||"/",isRead:2===o||3===o,isActionPerformed:3===o}}messagesWithNoActionPerformedCount(){return this.inboxModel.getDeliveredReadMessagesCount()}unreadMessagesCount(){return this.inboxModel.getDeliveredMessagesCount()}messagesCount(){return this.inboxModel.messagesCount()}async loadMessages(){const t=[...await this.inboxModel.getReadOpenMessages(),...await this.inboxModel.getDeliveredMessages()].sort((t,e)=>parseInt(e.send_date,10)-parseInt(t.send_date,10)).sort((t,e)=>parseInt(e.order||"0",10)-parseInt(t.order||"0",10)).map(this.publicMessageBuilder);return Promise.all(t)}async readMessagesWithCodes(t){const e=await this.inboxModel.getDeliveredMessages();await this.updateMessagesStatusWithCodes(t,e,2)}async performActionForMessageWithCode(t){const e=await this.inboxModel.getMessage(t),s=JSON.parse(e.action_params),a=this.messageTypeFactory(e.action_type,s);2===a&&null!=s.l?document.location.href=s.l:3===a&&null!=s.l&&window.history.go(s.l),e.status=3,await this.inboxModel.putMessage(e),await this.api.inboxStatus(e.order,e.status)}async deleteMessagesWithCodes(t){const e=await this.inboxModel.getReadOpenMessages(),s=await this.inboxModel.getDeliveredMessages();await this.updateMessagesStatusWithCodes(t,[...e,...s],4)}async syncMessages(){await this.inboxModel.updateMessages()}}class st{constructor(t,e){this.name=e,this.store=t.transaction(this.name,"readwrite").objectStore(this.name)}set index(t){this.store.indexNames.contains(t)?this._index=this.store.index(t):console.warn(`Index "${t}" in `)}writeRequestPromise(t,e){return new Promise((s,a)=>{t.onsuccess=()=>{s(e)},t.onerror=()=>{a(t.error)}})}readRequestPromise(t,e){return new Promise((s,a)=>{t.onsuccess=t=>{const a=t.target;s(a.result||e)},t.onerror=()=>{a(t.error)}})}put(t,e){const s=this.store.put(t,e);return this.writeRequestPromise(s,e)}add(t,e){return this.put(t,e)}delete(t){const e=this.store.delete(t);return this.writeRequestPromise(e)}get(t,e){const s=this.store.get(t);return this.readRequestPromise(s,e)}getAll(){const t=this.store.openCursor(),e=[];return new Promise((s,a)=>{t.onsuccess=t=>{const a=t.target.result;a?(e.push(a.value),a.continue()):s(e)},t.onerror=()=>{a(t.error)}})}count(t){const e=this.store.count(t);return this.readRequestPromise(e,0)}countByIndex(t){const e=this._index.count(t);return this.readRequestPromise(e,0)}}class at{getDB(){return j()}async put(t,e,s){const a=await this.getDB();return new st(a,t).put(e,s)}async delete(t,e){const s=await this.getDB();return new st(s,t).delete(e)}async get(t,e,s){const a=await this.getDB();return new st(a,t).get(e,s)}async getAll(t){const e=await this.getDB(),s=new st(e,t);return await s.getAll()||[]}async count(t,e){const s=await this.getDB();return new st(s,t).count(e)}async countByIndex(t,e,s){const a=await this.getDB(),i=new st(a,t);return i.index=e,i.countByIndex(s)}}class it{constructor(t,e,s,a=new at,i=new tt){this.eventBus=t,this.data=e,this.api=s,this.storage=a,this.storeName="inboxMessages",this.dateModule=i}async getInboxMessages(){const t=await this.api.getInboxMessages();return await this.storeGetInboxMessagesRequestParams(t.next,t.new_inbox),t}async storeGetInboxMessagesRequestParams(t,e){this.dateModule.date=new Date,await this.data.setInboxLastRequestTime(this.dateModule.getUtcTimestamp()),await this.data.setInboxLastRequestCode(t),await this.data.setInboxNewMessagesCount(e)}async putServerMessages(t){const e=t.map(async t=>{const e=await this.storage.get(this.storeName,t.inbox_id,{});return"status"in e&&(t.status=e.status),this.putMessage(t)});return Promise.all(e)}putMessage(t){return this.storage.put(this.storeName,t)}putBulkMessages(t){const e=t.map(t=>this.putMessage(t));return Promise.all(e)}deleteMessages(t){const e=t.map(t=>this.storage.delete(this.storeName,t));return Promise.all(e)}async deleteExpiredMessages(){this.dateModule.date=new Date;const t=this.dateModule.getTimestamp().toString(),e=(await this.storage.getAll(this.storeName)).filter(e=>e.rt<t).map(t=>t.inbox_id);return this.deleteMessages(e)}getMessage(t){return this.storage.get(this.storeName,t)}async getReadOpenMessages(){return(await this.storage.getAll(this.storeName)).filter(t=>2===t.status||3===t.status)}async getDeliveredMessages(){return(await this.storage.getAll(this.storeName)).filter(t=>1===t.status)}async messagesCount(){return this.storage.count(this.storeName)}async getDeliveredMessagesCount(){return this.storage.countByIndex(this.storeName,"status",1)}async getReadMessagesCount(){return this.storage.countByIndex(this.storeName,"status",2)}async getDeliveredReadMessagesCount(){const[t,e]=[2,3],s=IDBKeyRange.bound(t,e);return this.storage.countByIndex(this.storeName,"status",s)}async updateMessages(){const t=await this.getInboxMessages();await this.deleteExpiredMessages(),t.deleted&&await this.deleteMessages(t.deleted),await this.putServerMessages(t.messages),this.eventBus.dispatchEvent("update-inbox-messages",{messages:new et(this.data,this.api,this)})}}const rt=t=>`params.${t}`;class nt{constructor(t=K){this.store=t}async clearAll(){const t=["applicationCode","apiToken","hwid","deviceType","deviceModel","language","languageWasChanged","apiEntrypoint","tokens","applicationServerKey","isVapidChanged","webSitePushId","defaultNotificationImage","defaultNotificationTitle","userId","userIdWasChanged","email","emailWasChanged","isLastPermissionStatus","isManualUnsubscribed","isCommunicationDisabled","communicationEnabled","isDropAllData","sdkVersion","serviceWorkerVersion","serviceWorkerUrl","serviceWorkerScope","lastOpenMessage","lastOpenApplicationTime","features","init","inbox.lastRequestCode","inbox.lastRequestTime","inbox.newMessagesCount","delayedEvent","promptDisplayCount","promptLastSeenTime","logLevel","shownWebPopups","isRecurringVisitor"];for(const e of t)await this.store.set(rt(e),void 0)}async setApplicationCode(t){await this.store.set(rt("applicationCode"),t)}async getApplicationCode(){return this.store.get(rt("applicationCode"))}async setApiToken(t){return await this.store.set(rt("apiToken"),t)}async getApiToken(){return this.store.get(rt("apiToken"))}async setHwid(t){await this.store.set(rt("hwid"),t)}async getHwid(){return this.store.get(rt("hwid"))}async setDeviceType(t){await this.store.set(rt("deviceType"),t)}async getDeviceType(){return this.store.get(rt("deviceType"))}async setFormFactor(t){await this.store.set(rt("formFactor"),t)}async getFormFactor(){return this.store.get(rt("formFactor"))}async setDeviceModel(t){await this.store.set(rt("deviceModel"),t)}async getDeviceModel(){return this.store.get(rt("deviceModel"))}async setLanguage(t){await this.store.set(rt("language"),t)}async getLanguage(){return this.store.get(rt("language"),"en")}async setStatusLanguageWasChanged(t){await this.store.set(rt("languageWasChanged"),t)}async getStatusLanguageWasChanged(){return this.store.get(rt("languageWasChanged"),!1)}async setApiEntrypoint(t){await this.store.set(rt("apiEntrypoint"),t)}async getApiEntrypoint(){return this.store.get(rt("apiEntrypoint"),"https://api.pushwoosh.com/json/1.3/")}async setTokens(t){await this.store.set(rt("tokens"),t)}getTokens(){return this.store.get(rt("tokens"))}async setApplicationServerKey(t){await this.store.set(rt("applicationServerKey"),t)}async getApplicationServerKey(){return this.store.get(rt("applicationServerKey"))}async setIsVapidChanged(t){await this.store.set(rt("isVapidChanged"),t)}async getIsVapidChanged(){return this.store.get(rt("isVapidChanged"),!1)}async setWebSitePushId(t){await this.store.set(rt("webSitePushId"),t)}async getWebSitePushId(){return this.store.get(rt("webSitePushId"))}async setDefaultNotificationImage(t){await this.store.set(rt("defaultNotificationImage"),t)}async getDefaultNotificationImage(){return this.store.get(rt("defaultNotificationImage"),"https://cp.pushwoosh.com/img/logo-medium.png")}async setDefaultNotificationTitle(t){await this.store.set(rt("defaultNotificationTitle"),t)}async getDefaultNotificationTitle(){return this.store.get(rt("defaultNotificationTitle"),"Pushwoosh notification")}async setUserId(t){await this.store.set(rt("userId"),t?`${t}`:void 0)}async getUserId(){return this.store.get(rt("userId"))}async setStatusUserIdWasChanged(t){await this.store.set(rt("userIdWasChanged"),t)}async getStatusUserIdWasChanged(){return this.store.get(rt("userIdWasChanged"),!1)}async setEmail(t){await this.store.set(rt("email"),t?`${t}`:void 0)}async getEmail(){return this.store.get(rt("email"))}async setStatusEmailWasChanged(t){await this.store.set(rt("emailWasChanged"),t)}async getStatusEmailWasChanged(){return this.store.get(rt("emailWasChanged"),!1)}async setSmsNumber(t){await this.store.set(rt("smsNumber"),t?`${t}`:void 0)}async getSmsNumber(){return this.store.get(rt("smsNumber"))}async setStatusSmsNumberWasChanged(t){await this.store.set(rt("smsNumberWasChanged"),t)}async getStatusSmsNumberWasChanged(){return this.store.get(rt("smsNumberWasChanged"),!1)}async setWhatsAppNumber(t){await this.store.set(rt("whatsAppNumber"),t?`${t}`:void 0)}async getWhatsAppNumber(){return this.store.get(rt("whatsAppNumber"))}async setStatusWhatsAppNumberWasChanged(t){await this.store.set(rt("whatsAppNumberWasChanged"),t)}async getStatusWhatsAppNumberWasChanged(){return this.store.get(rt("whatsAppNumberWasChanged"),!1)}async setLastPermissionStatus(t){await this.store.set(rt("isLastPermissionStatus"),t)}async getLastPermissionStatus(){return this.store.get(rt("isLastPermissionStatus"))}async setStatusManualUnsubscribed(t){await this.store.set(rt("isManualUnsubscribed"),t)}getStatusManualUnsubscribed(){return this.store.get(rt("isManualUnsubscribed"),!1)}async setStatusCommunicationDisabled(t){await this.store.set(rt("isCommunicationDisabled"),t)}getStatusCommunicationDisabled(){return this.store.get(rt("isCommunicationDisabled"),!1)}async setCommunicationEnabled(t){await this.store.set(rt("communicationEnabled"),t)}getCommunicationEnabled(){return this.store.get(rt("communicationEnabled"))}async setStatusDropAllData(t){await this.store.set(rt("isDropAllData"),t)}getStatusDropAllData(){return this.store.get(rt("isDropAllData"),!1)}async setSdkVersion(t){await this.store.set(rt("sdkVersion"),t)}async getSdkVersion(){return this.store.get(rt("sdkVersion"))}async setServiceWorkerVersion(t){await this.store.set(rt("serviceWorkerVersion"),t)}getServiceWorkerVersion(){return this.store.get(rt("serviceWorkerVersion"))}async setServiceWorkerUrl(t){t&&await this.store.set(rt("serviceWorkerUrl"),t)}async getServiceWorkerUrl(){return this.store.get(rt("serviceWorkerUrl"),s)}async setServiceWorkerScope(t){t&&await this.store.set(rt("serviceWorkerScope"),t)}async getServiceWorkerScope(){return this.store.get(rt("serviceWorkerScope"))}async setLastOpenMessage(t){await this.store.set(rt("lastOpenMessage"),t)}getLastOpenMessage(){return this.store.get(rt("lastOpenMessage"))}async setLastOpenApplicationTime(t){await this.store.set(rt("lastOpenApplicationTime"),t)}async getLastOpenApplicationTime(){return this.store.get(rt("lastOpenApplicationTime"))}async setFeatures(t){await this.store.set(rt("features"),t)}async getFeatures(){return this.store.get(rt("features"))}async setInitParams(t){await this.store.set(rt("init"),t)}async getInitParams(){return this.store.get(rt("init"))}async setInboxLastRequestCode(t){await this.store.set(rt("inbox.lastRequestCode"),t)}async getInboxLastRequestCode(){return this.store.get(rt("inbox.lastRequestCode"),"")}async setInboxLastRequestTime(t){await this.store.set(rt("inbox.lastRequestTime"),t)}async getInboxLastRequestTime(){return this.store.get(rt("inbox.lastRequestTime"),0)}async setInboxNewMessagesCount(t){await this.store.set(rt("inbox.newMessagesCount"),t)}async getInboxNewMessagesCount(){return this.store.get(rt("inbox.newMessagesCount"),0)}async setDelayedEvent(t){await this.store.set(rt("delayedEvent"),t)}getDelayedEvent(){return this.store.get(rt("delayedEvent"))}async setPromptDisplayCount(t){await this.store.set(rt("promptDisplayCount"),t)}async getPromptDisplayCount(){return this.store.get(rt("promptDisplayCount"),0)}async setPromptLastSeenTime(t){await this.store.set(rt("promptLastSeenTime"),t)}async getPromptLastSeenTime(){return this.store.get(rt("promptLastSeenTime"),0)}async setLogLevel(t){await this.store.set(rt("logLevel"),t)}async getLogLevel(){return this.store.get(rt("logLevel"),"error")}async getShownWebPopups(){return this.store.get(rt("shownWebPopups"),[])}async addShownWebPopup(t){const e=await this.getShownWebPopups();e.includes(t)||(e.push(t),await this.store.set(rt("shownWebPopups"),e))}async setIsRecurringVisitor(t){await this.store.set(rt("isRecurringVisitor"),t)}async getIsRecurringVisitor(){return this.store.get(rt("isRecurringVisitor"),!1)}}class ot{constructor(t=new nt,e=X){this.data=t,this.logger=e}checkDevice(t){return this.createRequest("checkDevice",t)}getConfig(t){return this.createRequest("getConfig",t)}getPopupFormContent(t){return this.createRequest("getPopupFormContent",t)}recordPopupFormEvent(t){return this.createRequest("recordPopupFormEvent",t)}applicationOpen(t){return this.createRequest("applicationOpen",t)}registerDevice(t){return this.createRequest("registerDevice",t)}unregisterDevice(t){return this.createRequest("unregisterDevice",t)}deleteDevice(t){return this.createRequest("deleteDevice",t)}messageDeliveryEvent(t){return this.createRequest("messageDeliveryEvent",t)}pushStat(t){return this.createRequest("pushStat",t)}setTags(t){return this.createRequest("setTags",t)}getTags(t){return this.createRequest("getTags",t)}registerUser(t){return this.createRequest("registerUser",t)}registerEmail(t){return this.createRequest("registerEmail",t)}registerEmailUser(t){return this.createRequest("registerEmailUser",t)}setEmailTags(t){return this.createRequest("setEmailTags",t)}postEvent(t){return this.createRequest("postEvent",t)}getInboxMessages(t){return this.createRequest("getInboxMessages",t)}inboxStatus(t){return this.createRequest("inboxStatus",t)}pageVisit(t,e){return this.createRequest("pageVisit",t,e)}setPurchase(t){return this.createRequest("setPurchase",t)}multiRegisterDevice(t){return this.createRequest("multiRegisterDevice",t)}async createRequest(t,e,s){const a=await this.data.getApiEntrypoint(),i=await this.data.getApiToken(),r=s||a+t,n=i?{headers:{Authorization:`Token ${i}`,"Content-Type":"text/plain;charset=UTF-8",Origin:M().location.origin},credentials:"include"}:{},o=await fetch(r,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify({request:e}),...n}),c=await this.checkResponse(o);return c.base_url&&await this.data.setApiEntrypoint(c.base_url),await this.logger.write("apirequest",`${t} call with arguments: ${JSON.stringify(e)} to Pushwoosh has been successful. Result: ${JSON.stringify(c.response)}`),c.response}async checkResponse(t){if(200!==t.status){let e=`status: ${t.status}. statusText: ${t.statusText}.`;try{const s=await t.json();s&&s.status_message&&(e+=` status_code: ${s.status_code}. status_message: ${s.status_message}.`)}catch(t){}throw new Error(e)}const e=await t.json();if(200!==e.status_code)throw new Error(`Error code: ${e.status_code}. Error text: ${e.status_message}`);return e}}class ct{constructor(t,e=new nt,s=new ot,a=()=>!1){this.eventBus=t,this.data=e,this.apiClient=s,this.getIsCommunicationDisabled=a}async checkDevice(){const t=await this.getRequestParams();return await this.apiClient.checkDevice(t)}async checkDeviceSubscribeForPushNotifications(t=!0){let e=localStorage.getItem(a);if(void 0===e||!t){const{exist:t,push_token_exist:s}=await this.checkDevice();localStorage.setItem(a,t&&s?i:r),e=localStorage.getItem(a)}return e===i}async getConfig(t){const e=await this.getRequestParams();return this.apiClient.getConfig({...e,features:t})}async applicationOpen(){const t=await this.getRequestParams();return await this.data.setLastOpenApplicationTime(Date.now()),this.apiClient.applicationOpen(t)}async registerDevice(){if(await this.data.getStatusCommunicationDisabled())throw new Error("Can't register device: Communication is disabled!");const t=await this.getRequestParams(),e=await this.data.getTokens();if(!e.pushToken)throw new Error("Can't register device: pushToken is not exist!");const s=await this.apiClient.registerDevice({...t,push_token:e.pushToken,auth_token:e.authToken,public_key:e.publicKey});return await this.data.setStatusManualUnsubscribed(!1),localStorage.setItem(a,i),this.eventBus.dispatchEvent("register",{}),s}async unregisterDevice(){const t=await this.getRequestParams(),e=await this.apiClient.unregisterDevice(t);return localStorage.setItem(a,r),this.eventBus.dispatchEvent("unsubscribe",{}),e}async deleteDevice(){const t=await this.getRequestParams(),e=await this.apiClient.deleteDevice(t);return await this.data.setStatusManualUnsubscribed(!0),localStorage.setItem(a,r),this.eventBus.dispatchEvent("unsubscribe",{}),e}async messageDeliveryEvent(t,e,s={}){const a=await this.getRequestParams();return await this.apiClient.messageDeliveryEvent({...a,hash:t,metaData:s})}async pushStat(t,e,s={}){const a=await this.getRequestParams();return await this.apiClient.pushStat({...a,hash:t,metaData:s})}async setTags(t){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const{hwid:e,device_type:s,...a}=await this.getRequestParams(),i=await this.data.getEmail();return i&&await this.apiClient.setEmailTags({...a,email:i,tags:t}),this.apiClient.setTags({...a,hwid:e,device_type:s,tags:t})}async getTags(){const t=await this.getRequestParams();return this.apiClient.getTags(t)}async setLanguage(t){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):(await this.data.setLanguage(t),await this.data.setStatusLanguageWasChanged(!0),this.setTags({Language:t}))}async registerUser(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const{hwid:s,device_type:a,...i}=await this.getRequestParams(),r=await this.data.getDeviceType(),n=`${t}`,o=await this.apiClient.registerUser({...i,hwid:s,userId:n,ts_offset:60*-(new Date).getTimezoneOffset(),device_type:r});return await this.data.setUserId(n),e&&await this.data.setStatusUserIdWasChanged(!0),o}async registerEmail(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^\S+@\S+\.\S+$/.test(t))return Promise.reject(new Error("Invalid Email format"));const{hwid:s,device_type:a,...i}=await this.getRequestParams(),r=await this.apiClient.registerEmail({...i,email:t,ts_offset:60*-(new Date).getTimezoneOffset()});return await this.data.setEmail(t),e&&await this.data.setStatusEmailWasChanged(!0),r}async registerSmsNumber(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^\+?[0-9]+$/.test(t))return Promise.reject(new Error("Invalid Phone number format: +1234567890"));const{application:s,userId:a}=await this.getRequestParams(),i=await this.apiClient.registerDevice({application:s,userId:a,hwid:t,device_type:18});return await this.data.setSmsNumber(t),e&&await this.data.setStatusSmsNumberWasChanged(!0),i}async registerWhatsappNumber(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^(whatsapp:)?\+?[0-9]+$/.test(t))return Promise.reject(new Error("Invalid WhatsApp number format: +1234567890"));const{application:s,userId:a}=await this.getRequestParams(),i=await this.apiClient.registerDevice({application:s,userId:a,hwid:t,device_type:21});return await this.data.setWhatsAppNumber(t),e&&await this.data.setStatusWhatsAppNumberWasChanged(!0),i}async getPopupFormContent(t){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):this.apiClient.getPopupFormContent({...await this.getRequestParams(),code:t})}async recordPopupFormEvent(t,e){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):this.apiClient.recordPopupFormEvent({...await this.getRequestParams(),code:t,event:e})}async postEvent(t,e){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const s=await this.getRequestParams(),a=new Date,i=a.getTime(),r=Math.floor(i/1e3),n=r-a.getTimezoneOffset()/60*3600,o=await this.data.getLastOpenMessage();if(o&&o.expiry>Date.now()){if(e.msgHash)return Promise.reject(new Error("attribute msgHash already defined"));e={...e,msgHash:o.messageHash}}await this.data.setLastOpenMessage(void 0);const c=await this.apiClient.postEvent({...s,event:t,timestampUTC:r,timestampCurrent:n,attributes:e});return c&&c.code&&this.eventBus.dispatchEvent("receive-in-app-code",{code:c.code}),c}async getInboxMessages(t=0){const e=await this.getRequestParams(),s=await this.data.getInboxLastRequestCode(),a=await this.data.getInboxLastRequestTime();return this.apiClient.getInboxMessages({...e,count:t,last_code:s,last_request_time:a})}async inboxStatus(t,e){const s=await this.getRequestParams();return this.apiClient.inboxStatus({...s,inbox_code:t,status:e,time:(new Date).getTime()})}async pageVisit(t){const e=await this.getRequestParams(),s=await this.data.getFeatures(),a=s&&s.page_visit&&s.page_visit.entrypoint;if(a)return this.apiClient.pageVisit({...e,...t},a)}async setPurchase(t){const e=await this.getRequestParams();return this.apiClient.setPurchase({...e,...t})}async multiRegisterDevice(t){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const e=await this.data.getApplicationCode(),s=await this.data.getDeviceModel(),r=await this.data.getDeviceType(),n=await this.data.getLanguage(),o=await this.data.getSdkVersion(),c=await this.data.getTokens(),u=await this.data.getHwid(),h={application:e,...t};if(t.user_id){h.user_id=String(t.user_id);await this.data.getUserId()!==h.user_id&&(await this.data.setUserId(h.user_id),await this.data.setStatusUserIdWasChanged(!0))}if(t.email){if(!/^\S+@\S+\.\S+$/.test(t.email))return Promise.reject(new Error("Invalid Email format"));await this.data.getEmail()!==t.email&&(await this.data.setEmail(t.email),await this.data.setStatusEmailWasChanged(!0))}if(t.sms_phone_number){if(!/^\+?[0-9]+$/.test(t.sms_phone_number))return Promise.reject(new Error("Invalid Phone number format: +1234567890"));await this.data.getSmsNumber()!==t.sms_phone_number&&(await this.data.setSmsNumber(t.sms_phone_number),await this.data.setStatusSmsNumberWasChanged(!0))}if(t.whatsapp_phone_number){if(!/^(whatsapp:)?\+?[0-9]+$/.test(t.whatsapp_phone_number))return Promise.reject(new Error("Invalid WhatsApp number format: +1234567890"));await this.data.getWhatsAppNumber()!==t.whatsapp_phone_number&&(await this.data.setWhatsAppNumber(t.whatsapp_phone_number),await this.data.setStatusWhatsAppNumberWasChanged(!0))}if(h.language?(await this.data.setLanguage(h.language),await this.data.setStatusLanguageWasChanged(!0)):h.language=n,!h.timezone){const t=60*-(new Date).getTimezoneOffset();h.timezone=String(t)}if(!h.push_devices&&c.pushToken){const t={hwid:u,platform:r,push_token:c.pushToken,sdk_version:o};if(c.publicKey||c.authToken||s){const e={};c.publicKey&&(e.public_key=c.publicKey),c.authToken&&(e.auth_token=c.authToken),s&&(e.browser=s),t.platformData=e}h.push_devices=[t]}const d=await this.apiClient.multiRegisterDevice(h);return h.push_devices?.length&&(await this.data.setStatusManualUnsubscribed(!1),localStorage.setItem(a,i),this.eventBus.dispatchEvent("register",{})),d}async getParams(){return{applicationCode:await this.data.getApplicationCode(),hwid:await this.data.getHwid(),...await this.data.getTokens(),...await this.data.getInitParams()}}async getRequestParams(){const t=await this.data.getApplicationCode(),e=await this.data.getHwid(),s=await this.data.getUserId(),a=await this.data.getDeviceType(),i=await this.data.getDeviceModel(),r=await this.data.getLanguage(),n=await this.data.getSdkVersion();return{application:t,hwid:e,userId:s||e,device_type:a,device_model:i,timezone:60*-(new Date).getTimezoneOffset(),language:r,v:n}}}class ut{constructor(t){this.global=t,this._isSafari=this.isSafariBrowser(),this._isOpera=this.isOperaBrowser(),this._isEdge=this.isEdgeBrowser(),this._isFirefox=this.isFirefoxBrowser(),this._isChrome=this.isChromeBrowser(),this._isMacOS=this.isMacOS(),this._isAvailableServiceWorker=this.canUseServiceWorkers(),this._isAvailableNotifications=this.canReceiveNotifications(),this._platform=this.getPlatformType(),this._browserVersion=this.getBrowserVersion(),this._formFactor=this.getFormFactor()}get isEdge(){return this._isEdge}get isSafari(){return this._isSafari}get isOpera(){return this._isOpera}get isAvailableServiceWorker(){return this._isAvailableServiceWorker}get isAvailableNotifications(){return this._isAvailableNotifications}get platform(){return this._platform}get browserVersion(){return this._browserVersion}get formFactor(){return this._formFactor}get isMobile(){return"MOBILE"===this._formFactor}get isDesktop(){return"DESKTOP"===this._formFactor}isSafariBrowser(){return"safari"in this.global&&navigator.userAgent.indexOf("Safari")>-1}isOperaBrowser(){return-1!==navigator.userAgent.indexOf("Opera")||-1!==navigator.userAgent.indexOf("OPR")}isEdgeBrowser(){return navigator.userAgent.indexOf("Edge")>-1}isFirefoxBrowser(){return-1!==navigator.userAgent.toLowerCase().indexOf("firefox")}isChromeBrowser(){return/Chrome/.test(navigator.userAgent)&&/Google Inc/.test(navigator.vendor)&&!this._isOpera&&!this._isEdge}isMacOS(){return"platform"in navigator&&-1!==navigator.platform.toLowerCase().indexOf("mac")}canUseServiceWorkers(){return!!navigator.serviceWorker&&"PushManager"in this.global&&"Notification"in this.global}canReceiveNotifications(){return this._isSafari&&this._isMacOS||this._isAvailableServiceWorker&&!this._isEdge}getPlatformType(){let t=11;switch(!0){case this._isSafari:t=10;break;case this._isOpera||this._isChrome:t=11;break;case this._isFirefox:t=12;break;case this._isEdge:t=150}return t}getFormFactor(){const t=navigator.userAgentData;if(t&&"boolean"==typeof t.mobile)return t.mobile?"MOBILE":"DESKTOP";return/Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)?"MOBILE":"DESKTOP"}getBrowserVersion(){const{userAgent:t}=navigator,e=t.match(/\bOPR\/(\d+)/);if(null!==e)return`Opera ${e[1]}`;const s=t.match(/\bEdge\/(\d+)/);if(null!==s)return`Edge ${s[1]}`;const a=t.match(/\bEdg\/(\d+)/);if(null!==a)return`Edge ${a[1]}`;let i=t.match(/(opera|chrome|safari|firefox(?=\/))\/?\s*(\d+)/i)||[];const[,r=""]=i;i=i[2]?[r,i[2]]:[navigator.appName,navigator.appVersion,"-?"];const n=t.match(/version\/([.\d]+)/i);return null!==n&&i.splice(1,1,n[1]),i.join(" ")}}class ht{constructor(t,e,s){this.api=t,this.data=e,this.config=s}getPermission(){return Notification.permission}checkIsPermissionGranted(){return this.getPermission()===o}checkIsPermissionDefault(){return this.getPermission()===c}async checkIsManualUnsubscribed(){return this.data.getStatusManualUnsubscribed()}async askPermission(){await Notification.requestPermission()}async getTokens(){return this.data.getTokens()}async subscribe(t){const e=t||await this.trySubscribe();if(!this.checkIsPermissionGranted())return void X.error("You must have permission granted before subscribe!");const s=this.getPushToken(e),a=e.getKey("p256dh"),i=e.getKey("auth");if(!a||!i)throw new Error("Can't get subscription keys!");const r=btoa(String.fromCharCode.apply(String,new Uint8Array(a))),n=btoa(String.fromCharCode.apply(String,new Uint8Array(i)));await this.data.setTokens({publicKey:r,pushToken:s,authToken:n,endpoint:e.endpoint}),await this.api.registerDevice()}async unsubscribe(){const t=await this.getServiceWorkerRegistration(),e=await t.pushManager.getSubscription();await this.data.setTokens({}),await this.data.setStatusManualUnsubscribed(!0),await this.api.unregisterDevice(),e&&await e.unsubscribe()}async checkIsRegister(){return this.api.checkDeviceSubscribeForPushNotifications()}async checkIsNeedResubscribe(){const t=await this.data.getLastPermissionStatus(),e=this.getPermission();if(t!==e)return await this.data.setLastPermissionStatus(e),!0;const s=await this.getCredentials(),a=this.getPushToken(s),i=await this.data.getTokens(),r=a===(i&&i.pushToken||""),n=await this.data.getIsVapidChanged();return!r||n}async getServiceWorkerRegistration(){if(!this.registration){await this.registerServiceWorker();const t=await this.data.getServiceWorkerUrl();this.registration=await navigator.serviceWorker.getRegistration(t),await this.registration.update()}if(!this.registration)throw new Error("Internal Error: Can't register service worker!");return this.registration}async registerServiceWorker(){const t=await this.data.getServiceWorkerUrl(),e=await this.data.getServiceWorkerScope();let s="";await this.data.getSdkVersion()!==await this.data.getServiceWorkerVersion()&&(s=`?cache_clean=${T()}`),await navigator.serviceWorker.register(`${t}${s}`,{scope:e})}async trySubscribe(){try{return await this.subscribePushManager()}catch(t){return console.error(t),await this.unsubscribe(),this.subscribePushManager()}}async subscribePushManager(){const t=await this.getServiceWorkerRegistration(),e=await this.getApplicationServerKey();return t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e?this.urlBase64ToUint8Array(e):null})}async getCredentials(){const t=await this.getServiceWorkerRegistration();return await t.pushManager.getSubscription()}getPushToken(t){return t?t.endpoint:""}async getApplicationServerKey(){return await this.data.getApplicationServerKey()}urlBase64ToUint8Array(t){const e=(t+"=".repeat((4-t.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),s=atob(e),a=new Uint8Array(s.length);for(let t=0;t<s.length;++t)a[t]=s.charCodeAt(t);return a}}class dt{constructor(t,e,s){this.api=t,this.config=s,this.data=e}getPermission(){const{permission:t}=this.getPermissionInfo();return t}checkIsPermissionGranted(){return this.getPermission()===o}checkIsPermissionDefault(){return this.getPermission()===c}async checkIsManualUnsubscribed(){return await this.data.getStatusManualUnsubscribed()}async askPermission(){const t={application:await this.data.getApplicationCode(),hwid:await this.data.getHwid()};return new Promise(e=>{safari.pushNotification.requestPermission(this.config.entrypoint||"https://cp.pushwoosh.com/json/1.3/safari",this.config.webSitePushId,t,()=>e())})}getTokens(){return this.data.getTokens()}async subscribe(){if(!this.checkIsPermissionGranted())return void X.error("You must have permission granted before subscribe!");const{deviceToken:t}=this.getPermissionInfo();await this.data.setTokens({pushToken:t}),await this.api.registerDevice()}async unsubscribe(){await this.data.setTokens({}),await this.data.setStatusManualUnsubscribed(!0),await this.api.unregisterDevice()}async checkIsRegister(){return this.api.checkDeviceSubscribeForPushNotifications()}async checkIsNeedResubscribe(){const t=await this.data.getWebSitePushId(),e=void 0!==t&&this.config.webSitePushId!==t;await this.data.setWebSitePushId(this.config.webSitePushId);const s=await this.data.getLastPermissionStatus(),a=this.getPermission();return s!==a?(await this.data.setLastPermissionStatus(a),!0):e}getPermissionInfo(){return safari.pushNotification.permission(this.config.webSitePushId)}}class gt{constructor(){this.ready=!1,this.moduleRegistry={},this.addEventHandler=(t,e)=>this.eventBus.addEventHandler(t,e),this.removeEventHandler=(t,e)=>this.eventBus.removeEventHandler(t,e),this.dispatchEvent=(t,e)=>this.eventBus.dispatchEvent(t,e),this.debug={async showLog(){const t=await G.getAll();console.log(t)},async showKeyValues(){const t=await K.getAll();console.log(t)},async showMessages(){(await J.getAll()).forEach(t=>console.log(t))}},this.eventBus=new Z,this.data=new nt,this.apiClient=new ot(this.data),this.api=new ct(this.eventBus,this.data,this.apiClient,()=>this.isCommunicationDisabled),this.platformChecker=new ut(M()),this.inboxModel=new it(this.eventBus,this.data,this.api),this.pwinbox=new et(this.data,this.api,this.inboxModel)}push(t){if(_(t))this.subscribeToLegacyEvents(u,t);else{if(!Array.isArray(t))throw new Error("Invalid command!");if("init"===t[0])this.initialize(t[1]).catch(t=>{console.error("Pushwoosh: Error during initialization",t)});else if(!this.subscribeToLegacyEvents(t[0],t[1]))throw console.log("Pushwoosh: Unknown command",t),new Error("Unknown command!")}}async subscribe(t=!0){if(this.isCommunicationDisabled)throw new Error("Communication is disabled!");if(this.driver.checkIsPermissionDefault()){this.eventBus.dispatchEvent("show-notification-permission-dialog",{}),await this.driver.askPermission();const t=this.driver.getPermission();this.eventBus.dispatchEvent("hide-notification-permission-dialog",{permission:t})}const e=this.driver.getPermission(),s=await this.data.getStatusManualUnsubscribed(),a=await this.api.checkDeviceSubscribeForPushNotifications(!1);if(e===o){this.eventBus.dispatchEvent("permission-granted",{});return(!a&&!s||t)&&await this.driver.subscribe(),void this.eventBus.dispatchEvent("subscribe",{})}if(e===n)return this.eventBus.dispatchEvent("permission-denied",{}),void(a&&await this.driver.unsubscribe())}async unsubscribe(){try{await this.driver.unsubscribe()}catch(t){throw X.error(t,"Error occurred during the unsubscribe"),t}}async forceSubscribe(){await this.subscribe(!0)}isDeviceRegistered(){return localStorage.getItem(a)===i}isDeviceUnregistered(){return localStorage.getItem(a)===r}async isSubscribed(){return this.api.checkDeviceSubscribeForPushNotifications()}async isCommunicationEnabled(){return!await this.data.getStatusCommunicationDisabled()}async setCommunicationEnabled(t=!0){if(await this.data.setCommunicationEnabled(t),t){this.isCommunicationDisabled=!1,await this.data.setStatusDropAllData(!1),await this.finishInit();this.driver.checkIsPermissionGranted()&&(await this.api.registerDevice(),await this.sendData())}else await this.api.unregisterDevice();this.eventBus.dispatchEvent("change-enabled-communication",{isEnabled:t});const e=await this.data.getDeviceType();await this.api.postEvent("GDPRConsent",{channel:t,device_type:e})}async removeAllDeviceData(){const t=await this.data.getDeviceType();await this.api.postEvent("GDPRDelete",{status:!0,device_type:t}),await this.api.deleteDevice(),await this.data.clearAll(),await this.data.setStatusDropAllData(!0)}async getHWID(){return await this.data.getHwid()}async getPushToken(){const{pushToken:t}=await this.data.getTokens();return t}async getUserId(){return await this.data.getUserId()}async getParams(){return await this.api.getParams()}isAvailableNotifications(){return this.platformChecker.isAvailableNotifications}async sendStatisticsVisitedPage(){const{document:{title:t},location:{origin:e,pathname:s,href:a}}=window;await this.api.pageVisit({title:t,url_path:`${e}${s}`,url:a})}async initialize(t){this.initParams={...x,...t};const e=localStorage.getItem("PW_SET_LOGGER_LEVEL");if(X.setLevel(e||t.logLevel||"error"),t.logLevel&&await this.data.setLogLevel(t.logLevel),!this.isAvailableNotifications())return;if(!t.applicationCode)throw new Error("Can't find application code!");const s=!1===t.communicationEnabled,a=await this.data.getCommunicationEnabled(),i=await this.data.getStatusCommunicationDisabled();(s&&!0!==a||!1===a||i)&&(this.isCommunicationDisabled=!0);const r=await this.data.getApplicationCode(),n=await this.isUserIdChanged();(!r||r!==t.applicationCode||n)&&(await this.data.setHwid(""),await this.data.setUserId(),await this.data.setEmail(),await this.data.setStatusLanguageWasChanged(!1)),await this.data.setApplicationCode(t.applicationCode);const o=t.unifiedPlatform?11:this.platformChecker.getPlatformType();await this.data.setDeviceType(o),await this.data.setFormFactor(this.platformChecker.formFactor),await this.data.setDeviceModel(this.platformChecker.getBrowserVersion());if(await this.data.getStatusLanguageWasChanged()||await this.data.setLanguage(t.tags?.Language||navigator.language),await this.data.setApiEntrypoint(t.pushwooshUrl||""),await this.data.setApiToken(t.apiToken||""),await this.data.setSdkVersion("3.58.0"),this.isCommunicationDisabled)this.eventBus.dispatchEvent("communication-disabled",{});else{await this.finishInit();try{await this.inboxModel.updateMessages()}catch(t){X.write("error",t)}const e=await this.data.getDelayedEvent();if(e){const{type:t,payload:s}=e;this.emitLegacyEventsFromServiceWorker(t,s),await this.data.setDelayedEvent(null)}if(this.platformChecker.isSafari&&!t.unifiedPlatform){const t=/#P(.*)/,e=decodeURIComponent(document.location.hash);t.test(e)&&this.api.pushStat(t.exec(e)[1]).then(()=>history.pushState(null,"","#"))}}}async finishInit(){await this.ensureHwid(),await this.loadConfig(),await this.open(),await this.sendData();await this.data.getApplicationServerKey()?await this.initPushNotifications(this.initParams):X.error("Pushwoosh: No vapid key found! Please, check your application settings in Pushwoosh dashboard."),this.ready=!0,this.eventBus.dispatchEvent("ready",{}),"serviceWorker"in navigator&&(navigator.serviceWorker.onmessage=t=>this.onServiceWorkerMessage(t)),localStorage.setItem("pushwoosh-websdk-status","init"),document.dispatchEvent(new CustomEvent("pushwoosh.initialized",{detail:{pw:this}}))}async ensureHwid(t=!1){await this.data.getHwid()&&!t||await this.data.setHwid(this.initParams.applicationCode+"_"+T())}async isUserIdChanged(){const{userId:t}=this.initParams,e=await this.data.getUserId(),s=await this.data.getStatusUserIdWasChanged();return!!t&&"user_id"!==t&&t!==e&&!s}async defaultProcess(){const t=this.driver.getPermission();"granted"===t&&await this.data.setLastPermissionStatus(t);const e=await this.data.getStatusCommunicationDisabled(),s=await this.data.getStatusDropAllData(),a=await this.driver.checkIsNeedResubscribe();if(e||s)return void await this.unsubscribe();a&&(await this.unsubscribe(),await this.data.setStatusManualUnsubscribed(!1),await this.data.setIsVapidChanged(!1));const i=await this.data.getStatusManualUnsubscribed(),r=await this.api.checkDeviceSubscribeForPushNotifications(!1);switch(t){case c:this.eventBus.dispatchEvent("permission-default",{}),r&&await this.unsubscribe();break;case n:this.eventBus.dispatchEvent("permission-denied",{}),r&&await this.unsubscribe();break;case o:this.eventBus.dispatchEvent("permission-granted",{}),i&&r&&await this.unsubscribe(),(!r&&!i||a)&&await this.subscribe(!0)}}onServiceWorkerMessage(t){const{data:e={}}=t||{},{type:s="",payload:a={}}=e||{};this.emitLegacyEventsFromServiceWorker(s,a)}async open(t){let e=await this.data.getLastOpenApplicationTime();const s=Date.now();e||(e=0);(t||!(s-e<36e5))&&(await this.data.setLastOpenApplicationTime(s),await this.api.applicationOpen())}async sendData(){const t=this.initParams,e=await this.data.getUserId();t.userId&&"user_id"!==t.userId&&t.userId!==e&&await this.api.registerUser(t.userId,!1);const s=[{test:async()=>{if(await this.data.getStatusEmailWasChanged())return!1;const e=await this.data.getEmail();return!!t.email&&t.email!==e},task:async()=>{await this.api.registerEmail(t.email,!1)}},{test:async()=>{if(await this.data.getStatusSmsNumberWasChanged())return!1;const e=await this.data.getSmsNumber();return!!t.smsNumber&&t.smsNumber!==e},task:async()=>{await this.api.registerSmsNumber(t.smsNumber,!1)}},{test:async()=>{if(await this.data.getStatusWhatsAppNumberWasChanged())return!1;const e=await this.data.getWhatsAppNumber();return!!t.whatsAppNumber&&t.whatsAppNumber!==e},task:async()=>{await this.api.registerWhatsappNumber(t.whatsAppNumber,!1)}},{test:async()=>!!t.tags||await this.data.getStatusLanguageWasChanged(),task:async()=>{const e=await this.data.getLanguage(),s={...t.tags||{},Language:e};await this.api.setTags(s)}}];await Promise.all(s.map(async t=>{try{await t.test()&&await t.task()}catch(t){console.error("Pushwoosh: Error during data registration",t)}}))}async loadConfig(){const t=await this.api.getConfig(["page_visit","vapid_key","web_in_apps","events","subscription_prompt","popup_forms"]),e=t&&t.features;if(await this.data.setFeatures(e),e){if(e.page_visit&&e.page_visit.enabled&&(await K.set("PAGE_VISITED_URL",e.page_visit.entrypoint),this.sendStatisticsVisitedPage()),e.events&&e.events.length){e.events.some(t=>t===D)&&this.sendPostEventVisitedPage()}if(e.vapid_key){const t=await this.data.getApplicationServerKey();await this.data.setApplicationServerKey(e.vapid_key),t!==e.vapid_key&&await this.data.setIsVapidChanged(!0)}}}async initPushNotifications(t){await this.data.setDefaultNotificationImage(t.defaultNotificationImage),await this.data.setDefaultNotificationTitle(t.defaultNotificationTitle),await this.data.setServiceWorkerUrl(t.serviceWorkerUrl),await this.data.setServiceWorkerScope(t.scope),await this.data.setInitParams(t),await this.initDriver();try{await this.defaultProcess()}catch(t){X.error(t,"Internal error: defaultProcess fail")}}async initDriver(){if(this.platformChecker.isSafari&&!this.initParams.unifiedPlatform){const{safariWebsitePushID:t}=await this.data.getInitParams();return t?void(this.driver=new dt(this.api,this.data,{webSitePushId:t})):void X.info("For work with Safari Push Notification add safariWebsitePushID to initParams!")}X.info({isAvailableServiceWorker:this.platformChecker.isAvailableServiceWorker}),this.platformChecker.isAvailableServiceWorker&&(this.driver=new ht(this.api,this.data,{}))}async sendPostEventVisitedPage(){const{document:{title:t},location:{href:e}}=window,s=await this.data.getDeviceType();this.api.postEvent(D,{url:e,title:t,device_type:s})}subscribeToLegacyEvents(t,e){let s=!0;switch(!0){case"onLoad"===t:e();break;case t===u:if(this.ready){e(this.api);break}this.eventBus.addEventHandler("ready",()=>e(this.api));break;case t in W:this.eventBus.addEventHandler(W[t].name,s=>{const{prop:a}=W[t];e(this.api,a?s[a]:void 0)});break;default:s=!1}return s}emitLegacyEventsFromServiceWorker(t,e){switch(t){case b:this.eventBus.dispatchEvent("receive-push",{notification:e});break;case v:this.eventBus.dispatchEvent("open-notification",{notification:e});break;case y:this.eventBus.dispatchEvent("hide-notification",{notification:e});break;case S:this.eventBus.dispatchEvent("receive-inbox-message",{message:e})}}}return e})());
|
|
2
2
|
//# sourceMappingURL=npm.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "web-push-notifications",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.58.0",
|
|
4
4
|
"description": "Pushwoosh web push notifications",
|
|
5
5
|
"main": "npm.js",
|
|
6
6
|
"types": "npm.d.ts",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
},
|
|
32
32
|
"homepage": "https://github.com/Pushwoosh/web-push-notifications#readme",
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"smart-blocks-utils": "^1.0.
|
|
34
|
+
"smart-blocks-utils": "^1.0.4",
|
|
35
35
|
"preact": "^10.0.0"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
package/service-worker.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var a in s)("object"==typeof exports?exports:t)[a]=s[a]}}(this,()=>(()=>{"use strict";const t="deviceRegistrationStatus",e="registered",s="unregistered";function a(t,e){if("string"==typeof t)try{return JSON.parse(t)}catch(t){console.log(t)}return void 0===t&&void 0!==e?e:t}function i(){return crypto.randomUUID?.()||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}const n=t=>"function"==typeof t,r="keyValue",o="messages",c="log",u="inboxMessages";function h(t,e){return function(s){s.objectStoreNames.contains(t)||e(s)}}const d=[h(r,function(t){t.createObjectStore(r,{keyPath:"key"})}),h(c,function(t){const e=t.createObjectStore(c,{keyPath:"id",autoIncrement:!0});e.createIndex("environment","environment",{unique:!1}),e.createIndex("date","date",{unique:!1}),e.createIndex("type","type",{unique:!1})}),h(o,function(t){t.createObjectStore(o,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),h(u,function(t){const e="status",s=t.createObjectStore(u,{keyPath:"inbox_id",autoIncrement:!1});s.createIndex(e,e,{unique:!1,multiEntry:!0}),s.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class l{get all(){return d}}class g{constructor(t,e=new l){this.db=t,this.migrationsBuilder=e}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(t){t.forEach(t=>{t(this.db)})}}function p(t,e){console.info("onversionchange",e),t.close()}let m;function w(){return m||(m=new Promise((t,e)=>{const s=indexedDB.open("PUSHWOOSH_SDK_STORE",7);s.onsuccess=s=>{const a=s.target.result;a.onversionchange=p.bind(null,a,e),t(a)},s.onerror=()=>e(s.error),s.onupgradeneeded=t=>{const s=t.target.result;s.onversionchange=p.bind(null,s,e);new g(s).applyMigrations()}})),m}function y(t){return w().then(e=>new Promise((s,a)=>t(e,s,a)))}class b{_add(t){return y((e,s,a)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).add(t);i.onsuccess=()=>{s(t)},i.onerror=()=>{a(i.error)}}).then(t=>this.getAll().then(e=>{if(Array.isArray(e)){const s=e.map(t=>t.id).sort((t,e)=>t==e?0:t<e?1:-1);if(s.length>this.maxItems)return Promise.all(s.slice(this.maxItems).map(t=>this.delete(t))).then(()=>t)}return t}))}delete(t){return y((e,s,a)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).delete(t);i.onsuccess=()=>{s(i.result)},i.onerror=()=>{a(i.error)}})}getAll(){return y((t,e,s)=>{const a=[],i=t.transaction(this.name).objectStore(this.name).openCursor();i.onsuccess=t=>{const s=t.target.result;s?(s.value&&a.push(s.value),s.continue()):e(a)},i.onerror=()=>{s(i.error)}})}}const f=(v=r,{get:(t,e)=>y((s,a,i)=>{const n=s.transaction(v).objectStore(v).get(t);let r,o=!1,c=!1;const u=()=>{clearTimeout(r),o?a(n.result?.value||e):c?i(n.error):r=setTimeout(u,0)};n.onsuccess=()=>o=!0,n.onerror=()=>c=!0,u()}),getAll:()=>y((t,e,s)=>{const a={},i=t.transaction(v).objectStore(v).openCursor();let n,r=!1,o=!1;const c=()=>{clearTimeout(n),r?e(a):o?s(i.error):n=setTimeout(c,0)};i.onsuccess=t=>{const e=t.target.result;e?(a[e.key]=e.value.value,e.continue()):r=!0},i.onerror=()=>o=!0,c()}),async extend(t,e){const s=await this.get(t),{...a}=e;await this.set(t,{...s,...a})},set:(t,e)=>y((s,a,i)=>{const n=s.transaction([v],"readwrite").objectStore(v).put({key:t,value:e});let r,o=!1,c=!1;const u=()=>{clearTimeout(r),o?a(t):c?i(n.error):r=setTimeout(u,0)};n.onsuccess=()=>o=!0,n.onerror=()=>c=!0,u()})});var v;const S=new class extends b{constructor(){super(...arguments),this.name=c,this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(t,e,s){const a={type:t,environment:this.environment,message:`${e}`,date:new Date};return e instanceof Error&&(a.stack=e.stack),s&&(a.additional=s),this._add(a)}},C=new class extends b{constructor(){super(...arguments),this.name=o,this.maxItems=25}add(t){return this._add({...t,date:new Date})}},x={error:1,info:2,debug:3};let P=3;const D={setLevel(t){x[t]||(t="error"),P=x[t]},write(t,e,s){return"error"===t?this.error(e):this.info(e),S.add(t,e,s)}};Object.keys(x).forEach(t=>{const e=x[t];D[t]=(...s)=>{e<=P&&(console.groupCollapsed(t),console.info("",...s),console.trace("trace"),console.groupEnd())}});const I="silent",T="fatal",k="error",M="warn",E="info",R="debug",_={[I]:0,[T]:10,[k]:20,[M]:30,[E]:40,[R]:50};function A(t){const{code:e,text:s,type:a}=t,i=function(t){switch(t){case"fatal":case"error":return console.error;case"warn":case"info":case"debug":return console.log}}(a);console.groupCollapsed(a),i(e?`${e}: ${s}`:s),console.groupEnd()}const W=new class{constructor(t){this.relations=_,this.level=t&&void 0!==t.level?t.level:k,this.applicationType=t&&void 0!==t.applicationType?t.applicationType:"sdk",this.subscribers=t&&void 0!==t.subscribers?t.subscribers:[]}updateLogLevel(t){this.level=t}updateApplicationType(t){this.applicationType=t}updateApplicationCode(t){this.applicationCode=t}updateDomain(t){this.domain=t}updateDeviceInfo(t){this.deviceInfo=t}subscribe(t,e){this.subscribers.push({handler:e,level:t})}async log(t){const e=[],{options:s,...a}=t;let i=a;if(s){const{handler:t,...e}=s;i={...a,...e}}const n=this.getMessage(i);this.subscribers.forEach(s=>{s.level===t.type&&this.relations[s.level]<=this.relations[this.level]&&e.push(s.handler.call(null,n))}),s&&s.handler&&this.level!==I&&s.handler.call(null,n),await Promise.all(e)}async debug(t,e){return this.log({type:R,text:t,options:e})}async info(t,e){return this.log({type:E,text:t,options:e})}async warn(t,e,s){return this.log({type:M,text:t,code:e,options:s})}async error(t,e,s){return this.log({type:k,text:t,code:e,options:s})}async fatal(t,e,s){return this.log({type:T,text:t,code:e,options:s})}async errorAndThrow(t,e,s){return this.logAndThrow({type:k,text:t,code:e,options:s})}async errorAndReject(t,e,s,a){return this.logAndReject(t,{type:k,text:e,code:s,options:a})}async fatalAndThrow(t,e,s){return this.logAndThrow({type:T,text:t,code:e,options:s})}async fatalAndReject(t,e,s,a){return this.logAndReject(t,{type:T,text:e,code:s,options:a})}async logAndThrow(t){await this.log(t);const e=new Error(t.text);throw t.code&&(e.code=t.code),e}async logAndReject(t,e){await this.log(e);const s=new Error(e.text);e.code&&(s.code=e.code),t(s)}getMessage(t){return{applicationCode:this.applicationCode,domain:this.domain,applicationType:this.applicationType,deviceInfo:this.deviceInfo,...t}}}({level:"error",subscribers:[{level:"fatal",handler:A},{level:"error",handler:A}]});async function N(t){const e=q(t);return W.fatal(e.text,e.code,e.options)}function q(t){const{message:e,code:s,error:a,...i}=t,n=function(t){let e=new Error("unknown error");"string"!=typeof t&&"number"!=typeof t&&"boolean"!=typeof t||(e.message=t.toString());t instanceof Error&&(e=t);return e}(a);return{text:e,code:s,options:{...i,errorText:n.message,errorStack:n.stack}}}class L{constructor(t=new Date){this._date=t}set date(t){this._date=t}get date(){return this._date}getUtcTimestamp(){return Math.floor((this.date.getTime()+60*this.date.getTimezoneOffset()*1e3)/1e3)}getTimestamp(){return Math.round(this.date.getTime()/1e3)}setLocal(){const t=this._date.getTime()-60*this.date.getTimezoneOffset()*1e3;this._date=new Date(t)}addDays(t){const e=this._date.getTime()+24*t*60*60*1e3;this._date=new Date(e)}getInboxFakeOrder(){return(100*this._date.getTime()+9e9).toString()}}class O{constructor(t,e,s,a=new L){this.data=t,this.api=e,this.inboxModel=s,this.dateModule=a,this.publicMessageBuilder=this.publicMessageBuilder.bind(this)}messageTypeFactory(t,e){let s=0;return 2===t?s=1:"l"in e&&null!=e.l&&(s=e.l.startsWith("http")?2:3),s}async updateMessagesStatusWithCodes(t,e,s){const a=[],i=[];e.forEach(async e=>{-1!==t.indexOf(e.inbox_id)&&(e.status=s,a.push(e),i.push(this.api.inboxStatus(e.order,e.status)))}),await this.inboxModel.putBulkMessages(a),await Promise.all(i)}async publicMessageBuilder({action_type:t,action_params:e,image:s,title:a,send_date:i,inbox_id:n,text:r,status:o}){const c=s||await this.data.getDefaultNotificationImage(),u=a||await this.data.getDefaultNotificationTitle(),h=JSON.parse(e);return this.dateModule.date=new Date(1e3*parseInt(i)),this.dateModule.setLocal(),{title:u,imageUrl:c,code:n,message:r,sendDate:this.dateModule.date.toISOString(),type:this.messageTypeFactory(t,h),link:h?.l||"/",isRead:2===o||3===o,isActionPerformed:3===o}}messagesWithNoActionPerformedCount(){return this.inboxModel.getDeliveredReadMessagesCount()}unreadMessagesCount(){return this.inboxModel.getDeliveredMessagesCount()}messagesCount(){return this.inboxModel.messagesCount()}async loadMessages(){const t=[...await this.inboxModel.getReadOpenMessages(),...await this.inboxModel.getDeliveredMessages()].sort((t,e)=>parseInt(e.send_date,10)-parseInt(t.send_date,10)).sort((t,e)=>parseInt(e.order||"0",10)-parseInt(t.order||"0",10)).map(this.publicMessageBuilder);return Promise.all(t)}async readMessagesWithCodes(t){const e=await this.inboxModel.getDeliveredMessages();await this.updateMessagesStatusWithCodes(t,e,2)}async performActionForMessageWithCode(t){const e=await this.inboxModel.getMessage(t),s=JSON.parse(e.action_params),a=this.messageTypeFactory(e.action_type,s);2===a&&null!=s.l?document.location.href=s.l:3===a&&null!=s.l&&window.history.go(s.l),e.status=3,await this.inboxModel.putMessage(e),await this.api.inboxStatus(e.order,e.status)}async deleteMessagesWithCodes(t){const e=await this.inboxModel.getReadOpenMessages(),s=await this.inboxModel.getDeliveredMessages();await this.updateMessagesStatusWithCodes(t,[...e,...s],4)}async syncMessages(){await this.inboxModel.updateMessages()}}class U{constructor(t,e){this.name=e,this.store=t.transaction(this.name,"readwrite").objectStore(this.name)}set index(t){this.store.indexNames.contains(t)?this._index=this.store.index(t):console.warn(`Index "${t}" in `)}writeRequestPromise(t,e){return new Promise((s,a)=>{t.onsuccess=()=>{s(e)},t.onerror=()=>{a(t.error)}})}readRequestPromise(t,e){return new Promise((s,a)=>{t.onsuccess=t=>{const a=t.target;s(a.result||e)},t.onerror=()=>{a(t.error)}})}put(t,e){const s=this.store.put(t,e);return this.writeRequestPromise(s,e)}add(t,e){return this.put(t,e)}delete(t){const e=this.store.delete(t);return this.writeRequestPromise(e)}get(t,e){const s=this.store.get(t);return this.readRequestPromise(s,e)}getAll(){const t=this.store.openCursor(),e=[];return new Promise((s,a)=>{t.onsuccess=t=>{const a=t.target.result;a?(e.push(a.value),a.continue()):s(e)},t.onerror=()=>{a(t.error)}})}count(t){const e=this.store.count(t);return this.readRequestPromise(e,0)}countByIndex(t){const e=this._index.count(t);return this.readRequestPromise(e,0)}}class V{getDB(){return w()}async put(t,e,s){const a=await this.getDB();return new U(a,t).put(e,s)}async delete(t,e){const s=await this.getDB();return new U(s,t).delete(e)}async get(t,e,s){const a=await this.getDB();return new U(a,t).get(e,s)}async getAll(t){const e=await this.getDB(),s=new U(e,t);return await s.getAll()||[]}async count(t,e){const s=await this.getDB();return new U(s,t).count(e)}async countByIndex(t,e,s){const a=await this.getDB(),i=new U(a,t);return i.index=e,i.countByIndex(s)}}class j{constructor(t,e,s,a=new V,i=new L){this.eventBus=t,this.data=e,this.api=s,this.storage=a,this.storeName="inboxMessages",this.dateModule=i}async getInboxMessages(){const t=await this.api.getInboxMessages();return await this.storeGetInboxMessagesRequestParams(t.next,t.new_inbox),t}async storeGetInboxMessagesRequestParams(t,e){this.dateModule.date=new Date,await this.data.setInboxLastRequestTime(this.dateModule.getUtcTimestamp()),await this.data.setInboxLastRequestCode(t),await this.data.setInboxNewMessagesCount(e)}async putServerMessages(t){const e=t.map(async t=>{const e=await this.storage.get(this.storeName,t.inbox_id,{});return"status"in e&&(t.status=e.status),this.putMessage(t)});return Promise.all(e)}putMessage(t){return this.storage.put(this.storeName,t)}putBulkMessages(t){const e=t.map(t=>this.putMessage(t));return Promise.all(e)}deleteMessages(t){const e=t.map(t=>this.storage.delete(this.storeName,t));return Promise.all(e)}async deleteExpiredMessages(){this.dateModule.date=new Date;const t=this.dateModule.getTimestamp().toString(),e=(await this.storage.getAll(this.storeName)).filter(e=>e.rt<t).map(t=>t.inbox_id);return this.deleteMessages(e)}getMessage(t){return this.storage.get(this.storeName,t)}async getReadOpenMessages(){return(await this.storage.getAll(this.storeName)).filter(t=>2===t.status||3===t.status)}async getDeliveredMessages(){return(await this.storage.getAll(this.storeName)).filter(t=>1===t.status)}async messagesCount(){return this.storage.count(this.storeName)}async getDeliveredMessagesCount(){return this.storage.countByIndex(this.storeName,"status",1)}async getReadMessagesCount(){return this.storage.countByIndex(this.storeName,"status",2)}async getDeliveredReadMessagesCount(){const[t,e]=[2,3],s=IDBKeyRange.bound(t,e);return this.storage.countByIndex(this.storeName,"status",s)}async updateMessages(){const t=await this.getInboxMessages();await this.deleteExpiredMessages(),t.deleted&&await this.deleteMessages(t.deleted),await this.putServerMessages(t.messages),this.eventBus.dispatchEvent("update-inbox-messages",{messages:new O(this.data,this.api,this)})}}const B={"&":"&","<":"<",">":">",""":'"',"'":"'"},F=/&(?:amp|lt|gt|quot|#39);/g,$=RegExp(F.source);const H=t=>`params.${t}`;class K{constructor(t=f){this.store=t}async clearAll(){const t=["applicationCode","apiToken","hwid","deviceType","deviceModel","language","languageWasChanged","apiEntrypoint","tokens","applicationServerKey","isVapidChanged","webSitePushId","defaultNotificationImage","defaultNotificationTitle","userId","userIdWasChanged","email","emailWasChanged","isLastPermissionStatus","isManualUnsubscribed","isCommunicationDisabled","communicationEnabled","isDropAllData","sdkVersion","serviceWorkerVersion","serviceWorkerUrl","serviceWorkerScope","lastOpenMessage","lastOpenApplicationTime","features","init","inbox.lastRequestCode","inbox.lastRequestTime","inbox.newMessagesCount","delayedEvent","promptDisplayCount","promptLastSeenTime","logLevel","shownWebPopups","isRecurringVisitor"];for(const e of t)await this.store.set(H(e),void 0)}async setApplicationCode(t){await this.store.set(H("applicationCode"),t)}async getApplicationCode(){return this.store.get(H("applicationCode"))}async setApiToken(t){return await this.store.set(H("apiToken"),t)}async getApiToken(){return this.store.get(H("apiToken"))}async setHwid(t){await this.store.set(H("hwid"),t)}async getHwid(){return this.store.get(H("hwid"))}async setDeviceType(t){await this.store.set(H("deviceType"),t)}async getDeviceType(){return this.store.get(H("deviceType"))}async setFormFactor(t){await this.store.set(H("formFactor"),t)}async getFormFactor(){return this.store.get(H("formFactor"))}async setDeviceModel(t){await this.store.set(H("deviceModel"),t)}async getDeviceModel(){return this.store.get(H("deviceModel"))}async setLanguage(t){await this.store.set(H("language"),t)}async getLanguage(){return this.store.get(H("language"),"en")}async setStatusLanguageWasChanged(t){await this.store.set(H("languageWasChanged"),t)}async getStatusLanguageWasChanged(){return this.store.get(H("languageWasChanged"),!1)}async setApiEntrypoint(t){await this.store.set(H("apiEntrypoint"),t)}async getApiEntrypoint(){return this.store.get(H("apiEntrypoint"),"https://api.pushwoosh.com/json/1.3/")}async setTokens(t){await this.store.set(H("tokens"),t)}getTokens(){return this.store.get(H("tokens"))}async setApplicationServerKey(t){await this.store.set(H("applicationServerKey"),t)}async getApplicationServerKey(){return this.store.get(H("applicationServerKey"))}async setIsVapidChanged(t){await this.store.set(H("isVapidChanged"),t)}async getIsVapidChanged(){return this.store.get(H("isVapidChanged"),!1)}async setWebSitePushId(t){await this.store.set(H("webSitePushId"),t)}async getWebSitePushId(){return this.store.get(H("webSitePushId"))}async setDefaultNotificationImage(t){await this.store.set(H("defaultNotificationImage"),t)}async getDefaultNotificationImage(){return this.store.get(H("defaultNotificationImage"),"https://cp.pushwoosh.com/img/logo-medium.png")}async setDefaultNotificationTitle(t){await this.store.set(H("defaultNotificationTitle"),t)}async getDefaultNotificationTitle(){return this.store.get(H("defaultNotificationTitle"),"Pushwoosh notification")}async setUserId(t){await this.store.set(H("userId"),t?`${t}`:void 0)}async getUserId(){return this.store.get(H("userId"))}async setStatusUserIdWasChanged(t){await this.store.set(H("userIdWasChanged"),t)}async getStatusUserIdWasChanged(){return this.store.get(H("userIdWasChanged"),!1)}async setEmail(t){await this.store.set(H("email"),t?`${t}`:void 0)}async getEmail(){return this.store.get(H("email"))}async setStatusEmailWasChanged(t){await this.store.set(H("emailWasChanged"),t)}async getStatusEmailWasChanged(){return this.store.get(H("emailWasChanged"),!1)}async setSmsNumber(t){await this.store.set(H("smsNumber"),t?`${t}`:void 0)}async getSmsNumber(){return this.store.get(H("smsNumber"))}async setStatusSmsNumberWasChanged(t){await this.store.set(H("smsNumberWasChanged"),t)}async getStatusSmsNumberWasChanged(){return this.store.get(H("smsNumberWasChanged"),!1)}async setWhatsAppNumber(t){await this.store.set(H("whatsAppNumber"),t?`${t}`:void 0)}async getWhatsAppNumber(){return this.store.get(H("whatsAppNumber"))}async setStatusWhatsAppNumberWasChanged(t){await this.store.set(H("whatsAppNumberWasChanged"),t)}async getStatusWhatsAppNumberWasChanged(){return this.store.get(H("whatsAppNumberWasChanged"),!1)}async setLastPermissionStatus(t){await this.store.set(H("isLastPermissionStatus"),t)}async getLastPermissionStatus(){return this.store.get(H("isLastPermissionStatus"))}async setStatusManualUnsubscribed(t){await this.store.set(H("isManualUnsubscribed"),t)}getStatusManualUnsubscribed(){return this.store.get(H("isManualUnsubscribed"),!1)}async setStatusCommunicationDisabled(t){await this.store.set(H("isCommunicationDisabled"),t)}getStatusCommunicationDisabled(){return this.store.get(H("isCommunicationDisabled"),!1)}async setCommunicationEnabled(t){await this.store.set(H("communicationEnabled"),t)}getCommunicationEnabled(){return this.store.get(H("communicationEnabled"))}async setStatusDropAllData(t){await this.store.set(H("isDropAllData"),t)}getStatusDropAllData(){return this.store.get(H("isDropAllData"),!1)}async setSdkVersion(t){await this.store.set(H("sdkVersion"),t)}async getSdkVersion(){return this.store.get(H("sdkVersion"))}async setServiceWorkerVersion(t){await this.store.set(H("serviceWorkerVersion"),t)}getServiceWorkerVersion(){return this.store.get(H("serviceWorkerVersion"))}async setServiceWorkerUrl(t){t&&await this.store.set(H("serviceWorkerUrl"),t)}async getServiceWorkerUrl(){return this.store.get(H("serviceWorkerUrl"),"/pushwoosh-service-worker.js")}async setServiceWorkerScope(t){t&&await this.store.set(H("serviceWorkerScope"),t)}async getServiceWorkerScope(){return this.store.get(H("serviceWorkerScope"))}async setLastOpenMessage(t){await this.store.set(H("lastOpenMessage"),t)}getLastOpenMessage(){return this.store.get(H("lastOpenMessage"))}async setLastOpenApplicationTime(t){await this.store.set(H("lastOpenApplicationTime"),t)}async getLastOpenApplicationTime(){return this.store.get(H("lastOpenApplicationTime"))}async setFeatures(t){await this.store.set(H("features"),t)}async getFeatures(){return this.store.get(H("features"))}async setInitParams(t){await this.store.set(H("init"),t)}async getInitParams(){return this.store.get(H("init"))}async setInboxLastRequestCode(t){await this.store.set(H("inbox.lastRequestCode"),t)}async getInboxLastRequestCode(){return this.store.get(H("inbox.lastRequestCode"),"")}async setInboxLastRequestTime(t){await this.store.set(H("inbox.lastRequestTime"),t)}async getInboxLastRequestTime(){return this.store.get(H("inbox.lastRequestTime"),0)}async setInboxNewMessagesCount(t){await this.store.set(H("inbox.newMessagesCount"),t)}async getInboxNewMessagesCount(){return this.store.get(H("inbox.newMessagesCount"),0)}async setDelayedEvent(t){await this.store.set(H("delayedEvent"),t)}getDelayedEvent(){return this.store.get(H("delayedEvent"))}async setPromptDisplayCount(t){await this.store.set(H("promptDisplayCount"),t)}async getPromptDisplayCount(){return this.store.get(H("promptDisplayCount"),0)}async setPromptLastSeenTime(t){await this.store.set(H("promptLastSeenTime"),t)}async getPromptLastSeenTime(){return this.store.get(H("promptLastSeenTime"),0)}async setLogLevel(t){await this.store.set(H("logLevel"),t)}async getLogLevel(){return this.store.get(H("logLevel"),"error")}async getShownWebPopups(){return this.store.get(H("shownWebPopups"),[])}async addShownWebPopup(t){const e=await this.getShownWebPopups();e.includes(t)||(e.push(t),await this.store.set(H("shownWebPopups"),e))}async setIsRecurringVisitor(t){await this.store.set(H("isRecurringVisitor"),t)}async getIsRecurringVisitor(){return this.store.get(H("isRecurringVisitor"),!1)}}class z{constructor(t,e=new K,s=new L){if("data"in t){const e=t;this.payload=e.data}else this.payload=t;this.data=e,this.code=`notificationCode-${Date.now()}-${Math.random().toString(16).slice(2,10)}`,this.dateModule=s}async getIcon(){return this.payload.i||await this.data.getDefaultNotificationImage()}async getTitle(){return this.payload.header||await this.data.getDefaultNotificationTitle()}get silent(){return Boolean(this.payload.silent)}get body(){return this.payload.body}get messageHash(){return this.payload.p||""}get metaData(){return this.payload.md?a(this.payload.md):{}}get image(){return this.payload.image||""}get buttons(){return this.payload.buttons?a(this.payload.buttons):[]}get customData(){return this.payload.u?a(this.payload.u):{}}get campaignCode(){return this.payload.pwcid||""}get link(){return this.payload.l?(t=this.payload.l)&&$.test(t)?t.replace(F,t=>B[t]):t:"/";var t}get inboxId(){return this.payload.pw_inbox||""}get inboxParams(){return this.payload.inbox_params?a(this.payload.inbox_params):{}}get inboxRemovalTime(){return this.inboxParams&&this.inboxParams.rt?this.inboxParams.rt:(this.dateModule.date=new Date,this.dateModule.addDays(1),this.dateModule.getUtcTimestamp().toString())}async getInboxImage(){return this.inboxParams&&this.inboxParams.image?this.inboxParams.image:""}get rootParams(){const{body:t,p:e,header:s,i:a,u:i,l:n,pwcid:r,image:o,buttons:c,pw_inbox:u,inbox_params:h,...d}=this.payload;return d}async getNotificationOptionsPayload(){const t=await this.getTitle(),e=await this.getIcon();return{...this.rootParams,body:this.body,title:t,icon:e,image:this.image,buttons:this.buttons,customData:this.customData,metaData:this.metaData,campaignCode:this.campaignCode,openUrl:this.link,messageHash:this.messageHash}}async getShowNotificationOptions(){const t=await this.getIcon(),e=this.buttons.map((t,e)=>(t.action=`action-${e}`,t));return{renotify:!0,...this.rootParams,body:this.body,icon:t,tag:JSON.stringify({url:this.link,messageHash:this.messageHash,customData:this.customData,metaData:this.metaData}),data:{code:this.code,buttons:e,image:this.image,campaignCode:this.campaignCode,inboxId:this.inboxId},silent:this.silent,actions:e,image:this.image,buttons:e}}async getInboxMessage(){this.dateModule.date=new Date;const t=this.dateModule.getTimestamp().toString();return{title:this.payload.header||"",image:await this.getInboxImage(),status:1,order:this.dateModule.getInboxFakeOrder(),inbox_id:this.inboxId,send_date:t,rt:this.inboxRemovalTime,text:this.body,action_type:1,action_params:JSON.stringify({l:this.link})}}}class J{constructor(t=new K,e=D){this.data=t,this.logger=e}checkDevice(t){return this.createRequest("checkDevice",t)}getConfig(t){return this.createRequest("getConfig",t)}getPopupFormContent(t){return this.createRequest("getPopupFormContent",t)}recordPopupFormEvent(t){return this.createRequest("recordPopupFormEvent",t)}applicationOpen(t){return this.createRequest("applicationOpen",t)}registerDevice(t){return this.createRequest("registerDevice",t)}unregisterDevice(t){return this.createRequest("unregisterDevice",t)}deleteDevice(t){return this.createRequest("deleteDevice",t)}messageDeliveryEvent(t){return this.createRequest("messageDeliveryEvent",t)}pushStat(t){return this.createRequest("pushStat",t)}setTags(t){return this.createRequest("setTags",t)}getTags(t){return this.createRequest("getTags",t)}registerUser(t){return this.createRequest("registerUser",t)}registerEmail(t){return this.createRequest("registerEmail",t)}registerEmailUser(t){return this.createRequest("registerEmailUser",t)}setEmailTags(t){return this.createRequest("setEmailTags",t)}postEvent(t){return this.createRequest("postEvent",t)}getInboxMessages(t){return this.createRequest("getInboxMessages",t)}inboxStatus(t){return this.createRequest("inboxStatus",t)}pageVisit(t,e){return this.createRequest("pageVisit",t,e)}setPurchase(t){return this.createRequest("setPurchase",t)}multiRegisterDevice(t){return this.createRequest("multiRegisterDevice",t)}async createRequest(t,e,s){const a=await this.data.getApiEntrypoint(),i=await this.data.getApiToken(),n=s||a+t,r=i?{headers:{Authorization:`Token ${i}`,"Content-Type":"text/plain;charset=UTF-8",Origin:globalThis.location.origin},credentials:"include"}:{},o=await fetch(n,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify({request:e}),...r}),c=await this.checkResponse(o);return c.base_url&&await this.data.setApiEntrypoint(c.base_url),await this.logger.write("apirequest",`${t} call with arguments: ${JSON.stringify(e)} to Pushwoosh has been successful. Result: ${JSON.stringify(c.response)}`),c.response}async checkResponse(t){if(200!==t.status){let e=`status: ${t.status}. statusText: ${t.statusText}.`;try{const s=await t.json();s&&s.status_message&&(e+=` status_code: ${s.status_code}. status_message: ${s.status_message}.`)}catch(t){}throw new Error(e)}const e=await t.json();if(200!==e.status_code)throw new Error(`Error code: ${e.status_code}. Error text: ${e.status_message}`);return e}}class G{constructor(t,e,s){this.api=t,this.data=e,this.config=s}getPermission(){return Notification.permission}checkIsPermissionGranted(){return"granted"===this.getPermission()}checkIsPermissionDefault(){return"default"===this.getPermission()}async checkIsManualUnsubscribed(){return this.data.getStatusManualUnsubscribed()}async askPermission(){await Notification.requestPermission()}async getTokens(){return this.data.getTokens()}async subscribe(t){const e=t||await this.trySubscribe();if(!this.checkIsPermissionGranted())return void D.error("You must have permission granted before subscribe!");const s=this.getPushToken(e),a=e.getKey("p256dh"),i=e.getKey("auth");if(!a||!i)throw new Error("Can't get subscription keys!");const n=btoa(String.fromCharCode.apply(String,new Uint8Array(a))),r=btoa(String.fromCharCode.apply(String,new Uint8Array(i)));await this.data.setTokens({publicKey:n,pushToken:s,authToken:r,endpoint:e.endpoint}),await this.api.registerDevice()}async unsubscribe(){const t=await this.getServiceWorkerRegistration(),e=await t.pushManager.getSubscription();await this.data.setTokens({}),await this.data.setStatusManualUnsubscribed(!0),await this.api.unregisterDevice(),e&&await e.unsubscribe()}async checkIsRegister(){return this.api.checkDeviceSubscribeForPushNotifications()}async checkIsNeedResubscribe(){const t=await this.data.getLastPermissionStatus(),e=this.getPermission();if(t!==e)return await this.data.setLastPermissionStatus(e),!0;const s=await this.getCredentials(),a=this.getPushToken(s),i=await this.data.getTokens(),n=a===(i&&i.pushToken||""),r=await this.data.getIsVapidChanged();return!n||r}async getServiceWorkerRegistration(){if(!this.registration){await this.registerServiceWorker();const t=await this.data.getServiceWorkerUrl();this.registration=await navigator.serviceWorker.getRegistration(t),await this.registration.update()}if(!this.registration)throw new Error("Internal Error: Can't register service worker!");return this.registration}async registerServiceWorker(){const t=await this.data.getServiceWorkerUrl(),e=await this.data.getServiceWorkerScope();let s="";await this.data.getSdkVersion()!==await this.data.getServiceWorkerVersion()&&(s=`?cache_clean=${i()}`),await navigator.serviceWorker.register(`${t}${s}`,{scope:e})}async trySubscribe(){try{return await this.subscribePushManager()}catch(t){return console.error(t),await this.unsubscribe(),this.subscribePushManager()}}async subscribePushManager(){const t=await this.getServiceWorkerRegistration(),e=await this.getApplicationServerKey();return t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e?this.urlBase64ToUint8Array(e):null})}async getCredentials(){const t=await this.getServiceWorkerRegistration();return await t.pushManager.getSubscription()}getPushToken(t){return t?t.endpoint:""}async getApplicationServerKey(){return await this.data.getApplicationServerKey()}urlBase64ToUint8Array(t){const e=(t+"=".repeat((4-t.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),s=atob(e),a=new Uint8Array(s.length);for(let t=0;t<s.length;++t)a[t]=s.charCodeAt(t);return a}}class Y{constructor(t,e,s){this._canceled=!1,this.showNotificationOptions=t,this.body=e,this.title=s}async show(){if(this._canceled)return;const t=this.showNotificationOptions;t.silent||await self.registration.showNotification(this.title,t)}cancel(){this._canceled=!0}}const Q=new class{constructor(){this.addEventHandler=(t,e)=>{let s=this.handlers[t];s||(s=[]),s.push(e),this.handlers[t]=s},this.removeEventHandler=(t,e)=>{const s=this.handlers[t];s&&(this.handlers[t]=s.filter(t=>t!==e))},this.dispatchEvent=(t,e)=>{const s=e.eventId||i(),a=this.handlers[t];return a?(a.forEach(t=>{n(t)&&setTimeout(()=>{t({...e,eventId:s})},0)}),s):s},this.handlers={}}},X=new K,Z=new class{constructor(t,e=new K,s=new J,a=()=>!1){this.eventBus=t,this.data=e,this.apiClient=s,this.getIsCommunicationDisabled=a}async checkDevice(){const t=await this.getRequestParams();return await this.apiClient.checkDevice(t)}async checkDeviceSubscribeForPushNotifications(a=!0){let i=localStorage.getItem(t);if(void 0===i||!a){const{exist:a,push_token_exist:n}=await this.checkDevice();localStorage.setItem(t,a&&n?e:s),i=localStorage.getItem(t)}return i===e}async getConfig(t){const e=await this.getRequestParams();return this.apiClient.getConfig({...e,features:t})}async applicationOpen(){const t=await this.getRequestParams();return await this.data.setLastOpenApplicationTime(Date.now()),this.apiClient.applicationOpen(t)}async registerDevice(){if(await this.data.getStatusCommunicationDisabled())throw new Error("Can't register device: Communication is disabled!");const s=await this.getRequestParams(),a=await this.data.getTokens();if(!a.pushToken)throw new Error("Can't register device: pushToken is not exist!");const i=await this.apiClient.registerDevice({...s,push_token:a.pushToken,auth_token:a.authToken,public_key:a.publicKey});return await this.data.setStatusManualUnsubscribed(!1),localStorage.setItem(t,e),this.eventBus.dispatchEvent("register",{}),i}async unregisterDevice(){const e=await this.getRequestParams(),a=await this.apiClient.unregisterDevice(e);return localStorage.setItem(t,s),this.eventBus.dispatchEvent("unsubscribe",{}),a}async deleteDevice(){const e=await this.getRequestParams(),a=await this.apiClient.deleteDevice(e);return await this.data.setStatusManualUnsubscribed(!0),localStorage.setItem(t,s),this.eventBus.dispatchEvent("unsubscribe",{}),a}async messageDeliveryEvent(t,e,s={}){const a=await this.getRequestParams();return await this.apiClient.messageDeliveryEvent({...a,hash:t,metaData:s})}async pushStat(t,e,s={}){const a=await this.getRequestParams();return await this.apiClient.pushStat({...a,hash:t,metaData:s})}async setTags(t){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const{hwid:e,device_type:s,...a}=await this.getRequestParams(),i=await this.data.getEmail();return i&&await this.apiClient.setEmailTags({...a,email:i,tags:t}),this.apiClient.setTags({...a,hwid:e,device_type:s,tags:t})}async getTags(){const t=await this.getRequestParams();return this.apiClient.getTags(t)}async setLanguage(t){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):(await this.data.setLanguage(t),await this.data.setStatusLanguageWasChanged(!0),this.setTags({Language:t}))}async registerUser(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const{hwid:s,device_type:a,...i}=await this.getRequestParams(),n=await this.data.getDeviceType(),r=`${t}`,o=await this.apiClient.registerUser({...i,hwid:s,userId:r,ts_offset:60*-(new Date).getTimezoneOffset(),device_type:n});return await this.data.setUserId(r),e&&await this.data.setStatusUserIdWasChanged(!0),o}async registerEmail(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^\S+@\S+\.\S+$/.test(t))return Promise.reject(new Error("Invalid Email format"));const{hwid:s,device_type:a,...i}=await this.getRequestParams(),n=await this.apiClient.registerEmail({...i,email:t,ts_offset:60*-(new Date).getTimezoneOffset()});return await this.data.setEmail(t),e&&await this.data.setStatusEmailWasChanged(!0),n}async registerSmsNumber(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^\+?[0-9]+$/.test(t))return Promise.reject(new Error("Invalid Phone number format: +1234567890"));const{application:s,userId:a}=await this.getRequestParams(),i=await this.apiClient.registerDevice({application:s,userId:a,hwid:t,device_type:18});return await this.data.setSmsNumber(t),e&&await this.data.setStatusSmsNumberWasChanged(!0),i}async registerWhatsappNumber(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^(whatsapp:)?\+?[0-9]+$/.test(t))return Promise.reject(new Error("Invalid WhatsApp number format: +1234567890"));const{application:s,userId:a}=await this.getRequestParams(),i=await this.apiClient.registerDevice({application:s,userId:a,hwid:t,device_type:21});return await this.data.setWhatsAppNumber(t),e&&await this.data.setStatusWhatsAppNumberWasChanged(!0),i}async getPopupFormContent(t){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):this.apiClient.getPopupFormContent({...await this.getRequestParams(),code:t})}async recordPopupFormEvent(t,e){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):this.apiClient.recordPopupFormEvent({...await this.getRequestParams(),code:t,event:e})}async postEvent(t,e){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const s=await this.getRequestParams(),a=new Date,i=a.getTime(),n=Math.floor(i/1e3),r=n-a.getTimezoneOffset()/60*3600,o=await this.data.getLastOpenMessage();if(o&&o.expiry>Date.now()){if(e.msgHash)return Promise.reject(new Error("attribute msgHash already defined"));e={...e,msgHash:o.messageHash}}await this.data.setLastOpenMessage(void 0);const c=await this.apiClient.postEvent({...s,event:t,timestampUTC:n,timestampCurrent:r,attributes:e});return c&&c.code&&this.eventBus.dispatchEvent("receive-in-app-code",{code:c.code}),c}async getInboxMessages(t=0){const e=await this.getRequestParams(),s=await this.data.getInboxLastRequestCode(),a=await this.data.getInboxLastRequestTime();return this.apiClient.getInboxMessages({...e,count:t,last_code:s,last_request_time:a})}async inboxStatus(t,e){const s=await this.getRequestParams();return this.apiClient.inboxStatus({...s,inbox_code:t,status:e,time:(new Date).getTime()})}async pageVisit(t){const e=await this.getRequestParams(),s=await this.data.getFeatures(),a=s&&s.page_visit&&s.page_visit.entrypoint;if(a)return this.apiClient.pageVisit({...e,...t},a)}async setPurchase(t){const e=await this.getRequestParams();return this.apiClient.setPurchase({...e,...t})}async multiRegisterDevice(s){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const a=await this.data.getApplicationCode(),i=await this.data.getDeviceModel(),n=await this.data.getDeviceType(),r=await this.data.getLanguage(),o=await this.data.getSdkVersion(),c=await this.data.getTokens(),u=await this.data.getHwid(),h={application:a,...s};if(s.user_id){h.user_id=String(s.user_id);await this.data.getUserId()!==h.user_id&&(await this.data.setUserId(h.user_id),await this.data.setStatusUserIdWasChanged(!0))}if(s.email){if(!/^\S+@\S+\.\S+$/.test(s.email))return Promise.reject(new Error("Invalid Email format"));await this.data.getEmail()!==s.email&&(await this.data.setEmail(s.email),await this.data.setStatusEmailWasChanged(!0))}if(s.sms_phone_number){if(!/^\+?[0-9]+$/.test(s.sms_phone_number))return Promise.reject(new Error("Invalid Phone number format: +1234567890"));await this.data.getSmsNumber()!==s.sms_phone_number&&(await this.data.setSmsNumber(s.sms_phone_number),await this.data.setStatusSmsNumberWasChanged(!0))}if(s.whatsapp_phone_number){if(!/^(whatsapp:)?\+?[0-9]+$/.test(s.whatsapp_phone_number))return Promise.reject(new Error("Invalid WhatsApp number format: +1234567890"));await this.data.getWhatsAppNumber()!==s.whatsapp_phone_number&&(await this.data.setWhatsAppNumber(s.whatsapp_phone_number),await this.data.setStatusWhatsAppNumberWasChanged(!0))}if(h.language?(await this.data.setLanguage(h.language),await this.data.setStatusLanguageWasChanged(!0)):h.language=r,!h.timezone){const t=60*-(new Date).getTimezoneOffset();h.timezone=String(t)}if(!h.push_devices&&c.pushToken){const t={hwid:u,platform:n,push_token:c.pushToken,sdk_version:o};if(c.publicKey||c.authToken||i){const e={};c.publicKey&&(e.public_key=c.publicKey),c.authToken&&(e.auth_token=c.authToken),i&&(e.browser=i),t.platformData=e}h.push_devices=[t]}const d=await this.apiClient.multiRegisterDevice(h);return h.push_devices?.length&&(await this.data.setStatusManualUnsubscribed(!1),localStorage.setItem(t,e),this.eventBus.dispatchEvent("register",{})),d}async getParams(){return{applicationCode:await this.data.getApplicationCode(),hwid:await this.data.getHwid(),...await this.data.getTokens(),...await this.data.getInitParams()}}async getRequestParams(){const t=await this.data.getApplicationCode(),e=await this.data.getHwid(),s=await this.data.getUserId(),a=await this.data.getDeviceType(),i=await this.data.getDeviceModel(),n=await this.data.getLanguage(),r=await this.data.getSdkVersion();return{application:t,hwid:e,userId:s||e,device_type:a,device_model:i,timezone:60*-(new Date).getTimezoneOffset(),language:n,v:r}}}(Q,X);X.getLogLevel().then(t=>{t&&D.setLevel(t)});const tt=self.Pushwoosh=new class{constructor(t,e,s){this._listeners={},this.eventBus=t,this.data=e,this.api=s}push(t){Array.isArray(t)&&"onPush"===t[0]&&n(t[1])&&(this._listeners[t[0]]||(this._listeners[t[0]]=[]),this._listeners[t[0]].push(t[1]))}getListeners(t){return this._listeners[t]||[]}async initApi(){return Promise.resolve()}}(Q,X,Z),et=[];async function st(t){(await self.clients.matchAll()).forEach(e=>e.postMessage(t))}async function at(t){const{notification:e={}}=t,{data:s}=e,i=a(e.tag,{});let n="";if(t.action&&Array.isArray(s.buttons)){n=(s.buttons.find(e=>e.action===t.action)||{}).url}else n=i.url;return{title:e.title,body:e.body,icon:e.icon,buttons:s.buttons,image:s.image,code:s.code,campaignCode:s.campaignCode,inboxId:s.inboxId,messageHash:i.messageHash,customData:i.customData,metaData:i.metaData,openUrl:i.url,tag:e.tag,url:n}}async function it(t){const e=await tt.data.getApplicationCode(),s=await tt.data.getServiceWorkerVersion();await N({message:"Error in onInstallEventHandler",code:"FATAL-SW-001",error:t,applicationCode:e,workerVersion:s})}async function nt(t){const e=await tt.data.getApplicationCode(),s=await tt.data.getServiceWorkerVersion();await N({message:"Error in onActivateEventHandler",code:"FATAL-SW-002",error:t,applicationCode:e,workerVersion:s})}async function rt(t){const e=await tt.data.getApplicationCode(),s=await tt.data.getServiceWorkerVersion();await N({message:"Error in onNotificationClickEventHandler",code:"FATAL-SW-004",error:t,applicationCode:e,workerVersion:s})}async function ot(t){const e=await tt.data.getApplicationCode(),s=await tt.data.getServiceWorkerVersion();await N({message:"Error in onNotificationCloseEventHandler",code:"FATAL-SW-005",error:t,applicationCode:e,workerVersion:s})}async function ct(t){const e=await tt.data.getApplicationCode(),s=await tt.data.getServiceWorkerVersion();await N({message:"Error in onPushSubscriptionChange",code:"FATAL-SW-006",error:t,applicationCode:e,workerVersion:s})}return self.addEventListener("install",function(t){return t.waitUntil(async function(){await Promise.all([tt.data.setServiceWorkerVersion("3.57.0"),D.write("info","install")]),await self.skipWaiting()}().catch(it))}),self.addEventListener("activate",function(t){t.waitUntil(async function(){await Promise.all([D.write("info","activate")]),await self.clients.claim()}().catch(nt))}),self.addEventListener("push",function(t){t.waitUntil(async function(t){await self.clients.claim();const e=await t.data.json(),s=new z(e),a=await s.getNotificationOptionsPayload(),i=await s.getShowNotificationOptions(),n=s.messageHash;await D.write("info",JSON.stringify(a),"onPush");const r=new Y(i,s.body,await s.getTitle()),o=tt.getListeners("onPush");await o.reduce((t,e)=>t.then(()=>e(r)),Promise.resolve());const c=[r.show(),C.add({payload:e,parsedPayload:a,showOptions:i}),st({type:"onPushDelivery",payload:a})];if(n&&c.push(tt.initApi().then(()=>tt.api.messageDeliveryEvent(n,!0,a.metaData))),""!==s.inboxId){const t=new j(tt.eventBus,tt.data,tt.api),e=new O(tt.data,tt.api,t),a=await s.getInboxMessage(),i=await e.publicMessageBuilder(a);c.push(t.putMessage(a),st({type:"onPutNewMessageToInboxStore",payload:i}))}await Promise.all(c)}(t).catch(e=>async function(t,e){const s=await tt.data.getApplicationCode(),a=await tt.data.getServiceWorkerVersion();await N({message:"Error in onPushEventHandler",code:"FATAL-SW-003",error:t,applicationCode:s,workerVersion:a}),t instanceof Error||(t=new Error(t));return C.add({error:`${t}`,stack:t.stack,payload:e.data&&e.data.text()})}(e,t)))}),self.addEventListener("notificationclick",function(t){t.waitUntil(async function(t){await self.clients.claim();const e=await at(t),{messageHash:s,metaData:a,url:i,code:n,inboxId:r}=e;if(n&&et.push(n),""!==r){const t=new j(tt.eventBus,tt.data,tt.api),e=await t.getMessage(r);e.status=3,await t.putMessage(e)}t.notification.close();const o={type:"onNotificationClick",payload:e};return i&&t.waitUntil(self.clients.matchAll({type:"window"}).then(t=>async function(t,e){const{hostname:s,pathname:a}=new URL(e,self.location.origin),i=t.find(t=>{const{hostname:e,pathname:i}=new URL(t.url);return e===s&&i===a});return i?(await i.focus(),!1):(await self.clients.openWindow(e).then(t=>{t&&t.focus()}),!0)}(t,i)).then(t=>{t&&tt.data.setDelayedEvent(o)})),Promise.all([tt.initApi().then(()=>tt.api.pushStat(s,!0,a)),tt.data.setLastOpenMessage({url:i,messageHash:s,expiry:Date.now()+864e5}),st(o)])}(t).catch(rt))}),self.addEventListener("notificationclose",function(t){t.waitUntil(async function(t){await self.clients.claim();const e=await at(t),{code:s}=e;if(t.notification.close(),!s)return;const a=et.indexOf(s);if(!(a>=0))return st({type:"onNotificationClose",payload:e});et.splice(a,1)}(t).catch(ot))}),self.addEventListener("pushsubscriptionchange",async function(t){t.waitUntil(async function(t){let e=t.newSubscription;if(!e&&(e=await self.registration.pushManager.getSubscription(),!e))return;const s=new G(Z,X,{});await s.subscribe(e)}(t).catch(ct))}),{}})());
|
|
1
|
+
!function(t,e){if("object"==typeof exports&&"object"==typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{var s=e();for(var a in s)("object"==typeof exports?exports:t)[a]=s[a]}}(this,()=>(()=>{"use strict";const t="deviceRegistrationStatus",e="registered",s="unregistered";function a(t,e){if("string"==typeof t)try{return JSON.parse(t)}catch(t){console.log(t)}return void 0===t&&void 0!==e?e:t}function i(){return crypto.randomUUID?.()||"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}const n=t=>"function"==typeof t,r="keyValue",o="messages",c="log",u="inboxMessages";function h(t,e){return function(s){s.objectStoreNames.contains(t)||e(s)}}const d=[h(r,function(t){t.createObjectStore(r,{keyPath:"key"})}),h(c,function(t){const e=t.createObjectStore(c,{keyPath:"id",autoIncrement:!0});e.createIndex("environment","environment",{unique:!1}),e.createIndex("date","date",{unique:!1}),e.createIndex("type","type",{unique:!1})}),h(o,function(t){t.createObjectStore(o,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),h(u,function(t){const e="status",s=t.createObjectStore(u,{keyPath:"inbox_id",autoIncrement:!1});s.createIndex(e,e,{unique:!1,multiEntry:!0}),s.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class l{get all(){return d}}class g{constructor(t,e=new l){this.db=t,this.migrationsBuilder=e}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(t){t.forEach(t=>{t(this.db)})}}function p(t,e){console.info("onversionchange",e),t.close()}let m;function w(){return m||(m=new Promise((t,e)=>{const s=indexedDB.open("PUSHWOOSH_SDK_STORE",7);s.onsuccess=s=>{const a=s.target.result;a.onversionchange=p.bind(null,a,e),t(a)},s.onerror=()=>e(s.error),s.onupgradeneeded=t=>{const s=t.target.result;s.onversionchange=p.bind(null,s,e);new g(s).applyMigrations()}})),m}function y(t){return w().then(e=>new Promise((s,a)=>t(e,s,a)))}class b{_add(t){return y((e,s,a)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).add(t);i.onsuccess=()=>{s(t)},i.onerror=()=>{a(i.error)}}).then(t=>this.getAll().then(e=>{if(Array.isArray(e)){const s=e.map(t=>t.id).sort((t,e)=>t==e?0:t<e?1:-1);if(s.length>this.maxItems)return Promise.all(s.slice(this.maxItems).map(t=>this.delete(t))).then(()=>t)}return t}))}delete(t){return y((e,s,a)=>{const i=e.transaction([this.name],"readwrite").objectStore(this.name).delete(t);i.onsuccess=()=>{s(i.result)},i.onerror=()=>{a(i.error)}})}getAll(){return y((t,e,s)=>{const a=[],i=t.transaction(this.name).objectStore(this.name).openCursor();i.onsuccess=t=>{const s=t.target.result;s?(s.value&&a.push(s.value),s.continue()):e(a)},i.onerror=()=>{s(i.error)}})}}const f=(v=r,{get:(t,e)=>y((s,a,i)=>{const n=s.transaction(v).objectStore(v).get(t);let r,o=!1,c=!1;const u=()=>{clearTimeout(r),o?a(n.result?.value||e):c?i(n.error):r=setTimeout(u,0)};n.onsuccess=()=>o=!0,n.onerror=()=>c=!0,u()}),getAll:()=>y((t,e,s)=>{const a={},i=t.transaction(v).objectStore(v).openCursor();let n,r=!1,o=!1;const c=()=>{clearTimeout(n),r?e(a):o?s(i.error):n=setTimeout(c,0)};i.onsuccess=t=>{const e=t.target.result;e?(a[e.key]=e.value.value,e.continue()):r=!0},i.onerror=()=>o=!0,c()}),async extend(t,e){const s=await this.get(t),{...a}=e;await this.set(t,{...s,...a})},set:(t,e)=>y((s,a,i)=>{const n=s.transaction([v],"readwrite").objectStore(v).put({key:t,value:e});let r,o=!1,c=!1;const u=()=>{clearTimeout(r),o?a(t):c?i(n.error):r=setTimeout(u,0)};n.onsuccess=()=>o=!0,n.onerror=()=>c=!0,u()})});var v;const S=new class extends b{constructor(){super(...arguments),this.name=c,this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(t,e,s){const a={type:t,environment:this.environment,message:`${e}`,date:new Date};return e instanceof Error&&(a.stack=e.stack),s&&(a.additional=s),this._add(a)}},C=new class extends b{constructor(){super(...arguments),this.name=o,this.maxItems=25}add(t){return this._add({...t,date:new Date})}},x={error:1,info:2,debug:3};let P=3;const D={setLevel(t){x[t]||(t="error"),P=x[t]},write(t,e,s){return"error"===t?this.error(e):this.info(e),S.add(t,e,s)}};Object.keys(x).forEach(t=>{const e=x[t];D[t]=(...s)=>{e<=P&&(console.groupCollapsed(t),console.info("",...s),console.trace("trace"),console.groupEnd())}});const I="silent",T="fatal",k="error",M="warn",E="info",R="debug",_={[I]:0,[T]:10,[k]:20,[M]:30,[E]:40,[R]:50};function A(t){const{code:e,text:s,type:a}=t,i=function(t){switch(t){case"fatal":case"error":return console.error;case"warn":case"info":case"debug":return console.log}}(a);console.groupCollapsed(a),i(e?`${e}: ${s}`:s),console.groupEnd()}const W=new class{constructor(t){this.relations=_,this.level=t&&void 0!==t.level?t.level:k,this.applicationType=t&&void 0!==t.applicationType?t.applicationType:"sdk",this.subscribers=t&&void 0!==t.subscribers?t.subscribers:[]}updateLogLevel(t){this.level=t}updateApplicationType(t){this.applicationType=t}updateApplicationCode(t){this.applicationCode=t}updateDomain(t){this.domain=t}updateDeviceInfo(t){this.deviceInfo=t}subscribe(t,e){this.subscribers.push({handler:e,level:t})}async log(t){const e=[],{options:s,...a}=t;let i=a;if(s){const{handler:t,...e}=s;i={...a,...e}}const n=this.getMessage(i);this.subscribers.forEach(s=>{s.level===t.type&&this.relations[s.level]<=this.relations[this.level]&&e.push(s.handler.call(null,n))}),s&&s.handler&&this.level!==I&&s.handler.call(null,n),await Promise.all(e)}async debug(t,e){return this.log({type:R,text:t,options:e})}async info(t,e){return this.log({type:E,text:t,options:e})}async warn(t,e,s){return this.log({type:M,text:t,code:e,options:s})}async error(t,e,s){return this.log({type:k,text:t,code:e,options:s})}async fatal(t,e,s){return this.log({type:T,text:t,code:e,options:s})}async errorAndThrow(t,e,s){return this.logAndThrow({type:k,text:t,code:e,options:s})}async errorAndReject(t,e,s,a){return this.logAndReject(t,{type:k,text:e,code:s,options:a})}async fatalAndThrow(t,e,s){return this.logAndThrow({type:T,text:t,code:e,options:s})}async fatalAndReject(t,e,s,a){return this.logAndReject(t,{type:T,text:e,code:s,options:a})}async logAndThrow(t){await this.log(t);const e=new Error(t.text);throw t.code&&(e.code=t.code),e}async logAndReject(t,e){await this.log(e);const s=new Error(e.text);e.code&&(s.code=e.code),t(s)}getMessage(t){return{applicationCode:this.applicationCode,domain:this.domain,applicationType:this.applicationType,deviceInfo:this.deviceInfo,...t}}}({level:"error",subscribers:[{level:"fatal",handler:A},{level:"error",handler:A}]});async function N(t){const e=q(t);return W.fatal(e.text,e.code,e.options)}function q(t){const{message:e,code:s,error:a,...i}=t,n=function(t){let e=new Error("unknown error");"string"!=typeof t&&"number"!=typeof t&&"boolean"!=typeof t||(e.message=t.toString());t instanceof Error&&(e=t);return e}(a);return{text:e,code:s,options:{...i,errorText:n.message,errorStack:n.stack}}}class L{constructor(t=new Date){this._date=t}set date(t){this._date=t}get date(){return this._date}getUtcTimestamp(){return Math.floor((this.date.getTime()+60*this.date.getTimezoneOffset()*1e3)/1e3)}getTimestamp(){return Math.round(this.date.getTime()/1e3)}setLocal(){const t=this._date.getTime()-60*this.date.getTimezoneOffset()*1e3;this._date=new Date(t)}addDays(t){const e=this._date.getTime()+24*t*60*60*1e3;this._date=new Date(e)}getInboxFakeOrder(){return(100*this._date.getTime()+9e9).toString()}}class O{constructor(t,e,s,a=new L){this.data=t,this.api=e,this.inboxModel=s,this.dateModule=a,this.publicMessageBuilder=this.publicMessageBuilder.bind(this)}messageTypeFactory(t,e){let s=0;return 2===t?s=1:"l"in e&&null!=e.l&&(s=e.l.startsWith("http")?2:3),s}async updateMessagesStatusWithCodes(t,e,s){const a=[],i=[];e.forEach(async e=>{-1!==t.indexOf(e.inbox_id)&&(e.status=s,a.push(e),i.push(this.api.inboxStatus(e.order,e.status)))}),await this.inboxModel.putBulkMessages(a),await Promise.all(i)}async publicMessageBuilder({action_type:t,action_params:e,image:s,title:a,send_date:i,inbox_id:n,text:r,status:o}){const c=s||await this.data.getDefaultNotificationImage(),u=a||await this.data.getDefaultNotificationTitle(),h=JSON.parse(e);return this.dateModule.date=new Date(1e3*parseInt(i)),this.dateModule.setLocal(),{title:u,imageUrl:c,code:n,message:r,sendDate:this.dateModule.date.toISOString(),type:this.messageTypeFactory(t,h),link:h?.l||"/",isRead:2===o||3===o,isActionPerformed:3===o}}messagesWithNoActionPerformedCount(){return this.inboxModel.getDeliveredReadMessagesCount()}unreadMessagesCount(){return this.inboxModel.getDeliveredMessagesCount()}messagesCount(){return this.inboxModel.messagesCount()}async loadMessages(){const t=[...await this.inboxModel.getReadOpenMessages(),...await this.inboxModel.getDeliveredMessages()].sort((t,e)=>parseInt(e.send_date,10)-parseInt(t.send_date,10)).sort((t,e)=>parseInt(e.order||"0",10)-parseInt(t.order||"0",10)).map(this.publicMessageBuilder);return Promise.all(t)}async readMessagesWithCodes(t){const e=await this.inboxModel.getDeliveredMessages();await this.updateMessagesStatusWithCodes(t,e,2)}async performActionForMessageWithCode(t){const e=await this.inboxModel.getMessage(t),s=JSON.parse(e.action_params),a=this.messageTypeFactory(e.action_type,s);2===a&&null!=s.l?document.location.href=s.l:3===a&&null!=s.l&&window.history.go(s.l),e.status=3,await this.inboxModel.putMessage(e),await this.api.inboxStatus(e.order,e.status)}async deleteMessagesWithCodes(t){const e=await this.inboxModel.getReadOpenMessages(),s=await this.inboxModel.getDeliveredMessages();await this.updateMessagesStatusWithCodes(t,[...e,...s],4)}async syncMessages(){await this.inboxModel.updateMessages()}}class U{constructor(t,e){this.name=e,this.store=t.transaction(this.name,"readwrite").objectStore(this.name)}set index(t){this.store.indexNames.contains(t)?this._index=this.store.index(t):console.warn(`Index "${t}" in `)}writeRequestPromise(t,e){return new Promise((s,a)=>{t.onsuccess=()=>{s(e)},t.onerror=()=>{a(t.error)}})}readRequestPromise(t,e){return new Promise((s,a)=>{t.onsuccess=t=>{const a=t.target;s(a.result||e)},t.onerror=()=>{a(t.error)}})}put(t,e){const s=this.store.put(t,e);return this.writeRequestPromise(s,e)}add(t,e){return this.put(t,e)}delete(t){const e=this.store.delete(t);return this.writeRequestPromise(e)}get(t,e){const s=this.store.get(t);return this.readRequestPromise(s,e)}getAll(){const t=this.store.openCursor(),e=[];return new Promise((s,a)=>{t.onsuccess=t=>{const a=t.target.result;a?(e.push(a.value),a.continue()):s(e)},t.onerror=()=>{a(t.error)}})}count(t){const e=this.store.count(t);return this.readRequestPromise(e,0)}countByIndex(t){const e=this._index.count(t);return this.readRequestPromise(e,0)}}class V{getDB(){return w()}async put(t,e,s){const a=await this.getDB();return new U(a,t).put(e,s)}async delete(t,e){const s=await this.getDB();return new U(s,t).delete(e)}async get(t,e,s){const a=await this.getDB();return new U(a,t).get(e,s)}async getAll(t){const e=await this.getDB(),s=new U(e,t);return await s.getAll()||[]}async count(t,e){const s=await this.getDB();return new U(s,t).count(e)}async countByIndex(t,e,s){const a=await this.getDB(),i=new U(a,t);return i.index=e,i.countByIndex(s)}}class j{constructor(t,e,s,a=new V,i=new L){this.eventBus=t,this.data=e,this.api=s,this.storage=a,this.storeName="inboxMessages",this.dateModule=i}async getInboxMessages(){const t=await this.api.getInboxMessages();return await this.storeGetInboxMessagesRequestParams(t.next,t.new_inbox),t}async storeGetInboxMessagesRequestParams(t,e){this.dateModule.date=new Date,await this.data.setInboxLastRequestTime(this.dateModule.getUtcTimestamp()),await this.data.setInboxLastRequestCode(t),await this.data.setInboxNewMessagesCount(e)}async putServerMessages(t){const e=t.map(async t=>{const e=await this.storage.get(this.storeName,t.inbox_id,{});return"status"in e&&(t.status=e.status),this.putMessage(t)});return Promise.all(e)}putMessage(t){return this.storage.put(this.storeName,t)}putBulkMessages(t){const e=t.map(t=>this.putMessage(t));return Promise.all(e)}deleteMessages(t){const e=t.map(t=>this.storage.delete(this.storeName,t));return Promise.all(e)}async deleteExpiredMessages(){this.dateModule.date=new Date;const t=this.dateModule.getTimestamp().toString(),e=(await this.storage.getAll(this.storeName)).filter(e=>e.rt<t).map(t=>t.inbox_id);return this.deleteMessages(e)}getMessage(t){return this.storage.get(this.storeName,t)}async getReadOpenMessages(){return(await this.storage.getAll(this.storeName)).filter(t=>2===t.status||3===t.status)}async getDeliveredMessages(){return(await this.storage.getAll(this.storeName)).filter(t=>1===t.status)}async messagesCount(){return this.storage.count(this.storeName)}async getDeliveredMessagesCount(){return this.storage.countByIndex(this.storeName,"status",1)}async getReadMessagesCount(){return this.storage.countByIndex(this.storeName,"status",2)}async getDeliveredReadMessagesCount(){const[t,e]=[2,3],s=IDBKeyRange.bound(t,e);return this.storage.countByIndex(this.storeName,"status",s)}async updateMessages(){const t=await this.getInboxMessages();await this.deleteExpiredMessages(),t.deleted&&await this.deleteMessages(t.deleted),await this.putServerMessages(t.messages),this.eventBus.dispatchEvent("update-inbox-messages",{messages:new O(this.data,this.api,this)})}}const B={"&":"&","<":"<",">":">",""":'"',"'":"'"},F=/&(?:amp|lt|gt|quot|#39);/g,$=RegExp(F.source);const H=t=>`params.${t}`;class K{constructor(t=f){this.store=t}async clearAll(){const t=["applicationCode","apiToken","hwid","deviceType","deviceModel","language","languageWasChanged","apiEntrypoint","tokens","applicationServerKey","isVapidChanged","webSitePushId","defaultNotificationImage","defaultNotificationTitle","userId","userIdWasChanged","email","emailWasChanged","isLastPermissionStatus","isManualUnsubscribed","isCommunicationDisabled","communicationEnabled","isDropAllData","sdkVersion","serviceWorkerVersion","serviceWorkerUrl","serviceWorkerScope","lastOpenMessage","lastOpenApplicationTime","features","init","inbox.lastRequestCode","inbox.lastRequestTime","inbox.newMessagesCount","delayedEvent","promptDisplayCount","promptLastSeenTime","logLevel","shownWebPopups","isRecurringVisitor"];for(const e of t)await this.store.set(H(e),void 0)}async setApplicationCode(t){await this.store.set(H("applicationCode"),t)}async getApplicationCode(){return this.store.get(H("applicationCode"))}async setApiToken(t){return await this.store.set(H("apiToken"),t)}async getApiToken(){return this.store.get(H("apiToken"))}async setHwid(t){await this.store.set(H("hwid"),t)}async getHwid(){return this.store.get(H("hwid"))}async setDeviceType(t){await this.store.set(H("deviceType"),t)}async getDeviceType(){return this.store.get(H("deviceType"))}async setFormFactor(t){await this.store.set(H("formFactor"),t)}async getFormFactor(){return this.store.get(H("formFactor"))}async setDeviceModel(t){await this.store.set(H("deviceModel"),t)}async getDeviceModel(){return this.store.get(H("deviceModel"))}async setLanguage(t){await this.store.set(H("language"),t)}async getLanguage(){return this.store.get(H("language"),"en")}async setStatusLanguageWasChanged(t){await this.store.set(H("languageWasChanged"),t)}async getStatusLanguageWasChanged(){return this.store.get(H("languageWasChanged"),!1)}async setApiEntrypoint(t){await this.store.set(H("apiEntrypoint"),t)}async getApiEntrypoint(){return this.store.get(H("apiEntrypoint"),"https://api.pushwoosh.com/json/1.3/")}async setTokens(t){await this.store.set(H("tokens"),t)}getTokens(){return this.store.get(H("tokens"))}async setApplicationServerKey(t){await this.store.set(H("applicationServerKey"),t)}async getApplicationServerKey(){return this.store.get(H("applicationServerKey"))}async setIsVapidChanged(t){await this.store.set(H("isVapidChanged"),t)}async getIsVapidChanged(){return this.store.get(H("isVapidChanged"),!1)}async setWebSitePushId(t){await this.store.set(H("webSitePushId"),t)}async getWebSitePushId(){return this.store.get(H("webSitePushId"))}async setDefaultNotificationImage(t){await this.store.set(H("defaultNotificationImage"),t)}async getDefaultNotificationImage(){return this.store.get(H("defaultNotificationImage"),"https://cp.pushwoosh.com/img/logo-medium.png")}async setDefaultNotificationTitle(t){await this.store.set(H("defaultNotificationTitle"),t)}async getDefaultNotificationTitle(){return this.store.get(H("defaultNotificationTitle"),"Pushwoosh notification")}async setUserId(t){await this.store.set(H("userId"),t?`${t}`:void 0)}async getUserId(){return this.store.get(H("userId"))}async setStatusUserIdWasChanged(t){await this.store.set(H("userIdWasChanged"),t)}async getStatusUserIdWasChanged(){return this.store.get(H("userIdWasChanged"),!1)}async setEmail(t){await this.store.set(H("email"),t?`${t}`:void 0)}async getEmail(){return this.store.get(H("email"))}async setStatusEmailWasChanged(t){await this.store.set(H("emailWasChanged"),t)}async getStatusEmailWasChanged(){return this.store.get(H("emailWasChanged"),!1)}async setSmsNumber(t){await this.store.set(H("smsNumber"),t?`${t}`:void 0)}async getSmsNumber(){return this.store.get(H("smsNumber"))}async setStatusSmsNumberWasChanged(t){await this.store.set(H("smsNumberWasChanged"),t)}async getStatusSmsNumberWasChanged(){return this.store.get(H("smsNumberWasChanged"),!1)}async setWhatsAppNumber(t){await this.store.set(H("whatsAppNumber"),t?`${t}`:void 0)}async getWhatsAppNumber(){return this.store.get(H("whatsAppNumber"))}async setStatusWhatsAppNumberWasChanged(t){await this.store.set(H("whatsAppNumberWasChanged"),t)}async getStatusWhatsAppNumberWasChanged(){return this.store.get(H("whatsAppNumberWasChanged"),!1)}async setLastPermissionStatus(t){await this.store.set(H("isLastPermissionStatus"),t)}async getLastPermissionStatus(){return this.store.get(H("isLastPermissionStatus"))}async setStatusManualUnsubscribed(t){await this.store.set(H("isManualUnsubscribed"),t)}getStatusManualUnsubscribed(){return this.store.get(H("isManualUnsubscribed"),!1)}async setStatusCommunicationDisabled(t){await this.store.set(H("isCommunicationDisabled"),t)}getStatusCommunicationDisabled(){return this.store.get(H("isCommunicationDisabled"),!1)}async setCommunicationEnabled(t){await this.store.set(H("communicationEnabled"),t)}getCommunicationEnabled(){return this.store.get(H("communicationEnabled"))}async setStatusDropAllData(t){await this.store.set(H("isDropAllData"),t)}getStatusDropAllData(){return this.store.get(H("isDropAllData"),!1)}async setSdkVersion(t){await this.store.set(H("sdkVersion"),t)}async getSdkVersion(){return this.store.get(H("sdkVersion"))}async setServiceWorkerVersion(t){await this.store.set(H("serviceWorkerVersion"),t)}getServiceWorkerVersion(){return this.store.get(H("serviceWorkerVersion"))}async setServiceWorkerUrl(t){t&&await this.store.set(H("serviceWorkerUrl"),t)}async getServiceWorkerUrl(){return this.store.get(H("serviceWorkerUrl"),"/pushwoosh-service-worker.js")}async setServiceWorkerScope(t){t&&await this.store.set(H("serviceWorkerScope"),t)}async getServiceWorkerScope(){return this.store.get(H("serviceWorkerScope"))}async setLastOpenMessage(t){await this.store.set(H("lastOpenMessage"),t)}getLastOpenMessage(){return this.store.get(H("lastOpenMessage"))}async setLastOpenApplicationTime(t){await this.store.set(H("lastOpenApplicationTime"),t)}async getLastOpenApplicationTime(){return this.store.get(H("lastOpenApplicationTime"))}async setFeatures(t){await this.store.set(H("features"),t)}async getFeatures(){return this.store.get(H("features"))}async setInitParams(t){await this.store.set(H("init"),t)}async getInitParams(){return this.store.get(H("init"))}async setInboxLastRequestCode(t){await this.store.set(H("inbox.lastRequestCode"),t)}async getInboxLastRequestCode(){return this.store.get(H("inbox.lastRequestCode"),"")}async setInboxLastRequestTime(t){await this.store.set(H("inbox.lastRequestTime"),t)}async getInboxLastRequestTime(){return this.store.get(H("inbox.lastRequestTime"),0)}async setInboxNewMessagesCount(t){await this.store.set(H("inbox.newMessagesCount"),t)}async getInboxNewMessagesCount(){return this.store.get(H("inbox.newMessagesCount"),0)}async setDelayedEvent(t){await this.store.set(H("delayedEvent"),t)}getDelayedEvent(){return this.store.get(H("delayedEvent"))}async setPromptDisplayCount(t){await this.store.set(H("promptDisplayCount"),t)}async getPromptDisplayCount(){return this.store.get(H("promptDisplayCount"),0)}async setPromptLastSeenTime(t){await this.store.set(H("promptLastSeenTime"),t)}async getPromptLastSeenTime(){return this.store.get(H("promptLastSeenTime"),0)}async setLogLevel(t){await this.store.set(H("logLevel"),t)}async getLogLevel(){return this.store.get(H("logLevel"),"error")}async getShownWebPopups(){return this.store.get(H("shownWebPopups"),[])}async addShownWebPopup(t){const e=await this.getShownWebPopups();e.includes(t)||(e.push(t),await this.store.set(H("shownWebPopups"),e))}async setIsRecurringVisitor(t){await this.store.set(H("isRecurringVisitor"),t)}async getIsRecurringVisitor(){return this.store.get(H("isRecurringVisitor"),!1)}}class z{constructor(t,e=new K,s=new L){if("data"in t){const e=t;this.payload=e.data}else this.payload=t;this.data=e,this.code=`notificationCode-${Date.now()}-${Math.random().toString(16).slice(2,10)}`,this.dateModule=s}async getIcon(){return this.payload.i||await this.data.getDefaultNotificationImage()}async getTitle(){return this.payload.header||await this.data.getDefaultNotificationTitle()}get silent(){return Boolean(this.payload.silent)}get body(){return this.payload.body}get messageHash(){return this.payload.p||""}get metaData(){return this.payload.md?a(this.payload.md):{}}get image(){return this.payload.image||""}get buttons(){return this.payload.buttons?a(this.payload.buttons):[]}get customData(){return this.payload.u?a(this.payload.u):{}}get campaignCode(){return this.payload.pwcid||""}get link(){return this.payload.l?(t=this.payload.l)&&$.test(t)?t.replace(F,t=>B[t]):t:"/";var t}get inboxId(){return this.payload.pw_inbox||""}get inboxParams(){return this.payload.inbox_params?a(this.payload.inbox_params):{}}get inboxRemovalTime(){return this.inboxParams&&this.inboxParams.rt?this.inboxParams.rt:(this.dateModule.date=new Date,this.dateModule.addDays(1),this.dateModule.getUtcTimestamp().toString())}async getInboxImage(){return this.inboxParams&&this.inboxParams.image?this.inboxParams.image:""}get rootParams(){const{body:t,p:e,header:s,i:a,u:i,l:n,pwcid:r,image:o,buttons:c,pw_inbox:u,inbox_params:h,...d}=this.payload;return d}async getNotificationOptionsPayload(){const t=await this.getTitle(),e=await this.getIcon();return{...this.rootParams,body:this.body,title:t,icon:e,image:this.image,buttons:this.buttons,customData:this.customData,metaData:this.metaData,campaignCode:this.campaignCode,openUrl:this.link,messageHash:this.messageHash}}async getShowNotificationOptions(){const t=await this.getIcon(),e=this.buttons.map((t,e)=>(t.action=`action-${e}`,t));return{renotify:!0,...this.rootParams,body:this.body,icon:t,tag:JSON.stringify({url:this.link,messageHash:this.messageHash,customData:this.customData,metaData:this.metaData}),data:{code:this.code,buttons:e,image:this.image,campaignCode:this.campaignCode,inboxId:this.inboxId},silent:this.silent,actions:e,image:this.image,buttons:e}}async getInboxMessage(){this.dateModule.date=new Date;const t=this.dateModule.getTimestamp().toString();return{title:this.payload.header||"",image:await this.getInboxImage(),status:1,order:this.dateModule.getInboxFakeOrder(),inbox_id:this.inboxId,send_date:t,rt:this.inboxRemovalTime,text:this.body,action_type:1,action_params:JSON.stringify({l:this.link})}}}class J{constructor(t=new K,e=D){this.data=t,this.logger=e}checkDevice(t){return this.createRequest("checkDevice",t)}getConfig(t){return this.createRequest("getConfig",t)}getPopupFormContent(t){return this.createRequest("getPopupFormContent",t)}recordPopupFormEvent(t){return this.createRequest("recordPopupFormEvent",t)}applicationOpen(t){return this.createRequest("applicationOpen",t)}registerDevice(t){return this.createRequest("registerDevice",t)}unregisterDevice(t){return this.createRequest("unregisterDevice",t)}deleteDevice(t){return this.createRequest("deleteDevice",t)}messageDeliveryEvent(t){return this.createRequest("messageDeliveryEvent",t)}pushStat(t){return this.createRequest("pushStat",t)}setTags(t){return this.createRequest("setTags",t)}getTags(t){return this.createRequest("getTags",t)}registerUser(t){return this.createRequest("registerUser",t)}registerEmail(t){return this.createRequest("registerEmail",t)}registerEmailUser(t){return this.createRequest("registerEmailUser",t)}setEmailTags(t){return this.createRequest("setEmailTags",t)}postEvent(t){return this.createRequest("postEvent",t)}getInboxMessages(t){return this.createRequest("getInboxMessages",t)}inboxStatus(t){return this.createRequest("inboxStatus",t)}pageVisit(t,e){return this.createRequest("pageVisit",t,e)}setPurchase(t){return this.createRequest("setPurchase",t)}multiRegisterDevice(t){return this.createRequest("multiRegisterDevice",t)}async createRequest(t,e,s){const a=await this.data.getApiEntrypoint(),i=await this.data.getApiToken(),n=s||a+t,r=i?{headers:{Authorization:`Token ${i}`,"Content-Type":"text/plain;charset=UTF-8",Origin:globalThis.location.origin},credentials:"include"}:{},o=await fetch(n,{method:"POST",headers:{"Content-Type":"text/plain;charset=UTF-8"},body:JSON.stringify({request:e}),...r}),c=await this.checkResponse(o);return c.base_url&&await this.data.setApiEntrypoint(c.base_url),await this.logger.write("apirequest",`${t} call with arguments: ${JSON.stringify(e)} to Pushwoosh has been successful. Result: ${JSON.stringify(c.response)}`),c.response}async checkResponse(t){if(200!==t.status){let e=`status: ${t.status}. statusText: ${t.statusText}.`;try{const s=await t.json();s&&s.status_message&&(e+=` status_code: ${s.status_code}. status_message: ${s.status_message}.`)}catch(t){}throw new Error(e)}const e=await t.json();if(200!==e.status_code)throw new Error(`Error code: ${e.status_code}. Error text: ${e.status_message}`);return e}}class G{constructor(t,e,s){this.api=t,this.data=e,this.config=s}getPermission(){return Notification.permission}checkIsPermissionGranted(){return"granted"===this.getPermission()}checkIsPermissionDefault(){return"default"===this.getPermission()}async checkIsManualUnsubscribed(){return this.data.getStatusManualUnsubscribed()}async askPermission(){await Notification.requestPermission()}async getTokens(){return this.data.getTokens()}async subscribe(t){const e=t||await this.trySubscribe();if(!this.checkIsPermissionGranted())return void D.error("You must have permission granted before subscribe!");const s=this.getPushToken(e),a=e.getKey("p256dh"),i=e.getKey("auth");if(!a||!i)throw new Error("Can't get subscription keys!");const n=btoa(String.fromCharCode.apply(String,new Uint8Array(a))),r=btoa(String.fromCharCode.apply(String,new Uint8Array(i)));await this.data.setTokens({publicKey:n,pushToken:s,authToken:r,endpoint:e.endpoint}),await this.api.registerDevice()}async unsubscribe(){const t=await this.getServiceWorkerRegistration(),e=await t.pushManager.getSubscription();await this.data.setTokens({}),await this.data.setStatusManualUnsubscribed(!0),await this.api.unregisterDevice(),e&&await e.unsubscribe()}async checkIsRegister(){return this.api.checkDeviceSubscribeForPushNotifications()}async checkIsNeedResubscribe(){const t=await this.data.getLastPermissionStatus(),e=this.getPermission();if(t!==e)return await this.data.setLastPermissionStatus(e),!0;const s=await this.getCredentials(),a=this.getPushToken(s),i=await this.data.getTokens(),n=a===(i&&i.pushToken||""),r=await this.data.getIsVapidChanged();return!n||r}async getServiceWorkerRegistration(){if(!this.registration){await this.registerServiceWorker();const t=await this.data.getServiceWorkerUrl();this.registration=await navigator.serviceWorker.getRegistration(t),await this.registration.update()}if(!this.registration)throw new Error("Internal Error: Can't register service worker!");return this.registration}async registerServiceWorker(){const t=await this.data.getServiceWorkerUrl(),e=await this.data.getServiceWorkerScope();let s="";await this.data.getSdkVersion()!==await this.data.getServiceWorkerVersion()&&(s=`?cache_clean=${i()}`),await navigator.serviceWorker.register(`${t}${s}`,{scope:e})}async trySubscribe(){try{return await this.subscribePushManager()}catch(t){return console.error(t),await this.unsubscribe(),this.subscribePushManager()}}async subscribePushManager(){const t=await this.getServiceWorkerRegistration(),e=await this.getApplicationServerKey();return t.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:e?this.urlBase64ToUint8Array(e):null})}async getCredentials(){const t=await this.getServiceWorkerRegistration();return await t.pushManager.getSubscription()}getPushToken(t){return t?t.endpoint:""}async getApplicationServerKey(){return await this.data.getApplicationServerKey()}urlBase64ToUint8Array(t){const e=(t+"=".repeat((4-t.length%4)%4)).replace(/-/g,"+").replace(/_/g,"/"),s=atob(e),a=new Uint8Array(s.length);for(let t=0;t<s.length;++t)a[t]=s.charCodeAt(t);return a}}class Y{constructor(t,e,s){this._canceled=!1,this.showNotificationOptions=t,this.body=e,this.title=s}async show(){if(this._canceled)return;const t=this.showNotificationOptions;t.silent||await self.registration.showNotification(this.title,t)}cancel(){this._canceled=!0}}const Q=new class{constructor(){this.addEventHandler=(t,e)=>{let s=this.handlers[t];s||(s=[]),s.push(e),this.handlers[t]=s},this.removeEventHandler=(t,e)=>{const s=this.handlers[t];s&&(this.handlers[t]=s.filter(t=>t!==e))},this.dispatchEvent=(t,e)=>{const s=e.eventId||i(),a=this.handlers[t];return a?(a.forEach(t=>{n(t)&&setTimeout(()=>{t({...e,eventId:s})},0)}),s):s},this.handlers={}}},X=new K,Z=new class{constructor(t,e=new K,s=new J,a=()=>!1){this.eventBus=t,this.data=e,this.apiClient=s,this.getIsCommunicationDisabled=a}async checkDevice(){const t=await this.getRequestParams();return await this.apiClient.checkDevice(t)}async checkDeviceSubscribeForPushNotifications(a=!0){let i=localStorage.getItem(t);if(void 0===i||!a){const{exist:a,push_token_exist:n}=await this.checkDevice();localStorage.setItem(t,a&&n?e:s),i=localStorage.getItem(t)}return i===e}async getConfig(t){const e=await this.getRequestParams();return this.apiClient.getConfig({...e,features:t})}async applicationOpen(){const t=await this.getRequestParams();return await this.data.setLastOpenApplicationTime(Date.now()),this.apiClient.applicationOpen(t)}async registerDevice(){if(await this.data.getStatusCommunicationDisabled())throw new Error("Can't register device: Communication is disabled!");const s=await this.getRequestParams(),a=await this.data.getTokens();if(!a.pushToken)throw new Error("Can't register device: pushToken is not exist!");const i=await this.apiClient.registerDevice({...s,push_token:a.pushToken,auth_token:a.authToken,public_key:a.publicKey});return await this.data.setStatusManualUnsubscribed(!1),localStorage.setItem(t,e),this.eventBus.dispatchEvent("register",{}),i}async unregisterDevice(){const e=await this.getRequestParams(),a=await this.apiClient.unregisterDevice(e);return localStorage.setItem(t,s),this.eventBus.dispatchEvent("unsubscribe",{}),a}async deleteDevice(){const e=await this.getRequestParams(),a=await this.apiClient.deleteDevice(e);return await this.data.setStatusManualUnsubscribed(!0),localStorage.setItem(t,s),this.eventBus.dispatchEvent("unsubscribe",{}),a}async messageDeliveryEvent(t,e,s={}){const a=await this.getRequestParams();return await this.apiClient.messageDeliveryEvent({...a,hash:t,metaData:s})}async pushStat(t,e,s={}){const a=await this.getRequestParams();return await this.apiClient.pushStat({...a,hash:t,metaData:s})}async setTags(t){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const{hwid:e,device_type:s,...a}=await this.getRequestParams(),i=await this.data.getEmail();return i&&await this.apiClient.setEmailTags({...a,email:i,tags:t}),this.apiClient.setTags({...a,hwid:e,device_type:s,tags:t})}async getTags(){const t=await this.getRequestParams();return this.apiClient.getTags(t)}async setLanguage(t){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):(await this.data.setLanguage(t),await this.data.setStatusLanguageWasChanged(!0),this.setTags({Language:t}))}async registerUser(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const{hwid:s,device_type:a,...i}=await this.getRequestParams(),n=await this.data.getDeviceType(),r=`${t}`,o=await this.apiClient.registerUser({...i,hwid:s,userId:r,ts_offset:60*-(new Date).getTimezoneOffset(),device_type:n});return await this.data.setUserId(r),e&&await this.data.setStatusUserIdWasChanged(!0),o}async registerEmail(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^\S+@\S+\.\S+$/.test(t))return Promise.reject(new Error("Invalid Email format"));const{hwid:s,device_type:a,...i}=await this.getRequestParams(),n=await this.apiClient.registerEmail({...i,email:t,ts_offset:60*-(new Date).getTimezoneOffset()});return await this.data.setEmail(t),e&&await this.data.setStatusEmailWasChanged(!0),n}async registerSmsNumber(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^\+?[0-9]+$/.test(t))return Promise.reject(new Error("Invalid Phone number format: +1234567890"));const{application:s,userId:a}=await this.getRequestParams(),i=await this.apiClient.registerDevice({application:s,userId:a,hwid:t,device_type:18});return await this.data.setSmsNumber(t),e&&await this.data.setStatusSmsNumberWasChanged(!0),i}async registerWhatsappNumber(t,e=!0){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));if(!/^(whatsapp:)?\+?[0-9]+$/.test(t))return Promise.reject(new Error("Invalid WhatsApp number format: +1234567890"));const{application:s,userId:a}=await this.getRequestParams(),i=await this.apiClient.registerDevice({application:s,userId:a,hwid:t,device_type:21});return await this.data.setWhatsAppNumber(t),e&&await this.data.setStatusWhatsAppNumberWasChanged(!0),i}async getPopupFormContent(t){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):this.apiClient.getPopupFormContent({...await this.getRequestParams(),code:t})}async recordPopupFormEvent(t,e){return this.getIsCommunicationDisabled()?Promise.reject(new Error("Communication is disabled")):this.apiClient.recordPopupFormEvent({...await this.getRequestParams(),code:t,event:e})}async postEvent(t,e){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const s=await this.getRequestParams(),a=new Date,i=a.getTime(),n=Math.floor(i/1e3),r=n-a.getTimezoneOffset()/60*3600,o=await this.data.getLastOpenMessage();if(o&&o.expiry>Date.now()){if(e.msgHash)return Promise.reject(new Error("attribute msgHash already defined"));e={...e,msgHash:o.messageHash}}await this.data.setLastOpenMessage(void 0);const c=await this.apiClient.postEvent({...s,event:t,timestampUTC:n,timestampCurrent:r,attributes:e});return c&&c.code&&this.eventBus.dispatchEvent("receive-in-app-code",{code:c.code}),c}async getInboxMessages(t=0){const e=await this.getRequestParams(),s=await this.data.getInboxLastRequestCode(),a=await this.data.getInboxLastRequestTime();return this.apiClient.getInboxMessages({...e,count:t,last_code:s,last_request_time:a})}async inboxStatus(t,e){const s=await this.getRequestParams();return this.apiClient.inboxStatus({...s,inbox_code:t,status:e,time:(new Date).getTime()})}async pageVisit(t){const e=await this.getRequestParams(),s=await this.data.getFeatures(),a=s&&s.page_visit&&s.page_visit.entrypoint;if(a)return this.apiClient.pageVisit({...e,...t},a)}async setPurchase(t){const e=await this.getRequestParams();return this.apiClient.setPurchase({...e,...t})}async multiRegisterDevice(s){if(this.getIsCommunicationDisabled())return Promise.reject(new Error("Communication is disabled"));const a=await this.data.getApplicationCode(),i=await this.data.getDeviceModel(),n=await this.data.getDeviceType(),r=await this.data.getLanguage(),o=await this.data.getSdkVersion(),c=await this.data.getTokens(),u=await this.data.getHwid(),h={application:a,...s};if(s.user_id){h.user_id=String(s.user_id);await this.data.getUserId()!==h.user_id&&(await this.data.setUserId(h.user_id),await this.data.setStatusUserIdWasChanged(!0))}if(s.email){if(!/^\S+@\S+\.\S+$/.test(s.email))return Promise.reject(new Error("Invalid Email format"));await this.data.getEmail()!==s.email&&(await this.data.setEmail(s.email),await this.data.setStatusEmailWasChanged(!0))}if(s.sms_phone_number){if(!/^\+?[0-9]+$/.test(s.sms_phone_number))return Promise.reject(new Error("Invalid Phone number format: +1234567890"));await this.data.getSmsNumber()!==s.sms_phone_number&&(await this.data.setSmsNumber(s.sms_phone_number),await this.data.setStatusSmsNumberWasChanged(!0))}if(s.whatsapp_phone_number){if(!/^(whatsapp:)?\+?[0-9]+$/.test(s.whatsapp_phone_number))return Promise.reject(new Error("Invalid WhatsApp number format: +1234567890"));await this.data.getWhatsAppNumber()!==s.whatsapp_phone_number&&(await this.data.setWhatsAppNumber(s.whatsapp_phone_number),await this.data.setStatusWhatsAppNumberWasChanged(!0))}if(h.language?(await this.data.setLanguage(h.language),await this.data.setStatusLanguageWasChanged(!0)):h.language=r,!h.timezone){const t=60*-(new Date).getTimezoneOffset();h.timezone=String(t)}if(!h.push_devices&&c.pushToken){const t={hwid:u,platform:n,push_token:c.pushToken,sdk_version:o};if(c.publicKey||c.authToken||i){const e={};c.publicKey&&(e.public_key=c.publicKey),c.authToken&&(e.auth_token=c.authToken),i&&(e.browser=i),t.platformData=e}h.push_devices=[t]}const d=await this.apiClient.multiRegisterDevice(h);return h.push_devices?.length&&(await this.data.setStatusManualUnsubscribed(!1),localStorage.setItem(t,e),this.eventBus.dispatchEvent("register",{})),d}async getParams(){return{applicationCode:await this.data.getApplicationCode(),hwid:await this.data.getHwid(),...await this.data.getTokens(),...await this.data.getInitParams()}}async getRequestParams(){const t=await this.data.getApplicationCode(),e=await this.data.getHwid(),s=await this.data.getUserId(),a=await this.data.getDeviceType(),i=await this.data.getDeviceModel(),n=await this.data.getLanguage(),r=await this.data.getSdkVersion();return{application:t,hwid:e,userId:s||e,device_type:a,device_model:i,timezone:60*-(new Date).getTimezoneOffset(),language:n,v:r}}}(Q,X);X.getLogLevel().then(t=>{t&&D.setLevel(t)});const tt=self.Pushwoosh=new class{constructor(t,e,s){this._listeners={},this.eventBus=t,this.data=e,this.api=s}push(t){Array.isArray(t)&&"onPush"===t[0]&&n(t[1])&&(this._listeners[t[0]]||(this._listeners[t[0]]=[]),this._listeners[t[0]].push(t[1]))}getListeners(t){return this._listeners[t]||[]}async initApi(){return Promise.resolve()}}(Q,X,Z),et=[];async function st(t){(await self.clients.matchAll()).forEach(e=>e.postMessage(t))}async function at(t){const{notification:e={}}=t,{data:s}=e,i=a(e.tag,{});let n="";if(t.action&&Array.isArray(s.buttons)){n=(s.buttons.find(e=>e.action===t.action)||{}).url}else n=i.url;return{title:e.title,body:e.body,icon:e.icon,buttons:s.buttons,image:s.image,code:s.code,campaignCode:s.campaignCode,inboxId:s.inboxId,messageHash:i.messageHash,customData:i.customData,metaData:i.metaData,openUrl:i.url,tag:e.tag,url:n}}async function it(t){const e=await tt.data.getApplicationCode(),s=await tt.data.getServiceWorkerVersion();await N({message:"Error in onInstallEventHandler",code:"FATAL-SW-001",error:t,applicationCode:e,workerVersion:s})}async function nt(t){const e=await tt.data.getApplicationCode(),s=await tt.data.getServiceWorkerVersion();await N({message:"Error in onActivateEventHandler",code:"FATAL-SW-002",error:t,applicationCode:e,workerVersion:s})}async function rt(t){const e=await tt.data.getApplicationCode(),s=await tt.data.getServiceWorkerVersion();await N({message:"Error in onNotificationClickEventHandler",code:"FATAL-SW-004",error:t,applicationCode:e,workerVersion:s})}async function ot(t){const e=await tt.data.getApplicationCode(),s=await tt.data.getServiceWorkerVersion();await N({message:"Error in onNotificationCloseEventHandler",code:"FATAL-SW-005",error:t,applicationCode:e,workerVersion:s})}async function ct(t){const e=await tt.data.getApplicationCode(),s=await tt.data.getServiceWorkerVersion();await N({message:"Error in onPushSubscriptionChange",code:"FATAL-SW-006",error:t,applicationCode:e,workerVersion:s})}return self.addEventListener("install",function(t){return t.waitUntil(async function(){await Promise.all([tt.data.setServiceWorkerVersion("3.58.0"),D.write("info","install")]),await self.skipWaiting()}().catch(it))}),self.addEventListener("activate",function(t){t.waitUntil(async function(){await Promise.all([D.write("info","activate")]),await self.clients.claim()}().catch(nt))}),self.addEventListener("push",function(t){t.waitUntil(async function(t){await self.clients.claim();const e=await t.data.json(),s=new z(e),a=await s.getNotificationOptionsPayload(),i=await s.getShowNotificationOptions(),n=s.messageHash;await D.write("info",JSON.stringify(a),"onPush");const r=new Y(i,s.body,await s.getTitle()),o=tt.getListeners("onPush");await o.reduce((t,e)=>t.then(()=>e(r)),Promise.resolve());const c=[r.show(),C.add({payload:e,parsedPayload:a,showOptions:i}),st({type:"onPushDelivery",payload:a})];if(n&&c.push(tt.initApi().then(()=>tt.api.messageDeliveryEvent(n,!0,a.metaData))),""!==s.inboxId){const t=new j(tt.eventBus,tt.data,tt.api),e=new O(tt.data,tt.api,t),a=await s.getInboxMessage(),i=await e.publicMessageBuilder(a);c.push(t.putMessage(a),st({type:"onPutNewMessageToInboxStore",payload:i}))}await Promise.all(c)}(t).catch(e=>async function(t,e){const s=await tt.data.getApplicationCode(),a=await tt.data.getServiceWorkerVersion();await N({message:"Error in onPushEventHandler",code:"FATAL-SW-003",error:t,applicationCode:s,workerVersion:a}),t instanceof Error||(t=new Error(t));return C.add({error:`${t}`,stack:t.stack,payload:e.data&&e.data.text()})}(e,t)))}),self.addEventListener("notificationclick",function(t){t.waitUntil(async function(t){await self.clients.claim();const e=await at(t),{messageHash:s,metaData:a,url:i,code:n,inboxId:r}=e;if(n&&et.push(n),""!==r){const t=new j(tt.eventBus,tt.data,tt.api),e=await t.getMessage(r);e.status=3,await t.putMessage(e)}t.notification.close();const o={type:"onNotificationClick",payload:e};return i&&t.waitUntil(self.clients.matchAll({type:"window"}).then(t=>async function(t,e){const{hostname:s,pathname:a}=new URL(e,self.location.origin),i=t.find(t=>{const{hostname:e,pathname:i}=new URL(t.url);return e===s&&i===a});return i?(await i.focus(),!1):(await self.clients.openWindow(e).then(t=>{t&&t.focus()}),!0)}(t,i)).then(t=>{t&&tt.data.setDelayedEvent(o)})),Promise.all([tt.initApi().then(()=>tt.api.pushStat(s,!0,a)),tt.data.setLastOpenMessage({url:i,messageHash:s,expiry:Date.now()+864e5}),st(o)])}(t).catch(rt))}),self.addEventListener("notificationclose",function(t){t.waitUntil(async function(t){await self.clients.claim();const e=await at(t),{code:s}=e;if(t.notification.close(),!s)return;const a=et.indexOf(s);if(!(a>=0))return st({type:"onNotificationClose",payload:e});et.splice(a,1)}(t).catch(ot))}),self.addEventListener("pushsubscriptionchange",async function(t){t.waitUntil(async function(t){let e=t.newSubscription;if(!e&&(e=await self.registration.pushManager.getSubscription(),!e))return;const s=new G(Z,X,{});await s.subscribe(e)}(t).catch(ct))}),{}})());
|
|
2
2
|
//# sourceMappingURL=service-worker.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var n=t();for(var o in n)("object"==typeof exports?exports:e)[o]=n[o]}}(this,()=>(()=>{"use strict";var e={d:(t,n)=>{for(var o in n)e.o(n,o)&&!e.o(t,o)&&Object.defineProperty(t,o,{enumerable:!0,get:n[o]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{WebPopupsWidget:()=>ln});const n="pushwoosh-web-popups";var o,r,i,u,l,_,a,c,s,d,p,f,h,m,v,y={},g=[],b=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,w=Array.isArray;function x(e,t){for(var n in t)e[n]=t[n];return e}function k(e){e&&e.parentNode&&e.parentNode.removeChild(e)}function E(e,t,n){var r,i,u,l={};for(u in t)"key"==u?r=t[u]:"ref"==u?i=t[u]:l[u]=t[u];if(arguments.length>2&&(l.children=arguments.length>3?o.call(arguments,2):n),"function"==typeof e&&null!=e.defaultProps)for(u in e.defaultProps)void 0===l[u]&&(l[u]=e.defaultProps[u]);return S(e,l,r,i,null)}function S(e,t,n,o,u){var l={type:e,props:t,key:n,ref:o,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:u??++i,__i:-1,__u:0};return null==u&&null!=r.vnode&&r.vnode(l),l}function C(e){return e.children}function P(e,t){this.props=e,this.context=t}function N(e,t){if(null==t)return e.__?N(e.__,e.__i+1):null;for(var n;t<e.__k.length;t++)if(null!=(n=e.__k[t])&&null!=n.__e)return n.__e;return"function"==typeof e.type?N(e):null}function I(e){if(e.__P&&e.__d){var t=e.__v,n=t.__e,o=[],i=[],u=x({},t);u.__v=t.__v+1,r.vnode&&r.vnode(u),H(e.__P,u,t,e.__n,e.__P.namespaceURI,32&t.__u?[n]:null,o,n??N(t),!!(32&t.__u),i),u.__v=t.__v,u.__.__k[u.__i]=u,j(o,u,i),t.__e=t.__=null,u.__e!=n&&R(u)}}function R(e){if(null!=(e=e.__)&&null!=e.__c)return e.__e=e.__c.base=null,e.__k.some(function(t){if(null!=t&&null!=t.__e)return e.__e=e.__c.base=t.__e}),R(e)}function T(e){(!e.__d&&(e.__d=!0)&&u.push(e)&&!O.__r++||l!=r.debounceRendering)&&((l=r.debounceRendering)||_)(O)}function O(){try{for(var e,t=1;u.length;)u.length>t&&u.sort(a),e=u.shift(),t=u.length,I(e)}finally{u.length=O.__r=0}}function $(e,t,n,o,r,i,u,l,_,a,c){var s,d,p,f,h,m,v,b=o&&o.__k||g,w=t.length;for(_=F(n,t,b,_,w),s=0;s<w;s++)null!=(p=n.__k[s])&&(d=-1!=p.__i&&b[p.__i]||y,p.__i=s,m=H(e,p,d,r,i,u,l,_,a,c),f=p.__e,p.ref&&d.ref!=p.ref&&(d.ref&&z(d.ref,null,p),c.push(p.ref,p.__c||f,p)),null==h&&null!=f&&(h=f),(v=!!(4&p.__u))||d.__k===p.__k?(_=A(p,_,e,v),v&&d.__e&&(d.__e=null)):"function"==typeof p.type&&void 0!==m?_=m:f&&(_=f.nextSibling),p.__u&=-7);return n.__e=h,_}function F(e,t,n,o,r){var i,u,l,_,a,c=n.length,s=c,d=0;for(e.__k=new Array(r),i=0;i<r;i++)null!=(u=t[i])&&"boolean"!=typeof u&&"function"!=typeof u?("string"==typeof u||"number"==typeof u||"bigint"==typeof u||u.constructor==String?u=e.__k[i]=S(null,u,null,null,null):w(u)?u=e.__k[i]=S(C,{children:u},null,null,null):void 0===u.constructor&&u.__b>0?u=e.__k[i]=S(u.type,u.props,u.key,u.ref?u.ref:null,u.__v):e.__k[i]=u,_=i+d,u.__=e,u.__b=e.__b+1,l=null,-1!=(a=u.__i=D(u,n,_,s))&&(s--,(l=n[a])&&(l.__u|=2)),null==l||null==l.__v?(-1==a&&(r>c?d--:r<c&&d++),"function"!=typeof u.type&&(u.__u|=4)):a!=_&&(a==_-1?d--:a==_+1?d++:(a>_?d--:d++,u.__u|=4))):e.__k[i]=null;if(s)for(i=0;i<c;i++)null!=(l=n[i])&&!(2&l.__u)&&(l.__e==o&&(o=N(l)),q(l,l));return o}function A(e,t,n,o){var r,i;if("function"==typeof e.type){for(r=e.__k,i=0;r&&i<r.length;i++)r[i]&&(r[i].__=e,t=A(r[i],t,n,o));return t}e.__e!=t&&(o&&(t&&e.type&&!t.parentNode&&(t=N(e)),n.insertBefore(e.__e,t||null)),t=e.__e);do{t=t&&t.nextSibling}while(null!=t&&8==t.nodeType);return t}function U(e,t){return t=t||[],null==e||"boolean"==typeof e||(w(e)?e.some(function(e){U(e,t)}):t.push(e)),t}function D(e,t,n,o){var r,i,u,l=e.key,_=e.type,a=t[n],c=null!=a&&!(2&a.__u);if(null===a&&null==l||c&&l==a.key&&_==a.type)return n;if(o>(c?1:0))for(r=n-1,i=n+1;r>=0||i<t.length;)if(null!=(a=t[u=r>=0?r--:i++])&&!(2&a.__u)&&l==a.key&&_==a.type)return u;return-1}function W(e,t,n){"-"==t[0]?e.setProperty(t,n??""):e[t]=null==n?"":"number"!=typeof n||b.test(t)?n:n+"px"}function M(e,t,n,o,r){var i,u;e:if("style"==t)if("string"==typeof n)e.style.cssText=n;else{if("string"==typeof o&&(e.style.cssText=o=""),o)for(t in o)n&&t in n||W(e.style,t,"");if(n)for(t in n)o&&n[t]==o[t]||W(e.style,t,n[t])}else if("o"==t[0]&&"n"==t[1])i=t!=(t=t.replace(p,"$1")),u=t.toLowerCase(),t=u in e||"onFocusOut"==t||"onFocusIn"==t?u.slice(2):t.slice(2),e.l||(e.l={}),e.l[t+i]=n,n?o?n[d]=o[d]:(n[d]=f,e.addEventListener(t,i?m:h,i)):e.removeEventListener(t,i?m:h,i);else{if("http://www.w3.org/2000/svg"==r)t=t.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=t&&"height"!=t&&"href"!=t&&"list"!=t&&"form"!=t&&"tabIndex"!=t&&"download"!=t&&"rowSpan"!=t&&"colSpan"!=t&&"role"!=t&&"popover"!=t&&t in e)try{e[t]=n??"";break e}catch(e){}"function"==typeof n||(null==n||!1===n&&"-"!=t[4]?e.removeAttribute(t):e.setAttribute(t,"popover"==t&&1==n?"":n))}}function L(e){return function(t){if(this.l){var n=this.l[t.type+e];if(null==t[s])t[s]=f++;else if(t[s]<n[d])return;return n(r.event?r.event(t):t)}}}function H(e,t,n,o,i,u,l,_,a,c){var s,d,p,f,h,m,v,y,b,E,S,N,I,R,T,O=t.type;if(void 0!==t.constructor)return null;128&n.__u&&(a=!!(32&n.__u),u=[_=t.__e=n.__e]),(s=r.__b)&&s(t);e:if("function"==typeof O)try{if(y=t.props,b=O.prototype&&O.prototype.render,E=(s=O.contextType)&&o[s.__c],S=s?E?E.props.value:s.__:o,n.__c?v=(d=t.__c=n.__c).__=d.__E:(b?t.__c=d=new O(y,S):(t.__c=d=new P(y,S),d.constructor=O,d.render=Z),E&&E.sub(d),d.state||(d.state={}),d.__n=o,p=d.__d=!0,d.__h=[],d._sb=[]),b&&null==d.__s&&(d.__s=d.state),b&&null!=O.getDerivedStateFromProps&&(d.__s==d.state&&(d.__s=x({},d.__s)),x(d.__s,O.getDerivedStateFromProps(y,d.__s))),f=d.props,h=d.state,d.__v=t,p)b&&null==O.getDerivedStateFromProps&&null!=d.componentWillMount&&d.componentWillMount(),b&&null!=d.componentDidMount&&d.__h.push(d.componentDidMount);else{if(b&&null==O.getDerivedStateFromProps&&y!==f&&null!=d.componentWillReceiveProps&&d.componentWillReceiveProps(y,S),t.__v==n.__v||!d.__e&&null!=d.shouldComponentUpdate&&!1===d.shouldComponentUpdate(y,d.__s,S)){t.__v!=n.__v&&(d.props=y,d.state=d.__s,d.__d=!1),t.__e=n.__e,t.__k=n.__k,t.__k.some(function(e){e&&(e.__=t)}),g.push.apply(d.__h,d._sb),d._sb=[],d.__h.length&&l.push(d);break e}null!=d.componentWillUpdate&&d.componentWillUpdate(y,d.__s,S),b&&null!=d.componentDidUpdate&&d.__h.push(function(){d.componentDidUpdate(f,h,m)})}if(d.context=S,d.props=y,d.__P=e,d.__e=!1,N=r.__r,I=0,b)d.state=d.__s,d.__d=!1,N&&N(t),s=d.render(d.props,d.state,d.context),g.push.apply(d.__h,d._sb),d._sb=[];else do{d.__d=!1,N&&N(t),s=d.render(d.props,d.state,d.context),d.state=d.__s}while(d.__d&&++I<25);d.state=d.__s,null!=d.getChildContext&&(o=x(x({},o),d.getChildContext())),b&&!p&&null!=d.getSnapshotBeforeUpdate&&(m=d.getSnapshotBeforeUpdate(f,h)),R=null!=s&&s.type===C&&null==s.key?V(s.props.children):s,_=$(e,w(R)?R:[R],t,n,o,i,u,l,_,a,c),d.base=t.__e,t.__u&=-161,d.__h.length&&l.push(d),v&&(d.__E=d.__=null)}catch(e){if(t.__v=null,a||null!=u)if(e.then){for(t.__u|=a?160:128;_&&8==_.nodeType&&_.nextSibling;)_=_.nextSibling;u[u.indexOf(_)]=null,t.__e=_}else{for(T=u.length;T--;)k(u[T]);B(t)}else t.__e=n.__e,t.__k=n.__k,e.then||B(t);r.__e(e,t,n)}else null==u&&t.__v==n.__v?(t.__k=n.__k,t.__e=n.__e):_=t.__e=G(n.__e,t,n,o,i,u,l,a,c);return(s=r.diffed)&&s(t),128&t.__u?void 0:_}function B(e){e&&(e.__c&&(e.__c.__e=!0),e.__k&&e.__k.some(B))}function j(e,t,n){for(var o=0;o<n.length;o++)z(n[o],n[++o],n[++o]);r.__c&&r.__c(t,e),e.some(function(t){try{e=t.__h,t.__h=[],e.some(function(e){e.call(t)})}catch(e){r.__e(e,t.__v)}})}function V(e){return"object"!=typeof e||null==e||e.__b>0?e:w(e)?e.map(V):void 0!==e.constructor?null:x({},e)}function G(e,t,n,i,u,l,_,a,c){var s,d,p,f,h,m,v,g=n.props||y,b=t.props,x=t.type;if("svg"==x?u="http://www.w3.org/2000/svg":"math"==x?u="http://www.w3.org/1998/Math/MathML":u||(u="http://www.w3.org/1999/xhtml"),null!=l)for(s=0;s<l.length;s++)if((h=l[s])&&"setAttribute"in h==!!x&&(x?h.localName==x:3==h.nodeType)){e=h,l[s]=null;break}if(null==e){if(null==x)return document.createTextNode(b);e=document.createElementNS(u,x,b.is&&b),a&&(r.__m&&r.__m(t,l),a=!1),l=null}if(null==x)g===b||a&&e.data==b||(e.data=b);else{if(l="textarea"==x&&null!=b.defaultValue?null:l&&o.call(e.childNodes),!a&&null!=l)for(g={},s=0;s<e.attributes.length;s++)g[(h=e.attributes[s]).name]=h.value;for(s in g)h=g[s],"dangerouslySetInnerHTML"==s?p=h:"children"==s||s in b||"value"==s&&"defaultValue"in b||"checked"==s&&"defaultChecked"in b||M(e,s,null,h,u);for(s in b)h=b[s],"children"==s?f=h:"dangerouslySetInnerHTML"==s?d=h:"value"==s?m=h:"checked"==s?v=h:a&&"function"!=typeof h||g[s]===h||M(e,s,h,g[s],u);if(d)a||p&&(d.__html==p.__html||d.__html==e.innerHTML)||(e.innerHTML=d.__html),t.__k=[];else if(p&&(e.innerHTML=""),$("template"==t.type?e.content:e,w(f)?f:[f],t,n,i,"foreignObject"==x?"http://www.w3.org/1999/xhtml":u,l,_,l?l[0]:n.__k&&N(n,0),a,c),null!=l)for(s=l.length;s--;)k(l[s]);a&&"textarea"!=x||(s="value","progress"==x&&null==m?e.removeAttribute("value"):null!=m&&(m!==e[s]||"progress"==x&&!m||"option"==x&&m!=g[s])&&M(e,s,m,g[s],u),s="checked",null!=v&&v!=e[s]&&M(e,s,v,g[s],u))}return e}function z(e,t,n){try{if("function"==typeof e){var o="function"==typeof e.__u;o&&e.__u(),o&&null==t||(e.__u=e(t))}else e.current=t}catch(e){r.__e(e,n)}}function q(e,t,n){var o,i;if(r.unmount&&r.unmount(e),(o=e.ref)&&(o.current&&o.current!=e.__e||z(o,null,t)),null!=(o=e.__c)){if(o.componentWillUnmount)try{o.componentWillUnmount()}catch(e){r.__e(e,t)}o.base=o.__P=null}if(o=e.__k)for(i=0;i<o.length;i++)o[i]&&q(o[i],t,n||"function"!=typeof e.type);n||k(e.__e),e.__c=e.__=e.__e=void 0}function Z(e,t,n){return this.constructor(e,n)}function K(e,t,n){var i,u,l,_;t==document&&(t=document.documentElement),r.__&&r.__(e,t),u=(i="function"==typeof n)?null:n&&n.__k||t.__k,l=[],_=[],H(t,e=(!i&&n||t).__k=E(C,null,[e]),u||y,y,t.namespaceURI,!i&&n?[n]:u?null:t.firstChild?o.call(t.childNodes):null,l,!i&&n?n:u?u.__e:t.firstChild,i,_),j(l,e,_)}function Q(e,t){K(e,t,Q)}function J(e,t,n){var r,i,u,l,_=x({},e.props);for(u in e.type&&e.type.defaultProps&&(l=e.type.defaultProps),t)"key"==u?r=t[u]:"ref"==u?i=t[u]:_[u]=void 0===t[u]&&null!=l?l[u]:t[u];return arguments.length>2&&(_.children=arguments.length>3?o.call(arguments,2):n),S(e.type,_,r||e.key,i||e.ref,null)}function Y(e){function t(e){var n,o;return this.getChildContext||(n=new Set,(o={})[t.__c]=this,this.getChildContext=function(){return o},this.componentWillUnmount=function(){n=null},this.shouldComponentUpdate=function(e){this.props.value!=e.value&&n.forEach(function(e){e.__e=!0,T(e)})},this.sub=function(e){n.add(e);var t=e.componentWillUnmount;e.componentWillUnmount=function(){n&&n.delete(e),t&&t.call(e)}}),e.children}return t.__c="__cC"+v++,t.__=e,t.Provider=t.__l=(t.Consumer=function(e,t){return e.children(t)}).contextType=t,t}o=g.slice,r={__e:function(e,t,n,o){for(var r,i,u;t=t.__;)if((r=t.__c)&&!r.__)try{if((i=r.constructor)&&null!=i.getDerivedStateFromError&&(r.setState(i.getDerivedStateFromError(e)),u=r.__d),null!=r.componentDidCatch&&(r.componentDidCatch(e,o||{}),u=r.__d),u)return r.__E=r}catch(t){e=t}throw e}},i=0,P.prototype.setState=function(e,t){var n;n=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=x({},this.state),"function"==typeof e&&(e=e(x({},n),this.props)),e&&x(n,e),null!=e&&this.__v&&(t&&this._sb.push(t),T(this))},P.prototype.forceUpdate=function(e){this.__v&&(this.__e=!0,e&&this.__h.push(e),T(this))},P.prototype.render=C,u=[],_="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,a=function(e,t){return e.__v.__b-t.__v.__b},O.__r=0,c=Math.random().toString(8),s="__d"+c,d="__a"+c,p=/(PointerCapture)$|Capture$/i,f=0,h=L(!1),m=L(!0),v=0;var X=0;Array.isArray;function ee(e,t,n,o,i,u){t||(t={});var l,_,a=t;if("ref"in a)for(_ in a={},t)"ref"==_?l=t[_]:a[_]=t[_];var c={type:e,props:a,key:n,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--X,__i:-1,__u:0,__source:i,__self:u};if("function"==typeof e&&(l=e.defaultProps))for(_ in l)void 0===a[_]&&(a[_]=l[_]);return r.vnode&&r.vnode(c),c}var te,ne,oe,re,ie=0,ue=[],le=r,_e=le.__b,ae=le.__r,ce=le.diffed,se=le.__c,de=le.unmount,pe=le.__;function fe(e,t){le.__h&&le.__h(ne,e,ie||t),ie=0;var n=ne.__H||(ne.__H={__:[],__h:[]});return e>=n.__.length&&n.__.push({}),n.__[e]}function he(e){return ie=1,me(Oe,e)}function me(e,t,n){var o=fe(te++,2);if(o.t=e,!o.__c&&(o.__=[n?n(t):Oe(void 0,t),function(e){var t=o.__N?o.__N[0]:o.__[0],n=o.t(t,e);t!==n&&(o.__N=[n,o.__[1]],o.__c.setState({}))}],o.__c=ne,!ne.__f)){var r=function(e,t,n){if(!o.__c.__H)return!0;var r=o.__c.__H.__.filter(function(e){return e.__c});if(r.every(function(e){return!e.__N}))return!i||i.call(this,e,t,n);var u=o.__c.props!==e;return r.some(function(e){if(e.__N){var t=e.__[0];e.__=e.__N,e.__N=void 0,t!==e.__[0]&&(u=!0)}}),i&&i.call(this,e,t,n)||u};ne.__f=!0;var i=ne.shouldComponentUpdate,u=ne.componentWillUpdate;ne.componentWillUpdate=function(e,t,n){if(this.__e){var o=i;i=void 0,r(e,t,n),i=o}u&&u.call(this,e,t,n)},ne.shouldComponentUpdate=r}return o.__N||o.__}function ve(e,t){var n=fe(te++,3);!le.__s&&Te(n.__H,t)&&(n.__=e,n.u=t,ne.__H.__h.push(n))}function ye(e,t){var n=fe(te++,4);!le.__s&&Te(n.__H,t)&&(n.__=e,n.u=t,ne.__h.push(n))}function ge(e){return ie=5,we(function(){return{current:e}},[])}function be(e,t,n){ie=6,ye(function(){if("function"==typeof e){var n=e(t());return function(){e(null),n&&"function"==typeof n&&n()}}if(e)return e.current=t(),function(){return e.current=null}},null==n?n:n.concat(e))}function we(e,t){var n=fe(te++,7);return Te(n.__H,t)&&(n.__=e(),n.__H=t,n.__h=e),n.__}function xe(e,t){return ie=8,we(function(){return e},t)}function ke(e){var t=ne.context[e.__c],n=fe(te++,9);return n.c=e,t?(null==n.__&&(n.__=!0,t.sub(ne)),t.props.value):e.__}function Ee(e,t){le.useDebugValue&&le.useDebugValue(t?t(e):e)}function Se(){var e=fe(te++,11);if(!e.__){for(var t=ne.__v;null!==t&&!t.__m&&null!==t.__;)t=t.__;var n=t.__m||(t.__m=[0,0]);e.__="P"+n[0]+"-"+n[1]++}return e.__}function Ce(){for(var e;e=ue.shift();){var t=e.__H;if(e.__P&&t)try{t.__h.some(Ie),t.__h.some(Re),t.__h=[]}catch(n){t.__h=[],le.__e(n,e.__v)}}}le.__b=function(e){ne=null,_e&&_e(e)},le.__=function(e,t){e&&t.__k&&t.__k.__m&&(e.__m=t.__k.__m),pe&&pe(e,t)},le.__r=function(e){ae&&ae(e),te=0;var t=(ne=e.__c).__H;t&&(oe===ne?(t.__h=[],ne.__h=[],t.__.some(function(e){e.__N&&(e.__=e.__N),e.u=e.__N=void 0})):(t.__h.some(Ie),t.__h.some(Re),t.__h=[],te=0)),oe=ne},le.diffed=function(e){ce&&ce(e);var t=e.__c;t&&t.__H&&(t.__H.__h.length&&(1!==ue.push(t)&&re===le.requestAnimationFrame||((re=le.requestAnimationFrame)||Ne)(Ce)),t.__H.__.some(function(e){e.u&&(e.__H=e.u),e.u=void 0})),oe=ne=null},le.__c=function(e,t){t.some(function(e){try{e.__h.some(Ie),e.__h=e.__h.filter(function(e){return!e.__||Re(e)})}catch(n){t.some(function(e){e.__h&&(e.__h=[])}),t=[],le.__e(n,e.__v)}}),se&&se(e,t)},le.unmount=function(e){de&&de(e);var t,n=e.__c;n&&n.__H&&(n.__H.__.some(function(e){try{Ie(e)}catch(e){t=e}}),n.__H=void 0,t&&le.__e(t,n.__v))};var Pe="function"==typeof requestAnimationFrame;function Ne(e){var t,n=function(){clearTimeout(o),Pe&&cancelAnimationFrame(t),setTimeout(e)},o=setTimeout(n,35);Pe&&(t=requestAnimationFrame(n))}function Ie(e){var t=ne,n=e.__c;"function"==typeof n&&(e.__c=void 0,n()),ne=t}function Re(e){var t=ne;e.__c=e.__(),ne=t}function Te(e,t){return!e||e.length!==t.length||t.some(function(t,n){return t!==e[n]})}function Oe(e,t){return"function"==typeof t?t(e):t}function $e(e,t){for(var n in t)e[n]=t[n];return e}function Fe(e,t){for(var n in e)if("__source"!==n&&!(n in t))return!0;for(var o in t)if("__source"!==o&&e[o]!==t[o])return!0;return!1}function Ae(e,t){var n=t(),o=he({t:{__:n,u:t}}),r=o[0].t,i=o[1];return ye(function(){r.__=n,r.u=t,Ue(r)&&i({t:r})},[e,n,t]),ve(function(){return Ue(r)&&i({t:r}),e(function(){Ue(r)&&i({t:r})})},[e]),n}function Ue(e){try{return!((t=e.__)===(n=e.u())&&(0!==t||1/t==1/n)||t!=t&&n!=n)}catch(e){return!0}var t,n}function De(e){e()}function We(e){return e}function Me(){return[!1,De]}var Le=ye;function He(e,t){this.props=e,this.context=t}(He.prototype=new P).isPureReactComponent=!0,He.prototype.shouldComponentUpdate=function(e,t){return Fe(this.props,e)||Fe(this.state,t)};var Be=r.__b;r.__b=function(e){e.type&&e.type.__f&&e.ref&&(e.props.ref=e.ref,e.ref=null),Be&&Be(e)};var je="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.forward_ref")||3911;var Ve=function(e,t){return null==e?null:U(U(e).map(t))},Ge={map:Ve,forEach:Ve,count:function(e){return e?U(e).length:0},only:function(e){var t=U(e);if(1!==t.length)throw"Children.only";return t[0]},toArray:U},ze=r.__e;r.__e=function(e,t,n,o){if(e.then)for(var r,i=t;i=i.__;)if((r=i.__c)&&r.__c)return null==t.__e&&(t.__e=n.__e,t.__k=n.__k),r.__c(e,t);ze(e,t,n,o)};var qe=r.unmount;function Ze(e,t,n){return e&&(e.__c&&e.__c.__H&&(e.__c.__H.__.forEach(function(e){"function"==typeof e.__c&&e.__c()}),e.__c.__H=null),null!=(e=$e({},e)).__c&&(e.__c.__P===n&&(e.__c.__P=t),e.__c.__e=!0,e.__c=null),e.__k=e.__k&&e.__k.map(function(e){return Ze(e,t,n)})),e}function Ke(e,t,n){return e&&n&&(e.__v=null,e.__k=e.__k&&e.__k.map(function(e){return Ke(e,t,n)}),e.__c&&e.__c.__P===t&&(e.__e&&n.appendChild(e.__e),e.__c.__e=!0,e.__c.__P=n)),e}function Qe(){this.__u=0,this.o=null,this.__b=null}function Je(e){var t=e.__&&e.__.__c;return t&&t.__a&&t.__a(e)}function Ye(){this.i=null,this.l=null}r.unmount=function(e){var t=e.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&e.__u&&(e.type=null),qe&&qe(e)},(Qe.prototype=new P).__c=function(e,t){var n=t.__c,o=this;null==o.o&&(o.o=[]),o.o.push(n);var r=Je(o.__v),i=!1,u=function(){i||o.__z||(i=!0,n.__R=null,r?r(_):_())};n.__R=u;var l=n.__P;n.__P=null;var _=function(){if(! --o.__u){if(o.state.__a){var e=o.state.__a;o.__v.__k[0]=Ke(e,e.__c.__P,e.__c.__O)}var t;for(o.setState({__a:o.__b=null});t=o.o.pop();)t.__P=l,t.forceUpdate()}};o.__u++||32&t.__u||o.setState({__a:o.__b=o.__v.__k[0]}),e.then(u,u)},Qe.prototype.componentWillUnmount=function(){this.o=[]},Qe.prototype.render=function(e,t){if(this.__b){if(this.__v.__k){var n=document.createElement("div"),o=this.__v.__k[0].__c;this.__v.__k[0]=Ze(this.__b,n,o.__O=o.__P)}this.__b=null}var r=t.__a&&E(C,null,e.fallback);return r&&(r.__u&=-33),[E(C,null,t.__a?null:e.children),r]};var Xe=function(e,t,n){if(++n[1]===n[0]&&e.l.delete(t),e.props.revealOrder&&("t"!==e.props.revealOrder[0]||!e.l.size))for(n=e.i;n;){for(;n.length>3;)n.pop()();if(n[1]<n[0])break;e.i=n=n[2]}};function et(e){return this.getChildContext=function(){return e.context},e.children}function tt(e){var t=this,n=e.h;if(t.componentWillUnmount=function(){K(null,t.v),t.v=null,t.h=null},t.h&&t.h!==n&&t.componentWillUnmount(),!t.v){for(var o=t.__v;null!==o&&!o.__m&&null!==o.__;)o=o.__;t.h=n,t.v={nodeType:1,parentNode:n,childNodes:[],__k:{__m:o.__m},contains:function(){return!0},namespaceURI:n.namespaceURI,insertBefore:function(e,n){this.childNodes.push(e),t.h.insertBefore(e,n)},removeChild:function(e){this.childNodes.splice(this.childNodes.indexOf(e)>>>1,1),t.h.removeChild(e)}}}K(E(et,{context:t.context},e.__v),t.v)}(Ye.prototype=new P).__a=function(e){var t=this,n=Je(t.__v),o=t.l.get(e);return o[0]++,function(r){var i=function(){t.props.revealOrder?(o.push(r),Xe(t,e,o)):r()};n?n(i):i()}},Ye.prototype.render=function(e){this.i=null,this.l=new Map;var t=U(e.children);e.revealOrder&&"b"===e.revealOrder[0]&&t.reverse();for(var n=t.length;n--;)this.l.set(t[n],this.i=[1,0,this.i]);return e.children},Ye.prototype.componentDidUpdate=Ye.prototype.componentDidMount=function(){var e=this;this.l.forEach(function(t,n){Xe(e,n,t)})};var nt="undefined"!=typeof Symbol&&Symbol.for&&Symbol.for("react.element")||60103,ot=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,rt=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,it=/[A-Z0-9]/g,ut="undefined"!=typeof document,lt=function(e){return("undefined"!=typeof Symbol&&"symbol"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(e)};P.prototype.isReactComponent=!0,["componentWillMount","componentWillReceiveProps","componentWillUpdate"].forEach(function(e){Object.defineProperty(P.prototype,e,{configurable:!0,get:function(){return this["UNSAFE_"+e]},set:function(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,value:t})}})});var _t=r.event;r.event=function(e){return _t&&(e=_t(e)),e.persist=function(){},e.isPropagationStopped=function(){return this.cancelBubble},e.isDefaultPrevented=function(){return this.defaultPrevented},e.nativeEvent=e};var at,ct={configurable:!0,get:function(){return this.class}},st=r.vnode;r.vnode=function(e){"string"==typeof e.type&&function(e){var t=e.props,n=e.type,o={},r=-1==n.indexOf("-");for(var i in t){var u=t[i];if(!("value"===i&&"defaultValue"in t&&null==u||ut&&"children"===i&&"noscript"===n||"class"===i||"className"===i)){var l=i.toLowerCase();"defaultValue"===i&&"value"in t&&null==t.value?i="value":"download"===i&&!0===u?u="":"translate"===l&&"no"===u?u=!1:"o"===l[0]&&"n"===l[1]?"ondoubleclick"===l?i="ondblclick":"onchange"!==l||"input"!==n&&"textarea"!==n||lt(t.type)?"onfocus"===l?i="onfocusin":"onblur"===l?i="onfocusout":rt.test(i)&&(i=l):l=i="oninput":r&&ot.test(i)?i=i.replace(it,"-$&").toLowerCase():null===u&&(u=void 0),"oninput"===l&&o[i=l]&&(i="oninputCapture"),o[i]=u}}"select"==n&&(o.multiple&&Array.isArray(o.value)&&(o.value=U(t.children).forEach(function(e){e.props.selected=-1!=o.value.indexOf(e.props.value)})),null!=o.defaultValue&&(o.value=U(t.children).forEach(function(e){e.props.selected=o.multiple?-1!=o.defaultValue.indexOf(e.props.value):o.defaultValue==e.props.value}))),t.class&&!t.className?(o.class=t.class,Object.defineProperty(o,"className",ct)):t.className&&(o.class=o.className=t.className),e.props=o}(e),e.$$typeof=nt,st&&st(e)};var dt=r.__r;r.__r=function(e){dt&&dt(e),at=e.__c};var pt=r.diffed;r.diffed=function(e){pt&&pt(e);var t=e.props,n=e.__e;null!=n&&"textarea"===e.type&&"value"in t&&t.value!==n.value&&(n.value=null==t.value?"":t.value),at=null};var ft={ReactCurrentDispatcher:{current:{readContext:function(e){return at.__n[e.__c].props.value},useCallback:xe,useContext:ke,useDebugValue:Ee,useDeferredValue:We,useEffect:ve,useId:Se,useImperativeHandle:be,useInsertionEffect:Le,useLayoutEffect:ye,useMemo:we,useReducer:me,useRef:ge,useState:he,useSyncExternalStore:Ae,useTransition:Me}}};function ht(e){return!!e&&e.$$typeof===nt}var mt={useState:he,useId:Se,useReducer:me,useEffect:ve,useLayoutEffect:ye,useInsertionEffect:Le,useTransition:Me,useDeferredValue:We,useSyncExternalStore:Ae,startTransition:De,useRef:ge,useImperativeHandle:be,useMemo:we,useCallback:xe,useContext:ke,useDebugValue:Ee,version:"18.3.1",Children:Ge,render:function(e,t,n){return null==t.__k&&(t.textContent=""),K(e,t),"function"==typeof n&&n(),e?e.__c:null},hydrate:function(e,t,n){return Q(e,t),"function"==typeof n&&n(),e?e.__c:null},unmountComponentAtNode:function(e){return!!e.__k&&(K(null,e),!0)},createPortal:function(e,t){var n=E(tt,{__v:e,h:t});return n.containerInfo=t,n},createElement:E,createContext:Y,createFactory:function(e){return E.bind(null,e)},cloneElement:function(e){return ht(e)?J.apply(null,arguments):e},createRef:function(){return{current:null}},Fragment:C,isValidElement:ht,isElement:ht,isFragment:function(e){return ht(e)&&e.type===C},isMemo:function(e){return!!e&&"string"==typeof e.displayName&&0==e.displayName.indexOf("Memo(")},findDOMNode:function(e){return e&&(e.base||1===e.nodeType&&e)||null},Component:P,PureComponent:He,memo:function(e,t){function n(e){var n=this.props.ref;return n!=e.ref&&n&&("function"==typeof n?n(null):n.current=null),t?!t(this.props,e)||n!=e.ref:Fe(this.props,e)}function o(t){return this.shouldComponentUpdate=n,E(e,t)}return o.displayName="Memo("+(e.displayName||e.name)+")",o.__f=o.prototype.isReactComponent=!0,o.type=e,o},forwardRef:function(e){function t(t){var n=$e({},t);return delete n.ref,e(n,t.ref||null)}return t.$$typeof=je,t.render=e,t.prototype.isReactComponent=t.__f=!0,t.displayName="ForwardRef("+(e.displayName||e.name)+")",t},flushSync:function(e,t){var n=r.debounceRendering;r.debounceRendering=function(e){return e()};var o=e(t);return r.debounceRendering=n,o},unstable_batchedUpdates:function(e,t){return e(t)},StrictMode:C,Suspense:Qe,SuspenseList:Ye,lazy:function(e){var t,n,o,r=null;function i(i){if(t||(t=e()).then(function(e){e&&(r=e.default||e),o=!0},function(e){n=e,o=!0}),n)throw n;if(!o)throw t;return r?E(r,i):null}return i.displayName="Lazy",i.__f=!0,i},__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:ft};const vt=/^(https?:|mailto:|tel:)/i,yt=Y({textVariants:{}});function gt(e){if(!e)return;const t={};return e.backgroundColor&&(t.backgroundColor=e.backgroundColor),e.borderColor&&e.borderWidth&&(t.border=`${e.borderWidth}px solid ${e.borderColor}`),e.borderRadius&&(t.borderRadius=`${e.borderRadius}px`),Object.keys(t).length?t:void 0}function bt(e){return!!e&&e.value>0&&"CARD_IMAGE_SIZE_UNIT_UNSPECIFIED"!==e.unit}function wt(e){return bt(e)?function(e){return bt(e)&&"CARD_IMAGE_SIZE_UNIT_PERCENT"===e.unit}(e)?{width:"100%",height:"auto",aspectRatio:`100 / ${e.value}`}:{width:"100%",height:`${e.value}px`}:{}}function xt(e){return e.top===e.right&&e.right===e.bottom&&e.bottom===e.left?`${e.top}px`:e.top===e.bottom&&e.left===e.right?`${e.top}px ${e.right}px`:`${e.top}px ${e.right}px ${e.bottom}px ${e.left}px`}function kt(e,t){return e[t]??{fontSize:14,fontWeight:400,lineHeight:1.5}}function Et(e,t,n){const o=kt(e,t),r={fontSize:`${o.fontSize}px`};400!==o.fontWeight&&(r.fontWeight=o.fontWeight),1.5!==o.lineHeight&&(r.lineHeight=o.lineHeight);const i=o.fontFamily||n;return i&&(r.fontFamily=i),r}function St({block:e,items:t,defaults:n}){if("placeholder"===e.itemType)return null;const o={...n,...e.styles};let r;return r="card"===e.itemType?mt.createElement(Nt,{card:e}):"columns"===e.itemType?mt.createElement(It,{columns:e}):"content"===e.itemType?mt.createElement(Ct,{leaf:e}):mt.createElement(Pt,{group:e,items:t,defaults:n}),mt.createElement("div",{style:gt(o)},r)}function Ct({leaf:e}){return mt.createElement(Tt,{body:e.content})}function Pt({group:e,items:t,defaults:n}){const o=function(e,t){return e.filter(e=>e.parentId===t)}(t,e.id);if(0===o.length)return null;const r={display:"flex",flexDirection:"GROUP_DIRECTION_HORIZONTAL"===e.direction?"row":"column",gap:`${e.gap??0}px`,alignItems:(i=e.align,"GROUP_ALIGN_CENTER"===i?"center":"GROUP_ALIGN_END"===i?"flex-end":"flex-start")};var i;return e.padding&&(r.padding=xt(e.padding)),e.margin&&(r.margin=xt(e.margin)),mt.createElement("div",{style:r},o.map(e=>mt.createElement(St,{key:e.id,block:e,items:t,defaults:n})))}function Nt({card:e}){const{cardDefaults:t}=ke(yt),n=(e.cardStyles??{}).contentPadding??t?.contentPadding,o=("CARD_IMAGE_FIT_COVER"===(r=e.imageFit)?"cover":"CARD_IMAGE_FIT_CONTAIN"===r?"contain":"CARD_IMAGE_FIT_FILL"===r?"fill":void 0)??"cover";var r;const i=(u=e.imagePosition,`${u?.x??50}% ${u?.y??50}%`);var u;const l=mt.createElement("div",{style:n?{padding:xt(n)}:void 0},mt.createElement(Tt,{body:e.content}));if("no"===e.layout)return l;if("background"===e.layout&&e.image?.src)return mt.createElement("div",{style:{position:"relative",overflow:"hidden",borderRadius:"4px"}},mt.createElement(Ut,{image:e.image,style:{width:"100%",display:"block",objectFit:o,objectPosition:i,...wt(e.imageSize)}}),mt.createElement("div",{style:{position:"absolute",inset:0,padding:"16px",backgroundColor:"rgba(0,0,0,0.4)",color:"#ffffff",display:"flex",flexDirection:"column",justifyContent:"center"}},l));if("left"===e.layout||"right"===e.layout){const t=function(e){if(bt(e))return"CARD_IMAGE_SIZE_UNIT_PERCENT"===e.unit?`${e.value}%`:`${e.value}px`}(e.imageSize)??"200px",n=e.image?.src?mt.createElement("div",{style:{position:"relative",flexShrink:0,alignSelf:"stretch",width:t}},mt.createElement(Ut,{image:e.image,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:o,objectPosition:i}})):null;return mt.createElement("div",{style:{display:"flex",alignItems:"stretch"}},"left"===e.layout&&n,mt.createElement("div",{style:{flex:1,minWidth:0}},l),"right"===e.layout&&n)}return mt.createElement("div",null,e.image?.src&&mt.createElement(Ut,{image:e.image,style:{width:"100%",display:"block",objectFit:o,objectPosition:i,...wt(e.imageSize)}}),l)}function It({columns:e}){const{columnsDefaults:t}=ke(yt),n=e.columnsStyles??{},o=e.gap||t?.gap||16,r=n.padding??t?.padding,i=n.columnPadding??t?.columnPadding,u={display:"flex",gap:`${o}px`};return r&&(u.padding=xt(r)),mt.createElement("div",{style:u},e.columns.map((e,t)=>mt.createElement(Rt,{key:t,column:e,columnPadding:i})))}function Rt({column:e,columnPadding:t}){const n={flex:e.width?`0 1 ${e.width}`:"1 1 0",minWidth:0};return t&&(n.padding=xt(t)),mt.createElement("div",{style:n},e.image?.src&&mt.createElement(Ut,{image:e.image,style:{width:"100%",display:"block"}}),mt.createElement(Tt,{body:e.content}))}function Tt({body:e}){if(!e)return null;const t=function(e){const t={};return e.margin&&(t.margin=xt(e.margin)),e.padding&&(t.padding=xt(e.padding)),t}(e),n=Object.keys(t).length>0,o=e.items.map((e,t)=>mt.createElement(Ot,{key:t,item:e}));return n?mt.createElement("div",{style:t},o):mt.createElement(mt.Fragment,null,o)}function Ot({item:e}){return"buttonGroup"===e.itemType?mt.createElement(Ft,{group:e}):mt.createElement($t,{item:e})}function $t({item:e}){const{textVariants:t,baseFontFamily:n}=ke(yt),o={...Et(t,e.variant,n),padding:"2px 0"};return mt.createElement("div",{style:o,dangerouslySetInnerHTML:{__html:e.text}})}function Ft({group:e}){const{buttonGroupDefaults:t}=ke(yt);if(!e.buttons.length)return null;const n=e.styles??{},o=n.gap??t?.gap??8,r=n.padding??t?.padding,i=n.backgroundColor||t?.backgroundColor,u={display:"flex",flexWrap:"wrap",gap:`${o}px`,justifyContent:(l=e.align,"BUTTON_GROUP_ALIGN_CENTER"===l?"center":"BUTTON_GROUP_ALIGN_RIGHT"===l?"flex-end":"flex-start")};var l;return r&&(u.padding=xt(r)),i&&(u.backgroundColor=i),mt.createElement("div",{style:u},e.buttons.map((e,t)=>mt.createElement(At,{key:t,button:e})))}function At({button:e}){const{buttonDefaults:t,baseFontFamily:n}=ke(yt),o=e.styles??{},r={display:"inline-block",textDecoration:"none",padding:"8px 16px"},i=o.backgroundColor||t?.backgroundColor;i&&(r.backgroundColor=i);const u=o.textColor||t?.textColor;u&&(r.color=u);const l=o.borderWidth||t?.borderWidth;if(l){const e=o.borderColor||t?.borderColor||"#000";r.border=`${l}px solid ${e}`}const _=o.borderRadius||t?.borderRadius;_&&(r.borderRadius=`${_}px`);const a=o.fontSize||t?.fontSize;a&&(r.fontSize=`${a}px`);const c=o.fontFamily||t?.fontFamily||n;c&&(r.fontFamily=c);const s=function(e){const t=(e||"").trim();if(t)return t.startsWith("#")||t.startsWith("/")||t.startsWith("?")||vt.test(t)?t:void 0}(e.url);return mt.createElement("a",{href:s||"#",target:"_blank",rel:"noreferrer",style:r},e.text||"Button")}function Ut({image:e,style:t}){return e.src?mt.createElement("img",{src:e.src,alt:e.alt||"",style:{maxWidth:"100%",...t}}):null}const Dt="\n@keyframes pw-popup-fade { from { opacity: 0; } }\n@keyframes pw-popup-slide { from { opacity: 0; translate: 0 16px; } }\n@keyframes pw-popup-overlay { from { opacity: 0; } }\n";function Wt(e){const t={};e.borderRadius>0&&(t.borderRadius=`${e.borderRadius}px`),e.boxShadow&&(t.boxShadow=e.boxShadow);const n="POPUP_ANIMATION_FADE"===(o=e.animation)?"pw-popup-fade":"POPUP_ANIMATION_SLIDE"===o?"pw-popup-slide":void 0;var o;return n&&(t.animation=`${n} 0.2s ease-out backwards`),t}function Mt(e,t){const n=void 0!==e.top,o=void 0!==e.bottom,r=void 0!==e.left,i=void 0!==e.right,u={position:"fixed",boxSizing:"border-box",overflow:"auto",...Wt(e)};r&&i?(u.left=`${e.left}px`,u.right=`${e.right}px`):(u.width=`${t}px`,r?u.left=`${e.left}px`:i?u.right=`${e.right}px`:u.left="50%"),n&&o?(u.top=`${e.top}px`,u.bottom=`${e.bottom}px`):(n?u.top=`${e.top}px`:o?u.bottom=`${e.bottom}px`:u.top="50%",u.maxHeight=`calc(100% - ${(e.top??0)+(e.bottom??0)}px)`);const l=r||i?"0":"-50%",_=n||o?"0":"-50%";return"0"===l&&"0"===_||(u.transform=`translate(${l}, ${_})`),u}function Lt(e,t){return{position:"relative",boxSizing:"border-box",width:`${t}px`,...Wt(e)}}function Ht(e){const{document:t,mode:n}=e,{items:o,settings:r,textVariants:i,popupSettings:u}=t,l=o??[],_=function(e){return e.filter(e=>!e.parentId)}(l),a=r?.blockGap||16,c=r?.width||600,s=r?.defaultStyles?.common,d=r?.fontFamily||'-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Helvetica,Arial,sans-serif',p={maxWidth:`${c}px`,margin:"0 auto",fontFamily:d};r?.backgroundColor&&(p.backgroundColor=r.backgroundColor),r?.textColor&&(p.color=r.textColor),r?.padding&&(p.padding=xt(r.padding));const f={textVariants:i,baseFontFamily:d,cardDefaults:r?.defaultStyles?.card,columnsDefaults:r?.defaultStyles?.columns,buttonGroupDefaults:r?.defaultStyles?.buttonGroup,buttonDefaults:r?.defaultStyles?.button},h=mt.createElement(mt.Fragment,null,_.map((e,t)=>mt.createElement("div",{key:e.id||t,style:t>0?{marginTop:`${a}px`}:void 0},mt.createElement(St,{block:e,items:l,defaults:s}))));if("popup"===n&&u){const e=u.overlay,t=e&&e.color?{position:"fixed",inset:0,backgroundColor:e.color,opacity:e.opacity,animation:"pw-popup-overlay 0.2s ease-out backwards"}:void 0,n={...p,maxWidth:"none",margin:0};return mt.createElement(yt.Provider,{value:f},mt.createElement("style",null,Dt),t&&mt.createElement("div",{style:t}),mt.createElement("div",{style:Mt(u,c)},mt.createElement("div",{style:n},h)))}if("popup-preview"===n&&u){const e={...p,maxWidth:"none",margin:0};return mt.createElement(yt.Provider,{value:f},mt.createElement("style",null,Dt),mt.createElement("div",{style:Lt(u,c)},mt.createElement("div",{style:e},h)))}return mt.createElement(yt.Provider,{value:f},mt.createElement("div",{style:p},h))}const Bt=e=>{try{return JSON.parse(e)}catch{return null}},jt="keyValue",Vt="messages",Gt="log",zt="inboxMessages";function qt(e,t){return function(n){n.objectStoreNames.contains(e)||t(n)}}const Zt=[qt(jt,function(e){e.createObjectStore(jt,{keyPath:"key"})}),qt(Gt,function(e){const t=e.createObjectStore(Gt,{keyPath:"id",autoIncrement:!0});t.createIndex("environment","environment",{unique:!1}),t.createIndex("date","date",{unique:!1}),t.createIndex("type","type",{unique:!1})}),qt(Vt,function(e){e.createObjectStore(Vt,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}),qt(zt,function(e){const t="status",n=e.createObjectStore(zt,{keyPath:"inbox_id",autoIncrement:!1});n.createIndex(t,t,{unique:!1,multiEntry:!0}),n.createIndex("rt","rt",{unique:!1,multiEntry:!0})})];class Kt{get all(){return Zt}}class Qt{constructor(e,t=new Kt){this.db=e,this.migrationsBuilder=t}applyMigrations(){this.applyMigrationsPack(this.migrationsBuilder.all)}applyMigrationsPack(e){e.forEach(e=>{e(this.db)})}}function Jt(e,t){console.info("onversionchange",t),e.close()}let Yt;function Xt(e){return(Yt||(Yt=new Promise((e,t)=>{const n=indexedDB.open("PUSHWOOSH_SDK_STORE",7);n.onsuccess=n=>{const o=n.target.result;o.onversionchange=Jt.bind(null,o,t),e(o)},n.onerror=()=>t(n.error),n.onupgradeneeded=e=>{const n=e.target.result;n.onversionchange=Jt.bind(null,n,t),new Qt(n).applyMigrations()}})),Yt).then(t=>new Promise((n,o)=>e(t,n,o)))}class en{_add(e){return Xt((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).add(e);r.onsuccess=()=>{n(e)},r.onerror=()=>{o(r.error)}}).then(e=>this.getAll().then(t=>{if(Array.isArray(t)){const n=t.map(e=>e.id).sort((e,t)=>e==t?0:e<t?1:-1);if(n.length>this.maxItems)return Promise.all(n.slice(this.maxItems).map(e=>this.delete(e))).then(()=>e)}return e}))}delete(e){return Xt((t,n,o)=>{const r=t.transaction([this.name],"readwrite").objectStore(this.name).delete(e);r.onsuccess=()=>{n(r.result)},r.onerror=()=>{o(r.error)}})}getAll(){return Xt((e,t,n)=>{const o=[],r=e.transaction(this.name).objectStore(this.name).openCursor();r.onsuccess=e=>{const n=e.target.result;n?(n.value&&o.push(n.value),n.continue()):t(o)},r.onerror=()=>{n(r.error)}})}}tn=jt;var tn;const nn=new class extends en{constructor(){super(...arguments),this.name=Gt,this.maxItems=100,this.environment="undefined"!=typeof self&&self.registration?"worker":"browser"}add(e,t,n){const o={type:e,environment:this.environment,message:`${t}`,date:new Date};return t instanceof Error&&(o.stack=t.stack),n&&(o.additional=n),this._add(o)}},on=(new class extends en{constructor(){super(...arguments),this.name=Vt,this.maxItems=25}add(e){return this._add({...e,date:new Date})}},{error:1,info:2,debug:3});let rn=3;const un={setLevel(e){on[e]||(e="error"),rn=on[e]},write(e,t,n){return"error"===e?this.error(t):this.info(t),nn.add(e,t,n)}};Object.keys(on).forEach(e=>{const t=on[e];un[e]=(...n)=>{t<=rn&&(console.groupCollapsed(e),console.info("",...n),console.trace("trace"),console.groupEnd())}});class ln{lockBodyScroll(){0===this.openPopupsCount&&(this.bodyOverflowBeforeLock=document.body.style.overflow,document.body.style.overflow="hidden"),this.openPopupsCount+=1}unlockBodyScroll(){this.openPopupsCount=Math.max(0,this.openPopupsCount-1),0===this.openPopupsCount&&null!==this.bodyOverflowBeforeLock&&(document.body.style.overflow=this.bodyOverflowBeforeLock,this.bodyOverflowBeforeLock=null)}constructor(e){this.isRecurringVisitor=!1,this.loadedPopups=new Map,this.pendingTimers=new Map,this.isNavigationSubscribed=!1,this.openPopupsCount=0,this.bodyOverflowBeforeLock=null,this.pw=e}async run(){const{pw:e}=this;this.isRecurringVisitor=await e.data.getIsRecurringVisitor();const t=(e=>{if("object"!=typeof e||null===e)return[];const t=e.popup_forms;return Array.isArray(t)?t:[]})(await e.data.getFeatures());(await Promise.allSettled(t.map(e=>this.loadWebPopup(e)))).forEach((e,n)=>{"rejected"===e.status&&un.error(e.reason,`Failed to load web popup "${t[n].code}"`)}),this.subscribeToNavigation(),this.renderForCurrentPage(),await e.data.setIsRecurringVisitor(!0)}async loadWebPopup(e){if(!await this.checkStrongCondition(e))return;const t=await this.pw.api.getPopupFormContent(e.popup_form_content_code);this.loadedPopups.set(e.code,{popup:e,content:t})}renderForCurrentPage(){this.cancelPendingForUnmatchedPages();const e=[];this.loadedPopups.forEach((t,n)=>{this.checkSoftCondition(t.popup)&&e.push([n,t])}),e.forEach(([e,{popup:t,content:n}])=>{this.addToQueue(t,n),this.loadedPopups.delete(e)})}cancelPendingForUnmatchedPages(){this.pendingTimers.forEach(({timeoutId:e,loaded:t},n)=>{this.checkSoftCondition(t.popup)||(window.clearTimeout(e),this.pendingTimers.delete(n),this.loadedPopups.set(n,t))})}subscribeToNavigation(){if(this.isNavigationSubscribed)return;this.isNavigationSubscribed=!0;const e=()=>this.renderForCurrentPage(),t=window.navigation;if(t&&"function"==typeof t.addEventListener)return void t.addEventListener("currententrychange",e);window.addEventListener("popstate",e),window.addEventListener("hashchange",e);let n=window.location.href;window.setInterval(()=>{window.location.href!==n&&(n=window.location.href,e())},500)}async checkStrongCondition(e){return(await Promise.all([this.checkCanBeShownByDeviceTypeCondition(e),this.checkCanBeShownByFrequencyCondition(e),this.checkCanBeShownByVisitorsTypeCondition(e)])).every(e=>e)}checkSoftCondition(e){return this.checkCanBeShownByMatchingPagesCondition(e)}checkCanBeShownByDeviceTypeCondition(e){const{device_type:t}=e,n=this.pw.platformChecker.formFactor;return"ALL"===t||t===n}async checkCanBeShownByFrequencyCondition(e){const{frequency:t,code:n}=e;if("ONCE"===t){return!(await this.pw.data.getShownWebPopups()).includes(n)}return"ONCE_PER_SESSION"!==t||null===sessionStorage.getItem(this.getSessionStorageKey(n))}checkCanBeShownByMatchingPagesCondition(e){const{matching_pages:t}=e;return!t||(0===t.length||t.includes(window.location.pathname))}checkCanBeShownByVisitorsTypeCondition(e){const{visitors_type:t}=e;return"NEW"===t?!this.isRecurringVisitor:"RECURRING"!==t||this.isRecurringVisitor}async markAsShown(e){this.pw.api.recordPopupFormEvent(e.code,2).catch(t=>{un.error(t,`Failed to record web popup shown event for "${e.code}"`)});const{frequency:t,code:n}=e;"ONCE"!==t?"ONCE_PER_SESSION"===t&&sessionStorage.setItem(this.getSessionStorageKey(n),"1"):await this.pw.data.addShownWebPopup(n)}getSessionStorageKey(e){return`${n}.shown.${e}`}addToQueue(e,t){this.pw.api.recordPopupFormEvent(e.code,1).catch(t=>{un.error(t,`Failed to record web popup queued event for "${e.code}"`)});const o=window.setTimeout(()=>{this.pendingTimers.delete(e.code);const o=document.createElement("div");o.id=`${n}-${e.code}`,o.style.position="fixed",o.style.inset="0",o.style.zIndex=String(2147483647),document.body.appendChild(o);const r=o.attachShadow({mode:"open"}),i=document.createElement("style");i.textContent="\n .close {\n position: fixed;\n top: 16px;\n right: 16px;\n width: 32px;\n height: 32px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: rgba(255, 255, 255, 0.9);\n cursor: pointer;\n font-size: 24px;\n line-height: 1;\n color: #333;\n }\n";const u=document.createElement("button");u.type="button",u.className="close",u.setAttribute("aria-label","Close"),u.textContent="×";const l=document.createElement("div");r.appendChild(i),r.appendChild(l),r.appendChild(u),this.lockBodyScroll();const _=()=>{this.unlockBodyScroll(),o.remove(),this.pw.dispatchEvent("hide-web-popup",{code:e.code})};u.addEventListener("click",_),((e,t)=>{const n=Bt(t.json);if(!n)return;const o=n.settings?.width??600;e.style.width=`${o}px`,e.style.maxWidth="100%",K(ee(Ht,{document:n,mode:"popup"}),e)})(l,t);const a=l.lastElementChild;l.addEventListener("click",e=>{a&&a.contains(e.target)||_()}),this.markAsShown(e).catch(t=>{un.error(t,`Failed to mark web popup "${e.code}" as shown`)}),this.pw.dispatchEvent("show-web-popup",{code:e.code})},1e3*e.delay);this.pendingTimers.set(e.code,{timeoutId:o,loaded:{popup:e,content:t}})}}return t})());
|
|
2
|
+
//# sourceMappingURL=widget-web-popups.js.map
|
|
@@ -0,0 +1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zJ,EAAMgW,SAC9CqM,MAEFhpB,KAAKqoB,YAAY9C,GAAUgD,MAAOvG,IAChC2B,GAAO3B,MAAMA,EAAO,6BAA6BuD,EAASK,oBAE5D5lB,KAAK2kB,GAAGuE,cAAc,iBAAkB,CAAEtD,KAAML,EAASK,QACvC,IAAjBL,EAASgE,OAEZvpB,KAAK8kB,cAActU,IAAI+U,EAASK,KAAM,CACpCa,YACAH,OAAQ,CAAErJ,MAAOsI,EAAUnc,YAE/B","sources":["webpack://web-push-notifications/webpack/universalModuleDefinition","webpack://web-push-notifications/webpack/bootstrap","webpack://web-push-notifications/webpack/runtime/define property getters","webpack://web-push-notifications/webpack/runtime/hasOwnProperty shorthand","webpack://web-push-notifications/webpack/runtime/make namespace object","webpack://web-push-notifications/./src/widgets/WebPopups/constants.ts","webpack://web-push-notifications/./node_modules/preact/dist/preact.module.js","webpack://web-push-notifications/./node_modules/preact/jsx-runtime/dist/jsxRuntime.module.js","webpack://web-push-notifications/./node_modules/preact/hooks/dist/hooks.module.js","webpack://web-push-notifications/./node_modules/preact/compat/dist/compat.module.js","webpack://web-push-notifications/./node_modules/smart-blocks-utils/dist/views/DocumentReader/constants.js","webpack://web-push-notifications/./node_modules/smart-blocks-utils/dist/views/DocumentReader/context.js","webpack://web-push-notifications/./node_modules/smart-blocks-utils/dist/views/DocumentReader/helpers.js","webpack://web-push-notifications/./node_modules/smart-blocks-utils/dist/views/DocumentReader/components.js","webpack://web-push-notifications/./node_modules/smart-blocks-utils/dist/views/DocumentReader/DocumentReader.js","webpack://web-push-notifications/./src/widgets/WebPopups/renderer.tsx","webpack://web-push-notifications/./src/modules/storage/migrations/constants.ts","webpack://web-push-notifications/./src/modules/storage/migrations/helpers.ts","webpack://web-push-notifications/./src/modules/storage/migrations/initial.ts","webpack://web-push-notifications/./src/modules/storage/migrations/Migrations.ts","webpack://web-push-notifications/./src/modules/storage/migrations/MigrationExecutor.ts","webpack://web-push-notifications/./src/core/storage.ts","webpack://web-push-notifications/./src/modules/storage/version.ts","webpack://web-push-notifications/./src/core/logger.ts","webpack://web-push-notifications/./src/widgets/WebPopups/WebPopupsWidget.ts","webpack://web-push-notifications/./src/widgets/WebPopups/helpers.ts"],"sourcesContent":["(function webpackUniversalModuleDefinition(root, factory) {\n\tif(typeof exports === 'object' && typeof module === 'object')\n\t\tmodule.exports = factory();\n\telse if(typeof define === 'function' && define.amd)\n\t\tdefine([], factory);\n\telse {\n\t\tvar a = factory();\n\t\tfor(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];\n\t}\n})(this, () => {\nreturn ","// The require scope\nvar __webpack_require__ = {};\n\n","// define getter functions for harmony exports\n__webpack_require__.d = (exports, definition) => {\n\tfor(var key in definition) {\n\t\tif(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {\n\t\t\tObject.defineProperty(exports, key, { enumerable: true, get: definition[key] });\n\t\t}\n\t}\n};","__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))","// define __esModule on exports\n__webpack_require__.r = (exports) => {\n\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n\t}\n\tObject.defineProperty(exports, '__esModule', { value: true });\n};","export const WEB_POPUPS_WIDGET_NAMESPACE = 'pushwoosh-web-popups';\n\nexport const DEFAULT_DOCUMENT_WIDTH = 600;\n\nexport const POPUP_HOST_Z_INDEX = 2147483647;\n\nexport const POPUP_STYLES = `\n .close {\n position: fixed;\n top: 16px;\n right: 16px;\n width: 32px;\n height: 32px;\n padding: 0;\n border: none;\n border-radius: 50%;\n background: rgba(255, 255, 255, 0.9);\n cursor: pointer;\n font-size: 24px;\n line-height: 1;\n color: #333;\n }\n`;\n","var n,l,u,t,i,r,o,e,f,c,a,s,h,p,v,y,d={},w=[],_=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,g=Array.isArray;function m(n,l){for(var u in l)n[u]=l[u];return n}function b(n){n&&n.parentNode&&n.parentNode.removeChild(n)}function k(l,u,t){var i,r,o,e={};for(o in u)\"key\"==o?i=u[o]:\"ref\"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),\"function\"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps)void 0===e[o]&&(e[o]=l.defaultProps[o]);return x(l,e,i,r,null)}function x(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u:o,__i:-1,__u:0};return null==o&&null!=l.vnode&&l.vnode(e),e}function M(){return{current:null}}function S(n){return n.children}function C(n,l){this.props=n,this.context=l}function $(n,l){if(null==l)return n.__?$(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return\"function\"==typeof n.type?$(n):null}function I(n){if(n.__P&&n.__d){var u=n.__v,t=u.__e,i=[],r=[],o=m({},u);o.__v=u.__v+1,l.vnode&&l.vnode(o),q(n.__P,o,u,n.__n,n.__P.namespaceURI,32&u.__u?[t]:null,i,null==t?$(u):t,!!(32&u.__u),r),o.__v=u.__v,o.__.__k[o.__i]=o,D(i,o,r),u.__e=u.__=null,o.__e!=t&&P(o)}}function P(n){if(null!=(n=n.__)&&null!=n.__c)return n.__e=n.__c.base=null,n.__k.some(function(l){if(null!=l&&null!=l.__e)return n.__e=n.__c.base=l.__e}),P(n)}function A(n){(!n.__d&&(n.__d=!0)&&i.push(n)&&!H.__r++||r!=l.debounceRendering)&&((r=l.debounceRendering)||o)(H)}function H(){try{for(var n,l=1;i.length;)i.length>l&&i.sort(e),n=i.shift(),l=i.length,I(n)}finally{i.length=H.__r=0}}function L(n,l,u,t,i,r,o,e,f,c,a){var s,h,p,v,y,_,g,m=t&&t.__k||w,b=l.length;for(f=T(u,l,m,f,b),s=0;s<b;s++)null!=(p=u.__k[s])&&(h=-1!=p.__i&&m[p.__i]||d,p.__i=s,_=q(n,p,h,i,r,o,e,f,c,a),v=p.__e,p.ref&&h.ref!=p.ref&&(h.ref&&J(h.ref,null,p),a.push(p.ref,p.__c||v,p)),null==y&&null!=v&&(y=v),(g=!!(4&p.__u))||h.__k===p.__k?(f=j(p,f,n,g),g&&h.__e&&(h.__e=null)):\"function\"==typeof p.type&&void 0!==_?f=_:v&&(f=v.nextSibling),p.__u&=-7);return u.__e=y,f}function T(n,l,u,t,i){var r,o,e,f,c,a=u.length,s=a,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&\"boolean\"!=typeof o&&\"function\"!=typeof o?(\"string\"==typeof o||\"number\"==typeof o||\"bigint\"==typeof o||o.constructor==String?o=n.__k[r]=x(null,o,null,null,null):g(o)?o=n.__k[r]=x(S,{children:o},null,null,null):void 0===o.constructor&&o.__b>0?o=n.__k[r]=x(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):n.__k[r]=o,f=r+h,o.__=n,o.__b=n.__b+1,e=null,-1!=(c=o.__i=O(o,u,f,s))&&(s--,(e=u[c])&&(e.__u|=2)),null==e||null==e.__v?(-1==c&&(i>a?h--:i<a&&h++),\"function\"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(s)for(r=0;r<a;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=$(e)),K(e,e));return t}function j(n,l,u,t){var i,r;if(\"function\"==typeof n.type){for(i=n.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=n,l=j(i[r],l,u,t));return l}n.__e!=l&&(t&&(l&&n.type&&!l.parentNode&&(l=$(n)),u.insertBefore(n.__e,l||null)),l=n.__e);do{l=l&&l.nextSibling}while(null!=l&&8==l.nodeType);return l}function F(n,l){return l=l||[],null==n||\"boolean\"==typeof n||(g(n)?n.some(function(n){F(n,l)}):l.push(n)),l}function O(n,l,u,t){var i,r,o,e=n.key,f=n.type,c=l[u],a=null!=c&&0==(2&c.__u);if(null===c&&null==e||a&&e==c.key&&f==c.type)return u;if(t>(a?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;)if(null!=(c=l[o=i>=0?i--:r++])&&0==(2&c.__u)&&e==c.key&&f==c.type)return o;return-1}function z(n,l,u){\"-\"==l[0]?n.setProperty(l,null==u?\"\":u):n[l]=null==u?\"\":\"number\"!=typeof u||_.test(l)?u:u+\"px\"}function N(n,l,u,t,i){var r,o;n:if(\"style\"==l)if(\"string\"==typeof u)n.style.cssText=u;else{if(\"string\"==typeof t&&(n.style.cssText=t=\"\"),t)for(l in t)u&&l in u||z(n.style,l,\"\");if(u)for(l in u)t&&u[l]==t[l]||z(n.style,l,u[l])}else if(\"o\"==l[0]&&\"n\"==l[1])r=l!=(l=l.replace(s,\"$1\")),o=l.toLowerCase(),l=o in n||\"onFocusOut\"==l||\"onFocusIn\"==l?o.slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u[a]=t[a]:(u[a]=h,n.addEventListener(l,r?v:p,r)):n.removeEventListener(l,r?v:p,r);else{if(\"http://www.w3.org/2000/svg\"==i)l=l.replace(/xlink(H|:h)/,\"h\").replace(/sName$/,\"s\");else if(\"width\"!=l&&\"height\"!=l&&\"href\"!=l&&\"list\"!=l&&\"form\"!=l&&\"tabIndex\"!=l&&\"download\"!=l&&\"rowSpan\"!=l&&\"colSpan\"!=l&&\"role\"!=l&&\"popover\"!=l&&l in n)try{n[l]=null==u?\"\":u;break n}catch(n){}\"function\"==typeof u||(null==u||!1===u&&\"-\"!=l[4]?n.removeAttribute(l):n.setAttribute(l,\"popover\"==l&&1==u?\"\":u))}}function V(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u[c])u[c]=h++;else if(u[c]<t[a])return;return t(l.event?l.event(u):u)}}}function q(n,u,t,i,r,o,e,f,c,a){var s,h,p,v,y,d,_,k,x,M,$,I,P,A,H,T=u.type;if(void 0!==u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(s=l.__b)&&s(u);n:if(\"function\"==typeof T)try{if(k=u.props,x=T.prototype&&T.prototype.render,M=(s=T.contextType)&&i[s.__c],$=s?M?M.props.value:s.__:i,t.__c?_=(h=u.__c=t.__c).__=h.__E:(x?u.__c=h=new T(k,$):(u.__c=h=new C(k,$),h.constructor=T,h.render=Q),M&&M.sub(h),h.state||(h.state={}),h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),x&&null==h.__s&&(h.__s=h.state),x&&null!=T.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=m({},h.__s)),m(h.__s,T.getDerivedStateFromProps(k,h.__s))),v=h.props,y=h.state,h.__v=u,p)x&&null==T.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),x&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else{if(x&&null==T.getDerivedStateFromProps&&k!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(k,$),u.__v==t.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(k,h.__s,$)){u.__v!=t.__v&&(h.props=k,h.state=h.__s,h.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u)}),w.push.apply(h.__h,h._sb),h._sb=[],h.__h.length&&e.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(k,h.__s,$),x&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,y,d)})}if(h.context=$,h.props=k,h.__P=n,h.__e=!1,I=l.__r,P=0,x)h.state=h.__s,h.__d=!1,I&&I(u),s=h.render(h.props,h.state,h.context),w.push.apply(h.__h,h._sb),h._sb=[];else do{h.__d=!1,I&&I(u),s=h.render(h.props,h.state,h.context),h.state=h.__s}while(h.__d&&++P<25);h.state=h.__s,null!=h.getChildContext&&(i=m(m({},i),h.getChildContext())),x&&!p&&null!=h.getSnapshotBeforeUpdate&&(d=h.getSnapshotBeforeUpdate(v,y)),A=null!=s&&s.type===S&&null==s.key?E(s.props.children):s,f=L(n,g(A)?A:[A],u,t,i,r,o,e,f,c,a),h.base=u.__e,u.__u&=-161,h.__h.length&&e.push(h),_&&(h.__E=h.__=null)}catch(n){if(u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,u.__e=f}else{for(H=o.length;H--;)b(o[H]);B(u)}else u.__e=t.__e,u.__k=t.__k,n.then||B(u);l.__e(n,u,t)}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=G(t.__e,u,t,i,r,o,e,c,a);return(s=l.diffed)&&s(u),128&u.__u?void 0:f}function B(n){n&&(n.__c&&(n.__c.__e=!0),n.__k&&n.__k.some(B))}function D(n,u,t){for(var i=0;i<t.length;i++)J(t[i],t[++i],t[++i]);l.__c&&l.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u)})}catch(n){l.__e(n,u.__v)}})}function E(n){return\"object\"!=typeof n||null==n||n.__b>0?n:g(n)?n.map(E):void 0!==n.constructor?null:m({},n)}function G(u,t,i,r,o,e,f,c,a){var s,h,p,v,y,w,_,m=i.props||d,k=t.props,x=t.type;if(\"svg\"==x?o=\"http://www.w3.org/2000/svg\":\"math\"==x?o=\"http://www.w3.org/1998/Math/MathML\":o||(o=\"http://www.w3.org/1999/xhtml\"),null!=e)for(s=0;s<e.length;s++)if((y=e[s])&&\"setAttribute\"in y==!!x&&(x?y.localName==x:3==y.nodeType)){u=y,e[s]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l.__m&&l.__m(t,e),c=!1),e=null}if(null==x)m===k||c&&u.data==k||(u.data=k);else{if(e=\"textarea\"==x&&null!=k.defaultValue?null:e&&n.call(u.childNodes),!c&&null!=e)for(m={},s=0;s<u.attributes.length;s++)m[(y=u.attributes[s]).name]=y.value;for(s in m)y=m[s],\"dangerouslySetInnerHTML\"==s?p=y:\"children\"==s||s in k||\"value\"==s&&\"defaultValue\"in k||\"checked\"==s&&\"defaultChecked\"in k||N(u,s,null,y,o);for(s in k)y=k[s],\"children\"==s?v=y:\"dangerouslySetInnerHTML\"==s?h=y:\"value\"==s?w=y:\"checked\"==s?_=y:c&&\"function\"!=typeof y||m[s]===y||N(u,s,y,m[s],o);if(h)c||p&&(h.__html==p.__html||h.__html==u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(p&&(u.innerHTML=\"\"),L(\"template\"==t.type?u.content:u,g(v)?v:[v],t,i,r,\"foreignObject\"==x?\"http://www.w3.org/1999/xhtml\":o,e,f,e?e[0]:i.__k&&$(i,0),c,a),null!=e)for(s=e.length;s--;)b(e[s]);c&&\"textarea\"!=x||(s=\"value\",\"progress\"==x&&null==w?u.removeAttribute(\"value\"):null!=w&&(w!==u[s]||\"progress\"==x&&!w||\"option\"==x&&w!=m[s])&&N(u,s,w,m[s],o),s=\"checked\",null!=_&&_!=u[s]&&N(u,s,_,m[s],o))}return u}function J(n,u,t){try{if(\"function\"==typeof n){var i=\"function\"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u))}else n.current=u}catch(n){l.__e(n,t)}}function K(n,u,t){var i,r;if(l.unmount&&l.unmount(n),(i=n.ref)&&(i.current&&i.current!=n.__e||J(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount()}catch(n){l.__e(n,u)}i.base=i.__P=null}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&K(i[r],u,t||\"function\"!=typeof n.type);t||b(n.__e),n.__c=n.__=n.__e=void 0}function Q(n,l,u){return this.constructor(n,u)}function R(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l.__&&l.__(u,t),o=(r=\"function\"==typeof i)?null:i&&i.__k||t.__k,e=[],f=[],q(t,u=(!r&&i||t).__k=k(S,null,[u]),o||d,d,t.namespaceURI,!r&&i?[i]:o?null:t.firstChild?n.call(t.childNodes):null,e,!r&&i?i:o?o.__e:t.firstChild,r,f),D(e,u,f)}function U(n,l){R(n,l,U)}function W(l,u,t){var i,r,o,e,f=m({},l.props);for(o in l.type&&l.type.defaultProps&&(e=l.type.defaultProps),u)\"key\"==o?i=u[o]:\"ref\"==o?r=u[o]:f[o]=void 0===u[o]&&null!=e?e[o]:u[o];return arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):t),x(l.type,f,i||l.key,r||l.ref,null)}function X(n){function l(n){var u,t;return this.getChildContext||(u=new Set,(t={})[l.__c]=this,this.getChildContext=function(){return t},this.componentWillUnmount=function(){u=null},this.shouldComponentUpdate=function(n){this.props.value!=n.value&&u.forEach(function(n){n.__e=!0,A(n)})},this.sub=function(n){u.add(n);var l=n.componentWillUnmount;n.componentWillUnmount=function(){u&&u.delete(n),l&&l.call(n)}}),n.children}return l.__c=\"__cC\"+y++,l.__=n,l.Provider=l.__l=(l.Consumer=function(n,l){return n.children(l)}).contextType=l,l}n=w.slice,l={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l}throw n}},u=0,t=function(n){return null!=n&&void 0===n.constructor},C.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=m({},this.state),\"function\"==typeof n&&(n=n(m({},u),this.props)),n&&m(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),A(this))},C.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),A(this))},C.prototype.render=S,i=[],o=\"function\"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e=function(n,l){return n.__v.__b-l.__v.__b},H.__r=0,f=Math.random().toString(8),c=\"__d\"+f,a=\"__a\"+f,s=/(PointerCapture)$|Capture$/i,h=0,p=V(!1),v=V(!0),y=0;export{C as Component,S as Fragment,W as cloneElement,X as createContext,k as createElement,M as createRef,k as h,U as hydrate,t as isValidElement,l as options,R as render,F as toChildArray};\n//# sourceMappingURL=preact.module.js.map\n","import{options as r,Fragment as e}from\"preact\";export{Fragment}from\"preact\";var t=/[\"&<]/;function n(r){if(0===r.length||!1===t.test(r))return r;for(var e=0,n=0,o=\"\",f=\"\";n<r.length;n++){switch(r.charCodeAt(n)){case 34:f=\""\";break;case 38:f=\"&\";break;case 60:f=\"<\";break;default:continue}n!==e&&(o+=r.slice(e,n)),o+=f,e=n+1}return n!==e&&(o+=r.slice(e,n)),o}var o=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,f=0,i=Array.isArray;function u(e,t,n,o,i,u){t||(t={});var a,c,p=t;if(\"ref\"in p)for(c in p={},t)\"ref\"==c?a=t[c]:p[c]=t[c];var l={type:e,props:p,key:n,ref:a,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:--f,__i:-1,__u:0,__source:i,__self:u};if(\"function\"==typeof e&&(a=e.defaultProps))for(c in a)void 0===p[c]&&(p[c]=a[c]);return r.vnode&&r.vnode(l),l}function a(r){var t=u(e,{tpl:r,exprs:[].slice.call(arguments,1)});return t.key=t.__v,t}var c={},p=/[A-Z]/g;function l(e,t){if(r.attr){var f=r.attr(e,t);if(\"string\"==typeof f)return f}if(t=function(r){return null!==r&&\"object\"==typeof r&&\"function\"==typeof r.valueOf?r.valueOf():r}(t),\"ref\"===e||\"key\"===e)return\"\";if(\"style\"===e&&\"object\"==typeof t){var i=\"\";for(var u in t){var a=t[u];if(null!=a&&\"\"!==a){var l=\"-\"==u[0]?u:c[u]||(c[u]=u.replace(p,\"-$&\").toLowerCase()),s=\";\";\"number\"!=typeof a||l.startsWith(\"--\")||o.test(l)||(s=\"px;\"),i=i+l+\":\"+a+s}}return e+'=\"'+n(i)+'\"'}return null==t||!1===t||\"function\"==typeof t||\"object\"==typeof t?\"\":!0===t?e:e+'=\"'+n(\"\"+t)+'\"'}function s(r){if(null==r||\"boolean\"==typeof r||\"function\"==typeof r)return null;if(\"object\"==typeof r){if(void 0===r.constructor)return r;if(i(r)){for(var e=0;e<r.length;e++)r[e]=s(r[e]);return r}}return n(\"\"+r)}export{u as jsx,l as jsxAttr,u as jsxDEV,s as jsxEscape,a as jsxTemplate,u as jsxs};\n//# sourceMappingURL=jsxRuntime.module.js.map\n","import{options as n}from\"preact\";var t,r,u,i,o=0,f=[],c=n,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,s=c.__;function p(n,t){c.__h&&c.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function d(n){return o=1,h(D,n)}function h(n,u,i){var o=p(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}))}],o.__c=r,!r.__f)){var f=function(n,t,r){if(!o.__c.__H)return!0;var u=o.__c.__H.__.filter(function(n){return n.__c});if(u.every(function(n){return!n.__N}))return!c||c.call(this,n,t,r);var i=o.__c.props!==n;return u.some(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0)}}),c&&c.call(this,n,t,r)||i};r.__f=!0;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u}e&&e.call(this,n,t,r)},r.shouldComponentUpdate=f}return o.__N||o.__}function y(n,u){var i=p(t++,3);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__H.__h.push(i))}function _(n,u){var i=p(t++,4);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__h.push(i))}function A(n){return o=5,T(function(){return{current:n}},[])}function F(n,t,r){o=6,_(function(){if(\"function\"==typeof n){var r=n(t());return function(){n(null),r&&\"function\"==typeof r&&r()}}if(n)return n.current=t(),function(){return n.current=null}},null==r?r:r.concat(n))}function T(n,r){var u=p(t++,7);return C(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function q(n,t){return o=8,T(function(){return n},t)}function x(n){var u=r.context[n.__c],i=p(t++,9);return i.c=n,u?(null==i.__&&(i.__=!0,u.sub(r)),u.props.value):n.__}function P(n,t){c.useDebugValue&&c.useDebugValue(t?t(n):n)}function b(n){var u=p(t++,10),i=d();return u.__=n,r.componentDidCatch||(r.componentDidCatch=function(n,t){u.__&&u.__(n,t),i[1](n)}),[i[0],function(){i[1](void 0)}]}function g(){var n=p(t++,11);if(!n.__){for(var u=r.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;var i=u.__m||(u.__m=[0,0]);n.__=\"P\"+i[0]+\"-\"+i[1]++}return n.__}function j(){for(var n;n=f.shift();){var t=n.__H;if(n.__P&&t)try{t.__h.some(z),t.__h.some(B),t.__h=[]}catch(r){t.__h=[],c.__e(r,n.__v)}}}c.__b=function(n){r=null,e&&e(n)},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),s&&s(n,t)},c.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.some(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0})):(i.__h.some(z),i.__h.some(B),i.__h=[],t=0)),u=r},c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w)(j)),t.__H.__.some(function(n){n.u&&(n.__H=n.u),n.u=void 0})),u=r=null},c.__c=function(n,t){t.some(function(n){try{n.__h.some(z),n.__h=n.__h.filter(function(n){return!n.__||B(n)})}catch(r){t.some(function(n){n.__h&&(n.__h=[])}),t=[],c.__e(r,n.__v)}}),l&&l(n,t)},c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.some(function(n){try{z(n)}catch(n){t=n}}),r.__H=void 0,t&&c.__e(t,r.__v))};var k=\"function\"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n)},u=setTimeout(r,35);k&&(t=requestAnimationFrame(r))}function z(n){var t=r,u=n.__c;\"function\"==typeof u&&(n.__c=void 0,u()),r=t}function B(n){var t=r;n.__c=n.__(),r=t}function C(n,t){return!n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return\"function\"==typeof t?t(n):t}export{q as useCallback,x as useContext,P as useDebugValue,y as useEffect,b as useErrorBoundary,g as useId,F as useImperativeHandle,_ as useLayoutEffect,T as useMemo,h as useReducer,A as useRef,d as useState};\n//# sourceMappingURL=hooks.module.js.map\n","import{Component as n,createElement as t,options as e,toChildArray as r,Fragment as u,render as o,hydrate as i,createContext as l,createRef as c,cloneElement as f}from\"preact\";export{Component,Fragment,Fragment as StrictMode,createContext,createElement,createRef}from\"preact\";import{useState as a,useLayoutEffect as s,useEffect as h,useCallback as v,useContext as d,useDebugValue as m,useId as p,useImperativeHandle as y,useMemo as _,useReducer as b,useRef as S}from\"preact/hooks\";export*from\"preact/hooks\";function g(n,t){for(var e in t)n[e]=t[e];return n}function E(n,t){for(var e in n)if(\"__source\"!==e&&!(e in t))return!0;for(var r in t)if(\"__source\"!==r&&n[r]!==t[r])return!0;return!1}function C(n,t){var e=t(),r=a({t:{__:e,u:t}}),u=r[0].t,o=r[1];return s(function(){u.__=e,u.u=t,R(u)&&o({t:u})},[n,e,t]),h(function(){return R(u)&&o({t:u}),n(function(){R(u)&&o({t:u})})},[n]),e}function R(n){try{return!((t=n.__)===(e=n.u())&&(0!==t||1/t==1/e)||t!=t&&e!=e)}catch(n){return!0}var t,e}function x(n){n()}function w(n){return n}function k(){return[!1,x]}var I=s;function M(n,t){this.props=n,this.context=t}function N(n,e){function r(n){var t=this.props.ref;return t!=n.ref&&t&&(\"function\"==typeof t?t(null):t.current=null),e?!e(this.props,n)||t!=n.ref:E(this.props,n)}function u(e){return this.shouldComponentUpdate=r,t(n,e)}return u.displayName=\"Memo(\"+(n.displayName||n.name)+\")\",u.__f=u.prototype.isReactComponent=!0,u.type=n,u}(M.prototype=new n).isPureReactComponent=!0,M.prototype.shouldComponentUpdate=function(n,t){return E(this.props,n)||E(this.state,t)};var T=e.__b;e.__b=function(n){n.type&&n.type.__f&&n.ref&&(n.props.ref=n.ref,n.ref=null),T&&T(n)};var A=\"undefined\"!=typeof Symbol&&Symbol.for&&Symbol.for(\"react.forward_ref\")||3911;function D(n){function t(t){var e=g({},t);return delete e.ref,n(e,t.ref||null)}return t.$$typeof=A,t.render=n,t.prototype.isReactComponent=t.__f=!0,t.displayName=\"ForwardRef(\"+(n.displayName||n.name)+\")\",t}var F=function(n,t){return null==n?null:r(r(n).map(t))},L={map:F,forEach:F,count:function(n){return n?r(n).length:0},only:function(n){var t=r(n);if(1!==t.length)throw\"Children.only\";return t[0]},toArray:r},O=e.__e;e.__e=function(n,t,e,r){if(n.then)for(var u,o=t;o=o.__;)if((u=o.__c)&&u.__c)return null==t.__e&&(t.__e=e.__e,t.__k=e.__k),u.__c(n,t);O(n,t,e,r)};var U=e.unmount;function V(n,t,e){return n&&(n.__c&&n.__c.__H&&(n.__c.__H.__.forEach(function(n){\"function\"==typeof n.__c&&n.__c()}),n.__c.__H=null),null!=(n=g({},n)).__c&&(n.__c.__P===e&&(n.__c.__P=t),n.__c.__e=!0,n.__c=null),n.__k=n.__k&&n.__k.map(function(n){return V(n,t,e)})),n}function W(n,t,e){return n&&e&&(n.__v=null,n.__k=n.__k&&n.__k.map(function(n){return W(n,t,e)}),n.__c&&n.__c.__P===t&&(n.__e&&e.appendChild(n.__e),n.__c.__e=!0,n.__c.__P=e)),n}function P(){this.__u=0,this.o=null,this.__b=null}function j(n){var t=n.__&&n.__.__c;return t&&t.__a&&t.__a(n)}function z(n){var e,r,u,o=null;function i(i){if(e||(e=n()).then(function(n){n&&(o=n.default||n),u=!0},function(n){r=n,u=!0}),r)throw r;if(!u)throw e;return o?t(o,i):null}return i.displayName=\"Lazy\",i.__f=!0,i}function B(){this.i=null,this.l=null}e.unmount=function(n){var t=n.__c;t&&(t.__z=!0),t&&t.__R&&t.__R(),t&&32&n.__u&&(n.type=null),U&&U(n)},(P.prototype=new n).__c=function(n,t){var e=t.__c,r=this;null==r.o&&(r.o=[]),r.o.push(e);var u=j(r.__v),o=!1,i=function(){o||r.__z||(o=!0,e.__R=null,u?u(c):c())};e.__R=i;var l=e.__P;e.__P=null;var c=function(){if(!--r.__u){if(r.state.__a){var n=r.state.__a;r.__v.__k[0]=W(n,n.__c.__P,n.__c.__O)}var t;for(r.setState({__a:r.__b=null});t=r.o.pop();)t.__P=l,t.forceUpdate()}};r.__u++||32&t.__u||r.setState({__a:r.__b=r.__v.__k[0]}),n.then(i,i)},P.prototype.componentWillUnmount=function(){this.o=[]},P.prototype.render=function(n,e){if(this.__b){if(this.__v.__k){var r=document.createElement(\"div\"),o=this.__v.__k[0].__c;this.__v.__k[0]=V(this.__b,r,o.__O=o.__P)}this.__b=null}var i=e.__a&&t(u,null,n.fallback);return i&&(i.__u&=-33),[t(u,null,e.__a?null:n.children),i]};var H=function(n,t,e){if(++e[1]===e[0]&&n.l.delete(t),n.props.revealOrder&&(\"t\"!==n.props.revealOrder[0]||!n.l.size))for(e=n.i;e;){for(;e.length>3;)e.pop()();if(e[1]<e[0])break;n.i=e=e[2]}};function Z(n){return this.getChildContext=function(){return n.context},n.children}function Y(n){var e=this,r=n.h;if(e.componentWillUnmount=function(){o(null,e.v),e.v=null,e.h=null},e.h&&e.h!==r&&e.componentWillUnmount(),!e.v){for(var u=e.__v;null!==u&&!u.__m&&null!==u.__;)u=u.__;e.h=r,e.v={nodeType:1,parentNode:r,childNodes:[],__k:{__m:u.__m},contains:function(){return!0},namespaceURI:r.namespaceURI,insertBefore:function(n,t){this.childNodes.push(n),e.h.insertBefore(n,t)},removeChild:function(n){this.childNodes.splice(this.childNodes.indexOf(n)>>>1,1),e.h.removeChild(n)}}}o(t(Z,{context:e.context},n.__v),e.v)}function $(n,e){var r=t(Y,{__v:n,h:e});return r.containerInfo=e,r}(B.prototype=new n).__a=function(n){var t=this,e=j(t.__v),r=t.l.get(n);return r[0]++,function(u){var o=function(){t.props.revealOrder?(r.push(u),H(t,n,r)):u()};e?e(o):o()}},B.prototype.render=function(n){this.i=null,this.l=new Map;var t=r(n.children);n.revealOrder&&\"b\"===n.revealOrder[0]&&t.reverse();for(var e=t.length;e--;)this.l.set(t[e],this.i=[1,0,this.i]);return n.children},B.prototype.componentDidUpdate=B.prototype.componentDidMount=function(){var n=this;this.l.forEach(function(t,e){H(n,e,t)})};var q=\"undefined\"!=typeof Symbol&&Symbol.for&&Symbol.for(\"react.element\")||60103,G=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|dominant|fill|flood|font|glyph(?!R)|horiz|image(!S)|letter|lighting|marker(?!H|W|U)|overline|paint|pointer|shape|stop|strikethrough|stroke|text(?!L)|transform|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/,J=/^on(Ani|Tra|Tou|BeforeInp|Compo)/,K=/[A-Z0-9]/g,Q=\"undefined\"!=typeof document,X=function(n){return(\"undefined\"!=typeof Symbol&&\"symbol\"==typeof Symbol()?/fil|che|rad/:/fil|che|ra/).test(n)};function nn(n,t,e){return null==t.__k&&(t.textContent=\"\"),o(n,t),\"function\"==typeof e&&e(),n?n.__c:null}function tn(n,t,e){return i(n,t),\"function\"==typeof e&&e(),n?n.__c:null}n.prototype.isReactComponent=!0,[\"componentWillMount\",\"componentWillReceiveProps\",\"componentWillUpdate\"].forEach(function(t){Object.defineProperty(n.prototype,t,{configurable:!0,get:function(){return this[\"UNSAFE_\"+t]},set:function(n){Object.defineProperty(this,t,{configurable:!0,writable:!0,value:n})}})});var en=e.event;e.event=function(n){return en&&(n=en(n)),n.persist=function(){},n.isPropagationStopped=function(){return this.cancelBubble},n.isDefaultPrevented=function(){return this.defaultPrevented},n.nativeEvent=n};var rn,un={configurable:!0,get:function(){return this.class}},on=e.vnode;e.vnode=function(n){\"string\"==typeof n.type&&function(n){var t=n.props,e=n.type,u={},o=-1==e.indexOf(\"-\");for(var i in t){var l=t[i];if(!(\"value\"===i&&\"defaultValue\"in t&&null==l||Q&&\"children\"===i&&\"noscript\"===e||\"class\"===i||\"className\"===i)){var c=i.toLowerCase();\"defaultValue\"===i&&\"value\"in t&&null==t.value?i=\"value\":\"download\"===i&&!0===l?l=\"\":\"translate\"===c&&\"no\"===l?l=!1:\"o\"===c[0]&&\"n\"===c[1]?\"ondoubleclick\"===c?i=\"ondblclick\":\"onchange\"!==c||\"input\"!==e&&\"textarea\"!==e||X(t.type)?\"onfocus\"===c?i=\"onfocusin\":\"onblur\"===c?i=\"onfocusout\":J.test(i)&&(i=c):c=i=\"oninput\":o&&G.test(i)?i=i.replace(K,\"-$&\").toLowerCase():null===l&&(l=void 0),\"oninput\"===c&&u[i=c]&&(i=\"oninputCapture\"),u[i]=l}}\"select\"==e&&(u.multiple&&Array.isArray(u.value)&&(u.value=r(t.children).forEach(function(n){n.props.selected=-1!=u.value.indexOf(n.props.value)})),null!=u.defaultValue&&(u.value=r(t.children).forEach(function(n){n.props.selected=u.multiple?-1!=u.defaultValue.indexOf(n.props.value):u.defaultValue==n.props.value}))),t.class&&!t.className?(u.class=t.class,Object.defineProperty(u,\"className\",un)):t.className&&(u.class=u.className=t.className),n.props=u}(n),n.$$typeof=q,on&&on(n)};var ln=e.__r;e.__r=function(n){ln&&ln(n),rn=n.__c};var cn=e.diffed;e.diffed=function(n){cn&&cn(n);var t=n.props,e=n.__e;null!=e&&\"textarea\"===n.type&&\"value\"in t&&t.value!==e.value&&(e.value=null==t.value?\"\":t.value),rn=null};var fn={ReactCurrentDispatcher:{current:{readContext:function(n){return rn.__n[n.__c].props.value},useCallback:v,useContext:d,useDebugValue:m,useDeferredValue:w,useEffect:h,useId:p,useImperativeHandle:y,useInsertionEffect:I,useLayoutEffect:s,useMemo:_,useReducer:b,useRef:S,useState:a,useSyncExternalStore:C,useTransition:k}}},an=\"18.3.1\";function sn(n){return t.bind(null,n)}function hn(n){return!!n&&n.$$typeof===q}function vn(n){return hn(n)&&n.type===u}function dn(n){return!!n&&\"string\"==typeof n.displayName&&0==n.displayName.indexOf(\"Memo(\")}function mn(n){return hn(n)?f.apply(null,arguments):n}function pn(n){return!!n.__k&&(o(null,n),!0)}function yn(n){return n&&(n.base||1===n.nodeType&&n)||null}var _n=function(n,t){return n(t)},bn=function(n,t){var r=e.debounceRendering;e.debounceRendering=function(n){return n()};var u=n(t);return e.debounceRendering=r,u},Sn=hn,gn={useState:a,useId:p,useReducer:b,useEffect:h,useLayoutEffect:s,useInsertionEffect:I,useTransition:k,useDeferredValue:w,useSyncExternalStore:C,startTransition:x,useRef:S,useImperativeHandle:y,useMemo:_,useCallback:v,useContext:d,useDebugValue:m,version:\"18.3.1\",Children:L,render:nn,hydrate:tn,unmountComponentAtNode:pn,createPortal:$,createElement:t,createContext:l,createFactory:sn,cloneElement:mn,createRef:c,Fragment:u,isValidElement:hn,isElement:Sn,isFragment:vn,isMemo:dn,findDOMNode:yn,Component:n,PureComponent:M,memo:N,forwardRef:D,flushSync:bn,unstable_batchedUpdates:_n,StrictMode:u,Suspense:P,SuspenseList:B,lazy:z,__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED:fn};export{L as Children,M as PureComponent,P as Suspense,B as SuspenseList,fn as __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,mn as cloneElement,sn as createFactory,$ as createPortal,gn as default,yn as findDOMNode,bn as flushSync,D as forwardRef,tn as hydrate,Sn as isElement,vn as isFragment,dn as isMemo,hn as isValidElement,z as lazy,N as memo,nn as render,x as startTransition,pn as unmountComponentAtNode,_n as unstable_batchedUpdates,w as useDeferredValue,I as useInsertionEffect,C as useSyncExternalStore,k as useTransition,an as version};\n//# sourceMappingURL=compat.module.js.map\n","export const FONT_STACK = '-apple-system,BlinkMacSystemFont,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif';\nexport const DEFAULT_BLOCK_GAP = 16;\nexport const DEFAULT_CONTAINER_WIDTH = 600;\nexport const DEFAULT_SIDE_IMAGE_WIDTH = 200;\nexport const SAFE_URL_PROTOCOL = /^(https?:|mailto:|tel:)/i;\nexport const BUTTON_GROUP_ALIGN_UNSPECIFIED = 'BUTTON_GROUP_ALIGN_UNSPECIFIED';\nexport const CARD_IMAGE_FIT_UNSPECIFIED = 'CARD_IMAGE_FIT_UNSPECIFIED';\nexport const CARD_IMAGE_SIZE_UNIT_UNSPECIFIED = 'CARD_IMAGE_SIZE_UNIT_UNSPECIFIED';\nexport const ZERO_EDGE_INSETS = { top: 0, right: 0, bottom: 0, left: 0 };\nexport const DEFAULT_META = { templateName: '' };\nexport const DEFAULT_EMAIL_SETTINGS = {};\nexport const DEFAULT_POPUP_SETTINGS = {\n borderRadius: 0,\n boxShadow: '',\n animation: 'POPUP_ANIMATION_UNSPECIFIED',\n};\nexport const DEFAULT_EDGE_INSETS = { top: 16, right: 16, bottom: 16, left: 16 };\nexport const DEFAULT_BLOCK_STYLES = {\n backgroundColor: '#ffffff',\n borderColor: '#e0e0e0',\n};\nexport const DEFAULT_COLUMNS_GAP = 16;\nexport const DEFAULT_BUTTON_GROUP_GAP = 8;\nexport const DEFAULT_BUTTON_GROUP_STYLES = {\n padding: { top: 8, right: 0, bottom: 8, left: 0 },\n backgroundColor: '',\n gap: DEFAULT_BUTTON_GROUP_GAP,\n};\nexport const DEFAULT_BUTTON_STYLES = {\n backgroundColor: '#111827',\n textColor: '#ffffff',\n borderRadius: 6,\n fontSize: 14,\n};\nexport const DEFAULT_TEXT_VARIANTS = {\n normal: { fontSize: 14, fontWeight: 400, lineHeight: 1.5 },\n small: { fontSize: 12, fontWeight: 400, lineHeight: 1.5 },\n large: { fontSize: 18, fontWeight: 400, lineHeight: 1.5 },\n h4: { fontSize: 16, fontWeight: 600, lineHeight: 1.4 },\n h3: { fontSize: 18, fontWeight: 600, lineHeight: 1.4 },\n h2: { fontSize: 20, fontWeight: 600, lineHeight: 1.4 },\n h1: { fontSize: 24, fontWeight: 700, lineHeight: 1.3 },\n title: { fontSize: 28, fontWeight: 600, lineHeight: 1.3 },\n display: { fontSize: 36, fontWeight: 700, lineHeight: 1.2 },\n monster: { fontSize: 48, fontWeight: 700, lineHeight: 1.1 },\n};\nexport const DEFAULT_COLOR_SCHEME = {\n background: { color: '#FFFFFF', description: 'Background' },\n surface: { color: '#F0F1F5', description: 'Surface' },\n border: { color: '#DCE1E5', description: 'Border' },\n text: { color: '#10162F', description: 'Text' },\n 'text-secondary': { color: '#5C6270', description: 'Text secondary' },\n 'text-disabled': { color: '#A8ADB8', description: 'Text disabled' },\n 'text-on-accent': { color: '#FFFFFF', description: 'Text on accent' },\n accent: { color: '#3735BC', description: 'Accent' },\n 'accent-hover': { color: '#2A289A', description: 'Accent hover' },\n link: { color: '#1F6FEB', description: 'Link' },\n success: { color: '#16A34A', description: 'Success' },\n warning: { color: '#F59E0B', description: 'Warning' },\n error: { color: '#E52E59', description: 'Error' },\n};\nexport const DEFAULT_PAGE_ID = 'page-1';\n","import { createContext } from 'react';\nexport const ReaderContext = createContext({ textVariants: {} });\n","import { CARD_IMAGE_SIZE_UNIT_UNSPECIFIED, SAFE_URL_PROTOCOL } from './constants';\nexport function blockStylesToStyle(styles) {\n if (!styles)\n return undefined;\n const s = {};\n if (styles.backgroundColor)\n s.backgroundColor = styles.backgroundColor;\n if (styles.borderColor && styles.borderWidth) {\n s.border = `${styles.borderWidth}px solid ${styles.borderColor}`;\n }\n if (styles.borderRadius)\n s.borderRadius = `${styles.borderRadius}px`;\n return Object.keys(s).length ? s : undefined;\n}\nexport function safeUrl(url) {\n const trimmed = (url || '').trim();\n if (!trimmed)\n return undefined;\n if (trimmed.startsWith('#') || trimmed.startsWith('/') || trimmed.startsWith('?'))\n return trimmed;\n if (SAFE_URL_PROTOCOL.test(trimmed))\n return trimmed;\n return undefined;\n}\nexport function cardImageObjectFit(fit) {\n if (fit === 'CARD_IMAGE_FIT_COVER')\n return 'cover';\n if (fit === 'CARD_IMAGE_FIT_CONTAIN')\n return 'contain';\n if (fit === 'CARD_IMAGE_FIT_FILL')\n return 'fill';\n return undefined;\n}\nexport function isValidImageSize(size) {\n return !!size && size.value > 0 && size.unit !== CARD_IMAGE_SIZE_UNIT_UNSPECIFIED;\n}\nexport function isPercentImageSize(size) {\n return isValidImageSize(size) && size.unit === 'CARD_IMAGE_SIZE_UNIT_PERCENT';\n}\nexport function cardImageSizeToCss(size) {\n if (!isValidImageSize(size))\n return undefined;\n return size.unit === 'CARD_IMAGE_SIZE_UNIT_PERCENT' ? `${size.value}%` : `${size.value}px`;\n}\nexport function cardImagePositionToCss(pos) {\n return `${pos?.x ?? 50}% ${pos?.y ?? 50}%`;\n}\nexport function cardImageHeightStyle(size) {\n if (!isValidImageSize(size))\n return {};\n if (isPercentImageSize(size)) {\n return { width: '100%', height: 'auto', aspectRatio: `100 / ${size.value}` };\n }\n return { width: '100%', height: `${size.value}px` };\n}\nexport function buttonGroupAlignToJustify(align) {\n if (align === 'BUTTON_GROUP_ALIGN_CENTER')\n return 'center';\n if (align === 'BUTTON_GROUP_ALIGN_RIGHT')\n return 'flex-end';\n return 'flex-start';\n}\nexport function edgeInsetsToCss(insets) {\n if (insets.top === insets.right && insets.right === insets.bottom && insets.bottom === insets.left) {\n return `${insets.top}px`;\n }\n if (insets.top === insets.bottom && insets.left === insets.right) {\n return `${insets.top}px ${insets.right}px`;\n }\n return `${insets.top}px ${insets.right}px ${insets.bottom}px ${insets.left}px`;\n}\nexport function resolveVariantStyle(textVariants, variant) {\n return textVariants[variant] ?? { fontSize: 14, fontWeight: 400, lineHeight: 1.5 };\n}\nexport function variantToReactStyle(textVariants, variant, baseFontFamily) {\n const s = resolveVariantStyle(textVariants, variant);\n const result = { fontSize: `${s.fontSize}px` };\n if (s.fontWeight !== 400)\n result.fontWeight = s.fontWeight;\n if (s.lineHeight !== 1.5)\n result.lineHeight = s.lineHeight;\n const fontFamily = s.fontFamily || baseFontFamily;\n if (fontFamily)\n result.fontFamily = fontFamily;\n return result;\n}\nexport function variantToCssString(textVariants, variant, baseFontFamily) {\n const s = resolveVariantStyle(textVariants, variant);\n let css = `font-size:${s.fontSize}px;line-height:${s.lineHeight};`;\n if (s.fontWeight !== 400)\n css += `font-weight:${s.fontWeight};`;\n const fontFamily = s.fontFamily || baseFontFamily;\n if (fontFamily)\n css += `font-family:${fontFamily};`;\n return css;\n}\nexport function createDefaultContentButton() {\n return {\n text: 'Button',\n url: '',\n styles: {},\n };\n}\nexport function createDefaultContentButtonGroup() {\n return {\n itemType: 'buttonGroup',\n buttons: [createDefaultContentButton()],\n styles: {},\n };\n}\nexport function contentBodyStyle(body) {\n const style = {};\n if (body.margin)\n style.margin = edgeInsetsToCss(body.margin);\n if (body.padding)\n style.padding = edgeInsetsToCss(body.padding);\n return style;\n}\nexport function topLevelOf(items) {\n return items.filter((b) => !b.parentId);\n}\nexport function childrenOf(items, parentId) {\n return items.filter((b) => b.parentId === parentId);\n}\n","import React, { useContext } from 'react';\nimport { DEFAULT_BUTTON_GROUP_GAP, DEFAULT_COLUMNS_GAP, DEFAULT_SIDE_IMAGE_WIDTH } from './constants';\nimport { ReaderContext } from './context';\nimport { blockStylesToStyle, buttonGroupAlignToJustify, cardImageHeightStyle, cardImageObjectFit, cardImagePositionToCss, cardImageSizeToCss, childrenOf, contentBodyStyle, edgeInsetsToCss, safeUrl, variantToReactStyle, } from './helpers';\nexport function BlockView({ block, items, defaults }) {\n if (block.itemType === 'placeholder')\n return null;\n const styles = { ...defaults, ...block.styles };\n let inner;\n if (block.itemType === 'card')\n inner = React.createElement(CardView, { card: block });\n else if (block.itemType === 'columns')\n inner = React.createElement(ColumnsView, { columns: block });\n else if (block.itemType === 'content')\n inner = React.createElement(ContentLeafView, { leaf: block });\n else\n inner = React.createElement(GroupView, { group: block, items: items, defaults: defaults });\n return React.createElement(\"div\", { style: blockStylesToStyle(styles) }, inner);\n}\nexport function ContentLeafView({ leaf }) {\n return React.createElement(ContentBodyView, { body: leaf.content });\n}\nfunction groupAlignToFlex(align) {\n if (align === 'GROUP_ALIGN_CENTER')\n return 'center';\n if (align === 'GROUP_ALIGN_END')\n return 'flex-end';\n return 'flex-start';\n}\nexport function GroupView({ group, items, defaults }) {\n const children = childrenOf(items, group.id);\n if (children.length === 0)\n return null;\n const isHorizontal = group.direction === 'GROUP_DIRECTION_HORIZONTAL';\n const wrap = {\n display: 'flex',\n flexDirection: isHorizontal ? 'row' : 'column',\n gap: `${group.gap ?? 0}px`,\n alignItems: groupAlignToFlex(group.align),\n };\n if (group.padding)\n wrap.padding = edgeInsetsToCss(group.padding);\n if (group.margin)\n wrap.margin = edgeInsetsToCss(group.margin);\n return (React.createElement(\"div\", { style: wrap }, children.map((child) => (React.createElement(BlockView, { key: child.id, block: child, items: items, defaults: defaults })))));\n}\nexport function CardView({ card }) {\n const { cardDefaults } = useContext(ReaderContext);\n const cardStyles = card.cardStyles ?? {};\n const contentPadding = cardStyles.contentPadding ?? cardDefaults?.contentPadding;\n const objectFit = cardImageObjectFit(card.imageFit) ?? 'cover';\n const objectPosition = cardImagePositionToCss(card.imagePosition);\n const content = (React.createElement(\"div\", { style: contentPadding ? { padding: edgeInsetsToCss(contentPadding) } : undefined },\n React.createElement(ContentBodyView, { body: card.content })));\n if (card.layout === 'no')\n return content;\n if (card.layout === 'background' && card.image?.src) {\n return (React.createElement(\"div\", { style: { position: 'relative', overflow: 'hidden', borderRadius: '4px' } },\n React.createElement(ImageView, { image: card.image, style: { width: '100%', display: 'block', objectFit, objectPosition, ...cardImageHeightStyle(card.imageSize) } }),\n React.createElement(\"div\", { style: {\n position: 'absolute',\n inset: 0,\n padding: '16px',\n backgroundColor: 'rgba(0,0,0,0.4)',\n color: '#ffffff',\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n } }, content)));\n }\n if (card.layout === 'left' || card.layout === 'right') {\n const width = cardImageSizeToCss(card.imageSize) ?? `${DEFAULT_SIDE_IMAGE_WIDTH}px`;\n const image = card.image?.src ? (React.createElement(\"div\", { style: { position: 'relative', flexShrink: 0, alignSelf: 'stretch', width } },\n React.createElement(ImageView, { image: card.image, style: { position: 'absolute', inset: 0, width: '100%', height: '100%', objectFit, objectPosition } }))) : null;\n return (React.createElement(\"div\", { style: { display: 'flex', alignItems: 'stretch' } },\n card.layout === 'left' && image,\n React.createElement(\"div\", { style: { flex: 1, minWidth: 0 } }, content),\n card.layout === 'right' && image));\n }\n return (React.createElement(\"div\", null,\n card.image?.src && (React.createElement(ImageView, { image: card.image, style: { width: '100%', display: 'block', objectFit, objectPosition, ...cardImageHeightStyle(card.imageSize) } })),\n content));\n}\nexport function ColumnsView({ columns }) {\n const { columnsDefaults } = useContext(ReaderContext);\n const styles = columns.columnsStyles ?? {};\n const gap = columns.gap || columnsDefaults?.gap || DEFAULT_COLUMNS_GAP;\n const outerPadding = styles.padding ?? columnsDefaults?.padding;\n const columnPadding = styles.columnPadding ?? columnsDefaults?.columnPadding;\n const wrapperStyle = { display: 'flex', gap: `${gap}px` };\n if (outerPadding)\n wrapperStyle.padding = edgeInsetsToCss(outerPadding);\n return (React.createElement(\"div\", { style: wrapperStyle }, columns.columns.map((col, i) => (\n // eslint-disable-next-line react/no-array-index-key\n React.createElement(ColumnView, { key: i, column: col, columnPadding: columnPadding })))));\n}\nexport function ColumnView({ column, columnPadding }) {\n const style = {\n flex: column.width ? `0 1 ${column.width}` : '1 1 0',\n minWidth: 0,\n };\n if (columnPadding)\n style.padding = edgeInsetsToCss(columnPadding);\n return (React.createElement(\"div\", { style: style },\n column.image?.src &&\n React.createElement(ImageView, { image: column.image, style: { width: '100%', display: 'block' } }),\n React.createElement(ContentBodyView, { body: column.content })));\n}\nexport function ContentBodyView({ body }) {\n if (!body)\n return null;\n const wrap = contentBodyStyle(body);\n const hasWrap = Object.keys(wrap).length > 0;\n const items = body.items.map((item, i) => (\n // eslint-disable-next-line react/no-array-index-key\n React.createElement(ContentItemView, { key: i, item: item })));\n return hasWrap ? React.createElement(\"div\", { style: wrap }, items) : React.createElement(React.Fragment, null, items);\n}\nexport function ContentItemView({ item }) {\n if (item.itemType === 'buttonGroup') {\n return React.createElement(ButtonGroupView, { group: item });\n }\n return React.createElement(TextView, { item: item });\n}\nexport function TextView({ item }) {\n const { textVariants, baseFontFamily } = useContext(ReaderContext);\n const style = {\n ...variantToReactStyle(textVariants, item.variant, baseFontFamily),\n padding: '2px 0',\n };\n return React.createElement(\"div\", { style: style, dangerouslySetInnerHTML: { __html: item.text } });\n}\nexport function ButtonGroupView({ group }) {\n const { buttonGroupDefaults } = useContext(ReaderContext);\n if (!group.buttons.length)\n return null;\n const styles = group.styles ?? {};\n const gap = styles.gap ?? buttonGroupDefaults?.gap ?? DEFAULT_BUTTON_GROUP_GAP;\n const padding = styles.padding ?? buttonGroupDefaults?.padding;\n const backgroundColor = styles.backgroundColor || buttonGroupDefaults?.backgroundColor;\n const wrap = {\n display: 'flex',\n flexWrap: 'wrap',\n gap: `${gap}px`,\n justifyContent: buttonGroupAlignToJustify(group.align),\n };\n if (padding)\n wrap.padding = edgeInsetsToCss(padding);\n if (backgroundColor)\n wrap.backgroundColor = backgroundColor;\n return (React.createElement(\"div\", { style: wrap }, group.buttons.map((b, i) => (\n // eslint-disable-next-line react/no-array-index-key\n React.createElement(ButtonView, { key: i, button: b })))));\n}\nexport function ButtonView({ button }) {\n const { buttonDefaults, baseFontFamily } = useContext(ReaderContext);\n const s = button.styles ?? {};\n const style = {\n display: 'inline-block',\n textDecoration: 'none',\n padding: '8px 16px',\n };\n const bg = s.backgroundColor || buttonDefaults?.backgroundColor;\n if (bg)\n style.backgroundColor = bg;\n const color = s.textColor || buttonDefaults?.textColor;\n if (color)\n style.color = color;\n const borderWidth = s.borderWidth || buttonDefaults?.borderWidth;\n if (borderWidth) {\n const borderColor = s.borderColor || buttonDefaults?.borderColor || '#000';\n style.border = `${borderWidth}px solid ${borderColor}`;\n }\n const borderRadius = s.borderRadius || buttonDefaults?.borderRadius;\n if (borderRadius)\n style.borderRadius = `${borderRadius}px`;\n const fontSize = s.fontSize || buttonDefaults?.fontSize;\n if (fontSize)\n style.fontSize = `${fontSize}px`;\n const fontFamily = s.fontFamily || buttonDefaults?.fontFamily || baseFontFamily;\n if (fontFamily)\n style.fontFamily = fontFamily;\n const href = safeUrl(button.url);\n return (React.createElement(\"a\", { href: href || '#', target: \"_blank\", rel: \"noreferrer\", style: style }, button.text || 'Button'));\n}\nexport function ImageView({ image, style }) {\n if (!image.src)\n return null;\n return React.createElement(\"img\", { src: image.src, alt: image.alt || '', style: { maxWidth: '100%', ...style } });\n}\n","import React from 'react';\nimport { BlockView } from './components';\nimport { DEFAULT_BLOCK_GAP, DEFAULT_CONTAINER_WIDTH, FONT_STACK } from './constants';\nimport { ReaderContext } from './context';\nimport { edgeInsetsToCss, topLevelOf } from './helpers';\nconst POPUP_KEYFRAMES = `\n@keyframes pw-popup-fade { from { opacity: 0; } }\n@keyframes pw-popup-slide { from { opacity: 0; translate: 0 16px; } }\n@keyframes pw-popup-overlay { from { opacity: 0; } }\n`;\nfunction animationName(anim) {\n if (anim === 'POPUP_ANIMATION_FADE')\n return 'pw-popup-fade';\n if (anim === 'POPUP_ANIMATION_SLIDE')\n return 'pw-popup-slide';\n return undefined;\n}\nfunction popupChromeStyle(popup) {\n const style = {};\n if (popup.borderRadius > 0)\n style.borderRadius = `${popup.borderRadius}px`;\n if (popup.boxShadow)\n style.boxShadow = popup.boxShadow;\n const name = animationName(popup.animation);\n if (name)\n style.animation = `${name} 0.2s ease-out backwards`;\n return style;\n}\nfunction popupFixedContainerStyle(popup, width) {\n const hasTop = popup.top !== undefined;\n const hasBottom = popup.bottom !== undefined;\n const hasLeft = popup.left !== undefined;\n const hasRight = popup.right !== undefined;\n const style = {\n position: 'fixed',\n boxSizing: 'border-box',\n overflow: 'auto',\n ...popupChromeStyle(popup),\n };\n if (hasLeft && hasRight) {\n style.left = `${popup.left}px`;\n style.right = `${popup.right}px`;\n }\n else {\n style.width = `${width}px`;\n if (hasLeft)\n style.left = `${popup.left}px`;\n else if (hasRight)\n style.right = `${popup.right}px`;\n else\n style.left = '50%';\n }\n if (hasTop && hasBottom) {\n style.top = `${popup.top}px`;\n style.bottom = `${popup.bottom}px`;\n }\n else {\n if (hasTop)\n style.top = `${popup.top}px`;\n else if (hasBottom)\n style.bottom = `${popup.bottom}px`;\n else\n style.top = '50%';\n style.maxHeight = `calc(100% - ${(popup.top ?? 0) + (popup.bottom ?? 0)}px)`;\n }\n const tx = !hasLeft && !hasRight ? '-50%' : '0';\n const ty = !hasTop && !hasBottom ? '-50%' : '0';\n if (tx !== '0' || ty !== '0') {\n style.transform = `translate(${tx}, ${ty})`;\n }\n return style;\n}\nfunction popupPreviewContainerStyle(popup, width) {\n return {\n position: 'relative',\n boxSizing: 'border-box',\n width: `${width}px`,\n ...popupChromeStyle(popup),\n };\n}\nexport function DocumentReader(props) {\n const { document: doc, mode } = props;\n const { items, settings, textVariants, popupSettings } = doc;\n const allBlocks = items ?? [];\n const topLevel = topLevelOf(allBlocks);\n const gap = settings?.blockGap || DEFAULT_BLOCK_GAP;\n const width = settings?.width || DEFAULT_CONTAINER_WIDTH;\n const commonDefaults = settings?.defaultStyles?.common;\n const baseFontFamily = settings?.fontFamily || FONT_STACK;\n const bodyStyle = {\n maxWidth: `${width}px`,\n margin: '0 auto',\n fontFamily: baseFontFamily,\n };\n if (settings?.backgroundColor)\n bodyStyle.backgroundColor = settings.backgroundColor;\n if (settings?.textColor)\n bodyStyle.color = settings.textColor;\n if (settings?.padding)\n bodyStyle.padding = edgeInsetsToCss(settings.padding);\n const ctx = {\n textVariants,\n baseFontFamily,\n cardDefaults: settings?.defaultStyles?.card,\n columnsDefaults: settings?.defaultStyles?.columns,\n buttonGroupDefaults: settings?.defaultStyles?.buttonGroup,\n buttonDefaults: settings?.defaultStyles?.button,\n };\n const body = (React.createElement(React.Fragment, null, topLevel.map((block, i) => (React.createElement(\"div\", { key: block.id || i, style: i > 0 ? { marginTop: `${gap}px` } : undefined },\n React.createElement(BlockView, { block: block, items: allBlocks, defaults: commonDefaults }))))));\n if (mode === 'popup' && popupSettings) {\n const overlay = popupSettings.overlay;\n const overlayStyle = overlay && overlay.color ? {\n position: 'fixed',\n inset: 0,\n backgroundColor: overlay.color,\n opacity: overlay.opacity,\n animation: 'pw-popup-overlay 0.2s ease-out backwards',\n } : undefined;\n const popupBodyStyle = { ...bodyStyle, maxWidth: 'none', margin: 0 };\n return (React.createElement(ReaderContext.Provider, { value: ctx },\n React.createElement(\"style\", null, POPUP_KEYFRAMES),\n overlayStyle && React.createElement(\"div\", { style: overlayStyle }),\n React.createElement(\"div\", { style: popupFixedContainerStyle(popupSettings, width) },\n React.createElement(\"div\", { style: popupBodyStyle }, body))));\n }\n if (mode === 'popup-preview' && popupSettings) {\n const popupBodyStyle = { ...bodyStyle, maxWidth: 'none', margin: 0 };\n return (React.createElement(ReaderContext.Provider, { value: ctx },\n React.createElement(\"style\", null, POPUP_KEYFRAMES),\n React.createElement(\"div\", { style: popupPreviewContainerStyle(popupSettings, width) },\n React.createElement(\"div\", { style: popupBodyStyle }, body))));\n }\n return (React.createElement(ReaderContext.Provider, { value: ctx },\n React.createElement(\"div\", { style: bodyStyle }, body)));\n}\n","import { render } from 'preact';\nimport { type BuilderDocument, DocumentReader } from 'smart-blocks-utils';\n\nimport { DEFAULT_DOCUMENT_WIDTH } from './constants';\nimport { type WebPopupContent } from './types';\n\nexport const renderWebPopup = (container: HTMLElement, content: WebPopupContent): void => {\n const parsedJson = parseWebPopupJson(content.json);\n if (!parsedJson) {\n return;\n }\n\n const width = parsedJson.settings?.width ?? DEFAULT_DOCUMENT_WIDTH;\n container.style.width = `${width}px`;\n container.style.maxWidth = '100%';\n\n render(\n <DocumentReader document={parsedJson} mode=\"popup\" />,\n container,\n );\n};\n\nconst parseWebPopupJson = (json: string): BuilderDocument | null => {\n try {\n return JSON.parse(json) as BuilderDocument;\n } catch {\n return null;\n }\n};\n","import { type TInboxMessagesStoreName, type TKeyValueStoreName, type TMainLogStoreName, type TMessageLogStoreName } from '../Storage.types';\n\nexport const STORE_NAME_KEY_VALUE: TKeyValueStoreName = 'keyValue';\nexport const STORE_NAME_MESSAGE_LOG: TMessageLogStoreName = 'messages';\nexport const STORE_NAME_MAIN_LOG: TMainLogStoreName = 'log';\nexport const STORE_NAME_INBOX_MESSAGES: TInboxMessagesStoreName = 'inboxMessages';\n\nexport const KEY_PATH_BASE_INCREMENT = 'id';\n","import { type TMigrationType, type TSdkStoreName } from '../Storage.types';\n\n/**\n * Check existed store, before create\n * @param name\n * @param storeCreator\n */\nexport function storeCreatorDecorator(name: TSdkStoreName, storeCreator: TMigrationType): TMigrationType {\n return function (database: IDBDatabase) {\n if (database.objectStoreNames.contains(name)) {\n return;\n }\n\n storeCreator(database);\n };\n}\n","import {\n STORE_NAME_INBOX_MESSAGES,\n STORE_NAME_KEY_VALUE,\n STORE_NAME_MAIN_LOG,\n STORE_NAME_MESSAGE_LOG,\n KEY_PATH_BASE_INCREMENT,\n} from './constants';\nimport { storeCreatorDecorator } from './helpers';\nimport {\n type TInboxMessagesIDBKeyPath,\n type TInboxMessagesIDBRemovalTimeIndex,\n type TInboxMessagesIDBStatusIndex,\n} from '../../../models/InboxMessages.types';\n\n/**\n * Create keyValue store migration\n * @param database\n */\nfunction createKeyValueStore(database: IDBDatabase) {\n database.createObjectStore(STORE_NAME_KEY_VALUE, { keyPath: 'key' });\n}\n\n/**\n * Create log store migration\n * @param database\n */\nfunction createLogStore(database: IDBDatabase) {\n const logStore = database.createObjectStore(\n STORE_NAME_MAIN_LOG,\n { keyPath: KEY_PATH_BASE_INCREMENT, autoIncrement: true },\n );\n logStore.createIndex('environment', 'environment', { unique: false });\n logStore.createIndex('date', 'date', { unique: false });\n logStore.createIndex('type', 'type', { unique: false });\n}\n\n/**\n * Create message log store migration\n * @param database\n */\nfunction createMessageLogStore(database: IDBDatabase) {\n const messagesStore = database.createObjectStore(\n STORE_NAME_MESSAGE_LOG,\n { keyPath: KEY_PATH_BASE_INCREMENT, autoIncrement: true },\n );\n messagesStore.createIndex('date', 'date', { unique: false });\n}\n\n/**\n * Create inbox messages store migration\n * @param database\n */\nfunction createInboxMessagesStore(database: IDBDatabase) {\n const keyPath: TInboxMessagesIDBKeyPath = 'inbox_id';\n const statusIndex: TInboxMessagesIDBStatusIndex = 'status';\n const removalTimeIndex: TInboxMessagesIDBRemovalTimeIndex = 'rt';\n\n const store = database.createObjectStore(STORE_NAME_INBOX_MESSAGES,\n { keyPath, autoIncrement: false },\n );\n store.createIndex(statusIndex, statusIndex, { unique: false, multiEntry: true });\n store.createIndex(removalTimeIndex, removalTimeIndex, { unique: false, multiEntry: true });\n}\n\nexport default [\n storeCreatorDecorator(STORE_NAME_KEY_VALUE, createKeyValueStore),\n storeCreatorDecorator(STORE_NAME_MAIN_LOG, createLogStore),\n storeCreatorDecorator(STORE_NAME_MESSAGE_LOG, createMessageLogStore),\n storeCreatorDecorator(STORE_NAME_INBOX_MESSAGES, createInboxMessagesStore),\n];\n","import { default as migrationsInitial } from './initial';\nimport { type TMigrationType } from '../Storage.types';\n\nexport default class Migrations {\n get all(): Array<TMigrationType> {\n return migrationsInitial;\n }\n}\n","import Migrations from './Migrations';\nimport { type TMigrationType } from '../Storage.types';\n\nexport default class MigrationExecutor {\n db: IDBDatabase;\n migrationsBuilder: Migrations;\n\n constructor(\n db: IDBDatabase,\n migrationsBuilder: Migrations = new Migrations(),\n ) {\n this.db = db;\n this.migrationsBuilder = migrationsBuilder;\n }\n\n applyMigrations() {\n this.applyMigrationsPack(this.migrationsBuilder.all);\n }\n\n applyMigrationsPack(migrationsPack: Array<TMigrationType>) {\n migrationsPack.forEach((migration) => {\n migration(this.db);\n });\n }\n}\n","import {\n STORE_NAME_KEY_VALUE,\n STORE_NAME_MAIN_LOG,\n STORE_NAME_MESSAGE_LOG,\n} from '../modules/storage/migrations/constants';\nimport MigrationExecutor from '../modules/storage/migrations/MigrationExecutor';\nimport { type IIDBOpenEventTargetWithResult } from '../modules/storage/Storage.types';\nimport version from '../modules/storage/version';\n\ndeclare const self: ServiceWorkerGlobalScope;\n\nfunction onversionchange(database: IDBDatabase, event: Event) {\n console.info('onversionchange', event);\n database.close();\n}\n\nlet databasePromise: Promise<IDBDatabase>;\nexport function getInstance(): Promise<IDBDatabase> {\n if (!databasePromise) {\n databasePromise = new Promise<IDBDatabase>((resolve, reject) => {\n const request: IDBOpenDBRequest = indexedDB.open('PUSHWOOSH_SDK_STORE', version);\n request.onsuccess = (event) => {\n const database: IDBDatabase = (event.target as IIDBOpenEventTargetWithResult).result;\n database.onversionchange = onversionchange.bind(null, database, reject);\n resolve(database);\n };\n\n request.onerror = () => reject(request.error);\n\n request.onupgradeneeded = (event) => {\n const database: IDBDatabase = (event.target as IIDBOpenEventTargetWithResult).result;\n database.onversionchange = onversionchange.bind(null, database, reject);\n\n const migrationExecutor = new MigrationExecutor(database);\n migrationExecutor.applyMigrations();\n };\n });\n }\n return databasePromise;\n}\n\nfunction getInstanceWithPromise(executor: any): any {\n return getInstance().then((database) => (\n new Promise((resolve, reject) => executor(database, resolve, reject))\n ));\n}\n\nfunction createKeyValue(name: string) {\n return {\n get<K extends string, D>(key: K, defaultValue?: D) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction(name).objectStore(name).get(key);\n\n /** @TODO\n * we cant invoke \"resolve\" or \"reject\" in onsuccess or onerror because\n * it leads to bugs in Safari when we try to get permissions for notifications\n *\n * Checking status of request in setTimeout fixes this bug\n */\n let isComplete = false;\n let isError = false;\n let timeout: any;\n\n const check = () => {\n clearTimeout(timeout);\n if (isComplete) {\n resolve(request.result?.value || defaultValue);\n } else if (isError) {\n reject(request.error);\n } else {\n timeout = setTimeout(check, 0);\n }\n };\n\n request.onsuccess = () => isComplete = true;\n request.onerror = () => isError = true;\n check();\n });\n },\n\n getAll() {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const result: { [key: string]: any } = {};\n const cursor = database.transaction(name).objectStore(name).openCursor();\n let isComplete = false;\n let isError = false;\n let timeout: any;\n\n /** @TODO\n * we cant invoke \"resolve\" or \"reject\" in onsuccess or onerror because\n * it leads to bugs in Safari when we try to get permissions for notifications\n *\n * Checking status of request in setTimeout fixes this bug\n */\n const check = () => {\n clearTimeout(timeout);\n if (isComplete) {\n resolve(result);\n } else if (isError) {\n reject(cursor.error);\n } else {\n timeout = setTimeout(check, 0);\n }\n };\n\n cursor.onsuccess = (event) => {\n const cursorResult = (event.target as any).result;\n if (cursorResult) {\n result[cursorResult.key] = cursorResult.value.value;\n cursorResult.continue();\n } else {\n isComplete = true;\n }\n };\n cursor.onerror = () => isError = true;\n check();\n });\n },\n\n async extend(key: string, value: any) {\n const oldValues = await this.get(key);\n const { ...newValues } = value;\n await this.set(key, { ...oldValues, ...newValues });\n },\n\n set<K, D>(key: K, value: D) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction([name], 'readwrite').objectStore(name).put({ key, value });\n let isComplete = false;\n let isError = false;\n let timeout: any;\n\n /** @TODO\n * we cant invoke \"resolve\" or \"reject\" in onsuccess or onerror because\n * it leads to bugs in Safari when we try to get permissions for notifications\n *\n * Checking status of request in setTimeout fixes this bug\n */\n const check = () => {\n clearTimeout(timeout);\n if (isComplete) {\n resolve(key);\n } else if (isError) {\n reject(request.error);\n } else {\n timeout = setTimeout(check, 0);\n }\n };\n\n request.onsuccess = () => isComplete = true;\n request.onerror = () => isError = true;\n check();\n });\n },\n };\n}\n\nexport abstract class LogBase {\n protected abstract name: string;\n protected abstract maxItems: number;\n _add(obj: any) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction([this.name], 'readwrite').objectStore(this.name).add(obj);\n request.onsuccess = () => {\n resolve(obj);\n };\n request.onerror = () => {\n reject(request.error);\n };\n }).then((obj: any) => {\n return this.getAll().then((items: { id: number }[]) => {\n if (Array.isArray(items)) {\n const ids = items.map((i) => i.id).sort((a, b) => {\n if (a == b) return 0;\n return a < b ? 1 : -1;\n });\n if (ids.length > this.maxItems) {\n return Promise.all(ids.slice(this.maxItems).map((id) => this.delete(id))).then(() => obj);\n }\n }\n return obj;\n });\n });\n }\n\n delete(key: any) {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const request = database.transaction([this.name], 'readwrite').objectStore(this.name).delete(key);\n request.onsuccess = () => {\n resolve(request.result);\n };\n request.onerror = () => {\n reject(request.error);\n };\n });\n }\n\n getAll() {\n return getInstanceWithPromise((database: IDBDatabase, resolve: any, reject: any) => {\n const result: any[] = [];\n const cursor = database.transaction(this.name).objectStore(this.name).openCursor();\n cursor.onsuccess = (ev) => {\n const cursorResult = (ev.target as any).result;\n if (cursorResult) {\n if (cursorResult.value) {\n result.push(cursorResult.value);\n }\n cursorResult.continue();\n } else {\n resolve(result);\n }\n };\n cursor.onerror = () => {\n reject(cursor.error);\n };\n });\n }\n}\n\nexport class LogLog extends LogBase {\n protected name = STORE_NAME_MAIN_LOG;\n protected maxItems = 100;\n protected environment = (typeof self !== 'undefined' && self.registration) ? 'worker' : 'browser';\n add(type: string, message: any, additional?: any) {\n const obj: any = {\n type,\n environment: this.environment,\n message: `${message}`,\n date: new Date(),\n };\n if (message instanceof Error) {\n obj.stack = message.stack;\n }\n if (additional) {\n obj.additional = additional;\n }\n return this._add(obj);\n }\n}\n\nexport class LogMessage extends LogBase {\n protected name = STORE_NAME_MESSAGE_LOG;\n protected maxItems = 25;\n add(log: any) {\n return this._add({\n ...log,\n date: new Date(),\n });\n }\n}\n\nexport const keyValue = createKeyValue(STORE_NAME_KEY_VALUE);\nexport const log = new LogLog();\nexport const message = new LogMessage();\n","// indexed DB version\nexport default 7;\n","import { log as logStorage } from './storage';\n\nconst levels: { [key: string]: number } = {\n error: 1,\n info: 2,\n debug: 3,\n};\n\nlet limitLevel = 3;\n\ntype TWriteType = 'error' | 'apirequest' | 'info';\n\ninterface ILogger {\n setLevel(level: string): void;\n error(...args: any[]): void;\n info(...args: any[]): void;\n debug(...args: any[]): void;\n write(type: TWriteType, message: any, additional?: any): Promise<void>;\n isManualLevel(): boolean;\n [key: string]: any;\n}\n\nconst Logger: ILogger = {\n setLevel(level) {\n if (!levels[level]) {\n level = 'error';\n }\n limitLevel = levels[level];\n },\n write(type: TWriteType, message: any, additional?: any) {\n if (type === 'error') {\n this.error(message);\n } else {\n this.info(message);\n }\n return logStorage.add(type, message, additional);\n },\n} as ILogger;\n\nObject.keys(levels).forEach((levelName: string) => {\n const levelNumber = levels[levelName];\n Logger[levelName] = (...args: any[]) => {\n if (levelNumber <= limitLevel) {\n console.groupCollapsed(levelName);\n console.info('', ...args);\n console.trace('trace');\n console.groupEnd();\n }\n };\n});\n\nexport function logAndThrowError(error: string) {\n const logText = new Error(error);\n Logger.write('error', logText, 'logAndThrowError');\n throw logText;\n}\n\nexport function logAndRejectError(error: string, reject: (e: any) => void) {\n const logText = new Error(error);\n Logger.write('error', logText, 'logAndRejectError');\n reject(logText);\n}\n\nexport { Logger };\n","import { POPUP_HOST_Z_INDEX, POPUP_STYLES, WEB_POPUPS_WIDGET_NAMESPACE } from './constants';\nimport { getWebPopups } from './helpers';\nimport { renderWebPopup } from './renderer';\nimport { type WebPopup, type WebPopupContent } from './types';\nimport { Logger } from '../../core/logger';\nimport { type Pushwoosh } from '../../core/Pushwoosh';\n\ntype LoadedWebPopup = {\n popup: WebPopup;\n content: WebPopupContent;\n};\n\nexport class WebPopupsWidget {\n private readonly pw: Pushwoosh;\n\n private isRecurringVisitor = false;\n\n private readonly loadedPopups = new Map<string, LoadedWebPopup>();\n\n private readonly pendingTimers = new Map<string, { timeoutId: number; loaded: LoadedWebPopup }>();\n\n private isNavigationSubscribed = false;\n\n private openPopupsCount = 0;\n\n private bodyOverflowBeforeLock: string | null = null;\n\n private lockBodyScroll(): void {\n if (this.openPopupsCount === 0) {\n this.bodyOverflowBeforeLock = document.body.style.overflow;\n document.body.style.overflow = 'hidden';\n }\n this.openPopupsCount += 1;\n }\n\n private unlockBodyScroll(): void {\n this.openPopupsCount = Math.max(0, this.openPopupsCount - 1);\n if (this.openPopupsCount === 0 && this.bodyOverflowBeforeLock !== null) {\n document.body.style.overflow = this.bodyOverflowBeforeLock;\n this.bodyOverflowBeforeLock = null;\n }\n }\n\n constructor(pw: Pushwoosh) {\n this.pw = pw;\n }\n\n public async run(): Promise<void> {\n const { pw } = this;\n\n this.isRecurringVisitor = await pw.data.getIsRecurringVisitor();\n\n const webPopups = getWebPopups(await pw.data.getFeatures());\n\n const results = await Promise.allSettled(webPopups.map((webPopup) => this.loadWebPopup(webPopup)));\n results.forEach((result, index) => {\n if (result.status === 'rejected') {\n Logger.error(result.reason, `Failed to load web popup \"${webPopups[index].code}\"`);\n }\n });\n\n this.subscribeToNavigation();\n this.renderForCurrentPage();\n\n await pw.data.setIsRecurringVisitor(true);\n }\n\n private async loadWebPopup(webPopup: WebPopup): Promise<void> {\n const canBeShown = await this.checkStrongCondition(webPopup);\n if (!canBeShown) {\n return;\n }\n\n const content = await this.pw.api.getPopupFormContent(webPopup.popup_form_content_code);\n this.loadedPopups.set(webPopup.code, { popup: webPopup, content });\n }\n\n private renderForCurrentPage(): void {\n this.cancelPendingForUnmatchedPages();\n\n const toRender: Array<[string, LoadedWebPopup]> = [];\n\n this.loadedPopups.forEach((loaded, code) => {\n if (this.checkSoftCondition(loaded.popup)) {\n toRender.push([code, loaded]);\n }\n });\n\n toRender.forEach(([code, { popup, content }]) => {\n this.addToQueue(popup, content);\n this.loadedPopups.delete(code);\n });\n }\n\n private cancelPendingForUnmatchedPages(): void {\n this.pendingTimers.forEach(({ timeoutId, loaded }, code) => {\n if (this.checkSoftCondition(loaded.popup)) {\n return;\n }\n\n window.clearTimeout(timeoutId);\n this.pendingTimers.delete(code);\n this.loadedPopups.set(code, loaded);\n });\n }\n\n private subscribeToNavigation(): void {\n if (this.isNavigationSubscribed) {\n return;\n }\n\n this.isNavigationSubscribed = true;\n\n const onNavigate = (): void => this.renderForCurrentPage();\n\n const nav = (window as Window & { navigation?: EventTarget }).navigation;\n if (nav && typeof nav.addEventListener === 'function') {\n nav.addEventListener('currententrychange', onNavigate);\n return;\n }\n\n window.addEventListener('popstate', onNavigate);\n window.addEventListener('hashchange', onNavigate);\n\n // Programmatic pushState/replaceState fires no event; poll location instead\n // of monkey-patching history so SPA routers stay untouched.\n let lastHref = window.location.href;\n window.setInterval(() => {\n if (window.location.href !== lastHref) {\n lastHref = window.location.href;\n onNavigate();\n }\n }, 500);\n }\n\n private async checkStrongCondition(webPopup: WebPopup): Promise<boolean> {\n const conditions: Array<boolean> = await Promise.all([\n this.checkCanBeShownByDeviceTypeCondition(webPopup),\n this.checkCanBeShownByFrequencyCondition(webPopup),\n this.checkCanBeShownByVisitorsTypeCondition(webPopup),\n ]);\n\n return conditions.every((condition) => condition);\n }\n\n private checkSoftCondition(webPopup: WebPopup): boolean {\n return this.checkCanBeShownByMatchingPagesCondition(webPopup);\n }\n\n private checkCanBeShownByDeviceTypeCondition(webPopup: WebPopup): boolean {\n const { device_type: deviceType } = webPopup;\n\n const formFactor = this.pw.platformChecker.formFactor;\n if (deviceType === 'ALL') {\n return true;\n }\n\n return deviceType === formFactor;\n }\n\n private async checkCanBeShownByFrequencyCondition(webPopup: WebPopup): Promise<boolean> {\n const { frequency, code } = webPopup;\n\n if (frequency === 'ONCE') {\n const shown = await this.pw.data.getShownWebPopups();\n return !shown.includes(code);\n }\n\n if (frequency === 'ONCE_PER_SESSION') {\n return sessionStorage.getItem(this.getSessionStorageKey(code)) === null;\n }\n\n return true;\n }\n\n private checkCanBeShownByMatchingPagesCondition(webPopup: WebPopup): boolean {\n const { matching_pages: matchingPages } = webPopup;\n if (!matchingPages) {\n return true;\n }\n\n if (matchingPages.length === 0) {\n return true;\n }\n\n return matchingPages.includes(window.location.pathname);\n }\n\n private checkCanBeShownByVisitorsTypeCondition(webPopup: WebPopup): boolean {\n const { visitors_type: visitorsType } = webPopup;\n\n if (visitorsType === 'NEW') {\n return !this.isRecurringVisitor;\n }\n\n if (visitorsType === 'RECURRING') {\n return this.isRecurringVisitor;\n }\n\n return true;\n }\n\n private async markAsShown(webPopup: WebPopup): Promise<void> {\n this.pw.api.recordPopupFormEvent(webPopup.code, 2).catch((error) => {\n Logger.error(error, `Failed to record web popup shown event for \"${webPopup.code}\"`);\n });\n const { frequency, code } = webPopup;\n\n if (frequency === 'ONCE') {\n await this.pw.data.addShownWebPopup(code);\n return;\n }\n\n if (frequency === 'ONCE_PER_SESSION') {\n sessionStorage.setItem(this.getSessionStorageKey(code), '1');\n }\n }\n\n private getSessionStorageKey(code: string): string {\n return `${WEB_POPUPS_WIDGET_NAMESPACE}.shown.${code}`;\n }\n\n private addToQueue(webPopup: WebPopup, content: WebPopupContent): void {\n this.pw.api.recordPopupFormEvent(webPopup.code, 1).catch((error) => {\n Logger.error(error, `Failed to record web popup queued event for \"${webPopup.code}\"`);\n });\n\n const timeoutId = window.setTimeout(() => {\n this.pendingTimers.delete(webPopup.code);\n\n const host = document.createElement('div');\n host.id = `${WEB_POPUPS_WIDGET_NAMESPACE}-${webPopup.code}`;\n host.style.position = 'fixed';\n host.style.inset = '0';\n host.style.zIndex = String(POPUP_HOST_Z_INDEX);\n document.body.appendChild(host);\n\n const shadow = host.attachShadow({ mode: 'open' });\n\n const style = document.createElement('style');\n style.textContent = POPUP_STYLES;\n\n const closeButton = document.createElement('button');\n closeButton.type = 'button';\n closeButton.className = 'close';\n closeButton.setAttribute('aria-label', 'Close');\n closeButton.textContent = '×';\n\n const container = document.createElement('div');\n\n shadow.appendChild(style);\n shadow.appendChild(container);\n shadow.appendChild(closeButton);\n\n this.lockBodyScroll();\n\n const closePopup = (): void => {\n this.unlockBodyScroll();\n host.remove();\n this.pw.dispatchEvent('hide-web-popup', { code: webPopup.code });\n };\n\n closeButton.addEventListener('click', closePopup);\n\n renderWebPopup(container, content);\n\n const popupChrome = container.lastElementChild;\n container.addEventListener('click', (event) => {\n if (popupChrome && popupChrome.contains(event.target as Node)) return;\n closePopup();\n });\n this.markAsShown(webPopup).catch((error) => {\n Logger.error(error, `Failed to mark web popup \"${webPopup.code}\" as shown`);\n });\n this.pw.dispatchEvent('show-web-popup', { code: webPopup.code });\n }, webPopup.delay * 1000);\n\n this.pendingTimers.set(webPopup.code, {\n timeoutId,\n loaded: { popup: webPopup, content },\n });\n }\n}\n","import type { WebPopup } from './types';\n\nexport const getWebPopups = (features: unknown): Array<WebPopup> => {\n if (typeof features !== 'object' || features === null) {\n return [];\n }\n\n const webPopups = (features as Record<string, unknown>)['popup_forms'];\n if (!Array.isArray(webPopups)) {\n return [];\n }\n\n return webPopups as Array<WebPopup>;\n};\n"],"names":["root","factory","exports","module","define","amd","a","i","this","__webpack_require__","definition","key","o","Object","defineProperty","enumerable","get","obj","prop","prototype","hasOwnProperty","call","Symbol","toStringTag","value","WEB_POPUPS_WIDGET_NAMESPACE","n","preact_module_l","u","r","e","f","c","s","h","p","v","y","d","w","_","g","Array","isArray","m","l","b","parentNode","removeChild","k","t","arguments","length","children","defaultProps","x","type","props","ref","__k","__","__b","__e","__c","constructor","__v","__i","__u","vnode","S","C","context","$","I","__P","__d","q","__n","namespaceURI","D","P","base","some","A","push","H","__r","debounceRendering","sort","shift","L","T","J","j","nextSibling","String","O","K","insertBefore","nodeType","F","z","setProperty","test","N","style","cssText","replace","toLowerCase","slice","addEventListener","removeEventListener","removeAttribute","setAttribute","V","event","M","render","contextType","__E","Q","sub","state","__h","_sb","__s","getDerivedStateFromProps","componentWillMount","componentDidMount","componentWillReceiveProps","shouldComponentUpdate","apply","componentWillUpdate","componentDidUpdate","getChildContext","getSnapshotBeforeUpdate","E","then","indexOf","B","G","diffed","map","localName","document","createTextNode","createElementNS","is","__m","data","defaultValue","childNodes","attributes","name","__html","innerHTML","content","current","unmount","componentWillUnmount","R","documentElement","firstChild","U","W","X","Set","forEach","add","delete","Provider","__l","Consumer","getDerivedStateFromError","setState","componentDidCatch","forceUpdate","Promise","bind","resolve","setTimeout","Math","random","toString","jsxRuntime_module_f","jsxRuntime_module_u","__source","__self","hooks_module_t","hooks_module_r","hooks_module_u","hooks_module_i","hooks_module_o","hooks_module_f","hooks_module_c","hooks_module_e","hooks_module_a","hooks_module_v","hooks_module_l","hooks_module_m","hooks_module_s","hooks_module_p","__H","hooks_module_d","hooks_module_h","hooks_module_D","__N","__f","filter","every","hooks_module_y","hooks_module_C","hooks_module_","hooks_module_A","hooks_module_T","hooks_module_F","concat","hooks_module_q","hooks_module_x","hooks_module_P","useDebugValue","hooks_module_g","hooks_module_j","hooks_module_z","hooks_module_B","requestAnimationFrame","hooks_module_w","hooks_module_k","clearTimeout","cancelAnimationFrame","compat_module_g","compat_module_E","compat_module_C","compat_module_R","compat_module_x","compat_module_w","compat_module_k","compat_module_I","compat_module_M","isPureReactComponent","compat_module_T","compat_module_A","for","compat_module_F","compat_module_L","count","only","toArray","compat_module_O","compat_module_U","compat_module_V","compat_module_W","appendChild","compat_module_P","compat_module_j","__a","compat_module_B","__z","__R","__O","pop","createElement","fallback","compat_module_H","revealOrder","size","Z","Y","contains","splice","Map","reverse","set","compat_module_q","compat_module_G","compat_module_J","compat_module_K","compat_module_Q","compat_module_X","isReactComponent","configurable","writable","en","persist","isPropagationStopped","cancelBubble","isDefaultPrevented","defaultPrevented","nativeEvent","rn","un","class","on","multiple","selected","className","$$typeof","ln","cn","fn","ReactCurrentDispatcher","readContext","useCallback","useContext","useDeferredValue","useEffect","useId","useImperativeHandle","useInsertionEffect","useLayoutEffect","useMemo","useReducer","useRef","useState","useSyncExternalStore","useTransition","hn","gn","startTransition","version","Children","textContent","hydrate","unmountComponentAtNode","createPortal","containerInfo","createContext","createFactory","cloneElement","createRef","Fragment","isValidElement","isElement","isFragment","isMemo","displayName","findDOMNode","Component","PureComponent","memo","forwardRef","flushSync","unstable_batchedUpdates","StrictMode","Suspense","SuspenseList","lazy","default","__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED","SAFE_URL_PROTOCOL","ReaderContext","textVariants","blockStylesToStyle","styles","backgroundColor","borderColor","borderWidth","border","borderRadius","keys","undefined","isValidImageSize","unit","cardImageHeightStyle","isPercentImageSize","width","height","aspectRatio","edgeInsetsToCss","insets","top","right","bottom","left","resolveVariantStyle","variant","fontSize","fontWeight","lineHeight","variantToReactStyle","baseFontFamily","result","fontFamily","BlockView","block","items","defaults","itemType","inner","CardView","card","ColumnsView","columns","ContentLeafView","leaf","GroupView","group","ContentBodyView","body","parentId","childrenOf","id","wrap","display","flexDirection","direction","gap","alignItems","align","padding","margin","child","cardDefaults","contentPadding","cardStyles","objectFit","fit","imageFit","objectPosition","pos","imagePosition","layout","image","src","position","overflow","ImageView","imageSize","inset","color","justifyContent","cardImageSizeToCss","flexShrink","alignSelf","flex","minWidth","columnsDefaults","columnsStyles","outerPadding","columnPadding","wrapperStyle","col","ColumnView","column","contentBodyStyle","hasWrap","item","ContentItemView","ButtonGroupView","TextView","dangerouslySetInnerHTML","text","buttonGroupDefaults","buttons","flexWrap","ButtonView","button","buttonDefaults","textDecoration","bg","textColor","href","url","trimmed","trim","startsWith","safeUrl","target","rel","alt","maxWidth","POPUP_KEYFRAMES","popupChromeStyle","popup","boxShadow","anim","animation","popupFixedContainerStyle","hasTop","hasBottom","hasLeft","hasRight","boxSizing","maxHeight","tx","ty","transform","popupPreviewContainerStyle","DocumentReader","doc","mode","settings","popupSettings","allBlocks","topLevel","topLevelOf","blockGap","commonDefaults","defaultStyles","common","bodyStyle","ctx","buttonGroup","marginTop","overlay","overlayStyle","opacity","popupBodyStyle","parseWebPopupJson","json","JSON","parse","STORE_NAME_KEY_VALUE","STORE_NAME_MESSAGE_LOG","STORE_NAME_MAIN_LOG","STORE_NAME_INBOX_MESSAGES","storeCreatorDecorator","storeCreator","database","objectStoreNames","initial","createObjectStore","keyPath","logStore","autoIncrement","createIndex","unique","statusIndex","store","multiEntry","Migrations","all","MigrationExecutor","db","migrationsBuilder","applyMigrations","applyMigrationsPack","migrationsPack","migration","onversionchange","console","info","close","databasePromise","getInstanceWithPromise","executor","reject","request","indexedDB","open","onsuccess","onerror","error","onupgradeneeded","LogBase","_add","transaction","objectStore","getAll","ids","maxItems","cursor","openCursor","ev","cursorResult","continue","log","environment","self","registration","message","additional","date","Date","Error","stack","levels","debug","limitLevel","Logger","setLevel","level","write","levelName","levelNumber","args","groupCollapsed","trace","groupEnd","WebPopupsWidget","lockBodyScroll","openPopupsCount","bodyOverflowBeforeLock","unlockBodyScroll","max","pw","isRecurringVisitor","loadedPopups","pendingTimers","isNavigationSubscribed","run","getIsRecurringVisitor","webPopups","features","getWebPopups","getFeatures","allSettled","webPopup","loadWebPopup","index","status","reason","code","subscribeToNavigation","renderForCurrentPage","setIsRecurringVisitor","checkStrongCondition","api","getPopupFormContent","popup_form_content_code","cancelPendingForUnmatchedPages","toRender","loaded","checkSoftCondition","addToQueue","timeoutId","window","onNavigate","nav","navigation","lastHref","location","setInterval","checkCanBeShownByDeviceTypeCondition","checkCanBeShownByFrequencyCondition","checkCanBeShownByVisitorsTypeCondition","condition","checkCanBeShownByMatchingPagesCondition","device_type","deviceType","formFactor","platformChecker","frequency","getShownWebPopups","includes","sessionStorage","getItem","getSessionStorageKey","matching_pages","matchingPages","pathname","visitors_type","visitorsType","markAsShown","recordPopupFormEvent","catch","setItem","addShownWebPopup","host","zIndex","shadow","attachShadow","closeButton","container","closePopup","remove","dispatchEvent","parsedJson","renderWebPopup","popupChrome","lastElementChild","delay"],"sourceRoot":""}
|