var TTDConversionEvents;(()=>{"use strict";var e={d:(n,t)=>{for(var i in t)e.o(t,i)&&!e.o(n,i)&&Object.defineProperty(n,i,{enumerable:!0,get:t[i]})},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:()=>we,clearAllConfigs:()=>Ee,event:()=>Ie});var t={tcfV2ConsentVersion:2,consentRequestHasTimedOut:!1,waitForConsentTimeout:null,consentCheckExists:!1,isGdprApplicable:!1,gdprConsentString:null};function i(){return new URL(window.location.href).searchParams.has("upjs_debug")}function r(){return i()||null!=localStorage.getItem("enable-ttd-pixel-debugging")}function o(e){if(!e)return"";var n=void 0!==e.advertiserId&&null!==e.advertiserId?"adv_".concat(e.advertiserId):"merchant_".concat(e.merchantId),t=e.pixelIds&&e.pixelIds.length>0?"|".concat(e.pixelIds.join(",")):"";return"".concat(n).concat(t," ")}function a(e,n){var t=r(),i=(null==n?void 0:n.enableDebug)||!1;if(t||i){var a=o(n);console.info("TTD Pixel v3: ".concat(a).concat(e))}}function c(e,n){var t=r(),i=(null==n?void 0:n.enableDebug)||!1;if(t||i){var a=o(n);console.error("TTD Pixel v3: ".concat(a).concat(e))}}function d(e,n){for(var t=[],i=2;i0,f=o||s,p=Array.from(new Set(e.values())),g=0,h=l?i.map((function(e){return v(n,t,e)})):[v(n,t)];g0)return a("Partial config match found",b[0]),b.length>1&&d("Multiple partial config matches found, using first one",b[0],b.slice(1)),b[0];if(f)return void c("No matching config found for adv/merchant, event will not fire")}if(!f||!l)return 1===p.length?(a("Single config found, using it for event",p[0]),p[0]):(d("Event ids not sent, will use mostRecentInitConfig",r),r);c("Event sent ids but no exact config match found, event will not fire")}var p=function(){return p=Object.assign||function(e){for(var n,t=1,i=arguments.length;t0)return;null==e||e.resolveWith(document,[i])}},bindReady:function(){if(!e){if(e=i._Deferred(),"complete"===document.readyState)return setTimeout((function(){return i.ready()}),1);if(document.addEventListener)document.addEventListener("DOMContentLoaded",n,!1),window.addEventListener("load",(function(){return i.ready()}),!1);else if(document.attachEvent){document.attachEvent("onreadystatechange",n),window.attachEvent("onload",i.ready);var t=!1;try{t=null==window.frameElement}catch(e){console.log(e)}document.documentElement.doScroll&&t&&r()}}},_Deferred:function(){var e,n=[],t=!1,r=!1,o={done:function(){for(var t=[],a=0;a0){var a=e.querySelectorAll(p);a&&a.forEach((function(e){i.includes(e)||i.push(e)}))}for(var c=window.location.hostname,d=document.getElementsByTagName("iframe"),s=0,l=Array.from(d);s0&&u.contentDocument.querySelectorAll(p).forEach((function(e){i.includes(e)||i.push(e)}))}}return i}function q(e,n){var t=0,i=null;return new MutationObserver((function(r,o){var a=Date.now(),c=a-t;c>=n?(t=a,e(r,o)):(i&&clearTimeout(i),i=setTimeout((function(){t=Date.now(),e(r,o)}),n-c))}))}function V(e,n){if(!n.src)return!1;try{var t=e===new URL(n.src).hostname;return t&&J("Iframe "+n.src+" can be accessed"),t}catch(e){return J("error: ",e),!1}}function W(e){var n=e.currentTarget;if(n&&n.__upixel_detection)try{R(n.__upixel_detection.root,n.__upixel_detection.scopeName,n.__upixel_detection.config)}catch(e){J(e)}}function B(e,n){return function(e,n){var t=/((([^<>()[\].,;:\s@"]+(\.[^<>()[\].,;:\s@"]+)*)|(".+"))@(([^<>()[\].,;:\s@"]+\.)+[^<>()[\].,;:\s@"]{2,}))/i;if(n.detectionSubject.includes("email")&&t.test(e)){var i=function(e){return e.toLowerCase().trim()}(e.match(t)[0]);return J("We detected email: "+i),function(e,n){if(e&&n){var t=new CustomEvent("detected-identifier",{detail:{identifier:e,type:n}});J("Dispatched event with identifier: ",e," and type: ",n),window.dispatchEvent(t)}}(i,"email"),!0}return!1}(e,n)}function J(e){for(var n=[],t=1;t0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]0&&r[r.length-1])||6!==o[0]&&2!==o[0])){a=0;continue}if(3===o[0]&&(!r||o[1]>r[0]&&o[1]0?i.map((function(e){return v(n,t,e)})):[v(n,t)],a=0,c=o;a0&&!p.includes(Y.pixelId))||(ie(n.uidConfig)?e.uid2_token=n.uidConfig.uid_token:te(n.uidConfig)&&(e.euid_token=n.uidConfig.uid_token));var I={data:[ge(ge({},e),{privacy_settings:h})]};(n.enableDebug||e.debug)&&(I.debug="1"),function(e,n,t){var i=this,r="".concat(e.rootUrl,"/track/realtimeconversion");return a("trigger POST realtime conversion event",e),new Promise((function(o,c){var d=new XMLHttpRequest;d.withCredentials=!0,d.open("POST",r),d.setRequestHeader("Content-type","application/json"),d.setRequestHeader("eventDataSource","JsSdk"),d.setRequestHeader("eventDataSourceVersion",e.pixelVersion),d.onload=function(){d.status>=200&&d.status<300?o(d.response):c(d.response)},d.onerror=function(){return he(i,void 0,void 0,(function(){var i;return me(this,(function(r){return i=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."}(d),c(d.statusText),function(e,n,t,i){var r,o,c,d;he(this,void 0,void 0,(function(){var s,l,u,v;return me(this,(function(f){var p,g;return s="universal_pixel_realtime_fallback_"+(null!==(d=null!==(o=null===(r=t.pixel_ids)||void 0===r?void 0:r.join("_"))&&void 0!==o?o:null===(c=e.pixelIds)||void 0===c?void 0:c.join("_"))&&void 0!==d?d:""),a("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})),l=g.map((function(e){var n=e[0],t=e[1];return"".concat(n,"=").concat(t)})).join("&"),u=e.pixelVersion,v="".concat(e.rootUrl,"/track/rt"),""!==l&&(v+="?"+l+"&eds=".concat("JsSdkGet")+"&edsv=".concat(u)+"&rt_fallback=1"),""!==i&&(v+="&rt_fbErr=".concat(i)),C(v,s,"TTD Universal Pixel Realtime Fallback"),[2]}))}))}(e,n,t,i),[2]}))}))},d.send(JSON.stringify(n))}))}(n,I,e).catch((function(e){return c(e,n)}))}function ke(e,n,t,i,r,o){return he(this,void 0,void 0,(function(){var c,d,s,l,u;return me(this,(function(v){if(!e||""==e||!n||n.length<=0)return a("no advertiser id or pixel id given"),[2];if(c="https://"+new URL(t).hostname,d={advertiserId:e,pixelIds:n,rootUrl:c,uidConfig:r,referrerUrl:o},s={adv:e,pixel_ids:n,referrer_url:o},i)for(l in i)u=i[l],"cookie_sync"===l?d.enableCookieSyncing="1"===u:void 0!==u&&(s[l]="fmt"===l&&"number"==typeof u?u.toString():u),"fmt"!==l||"4"!==u&&4!==u||(d.enableCookieSyncing=!1);return window.ttdConversionEventsLayer.push(["init",d]),setTimeout((function(){var t,i=f(ye,e,null,n);!window._uidSdkListenerLock||(null===(t=null==i?void 0:i.uidConfig)||void 0===t?void 0:t.uid_token)?window.ttdConversionEventsLayer.push(["event",s]):document.addEventListener("visibilitychange",(function(){return xe(s,e,n)}))}),1e3),[2]}))}))}function xe(e,n,t){return he(this,void 0,void 0,(function(){var i;return me(this,(function(r){return"hidden"===document.visibilityState&&((i=f(ye,n,null,t))&&Ie(e,i,!0),document.removeEventListener("visibilitychange",xe)),[2]}))}))}function Ee(){ye.clear(),be.length=0,fe=void 0,Q={},Y=null}window.ttdConversionEventsLayer=window.ttdConversionEventsLayer||[],window.ttdConversionEvents=null!==(pe=window.ttdConversionEvents)&&void 0!==pe?pe:{activeDetection:null,startDetection:null},function(e,n,t){if(t||2===arguments.length)for(var i,r=0,o=n.length;r