wsdk.rokt.com
Open in
urlscan Pro
2a02:26f0:3500:2b::17cf:d256
Public Scan
Submitted URL: http://wsdk.rokt.com/
Effective URL: https://wsdk.rokt.com/
Submission: On March 12 via api from US — Scanned from DE
Effective URL: https://wsdk.rokt.com/
Submission: On March 12 via api from US — Scanned from DE
Form analysis
0 forms found in the DOMText Content
(()=>{var e={397:e=>{self,e.exports=(()=>{"use strict";var e={d:(t,n)=>{for(var i in n)e.o(n,i)&&!e.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:n[i]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},t={};e.r(t),e.d(t,{ERROR_LIMIT:()=>i,reportError:()=>r});class n extends Error{constructor(e,t){super(e),this.name=(null==t||t.name,this.name),this.code=null==t?void 0:t.code,this.additionalInformation=null==t?void 0:t.additionalInformation,this.handled=null!==(null==t?void 0:t.handled)&&!1,this.severity=(null==t?void 0:t.severity)||WSDKErrorSeverity.ERROR}}const i=10;let s=0,o=!1;const r=e=>{return void 0,void 0,n=function*(){var t,n;if(e.handled)return;if(!e.bypassErrorLimit&&s>=i){if(o)return;e.code="ERROR_LIMIT_EXCEEDED",o=!0}s++;const r=(1e7*Math.random()).toFixed(0).toString(),a=new URLSearchParams;a.append("use_sandbox",(null===(t=e.useSandbox)||void 0===t?void 0:t.toString())||"false"),a.append("error_id",r),a.append("partner_origin",window.location.origin),a.append("rokt_tag_id",e.tagId),a.append("severity",e.severity||"WARNING"),e.code&&a.append("code",e.code),e.integration&&a.append("integration",e.integration),e.stack&&(e.stack.length>400&&(e.stack=e.stack.substring(0,400)),a.append("stack",e.stack));const c=e.reporter?`frame-${e.reporter}`:"frame";a.append("reporter",c),e.additionalInformation=e.additionalInformation||{},e.additionalInformation.name=e.additionalInformation.name||e.name,e.additionalInformation.message=e.additionalInformation.message||e.message,a.append("additional_information",JSON.stringify(e.additionalInformation));const l=document.createElement("iframe");l.src=`https://apps.rokt.com/wsdk/reporter/index.html?${a.toString()}`,l.style.display="none";const d=new Promise((e=>{const t=n=>{var i,s,o;"Rokt.Reporter.Close"!==(null===(i=n.data)||void 0===i?void 0:i.action)&&(null===(o=null===(s=n.data)||void 0===s?void 0:s.payload)||void 0===o?void 0:o.errorId)!==r||(e(),window.removeEventListener("message",t))};window.addEventListener("message",t)}));(window.document.body||window.document.head).appendChild(l),yield d,null===(n=l.parentElement)||void 0===n||n.removeChild(l)},new((t=void 0)||(t=Promise))((function(e,i){function s(e){try{r(n.next(e))}catch(e){i(e)}}function o(e){try{r(n.throw(e))}catch(e){i(e)}}function r(n){var i;n.done?e(n.value):(i=n.value,i instanceof t?i:new t((function(e){e(i)}))).then(s,o)}r((n=n.apply(undefined,[])).next())}));var t,n};return t})()}},t={};function n(i){var s=t[i];if(void 0!==s)return s.exports;var o=t[i]={exports:{}};return e[i](o,o.exports,n),o.exports}(()=>{"use strict";class e{constructor(){this._subscribers=[]}add(e){this._subscribers.push(e)}unsubscribe(){this._subscribers.forEach((e=>e.unsubscribe()))}}const t=()=>{};class i{constructor(e){this._setupFn=e}subscribe(n,i,s){const o=((e=t,n=t,i=t)=>"function"!=typeof e?e:{next:e,error:n,complete:i})(n,i,s);let r,a=!0;const c={next:e=>{a&&o.next(e)},complete:()=>{a&&(r&&r(),o.complete(),a=!1)},error:e=>{a&&(o.error(e),a=!1)}};r=this._setupFn(c),a||r&&r();const l=new e;return l.add({unsubscribe:()=>{r&&r(),a=!1}}),l}}class s extends i{constructor(){super((e=>(this._isComplete&&e.complete(),this._observers.push(e),()=>this._observers=this._observers.filter((t=>t!==e))))),this._observers=[],this._isComplete=!1}next(e){for(const t of this._observers)t.next(e)}error(e){for(const t of this._observers)t.error(e)}complete(){this._isComplete=!0;for(const e of this._observers)e.complete()}asObservable(){return new i((e=>{const t=this.subscribe(e);return()=>t.unsubscribe()}))}}const o=(e,t)=>new Promise(((n,i)=>{let s;"object"==typeof t&&(s=t.defaultValue),e.subscribe((e=>s=e),(e=>i(e)),(()=>n(s)))})),r=(e,t)=>new i((n=>{const i=e=>n.next(e);return e.addEventListener(t,i),()=>e.removeEventListener(t,i)})),a=(...t)=>new i((n=>{const i=new e;let s=0;for(const e of t)i.add(e.subscribe((e=>n.next(e)),(e=>n.error(e)),(()=>{s+=1,s>=t.length&&n.complete()})));return()=>i.unsubscribe()}));function c(e,t){return new l(e,t)}class l{constructor(e,t){this._target=e,this._handler=t}subscribe(e,t,n){const i=e.next?e.next.bind(e):e,s={next:(...e)=>{return t=this,n=void 0,o=function*(){try{yield i(...e)}catch(e){this._handler(e)}},new((s=void 0)||(s=Promise))((function(e,i){function r(e){try{c(o.next(e))}catch(e){i(e)}}function a(e){try{c(o.throw(e))}catch(e){i(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof s?n:new s((function(e){e(n)}))).then(r,a)}c((o=o.apply(t,n||[])).next())}));var t,n,s,o},error:e.error?e.error.bind(e):t,complete:e.complete?e.complete.bind(e):n};return this._target.subscribe(s)}}class d{constructor(e){this.value=e,this.complete=!1,this.skip=!1}}const u=e=>(...t)=>new i((n=>{const i=e.subscribe((e=>{return i=void 0,s=void 0,r=function*(){try{let i=new d(e);for(const e of t){const t=e(i);if(i=t.then?yield t:t,!0===i.skip||!0===i.complete)break}if(i.skip)return;n.next(i.value),!0===i.complete&&n.complete()}catch(e){n.error(e)}},new((o=void 0)||(o=Promise))((function(e,t){function n(e){try{c(r.next(e))}catch(e){t(e)}}function a(e){try{c(r.throw(e))}catch(e){t(e)}}function c(t){var i;t.done?e(t.value):(i=t.value,i instanceof o?i:new o((function(e){e(i)}))).then(n,a)}c((r=r.apply(i,s||[])).next())}));var i,s,o,r}),(e=>n.error(e)),(()=>n.complete()));return()=>i.unsubscribe()})),h=e=>t=>(!1===e(t.value)&&(t.skip=!0),t),v=e=>t=>(e?!0===e(t.value)?t.complete=!0:t.skip=!0:t.complete=!0,t),m=e=>t=>{const n=e(t.value);return new d(n)},p=e=>e.send(),f="LAUNCHER_DUPLICATE_SELECT_PLACEMENTS",g={AttributesCapture:"ATTRIBUTES_CAPTURE",AttributesCaptureFailure:"ATTRIBUTES_CAPTURE_FAILURE",PageIdUpdated:"PAGE_ID_UPDATED",PageInstanceGuidUpdated:"PAGE_INSTANCE_GUID_UPDATED",PageVariantNameUpdated:"PAGE_VARIANT_NAME_UPDATED",SessionIdUpdated:"SESSION_ID_UPDATED",SessionInformationUpdated:"SESSION_INFORMATION_UPDATED",RoktWSDKIntegration:"ROKT_WSDK_INTEGRATION"},_="userAgent",w="clientType",E="passbackconversiontrackingid",y={OFFER_ENGAGEMENT:"OFFER_ENGAGEMENT",POSITIVE_ENGAGEMENT:"POSITIVE_ENGAGEMENT",OFFER_POSITIVE_ENGAGEMENT:"OFFER_POSITIVE_ENGAGEMENT",PLACEMENT_CLOSED:"PLACEMENT_CLOSED",PLACEMENT_COMPLETED:"PLACEMENT_COMPLETED",PLACEMENT_INTERACTIVE:"PLACEMENT_INTERACTIVE",PLACEMENT_READY:"PLACEMENT_READY",PLACEMENT_RESIZE:"PLACEMENT_RESIZE",PLACEMENT_FAILURE:"PLACEMENT_FAILURE",UPDATE_CART_ITEM_MESSAGE:"UPDATE_CART_ITEM_MESSAGE",DISPLAY_SETTINGS_SET:"DISPLAY_SETTINGS_SET",PAYMENT_BUTTON_CLICKED:"PAYMENT_BUTTON_CLICKED"};var S;!function(e){e.PAYPAL="Paypal"}(S||(S={}));const b="[L] PUT_DISPLAY_SETTINGS",I="[L] CLOSE_PLACEMENT",T="[L] FAILED_TO_LOAD_PLUGIN",R="[L] PLUGIN_TO_PARTNER",O="[L] PLUGIN_RESIZED",A="rokt-frame-type",P="PLUGIN_FRAME_CREATED",C="Standard",N="Fulfillment",L="RoktTransactionId",x="ERROR",k="WARNING";class D extends Error{constructor(e,t){var n,i;super(e),this.name=null!==(n=null==t?void 0:t.name)&&void 0!==n?n:this.name,this.code=null==t?void 0:t.code,this.additionalInformation=null==t?void 0:t.additionalInformation,this.handled=null!==(i=null==t?void 0:t.handled)&&void 0!==i&&i,this.severity=(null==t?void 0:t.severity)||x}}var U=n(397);class M{constructor(){this.fulfilled=!1,this.rejected=!1,this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t})).then((e=>(this.fulfilled=!0,e)),(e=>{throw this.rejected=!0,e}))}isFulfilled(){return this.fulfilled}isPending(){return!this.isFulfilled()&&!this.isRejected()}isRejected(){return this.rejected}static resolve(e){const t=new M;return t.resolve(e),t}}new RegExp("^\\d{4}-\\d{2}-\\d{2}((T\\d{2}:\\d{2}(:\\d{2})?)(\\.\\d{1,6})?(Z|(\\+|-)\\d{2}:\\d{2})?)?$");const F=(e=0)=>new Promise((t=>setTimeout(t,e)));function G(e,t=3,n=100,i=(()=>!0)){return s=this,o=void 0,a=function*(){try{return yield e()}catch(e){if(t<=1||!i(e))throw e}return yield F(1*n),yield G(e,t-1,n)},new((r=void 0)||(r=Promise))((function(e,t){function n(e){try{c(a.next(e))}catch(e){t(e)}}function i(e){try{c(a.throw(e))}catch(e){t(e)}}function c(t){var s;t.done?e(t.value):(s=t.value,s instanceof r?s:new r((function(e){e(s)}))).then(n,i)}c((a=a.apply(s,o||[])).next())}));var s,o,r,a}function W(e){return function(e){return!isNaN(parseFloat(e))&&isFinite(e)}(e)?parseInt(e,10):0}function j(){const e=document.body.querySelectorAll("*");return Array.from(e).filter((e=>e&&e.nodeType===Node.ELEMENT_NODE)).reduce(((e,t)=>{const n=W(document.defaultView.getComputedStyle(t).getPropertyValue("z-index")),i=W(t.style&&t.style.zIndex);return Math.max(e,n,i)}),0)}const $=(e,t={})=>{for(const[n,i]of Object.entries(t))e.style[n]=i};class V{constructor(e){this.window=e}getCookie(e){try{const t=this.window.document.cookie.match(new RegExp("(^| )"+e+"=([^;]+)"));if(t)return t[2]}catch(e){}}setCookie(e,t=!1){try{t&&(e.domain=this.getBaseDomain()),this.window.document.cookie=this.serialize(e)}catch(e){}}getBaseDomain(){const e=this.window.location.hostname,t=e.split("."),n=t.pop(),i=t.pop();return i&&n?`.${i}.${n}`:e}serialize(e){const{name:t,path:n="/",sameSite:i,secure:s,value:o,domain:r}=e;let{expires:a}=e;if(!a){const e=new Date;e.setTime(e.getTime()+31536e6),a=e}let c=`${t}=${o};expires=${a.toUTCString()};path=${n}`;return r&&(c+=`;domain=${r}`),s&&(c+=";secure"),i&&(c+=`;samesite=${i}`),c}}const B=()=>{if("undefined"==typeof window)throw new Error("NO_WINDOW");return window};class H{constructor(e,t="local"){this.window=e,this._store="session"===t?"sessionStorage":"localStorage"}getItem(e){try{const t=this.window[this._store].getItem(e);if(null===t)return;return t}catch(e){return}}setItem(e,t){try{this.window[this._store].setItem(e,t)}catch(e){}}}class K extends H{constructor(e){super(e,"local")}}const z="RoktRecogniser";class Y{constructor(e,t,n){this.cookieService=e,this.localStorageService=t,this.sameSite=n}setRecogniser(e){e.cookie&&this.cookieService.setCookie({name:z,sameSite:this.sameSite,secure:!0,value:e.cookie}),e.localStorage&&this.localStorageService.setItem(z,e.localStorage)}getRecogniser(){return{cookie:this.cookieService.getCookie(z),localStorage:this.localStorageService.getItem(z)}}}class q extends Y{constructor(e,t){super(e,t,"lax")}}class Q{constructor(e,t){this._tagId=e,this._cookieService=t}setSessionInformationCookie(e){const t=this._unpackSessionInformation(e);this._validateSessionCookie(t)&&this._cookieService.setCookie({name:`RoktSessionId-${this._tagId}`,sameSite:"strict",secure:!0,value:e,expires:new Date(t.expirationTimestamp)},!0)}getSessionInformationCookie(){const e=this._cookieService.getCookie(`RoktSessionId-${this._tagId}`);return e&&this._validateSessionCookie(this._unpackSessionInformation(e))?e:""}_unpackSessionInformation(e){const[t,n,i]=e.split("|");return{sessionId:t,isTestSession:"true"===n,expirationTimestamp:Number(i)}}_validateSessionCookie(e){return""!==e.sessionId&&!!e.expirationTimestamp}}function Z(){return window.crypto||window.msCrypto}function J(e){return Array.from(new Uint8Array(e)).map((e=>e.toString(16).padStart(2,"0"))).join("")}function X(e){return new Promise(((t,n)=>{const i=function(e){if(window.TextEncoder)return(new TextEncoder).encode(e);const t=unescape(encodeURIComponent(e)),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}(e),s=Z().subtle.digest("SHA-256",i);s.then?s.then((e=>{t(J(e))}),n):(s.oncomplete=e=>{const n=e.target.result;t(J(n))},s.onerror=e=>{n(e)})}))}var ee=function(e,t,n){if(n||2===arguments.length)for(var i,s=0,o=t.length;s<o;s++)!i&&s in t||(i||(i=Array.prototype.slice.call(t,0,s)),i[s]=t[s]);return e.concat(i||Array.prototype.slice.call(t))},te=function(e,t,n){this.name=e,this.version=t,this.os=n,this.type="browser"},ne=function(e){this.version=e,this.type="node",this.name="node",this.os=process.platform},ie=function(e,t,n,i){this.name=e,this.version=t,this.os=n,this.bot=i,this.type="bot-device"},se=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},oe=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},re=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,ae=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],ce=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function le(e){var t=function(e){return""!==e&&ae.reduce((function(t,n){var i=n[0],s=n[1];if(t)return t;var o=s.exec(e);return!!o&&[i,o]}),!1)}(e);if(!t)return null;var n=t[0],i=t[1];if("searchbot"===n)return new se;var s=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);s?s.length<3&&(s=ee(ee([],s,!0),function(e){for(var t=[],n=0;n<e;n++)t.push("0");return t}(3-s.length),!0)):s=[];var o=s.join("."),r=function(e){for(var t=0,n=ce.length;t<n;t++){var i=ce[t],s=i[0];if(i[1].exec(e))return s}return null}(e),a=re.exec(e);return a&&a[1]?new ie(n,o,r,a[1]):new te(n,o,r)}function de(e){return function(e){return e?le(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new oe:"undefined"!=typeof navigator?le(navigator.userAgent):"undefined"!=typeof process&&process.version?new ne(process.version.slice(1)):null}(e)}function ue(e=5){let t="";const n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=n.length;for(let s=0;s<e;s++)t+=n.charAt(Math.floor(Math.random()*i));return t}class he extends Error{constructor(e,t){var n,i;super(e),this.name=null!==(n=null==t?void 0:t.name)&&void 0!==n?n:this.name,this.code=null==t?void 0:t.code,this.additionalInformation=null==t?void 0:t.additionalInformation,this.handled=null!==(i=null==t?void 0:t.handled)&&void 0!==i&&i}}class ve{constructor(e){this.ID=e.ID,this.eventType=e.eventType,this.body=e.body||{},this.headers=e.headers||{},this.hasError=e.hasError||!1,this.isResponse=!!e.isResponse}}var me=function(e,t,n,i){return new(n||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))};class pe{constructor(e){var t;this.options=e,this.id=this.options.id||ue(10),this.alias=this.options.alias||"No Alias",this.connection=this.options.connection,this.timeoutDuration=null!==(t=this.options.timeoutDuration)&&void 0!==t?t:1e4,this.interceptors=[]}addInterceptor(e){this.interceptors.push(e)}send(e,{body:t,headers:n={}}={}){return me(this,void 0,void 0,(function*(){const i=this.runInterceptors(this.createRequest(e,t,n)),s=new Promise(((t,n)=>me(this,void 0,void 0,(function*(){let s=!1;const o=setTimeout((()=>{s||(n(new he(`Request timed out for ${e}`,{code:"REQUEST_TIMEOUT_ERROR"})),s=!0)}),this.timeoutDuration);u(this.connection.onMessage)(v((e=>e.ID===i.ID))).subscribe((i=>{if(s)return;if(clearTimeout(o),!i)return void n(new he(`Wrong request format for ${e}`,{code:"REQUEST_FORMAT_ERROR"}));const r=this.runInterceptors(i);!0===r.hasError?n(r.body):t(r)}))}))));return this.connection.send(i),s}))}runInterceptors(e){const t=(e=>{const t=new WeakMap,n=e=>{if(!e||"object"!=typeof e)return e;let i;const s=Array.isArray(e)?[]:{},o=Object.getPrototypeOf(s);t.set(e,s);for(const r in e)o[r]||(i=e[r],i&&"object"==typeof i?t.get(i)?s[r]=t.get(i):s[r]=n(i):s[r]=i);return s};return n(e)})(e);for(const e of this.interceptors)e(t);return t}createRequest(e,t,n){return new ve({ID:ue(10),eventType:e,body:t,headers:Object.assign({"sender-alias":this.alias,"sender-id":this.id},n)})}}class fe{constructor(){this.middleware=[],this.handlers={}}getHandlers(){const e={};for(const[t,n]of Object.entries(this.handlers))e[t]=[...this.middleware,...n];return e}use(e){this.middleware.push(e)}on(e,...t){this.handlers[e]=t}}class ge{constructor(e,t){this.connection=e,this.event=t,this.data={},this.isSent=!1,this.responseHeaders={}}getHeaders(){return this.event.headers}getEvent(){return this.event.eventType}getContext(e){return this.data[e]}setResponseHeader(e,t){this.responseHeaders[e]=t}setContext(e,t){this.data[e]=t}getBody(){return this.event.body}setBody(e){this.event.body=e}sendError(e){this.validate(e),e instanceof Error&&(e=this.convertErrorToObject(e));const t=new ve({ID:this.event.ID,eventType:this.event.eventType,body:e,headers:this.responseHeaders,hasError:!0,isResponse:!0});this.connection.send(t),this.isSent=!0}send(e){this.validate(e);const t=new ve({ID:this.event.ID,eventType:this.event.eventType,body:e,headers:this.responseHeaders,isResponse:!0});this.connection.send(t),this.isSent=!0}hasSent(){return this.isSent}validate(e){if(!0===this.isSent)throw{name:"HandlerContext.RESPONSE_ALREADY_SENT",message:"HandlerContext: Response already sent.",code:"RESPONSE_ALREADY_SENT",additionalInformation:{response:e}}}convertErrorToObject(e){return{message:e.message,name:e.name,stack:e.stack,code:e.code,handled:e.handled,additionalInformation:e.additionalInformation}}}var _e=function(e,t,n,i){return new(n||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))};class we{constructor(t){this.options=t,this.onMessage=e=>t=>((e,...t)=>_e(void 0,void 0,void 0,(function*(){const n=e;let i=!1;const[s,o]=function(e){const t=[];return[e.filter((e=>!(e.length>1&&(t.push(e),1)))),t]}(t),r=(e,t)=>_e(void 0,void 0,void 0,(function*(){if(!o.length)throw t;for(const n of o)yield n(e,t)}));for(const e of s)try{yield e(n)}catch(e){i=!0,yield r(n,e);break}i||n.hasSent()||(yield r(n,new Error(`Context: Response never sent for ${n.getEvent()}`)))})))(new ge(this.connection,t),...this.middleware,...e),this.connection=this.options.connection,this.subscription=new e,this.handlers=[],this.middleware=[]}use(e){if(e instanceof fe){const t=e.getHandlers();for(const[e,n]of Object.entries(t))this.on(e,...n)}else this.middleware.push(e)}on(e,...t){if(this.handlers.includes(e))throw new Error("HandlerExists");this.handlers.push(e);const n=u(this.connection.onMessage)(h((t=>t.eventType===e)));this.subscription.add(n.subscribe(this.onMessage(t)))}close(){this.subscription.unsubscribe()}}var Ee=function(e,t,n,i){return new(n||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))};class ye{constructor(e,t){this.transmitter=e,this.router=t}eject(){return{transmitter:this.transmitter,router:this.router}}addInterceptor(e){return Ee(this,void 0,void 0,(function*(){this.transmitter.addInterceptor(e)}))}send(e,t={}){return Ee(this,void 0,void 0,(function*(){return this.transmitter.send(e,t)}))}use(e){return Ee(this,void 0,void 0,(function*(){this.router.use(e)}))}on(e,...t){return Ee(this,void 0,void 0,(function*(){this.router.on(e,...t)}))}close(){return Ee(this,void 0,void 0,(function*(){this.router.close()}))}}var Se=function(e,t,n,i){return new(n||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))};class be{constructor(){this.hasConnected=!1,this.transmitter=new M,this.router=new M}setEngine(e){const{router:t,transmitter:n}=e.eject();this.router.resolve(t),this.transmitter.resolve(n),this.hasConnected=!0}setRouter(e){this.router.resolve(e)}setTransmitter(e){this.transmitter.resolve(e)}addInterceptor(e){return Se(this,void 0,void 0,(function*(){(yield this.transmitter.promise).addInterceptor(e)}))}send(e,t={}){return Se(this,void 0,void 0,(function*(){return(yield this.transmitter.promise).send(e,t)}))}use(e){return Se(this,void 0,void 0,(function*(){(yield this.router.promise).use(e)}))}on(e,...t){return Se(this,void 0,void 0,(function*(){(yield this.router.promise).on(e,...t)}))}close(){return Se(this,void 0,void 0,(function*(){(yield this.router.promise).close()}))}}const Ie="ERROR_SENT",Te=(e,t)=>{!e.hasSent()&&t&&(e.sendError(t),((e,t)=>{e.setContext(Ie,!0)})(e))},Re="[C] ERROR",Oe=e=>{if(!e.isResponse&&e.body instanceof Error){const t=e.body;e.body={name:t.name,message:t.message,stack:t.stack,code:t.code,additionalInformation:t.additionalInformation,handled:t.handled,level:t.level}}},Ae="rokt-controller-frame";class Pe{constructor(e,t){this.type=e,this.payload=t}}const Ce="LINK_SENDING_DATA",Ne="LINK_CLIENT_READY_FOR_PORT",Le="LINK_HOST_PORT_TRANSFER",xe="LINK_LISTENING";class ke{constructor(e){this.port=e,this.onEvent=r(this.port,"message");const t=u(this.onEvent)(v((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.type)===xe})));this.onReady=o(t).then((()=>{})),this.onMessage=u(this.onEvent)(h((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.type)===Ce})),m((e=>e.data.payload))),this.port.start()}send(e){this.dispatch(e)}dispatch(e){return t=this,n=void 0,s=function*(){yield this.onReady;const t=new Pe(Ce,e);this.port.postMessage(t)},new((i=void 0)||(i=Promise))((function(e,o){function r(e){try{c(s.next(e))}catch(e){o(e)}}function a(e){try{c(s.throw(e))}catch(e){o(e)}}function c(t){var n;t.done?e(t.value):(n=t.value,n instanceof i?n:new i((function(e){e(n)}))).then(r,a)}c((s=s.apply(t,n||[])).next())}));var t,n,i,s}}var De=function(e,t,n,i){return new(n||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))},Ue=function(e,t,n,i){return new(n||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))};class Me{constructor(e){this.options=e,this.onConnectionSubject=new s,this.connections={},this.handshakeFilter=e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.type)===Ne&&e.data.payload.ID===(this.options.ID||80)},this.handshake=e=>Ue(this,void 0,void 0,(function*(){const t=ue(20),n=new this.options.channelConstructor,{port1:i,port2:s}=n,o=new ke(i);e.source&&(e.source.postMessage(new Pe(Le),this.options.targetOrigin,[s]),yield o.onReady,this.connections[t]=o,this.onConnectionSubject.next(o),i.postMessage(new Pe(xe)))})),this.onConnection=this.onConnectionSubject.asObservable();const t=r(this.options.selfEventSource,"message");this.onPostMessage=u(t)(h(this.handshakeFilter)).subscribe(this.handshake)}destroy(){this.onPostMessage.unsubscribe()}connect(e){return Ue(this,void 0,void 0,(function*(){const t=yield(({target:e,targetID:t=80,targetOrigin:n="*",selfEventSource:i,retryTimeout:s=1e3})=>De(void 0,void 0,void 0,(function*(){const a=r(i,"message"),c=u(a)(v((e=>{var t;return(null===(t=e.data)||void 0===t?void 0:t.type)===Le}))),l=o(c);let d;setTimeout((()=>De(void 0,void 0,void 0,(function*(){for(;void 0===d;)e.postMessage(new Pe(Ne,{ID:t}),n),yield F(s)}))),0);const h=yield l;d=h.ports[0];const m=new ke(d);return d.postMessage(new Pe(xe)),m})))({target:e.target,targetOrigin:this.options.targetOrigin||"*",selfEventSource:this.options.selfEventSource});return this.onConnectionSubject.next(t),t}))}}function Fe(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(e=>{return(("y"===e?8:0)^(t=new Uint8Array(1),Z().getRandomValues(t))[0]&15>>("y"===e?2:0)).toString(16);var t}))}function Ge(e,t,n,i){return new(n||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))}Object.create,Object.create;const We="__rokt-launcher__";let je;const $e={NoElementToPlacePlugin:"NoElementToPlacePlugin"};function Ve(e){const t=/url|\\|&/i;return Object.entries(e).reduce(((e,[n,i])=>(t.test(i)||(e[n]=i),e)),{})}class Be{constructor(e,t,n){this.services=e,this.pluginDetails=t,this.onResizeSubject$=new s,this.usingAutoResize=!1,this.attributeSet=!1,this.url=n?`${n}/wsdk/plugin-runtime/index.html`:this.services.urls.PLUGIN_RUNTIME_URL,this.element=((e={},...t)=>{const n=document.createElement(e.tag||"div");e.id&&(n.id=e.id),e.className&&(n.classList.value=e.className),e.cssText&&(n.style.cssText=e.cssText),e.styles&&$(n,e.styles),e.innerText&&(n.innerText=e.innerText),e.events&&((e,t={})=>{for(const[n,i]of Object.entries(t))e[n]=i})(n,e.events),e.attributes&&((e,t={})=>{for(const[n,i]of Object.entries(t))e.setAttribute(n,i)})(n,e.attributes),e.title&&(n.title=e.title);for(const e of t)"string"==typeof e?n.appendChild(document.createTextNode(e)):n.appendChild(e);return n})({tag:"iframe",styles:{border:0,width:"1px",minWidth:"100%",boxSizing:"border-box",display:"block"},id:`rokt-placement-${this.pluginDetails.pluginInstanceId}`,title:"Rokt placement",attributes:{[A]:"plugin-runtime"}}),this.onLoaded=new Promise((e=>this.element.onload=()=>e()))}getElement(){return this.element}setSandbox(e=[]){if(!0===this.attributeSet)throw new Error("Can only set attributes once");for(const t of["allow-scripts","allow-same-origin",...e])this.element.sandbox.add(t);this.attributeSet=!0}resetStyles(){this.element.removeAttribute("style")}removeStyles(e=[]){for(const t of e)this.element.style.removeProperty(t)}setStyles(e={}){$(this.element,e)}setSize(e,t){!1!==this.usingAutoResize&&(this.setStyles({height:`${e}px`,width:`${t}px`}),this.onResizeSubject$.next({height:e.toString(),width:t.toString()}))}setFullscreen(){const e=this.services.window.document.body;this.originalOverflowValue=e.style.overflow,e.style.overflow="hidden"}useAutoResizer(){this.usingAutoResize=!0}insert(e,t="child",n="append"){let i;switch(this.element.name=this.pluginDetails.configuration,this.element.src=this.url,`${t}-${n}`){case"sibling-prepend":i="beforebegin";break;case"child-prepend":i="afterbegin";break;case"sibling-append":i="afterend";break;default:i="beforeend"}e.insertAdjacentElement(i,this.element);const s=e=>{e.persisted&&(this.close(),window.removeEventListener("pageshow",s))};window.addEventListener("pageshow",s)}close(){var e;null===(e=this.element.parentNode)||void 0===e||e.removeChild(this.element),this.onResizeSubject$.complete(),"string"==typeof this.originalOverflowValue&&(this.services.window.document.body.style.overflow=this.originalOverflowValue)}onLoad(){return this.onLoaded}onClose(){return Ge(this,void 0,void 0,(function*(){var e;yield this.onLoaded,yield(e=this.element,new Promise((t=>{const n=new MutationObserver((i=>{i.forEach((i=>{const s=Array.from(i.removedNodes),o=s.indexOf(e)>-1,r=s.some((t=>t.contains&&t.contains(e)));(o||r)&&(n.disconnect(),t())}))}));n.observe(document.body,{subtree:!0,childList:!0})})))}))}onResize(){return this.onResizeSubject$.asObservable()}}class He{constructor(e,t,n,i=new s,o,r){this._details=e,this._services=t,this._catchWrapSubscriber=n,this._internalEvents$=i,this._serviceUrlOverride=r,this.handleClose=()=>{this.sendToPartner({event:y.PLACEMENT_CLOSED,body:{}}),this._internalEvents$.complete()},this._frame=o||this.createFrame(),this._displayResolver=new M,this.setupHandlers(),this._frame.onResize().subscribe((e=>{this.sendToPartner({event:y.PLACEMENT_RESIZE,body:e})}))}getElement(){return this._frame.getElement()}getAlias(){var e;return null!==(e=this._details.alias)&&void 0!==e?e:""}on(e){const{placementsStream:t}=this._services,n=u(t.on(this._details.pluginInstanceId,R))(m((e=>e.getBody())));return this._catchWrapSubscriber(u(a(n,this._internalEvents$))(h((t=>"*"===e||t.event===e)),m((e=>({body:e.body,event:e.event,placement:this})))),(e=>{throw e.code="LAUNCHER_PLACEMENT_EVENT_PARTNER_CALLBACK_ERROR",this._services.logger.raiseWarning(e),e}))}send(e,t){return Ge(this,void 0,void 0,(function*(){const{placementsStream:n}=this._services;yield n.send(this._details.pluginInstanceId,e,t)}))}place(e){return Ge(this,void 0,void 0,(function*(){const{metricsService:t,controllerService:n,logger:i,partnerContentTemplateService:s}=this._services;try{this._frame.setStyles({display:"none"});const{targetElementSelector:i="body"}=this._details;yield i&&"body"!==i?s.isTemplateReady():Promise.resolve();const o=yield G((()=>Promise.resolve(e||((e="")=>{const t=(n=e)?n.replace(/([\#\.])([0-9])/gi,"$1\\3$2 "):n;var n;if(!t)return window.document.body;const i=window.document.querySelector(t);if(!i)throw new Error($e.NoElementToPlacePlugin);return i})(this._details.targetElementSelector))),50,100);t.triggerPluginFrameCreated(this._details.alias||"",this._details.pluginInstanceId),this._frame.insert(o,this._details.targetElementRelation||void 0,this._details.targetElementPosition||void 0),yield this._frame.onLoad(),this._frame.onClose().then(this.handleClose),this.sendToPartner({event:y.PLACEMENT_READY,body:{}}),yield n.framePlaced(this._details.pluginInstanceId)}catch(e){throw e.code="LAUNCHER_FAILED_TO_PLACE_PLUGIN",e.additionalInformation={placementId:this.getAlias()},i.raiseWarning(e),this._displayResolver.resolve(e),e}}))}remove(){return Ge(this,void 0,void 0,(function*(){return this._frame.close()}))}onClose(){return Ge(this,void 0,void 0,(function*(){return this._frame.onClose()}))}onDisplay(){return Ge(this,void 0,void 0,(function*(){const e=yield this._displayResolver.promise;if(e)throw e}))}setupHandlers(){const{placementsStream:e}=this._services;e.on(this._details.pluginInstanceId,b).subscribe((e=>Ge(this,void 0,void 0,(function*(){yield(({pluginRuntimeFrame:e,internalEvents$:t})=>n=>Ge(void 0,void 0,void 0,(function*(){const{sandbox:i,css:s,outerCss:o,applyHighestZIndex:r,autoresize:a,preset:c,title:l}=n.getBody();a&&e.useAutoResizer(),"DisplayPreset.FULLSCREEN"===c&&e.setFullscreen(),i&&e.setSandbox(i),s&&e.setStyles(Ve(s)),o&&e.setStyles(Ve(o)),l&&(e.getElement().title=l),r&&e.setStyles({zIndex:j()+1}),e.removeStyles(["display"]),t.next({event:y.DISPLAY_SETTINGS_SET,body:void 0}),n.send()})))({pluginRuntimeFrame:this._frame,internalEvents$:this._internalEvents$})(e),this._displayResolver.resolve()})))),e.on(this._details.pluginInstanceId,O).subscribe((({pluginRuntimeFrame:e})=>t=>Ge(void 0,void 0,void 0,(function*(){const{height:n,width:i}=t.getBody();e.setSize(n,i),t.send()})))({pluginRuntimeFrame:this._frame})),e.on(this._details.pluginInstanceId,I).subscribe((e=>{this._frame.close(),e.send()})),e.on(this._details.pluginInstanceId,T).subscribe((e=>{this._displayResolver.resolve(new Error("Placement failed to load")),e.send()}))}createFrame(){return new Be(this._services,this._details,this._serviceUrlOverride)}sendToPartner(e){this._internalEvents$.next(e)}}class Ke{constructor(e){this.controller=e,this._bus=new s,this.middleware=()=>e=>this._bus.next(e)}on(e,t){return u(this._bus)(h((n=>(e=>e.getHeaders()["plugin-instance-id"])(n)===e&&n.getEvent()===t)))}send(e,t,n){return Ge(this,void 0,void 0,(function*(){yield this.controller.send("[P] PARTNER_TO_PLUGIN",{body:{event:t,body:n},headers:{"placement-id":e}})}))}}class ze{constructor(e){this._placements=e}placeAll(){return Ge(this,void 0,void 0,(function*(){const e=this._mapAll((e=>e.place()));yield Promise.all(e)}))}removeAll(){return Ge(this,void 0,void 0,(function*(){const e=this._mapAll((e=>e.remove()));yield Promise.all(e)}))}getAll(){return this._placements}on(e){const t=this._mapAll((t=>t.on(e)));return a(...t)}onDisplay(){return Ge(this,void 0,void 0,(function*(){const e=this._mapAll((e=>e.onDisplay()));yield Promise.all(e)}))}send(e,t){return Ge(this,void 0,void 0,(function*(){const n=this._mapAll((n=>n.send(e,t)));yield Promise.all(n)}))}_mapAll(e){const t=[];for(const n of this._placements)t.push(e(n));return t}}class Ye{constructor(e,t,n){this._controllerService=n,this.context=e,this.placements=new ze(t)}setAttributes(e){return Ge(this,void 0,void 0,(function*(){yield this._controllerService.setAttributes(e)}))}}const qe=e=>e.querySelectorAll("[rokt-frame-type]");class Qe{constructor(){this.fulfillmentAttributes={}}setFulfillmentAttributes(e){this.fulfillmentAttributes=this.filterAttributes(e)}getFulfillmentAttributes(){return this.fulfillmentAttributes}getHashedFulfillmentAttributes(){return Ge(this,void 0,void 0,(function*(){const e=Object.keys(this.fulfillmentAttributes);return 0===e.length?Promise.resolve({}):new Promise(((t,n)=>{const i=e.map((e=>X(`${this.fulfillmentAttributes[e].value}`.trim().toLowerCase())));Promise.all(i).then((n=>{const i=n.reduce(((t,n,i)=>{const s=`widget-${e[i]}sha256hex`;return t[s]={type:N,name:s,value:n},t}),{});t(i)}),n)}))}))}filterAttributes(e){return e?((e,t)=>{const n={};for(const t of Object.keys(e)){const s=e[t];(i=s).type===N&&void 0!==i.value&&null!==i.value&&""!==i.value&&(n[t]=s)}var i;return n})(e):{}}}const Ze=e=>!e||"object"!=typeof e||e.constructor!==Object;class Je{constructor(e,t,n,i,s,o){this.window=e,this.controllerConnection=t,this.fulfillmentAttributeService=n,this.sessionService=i,this.eventsService=s,this.referralService=o}selectPlacements(e,t,n){return Ge(this,void 0,void 0,(function*(){const i={attributes:yield this.processAttributes(e),pageInstanceId:this.sessionService.pageInstanceId,pageIdentifier:t,omitUrl:n||!1,url:this.window.location.href};try{const e=yield this.controllerConnection.send("[C] SELECT_PLACEMENTS",{body:i});return this.eventsService.emit(g.AttributesCapture),e.body}catch(e){throw this.eventsService.emit(g.AttributesCaptureFailure),e}}))}placementPlaced(e){return Ge(this,void 0,void 0,(function*(){yield this.controllerConnection.send("[C] PLACEMENT_PLACED",{body:{id:e}})}))}framePlaced(e){return Ge(this,void 0,void 0,(function*(){yield this.controllerConnection.send("[C] FRAME_LOAD_END",{body:{id:e}})}))}setAttributes(e){return Ge(this,void 0,void 0,(function*(){try{yield this.controllerConnection.send("[C] SET_ATTRIBUTES",{body:{pageInstanceId:this.sessionService.pageInstanceId,attributes:e}})}catch(e){throw this.eventsService.emit(g.AttributesCaptureFailure),e}}))}processAttributes(e){return Ge(this,void 0,void 0,(function*(){const t=Object.assign({},e),n={},i={};for(const[e,s]of Object.entries(t))(s||!1===s||0===s)&&(Ze(s)?i[e]={name:e,type:C,value:s}:s.type===C?i[s.name]=s:s.type===N&&(n[s.name]=s));this.fulfillmentAttributeService.setFulfillmentAttributes(n);const s=yield this.fulfillmentAttributeService.getHashedFulfillmentAttributes(),o=Object.assign(Object.assign({},i),s);if(o.userAgent||(o.userAgent={name:_,type:C,value:this.window.navigator.userAgent}),!o.clientType){const e=function(e){const t=de(void 0),n=t?t.os:null;if(null!==n)switch(n){case"Amazon OS":case"Android OS":case"BlackBerry OS":case"iOS":case"Windows Mobile":return"MobileWeb";default:return"DesktopWeb"}}();e&&(o.clientType={name:w,type:C,value:e})}if(!o.passbackconversiontrackingid){const e=this.referralService.getReferralId();e&&(o.passbackconversiontrackingid={name:E,type:C,value:e})}return o}))}}class Xe extends be{constructor(e,t){super(),this._errorReporter=e,this.constants=t,this._CONNECTION_TIMEOUT=13e3,this._connectionPromise=new M,this._setupCompletePromise=new M,this._link=(({targetOrigin:e,ID:t=80,window:n=B()})=>new Me({targetOrigin:e,ID:t,selfEventSource:n,channelConstructor:n.MessageChannel}))({targetOrigin:"*"}),this._link.onConnection.subscribe((e=>{if(this._connectionError){const e=new D("",{code:"LAUNCHER_REJECT_LATE_CONTROLLER_CONNECTION",severity:x});this._errorReporter(e)}else{try{const s=new ye(new pe(n={connection:e,alias:"Launcher",timeoutDuration:15e3}),new we(n));s.use((e=>t=>{t.setResponseHeader("origin",e.location.origin),t.setResponseHeader("host",e.location.host),t.setResponseHeader("href",e.location.href),t.setResponseHeader("pathname",e.location.pathname)})(window)),s.use(Te),s.use((i=this,(e,t)=>{t&&e.hasSent()&&!(e=>e.getContext(Ie))(e)&&i.send(Re,{body:t})})),s.addInterceptor((e=>t=>{t.isResponse||(t.headers=Object.assign(Object.assign({},t.headers),{host:e.location.host,origin:e.location.origin,href:e.location.href,pathname:e.location.pathname}))})(window)),s.addInterceptor((t=this.constants.VERSION,e=>{e.isResponse||(e.headers=Object.assign(Object.assign({},e.headers),{"launcher-version":t}))})),s.addInterceptor(Oe),this.setEngine(s),s.on("[L] CONTROLLER_SETUP_COMPLETE",p,(()=>this._setupCompletePromise.resolve())),this._connectionPromise.resolve()}catch(e){throw e.code="LAUNCHER_CONTROLLER_HANDLER_SETUP",e.severity=x,this._errorReporter(e),e}var t,n}var i}))}onConnection(){return Ge(this,void 0,void 0,(function*(){if(yield this._connectionPromise.promise,this._connectionError)throw this._connectionError}))}onSetupComplete(){return Ge(this,void 0,void 0,(function*(){yield this._setupCompletePromise.promise}))}connect(e){return Ge(this,void 0,void 0,(function*(){const t=F(this._CONNECTION_TIMEOUT).then((()=>{throw new D("",{code:"LAUNCHER_CONTROLLER_CONNECTION_TIMEOUT",severity:x})})),n=this._link.connect({target:e}).catch((()=>{throw new D("",{code:"LAUNCHER_CONTROLLER_CONNECTION_SETUP",severity:x})}));try{yield Promise.race([t,n])}catch(e){this._connectionError=e,this._connectionPromise.resolve(),this._errorReporter(e)}}))}}class et{constructor(e,t,n,i,s,o,r){this._sessionService=e,this._urls=t,this._window=n,this._constants=i,this._recogniserAccessor=s,this._initOptions=o,this._storageService=r,this._controllerFrame=this._window.document.createElement("iframe"),this._controllerFrame.id=Ae,this._controllerFrame.name=this._createControllerName(),this._controllerFrame.title="No content",this._controllerFrame.sandbox.add("allow-scripts"),this._controllerFrame.sandbox.add("allow-same-origin"),this._controllerFrame.style.display="none",this._controllerFrame.setAttribute("aria-hidden","true"),this._controllerFrame.setAttribute(A,"controller"),o.serviceUrlOverride?this._controllerFrame.src=`${o.serviceUrlOverride}/wsdk/controller/index.html`:this._controllerFrame.src=this._urls.CONTROLLER_URL}append(){return Ge(this,void 0,void 0,(function*(){const e=this._window.document.body||this._window.document.head,t=new Promise((e=>this._controllerFrame.onload=e));e.appendChild(this._controllerFrame),yield t}))}getWindow(){if(!this._controllerFrame.contentWindow)throw new Error("Tried to get controller frame before it was loaded");return this._controllerFrame.contentWindow}_createControllerName(){var e,t,n,i,s;const o=new URLSearchParams,r=[["name",Ae],["launcherVersion",this._constants.VERSION],["sessionRecogniser",JSON.stringify(this._recogniserAccessor.getRecogniser())],["initTimestamp",null===(e=this._sessionService.initTimestamp)||void 0===e?void 0:e.toISOString()],["launcherInstanceId",this._sessionService.launcherInstanceId],["noFunctional",null===(t=this._sessionService.noFunctional)||void 0===t?void 0:t.toString()],["noTargeting",null===(n=this._sessionService.noTargeting)||void 0===n?void 0:n.toString()],["doNotShareOrSell",null===(i=this._sessionService.doNotShareOrSell)||void 0===i?void 0:i.toString()],["sandbox",null===(s=this._sessionService.sandbox)||void 0===s?void 0:s.toString()],["tagId",this._sessionService.tagId],["integrationType",this._sessionService.integrationType],["sessionId",this._sessionService.sessionId],["sessionInformation",this._sessionService.sessionInformation],["customHeaders",JSON.stringify(this._sessionService.customHeaders)],["url",this._window.location.href],["integration",this._initOptions.integrationName],["serviceUrlOverride",this._initOptions.serviceUrlOverride]];return this._shouldSetExperiencesFlag()&&r.push(["useExperiences","true"]),r.forEach((e=>{const[t,n]=e;void 0!==n&&""!==n&&o.append(t,n)})),o.toString()}_shouldSetExperiencesFlag(){return"true"===this._storageService.getItem("rokt-use-experiences")||!!this._sessionService.customHeaders&&!!this._sessionService.customHeaders["rokt-use-experiences"]}}class tt{constructor(){this._subject=new s,this._observable=this._subject.asObservable()}on(e){return u(this._observable)(h((({event:t})=>e===t||"*"===e)))}emit(e,t){this._subject.next({event:e,body:t})}}class nt{constructor(e,t,n="Unspecified"){this._errorReporter=e,this._controllerConnection=t,this._integrationName=n}log(e){return Ge(this,void 0,void 0,(function*(){yield this._controllerConnection.send("[C] LOG",{body:e})}))}raiseError(e){return Ge(this,void 0,void 0,(function*(){e.severity=x,yield this.raiseIssue(e)}))}raiseWarning(e){return Ge(this,void 0,void 0,(function*(){e.severity=k,yield this.raiseIssue(e)}))}raiseIssue(e){return Ge(this,void 0,void 0,(function*(){if(!this._controllerConnection.hasConnected)return this._errorReporter(e);try{const t=e.severity||x;yield this._controllerConnection.send(Re,{body:{additionalInformation:e.additionalInformation,code:e.code,level:t,integration:e.integration||this._integrationName,message:e.message||"Launcher error raised.",name:e.name||"LauncherError",reporter:"WSDK",severity:t,stack:e.stack,handled:e.handled}})}catch(t){this._errorReporter(e)}}))}}class it{constructor(e,t,n,i="Unspecified"){this._integrationName=i,this._controllerConnection=e,this._windowRef=t,this._sessionService=n}trigger(e,t=!1){return Ge(this,void 0,void 0,(function*(){try{yield this._controllerConnection.send("[C] PUT_METRIC_EVENT",{body:Object.assign(Object.assign({},e),{timestamp:e.timestamp.toISOString(),launcherInstanceId:this._sessionService.launcherInstanceId,pageInstanceId:t&&this._sessionService.pageInstanceId||e.pageInstanceId||void 0,data:Object.assign({},e.data)})})}catch(e){}}))}triggerPageStart(e){var t,n;return Ge(this,void 0,void 0,(function*(){const i=null===(n=null===(t=this._windowRef.performance)||void 0===t?void 0:t.timing)||void 0===n?void 0:n.responseStart;(e||i&&!(Date.now()-i>36e5))&&(yield this.trigger({type:"PAGE_START",timestamp:e||new Date(i)},!0))}))}triggerIntegrationStart(e=new Date){return Ge(this,void 0,void 0,(function*(){const t={integrationName:this._integrationName};yield Promise.all([this.trigger({type:"INTEGRATION_START",timestamp:e,data:t},!0),this.trigger({type:"ROKT_START",timestamp:e},!0)])}))}triggerLauncherStart(e){return Ge(this,void 0,void 0,(function*(){yield this.trigger({type:"LAUNCHER_START",timestamp:e||new Date})}))}triggerControllerFrameCreated(){return Ge(this,void 0,void 0,(function*(){yield this.trigger({type:"CONTROLLER_FRAME_CREATED",timestamp:new Date})}))}triggerSelectionStart(e,t){return Ge(this,void 0,void 0,(function*(){yield this.trigger({type:"SELECTION_START",timestamp:t,pageInstanceId:e})}))}triggerSelectionEnd(e){return Ge(this,void 0,void 0,(function*(){yield this.trigger({type:"SELECTION_END",timestamp:new Date,pageInstanceId:e})}))}triggerPluginFrameCreated(e,t){return Ge(this,void 0,void 0,(function*(){const n={type:P,timestamp:new Date,pluginAlias:e,pluginInstanceId:t};yield this.trigger(Object.assign(Object.assign({},n),{type:P}),!0),yield this.trigger(Object.assign(Object.assign({},n),{type:"PLUGIN_RUNTIME_FRAME_CREATED"}),!0)}))}}var st,ot,rt,at,ct;!function(e){e.TEMPLATE_LOAD_ERROR_EVENT="template-load-error-event",e.TEMPLATE_RENDERED_EVENT="template-rendered-event",e.SET_TEMPLATE_NAME="set-template-name"}(st||(st={})),function(e){e.RoktTemplateReady="rokt-template-ready",e.NoTemplateAssigned="no-template-assigned",e.Timeout="timeout"}(ot||(ot={}));class lt{constructor(e){this._windowRef=e}isTemplateReady(){return lt._isTemplateReadyPromise.promise}init(e){var t;(null===(t=lt._isTemplateReadyPromise)||void 0===t?void 0:t.isPending())||(lt._isTemplateReadyPromise=new M,this._listenToPartnerContentTemplateMessages()),this._windowRef.postMessage({type:g.RoktWSDKIntegration,payload:{type:st.SET_TEMPLATE_NAME,payload:e.partnerContentTemplate||""}},this._windowRef.location.origin),e.partnerContentTemplate||lt._isTemplateReadyPromise.resolve(ot.NoTemplateAssigned)}_listenToPartnerContentTemplateMessages(){let e=t;Promise.race([(()=>new Promise((t=>{e=({origin:e,data:n})=>{if(e===this._windowRef.location.origin&&(null==n?void 0:n.type)===g.RoktWSDKIntegration){const{type:e}=n.payload;[st.TEMPLATE_RENDERED_EVENT,st.TEMPLATE_LOAD_ERROR_EVENT].includes(e)&&t(ot.RoktTemplateReady)}},this._windowRef.addEventListener("message",e)})))(),new Promise((e=>setTimeout(e,5e3,ot.Timeout)))]).then((e=>{lt._isTemplateReadyPromise.isPending()&<._isTemplateReadyPromise.resolve(e)})).finally((()=>{this._windowRef.removeEventListener("message",e)}))}}!function(e){e.TicketmasterUS="6240a06506ec42b38f5475f577e2e5d8",e.LivenationUS="18f21499ab634e598a0029da04bc9ba3",e.TicketmasterPW="93a61038b3dd4b0c905279e0fb7f9e36",e.TicketmasterAU="d95d8b6d8662476e8648eb91fbb49fb7",e.TicketmasterNZ="4019a66f0590412ab5b2128fd5eddcf7",e.Spirit="669f3e389da34e3a9c5314cd7406ae0d"}(rt||(rt={})),function(e){e.TicketmasterUS="227",e.LivenationUS="253",e.TicketmasterPW="280",e.TicketmasterAU="249",e.TicketmasterNZ="250",e.Spirit="244"}(at||(at={})),function(e){e.TicketmasterCO2="checkout",e.TicketmasterPW="spon",e.Spirit="book"}(ct||(ct={}));class dt{constructor(e,t,n){this._urls=e,this._windowRef=t,this._tagId=n}preloadPluginRuntime(){return Ge(this,void 0,void 0,(function*(){return this._createPreloadIframe(this._urls.PLUGIN_RUNTIME_URL)}))}preloadPlugins(){return Ge(this,void 0,void 0,(function*(){const e=new Set([...Object.values(rt),...Object.values(at)]),t=Object.values(ct),n=this._windowRef.location.href,i=this._tagId.split("_")[0];e.has(i)&&t.some((e=>n.includes(e)))?yield Promise.all([this._createPreloadIframe(this._urls.WIDGET_PLUGIN_URL),this._createPreloadIframe(this._urls.DCUI_PLUGIN_URL),this._createPreloadIframe(this._urls.OL16_PLUGIN_URL),this._createPreloadIframe(this._urls.OL14_PLUGIN_URL)]):yield Promise.all([this._createPreloadIframe(this._urls.WIDGET_PLUGIN_URL),this._createPreloadIframe(this._urls.DCUI_PLUGIN_URL)])}))}_createPreloadIframe(e){return Ge(this,void 0,void 0,(function*(){const t=new URLSearchParams;t.append("integration_type","preload"),t.append("init_timestamp",String((new Date).getTime()));const n=t.toString(),i=this._windowRef.document.createElement("iframe");i.style.display="none",i.name=n,i.src=e;const s=new Promise((e=>i.onload=e)),o=this._windowRef.document.body||this._windowRef.document.head;o.appendChild(i),yield s,i.onload=null,o.removeChild(i)}))}}class ut{constructor(e,t){this._storage=e,this._cookie=t}getReferralId(){var e,t;return null!==(t=null!==(e=this._storage.getItem("rtid"))&&void 0!==e?e:this._storage.getItem(L))&&void 0!==t?t:this._cookie.getCookie(L)}}class ht{constructor(e){const t=e[e.INTEGRATION_WSDK_TARGET];this.CONTROLLER_URL=`${t}/wsdk/controller/index.html`,this.PLUGIN_RUNTIME_URL=`${t}/wsdk/plugin-runtime/index.html`,this.WIDGET_PLUGIN_URL=`${t}/wsdk/plugins/widget/index.html`,this.DCUI_PLUGIN_URL=`${t}/wsdk/plugins/dcui/index.html`,this.OL16_PLUGIN_URL=`${t}/wsdk/plugins/offer-layout-16/index.html`,this.OL14_PLUGIN_URL=`${t}/wsdk/plugins/offer-layout-14/index.html`}}class vt{constructor(e,t){this._sessionAccessor=t,this.initTimestamp=e.initTimestamp||new Date,this.integrationType=e.integrationType||"default",this.noFunctional=e.noDeviceId||e.noFunctional||!1,this.noTargeting=e.noDeviceId||e.noTargeting||!1,this.doNotShareOrSell=e.doNotShareOrSell||!1,this.sandbox=e.sandbox||!1,this.sessionId=this._getSessionId(e),this.sessionInformation=this._getSessionInformationCookie(),this.tagId=e.tagId,this.pageInstanceId=e.pageInstanceId||this.getNewPageInstanceGuid(),this.launcherInstanceId=Fe(),this.customHeaders=e.customHeaders}resetPageId(){this.pageInstanceId=this.getNewPageInstanceGuid()}getNewPageInstanceGuid(){return Fe()}_getSessionId(e){return e.sessionId||""}_getSessionInformationCookie(){return this._sessionAccessor.getSessionInformationCookie()}}class mt{constructor(e,t){this.initOptions=e,this.window=B(),this.constants=(()=>{let e;return e=void 0==={VERSION:"3.8.0",ORIGIN_ROKT_APPS:"https://apps.rokt.com",ORIGIN_ROKT_WSDK:"https://wsdk.rokt.com",INTEGRATION_WSDK_TARGET:"ORIGIN_ROKT_APPS"}?{VERSION:je||"",ORIGIN_ROKT_APPS:"",ORIGIN_ROKT_WSDK:"",INTEGRATION_WSDK_TARGET:"ORIGIN_ROKT_APPS"}:{VERSION:"3.8.0",ORIGIN_ROKT_APPS:"https://apps.rokt.com",ORIGIN_ROKT_WSDK:"https://wsdk.rokt.com",INTEGRATION_WSDK_TARGET:"ORIGIN_ROKT_APPS"},e.VERSION=je||e.VERSION,e})(),this.controllerConnection=new Xe(t,this.constants),this.logger=new nt(t,this.controllerConnection,this.initOptions.integrationName),this.eventsService=new tt,this.cookieService=new V(this.window),this.localStorageService=new K(this.window),this.sessionAccessor=new Q(this.initOptions.tagId,this.cookieService),this.recogniserAccessor=new q(this.cookieService,this.localStorageService),this.referralService=new ut(this.localStorageService,this.cookieService),this.urls=new ht(this.constants),this.preloadService=new dt(this.urls,this.window,this.initOptions.tagId),this.fulfillmentAttributeService=new Qe,this.sessionService=new vt(this.initOptions,this.sessionAccessor),this.controllerFrame=new et(this.sessionService,this.urls,this.window,this.constants,this.recogniserAccessor,this.initOptions,this.localStorageService),this.controllerService=new Je(this.window,this.controllerConnection,this.fulfillmentAttributeService,this.sessionService,this.eventsService,this.referralService),this.metricsService=new it(this.controllerConnection,this.window,this.sessionService,this.initOptions.integrationName),this.placementsStream=new Ke(this.controllerConnection),this.partnerContentTemplateService=new lt(this.window)}}class pt{constructor(e){var t,n;const i=new Date;var o;this._initOptions=e,this._initOptions.integrationVersion&&(o=this._initOptions.integrationVersion,je=o),this.fromController=new s;const r=((e,t=!1,n="Unspecified")=>i=>{(0,U.reportError)({tagId:e,useSandbox:t,integration:n,reporter:i.reporter||"WSDK",message:i.message,name:i.name,stack:i.stack,additionalInformation:i.additionalInformation,code:i.code,severity:i.severity})})(e.tagId,e.sandbox,this._initOptions.integrationName);try{this.services=new mt(this._initOptions,r);const{controllerConnection:e,controllerFrame:s,eventsService:o,metricsService:a,placementsStream:l,preloadService:d,sessionService:u}=this.services;this._initOptions.sandbox&&this.services.window.console.warn("ROKT: 'sandbox' mode enabled. ROKT Placements shown will not generate revenue. If this is not intended then please omit the 'sandbox' flag when initializing ROKT's SDK."),s.append().then((()=>e.connect(s.getWindow()))).catch((e=>{throw e.code=e.code||"LAUNCHER_CONTROLLER_CONNECTION",r(e),e})),a.triggerControllerFrameCreated(),this._initOptions.skipPreload||(d.preloadPluginRuntime(),d.preloadPlugins()),a.triggerPageStart(null!==(t=this._initOptions.pageInitTimestamp)&&void 0!==t?t:void 0),a.triggerIntegrationStart(null!==(n=this._initOptions.initTimestamp)&&void 0!==n?n:i),a.triggerLauncherStart(i),e.on(b,l.middleware()),e.on(I,l.middleware()),e.on(T,l.middleware()),e.on(O,l.middleware()),e.on(R,p,l.middleware()),e.on("[L] GET_FULFILLMENT_ATTRIBUTES",(({fulfillmentAttributeService:e})=>t=>{const n=e.getFulfillmentAttributes();t.send({fulfillmentAttributes:n})})(this.services)),e.on("[L] SEND_LAUNCHER_EVENT",(({eventsService:e})=>t=>{const n=t.getBody();n&&n.name&&e.emit(n.name,n.payload),t.send()})(this.services)),e.on("[L] SET_FIRST_PARTY_RECOGNISER",(({recogniserAccessor:e})=>t=>{const n=t.getBody();e.setRecogniser(n.firstPartyRecogniser),t.send()})(this.services)),e.on("[L] SET_SESSION_ID",(()=>e=>e.send())),e.on("[L] ATTRIBUTES_CAPTURE_RESULT",(({eventsService:e})=>t=>{t.getBody().isSuccess?e.emit(g.AttributesCapture):e.emit(g.AttributesCaptureFailure),t.send()})(this.services)),e.on("[L] CONTROLLER_TO_PARTNER",(e=>this.fromController.next(e.getBody())),p),e.on("[L] CREATE_PLUGIN",(e=>{var t=function(e,t){var n={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&t.indexOf(i)<0&&(n[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var s=0;for(i=Object.getOwnPropertySymbols(e);s<i.length;s++)t.indexOf(i[s])<0&&Object.prototype.propertyIsEnumerable.call(e,i[s])&&(n[i[s]]=e[i[s]])}return n}(e,[]);return e=>{const n=e.getBody();new He(n,t,c,void 0,void 0,t.initOptions.serviceUrlOverride).place(),e.send()}})(this.services)),o.on(g.SessionInformationUpdated).subscribe((e=>this.services.sessionAccessor.setSessionInformationCookie(e.body))),o.on(g.SessionIdUpdated).subscribe((e=>{u.sessionId=e.body}))}catch(e){throw e.code=e.code||"LAUNCHER_INIT",r(e),e}}on(e){const t=this.services.eventsService;return u(a(this.fromController,t.on("*")))(h((t=>"*"===e||t.event===e)))}log(e){return Ge(this,void 0,void 0,(function*(){const{logger:t}=this.services;yield t.log(e)}))}raiseError(e){return Ge(this,void 0,void 0,(function*(){const{logger:t}=this.services;yield t.raiseIssue(e)}))}ready(){return Ge(this,void 0,void 0,(function*(){const{controllerConnection:e}=this.services;yield e.onConnection()}))}selectPlacements({attributes:e,pageIdentifier:t,omitUrl:n}){return Ge(this,void 0,void 0,(function*(){const{controllerConnection:i,controllerService:s,sessionService:o,metricsService:r,partnerContentTemplateService:a}=this.services;yield i.onSetupComplete();const l=new Date;if(o.pageInstanceId===this.previousPageInstanceId)throw new D(f,{code:f,severity:k});const d=yield s.selectPlacements(e,t,n),u=d.context;a.init(u),this.previousPageInstanceId=o.pageInstanceId;const h=d.placements.map((e=>new He(e,this.services,c,void 0,void 0,this.services.initOptions.serviceUrlOverride))),v=new Ye(u,h,s);return r.triggerSelectionStart(o.pageInstanceId,l),r.triggerSelectionEnd(o.pageInstanceId),v}))}destroy(){qe(window.document).forEach((e=>{var t;return null===(t=null==e?void 0:e.parentNode)||void 0===t?void 0:t.removeChild(e)})),this.services.window[We]=void 0}changePage(e){var t;const n=new Date;this.services.sessionService.resetPageId(),this.services.metricsService.triggerPageStart(null!==(t=null==e?void 0:e.pageInitTimestamp)&&void 0!==t?t:n),this.services.metricsService.triggerIntegrationStart(n)}}const ft={HashArgumentTypeOf:"Value to be hashed must be of type string"};var gt=Object.freeze({__proto__:null,RoktEvent:y,LauncherEvent:g,createLauncher:e=>Ge(void 0,void 0,void 0,(function*(){return window[We]&&!window["__rokt-launcher-allow-multiple__"]||(window[We]=Promise.resolve(new pt(e))),window[We]})),LauncherInstance:pt,ServiceContainer:mt,findFrames:qe,ErrorType:$e,PlacementInstance:He,PlacementStream:Ke,PlacementCollection:ze,Selection:Ye,isBrowserSupported:function(){const e=de();switch(null==e?void 0:e.name){case"chrome":return parseFloat(null==e?void 0:e.version)>=52;case"ie":case"safari":case"ios":return parseFloat(null==e?void 0:e.version)>=11;case"ios-webview":return parseFloat(null==e?void 0:e.version)>=604;default:return!0}},ErrorMessage:ft,hashString:e=>Ge(void 0,void 0,void 0,(function*(){if("string"!=typeof e)throw new Error(ft.HashArgumentTypeOf);return X(e.trim().toLocaleLowerCase())}))});class _t{constructor(e,t){this.queryParamsService=e,this.window=t}getAttributes(){return Object.assign(Object.assign({},this.getQueryParamAttributes()),this.getGlobalAttributes())}getFulfillmentAttributes(){const e=this.window._ROKTa||[];return this.wrap(e)}getLegacyWidgetEventCallback(e){var t;const n=e.toLowerCase(),i=this.window._ROKT||[],[,s]=null!==(t=i.find((([e,t])=>String(e).toLowerCase()===n&&"function"==typeof t)))&&void 0!==t?t:[];return s}wrap(e){return e.reduce(((e,[t,n])=>(e[t]?e[t]=this.mergeAttributeValues(e[t],n):e[t]=n,e)),{})}mergeAttributeValues(e,t){if(null==e)return t;const n=[].concat(e,null!=t?t:[]);return this.caseInsensitiveDedupValues(n)}getGlobalAttributes(){const e=(this.window._ROKT||[]).filter((([e,t])=>"function"!=typeof t));return this.wrap(e)}getQueryParamAttributes(){const e=this.queryParamsService.getAttributes();return this.wrap(e)}caseInsensitiveDedupValues(e){const t=e.reduce(((e,t)=>e.map((e=>"string"==typeof e?e.toLowerCase():e)).includes("string"==typeof t?t.toLowerCase():t)?e:[...e,t]),[]);return 1===t.length?t[0]:t}}class wt{constructor(){let e;try{e={VERSION:"LL-2.1.0"}}catch(e){}this.Version=(null==e?void 0:e.VERSION)||""}}const Et="widgetOpened",yt="widgetReady",St="widgetCompleted",bt="widgetSignedUp",It="widgetClosed",Tt="widgetFailure",Rt={[It]:y.PLACEMENT_CLOSED,[St]:y.PLACEMENT_COMPLETED,[Et]:y.PLACEMENT_READY,[yt]:y.PLACEMENT_INTERACTIVE,[Tt]:y.PLACEMENT_FAILURE,[bt]:y.OFFER_ENGAGEMENT};var Ot=function(e,t,n,i){return new(n||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))};class At{constructor(e,t,n,i,s,o){this.window=e,this.queryParamsService=t,this.attrCollector=n,this.createLauncher=i,this.getSha256Hex=s,this.environment=o}getLauncherOptions(){var e;return{tagId:null!==(e=this.queryParamsService.getTagId())&&void 0!==e?e:"",integrationName:"legacy-launcher",integrationVersion:this.environment.Version,initTimestamp:new Date}}getPlacementSelectionOptions(){return e=this,t=void 0,i=function*(){const e=this.attrCollector.getAttributes();for(const[t,n]of Object.entries(this.attrCollector.getFulfillmentAttributes()))void 0===n&&null===n&&""===n||(e[`${t}sha256`]=yield this.getSha256Hex(String(n)));return{attributes:e}},new((n=void 0)||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}));var e,t,n,i}getWindow(){return this.window}negotiateTargetElement(e){const t=this.window.document,n=`${e}-b`,i="rokt-placeholder";let s=t.getElementById(n);s||(s=t.createElement("div"),s.id=n,t.body.appendChild(s));let o=t.getElementById(i);o||(o=t.createElement("div"),o.id=i,s.appendChild(o))}triggerCallback(e){const t=this.getCallback(e);t&&t()}subscribeToFirst(n,s){const o=this.getCallback(n);if(!o)return;const r=Rt[n];((e,t)=>{let n;return new Promise(((t,i)=>{n=e.subscribe(t,i,(()=>{i(new Error("CompletedBeforeEmit"))}))})).finally((()=>n.unsubscribe()))})(((...n)=>new i((i=>{if(!n.length)return i.complete(),t;const s=new e,o=new Array(n.length),r=new Array(n.length),a=e=>!o.includes(void 0)&&i.next(e);for(let e=0;e<n.length;e++){const t=n[e].subscribe((t=>{r[e]=t,o[e]=!0,a(r)}));s.add(t)}return()=>s.unsubscribe()})))(...s.map((e=>e.on(r))))).then((()=>o()))}getFulfillmentAttributes(){return this.attrCollector.getFulfillmentAttributes()}getCallback(e){return this.attrCollector.getLegacyWidgetEventCallback(e)}}const Pt={id:"id",bcode:"bcode",bhid:"bhid",hide:"hide",pcode:"pcode",secureProtocol:"secureProtocol",v:"v"},Ct=[/https:\/\/apps(\-demo|\.stage|)\.rokt\.com\/\?/,/https:\/\/rockliveapps\.com\.au\/\?/,/https:\/\/demo\.roktinternal\.com\/\?/];class Nt{constructor(e){this.window=e;const t=this.getScriptSource(),n=t?t.substring(t.indexOf("?")):"";this.roktQueryParams=new URLSearchParams(n)}getTagId(){return this.roktQueryParams.get(Pt.id)}getAttributes(){return Array.from(this.roktQueryParams.entries()).filter((([e,t])=>!!e&&!!t&&!Pt[e]))}getScriptSource(){const e=this.window.document.getElementsByTagName("script");return Array.from(e).map((e=>e.src)).find((e=>Ct.some((t=>t.test(e)))))}}!function(){var e,t,n,i;e=this,t=void 0,i=function*(){const e=new Nt(window),t=new wt,n=new _t(e,window),i=new At(window,e,n,gt.createLauncher,gt.hashString,t);yield function(e){var t,n;return Ot(this,void 0,void 0,(function*(){if(!gt.isBrowserSupported())return void e.triggerCallback(Tt);const i=e.getWindow(),s=i.roktLegacyLauncher;s&&s.destroy();const o=e.getLauncherOptions();e.negotiateTargetElement(o.tagId);const r=yield e.createLauncher(o);r.on(g.SessionIdUpdated).subscribe((({body:e})=>{const t={sessionId:e};i.rokt=i.rokt||{},i.rokt=Object.assign(Object.assign({},i.rokt),{roktConfiguration:t})})),i.roktLegacyLauncher=r;const a=null===(n=null===(t=i.performance)||void 0===t?void 0:t.timing)||void 0===n?void 0:n.responseStart;yield r.changePage({pageInitTimestamp:a?new Date(a):void 0});const c=yield r.selectPlacements(yield e.getPlacementSelectionOptions());c.placements.on(y.POSITIVE_ENGAGEMENT).subscribe((()=>Ot(this,void 0,void 0,(function*(){yield c.setAttributes(e.getFulfillmentAttributes())}))));const l=c.placements.getAll();l.forEach((e=>e.place())),e.subscribeToFirst(It,l),e.subscribeToFirst(St,l),e.subscribeToFirst(Et,l),e.subscribeToFirst(yt,l),e.subscribeToFirst(bt,l)}))}(i)},new((n=void 0)||(n=Promise))((function(s,o){function r(e){try{c(i.next(e))}catch(e){o(e)}}function a(e){try{c(i.throw(e))}catch(e){o(e)}}function c(e){var t;e.done?s(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(r,a)}c((i=i.apply(e,t||[])).next())}))}()})()})();