@sentientui/core 0.41.1 → 0.42.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 +31 -2
  2. package/dist/chunk-BGZLWZUG.mjs +2 -0
  3. package/dist/chunk-BGZLWZUG.mjs.map +1 -0
  4. package/dist/chunk-JNQY3XNF.mjs +2 -0
  5. package/dist/chunk-JNQY3XNF.mjs.map +1 -0
  6. package/dist/chunk-LCYGZNFI.mjs +2 -0
  7. package/dist/chunk-LCYGZNFI.mjs.map +1 -0
  8. package/dist/chunk-QPJ6TL6L.mjs +2 -0
  9. package/dist/chunk-QPJ6TL6L.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-Bz4QCRmF.d.cts} +26 -5
  13. package/dist/{index-C--aVpoo.d.ts → index-C36TXfry.d.ts} +26 -5
  14. package/dist/index-consent.js +1 -1
  15. package/dist/index-consent.js.map +1 -1
  16. package/dist/index-consent.mjs +1 -1
  17. package/dist/index-consent.mjs.map +1 -1
  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
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var Wn=Object.create;var Me=Object.defineProperty,Vn=Object.defineProperties,Hn=Object.getOwnPropertyDescriptor,zn=Object.getOwnPropertyDescriptors,Qn=Object.getOwnPropertyNames,cn=Object.getOwnPropertySymbols,Xn=Object.getPrototypeOf,un=Object.prototype.hasOwnProperty,Jn=Object.prototype.propertyIsEnumerable;var dn=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A=(e,t)=>{for(var n in t||(t={}))un.call(t,n)&&dn(e,n,t[n]);if(cn)for(var n of cn(t))Jn.call(t,n)&&dn(e,n,t[n]);return e},Se=(e,t)=>Vn(e,zn(t));var qn=(e,t)=>{for(var n in t)Me(e,n,{get:t[n],enumerable:!0})},gn=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of Qn(t))!un.call(e,u)&&u!==n&&Me(e,u,{get:()=>t[u],enumerable:!(s=Hn(t,u))||s.enumerable});return e};var Yn=(e,t,n)=>(n=e!=null?Wn(Xn(e)):{},gn(t||!e||!e.__esModule?Me(n,"default",{value:e,enumerable:!0}):n,e)),Zn=e=>gn(Me({},"__esModule",{value:!0}),e);var Zo={};qn(Zo,{AGENT_INTENTS:()=>ut,BLOCK_ALIGNS:()=>ko,BLOCK_EMPHASES:()=>_o,BLOCK_FITS:()=>Co,BLOCK_GAPS:()=>bo,BLOCK_GRID_COLUMNS:()=>Ro,BLOCK_HEADING_LEVELS:()=>To,BLOCK_JUSTIFIES:()=>vo,BLOCK_MAX_WIDTHS:()=>Po,BLOCK_PADS:()=>Do,BLOCK_RATIOS:()=>Ao,BLOCK_SIZES:()=>xo,BLOCK_SURFACES:()=>Oo,BLOCK_TEXT_ALIGNS:()=>Io,BLOCK_TONES:()=>Eo,BLOCK_WEIGHTS:()=>wo,CLASSIC_CRAWLER_TOKENS:()=>Ot,CLICK_ID_KEYS:()=>Pt,FORM_FIELD_KINDS:()=>Bo,FORM_INPUT_TYPES:()=>Lo,LEGACY_SESSION_COOKIE_NAME:()=>he,LOCAL_MODE_BANNER:()=>Bt,MAX_BLOCK_ARMS:()=>$o,MAX_BLOCK_CHILDREN:()=>Uo,MAX_BLOCK_DEPTH:()=>Go,MAX_BLOCK_NODES:()=>Ko,MAX_BLOCK_TEXT_LEN:()=>Fo,MAX_FORM_FIELDS:()=>Mo,MAX_FORM_SELECT_OPTIONS:()=>No,MAX_SKELETON_LEAVES:()=>$r,MAX_SKELETON_NODES:()=>Ur,MAX_SKELETON_TEXT:()=>Fr,PAGE_SCOPE_RE:()=>Mt,PROD_KEYLESS_ERROR:()=>bt,REVEAL_MS:()=>Kt,SNAPSHOT_STORAGE_KEY_PREFIX:()=>fe,STAGE_ATTRIBUTE:()=>ft,_registerConsentUpgradeInit:()=>Vo,agentIntent:()=>kn,agentUaList:()=>Ue,applyNonce:()=>qe,armOfResult:()=>pt,attachMicroSignalDetectors:()=>Pn,baselineResultFor:()=>De,baselineSlots:()=>wn,classifiedAgents:()=>vn,containsFormBlock:()=>Tn,cspNonce:()=>Ct,deriveSessionSegment:()=>xn,detectDeviceClass:()=>Fe,detectTimeOfDay:()=>Ve,detectTrafficSource:()=>je,exposedStage:()=>mt,extractTrackedParams:()=>gt,forgetGeneration:()=>se,forgetVisitor:()=>ot,grantConsent:()=>qo,init:()=>Un,isDoNotTrackEnabled:()=>Wt,matchedAgentToken:()=>dt,matchedCrawlerToken:()=>Dt,normalizeUrlPattern:()=>Rn,pageScopeMatches:()=>An,readSnapshot:()=>Ie,referrerDomainFromReferer:()=>We,renderPrePaintScript:()=>pn,resetRevealStyles:()=>On,reveal:()=>Dn,routeKey:()=>Ft,sessionCookieName:()=>_e,setCspNonce:()=>Je,setStageAttribute:()=>yt,toWireSlot:()=>He,uaTokenMatch:()=>$e,urlMatches:()=>Cn,writeSnapshot:()=>Ae});module.exports=Zn(Zo);function ue(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function It(e,t){return new Promise(n=>{let s=setTimeout(()=>n(!1),t),u=()=>{clearTimeout(s),n(!0)};e.then(u,u)})}var At;function Je(e){At=typeof e=="string"&&e!==""?e:void 0}function Ct(e=document){if(At)return At;try{let t=e.querySelector("script[nonce]");return(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"))||void 0}catch(t){return}}function qe(e,t=document){let n=Ct(t);return n&&e.setAttribute("nonce",n),e}function pe(e){return e?`_${e.slice(0,12)}`:""}var he="_snt_uid";function _e(e){return`${he}${pe(e)}`}var Ye="__sntForgetGen",eo=()=>{try{return window[Ye]}catch(e){return}};function Ze(e){var t,n;try{let s=window,u=(t=s[Ye])!=null?t:s[Ye]={};u[e]=((n=u[e])!=null?n:0)+1}catch(s){}}function se(e){var t,n;return(n=(t=eo())==null?void 0:t[e])!=null?n:0}var fe="_snt_snap:";var to=["low","medium","high"];function Ie(e){try{let t=localStorage.getItem(fe+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"||!to.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(Date.now()-n.savedAt<2592e6)||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig)))return null;let s=n.vocabulary;return s!==void 0&&(typeof s!="object"||s===null||!Array.isArray(s.entries)||!Array.isArray(s.images))&&delete n.vocabulary,n.stage!==void 0&&typeof n.stage!="string"&&delete n.stage,n}catch(t){return null}}function Ae(e,t){try{localStorage.setItem(fe+e,JSON.stringify(t))}catch(n){}}function pn(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(fe+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 me(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Ce(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 et(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let s=JSON.parse(n);return Array.isArray(s)?(localStorage.removeItem(e),s.slice(-t)):[]}catch(n){return[]}}function Ne(e,t,n){try{let s=(()=>{try{let g=localStorage.getItem(n);if(!g)return[];let S=JSON.parse(g);return Array.isArray(S)?S:[]}catch(g){return[]}})(),u=new Map;for(let g of s)u.set(g.id,g);for(let g of e)u.set(g.id,g);localStorage.setItem(n,JSON.stringify([...u.values()].slice(-t)))}catch(s){}}function tt(e,t){try{let n=localStorage.getItem(t);if(!n)return;let s=JSON.parse(n);if(!Array.isArray(s))return;let u=new Set(e),g=s.filter(S=>!u.has(S.id));if(g.length===s.length)return;g.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(g))}catch(n){}}var no=500,oo=56*1024;function Ke(e){return`_snt_retry_${e.slice(0,12)}`}var ro={push:()=>{},flush:()=>{},destroy:()=>{}};function fn(e){var O,ee,ie;if(typeof window=="undefined")return ro;let t=(O=e.flushIntervalMs)!=null?O:5e3,n=(ee=e.maxBatchSize)!=null?ee:20,s=(ie=e.maxRetrySize)!=null?ie:100,u=e.ingestUrl,g=e.apiKey,S=Ke(g),o=!1,f=se(g),a=(...v)=>{!o&&se(g)===f&&Ne(...v)},i=[],c=new Set,b=[],C=v=>{for(let B of v)T.delete(B),!c.has(B)&&(c.add(B),b.push(B));for(;b.length>no;){let B=b.shift();B&&c.delete(B)}tt(v,S)},T=new Set,P=()=>{for(;i.length>s;){let v=i.shift();v&&T.delete(v.id)}},K=v=>{c.has(v.id)||T.has(v.id)||(T.add(v.id),i.push(v),P())},V=v=>{for(let B of v)c.has(B.id)||(T.add(B.id),i.push(B));P()},H=et(S,s);for(let v of H)K(v);let z=0,Q=0,q=(v,B=!0)=>{if(v.length===0)return;let ge=JSON.stringify(v),be=v.map(oe=>oe.id),te,ve=ue(15e3);try{te=fetch(u,{method:"POST",keepalive:!0,signal:ve.signal,body:ge,headers:{"Content-Type":"application/json",Authorization:`Bearer ${g}`}})}catch(oe){a(v,s,S),V(v),Q++,z=Date.now()+me(Q);return}Promise.resolve(te).then(ve.clear,ve.clear);let xe=oe=>{if(Ce(oe)!=="retry"){if(!oe.ok&&B){let we=v.filter(ae=>ae.eventType!=="pageview");if(we.length>0&&we.length<v.length){C(v.filter(ae=>ae.eventType==="pageview").map(ae=>ae.id)),q(we,!1);return}}C(be),Q=0,z=0;return}a(v,s,S),V(v),Q++,z=Date.now()+me(Q)};te&&typeof te.then=="function"?te.then(xe).catch(()=>{a(v,s,S),V(v),Q++,z=Date.now()+me(Q)}):xe(te)},$=typeof TextEncoder!="undefined"?new TextEncoder:null,d=v=>$?$.encode(v).length:v.length,m=v=>{let B=[],ge=2;for(let be of v){let te=d(JSON.stringify(be))+1;if(B.length>0&&ge+te>oo||B.length>=n)break;B.push(be),ge+=te}return B},h=()=>{try{if(Date.now()<z)return;for(;i.length>0&&!(Date.now()<z);){let v=i.filter(ge=>!c.has(ge.id));if(i.length=0,v.length===0)break;let B=m(v);if(B.length===0)break;B.length<v.length&&i.push(...v.slice(B.length)),q(B)}}catch(v){}},p=!0,_=null;_=setInterval(()=>{p&&h()},t);let M=()=>{document.visibilityState==="hidden"&&h()},F=()=>{h()};return document.addEventListener("visibilitychange",M),window.addEventListener("pagehide",F),{push(v){K(v),i.length>=n&&h()},flush:h,destroy(v){v!=null&&v.forget&&(o=!0),p=!1,_!==null&&(clearInterval(_),_=null),document.removeEventListener("visibilitychange",M),window.removeEventListener("pagehide",F),h()}}}var so=200;function Ge(e){return`_snt_goal_retry_${e.slice(0,12)}`}var io={send:()=>{},flush:()=>{},destroy:()=>{}};function mn(e){var d,m,h;if(typeof window=="undefined")return io;let t=(d=e.flushIntervalMs)!=null?d:5e3,n=(m=e.maxRetrySize)!=null?m:100,s=(h=e.maxPerFlush)!=null?h:5,u=Ge(e.apiKey),g=!1,S=se(e.apiKey),o=(...p)=>{!g&&se(e.apiKey)===S&&Ne(...p)},f=[],a=new Set,i=new Set,c=[],b=0,C=0,T=!1,P=p=>{for(a.delete(p.id),i.has(p.id)||(i.add(p.id),c.push(p.id));c.length>so;){let _=c.shift();_&&i.delete(_)}tt([p.id],u)},K=p=>{o([p],n,u),!i.has(p.id)&&!a.has(p.id)&&(a.add(p.id),f.push(p)),Date.now()>=b&&(C++,b=Date.now()+me(C))},V=p=>{let _,M=ue(15e3);try{_=fetch(e.url,{method:"POST",keepalive:!0,signal:M.signal,body:p.body,headers:e.headers})}catch(O){K(p);return}let F=O=>{var ie;let ee=Ce(O);if(ee==="retry"){K(p);return}ee==="dropped"&&((ie=e.onDrop)==null||ie.call(e,p,O.status)),P(p),C=0,b=0};Promise.resolve(_).then(M.clear,M.clear),_&&typeof _.then=="function"?_.then(F).catch(()=>K(p)):F(_)},H=()=>{try{if(T||Date.now()<b)return;let p=0;for(;f.length>0&&p<s&&!(Date.now()<b);){let _=f.shift();a.delete(_.id),!i.has(_.id)&&(p++,V(_))}}catch(p){}},z=et(u,n);for(let p of z)a.has(p.id)||(a.add(p.id),f.push(p));z.length>0&&Ne(z,n,u);let Q=setInterval(H,t),q=()=>{document.visibilityState==="hidden"&&H()},$=()=>H();return document.addEventListener("visibilitychange",q),window.addEventListener("pagehide",$),{send(p){if(T){i.has(p.id)||o([p],n,u);return}if(!(i.has(p.id)||a.has(p.id))){if(Date.now()<b){o([p],n,u),a.add(p.id),f.push(p);return}V(p)}},flush:H,destroy(p){p!=null&&p.forget&&(g=!0),clearInterval(Q),document.removeEventListener("visibilitychange",q),window.removeEventListener("pagehide",$),H(),T=!0}}}function nt(e){let t=(e||"").toLowerCase();if(!t.includes(".")||/^[\d.]+$|:/.test(t))return[];let n=t.split("."),s=[];for(let u=n.length-2;u>=0;u--)s.push(n.slice(u).join("."));return s}function ot(e){if(typeof window=="undefined"||!e)return!1;Ze(e);let t=!1,n=_e(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let S=location.protocol==="https:"?"; Secure":"";for(let o of["",...nt(location.hostname)])document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${o?`; domain=${o}`:""}${S}`;t=!0}}catch(S){}let s=pe(e),u=[n,"_snt_graph_edges",fe+e,Ke(e),Ge(e),`_snt_graph_nodes${s}`],g=[`_snt_asgn${s}_`];for(let S of["localStorage","sessionStorage"])try{let o=window[S];for(let f of u)o.getItem(f)!==null&&(o.removeItem(f),t=!0);for(let f=o.length-1;f>=0;f--){let a=o.key(f);a&&g.some(i=>a.startsWith(i))&&(o.removeItem(a),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${he}=[^;]`).test(document.cookie)||localStorage.getItem(he)!==null||sessionStorage.getItem(he)!==null)&&localStorage.setItem(`${he}_tomb${s}`,"1")}catch(S){}return t}function rt(){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 yn="_snt_uid",ao=365,Re="_snt_uid";function lo(){return rt()}function Te(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function hn(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function at(e,t,n,s){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${s?`; domain=${s}`:""}${hn()}`}catch(u){}}function st(e){try{return localStorage.getItem(e)}catch(t){return null}}function Sn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Tt(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function co(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function uo(e){try{sessionStorage.removeItem(e)}catch(t){}}function go(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${hn()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function po(e){try{localStorage.removeItem(e)}catch(t){}}function it(e,t){at(e,"",0,t)}var fo={getSessionId:()=>null,isEphemeral:()=>!1,domain:null,destroy:()=>{}};function mo(e,t){if(e===!1)return null;if(typeof e=="string")return e.replace(/^\./,"");for(let n of nt(location.hostname))if(at(t,"1",10,n),Te(t)==="1")return it(t,n),n;return null}function lt(e){var V,H,z,Q,q,$,d;if(typeof window=="undefined")return fo;let t=pe(e==null?void 0:e.apiKey),n=(V=e==null?void 0:e.cookieName)!=null?V:_e(e==null?void 0:e.apiKey),s=`${Re}${t}`,u=`${Re}_tomb${t}`,S=((H=e==null?void 0:e.cookieTTLDays)!=null?H:ao)*24*60*60,o=m=>m&&m.length>0?m:null,f=()=>{var m,h;return t&&!(e!=null&&e.cookieName)&&st(u)===null?(h=(m=o(Te(yn)))!=null?m:o(st(Re)))!=null?h:o(Tt(Re)):null},a=mo(e==null?void 0:e.cookieDomain,`${n}_dom`),i=o(Te(n)),c=a?(it(n),o(Te(n))):null,b=(d=($=(q=(Q=(z=c!=null?c:i)!=null?z:o(st(s)))!=null?Q:o(Tt(s)))!=null?q:f())!=null?$:o(e==null?void 0:e.ssrSessionId))!=null?d:lo();at(n,b,S,a),a&&Te(n)!==b&&(a=null,at(n,b,S));let C=Sn(s,b),T=go(n),P=C?!1:co(s,b),K=!C&&!T&&!P;return{getSessionId:()=>b,isEphemeral:()=>K,domain:a,destroy:()=>{b=null,it(n),it(n,a),po(s),uo(s),t&&!(e!=null&&e.cookieName)&&(Te(yn)!==null||st(Re)!==null||Tt(Re)!==null)&&Sn(u,"1")}}}var yo=1800*1e3;function ct(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function bn(e=yo,t){let n=new Map,s=`_snt_asgn${pe(t)}_`,u=(a,i)=>`${s}${encodeURIComponent(a)}:${encodeURIComponent(i)}`,g=a=>{let i=a.slice(s.length),c=i.indexOf(":");if(c<0)return null;try{return{componentId:decodeURIComponent(i.slice(0,c)),segment:decodeURIComponent(i.slice(c+1))}}catch(b){return null}},S=()=>{try{let a=[];for(let i=0;i<localStorage.length;i++){let c=localStorage.key(i);c!=null&&c.startsWith(s)&&a.push(c)}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 S())try{let i=localStorage.getItem(a);if(!i)continue;let c=JSON.parse(i);if(o(c)){localStorage.removeItem(a);continue}let b=g(a);if(!b)continue;n.set(ct(b.componentId,b.segment),c)}catch(i){}})(),{get(a,i){let c=n.get(ct(a,i));return c?o(c)?(n.delete(ct(a,i)),null):c:null},set(a,i,c){let b=ct(a,i);n.set(b,c);try{localStorage.setItem(u(a,i),JSON.stringify(c))}catch(C){}},clear(){n.clear();for(let a of S())try{localStorage.removeItem(a)}catch(i){}}}}var Ue=["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 $e(e){return dt(e)!==null}function dt(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=Ue.find(s=>t.includes(s.toLowerCase())))!=null?n:null}var Ot=["Googlebot","Bingbot","DuckDuckBot","YandexBot","Baiduspider","Applebot","Slurp","facebookexternalhit","LinkedInBot","Twitterbot"];function Dt(e){var s;let t=dt(e);if(t)return t;if(!e)return null;let n=e.toLowerCase();return(s=Ot.find(u=>n.includes(u.toLowerCase())))!=null?s:null}var ut={GPTBot:"training","ChatGPT-User":"user","OAI-SearchBot":"search",ClaudeBot:"training","Claude-User":"user","Claude-SearchBot":"search",PerplexityBot:"search","Perplexity-User":"user","Google-Extended":"training","Applebot-Extended":"training","Meta-ExternalAgent":"training",Bytespider:"training",CCBot:"training",Amazonbot:"other","cohere-ai":"training",Diffbot:"other"};function kn(e){if(!e)return"other";let t=Ue.find(n=>n.toLowerCase()===e.toLowerCase());return t&&ut[t]||"other"}function vn(){var t;let e={user:[],search:[],training:[],other:[]};for(let n of Ue)e[(t=ut[n])!=null?t:"other"].push(n);return e}function Fe(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 je(e,t,n){if(!e)return"direct";try{let s=new URL(e);if(t)try{if(new URL(t).host===s.host)return"direct"}catch(g){}let u=s.hostname.toLowerCase();return n&&`.${u}`.endsWith(`.${n}`)?"direct":/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(u)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(u)?"social":"referral"}catch(s){return"direct"}}function We(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var Pt=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function gt(e){let t={},n={};try{let s=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([u,g])=>{let S=Array.isArray(g)?g[0]:g;return S===void 0?[]:[[u,S]]});for(let[u,g]of s)u.startsWith("utm_")?u in t||(t[u]=g):Pt.includes(u)&&(u in n||(n[u]=g))}catch(s){}return{utmParams:t,clickIds:n}}function Ve(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function xn(e){let t=So("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function So(e,t){var S,o,f,a,i,c,b,C;let n=(o=(S=t==null?void 0:t.userAgent)==null?void 0:S.trim())!=null?o:"",s=(a=(f=t==null?void 0:t.referer)==null?void 0:f.trim())!=null?a:"",u=(i=t==null?void 0:t.now)!=null?i:new Date,g=Dt(n);return A(A({sessionId:e,ephemeral:!1,utmParams:(c=t==null?void 0:t.utmParams)!=null?c:{},clickIds:(b=t==null?void 0:t.clickIds)!=null?b:{},deviceClass:n?Fe(n):"desktop",trafficSource:s?je(s,t==null?void 0:t.appOrigin):"direct",referrerDomain:We(s),timeOfDay:Ve(u),dayOfWeek:(C=["sun","mon","tue","wed","thu","fri","sat"][u.getDay()])!=null?C:"sun",automation:(t==null?void 0:t.webdriver)===!0||$e(n)},g?{agentToken:g}:{}),t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var Oe=require("@sentientui/policy");function He(e){return A(A(A({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 De(e){let t=He(e);return(0,Oe.slotResultFor)(t,(0,Oe.slotBaselineArm)(t))}function wn(e){let t={};for(let n of e)t[n.id]=De(n);return t}function pt(e){return typeof e=="string"?e:(0,Oe.canonicalArm)(e)}var En=require("@sentientui/policy"),ft="data-sentient-stage";function mt(e,t){return!t||typeof e!="string"||!(e==="returning"||En.STAGE_KEYS.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function yt(e,t=document){try{e?t.documentElement.setAttribute(ft,e):t.documentElement.removeAttribute(ft)}catch(n){}}var $t=require("@sentientui/policy");var ht=require("@sentientui/policy");var bt="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Bt="[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.",_n=!1,St=!1;function ho(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function In(e){var a;let t=lt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(a=t.getSessionId())!=null?a:"local",s=ho(),u=import("@sentientui/core/local").then(i=>{let c=i;return c.LOCAL_ENGINE_AVAILABLE?(_n||(_n=!0,console.info(Bt)),c):(St||(St=!0,console.error(bt)),null)}).catch(()=>(St||(St=!0,console.error(bt)),null)),g=null,S={low:.15,medium:.5,high:.85},o=(()=>{var c;if(e.initialPersona)return A({},e.initialPersona);let i=Ie(e.apiKey||"local");return i?{persona:i.persona,confidence:(c=S[i.band])!=null?c:.15}:null})();function f(i){let c=document.documentElement;c.dataset.sentientPersona===void 0&&(c.dataset.sentientPersona=i.persona,c.dataset.sentientConfidence=(0,ht.confidenceBand)(i.confidence))}return{isLocal:!0,async decide(i){var C,T,P;let c=await u;if(!c)return null;let b=c.createLocalEngine({sessionId:n,forcedPersona:s}).decide(i);return g=Se(A({},b),{layoutOrder:(T=(C=b.layoutOrder)!=null?C:g==null?void 0:g.layoutOrder)!=null?T:null,slots:A(A({},(P=g==null?void 0:g.slots)!=null?P:{}),b.slots)}),Ae(e.apiKey||"local",{v:1,persona:g.persona,band:(0,ht.confidenceBand)(g.confidence),slots:g.slots,layoutOrder:g.layoutOrder,savedAt:Date.now()}),f(b),b},getSlotResult(i){var c,b,C;return(C=(b=g==null?void 0:g.slots[i])!=null?b:(c=e.initialSlots)==null?void 0:c[i])!=null?C:null},getSlotConfig(i){var c,b;return(b=(c=e.initialSlotConfig)==null?void 0:c[i])!=null?b:null},getSitePalette(){var i;return(i=e.initialPalette)!=null?i:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let i=g!=null?g:o;return i?{persona:i.persona,confidence:i.confidence,band:(0,ht.confidenceBand)(i.confidence)}:null},async assign(i,c){var T;let b=await u;return!b||!c||c.length===0?c!=null&&c[0]?{variantId:c[0],assignmentTtlMs:0}:null:{variantId:(T=b.createLocalEngine({sessionId:n,forcedPersona:s}).decide({components:[{id:i,variantIds:c}]}).assignments[i])!=null?T:c[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var Mt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Lt(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function An(e,t){if(e===void 0||!Mt.test(e))return!1;if(e==="*")return!0;let n=Lt(t);if(e.endsWith("/*")){let s=Lt(e.slice(0,-2));return n.startsWith(s==="/"?"/":`${s}/`)&&n!==s}return n===Lt(e)}function Cn(e,t){if(!e)return!1;if(e==="/")return t==="/";let n=e.endsWith("/")?e.slice(0,-1):e;return t===n||t.startsWith(`${n}/`)}function Rn(e){if(!/^https?:\/\//i.test(e))return e;try{return new URL(e).pathname||"/"}catch(t){return e}}var bo=["none","sm","md","lg"],ko=["start","center","end","stretch"],vo=["start","center","end","between"],xo=["sm","md","lg"],wo=["normal","medium","bold"],Eo=["default","muted","accent"],_o=["primary","secondary","ghost"],Io=["left","center","right"],Ao=["auto","square","landscape","wide"],Co=["cover","contain"],Ro=[2,3,4],To=[1,2,3,4],Oo=["default","raised"],Do=["none","sm","md","lg"],Po=["measure"],Bo=["input","textarea","select"],Lo=["text","email","number","tel"],Mo=5,No=8,Ko=64,Go=5,Uo=12,$o=4,Fo=500;function Tn(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(Tn):!1}var Ur=40,$r=120,Fr=300;var Nt="sentient-reveal",Pe="sentient-revealed",Kt=240,kt=!1;function On(){var e;kt=!1,typeof document!="undefined"&&((e=document.getElementById(Nt))==null||e.remove())}function jo(e){if(kt||e.getElementById(Nt)){kt=!0;return}let t=qe(e.createElement("style"),e);t.id=Nt,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${Pe}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${Pe}{animation:${Pe} ${Kt}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),kt=!0}function Dn(e,t={}){var u;let n=(u=t.doc)!=null?u:typeof document!="undefined"?document:void 0;if(!n||!(e instanceof Element)||(t.arm!==void 0&&e.setAttribute("data-sentient-arm",t.arm),t.persona!==void 0&&e.setAttribute("data-sentient-persona",t.persona),t.previous!==void 0&&t.previous===e.textContent))return!1;jo(n),e.classList.remove(Pe),e.offsetWidth,e.classList.add(Pe);let s=()=>{e.classList.remove(Pe),e.removeEventListener("animationend",s)};return e.addEventListener("animationend",s),!0}function Pn(e,t,n,s){let u=[];{let o=!1,f=[],a=()=>{if(o)return;let i=Date.now();for(f.push(i);f.length>0&&i-f[0]>500;)f.shift();f.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",a),u.push(()=>t.removeEventListener("click",a))}{let g=!1,S=o=>{if(g||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;g=!0;let f=typeof window!="undefined"?window.getSelection():null,a=f?f.toString().length:0;e("text_copy",{selectionLength:a})};document.addEventListener("copy",S),u.push(()=>document.removeEventListener("copy",S))}{let g=!1,S=!1,o=null,f=()=>{o!==null&&(clearTimeout(o),o=null)},a=()=>{g||!S||(f(),o=setTimeout(()=>{!g&&S&&(g=!0,e("scroll_hesitation"))},3e3))},i=()=>{f(),a()},c=C=>{for(let T of C)S=T.intersectionRatio>.3,S?a():f()},b=new IntersectionObserver(c,{threshold:[.3]});b.observe(t),window.addEventListener("scroll",i,{passive:!0}),u.push(()=>{b.disconnect(),window.removeEventListener("scroll",i),f()})}if((s==null?void 0:s.tabLoss)!==!1){let g=!1,S=n!=null?n:Date.now(),o=()=>{if(g||document.visibilityState!=="hidden")return;let f=Date.now()-S;f<15e3&&(g=!0,e("tab_loss",{timeOnPage:f}))};document.addEventListener("visibilitychange",o),u.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let g of u)g()}}function Wo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Mn="https://api.sentient-ui.com/v1/events",J=new Map,Nn=null;function Vo(e,t){let n=J.get(e);n&&n.upgrade&&(n.reinit=t)}function Ho(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var zo=3;function Gt(){return rt()}function vt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Qo(){let e=new WeakMap,t=new Map,n=!1,s=(o,f,a)=>{let i=o.get(f);return a===null?i?!0:(o.set(f,new Set),!1):i?i.has(a)?!0:(i.add(a),!1):(o.set(f,new Set([a])),!1)},u=typeof window!="undefined"&&"event"in window,g=()=>{if(!u)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},S=()=>{if(u){Promise.resolve().then(()=>{n=!1,t.clear()});return}let o=!1,f=()=>{o||(o=!0,n=!1,t.clear())};if(setTimeout(f,0),typeof MessageChannel=="function"){let a=new MessageChannel;a.port1.onmessage=()=>{a.port1.close(),a.port2.close(),f()},a.port2.postMessage(0)}};return{firedBefore(o,f){let a=g();if(a){let c=e.get(a);return c||(c=new Map,e.set(a,c)),s(c,o,f)}let i=s(t,o,f);return!i&&!n&&(n=!0,S()),i}}}var Kn=new Set;function Xo(e,t,n){let s=typeof window=="undefined"?null:window.history;if(!s)return()=>{};let u=!1,g,S=()=>{if(u)return;let a=vt();!a||a===g||(g=a,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${a}`))},o=[];for(let a of["pushState","replaceState"]){let i=s[a],c=function(...b){let C=i.apply(this,b);return S(),C};s[a]=c,o.push([a,i,c])}window.addEventListener("popstate",S);let f=vt();return f&&Kn.has(`${t}:${f}`)?g=f:S(),()=>{if(!u){u=!0,window.removeEventListener("popstate",S);for(let[a,i,c]of o)s[a]===c&&(s[a]=i)}}}var ze={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Jo(){try{return gt(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Gn(e){return e.replace(/\/events\/?$/,"")}function Wt(){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 qo(e){var f;if(typeof window=="undefined")return;let t=e!=null?e:Nn;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=J.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:s,upgrade:u,reinit:g}=n;if(!u){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(s.respectDoNotTrack!==!1&&Wt())return;let S=(g!=null?g:Un)(Se(A({},s),{consent:!0}));u(S);let o=(f=J.get(t))==null?void 0:f.dispose;J.set(t,{config:Se(A({},s),{consent:!0}),upgrade:null,dispose:o})}function Yo(e,t){var $;let n=e.preConsentBehavior==="statistical_winner",s=Gn(($=e.ingestUrl)!=null?$:Mn),u={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},g=new Map,S=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(d,m,h){if(!n)return Promise.resolve(null);let p=g.get(d);return p?Promise.resolve(p):jt(S,d,async()=>{try{let _=new URLSearchParams({componentId:d});for(let ee of m!=null?m:[])_.append("variantIds[]",ee);let M=ue(5e3),F;try{let ee=await fetch(`${s}/winner?${_.toString()}`,{headers:u,signal:M.signal});if(!ee.ok)return m!=null&&m[0]?{variantId:m[0],assignmentTtlMs:0}:null;F=await ee.json()}finally{M.clear()}let O={variantId:F.variantId,assignmentTtlMs:0};return g.set(d,O),O}catch(_){return m!=null&&m[0]?{variantId:m[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:()=>{}},f=!1,a=new Set,i=[],c=[],b=[],C=()=>{for(let[,,d]of b.splice(0))d(null);T.length=0},T=[],P=!1,K=()=>{if(f)return;P=!0;let d=J.get(e.apiKey);(d==null?void 0:d.upgrade)===q&&J.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},V=[],H=()=>{setTimeout(()=>{var d;try{(d=V.shift())==null||d(o)}catch(m){}V.length&&H()})},z=d=>{f?V.length?V.push(d):d(o):!t&&!P&&T.length<100?T.push(d):P&&e.debug&&console.warn("[sentient] goal dropped: client released")},Q={get gated(){return!f&&!t},get released(){return P&&!f},takeHeld:()=>T.splice(0),track:d=>o.track(d),goal:((d,m,h,p)=>z(_=>_.goal(d,m,h,p))),componentGoal:(d,m,h)=>o.componentGoal(d,m,h),identify:(d,m)=>o.identify(d,m),getAssignment:(d,m)=>o.getAssignment(d,m),isUnified:d=>{var m,h;return(h=(m=o.isUnified)==null?void 0:m.call(o,d))!=null?h:!1},assign:(d,m,h,p,_)=>o.assign(d,m,h,p,_),decide:d=>f?o.decide(d):P||t?Promise.resolve(null):new Promise(m=>b.push([d,Ft(),m])),getSlotResult:d=>o.getSlotResult(d),isSlotDecided:d=>{var m,h;return(h=(m=o.isSlotDecided)==null?void 0:m.call(o,d))!=null?h:!0},getSlotConfig:d=>o.getSlotConfig(d),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var d,m;return(m=(d=o.getStyleVocabulary)==null?void 0:d.call(o))!=null?m:null},reportSlots:(d,m,h,p)=>o.reportSlots(d,m,h,p),reportSkeleton:(d,m)=>{var h;return(h=o.reportSkeleton)==null?void 0:h.call(o,d,m)},reportAgentData:(d,m,h)=>{var p;return(p=o.reportAgentData)==null?void 0:p.call(o,d,m,h)},reportDrift:(d,m,h,p)=>{var _;return(_=o.reportDrift)==null?void 0:_.call(o,d,m,h,p)},requestSlots:(d,m,h)=>{var p;return f?(p=o.requestSlots)==null?void 0:p.call(o,d,m,h):i.push([d,m,h])},decideSlots:d=>{var m;return f?(m=o.decideSlots)==null?void 0:m.call(o,d):c.push(...d)},cancelSlots:d=>{var h;if(f)return(h=o.cancelSlots)==null?void 0:h.call(o,d);let m=new Set(d);for(let p of i)p[0]=p[0].filter(_=>!m.has(_));c=c.filter(p=>!m.has(p.id))},onSlotsChanged:d=>(a.add(d),()=>{a.delete(d)}),getPersona:()=>o.getPersona(),getVisitorId:()=>{var d,m;return(m=(d=o.getVisitorId)==null?void 0:d.call(o))!=null?m:null},fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(K(),C(),o.dispose()),destroy:()=>(K(),C(),f?o.destroy():ot(e.apiKey))};function q(d){var h,p,_;o=d,f=!0,T.length&&(V.push(...T.splice(0)),H());let m=Ft();for(let[M,F,O]of b.splice(0))F!==m?O(null):d.decide(M).then(O,()=>O(null));(h=d.onSlotsChanged)==null||h.call(d,()=>a.forEach(M=>M()));for(let[M,F,O]of i.splice(0))M.length>0&&((p=d.requestSlots)==null||p.call(d,M,F,O));c.length>0&&((_=d.decideSlots)==null||_.call(d,c.splice(0)))}return{proxy:Q,setInner:q}}function Ft(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function jt(e,t,n){let s=e.get(t);if(s)return s;let u=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,u),u}function Un(e){var Xt,Jt,qt,Yt,Zt,en,tn,nn,on,rn,sn;if(typeof window=="undefined")return ze;e.nonce&&Je(e.nonce),Nn=e.apiKey||"local";let t=J.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(r){}let n=e.respectDoNotTrack!==!1&&Wt(),s=e.consent===!1||n,u=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!u&&e.localMode!==!1)return J.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),s?ze:In(e);if(s){if(!e.apiKey||!e.apiKey.startsWith("pk_"))return e.preConsentBehavior==="statistical_winner"&&console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),J.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): the client was initialized with an invalid apiKey (expected a pk_ public key) \u2014 consent cannot enable tracking."}),ze;let{proxy:r,setInner:l}=Yo(e,n);return J.set(e.apiKey,{config:e,upgrade:n?null:l}),r}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."),ze;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),ze;let g=(Xt=e.ingestUrl)!=null?Xt:Mn,S=Date.now(),o=lt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey,cookieDomain:e.cookieDomain}),f=bn(void 0,e.apiKey),a=!1,i=se(e.apiKey),c=()=>!a&&se(e.apiKey)===i,b=new Set((Jt=e.initialUnified)!=null?Jt:[]),C=Se(A({},f),{get:(r,l)=>b.has(r)?null:f.get(r,l),set:(...r)=>{c()&&f.set(...r)}}),T=fn({ingestUrl:g,apiKey:e.apiKey}),P=Gn(g),K={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},V=new Set,H=mn({url:`${P}/goals`,apiKey:e.apiKey,headers:K,onDrop:(r,l)=>{if(!e.debug){if(V.has(l))return;V.add(l)}console.warn(`[sentient] goal dropped (HTTP ${l}) \u2014 this will not be retried. `+(l===400?"The session was not found: call init() and let the session upsert complete before firing goals.":l===401||l===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),r)}}),z=Fe((qt=navigator.userAgent)!=null?qt:""),Q=window.location.origin,q=je((Yt=document.referrer)!=null?Yt:"",Q,o.domain),$=(Zt=e.sessionSegment)!=null?Zt:`${z}:${q}`,d=new Map,m=new Map,h=new Map,p=new Set,_=new Map,M=null,F=null,O=null,ee=new Set,ie=new Set,v=new Map,B=new Map,ge=new Set,be=new Set,te=new Set,ve=new Set,xe=null,oe=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,we=new Set,ae=new Set,Qe=new Set,Be=new Map,xt=null,Xe=new Set,Le=new Map,wt=null,$n=2,Vt=new Map,re=!1,Ht=(r,l,y)=>{var k;let I=new Set,R=1;for(let x of r){l.delete(x);let w=((k=Vt.get(x))!=null?k:0)+1;Vt.set(x,w),w<=$n&&(I.add(x),w>R&&(R=w))}I.size>0&&setTimeout(()=>{re||y(I)},me(R))},Et=r=>{for(let l of r)h.has(l.id)||h.set(l.id,De(l))};if(e.initialSlots)for(let[r,l]of Object.entries(e.initialSlots))h.set(r,l),p.add(r);if(e.initialSlotConfig)for(let[r,l]of Object.entries(e.initialSlotConfig))_.set(r,l);e.initialPalette&&(M=e.initialPalette),e.initialVocabulary&&(F=e.initialVocabulary);let le=Ie(e.apiKey);if(le){for(let[r,l]of Object.entries(le.slots))h.has(r)||h.set(r,l);for(let[r,l]of Object.entries((en=le.slotConfig)!=null?en:{}))_.has(r)||_.set(r,l);!M&&le.palette&&(M=le.palette),!F&&le.vocabulary&&(F=le.vocabulary)}let zt={low:.15,medium:.5,high:.85};if(e.initialPersona)O=A({},e.initialPersona);else{let r=document.documentElement.dataset;r.sentientPersona?O={persona:r.sentientPersona,confidence:(nn=zt[(tn=r.sentientConfidence)!=null?tn:"low"])!=null?nn:.15}:le&&(O={persona:le.persona,confidence:(on=zt[le.band])!=null?on:.15})}if(e.initialAssignments)for(let[r,l]of Object.entries(e.initialAssignments))C.set(r,$,{variantId:l,assignedAt:Date.now(),segment:$,confidence:1});let ye=Promise.resolve(),Qt=o.getSessionId();if(Qt){let r=We((rn=document.referrer)!=null?rn:""),{utmParams:l,clickIds:y}=Jo(),I=A(A(A(A({sessionId:Qt,deviceClass:z,trafficSource:q,referrerDomain:r,utmParams:l,clickIds:y,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:Ve(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||$e((sn=navigator.userAgent)!=null?sn:"")},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}:{}),R=async()=>{for(let k=0;;k++){if(re||!c())return;let x=ue(5e3);try{let w=await fetch(`${P}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(I),headers:K,signal:x.signal});if(w.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(w.ok||Ce(w)==="dropped")return}catch(w){}finally{x.clear()}if(k>=zo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(w=>setTimeout(w,me(k+1)))}};try{ye=R()}catch(k){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:T});let Fn=Qo(),ke=null,_t=!1,W={goal(r,l={},y=1,I=0){var j,L,Y,ne,Z,X,E;let R=o.getSessionId();if(!R||re||!c())return;let k=Ho(l)?l:{metadata:l},x=[r,(j=k.externalId)!=null?j:"",(L=k.stepIndex)!=null?L:I,(Y=k.weight)!=null?Y:y].join("\0"),w=k.value!==void 0?`${k.value}\0${(ne=k.currency)!=null?ne:""}`:null;if(Fn.firedBefore(x,w)){e.debug&&console.log(`[sentient] goal("${r}") already recorded for this action \u2014 not sent twice`);return}let N=Gt(),D={sessionId:R,name:r,metadata:(Z=k.metadata)!=null?Z:{},weight:(X=k.weight)!=null?X:y,stepIndex:(E=k.stepIndex)!=null?E:I,goalId:N,value:k.value,currency:k.currency,externalId:k.externalId};e.debug&&console.log("[sentient] goal",D);let G={id:N,body:JSON.stringify(D)};ye.then(()=>H.send(G))},componentGoal(r,l,y){var N,D,G;let I=o.getSessionId();if(!I||re||!c())return;let R=C.get(r,$),k=R?null:(N=h.get(r))!=null?N:null;if(!R&&k===null){e.debug&&console.warn(`[sentient] componentGoal("${r}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!R&&!p.has(r)){e.debug&&console.warn(`[sentient] componentGoal("${r}"): slot not decided this session \u2014 not attributed`);return}let x=R?R.variantId:pt(k),w={id:Gt(),sessionId:I,projectId:e.apiKey,componentId:r,variantId:x,eventType:"goal_achieved",goalType:l,payload:A({reward:(D=y==null?void 0:y.reward)!=null?D:1,goalValue:y==null?void 0:y.value,currency:y==null?void 0:y.currency},(G=y==null?void 0:y.metadata)!=null?G:{}),timestamp:Date.now(),timeInSession:Date.now()-S,path:vt()};e.debug&&console.log("[sentient] componentGoal",w),ye.then(()=>{!re&&c()&&T.push(w)})},identify(r,l){let y=o.getSessionId();!y||re||!c()||ye.then(()=>{fetch(`${P}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:y,userId:r,userHash:l==null?void 0:l.userHash,ephemeral:o.isEphemeral()}),headers:K}).catch(()=>{})})},track(r){let l=o.getSessionId();if(!l||re||!c()||r.eventType==="variant_assigned"&&h.get(r.componentId)!==void 0&&!p.has(r.componentId)&&!C.get(r.componentId,$))return;let y=Se(A({path:vt()},r),{id:Gt(),sessionId:l,timestamp:Date.now(),timeInSession:Date.now()-S});e.debug&&console.log("[sentient] track",y),ye.then(()=>T.push(y))},getAssignment(r,l){return C.get(r,l)},isUnified:r=>b.has(r),async assign(r,l,y,I,R){var N;let k=o.getSessionId();if(!k)return null;let x=(R==null?void 0:R.unified)===!0;if(x&&b.has(r))return{variantId:(N=l==null?void 0:l[0])!=null?N:"",assignmentTtlMs:0,unified:!0};let w=C.get(r,$);if(w&&(l!=null&&l.length||w.content!==void 0)){let D=w.ttlMs&&w.ttlMs>0?Math.max(0,w.assignedAt+w.ttlMs-Date.now()):0;return{variantId:w.variantId,assignmentTtlMs:D,content:w.content}}return jt(d,x?`${r}\0unified`:r,async()=>{if(!await It(ye,2500)||re||!c())return null;let D=ue(3e4);try{let G={sessionId:k,componentId:r,variantIds:l};I!==void 0?G.agentDataByVariant=I:y!==void 0&&(G.agentData=y),x&&(G.caps={unified:!0});let j=await fetch(`${P}/assign`,{method:"POST",body:JSON.stringify(G),headers:K,signal:D.signal});if(!j.ok)return null;let L=await j.json();return L.unified===!0?x?(b.add(r),{variantId:L.variantId,assignmentTtlMs:0,unified:!0}):null:(C.set(r,$,A({variantId:L.variantId,assignedAt:Date.now(),segment:$,confidence:1,content:L.content},L.assignmentTtlMs&&L.assignmentTtlMs>0?{ttlMs:L.assignmentTtlMs}:{})),L)}catch(G){return null}finally{D.clear()}})},async decide(r){var k,x;let l=o.getSessionId();if(!l)return null;let y=(k=r.slots)!=null?k:[],I={sessionId:l};r.sections&&r.sections.length>0&&(I.sections=r.sections.map(w=>({id:w}))),I.components=(x=r.components)!=null?x:[],y.length>0&&(I.slots=y.map(He)),r.slotsFrom==="registry"&&(I.slotsFrom="registry",r.registrySlotIds&&(I.registrySlotIds=r.registrySlotIds),r.bootstrap===!1&&(I.bootstrap=!1),r.render&&Object.keys(r.render).length>0&&(I.render=r.render)),r.v&&(I.v=r.v),typeof r.pp=="number"&&(I.pp=r.pp),e.persona&&(I.persona=e.persona);let R=JSON.stringify(I);return jt(m,R,async()=>{var N,D,G,j,L,Y,ne,Z;if(!await It(ye,2500)||re||!c())return Et(y),null;let w=ue(3e4);try{let X=await fetch(`${P}/decide`,{method:"POST",body:R,headers:K,signal:w.signal});if(!X.ok)return Et(y),null;let E=await X.json(),ce=mt(E.stage,e.stageAttributes);e.stageAttributes&&yt(ce);let Ee={};for(let U of y){let de=(N=E.slots)==null?void 0:N[U.id];if(de!==void 0){Ee[U.id]=de,h.set(U.id,de),p.add(U.id);continue}let an=h.get(U.id);if(an!==void 0)Ee[U.id]=an;else{let ln=De(U);Ee[U.id]=ln,h.set(U.id,ln)}}if(E.slots)for(let[U,de]of Object.entries(E.slots))U in Ee||(Ee[U]=de,h.set(U,de),p.add(U));let jn=O!=null&&O.persona!=="unknown";E.persona&&!(E.persona==="unknown"&&jn)?O={persona:E.persona,confidence:(D=E.confidence)!=null?D:0}:O||(O={persona:"unknown",confidence:0});for(let[U,de]of Object.entries((G=E.assignments)!=null?G:{}))C.set(U,$,{variantId:de,assignedAt:Date.now(),segment:$,confidence:1});if(E.slotConfig)for(let[U,de]of Object.entries(E.slotConfig))_.set(U,de);E.palette&&(M=E.palette),E.vocabulary&&(F=E.vocabulary);for(let U of(j=r.registrySlotIds)!=null?j:[])(L=E.slotConfig)!=null&&L[U]||(_.delete(U),h.delete(U),p.delete(U));return c()&&Ae(e.apiKey,A(A(A(A({v:1,persona:O.persona,band:(0,$t.confidenceBand)(O.confidence),slots:Object.fromEntries(h),layoutOrder:(Y=E.layoutOrder)!=null?Y:null,savedAt:Date.now()},_.size>0?{slotConfig:Object.fromEntries(_)}:{}),M?{palette:M}:{}),F?{vocabulary:F}:{}),ce?{stage:ce}:{})),A(A(A(A(A(A(A({layoutOrder:(ne=E.layoutOrder)!=null?ne:null,assignments:(Z=E.assignments)!=null?Z:{},slots:Ee,persona:O.persona,confidence:O.confidence},E.slotConfig?{slotConfig:E.slotConfig}:{}),E.goals?{goals:E.goals}:{}),E.sectionMap?{sectionMap:E.sectionMap}:{}),E.palette?{palette:E.palette}:{}),E.vocabulary?{vocabulary:E.vocabulary}:{}),E.stage?{stage:E.stage}:{}),E.context?{context:E.context}:{})}catch(X){return Et(y),null}finally{w.clear()}})},getSlotResult(r){var l;return(l=h.get(r))!=null?l:null},isSlotDecided(r){return p.has(r)},getSlotConfig(r){var l;return(l=_.get(r))!=null?l:null},reportSlots(r,l,y,I){var k;let R={};for(let[x,w]of Object.entries(I!=null?I:{}))for(let N of w){let D=`${x}|${N.key}`;!oe.test(x)||te.has(D)||(te.add(D),((k=R[x])!=null?k:R[x]=[]).push(N))}Object.keys(R).length>0&&fetch(`${P}/slots/observed`,{method:"POST",headers:K,body:JSON.stringify({slotIds:Object.keys(R),authoredArms:R})}).catch(()=>{});for(let x of r)if(!(typeof x!="string"||x.length===0)){if(!oe.test(x)){Wo()&&!we.has(x)&&(we.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(!ee.has(x)){ee.add(x),ie.add(x);let w=l==null?void 0:l[x];if(typeof w=="string"){let D=w.replace(/\s+/g," ").trim().slice(0,400);D!==""&&v.set(x,D)}let N=y==null?void 0:y[x];N!==void 0&&B.set(x,N)}}ie.size===0||xe!=null||(xe=setTimeout(()=>{xe=null;let x=[...ie];ie.clear();for(let w=0;w<x.length;w+=20){let N=x.slice(w,w+20),D={},G={};for(let j of N){let L=v.get(j);L!==void 0&&(D[j]=L,v.delete(j));let Y=B.get(j);Y!==void 0&&(G[j]=Y,B.delete(j))}fetch(`${P}/slots/observed`,{method:"POST",headers:K,body:JSON.stringify(A(Se(A(A({slotIds:N},Object.keys(D).length>0?{baselineTexts:D}:{}),Object.keys(G).length>0?{baselineSkeletons:G}:{}),{pagePaths:Object.fromEntries(N.map(j=>[j,location.pathname]))}),Object.keys(D).length>0&&o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(r,l){!oe.test(r)||ge.has(r)||(ge.add(r),fetch(`${P}/slots/observed`,{method:"POST",headers:K,body:JSON.stringify({slotIds:[r],baselineSkeletons:{[r]:l}})}).catch(()=>{}))},reportAgentData(r,l,y){let I=`${r}|${l}`;!oe.test(r)||ve.has(I)||(ve.add(I),fetch(`${P}/slots/observed`,{method:"POST",headers:K,body:JSON.stringify(A(A({slotIds:[r],agentData:{[r]:{[l]:y}}},l.startsWith("authored.")?{authoredArms:{[r]:[{key:l.slice(9)}]}}:{}),o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{}))},reportDrift(r,l,y,I){let R=`${r}|${l}`,k=o.getSessionId();!k||be.has(R)||(be.add(R),fetch(`${P}/slots/drift`,{method:"POST",headers:K,body:JSON.stringify({sessionId:k,reports:[{slotId:r,expectedFp:l,observedFp:y,reason:I}]})}).catch(()=>{}))},requestSlots(r,l,y){var I,R;for(let k of r)Qe.has(k)||(Qe.add(k),oe.test(k)?Be.set(k,{text:l==null?void 0:l[k],render:(I=y==null?void 0:y.render)==null?void 0:I[k],skeleton:(R=y==null?void 0:y.skeletons)==null?void 0:R[k]}):W.reportSlots([k]));Be.size===0||xt!=null||(xt=setTimeout(()=>{xt=null;let k=[...Be];Be.clear();for(let x=0;x<k.length;x+=50){let w=k.slice(x,x+50),N={};for(let[D,G]of w)G.render&&(N[D]=G.render);W.decide({slotsFrom:"registry",registrySlotIds:w.map(([D])=>D),bootstrap:!1,render:N}).then(D=>{var G,j;if(D){let L={},Y={},ne=[];for(let[Z,X]of w){let E=(G=D.slotConfig)==null?void 0:G[Z];if(E){E.needsSkeleton&&X.skeleton&&((j=W.reportSkeleton)==null||j.call(W,Z,X.skeleton));continue}ne.push(Z),X.text&&(L[Z]=X.text),X.skeleton&&(Y[Z]=X.skeleton)}ne.length>0&&W.reportSlots(ne,L,Y)}else Ht(w.map(([L])=>L),Qe,L=>{var X;let Y={},ne={},Z={};for(let[E,ce]of w)L.has(E)&&(ce.text&&(Y[E]=ce.text),ce.render&&(ne[E]=ce.render),ce.skeleton&&(Z[E]=ce.skeleton));(X=W.requestSlots)==null||X.call(W,[...L],Y,{render:ne,skeletons:Z})});ae.forEach(L=>L())})}},0))},decideSlots(r){for(let l of r)Xe.has(l.id)||(Xe.add(l.id),Le.set(l.id,l));Le.size===0||wt!=null||(wt=setTimeout(()=>{wt=null;let l=[...Le.values()];Le.clear();for(let y=0;y<l.length;y+=30){let I=l.slice(y,y+30);W.decide({slots:I}).then(R=>{R||Ht(I.map(k=>k.id),Xe,k=>{var x;return(x=W.decideSlots)==null?void 0:x.call(W,I.filter(w=>k.has(w.id)))}),ae.forEach(k=>k())})}},0))},cancelSlots(r){for(let l of r)Be.delete(l)&&Qe.delete(l),Le.delete(l)&&Xe.delete(l)},onSlotsChanged(r){return ae.add(r),()=>{ae.delete(r)}},getStyleVocabulary(){return F},getSitePalette(){return M},getVisitorId:()=>c()?o.getSessionId():null,getPersona(){return O?{persona:O.persona,confidence:O.confidence,band:(0,$t.confidenceBand)(O.confidence)}:null},async fetchWeights(){var l;let r=ue(5e3);try{let y=await fetch(`${P}/weights`,{headers:K,signal:r.signal});return y.ok?(l=(await y.json()).components)!=null?l:[]:[]}catch(y){return[]}finally{r.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){T.flush(),H.flush()},dispose(){var r;ke==null||ke(),_t=!0,re=!0,T.destroy(),H.destroy(),((r=J.get(e.apiKey))==null?void 0:r.dispose)===W.dispose&&J.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var r;ke==null||ke(),_t=!0,re=!0,a=!0,Ze(e.apiKey),T.destroy({forget:!0}),H.destroy({forget:!0}),o.destroy(),C.clear(),((r=J.get(e.apiKey))==null?void 0:r.dispose)===W.dispose&&J.delete(e.apiKey);try{localStorage.removeItem(fe+e.apiKey),localStorage.removeItem(Ke(e.apiKey)),localStorage.removeItem(Ge(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${pe(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(l){}e.debug&&console.log("[sentient] destroyed")}};if(J.set(e.apiKey,{config:e,upgrade:null,dispose:W.dispose}),ke=Xo(W,e.apiKey,r=>{ye.then(()=>{_t||Kn.add(r)})}),e.debug){let r=window;r.__sentient&&(r.__sentient.client=W)}return W}0&&(module.exports={AGENT_INTENTS,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,CLASSIC_CRAWLER_TOKENS,CLICK_ID_KEYS,FORM_FIELD_KINDS,FORM_INPUT_TYPES,LEGACY_SESSION_COOKIE_NAME,LOCAL_MODE_BANNER,MAX_BLOCK_ARMS,MAX_BLOCK_CHILDREN,MAX_BLOCK_DEPTH,MAX_BLOCK_NODES,MAX_BLOCK_TEXT_LEN,MAX_FORM_FIELDS,MAX_FORM_SELECT_OPTIONS,MAX_SKELETON_LEAVES,MAX_SKELETON_NODES,MAX_SKELETON_TEXT,PAGE_SCOPE_RE,PROD_KEYLESS_ERROR,REVEAL_MS,SNAPSHOT_STORAGE_KEY_PREFIX,STAGE_ATTRIBUTE,_registerConsentUpgradeInit,agentIntent,agentUaList,applyNonce,armOfResult,attachMicroSignalDetectors,baselineResultFor,baselineSlots,classifiedAgents,containsFormBlock,cspNonce,deriveSessionSegment,detectDeviceClass,detectTimeOfDay,detectTrafficSource,exposedStage,extractTrackedParams,forgetGeneration,forgetVisitor,grantConsent,init,isDoNotTrackEnabled,matchedAgentToken,matchedCrawlerToken,normalizeUrlPattern,pageScopeMatches,readSnapshot,referrerDomainFromReferer,renderPrePaintScript,resetRevealStyles,reveal,routeKey,sessionCookieName,setCspNonce,setStageAttribute,toWireSlot,uaTokenMatch,urlMatches,writeSnapshot});
1
+ "use strict";var Qn=Object.create;var Me=Object.defineProperty,Xn=Object.defineProperties,Jn=Object.getOwnPropertyDescriptor,qn=Object.getOwnPropertyDescriptors,Yn=Object.getOwnPropertyNames,gn=Object.getOwnPropertySymbols,Zn=Object.getPrototypeOf,fn=Object.prototype.hasOwnProperty,eo=Object.prototype.propertyIsEnumerable;var pn=(e,t,n)=>t in e?Me(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,A=(e,t)=>{for(var n in t||(t={}))fn.call(t,n)&&pn(e,n,t[n]);if(gn)for(var n of gn(t))eo.call(t,n)&&pn(e,n,t[n]);return e},ge=(e,t)=>Xn(e,qn(t));var to=(e,t)=>{for(var n in t)Me(e,n,{get:t[n],enumerable:!0})},mn=(e,t,n,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Yn(t))!fn.call(e,d)&&d!==n&&Me(e,d,{get:()=>t[d],enumerable:!(s=Jn(t,d))||s.enumerable});return e};var yn=(e,t,n)=>(n=e!=null?Qn(Zn(e)):{},mn(t||!e||!e.__esModule?Me(n,"default",{value:e,enumerable:!0}):n,e)),no=e=>mn(Me({},"__esModule",{value:!0}),e);var nr={};to(nr,{AGENT_INTENTS:()=>pt,BLOCK_ALIGNS:()=>wo,BLOCK_EMPHASES:()=>Co,BLOCK_FITS:()=>Oo,BLOCK_GAPS:()=>xo,BLOCK_GRID_COLUMNS:()=>Do,BLOCK_HEADING_LEVELS:()=>Po,BLOCK_JUSTIFIES:()=>Eo,BLOCK_MAX_WIDTHS:()=>Mo,BLOCK_PADS:()=>Lo,BLOCK_RATIOS:()=>Ro,BLOCK_SIZES:()=>_o,BLOCK_SURFACES:()=>Bo,BLOCK_TEXT_ALIGNS:()=>To,BLOCK_TONES:()=>Ao,BLOCK_WEIGHTS:()=>Io,CLASSIC_CRAWLER_TOKENS:()=>Dt,CLICK_ID_KEYS:()=>Bt,FORM_FIELD_KINDS:()=>No,FORM_INPUT_TYPES:()=>Ko,LEGACY_SESSION_COOKIE_NAME:()=>be,LOCAL_MODE_BANNER:()=>Lt,MAX_BLOCK_ARMS:()=>Wo,MAX_BLOCK_CHILDREN:()=>jo,MAX_BLOCK_DEPTH:()=>Fo,MAX_BLOCK_NODES:()=>$o,MAX_BLOCK_TEXT_LEN:()=>Vo,MAX_FORM_FIELDS:()=>Go,MAX_FORM_SELECT_OPTIONS:()=>Uo,MAX_SKELETON_LEAVES:()=>Wr,MAX_SKELETON_NODES:()=>jr,MAX_SKELETON_TEXT:()=>Vr,PAGE_SCOPE_RE:()=>Nt,PROD_KEYLESS_ERROR:()=>vt,REVEAL_MS:()=>Gt,SNAPSHOT_STORAGE_KEY_PREFIX:()=>fe,STAGE_ATTRIBUTE:()=>yt,_registerConsentUpgradeInit:()=>Qo,agentIntent:()=>En,agentUaList:()=>Ue,applyNonce:()=>Ze,armOfResult:()=>mt,attachMicroSignalDetectors:()=>Nn,baselineResultFor:()=>Oe,baselineSlots:()=>An,classifiedAgents:()=>_n,containsFormBlock:()=>Bn,cspNonce:()=>Tt,deriveSessionSegment:()=>In,detectDeviceClass:()=>Fe,detectTimeOfDay:()=>Ve,detectTrafficSource:()=>je,exposedStage:()=>St,extractTrackedParams:()=>ft,forgetGeneration:()=>ie,forgetVisitor:()=>st,grantConsent:()=>er,init:()=>Wn,isDoNotTrackEnabled:()=>Ht,matchedAgentToken:()=>gt,matchedCrawlerToken:()=>Pt,normalizeUrlPattern:()=>Pn,pageScopeMatches:()=>On,readSnapshot:()=>_e,referrerDomainFromReferer:()=>We,renderPrePaintScript:()=>Sn,resetRevealStyles:()=>Ln,reveal:()=>Mn,routeKey:()=>Wt,sessionCookieName:()=>Ee,setCspNonce:()=>Ye,setStageAttribute:()=>ht,toWireSlot:()=>He,uaTokenMatch:()=>$e,urlMatches:()=>Dn,writeSnapshot:()=>Ie});module.exports=no(nr);function ue(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 s=setTimeout(()=>n(!1),t),d=()=>{clearTimeout(s),n(!0)};e.then(d,d)})}var Ct;function Ye(e){Ct=typeof e=="string"&&e!==""?e:void 0}function Tt(e=document){if(Ct)return Ct;try{let t=e.querySelector("script[nonce]");return(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"))||void 0}catch(t){return}}function Ze(e,t=document){let n=Tt(t);return n&&e.setAttribute("nonce",n),e}function pe(e){return e?`_${e.slice(0,12)}`:""}var be="_snt_uid";function Ee(e){return`${be}${pe(e)}`}var et="__sntForgetGen",oo=()=>{try{return window[et]}catch(e){return}};function tt(e){var t,n;try{let s=window,d=(t=s[et])!=null?t:s[et]={};d[e]=((n=d[e])!=null?n:0)+1}catch(s){}}function ie(e){var t,n;return(n=(t=oo())==null?void 0:t[e])!=null?n:0}var fe="_snt_snap:";var ro=["low","medium","high"];function _e(e){try{let t=localStorage.getItem(fe+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"||!ro.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(Date.now()-n.savedAt<2592e6)||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig)))return null;let s=n.vocabulary;return s!==void 0&&(typeof s!="object"||s===null||!Array.isArray(s.entries)||!Array.isArray(s.images))&&delete n.vocabulary,n.stage!==void 0&&typeof n.stage!="string"&&delete n.stage,n}catch(t){return null}}function Ie(e,t){try{localStorage.setItem(fe+e,JSON.stringify(t))}catch(n){}}function Sn(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(fe+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 me(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 nt(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let s=JSON.parse(n);return Array.isArray(s)?(localStorage.removeItem(e),s.slice(-t)):[]}catch(n){return[]}}function Ne(e,t,n){try{let s=(()=>{try{let g=localStorage.getItem(n);if(!g)return[];let S=JSON.parse(g);return Array.isArray(S)?S:[]}catch(g){return[]}})(),d=new Map;for(let g of s)d.set(g.id,g);for(let g of e)d.set(g.id,g);localStorage.setItem(n,JSON.stringify([...d.values()].slice(-t)))}catch(s){}}function ot(e,t){try{let n=localStorage.getItem(t);if(!n)return;let s=JSON.parse(n);if(!Array.isArray(s))return;let d=new Set(e),g=s.filter(S=>!d.has(S.id));if(g.length===s.length)return;g.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(g))}catch(n){}}var so=500,io=56*1024;function Ke(e){return`_snt_retry_${e.slice(0,12)}`}var ao={push:()=>{},flush:()=>{},destroy:()=>{}};function hn(e){var G,X,F;if(typeof window=="undefined")return ao;let t=(G=e.flushIntervalMs)!=null?G:5e3,n=(X=e.maxBatchSize)!=null?X:20,s=(F=e.maxRetrySize)!=null?F:100,d=e.ingestUrl,g=e.apiKey,S=Ke(g),o=!1,f=ie(g),l=(...x)=>{!o&&ie(g)===f&&Ne(...x)},i=[],u=new Set,h=[],T=x=>{for(let D of x)R.delete(D),!u.has(D)&&(u.add(D),h.push(D));for(;h.length>so;){let D=h.shift();D&&u.delete(D)}ot(x,S)},R=new Set,M=()=>{for(;i.length>s;){let x=i.shift();x&&R.delete(x.id)}},z=x=>{u.has(x.id)||R.has(x.id)||(R.add(x.id),i.push(x),M())},P=x=>{for(let D of x)u.has(D.id)||(R.add(D.id),i.push(D));M()},L=nt(S,s);for(let x of L)z(x);let Q=0,V=0,Y=(x,D=!0)=>{if(x.length===0)return;let ae=JSON.stringify(x),ye=x.map(Se=>Se.id),ne,xe=ue(15e3);try{ne=fetch(d,{method:"POST",keepalive:!0,signal:xe.signal,body:ae,headers:{"Content-Type":"application/json",Authorization:`Bearer ${g}`}})}catch(Se){l(x,s,S),P(x),V++,Q=Date.now()+me(V);return}Promise.resolve(ne).then(xe.clear,xe.clear);let Pe=Se=>{if(Ae(Se)!=="retry"){if(!Se.ok&&D){let ke=x.filter(re=>re.eventType!=="pageview");if(ke.length>0&&ke.length<x.length){T(x.filter(re=>re.eventType==="pageview").map(re=>re.id)),Y(ke,!1);return}}T(ye),V=0,Q=0;return}l(x,s,S),P(x),V++,Q=Date.now()+me(V)};ne&&typeof ne.then=="function"?ne.then(Pe).catch(()=>{l(x,s,S),P(x),V++,Q=Date.now()+me(V)}):Pe(ne)},te=typeof TextEncoder!="undefined"?new TextEncoder:null,c=x=>te?te.encode(x).length:x.length,p=x=>{let D=[],ae=2;for(let ye of x){let ne=c(JSON.stringify(ye))+1;if(D.length>0&&ae+ne>io||D.length>=n)break;D.push(ye),ae+=ne}return D},_=()=>{try{if(Date.now()<Q)return;for(;i.length>0&&!(Date.now()<Q);){let x=i.filter(ae=>!u.has(ae.id));if(i.length=0,x.length===0)break;let D=p(x);if(D.length===0)break;D.length<x.length&&i.push(...x.slice(D.length)),Y(D)}}catch(x){}},m=!0,v=null;v=setInterval(()=>{m&&_()},t);let N=()=>{document.visibilityState==="hidden"&&_()},j=()=>{_()};return document.addEventListener("visibilitychange",N),window.addEventListener("pagehide",j),{push(x){z(x),i.length>=n&&_()},flush:_,destroy(x){x!=null&&x.forget&&(o=!0),m=!1,v!==null&&(clearInterval(v),v=null),document.removeEventListener("visibilitychange",N),window.removeEventListener("pagehide",j),_()}}}var lo=200;function Ge(e){return`_snt_goal_retry_${e.slice(0,12)}`}var co={send:()=>{},flush:()=>{},destroy:()=>{}};function bn(e){var c,p,_;if(typeof window=="undefined")return co;let t=(c=e.flushIntervalMs)!=null?c:5e3,n=(p=e.maxRetrySize)!=null?p:100,s=(_=e.maxPerFlush)!=null?_:5,d=Ge(e.apiKey),g=!1,S=ie(e.apiKey),o=(...m)=>{!g&&ie(e.apiKey)===S&&Ne(...m)},f=[],l=new Set,i=new Set,u=[],h=0,T=0,R=!1,M=m=>{for(l.delete(m.id),i.has(m.id)||(i.add(m.id),u.push(m.id));u.length>lo;){let v=u.shift();v&&i.delete(v)}ot([m.id],d)},z=m=>{o([m],n,d),!i.has(m.id)&&!l.has(m.id)&&(l.add(m.id),f.push(m)),Date.now()>=h&&(T++,h=Date.now()+me(T))},P=m=>{let v,N=ue(15e3);try{v=fetch(e.url,{method:"POST",keepalive:!0,signal:N.signal,body:m.body,headers:e.headers})}catch(G){z(m);return}let j=G=>{var F;let X=Ae(G);if(X==="retry"){z(m);return}X==="dropped"&&((F=e.onDrop)==null||F.call(e,m,G.status)),M(m),T=0,h=0};Promise.resolve(v).then(N.clear,N.clear),v&&typeof v.then=="function"?v.then(j).catch(()=>z(m)):j(v)},L=()=>{try{if(R||Date.now()<h)return;let m=0;for(;f.length>0&&m<s&&!(Date.now()<h);){let v=f.shift();l.delete(v.id),!i.has(v.id)&&(m++,P(v))}}catch(m){}},Q=nt(d,n);for(let m of Q)l.has(m.id)||(l.add(m.id),f.push(m));Q.length>0&&Ne(Q,n,d);let V=setInterval(L,t),Y=()=>{document.visibilityState==="hidden"&&L()},te=()=>L();return document.addEventListener("visibilitychange",Y),window.addEventListener("pagehide",te),{send(m){if(R){i.has(m.id)||o([m],n,d);return}if(!(i.has(m.id)||l.has(m.id))){if(Date.now()<h){o([m],n,d),l.add(m.id),f.push(m);return}P(m)}},flush:L,destroy(m){m!=null&&m.forget&&(g=!0),clearInterval(V),document.removeEventListener("visibilitychange",Y),window.removeEventListener("pagehide",te),L(),R=!0}}}function rt(e){let t=(e||"").toLowerCase();if(!t.includes(".")||/^[\d.]+$|:/.test(t))return[];let n=t.split("."),s=[];for(let d=n.length-2;d>=0;d--)s.push(n.slice(d).join("."));return s}function st(e){if(typeof window=="undefined"||!e)return!1;tt(e);let t=!1,n=Ee(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let S=location.protocol==="https:"?"; Secure":"";for(let o of["",...rt(location.hostname)])document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${o?`; domain=${o}`:""}${S}`;t=!0}}catch(S){}let s=pe(e),d=[n,"_snt_graph_edges",fe+e,Ke(e),Ge(e),`_snt_graph_nodes${s}`],g=[`_snt_asgn${s}_`];for(let S of["localStorage","sessionStorage"])try{let o=window[S];for(let f of d)o.getItem(f)!==null&&(o.removeItem(f),t=!0);for(let f=o.length-1;f>=0;f--){let l=o.key(f);l&&g.some(i=>l.startsWith(i))&&(o.removeItem(l),t=!0)}}catch(o){}try{(new RegExp(`(?:^|; )${be}=[^;]`).test(document.cookie)||localStorage.getItem(be)!==null||sessionStorage.getItem(be)!==null)&&localStorage.setItem(`${be}_tomb${s}`,"1")}catch(S){}return t}function it(){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 kn="_snt_uid",uo=365,Ce="_snt_uid";function go(){return it()}function Te(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function xn(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function ct(e,t,n,s){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${s?`; domain=${s}`:""}${xn()}`}catch(d){}}function at(e){try{return localStorage.getItem(e)}catch(t){return null}}function vn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Ot(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function po(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function fo(e){try{sessionStorage.removeItem(e)}catch(t){}}function mo(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${xn()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function yo(e){try{localStorage.removeItem(e)}catch(t){}}function lt(e,t){ct(e,"",0,t)}var So={getSessionId:()=>null,isEphemeral:()=>!1,domain:null,destroy:()=>{}};function ho(e,t){if(e===!1)return null;if(typeof e=="string")return e.replace(/^\./,"");for(let n of rt(location.hostname))if(ct(t,"1",10,n),Te(t)==="1")return lt(t,n),n;return null}function dt(e){var P,L,Q,V,Y,te,c;if(typeof window=="undefined")return So;let t=pe(e==null?void 0:e.apiKey),n=(P=e==null?void 0:e.cookieName)!=null?P:Ee(e==null?void 0:e.apiKey),s=`${Ce}${t}`,d=`${Ce}_tomb${t}`,S=((L=e==null?void 0:e.cookieTTLDays)!=null?L:uo)*24*60*60,o=p=>p&&p.length>0?p:null,f=()=>{var p,_;return t&&!(e!=null&&e.cookieName)&&at(d)===null?(_=(p=o(Te(kn)))!=null?p:o(at(Ce)))!=null?_:o(Ot(Ce)):null},l=ho(e==null?void 0:e.cookieDomain,`${n}_dom`),i=o(Te(n)),u=l?(lt(n),o(Te(n))):null,h=(c=(te=(Y=(V=(Q=u!=null?u:i)!=null?Q:o(at(s)))!=null?V:o(Ot(s)))!=null?Y:f())!=null?te:o(e==null?void 0:e.ssrSessionId))!=null?c:go();ct(n,h,S,l),l&&Te(n)!==h&&(l=null,ct(n,h,S));let T=vn(s,h),R=mo(n),M=T?!1:po(s,h),z=!T&&!R&&!M;return{getSessionId:()=>h,isEphemeral:()=>z,domain:l,destroy:()=>{h=null,lt(n),lt(n,l),yo(s),fo(s),t&&!(e!=null&&e.cookieName)&&(Te(kn)!==null||at(Ce)!==null||Ot(Ce)!==null)&&vn(d,"1")}}}var bo=1800*1e3;function ut(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function wn(e=bo,t){let n=new Map,s=`_snt_asgn${pe(t)}_`,d=(l,i)=>`${s}${encodeURIComponent(l)}:${encodeURIComponent(i)}`,g=l=>{let i=l.slice(s.length),u=i.indexOf(":");if(u<0)return null;try{return{componentId:decodeURIComponent(i.slice(0,u)),segment:decodeURIComponent(i.slice(u+1))}}catch(h){return null}},S=()=>{try{let l=[];for(let i=0;i<localStorage.length;i++){let u=localStorage.key(i);u!=null&&u.startsWith(s)&&l.push(u)}return l}catch(l){return[]}},o=l=>l.assignedAt+(l.ttlMs&&l.ttlMs>0?l.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let l of S())try{let i=localStorage.getItem(l);if(!i)continue;let u=JSON.parse(i);if(o(u)){localStorage.removeItem(l);continue}let h=g(l);if(!h)continue;n.set(ut(h.componentId,h.segment),u)}catch(i){}})(),{get(l,i){let u=n.get(ut(l,i));return u?o(u)?(n.delete(ut(l,i)),null):u:null},set(l,i,u){let h=ut(l,i);n.set(h,u);try{localStorage.setItem(d(l,i),JSON.stringify(u))}catch(T){}},clear(){n.clear();for(let l of S())try{localStorage.removeItem(l)}catch(i){}}}}var Ue=["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 $e(e){return gt(e)!==null}function gt(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=Ue.find(s=>t.includes(s.toLowerCase())))!=null?n:null}var Dt=["Googlebot","Bingbot","DuckDuckBot","YandexBot","Baiduspider","Applebot","Slurp","facebookexternalhit","LinkedInBot","Twitterbot"];function Pt(e){var s;let t=gt(e);if(t)return t;if(!e)return null;let n=e.toLowerCase();return(s=Dt.find(d=>n.includes(d.toLowerCase())))!=null?s:null}var pt={GPTBot:"training","ChatGPT-User":"user","OAI-SearchBot":"search",ClaudeBot:"training","Claude-User":"user","Claude-SearchBot":"search",PerplexityBot:"search","Perplexity-User":"user","Google-Extended":"training","Applebot-Extended":"training","Meta-ExternalAgent":"training",Bytespider:"training",CCBot:"training",Amazonbot:"other","cohere-ai":"training",Diffbot:"other"};function En(e){if(!e)return"other";let t=Ue.find(n=>n.toLowerCase()===e.toLowerCase());return t&&pt[t]||"other"}function _n(){var t;let e={user:[],search:[],training:[],other:[]};for(let n of Ue)e[(t=pt[n])!=null?t:"other"].push(n);return e}function Fe(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 je(e,t,n){if(!e)return"direct";try{let s=new URL(e);if(t)try{if(new URL(t).host===s.host)return"direct"}catch(g){}let d=s.hostname.toLowerCase();return n&&`.${d}`.endsWith(`.${n}`)?"direct":/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(d)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(d)?"social":"referral"}catch(s){return"direct"}}function We(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var Bt=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function ft(e){let t={},n={};try{let s=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([d,g])=>{let S=Array.isArray(g)?g[0]:g;return S===void 0?[]:[[d,S]]});for(let[d,g]of s)d.startsWith("utm_")?d in t||(t[d]=g):Bt.includes(d)&&(d in n||(n[d]=g))}catch(s){}return{utmParams:t,clickIds:n}}function Ve(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function In(e){let t=ko("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function ko(e,t){var S,o,f,l,i,u,h,T;let n=(o=(S=t==null?void 0:t.userAgent)==null?void 0:S.trim())!=null?o:"",s=(l=(f=t==null?void 0:t.referer)==null?void 0:f.trim())!=null?l:"",d=(i=t==null?void 0:t.now)!=null?i:new Date,g=Pt(n);return A(A({sessionId:e,ephemeral:!1,utmParams:(u=t==null?void 0:t.utmParams)!=null?u:{},clickIds:(h=t==null?void 0:t.clickIds)!=null?h:{},deviceClass:n?Fe(n):"desktop",trafficSource:s?je(s,t==null?void 0:t.appOrigin):"direct",referrerDomain:We(s),timeOfDay:Ve(d),dayOfWeek:(T=["sun","mon","tue","wed","thu","fri","sat"][d.getDay()])!=null?T:"sun",automation:(t==null?void 0:t.webdriver)===!0||$e(n)},g?{agentToken:g}:{}),t!=null&&t.landingPath?{landingPath:t.landingPath.split(/[?#]/)[0]}:{})}var Re=require("@sentientui/policy");function He(e){return A(A(A({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 Oe(e){let t=He(e);return(0,Re.slotResultFor)(t,(0,Re.slotBaselineArm)(t))}function An(e){let t={};for(let n of e)t[n.id]=Oe(n);return t}function mt(e){return typeof e=="string"?e:(0,Re.canonicalArm)(e)}var Cn=require("@sentientui/policy"),yt="data-sentient-stage";function St(e,t){return!t||typeof e!="string"||!(e==="returning"||Cn.STAGE_KEYS.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function ht(e,t=document){try{e?t.documentElement.setAttribute(yt,e):t.documentElement.removeAttribute(yt)}catch(n){}}var jt=require("@sentientui/policy");var kt=require("@sentientui/policy");var vt="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Lt="[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.",Tn=!1,bt=!1;function vo(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function Rn(e){var l;let t=dt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(l=t.getSessionId())!=null?l:"local",s=vo(),d=import("@sentientui/core/local").then(i=>{let u=i;return u.LOCAL_ENGINE_AVAILABLE?(Tn||(Tn=!0,console.info(Lt)),u):(bt||(bt=!0,console.error(vt)),null)}).catch(()=>(bt||(bt=!0,console.error(vt)),null)),g=null,S={low:.15,medium:.5,high:.85},o=(()=>{var u;if(e.initialPersona)return A({},e.initialPersona);let i=_e(e.apiKey||"local");return i?{persona:i.persona,confidence:(u=S[i.band])!=null?u:.15}:null})();function f(i){let u=document.documentElement;u.dataset.sentientPersona===void 0&&(u.dataset.sentientPersona=i.persona,u.dataset.sentientConfidence=(0,kt.confidenceBand)(i.confidence))}return{isLocal:!0,async decide(i){var T,R,M;let u=await d;if(!u)return null;let h=u.createLocalEngine({sessionId:n,forcedPersona:s}).decide(i);return g=ge(A({},h),{layoutOrder:(R=(T=h.layoutOrder)!=null?T:g==null?void 0:g.layoutOrder)!=null?R:null,slots:A(A({},(M=g==null?void 0:g.slots)!=null?M:{}),h.slots)}),Ie(e.apiKey||"local",{v:1,persona:g.persona,band:(0,kt.confidenceBand)(g.confidence),slots:g.slots,layoutOrder:g.layoutOrder,savedAt:Date.now()}),f(h),h},getSlotResult(i){var u,h,T;return(T=(h=g==null?void 0:g.slots[i])!=null?h:(u=e.initialSlots)==null?void 0:u[i])!=null?T:null},getSlotConfig(i){var u,h;return(h=(u=e.initialSlotConfig)==null?void 0:u[i])!=null?h:null},getSitePalette(){var i;return(i=e.initialPalette)!=null?i:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let i=g!=null?g:o;return i?{persona:i.persona,confidence:i.confidence,band:(0,kt.confidenceBand)(i.confidence)}:null},async assign(i,u){var R;let h=await d;return!h||!u||u.length===0?u!=null&&u[0]?{variantId:u[0],assignmentTtlMs:0}:null:{variantId:(R=h.createLocalEngine({sessionId:n,forcedPersona:s}).decide({components:[{id:i,variantIds:u}]}).assignments[i])!=null?R:u[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>t.destroy()}}var Nt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Mt(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function On(e,t){if(e===void 0||!Nt.test(e))return!1;if(e==="*")return!0;let n=Mt(t);if(e.endsWith("/*")){let s=Mt(e.slice(0,-2));return n.startsWith(s==="/"?"/":`${s}/`)&&n!==s}return n===Mt(e)}function Dn(e,t){if(!e)return!1;if(e==="/")return t==="/";let n=e.endsWith("/")?e.slice(0,-1):e;return t===n||t.startsWith(`${n}/`)}function Pn(e){if(!/^https?:\/\//i.test(e))return e;try{return new URL(e).pathname||"/"}catch(t){return e}}var xo=["none","sm","md","lg"],wo=["start","center","end","stretch"],Eo=["start","center","end","between"],_o=["sm","md","lg"],Io=["normal","medium","bold"],Ao=["default","muted","accent"],Co=["primary","secondary","ghost"],To=["left","center","right"],Ro=["auto","square","landscape","wide"],Oo=["cover","contain"],Do=[2,3,4],Po=[1,2,3,4],Bo=["default","raised"],Lo=["none","sm","md","lg"],Mo=["measure"],No=["input","textarea","select"],Ko=["text","email","number","tel"],Go=5,Uo=8,$o=64,Fo=5,jo=12,Wo=4,Vo=500;function Bn(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="form"?!0:Array.isArray(t.children)?t.children.some(Bn):!1}var jr=40,Wr=120,Vr=300;var Kt="sentient-reveal",De="sentient-revealed",Gt=240,xt=!1;function Ln(){var e;xt=!1,typeof document!="undefined"&&((e=document.getElementById(Kt))==null||e.remove())}function Ho(e){if(xt||e.getElementById(Kt)){xt=!0;return}let t=Ze(e.createElement("style"),e);t.id=Kt,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${De}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${De}{animation:${De} ${Gt}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),xt=!0}function Mn(e,t={}){var d;let n=(d=t.doc)!=null?d:typeof document!="undefined"?document:void 0;if(!n||!(e instanceof Element)||(t.arm!==void 0&&e.setAttribute("data-sentient-arm",t.arm),t.persona!==void 0&&e.setAttribute("data-sentient-persona",t.persona),t.previous!==void 0&&t.previous===e.textContent))return!1;Ho(n),e.classList.remove(De),e.offsetWidth,e.classList.add(De);let s=()=>{e.classList.remove(De),e.removeEventListener("animationend",s)};return e.addEventListener("animationend",s),!0}function Nn(e,t,n,s){let d=[];{let o=!1,f=[],l=()=>{if(o)return;let i=Date.now();for(f.push(i);f.length>0&&i-f[0]>500;)f.shift();f.length>=3&&(o=!0,e("rage_click"))};t.addEventListener("click",l),d.push(()=>t.removeEventListener("click",l))}{let g=!1,S=o=>{if(g||!(o.target instanceof Node)||!t.contains(o.target)&&t!==o.target)return;g=!0;let f=typeof window!="undefined"?window.getSelection():null,l=f?f.toString().length:0;e("text_copy",{selectionLength:l})};document.addEventListener("copy",S),d.push(()=>document.removeEventListener("copy",S))}{let g=!1,S=!1,o=null,f=()=>{o!==null&&(clearTimeout(o),o=null)},l=()=>{g||!S||(f(),o=setTimeout(()=>{!g&&S&&(g=!0,e("scroll_hesitation"))},3e3))},i=()=>{f(),l()},u=T=>{for(let R of T)S=R.intersectionRatio>.3,S?l():f()},h=new IntersectionObserver(u,{threshold:[.3]});h.observe(t),window.addEventListener("scroll",i,{passive:!0}),d.push(()=>{h.disconnect(),window.removeEventListener("scroll",i),f()})}if((s==null?void 0:s.tabLoss)!==!1){let g=!1,S=n!=null?n:Date.now(),o=()=>{if(g||document.visibilityState!=="hidden")return;let f=Date.now()-S;f<15e3&&(g=!0,e("tab_loss",{timeOnPage:f}))};document.addEventListener("visibilitychange",o),d.push(()=>document.removeEventListener("visibilitychange",o))}return()=>{for(let g of d)g()}}function zo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Un="https://api.sentient-ui.com/v1/events",Gn=()=>import("@sentientui/core/internal-traffic"),q=new Map,$n=null;function Qo(e,t){let n=q.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 Jo=3;function $t(){return it()}function wt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function qo(){let e=new WeakMap,t=new Map,n=!1,s=(o,f,l)=>{let i=o.get(f);return l===null?i?!0:(o.set(f,new Set),!1):i?i.has(l)?!0:(i.add(l),!1):(o.set(f,new Set([l])),!1)},d=typeof window!="undefined"&&"event"in window,g=()=>{if(!d)return;let o=window.event;return typeof Event=="function"&&o instanceof Event?o:void 0},S=()=>{if(d){Promise.resolve().then(()=>{n=!1,t.clear()});return}let o=!1,f=()=>{o||(o=!0,n=!1,t.clear())};if(setTimeout(f,0),typeof MessageChannel=="function"){let l=new MessageChannel;l.port1.onmessage=()=>{l.port1.close(),l.port2.close(),f()},l.port2.postMessage(0)}};return{firedBefore(o,f){let l=g();if(l){let u=e.get(l);return u||(u=new Map,e.set(l,u)),s(u,o,f)}let i=s(t,o,f);return!i&&!n&&(n=!0,S()),i}}}var Fn=new Set;function Yo(e,t,n){let s=typeof window=="undefined"?null:window.history;if(!s)return()=>{};let d=!1,g,S=()=>{if(d)return;let l=wt();!l||l===g||(g=l,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${l}`))},o=[];for(let l of["pushState","replaceState"]){let i=s[l],u=function(...h){let T=i.apply(this,h);return S(),T};s[l]=u,o.push([l,i,u])}window.addEventListener("popstate",S);let f=wt();return f&&Fn.has(`${t}:${f}`)?g=f:S(),()=>{if(!d){d=!0,window.removeEventListener("popstate",S);for(let[l,i,u]of o)s[l]===u&&(s[l]=i)}}}var ze={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 ft(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function jn(e){return e.replace(/\/events\/?$/,"")}function Ht(){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 er(e){var f;if(typeof window=="undefined")return;let t=e!=null?e:$n;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=q.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:s,upgrade:d,reinit:g}=n;if(!d){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(s.respectDoNotTrack!==!1&&Ht())return;let S=(g!=null?g:Wn)(ge(A({},s),{consent:!0}));d(S);let o=(f=q.get(t))==null?void 0:f.dispose;q.set(t,{config:ge(A({},s),{consent:!0}),upgrade:null,dispose:o})}function tr(e,t){var te;let n=e.preConsentBehavior==="statistical_winner",s=jn((te=e.ingestUrl)!=null?te:Un),d={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},g=new Map,S=new Map,o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(c,p,_){if(!n)return Promise.resolve(null);let m=g.get(c);return m?Promise.resolve(m):Vt(S,c,async()=>{try{let v=new URLSearchParams({componentId:c});for(let X of p!=null?p:[])v.append("variantIds[]",X);let N=ue(5e3),j;try{let X=await fetch(`${s}/winner?${v.toString()}`,{headers:d,signal:N.signal});if(!X.ok)return p!=null&&p[0]?{variantId:p[0],assignmentTtlMs:0}:null;j=await X.json()}finally{N.clear()}let G={variantId:j.variantId,assignmentTtlMs:0};return g.set(c,G),G}catch(v){return p!=null&&p[0]?{variantId:p[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:()=>{}},f=!1,l=new Set,i=[],u=[],h=[],T=()=>{for(let[,,c]of h.splice(0))c(null);R.length=0},R=[],M=!1,z=()=>{if(f)return;M=!0;let c=q.get(e.apiKey);(c==null?void 0:c.upgrade)===Y&&q.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},P=[],L=()=>{setTimeout(()=>{var c;try{(c=P.shift())==null||c(o)}catch(p){}P.length&&L()})},Q=c=>{f?P.length?P.push(c):c(o):!t&&!M&&R.length<100?R.push(c):M&&e.debug&&console.warn("[sentient] goal dropped: client released")},V={get gated(){return!f&&!t},get released(){return M&&!f},takeHeld:()=>R.splice(0),track:c=>o.track(c),goal:((c,p,_,m)=>Q(v=>v.goal(c,p,_,m))),componentGoal:(c,p,_)=>o.componentGoal(c,p,_),identify:(c,p)=>o.identify(c,p),getAssignment:(c,p)=>o.getAssignment(c,p),isUnified:c=>{var p,_;return(_=(p=o.isUnified)==null?void 0:p.call(o,c))!=null?_:!1},assign:(c,p,_,m,v)=>o.assign(c,p,_,m,v),decide:c=>f?o.decide(c):M||t?Promise.resolve(null):new Promise(p=>h.push([c,Wt(),p])),getSlotResult:c=>o.getSlotResult(c),isSlotDecided:c=>{var p,_;return(_=(p=o.isSlotDecided)==null?void 0:p.call(o,c))!=null?_:!0},getSlotConfig:c=>o.getSlotConfig(c),getSitePalette:()=>o.getSitePalette(),getStyleVocabulary:()=>{var c,p;return(p=(c=o.getStyleVocabulary)==null?void 0:c.call(o))!=null?p:null},reportSlots:(c,p,_,m)=>o.reportSlots(c,p,_,m),reportSkeleton:(c,p)=>{var _;return(_=o.reportSkeleton)==null?void 0:_.call(o,c,p)},reportAgentData:(c,p,_)=>{var m;return(m=o.reportAgentData)==null?void 0:m.call(o,c,p,_)},reportDrift:(c,p,_,m)=>{var v;return(v=o.reportDrift)==null?void 0:v.call(o,c,p,_,m)},requestSlots:(c,p,_)=>{var m;return f?(m=o.requestSlots)==null?void 0:m.call(o,c,p,_):i.push([c,p,_])},decideSlots:c=>{var p;return f?(p=o.decideSlots)==null?void 0:p.call(o,c):u.push(...c)},cancelSlots:c=>{var _;if(f)return(_=o.cancelSlots)==null?void 0:_.call(o,c);let p=new Set(c);for(let m of i)m[0]=m[0].filter(v=>!p.has(v));u=u.filter(m=>!p.has(m.id))},onSlotsChanged:c=>(l.add(c),()=>{l.delete(c)}),getPersona:()=>o.getPersona(),getVisitorId:()=>{var c,p;return(p=(c=o.getVisitorId)==null?void 0:c.call(o))!=null?p:null},fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),flush:()=>o.flush(),dispose:()=>(z(),T(),o.dispose()),destroy:()=>(z(),T(),f?o.destroy():st(e.apiKey))};function Y(c){var _,m,v;o=c,f=!0,R.length&&(P.push(...R.splice(0)),L());let p=Wt();for(let[N,j,G]of h.splice(0))j!==p?G(null):c.decide(N).then(G,()=>G(null));(_=c.onSlotsChanged)==null||_.call(c,()=>l.forEach(N=>N()));for(let[N,j,G]of i.splice(0))N.length>0&&((m=c.requestSlots)==null||m.call(c,N,j,G));u.length>0&&((v=c.decideSlots)==null||v.call(c,u.splice(0)))}return{proxy:V,setInner:Y}}function Wt(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Vt(e,t,n){let s=e.get(t);if(s)return s;let d=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,d),d}function Wn(e){var Yt,Zt,en,tn,nn,on,rn,sn,an,ln,cn;if(typeof window=="undefined")return ze;e.nonce&&Ye(e.nonce),$n=e.apiKey||"local";let t=q.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(r){}let n=e.respectDoNotTrack!==!1&&Ht(),s=e.consent===!1||n,d=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!d&&e.localMode!==!1)return q.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),s?ze:Rn(e);if(s){if(!e.apiKey||!e.apiKey.startsWith("pk_"))return e.preConsentBehavior==="statistical_winner"&&console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),q.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."}),ze;let{proxy:r,setInner:a}=tr(e,n);return q.set(e.apiKey,{config:e,upgrade:n?null:a}),r}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."),ze;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),ze;let g=(Yt=e.ingestUrl)!=null?Yt:Un,S=Date.now(),o=dt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey,cookieDomain:e.cookieDomain}),f={},l;try{/sentient_internal=/.test(location.search+document.cookie)&&(l=Gn().then(async r=>{f.internalToken=await r.takeInternalToken(o.domain)||void 0}).catch(()=>{})),(typeof e.internal=="function"?e.internal():e.internal)===!0&&(f.internal=!0)}catch(r){}let i=wn(void 0,e.apiKey),u=!1,h=ie(e.apiKey),T=()=>!u&&ie(e.apiKey)===h,R=new Set((Zt=e.initialUnified)!=null?Zt:[]),M=ge(A({},i),{get:(r,a)=>R.has(r)?null:i.get(r,a),set:(...r)=>{T()&&i.set(...r)}}),z=hn({ingestUrl:g,apiKey:e.apiKey}),P=jn(g),L={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},Q=new Set,V=bn({url:`${P}/goals`,apiKey:e.apiKey,headers:L,onDrop:(r,a)=>{if(!e.debug){if(Q.has(a))return;Q.add(a)}console.warn(`[sentient] goal dropped (HTTP ${a}) \u2014 this will not be retried. `+(a===400?"The session was not found: call init() and let the session upsert complete before firing goals.":a===401||a===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),r)}}),Y=Fe((en=navigator.userAgent)!=null?en:""),te=window.location.origin,c=je((tn=document.referrer)!=null?tn:"",te,o.domain),p=(nn=e.sessionSegment)!=null?nn:`${Y}:${c}`,_=new Map,m=new Map,v=new Map,N=new Set,j=new Map,G=null,X=null,F=null,x=new Set,D=new Set,ae=new Map,ye=new Map,ne=new Set,xe=new Set,Pe=new Set,Se=new Set,ke=null,re=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,zt=new Set,Qe=new Set,Xe=new Set,Be=new Map,Et=null,Je=new Set,Le=new Map,_t=null,Vn=2,Qt=new Map,se=!1,Xt=(r,a,y)=>{var b;let E=new Set,C=1;for(let k of r){a.delete(k);let w=((b=Qt.get(k))!=null?b:0)+1;Qt.set(k,w),w<=Vn&&(E.add(k),w>C&&(C=w))}E.size>0&&setTimeout(()=>{se||y(E)},me(C))},It=r=>{for(let a of r)v.has(a.id)||v.set(a.id,Oe(a))};if(e.initialSlots)for(let[r,a]of Object.entries(e.initialSlots))v.set(r,a),N.add(r);if(e.initialSlotConfig)for(let[r,a]of Object.entries(e.initialSlotConfig))j.set(r,a);e.initialPalette&&(G=e.initialPalette),e.initialVocabulary&&(X=e.initialVocabulary);let le=_e(e.apiKey);if(le){for(let[r,a]of Object.entries(le.slots))v.has(r)||v.set(r,a);for(let[r,a]of Object.entries((on=le.slotConfig)!=null?on:{}))j.has(r)||j.set(r,a);!G&&le.palette&&(G=le.palette),!X&&le.vocabulary&&(X=le.vocabulary)}let Jt={low:.15,medium:.5,high:.85};if(e.initialPersona)F=A({},e.initialPersona);else{let r=document.documentElement.dataset;r.sentientPersona?F={persona:r.sentientPersona,confidence:(sn=Jt[(rn=r.sentientConfidence)!=null?rn:"low"])!=null?sn:.15}:le&&(F={persona:le.persona,confidence:(an=Jt[le.band])!=null?an:.15})}if(e.initialAssignments)for(let[r,a]of Object.entries(e.initialAssignments))M.set(r,p,{variantId:a,assignedAt:Date.now(),segment:p,confidence:1});let he=Promise.resolve(),qt=o.getSessionId();if(qt){let r=We((ln=document.referrer)!=null?ln:""),{utmParams:a,clickIds:y}=Zo(),E=A(A(A(A({sessionId:qt,deviceClass:Y,trafficSource:c,referrerDomain:r,utmParams:a,clickIds:y,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:Ve(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:o.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||$e((cn=navigator.userAgent)!=null?cn:"")},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}:{}),C=async()=>{l&&await qe(l,2500);for(let b=0;;b++){if(se||!T())return;let k=ue(5e3);try{let w=await fetch(`${P}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(Object.assign(E,f)),headers:L,signal:k.signal});if(w.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(w.ok||Ae(w)==="dropped")return}catch(w){}finally{k.clear()}if(b>=Jo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(w=>setTimeout(w,me(b+1)))}};try{he=C()}catch(b){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:z});let Hn=qo(),ve=null,At=!1,H={goal(r,a={},y=1,E=0){var W,B,Z,oe,ee,J,I;let C=o.getSessionId();if(!C||se||!T())return;let b=Xo(a)?a:{metadata:a},k=[r,(W=b.externalId)!=null?W:"",(B=b.stepIndex)!=null?B:E,(Z=b.weight)!=null?Z:y].join("\0"),w=b.value!==void 0?`${b.value}\0${(oe=b.currency)!=null?oe:""}`:null;if(Hn.firedBefore(k,w)){e.debug&&console.log(`[sentient] goal("${r}") already recorded for this action \u2014 not sent twice`);return}let K=$t(),O={sessionId:C,name:r,metadata:(ee=b.metadata)!=null?ee:{},weight:(J=b.weight)!=null?J:y,stepIndex:(I=b.stepIndex)!=null?I:E,goalId:K,value:b.value,currency:b.currency,externalId:b.externalId};e.debug&&console.log("[sentient] goal",O);let U={id:K,body:JSON.stringify(O)};he.then(()=>V.send(U))},componentGoal(r,a,y){var K,O,U;let E=o.getSessionId();if(!E||se||!T())return;let C=M.get(r,p),b=C?null:(K=v.get(r))!=null?K:null;if(!C&&b===null){e.debug&&console.warn(`[sentient] componentGoal("${r}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!C&&!N.has(r)){e.debug&&console.warn(`[sentient] componentGoal("${r}"): slot not decided this session \u2014 not attributed`);return}let k=C?C.variantId:mt(b),w={id:$t(),sessionId:E,projectId:e.apiKey,componentId:r,variantId:k,eventType:"goal_achieved",goalType:a,payload:A({reward:(O=y==null?void 0:y.reward)!=null?O:1,goalValue:y==null?void 0:y.value,currency:y==null?void 0:y.currency},(U=y==null?void 0:y.metadata)!=null?U:{}),timestamp:Date.now(),timeInSession:Date.now()-S,path:wt()};e.debug&&console.log("[sentient] componentGoal",w),he.then(()=>{!se&&T()&&z.push(w)})},identify(r,a){let y=o.getSessionId();if(!y||se||!T())return;let E=(a==null?void 0:a.email)!==void 0?Gn().then(C=>C.emailFields(a.email)).catch(()=>({})):{};Promise.all([he,E]).then(([,C])=>{fetch(`${P}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(ge(A(A({sessionId:y,userId:r,userHash:a==null?void 0:a.userHash},C),f),{ephemeral:o.isEphemeral()})),headers:L}).catch(()=>{})})},track(r){let a=o.getSessionId();if(!a||se||!T()||r.eventType==="variant_assigned"&&v.get(r.componentId)!==void 0&&!N.has(r.componentId)&&!M.get(r.componentId,p))return;let y=ge(A({path:wt()},r),{id:$t(),sessionId:a,timestamp:Date.now(),timeInSession:Date.now()-S});e.debug&&console.log("[sentient] track",y),he.then(()=>z.push(y))},getAssignment(r,a){return M.get(r,a)},isUnified:r=>R.has(r),async assign(r,a,y,E,C){var K;let b=o.getSessionId();if(!b)return null;let k=(C==null?void 0:C.unified)===!0;if(k&&R.has(r))return{variantId:(K=a==null?void 0:a[0])!=null?K:"",assignmentTtlMs:0,unified:!0};let w=M.get(r,p);if(w&&(a!=null&&a.length||w.content!==void 0)){let O=w.ttlMs&&w.ttlMs>0?Math.max(0,w.assignedAt+w.ttlMs-Date.now()):0;return{variantId:w.variantId,assignmentTtlMs:O,content:w.content}}return Vt(_,k?`${r}\0unified`:r,async()=>{if(!await qe(he,2500)||se||!T())return null;let O=ue(3e4);try{let U={sessionId:b,componentId:r,variantIds:a};E!==void 0?U.agentDataByVariant=E:y!==void 0&&(U.agentData=y),k&&(U.caps={unified:!0});let W=await fetch(`${P}/assign`,{method:"POST",body:JSON.stringify(U),headers:L,signal:O.signal});if(!W.ok)return null;let B=await W.json();return B.unified===!0?k?(R.add(r),{variantId:B.variantId,assignmentTtlMs:0,unified:!0}):null:(M.set(r,p,A({variantId:B.variantId,assignedAt:Date.now(),segment:p,confidence:1,content:B.content},B.assignmentTtlMs&&B.assignmentTtlMs>0?{ttlMs:B.assignmentTtlMs}:{})),B)}catch(U){return null}finally{O.clear()}})},async decide(r){var b,k;let a=o.getSessionId();if(!a)return null;let y=(b=r.slots)!=null?b:[],E={sessionId:a};r.sections&&r.sections.length>0&&(E.sections=r.sections.map(w=>({id:w}))),E.components=(k=r.components)!=null?k:[],y.length>0&&(E.slots=y.map(He)),r.slotsFrom==="registry"&&(E.slotsFrom="registry",r.registrySlotIds&&(E.registrySlotIds=r.registrySlotIds),r.bootstrap===!1&&(E.bootstrap=!1),r.render&&Object.keys(r.render).length>0&&(E.render=r.render)),r.v&&(E.v=r.v),typeof r.pp=="number"&&(E.pp=r.pp),e.persona&&(E.persona=e.persona),Object.assign(E,f);let C=JSON.stringify(E);return Vt(m,C,async()=>{var K,O,U,W,B,Z,oe,ee;if(!await qe(he,2500)||se||!T())return It(y),null;let w=ue(3e4);try{let J=await fetch(`${P}/decide`,{method:"POST",body:C,headers:L,signal:w.signal});if(!J.ok)return It(y),null;let I=await J.json(),ce=St(I.stage,e.stageAttributes);e.stageAttributes&&ht(ce);let we={};for(let $ of y){let de=(K=I.slots)==null?void 0:K[$.id];if(de!==void 0){we[$.id]=de,v.set($.id,de),N.add($.id);continue}let dn=v.get($.id);if(dn!==void 0)we[$.id]=dn;else{let un=Oe($);we[$.id]=un,v.set($.id,un)}}if(I.slots)for(let[$,de]of Object.entries(I.slots))$ in we||(we[$]=de,v.set($,de),N.add($));let zn=F!=null&&F.persona!=="unknown";I.persona&&!(I.persona==="unknown"&&zn)?F={persona:I.persona,confidence:(O=I.confidence)!=null?O:0}:F||(F={persona:"unknown",confidence:0});for(let[$,de]of Object.entries((U=I.assignments)!=null?U:{}))M.set($,p,{variantId:de,assignedAt:Date.now(),segment:p,confidence:1});if(I.slotConfig)for(let[$,de]of Object.entries(I.slotConfig))j.set($,de);I.palette&&(G=I.palette),I.vocabulary&&(X=I.vocabulary);for(let $ of(W=r.registrySlotIds)!=null?W:[])(B=I.slotConfig)!=null&&B[$]||(j.delete($),v.delete($),N.delete($));return T()&&Ie(e.apiKey,A(A(A(A({v:1,persona:F.persona,band:(0,jt.confidenceBand)(F.confidence),slots:Object.fromEntries(v),layoutOrder:(Z=I.layoutOrder)!=null?Z:null,savedAt:Date.now()},j.size>0?{slotConfig:Object.fromEntries(j)}:{}),G?{palette:G}:{}),X?{vocabulary:X}:{}),ce?{stage:ce}:{})),A(A(A(A(A(A(A({layoutOrder:(oe=I.layoutOrder)!=null?oe:null,assignments:(ee=I.assignments)!=null?ee:{},slots:we,persona:F.persona,confidence:F.confidence},I.slotConfig?{slotConfig:I.slotConfig}:{}),I.goals?{goals:I.goals}:{}),I.sectionMap?{sectionMap:I.sectionMap}:{}),I.palette?{palette:I.palette}:{}),I.vocabulary?{vocabulary:I.vocabulary}:{}),I.stage?{stage:I.stage}:{}),I.context?{context:I.context}:{})}catch(J){return It(y),null}finally{w.clear()}})},getSlotResult(r){var a;return(a=v.get(r))!=null?a:null},isSlotDecided(r){return N.has(r)},getSlotConfig(r){var a;return(a=j.get(r))!=null?a:null},reportSlots(r,a,y,E){var b;let C={};for(let[k,w]of Object.entries(E!=null?E:{}))for(let K of w){let O=`${k}|${K.key}`;!re.test(k)||Pe.has(O)||(Pe.add(O),((b=C[k])!=null?b:C[k]=[]).push(K))}Object.keys(C).length>0&&fetch(`${P}/slots/observed`,{method:"POST",headers:L,body:JSON.stringify({slotIds:Object.keys(C),authoredArms:C})}).catch(()=>{});for(let k of r)if(!(typeof k!="string"||k.length===0)){if(!re.test(k)){zo()&&!zt.has(k)&&(zt.add(k),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(k)} 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(!x.has(k)){x.add(k),D.add(k);let w=a==null?void 0:a[k];if(typeof w=="string"){let O=w.replace(/\s+/g," ").trim().slice(0,400);O!==""&&ae.set(k,O)}let K=y==null?void 0:y[k];K!==void 0&&ye.set(k,K)}}D.size===0||ke!=null||(ke=setTimeout(()=>{ke=null;let k=[...D];D.clear();for(let w=0;w<k.length;w+=20){let K=k.slice(w,w+20),O={},U={};for(let W of K){let B=ae.get(W);B!==void 0&&(O[W]=B,ae.delete(W));let Z=ye.get(W);Z!==void 0&&(U[W]=Z,ye.delete(W))}fetch(`${P}/slots/observed`,{method:"POST",headers:L,body:JSON.stringify(A(ge(A(A({slotIds:K},Object.keys(O).length>0?{baselineTexts:O}:{}),Object.keys(U).length>0?{baselineSkeletons:U}:{}),{pagePaths:Object.fromEntries(K.map(W=>[W,location.pathname]))}),Object.keys(O).length>0&&o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(r,a){!re.test(r)||ne.has(r)||(ne.add(r),fetch(`${P}/slots/observed`,{method:"POST",headers:L,body:JSON.stringify({slotIds:[r],baselineSkeletons:{[r]:a}})}).catch(()=>{}))},reportAgentData(r,a,y){let E=`${r}|${a}`;!re.test(r)||Se.has(E)||(Se.add(E),fetch(`${P}/slots/observed`,{method:"POST",headers:L,body:JSON.stringify(A(A({slotIds:[r],agentData:{[r]:{[a]:y}}},a.startsWith("authored.")?{authoredArms:{[r]:[{key:a.slice(9)}]}}:{}),o.getSessionId()?{sessionId:o.getSessionId()}:{}))}).catch(()=>{}))},reportDrift(r,a,y,E){let C=`${r}|${a}`,b=o.getSessionId();!b||xe.has(C)||(xe.add(C),fetch(`${P}/slots/drift`,{method:"POST",headers:L,body:JSON.stringify({sessionId:b,reports:[{slotId:r,expectedFp:a,observedFp:y,reason:E}]})}).catch(()=>{}))},requestSlots(r,a,y){var E,C;for(let b of r)Xe.has(b)||(Xe.add(b),re.test(b)?Be.set(b,{text:a==null?void 0:a[b],render:(E=y==null?void 0:y.render)==null?void 0:E[b],skeleton:(C=y==null?void 0:y.skeletons)==null?void 0:C[b]}):H.reportSlots([b]));Be.size===0||Et!=null||(Et=setTimeout(()=>{Et=null;let b=[...Be];Be.clear();for(let k=0;k<b.length;k+=50){let w=b.slice(k,k+50),K={};for(let[O,U]of w)U.render&&(K[O]=U.render);H.decide({slotsFrom:"registry",registrySlotIds:w.map(([O])=>O),bootstrap:!1,render:K}).then(O=>{var U,W;if(O){let B={},Z={},oe=[];for(let[ee,J]of w){let I=(U=O.slotConfig)==null?void 0:U[ee];if(I){I.needsSkeleton&&J.skeleton&&((W=H.reportSkeleton)==null||W.call(H,ee,J.skeleton));continue}oe.push(ee),J.text&&(B[ee]=J.text),J.skeleton&&(Z[ee]=J.skeleton)}oe.length>0&&H.reportSlots(oe,B,Z)}else Xt(w.map(([B])=>B),Xe,B=>{var J;let Z={},oe={},ee={};for(let[I,ce]of w)B.has(I)&&(ce.text&&(Z[I]=ce.text),ce.render&&(oe[I]=ce.render),ce.skeleton&&(ee[I]=ce.skeleton));(J=H.requestSlots)==null||J.call(H,[...B],Z,{render:oe,skeletons:ee})});Qe.forEach(B=>B())})}},0))},decideSlots(r){for(let a of r)Je.has(a.id)||(Je.add(a.id),Le.set(a.id,a));Le.size===0||_t!=null||(_t=setTimeout(()=>{_t=null;let a=[...Le.values()];Le.clear();for(let y=0;y<a.length;y+=30){let E=a.slice(y,y+30);H.decide({slots:E}).then(C=>{C||Xt(E.map(b=>b.id),Je,b=>{var k;return(k=H.decideSlots)==null?void 0:k.call(H,E.filter(w=>b.has(w.id)))}),Qe.forEach(b=>b())})}},0))},cancelSlots(r){for(let a of r)Be.delete(a)&&Xe.delete(a),Le.delete(a)&&Je.delete(a)},onSlotsChanged(r){return Qe.add(r),()=>{Qe.delete(r)}},getStyleVocabulary(){return X},getSitePalette(){return G},getVisitorId:()=>T()?o.getSessionId():null,getPersona(){return F?{persona:F.persona,confidence:F.confidence,band:(0,jt.confidenceBand)(F.confidence)}:null},async fetchWeights(){var a;let r=ue(5e3);try{let y=await fetch(`${P}/weights`,{headers:L,signal:r.signal});return y.ok?(a=(await y.json()).components)!=null?a:[]:[]}catch(y){return[]}finally{r.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){z.flush(),V.flush()},dispose(){var r;ve==null||ve(),At=!0,se=!0,z.destroy(),V.destroy(),((r=q.get(e.apiKey))==null?void 0:r.dispose)===H.dispose&&q.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var r;ve==null||ve(),At=!0,se=!0,u=!0,tt(e.apiKey),z.destroy({forget:!0}),V.destroy({forget:!0}),o.destroy(),M.clear(),((r=q.get(e.apiKey))==null?void 0:r.dispose)===H.dispose&&q.delete(e.apiKey);try{localStorage.removeItem(fe+e.apiKey),localStorage.removeItem(Ke(e.apiKey)),localStorage.removeItem(Ge(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${pe(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(a){}e.debug&&console.log("[sentient] destroyed")}};if(q.set(e.apiKey,{config:e,upgrade:null,dispose:H.dispose}),ve=Yo(H,e.apiKey,r=>{he.then(()=>{At||Fn.add(r)})}),e.debug){let r=window;r.__sentient&&(r.__sentient.client=H)}return H}0&&(module.exports={AGENT_INTENTS,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,CLASSIC_CRAWLER_TOKENS,CLICK_ID_KEYS,FORM_FIELD_KINDS,FORM_INPUT_TYPES,LEGACY_SESSION_COOKIE_NAME,LOCAL_MODE_BANNER,MAX_BLOCK_ARMS,MAX_BLOCK_CHILDREN,MAX_BLOCK_DEPTH,MAX_BLOCK_NODES,MAX_BLOCK_TEXT_LEN,MAX_FORM_FIELDS,MAX_FORM_SELECT_OPTIONS,MAX_SKELETON_LEAVES,MAX_SKELETON_NODES,MAX_SKELETON_TEXT,PAGE_SCOPE_RE,PROD_KEYLESS_ERROR,REVEAL_MS,SNAPSHOT_STORAGE_KEY_PREFIX,STAGE_ATTRIBUTE,_registerConsentUpgradeInit,agentIntent,agentUaList,applyNonce,armOfResult,attachMicroSignalDetectors,baselineResultFor,baselineSlots,classifiedAgents,containsFormBlock,cspNonce,deriveSessionSegment,detectDeviceClass,detectTimeOfDay,detectTrafficSource,exposedStage,extractTrackedParams,forgetGeneration,forgetVisitor,grantConsent,init,isDoNotTrackEnabled,matchedAgentToken,matchedCrawlerToken,normalizeUrlPattern,pageScopeMatches,readSnapshot,referrerDomainFromReferer,renderPrePaintScript,resetRevealStyles,reveal,routeKey,sessionCookieName,setCspNonce,setStageAttribute,toWireSlot,uaTokenMatch,urlMatches,writeSnapshot});
2
2
  //# sourceMappingURL=index.js.map