/*! web-client-bundle - v26.331.1504 - 2026-03-31 15:04:28 */ !function(){"use strict";const t=new Uint8Array([253,180,226,228,183,131,164,73,141,178,202,137,216,81,43,173,208,100,102,229,162,194,214,9,148,199,135,170,57,197,223,156,41,136,4,3,200,178,57,54,79,131,168,59,80,48,151,24,111,215,97,188,3,100,184,187,143,96,25,143,91,187,182,121,46,176,255,38,139,12,82,107,216,149,245,157,113,26,77,70,155,37,52,159,213,227,12,54,198,7,102,254,180,157,233,103,108,224,122,161,135,132,159,98,100,106,221,159,175,135,183,248,54,14,184,242,221,2,80,97,177,147,197,160,11,21,138,69,255,196,221,32,195,72,86,190,244,249,80,29,178,45,66,60,232,185,29,20,199,123,246,231,156,7,54,180,77,62,150,53,115,187,200,212,170,186,144,32,46,11,80,201,43,223,218,164,34,213,246,243,147,234,255,192,150,138,97,172,147,167,89,140,237,223,17,113,30,126,111,177,26,223,207,83,32,235,55,207,126,56,8,175,106,135,75,110,230,84,227,208,164,23,244,196,172,19,60,121,99,157,157,28,12,112,139,45,233,57,244,21,52,224,61,0,106,211,66,129,41,115,126,16,126,238,94,11,64,4,145,78,151,133,134,52,172,139,93,179,175,245,248,178,99,170,136,67,233,242,239,132,178,241,20,148,18,186,79,19,232,179,247,69,83,95,58,66,11,92,116,248,117,163,212,250,10,185,184,169,170,128,41,61,53,230,182,253,161,8,167,164,63,35,39,201,231,154,123,94,212,237,72,222,20,134,100,139,234,78,249,164,120,250,87,133,48,142,194,60,210,245,244,231,74,216,234,34,92,73,225,47,111,125,66,44,248,73,44,147,47,132,242,231,61,247,99,64,202,246,255,93,92,234,3,44,218,102,9,119,180,212,133,251,239,62,155,55,70,112,228,52,237,237,104,100,129,1,220,241,60,10,56,57,194,143,24,109,66,193,44,246,111,13,127,127,91,180,118,221,225,218,152,206,50,238,220,14,227,223,166,216,88,211,38,8,226,160,115,83,5,185,161,200,77,233,43,195,103,18,15,6,110,87,216,163,143,122,43,93,68,173,126,70,108,59,22,208,70,164,61,34,43,98,71,162,220,49,209,227,47,83,188,219,171,169,50,49,6,213,155,95,205,190,189,18,9,51,158,184,182,119,235,146,63,214,66,131,195,54,38,202,77,140,129,211,65,120,109,149,44,139,172,132,230,143,36,214,241,54,233,205,161,183,231,126,126,163,43,234,84,6,132,103,220,75,226,72,231,128,148,61,65,144,214,194,252,153,193,24,171,76,213,63,127,115,153,139,88,12,28,169,29,250,101,99,209,178,0,22,230,190,166,203,158,152,247,229,31,105,4,59,211,106,217,130,86,21,196,145,174,253,14,224,171,245,237,6,171,201,92,31,139,167,163,23,17,47,53,11,149,131,85,189,109,78,206,165,223,238,74,236,225,108,200,244,26,95,91,135,192,238,206,81,87,230,226,124,98,201,18,104,87,25,44,204,123,246,83,5,182,167,174,179,171,177,210,66,17,170,205,82,166,91,27,150,165,218,52,30,172,113,135,25,96,41,81,245,175,162,208,158,70,176,47,162,155,189,80,85,171,239,22,48,185,78,136,61,104,199,31,131,177,190,251,46,30,206,60,13,128,53,107,170,50,158,228,132,209,121,33,167,226,23,32,111,16,63,117,145,200,69,75,194,81,63,16,13,113,114,62,98,90,72,151,158,133,131,137,252,216,134,102,173,218,14,19,218,202,186,68,116,34,214,228,204,133,214,233,119,43,196,61,206,153,206,196,33,15,96,206,120,170,160,204,176,205,209,253,186,93,139,159,110,39,85,209,239,91,204,55,207,118,255,124,223,100,22,55,206,197,98,94,248,227,17,125,43,14,246,100,23,93,33,38,139,218,110,31,182,249,22,225,153,56,114,206,190,199,133,69,166,181,157,85,137,179,47,142,181,48,170,127,41,248,22,226,241,184,85,244,228,242,69,72,209,66,71,108,94,226,109,171,118,26,131,83,22,176,13,140,109,58,37,82,14,139,8,154,199,34,245,203,105,56,183,107,8,166,145,213,78,24,77,254,237,86,180,130,39,213,117,25,176,58,90,58,246,157,84,76,172,117,204,148,123,168,79,181,26,35,203,217,196,123,224,224,75,55,250,102,106,10,127,201,141,155,223,205,199,148,178,135,46,216,22,23,189,112,19,75,56,157,248,58,49,221,181,25,121,73,219,61,151,175,186,206,191,200,199,154,237,180,163,82,255,107,84,50,115,244,116,99,205,68,187,58,117,246,52,236,127,220,186,110,28,69,236,185,120,210,69,86,103,22,177,56,227,250,117,71,116,17,9,39,72,102,196,248,136,165,175,152,77,247,178,57,26,193,174,229,209,164,234,100,111,35,219,220,84,115,159,212,225,12,98,23,204,4,114,10,22,223,105,95,173,135,76,153,71,250,125,22,132,186,149,121,131,44,105,19,190,160,24,40,136,10,11,233,33,140,161,227,149,38,220,94,132,168,155,187,115,31,199,16,56,223,107,43,213,250,240,124,86,71,51,113,222,203,11,165,53,22,223,209,69,2,236,115,81,51,12,99,146,22,53,205,68,114,75,89,199,217,164,99,58,46,145,118,188,102,80,127,166,16,5,81,133,3,52,234,175,115,193,125,137,219,238,22,153,103,49,191,14,131,224,70,221,101,112,104,72,69,188,36,227,79,196,133,173,98,20,1,69,114,174,40,47,30,171,179,18,222,241,225,119,153,2,253,26,142,124,91,147,240,218,157,249,8,164,192,14,255,211,150,216,253,62,35,3,229,112,199,125,141,105,148,45,153,22,98,202,202,62,19,164,189,41,248,51,186,198,138,131,218,17,244,72,182,253,23,168,229,146,72,13,100,247,165,248,201,55,199,120,210,152,222,2,58,196,160,103,129,7,140,232,41,155,177,13,160,124,10,243,23,160,198,35,181,203,77,248,192,62,51,220,118,113,135,190,235,51,47,64,159,150,57,135,17,129,160,190,70,76,88,47,8,59,0,219,150,1,50,27,107,153,20]);function e(t){const e=(new TextEncoder).encode(t);let n=2166136261;for(let t=0;t>>0}const n=(t,e)=>`${t}_${e}_salt`,s=(t,e=200)=>t.length<=e?t:`${t.substring(0,e)}...`;let o=!1;try{((t,e)=>{const n=new Set,o=[];try{const e=t.top?.location.hostname;e&&n.add(e)}catch(t){const e=t;o.push(s(e.message))}try{n.add(t.location.hostname)}catch(t){const e=t;o.push(s(e.message))}try{const e=t.location.href;n.add(new URL(e).hostname)}catch(t){const e=t;o.push(s(e.message))}try{const t=e.URL;n.add(new URL(t).hostname)}catch(t){const e=t;o.push(s(e.message))}if(0===n.size)throw new Error(`Unable to determine hostname: ${JSON.stringify(o)}`);return n})(window,document).forEach((s=>{o||(o=((t,s)=>{for(let o=0;o<14;o++){const a=e(n(t,o))%10837,r=a%8;if(!(s[Math.floor(a/8)]&1<{const e=this.globalContext.document.cookie.split("; ").reduce(((e,n)=>{const o=n.split("=");return o[0]===t?decodeURIComponent(o.slice(1).join("=")):e}),"");return e.length>0?e:null},this.removeItem=(t,e="/")=>{this.setItem(t,"",0,e)},this.setItem=(t,e,n,o="/")=>{const a=new Date(n);if(!this.isValidDate(a))throw new Error("Invalid expiration date");this.globalContext.document.cookie=`${t}=${e}; expires=${a.toUTCString()}; path=${o};`},this.globalContext=t}isValidDate(t){return t instanceof Date&&!isNaN(t)}}const u=["scope/objectName",t,e];function p(t){return null===t||"object"!=typeof t?t:t instanceof Date?new Date(t.getTime()):t instanceof Array?t.reduce(((t,e)=>(t.push(p(e)),t)),[]):t instanceof Set?Array.from(t.values()).reduce(((t,e)=>(t.add(p(e)),t)),new Set):t instanceof Map?Array.from(t.entries()).reduce(((t,e)=>(t.set(e[0],p(e[1])),t)),new Map):t instanceof Object?Object.keys(t).reduce(((e,n)=>(e[n]=p(t[n]),e)),{}):t}class m{constructor(t,e){const n=e.rootName;this.globalContext=e.globalContext;const o=this.globalContext[n].get(t);if(null==o)throw new Error(`Missing "${t}" account in userspace object`);this.id=t,this.store=o.store,this.queue=o.queue,this.store.has("listeners")||this.store.set("listeners",new Map)}async record(t,e){return await new Promise(((n,o)=>{this.queue.push(new CustomEvent(t,{detail:{resolve:n,reject:o,source:i.internal,...e}}))}))}async recordListener(t,e){return await new Promise(((n,o)=>{this.queue.push(new CustomEvent(t.name,{detail:{resolve:n,reject:o,source:i.internal,...e}}))}))}recordListenerNonBlocking(t,e){this.recordListener(t,e).catch((t=>{}))}read(t,e){const n=this.store.get(t);if(void 0!==n)return n;if(void 0!==e?.persist&&e.persist){const n=this.readLocalStorage(t,{usePrefix:!0,throwOnDisallowed:e.throwOnDisallowed});if(void 0!==n)return n}const o=e?.default?.generators?.get(t);return void 0!==o?o(...e?.default?.args??[]):void 0}write(t,e,n){this.store.set(t,e),void 0!==n?.persist&&n.persist&&this.writeLocalStorage(t,e,{usePrefix:!0,throwOnDisallowed:n.throwOnDisallowed})}use(t,e){let n;const o=this.store.get(t.key);if(void 0!==o)n=o;else if(void 0!==e?.persist&&e.persist){const o=this.readLocalStorage(t.key,{usePrefix:!0,throwOnDisallowed:e.throwOnDisallowed});null!=o&&(n=o)}const a=n??t.default;if("function"==typeof a||!1===e?.structuredClone)return a;try{return structuredClone(a)}catch(t){try{return p(a)}catch(t){return yt.logCoreError({id:"Core.library.Account.use",account:null,error:t}),a}}}update(t,e,n){let o=e(this.use(t,{...n,throwOnDisallowed:n?.throwOnDisallowed}));if(void 0!==t.postProcessor&&(o=t.postProcessor(o)),this.store.set(t.key,o),void 0!==n?.persist&&n.persist){if("string"!=typeof o)throw new Error(`${JSON.stringify(o)} must be a string to be writtable to browser storage`);this.writeLocalStorage(t.key,o,{usePrefix:!0,throwOnDisallowed:n.throwOnDisallowed})}}delete(t,e){this.store.delete(t),void 0!==e?.persist&&e.persist&&this.deleteLocalStorage(t,{usePrefix:!0,throwOnDisallowed:e.throwOnDisallowed})}remove(t,e){this.store.delete(t.key),void 0!==e?.persist&&e.persist&&this.deleteLocalStorage(t.key,{usePrefix:!0,throwOnDisallowed:e.throwOnDisallowed})}executeFuncWithConsent(t,e){if(!this.isAllowedToAccessInfoOnDevice())throw new Error("Invalid consent. API requires consent before execution.");return e.apply(t)}recordErrorEvent(t){yt.logError({...t,account:this})}recordStatusChangeEvent(t){yt.logFeature({id:t.id,account:this,feature:t.status,analyticsSampleRateAdjustFactor:t.analyticsSampleRateAdjustFactor,props:{...t.props}})}recordGenericEvent(t){yt.logFeature({id:t.id,account:this,feature:t.id,analyticsSampleRateAdjustFactor:t.analyticsSampleRateAdjustFactor,props:{...t.props}})}isAllowedToAccessInfoOnDevice(){return this.updateUserConsent(),this.use(d)}isAPStagAllowedToAccessInfoOnDevice(){return!0===this.globalContext.apstag._atsaaiod()}updateUserConsent(){try{const t=this.isAPStagAllowedToAccessInfoOnDevice();this.update(d,(()=>t))}catch(t){}}getPersistedItemName(t){return`aps:${this.id}:${t}`}isBrowserStorageAllowed(t){let e=!1;try{e=this.isAllowedToAccessInfoOnDevice()}catch{}return e||u.includes(t)}setCookieStorage(t,e,n,o){const a=o?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(a)throw new Error(`${t} is not allowed to be set on cookie storage`);return}const i=o?.usePrefix?this.getPersistedItemName(t):t;return new l(this.globalContext).setItem(i,e,n,o?.path??"/")}readCookieStorage(t,e){const n=e?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(n)throw new Error(`${t} is not allowed to be read from cookie storage`);return}const o=e?.usePrefix?this.getPersistedItemName(t):t;return new l(this.globalContext).getItem(o)}readLocalStorage(t,e){const n=e?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(n)throw new Error(`${t} is not allowed to be read from browser storage`);return}const o=e?.usePrefix?this.getPersistedItemName(t):t;return this.globalContext.localStorage.getItem(o)??void 0}writeLocalStorage(t,e,n){const o=n?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(o)throw new Error(`${t} is not allowed to be written to browser storage`);return}if("string"!=typeof e)throw new Error(`${JSON.stringify(e)} must be a string to be writtable to browser storage`);const a=n?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.localStorage.setItem(a,e)}deleteLocalStorage(t,e){const n=e?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(n)throw new Error(`${t} is not allowed to be touched/deleted in browser storage`);return}const o=e?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.localStorage.removeItem(o)}readSessionStorage(t,e){const n=e?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(n)throw new Error(`${t} is not allowed to be read from browser storage`);return}const o=e?.usePrefix?this.getPersistedItemName(t):t;if(o in this.globalContext.sessionStorage)return this.globalContext.sessionStorage.getItem(o)}writeSessionStorage(t,e,n){const o=n?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(o)throw new Error(`${t} is not allowed to be written to browser storage`);return}if("string"!=typeof e)throw new Error(`${JSON.stringify(e)} must be a string to be writable to browser storage`);const a=n?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.sessionStorage.setItem(a,e)}deleteSessionStorage(t,e){const n=e?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(n)throw new Error(`${t} is not allowed to be touched/deleted in browser storage`);return}const o=e?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.sessionStorage.removeItem(o)}}const f="_system";class h extends m{constructor(t,e){super(f,{globalContext:t,rootName:e})}}const v="listeners",y="_internal/history",g="_internal/pageLoadID",w="_internal/externalEventCount";class b{constructor(t,e,n){this.globalContext=t,this.rootName=e,this.dispatcher=n}getAccounts(){return this.globalContext[this.rootName]}createUserspaceRoot(){null==this.getAccounts()&&(this.globalContext[this.rootName]=new Map)}createSystemAccount(){!1===this.getAccounts().has(f)&&(this.getAccounts().set(f,{queue:[],store:new Map}),new h(this.globalContext,this.rootName).store.set(g,Math.random()))}observeRootSet(){const t=this;this.getAccounts().set=function(e,n){Map.prototype.set.apply(this,[e,n]),t.equip()}}observeAccountQueuesPush(){const t=this;this.getAccounts().forEach((e=>{e.queue.push=function(...e){Array.prototype.push.apply(this,e),t.dispatcher.t({reason:{method:a.push,events:e}})}}))}overwriteAccountStoresGet(){this.getAccounts().forEach((t=>{t.store.get=function(...t){return Map.prototype.get.apply(this,t)}}))}defineConvenienceFunctions(){const t=(t,e,n)=>{const o=this.getAccounts().get(t);void 0!==o&&o.queue.push(new CustomEvent(e,{detail:n??{}}))},e=this.globalContext[this.rootName];e.triggerFor=t,e.trigger=(e,n)=>{t(f,e,n)},void 0===e._private&&(e._private={}),e._private.CookieStorage=l}equip(){try{this.createUserspaceRoot(),this.createSystemAccount(),this.observeRootSet(),this.observeAccountQueuesPush(),this.overwriteAccountStoresGet(),this.defineConvenienceFunctions()}catch(t){throw new h(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Equiper.equip",error:t}),t}}}var E;!function(t){t.info="info",t.warn="warn",t.error="error"}(E||(E={}));class S{static Instance(){return this.o}static SessionId(){return this.i}info(...t){const e=new Date(Date.now()),n=E.info;return console.log(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}warn(...t){const e=new Date(Date.now()),n=E.warn;return console.warn(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}error(...t){const e=new Date(Date.now()),n=E.error;return console.error(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}getPrefix(t,e){return`${t.toISOString()} | ${S.SessionId()} | [${e.toUpperCase()}]`}}S.o=new S,S.i=`${Date.now()}`;const x=S.Instance(),_="26.331.1504",R=t=>{let e,n=window;do{try{const e=n?.location?.hostname;if(e&&t(e))return!0}catch(t){if(!(t instanceof DOMException&&"SecurityError"===t.name||t instanceof Error&&t.message.includes("cross-origin frame")))throw t;if(Math.random()<.001)throw t}if(n===window.top)break;e=n,n=n.parent}while(e!==n&&e!==window.top);return!1},A=t=>void 0===t||!Array.isArray(t)||R((e=>t.includes(e))),I=t=>void 0===t||!Array.isArray(t)||R((e=>t.some((t=>((t,e)=>{const n=(t=>t?t.toLowerCase().trim().replace(/^www\./,""):"")(t);return n===e})(e,t)))));function j(t){return!(t>=1||Number.isNaN(t))&&(t<=0||Math.random()>=t)}function k(){try{return!!new URLSearchParams(window.top?.location.search??window.location.search).has("apscoredebug")||(window._aps?.get("_system").store.get("_internal/coreDebugMode")??!1)}catch{return!1}}const $={key:"_internal/eventSources",default:new Map},C={key:"_internal/processedEventSources",default:new Set},O={key:"analytics/sampleRateFactors",default:void 0},P=[c.completed,c.error,c.cancelled,c.analytics];class D{constructor(t,e){this.globalContext=t,this.rootName=e}l(t){return t.store.get("_config/events/deactivations")??new Set}p(t,e){return!0===this.l(t).has(e.type)||((t,e)=>{try{const e=t.detail?.restrictions?.allow?.hostnames;if(void 0!==e&&!A(e))return!0;const n=t.detail?.restrictions?.block?.hostnames;if(void 0!==n&&A(n))return!0}catch(t){return e.recordErrorEvent({id:"hostnames",error:new Error(t)}),!1}return!1})(e,t)||((t,e)=>{try{const e=t.detail?.restrictions?.allow?.dtbHostnames;if(void 0!==e&&!I(e))return!0;const n=t.detail?.restrictions?.block?.dtbHostnames;if(void 0!==n&&I(n))return!0}catch(t){return e.recordErrorEvent({id:"dtbHostnames",error:new Error(t)}),!1}return!1})(e,t)||(t=>{const e=t?.detail?.restrictions?.allow?.libraryVersions,n=t?.detail?.restrictions?.block?.libraryVersions;return!(!Array.isArray(n)||!n.includes(_))||!(!Array.isArray(e)||e.includes(_))})(e)||((t,e)=>{const n=t?.detail?.restrictions?.allow?.accounts,o=t?.detail?.restrictions?.block?.accounts;return!(!Array.isArray(o)||!o.includes(e.id))||!(!Array.isArray(n)||n.includes(e.id))})(e,t)||((t,e)=>{const n=(t=>{if(!t)return null;const e=Number(t);return!Number.isNaN(e)&&Number.isInteger(e)&&e>=0?o.ManagedWeb:o.SelfServeWeb})(e.id);if(null===n)return!1;const a=t?.detail?.restrictions?.allow?.accountTypes,i=t?.detail?.restrictions?.block?.accountTypes;return!(!Array.isArray(i)||!i.includes(n))||!(!Array.isArray(a)||a.includes(n))})(e,t)||(t=>{const e=t?.detail?.restrictions?.allow?.rate??1;return!(!j(t?.detail?.restrictions?.block?.rate??1)&&!j(e))})(e)}m(){return new h(this.globalContext,this.rootName).store.get(v)??new Map}v(t){return t.store.get("listeners")??new Map}S(t,e){return this.m().get(e.type)||this.v(t).get(e.type)}_(t){const e=this.R(w);return(void 0===t.externalEventCount||t.externalEventCount{setTimeout((()=>n(new Error(`Event "${e.type}" timed out`))),e.detail.timeout)})))}j(t,e){const n=new h(this.globalContext,this.rootName),o=n.read(t)??0;n.write(t,o+e)}$(t){new h(this.globalContext,this.rootName).write(t,0)}R(t){return new h(this.globalContext,this.rootName).read(t)??0}C(t,e,n,o,i){if(!(e in c))throw new Error(`Listener returned invalid status: ${t.type} returned ${e}`);if(this.O(t,e,o,i),e!==c.waiting&&void 0!==t.detail?.resolve)try{t.detail.resolve(n)}catch(t){x.error(t)}this.t({reason:{method:a.listenerSuccess,events:[t]}})}P(t,e,n){void 0!==e&&"string"!=typeof e||(e=new Error(e)),this.O(t,c.error,n),this.D(t,e),e.context=t.type,n.recordErrorEvent({id:t.type,analyticsSampleRateAdjustFactor:this.T(t),error:e})}N(t,e,n,o){const a=this.S(n,e);if(void 0===a)throw new Error(`No listener found for event: ${e.type}`);t.push(a({customEvent:e,account:n,systemAccount:o,detail:e.detail,context:n.globalContext}))}L(t,e,n){Promise.race(t).then((t=>{let o,a,i;void 0===t?o=s.completed:"string"==typeof t?o=t:"object"==typeof t&&(o=t.status,a=t.value,i=t.analytics,!0===e.detail?.surfaceAnalytics&&(void 0===a&&(a={}),a.analytics=i)),this.C(e,o,a,n,i)})).catch((t=>{this.P(e,t,n)}))}M(t,e,n){const o=[];this.N(o,t,e,n),this.I(o,t),this.L(o,t,e)}U(t,e){if(void 0!==t.status)return;const n=t.detail?.error;if(void 0!==n){t.status=c.error;const o=this.q(n),a={id:t.type,analyticsSampleRateAdjustFactor:this.T(t),error:o,props:{...t.detail.analytics,eventDetailSource:t.detail.source}};"string"==typeof t.detail.libraryVersion&&(a.libraryVersion=t.detail.libraryVersion),e.recordErrorEvent(a)}}q(t){let e;if(t instanceof Error)e=t;else if("string"==typeof t)e=new Error(t);else if("object"==typeof t&&null!==t){let n="Error object";if("message"in t&&"string"==typeof t.message)n=t.message;else if("error"in t&&"string"==typeof t.error)n=t.error;else try{n=JSON.stringify(t),n.length>500&&(n=n.substring(0,497)+"...")}catch{n=`Complex error object of type ${t.constructor?.name||"unknown"}`}e=new Error(n),e.originalError=t}else e=new Error(`Error value: ${String(t)}`);return e}V(t,e){if(void 0!==t.status)return;const n=t.detail?.analytics;void 0!==n&&(t.status=c.analytics,e.recordStatusChangeEvent({id:t.type,status:t.status,analyticsSampleRateAdjustFactor:this.T(t),props:{...n}}))}F(t,e){this.p(e,t)&&this.O(t,c.deactivated,e)}B(t,e){void 0===t.status&&void 0===this.S(e,t)&&this.O(t,c.unknown,e)}D(t,e){if(k()&&x.error(e),void 0!==t.detail?.reject)try{t.detail.reject(e)}catch(t){x.error(t)}}J(t,e){const n=new Error(`Invalid account ID: "${e.id}"`);this.P(t,n,e)}static H(t){return"string"==typeof t&&!["","undefined","true","false"].includes(t.trim())}G(t,e,n){D.H(e.id)?(this.U(t,e),this.V(t,e),this.B(t,e),this.F(t,e),this.A(t)&&(this.O(t,c.started,e),k()&&x.info(`## Execute event: ${t.type} with initial status ${t.status??"undefined"}`),this.M(t,e,n))):this.J(t,e)}K(t){const e=new h(this.globalContext,this.rootName).use($),n=t.use(C);e.forEach(((e,o)=>{if(n.has(o))return;const a=e.map((([t,e])=>new CustomEvent(t,{detail:e})));t.queue.unshift(...a),t.update(C,(t=>t.add(o)))}))}W(t,e,n){this.K(t),t.queue.forEach((n=>this.G(n,t,e)))}Y(t,e){t.status=e,t.statusEvents=null!=t.statusEvents?t.statusEvents:[],t.statusEvents.push(new CustomEvent(e))}T(t){if(t.detail?.analyticsSampleRateAdjustFactor)return t.detail.analyticsSampleRateAdjustFactor;const e=new h(this.globalContext,this.rootName).use(O);return e?.get(t.type)}Z(t,e,n,o){const a=new CustomEvent("now").timeStamp,i=t.statusEvents?.find((t=>t.type===c.started)),s=null!=i?a-i.timeStamp:void 0;n.recordStatusChangeEvent({id:t.type,status:e,analyticsSampleRateAdjustFactor:this.T(t),props:{...o,source:t.detail?.source,timers:{sinceCreated:a-t.timeStamp,sinceStarted:s}}})}O(t,e,n,o){t.status!==e&&(k()&&x.info(`### Update ${t.type} from ${t.status??"undefined"} to ${e}`),this.Y(t,e),this.Z(t,e,n,o))}X(){const t=new Map;return this.globalContext[this.rootName].forEach(((e,n)=>t.set(n,new m(n,{globalContext:this.globalContext,rootName:this.rootName})))),t}tt(t){if(k())return;const e=t.store.get(y)??[];if(e.length>150){const n=e.slice(-100);t.store.set(y,n)}}et(t){const e=t.store.get(y)??[];e.push(...t.queue.filter((t=>void 0!==t.status&&P.includes(t.status)))),t.store.set(y,e)}nt(t){t.queue.splice(0,t.queue.length,...t.queue.filter((t=>void 0===t.status||!P.includes(t.status))))}ot(){this.X().forEach((t=>{this.et(t),this.tt(t),this.nt(t)}))}it(t){return t?.filter((t=>t.detail?.source!==i.internal&&t.detail?.source!==i.apstag&&t.status!==c.waiting))}st(t){const e=this.it(t);return e?.length??0}rt(t){const e=this.st(t);this.j(w,e)}ct(){const t="_internal/recentDispatches";this.j(t,1);const e=this.R(t);if(e>1e4)throw new Error("Too many dispatches. Aborting");e%100==0&&new h(this.globalContext,this.rootName).recordGenericEvent({id:"C.l.D.thr",props:{recentDispatchesCount:e}}),setTimeout((()=>{this.$(t)}),100)}t({reason:t}){try{this.ct(),k()&&x.info(`# Dispatch from method "${t.method}" on event "${t.events?.[0].type??"undefined"}" with source "${t.events?.[0].detail?.source??"undefined"}"\n_________________________________________`),this.rt(t.events);const e=new h(this.globalContext,this.rootName);this.X().forEach((n=>this.W(n,e,t))),this.ot()}catch(t){throw new h(this.globalContext,this.rootName).recordErrorEvent({id:"C.l.D.dis",error:t}),t}}}class T{constructor(t,e){this.globalContext=t,this.rootName=e}subscribe(t){try{const e=new h(this.globalContext,this.rootName),n=null!=e.store.get(v)?e.store.get(v):new Map;e.store.set(v,new Map([...n,...t]))}catch(t){throw new h(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Subscriber.subscribe",error:t}),t}}}class N{constructor(t,e){this.globalContext=t,this.rootName=e}populate(){try{const t=new h(this.globalContext,this.rootName);let e=!1;try{e=JSON.parse(t.read(n))}catch{}if(e)return;t.write(n,JSON.stringify(!0)),this.populateFromPrependStore(),this.populateFromQueryParams()}catch(t){new h(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Populator.populate",error:t})}}populateFromPrependStore(){this.globalContext[this.rootName].forEach(((t,n)=>{const o=new m(n,{globalContext:this.globalContext,rootName:this.rootName}),a=o.read(e,{persist:!0})??"[]";o.write(e,JSON.stringify([]));try{const t=JSON.parse(a);if(0===t.length)return;o.queue.push(...t.map(M))}catch(t){console.error("Error processing prepended events",t)}}))}populateFromQueryParams(){const t=this.globalContext?.location?.search,e=new URLSearchParams(t),n=this.globalContext[this.rootName],o=n.get(f);L(e,"aps.trigger").forEach((t=>{o.queue.push(M(t))})),L(e,"aps.triggerFor",!0).forEach((t=>{void 0!==t.accountId&&n.has(t.accountId)&&n.get(t.accountId).queue.push(M(t))}));const a=L(e,"aps_event");n.forEach((t=>{a.forEach((e=>{t.queue.push(M(e))}))}))}}const L=(t,e,n=!1)=>{const o=t.getAll(e),a=[];return o.forEach((t=>{const e=t.split(",");let o;n&&(o=e.shift());const i=e.shift();if(void 0!==i&&i.length>0){const t=decodeURIComponent(e.join(","));let n;if(t.length>0)try{n=JSON.parse(t)}catch{console.error("Error processing query param event",i,n)}a.push({eventName:i.replace(/_/g,"/"),eventDetail:n,accountId:o})}})),a},M=t=>new CustomEvent(t.eventName,{detail:{...t.eventDetail??{}}}),U=window;class q{constructor(t,e,n){this.ID=t,this.rootName=n,this.globalContext=e,this.clear()}clear(){new h(this.globalContext,this.rootName).update($,(t=>(t.delete(this.ID),t)))}recordListener(t,e){new h(this.globalContext,this.rootName).update($,(n=>{const o=n.get(this.ID);return void 0!==o?o.push([t.name,e]):n.set(this.ID,[[t.name,e]]),n}))}}class V{constructor(t=U,e="_aps"){this.dispatcher=new D(t,e),this.equiper=new b(t,e,this.dispatcher),this.subscriber=new T(t,e),this.populator=new N(t,e),this.globalContext=t,this.rootName=e}createAccount(t){if(void 0===t)throw new Error("accountID must be provided");this.globalContext[this.rootName]=this.globalContext[this.rootName]??new Map;const e=this.globalContext[this.rootName],n={store:new Map,queue:[]};return!1===e.has(t)&&e.set(t,n),new m(t,{globalContext:this.globalContext,rootName:this.rootName})}subscribe(t){this.subscriber.subscribe(t)}equip(){this.equiper.equip()}dispatch({reason:t}){this.dispatcher.t({reason:t})}populate(){this.populator.populate()}load({listeners:t}){this.equip(),this.subscribe(t),this.dispatch({reason:{method:a.direct}}),this.populate()}registerEventSource(t){return this.equip(),new q(t,this.globalContext,this.rootName)}}var F;!function(t){t.postulate="postulate",t.genericError="error"}(F||(F={}));const z="26.331.1504";function B(t,e,n){const o=new URL("https://prod.tahoe-analytics.publishers.advertising.a2z.com/logevent/putRecord");let a=t;try{"web-client-scenarios.aps.amazon.dev"===n?.hostname?a=t+"-debug-only":window.Cypress&&(a=t+"-integration-test")}catch(t){}const i={...n,eventSource:"aps_web_client_library",eventCategory:a,eventName:e,libraryVersion:z};Object.entries(i).forEach((([t,e])=>{o.searchParams.append(t,e)})),fetch(o.toString(),{method:"GET",keepalive:!0,headers:{"x-api-key":"79db72eb0b5c7255afa54a253df24fb4a5ac916bf40b51c730df8850aa5665ca"}}).catch((()=>{}))}const J={lt:setInterval,ut:function(){return window[H]?.[G]},ft:function(t=window){try{return t.top?.location||{href:"unknown",hostname:"unknown"}}catch(t){return{href:"unknown",hostname:"unknown"}}},ht:B,vt:function(t,e){return{eventTime:K((()=>`${Date.now()}`)),accountID:K((()=>t?.accountID)),libraryVersion:z,url:K((()=>e().href)),hostname:K((()=>e().hostname)),message:K((()=>t?.message)),condition:K((()=>t?.condition))}},yt:function(t,e){try{(e??B)(F.genericError,"telemetry_core_failure",{errorName:t?.name??"unknown",errorMessage:t?.message??"unknown"})}catch{(e??B)(F.genericError,"telemetry_core_failure")}}},H="_aps_telemetry",G="alarms";function K(t){try{return t()??"undefined"}catch(t){return function(t){try{return t instanceof Error?`Access Error: ${t.name} - ${t.message}`:"Access Error: Unknown error type"}catch{return"Access Error: Unable to provide more information"}}(t)}}function W(t,e,n){const o=()=>!1;throw n||function(t,e,n){const o=window;void 0===o[H]&&(o[H]={}),void 0===o[H][G]&&(o[H][G]=[]);const a=o[H][G],i=e.toString();a.push({hash:t,context:{...n,condition:i}})}(t,o,e),new Error(e?.message??`Postulate violation: ${t}, ${o}`)}const Q=new WeakMap;function Y({debugKey:t,obj:e,validators:n,root:o,separator:a}){o=o??"root",a=a??".";const i={nonModifiable:{set(t,e){throw new Error(`Cannot set property "${String(e)}": "${o}" is not marked as modifiable.`)},deleteProperty(t,e){throw new Error(`Cannot delete property "${String(e)}": "${o}" is not marked as modifiable.`)},defineProperty(t,e){throw new Error(`Cannot define property "${String(e)}": "${o}" is not marked as modifiable.`)},setPrototypeOf(t){throw new Error(`Cannot set prototype: "${o}" is not marked as modifiable.`)}},modifiable:{set(t,e,n,o){try{return Reflect.set(t,e,n,o)}catch(o){if("TypeError"===o.name)return t[e]=n,!0;throw o}}},validating:{get(e,i,s){if("raw"===i)return Q.get(s)||e;if("symbol"==typeof i)return Reflect.get(e,i,s);if((t=>{if(["asymmetricMatch","nodeType"].includes(t))return!0})(i))return Reflect.get(e,i,s);let r;try{r=Reflect.get(e,i,s)}catch(t){if("TypeError"!==t.name)throw t;r=e[i]}return Y({obj:r,validators:n,root:`${o}${a}${String(i)}`,debugKey:t})},ownKeys:t=>Reflect.ownKeys(t).filter((t=>{const e=`${o}${a}${String(t)}`;return void 0!==n[e]}))},function:{apply:(e,a,i)=>{const s=Q.has(a)?Q.get(a):a;return Y({obj:e.apply(s,i),validators:n,root:`${o}()`,debugKey:t})},get:(t,e,n)=>"raw"===e?Q.get(n)||t:Reflect.get(t,e,n)}},s=function(a){if(!1===a.verifiable)return e;if(e instanceof Set)return e.forEach((e=>{Y({obj:e,validators:n,root:`${o}.value`,debugKey:t})})),e;if(e instanceof Map)return e.forEach(((e,a)=>{Y({obj:a,validators:n,root:`${o}.key`,debugKey:t}),Y({obj:e,validators:n,root:`${o}.value`,debugKey:t})})),e;if(Array.isArray(e))return e.map((e=>Y({obj:e,validators:n,root:`${o}[]`,debugKey:t})));if("function"==typeof e){const t=new Proxy(e,i.function);return Q.set(t,e),t}const s={...i.validating,...a?.modifiable?i.modifiable:i.nonModifiable};try{const t=new Proxy(e,s);return Q.set(t,e),t}catch(t){if("TypeError"===t.name)return e;throw t}}(function(){const a=(t??"").length>0?`Location: ${t} - `:"",i=n[o??""];if(void 0===i){const t=".constructor"===(o??"").slice(-12)||".toString"===(o??"").slice(-9);W("ea3914",{message:`${a}Unauthorized usage for "${o}": No validator has been defined`},t)}if(null===i)return{verifiable:!1};let s;try{s=i(e,o)}catch(t){let n="Error, could not convert to string";try{n="string"==typeof e?'"'+e+'"':null!=e&&"function"==typeof e.toString?e.toString():Object.prototype.toString.call(e)}catch(t){}throw new Error(`${a}Validation failed for "${o}": ${t.message} - Received: ${n}`)}return s??{}}());return s}const Z=t=>{if("number"!=typeof t)throw new Error("must be a number")},X=t=>{if("string"!=typeof t)throw new Error("must be a string")},tt=t=>{if("boolean"!=typeof t)throw new Error("must be a boolean")},et=t=>{if("object"!=typeof t||null===t||Array.isArray(t))throw new Error("must be a standard object")};function nt(t){if(void 0!==t?.min&&(t.min<0||t.min>1))throw new Error("min option must be between 0 and 1");if(void 0!==t?.max&&(t.max<0||t.max>1))throw new Error("max option must be between 0 and 1");const e=t?.min??0,n=t?.max??1;if(e>n)throw new Error("min option cannot be greater than max option");return t=>{if("number"!=typeof t)throw new Error("must be a number");if(tn)throw new Error(`must be a percentage between ${e} and ${n} (where 1 = 100%)`)}}const ot=t=>e=>{let n=!1;for(const o of t)try{o(e),n=!0}catch(t){}if(!n)throw new Error("None of the validators passed")},at=t=>{if(!Array.isArray(t))throw new Error("must be an array")};function it(t){return e=>{if(!1===t.includes(e))throw new Error(`must be one of the following values: ${JSON.stringify(t)}`)}}function st(t){return(e,n)=>({modifiable:!0,...t(e,n)})}function rt(t){return(e,n)=>{if(t===dt)throw new Error("isAny cannot be used within isOptional");if(null!=e)return t(e,n)}}const ct=t=>{if("function"!=typeof t)throw new Error("must be a function")},dt=()=>{},lt=()=>({verifiable:!1}),ut=t=>{if(void 0!==t)throw new Error("must be undefined")};class pt{constructor(t){const{scope:e,object:n,action:o,validators:a,handler:i}=t,s=`${e}/${n}/${o}`;this.throwIfInvalid(e,n,o),this.name=`${e}/${n}/${o}`,this.handler=this.wrapHandler({handler:i,validators:a,debugKey:s})}wrapHandler({debugKey:t,handler:e,validators:n}){return async o=>{let a=o;return a={...a,detail:Y({obj:a.customEvent.detail,validators:this.getDetailValidators(n),root:"detail",debugKey:t}),context:Y({obj:a.account.globalContext,validators:this.getContextValidators(n),root:"context",debugKey:t})},await e(a)}}getDetailValidators(t){return t?.detail&&0!==Object.keys(t.detail).length?t.detail:{detail:dt}}getContextValidators(t){return t?.context&&0!==Object.keys(t.context).length?t.context:{context:dt}}throwIfInvalid(t,e,n){if(["consent/gppapi/attemptSync","consent/gppapi/didChange","consent/gppapi/syncData","consent/tcfapi/attemptSync","consent/tcfapi/didChange","log/analytics/setInterval","analytics/sampling/set"].includes(`${t}/${e}/${n}`))return;const o=/^[a-z0-9][a-zA-Z0-9]*$/;if(!o.test(t)||!o.test(e)||!o.test(n))throw new Error(`scope, object, and action must be alphanumeric and start with a lowercase. Received: ${t}, ${e}, ${n}`);if(/[A-Z]/.test(n)&&!/^(will|did)/i.test(n))throw new Error(`action must be a single verb (or a single verb prefixed by 'will' or 'did'). Received: ${n}`)}}function mt(t){if(new Set(t.map((t=>t.name))).size!==t.length)throw new Error("Duplicates found");return new Map(t.map((t=>[t.name,t.handler])))}class ft{constructor(){this.gt=300,this.wt="https://prod.tahoe-analytics.publishers.advertising.a2z.com/logevent/putRecords",this.bt="79db72eb0b5c7255afa54a253df24fb4a5ac916bf40b51c730df8850aa5665ca",this.Et=5e3,this.St=[],this.clearAndUpdateEventProcessingInterval(5e3)}logEvent(t){try{const n=`${Date.now()}`,o=null==(e=t.eventSampleRate)||isNaN(e)||e<0?0:e>=0&&e<=1?e:1,a={Data:{eventSource:"aps_web_client_library",eventTime:n,eventCategory:t.eventCategory,eventName:t.eventName,eventSampleRate:o,eventProperties:{...t.eventProperties,eventSampleRate:`${o}`}},PartitionKey:n};this.St.push(a)}catch(t){W("4daf34",{message:t.message})}var e;this.St.length>this.Et&&this.safelyProcessRecordQueue()}clearAndUpdateEventProcessingInterval(t){"number"!=typeof t||t<=0||t!==this.xt&&(clearInterval(this._t),this._t=setInterval((()=>this.safelyProcessRecordQueue()),t),this.xt=t)}safelyProcessRecordQueue(){if(void 0===this.St||this.St.length<=0)return;const t=this.St.filter((t=>void 0!==t&&t.Data.eventSampleRate>=Math.random()));this.St.length=0,t.length<=0||this.batchSendRecords(t).catch((t=>{this.logEvent({eventCategory:"error",eventName:"tahoe/putRecords/didFail",eventSampleRate:1,eventProperties:{error:{message:t?.message}}})}))}batchSendRecords(t){const e=[];for(let n=0;nt.map((t=>({...t,Data:window.btoa(JSON.stringify(t.Data))}))))(t)})})}}const ht={key:"_config/requestViewer/countryCode",default:"unknown"},vt={key:"video/analytics",default:void 0},yt=new class{constructor(){this.STACK_MAX_LENGTH=500,this.Rt=.001,this.At=1e-4,this.It=new ft}getVideoPlayerMetadata(t){const e=t.account?.use(vt,{structuredClone:!1}),n="object"==typeof t.props?.legacyPlayerEventProps;return e?.getMetadata&&!n?{legacyPlayerEventProps:e.getMetadata()}:{}}fireReferencePixel(t,e){this.logCoreError({id:`REFERENCE-${t}`,error:new Error(`REFERENCE-${t}`),analyticsSampleRateAdjustFactor:e??{status:.01,error:.01},account:null})}logCoreError(t){this.logError({...t,isCore:!0})}logCoreFeature(t){this.logFeature({...t,isCore:!0})}logError(t){if(void 0===t)return;const e=this.getEventSampleRate({eventCategory:"error",rateFactor:{error:t.analyticsSampleRateAdjustFactor?.error,status:t.analyticsSampleRateAdjustFactor?.status}});this.It.logEvent({eventCategory:"error",eventName:t.id??"unknown",eventSampleRate:e,eventProperties:{...t.props,...this.getSharedEventProperties(t),error:{name:this.getErrorName(t.error),message:this.getErrorMessage(t.error),stack:this.getStackTraceMessage(t.error),context:this.getErrorContext(t.error)}}})}logFeature(t){if(void 0===t)return;const e=this.getEventSampleRate({eventCategory:"feat",rateFactor:{error:t.analyticsSampleRateAdjustFactor?.error,status:t.analyticsSampleRateAdjustFactor?.status}});this.It.logEvent({eventCategory:"feat",eventName:t.id??"unknown",eventSampleRate:e,eventProperties:{...t.props,...this.getSharedEventProperties(t),status:t.feature}})}setEventProcessingInterval(t){if("number"!=typeof t)throw new Error("Event processing interval must be a number.");this.It.clearAndUpdateEventProcessingInterval(t)}setEventSamplingRates(t){const e=t=>t<0?0:t>=0&&t<=1?t:1;"number"==typeof t?.error&&(this.Rt=e(t.error)),"number"==typeof t?.feature&&(this.At=e(t.feature))}getEventSampleRate(t){let e=0;return e="error"===t.eventCategory?this.Rt*(t.rateFactor?.error??1):this.At*(t.rateFactor?.status??1),Number.isNaN(e)||e<0?0:e>=0&&e<=1?e:1}getSharedEventProperties(t){return{isCore:t.isCore??!1,accountID:this.safelyGetAccountID(t.account),libraryVersion:t.libraryVersion??_,url:this.getLocationHref(),hostname:this.getLocationHostname(),viewerCountryCode:this.getViewerCountryCode(t.account),...this.getVideoPlayerMetadata(t)}}safelyGetAccountID(t){let e="unknown";try{void 0!==t?.id&&(e=t.id)}catch(t){try{e=`Client Error: ${t.name.toString()} - ${t.message}`}catch{e="Client Error: Unable to provide more information"}}return e}getLocationHref(){let t="";try{t=window.top?.location?.href??""}catch(e){try{t=`Client Error: ${e.name.toString()} - ${e.message}`}catch{t="Client Error: Unable to provide more information"}}return t}getLocationHostname(){let t="";try{t=window.top?.location?.hostname??""}catch(e){try{t=`Client Error: ${e.name.toString()} - ${e.message}`}catch{t="Client Error: Unable to provide more information"}}return t}getViewerCountryCode(t){let e="unknown";try{null!==t&&(e=t.use(ht))}catch(t){try{e=`Client Error: ${t.name.toString()} - ${t.message}`}catch{e="Client Error: Unable to provide more information"}}return e}getStackTraceMessage(t){try{if("string"==typeof t)return"NO STACK: ERROR PASSED AS STRING";if(void 0===t.stack)return"NO STACK: error.stack IS UNDEFINED";if(t.stack.length>this.STACK_MAX_LENGTH){const e="[...]";return t.stack.substring(0,this.STACK_MAX_LENGTH-e.length)+e}return t.stack}catch(t){return"NO STACK: ERROR ON RETRIEVAL"}}getErrorName(t){let e="unknown";try{"string"==typeof t?e=t:void 0!==t.name&&(e=t.name)}catch(t){try{e=`Client Error: ${t.name.toString()} - ${t.message}`}catch{e="Client Error: Unable to provide more information"}}return e}getErrorMessage(t){let e="unknown";try{"string"==typeof t?e=t:void 0!==t.message&&(e=t.message)}catch(t){try{e=`Client Error: ${t.name.toString()} - ${t.message}`}catch{e="Client Error: Unable to provide more information"}}return e}getErrorContext(t){let e="unknown";try{"string"!=typeof t&&"context"in t&&(e=t.context??"")}catch(t){try{e=`Client Error: ${t.name.toString()} - ${t.message}`}catch{e="Client Error: Unable to provide more information"}}return e}},gt=new Map([["_config/config/didLoad",async({account:t,customEvent:e})=>(t.write("config/loaded",!0),s.completed)],["_config/requestViewerCountry/define",async({account:t,customEvent:e})=>{if(void 0===e.detail?.code)throw new Error("Missing country code");const{code:n}=e.detail;if("string"!=typeof n||0===n.trim().length)throw new Error(`Invalid country code: "${n}"`);return t.update(ht,(()=>n)),s.completed}]]),wt="apstag/configuration/fetch",bt=new Map([[wt,async({account:t,customEvent:e})=>{const n=t.globalContext.document.createElement("script");return n.setAttribute("src",`https://config.aps.amazon-adsystem.com/configs/${t.id}`),n.setAttribute("type","text/javascript"),n.setAttribute("async","async"),t.globalContext.document.head.appendChild(n),await new Promise(((t,e)=>{n.addEventListener("load",(()=>{t()})),n.addEventListener("error",(t=>{e(t)}))})),s.completed}]]),Et="consent/GPPData",St="consent/isGPPListenerRegistered";var xt=new pt({scope:"consent",object:"gppapi",action:"syncData",validators:{detail:{detail:et,"detail.fromAddEvent":rt(tt),"detail.eventListener":rt(et),"detail.eventListener.pingData":rt(et),"detail.eventListener.pingData.gppString":rt(X),"detail.eventListener.pingData.gppVersion":rt(ot([X,Z])),"detail.eventListener.pingData.cmpId":rt(ot([X,Z])),"detail.eventListener.pingData.applicableSections":at,"detail.eventListener.pingData.applicableSections[]":ot([X,Z])}},handler:async({account:t,detail:e})=>{let n,o,a,i;(e?.eventListener?.pingData?.gppString??"").length>0?(n=e?.eventListener?.pingData,i="addEventListener"):([n,a]=(t=>{let e,n;try{const n=t.globalContext.__gpp("ping",((t,n)=>{n&&"object"==typeof t&&(e=t)}));void 0===e&&(n?.gppString??"").length>0&&(e=n)}catch(t){n=`E:ping: ${t}`}return[e,n]})(t),i="ping","object"!=typeof n&&([n,o]=(t=>{let e,n;try{const n=t.globalContext.__gpp("getGPPData");e={...n,...n.pingData}}catch(t){n=`E:getGPPData: ${t}`}return[e,n]})(t),i="getGPPData"));const r={gpp:{gppLength:"string"==typeof n?.gppString?n.gppString.length:void 0,isGPPTilde:(n?.gppString??"").includes("~"),error10:o,error:a,gppVersion:n?.gppVersion,cmpId:n?.cmpId,method:i,fromAddEvent:e?.fromAddEvent}};return t.write(Et,n),{status:s.completed,analytics:r}}}),_t=new pt({scope:"consent",object:"gppapi",action:"didChange",validators:{detail:{detail:et,"detail.fromAddEvent":rt(tt),"detail.eventListener":rt(et),"detail.eventListener.pingData":rt(et),"detail.eventListener.pingData.gppString":rt(X),"detail.eventListener.pingData.gppVersion":rt(ot([X,Z])),"detail.eventListener.pingData.cmpId":rt(ot([X,Z])),"detail.eventListener.pingData.applicableSections":at,"detail.eventListener.pingData.applicableSections[]":ot([X,Z])}},handler:async({account:t,detail:{eventListener:e,fromAddEvent:n}})=>(await t.recordListener(xt,{eventListener:e,fromAddEvent:n}),{status:s.completed})}),Rt=new pt({scope:"consent",object:"gppapi",action:"attemptSync",handler:async({account:t})=>{if(void 0===t.globalContext.__gpp||!0===t.read(St))return{status:s.cancelled};await t.recordListener(xt);const e=t.globalContext.__gpp("addEventListener",(e=>{"error"!==e?.eventName&&t.recordListenerNonBlocking(_t,{eventListener:e,fromAddEvent:!0})}));return t.write(St,"listenerRegistered"===e?.eventName&&!0===e?.data),{status:s.completed}}});const At={key:"consent/isTCFAPIListenerRegistered",default:!1},It={key:"consent/TCData",default:void 0};function jt(t,e){return"string"==typeof e?.tcString&&e?.tcString.length>0||!0===t?.globalContext?.apstag?.isGDPRRegion||!0===e?.gdprApplies}function kt(t,e){return!0===t.vendor?.consents?.[793]&&(n=e,o=t.purpose?.consents,(n??[]).reduce(((t,e)=>t&&!0===o?.[e]),!0));var n,o}var $t=new pt({scope:"consent",object:"tcfapi",action:"didChange",validators:{detail:{detail:et,"detail.success":rt(tt),"detail.tcData":rt(lt)}},handler:async({account:t,detail:{success:e,tcData:n}})=>(t.update(At,(t=>t||!0===e)),t.update(It,(t=>void 0!==n||!0===e?n:t)),"object"!=typeof n?{status:s.completed}:{status:s.completed,analytics:Ct(t,n)})});const Ct=(t,e)=>{const n={tcData:e,consents:[1]},o=t=>{try{return t()}catch{return"error"}};return{tcT:o((()=>t.isAPStagAllowedToAccessInfoOnDevice())),tcCC:o((()=>function({account:t,tcData:e,consents:n}){if(!jt(t,e))return!0;if("object"!=typeof e)return!1;if((e.tcfPolicyVersion??0)<2)return!1;if(e.useNonStandardStacks)return!1;if(!e.isServiceSpecific)return!1;let o=!1;return n.forEach((t=>{const a=e.publisher?.restrictions?.[t]?.[793];switch(a){case 0:case 2:o=!0;break;default:kt(e,n)||(o=!0)}})),!o}({...n,account:t}))),tcCF:o((()=>0===function({tcData:t,consents:e}){if(0===(e??[]).length)return["No consents param passed"];const n=[];try{if("object"!=typeof t){let e="";try{e=JSON.stringify(t)}catch{}n.push(`Invalid tcData: ${e}`)}return!1===t.gdprApplies?[]:((t.tcfPolicyVersion??0)<2&&n.push(`tcData version not supported: ${t.tcfPolicyVersion}`),t.useNonStandardStacks&&n.push("tcData's useNonStandardStacks should not be true"),t.isServiceSpecific||n.push("tcData needs to be service specific"),e.forEach((o=>{const a=t.publisher?.restrictions?.[o]?.[793];switch(a){case 0:n.push(`Invalid publisher restrictions 0, consent ${o}`);break;case 2:n.push(`Invalid publisher restrictions 2, consent ${o}`);break;default:kt(t,e)||n.push(`Invalid publisher restrictions default, consent ${o}`)}})),n)}catch(t){if(n.length>0)return n;throw t}}(n).length)),PRA:o((()=>jt(t,e)))}};var Ot=new pt({scope:"consent",object:"tcfapi",action:"attemptSync",handler:async({account:t})=>{const e=t.use(At);return void 0===t.globalContext.__tcfapi||e?{status:s.cancelled}:(t.globalContext.__tcfapi("addEventListener",2,((e,n)=>{t.recordListenerNonBlocking($t,{tcData:e,success:n})})),{status:s.completed})}});const Pt=mt([Rt,_t,xt,Ot,$t]),Dt="vnd_prx_segments",Tt="aps_targeting_comscore";var Nt=new pt({scope:"cxm",object:"comscore",action:"set",handler:async({account:t,customEvent:e})=>({status:Lt(t)})});const Lt=t=>{const e=t.readSessionStorage(Tt);if(t.deleteSessionStorage(Tt),null==e)return s.cancelled;try{const n=JSON.parse(e)[Dt];if(null==n)throw new Error;const{googletag:o}=t.globalContext;return o.pubads().getSlots().forEach((t=>{t.setTargeting(Dt,n)})),s.completed}catch(t){throw new Error(`Malformed targeting object at ${Tt}`)}},Mt="aps_targeting_ias";var Ut=new pt({scope:"cxm",object:"ias",action:"set",handler:async({account:t,customEvent:e})=>({status:qt(t)})});const qt=t=>{const e=(t=>{const{iasApsArtifact:e}=t.globalContext;if(e)return e;const n=t.readSessionStorage(Mt);return n?(t.deleteSessionStorage(Mt),JSON.parse(n)):void 0})(t);if(null==e)return s.cancelled;try{const{googletag:n}=t.globalContext;n.pubads().getSlots().forEach((t=>{const n=e.targeting.slots[t.getSlotElementId()];null!=n&&Object.keys(n).forEach((e=>{t.setTargeting(e,n[e])}))}));const{brandSafety:o,fr:a,custom:i}=e.targeting;return null!=o&&Object.keys(o).forEach((t=>{n.pubads().setTargeting(t,o[t])})),null!=i&&Object.keys(i).forEach((t=>{const e=i[t];n.cmd.push((()=>n.pubads().setTargeting(t,e)))})),null!=a&&n.pubads().setTargeting("fr",a),s.completed}catch(t){throw new Error(`Malformed targeting object at ${Mt}`)}},Vt="aps_targeting_illuma";var Ft=new pt({scope:"cxm",object:"illuma",action:"set",handler:async({account:t,customEvent:e})=>({status:zt(t)})});const zt=t=>{const e=t.readSessionStorage(Vt);if(t.deleteSessionStorage(Vt),null==e)return s.cancelled;const n=JSON.parse(e).results;if(null==n)throw new Error(`Malformed targeting object at ${Vt}`);const{googletag:o}=t.globalContext;return Object.keys(n).forEach((t=>{const e=n[t];o.pubads().setTargeting(`illuma_${t}`,JSON.stringify(e))})),s.completed};var Bt=new pt({scope:"cxm",object:"contextual",action:"set",handler:async({account:t,customEvent:e})=>(await Promise.all([t.recordListener(Nt),t.recordListener(Ut),t.recordListener(Ft)]),{status:s.completed})});const Jt=mt([Nt,Bt,Ut,Ft]),Ht={key:"customPlacement/hints",default:{}},Gt={key:"customPlacement/bidResponses",default:{}};class Kt{constructor(t,e,n){this.CLICK_PREFIX_MACRO="%%CLICK_URL_PREFIX%%",this.PROGRAM_CUSTOM_PLACEMENTS="customPlacements",this.getPageStyles=(t=["p","h1","h2"])=>t.map(this.getTagStyle).filter((t=>Object.keys(t).length>0)).reduce(((t,e)=>({...t,...e})),{}),this.getContainerStyles=t=>{try{if(!t)return{};const e=window.getComputedStyle(t),n="--aps-custom-container-",o=new Map;return o.set(`${n}width`,e.width),o.set(`${n}margin`,e.margin),o.set(`${n}padding`,e.padding),Object.fromEntries(o.entries())}catch(t){return{}}},this.slotProps=t,this.rawResponse=e,this.jt=n}getTagStyle(t){const e=this.jt.getElementsByTagName(t);if(e&&e[0]){const e=window.getComputedStyle(this.jt.getElementsByTagName(t)[0]),n=new Map,o="--aps-custom-page-";return n.set(`${o}${t}-color`,e.color),n.set(`${o}${t}-fontFamily`,e.fontFamily),n.set(`${o}${t}-fontSize`,e.fontSize),n.set(`${o}${t}-fontWeight`,e.fontWeight),n.set(`${o}${t}-lineHeight`,e.lineHeight),Object.fromEntries(n)}return{}}getDynamicFrameBodyHeight(t,e,n){if(e){const n=e?.contentDocument||e?.contentWindow?.document,o=n?.body.scrollHeight;e.style.height=`${o}px`;try{const e={...this.getPageStyles(),...this.getContainerStyles(t)};Object.keys(e).forEach((t=>{n?.documentElement.style.setProperty(t,e[t])}))}catch(t){}}}render(t){return this.kt(t)}kt(t){if(!this.rawResponse||!this.slotProps)return!1;try{const e=this.rawResponse.size.split("x"),n=this.rawResponse.targeting?.amzniid||this.rawResponse.amzniid,o=this.rawResponse.targeting?.amznadm||this.rawResponse.amznadm;if(!n)return!1;let a=this.slotProps.$t;if(this.slotProps.location&&this.slotProps.id){const t=this.jt.createElement("div");this.jt.getElementById(this.slotProps.id)?.insertAdjacentElement(this.slotProps.location,t),a=t}if(!a)return!1;const i=this.jt.createElement("iframe");return i.style.marginLeft="0",i.style.marginTop="0",i.style.height=`${e[1]}px`,i.style.width="100%",i.setAttribute("data-testid","amzn-asr-ad"),i.setAttribute("scrolling","no"),i.setAttribute("frameborder","0"),i.onload=()=>this.getDynamicFrameBodyHeight(a,i,o?"amznadm":"admi"),i.srcdoc=o||"",t&&t.clickPrefix&&(i.srcdoc=i.srcdoc.replace(this.CLICK_PREFIX_MACRO,t.clickPrefix)),a.appendChild(i),this.updateSlotAttribute("status","rendered"),!0}catch(t){throw new Error("CustomPlacements: Error while rendering")}}updateSlotAttribute(t,e){this.slotProps.$t?.setAttribute(`data-aps-custom-${t}`,e)}}const Wt={key:"customPlacement/timings",default:[]},Qt=(t,e,n=0,o=0)=>{try{const a={effectiveType:e?.effectiveType,rtt:e?.rtt,downlink:e?.downlink},i=function(t,e,n){try{return`${isNaN(e)||0===e?t.body.clientWidth:e}x${isNaN(n)||0===n?t.body.clientHeight:n}`}catch(t){}return"x"}(t,n,o);return{connection:a,screen:i}}catch(t){return{}}},Yt=(t,e,n)=>{t.update(Wt,(t=>(t.push({time:performance.now(),key:`${e}/${n}`}),t)))},Zt="customPlacements";var Xt=new pt({scope:"customPlacement",object:"hint",action:"process",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{const o=e=>{Yt(t,Zt,`hint/process/${e}`);const n=t.use(Ht),o=t.use(Gt);n[e].isRendered||(Object.values(o).forEach((o=>{if(o.isRendered)return;const a=t.globalContext.document.getElementById(e);if(null==a)return;const i=new Kt({id:e,$t:a},o,t.globalContext.document);Yt(t,Zt,`widget/render/${e}`),i.render(n[e].hintMetadata)&&(o.isRendered=!0,n[e].isRendered=!0)})),t.update(Ht,(()=>n)),t.update(Gt,(()=>o)))},a=t.use(Ht);return Object.keys(a).filter((t=>a[t].default)).forEach(o),Object.keys(a).filter((t=>!a[t].default)).forEach(o),{status:s.completed,analytics:{browserInfo:Qt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}}),te=new pt({scope:"customPlacement",object:"hint",action:"define",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{if(void 0===n.detail?.id)throw new Error("Hint `id` must be defined");const{id:o,isDefault:a,hintMetadata:i}=n.detail;Yt(t,Zt,`hint/define/${o}`);const r=t.use(Ht);return r[o]={default:"default"===a,isRendered:!1,hintMetadata:i??{}},t.update(Ht,(()=>r)),t.recordListenerNonBlocking(Xt),{status:s.completed,analytics:{browserInfo:Qt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}});const ee={key:"customPlacement/placementResponseDispatched",default:!1},ne={key:"customPlacement/placementResponse",default:void 0},oe={key:"customPlacement/contextURL",default:void 0},ae={key:"customPlacement/placementEndpoint",default:"https://c.aps.amazon-adsystem.com/e/placements"},ie={key:"ad/context",default:void 0};var se=new pt({scope:"customPlacement",object:"placement",action:"fetch",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{Yt(t,Zt,"placementFetch/start");const o=await async function(t){const e={ortb2:re(t)},n=t.use(oe),o=t.use(ae),a=function(t,e){try{const n=e??function(t){try{if(void 0!==t.globalContext.top?.location.href)return t.globalContext.top?.location.href}catch(t){}try{if(t.globalContext.top!==t.globalContext.self)return t.globalContext.document.referrer}catch(t){}}(t);if(void 0!==n)return encodeURIComponent(n)}catch(t){}return""}(t,n),i=encodeURIComponent(JSON.stringify(e)),s=await fetch(`${o}?account=${t.id}&u=${a}&sg=${i}`);return await s.json()}(t);return Yt(t,Zt,"placementFetch/end"),{status:s.completed,value:{placementResponse:o},analytics:{browserInfo:Qt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}});function re(t){const e=t.use(ie);if(void 0!==e&&"user"in e){const{user:t,...n}=e;return n}return e}const ce={key:"customPlacement/bidEndpoint",default:"c.aps.amazon-adsystem.com"},de={key:"customPlacement/bidIsKey",default:"86355855cc6ed9e335d0382c8563aa10"};var le=new pt({scope:"customPlacement",object:"bids",action:"fetch",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{const o=Qt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight);if(void 0===t.globalContext.apstag?.clientFetchBids)return{status:s.waiting,analytics:{browserInfo:o}};Yt(t,Zt,"fetchBids/start");const a=await async function(t){const e={slots:[{slotID:"93b7dd52-a8ce-11ed-afa1-0242ac120002:1",sizes:[[999,999]]}],timeout:6e4,_endpointDomain:t.use(ce),params:{program:"apscustom",is:t.use(de)}},n={pubID:t.id,isSelfServePub:36===t.id.length,deals:!0},o=t.use(oe);return await new Promise((a=>{t.globalContext.apstag?.clientFetchBids(e,(t=>{a(t)}),{initConfig:n,contextURL:o})}))}(t);return Yt(t,Zt,"fetchBids/end"),{status:s.completed,value:{bidResponses:a},analytics:{browserInfo:o}}}}),ue=new pt({scope:"customPlacement",object:"service",action:"enable",validators:{},handler:async({account:t,detail:e,customEvent:n})=>(Yt(t,Zt,"service/enable"),t.update(ee,(()=>!1)),await Promise.all([t.recordListener(se).then((({placementResponse:e})=>{pe(t,!0,e),t.update(ne,(()=>e))})),t.recordListener(le).then((({bidResponses:e})=>{e.forEach((e=>{const n=e.targeting?.amzniid??e.amzniid;let o=!1;if(""!==n){const a=t.use(Gt);a[n]=e,t.update(Gt,(()=>a)),o=!0}pe(t,!1,{aps:[{active:o,dispatchEventOnValidBid:!0}]})}))})).then((()=>{t.recordListenerNonBlocking(Xt)}))]),{status:s.completed,analytics:{browserInfo:Qt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}})});function pe(t,e,n){if(t.use(ee))return;const o=n?.aps?.find((t=>t.dispatchEventOnValidBid));e&&void 0!==o||(Yt(t,Zt,"placementResponseEvent/dispatch"),t.record("customPlacement/placement/didRespond",n).catch((t=>{})),t.update(ee,(()=>!0)))}const me=new Map([...mt([te,le,Xt,ue,se])]),fe={key:"ortbVendors/vm",default:{}},he="anonymised";var ve=new pt({scope:"ortbVendors",object:"anonymised",action:"set",handler:async({account:t})=>{const e=function(t){const e=t.readLocalStorage("cohort_ids");if("string"==typeof e){const t=JSON.parse(e);let n="";for(let e=0;e({...t,[he]:e}))),{status:s.completed})}}),ye=new pt({scope:"ortbVendors",object:"arcspan",action:"set",handler:async({account:t})=>{const e=function(t){const e=t.globalContext[ge],n=t.globalContext[we];let o=[],a=[],i=[];if(void 0!==e){if(void 0!==e.page_iab_codes.text&&(o=o.concat(e.page_iab_codes.text)),void 0!==e.page_iab_codes.images&&(o=o.concat(e.page_iab_codes.images)),void 0!==e.page_keywords){const t="string"==typeof e.page_keywords?e.page_keywords.split(","):e.page_keywords;i=i.concat(t),void 0!==n?.compcohorts&&(i=i.concat(n.compcohorts))}void 0!==e.page_iab_newcodes.text&&(a=[...new Set([...a,...e.page_iab_newcodes.text])]),void 0!==e.page_iab_newcodes.images&&(a=[...new Set([...a,...e.page_iab_newcodes.images])]);const s={name:"arcspan",segment:[],ext:{segtax:6}};a.forEach((function(t){s.segment=s.segment.concat({id:t})}));const r={data:[]};return r.data=r.data.concat(s),{data:{default:{site:{name:"arcspan",cat:o,sectioncat:o,pagecat:o,keywords:i.toString(),content:r,domain:new URL(t.globalContext.location.href).hostname,page:t.globalContext.location.href,ref:t.globalContext.document.referrer}}}}}}(t);return void 0===e?{status:s.cancelled}:(t.update(fe,(t=>({...t,arcspan:e}))),{status:s.completed})}});const ge="arcobj1",we="arcobj2",be={key:"idVendors/ids",default:void 0},Ee={key:"idVendors/metadata",default:void 0};function Se(t,e){const n=t(e);return null!=n?(e.update(be,(t=>({...t,...n}))),{status:s.completed}):{status:s.cancelled}}class xe{constructor(t){return this.parser=null,this.keys=null,this.account=null,this.read=t=>null,this.anyAttributesMissing=()=>[this.parser,this.keys,this.account,this.egressNodeKey,this.read].some((t=>null==t)),this.egressNodeKey=t,this}using(t){return this.parser=t,this}fromCookieKeys(t){return this.keys=t,this.read=t=>this.account?.readCookieStorage(t),this}fromLocalStorageKeys(t){return this.keys=t,this.read=t=>this.account?.readLocalStorage(t),this}fromCookieOrLocalStorageKeys(t){return this.keys=t,this.read=t=>this.account?.readCookieStorage(t)??this.account?.readLocalStorage(t),this}fromLocalStorageOrCookieKeys(t){return this.keys=t,this.read=t=>this.account?.readLocalStorage(t)??this.account?.readCookieStorage(t),this}forAccount(t){return this.account=t,this}getRunner(){if(this.anyAttributesMissing())throw new Error("Missing attribute(s) - unable to return a runner.");return()=>{if(this.anyAttributesMissing())throw new Error("Missing attribute(s) - runner execution failed.");for(const t of this.keys){const e=this.parser(this.read(t));if(null!=e)return{[this.egressNodeKey]:e}}return null}}}const _e=function(t){return"string"==typeof t?t:null},Re=function(t){return"string"==typeof t?atob(t):null};function Ae(t){return function(e){return"string"==typeof e?t(JSON.parse(e)):null}}function Ie(t){return function(e){if("string"!=typeof e)return null;let n=e,o=null;for(let e=0;++e<=5;)try{n=decodeURIComponent(n),o=Ae(t)(n);break}catch(t){if(e>=5)throw t}return o}}const je="growthcode",ke="temp",$e=["gceb"];var Ce=new pt({scope:"ortbVendors",object:"growthcode",action:"set",handler:async({account:t})=>{const e=new xe(ke).using(_e).fromLocalStorageKeys($e).forAccount(t).getRunner()();if(!e)return{status:s.cancelled};const n=JSON.parse(e[ke]);if(!(n instanceof Array))return{status:s.cancelled};const o=n.filter((t=>Oe(t)));if(0===o.length)return{status:s.cancelled};const a={data:{default:{user:{ext:{eids:o}}}}};return t.update(fe,(t=>({...t,[je]:a}))),{status:s.completed}}});const Oe=t=>!!t&&!!t.source&&t.uids instanceof Array&&0!==t.uids.length&&t.uids.every((t=>void 0!==t?.id)),Pe="liveintent",De={nonId:{noExtraDefaults:!0,source:"liveintent.com",atype:3},bidswitch:{source:"bidswitch.net",atype:3},openx:{source:"openx.net",atype:3},magnite:{source:"rubiconproject.com",atype:3},medianet:{source:"media.net",atype:3},pubmatic:{source:"pubmatic.com",atype:3},index:{source:"liveintent.indexexchange.com",atype:3},uid2:{source:"uidapi.com",atype:3},sovrn:{source:"liveintent.sovrn.com",atype:3},thetradedesk:{source:"adserver.org",atype:1},vidazoo:{source:"liveintent.vidazoo.com",atype:3},triplelift:{source:"liveintent.triplelift.com",atype:3},sharethrough:{source:"sharethrough.com",atype:3},sonobi:{source:"liveintent.sonobi.com",atype:3},nexxen:{source:"liveintent.unrulymedia.com",atype:3},zetassp:{source:"zeta-ssp.liveintent.com",atype:3}};var Te=new pt({scope:"ortbVendors",object:"liveintent",action:"set",handler:async({account:t})=>{const e=function(t){const e=t.readLocalStorage("__tamLIResolveResult");if(null!=e&&(void 0===t.globalContext.liModuleEnabled&&(t.globalContext.liModuleEnabled=Math.random()<.95,t.globalContext?.googletag?.cmd.push((()=>{t.globalContext.googletag.pubads().setTargeting("li-module-enabled",t.globalContext.liModuleEnabled?["on"]:["off"])}))),t.globalContext.liModuleEnabled)){let t;try{t=Ne(JSON.parse(e))}catch(n){t=Ne(JSON.parse(decodeURIComponent(e)))}if(void 0!==t)return{data:{default:t}}}}(t);return void 0===e?{status:s.cancelled}:(t.update(fe,(t=>({...t,[Pe]:e}))),{status:s.completed})}});function Ne(t){const e=[],n={user:{ext:{eids:e}}};return Object.entries(De).forEach((n=>{const o=n[0],a=n[1];if(void 0===t[o])return;const i={source:a.source,uids:[{id:t[o],atype:a.atype}]};!0!==a.noExtraDefaults&&(i.uids[0].ext={provider:"liveintent.com"}),e.push(i)})),n}const Le="optable",Me="temp";var Ue=new pt({scope:"ortbVendors",object:"optable",action:"set",handler:async({account:t})=>{const e=new xe(Me).using(_e).fromLocalStorageKeys(["OPTABLE_RESOLVED"]).forAccount(t).getRunner()();if(!e)return{status:s.cancelled};const n=function(t){return t&&t.ortb2?t.ortb2:t}(JSON.parse(e[Me])),o={data:{default:n}};return t.update(fe,(t=>({...t,[Le]:o}))),{status:s.completed}}});const qe="permutive",Ve="permutive_temp",Fe=["_pamzn_ids"];var ze=new pt({scope:"ortbVendors",object:"permutive",action:"set",handler:async({account:t})=>{const e=new xe(Ve).using(_e).fromLocalStorageKeys(Fe).forAccount(t).getRunner()();if(!e)return{status:s.cancelled};const n=JSON.parse(e[Ve]);if(!Array.isArray(n))return{status:s.cancelled};const o=n.filter((t=>Be(t)));if(0===o.length)return{status:s.cancelled};const a={data:{default:{user:{ext:{eids:o}}}}};return t.update(fe,(t=>({...t,[qe]:a}))),{status:s.completed}}});const Be=t=>!!t&&!!t.source&&!!Array.isArray(t.uids)&&0!==t.uids.length&&t.uids.every((t=>void 0!==t?.id));var Je=new pt({scope:"ortbVendors",object:"all",action:"process",handler:async({account:t})=>(await Promise.all([t.recordListener(ve),t.recordListener(ye),t.recordListener(Ce),t.recordListener(Te),t.recordListener(Ue),t.recordListener(ze)]),{status:s.completed})});const He=mt([ve,ye,Ce,Te,Ue,ze,Je]),Ge="33across",Ke="33acrossId";var We=new pt({scope:"idVendors",object:"33across",action:"get",handler:async({account:t,customEvent:e})=>{const n=Se(Qe,t),o=t.readLocalStorage(Ke);if(o&&o.length>1500){const t={idLength:100*Math.ceil(o.length/100)};return{...n,analytics:t}}return n}});const Qe=t=>{const e=t.readLocalStorage(Ke);return null!=e?{[Ge]:decodeURIComponent(e)}:null},Ye=["amxId"];var Ze=new pt({scope:"idVendors",object:"amx",action:"get",handler:async({account:t,customEvent:e})=>Se(new xe("amx").using(_e).fromLocalStorageKeys(Ye).forAccount(t).getRunner(),t)});const Xe="audigent";var tn=new pt({scope:"idVendors",object:"audigent",action:"get",handler:async({account:t,customEvent:e})=>Se(en,t)});const en=t=>{const e=t.readLocalStorage("hadronId")??t.readLocalStorage("auHadronId");return null!=e?{[Xe]:e}:null},nn=["cto_bidid"];var on=new pt({scope:"idVendors",object:"criteo",action:"get",handler:async({account:t,customEvent:e})=>Se(new xe("criteo").using(_e).fromLocalStorageKeys(nn).forAccount(t).getRunner(),t)});const an="firstid",sn=["firstid"];var rn=new pt({scope:"idVendors",object:"firstid",action:"get",handler:async({account:t,customEvent:e})=>Se(new xe(an).using(_e).fromCookieKeys(sn).forAccount(t).getRunner(),t)});const cn={key:"idVendors/enabled",default:void 0},dn={"context.apstag":et,"context.apstag.bids":ct,"context.apstag.bids()":ut,"context.apstag._atsaaiod":ot([ut,ct]),"context.apstag.setDisplayBids":ct,"context.apstag.setDisplayBids()":null,"context._apstag":rt(et),"context._apstag.bids":rt(ct),"context._apstag.bids()":rt(ut),"context._apstag._atsaaiod":rt(ot([ut,ct])),"context._apstag.setDisplayBids":rt(ct),"context._apstag.setDisplayBids()":null};var ln=new pt({scope:"idVendors",object:"enabled",action:"set",handler:async({account:t,detail:e,context:n})=>un(n)?(t.update(cn,(()=>JSON.stringify(e.bidParameterKeys)),{persist:!0}),{status:s.completed}):{status:s.waiting},validators:{detail:{detail:et,"detail.bidParameterKeys":at,"detail.bidParameterKeys[]":X},context:{context:et,...dn,"context.apstag":ot([ut,et]),"context._apstag":rt(ot([ut,et]))}}});const un=t=>void 0!==t.apstag?._atsaaiod,pn={key:"idVendors/newConfigFlowEnabled",default:!1};var mn=new pt({scope:"idVendors",object:"newConfigFlowEnabled",action:"set",validators:{detail:{detail:et,"detail.value":tt},context:{context:et}},handler:async({account:t,detail:e})=>(t.update(pn,(()=>e.value)),{status:s.completed,analytics:{enabled:e.value}})}),fn=new pt({scope:"idVendors",object:"newConfigFlow",action:"initialize",validators:{detail:{detail:et},context:{context:et}},handler:async({account:t})=>(t.recordListenerNonBlocking(mn,{value:!1}),t.recordListenerNonBlocking(mn,{value:!0,restrictions:{allow:{accounts:["5202","5054","5145","5124","5218"]}}}),{status:s.completed})});const hn="fabrick";var vn=new pt({scope:"idVendors",object:"fabrick",action:"get",handler:async({account:t,customEvent:e})=>Se(yn,t)});const yn=t=>{let e=null;const n=t.readCookieStorage("pbjs_fabrickId");if(null!=n){const t=decodeURIComponent(n);e=JSON.parse(t).fabrickId}return null!=e?{[hn]:e}:null},gn=["FTrackId"],wn=t=>t?.DeviceID?.pop?t?.DeviceID?.pop()??null:null;var bn=new pt({scope:"idVendors",object:"fTrack",action:"get",handler:async({account:t,customEvent:e})=>Se(new xe("fTrack").using(Ie(wn)).fromLocalStorageKeys(gn).forAccount(t).getRunner(),t)});const En="id5",Sn="id5id";var xn=new pt({scope:"idVendors",object:"id5",action:"get",handler:async({account:t,customEvent:e})=>Se(_n,t)});const _n=t=>{const e=t.readLocalStorage(Sn);return null!=e?{[En]:JSON.parse(decodeURIComponent(e)).universal_uid}:null},Rn=["IDP"];var An=new pt({scope:"idVendors",object:"idPlus",action:"get",handler:async({account:t,customEvent:e})=>Se(new xe("idPlus").using(Re).fromCookieOrLocalStorageKeys(Rn).forAccount(t).getRunner(),t)});const In=["__im_uid","__im_ppid"];var jn=new pt({scope:"idVendors",object:"intimateMerger",action:"get",handler:async({account:t,customEvent:e})=>Se(new xe("intimateMerger").using(_e).fromLocalStorageKeys(In).forAccount(t).getRunner(),t)});const kn="liveRamp",$n="_lr_env",Cn="idl_env",On="apstagLiveRampTimestamp";var Pn;!function(t){t[t.oldTimestamp=0]="oldTimestamp",t[t.newTimestamp=1]="newTimestamp",t[t.noTimestamp=2]="noTimestamp"}(Pn||(Pn={}));var Dn=new pt({scope:"idVendors",object:"liveramp",action:"get",handler:async({account:t,customEvent:e})=>{const n=Nn(Tn(t),t),o=Se((()=>null!=n?{[kn]:n.id}:null),t);return o.status===s.completed?function(t,e){const o=null!=n?{[kn]:n.newGen}:null;return null!=o?(e.update(Ee,(t=>({...t,...o}))),{status:s.completed}):{status:s.cancelled}}(0,t):o}});const Tn=t=>{const e=t.readLocalStorage($n);if(null!=e)return e;const n=t.readCookieStorage($n);if(null!=n)return n;const o=t.readLocalStorage(Cn);if(null!=o)return o;const a=t.readCookieStorage(Cn);return null!=a?a:null},Nn=(t,e)=>{if(null!=t&&""!==t)try{const n=JSON.parse(atob(decodeURIComponent(t))),o=Array.isArray(n.envelope)?n.envelope[0]:n.envelope;if("string"!=typeof o)return null;const a={id:o,newGen:Pn.noTimestamp};if(null!=n.timestamp){const t=e.readLocalStorage(On);null==t||tSe(Vn,t)});const Vn=t=>{const e=t.readLocalStorage("lockr_identity_providers");if(e){const n={};return e.split(",").filter((t=>!Mn.has(t))).forEach((e=>{const o=Fn(t,e);null!==o&&(n[Ln[e]||e]=decodeURIComponent(o))})),n}return null},Fn=(t,e)=>{let n=t.readLocalStorage(e);if(!n)return null;if(Un[e])try{n=JSON.parse(decodeURIComponent(n)),Un[e].split(".").forEach((t=>{n=n?.[t]}))}catch(t){throw new Error(`Malformed json at ${e}: ${t}`)}return n||null},zn="lotame";var Bn=new pt({scope:"idVendors",object:"lotame",action:"get",handler:async({account:t,customEvent:e})=>Se(Jn,t)});const Jn=t=>{const e=t.readLocalStorage("panoramaId");return null!=e?{[zn]:e}:null},Hn=["pbjs-merkleId"],Gn=t=>t?.merkleId?.pop?t?.merkleId?.pop()?.id??null:null;var Kn=new pt({scope:"idVendors",object:"merkle",action:"get",handler:async({account:t,customEvent:e})=>Se(new xe("merkle").using(Ie(Gn)).fromLocalStorageKeys(Hn).forAccount(t).getRunner(),t)});const Wn="pair",Qn=["pairId"],Yn=["_lr_pairId"],Zn=t=>t?.envelope?.pop?t?.envelope?.pop()??null:null;var Xn=new pt({scope:"idVendors",object:"pair",action:"get",handler:async({account:t,customEvent:e})=>Se((t=>new xe(Wn).using(Re).fromCookieOrLocalStorageKeys(Qn).forAccount(t).getRunner()()??new xe(Wn).using(function(t){return function(e){return"string"==typeof e?Ae(t)(atob(decodeURIComponent(e))):null}}(Zn)).fromCookieOrLocalStorageKeys(Yn).forAccount(t).getRunner()()),t)});const to="pubcommon",eo=["_pubcid","_sharedID"];var no=new pt({scope:"idVendors",object:"pubcommon",action:"get",handler:async({account:t,customEvent:e})=>Se(new xe(to).using(_e).fromLocalStorageOrCookieKeys(eo).forAccount(t).getRunner(),t)});const oo="publink",ao=["_publink_srv","_publink","pbjs_publink"];var io=new pt({scope:"idVendors",object:"publink",action:"get",handler:async({account:t,customEvent:e})=>Se(so,t)});const so=t=>{for(const e of ao){const n=t.readCookieStorage(e);if(null!=n){let t;try{t=JSON.parse(n).publink}catch{t=n}if(null!=t)return{[oo]:t}}}return null},ro=["__qca"];var co=new pt({scope:"idVendors",object:"quantcast",action:"get",handler:async({account:t,customEvent:e})=>Se(new xe("quantcast").using(_e).fromCookieKeys(ro).forAccount(t).getRunner(),t)});const lo=["__uid2_advertising_token"],uo=t=>t?.latestToken?.advertising_token??null;var po=new pt({scope:"idVendors",object:"uid",action:"get",handler:async({account:t,customEvent:e})=>Se(new xe("uid").using(Ae(uo)).fromLocalStorageKeys(lo).forAccount(t).getRunner(),t)});const mo=["pbjs_unifiedID","pbjs-unifiedid"],fo=t=>t?.TDID??null;var ho=new pt({scope:"idVendors",object:"unifiedid",action:"get",handler:async({account:t,customEvent:e})=>Se(new xe("unifiedid").using(Ie(fo)).fromLocalStorageOrCookieKeys(mo).forAccount(t).getRunner(),t)});const vo="yahoo",yo=["connectId"],go=t=>t?.connectid??t?.connectId??null;var wo=new pt({scope:"idVendors",object:"yahoo",action:"get",handler:async({account:t})=>Se(new xe(vo).using(Ie(go)).fromLocalStorageKeys(yo).forAccount(t).getRunner(),t)});const bo="liveRamp/envelope",Eo={key:"liveRamp/envelope",default:void 0},So={key:"liveRamp/envelopeHost",default:"https://api.rlcdn.com"};var xo=new pt({scope:"liveRamp",object:"envelope",action:"fetch",handler:async({account:t})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:s.waiting};const e=t.use(So),n=new URL(`${e}/api/identity/envelope`);n.searchParams.append("pid","13310");const o=t.use(It),a=t.read(Et);!0===o?.gdprApplies&&o.tcString&&(n.searchParams.append("gdpr","1"),n.searchParams.append("gdpr_consent",o.tcString)),a?.gppString&&a.applicableSections?.length>0&&(n.searchParams.append("gpp",a.gppString),n.searchParams.append("gpp_sid",a.applicableSections.join(",")));const i=await t.globalContext.fetch(n.toString(),{method:"GET",credentials:"include"}),r={statusCode:i.status,responseOk:i.ok};if(200!==i.status)return{status:s.cancelled,analytics:{...r,...204===i.status&&{reason:"No Content"}}};const c=await i.json();if(!c.envelope)return{status:s.cancelled,analytics:{...r,reason:"missing_envelope"}};const d=JSON.stringify({value:c.envelope,createdAt:Date.now()});return t.update(Eo,(()=>c.envelope)),t.writeLocalStorage(bo,d,{usePrefix:!0}),{status:s.completed,analytics:r}}}),_o=new pt({scope:"liveRamp",object:"envelope",action:"sync",handler:async({account:t})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:s.waiting};const e=t.readLocalStorage(bo,{usePrefix:!0});if(e){const{createdAt:n,value:o}=JSON.parse(e);if(o&&Ro(n,Date.now())<15)return t.update(Eo,(()=>o)),{status:s.completed}}return await t.recordListener(xo),{status:s.completed}}});const Ro=(t,e)=>{const n=new Date(t),o=new Date(e);return(n.getTime()-o.getTime())/864e5};var Ao=new pt({scope:"idVendors",object:"rtisLiveRamp",action:"get",handler:async({account:t})=>(t.recordListenerNonBlocking(_o),{status:s.completed})});const Io={"33across":We,amx:Ze,audigent:tn,criteo:on,ddb_key_638:qn,firstid:rn,fabrick:vn,fTrack:bn,id5:xn,idPlus:An,intimateMerger:jn,liveRamp:Dn,lotame:Bn,merkle:Kn,pair:Xn,pubcommon:no,publink:io,quantcast:co,uid:po,unifiedid:ho,yahoo:wo,rtisLiveRamp:Ao},jo=Object.keys(Io);var ko=new pt({scope:"idVendors",object:"ids",action:"get",handler:async({account:t})=>{let e=Object.values(Io);const n=t.use(cn,{persist:!0,throwOnDisallowed:!1});if(n){const t=JSON.parse(n);if(o=t,!Array.isArray(o)||!o.every((t=>"string"==typeof t)))throw new Error("Received invalid 3P bid param key");const a=new Set(t);e=jo.filter((t=>a.has(t))).map((t=>Io[t]))}var o;const a=n?e:e.filter((t=>t!==Ao));return await Promise.all(a.map((e=>t.recordListener(e)))),{status:s.completed,analytics:{enabledIdVendors:`${n}`}}}});const $o={key:"idVendors/recordVendorsLoadedEndpoint",default:"https://prod.us-east-1.cxm-bcn.publisher-services.amazon.dev/v1/recordVendorsLoaded"};var Co=new pt({scope:"idVendors",object:"vendorsLoaded",action:"record",validators:{detail:{detail:et,"detail.accountId":X,"detail.sourceId":X,"detail.vendorId":rt(X),"detail.propertyId":rt(X),"detail.failure":rt(X),"detail.errorName":rt(X),"detail.errorMessage":rt(X)},context:{context:et,"context.fetch":ct,"context.fetch()":null}},handler:async({detail:t,account:e,context:n})=>{const o=[{publisherId:t.accountId,sourceId:t.sourceId,clientName:"aps-listener",...t.failure&&{failure:t.failure,errorName:t.errorName,errorMessage:t.errorMessage},...!t.failure&&{vendorId:t.vendorId,propertyId:t.propertyId}}],a=e.use($o),i=await n.fetch(a,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(o),keepalive:!0});if(!i.ok)throw new Error(`HTTP ${i.status}`);return{status:s.completed,analytics:{vendorId:t.vendorId}}}}),Oo=new pt({scope:"idVendors",object:"integration",action:"execute",validators:{detail:{detail:et,"detail.script":ct,"detail.script()":dt,"detail.accountId":X,"detail.sourceId":X,"detail.vendorId":X,"detail.propertyId":X,"detail.countryCode":X,"detail.vendorLoadedSampleRate":rt(Z),"detail.restrictions":rt(et),"detail.restrictions.block":rt(et),"detail.restrictions.block.dtbHostnames":rt(at),"detail.restrictions.block.dtbHostnames[]":X,"detail.allowedRegions":rt(at),"detail.allowedRegions[]":X,"detail.blockedRegions":rt(at),"detail.blockedRegions[]":X}},handler:async({detail:t,account:e})=>{if(!e.use(pn))return{status:s.cancelled,analytics:{accountId:t.accountId}};let n,o,a;try{t.script()}catch(t){n="vendor-script-execution-error",o=t instanceof Error?t.name:"Error",a=t instanceof Error?t.message:String(t)}if(e.recordListenerNonBlocking(Co,{accountId:t.accountId,sourceId:t.sourceId,vendorId:t.vendorId,propertyId:t.propertyId,...n&&{failure:n,errorName:o,errorMessage:a},restrictions:{allow:{rate:(t.vendorLoadedSampleRate??5)/100}}}),n)throw new Error(a);return{status:s.completed,analytics:{vendorId:t.vendorId,accountId:t.accountId,propertyId:t.propertyId}}}});const Po=mt([We,Ze,tn,on,rn,ln,mn,fn,vn,bn,xn,An,ko,Oo,jn,Dn,qn,Bn,Kn,Xn,no,io,co,po,ho,Co,wo,Ao]);var Do=new pt({scope:"analytics",object:"sampleRateFactors",action:"set",validators:{detail:{detail:dt,"detail.sampleRateFactors":lt}},handler:async({account:t,detail:{sampleRateFactors:e}})=>(t.update(O,(()=>e)),{status:s.completed})});const To=mt([new pt({scope:"analytics",object:"sampling",action:"set",validators:{detail:{detail:dt,"detail.rates":dt,"detail.rates.error":dt,"detail.rates.status":dt}},handler:async({detail:t})=>void 0===t?.rates?{status:s.cancelled}:(void 0!==t?.rates?.error&&yt.setEventSamplingRates({error:t?.rates?.error}),void 0!==t?.rates?.status&&yt.setEventSamplingRates({feature:t?.rates?.status}),{status:s.completed})}),new pt({scope:"log",object:"analytics",action:"setInterval",validators:{detail:{detail:et,"detail.interval":Z}},handler:async({detail:t})=>(yt.setEventProcessingInterval(t.interval),{status:s.completed})}),Do]);var No=new pt({scope:"debug",object:"version",action:"show",handler:async({account:t,customEvent:e})=>({status:s.completed,value:{LIBRARY_VERSION:_}})});const Lo="debug/events/show",Mo="debug/prepend/add",Uo="debug/prepend/remove",qo="debug/store/show",Vo="ad/debugSession/start",Fo=new Map([[Lo,async({account:t})=>{const e=[...(null!=t.store.get(y)?t.store.get(y):[]).map((t=>({type:t.type,status:"created",detail:t.detail,timestamp:t.timeStamp}))),...t.queue.map((t=>({type:t.type,status:"created",detail:t.detail,timestamp:t.timeStamp}))),...(null!=t.store.get(y)?t.store.get(y):[]).map((t=>null!=t.statusEvents?t.statusEvents.map((e=>({type:t.type,status:e.type,detail:t.detail,timestamp:e.timeStamp}))):[])).flat(),...t.queue.map((t=>null!=t.statusEvents?t.statusEvents.map((e=>({type:t.type,status:e.type,detail:t.detail,timestamp:e.timeStamp}))):[])).flat()].filter((t=>!t.type.startsWith("debug/")));return e.sort(((t,e)=>t.timestamp-e.timestamp)),console.groupCollapsed(`⌂ Account ID: ${t.id}`),console.table(e),console.groupEnd(),s.completed}],[Mo,async({account:t,customEvent:n})=>{if(void 0===n.detail?.eventName)throw new Error("Missing event information");const o=t.read(e,{persist:!0})??"[]",a=JSON.parse(o),{eventName:i,eventDetail:r}=n.detail;return a.unshift({eventName:i,eventDetail:r}),t.write(e,JSON.stringify(a),{persist:!0}),s.completed}],["debug/prepend/clear",async({account:t})=>(t.delete(e,{persist:!0}),s.completed)],[Uo,async({account:t,customEvent:n})=>{if(void 0===n.detail?.eventName)throw new Error("Missing event information");const o=t.read(e,{persist:!0})??"[]",a=JSON.parse(o),{eventName:i}=n.detail,r=a.filter((t=>t.eventName!==i));return t.write(e,JSON.stringify(r),{persist:!0}),s.completed}],[qo,async({account:t})=>{const e=[...t.store.entries()];return console.groupCollapsed(`⌂ Account ID: ${t.id}`),console.table(e),console.groupEnd(),s.completed}],[Vo,async({account:e,customEvent:n})=>function(t){return t.status!==s.waiting}(n)&&(function(e,n){void 0!==e.detail?.minutes&&function(e,n){const o=new Date;e.write(t,o.setMinutes(Number(o.getMinutes())+Number(n.detail?.minutes)).toString(),{persist:!0})}(n,e),function(t){t.globalContext.apstagDEBUG=t.globalContext.apstagDEBUG??{},t.globalContext.apstagDEBUG.url=function(t){const e=new URL(t?.top?.location?.href??t?.document?.referrer);return e.searchParams.set("amzn_debug_mode","1"),e.toString()}(t.globalContext)}(n)}(n,e),function(t){return t.queue.filter((t=>t.type===Vo)).length>1}(e))?s.completed:function(e){const n=e.read(t,{persist:!0});return void 0!==n&&new Date>=new Date(Number(n))}(e)?(function(e){e.delete(t,{persist:!0}),function(t){delete t.globalContext.apstagDEBUG?.url}(e)}(e),s.completed):(function(t){t.record(Lo).catch((t=>{})),t.record(qo).catch((t=>{}))}(e),s.waiting)],["debug/listeners/show",async({systemAccount:t})=>{const e=[...t.store.get(v).entries()];return console.groupCollapsed("⌂ Listeners"),console.table(e),console.groupEnd(),s.completed}]]),zo=new Map([...Fo,...mt([No])]);var Bo;!function(t){t[t.unspecifiedUnknown=0]="unspecifiedUnknown",t[t.lowEntropy=1]="lowEntropy",t[t.highEntropy=2]="highEntropy"}(Bo||(Bo={}));const Jo=["brands","mobile","platform"],Ho=["architecture","bitness","fullVersionList","model","platformVersion"];var Go=new pt({scope:"deviceSignal",object:"sua",action:"set",validators:{context:{context:et,...dn,"context.navigator":et,"context.navigator.userAgentData":et,"context.navigator.userAgentData.getHighEntropyValues":ct,"context.navigator.userAgentData.architecture":rt(X),"context.navigator.userAgentData.bitness":rt(X),"context.navigator.userAgentData.mobile":rt(tt),"context.navigator.userAgentData.model":rt(X),"context.navigator.userAgentData.platform":rt(X),"context.navigator.userAgentData.platformVersion":rt(X),"context.navigator.userAgentData.fullVersionList":rt(at),"context.navigator.userAgentData.fullVersionList[]":et,"context.navigator.userAgentData.fullVersionList[].brand":X,"context.navigator.userAgentData.fullVersionList[].version":X,"context.navigator.userAgentData.brands":rt(at),"context.navigator.userAgentData.brands[]":et,"context.navigator.userAgentData.brands[].brand":X,"context.navigator.userAgentData.brands[].version":X}},handler:async({account:t})=>{if(void 0===t.globalContext.apstag?.isGDPRRegion)return{status:s.waiting};const e="deviceSignal/sua",n=t.globalContext.navigator?.userAgentData,o=t.read(e,{persist:!0,throwOnDisallowed:!1});return"string"==typeof o?t.write(e,o):n instanceof Object&&function(t,e,n){t.write(e,JSON.stringify(Ko(n)))}(t,e,n),!1!==t.globalContext.apstag?.isGDPRRegion||"function"==typeof n?.getHighEntropyValues&&await async function(t,e,n){const o=await n.getHighEntropyValues([...Jo,...Ho]);return t.write(e,JSON.stringify(Ko(o)),{persist:!0,throwOnDisallowed:!1}),s.completed}(t,e,n),{status:s.completed}}});function Ko(t){const e={};let n;return e.architecture=t.architecture,e.bitness=t.bitness,e.mobile=t.mobile?1:0,e.model=t.model,e.source=(o=t,Ho.some((t=>o[t]))?Bo.highEntropy:Jo.some((t=>o[t]))?Bo.lowEntropy:Bo.unspecifiedUnknown),"string"==typeof t.platform&&(e.platform={brand:t.platform,version:t.platformVersion?.split(".")}),Array.isArray(t.fullVersionList)?n=t.fullVersionList:Array.isArray(t.brands)&&(n=t.brands),n instanceof Array&&(e.browsers=n.map((t=>({brand:t.brand,version:t.version?.split(".")})))),e;var o}const Wo=mt([Go]),Qo={key:"deviceSignal/cookieDeprecationLabel",default:void 0};var Yo=new pt({scope:"deviceSignal",object:"cookieDeprecationLabel",action:"set",handler:async({account:t,customEvent:e})=>{const{cookieDeprecationLabel:n}=t.globalContext.navigator;if(void 0===n?.getValue||"function"!=typeof n.getValue)return{status:s.cancelled};const o=await t.executeFuncWithConsent(n,n.getValue);return void 0===o||""===o?{status:s.cancelled}:(t.update(Qo,(()=>o)),{status:s.completed,analytics:{gcdl:o}})}});const Zo=mt([Yo]),Xo={key:"_monitoring/statusesByEventIdentifier",default:new Map};var ta=async({account:t,customEvent:e})=>{const n=e.detail?.eventIdentifier;if(void 0===n)throw new Error("Missing eventIdentifier parameter");const o=t.use(Xo),a=`${e.type}:${n}`,i=o.get(a);return void 0!==i?i:s.waiting},ea=async({account:t,customEvent:e})=>{const n=e.detail?.eventIdentifier;if(void 0===n)throw new Error("Missing eventIdentifier parameter");const o=e.detail?.statusUpdate;if(void 0===o)throw new Error("Missing statusUpdate parameter");if(!(o in s))throw new Error(`Invalid statusUpdate parameter. Expected one of ${Object.values(s).join(", ")}`);const a=e.detail?.pairedEvents;if(void 0===a||a.length<1||a.some((t=>"string"!=typeof t)))throw new Error("Parameter pairedEvents must be a non-empty array of string");return a.forEach((e=>{const a=`${e}:${n}`;t.update(Xo,(t=>t.set(a,o)))})),s.completed};const na=new Map([["_monitor/testing/only",ta],["_update/testing/only",ea],["_legacy/bidRequest/monitor",ta],["_legacy/bidRequest/didComplete",ea]]);var oa=new pt({scope:"prebid",object:"analyticsEvent",action:"track",handler:async({account:t,customEvent:e})=>{if(void 0===e.detail?.eventType||void 0===e.detail?.eventArgs||void 0===e.detail?.config?.options?.accountID)return{status:s.cancelled};const n={eventType:e.detail.eventType,metadata:e.detail.metadata,config:e.detail.config},o=await t.globalContext.fetch("https://prod.us-east-1.cxm-bcn.publisher-services.amazon.dev/v1/events/prebid",aa(e.detail));return o.ok?{status:s.completed,analytics:n}:{status:s.cancelled,analytics:{...n,message:`Request failed: ${o.status}`}}}});const aa=t=>{const e={accountId:t.config.options.accountID,events:[{eventArgs:t.eventArgs,eventType:t.eventType}]};return{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)}},ia={key:"prebid/config",default:void 0};var sa;!function(t){t.NotStarted="NOT STARTED",t.Loading="LOADING",t.Complete="COMPLETE"}(sa||(sa={}));const ra={key:"prebid/configRequestState",default:sa.NotStarted};var ca=new pt({scope:"prebid",object:"config",action:"fetch",handler:async({account:t,customEvent:e})=>{const n=t.use(ra);if(n===sa.Loading)return{status:s.waiting};const o={metadata:e?.detail?.metadata};if(n===sa.Complete){const e=t.use(ia);if(void 0!==e)return{status:s.completed,value:JSON.parse(e),analytics:o}}try{t.update(ra,(()=>sa.Loading));const e=`https://c.amazon-adsystem.com/cdn/prod/config?src=${t.id}`,n=await t.globalContext.fetch(e);if(t.update(ra,(()=>sa.Complete)),!n.ok)return{status:s.cancelled,analytics:{...o,message:"Config request failed"}};const a=await n.json(),i=da(t,a);return t.update(ia,(()=>JSON.stringify(i)),{persist:!0}),{status:s.completed,value:i,analytics:o}}catch(t){return{status:s.cancelled,analytics:{...o,message:t.message}}}}});const da=(t,e)=>({analyticsConfig:{options:{accountID:t.id,sampling:e.pbjs?.sampleRate},includeEvents:e.pbjs?.allowedEvents},idConfig:{params:{accountID:t.id,enabled:e.pbjs?.enabled,treatments:e.pbjs?.treatments}}}),la={key:"prebid/eidsConfig",default:"{}"};var ua;!function(t){t.APSSignalIQ="_apsIdTreatment",t.Audigent="hadronId",t.FirstID="firstId",t.ID5="id5id",t.Liveramp="idl_env",t.Lotame="lotamePanoramaId",t.Pubcommon="pubcid",t.Publink="publinkId",t.ThirtyThree="33acrossId",t.Yahoo="connectId"}(ua||(ua={}));const pa=new Map([[Xe,ua.Audigent],[an,ua.FirstID],["id5",ua.ID5],[kn,ua.Liveramp],[zn,ua.Lotame],[to,ua.Pubcommon],[oo,ua.Publink],[Ge,ua.ThirtyThree],[vo,ua.Yahoo]]),ma={[ua.Audigent]:{source:"audigent.com",atype:1},[ua.FirstID]:{source:"first-id.fr",atype:1},[ua.ID5]:{source:"id5-sync.com",atype:1},[ua.Liveramp]:{source:"liveramp.com",atype:3},[ua.Lotame]:{source:"crwdcntrl.net",atype:1},[ua.Pubcommon]:{source:"pubcid.org",atype:1},[ua.Publink]:{source:"epsilon.com",atype:3},[ua.ThirtyThree]:{source:"33across.com",atype:1},[ua.Yahoo]:{source:"yahoo.com",atype:3}};var fa=new pt({scope:"prebid",object:"eidsConfig",action:"get",handler:async({account:t,customEvent:e})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:s.waiting};t.update(la,(()=>JSON.stringify({...ma})),{persist:!0});const n={metadata:e?.detail?.metadata,config:e?.detail?.config};return{status:s.completed,analytics:n}}});const ha=new Set(["CONTROL_HOLD_OUT","CLEAN",...pa.keys()]);const va={key:"prebid/ids",default:void 0};var ya=new pt({scope:"prebid",object:"ids",action:"get",handler:async({account:t,customEvent:e})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:s.waiting};t.recordListenerNonBlocking(ko);const n=t.use(be);let o;void 0!==n&&(o=Object.fromEntries(Object.entries(n).map((([t,e])=>[pa.get(t),e]))));const a=await t.recordListener(ca,{metadata:e?.detail?.metadata}),i={metadata:e?.detail?.metadata};return a.idConfig.params.enabled?(null!=a.idConfig.params.treatments&&(o=function(t,e){if(!function(t){const e=100===t.reduce(((t,{percent:e})=>t+e),0),n=t.reduce(((t,{treatment:e})=>t&&ha.has(e)),!0);return e&&n}(e))return t;const n=function(t){const e=100*Math.random();let n=0;for(const o of t)if(n+=o.percent,e<=n)return o.treatment;throw new Error("Invalid treatment percentages")}(e);return function(t,e){const n={[ua.APSSignalIQ]:e},o=pa.get(e);switch(e){case"CONTROL_HOLD_OUT":return{...t,...n};case"CLEAN":return n;default:return void 0!==o&&void 0!==t?.[o]&&(n[o]=t[o]),n}}(t,n)}(o,a.idConfig.params.treatments)),t.update(va,(()=>o)),{status:s.completed,value:o,analytics:i}):{status:s.cancelled,analytics:i}}});const ga=mt([oa,ca,fa,ya]),wa=t=>t===ba.noConsent?"AMZN-NoCookieConsent":"AMZN-Token";var ba;!function(t){t[t.noConsent=0]="noConsent",t[t.token=1]="token"}(ba||(ba={}));const Ea=t=>{t.setCookieStorage(wa(ba.token),"",0),t.setCookieStorage(wa(ba.noConsent),"",0)},Sa=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:o,tcString:a,setToken:i})=>(Ea(t),"boolean"!=typeof i&&(i=!0),xa({account:t,hashedRecords:e,ttl:n,isGDPRRegion:o,tcString:a}).then((({AIPToken:e,cookieExpiry:n})=>_a({AIPToken:e,cookieExpiry:n,account:t,setToken:i})))),xa=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:o,tcString:a})=>fetch("https://tk.amazon-adsystem.com/envelope",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ra({account:t,hashedRecords:e,ttl:n,isGDPRRegion:o,tcString:a}))}).then((t=>{if(!t.ok)throw new Error(`Token http status error: ${t.status}`);return t.json()})),_a=({AIPToken:t,cookieExpiry:e,account:n,setToken:o})=>{if("string"!=typeof t||"number"!=typeof e)throw new Error("Invalid AIPES response");if(""===t)throw n.setCookieStorage(wa(ba.noConsent),"1",e),new Error("Empty token");(o||"boolean"!=typeof o)&&n.setCookieStorage(wa(ba.token),t,e)},Ra=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:o,tcString:a})=>{const i={publisherId:t.id,hashedRecords:e};return void 0!==n&&(i.ttl=n),o?(i.gdpr=1,a&&(i.gdprConsent=a)):i.gdpr=0,i};var Aa=new pt({scope:"ad",object:"record",action:"delete",handler:async({account:t})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:s.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");return Ea(t),{status:s.completed}}});const Ia={detail:et,"detail.setCookie":rt(tt),"detail.config":et,"detail.config.optOut":rt(tt),"detail.config.ttl":rt(Z),"detail.config.gdpr":rt(et),"detail.config.gdpr.cmpTimeout":rt(Z),"detail.config.gdpr.enabled":rt(lt),"detail.config.gdpr.consent":rt(X),"detail.config.gdpr.cmpGlobal":rt(X),"detail.config.gdpr.cmpGlobalv2":rt(X),"detail.config.hashedRecords":at,"detail.config.hashedRecords[]":et,"detail.config.hashedRecords[].type":X,"detail.config.hashedRecords[].record":X,"detail.config.hashedRecords[].encrypted":rt(Z),"detail.config.hashedRecords[].toJSON":dt,"detail.config.hashedRecords[].$$typeof":dt,"detail.config.hashedRecords[].constructor":dt,"detail.config.hashedRecords[].tagName":dt,"detail.config.hashedRecords[].@@__IMMUTABLE_ITERABLE__@@":dt,"detail.config.hashedRecords[].@@__IMMUTABLE_RECORD__@@":dt};var ja,ka,$a=new pt({scope:"ad",object:"record",action:"renew",validators:{detail:Ia,context:{context:et}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:s.waiting};if(void 0===e?.config)throw new Error("Missing tokenConfig object");if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");if((t.readCookieStorage(wa(ba.token))??"").length>0)return{status:s.cancelled};const n=t.globalContext.apstag.isGDPRRegion,o=t.use(It);var a;return await(a={account:t,hashedRecords:e.config.hashedRecords,ttl:e.config.ttl,isGDPRRegion:n,tcString:o?.tcString},Sa(a)),{status:s.completed}}});!function(t){t.email="email"}(ja||(ja={})),function(t){t.Display="display",t.Video="video",t.MultiFormat="multi-format"}(ka||(ka={}));const Ca=/^[0-9a-fA-F]{64}$/,Oa=t=>Ca.test(t||""),Pa=t=>t.then((t=>Array.from(new Uint8Array(t)).map((t=>t.toString(16).padStart(2,"0"))).join(""))).then((t=>"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"!==t?t:"")),Da=(t,e)=>"string"==typeof t&&(e===ja.email?/\S+@\S+\.\S+/.test(t)||Oa(t):t.trim().length>0),Ta=(t,e,n)=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?Da(e.value,n)?Pa(t.globalContext.crypto.subtle.digest("SHA-256",(new t.globalContext.TextEncoder).encode(e.value||""))):Promise.resolve(""):Da(e.innerText,n)?Pa(t.globalContext.crypto.subtle.digest("SHA-256",(new t.globalContext.TextEncoder).encode(e.innerText||""))):Promise.resolve(""),Na=(t,e,n)=>{const o=t.readLocalStorage(e);return o&&Da(o,n)?o:""},La=(t,e,n)=>{n=n??t.globalContext.location.href,e=e.replace(/[[\]]/g,"\\$&");const o=new RegExp("[?&#]"+e+"(=([^&#?]*)|&|#|$)").exec(n);return Array.isArray(o)&&"string"==typeof o[2]&&0!==decodeURIComponent(o[2].replace(/\+/g," ")).trim().length&&Oa(decodeURIComponent(o[2].replace(/\+/g," ")))?Promise.resolve(decodeURIComponent(o[2].replace(/\+/g," "))):new Promise((t=>t("")))};var Ma;!function(t){t.LOCAL_STORAGE="LOCAL",t.CSS_SELECTOR="CSS",t.URL="URL"}(Ma||(Ma={}));const Ua=(t,e={},n)=>{(t=>{const e={[Ma.LOCAL_STORAGE]:5,[Ma.URL]:4,[Ma.CSS_SELECTOR]:3},n={};t.forEach((t=>{n[t.method]=(n[t.method]||0)+1,t.priority=n[t.method]})),t.sort(((t,n)=>t.method===n.method?(t.priority||0)>(n.priority||0)?1:-1:e[t.method]>e[n.method]?-1:1))})(e.methods||[]);const o=[];let a;for(const i of e.methods||[]){const{method:e,target:s,type:r}=i;let c="";switch(e){case Ma.LOCAL_STORAGE:c=Na(t,s,r);break;case Ma.URL:o.push(La(t,s).then((t=>({type:r,value:t}))));break;case Ma.CSS_SELECTOR:a=i}if(c.length>0)return void n({value:c,type:r})}const i=()=>{if(!a||!0!==a.isGlobalSubmit&&("string"!=typeof a.eventTarget||"string"!=typeof a.event))return void n(!1);const{eventTarget:e,target:o,type:i,isGlobalSubmit:s}=a,r=s?"submit":a.event;if("string"!=typeof r||0===r.length)return void n(!1);const c=a=>(({account:t,e:e,eventTarget:n,event:o,isGlobalSubmit:a,target:i,type:s,onDone:r,listener:c})=>{if(!(a||"window"===n||e.target&&"function"==typeof e.target.matches&&"string"==typeof n&&e.target.matches(n)))return void r(!1);let d;a&&e instanceof Event&&e.target&&(d=e.target.querySelectorAll('input[type="email"]')),((t,e,n,o)=>{const a=o||t.globalContext.document.querySelectorAll(e);if(0===a.length)return new Promise((t=>t("")));if(1===a.length)return Ta(t,a[0],n);const i=[];for(const e of a)i.push(Ta(t,e,n));return Promise.all(i).then((t=>{let e=null;for(const n of t)if(""!==n){if(null!==e&&("string"!=typeof e||e!==n))return"";e=n}return e??""}))})(t,i,s,d).then((e=>{"function"==typeof c&&t.globalContext.removeEventListener(o,c),r(!(e.length<1)&&{value:e,type:s})}))})({account:t,e:a,event:r,eventTarget:e,isGlobalSubmit:s,target:o,type:i,onDone:n,listener:c});t.globalContext.addEventListener(r,c)};if(0!==o.length)return Promise.all(o).then((t=>{for(const e of t)if(e.value.length>0)return void n(e);i()}));i()},qa={called:!1};const Va=mt([Aa,$a,new pt({scope:"ad",object:"record",action:"rr",validators:{detail:{detail:et,"detail.config":et,"detail.config.$$typeof":dt,"detail.config.tagName":dt,"detail.config.@@__IMMUTABLE_ITERABLE__@@":dt,"detail.config.@@__IMMUTABLE_RECORD__@@":dt,"detail.config.accountID":rt(X),"detail.config.overrideLimit":rt(tt),"detail.config.methods":at,"detail.config.methods[].tagName":dt,"detail.config.methods[]":st(et),"detail.config.methods[].$$typeof":dt,"detail.config.methods[].@@__IMMUTABLE_ITERABLE__@@":dt,"detail.config.methods[].@@__IMMUTABLE_RECORD__@@":dt,"detail.config.methods[].type":it(Object.values(ja)),"detail.config.methods[].method":it(Object.values(Ma)),"detail.config.methods[].target":rt(X),"detail.config.methods[].event":rt(X),"detail.config.methods[].eventTarget":rt(X),"detail.config.methods[].isGlobalSubmit":rt(tt),"detail.config.methods[].priority":rt(Z)},context:{context:et,"context.Promise":ct,"context.crypto":et,"context.crypto.subtle":ct}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:s.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");const n=await function(t,e){return new Promise(((n,o)=>{if(qa.called&&!e.overrideLimit)throw new Error("rr should only be called once per page load");qa.called=!0;let a=0;const i=()=>{const s=(()=>{const a=t.use(It);return(!t.globalContext.apstag?.isGDPRRegion||void 0!==a)&&(void 0===a||t.isAllowedToAccessInfoOnDevice()?(Ua(t,e,(e=>{if(!1===e)return n("no retrieval");Sa({account:t,hashedRecords:[{type:e.type,record:e.value}],source:"rr",tcString:a?.tcString}).then((()=>{n("token generated")})).catch(o)}))?.catch(o),!0):"canceled")})(),r=a>6400;if(s||r)return"canceled"===s&&o(new Error("tcf timeout")),void(r&&o(new Error("interval over")));setTimeout(i,a),a=0===a?200:2*a};i()}))}(t,e.config);return{status:s.completed,analytics:{rr:n}}}}),new pt({scope:"ad",object:"record",action:"update",validators:{detail:Ia,context:{context:et}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:s.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");const n=t.globalContext.apstag.isGDPRRegion,o=t.use(It);return e.config.optOut?Ea(t):await Sa({account:t,hashedRecords:e.config.hashedRecords,ttl:e.config.ttl,isGDPRRegion:n,tcString:o?.tcString,setToken:e?.setCookie}),{status:s.completed}}})]),Fa=new Map([["ad/ASRSlot/render",async({account:t,customEvent:e})=>{if(void 0===e.detail?.id||void 0===e.detail?.targeting)throw new Error("Missing event detail");return((t,e,n,o)=>{const a=n.globalContext.document.createElement("iframe"),i=e.get("amznsz")?.split("x"),s=e.get("amzniid"),r=t;if(void 0===s||void 0===r||void 0===i||i.length<2)return;a.style.marginLeft="0",a.style.marginTop="0",a.style.height=`${i[1]}px`,a.style.width="100%",a.setAttribute("scrolling","no"),a.setAttribute("frameborder","0");const c=n.globalContext.document.createElement("div"),d=o?.location??"afterend",l=n.globalContext.document.getElementById(r);if(null==l)return;l.insertAdjacentElement(d,c),c.appendChild(a);const u=a?.contentWindow?.document;void 0!==u&&(u.open(),u.write('