@sentientui/core 0.41.2 → 0.43.0

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