@thg-agentic/hyper-personalisation-web 3.18.0 → 3.22.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
@@ -1,7 +1,7 @@
1
1
  # @thg-agentic/hyper-personalisation-web
2
2
 
3
3
  The browser SDK for THG Hyper-Personalisation, a customer data platform. It implements the event
4
- specification (spec 1.10, stamped on every event as `context.spec.version`) for any storefront: it
4
+ specification (spec 1.15, stamped on every event as `context.spec.version`) for any storefront: it
5
5
  sends events in the Segment wire format, applies consent strictly whichever CMP the site uses, reads
6
6
  the GA4 `dataLayer` the site already pushes to, and has no runtime dependencies.
7
7
 
@@ -45,12 +45,12 @@ collects, is a settings change and never a deploy:
45
45
  | From the settings (`hp`) | |
46
46
  |---|---|
47
47
  | `enabled` | Anything but `true` leaves the SDK off: no events, no cookie, nothing stored. |
48
- | `propertyId` | `context.source.property_id`. Null for a key scoped to several properties; the page then passes `propertyId`. |
48
+ | `propertyId` | `context.source.property_id`: the source's default property. A `propertyId` the page passes wins over it (since 3.20); a key scoped to several properties with no default needs one. |
49
49
  | `environment` | `context.source.environment`. |
50
50
  | `consent.purposes` | The purposes the property asks for. Only those are reported; the rest read as unanswered. Strict is the only mode. |
51
51
  | `queryParamAllowlist` | Query parameters kept on page URLs (plus campaign parameters). |
52
52
  | `anonymousId` | Where device ids come from, chosen per source in the console (since 3.6): `{ source: 'site_cookie', cookie }` or `{ source: 'hp_cookie' }`. See [Device ids](#device-ids). |
53
- | `apiHost` | Where events go, when not the host the settings came from. |
53
+ | `apiHost` | Where events go when the page set no `apiHost` (an `https://` host only). A page's own `apiHost` is a proxy and carries events too (since 3.20). |
54
54
  | `plan.track` | Segment's tracking plan: an event with `enabled: false` is dropped at the source. The console's blocked events arrive here. |
55
55
  | `sampleRate` | The share of visitors events are sent for, by a hash of the anonymous id (since 3.18). Absent: 1. |
56
56
  | `debug` | `{ enabled, tokenSha256 }`: console logging for everyone, or for a session opened with `?hp_debug=<token>` whose SHA-256 is `tokenSha256` (since 3.18). `?hp_debug=` ends it. |
@@ -178,11 +178,18 @@ and `productAdded` (your search engine's id for the result set, such as Algolia'
178
178
  `newsletterSubscribed`. A search page sends `productsSearched` with its results and never a
179
179
  `productListViewed` for the same grid.
180
180
 
181
+ Since 3.19 (spec 1.12), a search box's suggestions are their own event:
182
+
183
+ | Method | Event | Notes |
184
+ |---|---|---|
185
+ | `productsSearched` | Products Searched | A submitted search and the results page it produced: `query`, the results in `products`, and `pagination` with `total_results` |
186
+ | `searchSuggestionsViewed` | Search Suggestions Viewed | The products a search box suggested for a partly typed `query`, sent once per suggestion set with the products seen (`position` in the suggestions). Give each set its own `search_request_id`, and a click on one of its products carries that id on `productClicked`. Never `productsSearched`: suggestions and results are ranked by different models and are measured apart |
187
+
181
188
  ## Options
182
189
 
183
190
  | Option | Default | |
184
191
  |---|---|---|
185
- | `apiHost` | the HP API | Only for a first-party proxy. Events are POSTed to `${apiHost}/v1/batch`. |
192
+ | `apiHost` | the HP API | Only for a first-party proxy. The settings and the events both go to it: events are POSTed to `${apiHost}/v1/batch` (since 3.20 a host in the settings never overrides it). |
186
193
  | `writeKey` | `'web'` | The source's publishable key, `hp_pk_…`. Sent in the batch body. |
187
194
  | `propertyId` | required | `context.source.property_id`. |
188
195
  | `channel`, `market`, `environment` | `null` | The rest of `context.source`. |
@@ -190,8 +197,8 @@ and `productAdded` (your search engine's id for the result set, such as Algolia'
190
197
  | `shipToCountry`, `getShipToCountry` | `null` | ISO-3166 alpha-2 destination, per event. |
191
198
  | `locale`, `getLocale` | `null` | The storefront locale served (BCP-47), per event. |
192
199
  | `country` | `null` | Visitor country; the ingest derives it at the edge and overwrites this. |
193
- | `consent` | none | A consent adapter (see below). Makes the SDK strict. |
194
- | `consentTimeoutMs` | `5000` | How long events wait for the CMP before they are dropped. |
200
+ | `consent` | none | A consent adapter (see below). Makes the SDK strict. Without one the SDK sends under your lawful basis (`basis: 'host'`) and says so once in the console (3.19). |
201
+ | `consentTimeoutMs` | `5000` | How long the CMP has to answer before the status is `unknown`. Events stay held, in memory, until it answers. |
195
202
  | `consentCookieDomain` | host only | `Domain` for the consent cookie. |
196
203
  | `onConsentStatus` | none | Called with the gate's status: `granted`, `denied` or `unknown` (timed out). |
197
204
  | `storageNames` | `thg_hp_*` | Rename what the SDK stores; see [Storage](#storage). |
@@ -200,7 +207,7 @@ and `productAdded` (your search engine's id for the result set, such as Algolia'
200
207
  | `queryParamAllowlist` | none | Keep only these query params (plus campaign params) in `context.page`. Patterns are anchored and case-insensitive. |
201
208
  | `queryParamBlocklist` | `[]` | Strip these params. Ignored when an allowlist is given. |
202
209
  | `sensitiveParamAllowlist` | `[]` | Whatever else is configured, a param is always dropped from every reported URL when its name contains `email`, `token`, `password`, `secret`, `auth`, `session`, `phone`, `address`, `card`, `customerid` and the like (see `SENSITIVE_PARAM_FRAGMENTS` in `src/context.js`), or when its value is an email address or a card-length number — campaign params and the referrer included. This exempts names from the first rule, for a false positive such as an `author` filter; nothing exempts a value. |
203
- | `getAnonymousId`, `getUserId`, `getSessionId`, `getRenderId` | none | Identity accessors. Without `getSessionId` the SDK keeps its own session (see [Session ids](#session-ids)); a missing or empty device id gives way to the SDK's own (see [Device ids](#device-ids)). |
210
+ | `getAnonymousId`, `getUserId`, `getSessionId` | none | Identity accessors. Without `getSessionId` the SDK keeps its own session (see [Session ids](#session-ids)); a missing or empty device id gives way to the SDK's own (see [Device ids](#device-ids)). |
204
211
  | `getExperiments`, `getAudiences`, `getDecisions`, `getRecommendations`, `getExtensions` | none | Read per event into the matching `context` field. Without `getDecisions`, `context.decisions` is what `recordExposure` last recorded per slot. |
205
212
  | `pageType` | `null` | `context.page.type` before the first `page()` call. |
206
213
  | `onEvent` | none | Observer for every event that will be sent. |
@@ -211,8 +218,49 @@ and `productAdded` (your search engine's id for the result set, such as Algolia'
211
218
  The client has one method per browser event in the spec, plus `track`, `page`, `identify`,
212
219
  `reset`, `signedOut`, `flush`, `servingHeaders`, and the read-only `consent` and
213
220
  `lastPageMessageId`. Every method takes an optional last argument of context overrides, either as
214
- the overrides or as `{ context }`. An event method returns the event, or null when the tracking
215
- plan disables it. Declarations are in `types/`, and event properties are typed from the registry.
221
+ the overrides or as `{ context }`. An event method returns the event, or null when it is not sent
222
+ (the tracking plan disables it, the visitor is outside the sample, or `beforeSend` drops it).
223
+ Declarations are in `types/`, and event properties are typed from the registry.
224
+
225
+ - **No method throws into your page** (3.19). A call that fails, whatever it was passed, logs a
226
+ warning and answers what a client that cannot decide answers, failing closed: an event method
227
+ null, `inHoldout()` true, `personalisationGroup()` `'excluded'`, `servingHeaders()` and
228
+ `recommendationContext()` `{}`, `flush()` a resolved promise. The one exception is
229
+ `throwOnInvalid`, which you ask for in development.
230
+ - **One event is at most 55 KB** of JSON (3.19), so that it can always travel in a keepalive request
231
+ at unload. A bigger one is not sent and its method returns null; with `debug` the SDK logs it.
232
+ Segment's limit is 32 KB; this one is higher so that a long product list still fits.
233
+ - **A sign-out forgets the visit** (3.19). `signedOut()` (or `track('Signed Out')`, since 3.20), or `reset()` while a user is signed in,
234
+ also forgets the SDK's session, the decisions in force and the recommendation context, so the
235
+ next person on a shared device inherits none of them. `reset()` with nobody signed in changes
236
+ nothing else, so a host that calls it on every page keeps its session. The SDK's own device id
237
+ starts afresh too, as Segment's `analytics.reset()` does; a device id from the site's own cookie
238
+ (`getAnonymousId`, or a `site_cookie` source) stays, because the site owns it. On one page,
239
+ `identify` with a different `userId` than an earlier `identify` named is a sign-out first; the
240
+ same user again, a first `identify`, a `getUserId` cookie or bootstrap's `identity` option of
241
+ another form changes nothing (with `debug`, a mismatch with `identity` is logged). Across
242
+ pages, call `signedOut()` or `reset()` at the sign-out.
243
+ - **A refusal forgets the visit at once** (3.19): the kept recommendation context and the session
244
+ signals go when consent is refused or personalisation withdrawn, even if `beforeSend` drops the
245
+ `Consent Updated` event. Before the client starts, `hp.recommendationContext()` reads the kept
246
+ visit only when the consent cookie grants personalisation.
247
+ - **Retries wait out `Retry-After`** on a 429 or 5xx (3.19), as well as backing off exponentially
248
+ with jitter, up to 30 seconds. Cross-origin, the HP ingest exposes the header to the page
249
+ (`Access-Control-Expose-Headers: Retry-After`, from the `ingest-gateway-v1.13.0` release);
250
+ a same-origin proxy needs nothing. Where the header cannot be read the backoff alone applies.
251
+ - **A refusal sends only the withdrawal** (3.20): what was collected under the grant and not yet sent
252
+ is dropped, including batches already cut while one was on the wire.
253
+ - **`identify` sends only the spec's traits** (3.20): `email_sha256` and `phone_sha256` (SHA-256 hex,
254
+ or base64 sent as hex), `accepts_marketing` (boolean), `gender` (string) and `created_at` (RFC 3339
255
+ date-time). Anything else, a raw `email` or `phone` included, is not sent; with `debug` the dropped
256
+ keys are logged.
257
+ - **A listing must name its own `category`** (3.22): a Product List Viewed without one, and its
258
+ facets, no longer count as browsing (`listViews`, `browseViews`, `browseShare`), with or without
259
+ `browse_categories`, and product views after it credit no category page. Send `category` on every
260
+ category listing. See [Visit traits](#visit-traits).
261
+ - **The tracking plan covers every call** (3.20): it is keyed as the gateway keys it, a track's
262
+ event name or otherwise the call's type (`page`, `identify`), so an allow-list that omits `page`
263
+ sends no page views. A consent withdrawal is sent whatever the plan says.
216
264
 
217
265
  ## Calling the serving API
218
266
 
@@ -372,6 +420,25 @@ A session audience's rules name fields the SDK keeps for the visit, from the eve
372
420
  `categoryViews.<path>`, `categoryShare.<path>` and, since 3.18, `basketValue`. A field this build
373
421
  does not know fails its rule closed.
374
422
 
423
+ `listViews`, `browseViews` and `browseShare` count category pages, as the warehouse does. A listing
424
+ must send its own `category` (Product List Viewed); one without is not recorded. Since 3.22, pass
425
+ the datafile's `browse_categories` as the fifth argument to `resolveAudiences` or
426
+ `resolveAudienceMemberships`, and a listing counts only when the catalogue files products under its
427
+ `category`, so a merchandising list (best sellers, new in, a sale) is never browsing interest:
428
+
429
+ ```js
430
+ resolveAudienceMemberships(body.audiences, datafile.session_audiences, undefined, body.qualified_for, datafile.browse_categories);
431
+ ```
432
+
433
+ Each trail entry is judged on the listing it came from, as the warehouse judges each event: two
434
+ listings under one path, one a category and one a sale list, count once. Product views and adds
435
+ credit the category page they were reached from, and a facet (Product List Filtered) counts only on
436
+ the listing being browsed; the warehouse counts neither, so these two measures run a little ahead
437
+ of it. Without `browse_categories` (a datafile that predates it, or a property whose catalogue is
438
+ not served yet, when the field is absent), every listing that names a category counts. A visit
439
+ recorded by an SDK before 3.22 has no listing categories, so with the list its earlier browsing
440
+ drops out once.
441
+
375
442
  `basketValue` is the `value` of the last `cartUpdated` (Cart Updated), in that event's currency:
376
443
  the basket as your platform priced it. It is never summed from `productAdded` lines, whose prices
377
444
  can include tax where `value` does not. It is `null`, so every rule on it fails, until the visit
@@ -385,7 +452,7 @@ response's `audiences` and `qualified_for`, and the datafile's `session_audience
385
452
  `resolveAudienceMemberships` exactly as before:
386
453
 
387
454
  ```js
388
- const memberships = resolveAudienceMemberships(body.audiences, datafile.session_audiences, undefined, body.qualified_for);
455
+ const memberships = resolveAudienceMemberships(body.audiences, datafile.session_audiences, undefined, body.qualified_for, datafile.browse_categories);
389
456
  ```
390
457
 
391
458
  A targetable visit audience may require an audience nobody may target. The server sends that base
@@ -415,8 +482,9 @@ With a `consent` adapter the SDK is strict:
415
482
  - **Analytics granted:** held events are sent, each carrying the answer in `context.consent`.
416
483
  - **Analytics refused:** held events are dropped, and so is everything after. Nothing goes into
417
484
  local or session storage.
418
- - **No answer by the timeout:** held and later events are dropped until an answer arrives. Strict
419
- is the only mode: an unanswered CMP is never a grant, however long it takes.
485
+ - **No answer by the timeout:** the status is `unknown`, and held and later events stay held, in
486
+ memory, while the SDK keeps listening for the answer. Strict is the only mode: an unanswered CMP
487
+ is never a grant, however long it takes.
420
488
  - **Page closed before an answer:** nothing is sent. Switching to another tab is not closing the
421
489
  page: held events wait for the visitor to come back.
422
490
  - **A navigation before an answer** (a sign-in that redirects) loses what the page held, unless
@@ -796,8 +864,10 @@ The `hp_cookie` cookie is one per browser, not per property. It is written with
796
864
  from the last visit. With a consent adapter it is never written before analytics is granted: until
797
865
  then the id lives in memory, and in the held store with `holdAcrossPages`, so a redirect keeps it.
798
866
  A refusal or withdrawal deletes it, and the id with it: a later grant, on the same page or another,
799
- starts a new device, as `analytics.reset()` does in analytics.js (3.18). Without a consent adapter
800
- you have decided the lawful basis yourself, so it is written at once.
867
+ starts a new device, as Segment's `analytics.reset()` does in analytics.js (3.18). A sign-out
868
+ (`signedOut()`, or `reset()` with a user signed in) deletes it too, and the next event mints a new
869
+ one (3.19). Without a consent adapter you have decided the lawful basis yourself, so it is written
870
+ at once.
801
871
 
802
872
  Changing a source's choice gives every returning visitor a new device id. A device id 3.5 minted
803
873
  into localStorage (`thg_hp_anonymous_id:<property>`) becomes the cookie's value under a grant, and
@@ -817,8 +887,8 @@ memory), and a refusal deletes it. Before 3.15 such a site sent `session_id: nul
817
887
 
818
888
  ## CSP and proxying
819
889
 
820
- The SDK makes requests only to `apiHost` (the settings, and the events unless the settings name
821
- another host), so allow it in `connect-src`: `resolveApiHost(apiHost)` is that origin, the HP API
890
+ The SDK makes requests only to `apiHost` (the settings and the events; without an `apiHost`, events
891
+ go to the settings' host when they name one), so allow it in `connect-src`: `resolveApiHost(apiHost)` is that origin, the HP API
822
892
  (`DEFAULT_API_HOST`) when you set none. Since 3.18 that is `https://hp.thgingenuity.com`
823
893
  (`connect-src https://hp.thgingenuity.com`); 3.17 used HP's nonprod host and 3.16 and earlier a
824
894
  staging host that is being retired. Allow the CDN host in `script-src` too if you use the script. Call the API host directly rather than through a CDN proxy route: behind a proxy the ingest
package/dist/hp.min.js CHANGED
@@ -1,3 +1,3 @@
1
- (()=>{var Pt=e=>{throw TypeError(e)};var ir=(e,t,n)=>t.has(e)||Pt("Cannot "+n);var Lt=(e,t,n)=>t.has(e)?Pt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var N=(e,t,n)=>(ir(e,t,"access private method"),n);var ge=[];for(let e=2;ge.length<64;e++)ge.every(t=>e%t!==0)&&ge.push(e);var Ot=e=>(e-Math.floor(e))*2**32>>>0,ar=ge.slice(0,8).map(e=>Ot(Math.sqrt(e))),cr=ge.map(e=>Ot(Math.cbrt(e))),z=(e,t)=>e>>>t|e<<32-t;function Nt(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(ar),o=new Uint32Array(64);for(let s=0;s<n.length;s+=16){for(let g=0;g<64;g++){if(g<16){o[g]=n[s+g];continue}let _=o[g-15],x=o[g-2],v=z(_,7)^z(_,18)^_>>>3,h=z(x,17)^z(x,19)^x>>>10;o[g]=o[g-16]+v+o[g-7]+h}let[i,a,u,d,p,f,m,b]=r;for(let g=0;g<64;g++){let _=z(p,6)^z(p,11)^z(p,25),x=b+_+(p&f^~p&m)+cr[g]+o[g]|0,h=(z(i,2)^z(i,13)^z(i,22))+(i&a^i&u^a&u)|0;[b,m,f,p,d,u,a,i]=[m,f,p,d+x|0,u,a,i,x+h|0]}[i,a,u,d,p,f,m,b].forEach((g,_)=>{r[_]+=g})}return Array.from(r,s=>s.toString(16).padStart(8,"0")).join("")}var He=(e,t)=>e<<t|e>>>32-t;function Tt(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 f=0;f<80;f++)r[f]=f<16?t[s+f]:He(r[f-3]^r[f-8]^r[f-14]^r[f-16],1);let[i,a,u,d,p]=n;for(let f=0;f<80;f++){let m,b;f<20?(m=a&u|~a&d,b=1518500249):f<40?(m=a^u^d,b=1859775393):f<60?(m=a&u|a&d|u&d,b=2400959708):(m=a^u^d,b=3395469782);let g=He(i,5)+m+p+b+r[f]|0;[p,d,u,a,i]=[d,u,He(a,30),i,g]}[i,a,u,d,p].forEach((f,m)=>{n[m]+=f})}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 ur="e28e8ada-5b76-4209-bba9-79b823a0af75",lr=e=>Array.from(e,t=>t.toString(16).padStart(2,"0")).join("");function Rt(e,t){let n=Uint8Array.from(e.replace(/-/g,"").match(/../g),a=>Number.parseInt(a,16)),r=new TextEncoder().encode(t),o=new Uint8Array(16+r.length);o.set(n),o.set(r,16);let s=Tt(o).slice(0,16);s[6]=s[6]&15|80,s[8]=s[8]&63|128;let i=lr(s);return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}var ee=(e,t)=>typeof e=="string"&&e!==""&&e.length<=t?e:null;function be(e,t){return ee(e,64)??ee(t,256)}function Dt({sessionId:e,slot:t,arm:n}={}){let r=ee(e,256);return!r||!ee(t,256)||!ee(n,256)?null:Rt(ur,`${r}:${t}:${n}`)}var dr="4b1f2c7e-9a3d-4e58-b6c1-2d7f0a9e8c53";function Mt({sessionId:e,surface:t}={}){let n=ee(e,256);return!n||!ee(t,64)?null:Rt(dr,`${n}:${t}`)}var fr=Array.from({length:11},(e,t)=>t/10);function pr(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,a=o?Math.min(i,o.width*o.height):i;return a>0&&s/a>=t}function Y(e){let{selector:t,onViewable:n,visibleRatio:r=.5,dwellMs:o=1e3,root:s=document}=e,i=new Map,a=new WeakSet,u=new Set,d=h=>{i.has(h)||i.set(h,setTimeout(()=>{i.delete(h),n(h)&&(f?.unobserve(h),u.delete(h))},o))},p=h=>{clearTimeout(i.get(h)),i.delete(h)},f=typeof IntersectionObserver>"u"?null:new IntersectionObserver(h=>{for(let E of h){let S=E.target;if(!pr(E,r)){u.delete(S),p(S);continue}u.add(S),m()&&d(S)}},{threshold:fr}),m=()=>typeof document>"u"||document.visibilityState!=="hidden",b=()=>{if(m())for(let h of u)d(h);else for(let h of u)p(h)};document.addEventListener("visibilitychange",b);let g=()=>{for(let h of s.querySelectorAll(t))a.has(h)||(a.add(h),f?.observe(h))},_=typeof MutationObserver>"u"?null:new MutationObserver(()=>g()),x=()=>{g(),_?.observe(s===document?document.body:s,{childList:!0,subtree:!0})},v=s===document&&!document.body;return v?document.addEventListener("DOMContentLoaded",x,{once:!0}):x(),()=>{v&&document.removeEventListener("DOMContentLoaded",x),document.removeEventListener("visibilitychange",b),f?.disconnect(),_?.disconnect();for(let h of i.values())clearTimeout(h);i.clear(),u.clear()}}function Ke(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 Y({selector:n,root:s,visibleRatio:r,dwellMs:o,onViewable(i){let a=i.dataset?.hpExposure?.trim();return a&&e.surfaceViewed({surface:a}),!0}})}var Ut=e=>{try{return new URL(e,document.baseURI).toString()}catch{return e}};function Ge(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,a=new Set,u=g=>g.closest?.(n)??null,d=g=>{let _=g.dataset.hpList?.trim();return _?{list_id:_,category:g.dataset.hpListCategory?.trim()||null}:null},p=g=>Array.from(g.querySelectorAll(r)).filter(_=>u(_)===g),f=(g,_)=>{try{let x=JSON.parse(g.dataset.hpProduct??"");return!x||typeof x!="object"||!x.product_id?null:{...x,position:x.position??_+1,...x.url?{url:Ut(x.url)}:{},...x.image_url?{image_url:Ut(x.image_url)}:{}}}catch{return null}},m=Y({selector:`${n} ${r}`,root:i,visibleRatio:o,dwellMs:s,onViewable(g){let _=u(g);if(!_||_.dataset.hpListView==="manual")return!0;let x=d(_);if(!x||a.has(x.list_id))return!0;let v=new Set,h=p(_).map(f).filter(E=>!E||v.has(E.product_id)?!1:(v.add(E.product_id),!0));return h.length===0||(a.add(x.list_id),e.productListViewed({...x,products:h})),!0}}),b=g=>{let x=g.target?.closest?.("a[href]")?.closest(r);if(!x)return;let v=u(x),h=f(x,v?p(v).indexOf(x):0);h&&e.productClicked({list_id:v?d(v)?.list_id??null:null,products:[h]})};return document.addEventListener("click",b,!0),()=>{document.removeEventListener("click",b,!0),m()}}function T(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 xe(e,...t){let n=T(e,...t);if(n===null)return null;let r=Number(n);return Number.isFinite(r)?Math.trunc(r):null}function mr(e,t){let n=T(e,"hpPromotion");return n?{promotion_id:n,name:T(e,"hpPromotionName"),creative:T(e,"hpPromotionCreative"),position:T(e,"hpPromotionSlot")??String(t+1)}:null}function We(e,t={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{selector:n="[data-hp-promotion]",resolve:r=mr,visibleRatio:o=.5,dwellMs:s=1e3,root:i=document}=t,a=new Set,u=f=>{let m=Array.from(i.querySelectorAll(n)),b=m.indexOf(f);try{return r(f,b<0?m.length:b)}catch{return null}},d=Y({selector:n,root:i,visibleRatio:o,dwellMs:s,onViewable(f){let m=u(f);return!m||a.has(m.promotion_id)?!1:(a.add(m.promotion_id),e.promotionViewed(m),!0)}}),p=f=>{let m=f.target;if(!m||typeof m.closest!="function")return;let b=m.closest(n),g=m.closest("a[href]");if(!b||!g||!b.contains(g)&&!g.contains(b))return;let _=u(b);_&&e.promotionClicked({..._,href:g.getAttribute("href")})};return document.addEventListener("click",p,!0),()=>{document.removeEventListener("click",p,!0),d()}}function hr(e){let t=T(e,"hpRecoRequest"),n=T(e,"hpRecoPlacement"),r=T(e,"hpRecoStrategy");if(!t||!n||!r)return null;let o=T(e,"hpRecoHoldout");return{recommendation_request_id:t,placement:n,strategy:r,recipe:T(e,"hpRecoRecipe"),algorithm_version:T(e,"hpRecoAlgorithmVersion"),experiment:T(e,"hpRecoExperiment"),variant:T(e,"hpRecoVariant"),holdout:o===null?null:o==="true",assignment_bucket:xe(e,"hpRecoBucket"),assignment_unit_kind:T(e,"hpRecoUnitKind"),candidate_set_fingerprint:T(e,"hpRecoFingerprint"),candidate_set_size:xe(e,"hpRecoCandidates"),ranked_by:T(e,"hpRecoRankedBy"),served_at:T(e,"hpRecoServedAt")}}function gr(e,t){let n=T(e,"hpRecoProduct");if(!n)return null;let r=T(e,"hpRecoPrice");return{product_id:n,sku:T(e,"hpRecoSku"),name:T(e,"hpRecoName"),brand:T(e,"hpRecoBrand"),price:r===null||Number.isNaN(Number(r))?null:Number(r),position:xe(e,"hpRecoPosition")??t+1}}function ze(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=hr,resolveTile:s=gr,visibleRatio:i=.5,dwellMs:a=1e3,root:u=document}=t,d=new Set,p=new Map,f=new Map,m=(h,...E)=>{try{return h(...E)}catch{return null}},b=h=>typeof h.closest=="function"?h.closest(n):null,g=h=>Array.from(h.querySelectorAll(r)),_=(h,E)=>{if(f.delete(E.recommendation_request_id),d.has(E.recommendation_request_id))return;let S=g(h).map((w,L)=>m(s,w,L)).filter(w=>w?.product_id);if(S.length===0)return;d.add(E.recommendation_request_id);let y=[...p.get(E.recommendation_request_id)?.values()??[]].sort((w,L)=>w.position-L.position);e.recommendationsViewed({...E,products:S,viewable:y})},x=Y({selector:`${n} ${r}`,root:u,visibleRatio:i,dwellMs:a,onViewable(h){let E=b(h);if(!E)return!0;let S=m(o,E);if(!S)return!0;let y=S.recommendation_request_id,w=m(s,h,g(E).indexOf(h));if(w?.product_id){p.has(y)||p.set(y,new Map);let L=p.get(y);L.has(w.position)||L.set(w.position,{position:w.position,product_id:w.product_id,viewable_at:new Date().toISOString()})}return!d.has(y)&&!f.has(y)&&f.set(y,setTimeout(()=>_(E,S),0)),!0}}),v=h=>{let E=h.target;if(!E||typeof E.closest!="function")return;let S=E.closest(r);if(!S)return;let y=E.closest("[data-hp-reco-interaction]"),w=E.closest("a[href]"),L=w&&(S.contains(w)||w.contains(S));if(!(y&&S.contains(y))&&!L)return;let D=b(S);if(!D)return;let H=m(o,D);if(!H)return;let K=m(s,S,g(D).indexOf(S));if(!K?.product_id)return;let F=H.recommendation_request_id;d.has(F)||(clearTimeout(f.get(F)),_(D,H)),e.productClicked({recommendation_request_id:H.recommendation_request_id,interaction:T(y??S,"hpRecoInteraction")??"navigate",products:[K]})};return document.addEventListener("click",v,!0),()=>{document.removeEventListener("click",v,!0);for(let h of f.values())clearTimeout(h);f.clear(),x()}}var ae=new Set(["home","list","product","search","basket","checkout","order_confirmation","login","register","account","info","blog","other"]),yr=new Set(["products"]),$t=e=>e==null;function Je(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=>Je(r,t)):Object.fromEntries(Object.entries(e).filter(([,r])=>!$t(r)).map(([r,o])=>[r,Je(o,t)]));return t.delete(e),n}function Xe(e){if(!e)return e;let t=Je(e);for(let n of yr)n in e&&$t(e[n])&&(t[n]=e[n]);return t}function Vt(){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 Sr=new Set(["","unknown","undefined","null","none","nil","nan","anonymous","guest","0","-1"]);function B(e){if(e==null)return null;let t=String(e).trim();return Sr.has(t.toLowerCase())?null:t}function Z(){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 jt="1.10";function U(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 wr={gclid:"gclid",fbclid:"fbclid",ttclid:"ttclid"},_r=/[a-z0-9._%+-]+@[a-z0-9-]+(\.[a-z0-9-]+)*\.[a-z]{2,}/i,br=/\d(?:[ -]?\d){12,}/,xr=new Set(["gclid","fbclid","ttclid","msclkid"]);function qt(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=!xr.has(String(t).toLowerCase());return n.some(o=>_r.test(o)||r&&br.test(o))}function Ir(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(wr)]){let i=t.get(o);i&&!qt(i,o)&&(n[s]=i)}return Object.keys(n).length?n:null}var Ar=["email","e-mail","password","pass","pwd","token","auth","code","uid","customer_id","postcode","zip","phone","applyCode"],kr=["email","password","passwd","pwd","token","secret","auth","session","phone","postcode","zip","address","birth","card","cvv","iban","ssn","customerid","userid"],vr=["tel","uid","dob"],Er=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","fbclid","ttclid","msclkid"],Cr=new Set(Ar.map(e=>e.toLowerCase()));function Pr(e){let t=String(e).toLowerCase();if(Cr.has(t))return!0;let n=t.replace(/[-_.]/g,"");return kr.some(o=>n.includes(o))?!0:String(e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).some(o=>vr.includes(o))}function Ye(e){return(e??[]).map(t=>{try{return new RegExp(`^${t}$`,"i")}catch{return{test:n=>n.toLowerCase()===String(t).toLowerCase()}}})}function Ft(e,t={}){if(!e)return null;try{let n=new URLSearchParams(e),r=t.queryParamAllowlist?Ye([...t.queryParamAllowlist,...Er]):null,o=Ye(t.queryParamBlocklist),s=Ye(t.sensitiveParamAllowlist);for(let a of new Set(n.keys()))(Pr(a)&&!s.some(d=>d.test(a))||n.getAll(a).some(d=>qt(d,a))||(r?!r.some(d=>d.test(a)):o.some(d=>d.test(a))))&&n.delete(a);let i=n.toString();return i?`?${i}`:""}catch{return""}}function Lr(e,t,n={}){if(!e)return null;try{let r=new URL(e);return t&&r.origin===t?r.origin+r.pathname+(Ft(r.search,n)??""):r.origin+r.pathname}catch{return null}}function Ze(e){if(typeof e!="string")return null;let t=e.trim().toUpperCase();return/^[A-Z]{3}$/.test(t)?t:null}function Bt(e){if(typeof e!="string")return null;let t=e.trim().toUpperCase();return/^[A-Z]{2}$/.test(t)?t:null}function Or(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 Nr(e){return{property_id:String(e.propertyId),channel:e.channel??null,market:e.market??null,environment:e.environment??null}}function Tr(e){let t=typeof window<"u"?window.location:null,n=t?Ft(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"?Lr(document.referrer,t?.origin,e):null,title:typeof document<"u"&&document.title||null,type:e.pageType??null}}function Ht(e,t={}){let n=typeof window<"u"?window.location:null,r={library:{name:e.libraryName,version:e.libraryVersion},spec:{version:jt},source:Nr(e),session_id:M(e.getSessionId,null),render_id:M(e.getRenderId,null),identity_trust:B(M(e.getAnonymousId,null))?"device":"none",page:Tr(e),campaign:n?Ir(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:Ze(M(e.getCurrency,e.currency)),locale:Or(M(e.getLocale,e.locale)),timezone:(()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return null}})(),country:Bt(e.country),ship_to_country:Bt(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 Kt(r,t)}function Kt(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]=Kt(e[r],o):o!==void 0&&(n[r]=o);return n}var re=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"}),Rr={retry:"cdp.retry",sessionSignals:"cdp_session_signals",identified:"cdp_identified",previousPage:"cdp_prev_page_message_id"},Qe={...re},Gt=!1;function Ie(e){let t={...re};for(let[n,r]of Object.entries(e??{})){if(!(n in re))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}Qe=t}function O(e){return Qe[e]}var Dr="_",Wt=e=>e==null||e===""?Dr:String(e);function q(e,t,n){let r=`${e}:${Wt(t)}`;return n==null||n===""?r:`${r}:${n}`}function zt(e,t){return`${e}:${Wt(t)}:`}function Ae(){if(!Gt){Gt=!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(Rr)){if(n!==o&&!n.startsWith(`${o}:`))continue;let s=Qe[r]+n.slice(o.length);t.getItem(s)===null&&t.setItem(s,t.getItem(n)),t.removeItem(n)}}catch{}}}}var tt=1800*1e3,ke=()=>{try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}},et=()=>{try{return typeof localStorage>"u"?null:localStorage}catch{return null}};function Jt(e,t=()=>Date.now()){return{read(){try{let n=ke()?.getItem(e),r=n?JSON.parse(n):null;return!r||t()-r.savedAt>tt?(r&&ke()?.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?ke()?.removeItem(e):ke()?.setItem(e,JSON.stringify({savedAt:t(),items:n,anonymousId:r}))}catch{}}}}var Mr=400*24*60*60;function Q(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 Ur({name:e,domain:t=null,legacyKey:n,read:r,mint:o,mayStore:s,carried:i=null}){let a=null;try{a=et()?.getItem(n)||null}catch{a=null}let u=r(e)??a??i,d=!1,p=()=>{if(!(d||u===null||!s())&&(d=Q(e,u,Mr,t),!(!d||a===null)))try{et()?.removeItem(n),a=null}catch{}};return{get(){return u??(u=o()),p(),u},peek:()=>u,persist:p,forget(){Q(e,"",0,t),u=null,d=!1;try{et()?.removeItem(n)}catch{}a=null}}}function Xt(e,{carried:t=null,mayStore:n,orOwn:r=!1}){let o=e.anonymousIdSource,s=()=>Ur({name:O("anonymousId"),domain:e.consentCookieDomain??null,legacyKey:q(O("anonymousId"),e.propertyId),read:U,mint:Z,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=()=>U(u)}if(!r)return null;let i=e.getAnonymousId,a=s();return e.getAnonymousId=()=>B(M(i,null))??a.get(),a}var $r=200;function Yt(e,t,n=()=>Date.now()){let r=()=>q(O("carried"),e),o=!1;function s(){try{let i=JSON.parse(sessionStorage.getItem(r())??"null");return!i||!(n()-i.savedAt<=tt)?[]: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(-$r)})),!0)}catch{return!1}},close(){o=!0}}}var Fs=re.consent,ve=Object.freeze({visitor:"visitor",host:"host"}),Zt=()=>({basis:ve.host}),Vr="hp-consent",oe=["analytics","marketing","personalisation","ad_user_data","ad_personalization"],Qt={analytics:"a",marketing:"m",personalisation:"p",ad_user_data:"aud",ad_personalization:"adp"},X=()=>typeof window<"u",en=()=>X()&&typeof window.cookieStore?.addEventListener=="function",jr=e=>e===!0?!0:e===!1?!1:null;function ce(e){if(!e||typeof e!="object")return null;let t={};for(let n of oe)t[n]=jr(e[n]);return t}function rt(e,t){return!e||!t?e===t:oe.every(n=>e[n]===t[n])}function ot(e){if(!e)return"";let t=[];for(let n of oe){let r=e[n];(r===!0||r===!1)&&t.push(`${Qt[n]}=${r?1:0}`)}return t.join("&")}function tn(e){return{[Vr]:ot(ce(e))}}function ye(e){let t=ce({});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(Qt).map(([s,i])=>[i,s])),o=new Set;for(let s of n.split("&")){let i=s.indexOf("=");if(i<=0)continue;let a=r[s.slice(0,i).trim()],u={1:!0,0:!1}[s.slice(i+1).trim()]??null;!a||u===null||o.has(a)||(t[a]===null?t[a]=u:t[a]!==u&&(t[a]=null,o.add(a)))}return t}function st(e,t){if(!t)return e;let n=r=>{if(!r)return r;let o={...r};for(let s of oe)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 it(e,t={}){return{...e,ad_user_data:t.ad_user_data??e.marketing,ad_personalization:t.ad_personalization??e.marketing}}function Ee(e,t){let n=!0;return{notify:()=>{if(n)try{let o=e();o&&t(o)}catch{}},stop:()=>n=!1}}var Br={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 qr(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(a=>{let u=String(a).toLowerCase();return s===u||s.startsWith(`${u}-`)})&&(n=!0,o?.enabled===!0))return!0}return n?!1:null}function nn(e={}){let t={...Br,...e.purposes};function n(){let r=X()?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=>qr(o,t[i]);return it({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(!X())return()=>{};let o=Ee(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 nt(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 rn(e={}){let t={analytics:"C0002",personalisation:"C0003",marketing:"C0004",...e.groups},n=e.impliedConsent===!0;function r(){let i=X()?window.OnetrustActiveGroups:void 0;if(typeof i=="string"&&i.length){let d=new Set(i.split(",").map(p=>p.trim()).filter(Boolean));return p=>d.has(p)}let a=nt(U("OptanonConsent"));if(!a.groups)return null;let u={};for(let d of a.groups.split(",")){let[p,f]=d.split(":");p?.trim()&&(u[p.trim()]=f==="1"?!0:f==="0"?!1:null)}return d=>u[d]??null}function o(){if(U("OptanonAlertBoxClosed"))return!0;try{if(X()&&window.OneTrust?.IsAlertBoxClosed?.()===!0)return!0}catch{}return Number.parseInt(nt(U("OptanonConsent")).interactionCount,10)>0?!0:n&&X()&&(!!window.OneTrust||typeof window.OnetrustActiveGroups=="string")}function s(){if(!o())return null;let i=r();if(!i)return null;let a=f=>t[f]?i(t[f]):null,u=it({analytics:a("analytics"),marketing:a("marketing"),personalisation:a("personalisation")},{ad_user_data:a("ad_user_data"),ad_personalization:a("ad_personalization")}),d=nt(U("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(!X())return()=>{};let a=Ee(s,i),u=!1,d=()=>{u||!window.OneTrust?.OnConsentChanged||(u=!0,window.OneTrust.OnConsentChanged(a.notify))};window.addEventListener("OneTrustGroupsUpdated",a.notify);let p=window.OptanonWrapper;return window.OptanonWrapper=function(...m){try{typeof p=="function"&&p.apply(this,m)}finally{d(),a.notify()}},d(),()=>{a.stop(),window.removeEventListener("OneTrustGroupsUpdated",a.notify)}}}}function Fr(e){let t=String(e).split(",").map(n=>n.trim()).filter(Boolean);return t.length?new Set(t):null}function on(e){let{name:t,categories:n,parse:r=Fr,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 a(){let u=U(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 p=f=>n[f]?d.has(n[f]):null;return it({analytics:p("analytics"),marketing:p("marketing"),personalisation:p("personalisation")},{ad_user_data:p("ad_user_data"),ad_personalization:p("ad_personalization")})}return{name:s,read:a,get observesChanges(){return en()},subscribe(u){if(!X())return()=>{};let d=Ee(a,u),p=f=>{[...f.changed??[],...f.deleted??[]].some(b=>b?.name===t)&&d.notify()};return window.addEventListener(i,d.notify),window.cookieStore?.addEventListener?.("change",p),()=>{d.stop(),window.removeEventListener(i,d.notify),window.cookieStore?.removeEventListener?.("change",p)}}}}function sn(e={}){let t=e.name??O("consent"),n=()=>{let r=U(t);if(r==null)return null;let o=ye(r);return o.analytics==null?null:o};return{name:"forwarded",read:n,get observesChanges(){return en()},subscribe(r){if(!X())return()=>{};let o=Ee(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 an(e){let t=ce(e);return{name:"static",basis:ve.host,read:()=>t?{...t}:null,observesChanges:!0,subscribe:()=>()=>{}}}function cn(e){if(e==null)return null;let t=String(e).split("/").map(n=>n.trim()).filter(Boolean).join("/");return t===""?null:t}function Hr(e){let t=e.item_category;if(t!=null&&String(t).includes("/"))return cn(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 cn(n.join("/"))}var Kr=e=>{if(e==null||typeof e=="object")return null;let t=String(e).trim();return t===""?null:t};function Gr(...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 Ce=e=>Gr(e.item_group_id,e.item_id);function Wr(e,t=Ce){if(!e)return null;let n=a=>a==null||a===""||Number.isNaN(Number(a))?null:Number(a),r=a=>{let u=n(a);return u==null?null:Math.round(u*1e6)/1e6},o=a=>{let u=r(a);return u!=null&&u>=0?u:null},s=a=>{let u=n(a);return Number.isInteger(u)&&u>=0?u:null},i=Kr;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:Hr(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 at(e,t=Ce){return(e??[]).map(n=>Wr(n,t)).filter(n=>n?.product_id)}var zr=1e3,Jr={shipping:2,payment:3},Xr=new Set(["password","google","apple","facebook","magic_link","sso","passkey","other"]),$=e=>{if(e==null||typeof e=="object")return null;let t=String(e).trim();return t===""?null:t},Yr=e=>{if(e==null||e===""||typeof e=="object")return null;let t=Number(e);return Number.isFinite(t)&&t>=0?t:null},Pe=e=>e!==null&&typeof e=="object";function Zr(e){return Array.isArray(e.items)?e.items.filter(Pe):null}function un(e){let t=$(e)?.toLowerCase().replace(/[\s-]+/g,"_");return t?Xr.has(t)?t:t==="email"||t==="email_password"?"password":"other":null}function Qr({ecommerce:e,items:t}){let n=s=>({promotion_id:$(s.promotion_id),name:$(s.promotion_name),creative:$(s.creative_name),position:$(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 ln=({ecommerce:e,items:t})=>$(e.item_list_id)??$(e.item_list_name)??$(t[0]?.item_list_id)??$(t[0]?.item_list_name),se=(e,t)=>t.products?.length?{event:e,properties:t}:null,eo=new Set(["product","products","item","items"]);function to({ecommerce:e}){let t=$(e.item_id),n=$(e.content_type)?.toLowerCase();return!t||n&&!eo.has(n)?null:{event:"Product Shared",properties:{share_via:$(e.method),products:[{product_id:t}]}}}function no(e){let t=o=>se("Product List Viewed",{list_id:ln(o),products:o.products}),n=o=>{let s=$(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=>se("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=>se("Product Clicked",{list_id:ln(o),products:o.products.slice(0,1)}),add_to_cart:o=>se("Product Added",{cart_id:$(o.ecommerce.cart_id),products:o.products}),remove_from_cart:o=>se("Product Removed",{cart_id:$(o.ecommerce.cart_id),products:o.products}),view_cart:o=>({event:"Cart Viewed",properties:{cart_id:$(o.ecommerce.cart_id),value:o.value,currency:o.currency,coupon:$(o.ecommerce.coupon),...o.itemsListed?{products:o.products}:{}}}),begin_checkout:o=>se("Checkout Started",{value:o.value,currency:o.currency,coupon:$(o.ecommerce.coupon),products:o.products}),add_shipping_info:o=>({event:"Checkout Step Completed",properties:{step:e.shipping,step_name:"shipping",shipping_method:$(o.ecommerce.shipping_tier)}}),add_payment_info:o=>({event:"Payment Info Entered",properties:{step:e.payment,step_name:"payment",payment_method:$(o.ecommerce.payment_type)}}),view_promotion:r("Promotion Viewed"),select_promotion:r("Promotion Clicked"),add_to_wishlist:o=>se("Product Added to Wishlist",{products:o.products}),share:to,login:o=>({event:"Signed In",properties:{method:un(o.ecommerce.method)}}),sign_up:o=>({event:"Signed Up",properties:{method:un(o.ecommerce.method)}})}}var ro=e=>e.event;function oo(e,t){if(!Pe(e))return null;if(typeof e.length=="number"&&e[0]==="event"&&typeof e[1]=="string"){let r=Pe(e[2])?e[2]:{};return{name:e[1],entry:r,ecommerce:r}}let n=$(t(e));return n?{name:n,entry:e,ecommerce:Pe(e.ecommerce)?e.ecommerce:e}:null}function ct(e){return Array.isArray(e)?`[${e.map(ct).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${ct(e[t])}`).join(",")}}`:JSON.stringify(e??null)}function dn(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=no({...Jr,...t.steps}),o=t.map??{},s=t.eventName??ro,i=t.productId??Ce,a=new Set(["purchase","refund",...t.ignore??[]]),u=t.dedupeMs??zr,d=new Map,p=!0;function f(S,y,w){if(u<=0)return!1;let L=`${S}|${w??""}|${ct(y)}`,D=Date.now();for(let[H,K]of d)D-K>u&&d.delete(H);return d.has(L)?!0:(d.set(L,D),!1)}let m=null,b=new Set;function g(S,y){if(S!=="Product Viewed")return!1;let w=typeof location>"u"?"":location.pathname;w!==m&&(m=w,b.clear());let L=y.products?.[0]?.product_id;return L?b.has(L)?!0:(b.add(L),!1):!1}function _({event:S,properties:y={}},w){if(!S||f(S,y,w)||g(S,y))return;let L=w?{context:{currency:w}}:void 0;if(S==="Signed Out"&&typeof e.signedOut=="function"){e.signedOut(L);return}e.track(S,y,L)}function x(S){let y=t.transform?t.transform(S):S,w=oo(y,s);if(!w||a.has(w.name))return;let L=Object.hasOwn(o,w.name),D=L?o[w.name]:r[w.name];if(typeof D!="function")return;let H=Zr(w.ecommerce),K=H??[],F={...w,items:K,itemsListed:H!==null,products:at(K,i),currency:Ze(w.ecommerce.currency),value:Yr(w.ecommerce.value)};F.promotions=Qr(F);let I=L?D(y,{...F,toProducts:G=>at(G,i)}):D(F);for(let G of[I].flat())G&&_(G,F.currency)}function v(S){if(p)try{x(S)}catch(y){try{t.onError?.(y,S)}catch{}}}for(let S of n.slice())v(S);let h=n.push;function E(...S){let y=h.apply(this,S);for(let w of S)v(w);return y}return n.push=E,()=>{p=!1,n.push===E&&(n.push=h)}}var so="hp_debug",io=256;function ao(){try{return new URLSearchParams(location.search).get(so)}catch{return null}}function fn(e,t){if(typeof location>"u")return!1;try{let n=ao();if(n!==null){let o=n.trim();o===""||o.length>io?sessionStorage.removeItem(t):sessionStorage.setItem(t,o)}let r=sessionStorage.getItem(t);return!!(e&&r&&Nt(r)===e)}catch{return!1}}var co=4320*60*60,uo=100,lo=1e3,fo=2e3,pn=500,Le=e=>(e?.unref?.(),e);function po(e,t){if(t?.analytics===!0&&e.analytics===!1)return"withdrawn";let n=oe.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 mo(e,t,n=O("consent")){if(!(typeof document>"u"))try{let r=typeof location<"u"&&location.protocol==="https:"?"; Secure":"",o=t?`; Domain=${t}`:"";document.cookie=`${n}=${ot(e)}; Path=/; Max-Age=${co}; SameSite=Lax`+o+r}catch{}}function ho(e){let t=ye(U(e));return oe.some(n=>t[n]!==null)?t:null}function mn(e){let{adapter:t,timeoutMs:n=5e3,cookieDomain:r=null,cookieName:o=O("consent"),release:s,announce:i}=e,a=e.discard??(()=>{}),u="pending",d=null,p=null,f=null,m=null,b=!1,g=null,_=[],x=R=>{u=R,e.onStatus?.(R)};function v(){try{return ce(t.read())}catch{return null}}function h(){p&&clearInterval(p),f&&clearTimeout(f),p=null,f=null}let E=()=>typeof window<"u"&&typeof document<"u",S=()=>{try{return typeof t.subscribe=="function"&&t.observesChanges===!0}catch{return!1}};function y(){m&&clearInterval(m),m=null}function w(){b||m||d===null||S()||E()&&document.visibilityState==="hidden"||(m=Le(setInterval(()=>F(v()),fo)))}let L=()=>u==="pending"||u==="unknown",D=e.store??null,H=()=>{let R=_.splice(0);D?.write([]);for(let j of R)s(j)},K=()=>{let R=_.splice(0);D?.write([]);for(let j of R)a(j)};function F(R){let j=ce(R);if(!j||j.analytics===null)return;let c=d===null,l=c?ho(o):d;if(!c&&rt(l,j))return;h(),d=j,w(),mo(j,r,o);let k=!rt(l,j);if(j.analytics){x("granted"),H(),k&&i({action:po(j,l),state:j,withdrawal:!1});return}K(),l?.analytics===!0&&i({action:"withdrawn",state:j,withdrawal:!0}),x("denied")}function I(){f=null,u==="pending"&&(x("unknown"),p&&clearInterval(p),p=Le(setInterval(()=>F(v()),lo)))}function G(R){L()&&(D||R?.type!=="visibilitychange"&&!R?.persisted&&K())}let we=R=>{document.visibilityState==="hidden"?(y(),G(R)):w()},me=R=>{y(),G(R)},he=()=>w();return{get status(){return u},get state(){return d?{...d}:null},stamp(){return d?{...d,source:t.name??null,basis:t.basis??ve.visitor}:null},admits(){return u==="granted"},hold(R){return!L()||_.length>=pn?(a(R),!1):(_.push(R),D?.write(_),!0)},onHidden:G,start(){b=!1;try{g=t.subscribe?.(R=>F(R))??null}catch(R){e.debug&&console.warn("[hp] consent adapter subscribe failed",R)}E()&&(window.addEventListener("pagehide",me),window.addEventListener("pageshow",he),document.addEventListener("visibilitychange",we)),D&&_.length===0&&_.push(...D.read().slice(-pn)),F(v()),!d&&(p=Le(setInterval(()=>F(v()),uo)),f=Le(setTimeout(I,n)))},stop(){b=!0,h(),y(),typeof g=="function"&&g(),E()&&(window.removeEventListener("pagehide",me),window.removeEventListener("pageshow",he),document.removeEventListener("visibilitychange",we))}}}var go=["recommendation","search_rank","banner","offer","layout","copy","price","other"],Oe=e=>typeof e=="string"&&e!=="";function hn(e){return(Array.isArray(e?.decisions)?e.decisions:[]).filter(t=>Oe(t?.slot)&&Oe(t.decision_id)&&t.holdout!==!0).map(({decision_id:t,slot:n,arm:r,kind:o})=>({decision_id:t,slot:n,...Oe(r)&&{arm:r},...go.includes(o)&&{kind:o}}))}function gn({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=>Oe(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(a=>a.slot));n=[...r().filter(a=>!i.has(a.slot)),...s],o()},forget(){n=[];try{sessionStorage.removeItem(e)}catch{}}}}function yo(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 Ne(e,t,n=1e4){return yo(`${t}\0${e}`)%n}function ut(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 lt(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}=ut(e),s=Ne(t,e.salt),i=u=>Math.round(u*1e4),a=r>0&&s<i(r)?"holdout":!n||s<i(r+o)?"personalised":"excluded";return{holdout:a==="holdout",bucket:s,group:a}}function yn(e,t){return typeof e!="string"||e===""||t==null||t===""?null:Ne(t,`bandit-vs-default:${e}`)<1e4/2?"default":"bandit"}var So="hp_preview",wo=256;function Sn(e,t=null){if(typeof location>"u")return U(e);let n=null;try{n=new URLSearchParams(location.search).get(So)}catch{n=null}if(n===null)return U(e);let r=n.trim();return r===""||r.length>wo?(Q(e,"",0,t),null):(Q(e,r,null,t),r)}var _o=40,bo=128,xo=5,Io=60,_n=e=>typeof e=="string"&&e!==""&&e.length<=bo&&!e.includes(","),wn=e=>Array.isArray(e)?e.filter(_n).slice(0,_o):[],Ao=e=>Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.replaceAll(","," ").trim()).filter(t=>t!=="").slice(0,xo):[],ko=e=>Object.entries(e&&typeof e=="object"?e:{}).filter(([t,n])=>_n(t)&&Number.isFinite(n)&&n>=1).sort(([,t],[,n])=>n-t).slice(0,Io).map(([t,n])=>`${t}:${Math.floor(n)}`);function dt(e){let t={},n={viewed:wn(e?.recentProducts),basket:wn(e?.basketProducts),q:Ao(e?.recentSearches),impressed:ko(e?.impressions)};for(let[r,o]of Object.entries(n))o.length>0&&(t[r]=o.join(","));return t}var vo=1800*1e3;function bn(e,t=Date.now()){try{localStorage.setItem(O("recommendationContext"),JSON.stringify({context:e,until:t+vo}))}catch{}}function xn(){try{localStorage.removeItem(O("recommendationContext"))}catch{}}var Eo="hp_sample",In=1e4;function An(e,t){return!(typeof t=="number"&&t<1)||e==null||e===""?!0:Ne(e,Eo,In)<Math.round(t*In)}function ft(e){return e.trim().toLowerCase().replace(/\s*\/\s*/g,"/").replace(/^\/+|\/+$/g,"")}var Co=2,Po=12;function Lo(e,t=Co){return e.split("/").slice(0,t).join("/")}function ue(e,t){if(typeof t!="string"||!t.trim())return null;let n=Lo(ft(t));return n?(e.unshift(n),e.length=Math.min(e.length,Po),n):null}var ie=()=>O("sessionSignals"),le=null,pt=()=>le??ie();function kn(){try{return le?localStorage:sessionStorage}catch{return}}function vn(e,t){let n=t==null?null:String(t),r=e?q(ie(),n,e):null;if(r===le)return;let o=le===null?Oo():null;if(le=r,!!le)try{let s=pt(),i=zt(ie(),n);for(let a of Object.keys(localStorage))a.startsWith(i)&&a!==s&&localStorage.removeItem(a);o&&!localStorage.getItem(s)&&(localStorage.setItem(s,JSON.stringify(o)),sessionStorage.removeItem(ie()))}catch{}}function Oo(){try{let e=sessionStorage.getItem(ie());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:null}catch{return null}}function Te(){return{productViews:0,listViews:0,cartAdds:0,searches:0,recentProducts:[],recentCategories:[],recentBrowse:[],basketProducts:[],basketValue:null,recentSearches:[],impressions:{},browsingCategory:null,startedAt:0}}function mt(){let e=kn();if(!e)return Te();try{let t=e.getItem(pt());return t?{...Te(),...JSON.parse(t)}:{...Te(),startedAt:Date.now()}}catch{return{...Te(),startedAt:Date.now()}}}function ht(e){let t=kn();if(t)try{t.setItem(pt(),JSON.stringify(e))}catch{}}function En(){return mt()}function Cn(){for(let e of[()=>sessionStorage,()=>localStorage])try{let t=e();t.removeItem(ie());for(let n of Object.keys(t))n.startsWith(`${ie()}:`)&&t.removeItem(n)}catch{}}var Pn=20,Ln=200,No=new Set(["Product Viewed","Product Clicked","Product Added","Product Added to Wishlist"]),To=new Set(["Product Clicked","Product Added to Wishlist"]);function On(e,t){let n=mt();n.startedAt||(n.startedAt=Date.now());let r=Array.isArray(t?.products)?t.products:[];switch(e){case"Product Viewed":n.productViews+=1,ue(n.recentBrowse,n.browsingCategory);break;case"Product List Viewed":n.listViews+=1;{let i=t?.list_id;typeof i=="string"&&i.includes("/")&&!i.startsWith("cdp-")&&(n.browsingCategory=ue(n.recentBrowse,i)??n.browsingCategory)}break;case"Product List Filtered":{let i=t?.change,a=typeof t?.list_id=="string"?t.list_id:"",u=typeof i?.value=="string"?i.value:"";u&&i?.action!=="removed"&&(n.browsingCategory=ue(n.recentBrowse,`${a}/${u}`)??n.browsingCategory);break}case"Product Added":{n.cartAdds+=1,ue(n.recentBrowse,n.browsingCategory);for(let i of r){let a=i.product_id;typeof a!="string"||!a||(n.basketProducts=[a,...n.basketProducts.filter(u=>u!==a)].slice(0,Pn))}break}case"Product Removed":{for(let i of r){let a=i.product_id;typeof a=="string"&&a&&(n.basketProducts=n.basketProducts.filter(u=>u!==a))}break}case"Products Searched":{n.searches+=1;let i=t?.query;if(typeof i=="string"&&i.trim()){let a=i.trim().toLowerCase().slice(0,64);n.recentSearches=[a,...n.recentSearches.filter(u=>u!==a)].slice(0,5)}break}case"Product Clicked":case"Product Added to Wishlist":break;case"Cart Updated":{let i=t?.value;return n.basketValue=typeof i=="number"&&Number.isFinite(i)&&i>=0?i:null,ht(n),n}default:return n}let o=No.has(e);if(o)for(let i of r)typeof i.product_id=="string"&&i.product_id&&delete n.impressions[i.product_id];else{for(let a of r){let u=a.product_id;typeof u!="string"||!u||(n.impressions[u]=(n.impressions[u]??0)+1)}let i=Object.keys(n.impressions);if(i.length>Ln){let a={};for(let u of i.sort((d,p)=>n.impressions[p]-n.impressions[d]).slice(0,Ln))a[u]=n.impressions[u];n.impressions=a}}let s=new Set;for(let i of r){let a=i.product_id;if(o&&typeof a=="string"&&a&&(n.recentProducts=[a,...n.recentProducts.filter(u=>u!==a)].slice(0,Pn)),!To.has(e)&&typeof i.category=="string"&&i.category){let u=ft(i.category);u&&!s.has(u)&&(s.add(u),ue(n.recentCategories,u))}}return ht(n),n}var Nn=1800*1e3;function Tn({name:e,domain:t=null,mayStore:n,now:r=()=>Date.now(),mint:o=Z}){let s=null,i=0,a=()=>{s!==null&&n()&&Q(e,s,Nn/1e3,t)};return{get(){let u=r(),d=U(e);return d?s=d:(s===null||u-i>=Nn)&&(s=o()),i=u,a(),s},persist:a,forget(){Q(e,"",0,t),s=null}}}var J=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Rn=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),yt=Object.freeze({enabled:!1});function Dn(e,t){let n=e?.track;return J(n)?(Object.hasOwn(n,t)?n[t]:n.__default)?.enabled!==!1:!0}function Ro(e,t){return`${de(e)}/v1/projects/${encodeURIComponent(t)}/settings`}var Do="https://hp.thgingenuity.com";function de(e){return e==null||e===""?Do:Mn(e)}function Mn(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 Mo(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 gt=e=>typeof e=="number"&&e>=0&&e<=1,Uo=/^[0-9a-f]{64}$/;function $o(e){return J(e)?{enabled:e.enabled===!0,tokenSha256:typeof e.tokenSha256=="string"&&Uo.test(e.tokenSha256)?e.tokenSha256:null}:{enabled:!1,tokenSha256:null}}function Vo(e){if(!J(e))return null;let t=Object.fromEntries(Object.entries(e).filter(([,n])=>J(n)&&gt(n.share)&&(n.ramp==null||gt(n.ramp))&&typeof n.salt=="string"&&n.salt!=="").map(([n,r])=>[n,{share:r.share,ramp:r.ramp??null,salt:r.salt,...Rn(r.readoutSlots)&&r.readoutSlots.length>0&&{readoutSlots:r.readoutSlots}}]));return Object.keys(t).length?t:null}var jo=/^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/;function Bo(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"&&jo.test(e.cookie)?{source:"site_cookie",cookie:e.cookie}:null:null}function St(e){let t=J(e)?e.hp:null;return!J(t)||t.enabled!==!0?yt:{enabled:!0,propertyId:typeof t.propertyId=="string"&&t.propertyId!==""?t.propertyId:null,environment:typeof t.environment=="string"?t.environment:null,consentPurposes:Mo(t.consent?.purposes),queryParamAllowlist:Rn(t.queryParamAllowlist)?t.queryParamAllowlist:null,anonymousId:Bo(t.anonymousId),apiHost:Mn(t.apiHost),holdouts:Vo(t.holdouts),sampleRate:gt(t.sampleRate)?t.sampleRate:1,debug:$o(t.debug),plan:J(e.plan)&&J(e.plan.track)?{track:e.plan.track}:null}}async function Un(e,t,n=globalThis.fetch){try{let r=await n(Ro(e,t),{credentials:"omit",headers:{accept:"application/json"}});return r.ok?St(await r.json()):null}catch{return null}}var Re=e=>q(O("settings"),e);function $n(e){try{let t=localStorage.getItem(Re(e));if(!t)return null;let n=JSON.parse(t);return n?.enabled===!0?n:null}catch{return null}}function Vn(e,t){try{t?.enabled===!0?localStorage.setItem(Re(e),JSON.stringify(t)):localStorage.removeItem(Re(e))}catch{}}function wt(e){try{localStorage.removeItem(Re(e))}catch{}}var qo={flushAt:20,flushIntervalMs:1e4,maxQueue:500,maxRetryAgeMs:1440*60*1e3,maxRetries:5,maxPersistedBatches:20,maxPersistedBytes:1024*1024,storageKey:re.retry,beaconSafeBytes:56*1024,maxBatchEvents:100,maxBatchBytes:500*1024},_t=()=>Date.now(),fe=e=>typeof TextEncoder<"u"?new TextEncoder().encode(e).length:Buffer.byteLength(e),bt=()=>typeof window<"u"&&typeof document<"u";function Fo(){try{return!bt()||!window.localStorage?null:(window.localStorage.getItem("thg_hp_probe"),window.localStorage)}catch{return null}}var A,xt,jn,De,It,At,Bn,Se,kt,Me,qn,vt,Fn,Ue,$e=class{constructor(t){Lt(this,A);this.o={...qo,...t},this.queue=[],this.timer=null,this.storage=Fo(),this.inflight=null,this.sending=new Set,this.replayAllowed=!this.o.deferReplay,this.draining=null,bt()&&(window.addEventListener("pagehide",()=>this.flush({beacon:!0})),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flush()}),N(this,A,Ue).call(this))}replayPersisted(){return this.replayAllowed=!0,N(this,A,Ue).call(this)}clearPersisted(){if(this.replayAllowed=!1,!!this.storage)try{this.storage.removeItem(this.o.storageKey)}catch{}}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():N(this,A,xt).call(this)}flush(t={}){if(N(this,A,jn).call(this),this.queue.length===0)return Promise.resolve();if(t.beacon&&bt()&&typeof navigator<"u"&&navigator.sendBeacon)return N(this,A,Bn).call(this),Promise.resolve();if(this.inflight)return this.inflight;let n=N(this,A,At).call(this,this.queue,this.o.maxBatchEvents,this.o.maxBatchBytes).map(r=>{let o=N(this,A,vt).call(this,r);return o&&this.sending.add(o),{batch:r,id:o}});return this.queue=[],this.inflight=(async()=>{for(let{batch:r,id:o}of n)await N(this,A,Se).call(this,r,0,o)})().finally(()=>{this.inflight=null,this.queue.length>=this.o.flushAt?this.flush():this.queue.length&&N(this,A,xt).call(this)}),this.inflight}};A=new WeakSet,xt=function(){this.timer||(this.timer=setTimeout(()=>this.flush(),this.o.flushIntervalMs),this.timer?.unref?.())},jn=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},De=function(t){return JSON.stringify({batch:t,writeKey:this.o.writeKey,sentAt:new Date().toISOString()})},It=function(){return`${this.o.apiHost.replace(/\/$/,"")}/v1/batch`},At=function(t,n,r){let o=fe(N(this,A,De).call(this,[])),s=[],i=[],a=o;for(let u of t){let d=fe(JSON.stringify(u))+1;i.length&&(i.length>=n||a+d>r)&&(s.push(i),i=[],a=o),i.push(u),a+=d}return i.length&&s.push(i),s},Bn=function(){let t=this.queue;this.queue=[];let n=N(this,A,It).call(this);for(let r of N(this,A,At).call(this,t,this.o.maxBatchEvents,this.o.beaconSafeBytes)){let o=N(this,A,De).call(this,r);if(fe(o)<=this.o.beaconSafeBytes){let s=!1;try{s=navigator.sendBeacon(n,new Blob([o],{type:"text/plain"}))}catch{s=!1}if(s)continue}N(this,A,Se).call(this,r,0,N(this,A,vt).call(this,r))}},Se=async function(t,n,r=null){r&&this.sending.add(r);let o=N(this,A,De).call(this,t);try{let s=await fetch(N(this,A,It).call(this),{method:"POST",headers:{"Content-Type":"text/plain"},body:o,keepalive:fe(o)<=this.o.beaconSafeBytes});if(s.ok)return N(this,A,kt).call(this,r),N(this,A,Ue).call(this),!0;if(!(s.status===429||s.status>=500))return N(this,A,kt).call(this,r),this.o.onError?.(`CDP ingest rejected batch (${s.status}); dropping ${t.length} events`),!0;throw new Error(`retryable ${s.status}`)}catch(s){if(n>=this.o.maxRetries){r&&this.sending.delete(r);let a=r?"kept for the next page":"dropped";return this.o.onError?.(`CDP ingest unreachable after ${n} attempts; ${a}: ${t.length} events`,s),!1}let i=Math.min(1e3*2**n,3e4)*(.5+Math.random());return await new Promise(a=>setTimeout(a,i)),N(this,A,Se).call(this,t,n+1,r)}},kt=function(t){t&&(this.sending.delete(t),N(this,A,Fn).call(this,t))},Me=function(){let t=JSON.parse(this.storage.getItem(this.o.storageKey)||"[]");return Array.isArray(t)?t:[]},qn=function(t,n){let r=i=>fe(JSON.stringify(i))+1,o=[...t,n].slice(-this.o.maxPersistedBatches),s=o.reduce((i,a)=>i+r(a),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},vt=function(t){if(!this.storage||this.o.mayPersist&&!this.o.mayPersist())return null;try{let n={at:_t(),id:`${_t()}-${Math.random().toString(36).slice(2)}`,batch:t};return fe(JSON.stringify(n))+3>this.o.maxPersistedBytes?null:N(this,A,qn).call(this,N(this,A,Me).call(this),n)?n.id:null}catch{return null}},Fn=function(t){if(!(!t||!this.storage))try{let n=N(this,A,Me).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{}},Ue=function(){if(!this.storage||!this.replayAllowed)return this.draining??Promise.resolve();if(this.draining)return this.draining;let t;try{let r=N(this,A,Me).call(this);t=r.filter(o=>Array.isArray(o?.batch)&&_t()-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 N(this,A,Se).call(this,r.batch,0,r.id))return})().finally(()=>{this.draining=null}),this.draining):Promise.resolve()};var Hn="3.18.0",Kn="@thg-agentic/hyper-personalisation-web";var Ho=new Set(["audiences","decisions","recommendations"]);var Ko=Symbol.for("@thg-agentic/hyper-personalisation-web.replay"),Ve=class extends Error{};function Go(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 Wo="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";function zo(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 je(e){if(typeof e!="string")return null;let t=zo(e.trim());return t===Wo?null:t}var Gn=!1;function Jo(e){!e||Gn||(Gn=!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 Wn(e){return e&&typeof e.context=="object"&&e.context!==null?e.context:e}function zn(e){let t=de(e?.apiHost);if(!t)throw new Error("createAnalytics: apiHost, when given, must be a host or an http(s) origin");if(!e?.propertyId)throw new Error("createAnalytics: propertyId is required");let n={libraryName:Kn,libraryVersion:Hn,writeKey:"web",queryParamBlocklist:[],debug:!1,validate:null,consentTimeoutMs:5e3,...e,apiHost:t};Ie(n.storageNames),Ae();let r=!!n.consent,o=null;n.getConsent=()=>o?o.stamp():Zt();let s=()=>!r||o?.status==="granted",i=r&&n.holdAcrossPages?Jt(q(O("held"),n.propertyId)):null,a=i?.read()??{items:[],anonymousId:null};n.mintAnonymousId!==void 0&&Jo(n.debug);let u=Xt(n,{carried:a.anonymousId,mayStore:s,orOwn:!0}),d=Tn({name:O("session"),domain:n.consentCookieDomain??null,mayStore:s}),p=n.getSessionId;n.getSessionId=()=>B(M(p,null))??d.get();let f=Sn(O("preview"),n.consentCookieDomain??null),m=n.transport??new $e({apiHost:n.apiHost,writeKey:n.writeKey,storageKey:q(O("retry"),n.propertyId),mayPersist:r?()=>o?.status==="granted":void 0,deferReplay:r,onError:(c,l)=>n.debug&&console.warn("[hp]",c,l??"")}),b=q(O("previousPage"),n.propertyId),g=null,_=()=>{if(g)return g;try{return sessionStorage.getItem(b)||null}catch{return null}},x=c=>{if(g=c||null,!(r&&o.status!=="granted"))try{sessionStorage.setItem(b,c)}catch{}},v=gn({key:q(O("decisions"),n.propertyId),mayStore:s});n.getDecisions??(n.getDecisions=v.current);let h=B(M(n.getUserId,null)),E=null;function S(c,l,k=!1){try{return y(c,l,k)}catch(P){if(P instanceof Ve)throw P;return console.warn("[hp] the event was not sent",P),null}}function y(c,l,k){let P=E;E=null;let C={messageId:P?.messageId??Z(),timestamp:P?.timestamp??new Date().toISOString(),anonymousId:B(M(n.getAnonymousId,null)),userId:h??null,...c,context:Ht(n,Wn(l))};if(C.properties&&(C.properties=Xe(C.properties)),!k&&!An(C.anonymousId,n.sampleRate))return n.debug&&console.debug("[hp] not sent: outside the sample",C),null;if(n.beforeSend){let W;try{W=n.beforeSend(C)}catch(sr){return console.warn("[hp] beforeSend failed; the event was not sent",sr),null}if(!W)return null;let{type:_e,event:Ct,messageId:rr,timestamp:or}=C;C={...W,type:_e,messageId:rr,timestamp:or,...Ct?{event:Ct}:{}}}if(n.validate){let W=n.validate(C,{producer:"web"});if(!W.valid){let _e=`[hp] invalid ${C.event??C.type}:
2
- ${W.errors.join(`
3
- `)}`;if(n.throwOnInvalid)throw new Ve(_e);console.error(_e)}}return n.debug&&console.debug("[hp]",C.event??C.type,C),F(C,k),C}function w(c){if(c.type==="track"&&K(c),n.onEvent)try{n.onEvent(c)}catch(l){console.warn("[hp] onEvent observer failed",l)}}let L=()=>r&&o?.state?.personalisation===!0,D=()=>vn(M(n.getSessionId,null),n.propertyId),H=!1;function K(c){try{L()?(D(),bn(dt(On(c.event,c.properties))),H=!0):(xn(),H&&Cn(),H=!1)}catch(l){n.debug&&console.warn("[hp] the visit was not recorded",l)}}function F(c,l){!r||l||o.admits()?(w(c),m.enqueue(c)):o.hold(c)}let I=(c,l,k)=>Dn(n.plan,c)?S({type:"track",event:c,properties:l??{}},k):null,G=new Set,we=(c,l,k)=>c==="audiences"?{audiences:l?null:k.audiences??[]}:c==="decisions"?{decisions:(k.decisions??[]).map(P=>({slot:P.slot,decision_id:P.decision_id??null,arm:P.arm??null,...P.variant&&{variant:P.variant}}))}:{recommendation_request_id:k.recommendation_request_id??null};r&&(o=mn({adapter:n.consent,timeoutMs:n.consentTimeoutMs,cookieDomain:n.consentCookieDomain,debug:n.debug,store:i&&{read:()=>a.items,write:c=>i.write(c,u?.peek()??null)},release(c){c.context&&(c.context.consent=o.stamp()),w(c),m.enqueue(c)},onStatus(c){if(c==="granted"&&(u?.persist(),d.persist(),g&&x(g),v.persist(),m.replayPersisted?.()),c==="denied"){m.clearPersisted?.(),u?.forget(),d.forget();try{sessionStorage.removeItem(b)}catch{}v.forget()}try{n.onConsentStatus?.(c)}catch(l){console.warn("[hp] onConsentStatus observer failed",l)}},announce({action:c,state:l,withdrawal:k}){S({type:"track",event:"Consent Updated",properties:{action:c,state:l}},void 0,k),k&&m.flush()}}),o.start());let me=()=>n.holdout?ut(n.holdout):null,he=()=>lt(n.holdout,B(M(n.getAnonymousId,null))).group;function R(c,l){if(!Array.isArray(c?.decisions))return c;let k=n.holdout?.readoutSlots??[],P=B(M(n.getAnonymousId,null));return{...c,decisions:c.decisions.map(C=>{let W=C?.variant==="bandit"||C?.variant==="default"?C.variant:!l&&C?.holdout!==!0&&k.includes(C?.slot)?yn(C.slot,P):null;return W?W==="default"?{...C,variant:W,decision_id:null}:{...C,variant:W}:C})}}function j(c,l){if(f)return null;let k=c?.exposure,P=k?.holdout===!0,C=R(c,P);return v.remember(hn(C)),!k?.token||G.has(k.token)?null:(G.add(k.token),I("Personalisation Exposed",{exposure_token:k.token,surface:k.surface,holdout:P,holdout_share:k.holdout_share??me()?.holdout_share??null,personalised_share:k.personalised_share??me()?.personalised_share??null,...we(k.surface,P,C)},l))}return{track:I,page(c={},l){let k=n.pageType??null;c.type&&(ae.has(c.type)?(k=c.type,n.pageType=c.type):n.debug&&console.warn(`[hp] ignoring unknown page.type "${c.type}". Allowed: ${[...ae].join(", ")}`));let P=S({type:"page",properties:{name:c.name??null,navigation_trigger:c.navigation_trigger??Vt(),previous_message_id:_()}},{page:{type:k},...Wn(l)??{}});return P&&x(P.messageId),P},identify(c,l){let{userId:k,...P}=c&&typeof c=="object"?c:{};if(k!==void 0&&(h=B(k)),typeof P.email_sha256=="string"){let C=je(P.email_sha256);C?P.email_sha256=C:delete P.email_sha256}return S({type:"identify",traits:P},l)},reset(){h=null,x("")},productViewed:(c,l)=>I("Product Viewed",c,l),productListViewed:(c,l)=>I("Product List Viewed",c,l),recommendationsViewed:(c,l)=>I("Recommendations Viewed",c,l),personalisationExposed:(c,l)=>I("Personalisation Exposed",c,l),recordExposure:j,surfaceViewed({surface:c}={},l){if(!Ho.has(c)||!n.holdout||c!=="decisions"&&!L())return null;let k=B(M(n.getAnonymousId,null)),P=lt(n.holdout,k).group;if(P==="excluded")return null;let C=Mt({sessionId:be(M(n.getSessionId,null),k),surface:c});return C?j({exposure:{token:C,surface:c,holdout:P==="holdout"}},l):null},inHoldout:()=>he()!=="personalised",personalisationGroup:he,productClicked:(c,l)=>I("Product Clicked",c,l),productListFiltered:(c,l)=>I("Product List Filtered",c,l),productsSearched:(c,l)=>I("Products Searched",c,l),productAdded:(c,l)=>I("Product Added",c,l),productRemoved:(c,l)=>I("Product Removed",c,l),cartUpdated:(c,l)=>I("Cart Updated",Go(c),l),identityLinked:(c,l)=>I("Identity Linked",c,l),slotEngaged:(c,l)=>f?null:I("Slot Engaged",c,l),productVariantSelected:(c,l)=>I("Product Variant Selected",c,l),cartViewed:(c,l)=>I("Cart Viewed",c,l),productAddedToWishlist:(c,l)=>I("Product Added to Wishlist",c,l),productRemovedFromWishlist:(c,l)=>I("Product Removed from Wishlist",c,l),wishlistProductAddedToCart:(c,l)=>I("Wishlist Product Added to Cart",c,l),productShared:(c,l)=>I("Product Shared",c,l),cartShared:(c,l)=>I("Cart Shared",c,l),couponEntered:(c,l)=>I("Coupon Entered",c,l),couponApplied:(c,l)=>I("Coupon Applied",c,l),couponDenied:(c,l)=>I("Coupon Denied",c,l),couponRemoved:(c,l)=>I("Coupon Removed",c,l),checkoutStarted:(c,l)=>I("Checkout Started",c,l),promotionViewed:(c,l)=>I("Promotion Viewed",c,l),promotionClicked:(c,l)=>I("Promotion Clicked",c,l),checkoutStepViewed:(c,l)=>I("Checkout Step Viewed",c,l),checkoutStepCompleted:(c,l)=>I("Checkout Step Completed",c,l),paymentInfoEntered:(c,l)=>I("Payment Info Entered",c,l),checkoutFailed:(c,l)=>I("Checkout Failed",c,l),signedIn:(c,l)=>I("Signed In",c,l),signedUp:(c,l)=>I("Signed Up",c,l),signedOut(c){let l=I("Signed Out",{},c);return h=null,l},newsletterSubscribed:(c,l)=>I("Newsletter Subscribed",c,l),newsletterUnsubscribed:(c,l)=>I("Newsletter Unsubscribed",c,l),backInStockSubscribed:(c,l)=>I("Back In Stock Subscribed",c,l),productReviewed:(c,l)=>I("Product Reviewed",c,l),consentUpdated:(c,l)=>I("Consent Updated",c,l),flush:c=>m.flush(c),recommendationContext(){if(!L())return{};try{return D(),dt(En())}catch{return{}}},get consent(){return o?o.state:null},servingHeaders:()=>tn(o?.state??null),get lastPageMessageId(){return _()},get anonymousId(){return B(M(n.getAnonymousId,null))},[Ko](c,l,k){if(typeof this[c]=="function"){E=typeof k?.messageId=="string"&&typeof k?.timestamp=="string"?{messageId:k.messageId,timestamp:k.timestamp}:null;try{this[c](...Array.isArray(l)?l:[])}finally{E=null}}}}}var Et=Symbol.for("@thg-agentic/hyper-personalisation-web.bootstrap"),Xo=Symbol.for("@thg-agentic/hyper-personalisation-web.drain"),Yo=Symbol.for("@thg-agentic/hyper-personalisation-web.carry"),Jn=Symbol.for("@thg-agentic/hyper-personalisation-web.replay"),Zo=Symbol.for("@thg-agentic/hyper-personalisation-web.assignment"),Qo=Symbol.for("@thg-agentic/hyper-personalisation-web.recommendation-context"),Fe=e=>e?()=>U(e):()=>null,Zn={didomi:e=>nn({purposes:e.purposes}),onetrust:e=>rn({groups:e.groups,impliedConsent:e.impliedConsent}),cookie:e=>on({name:e.name,categories:e.categories,refusedValue:e.refusedValue,source:e.source,changeEvent:e.changeEvent}),forwarded:e=>sn({name:e.name}),static:e=>{if(!e.state||typeof e.state!="object")throw new Error('consent.state is required for provider "static"');return an(e.state)}},Xn=Object.keys(Zn),pe=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Be=e=>typeof e=="string"&&e!=="",es=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),Qn=e=>pe(e)&&typeof e.read=="function";function ts(e,t={}){let n=[];if(!pe(e))return["config must be { writeKey, apiHost? }"];Be(e.writeKey)||n.push("writeKey is required"),de(e.apiHost)||n.push("apiHost, when given, must be a host or an http(s) origin"),t.propertyId!==void 0&&!Be(t.propertyId)&&n.push("propertyId must be a string");let{consent:r}=t;if(!Qn(r)&&!(pe(r)&&Xn.includes(r.provider))&&n.push(`consent must be a consent adapter or { provider: ${Xn.join(" | ")} }`),t.autocapture!==void 0&&t.autocapture!==!1&&!pe(t.autocapture)&&n.push("autocapture must be false or { promotions, productLists, recommendations }"),t.beforeSend!==void 0&&typeof t.beforeSend!="function"&&n.push("beforeSend must be a function"),t.identityCookies!==void 0)if(!pe(t.identityCookies))n.push("identityCookies must be an object");else for(let o of["anonymousId","sessionId"]){let s=t.identityCookies[o];s!==void 0&&!Be(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&&(pe(t.dataLayer)?(t.dataLayer.name!==void 0&&!Be(t.dataLayer.name)&&n.push("dataLayer.name must be a string"),t.dataLayer.ignore!==void 0&&!es(t.dataLayer.ignore)&&n.push("dataLayer.ignore must be an array of strings")):n.push("dataLayer must be an object")),n}function ns(e,t,n){if(Qn(e))return st(e,t.consentPurposes);let{provider:r,...o}=e,s=n?.consent?.[r]??Zn[r];return st(s(o),t.consentPurposes)}var er=(e,t)=>`${e??""}|${t??""}`;function rs(e,t){let n=B(t?.userId),r=je(t?.emailSha256);if(!n&&!r)return null;try{let o=q(O("identified"),e);if(sessionStorage.getItem(o)===er(n,r))return null}catch{}return{...n?{userId:n}:{},...r?{email_sha256:r}:{}}}async function os({writeKey:e,apiHost:t},n){if(n.settings!==void 0)return{settings:St(n.settings),revalidated:null};let r=Un(t,e),o=$n(e);if(o)return{settings:o,revalidated:r};let s=await r,i=s??yt;return{settings:i,revalidated:Promise.resolve(i),unreachable:s===null}}function tr(e,t={}){let n=typeof window<"u"?window:null;if(n?.[Et])return n[Et];let r=Yt(e?.writeKey,()=>{let{analytics:s}=ye(U(O("consent")));return s===!0||s===null&&t.holdAcrossPages===!0}),o=is(e,t,r);if(n){let s=t.extend?.getSessionId??Fe(t.identityCookies?.sessionId),i=Fe(t.identityCookies?.anonymousId);n[Zo]=({slot:a,arm:u}={})=>Dt({sessionId:be(s(),i()),slot:a,arm:u}),n[Et]=o,n[Yo]=r,n[Xo]?.(o)}return o}function ss(){let e=globalThis.performance?.now?.();return new Date(Date.now()-(Number.isFinite(e)?e:0)).toISOString()}function Yn(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(We(e,r(n.promotions))),n.productLists&&o.push(Ge(e,r(n.productLists))),n.recommendations&&o.push(ze(e,r(n.recommendations))),n.exposures&&o.push(Ke(e,r(n.exposures)))}catch(s){console.warn("[hp] autocapture not started:",s?.message??s)}return()=>{for(let s of o)s()}}function qe(e){return e.close(),null}async function is(e,t,n){try{let r=ts(e,t);if(r.length)return console.warn(`[hp] not started, the configuration is invalid: ${r.join("; ")}`),qe(n);Ie(t.storageNames),Ae();let{writeKey:o}=e,[{settings:s,revalidated:i,unreachable:a},u]=await Promise.all([os(e,t),Promise.resolve(t.identity).catch(()=>null)]),d=i?s:null,p=!1,f=()=>p&&d&&Vn(o,d);if(i?.then(y=>{y&&(d=y,y.enabled?f():wt(o))}),a)return null;if(!s.enabled)return t.debug&&console.info("[hp] off: the settings for this write key do not enable it"),qe(n);let m=s.propertyId??t.propertyId;if(!m)return console.warn("[hp] not started: this write key covers several properties, so propertyId is required"),qe(n);let{preset:b}=t,g=rs(m,u),_=t.debug===!0||s.debug?.enabled===!0||fn(s.debug?.tokenSha256??null,O("debug")),x=B(u?.userId),v=zn({apiHost:s.apiHost??de(e.apiHost),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:ns(t.consent,s,b),consentCookieDomain:t.consentCookieDomain,storageNames:t.storageNames,holdAcrossPages:t.holdAcrossPages===!0,mintAnonymousId:t.mintAnonymousId,debug:_,anonymousIdSource:s.anonymousId??void 0,getAnonymousId:Fe(t.identityCookies?.anonymousId),getSessionId:t.identityCookies?.sessionId?Fe(t.identityCookies.sessionId):void 0,getUserId:()=>x,beforeSend:t.beforeSend,...t.extend,onConsentStatus(y){if(y==="granted"&&(p=!0,f()),y==="denied"){wt(o);try{sessionStorage.removeItem(q(O("identified"),m))}catch{}}t.extend?.onConsentStatus?.(y)},onEvent(y){if(y.type==="identify"){let w=er(B(y.userId),je(y.traits?.email_sha256));try{sessionStorage.setItem(q(O("identified"),m),w)}catch{}}t.extend?.onEvent?.(y)}});typeof window<"u"&&(window[Qo]=()=>v.recommendationContext());for(let[y,w,L]of n.take())try{v[Jn](y,w,L)}catch(D){console.warn(`[hp] carried ${y} failed`,D)}v[Jn]("page",[t.pageType?{type:t.pageType}:{}],{messageId:Z(),timestamp:ss()});let h=Yn(v,t.autocapture),E=v.page;v.page=(...y)=>{let w=E(...y);return h(),h=Yn(v,t.autocapture),w};let S=typeof window<"u"?window:null;if(t.dataLayer&&S){let y=t.dataLayer.name??"dataLayer";S[y]=S[y]||[],dn(v,{...b,dataLayer:S[y],ignore:[...b?.ignore??[],...t.dataLayer.ignore??[]],onError:w=>_&&console.warn("[hp] dataLayer mapping failed",w)})}return g&&v.identify(g),v}catch(r){return console.warn("[hp] not started:",r?.message??r),qe(n)}}function nr(e){e.initialized=!0,tr(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 V=window.hp=window.hp||[];V.servingHeaders??(V.servingHeaders=()=>({}));V.inHoldout??(V.inHoldout=()=>!0);V.personalisationGroup??(V.personalisationGroup=()=>"excluded");V.recommendationContext??(V.recommendationContext=()=>({}));V.initialized||(V._config?nr(V):V.load=(e,t)=>{V._config=e,V._options=t??{},nr(V)});})();
1
+ (()=>{var qt=e=>{throw TypeError(e)};var Ar=(e,t,n)=>t.has(e)||qt("Cannot "+n);var Ft=(e,t,n)=>t.has(e)?qt("Cannot add the same private member more than once"):t instanceof WeakSet?t.add(e):t.set(e,n);var O=(e,t,n)=>(Ar(e,t,"access private method"),n);var Se=[];for(let e=2;Se.length<64;e++)Se.every(t=>e%t!==0)&&Se.push(e);var Ht=e=>(e-Math.floor(e))*2**32>>>0,Er=Se.slice(0,8).map(e=>Ht(Math.sqrt(e))),vr=Se.map(e=>Ht(Math.cbrt(e))),W=(e,t)=>e>>>t|e<<32-t;function Kt(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(Er),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 x=o[w-15],k=o[w-2],v=W(x,7)^W(x,18)^x>>>3,h=W(k,17)^W(k,19)^k>>>10;o[w]=o[w-16]+v+o[w-7]+h}let[i,a,u,d,f,p,y,b]=r;for(let w=0;w<64;w++){let x=W(f,6)^W(f,11)^W(f,25),k=b+x+(f&p^~f&y)+vr[w]+o[w]|0,h=(W(i,2)^W(i,13)^W(i,22))+(i&a^i&u^a&u)|0;[b,y,p,f,d,u,a,i]=[y,p,f,d+k|0,u,a,i,k+h|0]}[i,a,u,d,f,p,y,b].forEach((w,x)=>{r[x]+=w})}return Array.from(r,s=>s.toString(16).padStart(8,"0")).join("")}var Qe=(e,t)=>e<<t|e>>>32-t;function Gt(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]:Qe(r[p-3]^r[p-8]^r[p-14]^r[p-16],1);let[i,a,u,d,f]=n;for(let p=0;p<80;p++){let y,b;p<20?(y=a&u|~a&d,b=1518500249):p<40?(y=a^u^d,b=1859775393):p<60?(y=a&u|a&d|u&d,b=2400959708):(y=a^u^d,b=3395469782);let w=Qe(i,5)+y+f+b+r[p]|0;[f,d,u,a,i]=[d,u,Qe(a,30),i,w]}[i,a,u,d,f].forEach((p,y)=>{n[y]+=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 Cr="e28e8ada-5b76-4209-bba9-79b823a0af75",Pr=e=>Array.from(e,t=>t.toString(16).padStart(2,"0")).join("");function zt(e,t){let n=Uint8Array.from(e.replace(/-/g,"").match(/../g),a=>Number.parseInt(a,16)),r=new TextEncoder().encode(t),o=new Uint8Array(16+r.length);o.set(n),o.set(r,16);let s=Gt(o).slice(0,16);s[6]=s[6]&15|80,s[8]=s[8]&63|128;let i=Pr(s);return`${i.slice(0,8)}-${i.slice(8,12)}-${i.slice(12,16)}-${i.slice(16,20)}-${i.slice(20)}`}var re=(e,t)=>typeof e=="string"&&e!==""&&e.length<=t?e:null;function Oe(e,t){return re(e,64)??re(t,256)}function Wt({sessionId:e,slot:t,arm:n}={}){let r=re(e,256);return!r||!re(t,256)||!re(n,256)?null:zt(Cr,`${r}:${t}:${n}`)}var Or="4b1f2c7e-9a3d-4e58-b6c1-2d7f0a9e8c53";function Jt({sessionId:e,surface:t}={}){let n=re(e,256);return!n||!re(t,64)?null:zt(Or,`${n}:${t}`)}var Lr=Array.from({length:11},(e,t)=>t/10);function Tr(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,a=o?Math.min(i,o.width*o.height):i;return a>0&&s/a>=t}function X(e){let{selector:t,onViewable:n,visibleRatio:r=.5,dwellMs:o=1e3,root:s=document}=e,i=new Map,a=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 E of h){let S=E.target;if(!Tr(E,r)){u.delete(S),f(S);continue}u.add(S),y()&&d(S)}},{threshold:Lr}),y=()=>typeof document>"u"||document.visibilityState!=="hidden",b=()=>{if(y())for(let h of u)d(h);else for(let h of u)f(h)};document.addEventListener("visibilitychange",b);let w=()=>{for(let h of s.querySelectorAll(t))a.has(h)||(a.add(h),p?.observe(h))},x=typeof MutationObserver>"u"?null:new MutationObserver(()=>w()),k=()=>{w(),x?.observe(s===document?document.body:s,{childList:!0,subtree:!0})},v=s===document&&!document.body;return v?document.addEventListener("DOMContentLoaded",k,{once:!0}):k(),()=>{v&&document.removeEventListener("DOMContentLoaded",k),document.removeEventListener("visibilitychange",b),p?.disconnect(),x?.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 X({selector:n,root:s,visibleRatio:r,dwellMs:o,onViewable(i){let a=i.dataset?.hpExposure?.trim();return a&&e.surfaceViewed({surface:a}),!0}})}var Yt=e=>{try{return new URL(e,document.baseURI).toString()}catch{return e}};function tt(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,a=new Set,u=w=>w.closest?.(n)??null,d=w=>{let x=w.dataset.hpList?.trim();return x?{list_id:x,category:w.dataset.hpListCategory?.trim()||null}:null},f=w=>Array.from(w.querySelectorAll(r)).filter(x=>u(x)===w),p=(w,x)=>{try{let k=JSON.parse(w.dataset.hpProduct??"");return!k||typeof k!="object"||!k.product_id?null:{...k,position:k.position??x+1,...k.url?{url:Yt(k.url)}:{},...k.image_url?{image_url:Yt(k.image_url)}:{}}}catch{return null}},y=X({selector:`${n} ${r}`,root:i,visibleRatio:o,dwellMs:s,onViewable(w){let x=u(w);if(!x||x.dataset.hpListView==="manual")return!0;let k=d(x);if(!k||a.has(k.list_id))return!0;let v=new Set,h=f(x).map(p).filter(E=>!E||v.has(E.product_id)?!1:(v.add(E.product_id),!0));return h.length===0||(a.add(k.list_id),e.productListViewed({...k,products:h})),!0}}),b=w=>{let k=w.target?.closest?.("a[href]")?.closest(r);if(!k)return;let v=u(k),h=p(k,v?f(v).indexOf(k):0);h&&e.productClicked({list_id:v?d(v)?.list_id??null:null,products:[h]})};return document.addEventListener("click",b,!0),()=>{document.removeEventListener("click",b,!0),y()}}function N(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 Le(e,...t){let n=N(e,...t);if(n===null)return null;let r=Number(n);return Number.isFinite(r)?Math.trunc(r):null}function Nr(e,t){let n=N(e,"hpPromotion");return n?{promotion_id:n,name:N(e,"hpPromotionName"),creative:N(e,"hpPromotionCreative"),position:N(e,"hpPromotionSlot")??String(t+1)}:null}function nt(e,t={}){if(typeof window>"u"||typeof document>"u")return()=>{};let{selector:n="[data-hp-promotion]",resolve:r=Nr,visibleRatio:o=.5,dwellMs:s=1e3,root:i=document}=t,a=new Set,u=p=>{let y=Array.from(i.querySelectorAll(n)),b=y.indexOf(p);try{return r(p,b<0?y.length:b)}catch{return null}},d=X({selector:n,root:i,visibleRatio:o,dwellMs:s,onViewable(p){let y=u(p);return!y||a.has(y.promotion_id)?!1:(a.add(y.promotion_id),e.promotionViewed(y),!0)}}),f=p=>{let y=p.target;if(!y||typeof y.closest!="function")return;let b=y.closest(n),w=y.closest("a[href]");if(!b||!w||!b.contains(w)&&!w.contains(b))return;let x=u(b);x&&e.promotionClicked({...x,href:w.getAttribute("href")})};return document.addEventListener("click",f,!0),()=>{document.removeEventListener("click",f,!0),d()}}function Rr(e){let t=N(e,"hpRecoRequest"),n=N(e,"hpRecoPlacement"),r=N(e,"hpRecoStrategy");if(!t||!n||!r)return null;let o=N(e,"hpRecoHoldout");return{recommendation_request_id:t,placement:n,strategy:r,recipe:N(e,"hpRecoRecipe"),algorithm_version:N(e,"hpRecoAlgorithmVersion"),experiment:N(e,"hpRecoExperiment"),variant:N(e,"hpRecoVariant"),holdout:o===null?null:o==="true",assignment_bucket:Le(e,"hpRecoBucket"),assignment_unit_kind:N(e,"hpRecoUnitKind"),candidate_set_fingerprint:N(e,"hpRecoFingerprint"),candidate_set_size:Le(e,"hpRecoCandidates"),ranked_by:N(e,"hpRecoRankedBy"),served_at:N(e,"hpRecoServedAt")}}function Dr(e,t){let n=N(e,"hpRecoProduct");if(!n)return null;let r=N(e,"hpRecoPrice");return{product_id:n,sku:N(e,"hpRecoSku"),name:N(e,"hpRecoName"),brand:N(e,"hpRecoBrand"),price:r===null||Number.isNaN(Number(r))?null:Number(r),position:Le(e,"hpRecoPosition")??t+1}}function rt(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=Rr,resolveTile:s=Dr,visibleRatio:i=.5,dwellMs:a=1e3,root:u=document}=t,d=new Set,f=new Map,p=new Map,y=(h,...E)=>{try{return h(...E)}catch{return null}},b=h=>typeof h.closest=="function"?h.closest(n):null,w=h=>Array.from(h.querySelectorAll(r)),x=(h,E)=>{if(p.delete(E.recommendation_request_id),d.has(E.recommendation_request_id))return;let S=w(h).map((_,L)=>y(s,_,L)).filter(_=>_?.product_id);if(S.length===0)return;d.add(E.recommendation_request_id);let g=[...f.get(E.recommendation_request_id)?.values()??[]].sort((_,L)=>_.position-L.position);e.recommendationsViewed({...E,products:S,viewable:g})},k=X({selector:`${n} ${r}`,root:u,visibleRatio:i,dwellMs:a,onViewable(h){let E=b(h);if(!E)return!0;let S=y(o,E);if(!S)return!0;let g=S.recommendation_request_id,_=y(s,h,w(E).indexOf(h));if(_?.product_id){f.has(g)||f.set(g,new Map);let L=f.get(g);L.has(_.position)||L.set(_.position,{position:_.position,product_id:_.product_id,viewable_at:new Date().toISOString()})}return!d.has(g)&&!p.has(g)&&p.set(g,setTimeout(()=>x(E,S),0)),!0}}),v=h=>{let E=h.target;if(!E||typeof E.closest!="function")return;let S=E.closest(r);if(!S)return;let g=E.closest("[data-hp-reco-interaction]"),_=E.closest("a[href]"),L=_&&(S.contains(_)||_.contains(S));if(!(g&&S.contains(g))&&!L)return;let R=b(S);if(!R)return;let H=y(o,R);if(!H)return;let K=y(s,S,w(R).indexOf(S));if(!K?.product_id)return;let j=H.recommendation_request_id;d.has(j)||(clearTimeout(p.get(j)),x(R,H)),e.productClicked({recommendation_request_id:H.recommendation_request_id,interaction:N(g??S,"hpRecoInteraction")??"navigate",products:[K]})};return document.addEventListener("click",v,!0),()=>{document.removeEventListener("click",v,!0);for(let h of p.values())clearTimeout(h);p.clear(),k()}}var pe=new Set(["home","list","product","search","basket","checkout","order_confirmation","login","register","account","info","blog","other"]),Mr=new Set(["products"]),Xt=e=>e==null;function ot(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=>ot(r,t)):Object.fromEntries(Object.entries(e).filter(([,r])=>!Xt(r)).map(([r,o])=>[r,ot(o,t)]));return t.delete(e),n}function st(e){if(!e)return e;let t=ot(e);for(let n of Mr)n in e&&Xt(e[n])&&(t[n]=e[n]);return t}function Zt(){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 $r=new Set(["","unknown","undefined","null","none","nil","nan","anonymous","guest","0","-1"]);function q(e){if(e==null)return null;let t=String(e).trim();return $r.has(t.toLowerCase())?null:t}function Z(){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 Qt="1.15";function M(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 Ur={gclid:"gclid",fbclid:"fbclid",ttclid:"ttclid"},Vr=/[a-z0-9._%+-]+@[a-z0-9-]+(\.[a-z0-9-]+)*\.[a-z]{2,}/i,Br=/\d(?:[ -]?\d){12,}/,jr=new Set(["gclid","fbclid","ttclid","msclkid"]);function tn(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=!jr.has(String(t).toLowerCase());return n.some(o=>Vr.test(o)||r&&Br.test(o))}function qr(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(Ur)]){let i=t.get(o);i&&!tn(i,o)&&(n[s]=i)}return Object.keys(n).length?n:null}var Fr=["email","e-mail","password","pass","pwd","token","auth","code","uid","customer_id","postcode","zip","phone","applyCode"],Hr=["email","password","passwd","pwd","token","secret","auth","session","phone","postcode","zip","address","birth","card","cvv","iban","ssn","customerid","userid"],Kr=["tel","uid","dob"],Gr=["utm_source","utm_medium","utm_campaign","utm_term","utm_content","gclid","fbclid","ttclid","msclkid"],zr=new Set(Fr.map(e=>e.toLowerCase()));function Wr(e){let t=String(e).toLowerCase();if(zr.has(t))return!0;let n=t.replace(/[-_.]/g,"");return Hr.some(o=>n.includes(o))?!0:String(e).replace(/([a-z0-9])([A-Z])/g,"$1 $2").toLowerCase().split(/[^a-z0-9]+/).some(o=>Kr.includes(o))}function it(e){return(e??[]).map(t=>{try{return new RegExp(`^${t}$`,"i")}catch{return{test:n=>n.toLowerCase()===String(t).toLowerCase()}}})}function nn(e,t={}){if(!e)return null;try{let n=new URLSearchParams(e),r=t.queryParamAllowlist?it([...t.queryParamAllowlist,...Gr]):null,o=it(t.queryParamBlocklist),s=it(t.sensitiveParamAllowlist);for(let a of new Set(n.keys()))(Wr(a)&&!s.some(d=>d.test(a))||n.getAll(a).some(d=>tn(d,a))||(r?!r.some(d=>d.test(a)):o.some(d=>d.test(a))))&&n.delete(a);let i=n.toString();return i?`?${i}`:""}catch{return""}}function Jr(e,t,n={}){if(!e)return null;try{let r=new URL(e);return t&&r.origin===t?r.origin+r.pathname+(nn(r.search,n)??""):r.origin+r.pathname}catch{return null}}function at(e){if(typeof e!="string")return null;let t=e.trim().toUpperCase();return/^[A-Z]{3}$/.test(t)?t:null}function en(e){if(typeof e!="string")return null;let t=e.trim().toUpperCase();return/^[A-Z]{2}$/.test(t)?t:null}function Yr(e){if(typeof e!="string")return null;let t=e.trim().replace(/_/g,"-");if(!/^[A-Za-z]{2,3}(-[A-Za-z0-9]{2,8})*$/.test(t))return null;try{return Intl.getCanonicalLocales(t)[0]}catch{return null}}function D(e,t){if(typeof e=="function")try{let n=e();if(n!=null)return n}catch{}return t}function Xr(e){return{property_id:String(e.propertyId),channel:e.channel??null,market:e.market??null,environment:e.environment??null}}function Zr(e){let t=typeof window<"u"?window.location:null,n=t?nn(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"?Jr(document.referrer,t?.origin,e):null,title:typeof document<"u"&&document.title||null,type:e.pageType??null}}function rn(e,t={}){let n=typeof window<"u"?window.location:null,r={library:{name:e.libraryName,version:e.libraryVersion},spec:{version:Qt},source:Xr(e),session_id:D(e.getSessionId,null),identity_trust:q(D(e.getAnonymousId,null))?"device":"none",page:Zr(e),campaign:n?qr(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:at(D(e.getCurrency,e.currency)),locale:Yr(D(e.getLocale,e.locale)),timezone:(()=>{try{return Intl.DateTimeFormat().resolvedOptions().timeZone}catch{return null}})(),country:en(e.country),ship_to_country:en(D(e.getShipToCountry,e.shipToCountry)),ip:null,bot:null,consent:e.getConsent?.()??null,experiments:D(e.getExperiments,null),audiences:D(e.getAudiences,null),decisions:D(e.getDecisions,null),recommendations:D(e.getRecommendations,null),extensions:D(e.getExtensions,null)};return on(r,t)}function on(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]=on(e[r],o):o!==void 0&&(n[r]=o);return n}var ie=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"}),Qr={retry:"cdp.retry",sessionSignals:"cdp_session_signals",identified:"cdp_identified",previousPage:"cdp_prev_page_message_id"},ct={...ie},sn=!1;function Te(e){let t={...ie};for(let[n,r]of Object.entries(e??{})){if(!(n in ie))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}ct=t}function T(e){return ct[e]}var eo="_",an=e=>e==null||e===""?eo:String(e);function F(e,t,n){let r=`${e}:${an(t)}`;return n==null||n===""?r:`${r}:${n}`}function cn(e,t){return`${e}:${an(t)}:`}function Ne(){if(!sn){sn=!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(Qr)){if(n!==o&&!n.startsWith(`${o}:`))continue;let s=ct[r]+n.slice(o.length);t.getItem(s)===null&&t.setItem(s,t.getItem(n)),t.removeItem(n)}}catch{}}}}var lt=1800*1e3,Re=()=>{try{return typeof sessionStorage>"u"?null:sessionStorage}catch{return null}},ut=()=>{try{return typeof localStorage>"u"?null:localStorage}catch{return null}};function un(e,t=()=>Date.now()){return{read(){try{let n=Re()?.getItem(e),r=n?JSON.parse(n):null;return!r||t()-r.savedAt>lt?(r&&Re()?.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?Re()?.removeItem(e):Re()?.setItem(e,JSON.stringify({savedAt:t(),items:n,anonymousId:r}))}catch{}}}}var to=400*24*60*60;function Q(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 no({name:e,domain:t=null,legacyKey:n,read:r,mint:o,mayStore:s,carried:i=null}){let a=null;try{a=ut()?.getItem(n)||null}catch{a=null}let u=r(e)??a??i,d=!1,f=()=>{if(!(d||u===null||!s())&&(d=Q(e,u,to,t),!(!d||a===null)))try{ut()?.removeItem(n),a=null}catch{}};return{get(){return u??(u=o()),f(),u},peek:()=>u,persist:f,forget(){Q(e,"",0,t),u=null,d=!1;try{ut()?.removeItem(n)}catch{}a=null}}}function ln(e,{carried:t=null,mayStore:n,orOwn:r=!1}){let o=e.anonymousIdSource,s=()=>no({name:T("anonymousId"),domain:e.consentCookieDomain??null,legacyKey:F(T("anonymousId"),e.propertyId),read:M,mint:Z,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=()=>M(u)}if(!r)return null;let i=e.getAnonymousId,a=s();return e.getAnonymousId=()=>q(D(i,null))??a.get(),a}var ro=200;function dn(e,t,n=()=>Date.now()){let r=()=>F(T("carried"),e),o=!1;function s(){try{let i=JSON.parse(sessionStorage.getItem(r())??"null");return!i||!(n()-i.savedAt<=lt)?[]: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(-ro)})),!0)}catch{return!1}},close(){o=!0}}}var yi=ie.consent,De=Object.freeze({visitor:"visitor",host:"host"}),fn=()=>({basis:De.host}),oo="hp-consent",ae=["analytics","marketing","personalisation","ad_user_data","ad_personalization"],pn={analytics:"a",marketing:"m",personalisation:"p",ad_user_data:"aud",ad_personalization:"adp"},Y=()=>typeof window<"u",mn=()=>Y()&&typeof window.cookieStore?.addEventListener=="function",so=e=>e===!0?!0:e===!1?!1:null;function me(e){if(!e||typeof e!="object")return null;let t={};for(let n of ae)t[n]=so(e[n]);return t}function ft(e,t){return!e||!t?e===t:ae.every(n=>e[n]===t[n])}function pt(e){if(!e)return"";let t=[];for(let n of ae){let r=e[n];(r===!0||r===!1)&&t.push(`${pn[n]}=${r?1:0}`)}return t.join("&")}function hn(e){return{[oo]:pt(me(e))}}function _e(e){let t=me({});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(pn).map(([s,i])=>[i,s])),o=new Set;for(let s of n.split("&")){let i=s.indexOf("=");if(i<=0)continue;let a=r[s.slice(0,i).trim()],u={1:!0,0:!1}[s.slice(i+1).trim()]??null;!a||u===null||o.has(a)||(t[a]===null?t[a]=u:t[a]!==u&&(t[a]=null,o.add(a)))}return t}function mt(e,t){if(!t)return e;let n=r=>{if(!r)return r;let o={...r};for(let s of ae)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 ht(e,t={}){return{...e,ad_user_data:t.ad_user_data??e.marketing,ad_personalization:t.ad_personalization??e.marketing}}function Me(e,t){let n=!0;return{notify:()=>{if(n)try{let o=e();o&&t(o)}catch{}},stop:()=>n=!1}}var io={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 ao(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(a=>{let u=String(a).toLowerCase();return s===u||s.startsWith(`${u}-`)})&&(n=!0,o?.enabled===!0))return!0}return n?!1:null}function gn(e={}){let t={...io,...e.purposes};function n(){let r=Y()?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=>ao(o,t[i]);return ht({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(!Y())return()=>{};let o=Me(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 dt(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 yn(e={}){let t={analytics:"C0002",personalisation:"C0003",marketing:"C0004",...e.groups},n=e.impliedConsent===!0;function r(){let i=Y()?window.OnetrustActiveGroups:void 0;if(typeof i=="string"&&i.length){let d=new Set(i.split(",").map(f=>f.trim()).filter(Boolean));return f=>d.has(f)}let a=dt(M("OptanonConsent"));if(!a.groups)return null;let u={};for(let d of a.groups.split(",")){let[f,p]=d.split(":");f?.trim()&&(u[f.trim()]=p==="1"?!0:p==="0"?!1:null)}return d=>u[d]??null}function o(){if(M("OptanonAlertBoxClosed"))return!0;try{if(Y()&&window.OneTrust?.IsAlertBoxClosed?.()===!0)return!0}catch{}return Number.parseInt(dt(M("OptanonConsent")).interactionCount,10)>0?!0:n&&Y()&&(!!window.OneTrust||typeof window.OnetrustActiveGroups=="string")}function s(){if(!o())return null;let i=r();if(!i)return null;let a=p=>t[p]?i(t[p]):null,u=ht({analytics:a("analytics"),marketing:a("marketing"),personalisation:a("personalisation")},{ad_user_data:a("ad_user_data"),ad_personalization:a("ad_personalization")}),d=dt(M("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(!Y())return()=>{};let a=Me(s,i),u=!1,d=()=>{u||!window.OneTrust?.OnConsentChanged||(u=!0,window.OneTrust.OnConsentChanged(a.notify))};window.addEventListener("OneTrustGroupsUpdated",a.notify);let f=window.OptanonWrapper;return window.OptanonWrapper=function(...y){try{typeof f=="function"&&f.apply(this,y)}finally{d(),a.notify()}},d(),()=>{a.stop(),window.removeEventListener("OneTrustGroupsUpdated",a.notify)}}}}function co(e){let t=String(e).split(",").map(n=>n.trim()).filter(Boolean);return t.length?new Set(t):null}function wn(e){let{name:t,categories:n,parse:r=co,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 a(){let u=M(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 ht({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:a,get observesChanges(){return mn()},subscribe(u){if(!Y())return()=>{};let d=Me(a,u),f=p=>{[...p.changed??[],...p.deleted??[]].some(b=>b?.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 Sn(e={}){let t=e.name??T("consent"),n=()=>{let r=M(t);if(r==null)return null;let o=_e(r);return o.analytics==null?null:o};return{name:"forwarded",read:n,get observesChanges(){return mn()},subscribe(r){if(!Y())return()=>{};let o=Me(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 _n(e){let t=me(e);return{name:"static",basis:De.host,read:()=>t?{...t}:null,observesChanges:!0,subscribe:()=>()=>{}}}function bn(e){if(e==null)return null;let t=String(e).split("/").map(n=>n.trim()).filter(Boolean).join("/");return t===""?null:t}function uo(e){let t=e.item_category;if(t!=null&&String(t).includes("/"))return bn(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 bn(n.join("/"))}var lo=e=>{if(e==null||typeof e=="object")return null;let t=String(e).trim();return t===""?null:t};function fo(...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 $e=e=>fo(e.item_group_id,e.item_id);function po(e,t=$e){if(!e)return null;let n=a=>a==null||a===""||Number.isNaN(Number(a))?null:Number(a),r=a=>{let u=n(a);return u==null?null:Math.round(u*1e6)/1e6},o=a=>{let u=r(a);return u!=null&&u>=0?u:null},s=a=>{let u=n(a);return Number.isInteger(u)&&u>=0?u:null},i=lo;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:uo(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 gt(e,t=$e){return(e??[]).map(n=>po(n,t)).filter(n=>n?.product_id)}var mo=1e3,ho={shipping:2,payment:3},go=new Set(["password","google","apple","facebook","magic_link","sso","passkey","other"]),$=e=>{if(e==null||typeof e=="object")return null;let t=String(e).trim();return t===""?null:t},yo=e=>{if(e==null||e===""||typeof e=="object")return null;let t=Number(e);return Number.isFinite(t)&&t>=0?t:null},Ue=e=>e!==null&&typeof e=="object";function wo(e){return Array.isArray(e.items)?e.items.filter(Ue):null}function xn(e){let t=$(e)?.toLowerCase().replace(/[\s-]+/g,"_");return t?go.has(t)?t:t==="email"||t==="email_password"?"password":"other":null}function So({ecommerce:e,items:t}){let n=s=>({promotion_id:$(s.promotion_id),name:$(s.promotion_name),creative:$(s.creative_name),position:$(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 In=({ecommerce:e,items:t})=>$(e.item_list_id)??$(e.item_list_name)??$(t[0]?.item_list_id)??$(t[0]?.item_list_name),ce=(e,t)=>t.products?.length?{event:e,properties:t}:null,_o=new Set(["product","products","item","items"]);function bo({ecommerce:e}){let t=$(e.item_id),n=$(e.content_type)?.toLowerCase();return!t||n&&!_o.has(n)?null:{event:"Product Shared",properties:{share_via:$(e.method),products:[{product_id:t}]}}}function xo(e){let t=o=>ce("Product List Viewed",{list_id:In(o),products:o.products}),n=o=>{let s=$(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=>ce("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=>ce("Product Clicked",{list_id:In(o),products:o.products.slice(0,1)}),add_to_cart:o=>ce("Product Added",{cart_id:$(o.ecommerce.cart_id),products:o.products}),remove_from_cart:o=>ce("Product Removed",{cart_id:$(o.ecommerce.cart_id),products:o.products}),view_cart:o=>({event:"Cart Viewed",properties:{cart_id:$(o.ecommerce.cart_id),value:o.value,currency:o.currency,coupon:$(o.ecommerce.coupon),...o.itemsListed?{products:o.products}:{}}}),begin_checkout:o=>ce("Checkout Started",{value:o.value,currency:o.currency,coupon:$(o.ecommerce.coupon),products:o.products}),add_shipping_info:o=>({event:"Checkout Step Completed",properties:{step:e.shipping,step_name:"shipping",shipping_method:$(o.ecommerce.shipping_tier)}}),add_payment_info:o=>({event:"Payment Info Entered",properties:{step:e.payment,step_name:"payment",payment_method:$(o.ecommerce.payment_type)}}),view_promotion:r("Promotion Viewed"),select_promotion:r("Promotion Clicked"),add_to_wishlist:o=>ce("Product Added to Wishlist",{products:o.products}),share:bo,login:o=>({event:"Signed In",properties:{method:xn(o.ecommerce.method)}}),sign_up:o=>({event:"Signed Up",properties:{method:xn(o.ecommerce.method)}})}}var Io=e=>e.event;function ko(e,t){if(!Ue(e))return null;if(typeof e.length=="number"&&e[0]==="event"&&typeof e[1]=="string"){let r=Ue(e[2])?e[2]:{};return{name:e[1],entry:r,ecommerce:r}}let n=$(t(e));return n?{name:n,entry:e,ecommerce:Ue(e.ecommerce)?e.ecommerce:e}:null}function yt(e){return Array.isArray(e)?`[${e.map(yt).join(",")}]`:e&&typeof e=="object"?`{${Object.keys(e).sort().map(t=>`${JSON.stringify(t)}:${yt(e[t])}`).join(",")}}`:JSON.stringify(e??null)}function kn(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=xo({...ho,...t.steps}),o=t.map??{},s=t.eventName??Io,i=t.productId??$e,a=new Set(["purchase","refund",...t.ignore??[]]),u=t.dedupeMs??mo,d=new Map,f=!0;function p(S,g,_){if(u<=0)return!1;let L=`${S}|${_??""}|${yt(g)}`,R=Date.now();for(let[H,K]of d)R-K>u&&d.delete(H);return d.has(L)?!0:(d.set(L,R),!1)}let y=null,b=new Set;function w(S,g){if(S!=="Product Viewed")return!1;let _=typeof location>"u"?"":location.pathname;_!==y&&(y=_,b.clear());let L=g.products?.[0]?.product_id;return L?b.has(L)?!0:(b.add(L),!1):!1}function x({event:S,properties:g={}},_){if(!S||p(S,g,_)||w(S,g))return;let L=_?{context:{currency:_}}:void 0;if(S==="Signed Out"&&typeof e.signedOut=="function"){e.signedOut(L);return}e.track(S,g,L)}function k(S){let g=t.transform?t.transform(S):S,_=ko(g,s);if(!_||a.has(_.name))return;let L=Object.hasOwn(o,_.name),R=L?o[_.name]:r[_.name];if(typeof R!="function")return;let H=wo(_.ecommerce),K=H??[],j={..._,items:K,itemsListed:H!==null,products:gt(K,i),currency:at(_.ecommerce.currency),value:yo(_.ecommerce.value)};j.promotions=So(j);let te=L?R(g,{...j,toProducts:z=>gt(z,i)}):R(j);for(let z of[te].flat())z&&x(z,j.currency)}function v(S){if(f)try{k(S)}catch(g){try{t.onError?.(g,S)}catch{}}}for(let S of n.slice())v(S);let h=n.push;function E(...S){let g=h.apply(this,S);for(let _ of S)v(_);return g}return n.push=E,()=>{f=!1,n.push===E&&(n.push=h)}}var Ao="hp_debug",Eo=256;function vo(){try{return new URLSearchParams(location.search).get(Ao)}catch{return null}}function An(e,t){if(typeof location>"u")return!1;try{let n=vo();if(n!==null){let o=n.trim();o===""||o.length>Eo?sessionStorage.removeItem(t):sessionStorage.setItem(t,o)}let r=sessionStorage.getItem(t);return!!(e&&r&&Kt(r)===e)}catch{return!1}}var he=class extends Error{},Co={inHoldout:()=>!0,personalisationGroup:()=>"excluded",servingHeaders:()=>({}),recommendationContext:()=>({}),flush:()=>Promise.resolve(),reset:()=>{}};function wt(e,t){let n=Co[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 he)throw i;return r(i)}}}function En(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 be=Symbol("hp.identityOption");var Po=4320*60*60,Oo=100,Lo=1e3,To=2e3,vn=500,Ve=e=>(e?.unref?.(),e);function No(e,t){if(t?.analytics===!0&&e.analytics===!1)return"withdrawn";let n=ae.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 Ro(e,t,n=T("consent")){if(!(typeof document>"u"))try{let r=typeof location<"u"&&location.protocol==="https:"?"; Secure":"",o=t?`; Domain=${t}`:"";document.cookie=`${n}=${pt(e)}; Path=/; Max-Age=${Po}; SameSite=Lax`+o+r}catch{}}function Do(e){let t=_e(M(e));return ae.some(n=>t[n]!==null)?t:null}function Cn(e){let{adapter:t,timeoutMs:n=5e3,cookieDomain:r=null,cookieName:o=T("consent"),release:s,announce:i}=e,a=e.discard??(()=>{}),u="pending",d=null,f=null,p=null,y=null,b=!1,w=null,x=[],k=m=>{u=m,e.onStatus?.(m)};function v(){try{return me(t.read())}catch{return null}}function h(){f&&clearInterval(f),p&&clearTimeout(p),f=null,p=null}let E=()=>typeof window<"u"&&typeof document<"u",S=()=>{try{return typeof t.subscribe=="function"&&t.observesChanges===!0}catch{return!1}};function g(){y&&clearInterval(y),y=null}function _(){b||y||d===null||S()||E()&&document.visibilityState==="hidden"||(y=Ve(setInterval(()=>j(v()),To)))}let L=()=>u==="pending"||u==="unknown",R=e.store??null,H=()=>{let m=x.splice(0);R?.write([]);for(let B of m)s(B)},K=()=>{let m=x.splice(0);R?.write([]);for(let B of m)a(B)};function j(m){let B=me(m);if(!B||B.analytics===null)return;let ve=d===null,J=ve?Do(o):d;if(!ve&&ft(J,B))return;h(),d=B,_(),Ro(B,r,o);let Ce=!ft(J,B);if(B.analytics){k("granted"),H(),Ce&&i({action:No(B,J),state:B,previous:J,withdrawal:!1});return}K(),J?.analytics===!0&&i({action:"withdrawn",state:B,previous:J,withdrawal:!0}),k("denied")}function te(){p=null,u==="pending"&&(k("unknown"),f&&clearInterval(f),f=Ve(setInterval(()=>j(v()),Lo)))}function z(m){L()&&(R||m?.type!=="visibilitychange"&&!m?.persisted&&K())}let ne=m=>{document.visibilityState==="hidden"?(g(),z(m)):_()},de=m=>{g(),z(m)},Ee=()=>_();return{get status(){return u},get state(){return d?{...d}:null},stamp(){return d?{...d,source:t.name??null,basis:t.basis??De.visitor}:null},admits(){return u==="granted"},hold(m){return!L()||x.length>=vn?(a(m),!1):(x.push(m),R?.write(x),!0)},onHidden:z,start(){b=!1;try{w=t.subscribe?.(m=>j(m))??null}catch(m){e.debug&&console.warn("[hp] consent adapter subscribe failed",m)}E()&&(window.addEventListener("pagehide",de),window.addEventListener("pageshow",Ee),document.addEventListener("visibilitychange",ne)),R&&x.length===0&&x.push(...R.read().slice(-vn)),j(v()),!d&&(f=Ve(setInterval(()=>j(v()),Oo)),p=Ve(setTimeout(te,n)))},stop(){b=!0,h(),g(),typeof w=="function"&&w(),E()&&(window.removeEventListener("pagehide",de),window.removeEventListener("pageshow",Ee),document.removeEventListener("visibilitychange",ne))}}}var Mo=["recommendation","search_rank","banner","offer","layout","copy","price","other"],Be=e=>typeof e=="string"&&e!=="";function Pn(e){return(Array.isArray(e?.decisions)?e.decisions:[]).filter(t=>Be(t?.slot)&&Be(t.decision_id)&&t.holdout!==!0).map(({decision_id:t,slot:n,arm:r,kind:o})=>({decision_id:t,slot:n,...Be(r)&&{arm:r},...Mo.includes(o)&&{kind:o}}))}function On({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=>Be(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(a=>a.slot));n=[...r().filter(a=>!i.has(a.slot)),...s],o()},forget(){n=[];try{sessionStorage.removeItem(e)}catch{}}}}function $o(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 je(e,t,n=1e4){return $o(`${t}\0${e}`)%n}function St(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 _t(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}=St(e),s=je(t,e.salt),i=u=>Math.round(u*1e4),a=r>0&&s<i(r)?"holdout":!n||s<i(r+o)?"personalised":"excluded";return{holdout:a==="holdout",bucket:s,group:a}}function Ln(e,t){return typeof e!="string"||e===""||t==null||t===""?null:je(t,`bandit-vs-default:${e}`)<1e4/2?"default":"bandit"}var Uo="hp_preview",Vo=256;function Tn(e,t=null){if(typeof location>"u")return M(e);let n=null;try{n=new URLSearchParams(location.search).get(Uo)}catch{n=null}if(n===null)return M(e);let r=n.trim();return r===""||r.length>Vo?(Q(e,"",0,t),null):(Q(e,r,null,t),r)}var Bo=40,jo=128,qo=5,Fo=60,Rn=e=>typeof e=="string"&&e!==""&&e.length<=jo&&!e.includes(","),Nn=e=>Array.isArray(e)?e.filter(Rn).slice(0,Bo):[],Ho=e=>Array.isArray(e)?e.filter(t=>typeof t=="string").map(t=>t.replaceAll(","," ").trim()).filter(t=>t!=="").slice(0,qo):[],Ko=e=>Object.entries(e&&typeof e=="object"?e:{}).filter(([t,n])=>Rn(t)&&Number.isFinite(n)&&n>=1).sort(([,t],[,n])=>n-t).slice(0,Fo).map(([t,n])=>`${t}:${Math.floor(n)}`);function bt(e){let t={},n={viewed:Nn(e?.recentProducts),basket:Nn(e?.basketProducts),q:Ho(e?.recentSearches),impressed:Ko(e?.impressions)};for(let[r,o]of Object.entries(n))o.length>0&&(t[r]=o.join(","));return t}var Go=1800*1e3;function Dn(e,t=Date.now()){try{localStorage.setItem(T("recommendationContext"),JSON.stringify({context:e,until:t+Go}))}catch{}}function Mn(){try{localStorage.removeItem(T("recommendationContext"))}catch{}}var zo="hp_sample",$n=1e4;function Un(e,t){return!(typeof t=="number"&&t<1)||e==null||e===""?!0:je(e,zo,$n)<Math.round(t*$n)}function ge(e){return e.trim().toLowerCase().replace(/\s*\/\s*/g,"/").replace(/^\/+|\/+$/g,"")}var Wo=2,Jo=12;function xe(e,t=Wo){return e.split("/").slice(0,t).join("/")}function xt(e,t){if(typeof t!="string"||!t.trim())return null;let n=xe(ge(t));return n?(e.unshift(n),e.length=Math.min(e.length,Jo),n):null}var ue=()=>T("sessionSignals"),ye=null,It=()=>ye??ue();function Vn(){try{return ye?localStorage:sessionStorage}catch{return}}function Bn(e,t){let n=t==null?null:String(t),r=e?F(ue(),n,e):null;if(r===ye)return;let o=ye===null?Yo():null;if(ye=r,!!ye)try{let s=It(),i=cn(ue(),n);for(let a of Object.keys(localStorage))a.startsWith(i)&&a!==s&&localStorage.removeItem(a);o&&!localStorage.getItem(s)&&(localStorage.setItem(s,JSON.stringify(o)),sessionStorage.removeItem(ue()))}catch{}}function Yo(){try{let e=sessionStorage.getItem(ue());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:null}catch{return null}}function qe(){return{productViews:0,listViews:0,cartAdds:0,searches:0,recentProducts:[],recentCategories:[],recentBrowse:[],basketProducts:[],basketValue:null,recentSearches:[],impressions:{},browsingCategory:null,recentBrowseCategories:[],browsingListing:null,listViewsByCategory:{},startedAt:0}}function kt(){let e=Vn();if(!e)return qe();try{let t=e.getItem(It());return t?{...qe(),...JSON.parse(t)}:{...qe(),startedAt:Date.now()}}catch{return{...qe(),startedAt:Date.now()}}}function At(e){let t=Vn();if(t)try{t.setItem(It(),JSON.stringify(e))}catch{}}function jn(){return kt()}function qn(){for(let e of[()=>sessionStorage,()=>localStorage])try{let t=e();t.removeItem(ue());for(let n of Object.keys(t))n.startsWith(`${ue()}:`)&&t.removeItem(n)}catch{}}var Fn=20,Hn=200,Xo=new Set(["Product Viewed","Product Clicked","Product Added","Product Added to Wishlist"]),Zo=new Set(["Product Viewed","Product Added"]),Kn=50;function Fe(e,t){let n=xt(e.recentBrowse,t);return n?(e.recentBrowseCategories=[e.browsingListing?.category??null,...e.recentBrowseCategories].slice(0,e.recentBrowse.length),n):null}function Qo(e,t){let n=e.listViewsByCategory;n[t]=(n[t]??0)+1;let r=Object.keys(n);if(r.length>Kn){let o={};for(let s of r.sort((i,a)=>n[a]-n[i]).slice(0,Kn))o[s]=n[s];e.listViewsByCategory=o}}function Gn(e,t){let n=kt();n.startedAt||(n.startedAt=Date.now());let r=Array.isArray(t?.products)?t.products:[];switch(e){case"Product Viewed":n.productViews+=1,Fe(n,n.browsingCategory);break;case"Product List Viewed":{let i=t?.list_id,a=t?.category;if(!(typeof i=="string"&&i.includes("/")&&!i.startsWith("cdp-")))break;let d=typeof a=="string"&&xe(ge(a))||null,f=d?xe(ge(i)):"";if(!f){n.browsingCategory=null,n.browsingListing=null;break}n.browsingListing={key:f,category:d},Fe(n,f),n.browsingCategory=f,Qo(n,d),n.listViews+=1}break;case"Product List Filtered":{let i=t?.change,a=typeof t?.list_id=="string"?t.list_id:"",u=typeof i?.value=="string"?i.value:"",d=n.browsingListing;if(u&&i?.action!=="removed"&&d&&xe(ge(a))===d.key){let f=Fe(n,`${a}/${u}`);f&&(n.browsingCategory=f)}break}case"Product Added":{n.cartAdds+=1,Fe(n,n.browsingCategory);for(let i of r){let a=i.product_id;typeof a!="string"||!a||(n.basketProducts=[a,...n.basketProducts.filter(u=>u!==a)].slice(0,Fn))}break}case"Product Removed":{for(let i of r){let a=i.product_id;typeof a=="string"&&a&&(n.basketProducts=n.basketProducts.filter(u=>u!==a))}break}case"Products Searched":{n.searches+=1;let i=t?.query;if(typeof i=="string"&&i.trim()){let a=i.trim().toLowerCase().slice(0,64);n.recentSearches=[a,...n.recentSearches.filter(u=>u!==a)].slice(0,5)}break}case"Product Clicked":case"Product Added to Wishlist":break;case"Cart Updated":{let i=t?.value;return n.basketValue=typeof i=="number"&&Number.isFinite(i)&&i>=0?i:null,At(n),n}default:return n}let o=Xo.has(e);if(o)for(let i of r)typeof i.product_id=="string"&&i.product_id&&delete n.impressions[i.product_id];else{for(let a of r){let u=a.product_id;typeof u!="string"||!u||(n.impressions[u]=(n.impressions[u]??0)+1)}let i=Object.keys(n.impressions);if(i.length>Hn){let a={};for(let u of i.sort((d,f)=>n.impressions[f]-n.impressions[d]).slice(0,Hn))a[u]=n.impressions[u];n.impressions=a}}let s=new Set;for(let i of r){let a=i.product_id;if(o&&typeof a=="string"&&a&&(n.recentProducts=[a,...n.recentProducts.filter(u=>u!==a)].slice(0,Fn)),Zo.has(e)&&typeof i.category=="string"&&i.category){let u=ge(i.category);u&&!s.has(u)&&(s.add(u),xt(n.recentCategories,u))}}return At(n),n}var zn=1800*1e3;function Wn({name:e,domain:t=null,mayStore:n,now:r=()=>Date.now(),mint:o=Z}){let s=null,i=0,a=()=>{s!==null&&n()&&Q(e,s,zn/1e3,t)};return{get(){let u=r(),d=M(e);return d?s=d:(s===null||u-i>=zn)&&(s=o()),i=u,a(),s},persist:a,forget(){Q(e,"",0,t),s=null}}}var G=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Jn=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),vt=Object.freeze({enabled:!1});function Yn(e,t){let n=e?.track;return G(n)?(Object.hasOwn(n,t)?n[t]:n.__default)?.enabled!==!1:!0}function es(e,t){return`${le(e)}/v1/projects/${encodeURIComponent(t)}/settings`}var ts="https://hp.thgingenuity.com";function le(e){return e==null||e===""?ts:Zn(e)}function Xn(e,t){return e!=null&&e!==""?le(e):t?.startsWith("https://")?t:le(void 0)}function Zn(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 ns(e){if(!G(e))return null;let t=Object.fromEntries(Object.entries(e).filter(([,n])=>typeof n=="boolean"));return Object.keys(t).length?t:null}var Et=e=>typeof e=="number"&&e>=0&&e<=1,rs=/^[0-9a-f]{64}$/;function os(e){return G(e)?{enabled:e.enabled===!0,tokenSha256:typeof e.tokenSha256=="string"&&rs.test(e.tokenSha256)?e.tokenSha256:null}:{enabled:!1,tokenSha256:null}}function ss(e){if(!G(e))return null;let t=Object.fromEntries(Object.entries(e).filter(([,n])=>G(n)&&Et(n.share)&&(n.ramp==null||Et(n.ramp))&&typeof n.salt=="string"&&n.salt!=="").map(([n,r])=>[n,{share:r.share,ramp:r.ramp??null,salt:r.salt,...Jn(r.readoutSlots)&&r.readoutSlots.length>0&&{readoutSlots:r.readoutSlots}}]));return Object.keys(t).length?t:null}var is=/^[A-Za-z0-9!#$%&'*+.^_`|~-]{1,128}$/;function as(e){return G(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"&&is.test(e.cookie)?{source:"site_cookie",cookie:e.cookie}:null:null}function cs(e){let t=G(e)?e.hp:null;return G(t)&&typeof t.enabled=="boolean"}function Ct(e){let t=G(e)?e.hp:null;return!G(t)||t.enabled!==!0?vt:{enabled:!0,propertyId:typeof t.propertyId=="string"&&t.propertyId!==""?t.propertyId:null,environment:typeof t.environment=="string"?t.environment:null,consentPurposes:ns(t.consent?.purposes),queryParamAllowlist:Jn(t.queryParamAllowlist)?t.queryParamAllowlist:null,anonymousId:as(t.anonymousId),apiHost:Zn(t.apiHost),holdouts:ss(t.holdouts),sampleRate:Et(t.sampleRate)?t.sampleRate:1,debug:os(t.debug),plan:G(e.plan)&&G(e.plan.track)?{track:e.plan.track}:null}}async function Qn(e,t,n=globalThis.fetch){try{let r=await n(es(e,t),{credentials:"omit",headers:{accept:"application/json"}});if(!r.ok)return null;let o=await r.json();return cs(o)?Ct(o):null}catch{return null}}var He=e=>F(T("settings"),e);function er(e){try{let t=localStorage.getItem(He(e));if(!t)return null;let n=JSON.parse(t);return n?.enabled===!0?n:null}catch{return null}}function tr(e,t){try{t?.enabled===!0?localStorage.setItem(He(e),JSON.stringify(t)):localStorage.removeItem(He(e))}catch{}}function Pt(e){try{localStorage.removeItem(He(e))}catch{}}var us={flushAt:20,flushIntervalMs:1e4,maxQueue:500,maxRetryAgeMs:1440*60*1e3,maxRetries:5,maxPersistedBatches:20,maxPersistedBytes:1024*1024,storageKey:ie.retry,beaconSafeBytes:56*1024,maxBatchEvents:100,maxBatchBytes:500*1024},Ke=()=>Date.now(),nr=3e4,Mt=55*1024;function ls(e,t=Ke()){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 ee=e=>typeof TextEncoder<"u"?new TextEncoder().encode(e).length:Buffer.byteLength(e),Ot=()=>typeof window<"u"&&typeof document<"u";function ds(){try{return!Ot()||!window.localStorage?null:(window.localStorage.getItem("thg_hp_probe"),window.localStorage)}catch{return null}}var I,Lt,Tt,Ge,Nt,Rt,rr,Ie,ke,Ae,or,Dt,sr,ze,We=class{constructor(t){Ft(this,I);this.o={...us,...t},this.queue=[],this.timer=null,this.storage=ds(),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,Ot()&&(window.addEventListener("pagehide",()=>this.flush({beacon:!0})),document.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&this.flush()}),O(this,I,ze).call(this))}replayPersisted(){return this.replayAllowed=!0,O(this,I,ze).call(this)}clearPersisted(){if(this.replayAllowed=!1,!!this.storage)try{let t=O(this,I,Ae).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(),O(this,I,Tt).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():O(this,I,Lt).call(this)}flush(t={}){if(O(this,I,Tt).call(this),this.queue.length===0)return Promise.resolve();if(t.beacon&&Ot()&&typeof navigator<"u"&&navigator.sendBeacon)return O(this,I,rr).call(this),Promise.resolve();if(this.inflight)return this.inflight;let n=O(this,I,Rt).call(this,this.queue,this.o.maxBatchEvents,this.o.maxBatchBytes).map(o=>{let s=O(this,I,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){O(this,I,ke).call(this,s);continue}await O(this,I,Ie).call(this,o,0,s,r)}})().finally(()=>{this.inflight=null,this.queue.length>=this.o.flushAt?this.flush():this.queue.length&&O(this,I,Lt).call(this)}),this.inflight}};I=new WeakSet,Lt=function(){this.timer||(this.timer=setTimeout(()=>this.flush(),this.o.flushIntervalMs),this.timer?.unref?.())},Tt=function(){this.timer&&(clearTimeout(this.timer),this.timer=null)},Ge=function(t){return JSON.stringify({batch:t,writeKey:this.o.writeKey,sentAt:new Date().toISOString()})},Nt=function(){return`${this.o.apiHost.replace(/\/$/,"")}/v1/batch`},Rt=function(t,n,r){let o=ee(O(this,I,Ge).call(this,[])),s=[],i=[],a=o;for(let u of t){let d=ee(JSON.stringify(u))+1;i.length&&(i.length>=n||a+d>r)&&(s.push(i),i=[],a=o),i.push(u),a+=d}return i.length&&s.push(i),s},rr=function(){let t=this.queue;this.queue=[];let n=O(this,I,Nt).call(this);for(let r of O(this,I,Rt).call(this,t,this.o.maxBatchEvents,this.o.beaconSafeBytes)){let o=O(this,I,Ge).call(this,r);if(ee(o)<=this.o.beaconSafeBytes){let s=!1;try{s=navigator.sendBeacon(n,new Blob([o],{type:"text/plain"}))}catch{s=!1}if(s)continue}O(this,I,Ie).call(this,r,0,O(this,I,Dt).call(this,r))}},Ie=async function(t,n,r=null,o=this.epoch){r&&this.sending.add(r);let s=O(this,I,Ge).call(this,t),i=0;try{let a=await fetch(O(this,I,Nt).call(this),{method:"POST",headers:{"Content-Type":"text/plain"},body:s,keepalive:ee(s)<=this.o.beaconSafeBytes});if(a.ok)return O(this,I,ke).call(this,r),O(this,I,ze).call(this),!0;let u=a.status===408||a.status===429||a.status>=500;if(u&&(i=ls(a.headers?.get?.("retry-after"))),!u)return O(this,I,ke).call(this,r),this.o.onError?.(`CDP ingest rejected batch (${a.status}); dropping ${t.length} events`),!0;throw new Error(`retryable ${a.status}`)}catch(a){if(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`,a),!1}let u=Math.max(Math.min(1e3*2**n,nr)*(.5+Math.random()),Math.min(i,nr));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?(O(this,I,ke).call(this,r),!1):O(this,I,Ie).call(this,t,n+1,r,o)}},ke=function(t){t&&(this.sending.delete(t),this.sinceRefusal.delete(t),O(this,I,sr).call(this,t))},Ae=function(){let t=JSON.parse(this.storage.getItem(this.o.storageKey)||"[]");return Array.isArray(t)?t:[]},or=function(t,n){let r=i=>ee(JSON.stringify(i))+1,o=[...t,n].slice(-this.o.maxPersistedBatches),s=o.reduce((i,a)=>i+r(a),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:Ke(),id:`${Ke()}-${Math.random().toString(36).slice(2)}`,batch:t};return ee(JSON.stringify(n))+3>this.o.maxPersistedBytes?null:O(this,I,or).call(this,O(this,I,Ae).call(this),n)?n.id:null}catch{return null}},sr=function(t){if(!(!t||!this.storage))try{let n=O(this,I,Ae).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{}},ze=function(){if(!this.storage||!this.replayAllowed)return this.draining??Promise.resolve();if(this.draining)return this.draining;let t;try{let r=O(this,I,Ae).call(this);t=r.filter(o=>Array.isArray(o?.batch)&&Ke()-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 O(this,I,Ie).call(this,r.batch,0,r.id))return})().finally(()=>{this.draining=null}),this.draining):Promise.resolve()};var ir="3.22.0",ar="@thg-agentic/hyper-personalisation-web";var fs=new Set(["audiences","decisions","recommendations"]);var ps=Symbol.for("@thg-agentic/hyper-personalisation-web.replay");function ms(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 hs="e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855";function gs(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 Je(e){if(typeof e!="string")return null;let t=gs(e.trim());return t===hs?null:t}var cr=Object.freeze({email_sha256:"sha256",phone_sha256:"sha256",accepts_marketing:"boolean",gender:"string",created_at:"date-time"}),ys=/^\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 ws(e){if(typeof e!="string"||!ys.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 Ss(e,t){return t===null?null:e==="sha256"?Je(t)??void 0:e==="date-time"?t instanceof Date?Number.isNaN(t.getTime())?void 0:t.toISOString():ws(t)?t:void 0:typeof t===e?t:void 0}function _s(e,t){let n={},r=[];for(let[o,s]of Object.entries(e)){let i=Object.hasOwn(cr,o)?cr[o]:null,a=i?Ss(i,s):void 0;a===void 0?r.push(o):n[o]=a}return t&&r.length&&console.warn(`[hp] identify: not sent, not spec traits: ${r.join(", ")}`),n}var ur=!1,lr=!1;function bs(){lr||(lr=!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 xs(e){!e||ur||(ur=!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 Is(e){try{return ee(JSON.stringify(e))}catch{return 0}}function dr(e){return e&&typeof e.context=="object"&&e.context!==null?e.context:e}function fr(e){let t=le(e?.apiHost);if(!t)throw new Error("createAnalytics: apiHost, when given, must be a host or an http(s) origin");if(!e?.propertyId)throw new Error("createAnalytics: propertyId is required");let n={libraryName:ar,libraryVersion:ir,writeKey:"web",queryParamBlocklist:[],debug:!1,validate:null,consentTimeoutMs:5e3,...e,apiHost:t};Te(n.storageNames),Ne();let r=!!n.consent;r||bs();let o=null;n.getConsent=()=>o?o.stamp():fn();let s=()=>!r||o?.status==="granted",i=r&&n.holdAcrossPages?un(F(T("held"),n.propertyId)):null,a=i?.read()??{items:[],anonymousId:null};n.mintAnonymousId!==void 0&&xs(n.debug);let u=ln(n,{carried:a.anonymousId,mayStore:s,orOwn:!0}),d=Wn({name:T("session"),domain:n.consentCookieDomain??null,mayStore:s}),f=n.getSessionId;n.getSessionId=()=>q(D(f,null))??d.get();let p=Tn(T("preview"),n.consentCookieDomain??null),y=(c,l)=>n.debug&&console.warn("[hp]",c,l??""),b=n.transport??new We({apiHost:n.apiHost,writeKey:n.writeKey,storageKey:F(T("retry"),n.propertyId),mayPersist:r?()=>o?.status==="granted":void 0,deferReplay:r,onError:y}),w=F(T("previousPage"),n.propertyId),x=null,k=()=>{if(x)return x;try{return sessionStorage.getItem(w)||null}catch{return null}},v=c=>{if(x=c||null,!(r&&o.status!=="granted"))try{sessionStorage.setItem(w,c)}catch{}},h=On({key:F(T("decisions"),n.propertyId),mayStore:s});n.getDecisions??(n.getDecisions=h.current);let E=q(D(n.getUserId,null)),S=null,g=null,_=null;function L(c,l,A=!1){try{return R(c,l,A)}catch(P){if(P instanceof he)throw P;return console.warn("[hp] the event was not sent",P),null}}function R(c,l,A){let P=_;_=null;let U=c.type==="track"?c.event:c.type;if(!A&&!Yn(n.plan,U))return null;let C={messageId:P?.messageId??Z(),timestamp:P?.timestamp??new Date().toISOString(),anonymousId:q(D(n.getAnonymousId,null)),userId:E??null,...c,context:rn(n,dr(l))};if(C.properties&&(C.properties=st(C.properties)),!A&&!Un(C.anonymousId,n.sampleRate))return n.debug&&console.debug("[hp] not sent: outside the sample",C),null;if(n.beforeSend){let fe;try{fe=n.beforeSend(C)}catch(kr){return console.warn("[hp] beforeSend failed; the event was not sent",kr),null}if(!fe)return null;let{type:Pe,event:jt,messageId:xr,timestamp:Ir}=C;C={...fe,type:Pe,messageId:xr,timestamp:Ir,...jt?{event:jt}:{}}}if(n.validate){let fe=n.validate(C,{producer:"web"});if(!fe.valid){let Pe=`[hp] invalid ${C.event??C.type}:
2
+ ${fe.errors.join(`
3
+ `)}`;if(n.throwOnInvalid)throw new he(Pe);console.error(Pe)}}n.debug&&console.debug("[hp]",C.event??C.type,C);let Bt=Is(C);return Bt>Mt?(y(`${C.event??C.type} not sent: ${Bt} bytes, over the ${Mt}-byte limit for one event`),null):(Ee(C,A),C)}function H(c){if(c.type==="track"&&z(c),n.onEvent)try{n.onEvent(c)}catch(l){console.warn("[hp] onEvent observer failed",l)}}let K=()=>r&&o?.state?.personalisation===!0,j=()=>Bn(D(n.getSessionId,null),n.propertyId),te=!1;function z(c){try{K()?(j(),Dn(bt(Gn(c.event,c.properties))),te=!0):ne()}catch(l){n.debug&&console.warn("[hp] the visit was not recorded",l)}}function ne(c=!1){Mn(),(c||te)&&qn(),te=!1}function de(){d.forget(),h.forget(),B.clear(),u?.forget(),ne(!0)}function Ee(c,l){!r||l||o.admits()?(H(c),b.enqueue(c)):o.hold(c)}let m=(c,l,A)=>L({type:"track",event:c,properties:l??{}},A),B=new Set,ve=(c,l,A)=>c==="audiences"?{audiences:l?null:A.audiences??[]}:c==="decisions"?{decisions:(A.decisions??[]).map(P=>({slot:P.slot,decision_id:P.decision_id??null,arm:P.arm??null,...P.variant&&{variant:P.variant}}))}:{recommendation_request_id:A.recommendation_request_id??null};r&&(o=Cn({adapter:n.consent,timeoutMs:n.consentTimeoutMs,cookieDomain:n.consentCookieDomain,debug:n.debug,store:i&&{read:()=>a.items,write:c=>i.write(c,u?.peek()??null)},release(c){c.context&&(c.context.consent=o.stamp()),H(c),b.enqueue(c)},onStatus(c){if(c==="granted"&&(u?.persist(),d.persist(),x&&v(x),h.persist(),b.replayPersisted?.()),c==="denied"){b.clearPersisted?.(),u?.forget(),d.forget();try{sessionStorage.removeItem(w)}catch{}h.forget(),ne(!0)}try{n.onConsentStatus?.(c)}catch(l){console.warn("[hp] onConsentStatus observer failed",l)}},announce({action:c,state:l,previous:A,withdrawal:P}){l?.personalisation!==!0&&ne(A?.personalisation===!0),P&&b.discardQueued?.(),L({type:"track",event:"Consent Updated",properties:{action:c,state:l}},void 0,P),P&&b.flush()}}),o.start());let J=()=>n.holdout?St(n.holdout):null,Ce=()=>_t(n.holdout,q(D(n.getAnonymousId,null))).group;function br(c,l){if(!Array.isArray(c?.decisions))return c;let A=n.holdout?.readoutSlots??[],P=q(D(n.getAnonymousId,null));return{...c,decisions:c.decisions.map(U=>{let C=U?.variant==="bandit"||U?.variant==="default"?U.variant:!l&&U?.holdout!==!0&&A.includes(U?.slot)?Ln(U.slot,P):null;return C?C==="default"?{...U,variant:C,decision_id:null}:{...U,variant:C}:U})}}function Ut(c,l){if(p)return null;let A=c?.exposure,P=A?.holdout===!0,U=br(c,P);return h.remember(Pn(U)),!A?.token||B.has(A.token)?null:(B.add(A.token),m("Personalisation Exposed",{exposure_token:A.token,surface:A.surface,holdout:P,holdout_share:A.holdout_share??J()?.holdout_share??null,personalised_share:A.personalised_share??J()?.personalised_share??null,...ve(A.surface,P,U)},l))}function Vt(c){return E&&de(),E=null,S=null,g=null,c}return En({track:(c,l,A)=>c==="Signed Out"?Vt(m(c,l,A)):m(c,l,A),page(c,l){c??(c={});let A=n.pageType??null;c.type&&(pe.has(c.type)?(A=c.type,n.pageType=c.type):n.debug&&console.warn(`[hp] ignoring unknown page.type "${c.type}". Allowed: ${[...pe].join(", ")}`));let P=L({type:"page",properties:{name:c.name??null,navigation_trigger:c.navigation_trigger??Zt(),previous_message_id:k()}},{page:{type:A},...dr(l)??{}});return P&&v(P.messageId),P},identify(c,l,A){let{userId:P,...U}=c&&typeof c=="object"?c:{};if(P!==void 0){let C=q(P);A===be?g=C:S&&C&&C!==S?de():n.debug&&g&&C&&C!==g&&console.warn("[hp] identify names another userId than the identity option; using the new one"),E=C,C&&A!==be&&(S=C)}return L({type:"identify",traits:_s(U,n.debug)},l)},reset(){E&&de(),E=null,S=null,g=null,v("")},productViewed:(c,l)=>m("Product Viewed",c,l),productListViewed:(c,l)=>m("Product List Viewed",c,l),recommendationsViewed:(c,l)=>m("Recommendations Viewed",c,l),personalisationExposed:(c,l)=>m("Personalisation Exposed",c,l),recordExposure:Ut,surfaceViewed({surface:c}={},l){if(!fs.has(c)||!n.holdout||c!=="decisions"&&!K())return null;let A=q(D(n.getAnonymousId,null)),P=_t(n.holdout,A).group;if(P==="excluded")return null;let U=Jt({sessionId:Oe(D(n.getSessionId,null),A),surface:c});return U?Ut({exposure:{token:U,surface:c,holdout:P==="holdout"}},l):null},inHoldout:()=>Ce()!=="personalised",personalisationGroup:Ce,productClicked:(c,l)=>m("Product Clicked",c,l),productListFiltered:(c,l)=>m("Product List Filtered",c,l),productsSearched:(c,l)=>m("Products Searched",c,l),searchSuggestionsViewed:(c,l)=>m("Search Suggestions Viewed",c,l),productAdded:(c,l)=>m("Product Added",c,l),productRemoved:(c,l)=>m("Product Removed",c,l),cartUpdated:(c,l)=>m("Cart Updated",ms(c),l),identityLinked:(c,l)=>m("Identity Linked",c,l),slotEngaged:(c,l)=>p?null:m("Slot Engaged",c,l),productVariantSelected:(c,l)=>m("Product Variant Selected",c,l),cartViewed:(c,l)=>m("Cart Viewed",c,l),productAddedToWishlist:(c,l)=>m("Product Added to Wishlist",c,l),productRemovedFromWishlist:(c,l)=>m("Product Removed from Wishlist",c,l),wishlistProductAddedToCart:(c,l)=>m("Wishlist Product Added to Cart",c,l),productShared:(c,l)=>m("Product Shared",c,l),cartShared:(c,l)=>m("Cart Shared",c,l),couponEntered:(c,l)=>m("Coupon Entered",c,l),couponApplied:(c,l)=>m("Coupon Applied",c,l),couponDenied:(c,l)=>m("Coupon Denied",c,l),couponRemoved:(c,l)=>m("Coupon Removed",c,l),checkoutStarted:(c,l)=>m("Checkout Started",c,l),promotionViewed:(c,l)=>m("Promotion Viewed",c,l),promotionClicked:(c,l)=>m("Promotion Clicked",c,l),checkoutStepViewed:(c,l)=>m("Checkout Step Viewed",c,l),checkoutStepCompleted:(c,l)=>m("Checkout Step Completed",c,l),paymentInfoEntered:(c,l)=>m("Payment Info Entered",c,l),checkoutFailed:(c,l)=>m("Checkout Failed",c,l),signedIn:(c,l)=>m("Signed In",c,l),signedUp:(c,l)=>m("Signed Up",c,l),signedOut:c=>Vt(m("Signed Out",{},c)),newsletterSubscribed:(c,l)=>m("Newsletter Subscribed",c,l),newsletterUnsubscribed:(c,l)=>m("Newsletter Unsubscribed",c,l),backInStockSubscribed:(c,l)=>m("Back In Stock Subscribed",c,l),productReviewed:(c,l)=>m("Product Reviewed",c,l),consentUpdated:(c,l)=>m("Consent Updated",c,l),flush:c=>b.flush(c),recommendationContext(){if(!K())return{};try{return j(),bt(jn())}catch{return{}}},get consent(){return o?o.state:null},servingHeaders:()=>hn(o?.state??null),get lastPageMessageId(){return k()},get anonymousId(){return q(D(n.getAnonymousId,null))},[ps](c,l,A){if(typeof this[c]=="function"){_=typeof A?.messageId=="string"&&typeof A?.timestamp=="string"?{messageId:A.messageId,timestamp:A.timestamp}:null;try{this[c](...Array.isArray(l)?l:[])}finally{_=null}}}})}var $t=Symbol.for("@thg-agentic/hyper-personalisation-web.bootstrap"),ks=Symbol.for("@thg-agentic/hyper-personalisation-web.drain"),As=Symbol.for("@thg-agentic/hyper-personalisation-web.carry"),pr=Symbol.for("@thg-agentic/hyper-personalisation-web.replay"),Es=Symbol.for("@thg-agentic/hyper-personalisation-web.assignment"),vs=Symbol.for("@thg-agentic/hyper-personalisation-web.recommendation-context"),Ze=e=>e?()=>M(e):()=>null,gr={didomi:e=>gn({purposes:e.purposes}),onetrust:e=>yn({groups:e.groups,impliedConsent:e.impliedConsent}),cookie:e=>wn({name:e.name,categories:e.categories,refusedValue:e.refusedValue,source:e.source,changeEvent:e.changeEvent}),forwarded:e=>Sn({name:e.name}),static:e=>{if(!e.state||typeof e.state!="object")throw new Error('consent.state is required for provider "static"');return _n(e.state)}},mr=Object.keys(gr),we=e=>e!==null&&typeof e=="object"&&!Array.isArray(e),Ye=e=>typeof e=="string"&&e!=="",Cs=e=>Array.isArray(e)&&e.every(t=>typeof t=="string"),yr=e=>we(e)&&typeof e.read=="function";function Ps(e,t={}){let n=[];if(!we(e))return["config must be { writeKey, apiHost? }"];Ye(e.writeKey)||n.push("writeKey is required"),le(e.apiHost)||n.push("apiHost, when given, must be a host or an http(s) origin"),t.propertyId!==void 0&&!Ye(t.propertyId)&&n.push("propertyId must be a string");let{consent:r}=t;if(!yr(r)&&!(we(r)&&mr.includes(r.provider))&&n.push(`consent must be a consent adapter or { provider: ${mr.join(" | ")} }`),t.autocapture!==void 0&&t.autocapture!==!1&&!we(t.autocapture)&&n.push("autocapture must be false or { promotions, productLists, recommendations }"),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&&!Ye(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&&!Ye(t.dataLayer.name)&&n.push("dataLayer.name must be a string"),t.dataLayer.ignore!==void 0&&!Cs(t.dataLayer.ignore)&&n.push("dataLayer.ignore must be an array of strings")):n.push("dataLayer must be an object")),n}function Os(e,t,n){if(yr(e))return mt(e,t.consentPurposes);let{provider:r,...o}=e,s=n?.consent?.[r]??gr[r];return mt(s(o),t.consentPurposes)}var wr=(e,t)=>`${e??""}|${t??""}`;function Ls(e,t){let n=q(t?.userId),r=Je(t?.emailSha256);if(!n&&!r)return null;try{let o=F(T("identified"),e);if(sessionStorage.getItem(o)===wr(n,r))return null}catch{}return{...n?{userId:n}:{},...r?{email_sha256:r}:{}}}async function Ts({writeKey:e,apiHost:t},n){if(n.settings!==void 0)return{settings:Ct(n.settings),revalidated:null};let r=Qn(t,e),o=er(e);if(o)return{settings:o,revalidated:r};let s=await r,i=s??vt;return{settings:i,revalidated:Promise.resolve(i),unreachable:s===null}}function Sr(e,t){let n=t??{},r=typeof window<"u"?window:null;if(r?.[$t])return r[$t];let o=dn(e?.writeKey,()=>{let{analytics:i}=_e(M(T("consent")));return i===!0||i===null&&n.holdAcrossPages===!0}),s=Rs(e,n,o);if(r){let i=n.extend?.getSessionId??Ze(n.identityCookies?.sessionId),a=Ze(n.identityCookies?.anonymousId);r[Es]=({slot:u,arm:d}={})=>Wt({sessionId:Oe(i(),a()),slot:u,arm:d}),r[$t]=s,r[As]=o,r[ks]?.(s)}return s}function Ns(){let e=globalThis.performance?.now?.();return new Date(Date.now()-(Number.isFinite(e)?e:0)).toISOString()}function hr(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(nt(e,r(n.promotions))),n.productLists&&o.push(tt(e,r(n.productLists))),n.recommendations&&o.push(rt(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()}}function Xe(e){return e.close(),null}async function Rs(e,t,n){try{let r=Ps(e,t);if(r.length)return console.warn(`[hp] not started, the configuration is invalid: ${r.join("; ")}`),Xe(n);Te(t.storageNames),Ne();let{writeKey:o}=e,[{settings:s,revalidated:i,unreachable:a},u]=await Promise.all([Ts(e,t),Promise.resolve(t.identity).catch(()=>null)]),d=i?s:null,f=!1,p=()=>f&&d&&tr(o,d);if(i?.then(g=>{g&&(d=g,g.enabled?p():Pt(o))}),a)return null;if(!s.enabled)return t.debug&&console.info("[hp] off: the settings for this write key do not enable it"),Xe(n);let y=t.propertyId??s.propertyId;if(!y)return console.warn("[hp] not started: this write key covers several properties, so propertyId is required"),Xe(n);let{preset:b}=t,w=Ls(y,u),x=t.debug===!0||s.debug?.enabled===!0||An(s.debug?.tokenSha256??null,T("debug")),k=q(u?.userId),v=fr({apiHost:Xn(e.apiHost,s.apiHost),writeKey:o,propertyId:y,pageType:pe.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?.[y],getCurrency:t.getCurrency,getShipToCountry:t.getShipToCountry,getLocale:t.getLocale,consent:Os(t.consent,s,b),consentCookieDomain:t.consentCookieDomain,storageNames:t.storageNames,holdAcrossPages:t.holdAcrossPages===!0,mintAnonymousId:t.mintAnonymousId,debug:x,anonymousIdSource:s.anonymousId??void 0,getAnonymousId:Ze(t.identityCookies?.anonymousId),getSessionId:t.identityCookies?.sessionId?Ze(t.identityCookies.sessionId):void 0,getUserId:()=>k,beforeSend:t.beforeSend,...t.extend,onConsentStatus(g){if(g==="granted"&&(f=!0,p()),g==="denied"){Pt(o);try{sessionStorage.removeItem(F(T("identified"),y))}catch{}}t.extend?.onConsentStatus?.(g)},onEvent(g){if(g.type==="identify"){let _=wr(q(g.userId),Je(g.traits?.email_sha256));try{sessionStorage.setItem(F(T("identified"),y),_)}catch{}}t.extend?.onEvent?.(g)}});typeof window<"u"&&(window[vs]=()=>v.recommendationContext());for(let[g,_,L]of n.take())try{v[pr](g,_,L)}catch(R){console.warn(`[hp] carried ${g} failed`,R)}v[pr]("page",[t.pageType?{type:t.pageType}:{}],{messageId:Z(),timestamp:Ns()});let h=hr(v,t.autocapture),E=v.page;v.page=wt("page",(...g)=>{let _=E(...g);return h(),h=hr(v,t.autocapture),_});let S=typeof window<"u"?window:null;if(t.dataLayer&&S){let g=t.dataLayer.name??"dataLayer";S[g]=S[g]||[],kn(v,{...b,dataLayer:S[g],ignore:[...b?.ignore??[],...t.dataLayer.ignore??[]],onError:_=>x&&console.warn("[hp] dataLayer mapping failed",_)})}return w&&v.identify(w,void 0,be),v}catch(r){return console.warn("[hp] not started:",r?.message??r),Xe(n)}}function _r(e){e.initialized=!0,Sr(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 V=window.hp=window.hp||[];V.servingHeaders??(V.servingHeaders=()=>({}));V.inHoldout??(V.inHoldout=()=>!0);V.personalisationGroup??(V.personalisationGroup=()=>"excluded");V.recommendationContext??(V.recommendationContext=()=>({}));V.initialized||(V._config?_r(V):V.load=(e,t)=>{V._config=e,V._options=t??{},_r(V)});})();
@@ -1 +1 @@
1
- (()=>{(()=>{let e=window.hp=window.hp||[];if(!(e.initialized||e.invoked)){e.invoked=!0,e.methods=["track","page","identify","reset","flush","productViewed","productListViewed","recommendationsViewed","personalisationExposed","recordExposure","surfaceViewed","productClicked","productListFiltered","productsSearched","productAdded","productRemoved","cartUpdated","identityLinked","slotEngaged","productVariantSelected","cartViewed","productAddedToWishlist","productRemovedFromWishlist","wishlistProductAddedToCart","productShared","cartShared","couponEntered","couponApplied","couponDenied","couponRemoved","checkoutStarted","promotionViewed","promotionClicked","checkoutStepViewed","checkoutStepCompleted","paymentInfoEntered","checkoutFailed","signedIn","signedUp","signedOut","newsletterSubscribed","newsletterUnsubscribed","backInStockSubscribed","productReviewed","consentUpdated"],e.factory=t=>(...o)=>(e.push([t,...o]),e);for(let t of e.methods)e[t]=e.factory(t);e.servingHeaders=()=>({}),e.inHoldout=()=>!0,e.personalisationGroup=()=>"excluded",e.recommendationContext=()=>({}),e.load=(t,o,r)=>{e._config=t,e._options=o||{};let d=document.createElement("script");d.async=!0,d.src=r;let i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(d,i)},e.SNIPPET_VERSION="1",e.load({writeKey:"hp_pk_live_REPLACE_ME",apiHost:"https://api.example.com"},{consent:{provider:"onetrust"},identityCookies:{sessionId:"session_id"}},"https://cdn.jsdelivr.net/npm/@thg-agentic/hyper-personalisation-web@3/dist/hp.min.js")}})();})();
1
+ (()=>{(()=>{let e=window.hp=window.hp||[];if(!(e.initialized||e.invoked)){e.invoked=!0,e.methods=["track","page","identify","reset","flush","productViewed","productListViewed","recommendationsViewed","personalisationExposed","recordExposure","surfaceViewed","productClicked","productListFiltered","productsSearched","searchSuggestionsViewed","productAdded","productRemoved","cartUpdated","identityLinked","slotEngaged","productVariantSelected","cartViewed","productAddedToWishlist","productRemovedFromWishlist","wishlistProductAddedToCart","productShared","cartShared","couponEntered","couponApplied","couponDenied","couponRemoved","checkoutStarted","promotionViewed","promotionClicked","checkoutStepViewed","checkoutStepCompleted","paymentInfoEntered","checkoutFailed","signedIn","signedUp","signedOut","newsletterSubscribed","newsletterUnsubscribed","backInStockSubscribed","productReviewed","consentUpdated"],e.factory=t=>(...o)=>(e.push([t,...o]),e);for(let t of e.methods)e[t]=e.factory(t);e.servingHeaders=()=>({}),e.inHoldout=()=>!0,e.personalisationGroup=()=>"excluded",e.recommendationContext=()=>({}),e.load=(t,o,r)=>{e._config=t,e._options=o||{};let d=document.createElement("script");d.async=!0,d.src=r;let i=document.getElementsByTagName("script")[0];i.parentNode.insertBefore(d,i)},e.SNIPPET_VERSION="1",e.load({writeKey:"hp_pk_live_REPLACE_ME",apiHost:"https://api.example.com"},{consent:{provider:"onetrust"},identityCookies:{sessionId:"session_id"}},"https://cdn.jsdelivr.net/npm/@thg-agentic/hyper-personalisation-web@3/dist/hp.min.js")}})();})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thg-agentic/hyper-personalisation-web",
3
- "version": "3.18.0",
3
+ "version": "3.22.0",
4
4
  "description": "Browser SDK for the THG Hyper-Personalisation event specification: event tracking from a write key and remote settings, strict CMP-agnostic consent, a GA4 dataLayer bridge and in-session audience evaluation. Dependency-free ESM on the Segment wire protocol, a CDN script (dist/hp.min.js), and an optional @segment/analytics-next plugin path.",
5
5
  "type": "module",
6
6
  "main": "./src/index.js",
@@ -74,7 +74,7 @@
74
74
  "esbuild": "^0.28.2",
75
75
  "jsdom": "^30.1.1",
76
76
  "typescript": "^7.0.2",
77
- "@thg-agentic/hyper-personalisation-spec": "1.10.0"
77
+ "@thg-agentic/hyper-personalisation-spec": "1.15.0"
78
78
  },
79
79
  "scripts": {
80
80
  "test": "node --test tests/*.test.mjs",