var TTDConversionEvents;(()=>{"use strict";var e={d:(n,t)=>{for(var r in t)e.o(t,r)&&!e.o(n,r)&&Object.defineProperty(n,r,{enumerable:!0,get:t[r]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n),r:e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})}},n={};e.r(n),e.d(n,{argsToSdkFunction:()=>ze,clearAllConfigs:()=>Qe,dumpConfigs:()=>He,event:()=>Ze});var t={tcfV2ConsentVersion:2,consentRequestHasTimedOut:!1,waitForConsentTimeout:null,consentCheckExists:!1,isGdprApplicable:!1,gdprConsentString:null},r=function(e,n,t){if(t||2===arguments.length)for(var r,i=0,o=n.length;i0?"|".concat(e.pixelIds.join(",")):"";return"".concat(n).concat(t," ")}function c(e,n){for(var t=[],i=2;i0?n:void 0}return Array.isArray(e)?e:void 0}}function p(e,n,t){var r;return r=null!=e?"adv_".concat(e):null!=n?"merchant_".concat(n):"nokey",t?"".concat(r,"|").concat(t):r}function g(e,n,t,r,i){r=f(r);for(var o=v(n),a=v(t),d=r&&r.length>0,s=o||a,g=Array.from(new Set(e.values())),m=0,h=d?r.map((function(e){return p(n,t,e)})):[p(n,t)];m0)return c("Partial config match found",w[0]),w.length>1&&u("Multiple partial config matches found, using first one",w[0],w.slice(1)),w[0];if(s)return void l("No matching config found for adv/merchant '"+n+"/"+t+"', event will not fire")}if(s&&d)l("Event sent ids (advId: "+n+", merchantId: "+t+", pixelIds: "+(null==r?void 0:r.join(","))+") but no exact config match found, event will not fire");else{if(1===g.length)return c("Single config found, using it for event",g[0]),g[0];if(!d)return u("Event ids not sent, will use mostRecentInitConfig",i),i;l("No matching config found for pixel_ids '"+r.join(",")+"', event will queue and fire with default config after timeout")}}var m=function(){return m=Object.assign||function(e){for(var n,t=1,r=arguments.length;t0){var l=c[c.length-1];l&&R(l,r,e)&&(r=l,F(e,"strategy 4: found toporigin: "+l+" from origins: "+c))}}catch(n){F(e,"strategy 4: ancestorOrigins unsupported, continue")}if(!r||A(r)){var u=function(e){try{if((t=document.querySelector("link[rel='canonical']"))&&(r=t.href))return r}catch(n){F(e,"strategy 5: canonical link not accessible in current document")}for(var n=window;;)try{if(n.parent===n)break;var t,r;if((t=(n=n.parent).document.querySelector("link[rel='canonical']"))&&(r=t.href))return r}catch(n){F(e,"strategy 5: cross-origin parent, cannot read canonical link");break}return""}(e);u&&R(u,r,e)&&(r=u,F(e,"strategy 5: canonical url found"))}if(!r||A(r)){var d=function(e,n){try{var t=window.dataLayer;if(!t||!Array.isArray(t))return F(n,"strategy 6: dataLayer not present or not an array"),"";var r="";try{r=e?new URL(e).origin:""}catch(t){F(n,"strategy 6: could not parse known origin: "+e)}for(var i=t.length-1;i>=0;i--){var o=t[i];if(o&&"object"==typeof o&&!Array.isArray(o))for(var a=0,c=N;a1)return r+u;F(n,"strategy 6: dataLayer["+i+"]."+l+" is not a valid URL: "+u)}}}}catch(e){F(n,"strategy 6: error reading dataLayer, continue")}return""}(r,e);d&&R(d,r,e)&&(r=d,F(e,"strategy 6: dataLayer url found: "+d))}var s=function(e,n,t){var r=[];n&&n.includes("?")&&r.push(n),e&&e.includes("?")&&function(e){try{return"/"===new URL(e).pathname||-1!==e.indexOf("cloudfront.net")}catch(e){return!1}}(e)&&r.push(e);for(var i=0,o=r;i0)return;null==e||e.resolveWith(document,[r])}},bindReady:function(){if(!e){if(e=r._Deferred(),"complete"===document.readyState)return setTimeout((function(){return r.ready()}),1);if(document.addEventListener)document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",(function(){return r.ready()}),!1);else if(document.attachEvent){document.attachEvent("onreadystatechange",n),window.attachEvent("onload",r.ready);var t=!1;try{t=null==window.frameElement}catch(e){console.log(e)}document.documentElement.doScroll&&t&&i()}}},_Deferred:function(){var e,n=[],t=!1,i=!1,o={done:function(){for(var t=[],a=0;a0){var a=e.querySelectorAll(p);a&&a.forEach((function(e){r.includes(e)||r.push(e)}))}for(var c=window.location.hostname,l=document.getElementsByTagName("iframe"),u=0,d=Array.from(l);u0&&s.contentDocument.querySelectorAll(p).forEach((function(e){r.includes(e)||r.push(e)}))}}return r}function K(e,n){var t=0,r=null;return new MutationObserver((function(i,o){var a=Date.now(),c=a-t;c>=n?(t=a,e(i,o)):(r&&clearTimeout(r),r=setTimeout((function(){t=Date.now(),e(i,o)}),n-c))}))}function X(e,n){if(!n.src)return!1;try{var t=e===new URL(n.src).hostname;return t&&ee("Iframe "+n.src+" can be accessed"),t}catch(e){return ee("error: ",e),!1}}function Q(e){var n=e.currentTarget;if(n&&n.__upixel_detection)try{W(n.__upixel_detection.root,n.__upixel_detection.scopeName,n.__upixel_detection.config)}catch(e){ee(e)}}function Y(e,n){return function(e,n){var t=/((([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,}))/i;if(n.detectionSubject.includes("email")&&t.test(e)){var r=function(e){return e.toLowerCase().trim()}(e.match(t)[0]);return ee("We detected email: "+r),function(e,n){if(e&&n){var t=new CustomEvent("detected-identifier",{detail:{identifier:e,type:n}});ee("Dispatched event with identifier: ",e," and type: ",n),window.dispatchEvent(t)}}(r,"email"),!0}return!1}(e,n)}function ee(e){for(var n=[],t=1;t0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]$/,/^%%[\s\S]+%%$/,/^%p\w+\s*[=!0-9]+\s*;?$/,/^%[^%\s]+%$/,/^\[+[\s\S]+\]+$/,/^\([\s\S]+\)$/,/^["'][\s\S]+["']$/];function Se(e){var n=window[e];if(void 0!==n)return n;if(_e.test(e))try{return new Function("return (".concat(e,");"))()}catch(e){return}}function ke(e){var n,t;return{evaluatedParameter:De(String(null!==(n=null==e?void 0:e.evaluatedParameter)&&void 0!==n?n:"").trim()),parameterValue:De(String(null!==(t=null==e?void 0:e.parameterValue)&&void 0!==t?t:"").trim())}}function De(e){return e.replace(/&(?:#(\d+)|#x([0-9a-fA-F]+)|([a-zA-Z]+));/g,(function(e,n,t,r){if(void 0!==n)return String.fromCharCode(parseInt(n,10));if(void 0!==t)return String.fromCharCode(parseInt(t,16));switch(r){case"amp":return"&";case"quot":return'"';case"apos":return"'";case"lt":return"<";case"gt":return">";case"nbsp":return" ";default:return e}}))}function Ee(e,n,t,r){var i=e.parameterValue,o=i.match(Ie);if(o)return Te(o[1],i,e,n,t);var a=_e.test(i);if(a){var c=Se(i);if("function"==typeof c)return Te(i,i,e,n,t,c);if(null!=c)return String(c)}var l=function(e){try{var n=e.replace(/\\/g,"\\\\").replace(/"/g,'\\"'),t=document.querySelector('[name="'.concat(n,'"]'));if(!t)return;var r=t.value;return"string"==typeof r?r:void 0}catch(e){return}}(i);if(void 0!==l&&""!==l)return l;if(a)u("DynamicParams: could not resolve '".concat(i,"' for ").concat(e.evaluatedParameter," on pixel ").concat(n," (tried variable, function, and form field name)"),t);else{if(function(e){return xe.some((function(n){return n.test(e)}))}(i))return u("DynamicParams: '".concat(i,"' for ").concat(e.evaluatedParameter," on pixel ").concat(n," looks like an unfilled template placeholder and no matching form field exists"),t),void r.add("".concat(e.evaluatedParameter,"t"));u("DynamicParams: '".concat(i,"' for ").concat(e.evaluatedParameter," on pixel ").concat(n," is not a safe identifier path and no matching form field exists"),t),r.add("".concat(e.evaluatedParameter,"u"))}}function Te(e,n,t,r,i,o){var a=void 0!==o?o:Se(e);if("function"==typeof a){var c;try{c=a()}catch(e){return void u("DynamicParams: '".concat(n,"' for ").concat(t.evaluatedParameter," on pixel ").concat(r," threw when called: ").concat(e),i)}if(null!=c)return String(c);u("DynamicParams: '".concat(n,"' for ").concat(t.evaluatedParameter," on pixel ").concat(r," returned ").concat(null===c?"null":"undefined"),i)}else u("DynamicParams: '".concat(n,"' for ").concat(t.evaluatedParameter," on pixel ").concat(r," is not a function"),i)}var Ce=/^[a-zA-Z_$][a-zA-Z0-9_$]*$/,Pe=new Set(["window","document","location","navigator","localStorage","sessionStorage","history","screen","self","top","parent","frames","performance","crypto"]),Oe=200;function Le(){for(var e=document.querySelectorAll("input[name], select[name], textarea[name]"),n=[],t=0,r=Array.from(e);t0&&i[i.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!i||o[1]>i[0]&&o[1]0?r.map((function(e){return p(n,t,e)})):[p(n,t)],a=0,c=o;a0)||t.includes(ae.pixelId)}(e.adv,e.pixel_ids)&&(se(n.uidConfig)?e.uid2_token=n.uidConfig.uid_token:de(n.uidConfig)&&(e.euid_token=n.uidConfig.uid_token)),null!=localStorage.getItem("enable-ttd-pixel-available-param-analysis")&&function(e,n){var t,r={formFields:Le(),variables:Ue(),functions:je()},i=r.formFields,o=r.variables,a=r.functions,l=null!==(t=n.event_name)&&void 0!==t?t:"unknown";c("AvailableParamAnalysis (event: ".concat(l,") — ")+"formFields: ".concat(i.length,", variables: ").concat(o.length,", functions: ").concat(a.length),e,{formFields:i,variables:o,functions:a})}(n,e),function(e,n){var t;if(n.dynamicParamsConfig){var r=null!==(t=e.pixel_ids)&&void 0!==t?t:n.pixelIds;if(r&&0!==r.length){for(var i=new Set,o=0,a=r;o0&&(e.rt_dpme=Array.from(i).join(","))}}}(e,n);var k={data:[qe(qe({},e),{privacy_settings:b})]};(n.enableDebug||e.debug)&&(k.debug="1"),function(e,n,t){var r=this,i="".concat(e.rootUrl,"/track/realtimeconversion");return c("trigger POST realtime conversion event",e),new Promise((function(o,a){var l=new XMLHttpRequest;l.withCredentials=!0,l.open("POST",i),l.setRequestHeader("Content-type","application/json"),l.setRequestHeader("eventDataSource",e.eventDataSource||"JsSdk"),l.setRequestHeader("eventDataSourceVersion",e.eventDataSourceVersion||e.pixelVersion),l.onload=function(){l.status>=200&&l.status<300?o(l.response):a(l.response)},l.onerror=function(){return $e(r,void 0,void 0,(function(){var r;return Me(this,(function(i){return r=function(e){var n,t=null!==(n=e.responseText)&&void 0!==n?n:JSON.parse(e.responseText);return(null==t?void 0:t.Message)?t.Message:0!==e.status||e.responseText?"Status Code ".concat(e.status):"Request never hit server. Possible CSP violation."}(l),a(l.statusText),function(e,n,t,r){var i,o,a,l;$e(this,void 0,void 0,(function(){var u,d,s,v;return Me(this,(function(f){var p,g,m;return u="universal_pixel_realtime_fallback_"+(null!==(l=null!==(o=null===(i=t.pixel_ids)||void 0===i?void 0:i.join("_"))&&void 0!==o?o:null===(a=e.pixelIds)||void 0===a?void 0:a.join("_"))&&void 0!==l?l:""),c("trigger GET realtime conversion event fallback",e),p=n.data[0],g=Object.entries(p).filter((function(e){var n=e[0],t=e[1];return("string"==typeof t||"number"==typeof t||"boolean"==typeof t||"pixel_ids"===n)&&null!=t&&""!==t})),m=new URLSearchParams,g.forEach((function(e){var n=e[0],t=e[1];m.append(n,String(t))})),d=m,s=(e.eventDataSource||"JsSdk")+"Get",v=e.eventDataSourceVersion||e.pixelVersion,d.set("eds",s),d.set("edsv",v),d.set("rt_fallback","1"),""!==r&&d.set("rt_fbErr",r),L("".concat(e.rootUrl,"/track/rt?").concat(d.toString()),u,"TTD Universal Pixel Realtime Fallback"),[2]}))}))}(e,n,t,r),[2]}))}))},l.send(JSON.stringify(n))}))}(n,k,e).catch((function(e){return l(e,n)}))}window.ttdConversionEventsLayer=window.ttdConversionEventsLayer||[],window.ttdConversionEvents=null!==(Fe=window.ttdConversionEvents)&&void 0!==Fe?Fe:{activeDetection:null,startDetection:null,dumpConfigs:null},window.ttdConversionEvents.dumpConfigs=He,function(e,n,t){if(t||2===arguments.length)for(var r,i=0,o=n.length;i