/*! web-client-bundle - v25.916.1838 - 2025-09-16 18:38:43 */ !function(){"use strict";const t=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,128,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,8,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function e(t){const e=(new TextEncoder).encode(t);let n=2166136261;for(let t=0;t>>0}const n=(t,e=200)=>t.length<=e?t:`${t.substring(0,e)}...`;let o=!1;try{((t,e)=>{const o=new Set,s=[];try{const e=t.top?.location.hostname;e&&o.add(e)}catch(t){const e=t;s.push(n(e.message))}try{o.add(t.location.hostname)}catch(t){const e=t;s.push(n(e.message))}try{const e=t.location.href;o.add(new URL(e).hostname)}catch(t){const e=t;s.push(n(e.message))}try{const t=e.URL;o.add(new URL(t).hostname)}catch(t){const e=t;s.push(n(e.message))}if(0===o.size)throw new Error(`Unable to determine hostname: ${JSON.stringify(s)}`);return o})(window,document).forEach((n=>{o||(o=((t,n)=>{for(let o=0;o<5;o++){const s=e(t+o.toString())%8e3,r=s%8;if(!(n[Math.floor(s/8)]&1<{const e=this.globalContext.document.cookie.split("; ").reduce(((e,n)=>{const a=n.split("=");return a[0]===t?decodeURIComponent(a.slice(1).join("=")):e}),"");return e.length>0?e:null},this.removeItem=(t,e="/")=>{this.setItem(t,"",0,e)},this.setItem=(t,e,n,a="/")=>{const i=new Date(n);if(!this.isValidDate(i))throw new Error("Invalid expiration date");this.globalContext.document.cookie=`${t}=${e}; expires=${i.toUTCString()}; path=${a};`},this.globalContext=t}isValidDate(t){return t instanceof Date&&!isNaN(t)}}const l=["scope/objectName",t,e];function u(t){return null===t||"object"!=typeof t?t:t instanceof Date?new Date(t.getTime()):t instanceof Array?t.reduce(((t,e)=>(t.push(u(e)),t)),[]):t instanceof Set?Array.from(t.values()).reduce(((t,e)=>(t.add(u(e)),t)),new Set):t instanceof Map?Array.from(t.entries()).reduce(((t,e)=>(t.set(e[0],u(e[1])),t)),new Map):t instanceof Object?Object.keys(t).reduce(((e,n)=>(e[n]=u(t[n]),e)),{}):t}class p{constructor(t,e){const n=e.rootName;this.globalContext=e.globalContext;const a=this.globalContext[n].get(t);if(null==a)throw new Error(`Missing "${t}" account in userspace object`);this.id=t,this.store=a.store,this.queue=a.queue,this.store.has("listeners")||this.store.set("listeners",new Map)}async record(t,e){return await new Promise(((n,a)=>{this.queue.push(new CustomEvent(t,{detail:{resolve:n,reject:a,source:i.internal,...e}}))}))}async recordListener(t,e){return await new Promise(((n,a)=>{this.queue.push(new CustomEvent(t.name,{detail:{resolve:n,reject:a,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 a=e?.default?.generators?.get(t);return void 0!==a?a(...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 a=this.store.get(t.key);if(void 0!==a)n=a;else if(void 0!==e?.persist&&e.persist){const a=this.readLocalStorage(t.key,{usePrefix:!0,throwOnDisallowed:e.throwOnDisallowed});null!=a&&(n=a)}const i=n??t.default;if("function"==typeof i||!1===e?.structuredClone)return i;try{return structuredClone(i)}catch(t){try{return u(i)}catch(t){return ut.logCoreError({id:"Core.library.Account.use",account:null,error:t}),i}}}update(t,e,n){let a=e(this.use(t,{...n,throwOnDisallowed:n?.throwOnDisallowed}));if(void 0!==t.postProcessor&&(a=t.postProcessor(a)),this.store.set(t.key,a),void 0!==n?.persist&&n.persist){if("string"!=typeof a)throw new Error(`${JSON.stringify(a)} must be a string to be writtable to browser storage`);this.writeLocalStorage(t.key,a,{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){ut.logError({...t,account:this})}recordStatusChangeEvent(t){ut.logFeature({id:t.id,account:this,feature:t.status,analyticsSampleRateAdjustFactor:t.analyticsSampleRateAdjustFactor,props:{...t.props}})}recordGenericEvent(t){ut.logFeature({id:t.id,account:this,feature:t.id,analyticsSampleRateAdjustFactor:t.analyticsSampleRateAdjustFactor,props:{...t.props}})}isAllowedToAccessInfoOnDevice(){return this.updateUserConsent(),this.use(c)}isAPStagAllowedToAccessInfoOnDevice(){return!0===this.globalContext.apstag._atsaaiod()}updateUserConsent(){try{const t=this.isAPStagAllowedToAccessInfoOnDevice();this.update(c,(()=>t))}catch(t){}}getPersistedItemName(t){return`aps:${this.id}:${t}`}isBrowserStorageAllowed(t){let e=!1;try{e=this.isAllowedToAccessInfoOnDevice()}catch{}return e||l.includes(t)}setCookieStorage(t,e,n,a){const i=a?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(i)throw new Error(`${t} is not allowed to be set on cookie storage`);return}const o=a?.usePrefix?this.getPersistedItemName(t):t;return new d(this.globalContext).setItem(o,e,n,a?.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 a=e?.usePrefix?this.getPersistedItemName(t):t;return new d(this.globalContext).getItem(a)}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 a=e?.usePrefix?this.getPersistedItemName(t):t;return this.globalContext.localStorage.getItem(a)??void 0}writeLocalStorage(t,e,n){const a=n?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(a)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 i=n?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.localStorage.setItem(i,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 a=e?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.localStorage.removeItem(a)}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 a=e?.usePrefix?this.getPersistedItemName(t):t;if(a in this.globalContext.sessionStorage)return this.globalContext.sessionStorage.getItem(a)}writeSessionStorage(t,e,n){const a=n?.throwOnDisallowed??!0;if(!this.isBrowserStorageAllowed(t)){if(a)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 i=n?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.sessionStorage.setItem(i,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 a=e?.usePrefix?this.getPersistedItemName(t):t;this.globalContext.sessionStorage.removeItem(a)}}const m="_system";class f extends p{constructor(t,e){super(m,{globalContext:t,rootName:e})}}const h="listeners",v="_internal/history",g="_internal/pageLoadID",y="_internal/externalEventCount";class w{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(m)&&(this.getAccounts().set(m,{queue:[],store:new Map}),new f(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 a=this.getAccounts().get(t);void 0!==a&&a.queue.push(new CustomEvent(e,{detail:n??{}}))},e=this.globalContext[this.rootName];e.triggerFor=t,e.trigger=(e,n)=>{t(m,e,n)},void 0===e._private&&(e._private={}),e._private.CookieStorage=d}equip(){try{this.createUserspaceRoot(),this.createSystemAccount(),this.observeRootSet(),this.observeAccountQueuesPush(),this.overwriteAccountStoresGet(),this.defineConvenienceFunctions()}catch(t){throw new f(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Equiper.equip",error:t}),t}}}var b;!function(t){t.info="info",t.warn="warn",t.error="error"}(b||(b={}));class E{static Instance(){return this.i}static SessionId(){return this.o}info(...t){const e=new Date(Date.now()),n=b.info;return console.log(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}warn(...t){const e=new Date(Date.now()),n=b.warn;return console.warn(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}error(...t){const e=new Date(Date.now()),n=b.error;return console.error(this.getPrefix(e,n),...t),{timestamp:e,logLevel:n}}getPrefix(t,e){return`${t.toISOString()} | ${E.SessionId()} | [${e.toUpperCase()}]`}}E.i=new E,E.o=`${Date.now()}`;const S=E.Instance(),x="25.916.1838",_=t=>{if(void 0===t||!Array.isArray(t))return!0;let e,n=window;do{if(t.includes(n?.location?.hostname))return!0;if(n===window.top)break;e=n,n=n.parent}while(e!==n&&e!==window.top);return!1};function R(t){return!(t>=1||Number.isNaN(t))&&(t<=0||Math.random()>=t)}function A(){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 I={key:"_internal/eventSources",default:new Map},$={key:"_internal/processedEventSources",default:new Set},k=[r.completed,r.error,r.cancelled,r.analytics];class j{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&&!_(e))return!0;const n=t.detail?.restrictions?.block?.hostnames;if(void 0!==n&&_(n))return!0}catch(t){return e.recordErrorEvent({id:"hostnames",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(x))||!(!Array.isArray(e)||e.includes(x))})(e)||((t,e)=>{const n=t?.detail?.restrictions?.allow?.accounts,a=t?.detail?.restrictions?.block?.accounts;return!(!Array.isArray(a)||!a.includes(e.id))||!(!Array.isArray(n)||n.includes(e.id))})(e,t)||(t=>{const e=t?.detail?.restrictions?.allow?.rate??1;return!(!R(t?.detail?.restrictions?.block?.rate??1)&&!R(e))})(e)}m(){return new f(this.globalContext,this.rootName).store.get(h)??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(y);return(void 0===t.externalEventCount||t.externalEventCount{setTimeout((()=>n(new Error(`Event "${e.type}" timed out`))),e.detail.timeout)})))}$(t,e){const n=new f(this.globalContext,this.rootName),a=n.read(t)??0;n.write(t,a+e)}j(t){new f(this.globalContext,this.rootName).write(t,0)}R(t){return new f(this.globalContext,this.rootName).read(t)??0}D(t,e,n,i,o){if(!(e in r))throw new Error(`Listener returned invalid status: ${t.type} returned ${e}`);if(this.C(t,e,i,o),e!==r.waiting&&void 0!==t.detail?.resolve)try{t.detail.resolve(n)}catch(t){S.error(t)}this.t({reason:{method:a.listenerSuccess,events:[t]}})}O(t,e,n){void 0!==e&&"string"!=typeof e||(e=new Error(e)),this.C(t,r.error,n),this.P(t,e),e.context=t.type,n.recordErrorEvent({id:t.type,analyticsSampleRateAdjustFactor:t.detail?.analyticsSampleRateAdjustFactor,error:e})}L(t,e,n,a){const i=this.S(n,e);if(void 0===i)throw new Error(`No listener found for event: ${e.type}`);t.push(i({customEvent:e,account:n,systemAccount:a,detail:e.detail,context:n.globalContext}))}N(t,e,n){Promise.race(t).then((t=>{let a,i,s;void 0===t?a=o.completed:"string"==typeof t?a=t:"object"==typeof t&&(a=t.status,i=t.value,s=t.analytics,!0===e.detail?.surfaceAnalytics&&(void 0===i&&(i={}),i.analytics=s)),this.D(e,a,i,n,s)})).catch((t=>{this.O(e,t,n)}))}T(t,e,n){const a=[];this.L(a,t,e,n),this.I(a,t),this.N(a,t,e)}M(t,e){if(void 0!==t.status)return;const n=t.detail?.error;if(void 0!==n){t.status=r.error;const a=this.U(n),i={id:t.type,analyticsSampleRateAdjustFactor:t.detail?.analyticsSampleRateAdjustFactor,error:a,props:{...t.detail.analytics,eventDetailSource:t.detail.source}};"string"==typeof t.detail.libraryVersion&&(i.libraryVersion=t.detail.libraryVersion),e.recordErrorEvent(i)}}U(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}q(t,e){if(void 0!==t.status)return;const n=t.detail?.analytics;void 0!==n&&(t.status=r.analytics,e.recordStatusChangeEvent({id:t.type,status:t.status,analyticsSampleRateAdjustFactor:t.detail?.analyticsSampleRateAdjustFactor,props:{...n}}))}F(t,e){this.p(e,t)&&this.C(t,r.deactivated,e)}V(t,e){void 0===t.status&&void 0===this.S(e,t)&&this.C(t,r.unknown,e)}P(t,e){if(A()&&S.error(e),void 0!==t.detail?.reject)try{t.detail.reject(e)}catch(t){S.error(t)}}J(t,e){const n=new Error(`Invalid account ID: "${e.id}"`);this.O(t,n,e)}static B(t){return"string"==typeof t&&!["","undefined","true","false"].includes(t.trim())}G(t,e,n){j.B(e.id)?(this.M(t,e),this.q(t,e),this.V(t,e),this.F(t,e),this.A(t)&&(this.C(t,r.started,e),A()&&S.info(`## Execute event: ${t.type} with initial status ${t.status??"undefined"}`),this.T(t,e,n))):this.J(t,e)}H(t){const e=new f(this.globalContext,this.rootName).use(I),n=t.use($);e.forEach(((e,a)=>{if(n.has(a))return;const i=e.map((([t,e])=>new CustomEvent(t,{detail:e})));t.queue.unshift(...i),t.update($,(t=>t.add(a)))}))}K(t,e,n){this.H(t),t.queue.forEach((n=>this.G(n,t,e)))}W(t,e){t.status=e,t.statusEvents=null!=t.statusEvents?t.statusEvents:[],t.statusEvents.push(new CustomEvent(e))}Y(t,e,n,a){const i=new CustomEvent("now").timeStamp,o=t.statusEvents?.find((t=>t.type===r.started)),s=null!=o?i-o.timeStamp:void 0;n.recordStatusChangeEvent({id:t.type,status:e,analyticsSampleRateAdjustFactor:t.detail?.analyticsSampleRateAdjustFactor,props:{...a,source:t.detail?.source,timers:{sinceCreated:i-t.timeStamp,sinceStarted:s}}})}C(t,e,n,a){t.status!==e&&(A()&&S.info(`### Update ${t.type} from ${t.status??"undefined"} to ${e}`),this.W(t,e),this.Y(t,e,n,a))}Z(){const t=new Map;return this.globalContext[this.rootName].forEach(((e,n)=>t.set(n,new p(n,{globalContext:this.globalContext,rootName:this.rootName})))),t}X(t){if(A())return;const e=t.store.get(v)??[];if(e.length>150){const n=e.slice(-100);t.store.set(v,n)}}tt(t){const e=t.store.get(v)??[];e.push(...t.queue.filter((t=>void 0!==t.status&&k.includes(t.status)))),t.store.set(v,e)}et(t){t.queue.splice(0,t.queue.length,...t.queue.filter((t=>void 0===t.status||!k.includes(t.status))))}nt(){this.Z().forEach((t=>{this.tt(t),this.X(t),this.et(t)}))}it(t){return t?.filter((t=>t.detail?.source!==i.internal&&t.detail?.source!==i.apstag&&t.status!==r.waiting))}ot(t){const e=this.it(t);return e?.length??0}st(t){const e=this.ot(t);this.$(y,e)}rt(){const t="_internal/recentDispatches";this.$(t,1);const e=this.R(t);if(e>1e4)throw new Error("Too many dispatches. Aborting");e%100==0&&new f(this.globalContext,this.rootName).recordGenericEvent({id:"C.l.D.thr",props:{recentDispatchesCount:e}}),setTimeout((()=>{this.j(t)}),100)}t({reason:t}){try{this.rt(),A()&&S.info(`# Dispatch from method "${t.method}" on event "${t.events?.[0].type??"undefined"}" with source "${t.events?.[0].detail?.source??"undefined"}"\n_________________________________________`),this.st(t.events);const e=new f(this.globalContext,this.rootName);this.Z().forEach((n=>this.K(n,e,t))),this.nt()}catch(t){throw new f(this.globalContext,this.rootName).recordErrorEvent({id:"C.l.D.dis",error:t}),t}}}class D{constructor(t,e){this.globalContext=t,this.rootName=e}subscribe(t){try{const e=new f(this.globalContext,this.rootName),n=null!=e.store.get(h)?e.store.get(h):new Map;e.store.set(h,new Map([...n,...t]))}catch(t){throw new f(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Subscriber.subscribe",error:t}),t}}}class C{constructor(t,e){this.globalContext=t,this.rootName=e}populate(){try{const t=new f(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 f(this.globalContext,this.rootName).recordErrorEvent({id:"Core.library.Populator.populate",error:t})}}populateFromPrependStore(){this.globalContext[this.rootName].forEach(((t,n)=>{const a=new p(n,{globalContext:this.globalContext,rootName:this.rootName}),i=a.read(e,{persist:!0})??"[]";a.write(e,JSON.stringify([]));try{const t=JSON.parse(i);if(0===t.length)return;a.queue.push(...t.map(P))}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],a=n.get(m);O(e,"aps.trigger").forEach((t=>{a.queue.push(P(t))})),O(e,"aps.triggerFor",!0).forEach((t=>{void 0!==t.accountId&&n.has(t.accountId)&&n.get(t.accountId).queue.push(P(t))}));const i=O(e,"aps_event");n.forEach((t=>{i.forEach((e=>{t.queue.push(P(e))}))}))}}const O=(t,e,n=!1)=>{const a=t.getAll(e),i=[];return a.forEach((t=>{const e=t.split(",");let a;n&&(a=e.shift());const o=e.shift();if(void 0!==o&&o.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",o,n)}i.push({eventName:o.replace(/_/g,"/"),eventDetail:n,accountId:a})}})),i},P=t=>new CustomEvent(t.eventName,{detail:{...t.eventDetail??{}}}),L=window;class N{constructor(t,e,n){this.ID=t,this.rootName=n,this.globalContext=e,this.clear()}clear(){new f(this.globalContext,this.rootName).update(I,(t=>(t.delete(this.ID),t)))}recordListener(t,e){new f(this.globalContext,this.rootName).update(I,(n=>{const a=n.get(this.ID);return void 0!==a?a.push([t.name,e]):n.set(this.ID,[[t.name,e]]),n}))}}class T{constructor(t=L,e="_aps"){this.dispatcher=new j(t,e),this.equiper=new w(t,e,this.dispatcher),this.subscriber=new D(t,e),this.populator=new C(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 p(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 N(t,this.globalContext,this.rootName)}}var M;!function(t){t.postulate="postulate",t.genericError="error"}(M||(M={}));const U="25.916.1838";function q(t,e,n){const a=new URL("https://prod.tahoe-analytics.publishers.advertising.a2z.com/logevent/putRecord");let i=t;try{"web-client-scenarios.aps.amazon.dev"===n?.hostname?i=t+"-debug-only":window.Cypress&&(i=t+"-integration-test")}catch(t){}const o={...n,eventSource:"aps_web_client_library",eventCategory:i,eventName:e,libraryVersion:U};Object.entries(o).forEach((([t,e])=>{a.searchParams.append(t,e)})),fetch(a.toString(),{method:"GET",keepalive:!0,headers:{"x-api-key":"79db72eb0b5c7255afa54a253df24fb4a5ac916bf40b51c730df8850aa5665ca"}}).catch((()=>{}))}const F={ct:setInterval,lt:function(){return window[z]?.[V]},ut:function(t=window){try{return t.top?.location||{href:"unknown",hostname:"unknown"}}catch(t){return{href:"unknown",hostname:"unknown"}}},ft:q,ht:function(t,e){return{eventTime:J((()=>`${Date.now()}`)),accountID:J((()=>t?.accountID)),libraryVersion:U,url:J((()=>e().href)),hostname:J((()=>e().hostname)),message:J((()=>t?.message)),condition:J((()=>t?.condition))}},vt:function(t,e){try{(e??q)(M.genericError,"telemetry_core_failure",{errorName:t?.name??"unknown",errorMessage:t?.message??"unknown"})}catch{(e??q)(M.genericError,"telemetry_core_failure")}}},z="_aps_telemetry",V="alarms";function J(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 B(t,e,n){const a=()=>!1;throw n||function(t,e,n){const a=window;void 0===a[z]&&(a[z]={}),void 0===a[z][V]&&(a[z][V]=[]);const i=a[z][V],o=e.toString();i.push({hash:t,context:{...n,condition:o}})}(t,a,e),new Error(e?.message??`Postulate violation: ${t}, ${a}`)}const G=new WeakMap;function H(t,e,n="root",a="."){const i={nonModifiable:{set(t,e){throw new Error(`Cannot set property "${String(e)}": "${n}" is not marked as modifiable.`)},deleteProperty(t,e){throw new Error(`Cannot delete property "${String(e)}": "${n}" is not marked as modifiable.`)},defineProperty(t,e){throw new Error(`Cannot define property "${String(e)}": "${n}" is not marked as modifiable.`)},setPrototypeOf(t){throw new Error(`Cannot set prototype: "${n}" is not marked as modifiable.`)}},modifiable:{set(t,e,n,a){try{return Reflect.set(t,e,n,a)}catch(a){if("TypeError"===a.name)return t[e]=n,!0;throw a}}},validating:{get(t,i,o){if("raw"===i)return G.get(o)||t;if("symbol"==typeof i)return Reflect.get(t,i,o);if((t=>{if(["asymmetricMatch","nodeType"].includes(t))return!0})(i))return Reflect.get(t,i,o);let s;try{s=Reflect.get(t,i,o)}catch(e){if("TypeError"!==e.name)throw e;s=t[i]}return H(s,e,`${n}${a}${String(i)}`)},ownKeys:t=>Reflect.ownKeys(t).filter((t=>{const i=`${n}${a}${String(t)}`;return void 0!==e[i]}))},function:{apply:(t,a,i)=>{const o=G.has(a)?G.get(a):a;return H(t.apply(o,i),e,`${n}()`)},get:(t,e,n)=>"raw"===e?G.get(n)||t:Reflect.get(t,e,n)}},o=function(a){if(!1===a.verifiable)return t;if(t instanceof Set)return t.forEach((t=>{H(t,e,`${n}.value`)})),t;if(t instanceof Map)return t.forEach(((t,a)=>{H(a,e,`${n}.key`),H(t,e,`${n}.value`)})),t;if(Array.isArray(t))return t.map((t=>H(t,e,`${n}[]`)));if("function"==typeof t){const e=new Proxy(t,i.function);return G.set(e,t),e}const o={...i.validating,...a?.modifiable?i.modifiable:i.nonModifiable};try{const e=new Proxy(t,o);return G.set(e,t),e}catch(e){if("TypeError"===e.name)return t;throw e}}(function(){const a=e[n];if(void 0===a){const t=".constructor"===(n??"").slice(-12)||".toString"===(n??"").slice(-9);B("ea3914",{message:`Unauthorized usage for "${n}": No validator has been defined`},t)}if(null===a)return{verifiable:!1};let i;try{i=a(t,n)}catch(e){let a="Error, could not convert to string";try{a="string"==typeof t?'"'+t+'"':null!=t&&"function"==typeof t.toString?t.toString():Object.prototype.toString.call(t)}catch(t){}throw new Error(`Validation failed for "${n}": ${e.message} - Received: ${a}`)}return i??{}}());return o}const K=t=>{if("number"!=typeof t)throw new Error("must be a number")},W=t=>{if("string"!=typeof t)throw new Error("must be a string")},Q=t=>{if("boolean"!=typeof t)throw new Error("must be a boolean")},Y=t=>{if("object"!=typeof t||null===t||Array.isArray(t))throw new Error("must be a standard object")},Z=t=>e=>{let n=!1;for(const a of t)try{a(e),n=!0}catch(t){}if(!n)throw new Error("None of the validators passed")},X=t=>{if(!Array.isArray(t))throw new Error("must be an array")};function tt(t){return e=>{if(!1===t.includes(e))throw new Error(`must be one of the following values: ${JSON.stringify(t)}`)}}function et(t){return(e,n)=>({modifiable:!0,...t(e,n)})}function nt(t){return(e,n)=>{if(t===it)throw new Error("isAny cannot be used within isOptional");if(null!=e)return t(e,n)}}const at=t=>{if("function"!=typeof t)throw new Error("must be a function")},it=()=>{},ot=()=>({verifiable:!1}),st=t=>{if(void 0!==t)throw new Error("must be undefined")};class rt{constructor(t){const{scope:e,object:n,action:a,validators:i,handler:o}=t;this.throwIfInvalid(e,n,a),this.name=`${e}/${n}/${a}`,this.handler=this.wrapHandler(o,i)}wrapHandler(t,e){return async n=>{let a=n;return a={...a,detail:H(a.customEvent.detail,e?.detail??{detail:it},"detail"),context:H(a.account.globalContext,e?.context??{context:it},"context")},await t(a)}}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 a=/^[a-z0-9][a-zA-Z0-9]*$/;if(!a.test(t)||!a.test(e)||!a.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 ct(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 dt{constructor(){this.gt=300,this.yt="https://prod.tahoe-analytics.publishers.advertising.a2z.com/logevent/putRecords",this.wt="79db72eb0b5c7255afa54a253df24fb4a5ac916bf40b51c730df8850aa5665ca",this.bt=5e3,this.Et=[],this.clearAndUpdateEventProcessingInterval(5e3)}logEvent(t){try{const n=`${Date.now()}`,a=null==(e=t.eventSampleRate)||isNaN(e)||e<0?0:e>=0&&e<=1?e:1,i={Data:{eventSource:"aps_web_client_library",eventTime:n,eventCategory:t.eventCategory,eventName:t.eventName,eventSampleRate:a,eventProperties:{...t.eventProperties,eventSampleRate:`${a}`}},PartitionKey:n};this.Et.push(i)}catch(t){B("4daf34",{message:t.message})}var e;this.Et.length>this.bt&&this.safelyProcessRecordQueue()}clearAndUpdateEventProcessingInterval(t){"number"!=typeof t||t<=0||t!==this.St&&(clearInterval(this.xt),this.xt=setInterval((()=>this.safelyProcessRecordQueue()),t),this.St=t)}safelyProcessRecordQueue(){if(void 0===this.Et||this.Et.length<=0)return;const t=this.Et.filter((t=>void 0!==t&&t.Data.eventSampleRate>=Math.random()));this.Et.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 lt={key:"_config/requestViewer/countryCode",default:"unknown"},ut=new class{constructor(){this.STACK_MAX_LENGTH=500,this._t=.001,this.Rt=1e-4,this.At=new dt}fireReferencePixel(t){this.logCoreError({id:`REFERENCE-${t}`,error:new Error(`REFERENCE-${t}`),analyticsSampleRateAdjustFactor:{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.At.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.At.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.At.clearAndUpdateEventProcessingInterval(t)}setEventSamplingRates(t){const e=t=>t<0?0:t>=0&&t<=1?t:1;"number"==typeof t?.error&&(this._t=e(t.error)),"number"==typeof t?.feature&&(this.Rt=e(t.feature))}getEventSampleRate(t){let e=0;return e="error"===t.eventCategory?this._t*(t.rateFactor?.error??1):this.Rt*(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??x,url:this.getLocationHref(),hostname:this.getLocationHostname(),viewerCountryCode:this.getViewerCountryCode(t.account)}}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(lt))}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}},pt=new Map([["_config/config/didLoad",async({account:t,customEvent:e})=>(t.write("config/loaded",!0),o.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(lt,(()=>n)),o.completed}]]),mt="apstag/configuration/fetch",ft=new Map([[mt,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)}))})),o.completed}]]),ht="consent/isGPPListenerRegistered";var vt=new rt({scope:"consent",object:"gppapi",action:"syncData",validators:{detail:{detail:Y,"detail.fromAddEvent":nt(Q),"detail.eventListener":nt(Y),"detail.eventListener.pingData":nt(Y),"detail.eventListener.pingData.gppString":nt(W),"detail.eventListener.pingData.gppVersion":nt(Z([W,K])),"detail.eventListener.pingData.cmpId":nt(Z([W,K])),"detail.eventListener.pingData.applicableSections":X,"detail.eventListener.pingData.applicableSections[]":Z([W,K])}},handler:async({account:t,detail:e})=>{let n,a,i,s;(e?.eventListener?.pingData?.gppString??"").length>0?(n=e?.eventListener?.pingData,s="addEventListener"):([n,i]=(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),s="ping","object"!=typeof n&&([n,a]=(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),s="getGPPData"));const r={gpp:{gppLength:"string"==typeof n?.gppString?n.gppString.length:void 0,isGPPTilde:(n?.gppString??"").includes("~"),error10:a,error:i,gppVersion:n?.gppVersion,cmpId:n?.cmpId,method:s,fromAddEvent:e?.fromAddEvent}};return t.write("consent/GPPData",n),{status:o.completed,analytics:r}}}),gt=new rt({scope:"consent",object:"gppapi",action:"didChange",validators:{detail:{detail:Y,"detail.fromAddEvent":nt(Q),"detail.eventListener":nt(Y),"detail.eventListener.pingData":nt(Y),"detail.eventListener.pingData.gppString":nt(W),"detail.eventListener.pingData.gppVersion":nt(Z([W,K])),"detail.eventListener.pingData.cmpId":nt(Z([W,K])),"detail.eventListener.pingData.applicableSections":X,"detail.eventListener.pingData.applicableSections[]":Z([W,K])}},handler:async({account:t,detail:{eventListener:e,fromAddEvent:n}})=>(await t.recordListener(vt,{eventListener:e,fromAddEvent:n}),{status:o.completed})}),yt=new rt({scope:"consent",object:"gppapi",action:"attemptSync",handler:async({account:t})=>{if(void 0===t.globalContext.__gpp||!0===t.read(ht))return{status:o.cancelled};await t.recordListener(vt);const e=t.globalContext.__gpp("addEventListener",(e=>{"error"!==e?.eventName&&t.recordListenerNonBlocking(gt,{eventListener:e,fromAddEvent:!0})}));return t.write(ht,"listenerRegistered"===e?.eventName&&!0===e?.data),{status:o.completed}}});const wt={key:"consent/isTCFAPIListenerRegistered",default:!1},bt={key:"consent/TCData",default:void 0};function Et(t,e){return"string"==typeof e?.tcString&&e?.tcString.length>0||!0===t?.globalContext?.apstag?.isGDPRRegion||!0===e?.gdprApplies}function St(t,e){return!0===t.vendor?.consents?.[793]&&(n=e,a=t.purpose?.consents,(n??[]).reduce(((t,e)=>t&&!0===a?.[e]),!0));var n,a}var xt=new rt({scope:"consent",object:"tcfapi",action:"didChange",validators:{detail:{detail:Y,"detail.success":nt(Q),"detail.tcData":nt(Z([W,Y])),"detail.tcData.tcString":nt(W),"detail.tcData.tcfPolicyVersion":nt(K),"detail.tcData.cmpId":nt(K),"detail.tcData.cmpVersion":nt(K),"detail.tcData.useNonStandardStacks":nt(Q),"detail.tcData.gdprApplies":nt(Q),"detail.tcData.eventStatus":nt(W),"detail.tcData.cmpStatus":nt(W),"detail.tcData.listenerId":nt(K),"detail.tcData.isServiceSpecific":nt(Q),"detail.tcData.useNonStandardTexts":nt(Q),"detail.tcData.publisherCC":nt(W),"detail.tcData.purposeOneTreatment":nt(Q),"detail.tcData.purpose":nt(Y),"detail.tcData.purpose.consents":nt(ot),"detail.tcData.purpose.legitimateInterests":nt(ot),"detail.tcData.vendor":nt(Y),"detail.tcData.vendor.consents":nt(ot),"detail.tcData.vendor.legitimateInterests":nt(ot),"detail.tcData.specialFeatureOptins":nt(ot),"detail.tcData.publisher":nt(Y),"detail.tcData.publisher.consents":nt(ot),"detail.tcData.publisher.legitimateInterests":nt(ot),"detail.tcData.publisher.customPurpose":nt(Y),"detail.tcData.publisher.customPurpose.consents":nt(ot),"detail.tcData.publisher.customPurpose.legitimateInterests":nt(ot),"detail.tcData.publisher.restrictions":nt(ot)}},handler:async({account:t,detail:{success:e,tcData:n}})=>(t.update(wt,(t=>t||!0===e)),t.update(bt,(t=>void 0!==n||!0===e?n:t)),"object"!=typeof n?{status:o.completed}:{status:o.completed,analytics:_t(t,n)})});const _t=(t,e)=>{const n={tcData:e,consents:[1]},a=t=>{try{return t()}catch{return"error"}};return{tcT:a((()=>t.isAPStagAllowedToAccessInfoOnDevice())),tcCC:a((()=>function({account:t,tcData:e,consents:n}){if(!Et(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 a=!1;return n.forEach((t=>{const i=e.publisher?.restrictions?.[t]?.[793];switch(i){case 0:case 2:a=!0;break;default:St(e,n)||(a=!0)}})),!a}({...n,account:t}))),tcCF:a((()=>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((a=>{const i=t.publisher?.restrictions?.[a]?.[793];switch(i){case 0:n.push(`Invalid publisher restrictions 0, consent ${a}`);break;case 2:n.push(`Invalid publisher restrictions 2, consent ${a}`);break;default:St(t,e)||n.push(`Invalid publisher restrictions default, consent ${a}`)}})),n)}catch(t){if(n.length>0)return n;throw t}}(n).length)),PRA:a((()=>Et(t,e)))}};var Rt=new rt({scope:"consent",object:"tcfapi",action:"attemptSync",handler:async({account:t})=>{const e=t.use(wt);return void 0===t.globalContext.__tcfapi||e?{status:o.cancelled}:(t.globalContext.__tcfapi("addEventListener",2,((e,n)=>{t.recordListenerNonBlocking(xt,{tcData:e,success:n})})),{status:o.completed})}});const At=ct([yt,gt,vt,Rt,xt]),It="vnd_prx_segments",$t="aps_targeting_comscore";var kt=new rt({scope:"cxm",object:"comscore",action:"set",handler:async({account:t,customEvent:e})=>({status:jt(t)})});const jt=t=>{const e=t.readSessionStorage($t);if(t.deleteSessionStorage($t),null==e)return o.cancelled;try{const n=JSON.parse(e)[It];if(null==n)throw new Error;const{googletag:a}=t.globalContext;return a.pubads().getSlots().forEach((t=>{t.setTargeting(It,n)})),o.completed}catch(t){throw new Error(`Malformed targeting object at ${$t}`)}},Dt="aps_targeting_ias";var Ct=new rt({scope:"cxm",object:"ias",action:"set",handler:async({account:t,customEvent:e})=>({status:Ot(t)})});const Ot=t=>{const e=(t=>{const{iasApsArtifact:e}=t.globalContext;if(e)return e;const n=t.readSessionStorage(Dt);return n?(t.deleteSessionStorage(Dt),JSON.parse(n)):void 0})(t);if(null==e)return o.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:a,fr:i,custom:s}=e.targeting;return null!=a&&Object.keys(a).forEach((t=>{n.pubads().setTargeting(t,a[t])})),null!=s&&Object.keys(s).forEach((t=>{const e=s[t];n.cmd.push((()=>n.pubads().setTargeting(t,e)))})),null!=i&&n.pubads().setTargeting("fr",i),o.completed}catch(t){throw new Error(`Malformed targeting object at ${Dt}`)}},Pt="aps_targeting_illuma";var Lt=new rt({scope:"cxm",object:"illuma",action:"set",handler:async({account:t,customEvent:e})=>({status:Nt(t)})});const Nt=t=>{const e=t.readSessionStorage(Pt);if(t.deleteSessionStorage(Pt),null==e)return o.cancelled;const n=JSON.parse(e).results;if(null==n)throw new Error(`Malformed targeting object at ${Pt}`);const{googletag:a}=t.globalContext;return Object.keys(n).forEach((t=>{const e=n[t];a.pubads().setTargeting(`illuma_${t}`,JSON.stringify(e))})),o.completed};var Tt=new rt({scope:"cxm",object:"contextual",action:"set",handler:async({account:t,customEvent:e})=>(await Promise.all([t.recordListener(kt),t.recordListener(Ct),t.recordListener(Lt)]),{status:o.completed})});const Mt=ct([kt,Tt,Ct,Lt]),Ut={key:"customPlacement/hints",default:{}},qt={key:"customPlacement/bidResponses",default:{}};class Ft{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-",a=new Map;return a.set(`${n}width`,e.width),a.set(`${n}margin`,e.margin),a.set(`${n}padding`,e.padding),Object.fromEntries(a.entries())}catch(t){return{}}},this.slotProps=t,this.rawResponse=e,this.It=n}getTagStyle(t){const e=this.It.getElementsByTagName(t);if(e&&e[0]){const e=window.getComputedStyle(this.It.getElementsByTagName(t)[0]),n=new Map,a="--aps-custom-page-";return n.set(`${a}${t}-color`,e.color),n.set(`${a}${t}-fontFamily`,e.fontFamily),n.set(`${a}${t}-fontSize`,e.fontSize),n.set(`${a}${t}-fontWeight`,e.fontWeight),n.set(`${a}${t}-lineHeight`,e.lineHeight),Object.fromEntries(n)}return{}}getDynamicFrameBodyHeight(t,e,n){if(e){const n=e?.contentDocument||e?.contentWindow?.document,a=n?.body.scrollHeight;e.style.height=`${a}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.$t(t)}$t(t){if(!this.rawResponse||!this.slotProps)return!1;try{const e=this.rawResponse.size.split("x"),n=this.rawResponse.targeting?.amzniid||this.rawResponse.amzniid,a=this.rawResponse.targeting?.amznadm||this.rawResponse.amznadm;if(!n)return!1;let i=this.slotProps.kt;if(this.slotProps.location&&this.slotProps.id){const t=this.It.createElement("div");this.It.getElementById(this.slotProps.id)?.insertAdjacentElement(this.slotProps.location,t),i=t}if(!i)return!1;const o=this.It.createElement("iframe");return o.style.marginLeft="0",o.style.marginTop="0",o.style.height=`${e[1]}px`,o.style.width="100%",o.setAttribute("data-testid","amzn-asr-ad"),o.setAttribute("scrolling","no"),o.setAttribute("frameborder","0"),o.onload=()=>this.getDynamicFrameBodyHeight(i,o,a?"amznadm":"admi"),o.srcdoc=a||"",t&&t.clickPrefix&&(o.srcdoc=o.srcdoc.replace(this.CLICK_PREFIX_MACRO,t.clickPrefix)),i.appendChild(o),this.updateSlotAttribute("status","rendered"),!0}catch(t){throw new Error("CustomPlacements: Error while rendering")}}updateSlotAttribute(t,e){this.slotProps.kt?.setAttribute(`data-aps-custom-${t}`,e)}}const zt={key:"customPlacement/timings",default:[]},Vt=(t,e,n=0,a=0)=>{try{const i={effectiveType:e?.effectiveType,rtt:e?.rtt,downlink:e?.downlink},o=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,a);return{connection:i,screen:o}}catch(t){return{}}},Jt=(t,e,n)=>{t.update(zt,(t=>(t.push({time:performance.now(),key:`${e}/${n}`}),t)))},Bt="customPlacements";var Gt=new rt({scope:"customPlacement",object:"hint",action:"process",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{const a=e=>{Jt(t,Bt,`hint/process/${e}`);const n=t.use(Ut),a=t.use(qt);n[e].isRendered||(Object.values(a).forEach((a=>{if(a.isRendered)return;const i=t.globalContext.document.getElementById(e);if(null==i)return;const o=new Ft({id:e,kt:i},a,t.globalContext.document);Jt(t,Bt,`widget/render/${e}`),o.render(n[e].hintMetadata)&&(a.isRendered=!0,n[e].isRendered=!0)})),t.update(Ut,(()=>n)),t.update(qt,(()=>a)))},i=t.use(Ut);return Object.keys(i).filter((t=>i[t].default)).forEach(a),Object.keys(i).filter((t=>!i[t].default)).forEach(a),{status:o.completed,analytics:{browserInfo:Vt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}}),Ht=new rt({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:a,isDefault:i,hintMetadata:s}=n.detail;Jt(t,Bt,`hint/define/${a}`);const r=t.use(Ut);return r[a]={default:"default"===i,isRendered:!1,hintMetadata:s??{}},t.update(Ut,(()=>r)),t.recordListenerNonBlocking(Gt),{status:o.completed,analytics:{browserInfo:Vt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}});const Kt={key:"customPlacement/placementResponseDispatched",default:!1},Wt={key:"customPlacement/placementResponse",default:void 0},Qt={key:"customPlacement/contextURL",default:void 0},Yt={key:"customPlacement/placementEndpoint",default:"https://c.aps.amazon-adsystem.com/e/placements"},Zt={key:"ad/context",default:void 0};var Xt=new rt({scope:"customPlacement",object:"placement",action:"fetch",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{Jt(t,Bt,"placementFetch/start");const a=await async function(t){const e={ortb2:te(t)},n=t.use(Qt),a=t.use(Yt),i=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),o=encodeURIComponent(JSON.stringify(e)),s=await fetch(`${a}?account=${t.id}&u=${i}&sg=${o}`);return await s.json()}(t);return Jt(t,Bt,"placementFetch/end"),{status:o.completed,value:{placementResponse:a},analytics:{browserInfo:Vt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}}}});function te(t){const e=t.use(Zt);if(void 0!==e&&"user"in e){const{user:t,...n}=e;return n}return e}const ee={key:"customPlacement/bidEndpoint",default:"c.aps.amazon-adsystem.com"},ne={key:"customPlacement/bidIsKey",default:"86355855cc6ed9e335d0382c8563aa10"};var ae=new rt({scope:"customPlacement",object:"bids",action:"fetch",validators:{},handler:async({account:t,detail:e,customEvent:n})=>{const a=Vt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight);if(void 0===t.globalContext.apstag?.clientFetchBids)return{status:o.waiting,analytics:{browserInfo:a}};Jt(t,Bt,"fetchBids/start");const i=await async function(t){const e={slots:[{slotID:"93b7dd52-a8ce-11ed-afa1-0242ac120002:1",sizes:[[999,999]]}],timeout:6e4,_endpointDomain:t.use(ee),params:{program:"apscustom",is:t.use(ne)}},n={pubID:t.id,isSelfServePub:36===t.id.length,deals:!0},a=t.use(Qt);return await new Promise((i=>{t.globalContext.apstag?.clientFetchBids(e,(t=>{i(t)}),{initConfig:n,contextURL:a})}))}(t);return Jt(t,Bt,"fetchBids/end"),{status:o.completed,value:{bidResponses:i},analytics:{browserInfo:a}}}}),ie=new rt({scope:"customPlacement",object:"service",action:"enable",validators:{},handler:async({account:t,detail:e,customEvent:n})=>(Jt(t,Bt,"service/enable"),t.update(Kt,(()=>!1)),await Promise.all([t.recordListener(Xt).then((({placementResponse:e})=>{oe(t,!0,e),t.update(Wt,(()=>e))})),t.recordListener(ae).then((({bidResponses:e})=>{e.forEach((e=>{const n=e.targeting?.amzniid??e.amzniid;let a=!1;if(""!==n){const i=t.use(qt);i[n]=e,t.update(qt,(()=>i)),a=!0}oe(t,!1,{aps:[{active:a,dispatchEventOnValidBid:!0}]})}))})).then((()=>{t.recordListenerNonBlocking(Gt)}))]),{status:o.completed,analytics:{browserInfo:Vt(t.globalContext.document,t.globalContext.navigator?.connection,t.globalContext.innerWidth,t.globalContext.innerHeight)}})});function oe(t,e,n){if(t.use(Kt))return;const a=n?.aps?.find((t=>t.dispatchEventOnValidBid));e&&void 0!==a||(Jt(t,Bt,"placementResponseEvent/dispatch"),t.record("customPlacement/placement/didRespond",n).catch((t=>{})),t.update(Kt,(()=>!0)))}const se=new Map([...ct([Ht,ae,Gt,ie,Xt])]);class re extends Error{constructor(t){super(t.message),this.message=`Could not read vendor data because: "${t.message}"`}}const ce={key:"cxm/vendors",default:{}},de="liveintent",le={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}};function ue(t){const e=[],n={user:{ext:{eids:e}}};return Object.entries(le).forEach((n=>{const a=n[0],i=n[1];if(void 0===t[a])return;const o={source:i.source,uids:[{id:t[a],atype:i.atype}]};!0!==i.noExtraDefaults&&(o.uids[0].ext={provider:"liveintent.com"}),e.push(o)})),n}const pe="anonymised",me="cxm/liveintent/set",fe="cxm/arcspan/set",he="cxm/anomymised/set",ve=new Map([["cxm/vendors/set",async({account:t})=>(await Promise.all([t.record(me),t.record(fe),t.record(he)]),o.completed)],[me,async({account:t,customEvent:e})=>{let n;try{n=function(t){let e;try{e=t.readLocalStorage("__tamLIResolveResult")}catch(t){if(t instanceof Error)throw new re(t)}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=ue(JSON.parse(e))}catch(n){t=ue(JSON.parse(decodeURIComponent(e)))}if(void 0!==t)return{data:{default:t}}}}(t)}catch(t){if(t instanceof re)return{status:o.cancelled,analytics:{statusReason:t.message}};throw t}return void 0===n?o.cancelled:(t.update(ce,(t=>({...t,[de]:n}))),o.completed)}],[fe,async({account:t})=>{const e=function(t){const e=t.globalContext.arcobj1,n=t.globalContext.arcobj2;let a=[],i=[],o=[];if(void 0!==e){if(void 0!==e.page_iab_codes.text&&(a=a.concat(e.page_iab_codes.text)),void 0!==e.page_iab_codes.images&&(a=a.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;o=o.concat(t),void 0!==n?.compcohorts&&(o=o.concat(n.compcohorts))}void 0!==e.page_iab_newcodes.text&&(i=[...new Set([...i,...e.page_iab_newcodes.text])]),void 0!==e.page_iab_newcodes.images&&(i=[...new Set([...i,...e.page_iab_newcodes.images])]);const s={name:"arcspan",segment:[],ext:{segtax:6}};i.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:a,sectioncat:a,pagecat:a,keywords:o.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?o.cancelled:(t.update(ce,(t=>({...t,arcspan:e}))),o.completed)}],[he,async({account:t,customEvent:e})=>{let n;try{n=function(t){let e;try{e=t.readLocalStorage("cohort_ids")}catch(t){if(t instanceof Error)throw new re(t)}if("string"==typeof e){const t=JSON.parse(e);let n="";for(let e=0;e({...t,[pe]:n}))),o.completed)}]]),ge={key:"idVendors/ids",default:void 0},ye={key:"idVendors/metadata",default:void 0};function we(t,e){const n=t(e);return null!=n?(e.update(ge,(t=>({...t,...n}))),{status:o.completed}):{status:o.cancelled}}class be{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 Ee=function(t){return"string"==typeof t?t:null},Se=function(t){return"string"==typeof t?atob(t):null};function xe(t){return function(e){return"string"==typeof e?t(JSON.parse(e)):null}}function _e(t){return function(e){if("string"!=typeof e)return null;let n=e,a=null;for(let e=0;++e<=5;)try{n=decodeURIComponent(n),a=xe(t)(n);break}catch(t){if(e>=5)throw t}return a}}const Re="33across";var Ae=new rt({scope:"idVendors",object:"33across",action:"get",handler:async({account:t,customEvent:e})=>we(Ie,t)});const Ie=t=>{const e=t.readLocalStorage("33acrossId");if(e&&e.length>1500)throw new Error(`Id length of ${100*Math.ceil(e.length/100)} (normalized) exceeds 1500 character limit`);return null!=e?{[Re]:decodeURIComponent(e)}:null},$e="audigent";var ke=new rt({scope:"idVendors",object:"audigent",action:"get",handler:async({account:t,customEvent:e})=>we(je,t)});const je=t=>{const e=t.readLocalStorage("hadronId")??t.readLocalStorage("auHadronId");return null!=e?{[$e]:e}:null},De=["cto_bidid"];var Ce=new rt({scope:"idVendors",object:"criteo",action:"get",handler:async({account:t,customEvent:e})=>we(new be("criteo").using(Ee).fromLocalStorageKeys(De).forAccount(t).getRunner(),t)});const Oe="id5",Pe="id5id";var Le=new rt({scope:"idVendors",object:"id5",action:"get",handler:async({account:t,customEvent:e})=>we(Ne,t)});const Ne=t=>{const e=t.readLocalStorage(Pe);return null!=e?{[Oe]:JSON.parse(decodeURIComponent(e)).universal_uid}:null},Te={key:"idVendors/enabled",default:void 0},Me=["__uid2_advertising_token"],Ue=t=>t?.latestToken?.advertising_token??null;var qe=new rt({scope:"idVendors",object:"uid",action:"get",handler:async({account:t,customEvent:e})=>we(new be("uid").using(xe(Ue)).fromLocalStorageKeys(Me).forAccount(t).getRunner(),t)});const Fe="pair",ze=["pairId"],Ve=["_lr_pairId"],Je=t=>t?.envelope?.pop?t?.envelope?.pop()??null:null;var Be=new rt({scope:"idVendors",object:"pair",action:"get",handler:async({account:t,customEvent:e})=>we((t=>new be(Fe).using(Se).fromCookieOrLocalStorageKeys(ze).forAccount(t).getRunner()()??new be(Fe).using(function(t){return function(e){return"string"==typeof e?xe(t)(atob(decodeURIComponent(e))):null}}(Je)).fromCookieOrLocalStorageKeys(Ve).forAccount(t).getRunner()()),t)});const Ge="yahoo",He=["connectId"],Ke=t=>t?.connectid??t?.connectId??null;var We=new rt({scope:"idVendors",object:"yahoo",action:"get",handler:async({account:t})=>we(new be(Ge).using(_e(Ke)).fromLocalStorageKeys(He).forAccount(t).getRunner(),t)});const Qe="lotame";var Ye=new rt({scope:"idVendors",object:"lotame",action:"get",handler:async({account:t,customEvent:e})=>we(Ze,t)});const Ze=t=>{const e=t.readLocalStorage("panoramaId");return null!=e?{[Qe]:e}:null},Xe="publink",tn=["_publink_srv","_publink","pbjs_publink"];var en=new rt({scope:"idVendors",object:"publink",action:"get",handler:async({account:t,customEvent:e})=>we(nn,t)});const nn=t=>{for(const e of tn){const n=t.readCookieStorage(e);if(null!=n){let t;try{t=JSON.parse(n).publink}catch{t=n}if(null!=t)return{[Xe]:t}}}return null},an="liveRamp",on="_lr_env",sn="idl_env",rn="apstagLiveRampTimestamp";var cn;!function(t){t[t.oldTimestamp=0]="oldTimestamp",t[t.newTimestamp=1]="newTimestamp",t[t.noTimestamp=2]="noTimestamp"}(cn||(cn={}));var dn=new rt({scope:"idVendors",object:"liveramp",action:"get",handler:async({account:t,customEvent:e})=>{const n=un(ln(t),t),a=we((()=>null!=n?{[an]:n.id}:null),t);return a.status===o.completed?function(t,e){const a=null!=n?{[an]:n.newGen}:null;return null!=a?(e.update(ye,(t=>({...t,...a}))),{status:o.completed}):{status:o.cancelled}}(0,t):a}});const ln=t=>{const e=t.readLocalStorage(on);if(null!=e)return e;const n=t.readCookieStorage(on);if(null!=n)return n;const a=t.readLocalStorage(sn);if(null!=a)return a;const i=t.readCookieStorage(sn);return null!=i?i:null},un=(t,e)=>{if(null!=t&&""!==t)try{const n=JSON.parse(atob(decodeURIComponent(t))),a={id:n.envelope,newGen:cn.noTimestamp};if(null!=n.timestamp){const t=e.readLocalStorage(rn);null==t||twe(new be(pn).using(Ee).fromLocalStorageOrCookieKeys(mn).forAccount(t).getRunner(),t)});const hn=["pbjs_unifiedID","pbjs-unifiedid"],vn=t=>t?.TDID??null;var gn=new rt({scope:"idVendors",object:"unifiedid",action:"get",handler:async({account:t,customEvent:e})=>we(new be("unifiedid").using(_e(vn)).fromLocalStorageOrCookieKeys(hn).forAccount(t).getRunner(),t)});const yn={},wn=new Set([Pe,sn,on]),bn={};var En=new rt({scope:"idVendors",object:"lockr",action:"get",handler:async({account:t,customEvent:e})=>we(Sn,t)});const Sn=t=>{const e=t.readLocalStorage("lockr_identity_providers");if(e){const n={};return e.split(",").filter((t=>!wn.has(t))).forEach((e=>{const a=xn(t,e);null!==a&&(n[yn[e]||e]=decodeURIComponent(a))})),n}return null},xn=(t,e)=>{let n=t.readLocalStorage(e);if(!n)return null;if(bn[e])try{n=JSON.parse(decodeURIComponent(n)),bn[e].split(".").forEach((t=>{n=n?.[t]}))}catch(t){throw new Error(`Malformed json at ${e}: ${t}`)}return n||null},_n={"33across":Ae,audigent:ke,criteo:Ce,ddb_key_638:En,id5:Le,liveRamp:dn,lotame:Ye,pair:Be,pubcommon:fn,publink:en,uid:qe,unifiedid:gn,yahoo:We},Rn=Object.keys(_n);var An=new rt({scope:"idVendors",object:"ids",action:"get",handler:async({account:t})=>{let e=Object.values(_n);const n=t.use(Te,{persist:!0,throwOnDisallowed:!1});if(n){const t=JSON.parse(n);if(a=t,!Array.isArray(a)||!a.every((t=>"string"==typeof t)))throw new Error("Received invalid 3P bid param key");const i=new Set(t);e=Rn.filter((t=>i.has(t))).map((t=>_n[t]))}var a;return await Promise.all(e.map((e=>t.recordListener(e)))),{status:o.completed,analytics:{enabledIdVendors:`${n}`}}}}),In=new rt({scope:"idVendors",object:"enabled",action:"set",handler:async({account:t,detail:e,context:n})=>$n(n)?(t.update(Te,(()=>JSON.stringify(e.bidParameterKeys)),{persist:!0}),{status:o.completed}):{status:o.waiting},validators:{detail:{detail:Y,"detail.bidParameterKeys":X,"detail.bidParameterKeys[]":W},context:{context:Y,"context.apstag":Z([st,Y]),"context.apstag._atsaaiod":Z([st,at])}}});const $n=t=>void 0!==t.apstag?._atsaaiod,kn=ct([Ae,ke,Ce,Le,An,dn,En,Ye,Be,fn,en,qe,gn,We,In]),jn=ct([new rt({scope:"analytics",object:"sampling",action:"set",validators:{detail:{detail:it,"detail.rates":it,"detail.rates.error":it,"detail.rates.status":it}},handler:async({detail:t})=>void 0===t?.rates?{status:o.cancelled}:(void 0!==t?.rates?.error&&ut.setEventSamplingRates({error:t?.rates?.error}),void 0!==t?.rates?.status&&ut.setEventSamplingRates({feature:t?.rates?.status}),{status:o.completed})}),new rt({scope:"log",object:"analytics",action:"setInterval",validators:{detail:{detail:Y,"detail.interval":K}},handler:async({detail:t})=>(ut.setEventProcessingInterval(t.interval),{status:o.completed})})]);var Dn=new rt({scope:"debug",object:"version",action:"show",handler:async({account:t,customEvent:e})=>({status:o.completed,value:{LIBRARY_VERSION:x}})});const Cn="debug/events/show",On="debug/prepend/add",Pn="debug/prepend/remove",Ln="debug/store/show",Nn="ad/debugSession/start",Tn=new Map([[Cn,async({account:t})=>{const e=[...(null!=t.store.get(v)?t.store.get(v):[]).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(v)?t.store.get(v):[]).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(),o.completed}],[On,async({account:t,customEvent:n})=>{if(void 0===n.detail?.eventName)throw new Error("Missing event information");const a=t.read(e,{persist:!0})??"[]",i=JSON.parse(a),{eventName:s,eventDetail:r}=n.detail;return i.unshift({eventName:s,eventDetail:r}),t.write(e,JSON.stringify(i),{persist:!0}),o.completed}],["debug/prepend/clear",async({account:t})=>(t.delete(e,{persist:!0}),o.completed)],[Pn,async({account:t,customEvent:n})=>{if(void 0===n.detail?.eventName)throw new Error("Missing event information");const a=t.read(e,{persist:!0})??"[]",i=JSON.parse(a),{eventName:s}=n.detail,r=i.filter((t=>t.eventName!==s));return t.write(e,JSON.stringify(r),{persist:!0}),o.completed}],[Ln,async({account:t})=>{const e=[...t.store.entries()];return console.groupCollapsed(`⌂ Account ID: ${t.id}`),console.table(e),console.groupEnd(),o.completed}],[Nn,async({account:e,customEvent:n})=>function(t){return t.status!==o.waiting}(n)&&(function(e,n){void 0!==e.detail?.minutes&&function(e,n){const a=new Date;e.write(t,a.setMinutes(Number(a.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===Nn)).length>1}(e))?o.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),o.completed):(function(t){t.record(Cn).catch((t=>{})),t.record(Ln).catch((t=>{}))}(e),o.waiting)],["debug/listeners/show",async({systemAccount:t})=>{const e=[...t.store.get(h).entries()];return console.groupCollapsed("⌂ Listeners"),console.table(e),console.groupEnd(),o.completed}]]),Mn=new Map([...Tn,...ct([Dn])]);var Un;!function(t){t[t.unspecifiedUnknown=0]="unspecifiedUnknown",t[t.lowEntropy=1]="lowEntropy",t[t.highEntropy=2]="highEntropy"}(Un||(Un={}));const qn=["brands","mobile","platform"],Fn=["architecture","bitness","fullVersionList","model","platformVersion"];var zn=new rt({scope:"deviceSignal",object:"sua",action:"set",validators:{context:{context:Y,"context.apstag":Y,"context.navigator":Y,"context.navigator.userAgentData":Y,"context.navigator.userAgentData.getHighEntropyValues":at,"context.navigator.userAgentData.architecture":nt(W),"context.navigator.userAgentData.bitness":nt(W),"context.navigator.userAgentData.mobile":nt(Q),"context.navigator.userAgentData.model":nt(W),"context.navigator.userAgentData.platform":nt(W),"context.navigator.userAgentData.platformVersion":nt(W),"context.navigator.userAgentData.fullVersionList":nt(X),"context.navigator.userAgentData.fullVersionList[]":Y,"context.navigator.userAgentData.fullVersionList[].brand":W,"context.navigator.userAgentData.fullVersionList[].version":W,"context.navigator.userAgentData.brands":nt(X),"context.navigator.userAgentData.brands[]":Y,"context.navigator.userAgentData.brands[].brand":W,"context.navigator.userAgentData.brands[].version":W}},handler:async({account:t})=>{if(void 0===t.globalContext.apstag?.isGDPRRegion)return{status:o.waiting};const e="deviceSignal/sua",n=t.globalContext.navigator?.userAgentData,a=t.read(e,{persist:!0,throwOnDisallowed:!1});return"string"==typeof a?t.write(e,a):n instanceof Object&&function(t,e,n){t.write(e,JSON.stringify(Vn(n)))}(t,e,n),!1!==t.globalContext.apstag?.isGDPRRegion||"function"==typeof n?.getHighEntropyValues&&await async function(t,e,n){const a=await n.getHighEntropyValues([...qn,...Fn]);return t.write(e,JSON.stringify(Vn(a)),{persist:!0,throwOnDisallowed:!1}),o.completed}(t,e,n),{status:o.completed}}});function Vn(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=(a=t,Fn.some((t=>a[t]))?Un.highEntropy:qn.some((t=>a[t]))?Un.lowEntropy:Un.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 a}const Jn=ct([zn]),Bn={key:"deviceSignal/cookieDeprecationLabel",default:void 0};var Gn=new rt({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:o.cancelled};const a=await t.executeFuncWithConsent(n,n.getValue);return void 0===a||""===a?{status:o.cancelled}:(t.update(Bn,(()=>a)),{status:o.completed,analytics:{gcdl:a}})}});const Hn=ct([Gn]),Kn={key:"_monitoring/statusesByEventIdentifier",default:new Map};var Wn=async({account:t,customEvent:e})=>{const n=e.detail?.eventIdentifier;if(void 0===n)throw new Error("Missing eventIdentifier parameter");const a=t.use(Kn),i=`${e.type}:${n}`,s=a.get(i);return void 0!==s?s:o.waiting},Qn=async({account:t,customEvent:e})=>{const n=e.detail?.eventIdentifier;if(void 0===n)throw new Error("Missing eventIdentifier parameter");const a=e.detail?.statusUpdate;if(void 0===a)throw new Error("Missing statusUpdate parameter");if(!(a in o))throw new Error(`Invalid statusUpdate parameter. Expected one of ${Object.values(o).join(", ")}`);const i=e.detail?.pairedEvents;if(void 0===i||i.length<1||i.some((t=>"string"!=typeof t)))throw new Error("Parameter pairedEvents must be a non-empty array of string");return i.forEach((e=>{const i=`${e}:${n}`;t.update(Kn,(t=>t.set(i,a)))})),o.completed};const Yn=new Map([["_monitor/testing/only",Wn],["_update/testing/only",Qn],["_legacy/bidRequest/monitor",Wn],["_legacy/bidRequest/didComplete",Qn]]);var Zn=new rt({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:o.cancelled};const n={eventType:e.detail.eventType,metadata:e.detail.metadata,config:e.detail.config},a=await t.globalContext.fetch("https://prod.us-east-1.cxm-bcn.publisher-services.amazon.dev/v1/events/prebid",Xn(e.detail));return a.ok?{status:o.completed,analytics:n}:{status:o.cancelled,analytics:{...n,message:`Request failed: ${a.status}`}}}});const Xn=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)}},ta={key:"prebid/config",default:void 0};var ea;!function(t){t.NotStarted="NOT STARTED",t.Loading="LOADING",t.Complete="COMPLETE"}(ea||(ea={}));const na={key:"prebid/configRequestState",default:ea.NotStarted};var aa=new rt({scope:"prebid",object:"config",action:"fetch",handler:async({account:t,customEvent:e})=>{const n=t.use(na);if(n===ea.Loading)return{status:o.waiting};const a={metadata:e?.detail?.metadata};if(n===ea.Complete){const e=t.use(ta);if(void 0!==e)return{status:o.completed,value:JSON.parse(e),analytics:a}}try{t.update(na,(()=>ea.Loading));const e=`https://c.amazon-adsystem.com/cdn/prod/config?src=${t.id}`,n=await t.globalContext.fetch(e);if(t.update(na,(()=>ea.Complete)),!n.ok)return{status:o.cancelled,analytics:{...a,message:"Config request failed"}};const i=await n.json(),s=ia(t,i);return t.update(ta,(()=>JSON.stringify(s)),{persist:!0}),{status:o.completed,value:s,analytics:a}}catch(t){return{status:o.cancelled,analytics:{...a,message:t.message}}}}});const ia=(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}}}),oa={key:"prebid/eidsConfig",default:"{}"};var sa;!function(t){t.APSSignalIQ="_apsIdTreatment",t.Audigent="hadronId",t.ID5="id5id",t.Liveramp="idl_env",t.Lotame="lotamePanoramaId",t.Pubcommon="pubcid",t.Publink="publinkId",t.ThirtyThree="33acrossId",t.Yahoo="connectId"}(sa||(sa={}));const ra=new Map([[$e,sa.Audigent],["id5",sa.ID5],[an,sa.Liveramp],[Qe,sa.Lotame],[pn,sa.Pubcommon],[Xe,sa.Publink],[Re,sa.ThirtyThree],[Ge,sa.Yahoo]]),ca={[sa.Audigent]:{source:"audigent.com",atype:1},[sa.ID5]:{source:"id5-sync.com",atype:1},[sa.Liveramp]:{source:"liveramp.com",atype:3},[sa.Lotame]:{source:"crwdcntrl.net",atype:1},[sa.Pubcommon]:{source:"pubcid.org",atype:1},[sa.Publink]:{source:"epsilon.com",atype:3},[sa.ThirtyThree]:{source:"33across.com",atype:1},[sa.Yahoo]:{source:"yahoo.com",atype:3}};var da=new rt({scope:"prebid",object:"eidsConfig",action:"get",handler:async({account:t,customEvent:e})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:o.waiting};t.update(oa,(()=>JSON.stringify({...ca})),{persist:!0});const n={metadata:e?.detail?.metadata,config:e?.detail?.config};return{status:o.completed,analytics:n}}});const la=new Set(["CONTROL_HOLD_OUT","CLEAN",...ra.keys()]);const ua={key:"prebid/ids",default:void 0};var pa=new rt({scope:"prebid",object:"ids",action:"get",handler:async({account:t,customEvent:e})=>{if(void 0===t.globalContext.apstag?._atsaaiod)return{status:o.waiting};t.recordListenerNonBlocking(An);const n=t.use(ge);let a;void 0!==n&&(a=Object.fromEntries(Object.entries(n).map((([t,e])=>[ra.get(t),e]))));const i=await t.recordListener(aa,{metadata:e?.detail?.metadata}),s={metadata:e?.detail?.metadata};return i.idConfig.params.enabled?(null!=i.idConfig.params.treatments&&(a=function(t,e){if(!function(t){const e=100===t.reduce(((t,{percent:e})=>t+e),0),n=t.reduce(((t,{treatment:e})=>t&&la.has(e)),!0);return e&&n}(e))return t;const n=function(t){const e=100*Math.random();let n=0;for(const a of t)if(n+=a.percent,e<=n)return a.treatment;throw new Error("Invalid treatment percentages")}(e);return function(t,e){const n={[sa.APSSignalIQ]:e},a=ra.get(e);switch(e){case"CONTROL_HOLD_OUT":return{...t,...n};case"CLEAN":return n;default:return void 0!==a&&void 0!==t?.[a]&&(n[a]=t[a]),n}}(t,n)}(a,i.idConfig.params.treatments)),t.update(ua,(()=>a)),{status:o.completed,value:a,analytics:s}):{status:o.cancelled,analytics:s}}});const ma=ct([Zn,aa,da,pa]),fa=t=>t===ha.noConsent?"AMZN-NoCookieConsent":"AMZN-Token";var ha;!function(t){t[t.noConsent=0]="noConsent",t[t.token=1]="token"}(ha||(ha={}));const va=t=>{t.setCookieStorage(fa(ha.token),"",0),t.setCookieStorage(fa(ha.noConsent),"",0)},ga=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:a,tcString:i,setToken:o})=>(va(t),"boolean"!=typeof o&&(o=!0),ya({account:t,hashedRecords:e,ttl:n,isGDPRRegion:a,tcString:i}).then((({AIPToken:e,cookieExpiry:n})=>wa({AIPToken:e,cookieExpiry:n,account:t,setToken:o})))),ya=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:a,tcString:i})=>fetch("https://tk.amazon-adsystem.com/envelope",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(ba({account:t,hashedRecords:e,ttl:n,isGDPRRegion:a,tcString:i}))}).then((t=>{if(!t.ok)throw new Error(`Token http status error: ${t.status}`);return t.json()})),wa=({AIPToken:t,cookieExpiry:e,account:n,setToken:a})=>{if("string"!=typeof t||"number"!=typeof e)throw new Error("Invalid AIPES response");if(""===t)throw n.setCookieStorage(fa(ha.noConsent),"1",e),new Error("Empty token");(a||"boolean"!=typeof a)&&n.setCookieStorage(fa(ha.token),t,e)},ba=({account:t,hashedRecords:e,ttl:n,isGDPRRegion:a,tcString:i})=>{const o={publisherId:t.id,hashedRecords:e};return void 0!==n&&(o.ttl=n),a?(o.gdpr=1,i&&(o.gdprConsent=i)):o.gdpr=0,o};var Ea=new rt({scope:"ad",object:"record",action:"delete",handler:async({account:t})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:o.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");return va(t),{status:o.completed}}});const Sa={detail:Y,"detail.setCookie":nt(Q),"detail.config":Y,"detail.config.optOut":nt(Q),"detail.config.ttl":nt(K),"detail.config.gdpr":nt(Y),"detail.config.gdpr.cmpTimeout":nt(K),"detail.config.gdpr.enabled":nt(ot),"detail.config.gdpr.consent":nt(W),"detail.config.gdpr.cmpGlobal":nt(W),"detail.config.gdpr.cmpGlobalv2":nt(W),"detail.config.hashedRecords":X,"detail.config.hashedRecords[]":Y,"detail.config.hashedRecords[].type":W,"detail.config.hashedRecords[].record":W,"detail.config.hashedRecords[].encrypted":nt(K),"detail.config.hashedRecords[].toJSON":it,"detail.config.hashedRecords[].$$typeof":it,"detail.config.hashedRecords[].constructor":it,"detail.config.hashedRecords[].tagName":it,"detail.config.hashedRecords[].@@__IMMUTABLE_ITERABLE__@@":it,"detail.config.hashedRecords[].@@__IMMUTABLE_RECORD__@@":it};var xa,_a,Ra=new rt({scope:"ad",object:"record",action:"renew",validators:{detail:Sa,context:{context:Y}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:o.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(fa(ha.token))??"").length>0)return{status:o.cancelled};const n=t.globalContext.apstag.isGDPRRegion,a=t.use(bt);var i;return await(i={account:t,hashedRecords:e.config.hashedRecords,ttl:e.config.ttl,isGDPRRegion:n,tcString:a?.tcString},ga(i)),{status:o.completed}}});!function(t){t.email="email"}(xa||(xa={})),function(t){t.Display="display",t.Video="video",t.MultiFormat="multi-format"}(_a||(_a={}));const Aa=/^[0-9a-fA-F]{64}$/,Ia=t=>Aa.test(t||""),$a=t=>t.then((t=>Array.from(new Uint8Array(t)).map((t=>t.toString(16).padStart(2,"0"))).join(""))).then((t=>"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"!==t?t:"")),ka=(t,e)=>"string"==typeof t&&(e===xa.email?/\S+@\S+\.\S+/.test(t)||Ia(t):t.trim().length>0),ja=(t,e,n)=>e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement?ka(e.value,n)?$a(t.globalContext.crypto.subtle.digest("SHA-256",(new t.globalContext.TextEncoder).encode(e.value||""))):Promise.resolve(""):ka(e.innerText,n)?$a(t.globalContext.crypto.subtle.digest("SHA-256",(new t.globalContext.TextEncoder).encode(e.innerText||""))):Promise.resolve(""),Da=(t,e,n)=>{const a=t.readLocalStorage(e);return a&&ka(a,n)?a:""},Ca=(t,e,n)=>{n=n??t.globalContext.location.href,e=e.replace(/[[\]]/g,"\\$&");const a=new RegExp("[?&#]"+e+"(=([^&#?]*)|&|#|$)").exec(n);return Array.isArray(a)&&"string"==typeof a[2]&&0!==decodeURIComponent(a[2].replace(/\+/g," ")).trim().length&&Ia(decodeURIComponent(a[2].replace(/\+/g," ")))?Promise.resolve(decodeURIComponent(a[2].replace(/\+/g," "))):new Promise((t=>t("")))};var Oa;!function(t){t.LOCAL_STORAGE="LOCAL",t.CSS_SELECTOR="CSS",t.URL="URL"}(Oa||(Oa={}));const Pa=(t,e={},n)=>{(t=>{const e={[Oa.LOCAL_STORAGE]:5,[Oa.URL]:4,[Oa.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 a=[];let i;for(const o of e.methods||[]){const{method:e,target:s,type:r}=o;let c="";switch(e){case Oa.LOCAL_STORAGE:c=Da(t,s,r);break;case Oa.URL:a.push(Ca(t,s).then((t=>({type:r,value:t}))));break;case Oa.CSS_SELECTOR:i=o}if(c.length>0)return void n({value:c,type:r})}const o=()=>{if(!i||!0!==i.isGlobalSubmit&&("string"!=typeof i.eventTarget||"string"!=typeof i.event))return void n(!1);const{eventTarget:e,target:a,type:o,isGlobalSubmit:s}=i,r=s?"submit":i.event;if("string"!=typeof r||0===r.length)return void n(!1);const c=i=>(({account:t,e:e,eventTarget:n,event:a,isGlobalSubmit:i,target:o,type:s,onDone:r,listener:c})=>{if(!(i||"window"===n||e.target&&"function"==typeof e.target.matches&&"string"==typeof n&&e.target.matches(n)))return void r(!1);let d;i&&e instanceof Event&&e.target&&(d=e.target.querySelectorAll('input[type="email"]')),((t,e,n,a)=>{const i=a||t.globalContext.document.querySelectorAll(e);if(0===i.length)return new Promise((t=>t("")));if(1===i.length)return ja(t,i[0],n);const o=[];for(const e of i)o.push(ja(t,e,n));return Promise.all(o).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,o,s,d).then((e=>{"function"==typeof c&&t.globalContext.removeEventListener(a,c),r(!(e.length<1)&&{value:e,type:s})}))})({account:t,e:i,event:r,eventTarget:e,isGlobalSubmit:s,target:a,type:o,onDone:n,listener:c});t.globalContext.addEventListener(r,c)};if(0!==a.length)return Promise.all(a).then((t=>{for(const e of t)if(e.value.length>0)return void n(e);o()}));o()},La={called:!1};const Na=ct([Ea,Ra,new rt({scope:"ad",object:"record",action:"rr",validators:{detail:{detail:Y,"detail.config":Y,"detail.config.$$typeof":it,"detail.config.tagName":it,"detail.config.@@__IMMUTABLE_ITERABLE__@@":it,"detail.config.@@__IMMUTABLE_RECORD__@@":it,"detail.config.accountID":nt(W),"detail.config.overrideLimit":nt(Q),"detail.config.methods":X,"detail.config.methods[].tagName":it,"detail.config.methods[]":et(Y),"detail.config.methods[].$$typeof":it,"detail.config.methods[].@@__IMMUTABLE_ITERABLE__@@":it,"detail.config.methods[].@@__IMMUTABLE_RECORD__@@":it,"detail.config.methods[].type":tt(Object.values(xa)),"detail.config.methods[].method":tt(Object.values(Oa)),"detail.config.methods[].target":nt(W),"detail.config.methods[].event":nt(W),"detail.config.methods[].eventTarget":nt(W),"detail.config.methods[].isGlobalSubmit":nt(Q),"detail.config.methods[].priority":nt(K)},context:{context:Y,"context.Promise":at,"context.crypto":Y,"context.crypto.subtle":at}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:o.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");const n=await function(t,e){return new Promise(((n,a)=>{if(La.called&&!e.overrideLimit)throw new Error("rr should only be called once per page load");La.called=!0;let i=0;const o=()=>{const s=(()=>{const i=t.use(bt);return(!t.globalContext.apstag?.isGDPRRegion||void 0!==i)&&(void 0===i||t.isAllowedToAccessInfoOnDevice()?(Pa(t,e,(e=>{if(!1===e)return n("no retrieval");ga({account:t,hashedRecords:[{type:e.type,record:e.value}],source:"rr",tcString:i?.tcString}).then((()=>{n("token generated")})).catch(a)}))?.catch(a),!0):"canceled")})(),r=i>6400;if(s||r)return"canceled"===s&&a(new Error("tcf timeout")),void(r&&a(new Error("interval over")));setTimeout(o,i),i=0===i?200:2*i};o()}))}(t,e.config);return{status:o.completed,analytics:{rr:n}}}}),new rt({scope:"ad",object:"record",action:"update",validators:{detail:Sa,context:{context:Y}},handler:async({account:t,detail:e})=>{if(!t.globalContext.apstag?._atsaaiod)return{status:o.waiting};if(!t.isAllowedToAccessInfoOnDevice())throw new Error("Not allowed to access storage on device");const n=t.globalContext.apstag.isGDPRRegion,a=t.use(bt);return e.config.optOut?va(t):await ga({account:t,hashedRecords:e.config.hashedRecords,ttl:e.config.ttl,isGDPRRegion:n,tcString:a?.tcString,setToken:e?.setCookie}),{status:o.completed}}})]),Ta=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,a)=>{const i=n.globalContext.document.createElement("iframe"),o=e.get("amznsz")?.split("x"),s=e.get("amzniid"),r=t;if(void 0===s||void 0===r||void 0===o||o.length<2)return;i.style.marginLeft="0",i.style.marginTop="0",i.style.height=`${o[1]}px`,i.style.width="100%",i.setAttribute("scrolling","no"),i.setAttribute("frameborder","0");const c=n.globalContext.document.createElement("div"),d=a?.location??"afterend",l=n.globalContext.document.getElementById(r);if(null==l)return;l.insertAdjacentElement(d,c),c.appendChild(i);const u=i?.contentWindow?.document;void 0!==u&&(u.open(),u.write('