@thg-agentic/hyper-personalisation-web 3.31.0 → 3.32.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
@@ -516,8 +516,9 @@ itself: `import { startOnsite } from '@thg-agentic/hyper-personalisation-web/ons
516
516
  `startOnsite(client, options)`. On the CDN, `hp.min.js` loads `onsite.min.js` (and that loads
517
517
  `onsite-render.min.js` once a trigger fires, `onsite-wheel.min.js` for a wheel,
518
518
  `onsite-answers.min.js` for a date or number question, `onsite-products.min.js` for a products
519
- block, `onsite-audiences.min.js` for a form limited to audiences) from beside itself; a self-hosted
520
- copy keeps all six beside `hp.min.js`. The runtime watches triggers, caps and consent and asks for the
519
+ block, `onsite-audiences.min.js` for a form limited to audiences, `onsite-values.min.js` for a form
520
+ whose text has shopper values) from beside itself; a self-hosted copy keeps all seven beside
521
+ `hp.min.js`. The runtime watches triggers, caps and consent and asks for the
521
522
  decision; the renderer and its stylesheet are fetched only when a trigger fires, alongside the
522
523
  decision request, so a page whose forms never fire never downloads them. If the renderer cannot
523
524
  load, the form is not shown (`hp.onsite.debug()` says `the renderer did not load`) and the page goes
@@ -598,6 +599,23 @@ refused or withdrawn, at a sign-out and when another user signs in. Anywhere els
598
599
  audience is MIXED: met where the warehouse qualified the shopper on its answers and its visit rules
599
600
  hold, from the next profile update.
600
601
 
602
+ **Shopper values in text (3.32).** A heading or paragraph may hold a value node,
603
+ `{ v, fallback, format? }`, filled in the browser as a text node (never markup): trimmed, without
604
+ control or invisible characters, at most 60 characters with an ellipsis. `v` is one of
605
+ `basket_value` (the basket this visit, as a basket bar reads it, as money in the `Cart Updated`'s
606
+ own `currency`, else the client's), `basket_items` (the items its lines hold: each line's whole
607
+ `quantity`, a line without one or with a fractional one once, zero or less none), `first_name` (what the page gave, below) or `answer.<question>` (the label of the
608
+ shopper's answer in the form's language: one given in this form, else the one kept under
609
+ personalisation consent; none without it). `format.style` is `number`, `money`, `date`,
610
+ `relative` or `text`, formatted with `Intl` in the form's locale, and `format.plural`
611
+ (`{ one, other }`) follows a number with its word ("3 items"). A value the page does not know shows
612
+ its `fallback`; with the block's `missing: "hide"` the block is not shown instead. The page gives
613
+ what only it knows with `hp.onsite.values({ first_name: 'Alex' })` (or `startOnsite`'s `values`):
614
+ kept in the page's memory only, drawn as text, never sent, stored or logged; each call replaces the
615
+ last, `values({})` forgets it. The formatting is its own chunk (`onsite-values.min.js`), loaded
616
+ only for a form whose text has a value; if it does not load, the form is not shown
617
+ (`values-failed`). The public API serves such a form only to 3.32 or later.
618
+
601
619
  **Arrived from.** A form with `arrived_from` shows only to a visit that landed from a matching
602
620
  campaign: `[{ field, match, values }]`, `field` one of `source`, `medium`, `campaign`, `content`,
603
621
  `term` (the link's `utm_*` tags), `match` `is` or `contains`, compared trimmed and in any case.
@@ -624,6 +642,7 @@ URL's tags: the console's Preview on site link adds them. Click ids
624
642
  | `servingHost`, `gatewayHost` | Where decisions and claims go (default: the host the SDK was pointed at) and capture goes (default: where events go). |
625
643
  | `debug` | Log why each form did or did not show. Also on with `?hp_debug=onsite`. |
626
644
  | `settings` | Development and tests: these forms instead of the settings'. |
645
+ | `values` | What the page knows of the shopper for a form's text, `{ first_name }`, as `hp.onsite.values` (3.32). |
627
646
 
628
647
  `hp.onsite.debug()` returns each form's state and reasons (`armed`, `not eligible: per_session cap`,
629
648
  `held out`, `shown`, …), and since 3.29 a `code`, which stays the same across releases while the
@@ -635,9 +654,10 @@ on it, not on the reasons. `code` is always present, so a trace built by hand ne
635
654
  | `hp.onsite` | |
636
655
  |---|---|
637
656
  | `open(name)`, `show(name)` | Show a form now, past its trigger; resolves with whether it showed. `name` is a form's slot, else one of a form's `aliases` (the settings' names for it: `footer_signup` for the site's own sign-up button), matched exactly; a slot wins over an alias. A `manual` form, or one opened by an alias, shows each time (see above); any other keeps to its caps. From there it is that form, by its slot, in every event. |
638
- | `on(name, fn)` | `shown`, `submitted`, `apply`, `closed`, `held` or `nothing`, with `{ slot, arm, format }` (`nothing`: `{ slot, format, code }`); `submitted` and `apply` add `coupon` (`{ code, prize }` or `null`), `closed` adds `reason`. `held` is a held-out visitor whose trigger fired (a form the site opened says so by `open` resolving `false` instead), so a site replacing its own popup with HP's shows its own there and the holdout compares the two. `nothing` (since 3.29) is a covering form (any but `inline`) whose own trigger fired and for which HP will show nothing on this page view; the site shows its own there too. `code` says why: `decision-failed` (a network error, any status but 200, a 200 without a list of decisions, or no answer within 3 s), `no-creative`, `no-code` (a reminder with no code to remind of), `renderer-failed` or `products-failed` (the chunk did not load within 3 s), or `error` (the form failed while it was being opened). It comes at most 3.05 s after the trigger: the 50 ms in which forms that fire together compete, then one 3 s deadline they share; an answer after it is never shown, so the site needs no timer of its own. It is not said when another covering form that fired with it shows, or the visitor is held out (`held` is said instead); for a form the site opened (`open` resolves `false`); on a suppressed page (`suppress`: the site is keeping its own screen clear); when its caps, the gap between popups, the consent banner or a form already on screen keep it away; or for an empty basket, which is tried again when the basket changes. Of the forms that fire together, only the highest HP has nothing for says it: the slot whose place the site takes. Like a holdout, it spends the page view's allowance, so no other HP popup, sheet, bar or teaser follows it on that page view (a later trigger is `allowance-spent`; a form the shopper asks for, `manual` or by an alias, still opens). A form with prizes says `submitted` once, when its claim settles: with the code, or `null` if the claim failed. Returns a function that stops listening. A throwing listener is logged, never breaks the form. |
657
+ | `on(name, fn)` | `shown`, `submitted`, `apply`, `closed`, `held` or `nothing`, with `{ slot, arm, format }` (`nothing`: `{ slot, format, code }`); `submitted` and `apply` add `coupon` (`{ code, prize }` or `null`), `closed` adds `reason`. `held` is a held-out visitor whose trigger fired (a form the site opened says so by `open` resolving `false` instead), so a site replacing its own popup with HP's shows its own there and the holdout compares the two. `nothing` (since 3.29) is a covering form (any but `inline`) whose own trigger fired and for which HP will show nothing on this page view; the site shows its own there too. `code` says why: `decision-failed` (a network error, any status but 200, a 200 without a list of decisions, or no answer within 3 s), `no-creative`, `no-code` (a reminder with no code to remind of), `renderer-failed`, `products-failed` or `values-failed` (the chunk did not load within 3 s), or `error` (the form failed while it was being opened). It comes at most 3.05 s after the trigger: the 50 ms in which forms that fire together compete, then one 3 s deadline they share; an answer after it is never shown, so the site needs no timer of its own. It is not said when another covering form that fired with it shows, or the visitor is held out (`held` is said instead); for a form the site opened (`open` resolves `false`); on a suppressed page (`suppress`: the site is keeping its own screen clear); when its caps, the gap between popups, the consent banner or a form already on screen keep it away; or for an empty basket, which is tried again when the basket changes. Of the forms that fire together, only the highest HP has nothing for says it: the slot whose place the site takes. Like a holdout, it spends the page view's allowance, so no other HP popup, sheet, bar or teaser follows it on that page view (a later trigger is `allowance-spent`; a form the shopper asks for, `manual` or by an alias, still opens). A form with prizes says `submitted` once, when its claim settles: with the code, or `null` if the claim failed. Returns a function that stops listening. A throwing listener is logged, never breaks the form. |
639
658
  | `ready()` | Resolves once the page knows whether onsite forms run on it: each form's state, as `debug()`, once the runtime has started, or `[]` once none will (not opted in, no live form, the runtime failed to load). A site keeping its own popup where HP has none for the visitor reads it. |
640
659
  | `suppress(reason)`, `unsuppress(reason?)` | Take any form off the screen quietly (not a dismissal) and keep forms away while any reason holds; `unsuppress()` lifts all. |
660
+ | `values(given)` | What the page knows of the shopper for a form's text, `{ first_name }` (3.32): in memory only, never sent; each call replaces the last. |
641
661
 
642
662
  **Formats.** A `teaser` is a tab (its first step) that opens the rest as a popup; the tab is kept on
643
663
  the session's later pages until opened or dismissed, and never traps focus. A `bar` with a
@@ -651,7 +671,8 @@ image or muted, looping video media; see ADR 0064.
651
671
  **Preview.** `?hp_preview=<token>` asks `POST /v1/decisions` for the previewed version and counts
652
672
  nothing. For an editor, `import { mountPreview } from
653
673
  '@thg-agentic/hyper-personalisation-web/onsite/preview'`; `mountPreview(host, creative, { step,
654
- device: 'desktop' | 'mobile', consentText, smsConsentText, questions, prizes, basketValue })` draws the creative
674
+ device: 'desktop' | 'mobile', consentText, smsConsentText, questions, prizes, basketValue, values })`
675
+ draws the creative (with `values`, a returning shopper's sample values; without, every fallback)
655
676
  inside `host` with no request, event or counter, and returns `{ update(creative, options), destroy(),
656
677
  step() }`. It is not part of the runtime chunk.
657
678
 
@@ -714,7 +735,8 @@ each form did or did not show, and a preview link (`?hp_preview=`) counts nothin
714
735
  (about 15.7 KiB), so a page that shows a form loads about 22.3 KiB of onsite code and one whose
715
736
  forms never fire about 6.6 KiB; `onsite-wheel.min.js` under 8 KiB (about 1.8 KiB),
716
737
  `onsite-answers.min.js` under 2 KiB (about 1.5 KiB), `onsite-products.min.js` under 2.6 KiB (about
717
- 2.5 KiB), `onsite-audiences.min.js` under 1.63 KiB (about 1.61 KiB). The core carries only the loader.
738
+ 2.5 KiB), `onsite-audiences.min.js` under 1.63 KiB (about 1.61 KiB), `onsite-values.min.js` under
739
+ 1.5 KiB (about 1.35 KiB). The core carries only the loader.
718
740
 
719
741
  **Products in a form.** A creative's `products` block (ADR 0064 as amended 2026-11-02) is filled by
720
742
  the public API in the decision that serves the form, as the block's `served`. For a form whose
package/dist/hp.min.js CHANGED
@@ -1,3 +1,3 @@
1
- (()=>{var In=e=>{throw TypeError(e)};var Ao=(e,t,n)=>t.has(e)||In("Cannot "+n);var vn=(e,t,n)=>t.has(e)?In("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var L=(e,t,n)=>(Ao(e,t,"access private method"),n);var Ee=[];for(let e=2;Ee.length<64;e++)Ee.every(t=>e%t!==0)&&Ee.push(e);var En=e=>(e-Math.floor(e))*2**32>>>0,ko=Ee.slice(0,8).map(e=>En(Math.sqrt(e))),xo=Ee.map(e=>En(Math.cbrt(e))),Q=(e,t)=>e>>>t|e<<32-t;function Cn(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(ko),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],x=Q(k,7)^Q(k,18)^k>>>3,h=Q(b,17)^Q(b,19)^b>>>10;o[w]=o[w-16]+x+o[w-7]+h}let[i,c,u,d,f,p,m,I]=r;for(let w=0;w<64;w++){let k=Q(f,6)^Q(f,11)^Q(f,25),b=I+k+(f&p^~f&m)+xo[w]+o[w]|0,h=(Q(i,2)^Q(i,13)^Q(i,22))+(i&c^i&u^c&u)|0;[I,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,I].forEach((w,k)=>{r[k]+=w})}return Array.from(r,s=>s.toString(16).padStart(8,"0")).join("")}var vt=(e,t)=>e<<t|e>>>32-t;function On(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]:vt(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,I;p<20?(m=c&u|~c&d,I=1518500249):p<40?(m=c^u^d,I=1859775393):p<60?(m=c&u|c&d|u&d,I=2400959708):(m=c^u^d,I=3395469782);let w=vt(i,5)+m+f+I+r[p]|0;[f,d,u,c,i]=[d,u,vt(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 Io="e28e8ada-5b76-4209-bba9-79b823a0af75",vo=e=>Array.from(e,t=>t.toString(16).padStart(2,"0")).join("");function Pn(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=On(o).slice(0,16);s[6]=s[6]&15|80,s[8]=s[8]&63|128;let i=vo(s);return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}var ue=(e,t)=>typeof e=="string"&&e!==""&&e.length<=t?e:null;function He(e,t){return ue(e,64)??ue(t,256)}function Ln({sessionId:e,slot:t,arm:n}={}){let r=ue(e,256);return!r||!ue(t,256)||!ue(n,256)?null:Pn(Io,`${r}:${t}:${n}`)}var Eo="4b1f2c7e-9a3d-4e58-b6c1-2d7f0a9e8c53";function Tn({sessionId:e,surface:t}={}){let n=ue(e,256);return!n||!ue(t,64)?null:Pn(Eo,`${n}:${t}`)}var Co=Array.from({length:11},(e,t)=>t/10);function Oo(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 re(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(!Oo(O,r)){u.delete(_),f(_);continue}u.add(_),m()&&d(_)}},{threshold:Co}),m=()=>typeof document>"u"||document.visibilityState!=="hidden",I=()=>{if(m())for(let h of u)d(h);else for(let h of u)f(h)};document.addEventListener("visibilitychange",I);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})},x=s===document&&!document.body;return x?document.addEventListener("DOMContentLoaded",b,{once:!0}):b(),()=>{x&&document.removeEventListener("DOMContentLoaded",b),document.removeEventListener("visibilitychange",I),p?.disconnect(),k?.disconnect();for(let h of i.values())clearTimeout(h);i.clear(),u.clear()}}function Et(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 re({selector:n,root:s,visibleRatio:r,dwellMs:o,onViewable(i){let c=i.dataset?.hpExposure?.trim();return c&&e.surfaceViewed({surface:c}),!0}})}var Nn=e=>{try{return new URL(e,document.baseURI).toString()}catch{return e}};function Ct(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:Nn(b.url)}:{},...b.image_url?{image_url:Nn(b.image_url)}:{}}}catch{return null}},m=re({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 x=new Set,h=f(k).map(p).filter(O=>!O||x.has(O.product_id)?!1:(x.add(O.product_id),!0));return h.length===0||(c.add(b.list_id),e.productListViewed({...b,products:h})),!0}}),I=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",I,!0),()=>{document.removeEventListener("click",I,!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 Fe(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 Po(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 Ot(e,t={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{selector:n="[data-hp-promotion]",resolve:r=Po,visibleRatio:o=.5,dwellMs:s=1e3,root:i=document}=t,c=new Set,u=p=>{let m=Array.from(i.querySelectorAll(n)),I=m.indexOf(p);try{return r(p,I<0?m.length:I)}catch{return null}},d=re({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 I=m.closest(n),w=m.closest("a[href]");if(!I||!w||!I.contains(w)&&!w.contains(I))return;let k=u(I);k&&e.promotionClicked({...k,href:w.getAttribute("href")})};return document.addEventListener("click",f,!0),()=>{document.removeEventListener("click",f,!0),d()}}function Lo(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:Fe(e,"hpRecoBucket"),assignment_unit_kind:D(e,"hpRecoUnitKind"),candidate_set_fingerprint:D(e,"hpRecoFingerprint"),candidate_set_size:Fe(e,"hpRecoCandidates"),ranked_by:D(e,"hpRecoRankedBy"),served_at:D(e,"hpRecoServedAt")}}function To(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:Fe(e,"hpRecoPosition")??t+1}}function Pt(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=Lo,resolveTile:s=To,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}},I=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,P)=>m(s,y,P)).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,P)=>y.position-P.position);e.recommendationsViewed({...O,products:_,viewable:g})},b=re({selector:`${n} ${r}`,root:u,visibleRatio:i,dwellMs:c,onViewable(h){let O=I(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 P=f.get(g);P.has(y.position)||P.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}}),x=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]"),P=y&&(_.contains(y)||y.contains(_));if(!(g&&_.contains(g))&&!P)return;let N=I(_);if(!N)return;let V=m(o,N);if(!V)return;let G=m(s,_,w(N).indexOf(_));if(!G?.product_id)return;let F=V.recommendation_request_id;d.has(F)||(clearTimeout(p.get(F)),k(N,V)),e.productClicked({recommendation_request_id:V.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 _e=new Set(["home","list","product","search","basket","checkout","order_confirmation","login","register","account","info","blog","other"]),No=new Set(["products"]),Rn=e=>e==null;function Lt(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=>Lt(r,t)):Object.fromEntries(Object.entries(e).filter(([,r])=>!Rn(r)).map(([r,o])=>[r,Lt(o,t)]));return t.delete(e),n}function Tt(e){if(!e)return e;let t=Lt(e);for(let n of No)n in e&&Rn(e[n])&&(t[n]=e[n]);return t}function Mn(){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 Ro=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 Ro.has(t.toLowerCase())?null:t}var Ce=e=>typeof e=="string"&&e!==""?e:null;function oe(){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 Dn="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 Mo={gclid:"gclid",fbclid:"fbclid",ttclid:"ttclid"},Do=/[a-z0-9._%+-]+@[a-z0-9-]+(\.[a-z0-9-]+)*\.[a-z]{2,}/i,Uo=/\d(?:[ -]?\d){12,}/,Vo=new Set(["gclid","fbclid","ttclid","msclkid"]);function Vn(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=!Vo.has(String(t).toLowerCase());return n.some(o=>Do.test(o)||r&&Uo.test(o))}function Rt(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(Mo)]){let i=t.get(o);i&&!Vn(i,o)&&(n[s]=i)}return Object.keys(n).length?n:null}var $o=["email","e-mail","password","pass","pwd","token","auth","code","uid","customer_id","postcode","zip","phone","applyCode"],Bo=["email","password","passwd","pwd","token","secret","auth","session","phone","postcode","zip","address","birth","card","cvv","iban","ssn","customerid","userid"],jo=["tel","uid","dob"],qo=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","fbclid","ttclid","msclkid"],Ho=new Set($o.map(e=>e.toLowerCase()));function Fo(e){let t=String(e).toLowerCase();if(Ho.has(t))return!0;let n=t.replace(/[-_.]/g,"");return Bo.some(o=>n.includes(o))?!0:String(e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).some(o=>jo.includes(o))}function Nt(e){return(e??[]).map(t=>{try{return new RegExp(`^${t}$`,"i")}catch{return{test:n=>n.toLowerCase()===String(t).toLowerCase()}}})}function $n(e,t={}){if(!e)return null;try{let n=new URLSearchParams(e),r=t.queryParamAllowlist?Nt([...t.queryParamAllowlist,...qo]):null,o=Nt(t.queryParamBlocklist),s=Nt(t.sensitiveParamAllowlist);for(let c of new Set(n.keys()))(Fo(c)&&!s.some(d=>d.test(c))||n.getAll(c).some(d=>Vn(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 Bn(e,t,n={}){if(!e)return null;try{let r=new URL(e);return t&&r.origin===t?r.origin+r.pathname+($n(r.search,n)??""):r.origin+r.pathname}catch{return null}}function Mt(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:Bn(n.href,location.origin,t)}catch{return null}}function Dt(e){if(typeof e!="string")return null;let t=e.trim().toUpperCase();return/^[A-Z]{3}$/.test(t)?t:null}function Un(e){if(typeof e!="string")return null;let t=e.trim().toUpperCase();return/^[A-Z]{2}$/.test(t)?t:null}function Ut(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 M(e,t){if(typeof e=="function")try{let n=e();if(n!=null)return n}catch{}return t}function Ko(e){return{...e.propertyId==null?{}:{property_id:String(e.propertyId)},channel:e.channel??null,market:e.market??null,environment:e.environment??null}}function Go(e){let t=typeof window<"u"?window.location:null,n=t?$n(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"?Bn(document.referrer,t?.origin,e):null,title:typeof document<"u"&&document.title||null,type:e.pageType??null}}var Oe;function zo(){if(Oe!==void 0)return Oe;try{Oe=globalThis.Temporal?.Now?.timeZoneId?.()||Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{Oe=null}return Oe}function jn(e,t={}){let n=typeof window<"u"?window.location:null,r={library:{name:e.libraryName,version:e.libraryVersion},spec:{version:Dn},source:Ko(e),session_id:M(e.getSessionId,null),identity_trust:H(M(e.getAnonymousId,null))?"device":"none",page:Go(e),campaign:n?Rt(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:Dt(M(e.getCurrency,e.currency)),locale:Ut(M(e.getLocale,e.locale)),timezone:zo(),country:Un(e.country),ship_to_country:Un(M(e.getShipToCountry,e.shipToCountry)),ip:null,bot:null,consent:e.getConsent?.()??null,experiments:M(e.getExperiments,null),audiences:M(e.getAudiences,null),decisions:M(e.getDecisions,null),recommendations:M(e.getRecommendations,null),extensions:M(e.getExtensions,null)};return qn(r,t)}function qn(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]=qn(e[r],o):o!==void 0&&(n[r]=o);return n}var fe=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"}),Jo={retry:"cdp.retry",sessionSignals:"cdp_session_signals",identified:"cdp_identified",previousPage:"cdp_prev_page_message_id"},Ke={...fe},Hn=!1;function Ge(e){let t={...fe};for(let[n,r]of Object.entries(e??{})){if(!(n in fe))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}Ke=t}function C(e){return Ke[e]}var Wo="_",Fn=e=>e==null||e===""?Wo:String(e);function U(e,t,n){let r=`${e}:${Fn(t)}`;return n==null||n===""?r:`${r}:${n}`}function Kn(e,t){return`${e}:${Fn(t)}:`}function ze(e){let t=`${Ke[e]}:`;try{for(let n of Object.keys(localStorage))n.startsWith(t)&&localStorage.removeItem(n)}catch{}}function Je(){if(!Hn){Hn=!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(Jo)){if(n!==o&&!n.startsWith(`${o}:`))continue;let s=Ke[r]+n.slice(o.length);t.getItem(s)===null&&t.setItem(s,t.getItem(n)),t.removeItem(n)}}catch{}}}}var $t=1800*1e3,We=()=>{try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}},Vt=()=>{try{return typeof localStorage>"u"?null:localStorage}catch{return null}};function Gn(e,t=()=>Date.now()){return{read(){try{let n=We()?.getItem(e),r=n?JSON.parse(n):null;return!r||t()-r.savedAt>$t?(r&&We()?.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?We()?.removeItem(e):We()?.setItem(e,JSON.stringify({savedAt:t(),items:n,anonymousId:r}))}catch{}}}}var Xo=400*24*60*60;function se(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 Yo({name:e,domain:t=null,legacyKey:n,read:r,mint:o,mayStore:s,carried:i=null}){let c=null;try{c=Vt()?.getItem(n)||null}catch{c=null}let u=r(e)??c??i,d=!1,f=()=>{if(!(d||u===null||!s())&&(d=se(e,u,Xo,t),!(!d||c===null)))try{Vt()?.removeItem(n),c=null}catch{}};return{get(){return u??(u=o()),f(),u},peek:()=>u,persist:f,forget(){se(e,"",0,t),u=null,d=!1;try{Vt()?.removeItem(n)}catch{}c=null}}}function zn(e,{carried:t=null,mayStore:n,orOwn:r=!1}){let o=e.anonymousIdSource,s=()=>Yo({name:C("anonymousId"),domain:e.consentCookieDomain??null,legacyKey:U(C("anonymousId"),e.propertyId),read:j,mint:oe,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(M(i,null))??c.get(),c}var Zo=200;function Jn(e,t,n=()=>Date.now()){let r=()=>U(C("carried"),e),o=!1;function s(){try{let i=JSON.parse(sessionStorage.getItem(r())??"null");return!i||!(n()-i.savedAt<=$t)?[]: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(-Zo)})),!0)}catch{return!1}},close(){o=!0}}}var Oa=fe.consent,Xe=Object.freeze({visitor:"visitor",host:"host"}),Xn=()=>({basis:Xe.host}),Qo="hp-consent",pe=["analytics","marketing","personalisation","ad_user_data","ad_personalization"],Yn={analytics:"a",marketing:"m",personalisation:"p",ad_user_data:"aud",ad_personalization:"adp"},ne=()=>typeof window<"u",Zn=()=>ne()&&typeof window.cookieStore?.addEventListener=="function",es=e=>e===!0?!0:e===!1?!1:null;function be(e){if(!e||typeof e!="object")return null;let t={};for(let n of pe)t[n]=es(e[n]);return t}function Bt(e,t){return!e||!t?e===t:pe.every(n=>e[n]===t[n])}function jt(e){if(!e)return"";let t=[];for(let n of pe){let r=e[n];(r===!0||r===!1)&&t.push(`${Yn[n]}=${r?1:0}`)}return t.join("&")}function qt(e){return{[Qo]:jt(be(e))}}function Pe(e){let t=be({});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(Yn).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 Ht(e,t){if(!t)return e;let n=r=>{if(!r)return r;let o={...r};for(let s of pe)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 Ft(e,t={}){return{...e,ad_user_data:t.ad_user_data??e.marketing,ad_personalization:t.ad_personalization??e.marketing}}function Ye(e,t){let n=!0;return{notify:()=>{if(n)try{let o=e();o&&t(o)}catch{}},stop:()=>n=!1}}var ts={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 ns(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 Qn(e={}){let t={...ts,...e.purposes};function n(){let r=ne()?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=>ns(o,t[i]);return Ft({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(!ne())return()=>{};let o=Ye(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 Wn(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 er(e={}){let t={analytics:"C0002",personalisation:"C0003",marketing:"C0004",...e.groups},n=e.impliedConsent===!0;function r(){let i=Wn(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=ne()?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(ne()&&window.OneTrust?.IsAlertBoxClosed?.()===!0)return!0}catch{}return n&&ne()&&(!!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=Ft({analytics:c("analytics"),marketing:c("marketing"),personalisation:c("personalisation")},{ad_user_data:c("ad_user_data"),ad_personalization:c("ad_personalization")}),d=Wn(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(!ne())return()=>{};let c=Ye(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 rs(e){let t=String(e).split(",").map(n=>n.trim()).filter(Boolean);return t.length?new Set(t):null}function tr(e){let{name:t,categories:n,parse:r=rs,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 Ft({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 Zn()},subscribe(u){if(!ne())return()=>{};let d=Ye(c,u),f=p=>{[...p.changed??[],...p.deleted??[]].some(I=>I?.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 nr(e={}){let t=e.name??C("consent"),n=()=>{let r=j(t);if(r==null)return null;let o=Pe(r);return o.analytics==null?null:o};return{name:"forwarded",read:n,get observesChanges(){return Zn()},subscribe(r){if(!ne())return()=>{};let o=Ye(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 rr(e){let t=be(e);return{name:"static",basis:Xe.host,read:()=>t?{...t}:null,observesChanges:!0,subscribe:()=>()=>{}}}function or(e){if(e==null)return null;let t=String(e).split("/").map(n=>n.trim()).filter(Boolean).join("/");return t===""?null:t}function os(e){let t=e.item_category;if(t!=null&&String(t).includes("/"))return or(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 or(n.join("/"))}var ss=e=>{if(e==null||typeof e=="object")return null;let t=String(e).trim();return t===""?null:t};function is(...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 Ze=e=>is(e.item_group_id,e.item_id);function as(e,t=Ze){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=ss;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:os(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 Kt(e,t=Ze){return(e??[]).map(n=>as(n,t)).filter(n=>n?.product_id)}var cs=1e3,us={shipping:2,payment:3},ls=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},ds=e=>{if(e==null||e===""||typeof e=="object")return null;let t=Number(e);return Number.isFinite(t)&&t>=0?t:null},Qe=e=>e!==null&&typeof e=="object";function fs(e){return Array.isArray(e.items)?e.items.filter(Qe):null}function sr(e){let t=q(e)?.toLowerCase().replace(/[\s-]+/g,"_");return t?ls.has(t)?t:t==="email"||t==="email_password"?"password":"other":null}function ps({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 ir=({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),me=(e,t)=>t.products?.length?{event:e,properties:t}:null,ms=new Set(["product","products","item","items"]);function hs({ecommerce:e}){let t=q(e.item_id),n=q(e.content_type)?.toLowerCase();return!t||n&&!ms.has(n)?null:{event:"Product Shared",properties:{share_via:q(e.method),products:[{product_id:t}]}}}function gs(e){let t=o=>me("Product List Viewed",{list_id:ir(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=>me("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=>me("Product Clicked",{list_id:ir(o),products:o.products.slice(0,1)}),add_to_cart:o=>me("Product Added",{cart_id:q(o.ecommerce.cart_id),products:o.products}),remove_from_cart:o=>me("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=>me("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=>me("Product Added to Wishlist",{products:o.products}),share:hs,login:o=>({event:"Signed In",properties:{method:sr(o.ecommerce.method)}}),sign_up:o=>({event:"Signed Up",properties:{method:sr(o.ecommerce.method)}})}}var ys=e=>e.event;function ws(e,t){if(!Qe(e))return null;if(typeof e.length=="number"&&e[0]==="event"&&typeof e[1]=="string"){let r=Qe(e[2])?e[2]:{};return{name:e[1],entry:r,ecommerce:r}}let n=q(t(e));return n?{name:n,entry:e,ecommerce:Qe(e.ecommerce)?e.ecommerce:e}:null}function Gt(e){return Array.isArray(e)?`[${e.map(Gt).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${Gt(e[t])}`).join(",")}}`:JSON.stringify(e??null)}function ar(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=gs({...us,...t.steps}),o=t.map??{},s=t.eventName??ys,i=t.productId??Ze,c=new Set(["purchase","refund",...t.ignore??[]]),u=t.dedupeMs??cs,d=new Map,f=!0;function p(_,g,y){if(u<=0)return!1;let P=`${_}|${y??""}|${Gt(g)}`,N=Date.now();for(let[V,G]of d)N-G>u&&d.delete(V);return d.has(P)?!0:(d.set(P,N),!1)}let m=null,I=new Set;function w(_,g){if(_!=="Product Viewed")return!1;let y=typeof location>"u"?"":location.pathname;y!==m&&(m=y,I.clear());let P=g.products?.[0]?.product_id;return P?I.has(P)?!0:(I.add(P),!1):!1}function k({event:_,properties:g={}},y){if(!_||p(_,g,y)||w(_,g))return;let P=y?{context:{currency:y}}:void 0;if(_==="Signed Out"&&typeof e.signedOut=="function"){e.signedOut(P);return}e.track(_,g,P)}function b(_){let g=t.transform?t.transform(_):_,y=ws(g,s);if(!y||c.has(y.name))return;let P=Object.hasOwn(o,y.name),N=P?o[y.name]:r[y.name];if(typeof N!="function")return;let V=fs(y.ecommerce),G=V??[],F={...y,items:G,itemsListed:V!==null,products:Kt(G,i),currency:Dt(y.ecommerce.currency),value:ds(y.ecommerce.value)};F.promotions=ps(F);let ee=P?N(g,{...F,toProducts:W=>Kt(W,i)}):N(F);for(let W of[ee].flat())W&&k(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 O(..._){let g=h.apply(this,_);for(let y of _)x(y);return g}return n.push=O,()=>{f=!1,n.push===O&&(n.push=h)}}var Ss="hp_debug",_s=256;function bs(){try{return new URLSearchParams(location.search).get(Ss)}catch{return null}}function cr(e,t){if(typeof location>"u")return!1;try{let n=bs();if(n!==null){let o=n.trim();o===""||o.length>_s?sessionStorage.removeItem(t):sessionStorage.setItem(t,o)}let r=sessionStorage.getItem(t);return!!(e&&r&&Cn(r)===e)}catch{return!1}}var Ae=class extends Error{},As={inHoldout:()=>!0,personalisationGroup:()=>"excluded",servingHeaders:()=>({}),recommendationContext:()=>({}),flush:()=>Promise.resolve(),reset:()=>{}};function zt(e,t){let n=As[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 Ae)throw i;return r(i)}}}function ur(e){for(let t of Reflect.ownKeys(e)){let{value:n}=Object.getOwnPropertyDescriptor(e,t)??{};typeof n=="function"&&(e[t]=zt(t,n))}return e}var Le=Symbol("hp.identityOption");var ks=2160*60*60*1e3,xs=50,Is=20,vs=128,Jt=e=>U(C("answers"),e),tt=e=>typeof e=="string"&&e!==""&&e.length<=vs;function lr(e,t){try{let n=JSON.parse(localStorage.getItem(Jt(e)));return Array.isArray(n)?n.filter(r=>tt(r?.q)&&Array.isArray(r.v)&&r.v.every(tt)&&t-r.at<ks):[]}catch{return[]}}function dr(e,t=Date.now()){return Object.fromEntries(lr(e,t).map(n=>[n.q,n.v]))}function fr(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 pr(e,t,n=Date.now()){let r=(Array.isArray(t)?t:[]).filter(i=>tt(i?.question)&&Array.isArray(i.values));if(!r.length)return;let o=new Set(r.map(i=>i.question)),s=[...lr(e,n).filter(i=>!o.has(i.q)),...r.map(i=>({q:i.question,v:i.values.filter(tt).slice(0,Is),at:n}))].slice(-xs);try{et.delete(e),localStorage.setItem(Jt(e),JSON.stringify(s))}catch{}}var et=new Set;function mr(e){if(e===void 0)ze("answers"),et.clear();else if(!et.has(e)){try{localStorage.removeItem(Jt(e))}catch{}et.add(e)}}var Es=4320*60*60,Cs=100,Os=1e3,Ps=2e3,hr=500,nt=e=>(e?.unref?.(),e);function Ls(e,t){if(t?.analytics===!0&&e.analytics===!1)return"withdrawn";let n=pe.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 Ts(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}=${jt(e)}; Path=/; Max-Age=${Es}; SameSite=Lax`+o+r}catch{}}function Ns(e){let t=Pe(j(e));return pe.some(n=>t[n]!==null)?t:null}function gr(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,I=!1,w=null,k=[],b=R=>{u=R,e.onStatus?.(R)};function x(){try{return be(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(){I||m||d===null||_()||O()&&document.visibilityState==="hidden"||(m=nt(setInterval(()=>F(x()),Ps)))}let P=()=>u==="pending"||u==="unknown",N=e.store??null,V=()=>{let R=k.splice(0);N?.write([]);for(let K of R)s(K)},G=()=>{let R=k.splice(0);N?.write([]);for(let K of R)c(K)};function F(R){let K=be(R);if(!K||K.analytics===null)return;let X=d===null,Y=X?Ns(o):d;if(!X&&Bt(Y,K))return;h(),d=K,y(),Ts(K,r,o);let ve=!Bt(Y,K);if(K.analytics){b("granted"),V(),ve&&i({action:Ls(K,Y),state:K,previous:Y,withdrawal:!1});return}G(),Y?.analytics===!0&&i({action:"withdrawn",state:K,previous:Y,withdrawal:!0}),b("denied")}function ee(){p=null,u==="pending"&&(b("unknown"),f&&clearInterval(f),f=nt(setInterval(()=>F(x()),Os)))}function W(R){if(P()){if(N){N.write(k);return}R?.type!=="visibilitychange"&&!R?.persisted&&G()}}let Se=R=>{document.visibilityState==="hidden"?(g(),W(R)):y()},je=R=>{g(),W(R)},ce=R=>{R?.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??Xe.visitor}:null},admits(){return u==="granted"},hold(R){return!P()||k.length>=hr?(c(R),!1):(k.push(R),!0)},onHidden:W,start(){I=!1;try{w=t.subscribe?.(R=>F(R))??null}catch(R){e.debug&&console.warn("[hp] consent adapter subscribe failed",R)}O()&&(window.addEventListener("pagehide",je),window.addEventListener("pageshow",ce),document.addEventListener("visibilitychange",Se)),N&&k.length===0&&k.push(...N.read().slice(-hr)),F(x()),!d&&(f=nt(setInterval(()=>F(x()),Cs)),p=nt(setTimeout(ee,n)))},stop(){I=!0,h(),g(),typeof w=="function"&&w(),O()&&(window.removeEventListener("pagehide",je),window.removeEventListener("pageshow",ce),document.removeEventListener("visibilitychange",Se))}}}var Rs=["recommendation","search_rank","banner","offer","layout","copy","price","other"],rt=e=>typeof e=="string"&&e!=="";function yr(e){return(Array.isArray(e?.decisions)?e.decisions:[]).filter(t=>rt(t?.slot)&&rt(t.decision_id)&&t.holdout!==!0).map(({decision_id:t,slot:n,arm:r,kind:o})=>({decision_id:t,slot:n,...rt(r)&&{arm:r},...Rs.includes(o)&&{kind:o}}))}function wr({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=>rt(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 Ms(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 ot(e,t,n=1e4){return Ms(`${t}\0${e}`)%n}function Wt(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 Xt(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}=Wt(e),s=ot(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 Sr(e,t){return typeof e!="string"||e===""||t==null||t===""?null:ot(t,`bandit-vs-default:${e}`)<1e4/2?"default":"bandit"}var Ds="hp_preview",Us=256;function _r(e,t=null){if(typeof location>"u")return j(e);let n=null;try{n=new URLSearchParams(location.search).get(Ds)}catch{n=null}if(n===null)return j(e);let r=n.trim();return r===""||r.length>Us?(se(e,"",0,t),null):(se(e,r,null,t),r)}var Vs=40,$s=128,Bs=5,js=60,Ar=e=>typeof e=="string"&&e!==""&&e.length<=$s&&!e.includes(","),br=e=>Array.isArray(e)?e.filter(Ar).slice(0,Vs):[],qs=e=>Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.replaceAll(","," ").trim()).filter(t=>t!=="").slice(0,Bs):[],Hs=e=>Object.entries(e&&typeof e=="object"?e:{}).filter(([t,n])=>Ar(t)&&Number.isFinite(n)&&n>=1).sort(([,t],[,n])=>n-t).slice(0,js).map(([t,n])=>`${t}:${Math.floor(n)}`);function Yt(e){let t={},n={viewed:br(e?.recentProducts),basket:br(e?.basketProducts),q:qs(e?.recentSearches),impressed:Hs(e?.impressions)};for(let[r,o]of Object.entries(n))o.length>0&&(t[r]=o.join(","));return t}var Fs=1800*1e3;function kr(e,t=Date.now()){try{localStorage.setItem(C("recommendationContext"),JSON.stringify({context:e,until:t+Fs}))}catch{}}function xr(){try{localStorage.removeItem(C("recommendationContext"))}catch{}}var Ks="hp_sample",Ir=1e4;function vr(e,t){return!(typeof t=="number"&&t<1)||e==null||e===""?!0:ot(e,Ks,Ir)<Math.round(t*Ir)}function ke(e){return e.trim().toLowerCase().replace(/\s*\/\s*/g,"/").replace(/^\/+|\/+$/g,"")}var Gs=2,zs=12;function Te(e,t=Gs){return e.split("/").slice(0,t).join("/")}function Zt(e,t){if(typeof t!="string"||!t.trim())return null;let n=Te(ke(t));return n?(e.unshift(n),e.length=Math.min(e.length,zs),n):null}var he=()=>C("sessionSignals"),xe=null,Qt=()=>xe??he();function Er(){try{return xe?localStorage:sessionStorage}catch{return}}function Cr(e,t){let n=t==null?null:String(t),r=e?U(he(),n,e):null;if(r===xe)return;let o=xe===null?Js():null;if(xe=r,!!xe)try{let s=Qt(),i=Kn(he(),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(he()))}catch{}}function Js(){try{let e=sessionStorage.getItem(he());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 st(){return{productViews:0,listViews:0,cartAdds:0,searches:0,recentProducts:[],recentCategories:[],recentBrowse:[],basketProducts:[],basketValue:null,recentSearches:[],impressions:{},browsingCategory:null,recentBrowseCategories:[],browsingListing:null,listViewsByCategory:{},campaign:null,startedAt:0}}function en(){let e=Er();if(!e)return st();try{let t=e.getItem(Qt());return t?{...st(),...JSON.parse(t)}:{...st(),startedAt:Date.now()}}catch{return{...st(),startedAt:Date.now()}}}function Ne(e){let t=Er();if(t)try{t.setItem(Qt(),JSON.stringify(e))}catch{}}function Re(){return en()}function Or(){for(let e of[()=>sessionStorage,()=>localStorage])try{let t=e();t.removeItem(he());for(let n of Object.keys(t))n.startsWith(`${he()}:`)&&t.removeItem(n)}catch{}}var tn=20,Pr=200,Ws=new Set(["Product Viewed","Product Clicked","Product Added","Product Added to Wishlist"]),Xs=new Set(["Product Viewed","Product Added"]),Lr=50;function it(e,t){let n=Zt(e.recentBrowse,t);return n?(e.recentBrowseCategories=[e.browsingListing?.category??null,...e.recentBrowseCategories].slice(0,e.recentBrowse.length),n):null}function Ys(e,t){let n=e.listViewsByCategory;n[t]=(n[t]??0)+1;let r=Object.keys(n);if(r.length>Lr){let o={};for(let s of r.sort((i,c)=>n[c]-n[i]).slice(0,Lr))o[s]=n[s];e.listViewsByCategory=o}}var Tr=e=>[...new Set(e.map(t=>t?.product_id).filter(t=>typeof t=="string"&&t))].slice(0,tn);function Nr(e,t,n){let r=en();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,it(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"&&Te(ke(d))||null,m=p?Te(ke(u)):"";if(!m){r.browsingCategory=null,r.browsingListing=null;break}r.browsingListing={key:m,category:p},it(r,m),r.browsingCategory=m,Ys(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&&Te(ke(d))===p.key){let m=it(r,`${d}/${f}`);m&&(r.browsingCategory=m)}break}case"Product Added":{r.cartAdds+=1,it(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,tn))}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=Tr(s)),Ne(r),r;case"Cart Updated":{Array.isArray(t?.products)&&(r.basketProducts=Tr(s));let u=t?.value;return r.basketValue=typeof u=="number"&&Number.isFinite(u)&&u>=0?u:null,Ne(r),r}default:return o&&Ne(r),r}let i=Ws.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>Pr){let d={};for(let f of u.sort((p,m)=>r.impressions[m]-r.impressions[p]).slice(0,Pr))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,tn)),Xs.has(e)&&typeof u.category=="string"&&u.category){let f=ke(u.category);f&&!c.has(f)&&(c.add(f),Zt(r.recentCategories,f))}}return Ne(r),r}var at=1800*1e3;function Rr({name:e,domain:t=null,mayStore:n,now:r=()=>Date.now(),mint:o=oe}){let s=null,i=0,c=()=>{s!==null&&n()&&se(e,s,at/1e3,t)};return{get(){let u=r(),d=j(e);return d?s=d:(s===null||u-i>=at)&&(s=o()),i=u,c(),s},persist:c,forget(){se(e,"",0,t),s=null}}}var J=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Mr=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),Dr=Object.freeze({enabled:!1}),rn=Object.freeze({enabled:!0,queryParamAllowlist:Object.freeze([])});function Ur(e,t){let n=e?.track;return J(n)?(Object.hasOwn(n,t)?n[t]:n.__default)?.enabled!==!1:!0}function Zs(e,t){return`${ie(e)}/v1/projects/${encodeURIComponent(t)}/settings`}var Qs="https://hp.thgingenuity.com";function ie(e){return e==null||e===""?Qs:$r(e)}function Vr(e,t){return e!=null&&e!==""?ie(e):t?.startsWith("https://")?t:ie(void 0)}function $r(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 ei(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 nn=e=>typeof e=="number"&&e>=0&&e<=1,ti=/^[0-9a-f]{64}$/;function ni(e){return J(e)?{enabled:e.enabled===!0,tokenSha256:typeof e.tokenSha256=="string"&&ti.test(e.tokenSha256)?e.tokenSha256:null}:{enabled:!1,tokenSha256:null}}function ri(e){if(!J(e))return null;let t=Object.fromEntries(Object.entries(e).filter(([,n])=>J(n)&&nn(n.share)&&(n.ramp==null||nn(n.ramp))&&typeof n.salt=="string"&&n.salt!=="").map(([n,r])=>[n,{share:r.share,ramp:r.ramp??null,salt:r.salt,...Mr(r.readoutSlots)&&r.readoutSlots.length>0&&{readoutSlots:r.readoutSlots}}]));return Object.keys(t).length?t:null}var oi=/^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/;function si(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"&&oi.test(e.cookie)?{source:"site_cookie",cookie:e.cookie}:null:null}function ii(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 ai(e){let t=J(e)?e.hp:null;return J(t)&&typeof t.enabled=="boolean"}function on(e){let t=J(e)?e.hp:null;if(!J(t)||t.enabled!==!0)return Dr;let n=ii(t.onsite);return{enabled:!0,propertyId:typeof t.propertyId=="string"&&t.propertyId!==""?t.propertyId:null,environment:typeof t.environment=="string"?t.environment:null,consentPurposes:ei(t.consent?.purposes),queryParamAllowlist:Mr(t.queryParamAllowlist)?t.queryParamAllowlist:null,anonymousId:si(t.anonymousId),apiHost:$r(t.apiHost),holdouts:ri(t.holdouts),sampleRate:nn(t.sampleRate)?t.sampleRate:1,debug:ni(t.debug),...n&&{onsite:n},plan:J(e.plan)&&J(e.plan.track)?{track:e.plan.track}:null}}var ci=3e3;async function Br(e,t,n=globalThis.fetch,r=ci){try{let o=await n(Zs(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 Dr;if(!o.ok)return null;let s=await o.json();return ai(s)?on(s):null}catch{return null}}var ct=e=>U(C("settings"),e);function jr(e){try{let t=localStorage.getItem(ct(e));if(!t)return null;let n=JSON.parse(t);return n?.enabled===!0?n:null}catch{return null}}function qr(e,t){try{t?.enabled===!0?localStorage.setItem(ct(e),JSON.stringify(t)):localStorage.removeItem(ct(e))}catch{}}function sn(e){try{localStorage.removeItem(ct(e))}catch{}}var ui={flushAt:20,flushIntervalMs:1e4,maxQueue:500,maxRetryAgeMs:1440*60*1e3,maxRetries:5,maxPersistedBatches:20,maxPersistedBytes:1024*1024,storageKey:fe.retry,beaconSafeBytes:56*1024,maxBatchEvents:100,maxBatchBytes:500*1024},ut=()=>Date.now(),Hr=3e4,fn=55*1024;function li(e,t=ut()){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 ae=e=>typeof TextEncoder<"u"?new TextEncoder().encode(e).length:Buffer.byteLength(e),an=()=>typeof window<"u"&&typeof document<"u";function di(){try{return!an()||!window.localStorage?null:(window.localStorage.getItem("thg_hp_probe"),window.localStorage)}catch{return null}}var A,cn,un,lt,ln,dn,Fr,Me,De,Ue,Kr,dt,Gr,ft,pt=class{constructor(t){vn(this,A);this.o={...ui,...t},this.queue=[],this.timer=null,this.storage=di(),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,an()&&(window.addEventListener("pagehide",()=>this.flush({beacon:!0})),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flush()}),L(this,A,ft).call(this))}markFailing(){this.answered||(this.failing=!0)}replayPersisted(){return this.replayAllowed=!0,L(this,A,ft).call(this)}clearPersisted(){if(this.replayAllowed=!1,!!this.storage)try{let t=L(this,A,Ue).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,un).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,cn).call(this)}flush(t={}){if(L(this,A,un).call(this),this.queue.length===0)return Promise.resolve();if(t.beacon&&an()&&typeof navigator<"u"&&navigator.sendBeacon)return L(this,A,Fr).call(this),Promise.resolve();if(this.inflight)return this.inflight;let n=L(this,A,dn).call(this,this.queue,this.o.maxBatchEvents,this.o.maxBatchBytes).map(o=>{let s=L(this,A,dt).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,De).call(this,s);continue}await L(this,A,Me).call(this,o,0,s,r)}})().finally(()=>{this.inflight=null,this.queue.length>=this.o.flushAt?this.flush():this.queue.length&&L(this,A,cn).call(this)}),this.inflight}};A=new WeakSet,cn=function(){this.timer||(this.timer=setTimeout(()=>this.flush(),this.o.flushIntervalMs),this.timer?.unref?.())},un=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},lt=function(t){return JSON.stringify({batch:t,writeKey:this.o.writeKey,sentAt:new Date().toISOString()})},ln=function(){return`${this.o.apiHost.replace(/\/$/,"")}/v1/batch`},dn=function(t,n,r){let o=ae(L(this,A,lt).call(this,[])),s=[],i=[],c=o;for(let u of t){let d=ae(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},Fr=function(){let t=this.queue;this.queue=[];let n=L(this,A,ln).call(this);for(let r of L(this,A,dn).call(this,t,this.o.maxBatchEvents,this.o.beaconSafeBytes)){let o=L(this,A,lt).call(this,r);if(ae(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,dt).call(this,r):null;i&&this.sending.add(i);continue}}L(this,A,Me).call(this,r,0,L(this,A,dt).call(this,r))}},Me=async function(t,n,r=null,o=this.epoch){r&&this.sending.add(r);let s=L(this,A,lt).call(this,t),i=0;try{let c=await fetch(L(this,A,ln).call(this),{method:"POST",headers:{"Content-Type":"text/plain"},body:s,keepalive:ae(s)<=this.o.beaconSafeBytes});if(c.ok)return this.failing=!1,this.answered=!0,L(this,A,De).call(this,r),L(this,A,ft).call(this),!0;let u=c.status===408||c.status===429||c.status>=500;if(u&&(i=li(c.headers?.get?.("retry-after"))),!u)return L(this,A,De).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,Hr)*(.5+Math.random()),Math.min(i,Hr));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,De).call(this,r),!1):L(this,A,Me).call(this,t,n+1,r,o)}},De=function(t){t&&(this.sending.delete(t),this.sinceRefusal.delete(t),L(this,A,Gr).call(this,t))},Ue=function(){let t=JSON.parse(this.storage.getItem(this.o.storageKey)||"[]");return Array.isArray(t)?t:[]},Kr=function(t,n){let r=i=>ae(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},dt=function(t){if(!this.storage||this.o.mayPersist&&!this.o.mayPersist())return null;try{let n={at:ut(),id:`${ut()}-${Math.random().toString(36).slice(2)}`,batch:t};return ae(JSON.stringify(n))+3>this.o.maxPersistedBytes?null:L(this,A,Kr).call(this,L(this,A,Ue).call(this),n)?n.id:null}catch{return null}},Gr=function(t){if(!(!t||!this.storage))try{let n=L(this,A,Ue).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{}},ft=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,Ue).call(this);t=r.filter(o=>Array.isArray(o?.batch)&&ut()-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,Me).call(this,r.batch,0,r.id))return})().finally(()=>{this.draining=null}),this.draining):Promise.resolve()};var pn="3.31.0",mn="@thg-agentic/hyper-personalisation-web";var fi=100,pi=["source","medium","campaign","content","term"];function Jr(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,fi))}return Object.keys(t).length?t:null}var Wr=e=>U(C("visitCampaign"),e==null?null:String(e)),Ie=new Map;function Xr(e){if(Ie.has(e))return Ie.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),Ie.delete(e)}catch{t?Ie.set(e,t):Ie.delete(e)}}function Yr(e,t,n){return typeof e?.tags=="object"&&e.tags!==null&&Number.isFinite(e.at)&&n-e.at<at&&!(t&&e.sid&&e.sid!==t)?e:null}function mt(e,{sessionId:t=null,now:n=Date.now()}={}){return Yr(Xr(Wr(e)),t,n)?.tags??null}function Zr(e,t,{sessionId:n=null,keepSession:r=!1,now:o=Date.now()}={}){let s=Wr(e),i=Xr(s),c=Yr(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 hn(){Ie.clear(),ze("visitCampaign")}var mi=new Set(["audiences","decisions","recommendations"]);var hi=Symbol.for("@thg-agentic/hyper-personalisation-web.replay"),gi=Symbol.for("@thg-agentic/hyper-personalisation-web.unreachable"),yi=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite-access");function wi(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 Si="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";function _i(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 gt(e){if(typeof e!="string")return null;let t=_i(e.trim());return t===Si?null:t}var Qr=Object.freeze({email_sha256:"sha256",phone_sha256:"sha256",accepts_marketing:"boolean",gender:"string",created_at:"date-time"}),bi=/^\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 Ai(e){if(typeof e!="string"||!bi.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 ki(e,t){return t===null?null:e==="sha256"?gt(t)??void 0:e==="date-time"?t instanceof Date?Number.isNaN(t.getTime())?void 0:t.toISOString():Ai(t)?t:void 0:typeof t===e?t:void 0}function xi(e,t){let n={},r=[];for(let[o,s]of Object.entries(e)){let i=Object.hasOwn(Qr,o)?Qr[o]:null,c=i?ki(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 eo=!1,to=!1;function Ii(){to||(to=!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 vi(e){!e||eo||(eo=!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 Ei(e){try{return ae(JSON.stringify(e))}catch{return 0}}function ht(e){return e&&typeof e.context=="object"&&e.context!==null?e.context:e}function Ci(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(C(o),e),u=i?.getItem(c);if(!u)continue;let d=U(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 no(e){let t=ie(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:mn,libraryVersion:pn,writeKey:"web",queryParamBlocklist:[],debug:!1,validate:null,consentTimeoutMs:5e3,...e,apiHost:t};Ge(n.storageNames),Je();let r=!!n.consent;r||Ii();let o=null;n.getConsent=()=>o?o.stamp():Xn();let s=()=>!r||o?.status==="granted";Ci(n.propertyId,n.writeKey);let i=r&&n.holdAcrossPages?Gn(U(C("held"),n.writeKey)):null,c=i?.read()??{items:[],anonymousId:null};n.mintAnonymousId!==void 0&&vi(n.debug);let u=zn(n,{carried:c.anonymousId,mayStore:s,orOwn:!0}),d=Rr({name:C("session"),domain:n.consentCookieDomain??null,mayStore:s}),f=n.getSessionId;n.getSessionId=()=>H(M(f,null))??d.get();let p=_r(C("preview"),n.consentCookieDomain??null),m=()=>H(M(f,null))??j(C("session")),I=Jr(typeof location>"u"?null:Rt(location.search)),w=(a=null)=>{p||Zr(n.propertyId,a,{sessionId:m(),keepSession:s()})},k=(a,l)=>n.debug&&console.warn("[hp]",a,l??""),b=n.transport??new pt({apiHost:n.apiHost,writeKey:n.writeKey,storageKey:U(C("retry"),n.writeKey),mayPersist:r?()=>o?.status==="granted":void 0,deferReplay:r,onError:k}),x=U(C("previousPage"),n.propertyId),h=null,O=()=>{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=wr({key:U(C("decisions"),n.propertyId),mayStore:s});n.getDecisions??(n.getDecisions=g.current);let y=H(M(n.getUserId,null)),P=null,N=null,V=y?Ce(n.identityToken):null,G=null,F=null,ee=null,W=new Set,Se=new Set;function je(a){if(a.type==="page"&&(ee=null),a.type==="track"&&a.event==="Product Viewed"){let S=a.properties?.products?.[0]?.product_id;ee=typeof S=="string"&&S?S:ee}if(a.type!=="track"||a.event!=="Cart Updated")return;let l=a.properties?.value;F=typeof l=="number"&&Number.isFinite(l)&&l>=0?l:null;for(let S of W)try{S()}catch(E){console.warn("[hp] a basket listener failed",E)}}function ce(a,l,S=!1){je(a),w();try{return R(a,l,S)}catch(E){if(E instanceof Ae)throw E;return console.warn("[hp] the event was not sent",E),null}}function R(a,l,S){let E=G;G=null;let $=a.type==="track"?a.event:a.type;if(!S&&!Ur(n.plan,$))return null;let T={messageId:E?.messageId??oe(),timestamp:E?.timestamp??new Date().toISOString(),anonymousId:H(M(n.getAnonymousId,null)),userId:y??null,...a,context:jn(n,ht(l))};if(T.properties&&(T.properties=Tt(T.properties)),typeof T.properties?.href=="string"&&(T.properties.href=Mt(T.properties.href,n)),!S&&!vr(T.anonymousId,n.sampleRate))return n.debug&&console.debug("[hp] not sent: outside the sample",T),null;if(n.beforeSend){let te;try{te=n.beforeSend(T)}catch(bo){return console.warn("[hp] beforeSend failed; the event was not sent",bo),null}if(!te)return null;let{type:z,event:xn,messageId:So,timestamp:_o}=T;T={...te,type:z,messageId:So,timestamp:_o,...xn?{event:xn}:{}}}if(n.validate){let te=n.validate(T,{producer:"web"});if(!te.valid){let z=`[hp] invalid ${T.event??T.type}:
2
- ${te.errors.join(`
3
- `)}`;if(n.throwOnInvalid)throw new Ae(z);console.error(z)}}n.debug&&console.debug("[hp]",T.event??T.type,T);let It=Ei(T);return It>fn?(k(`${T.event??T.type} not sent: ${It} bytes, over the ${fn}-byte limit for one event`),null):(go(T,S),T)}function K(a){if((a.type==="track"||a.type==="page")&&ho(a),n.onEvent)try{n.onEvent(a)}catch(l){console.warn("[hp] onEvent observer failed",l)}}let X=()=>r&&o?.state?.personalisation===!0,Y=()=>Cr(M(n.getSessionId,null),n.propertyId),ve=!1,wn=null;function ho(a){try{if(X()){Y();let l=Nr(a.event,a.properties,mt(n.propertyId,{sessionId:m()}));a.type==="track"&&kr(Yt(l)),a.event==="Preferences Stated"&&a.properties?.source==="onsite"&&Sn([a.properties],a.properties.slot),ve=!0}else qe(!1,n.propertyId??null)}catch(l){n.debug&&console.warn("[hp] the visit was not recorded",l)}}function Sn(a,l){let S=(wn??n.onsite)?.forms?.find?.(E=>E?.slot===l);pr(n.propertyId,fr(a,S?.questions))}function qe(a=!1,l=void 0){xr(),mr(l),(a||ve)&&Or(),ve=!1}function kt(){d.forget(),g.forget(),xt.clear(),u?.forget(),qe(!0),hn()}function go(a,l){!r||l||o.admits()?(K(a),b.enqueue(a)):o.hold(a)}let v=(a,l,S)=>ce({type:"track",event:a,properties:l??{}},S),xt=new Set,yo=(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(I),r&&(o=gr({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()),K(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(),qe(!0)}try{n.onConsentStatus?.(a)}catch(l){console.warn("[hp] onConsentStatus observer failed",l)}if(a==="granted"||a==="denied")for(let l of Se)try{l()}catch(S){console.warn("[hp] a consent listener failed",S)}},announce({action:a,state:l,previous:S,withdrawal:E}){l?.personalisation!==!0&&qe(S?.personalisation===!0),E&&(b.discardQueued?.(),hn()),ce({type:"track",event:"Consent Updated",properties:{action:a,state:l}},void 0,E),E&&b.flush()}}),o.start(),w());let _n=()=>n.holdout?Wt(n.holdout):null,bn=()=>Xt(n.holdout,H(M(n.getAnonymousId,null))).group;function wo(a,l){if(!Array.isArray(a?.decisions))return a;let S=n.holdout?.readoutSlots??[],E=H(M(n.getAnonymousId,null));return{...a,decisions:a.decisions.map($=>{let T=$?.variant==="bandit"||$?.variant==="default"?$.variant:!l&&$?.holdout!==!0&&S.includes($?.slot)?Sr($.slot,E):null;return T?T==="default"?{...$,variant:T,decision_id:null}:{...$,variant:T}:$})}}function An(a,l){if(p)return null;let S=a?.exposure,E=S?.holdout===!0,$=wo(a,E);return g.remember(yr($)),!S?.token||xt.has(S.token)?null:(xt.add(S.token),v("Personalisation Exposed",{exposure_token:S.token,surface:S.surface,holdout:E,holdout_share:S.holdout_share??_n()?.holdout_share??null,personalised_share:S.personalised_share??_n()?.personalised_share??null,...yo(S.surface,E,$)},l))}function kn(a){return y&&kt(),y=null,P=null,N=null,V=null,a}return ur({track:(a,l,S)=>a==="Signed Out"?kn(v(a,l,S)):v(a,l,S),page(a,l){a??(a={});let S=n.pageType??null;a.type&&(_e.has(a.type)?(S=a.type,n.pageType=a.type):n.debug&&console.warn(`[hp] ignoring unknown page.type "${a.type}". Allowed: ${[..._e].join(", ")}`));let E=ce({type:"page",properties:{name:a.name??null,navigation_trigger:a.navigation_trigger??Mn(),previous_message_id:O()}},{page:{type:S},...ht(l)??{}});return E&&_(E.messageId),E},identify(a,l,S){let{userId:E,...$}=a&&typeof a=="object"?a:{},T=Ce(ht(l)?.identity_token);if(E!==void 0){let z=H(E);V=z?z===y?T??V:T:null,S===Le?N=z:P&&z&&z!==P?kt():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!==Le&&(P=z)}else T&&y&&(V=T);let{identity_token:It,...te}=ht(l)??{};return ce({type:"identify",traits:xi($,n.debug)},V?{...te,identity_token:V}:te)},reset(){y&&kt(),y=null,P=null,N=null,V=null,_("")},productViewed:(a,l)=>v("Product Viewed",a,l),productListViewed:(a,l)=>v("Product List Viewed",a,l),recommendationsViewed:(a,l)=>v("Recommendations Viewed",a,l),personalisationExposed:(a,l)=>v("Personalisation Exposed",a,l),recordExposure:An,surfaceViewed({surface:a}={},l){if(!mi.has(a)||!n.holdout||a!=="decisions"&&!X())return null;let S=H(M(n.getAnonymousId,null)),E=Xt(n.holdout,S).group;if(E==="excluded")return null;let $=Tn({sessionId:He(M(n.getSessionId,null),S),surface:a});return $?An({exposure:{token:$,surface:a,holdout:E==="holdout"}},l):null},inHoldout:()=>bn()!=="personalised",personalisationGroup:bn,productClicked:(a,l)=>v("Product Clicked",a,l),productListFiltered:(a,l)=>v("Product List Filtered",a,l),productsSearched:(a,l)=>v("Products Searched",a,l),searchSuggestionsViewed:(a,l)=>v("Search Suggestions Viewed",a,l),productAdded:(a,l)=>v("Product Added",a,l),productRemoved:(a,l)=>v("Product Removed",a,l),cartUpdated:(a,l)=>v("Cart Updated",wi(a),l),identityLinked:(a,l)=>v("Identity Linked",a,l),slotEngaged:(a,l)=>p?null:v("Slot Engaged",a,l),productVariantSelected:(a,l)=>v("Product Variant Selected",a,l),cartViewed:(a,l)=>v("Cart Viewed",a,l),productAddedToWishlist:(a,l)=>v("Product Added to Wishlist",a,l),productRemovedFromWishlist:(a,l)=>v("Product Removed from Wishlist",a,l),wishlistProductAddedToCart:(a,l)=>v("Wishlist Product Added to Cart",a,l),productShared:(a,l)=>v("Product Shared",a,l),cartShared:(a,l)=>v("Cart Shared",a,l),couponEntered:(a,l)=>v("Coupon Entered",a,l),couponApplied:(a,l)=>v("Coupon Applied",a,l),couponDenied:(a,l)=>v("Coupon Denied",a,l),couponRemoved:(a,l)=>v("Coupon Removed",a,l),checkoutStarted:(a,l)=>v("Checkout Started",a,l),promotionViewed:(a,l)=>v("Promotion Viewed",a,l),promotionClicked:(a,l)=>v("Promotion Clicked",a,l),checkoutStepViewed:(a,l)=>v("Checkout Step Viewed",a,l),checkoutStepCompleted:(a,l)=>v("Checkout Step Completed",a,l),paymentInfoEntered:(a,l)=>v("Payment Info Entered",a,l),checkoutFailed:(a,l)=>v("Checkout Failed",a,l),signedIn:(a,l)=>v("Signed In",a,l),signedUp:(a,l)=>v("Signed Up",a,l),signedOut:a=>kn(v("Signed Out",{},a)),newsletterSubscribed:(a,l)=>v("Newsletter Subscribed",a,l),newsletterUnsubscribed:(a,l)=>v("Newsletter Unsubscribed",a,l),preferencesStated:(a,l)=>v("Preferences Stated",a,l),backInStockSubscribed:(a,l)=>v("Back In Stock Subscribed",a,l),productReviewed:(a,l)=>v("Product Reviewed",a,l),consentUpdated:(a,l)=>v("Consent Updated",a,l),flush:a=>b.flush(a),recommendationContext(){if(!X())return{};try{return Y(),Yt(Re())}catch{return{}}},get consent(){return o?o.state:null},servingHeaders:()=>qt(o?.state??null),get lastPageMessageId(){return O()},get anonymousId(){return H(M(n.getAnonymousId,null))},[yi](){return{writeKey:n.writeKey,library:{name:mn,version:pn},storageKey:U(C("onsite"),n.propertyId),gatewayHost:n.apiHost,servingHost:n.servingHost??n.apiHost,settings:n.onsite??null,debug:n.debug===!0,preview:p,anonymousId:()=>H(M(n.getAnonymousId,null)),sessionId:()=>H(M(n.getSessionId,null)),identityToken:()=>X()?V:null,analytics:s,personalisation:X,answered:(a,l)=>{X()&&Sn(a,l)},started:a=>{wn=a},consent:()=>n.getConsent(),headers:()=>qt(o?.state??null),pageUrl:()=>typeof location>"u"?null:Mt(location.href,n),locale:()=>Ut(M(n.getLocale,n.locale)),campaign:()=>p?I:mt(n.propertyId,{sessionId:m()}),basketValue:()=>{let a=Re().basketValue;return F??(Number.isFinite(a)?a:null)},sessionSignals:()=>X()?(Y(),{...Re(),campaign:mt(n.propertyId,{sessionId:m()}),answers:dr(n.propertyId)}):null,visitContext:()=>{let a=X();a&&Y();let l=a?Re():null,S=E=>Array.isArray(E)?E.filter($=>typeof $=="string"&&$.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=>(W.add(a),()=>W.delete(a)),consentAnswered:()=>!o||o.status==="granted"||o.status==="denied",onConsentAnswered:a=>(Se.add(a),()=>Se.delete(a))}},[gi](){b.markFailing?.()},[hi](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}}}})}var Ve=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite"),Z=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.pending"),$e=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.listeners"),yt=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.suppressed"),Oi=["shown","submitted","apply","closed","held","nothing"],ro=10,ge=()=>typeof window>"u"?null:window;function Be(){try{for(let{resolve:e}of ge()?.[Z]?.splice(0)??[])e(!1)}catch{}}var ye=Object.freeze({open(e){try{let t=ge();if(!t||typeof e!="string")return Promise.resolve(!1);if(t[Ve])return t[Ve].open(e);if(t[Z]??(t[Z]=[]),t[Z].length<ro)return new Promise(n=>t[Z].push({slot:e,resolve:n}))}catch{}return Promise.resolve(!1)},show(e){return ye.open(e)},on(e,t){var n;try{let r=ge();return!r||!Oi.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=ge();if(!t)return;(t[yt]??(t[yt]=new Set)).add(String(e)),t[Ve]?.suppress()}catch{}},unsuppress(e){try{let t=ge()?.[yt];e===void 0?t?.clear():t?.delete(String(e))}catch{}},ready(){try{let e=ge();if(!e)return Promise.resolve([]);if(e[Ve])return Promise.resolve(ye.debug());if(e[Z]??(e[Z]=[]),e[Z].length<ro)return new Promise(t=>e[Z].push({slot:null,resolve:()=>t(ye.debug())}))}catch{}return Promise.resolve([])},debug(){try{return ge()?.[Ve]?.debug()??[]}catch{return[]}}});function oo(e){let t=typeof document>"u"?null:document.currentScript?.src;return t?new URL(e,t).href:null}var wt=new Map;function so(e,t){return window[t]?Promise.resolve(window[t]):e?(wt.has(t)||wt.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(()=>wt.delete(t))),wt.get(t)):Promise.reject(new Error("the CDN script\u2019s own URL is unknown"))}var Pi=oo("onsite.min.js"),gn=()=>so(Pi,Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.module"));var yn=Symbol.for("@thg-agentic/hyper-personalisation-web.bootstrap"),Li=Symbol.for("@thg-agentic/hyper-personalisation-web.drain"),Ti=Symbol.for("@thg-agentic/hyper-personalisation-web.carry"),io=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.assignment"),Mi=Symbol.for("@thg-agentic/hyper-personalisation-web.recommendation-context"),bt=e=>e?()=>j(e):()=>null,uo={didomi:e=>Qn({purposes:e.purposes}),onetrust:e=>er({groups:e.groups,impliedConsent:e.impliedConsent}),cookie:e=>tr({name:e.name,categories:e.categories,refusedValue:e.refusedValue,source:e.source,changeEvent:e.changeEvent}),forwarded:e=>nr({name:e.name}),static:e=>{if(!e.state||typeof e.state!="object")throw new Error('consent.state is required for provider "static"');return rr(e.state)}},ao=Object.keys(uo),we=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),St=e=>typeof e=="string"&&e!=="",Di=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),lo=e=>we(e)&&typeof e.read=="function";function Ui(e,t={}){let n=[];if(!we(e))return["config must be { writeKey, apiHost? }"];St(e.writeKey)||n.push("writeKey is required"),ie(e.apiHost)||n.push("apiHost, when given, must be a host or an http(s) origin"),t.propertyId!==void 0&&!St(t.propertyId)&&n.push("propertyId must be a string");let{consent:r}=t;if(!lo(r)&&!(we(r)&&ao.includes(r.provider))&&n.push(`consent must be a consent adapter or { provider: ${ao.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&&!St(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&&!St(t.dataLayer.name)&&n.push("dataLayer.name must be a string"),t.dataLayer.ignore!==void 0&&!Di(t.dataLayer.ignore)&&n.push("dataLayer.ignore must be an array of strings")):n.push("dataLayer must be an object")),n}function Vi(e,t,n){if(lo(e))return Ht(e,t.consentPurposes);let{provider:r,...o}=e,s=n?.consent?.[r]??uo[r];return Ht(s(o),t.consentPurposes)}var At=(e,t,n)=>`${e??""}|${t??""}${n?"|v":""}`,$i=(e,t,n,r)=>e===At(t,n,!0)||!r&&e===At(t,n,!1),Bi=e=>{if(e.context?.identity_token===void 0)return e;let{identity_token:t,...n}=e.context;return{...e,context:n}},fo=e=>{try{return sessionStorage.getItem(e)}catch{return null}};function ji(e,t){let n=H(t?.userId),r=gt(t?.emailSha256);if(!n&&!r)return null;let o=fo(U(C("identified"),e));return $i(o,n,r,n!==null&&Ce(t?.token)!==null)?null:{...n?{userId:n}:{},...r?{email_sha256:r}:{}}}async function qi({writeKey:e,apiHost:t},n){if(n.settings!==void 0)return{settings:on(n.settings),revalidated:null};let r=Br(t,e),o=jr(e);if(o)return{settings:o,revalidated:r,fetched:r};let s=await r;return s?{settings:s,revalidated:r,fetched:r}:{settings:rn,revalidated:null,fetched:r}}function po(e,t){let n=t??{},r=typeof window<"u"?window:null;if(r?.[yn])return r[yn];let o=Jn(e?.writeKey,()=>{let{analytics:i}=Pe(j(C("consent")));return i===!0||i===null&&n.holdAcrossPages===!0}),s=Gi(e,n,o);if(r){let i=n.extend?.getSessionId??bt(n.identityCookies?.sessionId),c=bt(n.identityCookies?.anonymousId);r[Ri]=({slot:u,arm:d}={})=>Ln({sessionId:He(i(),c()),slot:u,arm:d}),r[yn]=s,r[Ti]=o,r[Li]?.(s)}return s}function Hi(){let e=globalThis.performance?.now?.();return new Date(Date.now()-(Number.isFinite(e)?e:0)).toISOString()}function co(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(Ot(e,r(n.promotions))),n.productLists&&o.push(Ct(e,r(n.productLists))),n.recommendations&&o.push(Pt(e,r(n.recommendations))),n.exposures&&o.push(Et(e,r(n.exposures)))}catch(s){console.warn("[hp] autocapture not started:",s?.message??s)}return()=>{for(let s of o)s()}}var Fi=1e3;function Ki(e,t,n,r){if(!t)return Be();let o=n.onsite?gn():null;o?.catch(()=>{}),(r?Promise.race([r.then(i=>i??n),new Promise(i=>setTimeout(()=>i(n),Fi))]):Promise.resolve(n)).then(i=>{let c=i.enabled?i.onsite:null;if(!c)return Be();let u=t===!0?{}:t;return(o??gn()).then(d=>d.startOnsite(e,{...u,settings:u.settings??c}))}).catch(i=>{Be(),console.warn("[hp] onsite not started:",i?.message??i)})}function _t(e){return e.close(),Be(),null}async function Gi(e,t,n){try{let r=Ui(e,t);if(r.length)return console.warn(`[hp] not started, the configuration is invalid: ${r.join("; ")}`),_t(n);Ge(t.storageNames),Je();let{writeKey:o}=e,[{settings:s,revalidated:i,fetched:c},u]=await Promise.all([qi(e,t),Promise.resolve(t.identity).catch(()=>null)]),d=i?s:null,f=!1,p=()=>f&&d&&qr(o,d);if(i?.then(g=>{g&&(d=g,g.enabled?p():sn(o))}),!s.enabled)return t.debug&&console.info("[hp] off: the settings for this write key do not enable it"),_t(n);let m=t.propertyId??s.propertyId??null;if(!m&&s!==rn)return console.warn("[hp] not started: this write key covers several properties, so propertyId is required"),_t(n);let{preset:I}=t,w=ji(m,u),k=t.debug===!0||s.debug?.enabled===!0||cr(s.debug?.tokenSha256??null,C("debug")),b=H(u?.userId),x=no({apiHost:Vr(e.apiHost,s.apiHost),servingHost:ie(e.apiHost),onsite:s.onsite??null,writeKey:o,propertyId:m,pageType:_e.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:Vi(t.consent,s,I),consentCookieDomain:t.consentCookieDomain,storageNames:t.storageNames,holdAcrossPages:t.holdAcrossPages===!0,mintAnonymousId:t.mintAnonymousId,debug:k,anonymousIdSource:s.anonymousId??void 0,getAnonymousId:bt(t.identityCookies?.anonymousId),getSessionId:t.identityCookies?.sessionId?bt(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"){sn(o);try{sessionStorage.removeItem(U(C("identified"),m))}catch{}}t.extend?.onConsentStatus?.(g)},onEvent(g){if(g.type==="identify"){let y=U(C("identified"),m),P=H(g.userId),N=gt(g.traits?.email_sha256),V=!!g.context?.identity_token||fo(y)===At(P,N,!0);try{sessionStorage.setItem(y,At(P,N,V))}catch{}}t.extend?.onEvent?.(Bi(g))}});typeof window<"u"&&(window[Mi]=()=>x.recommendationContext()),c?.then(g=>g===null&&x[Ni]());for(let[g,y,P]of n.take())try{x[io](g,y,P)}catch(N){console.warn(`[hp] carried ${g} failed`,N)}x[io]("page",[t.pageType?{type:t.pageType}:{}],{messageId:oe(),timestamp:Hi()});let h=co(x,t.autocapture),O=x.page;x.page=zt("page",(...g)=>{let y=O(...g);return h(),h=co(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]||[],ar(x,{...I,dataLayer:_[g],ignore:[...I?.ignore??[],...t.dataLayer.ignore??[]],onError:y=>k&&console.warn("[hp] dataLayer mapping failed",y)})}return w&&x.identify(w,void 0,Le),x.onsite=ye,Ki(x,t.onsite,s,i),x}catch(r){return console.warn("[hp] not started:",r?.message??r),_t(n)}}function mo(e){e.initialized=!0,po(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=ye);B.initialized||(B._config?mo(B):B.load=(e,t)=>{B._config=e,B._options=t??{},mo(B)});})();
1
+ (()=>{var On=e=>{throw TypeError(e)};var xo=(e,t,n)=>t.has(e)||On("Cannot "+n);var Pn=(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)=>(xo(e,t,"access private method"),n);var Oe=[];for(let e=2;Oe.length<64;e++)Oe.every(t=>e%t!==0)&&Oe.push(e);var Ln=e=>(e-Math.floor(e))*2**32>>>0,vo=Oe.slice(0,8).map(e=>Ln(Math.sqrt(e))),Eo=Oe.map(e=>Ln(Math.cbrt(e))),Z=(e,t)=>e>>>t|e<<32-t;function Tn(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(vo),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)+Eo[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 Ot=(e,t)=>e<<t|e>>>32-t;function Nn(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]:Ot(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=Ot(i,5)+m+f+v+r[p]|0;[f,d,u,c,i]=[d,u,Ot(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 Co="e28e8ada-5b76-4209-bba9-79b823a0af75",Oo=e=>Array.from(e,t=>t.toString(16).padStart(2,"0")).join("");function Rn(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=Nn(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 Mn({sessionId:e,slot:t,arm:n}={}){let r=le(e,256);return!r||!le(t,256)||!le(n,256)?null:Rn(Co,`${r}:${t}:${n}`)}var Po="4b1f2c7e-9a3d-4e58-b6c1-2d7f0a9e8c53";function Dn({sessionId:e,surface:t}={}){let n=le(e,256);return!n||!le(t,64)?null:Rn(Po,`${n}:${t}`)}var Lo=Array.from({length:11},(e,t)=>t/10);function To(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 oe(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(!To(O,r)){u.delete(_),f(_);continue}u.add(_),m()&&d(_)}},{threshold:Lo}),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 Pt(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 oe({selector:n,root:s,visibleRatio:r,dwellMs:o,onViewable(i){let c=i.dataset?.hpExposure?.trim();return c&&e.surfaceViewed({surface:c}),!0}})}var Un=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:Un(b.url)}:{},...b.image_url?{image_url:Un(b.image_url)}:{}}}catch{return null}},m=oe({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(O=>!O||x.has(O.product_id)?!1:(x.add(O.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 No(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=No,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=oe({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 Ro(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 Mo(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=Ro,resolveTile:s=Mo,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}},v=h=>typeof h.closest=="function"?h.closest(n):null,w=h=>Array.from(h.querySelectorAll(r)),I=(h,O)=>{if(p.delete(O.recommendation_request_id),d.has(O.recommendation_request_id))return;let _=w(h).map((y,P)=>m(s,y,P)).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,P)=>y.position-P.position);e.recommendationsViewed({...O,products:_,viewable:g})},b=oe({selector:`${n} ${r}`,root:u,visibleRatio:i,dwellMs:c,onViewable(h){let O=v(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 P=f.get(g);P.has(y.position)||P.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(O,_),0)),!0}}),x=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]"),P=y&&(_.contains(y)||y.contains(_));if(!(g&&_.contains(g))&&!P)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"]),Do=new Set(["products"]),Vn=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])=>!Vn(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 Do)n in e&&Vn(e[n])&&(t[n]=e[n]);return t}function $n(){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 Uo=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 Uo.has(t.toLowerCase())?null:t}var Pe=e=>typeof e=="string"&&e!==""?e:null;function se(){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 jn="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 Vo={gclid:"gclid",fbclid:"fbclid",ttclid:"ttclid"},$o=/[a-z0-9._%+-]+@[a-z0-9-]+(\.[a-z0-9-]+)*\.[a-z]{2,}/i,jo=/\d(?:[ -]?\d){12,}/,Bo=new Set(["gclid","fbclid","ttclid","msclkid"]);function qn(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=!Bo.has(String(t).toLowerCase());return n.some(o=>$o.test(o)||r&&jo.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(Vo)]){let i=t.get(o);i&&!qn(i,o)&&(n[s]=i)}return Object.keys(n).length?n:null}var qo=["email","e-mail","password","pass","pwd","token","auth","code","uid","customer_id","postcode","zip","phone","applyCode"],Fo=["email","password","passwd","pwd","token","secret","auth","session","phone","postcode","zip","address","birth","card","cvv","iban","ssn","customerid","userid"],Ho=["tel","uid","dob"],Ko=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","fbclid","ttclid","msclkid"],Go=new Set(qo.map(e=>e.toLowerCase()));function zo(e){let t=String(e).toLowerCase();if(Go.has(t))return!0;let n=t.replace(/[-_.]/g,"");return Fo.some(o=>n.includes(o))?!0:String(e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).some(o=>Ho.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 Fn(e,t={}){if(!e)return null;try{let n=new URLSearchParams(e),r=t.queryParamAllowlist?Dt([...t.queryParamAllowlist,...Ko]):null,o=Dt(t.queryParamBlocklist),s=Dt(t.sensitiveParamAllowlist);for(let c of new Set(n.keys()))(zo(c)&&!s.some(d=>d.test(c))||n.getAll(c).some(d=>qn(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 Hn(e,t,n={}){if(!e)return null;try{let r=new URL(e);return t&&r.origin===t?r.origin+r.pathname+(Fn(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:Hn(n.href,location.origin,t)}catch{return null}}function te(e){if(typeof e!="string")return null;let t=e.trim().toUpperCase();return/^[A-Z]{3}$/.test(t)?t:null}function Bn(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 Jo(e){return{...e.propertyId==null?{}:{property_id:String(e.propertyId)},channel:e.channel??null,market:e.market??null,environment:e.environment??null}}function Wo(e){let t=typeof window<"u"?window.location:null,n=t?Fn(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"?Hn(document.referrer,t?.origin,e):null,title:typeof document<"u"&&document.title||null,type:e.pageType??null}}var Le;function Xo(){if(Le!==void 0)return Le;try{Le=globalThis.Temporal?.Now?.timeZoneId?.()||Intl.DateTimeFormat().resolvedOptions().timeZone||null}catch{Le=null}return Le}function Kn(e,t={}){let n=typeof window<"u"?window.location:null,r={library:{name:e.libraryName,version:e.libraryVersion},spec:{version:jn},source:Jo(e),session_id:R(e.getSessionId,null),identity_trust:H(R(e.getAnonymousId,null))?"device":"none",page:Wo(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:te(R(e.getCurrency,e.currency)),locale:$t(R(e.getLocale,e.locale)),timezone:Xo(),country:Bn(e.country),ship_to_country:Bn(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 Gn(r,t)}function Gn(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]=Gn(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"}),Yo={retry:"cdp.retry",sessionSignals:"cdp_session_signals",identified:"cdp_identified",previousPage:"cdp_prev_page_message_id"},ze={...pe},zn=!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 Zo="_",Jn=e=>e==null||e===""?Zo:String(e);function V(e,t,n){let r=`${e}:${Jn(t)}`;return n==null||n===""?r:`${r}:${n}`}function Wn(e,t){return`${e}:${Jn(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(!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(Yo)){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 Xn(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 Qo=400*24*60*60;function ie(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 es({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=ie(e,u,Qo,t),!(!d||c===null)))try{jt()?.removeItem(n),c=null}catch{}};return{get(){return u??(u=o()),f(),u},peek:()=>u,persist:f,forget(){ie(e,"",0,t),u=null,d=!1;try{jt()?.removeItem(n)}catch{}c=null}}}function Yn(e,{carried:t=null,mayStore:n,orOwn:r=!1}){let o=e.anonymousIdSource,s=()=>es({name:C("anonymousId"),domain:e.consentCookieDomain??null,legacyKey:V(C("anonymousId"),e.propertyId),read:B,mint:se,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 ts=200;function Zn(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(-ts)})),!0)}catch{return!1}},close(){o=!0}}}var Na=pe.consent,Ze=Object.freeze({visitor:"visitor",host:"host"}),er=()=>({basis:Ze.host}),ns="hp-consent",me=["analytics","marketing","personalisation","ad_user_data","ad_personalization"],tr={analytics:"a",marketing:"m",personalisation:"p",ad_user_data:"aud",ad_personalization:"adp"},ne=()=>typeof window<"u",nr=()=>ne()&&typeof window.cookieStore?.addEventListener=="function",rs=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]=rs(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(`${tr[n]}=${r?1:0}`)}return t.join("&")}function Ht(e){return{[ns]: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(tr).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 os={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 ss(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 rr(e={}){let t={...os,...e.purposes};function n(){let r=ne()?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=>ss(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(!ne())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 Qn(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 or(e={}){let t={analytics:"C0002",personalisation:"C0003",marketing:"C0004",...e.groups},n=e.impliedConsent===!0;function r(){let i=Qn(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=ne()?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(ne()&&window.OneTrust?.IsAlertBoxClosed?.()===!0)return!0}catch{}return n&&ne()&&(!!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=Qn(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(!ne())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 is(e){let t=String(e).split(",").map(n=>n.trim()).filter(Boolean);return t.length?new Set(t):null}function sr(e){let{name:t,categories:n,parse:r=is,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 nr()},subscribe(u){if(!ne())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 ir(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 nr()},subscribe(r){if(!ne())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 ar(e){let t=ke(e);return{name:"static",basis:Ze.host,read:()=>t?{...t}:null,observesChanges:!0,subscribe:()=>()=>{}}}function cr(e){if(e==null)return null;let t=String(e).split("/").map(n=>n.trim()).filter(Boolean).join("/");return t===""?null:t}function as(e){let t=e.item_category;if(t!=null&&String(t).includes("/"))return cr(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 cr(n.join("/"))}var cs=e=>{if(e==null||typeof e=="object")return null;let t=String(e).trim();return t===""?null:t};function us(...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=>us(e.item_group_id,e.item_id);function ls(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=cs;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:as(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=>ls(n,t)).filter(n=>n?.product_id)}var ds=1e3,fs={shipping:2,payment:3},ps=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},ms=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 hs(e){return Array.isArray(e.items)?e.items.filter(tt):null}function ur(e){let t=q(e)?.toLowerCase().replace(/[\s-]+/g,"_");return t?ps.has(t)?t:t==="email"||t==="email_password"?"password":"other":null}function gs({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 lr=({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,ys=new Set(["product","products","item","items"]);function ws({ecommerce:e}){let t=q(e.item_id),n=q(e.content_type)?.toLowerCase();return!t||n&&!ys.has(n)?null:{event:"Product Shared",properties:{share_via:q(e.method),products:[{product_id:t}]}}}function Ss(e){let t=o=>he("Product List Viewed",{list_id:lr(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:lr(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:ws,login:o=>({event:"Signed In",properties:{method:ur(o.ecommerce.method)}}),sign_up:o=>({event:"Signed Up",properties:{method:ur(o.ecommerce.method)}})}}var _s=e=>e.event;function bs(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 dr(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=Ss({...fs,...t.steps}),o=t.map??{},s=t.eventName??_s,i=t.productId??et,c=new Set(["purchase","refund",...t.ignore??[]]),u=t.dedupeMs??ds,d=new Map,f=!0;function p(_,g,y){if(u<=0)return!1;let P=`${_}|${y??""}|${Jt(g)}`,N=Date.now();for(let[$,G]of d)N-G>u&&d.delete($);return d.has(P)?!0:(d.set(P,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 P=g.products?.[0]?.product_id;return P?v.has(P)?!0:(v.add(P),!1):!1}function I({event:_,properties:g={}},y){if(!_||p(_,g,y)||w(_,g))return;let P=y?{context:{currency:y}}:void 0;if(_==="Signed Out"&&typeof e.signedOut=="function"){e.signedOut(P);return}e.track(_,g,P)}function b(_){let g=t.transform?t.transform(_):_,y=bs(g,s);if(!y||c.has(y.name))return;let P=Object.hasOwn(o,y.name),N=P?o[y.name]:r[y.name];if(typeof N!="function")return;let $=hs(y.ecommerce),G=$??[],F={...y,items:G,itemsListed:$!==null,products:zt(G,i),currency:te(y.ecommerce.currency),value:ms(y.ecommerce.value)};F.promotions=gs(F);let Se=P?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 O(..._){let g=h.apply(this,_);for(let y of _)x(y);return g}return n.push=O,()=>{f=!1,n.push===O&&(n.push=h)}}var As="hp_debug",ks=256;function Is(){try{return new URLSearchParams(location.search).get(As)}catch{return null}}function fr(e,t){if(typeof location>"u")return!1;try{let n=Is();if(n!==null){let o=n.trim();o===""||o.length>ks?sessionStorage.removeItem(t):sessionStorage.setItem(t,o)}let r=sessionStorage.getItem(t);return!!(e&&r&&Tn(r)===e)}catch{return!1}}var Ie=class extends Error{},xs={inHoldout:()=>!0,personalisationGroup:()=>"excluded",servingHeaders:()=>({}),recommendationContext:()=>({}),flush:()=>Promise.resolve(),reset:()=>{}};function Wt(e,t){let n=xs[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 pr(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 vs=2160*60*60*1e3,Es=50,Cs=20,Os=128,Xt=e=>V(C("answers"),e),rt=e=>typeof e=="string"&&e!==""&&e.length<=Os;function mr(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<vs):[]}catch{return[]}}function Yt(e,t=Date.now()){return Object.fromEntries(mr(e,t).map(n=>[n.q,n.v]))}function hr(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 gr(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=[...mr(e,n).filter(i=>!o.has(i.q)),...r.map(i=>({q:i.question,v:i.values.filter(rt).slice(0,Cs),at:n}))].slice(-Es);try{nt.delete(e),localStorage.setItem(Xt(e),JSON.stringify(s))}catch{}}var nt=new Set;function yr(e){if(e===void 0)We("answers"),nt.clear();else if(!nt.has(e)){try{localStorage.removeItem(Xt(e))}catch{}nt.add(e)}}var Ps=4320*60*60,Ls=100,Ts=1e3,Ns=2e3,wr=500,ot=e=>(e?.unref?.(),e);function Rs(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 Ms(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=${Ps}; SameSite=Lax`+o+r}catch{}}function Ds(e){let t=Te(B(e));return me.some(n=>t[n]!==null)?t:null}function Sr(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 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(){v||m||d===null||_()||O()&&document.visibilityState==="hidden"||(m=ot(setInterval(()=>F(x()),Ns)))}let P=()=>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,Q=qe?Ds(o):d;if(!qe&&qt(Q,K))return;h(),d=K,y(),Ms(K,r,o);let X=!qt(Q,K);if(K.analytics){b("granted"),$(),X&&i({action:Rs(K,Q),state:K,previous:Q,withdrawal:!1});return}G(),Q?.analytics===!0&&i({action:"withdrawn",state:K,previous:Q,withdrawal:!0}),b("denied")}function Se(){p=null,u==="pending"&&(b("unknown"),f&&clearInterval(f),f=ot(setInterval(()=>F(x()),Ts)))}function W(M){if(P()){if(N){N.write(I);return}M?.type!=="visibilitychange"&&!M?.persisted&&G()}}let re=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!P()||I.length>=wr?(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)}O()&&(window.addEventListener("pagehide",_e),window.addEventListener("pageshow",be),document.addEventListener("visibilitychange",re)),N&&I.length===0&&I.push(...N.read().slice(-wr)),F(x()),!d&&(f=ot(setInterval(()=>F(x()),Ls)),p=ot(setTimeout(Se,n)))},stop(){v=!0,h(),g(),typeof w=="function"&&w(),O()&&(window.removeEventListener("pagehide",_e),window.removeEventListener("pageshow",be),document.removeEventListener("visibilitychange",re))}}}var Us=["recommendation","search_rank","banner","offer","layout","copy","price","other"],st=e=>typeof e=="string"&&e!=="";function _r(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},...Us.includes(o)&&{kind:o}}))}function br({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 Vs(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 Vs(`${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 Ar(e,t){return typeof e!="string"||e===""||t==null||t===""?null:it(t,`bandit-vs-default:${e}`)<1e4/2?"default":"bandit"}var $s="hp_preview",js=256;function kr(e,t=null){if(typeof location>"u")return B(e);let n=null;try{n=new URLSearchParams(location.search).get($s)}catch{n=null}if(n===null)return B(e);let r=n.trim();return r===""||r.length>js?(ie(e,"",0,t),null):(ie(e,r,null,t),r)}var Bs=40,qs=128,Fs=5,Hs=60,xr=e=>typeof e=="string"&&e!==""&&e.length<=qs&&!e.includes(","),Ir=e=>Array.isArray(e)?e.filter(xr).slice(0,Bs):[],Ks=e=>Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.replaceAll(","," ").trim()).filter(t=>t!=="").slice(0,Fs):[],Gs=e=>Object.entries(e&&typeof e=="object"?e:{}).filter(([t,n])=>xr(t)&&Number.isFinite(n)&&n>=1).sort(([,t],[,n])=>n-t).slice(0,Hs).map(([t,n])=>`${t}:${Math.floor(n)}`);function en(e){let t={},n={viewed:Ir(e?.recentProducts),basket:Ir(e?.basketProducts),q:Ks(e?.recentSearches),impressed:Gs(e?.impressions)};for(let[r,o]of Object.entries(n))o.length>0&&(t[r]=o.join(","));return t}var zs=1800*1e3;function vr(e,t=Date.now()){try{localStorage.setItem(C("recommendationContext"),JSON.stringify({context:e,until:t+zs}))}catch{}}function Er(){try{localStorage.removeItem(C("recommendationContext"))}catch{}}var Js="hp_sample",Cr=1e4;function Or(e,t){return!(typeof t=="number"&&t<1)||e==null||e===""?!0:it(e,Js,Cr)<Math.round(t*Cr)}function xe(e){return e.trim().toLowerCase().replace(/\s*\/\s*/g,"/").replace(/^\/+|\/+$/g,"")}var Ws=2,Xs=12;function Re(e,t=Ws){return e.split("/").slice(0,t).join("/")}function tn(e,t){if(typeof t!="string"||!t.trim())return null;let n=Re(xe(t));return n?(e.unshift(n),e.length=Math.min(e.length,Xs),n):null}var ge=()=>C("sessionSignals"),ve=null,nn=()=>ve??ge();function Pr(){try{return ve?localStorage:sessionStorage}catch{return}}function Lr(e,t){let n=t==null?null:String(t),r=e?V(ge(),n,e):null;if(r===ve)return;let o=ve===null?Ys():null;if(ve=r,!!ve)try{let s=nn(),i=Wn(ge(),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(ge()))}catch{}}function Ys(){try{let e=sessionStorage.getItem(ge());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 at(){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 rn(){let e=Pr();if(!e)return at();try{let t=e.getItem(nn());return t?{...at(),...JSON.parse(t)}:{...at(),startedAt:Date.now()}}catch{return{...at(),startedAt:Date.now()}}}function Me(e){let t=Pr();if(t)try{t.setItem(nn(),JSON.stringify(e))}catch{}}function Ee(){return rn()}function Tr(){for(let e of[()=>sessionStorage,()=>localStorage])try{let t=e();t.removeItem(ge());for(let n of Object.keys(t))n.startsWith(`${ge()}:`)&&t.removeItem(n)}catch{}}var on=20,Nr=200,Zs=new Set(["Product Viewed","Product Clicked","Product Added","Product Added to Wishlist"]),Qs=new Set(["Product Viewed","Product Added"]),Rr=50;function ct(e,t){let n=tn(e.recentBrowse,t);return n?(e.recentBrowseCategories=[e.browsingListing?.category??null,...e.recentBrowseCategories].slice(0,e.recentBrowse.length),n):null}function ei(e,t){let n=e.listViewsByCategory;n[t]=(n[t]??0)+1;let r=Object.keys(n);if(r.length>Rr){let o={};for(let s of r.sort((i,c)=>n[c]-n[i]).slice(0,Rr))o[s]=n[s];e.listViewsByCategory=o}}var Mr=e=>[...new Set(e.map(t=>t?.product_id).filter(t=>typeof t=="string"&&t))].slice(0,on),sn=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 Dr(e,t,n){let r=rn();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,ct(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"&&Re(xe(d))||null,m=p?Re(xe(u)):"";if(!m){r.browsingCategory=null,r.browsingListing=null;break}r.browsingListing={key:m,category:p},ct(r,m),r.browsingCategory=m,ei(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&&Re(xe(d))===p.key){let m=ct(r,`${d}/${f}`);m&&(r.browsingCategory=m)}break}case"Product Added":{r.cartAdds+=1,ct(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,on))}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=Mr(s)),Me(r),r;case"Cart Updated":{Array.isArray(t?.products)&&(r.basketProducts=Mr(s)),r.basketItems=Array.isArray(t?.products)?sn(s):null,r.basketCurrency=te(t?.currency);let u=t?.value;return r.basketValue=typeof u=="number"&&Number.isFinite(u)&&u>=0?u:null,Me(r),r}default:return o&&Me(r),r}let i=Zs.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>Nr){let d={};for(let f of u.sort((p,m)=>r.impressions[m]-r.impressions[p]).slice(0,Nr))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,on)),Qs.has(e)&&typeof u.category=="string"&&u.category){let f=xe(u.category);f&&!c.has(f)&&(c.add(f),tn(r.recentCategories,f))}}return Me(r),r}var ut=1800*1e3;function Ur({name:e,domain:t=null,mayStore:n,now:r=()=>Date.now(),mint:o=se}){let s=null,i=0,c=()=>{s!==null&&n()&&ie(e,s,ut/1e3,t)};return{get(){let u=r(),d=B(e);return d?s=d:(s===null||u-i>=ut)&&(s=o()),i=u,c(),s},persist:c,forget(){ie(e,"",0,t),s=null}}}var J=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Vr=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),$r=Object.freeze({enabled:!1}),cn=Object.freeze({enabled:!0,queryParamAllowlist:Object.freeze([])});function jr(e,t){let n=e?.track;return J(n)?(Object.hasOwn(n,t)?n[t]:n.__default)?.enabled!==!1:!0}function ti(e,t){return`${ae(e)}/v1/projects/${encodeURIComponent(t)}/settings`}var ni="https://hp.thgingenuity.com";function ae(e){return e==null||e===""?ni:qr(e)}function Br(e,t){return e!=null&&e!==""?ae(e):t?.startsWith("https://")?t:ae(void 0)}function qr(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 ri(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 an=e=>typeof e=="number"&&e>=0&&e<=1,oi=/^[0-9a-f]{64}$/;function si(e){return J(e)?{enabled:e.enabled===!0,tokenSha256:typeof e.tokenSha256=="string"&&oi.test(e.tokenSha256)?e.tokenSha256:null}:{enabled:!1,tokenSha256:null}}function ii(e){if(!J(e))return null;let t=Object.fromEntries(Object.entries(e).filter(([,n])=>J(n)&&an(n.share)&&(n.ramp==null||an(n.ramp))&&typeof n.salt=="string"&&n.salt!=="").map(([n,r])=>[n,{share:r.share,ramp:r.ramp??null,salt:r.salt,...Vr(r.readoutSlots)&&r.readoutSlots.length>0&&{readoutSlots:r.readoutSlots}}]));return Object.keys(t).length?t:null}var ai=/^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/;function ci(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"&&ai.test(e.cookie)?{source:"site_cookie",cookie:e.cookie}:null:null}function ui(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 li(e){let t=J(e)?e.hp:null;return J(t)&&typeof t.enabled=="boolean"}function un(e){let t=J(e)?e.hp:null;if(!J(t)||t.enabled!==!0)return $r;let n=ui(t.onsite);return{enabled:!0,propertyId:typeof t.propertyId=="string"&&t.propertyId!==""?t.propertyId:null,environment:typeof t.environment=="string"?t.environment:null,consentPurposes:ri(t.consent?.purposes),queryParamAllowlist:Vr(t.queryParamAllowlist)?t.queryParamAllowlist:null,anonymousId:ci(t.anonymousId),apiHost:qr(t.apiHost),holdouts:ii(t.holdouts),sampleRate:an(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 di=3e3;async function Fr(e,t,n=globalThis.fetch,r=di){try{let o=await n(ti(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 $r;if(!o.ok)return null;let s=await o.json();return li(s)?un(s):null}catch{return null}}var lt=e=>V(C("settings"),e);function Hr(e){try{let t=localStorage.getItem(lt(e));if(!t)return null;let n=JSON.parse(t);return n?.enabled===!0?n:null}catch{return null}}function Kr(e,t){try{t?.enabled===!0?localStorage.setItem(lt(e),JSON.stringify(t)):localStorage.removeItem(lt(e))}catch{}}function ln(e){try{localStorage.removeItem(lt(e))}catch{}}var fi={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},dt=()=>Date.now(),Gr=3e4,gn=55*1024;function pi(e,t=dt()){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 ce=e=>typeof TextEncoder<"u"?new TextEncoder().encode(e).length:Buffer.byteLength(e),dn=()=>typeof window<"u"&&typeof document<"u";function mi(){try{return!dn()||!window.localStorage?null:(window.localStorage.getItem("thg_hp_probe"),window.localStorage)}catch{return null}}var A,fn,pn,ft,mn,hn,zr,De,Ue,Ve,Jr,pt,Wr,mt,ht=class{constructor(t){Pn(this,A);this.o={...fi,...t},this.queue=[],this.timer=null,this.storage=mi(),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,dn()&&(window.addEventListener("pagehide",()=>this.flush({beacon:!0})),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flush()}),L(this,A,mt).call(this))}markFailing(){this.answered||(this.failing=!0)}replayPersisted(){return this.replayAllowed=!0,L(this,A,mt).call(this)}clearPersisted(){if(this.replayAllowed=!1,!!this.storage)try{let t=L(this,A,Ve).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,pn).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,fn).call(this)}flush(t={}){if(L(this,A,pn).call(this),this.queue.length===0)return Promise.resolve();if(t.beacon&&dn()&&typeof navigator<"u"&&navigator.sendBeacon)return L(this,A,zr).call(this),Promise.resolve();if(this.inflight)return this.inflight;let n=L(this,A,hn).call(this,this.queue,this.o.maxBatchEvents,this.o.maxBatchBytes).map(o=>{let s=L(this,A,pt).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,Ue).call(this,s);continue}await L(this,A,De).call(this,o,0,s,r)}})().finally(()=>{this.inflight=null,this.queue.length>=this.o.flushAt?this.flush():this.queue.length&&L(this,A,fn).call(this)}),this.inflight}};A=new WeakSet,fn=function(){this.timer||(this.timer=setTimeout(()=>this.flush(),this.o.flushIntervalMs),this.timer?.unref?.())},pn=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},ft=function(t){return JSON.stringify({batch:t,writeKey:this.o.writeKey,sentAt:new Date().toISOString()})},mn=function(){return`${this.o.apiHost.replace(/\/$/,"")}/v1/batch`},hn=function(t,n,r){let o=ce(L(this,A,ft).call(this,[])),s=[],i=[],c=o;for(let u of t){let d=ce(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},zr=function(){let t=this.queue;this.queue=[];let n=L(this,A,mn).call(this);for(let r of L(this,A,hn).call(this,t,this.o.maxBatchEvents,this.o.beaconSafeBytes)){let o=L(this,A,ft).call(this,r);if(ce(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,pt).call(this,r):null;i&&this.sending.add(i);continue}}L(this,A,De).call(this,r,0,L(this,A,pt).call(this,r))}},De=async function(t,n,r=null,o=this.epoch){r&&this.sending.add(r);let s=L(this,A,ft).call(this,t),i=0;try{let c=await fetch(L(this,A,mn).call(this),{method:"POST",headers:{"Content-Type":"text/plain"},body:s,keepalive:ce(s)<=this.o.beaconSafeBytes});if(c.ok)return this.failing=!1,this.answered=!0,L(this,A,Ue).call(this,r),L(this,A,mt).call(this),!0;let u=c.status===408||c.status===429||c.status>=500;if(u&&(i=pi(c.headers?.get?.("retry-after"))),!u)return L(this,A,Ue).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,Gr)*(.5+Math.random()),Math.min(i,Gr));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,Ue).call(this,r),!1):L(this,A,De).call(this,t,n+1,r,o)}},Ue=function(t){t&&(this.sending.delete(t),this.sinceRefusal.delete(t),L(this,A,Wr).call(this,t))},Ve=function(){let t=JSON.parse(this.storage.getItem(this.o.storageKey)||"[]");return Array.isArray(t)?t:[]},Jr=function(t,n){let r=i=>ce(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},pt=function(t){if(!this.storage||this.o.mayPersist&&!this.o.mayPersist())return null;try{let n={at:dt(),id:`${dt()}-${Math.random().toString(36).slice(2)}`,batch:t};return ce(JSON.stringify(n))+3>this.o.maxPersistedBytes?null:L(this,A,Jr).call(this,L(this,A,Ve).call(this),n)?n.id:null}catch{return null}},Wr=function(t){if(!(!t||!this.storage))try{let n=L(this,A,Ve).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{}},mt=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,Ve).call(this);t=r.filter(o=>Array.isArray(o?.batch)&&dt()-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,De).call(this,r.batch,0,r.id))return})().finally(()=>{this.draining=null}),this.draining):Promise.resolve()};var yn="3.32.0",wn="@thg-agentic/hyper-personalisation-web";var hi=100,gi=["source","medium","campaign","content","term"];function Yr(e){if(!e||typeof e!="object")return null;let t={};for(let n of gi){let r=e[n==="campaign"?"name":n];typeof r=="string"&&r&&(t[n]=r.slice(0,hi))}return Object.keys(t).length?t:null}var Zr=e=>V(C("visitCampaign"),e==null?null:String(e)),Ce=new Map;function Qr(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 Xr(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 eo(e,t,n){return typeof e?.tags=="object"&&e.tags!==null&&Number.isFinite(e.at)&&n-e.at<ut&&!(t&&e.sid&&e.sid!==t)?e:null}function gt(e,{sessionId:t=null,now:n=Date.now()}={}){return eo(Qr(Zr(e)),t,n)?.tags??null}function to(e,t,{sessionId:n=null,keepSession:r=!1,now:o=Date.now()}={}){let s=Zr(e),i=Qr(s),c=eo(i,n,o),u=c?.tags??t??null;return u?Xr(s,{tags:u,at:o,sid:(r?n:null)??c?.sid??null}):i&&Xr(s,null),u}function Sn(){Ce.clear(),We("visitCampaign")}var yi=new Set(["audiences","decisions","recommendations"]);var wi=Symbol.for("@thg-agentic/hyper-personalisation-web.replay"),Si=Symbol.for("@thg-agentic/hyper-personalisation-web.unreachable"),_i=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite-access");function bi(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 Ai="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";function ki(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 wt(e){if(typeof e!="string")return null;let t=ki(e.trim());return t===Ai?null:t}var no=Object.freeze({email_sha256:"sha256",phone_sha256:"sha256",accepts_marketing:"boolean",gender:"string",created_at:"date-time"}),Ii=/^\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 xi(e){if(typeof e!="string"||!Ii.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 vi(e,t){return t===null?null:e==="sha256"?wt(t)??void 0:e==="date-time"?t instanceof Date?Number.isNaN(t.getTime())?void 0:t.toISOString():xi(t)?t:void 0:typeof t===e?t:void 0}function Ei(e,t){let n={},r=[];for(let[o,s]of Object.entries(e)){let i=Object.hasOwn(no,o)?no[o]:null,c=i?vi(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 ro=!1,oo=!1;function Ci(){oo||(oo=!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 Oi(e){!e||ro||(ro=!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 Pi(e){try{return ce(JSON.stringify(e))}catch{return 0}}function yt(e){return e&&typeof e.context=="object"&&e.context!==null?e.context:e}function Li(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 so(e){let t=ae(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:wn,libraryVersion:yn,writeKey:"web",queryParamBlocklist:[],debug:!1,validate:null,consentTimeoutMs:5e3,...e,apiHost:t};Je(n.storageNames),Xe();let r=!!n.consent;r||Ci();let o=null;n.getConsent=()=>o?o.stamp():er();let s=()=>!r||o?.status==="granted";Li(n.propertyId,n.writeKey);let i=r&&n.holdAcrossPages?Xn(V(C("held"),n.writeKey)):null,c=i?.read()??{items:[],anonymousId:null};n.mintAnonymousId!==void 0&&Oi(n.debug);let u=Yn(n,{carried:c.anonymousId,mayStore:s,orOwn:!0}),d=Ur({name:C("session"),domain:n.consentCookieDomain??null,mayStore:s}),f=n.getSessionId;n.getSessionId=()=>H(R(f,null))??d.get();let p=kr(C("preview"),n.consentCookieDomain??null),m=()=>H(R(f,null))??B(C("session")),v=Yr(typeof location>"u"?null:Ut(location.search)),w=(a=null)=>{p||to(n.propertyId,a,{sessionId:m(),keepSession:s()})},I=(a,l)=>n.debug&&console.warn("[hp]",a,l??""),b=n.transport??new ht({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,O=()=>{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=br({key:V(C("decisions"),n.propertyId),mayStore:s});n.getDecisions??(n.getDecisions=g.current);let y=H(R(n.getUserId,null)),P=null,N=null,$=y?Pe(n.identityToken):null,G=null,F=null,Se=null,W=null,re=null,_e=new Set,be=new Set;function M(a){if(a.type==="page"&&(re=null),a.type==="track"&&a.event==="Product Viewed"){let k=a.properties?.products?.[0]?.product_id;re=typeof k=="string"&&k?k:re}if(a.type!=="track"||a.event!=="Cart Updated")return;let l=a.properties?.value,S=a.properties?.products;Se=Array.isArray(S)?sn(S):null,W=te(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&&!jr(n.plan,U))return null;let T={messageId:k?.messageId??se(),timestamp:k?.timestamp??new Date().toISOString(),anonymousId:H(R(n.getAnonymousId,null)),userId:y??null,...a,context:Kn(n,yt(l))};if(T.properties&&(T.properties=Mt(T.properties)),typeof T.properties?.href=="string"&&(T.properties.href=Vt(T.properties.href,n)),!S&&!Or(T.anonymousId,n.sampleRate))return n.debug&&console.debug("[hp] not sent: outside the sample",T),null;if(n.beforeSend){let ee;try{ee=n.beforeSend(T)}catch(Io){return console.warn("[hp] beforeSend failed; the event was not sent",Io),null}if(!ee)return null;let{type:z,event:Cn,messageId:Ao,timestamp:ko}=T;T={...ee,type:z,messageId:Ao,timestamp:ko,...Cn?{event:Cn}:{}}}if(n.validate){let ee=n.validate(T,{producer:"web"});if(!ee.valid){let z=`[hp] invalid ${T.event??T.type}:
2
+ ${ee.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=Pi(T);return Ct>gn?(I(`${T.event??T.type} not sent: ${Ct} bytes, over the ${gn}-byte limit for one event`),null):(So(T,S),T)}function Q(a){if((a.type==="track"||a.type==="page")&&wo(a),n.onEvent)try{n.onEvent(a)}catch(l){console.warn("[hp] onEvent observer failed",l)}}let X=()=>r&&o?.state?.personalisation===!0,Fe=()=>Lr(R(n.getSessionId,null),n.propertyId),xt=!1,An=null;function wo(a){try{if(X()){Fe();let l=Dr(a.event,a.properties,gt(n.propertyId,{sessionId:m()}));a.type==="track"&&vr(en(l)),a.event==="Preferences Stated"&&a.properties?.source==="onsite"&&kn([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 kn(a,l){let S=(An??n.onsite)?.forms?.find?.(k=>k?.slot===l);gr(n.propertyId,hr(a,S?.questions))}function He(a=!1,l=void 0){Er(),yr(l),(a||xt)&&Tr(),xt=!1}function vt(){d.forget(),g.forget(),Et.clear(),u?.forget(),He(!0),Sn()}function So(a,l){!r||l||o.admits()?(Q(a),b.enqueue(a)):o.hold(a)}let E=(a,l,S)=>K({type:"track",event:a,properties:l??{}},S),Et=new Set,_o=(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=Sr({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()),Q(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?.(),Sn()),K({type:"track",event:"Consent Updated",properties:{action:a,state:l}},void 0,k),k&&b.flush()}}),o.start(),w());let In=()=>n.holdout?Zt(n.holdout):null,xn=()=>Qt(n.holdout,H(R(n.getAnonymousId,null))).group;function bo(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)?Ar(U.slot,k):null;return T?T==="default"?{...U,variant:T,decision_id:null}:{...U,variant:T}:U})}}function vn(a,l){if(p)return null;let S=a?.exposure,k=S?.holdout===!0,U=bo(a,k);return g.remember(_r(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??In()?.holdout_share??null,personalised_share:S.personalised_share??In()?.personalised_share??null,..._o(S.surface,k,U)},l))}function En(a){return y&&vt(),y=null,P=null,N=null,$=null,a}return pr({track:(a,l,S)=>a==="Signed Out"?En(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??$n(),previous_message_id:O()}},{page:{type:S},...yt(l)??{}});return k&&_(k.messageId),k},identify(a,l,S){let{userId:k,...U}=a&&typeof a=="object"?a:{},T=Pe(yt(l)?.identity_token);if(k!==void 0){let z=H(k);$=z?z===y?T??$:T:null,S===Ne?N=z:P&&z&&z!==P?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&&(P=z)}else T&&y&&($=T);let{identity_token:Ct,...ee}=yt(l)??{};return K({type:"identify",traits:Ei(U,n.debug)},$?{...ee,identity_token:$}:ee)},reset(){y&&vt(),y=null,P=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:vn,surfaceViewed({surface:a}={},l){if(!yi.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=Dn({sessionId:Ke(R(n.getSessionId,null),S),surface:a});return U?vn({exposure:{token:U,surface:a,holdout:k==="holdout"}},l):null},inHoldout:()=>xn()!=="personalised",personalisationGroup:xn,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",bi(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=>En(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(),en(Ee())}catch{return{}}},get consent(){return o?o.state:null},servingHeaders:()=>Ht(o?.state??null),get lastPageMessageId(){return O()},get anonymousId(){return H(R(n.getAnonymousId,null))},[_i](){return{writeKey:n.writeKey,library:{name:wn,version:yn},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()&&kn(a,l)},started:a=>{An=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:gt(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:te(S))??te(R(n.getCurrency,n.currency)),answers:X()?Yt(n.propertyId):null}},sessionSignals:()=>X()?(Fe(),{...Ee(),campaign:gt(n.propertyId,{sessionId:m()}),answers:Yt(n.propertyId)}):null,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}:{},...re?{product_id:re}:{},...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))}},[Si](){b.markFailing?.()},[wi](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}}}})}var $e=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite"),Y=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.pending"),je=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.listeners"),St=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.suppressed"),Ti=Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.page-values"),Ni=["shown","submitted","apply","closed","held","nothing"],io=10,ue=()=>typeof window>"u"?null:window;function Be(){try{for(let{resolve:e}of ue()?.[Y]?.splice(0)??[])e(!1)}catch{}}var ye=Object.freeze({open(e){try{let t=ue();if(!t||typeof e!="string")return Promise.resolve(!1);if(t[$e])return t[$e].open(e);if(t[Y]??(t[Y]=[]),t[Y].length<io)return new Promise(n=>t[Y].push({slot:e,resolve:n}))}catch{}return Promise.resolve(!1)},show(e){return ye.open(e)},on(e,t){var n;try{let r=ue();return!r||!Ni.includes(e)||typeof t!="function"?()=>{}:(r[je]??(r[je]={}),((n=r[je])[e]??(n[e]=new Set)).add(t),()=>r[je][e].delete(t))}catch{return()=>{}}},suppress(e="page"){try{let t=ue();if(!t)return;(t[St]??(t[St]=new Set)).add(String(e)),t[$e]?.suppress()}catch{}},unsuppress(e){try{let t=ue()?.[St];e===void 0?t?.clear():t?.delete(String(e))}catch{}},values(e){try{let t=ue();t&&(t[Ti]=e&&typeof e=="object"?{...e}:{})}catch{}},ready(){try{let e=ue();if(!e)return Promise.resolve([]);if(e[$e])return Promise.resolve(ye.debug());if(e[Y]??(e[Y]=[]),e[Y].length<io)return new Promise(t=>e[Y].push({slot:null,resolve:()=>t(ye.debug())}))}catch{}return Promise.resolve([])},debug(){try{return ue()?.[$e]?.debug()??[]}catch{return[]}}});function ao(e){let t=typeof document>"u"?null:document.currentScript?.src;return t?new URL(e,t).href:null}var _t=new Map;function co(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 Ri=ao("onsite.min.js"),_n=()=>co(Ri,Symbol.for("@thg-agentic/hyper-personalisation-web.onsite.module"));var bn=Symbol.for("@thg-agentic/hyper-personalisation-web.bootstrap"),Mi=Symbol.for("@thg-agentic/hyper-personalisation-web.drain"),Di=Symbol.for("@thg-agentic/hyper-personalisation-web.carry"),uo=Symbol.for("@thg-agentic/hyper-personalisation-web.replay"),Ui=Symbol.for("@thg-agentic/hyper-personalisation-web.unreachable"),Vi=Symbol.for("@thg-agentic/hyper-personalisation-web.assignment"),$i=Symbol.for("@thg-agentic/hyper-personalisation-web.recommendation-context"),kt=e=>e?()=>B(e):()=>null,po={didomi:e=>rr({purposes:e.purposes}),onetrust:e=>or({groups:e.groups,impliedConsent:e.impliedConsent}),cookie:e=>sr({name:e.name,categories:e.categories,refusedValue:e.refusedValue,source:e.source,changeEvent:e.changeEvent}),forwarded:e=>ir({name:e.name}),static:e=>{if(!e.state||typeof e.state!="object")throw new Error('consent.state is required for provider "static"');return ar(e.state)}},lo=Object.keys(po),we=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),bt=e=>typeof e=="string"&&e!=="",ji=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),mo=e=>we(e)&&typeof e.read=="function";function Bi(e,t={}){let n=[];if(!we(e))return["config must be { writeKey, apiHost? }"];bt(e.writeKey)||n.push("writeKey is required"),ae(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(!mo(r)&&!(we(r)&&lo.includes(r.provider))&&n.push(`consent must be a consent adapter or { provider: ${lo.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&&!ji(t.dataLayer.ignore)&&n.push("dataLayer.ignore must be an array of strings")):n.push("dataLayer must be an object")),n}function qi(e,t,n){if(mo(e))return Kt(e,t.consentPurposes);let{provider:r,...o}=e,s=n?.consent?.[r]??po[r];return Kt(s(o),t.consentPurposes)}var It=(e,t,n)=>`${e??""}|${t??""}${n?"|v":""}`,Fi=(e,t,n,r)=>e===It(t,n,!0)||!r&&e===It(t,n,!1),Hi=e=>{if(e.context?.identity_token===void 0)return e;let{identity_token:t,...n}=e.context;return{...e,context:n}},ho=e=>{try{return sessionStorage.getItem(e)}catch{return null}};function Ki(e,t){let n=H(t?.userId),r=wt(t?.emailSha256);if(!n&&!r)return null;let o=ho(V(C("identified"),e));return Fi(o,n,r,n!==null&&Pe(t?.token)!==null)?null:{...n?{userId:n}:{},...r?{email_sha256:r}:{}}}async function Gi({writeKey:e,apiHost:t},n){if(n.settings!==void 0)return{settings:un(n.settings),revalidated:null};let r=Fr(t,e),o=Hr(e);if(o)return{settings:o,revalidated:r,fetched:r};let s=await r;return s?{settings:s,revalidated:r,fetched:r}:{settings:cn,revalidated:null,fetched:r}}function go(e,t){let n=t??{},r=typeof window<"u"?window:null;if(r?.[bn])return r[bn];let o=Zn(e?.writeKey,()=>{let{analytics:i}=Te(B(C("consent")));return i===!0||i===null&&n.holdAcrossPages===!0}),s=Xi(e,n,o);if(r){let i=n.extend?.getSessionId??kt(n.identityCookies?.sessionId),c=kt(n.identityCookies?.anonymousId);r[Vi]=({slot:u,arm:d}={})=>Mn({sessionId:Ke(i(),c()),slot:u,arm:d}),r[bn]=s,r[Di]=o,r[Mi]?.(s)}return s}function zi(){let e=globalThis.performance?.now?.();return new Date(Date.now()-(Number.isFinite(e)?e:0)).toISOString()}function fo(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(Pt(e,r(n.exposures)))}catch(s){console.warn("[hp] autocapture not started:",s?.message??s)}return()=>{for(let s of o)s()}}var Ji=1e3;function Wi(e,t,n,r){if(!t)return Be();let o=n.onsite?_n():null;o?.catch(()=>{}),(r?Promise.race([r.then(i=>i??n),new Promise(i=>setTimeout(()=>i(n),Ji))]):Promise.resolve(n)).then(i=>{let c=i.enabled?i.onsite:null;if(!c)return Be();let u=t===!0?{}:t;return(o??_n()).then(d=>d.startOnsite(e,{...u,settings:u.settings??c}))}).catch(i=>{Be(),console.warn("[hp] onsite not started:",i?.message??i)})}function At(e){return e.close(),Be(),null}async function Xi(e,t,n){try{let r=Bi(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([Gi(e,t),Promise.resolve(t.identity).catch(()=>null)]),d=i?s:null,f=!1,p=()=>f&&d&&Kr(o,d);if(i?.then(g=>{g&&(d=g,g.enabled?p():ln(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!==cn)return console.warn("[hp] not started: this write key covers several properties, so propertyId is required"),At(n);let{preset:v}=t,w=Ki(m,u),I=t.debug===!0||s.debug?.enabled===!0||fr(s.debug?.tokenSha256??null,C("debug")),b=H(u?.userId),x=so({apiHost:Br(e.apiHost,s.apiHost),servingHost:ae(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:qi(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"){ln(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),P=H(g.userId),N=wt(g.traits?.email_sha256),$=!!g.context?.identity_token||ho(y)===It(P,N,!0);try{sessionStorage.setItem(y,It(P,N,$))}catch{}}t.extend?.onEvent?.(Hi(g))}});typeof window<"u"&&(window[$i]=()=>x.recommendationContext()),c?.then(g=>g===null&&x[Ui]());for(let[g,y,P]of n.take())try{x[uo](g,y,P)}catch(N){console.warn(`[hp] carried ${g} failed`,N)}x[uo]("page",[t.pageType?{type:t.pageType}:{}],{messageId:se(),timestamp:zi()});let h=fo(x,t.autocapture),O=x.page;x.page=Wt("page",(...g)=>{let y=O(...g);return h(),h=fo(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]||[],dr(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=ye,Wi(x,t.onsite,s,i),x}catch(r){return console.warn("[hp] not started:",r?.message??r),At(n)}}function yo(e){e.initialized=!0,go(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=ye);j.initialized||(j._config?yo(j):j.load=(e,t)=>{j._config=e,j._options=t??{},yo(j)});})();
@@ -1,4 +1,4 @@
1
- (()=>{var M=Array.from({length:11},(n,e)=>e/10);function F(n,e){if(!n.isIntersecting)return!1;let{intersectionRect:s,boundingClientRect:r,rootBounds:c}=n;if(!s||!r)return!0;let f=s.width*s.height,a=r.width*r.height,u=c?Math.min(a,c.width*c.height):a;return u>0&&f/u>=e}function R(n){let{selector:e,onViewable:s,visibleRatio:r=.5,dwellMs:c=1e3,root:f=document}=n,a=new Map,u=new WeakSet,l=new Set,p=i=>{a.has(i)||a.set(i,setTimeout(()=>{a.delete(i),s(i)&&(h?.unobserve(i),l.delete(i))},c))},d=i=>{clearTimeout(a.get(i)),a.delete(i)},h=typeof IntersectionObserver>"u"?null:new IntersectionObserver(i=>{for(let E of i){let o=E.target;if(!F(E,r)){l.delete(o),d(o);continue}l.add(o),b()&&p(o)}},{threshold:M}),b=()=>typeof document>"u"||document.visibilityState!=="hidden",x=()=>{if(b())for(let i of l)p(i);else for(let i of l)d(i)};document.addEventListener("visibilitychange",x);let y=()=>{for(let i of f.querySelectorAll(e))u.has(i)||(u.add(i),h?.observe(i))},_=typeof MutationObserver>"u"?null:new MutationObserver(()=>y()),v=()=>{y(),_?.observe(f===document?document.body:f,{childList:!0,subtree:!0})},w=f===document&&!document.body;return w?document.addEventListener("DOMContentLoaded",v,{once:!0}):v(),()=>{w&&document.removeEventListener("DOMContentLoaded",v),document.removeEventListener("visibilitychange",x),h?.disconnect(),_?.disconnect();for(let i of a.values())clearTimeout(i);a.clear(),l.clear()}}function T(n){if(typeof n!="string")return null;try{let e=new URL(n);return e.protocol==="https:"?e.href:null}catch{return null}}var O=n=>n!==null&&typeof n=="object"&&!Array.isArray(n);var P=`.pr ul{list-style:none;margin:0;padding:0;display:grid;gap:12px}
1
+ (()=>{var P=Array.from({length:11},(t,e)=>e/10);function F(t,e){if(!t.isIntersecting)return!1;let{intersectionRect:s,boundingClientRect:n,rootBounds:c}=t;if(!s||!n)return!0;let f=s.width*s.height,a=n.width*n.height,u=c?Math.min(a,c.width*c.height):a;return u>0&&f/u>=e}function R(t){let{selector:e,onViewable:s,visibleRatio:n=.5,dwellMs:c=1e3,root:f=document}=t,a=new Map,u=new WeakSet,l=new Set,p=i=>{a.has(i)||a.set(i,setTimeout(()=>{a.delete(i),s(i)&&(h?.unobserve(i),l.delete(i))},c))},d=i=>{clearTimeout(a.get(i)),a.delete(i)},h=typeof IntersectionObserver>"u"?null:new IntersectionObserver(i=>{for(let E of i){let o=E.target;if(!F(E,n)){l.delete(o),d(o);continue}l.add(o),b()&&p(o)}},{threshold:P}),b=()=>typeof document>"u"||document.visibilityState!=="hidden",_=()=>{if(b())for(let i of l)p(i);else for(let i of l)d(i)};document.addEventListener("visibilitychange",_);let y=()=>{for(let i of f.querySelectorAll(e))u.has(i)||(u.add(i),h?.observe(i))},x=typeof MutationObserver>"u"?null:new MutationObserver(()=>y()),v=()=>{y(),x?.observe(f===document?document.body:f,{childList:!0,subtree:!0})},w=f===document&&!document.body;return w?document.addEventListener("DOMContentLoaded",v,{once:!0}):v(),()=>{w&&document.removeEventListener("DOMContentLoaded",v),document.removeEventListener("visibilitychange",_),h?.disconnect(),x?.disconnect();for(let i of a.values())clearTimeout(i);a.clear(),l.clear()}}function $(t,e){try{return new Intl.NumberFormat(t||void 0,{style:"currency",currency:e})}catch{return null}}function T(t){if(typeof t!="string")return null;try{let e=new URL(t);return e.protocol==="https:"?e.href:null}catch{return null}}var D=t=>t!==null&&typeof t=="object"&&!Array.isArray(t);var C=`.pr ul{list-style:none;margin:0;padding:0;display:grid;gap:12px}
2
2
  .pr-c ul{grid-auto-flow:column;grid-auto-columns:minmax(132px,42%);overflow-x:auto;scroll-snap-type:x mandatory;scroll-behavior:smooth;padding-bottom:6px;overscroll-behavior-x:contain}
3
3
  .pr-c li{scroll-snap-align:start}
4
4
  .pr-g ul{grid-template-columns:repeat(auto-fill,minmax(132px,1fr))}
@@ -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}}`,C=["left","center","right"];function z(n,e){try{let s=new Intl.NumberFormat(n||void 0,{style:"currency",currency:e});return r=>s.format(r)}catch{return s=>s.toFixed(2)}}function $(n,e,s){let{el:r}=s,c=O(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=>O(o)&&typeof o.product_id=="string"&&T(o.url)).slice(0,f);if(a.length===0)return;let u=O(e.show)?e.show:{},l=e.layout==="grid";n.classList.add(l?"pr-g":"pr-c"),C.includes(e.align)&&n.classList.add(`a-${e.align}`),l||(n.setAttribute("role","region"),n.setAttribute("aria-label","Products"));let p=r("style");p.textContent=P;let d=r("ul");d.setAttribute("role","list");let h=(o,t)=>({product_id:o.product_id,...typeof o.name=="string"?{name:o.name}:{},...Number.isFinite(o.price)?{price:o.price}:{},position:t}),b=typeof c.recommendation_request_id=="string"&&!s.preview?s.client:null,x=new Map,y=c.recommendation_request_id,_=s.seen??new Set,v=null,w=()=>{clearTimeout(v),!(!b||_.has(y))&&(_.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,t)=>h(o,t+1)),viewable:[...x.values()].sort((o,t)=>o.position-t.position)}))};for(let[o,t]of a.entries()){let L=o+1,S=r("li","pc");S.dataset.hpProduct=t.product_id,S.dataset.hpPosition=String(L);let g=r("a","pa"),D=typeof t.name=="string"?t.name:"",I=T(t.image);if(I){let m=r("img","pi");m.alt=u.name===!1?D:"",m.loading="lazy",m.decoding="async",m.src=I;let A=r("span","pf");A.append(m),g.append(A)}else g.append(r("span","pf e"));if(u.name!==!1&&g.append(r("span","pn",D)),u.price!==!1&&Number.isFinite(t.price)){let m=z(s.lang,t.currency),A=r("span","pp");if(A.append(r("span","",m(t.price))),Number.isFinite(t.compare_at_price)&&t.compare_at_price>t.price){let N=r("s","",m(t.compare_at_price));N.setAttribute("aria-label",`was ${m(t.compare_at_price)}`),A.append(" ",N)}g.append(A)}u.name===!1&&!I&&g.setAttribute("aria-label",D||t.product_id),typeof e.button=="string"&&e.button&&g.append(r("span","btn bs pb",e.button)),g.href=T(t.url),g.rel="noopener",g.addEventListener("click",m=>{if(s.preview)return m.preventDefault();w(),b?.productClicked({recommendation_request_id:c.recommendation_request_id,interaction:"navigate",products:[h(t,L)]}),s.engaged("click",void 0,{position:L,products:[h(t,L)]})}),S.append(g),d.append(S)}n.append(p,d);let i=l?null:q(n,d,r),E=b&&!_.has(y)&&R({selector:"[data-hp-product]",root:s.root,onViewable(o){let t=Number(o.dataset.hpPosition);return x.has(t)||x.set(t,{position:t,product_id:o.dataset.hpProduct,viewable_at:new Date().toISOString()}),v??(v=setTimeout(w,0)),!0}});return()=>{i?.disconnect(),E&&E()}}function q(n,e,s){let r=["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}`,n.classList.toggle("pr-f",d[0]),n.style.setProperty("--ph",`${p}px`),r[0].setAttribute("aria-disabled",String(d[1])),r[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:$};})();
22
+ @media (prefers-reduced-motion:reduce){.pr-c ul{scroll-behavior:auto}}`,z=["left","center","right"];function q(t,e){let s=$(t,e);return s?n=>s.format(n):n=>n.toFixed(2)}function M(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 h=(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,_=new Map,y=c.recommendation_request_id,x=s.seen??new Set,v=null,w=()=>{clearTimeout(v),!(!b||x.has(y))&&(x.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)=>h(o,r+1)),viewable:[..._.values()].sort((o,r)=>o.position-r.position)}))};for(let[o,r]of a.entries()){let L=o+1,S=n("li","pc");S.dataset.hpProduct=r.product_id,S.dataset.hpPosition=String(L);let g=n("a","pa"),O=typeof r.name=="string"?r.name:"",I=T(r.image);if(I){let m=n("img","pi");m.alt=u.name===!1?O:"",m.loading="lazy",m.decoding="async",m.src=I;let A=n("span","pf");A.append(m),g.append(A)}else g.append(n("span","pf e"));if(u.name!==!1&&g.append(n("span","pn",O)),u.price!==!1&&Number.isFinite(r.price)){let m=q(s.lang,r.currency),A=n("span","pp");if(A.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)}`),A.append(" ",N)}g.append(A)}u.name===!1&&!I&&g.setAttribute("aria-label",O||r.product_id),typeof e.button=="string"&&e.button&&g.append(n("span","btn bs pb",e.button)),g.href=T(r.url),g.rel="noopener",g.addEventListener("click",m=>{if(s.preview)return m.preventDefault();w(),b?.productClicked({recommendation_request_id:c.recommendation_request_id,interaction:"navigate",products:[h(r,L)]}),s.engaged("click",void 0,{position:L,products:[h(r,L)]})}),S.append(g),d.append(S)}t.append(p,d);let i=l?null:V(t,d,n),E=b&&!x.has(y)&&R({selector:"[data-hp-product]",root:s.root,onViewable(o){let r=Number(o.dataset.hpPosition);return _.has(r)||_.set(r,{position:r,product_id:o.dataset.hpProduct,viewable_at:new Date().toISOString()}),v??(v=setTimeout(w,0)),!0}});return()=>{i?.disconnect(),E&&E()}}function V(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:M};})();