@sentientui/snippet 0.3.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -5
- package/dist/editor.global.js +1 -1
- package/dist/snippet.global.js +2 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -17,16 +17,17 @@ page is left exactly as it was.
|
|
|
17
17
|
};
|
|
18
18
|
</script>
|
|
19
19
|
<script
|
|
20
|
-
src="https://unpkg.com/@sentientui/snippet@0.
|
|
20
|
+
src="https://unpkg.com/@sentientui/snippet@0.5.0/dist/snippet.global.js"
|
|
21
21
|
defer
|
|
22
22
|
crossorigin="anonymous"
|
|
23
|
-
integrity="sha384-REPLACE_WITH_RELEASE_HASH"
|
|
24
23
|
></script>
|
|
25
24
|
```
|
|
26
25
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
26
|
+
The version above is pinned to the current published release. To lock the file down, add your
|
|
27
|
+
own Subresource Integrity hash computed from the published file
|
|
28
|
+
(`openssl dgst -sha384 -binary dist/snippet.global.js | openssl base64 -A`) as an `integrity="sha384-…"`
|
|
29
|
+
attribute, or self-host the file and skip the CDN entirely. Do **not** ship a placeholder
|
|
30
|
+
`integrity` value — a hash that doesn't match makes the browser refuse to run the script.
|
|
30
31
|
|
|
31
32
|
```css
|
|
32
33
|
#hero[data-tone='urgent'] .cta { font-weight: 700; }
|
|
@@ -35,4 +36,10 @@ html[data-sentient-persona='deal_seeker'] .discount-banner { display: block; }
|
|
|
35
36
|
|
|
36
37
|
The first value of each dim is your baseline (what you show today). Decisions are locked per
|
|
37
38
|
session and learned per visitor type on the SentientUI API: Visit 1 learns, Visit 2 converts.
|
|
39
|
+
|
|
40
|
+
The snippet also captures per-section attention (visible time + scroll depth) and behavioral
|
|
41
|
+
signals by default — that's what builds audience profiles with zero tagging. Add
|
|
42
|
+
`sectionCapture: false` to `window.sentient` to turn it off; it never runs for a Do-Not-Track,
|
|
43
|
+
Global Privacy Control, or consent-gated visitor.
|
|
44
|
+
|
|
38
45
|
Bundle ≤ 15 KB gzip. MIT.
|
package/dist/editor.global.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var SentientSnippet=(()=>{var
|
|
1
|
+
"use strict";var SentientSnippet=(()=>{var $=Object.defineProperty,Z=Object.defineProperties,Q=Object.getOwnPropertyDescriptor,Y=Object.getOwnPropertyDescriptors,tt=Object.getOwnPropertyNames,z=Object.getOwnPropertySymbols;var W=Object.prototype.hasOwnProperty,et=Object.prototype.propertyIsEnumerable;var G=(t,e,n)=>e in t?$(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,I=(t,e)=>{for(var n in e||(e={}))W.call(e,n)&&G(t,n,e[n]);if(z)for(var n of z(e))et.call(e,n)&&G(t,n,e[n]);return t},F=(t,e)=>Z(t,Y(e));var nt=(t,e)=>{for(var n in e)$(t,n,{get:e[n],enumerable:!0})},ot=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of tt(e))!W.call(t,i)&&i!==n&&$(t,i,{get:()=>e[i],enumerable:!(o=Q(e,i))||o.enumerable});return t};var rt=t=>ot($({},"__esModule",{value:!0}),t);var gt={};nt(gt,{clearTargetHighlights:()=>D,drawTargetHighlights:()=>V});function it(t){var n,o,i;let e=(o=(n=t.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:o.location;return(i=e==null?void 0:e.pathname)!=null?i:""}function at(t,e){var n;if(e.tag&&t.tagName.toLowerCase()!==e.tag.toLowerCase())return!1;if(e.text){let o=((n=t.textContent)!=null?n:"").trim().toLowerCase(),i=e.text.trim().toLowerCase();if(!(o===i||o.startsWith(i)||i.startsWith(o)))return!1}return!0}function H(t,e){var i;if(t.urlMatch&&!it(e).includes(t.urlMatch))return null;let n=[];if(t.id){let s=e.getElementById(t.id);n=s?[s]:[]}if(n.length===0&&((i=t.dataAttr)!=null&&i.name))try{let s=t.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(e.querySelectorAll(`[${t.dataAttr.name}="${s}"]`))}catch(s){n=[]}if(n.length===0&&t.selector)try{n=Array.from(e.querySelectorAll(t.selector))}catch(s){n=[]}if(n.length!==1)return null;let o=n[0];return t.fingerprint&&!at(o,t.fingerprint)?null:o}function J(t){let e=globalThis;return e.CSS&&typeof e.CSS.escape=="function"?e.CSS.escape(t):t.replace(/[^a-zA-Z0-9_-]/g,n=>`\\${n}`)}function st(t,e){if(t.id)return`#${J(t.id)}`;let n=[],o=t,i=0;for(;o&&o!==e.body&&o!==e.documentElement&&i<6;){if(o.id){n.unshift(`#${J(o.id)}`);break}let s=o.tagName.toLowerCase(),d=o.parentElement;if(d){let u=Array.from(d.children).filter(h=>h.tagName===o.tagName);u.length>1&&(s+=`:nth-of-type(${u.indexOf(o)+1})`)}n.unshift(s),o=o.parentElement,i++}return n.join(" > ")}function N(t,e){var i;let n={v:1};t.id&&(n.id=t.id);for(let s of["data-framer-name","data-w-id","data-sentient-name"]){let d=t.getAttribute(s);if(d){n.dataAttr={name:s,value:d};break}}n.selector=st(t,e);let o=((i=t.textContent)!=null?i:"").trim().replace(/\s+/g," ").slice(0,80);return n.fingerprint=I({tag:t.tagName.toLowerCase()},o?{text:o}:{}),n}function P(t,e,n){return H(t,n)===e}var lt="sentient-editor-highlight",K="sentient-editor-panel",U="sentient-editor-target-highlight",ct=10;function dt(){let t=window.__sentientEditor;return t&&typeof t.token=="string"&&typeof t.apiBase=="string"?t:null}async function ut(t){var e;try{let n=await fetch(`${t.apiBase}/v1/editor/verify`,{headers:{authorization:`Bearer ${t.token}`}});return n.ok&&(e=(await n.json()).projectId)!=null?e:null}catch(n){return null}}async function _(t,e,n){try{return(await fetch(`${t.apiBase}${e}`,{method:"POST",headers:{authorization:`Bearer ${t.token}`,"content-type":"application/json"},body:JSON.stringify(n)})).ok}catch(o){return!1}}async function pt(t){try{let e=await fetch(`${t.apiBase}/v1/editor/targets`,{headers:{authorization:`Bearer ${t.token}`}});if(!e.ok)return[];let n=await e.json();return Array.isArray(n.targets)?n.targets:[]}catch(e){return[]}}function D(t=document){for(let e of Array.from(t.querySelectorAll(`.${U}`)))e.remove()}function V(t,e=document){D(e);let n=0;for(let o of t){if(n>=ct)break;let i=H(o.locator,e);if(!i)continue;let s=i.getBoundingClientRect(),d=c("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483645",left:`${s.left}px`,top:`${s.top}px`,width:`${s.width}px`,height:`${s.height}px`,border:"2px dashed #10b981",background:"rgba(16,185,129,0.08)"});d.className=U;let u=c("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483645",left:`${s.left}px`,top:`${Math.max(0,s.top-20)}px`,padding:"2px 6px",borderRadius:"4px",background:"#10b981",color:"#fff",font:"11px system-ui, sans-serif",whiteSpace:"nowrap"},o.label);u.className=U,e.body.append(d,u),n+=1}}function c(t,e,n){let o=document.createElement(t);return Object.assign(o.style,e),n!==void 0&&(o.textContent=n),o}function mt(t){let e=null,n=c("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483646",border:"2px solid #6366f1",background:"rgba(99,102,241,0.12)",display:"none"});n.id=lt;let o=c("div",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",width:"300px",padding:"14px",borderRadius:"12px",background:"#111827",color:"#fff",font:"13px/1.4 system-ui, sans-serif",boxShadow:"0 8px 30px rgba(0,0,0,0.4)"});o.id=K;let i=c("div",{fontWeight:"600",marginBottom:"6px"},"SentientUI editor"),s=c("div",{opacity:"0.7",marginBottom:"10px"},"Click any element on the page to adapt it."),d=c("div",{fontSize:"12px",marginBottom:"10px",minHeight:"16px"}),u=c("button",x("#6366f1"),"Test different text here"),h=c("button",x("#374151"),"Track clicks as a goal"),w=c("button",x("#374151"),"Move up"),L=c("button",x("#374151"),"Move down"),S=c("button",x("#6366f1"),"Save this arrangement"),k=c("button",x("#374151"),"Undo"),T=c("button",F(I({},x("transparent")),{opacity:"0.6"}),"Close editor");for(let r of[u,h,w,L,T])r.disabled=!0;S.style.display="none",k.style.display="none",o.append(i,s,d,u,h,w,L,S,k,T),document.body.append(n,o);let m=(r,a=!0)=>{d.textContent=r,d.style.color=a?"#a7f3d0":"#fca5a5"},g=null,A=!1,v=null,y=null,E=null,C=null,p=null,B=r=>{S.style.display=r?"block":"none",k.style.display=r?"block":"none",w.disabled=r||!A||!E,L.disabled=r||!A||!C},j=()=>{if(!p||!e){p=null,B(!1);return}p.origParent.insertBefore(e,p.origNext),p=null,B(!1)},O=r=>{let a=r.target;if(!a||o.contains(a)||a===n)return;D(document);let l=a.getBoundingClientRect();Object.assign(n.style,{display:"block",left:`${l.left}px`,top:`${l.top}px`,width:`${l.width}px`,height:`${l.height}px`})},R=r=>{let a=r.target;if(!a||o.contains(a))return;r.preventDefault(),r.stopPropagation(),j(),e=a,g=N(a,document);let l=P(g,a,document);A=l,m(l?"\u2713 Selected \u2014 matches exactly 1 element":"\u26A0 Couldn\u2019t target this element uniquely",l);for(let M of[u,h,T])M.disabled=!1;u.disabled=!l,h.disabled=!l,v=a.previousElementSibling,y=a.nextElementSibling;let f=v?N(v,document):null,b=y?N(y,document):null;E=v&&f&&P(f,v,document)?f:null,C=y&&b&&P(b,y,document)?b:null,w.disabled=!l||!E,L.disabled=!l||!C};u.onclick=async()=>{var b,M,q;if(!e||!g)return;let r=window.prompt("First wording (what you show today):",(M=(b=e.textContent)==null?void 0:b.trim())!=null?M:"");if(r===null)return;let a=window.prompt("Alternative wording to test:","");if(a===null)return;let l=((q=window.prompt("Name this slot:","hero-cta"))!=null?q:"hero-cta").trim()||"hero-cta";m("Saving\u2026");let f=await _(t,`/v1/editor/slots/${encodeURIComponent(l)}`,{kind:"arms",target:g,draftConfig:{arms:[{id:"a",displayName:"Original",ops:{text:r}},{id:"b",displayName:"Alternative",ops:{text:a}}]}});m(f?"\u2713 Saved as a draft \u2014 publish it from your dashboard.":"\u26A0 Couldn\u2019t save \u2014 try again.",f)},h.onclick=async()=>{var l;if(!e||!g)return;let r=((l=window.prompt("Name this goal:","demo_requested"))!=null?l:"").trim();if(!r)return;m("Saving\u2026");let a=await _(t,`/v1/editor/goals/${encodeURIComponent(r)}`,{event:"click",locator:g});m(a?"\u2713 Goal saved as a draft.":"\u26A0 Couldn\u2019t save \u2014 try again.",a)},w.onclick=()=>{if(!e||!v||!E)return;let r=e.parentElement;if(!r)return;let a=e.nextSibling;r.insertBefore(e,v),p={direction:"up",origParent:r,origNext:a,anchorLocator:E},B(!0),m("Previewing the new position \u2014 save it or undo.")},L.onclick=()=>{if(!e||!y||!C)return;let r=e.parentElement;if(!r)return;let a=e.nextSibling;r.insertBefore(e,y.nextSibling),p={direction:"down",origParent:r,origNext:a,anchorLocator:C},B(!0),m("Previewing the new position \u2014 save it or undo.")},k.onclick=()=>{j(),m("Move undone \u2014 back to the original position.")},S.onclick=async()=>{var f;if(!e||!g||!p||!A)return;let r=((f=window.prompt("Name this slot:","reorder-slot"))!=null?f:"reorder-slot").trim()||"reorder-slot";m("Saving\u2026");let a=p.direction==="up"?"moveBefore":"moveAfter",l=await _(t,`/v1/editor/slots/${encodeURIComponent(r)}`,{kind:"arms",target:g,draftConfig:{arms:[{id:"a",ops:{}},{id:"b",ops:{[a]:p.anchorLocator}}]}});l&&(p=null,B(!1)),m(l?"\u2713 Saved as a draft \u2014 publish it from your dashboard.":"\u26A0 Couldn\u2019t save \u2014 try again.",l)};let X=()=>{document.removeEventListener("mousemove",O,!0),document.removeEventListener("click",R,!0),D(document),n.remove(),o.remove()};T.onclick=X,document.addEventListener("mousemove",O,!0),document.addEventListener("click",R,!0)}function x(t){return{display:"block",width:"100%",marginTop:"8px",padding:"8px 10px",borderRadius:"8px",border:"none",background:t,color:"#fff",font:"13px system-ui, sans-serif",cursor:"pointer",textAlign:"left"}}async function ft(){if(typeof document=="undefined")return;let t=dt();if(!t||!await ut(t)||document.getElementById(K))return;mt(t);let n=await pt(t);V(n,document)}ft();return rt(gt);})();
|
package/dist/snippet.global.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var SentientSnippet=(()=>{var fe=Object.defineProperty;var Rt=Object.getOwnPropertyDescriptor;var Dt=Object.getOwnPropertyNames,He=Object.getOwnPropertySymbols;var Ye=Object.prototype.hasOwnProperty,Lt=Object.prototype.propertyIsEnumerable;var Fe=(e,t,n)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_e=(e,t)=>{for(var n in t||(t={}))Ye.call(t,n)&&Fe(e,n,t[n]);if(He)for(var n of He(t))Lt.call(t,n)&&Fe(e,n,t[n]);return e};var Xe=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ze=(e,t)=>{for(var n in t)fe(e,n,{get:t[n],enumerable:!0})},Tt=(e,t,n,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Dt(t))!Ye.call(e,r)&&r!==n&&fe(e,r,{get:()=>t[r],enumerable:!(o=Rt(t,r))||o.enumerable});return e};var Pt=e=>Tt(fe({},"__esModule",{value:!0}),e);var jt,Nt,$t,Qe,Mt,Ut,et,O,se,ae=Xe(()=>{"use strict";jt=Object.defineProperty,Nt=Object.defineProperties,$t=Object.getOwnPropertyDescriptors,Qe=Object.getOwnPropertySymbols,Mt=Object.prototype.hasOwnProperty,Ut=Object.prototype.propertyIsEnumerable,et=(e,t,n)=>t in e?jt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))Mt.call(t,n)&&et(e,n,t[n]);if(Qe)for(var n of Qe(t))Ut.call(t,n)&&et(e,n,t[n]);return e},se=(e,t)=>Nt(e,$t(t))});var it={};Ze(it,{LOCAL_ENGINE_AVAILABLE:()=>Kt,createLocalEngine:()=>Bt});function Bt(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var Kt,st=Xe(()=>{"use strict";ae();Kt=!1});var Pn={};Ze(Pn,{applyPersonaAttributes:()=>Ae,applyRegistrySlots:()=>Ce,applySlotArms:()=>Oe,applySlotAttributes:()=>Ie,parseEditorToken:()=>xt,parsePreview:()=>Et,parseSnippetConfig:()=>we,reapply:()=>Je,run:()=>_t,version:()=>Cn});ae();function pe(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function tt(e){if(e.length===0)return null;let t={};for(let n of e.split("|")){let o=n.indexOf("=");if(o<=0||o!==n.lastIndexOf("=")||o===n.length-1)return null;let r=n.slice(0,o);if(r in t)return null;t[r]=n.slice(o+1)}return t}function Re(e){var t,n,o;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 pe(e.baseline);if(typeof e.baseline=="string")return e.baseline;let r={};for(let[i,a]of Object.entries((n=e.dims)!=null?n:{}))r[i]=(o=a[0])!=null?o:"";return pe(r)}function nt(e,t){var n,o;return e.dims!=null?(o=(n=tt(t))!=null?n:tt(Re(e)))!=null?o:{}:t}function H(e){return e>=.3?e<.7?"medium":"high":"low"}var rt=["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 De(e){return ot(e)!==null}function ot(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=rt.find(o=>n.includes(o.toLowerCase())))!=null?t:null}function Le(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 Te(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(r){}let o=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(o)?"search":/(^|\.)(twitter|x\.com|facebook|linkedin|reddit|t\.co)/.test(o)?"social":"referral"}catch(n){return"direct"}}function Pe(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}function je(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function ge(e){return O(O(O({id:e.id},e.arms?{arms:[...e.arms]}:{}),e.dims?{dims:Object.fromEntries(Object.entries(e.dims).map(([t,n])=>[t,[...n]]))}:{}),e.baseline!==void 0?{baseline:e.baseline}:{})}function me(e){let t=ge(e);return nt(t,Re(t))}function Ne(e){return typeof e=="string"?e:pe(e)}ae();var Gt="_snt_uid",Q="_snt_uid";function qt(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(t){}let e=()=>Math.floor(Math.random()*4294967295).toString(16).padStart(8,"0");return`${e()}-${e()}-${e()}-${e()}`}function Wt(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Jt(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(o){}}function zt(e){try{return localStorage.getItem(e)}catch(t){return null}}function Vt(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Ht(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function Ft(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Yt(e){try{sessionStorage.removeItem(e)}catch(t){}}function Xt(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=strict; path=/`,/(?:^|; )_snt_uid_probe=1/.test(document.cookie)||document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function Zt(e){try{localStorage.removeItem(e)}catch(t){}}function Qt(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var en={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function ct(e){var t,n,o,r,i,a;if(typeof window=="undefined")return en;let l=(t=e==null?void 0:e.cookieName)!=null?t:Gt,s=((n=e==null?void 0:e.cookieTTLDays)!=null?n:365)*24*60*60,c=(a=(i=(r=(o=Wt(l))!=null?o:zt(Q))!=null?r:Ht(Q))!=null?i:e==null?void 0:e.ssrSessionId)!=null?a:qt();Jt(l,c,s);let p=Vt(Q,c),f=Xt(l),S=p?!1:Ft(Q,c),d=!p&&!f&&!S;return{getSessionId:()=>c,isEphemeral:()=>d,destroy:()=>{c=null,Qt(l),Zt(Q),Yt(Q)}}}function ut(e){return`_snt_retry_${e.slice(0,12)}`}var tn={push:()=>{},flush:()=>{},destroy:()=>{}};function nn(e,t){try{let n=localStorage.getItem(t);if(!n)return[];let o=JSON.parse(n);return Array.isArray(o)?(localStorage.removeItem(t),o.slice(-e)):[]}catch(n){return[]}}function $e(e,t,n){try{let o=[...(()=>{try{let r=localStorage.getItem(n);if(!r)return[];let i=JSON.parse(r);return Array.isArray(i)?i:[]}catch(r){return[]}})(),...e].slice(-t);localStorage.setItem(n,JSON.stringify(o))}catch(o){}}function rn(e){var t,n,o;if(typeof window=="undefined")return tn;let r=(t=e.flushIntervalMs)!=null?t:5e3,i=(n=e.maxBatchSize)!=null?n:20,a=(o=e.maxRetrySize)!=null?o:100,l=e.ingestUrl,s=e.apiKey,c=ut(s),p=[],f=new Set,S=[],d=m=>{for(let w of m)h.delete(w),!f.has(w)&&(f.add(w),S.push(w));for(;S.length>500;){let w=S.shift();w&&f.delete(w)}},h=new Set,b=m=>{f.has(m.id)||h.has(m.id)||(h.add(m.id),p.push(m))},N=nn(a,c);for(let m of N)b(m);let R=0,y=0,v=m=>{if(m.length===0)return;let w=JSON.stringify(m),C=m.map(u=>u.id),M;try{M=fetch(l,{method:"POST",keepalive:!0,body:w,headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})}catch(u){$e(m,a,c);for(let g of C)h.delete(g);y++,R=Date.now()+Math.min(6e4,1e3*2**Math.min(y,6));return}let q=u=>{if(u.ok||u.status>=400&&u.status<500&&u.status!==429){d(C),y=0,R=0;return}$e(m,a,c);for(let g of C)h.delete(g);y++,R=Date.now()+Math.min(6e4,1e3*2**Math.min(y,6))};M instanceof Promise?M.then(q).catch(()=>{$e(m,a,c);for(let u of C)h.delete(u);y++,R=Date.now()+Math.min(6e4,1e3*2**Math.min(y,6))}):q(M)},k=typeof TextEncoder!="undefined"?new TextEncoder:null,D=m=>k?k.encode(m).length:m.length,de=m=>{let w=[],C=2;for(let M of m){let q=D(JSON.stringify(M))+1;if(w.length>0&&C+q>57344||w.length>=i)break;w.push(M),C+=q}return w},x=()=>{try{if(Date.now()<R)return;for(;p.length>0;){let m=p.filter(C=>!f.has(C.id));if(p.length=0,m.length===0)break;let w=de(m);if(w.length===0)break;w.length<m.length&&p.push(...m.slice(w.length)),v(w)}}catch(m){}},X=!0,L=null;L=setInterval(()=>{X&&x()},r);let E=()=>{document.visibilityState==="hidden"&&x()},ne=()=>{x()};return document.addEventListener("visibilitychange",E),window.addEventListener("beforeunload",ne),{push(m){b(m),p.length>=i&&x()},flush:x,destroy(){X=!1,L!==null&&(clearInterval(L),L=null),document.removeEventListener("visibilitychange",E),window.removeEventListener("beforeunload",ne),x()}}}var Be="_snt_asgn_";function ye(e,t){return`${e}:${t}`}function on(e,t){return`${Be}${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function at(e){let t=e.slice(Be.length),n=t.indexOf(":");if(n<0)return null;try{return{componentId:decodeURIComponent(t.slice(0,n)),segment:decodeURIComponent(t.slice(n+1))}}catch(o){return null}}function Me(){try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n!=null&&n.startsWith(Be)&&e.push(n)}return e}catch(e){return[]}}function sn(e=18e5){let t=new Map,n=o=>o.assignedAt+e<Date.now();return typeof window!="undefined"&&(()=>{for(let o of Me())try{let r=localStorage.getItem(o);if(!r)continue;let i=JSON.parse(r);if(n(i)){localStorage.removeItem(o);continue}let a=at(o);if(!a)continue;t.set(ye(a.componentId,a.segment),i)}catch(r){}})(),{get(o,r){let i=t.get(ye(o,r));return i?n(i)?(t.delete(ye(o,r)),null):i:null},set(o,r,i){let a=ye(o,r);t.set(a,i);try{localStorage.setItem(on(o,r),JSON.stringify(i))}catch(l){}},invalidate(o){let r=`${o}:`;for(let i of[...t.keys()])i.startsWith(r)&&t.delete(i);for(let i of Me()){let a=at(i);if((a==null?void 0:a.componentId)===o)try{localStorage.removeItem(i)}catch(l){}}},clear(){t.clear();for(let o of Me())try{localStorage.removeItem(o)}catch(r){}}}}var ve="_snt_snap:",an=["low","medium","high"];function be(e){try{let t=localStorage.getItem(ve+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"||!an.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 le(e,t){try{localStorage.setItem(ve+e,JSON.stringify(t))}catch(n){}}var Ke="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",dt="[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,he=!1;function ln(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function cn(e){var t;let n=ct({ssrSessionId:e.ssrSessionId}),o=(t=n.getSessionId())!=null?t:"local",r=ln(),i=Promise.resolve().then(()=>(st(),it)).then(s=>{let c=s;return c.LOCAL_ENGINE_AVAILABLE?(lt||(lt=!0,console.info(dt)),c):(he||(he=!0,console.error(Ke)),null)}).catch(()=>(he||(he=!0,console.error(Ke)),null)),a=null;function l(s){let c=document.documentElement;c.dataset.sentientPersona===void 0&&(c.dataset.sentientPersona=s.persona,c.dataset.sentientConfidence=H(s.confidence))}return{isLocal:!0,async decide(s){var c,p,f;let S=await i;if(!S)return null;let d=S.createLocalEngine({sessionId:o,forcedPersona:r}).decide(s);return a=se(O({},d),{layoutOrder:(p=(c=d.layoutOrder)!=null?c:a==null?void 0:a.layoutOrder)!=null?p:null,slots:O(O({},(f=a==null?void 0:a.slots)!=null?f:{}),d.slots)}),le(e.apiKey||"local",{v:1,persona:a.persona,band:H(a.confidence),slots:a.slots,layoutOrder:a.layoutOrder,savedAt:Date.now()}),l(d),d},getSlotResult(s){var c,p,f;return(f=(p=a==null?void 0:a.slots[s])!=null?p:(c=e.initialSlots)==null?void 0:c[s])!=null?f:null},getPersona(){return a?{persona:a.persona,confidence:a.confidence,band:H(a.confidence)}:null},async assign(s,c){var p;let f=await i;return!f||!c||c.length===0?c!=null&&c[0]?{variantId:c[0],assignmentTtlMs:0}:null:{variantId:(p=f.createLocalEngine({sessionId:o,forcedPersona:r}).decide({components:[{id:s,variantIds:c}]}).assignments[s])!=null?p:c[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>n.destroy()}}var ft="https://api.sentient-ui.com/v1/events",F=new Map,pt=null;function Ue(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var ee={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 un(){try{let e={},t=new URLSearchParams(window.location.search);for(let[n,o]of t)n.startsWith("utm_")&&(e[n]=o);return e}catch(e){return{}}}function gt(e){return e.replace(/\/events\/?$/,"")}function ce(){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 Ge(e){if(typeof window=="undefined")return;let t=e!=null?e:pt;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=F.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:o,upgrade:r}=n;if(!r||o.respectDoNotTrack!==!1&&ce())return;let i=Se(se(O({},o),{consent:!0}));r(i),F.set(t,{config:se(O({},o),{consent:!0}),upgrade:null})}function dn(e){var t;let n=gt((t=e.ingestUrl)!=null?t:ft),o={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},r={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),async assign(l,s,c){try{let p=new URLSearchParams({componentId:l});for(let S of s!=null?s:[])p.append("variantIds[]",S);let f=await fetch(`${n}/winner?${p.toString()}`,{headers:o});return f.ok?{variantId:(await f.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:()=>{}},i={track:l=>r.track(l),goal:(l,s,c,p)=>r.goal(l,s,c,p),componentGoal:(l,s,c)=>r.componentGoal(l,s,c),identify:l=>r.identify(l),getAssignment:(l,s)=>r.getAssignment(l,s),assign:(l,s,c,p)=>r.assign(l,s,c,p),decide:l=>r.decide(l),getSlotResult:l=>r.getSlotResult(l),getPersona:()=>r.getPersona(),fetchWeights:()=>r.fetchWeights(),getGraph:()=>r.getGraph(),dispose:()=>r.dispose(),destroy:()=>r.destroy()};function a(l){r=l}return{proxy:i,setInner:a}}function Se(e){var t,n,o,r,i,a,l,s,c;if(typeof window=="undefined")return ee;pt=e.apiKey;let p=e.respectDoNotTrack!==!1&&ce(),f=e.consent===!1||p,S=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!S&&e.localMode!==!1)return f?(F.set(e.apiKey||"local",{config:e,upgrade:null}),ee):(F.set(e.apiKey||"local",{config:e,upgrade:null}),cn(e));if(f){if(e.preConsentBehavior==="statistical_winner"){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."),ee;let{proxy:u,setInner:g}=dn(e);return F.set(e.apiKey,{config:e,upgrade:p?null:g}),u}return F.set(e.apiKey,{config:e,upgrade:null}),ee}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."),ee;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),ee;let d=(t=e.ingestUrl)!=null?t:ft,h=Date.now(),b=ct({ssrSessionId:e.ssrSessionId}),N=sn(),R=rn({ingestUrl:d,apiKey:e.apiKey}),y=gt(d),v={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},k=Le((n=navigator.userAgent)!=null?n:""),D=typeof window!="undefined"?window.location.origin:void 0,de=Te((o=document.referrer)!=null?o:"",D),x=(r=e.sessionSegment)!=null?r:`${k}:${de}`,X=new Map,L=new Map,E=null,ne=u=>{for(let g of u)L.has(g.id)||L.set(g.id,me(g))};if(e.initialSlots)for(let[u,g]of Object.entries(e.initialSlots))L.set(u,g);let m=be(e.apiKey);if(m)for(let[u,g]of Object.entries(m.slots))L.has(u)||L.set(u,g);let w={low:.15,medium:.5,high:.85};if(e.initialPersona)E=O({},e.initialPersona);else{let u=document.documentElement.dataset;u.sentientPersona?E={persona:u.sentientPersona,confidence:(a=w[(i=u.sentientConfidence)!=null?i:"low"])!=null?a:.15}:m&&(E={persona:m.persona,confidence:(l=w[m.band])!=null?l:.15})}if(e.initialAssignments)for(let[u,g]of Object.entries(e.initialAssignments))N.set(u,x,{variantId:g,assignedAt:Date.now(),segment:x,confidence:1});let C=Promise.resolve(),M=b.getSessionId();if(M){let u=Pe((s=document.referrer)!=null?s:""),g=O(O({sessionId:M,deviceClass:k,trafficSource:de,referrerDomain:u,utmParams:un(),timeOfDay:je(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:b.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||De((c=navigator.userAgent)!=null?c:"")},e.userId?{userId:e.userId}:{}),e.country?{country:e.country}:{});try{C=fetch(`${y}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(g),headers:v}).then(I=>{I.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(I){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:R});let q={goal(u,g={},I=1,U=0){let $=b.getSessionId();if(!$)return;let P=Ue();C.then(()=>{fetch(`${y}/goals`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:$,name:u,metadata:g,weight:I,stepIndex:U,goalId:P}),headers:v}).catch(()=>{})})},componentGoal(u,g,I){var U,$,P;let W=b.getSessionId();if(!W)return;let K=N.get(u,x),B=K?null:(U=L.get(u))!=null?U:null;if(!K&&B===null){e.debug&&console.warn(`[sentient] componentGoal("${u}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}let V=K?K.variantId:Ne(B),G={id:Ue(),sessionId:W,projectId:e.apiKey,componentId:u,variantId:V,eventType:"goal_achieved",goalType:g,payload:O({reward:($=I==null?void 0:I.reward)!=null?$:1},(P=I==null?void 0:I.metadata)!=null?P:{}),timestamp:Date.now(),timeInSession:Date.now()-h};e.debug&&console.log("[sentient] componentGoal",G),C.then(()=>R.push(G))},identify(u){let g=b.getSessionId();g&&C.then(()=>{fetch(`${y}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:g,userId:u,ephemeral:b.isEphemeral()}),headers:v}).catch(()=>{})})},track(u){let g=b.getSessionId();if(!g)return;let I=se(O({},u),{id:Ue(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-h});e.debug&&console.log("[sentient] track",I),C.then(()=>R.push(I))},getAssignment(u,g){return N.get(u,g)},async assign(u,g,I,U){let $=b.getSessionId();if(!$)return null;let P=N.get(u,x);if(P&&(g!=null&&g.length||P.content!==void 0))return{variantId:P.variantId,assignmentTtlMs:0,content:P.content};let W=X.get(u);if(W)return W;let K=(async()=>{await C;try{let B={sessionId:$,componentId:u,variantIds:g};U!==void 0?B.agentDataByVariant=U:I!==void 0&&(B.agentData=I);let V=await fetch(`${y}/assign`,{method:"POST",body:JSON.stringify(B),headers:v});if(!V.ok)return null;let G=await V.json();return N.set(u,x,{variantId:G.variantId,assignedAt:Date.now(),segment:x,confidence:1,content:G.content}),G}catch(B){return null}finally{X.delete(u)}})();return X.set(u,K),K},async decide(u){var g,I,U,$,P,W,K,B,V,G;let ze=b.getSessionId();if(!ze)return null;let re=(g=u.slots)!=null?g:[];await C;try{let Z={sessionId:ze};u.sections&&u.sections.length>0&&(Z.sections=u.sections.map(j=>({id:j}))),Z.components=(I=u.components)!=null?I:[],re.length>0&&(Z.slots=re.map(ge)),u.slotsFrom==="registry"&&(Z.slotsFrom="registry");let Ve=await fetch(`${y}/decide`,{method:"POST",body:JSON.stringify(Z),headers:v});if(!Ve.ok)return ne(re),null;let _=await Ve.json(),oe={};for(let j of re)oe[j.id]=($=(U=_.slots)==null?void 0:U[j.id])!=null?$:me(j);if(_.slots)for(let[j,ie]of Object.entries(_.slots))j in oe||(oe[j]=ie);for(let[j,ie]of Object.entries(oe))L.set(j,ie);E={persona:(P=_.persona)!=null?P:"unknown",confidence:(W=_.confidence)!=null?W:0};for(let[j,ie]of Object.entries((K=_.assignments)!=null?K:{}))N.set(j,x,{variantId:ie,assignedAt:Date.now(),segment:x,confidence:1});return le(e.apiKey,O({v:1,persona:E.persona,band:H(E.confidence),slots:Object.fromEntries(L),layoutOrder:(B=_.layoutOrder)!=null?B:null,savedAt:Date.now()},_.slotConfig?{slotConfig:_.slotConfig}:{})),O(O({layoutOrder:(V=_.layoutOrder)!=null?V:null,assignments:(G=_.assignments)!=null?G:{},slots:oe,persona:E.persona,confidence:E.confidence},_.slotConfig?{slotConfig:_.slotConfig}:{}),_.goals?{goals:_.goals}:{})}catch(Z){return ne(re),null}},getSlotResult(u){var g;return(g=L.get(u))!=null?g:null},getPersona(){return E?{persona:E.persona,confidence:E.confidence,band:H(E.confidence)}:null},async fetchWeights(){var u;try{let g=await fetch(`${y}/weights`,{headers:v});return g.ok?(u=(await g.json()).components)!=null?u:[]:[]}catch(g){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){R.destroy(),e.debug&&console.log("[sentient] disposed")},destroy(){R.destroy(),b.destroy();try{localStorage.removeItem(ve+e.apiKey),localStorage.removeItem(ut(e.apiKey))}catch(u){}e.debug&&console.log("[sentient] destroyed")}};if(F.set(e.apiKey,{config:e,upgrade:null}),e.debug){let u=window;u.__sentient&&(u.__sentient.client=q)}return q}ae();var fn=[["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]];function pn(e){var n;let t=e.querySelector("h1, h2, h3");return((n=t==null?void 0:t.textContent)!=null?n:"").slice(0,160)}function gn(e){var o;let t=e.querySelectorAll('a, button, [role="button"]').length,n=((o=e.textContent)!=null?o:"").trim().length;return t>=1&&n>0&&n<200}function mt(e){let t=e.tagName.toLowerCase();if(t==="nav"||t==="footer")return"navigation";let n=`${e.id} ${e.className} ${pn(e)}`.toLowerCase();for(let[o,r]of fn)if(r.test(n))return o;return gn(e)?"cta":t==="header"||/\b(hero|headline|banner)\b/i.test(n)?"hero":"generic"}var yt="section, header, footer, nav, main > div, [data-sentient-section]";function mn(e){var t;return((t=e.parentElement)==null?void 0:t.closest(yt))!=null}function yn(e,t,n,o){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:o})}).catch(()=>{})}catch(r){}}function ht(e,t,n,o=document){var S,d,h,b,N,R;if(typeof IntersectionObserver=="undefined"||typeof o=="undefined")return;let r=Array.from(o.querySelectorAll(yt)).filter(y=>!mn(y));if(r.length===0)return;let i=new Map,a=new Map;for(let y of r){let v=mt(y),k=`nc-${v}`;i.set(y,k),a.set(k,v)}let l=(b=(h=(d=(S=o.defaultView)!=null?S:typeof window!="undefined"?window:void 0)==null?void 0:d.location)==null?void 0:h.pathname)!=null?b:"/";yn(t,n,l,[...a.entries()].map(([y,v])=>({componentId:y,semanticType:v})));let s=new Map,c=y=>{let v=s.get(y);return v||(v={ms:0,scroll:0,enterAt:null,intersecting:!1},s.set(y,v)),v},p=new IntersectionObserver(y=>{for(let v of y){let k=i.get(v.target);if(!k)continue;let D=c(k);v.isIntersecting?(D.intersecting=!0,D.enterAt=Date.now(),v.intersectionRatio>D.scroll&&(D.scroll=v.intersectionRatio)):(D.intersecting=!1,D.enterAt!=null&&(D.ms+=Date.now()-D.enterAt,D.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let y of i.keys())p.observe(y);let f=()=>{let y=Date.now();for(let[v,k]of s)if(k.enterAt!=null&&(k.ms+=y-k.enterAt,k.enterAt=null),!(k.ms<=0)){try{e.track({projectId:t,componentId:v,eventType:"dwell",payload:{dwell_time:Math.round(k.ms),scroll_depth:Number(k.scroll.toFixed(2))}})}catch(D){}k.ms=0}};o.addEventListener("visibilitychange",()=>{if(o.hidden)f();else{let y=Date.now();for(let v of s.values())v.intersecting&&(v.enterAt=y)}}),(R=(N=o.defaultView)!=null?N:window)==null||R.addEventListener("pagehide",()=>{f();try{p.disconnect()}catch(y){}})}var hn=["landing","ecommerce","saas","marketplace"];function vn(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[o,r]of t){if(!Array.isArray(r)||r.length<2||r.length>6||!r.every(i=>typeof i=="string"))return null;n[o]=r}return n}function bn(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function we(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=hn.includes(t.context)?t.context:"landing",o={};if(typeof t.slots=="object"&&t.slots!==null&&!Array.isArray(t.slots))for(let[i,a]of Object.entries(t.slots)){if(typeof a!="object"||a===null)continue;let l=a,s=vn(l.dims);if(!s||l.target!==void 0&&typeof l.target!="string")continue;let c=l.arms!==void 0?bn(l.arms):null,p={dims:s};typeof l.target=="string"&&(p.target=l.target),c&&(p.arms=c),o[i]=p}let r={apiKey:t.apiKey,context:n,personaAttributes:t.personaAttributes===!0,slots:o};return typeof t.consent=="boolean"&&(r.consent=t.consent),(t.preConsentBehavior==="statistical_winner"||t.preConsentBehavior==="control")&&(r.preConsentBehavior=t.preConsentBehavior),t.debug===!0&&(r.debug=!0),typeof t.registry=="boolean"&&(r.registry=t.registry),typeof t.editorSrc=="string"&&(r.editorSrc=t.editorSrc),typeof t.apiBase=="string"&&(r.apiBase=t.apiBase),t.sectionCapture===!0&&(r.sectionCapture=!0),r}function vt(e){var n,o,r;let t=(o=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:o.location;return(r=t==null?void 0:t.pathname)!=null?r:""}function Sn(e,t){var n;if(t.tag&&e.tagName.toLowerCase()!==t.tag.toLowerCase())return!1;if(t.text){let o=((n=e.textContent)!=null?n:"").trim().toLowerCase(),r=t.text.trim().toLowerCase();if(!(o===r||o.startsWith(r)||r.startsWith(o)))return!1}return!0}function bt(e,t){return!!(e!=null&&e.urlMatch)&&!vt(t).includes(e.urlMatch)}function ke(e,t){var r;if(e.urlMatch&&!vt(t).includes(e.urlMatch))return null;let n=[];if(e.id){let i=t.getElementById(e.id);n=i?[i]:[]}if(n.length===0&&((r=e.dataAttr)!=null&&r.name))try{let i=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${i}"]`))}catch(i){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(i){n=[]}if(n.length!==1)return null;let o=n[0];return e.fingerprint&&!Sn(o,e.fingerprint)?null:o}var St=/^https:\/\//i,wn={color:"color",background:"background",fontSize:"font-size",fontWeight:"font-weight",textAlign:"text-align",padding:"padding",margin:"margin",borderRadius:"border-radius"};function kn(e){return!/[;{}<>]/.test(e)}var wt=new Map,J=null;function An(e){return e.replace(/["\\]/g,"\\$&")}function In(e){var t;(!J||!J.isConnected)&&(J=e.querySelector("style[data-sentient-ops]"),J||(J=e.createElement("style"),J.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(J))),J.textContent=[...wt.entries()].map(([n,o])=>`[data-snt-e="${An(n)}"]{${o}}`).join(`
|
|
2
|
-
`)}function
|
|
1
|
+
"use strict";var SentientSnippet=(()=>{var pe=Object.defineProperty;var Pt=Object.getOwnPropertyDescriptor;var Tt=Object.getOwnPropertyNames,Fe=Object.getOwnPropertySymbols;var Xe=Object.prototype.hasOwnProperty,Nt=Object.prototype.propertyIsEnumerable;var Ye=(e,t,n)=>t in e?pe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,_e=(e,t)=>{for(var n in t||(t={}))Xe.call(t,n)&&Ye(e,n,t[n]);if(Fe)for(var n of Fe(t))Nt.call(t,n)&&Ye(e,n,t[n]);return e};var Ze=(e,t)=>()=>(e&&(t=e(e=0)),t);var Qe=(e,t)=>{for(var n in t)pe(e,n,{get:t[n],enumerable:!0})},jt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Tt(t))!Xe.call(e,o)&&o!==n&&pe(e,o,{get:()=>t[o],enumerable:!(r=Pt(t,o))||r.enumerable});return e};var Mt=e=>jt(pe({},"__esModule",{value:!0}),e);var $t,Bt,Kt,et,Ut,Gt,tt,I,ue,ne=Ze(()=>{"use strict";$t=Object.defineProperty,Bt=Object.defineProperties,Kt=Object.getOwnPropertyDescriptors,et=Object.getOwnPropertySymbols,Ut=Object.prototype.hasOwnProperty,Gt=Object.prototype.propertyIsEnumerable,tt=(e,t,n)=>t in e?$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t)=>{for(var n in t||(t={}))Ut.call(t,n)&&tt(e,n,t[n]);if(et)for(var n of et(t))Gt.call(t,n)&&tt(e,n,t[n]);return e},ue=(e,t)=>Bt(e,Kt(t))});var st={};Qe(st,{LOCAL_ENGINE_AVAILABLE:()=>qt,createLocalEngine:()=>Wt});function Wt(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var qt,at=Ze(()=>{"use strict";ne();qt=!1});var jn={};Qe(jn,{applyPersonaAttributes:()=>ke,applyRegistrySlots:()=>Oe,applySlotArms:()=>Ee,applySlotAttributes:()=>Ie,parseEditorToken:()=>Rt,parsePreview:()=>Dt,parseSnippetConfig:()=>Ae,reapply:()=>Ve,run:()=>Lt,version:()=>_t});ne();function ge(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function nt(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 o=n.slice(0,r);if(o in t)return null;t[o]=n.slice(r+1)}return t}function Re(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 ge(e.baseline);if(typeof e.baseline=="string")return e.baseline;let o={};for(let[i,a]of Object.entries((n=e.dims)!=null?n:{}))o[i]=(r=a[0])!=null?r:"";return ge(o)}function rt(e,t){var n,r;return e.dims!=null?(r=(n=nt(t))!=null?n:nt(Re(e)))!=null?r:{}:t}function X(e){return e>=.3?e<.7?"medium":"high":"low"}var ot=["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 De(e){return it(e)!==null}function it(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=ot.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function Le(e){let t=e.toLowerCase();return/ipad|tablet|playbook|kindle|silk/.test(t)?"tablet":/mobi|iphone|ipod|android.*mobile|phone/.test(t)?"mobile":"desktop"}function Pe(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(o){}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 Te(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}function Ne(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function me(e){return I(I(I({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 he(e){let t=me(e);return rt(t,Re(t))}function je(e){return typeof e=="string"?e:ge(e)}ne();var Jt="_snt_uid",re="_snt_uid";function Vt(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(t){}let e=()=>Math.floor(Math.random()*4294967295).toString(16).padStart(8,"0");return`${e()}-${e()}-${e()}-${e()}`}function zt(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Ht(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(r){}}function Ft(e){try{return localStorage.getItem(e)}catch(t){return null}}function Yt(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Xt(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function Zt(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Qt(e){try{sessionStorage.removeItem(e)}catch(t){}}function en(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=strict; path=/`,/(?:^|; )_snt_uid_probe=1/.test(document.cookie)||document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function tn(e){try{localStorage.removeItem(e)}catch(t){}}function nn(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var rn={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function ut(e){var t,n,r,o,i,a;if(typeof window=="undefined")return rn;let l=(t=e==null?void 0:e.cookieName)!=null?t:Jt,s=((n=e==null?void 0:e.cookieTTLDays)!=null?n:365)*24*60*60,c=(a=(i=(o=(r=zt(l))!=null?r:Ft(re))!=null?o:Xt(re))!=null?i:e==null?void 0:e.ssrSessionId)!=null?a:Vt();Ht(l,c,s);let u=Yt(re,c),p=en(l),h=u?!1:Zt(re,c),f=!u&&!p&&!h;return{getSessionId:()=>c,isEphemeral:()=>f,destroy:()=>{c=null,nn(l),tn(re),Qt(re)}}}function dt(e){return`_snt_retry_${e.slice(0,12)}`}var on={push:()=>{},flush:()=>{},destroy:()=>{}};function sn(e,t){try{let n=localStorage.getItem(t);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?(localStorage.removeItem(t),r.slice(-e)):[]}catch(n){return[]}}function Me(e,t,n){try{let r=[...(()=>{try{let o=localStorage.getItem(n);if(!o)return[];let i=JSON.parse(o);return Array.isArray(i)?i:[]}catch(o){return[]}})(),...e].slice(-t);localStorage.setItem(n,JSON.stringify(r))}catch(r){}}function an(e){var t,n,r;if(typeof window=="undefined")return on;let o=(t=e.flushIntervalMs)!=null?t:5e3,i=(n=e.maxBatchSize)!=null?n:20,a=(r=e.maxRetrySize)!=null?r:100,l=e.ingestUrl,s=e.apiKey,c=dt(s),u=[],p=new Set,h=[],f=y=>{for(let k of y)b.delete(k),!p.has(k)&&(p.add(k),h.push(k));for(;h.length>500;){let k=h.shift();k&&p.delete(k)}},b=new Set,w=y=>{p.has(y.id)||b.has(y.id)||(b.add(y.id),u.push(y))},j=sn(a,c);for(let y of j)w(y);let _=0,O=0,T=y=>{if(y.length===0)return;let k=JSON.stringify(y),C=y.map(d=>d.id),M;try{M=fetch(l,{method:"POST",keepalive:!0,body:k,headers:{"Content-Type":"application/json",Authorization:`Bearer ${s}`}})}catch(d){Me(y,a,c);for(let g of C)b.delete(g);O++,_=Date.now()+Math.min(6e4,1e3*2**Math.min(O,6));return}let W=d=>{if(d.ok||d.status>=400&&d.status<500&&d.status!==429){f(C),O=0,_=0;return}Me(y,a,c);for(let g of C)b.delete(g);O++,_=Date.now()+Math.min(6e4,1e3*2**Math.min(O,6))};M instanceof Promise?M.then(W).catch(()=>{Me(y,a,c);for(let d of C)b.delete(d);O++,_=Date.now()+Math.min(6e4,1e3*2**Math.min(O,6))}):W(M)},G=typeof TextEncoder!="undefined"?new TextEncoder:null,q=y=>G?G.encode(y).length:y.length,H=y=>{let k=[],C=2;for(let M of y){let W=q(JSON.stringify(M))+1;if(k.length>0&&C+W>57344||k.length>=i)break;k.push(M),C+=W}return k},m=()=>{try{if(Date.now()<_)return;for(;u.length>0;){let y=u.filter(C=>!p.has(C.id));if(u.length=0,y.length===0)break;let k=H(y);if(k.length===0)break;k.length<y.length&&u.push(...y.slice(k.length)),T(k)}}catch(y){}},S=!0,v=null;v=setInterval(()=>{S&&m()},o);let A=()=>{document.visibilityState==="hidden"&&m()},te=()=>{m()};return document.addEventListener("visibilitychange",A),window.addEventListener("beforeunload",te),{push(y){w(y),u.length>=i&&m()},flush:m,destroy(){S=!1,v!==null&&(clearInterval(v),v=null),document.removeEventListener("visibilitychange",A),window.removeEventListener("beforeunload",te),m()}}}var Ue="_snt_asgn_";function ye(e,t){return`${e}:${t}`}function ln(e,t){return`${Ue}${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function lt(e){let t=e.slice(Ue.length),n=t.indexOf(":");if(n<0)return null;try{return{componentId:decodeURIComponent(t.slice(0,n)),segment:decodeURIComponent(t.slice(n+1))}}catch(r){return null}}function $e(){try{let e=[];for(let t=0;t<localStorage.length;t++){let n=localStorage.key(t);n!=null&&n.startsWith(Ue)&&e.push(n)}return e}catch(e){return[]}}function cn(e=18e5){let t=new Map,n=r=>r.assignedAt+e<Date.now();return typeof window!="undefined"&&(()=>{for(let r of $e())try{let o=localStorage.getItem(r);if(!o)continue;let i=JSON.parse(o);if(n(i)){localStorage.removeItem(r);continue}let a=lt(r);if(!a)continue;t.set(ye(a.componentId,a.segment),i)}catch(o){}})(),{get(r,o){let i=t.get(ye(r,o));return i?n(i)?(t.delete(ye(r,o)),null):i:null},set(r,o,i){let a=ye(r,o);t.set(a,i);try{localStorage.setItem(ln(r,o),JSON.stringify(i))}catch(l){}},invalidate(r){let o=`${r}:`;for(let i of[...t.keys()])i.startsWith(o)&&t.delete(i);for(let i of $e()){let a=lt(i);if((a==null?void 0:a.componentId)===r)try{localStorage.removeItem(i)}catch(l){}}},clear(){t.clear();for(let r of $e())try{localStorage.removeItem(r)}catch(o){}}}}var be="_snt_snap:",un=["low","medium","high"];function we(e){try{let t=localStorage.getItem(be+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"||!un.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 de(e,t){try{localStorage.setItem(be+e,JSON.stringify(t))}catch(n){}}var Ke="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",ft="[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.",ct=!1,ve=!1;function dn(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function fn(e){var t;let n=ut({ssrSessionId:e.ssrSessionId}),r=(t=n.getSessionId())!=null?t:"local",o=dn(),i=Promise.resolve().then(()=>(at(),st)).then(s=>{let c=s;return c.LOCAL_ENGINE_AVAILABLE?(ct||(ct=!0,console.info(ft)),c):(ve||(ve=!0,console.error(Ke)),null)}).catch(()=>(ve||(ve=!0,console.error(Ke)),null)),a=null;function l(s){let c=document.documentElement;c.dataset.sentientPersona===void 0&&(c.dataset.sentientPersona=s.persona,c.dataset.sentientConfidence=X(s.confidence))}return{isLocal:!0,async decide(s){var c,u,p;let h=await i;if(!h)return null;let f=h.createLocalEngine({sessionId:r,forcedPersona:o}).decide(s);return a=ue(I({},f),{layoutOrder:(u=(c=f.layoutOrder)!=null?c:a==null?void 0:a.layoutOrder)!=null?u:null,slots:I(I({},(p=a==null?void 0:a.slots)!=null?p:{}),f.slots)}),de(e.apiKey||"local",{v:1,persona:a.persona,band:X(a.confidence),slots:a.slots,layoutOrder:a.layoutOrder,savedAt:Date.now()}),l(f),f},getSlotResult(s){var c,u,p;return(p=(u=a==null?void 0:a.slots[s])!=null?u:(c=e.initialSlots)==null?void 0:c[s])!=null?p:null},getPersona(){return a?{persona:a.persona,confidence:a.confidence,band:X(a.confidence)}:null},async assign(s,c){var u;let p=await i;return!p||!c||c.length===0?c!=null&&c[0]?{variantId:c[0],assignmentTtlMs:0}:null:{variantId:(u=p.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:s,variantIds:c}]}).assignments[s])!=null?u:c[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>n.destroy()}}function Ge(e,t,n){var r;let o=[];{let i=!1,a=[],l=()=>{if(i)return;let s=Date.now();for(a.push(s);a.length>0&&s-a[0]>500;)a.shift();a.length>=3&&(i=!0,e("rage_click"))};t.addEventListener("click",l),o.push(()=>t.removeEventListener("click",l))}{let i=!1,a=l=>{if(i||!(l.target instanceof Node)||!t.contains(l.target)&&t!==l.target)return;i=!0;let s=typeof window!="undefined"?window.getSelection():null,c=s?s.toString().length:0;e("text_copy",{selectionLength:c})};document.addEventListener("copy",a),o.push(()=>document.removeEventListener("copy",a))}{let i=!1,a=!1,l=null,s=()=>{l!==null&&(clearTimeout(l),l=null)},c=()=>{i||!a||(s(),l=setTimeout(()=>{!i&&a&&(i=!0,e("scroll_hesitation"))},3e3))},u=()=>{s(),c()},p=f=>{for(let b of f)a=b.intersectionRatio>.3,a?c():s()};typeof process!="undefined"&&((r=process.env)==null?void 0:r.NODE_ENV)!=="production"&&(window.__lastIOCallback=p);let h=new IntersectionObserver(p,{threshold:[.3]});h.observe(t),window.addEventListener("scroll",u,{passive:!0}),o.push(()=>{h.disconnect(),window.removeEventListener("scroll",u),s()})}{let i=!1,a=n!=null?n:Date.now(),l=()=>{if(i||document.visibilityState!=="hidden")return;let s=Date.now()-a;s<15e3&&(i=!0,e("tab_loss",{timeOnPage:s}))};document.addEventListener("visibilitychange",l),o.push(()=>document.removeEventListener("visibilitychange",l))}return()=>{for(let i of o)i()}}var pt="https://api.sentient-ui.com/v1/events",Z=new Map,gt=null;function Be(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var oe={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 pn(){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 mt(e){return e.replace(/\/events\/?$/,"")}function Q(){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 qe(e){if(typeof window=="undefined")return;let t=e!=null?e:gt;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=Z.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:r,upgrade:o}=n;if(!o||r.respectDoNotTrack!==!1&&Q())return;let i=Se(ue(I({},r),{consent:!0}));o(i),Z.set(t,{config:ue(I({},r),{consent:!0}),upgrade:null})}function gn(e){var t;let n=mt((t=e.ingestUrl)!=null?t:pt),r={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},o={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),async assign(l,s,c){try{let u=new URLSearchParams({componentId:l});for(let h of s!=null?s:[])u.append("variantIds[]",h);let p=await fetch(`${n}/winner?${u.toString()}`,{headers:r});return p.ok?{variantId:(await p.json()).variantId,assignmentTtlMs:0}:s!=null&&s[0]?{variantId:s[0],assignmentTtlMs:0}:null}catch(u){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:()=>{}},i={track:l=>o.track(l),goal:(l,s,c,u)=>o.goal(l,s,c,u),componentGoal:(l,s,c)=>o.componentGoal(l,s,c),identify:l=>o.identify(l),getAssignment:(l,s)=>o.getAssignment(l,s),assign:(l,s,c,u)=>o.assign(l,s,c,u),decide:l=>o.decide(l),getSlotResult:l=>o.getSlotResult(l),getPersona:()=>o.getPersona(),fetchWeights:()=>o.fetchWeights(),getGraph:()=>o.getGraph(),dispose:()=>o.dispose(),destroy:()=>o.destroy()};function a(l){o=l}return{proxy:i,setInner:a}}function Se(e){var t,n,r,o,i,a,l,s,c;if(typeof window=="undefined")return oe;gt=e.apiKey;let u=e.respectDoNotTrack!==!1&&Q(),p=e.consent===!1||u,h=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!h&&e.localMode!==!1)return p?(Z.set(e.apiKey||"local",{config:e,upgrade:null}),oe):(Z.set(e.apiKey||"local",{config:e,upgrade:null}),fn(e));if(p){if(e.preConsentBehavior==="statistical_winner"){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."),oe;let{proxy:d,setInner:g}=gn(e);return Z.set(e.apiKey,{config:e,upgrade:u?null:g}),d}return Z.set(e.apiKey,{config:e,upgrade:null}),oe}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."),oe;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),oe;let f=(t=e.ingestUrl)!=null?t:pt,b=Date.now(),w=ut({ssrSessionId:e.ssrSessionId}),j=cn(),_=an({ingestUrl:f,apiKey:e.apiKey}),O=mt(f),T={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},G=Le((n=navigator.userAgent)!=null?n:""),q=typeof window!="undefined"?window.location.origin:void 0,H=Pe((r=document.referrer)!=null?r:"",q),m=(o=e.sessionSegment)!=null?o:`${G}:${H}`,S=new Map,v=new Map,A=null,te=d=>{for(let g of d)v.has(g.id)||v.set(g.id,he(g))};if(e.initialSlots)for(let[d,g]of Object.entries(e.initialSlots))v.set(d,g);let y=we(e.apiKey);if(y)for(let[d,g]of Object.entries(y.slots))v.has(d)||v.set(d,g);let k={low:.15,medium:.5,high:.85};if(e.initialPersona)A=I({},e.initialPersona);else{let d=document.documentElement.dataset;d.sentientPersona?A={persona:d.sentientPersona,confidence:(a=k[(i=d.sentientConfidence)!=null?i:"low"])!=null?a:.15}:y&&(A={persona:y.persona,confidence:(l=k[y.band])!=null?l:.15})}if(e.initialAssignments)for(let[d,g]of Object.entries(e.initialAssignments))j.set(d,m,{variantId:g,assignedAt:Date.now(),segment:m,confidence:1});let C=Promise.resolve(),M=w.getSessionId();if(M){let d=Te((s=document.referrer)!=null?s:""),g=I(I({sessionId:M,deviceClass:G,trafficSource:H,referrerDomain:d,utmParams:pn(),timeOfDay:Ne(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:w.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||De((c=navigator.userAgent)!=null?c:"")},e.userId?{userId:e.userId}:{}),e.country?{country:e.country}:{});try{C=fetch(`${O}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(g),headers:T}).then(x=>{x.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(x){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:_});let W={goal(d,g={},x=1,$=0){let N=w.getSessionId();if(!N)return;let L=Be();C.then(()=>{fetch(`${O}/goals`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:N,name:d,metadata:g,weight:x,stepIndex:$,goalId:L}),headers:T}).catch(()=>{})})},componentGoal(d,g,x){var $,N,L;let J=w.getSessionId();if(!J)return;let B=j.get(d,m),K=B?null:($=v.get(d))!=null?$:null;if(!B&&K===null){e.debug&&console.warn(`[sentient] componentGoal("${d}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}let F=B?B.variantId:je(K),U={id:Be(),sessionId:J,projectId:e.apiKey,componentId:d,variantId:F,eventType:"goal_achieved",goalType:g,payload:I({reward:(N=x==null?void 0:x.reward)!=null?N:1},(L=x==null?void 0:x.metadata)!=null?L:{}),timestamp:Date.now(),timeInSession:Date.now()-b};e.debug&&console.log("[sentient] componentGoal",U),C.then(()=>_.push(U))},identify(d){let g=w.getSessionId();g&&C.then(()=>{fetch(`${O}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:g,userId:d,ephemeral:w.isEphemeral()}),headers:T}).catch(()=>{})})},track(d){let g=w.getSessionId();if(!g)return;let x=ue(I({},d),{id:Be(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-b});e.debug&&console.log("[sentient] track",x),C.then(()=>_.push(x))},getAssignment(d,g){return j.get(d,g)},async assign(d,g,x,$){let N=w.getSessionId();if(!N)return null;let L=j.get(d,m);if(L&&(g!=null&&g.length||L.content!==void 0))return{variantId:L.variantId,assignmentTtlMs:0,content:L.content};let J=S.get(d);if(J)return J;let B=(async()=>{await C;try{let K={sessionId:N,componentId:d,variantIds:g};$!==void 0?K.agentDataByVariant=$:x!==void 0&&(K.agentData=x);let F=await fetch(`${O}/assign`,{method:"POST",body:JSON.stringify(K),headers:T});if(!F.ok)return null;let U=await F.json();return j.set(d,m,{variantId:U.variantId,assignedAt:Date.now(),segment:m,confidence:1,content:U.content}),U}catch(K){return null}finally{S.delete(d)}})();return S.set(d,B),B},async decide(d){var g,x,$,N,L,J,B,K,F,U;let ze=w.getSessionId();if(!ze)return null;let ae=(g=d.slots)!=null?g:[];await C;try{let Y={sessionId:ze};d.sections&&d.sections.length>0&&(Y.sections=d.sections.map(P=>({id:P}))),Y.components=(x=d.components)!=null?x:[],ae.length>0&&(Y.slots=ae.map(me)),d.slotsFrom==="registry"&&(Y.slotsFrom="registry"),d.v&&(Y.v=d.v);let He=await fetch(`${O}/decide`,{method:"POST",body:JSON.stringify(Y),headers:T});if(!He.ok)return te(ae),null;let R=await He.json(),le={};for(let P of ae)le[P.id]=(N=($=R.slots)==null?void 0:$[P.id])!=null?N:he(P);if(R.slots)for(let[P,ce]of Object.entries(R.slots))P in le||(le[P]=ce);for(let[P,ce]of Object.entries(le))v.set(P,ce);A={persona:(L=R.persona)!=null?L:"unknown",confidence:(J=R.confidence)!=null?J:0};for(let[P,ce]of Object.entries((B=R.assignments)!=null?B:{}))j.set(P,m,{variantId:ce,assignedAt:Date.now(),segment:m,confidence:1});return de(e.apiKey,I({v:1,persona:A.persona,band:X(A.confidence),slots:Object.fromEntries(v),layoutOrder:(K=R.layoutOrder)!=null?K:null,savedAt:Date.now()},R.slotConfig?{slotConfig:R.slotConfig}:{})),I(I({layoutOrder:(F=R.layoutOrder)!=null?F:null,assignments:(U=R.assignments)!=null?U:{},slots:le,persona:A.persona,confidence:A.confidence},R.slotConfig?{slotConfig:R.slotConfig}:{}),R.goals?{goals:R.goals}:{})}catch(Y){return te(ae),null}},getSlotResult(d){var g;return(g=v.get(d))!=null?g:null},getPersona(){return A?{persona:A.persona,confidence:A.confidence,band:X(A.confidence)}:null},async fetchWeights(){var d;try{let g=await fetch(`${O}/weights`,{headers:T});return g.ok?(d=(await g.json()).components)!=null?d:[]:[]}catch(g){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){_.destroy(),e.debug&&console.log("[sentient] disposed")},destroy(){_.destroy(),w.destroy();try{localStorage.removeItem(be+e.apiKey),localStorage.removeItem(dt(e.apiKey))}catch(d){}e.debug&&console.log("[sentient] destroyed")}};if(Z.set(e.apiKey,{config:e,upgrade:null}),e.debug){let d=window;d.__sentient&&(d.__sentient.client=W)}return W}ne();var mn=[["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]];function hn(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function yn(e){var t;let n=e.querySelectorAll('a, button, [role="button"]').length,r=((t=e.textContent)!=null?t:"").trim().length;return n>=1&&r>0&&r<200}function ht(e){let t=e.tagName.toLowerCase();if(t==="nav"||t==="footer")return"navigation";let n=`${e.id} ${e.className} ${hn(e)}`.toLowerCase();for(let[r,o]of mn)if(o.test(n))return r;return yn(e)?"cta":t==="header"||/\b(hero|headline|banner)\b/i.test(n)?"hero":"generic"}ne();var vt="section, header, footer, nav, main > div, [data-sentient-section]";function vn(e){var t;return((t=e.parentElement)==null?void 0:t.closest(vt))!=null}function bn(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(o){}}var yt=()=>{};function bt(e,t){var n,r,o,i,a,l,s;let c=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!c||typeof IntersectionObserver=="undefined"||Q())return yt;let u=(r=t.apiBase)!=null?r:"https://api.sentient-ui.com",p=Array.from(c.querySelectorAll(vt)).filter(m=>!vn(m));if(p.length===0)return yt;let h=new Map,f=new Map;for(let m of p){let S=ht(m),v=`nc-${S}`;h.set(m,v),f.set(v,S)}let b=(l=(a=(i=(o=c.defaultView)!=null?o:typeof window!="undefined"?window:void 0)==null?void 0:i.location)==null?void 0:a.pathname)!=null?l:"/";bn(t.apiKey,u,b,[...f.entries()].map(([m,S])=>({componentId:m,semanticType:S})));let w=new Map,j=m=>{let S=w.get(m);return S||(S={ms:0,scroll:0,enterAt:null,intersecting:!1},w.set(m,S)),S},_=new IntersectionObserver(m=>{for(let S of m){let v=h.get(S.target);if(!v)continue;let A=j(v);S.isIntersecting?(A.intersecting=!0,A.enterAt=Date.now(),S.intersectionRatio>A.scroll&&(A.scroll=S.intersectionRatio)):(A.intersecting=!1,A.enterAt!=null&&(A.ms+=Date.now()-A.enterAt,A.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let m of h.keys())_.observe(m);let O=()=>{let m=Date.now();for(let[S,v]of w)if(v.enterAt!=null&&(v.ms+=m-v.enterAt,v.enterAt=null),!(v.ms<=0)){try{e.track({projectId:t.apiKey,componentId:S,eventType:"dwell",payload:{dwell_time:Math.round(v.ms),scroll_depth:Number(v.scroll.toFixed(2))}})}catch(A){}v.ms=0}},T=()=>{if(c.hidden)O();else{let m=Date.now();for(let S of w.values())S.intersecting&&(S.enterAt=m)}},G=()=>{O();try{_.disconnect()}catch(m){}};c.addEventListener("visibilitychange",T);let q=(s=c.defaultView)!=null?s:typeof window!="undefined"?window:void 0;q==null||q.addEventListener("pagehide",G);let H=[];if(t.microSignals)for(let[m,S]of h)H.push(Ge((v,A={})=>{try{e.track({projectId:t.apiKey,componentId:S,eventType:"micro_signal",payload:I({signalType:v},A)})}catch(te){}},m));return()=>{O(),c.removeEventListener("visibilitychange",T),q==null||q.removeEventListener("pagehide",G);for(let m of H)m();try{_.disconnect()}catch(m){}}}var wn=["landing","ecommerce","saas","marketplace"];function Sn(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,o]of t){if(!Array.isArray(o)||o.length<2||o.length>6||!o.every(i=>typeof i=="string"))return null;n[r]=o}return n}function An(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function Ae(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=wn.includes(t.context)?t.context:"landing",r={};if(typeof t.slots=="object"&&t.slots!==null&&!Array.isArray(t.slots))for(let[i,a]of Object.entries(t.slots)){if(typeof a!="object"||a===null)continue;let l=a,s=Sn(l.dims);if(!s||l.target!==void 0&&typeof l.target!="string")continue;let c=l.arms!==void 0?An(l.arms):null,u={dims:s};typeof l.target=="string"&&(u.target=l.target),c&&(u.arms=c),r[i]=u}let o={apiKey:t.apiKey,context:n,personaAttributes:t.personaAttributes===!0,slots:r};return typeof t.consent=="boolean"&&(o.consent=t.consent),(t.preConsentBehavior==="statistical_winner"||t.preConsentBehavior==="control")&&(o.preConsentBehavior=t.preConsentBehavior),t.debug===!0&&(o.debug=!0),typeof t.registry=="boolean"&&(o.registry=t.registry),typeof t.editorSrc=="string"&&(o.editorSrc=t.editorSrc),typeof t.apiBase=="string"&&(o.apiBase=t.apiBase),typeof t.sectionCapture=="boolean"&&(o.sectionCapture=t.sectionCapture),o}function wt(e){var n,r,o;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(o=t==null?void 0:t.pathname)!=null?o:""}function kn(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(),o=t.text.trim().toLowerCase();if(!(r===o||r.startsWith(o)||o.startsWith(r)))return!1}return!0}function St(e,t){return!!(e!=null&&e.urlMatch)&&!wt(t).includes(e.urlMatch)}function ie(e,t){var o;if(e.urlMatch&&!wt(t).includes(e.urlMatch))return null;let n=[];if(e.id){let i=t.getElementById(e.id);n=i?[i]:[]}if(n.length===0&&((o=e.dataAttr)!=null&&o.name))try{let i=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${i}"]`))}catch(i){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(i){n=[]}if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!kn(r,e.fingerprint)?null:r}var At=/^https:\/\//i,In={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"};function En(e){return!/[;{}<>]/.test(e)}var kt=new Map,V=null;function On(e){return e.replace(/["\\]/g,"\\$&")}function xn(e){var t;(!V||!V.isConnected)&&(V=e.querySelector("style[data-sentient-ops]"),V||(V=e.createElement("style"),V.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(V))),V.textContent=[...kt.entries()].map(([n,r])=>`[data-snt-e="${On(n)}"]{${r}}`).join(`
|
|
2
|
+
`)}function It(e,t,n,r){var l;let o=!1,i=(l=t.moveBefore)!=null?l:t.moveAfter;if(i){let s=ie(i,r);!s||s===e||s.parentElement!==e.parentElement||!e.parentElement?o=!0:t.moveBefore?e.parentElement.insertBefore(e,s):e.parentElement.insertBefore(e,s.nextSibling)}typeof t.text=="string"&&(e.textContent=t.text),typeof t.href=="string"&&At.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&At.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let a=[];if(t.hidden&&a.push("display:none !important"),t.style)for(let[s,c]of Object.entries(t.style)){let u=In[s];u&&typeof c=="string"&&En(c)&&a.push(`${u}:${c.trim()} !important`)}return a.length>0&&(e.setAttribute("data-snt-e",n),kt.set(n,a.join(";")),xn(r)),{anchorMiss:o}}function ke(e,t,n){n.documentElement.setAttribute("data-sentient-persona",e),n.documentElement.setAttribute("data-sentient-confidence",t)}function Ie(e,t,n){var r;for(let[o,i]of Object.entries(t)){let a=e[o];if(!a||typeof a=="string")continue;let l=i.target?Array.from(n.querySelectorAll(i.target)):[n.documentElement];for(let s of l)for(let[c,u]of Object.entries(a))(r=i.dims[c])!=null&&r.includes(u)&&s.setAttribute(`data-${c}`,u)}}function Ee(e,t,n){for(let[r,o]of Object.entries(t)){let i=e[r];if(typeof i!="string"||!o.arms||!o.arms.includes(i))continue;let a=o.target?Array.from(n.querySelectorAll(o.target)):[n.documentElement];for(let l of a)l.setAttribute("data-sentient-arm",i)}}function Oe(e,t,n,r){var a;let o=(a=r==null?void 0:r.contentAndOps)!=null?a:!0,i=[];for(let[l,s]of Object.entries(t)){if(St(s.locator,n))continue;let c;if(s.locator){let p=ie(s.locator,n);c=p?[p]:[]}else s.target?c=Array.from(n.querySelectorAll(s.target)):c=[n.documentElement];(s.locator||s.target)&&c.length===0&&i.push(l);let u=e[l];for(let p of c){if(u!==void 0)if(typeof u=="string")p.setAttribute("data-sentient-arm",u);else for(let[h,f]of Object.entries(u))p.setAttribute(`data-${h}`,f);o&&(typeof s.content=="string"&&(p.textContent=s.content),s.ops&&It(p,s.ops,l,n).anchorMiss&&!i.includes(l)&&i.push(l))}}return i}function Cn(e){var n,r,o;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(o=t==null?void 0:t.pathname)!=null?o:""}function Et(e,t,n){var h;let r=new Set,o=f=>{if(!r.has(f.goalId)){r.add(f.goalId);try{f.slotId?t.componentGoal(f.slotId,f.goalId):t.goal(f.goalId)}catch(b){}}},i=e.filter(f=>f.event==="click"),a=e.filter(f=>f.event==="form_submit"),l=e.filter(f=>f.event==="url_reached"),s=(f,b)=>{if(!f.locator)return!1;let w=ie(f.locator,n);return!!w&&(w===b||w.contains(b))},c=f=>{let b=f.target;if(!(!b||typeof b.closest!="function"))for(let w of i)s(w,b)&&o(w)},u=f=>{let b=f.target;if(b)for(let w of a)s(w,b)&&o(w)},p=()=>{if(l.length===0)return;let f=Cn(n);for(let b of l)b.urlPattern&&f.includes(b.urlPattern)&&o(b)};return n.addEventListener("click",c,!0),n.addEventListener("submit",u,!0),(h=n.defaultView)==null||h.addEventListener("popstate",p),p(),{checkUrl:p,teardown:()=>{var f;n.removeEventListener("click",c,!0),n.removeEventListener("submit",u,!0),(f=n.defaultView)==null||f.removeEventListener("popstate",p)}}}var _t="0.5.0",_n=5e3,Rn=50,fe=null,D=null,z={},se=null,ee=null,E=null,Ot=!1,We=null;function Dn(e,t){return Promise.race([e,new Promise(n=>setTimeout(()=>n(null),t))])}function xe(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Ce(e,t){return fe?(fe.personaAttributes&&E&&ke(E.persona,E.band,e),Ie(z,fe.slots,e),Ee(z,fe.slots,e),se?Oe(z,se,e,t):[]):[]}function Ln(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 Ve(){try{Ce(document)}catch(e){}}function xt(){We===null&&(We=setTimeout(()=>{We=null,Ve();try{ee==null||ee.checkUrl()}catch(e){}},Rn))}function Ct(){if(!(Ot||typeof window=="undefined"||typeof history=="undefined")){Ot=!0;try{let e=t=>{let n=history[t];history[t]=function(r,o,i){let a=n.call(this,r,o,i!=null?i:null);return xt(),a}};e("pushState"),e("replaceState"),window.addEventListener("popstate",xt)}catch(e){}}}function Je(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 Rt(e){return new URLSearchParams(e).get("sentient_editor")}function Pn(){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 Tn(e,t){var n,r,o,i;try{window.__sentientEditor={token:t,apiBase:(n=e.apiBase)!=null?n:"https://api.sentient-ui.com"};try{let s=document.createElement("meta");s.name="referrer",s.content="no-referrer",((r=document.head)!=null?r:document.documentElement).appendChild(s)}catch(s){}let a=(o=e.editorSrc)!=null?o:Pn();if(!a)return;let l=document.createElement("script");l.src=a,l.async=!0,((i=document.head)!=null?i:document.documentElement).appendChild(l)}catch(a){}}function Dt(e){let t=new URLSearchParams(e).get("sentient_preview");if(!t)return null;let n={};for(let r of t.split("|")){let[o,i]=r.split(":");if(!(!o||!i))if(i.includes("=")){let a={};for(let l of i.split(",")){let[s,c]=l.split("=");s&&c&&(a[s]=c)}Object.keys(a).length&&(n[o]=a)}else n[o]=i}return Object.keys(n).length?n:null}function Nn(e){let t={goal(n,r){try{D==null||D.goal(n,r)}catch(o){}},componentGoal(n,r){try{D==null||D.componentGoal(n,r)}catch(o){}},grantConsent(){try{qe(e.apiKey)}catch(n){}},revokeConsent(){try{D==null||D.destroy()}catch(n){}},reapply:Ve,getState(){var n,r;return{apiKey:e.apiKey,persona:(n=E==null?void 0:E.persona)!=null?n:null,band:(r=E==null?void 0:E.band)!=null?r:null,slots:z,matchCounts:Je(e),consent:e.consent!==!1}}};window.SentientSnippet=t}async function Lt(){var e,t,n;try{let r=Ae(window.sentient);if(!r)return;fe=r;let o=typeof window!="undefined"?Rt(window.location.search):null;if(o){try{let h=new URL(window.location.href);h.searchParams.delete("sentient_editor"),window.history.replaceState(null,"",h.pathname+h.search+h.hash)}catch(h){}Tn(r,o),xe(r,"editor mode");return}let i=typeof window!="undefined"?Dt(window.location.search):null;if(i){z=i,E=null,Ce(document),Ct(),xe(r,"preview mode",i);return}let a=(e=r.registry)!=null?e:Object.keys(r.slots).length===0,l=we(r.apiKey);l&&(E={persona:l.persona,band:l.band},z=l.slots,l.slotConfig&&(se=l.slotConfig),Ce(document,{contentAndOps:!1}));let s=Se({apiKey:r.apiKey,context:r.context,consent:r.consent,preConsentBehavior:r.preConsentBehavior,debug:r.debug});D=s,Nn(r),Ct();let c=Object.entries(r.slots).map(([h,f])=>({id:h,dims:f.dims})),u=await Dn(s.decide(_e({slots:c,v:_t},a?{slotsFrom:"registry"}:{})),_n);if(!u){xe(r,"decide timeout/null \u2014 snapshot state stands",Je(r));return}let p=s.getPersona();if(p?E={persona:p.persona,band:p.band}:u.persona&&(E={persona:u.persona,band:"low"}),z=u.slots,u.slotConfig&&(se=u.slotConfig),Ln(r,Ce(document)),u.goals&&u.goals.length>0&&r.consent!==!1&&D)try{ee==null||ee.teardown(),ee=Et(u.goals,D,document)}catch(h){}if(r.sectionCapture!==!1&&r.consent!==!1&&D&&!Q())try{bt(D,{apiKey:r.apiKey,apiBase:r.apiBase,doc:document,microSignals:!0})}catch(h){}xe(r,"applied",{persona:E,slots:z,matches:Je(r)}),de(r.apiKey,_e({v:1,persona:(t=E==null?void 0:E.persona)!=null?t:u.persona,band:(n=E==null?void 0:E.band)!=null?n:"low",slots:u.slots,layoutOrder:u.layoutOrder,savedAt:Date.now()},se?{slotConfig:se}:{}))}catch(r){}}typeof window!="undefined"&&window.sentient&&Lt();return Mt(jn);})();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentientui/snippet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
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
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"tsx": "^4.19.2",
|
|
17
17
|
"typescript": "^5.7.2",
|
|
18
18
|
"vitest": "^2.1.8",
|
|
19
|
-
"@sentientui/core": "0.
|
|
19
|
+
"@sentientui/core": "0.15.0"
|
|
20
20
|
},
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsup",
|