@sentientui/snippet 0.28.0 → 0.29.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.
@@ -1,2 +1,2 @@
1
- "use strict";var SentientSnippet=(()=>{var ut=Object.defineProperty,Zr=Object.defineProperties,Qr=Object.getOwnPropertyDescriptor,eo=Object.getOwnPropertyDescriptors,to=Object.getOwnPropertyNames,bn=Object.getOwnPropertySymbols;var wn=Object.prototype.hasOwnProperty,no=Object.prototype.propertyIsEnumerable;var Sn=(e,t,n)=>t in e?ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j=(e,t)=>{for(var n in t||(t={}))wn.call(t,n)&&Sn(e,n,t[n]);if(bn)for(var n of bn(t))no.call(t,n)&&Sn(e,n,t[n]);return e},De=(e,t)=>Zr(e,eo(t));var En=(e,t)=>()=>(e&&(t=e(e=0)),t);var An=(e,t)=>{for(var n in t)ut(e,n,{get:t[n],enumerable:!0})},ro=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of to(t))!wn.call(e,o)&&o!==n&&ut(e,o,{get:()=>t[o],enumerable:!(r=Qr(t,o))||r.enumerable});return e};var oo=e=>ro(ut({},"__esModule",{value:!0}),e);var io,so,ao,xn,lo,co,kn,N,_e,We=En(()=>{"use strict";io=Object.defineProperty,so=Object.defineProperties,ao=Object.getOwnPropertyDescriptors,xn=Object.getOwnPropertySymbols,lo=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable,kn=(e,t,n)=>t in e?io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N=(e,t)=>{for(var n in t||(t={}))lo.call(t,n)&&kn(e,n,t[n]);if(xn)for(var n of xn(t))co.call(t,n)&&kn(e,n,t[n]);return e},_e=(e,t)=>so(e,ao(t))});var Bn={};An(Bn,{LOCAL_ENGINE_AVAILABLE:()=>mo,createLocalEngine:()=>ho});function ho(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var mo,Nn=En(()=>{"use strict";mo=!1});var $i={};An($i,{applyPersonaAttributes:()=>xt,applyRegistrySlots:()=>_t,applySlotArms:()=>Ct,applySlotAttributes:()=>kt,parseEditorToken:()=>zr,parsePersonaPreview:()=>Hr,parsePreview:()=>Wr,parseSnippetConfig:()=>St,planReorder:()=>Lt,reapply:()=>it,run:()=>Vr,version:()=>ot});We();function dt(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function Cn(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 zt(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 dt(e.baseline);if(typeof e.baseline=="string")return e.baseline;let o={};for(let[a,i]of Object.entries((n=e.dims)!=null?n:{}))o[a]=(r=i[0])!=null?r:"";return dt(o)}function _n(e,t){var n,r;return e.dims!=null?(r=(n=Cn(t))!=null?n:Cn(zt(e)))!=null?r:{}:t}function On(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t}function Oe(e){return e>=.3?e<.7?"medium":"high":"low"}function ft(e){return e?`_${e.slice(0,12)}`:""}var uo="_snt_uid";function In(e){return`${uo}${ft(e)}`}var fo=["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 Ln(e){return po(e)!==null}function po(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=fo.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function Tn(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 Rn(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 Pn(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var go=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Dn(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([o,a])=>{let i=Array.isArray(a)?a[0]:a;return i===void 0?[]:[[o,i]]});for(let[o,a]of r)o.startsWith("utm_")?o in t||(t[o]=a):go.includes(o)&&(o in n||(n[o]=a))}catch(r){}return{utmParams:t,clickIds:n}}function Mn(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function qt(e){return N(N(N({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 Wt(e){let t=qt(e);return _n(t,zt(t))}function $n(e){return typeof e=="string"?e:dt(e)}We();function zn(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var yo="_snt_uid",vo=365,pt="_snt_uid";function bo(){return zn()}function Kn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function So(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(r){}}function Ht(e){try{return localStorage.getItem(e)}catch(t){return null}}function jn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Gn(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function wo(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Eo(e){try{sessionStorage.removeItem(e)}catch(t){}}function Ao(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 xo(e){try{localStorage.removeItem(e)}catch(t){}}function ko(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var Co={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function qn(e){var t,n,r,o,a,i,s;if(typeof window=="undefined")return Co;let l=ft(e==null?void 0:e.apiKey),u=(t=e==null?void 0:e.cookieName)!=null?t:In(e==null?void 0:e.apiKey),c=`${pt}${l}`,d=`${pt}_tomb${l}`,m=((n=e==null?void 0:e.cookieTTLDays)!=null?n:vo)*24*60*60,C=w=>w&&w.length>0?w:null,p=()=>{var w,h;return l&&!(e!=null&&e.cookieName)&&Ht(d)===null?(h=(w=C(Kn(yo)))!=null?w:C(Ht(pt)))!=null?h:C(Gn(pt)):null},g=(s=(i=(a=(o=(r=C(Kn(u)))!=null?r:C(Ht(c)))!=null?o:C(Gn(c)))!=null?a:p())!=null?i:C(e==null?void 0:e.ssrSessionId))!=null?s:bo();So(u,g,m);let _=jn(c,g),v=Ao(u),O=_?!1:wo(c,g),b=!_&&!v&&!O;return{getSessionId:()=>g,isEphemeral:()=>b,destroy:()=>{g=null,ko(u),xo(c),Eo(c),l&&!(e!=null&&e.cookieName)&&jn(d,"1")}}}function Me(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Qt(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 Wn(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?(localStorage.removeItem(e),r.slice(-t)):[]}catch(n){return[]}}function $e(e,t,n){try{let r=(()=>{try{let a=localStorage.getItem(n);if(!a)return[];let i=JSON.parse(a);return Array.isArray(i)?i:[]}catch(a){return[]}})(),o=new Map;for(let a of r)o.set(a.id,a);for(let a of e)o.set(a.id,a);localStorage.setItem(n,JSON.stringify([...o.values()].slice(-t)))}catch(r){}}function Hn(e,t){try{let n=localStorage.getItem(t);if(!n)return;let r=JSON.parse(n);if(!Array.isArray(r))return;let o=new Set(e),a=r.filter(i=>!o.has(i.id));if(a.length===r.length)return;a.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(a))}catch(n){}}var _o=500,Oo=56*1024;function Vn(e){return`_snt_retry_${e.slice(0,12)}`}var Io={push:()=>{},flush:()=>{},destroy:()=>{}};function Lo(e){var t,n,r;if(typeof window=="undefined")return Io;let o=(t=e.flushIntervalMs)!=null?t:5e3,a=(n=e.maxBatchSize)!=null?n:20,i=(r=e.maxRetrySize)!=null?r:100,s=e.ingestUrl,l=e.apiKey,u=Vn(l),c=[],d=new Set,m=[],C=S=>{for(let T of S)p.delete(T),!d.has(T)&&(d.add(T),m.push(T));for(;m.length>_o;){let T=m.shift();T&&d.delete(T)}Hn(S,u)},p=new Set,g=()=>{for(;c.length>i;){let S=c.shift();S&&p.delete(S.id)}},_=S=>{d.has(S.id)||p.has(S.id)||(p.add(S.id),c.push(S),g())},v=S=>{for(let T of S)d.has(T.id)||(p.add(T.id),c.push(T));g()},O=Wn(u,i);for(let S of O)_(S);let b=0,w=0,h=(S,T=!0)=>{if(S.length===0)return;let Y=JSON.stringify(S),ee=S.map(R=>R.id),x;try{x=fetch(s,{method:"POST",keepalive:!0,body:Y,headers:{"Content-Type":"application/json",Authorization:`Bearer ${l}`}})}catch(R){$e(S,i,u),v(S),w++,b=Date.now()+Me(w);return}let K=R=>{if(Qt(R)!=="retry"){if(!R.ok&&T){let z=S.filter(Z=>Z.eventType!=="pageview");if(z.length>0&&z.length<S.length){C(S.filter(Z=>Z.eventType==="pageview").map(Z=>Z.id)),h(z,!1);return}}C(ee),w=0,b=0;return}$e(S,i,u),v(S),w++,b=Date.now()+Me(w)};x instanceof Promise?x.then(K).catch(()=>{$e(S,i,u),v(S),w++,b=Date.now()+Me(w)}):K(x)},A=typeof TextEncoder!="undefined"?new TextEncoder:null,E=S=>A?A.encode(S).length:S.length,F=S=>{let T=[],Y=2;for(let ee of S){let x=E(JSON.stringify(ee))+1;if(T.length>0&&Y+x>Oo||T.length>=a)break;T.push(ee),Y+=x}return T},M=()=>{try{if(Date.now()<b)return;for(;c.length>0&&!(Date.now()<b);){let S=c.filter(Y=>!d.has(Y.id));if(c.length=0,S.length===0)break;let T=F(S);if(T.length===0)break;T.length<S.length&&c.push(...S.slice(T.length)),h(T)}}catch(S){}},q=!0,W=null;W=setInterval(()=>{q&&M()},o);let ne=()=>{document.visibilityState==="hidden"&&M()},fe=()=>{M()};return document.addEventListener("visibilitychange",ne),window.addEventListener("pagehide",fe),{push(S){_(S),c.length>=a&&M()},flush:M,destroy(){q=!1,W!==null&&(clearInterval(W),W=null),document.removeEventListener("visibilitychange",ne),window.removeEventListener("pagehide",fe),M()}}}var To=200;function Jn(e){return`_snt_goal_retry_${e.slice(0,12)}`}var Ro={send:()=>{},flush:()=>{},destroy:()=>{}};function Po(e){var t,n,r;if(typeof window=="undefined")return Ro;let o=(t=e.flushIntervalMs)!=null?t:5e3,a=(n=e.maxRetrySize)!=null?n:100,i=(r=e.maxPerFlush)!=null?r:5,s=Jn(e.apiKey),l=[],u=new Set,c=new Set,d=[],m=0,C=0,p=!1,g=E=>{for(u.delete(E.id),c.has(E.id)||(c.add(E.id),d.push(E.id));d.length>To;){let F=d.shift();F&&c.delete(F)}Hn([E.id],s)},_=E=>{$e([E],a,s),!c.has(E.id)&&!u.has(E.id)&&(u.add(E.id),l.push(E)),Date.now()>=m&&(C++,m=Date.now()+Me(C))},v=E=>{let F;try{F=fetch(e.url,{method:"POST",keepalive:!0,body:E.body,headers:e.headers})}catch(q){_(E);return}let M=q=>{var W;let ne=Qt(q);if(ne==="retry"){_(E);return}ne==="dropped"&&((W=e.onDrop)==null||W.call(e,E,q.status)),g(E),C=0,m=0};F instanceof Promise?F.then(M).catch(()=>_(E)):M(F)},O=()=>{try{if(p||Date.now()<m)return;let E=0;for(;l.length>0&&E<i&&!(Date.now()<m);){let F=l.shift();u.delete(F.id),!c.has(F.id)&&(E++,v(F))}}catch(E){}},b=Wn(s,a);for(let E of b)u.has(E.id)||(u.add(E.id),l.push(E));b.length>0&&$e(b,a,s);let w=setInterval(O,o),h=()=>{document.visibilityState==="hidden"&&O()},A=()=>O();return document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",A),{send(E){if(!p&&!(c.has(E.id)||u.has(E.id))){if(Date.now()<m){$e([E],a,s),u.add(E.id),l.push(E);return}v(E)}},flush:O,destroy(){clearInterval(w),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",A),O(),p=!0}}}var Do=1800*1e3;function gt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function Mo(e=Do,t){let n=new Map,r=`_snt_asgn${ft(t)}_`,o=(l,u)=>`${r}${encodeURIComponent(l)}:${encodeURIComponent(u)}`,a=l=>{let u=l.slice(r.length),c=u.indexOf(":");if(c<0)return null;try{return{componentId:decodeURIComponent(u.slice(0,c)),segment:decodeURIComponent(u.slice(c+1))}}catch(d){return null}},i=()=>{try{let l=[];for(let u=0;u<localStorage.length;u++){let c=localStorage.key(u);c!=null&&c.startsWith(r)&&l.push(c)}return l}catch(l){return[]}},s=l=>l.assignedAt+(l.ttlMs&&l.ttlMs>0?l.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let l of i())try{let u=localStorage.getItem(l);if(!u)continue;let c=JSON.parse(u);if(s(c)){localStorage.removeItem(l);continue}let d=a(l);if(!d)continue;n.set(gt(d.componentId,d.segment),c)}catch(u){}})(),{get(l,u){let c=n.get(gt(l,u));return c?s(c)?(n.delete(gt(l,u)),null):c:null},set(l,u,c){let d=gt(l,u);n.set(d,c);try{localStorage.setItem(o(l,u),JSON.stringify(c))}catch(m){}},clear(){n.clear();for(let l of i())try{localStorage.removeItem(l)}catch(u){}}}}var yt="_snt_snap:",$o=["low","medium","high"];function Ve(e){try{let t=localStorage.getItem(yt+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"||!$o.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 Ne(e,t){try{localStorage.setItem(yt+e,JSON.stringify(t))}catch(n){}}var Xt="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Yn="[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.",Un=!1,mt=!1;function Bo(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function No(e){var t;let n=qn({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=Bo(),a=Promise.resolve().then(()=>(Nn(),Bn)).then(c=>{let d=c;return d.LOCAL_ENGINE_AVAILABLE?(Un||(Un=!0,console.info(Yn)),d):(mt||(mt=!0,console.error(Xt)),null)}).catch(()=>(mt||(mt=!0,console.error(Xt)),null)),i=null,s={low:.15,medium:.5,high:.85},l=(()=>{var c;if(e.initialPersona)return N({},e.initialPersona);let d=Ve(e.apiKey||"local");return d?{persona:d.persona,confidence:(c=s[d.band])!=null?c:.15}:null})();function u(c){let d=document.documentElement;d.dataset.sentientPersona===void 0&&(d.dataset.sentientPersona=c.persona,d.dataset.sentientConfidence=Oe(c.confidence))}return{isLocal:!0,async decide(c){var d,m,C;let p=await a;if(!p)return null;let g=p.createLocalEngine({sessionId:r,forcedPersona:o}).decide(c);return i=_e(N({},g),{layoutOrder:(m=(d=g.layoutOrder)!=null?d:i==null?void 0:i.layoutOrder)!=null?m:null,slots:N(N({},(C=i==null?void 0:i.slots)!=null?C:{}),g.slots)}),Ne(e.apiKey||"local",{v:1,persona:i.persona,band:Oe(i.confidence),slots:i.slots,layoutOrder:i.layoutOrder,savedAt:Date.now()}),u(g),g},getSlotResult(c){var d,m,C;return(C=(m=i==null?void 0:i.slots[c])!=null?m:(d=e.initialSlots)==null?void 0:d[c])!=null?C:null},getSlotConfig(c){var d,m;return(m=(d=e.initialSlotConfig)==null?void 0:d[c])!=null?m:null},getSitePalette(){var c;return(c=e.initialPalette)!=null?c:null},reportSlots(){},getPersona(){let c=i!=null?i:l;return c?{persona:c.persona,confidence:c.confidence,band:Oe(c.confidence)}:null},async assign(c,d){var m;let C=await a;return!C||!d||d.length===0?d!=null&&d[0]?{variantId:d[0],assignmentTtlMs:0}:null:{variantId:(m=C.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:c,variantIds:d}]}).assignments[c])!=null?m:d[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>n.destroy()}}var vt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Vt(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function en(e,t){if(e===void 0||!vt.test(e))return!1;if(e==="*")return!0;let n=Vt(t);if(e.endsWith("/*")){let r=Vt(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===Vt(e)}function bt(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="form"?!0:Array.isArray(t.children)?t.children.some(bt):!1}var Fn="sentient-reveal",Be="sentient-revealed";var Jt=!1;function Ko(e){if(Jt||e.getElementById(Fn)){Jt=!0;return}let t=e.createElement("style");t.id=Fn,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${Be}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${Be}{animation:${Be} 240ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),Jt=!0}function tn(e,t={}){var n;let r=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!r||!(e instanceof Element)||(t.arm!==void 0&&e.setAttribute("data-sentient-arm",t.arm),t.persona!==void 0&&e.setAttribute("data-sentient-persona",t.persona),t.previous!==void 0&&t.previous===e.textContent))return!1;Ko(r),e.classList.remove(Be),e.offsetWidth,e.classList.add(Be);let o=()=>{e.classList.remove(Be),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function Je(e,t,n,r){let o=[];{let a=!1,i=[],s=()=>{if(a)return;let l=Date.now();for(i.push(l);i.length>0&&l-i[0]>500;)i.shift();i.length>=3&&(a=!0,e("rage_click"))};t.addEventListener("click",s),o.push(()=>t.removeEventListener("click",s))}{let a=!1,i=s=>{if(a||!(s.target instanceof Node)||!t.contains(s.target)&&t!==s.target)return;a=!0;let l=typeof window!="undefined"?window.getSelection():null,u=l?l.toString().length:0;e("text_copy",{selectionLength:u})};document.addEventListener("copy",i),o.push(()=>document.removeEventListener("copy",i))}{let a=!1,i=!1,s=null,l=()=>{s!==null&&(clearTimeout(s),s=null)},u=()=>{a||!i||(l(),s=setTimeout(()=>{!a&&i&&(a=!0,e("scroll_hesitation"))},3e3))},c=()=>{l(),u()},d=C=>{for(let p of C)i=p.intersectionRatio>.3,i?u():l()},m=new IntersectionObserver(d,{threshold:[.3]});m.observe(t),window.addEventListener("scroll",c,{passive:!0}),o.push(()=>{m.disconnect(),window.removeEventListener("scroll",c),l()})}if((r==null?void 0:r.tabLoss)!==!1){let a=!1,i=n!=null?n:Date.now(),s=()=>{if(a||document.visibilityState!=="hidden")return;let l=Date.now()-i;l<15e3&&(a=!0,e("tab_loss",{timeOnPage:l}))};document.addEventListener("visibilitychange",s),o.push(()=>document.removeEventListener("visibilitychange",s))}return()=>{for(let a of o)a()}}function jo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Xn="https://api.sentient-ui.com/v1/events",le=new Map,Zn=null;function Go(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Uo=3;function Yt(){return zn()}function ht(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Fo(){let e=new WeakMap,t=new Map,n=!1,r=(s,l,u)=>{let c=s.get(l);return u===null?c?!0:(s.set(l,new Set),!1):c?c.has(u)?!0:(c.add(u),!1):(s.set(l,new Set([u])),!1)},o=typeof window!="undefined"&&"event"in window,a=()=>{if(!o)return;let s=window.event;return typeof Event=="function"&&s instanceof Event?s:void 0},i=()=>{if(o){Promise.resolve().then(()=>{n=!1,t.clear()});return}let s=!1,l=()=>{s||(s=!0,n=!1,t.clear())};if(setTimeout(l,0),typeof MessageChannel=="function"){let u=new MessageChannel;u.port1.onmessage=()=>{u.port1.close(),u.port2.close(),l()},u.port2.postMessage(0)}};return{firedBefore(s,l){let u=a();if(u){let d=e.get(u);return d||(d=new Map,e.set(u,d)),r(d,s,l)}let c=r(t,s,l);return!c&&!n&&(n=!0,i()),c}}}var Qn=new Set;function zo(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,a,i=()=>{if(o)return;let u=ht();!u||u===a||(a=u,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${u}`))},s=[];for(let u of["pushState","replaceState"]){let c=r[u],d=function(...m){let C=c.apply(this,m);return i(),C};r[u]=d,s.push([u,c,d])}window.addEventListener("popstate",i);let l=ht();return l&&Qn.has(`${t}:${l}`)?a=l:i(),()=>{if(!o){o=!0,window.removeEventListener("popstate",i);for(let[u,c,d]of s)r[u]===d&&(r[u]=c)}}}var He={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}};function qo(){try{return Dn(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function er(e){return e.replace(/\/events\/?$/,"")}function Ie(){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 nn(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:Zn;if(!n){console.warn("[sentient] grantConsent() called before init()");return}let r=le.get(n);if(!r){console.warn("[sentient] grantConsent() called before init()");return}let{config:o,upgrade:a,reinit:i}=r;if(!a){r.upgradeBlockedReason&&console.warn(r.upgradeBlockedReason);return}if(o.respectDoNotTrack!==!1&&Ie())return;let s=(i!=null?i:Ye)(_e(N({},o),{consent:!0}));a(s);let l=(t=le.get(n))==null?void 0:t.dispose;le.set(n,{config:_e(N({},o),{consent:!0}),upgrade:null,dispose:l})}function Wo(e){var t;let n=e.preConsentBehavior==="statistical_winner",r=er((t=e.ingestUrl)!=null?t:Xn),o={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},a=new Map,i=new Map,s={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(p,g,_){if(!n)return Promise.resolve(null);let v=a.get(p);return v?Promise.resolve(v):Zt(i,p,async()=>{try{let O=new URLSearchParams({componentId:p});for(let h of g!=null?g:[])O.append("variantIds[]",h);let b=await fetch(`${r}/winner?${O.toString()}`,{headers:o});if(!b.ok)return g!=null&&g[0]?{variantId:g[0],assignmentTtlMs:0}:null;let w={variantId:(await b.json()).variantId,assignmentTtlMs:0};return a.set(p,w),w}catch(O){return g!=null&&g[0]?{variantId:g[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}},l=!1,u=new Set,c=[],d=[],m={track:p=>s.track(p),goal:((p,g,_,v)=>s.goal(p,g,_,v)),componentGoal:(p,g,_)=>s.componentGoal(p,g,_),identify:p=>s.identify(p),getAssignment:(p,g)=>s.getAssignment(p,g),assign:(p,g,_,v)=>s.assign(p,g,_,v),decide:p=>s.decide(p),getSlotResult:p=>s.getSlotResult(p),isSlotDecided:p=>{var g,_;return(_=(g=s.isSlotDecided)==null?void 0:g.call(s,p))!=null?_:!0},getSlotConfig:p=>s.getSlotConfig(p),getSitePalette:()=>s.getSitePalette(),reportSlots:(p,g)=>s.reportSlots(p,g),requestSlots:(p,g)=>{var _;return l?(_=s.requestSlots)==null?void 0:_.call(s,p,g):c.push([p,g])},decideSlots:p=>{var g;return l?(g=s.decideSlots)==null?void 0:g.call(s,p):d.push(...p)},cancelSlots:p=>{var g;if(l)return(g=s.cancelSlots)==null?void 0:g.call(s,p);let _=new Set(p);for(let v of c)v[0]=v[0].filter(O=>!_.has(O));d=d.filter(v=>!_.has(v.id))},onSlotsChanged:p=>(u.add(p),()=>{u.delete(p)}),getPersona:()=>s.getPersona(),fetchWeights:()=>s.fetchWeights(),getGraph:()=>s.getGraph(),dispose:()=>s.dispose(),destroy:()=>s.destroy()};function C(p){var g,_,v;s=p,l=!0,(g=p.onSlotsChanged)==null||g.call(p,()=>u.forEach(O=>O()));for(let[O,b]of c.splice(0))O.length>0&&((_=p.requestSlots)==null||_.call(p,O,b));d.length>0&&((v=p.decideSlots)==null||v.call(p,d.splice(0)))}return{proxy:m,setInner:C}}function Zt(e,t,n){let r=e.get(t);if(r)return r;let o=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,o),o}function Ye(e){var t,n,r,o,a,i,s,l,u,c;if(typeof window=="undefined")return He;Zn=e.apiKey||"local";let d=le.get(e.apiKey||"local");if(d!=null&&d.dispose)try{d.dispose()}catch(f){}let m=e.respectDoNotTrack!==!1&&Ie(),C=e.consent===!1||m,p=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!p&&e.localMode!==!1)return le.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),C?He:No(e);if(C){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."),le.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): the client was initialized with an invalid apiKey (expected a pk_ public key) \u2014 consent cannot enable tracking."}),He;let{proxy:f,setInner:y}=Wo(e);return le.set(e.apiKey,{config:e,upgrade:m?null:y}),f}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."),He;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),He;let g=(t=e.ingestUrl)!=null?t:Xn,_=Date.now(),v=qn({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),O=Mo(void 0,e.apiKey),b=Lo({ingestUrl:g,apiKey:e.apiKey}),w=er(g),h={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},A=new Set,E=Po({url:`${w}/goals`,apiKey:e.apiKey,headers:h,onDrop:(f,y)=>{if(!e.debug){if(A.has(y))return;A.add(y)}console.warn(`[sentient] goal dropped (HTTP ${y}) \u2014 this will not be retried. `+(y===400?"The session was not found: call init() and let the session upsert complete before firing goals.":y===401||y===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),f)}}),F=Tn((n=navigator.userAgent)!=null?n:""),M=window.location.origin,q=Rn((r=document.referrer)!=null?r:"",M),W=(o=e.sessionSegment)!=null?o:`${F}:${q}`,ne=new Map,fe=new Map,S=new Map,T=new Set,Y=new Map,ee=null,x=null,K=new Set,R=new Set,z=new Map,Z=null,Re=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,Ue=new Set,pe=new Set,st=new Set,Fe=new Map,jt=null,at=new Set,ze=new Map,Gt=null,Jr=2,fn=new Map,Ut=!1,pn=(f,y,k)=>{var $;let B=new Set,I=1;for(let P of f){y.delete(P);let D=(($=fn.get(P))!=null?$:0)+1;fn.set(P,D),D<=Jr&&(B.add(P),D>I&&(I=D))}B.size>0&&setTimeout(()=>{Ut||k(B)},Me(I))},gn=f=>{for(let y of f)S.has(y.id)||S.set(y.id,Wt(y))};if(e.initialSlots)for(let[f,y]of Object.entries(e.initialSlots))S.set(f,y),T.add(f);if(e.initialSlotConfig)for(let[f,y]of Object.entries(e.initialSlotConfig))Y.set(f,y);e.initialPalette&&(ee=e.initialPalette);let be=Ve(e.apiKey);if(be){for(let[f,y]of Object.entries(be.slots))S.has(f)||S.set(f,y);for(let[f,y]of Object.entries((a=be.slotConfig)!=null?a:{}))Y.has(f)||Y.set(f,y);!ee&&be.palette&&(ee=be.palette)}let mn={low:.15,medium:.5,high:.85};if(e.initialPersona)x=N({},e.initialPersona);else{let f=document.documentElement.dataset;f.sentientPersona?x={persona:f.sentientPersona,confidence:(s=mn[(i=f.sentientConfidence)!=null?i:"low"])!=null?s:.15}:be&&(x={persona:be.persona,confidence:(l=mn[be.band])!=null?l:.15})}if(e.initialAssignments)for(let[f,y]of Object.entries(e.initialAssignments))O.set(f,W,{variantId:y,assignedAt:Date.now(),segment:W,confidence:1});let Se=Promise.resolve(),hn=v.getSessionId();if(hn){let f=Pn((u=document.referrer)!=null?u:""),{utmParams:y,clickIds:k}=qo(),$=N(N(N(N({sessionId:hn,deviceClass:F,trafficSource:q,referrerDomain:f,utmParams:y,clickIds:k,timeOfDay:Mn(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:v.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Ln((c=navigator.userAgent)!=null?c:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),B=async()=>{for(let I=0;;I++){try{let P=await fetch(`${w}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify($),headers:h});if(P.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(P.ok||Qt(P)==="dropped")return}catch(P){}if(I>=Uo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(P=>setTimeout(P,Me(I+1)))}};try{Se=B()}catch(I){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:b});let Yr=Fo(),qe=null,Ft=!1,oe={goal(f,y={},k=1,$=0){var B,I,P,D,J,ie,se;let we=v.getSessionId();if(!we)return;let re=Go(y)?y:{metadata:y},lt=[f,(B=re.externalId)!=null?B:"",(I=re.stepIndex)!=null?I:$,(P=re.weight)!=null?P:k].join("\0"),ct=re.value!==void 0?`${re.value}\0${(D=re.currency)!=null?D:""}`:null;if(Yr.firedBefore(lt,ct)){e.debug&&console.log(`[sentient] goal("${f}") already recorded for this action \u2014 not sent twice`);return}let Pe=Yt(),G={sessionId:we,name:f,metadata:(J=re.metadata)!=null?J:{},weight:(ie=re.weight)!=null?ie:k,stepIndex:(se=re.stepIndex)!=null?se:$,goalId:Pe,value:re.value,currency:re.currency,externalId:re.externalId};e.debug&&console.log("[sentient] goal",G);let Ee={id:Pe,body:JSON.stringify(G)};Se.then(()=>E.send(Ee))},componentGoal(f,y,k){var $,B,I;let P=v.getSessionId();if(!P)return;let D=O.get(f,W),J=D?null:($=S.get(f))!=null?$:null;if(!D&&J===null){e.debug&&console.warn(`[sentient] componentGoal("${f}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!D&&!T.has(f)){e.debug&&console.warn(`[sentient] componentGoal("${f}"): slot not decided this session \u2014 not attributed`);return}let ie=D?D.variantId:$n(J),se={id:Yt(),sessionId:P,projectId:e.apiKey,componentId:f,variantId:ie,eventType:"goal_achieved",goalType:y,payload:N({reward:(B=k==null?void 0:k.reward)!=null?B:1,goalValue:k==null?void 0:k.value,currency:k==null?void 0:k.currency},(I=k==null?void 0:k.metadata)!=null?I:{}),timestamp:Date.now(),timeInSession:Date.now()-_,path:ht()};e.debug&&console.log("[sentient] componentGoal",se),Se.then(()=>b.push(se))},identify(f){let y=v.getSessionId();y&&Se.then(()=>{fetch(`${w}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:y,userId:f,ephemeral:v.isEphemeral()}),headers:h}).catch(()=>{})})},track(f){let y=v.getSessionId();if(!y||f.eventType==="variant_assigned"&&S.get(f.componentId)!==void 0&&!T.has(f.componentId)&&!O.get(f.componentId,W))return;let k=_e(N({path:ht()},f),{id:Yt(),sessionId:y,timestamp:Date.now(),timeInSession:Date.now()-_});e.debug&&console.log("[sentient] track",k),Se.then(()=>b.push(k))},getAssignment(f,y){return O.get(f,y)},async assign(f,y,k,$){let B=v.getSessionId();if(!B)return null;let I=O.get(f,W);if(I&&(y!=null&&y.length||I.content!==void 0)){let P=I.ttlMs&&I.ttlMs>0?Math.max(0,I.assignedAt+I.ttlMs-Date.now()):0;return{variantId:I.variantId,assignmentTtlMs:P,content:I.content}}return Zt(ne,f,async()=>{await Se;try{let P={sessionId:B,componentId:f,variantIds:y};$!==void 0?P.agentDataByVariant=$:k!==void 0&&(P.agentData=k);let D=await fetch(`${w}/assign`,{method:"POST",body:JSON.stringify(P),headers:h});if(!D.ok)return null;let J=await D.json();return O.set(f,W,N({variantId:J.variantId,assignedAt:Date.now(),segment:W,confidence:1,content:J.content},J.assignmentTtlMs&&J.assignmentTtlMs>0?{ttlMs:J.assignmentTtlMs}:{})),J}catch(P){return null}})},async decide(f){var y,k;let $=v.getSessionId();if(!$)return null;let B=(y=f.slots)!=null?y:[],I={sessionId:$};f.sections&&f.sections.length>0&&(I.sections=f.sections.map(D=>({id:D}))),I.components=(k=f.components)!=null?k:[],B.length>0&&(I.slots=B.map(qt)),f.slotsFrom==="registry"&&(I.slotsFrom="registry",f.registrySlotIds&&(I.registrySlotIds=f.registrySlotIds),f.bootstrap===!1&&(I.bootstrap=!1)),f.v&&(I.v=f.v),typeof f.pp=="number"&&(I.pp=f.pp),e.persona&&(I.persona=e.persona);let P=JSON.stringify(I);return Zt(fe,P,async()=>{var D,J,ie,se,we,re,lt,ct;await Se;try{let Pe=await fetch(`${w}/decide`,{method:"POST",body:P,headers:h});if(!Pe.ok)return gn(B),null;let G=await Pe.json(),Ee={};for(let H of B){let ge=(D=G.slots)==null?void 0:D[H.id];if(ge!==void 0){Ee[H.id]=ge,S.set(H.id,ge),T.add(H.id);continue}let yn=S.get(H.id);if(yn!==void 0)Ee[H.id]=yn;else{let vn=Wt(H);Ee[H.id]=vn,S.set(H.id,vn)}}if(G.slots)for(let[H,ge]of Object.entries(G.slots))H in Ee||(Ee[H]=ge,S.set(H,ge),T.add(H));let Xr=x!=null&&x.persona!=="unknown";G.persona&&!(G.persona==="unknown"&&Xr)?x={persona:G.persona,confidence:(J=G.confidence)!=null?J:0}:x||(x={persona:"unknown",confidence:0});for(let[H,ge]of Object.entries((ie=G.assignments)!=null?ie:{}))O.set(H,W,{variantId:ge,assignedAt:Date.now(),segment:W,confidence:1});if(G.slotConfig)for(let[H,ge]of Object.entries(G.slotConfig))Y.set(H,ge);G.palette&&(ee=G.palette);for(let H of(se=f.registrySlotIds)!=null?se:[])(we=G.slotConfig)!=null&&we[H]||(Y.delete(H),S.delete(H),T.delete(H));return Ne(e.apiKey,N(N({v:1,persona:x.persona,band:Oe(x.confidence),slots:Object.fromEntries(S),layoutOrder:(re=G.layoutOrder)!=null?re:null,savedAt:Date.now()},Y.size>0?{slotConfig:Object.fromEntries(Y)}:{}),ee?{palette:ee}:{})),N(N(N(N({layoutOrder:(lt=G.layoutOrder)!=null?lt:null,assignments:(ct=G.assignments)!=null?ct:{},slots:Ee,persona:x.persona,confidence:x.confidence},G.slotConfig?{slotConfig:G.slotConfig}:{}),G.goals?{goals:G.goals}:{}),G.sectionMap?{sectionMap:G.sectionMap}:{}),G.palette?{palette:G.palette}:{})}catch(Pe){return gn(B),null}})},getSlotResult(f){var y;return(y=S.get(f))!=null?y:null},isSlotDecided(f){return T.has(f)},getSlotConfig(f){var y;return(y=Y.get(f))!=null?y:null},reportSlots(f,y){for(let k of f)if(!(typeof k!="string"||k.length===0)){if(!Re.test(k)){jo()&&!Ue.has(k)&&(Ue.add(k),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(k)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!K.has(k)){K.add(k),R.add(k);let $=y==null?void 0:y[k];if(typeof $=="string"){let B=$.replace(/\s+/g," ").trim().slice(0,400);B!==""&&z.set(k,B)}}}R.size===0||Z!=null||(Z=setTimeout(()=>{Z=null;let k=[...R];R.clear();for(let $=0;$<k.length;$+=20){let B=k.slice($,$+20),I={};for(let P of B){let D=z.get(P);D!==void 0&&(I[P]=D,z.delete(P))}fetch(`${w}/slots/observed`,{method:"POST",headers:h,body:JSON.stringify(N({slotIds:B},Object.keys(I).length>0?{baselineTexts:I}:{}))}).catch(()=>{})}},1e3))},requestSlots(f,y){for(let k of f)st.has(k)||(st.add(k),Re.test(k)?Fe.set(k,y==null?void 0:y[k]):oe.reportSlots([k]));Fe.size===0||jt!=null||(jt=setTimeout(()=>{jt=null;let k=[...Fe];Fe.clear();for(let $=0;$<k.length;$+=50){let B=k.slice($,$+50);oe.decide({slotsFrom:"registry",registrySlotIds:B.map(([I])=>I),bootstrap:!1}).then(I=>{var P;if(I){let D={},J=[];for(let[ie,se]of B)(P=I.slotConfig)!=null&&P[ie]||(J.push(ie),se&&(D[ie]=se));J.length>0&&oe.reportSlots(J,D)}else pn(B.map(([D])=>D),st,D=>{var J;let ie={};for(let[se,we]of B)D.has(se)&&we&&(ie[se]=we);(J=oe.requestSlots)==null||J.call(oe,[...D],ie)});pe.forEach(D=>D())})}},0))},decideSlots(f){for(let y of f)at.has(y.id)||(at.add(y.id),ze.set(y.id,y));ze.size===0||Gt!=null||(Gt=setTimeout(()=>{Gt=null;let y=[...ze.values()];ze.clear();for(let k=0;k<y.length;k+=30){let $=y.slice(k,k+30);oe.decide({slots:$}).then(B=>{B||pn($.map(I=>I.id),at,I=>{var P;return(P=oe.decideSlots)==null?void 0:P.call(oe,$.filter(D=>I.has(D.id)))}),pe.forEach(I=>I())})}},0))},cancelSlots(f){for(let y of f)Fe.delete(y)&&st.delete(y),ze.delete(y)&&at.delete(y)},onSlotsChanged(f){return pe.add(f),()=>{pe.delete(f)}},getSitePalette(){return ee},getPersona(){return x?{persona:x.persona,confidence:x.confidence,band:Oe(x.confidence)}:null},async fetchWeights(){var f;try{let y=await fetch(`${w}/weights`,{headers:h});return y.ok?(f=(await y.json()).components)!=null?f:[]:[]}catch(y){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){var f;qe==null||qe(),Ft=!0,Ut=!0,b.destroy(),E.destroy(),((f=le.get(e.apiKey))==null?void 0:f.dispose)===oe.dispose&&le.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var f;qe==null||qe(),Ft=!0,Ut=!0,b.destroy(),E.destroy(),v.destroy(),O.clear(),((f=le.get(e.apiKey))==null?void 0:f.dispose)===oe.dispose&&le.delete(e.apiKey);try{localStorage.removeItem(yt+e.apiKey),localStorage.removeItem(Vn(e.apiKey)),localStorage.removeItem(Jn(e.apiKey))}catch(y){}e.debug&&console.log("[sentient] destroyed")}};if(le.set(e.apiKey,{config:e,upgrade:null,dispose:oe.dispose}),qe=zo(oe,e.apiKey,f=>{Se.then(()=>{Ft||Qn.add(f)})}),e.debug){let f=window;f.__sentient&&(f.__sentient.client=oe)}return oe}var Ho=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function rn(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function Vo(e){return{tag:e.tagName.toLowerCase(),text:rn(e).slice(0,40)}}function tr(e){return e.replace(/["\\\]]/g,"\\$&")}function Xe(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function nr(e,t){var n;let r=e.tagName.toLowerCase();if(!r)return null;let o=((n=e.getAttribute("class"))!=null?n:"").split(/\s+/).filter(s=>/^[a-zA-Z][\w-]*$/.test(s)),a=[r,...o.map(s=>`${r}.${s}`)];for(let s of a)if(Xe(t,s))return s;let i=e.parentElement;if(i&&i!==t){let s=nr(i,t);if(s){for(let d of a){let m=`${s} > ${d}`;if(Xe(t,m))return m}let l=Array.from(i.children).filter(d=>d.tagName.toLowerCase()===r),u=l.indexOf(e),c=l.some(d=>d!==e&&rn(d)!==rn(e));if(u>=0&&c){let d=`${s} > ${r}:nth-of-type(${u+1})`;if(Xe(t,d))return d}}}return null}function rr(e,t){let n=Vo(e),r=e.getAttribute("id");if(r&&Xe(t,`#${tr(r)}`))return{v:1,id:r,fingerprint:n};for(let a of Ho){let i=e.getAttribute(a);if(i&&Xe(t,`[${a}="${tr(i)}"]`))return{v:1,dataAttr:{name:a,value:i},fingerprint:n}}let o=nr(e,t);return o?{v:1,selector:o,fingerprint:n}:null}We();var ir=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Jo={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Yo(e){let t=e.ariaRole?Jo[e.ariaRole.toLowerCase()]:void 0;if(t)return t;if(e.tag==="nav")return"navigation";if(e.tag==="footer")return"footer";if(e.tag==="header")return e.actionCount>=5?"navigation":"hero";let n=`${e.idClass} ${e.headingText}`.toLowerCase();return/\b(navbar|nav-bar|navigation|site-nav|main-nav|topbar|footer)\b/.test(n)?/footer/.test(n)?"footer":"navigation":/\b(hero|masthead|jumbotron)\b/i.test(e.idClass)?"hero":null}function Xo(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var Zo=[["pricing",/\b(pricing|price list|per month|\/mo|subscriptions?)\b|\bplans?\b(?=[^.]{0,40}(from|start|month|year|[$€£]))/i],["faq",/\bfaq\b|frequently asked|common questions?/i],["comparison",/\b(compare|comparison|versus)\b|\bvs\./i],["social_proof",/\b(reviews?|ratings?|testimonial|brands?|galler(y|ies)|logos)\b|trusted by|loved by|case stud|what our customers say/i],["trust",/\b(insurance|warrant(y|ies)|guarantees?|certifi|accredit|security|privacy|compliance|gdpr|encrypt)\b|why choose|about us|our team/i],["cta",/\b(book|booking|reserve|appointments?|newsletter|subscribe)\b|contact us|get in touch|opening hours/i],["features",/\b(features?|benefits?|capabilit|services?|repairs?|menus?|products?)\b|how it works|our process|what we (do|offer)|what you get/i]],on=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|free returns?|returns? within|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]],or={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function Qo(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function sr(e){var t,n;let r=Yo(e);if(r)return{type:(t=or[r])!=null?t:"generic",strength:"strong"};let o=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,s]of Zo)if(s.test(o))return{type:i,strength:"strong"};for(let[i,s]of on)if(s.test(e.bodyText))return{type:i,strength:"strong"};let a=Xo(e);return{type:(n=or[a])!=null?n:"generic",strength:"weak"}}function ar(e){var t,n;let r=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),o=e.getAttribute("role");return N({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:Qo(e),bodyText:r.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:r.length},o?{ariaRole:o}:{})}We();var ei="section, header, footer, nav, main > div, [data-sentient-section]",ti=2e4;function ni(e){let t=Array.from(e.querySelectorAll(ei)),n=t.filter(r=>t.filter(o=>o!==r&&r.contains(o)).length<2);return n.filter(r=>!n.some(o=>o!==r&&o.contains(r)))}function ri(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 lr=()=>{};function cr(e,t){var n,r,o,a,i,s,l,u,c,d,m,C,p,g,_;let v=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!v||typeof IntersectionObserver=="undefined"||Ie()||!t.apiKey||!t.apiKey.startsWith("pk_"))return lr;let O=((r=t.apiBase)!=null?r:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),b=ni(v);if(b.length===0)return lr;let w=new Map,h=[];for(let x of b){let K=(i=[(a=t.sectionTypes)==null?void 0:a[(o=x.getAttribute("data-sentient-id"))!=null?o:""],x.getAttribute("data-sentient-type")].find(pe=>ir.includes(pe)))!=null?i:null,R=ar(x),z=(l=K!=null?K:(s=t.typeOf)==null?void 0:s.call(t,x))!=null?l:sr(R).type,Z=rr(x,v),Re=Z?`nc-${z}-${On(JSON.stringify({id:(u=Z.id)!=null?u:null,dataAttr:(c=Z.dataAttr)!=null?c:null,selector:(d=Z.selector)!=null?d:null})).toString(36)}`:`nc-${z}`;w.set(x,Re);let Ue=on.filter(([,pe])=>pe.test(R.bodyText)).map(([pe])=>pe);h.push(_e(N({componentId:Re,semanticType:z,source:K?"markup":"auto"},Z?{locator:Z}:{}),{observation:N(N({tag:R.tag,idClass:R.idClass.slice(0,200),headingText:R.headingText,textLength:R.textLength,actionCount:R.actionCount},R.ariaRole?{ariaRole:R.ariaRole}:{}),Ue.length>0?{patternFlags:Ue}:{})}))}let A=(g=(p=(C=(m=v.defaultView)!=null?m:typeof window!="undefined"?window:void 0)==null?void 0:C.location)==null?void 0:p.pathname)!=null?g:"/";ri(t.apiKey,O,A,h);let E=new Map,F=x=>{let K=E.get(x);return K||(K={ms:0,scroll:0,enterAt:null,intersecting:!1},E.set(x,K)),K},M=new IntersectionObserver(x=>{for(let K of x){let R=w.get(K.target);if(!R)continue;let z=F(R);K.isIntersecting?(z.intersecting=!0,z.enterAt=Date.now(),K.intersectionRatio>z.scroll&&(z.scroll=K.intersectionRatio)):(z.intersecting=!1,z.enterAt!=null&&(z.ms+=Date.now()-z.enterAt,z.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let x of w.keys())M.observe(x);let q=()=>{let x=Date.now();for(let[K,R]of E)if(R.enterAt!=null&&(R.ms+=x-R.enterAt,R.enterAt=null),!(R.ms<=0)){try{e.track({projectId:t.apiKey,componentId:K,eventType:"dwell",payload:{dwell_time:Math.round(R.ms),scroll_depth:Number(R.scroll.toFixed(2))}})}catch(z){}R.ms=0}},W=()=>{if(v.hidden)q();else{let x=Date.now();for(let K of E.values())K.intersecting&&(K.enterAt=x)}},ne=!1,fe=x=>{if(q(),x!=null&&x.persisted){ne=!0;return}try{M.disconnect()}catch(K){}},S=x=>{if(!(x!=null&&x.persisted)||!ne)return;ne=!1;let K=Date.now();for(let R of E.values())R.enterAt=R.intersecting&&!v.hidden?K:null};v.addEventListener("visibilitychange",W);let T=(_=v.defaultView)!=null?_:typeof window!="undefined"?window:void 0;T==null||T.addEventListener("pagehide",fe),T==null||T.addEventListener("pageshow",S);let Y=setInterval(()=>{if(v.hidden||ne)return;q();let x=Date.now();for(let K of E.values())K.intersecting&&(K.enterAt=x)},ti),ee=[];return t.microSignals&&[...w.entries()].forEach(([x,K],R)=>{ee.push(Je((z,Z={})=>{try{e.track({projectId:t.apiKey,componentId:K,eventType:"micro_signal",payload:N({signalType:z},Z)})}catch(Re){}},x,void 0,{tabLoss:R===0}))}),()=>{q(),clearInterval(Y),v.removeEventListener("visibilitychange",W),T==null||T.removeEventListener("pagehide",fe),T==null||T.removeEventListener("pageshow",S);for(let x of ee)x();try{M.disconnect()}catch(x){}}}function oi(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(a=>typeof a=="string"))return null;n[r]=o}return n}function ii(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function si(e){try{return e()}catch(t){return}}function St(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={};if(typeof t.slots=="object"&&t.slots!==null&&!Array.isArray(t.slots))for(let[a,i]of Object.entries(t.slots)){if(typeof i!="object"||i===null)continue;let s=i,l=oi(s.dims);if(!l||s.target!==void 0&&typeof s.target!="string")continue;let u=s.arms!==void 0?ii(s.arms):null,c={dims:l};typeof s.target=="string"&&(c.target=s.target),u&&(c.arms=u),n[a]=c}let r={apiKey:t.apiKey,personaAttributes:t.personaAttributes===!0,slots:n};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),typeof t.sectionCapture=="boolean"&&(r.sectionCapture=t.sectionCapture);let o=typeof t.persona=="function"?si(t.persona):t.persona;if(typeof o=="string"&&o.trim()!==""&&(r.persona=o),Array.isArray(t.sections)){let a=t.sections.filter(i=>typeof i=="string"&&i.trim()!=="").slice(0,50);a.length>=2&&(r.sections=a)}return r}function Ze(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 ai(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:"").replace(/\s+/g," ").trim().toLowerCase(),o=t.text.replace(/\s+/g," ").trim().toLowerCase();if(!(r===o||r.startsWith(o)||o.startsWith(r)))return!1}return!0}function wt(e,t){return!!(e!=null&&e.urlMatch)&&!Ze(t).includes(e.urlMatch)}var li=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function ur(e,t){var r;let n=[];if(e.id){let o=t.getElementById(e.id);n=o?[o]:[]}if(n.length===0&&((r=e.dataAttr)!=null&&r.name)&&li.test(e.dataAttr.name))try{let o=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${o}"]`))}catch(o){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(o){n=[]}return n}function ye(e,t){if(e.urlMatch&&!Ze(t).includes(e.urlMatch))return null;let n=ur(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!ai(r,e.fingerprint)?null:r}function dr(e,t){return wt(e,t)?!1:!!e.selector&&!e.dataAttr&&!e.id&&!e.fingerprint&&e.page===void 0?fr(e,t):ye(e,t)!==null}function fr(e,t){return ur(e,t).length>0}function Et(e,t){return wt(e,t)?!1:e.page!==void 0&&vt.test(e.page)?en(e.page,Ze(t)):fr(e,t)}var pr={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"},ci=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function gr(e){var r;if(e.trim().length===0||/[;{}<>]/.test(e))return!1;let t=/([A-Za-z-]*)\(/g,n;for(;(n=t.exec(e))!==null;)if(!ci.test((r=n[1])!=null?r:""))return!1;return!0}var mr=/^https:\/\//i,hr=new Map,Ae=null;function ui(e){return e.replace(/["\\]/g,"\\$&")}function di(e){var t;(!Ae||!Ae.isConnected)&&(Ae=e.querySelector("style[data-sentient-ops]"),Ae||(Ae=e.createElement("style"),Ae.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Ae))),Ae.textContent=[...hr.entries()].map(([n,r])=>`[data-snt-e="${ui(n)}"]{${r}}`).join(`
2
- `)}function yr(e,t,n,r){var s;let o=!1,a=(s=t.moveBefore)!=null?s:t.moveAfter;if(a){let l=ye(a,r);!l||l===e||l.parentElement!==e.parentElement||!e.parentElement?o=!0:t.moveBefore?e.parentElement.insertBefore(e,l):e.parentElement.insertBefore(e,l.nextSibling)}typeof t.text=="string"&&(e.textContent=t.text),typeof t.href=="string"&&mr.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&mr.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let i=[];if(t.hidden&&i.push("display:none !important"),t.style)for(let[l,u]of Object.entries(t.style)){let c=pr[l];c&&typeof u=="string"&&gr(u)&&i.push(`${c}:${u.trim()} !important`)}return i.length>0&&(e.setAttribute("data-snt-e",n),hr.set(n,i.join(";")),di(r)),{anchorMiss:o}}var Qe="data-sentient-block-arm",L=null;function et(e){L=e!=null?e:null}var ve="data-sentient-blocks-hid",Ke={none:"0",sm:"8px",md:"16px",lg:"24px"},sn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},vr={sm:"0.875em",md:"1em",lg:"1.25em"},fi={sm:"1.25em",md:"1.5em",lg:"2em"},pi={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},br={sm:"8px",md:"16px",lg:"32px"},gi={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},mi={normal:"400",medium:"500",bold:"700"};function ce(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function Sr(e){return e==="muted"?L!=null&&L.muted?{color:L.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:L==null?void 0:L.accent}:{}}function wr(e,t){var n,r,o,a,i,s,l,u,c,d,m,C,p,g,_,v,O,b,w,h;try{switch(e.type){case"stack":case"grid":{let A=t.createElement("div");if(e.type==="stack"){let M=e;ce(A,{display:"flex","flex-direction":M.direction,gap:(r=Ke[(n=M.gap)!=null?n:"md"])!=null?r:Ke.md,"align-items":M.align?sn[M.align]:void 0,"justify-content":M.justify?sn[M.justify]:void 0,"flex-wrap":M.wrap?"wrap":void 0})}else{let M=e,q=(a=Ke[(o=M.gap)!=null?o:"md"])!=null?a:Ke.md;ce(A,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${M.columns-1} * ${q}) / ${M.columns})), 1fr))`,gap:q,"align-items":M.align?sn[M.align]:void 0})}let E=e.type==="stack"&&e.surface==="raised",F=(i=e.pad)!=null?i:E?"md":void 0;F&&ce(A,{padding:(s=Ke[F])!=null?s:Ke.md}),E&&ce(A,{background:L==null?void 0:L.surface,color:L!=null&&L.surface?L==null?void 0:L.surfaceText:void 0,border:`1px solid ${(l=L==null?void 0:L.border)!=null?l:"currentColor"}`,"border-radius":(u=L==null?void 0:L.radius)!=null?u:"8px"});for(let M of(c=e.children)!=null?c:[]){let q=wr(M,t);q&&A.appendChild(q)}return A}case"text":{let A=t.createElement("p");return A.textContent=e.value,ce(A,De(j({margin:"0","font-size":e.size?vr[e.size]:void 0,"font-weight":e.weight?mi[e.weight]:void 0,"text-align":e.align},Sr(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let A=t.createElement(`h${e.level}`);return A.textContent=e.value,ce(A,{margin:"0","font-size":fi[(d=e.size)!=null?d:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let A=t.createElement("a");A.textContent=e.label,A.href=e.href,e.tag&&A.setAttribute("data-sentient-tag",e.tag);let E=(m=e.emphasis)!=null?m:"primary";return ce(A,{display:"inline-block",padding:pi[(C=e.size)!=null?C:"md"],"border-radius":(p=L==null?void 0:L.radius)!=null?p:"8px",font:"inherit","font-size":e.size?vr[e.size]:void 0,"text-decoration":E==="ghost"?"underline":"none",cursor:"pointer",background:E==="primary"?(g=L==null?void 0:L.primaryBg)!=null?g:"#111827":"transparent",color:E==="primary"?(_=L==null?void 0:L.primaryText)!=null?_:"#ffffff":(v=L==null?void 0:L.accent)!=null?v:"inherit",border:E==="secondary"?`1px solid ${(O=L==null?void 0:L.accent)!=null?O:"currentColor"}`:"none"})}case"link":{let A=t.createElement("a");return A.textContent=e.label,A.href=e.href,e.tag&&A.setAttribute("data-sentient-tag",e.tag),ce(A,{color:"inherit","text-decoration":"underline"})}case"image":{let A=t.createElement("img");return A.src=e.src,A.alt=e.alt,ce(A,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?gi[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let A=t.createElement("span");return A.textContent=e.value,ce(A,j({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(b=L==null?void 0:L.border)!=null?b:"currentColor"}`},Sr(e.tone)))}case"spacer":return ce(t.createElement("div"),{height:(w=br[e.size])!=null?w:br.md});case"divider":return ce(t.createElement("hr"),{border:"none","border-top":`1px solid ${(h=L==null?void 0:L.border)!=null?h:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(A){return null}}function Er(e,t,n,r){try{let o=new Set;for(let i of Array.from(e.children)){let s=i.getAttribute(Qe);s!==null&&(t[s]===void 0?i.remove():o.add(s))}for(let[i,s]of Object.entries(t)){if(o.has(i))continue;let l=wr(s,r);if(!l)continue;let u=r.createElement("div");u.setAttribute(Qe,i),u.style.display="none",u.appendChild(l),e.appendChild(u)}let a=n!==void 0&&t[n]!==void 0;for(let i of Array.from(e.children)){let s=i.getAttribute(Qe),l=i;s!==null?l.style.display=a&&s===n?"":"none":a?l.hasAttribute(ve)||(l.setAttribute(ve,l.style.display),l.style.display="none"):l.hasAttribute(ve)&&(l.style.display=l.getAttribute(ve),l.removeAttribute(ve))}}catch(o){}}function hi(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(Qe)!==null){n.remove();continue}n.hasAttribute(ve)&&(n.style.display=n.getAttribute(ve),n.removeAttribute(ve))}}catch(t){}}function At(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${Qe}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${ve}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||hi(r)}catch(n){}}function an(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function xt(e,t,n,r){n.documentElement.setAttribute("data-sentient-persona",e),n.documentElement.setAttribute("data-sentient-confidence",t),r==null||r(n.documentElement,"data-sentient-persona"),r==null||r(n.documentElement,"data-sentient-confidence")}function kt(e,t,n,r){var o;for(let[a,i]of Object.entries(t)){let s=e[a];if(!s||typeof s=="string")continue;let l=an(i.target,n);for(let u of l)for(let[c,d]of Object.entries(s))(o=i.dims[c])!=null&&o.includes(d)&&(u.setAttribute(`data-${c}`,d),r==null||r(u,`data-${c}`))}}function Ct(e,t,n,r){for(let[o,a]of Object.entries(t)){let i=e[o];if(typeof i!="string"||!a.arms||!a.arms.includes(i))continue;let s=an(a.target,n);for(let l of s)l.setAttribute("data-sentient-arm",i),r==null||r(l,"data-sentient-arm")}}function _t(e,t,n,r){var s,l,u,c;let o=new Set,a=(s=r==null?void 0:r.contentAndOps)!=null?s:!0,i=[];for(let[d,m]of Object.entries(t)){if(wt(m.locator,n))continue;let C;if(m.locator){let g=ye(m.locator,n);C=g?[g]:[],!g&&Et(m.locator,n)&&i.push(d)}else C=an(m.target,n);let p=e[d];for(let g of C){if(p!==void 0)if(typeof p=="string")g.setAttribute("data-sentient-arm",p),(l=r==null?void 0:r.onAttr)==null||l.call(r,g,"data-sentient-arm"),a&&((u=r==null?void 0:r.onApplied)==null||u.call(r,d,p,g));else for(let[v,O]of Object.entries(p))g.setAttribute(`data-${v}`,O),(c=r==null?void 0:r.onAttr)==null||c.call(r,g,`data-${v}`);if(m.blocks&&!vi(n)){let v=Object.fromEntries(Object.entries(m.blocks).filter(([,O])=>!bt(O)));Object.keys(v).length>0&&(Er(g,v,typeof p=="string"?p:void 0,n),o.add(g))}if(!a)continue;let _=g.textContent;typeof m.content=="string"&&(g.textContent=m.content),m.ops&&yr(g,m.ops,d,n).anchorMiss&&!i.includes(d)&&i.push(d),tn(g,De(j(j({previous:_},typeof p=="string"?{arm:p}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return At(n,o),i}var yi=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function vi(e){var t,n,r;try{let o=(n=(t=e.defaultView)!=null?t:typeof window!="undefined"?window:void 0)==null?void 0:n.navigator;return o?o.webdriver===!0?!0:yi.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var bi=800;function Ot(e,t,n){let r=[];return n.forEach(({slotId:o,arm:a,el:i},s)=>{r.push(Je((m,C={})=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"micro_signal",payload:j({signalType:m},C)})}catch(p){}},i,void 0,{tabLoss:s===0}));let l=null,u=0,c=()=>{u=Date.now(),l=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-u}})}catch(m){}l=null},bi)},d=()=>{l!==null&&(clearTimeout(l),l=null)};i.addEventListener("mouseenter",c),i.addEventListener("mouseleave",d),r.push(()=>{i.removeEventListener("mouseenter",c),i.removeEventListener("mouseleave",d),l!==null&&clearTimeout(l)})}),()=>{for(let o of r)o()}}function Si(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 xr(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var wi="_snt_fired_goals";function kr(e,t){try{e==null||e.sessionStorage.removeItem(xr(t)),e==null||e.sessionStorage.removeItem(wi)}catch(n){}}function Ar(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function Ei(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(o=>typeof o=="string")):new Set}catch(n){return new Set}}function Ai(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function It(e,t,n,r){var v,O;let o=(v=n.defaultView)!=null?v:typeof window!="undefined"?window:null,a=xr(r),i=Ei(o,a),s=b=>{let w=Ar(b);if(!i.has(w))try{b.slotId?t.componentGoal(b.slotId,b.goalId):t.goal(b.goalId),i.add(w),Ai(o,a,i)}catch(h){}},l=e.filter(b=>b.event==="click"),u=e.filter(b=>b.event==="form_submit"),c=e.filter(b=>b.event==="url_reached"),d=e.filter(b=>b.event==="scroll_depth"),m=(b,w)=>{if(!b.locator)return!1;let h=ye(b.locator,n);return!!h&&(h===w||h.contains(w))},C=b=>{let w=b.target;if(!(!w||typeof w.closest!="function"))for(let h of l)m(h,w)&&s(h)},p=b=>{let w=b.target;if(w)for(let h of u)m(h,w)&&s(h)},g=()=>{if(c.length===0)return;let b=Ze(n);for(let w of c)w.urlPattern&&Si(w.urlPattern,b)&&s(w)},_=()=>{var h;let b=n.documentElement,w=b.scrollHeight>0?(b.scrollTop+b.clientHeight)/b.scrollHeight:0;for(let A of d)w>=((h=A.threshold)!=null?h:.75)&&s(A);d.every(A=>i.has(Ar(A)))&&n.removeEventListener("scroll",_)};return n.addEventListener("click",C,!0),n.addEventListener("submit",p,!0),(O=n.defaultView)==null||O.addEventListener("popstate",g),g(),d.length>0&&(n.addEventListener("scroll",_,{passive:!0}),_()),{checkUrl:g,teardown:()=>{var b;n.removeEventListener("click",C,!0),n.removeEventListener("submit",p,!0),(b=n.defaultView)==null||b.removeEventListener("popstate",g),d.length>0&&n.removeEventListener("scroll",_)}}}function Lt(e,t){if(!e||e.length<2||t.size!==e.length)return null;let n=[];for(let i of e){let s=t.get(i);if(!s||n.includes(s))return null;n.push(s)}let r=n[0].parentNode;if(!r||!n.every(i=>i.parentNode===r))return null;let o=n.slice().sort((i,s)=>i.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),a=[];for(let i=0;i<n.length;i++){let s=n[i];o[i]!==s&&(a.push({el:s,before:o[i]}),o.splice(o.indexOf(s),1),o.splice(i,0,s))}return a}var Cr="__snt_editor_token";function _r(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(Cr):null}catch(e){return null}}function Or(e){try{sessionStorage.setItem(Cr,e)}catch(t){}}var ot="0.28.0",Pt=ot!=="0.0.0-dev"?{name:"snippet",version:ot}:void 0,$r=ot!=="0.0.0-dev"?{v:ot}:{},Dt=5e3,xi=50,Br=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),Q=null,U=null,de={},ue=null,X=null,xe=null,te=null,he=null,V=null,Le=null,Ir=!1,ln=null,Tt=null,Mt=null,Te=!1,tt=!1,ke=!1,$t=null,Ce=[],Bt=null,nt=null,ae=null,ki=3e3,Ci=100;function Nt(e,t){let n,r=new Promise(o=>{n=setTimeout(()=>o(null),t)});return Promise.race([e,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}function me(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function je(e,t){return Q?(Q.personaAttributes&&V&&xt(V.persona,V.band,e,t==null?void 0:t.onAttr),kt(de,Q.slots,e,t==null?void 0:t.onAttr),Ct(de,Q.slots,e,t==null?void 0:t.onAttr),ue?_t(de,ue,e,j(j({},t),V?{persona:V.persona}:{})):(At(e,new Set),[])):[]}function Nr(e){var n;let t=new Map;for(let r of(n=Q==null?void 0:Q.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function cn(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=Lt(e,Nr(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function _i(e,t,n){let r=(o,a)=>t.some(([i,s])=>i===o&&s===a);try{if(Array.isArray(e.stamped))for(let o of e.stamped){if(!Array.isArray(o))continue;let[a,i,s]=o;!a||typeof i!="string"||r(a,i)||(s==null?a.removeAttribute(i):a.setAttribute(i,s))}if(Array.isArray(e.html))for(let o of e.html)typeof o!="string"||r(n.documentElement,o)||n.documentElement.removeAttribute(o)}catch(o){}}function Oi(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function Kr(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function Kt(e){var t;return(t=e.apiBase)!=null?t:"https://api.sentient-ui.com"}function Ii(e){return Promise.resolve().then(()=>fetch(`${Kt(e)}/v1/registry/locators`,{headers:{authorization:`Bearer ${e.apiKey}`}})).then(t=>t.ok?t.json():null).then(t=>Array.isArray(t==null?void 0:t.slots)?t.slots:null).catch(()=>null)}function jr(e,t){let n=[],r=[];for(let o of e)try{if(typeof(o==null?void 0:o.id)!="string")continue;!o.locator||dr(o.locator,t)?n.push(o.id):Et(o.locator,t)&&r.push(o.id)}catch(a){}return[n,r]}function Gr(e,t){let n=null;for(let r of t)e!=null&&e[r]&&((n!=null?n:n={})[r]=e[r]);return n}function Ur(){!$t||!Te||Bt===window.location.pathname||(Bt=window.location.pathname,Li())}function Li(){ae==null||ae();let e=Q,t=$t;if(!e||!t)return;let n,r,o=()=>{clearTimeout(n),clearTimeout(s),r==null||r.disconnect(),ae===o&&(ae=null)},a=null,i=l=>{let[u,c]=jr(t,document),d=u.filter(m=>!Ce.includes(m));a!==null&&u.some(m=>!a.has(m)&&!d.includes(m))&&it(),a=new Set(u),d.length>0&&Ti(d).catch(()=>{}),(l||c.length===0&&!t.some(m=>!u.includes(m.id)&&!Ce.includes(m.id)))&&(o(),Fr(e,c))},s=setTimeout(()=>i(!0),ki);if(ae=o,i(),ae===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(i,Ci)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(l){}}async function Ti(e){let t=Q,n=U;if(!t||!n)return;Ce=Ce.concat(e);let r=await Nt(n.decide(j({slotsFrom:"registry",registrySlotIds:e},$r)),Dt);if(r||(Ce=Ce.filter(a=>!e.includes(a))),!r||ke||U!==n)return;de=j(j({},de),r.slots);let o=Gr(r.slotConfig,e);o&&(ue=j(j({},ue),o)),it(),me(t,"late decide",e),nt&&Ne(t.apiKey,nt=j(De(j({},nt),{slots:de,savedAt:Date.now()}),ue?{slotConfig:ue}:{}))}function Fr(e,t){if(t.length!==0)try{fetch(`${Kt(e)}/v1/locator-miss`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify({slots:t})}).catch(()=>{})}catch(n){}}function Ge(){return!!(Q&&U&&Q.sectionCapture!==!1&&(Q.consent!==!1||tt)&&!Ie())}function Ri(){if(!U||!Q||!Ge()||he)return;let e=[];je(document,{contentAndOps:Te,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),dn();try{te==null||te(),te=Ot(U,Q.apiKey,e)}catch(t){}}function dn(){if(typeof document=="undefined"||!Ge())return;let e;try{if(Tt&&Tt.length>0){let t=new Map;for(let n of Tt){if(n.urlMatch!==window.location.pathname)continue;let r=ye(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{he=cr(U,j({apiKey:Q.apiKey,apiBase:Q.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{})),Mt=window.location.pathname}catch(t){}}function it(){try{let e=[];if(te==null||te(),te=null,je(document,{contentAndOps:Te,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),cn(Le,document),e.length>0&&Ge())try{te=Ot(U,Q.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Mt!==null&&window.location.pathname!==Mt&&Ge()&&(he==null||he(),he=null,dn())}catch(t){}}catch(e){}}function Lr(){ln===null&&(ln=setTimeout(()=>{ln=null,it();try{X==null||X.checkUrl()}catch(e){}Ur()},xi))}function un(){if(!(Ir||typeof window=="undefined"||typeof history=="undefined")){Ir=!0;try{let e=t=>{let n=history[t];history[t]=function(r,o,a){let i=n.call(this,r,o,a!=null?a:null);return Lr(),i}};e("pushState"),e("replaceState"),window.addEventListener("popstate",Lr)}catch(e){}}}function Rt(e){let t={};for(let[n,r]of Object.entries(e.slots))try{t[n]=r.target?document.querySelectorAll(r.target).length:1}catch(o){t[n]=0}return t}function zr(e){return new URLSearchParams(e).get("sentient_editor")}function Pi(){try{let e=Array.from(document.getElementsByTagName("script")),t=/(^|\/)snippet(\.global)?\.js(\?|$)/,n=e.find(r=>t.test(r.src));if(n!=null&&n.src)return n.src.replace(t,"$1editor.global.js$3")}catch(e){}return null}function Di(e,t){var n,r,o;try{window.__sentientEditor={token:t,apiBase:Kt(e)};try{let s=document.createElement("meta");s.name="referrer",s.content="no-referrer",s.setAttribute("data-sentient-editor",""),((n=document.head)!=null?n:document.documentElement).appendChild(s)}catch(s){}let a=(r=e.editorSrc)!=null?r:Pi();if(!a){Rr();return}let i=document.createElement("script");i.src=a,i.async=!0,i.onerror=()=>Rr(),((o=document.head)!=null?o:document.documentElement).appendChild(i)}catch(a){}}var Tr="sentient-editor-load-notice",qr={position:"fixed",bottom:"16px",zIndex:"2147483647",background:"#111827",color:"#fff",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"};function Rr(){var e,t;try{if(typeof document=="undefined"||document.getElementById(Tr))return;(e=document.querySelector('meta[name="referrer"][data-sentient-editor]'))==null||e.remove();let n=document.createElement("div");n.id=Tr,n.textContent="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.",Object.assign(n.style,qr,{right:"16px",maxWidth:"320px",padding:"14px 16px",borderRadius:"14px",font:"13px/1.45 system-ui, sans-serif",border:"1px solid rgba(245,158,11,0.6)",cursor:"pointer"}),n.addEventListener("click",()=>n.remove()),((t=document.body)!=null?t:document.documentElement).appendChild(n),setTimeout(()=>n.remove(),1e4)}catch(n){}}function Wr(e){let t=new URLSearchParams(e).get("sentient_preview");if(!t)return null;let n={};for(let r of t.split("|")){let o=r.indexOf(":"),a=o===-1?"":r.slice(0,o),i=o===-1?"":r.slice(o+1);if(!(!a||!i))if(i.includes("=")){let s={};for(let l of i.split(",")){let[u,c]=l.split("=");u&&c&&(s[u]=c)}Object.keys(s).length&&(n[a]=s)}else n[a]=i}return Object.keys(n).length?n:null}function Hr(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var Pr="sentient-persona-preview-banner";function Dr(e,t){var n;try{if(typeof document=="undefined"||document.getElementById(Pr))return;let r=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),o=document.createElement("div");o.id=Pr,o.setAttribute("role","status"),Object.assign(o.style,qr,{left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"12px",padding:"10px 14px",borderRadius:"999px",font:"13px/1 system-ui, sans-serif",border:"1px solid rgba(255,255,255,0.14)"});let a=document.createElement("span");a.textContent=t?`\u201C${e}\u201D isn\u2019t in your personas \u2014 showing the default experience`:`Previewing as ${r}`;let i=document.createElement("button");i.type="button",i.textContent="Exit preview",Object.assign(i.style,{cursor:"pointer",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"inherit",padding:"4px 10px",borderRadius:"999px"}),i.addEventListener("click",()=>{try{let s=new URL(window.location.href);s.searchParams.delete("sentient_persona"),window.location.href=s.pathname+s.search+s.hash}catch(s){}}),o.appendChild(a),o.appendChild(i),((n=document.body)!=null?n:document.documentElement).appendChild(o)}catch(r){}}async function Mi(e,t){var u,c,d,m,C,p,g,_,v;let n=Kt(e),o=((u=e.registry)!=null?u:Object.keys(e.slots).length===0)?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(e.slots).map(([O,b])=>({id:O,dims:b.dims}))},a=await Nt(fetch(`${n}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify(o)}).then(O=>O.ok?O.json():null).catch(()=>null),Dt);if(!a){rt(e),me(e,"persona preview: explain unavailable \u2014 page left as-is");return}let i=a;de=(c=i.slots)!=null?c:{},ue=(d=i.slotConfig)!=null?d:null,et(i.palette);let s=(p=(C=(m=i.personaAttributes)==null?void 0:m.persona)!=null?C:i.persona)!=null?p:t,l=(_=(g=i.personaAttributes)==null?void 0:g.confidence)!=null?_:"high";V={persona:s,band:l},je(document),Te=!0,un(),rt(e),i.recognized===!1?Dr(t,!0):Dr((v=i.personaDisplay)!=null?v:s)}function rt(e){let t={goal(n,r){try{U==null||U.goal(n,r)}catch(o){}},componentGoal(n,r){try{U==null||U.componentGoal(n,r)}catch(o){}},grantConsent(){try{!U&&ke?(U=Ye(j({apiKey:e.apiKey,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,ingestUrl:Kr(e)},Pt?{sdk:Pt}:{})),xe&&xe.length>0&&(X==null||X.teardown(),X=It(xe,U,document,e.apiKey))):(nn(e.apiKey),U&&xe&&xe.length>0&&(X==null||X.teardown(),X=It(xe,U,document,e.apiKey))),ke=!1}catch(n){}tt=!0;try{Ri()}catch(n){}},revokeConsent(){try{he==null||he(),he=null,Mt=null,te==null||te(),te=null,ae==null||ae(),X==null||X.teardown(),X=null,kr(typeof window!="undefined"?window:null,e.apiKey),tt=!1,ke=!0,U==null||U.destroy(),U=null}catch(n){}},reapply:it,getState(){var n,r;try{return{apiKey:e.apiKey,persona:(n=V==null?void 0:V.persona)!=null?n:null,band:(r=V==null?void 0:V.band)!=null?r:null,slots:de,matchCounts:Rt(e),consent:!ke&&(e.consent!==!1||tt)}}catch(o){return{apiKey:e.apiKey,persona:null,band:null,slots:{},matchCounts:{},consent:!1}}}};window.SentientSnippet=t;for(let n of Br.splice(0))try{n[0]==="goal"&&t.goal(n[1],n[2])}catch(r){}}function Mr(){var e;try{if(typeof window=="undefined")return;let t=window;if(typeof((e=t.SentientSnippet)==null?void 0:e.goal)=="function")return;let n=()=>{};t.SentientSnippet={goal:n,componentGoal:n,grantConsent:n,revokeConsent:n,reapply:n,getState:()=>({apiKey:"",persona:null,band:null,slots:{},matchCounts:{},consent:!1})},Br.length=0}catch(t){}}async function Vr(){var e,t;try{let n=St(window.sentient);if(!n){Mr();return}Q=n,Te=!1,Le=null,et(null),tt=!1,ke=!1,xe=null,$t=null,Ce=[],Bt=null,nt=null,ae==null||ae();let r=typeof window!="undefined"?zr(window.location.search):null;if(r){Or(r);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){}}let o=r!=null?r:_r();if(o){Di(n,o),rt(n),me(n,"editor mode");return}let a=typeof window!="undefined"?Wr(window.location.search):null;if(a){de=a,V=null,je(document),un(),rt(n),me(n,"preview mode",a);return}let i=typeof window!="undefined"?Hr(window.location.search):null;if(i){await Mi(n,i),me(n,"persona preview",i);return}let s=(e=n.registry)!=null?e:Object.keys(n.slots).length===0;n.registry===void 0&&!s&&me(n,"slots declared without registry: true, so dashboard-published components are not applied");let l=s?Ii(n):null,u=Oi();try{(t=u==null?void 0:u.stop)==null||t.call(u)}catch(h){}let c=Ve(n.apiKey),d=[];c&&(V={persona:c.persona,band:c.band},de=c.slots,c.slotConfig&&(ue=c.slotConfig),c.palette&&et(c.palette),je(document,j({contentAndOps:!1},u?{onAttr:(h,A)=>d.push([h,A])}:{})),c.layoutOrder&&(Le=c.layoutOrder,cn(Le,document))),u&&_i(u,d,document);let m=Ye(j({apiKey:n.apiKey,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,ingestUrl:Kr(n)},Pt?{sdk:Pt}:{}));U=m,rt(n),un();let C=Object.entries(n.slots).map(([h,A])=>({id:h,dims:A.dims})),p=$r,g={pp:u?u.v:0},_=Array.from(Nr(document).keys()),v=[];if(l){let[h]=await Promise.all([Nt(l,Dt),document.readyState==="loading"?new Promise(A=>document.addEventListener("DOMContentLoaded",A,{once:!0})):null]);$t=h,h&&(Ce=v=jr(h,document)[0]),me(n,"registry scope",h&&v)}let O=m.decide(j(j(j(j({slots:C},p),g),_.length>=2?{sections:_}:{}),s?{slotsFrom:"registry",registrySlotIds:v}:{})),b=await Nt(O,Dt),w=h=>{var F,M,q,W,ne;let A=m.getPersona();A?V={persona:A.persona,band:A.band}:h.persona&&(V={persona:h.persona,band:"low"}),de=h.slots,s?ue=Gr(h.slotConfig,v):h.slotConfig&&(ue=h.slotConfig),h.palette&&et(h.palette),Le=(F=h.layoutOrder)!=null?F:Le;let E=()=>{let fe=[],S=je(document,{onApplied:(T,Y,ee)=>fe.push({slotId:T,arm:Y,el:ee})});if(s||Fr(n,S),cn(Le,document),Te=!0,Ge())try{te==null||te(),te=Ot(U,n.apiKey,fe)}catch(T){}};if(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E,{once:!0}):E(),xe=(M=h.goals)!=null?M:null,h.goals&&h.goals.length>0&&n.consent!==!1&&U)try{X==null||X.teardown(),X=It(h.goals,U,document,n.apiKey)}catch(fe){}Tt=(q=h.sectionMap)!=null?q:null,Ge()&&dn(),me(n,"applied",{persona:V,slots:de,matches:Rt(n)}),!ke&&(Ne(n.apiKey,nt=j(j({v:1,persona:(W=V==null?void 0:V.persona)!=null?W:h.persona,band:(ne=V==null?void 0:V.band)!=null?ne:"low",slots:h.slots,layoutOrder:h.layoutOrder,savedAt:Date.now()},ue?{slotConfig:ue}:{}),h.palette?{palette:h.palette}:{})),Bt=null,Ur())};if(!b){me(n,"decide timeout/null \u2014 snapshot state stands",Rt(n)),O.then(h=>{!h||Te||ke||U!==m||(w(h),me(n,"late decide applied",Rt(n)))}).catch(()=>{});return}w(b)}catch(n){Mr()}}if(typeof window!="undefined"&&window.sentient){let e=window;e.__sentientInitialized||(e.__sentientInitialized=!0,Promise.resolve().then(()=>{Vr()}))}return oo($i);})();
1
+ "use strict";var SentientSnippet=(()=>{var pt=Object.defineProperty,Zr=Object.defineProperties,Qr=Object.getOwnPropertyDescriptor,eo=Object.getOwnPropertyDescriptors,to=Object.getOwnPropertyNames,bn=Object.getOwnPropertySymbols;var wn=Object.prototype.hasOwnProperty,no=Object.prototype.propertyIsEnumerable;var Sn=(e,t,n)=>t in e?pt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j=(e,t)=>{for(var n in t||(t={}))wn.call(t,n)&&Sn(e,n,t[n]);if(bn)for(var n of bn(t))no.call(t,n)&&Sn(e,n,t[n]);return e},De=(e,t)=>Zr(e,eo(t));var En=(e,t)=>()=>(e&&(t=e(e=0)),t);var An=(e,t)=>{for(var n in t)pt(e,n,{get:t[n],enumerable:!0})},ro=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of to(t))!wn.call(e,o)&&o!==n&&pt(e,o,{get:()=>t[o],enumerable:!(r=Qr(t,o))||r.enumerable});return e};var oo=e=>ro(pt({},"__esModule",{value:!0}),e);var io,so,ao,xn,lo,co,kn,N,_e,Je=En(()=>{"use strict";io=Object.defineProperty,so=Object.defineProperties,ao=Object.getOwnPropertyDescriptors,xn=Object.getOwnPropertySymbols,lo=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable,kn=(e,t,n)=>t in e?io(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,N=(e,t)=>{for(var n in t||(t={}))lo.call(t,n)&&kn(e,n,t[n]);if(xn)for(var n of xn(t))co.call(t,n)&&kn(e,n,t[n]);return e},_e=(e,t)=>so(e,ao(t))});var Bn={};An(Bn,{LOCAL_ENGINE_AVAILABLE:()=>mo,createLocalEngine:()=>ho});function ho(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var mo,Nn=En(()=>{"use strict";mo=!1});var Bi={};An(Bi,{applyPersonaAttributes:()=>_t,applyRegistrySlots:()=>Lt,applySlotArms:()=>It,applySlotAttributes:()=>Ot,parseEditorToken:()=>zr,parsePersonaPreview:()=>Hr,parsePreview:()=>Wr,parseSnippetConfig:()=>At,planReorder:()=>Pt,reapply:()=>lt,run:()=>Jr,version:()=>ot});Je();function gt(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function Cn(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 zt(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 gt(e.baseline);if(typeof e.baseline=="string")return e.baseline;let o={};for(let[a,i]of Object.entries((n=e.dims)!=null?n:{}))o[a]=(r=i[0])!=null?r:"";return gt(o)}function _n(e,t){var n,r;return e.dims!=null?(r=(n=Cn(t))!=null?n:Cn(zt(e)))!=null?r:{}:t}function On(e){let t=2166136261;for(let n=0;n<e.length;n++)t^=e.charCodeAt(n),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t}function Oe(e){return e>=.3?e<.7?"medium":"high":"low"}function mt(e){return e?`_${e.slice(0,12)}`:""}var uo="_snt_uid";function In(e){return`${uo}${mt(e)}`}var fo=["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 Ln(e){return po(e)!==null}function po(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=fo.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function Tn(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 Rn(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 Pn(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var go=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Dn(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([o,a])=>{let i=Array.isArray(a)?a[0]:a;return i===void 0?[]:[[o,i]]});for(let[o,a]of r)o.startsWith("utm_")?o in t||(t[o]=a):go.includes(o)&&(o in n||(n[o]=a))}catch(r){}return{utmParams:t,clickIds:n}}function Mn(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function qt(e){return N(N(N({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 Wt(e){let t=qt(e);return _n(t,zt(t))}function $n(e){return typeof e=="string"?e:gt(e)}Je();function zn(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}var yo="_snt_uid",vo=365,ht="_snt_uid";function bo(){return zn()}function Kn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function So(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(r){}}function Ht(e){try{return localStorage.getItem(e)}catch(t){return null}}function jn(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Gn(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function wo(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Eo(e){try{sessionStorage.removeItem(e)}catch(t){}}function Ao(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 xo(e){try{localStorage.removeItem(e)}catch(t){}}function ko(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var Co={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function qn(e){var t,n,r,o,a,i,s;if(typeof window=="undefined")return Co;let l=mt(e==null?void 0:e.apiKey),u=(t=e==null?void 0:e.cookieName)!=null?t:In(e==null?void 0:e.apiKey),c=`${ht}${l}`,d=`${ht}_tomb${l}`,m=((n=e==null?void 0:e.cookieTTLDays)!=null?n:vo)*24*60*60,C=w=>w&&w.length>0?w:null,p=()=>{var w,h;return l&&!(e!=null&&e.cookieName)&&Ht(d)===null?(h=(w=C(Kn(yo)))!=null?w:C(Ht(ht)))!=null?h:C(Gn(ht)):null},g=(s=(i=(a=(o=(r=C(Kn(u)))!=null?r:C(Ht(c)))!=null?o:C(Gn(c)))!=null?a:p())!=null?i:C(e==null?void 0:e.ssrSessionId))!=null?s:bo();So(u,g,m);let _=jn(c,g),v=Ao(u),O=_?!1:wo(c,g),b=!_&&!v&&!O;return{getSessionId:()=>g,isEphemeral:()=>b,destroy:()=>{g=null,ko(u),xo(c),Eo(c),l&&!(e!=null&&e.cookieName)&&jn(d,"1")}}}function Me(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Qt(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 Wn(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let r=JSON.parse(n);return Array.isArray(r)?(localStorage.removeItem(e),r.slice(-t)):[]}catch(n){return[]}}function $e(e,t,n){try{let r=(()=>{try{let a=localStorage.getItem(n);if(!a)return[];let i=JSON.parse(a);return Array.isArray(i)?i:[]}catch(a){return[]}})(),o=new Map;for(let a of r)o.set(a.id,a);for(let a of e)o.set(a.id,a);localStorage.setItem(n,JSON.stringify([...o.values()].slice(-t)))}catch(r){}}function Hn(e,t){try{let n=localStorage.getItem(t);if(!n)return;let r=JSON.parse(n);if(!Array.isArray(r))return;let o=new Set(e),a=r.filter(i=>!o.has(i.id));if(a.length===r.length)return;a.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(a))}catch(n){}}var _o=500,Oo=56*1024;function Jn(e){return`_snt_retry_${e.slice(0,12)}`}var Io={push:()=>{},flush:()=>{},destroy:()=>{}};function Lo(e){var t,n,r;if(typeof window=="undefined")return Io;let o=(t=e.flushIntervalMs)!=null?t:5e3,a=(n=e.maxBatchSize)!=null?n:20,i=(r=e.maxRetrySize)!=null?r:100,s=e.ingestUrl,l=e.apiKey,u=Jn(l),c=[],d=new Set,m=[],C=S=>{for(let T of S)p.delete(T),!d.has(T)&&(d.add(T),m.push(T));for(;m.length>_o;){let T=m.shift();T&&d.delete(T)}Hn(S,u)},p=new Set,g=()=>{for(;c.length>i;){let S=c.shift();S&&p.delete(S.id)}},_=S=>{d.has(S.id)||p.has(S.id)||(p.add(S.id),c.push(S),g())},v=S=>{for(let T of S)d.has(T.id)||(p.add(T.id),c.push(T));g()},O=Wn(u,i);for(let S of O)_(S);let b=0,w=0,h=(S,T=!0)=>{if(S.length===0)return;let Y=JSON.stringify(S),ee=S.map(R=>R.id),x;try{x=fetch(s,{method:"POST",keepalive:!0,body:Y,headers:{"Content-Type":"application/json",Authorization:`Bearer ${l}`}})}catch(R){$e(S,i,u),v(S),w++,b=Date.now()+Me(w);return}let K=R=>{if(Qt(R)!=="retry"){if(!R.ok&&T){let z=S.filter(Z=>Z.eventType!=="pageview");if(z.length>0&&z.length<S.length){C(S.filter(Z=>Z.eventType==="pageview").map(Z=>Z.id)),h(z,!1);return}}C(ee),w=0,b=0;return}$e(S,i,u),v(S),w++,b=Date.now()+Me(w)};x instanceof Promise?x.then(K).catch(()=>{$e(S,i,u),v(S),w++,b=Date.now()+Me(w)}):K(x)},A=typeof TextEncoder!="undefined"?new TextEncoder:null,E=S=>A?A.encode(S).length:S.length,F=S=>{let T=[],Y=2;for(let ee of S){let x=E(JSON.stringify(ee))+1;if(T.length>0&&Y+x>Oo||T.length>=a)break;T.push(ee),Y+=x}return T},M=()=>{try{if(Date.now()<b)return;for(;c.length>0&&!(Date.now()<b);){let S=c.filter(Y=>!d.has(Y.id));if(c.length=0,S.length===0)break;let T=F(S);if(T.length===0)break;T.length<S.length&&c.push(...S.slice(T.length)),h(T)}}catch(S){}},q=!0,W=null;W=setInterval(()=>{q&&M()},o);let ne=()=>{document.visibilityState==="hidden"&&M()},fe=()=>{M()};return document.addEventListener("visibilitychange",ne),window.addEventListener("pagehide",fe),{push(S){_(S),c.length>=a&&M()},flush:M,destroy(){q=!1,W!==null&&(clearInterval(W),W=null),document.removeEventListener("visibilitychange",ne),window.removeEventListener("pagehide",fe),M()}}}var To=200;function Vn(e){return`_snt_goal_retry_${e.slice(0,12)}`}var Ro={send:()=>{},flush:()=>{},destroy:()=>{}};function Po(e){var t,n,r;if(typeof window=="undefined")return Ro;let o=(t=e.flushIntervalMs)!=null?t:5e3,a=(n=e.maxRetrySize)!=null?n:100,i=(r=e.maxPerFlush)!=null?r:5,s=Vn(e.apiKey),l=[],u=new Set,c=new Set,d=[],m=0,C=0,p=!1,g=E=>{for(u.delete(E.id),c.has(E.id)||(c.add(E.id),d.push(E.id));d.length>To;){let F=d.shift();F&&c.delete(F)}Hn([E.id],s)},_=E=>{$e([E],a,s),!c.has(E.id)&&!u.has(E.id)&&(u.add(E.id),l.push(E)),Date.now()>=m&&(C++,m=Date.now()+Me(C))},v=E=>{let F;try{F=fetch(e.url,{method:"POST",keepalive:!0,body:E.body,headers:e.headers})}catch(q){_(E);return}let M=q=>{var W;let ne=Qt(q);if(ne==="retry"){_(E);return}ne==="dropped"&&((W=e.onDrop)==null||W.call(e,E,q.status)),g(E),C=0,m=0};F instanceof Promise?F.then(M).catch(()=>_(E)):M(F)},O=()=>{try{if(p||Date.now()<m)return;let E=0;for(;l.length>0&&E<i&&!(Date.now()<m);){let F=l.shift();u.delete(F.id),!c.has(F.id)&&(E++,v(F))}}catch(E){}},b=Wn(s,a);for(let E of b)u.has(E.id)||(u.add(E.id),l.push(E));b.length>0&&$e(b,a,s);let w=setInterval(O,o),h=()=>{document.visibilityState==="hidden"&&O()},A=()=>O();return document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",A),{send(E){if(!p&&!(c.has(E.id)||u.has(E.id))){if(Date.now()<m){$e([E],a,s),u.add(E.id),l.push(E);return}v(E)}},flush:O,destroy(){clearInterval(w),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",A),O(),p=!0}}}var Do=1800*1e3;function yt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function Mo(e=Do,t){let n=new Map,r=`_snt_asgn${mt(t)}_`,o=(l,u)=>`${r}${encodeURIComponent(l)}:${encodeURIComponent(u)}`,a=l=>{let u=l.slice(r.length),c=u.indexOf(":");if(c<0)return null;try{return{componentId:decodeURIComponent(u.slice(0,c)),segment:decodeURIComponent(u.slice(c+1))}}catch(d){return null}},i=()=>{try{let l=[];for(let u=0;u<localStorage.length;u++){let c=localStorage.key(u);c!=null&&c.startsWith(r)&&l.push(c)}return l}catch(l){return[]}},s=l=>l.assignedAt+(l.ttlMs&&l.ttlMs>0?l.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let l of i())try{let u=localStorage.getItem(l);if(!u)continue;let c=JSON.parse(u);if(s(c)){localStorage.removeItem(l);continue}let d=a(l);if(!d)continue;n.set(yt(d.componentId,d.segment),c)}catch(u){}})(),{get(l,u){let c=n.get(yt(l,u));return c?s(c)?(n.delete(yt(l,u)),null):c:null},set(l,u,c){let d=yt(l,u);n.set(d,c);try{localStorage.setItem(o(l,u),JSON.stringify(c))}catch(m){}},clear(){n.clear();for(let l of i())try{localStorage.removeItem(l)}catch(u){}}}}var St="_snt_snap:",$o=["low","medium","high"];function Ye(e){try{let t=localStorage.getItem(St+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"||!$o.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 Ne(e,t){try{localStorage.setItem(St+e,JSON.stringify(t))}catch(n){}}var Xt="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Yn="[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.",Un=!1,vt=!1;function Bo(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function No(e){var t;let n=qn({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=Bo(),a=Promise.resolve().then(()=>(Nn(),Bn)).then(c=>{let d=c;return d.LOCAL_ENGINE_AVAILABLE?(Un||(Un=!0,console.info(Yn)),d):(vt||(vt=!0,console.error(Xt)),null)}).catch(()=>(vt||(vt=!0,console.error(Xt)),null)),i=null,s={low:.15,medium:.5,high:.85},l=(()=>{var c;if(e.initialPersona)return N({},e.initialPersona);let d=Ye(e.apiKey||"local");return d?{persona:d.persona,confidence:(c=s[d.band])!=null?c:.15}:null})();function u(c){let d=document.documentElement;d.dataset.sentientPersona===void 0&&(d.dataset.sentientPersona=c.persona,d.dataset.sentientConfidence=Oe(c.confidence))}return{isLocal:!0,async decide(c){var d,m,C;let p=await a;if(!p)return null;let g=p.createLocalEngine({sessionId:r,forcedPersona:o}).decide(c);return i=_e(N({},g),{layoutOrder:(m=(d=g.layoutOrder)!=null?d:i==null?void 0:i.layoutOrder)!=null?m:null,slots:N(N({},(C=i==null?void 0:i.slots)!=null?C:{}),g.slots)}),Ne(e.apiKey||"local",{v:1,persona:i.persona,band:Oe(i.confidence),slots:i.slots,layoutOrder:i.layoutOrder,savedAt:Date.now()}),u(g),g},getSlotResult(c){var d,m,C;return(C=(m=i==null?void 0:i.slots[c])!=null?m:(d=e.initialSlots)==null?void 0:d[c])!=null?C:null},getSlotConfig(c){var d,m;return(m=(d=e.initialSlotConfig)==null?void 0:d[c])!=null?m:null},getSitePalette(){var c;return(c=e.initialPalette)!=null?c:null},reportSlots(){},getPersona(){let c=i!=null?i:l;return c?{persona:c.persona,confidence:c.confidence,band:Oe(c.confidence)}:null},async assign(c,d){var m;let C=await a;return!C||!d||d.length===0?d!=null&&d[0]?{variantId:d[0],assignmentTtlMs:0}:null:{variantId:(m=C.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:c,variantIds:d}]}).assignments[c])!=null?m:d[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>n.destroy()}}var wt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Jt(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function en(e,t){if(e===void 0||!wt.test(e))return!1;if(e==="*")return!0;let n=Jt(t);if(e.endsWith("/*")){let r=Jt(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===Jt(e)}function Et(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="form"?!0:Array.isArray(t.children)?t.children.some(Et):!1}var Fn="sentient-reveal",Be="sentient-revealed";var Vt=!1;function Ko(e){if(Vt||e.getElementById(Fn)){Vt=!0;return}let t=e.createElement("style");t.id=Fn,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${Be}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${Be}{animation:${Be} 240ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),Vt=!0}function tn(e,t={}){var n;let r=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!r||!(e instanceof Element)||(t.arm!==void 0&&e.setAttribute("data-sentient-arm",t.arm),t.persona!==void 0&&e.setAttribute("data-sentient-persona",t.persona),t.previous!==void 0&&t.previous===e.textContent))return!1;Ko(r),e.classList.remove(Be),e.offsetWidth,e.classList.add(Be);let o=()=>{e.classList.remove(Be),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function Xe(e,t,n,r){let o=[];{let a=!1,i=[],s=()=>{if(a)return;let l=Date.now();for(i.push(l);i.length>0&&l-i[0]>500;)i.shift();i.length>=3&&(a=!0,e("rage_click"))};t.addEventListener("click",s),o.push(()=>t.removeEventListener("click",s))}{let a=!1,i=s=>{if(a||!(s.target instanceof Node)||!t.contains(s.target)&&t!==s.target)return;a=!0;let l=typeof window!="undefined"?window.getSelection():null,u=l?l.toString().length:0;e("text_copy",{selectionLength:u})};document.addEventListener("copy",i),o.push(()=>document.removeEventListener("copy",i))}{let a=!1,i=!1,s=null,l=()=>{s!==null&&(clearTimeout(s),s=null)},u=()=>{a||!i||(l(),s=setTimeout(()=>{!a&&i&&(a=!0,e("scroll_hesitation"))},3e3))},c=()=>{l(),u()},d=C=>{for(let p of C)i=p.intersectionRatio>.3,i?u():l()},m=new IntersectionObserver(d,{threshold:[.3]});m.observe(t),window.addEventListener("scroll",c,{passive:!0}),o.push(()=>{m.disconnect(),window.removeEventListener("scroll",c),l()})}if((r==null?void 0:r.tabLoss)!==!1){let a=!1,i=n!=null?n:Date.now(),s=()=>{if(a||document.visibilityState!=="hidden")return;let l=Date.now()-i;l<15e3&&(a=!0,e("tab_loss",{timeOnPage:l}))};document.addEventListener("visibilitychange",s),o.push(()=>document.removeEventListener("visibilitychange",s))}return()=>{for(let a of o)a()}}function jo(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Xn="https://api.sentient-ui.com/v1/events",ce=new Map,Zn=null;function Go(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Uo=3;function Yt(){return zn()}function bt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Fo(){let e=new WeakMap,t=new Map,n=!1,r=(s,l,u)=>{let c=s.get(l);return u===null?c?!0:(s.set(l,new Set),!1):c?c.has(u)?!0:(c.add(u),!1):(s.set(l,new Set([u])),!1)},o=typeof window!="undefined"&&"event"in window,a=()=>{if(!o)return;let s=window.event;return typeof Event=="function"&&s instanceof Event?s:void 0},i=()=>{if(o){Promise.resolve().then(()=>{n=!1,t.clear()});return}let s=!1,l=()=>{s||(s=!0,n=!1,t.clear())};if(setTimeout(l,0),typeof MessageChannel=="function"){let u=new MessageChannel;u.port1.onmessage=()=>{u.port1.close(),u.port2.close(),l()},u.port2.postMessage(0)}};return{firedBefore(s,l){let u=a();if(u){let d=e.get(u);return d||(d=new Map,e.set(u,d)),r(d,s,l)}let c=r(t,s,l);return!c&&!n&&(n=!0,i()),c}}}var Qn=new Set;function zo(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,a,i=()=>{if(o)return;let u=bt();!u||u===a||(a=u,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${u}`))},s=[];for(let u of["pushState","replaceState"]){let c=r[u],d=function(...m){let C=c.apply(this,m);return i(),C};r[u]=d,s.push([u,c,d])}window.addEventListener("popstate",i);let l=bt();return l&&Qn.has(`${t}:${l}`)?a=l:i(),()=>{if(!o){o=!0,window.removeEventListener("popstate",i);for(let[u,c,d]of s)r[u]===d&&(r[u]=c)}}}var Ve={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}};function qo(){try{return Dn(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function er(e){return e.replace(/\/events\/?$/,"")}function Ie(){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 nn(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:Zn;if(!n){console.warn("[sentient] grantConsent() called before init()");return}let r=ce.get(n);if(!r){console.warn("[sentient] grantConsent() called before init()");return}let{config:o,upgrade:a,reinit:i}=r;if(!a){r.upgradeBlockedReason&&console.warn(r.upgradeBlockedReason);return}if(o.respectDoNotTrack!==!1&&Ie())return;let s=(i!=null?i:Ze)(_e(N({},o),{consent:!0}));a(s);let l=(t=ce.get(n))==null?void 0:t.dispose;ce.set(n,{config:_e(N({},o),{consent:!0}),upgrade:null,dispose:l})}function Wo(e){var t;let n=e.preConsentBehavior==="statistical_winner",r=er((t=e.ingestUrl)!=null?t:Xn),o={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},a=new Map,i=new Map,s={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(p,g,_){if(!n)return Promise.resolve(null);let v=a.get(p);return v?Promise.resolve(v):Zt(i,p,async()=>{try{let O=new URLSearchParams({componentId:p});for(let h of g!=null?g:[])O.append("variantIds[]",h);let b=await fetch(`${r}/winner?${O.toString()}`,{headers:o});if(!b.ok)return g!=null&&g[0]?{variantId:g[0],assignmentTtlMs:0}:null;let w={variantId:(await b.json()).variantId,assignmentTtlMs:0};return a.set(p,w),w}catch(O){return g!=null&&g[0]?{variantId:g[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}},l=!1,u=new Set,c=[],d=[],m={track:p=>s.track(p),goal:((p,g,_,v)=>s.goal(p,g,_,v)),componentGoal:(p,g,_)=>s.componentGoal(p,g,_),identify:p=>s.identify(p),getAssignment:(p,g)=>s.getAssignment(p,g),assign:(p,g,_,v)=>s.assign(p,g,_,v),decide:p=>s.decide(p),getSlotResult:p=>s.getSlotResult(p),isSlotDecided:p=>{var g,_;return(_=(g=s.isSlotDecided)==null?void 0:g.call(s,p))!=null?_:!0},getSlotConfig:p=>s.getSlotConfig(p),getSitePalette:()=>s.getSitePalette(),reportSlots:(p,g)=>s.reportSlots(p,g),requestSlots:(p,g)=>{var _;return l?(_=s.requestSlots)==null?void 0:_.call(s,p,g):c.push([p,g])},decideSlots:p=>{var g;return l?(g=s.decideSlots)==null?void 0:g.call(s,p):d.push(...p)},cancelSlots:p=>{var g;if(l)return(g=s.cancelSlots)==null?void 0:g.call(s,p);let _=new Set(p);for(let v of c)v[0]=v[0].filter(O=>!_.has(O));d=d.filter(v=>!_.has(v.id))},onSlotsChanged:p=>(u.add(p),()=>{u.delete(p)}),getPersona:()=>s.getPersona(),fetchWeights:()=>s.fetchWeights(),getGraph:()=>s.getGraph(),dispose:()=>s.dispose(),destroy:()=>s.destroy()};function C(p){var g,_,v;s=p,l=!0,(g=p.onSlotsChanged)==null||g.call(p,()=>u.forEach(O=>O()));for(let[O,b]of c.splice(0))O.length>0&&((_=p.requestSlots)==null||_.call(p,O,b));d.length>0&&((v=p.decideSlots)==null||v.call(p,d.splice(0)))}return{proxy:m,setInner:C}}function Zt(e,t,n){let r=e.get(t);if(r)return r;let o=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,o),o}function Ze(e){var t,n,r,o,a,i,s,l,u,c;if(typeof window=="undefined")return Ve;Zn=e.apiKey||"local";let d=ce.get(e.apiKey||"local");if(d!=null&&d.dispose)try{d.dispose()}catch(f){}let m=e.respectDoNotTrack!==!1&&Ie(),C=e.consent===!1||m,p=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!p&&e.localMode!==!1)return ce.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),C?Ve:No(e);if(C){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."),ce.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): the client was initialized with an invalid apiKey (expected a pk_ public key) \u2014 consent cannot enable tracking."}),Ve;let{proxy:f,setInner:y}=Wo(e);return ce.set(e.apiKey,{config:e,upgrade:m?null:y}),f}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."),Ve;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),Ve;let g=(t=e.ingestUrl)!=null?t:Xn,_=Date.now(),v=qn({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),O=Mo(void 0,e.apiKey),b=Lo({ingestUrl:g,apiKey:e.apiKey}),w=er(g),h={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},A=new Set,E=Po({url:`${w}/goals`,apiKey:e.apiKey,headers:h,onDrop:(f,y)=>{if(!e.debug){if(A.has(y))return;A.add(y)}console.warn(`[sentient] goal dropped (HTTP ${y}) \u2014 this will not be retried. `+(y===400?"The session was not found: call init() and let the session upsert complete before firing goals.":y===401||y===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),f)}}),F=Tn((n=navigator.userAgent)!=null?n:""),M=window.location.origin,q=Rn((r=document.referrer)!=null?r:"",M),W=(o=e.sessionSegment)!=null?o:`${F}:${q}`,ne=new Map,fe=new Map,S=new Map,T=new Set,Y=new Map,ee=null,x=null,K=new Set,R=new Set,z=new Map,Z=null,Re=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,ze=new Set,ge=new Set,ct=new Set,qe=new Map,jt=null,ut=new Set,We=new Map,Gt=null,Vr=2,fn=new Map,Ut=!1,pn=(f,y,k)=>{var $;let B=new Set,I=1;for(let P of f){y.delete(P);let D=(($=fn.get(P))!=null?$:0)+1;fn.set(P,D),D<=Vr&&(B.add(P),D>I&&(I=D))}B.size>0&&setTimeout(()=>{Ut||k(B)},Me(I))},gn=f=>{for(let y of f)S.has(y.id)||S.set(y.id,Wt(y))};if(e.initialSlots)for(let[f,y]of Object.entries(e.initialSlots))S.set(f,y),T.add(f);if(e.initialSlotConfig)for(let[f,y]of Object.entries(e.initialSlotConfig))Y.set(f,y);e.initialPalette&&(ee=e.initialPalette);let be=Ye(e.apiKey);if(be){for(let[f,y]of Object.entries(be.slots))S.has(f)||S.set(f,y);for(let[f,y]of Object.entries((a=be.slotConfig)!=null?a:{}))Y.has(f)||Y.set(f,y);!ee&&be.palette&&(ee=be.palette)}let mn={low:.15,medium:.5,high:.85};if(e.initialPersona)x=N({},e.initialPersona);else{let f=document.documentElement.dataset;f.sentientPersona?x={persona:f.sentientPersona,confidence:(s=mn[(i=f.sentientConfidence)!=null?i:"low"])!=null?s:.15}:be&&(x={persona:be.persona,confidence:(l=mn[be.band])!=null?l:.15})}if(e.initialAssignments)for(let[f,y]of Object.entries(e.initialAssignments))O.set(f,W,{variantId:y,assignedAt:Date.now(),segment:W,confidence:1});let Se=Promise.resolve(),hn=v.getSessionId();if(hn){let f=Pn((u=document.referrer)!=null?u:""),{utmParams:y,clickIds:k}=qo(),$=N(N(N(N({sessionId:hn,deviceClass:F,trafficSource:q,referrerDomain:f,utmParams:y,clickIds:k,timeOfDay:Mn(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:v.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Ln((c=navigator.userAgent)!=null?c:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),B=async()=>{for(let I=0;;I++){try{let P=await fetch(`${w}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify($),headers:h});if(P.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(P.ok||Qt(P)==="dropped")return}catch(P){}if(I>=Uo){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(P=>setTimeout(P,Me(I+1)))}};try{Se=B()}catch(I){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:b});let Yr=Fo(),He=null,Ft=!1,oe={goal(f,y={},k=1,$=0){var B,I,P,D,V,ie,se;let we=v.getSessionId();if(!we)return;let re=Go(y)?y:{metadata:y},dt=[f,(B=re.externalId)!=null?B:"",(I=re.stepIndex)!=null?I:$,(P=re.weight)!=null?P:k].join("\0"),ft=re.value!==void 0?`${re.value}\0${(D=re.currency)!=null?D:""}`:null;if(Yr.firedBefore(dt,ft)){e.debug&&console.log(`[sentient] goal("${f}") already recorded for this action \u2014 not sent twice`);return}let Pe=Yt(),G={sessionId:we,name:f,metadata:(V=re.metadata)!=null?V:{},weight:(ie=re.weight)!=null?ie:k,stepIndex:(se=re.stepIndex)!=null?se:$,goalId:Pe,value:re.value,currency:re.currency,externalId:re.externalId};e.debug&&console.log("[sentient] goal",G);let Ee={id:Pe,body:JSON.stringify(G)};Se.then(()=>E.send(Ee))},componentGoal(f,y,k){var $,B,I;let P=v.getSessionId();if(!P)return;let D=O.get(f,W),V=D?null:($=S.get(f))!=null?$:null;if(!D&&V===null){e.debug&&console.warn(`[sentient] componentGoal("${f}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!D&&!T.has(f)){e.debug&&console.warn(`[sentient] componentGoal("${f}"): slot not decided this session \u2014 not attributed`);return}let ie=D?D.variantId:$n(V),se={id:Yt(),sessionId:P,projectId:e.apiKey,componentId:f,variantId:ie,eventType:"goal_achieved",goalType:y,payload:N({reward:(B=k==null?void 0:k.reward)!=null?B:1,goalValue:k==null?void 0:k.value,currency:k==null?void 0:k.currency},(I=k==null?void 0:k.metadata)!=null?I:{}),timestamp:Date.now(),timeInSession:Date.now()-_,path:bt()};e.debug&&console.log("[sentient] componentGoal",se),Se.then(()=>b.push(se))},identify(f){let y=v.getSessionId();y&&Se.then(()=>{fetch(`${w}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:y,userId:f,ephemeral:v.isEphemeral()}),headers:h}).catch(()=>{})})},track(f){let y=v.getSessionId();if(!y||f.eventType==="variant_assigned"&&S.get(f.componentId)!==void 0&&!T.has(f.componentId)&&!O.get(f.componentId,W))return;let k=_e(N({path:bt()},f),{id:Yt(),sessionId:y,timestamp:Date.now(),timeInSession:Date.now()-_});e.debug&&console.log("[sentient] track",k),Se.then(()=>b.push(k))},getAssignment(f,y){return O.get(f,y)},async assign(f,y,k,$){let B=v.getSessionId();if(!B)return null;let I=O.get(f,W);if(I&&(y!=null&&y.length||I.content!==void 0)){let P=I.ttlMs&&I.ttlMs>0?Math.max(0,I.assignedAt+I.ttlMs-Date.now()):0;return{variantId:I.variantId,assignmentTtlMs:P,content:I.content}}return Zt(ne,f,async()=>{await Se;try{let P={sessionId:B,componentId:f,variantIds:y};$!==void 0?P.agentDataByVariant=$:k!==void 0&&(P.agentData=k);let D=await fetch(`${w}/assign`,{method:"POST",body:JSON.stringify(P),headers:h});if(!D.ok)return null;let V=await D.json();return O.set(f,W,N({variantId:V.variantId,assignedAt:Date.now(),segment:W,confidence:1,content:V.content},V.assignmentTtlMs&&V.assignmentTtlMs>0?{ttlMs:V.assignmentTtlMs}:{})),V}catch(P){return null}})},async decide(f){var y,k;let $=v.getSessionId();if(!$)return null;let B=(y=f.slots)!=null?y:[],I={sessionId:$};f.sections&&f.sections.length>0&&(I.sections=f.sections.map(D=>({id:D}))),I.components=(k=f.components)!=null?k:[],B.length>0&&(I.slots=B.map(qt)),f.slotsFrom==="registry"&&(I.slotsFrom="registry",f.registrySlotIds&&(I.registrySlotIds=f.registrySlotIds),f.bootstrap===!1&&(I.bootstrap=!1)),f.v&&(I.v=f.v),typeof f.pp=="number"&&(I.pp=f.pp),e.persona&&(I.persona=e.persona);let P=JSON.stringify(I);return Zt(fe,P,async()=>{var D,V,ie,se,we,re,dt,ft;await Se;try{let Pe=await fetch(`${w}/decide`,{method:"POST",body:P,headers:h});if(!Pe.ok)return gn(B),null;let G=await Pe.json(),Ee={};for(let H of B){let me=(D=G.slots)==null?void 0:D[H.id];if(me!==void 0){Ee[H.id]=me,S.set(H.id,me),T.add(H.id);continue}let yn=S.get(H.id);if(yn!==void 0)Ee[H.id]=yn;else{let vn=Wt(H);Ee[H.id]=vn,S.set(H.id,vn)}}if(G.slots)for(let[H,me]of Object.entries(G.slots))H in Ee||(Ee[H]=me,S.set(H,me),T.add(H));let Xr=x!=null&&x.persona!=="unknown";G.persona&&!(G.persona==="unknown"&&Xr)?x={persona:G.persona,confidence:(V=G.confidence)!=null?V:0}:x||(x={persona:"unknown",confidence:0});for(let[H,me]of Object.entries((ie=G.assignments)!=null?ie:{}))O.set(H,W,{variantId:me,assignedAt:Date.now(),segment:W,confidence:1});if(G.slotConfig)for(let[H,me]of Object.entries(G.slotConfig))Y.set(H,me);G.palette&&(ee=G.palette);for(let H of(se=f.registrySlotIds)!=null?se:[])(we=G.slotConfig)!=null&&we[H]||(Y.delete(H),S.delete(H),T.delete(H));return Ne(e.apiKey,N(N({v:1,persona:x.persona,band:Oe(x.confidence),slots:Object.fromEntries(S),layoutOrder:(re=G.layoutOrder)!=null?re:null,savedAt:Date.now()},Y.size>0?{slotConfig:Object.fromEntries(Y)}:{}),ee?{palette:ee}:{})),N(N(N(N({layoutOrder:(dt=G.layoutOrder)!=null?dt:null,assignments:(ft=G.assignments)!=null?ft:{},slots:Ee,persona:x.persona,confidence:x.confidence},G.slotConfig?{slotConfig:G.slotConfig}:{}),G.goals?{goals:G.goals}:{}),G.sectionMap?{sectionMap:G.sectionMap}:{}),G.palette?{palette:G.palette}:{})}catch(Pe){return gn(B),null}})},getSlotResult(f){var y;return(y=S.get(f))!=null?y:null},isSlotDecided(f){return T.has(f)},getSlotConfig(f){var y;return(y=Y.get(f))!=null?y:null},reportSlots(f,y){for(let k of f)if(!(typeof k!="string"||k.length===0)){if(!Re.test(k)){jo()&&!ze.has(k)&&(ze.add(k),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(k)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!K.has(k)){K.add(k),R.add(k);let $=y==null?void 0:y[k];if(typeof $=="string"){let B=$.replace(/\s+/g," ").trim().slice(0,400);B!==""&&z.set(k,B)}}}R.size===0||Z!=null||(Z=setTimeout(()=>{Z=null;let k=[...R];R.clear();for(let $=0;$<k.length;$+=20){let B=k.slice($,$+20),I={};for(let P of B){let D=z.get(P);D!==void 0&&(I[P]=D,z.delete(P))}fetch(`${w}/slots/observed`,{method:"POST",headers:h,body:JSON.stringify(N({slotIds:B},Object.keys(I).length>0?{baselineTexts:I}:{}))}).catch(()=>{})}},1e3))},requestSlots(f,y){for(let k of f)ct.has(k)||(ct.add(k),Re.test(k)?qe.set(k,y==null?void 0:y[k]):oe.reportSlots([k]));qe.size===0||jt!=null||(jt=setTimeout(()=>{jt=null;let k=[...qe];qe.clear();for(let $=0;$<k.length;$+=50){let B=k.slice($,$+50);oe.decide({slotsFrom:"registry",registrySlotIds:B.map(([I])=>I),bootstrap:!1}).then(I=>{var P;if(I){let D={},V=[];for(let[ie,se]of B)(P=I.slotConfig)!=null&&P[ie]||(V.push(ie),se&&(D[ie]=se));V.length>0&&oe.reportSlots(V,D)}else pn(B.map(([D])=>D),ct,D=>{var V;let ie={};for(let[se,we]of B)D.has(se)&&we&&(ie[se]=we);(V=oe.requestSlots)==null||V.call(oe,[...D],ie)});ge.forEach(D=>D())})}},0))},decideSlots(f){for(let y of f)ut.has(y.id)||(ut.add(y.id),We.set(y.id,y));We.size===0||Gt!=null||(Gt=setTimeout(()=>{Gt=null;let y=[...We.values()];We.clear();for(let k=0;k<y.length;k+=30){let $=y.slice(k,k+30);oe.decide({slots:$}).then(B=>{B||pn($.map(I=>I.id),ut,I=>{var P;return(P=oe.decideSlots)==null?void 0:P.call(oe,$.filter(D=>I.has(D.id)))}),ge.forEach(I=>I())})}},0))},cancelSlots(f){for(let y of f)qe.delete(y)&&ct.delete(y),We.delete(y)&&ut.delete(y)},onSlotsChanged(f){return ge.add(f),()=>{ge.delete(f)}},getSitePalette(){return ee},getPersona(){return x?{persona:x.persona,confidence:x.confidence,band:Oe(x.confidence)}:null},async fetchWeights(){var f;try{let y=await fetch(`${w}/weights`,{headers:h});return y.ok?(f=(await y.json()).components)!=null?f:[]:[]}catch(y){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){var f;He==null||He(),Ft=!0,Ut=!0,b.destroy(),E.destroy(),((f=ce.get(e.apiKey))==null?void 0:f.dispose)===oe.dispose&&ce.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var f;He==null||He(),Ft=!0,Ut=!0,b.destroy(),E.destroy(),v.destroy(),O.clear(),((f=ce.get(e.apiKey))==null?void 0:f.dispose)===oe.dispose&&ce.delete(e.apiKey);try{localStorage.removeItem(St+e.apiKey),localStorage.removeItem(Jn(e.apiKey)),localStorage.removeItem(Vn(e.apiKey))}catch(y){}e.debug&&console.log("[sentient] destroyed")}};if(ce.set(e.apiKey,{config:e,upgrade:null,dispose:oe.dispose}),He=zo(oe,e.apiKey,f=>{Se.then(()=>{Ft||Qn.add(f)})}),e.debug){let f=window;f.__sentient&&(f.__sentient.client=oe)}return oe}var Ho=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function rn(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function Jo(e){return{tag:e.tagName.toLowerCase(),text:rn(e).slice(0,40)}}function tr(e){return e.replace(/["\\\]]/g,"\\$&")}function Qe(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function nr(e,t){var n;let r=e.tagName.toLowerCase();if(!r)return null;let o=((n=e.getAttribute("class"))!=null?n:"").split(/\s+/).filter(s=>/^[a-zA-Z][\w-]*$/.test(s)),a=[r,...o.map(s=>`${r}.${s}`)];for(let s of a)if(Qe(t,s))return s;let i=e.parentElement;if(i&&i!==t){let s=nr(i,t);if(s){for(let d of a){let m=`${s} > ${d}`;if(Qe(t,m))return m}let l=Array.from(i.children).filter(d=>d.tagName.toLowerCase()===r),u=l.indexOf(e),c=l.some(d=>d!==e&&rn(d)!==rn(e));if(u>=0&&c){let d=`${s} > ${r}:nth-of-type(${u+1})`;if(Qe(t,d))return d}}}return null}function rr(e,t){let n=Jo(e),r=e.getAttribute("id");if(r&&Qe(t,`#${tr(r)}`))return{v:1,id:r,fingerprint:n};for(let a of Ho){let i=e.getAttribute(a);if(i&&Qe(t,`[${a}="${tr(i)}"]`))return{v:1,dataAttr:{name:a,value:i},fingerprint:n}}let o=nr(e,t);return o?{v:1,selector:o,fingerprint:n}:null}Je();var ir=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Vo={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Yo(e){let t=e.ariaRole?Vo[e.ariaRole.toLowerCase()]:void 0;if(t)return t;if(e.tag==="nav")return"navigation";if(e.tag==="footer")return"footer";if(e.tag==="header")return e.actionCount>=5?"navigation":"hero";let n=`${e.idClass} ${e.headingText}`.toLowerCase();return/\b(navbar|nav-bar|navigation|site-nav|main-nav|topbar|footer)\b/.test(n)?/footer/.test(n)?"footer":"navigation":/\b(hero|masthead|jumbotron)\b/i.test(e.idClass)?"hero":null}function Xo(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var Zo=[["pricing",/\b(pricing|price list|per month|\/mo|subscriptions?)\b|\bplans?\b(?=[^.]{0,40}(from|start|month|year|[$€£]))/i],["faq",/\bfaq\b|frequently asked|common questions?/i],["comparison",/\b(compare|comparison|versus)\b|\bvs\./i],["social_proof",/\b(reviews?|ratings?|testimonial|brands?|galler(y|ies)|logos)\b|trusted by|loved by|case stud|what our customers say/i],["trust",/\b(insurance|warrant(y|ies)|guarantees?|certifi|accredit|security|privacy|compliance|gdpr|encrypt)\b|why choose|about us|our team/i],["cta",/\b(book|booking|reserve|appointments?|newsletter|subscribe)\b|contact us|get in touch|opening hours/i],["features",/\b(features?|benefits?|capabilit|services?|repairs?|menus?|products?)\b|how it works|our process|what we (do|offer)|what you get/i]],on=[["pricing",/(?:[$€£]\s?\d[\d,.]*\s*(?:\/|per\s)\s*(?:mo|month|yr|year|seat|user))|(?:\b(?:starter|basic|pro|growth|premium|enterprise)\b[^.]{0,60}[$€£]\s?\d)/i],["social_proof",/(?:★{2,})|(?:\b\d(?:\.\d)?\s*(?:out of|\/)\s*5\b)|(?:\brated\b)|(?:["“][^"”]{20,160}["”]\s*[—–-]\s*[A-Z][a-z]+)/],["trust",/\b(?:money[- ]back guarantee|free returns?|returns? within|refund(?:s)? within|encrypted|soc ?2|iso ?27001|gdpr[- ]compliant|cancel anytime)\b/i],["comparison",/\b(?:vs|versus)\b\.?[^.!?]{0,80}\b(?:compare|comparison|plans?|features?|alternative)\b|\bhow (?:we|it) compares?\b/i]],or={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function Qo(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function sr(e){var t,n;let r=Yo(e);if(r)return{type:(t=or[r])!=null?t:"generic",strength:"strong"};let o=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,s]of Zo)if(s.test(o))return{type:i,strength:"strong"};for(let[i,s]of on)if(s.test(e.bodyText))return{type:i,strength:"strong"};let a=Xo(e);return{type:(n=or[a])!=null?n:"generic",strength:"weak"}}function ar(e){var t,n;let r=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),o=e.getAttribute("role");return N({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:Qo(e),bodyText:r.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:r.length},o?{ariaRole:o}:{})}Je();var ei="section, header, footer, nav, main > div, [data-sentient-section]",ti=2e4;function ni(e){let t=Array.from(e.querySelectorAll(ei)),n=t.filter(r=>t.filter(o=>o!==r&&r.contains(o)).length<2);return n.filter(r=>!n.some(o=>o!==r&&o.contains(r)))}function ri(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 lr=()=>{};function cr(e,t){var n,r,o,a,i,s,l,u,c,d,m,C,p,g,_;let v=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!v||typeof IntersectionObserver=="undefined"||Ie()||!t.apiKey||!t.apiKey.startsWith("pk_"))return lr;let O=((r=t.apiBase)!=null?r:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),b=ni(v);if(b.length===0)return lr;let w=new Map,h=[];for(let x of b){let K=(i=[(a=t.sectionTypes)==null?void 0:a[(o=x.getAttribute("data-sentient-id"))!=null?o:""],x.getAttribute("data-sentient-type")].find(ge=>ir.includes(ge)))!=null?i:null,R=ar(x),z=(l=K!=null?K:(s=t.typeOf)==null?void 0:s.call(t,x))!=null?l:sr(R).type,Z=rr(x,v),Re=Z?`nc-${z}-${On(JSON.stringify({id:(u=Z.id)!=null?u:null,dataAttr:(c=Z.dataAttr)!=null?c:null,selector:(d=Z.selector)!=null?d:null})).toString(36)}`:`nc-${z}`;w.set(x,Re);let ze=on.filter(([,ge])=>ge.test(R.bodyText)).map(([ge])=>ge);h.push(_e(N({componentId:Re,semanticType:z,source:K?"markup":"auto"},Z?{locator:Z}:{}),{observation:N(N({tag:R.tag,idClass:R.idClass.slice(0,200),headingText:R.headingText,textLength:R.textLength,actionCount:R.actionCount},R.ariaRole?{ariaRole:R.ariaRole}:{}),ze.length>0?{patternFlags:ze}:{})}))}let A=(g=(p=(C=(m=v.defaultView)!=null?m:typeof window!="undefined"?window:void 0)==null?void 0:C.location)==null?void 0:p.pathname)!=null?g:"/";ri(t.apiKey,O,A,h);let E=new Map,F=x=>{let K=E.get(x);return K||(K={ms:0,scroll:0,enterAt:null,intersecting:!1},E.set(x,K)),K},M=new IntersectionObserver(x=>{for(let K of x){let R=w.get(K.target);if(!R)continue;let z=F(R);K.isIntersecting?(z.intersecting=!0,z.enterAt=Date.now(),K.intersectionRatio>z.scroll&&(z.scroll=K.intersectionRatio)):(z.intersecting=!1,z.enterAt!=null&&(z.ms+=Date.now()-z.enterAt,z.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let x of w.keys())M.observe(x);let q=()=>{let x=Date.now();for(let[K,R]of E)if(R.enterAt!=null&&(R.ms+=x-R.enterAt,R.enterAt=null),!(R.ms<=0)){try{e.track({projectId:t.apiKey,componentId:K,eventType:"dwell",payload:{dwell_time:Math.round(R.ms),scroll_depth:Number(R.scroll.toFixed(2))}})}catch(z){}R.ms=0}},W=()=>{if(v.hidden)q();else{let x=Date.now();for(let K of E.values())K.intersecting&&(K.enterAt=x)}},ne=!1,fe=x=>{if(q(),x!=null&&x.persisted){ne=!0;return}try{M.disconnect()}catch(K){}},S=x=>{if(!(x!=null&&x.persisted)||!ne)return;ne=!1;let K=Date.now();for(let R of E.values())R.enterAt=R.intersecting&&!v.hidden?K:null};v.addEventListener("visibilitychange",W);let T=(_=v.defaultView)!=null?_:typeof window!="undefined"?window:void 0;T==null||T.addEventListener("pagehide",fe),T==null||T.addEventListener("pageshow",S);let Y=setInterval(()=>{if(v.hidden||ne)return;q();let x=Date.now();for(let K of E.values())K.intersecting&&(K.enterAt=x)},ti),ee=[];return t.microSignals&&[...w.entries()].forEach(([x,K],R)=>{ee.push(Xe((z,Z={})=>{try{e.track({projectId:t.apiKey,componentId:K,eventType:"micro_signal",payload:N({signalType:z},Z)})}catch(Re){}},x,void 0,{tabLoss:R===0}))}),()=>{q(),clearInterval(Y),v.removeEventListener("visibilitychange",W),T==null||T.removeEventListener("pagehide",fe),T==null||T.removeEventListener("pageshow",S);for(let x of ee)x();try{M.disconnect()}catch(x){}}}function oi(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(a=>typeof a=="string"))return null;n[r]=o}return n}function ii(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function si(e){try{return e()}catch(t){return}}function At(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={};if(typeof t.slots=="object"&&t.slots!==null&&!Array.isArray(t.slots))for(let[a,i]of Object.entries(t.slots)){if(typeof i!="object"||i===null)continue;let s=i,l=oi(s.dims);if(!l||s.target!==void 0&&typeof s.target!="string")continue;let u=s.arms!==void 0?ii(s.arms):null,c={dims:l};typeof s.target=="string"&&(c.target=s.target),u&&(c.arms=u),n[a]=c}let r={apiKey:t.apiKey,personaAttributes:t.personaAttributes===!0,slots:n};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),typeof t.sectionCapture=="boolean"&&(r.sectionCapture=t.sectionCapture);let o=typeof t.persona=="function"?si(t.persona):t.persona;if(typeof o=="string"&&o.trim()!==""&&(r.persona=o),Array.isArray(t.sections)){let a=t.sections.filter(i=>typeof i=="string"&&i.trim()!=="").slice(0,50);a.length>=2&&(r.sections=a)}return r}function et(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 ai(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:"").replace(/\s+/g," ").trim().toLowerCase(),o=t.text.replace(/\s+/g," ").trim().toLowerCase();if(!(r===o||r.startsWith(o)||o.startsWith(r)))return!1}return!0}function xt(e,t){return!!(e!=null&&e.urlMatch)&&!et(t).includes(e.urlMatch)}var li=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function ur(e,t){var r;let n=[];if(e.id){let o=t.getElementById(e.id);n=o?[o]:[]}if(n.length===0&&((r=e.dataAttr)!=null&&r.name)&&li.test(e.dataAttr.name))try{let o=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${o}"]`))}catch(o){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(o){n=[]}return n}function ye(e,t){if(e.urlMatch&&!et(t).includes(e.urlMatch))return null;let n=ur(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!ai(r,e.fingerprint)?null:r}function dr(e,t){return xt(e,t)?!1:!!e.selector&&!e.dataAttr&&!e.id&&!e.fingerprint&&e.page===void 0?fr(e,t):ye(e,t)!==null}function fr(e,t){return ur(e,t).length>0}function kt(e,t){return xt(e,t)?!1:e.page!==void 0&&wt.test(e.page)?en(e.page,et(t)):fr(e,t)}var pr={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"},ci=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function gr(e){var r;if(e.trim().length===0||/[;{}<>]/.test(e))return!1;let t=/([A-Za-z-]*)\(/g,n;for(;(n=t.exec(e))!==null;)if(!ci.test((r=n[1])!=null?r:""))return!1;return!0}var mr=/^https:\/\//i,hr=new Map,Ae=null;function ui(e){return e.replace(/["\\]/g,"\\$&")}function di(e){var t;(!Ae||!Ae.isConnected)&&(Ae=e.querySelector("style[data-sentient-ops]"),Ae||(Ae=e.createElement("style"),Ae.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Ae))),Ae.textContent=[...hr.entries()].map(([n,r])=>`[data-snt-e="${ui(n)}"]{${r}}`).join(`
2
+ `)}function yr(e,t,n,r){var s;let o=!1,a=(s=t.moveBefore)!=null?s:t.moveAfter;if(a){let l=ye(a,r);!l||l===e||l.parentElement!==e.parentElement||!e.parentElement?o=!0:t.moveBefore?e.parentElement.insertBefore(e,l):e.parentElement.insertBefore(e,l.nextSibling)}typeof t.text=="string"&&(e.textContent=t.text),typeof t.href=="string"&&mr.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&mr.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let i=[];if(t.hidden&&i.push("display:none !important"),t.style)for(let[l,u]of Object.entries(t.style)){let c=pr[l];c&&typeof u=="string"&&gr(u)&&i.push(`${c}:${u.trim()} !important`)}return i.length>0&&(e.setAttribute("data-snt-e",n),hr.set(n,i.join(";")),di(r)),{anchorMiss:o}}var tt="data-sentient-block-arm",L=null;function je(e){L=e!=null?e:null}var ve="data-sentient-blocks-hid",Ke={none:"0",sm:"8px",md:"16px",lg:"24px"},sn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},vr={sm:"0.875em",md:"1em",lg:"1.25em"},fi={sm:"1.25em",md:"1.5em",lg:"2em"},pi={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},br={sm:"8px",md:"16px",lg:"32px"},gi={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},mi={normal:"400",medium:"500",bold:"700"};function ue(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function Sr(e){return e==="muted"?L!=null&&L.muted?{color:L.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:L==null?void 0:L.accent}:{}}function wr(e,t){var n,r,o,a,i,s,l,u,c,d,m,C,p,g,_,v,O,b,w,h;try{switch(e.type){case"stack":case"grid":{let A=t.createElement("div");if(e.type==="stack"){let M=e;ue(A,{display:"flex","flex-direction":M.direction,gap:(r=Ke[(n=M.gap)!=null?n:"md"])!=null?r:Ke.md,"align-items":M.align?sn[M.align]:void 0,"justify-content":M.justify?sn[M.justify]:void 0,"flex-wrap":M.wrap?"wrap":void 0})}else{let M=e,q=(a=Ke[(o=M.gap)!=null?o:"md"])!=null?a:Ke.md;ue(A,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${M.columns-1} * ${q}) / ${M.columns})), 1fr))`,gap:q,"align-items":M.align?sn[M.align]:void 0})}let E=e.type==="stack"&&e.surface==="raised",F=(i=e.pad)!=null?i:E?"md":void 0;F&&ue(A,{padding:(s=Ke[F])!=null?s:Ke.md}),E&&ue(A,{background:L==null?void 0:L.surface,color:L!=null&&L.surface?L==null?void 0:L.surfaceText:void 0,border:`1px solid ${(l=L==null?void 0:L.border)!=null?l:"currentColor"}`,"border-radius":(u=L==null?void 0:L.radius)!=null?u:"8px"});for(let M of(c=e.children)!=null?c:[]){let q=wr(M,t);q&&A.appendChild(q)}return A}case"text":{let A=t.createElement("p");return A.textContent=e.value,ue(A,De(j({margin:"0","font-size":e.size?vr[e.size]:void 0,"font-weight":e.weight?mi[e.weight]:void 0,"text-align":e.align},Sr(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let A=t.createElement(`h${e.level}`);return A.textContent=e.value,ue(A,{margin:"0","font-size":fi[(d=e.size)!=null?d:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let A=t.createElement("a");A.textContent=e.label,A.href=e.href,e.tag&&A.setAttribute("data-sentient-tag",e.tag);let E=(m=e.emphasis)!=null?m:"primary";return ue(A,{display:"inline-block",padding:pi[(C=e.size)!=null?C:"md"],"border-radius":(p=L==null?void 0:L.radius)!=null?p:"8px",font:"inherit","font-size":e.size?vr[e.size]:void 0,"text-decoration":E==="ghost"?"underline":"none",cursor:"pointer",background:E==="primary"?(g=L==null?void 0:L.primaryBg)!=null?g:"#111827":"transparent",color:E==="primary"?(_=L==null?void 0:L.primaryText)!=null?_:"#ffffff":(v=L==null?void 0:L.accent)!=null?v:"inherit",border:E==="secondary"?`1px solid ${(O=L==null?void 0:L.accent)!=null?O:"currentColor"}`:"none"})}case"link":{let A=t.createElement("a");return A.textContent=e.label,A.href=e.href,e.tag&&A.setAttribute("data-sentient-tag",e.tag),ue(A,{color:"inherit","text-decoration":"underline"})}case"image":{let A=t.createElement("img");return A.src=e.src,A.alt=e.alt,ue(A,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?gi[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let A=t.createElement("span");return A.textContent=e.value,ue(A,j({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(b=L==null?void 0:L.border)!=null?b:"currentColor"}`},Sr(e.tone)))}case"spacer":return ue(t.createElement("div"),{height:(w=br[e.size])!=null?w:br.md});case"divider":return ue(t.createElement("hr"),{border:"none","border-top":`1px solid ${(h=L==null?void 0:L.border)!=null?h:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(A){return null}}function Er(e,t,n,r){try{let o=new Set;for(let i of Array.from(e.children)){let s=i.getAttribute(tt);s!==null&&(t[s]===void 0?i.remove():o.add(s))}for(let[i,s]of Object.entries(t)){if(o.has(i))continue;let l=wr(s,r);if(!l)continue;let u=r.createElement("div");u.setAttribute(tt,i),u.style.display="none",u.appendChild(l),e.appendChild(u)}let a=n!==void 0&&t[n]!==void 0;for(let i of Array.from(e.children)){let s=i.getAttribute(tt),l=i;s!==null?l.style.display=a&&s===n?"":"none":a?l.hasAttribute(ve)||(l.setAttribute(ve,l.style.display),l.style.display="none"):l.hasAttribute(ve)&&(l.style.display=l.getAttribute(ve),l.removeAttribute(ve))}}catch(o){}}function hi(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(tt)!==null){n.remove();continue}n.hasAttribute(ve)&&(n.style.display=n.getAttribute(ve),n.removeAttribute(ve))}}catch(t){}}function Ct(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${tt}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${ve}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||hi(r)}catch(n){}}function an(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function _t(e,t,n,r){n.documentElement.setAttribute("data-sentient-persona",e),n.documentElement.setAttribute("data-sentient-confidence",t),r==null||r(n.documentElement,"data-sentient-persona"),r==null||r(n.documentElement,"data-sentient-confidence")}function Ot(e,t,n,r){var o;for(let[a,i]of Object.entries(t)){let s=e[a];if(!s||typeof s=="string")continue;let l=an(i.target,n);for(let u of l)for(let[c,d]of Object.entries(s))(o=i.dims[c])!=null&&o.includes(d)&&(u.setAttribute(`data-${c}`,d),r==null||r(u,`data-${c}`))}}function It(e,t,n,r){for(let[o,a]of Object.entries(t)){let i=e[o];if(typeof i!="string"||!a.arms||!a.arms.includes(i))continue;let s=an(a.target,n);for(let l of s)l.setAttribute("data-sentient-arm",i),r==null||r(l,"data-sentient-arm")}}function Lt(e,t,n,r){var s,l,u,c;let o=new Set,a=(s=r==null?void 0:r.contentAndOps)!=null?s:!0,i=[];for(let[d,m]of Object.entries(t)){if(xt(m.locator,n))continue;let C;if(m.locator){let g=ye(m.locator,n);C=g?[g]:[],!g&&kt(m.locator,n)&&i.push(d)}else C=an(m.target,n);let p=e[d];for(let g of C){if(p!==void 0)if(typeof p=="string")g.setAttribute("data-sentient-arm",p),(l=r==null?void 0:r.onAttr)==null||l.call(r,g,"data-sentient-arm"),a&&((u=r==null?void 0:r.onApplied)==null||u.call(r,d,p,g));else for(let[v,O]of Object.entries(p))g.setAttribute(`data-${v}`,O),(c=r==null?void 0:r.onAttr)==null||c.call(r,g,`data-${v}`);if(m.blocks&&!vi(n)){let v=Object.fromEntries(Object.entries(m.blocks).filter(([,O])=>!Et(O)));Object.keys(v).length>0&&(Er(g,v,typeof p=="string"?p:void 0,n),o.add(g))}if(!a)continue;let _=g.textContent;typeof m.content=="string"&&(g.textContent=m.content),m.ops&&yr(g,m.ops,d,n).anchorMiss&&!i.includes(d)&&i.push(d),tn(g,De(j(j({previous:_},typeof p=="string"?{arm:p}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return Ct(n,o),i}var yi=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function vi(e){var t,n,r;try{let o=(n=(t=e.defaultView)!=null?t:typeof window!="undefined"?window:void 0)==null?void 0:n.navigator;return o?o.webdriver===!0?!0:yi.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var bi=800;function Tt(e,t,n){let r=[];return n.forEach(({slotId:o,arm:a,el:i},s)=>{r.push(Xe((m,C={})=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"micro_signal",payload:j({signalType:m},C)})}catch(p){}},i,void 0,{tabLoss:s===0}));let l=null,u=0,c=()=>{u=Date.now(),l=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-u}})}catch(m){}l=null},bi)},d=()=>{l!==null&&(clearTimeout(l),l=null)};i.addEventListener("mouseenter",c),i.addEventListener("mouseleave",d),r.push(()=>{i.removeEventListener("mouseenter",c),i.removeEventListener("mouseleave",d),l!==null&&clearTimeout(l)})}),()=>{for(let o of r)o()}}function Si(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 xr(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var wi="_snt_fired_goals";function kr(e,t){try{e==null||e.sessionStorage.removeItem(xr(t)),e==null||e.sessionStorage.removeItem(wi)}catch(n){}}function Ar(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function Ei(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(o=>typeof o=="string")):new Set}catch(n){return new Set}}function Ai(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function Rt(e,t,n,r){var v,O;let o=(v=n.defaultView)!=null?v:typeof window!="undefined"?window:null,a=xr(r),i=Ei(o,a),s=b=>{let w=Ar(b);if(!i.has(w))try{b.slotId?t.componentGoal(b.slotId,b.goalId):t.goal(b.goalId),i.add(w),Ai(o,a,i)}catch(h){}},l=e.filter(b=>b.event==="click"),u=e.filter(b=>b.event==="form_submit"),c=e.filter(b=>b.event==="url_reached"),d=e.filter(b=>b.event==="scroll_depth"),m=(b,w)=>{if(!b.locator)return!1;let h=ye(b.locator,n);return!!h&&(h===w||h.contains(w))},C=b=>{let w=b.target;if(!(!w||typeof w.closest!="function"))for(let h of l)m(h,w)&&s(h)},p=b=>{let w=b.target;if(w)for(let h of u)m(h,w)&&s(h)},g=()=>{if(c.length===0)return;let b=et(n);for(let w of c)w.urlPattern&&Si(w.urlPattern,b)&&s(w)},_=()=>{var h;let b=n.documentElement,w=b.scrollHeight>0?(b.scrollTop+b.clientHeight)/b.scrollHeight:0;for(let A of d)w>=((h=A.threshold)!=null?h:.75)&&s(A);d.every(A=>i.has(Ar(A)))&&n.removeEventListener("scroll",_)};return n.addEventListener("click",C,!0),n.addEventListener("submit",p,!0),(O=n.defaultView)==null||O.addEventListener("popstate",g),g(),d.length>0&&(n.addEventListener("scroll",_,{passive:!0}),_()),{checkUrl:g,teardown:()=>{var b;n.removeEventListener("click",C,!0),n.removeEventListener("submit",p,!0),(b=n.defaultView)==null||b.removeEventListener("popstate",g),d.length>0&&n.removeEventListener("scroll",_)}}}function Pt(e,t){if(!e||e.length<2||t.size!==e.length)return null;let n=[];for(let i of e){let s=t.get(i);if(!s||n.includes(s))return null;n.push(s)}let r=n[0].parentNode;if(!r||!n.every(i=>i.parentNode===r))return null;let o=n.slice().sort((i,s)=>i.compareDocumentPosition(s)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),a=[];for(let i=0;i<n.length;i++){let s=n[i];o[i]!==s&&(a.push({el:s,before:o[i]}),o.splice(o.indexOf(s),1),o.splice(i,0,s))}return a}var Cr="__snt_editor_token";function _r(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(Cr):null}catch(e){return null}}function Or(e){try{sessionStorage.setItem(Cr,e)}catch(t){}}var ot="0.29.0",$t=ot!=="0.0.0-dev"?{name:"snippet",version:ot}:void 0,$r=ot!=="0.0.0-dev"?{v:ot}:{},it=5e3,xi=50,Br=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),Q=null,U=null,de={},le=null,X=null,xe=null,te=null,he=null,J=null,Le=null,Ir=!1,ln=null,Dt=null,Bt=null,Te=!1,nt=!1,ke=!1,Nt=null,Ce=[],Kt=null,rt=null,ae=null,ki=3e3,Ci=100;function st(e,t){let n,r=new Promise(o=>{n=setTimeout(()=>o(null),t)});return Promise.race([e,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}function pe(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Ge(e,t){return Q?(Q.personaAttributes&&J&&_t(J.persona,J.band,e,t==null?void 0:t.onAttr),Ot(de,Q.slots,e,t==null?void 0:t.onAttr),It(de,Q.slots,e,t==null?void 0:t.onAttr),le?Lt(de,le,e,j(j({},t),J?{persona:J.persona}:{})):(Ct(e,new Set),[])):[]}function Nr(e){var n;let t=new Map;for(let r of(n=Q==null?void 0:Q.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function cn(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=Pt(e,Nr(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function _i(e,t,n){let r=(o,a)=>t.some(([i,s])=>i===o&&s===a);try{if(Array.isArray(e.stamped))for(let o of e.stamped){if(!Array.isArray(o))continue;let[a,i,s]=o;!a||typeof i!="string"||r(a,i)||(s==null?a.removeAttribute(i):a.setAttribute(i,s))}if(Array.isArray(e.html))for(let o of e.html)typeof o!="string"||r(n.documentElement,o)||n.documentElement.removeAttribute(o)}catch(o){}}function Oi(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function Kr(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function at(e){var t;return(t=e.apiBase)!=null?t:"https://api.sentient-ui.com"}function Ii(e){return Promise.resolve().then(()=>fetch(`${at(e)}/v1/registry/locators`,{headers:{authorization:`Bearer ${e.apiKey}`}})).then(t=>t.ok?t.json():null).then(t=>Array.isArray(t==null?void 0:t.slots)?t.slots:null).catch(()=>null)}function jr(e,t){let n=[],r=[];for(let o of e)try{if(typeof(o==null?void 0:o.id)!="string")continue;!o.locator||dr(o.locator,t)?n.push(o.id):kt(o.locator,t)&&r.push(o.id)}catch(a){}return[n,r]}function Gr(e,t){let n=null;for(let r of t)e!=null&&e[r]&&((n!=null?n:n={})[r]=e[r]);return n}function Ur(){!Nt||!Te||Kt===window.location.pathname||(Kt=window.location.pathname,Li())}function Li(){ae==null||ae();let e=Q,t=Nt;if(!e||!t)return;let n,r,o=()=>{clearTimeout(n),clearTimeout(s),r==null||r.disconnect(),ae===o&&(ae=null)},a=null,i=l=>{let[u,c]=jr(t,document),d=u.filter(m=>!Ce.includes(m));a!==null&&u.some(m=>!a.has(m)&&!d.includes(m))&&lt(),a=new Set(u),d.length>0&&Ti(d).catch(()=>{}),(l||c.length===0&&!t.some(m=>!u.includes(m.id)&&!Ce.includes(m.id)))&&(o(),Fr(e,c))},s=setTimeout(()=>i(!0),ki);if(ae=o,i(),ae===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(i,Ci)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(l){}}async function Ti(e){let t=Q,n=U;if(!t||!n)return;Ce=Ce.concat(e);let r=await st(n.decide(j({slotsFrom:"registry",registrySlotIds:e},$r)),it);if(r||(Ce=Ce.filter(a=>!e.includes(a))),!r||ke||U!==n)return;de=j(j({},de),r.slots);let o=Gr(r.slotConfig,e);o&&(le=j(j({},le),o)),lt(),pe(t,"late decide",e),rt&&Ne(t.apiKey,rt=j(De(j({},rt),{slots:de,savedAt:Date.now()}),le?{slotConfig:le}:{}))}function Fr(e,t){if(t.length!==0)try{fetch(`${at(e)}/v1/locator-miss`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify({slots:t})}).catch(()=>{})}catch(n){}}function Ue(){return!!(Q&&U&&Q.sectionCapture!==!1&&(Q.consent!==!1||nt)&&!Ie())}function Ri(){if(!U||!Q||!Ue()||he)return;let e=[];Ge(document,{contentAndOps:Te,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),un();try{te==null||te(),te=Tt(U,Q.apiKey,e)}catch(t){}}function un(){if(typeof document=="undefined"||!Ue())return;let e;try{if(Dt&&Dt.length>0){let t=new Map;for(let n of Dt){if(n.urlMatch!==window.location.pathname)continue;let r=ye(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{he=cr(U,j({apiKey:Q.apiKey,apiBase:Q.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{})),Bt=window.location.pathname}catch(t){}}function lt(){try{let e=[];if(te==null||te(),te=null,Ge(document,{contentAndOps:Te,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),cn(Le,document),e.length>0&&Ue())try{te=Tt(U,Q.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Bt!==null&&window.location.pathname!==Bt&&Ue()&&(he==null||he(),he=null,un())}catch(t){}}catch(e){}}function Lr(){ln===null&&(ln=setTimeout(()=>{ln=null,lt();try{X==null||X.checkUrl()}catch(e){}Ur()},xi))}function dn(){if(!(Ir||typeof window=="undefined"||typeof history=="undefined")){Ir=!0;try{let e=t=>{let n=history[t];history[t]=function(r,o,a){let i=n.call(this,r,o,a!=null?a:null);return Lr(),i}};e("pushState"),e("replaceState"),window.addEventListener("popstate",Lr)}catch(e){}}}function Mt(e){let t={};for(let[n,r]of Object.entries(e.slots))try{t[n]=r.target?document.querySelectorAll(r.target).length:1}catch(o){t[n]=0}return t}function zr(e){return new URLSearchParams(e).get("sentient_editor")}function Pi(){try{let e=Array.from(document.getElementsByTagName("script")),t=/(^|\/)snippet(\.global)?\.js(\?|$)/,n=e.find(r=>t.test(r.src));if(n!=null&&n.src)return n.src.replace(t,"$1editor.global.js$3")}catch(e){}return null}function Di(e,t){var n,r,o;try{window.__sentientEditor={token:t,apiBase:at(e)};try{let s=document.createElement("meta");s.name="referrer",s.content="no-referrer",s.setAttribute("data-sentient-editor",""),((n=document.head)!=null?n:document.documentElement).appendChild(s)}catch(s){}let a=(r=e.editorSrc)!=null?r:Pi();if(!a){Rr();return}let i=document.createElement("script");i.src=a,i.async=!0,i.onerror=()=>Rr(),((o=document.head)!=null?o:document.documentElement).appendChild(i)}catch(a){}}var Tr="sentient-editor-load-notice",qr={position:"fixed",bottom:"16px",zIndex:"2147483647",background:"#111827",color:"#fff",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"};function Rr(){var e,t;try{if(typeof document=="undefined"||document.getElementById(Tr))return;(e=document.querySelector('meta[name="referrer"][data-sentient-editor]'))==null||e.remove();let n=document.createElement("div");n.id=Tr,n.textContent="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.",Object.assign(n.style,qr,{right:"16px",maxWidth:"320px",padding:"14px 16px",borderRadius:"14px",font:"13px/1.45 system-ui, sans-serif",border:"1px solid rgba(245,158,11,0.6)",cursor:"pointer"}),n.addEventListener("click",()=>n.remove()),((t=document.body)!=null?t:document.documentElement).appendChild(n),setTimeout(()=>n.remove(),1e4)}catch(n){}}function Wr(e){let t=new URLSearchParams(e).get("sentient_preview");if(!t)return null;let n={};for(let r of t.split("|")){let o=r.indexOf(":"),a=o===-1?"":r.slice(0,o),i=o===-1?"":r.slice(o+1);if(!(!a||!i))if(i.includes("=")){let s={};for(let l of i.split(",")){let[u,c]=l.split("=");u&&c&&(s[u]=c)}Object.keys(s).length&&(n[a]=s)}else n[a]=i}return Object.keys(n).length?n:null}function Hr(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var Pr="sentient-persona-preview-banner";function Dr(e,t){var n;try{if(typeof document=="undefined"||document.getElementById(Pr))return;let r=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),o=document.createElement("div");o.id=Pr,o.setAttribute("role","status"),Object.assign(o.style,qr,{left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"12px",padding:"10px 14px",borderRadius:"999px",font:"13px/1 system-ui, sans-serif",border:"1px solid rgba(255,255,255,0.14)"});let a=document.createElement("span");a.textContent=t?`\u201C${e}\u201D isn\u2019t in your personas \u2014 showing the default experience`:`Previewing as ${r}`;let i=document.createElement("button");i.type="button",i.textContent="Exit preview",Object.assign(i.style,{cursor:"pointer",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"inherit",padding:"4px 10px",borderRadius:"999px"}),i.addEventListener("click",()=>{try{let s=new URL(window.location.href);s.searchParams.delete("sentient_persona"),window.location.href=s.pathname+s.search+s.hash}catch(s){}}),o.appendChild(a),o.appendChild(i),((n=document.body)!=null?n:document.documentElement).appendChild(o)}catch(r){}}async function Mi(e,t){var r;if((r=e.registry)!=null?r:Object.keys(e.slots).length===0){let o=at(e),i=await st(fetch(`${o}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify({slotsFrom:"registry",includeDrafts:!0,force:Object.fromEntries(Object.entries(t).filter(s=>typeof s[1]=="string"))})}).then(s=>s.ok?s.json():null).catch(()=>null),it);if(!(i!=null&&i.slotConfig)){Fe(e),pe(e,"preview mode: slot config unavailable \u2014 page left as-is");return}le=i.slotConfig,je(i.palette)}de=t,J=null,Ge(document),dn(),Fe(e),pe(e,"preview mode",t)}async function $i(e,t){var u,c,d,m,C,p,g,_,v;let n=at(e),o=((u=e.registry)!=null?u:Object.keys(e.slots).length===0)?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(e.slots).map(([O,b])=>({id:O,dims:b.dims}))},a=await st(fetch(`${n}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify(o)}).then(O=>O.ok?O.json():null).catch(()=>null),it);if(!a){Fe(e),pe(e,"persona preview: explain unavailable \u2014 page left as-is");return}let i=a;de=(c=i.slots)!=null?c:{},le=(d=i.slotConfig)!=null?d:null,je(i.palette);let s=(p=(C=(m=i.personaAttributes)==null?void 0:m.persona)!=null?C:i.persona)!=null?p:t,l=(_=(g=i.personaAttributes)==null?void 0:g.confidence)!=null?_:"high";J={persona:s,band:l},Ge(document),Te=!0,dn(),Fe(e),i.recognized===!1?Dr(t,!0):Dr((v=i.personaDisplay)!=null?v:s)}function Fe(e){let t={goal(n,r){try{U==null||U.goal(n,r)}catch(o){}},componentGoal(n,r){try{U==null||U.componentGoal(n,r)}catch(o){}},grantConsent(){try{!U&&ke?(U=Ze(j({apiKey:e.apiKey,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,ingestUrl:Kr(e)},$t?{sdk:$t}:{})),xe&&xe.length>0&&(X==null||X.teardown(),X=Rt(xe,U,document,e.apiKey))):(nn(e.apiKey),U&&xe&&xe.length>0&&(X==null||X.teardown(),X=Rt(xe,U,document,e.apiKey))),ke=!1}catch(n){}nt=!0;try{Ri()}catch(n){}},revokeConsent(){try{he==null||he(),he=null,Bt=null,te==null||te(),te=null,ae==null||ae(),X==null||X.teardown(),X=null,kr(typeof window!="undefined"?window:null,e.apiKey),nt=!1,ke=!0,U==null||U.destroy(),U=null}catch(n){}},reapply:lt,getState(){var n,r;try{return{apiKey:e.apiKey,persona:(n=J==null?void 0:J.persona)!=null?n:null,band:(r=J==null?void 0:J.band)!=null?r:null,slots:de,matchCounts:Mt(e),consent:!ke&&(e.consent!==!1||nt)}}catch(o){return{apiKey:e.apiKey,persona:null,band:null,slots:{},matchCounts:{},consent:!1}}}};window.SentientSnippet=t;for(let n of Br.splice(0))try{n[0]==="goal"&&t.goal(n[1],n[2])}catch(r){}}function Mr(){var e;try{if(typeof window=="undefined")return;let t=window;if(typeof((e=t.SentientSnippet)==null?void 0:e.goal)=="function")return;let n=()=>{};t.SentientSnippet={goal:n,componentGoal:n,grantConsent:n,revokeConsent:n,reapply:n,getState:()=>({apiKey:"",persona:null,band:null,slots:{},matchCounts:{},consent:!1})},Br.length=0}catch(t){}}async function Jr(){var e,t;try{let n=At(window.sentient);if(!n){Mr();return}Q=n,Te=!1,Le=null,je(null),nt=!1,ke=!1,xe=null,Nt=null,Ce=[],Kt=null,rt=null,ae==null||ae();let r=typeof window!="undefined"?zr(window.location.search):null;if(r){Or(r);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){}}let o=r!=null?r:_r();if(o){Di(n,o),Fe(n),pe(n,"editor mode");return}let a=typeof window!="undefined"?Wr(window.location.search):null;if(a){await Mi(n,a);return}let i=typeof window!="undefined"?Hr(window.location.search):null;if(i){await $i(n,i),pe(n,"persona preview",i);return}let s=(e=n.registry)!=null?e:Object.keys(n.slots).length===0;n.registry===void 0&&!s&&pe(n,"slots declared without registry: true, so dashboard-published components are not applied");let l=s?Ii(n):null,u=Oi();try{(t=u==null?void 0:u.stop)==null||t.call(u)}catch(h){}let c=Ye(n.apiKey),d=[];c&&(J={persona:c.persona,band:c.band},de=c.slots,c.slotConfig&&(le=c.slotConfig),c.palette&&je(c.palette),Ge(document,j({contentAndOps:!1},u?{onAttr:(h,A)=>d.push([h,A])}:{})),c.layoutOrder&&(Le=c.layoutOrder,cn(Le,document))),u&&_i(u,d,document);let m=Ze(j({apiKey:n.apiKey,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,ingestUrl:Kr(n)},$t?{sdk:$t}:{}));U=m,Fe(n),dn();let C=Object.entries(n.slots).map(([h,A])=>({id:h,dims:A.dims})),p=$r,g={pp:u?u.v:0},_=Array.from(Nr(document).keys()),v=[];if(l){let[h]=await Promise.all([st(l,it),document.readyState==="loading"?new Promise(A=>document.addEventListener("DOMContentLoaded",A,{once:!0})):null]);Nt=h,h&&(Ce=v=jr(h,document)[0]),pe(n,"registry scope",h&&v)}let O=m.decide(j(j(j(j({slots:C},p),g),_.length>=2?{sections:_}:{}),s?{slotsFrom:"registry",registrySlotIds:v}:{})),b=await st(O,it),w=h=>{var F,M,q,W,ne;let A=m.getPersona();A?J={persona:A.persona,band:A.band}:h.persona&&(J={persona:h.persona,band:"low"}),de=h.slots,s?le=Gr(h.slotConfig,v):h.slotConfig&&(le=h.slotConfig),h.palette&&je(h.palette),Le=(F=h.layoutOrder)!=null?F:Le;let E=()=>{let fe=[],S=Ge(document,{onApplied:(T,Y,ee)=>fe.push({slotId:T,arm:Y,el:ee})});if(s||Fr(n,S),cn(Le,document),Te=!0,Ue())try{te==null||te(),te=Tt(U,n.apiKey,fe)}catch(T){}};if(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",E,{once:!0}):E(),xe=(M=h.goals)!=null?M:null,h.goals&&h.goals.length>0&&n.consent!==!1&&U)try{X==null||X.teardown(),X=Rt(h.goals,U,document,n.apiKey)}catch(fe){}Dt=(q=h.sectionMap)!=null?q:null,Ue()&&un(),pe(n,"applied",{persona:J,slots:de,matches:Mt(n)}),!ke&&(Ne(n.apiKey,rt=j(j({v:1,persona:(W=J==null?void 0:J.persona)!=null?W:h.persona,band:(ne=J==null?void 0:J.band)!=null?ne:"low",slots:h.slots,layoutOrder:h.layoutOrder,savedAt:Date.now()},le?{slotConfig:le}:{}),h.palette?{palette:h.palette}:{})),Kt=null,Ur())};if(!b){pe(n,"decide timeout/null \u2014 snapshot state stands",Mt(n)),O.then(h=>{!h||Te||ke||U!==m||(w(h),pe(n,"late decide applied",Mt(n)))}).catch(()=>{});return}w(b)}catch(n){Mr()}}if(typeof window!="undefined"&&window.sentient){let e=window;e.__sentientInitialized||(e.__sentientInitialized=!0,Promise.resolve().then(()=>{Jr()}))}return oo(Bi);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentientui/snippet",
3
- "version": "0.28.0",
3
+ "version": "0.29.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
  "license": "MIT",