@sentientui/snippet 0.17.0 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/snippet.global.js +2 -2
- package/package.json +2 -2
package/dist/snippet.global.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var SentientSnippet=(()=>{var Le=Object.defineProperty;var _n=Object.getOwnPropertyDescriptor;var Ln=Object.getOwnPropertyNames,ut=Object.getOwnPropertySymbols;var pt=Object.prototype.hasOwnProperty,Tn=Object.prototype.propertyIsEnumerable;var dt=(e,t,n)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,J=(e,t)=>{for(var n in t||(t={}))pt.call(t,n)&&dt(e,n,t[n]);if(ut)for(var n of ut(t))Tn.call(t,n)&&dt(e,n,t[n]);return e};var ft=(e,t)=>()=>(e&&(t=e(e=0)),t);var gt=(e,t)=>{for(var n in t)Le(e,n,{get:t[n],enumerable:!0})},Rn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of Ln(t))!pt.call(e,a)&&a!==n&&Le(e,a,{get:()=>t[a],enumerable:!(r=_n(t,a))||r.enumerable});return e};var Pn=e=>Rn(Le({},"__esModule",{value:!0}),e);var Dn,Mn,Bn,mt,Nn,Kn,ht,_,xe,Te=ft(()=>{"use strict";Dn=Object.defineProperty,Mn=Object.defineProperties,Bn=Object.getOwnPropertyDescriptors,mt=Object.getOwnPropertySymbols,Nn=Object.prototype.hasOwnProperty,Kn=Object.prototype.propertyIsEnumerable,ht=(e,t,n)=>t in e?Dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_=(e,t)=>{for(var n in t||(t={}))Nn.call(t,n)&&ht(e,n,t[n]);if(mt)for(var n of mt(t))Kn.call(t,n)&&ht(e,n,t[n]);return e},xe=(e,t)=>Mn(e,Bn(t))});var kt={};gt(kt,{LOCAL_ENGINE_AVAILABLE:()=>zn,createLocalEngine:()=>qn});function qn(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var zn,It=ft(()=>{"use strict";zn=!1});var Qr={};gt(Qr,{applyPersonaAttributes:()=>Ge,applyRegistrySlots:()=>We,applySlotArms:()=>qe,applySlotAttributes:()=>ze,parseEditorToken:()=>An,parsePersonaPreview:()=>kn,parsePreview:()=>En,parseSnippetConfig:()=>Ue,reapply:()=>ct,run:()=>On,version:()=>it});Te();var $n=["buyer","researcher","deal_seeker","browser"];var jn={buyer:"Buyer",researcher:"Researcher",deal_seeker:"Deal seeker",browser:"Browser",unknown:"Unknown"};function Re(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function yt(e){if(e.length===0)return null;let t={};for(let n of e.split("|")){let r=n.indexOf("=");if(r<=0||r!==n.lastIndexOf("=")||r===n.length-1)return null;let a=n.slice(0,r);if(a in t)return null;t[a]=n.slice(r+1)}return t}function Ye(e){var t,n,r;if(e.arms)return typeof e.baseline=="string"?e.baseline:(t=e.arms[0])!=null?t:"";if(e.baseline!==void 0&&typeof e.baseline=="object")return Re(e.baseline);if(typeof e.baseline=="string")return e.baseline;let a={};for(let[l,o]of Object.entries((n=e.dims)!=null?n:{}))a[l]=(r=o[0])!=null?r:"";return Re(a)}function vt(e,t){var n,r;return e.dims!=null?(r=(n=yt(t))!=null?n:yt(Ye(e)))!=null?r:{}:t}function me(e){return e>=.3?e<.7?"medium":"high":"low"}var no=$n.map(e=>({key:e,displayName:jn[e]}));var Un=["GPTBot","ChatGPT-User","OAI-SearchBot","ClaudeBot","Claude-User","Claude-SearchBot","PerplexityBot","Perplexity-User","Google-Extended","Applebot-Extended","Meta-ExternalAgent","Bytespider","CCBot","Amazonbot","cohere-ai","Diffbot"];function bt(e){return Gn(e)!==null}function Gn(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=Un.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function wt(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 St(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(a){}let r=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(r)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(r)?"social":"referral"}catch(n){return"direct"}}function xt(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}function At(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function Xe(e){return _(_(_({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 Ze(e){let t=Xe(e);return vt(t,Ye(t))}function Et(e){return typeof e=="string"?e:Re(e)}Te();function Ct(){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)})}function _t(e){return e?`_${e.slice(0,12)}`:""}var Wn="_snt_uid",Fn=365,Hn="_snt_uid";function Vn(){return Ct()}function Jn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Yn(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(r){}}function Xn(e){try{return localStorage.getItem(e)}catch(t){return null}}function Zn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Qn(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function er(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function tr(e){try{sessionStorage.removeItem(e)}catch(t){}}function nr(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=strict; path=/`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function rr(e){try{localStorage.removeItem(e)}catch(t){}}function or(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var ir={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function Lt(e){var t,n,r,a,l,o;if(typeof window=="undefined")return ir;let c=_t(e==null?void 0:e.apiKey),i=(t=e==null?void 0:e.cookieName)!=null?t:`${Wn}${c}`,s=`${Hn}${c}`,u=((n=e==null?void 0:e.cookieTTLDays)!=null?n:Fn)*24*60*60,p=f=>f&&f.length>0?f:null,d=(o=(l=(a=(r=p(Jn(i)))!=null?r:p(Xn(s)))!=null?a:p(Qn(s)))!=null?l:p(e==null?void 0:e.ssrSessionId))!=null?o:Vn();Yn(i,d,u);let m=Zn(s,d),S=nr(i),R=m?!1:er(s,d),O=!m&&!S&&!R;return{getSessionId:()=>d,isEphemeral:()=>O,destroy:()=>{d=null,or(i),rr(s),tr(s)}}}function Me(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Tt(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 Rt(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?(localStorage.removeItem(e),r.slice(-t)):[]}catch(n){return[]}}function Be(e,t,n){try{let r=(()=>{try{let l=localStorage.getItem(n);if(!l)return[];let o=JSON.parse(l);return Array.isArray(o)?o:[]}catch(l){return[]}})(),a=new Map;for(let l of r)a.set(l.id,l);for(let l of e)a.set(l.id,l);localStorage.setItem(n,JSON.stringify([...a.values()].slice(-t)))}catch(r){}}function Pt(e,t){try{let n=localStorage.getItem(t);if(!n)return;let r=JSON.parse(n);if(!Array.isArray(r))return;let a=new Set(e),l=r.filter(o=>!a.has(o.id));if(l.length===r.length)return;l.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(l))}catch(n){}}var sr=500,ar=56*1024;function Dt(e){return`_snt_retry_${e.slice(0,12)}`}var lr={push:()=>{},flush:()=>{},destroy:()=>{}};function cr(e){var t,n,r;if(typeof window=="undefined")return lr;let a=(t=e.flushIntervalMs)!=null?t:5e3,l=(n=e.maxBatchSize)!=null?n:20,o=(r=e.maxRetrySize)!=null?r:100,c=e.ingestUrl,i=e.apiKey,s=Dt(i),u=[],p=new Set,d=[],m=h=>{for(let k of h)S.delete(k),!p.has(k)&&(p.add(k),d.push(k));for(;d.length>sr;){let k=d.shift();k&&p.delete(k)}Pt(h,s)},S=new Set,R=h=>{p.has(h.id)||S.has(h.id)||(S.add(h.id),u.push(h))},O=h=>{for(let k of h)p.has(k.id)||(S.add(k.id),u.push(k))},f=Rt(s,o);for(let h of f)R(h);let y=0,x=0,I=(h,k=!0)=>{if(h.length===0)return;let ne=JSON.stringify(h),q=h.map(Y=>Y.id),re;try{re=fetch(c,{method:"POST",keepalive:!0,body:ne,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})}catch(Y){Be(h,o,s),O(h),x++,y=Date.now()+Me(x);return}let pe=Y=>{if(Tt(Y)!=="retry"){if(!Y.ok&&k){let fe=h.filter(H=>H.eventType!=="pageview");if(fe.length>0&&fe.length<h.length){m(h.filter(H=>H.eventType==="pageview").map(H=>H.id)),I(fe,!1);return}}m(q),x=0,y=0;return}Be(h,o,s),O(h),x++,y=Date.now()+Me(x)};re instanceof Promise?re.then(pe).catch(()=>{Be(h,o,s),O(h),x++,y=Date.now()+Me(x)}):pe(re)},B=typeof TextEncoder!="undefined"?new TextEncoder:null,b=h=>B?B.encode(h).length:h.length,P=h=>{let k=[],ne=2;for(let q of h){let re=b(JSON.stringify(q))+1;if(k.length>0&&ne+re>ar||k.length>=l)break;k.push(q),ne+=re}return k},N=()=>{try{if(Date.now()<y)return;for(;u.length>0&&!(Date.now()<y);){let h=u.filter(ne=>!p.has(ne.id));if(u.length=0,h.length===0)break;let k=P(h);if(k.length===0)break;k.length<h.length&&u.push(...h.slice(k.length)),I(k)}}catch(h){}},D=!0,A=null;A=setInterval(()=>{D&&N()},a);let E=()=>{document.visibilityState==="hidden"&&N()},w=()=>{N()};return document.addEventListener("visibilitychange",E),window.addEventListener("pagehide",w),{push(h){R(h),u.length>=l&&N()},flush:N,destroy(){D=!1,A!==null&&(clearInterval(A),A=null),document.removeEventListener("visibilitychange",E),window.removeEventListener("pagehide",w),N()}}}var ur=200;function Mt(e){return`_snt_goal_retry_${e.slice(0,12)}`}var dr={send:()=>{},flush:()=>{},destroy:()=>{}};function pr(e){var t,n,r;if(typeof window=="undefined")return dr;let a=(t=e.flushIntervalMs)!=null?t:5e3,l=(n=e.maxRetrySize)!=null?n:100,o=(r=e.maxPerFlush)!=null?r:5,c=Mt(e.apiKey),i=[],s=new Set,u=new Set,p=[],d=0,m=0,S=!1,R=b=>{for(s.delete(b.id),u.has(b.id)||(u.add(b.id),p.push(b.id));p.length>ur;){let P=p.shift();P&&u.delete(P)}Pt([b.id],c)},O=b=>{Be([b],l,c),!u.has(b.id)&&!s.has(b.id)&&(s.add(b.id),i.push(b)),m++,d=Date.now()+Me(m)},f=b=>{let P;try{P=fetch(e.url,{method:"POST",keepalive:!0,body:b.body,headers:e.headers})}catch(D){O(b);return}let N=D=>{var A;let E=Tt(D);if(E==="retry"){O(b);return}E==="dropped"&&((A=e.onDrop)==null||A.call(e,b,D.status)),R(b),m=0,d=0};P instanceof Promise?P.then(N).catch(()=>O(b)):N(P)},y=()=>{try{if(S||Date.now()<d)return;let b=0;for(;i.length>0&&b<o&&!(Date.now()<d);){let P=i.shift();s.delete(P.id),!u.has(P.id)&&(b++,f(P))}}catch(b){}};for(let b of Rt(c,l))s.has(b.id)||(s.add(b.id),i.push(b));let x=setInterval(y,a),I=()=>{document.visibilityState==="hidden"&&y()},B=()=>y();return document.addEventListener("visibilitychange",I),window.addEventListener("pagehide",B),{send(b){if(!S&&!(u.has(b.id)||s.has(b.id))){if(Date.now()<d){s.add(b.id),i.push(b);return}f(b)}},flush:y,destroy(){clearInterval(x),document.removeEventListener("visibilitychange",I),window.removeEventListener("pagehide",B),y(),S=!0}}}var fr=1800*1e3;function Pe(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function gr(e=fr,t){let n=new Map,r=`_snt_asgn${_t(t)}_`,a=(i,s)=>`${r}${encodeURIComponent(i)}:${encodeURIComponent(s)}`,l=i=>{let s=i.slice(r.length),u=s.indexOf(":");if(u<0)return null;try{return{componentId:decodeURIComponent(s.slice(0,u)),segment:decodeURIComponent(s.slice(u+1))}}catch(p){return null}},o=()=>{try{let i=[];for(let s=0;s<localStorage.length;s++){let u=localStorage.key(s);u!=null&&u.startsWith(r)&&i.push(u)}return i}catch(i){return[]}},c=i=>i.assignedAt+(i.ttlMs&&i.ttlMs>0?i.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let i of o())try{let s=localStorage.getItem(i);if(!s)continue;let u=JSON.parse(s);if(c(u)){localStorage.removeItem(i);continue}let p=l(i);if(!p)continue;n.set(Pe(p.componentId,p.segment),u)}catch(s){}})(),{get(i,s){let u=n.get(Pe(i,s));return u?c(u)?(n.delete(Pe(i,s)),null):u:null},set(i,s,u){let p=Pe(i,s);n.set(p,u);try{localStorage.setItem(a(i,s),JSON.stringify(u))}catch(d){}},invalidate(i){let s=`${encodeURIComponent(i)}:`;for(let u of[...n.keys()])u.startsWith(s)&&n.delete(u);for(let u of o()){let p=l(u);if((p==null?void 0:p.componentId)===i)try{localStorage.removeItem(u)}catch(d){}}},clear(){n.clear();for(let i of o())try{localStorage.removeItem(i)}catch(s){}}}}var Ke="_snt_snap:",mr=["low","medium","high"];function $e(e){try{let t=localStorage.getItem(Ke+e);if(!t)return null;let n=JSON.parse(t);return!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!mr.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"||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig))?null:n}catch(t){return null}}function Ee(e,t){try{localStorage.setItem(Ke+e,JSON.stringify(t))}catch(n){}}var et="[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.",Ot=!1,De=!1;function hr(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function yr(e){var t;let n=Lt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",a=hr(),l=Promise.resolve().then(()=>(It(),kt)).then(i=>{let s=i;return s.LOCAL_ENGINE_AVAILABLE?(Ot||(Ot=!0,console.info(Bt)),s):(De||(De=!0,console.error(et)),null)}).catch(()=>(De||(De=!0,console.error(et)),null)),o=null;function c(i){let s=document.documentElement;s.dataset.sentientPersona===void 0&&(s.dataset.sentientPersona=i.persona,s.dataset.sentientConfidence=me(i.confidence))}return{isLocal:!0,async decide(i){var s,u,p;let d=await l;if(!d)return null;let m=d.createLocalEngine({sessionId:r,forcedPersona:a}).decide(i);return o=xe(_({},m),{layoutOrder:(u=(s=m.layoutOrder)!=null?s:o==null?void 0:o.layoutOrder)!=null?u:null,slots:_(_({},(p=o==null?void 0:o.slots)!=null?p:{}),m.slots)}),Ee(e.apiKey||"local",{v:1,persona:o.persona,band:me(o.confidence),slots:o.slots,layoutOrder:o.layoutOrder,savedAt:Date.now()}),c(m),m},getSlotResult(i){var s,u,p;return(p=(u=o==null?void 0:o.slots[i])!=null?u:(s=e.initialSlots)==null?void 0:s[i])!=null?p:null},getPersona(){return o?{persona:o.persona,confidence:o.confidence,band:me(o.confidence)}:null},async assign(i,s){var u;let p=await l;return!p||!s||s.length===0?s!=null&&s[0]?{variantId:s[0],assignmentTtlMs:0}:null:{variantId:(u=p.createLocalEngine({sessionId:r,forcedPersona:a}).decide({components:[{id:i,variantIds:s}]}).assignments[i])!=null?u:s[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>n.destroy()}}function ke(e,t,n,r){let a=[];{let l=!1,o=[],c=()=>{if(l)return;let i=Date.now();for(o.push(i);o.length>0&&i-o[0]>500;)o.shift();o.length>=3&&(l=!0,e("rage_click"))};t.addEventListener("click",c),a.push(()=>t.removeEventListener("click",c))}{let l=!1,o=c=>{if(l||!(c.target instanceof Node)||!t.contains(c.target)&&t!==c.target)return;l=!0;let i=typeof window!="undefined"?window.getSelection():null,s=i?i.toString().length:0;e("text_copy",{selectionLength:s})};document.addEventListener("copy",o),a.push(()=>document.removeEventListener("copy",o))}{let l=!1,o=!1,c=null,i=()=>{c!==null&&(clearTimeout(c),c=null)},s=()=>{l||!o||(i(),c=setTimeout(()=>{!l&&o&&(l=!0,e("scroll_hesitation"))},3e3))},u=()=>{i(),s()},p=m=>{for(let S of m)o=S.intersectionRatio>.3,o?s():i()},d=new IntersectionObserver(p,{threshold:[.3]});d.observe(t),window.addEventListener("scroll",u,{passive:!0}),a.push(()=>{d.disconnect(),window.removeEventListener("scroll",u),i()})}if((r==null?void 0:r.tabLoss)!==!1){let l=!1,o=n!=null?n:Date.now(),c=()=>{if(l||document.visibilityState!=="hidden")return;let i=Date.now()-o;i<15e3&&(l=!0,e("tab_loss",{timeOnPage:i}))};document.addEventListener("visibilitychange",c),a.push(()=>document.removeEventListener("visibilitychange",c))}return()=>{for(let l of a)l()}}var Nt="https://api.sentient-ui.com/v1/events",F=new Map,Kt=null;function vr(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}function Qe(){return Ct()}function Ne(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function br(e){if(typeof MessageChannel=="function"){let t=new MessageChannel;t.port1.onmessage=()=>{e.clear(),t.port1.close(),t.port2.close()},t.port2.postMessage(0)}else setTimeout(()=>e.clear(),0)}var $t=new Set;function wr(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let a=!1,l,o=()=>{if(a)return;let s=Ne();!s||s===l||(l=s,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${s}`))},c=[];for(let s of["pushState","replaceState"]){let u=r[s],p=function(...d){let m=u.apply(this,d);return o(),m};r[s]=p,c.push([s,u,p])}window.addEventListener("popstate",o);let i=Ne();return i&&$t.has(`${t}:${i}`)?l=i:o(),()=>{if(!a){a=!0,window.removeEventListener("popstate",o);for(let[s,u,p]of c)r[s]===p&&(r[s]=u)}}}var Ae={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}};function Sr(){try{let e={},t=new URLSearchParams(window.location.search);for(let[n,r]of t)n.startsWith("utm_")&&(e[n]=r);return e}catch(e){return{}}}function jt(e){return e.replace(/\/events\/?$/,"")}function he(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(e=>e==="1"||e==="yes")}function tt(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:Kt;if(!n){console.warn("[sentient] grantConsent() called before init()");return}let r=F.get(n);if(!r){console.warn("[sentient] grantConsent() called before init()");return}let{config:a,upgrade:l}=r;if(!l||a.respectDoNotTrack!==!1&&he())return;let o=je(xe(_({},a),{consent:!0}));l(o);let c=(t=F.get(n))==null?void 0:t.dispose;F.set(n,{config:xe(_({},a),{consent:!0}),upgrade:null,dispose:c})}function xr(e){var t;let n=e.preConsentBehavior==="statistical_winner",r=jt((t=e.ingestUrl)!=null?t:Nt),a={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},l={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),async assign(i,s,u){if(!n)return null;try{let p=new URLSearchParams({componentId:i});for(let m of s!=null?s:[])p.append("variantIds[]",m);let d=await fetch(`${r}/winner?${p.toString()}`,{headers:a});return d.ok?{variantId:(await d.json()).variantId,assignmentTtlMs:0}:s!=null&&s[0]?{variantId:s[0],assignmentTtlMs:0}:null}catch(p){return s!=null&&s[0]?{variantId:s[0],assignmentTtlMs:0}:null}},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}},o={track:i=>l.track(i),goal:((i,s,u,p)=>l.goal(i,s,u,p)),componentGoal:(i,s,u)=>l.componentGoal(i,s,u),identify:i=>l.identify(i),getAssignment:(i,s)=>l.getAssignment(i,s),assign:(i,s,u,p)=>l.assign(i,s,u,p),decide:i=>l.decide(i),getSlotResult:i=>l.getSlotResult(i),getPersona:()=>l.getPersona(),fetchWeights:()=>l.fetchWeights(),getGraph:()=>l.getGraph(),dispose:()=>l.dispose(),destroy:()=>l.destroy()};function c(i){l=i}return{proxy:o,setInner:c}}function je(e){var t,n,r,a,l,o,c,i,s;if(typeof window=="undefined")return Ae;Kt=e.apiKey;let u=F.get(e.apiKey||"local");if(u!=null&&u.dispose)try{u.dispose()}catch(g){}let p=e.respectDoNotTrack!==!1&&he(),d=e.consent===!1||p,m=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!m&&e.localMode!==!1)return d?(F.set(e.apiKey||"local",{config:e,upgrade:null}),Ae):(F.set(e.apiKey||"local",{config:e,upgrade:null}),yr(e));if(d){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."),F.set(e.apiKey,{config:e,upgrade:null}),Ae;let{proxy:g,setInner:v}=xr(e);return F.set(e.apiKey,{config:e,upgrade:p?null:v}),g}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."),Ae;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),Ae;let S=(t=e.ingestUrl)!=null?t:Nt,R=Date.now(),O=Lt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),f=gr(void 0,e.apiKey),y=cr({ingestUrl:S,apiKey:e.apiKey}),x=jt(S),I={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},B=pr({url:`${x}/goals`,apiKey:e.apiKey,headers:I,onDrop:(g,v)=>{e.debug&&console.warn(`[sentient] goal dropped (HTTP ${v}) \u2014 this will not be retried. `+(v===400?"The session was not found: call init() and let the session upsert complete before firing goals.":v===401||v===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),g)}}),b=wt((n=navigator.userAgent)!=null?n:""),P=typeof window!="undefined"?window.location.origin:void 0,N=St((r=document.referrer)!=null?r:"",P),D=(a=e.sessionSegment)!=null?a:`${b}:${N}`,A=new Map,E=new Map,w=null,h=g=>{for(let v of g)E.has(v.id)||E.set(v.id,Ze(v))};if(e.initialSlots)for(let[g,v]of Object.entries(e.initialSlots))E.set(g,v);let k=$e(e.apiKey);if(k)for(let[g,v]of Object.entries(k.slots))E.has(g)||E.set(g,v);let ne={low:.15,medium:.5,high:.85};if(e.initialPersona)w=_({},e.initialPersona);else{let g=document.documentElement.dataset;g.sentientPersona?w={persona:g.sentientPersona,confidence:(o=ne[(l=g.sentientConfidence)!=null?l:"low"])!=null?o:.15}:k&&(w={persona:k.persona,confidence:(c=ne[k.band])!=null?c:.15})}if(e.initialAssignments)for(let[g,v]of Object.entries(e.initialAssignments))f.set(g,D,{variantId:v,assignedAt:Date.now(),segment:D,confidence:1});let q=Promise.resolve(),re=O.getSessionId();if(re){let g=xt((i=document.referrer)!=null?i:""),v=_(_(_({sessionId:re,deviceClass:b,trafficSource:N,referrerDomain:g,utmParams:Sr(),timeOfDay:At(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:O.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||bt((s=navigator.userAgent)!=null?s:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{});try{q=fetch(`${x}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(v),headers:I}).then(L=>{L.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")}).catch(()=>{})}catch(L){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:y});let pe=new Set,Y=null,fe=!1,H={goal(g,v={},L=1,X=0){var Z,K,Q,W,U,oe;let G=O.getSessionId();if(!G)return;let z=vr(v)?v:{metadata:v},ee=`${g}\0${(Z=z.externalId)!=null?Z:""}\0${(K=z.stepIndex)!=null?K:X}\0${(Q=z.weight)!=null?Q:L}`;if(pe.has(ee)){e.debug&&console.log(`[sentient] goal("${g}") already recorded for this action \u2014 not sent twice`);return}pe.add(ee),pe.size===1&&br(pe);let we=Qe(),C={sessionId:G,name:g,metadata:(W=z.metadata)!=null?W:{},weight:(U=z.weight)!=null?U:L,stepIndex:(oe=z.stepIndex)!=null?oe:X,goalId:we,value:z.value,currency:z.currency,externalId:z.externalId};e.debug&&console.log("[sentient] goal",C);let ge={id:we,body:JSON.stringify(C)};q.then(()=>B.send(ge))},componentGoal(g,v,L){var X,Z,K;let Q=O.getSessionId();if(!Q)return;let W=f.get(g,D),U=W?null:(X=E.get(g))!=null?X:null;if(!W&&U===null){e.debug&&console.warn(`[sentient] componentGoal("${g}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}let oe=W?W.variantId:Et(U),G={id:Qe(),sessionId:Q,projectId:e.apiKey,componentId:g,variantId:oe,eventType:"goal_achieved",goalType:v,payload:_({reward:(Z=L==null?void 0:L.reward)!=null?Z:1,goalValue:L==null?void 0:L.value,currency:L==null?void 0:L.currency},(K=L==null?void 0:L.metadata)!=null?K:{}),timestamp:Date.now(),timeInSession:Date.now()-R,path:Ne()};e.debug&&console.log("[sentient] componentGoal",G),q.then(()=>y.push(G))},identify(g){let v=O.getSessionId();v&&q.then(()=>{fetch(`${x}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:v,userId:g,ephemeral:O.isEphemeral()}),headers:I}).catch(()=>{})})},track(g){let v=O.getSessionId();if(!v)return;let L=xe(_({path:Ne()},g),{id:Qe(),sessionId:v,timestamp:Date.now(),timeInSession:Date.now()-R});e.debug&&console.log("[sentient] track",L),q.then(()=>y.push(L))},getAssignment(g,v){return f.get(g,v)},async assign(g,v,L,X){let Z=O.getSessionId();if(!Z)return null;let K=f.get(g,D);if(K&&(v!=null&&v.length||K.content!==void 0)){let U=K.ttlMs&&K.ttlMs>0?Math.max(0,K.assignedAt+K.ttlMs-Date.now()):0;return{variantId:K.variantId,assignmentTtlMs:U,content:K.content}}let Q=A.get(g);if(Q)return Q;let W=(async()=>{await q;try{let U={sessionId:Z,componentId:g,variantIds:v};X!==void 0?U.agentDataByVariant=X:L!==void 0&&(U.agentData=L);let oe=await fetch(`${x}/assign`,{method:"POST",body:JSON.stringify(U),headers:I});if(!oe.ok)return null;let G=await oe.json();return f.set(g,D,_({variantId:G.variantId,assignedAt:Date.now(),segment:D,confidence:1,content:G.content},G.assignmentTtlMs&&G.assignmentTtlMs>0?{ttlMs:G.assignmentTtlMs}:{})),G}catch(U){return null}finally{A.delete(g)}})();return A.set(g,W),W},async decide(g){var v,L,X,Z,K,Q,W,U,oe;let G=O.getSessionId();if(!G)return null;let z=(v=g.slots)!=null?v:[];await q;try{let ee={sessionId:G};g.sections&&g.sections.length>0&&(ee.sections=g.sections.map(V=>({id:V}))),ee.components=(L=g.components)!=null?L:[],z.length>0&&(ee.slots=z.map(Xe)),g.slotsFrom==="registry"&&(ee.slotsFrom="registry"),g.v&&(ee.v=g.v),e.persona&&(ee.persona=e.persona);let we=await fetch(`${x}/decide`,{method:"POST",body:JSON.stringify(ee),headers:I});if(!we.ok)return h(z),null;let C=await we.json(),ge={};for(let V of z)ge[V.id]=(Z=(X=C.slots)==null?void 0:X[V.id])!=null?Z:Ze(V);if(C.slots)for(let[V,Se]of Object.entries(C.slots))V in ge||(ge[V]=Se);for(let[V,Se]of Object.entries(ge))E.set(V,Se);let Cn=w!=null&&w.persona!=="unknown";C.persona&&!(C.persona==="unknown"&&Cn)?w={persona:C.persona,confidence:(K=C.confidence)!=null?K:0}:w||(w={persona:"unknown",confidence:0});for(let[V,Se]of Object.entries((Q=C.assignments)!=null?Q:{}))f.set(V,D,{variantId:Se,assignedAt:Date.now(),segment:D,confidence:1});return Ee(e.apiKey,_(_({v:1,persona:w.persona,band:me(w.confidence),slots:Object.fromEntries(E),layoutOrder:(W=C.layoutOrder)!=null?W:null,savedAt:Date.now()},C.slotConfig?{slotConfig:C.slotConfig}:{}),C.palette?{palette:C.palette}:{})),_(_(_(_({layoutOrder:(U=C.layoutOrder)!=null?U:null,assignments:(oe=C.assignments)!=null?oe:{},slots:ge,persona:w.persona,confidence:w.confidence},C.slotConfig?{slotConfig:C.slotConfig}:{}),C.goals?{goals:C.goals}:{}),C.sectionMap?{sectionMap:C.sectionMap}:{}),C.palette?{palette:C.palette}:{})}catch(ee){return h(z),null}},getSlotResult(g){var v;return(v=E.get(g))!=null?v:null},getPersona(){return w?{persona:w.persona,confidence:w.confidence,band:me(w.confidence)}:null},async fetchWeights(){var g;try{let v=await fetch(`${x}/weights`,{headers:I});return v.ok?(g=(await v.json()).components)!=null?g:[]:[]}catch(v){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){var g;Y==null||Y(),fe=!0,y.destroy(),B.destroy(),((g=F.get(e.apiKey))==null?void 0:g.dispose)===H.dispose&&F.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var g;Y==null||Y(),fe=!0,y.destroy(),B.destroy(),O.destroy(),((g=F.get(e.apiKey))==null?void 0:g.dispose)===H.dispose&&F.delete(e.apiKey);try{localStorage.removeItem(Ke+e.apiKey),localStorage.removeItem(Dt(e.apiKey)),localStorage.removeItem(Mt(e.apiKey))}catch(v){}e.debug&&console.log("[sentient] destroyed")}};if(F.set(e.apiKey,{config:e,upgrade:null,dispose:H.dispose}),Y=wr(H,e.apiKey,g=>{q.then(()=>{fe||$t.add(g)})}),e.debug){let g=window;g.__sentient&&(g.__sentient.client=H)}return H}var Ut=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Ar=[["pricing",/\b(pricing|price|plans?|subscriptions?|per month|\/mo|tier)\b/i],["faq",/\b(faq|frequently asked|common questions?)\b/i],["comparison",/\b(compare|comparison|versus|vs\.)\b/i],["social_proof",/\b(testimonial|reviews?|trusted by|loved by|customers?|logos|rated|case stud)\b/i],["trust",/\b(security|guarantee|privacy|compliance|secure|gdpr|soc ?2|encrypt)\b/i],["features",/\b(features?|how it works|benefits?|capabilit|what you get)\b/i]],Er=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]];function kr(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function Gt(e){if(e.tag==="nav"||e.tag==="footer")return{type:"navigation",strength:"weak"};let t=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[n,r]of Ar)if(r.test(t))return{type:n,strength:"strong"};for(let[n,r]of Er)if(r.test(e.bodyText))return{type:n,strength:"strong"};return e.actionCount>=1&&e.textLength>0&&e.textLength<200?{type:"cta",strength:"weak"}:e.tag==="header"?{type:"hero",strength:"weak"}:/\b(hero|headline|banner)\b/i.test(t)?{type:"hero",strength:"weak"}:{type:"generic",strength:"weak"}}function zt(e){var t,n;let r=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim();return{tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:kr(e),bodyText:r.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:r.length}}function qt(e){return Gt(zt(e)).type}Te();var Ft="section, header, footer, nav, main > div, [data-sentient-section]";function Ir(e){var t;return((t=e.parentElement)==null?void 0:t.closest(Ft))!=null}function Or(e,t,n,r){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:r})}).catch(()=>{})}catch(a){}}var Wt=()=>{};function Ht(e,t){var n,r,a,l,o,c,i,s,u;let p=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!p||typeof IntersectionObserver=="undefined"||he()||!t.apiKey)return Wt;let d=((r=t.apiBase)!=null?r:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),m=Array.from(p.querySelectorAll(Ft)).filter(A=>!Ir(A));if(m.length===0)return Wt;let S=new Map,R=new Map,O=new Map;for(let A of m){let E=A.getAttribute("data-sentient-type"),w=E&&Ut.includes(E)?E:null,h=(l=w!=null?w:(a=t.typeOf)==null?void 0:a.call(t,A))!=null?l:qt(A),k=`nc-${h}`;S.set(A,k),R.set(k,h),w?O.set(k,"markup"):O.has(k)||O.set(k,"auto")}let f=(s=(i=(c=(o=p.defaultView)!=null?o:typeof window!="undefined"?window:void 0)==null?void 0:c.location)==null?void 0:i.pathname)!=null?s:"/";Or(t.apiKey,d,f,[...R.entries()].map(([A,E])=>{var w;return{componentId:A,semanticType:E,source:(w=O.get(A))!=null?w:"auto"}}));let y=new Map,x=A=>{let E=y.get(A);return E||(E={ms:0,scroll:0,enterAt:null,intersecting:!1},y.set(A,E)),E},I=new IntersectionObserver(A=>{for(let E of A){let w=S.get(E.target);if(!w)continue;let h=x(w);E.isIntersecting?(h.intersecting=!0,h.enterAt=Date.now(),E.intersectionRatio>h.scroll&&(h.scroll=E.intersectionRatio)):(h.intersecting=!1,h.enterAt!=null&&(h.ms+=Date.now()-h.enterAt,h.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let A of S.keys())I.observe(A);let B=()=>{let A=Date.now();for(let[E,w]of y)if(w.enterAt!=null&&(w.ms+=A-w.enterAt,w.enterAt=null),!(w.ms<=0)){try{e.track({projectId:t.apiKey,componentId:E,eventType:"dwell",payload:{dwell_time:Math.round(w.ms),scroll_depth:Number(w.scroll.toFixed(2))}})}catch(h){}w.ms=0}},b=()=>{if(p.hidden)B();else{let A=Date.now();for(let E of y.values())E.intersecting&&(E.enterAt=A)}},P=()=>{B();try{I.disconnect()}catch(A){}};p.addEventListener("visibilitychange",b);let N=(u=p.defaultView)!=null?u:typeof window!="undefined"?window:void 0;N==null||N.addEventListener("pagehide",P);let D=[];return t.microSignals&&[...S.entries()].forEach(([A,E],w)=>{D.push(ke((h,k={})=>{try{e.track({projectId:t.apiKey,componentId:E,eventType:"micro_signal",payload:_({signalType:h},k)})}catch(ne){}},A,void 0,{tabLoss:w===0}))}),()=>{B(),p.removeEventListener("visibilitychange",b),N==null||N.removeEventListener("pagehide",P);for(let A of D)A();try{I.disconnect()}catch(A){}}}var Cr=["landing","ecommerce","saas","marketplace"];function _r(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=Object.entries(e);if(t.length<1||t.length>4)return null;let n={};for(let[r,a]of t){if(!Array.isArray(a)||a.length<2||a.length>6||!a.every(l=>typeof l=="string"))return null;n[r]=a}return n}function Lr(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function Tr(e){try{return e()}catch(t){return}}function Ue(e){if(typeof e!="object"||e===null)return null;let t=e;if(typeof t.apiKey!="string"||!t.apiKey.startsWith("pk_"))return null;let n=Cr.includes(t.context)?t.context:"landing",r={};if(typeof t.slots=="object"&&t.slots!==null&&!Array.isArray(t.slots))for(let[o,c]of Object.entries(t.slots)){if(typeof c!="object"||c===null)continue;let i=c,s=_r(i.dims);if(!s||i.target!==void 0&&typeof i.target!="string")continue;let u=i.arms!==void 0?Lr(i.arms):null,p={dims:s};typeof i.target=="string"&&(p.target=i.target),u&&(p.arms=u),r[o]=p}let a={apiKey:t.apiKey,context:n,personaAttributes:t.personaAttributes===!0,slots:r};typeof t.consent=="boolean"&&(a.consent=t.consent),(t.preConsentBehavior==="statistical_winner"||t.preConsentBehavior==="control")&&(a.preConsentBehavior=t.preConsentBehavior),t.debug===!0&&(a.debug=!0),typeof t.registry=="boolean"&&(a.registry=t.registry),typeof t.editorSrc=="string"&&(a.editorSrc=t.editorSrc),typeof t.apiBase=="string"&&(a.apiBase=t.apiBase),typeof t.sectionCapture=="boolean"&&(a.sectionCapture=t.sectionCapture);let l=typeof t.persona=="function"?Tr(t.persona):t.persona;if(typeof l=="string"&&l.trim()!==""&&(a.persona=l),Array.isArray(t.sections)){let o=t.sections.filter(c=>typeof c=="string"&&c.trim()!=="").slice(0,50);o.length>=2&&(a.sections=o)}return a}function Vt(e){var n,r,a;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(a=t==null?void 0:t.pathname)!=null?a:""}function Rr(e,t){var n;if(t.tag&&e.tagName.toLowerCase()!==t.tag.toLowerCase())return!1;if(t.text){let r=((n=e.textContent)!=null?n:"").trim().toLowerCase(),a=t.text.trim().toLowerCase();if(!(r===a||r.startsWith(a)||a.startsWith(r)))return!1}return!0}function Jt(e,t){return!!(e!=null&&e.urlMatch)&&!Vt(t).includes(e.urlMatch)}var Pr=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function ce(e,t){var a;if(e.urlMatch&&!Vt(t).includes(e.urlMatch))return null;let n=[];if(e.id){let l=t.getElementById(e.id);n=l?[l]:[]}if(n.length===0&&((a=e.dataAttr)!=null&&a.name)&&Pr.test(e.dataAttr.name))try{let l=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${l}"]`))}catch(l){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(l){n=[]}if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Rr(r,e.fingerprint)?null:r}var Yt={color:"color",background:"background",fontSize:"font-size",fontWeight:"font-weight",textAlign:"text-align",padding:"padding",margin:"margin",borderRadius:"border-radius",width:"width",height:"height",maxWidth:"max-width",border:"border",boxShadow:"box-shadow",opacity:"opacity",lineHeight:"line-height",letterSpacing:"letter-spacing",textTransform:"text-transform",gap:"gap",fontFamily:"font-family"},Dr=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function Xt(e){var t;if(e.trim().length===0||/[;{}<>]/.test(e))return!1;for(let n of e.matchAll(/([A-Za-z-]*)\(/g))if(!Dr.test((t=n[1])!=null?t:""))return!1;return!0}var Zt=/^https:\/\//i,Qt=new Map,ue=null;function Mr(e){return e.replace(/["\\]/g,"\\$&")}function Br(e){var t;(!ue||!ue.isConnected)&&(ue=e.querySelector("style[data-sentient-ops]"),ue||(ue=e.createElement("style"),ue.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(ue))),ue.textContent=[...Qt.entries()].map(([n,r])=>`[data-snt-e="${Mr(n)}"]{${r}}`).join(`
|
|
2
|
-
`)}function en(e,t,n,r){var c;let a=!1,l=(c=t.moveBefore)!=null?c:t.moveAfter;if(l){let i=ce(l,r);!i||i===e||i.parentElement!==e.parentElement||!e.parentElement?a=!0:t.moveBefore?e.parentElement.insertBefore(e,i):e.parentElement.insertBefore(e,i.nextSibling)}typeof t.text=="string"&&(e.textContent=t.text),typeof t.href=="string"&&Zt.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&Zt.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let o=[];if(t.hidden&&o.push("display:none !important"),t.style)for(let[i,s]of Object.entries(t.style)){let u=Yt[i];u&&typeof s=="string"&&Xt(s)&&o.push(`${u}:${s.trim()} !important`)}return o.length>0&&(e.setAttribute("data-snt-e",n),Qt.set(n,o.join(";")),Br(r)),{anchorMiss:a}}var nt="data-sentient-block-arm",ie=null;function Oe(e){ie=e!=null?e:null}var Ie="data-sentient-blocks-hid",tn={none:"0",sm:"8px",md:"16px",lg:"24px"},rt={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},nn={sm:"0.875em",md:"1em",lg:"1.25em"},Nr={sm:"1.25em",md:"1.5em",lg:"2em"},Kr={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},rn={sm:"8px",md:"16px",lg:"32px"},$r={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},jr={normal:"400",medium:"500",bold:"700"};function ae(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function on(e){return{opacity:e==="muted"?"0.7":void 0,"font-weight":e==="accent"?"600":void 0}}function sn(e,t){var n,r,a,l,o,c,i,s,u,p;try{switch(e.type){case"stack":case"grid":{let d=t.createElement("div");if(e.type==="stack"){let m=e;ae(d,{display:"flex","flex-direction":m.direction,gap:tn[(n=m.gap)!=null?n:"md"],"align-items":m.align?rt[m.align]:void 0,"justify-content":m.justify?rt[m.justify]:void 0,"flex-wrap":m.wrap?"wrap":void 0})}else{let m=e,S=tn[(r=m.gap)!=null?r:"md"];ae(d,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${m.columns-1} * ${S}) / ${m.columns})), 1fr))`,gap:S,"align-items":m.align?rt[m.align]:void 0})}for(let m of(a=e.children)!=null?a:[]){let S=sn(m,t);S&&d.appendChild(S)}return d}case"text":{let d=t.createElement("p");return d.textContent=e.value,ae(d,J({margin:"0","font-size":e.size?nn[e.size]:void 0,"font-weight":e.weight?jr[e.weight]:void 0,"text-align":e.align},on(e.tone)))}case"heading":{let d=t.createElement(`h${e.level}`);return d.textContent=e.value,ae(d,{margin:"0","font-size":Nr[(l=e.size)!=null?l:"md"],"text-align":e.align})}case"button":{let d=t.createElement("a");d.textContent=e.label,d.href=e.href,e.tag&&d.setAttribute("data-sentient-tag",e.tag);let m=(o=e.emphasis)!=null?o:"primary";return ae(d,{display:"inline-block",padding:Kr[(c=e.size)!=null?c:"md"],"border-radius":(i=ie==null?void 0:ie.radius)!=null?i:"8px",font:"inherit","font-size":e.size?nn[e.size]:void 0,"text-decoration":m==="ghost"?"underline":"none",cursor:"pointer",background:m==="primary"?(s=ie==null?void 0:ie.primaryBg)!=null?s:"#111827":"transparent",color:m==="primary"?(u=ie==null?void 0:ie.primaryText)!=null?u:"#ffffff":"inherit",border:m==="secondary"?"1px solid currentColor":"none"})}case"link":{let d=t.createElement("a");return d.textContent=e.label,d.href=e.href,e.tag&&d.setAttribute("data-sentient-tag",e.tag),ae(d,{color:"inherit","text-decoration":"underline"})}case"image":{let d=t.createElement("img");return d.src=e.src,d.alt=e.alt,ae(d,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?$r[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let d=t.createElement("span");return d.textContent=e.value,ae(d,J({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:"1px solid currentColor"},on(e.tone)))}case"spacer":return ae(t.createElement("div"),{height:(p=rn[e.size])!=null?p:rn.md});default:return null}}catch(d){return null}}function an(e,t,n,r){try{let a=new Set;for(let o of Array.from(e.children)){let c=o.getAttribute(nt);c!==null&&(t[c]===void 0?o.remove():a.add(c))}for(let[o,c]of Object.entries(t)){if(a.has(o))continue;let i=sn(c,r);if(!i)continue;let s=r.createElement("div");s.setAttribute(nt,o),s.style.display="none",s.appendChild(i),e.appendChild(s)}let l=n!==void 0&&t[n]!==void 0;for(let o of Array.from(e.children)){let c=o.getAttribute(nt),i=o;c!==null?i.style.display=l&&c===n?"":"none":l?i.hasAttribute(Ie)||(i.setAttribute(Ie,i.style.display),i.style.display="none"):i.hasAttribute(Ie)&&(i.style.display=i.getAttribute(Ie),i.removeAttribute(Ie))}}catch(a){}}function Ge(e,t,n){n.documentElement.setAttribute("data-sentient-persona",e),n.documentElement.setAttribute("data-sentient-confidence",t)}function ze(e,t,n){var r;for(let[a,l]of Object.entries(t)){let o=e[a];if(!o||typeof o=="string")continue;let c=l.target?Array.from(n.querySelectorAll(l.target)):[n.documentElement];for(let i of c)for(let[s,u]of Object.entries(o))(r=l.dims[s])!=null&&r.includes(u)&&i.setAttribute(`data-${s}`,u)}}function qe(e,t,n){for(let[r,a]of Object.entries(t)){let l=e[r];if(typeof l!="string"||!a.arms||!a.arms.includes(l))continue;let o=a.target?Array.from(n.querySelectorAll(a.target)):[n.documentElement];for(let c of o)c.setAttribute("data-sentient-arm",l)}}function We(e,t,n,r){var o,c;let a=(o=r==null?void 0:r.contentAndOps)!=null?o:!0,l=[];for(let[i,s]of Object.entries(t)){if(Jt(s.locator,n))continue;let u;if(s.locator){let d=ce(s.locator,n);u=d?[d]:[]}else s.target?u=Array.from(n.querySelectorAll(s.target)):u=[n.documentElement];(s.locator||s.target)&&u.length===0&&l.push(i);let p=e[i];for(let d of u){if(p!==void 0)if(typeof p=="string")d.setAttribute("data-sentient-arm",p),a&&((c=r==null?void 0:r.onApplied)==null||c.call(r,i,p,d));else for(let[m,S]of Object.entries(p))d.setAttribute(`data-${m}`,S);s.blocks&&an(d,s.blocks,typeof p=="string"?p:void 0,n),a&&(typeof s.content=="string"&&(d.textContent=s.content),s.ops&&en(d,s.ops,i,n).anchorMiss&&!l.includes(i)&&l.push(i))}}return l}var Ur=800;function Fe(e,t,n){let r=[];return n.forEach(({slotId:a,arm:l,el:o},c)=>{r.push(ke((d,m={})=>{try{e.track({projectId:t,componentId:a,variantId:l,eventType:"micro_signal",payload:J({signalType:d},m)})}catch(S){}},o,void 0,{tabLoss:c===0}));let i=null,s=0,u=()=>{s=Date.now(),i=setTimeout(()=>{try{e.track({projectId:t,componentId:a,variantId:l,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-s}})}catch(d){}i=null},Ur)},p=()=>{i!==null&&(clearTimeout(i),i=null)};o.addEventListener("mouseenter",u),o.addEventListener("mouseleave",p),r.push(()=>{o.removeEventListener("mouseenter",u),o.removeEventListener("mouseleave",p),i!==null&&clearTimeout(i)})}),()=>{for(let a of r)a()}}function Gr(e){var n,r,a;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(a=t==null?void 0:t.pathname)!=null?a:""}function zr(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}/`)}var ln="_snt_fired_goals";function qr(e){try{let t=e==null?void 0:e.sessionStorage.getItem(ln);if(!t)return new Set;let n=JSON.parse(t);return Array.isArray(n)?new Set(n.filter(r=>typeof r=="string")):new Set}catch(t){return new Set}}function Wr(e,t){try{e==null||e.sessionStorage.setItem(ln,JSON.stringify([...t]))}catch(n){}}function cn(e,t,n){var R,O;let r=(R=n.defaultView)!=null?R:typeof window!="undefined"?window:null,a=qr(r),l=f=>{if(!a.has(f.goalId)){a.add(f.goalId),Wr(r,a);try{f.slotId?t.componentGoal(f.slotId,f.goalId):t.goal(f.goalId)}catch(y){}}},o=e.filter(f=>f.event==="click"),c=e.filter(f=>f.event==="form_submit"),i=e.filter(f=>f.event==="url_reached"),s=e.filter(f=>f.event==="scroll_depth"),u=(f,y)=>{if(!f.locator)return!1;let x=ce(f.locator,n);return!!x&&(x===y||x.contains(y))},p=f=>{let y=f.target;if(!(!y||typeof y.closest!="function"))for(let x of o)u(x,y)&&l(x)},d=f=>{let y=f.target;if(y)for(let x of c)u(x,y)&&l(x)},m=()=>{if(i.length===0)return;let f=Gr(n);for(let y of i)y.urlPattern&&zr(y.urlPattern,f)&&l(y)},S=()=>{var x;let f=n.documentElement,y=f.scrollHeight>0?(f.scrollTop+f.clientHeight)/f.scrollHeight:0;for(let I of s)y>=((x=I.threshold)!=null?x:.75)&&l(I);s.every(I=>a.has(I.goalId))&&n.removeEventListener("scroll",S)};return n.addEventListener("click",p,!0),n.addEventListener("submit",d,!0),(O=n.defaultView)==null||O.addEventListener("popstate",m),m(),s.length>0&&(n.addEventListener("scroll",S,{passive:!0}),S()),{checkUrl:m,teardown:()=>{var f;n.removeEventListener("click",p,!0),n.removeEventListener("submit",d,!0),(f=n.defaultView)==null||f.removeEventListener("popstate",m),s.length>0&&n.removeEventListener("scroll",S)}}}var un="__snt_editor_token";function dn(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(un):null}catch(e){return null}}function pn(e){try{sessionStorage.setItem(un,e)}catch(t){}}var it="0.17.0",wn=5e3,Fr=50,Hr=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),j=null,M=null,le={},de=null,te=null,$=null,se=null,T=null,ye=null,fn=!1,ot=null,He=null,Ve=null,Ce=!1,Je=!1;function Sn(e,t){return Promise.race([e,new Promise(n=>setTimeout(()=>n(null),t))])}function ve(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function be(e,t){return j?(j.personaAttributes&&T&&Ge(T.persona,T.band,e),ze(le,j.slots,e),qe(le,j.slots,e),de?We(le,de,e,t):[]):[]}function xn(e){var n;let t=new Map;for(let r of(n=j==null?void 0:j.sections)!=null?n:[])try{let a=e.querySelectorAll(r);a.length===1&&t.set(r,a[0])}catch(a){}return t}function st(e,t){try{if(!e||e.length<2||new Set(e).size!==e.length)return;let n=xn(t);if(n.size!==e.length)return;let r=[];for(let o of e){let c=n.get(o);if(!c)return;r.push(c)}let a=r[0].parentNode;if(!a||!r.every(o=>o.parentNode===a))return;let l=r.slice().sort((o,c)=>o.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);for(let o=0;o<r.length;o++){let c=r[o];l[o]!==c&&(a.insertBefore(c,l[o]),l.splice(l.indexOf(c),1),l.splice(o,0,c))}}catch(n){}}function Vr(e,t){var n;if(t.length!==0)try{let r=(n=e.apiBase)!=null?n:"https://api.sentient-ui.com";fetch(`${r}/v1/locator-miss`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify({slots:t})}).catch(()=>{})}catch(r){}}function _e(){return!!(j&&M&&j.sectionCapture!==!1&&(j.consent!==!1||Je)&&!he())}function Jr(){if(!M||!j||!_e()||se)return;let e=[];be(document,{contentAndOps:Ce,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),lt();try{$==null||$(),$=Fe(M,j.apiKey,e)}catch(t){}}function lt(){if(typeof document=="undefined"||!_e())return;let e;try{if(He&&He.length>0){let t=new Map;for(let n of He){if(n.urlMatch!==window.location.pathname)continue;let r=ce(n.locator,document);r&&t.set(r,n.type)}t.size>0&&(e=n=>{var r;return(r=t.get(n))!=null?r:null})}}catch(t){}try{se=Ht(M,J({apiKey:j.apiKey,apiBase:j.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{})),Ve=window.location.pathname}catch(t){}}function ct(){try{let e=[];if($==null||$(),$=null,be(document,{contentAndOps:Ce,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),st(ye,document),e.length>0&&_e())try{$=Fe(M,j.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Ve!==null&&window.location.pathname!==Ve&&_e()&&(se==null||se(),se=null,lt())}catch(t){}}catch(e){}}function gn(){ot===null&&(ot=setTimeout(()=>{ot=null,ct();try{te==null||te.checkUrl()}catch(e){}},Fr))}function mn(){if(!(fn||typeof window=="undefined"||typeof history=="undefined")){fn=!0;try{let e=t=>{let n=history[t];history[t]=function(r,a,l){let o=n.call(this,r,a,l!=null?l:null);return gn(),o}};e("pushState"),e("replaceState"),window.addEventListener("popstate",gn)}catch(e){}}}function at(e){let t={};for(let[n,r]of Object.entries(e.slots))t[n]=r.target?document.querySelectorAll(r.target).length:1;return t}function An(e){return new URLSearchParams(e).get("sentient_editor")}function Yr(){try{let t=Array.from(document.getElementsByTagName("script")).find(n=>/snippet(\.global)?\.js/.test(n.src));if(t!=null&&t.src)return t.src.replace(/snippet(\.global)?\.js/,"editor.global.js")}catch(e){}return null}function Xr(e,t){var n,r,a,l;try{window.__sentientEditor={token:t,apiBase:(n=e.apiBase)!=null?n:"https://api.sentient-ui.com"};try{let i=document.createElement("meta");i.name="referrer",i.content="no-referrer",i.setAttribute("data-sentient-editor",""),((r=document.head)!=null?r:document.documentElement).appendChild(i)}catch(i){}let o=(a=e.editorSrc)!=null?a:Yr();if(!o){yn();return}let c=document.createElement("script");c.src=o,c.async=!0,c.onerror=()=>yn(),((l=document.head)!=null?l:document.documentElement).appendChild(c)}catch(o){}}var hn="sentient-editor-load-notice";function yn(){var e;try{if(typeof document=="undefined"||document.getElementById(hn))return;let t=document.createElement("div");t.id=hn,t.textContent="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.",Object.assign(t.style,{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",maxWidth:"320px",padding:"14px 16px",borderRadius:"14px",background:"#111827",color:"#fff",font:"13px/1.45 system-ui, sans-serif",border:"1px solid rgba(245,158,11,0.6)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",cursor:"pointer"}),t.addEventListener("click",()=>t.remove()),((e=document.body)!=null?e:document.documentElement).appendChild(t),setTimeout(()=>t.remove(),1e4)}catch(t){}}function En(e){let t=new URLSearchParams(e).get("sentient_preview");if(!t)return null;let n={};for(let r of t.split("|")){let a=r.indexOf(":"),l=a===-1?"":r.slice(0,a),o=a===-1?"":r.slice(a+1);if(!(!l||!o))if(o.includes("=")){let c={};for(let i of o.split(",")){let[s,u]=i.split("=");s&&u&&(c[s]=u)}Object.keys(c).length&&(n[l]=c)}else n[l]=o}return Object.keys(n).length?n:null}function kn(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var vn="sentient-persona-preview-banner";function bn(e,t){var n;try{if(typeof document=="undefined"||document.getElementById(vn))return;let r=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),a=document.createElement("div");a.id=vn,a.setAttribute("role","status"),Object.assign(a.style,{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"12px",padding:"10px 14px",borderRadius:"999px",background:"#111827",color:"#fff",font:"13px/1 system-ui, sans-serif",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",border:"1px solid rgba(255,255,255,0.14)"});let l=document.createElement("span");l.textContent=t?`\u201C${e}\u201D isn\u2019t in your personas \u2014 showing the default experience`:`Previewing as ${r}`;let o=document.createElement("button");o.type="button",o.textContent="Exit preview",Object.assign(o.style,{cursor:"pointer",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"inherit",padding:"4px 10px",borderRadius:"999px"}),o.addEventListener("click",()=>{try{let c=new URL(window.location.href);c.searchParams.delete("sentient_persona"),window.location.href=c.pathname+c.search+c.hash}catch(c){}}),a.appendChild(l),a.appendChild(o),((n=document.body)!=null?n:document.documentElement).appendChild(a)}catch(r){}}async function Zr(e,t){var s,u,p,d,m,S,R,O,f,y;let n=(s=e.apiBase)!=null?s:"https://api.sentient-ui.com",a=((u=e.registry)!=null?u:Object.keys(e.slots).length===0)?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(e.slots).map(([x,I])=>({id:x,dims:I.dims}))},l=await Sn(fetch(`${n}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify(a)}).then(x=>x.ok?x.json():null).catch(()=>null),wn);if(!l){ve(e,"persona preview: explain unavailable \u2014 page left as-is");return}let o=l;le=(p=o.slots)!=null?p:{},de=(d=o.slotConfig)!=null?d:null,Oe(o.palette);let c=(R=(S=(m=o.personaAttributes)==null?void 0:m.persona)!=null?S:o.persona)!=null?R:t,i=(f=(O=o.personaAttributes)==null?void 0:O.confidence)!=null?f:"high";T={persona:c,band:i},be(document),Ce=!0,In(e),o.recognized===!1?bn(t,!0):bn((y=o.personaDisplay)!=null?y:c)}function In(e){let t={goal(n,r){try{M==null||M.goal(n,r)}catch(a){}},componentGoal(n,r){try{M==null||M.componentGoal(n,r)}catch(a){}},grantConsent(){try{tt(e.apiKey)}catch(n){}Je=!0;try{Jr()}catch(n){}},revokeConsent(){try{se==null||se(),se=null,Ve=null,$==null||$(),$=null,te==null||te.teardown(),te=null,Je=!1,M==null||M.destroy()}catch(n){}},reapply:ct,getState(){var n,r;return{apiKey:e.apiKey,persona:(n=T==null?void 0:T.persona)!=null?n:null,band:(r=T==null?void 0:T.band)!=null?r:null,slots:le,matchCounts:at(e),consent:e.consent!==!1}}};window.SentientSnippet=t;for(let n of Hr.splice(0))try{n[0]==="goal"&&t.goal(n[1],n[2])}catch(r){}}async function On(){var e,t,n,r,a,l;try{let o=Ue(window.sentient);if(!o)return;j=o,Ce=!1,ye=null,Oe(null),Je=!1;let c=typeof window!="undefined"?An(window.location.search):null;if(c){pn(c);try{let I=new URL(window.location.href);I.searchParams.delete("sentient_editor"),window.history.replaceState(null,"",I.pathname+I.search+I.hash)}catch(I){}}let i=c!=null?c:dn();if(i){Xr(o,i),ve(o,"editor mode");return}let s=typeof window!="undefined"?En(window.location.search):null;if(s){le=s,T=null,be(document),mn(),ve(o,"preview mode",s);return}let u=typeof window!="undefined"?kn(window.location.search):null;if(u){await Zr(o,u),ve(o,"persona preview",u);return}let p=(e=o.registry)!=null?e:Object.keys(o.slots).length===0,d=$e(o.apiKey);d&&(T={persona:d.persona,band:d.band},le=d.slots,d.slotConfig&&(de=d.slotConfig),d.palette&&Oe(d.palette),be(document,{contentAndOps:!1}),d.layoutOrder&&(ye=d.layoutOrder,st(ye,document)));let m=je({apiKey:o.apiKey,context:o.context,consent:o.consent,preConsentBehavior:o.preConsentBehavior,debug:o.debug,persona:o.persona});M=m,In(o),mn();let S=Object.entries(o.slots).map(([I,B])=>({id:I,dims:B.dims})),R=it!=="0.0.0-dev"?{v:it}:{},O=Array.from(xn(document).keys()),f=await Sn(m.decide(J(J(J({slots:S},R),O.length>=2?{sections:O}:{}),p?{slotsFrom:"registry"}:{})),wn);if(!f){ve(o,"decide timeout/null \u2014 snapshot state stands",at(o));return}let y=m.getPersona();y?T={persona:y.persona,band:y.band}:f.persona&&(T={persona:f.persona,band:"low"}),le=f.slots,p?de=(t=f.slotConfig)!=null?t:null:f.slotConfig&&(de=f.slotConfig),f.palette&&Oe(f.palette);let x=[];if(Vr(o,be(document,{onApplied:(I,B,b)=>x.push({slotId:I,arm:B,el:b})})),ye=(n=f.layoutOrder)!=null?n:ye,st(ye,document),Ce=!0,f.goals&&f.goals.length>0&&o.consent!==!1&&M)try{te==null||te.teardown(),te=cn(f.goals,M,document)}catch(I){}if(He=(r=f.sectionMap)!=null?r:null,_e()){lt();try{$==null||$(),$=Fe(M,o.apiKey,x)}catch(I){}}ve(o,"applied",{persona:T,slots:le,matches:at(o)}),Ee(o.apiKey,J(J({v:1,persona:(a=T==null?void 0:T.persona)!=null?a:f.persona,band:(l=T==null?void 0:T.band)!=null?l:"low",slots:f.slots,layoutOrder:f.layoutOrder,savedAt:Date.now()},de?{slotConfig:de}:{}),f.palette?{palette:f.palette}:{}))}catch(o){}}if(typeof window!="undefined"&&window.sentient){let e=window;e.__sentientInitialized||(e.__sentientInitialized=!0,On())}return Pn(Qr);})();
|
|
1
|
+
"use strict";var SentientSnippet=(()=>{var De=Object.defineProperty;var Cn=Object.getOwnPropertyDescriptor;var Ln=Object.getOwnPropertyNames,pt=Object.getOwnPropertySymbols;var mt=Object.prototype.hasOwnProperty,Tn=Object.prototype.propertyIsEnumerable;var gt=(e,t,n)=>t in e?De(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Y=(e,t)=>{for(var n in t||(t={}))mt.call(t,n)&>(e,n,t[n]);if(pt)for(var n of pt(t))Tn.call(t,n)&>(e,n,t[n]);return e};var ht=(e,t)=>()=>(e&&(t=e(e=0)),t);var yt=(e,t)=>{for(var n in t)De(e,n,{get:t[n],enumerable:!0})},Rn=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Ln(t))!mt.call(e,s)&&s!==n&&De(e,s,{get:()=>t[s],enumerable:!(r=Cn(t,s))||r.enumerable});return e};var Pn=e=>Rn(De({},"__esModule",{value:!0}),e);var Dn,Bn,Mn,vt,Nn,Kn,bt,C,ke,Be=ht(()=>{"use strict";Dn=Object.defineProperty,Bn=Object.defineProperties,Mn=Object.getOwnPropertyDescriptors,vt=Object.getOwnPropertySymbols,Nn=Object.prototype.hasOwnProperty,Kn=Object.prototype.propertyIsEnumerable,bt=(e,t,n)=>t in e?Dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,C=(e,t)=>{for(var n in t||(t={}))Nn.call(t,n)&&bt(e,n,t[n]);if(vt)for(var n of vt(t))Kn.call(t,n)&&bt(e,n,t[n]);return e},ke=(e,t)=>Bn(e,Mn(t))});var Ot={};yt(Ot,{LOCAL_ENGINE_AVAILABLE:()=>zn,createLocalEngine:()=>qn});function qn(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var zn,Ct=ht(()=>{"use strict";zn=!1});var ao={};yt(ao,{applyPersonaAttributes:()=>He,applyRegistrySlots:()=>Ve,applySlotArms:()=>Fe,applySlotAttributes:()=>We,parseEditorToken:()=>xn,parsePersonaPreview:()=>kn,parsePreview:()=>En,parseSnippetConfig:()=>ze,reapply:()=>ft,run:()=>_n,version:()=>lt});Be();var $n=["buyer","researcher","deal_seeker","browser"];var jn={buyer:"Buyer",researcher:"Researcher",deal_seeker:"Deal seeker",browser:"Browser",unknown:"Unknown"};function Me(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function wt(e){if(e.length===0)return null;let t={};for(let n of e.split("|")){let r=n.indexOf("=");if(r<=0||r!==n.lastIndexOf("=")||r===n.length-1)return null;let s=n.slice(0,r);if(s in t)return null;t[s]=n.slice(r+1)}return t}function Qe(e){var t,n,r;if(e.arms)return typeof e.baseline=="string"?e.baseline:(t=e.arms[0])!=null?t:"";if(e.baseline!==void 0&&typeof e.baseline=="object")return Me(e.baseline);if(typeof e.baseline=="string")return e.baseline;let s={};for(let[l,o]of Object.entries((n=e.dims)!=null?n:{}))s[l]=(r=o[0])!=null?r:"";return Me(s)}function St(e,t){var n,r;return e.dims!=null?(r=(n=wt(t))!=null?n:wt(Qe(e)))!=null?r:{}:t}function me(e){return e>=.3?e<.7?"medium":"high":"low"}var uo=$n.map(e=>({key:e,displayName:jn[e]}));var Un=["GPTBot","ChatGPT-User","OAI-SearchBot","ClaudeBot","Claude-User","Claude-SearchBot","PerplexityBot","Perplexity-User","Google-Extended","Applebot-Extended","Meta-ExternalAgent","Bytespider","CCBot","Amazonbot","cohere-ai","Diffbot"];function At(e){return Gn(e)!==null}function Gn(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=Un.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function xt(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 Et(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(s){}let r=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(r)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(r)?"social":"referral"}catch(n){return"direct"}}function kt(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}function It(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function et(e){return C(C(C({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 tt(e){let t=et(e);return St(t,Qe(t))}function _t(e){return typeof e=="string"?e:Me(e)}Be();function Tt(){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)})}function Rt(e){return e?`_${e.slice(0,12)}`:""}var Hn="_snt_uid",Wn=365,Fn="_snt_uid";function Vn(){return Tt()}function Jn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Yn(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(r){}}function Xn(e){try{return localStorage.getItem(e)}catch(t){return null}}function Zn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Qn(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function er(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function tr(e){try{sessionStorage.removeItem(e)}catch(t){}}function nr(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=strict; path=/`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function rr(e){try{localStorage.removeItem(e)}catch(t){}}function or(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var ir={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function Pt(e){var t,n,r,s,l,o;if(typeof window=="undefined")return ir;let c=Rt(e==null?void 0:e.apiKey),i=(t=e==null?void 0:e.cookieName)!=null?t:`${Hn}${c}`,a=`${Fn}${c}`,u=((n=e==null?void 0:e.cookieTTLDays)!=null?n:Wn)*24*60*60,f=w=>w&&w.length>0?w:null,d=(o=(l=(s=(r=f(Jn(i)))!=null?r:f(Xn(a)))!=null?s:f(Qn(a)))!=null?l:f(e==null?void 0:e.ssrSessionId))!=null?o:Vn();Yn(i,d,u);let g=Zn(a,d),A=nr(i),L=g?!1:er(a,d),x=!g&&!A&&!L;return{getSessionId:()=>d,isEphemeral:()=>x,destroy:()=>{d=null,or(i),rr(a),tr(a)}}}function _e(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function ot(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 Dt(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?(localStorage.removeItem(e),r.slice(-t)):[]}catch(n){return[]}}function we(e,t,n){try{let r=(()=>{try{let l=localStorage.getItem(n);if(!l)return[];let o=JSON.parse(l);return Array.isArray(o)?o:[]}catch(l){return[]}})(),s=new Map;for(let l of r)s.set(l.id,l);for(let l of e)s.set(l.id,l);localStorage.setItem(n,JSON.stringify([...s.values()].slice(-t)))}catch(r){}}function Bt(e,t){try{let n=localStorage.getItem(t);if(!n)return;let r=JSON.parse(n);if(!Array.isArray(r))return;let s=new Set(e),l=r.filter(o=>!s.has(o.id));if(l.length===r.length)return;l.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(l))}catch(n){}}var sr=500,ar=56*1024;function Mt(e){return`_snt_retry_${e.slice(0,12)}`}var lr={push:()=>{},flush:()=>{},destroy:()=>{}};function cr(e){var t,n,r;if(typeof window=="undefined")return lr;let s=(t=e.flushIntervalMs)!=null?t:5e3,l=(n=e.maxBatchSize)!=null?n:20,o=(r=e.maxRetrySize)!=null?r:100,c=e.ingestUrl,i=e.apiKey,a=Mt(i),u=[],f=new Set,d=[],g=p=>{for(let y of p)A.delete(y),!f.has(y)&&(f.add(y),d.push(y));for(;d.length>sr;){let y=d.shift();y&&f.delete(y)}Bt(p,a)},A=new Set,L=p=>{f.has(p.id)||A.has(p.id)||(A.add(p.id),u.push(p))},x=p=>{for(let y of p)f.has(y.id)||(A.add(y.id),u.push(y))},w=Dt(a,o);for(let p of w)L(p);let k=0,h=0,b=(p,y=!0)=>{if(p.length===0)return;let E=JSON.stringify(p),P=p.map(ne=>ne.id),T;try{T=fetch(c,{method:"POST",keepalive:!0,body:E,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})}catch(ne){we(p,o,a),x(p),h++,k=Date.now()+_e(h);return}let ve=ne=>{if(ot(ne)!=="retry"){if(!ne.ok&&y){let se=p.filter(ae=>ae.eventType!=="pageview");if(se.length>0&&se.length<p.length){g(p.filter(ae=>ae.eventType==="pageview").map(ae=>ae.id)),b(se,!1);return}}g(P),h=0,k=0;return}we(p,o,a),x(p),h++,k=Date.now()+_e(h)};T instanceof Promise?T.then(ve).catch(()=>{we(p,o,a),x(p),h++,k=Date.now()+_e(h)}):ve(T)},I=typeof TextEncoder!="undefined"?new TextEncoder:null,M=p=>I?I.encode(p).length:p.length,S=p=>{let y=[],E=2;for(let P of p){let T=M(JSON.stringify(P))+1;if(y.length>0&&E+T>ar||y.length>=l)break;y.push(P),E+=T}return y},R=()=>{try{if(Date.now()<k)return;for(;u.length>0&&!(Date.now()<k);){let p=u.filter(E=>!f.has(E.id));if(u.length=0,p.length===0)break;let y=S(p);if(y.length===0)break;y.length<p.length&&u.push(...p.slice(y.length)),b(y)}}catch(p){}},X=!0,_=null;_=setInterval(()=>{X&&R()},s);let Z=()=>{document.visibilityState==="hidden"&&R()},N=()=>{R()};return document.addEventListener("visibilitychange",Z),window.addEventListener("pagehide",N),{push(p){L(p),u.length>=l&&R()},flush:R,destroy(){X=!1,_!==null&&(clearInterval(_),_=null),document.removeEventListener("visibilitychange",Z),window.removeEventListener("pagehide",N),R()}}}var ur=200;function Nt(e){return`_snt_goal_retry_${e.slice(0,12)}`}var dr={send:()=>{},flush:()=>{},destroy:()=>{}};function fr(e){var t,n,r;if(typeof window=="undefined")return dr;let s=(t=e.flushIntervalMs)!=null?t:5e3,l=(n=e.maxRetrySize)!=null?n:100,o=(r=e.maxPerFlush)!=null?r:5,c=Nt(e.apiKey),i=[],a=new Set,u=new Set,f=[],d=0,g=0,A=!1,L=S=>{for(a.delete(S.id),u.has(S.id)||(u.add(S.id),f.push(S.id));f.length>ur;){let R=f.shift();R&&u.delete(R)}Bt([S.id],c)},x=S=>{we([S],l,c),!u.has(S.id)&&!a.has(S.id)&&(a.add(S.id),i.push(S)),Date.now()>=d&&(g++,d=Date.now()+_e(g))},w=S=>{let R;try{R=fetch(e.url,{method:"POST",keepalive:!0,body:S.body,headers:e.headers})}catch(_){x(S);return}let X=_=>{var Z;let N=ot(_);if(N==="retry"){x(S);return}N==="dropped"&&((Z=e.onDrop)==null||Z.call(e,S,_.status)),L(S),g=0,d=0};R instanceof Promise?R.then(X).catch(()=>x(S)):X(R)},k=()=>{try{if(A||Date.now()<d)return;let S=0;for(;i.length>0&&S<o&&!(Date.now()<d);){let R=i.shift();a.delete(R.id),!u.has(R.id)&&(S++,w(R))}}catch(S){}},h=Dt(c,l);for(let S of h)a.has(S.id)||(a.add(S.id),i.push(S));h.length>0&&we(h,l,c);let b=setInterval(k,s),I=()=>{document.visibilityState==="hidden"&&k()},M=()=>k();return document.addEventListener("visibilitychange",I),window.addEventListener("pagehide",M),{send(S){if(!A&&!(u.has(S.id)||a.has(S.id))){if(Date.now()<d){we([S],l,c),a.add(S.id),i.push(S);return}w(S)}},flush:k,destroy(){clearInterval(b),document.removeEventListener("visibilitychange",I),window.removeEventListener("pagehide",M),k(),A=!0}}}var pr=1800*1e3;function Ne(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function gr(e=pr,t){let n=new Map,r=`_snt_asgn${Rt(t)}_`,s=(i,a)=>`${r}${encodeURIComponent(i)}:${encodeURIComponent(a)}`,l=i=>{let a=i.slice(r.length),u=a.indexOf(":");if(u<0)return null;try{return{componentId:decodeURIComponent(a.slice(0,u)),segment:decodeURIComponent(a.slice(u+1))}}catch(f){return null}},o=()=>{try{let i=[];for(let a=0;a<localStorage.length;a++){let u=localStorage.key(a);u!=null&&u.startsWith(r)&&i.push(u)}return i}catch(i){return[]}},c=i=>i.assignedAt+(i.ttlMs&&i.ttlMs>0?i.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let i of o())try{let a=localStorage.getItem(i);if(!a)continue;let u=JSON.parse(a);if(c(u)){localStorage.removeItem(i);continue}let f=l(i);if(!f)continue;n.set(Ne(f.componentId,f.segment),u)}catch(a){}})(),{get(i,a){let u=n.get(Ne(i,a));return u?c(u)?(n.delete(Ne(i,a)),null):u:null},set(i,a,u){let f=Ne(i,a);n.set(f,u);try{localStorage.setItem(s(i,a),JSON.stringify(u))}catch(d){}},invalidate(i){let a=`${encodeURIComponent(i)}:`;for(let u of[...n.keys()])u.startsWith(a)&&n.delete(u);for(let u of o()){let f=l(u);if((f==null?void 0:f.componentId)===i)try{localStorage.removeItem(u)}catch(d){}}},clear(){n.clear();for(let i of o())try{localStorage.removeItem(i)}catch(a){}}}}var je="_snt_snap:",mr=["low","medium","high"];function Ue(e){try{let t=localStorage.getItem(je+e);if(!t)return null;let n=JSON.parse(t);return!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!mr.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"||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig))?null:n}catch(t){return null}}function Oe(e,t){try{localStorage.setItem(je+e,JSON.stringify(t))}catch(n){}}var rt="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Kt="[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.",Lt=!1,Ke=!1;function hr(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function yr(e){var t;let n=Pt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",s=hr(),l=Promise.resolve().then(()=>(Ct(),Ot)).then(i=>{let a=i;return a.LOCAL_ENGINE_AVAILABLE?(Lt||(Lt=!0,console.info(Kt)),a):(Ke||(Ke=!0,console.error(rt)),null)}).catch(()=>(Ke||(Ke=!0,console.error(rt)),null)),o=null;function c(i){let a=document.documentElement;a.dataset.sentientPersona===void 0&&(a.dataset.sentientPersona=i.persona,a.dataset.sentientConfidence=me(i.confidence))}return{isLocal:!0,async decide(i){var a,u,f;let d=await l;if(!d)return null;let g=d.createLocalEngine({sessionId:r,forcedPersona:s}).decide(i);return o=ke(C({},g),{layoutOrder:(u=(a=g.layoutOrder)!=null?a:o==null?void 0:o.layoutOrder)!=null?u:null,slots:C(C({},(f=o==null?void 0:o.slots)!=null?f:{}),g.slots)}),Oe(e.apiKey||"local",{v:1,persona:o.persona,band:me(o.confidence),slots:o.slots,layoutOrder:o.layoutOrder,savedAt:Date.now()}),c(g),g},getSlotResult(i){var a,u,f;return(f=(u=o==null?void 0:o.slots[i])!=null?u:(a=e.initialSlots)==null?void 0:a[i])!=null?f:null},getPersona(){return o?{persona:o.persona,confidence:o.confidence,band:me(o.confidence)}:null},async assign(i,a){var u;let f=await l;return!f||!a||a.length===0?a!=null&&a[0]?{variantId:a[0],assignmentTtlMs:0}:null:{variantId:(u=f.createLocalEngine({sessionId:r,forcedPersona:s}).decide({components:[{id:i,variantIds:a}]}).assignments[i])!=null?u:a[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>n.destroy()}}function Ce(e,t,n,r){let s=[];{let l=!1,o=[],c=()=>{if(l)return;let i=Date.now();for(o.push(i);o.length>0&&i-o[0]>500;)o.shift();o.length>=3&&(l=!0,e("rage_click"))};t.addEventListener("click",c),s.push(()=>t.removeEventListener("click",c))}{let l=!1,o=c=>{if(l||!(c.target instanceof Node)||!t.contains(c.target)&&t!==c.target)return;l=!0;let i=typeof window!="undefined"?window.getSelection():null,a=i?i.toString().length:0;e("text_copy",{selectionLength:a})};document.addEventListener("copy",o),s.push(()=>document.removeEventListener("copy",o))}{let l=!1,o=!1,c=null,i=()=>{c!==null&&(clearTimeout(c),c=null)},a=()=>{l||!o||(i(),c=setTimeout(()=>{!l&&o&&(l=!0,e("scroll_hesitation"))},3e3))},u=()=>{i(),a()},f=g=>{for(let A of g)o=A.intersectionRatio>.3,o?a():i()},d=new IntersectionObserver(f,{threshold:[.3]});d.observe(t),window.addEventListener("scroll",u,{passive:!0}),s.push(()=>{d.disconnect(),window.removeEventListener("scroll",u),i()})}if((r==null?void 0:r.tabLoss)!==!1){let l=!1,o=n!=null?n:Date.now(),c=()=>{if(l||document.visibilityState!=="hidden")return;let i=Date.now()-o;i<15e3&&(l=!0,e("tab_loss",{timeOnPage:i}))};document.addEventListener("visibilitychange",c),s.push(()=>document.removeEventListener("visibilitychange",c))}return()=>{for(let l of s)l()}}var $t="https://api.sentient-ui.com/v1/events",V=new Map,jt=null;function vr(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var br=3;function nt(){return Tt()}function $e(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function wr(e){if(typeof MessageChannel=="function"){let t=new MessageChannel;t.port1.onmessage=()=>{e.clear(),t.port1.close(),t.port2.close()},t.port2.postMessage(0)}else setTimeout(()=>e.clear(),0)}var Ut=new Set;function Sr(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let s=!1,l,o=()=>{if(s)return;let a=$e();!a||a===l||(l=a,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${a}`))},c=[];for(let a of["pushState","replaceState"]){let u=r[a],f=function(...d){let g=u.apply(this,d);return o(),g};r[a]=f,c.push([a,u,f])}window.addEventListener("popstate",o);let i=$e();return i&&Ut.has(`${t}:${i}`)?l=i:o(),()=>{if(!s){s=!0,window.removeEventListener("popstate",o);for(let[a,u,f]of c)r[a]===f&&(r[a]=u)}}}var Ie={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}};function Ar(){try{let e={},t=new URLSearchParams(window.location.search);for(let[n,r]of t)n.startsWith("utm_")&&(e[n]=r);return e}catch(e){return{}}}function Gt(e){return e.replace(/\/events\/?$/,"")}function he(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(e=>e==="1"||e==="yes")}function it(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:jt;if(!n){console.warn("[sentient] grantConsent() called before init()");return}let r=V.get(n);if(!r){console.warn("[sentient] grantConsent() called before init()");return}let{config:s,upgrade:l}=r;if(!l||s.respectDoNotTrack!==!1&&he())return;let o=Ge(ke(C({},s),{consent:!0}));l(o);let c=(t=V.get(n))==null?void 0:t.dispose;V.set(n,{config:ke(C({},s),{consent:!0}),upgrade:null,dispose:c})}function xr(e){var t;let n=e.preConsentBehavior==="statistical_winner",r=Gt((t=e.ingestUrl)!=null?t:$t),s={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},l={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),async assign(i,a,u){if(!n)return null;try{let f=new URLSearchParams({componentId:i});for(let g of a!=null?a:[])f.append("variantIds[]",g);let d=await fetch(`${r}/winner?${f.toString()}`,{headers:s});return d.ok?{variantId:(await d.json()).variantId,assignmentTtlMs:0}:a!=null&&a[0]?{variantId:a[0],assignmentTtlMs:0}:null}catch(f){return a!=null&&a[0]?{variantId:a[0],assignmentTtlMs:0}:null}},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}},o={track:i=>l.track(i),goal:((i,a,u,f)=>l.goal(i,a,u,f)),componentGoal:(i,a,u)=>l.componentGoal(i,a,u),identify:i=>l.identify(i),getAssignment:(i,a)=>l.getAssignment(i,a),assign:(i,a,u,f)=>l.assign(i,a,u,f),decide:i=>l.decide(i),getSlotResult:i=>l.getSlotResult(i),getPersona:()=>l.getPersona(),fetchWeights:()=>l.fetchWeights(),getGraph:()=>l.getGraph(),dispose:()=>l.dispose(),destroy:()=>l.destroy()};function c(i){l=i}return{proxy:o,setInner:c}}function Ge(e){var t,n,r,s,l,o,c,i,a;if(typeof window=="undefined")return Ie;jt=e.apiKey;let u=V.get(e.apiKey||"local");if(u!=null&&u.dispose)try{u.dispose()}catch(m){}let f=e.respectDoNotTrack!==!1&&he(),d=e.consent===!1||f,g=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!g&&e.localMode!==!1)return d?(V.set(e.apiKey||"local",{config:e,upgrade:null}),Ie):(V.set(e.apiKey||"local",{config:e,upgrade:null}),yr(e));if(d){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."),V.set(e.apiKey,{config:e,upgrade:null}),Ie;let{proxy:m,setInner:v}=xr(e);return V.set(e.apiKey,{config:e,upgrade:f?null:v}),m}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."),Ie;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),Ie;let A=(t=e.ingestUrl)!=null?t:$t,L=Date.now(),x=Pt({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),w=gr(void 0,e.apiKey),k=cr({ingestUrl:A,apiKey:e.apiKey}),h=Gt(A),b={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},I=new Set,M=fr({url:`${h}/goals`,apiKey:e.apiKey,headers:b,onDrop:(m,v)=>{if(!e.debug){if(I.has(v))return;I.add(v)}console.warn(`[sentient] goal dropped (HTTP ${v}) \u2014 this will not be retried. `+(v===400?"The session was not found: call init() and let the session upsert complete before firing goals.":v===401||v===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),m)}}),S=xt((n=navigator.userAgent)!=null?n:""),R=typeof window!="undefined"?window.location.origin:void 0,X=Et((r=document.referrer)!=null?r:"",R),_=(s=e.sessionSegment)!=null?s:`${S}:${X}`,Z=new Map,N=new Map,p=null,y=m=>{for(let v of m)N.has(v.id)||N.set(v.id,tt(v))};if(e.initialSlots)for(let[m,v]of Object.entries(e.initialSlots))N.set(m,v);let E=Ue(e.apiKey);if(E)for(let[m,v]of Object.entries(E.slots))N.has(m)||N.set(m,v);let P={low:.15,medium:.5,high:.85};if(e.initialPersona)p=C({},e.initialPersona);else{let m=document.documentElement.dataset;m.sentientPersona?p={persona:m.sentientPersona,confidence:(o=P[(l=m.sentientConfidence)!=null?l:"low"])!=null?o:.15}:E&&(p={persona:E.persona,confidence:(c=P[E.band])!=null?c:.15})}if(e.initialAssignments)for(let[m,v]of Object.entries(e.initialAssignments))w.set(m,_,{variantId:v,assignedAt:Date.now(),segment:_,confidence:1});let T=Promise.resolve(),ve=x.getSessionId();if(ve){let m=kt((i=document.referrer)!=null?i:""),v=C(C(C({sessionId:ve,deviceClass:S,trafficSource:X,referrerDomain:m,utmParams:Ar(),timeOfDay:It(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:x.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||At((a=navigator.userAgent)!=null?a:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),D=async()=>{for(let G=0;;G++){try{let K=await fetch(`${h}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(v),headers:b});if(K.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(K.ok||ot(K)==="dropped")return}catch(K){}if(G>=br){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(K=>setTimeout(K,_e(G+1)))}};try{T=D()}catch(G){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:k});let ne=new Set,se=null,ae=!1,be={goal(m,v={},D=1,G=0){var K,j,Q,F,q,re;let H=x.getSessionId();if(!H)return;let W=vr(v)?v:{metadata:v},ee=`${m}\0${(K=W.externalId)!=null?K:""}\0${(j=W.stepIndex)!=null?j:G}\0${(Q=W.weight)!=null?Q:D}`;if(ne.has(ee)){e.debug&&console.log(`[sentient] goal("${m}") already recorded for this action \u2014 not sent twice`);return}ne.add(ee),ne.size===1&&wr(ne);let xe=nt(),O={sessionId:H,name:m,metadata:(F=W.metadata)!=null?F:{},weight:(q=W.weight)!=null?q:D,stepIndex:(re=W.stepIndex)!=null?re:G,goalId:xe,value:W.value,currency:W.currency,externalId:W.externalId};e.debug&&console.log("[sentient] goal",O);let ge={id:xe,body:JSON.stringify(O)};T.then(()=>M.send(ge))},componentGoal(m,v,D){var G,K,j;let Q=x.getSessionId();if(!Q)return;let F=w.get(m,_),q=F?null:(G=N.get(m))!=null?G:null;if(!F&&q===null){e.debug&&console.warn(`[sentient] componentGoal("${m}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}let re=F?F.variantId:_t(q),H={id:nt(),sessionId:Q,projectId:e.apiKey,componentId:m,variantId:re,eventType:"goal_achieved",goalType:v,payload:C({reward:(K=D==null?void 0:D.reward)!=null?K:1,goalValue:D==null?void 0:D.value,currency:D==null?void 0:D.currency},(j=D==null?void 0:D.metadata)!=null?j:{}),timestamp:Date.now(),timeInSession:Date.now()-L,path:$e()};e.debug&&console.log("[sentient] componentGoal",H),T.then(()=>k.push(H))},identify(m){let v=x.getSessionId();v&&T.then(()=>{fetch(`${h}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:v,userId:m,ephemeral:x.isEphemeral()}),headers:b}).catch(()=>{})})},track(m){let v=x.getSessionId();if(!v)return;let D=ke(C({path:$e()},m),{id:nt(),sessionId:v,timestamp:Date.now(),timeInSession:Date.now()-L});e.debug&&console.log("[sentient] track",D),T.then(()=>k.push(D))},getAssignment(m,v){return w.get(m,v)},async assign(m,v,D,G){let K=x.getSessionId();if(!K)return null;let j=w.get(m,_);if(j&&(v!=null&&v.length||j.content!==void 0)){let q=j.ttlMs&&j.ttlMs>0?Math.max(0,j.assignedAt+j.ttlMs-Date.now()):0;return{variantId:j.variantId,assignmentTtlMs:q,content:j.content}}let Q=Z.get(m);if(Q)return Q;let F=(async()=>{await T;try{let q={sessionId:K,componentId:m,variantIds:v};G!==void 0?q.agentDataByVariant=G:D!==void 0&&(q.agentData=D);let re=await fetch(`${h}/assign`,{method:"POST",body:JSON.stringify(q),headers:b});if(!re.ok)return null;let H=await re.json();return w.set(m,_,C({variantId:H.variantId,assignedAt:Date.now(),segment:_,confidence:1,content:H.content},H.assignmentTtlMs&&H.assignmentTtlMs>0?{ttlMs:H.assignmentTtlMs}:{})),H}catch(q){return null}finally{Z.delete(m)}})();return Z.set(m,F),F},async decide(m){var v,D,G,K,j,Q,F,q,re;let H=x.getSessionId();if(!H)return null;let W=(v=m.slots)!=null?v:[];await T;try{let ee={sessionId:H};m.sections&&m.sections.length>0&&(ee.sections=m.sections.map(J=>({id:J}))),ee.components=(D=m.components)!=null?D:[],W.length>0&&(ee.slots=W.map(et)),m.slotsFrom==="registry"&&(ee.slotsFrom="registry"),m.v&&(ee.v=m.v),e.persona&&(ee.persona=e.persona);let xe=await fetch(`${h}/decide`,{method:"POST",body:JSON.stringify(ee),headers:b});if(!xe.ok)return y(W),null;let O=await xe.json(),ge={};for(let J of W)ge[J.id]=(K=(G=O.slots)==null?void 0:G[J.id])!=null?K:tt(J);if(O.slots)for(let[J,Ee]of Object.entries(O.slots))J in ge||(ge[J]=Ee);for(let[J,Ee]of Object.entries(ge))N.set(J,Ee);let On=p!=null&&p.persona!=="unknown";O.persona&&!(O.persona==="unknown"&&On)?p={persona:O.persona,confidence:(j=O.confidence)!=null?j:0}:p||(p={persona:"unknown",confidence:0});for(let[J,Ee]of Object.entries((Q=O.assignments)!=null?Q:{}))w.set(J,_,{variantId:Ee,assignedAt:Date.now(),segment:_,confidence:1});return Oe(e.apiKey,C(C({v:1,persona:p.persona,band:me(p.confidence),slots:Object.fromEntries(N),layoutOrder:(F=O.layoutOrder)!=null?F:null,savedAt:Date.now()},O.slotConfig?{slotConfig:O.slotConfig}:{}),O.palette?{palette:O.palette}:{})),C(C(C(C({layoutOrder:(q=O.layoutOrder)!=null?q:null,assignments:(re=O.assignments)!=null?re:{},slots:ge,persona:p.persona,confidence:p.confidence},O.slotConfig?{slotConfig:O.slotConfig}:{}),O.goals?{goals:O.goals}:{}),O.sectionMap?{sectionMap:O.sectionMap}:{}),O.palette?{palette:O.palette}:{})}catch(ee){return y(W),null}},getSlotResult(m){var v;return(v=N.get(m))!=null?v:null},getPersona(){return p?{persona:p.persona,confidence:p.confidence,band:me(p.confidence)}:null},async fetchWeights(){var m;try{let v=await fetch(`${h}/weights`,{headers:b});return v.ok?(m=(await v.json()).components)!=null?m:[]:[]}catch(v){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){var m;se==null||se(),ae=!0,k.destroy(),M.destroy(),((m=V.get(e.apiKey))==null?void 0:m.dispose)===be.dispose&&V.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var m;se==null||se(),ae=!0,k.destroy(),M.destroy(),x.destroy(),((m=V.get(e.apiKey))==null?void 0:m.dispose)===be.dispose&&V.delete(e.apiKey);try{localStorage.removeItem(je+e.apiKey),localStorage.removeItem(Mt(e.apiKey)),localStorage.removeItem(Nt(e.apiKey))}catch(v){}e.debug&&console.log("[sentient] destroyed")}};if(V.set(e.apiKey,{config:e,upgrade:null,dispose:be.dispose}),se=Sr(be,e.apiKey,m=>{T.then(()=>{ae||Ut.add(m)})}),e.debug){let m=window;m.__sentient&&(m.__sentient.client=be)}return be}var zt=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Er=[["pricing",/\b(pricing|price|plans?|subscriptions?|per month|\/mo|tier)\b/i],["faq",/\b(faq|frequently asked|common questions?)\b/i],["comparison",/\b(compare|comparison|versus|vs\.)\b/i],["social_proof",/\b(testimonial|reviews?|trusted by|loved by|customers?|logos|rated|case stud)\b/i],["trust",/\b(security|guarantee|privacy|compliance|secure|gdpr|soc ?2|encrypt)\b/i],["features",/\b(features?|how it works|benefits?|capabilit|what you get)\b/i]],kr=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]];function Ir(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function qt(e){if(e.tag==="nav"||e.tag==="footer")return{type:"navigation",strength:"weak"};let t=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[n,r]of Er)if(r.test(t))return{type:n,strength:"strong"};for(let[n,r]of kr)if(r.test(e.bodyText))return{type:n,strength:"strong"};return e.actionCount>=1&&e.textLength>0&&e.textLength<200?{type:"cta",strength:"weak"}:e.tag==="header"?{type:"hero",strength:"weak"}:/\b(hero|headline|banner)\b/i.test(t)?{type:"hero",strength:"weak"}:{type:"generic",strength:"weak"}}function Ht(e){var t,n;let r=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim();return{tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:Ir(e),bodyText:r.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:r.length}}function Wt(e){return qt(Ht(e)).type}Be();var _r="section, header, footer, nav, main > div, [data-sentient-section]",Or=2e4;function Cr(e){let t=Array.from(e.querySelectorAll(_r)),n=t.filter(r=>t.filter(s=>s!==r&&r.contains(s)).length<2);return n.filter(r=>!n.some(s=>s!==r&&s.contains(r)))}function Lr(e,t,n,r){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:r})}).catch(()=>{})}catch(s){}}var Ft=()=>{};function Vt(e,t){var n,r,s,l,o,c,i,a,u;let f=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!f||typeof IntersectionObserver=="undefined"||he()||!t.apiKey)return Ft;let d=((r=t.apiBase)!=null?r:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),g=Cr(f);if(g.length===0)return Ft;let A=new Map,L=new Map,x=new Map;for(let p of g){let y=p.getAttribute("data-sentient-type"),E=y&&zt.includes(y)?y:null,P=(l=E!=null?E:(s=t.typeOf)==null?void 0:s.call(t,p))!=null?l:Wt(p),T=`nc-${P}`;A.set(p,T),L.set(T,P),E?x.set(T,"markup"):x.has(T)||x.set(T,"auto")}let w=(a=(i=(c=(o=f.defaultView)!=null?o:typeof window!="undefined"?window:void 0)==null?void 0:c.location)==null?void 0:i.pathname)!=null?a:"/";Lr(t.apiKey,d,w,[...L.entries()].map(([p,y])=>{var E;return{componentId:p,semanticType:y,source:(E=x.get(p))!=null?E:"auto"}}));let k=new Map,h=p=>{let y=k.get(p);return y||(y={ms:0,scroll:0,enterAt:null,intersecting:!1},k.set(p,y)),y},b=new IntersectionObserver(p=>{for(let y of p){let E=A.get(y.target);if(!E)continue;let P=h(E);y.isIntersecting?(P.intersecting=!0,P.enterAt=Date.now(),y.intersectionRatio>P.scroll&&(P.scroll=y.intersectionRatio)):(P.intersecting=!1,P.enterAt!=null&&(P.ms+=Date.now()-P.enterAt,P.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let p of A.keys())b.observe(p);let I=()=>{let p=Date.now();for(let[y,E]of k)if(E.enterAt!=null&&(E.ms+=p-E.enterAt,E.enterAt=null),!(E.ms<=0)){try{e.track({projectId:t.apiKey,componentId:y,eventType:"dwell",payload:{dwell_time:Math.round(E.ms),scroll_depth:Number(E.scroll.toFixed(2))}})}catch(P){}E.ms=0}},M=()=>{if(f.hidden)I();else{let p=Date.now();for(let y of k.values())y.intersecting&&(y.enterAt=p)}},S=!1,R=p=>{if(I(),p!=null&&p.persisted){S=!0;return}try{b.disconnect()}catch(y){}},X=p=>{if(!(p!=null&&p.persisted)||!S)return;S=!1;let y=Date.now();for(let E of k.values())E.enterAt=E.intersecting&&!f.hidden?y:null};f.addEventListener("visibilitychange",M);let _=(u=f.defaultView)!=null?u:typeof window!="undefined"?window:void 0;_==null||_.addEventListener("pagehide",R),_==null||_.addEventListener("pageshow",X);let Z=setInterval(()=>{if(f.hidden||S)return;I();let p=Date.now();for(let y of k.values())y.intersecting&&(y.enterAt=p)},Or),N=[];return t.microSignals&&[...A.entries()].forEach(([p,y],E)=>{N.push(Ce((P,T={})=>{try{e.track({projectId:t.apiKey,componentId:y,eventType:"micro_signal",payload:C({signalType:P},T)})}catch(ve){}},p,void 0,{tabLoss:E===0}))}),()=>{I(),clearInterval(Z),f.removeEventListener("visibilitychange",M),_==null||_.removeEventListener("pagehide",R),_==null||_.removeEventListener("pageshow",X);for(let p of N)p();try{b.disconnect()}catch(p){}}}var Tr=["landing","ecommerce","saas","marketplace"];function Rr(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=Object.entries(e);if(t.length<1||t.length>4)return null;let n={};for(let[r,s]of t){if(!Array.isArray(s)||s.length<2||s.length>6||!s.every(l=>typeof l=="string"))return null;n[r]=s}return n}function Pr(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function Dr(e){try{return e()}catch(t){return}}function ze(e){if(typeof e!="object"||e===null)return null;let t=e;if(typeof t.apiKey!="string"||!t.apiKey.startsWith("pk_"))return null;let n=Tr.includes(t.context)?t.context:"landing",r={};if(typeof t.slots=="object"&&t.slots!==null&&!Array.isArray(t.slots))for(let[o,c]of Object.entries(t.slots)){if(typeof c!="object"||c===null)continue;let i=c,a=Rr(i.dims);if(!a||i.target!==void 0&&typeof i.target!="string")continue;let u=i.arms!==void 0?Pr(i.arms):null,f={dims:a};typeof i.target=="string"&&(f.target=i.target),u&&(f.arms=u),r[o]=f}let s={apiKey:t.apiKey,context:n,personaAttributes:t.personaAttributes===!0,slots:r};typeof t.consent=="boolean"&&(s.consent=t.consent),(t.preConsentBehavior==="statistical_winner"||t.preConsentBehavior==="control")&&(s.preConsentBehavior=t.preConsentBehavior),t.debug===!0&&(s.debug=!0),typeof t.registry=="boolean"&&(s.registry=t.registry),typeof t.editorSrc=="string"&&(s.editorSrc=t.editorSrc),typeof t.apiBase=="string"&&(s.apiBase=t.apiBase),typeof t.sectionCapture=="boolean"&&(s.sectionCapture=t.sectionCapture);let l=typeof t.persona=="function"?Dr(t.persona):t.persona;if(typeof l=="string"&&l.trim()!==""&&(s.persona=l),Array.isArray(t.sections)){let o=t.sections.filter(c=>typeof c=="string"&&c.trim()!=="").slice(0,50);o.length>=2&&(s.sections=o)}return s}function Jt(e){var n,r,s;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(s=t==null?void 0:t.pathname)!=null?s:""}function Br(e,t){var n;if(t.tag&&e.tagName.toLowerCase()!==t.tag.toLowerCase())return!1;if(t.text){let r=((n=e.textContent)!=null?n:"").trim().toLowerCase(),s=t.text.trim().toLowerCase();if(!(r===s||r.startsWith(s)||s.startsWith(r)))return!1}return!0}function Yt(e,t){return!!(e!=null&&e.urlMatch)&&!Jt(t).includes(e.urlMatch)}var Mr=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function de(e,t){var s;if(e.urlMatch&&!Jt(t).includes(e.urlMatch))return null;let n=[];if(e.id){let l=t.getElementById(e.id);n=l?[l]:[]}if(n.length===0&&((s=e.dataAttr)!=null&&s.name)&&Mr.test(e.dataAttr.name))try{let l=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${l}"]`))}catch(l){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(l){n=[]}if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Br(r,e.fingerprint)?null:r}var Xt={color:"color",background:"background",fontSize:"font-size",fontWeight:"font-weight",textAlign:"text-align",padding:"padding",margin:"margin",borderRadius:"border-radius",width:"width",height:"height",maxWidth:"max-width",border:"border",boxShadow:"box-shadow",opacity:"opacity",lineHeight:"line-height",letterSpacing:"letter-spacing",textTransform:"text-transform",gap:"gap",fontFamily:"font-family"},Nr=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function Zt(e){var t;if(e.trim().length===0||/[;{}<>]/.test(e))return!1;for(let n of e.matchAll(/([A-Za-z-]*)\(/g))if(!Nr.test((t=n[1])!=null?t:""))return!1;return!0}var Qt=/^https:\/\//i,en=new Map,fe=null;function Kr(e){return e.replace(/["\\]/g,"\\$&")}function $r(e){var t;(!fe||!fe.isConnected)&&(fe=e.querySelector("style[data-sentient-ops]"),fe||(fe=e.createElement("style"),fe.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(fe))),fe.textContent=[...en.entries()].map(([n,r])=>`[data-snt-e="${Kr(n)}"]{${r}}`).join(`
|
|
2
|
+
`)}function tn(e,t,n,r){var c;let s=!1,l=(c=t.moveBefore)!=null?c:t.moveAfter;if(l){let i=de(l,r);!i||i===e||i.parentElement!==e.parentElement||!e.parentElement?s=!0:t.moveBefore?e.parentElement.insertBefore(e,i):e.parentElement.insertBefore(e,i.nextSibling)}typeof t.text=="string"&&(e.textContent=t.text),typeof t.href=="string"&&Qt.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&Qt.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let o=[];if(t.hidden&&o.push("display:none !important"),t.style)for(let[i,a]of Object.entries(t.style)){let u=Xt[i];u&&typeof a=="string"&&Zt(a)&&o.push(`${u}:${a.trim()} !important`)}return o.length>0&&(e.setAttribute("data-snt-e",n),en.set(n,o.join(";")),$r(r)),{anchorMiss:s}}var Le="data-sentient-block-arm",oe=null;function Te(e){oe=e!=null?e:null}var ce="data-sentient-blocks-hid",nn={none:"0",sm:"8px",md:"16px",lg:"24px"},st={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},rn={sm:"0.875em",md:"1em",lg:"1.25em"},jr={sm:"1.25em",md:"1.5em",lg:"2em"},Ur={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},on={sm:"8px",md:"16px",lg:"32px"},Gr={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},zr={normal:"400",medium:"500",bold:"700"};function le(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function sn(e){return{opacity:e==="muted"?"0.7":void 0,"font-weight":e==="accent"?"600":void 0}}function an(e,t){var n,r,s,l,o,c,i,a,u,f;try{switch(e.type){case"stack":case"grid":{let d=t.createElement("div");if(e.type==="stack"){let g=e;le(d,{display:"flex","flex-direction":g.direction,gap:nn[(n=g.gap)!=null?n:"md"],"align-items":g.align?st[g.align]:void 0,"justify-content":g.justify?st[g.justify]:void 0,"flex-wrap":g.wrap?"wrap":void 0})}else{let g=e,A=nn[(r=g.gap)!=null?r:"md"];le(d,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${g.columns-1} * ${A}) / ${g.columns})), 1fr))`,gap:A,"align-items":g.align?st[g.align]:void 0})}for(let g of(s=e.children)!=null?s:[]){let A=an(g,t);A&&d.appendChild(A)}return d}case"text":{let d=t.createElement("p");return d.textContent=e.value,le(d,Y({margin:"0","font-size":e.size?rn[e.size]:void 0,"font-weight":e.weight?zr[e.weight]:void 0,"text-align":e.align},sn(e.tone)))}case"heading":{let d=t.createElement(`h${e.level}`);return d.textContent=e.value,le(d,{margin:"0","font-size":jr[(l=e.size)!=null?l:"md"],"text-align":e.align})}case"button":{let d=t.createElement("a");d.textContent=e.label,d.href=e.href,e.tag&&d.setAttribute("data-sentient-tag",e.tag);let g=(o=e.emphasis)!=null?o:"primary";return le(d,{display:"inline-block",padding:Ur[(c=e.size)!=null?c:"md"],"border-radius":(i=oe==null?void 0:oe.radius)!=null?i:"8px",font:"inherit","font-size":e.size?rn[e.size]:void 0,"text-decoration":g==="ghost"?"underline":"none",cursor:"pointer",background:g==="primary"?(a=oe==null?void 0:oe.primaryBg)!=null?a:"#111827":"transparent",color:g==="primary"?(u=oe==null?void 0:oe.primaryText)!=null?u:"#ffffff":"inherit",border:g==="secondary"?"1px solid currentColor":"none"})}case"link":{let d=t.createElement("a");return d.textContent=e.label,d.href=e.href,e.tag&&d.setAttribute("data-sentient-tag",e.tag),le(d,{color:"inherit","text-decoration":"underline"})}case"image":{let d=t.createElement("img");return d.src=e.src,d.alt=e.alt,le(d,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?Gr[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let d=t.createElement("span");return d.textContent=e.value,le(d,Y({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:"1px solid currentColor"},sn(e.tone)))}case"spacer":return le(t.createElement("div"),{height:(f=on[e.size])!=null?f:on.md});default:return null}}catch(d){return null}}function ln(e,t,n,r){try{let s=new Set;for(let o of Array.from(e.children)){let c=o.getAttribute(Le);c!==null&&(t[c]===void 0?o.remove():s.add(c))}for(let[o,c]of Object.entries(t)){if(s.has(o))continue;let i=an(c,r);if(!i)continue;let a=r.createElement("div");a.setAttribute(Le,o),a.style.display="none",a.appendChild(i),e.appendChild(a)}let l=n!==void 0&&t[n]!==void 0;for(let o of Array.from(e.children)){let c=o.getAttribute(Le),i=o;c!==null?i.style.display=l&&c===n?"":"none":l?i.hasAttribute(ce)||(i.setAttribute(ce,i.style.display),i.style.display="none"):i.hasAttribute(ce)&&(i.style.display=i.getAttribute(ce),i.removeAttribute(ce))}}catch(s){}}function qr(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(Le)!==null){n.remove();continue}n.hasAttribute(ce)&&(n.style.display=n.getAttribute(ce),n.removeAttribute(ce))}}catch(t){}}function qe(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${Le}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${ce}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||qr(r)}catch(n){}}function He(e,t,n){n.documentElement.setAttribute("data-sentient-persona",e),n.documentElement.setAttribute("data-sentient-confidence",t)}function We(e,t,n){var r;for(let[s,l]of Object.entries(t)){let o=e[s];if(!o||typeof o=="string")continue;let c=l.target?Array.from(n.querySelectorAll(l.target)):[n.documentElement];for(let i of c)for(let[a,u]of Object.entries(o))(r=l.dims[a])!=null&&r.includes(u)&&i.setAttribute(`data-${a}`,u)}}function Fe(e,t,n){for(let[r,s]of Object.entries(t)){let l=e[r];if(typeof l!="string"||!s.arms||!s.arms.includes(l))continue;let o=s.target?Array.from(n.querySelectorAll(s.target)):[n.documentElement];for(let c of o)c.setAttribute("data-sentient-arm",l)}}function Ve(e,t,n,r){var c,i;let s=new Set,l=(c=r==null?void 0:r.contentAndOps)!=null?c:!0,o=[];for(let[a,u]of Object.entries(t)){if(Yt(u.locator,n))continue;let f;if(u.locator){let g=de(u.locator,n);f=g?[g]:[]}else u.target?f=Array.from(n.querySelectorAll(u.target)):f=[n.documentElement];(u.locator||u.target)&&f.length===0&&o.push(a);let d=e[a];for(let g of f){if(d!==void 0)if(typeof d=="string")g.setAttribute("data-sentient-arm",d),l&&((i=r==null?void 0:r.onApplied)==null||i.call(r,a,d,g));else for(let[A,L]of Object.entries(d))g.setAttribute(`data-${A}`,L);u.blocks&&!Wr(n)&&(ln(g,u.blocks,typeof d=="string"?d:void 0,n),s.add(g)),l&&(typeof u.content=="string"&&(g.textContent=u.content),u.ops&&tn(g,u.ops,a,n).anchorMiss&&!o.includes(a)&&o.push(a))}}return qe(n,s),o}var Hr=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function Wr(e){var t,n,r;try{let s=(n=(t=e.defaultView)!=null?t:typeof window!="undefined"?window:void 0)==null?void 0:n.navigator;return s?s.webdriver===!0?!0:Hr.test((r=s.userAgent)!=null?r:""):!1}catch(s){return!1}}var Fr=800;function Je(e,t,n){let r=[];return n.forEach(({slotId:s,arm:l,el:o},c)=>{r.push(Ce((d,g={})=>{try{e.track({projectId:t,componentId:s,variantId:l,eventType:"micro_signal",payload:Y({signalType:d},g)})}catch(A){}},o,void 0,{tabLoss:c===0}));let i=null,a=0,u=()=>{a=Date.now(),i=setTimeout(()=>{try{e.track({projectId:t,componentId:s,variantId:l,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-a}})}catch(d){}i=null},Fr)},f=()=>{i!==null&&(clearTimeout(i),i=null)};o.addEventListener("mouseenter",u),o.addEventListener("mouseleave",f),r.push(()=>{o.removeEventListener("mouseenter",u),o.removeEventListener("mouseleave",f),i!==null&&clearTimeout(i)})}),()=>{for(let s of r)s()}}function Vr(e){var n,r,s;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(s=t==null?void 0:t.pathname)!=null?s:""}function Jr(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 Yr(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}function Xr(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function Zr(e,t){try{let n=e==null?void 0:e.sessionStorage.getItem(t);if(!n)return new Set;let r=JSON.parse(n);return Array.isArray(r)?new Set(r.filter(s=>typeof s=="string")):new Set}catch(n){return new Set}}function Qr(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function cn(e,t,n,r){var w,k;let s=(w=n.defaultView)!=null?w:typeof window!="undefined"?window:null,l=Yr(r),o=Zr(s,l),c=h=>{let b=Xr(h);if(!o.has(b))try{h.slotId?t.componentGoal(h.slotId,h.goalId):t.goal(h.goalId),o.add(b),Qr(s,l,o)}catch(I){}},i=e.filter(h=>h.event==="click"),a=e.filter(h=>h.event==="form_submit"),u=e.filter(h=>h.event==="url_reached"),f=e.filter(h=>h.event==="scroll_depth"),d=(h,b)=>{if(!h.locator)return!1;let I=de(h.locator,n);return!!I&&(I===b||I.contains(b))},g=h=>{let b=h.target;if(!(!b||typeof b.closest!="function"))for(let I of i)d(I,b)&&c(I)},A=h=>{let b=h.target;if(b)for(let I of a)d(I,b)&&c(I)},L=()=>{if(u.length===0)return;let h=Vr(n);for(let b of u)b.urlPattern&&Jr(b.urlPattern,h)&&c(b)},x=()=>{var I;let h=n.documentElement,b=h.scrollHeight>0?(h.scrollTop+h.clientHeight)/h.scrollHeight:0;for(let M of f)b>=((I=M.threshold)!=null?I:.75)&&c(M);f.every(M=>o.has(M.goalId))&&n.removeEventListener("scroll",x)};return n.addEventListener("click",g,!0),n.addEventListener("submit",A,!0),(k=n.defaultView)==null||k.addEventListener("popstate",L),L(),f.length>0&&(n.addEventListener("scroll",x,{passive:!0}),x()),{checkUrl:L,teardown:()=>{var h;n.removeEventListener("click",g,!0),n.removeEventListener("submit",A,!0),(h=n.defaultView)==null||h.removeEventListener("popstate",L),f.length>0&&n.removeEventListener("scroll",x)}}}var un="__snt_editor_token";function dn(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(un):null}catch(e){return null}}function fn(e){try{sessionStorage.setItem(un,e)}catch(t){}}var lt="0.17.1",wn=5e3,eo=50,to=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),z=null,$=null,ue={},pe=null,te=null,U=null,ie=null,B=null,ye=null,pn=!1,at=null,Ye=null,Xe=null,Re=!1,Ze=!1;function Sn(e,t){return Promise.race([e,new Promise(n=>setTimeout(()=>n(null),t))])}function Se(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Ae(e,t){return z?(z.personaAttributes&&B&&He(B.persona,B.band,e),We(ue,z.slots,e),Fe(ue,z.slots,e),pe?Ve(ue,pe,e,t):(qe(e,new Set),[])):[]}function An(e){var n;let t=new Map;for(let r of(n=z==null?void 0:z.sections)!=null?n:[])try{let s=e.querySelectorAll(r);s.length===1&&t.set(r,s[0])}catch(s){}return t}function ct(e,t){try{if(!e||e.length<2||new Set(e).size!==e.length)return;let n=An(t);if(n.size!==e.length)return;let r=[];for(let o of e){let c=n.get(o);if(!c)return;r.push(c)}let s=r[0].parentNode;if(!s||!r.every(o=>o.parentNode===s))return;let l=r.slice().sort((o,c)=>o.compareDocumentPosition(c)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1);for(let o=0;o<r.length;o++){let c=r[o];l[o]!==c&&(s.insertBefore(c,l[o]),l.splice(l.indexOf(c),1),l.splice(o,0,c))}}catch(n){}}function no(e,t){var n;if(t.length!==0)try{let r=(n=e.apiBase)!=null?n:"https://api.sentient-ui.com";fetch(`${r}/v1/locator-miss`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify({slots:t})}).catch(()=>{})}catch(r){}}function Pe(){return!!(z&&$&&z.sectionCapture!==!1&&(z.consent!==!1||Ze)&&!he())}function ro(){if(!$||!z||!Pe()||ie)return;let e=[];Ae(document,{contentAndOps:Re,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),dt();try{U==null||U(),U=Je($,z.apiKey,e)}catch(t){}}function dt(){if(typeof document=="undefined"||!Pe())return;let e;try{if(Ye&&Ye.length>0){let t=new Map;for(let n of Ye){if(n.urlMatch!==window.location.pathname)continue;let r=de(n.locator,document);r&&t.set(r,n.type)}t.size>0&&(e=n=>{var r;return(r=t.get(n))!=null?r:null})}}catch(t){}try{ie=Vt($,Y({apiKey:z.apiKey,apiBase:z.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{})),Xe=window.location.pathname}catch(t){}}function ft(){try{let e=[];if(U==null||U(),U=null,Ae(document,{contentAndOps:Re,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),ct(ye,document),e.length>0&&Pe())try{U=Je($,z.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Xe!==null&&window.location.pathname!==Xe&&Pe()&&(ie==null||ie(),ie=null,dt())}catch(t){}}catch(e){}}function gn(){at===null&&(at=setTimeout(()=>{at=null,ft();try{te==null||te.checkUrl()}catch(e){}},eo))}function mn(){if(!(pn||typeof window=="undefined"||typeof history=="undefined")){pn=!0;try{let e=t=>{let n=history[t];history[t]=function(r,s,l){let o=n.call(this,r,s,l!=null?l:null);return gn(),o}};e("pushState"),e("replaceState"),window.addEventListener("popstate",gn)}catch(e){}}}function ut(e){let t={};for(let[n,r]of Object.entries(e.slots))t[n]=r.target?document.querySelectorAll(r.target).length:1;return t}function xn(e){return new URLSearchParams(e).get("sentient_editor")}function oo(){try{let t=Array.from(document.getElementsByTagName("script")).find(n=>/snippet(\.global)?\.js/.test(n.src));if(t!=null&&t.src)return t.src.replace(/snippet(\.global)?\.js/,"editor.global.js")}catch(e){}return null}function io(e,t){var n,r,s,l;try{window.__sentientEditor={token:t,apiBase:(n=e.apiBase)!=null?n:"https://api.sentient-ui.com"};try{let i=document.createElement("meta");i.name="referrer",i.content="no-referrer",i.setAttribute("data-sentient-editor",""),((r=document.head)!=null?r:document.documentElement).appendChild(i)}catch(i){}let o=(s=e.editorSrc)!=null?s:oo();if(!o){yn();return}let c=document.createElement("script");c.src=o,c.async=!0,c.onerror=()=>yn(),((l=document.head)!=null?l:document.documentElement).appendChild(c)}catch(o){}}var hn="sentient-editor-load-notice";function yn(){var e;try{if(typeof document=="undefined"||document.getElementById(hn))return;let t=document.createElement("div");t.id=hn,t.textContent="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.",Object.assign(t.style,{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",maxWidth:"320px",padding:"14px 16px",borderRadius:"14px",background:"#111827",color:"#fff",font:"13px/1.45 system-ui, sans-serif",border:"1px solid rgba(245,158,11,0.6)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",cursor:"pointer"}),t.addEventListener("click",()=>t.remove()),((e=document.body)!=null?e:document.documentElement).appendChild(t),setTimeout(()=>t.remove(),1e4)}catch(t){}}function En(e){let t=new URLSearchParams(e).get("sentient_preview");if(!t)return null;let n={};for(let r of t.split("|")){let s=r.indexOf(":"),l=s===-1?"":r.slice(0,s),o=s===-1?"":r.slice(s+1);if(!(!l||!o))if(o.includes("=")){let c={};for(let i of o.split(",")){let[a,u]=i.split("=");a&&u&&(c[a]=u)}Object.keys(c).length&&(n[l]=c)}else n[l]=o}return Object.keys(n).length?n:null}function kn(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var vn="sentient-persona-preview-banner";function bn(e,t){var n;try{if(typeof document=="undefined"||document.getElementById(vn))return;let r=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),s=document.createElement("div");s.id=vn,s.setAttribute("role","status"),Object.assign(s.style,{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"12px",padding:"10px 14px",borderRadius:"999px",background:"#111827",color:"#fff",font:"13px/1 system-ui, sans-serif",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",border:"1px solid rgba(255,255,255,0.14)"});let l=document.createElement("span");l.textContent=t?`\u201C${e}\u201D isn\u2019t in your personas \u2014 showing the default experience`:`Previewing as ${r}`;let o=document.createElement("button");o.type="button",o.textContent="Exit preview",Object.assign(o.style,{cursor:"pointer",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"inherit",padding:"4px 10px",borderRadius:"999px"}),o.addEventListener("click",()=>{try{let c=new URL(window.location.href);c.searchParams.delete("sentient_persona"),window.location.href=c.pathname+c.search+c.hash}catch(c){}}),s.appendChild(l),s.appendChild(o),((n=document.body)!=null?n:document.documentElement).appendChild(s)}catch(r){}}async function so(e,t){var a,u,f,d,g,A,L,x,w,k;let n=(a=e.apiBase)!=null?a:"https://api.sentient-ui.com",s=((u=e.registry)!=null?u:Object.keys(e.slots).length===0)?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(e.slots).map(([h,b])=>({id:h,dims:b.dims}))},l=await Sn(fetch(`${n}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify(s)}).then(h=>h.ok?h.json():null).catch(()=>null),wn);if(!l){Se(e,"persona preview: explain unavailable \u2014 page left as-is");return}let o=l;ue=(f=o.slots)!=null?f:{},pe=(d=o.slotConfig)!=null?d:null,Te(o.palette);let c=(L=(A=(g=o.personaAttributes)==null?void 0:g.persona)!=null?A:o.persona)!=null?L:t,i=(w=(x=o.personaAttributes)==null?void 0:x.confidence)!=null?w:"high";B={persona:c,band:i},Ae(document),Re=!0,In(e),o.recognized===!1?bn(t,!0):bn((k=o.personaDisplay)!=null?k:c)}function In(e){let t={goal(n,r){try{$==null||$.goal(n,r)}catch(s){}},componentGoal(n,r){try{$==null||$.componentGoal(n,r)}catch(s){}},grantConsent(){try{it(e.apiKey)}catch(n){}Ze=!0;try{ro()}catch(n){}},revokeConsent(){try{ie==null||ie(),ie=null,Xe=null,U==null||U(),U=null,te==null||te.teardown(),te=null,Ze=!1,$==null||$.destroy()}catch(n){}},reapply:ft,getState(){var n,r;return{apiKey:e.apiKey,persona:(n=B==null?void 0:B.persona)!=null?n:null,band:(r=B==null?void 0:B.band)!=null?r:null,slots:ue,matchCounts:ut(e),consent:e.consent!==!1}}};window.SentientSnippet=t;for(let n of to.splice(0))try{n[0]==="goal"&&t.goal(n[1],n[2])}catch(r){}}async function _n(){var e,t,n,r,s,l;try{let o=ze(window.sentient);if(!o)return;z=o,Re=!1,ye=null,Te(null),Ze=!1;let c=typeof window!="undefined"?xn(window.location.search):null;if(c){fn(c);try{let b=new URL(window.location.href);b.searchParams.delete("sentient_editor"),window.history.replaceState(null,"",b.pathname+b.search+b.hash)}catch(b){}}let i=c!=null?c:dn();if(i){io(o,i),Se(o,"editor mode");return}let a=typeof window!="undefined"?En(window.location.search):null;if(a){ue=a,B=null,Ae(document),mn(),Se(o,"preview mode",a);return}let u=typeof window!="undefined"?kn(window.location.search):null;if(u){await so(o,u),Se(o,"persona preview",u);return}let f=(e=o.registry)!=null?e:Object.keys(o.slots).length===0,d=Ue(o.apiKey);d&&(B={persona:d.persona,band:d.band},ue=d.slots,d.slotConfig&&(pe=d.slotConfig),d.palette&&Te(d.palette),Ae(document,{contentAndOps:!1}),d.layoutOrder&&(ye=d.layoutOrder,ct(ye,document)));let g=Ge({apiKey:o.apiKey,context:o.context,consent:o.consent,preConsentBehavior:o.preConsentBehavior,debug:o.debug,persona:o.persona});$=g,In(o),mn();let A=Object.entries(o.slots).map(([b,I])=>({id:b,dims:I.dims})),L=lt!=="0.0.0-dev"?{v:lt}:{},x=Array.from(An(document).keys()),w=await Sn(g.decide(Y(Y(Y({slots:A},L),x.length>=2?{sections:x}:{}),f?{slotsFrom:"registry"}:{})),wn);if(!w){Se(o,"decide timeout/null \u2014 snapshot state stands",ut(o));return}let k=g.getPersona();k?B={persona:k.persona,band:k.band}:w.persona&&(B={persona:w.persona,band:"low"}),ue=w.slots,f?pe=(t=w.slotConfig)!=null?t:null:w.slotConfig&&(pe=w.slotConfig),w.palette&&Te(w.palette);let h=[];if(no(o,Ae(document,{onApplied:(b,I,M)=>h.push({slotId:b,arm:I,el:M})})),ye=(n=w.layoutOrder)!=null?n:ye,ct(ye,document),Re=!0,w.goals&&w.goals.length>0&&o.consent!==!1&&$)try{te==null||te.teardown(),te=cn(w.goals,$,document,o.apiKey)}catch(b){}if(Ye=(r=w.sectionMap)!=null?r:null,Pe()){dt();try{U==null||U(),U=Je($,o.apiKey,h)}catch(b){}}Se(o,"applied",{persona:B,slots:ue,matches:ut(o)}),Oe(o.apiKey,Y(Y({v:1,persona:(s=B==null?void 0:B.persona)!=null?s:w.persona,band:(l=B==null?void 0:B.band)!=null?l:"low",slots:w.slots,layoutOrder:w.layoutOrder,savedAt:Date.now()},pe?{slotConfig:pe}:{}),w.palette?{palette:w.palette}:{}))}catch(o){}}if(typeof window!="undefined"&&window.sentient){let e=window;e.__sentientInitialized||(e.__sentientInitialized=!0,_n())}return Pn(ao);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentientui/snippet",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "SentientUI Style-rung snippet for non-React sites — persona attributes and adaptive style tokens from one script tag",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"tsx": "^4.19.2",
|
|
25
25
|
"typescript": "^5.7.2",
|
|
26
26
|
"vitest": "^2.1.8",
|
|
27
|
-
"@sentientui/core": "0.21.
|
|
27
|
+
"@sentientui/core": "0.21.2"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsup",
|