1try{let e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:{},t=(new e.Error).stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]="1d424ece-9540-4cdf-975c-b7c1d51ee882",e._sentryDebugIdIdentifier="sentry-dbid-1d424ece-9540-4cdf-975c-b7c1d51ee882")}catch(e){}(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4926],{15524:(e,t,s)=>{e.exports=s(54614).A},54614:(e,t,s)=>{"use strict";let i;s.d(t,{A:()=>ej});class n{on(e,t){var s=this[e];s?s.push(t):this[e]=[t]}dispatch(e,t){var s=this[e];s&&s.forEach(e=>e(t))}}function a(e){ej.config&&ej.config.logging&&console.log(`Gist: ${e}`)}let o="gist.web.isPersistingSession";function r(e,t,s=null){var i=s;i||(i=new Date).setDate(i.getDate()+365);let n={value:t,expiry:i};d().setItem(e,JSON.stringify(n))}function u(e){d().removeItem(e)}function l(){let e=sessionStorage.getItem(o);return null===e?(sessionStorage.setItem(o,"true"),!0):"true"===e}function d(){return l()?localStorage:sessionStorage}function c(e){if(!e)return null;try{let t=d().getItem(e);if(!t)return null;let s=JSON.parse(t);if(!s.expiry)return s.value;let i=new Date,n=new Date(s.expiry),a=e.startsWith("gist.web.message.broadcasts")&&!e.endsWith("shouldShow")&&!e.endsWith("numberOfTimesShown")||e.startsWith("gist.web.message.user")&&!e.endsWith("seen"),o=new Date(i.getTime()+366e4);if(a&&n.getTime()>o.getTime()||i.getTime()>n.getTime())return u(e),null;return s.value}catch(t){a(`Error checking key ${e} for expiry: ${t}`)}return null}var g,m=new Uint8Array(16);let f=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i;for(var p=[],h=0;h<256;++h)p.push((h+256).toString(16).substr(1));let v=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,s=(p[e[t+0]]+p[e[t+1]]+p[e[t+2]]+p[e[t+3]]+"-"+p[e[t+4]]+p[e[t+5]]+"-"+p[e[t+6]]+p[e[t+7]]+"-"+p[e[t+8]]+p[e[t+9]]+"-"+p[e[t+10]]+p[e[t+11]]+p[e[t+12]]+p[e[t+13]]+p[e[t+14]]+p[e[t+15]]).toLowerCase();if(!("string"==typeof s&&f.test(s)))throw TypeError("Stringified UUID is invalid");return s},w=function(e,t,s){var i=(e=e||{}).random||(e.rng||function(){if(!g&&!(g="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return g(m)})();if(i[6]=15&i[6]|64,i[8]=63&i[8]|128,t){s=s||0;for(var n=0;n<16;++n)t[s+n]=i[n];return t}return v(i)},y="gist.web.userQueueUseSSE",b="gist.web.activeSSEConnection",I=30,S={RENDERER_HOST:"https://code.gist.build",ENGINE_API_ENDPOINT:{prod:"https://engine.api.gist.build",dev:"https://engine.api.dev.gist.build",local:"http://engine.api.local.gist.build:82"},GIST_QUEUE_API_ENDPOINT:{prod:"https://consumer.cloud.gist.build",dev:"https://consumer.cloud.dev.gist.build",local:"http://api.local.gist.build:86"},GIST_QUEUE_REALTIME_API_ENDPOINT:{prod:"https://realtime.cloud.gist.build",dev:"https://realtime.cloud.dev.gist.build",local:"http://api.local.gist.build:3000"},GIST_VIEW_ENDPOINT:{prod:"https://renderer.gist.build/3.0",dev:"https://renderer.gist.build/3.0",local:"http://app.local.gist.build:8080/web"},getSdkId:function(){return i||(i=w()),i},useSSE:function(){return c(y)??!1},setUseSSEFlag:function(e){r(y,e,new Date(new Date().getTime()+6e4)),a(`Set user uses SSE to "${e}"`)},removeActiveSSEConnection:function(){u(b)},setActiveSSEConnection:function(){r(b,S.getSdkId(),new Date(new Date().getTime()+S.getSSEHeartbeat()))},hasActiveSSEConnection:function(){return c(b)??!1},isSSEConnectionManagedBySDK:function(){return c(b)===S.getSdkId()},getSSEHeartbeat:function(){return(I+5)*1e3},setSSEHeartbeat:function(e){e&&e>0&&(I=e)}};function E(){let e=S.GIST_QUEUE_API_ENDPOINT[ej.config.env],t={"X-CIO-Site-Id":ej.config.siteId,"X-CIO-Client-Platform":"web"},s=U();async function i(s,n={}){let a=new AbortController,o=setTimeout(()=>a.abort(),5e3);try{let i=await fetch(e+s,{method:n.method||"GET",headers:{...t,...n.headers||{}},body:n.method&&"GET"!==n.method.toUpperCase()?n.body:void 0,signal:a.signal});clearTimeout(o);let r=i.headers.get("content-type")?.includes("application/json")?await i.json():await i.text(),u=Object.fromEntries(i.headers.entries());if(i.status<200||i.status>=400)throw{response:{status:i.status,data:r,headers:u}};return{status:i.status,headers:u,data:r}}catch(e){throw clearTimeout(o),e.response||(e.response={status:0,data:e.message||"Unknown error"}),e}}return null!=s&&(t["X-Gist-Encoded-User-Token"]=s),i.post=(e,t={},s={})=>i(e,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json",...s.headers||{}}}),i}let $="gist.web.userLocale";var x=600,k=!1;let T="gist.web.userQueueNextPullCheck",C="gist.web.sessionId";async function D(){var e;try{if(!k){k=!0;var t={"X-Gist-User-Anonymous":P(),"Content-Language":null===c($)?navigator.language:c($)};e=await E().post(`/api/v3/users?sessionId=${M()}`,{},{headers:t})}}catch(t){t.response?e=t.response:a(`Error getting user queue: ${t}`)}finally{k=!1,function(e){if(e&&e.headers){var t=e.headers["x-gist-queue-polling-interval"];t&&t>0&&(x=t)}var s=new Date(new Date().getTime()+1e3*x);r(T,x,s)}(e),function(e){let t=e?.headers?.["x-cio-use-sse"]?.toLowerCase()==="true";S.setUseSSEFlag(t)}(e)}return e}function M(){var e=c(C);return e||(e=w()),r(C,e,new Date(new Date().getTime()+18e5)),e}let A="gist.web.userToken",R="gist.web.usingGuestUserToken",L="gist.web.guestUserToken";function P(){return null!==c(R)}function q(){if(null===c(A)){var e=c(L);null==e&&(r(L,e=w()),a(`Set guest user token "${e}" with expiry date set to 1 year from today`)),r(A,e),r(R,!0),a(`Using anonymous session with token: "${e}"`)}}async function N(){var e=c(A);return null===e?null:await _(e)}function U(){var e=c(A);return null===e?null:btoa(e)}async function _(e){let t=new TextEncoder().encode(e);return Array.from(new Uint8Array(await crypto.subtle.digest("SHA-256",t))).map(e=>e.toString(16).padStart(2,"0")).join("")}async function W(e){try{return await E().post(`/api/v1/logs/queue/${e}`)}catch(e){return e.response}}async function O(e){try{return await E().post(`/api/v1/logs/message/${e}`)}catch(e){return e.response}}function H(e){let t={isEmbedded:!1,elementId:"",hasRouteRule:!1,routeRule:"",position:"",hasPosition:!1,shouldScale:!1,campaignId:null,messageWidth:414,overlayColor:"#00000033",persistent:!1,exitClick:!1,hasCustomWidth:!1},s=e?.properties?.gist;return s?{isEmbedded:!!s.elementId,elementId:s.elementId||"",hasRouteRule:!!s.routeRuleWeb,routeRule:s.routeRuleWeb||"",position:s.position||"",hasPosition:!!s.position,shouldScale:!!s.scale,campaignId:s.campaignId??null,messageWidth:s.messageWidth>0?s.messageWidth:t.messageWidth,hasCustomWidth:s.messageWidth>0,overlayColor:s.overlayColor||t.overlayColor,persistent:!!s.persistent,exitClick:!!s.exitClick}:t}var V=["x-gist-top","x-gist-floating-top","x-gist-bottom","x-gist-floating-bottom","x-gist-floating-bottom-left","x-gist-floating-bottom-right","x-gist-floating-top-left","x-gist-floating-top-right"];let G=["x-gist-top","x-gist-bottom","x-gist-floating-top","x-gist-floating-bottom"];function z(e){var t=X(e);if(t)return t.style&&t.style.height&&"0px"!=t.style.height}function j(e,t){let s=document.getElementById(e);s&&(s.onload=function(){var s=e,i=t;let n=document.getElementById(s);
1n&&n.contentWindow&&n.contentWindow.postMessage({options:i},"*")})}async function F(){var e=document.querySelector(".gist-message");e&&(e.classList.remove("gist-visible"),await new Promise(e=>setTimeout(e,300))),B()}function B(){var e=document.querySelector("#gist-embed-message");e&&e.parentNode.removeChild(e)}function Q(e){return`gist-${e}`}function J(){var e=document.querySelector(".gist-message");e&&e.classList.add("gist-visible")}function X(e){try{var t=document.querySelector(`#${e}`);if(t)return t;return null}catch{return null}}let Y="gist.web.customAttributes",K=new Map;function Z(){let e=Array.from(K.entries()),t=new Date;t.setDate(t.getDate()+30),r(Y,e,t),a(`Saved ${K.size} custom attributes to storage with TTL of 30 days`)}async function ee(e){let t=await eo();if(!t)return;let s=new Date;s.setMinutes(s.getMinutes()+60),r(t,e.filter(ea),s)}async function et(){let e=await eo();return e?(c(e)??[]).filter(t=>{let{broadcast:s}=t.properties.gist,i=c(eu(e,t.queueId))??!0,n=c(er(e,t.queueId))||0,a=0===s.frequency.count;return i&&(a||n<s.frequency.count)}):[]}async function es(e){a(`Marking broadcast ${e} as seen.`);let t=await eo();if(!t)return;let s=await en(t,e);if(!s)return;let{broadcast:i}=s.properties.gist,n=er(t,e),o=eu(t,e),u=c(n)||0;if(r(n,u+1),1===i.frequency.count)r(o,!1),a(`Marked broadcast ${e} as seen.`);else{let t=new Date;t.setSeconds(t.getSeconds()+i.frequency.delay),r(o,!1,t),a(`Marked broadcast ${e} as seen, broadcast was seen ${u+1} times, next show date is ${t}.`)}}async function ei(e){a(`Marking broadcast ${e} as dismissed.`);let t=await eo();if(!t)return;let s=await en(t,e);if(!s)return;let{broadcast:i}=s.properties.gist;if(!0===i.frequency.ignoreDismiss)return void a(`Broadcast ${e} is set to ignore dismiss.`);r(eu(t,e),!1),a(`Marked broadcast ${e} as dismissed and will not show again.`)}async function en(e,t){return c(e).find(e=>e.queueId===t)}function ea(e){return e.properties&&e.properties.gist&&e.properties.gist.broadcast}async function eo(){let e=await N();return e?`gist.web.message.broadcasts.${e}`:null}function er(e,t){return`${e}.${t}.numberOfTimesShown`}function eu(e,t){return`${e}.${t}.shouldShow`}!function(){let e=c(Y);if(e)try{K=new Map(e)}catch{K=new Map}else K=new Map}();let el="gist.web.message.user";async function ed(e){let t=await ev();if(!t)return;let s=e.filter(e=>!(e.properties&&e.properties.gist&&e.properties.gist.broadcast)),i=new Date;i.setMinutes(i.getMinutes()+60),r(t,s,i)}async function ec(){let e=await ev();if(!e)return[];let t=c(e)??[],s=await eh();return t.filter(e=>!s.includes(e.queueId))}async function eg(e){let t=await ew();if(!t)return;let s=c(t)??[];s.push(e),r(t,s)}async function em(e){let t=await ey(e);return!!t&&null!==c(t)}async function ef(e){let t=await ey(e);if(!t)return!1;r(t,!0,new Date(Date.now()+5e3))}async function ep(e){let t=await ey(e);if(!t)return!1;u(t)}async function eh(){let e=await ew();return e?c(e)??[]:[]}async function ev(){let e=await N();return e?`${el}.${e}`:null}async function ew(){let e=await N();return e?`${el}.${e}.seen`:null}async function ey(e){let t=await N();return t?`${el}.${t}.message.${e}.loading`:null}async function eb(e){if(!ej.isDocumentVisible)return a("Document hidden, not showing message now."),null;if(ej.overlayInstanceId)return a(`Message ${ej.overlayInstanceId} already showing.`),null;var t=H(e);return e.instanceId=w(),e.overlay=!0,e.firstLoad=!0,e.shouldResizeHeight=!0,e.shouldScale=t.shouldScale,e.renderStartTime=new Date().getTime(),ej.overlayInstanceId=e.instanceId,ej.currentMessages.push(e),ek(e)}async function eI(e,t){return ej.isDocumentVisible?(e.instanceId=w(),e.overlay=!1,e.firstLoad=!0,e.shouldScale=!1,e.elementId=t,e.shouldResizeHeight=!z(t),e.renderStartTime=new Date().getTime(),ej.currentMessages.push(e),ek(e,t)):(a("Document hidden, not showing message now."),null)}async function eS(e){e?(ej.messageDismissed(e),e.overlay?await ex(!0,e):e$(e)):a(`Message with instance id: ${e.instanceId} not found`)}async function eE(e){var t=H(e);e?t.persistent&&(a("Persistent message dismissed, logging view"),await eL(e),await eT(e)):a(`Message with instance id: ${e.instanceId} not found`)}function e$(e){var t;eD(e.instanceId),(t=X(e.elementId))&&(t.classList.remove("gist-visible"),t.style.removeProperty("height"),t.innerHTML="")}async function ex(e,t){e?await F():B(),0==ej.currentMessages.length&&(window.removeEventListener("message",eR),window.removeEventListener("touchstart",eA)),eD(t.instanceId),ej.overlayInstanceId=null}function ek(e,t=null){if(t&&(s=X(t))&&s.classList.contains("gist-visible"))return a(`Message ${e.messageId} already showing in element ${t}.`),null;var s,i={endpoint:S.ENGINE_API_ENDPOINT[ej.config.env],siteId:ej.config.siteId,dataCenter:ej.config.dataCenter,messageId:e.messageId,instanceId:e.instanceId,livePreview:!1,properties:e.properties,customAttributes:Object.fromEntries(new Map(K))},n=`${S.GIST_VIEW_ENDPOINT[ej.config.env]}/index.html`;if(window.addEventListener("message",eR),window.addEventListener("touchstart",eA),t){V.includes(t)&&function(e){let t=document.createElement("div");t.id=e,"x-gist-top"===e?document.body.insertBefore(t,document.body.firstChild):document.body.insertAdjacentElement("beforeend",t),a("Top & bottom elements injected into page")}(t);var o=X(t);if(o){var r=Q(e.instanceId);o.classList.add(r);var u=H(e),l=u.messageWidth+"px";
1G.includes(t)&&!u.hasCustomWidth&&(l="100%"),V.includes(t)&&(o.style.width=l),z(t)||(o.style.height="0px"),o.innerHTML=function(e,t,s){var i,n;return i=Q(t.instanceId),n=800,s.messageWidth>n&&(n=s.messageWidth),` 2 <div id="gist-embed"> 3 <style> 4 #x-gist-floating-top, #x-gist-floating-top-left, #x-gist-floating-top-right { 5 position: fixed; 6 top: 0px; 7 z-index: 1000000; 8 } 9 #x-gist-floating-bottom, #x-gist-floating-bottom-left, #x-gist-floating-bottom-right { 10 position: fixed; 11 bottom: 0px; 12 z-index: 1000000; 13 } 14 #x-gist-bottom, #x-gist-top, #x-gist-floating-top, #x-gist-floating-bottom { 15 left: 50%; 16 transform: translate(-50%, 0%); 17 } 18 #x-gist-floating-top-right, #x-gist-floating-bottom-right { 19 right: 0px; 20 } 21 #gist-embed { 22 position: relative; 23 height: 100%; 24 width: 100%; 25 } 26 #gist-embed-container { 27 position: relative; 28 height: 100%; 29 width: 100%; 30 } 31 #gist-embed-container .gist-frame { 32 height: 100%; 33 width: 100%; 34 border: none; 35 } 36 #x-gist-top.${i}, 37 #x-gist-bottom.${i}, 38 #x-gist-floating-top.${i}, 39 #x-gist-floating-bottom.${i}, 40 #x-gist-floating-top-left.${i}, 41 #x-gist-floating-top-right.${i}, 42 #x-gist-floating-bottom-left.${i}, 43 #x-gist-floating-bottom-right.${i} { 44 transition: height 0.1s ease-in-out; 45 } 46 @media (max-width: ${n}px) { 47 #x-gist-top.${i}, 48 #x-gist-bottom.${i}, 49 #x-gist-floating-top.${i}, 50 #x-gist-floating-bottom.${i}, 51 #x-gist-floating-top-left.${i}, 52 #x-gist-floating-top-right.${i}, 53 #x-gist-floating-bottom-left.${i}, 54 #x-gist-floating-bottom-right.${i} { 55 width: 100% !important; 56 } 57 } 58 </style> 59 <div id="gist-embed-container"> 60 <iframe id="${i}" class="gist-frame" src="${e}"></iframe> 61 </div> 62 </div>`}(n,e,u),j(r,i)}else a(`Message could not be embedded, elementId ${t} not found.`)}else document.body.insertAdjacentHTML("afterbegin",function(e,t){var s,i,n=H(t);return s=Q(t.instanceId),i=600,n.messageWidth>i&&(i=n.messageWidth),` 63 <div id="gist-embed-message"> 64 <style> 65 #gist-overlay.gist-background { 66 position: fixed; 67 z-index: 9999999998; 68 left: 0; 69 top: 0; 70 width: 100%; 71 height: 100%; 72 background-color: ${n.overlayColor}; 73 visibility: hidden; 74 } 75 #gist-overlay.gist-background.gist-visible { 76 visibility: visible; 77 } 78 .gist-message { 79 width: ${n.messageWidth}px; 80 position: absolute; 81 border: none; 82 opacity: 0; 83 transition: opacity 0.3s ease-in-out, height 0.1s ease-in-out; 84 z-index: 9999999999; 85 left: 50%; 86 transform: translateX(-50%); 87 } 88 .gist-message.gist-visible { 89 opacity: 1; 90 pointer-events: auto; 91 } 92 .gist-message.gist-center { 93 transform: translate(-50%, -50%); 94 top: 50%; 95 } 96 .gist-message.gist-bottom { 97 bottom: 0; 98 } 99 .gist-message.gist-top { 100 top: 0; 101 } 102 @media (max-width: ${i}px) { 103 .gist-message { 104 width: 100%; 105 } 106 } 107 </style> 108 <div id="gist-overlay" class="gist-background"> 109 <iframe id="${s}" class="gist-message" src="${e}"></iframe> 110 </div> 111 </div>`}(n,e)),j(Q(e.instanceId),i);return e}async function eT(e){a(`Message shown, logging view for: ${e.messageId}`);var t={};null!=e.queueId?(await eL(e),t=await W(e.queueId)):t=await O(e.messageId),200===t.status?a("Message view logged"):a(`Problem logging message: ${t.status}`)}function eC(e){return ej.currentMessages.find(t=>t.instanceId===e)}function eD(e){ej.currentMessages=ej.currentMessages.filter(t=>t.instanceId!==e)}function eM(e,t){eD(e),ej.currentMessages.push(t)}function eA(){}async function eR(e){if(e.data.gist&&e.origin===S.RENDERER_HOST){var t=e.data.gist.instanceId,s=eC(t);if(s){var i,n,o=H(s);switch(e.data.gist.method){case"routeLoaded":var r=(new Date().getTime()-s.renderStartTime)*.001;if(a(`Engine render for message: ${s.messageId} timer elapsed in ${r.toFixed(3)} seconds`),ep(s.queueId),s.currentRoute=e.data.gist.parameters.route,s.firstLoad){if(s.overlay){var u,l=H(s),d=document.querySelector("#gist-overlay");if(d){d.classList.add("gist-visible");var c=document.querySelector(".gist-message");s.position?c.classList.add("gist-"+s.position):c.classList.add("gist-center"),setTimeout(J,100),l.exitClick&&setTimeout(()=>{var e,t;return e=s.instanceId,void((t=document.querySelector("#gist-overlay"))&&t.addEventListener("click",function(){ej.dismissMessage(e)}))},1e3)}else B()}else(u=X(s.elementId))&&u.classList.add("gist-visible");ej.messageShown(s),o.persistent?a("Persistent message shown, skipping logging view"):await eT(s),s.firstLoad=!1}eM(t,s);break;case"tap":var g=e.data.gist.parameters.action,m=e.data.gist.parameters.name;if(ej.messageAction(s,g,m),e.data.gist.parameters.system&&!o.persistent){await eS(s);break}try{var f=new URL(g);if(f&&"gist:"===f.protocol)switch(f.href.replace("gist://","").split("?")[0]){case"close"
111:await eS(s),await eE(s),await eP(s),await eW();break;case"showMessage":var p=f.searchParams.get("messageId"),h=f.searchParams.get("properties");p&&(h&&(h=JSON.parse(atob(h))),await ej.showMessage({messageId:p,properties:h}));break;case"loadPage":(f=f.href.substring(f.href.indexOf("?url=")+5))&&(f.startsWith("mailto:")||f.startsWith("https://")||f.startsWith("http://")||f.startsWith("/")?window.location.href=f:window.location.href=window.location+f)}}catch{}break;case"routeChanged":s.currentRoute=e.data.gist.parameters.route,s.renderStartTime=new Date().getTime(),eM(t,s),a(`Route changed to: ${s.currentRoute}`);break;case"sizeChanged":a(`Size Changed Width: ${e.data.gist.parameters.width} - Height: ${e.data.gist.parameters.height}`),(!s.elementId||s.shouldResizeHeight)&&function(e,t){var s=X(e.elementId?e.elementId:Q(e.instanceId));if(s){var i=s.style;if(t.height>0)if(t.height>window.innerHeight){var n=1-(t.height/window.innerHeight-1);e.shouldScale&&n>=.4?(i.height=`${t.height}px`,i.transform=`translateX(-50%) translateY(-50%) scale(${n})`):i.height=`${window.innerHeight}px`}else i.height=`${t.height}px`}}(s,e.data.gist.parameters);break;case"titleChanged":a(`Overlay title changed to: ${e.data.gist.parameters.title}`),i=e.data.gist.parameters.title,(n=X(Q(t)))&&(n.title=i);break;case"eventDispatched":ej.events.dispatch("eventDispatched",{name:e.data.gist.parameters.name,payload:e.data.gist.parameters.payload});break;case"error":case"routeError":ej.messageError(s),ej.overlayInstanceId?ex(!1,s):e$(s)}}}}async function eL(e){a(`Logging user message view locally for: ${e.queueId}`),ea(e)?await es(e.queueId):await eg(e.queueId)}async function eP(e){ea(e)&&(a(`Logging broadcast dismissed locally for: ${e.queueId}`),await ei(e.queueId))}var eq=(e,t)=>e().then(new Promise(e=>setTimeout(e,t)).then(()=>eq(e,t))),eN=!1;let eU=null;async function e_(){eN?await eW():c(A)?(a("Queue watcher started"),eN=!0,eq(()=>new Promise(()=>eH()),1e3)):a("User token not setup, queue not started.")}async function eW(){var e=await et(),t=await ec(),s=e.concat(t);for(let e of(a(`Messages in local queue: ${s.length}`),s.sort((e,t)=>e.priority-t.priority)))await eO(e)}async function eO(e){var t=H(e);if(t.hasRouteRule){var s=ej.currentRoute;null==s&&(s=new URL(window.location.href).pathname);var i=t.routeRule;if(a(`Verifying route ${s} against rule: ${i}`),!new RegExp(i).test(s))return a(`Route ${s} does not match rule.`),!1}if(t.hasPosition&&(e.position=t.position),!t.persistent&&!function(e){if(!ea(e))return!1;let{broadcast:t}=e.properties.gist;return 0===t.frequency.delay&&0===t.frequency.count}(e)&&await em(e.queueId))return a(`Not showing message with queueId ${e.queueId} because its already loading.`),!1;var n=!1;return(n=t.isEmbedded?await eI(e,t.elementId):await eb(e))&&ef(e.queueId),n}async function eH(){if(S.hasActiveSSEConnection()){!S.isSSEConnectionManagedBySDK()&&eU&&(a("Not the main instance, closing our SSE connection."),ez()),await eW();return}if(eU&&(a("SSE connection not active, closing it."),ez()),S.useSSE()&&!P())return void await eG();await eV()}async function eV(){if(c(A))if(ej.isDocumentVisible)if(null===c(T)){var e=await D(),t=[];e?(200===e.status||204===e.status?(a("200 response, updating local store."),ed(t=e.data),ee(t)):304===e.status&&a("304 response, using local store."),await eW()):a("There was an error while checking message queue.")}else a("Next queue pull scheduled for later.");else a("Document not visible, skipping queue check.");else a("User token reset, skipping queue check.")}async function eG(){var e;ez();let t=null===(e=U())?(a("No user token available for SSE endpoint."),null):S.GIST_QUEUE_REALTIME_API_ENDPOINT[ej.config.env]+`/api/v3/sse?userToken=${e}&siteId=${ej.config.siteId}&sessionId=${M()}`;if(null===t){a("SSE endpoint not available, falling back to polling."),await eV();return}a(`Starting SSE queue listener on ${t}`),eU=new EventSource(t),S.setActiveSSEConnection(),eU.addEventListener("connected",async e=>{try{a("SSE connection received:",e),S.setUseSSEFlag(!0);var t=JSON.parse(e.data);t.heartbeat&&(S.setSSEHeartbeat(t.heartbeat),a(`SSE heartbeat set to ${t.heartbeat} seconds`)),S.setActiveSSEConnection()}catch(e){a(`Failed to parse SSE settings: ${e}`)}u(T),await eV()}),eU.addEventListener("messages",async e=>{try{var t=JSON.parse(e.data);a("SSE message received:",t),await ed(t),await ee(t),await eW()}catch(e){a("Failed to parse SSE message",e),ez()}}),eU.addEventListener("error",async e=>{a("SSE error received:",e),ez()}),eU.addEventListener("heartbeat",async e=>{a("SSE heartbeat received:",e),S.setActiveSSEConnection(),S.setUseSSEFlag(!0)})}function ez(e=!1){e&&S.removeActiveSSEConnection(),(e||S.isSSEConnectionManagedBySDK())&&S.setUseSSEFlag(!1),eU&&(a("Stopping SSE queue listener..."),eU.close(),eU=null)}let ej=class{static async setup(e){this.events=new n,this.config={useAnonymousSession:void 0!==e.useAnonymousSession&&e.useAnonymousSession,siteId:e.siteId,dataCenter:e.dataCenter,env:void 0===e.env?"prod":e.env,logging:void 0!==e.logging&&e.logging,experiments:void 0!==e.experiments&&e.experiments},this.currentMessages=[],this.overlayInstanceId=null,this.currentRoute=null,this.isDocumentVisible=!0,this.config.isPreviewSession=function(){let e=new URLSearchParams(window.location.search).get("cioPreviewId");e&&(sessionStorage.setItem(o,!1),ej.setUserToken(e),a(`Preview mode enabled with user token: ${e}`));return!l()}();let t=d();for(let e=t.length-1;e>=0;e--)c(t.key(e));a(`Setup complete on ${this.config.env} environment.`),!this.config.isPreviewSession&&this.config.useAnonymousSession&&q(),await e_(),document.addEventListener("visibilitychange",async()=>{"hidden"===document.visibilityState?this.isDocumentVisible=!1:(this.isDocumentVisible=!0,await eW())},!1)}static async setCurrentRoute(e){this.currentRoute=e,a(`Current route set to: ${e}`),await eW()}static async setUserToken(e,t){if(!this.config.isPreviewSession){var s;void 0===(s=t)&&(s=new Date).setDate(s.getDate()+30),r(A,e,s),P()&&(u(T),u(R)),a(`Set user token "${e}" with expiry date set to ${s}`),ez(!0),await e_()}}static setUserLocale(e){r($,e),a(`Set user locate to "${e}"`)}static setCustomAttribute(e,t){return e&&"string"==typeof e?(K.set(e,t),Z(),a(`Set custom attribute "${e}" to "${t}"`),!0):(a(`Invalid key for custom attribute: ${e}`),!1)}static clearCustomAttributes(){K.clear(),u(Y),a("Cleared all custom attributes")}static removeCustomAttribute(e){if(!e||"string"!=typeof e)return a(`Invalid key for custom attribute: ${e}`),!1;let t=K.has(e);return K.delete(e),K.size>0?Z():u(Y),a(`Removed custom attribute "${e}"`),t}static async clearUserToken(){this.config.isPreviewSession||(u(A),a("Cleared user token"),this.config.useAnonymousSession&&q(),ez(!0),await e_())}static async dismissMessage(e){var t=eC(e);await eS(t),await eE(t),await eP(t),await eW()}static async embedMessage(e,t){var s=await eI(e,t);return s?s.instanceId:null}static async showMessage(e){var t=await eb(e);return t?t.instanceId:null}static messageShown(e){a(`Message shown: ${e.messageId}`),this.events.dispatch("messageShown",e)}static messageDismissed(e){null!==e&&(a(`Message dismissed: ${e.messageId}`),this.events.dispatch("messageDismissed",e))}static messageError(e){a(`Message error: ${e.messageId}`),this.events.dispatch("messageError",e)}static messageAction(e,t,s){a(`Message action: ${e.currentRoute}, ${t} with name ${s} on ${e.instanceId}`),this.events.dispatch("messageAction",{message:e,action:t,name:s})}}},78504:(e,t,s)=>{"use strict";s.r(t),s.d(t,{InAppEvents:()=>i,InAppPlugin:()=>d});var i,n,a=s(8991);!function(e){e.MessageOpened="in-app:message-opened",e.MessageDismissed="in-app:message-dismissed",e.MessageError="in-app:message-error",e.MessageAction="in-app:message-action"}(i||(i={}));var o=Object.values(i);function r(e,t){return new CustomEvent(e,{detail:t})}!function(e){e.Metric="Report Delivery Event",e.Content="Report Content Event",e.Opened="opened",e.Clicked="clicked",e.ViewedContent="viewed_content",e.ClickedContent="clicked_content"}(n||(n={}));var u=s(15524),l=s.n(u);function d(e){var t,s=this,u=!1,d=!1,c=new EventTarget;function g(e){return(0,a.sH)(this,void 0,void 0,function(){return(0,a.YH)(this,function(t){switch(t.label){case 0:return[4,l().clearUserToken()];case 1:return t.sent(),[2,e]}})})}function m(e){return(0,a.sH)(this,void 0,void 0,function(){var s;return(0,a.YH)(this,function(i){switch(i.label){case 0:if(!u)return[2,e];if(!("string"==typeof(s=t.user().id())&&s.length>0))return[3,2];return[4,l().setUserToken(s)];case 1:return i.sent(),[3,4];case 2:return[4,l().clearUserToken()];case 3:i.sent(),i.label=4;case 4:return[2,e]}})})}return{name:"Customer.io In-App Plugin",type:"before",version:"0.0.1",isLoaded:function(){return d},load:function(f,p){return(0,a.sH)(s,void 0,void 0,function(){return(0,a.YH)(this,function(s){switch(s.label){case 0:if(t=p,null==e.siteId||""==e.siteId)return console.error("[Customer.io In-App Plugin] ".concat("siteId is required. Can't initialize.")),[2,f];return[4,l().setup({siteId:e.siteId,env:e._env?e._env:"prod",logging:e._logging,useAnonymousSession:e.anonymousInApp})];case 1:return s.sent(),u=!0,[4,m(f)];case 2:return s.sent(),u&&!d&&(t.on("reset",g),e.events&&(o.forEac
111h(function(t){c.addEventListener(t,null==e?void 0:e.events)}),["messageShown","messageDismissed","messageError"].forEach(function(e){l().events.on(e,function(t){var s,n;c.dispatchEvent(r(function(e){switch(e){case"messageShown":return i.MessageOpened;case"messageDismissed":return i.MessageDismissed;case"messageError":return i.MessageError;case"messageAction":return i.MessageAction;default:return""}}(e),{messageId:t.messageId,deliveryId:null==(n=null==(s=t.properties)?void 0:s.gist)?void 0:n.campaignId}))})})),l().events.on("messageShown",function(e){var s,i,a,o,r,u,l,d,c=null==(i=null==(s=null==e?void 0:e.properties)?void 0:s.gist)?void 0:i.campaignId;if(void 0!==c&&""!=c)return void t.track(n.Metric,{deliveryId:c,metric:n.Opened});var g=null==(r=null==(o=null==(a=null==e?void 0:e.properties)?void 0:a.gist)?void 0:o.broadcast)?void 0:r.broadcastIdInt;if(g){var m=null==(d=null==(l=null==(u=null==e?void 0:e.properties)?void 0:u.gist)?void 0:l.broadcast)?void 0:d.templateId;t.track(n.Content,{actionType:n.ViewedContent,contentId:g,templateId:m,contentType:"iab"})}}),l().events.on("messageAction",function(s){if("gist://close"!=s.action){var a,o,u,d,g,m,f,p,h,v,w,y=null==(u=null==(o=null==(a=null==s?void 0:s.message)?void 0:a.properties)?void 0:o.gist)?void 0:u.campaignId;if(void 0!==y&&""!=y){t.track(n.Metric,{deliveryId:y,metric:n.Clicked,actionName:s.name,actionValue:s.action}),e.events&&c.dispatchEvent(r(i.MessageAction,{messageId:s.message.messageId,deliveryId:y,action:s.action,name:s.name,actionName:s.name,actionValue:s.action,message:{dismiss:function(){var e;l().dismissMessage(null==(e=null==s?void 0:s.message)?void 0:e.instanceId)}}}));return}var b=null==(f=null==(m=null==(g=null==(d=null==s?void 0:s.message)?void 0:d.properties)?void 0:g.gist)?void 0:m.broadcast)?void 0:f.broadcastIdInt;if(b){var I=null==(w=null==(v=null==(h=null==(p=null==s?void 0:s.message)?void 0:p.properties)?void 0:h.gist)?void 0:v.broadcast)?void 0:w.templateId;t.track(n.Content,{actionType:n.ClickedContent,contentId:b,templateId:I,contentType:"iab",actionName:s.name,actionValue:s.action})}}}),l().events.on("eventDispatched",function(e){var s,i,n;if("analytics:track"==e.name){var a=null==(s=e.payload)?void 0:s.event;if(void 0===a||""==a)return;t.track(a,null==(i=e.payload)?void 0:i.properties,null==(n=e.payload)?void 0:n.options)}})),d=!0,[2,Promise.resolve()]}})})},identify:m,page:function(e){var t,s,i,n,o;return(0,a.sH)(this,void 0,void 0,function(){var r;return(0,a.YH)(this,function(a){return d&&"string"==typeof(r=null!=(i=null==(s=null==(t=e.event)?void 0:t.properties)?void 0:s.name)?i:null==(o=null==(n=e.event)?void 0:n.properties)?void 0:o.url)&&r.length>0&&l().setCurrentRoute(r),[2,e]})})},unload:function(){return(0,a.sH)(s,void 0,void 0,function(){return(0,a.YH)(this,function(t){return e.events&&o.forEach(function(t){c.removeEventListener(t,null==e?void 0:e.events)}),[2]})})}}}}}]); 112//# sourceMappingURL=inAppPlugin.10c1475b7235435b.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.