!function(n,e){var define;"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports["teads-fellow"]=e():n["teads-fellow"]=e()}(this,(()=>(()=>{"use strict";var n,e,t={},o={};function i(n){var e=o[n];if(void 0!==e)return e.exports;var a=o[n]={exports:{}};return t[n](a,a.exports,i),a.exports}i.m=t,i.d=(n,e)=>{for(var t in e)i.o(e,t)&&!i.o(n,t)&&Object.defineProperty(n,t,{enumerable:!0,get:e[t]})},i.f={},i.e=n=>Promise.all(Object.keys(i.f).reduce(((e,t)=>(i.f[t](n,e),e)),[])),i.u=n=>n+".js",i.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(n){if("object"==typeof window)return window}}(),i.o=(n,e)=>Object.prototype.hasOwnProperty.call(n,e),n={},e="performance-tracker:",i.l=(t,o,a,r)=>{if(n[t])n[t].push(o);else{var c,s;if(void 0!==a)for(var d=document.getElementsByTagName("script"),l=0;l{c.onerror=c.onload=null,clearTimeout(v);var i=n[t];if(delete n[t],c.parentNode&&c.parentNode.removeChild(c),i&&i.forEach((n=>n(o))),e)return e(o)},v=setTimeout(p.bind(null,void 0,{type:"timeout",target:c}),12e4);c.onerror=p.bind(null,c.onerror),c.onload=p.bind(null,c.onload),s&&document.head.appendChild(c)}},i.r=n=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(n,"__esModule",{value:!0})},(()=>{var n;i.g.importScripts&&(n=i.g.location+"");var e=i.g.document;if(!n&&e&&(e.currentScript&&(n=e.currentScript.src),!n)){var t=e.getElementsByTagName("script");if(t.length)for(var o=t.length-1;o>-1&&(!n||!/^http(s?):/.test(n));)n=t[o--].src}if(!n)throw new Error("Automatic publicPath is not supported in this browser");n=n.replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),i.p=n})(),(()=>{var n={284:0};i.f.j=(e,t)=>{var o=i.o(n,e)?n[e]:void 0;if(0!==o)if(o)t.push(o[2]);else{var a=new Promise(((t,i)=>o=n[e]=[t,i]));t.push(o[2]=a);var r=i.p+i.u(e),c=new Error;i.l(r,(t=>{if(i.o(n,e)&&(0!==(o=n[e])&&(n[e]=void 0),o)){var a=t&&("load"===t.type?"missing":t.type),r=t&&t.target&&t.target.src;c.message="Loading chunk "+e+" failed.\n("+a+": "+r+")",c.name="ChunkLoadError",c.type=a,c.request=r,o[1](c)}}),"chunk-"+e,e)}};var e=(e,t)=>{var o,a,[r,c,s]=t,d=0;if(r.some((e=>0!==n[e]))){for(o in c)i.o(c,o)&&(i.m[o]=c[o]);s&&s(i)}for(e&&e(t);d{S=n};function vn(){if(void 0!==window.teads&&void 0!==window.teads.advertiserId){if("number"==typeof window.teads.advertiserId)return window.teads.advertiserId}else{if(void 0===window.teads_cv||void 0===window.teads_cv.advertiserId)return window.teads_adv_id;if("number"==typeof window.teads_cv.advertiserId)return window.teads_cv.advertiserId}}function wn(){return window.teads_env&&[A,O].includes(window.teads_env)?window.teads_env:A}function _n(){return window.teads_zone===k.Default}const fn="https://l.teads.tv/performance/http-source",gn={INTERNAL:"internal",BAD_INTEGRATION:"bad_integration"};function hn(n){return"[object Function]"===toString.call(n)}function mn(n){let e="";const t=function(n){let e=n,t=!1;try{for(let n=0;e.parent.document!==e.document||n<50;n+=1){if(!e.parent.document){t=!0;break}e=e.parent}}catch(n){t=!0}return{topFrame:e,err:t}}(n),{topFrame:o}=t;if(t.err)try{e=o.top.location.href}catch(n){e=o.location.href}else e=o.location.href;return e}function yn(n,e,t){try{const o={errorMessage:n,topUrl:mn(window),userAgent:void 0!==window.navigator&&void 0!==window.navigator.userAgent?window.navigator.userAgent:"",exception:e||"",version:r,type:t||gn.BAD_INTEGRATION};n=JSON.stringify(o)}catch(n){}document.createElement("img").src="".concat(fn,"?").concat(encodeURIComponent(n))}function bn(n,e,t,o){try{(new Image).src="".concat(s,"/log?clickId=").concat(o||"","&eventName=").concat(t||"")+"&msg=".concat(encodeURIComponent('{"error":"LOAD", "teadsApiVersion": '.concat(r,', "marketerID": ').concat(rn(),', \n "referrer": ').concat(document.URL,', "pRef": ').concat(document.referrer,', "extra": {"name":"').concat(n.name,'","line":"').concat(n.lineNumber||n.line,'","script":"').concat(n.fileName||n.sourceURL||n.script,'","stack":"').concat(n.stackTrace||n.stack,'","errorMessage":"').concat(n.message,'", "message":"').concat(e,'"}}')))}catch(n){}}function Cn(n){const e=["account","password","pass","secret","secretkey","username","user","login","ordernumber","orderid","email","mail","user.email","user.password","user.name","user.mail","user.lastname","user.firstname","user.phone","user.phonenumber","lastname","firstname","name","address","phonenumber","phone","client_secret","guid"];if(""!==n){const t=n.split("?").length>1?n.split("?")[1]:void 0;if(void 0!==t){let o="".concat(n.split("?")[0],"?");const i=t.split("&");for(let n=0;n=0?"XXXXXXXX":t[1])}n=o}}return n}function In(n){try{const e=new RegExp("(?:\\?|&|%3F|%26)auctid(?:=|%3D)([0-9a-zA-Z-_]*)").exec(n);if(e&&e.length>=2)return e[1]}catch(n){yn("Error when extracting Auction ID from url",null==n?void 0:n.message,gn.INTERNAL)}}function En(n,e){var t,o;const i=vn(),a=T(),c=wn(),s=function(n){const e=[];return Object.keys(n).forEach((t=>{e.push("".concat(t,"=").concat(encodeURIComponent(n[t])))})),e.join("&")}(e),d=mn(window),l=function(n){let e=tn();if(!e){let t=n;n||(t=mn(window)),e=In(t),e&&(en(e),on("url"))}return e}(d),u=function(){const n=window.teads_auction_id_forwarded_by;return n?Object.keys(n).join(","):void 0}(),v=sn(),w=dn(),_=R(),f=M(),g=W(),h=Z(),m=Cn(d),y=q(),b=window.teads_vendor_disclosed;let C="?action=".concat(n,"&env=").concat(encodeURIComponent(c),"&tag_version=").concat(encodeURIComponent(r),"&provider=").concat(p);if(s.length>0&&(C="".concat(C,"&").concat(s)),void 0!==a?C="".concat(C,"&buyer_pixel_id=").concat(encodeURIComponent(a)):void 0!==i&&(C="".concat(C,"&advertiser_id=").concat(encodeURIComponent(i))),C="".concat(C,"&referer=").concat(encodeURIComponent(m)),("pageView"===n||"conversion"===n)&&document.referrer){const n=An(document.referrer),e=An(d);""!==n&&""!==e&&n!==e&&(C="".concat(C,"&prev_referrer=").concat(encodeURIComponent(n)))}return void 0!==l&&(C="".concat(C,"&auctid=").concat(l)),void 0!==u&&(C="".concat(C,"&cohort_id=").concat(u)),void 0!==v&&(C="".concat(C,"&user_session_id=").concat(v)),void 0!==w&&(C="".concat(C,"&firstPartyCookieTeadsId=").concat(w)),void 0!==(null==_||null===(t=_.data)||void 0===t?void 0:t.tcString)&&(C="".concat(C,"&gdpr_consent=").concat(_.data.tcString)),null!=g&&g.apply?C="".concat(C,"&gdpr_status=12"):void 0!==(null==g?void 0:g.apply)&&(C="".concat(C,"&gdpr_status=0")),g&&(void 0!==g.apply&&(C="".concat(C,"&gdpr_apply=").concat(g.apply)),void 0!==g.teadsConsent&&(C="".concat(C,">c=").concat(g.teadsConsent)),void 0!==g.isServiceSpecific&&(C="".concat(C,"&gdpr_is_service_specific=").concat(g.isServiceSpecific)),void 0!==g.cmpId&&(C="".concat(C,"&gdpr_cmp_id=").concat(g.cmpId)),void 0!==g.apiVersion&&(C="".concat(C,"&gdpr_api_version=").concat(g.apiVersion))),void 0!==(null==f||null===(o=f.data)||void 0===o?void 0:o.usPrivacy)&&(C="".concat(C,"&ccpa_consent=").concat(f.data.usPrivacy)),h&&(void 0!==h.apply&&(C="".concat(C,"&ca=").concat(h.apply)),void 0!==h.teadsConsent&&(C="".concat(C,"&ctc=").concat(h.teadsConsent))),y&&void 0!==y.type&&(C="".concat(C,"&hasConsent=").concat(y.hasConsent),C="".concat(C,"&cht=").concat(y.type)),null!=b&&(C="".concat(C,"&teads_vendor_disclosed=").concat(b)),C}const kn=n=>(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]||document.getElementsByTagName("script")[0].parentNode).insertBefore(n,null);function An(n){try{return new URL(n).hostname}catch(n){return""}}const On={auctionId:{key:"tfpai",maxAge:2592e3,isJson:!0},sessionId:{key:"tfpsi",maxAge:1800,isJson:!1},viewerId:{key:"tfpvi",maxAge:7776e3,isJson:!1}};function Sn(n){try{Rn(n,"",P(),0,"/","none",!0)}catch(e){yn('Error while deleting cookie on domain with key "'.concat(n,'"'),null==e?void 0:e.message,gn.INTERNAL)}}function Pn(n,e,t){try{Rn(n,e,P(),t,"/","none",!0)}catch(e){yn('Error while setting cookie on domain with key "'.concat(n,'"'),null==e?void 0:e.message,gn.INTERNAL)}}function Tn(n){const e="".concat(n,"="),t=document.cookie.split(";");for(let n=0;n1&&void 0!==arguments[1]?arguments[1]:{};return{type:n,id:null===(e=window)||void 0===e?void 0:e.name,ts:Date.now(),host:null===(t=window)||void 0===t||null===(t=t.location)||void 0===t?void 0:t.host,...o}}function Mn(n){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},t=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"*";try{var o,i;const a=(null===(o=window)||void 0===o||null===(o=o.opener)||void 0===o?void 0:o.top)||(null===(i=window)||void 0===i?void 0:i.opener);hn(a.postMessage)&&a.postMessage(jn(n,e),t)}catch(n){}}function Fn(n){var e;let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"/";if(hn(null===(e=window)||void 0===e?void 0:e.postMessage))try{window.postMessage(jn(n,t),o)}catch(n){}}function Xn(n){var e,t,o,i,a;null!==(e=window)&&void 0!==e&&e.opener&&((null==n||null===(o=n.data)||void 0===o?void 0:o.type)===xn.PIXEL_DEBUG&&(window.teads_post_message_event_to_opener=true),(null==n||null===(i=n.data)||void 0===i?void 0:i.type)===xn.SDK_PARAMETERS&&null!=n&&null!==(a=n.data)&&void 0!==a&&a.teadsClickId&&(en(n.data.teadsClickId),on("postMessage"),Nn())),(null==n||null===(t=n.data)||void 0===t?void 0:t.type)===xn.ASK_PIXEL_INFO&&(Fn(xn.PIXEL_INFO,{buyerPixelId:T(),advertiserId:vn(),trackingAllowed:K(),firstPartyCookieAllowed:ln(),gdprAdvertiser:W(),ccpaAdvertiser:Z(),advertiserDomain:P(),auctionId:tn(),env:wn(),iabData:R(),uspData:M(),gppIabData:x(),referer:Cn(mn(window)),trackingEventsSent:window.teads_tracking_events_sent||[],request:n.data,isCompatibleCMPDetected:H(),hasConsent:q().hasConsent}),window.teads_post_message_event_to_window=!0)}function Vn(n){!function(n){const e=document.createElement("img");e.width=0,e.height=0,e.alt="",e.style.position="absolute",e.src=n,kn(e)}(n),L()&&Mn(xn.PIXEL_EVENT,{trackingUrl:n}),N()&&Fn(xn.PIXEL_EVENT,{trackingUrl:n})}async function Gn(n,e,t){try{await fetch(n,{browsingTopics:!0,cache:"no-cache",credentials:"include",keepalive:!0,...t}).then((()=>{L()&&Mn(xn.PIXEL_EVENT,{trackingUrl:n}),N()&&Fn(xn.PIXEL_EVENT,{trackingUrl:n})}))}catch(t){!1===e?yn("Unable to fire a log using fetch API",null==t?void 0:t.message,gn.BAD_INTEGRATION):Vn(n)}}function Bn(n,e,t){let o,i,a=t;for(;!o;){try{if("function"==typeof a[n]){i=a[n],o=a;break}}catch(n){}try{if(a.frames[e]){o=a;break}}catch(n){}if(a===t.top)break;a=a.parent}return{cmpFrame:o,cmpFunction:i}}const Jn={listeners:{},on(n,e){return-1===Object.keys(this.listeners).indexOf(n)&&(this.listeners[n]=[]),this.listeners[n].push(e),()=>{this.listeners[n]=this.listeners[n].filter((n=>n!=e))}},dispatch(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),o=1;on.call(null,...t)))}};function zn(n,e){var t;return null===(t=n.vendor)||void 0===t||!t.disclosedVendors||!0===n.vendor.disclosedVendors[e]}function Wn(n){if(null==n||!n.consents)return!0;for(const e of E)if(!1===n.consents[e])return!1;return!0}function Zn(n){n.type&&!Kn(n.type)||(function(n){"Teads"===n.vendor?Y(n):("Outbrain"===n.vendor||Y(n),function(n){var e;let{hasConsent:t,type:o}=n;null!==(e=window.outbrain_consent)&&void 0!==e&&e.has_consent||(window.outbrain_consent={has_consent:t,consent_handler_type:o})}(n))}(n),"Teads"!==n.vendor&&n.hasConsent&&Jn.dispatch("hasObConsent"))}function Kn(n){switch(window.teads_zone){case k.EuZone1:return!0;case k.EuZone2:return!["ccpa","gpp"].includes(n);default:return["ccpa","gpp","tcf","shopify","timeout"].includes(n)}}function Yn(n,e){let t=!1;function o(t,o){o?!1!==t.gdprApplies&&"tcloaded"!==t.eventStatus&&"useractioncomplete"!==t.eventStatus||(function(n){var e,t,o;const i=null===(e=n.vendor)||void 0===e?void 0:e.disclosedVendors;var a;a=i?!0===i[b]:null,window.teads_vendor_disclosed=a,zn(n,b)&&(null===(t=n.vendor)||void 0===t||!t.consents||n.vendor.consents[b])&&Wn(n.purpose)?Zn({hasConsent:!0,type:"tcf",vendor:"Teads"}):Zn({hasConsent:!1,type:"tcf",vendor:"Teads"}),zn(n,C)&&(null===(o=n.vendor)||void 0===o||!o.consents||n.vendor.consents[C])&&Wn(n.purpose)?Zn({hasConsent:!0,type:"tcf",vendor:"Outbrain"}):Zn({hasConsent:!1,type:"tcf",vendor:"Outbrain"})}(t),n(t)):e("CMP unable to register callback function. Please check CMP setup.")}const i="__tcfapi",a={};function r(n){const e="".concat(i,"Return"),t="string"==typeof n.data&&"".concat(n.data).includes(e)?JSON.parse(n.data):n.data;if(t[e]&&t[e].callId){const n=t[e];void 0!==a[n.callId]&&a[n.callId](n.returnValue,n.success)}}function c(n,e,o){const c="".concat(i,"Call");window[i]=(n,t,o,i)=>{const r="".concat(Math.random()),s={[c]:{command:n,version:t,parameter:i,callId:r}};a[r]=o,e.postMessage(s,"*")},t||window.addEventListener("message",r,!1),window[i](n,2,o)}const{cmpFrame:s,cmpFunction:d}=Bn("__tcfapi","__tcfapiLocator",window);return!!s&&(new Promise(((n,e)=>{hn(d)?d("ping",2,(()=>n())):c("ping",s,(()=>n())),setTimeout((()=>e()),m)})).catch((()=>e("Unable to ping the CMP"))),t||(t=!0,hn(d)?d("addEventListener",2,o):c("addEventListener",s,o)),!0)}function qn(n,e){const t={};function o(n){const e=n&&n.data&&n.data.__uspapiReturn;e&&e.callId&&void 0!==t[e.callId]&&(t[e.callId](e.returnValue,e.success),delete t[e.callId])}let i=!1;function a(n,e,a){i||(window.addEventListener("message",o,!1),i=!0),function(n,o,i){const a="".concat(Math.random()),r={__uspapiCall:{command:n,version:1,callId:a}};t[a]=i,e.postMessage(r,"*")}(n,0,a)}const{cmpFrame:r,cmpFunction:c}=Bn("__uspapi","__uspapiLocator",window);if(!r)return!1;new Promise(((n,e)=>{hn(c)?c("getUSPData",1,(()=>n())):a("getUSPData",r,(()=>n())),setTimeout((()=>e()),m)})).catch((()=>e("Unable to ping the USP")));const s=function(){const t={};return{consentDataCallback:(o,i)=>{i&&o.uspString&&(t.usPrivacy=o.uspString),function(n,e){var t;null!=n&&n.uspString?e&&(t=n.uspString,!["1NYN","1YYN"].some((n=>n===(null==t?void 0:t.toUpperCase()))))?Zn({hasConsent:!0,type:"ccpa"}):Zn({hasConsent:!1,type:"ccpa"}):Zn({hasConsent:_n(),type:_n()?"ccpa":void 0})}(o,i),t.usPrivacy?n(t):e("Unable to get USP consent string.")}}}();return hn(c)?c("getUSPData",1,s.consentDataCallback):a("getUSPData",r,s.consentDataCallback),!0}let Hn=function(n){return n.Ping="ping",n.AddEventListener="addEventListener",n.RemoveEventListener="removeEventListener",n}({}),$n=function(n){return n.Ready="ready",n.NotReady="Not ready",n}({});function Qn(n,e,t){return new Promise(((o,i)=>{if(void 0!==n)switch(e){case Hn.Ping:n(e,((n,e)=>{e?o(n):i(new Error("Ping command failed"))}));break;case Hn.AddEventListener:n(e,((n,e)=>{e?o(n):i(new Error("AddEventListener command failed"))}));break;case Hn.RemoveEventListener:"number"==typeof t&&n(e,t,(()=>{}));break;default:i(new Error("Invalid GPP command"))}}))}const ne=n=>n===$n.Ready,ee=n=>null!=n;class te{constructor(){var n,e,t;n=this,t=!1,(e=function(n){var e=function(n,e){if("object"!=typeof n||!n)return n;var t=n[Symbol.toPrimitive];if(void 0!==t){var o=t.call(n,"string");if("object"!=typeof o)return o;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(n)}(n);return"symbol"==typeof e?e:e+""}(e="isGppAvailable"))in n?Object.defineProperty(n,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):n[e]=t;const{cmpFunction:o,cmpFrame:i}=Bn("__gpp","__gppLocator",window);hn(o)?this.gpp=o:i&&(this.gpp=te.buildCmpFunctionWithPostMessage(i)),this.isGppAvailable="function"==typeof this.gpp}static buildCmpFunctionWithPostMessage(n){const e={},t="__gpp",o="".concat(t,"Call");return n.addEventListener("message",(function(n){const o="".concat(t,"Return"),i="string"==typeof n.data&&"".concat(n.data).includes(o)?JSON.parse(n.data):n.data;if(i[o]&&i[o].callId){const n=i[o];"function"==typeof e[n.callId]&&e[n.callId](n.returnValue,n.success)}}),!1),(t,i,a)=>{const r="".concat(Math.random()),c={[o]:{command:t,version:"1.1",callId:r}};t===Hn.RemoveEventListener?e[r]=a:e[r]=i,n.postMessage(c,"*")}}async retrieveConsent(n,e){if(this.isGppAvailable)try{let t;const o=await Promise.race([Qn(this.gpp,Hn.Ping),new Promise(((n,o)=>{t=setTimeout((()=>{e("GPP ping timed out"),o("Unable to ping the GPP CMP")}),m)}))]);if(clearTimeout(t),ne(o.signalStatus)&&ee(o.gppString))return n({applicableSections:o.applicableSections,gppString:o.gppString}),void this.parseGppString(o,n,e);const i=await Qn(this.gpp,Hn.AddEventListener);Qn(this.gpp,Hn.RemoveEventListener,i.listenerId);const{pingData:a}=i;if(!ne(a.signalStatus))return void e("CMP is expecting changes, consent data is not available yet");if(!ee(a.gppString))return e("Expected gppString to be a string but got null or undefined"),void Zn({hasConsent:!1,type:"gpp"});const r=i.pingData;n({applicableSections:r.applicableSections,gppString:r.gppString}),this.parseGppString(r,n,e)}catch(n){e("Error during GPP command call: ".concat(n))}}async parseGppString(n,e,t){if(!this.iabLib)try{this.iabLib=await i.e(854).then(i.bind(i,854))}catch(n){return Zn({hasConsent:_n(),type:"gpp"}),void t("Failed to load iab library: ".concat(n))}const o=this.parseString(n.gppString,"Teads");Zn({hasConsent:null!=o?o:_n(),type:"gpp",vendor:"Teads"});const a=this.parseString(n.gppString,"Outbrain");Zn({hasConsent:null!=a?a:_n(),type:"gpp",vendor:"Outbrain"}),e({applicableSections:n.applicableSections,gppString:n.gppString})}parseString(n,e){try{return this.hasConsent(n,e)}catch(t){if(n.startsWith("D"))try{const t=n.substring(n.indexOf("~")+1);return this.hasConsent(t,e)}catch(n){}return}}hasConsent(n,e){const t=this.iabLib.TCString.decode(n),o="Teads"===e?b:C;if(t.vendorConsents.has(o))return t.purposeConsents.has(1)}retrieveConsentWithoutHolding(n,e){let t=!1,o=!1;this.retrieveConsent((e=>{o||(t=!0,n(e))}),(n=>{t||(o=!0,e(n))}))}}function oe(n,e){const t=new te;return t.isGppAvailable&&t.retrieveConsentWithoutHolding(n,e),t.isGppAvailable}function ie(n,e){const t=["ad_storage","ad_user_data"];let o=!1;function i(){return t.every((n=>{var e;return!0===(null===(e=window.google_tag_data)||void 0===e||null===(e=e.ics)||void 0===e||null===(e=e.entries[n])||void 0===e?void 0:e.update)}))}if(window.google_tag_data){var a;const c=window.google_tag_data;return null!=c&&null!==(a=c.ics)&&void 0!==a&&a.entries?(Zn({hasConsent:i(),type:"gtm"}),o||i()||null===(r=window.google_tag_data)||void 0===r||null===(r=r.ics)||void 0===r||!r.addListener||(o=!0,window.google_tag_data.ics.addListener(t,(function(){Zn({hasConsent:i(),type:"gtm"}),n({hasConsent:i()})}))),n({hasConsent:i()}),!0):(e("Unable to get consent data from GTM"),!1)}var r;return!1}function ae(n){if(window.didomiState){const e=window.didomiState;if(!e)return!1;e.didomiPurposesConsent||(Zn({hasConsent:!1,type:"di"}),n({hasConsent:!1}));const t=e.didomiPurposesConsent.indexOf("cookies")>-1&&e.didomiPurposesConsent.indexOf("measure_ad_performance")>-1;return Zn({hasConsent:t,type:"di"}),n({hasConsent:t}),!0}return!1}function re(n){let e=!1;if(window.Cookiebot){const i=window.Cookiebot;if(i){var t,o;const a=null!==(t=null===(o=i.consent)||void 0===o?void 0:o.marketing)&&void 0!==t?t:_n();return Zn({hasConsent:a,type:"cb"}),e||(e=!0,window.addEventListener("CookiebotOnAccept",(()=>{Zn({hasConsent:!0,type:"cb"})}),!1)),n({hasConsent:a}),!0}return!1}return!1}function ce(n){let e=!1;function t(){var n,e;const t=null===(n=window.OnetrustActiveGroups)||void 0===n?void 0:n.toUpperCase();return null!==(e=(null==t?void 0:t.indexOf("C0004"))>-1)&&void 0!==e?e:_n()}var o,i;return!!window.OnetrustActiveGroups&&!(!(null===(o=window.OnetrustActiveGroups)||void 0===o?void 0:o.toUpperCase())||(t()?(Zn({hasConsent:!0,type:"ot"}),n({hasConsent:!0}),0):"OneTrust"in window?(!e&&null!==(i=window.OneTrust)&&void 0!==i&&i.OnConsentChanged&&(e=!0,window.OneTrust.OnConsentChanged((()=>{Zn({hasConsent:t(),type:"ot"}),n({hasConsent:t()})}))),0):_n()||(Zn({hasConsent:!1,type:"ot"}),n({hasConsent:!1}),0)))}const se=["g111","g11-","g1-1"];function de(n){var e,t;const o=decodeURIComponent(document.location.href.toLowerCase()),i=o.match(/[?&]gcs=([^&]*)/);if(null===(e=null==i||null===(t=i[1])||void 0===t?void 0:t.trim())||void 0===e||!e)return!1;const a=se.some((n=>o.includes("gcs=".concat(n))));return Zn({hasConsent:a,type:"g111"}),n({hasConsent:a}),!0}function le(n){if(!window.UC_UI)return!1;let e=!1;function t(){Zn({hasConsent:o(),type:"uc"}),n({hasConsent:o()})}function o(){const n=window.UC_UI;return n.areAllConsentsAccepted()||!(null===(e=n.getServicesBaseInfo().find((n=>{var e;return(null===(e=n.name)||void 0===e?void 0:e.toLowerCase())===I})))||void 0===e||null===(e=e.consent)||void 0===e||!e.status);var e}return e||(e=!0,window.addEventListener("UC_UI_CMP_EVENT",(function(n){const{type:e}=n.detail;["ACCEPT_ALL","DENY_ALL","SAVE"].includes(e)&&t()}))),t(),!0}function ue(n){function e(){var n;return!(null===(n=window.teads_e)||void 0===n||!n.some((n=>{const{shopifyEvent:e}=n;return"boolean"!=typeof e&&!!e&&function(n){let{analyticsProcessingAllowed:e,marketingAllowed:t,saleOfDataAllowed:o}=n;return e&&t&&o}(e)})))}return!!function(){const n=document.cookie,e=!!n&&["_shopify_ga","_shopify_y","_shopify_s","_shopify_fs","_shopify_sa_p","_shopify_sa_t","_shopify_country","_shopify_essential"].some((e=>n.includes(e))),t=document.location.href.toLowerCase().includes("/custom/web-pixel-");return e||t}()&&(null!==(t=window.teads_e)&&void 0!==t&&t.length&&window.teads_e.some((n=>{const{shopifyEvent:e}=n;return!!e&&"boolean"!=typeof e}))?(Zn({hasConsent:e(),type:"shopify"}),n({hasConsent:e()}),!0):(Zn({hasConsent:_n(),type:"shopify"}),n({hasConsent:_n()}),!0));var t}function pe(n,e,t){return new Promise((o=>{const i=setTimeout((()=>o({type:t,cmpFound:!1})),y),a=n=>{clearTimeout(i),o({type:t,cmpFound:n})};try{n((n=>{e({data:n}),a(!0)}),(n=>{e({error:n}),a(!0)}))||a(!1)}catch(n){e({error:n instanceof Error?n.message:String(n)}),a(!0)}}))}async function ve(){return Promise.all([pe(Yn,U,"tcf"),pe(qn,j,"ccpa"),pe(oe,D,"gpp"),pe(re,V,"cb"),pe(ie,F,"gtm"),pe(ae,X,"di"),pe(ce,G,"ot"),pe(le,J,"uc"),pe(ue,z,"shopify"),pe(de,B,"g111")]).then((n=>{n.filter((n=>Kn(n.type))).every((n=>!n.cmpFound))&&Zn({hasConsent:_n(),type:"timeout"})}))}function we(n,e){return 0===n.indexOf(e+"=")}const _e="PAGE_VIEW",fe="AUTO_NAVIGATE_ANOTHER_SITE",ge="AUTO_TAB_LOST_FOCUS",he="AUTO_10_SEC_ON_PAGE";function me(n){var e,t;return null===(e=(t=window).teads_setOutbrainCookieOnTeads)||void 0===e?void 0:e.call(t,"".concat(_,"=").concat(encodeURIComponent(JSON.stringify(n))))}function ye(){try{var n,e;const t=null===(n=(e=window).teads_getOutbrainCookieFromTeads)||void 0===n?void 0:n.call(e);return t?JSON.parse(decodeURIComponent(t.split("=")[1])):{}}catch(n){return yn("Error while parsing Outbrain dicbo ID cookie",null==n?void 0:n.message),bn(n,"Error while parsing Outbrain dicbo ID cookie"),{}}}function be(){try{return ye()[_]}catch(n){return yn("Error while parsing Outbrain click ID cookie",null==n?void 0:n.message),void bn(n,"Error while parsing Outbrain click ID cookie")}}function Ce(n){if("optout"!==n)if("NoClickId"===n)nn()&&function(){const n=ye();n[g]=Date.now(),me(n)}();else{n&&(n=n.replace(/#/g,""));const e=ye();e[_]=n,me(e)}}function Ie(){const n=Q();return{cht:n.type,au:!n.hasConsent,referrer:document.URL,zone:window.teads_zone,bust:Math.random().toString().replace(".","")}}async function Ee(n,e,t){if(!nn())return;const o={marketerId:e.join(","),name:n,dl:mn(window),pRef:document.referrer,...t,...Ie()},i=be();i&&(o[f]=i),Object.keys(o).forEach((n=>(void 0===o[n]||""===o[n])&&delete o[n])),Gn("".concat(l,"?").concat(function(n){const e=new URLSearchParams;for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&e.append(t,String(n[t]));return e.toString()}(o)),!0,{referrerPolicy:"no-referrer-when-downgrade",eventSourceEligible:!1,triggerEligible:!0})}async function ke(n){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(nn()&&(e||function(n){return!!n.conversionType&&["AddToCart","AddToWishlist","CompleteRegistration","InitiateCheckout","Lead","Purchase","ViewContent","Search"].includes(n.conversionType)}(n))){const e={...n};n.price&&(e.orderValue="".concat(n.price)),"Purchase"===n.conversionType&&(e.orderId=n.name),delete e.conversionType,delete e.shopifyEvent,delete e.name;const t=an();await Ee(n.conversionType,t,e)}}function Ae(n,e,t){"track"===n&&e!==_e&&ke({conversionType:e,...t},!0).catch((n=>{yn("Error while sending Outbrain event",null==n?void 0:n.message),bn(n,"Error while sending Outbrain event",e,be())}))}let Oe=!1;const Se={zone:k.Default},Pe={conversionType:"conversion_type",price:"aepp",currency:"aepc",name:"aepn",product_name:"aeppn"};async function Te(n){if(K()){const e=function(n,e){const t={};return Object.keys(n).forEach((e=>{const o=e,i=n[e];Object.prototype.hasOwnProperty.call(Pe,o)?t[Pe[o]]=i+"":yn("Invalid parameter specified in event: ".concat(o))})),t}(n),t=c+En("conversion",e);Vn(t),un(t),ke(n).catch((e=>{bn(e,"Error while sending event based conversion",n.conversionType,be())}))}else nn()&&ke(n).catch((e=>{bn(e,"Error while sending event based conversion",n.conversionType,be())}))}async function Le(){const n=[];for(;null!==(e=window.teads_e)&&void 0!==e&&e.length;){var e;n.push(Te(window.teads_e.shift()))}try{return await Promise.all(n)}catch(n){yn("Error while sending event based conversion",null==n?void 0:n.message,gn.INTERNAL)}}const Ne=n=>{const{auctionId:e,gdpr:t,ccpa:o,firstPartyCookieAllowed:i,domain:a,trackingAllowed:r,outbrainAdvertiserId:c,outbrainAdvertiserIds:s}=n;var d,l,u,p;d=i,window.first_party_cookie_allowed=d,l=r,window.teads_tracking_allowed=l,t&&(u=t,window.teads_gdpr_advertiser=u),o&&function(n){window.teads_ccpa_advertiser=n}(o),a&&(p=a,window.advertiser_domain=p),e&&(en(e),on("url")),c&&function(n){window.teads_outbrainAdvertiserId=n}(c);const v=null==s?void 0:s.map((n=>n.trim())).filter((n=>!!n));null!=v&&v.length&&function(n){window.teads_outbrainAdvertiserIds=n}(v)},Ue=n=>{if(n){const n=Dn(On.auctionId);if(n){const e=tn();e&&e!==n||on("cookie"),e||en(n)}return Nn(),n}return Sn(On.auctionId.key),null},Re=(n,e,t,o)=>{if(n){const n=Dn(On.sessionId);e&&t&&e!==t?cn(o):n?cn(n):o&&cn(o),Un()}else o&&cn(o),Sn(On.sessionId.key)},De=(n,e)=>{if(e&&n){const n=Dn(On.viewerId);t=n||e,window.teads_viewer_id=t,function(){const n=dn();ln()&&n&&Pn(On.viewerId.key,n,On.viewerId.maxAge)}()}else Sn(On.viewerId.key);var t};let xe=!1;async function je(){try{const n=await async function(){const n=mn(window),e=function(n){var e,t,o;const i=vn(),a=T();let r="referer=".concat(encodeURIComponent(n));void 0!==a?r+="&buyer_pixel_id=".concat(encodeURIComponent(a)):void 0!==i&&(r+="&advertiser_id=".concat(encodeURIComponent(i)));const c=R();var s,d;c&&(void 0!==(null==c||null===(s=c.data)||void 0===s?void 0:s.gdprApplies)&&(r+="&gdpr_applies=".concat(encodeURIComponent(c.data.gdprApplies))),null!=c&&null!==(d=c.data)&&void 0!==d&&d.tcString&&(r+="&gdpr_consent=".concat(encodeURIComponent(c.data.tcString))),null!=c&&c.error&&(r+="&gdpr_error=".concat(encodeURIComponent(c.error))));const l=M();null!=l&&null!==(e=l.data)&&void 0!==e&&e.usPrivacy&&(r+="&ccpa_consent=".concat(encodeURIComponent(l.data.usPrivacy))),null!=l&&l.error&&(r+="&ccpa_error=".concat(encodeURIComponent(l.error)));const u=x();null!=u&&null!==(t=u.data)&&void 0!==t&&t.applicableSections&&(r+="&gpp_applicable_sections=".concat(encodeURIComponent(u.data.applicableSections.join(",")))),null!=u&&null!==(o=u.data)&&void 0!==o&&o.gppString&&(r+="&gpp_consent=".concat(encodeURIComponent(u.data.gppString))),null!=u&&u.error&&(r+="&gpp_error=".concat(encodeURIComponent(u.error)));const p=function(){const n=Tn("optout");if(n)return"1"===n}();void 0!==p&&(r+="&web_opt_out=".concat(encodeURIComponent(p)));const v=window.teads_gtm_consent_data;v&&(v.data&&(r+=">m_consent=".concat(encodeURIComponent(v.data.hasConsent))),v.error&&(r+=">m_error=".concat(encodeURIComponent(v.error))));const w=window.teads_didomi_consent_data;w&&(w.data&&(r+="&didomi_consent=".concat(encodeURIComponent(w.data.hasConsent))),w.error&&(r+="&didomi_error=".concat(encodeURIComponent(w.error))));const _=window.teads_cookiebot_consent_data;_&&(_.data&&(r+="&cookiebot_consent=".concat(encodeURIComponent(_.data.hasConsent))),_.error&&(r+="&cookiebot_error=".concat(encodeURIComponent(_.error))));const f=window.teads_onetrust_consent_data;return f&&(f.data&&(r+="&onetrust_consent=".concat(encodeURIComponent(f.data.hasConsent))),f.error&&(r+="&onetrust_error=".concat(encodeURIComponent(f.error)))),r}(n);try{const n=await fetch("".concat(u,"?").concat(e),{cache:"no-cache"});if(200===(null==n?void 0:n.status)){var t,o,i,a,r,c,s,d,l,p;const e=await n.json(),u=null==e||null===(t=e.outbrain_advertiser_ids)||void 0===t||null===(o=t.map)||void 0===o?void 0:o.call(t,(n=>n.trim())).filter((n=>n.length>0));return{trackingAllowed:!1!==(null==e?void 0:e.tracking_allowed),firstPartyCookieAllowed:!0===(null==e?void 0:e.first_party_cookie_allowed),sessionId:null==e?void 0:e.session_id,auctionId:null==e?void 0:e.auction_id,viewerId:null==e?void 0:e.user_id,domain:null==e?void 0:e.domain,ccpa:null!=e&&e.ccpa?{apply:null===(i=e.ccpa)||void 0===i?void 0:i.apply,teadsConsent:null===(a=e.ccpa)||void 0===a?void 0:a.teads_consent}:void 0,gpp:null!=e&&e.gpp?{apply:null===(r=e.gpp)||void 0===r?void 0:r.apply,teadsConsent:null===(c=e.gpp)||void 0===c?void 0:c.teads_consent}:void 0,gdpr:null!=e&&e.gdpr?{apply:null===(s=e.gdpr)||void 0===s?void 0:s.apply,teadsConsent:null===(d=e.gdpr)||void 0===d?void 0:d.teads_consent,apiVersion:null===(l=e.gdpr)||void 0===l?void 0:l.api_version,cmpId:null===(p=e.gdpr)||void 0===p?void 0:p.cmp_id,isServiceSpecific:null==e?void 0:e.gdpr.is_service_specific}:void 0,outbrainAdvertiserId:null==e?void 0:e.outbrain_advertiser_id,outbrainAdvertiserIds:null!=u&&u.length?u:void 0}}}catch(n){yn("Error while trigger API to know advertiser information",null==n?void 0:n.message,gn.INTERNAL)}const v=In(n);return v?{trackingAllowed:!0,firstPartyCookieAllowed:!1,auctionId:v}:{trackingAllowed:!0,firstPartyCookieAllowed:!1}}(),{sessionId:e,auctionId:t,viewerId:o}=n;Ne(n);const i=an();i.length&&(window.teads_obEvent=Ae,Me(i),xe||nn()||(xe=!0,Jn.on("hasObConsent",(()=>{Me(i)}))));const a=ln(),r=Ue(a);Re(a,r,t,e),De(a,o),N()&&Fn(xn.CONSENT_INFO_LOADED,{trackingAllowed:K(),firstPartyCookieAllowed:ln(),gdprAdvertiser:W(),ccpaAdvertiser:Z(),advertiserDomain:P(),auctionId:tn(),iabData:R(),uspData:M(),isCompatibleCMPDetected:H(),hasConsent:q().hasConsent})}catch(n){yn("Error while initializing advertiser",null==n?void 0:n.message,gn.INTERNAL)}}function Me(n){var e,t;null===(e=async function(){if(!nn())return;window.teads_setObCachedClickId=Ce;const n=function(n){let e=mn(window);e.indexOf("#")>-1&&(e=e.substring(0,e.indexOf("#")));const t=(e.split("?")[1]||"").split(/&/);for(let e=0;e3e5}catch(n){return yn("Error while parsing Outbrain click ID cookie",null==n?void 0:n.message),bn(n,"Error while parsing Outbrain click ID cookie"),!0}}()&&function(){const n=document.createElement("script"),e=rn();n.src="".concat(s,"/cachedClickId?marketerId=").concat(e,"&fromTeads=true"),document.body.appendChild(n)}()}())||void 0===e||e.catch(),null===(t=Ee(_e,n,{pld:Math.floor(performance.now())}))||void 0===t||t.catch((n=>{yn("Error while firing Outbrain Page View pixel",null==n?void 0:n.message),bn(n,"Error while firing Outbrain Page View pixel",_e,be())})),function(n){nn()&&null!=n&&n.length&&n.forEach((n=>{try{const e=document.createElement("script");e.src="".concat(d,"/mtWavesBundler/handler/").concat(n,"/true"),document.body.appendChild(e)}catch(n){bn(n,"Error while loading OB waves")}}))}(n),nn()&&be()&&!Oe&&(Oe=!0,setTimeout((()=>{ke({conversionType:he},!0)}),1e4),document.addEventListener("visibilitychange",(()=>{document.hidden&&ke({conversionType:ge})})),window.addEventListener("beforeunload",(()=>{ke({conversionType:fe})})))}const Fe=async()=>{const n=c+En("pageView",{});Vn(n),un(n),await Gn(c+En("browser-topics",{}),!1)},Xe=()=>{const n=En("timeSpent",{}),e=c+n;pn(!1),document.addEventListener("visibilitychange",(n=>()=>{"hidden"===document.visibilityState&&!0!==S&&(pn(!0),async function(n,e){try{const e=navigator.sendBeacon&&navigator.sendBeacon.bind(navigator);if(!e||!e(n))throw new Error("Beacon not sent");L()&&Mn(xn.PIXEL_EVENT,{trackingUrl:n}),N()&&Fn(xn.PIXEL_EVENT,{trackingUrl:n})}catch(e){await Gn(n,!0)}}(n),Un(),un(n))})(e))},Ve=()=>{const n=window.teads_e||[];window.teads_e=[],window.teads_e.push=function(){for(var n=arguments.length,e=new Array(n),t=0;t{await ve(),K()&&(clearInterval(e),await Le()),n--,0===n&&clearInterval(e)}),Be)}(),Un()):yn("The event queue is not defined.")}(),window.teads_e.length},window.teads_e.push(...n)};async function Ge(){const n=vn(),e=T();"number"!=typeof n&&"number"!=typeof e||(await je(),await async function(){K()&&(await Fe(),await Xe(),Ve())}())}const Be=500,Je=5e3;function ze(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Be;ve().then((()=>{if(!0===$())Ge().catch((n=>yn("Error while firing pixel",null==n?void 0:n.message)));else{const e=Math.min(2*n,Je);setTimeout((()=>ze(e)),n)}})).catch((e=>{yn("Error while checking consent",null==e?void 0:e.message);const t=Math.min(2*n,Je);setTimeout((()=>ze(t)),n)}))}async function We(){_n()||!0===$()?await Ge():await ze()}async function Ze(){try{window.teads_adv_id||Object.defineProperty(window,"teads_adv_id",{set(n){this._teads_adv_id=n,We()},get(){return this._teads_adv_id},configurable:!0}),window.teads_buyer_pixel_id||Object.defineProperty(window,"teads_buyer_pixel_id",{set(n){this._teads_buyer_pixel_id=n,We()},get(){return this._teads_buyer_pixel_id},configurable:!0})}catch(n){yn("Error while binding advertiser and pixel ids",null==n?void 0:n.message)}try{window.teads_setOutbrainCookieOnTeads||(window.teads_setOutbrainCookieOnTeads=function(n){const e=Ln(),t=JSON.parse(e);t[v]=n,Pn(On.auctionId.key,btoa(JSON.stringify(t)),On.auctionId.maxAge)}),window.teads_getOutbrainCookieFromTeads||(window.teads_getOutbrainCookieFromTeads=function(){const n=Ln();return JSON.parse(n)[v]})}catch(n){yn("Error while loading Outbrain",null==n?void 0:n.message)}await We()}return async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;try{"undefined"!=typeof window&&(window.teads_zone=Se.zone,hn(null===(e=window)||void 0===e?void 0:e.addEventListener)&&(Mn(xn.PIXEL_LOADED),Fn(xn.PIXEL_LOADED),window.addEventListener("message",Xn)),await new Promise(((e,t)=>{setTimeout((()=>{ve().then((()=>Ze())).then(e).catch(t)}),n>=0?n:0)})))}catch(n){yn("Unhandled exception",null==n?void 0:n.message,gn.INTERNAL),nn()&&rn()&&bn(n,"Unhandled exception")}var e}(0),a})()));