@sentientui/core 0.40.2 → 0.41.1
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/dist/chunk-3HMJERH4.mjs +2 -0
- package/dist/chunk-3HMJERH4.mjs.map +1 -0
- package/dist/{chunk-ZTQXHKHU.mjs → chunk-KXA3X6T3.mjs} +2 -2
- package/dist/chunk-KXA3X6T3.mjs.map +1 -0
- package/dist/{index-BgEe5mKL.d.ts → index-C--aVpoo.d.ts} +1 -1
- package/dist/{index-B7s2gvyU.d.cts → index-DlJDNOWu.d.cts} +1 -1
- package/dist/index-engagement.js +1 -1
- package/dist/index-engagement.js.map +1 -1
- package/dist/index-engagement.mjs +1 -1
- package/dist/index-graph.d.cts +4 -4
- package/dist/index-graph.d.ts +4 -4
- package/dist/index-graph.js +1 -1
- package/dist/index-graph.js.map +1 -1
- package/dist/index-graph.mjs +1 -1
- package/dist/index-local.d.cts +2 -2
- package/dist/index-local.d.ts +2 -2
- package/dist/index-server.d.cts +2 -2
- package/dist/index-server.d.ts +2 -2
- package/dist/index-server.js +1 -1
- package/dist/index-server.js.map +1 -1
- package/dist/index-server.mjs +1 -1
- package/dist/index-server.mjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{session-meta-BG8w53d7.d.cts → session-meta-BqBaLZag.d.cts} +17 -1
- package/dist/{session-meta-D9Wx2PtC.d.ts → session-meta-D_kdNsaU.d.ts} +17 -1
- package/package.json +2 -2
- package/dist/chunk-NBDVEYI5.mjs +0 -2
- package/dist/chunk-NBDVEYI5.mjs.map +0 -1
- package/dist/chunk-ZTQXHKHU.mjs.map +0 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as Z}from"./chunk-WKXD7KI3.mjs";import{a as j,d as J,e as H,f as q,g as se}from"./chunk-Z6ILOYBD.mjs";import{O as Q,Q as X}from"./chunk-
|
|
1
|
+
import{a as Z}from"./chunk-WKXD7KI3.mjs";import{a as j,d as J,e as H,f as q,g as se}from"./chunk-Z6ILOYBD.mjs";import{O as Q,Q as X}from"./chunk-KXA3X6T3.mjs";import"./chunk-FPOHOWJP.mjs";import"./chunk-EVF5PQ4U.mjs";import"./chunk-3HMJERH4.mjs";import"./chunk-J5EL7HKC.mjs";import{a as $,b as z}from"./chunk-TMCGHANO.mjs";import{fnv1a as ue}from"@sentientui/policy";var ee=[100,300,1e3,3e3,1e4],ie=250,ae=1e3,ce=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function te(t,o){t.n++;let e=o-t.mean;t.mean+=e/t.n,t.m2+=e*(o-t.mean)}var ne=t=>t.n>1?Math.sqrt(t.m2/t.n):0;function le(t){var o;try{let e=t.createElement("canvas"),u=e.getContext("webgl")||e.getContext("experimental-webgl");if(!u)return"unknown";let d=u.getExtension("WEBGL_debug_renderer_info"),p=d?String((o=u.getParameter(d.UNMASKED_RENDERER_WEBGL))!=null?o:""):"";return p?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(p)?"sw":"hw":"unknown"}catch(e){return"unknown"}}function re(t,o=Date.now){var a,c;let e=(a=t.defaultView)!=null?a:typeof window!="undefined"?window:void 0,u={n:0,mean:0,m2:0},d={n:0,mean:0,m2:0},p=[0,0,0,0,0,0],_=0,G=0,k=0,U=0,g=0,V=0,T=0,h=0,I=0,b=0,L=-1/0,C=-1/0,m=null,w=null,A=null,x=(c=e==null?void 0:e.scrollY)!=null?c:0,N=0,f=t.hidden?null:o(),E=()=>{let n=o();if(A!=null){let l=n-A,v=0;for(;v<ee.length&&l>=ee[v];)v++;p[v]++}A=n},O=()=>{_++,L=o()},R=()=>{G++,C=o()},M=()=>{m=o()},D=()=>{m!=null&&(te(u,o()-m),m=null)},P=()=>{let n=o();k++,n-L>ie&&n-C>ae&&U++,E()},S=()=>{g++},W=()=>{var l;let n=(l=e==null?void 0:e.scrollY)!=null?l:0;V+=Math.abs(n-x),x=n,E()},K=n=>{let l=o();T++,(n.key==="Backspace"||n.key==="Delete")&&I++,ce.has(n.key)&&b++,w!=null&&te(d,l-w),w=l,E()},F=n=>{let l=n.data;typeof l=="string"&&(h+=l.length),E()},B=()=>{let n=o();t.hidden?f!=null&&(N+=n-f,f=null):f==null&&(f=n)},i={passive:!0,capture:!0};t.addEventListener("mousemove",O,i),t.addEventListener("touchstart",R,i),t.addEventListener("touchmove",S,i),t.addEventListener("mousedown",M,i),t.addEventListener("mouseup",D,i),t.addEventListener("click",P,i),t.addEventListener("wheel",S,i),t.addEventListener("keydown",K,i),t.addEventListener("input",F,i),t.addEventListener("visibilitychange",B),e==null||e.addEventListener("scroll",W,i);let r=le(t),s=(()=>{var n;try{return((n=e==null?void 0:e.matchMedia)==null?void 0:n.call(e,"(prefers-reduced-motion: reduce)").matches)===!0}catch(l){return!1}})();return{snapshot(){var v,y;let n=o(),l=N+(f!=null?n-f:0);return{v:1,active_ms:Math.round(l),mm:_,mm_rate:l>0?Number((_*1e3/l).toFixed(2)):0,touches:G,clicks:k,hold_n:u.n,hold_mean:Math.round(u.mean),hold_std:Math.round(ne(u)),teleport:U,wheel:g,scroll_px:Math.round(V),keydowns:T,input_chars:h,ik_cv:d.mean>0?Number((ne(d)/d.mean).toFixed(2)):0,backspaces:I,gaps:[...p],reduced_motion:s,kb_nav:b,renderer:r,vp:[(v=e==null?void 0:e.innerWidth)!=null?v:0,(y=e==null?void 0:e.innerHeight)!=null?y:0],dpr:(e==null?void 0:e.devicePixelRatio)||1}},stop(){t.removeEventListener("mousemove",O,i),t.removeEventListener("touchstart",R,i),t.removeEventListener("touchmove",S,i),t.removeEventListener("mousedown",M,i),t.removeEventListener("mouseup",D,i),t.removeEventListener("click",P,i),t.removeEventListener("wheel",S,i),t.removeEventListener("keydown",K,i),t.removeEventListener("input",F,i),t.removeEventListener("visibilitychange",B),e==null||e.removeEventListener("scroll",W,i)}}}var de="section, header, footer, nav, main > div, [data-sentient-section]",me=2e4,oe="__session__";function pe(t){let o=Array.from(t.querySelectorAll(de)),e=o.filter(u=>o.filter(d=>d!==u&&u.contains(d)).length<2);return e.filter(u=>!e.some(d=>d!==u&&d.contains(u)))}function fe(t,o,e,u){try{fetch(`${o}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${t}`},body:JSON.stringify({pageUrl:e,sections:u})}).catch(()=>{})}catch(d){}}var Y=()=>{};function ve(t,o){var x,N,f,E,O,R,M,D,P,S,W,K,F,B,i;let e=(x=o.doc)!=null?x:typeof document!="undefined"?document:void 0;if(!e||typeof IntersectionObserver=="undefined"||X()||!o.apiKey||!o.apiKey.startsWith("pk_"))return Y;let u=((N=o.apiBase)!=null?N:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),d=pe(e);if(d.length===0)return Y;let p=new Map,_=[];for(let r of d){let s=(O=[(E=o.sectionTypes)==null?void 0:E[(f=r.getAttribute("data-sentient-id"))!=null?f:""],r.getAttribute("data-sentient-type")].find(y=>j.includes(y)))!=null?O:null,a=q(r),c=(M=s!=null?s:(R=o.typeOf)==null?void 0:R.call(o,r))!=null?M:H(a).type,n=Z(r,e),l=n?`nc-${c}-${ue(JSON.stringify({id:(D=n.id)!=null?D:null,dataAttr:(P=n.dataAttr)!=null?P:null,selector:(S=n.selector)!=null?S:null})).toString(36)}`:`nc-${c}`;p.set(r,l);let v=J.filter(([,y])=>y.test(a.bodyText)).map(([y])=>y);_.push(z($({componentId:l,semanticType:c,source:s?"markup":"auto"},n?{locator:n}:{}),{observation:$($({tag:a.tag,idClass:a.idClass.slice(0,200),headingText:a.headingText,textLength:a.textLength,actionCount:a.actionCount},a.ariaRole?{ariaRole:a.ariaRole}:{}),v.length>0?{patternFlags:v}:{})}))}let G=(B=(F=(K=(W=e.defaultView)!=null?W:typeof window!="undefined"?window:void 0)==null?void 0:K.location)==null?void 0:F.pathname)!=null?B:"/";fe(o.apiKey,u,G,_);let k=re(e),U=()=>{let r;try{r=k.snapshot()}catch(s){return}try{t.track({projectId:o.apiKey,componentId:oe,eventType:"interaction_stats",payload:r})}catch(s){}},g=new Map,V=r=>{let s=g.get(r);return s||(s={ms:0,scroll:0,enterAt:null,intersecting:!1},g.set(r,s)),s},T=new IntersectionObserver(r=>{for(let s of r){let a=p.get(s.target);if(!a)continue;let c=V(a);s.isIntersecting?(c.intersecting=!0,c.enterAt=Date.now(),s.intersectionRatio>c.scroll&&(c.scroll=s.intersectionRatio)):(c.intersecting=!1,c.enterAt!=null&&(c.ms+=Date.now()-c.enterAt,c.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let r of p.keys())T.observe(r);let h=(r=!1)=>{var a;let s=Date.now();for(let[c,n]of g)if(n.enterAt!=null&&(n.ms+=s-n.enterAt,n.enterAt=null),!(n.ms<=0)){try{t.track({projectId:o.apiKey,componentId:c,eventType:"dwell",payload:{dwell_time:Math.round(n.ms),scroll_depth:Number(n.scroll.toFixed(2))}})}catch(l){}n.ms=0}if(U(),r)try{(a=t.flush)==null||a.call(t)}catch(c){}},I=()=>{if(e.hidden)h(!0);else{let r=Date.now();for(let s of g.values())s.intersecting&&(s.enterAt=r)}},b=!1,L=r=>{if(h(!0),r!=null&&r.persisted){b=!0;return}try{T.disconnect()}catch(s){}},C=r=>{if(!(r!=null&&r.persisted)||!b)return;b=!1;let s=Date.now();for(let a of g.values())a.enterAt=a.intersecting&&!e.hidden?s:null};e.addEventListener("visibilitychange",I);let m=(i=e.defaultView)!=null?i:typeof window!="undefined"?window:void 0;m==null||m.addEventListener("pagehide",L),m==null||m.addEventListener("pageshow",C);let w=setInterval(()=>{if(e.hidden||b)return;h();let r=Date.now();for(let s of g.values())s.intersecting&&(s.enterAt=r)},me),A=[];return o.microSignals&&[...p.entries()].forEach(([r,s],a)=>{A.push(Q((c,n={})=>{try{t.track({projectId:o.apiKey,componentId:s,eventType:"micro_signal",payload:$({signalType:c},n)})}catch(l){}},r,void 0,{tabLoss:a===0}))}),()=>{h(!0),clearInterval(w),k.stop(),e.removeEventListener("visibilitychange",I),m==null||m.removeEventListener("pagehide",L),m==null||m.removeEventListener("pageshow",C);for(let r of A)r();try{T.disconnect()}catch(r){}}}export{oe as INTERACTION_STATS_COMPONENT,j as SEMANTIC_TYPES,H as classifyFeatures,se as classifySection,q as featuresFromElement,ve as startEngagementCapture};
|
|
2
2
|
//# sourceMappingURL=index-engagement.mjs.map
|
package/dist/index-graph.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as SentientConfig, r as SentientClient } from './index-
|
|
2
|
-
export { a as AssignResult, b as Assignment, c as AssignmentCache, E as EventQueue, g as EventType, i as GraphClient, j as GraphConfig, k as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, m as MicroSignalType, o as PageNode, Q as QueueConfig, S as STAGE_ATTRIBUTE, t as SentientEvent, u as SessionConfig, v as SessionManager, x as StageAttributes, z as attachMicroSignalDetectors, F as exposedStage, I as grantConsent, K as isDoNotTrackEnabled, X as sanitizePageUrl, Y as sessionCookieName, $ as setStageAttribute } from './index-
|
|
3
|
-
import {
|
|
4
|
-
export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX,
|
|
1
|
+
import { s as SentientConfig, r as SentientClient } from './index-DlJDNOWu.cjs';
|
|
2
|
+
export { a as AssignResult, b as Assignment, c as AssignmentCache, E as EventQueue, g as EventType, i as GraphClient, j as GraphConfig, k as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, m as MicroSignalType, o as PageNode, Q as QueueConfig, S as STAGE_ATTRIBUTE, t as SentientEvent, u as SessionConfig, v as SessionManager, x as StageAttributes, z as attachMicroSignalDetectors, F as exposedStage, I as grantConsent, K as isDoNotTrackEnabled, X as sanitizePageUrl, Y as sessionCookieName, $ as setStageAttribute } from './index-DlJDNOWu.cjs';
|
|
3
|
+
import { c as CompoundLocator } from './session-meta-BqBaLZag.cjs';
|
|
4
|
+
export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, e as SlotConfigEntry, f as SlotDeclInput, g as SlotOps, j as armOfResult, k as baselineResultFor, l as baselineSlots, o as deriveSessionSegment, p as detectDeviceClass, q as detectTimeOfDay, r as detectTrafficSource, v as readSnapshot, w as referrerDomainFromReferer, x as renderPrePaintScript, y as toWireSlot, B as writeSnapshot } from './session-meta-BqBaLZag.cjs';
|
|
5
5
|
export { B as BLOCK_ALIGNS, a as BLOCK_EMPHASES, b as BLOCK_FITS, c as BLOCK_GAPS, d as BLOCK_GRID_COLUMNS, e as BLOCK_HEADING_LEVELS, f as BLOCK_JUSTIFIES, g as BLOCK_MAX_WIDTHS, h as BLOCK_PADS, i as BLOCK_RATIOS, j as BLOCK_SIZES, k as BLOCK_SURFACES, l as BLOCK_TEXT_ALIGNS, m as BLOCK_TONES, n as BLOCK_WEIGHTS, o as BadgeBlock, p as BlockAlign, q as BlockEmphasis, r as BlockFit, s as BlockGap, t as BlockJustify, u as BlockMaxWidth, v as BlockNode, w as BlockPad, x as BlockRatio, y as BlockSize, z as BlockSurface, A as BlockTextAlign, C as BlockTone, D as BlockWeight, E as ButtonBlock, G as DividerBlock, H as FORM_FIELD_KINDS, I as FORM_INPUT_TYPES, J as FormBlock, K as FormField, L as GridBlock, M as HeadingBlock, N as ImageBlock, P as LinkBlock, Q as MAX_BLOCK_ARMS, R as MAX_BLOCK_CHILDREN, S as MAX_BLOCK_DEPTH, T as MAX_BLOCK_NODES, U as MAX_BLOCK_TEXT_LEN, V as MAX_FORM_FIELDS, W as MAX_FORM_SELECT_OPTIONS, $ as SitePalette, a0 as SpacerBlock, a1 as StackBlock, a5 as TextBlock, a6 as containsFormBlock } from './style-vocabulary-Ba_g6_DD.cjs';
|
|
6
6
|
export { SlotResult } from '@sentientui/policy';
|
|
7
7
|
import './region-skeleton-BRIVB-qf.cjs';
|
package/dist/index-graph.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { s as SentientConfig, r as SentientClient } from './index-
|
|
2
|
-
export { a as AssignResult, b as Assignment, c as AssignmentCache, E as EventQueue, g as EventType, i as GraphClient, j as GraphConfig, k as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, m as MicroSignalType, o as PageNode, Q as QueueConfig, S as STAGE_ATTRIBUTE, t as SentientEvent, u as SessionConfig, v as SessionManager, x as StageAttributes, z as attachMicroSignalDetectors, F as exposedStage, I as grantConsent, K as isDoNotTrackEnabled, X as sanitizePageUrl, Y as sessionCookieName, $ as setStageAttribute } from './index-
|
|
3
|
-
import {
|
|
4
|
-
export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX,
|
|
1
|
+
import { s as SentientConfig, r as SentientClient } from './index-C--aVpoo.js';
|
|
2
|
+
export { a as AssignResult, b as Assignment, c as AssignmentCache, E as EventQueue, g as EventType, i as GraphClient, j as GraphConfig, k as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, M as MicroSignalEmitter, m as MicroSignalType, o as PageNode, Q as QueueConfig, S as STAGE_ATTRIBUTE, t as SentientEvent, u as SessionConfig, v as SessionManager, x as StageAttributes, z as attachMicroSignalDetectors, F as exposedStage, I as grantConsent, K as isDoNotTrackEnabled, X as sanitizePageUrl, Y as sessionCookieName, $ as setStageAttribute } from './index-C--aVpoo.js';
|
|
3
|
+
import { c as CompoundLocator } from './session-meta-D_kdNsaU.js';
|
|
4
|
+
export { D as DecisionSnapshot, S as SNAPSHOT_STORAGE_KEY_PREFIX, e as SlotConfigEntry, f as SlotDeclInput, g as SlotOps, j as armOfResult, k as baselineResultFor, l as baselineSlots, o as deriveSessionSegment, p as detectDeviceClass, q as detectTimeOfDay, r as detectTrafficSource, v as readSnapshot, w as referrerDomainFromReferer, x as renderPrePaintScript, y as toWireSlot, B as writeSnapshot } from './session-meta-D_kdNsaU.js';
|
|
5
5
|
export { B as BLOCK_ALIGNS, a as BLOCK_EMPHASES, b as BLOCK_FITS, c as BLOCK_GAPS, d as BLOCK_GRID_COLUMNS, e as BLOCK_HEADING_LEVELS, f as BLOCK_JUSTIFIES, g as BLOCK_MAX_WIDTHS, h as BLOCK_PADS, i as BLOCK_RATIOS, j as BLOCK_SIZES, k as BLOCK_SURFACES, l as BLOCK_TEXT_ALIGNS, m as BLOCK_TONES, n as BLOCK_WEIGHTS, o as BadgeBlock, p as BlockAlign, q as BlockEmphasis, r as BlockFit, s as BlockGap, t as BlockJustify, u as BlockMaxWidth, v as BlockNode, w as BlockPad, x as BlockRatio, y as BlockSize, z as BlockSurface, A as BlockTextAlign, C as BlockTone, D as BlockWeight, E as ButtonBlock, G as DividerBlock, H as FORM_FIELD_KINDS, I as FORM_INPUT_TYPES, J as FormBlock, K as FormField, L as GridBlock, M as HeadingBlock, N as ImageBlock, P as LinkBlock, Q as MAX_BLOCK_ARMS, R as MAX_BLOCK_CHILDREN, S as MAX_BLOCK_DEPTH, T as MAX_BLOCK_NODES, U as MAX_BLOCK_TEXT_LEN, V as MAX_FORM_FIELDS, W as MAX_FORM_SELECT_OPTIONS, $ as SitePalette, a0 as SpacerBlock, a1 as StackBlock, a5 as TextBlock, a6 as containsFormBlock } from './style-vocabulary-Ba_g6_DD.js';
|
|
6
6
|
export { SlotResult } from '@sentientui/policy';
|
|
7
7
|
import './region-skeleton-BRIVB-qf.js';
|
package/dist/index-graph.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var Hn=Object.create;var Ke=Object.defineProperty,Vn=Object.defineProperties,zn=Object.getOwnPropertyDescriptor,qn=Object.getOwnPropertyDescriptors,Xn=Object.getOwnPropertyNames,Jt=Object.getOwnPropertySymbols,Qn=Object.getPrototypeOf,Zt=Object.prototype.hasOwnProperty,Jn=Object.prototype.propertyIsEnumerable;var Yt=(e,t,n)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t)=>{for(var n in t||(t={}))Zt.call(t,n)&&Yt(e,n,t[n]);if(Jt)for(var n of Jt(t))Jn.call(t,n)&&Yt(e,n,t[n]);return e},oe=(e,t)=>Vn(e,qn(t));var Yn=(e,t)=>{for(var n in t)Ke(e,n,{get:t[n],enumerable:!0})},en=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Xn(t))!Zt.call(e,i)&&i!==n&&Ke(e,i,{get:()=>t[i],enumerable:!(r=zn(t,i))||r.enumerable});return e};var Zn=(e,t,n)=>(n=e!=null?Hn(Qn(e)):{},en(t||!e||!e.__esModule?Ke(n,"default",{value:e,enumerable:!0}):n,e)),eo=e=>en(Ke({},"__esModule",{value:!0}),e);var Pr={};Yn(Pr,{BLOCK_ALIGNS:()=>xo,BLOCK_EMPHASES:()=>Ao,BLOCK_FITS:()=>Oo,BLOCK_GAPS:()=>Eo,BLOCK_GRID_COLUMNS:()=>Po,BLOCK_HEADING_LEVELS:()=>Do,BLOCK_JUSTIFIES:()=>ko,BLOCK_MAX_WIDTHS:()=>Lo,BLOCK_PADS:()=>Mo,BLOCK_RATIOS:()=>Ro,BLOCK_SIZES:()=>Io,BLOCK_SURFACES:()=>No,BLOCK_TEXT_ALIGNS:()=>_o,BLOCK_TONES:()=>To,BLOCK_WEIGHTS:()=>Co,FORM_FIELD_KINDS:()=>Bo,FORM_INPUT_TYPES:()=>Go,LEGACY_SESSION_COOKIE_NAME:()=>ge,MAX_BLOCK_ARMS:()=>Wo,MAX_BLOCK_CHILDREN:()=>jo,MAX_BLOCK_DEPTH:()=>Fo,MAX_BLOCK_NODES:()=>Uo,MAX_BLOCK_TEXT_LEN:()=>Ho,MAX_FORM_FIELDS:()=>Ko,MAX_FORM_SELECT_OPTIONS:()=>$o,SNAPSHOT_STORAGE_KEY_PREFIX:()=>ye,STAGE_ATTRIBUTE:()=>lt,armOfResult:()=>at,attachMicroSignalDetectors:()=>vn,baselineResultFor:()=>Le,baselineSlots:()=>fn,containsFormBlock:()=>bn,deriveSessionSegment:()=>kt,detectDeviceClass:()=>Oe,detectTimeOfDay:()=>Ne,detectTrafficSource:()=>Pe,exposedStage:()=>ct,grantConsent:()=>_n,init:()=>Un,isDoNotTrackEnabled:()=>He,locatorFromElement:()=>ft,readSnapshot:()=>Ce,referrerDomainFromReferer:()=>De,renderPrePaintScript:()=>nn,sanitizePageUrl:()=>Rt,sessionCookieName:()=>be,setStageAttribute:()=>dt,toWireSlot:()=>je,writeSnapshot:()=>Te});module.exports=eo(Pr);function pe(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function vt(e,t){return new Promise(n=>{let r=setTimeout(()=>n(!1),t),i=()=>{clearTimeout(r),n(!0)};e.then(i,i)})}var to;function tn(e){to=typeof e=="string"&&e!==""?e:void 0}function ie(e){return e?`_${e.slice(0,12)}`:""}var ge="_snt_uid";function be(e){return`${ge}${ie(e)}`}var Xe="__sntForgetGen",no=()=>{try{return window[Xe]}catch(e){return}};function Qe(e){var t,n;try{let r=window,i=(t=r[Xe])!=null?t:r[Xe]={};i[e]=((n=i[e])!=null?n:0)+1}catch(r){}}function me(e){var t,n;return(n=(t=no())==null?void 0:t[e])!=null?n:0}var ye="_snt_snap:";var oo=["low","medium","high"];function Ce(e){try{let t=localStorage.getItem(ye+e);if(!t)return null;let n=JSON.parse(t);if(!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!oo.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(Date.now()-n.savedAt<2592e6)||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig)))return null;let r=n.vocabulary;return r!==void 0&&(typeof r!="object"||r===null||!Array.isArray(r.entries)||!Array.isArray(r.images))&&delete n.vocabulary,n.stage!==void 0&&typeof n.stage!="string"&&delete n.stage,n}catch(t){return null}}function Te(e,t){try{localStorage.setItem(ye+e,JSON.stringify(t))}catch(n){}}function nn(e,t){return'(function(){try{var N=navigator,W=window;if(N.doNotTrack=="1"||N.doNotTrack=="yes"||W.doNotTrack=="1"||N.msDoNotTrack=="1"||N.globalPrivacyControl)return;var r=localStorage.getItem('+JSON.stringify(ye+e).replace(/</g,"\\u003c")+');if(!r)return;var s=JSON.parse(r);if(!s||s.v!==1||typeof s.persona!=="string"||typeof s.band!=="string")return;if(!('+2592e6+">Date.now()-s.savedAt))return;var d=document.documentElement;"+(t!=null&&t.stage?'if(typeof s.stage=="string"&&!d.hasAttribute("data-sentient-stage"))d.setAttribute("data-sentient-stage",s.stage);':"")+'if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",s.persona);d.setAttribute("data-sentient-confidence",s.band);}catch(e){}})();'}function Se(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Ae(e){if(e.ok===!0)return"delivered";let{status:t}=e;return typeof t!="number"?"retry":t>=200&&t<300?"delivered":t>=400&&t<500&&t!==429?"dropped":"retry"}function Je(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?(localStorage.removeItem(e),r.slice(-t)):[]}catch(n){return[]}}function $e(e,t,n){try{let r=(()=>{try{let s=localStorage.getItem(n);if(!s)return[];let u=JSON.parse(s);return Array.isArray(u)?u:[]}catch(s){return[]}})(),i=new Map;for(let s of r)i.set(s.id,s);for(let s of e)i.set(s.id,s);localStorage.setItem(n,JSON.stringify([...i.values()].slice(-t)))}catch(r){}}function Ye(e,t){try{let n=localStorage.getItem(t);if(!n)return;let r=JSON.parse(n);if(!Array.isArray(r))return;let i=new Set(e),s=r.filter(u=>!i.has(u.id));if(s.length===r.length)return;s.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(s))}catch(n){}}var ro=500,so=56*1024;function Ue(e){return`_snt_retry_${e.slice(0,12)}`}var io={push:()=>{},flush:()=>{},destroy:()=>{}};function on(e){var N,ee,ae;if(typeof window=="undefined")return io;let t=(N=e.flushIntervalMs)!=null?N:5e3,n=(ee=e.maxBatchSize)!=null?ee:20,r=(ae=e.maxRetrySize)!=null?ae:100,i=e.ingestUrl,s=e.apiKey,u=Ue(s),o=!1,p=me(s),a=(...k)=>{!o&&me(s)===p&&$e(...k)},c=[],d=new Set,S=[],y=k=>{for(let B of k)b.delete(B),!d.has(B)&&(d.add(B),S.push(B));for(;S.length>ro;){let B=S.shift();B&&d.delete(B)}Ye(k,u)},b=new Set,v=()=>{for(;c.length>r;){let k=c.shift();k&&b.delete(k.id)}},P=k=>{d.has(k.id)||b.has(k.id)||(b.add(k.id),c.push(k),v())},O=k=>{for(let B of k)d.has(B.id)||(b.add(B.id),c.push(B));v()},K=Je(u,r);for(let k of K)P(k);let L=0,W=0,X=(k,B=!0)=>{if(k.length===0)return;let fe=JSON.stringify(k),ve=k.map(re=>re.id),te,Ee=pe(15e3);try{te=fetch(i,{method:"POST",keepalive:!0,signal:Ee.signal,body:fe,headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})}catch(re){a(k,r,u),O(k),W++,L=Date.now()+Se(W);return}Promise.resolve(te).then(Ee.clear,Ee.clear);let xe=re=>{if(Ae(re)!=="retry"){if(!re.ok&&B){let ke=k.filter(le=>le.eventType!=="pageview");if(ke.length>0&&ke.length<k.length){y(k.filter(le=>le.eventType==="pageview").map(le=>le.id)),X(ke,!1);return}}y(ve),W=0,L=0;return}a(k,r,u),O(k),W++,L=Date.now()+Se(W)};te&&typeof te.then=="function"?te.then(xe).catch(()=>{a(k,r,u),O(k),W++,L=Date.now()+Se(W)}):xe(te)},H=typeof TextEncoder!="undefined"?new TextEncoder:null,f=k=>H?H.encode(k).length:k.length,h=k=>{let B=[],fe=2;for(let ve of k){let te=f(JSON.stringify(ve))+1;if(B.length>0&&fe+te>so||B.length>=n)break;B.push(ve),fe+=te}return B},E=()=>{try{if(Date.now()<L)return;for(;c.length>0&&!(Date.now()<L);){let k=c.filter(fe=>!d.has(fe.id));if(c.length=0,k.length===0)break;let B=h(k);if(B.length===0)break;B.length<k.length&&c.push(...k.slice(B.length)),X(B)}}catch(k){}},m=!0,_=null;_=setInterval(()=>{m&&E()},t);let $=()=>{document.visibilityState==="hidden"&&E()},V=()=>{E()};return document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",V),{push(k){P(k),c.length>=n&&E()},flush:E,destroy(k){k!=null&&k.forget&&(o=!0),m=!1,_!==null&&(clearInterval(_),_=null),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",V),E()}}}var ao=200;function Fe(e){return`_snt_goal_retry_${e.slice(0,12)}`}var lo={send:()=>{},flush:()=>{},destroy:()=>{}};function rn(e){var f,h,E;if(typeof window=="undefined")return lo;let t=(f=e.flushIntervalMs)!=null?f:5e3,n=(h=e.maxRetrySize)!=null?h:100,r=(E=e.maxPerFlush)!=null?E:5,i=Fe(e.apiKey),s=!1,u=me(e.apiKey),o=(...m)=>{!s&&me(e.apiKey)===u&&$e(...m)},p=[],a=new Set,c=new Set,d=[],S=0,y=0,b=!1,v=m=>{for(a.delete(m.id),c.has(m.id)||(c.add(m.id),d.push(m.id));d.length>ao;){let _=d.shift();_&&c.delete(_)}Ye([m.id],i)},P=m=>{o([m],n,i),!c.has(m.id)&&!a.has(m.id)&&(a.add(m.id),p.push(m)),Date.now()>=S&&(y++,S=Date.now()+Se(y))},O=m=>{let _,$=pe(15e3);try{_=fetch(e.url,{method:"POST",keepalive:!0,signal:$.signal,body:m.body,headers:e.headers})}catch(N){P(m);return}let V=N=>{var ae;let ee=Ae(N);if(ee==="retry"){P(m);return}ee==="dropped"&&((ae=e.onDrop)==null||ae.call(e,m,N.status)),v(m),y=0,S=0};Promise.resolve(_).then($.clear,$.clear),_&&typeof _.then=="function"?_.then(V).catch(()=>P(m)):V(_)},K=()=>{try{if(b||Date.now()<S)return;let m=0;for(;p.length>0&&m<r&&!(Date.now()<S);){let _=p.shift();a.delete(_.id),!c.has(_.id)&&(m++,O(_))}}catch(m){}},L=Je(i,n);for(let m of L)a.has(m.id)||(a.add(m.id),p.push(m));L.length>0&&$e(L,n,i);let W=setInterval(K,t),X=()=>{document.visibilityState==="hidden"&&K()},H=()=>K();return document.addEventListener("visibilitychange",X),window.addEventListener("pagehide",H),{send(m){if(b){c.has(m.id)||o([m],n,i);return}if(!(c.has(m.id)||a.has(m.id))){if(Date.now()<S){o([m],n,i),a.add(m.id),p.push(m);return}O(m)}},flush:K,destroy(m){m!=null&&m.forget&&(s=!0),clearInterval(W),document.removeEventListener("visibilitychange",X),window.removeEventListener("pagehide",H),K(),b=!0}}}function Ze(e){let t=(e||"").toLowerCase();if(!t.includes(".")||/^[\d.]+$|:/.test(t))return[];let n=t.split("."),r=[];for(let i=n.length-2;i>=0;i--)r.push(n.slice(i).join("."));return r}function sn(e){if(typeof window=="undefined"||!e)return!1;Qe(e);let t=!1,n=be(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let u=location.protocol==="https:"?"; Secure":"";for(let o of["",...Ze(location.hostname)])document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${o?`; domain=${o}`:""}${u}`;t=!0}}catch(u){}let r=ie(e),i=[n,"_snt_graph_edges",ye+e,Ue(e),Fe(e),`_snt_graph_nodes${r}`],s=[`_snt_asgn${r}_`];for(let u of["localStorage","sessionStorage"])try{let o=window[u];for(let p of i)o.getItem(p)!==null&&(o.removeItem(p),t=!0);for(let p=o.length-1;p>=0;p--){let a=o.key(p);a&&s.some(c=>a.startsWith(c))&&(o.removeItem(a),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${ge}=[^;]`).test(document.cookie)||localStorage.getItem(ge)!==null||sessionStorage.getItem(ge)!==null)&&localStorage.setItem(`${ge}_tomb${r}`,"1")}catch(u){}return t}function et(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"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 an="_snt_uid",co=365,_e="_snt_uid";function uo(){return et()}function Re(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function cn(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function ot(e,t,n,r){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${r?`; domain=${r}`:""}${cn()}`}catch(i){}}function tt(e){try{return localStorage.getItem(e)}catch(t){return null}}function ln(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Et(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function po(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function go(e){try{sessionStorage.removeItem(e)}catch(t){}}function fo(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${cn()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function mo(e){try{localStorage.removeItem(e)}catch(t){}}function nt(e,t){ot(e,"",0,t)}var yo={getSessionId:()=>null,isEphemeral:()=>!1,domain:null,destroy:()=>{}};function So(e,t){if(e===!1)return null;if(typeof e=="string")return e.replace(/^\./,"");for(let n of Ze(location.hostname))if(ot(t,"1",10,n),Re(t)==="1")return nt(t,n),n;return null}function rt(e){var O,K,L,W,X,H,f;if(typeof window=="undefined")return yo;let t=ie(e==null?void 0:e.apiKey),n=(O=e==null?void 0:e.cookieName)!=null?O:be(e==null?void 0:e.apiKey),r=`${_e}${t}`,i=`${_e}_tomb${t}`,u=((K=e==null?void 0:e.cookieTTLDays)!=null?K:co)*24*60*60,o=h=>h&&h.length>0?h:null,p=()=>{var h,E;return t&&!(e!=null&&e.cookieName)&&tt(i)===null?(E=(h=o(Re(an)))!=null?h:o(tt(_e)))!=null?E:o(Et(_e)):null},a=So(e==null?void 0:e.cookieDomain,`${n}_dom`),c=o(Re(n)),d=a?(nt(n),o(Re(n))):null,S=(f=(H=(X=(W=(L=d!=null?d:c)!=null?L:o(tt(r)))!=null?W:o(Et(r)))!=null?X:p())!=null?H:o(e==null?void 0:e.ssrSessionId))!=null?f:uo();ot(n,S,u,a),a&&Re(n)!==S&&(a=null,ot(n,S,u));let y=ln(r,S),b=fo(n),v=y?!1:po(r,S),P=!y&&!b&&!v;return{getSessionId:()=>S,isEphemeral:()=>P,domain:a,destroy:()=>{S=null,nt(n),nt(n,a),mo(r),go(r),t&&!(e!=null&&e.cookieName)&&(Re(an)!==null||tt(_e)!==null||Et(_e)!==null)&&ln(i,"1")}}}var ho=1800*1e3;function st(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function dn(e=ho,t){let n=new Map,r=`_snt_asgn${ie(t)}_`,i=(a,c)=>`${r}${encodeURIComponent(a)}:${encodeURIComponent(c)}`,s=a=>{let c=a.slice(r.length),d=c.indexOf(":");if(d<0)return null;try{return{componentId:decodeURIComponent(c.slice(0,d)),segment:decodeURIComponent(c.slice(d+1))}}catch(S){return null}},u=()=>{try{let a=[];for(let c=0;c<localStorage.length;c++){let d=localStorage.key(c);d!=null&&d.startsWith(r)&&a.push(d)}return a}catch(a){return[]}},o=a=>a.assignedAt+(a.ttlMs&&a.ttlMs>0?a.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let a of u())try{let c=localStorage.getItem(a);if(!c)continue;let d=JSON.parse(c);if(o(d)){localStorage.removeItem(a);continue}let S=s(a);if(!S)continue;n.set(st(S.componentId,S.segment),d)}catch(c){}})(),{get(a,c){let d=n.get(st(a,c));return d?o(d)?(n.delete(st(a,c)),null):d:null},set(a,c,d){let S=st(a,c);n.set(S,d);try{localStorage.setItem(i(a,c),JSON.stringify(d))}catch(y){}},clear(){n.clear();for(let a of u())try{localStorage.removeItem(a)}catch(c){}}}}var un=["GPTBot","ChatGPT-User","OAI-SearchBot","ClaudeBot","Claude-User","Claude-SearchBot","PerplexityBot","Perplexity-User","Google-Extended","Applebot-Extended","Meta-ExternalAgent","Bytespider","CCBot","Amazonbot","cohere-ai","Diffbot"];function it(e){return pn(e)!==null}function pn(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=un.find(r=>t.includes(r.toLowerCase())))!=null?n:null}function Oe(e){let t=e.toLowerCase();return/ipad|tablet|playbook|kindle|silk/.test(t)?"tablet":/mobi|iphone|ipod|android.*mobile|phone/.test(t)?"mobile":"desktop"}function Pe(e,t,n){if(!e)return"direct";try{let r=new URL(e);if(t)try{if(new URL(t).host===r.host)return"direct"}catch(s){}let i=r.hostname.toLowerCase();return n&&`.${i}`.endsWith(`.${n}`)?"direct":/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(i)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(i)?"social":"referral"}catch(r){return"direct"}}function De(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var gn=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function xt(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([i,s])=>{let u=Array.isArray(s)?s[0]:s;return u===void 0?[]:[[i,u]]});for(let[i,s]of r)i.startsWith("utm_")?i in t||(t[i]=s):gn.includes(i)&&(i in n||(n[i]=s))}catch(r){}return{utmParams:t,clickIds:n}}function Ne(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function kt(e){let t=bo("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function bo(e,t){var s,u,o,p,a,c,d,S;let n=(u=(s=t==null?void 0:t.userAgent)==null?void 0:s.trim())!=null?u:"",r=(p=(o=t==null?void 0:t.referer)==null?void 0:o.trim())!=null?p:"",i=(a=t==null?void 0:t.now)!=null?a:new Date;return T({sessionId:e,ephemeral:!1,utmParams:(c=t==null?void 0:t.utmParams)!=null?c:{},clickIds:(d=t==null?void 0:t.clickIds)!=null?d:{},deviceClass:n?Oe(n):"desktop",trafficSource:r?Pe(r,t==null?void 0:t.appOrigin):"direct",referrerDomain:De(r),timeOfDay:Ne(i),dayOfWeek:(S=["sun","mon","tue","wed","thu","fri","sat"][i.getDay()])!=null?S:"sun",automation:(t==null?void 0:t.webdriver)===!0||it(n)},t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var Me=require("@sentientui/policy");function je(e){return T(T(T({id:e.id},e.arms?{arms:[...e.arms]}:{}),e.dims?{dims:Object.fromEntries(Object.entries(e.dims).map(([t,n])=>[t,[...n]]))}:{}),e.baseline!==void 0?{baseline:e.baseline}:{})}function Le(e){let t=je(e);return(0,Me.slotResultFor)(t,(0,Me.slotBaselineArm)(t))}function fn(e){let t={};for(let n of e)t[n.id]=Le(n);return t}function at(e){return typeof e=="string"?e:(0,Me.canonicalArm)(e)}var mn=require("@sentientui/policy"),lt="data-sentient-stage";function ct(e,t){return!t||typeof e!="string"||!(e==="returning"||mn.STAGE_KEYS.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function dt(e,t=document){try{e?t.documentElement.setAttribute(lt,e):t.documentElement.removeAttribute(lt)}catch(n){}}var Tt=require("@sentientui/policy");var pt=require("@sentientui/policy");var yn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",vo="[sentient] Local mode \u2014 decisions are simulated on-device and nothing is sent over the network. Add an API key to learn from real traffic.",Sn=!1,ut=!1;function wo(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function hn(e){var a;let t=rt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(a=t.getSessionId())!=null?a:"local",r=wo(),i=import("@sentientui/core/local").then(c=>{let d=c;return d.LOCAL_ENGINE_AVAILABLE?(Sn||(Sn=!0,console.info(vo)),d):(ut||(ut=!0,console.error(yn)),null)}).catch(()=>(ut||(ut=!0,console.error(yn)),null)),s=null,u={low:.15,medium:.5,high:.85},o=(()=>{var d;if(e.initialPersona)return T({},e.initialPersona);let c=Ce(e.apiKey||"local");return c?{persona:c.persona,confidence:(d=u[c.band])!=null?d:.15}:null})();function p(c){let d=document.documentElement;d.dataset.sentientPersona===void 0&&(d.dataset.sentientPersona=c.persona,d.dataset.sentientConfidence=(0,pt.confidenceBand)(c.confidence))}return{isLocal:!0,async decide(c){var y,b,v;let d=await i;if(!d)return null;let S=d.createLocalEngine({sessionId:n,forcedPersona:r}).decide(c);return s=oe(T({},S),{layoutOrder:(b=(y=S.layoutOrder)!=null?y:s==null?void 0:s.layoutOrder)!=null?b:null,slots:T(T({},(v=s==null?void 0:s.slots)!=null?v:{}),S.slots)}),Te(e.apiKey||"local",{v:1,persona:s.persona,band:(0,pt.confidenceBand)(s.confidence),slots:s.slots,layoutOrder:s.layoutOrder,savedAt:Date.now()}),p(S),S},getSlotResult(c){var d,S,y;return(y=(S=s==null?void 0:s.slots[c])!=null?S:(d=e.initialSlots)==null?void 0:d[c])!=null?y:null},getSlotConfig(c){var d,S;return(S=(d=e.initialSlotConfig)==null?void 0:d[c])!=null?S:null},getSitePalette(){var c;return(c=e.initialPalette)!=null?c:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let c=s!=null?s:o;return c?{persona:c.persona,confidence:c.confidence,band:(0,pt.confidenceBand)(c.confidence)}:null},async assign(c,d){var b;let S=await i;return!S||!d||d.length===0?d!=null&&d[0]?{variantId:d[0],assignmentTtlMs:0}:null:{variantId:(b=S.createLocalEngine({sessionId:n,forcedPersona:r}).decide({components:[{id:c,variantIds:d}]}).assignments[c])!=null?b:d[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var Eo=["none","sm","md","lg"],xo=["start","center","end","stretch"],ko=["start","center","end","between"],Io=["sm","md","lg"],Co=["normal","medium","bold"],To=["default","muted","accent"],Ao=["primary","secondary","ghost"],_o=["left","center","right"],Ro=["auto","square","landscape","wide"],Oo=["cover","contain"],Po=[2,3,4],Do=[1,2,3,4],No=["default","raised"],Mo=["none","sm","md","lg"],Lo=["measure"],Bo=["input","textarea","select"],Go=["text","email","number","tel"],Ko=5,$o=8,Uo=64,Fo=5,jo=12,Wo=4,Ho=500;function bn(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="form"?!0:Array.isArray(t.children)?t.children.some(bn):!1}function vn(e,t,n,r){let i=[];{let o=!1,p=[],a=()=>{if(o)return;let c=Date.now();for(p.push(c);p.length>0&&c-p[0]>500;)p.shift();p.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",a),i.push(()=>t.removeEventListener("click",a))}{let s=!1,u=o=>{if(s||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;s=!0;let p=typeof window!="undefined"?window.getSelection():null,a=p?p.toString().length:0;e("text_copy",{selectionLength:a})};document.addEventListener("copy",u),i.push(()=>document.removeEventListener("copy",u))}{let s=!1,u=!1,o=null,p=()=>{o!==null&&(clearTimeout(o),o=null)},a=()=>{s||!u||(p(),o=setTimeout(()=>{!s&&u&&(s=!0,e("scroll_hesitation"))},3e3))},c=()=>{p(),a()},d=y=>{for(let b of y)u=b.intersectionRatio>.3,u?a():p()},S=new IntersectionObserver(d,{threshold:[.3]});S.observe(t),window.addEventListener("scroll",c,{passive:!0}),i.push(()=>{S.disconnect(),window.removeEventListener("scroll",c),p()})}if((r==null?void 0:r.tabLoss)!==!1){let s=!1,u=n!=null?n:Date.now(),o=()=>{if(s||document.visibilityState!=="hidden")return;let p=Date.now()-u;p<15e3&&(s=!0,e("tab_loss",{timeOnPage:p}))};document.addEventListener("visibilitychange",o),i.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let s of i)s()}}function Vo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var kn="https://api.sentient-ui.com/v1/events",J=new Map,In=null;function Cn(e,t){let n=J.get(e);n&&n.upgrade&&(n.reinit=t)}function zo(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var qo=3;function It(){return et()}function gt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Xo(){let e=new WeakMap,t=new Map,n=!1,r=(o,p,a)=>{let c=o.get(p);return a===null?c?!0:(o.set(p,new Set),!1):c?c.has(a)?!0:(c.add(a),!1):(o.set(p,new Set([a])),!1)},i=typeof window!="undefined"&&"event"in window,s=()=>{if(!i)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},u=()=>{if(i){Promise.resolve().then(()=>{n=!1,t.clear()});return}let o=!1,p=()=>{o||(o=!0,n=!1,t.clear())};if(setTimeout(p,0),typeof MessageChannel=="function"){let a=new MessageChannel;a.port1.onmessage=()=>{a.port1.close(),a.port2.close(),p()},a.port2.postMessage(0)}};return{firedBefore(o,p){let a=s();if(a){let d=e.get(a);return d||(d=new Map,e.set(a,d)),r(d,o,p)}let c=r(t,o,p);return!c&&!n&&(n=!0,u()),c}}}var Tn=new Set;function Qo(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let i=!1,s,u=()=>{if(i)return;let a=gt();!a||a===s||(s=a,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${a}`))},o=[];for(let a of["pushState","replaceState"]){let c=r[a],d=function(...S){let y=c.apply(this,S);return u(),y};r[a]=d,o.push([a,c,d])}window.addEventListener("popstate",u);let p=gt();return p&&Tn.has(`${t}:${p}`)?s=p:u(),()=>{if(!i){i=!0,window.removeEventListener("popstate",u);for(let[a,c,d]of o)r[a]===d&&(r[a]=c)}}}var We={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Jo(){try{return xt(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function An(e){return e.replace(/\/events\/?$/,"")}function He(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(t=>t==="1"||t==="yes")}function _n(e){var p;if(typeof window=="undefined")return;let t=e!=null?e:In;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=J.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:r,upgrade:i,reinit:s}=n;if(!i){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(r.respectDoNotTrack!==!1&&He())return;let u=(s!=null?s:_t)(oe(T({},r),{consent:!0}));i(u);let o=(p=J.get(t))==null?void 0:p.dispose;J.set(t,{config:oe(T({},r),{consent:!0}),upgrade:null,dispose:o})}function Yo(e,t){var H;let n=e.preConsentBehavior==="statistical_winner",r=An((H=e.ingestUrl)!=null?H:kn),i={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},s=new Map,u=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(f,h,E){if(!n)return Promise.resolve(null);let m=s.get(f);return m?Promise.resolve(m):At(u,f,async()=>{try{let _=new URLSearchParams({componentId:f});for(let ee of h!=null?h:[])_.append("variantIds[]",ee);let $=pe(5e3),V;try{let ee=await fetch(`${r}/winner?${_.toString()}`,{headers:i,signal:$.signal});if(!ee.ok)return h!=null&&h[0]?{variantId:h[0],assignmentTtlMs:0}:null;V=await ee.json()}finally{$.clear()}let N={variantId:V.variantId,assignmentTtlMs:0};return s.set(f,N),N}catch(_){return h!=null&&h[0]?{variantId:h[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},p=!1,a=new Set,c=[],d=[],S=[],y=()=>{for(let[,,f]of S.splice(0))f(null);b.length=0},b=[],v=!1,P=()=>{if(p)return;v=!0;let f=J.get(e.apiKey);(f==null?void 0:f.upgrade)===X&&J.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},O=[],K=()=>{setTimeout(()=>{var f;try{(f=O.shift())==null||f(o)}catch(h){}O.length&&K()})},L=f=>{p?O.length?O.push(f):f(o):!t&&!v&&b.length<100?b.push(f):v&&e.debug&&console.warn("[sentient] goal dropped: client released")},W={get gated(){return!p&&!t},get released(){return v&&!p},takeHeld:()=>b.splice(0),track:f=>o.track(f),goal:((f,h,E,m)=>L(_=>_.goal(f,h,E,m))),componentGoal:(f,h,E)=>o.componentGoal(f,h,E),identify:(f,h)=>o.identify(f,h),getAssignment:(f,h)=>o.getAssignment(f,h),isUnified:f=>{var h,E;return(E=(h=o.isUnified)==null?void 0:h.call(o,f))!=null?E:!1},assign:(f,h,E,m,_)=>o.assign(f,h,E,m,_),decide:f=>p?o.decide(f):v||t?Promise.resolve(null):new Promise(h=>S.push([f,xn(),h])),getSlotResult:f=>o.getSlotResult(f),isSlotDecided:f=>{var h,E;return(E=(h=o.isSlotDecided)==null?void 0:h.call(o,f))!=null?E:!0},getSlotConfig:f=>o.getSlotConfig(f),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var f,h;return(h=(f=o.getStyleVocabulary)==null?void 0:f.call(o))!=null?h:null},reportSlots:(f,h,E,m)=>o.reportSlots(f,h,E,m),reportSkeleton:(f,h)=>{var E;return(E=o.reportSkeleton)==null?void 0:E.call(o,f,h)},reportAgentData:(f,h,E)=>{var m;return(m=o.reportAgentData)==null?void 0:m.call(o,f,h,E)},reportDrift:(f,h,E,m)=>{var _;return(_=o.reportDrift)==null?void 0:_.call(o,f,h,E,m)},requestSlots:(f,h,E)=>{var m;return p?(m=o.requestSlots)==null?void 0:m.call(o,f,h,E):c.push([f,h,E])},decideSlots:f=>{var h;return p?(h=o.decideSlots)==null?void 0:h.call(o,f):d.push(...f)},cancelSlots:f=>{var E;if(p)return(E=o.cancelSlots)==null?void 0:E.call(o,f);let h=new Set(f);for(let m of c)m[0]=m[0].filter(_=>!h.has(_));d=d.filter(m=>!h.has(m.id))},onSlotsChanged:f=>(a.add(f),()=>{a.delete(f)}),getPersona:()=>o.getPersona(),getVisitorId:()=>{var f,h;return(h=(f=o.getVisitorId)==null?void 0:f.call(o))!=null?h:null},fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(P(),y(),o.dispose()),destroy:()=>(P(),y(),p?o.destroy():sn(e.apiKey))};function X(f){var E,m,_;o=f,p=!0,b.length&&(O.push(...b.splice(0)),K());let h=xn();for(let[$,V,N]of S.splice(0))V!==h?N(null):f.decide($).then(N,()=>N(null));(E=f.onSlotsChanged)==null||E.call(f,()=>a.forEach($=>$()));for(let[$,V,N]of c.splice(0))$.length>0&&((m=f.requestSlots)==null||m.call(f,$,V,N));d.length>0&&((_=f.decideSlots)==null||_.call(f,d.splice(0)))}return{proxy:W,setInner:X}}function xn(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function At(e,t,n){let r=e.get(t);if(r)return r;let i=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,i),i}function _t(e){var Gt,Kt,$t,Ut,Ft,jt,Wt,Ht,Vt,zt,qt;if(typeof window=="undefined")return We;e.nonce&&tn(e.nonce),In=e.apiKey||"local";let t=J.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(l){}let n=e.respectDoNotTrack!==!1&&He(),r=e.consent===!1||n,i=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!i&&e.localMode!==!1)return J.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),r?We:hn(e);if(r){if(!e.apiKey||!e.apiKey.startsWith("pk_"))return e.preConsentBehavior==="statistical_winner"&&console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),J.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): the client was initialized with an invalid apiKey (expected a pk_ public key) \u2014 consent cannot enable tracking."}),We;let{proxy:l,setInner:g}=Yo(e,n);return J.set(e.apiKey,{config:e,upgrade:n?null:g}),l}if(!e.apiKey||!e.apiKey.startsWith("pk_"))return console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),We;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),We;let s=(Gt=e.ingestUrl)!=null?Gt:kn,u=Date.now(),o=rt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey,cookieDomain:e.cookieDomain}),p=dn(void 0,e.apiKey),a=!1,c=me(e.apiKey),d=()=>!a&&me(e.apiKey)===c,S=new Set((Kt=e.initialUnified)!=null?Kt:[]),y=oe(T({},p),{get:(l,g)=>S.has(l)?null:p.get(l,g),set:(...l)=>{d()&&p.set(...l)}}),b=on({ingestUrl:s,apiKey:e.apiKey}),v=An(s),P={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},O=new Set,K=rn({url:`${v}/goals`,apiKey:e.apiKey,headers:P,onDrop:(l,g)=>{if(!e.debug){if(O.has(g))return;O.add(g)}console.warn(`[sentient] goal dropped (HTTP ${g}) \u2014 this will not be retried. `+(g===400?"The session was not found: call init() and let the session upsert complete before firing goals.":g===401||g===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),l)}}),L=Oe(($t=navigator.userAgent)!=null?$t:""),W=window.location.origin,X=Pe((Ut=document.referrer)!=null?Ut:"",W,o.domain),H=(Ft=e.sessionSegment)!=null?Ft:`${L}:${X}`,f=new Map,h=new Map,E=new Map,m=new Set,_=new Map,$=null,V=null,N=null,ee=new Set,ae=new Set,k=new Map,B=new Map,fe=new Set,ve=new Set,te=new Set,Ee=new Set,xe=null,re=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,ke=new Set,le=new Set,ze=new Set,Be=new Map,yt=null,qe=new Set,Ge=new Map,St=null,Fn=2,Nt=new Map,se=!1,Mt=(l,g,w)=>{var x;let R=new Set,D=1;for(let I of l){g.delete(I);let C=((x=Nt.get(I))!=null?x:0)+1;Nt.set(I,C),C<=Fn&&(R.add(I),C>D&&(D=C))}R.size>0&&setTimeout(()=>{se||w(R)},Se(D))},ht=l=>{for(let g of l)E.has(g.id)||E.set(g.id,Le(g))};if(e.initialSlots)for(let[l,g]of Object.entries(e.initialSlots))E.set(l,g),m.add(l);if(e.initialSlotConfig)for(let[l,g]of Object.entries(e.initialSlotConfig))_.set(l,g);e.initialPalette&&($=e.initialPalette),e.initialVocabulary&&(V=e.initialVocabulary);let ce=Ce(e.apiKey);if(ce){for(let[l,g]of Object.entries(ce.slots))E.has(l)||E.set(l,g);for(let[l,g]of Object.entries((jt=ce.slotConfig)!=null?jt:{}))_.has(l)||_.set(l,g);!$&&ce.palette&&($=ce.palette),!V&&ce.vocabulary&&(V=ce.vocabulary)}let Lt={low:.15,medium:.5,high:.85};if(e.initialPersona)N=T({},e.initialPersona);else{let l=document.documentElement.dataset;l.sentientPersona?N={persona:l.sentientPersona,confidence:(Ht=Lt[(Wt=l.sentientConfidence)!=null?Wt:"low"])!=null?Ht:.15}:ce&&(N={persona:ce.persona,confidence:(Vt=Lt[ce.band])!=null?Vt:.15})}if(e.initialAssignments)for(let[l,g]of Object.entries(e.initialAssignments))y.set(l,H,{variantId:g,assignedAt:Date.now(),segment:H,confidence:1});let he=Promise.resolve(),Bt=o.getSessionId();if(Bt){let l=De((zt=document.referrer)!=null?zt:""),{utmParams:g,clickIds:w}=Jo(),R=T(T(T(T({sessionId:Bt,deviceClass:L,trafficSource:X,referrerDomain:l,utmParams:g,clickIds:w,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:Ne(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||it((qt=navigator.userAgent)!=null?qt:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),D=async()=>{for(let x=0;;x++){if(se||!d())return;let I=pe(5e3);try{let C=await fetch(`${v}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(R),headers:P,signal:I.signal});if(C.status===402){console.warn("[SentientUI] Session limit exceeded for this project. The bandit will stop learning until the limit resets. Upgrade at sentient-ui.com/pricing");return}if(C.ok||Ae(C)==="dropped")return}catch(C){}finally{I.clear()}if(x>=qo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(C=>setTimeout(C,Se(x+1)))}};try{he=D()}catch(x){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:b});let jn=Xo(),we=null,bt=!1,q={goal(l,g={},w=1,R=0){var z,G,Y,ne,Z,Q,A;let D=o.getSessionId();if(!D||se||!d())return;let x=zo(g)?g:{metadata:g},I=[l,(z=x.externalId)!=null?z:"",(G=x.stepIndex)!=null?G:R,(Y=x.weight)!=null?Y:w].join("\0"),C=x.value!==void 0?`${x.value}\0${(ne=x.currency)!=null?ne:""}`:null;if(jn.firedBefore(I,C)){e.debug&&console.log(`[sentient] goal("${l}") already recorded for this action \u2014 not sent twice`);return}let U=It(),M={sessionId:D,name:l,metadata:(Z=x.metadata)!=null?Z:{},weight:(Q=x.weight)!=null?Q:w,stepIndex:(A=x.stepIndex)!=null?A:R,goalId:U,value:x.value,currency:x.currency,externalId:x.externalId};e.debug&&console.log("[sentient] goal",M);let F={id:U,body:JSON.stringify(M)};he.then(()=>K.send(F))},componentGoal(l,g,w){var U,M,F;let R=o.getSessionId();if(!R||se||!d())return;let D=y.get(l,H),x=D?null:(U=E.get(l))!=null?U:null;if(!D&&x===null){e.debug&&console.warn(`[sentient] componentGoal("${l}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!D&&!m.has(l)){e.debug&&console.warn(`[sentient] componentGoal("${l}"): slot not decided this session \u2014 not attributed`);return}let I=D?D.variantId:at(x),C={id:It(),sessionId:R,projectId:e.apiKey,componentId:l,variantId:I,eventType:"goal_achieved",goalType:g,payload:T({reward:(M=w==null?void 0:w.reward)!=null?M:1,goalValue:w==null?void 0:w.value,currency:w==null?void 0:w.currency},(F=w==null?void 0:w.metadata)!=null?F:{}),timestamp:Date.now(),timeInSession:Date.now()-u,path:gt()};e.debug&&console.log("[sentient] componentGoal",C),he.then(()=>{!se&&d()&&b.push(C)})},identify(l,g){let w=o.getSessionId();!w||se||!d()||he.then(()=>{fetch(`${v}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:w,userId:l,userHash:g==null?void 0:g.userHash,ephemeral:o.isEphemeral()}),headers:P}).catch(()=>{})})},track(l){let g=o.getSessionId();if(!g||se||!d()||l.eventType==="variant_assigned"&&E.get(l.componentId)!==void 0&&!m.has(l.componentId)&&!y.get(l.componentId,H))return;let w=oe(T({path:gt()},l),{id:It(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-u});e.debug&&console.log("[sentient] track",w),he.then(()=>b.push(w))},getAssignment(l,g){return y.get(l,g)},isUnified:l=>S.has(l),async assign(l,g,w,R,D){var U;let x=o.getSessionId();if(!x)return null;let I=(D==null?void 0:D.unified)===!0;if(I&&S.has(l))return{variantId:(U=g==null?void 0:g[0])!=null?U:"",assignmentTtlMs:0,unified:!0};let C=y.get(l,H);if(C&&(g!=null&&g.length||C.content!==void 0)){let M=C.ttlMs&&C.ttlMs>0?Math.max(0,C.assignedAt+C.ttlMs-Date.now()):0;return{variantId:C.variantId,assignmentTtlMs:M,content:C.content}}return At(f,I?`${l}\0unified`:l,async()=>{if(!await vt(he,2500)||se||!d())return null;let M=pe(3e4);try{let F={sessionId:x,componentId:l,variantIds:g};R!==void 0?F.agentDataByVariant=R:w!==void 0&&(F.agentData=w),I&&(F.caps={unified:!0});let z=await fetch(`${v}/assign`,{method:"POST",body:JSON.stringify(F),headers:P,signal:M.signal});if(!z.ok)return null;let G=await z.json();return G.unified===!0?I?(S.add(l),{variantId:G.variantId,assignmentTtlMs:0,unified:!0}):null:(y.set(l,H,T({variantId:G.variantId,assignedAt:Date.now(),segment:H,confidence:1,content:G.content},G.assignmentTtlMs&&G.assignmentTtlMs>0?{ttlMs:G.assignmentTtlMs}:{})),G)}catch(F){return null}finally{M.clear()}})},async decide(l){var x,I;let g=o.getSessionId();if(!g)return null;let w=(x=l.slots)!=null?x:[],R={sessionId:g};l.sections&&l.sections.length>0&&(R.sections=l.sections.map(C=>({id:C}))),R.components=(I=l.components)!=null?I:[],w.length>0&&(R.slots=w.map(je)),l.slotsFrom==="registry"&&(R.slotsFrom="registry",l.registrySlotIds&&(R.registrySlotIds=l.registrySlotIds),l.bootstrap===!1&&(R.bootstrap=!1),l.render&&Object.keys(l.render).length>0&&(R.render=l.render)),l.v&&(R.v=l.v),typeof l.pp=="number"&&(R.pp=l.pp),e.persona&&(R.persona=e.persona);let D=JSON.stringify(R);return At(h,D,async()=>{var U,M,F,z,G,Y,ne,Z;if(!await vt(he,2500)||se||!d())return ht(w),null;let C=pe(3e4);try{let Q=await fetch(`${v}/decide`,{method:"POST",body:D,headers:P,signal:C.signal});if(!Q.ok)return ht(w),null;let A=await Q.json(),de=ct(A.stage,e.stageAttributes);e.stageAttributes&&dt(de);let Ie={};for(let j of w){let ue=(U=A.slots)==null?void 0:U[j.id];if(ue!==void 0){Ie[j.id]=ue,E.set(j.id,ue),m.add(j.id);continue}let Xt=E.get(j.id);if(Xt!==void 0)Ie[j.id]=Xt;else{let Qt=Le(j);Ie[j.id]=Qt,E.set(j.id,Qt)}}if(A.slots)for(let[j,ue]of Object.entries(A.slots))j in Ie||(Ie[j]=ue,E.set(j,ue),m.add(j));let Wn=N!=null&&N.persona!=="unknown";A.persona&&!(A.persona==="unknown"&&Wn)?N={persona:A.persona,confidence:(M=A.confidence)!=null?M:0}:N||(N={persona:"unknown",confidence:0});for(let[j,ue]of Object.entries((F=A.assignments)!=null?F:{}))y.set(j,H,{variantId:ue,assignedAt:Date.now(),segment:H,confidence:1});if(A.slotConfig)for(let[j,ue]of Object.entries(A.slotConfig))_.set(j,ue);A.palette&&($=A.palette),A.vocabulary&&(V=A.vocabulary);for(let j of(z=l.registrySlotIds)!=null?z:[])(G=A.slotConfig)!=null&&G[j]||(_.delete(j),E.delete(j),m.delete(j));return d()&&Te(e.apiKey,T(T(T(T({v:1,persona:N.persona,band:(0,Tt.confidenceBand)(N.confidence),slots:Object.fromEntries(E),layoutOrder:(Y=A.layoutOrder)!=null?Y:null,savedAt:Date.now()},_.size>0?{slotConfig:Object.fromEntries(_)}:{}),$?{palette:$}:{}),V?{vocabulary:V}:{}),de?{stage:de}:{})),T(T(T(T(T(T(T({layoutOrder:(ne=A.layoutOrder)!=null?ne:null,assignments:(Z=A.assignments)!=null?Z:{},slots:Ie,persona:N.persona,confidence:N.confidence},A.slotConfig?{slotConfig:A.slotConfig}:{}),A.goals?{goals:A.goals}:{}),A.sectionMap?{sectionMap:A.sectionMap}:{}),A.palette?{palette:A.palette}:{}),A.vocabulary?{vocabulary:A.vocabulary}:{}),A.stage?{stage:A.stage}:{}),A.context?{context:A.context}:{})}catch(Q){return ht(w),null}finally{C.clear()}})},getSlotResult(l){var g;return(g=E.get(l))!=null?g:null},isSlotDecided(l){return m.has(l)},getSlotConfig(l){var g;return(g=_.get(l))!=null?g:null},reportSlots(l,g,w,R){var x;let D={};for(let[I,C]of Object.entries(R!=null?R:{}))for(let U of C){let M=`${I}|${U.key}`;!re.test(I)||te.has(M)||(te.add(M),((x=D[I])!=null?x:D[I]=[]).push(U))}Object.keys(D).length>0&&fetch(`${v}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify({slotIds:Object.keys(D),authoredArms:D})}).catch(()=>{});for(let I of l)if(!(typeof I!="string"||I.length===0)){if(!re.test(I)){Vo()&&!ke.has(I)&&(ke.add(I),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(I)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!ee.has(I)){ee.add(I),ae.add(I);let C=g==null?void 0:g[I];if(typeof C=="string"){let M=C.replace(/\s+/g," ").trim().slice(0,400);M!==""&&k.set(I,M)}let U=w==null?void 0:w[I];U!==void 0&&B.set(I,U)}}ae.size===0||xe!=null||(xe=setTimeout(()=>{xe=null;let I=[...ae];ae.clear();for(let C=0;C<I.length;C+=20){let U=I.slice(C,C+20),M={},F={};for(let z of U){let G=k.get(z);G!==void 0&&(M[z]=G,k.delete(z));let Y=B.get(z);Y!==void 0&&(F[z]=Y,B.delete(z))}fetch(`${v}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify(T(oe(T(T({slotIds:U},Object.keys(M).length>0?{baselineTexts:M}:{}),Object.keys(F).length>0?{baselineSkeletons:F}:{}),{pagePaths:Object.fromEntries(U.map(z=>[z,location.pathname]))}),Object.keys(M).length>0&&o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(l,g){!re.test(l)||fe.has(l)||(fe.add(l),fetch(`${v}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify({slotIds:[l],baselineSkeletons:{[l]:g}})}).catch(()=>{}))},reportAgentData(l,g,w){let R=`${l}|${g}`;!re.test(l)||Ee.has(R)||(Ee.add(R),fetch(`${v}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify(T(T({slotIds:[l],agentData:{[l]:{[g]:w}}},g.startsWith("authored.")?{authoredArms:{[l]:[{key:g.slice(9)}]}}:{}),o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{}))},reportDrift(l,g,w,R){let D=`${l}|${g}`,x=o.getSessionId();!x||ve.has(D)||(ve.add(D),fetch(`${v}/slots/drift`,{method:"POST",headers:P,body:JSON.stringify({sessionId:x,reports:[{slotId:l,expectedFp:g,observedFp:w,reason:R}]})}).catch(()=>{}))},requestSlots(l,g,w){var R,D;for(let x of l)ze.has(x)||(ze.add(x),re.test(x)?Be.set(x,{text:g==null?void 0:g[x],render:(R=w==null?void 0:w.render)==null?void 0:R[x],skeleton:(D=w==null?void 0:w.skeletons)==null?void 0:D[x]}):q.reportSlots([x]));Be.size===0||yt!=null||(yt=setTimeout(()=>{yt=null;let x=[...Be];Be.clear();for(let I=0;I<x.length;I+=50){let C=x.slice(I,I+50),U={};for(let[M,F]of C)F.render&&(U[M]=F.render);q.decide({slotsFrom:"registry",registrySlotIds:C.map(([M])=>M),bootstrap:!1,render:U}).then(M=>{var F,z;if(M){let G={},Y={},ne=[];for(let[Z,Q]of C){let A=(F=M.slotConfig)==null?void 0:F[Z];if(A){A.needsSkeleton&&Q.skeleton&&((z=q.reportSkeleton)==null||z.call(q,Z,Q.skeleton));continue}ne.push(Z),Q.text&&(G[Z]=Q.text),Q.skeleton&&(Y[Z]=Q.skeleton)}ne.length>0&&q.reportSlots(ne,G,Y)}else Mt(C.map(([G])=>G),ze,G=>{var Q;let Y={},ne={},Z={};for(let[A,de]of C)G.has(A)&&(de.text&&(Y[A]=de.text),de.render&&(ne[A]=de.render),de.skeleton&&(Z[A]=de.skeleton));(Q=q.requestSlots)==null||Q.call(q,[...G],Y,{render:ne,skeletons:Z})});le.forEach(G=>G())})}},0))},decideSlots(l){for(let g of l)qe.has(g.id)||(qe.add(g.id),Ge.set(g.id,g));Ge.size===0||St!=null||(St=setTimeout(()=>{St=null;let g=[...Ge.values()];Ge.clear();for(let w=0;w<g.length;w+=30){let R=g.slice(w,w+30);q.decide({slots:R}).then(D=>{D||Mt(R.map(x=>x.id),qe,x=>{var I;return(I=q.decideSlots)==null?void 0:I.call(q,R.filter(C=>x.has(C.id)))}),le.forEach(x=>x())})}},0))},cancelSlots(l){for(let g of l)Be.delete(g)&&ze.delete(g),Ge.delete(g)&&qe.delete(g)},onSlotsChanged(l){return le.add(l),()=>{le.delete(l)}},getStyleVocabulary(){return V},getSitePalette(){return $},getVisitorId:()=>d()?o.getSessionId():null,getPersona(){return N?{persona:N.persona,confidence:N.confidence,band:(0,Tt.confidenceBand)(N.confidence)}:null},async fetchWeights(){var g;let l=pe(5e3);try{let w=await fetch(`${v}/weights`,{headers:P,signal:l.signal});return w.ok?(g=(await w.json()).components)!=null?g:[]:[]}catch(w){return[]}finally{l.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){b.flush(),K.flush()},dispose(){var l;we==null||we(),bt=!0,se=!0,b.destroy(),K.destroy(),((l=J.get(e.apiKey))==null?void 0:l.dispose)===q.dispose&&J.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var l;we==null||we(),bt=!0,se=!0,a=!0,Qe(e.apiKey),b.destroy({forget:!0}),K.destroy({forget:!0}),o.destroy(),y.clear(),((l=J.get(e.apiKey))==null?void 0:l.dispose)===q.dispose&&J.delete(e.apiKey);try{localStorage.removeItem(ye+e.apiKey),localStorage.removeItem(Ue(e.apiKey)),localStorage.removeItem(Fe(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${ie(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(g){}e.debug&&console.log("[sentient] destroyed")}};if(J.set(e.apiKey,{config:e,upgrade:null,dispose:q.dispose}),we=Qo(q,e.apiKey,l=>{he.then(()=>{bt||Tn.add(l)})}),e.debug){let l=window;l.__sentient&&(l.__sentient.client=q)}return q}var Rn="_snt_graph_edges",Zo={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function er(e){var t;return(t=Zo[e])!=null?t:[]}function tr(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function nr(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var or=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function rr(e){return or.has(e)?e:"generic"}function Rt(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function sr(e,t,n){let r=`${e}:${t}:${n.join(",")}`,i=5381;for(let s=0;s<r.length;s++)i=(i<<5)+i+r.charCodeAt(s)&4294967295;return(i>>>0).toString(16).padStart(8,"0")}function On(e){let t=new Map,n=new Map,r=`_snt_graph_nodes${ie(e==null?void 0:e.apiKey)}`,i=()=>{typeof window!="undefined"&&nr(r,[...t.values()])};if(typeof window!="undefined"){let s=tr(r,[]);for(let u of s)t.set(u.componentId,u);try{localStorage.removeItem(Rn)}catch(u){}}return{addPageNode(s){t.set(s.componentId,s),i()},addStructuralEdge(s){let u=`${s.fromComponentId}->${s.toComponentId}`;n.set(u,s)},syncOnce(){var u,o;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let s=[...t.values()];if(s.length!==0)try{let p=new Map;for(let y of s){let b=(u=p.get(y.semanticType))!=null?u:[];b.push(y),p.set(y.semanticType,b)}let a=[],c=new Set;for(let y of s)for(let b of er(y.semanticType)){let v=(o=p.get(b))!=null?o:[];for(let P of v){if(P.componentId===y.componentId)continue;let O=`semantic:${y.componentId}->${P.componentId}`;c.has(O)||(c.add(O),a.push({fromComponentId:y.componentId,toComponentId:P.componentId,type:"semantic",weight:.4,confidence:.9}))}}let d=new Set(s.map(y=>y.componentId));for(let y of n.values()){if(!d.has(y.fromComponentId)||!d.has(y.toComponentId))continue;let b=`structural:${y.fromComponentId}->${y.toComponentId}`;c.has(b)||(c.add(b),a.push({fromComponentId:y.fromComponentId,toComponentId:y.toComponentId,type:"structural",weight:y.weight,confidence:1}))}let S=oe(T(T({pageUrl:Rt(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:s.map(y=>{let b=rr(y.semanticType);return{componentId:y.componentId,semanticType:b,answers:y.answers,contentHash:sr(y.componentId,b,y.answers),prominenceScore:y.prominenceScore,depthInPage:y.depth}}),edges:a});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:T({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(S)}).catch(()=>{})}catch(p){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(r),localStorage.removeItem(Rn)}catch(s){}}}}var ir=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Ot(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function ar(e){return{tag:e.tagName.toLowerCase(),text:Ot(e).slice(0,40)}}function Pn(e){return e.replace(/["\\\]]/g,"\\$&")}function Ve(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Dn(e,t){var u;let n=e.tagName.toLowerCase();if(!n)return null;let r=((u=e.getAttribute("class"))!=null?u:"").split(/\s+/).filter(o=>/^[a-zA-Z][\w-]*$/.test(o)),i=[n,...r.map(o=>`${n}.${o}`)];for(let o of i)if(Ve(t,o))return o;let s=e.parentElement;if(s&&s!==t){let o=Dn(s,t);if(o){for(let d of i){let S=`${o} > ${d}`;if(Ve(t,S))return S}let p=Array.from(s.children).filter(d=>d.tagName.toLowerCase()===n),a=p.indexOf(e),c=p.some(d=>d!==e&&Ot(d)!==Ot(e));if(a>=0&&c){let d=`${o} > ${n}:nth-of-type(${a+1})`;if(Ve(t,d))return d}}}return null}function ft(e,t){let n=ar(e),r=e.getAttribute("id");if(r&&Ve(t,`#${Pn(r)}`))return{v:1,id:r,fingerprint:n};for(let s of ir){let u=e.getAttribute(s);if(u&&Ve(t,`[${s}="${Pn(u)}"]`))return{v:1,dataAttr:{name:s,value:u},fingerprint:n}}let i=Dn(e,t);return i?{v:1,selector:i,fingerprint:n}:null}var Mn=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],lr={banner:"hero",navigation:"navigation",contentinfo:"footer"};function cr(e){let t=e.ariaRole?lr[e.ariaRole.toLowerCase()]:void 0;if(t)return t;if(e.tag==="nav")return"navigation";if(e.tag==="footer")return"footer";if(e.tag==="header")return e.actionCount>=5?"navigation":"hero";let n=`${e.idClass} ${e.headingText}`.toLowerCase();return/\b(navbar|nav-bar|navigation|site-nav|main-nav|topbar|footer)\b/.test(n)?/footer/.test(n)?"footer":"navigation":/\b(hero|masthead|jumbotron)\b/i.test(e.idClass)?"hero":null}function dr(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var ur=[["pricing",/\b(pricing|price list|per month|\/mo|subscriptions?)\b|\bplans?\b(?=[^.]{0,40}(from|start|month|year|[$€£]))/i],["faq",/\bfaq\b|frequently asked|common questions?/i],["comparison",/\b(compare|comparison|versus)\b|\bvs\./i],["social_proof",/\b(reviews?|ratings?|testimonial|brands?|galler(y|ies)|logos)\b|trusted by|loved by|case stud|what our customers say/i],["trust",/\b(insurance|warrant(y|ies)|guarantees?|certifi|accredit|security|privacy|compliance|gdpr|encrypt)\b|why choose|about us|our team/i],["cta",/\b(book|booking|reserve|appointments?|newsletter|subscribe)\b|contact us|get in touch|opening hours/i],["features",/\b(features?|benefits?|capabilit|services?|repairs?|menus?|products?)\b|how it works|our process|what we (do|offer)|what you get/i]],pr=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|free returns?|returns? within|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]],Nn={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function gr(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function fr(e){var i,s;let t=cr(e);if(t)return{type:(i=Nn[t])!=null?i:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[u,o]of ur)if(o.test(n))return{type:u,strength:"strong"};for(let[u,o]of pr)if(o.test(e.bodyText))return{type:u,strength:"strong"};let r=dr(e);return{type:(s=Nn[r])!=null?s:"generic",strength:"weak"}}function mr(e){var r,i;let t=((r=e.textContent)!=null?r:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return T({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((i=e.className)!=null?i:"")}`,headingText:gr(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function Ln(e){return fr(mr(e)).type}var yr=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),Sr=200,hr="h1, h2, h3",br="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",Bn=30,vr=1500,wr={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function Gn(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function Er(e){var t,n,r;try{let i=e;for(let s of Object.keys(i)){if(!s.startsWith("__reactFiber")&&!s.startsWith("__reactInternalInstance"))continue;let u=i[s],o=(r=(t=u==null?void 0:u.type)==null?void 0:t.displayName)!=null?r:(n=u==null?void 0:u.type)==null?void 0:n.name;if(o&&o.length>1)return o}}catch(i){}}function xr(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var Pt=new Set(Mn);function kr(e,t){let n=e.getAttribute("data-sentient-id"),r=n?t==null?void 0:t[n]:void 0;if(r&&Pt.has(r))return r;let i=e.getAttribute("data-sentient-type");if(i&&Pt.has(i))return i;let s=e.getAttribute("role");return s&&Pt.has(s)?s:Ln(e)}function Ir(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)&4294967295;return(t>>>0).toString(16).padStart(8,"0")}function Cr(e){let t=[],n=e;for(;n;){let r=n.parentElement;if(!r){t.push(n.tagName.toLowerCase());break}let i=Array.prototype.indexOf.call(r.children,n);t.push(`${n.tagName.toLowerCase()}[${i}]`),n=r}return t.reverse().join("/")}function Tr(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${Ir(Cr(e))}`}function Ar(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function Dt(e,t,n){var i,s,u,o;let r=e.querySelector(hr);return{componentId:Tr(e),semanticType:kr(e,n),ariaLabel:(i=e.getAttribute("aria-label"))!=null?i:void 0,headingText:(u=(s=r==null?void 0:r.textContent)==null?void 0:s.trim())!=null?u:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:Ar(e),reactComponentName:Er(e),dataAttributes:xr(e),locator:(o=ft(e,e.ownerDocument))!=null?o:void 0}}function Kn(e){var s;let t=[],n=new Set,r="__root__",i=new Map;for(let[u,o]of e){let p=u.parentElement,a=r;for(;p;){if(e.has(p)){a=e.get(p);let d=e.get(u),S=`${a}->${d}`;!n.has(S)&&a!==d&&(n.add(S),t.push({fromComponentId:a,toComponentId:d,weight:.6}));break}p=p.parentElement}let c=(s=i.get(a))!=null?s:[];c.push(u),i.set(a,c)}for(let u of i.values()){if(u.length<2)continue;let o=u.length>Bn?u.slice(0,Bn):u;for(let p=0;p<o.length;p++)for(let a=p+1;a<o.length;a++){if(t.length>=vr)return t;let c=e.get(o[p]),d=e.get(o[a]);if(c===d)continue;let S=`${c}->${d}::sib`,y=`${d}->${c}::sib`;n.has(S)||(n.add(S),t.push({fromComponentId:c,toComponentId:d,weight:.3})),n.has(y)||(n.add(y),t.push({fromComponentId:d,toComponentId:c,weight:.3}))}}return t}function _r(e,t){let n=[],r=new Set,i=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(o=>{if(o instanceof Element&&!r.has(o)){r.add(o);let p=Dt(o,e,t);n.push(p),i.set(o,p.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(o=>{if(!(o instanceof Element)||r.has(o))return;let p=o.hasAttribute("aria-label"),a=o.hasAttribute("data-sentient-id");if(!p&&!a)return;r.add(o);let c=Dt(o,e,t);n.push(c),i.set(o,c.componentId)}),{nodes:n,edges:Kn(i),elementToId:i}}function $n(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return wr;let n=null,r=0,i=null,s=new Map,u=y=>{try{let b=window.getComputedStyle(y),v=parseFloat(b.fontSize)||12,P=parseFloat(b.zIndex)||0,O=y.getBoundingClientRect(),K=Math.max(O.top,0),L=window.innerHeight||1,W=1/(K/L+1),X=Gn(v,12,48)*.4+W*.4+Gn(P,0,100)*.2;return Math.max(0,Math.min(1,X))}catch(b){return .5}},o=()=>new Promise(y=>{let b=()=>{let{nodes:v,edges:P,elementToId:O}=_r(u,t);s.clear();for(let[K,L]of O)s.set(K,L);y({nodes:v,edges:P,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?r=requestIdleCallback(b,{timeout:100}):b()}catch(v){b()}}),p=new Set,a=null,c=()=>{a=null;let y=[...p];p.clear();let b=[],v=new Set;for(let O of y){if(!O.isConnected)continue;let K=[];yr.has(O.tagName)&&(O.hasAttribute("data-sentient-id")||O.hasAttribute("aria-label"))&&K.push(O);try{O.querySelectorAll(br).forEach(L=>K.push(L))}catch(L){}for(let L of K){if(s.has(L))continue;let W=Dt(L,u,t);b.push(W),v.add(W.componentId),s.set(L,W.componentId)}}if(b.length===0||!i)return;for(let O of[...s.keys()])O.isConnected||s.delete(O);let P=Kn(s).filter(O=>v.has(O.fromComponentId)||v.has(O.toComponentId));i({nodes:b,edges:P,addedAt:Date.now()})};return{scan:o,observe:y=>{i=y;try{n=new MutationObserver(b=>{for(let v of b)v.type==="childList"&&v.addedNodes.forEach(P=>{P instanceof Element&&p.add(P)});p.size>0&&a===null&&(a=setTimeout(c,Sr))}),n.observe(document.body,{childList:!0,subtree:!0})}catch(b){}},getProminenceScore:u,destroy:()=>{if(n&&(n.disconnect(),n=null),a!==null&&clearTimeout(a),a=null,p.clear(),r&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(r)}catch(y){}r=0,i=null,s.clear()}}}var Rr="https://api.sentient-ui.com/v1/events";function Or(e){var n;let t=r=>{try{let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}catch(i){return}};return(n=e?t(be(e)):void 0)!=null?n:t(ge)}var mt=new Map;function Un(e){var y;let t=_t(e),n=e.respectDoNotTrack!==!1&&He(),r=e.consent===!1||n,i=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),s=e.localMode===!0||!i;if(!e.graph||s||typeof window=="undefined")return t;if(r)return n||Cn(e.apiKey,b=>Un(b)),t;let u=mt.get(e.apiKey);if(u)try{u()}catch(b){}let o=$n({sectionTypes:e.sectionTypes}),p=(y=e.ingestUrl)!=null?y:Rr,a=On({syncUrl:p.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:Or(e.apiKey)});o.scan().then(b=>{for(let v of b.nodes)a.addPageNode({id:v.componentId,componentId:v.componentId,semanticType:v.semanticType,answers:e.captureDomText&&v.headingText?[v.headingText]:[],prominenceScore:v.prominenceScore,depth:v.depth});for(let v of b.edges)a.addStructuralEdge(v);a.syncOnce()});let c=null,d=()=>{c!==null&&clearTimeout(c),c=setTimeout(()=>{c=null,a.syncOnce()},500)};o.observe(b=>{for(let v of b.nodes)a.addPageNode({id:v.componentId,componentId:v.componentId,semanticType:v.semanticType,answers:e.captureDomText&&v.headingText?[v.headingText]:[],prominenceScore:v.prominenceScore,depth:v.depth});for(let v of b.edges)a.addStructuralEdge(v);d()});let S=()=>{c!==null&&(clearTimeout(c),c=null),o.destroy(),a.destroy(),mt.get(e.apiKey)===S&&mt.delete(e.apiKey)};return mt.set(e.apiKey,S),oe(T({},t),{getGraph:()=>a.snapshot(),dispose:()=>{S(),t.dispose()},destroy:()=>{S(),t.destroy()}})}0&&(module.exports={BLOCK_ALIGNS,BLOCK_EMPHASES,BLOCK_FITS,BLOCK_GAPS,BLOCK_GRID_COLUMNS,BLOCK_HEADING_LEVELS,BLOCK_JUSTIFIES,BLOCK_MAX_WIDTHS,BLOCK_PADS,BLOCK_RATIOS,BLOCK_SIZES,BLOCK_SURFACES,BLOCK_TEXT_ALIGNS,BLOCK_TONES,BLOCK_WEIGHTS,FORM_FIELD_KINDS,FORM_INPUT_TYPES,LEGACY_SESSION_COOKIE_NAME,MAX_BLOCK_ARMS,MAX_BLOCK_CHILDREN,MAX_BLOCK_DEPTH,MAX_BLOCK_NODES,MAX_BLOCK_TEXT_LEN,MAX_FORM_FIELDS,MAX_FORM_SELECT_OPTIONS,SNAPSHOT_STORAGE_KEY_PREFIX,STAGE_ATTRIBUTE,armOfResult,attachMicroSignalDetectors,baselineResultFor,baselineSlots,containsFormBlock,deriveSessionSegment,detectDeviceClass,detectTimeOfDay,detectTrafficSource,exposedStage,grantConsent,init,isDoNotTrackEnabled,locatorFromElement,readSnapshot,referrerDomainFromReferer,renderPrePaintScript,sanitizePageUrl,sessionCookieName,setStageAttribute,toWireSlot,writeSnapshot});
|
|
1
|
+
"use strict";var zn=Object.create;var Ke=Object.defineProperty,qn=Object.defineProperties,Xn=Object.getOwnPropertyDescriptor,Qn=Object.getOwnPropertyDescriptors,Jn=Object.getOwnPropertyNames,Yt=Object.getOwnPropertySymbols,Yn=Object.getPrototypeOf,en=Object.prototype.hasOwnProperty,Zn=Object.prototype.propertyIsEnumerable;var Zt=(e,t,n)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t)=>{for(var n in t||(t={}))en.call(t,n)&&Zt(e,n,t[n]);if(Yt)for(var n of Yt(t))Zn.call(t,n)&&Zt(e,n,t[n]);return e},oe=(e,t)=>qn(e,Qn(t));var eo=(e,t)=>{for(var n in t)Ke(e,n,{get:t[n],enumerable:!0})},tn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of Jn(t))!en.call(e,i)&&i!==n&&Ke(e,i,{get:()=>t[i],enumerable:!(r=Xn(t,i))||r.enumerable});return e};var to=(e,t,n)=>(n=e!=null?zn(Yn(e)):{},tn(t||!e||!e.__esModule?Ke(n,"default",{value:e,enumerable:!0}):n,e)),no=e=>tn(Ke({},"__esModule",{value:!0}),e);var Nr={};eo(Nr,{BLOCK_ALIGNS:()=>Io,BLOCK_EMPHASES:()=>Ro,BLOCK_FITS:()=>Do,BLOCK_GAPS:()=>ko,BLOCK_GRID_COLUMNS:()=>No,BLOCK_HEADING_LEVELS:()=>Mo,BLOCK_JUSTIFIES:()=>Co,BLOCK_MAX_WIDTHS:()=>Go,BLOCK_PADS:()=>Bo,BLOCK_RATIOS:()=>Po,BLOCK_SIZES:()=>To,BLOCK_SURFACES:()=>Lo,BLOCK_TEXT_ALIGNS:()=>Oo,BLOCK_TONES:()=>_o,BLOCK_WEIGHTS:()=>Ao,FORM_FIELD_KINDS:()=>Ko,FORM_INPUT_TYPES:()=>$o,LEGACY_SESSION_COOKIE_NAME:()=>ge,MAX_BLOCK_ARMS:()=>Vo,MAX_BLOCK_CHILDREN:()=>Ho,MAX_BLOCK_DEPTH:()=>Wo,MAX_BLOCK_NODES:()=>jo,MAX_BLOCK_TEXT_LEN:()=>zo,MAX_FORM_FIELDS:()=>Uo,MAX_FORM_SELECT_OPTIONS:()=>Fo,SNAPSHOT_STORAGE_KEY_PREFIX:()=>ye,STAGE_ATTRIBUTE:()=>lt,armOfResult:()=>at,attachMicroSignalDetectors:()=>En,baselineResultFor:()=>Le,baselineSlots:()=>yn,containsFormBlock:()=>wn,deriveSessionSegment:()=>It,detectDeviceClass:()=>Oe,detectTimeOfDay:()=>Ne,detectTrafficSource:()=>Pe,exposedStage:()=>ct,grantConsent:()=>On,init:()=>jn,isDoNotTrackEnabled:()=>He,locatorFromElement:()=>ft,readSnapshot:()=>Ce,referrerDomainFromReferer:()=>De,renderPrePaintScript:()=>on,sanitizePageUrl:()=>Ot,sessionCookieName:()=>be,setStageAttribute:()=>dt,toWireSlot:()=>je,writeSnapshot:()=>Te});module.exports=no(Nr);function pe(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function vt(e,t){return new Promise(n=>{let r=setTimeout(()=>n(!1),t),i=()=>{clearTimeout(r),n(!0)};e.then(i,i)})}var oo;function nn(e){oo=typeof e=="string"&&e!==""?e:void 0}function ie(e){return e?`_${e.slice(0,12)}`:""}var ge="_snt_uid";function be(e){return`${ge}${ie(e)}`}var Xe="__sntForgetGen",ro=()=>{try{return window[Xe]}catch(e){return}};function Qe(e){var t,n;try{let r=window,i=(t=r[Xe])!=null?t:r[Xe]={};i[e]=((n=i[e])!=null?n:0)+1}catch(r){}}function me(e){var t,n;return(n=(t=ro())==null?void 0:t[e])!=null?n:0}var ye="_snt_snap:";var so=["low","medium","high"];function Ce(e){try{let t=localStorage.getItem(ye+e);if(!t)return null;let n=JSON.parse(t);if(!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!so.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(Date.now()-n.savedAt<2592e6)||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig)))return null;let r=n.vocabulary;return r!==void 0&&(typeof r!="object"||r===null||!Array.isArray(r.entries)||!Array.isArray(r.images))&&delete n.vocabulary,n.stage!==void 0&&typeof n.stage!="string"&&delete n.stage,n}catch(t){return null}}function Te(e,t){try{localStorage.setItem(ye+e,JSON.stringify(t))}catch(n){}}function on(e,t){return'(function(){try{var N=navigator,W=window;if(N.doNotTrack=="1"||N.doNotTrack=="yes"||W.doNotTrack=="1"||N.msDoNotTrack=="1"||N.globalPrivacyControl)return;var r=localStorage.getItem('+JSON.stringify(ye+e).replace(/</g,"\\u003c")+');if(!r)return;var s=JSON.parse(r);if(!s||s.v!==1||typeof s.persona!=="string"||typeof s.band!=="string")return;if(!('+2592e6+">Date.now()-s.savedAt))return;var d=document.documentElement;"+(t!=null&&t.stage?'if(typeof s.stage=="string"&&!d.hasAttribute("data-sentient-stage"))d.setAttribute("data-sentient-stage",s.stage);':"")+'if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",s.persona);d.setAttribute("data-sentient-confidence",s.band);}catch(e){}})();'}function Se(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Ae(e){if(e.ok===!0)return"delivered";let{status:t}=e;return typeof t!="number"?"retry":t>=200&&t<300?"delivered":t>=400&&t<500&&t!==429?"dropped":"retry"}function Je(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?(localStorage.removeItem(e),r.slice(-t)):[]}catch(n){return[]}}function $e(e,t,n){try{let r=(()=>{try{let s=localStorage.getItem(n);if(!s)return[];let u=JSON.parse(s);return Array.isArray(u)?u:[]}catch(s){return[]}})(),i=new Map;for(let s of r)i.set(s.id,s);for(let s of e)i.set(s.id,s);localStorage.setItem(n,JSON.stringify([...i.values()].slice(-t)))}catch(r){}}function Ye(e,t){try{let n=localStorage.getItem(t);if(!n)return;let r=JSON.parse(n);if(!Array.isArray(r))return;let i=new Set(e),s=r.filter(u=>!i.has(u.id));if(s.length===r.length)return;s.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(s))}catch(n){}}var io=500,ao=56*1024;function Ue(e){return`_snt_retry_${e.slice(0,12)}`}var lo={push:()=>{},flush:()=>{},destroy:()=>{}};function rn(e){var N,ee,ae;if(typeof window=="undefined")return lo;let t=(N=e.flushIntervalMs)!=null?N:5e3,n=(ee=e.maxBatchSize)!=null?ee:20,r=(ae=e.maxRetrySize)!=null?ae:100,i=e.ingestUrl,s=e.apiKey,u=Ue(s),o=!1,p=me(s),a=(...k)=>{!o&&me(s)===p&&$e(...k)},c=[],d=new Set,S=[],m=k=>{for(let B of k)b.delete(B),!d.has(B)&&(d.add(B),S.push(B));for(;S.length>io;){let B=S.shift();B&&d.delete(B)}Ye(k,u)},b=new Set,v=()=>{for(;c.length>r;){let k=c.shift();k&&b.delete(k.id)}},P=k=>{d.has(k.id)||b.has(k.id)||(b.add(k.id),c.push(k),v())},O=k=>{for(let B of k)d.has(B.id)||(b.add(B.id),c.push(B));v()},K=Je(u,r);for(let k of K)P(k);let L=0,W=0,X=(k,B=!0)=>{if(k.length===0)return;let fe=JSON.stringify(k),ve=k.map(re=>re.id),te,Ee=pe(15e3);try{te=fetch(i,{method:"POST",keepalive:!0,signal:Ee.signal,body:fe,headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})}catch(re){a(k,r,u),O(k),W++,L=Date.now()+Se(W);return}Promise.resolve(te).then(Ee.clear,Ee.clear);let xe=re=>{if(Ae(re)!=="retry"){if(!re.ok&&B){let ke=k.filter(le=>le.eventType!=="pageview");if(ke.length>0&&ke.length<k.length){m(k.filter(le=>le.eventType==="pageview").map(le=>le.id)),X(ke,!1);return}}m(ve),W=0,L=0;return}a(k,r,u),O(k),W++,L=Date.now()+Se(W)};te&&typeof te.then=="function"?te.then(xe).catch(()=>{a(k,r,u),O(k),W++,L=Date.now()+Se(W)}):xe(te)},H=typeof TextEncoder!="undefined"?new TextEncoder:null,f=k=>H?H.encode(k).length:k.length,h=k=>{let B=[],fe=2;for(let ve of k){let te=f(JSON.stringify(ve))+1;if(B.length>0&&fe+te>ao||B.length>=n)break;B.push(ve),fe+=te}return B},E=()=>{try{if(Date.now()<L)return;for(;c.length>0&&!(Date.now()<L);){let k=c.filter(fe=>!d.has(fe.id));if(c.length=0,k.length===0)break;let B=h(k);if(B.length===0)break;B.length<k.length&&c.push(...k.slice(B.length)),X(B)}}catch(k){}},y=!0,_=null;_=setInterval(()=>{y&&E()},t);let $=()=>{document.visibilityState==="hidden"&&E()},V=()=>{E()};return document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",V),{push(k){P(k),c.length>=n&&E()},flush:E,destroy(k){k!=null&&k.forget&&(o=!0),y=!1,_!==null&&(clearInterval(_),_=null),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",V),E()}}}var co=200;function Fe(e){return`_snt_goal_retry_${e.slice(0,12)}`}var uo={send:()=>{},flush:()=>{},destroy:()=>{}};function sn(e){var f,h,E;if(typeof window=="undefined")return uo;let t=(f=e.flushIntervalMs)!=null?f:5e3,n=(h=e.maxRetrySize)!=null?h:100,r=(E=e.maxPerFlush)!=null?E:5,i=Fe(e.apiKey),s=!1,u=me(e.apiKey),o=(...y)=>{!s&&me(e.apiKey)===u&&$e(...y)},p=[],a=new Set,c=new Set,d=[],S=0,m=0,b=!1,v=y=>{for(a.delete(y.id),c.has(y.id)||(c.add(y.id),d.push(y.id));d.length>co;){let _=d.shift();_&&c.delete(_)}Ye([y.id],i)},P=y=>{o([y],n,i),!c.has(y.id)&&!a.has(y.id)&&(a.add(y.id),p.push(y)),Date.now()>=S&&(m++,S=Date.now()+Se(m))},O=y=>{let _,$=pe(15e3);try{_=fetch(e.url,{method:"POST",keepalive:!0,signal:$.signal,body:y.body,headers:e.headers})}catch(N){P(y);return}let V=N=>{var ae;let ee=Ae(N);if(ee==="retry"){P(y);return}ee==="dropped"&&((ae=e.onDrop)==null||ae.call(e,y,N.status)),v(y),m=0,S=0};Promise.resolve(_).then($.clear,$.clear),_&&typeof _.then=="function"?_.then(V).catch(()=>P(y)):V(_)},K=()=>{try{if(b||Date.now()<S)return;let y=0;for(;p.length>0&&y<r&&!(Date.now()<S);){let _=p.shift();a.delete(_.id),!c.has(_.id)&&(y++,O(_))}}catch(y){}},L=Je(i,n);for(let y of L)a.has(y.id)||(a.add(y.id),p.push(y));L.length>0&&$e(L,n,i);let W=setInterval(K,t),X=()=>{document.visibilityState==="hidden"&&K()},H=()=>K();return document.addEventListener("visibilitychange",X),window.addEventListener("pagehide",H),{send(y){if(b){c.has(y.id)||o([y],n,i);return}if(!(c.has(y.id)||a.has(y.id))){if(Date.now()<S){o([y],n,i),a.add(y.id),p.push(y);return}O(y)}},flush:K,destroy(y){y!=null&&y.forget&&(s=!0),clearInterval(W),document.removeEventListener("visibilitychange",X),window.removeEventListener("pagehide",H),K(),b=!0}}}function Ze(e){let t=(e||"").toLowerCase();if(!t.includes(".")||/^[\d.]+$|:/.test(t))return[];let n=t.split("."),r=[];for(let i=n.length-2;i>=0;i--)r.push(n.slice(i).join("."));return r}function an(e){if(typeof window=="undefined"||!e)return!1;Qe(e);let t=!1,n=be(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let u=location.protocol==="https:"?"; Secure":"";for(let o of["",...Ze(location.hostname)])document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${o?`; domain=${o}`:""}${u}`;t=!0}}catch(u){}let r=ie(e),i=[n,"_snt_graph_edges",ye+e,Ue(e),Fe(e),`_snt_graph_nodes${r}`],s=[`_snt_asgn${r}_`];for(let u of["localStorage","sessionStorage"])try{let o=window[u];for(let p of i)o.getItem(p)!==null&&(o.removeItem(p),t=!0);for(let p=o.length-1;p>=0;p--){let a=o.key(p);a&&s.some(c=>a.startsWith(c))&&(o.removeItem(a),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${ge}=[^;]`).test(document.cookie)||localStorage.getItem(ge)!==null||sessionStorage.getItem(ge)!==null)&&localStorage.setItem(`${ge}_tomb${r}`,"1")}catch(u){}return t}function et(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"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 ln="_snt_uid",po=365,_e="_snt_uid";function go(){return et()}function Re(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function dn(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function ot(e,t,n,r){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${r?`; domain=${r}`:""}${dn()}`}catch(i){}}function tt(e){try{return localStorage.getItem(e)}catch(t){return null}}function cn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Et(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function fo(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function mo(e){try{sessionStorage.removeItem(e)}catch(t){}}function yo(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${dn()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function So(e){try{localStorage.removeItem(e)}catch(t){}}function nt(e,t){ot(e,"",0,t)}var ho={getSessionId:()=>null,isEphemeral:()=>!1,domain:null,destroy:()=>{}};function bo(e,t){if(e===!1)return null;if(typeof e=="string")return e.replace(/^\./,"");for(let n of Ze(location.hostname))if(ot(t,"1",10,n),Re(t)==="1")return nt(t,n),n;return null}function rt(e){var O,K,L,W,X,H,f;if(typeof window=="undefined")return ho;let t=ie(e==null?void 0:e.apiKey),n=(O=e==null?void 0:e.cookieName)!=null?O:be(e==null?void 0:e.apiKey),r=`${_e}${t}`,i=`${_e}_tomb${t}`,u=((K=e==null?void 0:e.cookieTTLDays)!=null?K:po)*24*60*60,o=h=>h&&h.length>0?h:null,p=()=>{var h,E;return t&&!(e!=null&&e.cookieName)&&tt(i)===null?(E=(h=o(Re(ln)))!=null?h:o(tt(_e)))!=null?E:o(Et(_e)):null},a=bo(e==null?void 0:e.cookieDomain,`${n}_dom`),c=o(Re(n)),d=a?(nt(n),o(Re(n))):null,S=(f=(H=(X=(W=(L=d!=null?d:c)!=null?L:o(tt(r)))!=null?W:o(Et(r)))!=null?X:p())!=null?H:o(e==null?void 0:e.ssrSessionId))!=null?f:go();ot(n,S,u,a),a&&Re(n)!==S&&(a=null,ot(n,S,u));let m=cn(r,S),b=yo(n),v=m?!1:fo(r,S),P=!m&&!b&&!v;return{getSessionId:()=>S,isEphemeral:()=>P,domain:a,destroy:()=>{S=null,nt(n),nt(n,a),So(r),mo(r),t&&!(e!=null&&e.cookieName)&&(Re(ln)!==null||tt(_e)!==null||Et(_e)!==null)&&cn(i,"1")}}}var vo=1800*1e3;function st(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function un(e=vo,t){let n=new Map,r=`_snt_asgn${ie(t)}_`,i=(a,c)=>`${r}${encodeURIComponent(a)}:${encodeURIComponent(c)}`,s=a=>{let c=a.slice(r.length),d=c.indexOf(":");if(d<0)return null;try{return{componentId:decodeURIComponent(c.slice(0,d)),segment:decodeURIComponent(c.slice(d+1))}}catch(S){return null}},u=()=>{try{let a=[];for(let c=0;c<localStorage.length;c++){let d=localStorage.key(c);d!=null&&d.startsWith(r)&&a.push(d)}return a}catch(a){return[]}},o=a=>a.assignedAt+(a.ttlMs&&a.ttlMs>0?a.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let a of u())try{let c=localStorage.getItem(a);if(!c)continue;let d=JSON.parse(c);if(o(d)){localStorage.removeItem(a);continue}let S=s(a);if(!S)continue;n.set(st(S.componentId,S.segment),d)}catch(c){}})(),{get(a,c){let d=n.get(st(a,c));return d?o(d)?(n.delete(st(a,c)),null):d:null},set(a,c,d){let S=st(a,c);n.set(S,d);try{localStorage.setItem(i(a,c),JSON.stringify(d))}catch(m){}},clear(){n.clear();for(let a of u())try{localStorage.removeItem(a)}catch(c){}}}}var pn=["GPTBot","ChatGPT-User","OAI-SearchBot","ClaudeBot","Claude-User","Claude-SearchBot","PerplexityBot","Perplexity-User","Google-Extended","Applebot-Extended","Meta-ExternalAgent","Bytespider","CCBot","Amazonbot","cohere-ai","Diffbot"];function it(e){return xt(e)!==null}function xt(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=pn.find(r=>t.includes(r.toLowerCase())))!=null?n:null}var gn=["Googlebot","Bingbot","DuckDuckBot","YandexBot","Baiduspider","Applebot","Slurp","facebookexternalhit","LinkedInBot","Twitterbot"];function fn(e){var r;let t=xt(e);if(t)return t;if(!e)return null;let n=e.toLowerCase();return(r=gn.find(i=>n.includes(i.toLowerCase())))!=null?r:null}function Oe(e){let t=e.toLowerCase();return/ipad|tablet|playbook|kindle|silk/.test(t)?"tablet":/mobi|iphone|ipod|android.*mobile|phone/.test(t)?"mobile":"desktop"}function Pe(e,t,n){if(!e)return"direct";try{let r=new URL(e);if(t)try{if(new URL(t).host===r.host)return"direct"}catch(s){}let i=r.hostname.toLowerCase();return n&&`.${i}`.endsWith(`.${n}`)?"direct":/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(i)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(i)?"social":"referral"}catch(r){return"direct"}}function De(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var mn=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function kt(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([i,s])=>{let u=Array.isArray(s)?s[0]:s;return u===void 0?[]:[[i,u]]});for(let[i,s]of r)i.startsWith("utm_")?i in t||(t[i]=s):mn.includes(i)&&(i in n||(n[i]=s))}catch(r){}return{utmParams:t,clickIds:n}}function Ne(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function It(e){let t=wo("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function wo(e,t){var u,o,p,a,c,d,S,m;let n=(o=(u=t==null?void 0:t.userAgent)==null?void 0:u.trim())!=null?o:"",r=(a=(p=t==null?void 0:t.referer)==null?void 0:p.trim())!=null?a:"",i=(c=t==null?void 0:t.now)!=null?c:new Date,s=fn(n);return T(T({sessionId:e,ephemeral:!1,utmParams:(d=t==null?void 0:t.utmParams)!=null?d:{},clickIds:(S=t==null?void 0:t.clickIds)!=null?S:{},deviceClass:n?Oe(n):"desktop",trafficSource:r?Pe(r,t==null?void 0:t.appOrigin):"direct",referrerDomain:De(r),timeOfDay:Ne(i),dayOfWeek:(m=["sun","mon","tue","wed","thu","fri","sat"][i.getDay()])!=null?m:"sun",automation:(t==null?void 0:t.webdriver)===!0||it(n)},s?{agentToken:s}:{}),t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var Me=require("@sentientui/policy");function je(e){return T(T(T({id:e.id},e.arms?{arms:[...e.arms]}:{}),e.dims?{dims:Object.fromEntries(Object.entries(e.dims).map(([t,n])=>[t,[...n]]))}:{}),e.baseline!==void 0?{baseline:e.baseline}:{})}function Le(e){let t=je(e);return(0,Me.slotResultFor)(t,(0,Me.slotBaselineArm)(t))}function yn(e){let t={};for(let n of e)t[n.id]=Le(n);return t}function at(e){return typeof e=="string"?e:(0,Me.canonicalArm)(e)}var Sn=require("@sentientui/policy"),lt="data-sentient-stage";function ct(e,t){return!t||typeof e!="string"||!(e==="returning"||Sn.STAGE_KEYS.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function dt(e,t=document){try{e?t.documentElement.setAttribute(lt,e):t.documentElement.removeAttribute(lt)}catch(n){}}var At=require("@sentientui/policy");var pt=require("@sentientui/policy");var hn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Eo="[sentient] Local mode \u2014 decisions are simulated on-device and nothing is sent over the network. Add an API key to learn from real traffic.",bn=!1,ut=!1;function xo(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function vn(e){var a;let t=rt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(a=t.getSessionId())!=null?a:"local",r=xo(),i=import("@sentientui/core/local").then(c=>{let d=c;return d.LOCAL_ENGINE_AVAILABLE?(bn||(bn=!0,console.info(Eo)),d):(ut||(ut=!0,console.error(hn)),null)}).catch(()=>(ut||(ut=!0,console.error(hn)),null)),s=null,u={low:.15,medium:.5,high:.85},o=(()=>{var d;if(e.initialPersona)return T({},e.initialPersona);let c=Ce(e.apiKey||"local");return c?{persona:c.persona,confidence:(d=u[c.band])!=null?d:.15}:null})();function p(c){let d=document.documentElement;d.dataset.sentientPersona===void 0&&(d.dataset.sentientPersona=c.persona,d.dataset.sentientConfidence=(0,pt.confidenceBand)(c.confidence))}return{isLocal:!0,async decide(c){var m,b,v;let d=await i;if(!d)return null;let S=d.createLocalEngine({sessionId:n,forcedPersona:r}).decide(c);return s=oe(T({},S),{layoutOrder:(b=(m=S.layoutOrder)!=null?m:s==null?void 0:s.layoutOrder)!=null?b:null,slots:T(T({},(v=s==null?void 0:s.slots)!=null?v:{}),S.slots)}),Te(e.apiKey||"local",{v:1,persona:s.persona,band:(0,pt.confidenceBand)(s.confidence),slots:s.slots,layoutOrder:s.layoutOrder,savedAt:Date.now()}),p(S),S},getSlotResult(c){var d,S,m;return(m=(S=s==null?void 0:s.slots[c])!=null?S:(d=e.initialSlots)==null?void 0:d[c])!=null?m:null},getSlotConfig(c){var d,S;return(S=(d=e.initialSlotConfig)==null?void 0:d[c])!=null?S:null},getSitePalette(){var c;return(c=e.initialPalette)!=null?c:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let c=s!=null?s:o;return c?{persona:c.persona,confidence:c.confidence,band:(0,pt.confidenceBand)(c.confidence)}:null},async assign(c,d){var b;let S=await i;return!S||!d||d.length===0?d!=null&&d[0]?{variantId:d[0],assignmentTtlMs:0}:null:{variantId:(b=S.createLocalEngine({sessionId:n,forcedPersona:r}).decide({components:[{id:c,variantIds:d}]}).assignments[c])!=null?b:d[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var ko=["none","sm","md","lg"],Io=["start","center","end","stretch"],Co=["start","center","end","between"],To=["sm","md","lg"],Ao=["normal","medium","bold"],_o=["default","muted","accent"],Ro=["primary","secondary","ghost"],Oo=["left","center","right"],Po=["auto","square","landscape","wide"],Do=["cover","contain"],No=[2,3,4],Mo=[1,2,3,4],Lo=["default","raised"],Bo=["none","sm","md","lg"],Go=["measure"],Ko=["input","textarea","select"],$o=["text","email","number","tel"],Uo=5,Fo=8,jo=64,Wo=5,Ho=12,Vo=4,zo=500;function wn(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="form"?!0:Array.isArray(t.children)?t.children.some(wn):!1}function En(e,t,n,r){let i=[];{let o=!1,p=[],a=()=>{if(o)return;let c=Date.now();for(p.push(c);p.length>0&&c-p[0]>500;)p.shift();p.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",a),i.push(()=>t.removeEventListener("click",a))}{let s=!1,u=o=>{if(s||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;s=!0;let p=typeof window!="undefined"?window.getSelection():null,a=p?p.toString().length:0;e("text_copy",{selectionLength:a})};document.addEventListener("copy",u),i.push(()=>document.removeEventListener("copy",u))}{let s=!1,u=!1,o=null,p=()=>{o!==null&&(clearTimeout(o),o=null)},a=()=>{s||!u||(p(),o=setTimeout(()=>{!s&&u&&(s=!0,e("scroll_hesitation"))},3e3))},c=()=>{p(),a()},d=m=>{for(let b of m)u=b.intersectionRatio>.3,u?a():p()},S=new IntersectionObserver(d,{threshold:[.3]});S.observe(t),window.addEventListener("scroll",c,{passive:!0}),i.push(()=>{S.disconnect(),window.removeEventListener("scroll",c),p()})}if((r==null?void 0:r.tabLoss)!==!1){let s=!1,u=n!=null?n:Date.now(),o=()=>{if(s||document.visibilityState!=="hidden")return;let p=Date.now()-u;p<15e3&&(s=!0,e("tab_loss",{timeOnPage:p}))};document.addEventListener("visibilitychange",o),i.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let s of i)s()}}function qo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Cn="https://api.sentient-ui.com/v1/events",J=new Map,Tn=null;function An(e,t){let n=J.get(e);n&&n.upgrade&&(n.reinit=t)}function Xo(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Qo=3;function Ct(){return et()}function gt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Jo(){let e=new WeakMap,t=new Map,n=!1,r=(o,p,a)=>{let c=o.get(p);return a===null?c?!0:(o.set(p,new Set),!1):c?c.has(a)?!0:(c.add(a),!1):(o.set(p,new Set([a])),!1)},i=typeof window!="undefined"&&"event"in window,s=()=>{if(!i)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},u=()=>{if(i){Promise.resolve().then(()=>{n=!1,t.clear()});return}let o=!1,p=()=>{o||(o=!0,n=!1,t.clear())};if(setTimeout(p,0),typeof MessageChannel=="function"){let a=new MessageChannel;a.port1.onmessage=()=>{a.port1.close(),a.port2.close(),p()},a.port2.postMessage(0)}};return{firedBefore(o,p){let a=s();if(a){let d=e.get(a);return d||(d=new Map,e.set(a,d)),r(d,o,p)}let c=r(t,o,p);return!c&&!n&&(n=!0,u()),c}}}var _n=new Set;function Yo(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let i=!1,s,u=()=>{if(i)return;let a=gt();!a||a===s||(s=a,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${a}`))},o=[];for(let a of["pushState","replaceState"]){let c=r[a],d=function(...S){let m=c.apply(this,S);return u(),m};r[a]=d,o.push([a,c,d])}window.addEventListener("popstate",u);let p=gt();return p&&_n.has(`${t}:${p}`)?s=p:u(),()=>{if(!i){i=!0,window.removeEventListener("popstate",u);for(let[a,c,d]of o)r[a]===d&&(r[a]=c)}}}var We={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Zo(){try{return kt(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Rn(e){return e.replace(/\/events\/?$/,"")}function He(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(t=>t==="1"||t==="yes")}function On(e){var p;if(typeof window=="undefined")return;let t=e!=null?e:Tn;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=J.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:r,upgrade:i,reinit:s}=n;if(!i){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(r.respectDoNotTrack!==!1&&He())return;let u=(s!=null?s:Rt)(oe(T({},r),{consent:!0}));i(u);let o=(p=J.get(t))==null?void 0:p.dispose;J.set(t,{config:oe(T({},r),{consent:!0}),upgrade:null,dispose:o})}function er(e,t){var H;let n=e.preConsentBehavior==="statistical_winner",r=Rn((H=e.ingestUrl)!=null?H:Cn),i={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},s=new Map,u=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(f,h,E){if(!n)return Promise.resolve(null);let y=s.get(f);return y?Promise.resolve(y):_t(u,f,async()=>{try{let _=new URLSearchParams({componentId:f});for(let ee of h!=null?h:[])_.append("variantIds[]",ee);let $=pe(5e3),V;try{let ee=await fetch(`${r}/winner?${_.toString()}`,{headers:i,signal:$.signal});if(!ee.ok)return h!=null&&h[0]?{variantId:h[0],assignmentTtlMs:0}:null;V=await ee.json()}finally{$.clear()}let N={variantId:V.variantId,assignmentTtlMs:0};return s.set(f,N),N}catch(_){return h!=null&&h[0]?{variantId:h[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},p=!1,a=new Set,c=[],d=[],S=[],m=()=>{for(let[,,f]of S.splice(0))f(null);b.length=0},b=[],v=!1,P=()=>{if(p)return;v=!0;let f=J.get(e.apiKey);(f==null?void 0:f.upgrade)===X&&J.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},O=[],K=()=>{setTimeout(()=>{var f;try{(f=O.shift())==null||f(o)}catch(h){}O.length&&K()})},L=f=>{p?O.length?O.push(f):f(o):!t&&!v&&b.length<100?b.push(f):v&&e.debug&&console.warn("[sentient] goal dropped: client released")},W={get gated(){return!p&&!t},get released(){return v&&!p},takeHeld:()=>b.splice(0),track:f=>o.track(f),goal:((f,h,E,y)=>L(_=>_.goal(f,h,E,y))),componentGoal:(f,h,E)=>o.componentGoal(f,h,E),identify:(f,h)=>o.identify(f,h),getAssignment:(f,h)=>o.getAssignment(f,h),isUnified:f=>{var h,E;return(E=(h=o.isUnified)==null?void 0:h.call(o,f))!=null?E:!1},assign:(f,h,E,y,_)=>o.assign(f,h,E,y,_),decide:f=>p?o.decide(f):v||t?Promise.resolve(null):new Promise(h=>S.push([f,In(),h])),getSlotResult:f=>o.getSlotResult(f),isSlotDecided:f=>{var h,E;return(E=(h=o.isSlotDecided)==null?void 0:h.call(o,f))!=null?E:!0},getSlotConfig:f=>o.getSlotConfig(f),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var f,h;return(h=(f=o.getStyleVocabulary)==null?void 0:f.call(o))!=null?h:null},reportSlots:(f,h,E,y)=>o.reportSlots(f,h,E,y),reportSkeleton:(f,h)=>{var E;return(E=o.reportSkeleton)==null?void 0:E.call(o,f,h)},reportAgentData:(f,h,E)=>{var y;return(y=o.reportAgentData)==null?void 0:y.call(o,f,h,E)},reportDrift:(f,h,E,y)=>{var _;return(_=o.reportDrift)==null?void 0:_.call(o,f,h,E,y)},requestSlots:(f,h,E)=>{var y;return p?(y=o.requestSlots)==null?void 0:y.call(o,f,h,E):c.push([f,h,E])},decideSlots:f=>{var h;return p?(h=o.decideSlots)==null?void 0:h.call(o,f):d.push(...f)},cancelSlots:f=>{var E;if(p)return(E=o.cancelSlots)==null?void 0:E.call(o,f);let h=new Set(f);for(let y of c)y[0]=y[0].filter(_=>!h.has(_));d=d.filter(y=>!h.has(y.id))},onSlotsChanged:f=>(a.add(f),()=>{a.delete(f)}),getPersona:()=>o.getPersona(),getVisitorId:()=>{var f,h;return(h=(f=o.getVisitorId)==null?void 0:f.call(o))!=null?h:null},fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(P(),m(),o.dispose()),destroy:()=>(P(),m(),p?o.destroy():an(e.apiKey))};function X(f){var E,y,_;o=f,p=!0,b.length&&(O.push(...b.splice(0)),K());let h=In();for(let[$,V,N]of S.splice(0))V!==h?N(null):f.decide($).then(N,()=>N(null));(E=f.onSlotsChanged)==null||E.call(f,()=>a.forEach($=>$()));for(let[$,V,N]of c.splice(0))$.length>0&&((y=f.requestSlots)==null||y.call(f,$,V,N));d.length>0&&((_=f.decideSlots)==null||_.call(f,d.splice(0)))}return{proxy:W,setInner:X}}function In(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function _t(e,t,n){let r=e.get(t);if(r)return r;let i=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,i),i}function Rt(e){var Kt,$t,Ut,Ft,jt,Wt,Ht,Vt,zt,qt,Xt;if(typeof window=="undefined")return We;e.nonce&&nn(e.nonce),Tn=e.apiKey||"local";let t=J.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(l){}let n=e.respectDoNotTrack!==!1&&He(),r=e.consent===!1||n,i=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!i&&e.localMode!==!1)return J.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),r?We:vn(e);if(r){if(!e.apiKey||!e.apiKey.startsWith("pk_"))return e.preConsentBehavior==="statistical_winner"&&console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),J.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): the client was initialized with an invalid apiKey (expected a pk_ public key) \u2014 consent cannot enable tracking."}),We;let{proxy:l,setInner:g}=er(e,n);return J.set(e.apiKey,{config:e,upgrade:n?null:g}),l}if(!e.apiKey||!e.apiKey.startsWith("pk_"))return console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),We;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),We;let s=(Kt=e.ingestUrl)!=null?Kt:Cn,u=Date.now(),o=rt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey,cookieDomain:e.cookieDomain}),p=un(void 0,e.apiKey),a=!1,c=me(e.apiKey),d=()=>!a&&me(e.apiKey)===c,S=new Set(($t=e.initialUnified)!=null?$t:[]),m=oe(T({},p),{get:(l,g)=>S.has(l)?null:p.get(l,g),set:(...l)=>{d()&&p.set(...l)}}),b=rn({ingestUrl:s,apiKey:e.apiKey}),v=Rn(s),P={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},O=new Set,K=sn({url:`${v}/goals`,apiKey:e.apiKey,headers:P,onDrop:(l,g)=>{if(!e.debug){if(O.has(g))return;O.add(g)}console.warn(`[sentient] goal dropped (HTTP ${g}) \u2014 this will not be retried. `+(g===400?"The session was not found: call init() and let the session upsert complete before firing goals.":g===401||g===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),l)}}),L=Oe((Ut=navigator.userAgent)!=null?Ut:""),W=window.location.origin,X=Pe((Ft=document.referrer)!=null?Ft:"",W,o.domain),H=(jt=e.sessionSegment)!=null?jt:`${L}:${X}`,f=new Map,h=new Map,E=new Map,y=new Set,_=new Map,$=null,V=null,N=null,ee=new Set,ae=new Set,k=new Map,B=new Map,fe=new Set,ve=new Set,te=new Set,Ee=new Set,xe=null,re=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,ke=new Set,le=new Set,ze=new Set,Be=new Map,yt=null,qe=new Set,Ge=new Map,St=null,Wn=2,Mt=new Map,se=!1,Lt=(l,g,w)=>{var x;let R=new Set,D=1;for(let I of l){g.delete(I);let C=((x=Mt.get(I))!=null?x:0)+1;Mt.set(I,C),C<=Wn&&(R.add(I),C>D&&(D=C))}R.size>0&&setTimeout(()=>{se||w(R)},Se(D))},ht=l=>{for(let g of l)E.has(g.id)||E.set(g.id,Le(g))};if(e.initialSlots)for(let[l,g]of Object.entries(e.initialSlots))E.set(l,g),y.add(l);if(e.initialSlotConfig)for(let[l,g]of Object.entries(e.initialSlotConfig))_.set(l,g);e.initialPalette&&($=e.initialPalette),e.initialVocabulary&&(V=e.initialVocabulary);let ce=Ce(e.apiKey);if(ce){for(let[l,g]of Object.entries(ce.slots))E.has(l)||E.set(l,g);for(let[l,g]of Object.entries((Wt=ce.slotConfig)!=null?Wt:{}))_.has(l)||_.set(l,g);!$&&ce.palette&&($=ce.palette),!V&&ce.vocabulary&&(V=ce.vocabulary)}let Bt={low:.15,medium:.5,high:.85};if(e.initialPersona)N=T({},e.initialPersona);else{let l=document.documentElement.dataset;l.sentientPersona?N={persona:l.sentientPersona,confidence:(Vt=Bt[(Ht=l.sentientConfidence)!=null?Ht:"low"])!=null?Vt:.15}:ce&&(N={persona:ce.persona,confidence:(zt=Bt[ce.band])!=null?zt:.15})}if(e.initialAssignments)for(let[l,g]of Object.entries(e.initialAssignments))m.set(l,H,{variantId:g,assignedAt:Date.now(),segment:H,confidence:1});let he=Promise.resolve(),Gt=o.getSessionId();if(Gt){let l=De((qt=document.referrer)!=null?qt:""),{utmParams:g,clickIds:w}=Zo(),R=T(T(T(T({sessionId:Gt,deviceClass:L,trafficSource:X,referrerDomain:l,utmParams:g,clickIds:w,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:Ne(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||it((Xt=navigator.userAgent)!=null?Xt:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),D=async()=>{for(let x=0;;x++){if(se||!d())return;let I=pe(5e3);try{let C=await fetch(`${v}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(R),headers:P,signal:I.signal});if(C.status===402){console.warn("[SentientUI] Session limit exceeded for this project. The bandit will stop learning until the limit resets. Upgrade at sentient-ui.com/pricing");return}if(C.ok||Ae(C)==="dropped")return}catch(C){}finally{I.clear()}if(x>=Qo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(C=>setTimeout(C,Se(x+1)))}};try{he=D()}catch(x){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:b});let Hn=Jo(),we=null,bt=!1,q={goal(l,g={},w=1,R=0){var z,G,Y,ne,Z,Q,A;let D=o.getSessionId();if(!D||se||!d())return;let x=Xo(g)?g:{metadata:g},I=[l,(z=x.externalId)!=null?z:"",(G=x.stepIndex)!=null?G:R,(Y=x.weight)!=null?Y:w].join("\0"),C=x.value!==void 0?`${x.value}\0${(ne=x.currency)!=null?ne:""}`:null;if(Hn.firedBefore(I,C)){e.debug&&console.log(`[sentient] goal("${l}") already recorded for this action \u2014 not sent twice`);return}let U=Ct(),M={sessionId:D,name:l,metadata:(Z=x.metadata)!=null?Z:{},weight:(Q=x.weight)!=null?Q:w,stepIndex:(A=x.stepIndex)!=null?A:R,goalId:U,value:x.value,currency:x.currency,externalId:x.externalId};e.debug&&console.log("[sentient] goal",M);let F={id:U,body:JSON.stringify(M)};he.then(()=>K.send(F))},componentGoal(l,g,w){var U,M,F;let R=o.getSessionId();if(!R||se||!d())return;let D=m.get(l,H),x=D?null:(U=E.get(l))!=null?U:null;if(!D&&x===null){e.debug&&console.warn(`[sentient] componentGoal("${l}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!D&&!y.has(l)){e.debug&&console.warn(`[sentient] componentGoal("${l}"): slot not decided this session \u2014 not attributed`);return}let I=D?D.variantId:at(x),C={id:Ct(),sessionId:R,projectId:e.apiKey,componentId:l,variantId:I,eventType:"goal_achieved",goalType:g,payload:T({reward:(M=w==null?void 0:w.reward)!=null?M:1,goalValue:w==null?void 0:w.value,currency:w==null?void 0:w.currency},(F=w==null?void 0:w.metadata)!=null?F:{}),timestamp:Date.now(),timeInSession:Date.now()-u,path:gt()};e.debug&&console.log("[sentient] componentGoal",C),he.then(()=>{!se&&d()&&b.push(C)})},identify(l,g){let w=o.getSessionId();!w||se||!d()||he.then(()=>{fetch(`${v}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:w,userId:l,userHash:g==null?void 0:g.userHash,ephemeral:o.isEphemeral()}),headers:P}).catch(()=>{})})},track(l){let g=o.getSessionId();if(!g||se||!d()||l.eventType==="variant_assigned"&&E.get(l.componentId)!==void 0&&!y.has(l.componentId)&&!m.get(l.componentId,H))return;let w=oe(T({path:gt()},l),{id:Ct(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-u});e.debug&&console.log("[sentient] track",w),he.then(()=>b.push(w))},getAssignment(l,g){return m.get(l,g)},isUnified:l=>S.has(l),async assign(l,g,w,R,D){var U;let x=o.getSessionId();if(!x)return null;let I=(D==null?void 0:D.unified)===!0;if(I&&S.has(l))return{variantId:(U=g==null?void 0:g[0])!=null?U:"",assignmentTtlMs:0,unified:!0};let C=m.get(l,H);if(C&&(g!=null&&g.length||C.content!==void 0)){let M=C.ttlMs&&C.ttlMs>0?Math.max(0,C.assignedAt+C.ttlMs-Date.now()):0;return{variantId:C.variantId,assignmentTtlMs:M,content:C.content}}return _t(f,I?`${l}\0unified`:l,async()=>{if(!await vt(he,2500)||se||!d())return null;let M=pe(3e4);try{let F={sessionId:x,componentId:l,variantIds:g};R!==void 0?F.agentDataByVariant=R:w!==void 0&&(F.agentData=w),I&&(F.caps={unified:!0});let z=await fetch(`${v}/assign`,{method:"POST",body:JSON.stringify(F),headers:P,signal:M.signal});if(!z.ok)return null;let G=await z.json();return G.unified===!0?I?(S.add(l),{variantId:G.variantId,assignmentTtlMs:0,unified:!0}):null:(m.set(l,H,T({variantId:G.variantId,assignedAt:Date.now(),segment:H,confidence:1,content:G.content},G.assignmentTtlMs&&G.assignmentTtlMs>0?{ttlMs:G.assignmentTtlMs}:{})),G)}catch(F){return null}finally{M.clear()}})},async decide(l){var x,I;let g=o.getSessionId();if(!g)return null;let w=(x=l.slots)!=null?x:[],R={sessionId:g};l.sections&&l.sections.length>0&&(R.sections=l.sections.map(C=>({id:C}))),R.components=(I=l.components)!=null?I:[],w.length>0&&(R.slots=w.map(je)),l.slotsFrom==="registry"&&(R.slotsFrom="registry",l.registrySlotIds&&(R.registrySlotIds=l.registrySlotIds),l.bootstrap===!1&&(R.bootstrap=!1),l.render&&Object.keys(l.render).length>0&&(R.render=l.render)),l.v&&(R.v=l.v),typeof l.pp=="number"&&(R.pp=l.pp),e.persona&&(R.persona=e.persona);let D=JSON.stringify(R);return _t(h,D,async()=>{var U,M,F,z,G,Y,ne,Z;if(!await vt(he,2500)||se||!d())return ht(w),null;let C=pe(3e4);try{let Q=await fetch(`${v}/decide`,{method:"POST",body:D,headers:P,signal:C.signal});if(!Q.ok)return ht(w),null;let A=await Q.json(),de=ct(A.stage,e.stageAttributes);e.stageAttributes&&dt(de);let Ie={};for(let j of w){let ue=(U=A.slots)==null?void 0:U[j.id];if(ue!==void 0){Ie[j.id]=ue,E.set(j.id,ue),y.add(j.id);continue}let Qt=E.get(j.id);if(Qt!==void 0)Ie[j.id]=Qt;else{let Jt=Le(j);Ie[j.id]=Jt,E.set(j.id,Jt)}}if(A.slots)for(let[j,ue]of Object.entries(A.slots))j in Ie||(Ie[j]=ue,E.set(j,ue),y.add(j));let Vn=N!=null&&N.persona!=="unknown";A.persona&&!(A.persona==="unknown"&&Vn)?N={persona:A.persona,confidence:(M=A.confidence)!=null?M:0}:N||(N={persona:"unknown",confidence:0});for(let[j,ue]of Object.entries((F=A.assignments)!=null?F:{}))m.set(j,H,{variantId:ue,assignedAt:Date.now(),segment:H,confidence:1});if(A.slotConfig)for(let[j,ue]of Object.entries(A.slotConfig))_.set(j,ue);A.palette&&($=A.palette),A.vocabulary&&(V=A.vocabulary);for(let j of(z=l.registrySlotIds)!=null?z:[])(G=A.slotConfig)!=null&&G[j]||(_.delete(j),E.delete(j),y.delete(j));return d()&&Te(e.apiKey,T(T(T(T({v:1,persona:N.persona,band:(0,At.confidenceBand)(N.confidence),slots:Object.fromEntries(E),layoutOrder:(Y=A.layoutOrder)!=null?Y:null,savedAt:Date.now()},_.size>0?{slotConfig:Object.fromEntries(_)}:{}),$?{palette:$}:{}),V?{vocabulary:V}:{}),de?{stage:de}:{})),T(T(T(T(T(T(T({layoutOrder:(ne=A.layoutOrder)!=null?ne:null,assignments:(Z=A.assignments)!=null?Z:{},slots:Ie,persona:N.persona,confidence:N.confidence},A.slotConfig?{slotConfig:A.slotConfig}:{}),A.goals?{goals:A.goals}:{}),A.sectionMap?{sectionMap:A.sectionMap}:{}),A.palette?{palette:A.palette}:{}),A.vocabulary?{vocabulary:A.vocabulary}:{}),A.stage?{stage:A.stage}:{}),A.context?{context:A.context}:{})}catch(Q){return ht(w),null}finally{C.clear()}})},getSlotResult(l){var g;return(g=E.get(l))!=null?g:null},isSlotDecided(l){return y.has(l)},getSlotConfig(l){var g;return(g=_.get(l))!=null?g:null},reportSlots(l,g,w,R){var x;let D={};for(let[I,C]of Object.entries(R!=null?R:{}))for(let U of C){let M=`${I}|${U.key}`;!re.test(I)||te.has(M)||(te.add(M),((x=D[I])!=null?x:D[I]=[]).push(U))}Object.keys(D).length>0&&fetch(`${v}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify({slotIds:Object.keys(D),authoredArms:D})}).catch(()=>{});for(let I of l)if(!(typeof I!="string"||I.length===0)){if(!re.test(I)){qo()&&!ke.has(I)&&(ke.add(I),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(I)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!ee.has(I)){ee.add(I),ae.add(I);let C=g==null?void 0:g[I];if(typeof C=="string"){let M=C.replace(/\s+/g," ").trim().slice(0,400);M!==""&&k.set(I,M)}let U=w==null?void 0:w[I];U!==void 0&&B.set(I,U)}}ae.size===0||xe!=null||(xe=setTimeout(()=>{xe=null;let I=[...ae];ae.clear();for(let C=0;C<I.length;C+=20){let U=I.slice(C,C+20),M={},F={};for(let z of U){let G=k.get(z);G!==void 0&&(M[z]=G,k.delete(z));let Y=B.get(z);Y!==void 0&&(F[z]=Y,B.delete(z))}fetch(`${v}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify(T(oe(T(T({slotIds:U},Object.keys(M).length>0?{baselineTexts:M}:{}),Object.keys(F).length>0?{baselineSkeletons:F}:{}),{pagePaths:Object.fromEntries(U.map(z=>[z,location.pathname]))}),Object.keys(M).length>0&&o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(l,g){!re.test(l)||fe.has(l)||(fe.add(l),fetch(`${v}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify({slotIds:[l],baselineSkeletons:{[l]:g}})}).catch(()=>{}))},reportAgentData(l,g,w){let R=`${l}|${g}`;!re.test(l)||Ee.has(R)||(Ee.add(R),fetch(`${v}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify(T(T({slotIds:[l],agentData:{[l]:{[g]:w}}},g.startsWith("authored.")?{authoredArms:{[l]:[{key:g.slice(9)}]}}:{}),o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{}))},reportDrift(l,g,w,R){let D=`${l}|${g}`,x=o.getSessionId();!x||ve.has(D)||(ve.add(D),fetch(`${v}/slots/drift`,{method:"POST",headers:P,body:JSON.stringify({sessionId:x,reports:[{slotId:l,expectedFp:g,observedFp:w,reason:R}]})}).catch(()=>{}))},requestSlots(l,g,w){var R,D;for(let x of l)ze.has(x)||(ze.add(x),re.test(x)?Be.set(x,{text:g==null?void 0:g[x],render:(R=w==null?void 0:w.render)==null?void 0:R[x],skeleton:(D=w==null?void 0:w.skeletons)==null?void 0:D[x]}):q.reportSlots([x]));Be.size===0||yt!=null||(yt=setTimeout(()=>{yt=null;let x=[...Be];Be.clear();for(let I=0;I<x.length;I+=50){let C=x.slice(I,I+50),U={};for(let[M,F]of C)F.render&&(U[M]=F.render);q.decide({slotsFrom:"registry",registrySlotIds:C.map(([M])=>M),bootstrap:!1,render:U}).then(M=>{var F,z;if(M){let G={},Y={},ne=[];for(let[Z,Q]of C){let A=(F=M.slotConfig)==null?void 0:F[Z];if(A){A.needsSkeleton&&Q.skeleton&&((z=q.reportSkeleton)==null||z.call(q,Z,Q.skeleton));continue}ne.push(Z),Q.text&&(G[Z]=Q.text),Q.skeleton&&(Y[Z]=Q.skeleton)}ne.length>0&&q.reportSlots(ne,G,Y)}else Lt(C.map(([G])=>G),ze,G=>{var Q;let Y={},ne={},Z={};for(let[A,de]of C)G.has(A)&&(de.text&&(Y[A]=de.text),de.render&&(ne[A]=de.render),de.skeleton&&(Z[A]=de.skeleton));(Q=q.requestSlots)==null||Q.call(q,[...G],Y,{render:ne,skeletons:Z})});le.forEach(G=>G())})}},0))},decideSlots(l){for(let g of l)qe.has(g.id)||(qe.add(g.id),Ge.set(g.id,g));Ge.size===0||St!=null||(St=setTimeout(()=>{St=null;let g=[...Ge.values()];Ge.clear();for(let w=0;w<g.length;w+=30){let R=g.slice(w,w+30);q.decide({slots:R}).then(D=>{D||Lt(R.map(x=>x.id),qe,x=>{var I;return(I=q.decideSlots)==null?void 0:I.call(q,R.filter(C=>x.has(C.id)))}),le.forEach(x=>x())})}},0))},cancelSlots(l){for(let g of l)Be.delete(g)&&ze.delete(g),Ge.delete(g)&&qe.delete(g)},onSlotsChanged(l){return le.add(l),()=>{le.delete(l)}},getStyleVocabulary(){return V},getSitePalette(){return $},getVisitorId:()=>d()?o.getSessionId():null,getPersona(){return N?{persona:N.persona,confidence:N.confidence,band:(0,At.confidenceBand)(N.confidence)}:null},async fetchWeights(){var g;let l=pe(5e3);try{let w=await fetch(`${v}/weights`,{headers:P,signal:l.signal});return w.ok?(g=(await w.json()).components)!=null?g:[]:[]}catch(w){return[]}finally{l.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){b.flush(),K.flush()},dispose(){var l;we==null||we(),bt=!0,se=!0,b.destroy(),K.destroy(),((l=J.get(e.apiKey))==null?void 0:l.dispose)===q.dispose&&J.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var l;we==null||we(),bt=!0,se=!0,a=!0,Qe(e.apiKey),b.destroy({forget:!0}),K.destroy({forget:!0}),o.destroy(),m.clear(),((l=J.get(e.apiKey))==null?void 0:l.dispose)===q.dispose&&J.delete(e.apiKey);try{localStorage.removeItem(ye+e.apiKey),localStorage.removeItem(Ue(e.apiKey)),localStorage.removeItem(Fe(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${ie(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(g){}e.debug&&console.log("[sentient] destroyed")}};if(J.set(e.apiKey,{config:e,upgrade:null,dispose:q.dispose}),we=Yo(q,e.apiKey,l=>{he.then(()=>{bt||_n.add(l)})}),e.debug){let l=window;l.__sentient&&(l.__sentient.client=q)}return q}var Pn="_snt_graph_edges",tr={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function nr(e){var t;return(t=tr[e])!=null?t:[]}function or(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function rr(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var sr=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function ir(e){return sr.has(e)?e:"generic"}function Ot(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function ar(e,t,n){let r=`${e}:${t}:${n.join(",")}`,i=5381;for(let s=0;s<r.length;s++)i=(i<<5)+i+r.charCodeAt(s)&4294967295;return(i>>>0).toString(16).padStart(8,"0")}function Dn(e){let t=new Map,n=new Map,r=`_snt_graph_nodes${ie(e==null?void 0:e.apiKey)}`,i=()=>{typeof window!="undefined"&&rr(r,[...t.values()])};if(typeof window!="undefined"){let s=or(r,[]);for(let u of s)t.set(u.componentId,u);try{localStorage.removeItem(Pn)}catch(u){}}return{addPageNode(s){t.set(s.componentId,s),i()},addStructuralEdge(s){let u=`${s.fromComponentId}->${s.toComponentId}`;n.set(u,s)},syncOnce(){var u,o;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let s=[...t.values()];if(s.length!==0)try{let p=new Map;for(let m of s){let b=(u=p.get(m.semanticType))!=null?u:[];b.push(m),p.set(m.semanticType,b)}let a=[],c=new Set;for(let m of s)for(let b of nr(m.semanticType)){let v=(o=p.get(b))!=null?o:[];for(let P of v){if(P.componentId===m.componentId)continue;let O=`semantic:${m.componentId}->${P.componentId}`;c.has(O)||(c.add(O),a.push({fromComponentId:m.componentId,toComponentId:P.componentId,type:"semantic",weight:.4,confidence:.9}))}}let d=new Set(s.map(m=>m.componentId));for(let m of n.values()){if(!d.has(m.fromComponentId)||!d.has(m.toComponentId))continue;let b=`structural:${m.fromComponentId}->${m.toComponentId}`;c.has(b)||(c.add(b),a.push({fromComponentId:m.fromComponentId,toComponentId:m.toComponentId,type:"structural",weight:m.weight,confidence:1}))}let S=oe(T(T({pageUrl:Ot(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:s.map(m=>{let b=ir(m.semanticType);return{componentId:m.componentId,semanticType:b,answers:m.answers,contentHash:ar(m.componentId,b,m.answers),prominenceScore:m.prominenceScore,depthInPage:m.depth}}),edges:a});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:T({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(S)}).catch(()=>{})}catch(p){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(r),localStorage.removeItem(Pn)}catch(s){}}}}var lr=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function Pt(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function cr(e){return{tag:e.tagName.toLowerCase(),text:Pt(e).slice(0,40)}}function Nn(e){return e.replace(/["\\\]]/g,"\\$&")}function Ve(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Mn(e,t){var u;let n=e.tagName.toLowerCase();if(!n)return null;let r=((u=e.getAttribute("class"))!=null?u:"").split(/\s+/).filter(o=>/^[a-zA-Z][\w-]*$/.test(o)),i=[n,...r.map(o=>`${n}.${o}`)];for(let o of i)if(Ve(t,o))return o;let s=e.parentElement;if(s&&s!==t){let o=Mn(s,t);if(o){for(let d of i){let S=`${o} > ${d}`;if(Ve(t,S))return S}let p=Array.from(s.children).filter(d=>d.tagName.toLowerCase()===n),a=p.indexOf(e),c=p.some(d=>d!==e&&Pt(d)!==Pt(e));if(a>=0&&c){let d=`${o} > ${n}:nth-of-type(${a+1})`;if(Ve(t,d))return d}}}return null}function ft(e,t){let n=cr(e),r=e.getAttribute("id");if(r&&Ve(t,`#${Nn(r)}`))return{v:1,id:r,fingerprint:n};for(let s of lr){let u=e.getAttribute(s);if(u&&Ve(t,`[${s}="${Nn(u)}"]`))return{v:1,dataAttr:{name:s,value:u},fingerprint:n}}let i=Mn(e,t);return i?{v:1,selector:i,fingerprint:n}:null}var Bn=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],dr={banner:"hero",navigation:"navigation",contentinfo:"footer"};function ur(e){let t=e.ariaRole?dr[e.ariaRole.toLowerCase()]:void 0;if(t)return t;if(e.tag==="nav")return"navigation";if(e.tag==="footer")return"footer";if(e.tag==="header")return e.actionCount>=5?"navigation":"hero";let n=`${e.idClass} ${e.headingText}`.toLowerCase();return/\b(navbar|nav-bar|navigation|site-nav|main-nav|topbar|footer)\b/.test(n)?/footer/.test(n)?"footer":"navigation":/\b(hero|masthead|jumbotron)\b/i.test(e.idClass)?"hero":null}function pr(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var gr=[["pricing",/\b(pricing|price list|per month|\/mo|subscriptions?)\b|\bplans?\b(?=[^.]{0,40}(from|start|month|year|[$€£]))/i],["faq",/\bfaq\b|frequently asked|common questions?/i],["comparison",/\b(compare|comparison|versus)\b|\bvs\./i],["social_proof",/\b(reviews?|ratings?|testimonial|brands?|galler(y|ies)|logos)\b|trusted by|loved by|case stud|what our customers say/i],["trust",/\b(insurance|warrant(y|ies)|guarantees?|certifi|accredit|security|privacy|compliance|gdpr|encrypt)\b|why choose|about us|our team/i],["cta",/\b(book|booking|reserve|appointments?|newsletter|subscribe)\b|contact us|get in touch|opening hours/i],["features",/\b(features?|benefits?|capabilit|services?|repairs?|menus?|products?)\b|how it works|our process|what we (do|offer)|what you get/i]],fr=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|free returns?|returns? within|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]],Ln={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function mr(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function yr(e){var i,s;let t=ur(e);if(t)return{type:(i=Ln[t])!=null?i:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[u,o]of gr)if(o.test(n))return{type:u,strength:"strong"};for(let[u,o]of fr)if(o.test(e.bodyText))return{type:u,strength:"strong"};let r=pr(e);return{type:(s=Ln[r])!=null?s:"generic",strength:"weak"}}function Sr(e){var r,i;let t=((r=e.textContent)!=null?r:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return T({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((i=e.className)!=null?i:"")}`,headingText:mr(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function Gn(e){return yr(Sr(e)).type}var hr=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),br=200,vr="h1, h2, h3",wr="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",Kn=30,Er=1500,xr={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function $n(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function kr(e){var t,n,r;try{let i=e;for(let s of Object.keys(i)){if(!s.startsWith("__reactFiber")&&!s.startsWith("__reactInternalInstance"))continue;let u=i[s],o=(r=(t=u==null?void 0:u.type)==null?void 0:t.displayName)!=null?r:(n=u==null?void 0:u.type)==null?void 0:n.name;if(o&&o.length>1)return o}}catch(i){}}function Ir(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var Dt=new Set(Bn);function Cr(e,t){let n=e.getAttribute("data-sentient-id"),r=n?t==null?void 0:t[n]:void 0;if(r&&Dt.has(r))return r;let i=e.getAttribute("data-sentient-type");if(i&&Dt.has(i))return i;let s=e.getAttribute("role");return s&&Dt.has(s)?s:Gn(e)}function Tr(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)&4294967295;return(t>>>0).toString(16).padStart(8,"0")}function Ar(e){let t=[],n=e;for(;n;){let r=n.parentElement;if(!r){t.push(n.tagName.toLowerCase());break}let i=Array.prototype.indexOf.call(r.children,n);t.push(`${n.tagName.toLowerCase()}[${i}]`),n=r}return t.reverse().join("/")}function _r(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${Tr(Ar(e))}`}function Rr(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function Nt(e,t,n){var i,s,u,o;let r=e.querySelector(vr);return{componentId:_r(e),semanticType:Cr(e,n),ariaLabel:(i=e.getAttribute("aria-label"))!=null?i:void 0,headingText:(u=(s=r==null?void 0:r.textContent)==null?void 0:s.trim())!=null?u:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:Rr(e),reactComponentName:kr(e),dataAttributes:Ir(e),locator:(o=ft(e,e.ownerDocument))!=null?o:void 0}}function Un(e){var s;let t=[],n=new Set,r="__root__",i=new Map;for(let[u,o]of e){let p=u.parentElement,a=r;for(;p;){if(e.has(p)){a=e.get(p);let d=e.get(u),S=`${a}->${d}`;!n.has(S)&&a!==d&&(n.add(S),t.push({fromComponentId:a,toComponentId:d,weight:.6}));break}p=p.parentElement}let c=(s=i.get(a))!=null?s:[];c.push(u),i.set(a,c)}for(let u of i.values()){if(u.length<2)continue;let o=u.length>Kn?u.slice(0,Kn):u;for(let p=0;p<o.length;p++)for(let a=p+1;a<o.length;a++){if(t.length>=Er)return t;let c=e.get(o[p]),d=e.get(o[a]);if(c===d)continue;let S=`${c}->${d}::sib`,m=`${d}->${c}::sib`;n.has(S)||(n.add(S),t.push({fromComponentId:c,toComponentId:d,weight:.3})),n.has(m)||(n.add(m),t.push({fromComponentId:d,toComponentId:c,weight:.3}))}}return t}function Or(e,t){let n=[],r=new Set,i=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(o=>{if(o instanceof Element&&!r.has(o)){r.add(o);let p=Nt(o,e,t);n.push(p),i.set(o,p.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(o=>{if(!(o instanceof Element)||r.has(o))return;let p=o.hasAttribute("aria-label"),a=o.hasAttribute("data-sentient-id");if(!p&&!a)return;r.add(o);let c=Nt(o,e,t);n.push(c),i.set(o,c.componentId)}),{nodes:n,edges:Un(i),elementToId:i}}function Fn(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return xr;let n=null,r=0,i=null,s=new Map,u=m=>{try{let b=window.getComputedStyle(m),v=parseFloat(b.fontSize)||12,P=parseFloat(b.zIndex)||0,O=m.getBoundingClientRect(),K=Math.max(O.top,0),L=window.innerHeight||1,W=1/(K/L+1),X=$n(v,12,48)*.4+W*.4+$n(P,0,100)*.2;return Math.max(0,Math.min(1,X))}catch(b){return .5}},o=()=>new Promise(m=>{let b=()=>{let{nodes:v,edges:P,elementToId:O}=Or(u,t);s.clear();for(let[K,L]of O)s.set(K,L);m({nodes:v,edges:P,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?r=requestIdleCallback(b,{timeout:100}):b()}catch(v){b()}}),p=new Set,a=null,c=()=>{a=null;let m=[...p];p.clear();let b=[],v=new Set;for(let O of m){if(!O.isConnected)continue;let K=[];hr.has(O.tagName)&&(O.hasAttribute("data-sentient-id")||O.hasAttribute("aria-label"))&&K.push(O);try{O.querySelectorAll(wr).forEach(L=>K.push(L))}catch(L){}for(let L of K){if(s.has(L))continue;let W=Nt(L,u,t);b.push(W),v.add(W.componentId),s.set(L,W.componentId)}}if(b.length===0||!i)return;for(let O of[...s.keys()])O.isConnected||s.delete(O);let P=Un(s).filter(O=>v.has(O.fromComponentId)||v.has(O.toComponentId));i({nodes:b,edges:P,addedAt:Date.now()})};return{scan:o,observe:m=>{i=m;try{n=new MutationObserver(b=>{for(let v of b)v.type==="childList"&&v.addedNodes.forEach(P=>{P instanceof Element&&p.add(P)});p.size>0&&a===null&&(a=setTimeout(c,br))}),n.observe(document.body,{childList:!0,subtree:!0})}catch(b){}},getProminenceScore:u,destroy:()=>{if(n&&(n.disconnect(),n=null),a!==null&&clearTimeout(a),a=null,p.clear(),r&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(r)}catch(m){}r=0,i=null,s.clear()}}}var Pr="https://api.sentient-ui.com/v1/events";function Dr(e){var n;let t=r=>{try{let i=document.cookie.match(new RegExp(`(?:^|; )${r}=([^;]*)`));return i?decodeURIComponent(i[1]):void 0}catch(i){return}};return(n=e?t(be(e)):void 0)!=null?n:t(ge)}var mt=new Map;function jn(e){var m;let t=Rt(e),n=e.respectDoNotTrack!==!1&&He(),r=e.consent===!1||n,i=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),s=e.localMode===!0||!i;if(!e.graph||s||typeof window=="undefined")return t;if(r)return n||An(e.apiKey,b=>jn(b)),t;let u=mt.get(e.apiKey);if(u)try{u()}catch(b){}let o=Fn({sectionTypes:e.sectionTypes}),p=(m=e.ingestUrl)!=null?m:Pr,a=Dn({syncUrl:p.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:Dr(e.apiKey)});o.scan().then(b=>{for(let v of b.nodes)a.addPageNode({id:v.componentId,componentId:v.componentId,semanticType:v.semanticType,answers:e.captureDomText&&v.headingText?[v.headingText]:[],prominenceScore:v.prominenceScore,depth:v.depth});for(let v of b.edges)a.addStructuralEdge(v);a.syncOnce()});let c=null,d=()=>{c!==null&&clearTimeout(c),c=setTimeout(()=>{c=null,a.syncOnce()},500)};o.observe(b=>{for(let v of b.nodes)a.addPageNode({id:v.componentId,componentId:v.componentId,semanticType:v.semanticType,answers:e.captureDomText&&v.headingText?[v.headingText]:[],prominenceScore:v.prominenceScore,depth:v.depth});for(let v of b.edges)a.addStructuralEdge(v);d()});let S=()=>{c!==null&&(clearTimeout(c),c=null),o.destroy(),a.destroy(),mt.get(e.apiKey)===S&&mt.delete(e.apiKey)};return mt.set(e.apiKey,S),oe(T({},t),{getGraph:()=>a.snapshot(),dispose:()=>{S(),t.dispose()},destroy:()=>{S(),t.destroy()}})}0&&(module.exports={BLOCK_ALIGNS,BLOCK_EMPHASES,BLOCK_FITS,BLOCK_GAPS,BLOCK_GRID_COLUMNS,BLOCK_HEADING_LEVELS,BLOCK_JUSTIFIES,BLOCK_MAX_WIDTHS,BLOCK_PADS,BLOCK_RATIOS,BLOCK_SIZES,BLOCK_SURFACES,BLOCK_TEXT_ALIGNS,BLOCK_TONES,BLOCK_WEIGHTS,FORM_FIELD_KINDS,FORM_INPUT_TYPES,LEGACY_SESSION_COOKIE_NAME,MAX_BLOCK_ARMS,MAX_BLOCK_CHILDREN,MAX_BLOCK_DEPTH,MAX_BLOCK_NODES,MAX_BLOCK_TEXT_LEN,MAX_FORM_FIELDS,MAX_FORM_SELECT_OPTIONS,SNAPSHOT_STORAGE_KEY_PREFIX,STAGE_ATTRIBUTE,armOfResult,attachMicroSignalDetectors,baselineResultFor,baselineSlots,containsFormBlock,deriveSessionSegment,detectDeviceClass,detectTimeOfDay,detectTrafficSource,exposedStage,grantConsent,init,isDoNotTrackEnabled,locatorFromElement,readSnapshot,referrerDomainFromReferer,renderPrePaintScript,sanitizePageUrl,sessionCookieName,setStageAttribute,toWireSlot,writeSnapshot});
|
|
2
2
|
//# sourceMappingURL=index-graph.js.map
|