@sentientui/core 0.39.0 → 0.39.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.
@@ -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-VE2K45X4.mjs";import"./chunk-XZRKD2GS.mjs";import"./chunk-EVF5PQ4U.mjs";import"./chunk-MKM7TD3L.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};
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-QEIHHO3T.mjs";import"./chunk-XZRKD2GS.mjs";import"./chunk-EVF5PQ4U.mjs";import"./chunk-MKM7TD3L.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
@@ -1,2 +1,2 @@
1
- "use strict";var Fn=Object.create;var Ge=Object.defineProperty,jn=Object.defineProperties,Wn=Object.getOwnPropertyDescriptor,Vn=Object.getOwnPropertyDescriptors,Hn=Object.getOwnPropertyNames,Xt=Object.getOwnPropertySymbols,zn=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty,qn=Object.prototype.propertyIsEnumerable;var Qt=(e,t,n)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t)=>{for(var n in t||(t={}))Jt.call(t,n)&&Qt(e,n,t[n]);if(Xt)for(var n of Xt(t))qn.call(t,n)&&Qt(e,n,t[n]);return e},oe=(e,t)=>jn(e,Vn(t));var Xn=(e,t)=>{for(var n in t)Ge(e,n,{get:t[n],enumerable:!0})},Yt=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of Hn(t))!Jt.call(e,c)&&c!==n&&Ge(e,c,{get:()=>t[c],enumerable:!(s=Wn(t,c))||s.enumerable});return e};var Qn=(e,t,n)=>(n=e!=null?Fn(zn(e)):{},Yt(t||!e||!e.__esModule?Ge(n,"default",{value:e,enumerable:!0}):n,e)),Jn=e=>Yt(Ge({},"__esModule",{value:!0}),e);var Rr={};Xn(Rr,{BLOCK_ALIGNS:()=>Eo,BLOCK_EMPHASES:()=>Co,BLOCK_FITS:()=>_o,BLOCK_GAPS:()=>vo,BLOCK_GRID_COLUMNS:()=>Ro,BLOCK_HEADING_LEVELS:()=>Oo,BLOCK_JUSTIFIES:()=>wo,BLOCK_MAX_WIDTHS:()=>No,BLOCK_PADS:()=>Do,BLOCK_RATIOS:()=>Ao,BLOCK_SIZES:()=>xo,BLOCK_SURFACES:()=>Po,BLOCK_TEXT_ALIGNS:()=>To,BLOCK_TONES:()=>Io,BLOCK_WEIGHTS:()=>ko,FORM_FIELD_KINDS:()=>Mo,FORM_INPUT_TYPES:()=>Lo,LEGACY_SESSION_COOKIE_NAME:()=>ge,MAX_BLOCK_ARMS:()=>Fo,MAX_BLOCK_CHILDREN:()=>Uo,MAX_BLOCK_DEPTH:()=>$o,MAX_BLOCK_NODES:()=>Ko,MAX_BLOCK_TEXT_LEN:()=>jo,MAX_FORM_FIELDS:()=>Bo,MAX_FORM_SELECT_OPTIONS:()=>Go,SNAPSHOT_STORAGE_KEY_PREFIX:()=>ye,STAGE_ATTRIBUTE:()=>rt,armOfResult:()=>ot,attachMicroSignalDetectors:()=>Sn,baselineResultFor:()=>Me,baselineSlots:()=>un,containsFormBlock:()=>yn,deriveSessionSegment:()=>wt,detectDeviceClass:()=>Re,detectTimeOfDay:()=>De,detectTrafficSource:()=>Oe,exposedStage:()=>st,grantConsent:()=>Cn,init:()=>Gn,isDoNotTrackEnabled:()=>We,locatorFromElement:()=>dt,readSnapshot:()=>Ce,referrerDomainFromReferer:()=>Pe,renderPrePaintScript:()=>en,sanitizePageUrl:()=>At,sessionCookieName:()=>be,setStageAttribute:()=>it,toWireSlot:()=>Fe,writeSnapshot:()=>Te});module.exports=Jn(Rr);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 yt(e,t){return new Promise(n=>{let s=setTimeout(()=>n(!1),t),c=()=>{clearTimeout(s),n(!0)};e.then(c,c)})}var Yn;function Zt(e){Yn=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 qe="__sntForgetGen",Zn=()=>{try{return window[qe]}catch(e){return}};function Xe(e){var t,n;try{let s=window,c=(t=s[qe])!=null?t:s[qe]={};c[e]=((n=c[e])!=null?n:0)+1}catch(s){}}function me(e){var t,n;return(n=(t=Zn())==null?void 0:t[e])!=null?n:0}var ye="_snt_snap:";var eo=["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"||!eo.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 s=n.vocabulary;return s!==void 0&&(typeof s!="object"||s===null||!Array.isArray(s.entries)||!Array.isArray(s.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 en(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 Qe(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let s=JSON.parse(n);return Array.isArray(s)?(localStorage.removeItem(e),s.slice(-t)):[]}catch(n){return[]}}function Ke(e,t,n){try{let s=(()=>{try{let r=localStorage.getItem(n);if(!r)return[];let u=JSON.parse(r);return Array.isArray(u)?u:[]}catch(r){return[]}})(),c=new Map;for(let r of s)c.set(r.id,r);for(let r of e)c.set(r.id,r);localStorage.setItem(n,JSON.stringify([...c.values()].slice(-t)))}catch(s){}}function Je(e,t){try{let n=localStorage.getItem(t);if(!n)return;let s=JSON.parse(n);if(!Array.isArray(s))return;let c=new Set(e),r=s.filter(u=>!c.has(u.id));if(r.length===s.length)return;r.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(r))}catch(n){}}var to=500,no=56*1024;function $e(e){return`_snt_retry_${e.slice(0,12)}`}var oo={push:()=>{},flush:()=>{},destroy:()=>{}};function tn(e){var N,ee,ae;if(typeof window=="undefined")return oo;let t=(N=e.flushIntervalMs)!=null?N:5e3,n=(ee=e.maxBatchSize)!=null?ee:20,s=(ae=e.maxRetrySize)!=null?ae:100,c=e.ingestUrl,r=e.apiKey,u=$e(r),o=!1,p=me(r),i=(...k)=>{!o&&me(r)===p&&Ke(...k)},a=[],d=new Set,h=[],y=k=>{for(let B of k)S.delete(B),!d.has(B)&&(d.add(B),h.push(B));for(;h.length>to;){let B=h.shift();B&&d.delete(B)}Je(k,u)},S=new Set,b=()=>{for(;a.length>s;){let k=a.shift();k&&S.delete(k.id)}},P=k=>{d.has(k.id)||S.has(k.id)||(S.add(k.id),a.push(k),b())},O=k=>{for(let B of k)d.has(B.id)||(S.add(B.id),a.push(B));b()},K=Qe(u,s);for(let k of K)P(k);let L=0,W=0,H=(k,B=!0)=>{if(k.length===0)return;let fe=JSON.stringify(k),ve=k.map(re=>re.id),te,we=pe(15e3);try{te=fetch(c,{method:"POST",keepalive:!0,signal:we.signal,body:fe,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}})}catch(re){i(k,s,u),O(k),W++,L=Date.now()+Se(W);return}Promise.resolve(te).then(we.clear,we.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)),H(ke,!1);return}}y(ve),W=0,L=0;return}i(k,s,u),O(k),W++,L=Date.now()+Se(W)};te&&typeof te.then=="function"?te.then(xe).catch(()=>{i(k,s,u),O(k),W++,L=Date.now()+Se(W)}):xe(te)},V=typeof TextEncoder!="undefined"?new TextEncoder:null,f=k=>V?V.encode(k).length:k.length,v=k=>{let B=[],fe=2;for(let ve of k){let te=f(JSON.stringify(ve))+1;if(B.length>0&&fe+te>no||B.length>=n)break;B.push(ve),fe+=te}return B},w=()=>{try{if(Date.now()<L)return;for(;a.length>0&&!(Date.now()<L);){let k=a.filter(fe=>!d.has(fe.id));if(a.length=0,k.length===0)break;let B=v(k);if(B.length===0)break;B.length<k.length&&a.push(...k.slice(B.length)),H(B)}}catch(k){}},m=!0,_=null;_=setInterval(()=>{m&&w()},t);let $=()=>{document.visibilityState==="hidden"&&w()},z=()=>{w()};return document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",z),{push(k){P(k),a.length>=n&&w()},flush:w,destroy(k){k!=null&&k.forget&&(o=!0),m=!1,_!==null&&(clearInterval(_),_=null),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",z),w()}}}var ro=200;function Ue(e){return`_snt_goal_retry_${e.slice(0,12)}`}var so={send:()=>{},flush:()=>{},destroy:()=>{}};function nn(e){var f,v,w;if(typeof window=="undefined")return so;let t=(f=e.flushIntervalMs)!=null?f:5e3,n=(v=e.maxRetrySize)!=null?v:100,s=(w=e.maxPerFlush)!=null?w:5,c=Ue(e.apiKey),r=!1,u=me(e.apiKey),o=(...m)=>{!r&&me(e.apiKey)===u&&Ke(...m)},p=[],i=new Set,a=new Set,d=[],h=0,y=0,S=!1,b=m=>{for(i.delete(m.id),a.has(m.id)||(a.add(m.id),d.push(m.id));d.length>ro;){let _=d.shift();_&&a.delete(_)}Je([m.id],c)},P=m=>{o([m],n,c),!a.has(m.id)&&!i.has(m.id)&&(i.add(m.id),p.push(m)),Date.now()>=h&&(y++,h=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 z=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)),b(m),y=0,h=0};Promise.resolve(_).then($.clear,$.clear),_&&typeof _.then=="function"?_.then(z).catch(()=>P(m)):z(_)},K=()=>{try{if(S||Date.now()<h)return;let m=0;for(;p.length>0&&m<s&&!(Date.now()<h);){let _=p.shift();i.delete(_.id),!a.has(_.id)&&(m++,O(_))}}catch(m){}},L=Qe(c,n);for(let m of L)i.has(m.id)||(i.add(m.id),p.push(m));L.length>0&&Ke(L,n,c);let W=setInterval(K,t),H=()=>{document.visibilityState==="hidden"&&K()},V=()=>K();return document.addEventListener("visibilitychange",H),window.addEventListener("pagehide",V),{send(m){if(S){a.has(m.id)||o([m],n,c);return}if(!(a.has(m.id)||i.has(m.id))){if(Date.now()<h){o([m],n,c),i.add(m.id),p.push(m);return}O(m)}},flush:K,destroy(m){m!=null&&m.forget&&(r=!0),clearInterval(W),document.removeEventListener("visibilitychange",H),window.removeEventListener("pagehide",V),K(),S=!0}}}function on(e){if(typeof window=="undefined"||!e)return!1;Xe(e);let t=!1,n=be(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let u=location.protocol==="https:"?"; Secure":"";document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${u}`,t=!0}}catch(u){}let s=ie(e),c=[n,"_snt_graph_edges",ye+e,$e(e),Ue(e),`_snt_graph_nodes${s}`],r=[`_snt_asgn${s}_`];for(let u of["localStorage","sessionStorage"])try{let o=window[u];for(let p of c)o.getItem(p)!==null&&(o.removeItem(p),t=!0);for(let p=o.length-1;p>=0;p--){let i=o.key(p);i&&r.some(a=>i.startsWith(a))&&(o.removeItem(i),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${ge}=[^;]`).test(document.cookie)||localStorage.getItem(ge)!==null||sessionStorage.getItem(ge)!==null)&&localStorage.setItem(`${ge}_tomb${s}`,"1")}catch(u){}return t}function Ye(){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 rn="_snt_uid",io=365,_e="_snt_uid";function ao(){return Ye()}function ht(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function vt(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function lo(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${vt()}`}catch(s){}}function Ze(e){try{return localStorage.getItem(e)}catch(t){return null}}function sn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function bt(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function co(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function uo(e){try{sessionStorage.removeItem(e)}catch(t){}}function po(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${vt()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function go(e){try{localStorage.removeItem(e)}catch(t){}}function fo(e){try{document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${vt()}`}catch(t){}}var mo={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function et(e){var S,b,P,O,K,L,W;if(typeof window=="undefined")return mo;let t=ie(e==null?void 0:e.apiKey),n=(S=e==null?void 0:e.cookieName)!=null?S:be(e==null?void 0:e.apiKey),s=`${_e}${t}`,c=`${_e}_tomb${t}`,u=((b=e==null?void 0:e.cookieTTLDays)!=null?b:io)*24*60*60,o=H=>H&&H.length>0?H:null,p=()=>{var H,V;return t&&!(e!=null&&e.cookieName)&&Ze(c)===null?(V=(H=o(ht(rn)))!=null?H:o(Ze(_e)))!=null?V:o(bt(_e)):null},i=(W=(L=(K=(O=(P=o(ht(n)))!=null?P:o(Ze(s)))!=null?O:o(bt(s)))!=null?K:p())!=null?L:o(e==null?void 0:e.ssrSessionId))!=null?W:ao();lo(n,i,u);let a=sn(s,i),d=po(n),h=a?!1:co(s,i),y=!a&&!d&&!h;return{getSessionId:()=>i,isEphemeral:()=>y,destroy:()=>{i=null,fo(n),go(s),uo(s),t&&!(e!=null&&e.cookieName)&&(ht(rn)!==null||Ze(_e)!==null||bt(_e)!==null)&&sn(c,"1")}}}var yo=1800*1e3;function tt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function an(e=yo,t){let n=new Map,s=`_snt_asgn${ie(t)}_`,c=(i,a)=>`${s}${encodeURIComponent(i)}:${encodeURIComponent(a)}`,r=i=>{let a=i.slice(s.length),d=a.indexOf(":");if(d<0)return null;try{return{componentId:decodeURIComponent(a.slice(0,d)),segment:decodeURIComponent(a.slice(d+1))}}catch(h){return null}},u=()=>{try{let i=[];for(let a=0;a<localStorage.length;a++){let d=localStorage.key(a);d!=null&&d.startsWith(s)&&i.push(d)}return i}catch(i){return[]}},o=i=>i.assignedAt+(i.ttlMs&&i.ttlMs>0?i.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let i of u())try{let a=localStorage.getItem(i);if(!a)continue;let d=JSON.parse(a);if(o(d)){localStorage.removeItem(i);continue}let h=r(i);if(!h)continue;n.set(tt(h.componentId,h.segment),d)}catch(a){}})(),{get(i,a){let d=n.get(tt(i,a));return d?o(d)?(n.delete(tt(i,a)),null):d:null},set(i,a,d){let h=tt(i,a);n.set(h,d);try{localStorage.setItem(c(i,a),JSON.stringify(d))}catch(y){}},clear(){n.clear();for(let i of u())try{localStorage.removeItem(i)}catch(a){}}}}var ln=["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 nt(e){return cn(e)!==null}function cn(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=ln.find(s=>t.includes(s.toLowerCase())))!=null?n:null}function Re(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 Oe(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(c){}let s=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(s)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(s)?"social":"referral"}catch(n){return"direct"}}function Pe(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var dn=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Et(e){let t={},n={};try{let s=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([c,r])=>{let u=Array.isArray(r)?r[0]:r;return u===void 0?[]:[[c,u]]});for(let[c,r]of s)c.startsWith("utm_")?c in t||(t[c]=r):dn.includes(c)&&(c in n||(n[c]=r))}catch(s){}return{utmParams:t,clickIds:n}}function De(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function wt(e){let t=So("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function So(e,t){var r,u,o,p,i,a,d,h;let n=(u=(r=t==null?void 0:t.userAgent)==null?void 0:r.trim())!=null?u:"",s=(p=(o=t==null?void 0:t.referer)==null?void 0:o.trim())!=null?p:"",c=(i=t==null?void 0:t.now)!=null?i:new Date;return T({sessionId:e,ephemeral:!1,utmParams:(a=t==null?void 0:t.utmParams)!=null?a:{},clickIds:(d=t==null?void 0:t.clickIds)!=null?d:{},deviceClass:n?Re(n):"desktop",trafficSource:s?Oe(s,t==null?void 0:t.appOrigin):"direct",referrerDomain:Pe(s),timeOfDay:De(c),dayOfWeek:(h=["sun","mon","tue","wed","thu","fri","sat"][c.getDay()])!=null?h:"sun",automation:(t==null?void 0:t.webdriver)===!0||nt(n)},t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var Ne=require("@sentientui/policy");function Fe(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 Me(e){let t=Fe(e);return(0,Ne.slotResultFor)(t,(0,Ne.slotBaselineArm)(t))}function un(e){let t={};for(let n of e)t[n.id]=Me(n);return t}function ot(e){return typeof e=="string"?e:(0,Ne.canonicalArm)(e)}var pn=require("@sentientui/policy"),rt="data-sentient-stage";function st(e,t){return!t||typeof e!="string"||!(e==="returning"||pn.STAGE_KEYS.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function it(e,t=document){try{e?t.documentElement.setAttribute(rt,e):t.documentElement.removeAttribute(rt)}catch(n){}}var It=require("@sentientui/policy");var lt=require("@sentientui/policy");var gn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",ho="[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.",fn=!1,at=!1;function bo(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function mn(e){var i;let t=et({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(i=t.getSessionId())!=null?i:"local",s=bo(),c=import("@sentientui/core/local").then(a=>{let d=a;return d.LOCAL_ENGINE_AVAILABLE?(fn||(fn=!0,console.info(ho)),d):(at||(at=!0,console.error(gn)),null)}).catch(()=>(at||(at=!0,console.error(gn)),null)),r=null,u={low:.15,medium:.5,high:.85},o=(()=>{var d;if(e.initialPersona)return T({},e.initialPersona);let a=Ce(e.apiKey||"local");return a?{persona:a.persona,confidence:(d=u[a.band])!=null?d:.15}:null})();function p(a){let d=document.documentElement;d.dataset.sentientPersona===void 0&&(d.dataset.sentientPersona=a.persona,d.dataset.sentientConfidence=(0,lt.confidenceBand)(a.confidence))}return{isLocal:!0,async decide(a){var y,S,b;let d=await c;if(!d)return null;let h=d.createLocalEngine({sessionId:n,forcedPersona:s}).decide(a);return r=oe(T({},h),{layoutOrder:(S=(y=h.layoutOrder)!=null?y:r==null?void 0:r.layoutOrder)!=null?S:null,slots:T(T({},(b=r==null?void 0:r.slots)!=null?b:{}),h.slots)}),Te(e.apiKey||"local",{v:1,persona:r.persona,band:(0,lt.confidenceBand)(r.confidence),slots:r.slots,layoutOrder:r.layoutOrder,savedAt:Date.now()}),p(h),h},getSlotResult(a){var d,h,y;return(y=(h=r==null?void 0:r.slots[a])!=null?h:(d=e.initialSlots)==null?void 0:d[a])!=null?y:null},getSlotConfig(a){var d,h;return(h=(d=e.initialSlotConfig)==null?void 0:d[a])!=null?h:null},getSitePalette(){var a;return(a=e.initialPalette)!=null?a:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let a=r!=null?r:o;return a?{persona:a.persona,confidence:a.confidence,band:(0,lt.confidenceBand)(a.confidence)}:null},async assign(a,d){var S;let h=await c;return!h||!d||d.length===0?d!=null&&d[0]?{variantId:d[0],assignmentTtlMs:0}:null:{variantId:(S=h.createLocalEngine({sessionId:n,forcedPersona:s}).decide({components:[{id:a,variantIds:d}]}).assignments[a])!=null?S:d[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var vo=["none","sm","md","lg"],Eo=["start","center","end","stretch"],wo=["start","center","end","between"],xo=["sm","md","lg"],ko=["normal","medium","bold"],Io=["default","muted","accent"],Co=["primary","secondary","ghost"],To=["left","center","right"],Ao=["auto","square","landscape","wide"],_o=["cover","contain"],Ro=[2,3,4],Oo=[1,2,3,4],Po=["default","raised"],Do=["none","sm","md","lg"],No=["measure"],Mo=["input","textarea","select"],Lo=["text","email","number","tel"],Bo=5,Go=8,Ko=64,$o=5,Uo=12,Fo=4,jo=500;function yn(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(yn):!1}function Sn(e,t,n,s){let c=[];{let o=!1,p=[],i=()=>{if(o)return;let a=Date.now();for(p.push(a);p.length>0&&a-p[0]>500;)p.shift();p.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",i),c.push(()=>t.removeEventListener("click",i))}{let r=!1,u=o=>{if(r||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;r=!0;let p=typeof window!="undefined"?window.getSelection():null,i=p?p.toString().length:0;e("text_copy",{selectionLength:i})};document.addEventListener("copy",u),c.push(()=>document.removeEventListener("copy",u))}{let r=!1,u=!1,o=null,p=()=>{o!==null&&(clearTimeout(o),o=null)},i=()=>{r||!u||(p(),o=setTimeout(()=>{!r&&u&&(r=!0,e("scroll_hesitation"))},3e3))},a=()=>{p(),i()},d=y=>{for(let S of y)u=S.intersectionRatio>.3,u?i():p()},h=new IntersectionObserver(d,{threshold:[.3]});h.observe(t),window.addEventListener("scroll",a,{passive:!0}),c.push(()=>{h.disconnect(),window.removeEventListener("scroll",a),p()})}if((s==null?void 0:s.tabLoss)!==!1){let r=!1,u=n!=null?n:Date.now(),o=()=>{if(r||document.visibilityState!=="hidden")return;let p=Date.now()-u;p<15e3&&(r=!0,e("tab_loss",{timeOnPage:p}))};document.addEventListener("visibilitychange",o),c.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let r of c)r()}}function Wo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var En="https://api.sentient-ui.com/v1/events",J=new Map,wn=null;function xn(e,t){let n=J.get(e);n&&n.upgrade&&(n.reinit=t)}function Vo(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Ho=3;function xt(){return Ye()}function ct(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function zo(){let e=new WeakMap,t=new Map,n=!1,s=(o,p,i)=>{let a=o.get(p);return i===null?a?!0:(o.set(p,new Set),!1):a?a.has(i)?!0:(a.add(i),!1):(o.set(p,new Set([i])),!1)},c=typeof window!="undefined"&&"event"in window,r=()=>{if(!c)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},u=()=>{if(c){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 i=new MessageChannel;i.port1.onmessage=()=>{i.port1.close(),i.port2.close(),p()},i.port2.postMessage(0)}};return{firedBefore(o,p){let i=r();if(i){let d=e.get(i);return d||(d=new Map,e.set(i,d)),s(d,o,p)}let a=s(t,o,p);return!a&&!n&&(n=!0,u()),a}}}var kn=new Set;function qo(e,t,n){let s=typeof window=="undefined"?null:window.history;if(!s)return()=>{};let c=!1,r,u=()=>{if(c)return;let i=ct();!i||i===r||(r=i,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${i}`))},o=[];for(let i of["pushState","replaceState"]){let a=s[i],d=function(...h){let y=a.apply(this,h);return u(),y};s[i]=d,o.push([i,a,d])}window.addEventListener("popstate",u);let p=ct();return p&&kn.has(`${t}:${p}`)?r=p:u(),()=>{if(!c){c=!0,window.removeEventListener("popstate",u);for(let[i,a,d]of o)s[i]===d&&(s[i]=a)}}}var je={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 Xo(){try{return Et(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function In(e){return e.replace(/\/events\/?$/,"")}function We(){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 Cn(e){var p;if(typeof window=="undefined")return;let t=e!=null?e:wn;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:s,upgrade:c,reinit:r}=n;if(!c){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(s.respectDoNotTrack!==!1&&We())return;let u=(r!=null?r:Tt)(oe(T({},s),{consent:!0}));c(u);let o=(p=J.get(t))==null?void 0:p.dispose;J.set(t,{config:oe(T({},s),{consent:!0}),upgrade:null,dispose:o})}function Qo(e,t){var V;let n=e.preConsentBehavior==="statistical_winner",s=In((V=e.ingestUrl)!=null?V:En),c={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},r=new Map,u=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(f,v,w){if(!n)return Promise.resolve(null);let m=r.get(f);return m?Promise.resolve(m):Ct(u,f,async()=>{try{let _=new URLSearchParams({componentId:f});for(let ee of v!=null?v:[])_.append("variantIds[]",ee);let $=pe(5e3),z;try{let ee=await fetch(`${s}/winner?${_.toString()}`,{headers:c,signal:$.signal});if(!ee.ok)return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null;z=await ee.json()}finally{$.clear()}let N={variantId:z.variantId,assignmentTtlMs:0};return r.set(f,N),N}catch(_){return v!=null&&v[0]?{variantId:v[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,i=new Set,a=[],d=[],h=[],y=()=>{for(let[,,f]of h.splice(0))f(null);S.length=0},S=[],b=!1,P=()=>{if(p)return;b=!0;let f=J.get(e.apiKey);(f==null?void 0:f.upgrade)===H&&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(v){}O.length&&K()})},L=f=>{p?O.length?O.push(f):f(o):!t&&!b&&S.length<100?S.push(f):b&&e.debug&&console.warn("[sentient] goal dropped: client released")},W={get gated(){return!p&&!t},get released(){return b&&!p},takeHeld:()=>S.splice(0),track:f=>o.track(f),goal:((f,v,w,m)=>L(_=>_.goal(f,v,w,m))),componentGoal:(f,v,w)=>o.componentGoal(f,v,w),identify:f=>o.identify(f),getAssignment:(f,v)=>o.getAssignment(f,v),isUnified:f=>{var v,w;return(w=(v=o.isUnified)==null?void 0:v.call(o,f))!=null?w:!1},assign:(f,v,w,m,_)=>o.assign(f,v,w,m,_),decide:f=>p?o.decide(f):b||t?Promise.resolve(null):new Promise(v=>h.push([f,vn(),v])),getSlotResult:f=>o.getSlotResult(f),isSlotDecided:f=>{var v,w;return(w=(v=o.isSlotDecided)==null?void 0:v.call(o,f))!=null?w:!0},getSlotConfig:f=>o.getSlotConfig(f),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var f,v;return(v=(f=o.getStyleVocabulary)==null?void 0:f.call(o))!=null?v:null},reportSlots:(f,v,w,m)=>o.reportSlots(f,v,w,m),reportSkeleton:(f,v)=>{var w;return(w=o.reportSkeleton)==null?void 0:w.call(o,f,v)},reportAgentData:(f,v,w)=>{var m;return(m=o.reportAgentData)==null?void 0:m.call(o,f,v,w)},reportDrift:(f,v,w,m)=>{var _;return(_=o.reportDrift)==null?void 0:_.call(o,f,v,w,m)},requestSlots:(f,v,w)=>{var m;return p?(m=o.requestSlots)==null?void 0:m.call(o,f,v,w):a.push([f,v,w])},decideSlots:f=>{var v;return p?(v=o.decideSlots)==null?void 0:v.call(o,f):d.push(...f)},cancelSlots:f=>{var w;if(p)return(w=o.cancelSlots)==null?void 0:w.call(o,f);let v=new Set(f);for(let m of a)m[0]=m[0].filter(_=>!v.has(_));d=d.filter(m=>!v.has(m.id))},onSlotsChanged:f=>(i.add(f),()=>{i.delete(f)}),getPersona:()=>o.getPersona(),getVisitorId:()=>{var f,v;return(v=(f=o.getVisitorId)==null?void 0:f.call(o))!=null?v:null},fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(P(),y(),o.dispose()),destroy:()=>(P(),y(),p?o.destroy():on(e.apiKey))};function H(f){var w,m,_;o=f,p=!0,S.length&&(O.push(...S.splice(0)),K());let v=vn();for(let[$,z,N]of h.splice(0))z!==v?N(null):f.decide($).then(N,()=>N(null));(w=f.onSlotsChanged)==null||w.call(f,()=>i.forEach($=>$()));for(let[$,z,N]of a.splice(0))$.length>0&&((m=f.requestSlots)==null||m.call(f,$,z,N));d.length>0&&((_=f.decideSlots)==null||_.call(f,d.splice(0)))}return{proxy:W,setInner:H}}function vn(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Ct(e,t,n){let s=e.get(t);if(s)return s;let c=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,c),c}function Tt(e){var Lt,Bt,Gt,Kt,$t,Ut,Ft,jt,Wt,Vt,Ht;if(typeof window=="undefined")return je;e.nonce&&Zt(e.nonce),wn=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&&We(),s=e.consent===!1||n,c=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!c&&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."}),s?je:mn(e);if(s){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."}),je;let{proxy:l,setInner:g}=Qo(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."),je;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),je;let r=(Lt=e.ingestUrl)!=null?Lt:En,u=Date.now(),o=et({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),p=an(void 0,e.apiKey),i=!1,a=me(e.apiKey),d=()=>!i&&me(e.apiKey)===a,h=new Set((Bt=e.initialUnified)!=null?Bt:[]),y=oe(T({},p),{get:(l,g)=>h.has(l)?null:p.get(l,g),set:(...l)=>{d()&&p.set(...l)}}),S=tn({ingestUrl:r,apiKey:e.apiKey}),b=In(r),P={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},O=new Set,K=nn({url:`${b}/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=Re((Gt=navigator.userAgent)!=null?Gt:""),W=window.location.origin,H=Oe((Kt=document.referrer)!=null?Kt:"",W),V=($t=e.sessionSegment)!=null?$t:`${L}:${H}`,f=new Map,v=new Map,w=new Map,m=new Set,_=new Map,$=null,z=null,N=null,ee=new Set,ae=new Set,k=new Map,B=new Map,fe=new Set,ve=new Set,te=new Set,we=new Set,xe=null,re=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,ke=new Set,le=new Set,He=new Set,Le=new Map,pt=null,ze=new Set,Be=new Map,gt=null,Kn=2,Pt=new Map,se=!1,Dt=(l,g,E)=>{var x;let R=new Set,D=1;for(let I of l){g.delete(I);let C=((x=Pt.get(I))!=null?x:0)+1;Pt.set(I,C),C<=Kn&&(R.add(I),C>D&&(D=C))}R.size>0&&setTimeout(()=>{se||E(R)},Se(D))},ft=l=>{for(let g of l)w.has(g.id)||w.set(g.id,Me(g))};if(e.initialSlots)for(let[l,g]of Object.entries(e.initialSlots))w.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&&(z=e.initialVocabulary);let ce=Ce(e.apiKey);if(ce){for(let[l,g]of Object.entries(ce.slots))w.has(l)||w.set(l,g);for(let[l,g]of Object.entries((Ut=ce.slotConfig)!=null?Ut:{}))_.has(l)||_.set(l,g);!$&&ce.palette&&($=ce.palette),!z&&ce.vocabulary&&(z=ce.vocabulary)}let Nt={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:(jt=Nt[(Ft=l.sentientConfidence)!=null?Ft:"low"])!=null?jt:.15}:ce&&(N={persona:ce.persona,confidence:(Wt=Nt[ce.band])!=null?Wt:.15})}if(e.initialAssignments)for(let[l,g]of Object.entries(e.initialAssignments))y.set(l,V,{variantId:g,assignedAt:Date.now(),segment:V,confidence:1});let he=Promise.resolve(),Mt=o.getSessionId();if(Mt){let l=Pe((Vt=document.referrer)!=null?Vt:""),{utmParams:g,clickIds:E}=Xo(),R=T(T(T(T({sessionId:Mt,deviceClass:L,trafficSource:H,referrerDomain:l,utmParams:g,clickIds:E,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:De(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||nt((Ht=navigator.userAgent)!=null?Ht:"")},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(`${b}/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>=Ho){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:S});let $n=zo(),Ee=null,mt=!1,X={goal(l,g={},E=1,R=0){var q,G,Y,ne,Z,Q,A;let D=o.getSessionId();if(!D||se||!d())return;let x=Vo(g)?g:{metadata:g},I=[l,(q=x.externalId)!=null?q:"",(G=x.stepIndex)!=null?G:R,(Y=x.weight)!=null?Y:E].join("\0"),C=x.value!==void 0?`${x.value}\0${(ne=x.currency)!=null?ne:""}`:null;if($n.firedBefore(I,C)){e.debug&&console.log(`[sentient] goal("${l}") already recorded for this action \u2014 not sent twice`);return}let U=xt(),M={sessionId:D,name:l,metadata:(Z=x.metadata)!=null?Z:{},weight:(Q=x.weight)!=null?Q:E,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,E){var U,M,F;let R=o.getSessionId();if(!R||se||!d())return;let D=y.get(l,V),x=D?null:(U=w.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:ot(x),C={id:xt(),sessionId:R,projectId:e.apiKey,componentId:l,variantId:I,eventType:"goal_achieved",goalType:g,payload:T({reward:(M=E==null?void 0:E.reward)!=null?M:1,goalValue:E==null?void 0:E.value,currency:E==null?void 0:E.currency},(F=E==null?void 0:E.metadata)!=null?F:{}),timestamp:Date.now(),timeInSession:Date.now()-u,path:ct()};e.debug&&console.log("[sentient] componentGoal",C),he.then(()=>{!se&&d()&&S.push(C)})},identify(l){let g=o.getSessionId();!g||se||!d()||he.then(()=>{fetch(`${b}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:g,userId:l,ephemeral:o.isEphemeral()}),headers:P}).catch(()=>{})})},track(l){let g=o.getSessionId();if(!g||se||!d()||l.eventType==="variant_assigned"&&w.get(l.componentId)!==void 0&&!m.has(l.componentId)&&!y.get(l.componentId,V))return;let E=oe(T({path:ct()},l),{id:xt(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-u});e.debug&&console.log("[sentient] track",E),he.then(()=>S.push(E))},getAssignment(l,g){return y.get(l,g)},isUnified:l=>h.has(l),async assign(l,g,E,R,D){var U;let x=o.getSessionId();if(!x)return null;let I=(D==null?void 0:D.unified)===!0;if(I&&h.has(l))return{variantId:(U=g==null?void 0:g[0])!=null?U:"",assignmentTtlMs:0,unified:!0};let C=y.get(l,V);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 Ct(f,I?`${l}\0unified`:l,async()=>{if(!await yt(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:E!==void 0&&(F.agentData=E),I&&(F.caps={unified:!0});let q=await fetch(`${b}/assign`,{method:"POST",body:JSON.stringify(F),headers:P,signal:M.signal});if(!q.ok)return null;let G=await q.json();return G.unified===!0?I?(h.add(l),{variantId:G.variantId,assignmentTtlMs:0,unified:!0}):null:(y.set(l,V,T({variantId:G.variantId,assignedAt:Date.now(),segment:V,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 E=(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:[],E.length>0&&(R.slots=E.map(Fe)),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 Ct(v,D,async()=>{var U,M,F,q,G,Y,ne,Z;if(!await yt(he,2500)||se||!d())return ft(E),null;let C=pe(3e4);try{let Q=await fetch(`${b}/decide`,{method:"POST",body:D,headers:P,signal:C.signal});if(!Q.ok)return ft(E),null;let A=await Q.json(),de=st(A.stage,e.stageAttributes);e.stageAttributes&&it(de);let Ie={};for(let j of E){let ue=(U=A.slots)==null?void 0:U[j.id];if(ue!==void 0){Ie[j.id]=ue,w.set(j.id,ue),m.add(j.id);continue}let zt=w.get(j.id);if(zt!==void 0)Ie[j.id]=zt;else{let qt=Me(j);Ie[j.id]=qt,w.set(j.id,qt)}}if(A.slots)for(let[j,ue]of Object.entries(A.slots))j in Ie||(Ie[j]=ue,w.set(j,ue),m.add(j));let Un=N!=null&&N.persona!=="unknown";A.persona&&!(A.persona==="unknown"&&Un)?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,V,{variantId:ue,assignedAt:Date.now(),segment:V,confidence:1});if(A.slotConfig)for(let[j,ue]of Object.entries(A.slotConfig))_.set(j,ue);A.palette&&($=A.palette),A.vocabulary&&(z=A.vocabulary);for(let j of(q=l.registrySlotIds)!=null?q:[])(G=A.slotConfig)!=null&&G[j]||(_.delete(j),w.delete(j),m.delete(j));return d()&&Te(e.apiKey,T(T(T(T({v:1,persona:N.persona,band:(0,It.confidenceBand)(N.confidence),slots:Object.fromEntries(w),layoutOrder:(Y=A.layoutOrder)!=null?Y:null,savedAt:Date.now()},_.size>0?{slotConfig:Object.fromEntries(_)}:{}),$?{palette:$}:{}),z?{vocabulary:z}:{}),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 ft(E),null}finally{C.clear()}})},getSlotResult(l){var g;return(g=w.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,E,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(`${b}/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)){Wo()&&!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=E==null?void 0:E[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 q of U){let G=k.get(q);G!==void 0&&(M[q]=G,k.delete(q));let Y=B.get(q);Y!==void 0&&(F[q]=Y,B.delete(q))}fetch(`${b}/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(q=>[q,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(`${b}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify({slotIds:[l],baselineSkeletons:{[l]:g}})}).catch(()=>{}))},reportAgentData(l,g,E){let R=`${l}|${g}`;!re.test(l)||we.has(R)||(we.add(R),fetch(`${b}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify(T({slotIds:[l],agentData:{[l]:{[g]:E}}},g.startsWith("authored.")?{authoredArms:{[l]:[{key:g.slice(9)}]}}:{}))}).catch(()=>{}))},reportDrift(l,g,E,R){let D=`${l}|${g}`,x=o.getSessionId();!x||ve.has(D)||(ve.add(D),fetch(`${b}/slots/drift`,{method:"POST",headers:P,body:JSON.stringify({sessionId:x,reports:[{slotId:l,expectedFp:g,observedFp:E,reason:R}]})}).catch(()=>{}))},requestSlots(l,g,E){var R,D;for(let x of l)He.has(x)||(He.add(x),re.test(x)?Le.set(x,{text:g==null?void 0:g[x],render:(R=E==null?void 0:E.render)==null?void 0:R[x],skeleton:(D=E==null?void 0:E.skeletons)==null?void 0:D[x]}):X.reportSlots([x]));Le.size===0||pt!=null||(pt=setTimeout(()=>{pt=null;let x=[...Le];Le.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);X.decide({slotsFrom:"registry",registrySlotIds:C.map(([M])=>M),bootstrap:!1,render:U}).then(M=>{var F,q;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&&((q=X.reportSkeleton)==null||q.call(X,Z,Q.skeleton));continue}ne.push(Z),Q.text&&(G[Z]=Q.text),Q.skeleton&&(Y[Z]=Q.skeleton)}ne.length>0&&X.reportSlots(ne,G,Y)}else Dt(C.map(([G])=>G),He,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=X.requestSlots)==null||Q.call(X,[...G],Y,{render:ne,skeletons:Z})});le.forEach(G=>G())})}},0))},decideSlots(l){for(let g of l)ze.has(g.id)||(ze.add(g.id),Be.set(g.id,g));Be.size===0||gt!=null||(gt=setTimeout(()=>{gt=null;let g=[...Be.values()];Be.clear();for(let E=0;E<g.length;E+=30){let R=g.slice(E,E+30);X.decide({slots:R}).then(D=>{D||Dt(R.map(x=>x.id),ze,x=>{var I;return(I=X.decideSlots)==null?void 0:I.call(X,R.filter(C=>x.has(C.id)))}),le.forEach(x=>x())})}},0))},cancelSlots(l){for(let g of l)Le.delete(g)&&He.delete(g),Be.delete(g)&&ze.delete(g)},onSlotsChanged(l){return le.add(l),()=>{le.delete(l)}},getStyleVocabulary(){return z},getSitePalette(){return $},getVisitorId:()=>d()?o.getSessionId():null,getPersona(){return N?{persona:N.persona,confidence:N.confidence,band:(0,It.confidenceBand)(N.confidence)}:null},async fetchWeights(){var g;let l=pe(5e3);try{let E=await fetch(`${b}/weights`,{headers:P,signal:l.signal});return E.ok?(g=(await E.json()).components)!=null?g:[]:[]}catch(E){return[]}finally{l.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){S.flush(),K.flush()},dispose(){var l;Ee==null||Ee(),mt=!0,se=!0,S.destroy(),K.destroy(),((l=J.get(e.apiKey))==null?void 0:l.dispose)===X.dispose&&J.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var l;Ee==null||Ee(),mt=!0,se=!0,i=!0,Xe(e.apiKey),S.destroy({forget:!0}),K.destroy({forget:!0}),o.destroy(),y.clear(),((l=J.get(e.apiKey))==null?void 0:l.dispose)===X.dispose&&J.delete(e.apiKey);try{localStorage.removeItem(ye+e.apiKey),localStorage.removeItem($e(e.apiKey)),localStorage.removeItem(Ue(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:X.dispose}),Ee=qo(X,e.apiKey,l=>{he.then(()=>{mt||kn.add(l)})}),e.debug){let l=window;l.__sentient&&(l.__sentient.client=X)}return X}var Tn="_snt_graph_edges",Jo={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function Yo(e){var t;return(t=Jo[e])!=null?t:[]}function Zo(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function er(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var tr=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function nr(e){return tr.has(e)?e:"generic"}function At(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function or(e,t,n){let s=`${e}:${t}:${n.join(",")}`,c=5381;for(let r=0;r<s.length;r++)c=(c<<5)+c+s.charCodeAt(r)&4294967295;return(c>>>0).toString(16).padStart(8,"0")}function An(e){let t=new Map,n=new Map,s=`_snt_graph_nodes${ie(e==null?void 0:e.apiKey)}`,c=()=>{typeof window!="undefined"&&er(s,[...t.values()])};if(typeof window!="undefined"){let r=Zo(s,[]);for(let u of r)t.set(u.componentId,u);try{localStorage.removeItem(Tn)}catch(u){}}return{addPageNode(r){t.set(r.componentId,r),c()},addStructuralEdge(r){let u=`${r.fromComponentId}->${r.toComponentId}`;n.set(u,r)},syncOnce(){var u,o;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let r=[...t.values()];if(r.length!==0)try{let p=new Map;for(let y of r){let S=(u=p.get(y.semanticType))!=null?u:[];S.push(y),p.set(y.semanticType,S)}let i=[],a=new Set;for(let y of r)for(let S of Yo(y.semanticType)){let b=(o=p.get(S))!=null?o:[];for(let P of b){if(P.componentId===y.componentId)continue;let O=`semantic:${y.componentId}->${P.componentId}`;a.has(O)||(a.add(O),i.push({fromComponentId:y.componentId,toComponentId:P.componentId,type:"semantic",weight:.4,confidence:.9}))}}let d=new Set(r.map(y=>y.componentId));for(let y of n.values()){if(!d.has(y.fromComponentId)||!d.has(y.toComponentId))continue;let S=`structural:${y.fromComponentId}->${y.toComponentId}`;a.has(S)||(a.add(S),i.push({fromComponentId:y.fromComponentId,toComponentId:y.toComponentId,type:"structural",weight:y.weight,confidence:1}))}let h=oe(T(T({pageUrl:At(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:r.map(y=>{let S=nr(y.semanticType);return{componentId:y.componentId,semanticType:S,answers:y.answers,contentHash:or(y.componentId,S,y.answers),prominenceScore:y.prominenceScore,depthInPage:y.depth}}),edges:i});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:T({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(h)}).catch(()=>{})}catch(p){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(s),localStorage.removeItem(Tn)}catch(r){}}}}var rr=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function _t(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function sr(e){return{tag:e.tagName.toLowerCase(),text:_t(e).slice(0,40)}}function _n(e){return e.replace(/["\\\]]/g,"\\$&")}function Ve(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Rn(e,t){var u;let n=e.tagName.toLowerCase();if(!n)return null;let s=((u=e.getAttribute("class"))!=null?u:"").split(/\s+/).filter(o=>/^[a-zA-Z][\w-]*$/.test(o)),c=[n,...s.map(o=>`${n}.${o}`)];for(let o of c)if(Ve(t,o))return o;let r=e.parentElement;if(r&&r!==t){let o=Rn(r,t);if(o){for(let d of c){let h=`${o} > ${d}`;if(Ve(t,h))return h}let p=Array.from(r.children).filter(d=>d.tagName.toLowerCase()===n),i=p.indexOf(e),a=p.some(d=>d!==e&&_t(d)!==_t(e));if(i>=0&&a){let d=`${o} > ${n}:nth-of-type(${i+1})`;if(Ve(t,d))return d}}}return null}function dt(e,t){let n=sr(e),s=e.getAttribute("id");if(s&&Ve(t,`#${_n(s)}`))return{v:1,id:s,fingerprint:n};for(let r of rr){let u=e.getAttribute(r);if(u&&Ve(t,`[${r}="${_n(u)}"]`))return{v:1,dataAttr:{name:r,value:u},fingerprint:n}}let c=Rn(e,t);return c?{v:1,selector:c,fingerprint:n}:null}var Pn=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],ir={banner:"hero",navigation:"navigation",contentinfo:"footer"};function ar(e){let t=e.ariaRole?ir[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 lr(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var cr=[["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]],dr=[["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]],On={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function ur(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function pr(e){var c,r;let t=ar(e);if(t)return{type:(c=On[t])!=null?c:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[u,o]of cr)if(o.test(n))return{type:u,strength:"strong"};for(let[u,o]of dr)if(o.test(e.bodyText))return{type:u,strength:"strong"};let s=lr(e);return{type:(r=On[s])!=null?r:"generic",strength:"weak"}}function gr(e){var s,c;let t=((s=e.textContent)!=null?s:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return T({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((c=e.className)!=null?c:"")}`,headingText:ur(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function Dn(e){return pr(gr(e)).type}var fr=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),mr=200,yr="h1, h2, h3",Sr="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",Nn=30,hr=1500,br={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function Mn(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function vr(e){var t,n,s;try{let c=e;for(let r of Object.keys(c)){if(!r.startsWith("__reactFiber")&&!r.startsWith("__reactInternalInstance"))continue;let u=c[r],o=(s=(t=u==null?void 0:u.type)==null?void 0:t.displayName)!=null?s:(n=u==null?void 0:u.type)==null?void 0:n.name;if(o&&o.length>1)return o}}catch(c){}}function Er(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var Rt=new Set(Pn);function wr(e,t){let n=e.getAttribute("data-sentient-id"),s=n?t==null?void 0:t[n]:void 0;if(s&&Rt.has(s))return s;let c=e.getAttribute("data-sentient-type");if(c&&Rt.has(c))return c;let r=e.getAttribute("role");return r&&Rt.has(r)?r:Dn(e)}function xr(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 kr(e){let t=[],n=e;for(;n;){let s=n.parentElement;if(!s){t.push(n.tagName.toLowerCase());break}let c=Array.prototype.indexOf.call(s.children,n);t.push(`${n.tagName.toLowerCase()}[${c}]`),n=s}return t.reverse().join("/")}function Ir(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${xr(kr(e))}`}function Cr(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function Ot(e,t,n){var c,r,u,o;let s=e.querySelector(yr);return{componentId:Ir(e),semanticType:wr(e,n),ariaLabel:(c=e.getAttribute("aria-label"))!=null?c:void 0,headingText:(u=(r=s==null?void 0:s.textContent)==null?void 0:r.trim())!=null?u:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:Cr(e),reactComponentName:vr(e),dataAttributes:Er(e),locator:(o=dt(e,e.ownerDocument))!=null?o:void 0}}function Ln(e){var r;let t=[],n=new Set,s="__root__",c=new Map;for(let[u,o]of e){let p=u.parentElement,i=s;for(;p;){if(e.has(p)){i=e.get(p);let d=e.get(u),h=`${i}->${d}`;!n.has(h)&&i!==d&&(n.add(h),t.push({fromComponentId:i,toComponentId:d,weight:.6}));break}p=p.parentElement}let a=(r=c.get(i))!=null?r:[];a.push(u),c.set(i,a)}for(let u of c.values()){if(u.length<2)continue;let o=u.length>Nn?u.slice(0,Nn):u;for(let p=0;p<o.length;p++)for(let i=p+1;i<o.length;i++){if(t.length>=hr)return t;let a=e.get(o[p]),d=e.get(o[i]);if(a===d)continue;let h=`${a}->${d}::sib`,y=`${d}->${a}::sib`;n.has(h)||(n.add(h),t.push({fromComponentId:a,toComponentId:d,weight:.3})),n.has(y)||(n.add(y),t.push({fromComponentId:d,toComponentId:a,weight:.3}))}}return t}function Tr(e,t){let n=[],s=new Set,c=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(o=>{if(o instanceof Element&&!s.has(o)){s.add(o);let p=Ot(o,e,t);n.push(p),c.set(o,p.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(o=>{if(!(o instanceof Element)||s.has(o))return;let p=o.hasAttribute("aria-label"),i=o.hasAttribute("data-sentient-id");if(!p&&!i)return;s.add(o);let a=Ot(o,e,t);n.push(a),c.set(o,a.componentId)}),{nodes:n,edges:Ln(c),elementToId:c}}function Bn(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return br;let n=null,s=0,c=null,r=new Map,u=y=>{try{let S=window.getComputedStyle(y),b=parseFloat(S.fontSize)||12,P=parseFloat(S.zIndex)||0,O=y.getBoundingClientRect(),K=Math.max(O.top,0),L=window.innerHeight||1,W=1/(K/L+1),H=Mn(b,12,48)*.4+W*.4+Mn(P,0,100)*.2;return Math.max(0,Math.min(1,H))}catch(S){return .5}},o=()=>new Promise(y=>{let S=()=>{let{nodes:b,edges:P,elementToId:O}=Tr(u,t);r.clear();for(let[K,L]of O)r.set(K,L);y({nodes:b,edges:P,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?s=requestIdleCallback(S,{timeout:100}):S()}catch(b){S()}}),p=new Set,i=null,a=()=>{i=null;let y=[...p];p.clear();let S=[],b=new Set;for(let O of y){if(!O.isConnected)continue;let K=[];fr.has(O.tagName)&&(O.hasAttribute("data-sentient-id")||O.hasAttribute("aria-label"))&&K.push(O);try{O.querySelectorAll(Sr).forEach(L=>K.push(L))}catch(L){}for(let L of K){if(r.has(L))continue;let W=Ot(L,u,t);S.push(W),b.add(W.componentId),r.set(L,W.componentId)}}if(S.length===0||!c)return;for(let O of[...r.keys()])O.isConnected||r.delete(O);let P=Ln(r).filter(O=>b.has(O.fromComponentId)||b.has(O.toComponentId));c({nodes:S,edges:P,addedAt:Date.now()})};return{scan:o,observe:y=>{c=y;try{n=new MutationObserver(S=>{for(let b of S)b.type==="childList"&&b.addedNodes.forEach(P=>{P instanceof Element&&p.add(P)});p.size>0&&i===null&&(i=setTimeout(a,mr))}),n.observe(document.body,{childList:!0,subtree:!0})}catch(S){}},getProminenceScore:u,destroy:()=>{if(n&&(n.disconnect(),n=null),i!==null&&clearTimeout(i),i=null,p.clear(),s&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(s)}catch(y){}s=0,c=null,r.clear()}}}var Ar="https://api.sentient-ui.com/v1/events";function _r(e){var n;let t=s=>{try{let c=document.cookie.match(new RegExp(`(?:^|; )${s}=([^;]*)`));return c?decodeURIComponent(c[1]):void 0}catch(c){return}};return(n=e?t(be(e)):void 0)!=null?n:t(ge)}var ut=new Map;function Gn(e){var y;let t=Tt(e),n=e.respectDoNotTrack!==!1&&We(),s=e.consent===!1||n,c=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),r=e.localMode===!0||!c;if(!e.graph||r||typeof window=="undefined")return t;if(s)return n||xn(e.apiKey,S=>Gn(S)),t;let u=ut.get(e.apiKey);if(u)try{u()}catch(S){}let o=Bn({sectionTypes:e.sectionTypes}),p=(y=e.ingestUrl)!=null?y:Ar,i=An({syncUrl:p.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:_r(e.apiKey)});o.scan().then(S=>{for(let b of S.nodes)i.addPageNode({id:b.componentId,componentId:b.componentId,semanticType:b.semanticType,answers:e.captureDomText&&b.headingText?[b.headingText]:[],prominenceScore:b.prominenceScore,depth:b.depth});for(let b of S.edges)i.addStructuralEdge(b);i.syncOnce()});let a=null,d=()=>{a!==null&&clearTimeout(a),a=setTimeout(()=>{a=null,i.syncOnce()},500)};o.observe(S=>{for(let b of S.nodes)i.addPageNode({id:b.componentId,componentId:b.componentId,semanticType:b.semanticType,answers:e.captureDomText&&b.headingText?[b.headingText]:[],prominenceScore:b.prominenceScore,depth:b.depth});for(let b of S.edges)i.addStructuralEdge(b);d()});let h=()=>{a!==null&&(clearTimeout(a),a=null),o.destroy(),i.destroy(),ut.get(e.apiKey)===h&&ut.delete(e.apiKey)};return ut.set(e.apiKey,h),oe(T({},t),{getGraph:()=>i.snapshot(),dispose:()=>{h(),t.dispose()},destroy:()=>{h(),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 Fn=Object.create;var Ge=Object.defineProperty,jn=Object.defineProperties,Wn=Object.getOwnPropertyDescriptor,Vn=Object.getOwnPropertyDescriptors,Hn=Object.getOwnPropertyNames,Xt=Object.getOwnPropertySymbols,zn=Object.getPrototypeOf,Jt=Object.prototype.hasOwnProperty,qn=Object.prototype.propertyIsEnumerable;var Qt=(e,t,n)=>t in e?Ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,T=(e,t)=>{for(var n in t||(t={}))Jt.call(t,n)&&Qt(e,n,t[n]);if(Xt)for(var n of Xt(t))qn.call(t,n)&&Qt(e,n,t[n]);return e},oe=(e,t)=>jn(e,Vn(t));var Xn=(e,t)=>{for(var n in t)Ge(e,n,{get:t[n],enumerable:!0})},Yt=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let c of Hn(t))!Jt.call(e,c)&&c!==n&&Ge(e,c,{get:()=>t[c],enumerable:!(s=Wn(t,c))||s.enumerable});return e};var Qn=(e,t,n)=>(n=e!=null?Fn(zn(e)):{},Yt(t||!e||!e.__esModule?Ge(n,"default",{value:e,enumerable:!0}):n,e)),Jn=e=>Yt(Ge({},"__esModule",{value:!0}),e);var Rr={};Xn(Rr,{BLOCK_ALIGNS:()=>Eo,BLOCK_EMPHASES:()=>Co,BLOCK_FITS:()=>_o,BLOCK_GAPS:()=>vo,BLOCK_GRID_COLUMNS:()=>Ro,BLOCK_HEADING_LEVELS:()=>Oo,BLOCK_JUSTIFIES:()=>wo,BLOCK_MAX_WIDTHS:()=>No,BLOCK_PADS:()=>Do,BLOCK_RATIOS:()=>Ao,BLOCK_SIZES:()=>xo,BLOCK_SURFACES:()=>Po,BLOCK_TEXT_ALIGNS:()=>To,BLOCK_TONES:()=>Io,BLOCK_WEIGHTS:()=>ko,FORM_FIELD_KINDS:()=>Mo,FORM_INPUT_TYPES:()=>Lo,LEGACY_SESSION_COOKIE_NAME:()=>ge,MAX_BLOCK_ARMS:()=>Fo,MAX_BLOCK_CHILDREN:()=>Uo,MAX_BLOCK_DEPTH:()=>$o,MAX_BLOCK_NODES:()=>Ko,MAX_BLOCK_TEXT_LEN:()=>jo,MAX_FORM_FIELDS:()=>Bo,MAX_FORM_SELECT_OPTIONS:()=>Go,SNAPSHOT_STORAGE_KEY_PREFIX:()=>ye,STAGE_ATTRIBUTE:()=>rt,armOfResult:()=>ot,attachMicroSignalDetectors:()=>Sn,baselineResultFor:()=>Me,baselineSlots:()=>un,containsFormBlock:()=>yn,deriveSessionSegment:()=>wt,detectDeviceClass:()=>Re,detectTimeOfDay:()=>De,detectTrafficSource:()=>Oe,exposedStage:()=>st,grantConsent:()=>Cn,init:()=>Gn,isDoNotTrackEnabled:()=>We,locatorFromElement:()=>dt,readSnapshot:()=>Ce,referrerDomainFromReferer:()=>Pe,renderPrePaintScript:()=>en,sanitizePageUrl:()=>At,sessionCookieName:()=>be,setStageAttribute:()=>it,toWireSlot:()=>Fe,writeSnapshot:()=>Te});module.exports=Jn(Rr);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 yt(e,t){return new Promise(n=>{let s=setTimeout(()=>n(!1),t),c=()=>{clearTimeout(s),n(!0)};e.then(c,c)})}var Yn;function Zt(e){Yn=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 qe="__sntForgetGen",Zn=()=>{try{return window[qe]}catch(e){return}};function Xe(e){var t,n;try{let s=window,c=(t=s[qe])!=null?t:s[qe]={};c[e]=((n=c[e])!=null?n:0)+1}catch(s){}}function me(e){var t,n;return(n=(t=Zn())==null?void 0:t[e])!=null?n:0}var ye="_snt_snap:";var eo=["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"||!eo.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 s=n.vocabulary;return s!==void 0&&(typeof s!="object"||s===null||!Array.isArray(s.entries)||!Array.isArray(s.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 en(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 Qe(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let s=JSON.parse(n);return Array.isArray(s)?(localStorage.removeItem(e),s.slice(-t)):[]}catch(n){return[]}}function Ke(e,t,n){try{let s=(()=>{try{let r=localStorage.getItem(n);if(!r)return[];let u=JSON.parse(r);return Array.isArray(u)?u:[]}catch(r){return[]}})(),c=new Map;for(let r of s)c.set(r.id,r);for(let r of e)c.set(r.id,r);localStorage.setItem(n,JSON.stringify([...c.values()].slice(-t)))}catch(s){}}function Je(e,t){try{let n=localStorage.getItem(t);if(!n)return;let s=JSON.parse(n);if(!Array.isArray(s))return;let c=new Set(e),r=s.filter(u=>!c.has(u.id));if(r.length===s.length)return;r.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(r))}catch(n){}}var to=500,no=56*1024;function $e(e){return`_snt_retry_${e.slice(0,12)}`}var oo={push:()=>{},flush:()=>{},destroy:()=>{}};function tn(e){var N,ee,ae;if(typeof window=="undefined")return oo;let t=(N=e.flushIntervalMs)!=null?N:5e3,n=(ee=e.maxBatchSize)!=null?ee:20,s=(ae=e.maxRetrySize)!=null?ae:100,c=e.ingestUrl,r=e.apiKey,u=$e(r),o=!1,p=me(r),i=(...k)=>{!o&&me(r)===p&&Ke(...k)},a=[],d=new Set,h=[],y=k=>{for(let B of k)S.delete(B),!d.has(B)&&(d.add(B),h.push(B));for(;h.length>to;){let B=h.shift();B&&d.delete(B)}Je(k,u)},S=new Set,b=()=>{for(;a.length>s;){let k=a.shift();k&&S.delete(k.id)}},P=k=>{d.has(k.id)||S.has(k.id)||(S.add(k.id),a.push(k),b())},O=k=>{for(let B of k)d.has(B.id)||(S.add(B.id),a.push(B));b()},K=Qe(u,s);for(let k of K)P(k);let L=0,W=0,H=(k,B=!0)=>{if(k.length===0)return;let fe=JSON.stringify(k),ve=k.map(re=>re.id),te,we=pe(15e3);try{te=fetch(c,{method:"POST",keepalive:!0,signal:we.signal,body:fe,headers:{"Content-Type":"application/json",Authorization:`Bearer ${r}`}})}catch(re){i(k,s,u),O(k),W++,L=Date.now()+Se(W);return}Promise.resolve(te).then(we.clear,we.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)),H(ke,!1);return}}y(ve),W=0,L=0;return}i(k,s,u),O(k),W++,L=Date.now()+Se(W)};te&&typeof te.then=="function"?te.then(xe).catch(()=>{i(k,s,u),O(k),W++,L=Date.now()+Se(W)}):xe(te)},V=typeof TextEncoder!="undefined"?new TextEncoder:null,f=k=>V?V.encode(k).length:k.length,v=k=>{let B=[],fe=2;for(let ve of k){let te=f(JSON.stringify(ve))+1;if(B.length>0&&fe+te>no||B.length>=n)break;B.push(ve),fe+=te}return B},w=()=>{try{if(Date.now()<L)return;for(;a.length>0&&!(Date.now()<L);){let k=a.filter(fe=>!d.has(fe.id));if(a.length=0,k.length===0)break;let B=v(k);if(B.length===0)break;B.length<k.length&&a.push(...k.slice(B.length)),H(B)}}catch(k){}},m=!0,_=null;_=setInterval(()=>{m&&w()},t);let $=()=>{document.visibilityState==="hidden"&&w()},z=()=>{w()};return document.addEventListener("visibilitychange",$),window.addEventListener("pagehide",z),{push(k){P(k),a.length>=n&&w()},flush:w,destroy(k){k!=null&&k.forget&&(o=!0),m=!1,_!==null&&(clearInterval(_),_=null),document.removeEventListener("visibilitychange",$),window.removeEventListener("pagehide",z),w()}}}var ro=200;function Ue(e){return`_snt_goal_retry_${e.slice(0,12)}`}var so={send:()=>{},flush:()=>{},destroy:()=>{}};function nn(e){var f,v,w;if(typeof window=="undefined")return so;let t=(f=e.flushIntervalMs)!=null?f:5e3,n=(v=e.maxRetrySize)!=null?v:100,s=(w=e.maxPerFlush)!=null?w:5,c=Ue(e.apiKey),r=!1,u=me(e.apiKey),o=(...m)=>{!r&&me(e.apiKey)===u&&Ke(...m)},p=[],i=new Set,a=new Set,d=[],h=0,y=0,S=!1,b=m=>{for(i.delete(m.id),a.has(m.id)||(a.add(m.id),d.push(m.id));d.length>ro;){let _=d.shift();_&&a.delete(_)}Je([m.id],c)},P=m=>{o([m],n,c),!a.has(m.id)&&!i.has(m.id)&&(i.add(m.id),p.push(m)),Date.now()>=h&&(y++,h=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 z=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)),b(m),y=0,h=0};Promise.resolve(_).then($.clear,$.clear),_&&typeof _.then=="function"?_.then(z).catch(()=>P(m)):z(_)},K=()=>{try{if(S||Date.now()<h)return;let m=0;for(;p.length>0&&m<s&&!(Date.now()<h);){let _=p.shift();i.delete(_.id),!a.has(_.id)&&(m++,O(_))}}catch(m){}},L=Qe(c,n);for(let m of L)i.has(m.id)||(i.add(m.id),p.push(m));L.length>0&&Ke(L,n,c);let W=setInterval(K,t),H=()=>{document.visibilityState==="hidden"&&K()},V=()=>K();return document.addEventListener("visibilitychange",H),window.addEventListener("pagehide",V),{send(m){if(S){a.has(m.id)||o([m],n,c);return}if(!(a.has(m.id)||i.has(m.id))){if(Date.now()<h){o([m],n,c),i.add(m.id),p.push(m);return}O(m)}},flush:K,destroy(m){m!=null&&m.forget&&(r=!0),clearInterval(W),document.removeEventListener("visibilitychange",H),window.removeEventListener("pagehide",V),K(),S=!0}}}function on(e){if(typeof window=="undefined"||!e)return!1;Xe(e);let t=!1,n=be(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let u=location.protocol==="https:"?"; Secure":"";document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${u}`,t=!0}}catch(u){}let s=ie(e),c=[n,"_snt_graph_edges",ye+e,$e(e),Ue(e),`_snt_graph_nodes${s}`],r=[`_snt_asgn${s}_`];for(let u of["localStorage","sessionStorage"])try{let o=window[u];for(let p of c)o.getItem(p)!==null&&(o.removeItem(p),t=!0);for(let p=o.length-1;p>=0;p--){let i=o.key(p);i&&r.some(a=>i.startsWith(a))&&(o.removeItem(i),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${ge}=[^;]`).test(document.cookie)||localStorage.getItem(ge)!==null||sessionStorage.getItem(ge)!==null)&&localStorage.setItem(`${ge}_tomb${s}`,"1")}catch(u){}return t}function Ye(){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 rn="_snt_uid",io=365,_e="_snt_uid";function ao(){return Ye()}function ht(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function vt(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function lo(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${vt()}`}catch(s){}}function Ze(e){try{return localStorage.getItem(e)}catch(t){return null}}function sn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function bt(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function co(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function uo(e){try{sessionStorage.removeItem(e)}catch(t){}}function po(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${vt()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function go(e){try{localStorage.removeItem(e)}catch(t){}}function fo(e){try{document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${vt()}`}catch(t){}}var mo={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function et(e){var S,b,P,O,K,L,W;if(typeof window=="undefined")return mo;let t=ie(e==null?void 0:e.apiKey),n=(S=e==null?void 0:e.cookieName)!=null?S:be(e==null?void 0:e.apiKey),s=`${_e}${t}`,c=`${_e}_tomb${t}`,u=((b=e==null?void 0:e.cookieTTLDays)!=null?b:io)*24*60*60,o=H=>H&&H.length>0?H:null,p=()=>{var H,V;return t&&!(e!=null&&e.cookieName)&&Ze(c)===null?(V=(H=o(ht(rn)))!=null?H:o(Ze(_e)))!=null?V:o(bt(_e)):null},i=(W=(L=(K=(O=(P=o(ht(n)))!=null?P:o(Ze(s)))!=null?O:o(bt(s)))!=null?K:p())!=null?L:o(e==null?void 0:e.ssrSessionId))!=null?W:ao();lo(n,i,u);let a=sn(s,i),d=po(n),h=a?!1:co(s,i),y=!a&&!d&&!h;return{getSessionId:()=>i,isEphemeral:()=>y,destroy:()=>{i=null,fo(n),go(s),uo(s),t&&!(e!=null&&e.cookieName)&&(ht(rn)!==null||Ze(_e)!==null||bt(_e)!==null)&&sn(c,"1")}}}var yo=1800*1e3;function tt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function an(e=yo,t){let n=new Map,s=`_snt_asgn${ie(t)}_`,c=(i,a)=>`${s}${encodeURIComponent(i)}:${encodeURIComponent(a)}`,r=i=>{let a=i.slice(s.length),d=a.indexOf(":");if(d<0)return null;try{return{componentId:decodeURIComponent(a.slice(0,d)),segment:decodeURIComponent(a.slice(d+1))}}catch(h){return null}},u=()=>{try{let i=[];for(let a=0;a<localStorage.length;a++){let d=localStorage.key(a);d!=null&&d.startsWith(s)&&i.push(d)}return i}catch(i){return[]}},o=i=>i.assignedAt+(i.ttlMs&&i.ttlMs>0?i.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let i of u())try{let a=localStorage.getItem(i);if(!a)continue;let d=JSON.parse(a);if(o(d)){localStorage.removeItem(i);continue}let h=r(i);if(!h)continue;n.set(tt(h.componentId,h.segment),d)}catch(a){}})(),{get(i,a){let d=n.get(tt(i,a));return d?o(d)?(n.delete(tt(i,a)),null):d:null},set(i,a,d){let h=tt(i,a);n.set(h,d);try{localStorage.setItem(c(i,a),JSON.stringify(d))}catch(y){}},clear(){n.clear();for(let i of u())try{localStorage.removeItem(i)}catch(a){}}}}var ln=["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 nt(e){return cn(e)!==null}function cn(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=ln.find(s=>t.includes(s.toLowerCase())))!=null?n:null}function Re(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 Oe(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(c){}let s=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(s)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(s)?"social":"referral"}catch(n){return"direct"}}function Pe(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var dn=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Et(e){let t={},n={};try{let s=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([c,r])=>{let u=Array.isArray(r)?r[0]:r;return u===void 0?[]:[[c,u]]});for(let[c,r]of s)c.startsWith("utm_")?c in t||(t[c]=r):dn.includes(c)&&(c in n||(n[c]=r))}catch(s){}return{utmParams:t,clickIds:n}}function De(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function wt(e){let t=So("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function So(e,t){var r,u,o,p,i,a,d,h;let n=(u=(r=t==null?void 0:t.userAgent)==null?void 0:r.trim())!=null?u:"",s=(p=(o=t==null?void 0:t.referer)==null?void 0:o.trim())!=null?p:"",c=(i=t==null?void 0:t.now)!=null?i:new Date;return T({sessionId:e,ephemeral:!1,utmParams:(a=t==null?void 0:t.utmParams)!=null?a:{},clickIds:(d=t==null?void 0:t.clickIds)!=null?d:{},deviceClass:n?Re(n):"desktop",trafficSource:s?Oe(s,t==null?void 0:t.appOrigin):"direct",referrerDomain:Pe(s),timeOfDay:De(c),dayOfWeek:(h=["sun","mon","tue","wed","thu","fri","sat"][c.getDay()])!=null?h:"sun",automation:(t==null?void 0:t.webdriver)===!0||nt(n)},t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var Ne=require("@sentientui/policy");function Fe(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 Me(e){let t=Fe(e);return(0,Ne.slotResultFor)(t,(0,Ne.slotBaselineArm)(t))}function un(e){let t={};for(let n of e)t[n.id]=Me(n);return t}function ot(e){return typeof e=="string"?e:(0,Ne.canonicalArm)(e)}var pn=require("@sentientui/policy"),rt="data-sentient-stage";function st(e,t){return!t||typeof e!="string"||!(e==="returning"||pn.STAGE_KEYS.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function it(e,t=document){try{e?t.documentElement.setAttribute(rt,e):t.documentElement.removeAttribute(rt)}catch(n){}}var It=require("@sentientui/policy");var lt=require("@sentientui/policy");var gn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",ho="[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.",fn=!1,at=!1;function bo(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function mn(e){var i;let t=et({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(i=t.getSessionId())!=null?i:"local",s=bo(),c=import("@sentientui/core/local").then(a=>{let d=a;return d.LOCAL_ENGINE_AVAILABLE?(fn||(fn=!0,console.info(ho)),d):(at||(at=!0,console.error(gn)),null)}).catch(()=>(at||(at=!0,console.error(gn)),null)),r=null,u={low:.15,medium:.5,high:.85},o=(()=>{var d;if(e.initialPersona)return T({},e.initialPersona);let a=Ce(e.apiKey||"local");return a?{persona:a.persona,confidence:(d=u[a.band])!=null?d:.15}:null})();function p(a){let d=document.documentElement;d.dataset.sentientPersona===void 0&&(d.dataset.sentientPersona=a.persona,d.dataset.sentientConfidence=(0,lt.confidenceBand)(a.confidence))}return{isLocal:!0,async decide(a){var y,S,b;let d=await c;if(!d)return null;let h=d.createLocalEngine({sessionId:n,forcedPersona:s}).decide(a);return r=oe(T({},h),{layoutOrder:(S=(y=h.layoutOrder)!=null?y:r==null?void 0:r.layoutOrder)!=null?S:null,slots:T(T({},(b=r==null?void 0:r.slots)!=null?b:{}),h.slots)}),Te(e.apiKey||"local",{v:1,persona:r.persona,band:(0,lt.confidenceBand)(r.confidence),slots:r.slots,layoutOrder:r.layoutOrder,savedAt:Date.now()}),p(h),h},getSlotResult(a){var d,h,y;return(y=(h=r==null?void 0:r.slots[a])!=null?h:(d=e.initialSlots)==null?void 0:d[a])!=null?y:null},getSlotConfig(a){var d,h;return(h=(d=e.initialSlotConfig)==null?void 0:d[a])!=null?h:null},getSitePalette(){var a;return(a=e.initialPalette)!=null?a:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let a=r!=null?r:o;return a?{persona:a.persona,confidence:a.confidence,band:(0,lt.confidenceBand)(a.confidence)}:null},async assign(a,d){var S;let h=await c;return!h||!d||d.length===0?d!=null&&d[0]?{variantId:d[0],assignmentTtlMs:0}:null:{variantId:(S=h.createLocalEngine({sessionId:n,forcedPersona:s}).decide({components:[{id:a,variantIds:d}]}).assignments[a])!=null?S:d[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var vo=["none","sm","md","lg"],Eo=["start","center","end","stretch"],wo=["start","center","end","between"],xo=["sm","md","lg"],ko=["normal","medium","bold"],Io=["default","muted","accent"],Co=["primary","secondary","ghost"],To=["left","center","right"],Ao=["auto","square","landscape","wide"],_o=["cover","contain"],Ro=[2,3,4],Oo=[1,2,3,4],Po=["default","raised"],Do=["none","sm","md","lg"],No=["measure"],Mo=["input","textarea","select"],Lo=["text","email","number","tel"],Bo=5,Go=8,Ko=64,$o=5,Uo=12,Fo=4,jo=500;function yn(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(yn):!1}function Sn(e,t,n,s){let c=[];{let o=!1,p=[],i=()=>{if(o)return;let a=Date.now();for(p.push(a);p.length>0&&a-p[0]>500;)p.shift();p.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",i),c.push(()=>t.removeEventListener("click",i))}{let r=!1,u=o=>{if(r||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;r=!0;let p=typeof window!="undefined"?window.getSelection():null,i=p?p.toString().length:0;e("text_copy",{selectionLength:i})};document.addEventListener("copy",u),c.push(()=>document.removeEventListener("copy",u))}{let r=!1,u=!1,o=null,p=()=>{o!==null&&(clearTimeout(o),o=null)},i=()=>{r||!u||(p(),o=setTimeout(()=>{!r&&u&&(r=!0,e("scroll_hesitation"))},3e3))},a=()=>{p(),i()},d=y=>{for(let S of y)u=S.intersectionRatio>.3,u?i():p()},h=new IntersectionObserver(d,{threshold:[.3]});h.observe(t),window.addEventListener("scroll",a,{passive:!0}),c.push(()=>{h.disconnect(),window.removeEventListener("scroll",a),p()})}if((s==null?void 0:s.tabLoss)!==!1){let r=!1,u=n!=null?n:Date.now(),o=()=>{if(r||document.visibilityState!=="hidden")return;let p=Date.now()-u;p<15e3&&(r=!0,e("tab_loss",{timeOnPage:p}))};document.addEventListener("visibilitychange",o),c.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let r of c)r()}}function Wo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var En="https://api.sentient-ui.com/v1/events",J=new Map,wn=null;function xn(e,t){let n=J.get(e);n&&n.upgrade&&(n.reinit=t)}function Vo(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Ho=3;function xt(){return Ye()}function ct(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function zo(){let e=new WeakMap,t=new Map,n=!1,s=(o,p,i)=>{let a=o.get(p);return i===null?a?!0:(o.set(p,new Set),!1):a?a.has(i)?!0:(a.add(i),!1):(o.set(p,new Set([i])),!1)},c=typeof window!="undefined"&&"event"in window,r=()=>{if(!c)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},u=()=>{if(c){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 i=new MessageChannel;i.port1.onmessage=()=>{i.port1.close(),i.port2.close(),p()},i.port2.postMessage(0)}};return{firedBefore(o,p){let i=r();if(i){let d=e.get(i);return d||(d=new Map,e.set(i,d)),s(d,o,p)}let a=s(t,o,p);return!a&&!n&&(n=!0,u()),a}}}var kn=new Set;function qo(e,t,n){let s=typeof window=="undefined"?null:window.history;if(!s)return()=>{};let c=!1,r,u=()=>{if(c)return;let i=ct();!i||i===r||(r=i,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${i}`))},o=[];for(let i of["pushState","replaceState"]){let a=s[i],d=function(...h){let y=a.apply(this,h);return u(),y};s[i]=d,o.push([i,a,d])}window.addEventListener("popstate",u);let p=ct();return p&&kn.has(`${t}:${p}`)?r=p:u(),()=>{if(!c){c=!0,window.removeEventListener("popstate",u);for(let[i,a,d]of o)s[i]===d&&(s[i]=a)}}}var je={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 Xo(){try{return Et(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function In(e){return e.replace(/\/events\/?$/,"")}function We(){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 Cn(e){var p;if(typeof window=="undefined")return;let t=e!=null?e:wn;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:s,upgrade:c,reinit:r}=n;if(!c){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(s.respectDoNotTrack!==!1&&We())return;let u=(r!=null?r:Tt)(oe(T({},s),{consent:!0}));c(u);let o=(p=J.get(t))==null?void 0:p.dispose;J.set(t,{config:oe(T({},s),{consent:!0}),upgrade:null,dispose:o})}function Qo(e,t){var V;let n=e.preConsentBehavior==="statistical_winner",s=In((V=e.ingestUrl)!=null?V:En),c={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},r=new Map,u=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(f,v,w){if(!n)return Promise.resolve(null);let m=r.get(f);return m?Promise.resolve(m):Ct(u,f,async()=>{try{let _=new URLSearchParams({componentId:f});for(let ee of v!=null?v:[])_.append("variantIds[]",ee);let $=pe(5e3),z;try{let ee=await fetch(`${s}/winner?${_.toString()}`,{headers:c,signal:$.signal});if(!ee.ok)return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null;z=await ee.json()}finally{$.clear()}let N={variantId:z.variantId,assignmentTtlMs:0};return r.set(f,N),N}catch(_){return v!=null&&v[0]?{variantId:v[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,i=new Set,a=[],d=[],h=[],y=()=>{for(let[,,f]of h.splice(0))f(null);S.length=0},S=[],b=!1,P=()=>{if(p)return;b=!0;let f=J.get(e.apiKey);(f==null?void 0:f.upgrade)===H&&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(v){}O.length&&K()})},L=f=>{p?O.length?O.push(f):f(o):!t&&!b&&S.length<100?S.push(f):b&&e.debug&&console.warn("[sentient] goal dropped: client released")},W={get gated(){return!p&&!t},get released(){return b&&!p},takeHeld:()=>S.splice(0),track:f=>o.track(f),goal:((f,v,w,m)=>L(_=>_.goal(f,v,w,m))),componentGoal:(f,v,w)=>o.componentGoal(f,v,w),identify:f=>o.identify(f),getAssignment:(f,v)=>o.getAssignment(f,v),isUnified:f=>{var v,w;return(w=(v=o.isUnified)==null?void 0:v.call(o,f))!=null?w:!1},assign:(f,v,w,m,_)=>o.assign(f,v,w,m,_),decide:f=>p?o.decide(f):b||t?Promise.resolve(null):new Promise(v=>h.push([f,vn(),v])),getSlotResult:f=>o.getSlotResult(f),isSlotDecided:f=>{var v,w;return(w=(v=o.isSlotDecided)==null?void 0:v.call(o,f))!=null?w:!0},getSlotConfig:f=>o.getSlotConfig(f),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var f,v;return(v=(f=o.getStyleVocabulary)==null?void 0:f.call(o))!=null?v:null},reportSlots:(f,v,w,m)=>o.reportSlots(f,v,w,m),reportSkeleton:(f,v)=>{var w;return(w=o.reportSkeleton)==null?void 0:w.call(o,f,v)},reportAgentData:(f,v,w)=>{var m;return(m=o.reportAgentData)==null?void 0:m.call(o,f,v,w)},reportDrift:(f,v,w,m)=>{var _;return(_=o.reportDrift)==null?void 0:_.call(o,f,v,w,m)},requestSlots:(f,v,w)=>{var m;return p?(m=o.requestSlots)==null?void 0:m.call(o,f,v,w):a.push([f,v,w])},decideSlots:f=>{var v;return p?(v=o.decideSlots)==null?void 0:v.call(o,f):d.push(...f)},cancelSlots:f=>{var w;if(p)return(w=o.cancelSlots)==null?void 0:w.call(o,f);let v=new Set(f);for(let m of a)m[0]=m[0].filter(_=>!v.has(_));d=d.filter(m=>!v.has(m.id))},onSlotsChanged:f=>(i.add(f),()=>{i.delete(f)}),getPersona:()=>o.getPersona(),getVisitorId:()=>{var f,v;return(v=(f=o.getVisitorId)==null?void 0:f.call(o))!=null?v:null},fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(P(),y(),o.dispose()),destroy:()=>(P(),y(),p?o.destroy():on(e.apiKey))};function H(f){var w,m,_;o=f,p=!0,S.length&&(O.push(...S.splice(0)),K());let v=vn();for(let[$,z,N]of h.splice(0))z!==v?N(null):f.decide($).then(N,()=>N(null));(w=f.onSlotsChanged)==null||w.call(f,()=>i.forEach($=>$()));for(let[$,z,N]of a.splice(0))$.length>0&&((m=f.requestSlots)==null||m.call(f,$,z,N));d.length>0&&((_=f.decideSlots)==null||_.call(f,d.splice(0)))}return{proxy:W,setInner:H}}function vn(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Ct(e,t,n){let s=e.get(t);if(s)return s;let c=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,c),c}function Tt(e){var Lt,Bt,Gt,Kt,$t,Ut,Ft,jt,Wt,Vt,Ht;if(typeof window=="undefined")return je;e.nonce&&Zt(e.nonce),wn=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&&We(),s=e.consent===!1||n,c=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!c&&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."}),s?je:mn(e);if(s){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."}),je;let{proxy:l,setInner:g}=Qo(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."),je;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),je;let r=(Lt=e.ingestUrl)!=null?Lt:En,u=Date.now(),o=et({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),p=an(void 0,e.apiKey),i=!1,a=me(e.apiKey),d=()=>!i&&me(e.apiKey)===a,h=new Set((Bt=e.initialUnified)!=null?Bt:[]),y=oe(T({},p),{get:(l,g)=>h.has(l)?null:p.get(l,g),set:(...l)=>{d()&&p.set(...l)}}),S=tn({ingestUrl:r,apiKey:e.apiKey}),b=In(r),P={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},O=new Set,K=nn({url:`${b}/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=Re((Gt=navigator.userAgent)!=null?Gt:""),W=window.location.origin,H=Oe((Kt=document.referrer)!=null?Kt:"",W),V=($t=e.sessionSegment)!=null?$t:`${L}:${H}`,f=new Map,v=new Map,w=new Map,m=new Set,_=new Map,$=null,z=null,N=null,ee=new Set,ae=new Set,k=new Map,B=new Map,fe=new Set,ve=new Set,te=new Set,we=new Set,xe=null,re=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,ke=new Set,le=new Set,He=new Set,Le=new Map,pt=null,ze=new Set,Be=new Map,gt=null,Kn=2,Pt=new Map,se=!1,Dt=(l,g,E)=>{var x;let R=new Set,D=1;for(let I of l){g.delete(I);let C=((x=Pt.get(I))!=null?x:0)+1;Pt.set(I,C),C<=Kn&&(R.add(I),C>D&&(D=C))}R.size>0&&setTimeout(()=>{se||E(R)},Se(D))},ft=l=>{for(let g of l)w.has(g.id)||w.set(g.id,Me(g))};if(e.initialSlots)for(let[l,g]of Object.entries(e.initialSlots))w.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&&(z=e.initialVocabulary);let ce=Ce(e.apiKey);if(ce){for(let[l,g]of Object.entries(ce.slots))w.has(l)||w.set(l,g);for(let[l,g]of Object.entries((Ut=ce.slotConfig)!=null?Ut:{}))_.has(l)||_.set(l,g);!$&&ce.palette&&($=ce.palette),!z&&ce.vocabulary&&(z=ce.vocabulary)}let Nt={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:(jt=Nt[(Ft=l.sentientConfidence)!=null?Ft:"low"])!=null?jt:.15}:ce&&(N={persona:ce.persona,confidence:(Wt=Nt[ce.band])!=null?Wt:.15})}if(e.initialAssignments)for(let[l,g]of Object.entries(e.initialAssignments))y.set(l,V,{variantId:g,assignedAt:Date.now(),segment:V,confidence:1});let he=Promise.resolve(),Mt=o.getSessionId();if(Mt){let l=Pe((Vt=document.referrer)!=null?Vt:""),{utmParams:g,clickIds:E}=Xo(),R=T(T(T(T({sessionId:Mt,deviceClass:L,trafficSource:H,referrerDomain:l,utmParams:g,clickIds:E,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:De(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||nt((Ht=navigator.userAgent)!=null?Ht:"")},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(`${b}/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>=Ho){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:S});let $n=zo(),Ee=null,mt=!1,X={goal(l,g={},E=1,R=0){var q,G,Y,ne,Z,Q,A;let D=o.getSessionId();if(!D||se||!d())return;let x=Vo(g)?g:{metadata:g},I=[l,(q=x.externalId)!=null?q:"",(G=x.stepIndex)!=null?G:R,(Y=x.weight)!=null?Y:E].join("\0"),C=x.value!==void 0?`${x.value}\0${(ne=x.currency)!=null?ne:""}`:null;if($n.firedBefore(I,C)){e.debug&&console.log(`[sentient] goal("${l}") already recorded for this action \u2014 not sent twice`);return}let U=xt(),M={sessionId:D,name:l,metadata:(Z=x.metadata)!=null?Z:{},weight:(Q=x.weight)!=null?Q:E,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,E){var U,M,F;let R=o.getSessionId();if(!R||se||!d())return;let D=y.get(l,V),x=D?null:(U=w.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:ot(x),C={id:xt(),sessionId:R,projectId:e.apiKey,componentId:l,variantId:I,eventType:"goal_achieved",goalType:g,payload:T({reward:(M=E==null?void 0:E.reward)!=null?M:1,goalValue:E==null?void 0:E.value,currency:E==null?void 0:E.currency},(F=E==null?void 0:E.metadata)!=null?F:{}),timestamp:Date.now(),timeInSession:Date.now()-u,path:ct()};e.debug&&console.log("[sentient] componentGoal",C),he.then(()=>{!se&&d()&&S.push(C)})},identify(l){let g=o.getSessionId();!g||se||!d()||he.then(()=>{fetch(`${b}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:g,userId:l,ephemeral:o.isEphemeral()}),headers:P}).catch(()=>{})})},track(l){let g=o.getSessionId();if(!g||se||!d()||l.eventType==="variant_assigned"&&w.get(l.componentId)!==void 0&&!m.has(l.componentId)&&!y.get(l.componentId,V))return;let E=oe(T({path:ct()},l),{id:xt(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-u});e.debug&&console.log("[sentient] track",E),he.then(()=>S.push(E))},getAssignment(l,g){return y.get(l,g)},isUnified:l=>h.has(l),async assign(l,g,E,R,D){var U;let x=o.getSessionId();if(!x)return null;let I=(D==null?void 0:D.unified)===!0;if(I&&h.has(l))return{variantId:(U=g==null?void 0:g[0])!=null?U:"",assignmentTtlMs:0,unified:!0};let C=y.get(l,V);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 Ct(f,I?`${l}\0unified`:l,async()=>{if(!await yt(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:E!==void 0&&(F.agentData=E),I&&(F.caps={unified:!0});let q=await fetch(`${b}/assign`,{method:"POST",body:JSON.stringify(F),headers:P,signal:M.signal});if(!q.ok)return null;let G=await q.json();return G.unified===!0?I?(h.add(l),{variantId:G.variantId,assignmentTtlMs:0,unified:!0}):null:(y.set(l,V,T({variantId:G.variantId,assignedAt:Date.now(),segment:V,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 E=(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:[],E.length>0&&(R.slots=E.map(Fe)),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 Ct(v,D,async()=>{var U,M,F,q,G,Y,ne,Z;if(!await yt(he,2500)||se||!d())return ft(E),null;let C=pe(3e4);try{let Q=await fetch(`${b}/decide`,{method:"POST",body:D,headers:P,signal:C.signal});if(!Q.ok)return ft(E),null;let A=await Q.json(),de=st(A.stage,e.stageAttributes);e.stageAttributes&&it(de);let Ie={};for(let j of E){let ue=(U=A.slots)==null?void 0:U[j.id];if(ue!==void 0){Ie[j.id]=ue,w.set(j.id,ue),m.add(j.id);continue}let zt=w.get(j.id);if(zt!==void 0)Ie[j.id]=zt;else{let qt=Me(j);Ie[j.id]=qt,w.set(j.id,qt)}}if(A.slots)for(let[j,ue]of Object.entries(A.slots))j in Ie||(Ie[j]=ue,w.set(j,ue),m.add(j));let Un=N!=null&&N.persona!=="unknown";A.persona&&!(A.persona==="unknown"&&Un)?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,V,{variantId:ue,assignedAt:Date.now(),segment:V,confidence:1});if(A.slotConfig)for(let[j,ue]of Object.entries(A.slotConfig))_.set(j,ue);A.palette&&($=A.palette),A.vocabulary&&(z=A.vocabulary);for(let j of(q=l.registrySlotIds)!=null?q:[])(G=A.slotConfig)!=null&&G[j]||(_.delete(j),w.delete(j),m.delete(j));return d()&&Te(e.apiKey,T(T(T(T({v:1,persona:N.persona,band:(0,It.confidenceBand)(N.confidence),slots:Object.fromEntries(w),layoutOrder:(Y=A.layoutOrder)!=null?Y:null,savedAt:Date.now()},_.size>0?{slotConfig:Object.fromEntries(_)}:{}),$?{palette:$}:{}),z?{vocabulary:z}:{}),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 ft(E),null}finally{C.clear()}})},getSlotResult(l){var g;return(g=w.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,E,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(`${b}/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)){Wo()&&!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=E==null?void 0:E[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 q of U){let G=k.get(q);G!==void 0&&(M[q]=G,k.delete(q));let Y=B.get(q);Y!==void 0&&(F[q]=Y,B.delete(q))}fetch(`${b}/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(q=>[q,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(`${b}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify({slotIds:[l],baselineSkeletons:{[l]:g}})}).catch(()=>{}))},reportAgentData(l,g,E){let R=`${l}|${g}`;!re.test(l)||we.has(R)||(we.add(R),fetch(`${b}/slots/observed`,{method:"POST",headers:P,body:JSON.stringify(T(T({slotIds:[l],agentData:{[l]:{[g]:E}}},g.startsWith("authored.")?{authoredArms:{[l]:[{key:g.slice(9)}]}}:{}),o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{}))},reportDrift(l,g,E,R){let D=`${l}|${g}`,x=o.getSessionId();!x||ve.has(D)||(ve.add(D),fetch(`${b}/slots/drift`,{method:"POST",headers:P,body:JSON.stringify({sessionId:x,reports:[{slotId:l,expectedFp:g,observedFp:E,reason:R}]})}).catch(()=>{}))},requestSlots(l,g,E){var R,D;for(let x of l)He.has(x)||(He.add(x),re.test(x)?Le.set(x,{text:g==null?void 0:g[x],render:(R=E==null?void 0:E.render)==null?void 0:R[x],skeleton:(D=E==null?void 0:E.skeletons)==null?void 0:D[x]}):X.reportSlots([x]));Le.size===0||pt!=null||(pt=setTimeout(()=>{pt=null;let x=[...Le];Le.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);X.decide({slotsFrom:"registry",registrySlotIds:C.map(([M])=>M),bootstrap:!1,render:U}).then(M=>{var F,q;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&&((q=X.reportSkeleton)==null||q.call(X,Z,Q.skeleton));continue}ne.push(Z),Q.text&&(G[Z]=Q.text),Q.skeleton&&(Y[Z]=Q.skeleton)}ne.length>0&&X.reportSlots(ne,G,Y)}else Dt(C.map(([G])=>G),He,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=X.requestSlots)==null||Q.call(X,[...G],Y,{render:ne,skeletons:Z})});le.forEach(G=>G())})}},0))},decideSlots(l){for(let g of l)ze.has(g.id)||(ze.add(g.id),Be.set(g.id,g));Be.size===0||gt!=null||(gt=setTimeout(()=>{gt=null;let g=[...Be.values()];Be.clear();for(let E=0;E<g.length;E+=30){let R=g.slice(E,E+30);X.decide({slots:R}).then(D=>{D||Dt(R.map(x=>x.id),ze,x=>{var I;return(I=X.decideSlots)==null?void 0:I.call(X,R.filter(C=>x.has(C.id)))}),le.forEach(x=>x())})}},0))},cancelSlots(l){for(let g of l)Le.delete(g)&&He.delete(g),Be.delete(g)&&ze.delete(g)},onSlotsChanged(l){return le.add(l),()=>{le.delete(l)}},getStyleVocabulary(){return z},getSitePalette(){return $},getVisitorId:()=>d()?o.getSessionId():null,getPersona(){return N?{persona:N.persona,confidence:N.confidence,band:(0,It.confidenceBand)(N.confidence)}:null},async fetchWeights(){var g;let l=pe(5e3);try{let E=await fetch(`${b}/weights`,{headers:P,signal:l.signal});return E.ok?(g=(await E.json()).components)!=null?g:[]:[]}catch(E){return[]}finally{l.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){S.flush(),K.flush()},dispose(){var l;Ee==null||Ee(),mt=!0,se=!0,S.destroy(),K.destroy(),((l=J.get(e.apiKey))==null?void 0:l.dispose)===X.dispose&&J.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var l;Ee==null||Ee(),mt=!0,se=!0,i=!0,Xe(e.apiKey),S.destroy({forget:!0}),K.destroy({forget:!0}),o.destroy(),y.clear(),((l=J.get(e.apiKey))==null?void 0:l.dispose)===X.dispose&&J.delete(e.apiKey);try{localStorage.removeItem(ye+e.apiKey),localStorage.removeItem($e(e.apiKey)),localStorage.removeItem(Ue(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:X.dispose}),Ee=qo(X,e.apiKey,l=>{he.then(()=>{mt||kn.add(l)})}),e.debug){let l=window;l.__sentient&&(l.__sentient.client=X)}return X}var Tn="_snt_graph_edges",Jo={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function Yo(e){var t;return(t=Jo[e])!=null?t:[]}function Zo(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function er(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var tr=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function nr(e){return tr.has(e)?e:"generic"}function At(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function or(e,t,n){let s=`${e}:${t}:${n.join(",")}`,c=5381;for(let r=0;r<s.length;r++)c=(c<<5)+c+s.charCodeAt(r)&4294967295;return(c>>>0).toString(16).padStart(8,"0")}function An(e){let t=new Map,n=new Map,s=`_snt_graph_nodes${ie(e==null?void 0:e.apiKey)}`,c=()=>{typeof window!="undefined"&&er(s,[...t.values()])};if(typeof window!="undefined"){let r=Zo(s,[]);for(let u of r)t.set(u.componentId,u);try{localStorage.removeItem(Tn)}catch(u){}}return{addPageNode(r){t.set(r.componentId,r),c()},addStructuralEdge(r){let u=`${r.fromComponentId}->${r.toComponentId}`;n.set(u,r)},syncOnce(){var u,o;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let r=[...t.values()];if(r.length!==0)try{let p=new Map;for(let y of r){let S=(u=p.get(y.semanticType))!=null?u:[];S.push(y),p.set(y.semanticType,S)}let i=[],a=new Set;for(let y of r)for(let S of Yo(y.semanticType)){let b=(o=p.get(S))!=null?o:[];for(let P of b){if(P.componentId===y.componentId)continue;let O=`semantic:${y.componentId}->${P.componentId}`;a.has(O)||(a.add(O),i.push({fromComponentId:y.componentId,toComponentId:P.componentId,type:"semantic",weight:.4,confidence:.9}))}}let d=new Set(r.map(y=>y.componentId));for(let y of n.values()){if(!d.has(y.fromComponentId)||!d.has(y.toComponentId))continue;let S=`structural:${y.fromComponentId}->${y.toComponentId}`;a.has(S)||(a.add(S),i.push({fromComponentId:y.fromComponentId,toComponentId:y.toComponentId,type:"structural",weight:y.weight,confidence:1}))}let h=oe(T(T({pageUrl:At(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:r.map(y=>{let S=nr(y.semanticType);return{componentId:y.componentId,semanticType:S,answers:y.answers,contentHash:or(y.componentId,S,y.answers),prominenceScore:y.prominenceScore,depthInPage:y.depth}}),edges:i});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:T({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(h)}).catch(()=>{})}catch(p){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(s),localStorage.removeItem(Tn)}catch(r){}}}}var rr=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function _t(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function sr(e){return{tag:e.tagName.toLowerCase(),text:_t(e).slice(0,40)}}function _n(e){return e.replace(/["\\\]]/g,"\\$&")}function Ve(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Rn(e,t){var u;let n=e.tagName.toLowerCase();if(!n)return null;let s=((u=e.getAttribute("class"))!=null?u:"").split(/\s+/).filter(o=>/^[a-zA-Z][\w-]*$/.test(o)),c=[n,...s.map(o=>`${n}.${o}`)];for(let o of c)if(Ve(t,o))return o;let r=e.parentElement;if(r&&r!==t){let o=Rn(r,t);if(o){for(let d of c){let h=`${o} > ${d}`;if(Ve(t,h))return h}let p=Array.from(r.children).filter(d=>d.tagName.toLowerCase()===n),i=p.indexOf(e),a=p.some(d=>d!==e&&_t(d)!==_t(e));if(i>=0&&a){let d=`${o} > ${n}:nth-of-type(${i+1})`;if(Ve(t,d))return d}}}return null}function dt(e,t){let n=sr(e),s=e.getAttribute("id");if(s&&Ve(t,`#${_n(s)}`))return{v:1,id:s,fingerprint:n};for(let r of rr){let u=e.getAttribute(r);if(u&&Ve(t,`[${r}="${_n(u)}"]`))return{v:1,dataAttr:{name:r,value:u},fingerprint:n}}let c=Rn(e,t);return c?{v:1,selector:c,fingerprint:n}:null}var Pn=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],ir={banner:"hero",navigation:"navigation",contentinfo:"footer"};function ar(e){let t=e.ariaRole?ir[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 lr(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var cr=[["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]],dr=[["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]],On={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function ur(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function pr(e){var c,r;let t=ar(e);if(t)return{type:(c=On[t])!=null?c:"generic",strength:"strong"};let n=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[u,o]of cr)if(o.test(n))return{type:u,strength:"strong"};for(let[u,o]of dr)if(o.test(e.bodyText))return{type:u,strength:"strong"};let s=lr(e);return{type:(r=On[s])!=null?r:"generic",strength:"weak"}}function gr(e){var s,c;let t=((s=e.textContent)!=null?s:"").replace(/\s+/g," ").trim(),n=e.getAttribute("role");return T({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((c=e.className)!=null?c:"")}`,headingText:ur(e),bodyText:t.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:t.length},n?{ariaRole:n}:{})}function Dn(e){return pr(gr(e)).type}var fr=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),mr=200,yr="h1, h2, h3",Sr="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",Nn=30,hr=1500,br={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function Mn(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function vr(e){var t,n,s;try{let c=e;for(let r of Object.keys(c)){if(!r.startsWith("__reactFiber")&&!r.startsWith("__reactInternalInstance"))continue;let u=c[r],o=(s=(t=u==null?void 0:u.type)==null?void 0:t.displayName)!=null?s:(n=u==null?void 0:u.type)==null?void 0:n.name;if(o&&o.length>1)return o}}catch(c){}}function Er(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var Rt=new Set(Pn);function wr(e,t){let n=e.getAttribute("data-sentient-id"),s=n?t==null?void 0:t[n]:void 0;if(s&&Rt.has(s))return s;let c=e.getAttribute("data-sentient-type");if(c&&Rt.has(c))return c;let r=e.getAttribute("role");return r&&Rt.has(r)?r:Dn(e)}function xr(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 kr(e){let t=[],n=e;for(;n;){let s=n.parentElement;if(!s){t.push(n.tagName.toLowerCase());break}let c=Array.prototype.indexOf.call(s.children,n);t.push(`${n.tagName.toLowerCase()}[${c}]`),n=s}return t.reverse().join("/")}function Ir(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${xr(kr(e))}`}function Cr(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function Ot(e,t,n){var c,r,u,o;let s=e.querySelector(yr);return{componentId:Ir(e),semanticType:wr(e,n),ariaLabel:(c=e.getAttribute("aria-label"))!=null?c:void 0,headingText:(u=(r=s==null?void 0:s.textContent)==null?void 0:r.trim())!=null?u:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:Cr(e),reactComponentName:vr(e),dataAttributes:Er(e),locator:(o=dt(e,e.ownerDocument))!=null?o:void 0}}function Ln(e){var r;let t=[],n=new Set,s="__root__",c=new Map;for(let[u,o]of e){let p=u.parentElement,i=s;for(;p;){if(e.has(p)){i=e.get(p);let d=e.get(u),h=`${i}->${d}`;!n.has(h)&&i!==d&&(n.add(h),t.push({fromComponentId:i,toComponentId:d,weight:.6}));break}p=p.parentElement}let a=(r=c.get(i))!=null?r:[];a.push(u),c.set(i,a)}for(let u of c.values()){if(u.length<2)continue;let o=u.length>Nn?u.slice(0,Nn):u;for(let p=0;p<o.length;p++)for(let i=p+1;i<o.length;i++){if(t.length>=hr)return t;let a=e.get(o[p]),d=e.get(o[i]);if(a===d)continue;let h=`${a}->${d}::sib`,y=`${d}->${a}::sib`;n.has(h)||(n.add(h),t.push({fromComponentId:a,toComponentId:d,weight:.3})),n.has(y)||(n.add(y),t.push({fromComponentId:d,toComponentId:a,weight:.3}))}}return t}function Tr(e,t){let n=[],s=new Set,c=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(o=>{if(o instanceof Element&&!s.has(o)){s.add(o);let p=Ot(o,e,t);n.push(p),c.set(o,p.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(o=>{if(!(o instanceof Element)||s.has(o))return;let p=o.hasAttribute("aria-label"),i=o.hasAttribute("data-sentient-id");if(!p&&!i)return;s.add(o);let a=Ot(o,e,t);n.push(a),c.set(o,a.componentId)}),{nodes:n,edges:Ln(c),elementToId:c}}function Bn(e={}){let{sectionTypes:t}=e;if(typeof window=="undefined")return br;let n=null,s=0,c=null,r=new Map,u=y=>{try{let S=window.getComputedStyle(y),b=parseFloat(S.fontSize)||12,P=parseFloat(S.zIndex)||0,O=y.getBoundingClientRect(),K=Math.max(O.top,0),L=window.innerHeight||1,W=1/(K/L+1),H=Mn(b,12,48)*.4+W*.4+Mn(P,0,100)*.2;return Math.max(0,Math.min(1,H))}catch(S){return .5}},o=()=>new Promise(y=>{let S=()=>{let{nodes:b,edges:P,elementToId:O}=Tr(u,t);r.clear();for(let[K,L]of O)r.set(K,L);y({nodes:b,edges:P,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?s=requestIdleCallback(S,{timeout:100}):S()}catch(b){S()}}),p=new Set,i=null,a=()=>{i=null;let y=[...p];p.clear();let S=[],b=new Set;for(let O of y){if(!O.isConnected)continue;let K=[];fr.has(O.tagName)&&(O.hasAttribute("data-sentient-id")||O.hasAttribute("aria-label"))&&K.push(O);try{O.querySelectorAll(Sr).forEach(L=>K.push(L))}catch(L){}for(let L of K){if(r.has(L))continue;let W=Ot(L,u,t);S.push(W),b.add(W.componentId),r.set(L,W.componentId)}}if(S.length===0||!c)return;for(let O of[...r.keys()])O.isConnected||r.delete(O);let P=Ln(r).filter(O=>b.has(O.fromComponentId)||b.has(O.toComponentId));c({nodes:S,edges:P,addedAt:Date.now()})};return{scan:o,observe:y=>{c=y;try{n=new MutationObserver(S=>{for(let b of S)b.type==="childList"&&b.addedNodes.forEach(P=>{P instanceof Element&&p.add(P)});p.size>0&&i===null&&(i=setTimeout(a,mr))}),n.observe(document.body,{childList:!0,subtree:!0})}catch(S){}},getProminenceScore:u,destroy:()=>{if(n&&(n.disconnect(),n=null),i!==null&&clearTimeout(i),i=null,p.clear(),s&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(s)}catch(y){}s=0,c=null,r.clear()}}}var Ar="https://api.sentient-ui.com/v1/events";function _r(e){var n;let t=s=>{try{let c=document.cookie.match(new RegExp(`(?:^|; )${s}=([^;]*)`));return c?decodeURIComponent(c[1]):void 0}catch(c){return}};return(n=e?t(be(e)):void 0)!=null?n:t(ge)}var ut=new Map;function Gn(e){var y;let t=Tt(e),n=e.respectDoNotTrack!==!1&&We(),s=e.consent===!1||n,c=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),r=e.localMode===!0||!c;if(!e.graph||r||typeof window=="undefined")return t;if(s)return n||xn(e.apiKey,S=>Gn(S)),t;let u=ut.get(e.apiKey);if(u)try{u()}catch(S){}let o=Bn({sectionTypes:e.sectionTypes}),p=(y=e.ingestUrl)!=null?y:Ar,i=An({syncUrl:p.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:_r(e.apiKey)});o.scan().then(S=>{for(let b of S.nodes)i.addPageNode({id:b.componentId,componentId:b.componentId,semanticType:b.semanticType,answers:e.captureDomText&&b.headingText?[b.headingText]:[],prominenceScore:b.prominenceScore,depth:b.depth});for(let b of S.edges)i.addStructuralEdge(b);i.syncOnce()});let a=null,d=()=>{a!==null&&clearTimeout(a),a=setTimeout(()=>{a=null,i.syncOnce()},500)};o.observe(S=>{for(let b of S.nodes)i.addPageNode({id:b.componentId,componentId:b.componentId,semanticType:b.semanticType,answers:e.captureDomText&&b.headingText?[b.headingText]:[],prominenceScore:b.prominenceScore,depth:b.depth});for(let b of S.edges)i.addStructuralEdge(b);d()});let h=()=>{a!==null&&(clearTimeout(a),a=null),o.destroy(),i.destroy(),ut.get(e.apiKey)===h&&ut.delete(e.apiKey)};return ut.set(e.apiKey,h),oe(T({},t),{getGraph:()=>i.snapshot(),dispose:()=>{h(),t.dispose()},destroy:()=>{h(),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