PageSourceSearch

https://www.northmill.com/se/app/static/event-logger-opS20UOn.js

js northmill.com collected 2026-10-01 14:39:43 UTC 118,616 bytes, 303 lines download raw bytes

1const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["static/push-manager-factory-BES9xuZF.js","static/rolldown-runtime-B0Z9INg1.js","static/refresh-feature-flags-C2M0IGII.js","static/feature-flags-provider-factory-CvxHkASJ.js"])))=>i.map(i=>d[i]);
2import{t as e}from"./preload-helper-D1VVPXqA.js";var t={init:function(e){e===void 0&&t.zg!==void 0||(t.zg=!!e),t.i||=!0},destroy:function(){t.i=!1,t.zg=void 0,t.Rd=void 0},setLogger:function(e){typeof e==`function`?(t.init(),t.Rd=e):t.info(`Ignoring setLogger call since logger is not a function`)},toggleLogging:function(){t.init(),t.zg?(console.log(`Disabling Braze logging`),t.zg=!1):(console.log(`Enabled Braze logging`),t.zg=!0)},info:function(e){if(t.zg){let n=`Braze: `+e;t.Rd==null?console.log(n):t.Rd(n)}},warn:function(e){if(t.zg){let n=`Braze SDK Warning: `+e+` (v6.5.0)`;t.Rd==null?console.warn(n):t.Rd(n)}},error:function(e){if(t.zg){let n=`Braze SDK Error: `+e+` (v6.5.0)`;t.Rd==null?console.error(n):t.Rd(n)}}},n={CustomEvent:`ce`,Pr:`p`,jd:`pc`,ev:`ca`,Fl:`i`,wl:`ie`,Xt:`cci`,Zt:`ccic`,Lt:`ccc`,Qt:`ccd`,Sm:`ss`,hm:`se`,wn:`si`,zn:`sc`,Sn:`sbc`,tv:`sfe`,om:`iec`,yd:`lr`,kd:`uae`,Dd:`lcaa`,Ad:`lcar`,Zu:`inc`,Qu:`add`,Xu:`rem`,Yu:`set`,Vu:`ncam`,$d:`sgu`,xo:`ffi`,ro:`bi`,ut:`bc`},r={se:function(){if(typeof window<`u`&&window.crypto){if(typeof window.crypto.randomUUID==`function`)return window.crypto.randomUUID();if(typeof window.crypto.getRandomValues==`function`)try{let e=new Uint8Array(16);window.crypto.getRandomValues(e),e[6]=15&e[6]|64,e[8]=63&e[8]|128;let t=Array.from(e,e=>(`0`+e.toString(16)).slice(-2));return[t.slice(0,4).join(``),t.slice(4,6).join(``),t.slice(6,8).join(``),t.slice(8,10).join(``),t.slice(10,16).join(``)].join(`-`)}catch{}}let e=(e=!1)=>{let t=(Math.random().toString(16)+`000000000`).substr(2,8);return e?`-`+t.substr(0,4)+`-`+t.substr(4,4):t};return e()+e(!0)+e(!0)+e()}},i=class{constructor(e,t){this.database=e,this.Rd=t,this.parent=typeof window>`u`?self:window,this.database=e,this.Rd=t}Ud(){if(`indexedDB`in this.parent)return this.parent.indexedDB}isSupported(){try{if(this.Ud()==null)return!1;{let e=this.Ud()?.open(`Braze IndexedDB Support Test`);if(e&&(e.onupgradeneeded=()=>e.result.close(),e.onsuccess=()=>e.result.close()),typeof window<`u`){let e=window,t=e.chrome||e.browser||e.Od;if(t&&t.runtime&&t.runtime.id)return this.Rd.info(`Not using IndexedDB for storage because we are running inside an extension`),!1}return!0}}catch(e){return this.Rd.info(`Not using IndexedDB for storage due to following error: `+e),!1}}Kd(e,t){let n=this.Ud()?.open(this.database.Ld,this.database.VERSION);if(n==null)return typeof t==`function`&&t(),!1;let r=this;return n.onupgradeneeded=e=>{r.Rd.info(`Upgrading indexedDB `+r.database.Ld+` to v`+r.database.VERSION+`...`);let t=e.target?.result;for(let e in r.database.Fs){let n=e;r.database.Fs.hasOwnProperty(e)&&!t.objectStoreNames.contains(r.database.Fs[n])&&t.createObjectStore(r.database.Fs[n])}},n.onsuccess=n=>{let i=n.target?.result;i.onversionchange=()=>{i.close(),typeof t==`function`&&t(),r.Rd.error(`Needed to close the database unexpectedly because of an upgrade in another tab`)},e(i)},n.onerror=e=>{let n=e;return r.Rd.info(`Could not open indexedDB `+r.database.Ld+` v`+r.database.VERSION+`: `+n.target?.errorCode),typeof t==`function`&&t(),!0},!0}setItem(e,t,n,r,i){if(!this.isSupported())return typeof i==`function`&&i(),!1;let a=this;return this.Kd(o=>{if(!o.objectStoreNames.contains(e))return a.Rd.error(`Could not store object `+t+` in `+e+` on indexedDB `+a.database.Ld+` - `+e+` is not a valid objectStore`),typeof i==`function`&&i(),void o.close();let s=o.transaction([e],`readwrite`);s.oncomplete=()=>o.close();let c=s.objectStore(e).put(n,t);c.onerror=()=>{a.Rd.error(`Could not store object `+t+` in `+e+` on indexedDB `+a.database.Ld),typeof i==`function`&&i()},c.onsuccess=()=>{typeof r==`function`&&r()}},i)}getItem(e,t,n){if(!this.isSupported())return!1;let r=this;return this.Kd(i=>{if(!i.objectStoreNames.contains(e))return r.Rd.error(`Could not retrieve object `+t+` in `+e+` on indexedDB `+r.database.Ld+` - `+e+` is not a valid objectStore`),void i.close();let a=i.transaction([e],`readonly`);a.oncomplete=()=>i.close();let o=a.objectStore(e).get(t);o.onerror=()=>{r.Rd.error(`Could not retrieve object `+t+` in `+e+` on indexedDB `+r.database.Ld)},o.onsuccess=e=>{let t=e.target?.result;t!=null&&n(t)}})}kr(e,t,n){if(!this.isSupported())return typeof n==`function`&&n(),!1;let r=this;return this.Kd(i=>{if(!i.objectStoreNames.contains(e))return r.Rd.error(`Could not retrieve last record from `+e+` on indexedDB `+r.database.Ld+` - `+e+` is not a valid objectStore`),typeof n==`function`&&n(),void i.close();let a=i.transaction([e],`readonly`);a.oncomplete=()=>i.close();let o=a.objectStore(e).openCursor(null,`prev`);o.onerror=()=>{r.Rd.error(`Could not open cursor for `+e+` on indexedDB `+r.database.Ld),typeof n==`function`&&n()},o.onsuccess=e=>{let r=e.target?.result;r!=null&&r.value!=null&&r.key!=null?t(r.key,r.value):typeof n==`function`&&n()}},n)}je(e,t){if(!this.isSupported())return!1;let n=this;return this.Kd(r=>{if(!r.objectStoreNames.contains(e))return n.Rd.error(`Could not delete record `+t+` from `+e+` on indexedDB `+n.database.Ld+` - `+e+` is not a valid objectStore`),void r.close();let i=r.transaction([e],`readwrite`);i.oncomplete=()=>r.close(),i.objectStore(e).delete(t).onerror=()=>{n.Rd.error(`Could not delete record `+t+` from `+e+` on indexedDB `+n.database.Ld)}})}Ds(e,t){if(!this.isSupported())return!1;let n=this;return this.Kd(r=>{if(!r.objectStoreNames.contains(e))return n.Rd.error(`Could not retrieve objects from `+e+` on indexedDB `+n.database.Ld+` - `+e+` is not a valid objectStore`),void r.close();let i=r.transaction([e],`readwrite`);i.oncomplete=()=>r.close();let a=i.objectStore(e),o=a.openCursor(),s=[];o.onerror=()=>{s.length>0?(n.Rd.info(`Cursor closed midway through for `+e+` on indexedDB `+n.database.Ld),t(s)):n.Rd.error(`Could not open cursor for `+e+` on indexedDB `+n.database.Ld)},o.onsuccess=e=>{let n=e.target?.result;n==null?s.length>0&&t(s):(n.value!=null&&n.key!=null&&(a.delete(n.key).onsuccess=()=>{s.push(n.value)}),typeof n.continue==`function`&&n.continue())}})}clearData(){if(!this.isSupported())return!1;let e=[];for(let t in this.database.Fs){let n=t;this.database.Fs.hasOwnProperty(t)&&this.database.Fs[n]!==this.database.Fs.be&&e.push(this.database.Fs[n])}let t=this;return this.Kd(function(n){let r=n.transaction(e,`readwrite`);r.oncomplete=()=>n.close();for(let n=0;n<e.length;n++){let i=e[n];r.objectStore(i).clear().onerror=function(){t.Rd.error(`Could not clear `+this.source.name+` on indexedDB `+t.database.Ld)}}r.onerror=function(){t.Rd.error(`Could not clear object stores on indexedDB `+t.database.Ld)}})}};i.Us={Rs:{Ld:`AppboyServiceWorkerAsyncStorage`,VERSION:6,Fs:{Ze:`data`,vr:`pushClicks`,Fu:`pu
2shSubscribed`,Gd:`fallbackDevice`,As:`cardUpdates`,be:`optOut`,zr:`pendingData`,qh:`sdkAuthenticationSignature`},fe:1}};var a={Ph:`allowCrawlerActivity`,Wh:`baseUrl`,Vh:`noCookies`,Kh:`devicePropertyAllowlist`,La:`disablePushTokenMaintenance`,$h:`enableLogging`,Yh:`enableSdkAuthentication`,Ka:`manageServiceWorkerExternally`,Xh:`minimumIntervalBetweenTriggerActionsInSeconds`,Zh:`sessionTimeoutInSeconds`,Qh:`appVersion`,Xa:`appVersionNumber`,Ga:`serviceWorkerLocation`,Ia:`safariWebsitePushId`,Wa:`localization`,er:`contentSecurityNonce`,te:`allowUserSuppliedJavascript`,$a:`inAppMessageZIndex`,Ja:`openInAppMessagesInNewTab`,Oh:`requireExplicitInAppMessageDismissal`,Za:`doNotLoadFontAwesome`,tl:`deviceId`,Ha:`serviceWorkerScope`,Ne:`dustHost`,il:`sdkFlavor`,tn:`openCardsInNewTab`};function o(e){let t=[],n;for(let r in e)n=r,Object.prototype.hasOwnProperty.call(e,n)&&e[n]!==void 0&&t.push(e[n]);return t}function s(e,n,r,i){let a=o(e);return a.indexOf(n)!==-1||(t.error(`${r} Valid values from ${i} are "${a.join(`"/"`)}".`),!1)}function c(e){return Array.isArray?Array.isArray(e):Object.prototype.toString.call(e)===`[object Array]`}function l(e){return Object.prototype.toString.call(e)===`[object Date]`}function u(e){return Object.prototype.toString.call(e)===`[object Object]`}function d(e){let t=[];for(let n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.push(n);return t}function f(e,t){if(e===t)return e!==0||1/e==1/t;if(e==null||t==null)return e===t;let n=e.toString();if(n!==t.toString())return!1;switch(n){case`[object RegExp]`:case`[object String]`:return``+e==``+t;case`[object Number]`:return+e==+e?+e==0?1/e==1/t:+e==+t:+t!=+t;case`[object Date]`:case`[object Boolean]`:return+e==+t}let r=n===`[object Array]`;if(!r){if(typeof e!=`object`||typeof t!=`object`)return!1;let n=e.constructor,r=t.constructor;if(n!==r&&!(typeof n==`function`&&n instanceof n&&typeof r==`function`&&r instanceof r)&&`constructor`in e&&`constructor`in t)return!1}let i=[],a=[],o=i.length;for(;o--;)if(i[o]===e)return a[o]===t;if(i.push(e),a.push(t),r){if(o=e.length,o!==t.length)return!1;for(;o--;)if(!f(e[o],t[o]))return!1}else{let n=d(e),r;if(o=n.length,d(t).length!==o)return!1;for(;o--;)if(r=n[o],!Object.prototype.hasOwnProperty.call(t,r)||!f(e[r],t[r]))return!1}return i.pop(),a.pop(),!0}function p(e,t=!1){let n=e/1e3;return t&&(n=Math.floor(n)),n}function m(e){return 1e3*e}function h(e){if(e==null)return null;let t=parseInt(e.toString());return isNaN(t)?null:new Date(1e3*t)}function g(e){return e!=null&&l(e)?e.toISOString().replace(/\.[0-9]{3}Z$/,``):e}function _(e){return e==null||e===``?null:new Date(e)}function v(e){return e==null||e===``?new Date().valueOf():e}function y(e){return(new Date().valueOf()-e.valueOf())/1e3}function b(e){return(e.valueOf()-new Date().valueOf())/1e3}var ee=72e5,x=1e4,S=3e5,C={ee:`Braze must be initialized before calling methods.`,$e:`logCustomEvent`,Ku:`setCustomUserAttribute`},w=class{constructor(){this.jn={}}Rt(e){if(typeof e!=`function`)return null;let t=r.se();return this.jn[t]=e,t}removeSubscription(e){delete this.jn[e]}removeAllSubscriptions(){this.jn={}}De(){return Object.keys(this.jn).length}L(e){let t=[];for(let n in this.jn){let r=this.jn[n];t.push(r(e))}return t}};function T(e){let t=e?.dt(B.ft.uE),n;return t&&(n={label:t.l,name:t.a}),n}var E=class e{constructor(e,t,n,r,i){this.userId=e,this.type=t,this.time=n,this.sessionId=r,this.data=i,this.userId=e,this.type=t,this.time=v(n),this.sessionId=r,this.data=i}Hn(){let e={name:this.type,time:p(this.time),data:this.data||{},session_id:this.sessionId};this.userId!=null&&(e.user_id=this.userId);let t=Q.Sr()?.wh()||!1;if(!e.user_id&&!t){let t=T(Q.p());t&&(e.alias=t)}return e}gt(){return{u:this.userId,t:this.type,ts:this.time,s:this.sessionId,d:this.data}}static fromJson(t){return new e(t.user_id,t.name,t.time,t.session_id,t.data)}static gE(e){return e!=null&&u(e)&&e.t!=null&&e.t!==``}static _u(t){return new e(t.u,t.t,t.ts,t.s,t.d)}},D=e=>e instanceof Error?e.message:String(e),O=class e{constructor(e,t,n){this.Tu=e,e??=r.se(),this.lm=!n||isNaN(n)?new Date().valueOf():n,this.Tu=e,this.gm=new Date().valueOf(),this.pm=t}gt(){return`g:${encodeURIComponent(this.Tu)}|e:${this.pm}|c:${this.lm}|l:${this.gm}`}static AE(e){if(typeof e!=`string`)return null;let t=e.lastIndexOf(`|e:`),n=e.substring(0,t),r=n.split(`g:`)[1],i;return i=/[|:]/.test(r)?encodeURIComponent(r):r,e=e.replace(n,`g:${i}`)}static _u(n){let r;if(typeof n==`string`)try{let t=n.split(`|`);if(!c(t)||t.length!==4)return null;let i=e=>e.split(`:`)[1],a=e=>{let t=parseInt(i(e));if(!isNaN(t))return t};r=new e(decodeURIComponent(i(t[0])),a(t[1]),a(t[2])),r.gm=a(t[3])}catch(e){t.info(`Unable to parse cookie string ${n}, failed with error: ${D(e)}`)}else{if(n==null||n.g==null)return null;r=new e(n.g,n.e,n.c),r.gm=n.l}return r}};function k(e){let t=e.length;for(let n=e.length-1;n>=0;n--){let r=e.charCodeAt(n);r>127&&r<=2047?t++:r>2047&&r<=65535&&(t+=2),r>=56320&&r<=57343&&n--}return t}function A(e){try{e=e.replace(/-/g,`+`).replace(/_/g,`/`);let t=window.atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);let r=new Uint16Array(n.buffer);return String.fromCharCode(...r)}catch(e){return t.error(`Unable to decode Base64: `+e),null}}var j={types:{io:`container`,logCustomEvent:`logCustomEvent`,setEmailNotificationSubscriptionType:`setEmailNotificationSubscriptionType`,setPushNotificationSubscriptionType:`setPushNotificationSubscriptionType`,setCustomUserAttribute:`setCustomUserAttribute`,requestPushPermission:`requestPushPermission`,addToSubscriptionGroup:`addToSubscriptionGroup`,removeFromSubscriptionGroup:`removeFromSubscriptionGroup`,addToCustomAttributeArray:`addToCustomAttributeArray`,removeFromCustomAttributeArray:`removeFromCustomAttributeArray`,mo:`openLink`,uo:`openLinkInWebView`},properties:{type:`type`,eo:`steps`,so:`args`}},M={Pn:`unknownBrazeAction`,cp:`noPushPrompt`},te=(e,t)=>
2e===M.Pn?`${t} contains an unknown braze action type and will not be displayed.`:``;function ne(e){try{let n=e.match(le),r=n?n[0].length:null,i=r?e.substring(r):null;if(r==null||r>e.length-1||!i)return void t.error(`Did not find base64 encoded brazeAction in url to process : ${e}`);let a=A(i);return a?JSON.parse(a):void t.error(`Failed to decode base64 encoded brazeAction: ${i}`)}catch(n){t.error(`Failed to process brazeAction URL ${e} : ${D(n)}`);return}}function N(e,t){let n=!1;if(t){for(let r of t)if(n||=e(r),n)return!0}return!1}function re(e){let t=j.properties.type,n=j.properties.eo;try{if(e==null)return!0;let r=e[t];return r===j.types.io?N(re,e[n]):!ve(r)}catch{return!0}}function ie(e){if(!e||!_e(e))return!1;let t=j.properties.type,n=j.properties.eo,r=e[t];return r===j.types.io?N(ie,e[n]):r===j.types.requestPushPermission}var ae=/^[^\x00-\x1F\x22]+$/,oe=/[$.]/,se=[`$add`,`$update`,`$remove`,`$identifier_key`,`$identifier_value`,`$new_object`,`$time`,`$google_ad_personalization`,`$google_ad_user_data`],ce=/^[^@\s]+@[^@\s]+\.[^@\s]+$/,le=/^brazeActions:\/\/v\d+\//;function P(e,n,r){let i=e!=null&&typeof e==`string`&&(e===``||e.match(ae)!=null);return i||t.error(`Cannot ${n} because ${r} "${e}" is invalid.`),i}function ue(e){return e!=null&&e.match(oe)&&se.indexOf(e)===-1&&t.warn(`Custom attribute keys cannot contain '$' or '.'`),P(e,`set custom user attribute`,`the given key`)}function de(e){let t=typeof e;return e==null||t===`number`||t===`boolean`||l(e)||t===`string`}function fe(e,n,r){let i=r!==-1;if(i&&r>50)return t.error(`Nested attributes cannot be more than 50 levels deep.`),!1;let a=i?r+1:-1;if(c(e)&&c(n)){for(let t=0;t<e.length&&t<n.length;t++)if(l(e[t])&&(n[t]=g(e[t])),!fe(e[t],n[t],a))return!1}else{if(!u(e))return de(e);for(let t of d(e)){let r=e[t];if(i&&!ue(t)||(l(r)&&(n[t]=g(r)),!fe(r,n[t],a)))return!1}}return!0}function pe(e,n,r,i,a){let o;return o=u(e)||c(e)?fe(e,n,a?1:-1):de(e),o||t.error(`Cannot ${r} because ${i} "${e}" is invalid.`),o}function F(e,n,r,i=!1){let a=typeof e==`string`||e===null&&i;return a||t.error(`Cannot ${n} because ${r} "${e}" is invalid.`),a}function me(e,n,r,i,a){if(e??={},typeof e!=`object`||c(e))return t.error(`${n} requires that ${r} be an object. Ignoring ${a}.`),[!1,null];let o,s;n===C.Ku?(o=76800,s=`75KB`):(o=51200,s=`50KB`);let u=JSON.stringify(e);if(k(u)>o)return t.error(`Could not ${i} because ${r} was greater than the max size of ${s}.`),[!1,null];let d;try{d=JSON.parse(u)}catch{return t.error(`Could not ${i} because ${r} did not contain valid JSON.`),[!1,null]}for(let t in e){if(n===C.Ku&&!ue(t)||!P(t,i,`the ${a} property name`))return[!1,null];let r=e[t];if(n!==C.Ku&&r==null){delete e[t],delete d[t];continue}if(l(r)&&(d[t]=g(r)),!pe(r,d[t],i,`the ${a} property "${t}"`,n===C.Ku))return[!1,null]}return[!0,d]}function he(e,n){let r=!1,i=!1,a=()=>{t.error(`Custom attribute arrays must be either string arrays or object arrays.`)};for(let t of n)if(typeof t==`string`){if(i)return a(),[!1,!1];if(!P(t,`set custom user attribute "${e}"`,`the element in the given array`))return[!1,!1];r=!0}else{if(!u(t)||r)return a(),[!1,!1];if(!me(t,C.Ku,`attribute value`,`set custom user attribute "${e}"`,`custom user attribute`))return[!1,!1];i=!0}return[r,i]}function ge(e){if(typeof e!=`string`)return!1;let t=e.length;return!(t===0||t>256)&&ce.test(e.toLowerCase())}function _e(e){if(!(j.properties.type in e))return!1;switch(e[j.properties.type]){case j.types.io:if(j.properties.eo in e)return!0;break;case j.types.logCustomEvent:case j.types.setEmailNotificationSubscriptionType:case j.types.setPushNotificationSubscriptionType:case j.types.setCustomUserAttribute:case j.types.addToSubscriptionGroup:case j.types.removeFromSubscriptionGroup:case j.types.addToCustomAttributeArray:case j.types.removeFromCustomAttributeArray:case j.types.mo:case j.types.uo:if(j.properties.so in e)return!0;break;case j.types.requestPushPermission:return!0;default:return!1}return!1}function ve(e){let t=!1;return Object.keys(j.types).forEach(n=>{j.types[n]!==e.toString()||(t=!0)}),t}var I=class e{constructor(e,t){this.vs=e,this.Ru=t,this.vs=e,this.Ru=t}getUserId(e){let n=this.vs.getUserId();if(typeof e!=`function`)return n;t.warn("The callback for getUserId is deprecated. You can access its return value directly instead (e.g. `const id = braze.getUser().getUserId()`)"),e(n)}addAlias(e,n){return!F(e,`add alias`,`the alias`,!1)||e.length<=0?(t.error(`addAlias requires a non-empty alias`),!1):!F(n,`add alias`,`the label`,!1)||n.length<=0?(t.error(`addAlias requires a non-empty label`),!1):this.Ru.Gu(e,n).W}setFirstName(e){return!!F(e,`set first name`,`the firstName`,!0)&&this.vs.zu(`first_name`,e)}setLastName(e){return!!F(e,`set last name`,`the lastName`,!0)&&this.vs.zu(`last_name`,e)}setEmail(e){return e===null||ge(e)?this.vs.zu(`email`,e):(t.error(`Cannot set email address - "${e}
2" did not pass RFC-5322 validation.`),!1)}setGender(t){return typeof t==`string`&&(t=t.toLowerCase()),!(t!==null&&!s(e.Genders,t,`Gender "${t}" is not a valid gender.`,`User.Genders`))&&this.vs.zu(`gender`,t)}setDateOfBirth(e,n,r){return e===null&&n===null&&r===null?this.vs.zu(`dob`,null):(e=e==null?null:parseInt(e.toString()),n=n==null?null:parseInt(n.toString()),r=r==null?null:parseInt(r.toString()),e==null||n==null||r==null||isNaN(e)||isNaN(n)||isNaN(r)||n>12||n<1||r>31||r<1?(t.error(`Cannot set date of birth - parameters should comprise a valid date e.g. setDateOfBirth(1776, 7, 4);`),!1):this.vs.zu(`dob`,`${e}-${n}-${r}`))}setCountry(e){return!!F(e,`set country`,`the country`,!0)&&this.vs.zu(`country`,e)}setHomeCity(e){return!!F(e,`set home city`,`the homeCity`,!0)&&this.vs.zu(`home_city`,e)}setLanguage(e){return!!F(e,`set language`,`the language`,!0)&&this.vs.zu(`language`,e)}setEmailNotificationSubscriptionType(t){return!!s(e.NotificationSubscriptionTypes,t,`Email notification setting "${t}" is not a valid subscription type.`,`User.NotificationSubscriptionTypes`)&&this.vs.zu(`email_subscribe`,t)}setPushNotificationSubscriptionType(t){return!!s(e.NotificationSubscriptionTypes,t,`Push notification setting "${t}" is not a valid subscription type.`,`User.NotificationSubscriptionTypes`)&&this.vs.zu(`push_subscribe`,t)}setPhoneNumber(n){return!!F(n,`set phone number`,`the phoneNumber`,!0)&&(n===null||n.match(e.Hu)?this.vs.zu(`phone`,n):(t.error(`Cannot set phone number - "${n}" did not pass validation.`),!1))}setLastKnownLocation(e,n,r,i,a){return e==null||n==null?(t.error(`Cannot set last-known location - latitude and longitude are required.`),!1):(e=parseFloat(e.toString()),n=parseFloat(n.toString()),r!=null&&(r=parseFloat(r.toString())),i!=null&&(i=parseFloat(i.toString())),a!=null&&(a=parseFloat(a.toString())),isNaN(e)||isNaN(n)||r!=null&&isNaN(r)||i!=null&&isNaN(i)||a!=null&&isNaN(a)?(t.error(`Cannot set last-known location - all supplied parameters must be numeric.`),!1):e>90||e<-90||n>180||n<-180?(t.error(`Cannot set last-known location - latitude and longitude are bounded by ±90 and ±180 respectively.`),!1):r!=null&&r<0||a!=null&&a<0?(t.error(`Cannot set last-known location - accuracy and altitudeAccuracy may not be negative.`),!1):this.Ru.setLastKnownLocation(this.vs.getUserId(),e,n,i,r,a).W)}setCustomUserAttribute(e,t,r){if(!ue(e))return!1;let i=t=>{let[n]=me(t,C.Ku,`attribute value`,`set custom user attribute "${e}"`,`custom user attribute`);return n};if(c(t)){let[r,a]=he(e,t);if(!r&&!a&&t.length!==0)return!1;if(r||t.length===0)return this.Ru.Mu(n.Yu,e,t).W;for(let e of t)if(!i(e))return!1}else if(u(t)){if(!i(t))return!1;if(r)return this.Ru.Mu(n.Vu,e,t).W}else if(!(t!==void 0&&de(t))||(l(t)&&(t=g(t)),typeof t==`string`&&!P(t,`set custom user attribute "${e}"`,`the element in the given array`)))return!1;return this.vs.setCustomUserAttribute(e,t)}addToCustomAttributeArray(e,t){return!!P(e,`add to custom user attribute array`,`the given key`)&&!(t!=null&&!P(t,`add to custom user attribute array`,`the given value`))&&this.Ru.Mu(n.Qu,e,t).W}removeFromCustomAttributeArray(e,t){return!!P(e,`remove from custom user attribute array`,`the given key`)&&!(t!=null&&!P(t,`remove from custom user attribute array`,`the given value`))&&this.Ru.Mu(n.Xu,e,t).W}incrementCustomUserAttribute(e,r){if(!P(e,`increment custom user attribute`,`the given key`))return!1;r??=1;let i=parseInt(r.toString());return isNaN(i)||i!==parseFloat(r.toString())?(t.error(`Cannot increment custom user attribute because the given incrementValue "${r}" is not an integer.`),!1):this.Ru.Mu(n.Zu,e,i).W}setCustomLocationAttribute(e,n,r){return!!P(e,`set custom location attribute`,`the given key`)&&((n!==null||r!==null)&&(n=n==null?null:parseFloat(n.toString()),r=r==null?null:parseFloat(r.toString()),n==null&&r!=null||n!=null&&r==null||n!=null&&(isNaN(n)||n>90||n<-90)||r!=null&&(isNaN(r)||r>180||r<-180))?(t.error(`Received invalid values for latitude and/or longitude. Latitude and longitude are bounded by ±90 and ±180 respectively, or must both be null for removal.`),!1):this.Ru.Na(e,n,r).W)}addToSubscriptionGroup(n){return!F(n,`add user to subscription group`,`subscription group ID`,!1)||n.length<=0?(t.error(`addToSubscriptionGroup requires a non-empty subscription group ID`),!1):this.Ru.Ra(n,e.Pa.SUBSCRIBED).W}removeFromSubscriptionGroup(n){return!F(n,`remove user from subscription group`,`subscription group ID`,!1)||n.length<=0?(t.error(`removeFromSubscriptionGroup requires a non-empty subscription group ID`),!1):this.Ru.Ra(n,e.Pa.UNSUBSCRIBED).W}setLineId(n){return F(n,`set LINE user ID`,`the ID`,!0)&&n?.length!==0?n&&n.length>e.Oa?(t.error(`Rejected LINE user ID ${n} because it is longer than ${e.Oa}
2 characters.`),!1):this.vs.zu(`native_line_id`,n):(t.error(`setLineId requires a non-empty ID`),!1)}gu(e,t,n,r,i){this.vs.gu(e,t,n,r,i),this.Ru.Ya()}wu(e){this.vs.wu(e)}};I.Genders={MALE:`m`,FEMALE:`f`,OTHER:`o`,UNKNOWN:`u`,NOT_APPLICABLE:`n`,PREFER_NOT_TO_SAY:`p`},I.NotificationSubscriptionTypes={OPTED_IN:`opted_in`,SUBSCRIBED:`subscribed`,UNSUBSCRIBED:`unsubscribed`},I.Hu=/^[0-9 .\\(\\)\\+\\-]+$/,I.Pa={SUBSCRIBED:`subscribed`,UNSUBSCRIBED:`unsubscribed`},I.Va=`user_id`,I.Bu=`custom`,I.mr=997,I.Oa=33;var ye=class{constructor(){}ff(){}cf(){}rc(e){}static lf(e,t){if(e&&t){if(e=e.toLowerCase(),c(t.uf)){for(let n=0;n<t.uf.length;n++)if(e.indexOf(t.uf[n].toLowerCase())!==-1)return t.identity}else if(e.indexOf(t.uf.toLowerCase())!==-1)return t.identity}}},L={rO:`Chrome`,eO:`Edge`,oO:`Opera`,Bg:`Safari`,OO:`Firefox`,Sg:`ChatGPTBrowser`},R={Dg:`Android`,co:`iOS`,Pg:`Mac`,kg:`Windows`},be=class e extends ye{constructor(){if(super(),this.userAgentData=navigator.userAgentData,this.browser=null,this.version=null,this.userAgentData){let e=this.hf();this.browser=e.browser||`Unknown Browser`,this.version=e.version||`Unknown Version`}this.OS=null}ff(){return this.browser}cf(){return this.version}rc(t){if(this.OS)return Promise.resolve(this.OS);let n=n=>{for(let r=0;r<t.length;r++){let i=e.lf(n,t[r]);if(i)return this.OS=i,this.OS}return n};return this.userAgentData.platform?Promise.resolve(n(this.userAgentData.platform)):this.getHighEntropyValues().then(e=>e.platform?n(e.platform):navigator.platform).catch(()=>navigator.platform)}hf(){let e={},t=this.userAgentData.brands;if(t&&t.length)for(let n of t){let t=this.af(L),r=n.brand.match(t);if(r&&r.length>0){e.browser=r[0],e.version=n.version;break}}return e}af(e){let t=[];for(let n in e){let r=n;t.push(e[r])}return RegExp(`(`+t.join(`|`)+`)`,`i`)}getHighEntropyValues(){return this.userAgentData.getHighEntropyValues?this.userAgentData.getHighEntropyValues([`platform`]):Promise.reject()}},xe=class e extends ye{constructor(){super(),this.Vd=e.hf(navigator.userAgent||``)}ff(){return this.Vd[0]||`Unknown Browser`}cf(){return this.Vd[1]||`Unknown Version`}rc(t){for(let n=0;n<t.length;n++){let r=t[n].string,i=e.lf(r,t[n]);if(i)return i===R.Pg&&navigator.maxTouchPoints>1&&(i=R.co),Promise.resolve(i)}return Promise.resolve(navigator.platform)}static hf(e){let t,n=e.match(/(samsungbrowser|tizen|roku|konqueror|icab|crios|opera|ucbrowser|chatgptbrowser|chrome|safari|firefox|camino|msie|trident(?=\/))\/?\s*(\.?\d+(\.\d+)*)/i)||[];if(e.indexOf(`(Web0S; Linux/SmartTV)`)!==-1)return[`LG Smart TV`,null];if(e.indexOf(`CrKey`)!==-1)return[`Chromecast`,null];if(e.indexOf(`BRAVIA`)!==-1||e.indexOf(`SonyCEBrowser`)!==-1||e.indexOf(`SonyDTV`)!==-1)return[`Sony Smart TV`,null];if(e.indexOf(`PhilipsTV`)!==-1)return[`Philips Smart TV`,null];if(e.match(/\b(Roku)\b/))return[`Roku`,null];if(e.match(/\bAFTM\b/))return[`Amazon Fire Stick`,null];if(n[1]===L.rO){if(e.includes(L.Sg))return[L.Sg,n[2]];if(t=e.match(/\b(OPR|Edge|EdgA|Edg|UCBrowser)\/(\.?\d+(\.\d+)*)/),t!=null)return t=t.slice(1),t[0]=t[0].replace(`OPR`,L.oO),t[0]=t[0].replace(`EdgA`,L.eO),t[0]===`Edg`&&(t[0]=L.eO),[t[0],t[1]]}if(n[1]===L.Bg&&(t=e.match(/\b(EdgiOS)\/(\.?\d+(\.\d+)*)/),t!=null))return t=t.slice(1),t[0]=t[0].replace(`EdgiOS`,L.eO),[t[0],t[1]];if(n=n[2]?[n[1],n[2]]:[null,null],n[0]===L.Bg&&(t=e.match(/version\/(\.?\d+(\.\d+)*)/i))!=null&&n.splice(1,1,t[1]),(t=e.match(/\b(UCBrowser)\/(\.?\d+(\.\d+)*)/))!=null&&n.splice(1,1,t[2]),n[0]===L.oO&&(t=e.match(/mini\/(\.?\d+(\.\d+)*)/i))!=null)return[`Opera Mini`,t[1]||``];if(n[0]){let e=n[0].toLowerCase();e===`crios`&&(n[0]=L.rO),e===`tizen`&&(n[0]=`Samsung Smart TV`,n[1]=null),e===`samsungbrowser`&&(n[0]=`Samsung Browser`)}return n}},Se=class e{constructor(){let t;t=navigator.userAgent.toLowerCase().includes(L.Sg.toLowerCase())||!navigator.userAgentData?xe:be,this.vg=new t,this.userAgent=navigator.userAgent,this.browser=this.vg.ff(),this.version=this.vg.cf(),this.OS=null,this.rc().then(e=>this.OS=e);let n=navigator;this.language=(n.userLanguage||n.language||n.browserLanguage||n.systemLanguage||``).toLowerCase(),this.Il=e.xg(this.userAgent)}fE(){return this.browser===L.Bg}nc(){return this.OS||null}rc(){return this.OS?Promise.resolve(this.OS):this.vg.rc(e.Og).then(e=>(this.OS=e,e))}static xg(e){e=e.toLowerCase();let t=[`bot`,`slurp`,`baiduspider`,`yandex`,`facebookexternalhit`,`sogou`,`ia_archiver`,`https://github.com/prerender/prerender`,`aolbuild`,`bingpreview`,`mediapartners-google`,`teoma`,`taiko`,`facebookexternalhit`,`facebookcatalog`,`meta-webindexer`,`meta-externalads`,`meta-externalagent`,`meta-externalfetcher`];for(let n=0;n<t.length;n++)if(e.indexOf(t[n])!==-1)return!0;return!1}};Se.Og=[{string:navigator.platform,uf:`Win`,identity:R.kg},{string:navigator.platform,uf:`Mac`,identity:R.Pg},{string:navigator.platform,uf:`BlackBerry`,identity:`BlackBerry`},{string:navigator.platform,uf:`FreeBSD`,identity:`FreeBSD`},{string:navigator.platform,uf:`OpenBSD`,identity:`OpenBSD`},{string:navigator.platform,uf:`Nintendo`,identity:`Nintendo`},{string:navigator.platform,uf:`SunOS`,identity:`SunOS`},{string:navigator.platform,uf:`PlayStation`,identity:`PlayStation`},{string:navigator.platform,uf:`X11`,identity:`X11`},{string:navigator.userAgent,uf:[`iPhone`,`iPad`,`iPod`],identity:R.co},{string:navigator.platform,uf:`Pike v`,identity:R.co},{string:navigator.userAgent,uf:[`Web0S`],identity:`WebOS`},{string:navigator.userAgent,uf:`Tizen`,identity:`Tizen`},{string:navigator.userAgent,uf:`Coolita`,identity:`Other Smart TV`},{string:navigator.userAgent,uf:`WhaleTV`,identity:`Other Smart TV`},{string:navigator.platform,uf:[`Linux armv7l`,`Android`],identity:R.Dg},{string:navigator.userAgent,uf:[`Android`],identity:R.Dg},{string:navigator.platform,uf:`Linux`,identity:`Linux`}];var z=new Se,B={Ou:{Cu:`ab.storage.userId`,tl:`ab.storage.deviceId`,um:`ab.storage.sessionId`},ft:{Qc:`ab.test`,tE:`ab.storage.events`,eE:`ab.storage.attributes`,sE:`ab.storage.attributes.anonymous_user`,ac:`ab.storage.device`,Dl:`ab.storage.sdk_metadata`,Tl:`ab.storage.session_id_for_cached_metadata`,Uu:`ab.storage.pushToken`,rE:`ab.storage.cardImpressions`,jc:`ab.storage.serverConfig`,oE:`ab.storage.triggers`,nE:`ab.storage.triggers.ts`,dm:`ab.storage.messagingSessionStart`,Ps:`ab.storage.cc`,Gs:`ab.storage.ccLastFullSync`,Hs:`ab.storage.ccLastCardUpdated`,uc:`ab.storage.globalRateLimitCurrentTokenCount`,fc:`ab.storage.dynamicRateLimitCurrentTokenCount`,Jt:`ab.storage.ccClicks`,Vt:`ab.storage.ccImpressions`,Pt:`ab.storage.ccDismissals`,aE:`ab.storage.lastDisplayedTriggerTimesById`,iE:`ab.storage.lastDisplayedTriggerTime`,EE:`ab.storage.triggerFireInstancesById`,xh:`ab.storage.signature`,SE:`ab.storage.brazeSyncRetryCount`,Qs:`ab.storage.sdkVersion`,lo:`ab.storage.ff`,vo:`ab.storage.ffImpressions`,Do:`ab.storage.ff
2LastRefreshAt`,Co:`ab.storage.ff.sessionId`,lE:`ab.storage.lastReqToEndpoint`,_E:`ab.storage.requestAttempts`,Wn:`ab.storage.deferredIam`,Jl:`ab.storage.lastSdkReq`,uE:`ab.storage.alias`,vt:`ab.storage.banners`,Dt:`ab.storage.banners.impressions`,Bt:`ab.storage.banners.sessionId`,Ue:`ab.storage.dust.mite`,Ne:`ab.storage.dust.host`,Te:`ab.storage.dust.auth`,ze:`ab.storage.dust.expiration`},pe:`ab.optOut`},V=class e{constructor(e,t){this.TE=e,this.cE=t,this.TE=e,this.cE=t}Sl(t){let n=d(B.Ou),r=new e.le(t);for(let e of n)r.remove(B.Ou[e])}Iu(e,t){let n=null;t!=null&&t instanceof O&&(n=t.gt()),this.TE.store(e,n)}hE(e){let t=this.$u(e);t!=null&&(t.gm=new Date().valueOf(),this.Iu(e,t))}$u(e){let t=this.TE.jr(e),n=(e=>{let t;try{t=JSON.parse(e)}catch{t=null}return t})(t),r;if(n)r=O._u(n)||null,r&&this.Iu(e,r);else{let n=O.AE(t);r=O._u(n)||null,n!==t&&r&&this.Iu(e,r)}return r}xm(e){this.TE.remove(e)}Al(){let e=d(B.Ou),t;for(let n of e)t=this.$u(B.Ou[n]),t!=null&&this.Iu(B.Ou[n],t)}ol(e){let t;if(e==null||e.length===0)return!1;t=c(e)?e:[e];let n=this.cE.jr(B.ft.tE);n!=null&&c(n)||(n=[]);for(let e=0;e<t.length;e++)n.push(t[e].gt());return this.cE.store(B.ft.tE,n)}wm(e){return e!=null&&this.ol([e])}RE(){let e=this.cE.jr(B.ft.tE);this.cE.remove(B.ft.tE),e??=[];let t=[],r=!1,i=null;if(c(e))for(let n=0;n<e.length;n++)E.gE(e[n])?t.push(E._u(e[n])):i=n;else r=!0;if(r||i!=null){let a=`Stored events could not be deserialized as Events`;r&&(a+=`, was `+Object.prototype.toString.call(e)+` not an array`),i!=null&&(a+=`, value at index `+i+` does not look like an event`),a+=`, serialized values were of type `+typeof e+`: `+JSON.stringify(e),t.push(new E(null,n.wl,new Date().valueOf(),null,{e:a}))}return t}bt(e,t){return!!s(B.ft,e,`StorageManager cannot store object.`,`STORAGE_KEYS.OBJECTS`)&&this.cE.store(e,t)}dt(e){return!!s(B.ft,e,`StorageManager cannot retrieve object.`,`STORAGE_KEYS.OBJECTS`)&&this.cE.jr(e)}zt(e){return!!s(B.ft,e,`StorageManager cannot remove object.`,`STORAGE_KEYS.OBJECTS`)&&(this.cE.remove(e),!0)}clearData(){let e=d(B.Ou),t=d(B.ft);for(let t=0;t<e.length;t++){let n=e[t];this.TE.remove(B.Ou[n])}for(let e=0;e<t.length;e++){let n=t[e];this.cE.remove(B.ft[n])}}OE(e){return e||B.ft.sE}Xl(e){let t=this.cE.jr(B.ft.eE);t??={};let n=this.OE(e[I.Va]),r=t[n];for(let i in e)i!==I.Va&&(t[n]==null||r&&r[i]==null)&&this.Eu(e[I.Va],i,e[i])}Eu(e,t,n){let r=this.cE.jr(B.ft.eE);r??={};let i=this.OE(e),a=r[i];if(a??(a={},e!=null&&(a[I.Va]=e)),t===I.Bu){a[t]??(a[t]={});for(let e in n)a[t][e]=n[e]}else a[t]=n;return r[i]=a,this.cE.store(B.ft.eE,r)}IE(){let e=this.cE.jr(B.ft.eE);this.cE.remove(B.ft.eE);let t=[];for(let n in e)e[n]!=null&&t.push(e[n]);return t}Lu(e){let t=this.cE.jr(B.ft.eE);if(t!=null){let n=this.OE(null),r=t[n];r!=null&&(t[n]=void 0,this.cE.store(B.ft.eE,t),r[I.Va]=e,this.Xl(r))}let n=this.$u(B.Ou.um),r=null;n!=null&&(r=n.Tu);let i=this.RE();if(i!=null)for(let t=0;t<i.length;t++){let n=i[t];n.userId==null&&n.sessionId==r&&(n.userId=e),this.wm(n)}}dE(){return this.cE.bE}};V.Wc=class{constructor(e){this.tu=e,this.tu=e,this.bE=z.fE()?3:10}mE(e){return e+`.`+this.tu}store(e,n){let r={v:n};try{return localStorage.setItem(this.mE(e),JSON.stringify(r)),!0}catch(e){return t.info(`Storage failure: `+D(e)),!1}}jr(e){try{let t=null,n=localStorage.getItem(this.mE(e));return n!=null&&(t=JSON.parse(n)),t==null?null:t.v}catch(e){return t.info(`Storage retrieval failure: `+D(e)),null}}remove(e){try{localStorage.removeItem(this.mE(e))}catch(e){return t.info(`Storage removal failure: `+D(e)),!1}}},V.Xc=class{constructor(){this.KE={},this.YE=5242880,this.bE=3}store(e,n){let r={value:n},i=this.NE(n);return i>this.YE?(t.info(`Storage failure: object is ≈`+i+` bytes which is greater than the max of `+this.YE),!1):(this.KE[e]=r,!0)}NE(e){let t=[],n=[e],r=0;for(;n.length;){let e=n.pop();if(typeof e==`boolean`)r+=4;else if(typeof e==`string`)r+=2*e.length;else if(typeof e==`number`)r+=8;else if(typeof e==`object`&&t.indexOf(e)===-1){let r,i;t.push(e);for(let t in e)i=e,r=t,n.push(i[r])}}return r}jr(e){let t=this.KE[e];return t==null?null:t.value}remove(e){this.KE[e]=null}},V.le=class{constructor(e,t){this.tu=e,this.DE=t,this.tu=e,this.GE=this.CE(),this.ME=576e3,this.DE=!!t}mE(e){return this.tu==null?e:e+`.`+this.tu}CE(){let e=0,t=document.location.hostname,n=t.split(`.`);for(;e<n.length-1&&document.cookie.indexOf(`ab._gd=ab._gd`)===-1;)e++,t=`.`+n.slice(-1-e).join(`.`),document.cookie=`ab._gd=ab._gd;domain=`+t+`;`;return document.cookie=`ab._gd=;expires=`+new Date(0).toUTCString()+`;domain=`+t+`;`,t}me(){let e=new Date;return e.setTime(e.getTime()+60*this.ME*1e3),e.getFullYear()}pE(){let e=o(B.Ou),t=document.cookie.split(`;`);for(let n=0;n<t.length;n++){let r=t[n];for(;r.charAt(0)===` `;)r=r.substring(1);let i=!1;for(let t=0;t<e.length;t++)if(r.indexOf(e[t])===0){i=!0;break}if(i){let e=r.split(`=`)[0];e.indexOf(`.`+this.tu)===-1&&this.UE(e)}}}store(e,n){this.pE();let r=new Date;r.setTime(r.getTime()+60*this.ME*1e3);let i=`expires=`+r.toUTCString(),a=`domain=`+this.GE,o;o=this.DE?n:encodeURIComponent(n);let s=this.mE(e)+`=`+o+`;`+i+`;`+a+`;path=/`;return s.length>=4093?(t.info(`Storage failure: string is `+s.length+` chars which is too large to store as a cookie.`),!1):(document.cookie=s,!0)}jr(e){let n=[],r=this.mE(e)+`=`,i=document.cookie.split(`;`);for(let a=0;a<i.length;a++){let o=i[a];for(;o.charAt(0)===` `;)o=o.substring(1);if(o.indexOf(r)===0)try{let e;e=this.DE?o.substring(r.length,o.length):decodeURIComponent(o.substring(r.length,o.length)),n.push(e)}catch(n){return t.info(`Storage retrieval failure: `+D(n)),this.remove(e),null}}return n.length>0?n[n.length-1]:null}remove(e){this.UE(this.mE(e))}UE(e){let t=e+`=;expires=`+new Date(0).toUTCString();document.cookie=t,document.cookie=t+`;path=/`;let n=t+`;domain=`+this.GE;document.cookie=n,document.cookie=n+`;path=/`}},V.Jc=class{constructor(e,t,n){this.tu=e,this.vE=[],t&&this.vE.push(new V.le(e)),n&&this.vE.push(new V.Wc(e)),this.vE.push(new V.Xc)}store(e,t){let n=!0;for(let r=0;r<this.vE.length;r++)n=this.vE[r].store(e,t)&&n;return n}jr(e){for(let t=0;t<this.vE.length;t++){let n=this.vE[t].jr(e);if(n!=null)return n}return null}remove(e){new V.le(this.tu).remove(e);for(let t=0;t<this.vE.length;t++)this.vE[t].remove(e)}};
2var Ce=class{constructor(e,t,n){this.B=e,this.gh=t,this.ph=n,this.B=e,this.gh=t||!1,this.ph=n,this.Fh=new w,this.kh=0,this.fh=1}wh(){return this.gh}jh(){return this.B.dt(B.ft.xh)}setSdkAuthenticationSignature(e){let n=this.jh();this.B.bt(B.ft.xh,e);let r=i.Us.Rs;new i(r,t).setItem(r.Fs.qh,this.fh,e),n!==e&&this.Z()}yh(){this.B.zt(B.ft.xh);let e=i.Us.Rs;new i(e,t).je(e.Fs.qh,this.fh)}subscribeToSdkAuthenticationFailures(e){return this.ph.Rt(e)}Bh(e){this.ph.L(e)}Gh(){this.Fh.removeAllSubscriptions()}Hh(){this.kh+=1}Jh(){return this.kh}Z(){this.kh=0}},we=class{constructor(){}N(e){}changeUser(e=!1){}clearData(e=!1){}},Te=class{constructor(e){this.id=e,this.id=e}Hn(){let e={};return this.browser!=null&&(e.browser=this.browser),this.ec!=null&&(e.browser_version=this.ec),this.os!=null&&(e.os_version=this.os),this.resolution!=null&&(e.resolution=this.resolution),this.language!=null&&(e.locale=this.language),this.timeZone!=null&&(e.time_zone=this.timeZone),this.userAgent!=null&&(e.user_agent=this.userAgent),e}},H={BROWSER:`browser`,BROWSER_VERSION:`browserVersion`,OS:`os`,RESOLUTION:`resolution`,LANGUAGE:`language`,TIME_ZONE:`timeZone`,USER_AGENT:`userAgent`},Ee=class{constructor(e,t){this.B=e,this.tc=t,this.B=e,t??=o(H),this.tc=t}ve(e=!0){let t=this.B.$u(B.Ou.tl);t??(t=new O(r.se()),e&&this.B.Iu(B.Ou.tl,t));let n=new Te(t.Tu);for(let e=0;e<this.tc.length;e++)switch(this.tc[e]){case H.BROWSER:n.browser=z.browser;break;case H.BROWSER_VERSION:n.ec=z.version;break;case H.OS:n.os=this.rc();break;case H.RESOLUTION:n.sc=screen.width+`x`+screen.height;break;case H.LANGUAGE:n.language=z.language;break;case H.TIME_ZONE:n.timeZone=this.oc(new Date);break;case H.USER_AGENT:n.userAgent=z.userAgent}return n}rc(){if(z.nc())return z.nc();let e=this.B.dt(B.ft.ac);return e&&e.os_version?e.os_version:z.rc()}oc(e){let n=!1;if(typeof Intl<`u`&&typeof Intl.DateTimeFormat==`function`)try{if(typeof Intl.DateTimeFormat().resolvedOptions==`function`){let e=Intl.DateTimeFormat().resolvedOptions().timeZone;if(e!=null&&e!==``)return e}}catch(e){t.info(`Intl.DateTimeFormat threw an error, cannot detect user's time zone:`+D(e)),n=!0}if(n)return``;let r=e.getTimezoneOffset();return this.cc(r)}cc(e){let t=Math.trunc(e/60),n=Math.trunc(e%60),r=`GMT`;return e!==0&&(r+=e<0?`+`:`-`,r+=(`00`+Math.abs(t)).slice(-2)+`:`+(`00`+Math.abs(n)).slice(-2)),r}},De={Bl:`invalid_api_key`,zl:`blacklisted`,jl:`no_device_identifier`,Cl:`invalid_json_response`,yl:`empty_response`,__:`sdk_auth_error`},U={H:{Ze:`data`,vi:`content_cards/sync`,wo:`feature_flags/sync`,On:`template`,G:`banners/sync`},bc:e=>e?.dt(B.ft.lE),Am:e=>e?.dt(B.ft._E),Rm:(e,t)=>{e?.bt(B.ft.lE,t)},qm:(e,t)=>{e?.bt(B.ft._E,t)},Pl:(e,t)=>{if(!e||!t)return-1;let n=U.bc(e);if(n==null)return-1;let r=n[t];return r==null||isNaN(r)?-1:r},Ul:(e,t)=>{let n=1;if(!e||!t)return n;let r=U.Am(e);return r==null?n:(n=r[t],n==null||isNaN(n)?1:n)},K:(e,t,n)=>{if(!e||!t)return;let r=U.bc(e);r??={},r[t]=n,U.Rm(e,r)},xl:(e,t,n)=>{if(!e||!t)return;let r=U.Am(e);r??={},r[t]=n,U.qm(e,r)},fi:(e,t)=>{e&&t&&U.xl(e,t,1)},Zl:(e,t)=>{if(!e||!t)return;let n=U.Ul(e,t);U.xl(e,t,n+1)}},Oe={O:e=>{let n,r;try{let i=()=>{t.error(`This browser does not have any supported ajax options!`)},a=!1;if(window.XMLHttpRequest&&(a=!0),!a)return void i();n=new XMLHttpRequest;let o=t=>{typeof e.error==`function`&&e.error(n.status),typeof e.tt==`function`&&e.tt(!1,t)};n.onload=()=>{let t=!1;if(n.readyState!==4)return;t=n.status>=200&&n.status<300||n.status===304;let r=n.getAllResponseHeaders();if(t){if(typeof e.W==`function`){let t;try{t=JSON.parse(n.responseText)}catch{let t={error:n.responseText===``?De.yl:De.Cl,response:n.responseText};(0,e.W)(t,r)}t&&e.W(t,r)}typeof e.tt==`function`&&e.tt(!0,r)}else o(r)},n.onerror=()=>{o(n.getAllResponseHeaders())},n.ontimeout=()=>{o()},r=JSON.stringify(e.data),n.open(`POST`,e.url,!0),n.setRequestHeader(`Content-type`,`application/json`),n.setRequestHeader(`X-Requested-With`,`XMLHttpRequest`);let s=e.headers||[];for(let e of s)n.setRequestHeader(e[0],e[1]);n.send(r)}catch(e){t.error(`Network request error: ${D(e)}`)}}},ke=e=>{let t={},n=e.toString().split(`\r
3`);if(!n)return t;let r,i;for(let e of n)e&&(r=e.slice(0,e.indexOf(`:`)).toLowerCase().trim(),i=e.slice(e.indexOf(`:`)+1).trim(),t[r]=i);return t},Ae=class{constructor(e,t,n,r,i,a,o,s,c,l,u,d){this.eu=e,this.B=t,this.hl=n,this.vs=r,this.C=i,this.h=a,this.tu=o,this.al=s,this.sl=c,this.rl=l,this.appVersion=u,this.vl=d,this.Rl=e=>e==null?``:`${e} `,this.eu=e,this.B=t,this.hl=n,this.vs=r,this.C=i,this.h=a,this.tu=o,this.al=s,this.sl=c,this.rl=l,this.appVersion=u,this.vl=d,this.bl=[`npm`],this.ql={}}$(e,t=!1,n=!1){let r=this.eu.ve(!n),i=r.Hn();f(this.B.dt(B.ft.ac),i)||(e.device=i),e.api_key=this.tu,e.time=p(new Date().valueOf(),!0);let a=this.B.dt(B.ft.Dl)||[],o=this.B.dt(B.ft.Tl)||``;this.bl.length>0&&(!f(a,this.bl)||o!==this.C.yt())&&(e.sdk_metadata=this.bl),e.sdk_version=this.sl,this.rl&&(e.sdk_flavor=this.rl),e.app_version=this.appVersion,e.app_version_code=this.vl,e.device_id=r.id;let s=this.vs.getUserId();if(t&&s!==null&&(e.user_id=s),!s&&!this.hl.wh()){let t=T(this.B);t&&(e.alias=t)}return e}Y(e,r,i){let a=r.auth_error,o=r.error;if(!a&&!o)return!0;
3if(a){let n;this.hl.Hh();let r={errorCode:a.error_code};for(let e of i)c(e)&&e[0]===`X-Braze-Auth-Signature`&&(r.signature=e[1]);e.respond_with&&e.respond_with.user_id?r.userId=e.respond_with.user_id:e.user_id&&(r.userId=e.user_id);let o=a.reason;return o?(r.reason=o,n=`due to ${o}`):n=`with error code ${a.error_code}.`,this.hl.wh()||(n+=` Please use the "enableSdkAuthentication" initialization option to enable authentication.`),t.error(`SDK Authentication failed ${n}`),this.kl(e.events||[],e.attributes||[]),this.hl.Bh(r),!1}if(o){let i,a=o;switch(a){case De.yl:return i=`Received successful response with empty body.`,$.lt(n.wl,{e:i}),t.info(i),!1;case De.Cl:return i=`Received successful response with invalid JSON`,$.lt(n.wl,{e:i+`: `+r.response}),t.info(i),!1;case De.Bl:a=`The API key "${e.api_key}" is invalid for the baseUrl ${this.al}`;break;case De.zl:a=`Sorry, we are not currently accepting your requests. If you think this is in error, please contact us.`;break;case De.jl:a=`No device identifier. Please contact [email protected]`}t.error(`Backend error: `+a)}return!1}Ml(e,t,n){return!!(e&&e.length!==0||t&&t.length!==0||n)}$l(e,t,n,r=!1){let i=[],a=e=>e||``,o=a(this.vs.getUserId()),s=this.Xn(e),c=[],l=[],u,d=null;if(t.length>0){let e=[];for(let n of t){if(u=n.Hn(),this.hl.wh()){if(o&&!u.user_id){d||={},d.events||(d.events=[]),d.events.push(u);continue}if(a(u.user_id)!==o){l.push(u);continue}}e.push(u)}e.length>0&&(s.events=e)}if(n.length>0){let e=[];for(let t of n)t&&(this.hl.wh()&&a(t.user_id)!==o?c.push(t):e.push(t));e.length>0&&(s.attributes=e)}if(this.kl(l,c),s=this.$(s,!1,r),d){d=this.$(d,!1,r);let e={requestData:d,headers:this.A(d,U.H.Ze)};i.push(e)}if(s&&!this.Ml(s.events,s.attributes,e))return d?i:null;let f={requestData:s,headers:this.A(s,U.H.Ze)};return i.push(f),i}kl(e,t){if(e){let t=[];for(let n of e){let e=E.fromJson(n);e.time=m(e.time),t.push(e)}this.B.ol(t)}if(t)for(let e of t)this.B.Xl(e)}_(e,n){let r=`HTTP error `;e!=null&&(r+=e+` `),r+=n,t.error(r)}Ll(e){return $.lt(n.Fl,{n:e})}Xn(e,t){let n={};e&&(n.triggers=!0);let r=t??this.vs.getUserId();if(r&&(n.user_id=r),!n.user_id&&!this.hl.wh()){let e=T(this.B);e&&(n.alias=e)}return n.config={config_time:this.h.xt()},{respond_with:n}}Kl(e){let t=new Date().valueOf(),n=ee.toString(),r=U.Pl(this.B,e);return r!==-1&&(n=(t-r).toString()),n}A(e,t,n=!1){let r=[[`X-Braze-Api-Key`,this.tu]],i=this.Kl(t);r.push([`X-Braze-Last-Req-Ms-Ago`,i]);let a=U.Ul(this.B,t).toString();r.push([`X-Braze-Req-Attempt`,a]);let o=!1;if(e.respond_with!=null&&e.respond_with.triggers&&(r.push([`X-Braze-TriggersRequest`,`true`]),o=!0),t===U.H.vi){r.push([`X-Braze-ContentCardsRequest`,`true`]);let e=U.Ul(this.B,U.H.vi);e&&!n||(e=1,U.xl(this.B,U.H.vi,e));let t=Math.max(0,e-1);r.push([`BRAZE-SYNC-RETRY-COUNT`,t.toString()]),o=!0}if(t===U.H.wo&&(r.push([`X-Braze-FeatureFlagsRequest`,`true`]),o=!0),o&&r.push([`X-Braze-DataRequest`,`true`]),this.hl.wh()){let e=this.hl.jh();e!=null&&r.push([`X-Braze-Auth-Signature`,e])}return r}Hl(e,n,r,i){if(this.ql[i])return;let a=window.setTimeout(()=>{t.info(`Retrying rate limited ${this.Rl(i)}SDK request.`),this.J(n,r,i)},e);this.ql[i]=a}fo(){for(let e in this.ql){let t=this.ql[e];window.clearTimeout(t)}this.ql={}}J(e,n,r,i){if(!this.Ol(r))return t.info(`${this.Rl(r)}SDK request being rate limited.`),void(typeof i==`function`&&i());let a=this.Gl();if(!a.Wl)return this.Hl(a.Yl,e,n,r),void t.info(`${this.Rl(r)}SDK request being rate limited. Request will be retried in ${Math.trunc(a.Yl/1e3)} seconds.`);this.B.bt(B.ft.Jl,new Date().valueOf());let o=e.device;o&&o.os_version instanceof Promise?o.os_version.then(t=>{e.device.os_version=t,n(a.Ql)}):n(a.Ql)}Vl(e){let t=e?ke(e):null;if(!t||!t[`retry-after`])return null;let r=t[`retry-after`];return isNaN(r)&&!isNaN(Date.parse(r))?{type:`date`,value:Date.parse(r)}:isNaN(parseFloat(r.toString()))?($.lt(n.wl,{e:`Received unexpected value for retry-after header in /sync response: `+r}),null):{type:`timestamp`,value:1e3*parseFloat(r.toString())}}et(e,t,n,r,i,a){if(U.Ul(this.B,n)>=15)return;let o;a||=0;let s=this.Vl(e);i();let c=e=>{r(window.setTimeout(()=>{t()},e)),U.Zl(this.B,n)};if(s&&!isNaN(s.value)){switch(s.type){case`date`:o=s.value-new Date().getTime()+a,o<0&&t();break;case`timestamp`:o=s.value+a}c(o)}else a?c(a):U.fi(this.B,n)}hc(e){var t;(t=this.B)==null||t.bt(B.ft.uc,e)}lc(e,t){let n=this.dc();n??={},n[e]=t,this.B.bt(B.ft.fc,n)}mc(){return this.B?.dt(B.ft.uc)}dc(){return this.B?.dt(B.ft.fc)}vc(e,t,n,r,i=``){let a;if(i){let e=this.dc();a=e==null||isNaN(e[i])?t:e[i]}else a=this.mc(),(a==null||isNaN(a))&&(a=t);let o=(e-r)/1e3;return a=Math.min(a+o/n,t),a}Rc(e,t){return Math.max(0,(1-e)*t*1e3)}gc(e,t=``){let n={Wl:!0,Ql:-1,Yl:0};if(e??=!0,!e&&!t)return n;let r,i,a=null;if(e)a=this.B?.dt(B.ft.Jl);else{let e=U.bc(this.B);if(e==null||e[t]==null)return n;a=e[t]}
3if(a==null||isNaN(a)||(e?(r=this.h?.qc()||-1,i=this.h?.Ac()||-1):(r=this.h?.Dc(t)||-1,i=this.h?.Tc(t)||-1),r===-1||i===-1))return n;let o=new Date().valueOf(),s=this.vc(o,r,i,a,t);return s<1?(n.Wl=!1,n.Yl=this.Rc(s,i),n):(s=Math.trunc(s)-1,n.Ql=s,e?this.hc(s):this.lc(t,s),n)}Gl(){return this.gc(!0)}Ol(e){let t=this.gc(!1,e);return!(t&&!t.Wl)}Z(){this.hl.Z()}V(){return this.al}addSdkMetadata(e){for(let t of e)this.bl.indexOf(t)===-1&&this.bl.push(t)}},je=(e,t)=>(e=Math.ceil(e),t=Math.floor(t),Math.floor(Math.random()*(t-e+1))+e),Me=class{constructor(e=!1,t=[]){this.W=e,this.Ee=t,this.W=e,this.Ee=t}Yt(e){this.W=this.W&&e.W,this.Ee.push(...e.Ee)}},W={cu:()=>`serviceWorker`in navigator&&typeof ServiceWorkerRegistration<`u`&&`showNotification`in ServiceWorkerRegistration.prototype&&`PushManager`in window,lu:()=>`safari`in window&&`pushNotification`in window.safari&&typeof window.safari.pushNotification.permission==`function`&&typeof window.safari.pushNotification.requestPermission==`function`,isPushSupported:()=>W.cu()||W.lu(),isPushBlocked:()=>{let e=W.isPushSupported()&&`Notification`in window&&window.Notification!=null&&window.Notification.permission!=null&&window.Notification.permission===`denied`,t=W.isPushSupported()&&(!(`Notification`in window)||window.Notification==null);return e||t},isPushPermissionGranted:()=>W.isPushSupported()&&`Notification`in window&&window.Notification!=null&&window.Notification.permission!=null&&window.Notification.permission===`granted`,En:()=>W.isPushBlocked()?{Gn:!1,reason:`blocked`}:W.isPushSupported()?W.isPushPermissionGranted()?{Gn:!1,reason:`permissionGranted`}:{Gn:!0}:{Gn:!1,reason:`unsupported`},Nn:(e,t)=>e===`blocked`?`${t} containing a push prompt is not being shown because the user has already declined push permission prompt.`:e===`unsupported`?`${t} containing a push prompt is not being shown because the browser doesn't support push notifications.`:`${t} containing a push prompt is not being shown because the user has already accepted the permission prompt.`},Ne={sS:`inAppMessage must be an InAppMessage object`,eS:`ab-pause-scrolling`};function Pe(){let e=document.querySelectorAll(`.ab-iam-root`);for(let t=0;t<e.length;t++){let n=e[t];if(n.id){let e=n.id+`-css`,t=document.getElementById(e);t&&t.parentNode&&t.parentNode.removeChild(t)}n.parentNode&&n.parentNode.removeChild(n)}let t=document.getElementsByClassName(Ne.eS);for(let e=0;e<t.length;e++){let n=t[e].classList;n.contains(Ne.eS)&&n.remove(Ne.eS)}}var Fe=class{constructor(e,t,n,r,i,a,o,s,c,l){this.tu=e,this.baseUrl=t,this.C=n,this.eu=r,this.vs=i,this.h=a,this.B=o,this.$c=s,this.hl=c,this.j=l,this.tu=e,this.baseUrl=t,this.Zc=0,this.bE=o.dE()||0,this.sd=null,this.C=n,this.eu=r,this.vs=i,this.h=a,this.B=o,this.hl=c,this.j=l,this.$c=s,this.hd=new w,this.nd=null,this.rd=50,this.ld=!1,this.ud=!1}ad(e,t){return!e&&!t&&this.hl.Jh()>=this.rd}md(e){let t=this.C.am();if(e.length>0){let r=this.vs.getUserId();for(let i of e){let e=!i.userId&&!r||i.userId===r;i.type===n.Sm&&e&&(t=!0)}}return t}fd(e=!1,n=!0,r,i,a,o=!1,s=!1){n&&this.gd();let c=this.B.RE(),l=this.B.IE(),u=!1,d=(e,t,o=-1)=>{let s=new Date().valueOf();U.K(this.B,U.H.Ze,s),o!==-1&&t.push([`X-Braze-Req-Tokens-Remaining`,o.toString()]);let c=!1;Oe.O({url:this.baseUrl+`/data/`,data:e,headers:t,W:n=>{e.respond_with!=null&&e.respond_with.triggers&&(this.Zc=Math.max(this.Zc-1,0)),this.j.Y(e,n,t)?(this.hl.Z(),this.h.Sc(n),e.respond_with!=null&&e.respond_with.user_id!=this.vs.getUserId()||(e.device!=null&&this.B.bt(B.ft.ac,e.device),e.sdk_metadata!=null&&(this.B.bt(B.ft.Dl,e.sdk_metadata),this.B.bt(B.ft.Tl,this.C.yt())),this.$c(n),U.xl(this.B,U.H.Ze,1),typeof r==`function`&&r())):n.auth_error&&(c=!0)},error:()=>{c=!0,e.respond_with!=null&&e.respond_with.triggers&&(this.Zc=Math.max(this.Zc-1,0)),this.j.kl(e.events,e.attributes),typeof i==`function`&&i()},tt:(e,t)=>{typeof a==`function`&&a(!c);let r=this.j.Vl(t),i=0;if(r)switch(r.type){case`date`:i=Math.max(r.value-new Date().valueOf(),0);break;case`timestamp`:i=r.value}if(n&&!u){if(c){U.Zl(this.B,U.H.Ze);let e=this.h.st(),t=this.h.it(),n=this.h.nt(),r=this.sd;(r==null||r<e)&&(r=e);let a=Math.min(n,je(e,r*t))+i;this.pd(a)}
3else this.pd(Math.max(1e3*this.bE,i));u=!0}}})},f=this.md(c),p=e||f;if(this.ad(o,f))return void t.info(`Declining to flush data due to 50 consecutive authentication failures`);if(n&&!this.j.Ml(c,l,p))return this.pd(),void(typeof a==`function`&&a(!0));let m=this.j.$l(p,c,l,s);p&&this.Zc++;let h=!1;if(m)for(let e of m)this.j.J(e.requestData,t=>d(e.requestData,e.headers,t),U.H.Ze,i),h=!0;this.hl.wh()&&n&&!h?this.pd():f&&(t.info(`Invoking new session subscriptions`),this.hd.L(),this.ud=!0)}vd(){return this.Zc>0}pd(e=1e3*this.bE){this.ld||(this.gd(),this.nd=window.setTimeout(()=>{if(document.hidden){let e=`visibilitychange`,t=()=>{document.hidden||(document.removeEventListener(e,t,!1),this.fd())};document.addEventListener(e,t,!1)}else this.fd()},e),this.sd=e)}gd(){this.nd!=null&&(clearTimeout(this.nd),this.nd=null)}initialize(){this.ld=!1,this.pd()}destroy(){this.hd.removeAllSubscriptions(),this.hl.Gh(),this.gd(),this.ld=!0,this.fd(void 0,!1,void 0,void 0,void 0,void 0,!0),this.nd=null,this.ud=!1}rn(e){return this.ud?(e(),null):this.hd.Rt(e)}openSession(){let n=this.C.yt()!==this.C.el();n&&(this.B.hE(B.Ou.tl),this.B.hE(B.Ou.Cu)),this.fd(!1,void 0,()=>{n&&(this.B.zt(B.ft.vo),this.B.zt(B.ft.Dt))}),this.Ya(),n&&e(()=>import(`./push-manager-factory-BES9xuZF.js`).then(e=>e.t).then(e=>{if(this.ld)return;let n=e.default.ra();if(n!=null&&(W.isPushPermissionGranted()||W.isPushBlocked())){let e=()=>{n.du()?t.info(`Push token maintenance is disabled, not refreshing token for backend.`):n.subscribe()},r=(t,n)=>{n&&e()},a=()=>{let t=this.B.dt(B.ft.Uu);(t==null||t)&&e()},o=i.Us.Rs;new i(o,t).kr(o.Fs.Fu,r,a)}}),__vite__mapDeps([0,1]))}bd(){this.B.zt(B.ft.lo),this.B.zt(B.ft.Ps),this.B.zt(B.ft.Wn)}wd(){this.B.zt(B.ft.Jl),this.B.zt(B.ft.lE);let e=U.H;for(let t in e){let n=e[t];this.j.lc(n,this.h?.Dc(n))}this.j.hc(this.h?.qc())}changeUser(e,n,r){let i=this.vs.getUserId();if(i!==e){this.C.jm(),this.bd(),Pe(),i!=null&&this.fd(void 0,!1,void 0,void 0,void 0),this.vs.Ju(e),r?this.hl.setSdkAuthenticationSignature(r):this.hl.yh();for(let e=0;e<n.length;e++)n[e].changeUser(i==null);this.j.fo(),i!=null&&this.B.zt(B.ft.rE),this.B.zt(B.ft.ac),this.B.zt(B.ft.uE),this.wd(),this.openSession(),t.info(`Changed user to "`+e+`".`)}else{let n=`Doing nothing.`;r&&this.hl.jh()!==r&&(this.hl.setSdkAuthenticationSignature(r),n=`Updated SDK authentication signature`),t.info(`Current user is already ${e}. ${n}`)}}requestImmediateDataFlush(e){this.gd(),this.C.el(),this.fd(void 0,void 0,void 0,()=>{t.error(`Failed to flush data, request will be retried automatically.`)},e,!0)}yr(e,n){this.C.el(),t.info(`Requesting explicit trigger refresh.`),this.fd(!0,void 0,e,n)}Gu(e,r){let i=n.kd,a={a:e,l:r},o=$.lt(i,a);return o&&(t.info(`Logged alias ${e} with label ${r}`),this.B.bt(B.ft.uE,a)),o}Mu(e,n,r){if(this.h.qu(n))return t.info(`Custom Attribute "${n}" is blocklisted, ignoring.`),new Me;let i={key:n,value:r},a=$.lt(e,i);if(a){let e=typeof r==`object`?JSON.stringify(r,null,2):r;t.info(`Logged custom attribute: ${n} with value: ${e}`)}return a}setLastKnownLocation(e,r,i,a,o,s){let c={latitude:r,longitude:i};a!=null&&(c.altitude=a),o!=null&&(c.ll_accuracy=o),s!=null&&(c.alt_accuracy=s);let l=$.lt(n.yd,c,e||void 0);return l&&t.info(`Set user last known location as ${JSON.stringify(c,null,2)}`),l}$r(e,t){let r=this.C.el();return new E(this.vs.getUserId(),n.jd,e,r,{cid:t})}Sd(e,t){return new i(e,t)}Ya(){let e=i.Us.Rs;this.Sd(e,t).setItem(e.Fs.Ze,1,{baseUrl:this.baseUrl,data:{api_key:this.tu,device_id:this.eu.ve().id},userId:this.vs.getUserId(),sdkAuthEnabled:this.hl.wh()})}Fr(e){for(let n of e)if(n.api_key===this.tu)this.j.kl(n.events,n.attributes);else{let e=i.Us.Rs;new i(e,t).setItem(e.Fs.zr,r.se(),n)}}Na(e,r,i){if(this.h.qu(e))return t.info(`Custom Attribute "${e}" is blocklisted, ignoring.`),new Me;let a,o;return r===null&&i===null?(a=n.Ad,o={key:e}):(a=n.Dd,o={key:e,latitude:r,longitude:i}),$.lt(a,o)}Ra(e,t){let r={group_id:e,status:t};return $.lt(n.$d,r)}},Ie=class e{constructor(e=0,t=[],n=[],r=[],i=null,a=null,o={enabled:!1},s={enabled:!1,refresh_rate_limit:void 0},c={enabled:!0,capacity:30,refill_rate:30,endpoint_overrides:{}},l=null,u=null,d=null){this.kc=e,this.Ic=t,this.Kc=n,this.Pc=r,this.Oc=i,this.xc=a,this.Gc=o,this.Xr=s,this.Nc=c,this.banners=l,this.dust=u,this.Hc=d,this.kc=e,this.Ic=t,this.Kc=n,this.Pc=r,this.Oc=i,this.xc=a,this.Gc=o,this.Xr=s,this.Nc=c,this.banners=l,this.dust=u,this.Hc=d}gt(){return{s:`6.5.0`,l:this.kc,e:this.Ic,a:this.Kc,p:this.Pc,m:this.Oc,v:this.xc,c:this.Gc,f:this.Xr,grl:this.Nc,b:this.banners,d:this.dust,rb:this.Hc}}static _u(t){let n=t.l;return t.s!==`6.5.0`&&(n=0),new e(n,t.e,t.a,t.p,t.m,t.v,t.c,t.f,t.grl,t.b,t.d,t.rb)}},Le=class{constructor(e){this.B=e,this.B=e,this.Ec=new w,this.Bc=new w,this.wc=new w,this.Cc=new w,this.yc=new w,this.Fc=null,this.Lc=null}Mc(){if(this.Lc==null){let e=this.B.dt(B.ft.jc);this.Lc=e==null?new Ie:Ie._u(e)}return this.Lc}xt(){return this.Mc().kc}Sc(e){if(e!=null&&e.config!=null){let t=e.config;if(t.time>this.Mc().kc){let e=new Ie(t.time,t.events_blacklist,t.attributes_blacklist,t.purchases_blacklist,t.messaging_session_timeout,t.vapid_public_key,t.content_cards,t.feature_flags,(e=>e??this.Mc().Nc)(t.global_request_rate_limit),t.banners,t.dust,t.request_backoff),n=!1;e.xc!=null&&this.ju()!==e.xc&&(n=!0);let r=!1;e.Gc.enabled!=null&&this.wi()!==e.Gc.enabled&&(r=!0);let i=!1;e.Xr.enabled!=null&&this.Yr()!==e.Xr.enabled&&(i=!0);let a=!1;e.banners?.enabled!=null&&this.kt()!==e.banners?.enabled&&(a=!0);let o=!1;e.dust?.enabled!=null&&this.Ye()!==e.dust?.enabled&&(o=!0),this.Lc=e,this.B.bt(B.ft.jc,e.gt()),n&&this.Ec.L(),r&&this.Bc.L(),i&&this.wc.L(),a&&this.Cc.L(),o&&this.yc.L()}}}xu(e){let t=this.Ec.Rt(e);return this.Fc&&this.Ec.removeSubscription(this.Fc),this.Fc=t,t}Ci(e){return this.Bc.Rt(e)}jo(e){return this.wc.Rt(e)}P(e){return this.Cc.Rt(e)}Tr(e){return this.yc.Rt(e)}Ce(e){return this.Mc().Ic.indexOf(e)!==-1}qu(e){return this.Mc().Kc.indexOf(e)!==-1}Dr(e){return this.Mc().Pc.indexOf(e)!==-1}_c(){return this.Mc().Oc}ju(){return this.Mc().xc}wi(){return this.Mc().Gc.enabled||!1}Vc(){let e=this.Mc().Nc;return!(!e||e.enabled==null)&&e.enabled}qc(){if(!this.Vc())return-1;let e=this.Mc().Nc;return e.capacity==null||e.capacity<10?-1:e.capacity}Ac(){if(!this.Vc())return-1;let e=this.Mc().Nc;return e.refill_rate==null||e.refill_rate<=0?-1:e.refill_rate}zc(e){let t=this.Mc().Nc.endpoint_overrides;return t==null?null:t[e]}Dc(e){let t=this.zc(e);return t==null||isNaN(t.capacity)||t.capacity<=0?-1:t.capacity}Tc(e){let t=this.zc(e);return t==null||isNaN(t.refill_rate)||t.refill_rate<=0?-1:t.refill_rate}Yr(){return this.Mc().Xr.enabled&&this.yo()==null?($.lt(n.wl,{e:`Missing feature flag refresh_rate_limit.`}),!1):this.Mc().Xr.enabled||!1}yo(){return this.Mc().Xr.refresh_rate_limit}kt(){return this.Mc().banners?.enabled||null}oe(){return this.Mc().banners?.max_placements||0}Ye(){return this.Mc().dust?.enabled||!1}st(){return this.Mc().Hc?.min_sleep_duration_ms??x}it(){return this.Mc().Hc?.scale_factor??3}nt(){return this.Mc().Hc?.max_sleep_duration_ms??S}},Re=class{constructor(e,n,r,i){this.B=e,this.vs=n,this.h=r,this.tm=i,this.B=e,this.vs=n,this.h=r,this.im=1e3,(i==null||isNaN(i))&&(i=1800),i<this.im/1e3&&(t.info(`Specified session timeout of `+i+`s is too small, using the minimum session timeout of `+this.im/1e3+`s instead.`),i=this.im/1e3),this.tm=i}nm(e,t){return new E(this.vs.getUserId(),n.hm,e,t.Tu,{d:p(e-t.lm)})}yt(){let e=this.B.$u(B.Ou.um);return e==null?null:e.Tu}am(){let e=new Date().valueOf(),t=this.h._c();if(t==null)return!1;let n=this.B.dt(B.ft.dm),r=n==null||e-n>1e3*t;return r&&this.B.bt(B.ft.dm,e),r}fm(e,t){return t==null||t.pm==null||!(e-t.lm<this.im)&&t.pm<e}el(){let e=new Date().valueOf(),i=e+1e3*this.tm,a=this.B.$u(B.Ou.um);if(this.fm(e,a)){let o=`Generating session start event with time `+e;if(a!=null){let e=a.gm;e-a.lm<this.im&&(e=a.lm+this.im),this.B.wm(this.nm(e,a)),o+=` (old session ended `+e+`)`}o+=`. Will expire `+i.valueOf(),t.info(o);let s=new O(r.se(),i);return this.B.wm(new E(this.vs.getUserId(),n.Sm,e,s.Tu)),this.B.Iu(B.Ou.um,s),this.B.dt(B.ft.dm)??this.B.bt(B.ft.dm,e),s.Tu}if(a!=null)return a.gm=e,a.pm=i,this.B.Iu(B.Ou.um,a),a.Tu}jm(){let e=this.B.$u(B.Ou.um);e!=null&&(this.B.xm(B.Ou.um),this.B.wm(this.nm(new Date().valueOf(),e)))}},ze={_l:function(e,n=!1){let r=!1;try{if(localStorage&&localStorage.getItem)try{localStorage.setItem(B.ft.Qc,`true`),localStorage.getItem(B.ft.Qc)&&(localStorage.removeItem(B.ft.Qc),r=!0)}catch(e){if(!(e instanceof Error&&(e.name===`QuotaExceededError`||e.name===`NS_ERROR_DOM_QUOTA_REACHED`)&&localStorage.length>0))throw e;r=!0}}catch{t.info(`Local Storage not supported!`)}let i=ze.Uc(),a=new V.Jc(e,i&&!n,r),o;return o=r?new V.Wc(e):new V.Xc,new V(a,o)},Uc:function(){return navigator.cookieEnabled||`cookie`in document&&(document.cookie.length>0||(document.cookie=`test`).indexOf.call(document.cookie,`test`)>-1)}},Be=class e{constructor(e,t){this.triggerId=e,this.messageExtras=t,this.triggerId=e,this.messageExtras=t,this.extras={}
3,this.isControl=!0,this.Gt=!1}static fromJson(t){return new e(t.trigger_id,t.message_extras)}Wt(){return!this.Gt&&(this.Gt=!0,!0)}sm(){return this.Gt}};function Ve(e,t=!1,n=!1,r=!1){if(e==null)return!1;t||=!1,n||=!1;let i=e.getBoundingClientRect();return i!=null&&(i.top>=0&&i.top<=(window.innerHeight||document.documentElement.clientHeight)||!t)&&(i.left>=0||!r)&&(i.bottom>=0&&i.bottom<=(window.innerHeight||document.documentElement.clientHeight)||!n)&&(i.right<=(window.innerWidth||document.documentElement.clientWidth)||!r)}var He={lp:null,td:Ve},Ue={Uo:`up`,Vo:`down`,de:`left`,ce:`right`};function We(){if(He.lp==null){He.lp=!1;try{let e=Object.defineProperty({},"passive",{get:()=>{He.lp=!0}});window.addEventListener(`testPassive`,()=>{},e),window.removeEventListener(`testPassive`,()=>{},e)}catch(e){t.error(D(e))}}return He.lp}function Ge(e,t,n=()=>{}){e.addEventListener(t,n,!!We()&&{passive:!0})}function Ke(e){if(e.onclick){let t=document.createEvent(`MouseEvents`);t.initEvent(`click`,!0,!0),e.onclick.apply(e,[t])}}function qe(e,t,n){let r=null,i=null;Ge(e,`touchstart`,e=>{r=e.touches[0].clientX,i=e.touches[0].clientY}),Ge(e,`touchmove`,a=>{if(r==null||i==null)return;let o=r-a.touches[0].clientX,s=i-a.touches[0].clientY;Math.abs(o)>Math.abs(s)&&Math.abs(o)>=25?((o>0&&t===Ue.de||o<0&&t===Ue.ce)&&n(a),r=null,i=null):Math.abs(s)>=25&&((s>0&&t===Ue.Uo&&e.scrollTop===e.scrollHeight-e.offsetHeight||s<0&&t===Ue.Vo&&e.scrollTop===0)&&n(a),r=null,i=null)})}function Je(e,t,n){let r=`http://www.w3.org/2000/svg`,i=document.createElementNS(r,`svg`);i.setAttribute(`viewBox`,e),i.setAttribute(`xmlns`,r);let a=document.createElementNS(r,`path`);return a.setAttribute(`d`,t),n!=null&&a.setAttribute(`fill`,n),i.appendChild(a),i}var Ye={Ho:32,Wo:9,Go:13,Ih:27},Xe=e=>e!==null&&e.tagName===`IFRAME`,G=class e{constructor(t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,ee,x,S,C,T,E,D,O,k,A,j,M){this.message=t,this.messageAlignment=n,this.slideFrom=r,this.extras=i,this.triggerId=a,this.clickAction=o,this.uri=s,this.openTarget=c,this.dismissType=l,this.duration=u,this.icon=d,this.imageUrl=f,this.imageStyle=p,this.iconColor=m,this.iconBackgroundColor=h,this.backgroundColor=g,this.textColor=_,this.closeButtonColor=v,this.animateIn=y,this.animateOut=b,this.header=ee,this.headerAlignment=x,this.headerTextColor=S,this.frameColor=C,this.buttons=T,this.cropType=E,this.orientation=D,this.htmlId=O,this.css=k,this.messageExtras=A,this.language=j,this.altImageText=M,this.message=t,this.messageAlignment=n||e.TextAlignment.CENTER,this.duration=u||5e3,this.slideFrom=r||e.SlideFrom.BOTTOM,this.extras=i||{},this.triggerId=a,this.clickAction=o||e.ClickAction.NONE,this.uri=s,this.openTarget=c||e.OpenTarget.NONE,this.dismissType=l||e.DismissType.AUTO_DISMISS,this.icon=d,this.imageUrl=f,this.imageStyle=p||e.ImageStyle.TOP,this.iconColor=m||e.th.ih,this.iconBackgroundColor=h||e.th.sh,this.backgroundColor=g||e.th.ih,this.textColor=_||e.th.hh,this.closeButtonColor=v||e.th.eh,this.animateIn=y,this.animateIn??=!0,this.animateOut=b,this.animateOut??=!0,this.header=ee,this.headerAlignment=x||e.TextAlignment.CENTER,this.headerTextColor=S||e.th.hh,this.frameColor=C||e.th.Eh,this.buttons=T||[],this.cropType=E||e.CropType.FIT_CENTER,this.orientation=D,this.htmlId=O,this.css=k,this.isControl=!1,this.messageExtras=A,this.language=j,this.altImageText=M,this.nh=!1,this.Gt=!1,this.dd=!1,this.Th=!1,this.qo=null,this.$o=null,this.ti=new w,this.oh=new w,this.Io=e.TextAlignment.CENTER}subscribeToClickedEvent(e){return this.ti.Rt(e)}subscribeToDismissedEvent(e){return this.oh.Rt(e)}removeSubscription(e){this.ti.removeSubscription(e),this.oh.removeSubscription(e)}removeAllSubscriptions(){this.ti.removeAllSubscriptions(),this.oh.removeAllSubscriptions()}closeMessage(){this.ll(this.qo)}zo(){return!0}od(){return this.zo()}_o(){return this.htmlId!=null&&this.htmlId.length>4}Mo(){return this._o()&&this.css!=null&&this.css.length>0}Oo(){if(this._o()&&this.Mo())return this.htmlId+`-css`}Wt(){return!this.Gt&&(this.Gt=!0,!0)}sm(){return this.Gt}$t(e){return!this.dd&&(this.dd=!0,this.ti.L(),!0)}Ot(){return!this.Th&&(this.Th=!0,this.oh.L(),!0)}hide(t){if(t&&t.parentNode){let n=t.closest(`.ab-iam-root`);if(n??=t,this.zo()&&n.parentNode!=null){let t=n.parentNode.classList;t&&t.contains(Ne.eS)&&t.remove(Ne.eS),document.body.removeEventListener(`touchmove`,e.rh)}n.className=n.className.replace(e.lh,e.uh)}return this.animateOut||!1}ll(t,n){if(t==null)return;let r;this.qo=null,r=t.className.indexOf(`ab-in-app-message`)===-1?t.getElementsByClassName(`ab-in-app-message`)[0]:t;let i=!1;r&&(i=this.hide(r));let a=document.body,o;a!=null&&(o=a.scrollTop);let s=()=>
3{if(t&&t.parentNode){let e=t.closest(`.ab-iam-root`);e??=t,e.parentNode&&e.parentNode.removeChild(e)}let e=this.Oo();if(e!=null){let t=document.getElementById(e);t&&t.parentNode&&t.parentNode.removeChild(t)}a!=null&&z.browser===`Safari`&&(a.scrollTop=o),n?n():this.Ot()};i?setTimeout(s,e.hr):s(),this.$o&&this.$o.focus()}No(){return document.createTextNode(this.message||``)}Jo(e){e.setAttribute(`alt`,this.altImageText||``)}static rh(e){if(e.targetTouches&&e.targetTouches.length>1)return;let t=e.target;t&&t.classList&&t.classList.contains(`ab-message-text`)&&t.scrollHeight>t.clientHeight||document.querySelector(`.${Ne.eS}`)&&e.cancelable&&e.preventDefault()}ah(t){let n=t.parentNode;this.zo()&&n!=null&&this.orientation!==e.Orientation.LANDSCAPE&&(n.classList!=null&&n.classList.add(Ne.eS),document.body.addEventListener(`touchmove`,e.rh,!!We()&&{passive:!1})),t.className+=` `+e.lh}static Ah(e){if(e.keyCode===Ye.Ih&&!Q.re(Z.Oh)&&document.querySelectorAll(`.ab-modal-interactions`).length>0){let e=document.getElementsByClassName(`ab-html-message`),t=!1;for(let n of e){let e=null;Xe(n)&&n.contentWindow&&(e=n.contentWindow.document.getElementsByClassName(`ab-programmatic-close-button`)[0]),e!=null&&(Ke(e),t=!0)}if(!t){let e=document.querySelectorAll(`.ab-modal-interactions > .ab-close-button`)[0];e!=null&&Ke(e)}}}Lh(){this.nh||Q.re(Z.Oh)||(document.addEventListener(`keydown`,e.Ah,!1),Q.mh(()=>{document.removeEventListener(`keydown`,e.Ah)}),this.nh=!0)}gt(t){let n={};return t?(n[e.ss.pa]=this.message,n[e.ss.ma]=this.messageAlignment,n[e.ss._h]=this.slideFrom,n[e.ss.xs]=this.extras,n[e.ss.ua]=this.triggerId,n[e.ss.ca]=this.clickAction,n[e.ss.URI]=this.uri,n[e.ss.fa]=this.openTarget,n[e.ss.da]=this.dismissType,n[e.ss.la]=this.duration,n[e.ss.ga]=this.icon,n[e.ss.ns]=this.imageUrl,n[e.ss.ja]=this.imageStyle,n[e.ss.xa]=this.iconColor,n[e.ss.za]=this.iconBackgroundColor,n[e.ss.ha]=this.backgroundColor,n[e.ss.va]=this.textColor,n[e.ss.wa]=this.closeButtonColor,n[e.ss.ya]=this.animateIn,n[e.ss.Sa]=this.animateOut,n[e.ss.ba]=this.header,n[e.ss.ka]=this.headerAlignment,n[e.ss.qa]=this.headerTextColor,n[e.ss.Aa]=this.frameColor,n[e.ss.Ba]=this.buttons,n[e.ss.Ca]=this.cropType,n[e.ss.Da]=this.orientation,n[e.ss.Ea]=this.htmlId,n[e.ss.CSS]=this.css,n[e.ss.ts]=t,n[e.ss.Fa]=this.messageExtras,n[e.ss.LANGUAGE]=this.language,n[e.ss.ks]=this.altImageText,n):n}};G.th={hh:4281545523,ih:4294967295,sh:4278219733,Nh:4293914607,Rh:4283782485,Eh:3224580915,eh:4288387995},G.Ao={Sh:`hd`,Lo:`ias`,Mh:`of`,Dh:`do`,Ch:`umt`,dh:`tf`,Uh:`te`},G.SlideFrom={TOP:`TOP`,BOTTOM:`BOTTOM`},G.ClickAction={URI:`URI`,NONE:`NONE`},G.DismissType={AUTO_DISMISS:`AUTO_DISMISS`,MANUAL:`SWIPE`},G.OpenTarget={NONE:`NONE`,BLANK:`BLANK`},G.ImageStyle={TOP:`TOP`,GRAPHIC:`GRAPHIC`},G.Orientation={PORTRAIT:`PORTRAIT`,LANDSCAPE:`LANDSCAPE`},G.TextAlignment={START:`START`,CENTER:`CENTER`,END:`END`},G.CropType={CENTER_CROP:`CENTER_CROP`,FIT_CENTER:`FIT_CENTER`},G.Eo={ia:`SLIDEUP`,ta:`MODAL`,Xo:`MODAL_STYLED`,Yn:`FULL`,Zo:`WEB_HTML`,Bo:`HTML`,Yo:`HTML_FULL`},G.hr=500,G.bh=200,G.lh=`ab-show`,G.uh=`ab-hide`,G.ss={pa:`m`,ma:`ma`,_h:`sf`,xs:`e`,ua:`ti`,ca:`ca`,URI:`u`,fa:`oa`,da:`dt`,la:`d`,ga:`i`,ns:`iu`,ja:`is`,xa:`ic`,za:`ibc`,ha:`bc`,va:`tc`,wa:`cbc`,ya:`ai`,Sa:`ao`,ba:`h`,ka:`ha`,qa:`htc`,Aa:`fc`,Ba:`b`,Ca:`ct`,Da:`o`,Ea:`hi`,CSS:`css`,ts:`type`,ed:`messageFields`,Fa:`me`,LANGUAGE:`l`,ks:`ia`};var Ze=class e extends G{constructor(e,t,n,r,i,a,o,s,c,l,u,d){super(e,void 0,void 0,t,n,void 0,void 0,void 0,r||=G.DismissType.MANUAL,i,void 0,void 0,void 0,void 0,void 0,void 0,void 0,void 0,a,o,void 0,void 0,void 0,s,void 0,void 0,void 0,c,l,d,void 0,void 0),this.messageFields=u,this.messageFields=u}od(){return!1}$t(e){if(this.ko===G.Eo.Zo){if(this.dd)return!1;this.dd=!0}return this.ti.L(e),!0}gt(){let t=super.gt(e.es);return t[G.ss.ed]=this.messageFields,t}static Zn(t){return new e(t[G.ss.pa],t[G.ss.xs],t[G.ss.ua],t[G.ss.da],t[G.ss.la],t[G.ss.ya],t[G.ss.Sa],t[G.ss.Aa],t[G.ss.Ea],t[G.ss.CSS],t[G.ss.ed],t[G.ss.Fa])}};Ze.es=G.Eo.Zo;var Qe=class e{constructor(t,n,r,i,a,o,s){this.text=t,this.backgroundColor=n,this.textColor=r,this.borderColor=i,this.clickAction=a,this.uri=o,this.id=s,this.text=t||``,this.backgroundColor=n||G.th.sh,this.textColor=r||G.th.ih,this.borderColor=i||this.backgroundColor,this.clickAction=a||G.ClickAction.NONE,this.uri=o,s??=e._n,this.id=s,this.dd=!1,this.ti=new w}subscribeToClickedEvent(e){return this.ti.Rt(e)}removeSubscription(e){this.ti.removeSubscription(e)}removeAllSubscriptions(){this.ti.removeAllSubscriptions()}$t(){return!this.dd&&(this.dd=!0,this.ti.L(),!0)}static fromJson(t){return new e(t.text,t.bg_color,t.text_color,t.border_color,t.click_action,t.uri,t.id)}};Qe._n=-1;var $e=class e extends G{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,ee,x,S,C,w,T,E,D,O,k){s||=G.DismissType.MANUAL,w||=G.Orientation.PORTRAIT,super(e,t,void 0,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,ee,x,S,C||=G.CropType.CENTER_CROP,w,T,E,D,O,k),this.Io=G.TextAlignment.CENTER}gt(){return super.gt(e.es)}static Zn(t){return new e(t[G.ss.pa],t[G.ss.ma],t[G.ss.xs],t[G.ss.ua],t[G.ss.ca],t[G.ss.URI],t[G.ss.fa],t[G.ss.da],t[G.ss.la],t[G.ss.ga],t[G.ss.ns],t[G.ss.ja],t[G.ss.xa],t[G.ss.za],t[G.ss.ha],t[G.ss.va],t[G.ss.wa],t[G.ss.ya],t[G.ss.Sa],t[G.ss.ba],t[G.ss.ka],t[G.ss.qa],t[G.ss.Aa],rt(t[G.ss.Ba]),t[G.ss.Ca],t[G.ss.Da],t[G.ss.Ea],t[G.ss.CSS],t[G.ss.Fa],t[G.ss.LANGUAGE],t[G.ss.ks])}};$e.es=G.Eo.Yn;var et=class e extends G{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,ee,x,S,C,w,T,E,D,O){super(e,t,void 0,n,r,i,a,o,s||=G.DismissType.MANUAL,c,l,u,d,f,p,m,h,g,_,v,y,b,ee,x,S,C||=G.CropType.FIT_CENTER,void 0,w,T,E,D,O),this.Io=G.TextAlignment.CENTER}gt(){return super.gt(e.es)}static Zn(t){return new e(t[G.ss.pa],t[G.ss.ma],t[G.ss.xs],t[G.ss.ua],t[G.ss.ca],t[G.ss.URI],t[G.ss.fa],t[G.ss.da],t[G.ss.la],t[G.ss.ga],t[G.ss.ns],t[G.ss.ja],t[G.ss.xa],t[G.ss.za],t[G.ss.ha],t[G.ss.va],t[G.ss.wa],t[G.ss.ya],t[G.ss.Sa],t[G.ss.ba],t[G.ss.ka],t[G.ss.qa],t[G.ss.Aa],rt(t[G.ss.Ba]),t[G.ss.Ca],t[G.ss.Ea],t[G.ss.CSS],t[G.ss.Fa],t[G.ss.LANGUAGE],t[G.ss.ks])}};et.es=G.Eo.ta;var tt=class e extends G{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,ee,x,S){h||=G.th.Rh,m||=G.th.Nh,super(e,t||=G.TextAlignment.START,n,r,i,a,o,s,c,l,u,d,void 0,f,p,m,h,g,_,v,void 0,void 0,void 0,void 0,void 0,void 0,void 0,y,b,ee,x,S),this.Io=G.TextAlignment.START}zo(){return!1}No(){let e=document.createElement(`span`);return e.appendChild(document.createTextNode(this.message||``)),e}ah(e){let t=e.getElementsByClassName(`ab-in-app-message`)[0];He.td(t,!0,!0)||(this.slideFrom===G.SlideFrom.TOP?t.style.top=`0px`:t.style.bottom=`0px`),super.ah(e)}gt(){return super.gt(e.es)}static Zn(t){return new e(t[G.ss.pa],t[G.ss.ma],t[G.ss._h],t[G.ss.xs],t[G.ss.ua],t[G.ss.ca],t[G.ss.URI],t[G.ss.fa],t[G.ss.da],t[G.ss.la],t[G.ss.ga],t[G.ss.ns],t[G.ss.xa],t[G.ss.za],t[G.ss.ha],t[G.ss.va],t[G.ss.wa],t[G.ss.ya],t[G.ss.Sa],t[G.ss.Ea],t[G.ss.CSS],t[G.ss.Fa],t[G.ss.LANGUAGE],t[G.ss.ks])}};tt.es=G.Eo.ia;function nt(e){if(!e)return null;if(e.is_control)return Be.fromJson(e);let n=e.type;n!=null&&(n=n.toUpperCase());let r=e.message,i=e.text_align_message,a=e.slide_from,o=e.extras,s=e.trigger_id,c=e.click_action,l=e.uri,u=e.open_target,d=e.message_close,f=e.duration,p=e.icon,m=e.image_url,h=e.image_style,g=e.icon_color,_=e.icon_bg_color,v=e.bg_color,y=e.text_color,b=e.close_btn_color,ee=e.header,x=e.text_align_header,S=e.header_text_color,C=e.frame_color,w=[],T=e.btns;T??=[];for(let e=0;e<T.length;e++)w.push(Qe.fromJson(T[e]));let E=e.crop_type,D=e.orientation,O=e.animate_in,k=e.animate_out,A=e.html_id,j=e.css;A!=null&&A!==``&&j!=null&&j!==``||(A=void 0,j=void 0);let M=e.message_extras,te=e.language,ne=e.image_alt,N;if(n===et.es||n===G.Eo.Xo)N=new et(r,i,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,O,k,ee,x,S,C,w,E,A,j,M,te,ne);else if(n===$e.es)N=new $e(r,i,o,s,c,l,u,d,f,p,m,h,g,_,v,y,b,O,k,ee,x,S,C,w,E,D,A,j,M,te,ne);else if(n===tt.es)N=new tt(r,i,a,o,s,c,l,u,d,f,p,m,g,_,v,y,b,O,k,A,j,M,te,ne);else{if(n!==Ze.es&&n!==G.Eo.Bo&&n!==G.Eo.Yo)return void t.error(`Ignoring message with unknown type `+n);{let t=e.message_fields;N=new Ze(r,o,s,d,f,O,k,C,A,j,t,M),N.trusted=e.trusted||!1}}return N.ko=n,N}function rt(e){let t=[];for(let n of e)t.push(new Qe(n.text,n.backgroundColor,n.textColor,n.borderColor,n.clickAction,n.uri,n.id));return t}var it=class e{constructor(e){this.tf=e,this.tf=e}sf(e){return this.tf==null||this.tf===e[0]}static fromJson(t){return new e(t?t.event_name:null)}gt(){return this.tf}},at=class e{constructor(t,n,r,i){this.yE=t,this.HE=n,this.comparator=r,this.LE=i,this.yE=t,this.HE=n,this.comparator=r,this.LE=i,this.HE===e.XE.QE&&this.comparator!==e.BE.wE&&this.comparator!==e.BE.jE&&this.comparator!==e.BE.zE&&this.comparator!==e.BE.FE&&(this.LE=h(this.LE))}sf(t){let n=null;switch(t!=null&&(n=t[this.yE]),this.comparator){case e.BE.kE:return n!=null&&n.valueOf()===this.LE.valueOf();case e.BE.xE:return n==null||n.valueOf()!==this.LE.valueOf();case e.BE.JE:return n!=null&&typeof n==typeof this.LE&&n>this.LE;case e.BE.wE:return this.HE===e.XE.QE?n!=null&&l(n)&&y(n)<=this.LE.valueOf():n!=null&&typeof n==typeof this.LE&&n>=this.LE;case e.BE.VE:return n!=null&&typeof n==typeof this.LE&&n<this.LE;case e.BE.jE:return this.HE===e.XE.QE?n!=null&&l(n)&&y(n)>=this.LE.valueOf():n!=null&&typeof n==typeof this.LE&&n<=this.LE;case e.BE.qE:return n!=null&&typeof n==`string`&&typeof n==typeof this.LE&&n.match(this.LE)!=null;case e.BE.PE:return n!=null;case e.BE.WE:return n==null;case e.BE.zE:return n!=null&&l(n)&&b(n)<this.LE;case e.BE.FE:return n!=null&&l(n)&&b(n)>this.LE;case e.BE.ZE:return n==null||typeof n!=typeof this.LE||typeof n!=`string`||n.match(this.LE)==null}return!1}static fromJson(t){return new e(t.property_key,t.property_type,t.comparator,t.property_value)}gt(){let e=this.LE;return l(this.LE)&&(e=p(e.valueOf())),{k:this.yE,t:this.HE,c:this.comparator,v:e}}static _u(t){return new e(t.k,t.t,t.c,t.v)}};at.XE={$E:`boolean`,tT:`number`,sT:`string`,QE:`date`},at.BE={kE:1,xE:2,JE:3,wE:4,VE:5,jE:6,qE:10,PE:11,WE:12,zE:15,FE:16,ZE:17};var ot=class e{constructor(e){this.filters=e,this.filters=e}sf(e){let t=!0;for(let n=0;n<this.filters.length;n++){let r=this.filters[n],i=!1;for(let t=0;t<r.length;t++)if(r[t].sf(e)){i=!0;break}if(!i){t=!1;break}}return t}static fromJson(t){if(t==null||!c(t))return null;let n=[];for(let e=0;e<t.length;e++){let r=[],i=t[e];for(let e=0;e<i.length;e++)r.push(at.fromJson(i[e]));n.push(r)}return new e(n)}gt(){let e=[];for(let t=0;t<this.filters.length;t++){let n=this.filters[t],r=[];for(let e=0;e<n.length;e++)r.push(n[e].gt());e.push(r)}return e}static _u(t){let n=[];for(let e=0;e<t.length;e++){let r=[],i=t[e];for(let e=0;e<i.length;e++)r.push(at._u(i[e]));n.push(r)}return new e(n)}},st=class e{constructor(e,t){this.tf=e,this.if=t,this.tf=e,this.if=t}sf(e){if(this.tf==null||this.if==null)return!1;let t=e[0],n=e[1];return t===this.tf&&this.if.sf(n)}static fromJson(t){return new e(t?t.event_name:null,t?ot.fromJson(t.property_filters):null)}gt(){return{e:this.tf,pf:this.if?this.if.gt():null}}},ct=class e{constructor(e,t){this.rf=e,this.nf=t,this.rf=e,this.nf=t}sf(e){if(this.rf==null)return!1;let t=q.ef(e[0],this.rf);if(!t)return!1;let n=this.nf==null||this.nf.length===0;if(this.nf!=null){for(let t=0;t<this.nf.length;t++)if(this.nf[t]===e[1]){n=!0;break}}return t&&n}static fromJson(t){return new e(t?t.id:null,t?t.buttons:null)}gt(){return this.rf}},lt=class e{constructor(e){this.productId=e,this.productId=e}sf(e){return this.productId==null||e[0]===this.productId}static fromJson(t){return new e(t?t.product_id:null)}gt(){return this.productId}},ut=class e{constructor(e,t){this.productId=e,this.if=t,this.productId=e,this.if=t}sf(e){if(this.productId==null||this.if==null)return!1;let t=e[0],n=e[1];return t===this.productId&&this.if.sf(n)}static fromJson(t){return new e(t?t.product_id:null,t?ot.fromJson(t.property_filters):null)}gt(){return{id:this.productId,pf:this.if?this.if.gt():null}}},dt=class e{constructor(e){this.rf=e,this.rf=e}sf(e){return this.rf==null||q.ef(e[0],this.rf)}static fromJson(t){return new e(t?t.campaign_id:null)}gt(){return this.rf}},K={OPEN:`open`,Rr:`purchase`,wr:`push_click`,xe:`custom_event`,rm:`iam_click`,qs:`test`},q=class e{constructor(e,t){this.type=e,this.data=t,this.type=e,this.data=t}km(t,n){return e._m[this.type]===t&&(this.data==null||this.data.sf(n))}static ef(e,n){let r=null;try{r=window.atob(e)}catch(n){return t.info(`Failed to unencode analytics id `+e+`: `+D(n)),!1}return n===r.split(`_`)[0]}static fromJson(t){let n=t.type,r=null;switch(n){case e.Ln.OPEN:case e.Ln.qs:break;case e.Ln.Rr:r=lt.fromJson(t.data);break;case e.Ln.bm:r=ut.fromJson(t.data);break;case e.Ln.wr:r=dt.fromJson(t.data);break;case e.Ln.xe:r=it.fromJson(t.data);break;case e.Ln.Em:r=st.fromJson(t.data);break;case e.Ln.rm:r=ct.fromJson(t.data)}return new e(n,r)}
3gt(){return{t:this.type,d:this.data?this.data.gt():null}}static _u(t){let n,r=null;switch(t.t){case e.Ln.OPEN:case e.Ln.qs:break;case e.Ln.Rr:r=new lt(t.d);break;case e.Ln.bm:n=t.d||{},r=new ut(n.id,ot._u(n.pf||[]));break;case e.Ln.wr:r=new dt(t.d);break;case e.Ln.xe:r=new it(t.d);break;case e.Ln.Em:n=t.d||{},r=new st(n.e,ot._u(n.pf||[]));break;case e.Ln.rm:r=new ct(t.d)}return new e(t.t,r)}};q.Ln={OPEN:`open`,Rr:`purchase`,bm:`purchase_property`,wr:`push_click`,xe:`custom_event`,Em:`custom_event_property`,rm:`iam_click`,qs:`test`},q._m={},q._m[q.Ln.OPEN]=K.OPEN,q._m[q.Ln.Rr]=K.Rr,q._m[q.Ln.bm]=K.Rr,q._m[q.Ln.wr]=K.wr,q._m[q.Ln.xe]=K.xe,q._m[q.Ln.Em]=K.xe,q._m[q.Ln.rm]=K.rm,q._m[q.Ln.qs]=K.qs;var ft=class e{constructor(t,n=[],r,i,a=0,o,s,c=0,l=e.Td,u,d,f){this.id=t,this.Pd=n,this.startTime=r,this.endTime=i,this.priority=a,this.type=o,this.data=s,this.Ed=c,this.Nd=l,this.Vn=u,this._d=d,this.Id=f,this.id=t,this.Pd=n||[],r===void 0&&(r=null),this.startTime=r,i===void 0&&(i=null),this.endTime=i,this.priority=a||0,this.type=o,this.Ed=c||0,u??=1e3*(this.Ed+30),this.Vn=u,this.data=s,l!=null&&(this.Nd=l),this._d=d,this.Id=f||null}xd(t){return this.Id==null||this.Nd!==e.Td&&t-this.Id>=1e3*this.Nd}zd(e){this.Id=e}Md(e){let t=e+1e3*this.Ed;return Math.max(t-new Date().valueOf(),0)}Bd(e){let n=new Date().valueOf()-e,r=e==null||isNaN(n)||this.Vn==null||n<this.Vn;return r||t.info(`Trigger action ${this.type} is no longer eligible for display - fired ${n}ms ago and has a timeout of ${this.Vn}ms.`),!r}static fromJson(t){let n=t.id,r=[];for(let e=0;e<t.trigger_condition.length;e++)r.push(q.fromJson(t.trigger_condition[e]));let i=h(t.start_time),a=h(t.end_time),o=t.priority,c=t.type,l=t.delay,u=t.re_eligibility,d=t.timeout,f=t.data,p=t.min_seconds_since_last_trigger;return s(e.Ln,c,`Could not construct Trigger from server data`,`Trigger.Types`)?new e(n,r,i,a,o,c,f,l,u,d,p):null}gt(){let e=[];for(let t=0;t<this.Pd.length;t++)e.push(this.Pd[t].gt());return{i:this.id,c:e,s:this.startTime,e:this.endTime,p:this.priority,t:this.type,da:this.data,d:this.Ed,r:this.Nd,tm:this.Vn,ss:this._d,ld:this.Id}}static _u(t){let n=[],r=t.c||[];for(let e=0;e<r.length;e++)n.push(q._u(r[e]));return new e(t.i,n,_(t.s),_(t.e),t.p,t.t,t.da,t.d,t.r,t.tm,t.ss,t.ld)}};ft.Ln={Kn:`inapp`,Cd:`templated_iam`},ft.Td=-1;var pt={PORTRAIT:0,LANDSCAPE:1};function mt(){return screen.width<=600}function ht(){if(`orientation`in window)return Math.abs(window.orientation)===90||window.orientation===270?pt.LANDSCAPE:pt.PORTRAIT;let e=window;if(`screen`in e){let t=e.screen.orientation||screen.mozOrientation||screen.msOrientation;return typeof t==`object`&&t&&(t=t.type),t===`landscape-primary`||t===`landscape-secondary`?pt.LANDSCAPE:pt.PORTRAIT}return pt.PORTRAIT}function gt(e,t,n){e&&(t||n!=null&&n.metaKey?window.open(e):window.location=e)}function _t(){return window.location.href}var vt={openUri:gt,Ua:mt,Ma:ht,gl:_t};function yt(e){e??=``;let t=e.split(`?`).slice(1).join(`?`),n={};if(t!=null){let e=t.split(`&`);for(let t=0;t<e.length;t++){let r=e[t].split(`=`);r[0]!==``&&(n[r[0]]=r[1])}}return n}function bt(e){return!(!e||(e=e.toString().toLowerCase()).lastIndexOf(`javascript:`,0)!==0&&e.lastIndexOf(`data:`,0)!==0)}var xt=class{constructor(e,t,n,r){this.j=e,this.C=t,this.B=n,this.vs=r,this.j=e,this.C=t,this.B=n,this.vs=r,this.jn=new w,Q.q(this.jn),this.vn=1e3,this.yn=6e4,this.bn=null,this.In=null,this.Mn=null}An(){return this.jn}Tn(e){return this.jn.Rt(e)}kn(){return this.bn}Dn(e){this.bn=e}lt(e,r,i,a){let o=new Me,s;if(r===n.wn||e instanceof Be){if(!e.Wt())return t.info(`This in-app message has already received an impression. Ignoring analytics event.`),o}else if((r===n.zn||e instanceof Ze&&r===n.Sn)&&!e.$t(a))return t.info(`This in-app message has already received a click. Ignoring analytics event.`),o;return s=e instanceof Be?{trigger_ids:[e.triggerId]}:this.Bn(e),s==null?o:(e.messageExtras&&(s.message_extras=e.messageExtras),i!=null&&(s.bid=i),$.lt(r,s))}Rn(e,r){let i=new Me;if(!e.$t())return t.info(`This in-app message button has already received a click. Ignoring analytics event.`),i;let a=this.Bn(r);return a==null?i:e.id===Qe._n?(t.info(`This in-app message button does not have a tracking id. Not logging event to Braze servers.`),i):(e.id!=null&&(a.bid=e.id),$.lt(n.Sn,a))}qn(e){let t=e.messageFields;return t!=null&&t.is_push_primer||!1}xn(e){if(!(e instanceof G))return;let t=e=>{if(!e)return;let t=ne(e);if(re(t))return te(M.Pn,`In-App Message`);if(ie(t)){let e=W.En();if(!e.Gn)return W.Nn(e.reason,`In-App Message`)}};if(this.qn(e)){let e=W.En();if(!e.Gn)return W.Nn(e.reason,`In-App Message`)}let n=e.buttons||[],r;for(let e of n)if(e.clickAction===G.ClickAction.URI&&e.uri&&le.test(e.uri)&&
3(r=t(e.uri),r))return r;return e.clickAction===G.ClickAction.URI&&e.uri&&le.test(e.uri)?t(e.uri):void 0}$n(e,t){t!==this.Mn&&this.Cn(),this.In=e,this.Mn=t}Cn(){this.In!=null&&(clearTimeout(this.In),this.In=null,this.Mn=null)}Fn(e,n,r,i){let a=this.j;if(!a)return;this.Mn&&e.triggerId!==this.Mn&&(this.Cn(),U.fi(this.B,U.H.On));let o=a.Xn(!1),s=a.$(o);s.template={trigger_id:e.triggerId,trigger_event_type:n},r!=null&&(s.template.data=r.Hn());let c=a.A(s,U.H.On);a.J(s,(a=-1)=>{let o=this.j;if(!o)return;let l=new Date().valueOf();U.K(this.B,U.H.On,l),a!==-1&&c.push([`X-Braze-Req-Tokens-Remaining`,a.toString()]);let u,d,f=!1;Oe.O({url:`${o.V()}/template/`,data:s,headers:c,W:n=>{if(!o.Y(s,n,c))return void(typeof e.Jn==`function`&&e.Jn());if(o.Z(),n==null||n.templated_message==null)return;let r=n.templated_message;if(r.type!==ft.Ln.Kn)return;let i=nt(r.data);if(i==null)return;let a=this.xn(i);if(a)return t.error(a),void(typeof e.Jn==`function`&&e.Jn());typeof e.Qn==`function`&&e.Qn(i)},error:t=>{f=!0,u=t,d=`getting user personalization for message ${e.triggerId}.`},tt:(t,a)=>{if(new Date().valueOf()-e.Un<e.Vn){let t=0;if(f){let n=Math.min(e.Vn,this.yn),r=this.vn;i??=r,t=Math.min(n,je(r,3*i))}o.et(a,()=>{this.Fn(e,n,r,t)},U.H.On,t=>this.$n(t,e.triggerId),()=>this.Cn(),t)}f&&o._(u,d)}})},U.H.On)}Bn(e){if(e.triggerId==null)return t.info(`The in-app message has no analytics id. Not logging event to Braze servers.`),null;let n={};return e.triggerId!=null&&(n.trigger_ids=[e.triggerId]),n}fn(e){return!!this.B&&!(!(e&&e instanceof G&&e.constructor!==G)||e instanceof Be)&&this.B.bt(B.ft.Wn,e.gt())}sa(){if(!this.B)return null;let e=this.B.dt(B.ft.Wn);if(!e)return null;let t;switch(e.type){case G.Eo.Yn:t=$e.Zn(e);break;case G.Eo.Zo:case G.Eo.Bo:case G.Eo.Yo:t=Ze.Zn(e);break;case G.Eo.ta:case G.Eo.Xo:t=et.Zn(e);break;case G.Eo.ia:t=tt.Zn(e)}return t&&this.oa(),t}oa(){this.B&&this.B.zt(B.ft.Wn)}},J={na:null,i:!1,ra:()=>(J.t(),J.na||=new xt(Q.m(),Q.u(),Q.p(),Q.ir()),J.na),t:()=>{J.i||=(Q.g(J),!0)},destroy:()=>{J.na=null,J.i=!1}},St=class e{constructor(e,t,n,r,i){this.triggerId=e,this.Qn=t,this.Jn=n,this.Un=r,this.Vn=i,this.triggerId=e,this.Qn=t,this.Jn=n,this.Un=r,this.Vn=i}static fromJson(t,n,r,i,a){return t==null||t.trigger_id==null?null:new e(t.trigger_id,n,r,i,a)}},Ct=class extends we{constructor(e,t,n,r,i){super(),this.tg=e,this.ws=t,this.B=n,this.Ru=r,this.ig=i,this.tg=e,this.ws=t,this.B=n,this.Ru=r,this.ig=i,this.sg=[],this.eg=[],this.hg=null,this.ng={},this.og={},this.triggers=[],this.lg=0,this.ag(),this.gg()}fg(){if(this.B){this.hg=this.B.dt(B.ft.iE)||this.hg,this.ng=this.B.dt(B.ft.EE)||this.ng,this.og=this.B.dt(B.ft.aE)||this.og;for(let e=0;e<this.triggers.length;e++){let t=this.triggers[e];t.id&&this.og[t.id]!=null&&t.zd(this.og[t.id])}}}ag(){if(!this.B)return;this.lg=this.B.dt(B.ft.nE)||0;let e=this.B.dt(B.ft.oE)||[],t=[];for(let n=0;n<e.length;n++)t.push(ft._u(e[n]));this.triggers=t,this.fg()}gg(){let e=this,t=function(t,n,r,i,a){return function(){e.cg(t,n,r,i,a)}},n={};for(let e of this.triggers)e.id&&(n[e.id]=e);let r=!1;for(let e=0;e<this.triggers.length;e++){let i=this.triggers[e];if(i.id&&this.ng[i.id]!=null){let e=this.ng[i.id],a=[];for(let r=0;r<e.length;r++){let o=e[r],s=i.Md(o.Un||0);if(s>0){let e,r;a.push(o),o.ug!=null&&(e=o.ug),o.dg!=null&&E.gE(o.dg)&&(r=E._u(o.dg));let l=[];if(o.pg&&c(o.pg))for(let e=0;e<o.pg.length;e++){let t=n[o.pg[e]];t!=null&&l.push(t)}this.eg.push(window.setTimeout(t(i,o.Un||0,e,r,l),s))}}this.ng[i.id].length>a.length&&(this.ng[i.id]=a,r=!0,this.ng[i.id].length===0&&delete this.ng[i.id])}}r&&this.B&&this.B.bt(B.ft.EE,this.ng)}mg(){if(!this.B)return;let e=[];for(let t=0;t<this.triggers.length;t++)e.push(this.triggers[t].gt());this.lg=new Date().valueOf(),this.B.bt(B.ft.oE,e),this.B.bt(B.ft.nE,this.lg)}bg(){this.B&&((this.B.dt(B.ft.nE)||0)>this.lg?this.ag():this.fg())}N(e){let n=!1;if(e!=null&&e.triggers){this.ig.oa(),this.fg();let r={},i={};this.triggers=[];for(let t=0;t<e.triggers.length;t++){let a=ft.fromJson(e.triggers[t]);if(a){a.id&&this.og[a.id]!=null&&(a.zd(this.og[a.id]),r[a.id]=this.og[a.id]),a.id&&this.ng[a.id]!=null&&(i[a.id]=this.ng[a.id]);for(let e=0;e<a.Pd.length;e++)if(a.Pd[e].km(K.qs,null)){n=!0;break}this.triggers.push(a)}}f(this.og,r)||(this.og=r,this.B&&this.B.bt(B.ft.aE,this.og)),f(this.ng,i)||(this.ng=i,this.B&&this.B.bt(B.ft.EE,this.ng)),this.mg(),n&&(t.info(`Trigger with test c
3ondition found, firing test.`),this.he(K.qs)),this.he(K.OPEN);let a=this.sg,o;this.sg=[];for(let e=0;e<a.length;e++)o=Array.prototype.slice.call(a[e]),this.he(...o)}}cg(e,n,r,i,a){let o=i=>{this.fg();let a=new Date().valueOf();e.Bd(n)||(!1===navigator.onLine&&e.type===ft.Ln.Kn&&i.imageUrl?t.info(`Not showing ${e.type} trigger action ${e.id} due to offline state.`):e.xd(a)&&this.wg(e,a,r)?this.ws.De()===0?t.info(`Not displaying trigger ${e.id} because neither automaticallyShowInAppMessages() nor subscribeToInAppMessage() were called.`):(this.ws.L([i]),this.yg(e,a)):t.info(`Not displaying trigger ${e.id} because display time fell outside of the acceptable time window.`))},s=()=>{this.fg();let o=a.pop();if(o!=null){if(this.Tg(o,n,r,i,a),o.Bd(n)){let e=`Server aborted in-app message display, but the timeout on fallback trigger ${o.id} has already elapsed.`;a.length>0&&(e+=` Continuing to fall back.`),t.info(e),s()}else{t.info(`Server aborted in-app message display. Falling back to lower priority ${o.type} trigger action ${e.id}.`);let s=1e3*o.Ed-(new Date().valueOf()-n);s>0?this.eg.push(window.setTimeout(()=>{this.cg(o,n,r,i,a)},s)):this.cg(o,n,r,i,a)}}},c,l,u;switch(e.type){case ft.Ln.Kn:if(c=nt(e.data),c==null){t.error(`Could not parse trigger data for trigger ${e.id}, ignoring.`);break}if(l=this.ig.xn(c),l){t.error(l),s();break}o(c);break;case ft.Ln.Cd:if(u=St.fromJson(e.data,o,s,n,e.Vn||0),u==null){t.error(`Could not parse trigger data for trigger ${e.id}, ignoring.`);break}this.ig.Fn(u,r,i);break;default:t.error(`Trigger ${e.id} was of unexpected type ${e.type}, ignoring.`)}}he(e,n=null,r){if(!s(K,e,`Cannot fire trigger action.`,`TriggerEvents`))return;if(this.Ru&&this.Ru.vd())return t.info(`Trigger sync is currently in progress, awaiting sync completion before firing trigger event.`),void this.sg.push(arguments);this.bg();let i=new Date().valueOf(),a=i-(this.hg||0),o=!0,c=!0,l=[];for(let t=0;t<this.triggers.length;t++){let r=this.triggers[t],a=i+1e3*r.Ed;if(r.xd(a)&&(r.startTime==null||r.startTime.valueOf()<=i)&&(r.endTime==null||r.endTime.valueOf()>=i)){let t=!1;for(let i=0;i<r.Pd.length;i++)if(r.Pd[i].km(e,n)){t=!0;break}t&&(o=!1,this.wg(r,a,e)&&(c=!1,l.push(r)))}}if(o)return void t.info(`Trigger event ${e} did not match any trigger conditions.`);if(c)return void t.info(`Ignoring ${e} trigger event because a trigger was displayed ${a/1e3}s ago.`);l.sort((e,t)=>e.priority-t.priority);let u=l.pop();u!=null&&(t.info(`Firing ${u.type} trigger action ${u.id} from trigger event ${e}.`),this.Tg(u,i,e,r,l),u.Ed===0?this.cg(u,i,e,r,l):this.eg.push(window.setTimeout(()=>{this.cg(u,i,e,r,l)},1e3*u.Ed)))}changeUser(e=!1){if(this.triggers=[],this.B&&this.B.zt(B.ft.oE),!e){this.sg=[],this.hg=null,this.og={},this.ng={};for(let e=0;e<this.eg.length;e++)clearTimeout(this.eg[e]);this.eg=[],this.B&&(this.B.zt(B.ft.iE),this.B.zt(B.ft.aE),this.B.zt(B.ft.EE))}}clearData(){this.triggers=[],this.hg=null,this.og={},this.ng={};for(let e=0;e<this.eg.length;e++)clearTimeout(this.eg[e]);this.eg=[]}wg(e,n,r){if(this.hg==null)return!0;if(r===K.qs)return t.info(`Ignoring minimum interval between trigger because it is a test type.`),!0;let i=e._d;return i??=this.tg,n-this.hg>=1e3*i}Tg(e,t,n,r,i){this.fg(),e.id&&(this.ng[e.id]=this.ng[e.id]||[]);let a={},o;a.Un=t,a.ug=n,r!=null&&(o=r.gt()),a.dg=o;let s=[];for(let e of i)e.id&&s.push(e.id);a.pg=s,e.id&&this.ng[e.id].push(a),this.B&&this.B.bt(B.ft.EE,this.ng)}yg(e,t){this.fg(),e.zd(t),this.hg=t,e.id&&(this.og[e.id]=t),this.B&&(this.B.bt(B.ft.iE,t),this.B.bt(B.ft.aE,this.og))}},Y={i:!1,provider:null,o:()=>(Y.t(),Y.provider||Y.rg(),Y.provider),rg:()=>{Y.provider||(Y.provider=new Ct(Q.re(Z.Xh)??30,J.ra().An(),Q.p(),Q.nn(),J.ra()),Q.v(Y.provider))},t:()=>{Y.i||=(Y.rg(),Q.g(Y),!0)},destroy:()=>{Y.provider=null,Y.i=!1}};function wt(e,t,n,r,i){let a=/^https?:\/\//i.test(e)?e:`https://${e}`,o=`mite=${encodeURIComponent(t)}&attempts=${n}`;return r&&(o+=`&auth=${encodeURIComponent(r)}`),i&&(o+=`&rcs=${encodeURIComponent(i)}`),`${a}/sse?${o}`}var Tt=`
4"use strict";
5const workerSelf = self;
6let eventSource = null;
7let currentConfig = null;
8let retryCount = 0;
9let retryTimeoutId = null;
10let connectionInProgress = false;
11const maxRetries = 5;
12const connectedPorts = new Map();
13let lastSleepMs = null;
14let currentRcs = null;
15let ttlTimeoutId = null;
16let leaderPortId = null;
17let ddrTimeoutId = null;
18const fn = {
19    startConnection: null,
20    handleMessage: null,
21};
22function broadcast(message) {
23    connectedPorts.forEach((portInfo, portId) => {
24        try {
25            portInfo.port.postMessage(message);
26        }
27        catch (_a) {
28            connectedPorts.delete(portId);
29        }
30    });
31}
32function randomInclusive(min, max) {
33    return Math.floor(Math.random() * (max - min + 1)) + min;
34}
35function electLeader() {
36    if (leaderPortId && connectedPorts.has(leaderPortId)) {
37        return;
38    }
39    const firstPortId = connectedPorts.keys().next().value;
40    leaderPortId = firstPortId || null;
41    if (leaderPortId) {
42        console.log("[Braze Real-Time] Elected leader port:", leaderPortId);
43    }
44}
45function promoteToLeader(portId) {
46    if (connectedPorts.has(portId) && leaderPortId !== portId) {
47        leaderPortId = portId;
48        console.log("[Braze Real-Time] Promoted to leader (tab became active):", portId);
49    }
50}
51function sendToLeader(message) {
52    electLeader();
53    if (!leaderPortId) {
54        console.warn("[Braze Real-Time] No leader to send message to");
55        return;
56    }
57    const leader = connectedPorts.get(leaderPortId);
58    if (leader) {
59        try {
60            leader.port.postMessage(message);
61        }
62        catch (_a) {
63            connectedPorts.delete(leaderPortId);
64            leaderPortId = null;
65            sendToLeader(message);
66        }
67    }
68}
69function closeConnection() {
70    connectionInProgress = false;
71    if (retryTimeoutId !== null) {
72        clearTimeout(retryTimeoutId);
73        retryTimeoutId = null;
74    }
75    if (ttlTimeoutId !== null) {
76        clearTimeout(ttlTimeoutId);
77        ttlTimeoutId = null;
78    }
79    if (ddrTimeoutId !== null) {
80        clearTimeout(ddrTimeoutId);
81        ddrTimeoutId = null;
82    }
83    if (eventSource) {
84        eventSource.close();
85        eventSource = null;
86        broadcast({ type: "disconnected" });
87    }
88}
89function retryWithBackoff() {
90    if (!currentConfig) {
91        return;
92    }
93    retryCount++;
94    const { minSleepMs, maxSleepMs, scaleFactor } = currentConfig.backoff;
95    let previousSleepMs = lastSleepMs;
96    if (previousSleepMs == null || previousSleepMs < minSleepMs) {
97        previousSleepMs = minSleepMs;
98    }
99    const backoffMs = Math.min(maxSleepMs, randomInclusive(minSleepMs, previousSleepMs * scaleFactor));
100    lastSleepMs = backoffMs;
101    console.log("[Braze Real-Time] Retrying in " + backoffMs + "ms (attempt " + retryCount + "/" + maxRetries + ")");
102    retryTimeoutId = setTimeout(function () {
103        retryTimeoutId = null;
104        fn.startConnection();
105    }, backoffMs);
106}
107function startConnection(oldEventSourceToClose) {
108    if (!currentConfig) {
109        return;
110    }
111    if (eventSource && !oldEventSourceToClose) {
112        console.warn("[Braze Real-Time] Connection already exists");
113        return;
114    }
115    if (connectionInProgress && !oldEventSourceToClose) {
116        console.warn("[Braze Real-Time] Connection attempt already in progress");
117        return;
118    }
119    connectionInProgress = true;
120    const { dustHost, mite, auth } = currentConfig;
121    const dustHostWithScheme = /^https?:\\/\\//i.test(dustHost) ? dustHost : "https://" + dustHost;
122    let queryString = "mite=" + encodeURIComponent(mite) + "&attempts=" + retryCount;
123    if (auth) {
124        queryString += "&auth=" + encodeURIComponent(auth);
125    }
126    if (currentRcs) {
127        queryString += "&rcs=" + encodeURIComponent(currentRcs);
128    }
129    const subscribeUrl = dustHostWithScheme + "/sse?" + queryString;
130    try {
131        const newEventSource = new EventSource(subscribeUrl);
132        newEventSource.onopen = function () {
133            if (oldEventSourceToClose) {
134                console.log("[Braze Real-Time] Gapless reconnection: new connection established, closing old connection");
135                oldEventSourceToClose.close();
136            }
137            else {
138                console.log("[Braze Real-Time] Connection established");
139            }
140            eventSource = newEventSource;
141            connectionInProgress = false;
142            retryCount = 0;
143            lastSleepMs = null;
144            broadcast({ type: "connected" });
145        };
146        newEventSource.addEventListener("msg", function (event) {
147            fn.handleMessage(event.data);
148        });
149        newEventSource.onerror = function () {
150            const readyState = newEventSource ? newEventSource.readyState : -1;
151            if (readyState === 0) {
152                console.log("[Braze Real-Time] Failed to connect");
153            }
154            else {
155                console.log("[Braze Real-Time] Connection lost");
156            }
157            if (oldEventSourceToClose && eventSource !== newEventSource) {
158                console.log("[Braze Real-Time] Gapless reconnection failed, keeping old connection");
159                newEventSource.close();
160                connectionInProgress = false;
161                if (retryCount < maxRetries) {
162                    retryWithBackoff();
163                }
164                return;
165            }
166            closeConnection();
167            if (retryCount < maxRetries) {
168                retryWithBackoff();
169            }
170            else {
171                console.error("[Braze Real-Time] Max retries reached");
172                broadcast({ type: "error", error: "Max retry attempts reached" });
173            }
174        };
175    }
176    catch (error) {
177        connectionInProgress = false;
178        console.error("[Braze Real-Time] Failed to create EventSource:", error);
179        broadcast({ type: "error", error: String(error) });
180    }
181}
182function handleTtlMessage(tMs, rcs) {
183    if (typeof tMs !== "number") {
184        return;
185    }
186    if (typeof rcs === "string") {
187        currentRcs = rcs;
188    }
189    console.log("[Braze Real-Time] TTL set to " + tMs + "ms, will perform gapless reconnection when expired");
190    if (ttlTimeoutId !== null) {
191        clearTimeout(ttlTimeoutId);
192    }
193    ttlTimeoutId = setTimeout(function () {
194        ttlTimeoutId = null;
195        console.log("[Braze Real-Time] TTL expired, performing gapless reconnection");
196        startConnection(eventSource || undefined);
197    }, tMs);
198}
199function handleDdrMessage(rMs, reason) {
200    if (typeof rMs !== "number") {
201        return;
202    }
203    const jitter = Math.random() * rMs * 0.3;
204    const waitMs = Math.round(rMs + jitter);
205    const reasonStr = reason ? " (" + reason + ")" : "";
206    console.log("[Braze Real-Time] Admin requested disconnect" + reasonStr + ", reconnecting in " + waitMs + "ms");
207    if (ddrTimeoutId !== null) {
208        clearTimeout(ddrTimeoutId);
209    }
210    closeConnection();
211    ddrTimeoutId = setTimeout(function () {
212        ddrTimeoutId = null;
213        fn.startConnection();
214    }, waitMs);
215}
216function handleMessage(data) {
217    try {
218        const message = JSON.parse(data);
219        if (!message.type) {
220            console.warn("[Braze Real-Time] Message without type:", message);
221            return;
222        }
223        if (message.type === "ttl" && message.body) {
224            handleTtlMessage(message.body.t_ms, message.body.rcs);
225            return;
226        }
227        if (message.type === "ddr" && message.body) {
228            handleDdrMessage(message.body.r_ms, message.body.e);
229            return;
230        }
231        console.log("[Braze Real-Time] Routing '" + message.type + "' message to leader");
232        sendToLeader({ type: "message", data: message });
233    }
234    catch (error) {
235        console.warn("[Braze Real-Time] Failed to parse message:", error);
236    }
237}
238fn.startConnection = startConnection;
239fn.handleMessage = handleMessage;
240function handlePortMessage(port, portId, message) {
241    switch (message.type) {
242        case "connect":
243            if (currentConfig &&
244                (currentConfig.mite !== message.config.mite || currentConfig.dustHost !== message.config.dustHost)) {
245                console.log("[Braze Real-Time] Config changed, reconnecting");
246                closeConnection();
247                retryCount = 0;
248                lastSleepMs = null;
249                currentRcs = null;
250            }
251            currentConfig = message.config;
252            electLeader();
253            if (!eventSource && !connectionInProgress) {
254                startConnection();
255            }
256            else if (eventSource) {
257                port.postMessage({ type: "connected" });
258            }
259            break;
260        case "disconnect":
261            connectedPorts.delete(portId);
262            if (portId === leaderPortId) {
263                leaderPortId = null;
264                electLeader();
265            }
266            if (connectedPorts.size === 0) {
267                console.log("[Braze Real-Time] No more ports, closing connection");
268                closeConnection();
269                currentConfig = null;
270                currentRcs = null;
271                leaderPortId = null;
272            }
273            break;
274        case "tab_active":
275            promoteToLeader(portId);
276            break;
277        case "ping":
278            port.postMessage({ type: "pong" });
279            break;
280        default:
281            console.warn("[Braze Real-Time] Unknown message type:", message.type);
282    }
283}
284workerSelf.onconnect = function (event) {
285    const port = event.ports[0];
286    const portId = "port-" + Date.now() + "-" + Math.random().toString(36).substr(2, 9);
287    connectedPorts.set(portId, { port: port });
288    port.onmessage = function (messageEvent) {
289        try {
290            handlePortMessage(port, portId, messageEvent.data);
291        }
292        catch (error) {
293            console.error("[Braze Real-Time] Error handling message:", error);
294        }
295    };
296    port.onmessageerror = function () {
297        console.warn("[Braze Real-Time] Message error from port:", portId);
298        connectedPorts.delete(portId);
299    };
300    port.start();
301};
302`;function Et(){return typeof SharedWorker<`u`}var Dt=class{constructor(e){this.Wr=null,this.Lr=null,this.isConnected=!1,this.Ir=null,this.Mr=null,this.we=e.we,this.ke=e.ke,this.Re=e.Re,this.Me=e.Me}initialize(){if(!Et())return t.info(`SharedWorker not supported, will use direct connection`),!1;try{let e=new Blob([Tt],{type:`application/javascript`});return this.Lr=URL.createObjectURL(e),this.Wr=new SharedWorker(this.Lr,{name:`braze-dust-worker`}),this.Wr.port.onmessage=e=>{this.Br(e.data)},this.Wr.port.onmessageerror=()=>{t.warn(`Message error from real-time messaging worker`)},this.Wr.onerror=e=>{var n;t.error(`Real-time messaging worker error: ${e.message||`unknown error`}`),(n=this.Me)==null||n.call(this,`SharedWorker error`)},this.Wr.port.start(),this.Ur(),this.Vr(),t.info(`Real-time messaging worker initialized`),!0}catch(e){return t.error(`Failed to create real-time messaging worker: ${e instanceof Error?e.message:String(e)}`),this.Er(),!1}}Br(e){var n,r,i;switch(e.type){case`connected`:t.info(`Real-time messaging connection established via SharedWorker`),this.isConnected=!0,(n=this.ke)==null||n.call(this);break;case`disconnected`:t.info(`Real-time messaging connection closed via SharedWorker`),this.isConnected=!1,(r=this.Re)==null||r.call(this);break;case`message`:this.we(e.data);break;case`error`:t.error(`Real-time messaging error: ${e.error}`),(i=this.Me)==null||i.call(this,e.error)}}Ur(){this.Ir=window.setInterval(()=>{this.Wr&&this._r({type:`ping`})},3e4)}qr(){this.Ir!==null&&(window.clearInterval(this.Ir),this.Ir=null)}Vr(){this.Mr=()=>{document.visibilityState===`visible`&&this.Wr&&this._r({type:`tab_active`})},document.addEventListener(`visibilitychange`,this.Mr)}Ar(){this.Mr&&=(document.removeEventListener(`visibilitychange`,this.Mr),null)}_r(e){this.Wr&&this.Wr.port.postMessage(e)}connect(e){this.Wr?(this._r({type:`connect`,pn:e}),t.info(`Connecting to real-time messaging`)):t.error(`Cannot connect: real-time messaging worker not initialized`)}disconnect(){this.Wr&&(this._r({type:`disconnect`}),this.isConnected=!1,t.info(`Disconnecting from real-time messaging`))}Ie(){return this.isConnected}isInitialized(){return this.Wr!==null}Er(){this.qr(),this.Ar(),this.Wr&&=(this.Wr.port.close(),null),this.Lr&&=(URL.revokeObjectURL(this.Lr),null),this.isConnected=!1}destroy(){this.disconnect(),this.Er(),t.info(`Real-time messaging worker destroyed`)}},Ot=class extends we{constructor(e,t,n,r,i=!0){super(),this.j=e,this.B=t,this.h=n,this.j=e,this.B=t,this.h=n,this.mite=null,this.ki=null,this.yi=null,this.$i=null,this.Ri=r||null,this.Mi=null,this.xi=null,this.D=null,this.ji=0,this.Wi=5,this.Fi=null,this.Ui=null,this.zi=!0,this.Bi=null,this.Gi=null,this.Pi=null,this.qi=null,this.Hi=!1,this.Ji=new Map,this.Li=null,this.Oi=null,this.Ki=null,this.Qi=this.Vi(i),this.Xi=!1,this.Yi=0,this.Zi()}
302Vi(e){return e?Et()?`sharedworker`:(t.info(`SharedWorker not supported, using direct EventSource (multi-tab will gracefully degrade)`),`direct`):(t.info(`Shared connection disabled, using direct EventSource`),`direct`)}_i(){this.Ki=new Dt({we:e=>{this.Se(e)},ke:()=>{this.ye()},Re:()=>{},Me:e=>{t.error(`Real-time messaging SharedWorker error: ${e}`)}}),this.Ki.initialize()||(t.info(`SharedWorker initialization failed, falling back to direct EventSource`),this.Qi=`direct`,this.Ki=null)}ye(){this.ji=0,this.Bi=null,this.zi=!0,this.Xi=!1,this.Yi=0}Se(e){if(!e.type)return void t.warn(`Received real-time message without type: ${JSON.stringify(e)}`);let n=this.Qi===`sharedworker`?`SharedWorker`:`Direct`;t.info(`Received real-time message of type '${e.type}' via ${n}`);let r=this.Ji.get(e.type);if(r&&r.De()>0)try{r.L(e)}catch(n){t.error(`Error invoking subscription for message type '${e.type}': ${n}`)}else t.info(`No subscribers for real-time message type '${e.type}'`)}We(){return this.Qi===`sharedworker`}Fe(){return this.Qi}Zi(){if(this.B){let e=this.B.dt(B.ft.Ue),n=this.B.dt(B.ft.Ne),r=this.B.dt(B.ft.Te),i=this.B.dt(B.ft.ze);e&&n?(this.mite=e,this.ki=n,this.yi=r,this.$i=i,t.info(`Restored real-time messaging configuration from storage`)):(e||n)&&(t.warn(`Incomplete real-time messaging configuration in storage, clearing`),this.Ae())}}Hr(){this.Li||this.Oi||(this.Li=this.Be(`ddr`,e=>{if(!e.body||typeof e.body.Ge!=`number`)return;let n=Math.random()*e.body.Ge*.3,r=Math.round(e.body.Ge+n),i=e.body.e?` (${e.body.e})`:``;t.info(`Admin requested disconnect${i}, reconnecting in ${r}ms`),this.Pe(),setTimeout(()=>this.qe(),r)}),this.Oi=this.Be(`ttl`,e=>{if(!e.body||typeof e.body.He!=`number`)return;let n=e.body.He;t.info(`Time to live set to ${n}ms, will reconnect when expired`),this.Qi!==`sharedworker`&&(typeof e.body.Je==`string`&&(this.Mi=e.body.Je),this.Ui!==null&&window.clearTimeout(this.Ui),this.Ui=window.setTimeout(()=>{this.Ui=null,t.info(`Time to live expired, performing gapless reconnection`),this.Le()},n))}))}Oe(){this.Gi||this.Pi||(this.qi=()=>{this.Hi=!0,this.zi=!1},window.addEventListener(`beforeunload`,this.qi),this.Gi=()=>{var e;this.Hi=!0,(this.xi||(e=this.Ki)!=null&&e.Ie())&&(t.info(`Page unloading, closing real-time connection gracefully`),this.zi=!1,this.Pe())},window.addEventListener(`pagehide`,this.Gi),this.Pi=e=>{let n=this.xi||this.Ki?.Ie();e.persisted&&this.Ke()&&!n&&(t.info(`Page restored from bfcache, reconnecting`),this.Hi=!1,this.ye(),this.qe())},window.addEventListener(`pageshow`,this.Pi))}St(){return this.D}wt(e){this.D=e}Be(e,t){if(typeof t!=`function`)return null;let n=this.Ji.get(e);return n||(n=new w,this.Ji.set(e,n),Q.q(n)),n.Rt(t)}Qe(e,t){let n=this.Ji.get(e);n&&n.removeSubscription(t)}Ke(){return!!(this.mite&&this.ki)}Ve(){return this.$i?Math.floor(new Date().valueOf()/1e3)>=this.$i:!1}Ae(){this.mite=null,this.ki=null,this.yi=null,this.$i=null,this.Mi=null,this.B&&(this.B.zt(B.ft.Ue),this.B.zt(B.ft.Ne),this.B.zt(B.ft.Te),this.B.zt(B.ft.ze))}Xe(e,n){let r=()=>{typeof n==`function`&&n()},i=this.j,a=this.B;if(!i||!a)return t.error(`NetworkManager or StorageManager not available`),void r();if(!this.h||!this.h.Ye())return t.info(`Real-time messaging is not enabled, skipping refresh`),void r();this.Ke()?t.info(`Refreshing real-time messaging configuration`):t.info(`Fetching initial real-time messaging configuration`);let o=i.$({},!0),s=i.A(o,U.H.Ze,!1),c=new Date().valueOf();U.K(a,U.H.Ze,c),Oe.O({url:`${i.V()}/dust/config`,headers:s,data:o,W:n=>{if(!i.Y(o,n,s))return t.error(`Failed to validate server response for real-time messaging configuration`),void r();i.Z(),n.mite&&n.host?(this.mite=n.mite,this.ki=n.host,this.yi=n.auth||null,this.$i=n.expiration||null,t.info(`Received real-time messaging configuration from server`),a.bt(B.ft.Ue,n.mite),a.bt(B.ft.Ne,n.host),n.auth?a.bt(B.ft.Te,n.auth):a.zt(B.ft.Te),n.expiration?a.bt(B.ft.ze,n.expiration):a.zt(B.ft.ze),this.qe(),typeof e==`function`&&e()):(t.info(`Real-time messaging configuration not available - this SDK version may not be supported`),this.Ae(),r())},error:e=>{i._(e,`retrieving DUST config`),r()}})}qe(){if(!this.h||!this.h.Ye())return;if(!this.Ke())return void t.error(`Cannot start real-time subscription without configuration`);if(this.Ve())return t.info(`Real-time messaging auth token has expired, refreshing configuration`),void this.Xe(()=>{this.qe()},()=>{t.error(`Failed to refresh expired real-time messaging configuration`)});let e=this.mite,n=this.Ri||this.ki;if(e&&n)switch(this.Qi){case`sharedworker`:this._e(e,n);break;case`direct`:this.xi&&(t.info(`Real-time connection already exists, closing before starting new subscription`),this.Pe()),this.sn()}}en(){let e=this.mite,t=this.Ri||this.ki;return e&&t?wt(t,e,this.ji,this.yi||void 0,this.Mi||void 0):null}_e(e,n){if(this.Ki||this._i(),!this.Ki)return t.info(`SharedWorker initialization failed, falling back to direct EventSource`),this.Qi=`direct`,void this.on();this.Ri&&t.info(`Using custom real-time messaging host: ${this.Ri}`),t.info(`Starting real-time subscription via SharedWorker`);let r=this.h?.st()||1e4,i=this.h?.nt()||3e5,a=this.h?.it()||3;this.Ki.connect({mite:e,ki:n,auth:this.yi||void 0,hn:{an:r,ln:i,cn:a}})}on(){this.xi&&(t.info(`Real-time connection already exists, closing before starting new subscription`),this.un()),this.sn()}sn(e){let n=this.en();if(n){this.Ri&&t.info(`Using custom real-time messaging host: ${this.Ri}`);try{let r=new EventSource(n);r.onopen=()=>{e?(t.info(`Gapless reconnection: new connection established, closing old connection`),e.close()):t.info(`Real-time messaging connection established`),this.xi=r,this.ji=0,this.Bi=null,this.zi=!0,this.Xi=!0},r.addEventListener(`msg`,e=>{this.dn(e.data)}),r.onerror=()=>{let n=r.readyState;this.Hi||(n===0?t.info(`Real-time messaging failed to connect`):t.info(`Real-time messaging connection lost`)),e&&this.xi!==r?(t.info(`Gapless reconnection failed, keeping old connection`),r.close(),this.zi&&this.ji<this.Wi&&this.gn()):(this.un(),this.Xi&&(this.Yi++,this.Yi>1)?(t.info(`Real-time messaging connection lost twice after successful connect (likely multi-tab conflict), yielding to other tab`),this.zi=!1):this.zi&&this.ji<this.Wi?this.gn():(this.ji>=this.Wi&&t.error(`Max retry attempts (${this.Wi}) reached for real-time messaging, giving up for current session`),this.zi=!1))}}catch(e){t.error(`Failed to create real-time messaging connection: ${e instanceof Error?e.message:String(e)}`)}}}gn(){this.ji++;let e=this.h?.st()||1e4,n=this.h?.it()||3,r=this.h?.nt()||3e5,i=this.Bi;(i==null||i<e)&&(i=e);let a=Math.min(r,je(e,i*n));this.Bi=a,t.info(`Retrying real-time messaging connection in ${a}ms (attempt ${this.ji}/${this.Wi})`),this.Fi=window.setTimeout(()=>{this.Fi=null,this.qe()},a)}Le(){if(this.Ke()){if(this.Ve())return t.info(`Auth token expired during gapless reconnection, falling back to regular reconnection`),this.Pe(),void this.qe();this.Ui!==null&&(window.clearTimeout(this.Ui),this.Ui=null),this.sn(this.xi||void 0)}else t.error(`Cannot perform gapless reconnection without configuration`)}Pe(){var e;switch(this.Qi){case`sharedworker`:(e=this.Ki)==null||e.disconnect();break;case`direct`:this.un()}}un(){this.Fi!==null&&(window.clearTimeout(this.Fi),this.Fi=null),this.Ui!==null&&(window.clearTimeout(this.Ui),this.Ui=null),this.xi&&(this.xi.
302close(),this.xi=null,t.info(`Real-time messaging connection closed`))}dn(e){try{let t=JSON.parse(e);this.Se(t)}catch(e){t.warn(`Failed to parse real-time message: ${e instanceof Error?e.message:String(e)}`)}}changeUser(e=!1){this.Pe(),e||(this.Ke()&&t.info(`Clearing cached real-time messaging configuration for user change`),this.Ae()),this.ye()}clearData(e=!1){this.zi=!1,this.Pe(),e&&(this.Ke()&&t.info(`Clearing cached real-time messaging configuration (wipeData)`),this.Ae()),this.ye()}destroy(){this.zi=!1,this.Pe(),this.Ae(),this.Ki&&=(this.Ki.destroy(),null),this.Li&&=(this.Qe(`ddr`,this.Li),null),this.Oi&&=(this.Qe(`ttl`,this.Oi),null),this.qi&&=(window.removeEventListener(`beforeunload`,this.qi),null),this.Gi&&=(window.removeEventListener(`pagehide`,this.Gi),null),this.Pi&&=(window.removeEventListener(`pageshow`,this.Pi),null),this.D&&=(Q.removeSubscription(this.D),null)}},X={i:!1,provider:null,o:()=>{if(X.t(),!X.provider){let e=Q.re(`dustHost`);X.provider=new Ot(Q.m(),Q.p(),Q.l(),e),Q.v(X.provider),X.provider.Hr()}return X.provider},t:()=>{X.i||=(Q.g(X),!0)},destroy:()=>{X.provider&&X.provider.destroy(),X.provider=null,X.i=!1}};function kt(){let e=Q.l(),t=Q.nn();if(!e||!t)return null;let n=X.o(),r=()=>{if(!n.St()){n.Oe();let r=t.rn(()=>{e.Ye()&&n.Xe()});return r&&n.wt(r),n.Ke()&&n.qe(),r}return n.St()};return e.Tr(()=>{Q.ao()&&(e.Ye()?(n.Xe(),r()):(n.Pe(),n.Ke()&&n.Ae()))}),e.Ye()?r():null}var At=class e{constructor(e,t,n,r,i){this.endpoint=e,this.Wu=t,this.publicKey=n,this.Yc=r,this.xc=i,this.endpoint=e||null,this.Wu=t||null,this.publicKey=n||null,this.Yc=r||null,this.xc=i||null}gt(){return{e:this.endpoint,c:this.Wu,p:this.publicKey,u:this.Yc,v:this.xc}}static _u(t){return new e(t.e,_(t.c),t.p,t.u,t.v)}},jt=class{constructor(e,t){this.h=e,this.B=t,this.h=e,this.B=t}getUserId(){let e=this.B.$u(B.Ou.Cu);if(e==null)return null;let t=e.Tu,n=k(t);if(n>I.mr){for(;n>I.mr;)t=t.slice(0,t.length-1),n=k(t);e.Tu=t,this.B.Iu(B.Ou.Cu,e)}return t}Ju(e){let t=this.getUserId()==null;this.B.Iu(B.Ou.Cu,new O(e)),t&&this.B.Lu(e)}setCustomUserAttribute(e,n){if(this.h.qu(e))return t.info(`Custom Attribute "`+e+`" is blocklisted, ignoring.`),!1;let r={};return r[e]=n,this.zu(I.Bu,r,!0)}zu(e,n,r=!1,i=!1){let a=this.B.Eu(this.getUserId(),e,n),o=``,s=e,c=n;return r&&(o=` custom`,typeof n==`object`&&(s=Object.keys(n)[0],c=n[s],typeof c==`object`&&(c=JSON.stringify(c,null,2)))),!i&&a&&t.info(`Logged${o} attribute ${s} with value ${c}`),a}gu(e,n,r,a,o){this.zu(`push_token`,e,!1,!0),this.zu(`custom_push_public_key`,r,!1,!0),this.zu(`custom_push_user_auth`,a,!1,!0),this.zu(`custom_push_vapid_public_key`,o,!1,!0);let s=i.Us.Rs,c=new i(s,t),l=new At(e,n,r,a,o);this.B.bt(B.ft.Uu,l.gt()),c.setItem(s.Fs.Fu,s.fe,!0)}wu(e){if(this.zu(`push_token`,null,!1,!0),this.zu(`custom_push_public_key`,null,!1,!0),this.zu(`custom_push_user_auth`,null,!1,!0),this.zu(`custom_push_vapid_public_key`,null,!1,!0),e){let e=i.Us.Rs,n=new i(e,t);this.B.bt(B.ft.Uu,!1),n.setItem(e.Fs.Fu,e.fe,!1)}}},Z={Ph:`allowCrawlerActivity`,Wh:`baseUrl`,Vh:`noCookies`,Kh:`devicePropertyAllowlist`,La:`disablePushTokenMaintenance`,$h:`enableLogging`,Yh:`enableSdkAuthentication`,Ka:`manageServiceWorkerExternally`,Xh:`minimumIntervalBetweenTriggerActionsInSeconds`,Zh:`sessionTimeoutInSeconds`,Qh:`appVersion`,Xa:`appVersionNumber`,Ga:`serviceWorkerLocation`,Ia:`safariWebsitePushId`,Wa:`localization`,er:`contentSecurityNonce`,te:`allowUserSuppliedJavascript`,$a:`inAppMessageZIndex`,Ja:`openInAppMessagesInNewTab`,tn:`openCardsInNewTab`,Oh:`requireExplicitInAppMessageDismissal`,Za:`doNotLoadFontAwesome`,tl:`deviceId`,Ha:`serviceWorkerScope`,Ne:`dustHost`,il:`sdkFlavor`},Q=new class{constructor(){this.tu=``,this.sl=``,this.rl=void 0,this.hl=null,this.eu=null,this.j=null,this.Ru=null,this.h=null,this.C=null,this.B=null,this.vs=null,this.al=``,this.isInitialized=!1,this.ul=!1,this.cl=new w,this.fl=new w,this.options={},this.ml=[],this.dl=[],this.jn=[],this.sl=`6.5.0`}El(e){this.cl.Rt(e)}mh(e){this.fl.Rt(e)}initialize(n,r){if(this.ao())return t.info(`Braze has already been initialized with an API key.`),!0;this.options=r||{};let i=this.re(Z.$h),l=yt(vt.gl());if(l&&l.brazeLogging===`true`&&(i=!0),t.init(i),t.info(`Initialization Options: ${JSON.stringify(this.options,null,2)}`),n==null||n===``||typeof n!=`string`)return t.error(`Braze requires a valid API key to be initialized.`),!1;this.tu=n;let u=this.re(Z.Wh);if(u==null||u===``||typeof u!=`string`)return t.error(`Braze requires a valid baseUrl to be initialized.`),!1;!1===/^https?:/.test(u)&&(u=`https://${u}`);let f=u;if(u=document.createElement(`a`),u.href=f,u.pathname===`/`&&(u=`${u}api/v3`),this.al=u.toString(),z.Il&&!this.re(Z.Ph))return t.info(`Ignoring activity from crawler bot `+navigator.userAgent),this.ul=!0,!1;let p=this.re(Z.Vh)||!1;if(this.B=ze._l(n,p),p&&this.B.Sl(n),new V.le(null,!0).jr(B.pe))return t.info(`Ignoring all activity due to previous opt out`),this.ul=!0,!1;for(let e of d(this.options))o(a).indexOf(e)===-1&&t.warn(`Ignoring unknown initialization option '${e}'.`);let m=[`mparticle`,`wordpress`,`tealium`];if(this.re(Z.il)!=null){let e=this.re(Z.il);m.indexOf(e)===-1?t.error(`Invalid sdk flavor passed: `+e):this.rl=e}let h=this.re(a.Kh);if(h!=null){if(c(h)){let e=[];for(let t=0;t<h.length;
302t++)s(H,h[t],`devicePropertyAllowlist contained an invalid value.`,`DeviceProperties`)&&e.push(h[t]);h=e}else t.error(`devicePropertyAllowlist must be an array. Defaulting to all properties.`),h=null}let g=this.re(Z.tl);if(g){let e=new O(g);this.B.Iu(B.Ou.tl,e)}this.eu=new Ee(this.B,h),this.h=new Le(this.B),this.vs=new jt(this.h,this.B),this.C=new Re(this.B,this.vs,this.h,this.re(Z.Zh));let _=new w;return this.hl=new Ce(this.B,this.re(Z.Yh),_),this.q(_),this.j=new Ae(this.eu,this.B,this.hl,this.vs,this.C,this.h,this.tu,this.al,this.sl,this.rl||``,this.re(Z.Qh),this.re(Z.Xa)),this.Ru=new Fe(this.tu,this.al,this.C,this.eu,this.vs,this.h,this.B,e=>{if(this.ao())for(let t of this.gr())t.N(e)},this.hl,this.j),this.Ru.initialize(),p||this.B.Al(),t.info(`Initialized for the Braze backend at "${this.re(Z.Wh)}" with API key "${this.tu}".`),Y.t(),kt(),this.h.jo(()=>{var t;this.isInitialized&&(t=this.h)!=null&&t.Yr()&&e(()=>import(`./refresh-feature-flags-C2M0IGII.js`).then(e=>{this.isInitialized&&(0,e.default)()}),__vite__mapDeps([2,3]))}),this.Ru.rn(()=>{var t;this.isInitialized&&(t=this.h)!=null&&t.Yr()&&e(()=>import(`./refresh-feature-flags-C2M0IGII.js`).then(e=>{this.isInitialized&&(0,e.default)(void 0,void 0,!0)}),__vite__mapDeps([2,3]))}),this.cl.L(this.options),this.isInitialized=!0,window.dispatchEvent(new CustomEvent(`braze.initialized`)),!0}destroy(e){if(t.destroy(),this.ao()){this.fl.L(),this.fl.removeAllSubscriptions();for(let e of this.ml)e.destroy();this.ml=[];for(let e of this.dl)e.clearData(!1);this.j&&this.j.fo(),this.dl=[],this.removeAllSubscriptions(),this.jn=[],this.Ru!=null&&this.Ru.destroy(),this.Ru=null,this.hl=null,this.eu=null,this.j=null,this.h=null,this.C=null,this.vs=null,this.options={},this.rl=void 0,this.isInitialized=!1,this.ul=!1,e&&(this.B=null)}}rr(){return!this.Nl()&&(!!this.ao()||(console.warn(C.ee),!1))}_a(){return this.tu}Sr(){return this.hl}V(){return this.al}ue(){return this.eu}m(){return this.j}re(e){return this.options[e]}gr(){return this.dl}nn(){return this.Ru}l(){return this.h}u(){return this.C}p(){return this.B}br(){if(this.vs&&this.Ru)return new I(this.vs,this.Ru)}ir(){return this.vs}nr(){return!0===this.re(Z.te)}g(e){let t=!1;for(let n of this.ml)n===e&&(t=!0);t||this.ml.push(e)}v(e){let t=!1;for(let n of this.dl)n.constructor===e.constructor&&(t=!0);e instanceof we&&!t&&this.dl.push(e)}q(e){e instanceof w&&this.jn.push(e)}removeAllSubscriptions(){if(this.rr())for(let e of this.jn)e.removeAllSubscriptions()}removeSubscription(e){if(this.rr())for(let t of this.jn)t.removeSubscription(e)}ge(e){this.ul=e}ao(){return this.isInitialized}Nl(){return this.ul}tr(e,t){return this.rr()?X.o().Be(e,t):null}Vs(){return this.sl}},$={lt:(e,n,r)=>{let i=new Me,a=Q.u();if(!a)return t.info(`Not logging event with type "${e}" because the current session ID could not be found.`),i;let o=a.el();return i.Ee.push(new E(r||Q.ir()?.getUserId(),e,new Date().valueOf(),o,n)),i.W=Q.p()?.ol(i.Ee)||!1,i}};export{f as $,U as A,F as B,qe as C,Me as D,W as E,I as F,w as G,ne as H,le as I,x as J,C as K,_e as L,B as M,z as N,je as O,R as P,c as Q,me as R,Je as S,Ne as T,k as U,j as V,D as W,h as X,p as Y,_ as Z,G as _,Y as a,Ue as b,yt as c,K as d,d as et,tt as f,Ze as g,Qe as h,At as i,t as it,we as j,Oe as k,pt as l,$e as m,Z as n,r as nt,J as o,et as p,S as q,Q as r,n as rt,bt as s,$ as t,i as tt,vt as u,Xe as v,Be as w,Ge as x,Ye as y,P as z};
303//# sourceMappingURL=event-logger-opS20UOn.js.map

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.