!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(w);var i=n[t];if(delete n[t],c.parentNode&&c.parentNode.removeChild(c),i&&i.forEach((n=>n(o))),e)return e(o)},w=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{this.listeners[n]=this.listeners[n].filter((n=>n!=e))}},once(n,e){const t=this.on(n,(function(){t(),e(...arguments)}));return t},dispatch(n){for(var e=arguments.length,t=new Array(e>1?e-1:0),o=1;on.call(null,...t)))}},S="js-web",P="js-gtm";let T=!1;function L(){return window.advertiser_domain}function N(){return window.teads_buyer_pixel_id}function U(){return!0===window.teads_post_message_event_to_opener}function R(){return!0===window.teads_post_message_event_to_window}function D(n){window.teads_iab_tcf_consent_data=n}function x(){return window.teads_iab_tcf_consent_data}function j(n){window.teads_iab_gpp_consent_data=n}function M(){return window.teads_iab_gpp_consent_data}function F(n){window.teads_usp_consent_data=n}function X(){return window.teads_usp_consent_data}function V(n){window.teads_gtm_consent_data=n}function G(n){window.teads_didomi_consent_data=n}function B(n){window.teads_cookiebot_consent_data=n}function J(n){window.teads_onetrust_consent_data=n}function z(n){window.teads_in_iframe_consent_data=n}function W(n){window.teads_user_centric_consent_data=n}function Z(n){window.teads_shopify_consent_data=n}function K(){return window.teads_gdpr_advertiser}function Y(){return window.teads_ccpa_advertiser}function q(){return!0===window.teads_tracking_allowed}function H(n){let{hasConsent:e,type:t}=n;const o=window.teads_consent;if(null!=o&&o.has_consent){const n=A(o.consent_handler_type),i=A(t);t&&i>n&&("timeout"===o.consent_handler_type?window.teads_consent={has_consent:e,consent_handler_type:t}:e&&(window.teads_consent={...o,consent_handler_type:t}))}else window.teads_consent={has_consent:e,consent_handler_type:t},e&&(window.teads_tracking_allowed=!0,O.dispatch("consentGranted"))}function $(){var n;return void 0===(null===(n=window.teads_consent)||void 0===n?void 0:n.has_consent)?{hasConsent:!1}:{hasConsent:window.teads_consent.has_consent,type:window.teads_consent.consent_handler_type}}function Q(){return![void 0,"timeout"].includes($().type)}function nn(){var n;return null===(n=window.teads_consent)||void 0===n?void 0:n.has_consent}function en(){var n;return void 0===(null===(n=window.outbrain_consent)||void 0===n?void 0:n.has_consent)?{hasConsent:!1}:{hasConsent:window.outbrain_consent.has_consent,type:window.outbrain_consent.consent_handler_type}}function tn(){return en().hasConsent}function on(n){window.teads_auction_id=n}function an(){return window.teads_auction_id}function rn(n){const e=window.teads_auction_id_forwarded_by||{};e[n]=!0,window.teads_auction_id_forwarded_by=e}function cn(){var n;return null!==(n=window.teads_outbrainAdvertiserIds)&&void 0!==n&&n.length?window.teads_outbrainAdvertiserIds:window.teads_outbrainAdvertiserId?[window.teads_outbrainAdvertiserId]:[]}function sn(){var n;return null!==(n=window.teads_outbrainAdvertiserIds)&&void 0!==n&&n.length?window.teads_outbrainAdvertiserIds.join(","):window.teads_outbrainAdvertiserId?window.teads_outbrainAdvertiserId:""}function dn(n){window.teads_session_id=n}function ln(){return window.teads_session_id}function un(){return window.teads_viewer_id}function pn(){return!0!==window.teads_disable_first_party_cookie&&window.first_party_cookie_allowed}function wn(n){window.teads_tracking_events_sent||(window.teads_tracking_events_sent=[]),window.teads_tracking_events_sent.push(n)}const vn=n=>{T=n};function _n(){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 fn(){return window.teads_env&&[S,P].includes(window.teads_env)?window.teads_env:S}function gn(){return window.teads_zone===E.Default}const hn="https://l.teads.tv/performance/http-source",mn={INTERNAL:"internal",BAD_INTEGRATION:"bad_integration"};function yn(n){return"[object Function]"===toString.call(n)}function bn(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 Cn(n,e,t){try{const o={errorMessage:n,topUrl:bn(window),userAgent:void 0!==window.navigator&&void 0!==window.navigator.userAgent?window.navigator.userAgent:"",exception:e||"",version:r,type:t||mn.BAD_INTEGRATION};n=JSON.stringify(o)}catch(n){}document.createElement("img").src="".concat(hn,"?").concat(encodeURIComponent(n))}function In(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(sn(),', \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 En(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 kn(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){Cn("Error when extracting Auction ID from url",null==n?void 0:n.message,mn.INTERNAL)}}function An(n,e){var t,o;const i=_n(),a=N(),c=fn(),s=function(n){const e=[];return Object.keys(n).forEach((t=>{e.push("".concat(t,"=").concat(encodeURIComponent(n[t])))})),e.join("&")}(e),d=bn(window),l=function(n){let e=an();if(!e){let t=n;n||(t=bn(window)),e=kn(t),e&&(on(e),rn("url"))}return e}(d),u=function(){const n=window.teads_auction_id_forwarded_by;return n?Object.keys(n).join(","):void 0}(),w=ln(),v=un(),_=x(),f=X(),g=K(),h=Y(),m=En(d),y=$(),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=Sn(document.referrer),e=Sn(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!==w&&(C="".concat(C,"&user_session_id=").concat(w)),void 0!==v&&(C="".concat(C,"&firstPartyCookieTeadsId=").concat(v)),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 On=n=>(document.getElementsByTagName("head")[0]||document.getElementsByTagName("body")[0]||document.getElementsByTagName("script")[0].parentNode).insertBefore(n,null);function Sn(n){try{return new URL(n).hostname}catch(n){return""}}const Pn={auctionId:{key:"tfpai",maxAge:2592e3,isJson:!0},sessionId:{key:"tfpsi",maxAge:1800,isJson:!1},viewerId:{key:"tfpvi",maxAge:7776e3,isJson:!1}};function Tn(n){try{xn(n,"",L(),0,"/","none",!0)}catch(e){Cn('Error while deleting cookie on domain with key "'.concat(n,'"'),null==e?void 0:e.message,mn.INTERNAL)}}function Ln(n,e,t){try{xn(n,e,L(),t,"/","none",!0)}catch(e){Cn('Error while setting cookie on domain with key "'.concat(n,'"'),null==e?void 0:e.message,mn.INTERNAL)}}function Nn(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 Xn(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);yn(a.postMessage)&&a.postMessage(Fn(n,e),t)}catch(n){}}function Vn(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(yn(null===(e=window)||void 0===e?void 0:e.postMessage))try{window.postMessage(Fn(n,t),o)}catch(n){}}function Gn(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)===Mn.PIXEL_DEBUG&&(window.teads_post_message_event_to_opener=true),(null==n||null===(i=n.data)||void 0===i?void 0:i.type)===Mn.SDK_PARAMETERS&&null!=n&&null!==(a=n.data)&&void 0!==a&&a.teadsClickId&&(on(n.data.teadsClickId),rn("postMessage"),Rn())),(null==n||null===(t=n.data)||void 0===t?void 0:t.type)===Mn.ASK_PIXEL_INFO&&(Vn(Mn.PIXEL_INFO,{buyerPixelId:N(),advertiserId:_n(),trackingAllowed:q(),firstPartyCookieAllowed:pn(),gdprAdvertiser:K(),ccpaAdvertiser:Y(),advertiserDomain:L(),auctionId:an(),env:fn(),iabData:x(),uspData:X(),gppIabData:M(),referer:En(bn(window)),trackingEventsSent:window.teads_tracking_events_sent||[],request:n.data,isCompatibleCMPDetected:Q(),hasConsent:$().hasConsent}),window.teads_post_message_event_to_window=!0)}function Bn(n){!function(n){const e=document.createElement("img");e.width=0,e.height=0,e.alt="",e.style.position="absolute",e.src=n,On(e)}(n),U()&&Xn(Mn.PIXEL_EVENT,{trackingUrl:n}),R()&&Vn(Mn.PIXEL_EVENT,{trackingUrl:n})}async function Jn(n,e,t){try{await fetch(n,{browsingTopics:!0,cache:"no-cache",credentials:"include",keepalive:!0,...t}).then((()=>{U()&&Xn(Mn.PIXEL_EVENT,{trackingUrl:n}),R()&&Vn(Mn.PIXEL_EVENT,{trackingUrl:n})}))}catch(t){!1===e?Cn("Unable to fire a log using fetch API",null==t?void 0:t.message,mn.BAD_INTEGRATION):Bn(n)}}function zn(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}}function Wn(n,e){var t;return null===(t=n.vendor)||void 0===t||!t.disclosedVendors||!0===n.vendor.disclosedVendors[e]}function Zn(n){if(null==n||!n.consents)return!0;for(const e of I)if(!1===n.consents[e])return!1;return!0}function Kn(n){n.type&&!Yn(n.type)||(function(n){"Teads"===n.vendor?H(n):("Outbrain"===n.vendor||H(n),function(n){let{hasConsent:e,type:t}=n;const o=window.outbrain_consent;null!=o&&o.has_consent?e&&t&&A(t)>A(o.consent_handler_type)&&(window.outbrain_consent={...o,consent_handler_type:t}):window.outbrain_consent={has_consent:e,consent_handler_type:t}}(n))}(n),"Teads"!==n.vendor&&n.hasConsent&&O.dispatch("hasObConsent"))}function Yn(n){switch(window.teads_zone){case E.EuZone1:return!0;case E.EuZone2:return!["ccpa","gpp"].includes(n);default:return["ccpa","gpp","tcf","shopify","timeout"].includes(n)}}function qn(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[y]:null,window.teads_vendor_disclosed=a,Wn(n,y)&&(null===(t=n.vendor)||void 0===t||!t.consents||n.vendor.consents[y])&&Zn(n.purpose)?Kn({hasConsent:!0,type:"tcf",vendor:"Teads"}):Kn({hasConsent:!1,type:"tcf",vendor:"Teads"}),Wn(n,b)&&(null===(o=n.vendor)||void 0===o||!o.consents||n.vendor.consents[b])&&Zn(n.purpose)?Kn({hasConsent:!0,type:"tcf",vendor:"Outbrain"}):Kn({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}=zn("__tcfapi","__tcfapiLocator",window);return!!s&&(new Promise(((n,e)=>{yn(d)?d("ping",2,(()=>n())):c("ping",s,(()=>n())),setTimeout((()=>e()),m)})).catch((()=>e("Unable to ping the CMP"))),t||(t=!0,yn(d)?d("addEventListener",2,o):c("addEventListener",s,o)),!0)}function Hn(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}=zn("__uspapi","__uspapiLocator",window);if(!r)return!1;new Promise(((n,e)=>{yn(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()))))?Kn({hasConsent:!0,type:"ccpa"}):Kn({hasConsent:!1,type:"ccpa"}):Kn({hasConsent:gn(),type:gn()?"ccpa":void 0})}(o,i),t.usPrivacy?n(t):e("Unable to get USP consent string.")}}}();return yn(c)?c("getUSPData",1,s.consentDataCallback):a("getUSPData",r,s.consentDataCallback),!0}let $n=function(n){return n.Ping="ping",n.AddEventListener="addEventListener",n.RemoveEventListener="removeEventListener",n}({}),Qn=function(n){return n.Ready="ready",n.NotReady="Not ready",n}({});function ne(n,e,t){return new Promise(((o,i)=>{if(void 0!==n)switch(e){case $n.Ping:n(e,((n,e)=>{e?o(n):i(new Error("Ping command failed"))}));break;case $n.AddEventListener:n(e,((n,e)=>{e?o(n):i(new Error("AddEventListener command failed"))}));break;case $n.RemoveEventListener:"number"==typeof t&&n(e,t,(()=>{}));break;default:i(new Error("Invalid GPP command"))}}))}const ee=n=>n===Qn.Ready,te=n=>null!=n;class oe{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}=zn("__gpp","__gppLocator",window);yn(o)?this.gpp=o:i&&(this.gpp=oe.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===$n.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([ne(this.gpp,$n.Ping),new Promise(((n,o)=>{t=setTimeout((()=>{e("GPP ping timed out"),o("Unable to ping the GPP CMP")}),m)}))]);if(clearTimeout(t),ee(o.signalStatus)&&te(o.gppString))return n({applicableSections:o.applicableSections,gppString:o.gppString}),void this.parseGppString(o,n,e);const i=await ne(this.gpp,$n.AddEventListener);ne(this.gpp,$n.RemoveEventListener,i.listenerId);const{pingData:a}=i;if(!ee(a.signalStatus))return void e("CMP is expecting changes, consent data is not available yet");if(!te(a.gppString))return e("Expected gppString to be a string but got null or undefined"),void Kn({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 Kn({hasConsent:gn(),type:"gpp"}),void t("Failed to load iab library: ".concat(n))}const o=this.parseString(n.gppString,"Teads");Kn({hasConsent:null!=o?o:gn(),type:"gpp",vendor:"Teads"});const a=this.parseString(n.gppString,"Outbrain");Kn({hasConsent:null!=a?a:gn(),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?y:b;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 ie(n,e){const t=new oe;return t.isGppAvailable&&t.retrieveConsentWithoutHolding(n,e),t.isGppAvailable}function ae(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?(Kn({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(){Kn({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 re(n){if(window.didomiState){const e=window.didomiState;if(!e)return!1;e.didomiPurposesConsent||(Kn({hasConsent:!1,type:"di"}),n({hasConsent:!1}));const t=e.didomiPurposesConsent.indexOf("cookies")>-1&&e.didomiPurposesConsent.indexOf("measure_ad_performance")>-1;return Kn({hasConsent:t,type:"di"}),n({hasConsent:t}),!0}return!1}function ce(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:gn();return Kn({hasConsent:a,type:"cb"}),e||(e=!0,window.addEventListener("CookiebotOnAccept",(()=>{Kn({hasConsent:!0,type:"cb"})}),!1)),n({hasConsent:a}),!0}return!1}return!1}function se(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:gn()}var o,i;return!!window.OnetrustActiveGroups&&!(!(null===(o=window.OnetrustActiveGroups)||void 0===o?void 0:o.toUpperCase())||(t()?(Kn({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((()=>{Kn({hasConsent:t(),type:"ot"}),n({hasConsent:t()})}))),0):gn()||(Kn({hasConsent:!1,type:"ot"}),n({hasConsent:!1}),0)))}const de=["g111","g11-","g1-1"];function le(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=de.some((n=>o.includes("gcs=".concat(n))));return Kn({hasConsent:a,type:"g111"}),n({hasConsent:a}),!0}function ue(n){if(!window.UC_UI)return!1;let e=!1;function t(){Kn({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())===C})))||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 pe(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}))?(Kn({hasConsent:e(),type:"shopify"}),n({hasConsent:e()}),!0):(Kn({hasConsent:gn(),type:"shopify"}),n({hasConsent:gn()}),!0));var t}function we(n,e,t){return new Promise((o=>{const i=n=>o({type:t,cmpFound:n});try{n((n=>{e({data:n}),i(!0)}),(n=>{e({error:n}),i(!0)}))||i(!1)}catch(n){e({error:n instanceof Error?n.message:String(n)}),i(!0)}}))}async function ve(){await new Promise((n=>{const e=O.once("consentGranted",n),t=[we(qn,D,"tcf"),we(Hn,F,"ccpa"),we(ie,j,"gpp"),we(ce,B,"cb"),we(ae,V,"gtm"),we(re,G,"di"),we(se,J,"ot"),we(ue,W,"uc"),we(pe,Z,"shopify"),we(le,z,"g111")];Promise.all(t).then((t=>{e(),t.filter((n=>Yn(n.type))).every((n=>!n.cmpFound))&&Kn({hasConsent:gn(),type:"timeout"}),n()})),!0===nn()&&(e(),n())}))}function _e(n,e){return 0===n.indexOf(e+"=")}const fe="PAGE_VIEW",ge="AUTO_NAVIGATE_ANOTHER_SITE",he="AUTO_TAB_LOST_FOCUS",me="AUTO_10_SEC_ON_PAGE";function ye(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 be(){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 Cn("Error while parsing Outbrain dicbo ID cookie",null==n?void 0:n.message),In(n,"Error while parsing Outbrain dicbo ID cookie"),{}}}function Ce(){try{return be()[_]}catch(n){return Cn("Error while parsing Outbrain click ID cookie",null==n?void 0:n.message),void In(n,"Error while parsing Outbrain click ID cookie")}}function Ie(n){if("optout"!==n)if("NoClickId"===n)tn()&&function(){const n=be();n[g]=Date.now(),ye(n)}();else{n&&(n=n.replace(/#/g,""));const e=be();e[_]=n,ye(e)}}function Ee(){const n=en();return{cht:n.type,au:!n.hasConsent,referrer:document.URL,zone:window.teads_zone,bust:Math.random().toString().replace(".","")}}async function ke(n,e,t){if(!tn())return;const o={marketerId:e.join(","),name:n,dl:bn(window),pRef:document.referrer,...t,...Ee()},i=Ce();i&&(o[f]=i),Object.keys(o).forEach((n=>(void 0===o[n]||""===o[n])&&delete o[n])),Jn("".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 Ae(n){let e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(tn()&&(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=cn();await ke(n.conversionType,t,e)}}function Oe(n,e,t){"track"===n&&e!==fe&&Ae({conversionType:e,...t},!0).catch((n=>{Cn("Error while sending Outbrain event",null==n?void 0:n.message),In(n,"Error while sending Outbrain event",e,Ce())}))}let Se=!1;const Pe={zone:E.Default},Te={conversionType:"conversion_type",price:"aepp",currency:"aepc",name:"aepn",product_name:"aeppn"};async function Le(n){if(q()){const e=function(n,e){const t={};return Object.keys(n).forEach((e=>{const o=e,i=n[e];Object.prototype.hasOwnProperty.call(Te,o)?t[Te[o]]=i+"":Cn("Invalid parameter specified in event: ".concat(o))})),t}(n),t=c+An("conversion",e);Bn(t),wn(t),Ae(n).catch((e=>{In(e,"Error while sending event based conversion",n.conversionType,Ce())}))}else tn()&&Ae(n).catch((e=>{In(e,"Error while sending event based conversion",n.conversionType,Ce())}))}async function Ne(){const n=[];for(;null!==(e=window.teads_e)&&void 0!==e&&e.length;){var e;n.push(Le(window.teads_e.shift()))}try{return await Promise.all(n)}catch(n){Cn("Error while sending event based conversion",null==n?void 0:n.message,mn.INTERNAL)}}const Ue=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&&(on(e),rn("url")),c&&function(n){window.teads_outbrainAdvertiserId=n}(c);const w=null==s?void 0:s.map((n=>n.trim())).filter((n=>!!n));null!=w&&w.length&&function(n){window.teads_outbrainAdvertiserIds=n}(w)},Re=n=>{if(n){const n=jn(Pn.auctionId);if(n){const e=an();e&&e!==n||rn("cookie"),e||on(n)}return Rn(),n}return Tn(Pn.auctionId.key),null},De=(n,e,t,o)=>{if(n){const n=jn(Pn.sessionId);e&&t&&e!==t?dn(o):n?dn(n):o&&dn(o),Dn()}else o&&dn(o),Tn(Pn.sessionId.key)},xe=(n,e)=>{if(e&&n){const n=jn(Pn.viewerId);t=n||e,window.teads_viewer_id=t,function(){const n=un();pn()&&n&&Ln(Pn.viewerId.key,n,Pn.viewerId.maxAge)}()}else Tn(Pn.viewerId.key);var t};let je=!1;async function Me(){try{const n=await async function(){const n=bn(window),e=function(n){var e,t,o;const i=_n(),a=N();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=x();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=X();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=M();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=Nn("optout");if(n)return"1"===n}();void 0!==p&&(r+="&web_opt_out=".concat(encodeURIComponent(p)));const w=window.teads_gtm_consent_data;w&&(w.data&&(r+=">m_consent=".concat(encodeURIComponent(w.data.hasConsent))),w.error&&(r+=">m_error=".concat(encodeURIComponent(w.error))));const v=window.teads_didomi_consent_data;v&&(v.data&&(r+="&didomi_consent=".concat(encodeURIComponent(v.data.hasConsent))),v.error&&(r+="&didomi_error=".concat(encodeURIComponent(v.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){Cn("Error while trigger API to know advertiser information",null==n?void 0:n.message,mn.INTERNAL)}const w=kn(n);return w?{trackingAllowed:!0,firstPartyCookieAllowed:!1,auctionId:w}:{trackingAllowed:!0,firstPartyCookieAllowed:!1}}(),{sessionId:e,auctionId:t,viewerId:o}=n;Ue(n);const i=cn();i.length&&(window.teads_obEvent=Oe,Fe(i),je||tn()||(je=!0,O.on("hasObConsent",(()=>{Fe(i)}))));const a=pn(),r=Re(a);De(a,r,t,e),xe(a,o),R()&&Vn(Mn.CONSENT_INFO_LOADED,{trackingAllowed:q(),firstPartyCookieAllowed:pn(),gdprAdvertiser:K(),ccpaAdvertiser:Y(),advertiserDomain:L(),auctionId:an(),iabData:x(),uspData:X(),isCompatibleCMPDetected:Q(),hasConsent:$().hasConsent})}catch(n){Cn("Error while initializing advertiser",null==n?void 0:n.message,mn.INTERNAL)}}function Fe(n){var e,t;null===(e=async function(){if(!tn())return;window.teads_setObCachedClickId=Ie;const n=function(n){let e=bn(window);e.indexOf("#")>-1&&(e=e.substring(0,e.indexOf("#")));const t=(e.split("?")[1]||"").split(/&/);for(let e=0;e3e5}catch(n){return Cn("Error while parsing Outbrain click ID cookie",null==n?void 0:n.message),In(n,"Error while parsing Outbrain click ID cookie"),!0}}()&&function(){const n=document.createElement("script"),e=sn();n.src="".concat(s,"/cachedClickId?marketerId=").concat(e,"&fromTeads=true"),document.body.appendChild(n)}()}())||void 0===e||e.catch(),null===(t=ke(fe,n,{pld:Math.floor(performance.now())}))||void 0===t||t.catch((n=>{Cn("Error while firing Outbrain Page View pixel",null==n?void 0:n.message),In(n,"Error while firing Outbrain Page View pixel",fe,Ce())})),function(n){tn()&&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){In(n,"Error while loading OB waves")}}))}(n),tn()&&Ce()&&!Se&&(Se=!0,setTimeout((()=>{Ae({conversionType:me},!0)}),1e4),document.addEventListener("visibilitychange",(()=>{document.hidden&&Ae({conversionType:he})})),window.addEventListener("beforeunload",(()=>{Ae({conversionType:ge})})))}const Xe=async()=>{const n=c+An("pageView",{});Bn(n),wn(n),await Jn(c+An("browser-topics",{}),!1)},Ve=()=>{const n=An("timeSpent",{}),e=c+n;vn(!1),document.addEventListener("visibilitychange",(n=>()=>{"hidden"===document.visibilityState&&!0!==T&&(vn(!0),async function(n,e){try{const e=navigator.sendBeacon&&navigator.sendBeacon.bind(navigator);if(!e||!e(n))throw new Error("Beacon not sent");U()&&Xn(Mn.PIXEL_EVENT,{trackingUrl:n}),R()&&Vn(Mn.PIXEL_EVENT,{trackingUrl:n})}catch(e){await Jn(n,!0)}}(n),Dn(),wn(n))})(e))},Ge=()=>{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(),q()&&(clearInterval(e),await Ne()),n--,0===n&&clearInterval(e)}),Je)}(),Dn()):Cn("The event queue is not defined.")}(),window.teads_e.length},window.teads_e.push(...n)};async function Be(){const n=_n(),e=N();"number"!=typeof n&&"number"!=typeof e||(await Me(),await async function(){q()&&(await Xe(),await Ve(),Ge())}())}const Je=500,ze=5e3;function We(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:Je;ve().then((()=>{if(!0===nn())Be().catch((n=>Cn("Error while firing pixel",null==n?void 0:n.message)));else{const e=Math.min(2*n,ze);setTimeout((()=>We(e)),n)}})).catch((e=>{Cn("Error while checking consent",null==e?void 0:e.message);const t=Math.min(2*n,ze);setTimeout((()=>We(t)),n)}))}async function Ze(){gn()||!0===nn()?await Be():We()}async function Ke(){try{window.teads_adv_id||Object.defineProperty(window,"teads_adv_id",{set(n){this._teads_adv_id=n,Ze()},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,Ze()},get(){return this._teads_buyer_pixel_id},configurable:!0})}catch(n){Cn("Error while binding advertiser and pixel ids",null==n?void 0:n.message)}try{window.teads_setOutbrainCookieOnTeads||(window.teads_setOutbrainCookieOnTeads=function(n){const e=Un(),t=JSON.parse(e);t[w]=n,Ln(Pn.auctionId.key,btoa(JSON.stringify(t)),Pn.auctionId.maxAge)}),window.teads_getOutbrainCookieFromTeads||(window.teads_getOutbrainCookieFromTeads=function(){const n=Un();return JSON.parse(n)[w]})}catch(n){Cn("Error while loading Outbrain",null==n?void 0:n.message)}await Ze()}return async function(){let n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0;try{"undefined"!=typeof window&&(window.teads_zone=Pe.zone,yn(null===(e=window)||void 0===e?void 0:e.addEventListener)&&(Xn(Mn.PIXEL_LOADED),Vn(Mn.PIXEL_LOADED),window.addEventListener("message",Gn)),await new Promise(((e,t)=>{setTimeout((()=>{ve().then((()=>Ke())).then(e).catch(t)}),n>=0?n:0)})))}catch(n){Cn("Unhandled exception",null==n?void 0:n.message,mn.INTERNAL),tn()&&sn()&&In(n,"Unhandled exception")}var e}(0),a})()));