@thg-agentic/hyper-personalisation-web 3.34.0 → 3.35.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -438,8 +438,8 @@ SDK never checks the token: serving does, and ignores one that has expired.
438
438
 
439
439
  A session audience's rules name fields the SDK keeps for the visit, from the events it sends:
440
440
  `productViews`, `listViews`, `cartAdds`, `searches`, `browseViews.<path>`, `browseShare.<path>`,
441
- `categoryViews.<path>`, `categoryShare.<path>` and, since 3.18, `basketValue`. A field this build
442
- does not know fails its rule closed.
441
+ `categoryViews.<path>`, `categoryShare.<path>`, since 3.18 `basketValue` and since 3.35
442
+ `basketCodeCount`. A field this build does not know fails its rule closed.
443
443
 
444
444
  `listViews`, `browseViews` and `browseShare` count category pages, as the warehouse does. A listing
445
445
  must send its own `category` (Product List Viewed); one without is not recorded. Since 3.22, pass
@@ -466,6 +466,12 @@ can include tax where `value` does not. It is `null`, so every rule on it fails,
466
466
  sends a Cart Updated, and again after one without a `value`. Send `cartUpdated` after every confirmed basket change, as the spec asks, or
467
467
  a basket audience goes stale.
468
468
 
469
+ `basketCodeCount` is how many discount codes the basket holds: those in the last cart event's
470
+ `discounts` (else its `coupon`), on Cart Viewed or Cart Updated, with `couponApplied` and
471
+ `couponRemoved` adding and taking them out between cart events (a code typed in another case is the
472
+ same code). It is `null`, so every rule on it fails, until a cart event names either field, so a
473
+ platform that sends no codes is never taken for a basket without one. `eq 0` is a basket with none.
474
+
469
475
  Since 3.27, `campaign.source`, `campaign.medium`, `campaign.campaign`, `campaign.content` and
470
476
  `campaign.term` are the campaign the visit arrived from: the `utm_*` tags of the first page of the
471
477
  visit that had any (a page view records them), kept for the visit. They are text, compared trimmed
@@ -682,6 +688,8 @@ filters in the catalogue. A page with no product does not ask (`not eligible: no
682
688
  | `settings` | Development and tests: these forms instead of the settings'. |
683
689
  | `values` | What the page knows of the shopper for a form's text, `{ first_name }`, as `hp.onsite.values` (3.32). |
684
690
 
691
+ A form with `exclude_code_applied` is not shown while the basket holds a discount code, read from the cart events the page sends (see `basketCodeCount` under [Visit traits](#visit-traits)); once the code is removed it is tried again.
692
+
685
693
  `hp.onsite.debug()` returns each form's state and reasons (`armed`, `not eligible: per_session cap`,
686
694
  `held out`, `shown`, …), and since 3.29 a `code`, which stays the same across releases while the
687
695
  reasons may be reworded: `armed`, `waiting-for-open`, `deciding`, `shown`, `closed`, `held-out`,
package/dist/hp.min.js CHANGED
@@ -1,3 +1,3 @@
1
- (()=>{var On=e=>{throw TypeError(e)};var vo=(e,t,n)=>t.has(e)||On("Cannot "+n);var Ln=(e,t,n)=>t.has(e)?On("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var L=(e,t,n)=>(vo(e,t,"access private method"),n);var Pe=[];for(let e=2;Pe.length<64;e++)Pe.every(t=>e%t!==0)&&Pe.push(e);var Tn=e=>(e-Math.floor(e))*2**32>>>0,Eo=Pe.slice(0,8).map(e=>Tn(Math.sqrt(e))),Co=Pe.map(e=>Tn(Math.cbrt(e))),Z=(e,t)=>e>>>t|e<<32-t;function Nn(e){let t=new TextEncoder().encode(String(e)),n=new Uint32Array((t.length+8>>6)*16+16);t.forEach((s,i)=>{n[i>>2]|=s<<24-i%4*8}),n[t.length>>2]|=128<<24-t.length%4*8,n[n.length-2]=Math.floor(t.length/2**29),n[n.length-1]=t.length*8;let r=Uint32Array.from(Eo),o=new Uint32Array(64);for(let s=0;s<n.length;s+=16){for(let w=0;w<64;w++){if(w<16){o[w]=n[s+w];continue}let I=o[w-15],b=o[w-2],x=Z(I,7)^Z(I,18)^I>>>3,h=Z(b,17)^Z(b,19)^b>>>10;o[w]=o[w-16]+x+o[w-7]+h}let[i,c,u,d,f,p,m,v]=r;for(let w=0;w<64;w++){let I=Z(f,6)^Z(f,11)^Z(f,25),b=v+I+(f&p^~f&m)+Co[w]+o[w]|0,h=(Z(i,2)^Z(i,13)^Z(i,22))+(i&c^i&u^c&u)|0;[v,m,p,f,d,u,c,i]=[m,p,f,d+b|0,u,c,i,b+h|0]}[i,c,u,d,f,p,m,v].forEach((w,I)=>{r[I]+=w})}return Array.from(r,s=>s.toString(16).padStart(8,"0")).join("")}var Pt=(e,t)=>e<<t|e>>>32-t;function Rn(e){let t=new Uint32Array((e.length+8>>6)*16+16);e.forEach((s,i)=>{t[i>>2]|=s<<24-i%4*8}),t[e.length>>2]|=128<<24-e.length%4*8,t[t.length-2]=Math.floor(e.length/2**29),t[t.length-1]=e.length*8;let n=Uint32Array.of(1732584193,4023233417,2562383102,271733878,3285377520),r=new Uint32Array(80);for(let s=0;s<t.length;s+=16){for(let p=0;p<80;p++)r[p]=p<16?t[s+p]:Pt(r[p-3]^r[p-8]^r[p-14]^r[p-16],1);let[i,c,u,d,f]=n;for(let p=0;p<80;p++){let m,v;p<20?(m=c&u|~c&d,v=1518500249):p<40?(m=c^u^d,v=1859775393):p<60?(m=c&u|c&d|u&d,v=2400959708):(m=c^u^d,v=3395469782);let w=Pt(i,5)+m+f+v+r[p]|0;[f,d,u,c,i]=[d,u,Pt(c,30),i,w]}[i,c,u,d,f].forEach((p,m)=>{n[m]+=p})}let o=new Uint8Array(20);return n.forEach((s,i)=>{o[i*4]=s>>>24,o[i*4+1]=s>>>16,o[i*4+2]=s>>>8,o[i*4+3]=s}),o}var Po="e28e8ada-5b76-4209-bba9-79b823a0af75",Oo=e=>Array.from(e,t=>t.toString(16).padStart(2,"0")).join("");function Mn(e,t){let n=Uint8Array.from(e.replace(/-/g,"").match(/../g),c=>Number.parseInt(c,16)),r=new TextEncoder().encode(t),o=new Uint8Array(16+r.length);o.set(n),o.set(r,16);let s=Rn(o).slice(0,16);s[6]=s[6]&15|80,s[8]=s[8]&63|128;let i=Oo(s);return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}var le=(e,t)=>typeof e=="string"&&e!==""&&e.length<=t?e:null;function Ke(e,t){return le(e,64)??le(t,256)}function Dn({sessionId:e,slot:t,arm:n}={}){let r=le(e,256);return!r||!le(t,256)||!le(n,256)?null:Mn(Po,`${r}:${t}:${n}`)}var Lo="4b1f2c7e-9a3d-4e58-b6c1-2d7f0a9e8c53";function Un({sessionId:e,surface:t}={}){let n=le(e,256);return!n||!le(t,64)?null:Mn(Lo,`${n}:${t}`)}var To=Array.from({length:11},(e,t)=>t/10);function No(e,t){if(!e.isIntersecting)return!1;let{intersectionRect:n,boundingClientRect:r,rootBounds:o}=e;if(!n||!r)return!0;let s=n.width*n.height,i=r.width*r.height,c=o?Math.min(i,o.width*o.height):i;return c>0&&s/c>=t}function se(e){let{selector:t,onViewable:n,visibleRatio:r=.5,dwellMs:o=1e3,root:s=document}=e,i=new Map,c=new WeakSet,u=new Set,d=h=>{i.has(h)||i.set(h,setTimeout(()=>{i.delete(h),n(h)&&(p?.unobserve(h),u.delete(h))},o))},f=h=>{clearTimeout(i.get(h)),i.delete(h)},p=typeof IntersectionObserver>"u"?null:new IntersectionObserver(h=>{for(let P of h){let _=P.target;if(!No(P,r)){u.delete(_),f(_);continue}u.add(_),m()&&d(_)}},{threshold:To}),m=()=>typeof document>"u"||document.visibilityState!=="hidden",v=()=>{if(m())for(let h of u)d(h);else for(let h of u)f(h)};document.addEventListener("visibilitychange",v);let w=()=>{for(let h of s.querySelectorAll(t))c.has(h)||(c.add(h),p?.observe(h))},I=typeof MutationObserver>"u"?null:new MutationObserver(()=>w()),b=()=>{w(),I?.observe(s===document?document.body:s,{childList:!0,subtree:!0})},x=s===document&&!document.body;return x?document.addEventListener("DOMContentLoaded",b,{once:!0}):b(),()=>{x&&document.removeEventListener("DOMContentLoaded",b),document.removeEventListener("visibilitychange",v),p?.disconnect(),I?.disconnect();for(let h of i.values())clearTimeout(h);i.clear(),u.clear()}}function Ot(e,t={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{selector:n="[data-hp-exposure]",visibleRatio:r=.5,dwellMs:o=1e3,root:s=document}=t;return se({selector:n,root:s,visibleRatio:r,dwellMs:o,onViewable(i){let c=i.dataset?.hpExposure?.trim();return c&&e.surfaceViewed({surface:c}),!0}})}var Vn=e=>{try{return new URL(e,document.baseURI).toString()}catch{return e}};function Lt(e,t={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{selector:n="[data-hp-list]",tileSelector:r="[data-hp-product]",visibleRatio:o=.5,dwellMs:s=1e3,root:i=document}=t,c=new Set,u=w=>w.closest?.(n)??null,d=w=>{let I=w.dataset.hpList?.trim();return I?{list_id:I,category:w.dataset.hpListCategory?.trim()||null}:null},f=w=>Array.from(w.querySelectorAll(r)).filter(I=>u(I)===w),p=(w,I)=>{try{let b=JSON.parse(w.dataset.hpProduct??"");return!b||typeof b!="object"||!b.product_id?null:{...b,position:b.position??I+1,...b.url?{url:Vn(b.url)}:{},...b.image_url?{image_url:Vn(b.image_url)}:{}}}catch{return null}},m=se({selector:`${n} ${r}`,root:i,visibleRatio:o,dwellMs:s,onViewable(w){let I=u(w);if(!I||I.dataset.hpListView==="manual")return!0;let b=d(I);if(!b||c.has(b.list_id))return!0;let x=new Set,h=f(I).map(p).filter(P=>!P||x.has(P.product_id)?!1:(x.add(P.product_id),!0));return h.length===0||(c.add(b.list_id),e.productListViewed({...b,products:h})),!0}}),v=w=>{let b=w.target?.closest?.("a[href]")?.closest(r);if(!b)return;let x=u(b),h=p(b,x?f(x).indexOf(b):0);h&&e.productClicked({list_id:x?d(x)?.list_id??null:null,products:[h]})};return document.addEventListener("click",v,!0),()=>{document.removeEventListener("click",v,!0),m()}}function D(e,...t){let n=e.dataset??{};for(let r of t){let o=n[r];if(typeof o=="string"&&o.trim()!=="")return o.trim()}return null}function Ge(e,...t){let n=D(e,...t);if(n===null)return null;let r=Number(n);return Number.isFinite(r)?Math.trunc(r):null}function Ro(e,t){let n=D(e,"hpPromotion");return n?{promotion_id:n,name:D(e,"hpPromotionName"),creative:D(e,"hpPromotionCreative"),position:D(e,"hpPromotionSlot")??String(t+1)}:null}function Tt(e,t={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{selector:n="[data-hp-promotion]",resolve:r=Ro,visibleRatio:o=.5,dwellMs:s=1e3,root:i=document}=t,c=new Set,u=p=>{let m=Array.from(i.querySelectorAll(n)),v=m.indexOf(p);try{return r(p,v<0?m.length:v)}catch{return null}},d=se({selector:n,root:i,visibleRatio:o,dwellMs:s,onViewable(p){let m=u(p);return!m||c.has(m.promotion_id)?!1:(c.add(m.promotion_id),e.promotionViewed(m),!0)}}),f=p=>{let m=p.target;if(!m||typeof m.closest!="function")return;let v=m.closest(n),w=m.closest("a[href]");if(!v||!w||!v.contains(w)&&!w.contains(v))return;let I=u(v);I&&e.promotionClicked({...I,href:w.getAttribute("href")})};return document.addEventListener("click",f,!0),()=>{document.removeEventListener("click",f,!0),d()}}function Mo(e){let t=D(e,"hpRecoRequest"),n=D(e,"hpRecoPlacement"),r=D(e,"hpRecoStrategy");if(!t||!n||!r)return null;let o=D(e,"hpRecoHoldout");return{recommendation_request_id:t,placement:n,strategy:r,recipe:D(e,"hpRecoRecipe"),algorithm_version:D(e,"hpRecoAlgorithmVersion"),experiment:D(e,"hpRecoExperiment"),variant:D(e,"hpRecoVariant"),holdout:o===null?null:o==="true",assignment_bucket:Ge(e,"hpRecoBucket"),assignment_unit_kind:D(e,"hpRecoUnitKind"),candidate_set_fingerprint:D(e,"hpRecoFingerprint"),candidate_set_size:Ge(e,"hpRecoCandidates"),ranked_by:D(e,"hpRecoRankedBy"),served_at:D(e,"hpRecoServedAt")}}function Do(e,t){let n=D(e,"hpRecoProduct");if(!n)return null;let r=D(e,"hpRecoPrice");return{product_id:n,sku:D(e,"hpRecoSku"),name:D(e,"hpRecoName"),brand:D(e,"hpRecoBrand"),price:r===null||Number.isNaN(Number(r))?null:Number(r),position:Ge(e,"hpRecoPosition")??t+1}}function Nt(e,t={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{selector:n="[data-hp-reco-request]",tileSelector:r="[data-hp-reco-product]",resolveRail:o=Mo,resolveTile:s=Do,visibleRatio:i=.5,dwellMs:c=1e3,root:u=document}=t,d=new Set,f=new Map,p=new Map,m=(h,...P)=>{try{return h(...P)}catch{return null}},v=h=>typeof h.closest=="function"?h.closest(n):null,w=h=>Array.from(h.querySelectorAll(r)),I=(h,P)=>{if(p.delete(P.recommendation_request_id),d.has(P.recommendation_request_id))return;let _=w(h).map((y,O)=>m(s,y,O)).filter(y=>y?.product_id);if(_.length===0)return;d.add(P.recommendation_request_id);let g=[...f.get(P.recommendation_request_id)?.values()??[]].sort((y,O)=>y.position-O.position);e.recommendationsViewed({...P,products:_,viewable:g})},b=se({selector:`${n} ${r}`,root:u,visibleRatio:i,dwellMs:c,onViewable(h){let P=v(h);if(!P)return!0;let _=m(o,P);if(!_)return!0;let g=_.recommendation_request_id,y=m(s,h,w(P).indexOf(h));if(y?.product_id){f.has(g)||f.set(g,new Map);let O=f.get(g);O.has(y.position)||O.set(y.position,{position:y.position,product_id:y.product_id,viewable_at:new Date().toISOString()})}return!d.has(g)&&!p.has(g)&&p.set(g,setTimeout(()=>I(P,_),0)),!0}}),x=h=>{let P=h.target;if(!P||typeof P.closest!="function")return;let _=P.closest(r);if(!_)return;let g=P.closest("[data-hp-reco-interaction]"),y=P.closest("a[href]"),O=y&&(_.contains(y)||y.contains(_));if(!(g&&_.contains(g))&&!O)return;let N=v(_);if(!N)return;let $=m(o,N);if(!$)return;let G=m(s,_,w(N).indexOf(_));if(!G?.product_id)return;let F=$.recommendation_request_id;d.has(F)||(clearTimeout(p.get(F)),I(N,$)),e.productClicked({recommendation_request_id:$.recommendation_request_id,interaction:D(g??_,"hpRecoInteraction")??"navigate",products:[G]})};return document.addEventListener("click",x,!0),()=>{document.removeEventListener("click",x,!0);for(let h of p.values())clearTimeout(h);p.clear(),b()}}var Ae=new Set(["home","list","product","search","basket","checkout","order_confirmation","login","register","account","info","blog","other"]),Uo=new Set(["products"]),$n=e=>e==null;function Rt(e,t=new WeakSet){if(e instanceof Date)return e.toJSON();if(e===null||typeof e!="object"||t.has(e))return e;t.add(e);let n=Array.isArray(e)?e.map(r=>Rt(r,t)):Object.fromEntries(Object.entries(e).filter(([,r])=>!$n(r)).map(([r,o])=>[r,Rt(o,t)]));return t.delete(e),n}function Mt(e){if(!e)return e;let t=Rt(e);for(let n of Uo)n in e&&$n(e[n])&&(t[n]=e[n]);return t}function jn(){try{let e=performance.getEntriesByType("navigation")[0];return e?["navigate","reload","back_forward","prerender"].includes(e.type)?e.type:"navigate":null}catch{return null}}var Vo=new Set(["","unknown","undefined","null","none","nil","nan","anonymous","guest","0","-1"]);function H(e){if(e==null)return null;let t=String(e).trim();return Vo.has(t.toLowerCase())?null:t}var Oe=e=>typeof e=="string"&&e!==""?e:null;function ie(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var Bn="1.22";function B(e){if(typeof document>"u")return null;try{let t=document.cookie.split(";").map(n=>n.trim()).find(n=>n.startsWith(`${e}=`));return t&&decodeURIComponent(t.slice(e.length+1))||null}catch{return null}}var $o={gclid:"gclid",fbclid:"fbclid",ttclid:"ttclid"},jo=/[a-z0-9._%+-]+@[a-z0-9-]+(\.[a-z0-9-]+)*\.[a-z]{2,}/i,Bo=/\d(?:[ -]?\d){12,}/,qo=new Set(["gclid","fbclid","ttclid","msclkid"]);function Fn(e,t=""){if(typeof e!="string"||e==="")return!1;let n=[e];try{let o=decodeURIComponent(e.replace(/\+/g," "));o!==e&&n.push(o)}catch{}let r=!qo.has(String(t).toLowerCase());return n.some(o=>jo.test(o)||r&&Bo.test(o))}function Ut(e){if(!e)return null;let t=new URLSearchParams(e),n={},r={utm_source:"source",utm_medium:"medium",utm_campaign:"name",utm_term:"term",utm_content:"content"};for(let[o,s]of[...Object.entries(r),...Object.entries($o)]){let i=t.get(o);i&&!Fn(i,o)&&(n[s]=i)}return Object.keys(n).length?n:null}var Fo=["email","e-mail","password","pass","pwd","token","auth","code","uid","customer_id","postcode","zip","phone","applyCode"],Ho=["email","password","passwd","pwd","token","secret","auth","session","phone","postcode","zip","address","birth","card","cvv","iban","ssn","customerid","userid"],Ko=["tel","uid","dob"],Go=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","fbclid","ttclid","msclkid"],zo=new Set(Fo.map(e=>e.toLowerCase()));function Jo(e){let t=String(e).toLowerCase();if(zo.has(t))return!0;let n=t.replace(/[-_.]/g,"");return Ho.some(o=>n.includes(o))?!0:String(e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).some(o=>Ko.includes(o))}function Dt(e){return(e??[]).map(t=>{try{return new RegExp(`^${t}$`,"i")}catch{return{test:n=>n.toLowerCase()===String(t).toLowerCase()}}})}function Hn(e,t={}){if(!e)return null;try{let n=new URLSearchParams(e),r=t.queryParamAllowlist?Dt([...t.queryParamAllowlist,...Go]):null,o=Dt(t.queryParamBlocklist),s=Dt(t.sensitiveParamAllowlist);for(let c of new Set(n.keys()))(Jo(c)&&!s.some(d=>d.test(c))||n.getAll(c).some(d=>Fn(d,c))||(r?!r.some(d=>d.test(c)):o.some(d=>d.test(c))))&&n.delete(c);let i=n.toString();return i?`?${i}`:""}catch{return""}}function Kn(e,t,n={}){if(!e)return null;try{let r=new URL(e);return t&&r.origin===t?r.origin+r.pathname+(Hn(r.search,n)??""):r.origin+r.pathname}catch{return null}}function Vt(e,t={}){if(typeof e!="string"||typeof location>"u")return null;try{let n=new URL(e,location.href);return n.protocol!=="https:"&&n.protocol!=="http:"?null:Kn(n.href,location.origin,t)}catch{return null}}function re(e){if(typeof e!="string")return null;let t=e.trim().toUpperCase();return/^[A-Z]{3}$/.test(t)?t:null}function qn(e){if(typeof e!="string")return null;let t=e.trim().toUpperCase();return/^[A-Z]{2}$/.test(t)?t:null}function $t(e){if(typeof e!="string")return null;let t=e.trim().replace(/_/g,"-");if(!/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(t))return null;try{return Intl.getCanonicalLocales(t)[0]}catch{return null}}function R(e,t){if(typeof e=="function")try{let n=e();if(n!=null)return n}catch{}return t}function Wo(e){return{...e.propertyId==null?{}:{property_id:String(e.propertyId)},channel:e.channel??null,market:e.market??null,environment:e.environment??null}}function Xo(e){let t=typeof window<"u"?window.location:null,n=t?Hn(t.search,e):null;return{url:t?t.origin+t.pathname+(n??""):e.pageUrl??null,path:t?t.pathname:e.pagePath??null,search:n??null,referrer:typeof document<"u"?Kn(document.referrer,t?.origin,e):null,title:typeof document<"u"&&document.title||null,type:e.pageType??null}}var Le;function Yo(){if(Le!==void 0)return Le;try{Le=globalThis.Temporal?.Now?.timeZoneId?.()||Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{Le=null}return Le}function Gn(e,t={}){let n=typeof window<"u"?window.location:null,r={library:{name:e.libraryName,version:e.libraryVersion},spec:{version:Bn},source:Wo(e),session_id:R(e.getSessionId,null),identity_trust:H(R(e.getAnonymousId,null))?"device":"none",page:Xo(e),campaign:n?Ut(n.search):null,device:{user_agent:typeof navigator<"u"?navigator.userAgent:null,type:null,viewport_width:typeof window<"u"?window.innerWidth:null,viewport_height:typeof window<"u"?window.innerHeight:null},currency:re(R(e.getCurrency,e.currency)),locale:$t(R(e.getLocale,e.locale)),timezone:Yo(),country:qn(e.country),ship_to_country:qn(R(e.getShipToCountry,e.shipToCountry)),ip:null,bot:null,consent:e.getConsent?.()??null,experiments:R(e.getExperiments,null),audiences:R(e.getAudiences,null),decisions:R(e.getDecisions,null),recommendations:R(e.getRecommendations,null),extensions:R(e.getExtensions,null)};return zn(r,t)}function zn(e,t){if(!t)return e;let n={...e};for(let[r,o]of Object.entries(t))o&&typeof o=="object"&&!Array.isArray(o)&&e[r]&&typeof e[r]=="object"&&!Array.isArray(e[r])?n[r]=zn(e[r],o):o!==void 0&&(n[r]=o);return n}var pe=Object.freeze({consent:"thg_hp_consent",retry:"thg_hp_retry",sessionSignals:"thg_hp_session_signals",identified:"thg_hp_identified",previousPage:"thg_hp_prev_page",decisions:"thg_hp_decisions",settings:"thg_hp_settings",held:"thg_hp_held",carried:"thg_hp_carried",recommendationContext:"thg_hp_recommendation_context",anonymousId:"thg_hp_anonymous_id",session:"thg_hp_session",preview:"thg_hp_preview",debug:"thg_hp_debug",onsite:"thg_hp_onsite",visitCampaign:"thg_hp_visit_campaign",answers:"thg_hp_answers"}),Zo={retry:"cdp.retry",sessionSignals:"cdp_session_signals",identified:"cdp_identified",previousPage:"cdp_prev_page_message_id"},ze={...pe},Jn=!1;function Je(e){let t={...pe};for(let[n,r]of Object.entries(e??{})){if(!(n in pe))throw new Error(`storageNames: unknown kind "${n}"`);if(typeof r!="string"||!/^[\w.-]+$/.test(r))throw new Error(`storageNames.${n} must be a non-empty cookie-safe name`);t[n]=r}ze=t}function C(e){return ze[e]}var Qo="_",Wn=e=>e==null||e===""?Qo:String(e);function V(e,t,n){let r=`${e}:${Wn(t)}`;return n==null||n===""?r:`${r}:${n}`}function Xn(e,t){return`${e}:${Wn(t)}:`}function We(e){let t=`${ze[e]}:`;try{for(let n of Object.keys(localStorage))n.startsWith(t)&&localStorage.removeItem(n)}catch{}}function Xe(){if(!Jn){Jn=!0;for(let e of[()=>localStorage,()=>sessionStorage]){let t;try{if(t=e(),!t)continue;for(let n of Object.keys(t))for(let[r,o]of Object.entries(Zo)){if(n!==o&&!n.startsWith(`${o}:`))continue;let s=ze[r]+n.slice(o.length);t.getItem(s)===null&&t.setItem(s,t.getItem(n)),t.removeItem(n)}}catch{}}}}var Bt=1800*1e3,Ye=()=>{try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}},jt=()=>{try{return typeof localStorage>"u"?null:localStorage}catch{return null}};function Yn(e,t=()=>Date.now()){return{read(){try{let n=Ye()?.getItem(e),r=n?JSON.parse(n):null;return!r||t()-r.savedAt>Bt?(r&&Ye()?.removeItem(e),{items:[],anonymousId:null}):{items:Array.isArray(r.items)?r.items:[],anonymousId:typeof r.anonymousId=="string"?r.anonymousId:null}}catch{return{items:[],anonymousId:null}}},write(n,r=null){try{n.length===0?Ye()?.removeItem(e):Ye()?.setItem(e,JSON.stringify({savedAt:t(),items:n,anonymousId:r}))}catch{}}}}var es=400*24*60*60;function ae(e,t,n,r){if(typeof document>"u")return!1;try{let o=typeof location<"u"&&location.protocol==="https:"?"; Secure":"",s=r?`; Domain=${r}`:"",i=n===null?"":`; Max-Age=${n}`;return document.cookie=`${e}=${encodeURIComponent(t)}; Path=/${i}; SameSite=Lax`+s+o,!0}catch{return!1}}function ts({name:e,domain:t=null,legacyKey:n,read:r,mint:o,mayStore:s,carried:i=null}){let c=null;try{c=jt()?.getItem(n)||null}catch{c=null}let u=r(e)??c??i,d=!1,f=()=>{if(!(d||u===null||!s())&&(d=ae(e,u,es,t),!(!d||c===null)))try{jt()?.removeItem(n),c=null}catch{}};return{get(){return u??(u=o()),f(),u},peek:()=>u,persist:f,forget(){ae(e,"",0,t),u=null,d=!1;try{jt()?.removeItem(n)}catch{}c=null}}}function Zn(e,{carried:t=null,mayStore:n,orOwn:r=!1}){let o=e.anonymousIdSource,s=()=>ts({name:C("anonymousId"),domain:e.consentCookieDomain??null,legacyKey:V(C("anonymousId"),e.propertyId),read:B,mint:ie,mayStore:n,carried:t});if(o?.source==="hp_cookie"){let u=s();return e.getAnonymousId=()=>u.get(),u}if(o?.source==="site_cookie"&&o.cookie){let u=o.cookie;e.getAnonymousId=()=>B(u)}if(!r)return null;let i=e.getAnonymousId,c=s();return e.getAnonymousId=()=>H(R(i,null))??c.get(),c}var ns=200;function Qn(e,t,n=()=>Date.now()){let r=()=>V(C("carried"),e),o=!1;function s(){try{let i=JSON.parse(sessionStorage.getItem(r())??"null");return!i||!(n()-i.savedAt<=Bt)?[]:Array.isArray(i.calls)?i.calls:[]}catch{return[]}}return{take(){let i=s();try{sessionStorage.removeItem(r())}catch{}return i},save(i){try{return o||!t()?!1:(sessionStorage.setItem(r(),JSON.stringify({savedAt:n(),calls:[...s(),...i].slice(-ns)})),!0)}catch{return!1}},close(){o=!0}}}var Da=pe.consent,Ze=Object.freeze({visitor:"visitor",host:"host"}),tr=()=>({basis:Ze.host}),rs="hp-consent",me=["analytics","marketing","personalisation","ad_user_data","ad_personalization"],nr={analytics:"a",marketing:"m",personalisation:"p",ad_user_data:"aud",ad_personalization:"adp"},oe=()=>typeof window<"u",rr=()=>oe()&&typeof window.cookieStore?.addEventListener=="function",os=e=>e===!0?!0:e===!1?!1:null;function ke(e){if(!e||typeof e!="object")return null;let t={};for(let n of me)t[n]=os(e[n]);return t}function qt(e,t){return!e||!t?e===t:me.every(n=>e[n]===t[n])}function Ft(e){if(!e)return"";let t=[];for(let n of me){let r=e[n];(r===!0||r===!1)&&t.push(`${nr[n]}=${r?1:0}`)}return t.join("&")}function Ht(e){return{[rs]:Ft(ke(e))}}function Te(e){let t=ke({});if(e==null)return t;let n=String(e).trim();if(n.length>=2&&n.startsWith('"')&&n.endsWith('"')&&(n=n.slice(1,-1)),n.includes("%"))try{n=decodeURIComponent(n.replace(/\+/g," "))}catch{return t}let r=Object.fromEntries(Object.entries(nr).map(([s,i])=>[i,s])),o=new Set;for(let s of n.split("&")){let i=s.indexOf("=");if(i<=0)continue;let c=r[s.slice(0,i).trim()],u={1:!0,0:!1}[s.slice(i+1).trim()]??null;!c||u===null||o.has(c)||(t[c]===null?t[c]=u:t[c]!==u&&(t[c]=null,o.add(c)))}return t}function Kt(e,t){if(!t)return e;let n=r=>{if(!r)return r;let o={...r};for(let s of me)s!=="analytics"&&t[s]!==!0&&(o[s]=null);return o};return{name:e.name,basis:e.basis,read:()=>n(e.read()),subscribe:r=>e.subscribe(o=>r(n(o))),get observesChanges(){return e.observesChanges}}}function Gt(e,t={}){return{...e,ad_user_data:t.ad_user_data??e.marketing,ad_personalization:t.ad_personalization??e.marketing}}function Qe(e,t){let n=!0;return{notify:()=>{if(n)try{let o=e();o&&t(o)}catch{}},stop:()=>n=!1}}var ss={analytics:["analytics","measure_content_performance","audience_measurement"],marketing:["marketing","targeting","advertising","select_personalized_ads","create_ads_profile"],personalisation:["personalisation","personalization","select_personalized_content","create_content_profile"]};function is(e,t){if(!t?.length)return null;let n=!1;for(let[r,o]of Object.entries(e)){let s=String(o?.id??r).toLowerCase();if(t.some(c=>{let u=String(c).toLowerCase();return s===u||s.startsWith(`${u}-`)})&&(n=!0,o?.enabled===!0))return!0}return n?!1:null}function or(e={}){let t={...ss,...e.purposes};function n(){let r=oe()?window.Didomi:void 0;if(!r?.getCurrentUserStatus||r.shouldUserStatusBeCollected?.()!==!1||r.isUserStatusPartial?.()===!0)return null;let o=r.getCurrentUserStatus()?.purposes;if(!o||typeof o!="object")return null;let s=i=>is(o,t[i]);return Gt({analytics:s("analytics"),marketing:s("marketing"),personalisation:s("personalisation")},{ad_user_data:s("ad_user_data"),ad_personalization:s("ad_personalization")})}return{name:"didomi",read:n,observesChanges:!0,subscribe(r){if(!oe())return()=>{};let o=Qe(n,r),s={event:"consent.changed",listener:o.notify};return window.didomiEventListeners=window.didomiEventListeners||[],window.didomiEventListeners.push(s),window.didomiOnReady=window.didomiOnReady||[],window.didomiOnReady.push(i=>{o.notify(),(i??window.Didomi)?.on?.("consent.changed",o.notify)}),window.Didomi?.on?.("consent.changed",o.notify),o.stop}}}function er(e){let t={};if(!e)return t;for(let n of String(e).split("&")){let r=n.indexOf("=");if(r<=0)continue;let o=n.slice(r+1).replace(/\+/g," ");try{o=decodeURIComponent(o)}catch{}t[n.slice(0,r)]=o}return t}function sr(e={}){let t={analytics:"C0002",personalisation:"C0003",marketing:"C0004",...e.groups},n=e.impliedConsent===!0;function r(){let i=er(B("OptanonConsent"));if(i.groups){let d={};for(let f of i.groups.split(",")){let[p,m]=f.split(":");p?.trim()&&(d[p.trim()]=m==="1"?!0:m==="0"?!1:null)}return f=>d[f]??!1}let c=oe()?window.OnetrustActiveGroups:void 0;if(typeof c!="string"||!c.length)return null;let u=new Set(c.split(",").map(d=>d.trim()).filter(Boolean));return d=>u.has(d)}function o(){if(B("OptanonAlertBoxClosed"))return!0;try{if(oe()&&window.OneTrust?.IsAlertBoxClosed?.()===!0)return!0}catch{}return n&&oe()&&(!!window.OneTrust||typeof window.OnetrustActiveGroups=="string")}function s(){if(!o())return null;let i=r();if(!i)return null;let c=p=>t[p]?i(t[p]):null,u=Gt({analytics:c("analytics"),marketing:c("marketing"),personalisation:c("personalisation")},{ad_user_data:c("ad_user_data"),ad_personalization:c("ad_personalization")}),d=er(B("OptanonConsent"));return(typeof navigator<"u"&&navigator.globalPrivacyControl===!0||d.isGpcEnabled==="1")&&(u.marketing=!1,u.ad_user_data=!1,u.ad_personalization=!1),u}return{name:"onetrust",read:s,observesChanges:!0,subscribe(i){if(!oe())return()=>{};let c=Qe(s,i),u=!1,d=()=>{u||!window.OneTrust?.OnConsentChanged||(u=!0,window.OneTrust.OnConsentChanged(c.notify))};window.addEventListener("OneTrustGroupsUpdated",c.notify);let f=window.OptanonWrapper;return window.OptanonWrapper=function(...m){try{typeof f=="function"&&f.apply(this,m)}finally{d(),c.notify()}},d(),()=>{c.stop(),window.removeEventListener("OneTrustGroupsUpdated",c.notify)}}}}function as(e){let t=String(e).split(",").map(n=>n.trim()).filter(Boolean);return t.length?new Set(t):null}function ir(e){let{name:t,categories:n,parse:r=as,refusedValue:o,source:s="native",changeEvent:i="thg_hp_consent_change"}=e??{};if(typeof t!="string"||t==="")throw new Error("cookieConsent: `name` (the cookie your banner writes) is required");if(!n||typeof n.analytics!="string")throw new Error("cookieConsent: `categories.analytics` (the category id that grants analytics) is required");function c(){let u=B(t);if(u==null)return null;let d;if(o!==void 0&&u===o)d=new Set;else try{d=r(u)}catch{d=null}if(!(d instanceof Set))return null;let f=p=>n[p]?d.has(n[p]):null;return Gt({analytics:f("analytics"),marketing:f("marketing"),personalisation:f("personalisation")},{ad_user_data:f("ad_user_data"),ad_personalization:f("ad_personalization")})}return{name:s,read:c,get observesChanges(){return rr()},subscribe(u){if(!oe())return()=>{};let d=Qe(c,u),f=p=>{[...p.changed??[],...p.deleted??[]].some(v=>v?.name===t)&&d.notify()};return window.addEventListener(i,d.notify),window.cookieStore?.addEventListener?.("change",f),()=>{d.stop(),window.removeEventListener(i,d.notify),window.cookieStore?.removeEventListener?.("change",f)}}}}function ar(e={}){let t=e.name??C("consent"),n=()=>{let r=B(t);if(r==null)return null;let o=Te(r);return o.analytics==null?null:o};return{name:"forwarded",read:n,get observesChanges(){return rr()},subscribe(r){if(!oe())return()=>{};let o=Qe(n,r),s=i=>{[...i.changed??[],...i.deleted??[]].some(u=>u?.name===t)&&o.notify()};return window.cookieStore?.addEventListener?.("change",s),()=>{o.stop(),window.cookieStore?.removeEventListener?.("change",s)}}}}function cr(e){let t=ke(e);return{name:"static",basis:Ze.host,read:()=>t?{...t}:null,observesChanges:!0,subscribe:()=>()=>{}}}function ur(e){if(e==null)return null;let t=String(e).split("/").map(n=>n.trim()).filter(Boolean).join("/");return t===""?null:t}function cs(e){let t=e.item_category;if(t!=null&&String(t).includes("/"))return ur(t);let n=[t,e.item_category2,e.item_category3,e.item_category4,e.item_category5].map(r=>r==null?"":String(r).trim()).filter(Boolean);return ur(n.join("/"))}var us=e=>{if(e==null||typeof e=="object")return null;let t=String(e).trim();return t===""?null:t};function ls(...e){for(let t of e){if(typeof t=="number"&&Number.isFinite(t))return String(t);if(typeof t=="string"&&t.trim()!=="")return t.trim()}return null}var et=e=>ls(e.item_group_id,e.item_id);function ds(e,t=et){if(!e)return null;let n=c=>c==null||c===""||Number.isNaN(Number(c))?null:Number(c),r=c=>{let u=n(c);return u==null?null:Math.round(u*1e6)/1e6},o=c=>{let u=r(c);return u!=null&&u>=0?u:null},s=c=>{let u=n(c);return Number.isInteger(u)&&u>=0?u:null},i=us;return{product_id:i(t(e)),sku:i(e.item_id),name:i(e.item_name),brand:i(e.item_brand),variant:i(e.item_variant)??i(e.variant),category:cs(e),price:r(e.price),discount:o(e.discount),quantity:s(e.quantity),coupon:i(e.coupon),position:s(e.index)!=null?s(e.index)+1:null,url:i(e.url)??i(e.item_url)??null,image_url:i(e.image_url)??i(e.image_link)??null,displayed_sku:i(e.displayed_sku)??i(e.displayed_variant_sku)}}function zt(e,t=et){return(e??[]).map(n=>ds(n,t)).filter(n=>n?.product_id)}var fs=1e3,ps={shipping:2,payment:3},ms=new Set(["password","google","apple","facebook","magic_link","sso","passkey","other"]),q=e=>{if(e==null||typeof e=="object")return null;let t=String(e).trim();return t===""?null:t},hs=e=>{if(e==null||e===""||typeof e=="object")return null;let t=Number(e);return Number.isFinite(t)&&t>=0?t:null},tt=e=>e!==null&&typeof e=="object";function gs(e){return Array.isArray(e.items)?e.items.filter(tt):null}function lr(e){let t=q(e)?.toLowerCase().replace(/[\s-]+/g,"_");return t?ms.has(t)?t:t==="email"||t==="email_password"?"password":"other":null}function ys({ecommerce:e,items:t}){let n=s=>({promotion_id:q(s.promotion_id),name:q(s.promotion_name),creative:q(s.creative_name),position:q(s.creative_slot)}),r=new Set,o=[];for(let s of[n(e),...t.map(n)])!s.promotion_id||r.has(s.promotion_id)||(r.add(s.promotion_id),o.push(s));return o}var dr=({ecommerce:e,items:t})=>q(e.item_list_id)??q(e.item_list_name)??q(t[0]?.item_list_id)??q(t[0]?.item_list_name),he=(e,t)=>t.products?.length?{event:e,properties:t}:null,ws=new Set(["product","products","item","items"]);function Ss({ecommerce:e}){let t=q(e.item_id),n=q(e.content_type)?.toLowerCase();return!t||n&&!ws.has(n)?null:{event:"Product Shared",properties:{share_via:q(e.method),products:[{product_id:t}]}}}function _s(e){let t=o=>he("Product List Viewed",{list_id:dr(o),products:o.products}),n=o=>{let s=q(o.ecommerce.search_term);return s?{event:"Products Searched",properties:{query:s,...o.products.length?{products:o.products}:{}}}:null},r=o=>s=>s.promotions.map(i=>({event:o,properties:i}));return{view_item:o=>he("Product Viewed",{currency:o.currency,value:o.value,products:o.products.slice(0,1)}),view_item_list:t,view_search_results:o=>n(o)??t(o),search:n,select_item:o=>he("Product Clicked",{list_id:dr(o),products:o.products.slice(0,1)}),add_to_cart:o=>he("Product Added",{cart_id:q(o.ecommerce.cart_id),products:o.products}),remove_from_cart:o=>he("Product Removed",{cart_id:q(o.ecommerce.cart_id),products:o.products}),view_cart:o=>({event:"Cart Viewed",properties:{cart_id:q(o.ecommerce.cart_id),value:o.value,currency:o.currency,coupon:q(o.ecommerce.coupon),...o.itemsListed?{products:o.products}:{}}}),begin_checkout:o=>he("Checkout Started",{value:o.value,currency:o.currency,coupon:q(o.ecommerce.coupon),products:o.products}),add_shipping_info:o=>({event:"Checkout Step Completed",properties:{step:e.shipping,step_name:"shipping",shipping_method:q(o.ecommerce.shipping_tier)}}),add_payment_info:o=>({event:"Payment Info Entered",properties:{step:e.payment,step_name:"payment",payment_method:q(o.ecommerce.payment_type)}}),view_promotion:r("Promotion Viewed"),select_promotion:r("Promotion Clicked"),add_to_wishlist:o=>he("Product Added to Wishlist",{products:o.products}),share:Ss,login:o=>({event:"Signed In",properties:{method:lr(o.ecommerce.method)}}),sign_up:o=>({event:"Signed Up",properties:{method:lr(o.ecommerce.method)}})}}var bs=e=>e.event;function As(e,t){if(!tt(e))return null;if(typeof e.length=="number"&&e[0]==="event"&&typeof e[1]=="string"){let r=tt(e[2])?e[2]:{};return{name:e[1],entry:r,ecommerce:r}}let n=q(t(e));return n?{name:n,entry:e,ecommerce:tt(e.ecommerce)?e.ecommerce:e}:null}function Jt(e){return Array.isArray(e)?`[${e.map(Jt).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${Jt(e[t])}`).join(",")}}`:JSON.stringify(e??null)}function fr(e,t={}){if(!e||typeof e.track!="function")throw new Error("connectDataLayer: analytics must have a track(event, properties, options) method");let n=t.dataLayer??(typeof window<"u"?window.dataLayer=window.dataLayer||[]:null);if(!Array.isArray(n))return()=>{};let r=_s({...ps,...t.steps}),o=t.map??{},s=t.eventName??bs,i=t.productId??et,c=new Set(["purchase","refund",...t.ignore??[]]),u=t.dedupeMs??fs,d=new Map,f=!0;function p(_,g,y){if(u<=0)return!1;let O=`${_}|${y??""}|${Jt(g)}`,N=Date.now();for(let[$,G]of d)N-G>u&&d.delete($);return d.has(O)?!0:(d.set(O,N),!1)}let m=null,v=new Set;function w(_,g){if(_!=="Product Viewed")return!1;let y=typeof location>"u"?"":location.pathname;y!==m&&(m=y,v.clear());let O=g.products?.[0]?.product_id;return O?v.has(O)?!0:(v.add(O),!1):!1}function I({event:_,properties:g={}},y){if(!_||p(_,g,y)||w(_,g))return;let O=y?{context:{currency:y}}:void 0;if(_==="Signed Out"&&typeof e.signedOut=="function"){e.signedOut(O);return}e.track(_,g,O)}function b(_){let g=t.transform?t.transform(_):_,y=As(g,s);if(!y||c.has(y.name))return;let O=Object.hasOwn(o,y.name),N=O?o[y.name]:r[y.name];if(typeof N!="function")return;let $=gs(y.ecommerce),G=$??[],F={...y,items:G,itemsListed:$!==null,products:zt(G,i),currency:re(y.ecommerce.currency),value:hs(y.ecommerce.value)};F.promotions=ys(F);let Se=O?N(g,{...F,toProducts:W=>zt(W,i)}):N(F);for(let W of[Se].flat())W&&I(W,F.currency)}function x(_){if(f)try{b(_)}catch(g){try{t.onError?.(g,_)}catch{}}}for(let _ of n.slice())x(_);let h=n.push;function P(..._){let g=h.apply(this,_);for(let y of _)x(y);return g}return n.push=P,()=>{f=!1,n.push===P&&(n.push=h)}}var ks="hp_debug",Is=256;function xs(){try{return new URLSearchParams(location.search).get(ks)}catch{return null}}function pr(e,t){if(typeof location>"u")return!1;try{let n=xs();if(n!==null){let o=n.trim();o===""||o.length>Is?sessionStorage.removeItem(t):sessionStorage.setItem(t,o)}let r=sessionStorage.getItem(t);return!!(e&&r&&Nn(r)===e)}catch{return!1}}var Ie=class extends Error{},vs={inHoldout:()=>!0,personalisationGroup:()=>"excluded",servingHeaders:()=>({}),recommendationContext:()=>({}),flush:()=>Promise.resolve(),reset:()=>{}};function Wt(e,t){let n=vs[e]??(()=>null),r=o=>(console.warn(`[hp] ${String(e)} failed; nothing was sent`,o),n());return function(...s){try{let i=t.apply(this,s);return typeof i?.then=="function"?Promise.resolve(i).catch(r):i}catch(i){if(i instanceof Ie)throw i;return r(i)}}}function mr(e){for(let t of Reflect.ownKeys(e)){let{value:n}=Object.getOwnPropertyDescriptor(e,t)??{};typeof n=="function"&&(e[t]=Wt(t,n))}return e}var Ne=Symbol("hp.identityOption");var Es=2160*60*60*1e3,Cs=50,Ps=20,Os=128,Xt=e=>V(C("answers"),e),rt=e=>typeof e=="string"&&e!==""&&e.length<=Os;function hr(e,t){try{let n=JSON.parse(localStorage.getItem(Xt(e)));return Array.isArray(n)?n.filter(r=>rt(r?.q)&&Array.isArray(r.v)&&r.v.every(rt)&&t-r.at<Es):[]}catch{return[]}}function Yt(e,t=Date.now()){return Object.fromEntries(hr(e,t).map(n=>[n.q,n.v]))}function gr(e,t){let n=Array.isArray(t)?t:[];return(Array.isArray(e)?e:[]).flatMap(r=>{let o=n.find(c=>c?.key===r?.question);if(!o||o.type!=="one"&&o.type!=="many")return[];let s=new Set((o.options??[]).map(c=>c?.value)),i=(Array.isArray(r.values)?r.values:[]).filter(c=>s.has(c));return i.length?[{question:r.question,values:i}]:[]})}function yr(e,t,n=Date.now()){let r=(Array.isArray(t)?t:[]).filter(i=>rt(i?.question)&&Array.isArray(i.values));if(!r.length)return;let o=new Set(r.map(i=>i.question)),s=[...hr(e,n).filter(i=>!o.has(i.q)),...r.map(i=>({q:i.question,v:i.values.filter(rt).slice(0,Ps),at:n}))].slice(-Cs);try{nt.delete(e),localStorage.setItem(Xt(e),JSON.stringify(s))}catch{}}var nt=new Set;function wr(e){if(e===void 0)We("answers"),nt.clear();else if(!nt.has(e)){try{localStorage.removeItem(Xt(e))}catch{}nt.add(e)}}var Ls=4320*60*60,Ts=100,Ns=1e3,Rs=2e3,Sr=500,ot=e=>(e?.unref?.(),e);function Ms(e,t){if(t?.analytics===!0&&e.analytics===!1)return"withdrawn";let n=me.map(r=>e[r]).filter(r=>r!==null);return n.length&&n.every(Boolean)?"accept_all":n.length&&n.every(r=>!r)?"reject_all":"custom"}function Ds(e,t,n=C("consent")){if(!(typeof document>"u"))try{let r=typeof location<"u"&&location.protocol==="https:"?"; Secure":"",o=t?`; Domain=${t}`:"";document.cookie=`${n}=${Ft(e)}; Path=/; Max-Age=${Ls}; SameSite=Lax`+o+r}catch{}}function Us(e){let t=Te(B(e));return me.some(n=>t[n]!==null)?t:null}function _r(e){let{adapter:t,timeoutMs:n=5e3,cookieDomain:r=null,cookieName:o=C("consent"),release:s,announce:i}=e,c=e.discard??(()=>{}),u="pending",d=null,f=null,p=null,m=null,v=!1,w=null,I=[],b=M=>{u=M,e.onStatus?.(M)};function x(){try{return ke(t.read())}catch{return null}}function h(){f&&clearInterval(f),p&&clearTimeout(p),f=null,p=null}let P=()=>typeof window<"u"&&typeof document<"u",_=()=>{try{return typeof t.subscribe=="function"&&t.observesChanges===!0}catch{return!1}};function g(){m&&clearInterval(m),m=null}function y(){v||m||d===null||_()||P()&&document.visibilityState==="hidden"||(m=ot(setInterval(()=>F(x()),Rs)))}let O=()=>u==="pending"||u==="unknown",N=e.store??null,$=()=>{let M=I.splice(0);N?.write([]);for(let K of M)s(K)},G=()=>{let M=I.splice(0);N?.write([]);for(let K of M)c(K)};function F(M){let K=ke(M);if(!K||K.analytics===null)return;let qe=d===null,te=qe?Us(o):d;if(!qe&&qt(te,K))return;h(),d=K,y(),Ds(K,r,o);let X=!qt(te,K);if(K.analytics){b("granted"),$(),X&&i({action:Ms(K,te),state:K,previous:te,withdrawal:!1});return}G(),te?.analytics===!0&&i({action:"withdrawn",state:K,previous:te,withdrawal:!0}),b("denied")}function Se(){p=null,u==="pending"&&(b("unknown"),f&&clearInterval(f),f=ot(setInterval(()=>F(x()),Ns)))}function W(M){if(O()){if(N){N.write(I);return}M?.type!=="visibilitychange"&&!M?.persisted&&G()}}let ee=M=>{document.visibilityState==="hidden"?(g(),W(M)):y()},_e=M=>{g(),W(M)},be=M=>{M?.persisted&&d!==null&&F(x()),y()};return{get status(){return u},get state(){return d?{...d}:null},stamp(){return d?{...d,source:t.name??null,basis:t.basis??Ze.visitor}:null},admits(){return u==="granted"},hold(M){return!O()||I.length>=Sr?(c(M),!1):(I.push(M),!0)},onHidden:W,start(){v=!1;try{w=t.subscribe?.(M=>F(M))??null}catch(M){e.debug&&console.warn("[hp] consent adapter subscribe failed",M)}P()&&(window.addEventListener("pagehide",_e),window.addEventListener("pageshow",be),document.addEventListener("visibilitychange",ee)),N&&I.length===0&&I.push(...N.read().slice(-Sr)),F(x()),!d&&(f=ot(setInterval(()=>F(x()),Ts)),p=ot(setTimeout(Se,n)))},stop(){v=!0,h(),g(),typeof w=="function"&&w(),P()&&(window.removeEventListener("pagehide",_e),window.removeEventListener("pageshow",be),document.removeEventListener("visibilitychange",ee))}}}var Vs=["recommendation","search_rank","banner","offer","layout","copy","price","other"],st=e=>typeof e=="string"&&e!=="";function br(e){return(Array.isArray(e?.decisions)?e.decisions:[]).filter(t=>st(t?.slot)&&st(t.decision_id)&&t.holdout!==!0).map(({decision_id:t,slot:n,arm:r,kind:o})=>({decision_id:t,slot:n,...st(r)&&{arm:r},...Vs.includes(o)&&{kind:o}}))}function Ar({key:e,mayStore:t}){let n,r=()=>{if(n)return n;try{let s=JSON.parse(sessionStorage.getItem(e));n=Array.isArray(s)?s.filter(i=>st(i?.slot)):[]}catch{n=[]}return n},o=()=>{try{n?.length&&t()&&sessionStorage.setItem(e,JSON.stringify(n))}catch{}};return{persist:o,current:()=>r().length?n.map(s=>({...s})):null,remember(s){if(!s.length)return;let i=new Set(s.map(c=>c.slot));n=[...r().filter(c=>!i.has(c.slot)),...s],o()},forget(){n=[];try{sessionStorage.removeItem(e)}catch{}}}}function $s(e){let t=2166136261,n=String(e);for(let r=0;r<n.length;r+=1)t^=n.charCodeAt(r),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t^=t>>>16,t=Math.imul(t,2246822507)>>>0,t^=t>>>13,t=Math.imul(t,3266489909)>>>0,t^=t>>>16,t>>>0}function it(e,t,n=1e4){return $s(`${t}\0${e}`)%n}function Zt(e){let t=o=>Math.min(Math.max(Number(o)||0,0),1),n=t(e.share),r=1-n;return{holdout_share:n,personalised_share:e.ramp==null?r:Math.min(t(e.ramp),r)}}function Qt(e,t){if(!e||typeof e.salt!="string")return{holdout:!1,bucket:null,group:"personalised"};let n=e.ramp!=null;if(t==null||t==="")return{holdout:!1,bucket:null,group:n?"excluded":"personalised"};let{holdout_share:r,personalised_share:o}=Zt(e),s=it(t,e.salt),i=u=>Math.round(u*1e4),c=r>0&&s<i(r)?"holdout":!n||s<i(r+o)?"personalised":"excluded";return{holdout:c==="holdout",bucket:s,group:c}}function kr(e,t){return typeof e!="string"||e===""||t==null||t===""?null:it(t,`bandit-vs-default:${e}`)<1e4/2?"default":"bandit"}var Re=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite"),Y=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.pending"),Me=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.listeners"),at=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.suppressed"),js=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.page-values"),Bs=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.page-facts"),qs=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.page-said"),Fs=["shown","submitted","apply","closed","held","nothing"],Ir=10,Q=()=>typeof window>"u"?null:window;function en(){try{for(let e of Q()?.[qs]??[])e()}catch{}}function De(){try{for(let{resolve:e}of Q()?.[Y]?.splice(0)??[])e(!1)}catch{}}var ge=Object.freeze({open(e){try{let t=Q();if(!t||typeof e!="string")return Promise.resolve(!1);if(t[Re])return t[Re].open(e);if(t[Y]??(t[Y]=[]),t[Y].length<Ir)return new Promise(n=>t[Y].push({slot:e,resolve:n}))}catch{}return Promise.resolve(!1)},show(e){return ge.open(e)},on(e,t){var n;try{let r=Q();return!r||!Fs.includes(e)||typeof t!="function"?()=>{}:(r[Me]??(r[Me]={}),((n=r[Me])[e]??(n[e]=new Set)).add(t),()=>r[Me][e].delete(t))}catch{return()=>{}}},suppress(e="page"){try{let t=Q();if(!t)return;(t[at]??(t[at]=new Set)).add(String(e)),t[Re]?.suppress()}catch{}},unsuppress(e){try{let t=Q()?.[at];e===void 0?t?.clear():t?.delete(String(e))}catch{}},values(e){try{let t=Q();t&&(t[js]=e&&typeof e=="object"?{...e}:{})}catch{}},facts(e){try{let t=Q();t&&(t[Bs]={path:t.location?.pathname,facts:e&&typeof e=="object"?{...e}:{}})}catch{}en()},ready(){try{let e=Q();if(!e)return Promise.resolve([]);if(e[Re])return Promise.resolve(ge.debug());if(e[Y]??(e[Y]=[]),e[Y].length<Ir)return new Promise(t=>e[Y].push({slot:null,resolve:()=>t(ge.debug())}))}catch{}return Promise.resolve([])},debug(){try{return Q()?.[Re]?.debug()??[]}catch{return[]}}});var Hs="hp_preview",Ks=256;function xr(e,t=null){if(typeof location>"u")return B(e);let n=null;try{n=new URLSearchParams(location.search).get(Hs)}catch{n=null}if(n===null)return B(e);let r=n.trim();return r===""||r.length>Ks?(ae(e,"",0,t),null):(ae(e,r,null,t),r)}var Gs=40,zs=128,Js=5,Ws=60,Er=e=>typeof e=="string"&&e!==""&&e.length<=zs&&!e.includes(","),vr=e=>Array.isArray(e)?e.filter(Er).slice(0,Gs):[],Xs=e=>Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.replaceAll(","," ").trim()).filter(t=>t!=="").slice(0,Js):[],Ys=e=>Object.entries(e&&typeof e=="object"?e:{}).filter(([t,n])=>Er(t)&&Number.isFinite(n)&&n>=1).sort(([,t],[,n])=>n-t).slice(0,Ws).map(([t,n])=>`${t}:${Math.floor(n)}`);function tn(e){let t={},n={viewed:vr(e?.recentProducts),basket:vr(e?.basketProducts),q:Xs(e?.recentSearches),impressed:Ys(e?.impressions)};for(let[r,o]of Object.entries(n))o.length>0&&(t[r]=o.join(","));return t}var Zs=1800*1e3;function Cr(e,t=Date.now()){try{localStorage.setItem(C("recommendationContext"),JSON.stringify({context:e,until:t+Zs}))}catch{}}function Pr(){try{localStorage.removeItem(C("recommendationContext"))}catch{}}var Qs="hp_sample",Or=1e4;function Lr(e,t){return!(typeof t=="number"&&t<1)||e==null||e===""?!0:it(e,Qs,Or)<Math.round(t*Or)}function xe(e){return e.trim().toLowerCase().replace(/\s*\/\s*/g,"/").replace(/^\/+|\/+$/g,"")}var ei=2,ti=12;function Ue(e,t=ei){return e.split("/").slice(0,t).join("/")}function nn(e,t){if(typeof t!="string"||!t.trim())return null;let n=Ue(xe(t));return n?(e.unshift(n),e.length=Math.min(e.length,ti),n):null}var ye=()=>C("sessionSignals"),ve=null,rn=()=>ve??ye();function Tr(){try{return ve?localStorage:sessionStorage}catch{return}}function Nr(e,t){let n=t==null?null:String(t),r=e?V(ye(),n,e):null;if(r===ve)return;let o=ve===null?ni():null;if(ve=r,!!ve)try{let s=rn(),i=Xn(ye(),n);for(let c of Object.keys(localStorage))c.startsWith(i)&&c!==s&&localStorage.removeItem(c);o&&!localStorage.getItem(s)&&(localStorage.setItem(s,JSON.stringify(o)),sessionStorage.removeItem(ye()))}catch{}}function ni(){try{let e=sessionStorage.getItem(ye());if(!e)return null;let t=JSON.parse(e);return t&&(t.productViews>0||t.listViews>0||t.basketValue!=null||t.recentProducts?.length||t.recentBrowse?.length||t.campaign)?t:null}catch{return null}}function ct(){return{productViews:0,listViews:0,cartAdds:0,searches:0,recentProducts:[],recentCategories:[],recentBrowse:[],basketProducts:[],basketValue:null,basketItems:null,basketCurrency:null,recentSearches:[],impressions:{},browsingCategory:null,recentBrowseCategories:[],browsingListing:null,listViewsByCategory:{},campaign:null,startedAt:0}}function on(){let e=Tr();if(!e)return ct();try{let t=e.getItem(rn());return t?{...ct(),...JSON.parse(t)}:{...ct(),startedAt:Date.now()}}catch{return{...ct(),startedAt:Date.now()}}}function Ve(e){let t=Tr();if(t)try{t.setItem(rn(),JSON.stringify(e))}catch{}}function Ee(){return on()}function Rr(){for(let e of[()=>sessionStorage,()=>localStorage])try{let t=e();t.removeItem(ye());for(let n of Object.keys(t))n.startsWith(`${ye()}:`)&&t.removeItem(n)}catch{}}var sn=20,Mr=200,ri=new Set(["Product Viewed","Product Clicked","Product Added","Product Added to Wishlist"]),oi=new Set(["Product Viewed","Product Added"]),Dr=50;function ut(e,t){let n=nn(e.recentBrowse,t);return n?(e.recentBrowseCategories=[e.browsingListing?.category??null,...e.recentBrowseCategories].slice(0,e.recentBrowse.length),n):null}function si(e,t){let n=e.listViewsByCategory;n[t]=(n[t]??0)+1;let r=Object.keys(n);if(r.length>Dr){let o={};for(let s of r.sort((i,c)=>n[c]-n[i]).slice(0,Dr))o[s]=n[s];e.listViewsByCategory=o}}var Ur=e=>[...new Set(e.map(t=>t?.product_id).filter(t=>typeof t=="string"&&t))].slice(0,sn),an=e=>e.reduce((t,n)=>{let r=n?.quantity;return r==null?t+1:typeof r!="number"||!Number.isFinite(r)||r<=0?t:t+(Number.isInteger(r)?r:1)},0);function Vr(e,t,n){let r=on();r.startedAt||(r.startedAt=Date.now());let o=n!==void 0&&JSON.stringify(n??null)!==JSON.stringify(r.campaign??null);o&&(r.campaign=n??null);let s=Array.isArray(t?.products)?t.products:[];switch(e){case"Product Viewed":r.productViews+=1,ut(r,r.browsingCategory);break;case"Product List Viewed":{let u=t?.list_id,d=t?.category;if(!(typeof u=="string"&&u.includes("/")&&!u.startsWith("cdp-")))break;let p=typeof d=="string"&&Ue(xe(d))||null,m=p?Ue(xe(u)):"";if(!m){r.browsingCategory=null,r.browsingListing=null;break}r.browsingListing={key:m,category:p},ut(r,m),r.browsingCategory=m,si(r,p),r.listViews+=1}break;case"Product List Filtered":{let u=t?.change,d=typeof t?.list_id=="string"?t.list_id:"",f=typeof u?.value=="string"?u.value:"",p=r.browsingListing;if(f&&u?.action!=="removed"&&p&&Ue(xe(d))===p.key){let m=ut(r,`${d}/${f}`);m&&(r.browsingCategory=m)}break}case"Product Added":{r.cartAdds+=1,ut(r,r.browsingCategory);for(let u of s){let d=u.product_id;typeof d!="string"||!d||(r.basketProducts=[d,...r.basketProducts.filter(f=>f!==d)].slice(0,sn))}break}case"Product Removed":{for(let u of s){let d=u.product_id;typeof d=="string"&&d&&(r.basketProducts=r.basketProducts.filter(f=>f!==d))}break}case"Products Searched":{r.searches+=1;let u=t?.query;if(typeof u=="string"&&u.trim()){let d=u.trim().toLowerCase().slice(0,64);r.recentSearches=[d,...r.recentSearches.filter(f=>f!==d)].slice(0,5)}break}case"Product Clicked":case"Product Added to Wishlist":break;case"Cart Viewed":return s.length>0&&(r.basketProducts=Ur(s)),Ve(r),r;case"Cart Updated":{Array.isArray(t?.products)&&(r.basketProducts=Ur(s)),r.basketItems=Array.isArray(t?.products)?an(s):null,r.basketCurrency=re(t?.currency);let u=t?.value;return r.basketValue=typeof u=="number"&&Number.isFinite(u)&&u>=0?u:null,Ve(r),r}default:return o&&Ve(r),r}let i=ri.has(e);if(i)for(let u of s)typeof u.product_id=="string"&&u.product_id&&delete r.impressions[u.product_id];else{for(let d of s){let f=d.product_id;typeof f!="string"||!f||(r.impressions[f]=(r.impressions[f]??0)+1)}let u=Object.keys(r.impressions);if(u.length>Mr){let d={};for(let f of u.sort((p,m)=>r.impressions[m]-r.impressions[p]).slice(0,Mr))d[f]=r.impressions[f];r.impressions=d}}let c=new Set;for(let u of s){let d=u.product_id;if(i&&typeof d=="string"&&d&&(r.recentProducts=[d,...r.recentProducts.filter(f=>f!==d)].slice(0,sn)),oi.has(e)&&typeof u.category=="string"&&u.category){let f=xe(u.category);f&&!c.has(f)&&(c.add(f),nn(r.recentCategories,f))}}return Ve(r),r}var lt=1800*1e3;function $r({name:e,domain:t=null,mayStore:n,now:r=()=>Date.now(),mint:o=ie}){let s=null,i=0,c=()=>{s!==null&&n()&&ae(e,s,lt/1e3,t)};return{get(){let u=r(),d=B(e);return d?s=d:(s===null||u-i>=lt)&&(s=o()),i=u,c(),s},persist:c,forget(){ae(e,"",0,t),s=null}}}var J=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),jr=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),Br=Object.freeze({enabled:!1}),un=Object.freeze({enabled:!0,queryParamAllowlist:Object.freeze([])});function qr(e,t){let n=e?.track;return J(n)?(Object.hasOwn(n,t)?n[t]:n.__default)?.enabled!==!1:!0}function ii(e,t){return`${ce(e)}/v1/projects/${encodeURIComponent(t)}/settings`}var ai="https://hp.thgingenuity.com";function ce(e){return e==null||e===""?ai:Hr(e)}function Fr(e,t){return e!=null&&e!==""?ce(e):t?.startsWith("https://")?t:ce(void 0)}function Hr(e){if(typeof e!="string")return null;let t=e.trim().replace(/\/+$/,"");return/^https?:\/\/[^/\s]+$/i.test(t)?t:/^[a-z0-9.-]+(:\d+)?$/i.test(t)?`https://${t}`:null}function ci(e){if(!J(e))return null;let t=Object.fromEntries(Object.entries(e).filter(([,n])=>typeof n=="boolean"));return Object.keys(t).length?t:null}var cn=e=>typeof e=="number"&&e>=0&&e<=1,ui=/^[0-9a-f]{64}$/;function li(e){return J(e)?{enabled:e.enabled===!0,tokenSha256:typeof e.tokenSha256=="string"&&ui.test(e.tokenSha256)?e.tokenSha256:null}:{enabled:!1,tokenSha256:null}}function di(e){if(!J(e))return null;let t=Object.fromEntries(Object.entries(e).filter(([,n])=>J(n)&&cn(n.share)&&(n.ramp==null||cn(n.ramp))&&typeof n.salt=="string"&&n.salt!=="").map(([n,r])=>[n,{share:r.share,ramp:r.ramp??null,salt:r.salt,...jr(r.readoutSlots)&&r.readoutSlots.length>0&&{readoutSlots:r.readoutSlots}}]));return Object.keys(t).length?t:null}var fi=/^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/;function pi(e){return J(e)?e.source==="hp_cookie"?{source:"hp_cookie"}:e.source!=="site_cookie"?null:e.cookie==null?{source:"site_cookie",cookie:null}:typeof e.cookie=="string"&&fi.test(e.cookie)?{source:"site_cookie",cookie:e.cookie}:null:null}function mi(e){let t=Array.isArray(e?.forms)?e.forms.filter(J):[];return t.length===0?null:{forms:t,capture:J(e.capture)?e.capture:null,...Number.isInteger(e.overlay_gap_minutes)?{overlay_gap_minutes:e.overlay_gap_minutes}:{}}}function hi(e){let t=J(e)?e.hp:null;return J(t)&&typeof t.enabled=="boolean"}function ln(e){let t=J(e)?e.hp:null;if(!J(t)||t.enabled!==!0)return Br;let n=mi(t.onsite);return{enabled:!0,propertyId:typeof t.propertyId=="string"&&t.propertyId!==""?t.propertyId:null,environment:typeof t.environment=="string"?t.environment:null,consentPurposes:ci(t.consent?.purposes),queryParamAllowlist:jr(t.queryParamAllowlist)?t.queryParamAllowlist:null,anonymousId:pi(t.anonymousId),apiHost:Hr(t.apiHost),holdouts:di(t.holdouts),sampleRate:cn(t.sampleRate)?t.sampleRate:1,debug:li(t.debug),...n&&{onsite:n},plan:J(e.plan)&&J(e.plan.track)?{track:e.plan.track}:null}}var gi=3e3;async function Kr(e,t,n=globalThis.fetch,r=gi){try{let o=await n(ii(e,t),{credentials:"omit",headers:{accept:"application/json"},signal:AbortSignal.timeout?.(r)});if(o.status>=400&&o.status<500&&o.status!==408&&o.status!==429)return Br;if(!o.ok)return null;let s=await o.json();return hi(s)?ln(s):null}catch{return null}}var dt=e=>V(C("settings"),e);function Gr(e){try{let t=localStorage.getItem(dt(e));if(!t)return null;let n=JSON.parse(t);return n?.enabled===!0?n:null}catch{return null}}function zr(e,t){try{t?.enabled===!0?localStorage.setItem(dt(e),JSON.stringify(t)):localStorage.removeItem(dt(e))}catch{}}function dn(e){try{localStorage.removeItem(dt(e))}catch{}}var yi={flushAt:20,flushIntervalMs:1e4,maxQueue:500,maxRetryAgeMs:1440*60*1e3,maxRetries:5,maxPersistedBatches:20,maxPersistedBytes:1024*1024,storageKey:pe.retry,beaconSafeBytes:56*1024,maxBatchEvents:100,maxBatchBytes:500*1024},ft=()=>Date.now(),Jr=3e4,yn=55*1024;function wi(e,t=ft()){if(typeof e!="string")return 0;let n=e.trim();if(/^\d+$/.test(n))return Number(n)*1e3;if(n==="")return 0;let r=Date.parse(n);return Number.isNaN(r)?0:Math.max(0,r-t)}var ue=e=>typeof TextEncoder<"u"?new TextEncoder().encode(e).length:Buffer.byteLength(e),fn=()=>typeof window<"u"&&typeof document<"u";function Si(){try{return!fn()||!window.localStorage?null:(window.localStorage.getItem("thg_hp_probe"),window.localStorage)}catch{return null}}var A,pn,mn,pt,hn,gn,Wr,$e,je,Be,Xr,mt,Yr,ht,gt=class{constructor(t){Ln(this,A);this.o={...yi,...t},this.queue=[],this.timer=null,this.storage=Si(),this.inflight=null,this.sending=new Set,this.epoch=0,this.sinceRefusal=new Set,this.wakers=new Set,this.replayAllowed=!this.o.deferReplay,this.draining=null,this.failing=!1,this.answered=!1,fn()&&(window.addEventListener("pagehide",()=>this.flush({beacon:!0})),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flush()}),L(this,A,ht).call(this))}markFailing(){this.answered||(this.failing=!0)}replayPersisted(){return this.replayAllowed=!0,L(this,A,ht).call(this)}clearPersisted(){if(this.replayAllowed=!1,!!this.storage)try{let t=L(this,A,Be).call(this).filter(n=>this.sinceRefusal.has(n?.id));t.length?this.storage.setItem(this.o.storageKey,JSON.stringify(t)):this.storage.removeItem(this.o.storageKey)}catch{}}discardQueued(){this.queue=[],this.epoch+=1,this.sinceRefusal.clear(),L(this,A,mn).call(this);for(let t of this.wakers)t()}enqueue(t){let n;try{n=JSON.parse(JSON.stringify(t))}catch(r){this.o.onError?.(`event ${t?.messageId??""} cannot be serialised; dropped`,r);return}this.queue.push(n),this.queue.length>this.o.maxQueue&&this.queue.splice(0,this.queue.length-this.o.maxQueue),this.queue.length>=this.o.flushAt?this.flush():L(this,A,pn).call(this)}flush(t={}){if(L(this,A,mn).call(this),this.queue.length===0)return Promise.resolve();if(t.beacon&&fn()&&typeof navigator<"u"&&navigator.sendBeacon)return L(this,A,Wr).call(this),Promise.resolve();if(this.inflight)return this.inflight;let n=L(this,A,gn).call(this,this.queue,this.o.maxBatchEvents,this.o.maxBatchBytes).map(o=>{let s=L(this,A,mt).call(this,o);return s&&(this.sending.add(s),this.sinceRefusal.add(s)),{batch:o,id:s}});this.queue=[];let r=this.epoch;return this.inflight=(async()=>{for(let{batch:o,id:s}of n){if(r!==this.epoch){L(this,A,je).call(this,s);continue}await L(this,A,$e).call(this,o,0,s,r)}})().finally(()=>{this.inflight=null,this.queue.length>=this.o.flushAt?this.flush():this.queue.length&&L(this,A,pn).call(this)}),this.inflight}};A=new WeakSet,pn=function(){this.timer||(this.timer=setTimeout(()=>this.flush(),this.o.flushIntervalMs),this.timer?.unref?.())},mn=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},pt=function(t){return JSON.stringify({batch:t,writeKey:this.o.writeKey,sentAt:new Date().toISOString()})},hn=function(){return`${this.o.apiHost.replace(/\/$/,"")}/v1/batch`},gn=function(t,n,r){let o=ue(L(this,A,pt).call(this,[])),s=[],i=[],c=o;for(let u of t){let d=ue(JSON.stringify(u))+1;i.length&&(i.length>=n||c+d>r)&&(s.push(i),i=[],c=o),i.push(u),c+=d}return i.length&&s.push(i),s},Wr=function(){let t=this.queue;this.queue=[];let n=L(this,A,hn).call(this);for(let r of L(this,A,gn).call(this,t,this.o.maxBatchEvents,this.o.beaconSafeBytes)){let o=L(this,A,pt).call(this,r);if(ue(o)<=this.o.beaconSafeBytes){let s=!1;try{s=navigator.sendBeacon(n,new Blob([o],{type:"text/plain"}))}catch{s=!1}if(s){let i=this.failing?L(this,A,mt).call(this,r):null;i&&this.sending.add(i);continue}}L(this,A,$e).call(this,r,0,L(this,A,mt).call(this,r))}},$e=async function(t,n,r=null,o=this.epoch){r&&this.sending.add(r);let s=L(this,A,pt).call(this,t),i=0;try{let c=await fetch(L(this,A,hn).call(this),{method:"POST",headers:{"Content-Type":"text/plain"},body:s,keepalive:ue(s)<=this.o.beaconSafeBytes});if(c.ok)return this.failing=!1,this.answered=!0,L(this,A,je).call(this,r),L(this,A,ht).call(this),!0;let u=c.status===408||c.status===429||c.status>=500;if(u&&(i=wi(c.headers?.get?.("retry-after"))),!u)return L(this,A,je).call(this,r),this.o.onError?.(`CDP ingest rejected batch (${c.status}); dropping ${t.length} events`),!0;throw new Error(`retryable ${c.status}`)}catch(c){if(this.failing=!0,n>=this.o.maxRetries){r&&this.sending.delete(r);let d=r?"kept for the next page":"dropped";return this.o.onError?.(`CDP ingest unreachable after ${n} attempts; ${d}: ${t.length} events`,c),!1}let u=Math.max(Math.min(1e3*2**n,Jr)*(.5+Math.random()),Math.min(i,Jr));return o===this.epoch&&await new Promise(d=>{let f=()=>{clearTimeout(p),this.wakers.delete(f),d()},p=setTimeout(f,u);this.wakers.add(f)}),o!==this.epoch?(L(this,A,je).call(this,r),!1):L(this,A,$e).call(this,t,n+1,r,o)}},je=function(t){t&&(this.sending.delete(t),this.sinceRefusal.delete(t),L(this,A,Yr).call(this,t))},Be=function(){let t=JSON.parse(this.storage.getItem(this.o.storageKey)||"[]");return Array.isArray(t)?t:[]},Xr=function(t,n){let r=i=>ue(JSON.stringify(i))+1,o=[...t,n].slice(-this.o.maxPersistedBatches),s=o.reduce((i,c)=>i+r(c),2);for(;o.length>1&&s>this.o.maxPersistedBytes;)s-=r(o[0]),o=o.slice(1);for(;o.length;)try{return this.storage.setItem(this.o.storageKey,JSON.stringify(o)),!0}catch{o=o.slice(1)}return!1},mt=function(t){if(!this.storage||this.o.mayPersist&&!this.o.mayPersist())return null;try{let n={at:ft(),id:`${ft()}-${Math.random().toString(36).slice(2)}`,batch:t};return ue(JSON.stringify(n))+3>this.o.maxPersistedBytes?null:L(this,A,Xr).call(this,L(this,A,Be).call(this),n)?n.id:null}catch{return null}},Yr=function(t){if(!(!t||!this.storage))try{let n=L(this,A,Be).call(this).filter(r=>r.id!==t);n.length?this.storage.setItem(this.o.storageKey,JSON.stringify(n)):this.storage.removeItem(this.o.storageKey)}catch{}},ht=function(){if(!this.storage||!this.replayAllowed)return this.draining??Promise.resolve();if(this.draining)return this.draining;let t;try{let r=L(this,A,Be).call(this);t=r.filter(o=>Array.isArray(o?.batch)&&ft()-o.at<this.o.maxRetryAgeMs).map(o=>o.id?o:{...o,id:`${o.at}-${Math.random().toString(36).slice(2)}`}),(t.length!==r.length||t.some((o,s)=>o!==r[s]))&&(t.length?this.storage.setItem(this.o.storageKey,JSON.stringify(t)):this.storage.removeItem(this.o.storageKey))}catch{return Promise.resolve()}let n=t.filter(r=>!this.sending.has(r.id));return n.length?(this.draining=(async()=>{for(let r of n)if(!this.replayAllowed||!await L(this,A,$e).call(this,r.batch,0,r.id))return})().finally(()=>{this.draining=null}),this.draining):Promise.resolve()};var wn="3.34.0",Sn="@thg-agentic/hyper-personalisation-web";var _i=100,bi=["source","medium","campaign","content","term"];function Qr(e){if(!e||typeof e!="object")return null;let t={};for(let n of bi){let r=e[n==="campaign"?"name":n];typeof r=="string"&&r&&(t[n]=r.slice(0,_i))}return Object.keys(t).length?t:null}var eo=e=>V(C("visitCampaign"),e==null?null:String(e)),Ce=new Map;function to(e){if(Ce.has(e))return Ce.get(e);try{let t=JSON.parse(localStorage.getItem(e));return t&&typeof t=="object"?t:null}catch{return null}}function Zr(e,t){try{t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e),Ce.delete(e)}catch{t?Ce.set(e,t):Ce.delete(e)}}function no(e,t,n){return typeof e?.tags=="object"&&e.tags!==null&&Number.isFinite(e.at)&&n-e.at<lt&&!(t&&e.sid&&e.sid!==t)?e:null}function yt(e,{sessionId:t=null,now:n=Date.now()}={}){return no(to(eo(e)),t,n)?.tags??null}function ro(e,t,{sessionId:n=null,keepSession:r=!1,now:o=Date.now()}={}){let s=eo(e),i=to(s),c=no(i,n,o),u=c?.tags??t??null;return u?Zr(s,{tags:u,at:o,sid:(r?n:null)??c?.sid??null}):i&&Zr(s,null),u}function _n(){Ce.clear(),We("visitCampaign")}var Ai=new Set(["audiences","decisions","recommendations"]);var ki=Symbol.for("@thg-agentic/hyper-personalisation-web.replay"),Ii=Symbol.for("@thg-agentic/hyper-personalisation-web.unreachable"),xi=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite-access");function vi(e){let t={...e??{}},n=Array.isArray(t.products)?t.products:null;if(t.item_count==null&&n){let r=n.map(o=>o?.quantity);r.every(Number.isInteger)&&(t.item_count=r.reduce((o,s)=>o+s,0))}return t}var Ei="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";function Ci(e){if(/^[0-9a-fA-F]{64}$/.test(e))return e.toLowerCase();if(!/^[A-Za-z0-9+/_-]{43}=?$/.test(e))return null;try{let t=atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(44,"="));return t.length!==32?null:Array.from(t,n=>n.charCodeAt(0).toString(16).padStart(2,"0")).join("")}catch{return null}}function St(e){if(typeof e!="string")return null;let t=Ci(e.trim());return t===Ei?null:t}var oo=Object.freeze({email_sha256:"sha256",phone_sha256:"sha256",accepts_marketing:"boolean",gender:"string",created_at:"date-time"}),Pi=/^\d{4}-\d{2}-\d{2}T([01]\d|2[0-3]):[0-5]\d:[0-5]\d(\.\d+)?(Z|[+-]([01]\d|2[0-3]):[0-5]\d)$/i;function Oi(e){if(typeof e!="string"||!Pi.test(e))return!1;let[t,n,r]=e.slice(0,10).split("-").map(Number),o=new Date(Date.UTC(t,n-1,r));return o.getUTCMonth()===n-1&&o.getUTCDate()===r&&!Number.isNaN(Date.parse(e))}function Li(e,t){return t===null?null:e==="sha256"?St(t)??void 0:e==="date-time"?t instanceof Date?Number.isNaN(t.getTime())?void 0:t.toISOString():Oi(t)?t:void 0:typeof t===e?t:void 0}function Ti(e,t){let n={},r=[];for(let[o,s]of Object.entries(e)){let i=Object.hasOwn(oo,o)?oo[o]:null,c=i?Li(i,s):void 0;c===void 0?r.push(o):n[o]=c}return t&&r.length&&console.warn(`[hp] identify: not sent, not spec traits: ${r.join(", ")}`),n}var so=!1,io=!1;function Ni(){io||(io=!0,console.warn("[hp] no consent adapter: events are sent under the host's lawful basis (basis 'host'). Pass `consent` to send only once the visitor allows analytics."))}function Ri(e){!e||so||(so=!0,console.warn("[hp] mintAnonymousId is ignored since 3.6: where device ids come from is set per source in the console (the site\u2019s own cookie, or Hyper-Personalisation\u2019s)."))}function Mi(e){try{return ue(JSON.stringify(e))}catch{return 0}}function wt(e){return e&&typeof e.context=="object"&&e.context!==null?e.context:e}function Di(e,t){if(e==null||String(e)===t)return;let n=[["localStorage","retry",(r,o)=>[...Array.isArray(r)?r:[],...Array.isArray(o)?o:[]]],["sessionStorage","held",(r,o)=>o?{...o,items:[...r.items??[],...o.items??[]]}:r]];for(let[r,o,s]of n)try{let i=globalThis[r],c=V(C(o),e),u=i?.getItem(c);if(!u)continue;let d=V(C(o),t),f=i.getItem(d);i.setItem(d,JSON.stringify(s(JSON.parse(u),f?JSON.parse(f):null))),i.removeItem(c)}catch{}}function ao(e){let t=ce(e?.apiHost);if(!t)throw new Error("createAnalytics: apiHost, when given, must be a host or an http(s) origin");if(e?.propertyId!==null&&!e?.propertyId)throw new Error("createAnalytics: propertyId is required (null: the ingest stamps the key\u2019s)");let n={libraryName:Sn,libraryVersion:wn,writeKey:"web",queryParamBlocklist:[],debug:!1,validate:null,consentTimeoutMs:5e3,...e,apiHost:t};Je(n.storageNames),Xe();let r=!!n.consent;r||Ni();let o=null;n.getConsent=()=>o?o.stamp():tr();let s=()=>!r||o?.status==="granted";Di(n.propertyId,n.writeKey);let i=r&&n.holdAcrossPages?Yn(V(C("held"),n.writeKey)):null,c=i?.read()??{items:[],anonymousId:null};n.mintAnonymousId!==void 0&&Ri(n.debug);let u=Zn(n,{carried:c.anonymousId,mayStore:s,orOwn:!0}),d=$r({name:C("session"),domain:n.consentCookieDomain??null,mayStore:s}),f=n.getSessionId;n.getSessionId=()=>H(R(f,null))??d.get();let p=xr(C("preview"),n.consentCookieDomain??null),m=()=>H(R(f,null))??B(C("session")),v=Qr(typeof location>"u"?null:Ut(location.search)),w=(a=null)=>{p||ro(n.propertyId,a,{sessionId:m(),keepSession:s()})},I=(a,l)=>n.debug&&console.warn("[hp]",a,l??""),b=n.transport??new gt({apiHost:n.apiHost,writeKey:n.writeKey,storageKey:V(C("retry"),n.writeKey),mayPersist:r?()=>o?.status==="granted":void 0,deferReplay:r,onError:I}),x=V(C("previousPage"),n.propertyId),h=null,P=()=>{if(h)return h;try{return sessionStorage.getItem(x)||null}catch{return null}};typeof window<"u"&&window.addEventListener("pageshow",a=>{a.persisted&&(h=null)});let _=a=>{if(h=a||null,!(r&&o.status!=="granted"))try{sessionStorage.setItem(x,a)}catch{}},g=Ar({key:V(C("decisions"),n.propertyId),mayStore:s});n.getDecisions??(n.getDecisions=g.current);let y=H(R(n.getUserId,null)),O=null,N=null,$=y?Oe(n.identityToken):null,G=null,F=null,Se=null,W=null,ee=null,_e=new Set,be=new Set;function M(a){if(a.type==="page"&&(ee=null),a.type==="track"&&a.event==="Product Viewed"){let k=a.properties?.products?.[0]?.product_id;ee=typeof k=="string"&&k?k:ee,en()}if(a.type!=="track"||a.event!=="Cart Updated")return;let l=a.properties?.value,S=a.properties?.products;Se=Array.isArray(S)?an(S):null,W=re(a.properties?.currency),F=typeof l=="number"&&Number.isFinite(l)&&l>=0?l:null;for(let k of _e)try{k()}catch(U){console.warn("[hp] a basket listener failed",U)}}function K(a,l,S=!1){M(a),w();try{return qe(a,l,S)}catch(k){if(k instanceof Ie)throw k;return console.warn("[hp] the event was not sent",k),null}}function qe(a,l,S){let k=G;G=null;let U=a.type==="track"?a.event:a.type;if(!S&&!qr(n.plan,U))return null;let T={messageId:k?.messageId??ie(),timestamp:k?.timestamp??new Date().toISOString(),anonymousId:H(R(n.getAnonymousId,null)),userId:y??null,...a,context:Gn(n,wt(l))};if(T.properties&&(T.properties=Mt(T.properties)),typeof T.properties?.href=="string"&&(T.properties.href=Vt(T.properties.href,n)),!S&&!Lr(T.anonymousId,n.sampleRate))return n.debug&&console.debug("[hp] not sent: outside the sample",T),null;if(n.beforeSend){let ne;try{ne=n.beforeSend(T)}catch(xo){return console.warn("[hp] beforeSend failed; the event was not sent",xo),null}if(!ne)return null;let{type:z,event:Pn,messageId:ko,timestamp:Io}=T;T={...ne,type:z,messageId:ko,timestamp:Io,...Pn?{event:Pn}:{}}}if(n.validate){let ne=n.validate(T,{producer:"web"});if(!ne.valid){let z=`[hp] invalid ${T.event??T.type}:
1
+ (()=>{var Mn=e=>{throw TypeError(e)};var Lo=(e,t,n)=>t.has(e)||Mn("Cannot "+n);var Dn=(e,t,n)=>t.has(e)?Mn("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var L=(e,t,n)=>(Lo(e,t,"access private method"),n);var Ne=[];for(let e=2;Ne.length<64;e++)Ne.every(t=>e%t!==0)&&Ne.push(e);var Vn=e=>(e-Math.floor(e))*2**32>>>0,No=Ne.slice(0,8).map(e=>Vn(Math.sqrt(e))),Ro=Ne.map(e=>Vn(Math.cbrt(e))),Z=(e,t)=>e>>>t|e<<32-t;function Un(e){let t=new TextEncoder().encode(String(e)),n=new Uint32Array((t.length+8>>6)*16+16);t.forEach((s,i)=>{n[i>>2]|=s<<24-i%4*8}),n[t.length>>2]|=128<<24-t.length%4*8,n[n.length-2]=Math.floor(t.length/2**29),n[n.length-1]=t.length*8;let r=Uint32Array.from(No),o=new Uint32Array(64);for(let s=0;s<n.length;s+=16){for(let w=0;w<64;w++){if(w<16){o[w]=n[s+w];continue}let k=o[w-15],b=o[w-2],I=Z(k,7)^Z(k,18)^k>>>3,h=Z(b,17)^Z(b,19)^b>>>10;o[w]=o[w-16]+I+o[w-7]+h}let[i,c,u,d,f,p,m,x]=r;for(let w=0;w<64;w++){let k=Z(f,6)^Z(f,11)^Z(f,25),b=x+k+(f&p^~f&m)+Ro[w]+o[w]|0,h=(Z(i,2)^Z(i,13)^Z(i,22))+(i&c^i&u^c&u)|0;[x,m,p,f,d,u,c,i]=[m,p,f,d+b|0,u,c,i,b+h|0]}[i,c,u,d,f,p,m,x].forEach((w,k)=>{r[k]+=w})}return Array.from(r,s=>s.toString(16).padStart(8,"0")).join("")}var Tt=(e,t)=>e<<t|e>>>32-t;function $n(e){let t=new Uint32Array((e.length+8>>6)*16+16);e.forEach((s,i)=>{t[i>>2]|=s<<24-i%4*8}),t[e.length>>2]|=128<<24-e.length%4*8,t[t.length-2]=Math.floor(e.length/2**29),t[t.length-1]=e.length*8;let n=Uint32Array.of(1732584193,4023233417,2562383102,271733878,3285377520),r=new Uint32Array(80);for(let s=0;s<t.length;s+=16){for(let p=0;p<80;p++)r[p]=p<16?t[s+p]:Tt(r[p-3]^r[p-8]^r[p-14]^r[p-16],1);let[i,c,u,d,f]=n;for(let p=0;p<80;p++){let m,x;p<20?(m=c&u|~c&d,x=1518500249):p<40?(m=c^u^d,x=1859775393):p<60?(m=c&u|c&d|u&d,x=2400959708):(m=c^u^d,x=3395469782);let w=Tt(i,5)+m+f+x+r[p]|0;[f,d,u,c,i]=[d,u,Tt(c,30),i,w]}[i,c,u,d,f].forEach((p,m)=>{n[m]+=p})}let o=new Uint8Array(20);return n.forEach((s,i)=>{o[i*4]=s>>>24,o[i*4+1]=s>>>16,o[i*4+2]=s>>>8,o[i*4+3]=s}),o}var Mo="e28e8ada-5b76-4209-bba9-79b823a0af75",Do=e=>Array.from(e,t=>t.toString(16).padStart(2,"0")).join("");function Bn(e,t){let n=Uint8Array.from(e.replace(/-/g,"").match(/../g),c=>Number.parseInt(c,16)),r=new TextEncoder().encode(t),o=new Uint8Array(16+r.length);o.set(n),o.set(r,16);let s=$n(o).slice(0,16);s[6]=s[6]&15|80,s[8]=s[8]&63|128;let i=Do(s);return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}var le=(e,t)=>typeof e=="string"&&e!==""&&e.length<=t?e:null;function Ge(e,t){return le(e,64)??le(t,256)}function jn({sessionId:e,slot:t,arm:n}={}){let r=le(e,256);return!r||!le(t,256)||!le(n,256)?null:Bn(Mo,`${r}:${t}:${n}`)}var Vo="4b1f2c7e-9a3d-4e58-b6c1-2d7f0a9e8c53";function qn({sessionId:e,surface:t}={}){let n=le(e,256);return!n||!le(t,64)?null:Bn(Vo,`${n}:${t}`)}var Uo=Array.from({length:11},(e,t)=>t/10);function $o(e,t){if(!e.isIntersecting)return!1;let{intersectionRect:n,boundingClientRect:r,rootBounds:o}=e;if(!n||!r)return!0;let s=n.width*n.height,i=r.width*r.height,c=o?Math.min(i,o.width*o.height):i;return c>0&&s/c>=t}function se(e){let{selector:t,onViewable:n,visibleRatio:r=.5,dwellMs:o=1e3,root:s=document}=e,i=new Map,c=new WeakSet,u=new Set,d=h=>{i.has(h)||i.set(h,setTimeout(()=>{i.delete(h),n(h)&&(p?.unobserve(h),u.delete(h))},o))},f=h=>{clearTimeout(i.get(h)),i.delete(h)},p=typeof IntersectionObserver>"u"?null:new IntersectionObserver(h=>{for(let O of h){let _=O.target;if(!$o(O,r)){u.delete(_),f(_);continue}u.add(_),m()&&d(_)}},{threshold:Uo}),m=()=>typeof document>"u"||document.visibilityState!=="hidden",x=()=>{if(m())for(let h of u)d(h);else for(let h of u)f(h)};document.addEventListener("visibilitychange",x);let w=()=>{for(let h of s.querySelectorAll(t))c.has(h)||(c.add(h),p?.observe(h))},k=typeof MutationObserver>"u"?null:new MutationObserver(()=>w()),b=()=>{w(),k?.observe(s===document?document.body:s,{childList:!0,subtree:!0})},I=s===document&&!document.body;return I?document.addEventListener("DOMContentLoaded",b,{once:!0}):b(),()=>{I&&document.removeEventListener("DOMContentLoaded",b),document.removeEventListener("visibilitychange",x),p?.disconnect(),k?.disconnect();for(let h of i.values())clearTimeout(h);i.clear(),u.clear()}}function Lt(e,t={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{selector:n="[data-hp-exposure]",visibleRatio:r=.5,dwellMs:o=1e3,root:s=document}=t;return se({selector:n,root:s,visibleRatio:r,dwellMs:o,onViewable(i){let c=i.dataset?.hpExposure?.trim();return c&&e.surfaceViewed({surface:c}),!0}})}var Fn=e=>{try{return new URL(e,document.baseURI).toString()}catch{return e}};function Nt(e,t={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{selector:n="[data-hp-list]",tileSelector:r="[data-hp-product]",visibleRatio:o=.5,dwellMs:s=1e3,root:i=document}=t,c=new Set,u=w=>w.closest?.(n)??null,d=w=>{let k=w.dataset.hpList?.trim();return k?{list_id:k,category:w.dataset.hpListCategory?.trim()||null}:null},f=w=>Array.from(w.querySelectorAll(r)).filter(k=>u(k)===w),p=(w,k)=>{try{let b=JSON.parse(w.dataset.hpProduct??"");return!b||typeof b!="object"||!b.product_id?null:{...b,position:b.position??k+1,...b.url?{url:Fn(b.url)}:{},...b.image_url?{image_url:Fn(b.image_url)}:{}}}catch{return null}},m=se({selector:`${n} ${r}`,root:i,visibleRatio:o,dwellMs:s,onViewable(w){let k=u(w);if(!k||k.dataset.hpListView==="manual")return!0;let b=d(k);if(!b||c.has(b.list_id))return!0;let I=new Set,h=f(k).map(p).filter(O=>!O||I.has(O.product_id)?!1:(I.add(O.product_id),!0));return h.length===0||(c.add(b.list_id),e.productListViewed({...b,products:h})),!0}}),x=w=>{let b=w.target?.closest?.("a[href]")?.closest(r);if(!b)return;let I=u(b),h=p(b,I?f(I).indexOf(b):0);h&&e.productClicked({list_id:I?d(I)?.list_id??null:null,products:[h]})};return document.addEventListener("click",x,!0),()=>{document.removeEventListener("click",x,!0),m()}}function V(e,...t){let n=e.dataset??{};for(let r of t){let o=n[r];if(typeof o=="string"&&o.trim()!=="")return o.trim()}return null}function ze(e,...t){let n=V(e,...t);if(n===null)return null;let r=Number(n);return Number.isFinite(r)?Math.trunc(r):null}function Bo(e,t){let n=V(e,"hpPromotion");return n?{promotion_id:n,name:V(e,"hpPromotionName"),creative:V(e,"hpPromotionCreative"),position:V(e,"hpPromotionSlot")??String(t+1)}:null}function Rt(e,t={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{selector:n="[data-hp-promotion]",resolve:r=Bo,visibleRatio:o=.5,dwellMs:s=1e3,root:i=document}=t,c=new Set,u=p=>{let m=Array.from(i.querySelectorAll(n)),x=m.indexOf(p);try{return r(p,x<0?m.length:x)}catch{return null}},d=se({selector:n,root:i,visibleRatio:o,dwellMs:s,onViewable(p){let m=u(p);return!m||c.has(m.promotion_id)?!1:(c.add(m.promotion_id),e.promotionViewed(m),!0)}}),f=p=>{let m=p.target;if(!m||typeof m.closest!="function")return;let x=m.closest(n),w=m.closest("a[href]");if(!x||!w||!x.contains(w)&&!w.contains(x))return;let k=u(x);k&&e.promotionClicked({...k,href:w.getAttribute("href")})};return document.addEventListener("click",f,!0),()=>{document.removeEventListener("click",f,!0),d()}}function jo(e){let t=V(e,"hpRecoRequest"),n=V(e,"hpRecoPlacement"),r=V(e,"hpRecoStrategy");if(!t||!n||!r)return null;let o=V(e,"hpRecoHoldout");return{recommendation_request_id:t,placement:n,strategy:r,recipe:V(e,"hpRecoRecipe"),algorithm_version:V(e,"hpRecoAlgorithmVersion"),experiment:V(e,"hpRecoExperiment"),variant:V(e,"hpRecoVariant"),holdout:o===null?null:o==="true",assignment_bucket:ze(e,"hpRecoBucket"),assignment_unit_kind:V(e,"hpRecoUnitKind"),candidate_set_fingerprint:V(e,"hpRecoFingerprint"),candidate_set_size:ze(e,"hpRecoCandidates"),ranked_by:V(e,"hpRecoRankedBy"),served_at:V(e,"hpRecoServedAt")}}function qo(e,t){let n=V(e,"hpRecoProduct");if(!n)return null;let r=V(e,"hpRecoPrice");return{product_id:n,sku:V(e,"hpRecoSku"),name:V(e,"hpRecoName"),brand:V(e,"hpRecoBrand"),price:r===null||Number.isNaN(Number(r))?null:Number(r),position:ze(e,"hpRecoPosition")??t+1}}function Mt(e,t={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{selector:n="[data-hp-reco-request]",tileSelector:r="[data-hp-reco-product]",resolveRail:o=jo,resolveTile:s=qo,visibleRatio:i=.5,dwellMs:c=1e3,root:u=document}=t,d=new Set,f=new Map,p=new Map,m=(h,...O)=>{try{return h(...O)}catch{return null}},x=h=>typeof h.closest=="function"?h.closest(n):null,w=h=>Array.from(h.querySelectorAll(r)),k=(h,O)=>{if(p.delete(O.recommendation_request_id),d.has(O.recommendation_request_id))return;let _=w(h).map((y,T)=>m(s,y,T)).filter(y=>y?.product_id);if(_.length===0)return;d.add(O.recommendation_request_id);let g=[...f.get(O.recommendation_request_id)?.values()??[]].sort((y,T)=>y.position-T.position);e.recommendationsViewed({...O,products:_,viewable:g})},b=se({selector:`${n} ${r}`,root:u,visibleRatio:i,dwellMs:c,onViewable(h){let O=x(h);if(!O)return!0;let _=m(o,O);if(!_)return!0;let g=_.recommendation_request_id,y=m(s,h,w(O).indexOf(h));if(y?.product_id){f.has(g)||f.set(g,new Map);let T=f.get(g);T.has(y.position)||T.set(y.position,{position:y.position,product_id:y.product_id,viewable_at:new Date().toISOString()})}return!d.has(g)&&!p.has(g)&&p.set(g,setTimeout(()=>k(O,_),0)),!0}}),I=h=>{let O=h.target;if(!O||typeof O.closest!="function")return;let _=O.closest(r);if(!_)return;let g=O.closest("[data-hp-reco-interaction]"),y=O.closest("a[href]"),T=y&&(_.contains(y)||y.contains(_));if(!(g&&_.contains(g))&&!T)return;let R=x(_);if(!R)return;let $=m(o,R);if(!$)return;let G=m(s,_,w(R).indexOf(_));if(!G?.product_id)return;let F=$.recommendation_request_id;d.has(F)||(clearTimeout(p.get(F)),k(R,$)),e.productClicked({recommendation_request_id:$.recommendation_request_id,interaction:V(g??_,"hpRecoInteraction")??"navigate",products:[G]})};return document.addEventListener("click",I,!0),()=>{document.removeEventListener("click",I,!0);for(let h of p.values())clearTimeout(h);p.clear(),b()}}var Ie=new Set(["home","list","product","search","basket","checkout","order_confirmation","login","register","account","info","blog","other"]),Fo=["products"],Ho=["products","coupon","discounts"],Ko=new Set(["Cart Viewed","Cart Updated"]),Go=e=>e==null;function Dt(e,t=new WeakSet){if(e instanceof Date)return e.toJSON();if(e===null||typeof e!="object"||t.has(e))return e;t.add(e);let n=Array.isArray(e)?e.map(r=>Dt(r,t)):Object.fromEntries(Object.entries(e).filter(([,r])=>!Go(r)).map(([r,o])=>[r,Dt(o,t)]));return t.delete(e),n}function Vt(e,t){if(!e)return e;let n=Dt(e);for(let r of Ko.has(t)?Ho:Fo)e[r]===null&&(n[r]=null);return n}function Hn(){try{let e=performance.getEntriesByType("navigation")[0];return e?["navigate","reload","back_forward","prerender"].includes(e.type)?e.type:"navigate":null}catch{return null}}var zo=new Set(["","unknown","undefined","null","none","nil","nan","anonymous","guest","0","-1"]);function H(e){if(e==null)return null;let t=String(e).trim();return zo.has(t.toLowerCase())?null:t}var Re=e=>typeof e=="string"&&e!==""?e:null;function ie(){return typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var Kn="1.22";function j(e){if(typeof document>"u")return null;try{let t=document.cookie.split(";").map(n=>n.trim()).find(n=>n.startsWith(`${e}=`));return t&&decodeURIComponent(t.slice(e.length+1))||null}catch{return null}}var Jo={gclid:"gclid",fbclid:"fbclid",ttclid:"ttclid"},Wo=/[a-z0-9._%+-]+@[a-z0-9-]+(\.[a-z0-9-]+)*\.[a-z]{2,}/i,Xo=/\d(?:[ -]?\d){12,}/,Yo=new Set(["gclid","fbclid","ttclid","msclkid"]);function zn(e,t=""){if(typeof e!="string"||e==="")return!1;let n=[e];try{let o=decodeURIComponent(e.replace(/\+/g," "));o!==e&&n.push(o)}catch{}let r=!Yo.has(String(t).toLowerCase());return n.some(o=>Wo.test(o)||r&&Xo.test(o))}function $t(e){if(!e)return null;let t=new URLSearchParams(e),n={},r={utm_source:"source",utm_medium:"medium",utm_campaign:"name",utm_term:"term",utm_content:"content"};for(let[o,s]of[...Object.entries(r),...Object.entries(Jo)]){let i=t.get(o);i&&!zn(i,o)&&(n[s]=i)}return Object.keys(n).length?n:null}var Zo=["email","e-mail","password","pass","pwd","token","auth","code","uid","customer_id","postcode","zip","phone","applyCode"],Qo=["email","password","passwd","pwd","token","secret","auth","session","phone","postcode","zip","address","birth","card","cvv","iban","ssn","customerid","userid"],es=["tel","uid","dob"],ts=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","fbclid","ttclid","msclkid"],ns=new Set(Zo.map(e=>e.toLowerCase()));function rs(e){let t=String(e).toLowerCase();if(ns.has(t))return!0;let n=t.replace(/[-_.]/g,"");return Qo.some(o=>n.includes(o))?!0:String(e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).some(o=>es.includes(o))}function Ut(e){return(e??[]).map(t=>{try{return new RegExp(`^${t}$`,"i")}catch{return{test:n=>n.toLowerCase()===String(t).toLowerCase()}}})}function Jn(e,t={}){if(!e)return null;try{let n=new URLSearchParams(e),r=t.queryParamAllowlist?Ut([...t.queryParamAllowlist,...ts]):null,o=Ut(t.queryParamBlocklist),s=Ut(t.sensitiveParamAllowlist);for(let c of new Set(n.keys()))(rs(c)&&!s.some(d=>d.test(c))||n.getAll(c).some(d=>zn(d,c))||(r?!r.some(d=>d.test(c)):o.some(d=>d.test(c))))&&n.delete(c);let i=n.toString();return i?`?${i}`:""}catch{return""}}function Wn(e,t,n={}){if(!e)return null;try{let r=new URL(e);return t&&r.origin===t?r.origin+r.pathname+(Jn(r.search,n)??""):r.origin+r.pathname}catch{return null}}function Bt(e,t={}){if(typeof e!="string"||typeof location>"u")return null;try{let n=new URL(e,location.href);return n.protocol!=="https:"&&n.protocol!=="http:"?null:Wn(n.href,location.origin,t)}catch{return null}}function re(e){if(typeof e!="string")return null;let t=e.trim().toUpperCase();return/^[A-Z]{3}$/.test(t)?t:null}function Gn(e){if(typeof e!="string")return null;let t=e.trim().toUpperCase();return/^[A-Z]{2}$/.test(t)?t:null}function jt(e){if(typeof e!="string")return null;let t=e.trim().replace(/_/g,"-");if(!/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(t))return null;try{return Intl.getCanonicalLocales(t)[0]}catch{return null}}function D(e,t){if(typeof e=="function")try{let n=e();if(n!=null)return n}catch{}return t}function os(e){return{...e.propertyId==null?{}:{property_id:String(e.propertyId)},channel:e.channel??null,market:e.market??null,environment:e.environment??null}}function ss(e){let t=typeof window<"u"?window.location:null,n=t?Jn(t.search,e):null;return{url:t?t.origin+t.pathname+(n??""):e.pageUrl??null,path:t?t.pathname:e.pagePath??null,search:n??null,referrer:typeof document<"u"?Wn(document.referrer,t?.origin,e):null,title:typeof document<"u"&&document.title||null,type:e.pageType??null}}var Me;function is(){if(Me!==void 0)return Me;try{Me=globalThis.Temporal?.Now?.timeZoneId?.()||Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{Me=null}return Me}function Xn(e,t={}){let n=typeof window<"u"?window.location:null,r={library:{name:e.libraryName,version:e.libraryVersion},spec:{version:Kn},source:os(e),session_id:D(e.getSessionId,null),identity_trust:H(D(e.getAnonymousId,null))?"device":"none",page:ss(e),campaign:n?$t(n.search):null,device:{user_agent:typeof navigator<"u"?navigator.userAgent:null,type:null,viewport_width:typeof window<"u"?window.innerWidth:null,viewport_height:typeof window<"u"?window.innerHeight:null},currency:re(D(e.getCurrency,e.currency)),locale:jt(D(e.getLocale,e.locale)),timezone:is(),country:Gn(e.country),ship_to_country:Gn(D(e.getShipToCountry,e.shipToCountry)),ip:null,bot:null,consent:e.getConsent?.()??null,experiments:D(e.getExperiments,null),audiences:D(e.getAudiences,null),decisions:D(e.getDecisions,null),recommendations:D(e.getRecommendations,null),extensions:D(e.getExtensions,null)};return Yn(r,t)}function Yn(e,t){if(!t)return e;let n={...e};for(let[r,o]of Object.entries(t))o&&typeof o=="object"&&!Array.isArray(o)&&e[r]&&typeof e[r]=="object"&&!Array.isArray(e[r])?n[r]=Yn(e[r],o):o!==void 0&&(n[r]=o);return n}var pe=Object.freeze({consent:"thg_hp_consent",retry:"thg_hp_retry",sessionSignals:"thg_hp_session_signals",identified:"thg_hp_identified",previousPage:"thg_hp_prev_page",decisions:"thg_hp_decisions",settings:"thg_hp_settings",held:"thg_hp_held",carried:"thg_hp_carried",recommendationContext:"thg_hp_recommendation_context",anonymousId:"thg_hp_anonymous_id",session:"thg_hp_session",preview:"thg_hp_preview",debug:"thg_hp_debug",onsite:"thg_hp_onsite",visitCampaign:"thg_hp_visit_campaign",answers:"thg_hp_answers"}),as={retry:"cdp.retry",sessionSignals:"cdp_session_signals",identified:"cdp_identified",previousPage:"cdp_prev_page_message_id"},Je={...pe},Zn=!1;function We(e){let t={...pe};for(let[n,r]of Object.entries(e??{})){if(!(n in pe))throw new Error(`storageNames: unknown kind "${n}"`);if(typeof r!="string"||!/^[\w.-]+$/.test(r))throw new Error(`storageNames.${n} must be a non-empty cookie-safe name`);t[n]=r}Je=t}function v(e){return Je[e]}var cs="_",Qn=e=>e==null||e===""?cs:String(e);function U(e,t,n){let r=`${e}:${Qn(t)}`;return n==null||n===""?r:`${r}:${n}`}function er(e,t){return`${e}:${Qn(t)}:`}function Xe(e){let t=`${Je[e]}:`;try{for(let n of Object.keys(localStorage))n.startsWith(t)&&localStorage.removeItem(n)}catch{}}function Ye(){if(!Zn){Zn=!0;for(let e of[()=>localStorage,()=>sessionStorage]){let t;try{if(t=e(),!t)continue;for(let n of Object.keys(t))for(let[r,o]of Object.entries(as)){if(n!==o&&!n.startsWith(`${o}:`))continue;let s=Je[r]+n.slice(o.length);t.getItem(s)===null&&t.setItem(s,t.getItem(n)),t.removeItem(n)}}catch{}}}}var Ft=1800*1e3,Ze=()=>{try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}},qt=()=>{try{return typeof localStorage>"u"?null:localStorage}catch{return null}};function tr(e,t=()=>Date.now()){return{read(){try{let n=Ze()?.getItem(e),r=n?JSON.parse(n):null;return!r||t()-r.savedAt>Ft?(r&&Ze()?.removeItem(e),{items:[],anonymousId:null}):{items:Array.isArray(r.items)?r.items:[],anonymousId:typeof r.anonymousId=="string"?r.anonymousId:null}}catch{return{items:[],anonymousId:null}}},write(n,r=null){try{n.length===0?Ze()?.removeItem(e):Ze()?.setItem(e,JSON.stringify({savedAt:t(),items:n,anonymousId:r}))}catch{}}}}var us=400*24*60*60;function ae(e,t,n,r){if(typeof document>"u")return!1;try{let o=typeof location<"u"&&location.protocol==="https:"?"; Secure":"",s=r?`; Domain=${r}`:"",i=n===null?"":`; Max-Age=${n}`;return document.cookie=`${e}=${encodeURIComponent(t)}; Path=/${i}; SameSite=Lax`+s+o,!0}catch{return!1}}function ls({name:e,domain:t=null,legacyKey:n,read:r,mint:o,mayStore:s,carried:i=null}){let c=null;try{c=qt()?.getItem(n)||null}catch{c=null}let u=r(e)??c??i,d=!1,f=()=>{if(!(d||u===null||!s())&&(d=ae(e,u,us,t),!(!d||c===null)))try{qt()?.removeItem(n),c=null}catch{}};return{get(){return u??(u=o()),f(),u},peek:()=>u,persist:f,forget(){ae(e,"",0,t),u=null,d=!1;try{qt()?.removeItem(n)}catch{}c=null}}}function nr(e,{carried:t=null,mayStore:n,orOwn:r=!1}){let o=e.anonymousIdSource,s=()=>ls({name:v("anonymousId"),domain:e.consentCookieDomain??null,legacyKey:U(v("anonymousId"),e.propertyId),read:j,mint:ie,mayStore:n,carried:t});if(o?.source==="hp_cookie"){let u=s();return e.getAnonymousId=()=>u.get(),u}if(o?.source==="site_cookie"&&o.cookie){let u=o.cookie;e.getAnonymousId=()=>j(u)}if(!r)return null;let i=e.getAnonymousId,c=s();return e.getAnonymousId=()=>H(D(i,null))??c.get(),c}var ds=200;function rr(e,t,n=()=>Date.now()){let r=()=>U(v("carried"),e),o=!1;function s(){try{let i=JSON.parse(sessionStorage.getItem(r())??"null");return!i||!(n()-i.savedAt<=Ft)?[]:Array.isArray(i.calls)?i.calls:[]}catch{return[]}}return{take(){let i=s();try{sessionStorage.removeItem(r())}catch{}return i},save(i){try{return o||!t()?!1:(sessionStorage.setItem(r(),JSON.stringify({savedAt:n(),calls:[...s(),...i].slice(-ds)})),!0)}catch{return!1}},close(){o=!0}}}var Ka=pe.consent,Qe=Object.freeze({visitor:"visitor",host:"host"}),sr=()=>({basis:Qe.host}),fs="hp-consent",me=["analytics","marketing","personalisation","ad_user_data","ad_personalization"],ir={analytics:"a",marketing:"m",personalisation:"p",ad_user_data:"aud",ad_personalization:"adp"},oe=()=>typeof window<"u",ar=()=>oe()&&typeof window.cookieStore?.addEventListener=="function",ps=e=>e===!0?!0:e===!1?!1:null;function xe(e){if(!e||typeof e!="object")return null;let t={};for(let n of me)t[n]=ps(e[n]);return t}function Ht(e,t){return!e||!t?e===t:me.every(n=>e[n]===t[n])}function Kt(e){if(!e)return"";let t=[];for(let n of me){let r=e[n];(r===!0||r===!1)&&t.push(`${ir[n]}=${r?1:0}`)}return t.join("&")}function Gt(e){return{[fs]:Kt(xe(e))}}function De(e){let t=xe({});if(e==null)return t;let n=String(e).trim();if(n.length>=2&&n.startsWith('"')&&n.endsWith('"')&&(n=n.slice(1,-1)),n.includes("%"))try{n=decodeURIComponent(n.replace(/\+/g," "))}catch{return t}let r=Object.fromEntries(Object.entries(ir).map(([s,i])=>[i,s])),o=new Set;for(let s of n.split("&")){let i=s.indexOf("=");if(i<=0)continue;let c=r[s.slice(0,i).trim()],u={1:!0,0:!1}[s.slice(i+1).trim()]??null;!c||u===null||o.has(c)||(t[c]===null?t[c]=u:t[c]!==u&&(t[c]=null,o.add(c)))}return t}function zt(e,t){if(!t)return e;let n=r=>{if(!r)return r;let o={...r};for(let s of me)s!=="analytics"&&t[s]!==!0&&(o[s]=null);return o};return{name:e.name,basis:e.basis,read:()=>n(e.read()),subscribe:r=>e.subscribe(o=>r(n(o))),get observesChanges(){return e.observesChanges}}}function Jt(e,t={}){return{...e,ad_user_data:t.ad_user_data??e.marketing,ad_personalization:t.ad_personalization??e.marketing}}function et(e,t){let n=!0;return{notify:()=>{if(n)try{let o=e();o&&t(o)}catch{}},stop:()=>n=!1}}var ms={analytics:["analytics","measure_content_performance","audience_measurement"],marketing:["marketing","targeting","advertising","select_personalized_ads","create_ads_profile"],personalisation:["personalisation","personalization","select_personalized_content","create_content_profile"]};function hs(e,t){if(!t?.length)return null;let n=!1;for(let[r,o]of Object.entries(e)){let s=String(o?.id??r).toLowerCase();if(t.some(c=>{let u=String(c).toLowerCase();return s===u||s.startsWith(`${u}-`)})&&(n=!0,o?.enabled===!0))return!0}return n?!1:null}function cr(e={}){let t={...ms,...e.purposes};function n(){let r=oe()?window.Didomi:void 0;if(!r?.getCurrentUserStatus||r.shouldUserStatusBeCollected?.()!==!1||r.isUserStatusPartial?.()===!0)return null;let o=r.getCurrentUserStatus()?.purposes;if(!o||typeof o!="object")return null;let s=i=>hs(o,t[i]);return Jt({analytics:s("analytics"),marketing:s("marketing"),personalisation:s("personalisation")},{ad_user_data:s("ad_user_data"),ad_personalization:s("ad_personalization")})}return{name:"didomi",read:n,observesChanges:!0,subscribe(r){if(!oe())return()=>{};let o=et(n,r),s={event:"consent.changed",listener:o.notify};return window.didomiEventListeners=window.didomiEventListeners||[],window.didomiEventListeners.push(s),window.didomiOnReady=window.didomiOnReady||[],window.didomiOnReady.push(i=>{o.notify(),(i??window.Didomi)?.on?.("consent.changed",o.notify)}),window.Didomi?.on?.("consent.changed",o.notify),o.stop}}}function or(e){let t={};if(!e)return t;for(let n of String(e).split("&")){let r=n.indexOf("=");if(r<=0)continue;let o=n.slice(r+1).replace(/\+/g," ");try{o=decodeURIComponent(o)}catch{}t[n.slice(0,r)]=o}return t}function ur(e={}){let t={analytics:"C0002",personalisation:"C0003",marketing:"C0004",...e.groups},n=e.impliedConsent===!0;function r(){let i=or(j("OptanonConsent"));if(i.groups){let d={};for(let f of i.groups.split(",")){let[p,m]=f.split(":");p?.trim()&&(d[p.trim()]=m==="1"?!0:m==="0"?!1:null)}return f=>d[f]??!1}let c=oe()?window.OnetrustActiveGroups:void 0;if(typeof c!="string"||!c.length)return null;let u=new Set(c.split(",").map(d=>d.trim()).filter(Boolean));return d=>u.has(d)}function o(){if(j("OptanonAlertBoxClosed"))return!0;try{if(oe()&&window.OneTrust?.IsAlertBoxClosed?.()===!0)return!0}catch{}return n&&oe()&&(!!window.OneTrust||typeof window.OnetrustActiveGroups=="string")}function s(){if(!o())return null;let i=r();if(!i)return null;let c=p=>t[p]?i(t[p]):null,u=Jt({analytics:c("analytics"),marketing:c("marketing"),personalisation:c("personalisation")},{ad_user_data:c("ad_user_data"),ad_personalization:c("ad_personalization")}),d=or(j("OptanonConsent"));return(typeof navigator<"u"&&navigator.globalPrivacyControl===!0||d.isGpcEnabled==="1")&&(u.marketing=!1,u.ad_user_data=!1,u.ad_personalization=!1),u}return{name:"onetrust",read:s,observesChanges:!0,subscribe(i){if(!oe())return()=>{};let c=et(s,i),u=!1,d=()=>{u||!window.OneTrust?.OnConsentChanged||(u=!0,window.OneTrust.OnConsentChanged(c.notify))};window.addEventListener("OneTrustGroupsUpdated",c.notify);let f=window.OptanonWrapper;return window.OptanonWrapper=function(...m){try{typeof f=="function"&&f.apply(this,m)}finally{d(),c.notify()}},d(),()=>{c.stop(),window.removeEventListener("OneTrustGroupsUpdated",c.notify)}}}}function gs(e){let t=String(e).split(",").map(n=>n.trim()).filter(Boolean);return t.length?new Set(t):null}function lr(e){let{name:t,categories:n,parse:r=gs,refusedValue:o,source:s="native",changeEvent:i="thg_hp_consent_change"}=e??{};if(typeof t!="string"||t==="")throw new Error("cookieConsent: `name` (the cookie your banner writes) is required");if(!n||typeof n.analytics!="string")throw new Error("cookieConsent: `categories.analytics` (the category id that grants analytics) is required");function c(){let u=j(t);if(u==null)return null;let d;if(o!==void 0&&u===o)d=new Set;else try{d=r(u)}catch{d=null}if(!(d instanceof Set))return null;let f=p=>n[p]?d.has(n[p]):null;return Jt({analytics:f("analytics"),marketing:f("marketing"),personalisation:f("personalisation")},{ad_user_data:f("ad_user_data"),ad_personalization:f("ad_personalization")})}return{name:s,read:c,get observesChanges(){return ar()},subscribe(u){if(!oe())return()=>{};let d=et(c,u),f=p=>{[...p.changed??[],...p.deleted??[]].some(x=>x?.name===t)&&d.notify()};return window.addEventListener(i,d.notify),window.cookieStore?.addEventListener?.("change",f),()=>{d.stop(),window.removeEventListener(i,d.notify),window.cookieStore?.removeEventListener?.("change",f)}}}}function dr(e={}){let t=e.name??v("consent"),n=()=>{let r=j(t);if(r==null)return null;let o=De(r);return o.analytics==null?null:o};return{name:"forwarded",read:n,get observesChanges(){return ar()},subscribe(r){if(!oe())return()=>{};let o=et(n,r),s=i=>{[...i.changed??[],...i.deleted??[]].some(u=>u?.name===t)&&o.notify()};return window.cookieStore?.addEventListener?.("change",s),()=>{o.stop(),window.cookieStore?.removeEventListener?.("change",s)}}}}function fr(e){let t=xe(e);return{name:"static",basis:Qe.host,read:()=>t?{...t}:null,observesChanges:!0,subscribe:()=>()=>{}}}function pr(e){if(e==null)return null;let t=String(e).split("/").map(n=>n.trim()).filter(Boolean).join("/");return t===""?null:t}function ys(e){let t=e.item_category;if(t!=null&&String(t).includes("/"))return pr(t);let n=[t,e.item_category2,e.item_category3,e.item_category4,e.item_category5].map(r=>r==null?"":String(r).trim()).filter(Boolean);return pr(n.join("/"))}var ws=e=>{if(e==null||typeof e=="object")return null;let t=String(e).trim();return t===""?null:t};function Ss(...e){for(let t of e){if(typeof t=="number"&&Number.isFinite(t))return String(t);if(typeof t=="string"&&t.trim()!=="")return t.trim()}return null}var tt=e=>Ss(e.item_group_id,e.item_id);function _s(e,t=tt){if(!e)return null;let n=c=>c==null||c===""||Number.isNaN(Number(c))?null:Number(c),r=c=>{let u=n(c);return u==null?null:Math.round(u*1e6)/1e6},o=c=>{let u=r(c);return u!=null&&u>=0?u:null},s=c=>{let u=n(c);return Number.isInteger(u)&&u>=0?u:null},i=ws;return{product_id:i(t(e)),sku:i(e.item_id),name:i(e.item_name),brand:i(e.item_brand),variant:i(e.item_variant)??i(e.variant),category:ys(e),price:r(e.price),discount:o(e.discount),quantity:s(e.quantity),coupon:i(e.coupon),position:s(e.index)!=null?s(e.index)+1:null,url:i(e.url)??i(e.item_url)??null,image_url:i(e.image_url)??i(e.image_link)??null,displayed_sku:i(e.displayed_sku)??i(e.displayed_variant_sku)}}function Wt(e,t=tt){return(e??[]).map(n=>_s(n,t)).filter(n=>n?.product_id)}var bs=1e3,As={shipping:2,payment:3},ks=new Set(["password","google","apple","facebook","magic_link","sso","passkey","other"]),q=e=>{if(e==null||typeof e=="object")return null;let t=String(e).trim();return t===""?null:t},Is=e=>{if(e==null||e===""||typeof e=="object")return null;let t=Number(e);return Number.isFinite(t)&&t>=0?t:null},nt=e=>e!==null&&typeof e=="object";function xs(e){return Array.isArray(e.items)?e.items.filter(nt):null}function mr(e){let t=q(e)?.toLowerCase().replace(/[\s-]+/g,"_");return t?ks.has(t)?t:t==="email"||t==="email_password"?"password":"other":null}function Cs({ecommerce:e,items:t}){let n=s=>({promotion_id:q(s.promotion_id),name:q(s.promotion_name),creative:q(s.creative_name),position:q(s.creative_slot)}),r=new Set,o=[];for(let s of[n(e),...t.map(n)])!s.promotion_id||r.has(s.promotion_id)||(r.add(s.promotion_id),o.push(s));return o}var hr=({ecommerce:e,items:t})=>q(e.item_list_id)??q(e.item_list_name)??q(t[0]?.item_list_id)??q(t[0]?.item_list_name),he=(e,t)=>t.products?.length?{event:e,properties:t}:null,Es=new Set(["product","products","item","items"]);function vs({ecommerce:e}){let t=q(e.item_id),n=q(e.content_type)?.toLowerCase();return!t||n&&!Es.has(n)?null:{event:"Product Shared",properties:{share_via:q(e.method),products:[{product_id:t}]}}}function Os(e){let t=o=>he("Product List Viewed",{list_id:hr(o),products:o.products}),n=o=>{let s=q(o.ecommerce.search_term);return s?{event:"Products Searched",properties:{query:s,...o.products.length?{products:o.products}:{}}}:null},r=o=>s=>s.promotions.map(i=>({event:o,properties:i}));return{view_item:o=>he("Product Viewed",{currency:o.currency,value:o.value,products:o.products.slice(0,1)}),view_item_list:t,view_search_results:o=>n(o)??t(o),search:n,select_item:o=>he("Product Clicked",{list_id:hr(o),products:o.products.slice(0,1)}),add_to_cart:o=>he("Product Added",{cart_id:q(o.ecommerce.cart_id),products:o.products}),remove_from_cart:o=>he("Product Removed",{cart_id:q(o.ecommerce.cart_id),products:o.products}),view_cart:o=>({event:"Cart Viewed",properties:{cart_id:q(o.ecommerce.cart_id),value:o.value,currency:o.currency,...o.ecommerce.coupon!==void 0?{coupon:q(o.ecommerce.coupon)}:{},...o.itemsListed?{products:o.products}:{}}}),begin_checkout:o=>he("Checkout Started",{value:o.value,currency:o.currency,...o.ecommerce.coupon!==void 0?{coupon:q(o.ecommerce.coupon)}:{},products:o.products}),add_shipping_info:o=>({event:"Checkout Step Completed",properties:{step:e.shipping,step_name:"shipping",shipping_method:q(o.ecommerce.shipping_tier)}}),add_payment_info:o=>({event:"Payment Info Entered",properties:{step:e.payment,step_name:"payment",payment_method:q(o.ecommerce.payment_type)}}),view_promotion:r("Promotion Viewed"),select_promotion:r("Promotion Clicked"),add_to_wishlist:o=>he("Product Added to Wishlist",{products:o.products}),share:vs,login:o=>({event:"Signed In",properties:{method:mr(o.ecommerce.method)}}),sign_up:o=>({event:"Signed Up",properties:{method:mr(o.ecommerce.method)}})}}var Ps=e=>e.event;function Ts(e,t){if(!nt(e))return null;if(typeof e.length=="number"&&e[0]==="event"&&typeof e[1]=="string"){let r=nt(e[2])?e[2]:{};return{name:e[1],entry:r,ecommerce:r}}let n=q(t(e));return n?{name:n,entry:e,ecommerce:nt(e.ecommerce)?e.ecommerce:e}:null}function Xt(e){return Array.isArray(e)?`[${e.map(Xt).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${Xt(e[t])}`).join(",")}}`:JSON.stringify(e??null)}function gr(e,t={}){if(!e||typeof e.track!="function")throw new Error("connectDataLayer: analytics must have a track(event, properties, options) method");let n=t.dataLayer??(typeof window<"u"?window.dataLayer=window.dataLayer||[]:null);if(!Array.isArray(n))return()=>{};let r=Os({...As,...t.steps}),o=t.map??{},s=t.eventName??Ps,i=t.productId??tt,c=new Set(["purchase","refund",...t.ignore??[]]),u=t.dedupeMs??bs,d=new Map,f=!0;function p(_,g,y){if(u<=0)return!1;let T=`${_}|${y??""}|${Xt(g)}`,R=Date.now();for(let[$,G]of d)R-G>u&&d.delete($);return d.has(T)?!0:(d.set(T,R),!1)}let m=null,x=new Set;function w(_,g){if(_!=="Product Viewed")return!1;let y=typeof location>"u"?"":location.pathname;y!==m&&(m=y,x.clear());let T=g.products?.[0]?.product_id;return T?x.has(T)?!0:(x.add(T),!1):!1}function k({event:_,properties:g={}},y){if(!_||p(_,g,y)||w(_,g))return;let T=y?{context:{currency:y}}:void 0;if(_==="Signed Out"&&typeof e.signedOut=="function"){e.signedOut(T);return}e.track(_,g,T)}function b(_){let g=t.transform?t.transform(_):_,y=Ts(g,s);if(!y||c.has(y.name))return;let T=Object.hasOwn(o,y.name),R=T?o[y.name]:r[y.name];if(typeof R!="function")return;let $=xs(y.ecommerce),G=$??[],F={...y,items:G,itemsListed:$!==null,products:Wt(G,i),currency:re(y.ecommerce.currency),value:Is(y.ecommerce.value)};F.promotions=Cs(F);let _e=T?R(g,{...F,toProducts:W=>Wt(W,i)}):R(F);for(let W of[_e].flat())W&&k(W,F.currency)}function I(_){if(f)try{b(_)}catch(g){try{t.onError?.(g,_)}catch{}}}for(let _ of n.slice())I(_);let h=n.push;function O(..._){let g=h.apply(this,_);for(let y of _)I(y);return g}return n.push=O,()=>{f=!1,n.push===O&&(n.push=h)}}var Ls="hp_debug",Ns=256;function Rs(){try{return new URLSearchParams(location.search).get(Ls)}catch{return null}}function yr(e,t){if(typeof location>"u")return!1;try{let n=Rs();if(n!==null){let o=n.trim();o===""||o.length>Ns?sessionStorage.removeItem(t):sessionStorage.setItem(t,o)}let r=sessionStorage.getItem(t);return!!(e&&r&&Un(r)===e)}catch{return!1}}var Ce=class extends Error{},Ms={inHoldout:()=>!0,personalisationGroup:()=>"excluded",servingHeaders:()=>({}),recommendationContext:()=>({}),flush:()=>Promise.resolve(),reset:()=>{}};function Yt(e,t){let n=Ms[e]??(()=>null),r=o=>(console.warn(`[hp] ${String(e)} failed; nothing was sent`,o),n());return function(...s){try{let i=t.apply(this,s);return typeof i?.then=="function"?Promise.resolve(i).catch(r):i}catch(i){if(i instanceof Ce)throw i;return r(i)}}}function wr(e){for(let t of Reflect.ownKeys(e)){let{value:n}=Object.getOwnPropertyDescriptor(e,t)??{};typeof n=="function"&&(e[t]=Yt(t,n))}return e}var Ve=Symbol("hp.identityOption");var Ds=2160*60*60*1e3,Vs=50,Us=20,$s=128,Zt=e=>U(v("answers"),e),ot=e=>typeof e=="string"&&e!==""&&e.length<=$s;function Sr(e,t){try{let n=JSON.parse(localStorage.getItem(Zt(e)));return Array.isArray(n)?n.filter(r=>ot(r?.q)&&Array.isArray(r.v)&&r.v.every(ot)&&t-r.at<Ds):[]}catch{return[]}}function Qt(e,t=Date.now()){return Object.fromEntries(Sr(e,t).map(n=>[n.q,n.v]))}function _r(e,t){let n=Array.isArray(t)?t:[];return(Array.isArray(e)?e:[]).flatMap(r=>{let o=n.find(c=>c?.key===r?.question);if(!o||o.type!=="one"&&o.type!=="many")return[];let s=new Set((o.options??[]).map(c=>c?.value)),i=(Array.isArray(r.values)?r.values:[]).filter(c=>s.has(c));return i.length?[{question:r.question,values:i}]:[]})}function br(e,t,n=Date.now()){let r=(Array.isArray(t)?t:[]).filter(i=>ot(i?.question)&&Array.isArray(i.values));if(!r.length)return;let o=new Set(r.map(i=>i.question)),s=[...Sr(e,n).filter(i=>!o.has(i.q)),...r.map(i=>({q:i.question,v:i.values.filter(ot).slice(0,Us),at:n}))].slice(-Vs);try{rt.delete(e),localStorage.setItem(Zt(e),JSON.stringify(s))}catch{}}var rt=new Set;function Ar(e){if(e===void 0)Xe("answers"),rt.clear();else if(!rt.has(e)){try{localStorage.removeItem(Zt(e))}catch{}rt.add(e)}}var Bs=4320*60*60,js=100,qs=1e3,Fs=2e3,kr=500,st=e=>(e?.unref?.(),e);function Hs(e,t){if(t?.analytics===!0&&e.analytics===!1)return"withdrawn";let n=me.map(r=>e[r]).filter(r=>r!==null);return n.length&&n.every(Boolean)?"accept_all":n.length&&n.every(r=>!r)?"reject_all":"custom"}function Ks(e,t,n=v("consent")){if(!(typeof document>"u"))try{let r=typeof location<"u"&&location.protocol==="https:"?"; Secure":"",o=t?`; Domain=${t}`:"";document.cookie=`${n}=${Kt(e)}; Path=/; Max-Age=${Bs}; SameSite=Lax`+o+r}catch{}}function Gs(e){let t=De(j(e));return me.some(n=>t[n]!==null)?t:null}function Ir(e){let{adapter:t,timeoutMs:n=5e3,cookieDomain:r=null,cookieName:o=v("consent"),release:s,announce:i}=e,c=e.discard??(()=>{}),u="pending",d=null,f=null,p=null,m=null,x=!1,w=null,k=[],b=M=>{u=M,e.onStatus?.(M)};function I(){try{return xe(t.read())}catch{return null}}function h(){f&&clearInterval(f),p&&clearTimeout(p),f=null,p=null}let O=()=>typeof window<"u"&&typeof document<"u",_=()=>{try{return typeof t.subscribe=="function"&&t.observesChanges===!0}catch{return!1}};function g(){m&&clearInterval(m),m=null}function y(){x||m||d===null||_()||O()&&document.visibilityState==="hidden"||(m=st(setInterval(()=>F(I()),Fs)))}let T=()=>u==="pending"||u==="unknown",R=e.store??null,$=()=>{let M=k.splice(0);R?.write([]);for(let K of M)s(K)},G=()=>{let M=k.splice(0);R?.write([]);for(let K of M)c(K)};function F(M){let K=xe(M);if(!K||K.analytics===null)return;let Te=d===null,te=Te?Gs(o):d;if(!Te&&Ht(te,K))return;h(),d=K,y(),Ks(K,r,o);let ke=!Ht(te,K);if(K.analytics){b("granted"),$(),ke&&i({action:Hs(K,te),state:K,previous:te,withdrawal:!1});return}G(),te?.analytics===!0&&i({action:"withdrawn",state:K,previous:te,withdrawal:!0}),b("denied")}function _e(){p=null,u==="pending"&&(b("unknown"),f&&clearInterval(f),f=st(setInterval(()=>F(I()),qs)))}function W(M){if(T()){if(R){R.write(k);return}M?.type!=="visibilitychange"&&!M?.persisted&&G()}}let be=M=>{document.visibilityState==="hidden"?(g(),W(M)):y()},ee=M=>{g(),W(M)},Ae=M=>{M?.persisted&&d!==null&&F(I()),y()};return{get status(){return u},get state(){return d?{...d}:null},stamp(){return d?{...d,source:t.name??null,basis:t.basis??Qe.visitor}:null},admits(){return u==="granted"},hold(M){return!T()||k.length>=kr?(c(M),!1):(k.push(M),!0)},onHidden:W,start(){x=!1;try{w=t.subscribe?.(M=>F(M))??null}catch(M){e.debug&&console.warn("[hp] consent adapter subscribe failed",M)}O()&&(window.addEventListener("pagehide",ee),window.addEventListener("pageshow",Ae),document.addEventListener("visibilitychange",be)),R&&k.length===0&&k.push(...R.read().slice(-kr)),F(I()),!d&&(f=st(setInterval(()=>F(I()),js)),p=st(setTimeout(_e,n)))},stop(){x=!0,h(),g(),typeof w=="function"&&w(),O()&&(window.removeEventListener("pagehide",ee),window.removeEventListener("pageshow",Ae),document.removeEventListener("visibilitychange",be))}}}var zs=["recommendation","search_rank","banner","offer","layout","copy","price","other"],it=e=>typeof e=="string"&&e!=="";function xr(e){return(Array.isArray(e?.decisions)?e.decisions:[]).filter(t=>it(t?.slot)&&it(t.decision_id)&&t.holdout!==!0).map(({decision_id:t,slot:n,arm:r,kind:o})=>({decision_id:t,slot:n,...it(r)&&{arm:r},...zs.includes(o)&&{kind:o}}))}function Cr({key:e,mayStore:t}){let n,r=()=>{if(n)return n;try{let s=JSON.parse(sessionStorage.getItem(e));n=Array.isArray(s)?s.filter(i=>it(i?.slot)):[]}catch{n=[]}return n},o=()=>{try{n?.length&&t()&&sessionStorage.setItem(e,JSON.stringify(n))}catch{}};return{persist:o,current:()=>r().length?n.map(s=>({...s})):null,remember(s){if(!s.length)return;let i=new Set(s.map(c=>c.slot));n=[...r().filter(c=>!i.has(c.slot)),...s],o()},forget(){n=[];try{sessionStorage.removeItem(e)}catch{}}}}function Js(e){let t=2166136261,n=String(e);for(let r=0;r<n.length;r+=1)t^=n.charCodeAt(r),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t^=t>>>16,t=Math.imul(t,2246822507)>>>0,t^=t>>>13,t=Math.imul(t,3266489909)>>>0,t^=t>>>16,t>>>0}function at(e,t,n=1e4){return Js(`${t}\0${e}`)%n}function en(e){let t=o=>Math.min(Math.max(Number(o)||0,0),1),n=t(e.share),r=1-n;return{holdout_share:n,personalised_share:e.ramp==null?r:Math.min(t(e.ramp),r)}}function tn(e,t){if(!e||typeof e.salt!="string")return{holdout:!1,bucket:null,group:"personalised"};let n=e.ramp!=null;if(t==null||t==="")return{holdout:!1,bucket:null,group:n?"excluded":"personalised"};let{holdout_share:r,personalised_share:o}=en(e),s=at(t,e.salt),i=u=>Math.round(u*1e4),c=r>0&&s<i(r)?"holdout":!n||s<i(r+o)?"personalised":"excluded";return{holdout:c==="holdout",bucket:s,group:c}}function Er(e,t){return typeof e!="string"||e===""||t==null||t===""?null:at(t,`bandit-vs-default:${e}`)<1e4/2?"default":"bandit"}var Ue=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite"),X=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.pending"),$e=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.listeners"),ct=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.suppressed"),Ws=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.page-values"),Xs=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.page-facts"),Ys=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.page-said"),Zs=["shown","submitted","apply","closed","held","nothing"],vr=10,Q=()=>typeof window>"u"?null:window;function nn(){try{for(let e of Q()?.[Ys]??[])e()}catch{}}function Be(){try{for(let{resolve:e}of Q()?.[X]?.splice(0)??[])e(!1)}catch{}}var ge=Object.freeze({open(e){try{let t=Q();if(!t||typeof e!="string")return Promise.resolve(!1);if(t[Ue])return t[Ue].open(e);if(t[X]??(t[X]=[]),t[X].length<vr)return new Promise(n=>t[X].push({slot:e,resolve:n}))}catch{}return Promise.resolve(!1)},show(e){return ge.open(e)},on(e,t){var n;try{let r=Q();return!r||!Zs.includes(e)||typeof t!="function"?()=>{}:(r[$e]??(r[$e]={}),((n=r[$e])[e]??(n[e]=new Set)).add(t),()=>r[$e][e].delete(t))}catch{return()=>{}}},suppress(e="page"){try{let t=Q();if(!t)return;(t[ct]??(t[ct]=new Set)).add(String(e)),t[Ue]?.suppress()}catch{}},unsuppress(e){try{let t=Q()?.[ct];e===void 0?t?.clear():t?.delete(String(e))}catch{}},values(e){try{let t=Q();t&&(t[Ws]=e&&typeof e=="object"?{...e}:{})}catch{}},facts(e){try{let t=Q();t&&(t[Xs]={path:t.location?.pathname,facts:e&&typeof e=="object"?{...e}:{}})}catch{}nn()},ready(){try{let e=Q();if(!e)return Promise.resolve([]);if(e[Ue])return Promise.resolve(ge.debug());if(e[X]??(e[X]=[]),e[X].length<vr)return new Promise(t=>e[X].push({slot:null,resolve:()=>t(ge.debug())}))}catch{}return Promise.resolve([])},debug(){try{return Q()?.[Ue]?.debug()??[]}catch{return[]}}});var Qs="hp_preview",ei=256;function Or(e,t=null){if(typeof location>"u")return j(e);let n=null;try{n=new URLSearchParams(location.search).get(Qs)}catch{n=null}if(n===null)return j(e);let r=n.trim();return r===""||r.length>ei?(ae(e,"",0,t),null):(ae(e,r,null,t),r)}var ti=40,ni=128,ri=5,oi=60,Tr=e=>typeof e=="string"&&e!==""&&e.length<=ni&&!e.includes(","),Pr=e=>Array.isArray(e)?e.filter(Tr).slice(0,ti):[],si=e=>Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.replaceAll(","," ").trim()).filter(t=>t!=="").slice(0,ri):[],ii=e=>Object.entries(e&&typeof e=="object"?e:{}).filter(([t,n])=>Tr(t)&&Number.isFinite(n)&&n>=1).sort(([,t],[,n])=>n-t).slice(0,oi).map(([t,n])=>`${t}:${Math.floor(n)}`);function rn(e){let t={},n={viewed:Pr(e?.recentProducts),basket:Pr(e?.basketProducts),q:si(e?.recentSearches),impressed:ii(e?.impressions)};for(let[r,o]of Object.entries(n))o.length>0&&(t[r]=o.join(","));return t}var ai=1800*1e3;function Lr(e,t=Date.now()){try{localStorage.setItem(v("recommendationContext"),JSON.stringify({context:e,until:t+ai}))}catch{}}function Nr(){try{localStorage.removeItem(v("recommendationContext"))}catch{}}var ci="hp_sample",Rr=1e4;function Mr(e,t){return!(typeof t=="number"&&t<1)||e==null||e===""?!0:at(e,ci,Rr)<Math.round(t*Rr)}function Ee(e){return e.trim().toLowerCase().replace(/\s*\/\s*/g,"/").replace(/^\/+|\/+$/g,"")}var ui=2,li=12;function je(e,t=ui){return e.split("/").slice(0,t).join("/")}function on(e,t){if(typeof t!="string"||!t.trim())return null;let n=je(Ee(t));return n?(e.unshift(n),e.length=Math.min(e.length,li),n):null}var ye=()=>v("sessionSignals"),ve=null,sn=()=>ve??ye();function Dr(){try{return ve?localStorage:sessionStorage}catch{return}}function Vr(e,t){let n=t==null?null:String(t),r=e?U(ye(),n,e):null;if(r===ve)return;let o=ve===null?di():null;if(ve=r,!!ve)try{let s=sn(),i=er(ye(),n);for(let c of Object.keys(localStorage))c.startsWith(i)&&c!==s&&localStorage.removeItem(c);o&&!localStorage.getItem(s)&&(localStorage.setItem(s,JSON.stringify(o)),sessionStorage.removeItem(ye()))}catch{}}function di(){try{let e=sessionStorage.getItem(ye());if(!e)return null;let t=JSON.parse(e);return t&&(t.productViews>0||t.listViews>0||t.basketValue!=null||t.basketCodes!=null||t.recentProducts?.length||t.recentBrowse?.length||t.campaign)?t:null}catch{return null}}function ut(){return{productViews:0,listViews:0,cartAdds:0,searches:0,recentProducts:[],recentCategories:[],recentBrowse:[],basketProducts:[],basketValue:null,basketItems:null,basketCurrency:null,basketCodes:null,recentSearches:[],impressions:{},browsingCategory:null,recentBrowseCategories:[],browsingListing:null,listViewsByCategory:{},campaign:null,startedAt:0}}function an(){let e=Dr();if(!e)return ut();try{let t=e.getItem(sn());return t?{...ut(),...JSON.parse(t)}:{...ut(),startedAt:Date.now()}}catch{return{...ut(),startedAt:Date.now()}}}function Oe(e){let t=Dr();if(t)try{t.setItem(sn(),JSON.stringify(e))}catch{}}function we(){return an()}function Ur(){for(let e of[()=>sessionStorage,()=>localStorage])try{let t=e();t.removeItem(ye());for(let n of Object.keys(t))n.startsWith(`${ye()}:`)&&t.removeItem(n)}catch{}}var un=20,$r=200,fi=new Set(["Product Viewed","Product Clicked","Product Added","Product Added to Wishlist"]),pi=new Set(["Product Viewed","Product Added"]),Br=50;function lt(e,t){let n=on(e.recentBrowse,t);return n?(e.recentBrowseCategories=[e.browsingListing?.category??null,...e.recentBrowseCategories].slice(0,e.recentBrowse.length),n):null}function mi(e,t){let n=e.listViewsByCategory;n[t]=(n[t]??0)+1;let r=Object.keys(n);if(r.length>Br){let o={};for(let s of r.sort((i,c)=>n[c]-n[i]).slice(0,Br))o[s]=n[s];e.listViewsByCategory=o}}var jr=e=>[...new Set(e.map(t=>t?.product_id).filter(t=>typeof t=="string"&&t))].slice(0,un),ln=e=>e.reduce((t,n)=>{let r=n?.quantity;return r==null?t+1:typeof r!="number"||!Number.isFinite(r)||r<=0?t:t+(Number.isInteger(r)?r:1)},0),qr=new Set(["Cart Viewed","Cart Updated","Coupon Applied","Coupon Removed","Order Completed"]),cn=(e,t)=>e.toLowerCase()===t.toLowerCase(),dt=e=>typeof e=="string"&&e.trim()?e.trim():null;function dn(e,t,n){switch(t){case"Cart Viewed":case"Cart Updated":{let{discounts:r,coupon:o}=n??{};if(Array.isArray(r))return r.map(s=>dt(s?.coupon_name)).filter(Boolean).filter((s,i,c)=>c.findIndex(u=>cn(u,s))===i);if(o!==void 0){let s=dt(o);return s?[s]:[]}return r===null?[]:e}case"Coupon Applied":{let r=dt(n?.coupon_name);if(!r)return e;let o=e??[];return o.some(s=>cn(s,r))?o:[...o,r]}case"Coupon Removed":{let r=dt(n?.coupon_name);return r&&e?e.filter(o=>!cn(o,r)):e}case"Order Completed":return e?.length?[]:e;default:return e}}function Fr(e,t,n){let r=an();r.startedAt||(r.startedAt=Date.now());let o=n!==void 0&&JSON.stringify(n??null)!==JSON.stringify(r.campaign??null);o&&(r.campaign=n??null);let s=Array.isArray(t?.products)?t.products:[];switch(r.basketCodes=dn(r.basketCodes,e,t),e){case"Product Viewed":r.productViews+=1,lt(r,r.browsingCategory);break;case"Product List Viewed":{let u=t?.list_id,d=t?.category;if(!(typeof u=="string"&&u.includes("/")&&!u.startsWith("cdp-")))break;let p=typeof d=="string"&&je(Ee(d))||null,m=p?je(Ee(u)):"";if(!m){r.browsingCategory=null,r.browsingListing=null;break}r.browsingListing={key:m,category:p},lt(r,m),r.browsingCategory=m,mi(r,p),r.listViews+=1}break;case"Product List Filtered":{let u=t?.change,d=typeof t?.list_id=="string"?t.list_id:"",f=typeof u?.value=="string"?u.value:"",p=r.browsingListing;if(f&&u?.action!=="removed"&&p&&je(Ee(d))===p.key){let m=lt(r,`${d}/${f}`);m&&(r.browsingCategory=m)}break}case"Product Added":{r.cartAdds+=1,lt(r,r.browsingCategory);for(let u of s){let d=u.product_id;typeof d!="string"||!d||(r.basketProducts=[d,...r.basketProducts.filter(f=>f!==d)].slice(0,un))}break}case"Product Removed":{for(let u of s){let d=u.product_id;typeof d=="string"&&d&&(r.basketProducts=r.basketProducts.filter(f=>f!==d))}break}case"Products Searched":{r.searches+=1;let u=t?.query;if(typeof u=="string"&&u.trim()){let d=u.trim().toLowerCase().slice(0,64);r.recentSearches=[d,...r.recentSearches.filter(f=>f!==d)].slice(0,5)}break}case"Product Clicked":case"Product Added to Wishlist":break;case"Cart Viewed":return s.length>0&&(r.basketProducts=jr(s)),Oe(r),r;case"Coupon Applied":case"Coupon Removed":case"Order Completed":return Oe(r),r;case"Cart Updated":{Array.isArray(t?.products)&&(r.basketProducts=jr(s)),r.basketItems=Array.isArray(t?.products)?ln(s):null,r.basketCurrency=re(t?.currency);let u=t?.value;return r.basketValue=typeof u=="number"&&Number.isFinite(u)&&u>=0?u:null,Oe(r),r}default:return o&&Oe(r),r}let i=fi.has(e);if(i)for(let u of s)typeof u.product_id=="string"&&u.product_id&&delete r.impressions[u.product_id];else{for(let d of s){let f=d.product_id;typeof f!="string"||!f||(r.impressions[f]=(r.impressions[f]??0)+1)}let u=Object.keys(r.impressions);if(u.length>$r){let d={};for(let f of u.sort((p,m)=>r.impressions[m]-r.impressions[p]).slice(0,$r))d[f]=r.impressions[f];r.impressions=d}}let c=new Set;for(let u of s){let d=u.product_id;if(i&&typeof d=="string"&&d&&(r.recentProducts=[d,...r.recentProducts.filter(f=>f!==d)].slice(0,un)),pi.has(e)&&typeof u.category=="string"&&u.category){let f=Ee(u.category);f&&!c.has(f)&&(c.add(f),on(r.recentCategories,f))}}return Oe(r),r}var ft=1800*1e3;function Hr({name:e,domain:t=null,mayStore:n,now:r=()=>Date.now(),mint:o=ie}){let s=null,i=0,c=()=>{s!==null&&n()&&ae(e,s,ft/1e3,t)};return{get(){let u=r(),d=j(e);return d?s=d:(s===null||u-i>=ft)&&(s=o()),i=u,c(),s},persist:c,forget(){ae(e,"",0,t),s=null}}}var J=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Kr=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),Gr=Object.freeze({enabled:!1}),pn=Object.freeze({enabled:!0,queryParamAllowlist:Object.freeze([])});function zr(e,t){let n=e?.track;return J(n)?(Object.hasOwn(n,t)?n[t]:n.__default)?.enabled!==!1:!0}function hi(e,t){return`${ce(e)}/v1/projects/${encodeURIComponent(t)}/settings`}var gi="https://hp.thgingenuity.com";function ce(e){return e==null||e===""?gi:Wr(e)}function Jr(e,t){return e!=null&&e!==""?ce(e):t?.startsWith("https://")?t:ce(void 0)}function Wr(e){if(typeof e!="string")return null;let t=e.trim().replace(/\/+$/,"");return/^https?:\/\/[^/\s]+$/i.test(t)?t:/^[a-z0-9.-]+(:\d+)?$/i.test(t)?`https://${t}`:null}function yi(e){if(!J(e))return null;let t=Object.fromEntries(Object.entries(e).filter(([,n])=>typeof n=="boolean"));return Object.keys(t).length?t:null}var fn=e=>typeof e=="number"&&e>=0&&e<=1,wi=/^[0-9a-f]{64}$/;function Si(e){return J(e)?{enabled:e.enabled===!0,tokenSha256:typeof e.tokenSha256=="string"&&wi.test(e.tokenSha256)?e.tokenSha256:null}:{enabled:!1,tokenSha256:null}}function _i(e){if(!J(e))return null;let t=Object.fromEntries(Object.entries(e).filter(([,n])=>J(n)&&fn(n.share)&&(n.ramp==null||fn(n.ramp))&&typeof n.salt=="string"&&n.salt!=="").map(([n,r])=>[n,{share:r.share,ramp:r.ramp??null,salt:r.salt,...Kr(r.readoutSlots)&&r.readoutSlots.length>0&&{readoutSlots:r.readoutSlots}}]));return Object.keys(t).length?t:null}var bi=/^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/;function Ai(e){return J(e)?e.source==="hp_cookie"?{source:"hp_cookie"}:e.source!=="site_cookie"?null:e.cookie==null?{source:"site_cookie",cookie:null}:typeof e.cookie=="string"&&bi.test(e.cookie)?{source:"site_cookie",cookie:e.cookie}:null:null}function ki(e){let t=Array.isArray(e?.forms)?e.forms.filter(J):[];return t.length===0?null:{forms:t,capture:J(e.capture)?e.capture:null,...Number.isInteger(e.overlay_gap_minutes)?{overlay_gap_minutes:e.overlay_gap_minutes}:{}}}function Ii(e){let t=J(e)?e.hp:null;return J(t)&&typeof t.enabled=="boolean"}function mn(e){let t=J(e)?e.hp:null;if(!J(t)||t.enabled!==!0)return Gr;let n=ki(t.onsite);return{enabled:!0,propertyId:typeof t.propertyId=="string"&&t.propertyId!==""?t.propertyId:null,environment:typeof t.environment=="string"?t.environment:null,consentPurposes:yi(t.consent?.purposes),queryParamAllowlist:Kr(t.queryParamAllowlist)?t.queryParamAllowlist:null,anonymousId:Ai(t.anonymousId),apiHost:Wr(t.apiHost),holdouts:_i(t.holdouts),sampleRate:fn(t.sampleRate)?t.sampleRate:1,debug:Si(t.debug),...n&&{onsite:n},plan:J(e.plan)&&J(e.plan.track)?{track:e.plan.track}:null}}var xi=3e3;async function Xr(e,t,n=globalThis.fetch,r=xi){try{let o=await n(hi(e,t),{credentials:"omit",headers:{accept:"application/json"},signal:AbortSignal.timeout?.(r)});if(o.status>=400&&o.status<500&&o.status!==408&&o.status!==429)return Gr;if(!o.ok)return null;let s=await o.json();return Ii(s)?mn(s):null}catch{return null}}var pt=e=>U(v("settings"),e);function Yr(e){try{let t=localStorage.getItem(pt(e));if(!t)return null;let n=JSON.parse(t);return n?.enabled===!0?n:null}catch{return null}}function Zr(e,t){try{t?.enabled===!0?localStorage.setItem(pt(e),JSON.stringify(t)):localStorage.removeItem(pt(e))}catch{}}function hn(e){try{localStorage.removeItem(pt(e))}catch{}}var Ci={flushAt:20,flushIntervalMs:1e4,maxQueue:500,maxRetryAgeMs:1440*60*1e3,maxRetries:5,maxPersistedBatches:20,maxPersistedBytes:1024*1024,storageKey:pe.retry,beaconSafeBytes:56*1024,maxBatchEvents:100,maxBatchBytes:500*1024},mt=()=>Date.now(),Qr=3e4,bn=55*1024;function Ei(e,t=mt()){if(typeof e!="string")return 0;let n=e.trim();if(/^\d+$/.test(n))return Number(n)*1e3;if(n==="")return 0;let r=Date.parse(n);return Number.isNaN(r)?0:Math.max(0,r-t)}var ue=e=>typeof TextEncoder<"u"?new TextEncoder().encode(e).length:Buffer.byteLength(e),gn=()=>typeof window<"u"&&typeof document<"u";function vi(){try{return!gn()||!window.localStorage?null:(window.localStorage.getItem("thg_hp_probe"),window.localStorage)}catch{return null}}var A,yn,wn,ht,Sn,_n,eo,qe,Fe,He,to,gt,no,yt,wt=class{constructor(t){Dn(this,A);this.o={...Ci,...t},this.queue=[],this.timer=null,this.storage=vi(),this.inflight=null,this.sending=new Set,this.epoch=0,this.sinceRefusal=new Set,this.wakers=new Set,this.replayAllowed=!this.o.deferReplay,this.draining=null,this.failing=!1,this.answered=!1,gn()&&(window.addEventListener("pagehide",()=>this.flush({beacon:!0})),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flush()}),L(this,A,yt).call(this))}markFailing(){this.answered||(this.failing=!0)}replayPersisted(){return this.replayAllowed=!0,L(this,A,yt).call(this)}clearPersisted(){if(this.replayAllowed=!1,!!this.storage)try{let t=L(this,A,He).call(this).filter(n=>this.sinceRefusal.has(n?.id));t.length?this.storage.setItem(this.o.storageKey,JSON.stringify(t)):this.storage.removeItem(this.o.storageKey)}catch{}}discardQueued(){this.queue=[],this.epoch+=1,this.sinceRefusal.clear(),L(this,A,wn).call(this);for(let t of this.wakers)t()}enqueue(t){let n;try{n=JSON.parse(JSON.stringify(t))}catch(r){this.o.onError?.(`event ${t?.messageId??""} cannot be serialised; dropped`,r);return}this.queue.push(n),this.queue.length>this.o.maxQueue&&this.queue.splice(0,this.queue.length-this.o.maxQueue),this.queue.length>=this.o.flushAt?this.flush():L(this,A,yn).call(this)}flush(t={}){if(L(this,A,wn).call(this),this.queue.length===0)return Promise.resolve();if(t.beacon&&gn()&&typeof navigator<"u"&&navigator.sendBeacon)return L(this,A,eo).call(this),Promise.resolve();if(this.inflight)return this.inflight;let n=L(this,A,_n).call(this,this.queue,this.o.maxBatchEvents,this.o.maxBatchBytes).map(o=>{let s=L(this,A,gt).call(this,o);return s&&(this.sending.add(s),this.sinceRefusal.add(s)),{batch:o,id:s}});this.queue=[];let r=this.epoch;return this.inflight=(async()=>{for(let{batch:o,id:s}of n){if(r!==this.epoch){L(this,A,Fe).call(this,s);continue}await L(this,A,qe).call(this,o,0,s,r)}})().finally(()=>{this.inflight=null,this.queue.length>=this.o.flushAt?this.flush():this.queue.length&&L(this,A,yn).call(this)}),this.inflight}};A=new WeakSet,yn=function(){this.timer||(this.timer=setTimeout(()=>this.flush(),this.o.flushIntervalMs),this.timer?.unref?.())},wn=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},ht=function(t){return JSON.stringify({batch:t,writeKey:this.o.writeKey,sentAt:new Date().toISOString()})},Sn=function(){return`${this.o.apiHost.replace(/\/$/,"")}/v1/batch`},_n=function(t,n,r){let o=ue(L(this,A,ht).call(this,[])),s=[],i=[],c=o;for(let u of t){let d=ue(JSON.stringify(u))+1;i.length&&(i.length>=n||c+d>r)&&(s.push(i),i=[],c=o),i.push(u),c+=d}return i.length&&s.push(i),s},eo=function(){let t=this.queue;this.queue=[];let n=L(this,A,Sn).call(this);for(let r of L(this,A,_n).call(this,t,this.o.maxBatchEvents,this.o.beaconSafeBytes)){let o=L(this,A,ht).call(this,r);if(ue(o)<=this.o.beaconSafeBytes){let s=!1;try{s=navigator.sendBeacon(n,new Blob([o],{type:"text/plain"}))}catch{s=!1}if(s){let i=this.failing?L(this,A,gt).call(this,r):null;i&&this.sending.add(i);continue}}L(this,A,qe).call(this,r,0,L(this,A,gt).call(this,r))}},qe=async function(t,n,r=null,o=this.epoch){r&&this.sending.add(r);let s=L(this,A,ht).call(this,t),i=0;try{let c=await fetch(L(this,A,Sn).call(this),{method:"POST",headers:{"Content-Type":"text/plain"},body:s,keepalive:ue(s)<=this.o.beaconSafeBytes});if(c.ok)return this.failing=!1,this.answered=!0,L(this,A,Fe).call(this,r),L(this,A,yt).call(this),!0;let u=c.status===408||c.status===429||c.status>=500;if(u&&(i=Ei(c.headers?.get?.("retry-after"))),!u)return L(this,A,Fe).call(this,r),this.o.onError?.(`CDP ingest rejected batch (${c.status}); dropping ${t.length} events`),!0;throw new Error(`retryable ${c.status}`)}catch(c){if(this.failing=!0,n>=this.o.maxRetries){r&&this.sending.delete(r);let d=r?"kept for the next page":"dropped";return this.o.onError?.(`CDP ingest unreachable after ${n} attempts; ${d}: ${t.length} events`,c),!1}let u=Math.max(Math.min(1e3*2**n,Qr)*(.5+Math.random()),Math.min(i,Qr));return o===this.epoch&&await new Promise(d=>{let f=()=>{clearTimeout(p),this.wakers.delete(f),d()},p=setTimeout(f,u);this.wakers.add(f)}),o!==this.epoch?(L(this,A,Fe).call(this,r),!1):L(this,A,qe).call(this,t,n+1,r,o)}},Fe=function(t){t&&(this.sending.delete(t),this.sinceRefusal.delete(t),L(this,A,no).call(this,t))},He=function(){let t=JSON.parse(this.storage.getItem(this.o.storageKey)||"[]");return Array.isArray(t)?t:[]},to=function(t,n){let r=i=>ue(JSON.stringify(i))+1,o=[...t,n].slice(-this.o.maxPersistedBatches),s=o.reduce((i,c)=>i+r(c),2);for(;o.length>1&&s>this.o.maxPersistedBytes;)s-=r(o[0]),o=o.slice(1);for(;o.length;)try{return this.storage.setItem(this.o.storageKey,JSON.stringify(o)),!0}catch{o=o.slice(1)}return!1},gt=function(t){if(!this.storage||this.o.mayPersist&&!this.o.mayPersist())return null;try{let n={at:mt(),id:`${mt()}-${Math.random().toString(36).slice(2)}`,batch:t};return ue(JSON.stringify(n))+3>this.o.maxPersistedBytes?null:L(this,A,to).call(this,L(this,A,He).call(this),n)?n.id:null}catch{return null}},no=function(t){if(!(!t||!this.storage))try{let n=L(this,A,He).call(this).filter(r=>r.id!==t);n.length?this.storage.setItem(this.o.storageKey,JSON.stringify(n)):this.storage.removeItem(this.o.storageKey)}catch{}},yt=function(){if(!this.storage||!this.replayAllowed)return this.draining??Promise.resolve();if(this.draining)return this.draining;let t;try{let r=L(this,A,He).call(this);t=r.filter(o=>Array.isArray(o?.batch)&&mt()-o.at<this.o.maxRetryAgeMs).map(o=>o.id?o:{...o,id:`${o.at}-${Math.random().toString(36).slice(2)}`}),(t.length!==r.length||t.some((o,s)=>o!==r[s]))&&(t.length?this.storage.setItem(this.o.storageKey,JSON.stringify(t)):this.storage.removeItem(this.o.storageKey))}catch{return Promise.resolve()}let n=t.filter(r=>!this.sending.has(r.id));return n.length?(this.draining=(async()=>{for(let r of n)if(!this.replayAllowed||!await L(this,A,qe).call(this,r.batch,0,r.id))return})().finally(()=>{this.draining=null}),this.draining):Promise.resolve()};var An="3.35.0",kn="@thg-agentic/hyper-personalisation-web";var Oi=100,Pi=["source","medium","campaign","content","term"];function oo(e){if(!e||typeof e!="object")return null;let t={};for(let n of Pi){let r=e[n==="campaign"?"name":n];typeof r=="string"&&r&&(t[n]=r.slice(0,Oi))}return Object.keys(t).length?t:null}var so=e=>U(v("visitCampaign"),e==null?null:String(e)),Pe=new Map;function io(e){if(Pe.has(e))return Pe.get(e);try{let t=JSON.parse(localStorage.getItem(e));return t&&typeof t=="object"?t:null}catch{return null}}function ro(e,t){try{t?localStorage.setItem(e,JSON.stringify(t)):localStorage.removeItem(e),Pe.delete(e)}catch{t?Pe.set(e,t):Pe.delete(e)}}function ao(e,t,n){return typeof e?.tags=="object"&&e.tags!==null&&Number.isFinite(e.at)&&n-e.at<ft&&!(t&&e.sid&&e.sid!==t)?e:null}function St(e,{sessionId:t=null,now:n=Date.now()}={}){return ao(io(so(e)),t,n)?.tags??null}function co(e,t,{sessionId:n=null,keepSession:r=!1,now:o=Date.now()}={}){let s=so(e),i=io(s),c=ao(i,n,o),u=c?.tags??t??null;return u?ro(s,{tags:u,at:o,sid:(r?n:null)??c?.sid??null}):i&&ro(s,null),u}function In(){Pe.clear(),Xe("visitCampaign")}var Ti=new Set(["audiences","decisions","recommendations"]);var Li=Symbol.for("@thg-agentic/hyper-personalisation-web.replay"),Ni=Symbol.for("@thg-agentic/hyper-personalisation-web.unreachable"),Ri=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite-access");function Mi(e){let t={...e??{}},n=Array.isArray(t.products)?t.products:null;if(t.item_count==null&&n){let r=n.map(o=>o?.quantity);r.every(Number.isInteger)&&(t.item_count=r.reduce((o,s)=>o+s,0))}return t}var Di="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";function Vi(e){if(/^[0-9a-fA-F]{64}$/.test(e))return e.toLowerCase();if(!/^[A-Za-z0-9+/_-]{43}=?$/.test(e))return null;try{let t=atob(e.replace(/-/g,"+").replace(/_/g,"/").padEnd(44,"="));return t.length!==32?null:Array.from(t,n=>n.charCodeAt(0).toString(16).padStart(2,"0")).join("")}catch{return null}}function bt(e){if(typeof e!="string")return null;let t=Vi(e.trim());return t===Di?null:t}var uo=Object.freeze({email_sha256:"sha256",phone_sha256:"sha256",accepts_marketing:"boolean",gender:"string",created_at:"date-time"}),Ui=/^\d{4}-\d{2}-\d{2}T([01]\d|2[0-3]):[0-5]\d:[0-5]\d(\.\d+)?(Z|[+-]([01]\d|2[0-3]):[0-5]\d)$/i;function $i(e){if(typeof e!="string"||!Ui.test(e))return!1;let[t,n,r]=e.slice(0,10).split("-").map(Number),o=new Date(Date.UTC(t,n-1,r));return o.getUTCMonth()===n-1&&o.getUTCDate()===r&&!Number.isNaN(Date.parse(e))}function Bi(e,t){return t===null?null:e==="sha256"?bt(t)??void 0:e==="date-time"?t instanceof Date?Number.isNaN(t.getTime())?void 0:t.toISOString():$i(t)?t:void 0:typeof t===e?t:void 0}function ji(e,t){let n={},r=[];for(let[o,s]of Object.entries(e)){let i=Object.hasOwn(uo,o)?uo[o]:null,c=i?Bi(i,s):void 0;c===void 0?r.push(o):n[o]=c}return t&&r.length&&console.warn(`[hp] identify: not sent, not spec traits: ${r.join(", ")}`),n}var lo=!1,fo=!1;function qi(){fo||(fo=!0,console.warn("[hp] no consent adapter: events are sent under the host's lawful basis (basis 'host'). Pass `consent` to send only once the visitor allows analytics."))}function Fi(e){!e||lo||(lo=!0,console.warn("[hp] mintAnonymousId is ignored since 3.6: where device ids come from is set per source in the console (the site\u2019s own cookie, or Hyper-Personalisation\u2019s)."))}function Hi(e){try{return ue(JSON.stringify(e))}catch{return 0}}function _t(e){return e&&typeof e.context=="object"&&e.context!==null?e.context:e}function Ki(e,t){if(e==null||String(e)===t)return;let n=[["localStorage","retry",(r,o)=>[...Array.isArray(r)?r:[],...Array.isArray(o)?o:[]]],["sessionStorage","held",(r,o)=>o?{...o,items:[...r.items??[],...o.items??[]]}:r]];for(let[r,o,s]of n)try{let i=globalThis[r],c=U(v(o),e),u=i?.getItem(c);if(!u)continue;let d=U(v(o),t),f=i.getItem(d);i.setItem(d,JSON.stringify(s(JSON.parse(u),f?JSON.parse(f):null))),i.removeItem(c)}catch{}}function po(e){let t=ce(e?.apiHost);if(!t)throw new Error("createAnalytics: apiHost, when given, must be a host or an http(s) origin");if(e?.propertyId!==null&&!e?.propertyId)throw new Error("createAnalytics: propertyId is required (null: the ingest stamps the key\u2019s)");let n={libraryName:kn,libraryVersion:An,writeKey:"web",queryParamBlocklist:[],debug:!1,validate:null,consentTimeoutMs:5e3,...e,apiHost:t};We(n.storageNames),Ye();let r=!!n.consent;r||qi();let o=null;n.getConsent=()=>o?o.stamp():sr();let s=()=>!r||o?.status==="granted";Ki(n.propertyId,n.writeKey);let i=r&&n.holdAcrossPages?tr(U(v("held"),n.writeKey)):null,c=i?.read()??{items:[],anonymousId:null};n.mintAnonymousId!==void 0&&Fi(n.debug);let u=nr(n,{carried:c.anonymousId,mayStore:s,orOwn:!0}),d=Hr({name:v("session"),domain:n.consentCookieDomain??null,mayStore:s}),f=n.getSessionId;n.getSessionId=()=>H(D(f,null))??d.get();let p=Or(v("preview"),n.consentCookieDomain??null),m=()=>H(D(f,null))??j(v("session")),x=oo(typeof location>"u"?null:$t(location.search)),w=(a=null)=>{p||co(n.propertyId,a,{sessionId:m(),keepSession:s()})},k=(a,l)=>n.debug&&console.warn("[hp]",a,l??""),b=n.transport??new wt({apiHost:n.apiHost,writeKey:n.writeKey,storageKey:U(v("retry"),n.writeKey),mayPersist:r?()=>o?.status==="granted":void 0,deferReplay:r,onError:k}),I=U(v("previousPage"),n.propertyId),h=null,O=()=>{if(h)return h;try{return sessionStorage.getItem(I)||null}catch{return null}};typeof window<"u"&&window.addEventListener("pageshow",a=>{a.persisted&&(h=null)});let _=a=>{if(h=a||null,!(r&&o.status!=="granted"))try{sessionStorage.setItem(I,a)}catch{}},g=Cr({key:U(v("decisions"),n.propertyId),mayStore:s});n.getDecisions??(n.getDecisions=g.current);let y=H(D(n.getUserId,null)),T=null,R=null,$=y?Re(n.identityToken):null,G=null,F=null,_e=null,W=null,be=null,ee=null,Ae=new Set,M=new Set;function K(a){if(a.type==="page"&&(ee=null),a.type==="track"&&a.event==="Product Viewed"){let N=a.properties?.products?.[0]?.product_id;ee=typeof N=="string"&&N?N:ee,nn()}if(a.type!=="track")return;let l=!1;if(qr.has(a.event))try{let N=Te(),P=dn(N,a.event,a.properties);l=P!==N,be=P}catch(N){n.debug&&console.warn("[hp] basket codes not read",N)}if(a.event!=="Cart Updated"){l&&te();return}let S=a.properties?.value,E=a.properties?.products;_e=Array.isArray(E)?ln(E):null,W=re(a.properties?.currency),F=typeof S=="number"&&Number.isFinite(S)&&S>=0?S:null,te()}function Te(){return be!==null?be:Y()?(Le(),we().basketCodes):null}function te(){for(let a of Ae)try{a()}catch(l){console.warn("[hp] a basket listener failed",l)}}function ke(a,l,S=!1){K(a),w();try{return Io(a,l,S)}catch(E){if(E instanceof Ce)throw E;return console.warn("[hp] the event was not sent",E),null}}function Io(a,l,S){let E=G;G=null;let N=a.type==="track"?a.event:a.type;if(!S&&!zr(n.plan,N))return null;let P={messageId:E?.messageId??ie(),timestamp:E?.timestamp??new Date().toISOString(),anonymousId:H(D(n.getAnonymousId,null)),userId:y??null,...a,context:Xn(n,_t(l))};if(P.properties&&(P.properties=Vt(P.properties,P.event)),typeof P.properties?.href=="string"&&(P.properties.href=Bt(P.properties.href,n)),!S&&!Mr(P.anonymousId,n.sampleRate))return n.debug&&console.debug("[hp] not sent: outside the sample",P),null;if(n.beforeSend){let ne;try{ne=n.beforeSend(P)}catch(To){return console.warn("[hp] beforeSend failed; the event was not sent",To),null}if(!ne)return null;let{type:z,event:Rn,messageId:Oo,timestamp:Po}=P;P={...ne,type:z,messageId:Oo,timestamp:Po,...Rn?{event:Rn}:{}}}if(n.validate){let ne=n.validate(P,{producer:"web"});if(!ne.valid){let z=`[hp] invalid ${P.event??P.type}:
2
2
  ${ne.errors.join(`
3
- `)}`;if(n.throwOnInvalid)throw new Ie(z);console.error(z)}}n.debug&&console.debug("[hp]",T.event??T.type,T);let Ct=Mi(T);return Ct>yn?(I(`${T.event??T.type} not sent: ${Ct} bytes, over the ${yn}-byte limit for one event`),null):(_o(T,S),T)}function te(a){if((a.type==="track"||a.type==="page")&&So(a),n.onEvent)try{n.onEvent(a)}catch(l){console.warn("[hp] onEvent observer failed",l)}}let X=()=>r&&o?.state?.personalisation===!0,Fe=()=>Nr(R(n.getSessionId,null),n.propertyId),xt=!1,kn=null;function So(a){try{if(X()){Fe();let l=Vr(a.event,a.properties,yt(n.propertyId,{sessionId:m()}));a.type==="track"&&Cr(tn(l)),a.event==="Preferences Stated"&&a.properties?.source==="onsite"&&In([a.properties],a.properties.slot),xt=!0}else He(!1,n.propertyId??null)}catch(l){n.debug&&console.warn("[hp] the visit was not recorded",l)}}function In(a,l){let S=(kn??n.onsite)?.forms?.find?.(k=>k?.slot===l);yr(n.propertyId,gr(a,S?.questions))}function He(a=!1,l=void 0){Pr(),wr(l),(a||xt)&&Rr(),xt=!1}function vt(){d.forget(),g.forget(),Et.clear(),u?.forget(),He(!0),_n()}function _o(a,l){!r||l||o.admits()?(te(a),b.enqueue(a)):o.hold(a)}let E=(a,l,S)=>K({type:"track",event:a,properties:l??{}},S),Et=new Set,bo=(a,l,S)=>a==="audiences"?{audiences:l?null:S.audiences??[]}:a==="decisions"?{decisions:(S.decisions??[]).map(k=>({slot:k.slot,decision_id:k.decision_id??null,arm:k.arm??null,...k.variant&&{variant:k.variant}}))}:{recommendation_request_id:S.recommendation_request_id??null};w(v),r&&(o=_r({adapter:n.consent,timeoutMs:n.consentTimeoutMs,cookieDomain:n.consentCookieDomain,debug:n.debug,store:i&&{read:()=>c.items,write:a=>i.write(a,u?.peek()??null)},release(a){a.context&&(a.context.consent=o.stamp()),te(a),b.enqueue(a)},onStatus(a){if(a==="granted"&&(u?.persist(),d.persist(),h&&_(h),g.persist(),b.replayPersisted?.()),a==="denied"){b.clearPersisted?.(),u?.forget(),d.forget();try{sessionStorage.removeItem(x)}catch{}g.forget(),He(!0)}try{n.onConsentStatus?.(a)}catch(l){console.warn("[hp] onConsentStatus observer failed",l)}if(a==="granted"||a==="denied")for(let l of be)try{l()}catch(S){console.warn("[hp] a consent listener failed",S)}},announce({action:a,state:l,previous:S,withdrawal:k}){l?.personalisation!==!0&&He(S?.personalisation===!0),k&&(b.discardQueued?.(),_n()),K({type:"track",event:"Consent Updated",properties:{action:a,state:l}},void 0,k),k&&b.flush()}}),o.start(),w());let xn=()=>n.holdout?Zt(n.holdout):null,vn=()=>Qt(n.holdout,H(R(n.getAnonymousId,null))).group;function Ao(a,l){if(!Array.isArray(a?.decisions))return a;let S=n.holdout?.readoutSlots??[],k=H(R(n.getAnonymousId,null));return{...a,decisions:a.decisions.map(U=>{let T=U?.variant==="bandit"||U?.variant==="default"?U.variant:!l&&U?.holdout!==!0&&S.includes(U?.slot)?kr(U.slot,k):null;return T?T==="default"?{...U,variant:T,decision_id:null}:{...U,variant:T}:U})}}function En(a,l){if(p)return null;let S=a?.exposure,k=S?.holdout===!0,U=Ao(a,k);return g.remember(br(U)),!S?.token||Et.has(S.token)?null:(Et.add(S.token),E("Personalisation Exposed",{exposure_token:S.token,surface:S.surface,holdout:k,holdout_share:S.holdout_share??xn()?.holdout_share??null,personalised_share:S.personalised_share??xn()?.personalised_share??null,...bo(S.surface,k,U)},l))}function Cn(a){return y&&vt(),y=null,O=null,N=null,$=null,a}return mr({track:(a,l,S)=>a==="Signed Out"?Cn(E(a,l,S)):E(a,l,S),page(a,l){a??(a={});let S=n.pageType??null;a.type&&(Ae.has(a.type)?(S=a.type,n.pageType=a.type):n.debug&&console.warn(`[hp] ignoring unknown page.type "${a.type}". Allowed: ${[...Ae].join(", ")}`));let k=K({type:"page",properties:{name:a.name??null,navigation_trigger:a.navigation_trigger??jn(),previous_message_id:P()}},{page:{type:S},...wt(l)??{}});return k&&_(k.messageId),k},identify(a,l,S){let{userId:k,...U}=a&&typeof a=="object"?a:{},T=Oe(wt(l)?.identity_token);if(k!==void 0){let z=H(k);$=z?z===y?T??$:T:null,S===Ne?N=z:O&&z&&z!==O?vt():n.debug&&N&&z&&z!==N&&console.warn("[hp] identify names another userId than the identity option; using the new one"),y=z,z&&S!==Ne&&(O=z)}else T&&y&&($=T);let{identity_token:Ct,...ne}=wt(l)??{};return K({type:"identify",traits:Ti(U,n.debug)},$?{...ne,identity_token:$}:ne)},reset(){y&&vt(),y=null,O=null,N=null,$=null,_("")},productViewed:(a,l)=>E("Product Viewed",a,l),productListViewed:(a,l)=>E("Product List Viewed",a,l),recommendationsViewed:(a,l)=>E("Recommendations Viewed",a,l),personalisationExposed:(a,l)=>E("Personalisation Exposed",a,l),recordExposure:En,surfaceViewed({surface:a}={},l){if(!Ai.has(a)||!n.holdout||a!=="decisions"&&!X())return null;let S=H(R(n.getAnonymousId,null)),k=Qt(n.holdout,S).group;if(k==="excluded")return null;let U=Un({sessionId:Ke(R(n.getSessionId,null),S),surface:a});return U?En({exposure:{token:U,surface:a,holdout:k==="holdout"}},l):null},inHoldout:()=>vn()!=="personalised",personalisationGroup:vn,productClicked:(a,l)=>E("Product Clicked",a,l),productListFiltered:(a,l)=>E("Product List Filtered",a,l),productsSearched:(a,l)=>E("Products Searched",a,l),searchSuggestionsViewed:(a,l)=>E("Search Suggestions Viewed",a,l),productAdded:(a,l)=>E("Product Added",a,l),productRemoved:(a,l)=>E("Product Removed",a,l),cartUpdated:(a,l)=>E("Cart Updated",vi(a),l),identityLinked:(a,l)=>E("Identity Linked",a,l),slotEngaged:(a,l)=>p?null:E("Slot Engaged",a,l),productVariantSelected:(a,l)=>E("Product Variant Selected",a,l),cartViewed:(a,l)=>E("Cart Viewed",a,l),productAddedToWishlist:(a,l)=>E("Product Added to Wishlist",a,l),productRemovedFromWishlist:(a,l)=>E("Product Removed from Wishlist",a,l),wishlistProductAddedToCart:(a,l)=>E("Wishlist Product Added to Cart",a,l),productShared:(a,l)=>E("Product Shared",a,l),cartShared:(a,l)=>E("Cart Shared",a,l),couponEntered:(a,l)=>E("Coupon Entered",a,l),couponApplied:(a,l)=>E("Coupon Applied",a,l),couponDenied:(a,l)=>E("Coupon Denied",a,l),couponRemoved:(a,l)=>E("Coupon Removed",a,l),checkoutStarted:(a,l)=>E("Checkout Started",a,l),promotionViewed:(a,l)=>E("Promotion Viewed",a,l),promotionClicked:(a,l)=>E("Promotion Clicked",a,l),checkoutStepViewed:(a,l)=>E("Checkout Step Viewed",a,l),checkoutStepCompleted:(a,l)=>E("Checkout Step Completed",a,l),paymentInfoEntered:(a,l)=>E("Payment Info Entered",a,l),checkoutFailed:(a,l)=>E("Checkout Failed",a,l),signedIn:(a,l)=>E("Signed In",a,l),signedUp:(a,l)=>E("Signed Up",a,l),signedOut:a=>Cn(E("Signed Out",{},a)),newsletterSubscribed:(a,l)=>E("Newsletter Subscribed",a,l),newsletterUnsubscribed:(a,l)=>E("Newsletter Unsubscribed",a,l),preferencesStated:(a,l)=>E("Preferences Stated",a,l),backInStockSubscribed:(a,l)=>E("Back In Stock Subscribed",a,l),productReviewed:(a,l)=>E("Product Reviewed",a,l),consentUpdated:(a,l)=>E("Consent Updated",a,l),flush:a=>b.flush(a),recommendationContext(){if(!X())return{};try{return Fe(),tn(Ee())}catch{return{}}},get consent(){return o?o.state:null},servingHeaders:()=>Ht(o?.state??null),get lastPageMessageId(){return P()},get anonymousId(){return H(R(n.getAnonymousId,null))},[xi](){return{writeKey:n.writeKey,library:{name:Sn,version:wn},storageKey:V(C("onsite"),n.propertyId),gatewayHost:n.apiHost,servingHost:n.servingHost??n.apiHost,settings:n.onsite??null,debug:n.debug===!0,preview:p,anonymousId:()=>H(R(n.getAnonymousId,null)),sessionId:()=>H(R(n.getSessionId,null)),identityToken:()=>X()?$:null,analytics:s,personalisation:X,answered:(a,l)=>{X()&&In(a,l)},started:a=>{kn=a},consent:()=>n.getConsent(),headers:()=>Ht(o?.state??null),pageUrl:()=>typeof location>"u"?null:Vt(location.href,n),locale:()=>$t(R(n.getLocale,n.locale)),campaign:()=>p?v:yt(n.propertyId,{sessionId:m()}),basketValue:()=>{let a=Ee().basketValue;return F??(Number.isFinite(a)?a:null)},values:()=>{let{basketValue:a,basketItems:l,basketCurrency:S}=Ee(),k=F!==null;return{basket_value:k?F:Number.isFinite(a)?a:null,basket_items:Se??(Number.isInteger(l)?l:null),currency:(k?W:re(S))??re(R(n.getCurrency,n.currency)),answers:X()?Yt(n.propertyId):null}},sessionSignals:()=>X()?(Fe(),{...Ee(),campaign:yt(n.propertyId,{sessionId:m()}),answers:Yt(n.propertyId)}):null,pageProduct:()=>ee,visitContext:()=>{let a=X();a&&Fe();let l=a?Ee():null,S=k=>Array.isArray(k)?k.filter(U=>typeof U=="string"&&U.length<=128).slice(0,20):[];return{...n.pageType?{page_type:n.pageType}:{},...ee?{product_id:ee}:{},...l?{basket:S(l.basketProducts),viewed:S(l.recentProducts)}:{}}},onBasket:a=>(_e.add(a),()=>_e.delete(a)),consentAnswered:()=>!o||o.status==="granted"||o.status==="denied",onConsentAnswered:a=>(be.add(a),()=>be.delete(a))}},[Ii](){b.markFailing?.()},[ki](a,l,S){if(typeof this[a]=="function"){G=typeof S?.messageId=="string"&&typeof S?.timestamp=="string"?{messageId:S.messageId,timestamp:S.timestamp}:null;try{this[a](...Array.isArray(l)?l:[])}finally{G=null}}}})}function co(e){let t=typeof document>"u"?null:document.currentScript?.src;return t?new URL(e,t).href:null}var _t=new Map;function uo(e,t){return window[t]?Promise.resolve(window[t]):e?(_t.has(t)||_t.set(t,new Promise((n,r)=>{let o=document.createElement("script");o.src=e,o.async=!0,o.onload=()=>window[t]?n(window[t]):r(new Error(`${e} did not register`)),o.onerror=()=>r(new Error(`${e} did not load`)),document.head.append(o)}).finally(()=>_t.delete(t))),_t.get(t)):Promise.reject(new Error("the CDN script\u2019s own URL is unknown"))}var Ui=co("onsite.min.js"),bn=()=>uo(Ui,Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.module"));var An=Symbol.for("@thg-agentic/hyper-personalisation-web.bootstrap"),Vi=Symbol.for("@thg-agentic/hyper-personalisation-web.drain"),$i=Symbol.for("@thg-agentic/hyper-personalisation-web.carry"),lo=Symbol.for("@thg-agentic/hyper-personalisation-web.replay"),ji=Symbol.for("@thg-agentic/hyper-personalisation-web.unreachable"),Bi=Symbol.for("@thg-agentic/hyper-personalisation-web.assignment"),qi=Symbol.for("@thg-agentic/hyper-personalisation-web.recommendation-context"),kt=e=>e?()=>B(e):()=>null,mo={didomi:e=>or({purposes:e.purposes}),onetrust:e=>sr({groups:e.groups,impliedConsent:e.impliedConsent}),cookie:e=>ir({name:e.name,categories:e.categories,refusedValue:e.refusedValue,source:e.source,changeEvent:e.changeEvent}),forwarded:e=>ar({name:e.name}),static:e=>{if(!e.state||typeof e.state!="object")throw new Error('consent.state is required for provider "static"');return cr(e.state)}},fo=Object.keys(mo),we=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),bt=e=>typeof e=="string"&&e!=="",Fi=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),ho=e=>we(e)&&typeof e.read=="function";function Hi(e,t={}){let n=[];if(!we(e))return["config must be { writeKey, apiHost? }"];bt(e.writeKey)||n.push("writeKey is required"),ce(e.apiHost)||n.push("apiHost, when given, must be a host or an http(s) origin"),t.propertyId!==void 0&&!bt(t.propertyId)&&n.push("propertyId must be a string");let{consent:r}=t;if(!ho(r)&&!(we(r)&&fo.includes(r.provider))&&n.push(`consent must be a consent adapter or { provider: ${fo.join(" | ")} }`),t.autocapture!==void 0&&t.autocapture!==!1&&!we(t.autocapture)&&n.push("autocapture must be false or { promotions, productLists, recommendations }"),t.onsite!==void 0&&typeof t.onsite!="boolean"&&!we(t.onsite)&&n.push("onsite must be true, false or the onsite options"),t.beforeSend!==void 0&&typeof t.beforeSend!="function"&&n.push("beforeSend must be a function"),t.identityCookies!==void 0)if(!we(t.identityCookies))n.push("identityCookies must be an object");else for(let o of["anonymousId","sessionId"]){let s=t.identityCookies[o];s!==void 0&&!bt(s)&&n.push(`identityCookies.${o} must be a cookie name`)}for(let o of["getCurrency","getShipToCountry","getLocale"])t[o]!==void 0&&typeof t[o]!="function"&&n.push(`${o} must be a function`);return t.dataLayer!==void 0&&(we(t.dataLayer)?(t.dataLayer.name!==void 0&&!bt(t.dataLayer.name)&&n.push("dataLayer.name must be a string"),t.dataLayer.ignore!==void 0&&!Fi(t.dataLayer.ignore)&&n.push("dataLayer.ignore must be an array of strings")):n.push("dataLayer must be an object")),n}function Ki(e,t,n){if(ho(e))return Kt(e,t.consentPurposes);let{provider:r,...o}=e,s=n?.consent?.[r]??mo[r];return Kt(s(o),t.consentPurposes)}var It=(e,t,n)=>`${e??""}|${t??""}${n?"|v":""}`,Gi=(e,t,n,r)=>e===It(t,n,!0)||!r&&e===It(t,n,!1),zi=e=>{if(e.context?.identity_token===void 0)return e;let{identity_token:t,...n}=e.context;return{...e,context:n}},go=e=>{try{return sessionStorage.getItem(e)}catch{return null}};function Ji(e,t){let n=H(t?.userId),r=St(t?.emailSha256);if(!n&&!r)return null;let o=go(V(C("identified"),e));return Gi(o,n,r,n!==null&&Oe(t?.token)!==null)?null:{...n?{userId:n}:{},...r?{email_sha256:r}:{}}}async function Wi({writeKey:e,apiHost:t},n){if(n.settings!==void 0)return{settings:ln(n.settings),revalidated:null};let r=Kr(t,e),o=Gr(e);if(o)return{settings:o,revalidated:r,fetched:r};let s=await r;return s?{settings:s,revalidated:r,fetched:r}:{settings:un,revalidated:null,fetched:r}}function yo(e,t){let n=t??{},r=typeof window<"u"?window:null;if(r?.[An])return r[An];let o=Qn(e?.writeKey,()=>{let{analytics:i}=Te(B(C("consent")));return i===!0||i===null&&n.holdAcrossPages===!0}),s=Qi(e,n,o);if(r){let i=n.extend?.getSessionId??kt(n.identityCookies?.sessionId),c=kt(n.identityCookies?.anonymousId);r[Bi]=({slot:u,arm:d}={})=>Dn({sessionId:Ke(i(),c()),slot:u,arm:d}),r[An]=s,r[$i]=o,r[Vi]?.(s)}return s}function Xi(){let e=globalThis.performance?.now?.();return new Date(Date.now()-(Number.isFinite(e)?e:0)).toISOString()}function po(e,t){if(t===!1)return()=>{};let n={promotions:!0,productLists:!0,recommendations:!0,exposures:!0,...t},r=s=>s&&typeof s=="object"?s:{},o=[];try{n.promotions&&o.push(Tt(e,r(n.promotions))),n.productLists&&o.push(Lt(e,r(n.productLists))),n.recommendations&&o.push(Nt(e,r(n.recommendations))),n.exposures&&o.push(Ot(e,r(n.exposures)))}catch(s){console.warn("[hp] autocapture not started:",s?.message??s)}return()=>{for(let s of o)s()}}var Yi=1e3;function Zi(e,t,n,r){if(!t)return De();let o=n.onsite?bn():null;o?.catch(()=>{}),(r?Promise.race([r.then(i=>i??n),new Promise(i=>setTimeout(()=>i(n),Yi))]):Promise.resolve(n)).then(i=>{let c=i.enabled?i.onsite:null;if(!c)return De();let u=t===!0?{}:t;return(o??bn()).then(d=>d.startOnsite(e,{...u,settings:u.settings??c}))}).catch(i=>{De(),console.warn("[hp] onsite not started:",i?.message??i)})}function At(e){return e.close(),De(),null}async function Qi(e,t,n){try{let r=Hi(e,t);if(r.length)return console.warn(`[hp] not started, the configuration is invalid: ${r.join("; ")}`),At(n);Je(t.storageNames),Xe();let{writeKey:o}=e,[{settings:s,revalidated:i,fetched:c},u]=await Promise.all([Wi(e,t),Promise.resolve(t.identity).catch(()=>null)]),d=i?s:null,f=!1,p=()=>f&&d&&zr(o,d);if(i?.then(g=>{g&&(d=g,g.enabled?p():dn(o))}),!s.enabled)return t.debug&&console.info("[hp] off: the settings for this write key do not enable it"),At(n);let m=t.propertyId??s.propertyId??null;if(!m&&s!==un)return console.warn("[hp] not started: this write key covers several properties, so propertyId is required"),At(n);let{preset:v}=t,w=Ji(m,u),I=t.debug===!0||s.debug?.enabled===!0||pr(s.debug?.tokenSha256??null,C("debug")),b=H(u?.userId),x=ao({apiHost:Fr(e.apiHost,s.apiHost),servingHost:ce(e.apiHost),onsite:s.onsite??null,writeKey:o,propertyId:m,pageType:Ae.has(t.pageType)?t.pageType:void 0,environment:s.environment,queryParamAllowlist:s.queryParamAllowlist??void 0,plan:s.plan,sampleRate:s.sampleRate??1,holdout:s.holdouts?.[m],getCurrency:t.getCurrency,getShipToCountry:t.getShipToCountry,getLocale:t.getLocale,consent:Ki(t.consent,s,v),consentCookieDomain:t.consentCookieDomain,storageNames:t.storageNames,holdAcrossPages:t.holdAcrossPages===!0,mintAnonymousId:t.mintAnonymousId,debug:I,anonymousIdSource:s.anonymousId??void 0,getAnonymousId:kt(t.identityCookies?.anonymousId),getSessionId:t.identityCookies?.sessionId?kt(t.identityCookies.sessionId):void 0,getUserId:()=>b,identityToken:u?.token,beforeSend:t.beforeSend,...t.extend,onConsentStatus(g){if(g==="granted"&&(f=!0,p()),g==="denied"){dn(o);try{sessionStorage.removeItem(V(C("identified"),m))}catch{}}t.extend?.onConsentStatus?.(g)},onEvent(g){if(g.type==="identify"){let y=V(C("identified"),m),O=H(g.userId),N=St(g.traits?.email_sha256),$=!!g.context?.identity_token||go(y)===It(O,N,!0);try{sessionStorage.setItem(y,It(O,N,$))}catch{}}t.extend?.onEvent?.(zi(g))}});typeof window<"u"&&(window[qi]=()=>x.recommendationContext()),c?.then(g=>g===null&&x[ji]());for(let[g,y,O]of n.take())try{x[lo](g,y,O)}catch(N){console.warn(`[hp] carried ${g} failed`,N)}x[lo]("page",[t.pageType?{type:t.pageType}:{}],{messageId:ie(),timestamp:Xi()});let h=po(x,t.autocapture),P=x.page;x.page=Wt("page",(...g)=>{let y=P(...g);return h(),h=po(x,t.autocapture),y});let _=typeof window<"u"?window:null;if(_?.addEventListener?.("pageshow",g=>{g.persisted&&x.page({navigation_trigger:"back_forward"})}),t.dataLayer&&_){let g=t.dataLayer.name??"dataLayer";_[g]=_[g]||[],fr(x,{...v,dataLayer:_[g],ignore:[...v?.ignore??[],...t.dataLayer.ignore??[]],onError:y=>I&&console.warn("[hp] dataLayer mapping failed",y)})}return w&&x.identify(w,void 0,Ne),x.onsite=ge,Zi(x,t.onsite,s,i),x}catch(r){return console.warn("[hp] not started:",r?.message??r),At(n)}}function wo(e){e.initialized=!0,yo(e._config,e._options).then(t=>{let n=e.splice(0);if(!t){for(let r of e.methods??[])e[r]=()=>e;return}e.client=t;for(let[r,o]of Object.entries(t))typeof o=="function"&&(e[r]=o);for(let[r,...o]of n)try{t[r]?.(...o)}catch(s){console.warn(`[hp] queued ${r} failed`,s)}})}var j=window.hp=window.hp||[];j.servingHeaders??(j.servingHeaders=()=>({}));j.inHoldout??(j.inHoldout=()=>!0);j.personalisationGroup??(j.personalisationGroup=()=>"excluded");j.recommendationContext??(j.recommendationContext=()=>({}));j.onsite??(j.onsite=ge);j.initialized||(j._config?wo(j):j.load=(e,t)=>{j._config=e,j._options=t??{},wo(j)});})();
3
+ `)}`;if(n.throwOnInvalid)throw new Ce(z);console.error(z)}}n.debug&&console.debug("[hp]",P.event??P.type,P);let Pt=Hi(P);return Pt>bn?(k(`${P.event??P.type} not sent: ${Pt} bytes, over the ${bn}-byte limit for one event`),null):(Co(P,S),P)}function En(a){if((a.type==="track"||a.type==="page")&&xo(a),n.onEvent)try{n.onEvent(a)}catch(l){console.warn("[hp] onEvent observer failed",l)}}let Y=()=>r&&o?.state?.personalisation===!0,Le=()=>Vr(D(n.getSessionId,null),n.propertyId),Et=!1,vn=null;function xo(a){try{if(Y()){Le();let l=Fr(a.event,a.properties,St(n.propertyId,{sessionId:m()}));a.type==="track"&&Lr(rn(l)),a.event==="Preferences Stated"&&a.properties?.source==="onsite"&&On([a.properties],a.properties.slot),Et=!0}else Ke(!1,n.propertyId??null)}catch(l){n.debug&&console.warn("[hp] the visit was not recorded",l)}}function On(a,l){let S=(vn??n.onsite)?.forms?.find?.(E=>E?.slot===l);br(n.propertyId,_r(a,S?.questions))}function Ke(a=!1,l=void 0){Nr(),Ar(l),(a||Et)&&Ur(),Et=!1}function vt(){d.forget(),g.forget(),Ot.clear(),u?.forget(),Ke(!0),In()}function Co(a,l){!r||l||o.admits()?(En(a),b.enqueue(a)):o.hold(a)}let C=(a,l,S)=>ke({type:"track",event:a,properties:l??{}},S),Ot=new Set,Eo=(a,l,S)=>a==="audiences"?{audiences:l?null:S.audiences??[]}:a==="decisions"?{decisions:(S.decisions??[]).map(E=>({slot:E.slot,decision_id:E.decision_id??null,arm:E.arm??null,...E.variant&&{variant:E.variant}}))}:{recommendation_request_id:S.recommendation_request_id??null};w(x),r&&(o=Ir({adapter:n.consent,timeoutMs:n.consentTimeoutMs,cookieDomain:n.consentCookieDomain,debug:n.debug,store:i&&{read:()=>c.items,write:a=>i.write(a,u?.peek()??null)},release(a){a.context&&(a.context.consent=o.stamp()),En(a),b.enqueue(a)},onStatus(a){if(a==="granted"&&(u?.persist(),d.persist(),h&&_(h),g.persist(),b.replayPersisted?.()),a==="denied"){b.clearPersisted?.(),u?.forget(),d.forget();try{sessionStorage.removeItem(I)}catch{}g.forget(),Ke(!0)}try{n.onConsentStatus?.(a)}catch(l){console.warn("[hp] onConsentStatus observer failed",l)}if(a==="granted"||a==="denied")for(let l of M)try{l()}catch(S){console.warn("[hp] a consent listener failed",S)}},announce({action:a,state:l,previous:S,withdrawal:E}){l?.personalisation!==!0&&Ke(S?.personalisation===!0),E&&(b.discardQueued?.(),In()),ke({type:"track",event:"Consent Updated",properties:{action:a,state:l}},void 0,E),E&&b.flush()}}),o.start(),w());let Pn=()=>n.holdout?en(n.holdout):null,Tn=()=>tn(n.holdout,H(D(n.getAnonymousId,null))).group;function vo(a,l){if(!Array.isArray(a?.decisions))return a;let S=n.holdout?.readoutSlots??[],E=H(D(n.getAnonymousId,null));return{...a,decisions:a.decisions.map(N=>{let P=N?.variant==="bandit"||N?.variant==="default"?N.variant:!l&&N?.holdout!==!0&&S.includes(N?.slot)?Er(N.slot,E):null;return P?P==="default"?{...N,variant:P,decision_id:null}:{...N,variant:P}:N})}}function Ln(a,l){if(p)return null;let S=a?.exposure,E=S?.holdout===!0,N=vo(a,E);return g.remember(xr(N)),!S?.token||Ot.has(S.token)?null:(Ot.add(S.token),C("Personalisation Exposed",{exposure_token:S.token,surface:S.surface,holdout:E,holdout_share:S.holdout_share??Pn()?.holdout_share??null,personalised_share:S.personalised_share??Pn()?.personalised_share??null,...Eo(S.surface,E,N)},l))}function Nn(a){return y&&vt(),y=null,T=null,R=null,$=null,a}return wr({track:(a,l,S)=>a==="Signed Out"?Nn(C(a,l,S)):C(a,l,S),page(a,l){a??(a={});let S=n.pageType??null;a.type&&(Ie.has(a.type)?(S=a.type,n.pageType=a.type):n.debug&&console.warn(`[hp] ignoring unknown page.type "${a.type}". Allowed: ${[...Ie].join(", ")}`));let E=ke({type:"page",properties:{name:a.name??null,navigation_trigger:a.navigation_trigger??Hn(),previous_message_id:O()}},{page:{type:S},..._t(l)??{}});return E&&_(E.messageId),E},identify(a,l,S){let{userId:E,...N}=a&&typeof a=="object"?a:{},P=Re(_t(l)?.identity_token);if(E!==void 0){let z=H(E);$=z?z===y?P??$:P:null,S===Ve?R=z:T&&z&&z!==T?vt():n.debug&&R&&z&&z!==R&&console.warn("[hp] identify names another userId than the identity option; using the new one"),y=z,z&&S!==Ve&&(T=z)}else P&&y&&($=P);let{identity_token:Pt,...ne}=_t(l)??{};return ke({type:"identify",traits:ji(N,n.debug)},$?{...ne,identity_token:$}:ne)},reset(){y&&vt(),y=null,T=null,R=null,$=null,_("")},productViewed:(a,l)=>C("Product Viewed",a,l),productListViewed:(a,l)=>C("Product List Viewed",a,l),recommendationsViewed:(a,l)=>C("Recommendations Viewed",a,l),personalisationExposed:(a,l)=>C("Personalisation Exposed",a,l),recordExposure:Ln,surfaceViewed({surface:a}={},l){if(!Ti.has(a)||!n.holdout||a!=="decisions"&&!Y())return null;let S=H(D(n.getAnonymousId,null)),E=tn(n.holdout,S).group;if(E==="excluded")return null;let N=qn({sessionId:Ge(D(n.getSessionId,null),S),surface:a});return N?Ln({exposure:{token:N,surface:a,holdout:E==="holdout"}},l):null},inHoldout:()=>Tn()!=="personalised",personalisationGroup:Tn,productClicked:(a,l)=>C("Product Clicked",a,l),productListFiltered:(a,l)=>C("Product List Filtered",a,l),productsSearched:(a,l)=>C("Products Searched",a,l),searchSuggestionsViewed:(a,l)=>C("Search Suggestions Viewed",a,l),productAdded:(a,l)=>C("Product Added",a,l),productRemoved:(a,l)=>C("Product Removed",a,l),cartUpdated:(a,l)=>C("Cart Updated",Mi(a),l),identityLinked:(a,l)=>C("Identity Linked",a,l),slotEngaged:(a,l)=>p?null:C("Slot Engaged",a,l),productVariantSelected:(a,l)=>C("Product Variant Selected",a,l),cartViewed:(a,l)=>C("Cart Viewed",a,l),productAddedToWishlist:(a,l)=>C("Product Added to Wishlist",a,l),productRemovedFromWishlist:(a,l)=>C("Product Removed from Wishlist",a,l),wishlistProductAddedToCart:(a,l)=>C("Wishlist Product Added to Cart",a,l),productShared:(a,l)=>C("Product Shared",a,l),cartShared:(a,l)=>C("Cart Shared",a,l),couponEntered:(a,l)=>C("Coupon Entered",a,l),couponApplied:(a,l)=>C("Coupon Applied",a,l),couponDenied:(a,l)=>C("Coupon Denied",a,l),couponRemoved:(a,l)=>C("Coupon Removed",a,l),checkoutStarted:(a,l)=>C("Checkout Started",a,l),promotionViewed:(a,l)=>C("Promotion Viewed",a,l),promotionClicked:(a,l)=>C("Promotion Clicked",a,l),checkoutStepViewed:(a,l)=>C("Checkout Step Viewed",a,l),checkoutStepCompleted:(a,l)=>C("Checkout Step Completed",a,l),paymentInfoEntered:(a,l)=>C("Payment Info Entered",a,l),checkoutFailed:(a,l)=>C("Checkout Failed",a,l),signedIn:(a,l)=>C("Signed In",a,l),signedUp:(a,l)=>C("Signed Up",a,l),signedOut:a=>Nn(C("Signed Out",{},a)),newsletterSubscribed:(a,l)=>C("Newsletter Subscribed",a,l),newsletterUnsubscribed:(a,l)=>C("Newsletter Unsubscribed",a,l),preferencesStated:(a,l)=>C("Preferences Stated",a,l),backInStockSubscribed:(a,l)=>C("Back In Stock Subscribed",a,l),productReviewed:(a,l)=>C("Product Reviewed",a,l),consentUpdated:(a,l)=>C("Consent Updated",a,l),flush:a=>b.flush(a),recommendationContext(){if(!Y())return{};try{return Le(),rn(we())}catch{return{}}},get consent(){return o?o.state:null},servingHeaders:()=>Gt(o?.state??null),get lastPageMessageId(){return O()},get anonymousId(){return H(D(n.getAnonymousId,null))},[Ri](){return{writeKey:n.writeKey,library:{name:kn,version:An},storageKey:U(v("onsite"),n.propertyId),gatewayHost:n.apiHost,servingHost:n.servingHost??n.apiHost,settings:n.onsite??null,debug:n.debug===!0,preview:p,anonymousId:()=>H(D(n.getAnonymousId,null)),sessionId:()=>H(D(n.getSessionId,null)),identityToken:()=>Y()?$:null,analytics:s,personalisation:Y,answered:(a,l)=>{Y()&&On(a,l)},started:a=>{vn=a},consent:()=>n.getConsent(),headers:()=>Gt(o?.state??null),pageUrl:()=>typeof location>"u"?null:Bt(location.href,n),locale:()=>jt(D(n.getLocale,n.locale)),campaign:()=>p?x:St(n.propertyId,{sessionId:m()}),basketValue:()=>{let a=we().basketValue;return F??(Number.isFinite(a)?a:null)},basketCodes:Te,values:()=>{let{basketValue:a,basketItems:l,basketCurrency:S}=we(),E=F!==null;return{basket_value:E?F:Number.isFinite(a)?a:null,basket_items:_e??(Number.isInteger(l)?l:null),currency:(E?W:re(S))??re(D(n.getCurrency,n.currency)),answers:Y()?Qt(n.propertyId):null}},sessionSignals:()=>Y()?(Le(),{...we(),campaign:St(n.propertyId,{sessionId:m()}),answers:Qt(n.propertyId)}):null,pageProduct:()=>ee,visitContext:()=>{let a=Y();a&&Le();let l=a?we():null,S=E=>Array.isArray(E)?E.filter(N=>typeof N=="string"&&N.length<=128).slice(0,20):[];return{...n.pageType?{page_type:n.pageType}:{},...ee?{product_id:ee}:{},...l?{basket:S(l.basketProducts),viewed:S(l.recentProducts)}:{}}},onBasket:a=>(Ae.add(a),()=>Ae.delete(a)),consentAnswered:()=>!o||o.status==="granted"||o.status==="denied",onConsentAnswered:a=>(M.add(a),()=>M.delete(a))}},[Ni](){b.markFailing?.()},[Li](a,l,S){if(typeof this[a]=="function"){G=typeof S?.messageId=="string"&&typeof S?.timestamp=="string"?{messageId:S.messageId,timestamp:S.timestamp}:null;try{this[a](...Array.isArray(l)?l:[])}finally{G=null}}}})}function mo(e){let t=typeof document>"u"?null:document.currentScript?.src;return t?new URL(e,t).href:null}var At=new Map;function ho(e,t){return window[t]?Promise.resolve(window[t]):e?(At.has(t)||At.set(t,new Promise((n,r)=>{let o=document.createElement("script");o.src=e,o.async=!0,o.onload=()=>window[t]?n(window[t]):r(new Error(`${e} did not register`)),o.onerror=()=>r(new Error(`${e} did not load`)),document.head.append(o)}).finally(()=>At.delete(t))),At.get(t)):Promise.reject(new Error("the CDN script\u2019s own URL is unknown"))}var Gi=mo("onsite.min.js"),xn=()=>ho(Gi,Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.module"));var Cn=Symbol.for("@thg-agentic/hyper-personalisation-web.bootstrap"),zi=Symbol.for("@thg-agentic/hyper-personalisation-web.drain"),Ji=Symbol.for("@thg-agentic/hyper-personalisation-web.carry"),go=Symbol.for("@thg-agentic/hyper-personalisation-web.replay"),Wi=Symbol.for("@thg-agentic/hyper-personalisation-web.unreachable"),Xi=Symbol.for("@thg-agentic/hyper-personalisation-web.assignment"),Yi=Symbol.for("@thg-agentic/hyper-personalisation-web.recommendation-context"),xt=e=>e?()=>j(e):()=>null,So={didomi:e=>cr({purposes:e.purposes}),onetrust:e=>ur({groups:e.groups,impliedConsent:e.impliedConsent}),cookie:e=>lr({name:e.name,categories:e.categories,refusedValue:e.refusedValue,source:e.source,changeEvent:e.changeEvent}),forwarded:e=>dr({name:e.name}),static:e=>{if(!e.state||typeof e.state!="object")throw new Error('consent.state is required for provider "static"');return fr(e.state)}},yo=Object.keys(So),Se=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),kt=e=>typeof e=="string"&&e!=="",Zi=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),_o=e=>Se(e)&&typeof e.read=="function";function Qi(e,t={}){let n=[];if(!Se(e))return["config must be { writeKey, apiHost? }"];kt(e.writeKey)||n.push("writeKey is required"),ce(e.apiHost)||n.push("apiHost, when given, must be a host or an http(s) origin"),t.propertyId!==void 0&&!kt(t.propertyId)&&n.push("propertyId must be a string");let{consent:r}=t;if(!_o(r)&&!(Se(r)&&yo.includes(r.provider))&&n.push(`consent must be a consent adapter or { provider: ${yo.join(" | ")} }`),t.autocapture!==void 0&&t.autocapture!==!1&&!Se(t.autocapture)&&n.push("autocapture must be false or { promotions, productLists, recommendations }"),t.onsite!==void 0&&typeof t.onsite!="boolean"&&!Se(t.onsite)&&n.push("onsite must be true, false or the onsite options"),t.beforeSend!==void 0&&typeof t.beforeSend!="function"&&n.push("beforeSend must be a function"),t.identityCookies!==void 0)if(!Se(t.identityCookies))n.push("identityCookies must be an object");else for(let o of["anonymousId","sessionId"]){let s=t.identityCookies[o];s!==void 0&&!kt(s)&&n.push(`identityCookies.${o} must be a cookie name`)}for(let o of["getCurrency","getShipToCountry","getLocale"])t[o]!==void 0&&typeof t[o]!="function"&&n.push(`${o} must be a function`);return t.dataLayer!==void 0&&(Se(t.dataLayer)?(t.dataLayer.name!==void 0&&!kt(t.dataLayer.name)&&n.push("dataLayer.name must be a string"),t.dataLayer.ignore!==void 0&&!Zi(t.dataLayer.ignore)&&n.push("dataLayer.ignore must be an array of strings")):n.push("dataLayer must be an object")),n}function ea(e,t,n){if(_o(e))return zt(e,t.consentPurposes);let{provider:r,...o}=e,s=n?.consent?.[r]??So[r];return zt(s(o),t.consentPurposes)}var Ct=(e,t,n)=>`${e??""}|${t??""}${n?"|v":""}`,ta=(e,t,n,r)=>e===Ct(t,n,!0)||!r&&e===Ct(t,n,!1),na=e=>{if(e.context?.identity_token===void 0)return e;let{identity_token:t,...n}=e.context;return{...e,context:n}},bo=e=>{try{return sessionStorage.getItem(e)}catch{return null}};function ra(e,t){let n=H(t?.userId),r=bt(t?.emailSha256);if(!n&&!r)return null;let o=bo(U(v("identified"),e));return ta(o,n,r,n!==null&&Re(t?.token)!==null)?null:{...n?{userId:n}:{},...r?{email_sha256:r}:{}}}async function oa({writeKey:e,apiHost:t},n){if(n.settings!==void 0)return{settings:mn(n.settings),revalidated:null};let r=Xr(t,e),o=Yr(e);if(o)return{settings:o,revalidated:r,fetched:r};let s=await r;return s?{settings:s,revalidated:r,fetched:r}:{settings:pn,revalidated:null,fetched:r}}function Ao(e,t){let n=t??{},r=typeof window<"u"?window:null;if(r?.[Cn])return r[Cn];let o=rr(e?.writeKey,()=>{let{analytics:i}=De(j(v("consent")));return i===!0||i===null&&n.holdAcrossPages===!0}),s=ca(e,n,o);if(r){let i=n.extend?.getSessionId??xt(n.identityCookies?.sessionId),c=xt(n.identityCookies?.anonymousId);r[Xi]=({slot:u,arm:d}={})=>jn({sessionId:Ge(i(),c()),slot:u,arm:d}),r[Cn]=s,r[Ji]=o,r[zi]?.(s)}return s}function sa(){let e=globalThis.performance?.now?.();return new Date(Date.now()-(Number.isFinite(e)?e:0)).toISOString()}function wo(e,t){if(t===!1)return()=>{};let n={promotions:!0,productLists:!0,recommendations:!0,exposures:!0,...t},r=s=>s&&typeof s=="object"?s:{},o=[];try{n.promotions&&o.push(Rt(e,r(n.promotions))),n.productLists&&o.push(Nt(e,r(n.productLists))),n.recommendations&&o.push(Mt(e,r(n.recommendations))),n.exposures&&o.push(Lt(e,r(n.exposures)))}catch(s){console.warn("[hp] autocapture not started:",s?.message??s)}return()=>{for(let s of o)s()}}var ia=1e3;function aa(e,t,n,r){if(!t)return Be();let o=n.onsite?xn():null;o?.catch(()=>{}),(r?Promise.race([r.then(i=>i??n),new Promise(i=>setTimeout(()=>i(n),ia))]):Promise.resolve(n)).then(i=>{let c=i.enabled?i.onsite:null;if(!c)return Be();let u=t===!0?{}:t;return(o??xn()).then(d=>d.startOnsite(e,{...u,settings:u.settings??c}))}).catch(i=>{Be(),console.warn("[hp] onsite not started:",i?.message??i)})}function It(e){return e.close(),Be(),null}async function ca(e,t,n){try{let r=Qi(e,t);if(r.length)return console.warn(`[hp] not started, the configuration is invalid: ${r.join("; ")}`),It(n);We(t.storageNames),Ye();let{writeKey:o}=e,[{settings:s,revalidated:i,fetched:c},u]=await Promise.all([oa(e,t),Promise.resolve(t.identity).catch(()=>null)]),d=i?s:null,f=!1,p=()=>f&&d&&Zr(o,d);if(i?.then(g=>{g&&(d=g,g.enabled?p():hn(o))}),!s.enabled)return t.debug&&console.info("[hp] off: the settings for this write key do not enable it"),It(n);let m=t.propertyId??s.propertyId??null;if(!m&&s!==pn)return console.warn("[hp] not started: this write key covers several properties, so propertyId is required"),It(n);let{preset:x}=t,w=ra(m,u),k=t.debug===!0||s.debug?.enabled===!0||yr(s.debug?.tokenSha256??null,v("debug")),b=H(u?.userId),I=po({apiHost:Jr(e.apiHost,s.apiHost),servingHost:ce(e.apiHost),onsite:s.onsite??null,writeKey:o,propertyId:m,pageType:Ie.has(t.pageType)?t.pageType:void 0,environment:s.environment,queryParamAllowlist:s.queryParamAllowlist??void 0,plan:s.plan,sampleRate:s.sampleRate??1,holdout:s.holdouts?.[m],getCurrency:t.getCurrency,getShipToCountry:t.getShipToCountry,getLocale:t.getLocale,consent:ea(t.consent,s,x),consentCookieDomain:t.consentCookieDomain,storageNames:t.storageNames,holdAcrossPages:t.holdAcrossPages===!0,mintAnonymousId:t.mintAnonymousId,debug:k,anonymousIdSource:s.anonymousId??void 0,getAnonymousId:xt(t.identityCookies?.anonymousId),getSessionId:t.identityCookies?.sessionId?xt(t.identityCookies.sessionId):void 0,getUserId:()=>b,identityToken:u?.token,beforeSend:t.beforeSend,...t.extend,onConsentStatus(g){if(g==="granted"&&(f=!0,p()),g==="denied"){hn(o);try{sessionStorage.removeItem(U(v("identified"),m))}catch{}}t.extend?.onConsentStatus?.(g)},onEvent(g){if(g.type==="identify"){let y=U(v("identified"),m),T=H(g.userId),R=bt(g.traits?.email_sha256),$=!!g.context?.identity_token||bo(y)===Ct(T,R,!0);try{sessionStorage.setItem(y,Ct(T,R,$))}catch{}}t.extend?.onEvent?.(na(g))}});typeof window<"u"&&(window[Yi]=()=>I.recommendationContext()),c?.then(g=>g===null&&I[Wi]());for(let[g,y,T]of n.take())try{I[go](g,y,T)}catch(R){console.warn(`[hp] carried ${g} failed`,R)}I[go]("page",[t.pageType?{type:t.pageType}:{}],{messageId:ie(),timestamp:sa()});let h=wo(I,t.autocapture),O=I.page;I.page=Yt("page",(...g)=>{let y=O(...g);return h(),h=wo(I,t.autocapture),y});let _=typeof window<"u"?window:null;if(_?.addEventListener?.("pageshow",g=>{g.persisted&&I.page({navigation_trigger:"back_forward"})}),t.dataLayer&&_){let g=t.dataLayer.name??"dataLayer";_[g]=_[g]||[],gr(I,{...x,dataLayer:_[g],ignore:[...x?.ignore??[],...t.dataLayer.ignore??[]],onError:y=>k&&console.warn("[hp] dataLayer mapping failed",y)})}return w&&I.identify(w,void 0,Ve),I.onsite=ge,aa(I,t.onsite,s,i),I}catch(r){return console.warn("[hp] not started:",r?.message??r),It(n)}}function ko(e){e.initialized=!0,Ao(e._config,e._options).then(t=>{let n=e.splice(0);if(!t){for(let r of e.methods??[])e[r]=()=>e;return}e.client=t;for(let[r,o]of Object.entries(t))typeof o=="function"&&(e[r]=o);for(let[r,...o]of n)try{t[r]?.(...o)}catch(s){console.warn(`[hp] queued ${r} failed`,s)}})}var B=window.hp=window.hp||[];B.servingHeaders??(B.servingHeaders=()=>({}));B.inHoldout??(B.inHoldout=()=>!0);B.personalisationGroup??(B.personalisationGroup=()=>"excluded");B.recommendationContext??(B.recommendationContext=()=>({}));B.onsite??(B.onsite=ge);B.initialized||(B._config?ko(B):B.load=(e,t)=>{B._config=e,B._options=t??{},ko(B)});})();
@@ -1,4 +1,4 @@
1
- (()=>{function _(t,e,r,i){let o=t.lastChild,n=e.daily&&(()=>i?.find?.(l=>l>Date.now())||0),a=n||"ends_at"in e,s=n?n():"ends_at"in e?Date.parse(e.ends_at):Date.now()+Math.max(0,Number(e.minutes)||0)*6e4,c=()=>{n&&s<=Date.now()&&(s=n());let l=Math.max(0,s-Date.now())||0,p=Math.floor(l/864e5);o.textContent=`${p?`${p}d `:""}${new Date(l).toISOString().slice(l<36e5?14:11,19)}`,t.hidden=!l&&a&&!r,!l&&!(n&&s)&&clearInterval(d)},d=setInterval(c,1e3);return c(),()=>clearInterval(d)}var y=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);function w(t,e,r,i,o){let n=t("select","i");n.setAttribute("aria-label",e);for(let[a,s]of[["",r],...i]){let c=t("option","",s);c.value=a,c.selected=a===o,n.append(c)}return n}var S=t=>(t.options??[]).filter(e=>y(e)&&typeof e.value=="string");function $(t,e,r,i,o){let n=t("input");return n.type=o,n.name=`q_${e.key}`,n.value=r.value,n.checked=i.includes(r.value),n}var A=t=>{let e=t.options.length;return e<=4?e:e%4?3:4};var M=t=>String(t).padStart(2,"0"),U=120,R=/^-?\d{1,10}(?:\.(\d{1,10}))?$/,z=1e9;function L(t){try{let e=new Intl.DateTimeFormat(t,{month:"long",timeZone:"UTC"});return{name:r=>e.format(Date.UTC(2016,r-1,1)),monthFirst:new Intl.DateTimeFormat(t,{month:"numeric",day:"numeric"}).formatToParts(0).find(r=>r.type!=="literal")?.type==="month"}}catch{return{name:String,monthFirst:!1}}}var D=(t,e,r,i,o,n)=>{let a=w(t,r,r,Array.from({length:i},(s,c)=>[M(c+1),o(c+1)]),n);return a.name=e,a};function b(t,e,r,i,o){let n=t("input","i");return n.name=e,n.inputMode=i,n.setAttribute("aria-label",r),n.value=o??"",n}function E(t,e,r,i,o){let n=e.format??{},a=r("div",n.kind==="birthday"?"ph bd":"ph");if(e.type==="number")a.append(b(r,"hp_v",e.label,n.decimals?"decimal":"numeric",i)),n.unit&&a.append(r("span","u",n.unit));else if(n.kind==="birthday"){let[,s,c,d]=/^(\d{4}|-)-(\d\d)-(\d\d)$/.exec(i??"")??[],l=L(o||void 0),p=D(r,"hp_d","Day",31,String,d),m=D(r,"hp_m","Month",12,l.name,c);if(a.append(...l.monthFirst?[m,p]:[p,m]),n.year!=="none"){let f=b(r,"hp_y","Year","numeric",s==="-"?"":s);f.placeholder=n.year==="required"?"Year":"Year (optional)",f.autocomplete="bday-year",f.maxLength=4,a.append(f)}}else{let s=b(r,"hp_v",e.label,"none",i);s.type="date",s.min="1900-01-01",s.max="2100-12-31",a.append(s)}t.append(a)}function I(t,e){try{return new Intl.NumberFormat(e||void 0).format(t)}catch{return String(t)}}var q=(t,e,r)=>{let i=new Date(Date.UTC(t,e-1,r));return i.getUTCMonth()===e-1&&i.getUTCDate()===r};function P(t){let e=t.replace(/\s/g,""),r=e.lastIndexOf(","),i=e.lastIndexOf(".");return r>=0&&i>=0?r>i?e.replace(/\./g,"").replace(",","."):e.replace(/,/g,""):/^-?\d{1,3}(?:,\d{3})+$/.test(e)?e.replace(/,/g,""):e.replace(",",".")}function N(t,e,r=Date.now(),i=void 0){let o=e.format??{},n=u=>t.querySelector(`[name=${u}]`);if(e.type==="number"){let u=n("hp_v"),x=P(u.value);if(!x)return{value:null};let h=Number(x),v=R.exec(x);return v&&(v[1]?.replace(/0+$/,"").length??0)<=(o.decimals?2:0)&&Math.abs(h)<=z&&!(h<o.min||h>o.max)?{value:String(h===0?0:h)}:{error:`Enter a ${o.decimals?"":"whole "}number${o.min!=null&&o.max!=null?` from ${I(o.min,i)} to ${I(o.max,i)}`:""}.`,input:u}}let a=u=>({error:"Enter a real date.",input:u});if(o.kind!=="birthday"){let u=n("hp_v");return u.value?u.value>=u.min&&u.value<=u.max?{value:u.value}:a(u):{value:null}}let[s,c,d]=["hp_d","hp_m","hp_y"].map(n),l=d?.value.trim()??"";if(!s.value&&!c.value&&!l)return{value:null};if(!s.value||!c.value)return a(s.value?c:s);if(!l)return o.year==="required"||!q(2016,+c.value,+s.value)?a(d??s):{value:`--${c.value}-${s.value}`};let p=`${l}-${c.value}-${s.value}`,m=new Date(r).toISOString().slice(0,10),f=new Date(r+864e5).toISOString().slice(0,10),g=`${+m.slice(0,4)-U}${m.slice(4)}`;return/^\d{4}$/.test(l)&&q(+l,+c.value,+s.value)&&p<=f&&p>=g?{value:p}:a(d)}var W=`.cd{display:contents}
1
+ (()=>{function v(t,e,r,i){let o=t.lastChild,n=e.daily&&(()=>i?.find?.(l=>l>Date.now())||0),a=n||"ends_at"in e,s=n?n():"ends_at"in e?Date.parse(e.ends_at):Date.now()+Math.max(0,Number(e.minutes)||0)*6e4,c=()=>{n&&s<=Date.now()&&(s=n());let l=Math.max(0,s-Date.now())||0,p=Math.floor(l/864e5);o.textContent=`${p?`${p}d `:""}${new Date(l).toISOString().slice(l<36e5?14:11,19)}`,t.hidden=!l&&a&&!r,!l&&!(n&&s)&&clearInterval(d)},d=setInterval(c,1e3);return c(),()=>clearInterval(d)}var y=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);function w(t,e,r,i,o){let n=t("select","i");n.setAttribute("aria-label",e);for(let[a,s]of[["",r],...i]){let c=t("option","",s);c.value=a,c.selected=a===o,n.append(c)}return n}var S=t=>(t.options??[]).filter(e=>y(e)&&typeof e.value=="string");function $(t,e,r,i,o){let n=t("input");return n.type=o,n.name=`q_${e.key}`,n.value=r.value,n.checked=i.includes(r.value),n}var A=t=>{let e=t.options.length;return e<=4?e:e%4?3:4};var M=t=>String(t).padStart(2,"0"),U=120,R=/^-?\d{1,10}(?:\.(\d{1,10}))?$/,z=1e9;function L(t){try{let e=new Intl.DateTimeFormat(t,{month:"long",timeZone:"UTC"});return{name:r=>e.format(Date.UTC(2016,r-1,1)),monthFirst:new Intl.DateTimeFormat(t,{month:"numeric",day:"numeric"}).formatToParts(0).find(r=>r.type!=="literal")?.type==="month"}}catch{return{name:String,monthFirst:!1}}}var D=(t,e,r,i,o,n)=>{let a=w(t,r,r,Array.from({length:i},(s,c)=>[M(c+1),o(c+1)]),n);return a.name=e,a};function b(t,e,r,i,o){let n=t("input","i");return n.name=e,n.inputMode=i,n.setAttribute("aria-label",r),n.value=o??"",n}function E(t,e,r,i,o){let n=e.format??{},a=r("div",n.kind==="birthday"?"ph bd":"ph");if(e.type==="number")a.append(b(r,"hp_v",e.label,n.decimals?"decimal":"numeric",i)),n.unit&&a.append(r("span","u",n.unit));else if(n.kind==="birthday"){let[,s,c,d]=/^(\d{4}|-)-(\d\d)-(\d\d)$/.exec(i??"")??[],l=L(o||void 0),p=D(r,"hp_d","Day",31,String,d),m=D(r,"hp_m","Month",12,l.name,c);if(a.append(...l.monthFirst?[m,p]:[p,m]),n.year!=="none"){let f=b(r,"hp_y","Year","numeric",s==="-"?"":s);f.placeholder=n.year==="required"?"Year":"Year (optional)",f.autocomplete="bday-year",f.maxLength=4,a.append(f)}}else{let s=b(r,"hp_v",e.label,"none",i);s.type="date",s.min="1900-01-01",s.max="2100-12-31",a.append(s)}t.append(a)}function I(t,e){try{return new Intl.NumberFormat(e||void 0).format(t)}catch{return String(t)}}var q=(t,e,r)=>{let i=new Date(Date.UTC(t,e-1,r));return i.getUTCMonth()===e-1&&i.getUTCDate()===r};function P(t){let e=t.replace(/\s/g,""),r=e.lastIndexOf(","),i=e.lastIndexOf(".");return r>=0&&i>=0?r>i?e.replace(/\./g,"").replace(",","."):e.replace(/,/g,""):/^-?\d{1,3}(?:,\d{3})+$/.test(e)?e.replace(/,/g,""):e.replace(",",".")}function C(t,e,r=Date.now(),i=void 0){let o=e.format??{},n=u=>t.querySelector(`[name=${u}]`);if(e.type==="number"){let u=n("hp_v"),x=P(u.value);if(!x)return{value:null};let h=Number(x),_=R.exec(x);return _&&(_[1]?.replace(/0+$/,"").length??0)<=(o.decimals?2:0)&&Math.abs(h)<=z&&!(h<o.min||h>o.max)?{value:String(h===0?0:h)}:{error:`Enter a ${o.decimals?"":"whole "}number${o.min!=null&&o.max!=null?` from ${I(o.min,i)} to ${I(o.max,i)}`:""}.`,input:u}}let a=u=>({error:"Enter a real date.",input:u});if(o.kind!=="birthday"){let u=n("hp_v");return u.value?u.value>=u.min&&u.value<=u.max?{value:u.value}:a(u):{value:null}}let[s,c,d]=["hp_d","hp_m","hp_y"].map(n),l=d?.value.trim()??"";if(!s.value&&!c.value&&!l)return{value:null};if(!s.value||!c.value)return a(s.value?c:s);if(!l)return o.year==="required"||!q(2016,+c.value,+s.value)?a(d??s):{value:`--${c.value}-${s.value}`};let p=`${l}-${c.value}-${s.value}`,m=new Date(r).toISOString().slice(0,10),f=new Date(r+864e5).toISOString().slice(0,10),g=`${+m.slice(0,4)-U}${m.slice(4)}`;return/^\d{4}$/.test(l)&&q(+l,+c.value,+s.value)&&p<=f&&p>=g?{value:p}:a(d)}var k=`.cd{display:contents}
2
2
  .cd>.x-md{color:var(--mu)}
3
3
  .tm{font-size:40px;line-height:1;font-weight:800;letter-spacing:.02em;font-variant-numeric:tabular-nums;text-align:center}
4
4
  .qw{container-type:inline-size;width:100%}
@@ -12,4 +12,4 @@
12
12
  .qk :checked~.qf{box-shadow:0 0 0 2px var(--b),0 0 0 4px var(--a)}
13
13
  .qk :checked~.qf::after{content:"\u2713";position:absolute;top:8px;right:8px;display:grid;place-content:center;width:26px;height:26px;border-radius:50%;background:var(--a);color:var(--ot);font:700 15px/1 sans-serif}
14
14
  .ql{font-size:15px;font-weight:600;line-height:1.3;text-align:center}
15
- @media (prefers-reduced-motion:reduce){.qi{transition:none}}`,O=new WeakSet;function C(t,e){if(O.has(t))return;O.add(t);let r=e("style");r.textContent=W,t.append(r)}function T(t,e,r,i,o){C(t.getRootNode(),i),e.label&&t.append(i("p","x-md",e.label));let n=i("p","tm");return n.setAttribute("role","timer"),t.append(n),_(t,e,r,o)}function F(t,e,r,i,o,n,a){let{pictures:s}=r,c=S(e);C(a,i);let d=i("div","qc");d.style.setProperty("--n",String(A(e)));let l=i("div","qw");l.append(d);for(let p of c){let m=i("span","qf"),f=y(s)?s[p.value]:null,g=y(f)&&n(f);g&&m.append(g);let u=i("label","qk");u.append($(i,e,p,o,"radio"),m,i("span","ql",p.label??p.value)),d.append(u)}t.append(l)}window[Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.answers")]={answerCards:F,answerFields:E,answerOf:N,countdown:T};})();
15
+ @media (prefers-reduced-motion:reduce){.qi{transition:none}}`,O=new WeakSet;function N(t,e){if(O.has(t))return;O.add(t);let r=e("style");r.textContent=k,t.append(r)}function T(t,e,r,i,o){N(t.getRootNode(),i),e.label&&t.append(i("p","x-md",e.label));let n=i("p","tm");return n.setAttribute("role","timer"),t.append(n),v(t,e,r,o)}function F(t,e,r,i,o,n,a){let{pictures:s}=r,c=S(e);N(a,i);let d=i("div","qc");d.style.setProperty("--n",String(A(e)));let l=i("div","qw");l.append(d);for(let p of c){let m=i("span","qf"),f=y(s)?s[p.value]:null,g=y(f)&&n(f);g&&m.append(g);let u=i("label","qk");u.append($(i,e,p,o,"radio"),m,i("span","ql",p.label??p.value)),d.append(u)}t.append(l)}window[Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.answers")]={answerCards:F,answerFields:E,answerOf:C,countdown:T};})();
@@ -1 +1 @@
1
- (()=>{var w=["source","medium","campaign","content","term"];var d=e=>String(e).trim().toLowerCase();function f(e,t,n){let i=d(e),o=d(n);return t==="is"?i===o:t==="contains"&&o!==""&&i.includes(o)}function S(e){return e.trim().toLowerCase().replace(/\s*\/\s*/g,"/").replace(/^\/+|\/+$/g,"")}var O={gte:(e,t)=>e>=t,greater_than_or_equal:(e,t)=>e>=t,">=":(e,t)=>e>=t,lte:(e,t)=>e<=t,less_than_or_equal:(e,t)=>e<=t,"<=":(e,t)=>e<=t,eq:(e,t)=>e===t,equals:(e,t)=>e===t,"=":(e,t)=>e===t},p=e=>typeof e=="string",u=(e,t)=>p(t)&&f(e,"is",t),x={eq:u,equals:u,"=":u,neq:(e,t)=>p(t)&&!u(e,t),in:(e,t)=>Array.isArray(t)&&t.some(n=>u(e,n)),contains:(e,t)=>p(t)&&f(e,"contains",t)},g={in:(e,t)=>t.some(n=>e.includes(n)),not_in:(e,t)=>!t.some(n=>e.includes(n)),all:(e,t)=>t.every(n=>e.includes(n))},G=new Set([...Object.keys(O),...Object.keys(x),...Object.keys(g),"between"]);function m(e,t){let n=S(t);return n?e.filter(i=>i===n||i.startsWith(`${n}/`)).length:0}function A(e,t){return e.length===0?0:m(e,t)/e.length}var j={categoryViews:(e,t)=>m(e.recentCategories,t),categoryShare:(e,t)=>A(e.recentCategories,t),browseViews:(e,t)=>m(e.recentBrowse,t),browseShare:(e,t)=>A(e.recentBrowse,t)};function I(e,t){let n=e.indexOf(".");if(n>0){let o=e.slice(0,n),s=e.slice(n+1);if(o==="campaign"){let r=w.includes(s)?t.campaign?.[s]:null;return typeof r=="string"?r:null}if(o==="answer"){let{answers:r}=t;return!r||typeof r!="object"?null:Object.hasOwn(r,s)&&Array.isArray(r[s])?r[s]:[]}let c=j[o];return c&&s?c(t,s):null}let i=t[e];return typeof i=="number"?i:null}function v(e,t){let n=I(e.field,t);if(n===null)return!1;if(Array.isArray(n))return Array.isArray(e.value)&&e.value.length>0&&Object.hasOwn(g,e.operator)&&g[e.operator](n,e.value);if(typeof n=="string"){let o=x[e.operator];return o?o(n,e.value):!1}if(e.operator==="between")return typeof e.value=="number"&&typeof e.value2=="number"&&n>=e.value&&n<=e.value2;let i=O[e.operator];return!i||typeof e.value!="number"?!1:i(n,e.value)}function y(e,t){let n=e.rules??[];if(n.length===0)return!1;let i=new Map;for(let c of n){let r=c.group??0,a=i.get(r);a?a.push(c):i.set(r,[c])}let o=e.groupOperators??[],s=[];for(let[c,r]of i)s.push(o[c]==="OR"?r.some(a=>v(a,t)):r.every(a=>v(a,t)));return e.groupJoin==="OR"?s.some(Boolean):s.every(Boolean)}function _(e,t){return e.early===!0&&Array.isArray(e.answer_rules)&&typeof t?.answers=="object"&&y({...e,rules:[...e.rules??[],...e.answer_rules]},t)}function b(e,t){if(!Array.isArray(t))return e;let n=new Set(t),i=e.recentBrowseCategories??[],o=(e.recentBrowse??[]).filter((c,r)=>n.has(i[r])),s=Object.entries(e.listViewsByCategory??{}).reduce((c,[r,a])=>n.has(r)?c+a:c,0);return{...e,recentBrowse:o,listViews:s}}var N=100,T=128,q=e=>typeof e=="string"&&e!==""&&e.length<=T,l=new WeakMap;function h(e){if(!l.has(e)){let t=e.datafile().then(n=>n.status===200?n.body:null).catch(()=>null);l.set(e,t),t.then(n=>{!n&&l.get(e)===t&&l.delete(e)})}return l.get(e)}async function E(e,t,n=[],i=[]){let o=await h(e),s=t?.(),c=Array.isArray(o?.session_audiences)?o.session_audiences:[],r=o&&s?M(o,s):[],a=R([...r,...i],n,c),C=o&&s?M(o,s,_):[];return{claims:a,answered:R(C,n,c)}}function R(e,t,n){let i=new Map(n.map(r=>[r?.slug,Array.isArray(r?.requires)?r.requires:[]])),o=new Set,s=r=>{if(!o.has(r)){o.add(r);for(let a of i.get(r)??[])s(a)}};for(let r of t)s(r);let c=[...new Set(e.filter(q))];return[...c.filter(r=>o.has(r)),...c.filter(r=>!o.has(r))].slice(0,N)}function M(e,t,n=y){let i=Array.isArray(e?.session_audiences)?e.session_audiences:[],o=b(t,e.browse_categories??null);return i.filter(s=>q(s?.slug)&&n(s,o)).map(s=>s.slug)}window[Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.audiences")]={prefetch:h,visitAudiences:E};})();
1
+ (()=>{var w=["source","medium","campaign","content","term"];var d=e=>String(e).trim().toLowerCase();function f(e,t,n){let i=d(e),o=d(n);return t==="is"?i===o:t==="contains"&&o!==""&&i.includes(o)}function S(e){return e.trim().toLowerCase().replace(/\s*\/\s*/g,"/").replace(/^\/+|\/+$/g,"")}var O={gte:(e,t)=>e>=t,greater_than_or_equal:(e,t)=>e>=t,">=":(e,t)=>e>=t,lte:(e,t)=>e<=t,less_than_or_equal:(e,t)=>e<=t,"<=":(e,t)=>e<=t,eq:(e,t)=>e===t,equals:(e,t)=>e===t,"=":(e,t)=>e===t},p=e=>typeof e=="string",u=(e,t)=>p(t)&&f(e,"is",t),b={eq:u,equals:u,"=":u,neq:(e,t)=>p(t)&&!u(e,t),in:(e,t)=>Array.isArray(t)&&t.some(n=>u(e,n)),contains:(e,t)=>p(t)&&f(e,"contains",t)},g={in:(e,t)=>t.some(n=>e.includes(n)),not_in:(e,t)=>!t.some(n=>e.includes(n)),all:(e,t)=>t.every(n=>e.includes(n))},G=new Set([...Object.keys(O),...Object.keys(b),...Object.keys(g),"between"]);function m(e,t){let n=S(t);return n?e.filter(i=>i===n||i.startsWith(`${n}/`)).length:0}function A(e,t){return e.length===0?0:m(e,t)/e.length}var j={categoryViews:(e,t)=>m(e.recentCategories,t),categoryShare:(e,t)=>A(e.recentCategories,t),browseViews:(e,t)=>m(e.recentBrowse,t),browseShare:(e,t)=>A(e.recentBrowse,t)};function I(e,t){let n=e.indexOf(".");if(n>0){let o=e.slice(0,n),s=e.slice(n+1);if(o==="campaign"){let r=w.includes(s)?t.campaign?.[s]:null;return typeof r=="string"?r:null}if(o==="answer"){let{answers:r}=t;return!r||typeof r!="object"?null:Object.hasOwn(r,s)&&Array.isArray(r[s])?r[s]:[]}let a=j[o];return a&&s?a(t,s):null}let i=e==="basketCodeCount"?t.basketCodes?.length:t[e];return typeof i=="number"?i:null}function v(e,t){let n=I(e.field,t);if(n===null)return!1;if(Array.isArray(n))return Array.isArray(e.value)&&e.value.length>0&&Object.hasOwn(g,e.operator)&&g[e.operator](n,e.value);if(typeof n=="string"){let o=b[e.operator];return o?o(n,e.value):!1}if(e.operator==="between")return typeof e.value=="number"&&typeof e.value2=="number"&&n>=e.value&&n<=e.value2;let i=O[e.operator];return!i||typeof e.value!="number"?!1:i(n,e.value)}function y(e,t){let n=e.rules??[];if(n.length===0)return!1;let i=new Map;for(let a of n){let r=a.group??0,c=i.get(r);c?c.push(a):i.set(r,[a])}let o=e.groupOperators??[],s=[];for(let[a,r]of i)s.push(o[a]==="OR"?r.some(c=>v(c,t)):r.every(c=>v(c,t)));return e.groupJoin==="OR"?s.some(Boolean):s.every(Boolean)}function x(e,t){return e.early===!0&&Array.isArray(e.answer_rules)&&typeof t?.answers=="object"&&y({...e,rules:[...e.rules??[],...e.answer_rules]},t)}function _(e,t){if(!Array.isArray(t))return e;let n=new Set(t),i=e.recentBrowseCategories??[],o=(e.recentBrowse??[]).filter((a,r)=>n.has(i[r])),s=Object.entries(e.listViewsByCategory??{}).reduce((a,[r,c])=>n.has(r)?a+c:a,0);return{...e,recentBrowse:o,listViews:s}}var N=100,T=128,M=e=>typeof e=="string"&&e!==""&&e.length<=T,l=new WeakMap;function h(e){if(!l.has(e)){let t=e.datafile().then(n=>n.status===200?n.body:null).catch(()=>null);l.set(e,t),t.then(n=>{!n&&l.get(e)===t&&l.delete(e)})}return l.get(e)}async function q(e,t,n=[],i=[]){let o=await h(e),s=t?.(),a=Array.isArray(o?.session_audiences)?o.session_audiences:[],r=o&&s?C(o,s):[],c=R([...r,...i],n,a),E=o&&s?C(o,s,x):[];return{claims:c,answered:R(E,n,a)}}function R(e,t,n){let i=new Map(n.map(r=>[r?.slug,Array.isArray(r?.requires)?r.requires:[]])),o=new Set,s=r=>{if(!o.has(r)){o.add(r);for(let c of i.get(r)??[])s(c)}};for(let r of t)s(r);let a=[...new Set(e.filter(M))];return[...a.filter(r=>o.has(r)),...a.filter(r=>!o.has(r))].slice(0,N)}function C(e,t,n=y){let i=Array.isArray(e?.session_audiences)?e.session_audiences:[],o=_(t,e.browse_categories??null);return i.filter(s=>M(s?.slug)&&n(s,o)).map(s=>s.slug)}window[Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.audiences")]={prefetch:h,visitAudiences:q};})();
@@ -19,4 +19,4 @@
19
19
  .ar+.ar{left:auto;right:-6px}
20
20
  .ar[aria-disabled=true]{opacity:.35;cursor:default}
21
21
  .mob .ar,.pr-f .ar{display:none}
22
- @media (prefers-reduced-motion:reduce){.pr-c ul{scroll-behavior:auto}}`,z=["left","center","right"];function q(t,e){let s=M(t,e);return s?n=>s.format(n):n=>n.toFixed(2)}function R(t,e,s){let{el:n}=s,c=D(e.served)?e.served:{},f=Number.isInteger(e.limit)?Math.min(Math.max(e.limit,1),12):4,a=(Array.isArray(c.products)?c.products:[]).filter(o=>D(o)&&typeof o.product_id=="string"&&T(o.url)).slice(0,f);if(a.length===0)return;let u=D(e.show)?e.show:{},l=e.layout==="grid";t.classList.add(l?"pr-g":"pr-c"),z.includes(e.align)&&t.classList.add(`a-${e.align}`),l||(t.setAttribute("role","region"),t.setAttribute("aria-label","Products"));let p=n("style");p.textContent=C;let d=n("ul");d.setAttribute("role","list");let g=(o,r)=>({product_id:o.product_id,...typeof o.name=="string"?{name:o.name}:{},...Number.isFinite(o.price)?{price:o.price}:{},position:r}),b=typeof c.recommendation_request_id=="string"&&!s.preview?s.client:null,x=new Map,y=c.recommendation_request_id,v=s.seen??new Set,_=null,A=()=>{clearTimeout(_),!(!b||v.has(y))&&(v.add(y),b.recommendationsViewed({recommendation_request_id:y,placement:c.placement||s.placement,strategy:c.strategy||c.recipe||e.source,recipe:c.recipe??null,algorithm_version:c.algorithm_version??null,products:a.map((o,r)=>g(o,r+1)),viewable:[...x.values()].sort((o,r)=>o.position-r.position)}))};for(let[o,r]of a.entries()){let S=o+1,L=n("li","pc");L.dataset.hpProduct=r.product_id,L.dataset.hpPosition=String(S);let h=n("a","pa"),I=typeof r.name=="string"?r.name:"",O=T(r.image);if(O){let m=n("img","pi");m.alt=u.name===!1?I:"",m.loading="lazy",m.decoding="async",m.src=O;let w=n("span","pf");w.append(m),h.append(w)}else h.append(n("span","pf e"));if(u.name!==!1&&h.append(n("span","pn",I)),u.price!==!1&&Number.isFinite(r.price)){let m=q(s.lang,r.currency),w=n("span","pp");if(w.append(n("span","",m(r.price))),Number.isFinite(r.compare_at_price)&&r.compare_at_price>r.price){let N=n("s","",m(r.compare_at_price));N.setAttribute("aria-label",`was ${m(r.compare_at_price)}`),w.append(" ",N)}h.append(w)}u.name===!1&&!O&&h.setAttribute("aria-label",I||r.product_id),typeof e.button=="string"&&e.button&&h.append(n("span","btn bs pb",e.button)),h.href=T(r.url),h.rel="noopener",h.addEventListener("click",m=>{if(s.preview)return m.preventDefault();A(),b?.productClicked({recommendation_request_id:c.recommendation_request_id,interaction:"navigate",products:[g(r,S)]}),s.engaged("click",void 0,{position:S,products:[g(r,S)]})}),L.append(h),d.append(L)}t.append(p,d);let i=l?null:U(t,d,n),E=b&&!v.has(y)&&$({selector:"[data-hp-product]",root:s.root,onViewable(o){let r=Number(o.dataset.hpPosition);return x.has(r)||x.set(r,{position:r,product_id:o.dataset.hpProduct,viewable_at:new Date().toISOString()}),_??(_=setTimeout(A,0)),!0}});return()=>{i?.disconnect(),E&&E()}}function U(t,e,s){let n=["Previous","Next"].map((u,l)=>{let p=s("button","ar",l?"\u203A":"\u2039");return p.type="button",p.setAttribute("aria-label",`${u} products`),p.addEventListener("click",()=>e.scrollBy({left:(l?1:-1)*e.clientWidth})),e.before(p),p}),c="",f=()=>{let u=e.scrollWidth-e.clientWidth,l=e.scrollLeft,p=e.firstElementChild?.offsetWidth??0,d=[u<2,l<2,l>u-2,p];`${d}`!==c&&(c=`${d}`,t.classList.toggle("pr-f",d[0]),t.style.setProperty("--ph",`${p}px`),n[0].setAttribute("aria-disabled",String(d[1])),n[1].setAttribute("aria-disabled",String(d[2])))};e.addEventListener("scroll",f,{passive:!0}),f();let a=globalThis.ResizeObserver&&new ResizeObserver(f);return a?.observe(e),a}window[Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.products")]={mountProducts:R};})();
22
+ @media (prefers-reduced-motion:reduce){.pr-c ul{scroll-behavior:auto}}`,z=["left","center","right"];function q(t,e){let s=M(t,e);return s?n=>s.format(n):n=>n.toFixed(2)}function R(t,e,s){let{el:n}=s,c=D(e.served)?e.served:{},f=Number.isInteger(e.limit)?Math.min(Math.max(e.limit,1),12):4,a=(Array.isArray(c.products)?c.products:[]).filter(o=>D(o)&&typeof o.product_id=="string"&&T(o.url)).slice(0,f);if(a.length===0)return;let u=D(e.show)?e.show:{},l=e.layout==="grid";t.classList.add(l?"pr-g":"pr-c"),z.includes(e.align)&&t.classList.add(`a-${e.align}`),l||(t.setAttribute("role","region"),t.setAttribute("aria-label","Products"));let p=n("style");p.textContent=C;let d=n("ul");d.setAttribute("role","list");let g=(o,r)=>({product_id:o.product_id,...typeof o.name=="string"?{name:o.name}:{},...Number.isFinite(o.price)?{price:o.price}:{},position:r}),b=typeof c.recommendation_request_id=="string"&&!s.preview?s.client:null,x=new Map,y=c.recommendation_request_id,v=s.seen??new Set,_=null,A=()=>{clearTimeout(_),!(!b||v.has(y))&&(v.add(y),b.recommendationsViewed({recommendation_request_id:y,placement:c.placement||s.placement,strategy:c.strategy||c.recipe||e.source,recipe:c.recipe??null,algorithm_version:c.algorithm_version??null,products:a.map((o,r)=>g(o,r+1)),viewable:[...x.values()].sort((o,r)=>o.position-r.position)}))};for(let[o,r]of a.entries()){let S=o+1,L=n("li","pc");L.dataset.hpProduct=r.product_id,L.dataset.hpPosition=String(S);let h=n("a","pa"),I=typeof r.name=="string"?r.name:"",O=T(r.image);if(O){let m=n("img","pi");m.alt=u.name===!1?I:"",m.loading="lazy",m.decoding="async",m.src=O;let w=n("span","pf");w.append(m),h.append(w)}else h.append(n("span","pf e"));if(u.name!==!1&&h.append(n("span","pn",I)),u.price!==!1&&Number.isFinite(r.price)){let m=q(s.lang,r.currency),w=n("span","pp");if(w.append(n("span","",m(r.price))),Number.isFinite(r.compare_at_price)&&r.compare_at_price>r.price){let N=n("s","",m(r.compare_at_price));N.setAttribute("aria-label",`was ${m(r.compare_at_price)}`),w.append(" ",N)}h.append(w)}u.name===!1&&!O&&h.setAttribute("aria-label",I||r.product_id),typeof e.button=="string"&&e.button&&h.append(n("span","btn bs pb",e.button)),h.href=T(r.url),h.rel="noopener",h.addEventListener("click",m=>{if(s.preview)return m.preventDefault();A(),b?.productClicked({recommendation_request_id:c.recommendation_request_id,interaction:"navigate",products:[g(r,S)]}),s.engaged("click",void 0,{position:S,products:[g(r,S)]})}),L.append(h),d.append(L)}t.append(p,d);let i=l?null:H(t,d,n),E=b&&!v.has(y)&&$({selector:"[data-hp-product]",root:s.root,onViewable(o){let r=Number(o.dataset.hpPosition);return x.has(r)||x.set(r,{position:r,product_id:o.dataset.hpProduct,viewable_at:new Date().toISOString()}),_??(_=setTimeout(A,0)),!0}});return()=>{i?.disconnect(),E&&E()}}function H(t,e,s){let n=["Previous","Next"].map((u,l)=>{let p=s("button","ar",l?"\u203A":"\u2039");return p.type="button",p.setAttribute("aria-label",`${u} products`),p.addEventListener("click",()=>e.scrollBy({left:(l?1:-1)*e.clientWidth})),e.before(p),p}),c="",f=()=>{let u=e.scrollWidth-e.clientWidth,l=e.scrollLeft,p=e.firstElementChild?.offsetWidth??0,d=[u<2,l<2,l>u-2,p];`${d}`!==c&&(c=`${d}`,t.classList.toggle("pr-f",d[0]),t.style.setProperty("--ph",`${p}px`),n[0].setAttribute("aria-disabled",String(d[1])),n[1].setAttribute("aria-disabled",String(d[2])))};e.addEventListener("scroll",f,{passive:!0}),f();let a=globalThis.ResizeObserver&&new ResizeObserver(f);return a?.observe(e),a}window[Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.products")]={mountProducts:R};})();