@sentientui/snippet 0.31.0 → 0.31.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- "use strict";var SentientSnippet=(()=>{var kt=Object.defineProperty,Ao=Object.defineProperties,xo=Object.getOwnPropertyDescriptor,Co=Object.getOwnPropertyDescriptors,_o=Object.getOwnPropertyNames,Pn=Object.getOwnPropertySymbols;var Nn=Object.prototype.hasOwnProperty,Oo=Object.prototype.propertyIsEnumerable;var Dn=(e,t,n)=>t in e?kt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V=(e,t)=>{for(var n in t||(t={}))Nn.call(t,n)&&Dn(e,n,t[n]);if(Pn)for(var n of Pn(t))Oo.call(t,n)&&Dn(e,n,t[n]);return e},Te=(e,t)=>Ao(e,Co(t));var Mn=(e,t)=>()=>(e&&(t=e(e=0)),t);var $n=(e,t)=>{for(var n in t)kt(e,n,{get:t[n],enumerable:!0})},Io=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _o(t))!Nn.call(e,o)&&o!==n&&kt(e,o,{get:()=>t[o],enumerable:!(r=xo(t,o))||r.enumerable});return e};var Lo=e=>Io(kt({},"__esModule",{value:!0}),e);var To,Ro,Po,Bn,Do,No,Kn,B,Re,rt=Mn(()=>{"use strict";To=Object.defineProperty,Ro=Object.defineProperties,Po=Object.getOwnPropertyDescriptors,Bn=Object.getOwnPropertySymbols,Do=Object.prototype.hasOwnProperty,No=Object.prototype.propertyIsEnumerable,Kn=(e,t,n)=>t in e?To(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,B=(e,t)=>{for(var n in t||(t={}))Do.call(t,n)&&Kn(e,n,t[n]);if(Bn)for(var n of Bn(t))No.call(t,n)&&Kn(e,n,t[n]);return e},Re=(e,t)=>Ro(e,Po(t))});var Xn={};$n(Xn,{LOCAL_ENGINE_AVAILABLE:()=>Vo,createLocalEngine:()=>Wo});function Wo(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var Vo,Zn=Mn(()=>{"use strict";Vo=!1});var Ls={};$n(Ls,{applyPersonaAttributes:()=>jt,applyRegistrySlots:()=>Ft,applySlotArms:()=>Gt,applySlotAttributes:()=>Ut,parseEditorToken:()=>yo,parsePersonaPreview:()=>wo,parsePreview:()=>bo,parseSnippetConfig:()=>Mt,planReorder:()=>Wt,reapply:()=>vt,run:()=>So,version:()=>mt});var Ct=e=>{try{return decodeURIComponent(e)}catch(t){return e}};function At(e,t){if(e)for(let n of e.cookie.split(";")){let r=n.indexOf("=");if(r>0&&n.slice(0,r).trim()===t)return n.slice(r+1).trim()}}function xt(e,t,n){let r=[e,...e.document?[e.document]:[]];for(let o of r)for(let a of t)o.addEventListener(a,n);return()=>{for(let o of r)for(let a of t)o.removeEventListener(a,n)}}function Mo(e,t="statistics"){if(e==null||e==="")return null;let n=Ct(e).trim();if(n==="-1")return!0;if(n==="0")return!1;let r=new RegExp(`[{,]\\s*${t}\\s*:\\s*(true|false)`).exec(n);return r?r[1]==="true":null}function $o(e,t="C0002"){var n;if(e==null||e==="")return null;let r=(n=/(?:^|&)groups=([^&]*)/.exec(Ct(e)))==null?void 0:n[1];if(r==null)return null;for(let o of Ct(r).split(",")){let[a,i]=o.split(":");if(a===t)return i==="1"}return null}function Bo(e,t="analytics"){if(e==null||e==="")return null;let n=new RegExp(`(?:^|,)${t}:(yes|no)(?:,|$)`).exec(Ct(e));return n?n[1]==="yes":null}function Ko(e){var t,n,r,o,a,i;let s=typeof e=="string"?{cmp:e}:e;switch(s.cmp){case"cookiebot":return{cmp:"cookiebot",category:(t=s.category)!=null?t:"statistics"};case"onetrust":return{cmp:"onetrust",group:(n=s.group)!=null?n:"C0002"};case"cookieyes":return{cmp:"cookieyes",category:(r=s.category)!=null?r:"analytics"};case"tcf":return{cmp:"tcf",purposes:s.purposes&&s.purposes.length>0?s.purposes:[1]};case"google-consent-mode":return{cmp:"google-consent-mode",type:(o=s.type)!=null?o:"analytics_storage",dataLayer:(a=s.dataLayer)!=null?a:"dataLayer"};default:return{cmp:"custom",cookie:s.cookie,value:(i=s.value)!=null?i:"accepted",check:s.check,event:s.event}}}function jo(e,t="analytics_storage"){var n;if(!Array.isArray(e))return null;let r=null;for(let o of e){let a=o&&typeof o=="object"&&"length"in o?Array.prototype.slice.call(o):null;if(!a||a[0]!=="consent"||a[1]!=="default"&&a[1]!=="update")continue;let i=(n=a[2])==null?void 0:n[t];i==="granted"?r=!0:i==="denied"&&(r=!1)}return r}function nn(e,t=window){let n=Ko(e),r=t,o=t.document;switch(n.cmp){case"cookiebot":return{read:()=>{let a=r.Cookiebot;return a!=null&&a.consent&&typeof a.consent[n.category]=="boolean"?a.consent[n.category]===!0:Mo(At(o,"CookieConsent"),n.category)},subscribe:a=>xt(t,["CookiebotOnAccept","CookiebotOnDecline","CookiebotOnConsentReady","CookiebotOnLoad"],a)};case"onetrust":return{read:()=>{let a=r.OnetrustActiveGroups;return typeof a=="string"?`,${a},`.includes(`,${n.group},`):$o(At(o,"OptanonConsent"),n.group)},subscribe:a=>xt(t,["OneTrustGroupsUpdated"],a)};case"cookieyes":return{read:()=>{var a;let i=r.getCkyConsent;if(typeof i=="function")try{let s=(a=i())==null?void 0:a.categories;if(s&&typeof s[n.category]=="boolean")return s[n.category]===!0}catch(s){}return Bo(At(o,"cookieyes-consent"),n.category)},subscribe:a=>xt(t,["cookieyes_consent_update","cookieyes_banner_load","cookieyes_banner_loaded"],a)};case"tcf":{let a=null;return{read:()=>a,subscribe:i=>{let s,u=!1,c=(g,x)=>{!x||u||(typeof g.listenerId=="number"&&(s=g.listenerId),g.eventStatus==="cmpuishown"?a=!1:a=g.gdprApplies===!1||n.purposes.every(f=>{var m,E;return((E=(m=g.purpose)==null?void 0:m.consents)==null?void 0:E[f])===!0}),i())},l=0,d=()=>{if(u)return;let g=r.__tcfapi;typeof g=="function"?g("addEventListener",2,c):l++<40&&window.setTimeout(d,250)};return d(),()=>{u=!0;let g=r.__tcfapi;typeof g=="function"&&s!==void 0&&g("removeEventListener",2,()=>{},s)}}}}case"google-consent-mode":{let a=()=>r[n.dataLayer];return{read:()=>jo(a(),n.type),subscribe:i=>{var s,u;let c=(u=r[s=n.dataLayer])!=null?u:r[s]=[],l=c.push,d=function(...x){let f=l.apply(c,x);return i(),f};c.push=d;let g=window.setInterval(i,1e3);return()=>{window.clearInterval(g),c.push===d&&(c.push=l)}}}}case"custom":return{read:()=>{if(n.check)try{return n.check()===!0}catch(i){return!1}if(!n.cookie)return null;let a=At(o,n.cookie);return a===void 0?null:a===n.value},subscribe:a=>n.event?xt(t,[n.event],a):()=>{}}}}rt();function _t(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function jn(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 rn(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 _t(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 _t(o)}function Un(e,t){var n,r;return e.dims!=null?(r=(n=jn(t))!=null?n:jn(rn(e)))!=null?r:{}:t}function Gn(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 $e(e){return e>=.3?e<.7?"medium":"high":"low"}function Ot(e){return e?`_${e.slice(0,12)}`:""}var Uo="_snt_uid";function Fn(e){return`${Uo}${Ot(e)}`}var Go=["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 zn(e){return Fo(e)!==null}function Fo(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=Go.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function Vn(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 Wn(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 Hn(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var zo=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function qn(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):zo.includes(o)&&(o in n||(n[o]=a))}catch(r){}return{utmParams:t,clickIds:n}}function Jn(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function on(e){return B(B(B({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 sn(e){let t=on(e);return Un(t,rn(t))}function Yn(e){return typeof e=="string"?e:_t(e)}rt();function or(){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 Ho="_snt_uid",qo=365,It="_snt_uid";function Jo(){return or()}function Qn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Yo(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(r){}}function an(e){try{return localStorage.getItem(e)}catch(t){return null}}function er(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function tr(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function Xo(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Zo(e){try{sessionStorage.removeItem(e)}catch(t){}}function Qo(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 ei(e){try{localStorage.removeItem(e)}catch(t){}}function ti(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var ni={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function ir(e){var t,n,r,o,a,i,s;if(typeof window=="undefined")return ni;let u=Ot(e==null?void 0:e.apiKey),c=(t=e==null?void 0:e.cookieName)!=null?t:Fn(e==null?void 0:e.apiKey),l=`${It}${u}`,d=`${It}_tomb${u}`,g=((n=e==null?void 0:e.cookieTTLDays)!=null?n:qo)*24*60*60,x=b=>b&&b.length>0?b:null,f=()=>{var b,h;return u&&!(e!=null&&e.cookieName)&&an(d)===null?(h=(b=x(Qn(Ho)))!=null?b:x(an(It)))!=null?h:x(tr(It)):null},m=(s=(i=(a=(o=(r=x(Qn(c)))!=null?r:x(an(l)))!=null?o:x(tr(l)))!=null?a:f())!=null?i:x(e==null?void 0:e.ssrSessionId))!=null?s:Jo();Yo(c,m,g);let E=er(l,m),y=Qo(c),k=E?!1:Xo(l,m),w=!E&&!y&&!k;return{getSessionId:()=>m,isEphemeral:()=>w,destroy:()=>{m=null,ti(c),ei(l),Zo(l),u&&!(e!=null&&e.cookieName)&&er(d,"1")}}}function Fe(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function pn(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 sr(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 ze(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 ar(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 ri=500,oi=56*1024;function lr(e){return`_snt_retry_${e.slice(0,12)}`}var ii={push:()=>{},flush:()=>{},destroy:()=>{}};function si(e){var t,n,r;if(typeof window=="undefined")return ii;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,u=e.apiKey,c=lr(u),l=[],d=new Set,g=[],x=A=>{for(let N of A)f.delete(N),!d.has(N)&&(d.add(N),g.push(N));for(;g.length>ri;){let N=g.shift();N&&d.delete(N)}ar(A,c)},f=new Set,m=()=>{for(;l.length>i;){let A=l.shift();A&&f.delete(A.id)}},E=A=>{d.has(A.id)||f.has(A.id)||(f.add(A.id),l.push(A),m())},y=A=>{for(let N of A)d.has(N.id)||(f.add(N.id),l.push(N));m()},k=sr(c,i);for(let A of k)E(A);let w=0,b=0,h=(A,N=!0)=>{if(A.length===0)return;let X=JSON.stringify(A),Y=A.map(L=>L.id),ie;try{ie=fetch(s,{method:"POST",keepalive:!0,body:X,headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`}})}catch(L){ze(A,i,c),y(A),b++,w=Date.now()+Fe(b);return}let Z=L=>{if(pn(L)!=="retry"){if(!L.ok&&N){let _=A.filter(U=>U.eventType!=="pageview");if(_.length>0&&_.length<A.length){x(A.filter(U=>U.eventType==="pageview").map(U=>U.id)),h(_,!1);return}}x(Y),b=0,w=0;return}ze(A,i,c),y(A),b++,w=Date.now()+Fe(b)};ie instanceof Promise?ie.then(Z).catch(()=>{ze(A,i,c),y(A),b++,w=Date.now()+Fe(b)}):Z(ie)},P=typeof TextEncoder!="undefined"?new TextEncoder:null,I=A=>P?P.encode(A).length:A.length,F=A=>{let N=[],X=2;for(let Y of A){let ie=I(JSON.stringify(Y))+1;if(N.length>0&&X+ie>oi||N.length>=a)break;N.push(Y),X+=ie}return N},S=()=>{try{if(Date.now()<w)return;for(;l.length>0&&!(Date.now()<w);){let A=l.filter(X=>!d.has(X.id));if(l.length=0,A.length===0)break;let N=F(A);if(N.length===0)break;N.length<A.length&&l.push(...A.slice(N.length)),h(N)}}catch(A){}},J=!0,z=null;z=setInterval(()=>{J&&S()},o);let K=()=>{document.visibilityState==="hidden"&&S()},oe=()=>{S()};return document.addEventListener("visibilitychange",K),window.addEventListener("pagehide",oe),{push(A){E(A),l.length>=a&&S()},flush:S,destroy(){J=!1,z!==null&&(clearInterval(z),z=null),document.removeEventListener("visibilitychange",K),window.removeEventListener("pagehide",oe),S()}}}var ai=200;function ur(e){return`_snt_goal_retry_${e.slice(0,12)}`}var li={send:()=>{},flush:()=>{},destroy:()=>{}};function ui(e){var t,n,r;if(typeof window=="undefined")return li;let o=(t=e.flushIntervalMs)!=null?t:5e3,a=(n=e.maxRetrySize)!=null?n:100,i=(r=e.maxPerFlush)!=null?r:5,s=ur(e.apiKey),u=[],c=new Set,l=new Set,d=[],g=0,x=0,f=!1,m=I=>{for(c.delete(I.id),l.has(I.id)||(l.add(I.id),d.push(I.id));d.length>ai;){let F=d.shift();F&&l.delete(F)}ar([I.id],s)},E=I=>{ze([I],a,s),!l.has(I.id)&&!c.has(I.id)&&(c.add(I.id),u.push(I)),Date.now()>=g&&(x++,g=Date.now()+Fe(x))},y=I=>{let F;try{F=fetch(e.url,{method:"POST",keepalive:!0,body:I.body,headers:e.headers})}catch(J){E(I);return}let S=J=>{var z;let K=pn(J);if(K==="retry"){E(I);return}K==="dropped"&&((z=e.onDrop)==null||z.call(e,I,J.status)),m(I),x=0,g=0};F instanceof Promise?F.then(S).catch(()=>E(I)):S(F)},k=()=>{try{if(f||Date.now()<g)return;let I=0;for(;u.length>0&&I<i&&!(Date.now()<g);){let F=u.shift();c.delete(F.id),!l.has(F.id)&&(I++,y(F))}}catch(I){}},w=sr(s,a);for(let I of w)c.has(I.id)||(c.add(I.id),u.push(I));w.length>0&&ze(w,a,s);let b=setInterval(k,o),h=()=>{document.visibilityState==="hidden"&&k()},P=()=>k();return document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",P),{send(I){if(!f&&!(l.has(I.id)||c.has(I.id))){if(Date.now()<g){ze([I],a,s),c.add(I.id),u.push(I);return}y(I)}},flush:k,destroy(){clearInterval(b),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",P),k(),f=!0}}}var ci=1800*1e3;function Lt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function di(e=ci,t){let n=new Map,r=`_snt_asgn${Ot(t)}_`,o=(u,c)=>`${r}${encodeURIComponent(u)}:${encodeURIComponent(c)}`,a=u=>{let c=u.slice(r.length),l=c.indexOf(":");if(l<0)return null;try{return{componentId:decodeURIComponent(c.slice(0,l)),segment:decodeURIComponent(c.slice(l+1))}}catch(d){return null}},i=()=>{try{let u=[];for(let c=0;c<localStorage.length;c++){let l=localStorage.key(c);l!=null&&l.startsWith(r)&&u.push(l)}return u}catch(u){return[]}},s=u=>u.assignedAt+(u.ttlMs&&u.ttlMs>0?u.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let u of i())try{let c=localStorage.getItem(u);if(!c)continue;let l=JSON.parse(c);if(s(l)){localStorage.removeItem(u);continue}let d=a(u);if(!d)continue;n.set(Lt(d.componentId,d.segment),l)}catch(c){}})(),{get(u,c){let l=n.get(Lt(u,c));return l?s(l)?(n.delete(Lt(u,c)),null):l:null},set(u,c,l){let d=Lt(u,c);n.set(d,l);try{localStorage.setItem(o(u,c),JSON.stringify(l))}catch(g){}},clear(){n.clear();for(let u of i())try{localStorage.removeItem(u)}catch(c){}}}}var Pt="_snt_snap:",fi=["low","medium","high"];function it(e){try{let t=localStorage.getItem(Pt+e);if(!t)return null;let n=JSON.parse(t);if(!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!fi.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)))return null;let r=n.vocabulary;return r!==void 0&&(typeof r!="object"||r===null||!Array.isArray(r.entries)||!Array.isArray(r.images))&&delete n.vocabulary,n}catch(t){return null}}function We(e,t){try{localStorage.setItem(Pt+e,JSON.stringify(t))}catch(n){}}var dn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",cr="[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.",nr=!1,Tt=!1;function pi(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function mi(e){var t;let n=ir({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=pi(),a=Promise.resolve().then(()=>(Zn(),Xn)).then(l=>{let d=l;return d.LOCAL_ENGINE_AVAILABLE?(nr||(nr=!0,console.info(cr)),d):(Tt||(Tt=!0,console.error(dn)),null)}).catch(()=>(Tt||(Tt=!0,console.error(dn)),null)),i=null,s={low:.15,medium:.5,high:.85},u=(()=>{var l;if(e.initialPersona)return B({},e.initialPersona);let d=it(e.apiKey||"local");return d?{persona:d.persona,confidence:(l=s[d.band])!=null?l:.15}:null})();function c(l){let d=document.documentElement;d.dataset.sentientPersona===void 0&&(d.dataset.sentientPersona=l.persona,d.dataset.sentientConfidence=$e(l.confidence))}return{isLocal:!0,async decide(l){var d,g,x;let f=await a;if(!f)return null;let m=f.createLocalEngine({sessionId:r,forcedPersona:o}).decide(l);return i=Re(B({},m),{layoutOrder:(g=(d=m.layoutOrder)!=null?d:i==null?void 0:i.layoutOrder)!=null?g:null,slots:B(B({},(x=i==null?void 0:i.slots)!=null?x:{}),m.slots)}),We(e.apiKey||"local",{v:1,persona:i.persona,band:$e(i.confidence),slots:i.slots,layoutOrder:i.layoutOrder,savedAt:Date.now()}),c(m),m},getSlotResult(l){var d,g,x;return(x=(g=i==null?void 0:i.slots[l])!=null?g:(d=e.initialSlots)==null?void 0:d[l])!=null?x:null},getSlotConfig(l){var d,g;return(g=(d=e.initialSlotConfig)==null?void 0:d[l])!=null?g:null},getSitePalette(){var l;return(l=e.initialPalette)!=null?l:null},reportSlots(){},getPersona(){let l=i!=null?i:u;return l?{persona:l.persona,confidence:l.confidence,band:$e(l.confidence)}:null},async assign(l,d){var g;let x=await a;return!x||!d||d.length===0?d!=null&&d[0]?{variantId:d[0],assignmentTtlMs:0}:null:{variantId:(g=x.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:l,variantIds:d}]}).assignments[l])!=null?g:d[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>n.destroy()}}var Dt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function ln(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function mn(e,t){if(e===void 0||!Dt.test(e))return!1;if(e==="*")return!0;let n=ln(t);if(e.endsWith("/*")){let r=ln(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===ln(e)}function st(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(st):!1}var rr="sentient-reveal",Ve="sentient-revealed";var un=!1;function gi(e){if(un||e.getElementById(rr)){un=!0;return}let t=e.createElement("style");t.id=rr,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${Ve}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${Ve}{animation:${Ve} 240ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),un=!0}function gn(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;gi(r),e.classList.remove(Ve),e.offsetWidth,e.classList.add(Ve);let o=()=>{e.classList.remove(Ve),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function at(e,t,n,r){let o=[];{let a=!1,i=[],s=()=>{if(a)return;let u=Date.now();for(i.push(u);i.length>0&&u-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 u=typeof window!="undefined"?window.getSelection():null,c=u?u.toString().length:0;e("text_copy",{selectionLength:c})};document.addEventListener("copy",i),o.push(()=>document.removeEventListener("copy",i))}{let a=!1,i=!1,s=null,u=()=>{s!==null&&(clearTimeout(s),s=null)},c=()=>{a||!i||(u(),s=setTimeout(()=>{!a&&i&&(a=!0,e("scroll_hesitation"))},3e3))},l=()=>{u(),c()},d=x=>{for(let f of x)i=f.intersectionRatio>.3,i?c():u()},g=new IntersectionObserver(d,{threshold:[.3]});g.observe(t),window.addEventListener("scroll",l,{passive:!0}),o.push(()=>{g.disconnect(),window.removeEventListener("scroll",l),u()})}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 u=Date.now()-i;u<15e3&&(a=!0,e("tab_loss",{timeOnPage:u}))};document.addEventListener("visibilitychange",s),o.push(()=>document.removeEventListener("visibilitychange",s))}return()=>{for(let a of o)a()}}function hi(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var dr="https://api.sentient-ui.com/v1/events",we=new Map,fr=null;function yi(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var vi=3;function cn(){return or()}function Rt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function bi(){let e=new WeakMap,t=new Map,n=!1,r=(s,u,c)=>{let l=s.get(u);return c===null?l?!0:(s.set(u,new Set),!1):l?l.has(c)?!0:(l.add(c),!1):(s.set(u,new Set([c])),!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,u=()=>{s||(s=!0,n=!1,t.clear())};if(setTimeout(u,0),typeof MessageChannel=="function"){let c=new MessageChannel;c.port1.onmessage=()=>{c.port1.close(),c.port2.close(),u()},c.port2.postMessage(0)}};return{firedBefore(s,u){let c=a();if(c){let d=e.get(c);return d||(d=new Map,e.set(c,d)),r(d,s,u)}let l=r(t,s,u);return!l&&!n&&(n=!0,i()),l}}}var pr=new Set;function wi(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,a,i=()=>{if(o)return;let c=Rt();!c||c===a||(a=c,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${c}`))},s=[];for(let c of["pushState","replaceState"]){let l=r[c],d=function(...g){let x=l.apply(this,g);return i(),x};r[c]=d,s.push([c,l,d])}window.addEventListener("popstate",i);let u=Rt();return u&&pr.has(`${t}:${u}`)?a=u:i(),()=>{if(!o){o=!0,window.removeEventListener("popstate",i);for(let[c,l,d]of s)r[c]===d&&(r[c]=l)}}}var ot={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}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Si(){try{return qn(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function mr(e){return e.replace(/\/events\/?$/,"")}function Be(){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 hn(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:fr;if(!n){console.warn("[sentient] grantConsent() called before init()");return}let r=we.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&&Be())return;let s=(i!=null?i:lt)(Re(B({},o),{consent:!0}));a(s);let u=(t=we.get(n))==null?void 0:t.dispose;we.set(n,{config:Re(B({},o),{consent:!0}),upgrade:null,dispose:u})}function Ei(e){var t;let n=e.preConsentBehavior==="statistical_winner",r=mr((t=e.ingestUrl)!=null?t:dr),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(f,m,E){if(!n)return Promise.resolve(null);let y=a.get(f);return y?Promise.resolve(y):fn(i,f,async()=>{try{let k=new URLSearchParams({componentId:f});for(let h of m!=null?m:[])k.append("variantIds[]",h);let w=await fetch(`${r}/winner?${k.toString()}`,{headers:o});if(!w.ok)return m!=null&&m[0]?{variantId:m[0],assignmentTtlMs:0}:null;let b={variantId:(await w.json()).variantId,assignmentTtlMs:0};return a.set(f,b),b}catch(k){return m!=null&&m[0]?{variantId:m[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},u=!1,c=new Set,l=[],d=[],g={track:f=>s.track(f),goal:((f,m,E,y)=>s.goal(f,m,E,y)),componentGoal:(f,m,E)=>s.componentGoal(f,m,E),identify:f=>s.identify(f),getAssignment:(f,m)=>s.getAssignment(f,m),assign:(f,m,E,y)=>s.assign(f,m,E,y),decide:f=>s.decide(f),getSlotResult:f=>s.getSlotResult(f),isSlotDecided:f=>{var m,E;return(E=(m=s.isSlotDecided)==null?void 0:m.call(s,f))!=null?E:!0},getSlotConfig:f=>s.getSlotConfig(f),getSitePalette:()=>s.getSitePalette(),getStyleVocabulary:()=>{var f,m;return(m=(f=s.getStyleVocabulary)==null?void 0:f.call(s))!=null?m:null},reportSlots:(f,m,E,y)=>s.reportSlots(f,m,E,y),reportSkeleton:(f,m)=>{var E;return(E=s.reportSkeleton)==null?void 0:E.call(s,f,m)},reportDrift:(f,m,E,y)=>{var k;return(k=s.reportDrift)==null?void 0:k.call(s,f,m,E,y)},requestSlots:(f,m,E)=>{var y;return u?(y=s.requestSlots)==null?void 0:y.call(s,f,m,E):l.push([f,m,E])},decideSlots:f=>{var m;return u?(m=s.decideSlots)==null?void 0:m.call(s,f):d.push(...f)},cancelSlots:f=>{var m;if(u)return(m=s.cancelSlots)==null?void 0:m.call(s,f);let E=new Set(f);for(let y of l)y[0]=y[0].filter(k=>!E.has(k));d=d.filter(y=>!E.has(y.id))},onSlotsChanged:f=>(c.add(f),()=>{c.delete(f)}),getPersona:()=>s.getPersona(),fetchWeights:()=>s.fetchWeights(),getGraph:()=>s.getGraph(),flush:()=>s.flush(),dispose:()=>s.dispose(),destroy:()=>s.destroy()};function x(f){var m,E,y;s=f,u=!0,(m=f.onSlotsChanged)==null||m.call(f,()=>c.forEach(k=>k()));for(let[k,w,b]of l.splice(0))k.length>0&&((E=f.requestSlots)==null||E.call(f,k,w,b));d.length>0&&((y=f.decideSlots)==null||y.call(f,d.splice(0)))}return{proxy:g,setInner:x}}function fn(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 lt(e){var t,n,r,o,a,i,s,u,c,l;if(typeof window=="undefined")return ot;fr=e.apiKey||"local";let d=we.get(e.apiKey||"local");if(d!=null&&d.dispose)try{d.dispose()}catch(p){}let g=e.respectDoNotTrack!==!1&&Be(),x=e.consent===!1||g,f=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!f&&e.localMode!==!1)return we.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."}),x?ot:mi(e);if(x){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."),we.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."}),ot;let{proxy:p,setInner:v}=Ei(e);return we.set(e.apiKey,{config:e,upgrade:g?null:v}),p}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."),ot;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),ot;let m=(t=e.ingestUrl)!=null?t:dr,E=Date.now(),y=ir({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),k=di(void 0,e.apiKey),w=si({ingestUrl:m,apiKey:e.apiKey}),b=mr(m),h={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},P=new Set,I=ui({url:`${b}/goals`,apiKey:e.apiKey,headers:h,onDrop:(p,v)=>{if(!e.debug){if(P.has(v))return;P.add(v)}console.warn(`[sentient] goal dropped (HTTP ${v}) \u2014 this will not be retried. `+(v===400?"The session was not found: call init() and let the session upsert complete before firing goals.":v===401||v===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),p)}}),F=Vn((n=navigator.userAgent)!=null?n:""),S=window.location.origin,J=Wn((r=document.referrer)!=null?r:"",S),z=(o=e.sessionSegment)!=null?o:`${F}:${J}`,K=new Map,oe=new Map,A=new Map,N=new Set,X=new Map,Y=null,ie=null,Z=null,L=new Set,_=new Set,U=new Map,Q=new Map,T=new Set,re=new Set,be=new Set,me=null,bt=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,xn=new Set,wt=new Set,St=new Set,et=new Map,Zt=null,Et=new Set,tt=new Map,Qt=null,Eo=2,Cn=new Map,en=!1,_n=(p,v,M)=>{var W;let G=new Set,C=1;for(let O of p){v.delete(O);let $=((W=Cn.get(O))!=null?W:0)+1;Cn.set(O,$),$<=Eo&&(G.add(O),$>C&&(C=$))}G.size>0&&setTimeout(()=>{en||M(G)},Fe(C))},On=p=>{for(let v of p)A.has(v.id)||A.set(v.id,sn(v))};if(e.initialSlots)for(let[p,v]of Object.entries(e.initialSlots))A.set(p,v),N.add(p);if(e.initialSlotConfig)for(let[p,v]of Object.entries(e.initialSlotConfig))X.set(p,v);e.initialPalette&&(Y=e.initialPalette),e.initialVocabulary&&(ie=e.initialVocabulary);let Ae=it(e.apiKey);if(Ae){for(let[p,v]of Object.entries(Ae.slots))A.has(p)||A.set(p,v);for(let[p,v]of Object.entries((a=Ae.slotConfig)!=null?a:{}))X.has(p)||X.set(p,v);!Y&&Ae.palette&&(Y=Ae.palette),!ie&&Ae.vocabulary&&(ie=Ae.vocabulary)}let In={low:.15,medium:.5,high:.85};if(e.initialPersona)Z=B({},e.initialPersona);else{let p=document.documentElement.dataset;p.sentientPersona?Z={persona:p.sentientPersona,confidence:(s=In[(i=p.sentientConfidence)!=null?i:"low"])!=null?s:.15}:Ae&&(Z={persona:Ae.persona,confidence:(u=In[Ae.band])!=null?u:.15})}if(e.initialAssignments)for(let[p,v]of Object.entries(e.initialAssignments))k.set(p,z,{variantId:v,assignedAt:Date.now(),segment:z,confidence:1});let Ie=Promise.resolve(),Ln=y.getSessionId();if(Ln){let p=Hn((c=document.referrer)!=null?c:""),{utmParams:v,clickIds:M}=Si(),W=B(B(B(B({sessionId:Ln,deviceClass:F,trafficSource:J,referrerDomain:p,utmParams:v,clickIds:M,timeOfDay:Jn(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:y.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||zn((l=navigator.userAgent)!=null?l:"")},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}:{}),G=async()=>{for(let C=0;;C++){try{let O=await fetch(`${b}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(W),headers:h});if(O.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(O.ok||pn(O)==="dropped")return}catch(O){}if(C>=vi){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(O=>setTimeout(O,Fe(C+1)))}};try{Ie=G()}catch(C){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:w});let ko=bi(),nt=null,tn=!1,de={goal(p,v={},M=1,W=0){var G,C,O,$,H,ee,ae;let ue=y.getSessionId();if(!ue)return;let q=yi(v)?v:{metadata:v},ge=[p,(G=q.externalId)!=null?G:"",(C=q.stepIndex)!=null?C:W,(O=q.weight)!=null?O:M].join("\0"),Ee=q.value!==void 0?`${q.value}\0${($=q.currency)!=null?$:""}`:null;if(ko.firedBefore(ge,Ee)){e.debug&&console.log(`[sentient] goal("${p}") already recorded for this action \u2014 not sent twice`);return}let pe=cn(),D={sessionId:ue,name:p,metadata:(H=q.metadata)!=null?H:{},weight:(ee=q.weight)!=null?ee:M,stepIndex:(ae=q.stepIndex)!=null?ae:W,goalId:pe,value:q.value,currency:q.currency,externalId:q.externalId};e.debug&&console.log("[sentient] goal",D);let fe={id:pe,body:JSON.stringify(D)};Ie.then(()=>I.send(fe))},componentGoal(p,v,M){var W,G,C;let O=y.getSessionId();if(!O)return;let $=k.get(p,z),H=$?null:(W=A.get(p))!=null?W:null;if(!$&&H===null){e.debug&&console.warn(`[sentient] componentGoal("${p}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!$&&!N.has(p)){e.debug&&console.warn(`[sentient] componentGoal("${p}"): slot not decided this session \u2014 not attributed`);return}let ee=$?$.variantId:Yn(H),ae={id:cn(),sessionId:O,projectId:e.apiKey,componentId:p,variantId:ee,eventType:"goal_achieved",goalType:v,payload:B({reward:(G=M==null?void 0:M.reward)!=null?G:1,goalValue:M==null?void 0:M.value,currency:M==null?void 0:M.currency},(C=M==null?void 0:M.metadata)!=null?C:{}),timestamp:Date.now(),timeInSession:Date.now()-E,path:Rt()};e.debug&&console.log("[sentient] componentGoal",ae),Ie.then(()=>w.push(ae))},identify(p){let v=y.getSessionId();v&&Ie.then(()=>{fetch(`${b}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:v,userId:p,ephemeral:y.isEphemeral()}),headers:h}).catch(()=>{})})},track(p){let v=y.getSessionId();if(!v||p.eventType==="variant_assigned"&&A.get(p.componentId)!==void 0&&!N.has(p.componentId)&&!k.get(p.componentId,z))return;let M=Re(B({path:Rt()},p),{id:cn(),sessionId:v,timestamp:Date.now(),timeInSession:Date.now()-E});e.debug&&console.log("[sentient] track",M),Ie.then(()=>w.push(M))},getAssignment(p,v){return k.get(p,v)},async assign(p,v,M,W){let G=y.getSessionId();if(!G)return null;let C=k.get(p,z);if(C&&(v!=null&&v.length||C.content!==void 0)){let O=C.ttlMs&&C.ttlMs>0?Math.max(0,C.assignedAt+C.ttlMs-Date.now()):0;return{variantId:C.variantId,assignmentTtlMs:O,content:C.content}}return fn(K,p,async()=>{await Ie;try{let O={sessionId:G,componentId:p,variantIds:v};W!==void 0?O.agentDataByVariant=W:M!==void 0&&(O.agentData=M);let $=await fetch(`${b}/assign`,{method:"POST",body:JSON.stringify(O),headers:h});if(!$.ok)return null;let H=await $.json();return k.set(p,z,B({variantId:H.variantId,assignedAt:Date.now(),segment:z,confidence:1,content:H.content},H.assignmentTtlMs&&H.assignmentTtlMs>0?{ttlMs:H.assignmentTtlMs}:{})),H}catch(O){return null}})},async decide(p){var v,M;let W=y.getSessionId();if(!W)return null;let G=(v=p.slots)!=null?v:[],C={sessionId:W};p.sections&&p.sections.length>0&&(C.sections=p.sections.map($=>({id:$}))),C.components=(M=p.components)!=null?M:[],G.length>0&&(C.slots=G.map(on)),p.slotsFrom==="registry"&&(C.slotsFrom="registry",p.registrySlotIds&&(C.registrySlotIds=p.registrySlotIds),p.bootstrap===!1&&(C.bootstrap=!1),p.render&&Object.keys(p.render).length>0&&(C.render=p.render)),p.v&&(C.v=p.v),typeof p.pp=="number"&&(C.pp=p.pp),e.persona&&(C.persona=e.persona);let O=JSON.stringify(C);return fn(oe,O,async()=>{var $,H,ee,ae,ue,q,ge,Ee;await Ie;try{let pe=await fetch(`${b}/decide`,{method:"POST",body:O,headers:h});if(!pe.ok)return On(G),null;let D=await pe.json(),fe={};for(let te of G){let xe=($=D.slots)==null?void 0:$[te.id];if(xe!==void 0){fe[te.id]=xe,A.set(te.id,xe),N.add(te.id);continue}let Tn=A.get(te.id);if(Tn!==void 0)fe[te.id]=Tn;else{let Rn=sn(te);fe[te.id]=Rn,A.set(te.id,Rn)}}if(D.slots)for(let[te,xe]of Object.entries(D.slots))te in fe||(fe[te]=xe,A.set(te,xe),N.add(te));let Le=Z!=null&&Z.persona!=="unknown";D.persona&&!(D.persona==="unknown"&&Le)?Z={persona:D.persona,confidence:(H=D.confidence)!=null?H:0}:Z||(Z={persona:"unknown",confidence:0});for(let[te,xe]of Object.entries((ee=D.assignments)!=null?ee:{}))k.set(te,z,{variantId:xe,assignedAt:Date.now(),segment:z,confidence:1});if(D.slotConfig)for(let[te,xe]of Object.entries(D.slotConfig))X.set(te,xe);D.palette&&(Y=D.palette),D.vocabulary&&(ie=D.vocabulary);for(let te of(ae=p.registrySlotIds)!=null?ae:[])(ue=D.slotConfig)!=null&&ue[te]||(X.delete(te),A.delete(te),N.delete(te));return We(e.apiKey,B(B(B({v:1,persona:Z.persona,band:$e(Z.confidence),slots:Object.fromEntries(A),layoutOrder:(q=D.layoutOrder)!=null?q:null,savedAt:Date.now()},X.size>0?{slotConfig:Object.fromEntries(X)}:{}),Y?{palette:Y}:{}),ie?{vocabulary:ie}:{})),B(B(B(B(B({layoutOrder:(ge=D.layoutOrder)!=null?ge:null,assignments:(Ee=D.assignments)!=null?Ee:{},slots:fe,persona:Z.persona,confidence:Z.confidence},D.slotConfig?{slotConfig:D.slotConfig}:{}),D.goals?{goals:D.goals}:{}),D.sectionMap?{sectionMap:D.sectionMap}:{}),D.palette?{palette:D.palette}:{}),D.vocabulary?{vocabulary:D.vocabulary}:{})}catch(pe){return On(G),null}})},getSlotResult(p){var v;return(v=A.get(p))!=null?v:null},isSlotDecided(p){return N.has(p)},getSlotConfig(p){var v;return(v=X.get(p))!=null?v:null},reportSlots(p,v,M,W){var G;let C={};for(let[O,$]of Object.entries(W!=null?W:{}))for(let H of $){let ee=`${O}|${H.key}`;!bt.test(O)||be.has(ee)||(be.add(ee),((G=C[O])!=null?G:C[O]=[]).push(H))}Object.keys(C).length>0&&fetch(`${b}/slots/observed`,{method:"POST",headers:h,body:JSON.stringify({slotIds:Object.keys(C),authoredArms:C})}).catch(()=>{});for(let O of p)if(!(typeof O!="string"||O.length===0)){if(!bt.test(O)){hi()&&!xn.has(O)&&(xn.add(O),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(O)} 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(!L.has(O)){L.add(O),_.add(O);let $=v==null?void 0:v[O];if(typeof $=="string"){let ee=$.replace(/\s+/g," ").trim().slice(0,400);ee!==""&&U.set(O,ee)}let H=M==null?void 0:M[O];H!==void 0&&Q.set(O,H)}}_.size===0||me!=null||(me=setTimeout(()=>{me=null;let O=[..._];_.clear();for(let $=0;$<O.length;$+=20){let H=O.slice($,$+20),ee={},ae={};for(let ue of H){let q=U.get(ue);q!==void 0&&(ee[ue]=q,U.delete(ue));let ge=Q.get(ue);ge!==void 0&&(ae[ue]=ge,Q.delete(ue))}fetch(`${b}/slots/observed`,{method:"POST",headers:h,body:JSON.stringify(Re(B(B({slotIds:H},Object.keys(ee).length>0?{baselineTexts:ee}:{}),Object.keys(ae).length>0?{baselineSkeletons:ae}:{}),{pagePaths:Object.fromEntries(H.map(ue=>[ue,location.pathname]))}))}).catch(()=>{})}},1e3))},reportSkeleton(p,v){!bt.test(p)||T.has(p)||(T.add(p),fetch(`${b}/slots/observed`,{method:"POST",headers:h,body:JSON.stringify({slotIds:[p],baselineSkeletons:{[p]:v}})}).catch(()=>{}))},reportDrift(p,v,M,W){let G=`${p}|${v}`,C=y.getSessionId();!C||re.has(G)||(re.add(G),fetch(`${b}/slots/drift`,{method:"POST",headers:h,body:JSON.stringify({sessionId:C,reports:[{slotId:p,expectedFp:v,observedFp:M,reason:W}]})}).catch(()=>{}))},requestSlots(p,v,M){var W,G;for(let C of p)St.has(C)||(St.add(C),bt.test(C)?et.set(C,{text:v==null?void 0:v[C],render:(W=M==null?void 0:M.render)==null?void 0:W[C],skeleton:(G=M==null?void 0:M.skeletons)==null?void 0:G[C]}):de.reportSlots([C]));et.size===0||Zt!=null||(Zt=setTimeout(()=>{Zt=null;let C=[...et];et.clear();for(let O=0;O<C.length;O+=50){let $=C.slice(O,O+50),H={};for(let[ee,ae]of $)ae.render&&(H[ee]=ae.render);de.decide({slotsFrom:"registry",registrySlotIds:$.map(([ee])=>ee),bootstrap:!1,render:H}).then(ee=>{var ae,ue;if(ee){let q={},ge={},Ee=[];for(let[pe,D]of $){let fe=(ae=ee.slotConfig)==null?void 0:ae[pe];if(fe){fe.needsSkeleton&&D.skeleton&&((ue=de.reportSkeleton)==null||ue.call(de,pe,D.skeleton));continue}Ee.push(pe),D.text&&(q[pe]=D.text),D.skeleton&&(ge[pe]=D.skeleton)}Ee.length>0&&de.reportSlots(Ee,q,ge)}else _n($.map(([q])=>q),St,q=>{var ge;let Ee={},pe={},D={};for(let[fe,Le]of $)q.has(fe)&&(Le.text&&(Ee[fe]=Le.text),Le.render&&(pe[fe]=Le.render),Le.skeleton&&(D[fe]=Le.skeleton));(ge=de.requestSlots)==null||ge.call(de,[...q],Ee,{render:pe,skeletons:D})});wt.forEach(q=>q())})}},0))},decideSlots(p){for(let v of p)Et.has(v.id)||(Et.add(v.id),tt.set(v.id,v));tt.size===0||Qt!=null||(Qt=setTimeout(()=>{Qt=null;let v=[...tt.values()];tt.clear();for(let M=0;M<v.length;M+=30){let W=v.slice(M,M+30);de.decide({slots:W}).then(G=>{G||_n(W.map(C=>C.id),Et,C=>{var O;return(O=de.decideSlots)==null?void 0:O.call(de,W.filter($=>C.has($.id)))}),wt.forEach(C=>C())})}},0))},cancelSlots(p){for(let v of p)et.delete(v)&&St.delete(v),tt.delete(v)&&Et.delete(v)},onSlotsChanged(p){return wt.add(p),()=>{wt.delete(p)}},getStyleVocabulary(){return ie},getSitePalette(){return Y},getPersona(){return Z?{persona:Z.persona,confidence:Z.confidence,band:$e(Z.confidence)}:null},async fetchWeights(){var p;try{let v=await fetch(`${b}/weights`,{headers:h});return v.ok?(p=(await v.json()).components)!=null?p:[]:[]}catch(v){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){w.flush(),I.flush()},dispose(){var p;nt==null||nt(),tn=!0,en=!0,w.destroy(),I.destroy(),((p=we.get(e.apiKey))==null?void 0:p.dispose)===de.dispose&&we.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var p;nt==null||nt(),tn=!0,en=!0,w.destroy(),I.destroy(),y.destroy(),k.clear(),((p=we.get(e.apiKey))==null?void 0:p.dispose)===de.dispose&&we.delete(e.apiKey);try{localStorage.removeItem(Pt+e.apiKey),localStorage.removeItem(lr(e.apiKey)),localStorage.removeItem(ur(e.apiKey))}catch(v){}e.debug&&console.log("[sentient] destroyed")}};if(we.set(e.apiKey,{config:e,upgrade:null,dispose:de.dispose}),nt=wi(de,e.apiKey,p=>{Ie.then(()=>{tn||pr.add(p)})}),e.debug){let p=window;p.__sentient&&(p.__sentient.client=de)}return de}function ki(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function gr(e,t){let n=t>>>0;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")}function Ai(e){let t=e.join("");return gr(t,2166136261)+gr(t,1523705862)}var xi=new Set(["A","BUTTON"]),Ci=/^H([1-6])$/,_i=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]);var Oi=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function Ii(e){return xi.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function Li(e){if(Ci.test(e.tagName)||_i.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function Ti(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(Ii(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||Li(r))return r;return t}function Nt(e,t=40){var n,r,o;let a=e.ownerDocument.createTreeWalker(e,4),i=[];for(let l=a.nextNode();l;l=a.nextNode())if(((n=l.nodeValue)!=null?n:"").trim()!==""&&!Oi.has((o=(r=l.parentElement)==null?void 0:r.tagName)!=null?o:"")&&(i.push(l),i.length>120))return{reason:"too_large"};if(i.length===0)return{reason:"empty"};let s=[],u=[];for(let l of i){let d=Ti(l,e),g=s.indexOf(d);g===-1&&(s.push(d),g=s.length-1),u.push(g)}if(s.length>t)return{reason:"too_large"};let c=i.map(l=>{var d;return ki((d=l.nodeValue)!=null?d:"")});return{textNodes:i,ownerEls:s,leafToNode:u,leaves:c,fp:Ai(c)}}var Ri=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function yn(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function Pi(e){return{tag:e.tagName.toLowerCase(),text:yn(e).slice(0,40)}}function hr(e){return e.replace(/["\\\]]/g,"\\$&")}function ut(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function yr(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(ut(t,s))return s;let i=e.parentElement;if(i&&i!==t){let s=yr(i,t);if(s){for(let d of a){let g=`${s} > ${d}`;if(ut(t,g))return g}let u=Array.from(i.children).filter(d=>d.tagName.toLowerCase()===r),c=u.indexOf(e),l=u.some(d=>d!==e&&yn(d)!==yn(e));if(c>=0&&l){let d=`${s} > ${r}:nth-of-type(${c+1})`;if(ut(t,d))return d}}}return null}function vr(e,t){let n=Pi(e),r=e.getAttribute("id");if(r&&ut(t,`#${hr(r)}`))return{v:1,id:r,fingerprint:n};for(let a of Ri){let i=e.getAttribute(a);if(i&&ut(t,`[${a}="${hr(i)}"]`))return{v:1,dataAttr:{name:a,value:i},fingerprint:n}}let o=yr(e,t);return o?{v:1,selector:o,fingerprint:n}:null}rt();var wr=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Di={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Ni(e){let t=e.ariaRole?Di[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 Mi(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var $i=[["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]],vn=[["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]],br={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function Bi(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=Ni(e);if(r)return{type:(t=br[r])!=null?t:"generic",strength:"strong"};let o=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,s]of $i)if(s.test(o))return{type:i,strength:"strong"};for(let[i,s]of vn)if(s.test(e.bodyText))return{type:i,strength:"strong"};let a=Mi(e);return{type:(n=br[a])!=null?n:"generic",strength:"weak"}}function Er(e){var t,n;let r=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),o=e.getAttribute("role");return B({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:Bi(e),bodyText:r.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:r.length},o?{ariaRole:o}:{})}rt();var kr=[100,300,1e3,3e3,1e4],Ki=250,ji=1e3,Ui=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function Ar(e,t){e.n++;let n=t-e.mean;e.mean+=n/e.n,e.m2+=n*(t-e.mean)}var xr=e=>e.n>1?Math.sqrt(e.m2/e.n):0;function Gi(e){var t;try{let n=e.createElement("canvas"),r=n.getContext("webgl")||n.getContext("experimental-webgl");if(!r)return"unknown";let o=r.getExtension("WEBGL_debug_renderer_info"),a=o?String((t=r.getParameter(o.UNMASKED_RENDERER_WEBGL))!=null?t:""):"";return a?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(a)?"sw":"hw":"unknown"}catch(n){return"unknown"}}function Fi(e,t=Date.now){var n,r;let o=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0,a={n:0,mean:0,m2:0},i={n:0,mean:0,m2:0},s=[0,0,0,0,0,0],u=0,c=0,l=0,d=0,g=0,x=0,f=0,m=0,E=0,y=0,k=-1/0,w=-1/0,b=null,h=null,P=null,I=(r=o==null?void 0:o.scrollY)!=null?r:0,F=0,S=e.hidden?null:t(),J=()=>{let T=t();if(P!=null){let re=T-P,be=0;for(;be<kr.length&&re>=kr[be];)be++;s[be]++}P=T},z=()=>{u++,k=t()},K=()=>{c++,w=t()},oe=()=>{b=t()},A=()=>{b!=null&&(Ar(a,t()-b),b=null)},N=()=>{let T=t();l++,T-k>Ki&&T-w>ji&&d++,J()},X=()=>{g++},Y=()=>{var T;let re=(T=o==null?void 0:o.scrollY)!=null?T:0;x+=Math.abs(re-I),I=re,J()},ie=T=>{let re=t();f++,(T.key==="Backspace"||T.key==="Delete")&&E++,Ui.has(T.key)&&y++,h!=null&&Ar(i,re-h),h=re,J()},Z=T=>{let re=T.data;typeof re=="string"&&(m+=re.length),J()},L=()=>{let T=t();e.hidden?S!=null&&(F+=T-S,S=null):S==null&&(S=T)},_={passive:!0,capture:!0};e.addEventListener("mousemove",z,_),e.addEventListener("touchstart",K,_),e.addEventListener("touchmove",X,_),e.addEventListener("mousedown",oe,_),e.addEventListener("mouseup",A,_),e.addEventListener("click",N,_),e.addEventListener("wheel",X,_),e.addEventListener("keydown",ie,_),e.addEventListener("input",Z,_),e.addEventListener("visibilitychange",L),o==null||o.addEventListener("scroll",Y,_);let U=Gi(e),Q=(()=>{var T;try{return((T=o==null?void 0:o.matchMedia)==null?void 0:T.call(o,"(prefers-reduced-motion: reduce)").matches)===!0}catch(re){return!1}})();return{snapshot(){var T,re;let be=t(),me=F+(S!=null?be-S:0);return{v:1,active_ms:Math.round(me),mm:u,mm_rate:me>0?Number((u*1e3/me).toFixed(2)):0,touches:c,clicks:l,hold_n:a.n,hold_mean:Math.round(a.mean),hold_std:Math.round(xr(a)),teleport:d,wheel:g,scroll_px:Math.round(x),keydowns:f,input_chars:m,ik_cv:i.mean>0?Number((xr(i)/i.mean).toFixed(2)):0,backspaces:E,gaps:[...s],reduced_motion:Q,kb_nav:y,renderer:U,vp:[(T=o==null?void 0:o.innerWidth)!=null?T:0,(re=o==null?void 0:o.innerHeight)!=null?re:0],dpr:(o==null?void 0:o.devicePixelRatio)||1}},stop(){e.removeEventListener("mousemove",z,_),e.removeEventListener("touchstart",K,_),e.removeEventListener("touchmove",X,_),e.removeEventListener("mousedown",oe,_),e.removeEventListener("mouseup",A,_),e.removeEventListener("click",N,_),e.removeEventListener("wheel",X,_),e.removeEventListener("keydown",ie,_),e.removeEventListener("input",Z,_),e.removeEventListener("visibilitychange",L),o==null||o.removeEventListener("scroll",Y,_)}}}var zi="section, header, footer, nav, main > div, [data-sentient-section]",Vi=2e4,Wi="__session__";function Hi(e){let t=Array.from(e.querySelectorAll(zi)),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 qi(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 Cr=()=>{};function _r(e,t){var n,r,o,a,i,s,u,c,l,d,g,x,f,m,E;let y=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!y||typeof IntersectionObserver=="undefined"||Be()||!t.apiKey||!t.apiKey.startsWith("pk_"))return Cr;let k=((r=t.apiBase)!=null?r:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),w=Hi(y);if(w.length===0)return Cr;let b=new Map,h=[];for(let L of w){let _=(i=[(a=t.sectionTypes)==null?void 0:a[(o=L.getAttribute("data-sentient-id"))!=null?o:""],L.getAttribute("data-sentient-type")].find(me=>wr.includes(me)))!=null?i:null,U=Er(L),Q=(u=_!=null?_:(s=t.typeOf)==null?void 0:s.call(t,L))!=null?u:Sr(U).type,T=vr(L,y),re=T?`nc-${Q}-${Gn(JSON.stringify({id:(c=T.id)!=null?c:null,dataAttr:(l=T.dataAttr)!=null?l:null,selector:(d=T.selector)!=null?d:null})).toString(36)}`:`nc-${Q}`;b.set(L,re);let be=vn.filter(([,me])=>me.test(U.bodyText)).map(([me])=>me);h.push(Re(B({componentId:re,semanticType:Q,source:_?"markup":"auto"},T?{locator:T}:{}),{observation:B(B({tag:U.tag,idClass:U.idClass.slice(0,200),headingText:U.headingText,textLength:U.textLength,actionCount:U.actionCount},U.ariaRole?{ariaRole:U.ariaRole}:{}),be.length>0?{patternFlags:be}:{})}))}let P=(m=(f=(x=(g=y.defaultView)!=null?g:typeof window!="undefined"?window:void 0)==null?void 0:x.location)==null?void 0:f.pathname)!=null?m:"/";qi(t.apiKey,k,P,h);let I=Fi(y),F=()=>{let L;try{L=I.snapshot()}catch(_){return}try{e.track({projectId:t.apiKey,componentId:Wi,eventType:"interaction_stats",payload:L})}catch(_){}},S=new Map,J=L=>{let _=S.get(L);return _||(_={ms:0,scroll:0,enterAt:null,intersecting:!1},S.set(L,_)),_},z=new IntersectionObserver(L=>{for(let _ of L){let U=b.get(_.target);if(!U)continue;let Q=J(U);_.isIntersecting?(Q.intersecting=!0,Q.enterAt=Date.now(),_.intersectionRatio>Q.scroll&&(Q.scroll=_.intersectionRatio)):(Q.intersecting=!1,Q.enterAt!=null&&(Q.ms+=Date.now()-Q.enterAt,Q.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let L of b.keys())z.observe(L);let K=(L=!1)=>{var _;let U=Date.now();for(let[Q,T]of S)if(T.enterAt!=null&&(T.ms+=U-T.enterAt,T.enterAt=null),!(T.ms<=0)){try{e.track({projectId:t.apiKey,componentId:Q,eventType:"dwell",payload:{dwell_time:Math.round(T.ms),scroll_depth:Number(T.scroll.toFixed(2))}})}catch(re){}T.ms=0}if(F(),L)try{(_=e.flush)==null||_.call(e)}catch(Q){}},oe=()=>{if(y.hidden)K(!0);else{let L=Date.now();for(let _ of S.values())_.intersecting&&(_.enterAt=L)}},A=!1,N=L=>{if(K(!0),L!=null&&L.persisted){A=!0;return}try{z.disconnect()}catch(_){}},X=L=>{if(!(L!=null&&L.persisted)||!A)return;A=!1;let _=Date.now();for(let U of S.values())U.enterAt=U.intersecting&&!y.hidden?_:null};y.addEventListener("visibilitychange",oe);let Y=(E=y.defaultView)!=null?E:typeof window!="undefined"?window:void 0;Y==null||Y.addEventListener("pagehide",N),Y==null||Y.addEventListener("pageshow",X);let ie=setInterval(()=>{if(y.hidden||A)return;K();let L=Date.now();for(let _ of S.values())_.intersecting&&(_.enterAt=L)},Vi),Z=[];return t.microSignals&&[...b.entries()].forEach(([L,_],U)=>{Z.push(at((Q,T={})=>{try{e.track({projectId:t.apiKey,componentId:_,eventType:"micro_signal",payload:B({signalType:Q},T)})}catch(re){}},L,void 0,{tabLoss:U===0}))}),()=>{K(!0),clearInterval(ie),I.stop(),y.removeEventListener("visibilitychange",oe),Y==null||Y.removeEventListener("pagehide",N),Y==null||Y.removeEventListener("pageshow",X);for(let L of Z)L();try{z.disconnect()}catch(L){}}}var Or=["cookiebot","onetrust","cookieyes","tcf","google-consent-mode"];function Ji(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 Yi(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function Xi(e){try{return e()}catch(t){return}}function Mt(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[i,s]of Object.entries(t.slots)){if(typeof s!="object"||s===null)continue;let u=s,c=Ji(u.dims);if(!c||u.target!==void 0&&typeof u.target!="string")continue;let l=u.arms!==void 0?Yi(u.arms):null,d={dims:c};typeof u.target=="string"&&(d.target=u.target),l&&(d.arms=l),n[i]=d}let r={apiKey:t.apiKey,personaAttributes:t.personaAttributes===!0,slots:n};typeof t.consent=="boolean"&&(r.consent=t.consent);let o=t.consentFrom;if(typeof o=="string"&&Or.includes(o))r.consentFrom=o;else if(o&&typeof o=="object"&&!Array.isArray(o)){let i=o;(typeof i.cmp=="string"&&Or.includes(i.cmp)||i.cmp===void 0&&(typeof i.cookie=="string"||typeof i.check=="function"))&&(r.consentFrom=i)}(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 a=typeof t.persona=="function"?Xi(t.persona):t.persona;if(typeof a=="string"&&a.trim()!==""&&(r.persona=a),Array.isArray(t.sections)){let i=t.sections.filter(s=>typeof s=="string"&&s.trim()!=="").slice(0,50);i.length>=2&&(r.sections=i)}return r}var Ir=new WeakMap;function Lr(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Tr(e,t,n){var a,i,s;let r=Ir.get(e);if(r){if(r.fp!==n.fp||!Lr(r.leafToNode,n.leafToNode))return"mismatch"}else{let u=Nt(e);if(!("fp"in u)||(r={fp:u.fp,leafToNode:u.leafToNode,textNodes:u.textNodes,ownerEls:u.ownerEls,classes:u.ownerEls.map(c=>{var l;return(l=c.getAttribute("class"))!=null?l:""})},r.fp!==n.fp||!Lr(r.leafToNode,n.leafToNode)))return"mismatch";Ir.set(e,r)}let o=r;for(let[u,c]of Object.entries(t.nodes)){let l=Number(u),d=o.ownerEls[l];if(d){if(typeof c.text=="string"){let g=!0;o.leafToNode.forEach((x,f)=>{x===l&&(o.textNodes[f].nodeValue=g?c.text:"",g=!1)})}c.like!==void 0&&o.classes[c.like]!==void 0&&d.setAttribute("class",o.classes[c.like]),c.hidden&&((a=d.style)==null||a.setProperty("display","none","important"))}}for(let u of Object.values((i=t.order)!=null?i:{})){let c=u.map(f=>o.ownerEls[f]).filter(f=>!!f),l=(s=c[0])==null?void 0:s.parentElement;if(!l||c.length!==u.length||c.some(f=>f.parentElement!==l))continue;let d=new Set(c),g=0;Array.from(l.children).map(f=>d.has(f)?c[g++]:f).forEach((f,m)=>{var E;l.children[m]!==f&&l.insertBefore(f,(E=l.children[m])!=null?E:null)})}return"applied"}function ct(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 Zi(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 $t(e,t){return!!(e!=null&&e.urlMatch)&&!ct(t).includes(e.urlMatch)}var Qi=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function Rr(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)&&Qi.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 Ce(e,t){if(e.urlMatch&&!ct(t).includes(e.urlMatch))return null;let n=Rr(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Zi(r,e.fingerprint)?null:r}function Pr(e,t){return $t(e,t)?!1:!!e.selector&&!e.dataAttr&&!e.id&&!e.fingerprint&&e.page===void 0?Dr(e,t):Ce(e,t)!==null}function Dr(e,t){return Rr(e,t).length>0}function Bt(e,t){return $t(e,t)?!1:e.page!==void 0&&Dt.test(e.page)?mn(e.page,ct(t)):Dr(e,t)}var Nr={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"},es=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function Mr(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(!es.test((r=n[1])!=null?r:""))return!1;return!0}var $r=/^https:\/\//i,Br=new Map,Pe=null;function ts(e){return e.replace(/["\\]/g,"\\$&")}function ns(e){var t;(!Pe||!Pe.isConnected)&&(Pe=e.querySelector("style[data-sentient-ops]"),Pe||(Pe=e.createElement("style"),Pe.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Pe))),Pe.textContent=[...Br.entries()].map(([n,r])=>`[data-snt-e="${ts(n)}"]{${r}}`).join(`
2
- `)}function Kr(e,t,n,r){var s;let o=!1,a=(s=t.moveBefore)!=null?s:t.moveAfter;if(a){let u=Ce(a,r);!u||u===e||u.parentElement!==e.parentElement||!e.parentElement?o=!0:t.moveBefore?e.parentElement.insertBefore(e,u):e.parentElement.insertBefore(e,u.nextSibling)}typeof t.text=="string"&&(e.textContent=t.text),typeof t.href=="string"&&$r.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&$r.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[u,c]of Object.entries(t.style)){let l=Nr[u];l&&typeof c=="string"&&Mr(c)&&i.push(`${l}:${c.trim()} !important`)}return i.length>0&&(e.setAttribute("data-snt-e",n),Br.set(n,i.join(";")),ns(r)),{anchorMiss:o}}var dt="data-sentient-block-arm",R=null;function qe(e){R=e!=null?e:null}var Ke=null;function Je(e){Ke=e!=null?e:null}var Fr=e=>{var t;return typeof e=="string"?(t=Ke==null?void 0:Ke.entries.find(n=>n.id===e))==null?void 0:t.classes:void 0},zr=e=>{let t=typeof e=="string"?Ke==null?void 0:Ke.entries.find(n=>n.id===e):void 0;return t!=null&&t.computed.inheritsColor?t.computed.color:void 0},Oe="data-sentient-blocks-hid",He={none:"0",sm:"8px",md:"16px",lg:"24px"},bn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},jr={sm:"0.875em",md:"1em",lg:"1.25em"},rs={sm:"1.25em",md:"1.5em",lg:"2em"},os={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},Ur={sm:"8px",md:"16px",lg:"32px"},is={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},ss={normal:"400",medium:"500",bold:"700"};function he(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function Gr(e){return e==="muted"?R!=null&&R.muted?{color:R.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:R==null?void 0:R.accent}:{}}function Vr(e,t){let n=as(e,t),r=zr(e.like);return n&&r&&(n.style.color=r),n}function as(e,t){var n,r,o,a,i,s,u,c,l,d,g,x,f,m,E,y,k,w,b,h;try{let P=Fr(e.like),I=e.maxWidth==="measure"?"65ch":void 0,F=S=>(S.className=P,he(S,{"max-width":I}));switch(e.type){case"stack":case"grid":{let S=t.createElement("div");if(e.type==="stack"){let K=e;he(S,{display:"flex","flex-direction":K.direction,gap:(r=He[(n=K.gap)!=null?n:"md"])!=null?r:He.md,"align-items":K.align?bn[K.align]:void 0,"justify-content":K.justify?bn[K.justify]:void 0,"flex-wrap":K.wrap?"wrap":void 0})}else{let K=e,oe=(a=He[(o=K.gap)!=null?o:"md"])!=null?a:He.md;he(S,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${K.columns-1} * ${oe}) / ${K.columns})), 1fr))`,gap:oe,"align-items":K.align?bn[K.align]:void 0})}P&&(S.className=P);let J=!P&&e.type==="stack"&&e.surface==="raised",z=(i=e.pad)!=null?i:J?"md":void 0;z&&he(S,{padding:(s=He[z])!=null?s:He.md}),J&&he(S,{background:R==null?void 0:R.surface,color:R!=null&&R.surface?R==null?void 0:R.surfaceText:void 0,border:`1px solid ${(u=R==null?void 0:R.border)!=null?u:"currentColor"}`,"border-radius":(c=R==null?void 0:R.radius)!=null?c:"8px"});for(let K of(l=e.children)!=null?l:[]){let oe=Vr(K,t);oe&&S.appendChild(oe)}return S}case"text":{let S=t.createElement("p");return S.textContent=e.value,P?F(S):he(S,Te(V({margin:"0","font-size":e.size?jr[e.size]:void 0,"font-weight":e.weight?ss[e.weight]:void 0,"text-align":e.align},Gr(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let S=t.createElement(`h${e.level}`);return S.textContent=e.value,P?F(S):he(S,{margin:"0","font-size":rs[(d=e.size)!=null?d:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let S=t.createElement("a");if(S.textContent=e.label,S.href=e.href,e.tag&&S.setAttribute("data-sentient-tag",e.tag),P)return F(S);let J=(g=e.emphasis)!=null?g:"primary";return he(S,{display:"inline-block",padding:os[(x=e.size)!=null?x:"md"],"border-radius":(f=R==null?void 0:R.radius)!=null?f:"8px",font:"inherit","font-size":e.size?jr[e.size]:void 0,"text-decoration":J==="ghost"?"underline":"none",cursor:"pointer",background:J==="primary"?(m=R==null?void 0:R.primaryBg)!=null?m:"#111827":"transparent",color:J==="primary"?(E=R==null?void 0:R.primaryText)!=null?E:"#ffffff":(y=R==null?void 0:R.accent)!=null?y:"inherit",border:J==="secondary"?`1px solid ${(k=R==null?void 0:R.accent)!=null?k:"currentColor"}`:"none"})}case"link":{let S=t.createElement("a");return S.textContent=e.label,S.href=e.href,e.tag&&S.setAttribute("data-sentient-tag",e.tag),P?F(S):he(S,{color:"inherit","text-decoration":"underline"})}case"image":{let S=t.createElement("img");return S.src=e.src,S.alt=e.alt,P&&(S.className=P),he(S,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?is[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let S=t.createElement("span");return S.textContent=e.value,P?F(S):he(S,V({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(w=R==null?void 0:R.border)!=null?w:"currentColor"}`},Gr(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(b=Ur[e.size])!=null?b:Ur.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(h=R==null?void 0:R.border)!=null?h:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(P){return null}}function Wr(e,t,n,r){var o,a;try{let i=new Set;for(let u of Array.from(e.children)){let c=u.getAttribute(dt);c!==null&&(t[c]===void 0?u.remove():i.add(c))}for(let[u,c]of Object.entries(t)){if(i.has(u))continue;let l="tree"in c?c:null,d=Vr(l?l.tree:c,r);if(!d)continue;let g=r.createElement("div");g.setAttribute(dt,u),g.style.display="none";let x=l?Fr((o=l.surface)==null?void 0:o.like):void 0;if(x){let f=r.createElement("div");f.className=x;let m=zr((a=l.surface)==null?void 0:a.like);m&&(f.style.color=m),f.appendChild(d),g.appendChild(f)}else g.appendChild(d);e.appendChild(g)}let s=n!==void 0&&t[n]!==void 0;for(let u of Array.from(e.children)){let c=u.getAttribute(dt),l=u;c!==null?l.style.display=s&&c===n?"":"none":s?l.hasAttribute(Oe)||(l.setAttribute(Oe,l.style.display),l.style.display="none"):l.hasAttribute(Oe)&&(l.style.display=l.getAttribute(Oe),l.removeAttribute(Oe))}}catch(i){}}function ls(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(dt)!==null){n.remove();continue}n.hasAttribute(Oe)&&(n.style.display=n.getAttribute(Oe),n.removeAttribute(Oe))}}catch(t){}}function Kt(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${dt}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${Oe}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||ls(r)}catch(n){}}function wn(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function jt(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 Ut(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 u=wn(i.target,n);for(let c of u)for(let[l,d]of Object.entries(s))(o=i.dims[l])!=null&&o.includes(d)&&(c.setAttribute(`data-${l}`,d),r==null||r(c,`data-${l}`))}}function Gt(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=wn(a.target,n);for(let u of s)u.setAttribute("data-sentient-arm",i),r==null||r(u,"data-sentient-arm")}}function us(e,t){var o,a;let n=e.ownerDocument.createTreeWalker(e,4),r=null;for(let i=n.nextNode();i!==null;i=n.nextNode()){if(((o=i.nodeValue)!=null?o:"").trim()==="")continue;let s=(a=i.parentElement)==null?void 0:a.tagName;if(!(s==="SCRIPT"||s==="STYLE"||s==="TEMPLATE")){if(r!==null){e.textContent=t;return}r=i}}r!==null?r.nodeValue=t:e.textContent=t}function Ft(e,t,n,r){var s,u,c,l,d,g,x;let o=new Set,a=(s=r==null?void 0:r.contentAndOps)!=null?s:!0,i=[];for(let[f,m]of Object.entries(t)){if($t(m.locator,n))continue;let E;if(m.locator){let k=Ce(m.locator,n);E=k?[k]:[],!k&&Bt(m.locator,n)&&i.push(f)}else E=wn(m.target,n);let y=e[f];for(let k of E){if(y!==void 0)if(typeof y=="string")k.setAttribute("data-sentient-arm",y),(u=r==null?void 0:r.onAttr)==null||u.call(r,k,"data-sentient-arm"),a&&((c=r==null?void 0:r.onApplied)==null||c.call(r,f,y,k));else for(let[b,h]of Object.entries(y))k.setAttribute(`data-${b}`,h),(l=r==null?void 0:r.onAttr)==null||l.call(r,k,`data-${b}`);if((m.blocks||m.compose)&&!ds(n)){let b=Object.fromEntries([...Object.entries((d=m.blocks)!=null?d:{}).filter(([,h])=>!st(h)),...Object.entries((g=m.compose)!=null?g:{}).filter(([,h])=>!st(h.tree))]);Object.keys(b).length>0&&(Wr(k,b,typeof y=="string"?y:void 0,n),o.add(k))}if(!a)continue;let w=k.textContent;m.edits?Tr(k,m.edits.edits,m.edits)==="mismatch"&&((x=r==null?void 0:r.onDrift)==null||x.call(r,f,m.edits.fp)):typeof m.content=="string"&&us(k,m.content),m.ops&&Kr(k,m.ops,f,n).anchorMiss&&!i.includes(f)&&i.push(f),gn(k,Te(V(V({previous:w},typeof y=="string"?{arm:y}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return Kt(n,o),i}var cs=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function ds(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:cs.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var fs=800;function zt(e,t,n){let r=[];return n.forEach(({slotId:o,arm:a,el:i},s)=>{r.push(at((g,x={})=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"micro_signal",payload:V({signalType:g},x)})}catch(f){}},i,void 0,{tabLoss:s===0}));let u=null,c=0,l=()=>{c=Date.now(),u=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-c}})}catch(g){}u=null},fs)},d=()=>{u!==null&&(clearTimeout(u),u=null)};i.addEventListener("mouseenter",l),i.addEventListener("mouseleave",d),r.push(()=>{i.removeEventListener("mouseenter",l),i.removeEventListener("mouseleave",d),u!==null&&clearTimeout(u)})}),()=>{for(let o of r)o()}}function ps(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 qr(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var ms="_snt_fired_goals";function Jr(e,t){try{e==null||e.sessionStorage.removeItem(qr(t)),e==null||e.sessionStorage.removeItem(ms)}catch(n){}}function Hr(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function gs(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 hs(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function Vt(e,t,n,r){var y,k;let o=(y=n.defaultView)!=null?y:typeof window!="undefined"?window:null,a=qr(r),i=gs(o,a),s=w=>{let b=Hr(w);if(!i.has(b))try{w.slotId?t.componentGoal(w.slotId,w.goalId):t.goal(w.goalId),i.add(b),hs(o,a,i)}catch(h){}},u=e.filter(w=>w.event==="click"),c=e.filter(w=>w.event==="form_submit"),l=e.filter(w=>w.event==="url_reached"),d=e.filter(w=>w.event==="scroll_depth"),g=(w,b)=>{if(!w.locator)return!1;let h=Ce(w.locator,n);return!!h&&(h===b||h.contains(b))},x=w=>{let b=w.target;if(!(!b||typeof b.closest!="function"))for(let h of u)g(h,b)&&s(h)},f=w=>{let b=w.target;if(b)for(let h of c)g(h,b)&&s(h)},m=()=>{if(l.length===0)return;let w=ct(n);for(let b of l)b.urlPattern&&ps(b.urlPattern,w)&&s(b)},E=()=>{var h;let w=n.documentElement,b=w.scrollHeight>0?(w.scrollTop+w.clientHeight)/w.scrollHeight:0;for(let P of d)b>=((h=P.threshold)!=null?h:.75)&&s(P);d.every(P=>i.has(Hr(P)))&&n.removeEventListener("scroll",E)};return n.addEventListener("click",x,!0),n.addEventListener("submit",f,!0),(k=n.defaultView)==null||k.addEventListener("popstate",m),m(),d.length>0&&(n.addEventListener("scroll",E,{passive:!0}),E()),{checkUrl:m,teardown:()=>{var w;n.removeEventListener("click",x,!0),n.removeEventListener("submit",f,!0),(w=n.defaultView)==null||w.removeEventListener("popstate",m),d.length>0&&n.removeEventListener("scroll",E)}}}function Wt(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 Yr="__snt_editor_token";function Xr(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(Yr):null}catch(e){return null}}function Zr(e){try{sessionStorage.setItem(Yr,e)}catch(t){}}var mt="0.31.0",Jt=mt!=="0.0.0-dev"?{name:"snippet",version:mt}:void 0,so=mt!=="0.0.0-dev"?{v:mt}:{},gt=5e3,ys=50,ao=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),le=null,j=null,Se={},ve=null,se=null,De=null,ce=null,_e=null,ne=null,je=null,Qr=!1,Sn=null,Ht=null,Yt=null,Ue=!1,ft=!1,Ye=null,Ne=!1,Ge=null,Me=[],Xt=null,pt=null,ye=null,vs=3e3,bs=100;function ht(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 ke(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Xe(e,t){return le?(le.personaAttributes&&ne&&jt(ne.persona,ne.band,e,t==null?void 0:t.onAttr),Ut(Se,le.slots,e,t==null?void 0:t.onAttr),Gt(Se,le.slots,e,t==null?void 0:t.onAttr),ve?Ft(Se,ve,e,V(Te(V({},t),{onDrift:(n,r)=>{var o,a;return(a=j==null?void 0:j.reportDrift)==null?void 0:a.call(j,n,r,(o=fo[n])!=null?o:null,"fp_mismatch")}}),ne?{persona:ne.persona}:{})):(Kt(e,new Set),[])):[]}function lo(e){var n;let t=new Map;for(let r of(n=le==null?void 0:le.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function En(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=Wt(e,lo(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function ws(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 Ss(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function uo(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function yt(e){var t;return(t=e.apiBase)!=null?t:"https://api.sentient-ui.com"}function Es(e){return Promise.resolve().then(()=>fetch(`${yt(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 co(e,t){let n=[],r=[];for(let o of e)try{if(typeof(o==null?void 0:o.id)!="string")continue;!o.locator||Pr(o.locator,t)?n.push(o.id):Bt(o.locator,t)&&r.push(o.id)}catch(a){}return[n,r]}var fo={};function po(e,t){var r;let n={};for(let o of e){let a=(r=Ge==null?void 0:Ge.find(c=>c.id===o))==null?void 0:r.locator,i=a?Ce(a,t):null,s=i?Nt(i):null,u=s&&"fp"in s?s.fp:void 0;u&&(fo[o]=u),n[o]=Te(V({},u?{fp:u}:{}),{forms:!1,compose:!0,content:!0})}return n}function mo(e,t){let n=null;for(let r of t)e!=null&&e[r]&&((n!=null?n:n={})[r]=e[r]);return n}function go(){!Ge||!Ue||Xt===window.location.pathname||(Xt=window.location.pathname,ks())}function ks(){ye==null||ye();let e=le,t=Ge;if(!e||!t)return;let n,r,o=()=>{clearTimeout(n),clearTimeout(s),r==null||r.disconnect(),ye===o&&(ye=null)},a=null,i=u=>{let[c,l]=co(t,document),d=c.filter(g=>!Me.includes(g));a!==null&&c.some(g=>!a.has(g)&&!d.includes(g))&&vt(),a=new Set(c),d.length>0&&As(d).catch(()=>{}),(u||l.length===0&&!t.some(g=>!c.includes(g.id)&&!Me.includes(g.id)))&&(o(),ho(e,l))},s=setTimeout(()=>i(!0),vs);if(ye=o,i(),ye===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(i,bs)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(u){}}async function As(e){let t=le,n=j;if(!t||!n)return;Me=Me.concat(e);let r=await ht(n.decide(V({slotsFrom:"registry",registrySlotIds:e,render:po(e,document)},so)),gt);if(r||(Me=Me.filter(a=>!e.includes(a))),!r||Ne||j!==n)return;Se=V(V({},Se),r.slots);let o=mo(r.slotConfig,e);o&&(ve=V(V({},ve),o)),vt(),ke(t,"late decide",e),pt&&We(t.apiKey,pt=V(Te(V({},pt),{slots:Se,savedAt:Date.now()}),ve?{slotConfig:ve}:{}))}function ho(e,t){if(t.length!==0)try{fetch(`${yt(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 Ze(){return!!(le&&j&&le.sectionCapture!==!1&&(le.consent!==!1||ft)&&!Be())}function xs(){if(!j||!le||!Ze()||_e)return;let e=[];Xe(document,{contentAndOps:Ue,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),kn();try{ce==null||ce(),ce=zt(j,le.apiKey,e)}catch(t){}}function kn(){if(typeof document=="undefined"||!Ze())return;let e;try{if(Ht&&Ht.length>0){let t=new Map;for(let n of Ht){if(n.urlMatch!==window.location.pathname)continue;let r=Ce(n.locator,document);r&&t.set(r,n.type)}t.size>0&&(e=n=>{var r;return(r=t.get(n))!=null?r:null})}}catch(t){}try{_e=_r(j,V({apiKey:le.apiKey,apiBase:le.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{})),Yt=window.location.pathname}catch(t){}}function vt(){try{let e=[];if(ce==null||ce(),ce=null,Xe(document,{contentAndOps:Ue,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),En(je,document),e.length>0&&Ze())try{ce=zt(j,le.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Yt!==null&&window.location.pathname!==Yt&&Ze()&&(_e==null||_e(),_e=null,kn())}catch(t){}}catch(e){}}function eo(){Sn===null&&(Sn=setTimeout(()=>{Sn=null,vt();try{se==null||se.checkUrl()}catch(e){}go()},ys))}function An(){if(!(Qr||typeof window=="undefined"||typeof history=="undefined")){Qr=!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 eo(),i}};e("pushState"),e("replaceState"),window.addEventListener("popstate",eo)}catch(e){}}}function qt(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 yo(e){return new URLSearchParams(e).get("sentient_editor")}function Cs(){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 _s(e,t){var n,r,o;try{window.__sentientEditor={token:t,apiBase:yt(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:Cs();if(!a){no();return}let i=document.createElement("script");i.src=a,i.async=!0,i.onerror=()=>no(),((o=document.head)!=null?o:document.documentElement).appendChild(i)}catch(a){}}var to="sentient-editor-load-notice",vo={position:"fixed",bottom:"16px",zIndex:"2147483647",background:"#111827",color:"#fff",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"};function no(){var e,t;try{if(typeof document=="undefined"||document.getElementById(to))return;(e=document.querySelector('meta[name="referrer"][data-sentient-editor]'))==null||e.remove();let n=document.createElement("div");n.id=to,n.textContent="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.",Object.assign(n.style,vo,{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 bo(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 u of i.split(",")){let[c,l]=u.split("=");c&&l&&(s[c]=l)}Object.keys(s).length&&(n[a]=s)}else n[a]=i}return Object.keys(n).length?n:null}function wo(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var ro="sentient-persona-preview-banner";function oo(e,t){var n;try{if(typeof document=="undefined"||document.getElementById(ro))return;let r=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),o=document.createElement("div");o.id=ro,o.setAttribute("role","status"),Object.assign(o.style,vo,{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 Os(e,t){var r;if((r=e.registry)!=null?r:Object.keys(e.slots).length===0){let o=yt(e),i=await ht(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),gt);if(!(i!=null&&i.slotConfig)){Qe(e),ke(e,"preview mode: slot config unavailable \u2014 page left as-is");return}ve=i.slotConfig,qe(i.palette),Je(i.vocabulary)}Se=t,ne=null,Xe(document),An(),Qe(e),ke(e,"preview mode",t)}async function Is(e,t){var c,l,d,g,x,f,m,E,y;let n=yt(e),o=((c=e.registry)!=null?c:Object.keys(e.slots).length===0)?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(e.slots).map(([k,w])=>({id:k,dims:w.dims}))},a=await ht(fetch(`${n}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify(o)}).then(k=>k.ok?k.json():null).catch(()=>null),gt);if(!a){Qe(e),ke(e,"persona preview: explain unavailable \u2014 page left as-is");return}let i=a;Se=(l=i.slots)!=null?l:{},ve=(d=i.slotConfig)!=null?d:null,qe(i.palette),Je(i.vocabulary);let s=(f=(x=(g=i.personaAttributes)==null?void 0:g.persona)!=null?x:i.persona)!=null?f:t,u=(E=(m=i.personaAttributes)==null?void 0:m.confidence)!=null?E:"high";ne={persona:s,band:u},Xe(document),Ue=!0,An(),Qe(e),i.recognized===!1?oo(t,!0):oo((y=i.personaDisplay)!=null?y:s)}function Qe(e){let t={goal(n,r){try{j==null||j.goal(n,r)}catch(o){}},componentGoal(n,r){try{j==null||j.componentGoal(n,r)}catch(o){}},grantConsent(){try{!j&&Ne?(j=lt(V({apiKey:e.apiKey,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,ingestUrl:uo(e)},Jt?{sdk:Jt}:{})),De&&De.length>0&&(se==null||se.teardown(),se=Vt(De,j,document,e.apiKey))):(hn(e.apiKey),j&&De&&De.length>0&&(se==null||se.teardown(),se=Vt(De,j,document,e.apiKey))),Ne=!1}catch(n){}ft=!0;try{xs()}catch(n){}},revokeConsent(){try{_e==null||_e(),_e=null,Yt=null,ce==null||ce(),ce=null,ye==null||ye(),se==null||se.teardown(),se=null,Jr(typeof window!="undefined"?window:null,e.apiKey),ft=!1,Ne=!0,j==null||j.destroy(),j=null}catch(n){}},reapply:vt,getState(){var n,r;try{return{apiKey:e.apiKey,persona:(n=ne==null?void 0:ne.persona)!=null?n:null,band:(r=ne==null?void 0:ne.band)!=null?r:null,slots:Se,matchCounts:qt(e),consent:!Ne&&(e.consent!==!1||ft)}}catch(o){return{apiKey:e.apiKey,persona:null,band:null,slots:{},matchCounts:{},consent:!1}}}};if(window.SentientSnippet=t,e.consentFrom&&!Ye)try{let n=nn(e.consentFrom),r=e.consent!==!1;Ye=n.subscribe(()=>{let o=n.read();o===!0&&!r?(r=!0,t.grantConsent()):o===!1&&r&&(r=!1,t.revokeConsent())})}catch(n){}for(let n of ao.splice(0))try{n[0]==="goal"&&t.goal(n[1],n[2])}catch(r){}}function io(){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})},ao.length=0}catch(t){}}async function So(){var e,t;try{let n=Mt(window.sentient);if(!n){io();return}if(le=n,Ye==null||Ye(),Ye=null,n.consentFrom&&n.consent===void 0)try{n.consent=nn(n.consentFrom).read()===!0}catch(h){n.consent=!1}Ue=!1,je=null,qe(null),Je(null),ft=!1,Ne=!1,De=null,Ge=null,Me=[],Xt=null,pt=null,ye==null||ye();let r=typeof window!="undefined"?yo(window.location.search):null;if(r){Zr(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:Xr();if(o){_s(n,o),Qe(n),ke(n,"editor mode");return}let a=typeof window!="undefined"?bo(window.location.search):null;if(a){await Os(n,a);return}let i=typeof window!="undefined"?wo(window.location.search):null;if(i){await Is(n,i),ke(n,"persona preview",i);return}let s=(e=n.registry)!=null?e:Object.keys(n.slots).length===0;n.registry===void 0&&!s&&ke(n,"slots declared without registry: true, so dashboard-published components are not applied");let u=s?Es(n):null,c=Ss();try{(t=c==null?void 0:c.stop)==null||t.call(c)}catch(h){}let l=it(n.apiKey),d=[];l&&(ne={persona:l.persona,band:l.band},Se=l.slots,l.slotConfig&&(ve=l.slotConfig),l.palette&&qe(l.palette),l.vocabulary&&Je(l.vocabulary),Xe(document,V({contentAndOps:!1},c?{onAttr:(h,P)=>d.push([h,P])}:{})),l.layoutOrder&&(je=l.layoutOrder,En(je,document))),c&&ws(c,d,document);let g=lt(V({apiKey:n.apiKey,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,ingestUrl:uo(n)},Jt?{sdk:Jt}:{}));j=g,Qe(n),An();let x=Object.entries(n.slots).map(([h,P])=>({id:h,dims:P.dims})),f=so,m={pp:c?c.v:0},E=Array.from(lo(document).keys()),y=[];if(u){let[h]=await Promise.all([ht(u,gt),document.readyState==="loading"?new Promise(P=>document.addEventListener("DOMContentLoaded",P,{once:!0})):null]);Ge=h,h&&(Me=y=co(h,document)[0]),ke(n,"registry scope",h&&y)}let k=g.decide(V(V(V(V({slots:x},f),m),E.length>=2?{sections:E}:{}),s?{slotsFrom:"registry",registrySlotIds:y,render:po(y,document)}:{})),w=await ht(k,gt),b=h=>{var F,S,J,z,K;let P=g.getPersona();P?ne={persona:P.persona,band:P.band}:h.persona&&(ne={persona:h.persona,band:"low"}),Se=h.slots,s?ve=mo(h.slotConfig,y):h.slotConfig&&(ve=h.slotConfig),h.palette&&qe(h.palette),h.vocabulary&&Je(h.vocabulary),je=(F=h.layoutOrder)!=null?F:je;let I=()=>{let oe=[],A=Xe(document,{onApplied:(N,X,Y)=>oe.push({slotId:N,arm:X,el:Y})});if(s||ho(n,A),En(je,document),Ue=!0,Ze())try{ce==null||ce(),ce=zt(j,n.apiKey,oe)}catch(N){}};if(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",I,{once:!0}):I(),De=(S=h.goals)!=null?S:null,h.goals&&h.goals.length>0&&n.consent!==!1&&j)try{se==null||se.teardown(),se=Vt(h.goals,j,document,n.apiKey)}catch(oe){}Ht=(J=h.sectionMap)!=null?J:null,Ze()&&kn(),ke(n,"applied",{persona:ne,slots:Se,matches:qt(n)}),!Ne&&(We(n.apiKey,pt=V(V(V({v:1,persona:(z=ne==null?void 0:ne.persona)!=null?z:h.persona,band:(K=ne==null?void 0:ne.band)!=null?K:"low",slots:h.slots,layoutOrder:h.layoutOrder,savedAt:Date.now()},ve?{slotConfig:ve}:{}),h.palette?{palette:h.palette}:{}),h.vocabulary?{vocabulary:h.vocabulary}:{})),Xt=null,go())};if(!w){ke(n,"decide timeout/null \u2014 snapshot state stands",qt(n)),k.then(h=>{!h||Ue||Ne||j!==g||(b(h),ke(n,"late decide applied",qt(n)))}).catch(()=>{});return}b(w)}catch(n){io()}}if(typeof window!="undefined"&&window.sentient){let e=window;e.__sentientInitialized||(e.__sentientInitialized=!0,Promise.resolve().then(()=>{So()}))}return Lo(Ls);})();
1
+ "use strict";var SentientSnippet=(()=>{var At=Object.defineProperty,Ao=Object.defineProperties,xo=Object.getOwnPropertyDescriptor,Co=Object.getOwnPropertyDescriptors,_o=Object.getOwnPropertyNames,Pn=Object.getOwnPropertySymbols;var Nn=Object.prototype.hasOwnProperty,Oo=Object.prototype.propertyIsEnumerable;var Dn=(e,t,n)=>t in e?At(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,V=(e,t)=>{for(var n in t||(t={}))Nn.call(t,n)&&Dn(e,n,t[n]);if(Pn)for(var n of Pn(t))Oo.call(t,n)&&Dn(e,n,t[n]);return e},Te=(e,t)=>Ao(e,Co(t));var Mn=(e,t)=>()=>(e&&(t=e(e=0)),t);var $n=(e,t)=>{for(var n in t)At(e,n,{get:t[n],enumerable:!0})},Io=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of _o(t))!Nn.call(e,o)&&o!==n&&At(e,o,{get:()=>t[o],enumerable:!(r=xo(t,o))||r.enumerable});return e};var Lo=e=>Io(At({},"__esModule",{value:!0}),e);var To,Ro,Po,Bn,Do,No,Kn,B,Re,ot=Mn(()=>{"use strict";To=Object.defineProperty,Ro=Object.defineProperties,Po=Object.getOwnPropertyDescriptors,Bn=Object.getOwnPropertySymbols,Do=Object.prototype.hasOwnProperty,No=Object.prototype.propertyIsEnumerable,Kn=(e,t,n)=>t in e?To(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,B=(e,t)=>{for(var n in t||(t={}))Do.call(t,n)&&Kn(e,n,t[n]);if(Bn)for(var n of Bn(t))No.call(t,n)&&Kn(e,n,t[n]);return e},Re=(e,t)=>Ro(e,Po(t))});var Xn={};$n(Xn,{LOCAL_ENGINE_AVAILABLE:()=>Vo,createLocalEngine:()=>Wo});function Wo(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var Vo,Zn=Mn(()=>{"use strict";Vo=!1});var Ls={};$n(Ls,{applyPersonaAttributes:()=>Ut,applyRegistrySlots:()=>zt,applySlotArms:()=>Ft,applySlotAttributes:()=>Gt,consentWatcher:()=>$e,parseEditorToken:()=>yo,parsePersonaPreview:()=>wo,parsePreview:()=>bo,parseSnippetConfig:()=>$t,planReorder:()=>Ht,reapply:()=>bt,run:()=>So,version:()=>gt});var _t=e=>{try{return decodeURIComponent(e)}catch(t){return e}};function xt(e,t){if(e)for(let n of e.cookie.split(";")){let r=n.indexOf("=");if(r>0&&n.slice(0,r).trim()===t)return n.slice(r+1).trim()}}function Ct(e,t,n){let r=[e,...e.document?[e.document]:[]];for(let o of r)for(let a of t)o.addEventListener(a,n);return()=>{for(let o of r)for(let a of t)o.removeEventListener(a,n)}}function Mo(e,t="statistics"){if(e==null||e==="")return null;let n=_t(e).trim();if(n==="-1")return!0;if(n==="0")return!1;let r=new RegExp(`[{,]\\s*${t}\\s*:\\s*(true|false)`).exec(n);return r?r[1]==="true":null}function $o(e,t="C0002"){var n;if(e==null||e==="")return null;let r=(n=/(?:^|&)groups=([^&]*)/.exec(_t(e)))==null?void 0:n[1];if(r==null)return null;for(let o of _t(r).split(",")){let[a,i]=o.split(":");if(a===t)return i==="1"}return null}function Bo(e,t="analytics"){if(e==null||e==="")return null;let n=new RegExp(`(?:^|,)${t}:(yes|no)(?:,|$)`).exec(_t(e));return n?n[1]==="yes":null}function Ko(e){var t,n,r,o,a,i;let s=typeof e=="string"?{cmp:e}:e;switch(s.cmp){case"cookiebot":return{cmp:"cookiebot",category:(t=s.category)!=null?t:"statistics"};case"onetrust":return{cmp:"onetrust",group:(n=s.group)!=null?n:"C0002"};case"cookieyes":return{cmp:"cookieyes",category:(r=s.category)!=null?r:"analytics"};case"tcf":return{cmp:"tcf",purposes:s.purposes&&s.purposes.length>0?s.purposes:[1]};case"google-consent-mode":return{cmp:"google-consent-mode",type:(o=s.type)!=null?o:"analytics_storage",dataLayer:(a=s.dataLayer)!=null?a:"dataLayer"};default:return{cmp:"custom",cookie:s.cookie,value:(i=s.value)!=null?i:"accepted",check:s.check,event:s.event}}}function jo(e,t="analytics_storage"){var n;if(!Array.isArray(e))return null;let r=null;for(let o of e){let a=o&&typeof o=="object"&&"length"in o?Array.prototype.slice.call(o):null;if(!a||a[0]!=="consent"||a[1]!=="default"&&a[1]!=="update")continue;let i=(n=a[2])==null?void 0:n[t];i==="granted"?r=!0:i==="denied"&&(r=!1)}return r}function $e(e,t=window){let n=Ko(e),r=t,o=t.document;switch(n.cmp){case"cookiebot":return{read:()=>{let a=r.Cookiebot;return a!=null&&a.consent&&typeof a.consent[n.category]=="boolean"?a.consent[n.category]===!0:Mo(xt(o,"CookieConsent"),n.category)},subscribe:a=>Ct(t,["CookiebotOnAccept","CookiebotOnDecline","CookiebotOnConsentReady","CookiebotOnLoad"],a)};case"onetrust":return{read:()=>{let a=r.OnetrustActiveGroups;return typeof a=="string"?`,${a},`.includes(`,${n.group},`):$o(xt(o,"OptanonConsent"),n.group)},subscribe:a=>Ct(t,["OneTrustGroupsUpdated"],a)};case"cookieyes":return{read:()=>{var a;let i=r.getCkyConsent;if(typeof i=="function")try{let s=(a=i())==null?void 0:a.categories;if(s&&typeof s[n.category]=="boolean")return s[n.category]===!0}catch(s){}return Bo(xt(o,"cookieyes-consent"),n.category)},subscribe:a=>Ct(t,["cookieyes_consent_update","cookieyes_banner_load","cookieyes_banner_loaded"],a)};case"tcf":{let a=null;return{read:()=>a,subscribe:i=>{let s,u=!1,c=(g,x)=>{!x||u||(typeof g.listenerId=="number"&&(s=g.listenerId),g.eventStatus==="cmpuishown"?a=!1:a=g.gdprApplies===!1||n.purposes.every(f=>{var m,E;return((E=(m=g.purpose)==null?void 0:m.consents)==null?void 0:E[f])===!0}),i())},l=0,d=()=>{if(u)return;let g=r.__tcfapi;typeof g=="function"?g("addEventListener",2,c):l++<40&&window.setTimeout(d,250)};return d(),()=>{u=!0;let g=r.__tcfapi;typeof g=="function"&&s!==void 0&&g("removeEventListener",2,()=>{},s)}}}}case"google-consent-mode":{let a=()=>r[n.dataLayer];return{read:()=>jo(a(),n.type),subscribe:i=>{var s,u;let c=(u=r[s=n.dataLayer])!=null?u:r[s]=[],l=c.push,d=function(...x){let f=l.apply(c,x);return i(),f};c.push=d;let g=window.setInterval(i,1e3);return()=>{window.clearInterval(g),c.push===d&&(c.push=l)}}}}case"custom":return{read:()=>{if(n.check)try{return n.check()===!0}catch(i){return!1}if(!n.cookie)return null;let a=xt(o,n.cookie);return a===void 0?null:a===n.value},subscribe:a=>n.event?Ct(t,[n.event],a):()=>{}}}}ot();function Ot(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function jn(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 rn(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 Ot(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 Ot(o)}function Un(e,t){var n,r;return e.dims!=null?(r=(n=jn(t))!=null?n:jn(rn(e)))!=null?r:{}:t}function Gn(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 Be(e){return e>=.3?e<.7?"medium":"high":"low"}function It(e){return e?`_${e.slice(0,12)}`:""}var Uo="_snt_uid";function Fn(e){return`${Uo}${It(e)}`}var Go=["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 zn(e){return Fo(e)!==null}function Fo(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=Go.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function Vn(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 Wn(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 Hn(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var zo=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function qn(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):zo.includes(o)&&(o in n||(n[o]=a))}catch(r){}return{utmParams:t,clickIds:n}}function Jn(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function on(e){return B(B(B({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 sn(e){let t=on(e);return Un(t,rn(t))}function Yn(e){return typeof e=="string"?e:Ot(e)}ot();function or(){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 Ho="_snt_uid",qo=365,Lt="_snt_uid";function Jo(){return or()}function Qn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Yo(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(r){}}function an(e){try{return localStorage.getItem(e)}catch(t){return null}}function er(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function tr(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function Xo(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Zo(e){try{sessionStorage.removeItem(e)}catch(t){}}function Qo(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 ei(e){try{localStorage.removeItem(e)}catch(t){}}function ti(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var ni={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function ir(e){var t,n,r,o,a,i,s;if(typeof window=="undefined")return ni;let u=It(e==null?void 0:e.apiKey),c=(t=e==null?void 0:e.cookieName)!=null?t:Fn(e==null?void 0:e.apiKey),l=`${Lt}${u}`,d=`${Lt}_tomb${u}`,g=((n=e==null?void 0:e.cookieTTLDays)!=null?n:qo)*24*60*60,x=b=>b&&b.length>0?b:null,f=()=>{var b,h;return u&&!(e!=null&&e.cookieName)&&an(d)===null?(h=(b=x(Qn(Ho)))!=null?b:x(an(Lt)))!=null?h:x(tr(Lt)):null},m=(s=(i=(a=(o=(r=x(Qn(c)))!=null?r:x(an(l)))!=null?o:x(tr(l)))!=null?a:f())!=null?i:x(e==null?void 0:e.ssrSessionId))!=null?s:Jo();Yo(c,m,g);let E=er(l,m),y=Qo(c),k=E?!1:Xo(l,m),w=!E&&!y&&!k;return{getSessionId:()=>m,isEphemeral:()=>w,destroy:()=>{m=null,ti(c),ei(l),Zo(l),u&&!(e!=null&&e.cookieName)&&er(d,"1")}}}function ze(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function pn(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 sr(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 Ve(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 ar(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 ri=500,oi=56*1024;function lr(e){return`_snt_retry_${e.slice(0,12)}`}var ii={push:()=>{},flush:()=>{},destroy:()=>{}};function si(e){var t,n,r;if(typeof window=="undefined")return ii;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,u=e.apiKey,c=lr(u),l=[],d=new Set,g=[],x=A=>{for(let N of A)f.delete(N),!d.has(N)&&(d.add(N),g.push(N));for(;g.length>ri;){let N=g.shift();N&&d.delete(N)}ar(A,c)},f=new Set,m=()=>{for(;l.length>i;){let A=l.shift();A&&f.delete(A.id)}},E=A=>{d.has(A.id)||f.has(A.id)||(f.add(A.id),l.push(A),m())},y=A=>{for(let N of A)d.has(N.id)||(f.add(N.id),l.push(N));m()},k=sr(c,i);for(let A of k)E(A);let w=0,b=0,h=(A,N=!0)=>{if(A.length===0)return;let X=JSON.stringify(A),Y=A.map(L=>L.id),ie;try{ie=fetch(s,{method:"POST",keepalive:!0,body:X,headers:{"Content-Type":"application/json",Authorization:`Bearer ${u}`}})}catch(L){Ve(A,i,c),y(A),b++,w=Date.now()+ze(b);return}let Z=L=>{if(pn(L)!=="retry"){if(!L.ok&&N){let _=A.filter(U=>U.eventType!=="pageview");if(_.length>0&&_.length<A.length){x(A.filter(U=>U.eventType==="pageview").map(U=>U.id)),h(_,!1);return}}x(Y),b=0,w=0;return}Ve(A,i,c),y(A),b++,w=Date.now()+ze(b)};ie instanceof Promise?ie.then(Z).catch(()=>{Ve(A,i,c),y(A),b++,w=Date.now()+ze(b)}):Z(ie)},P=typeof TextEncoder!="undefined"?new TextEncoder:null,I=A=>P?P.encode(A).length:A.length,F=A=>{let N=[],X=2;for(let Y of A){let ie=I(JSON.stringify(Y))+1;if(N.length>0&&X+ie>oi||N.length>=a)break;N.push(Y),X+=ie}return N},S=()=>{try{if(Date.now()<w)return;for(;l.length>0&&!(Date.now()<w);){let A=l.filter(X=>!d.has(X.id));if(l.length=0,A.length===0)break;let N=F(A);if(N.length===0)break;N.length<A.length&&l.push(...A.slice(N.length)),h(N)}}catch(A){}},J=!0,z=null;z=setInterval(()=>{J&&S()},o);let K=()=>{document.visibilityState==="hidden"&&S()},oe=()=>{S()};return document.addEventListener("visibilitychange",K),window.addEventListener("pagehide",oe),{push(A){E(A),l.length>=a&&S()},flush:S,destroy(){J=!1,z!==null&&(clearInterval(z),z=null),document.removeEventListener("visibilitychange",K),window.removeEventListener("pagehide",oe),S()}}}var ai=200;function ur(e){return`_snt_goal_retry_${e.slice(0,12)}`}var li={send:()=>{},flush:()=>{},destroy:()=>{}};function ui(e){var t,n,r;if(typeof window=="undefined")return li;let o=(t=e.flushIntervalMs)!=null?t:5e3,a=(n=e.maxRetrySize)!=null?n:100,i=(r=e.maxPerFlush)!=null?r:5,s=ur(e.apiKey),u=[],c=new Set,l=new Set,d=[],g=0,x=0,f=!1,m=I=>{for(c.delete(I.id),l.has(I.id)||(l.add(I.id),d.push(I.id));d.length>ai;){let F=d.shift();F&&l.delete(F)}ar([I.id],s)},E=I=>{Ve([I],a,s),!l.has(I.id)&&!c.has(I.id)&&(c.add(I.id),u.push(I)),Date.now()>=g&&(x++,g=Date.now()+ze(x))},y=I=>{let F;try{F=fetch(e.url,{method:"POST",keepalive:!0,body:I.body,headers:e.headers})}catch(J){E(I);return}let S=J=>{var z;let K=pn(J);if(K==="retry"){E(I);return}K==="dropped"&&((z=e.onDrop)==null||z.call(e,I,J.status)),m(I),x=0,g=0};F instanceof Promise?F.then(S).catch(()=>E(I)):S(F)},k=()=>{try{if(f||Date.now()<g)return;let I=0;for(;u.length>0&&I<i&&!(Date.now()<g);){let F=u.shift();c.delete(F.id),!l.has(F.id)&&(I++,y(F))}}catch(I){}},w=sr(s,a);for(let I of w)c.has(I.id)||(c.add(I.id),u.push(I));w.length>0&&Ve(w,a,s);let b=setInterval(k,o),h=()=>{document.visibilityState==="hidden"&&k()},P=()=>k();return document.addEventListener("visibilitychange",h),window.addEventListener("pagehide",P),{send(I){if(!f&&!(l.has(I.id)||c.has(I.id))){if(Date.now()<g){Ve([I],a,s),c.add(I.id),u.push(I);return}y(I)}},flush:k,destroy(){clearInterval(b),document.removeEventListener("visibilitychange",h),window.removeEventListener("pagehide",P),k(),f=!0}}}var ci=1800*1e3;function Tt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function di(e=ci,t){let n=new Map,r=`_snt_asgn${It(t)}_`,o=(u,c)=>`${r}${encodeURIComponent(u)}:${encodeURIComponent(c)}`,a=u=>{let c=u.slice(r.length),l=c.indexOf(":");if(l<0)return null;try{return{componentId:decodeURIComponent(c.slice(0,l)),segment:decodeURIComponent(c.slice(l+1))}}catch(d){return null}},i=()=>{try{let u=[];for(let c=0;c<localStorage.length;c++){let l=localStorage.key(c);l!=null&&l.startsWith(r)&&u.push(l)}return u}catch(u){return[]}},s=u=>u.assignedAt+(u.ttlMs&&u.ttlMs>0?u.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let u of i())try{let c=localStorage.getItem(u);if(!c)continue;let l=JSON.parse(c);if(s(l)){localStorage.removeItem(u);continue}let d=a(u);if(!d)continue;n.set(Tt(d.componentId,d.segment),l)}catch(c){}})(),{get(u,c){let l=n.get(Tt(u,c));return l?s(l)?(n.delete(Tt(u,c)),null):l:null},set(u,c,l){let d=Tt(u,c);n.set(d,l);try{localStorage.setItem(o(u,c),JSON.stringify(l))}catch(g){}},clear(){n.clear();for(let u of i())try{localStorage.removeItem(u)}catch(c){}}}}var Dt="_snt_snap:",fi=["low","medium","high"];function st(e){try{let t=localStorage.getItem(Dt+e);if(!t)return null;let n=JSON.parse(t);if(!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!fi.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)))return null;let r=n.vocabulary;return r!==void 0&&(typeof r!="object"||r===null||!Array.isArray(r.entries)||!Array.isArray(r.images))&&delete n.vocabulary,n}catch(t){return null}}function He(e,t){try{localStorage.setItem(Dt+e,JSON.stringify(t))}catch(n){}}var dn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",cr="[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.",nr=!1,Rt=!1;function pi(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function mi(e){var t;let n=ir({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=pi(),a=Promise.resolve().then(()=>(Zn(),Xn)).then(l=>{let d=l;return d.LOCAL_ENGINE_AVAILABLE?(nr||(nr=!0,console.info(cr)),d):(Rt||(Rt=!0,console.error(dn)),null)}).catch(()=>(Rt||(Rt=!0,console.error(dn)),null)),i=null,s={low:.15,medium:.5,high:.85},u=(()=>{var l;if(e.initialPersona)return B({},e.initialPersona);let d=st(e.apiKey||"local");return d?{persona:d.persona,confidence:(l=s[d.band])!=null?l:.15}:null})();function c(l){let d=document.documentElement;d.dataset.sentientPersona===void 0&&(d.dataset.sentientPersona=l.persona,d.dataset.sentientConfidence=Be(l.confidence))}return{isLocal:!0,async decide(l){var d,g,x;let f=await a;if(!f)return null;let m=f.createLocalEngine({sessionId:r,forcedPersona:o}).decide(l);return i=Re(B({},m),{layoutOrder:(g=(d=m.layoutOrder)!=null?d:i==null?void 0:i.layoutOrder)!=null?g:null,slots:B(B({},(x=i==null?void 0:i.slots)!=null?x:{}),m.slots)}),He(e.apiKey||"local",{v:1,persona:i.persona,band:Be(i.confidence),slots:i.slots,layoutOrder:i.layoutOrder,savedAt:Date.now()}),c(m),m},getSlotResult(l){var d,g,x;return(x=(g=i==null?void 0:i.slots[l])!=null?g:(d=e.initialSlots)==null?void 0:d[l])!=null?x:null},getSlotConfig(l){var d,g;return(g=(d=e.initialSlotConfig)==null?void 0:d[l])!=null?g:null},getSitePalette(){var l;return(l=e.initialPalette)!=null?l:null},reportSlots(){},getPersona(){let l=i!=null?i:u;return l?{persona:l.persona,confidence:l.confidence,band:Be(l.confidence)}:null},async assign(l,d){var g;let x=await a;return!x||!d||d.length===0?d!=null&&d[0]?{variantId:d[0],assignmentTtlMs:0}:null:{variantId:(g=x.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:l,variantIds:d}]}).assignments[l])!=null?g:d[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>n.destroy()}}var Nt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function ln(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function mn(e,t){if(e===void 0||!Nt.test(e))return!1;if(e==="*")return!0;let n=ln(t);if(e.endsWith("/*")){let r=ln(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===ln(e)}function at(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(at):!1}var rr="sentient-reveal",We="sentient-revealed";var un=!1;function gi(e){if(un||e.getElementById(rr)){un=!0;return}let t=e.createElement("style");t.id=rr,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${We}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${We}{animation:${We} 240ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),un=!0}function gn(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;gi(r),e.classList.remove(We),e.offsetWidth,e.classList.add(We);let o=()=>{e.classList.remove(We),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function lt(e,t,n,r){let o=[];{let a=!1,i=[],s=()=>{if(a)return;let u=Date.now();for(i.push(u);i.length>0&&u-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 u=typeof window!="undefined"?window.getSelection():null,c=u?u.toString().length:0;e("text_copy",{selectionLength:c})};document.addEventListener("copy",i),o.push(()=>document.removeEventListener("copy",i))}{let a=!1,i=!1,s=null,u=()=>{s!==null&&(clearTimeout(s),s=null)},c=()=>{a||!i||(u(),s=setTimeout(()=>{!a&&i&&(a=!0,e("scroll_hesitation"))},3e3))},l=()=>{u(),c()},d=x=>{for(let f of x)i=f.intersectionRatio>.3,i?c():u()},g=new IntersectionObserver(d,{threshold:[.3]});g.observe(t),window.addEventListener("scroll",l,{passive:!0}),o.push(()=>{g.disconnect(),window.removeEventListener("scroll",l),u()})}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 u=Date.now()-i;u<15e3&&(a=!0,e("tab_loss",{timeOnPage:u}))};document.addEventListener("visibilitychange",s),o.push(()=>document.removeEventListener("visibilitychange",s))}return()=>{for(let a of o)a()}}function hi(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var dr="https://api.sentient-ui.com/v1/events",we=new Map,fr=null;function yi(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var vi=3;function cn(){return or()}function Pt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function bi(){let e=new WeakMap,t=new Map,n=!1,r=(s,u,c)=>{let l=s.get(u);return c===null?l?!0:(s.set(u,new Set),!1):l?l.has(c)?!0:(l.add(c),!1):(s.set(u,new Set([c])),!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,u=()=>{s||(s=!0,n=!1,t.clear())};if(setTimeout(u,0),typeof MessageChannel=="function"){let c=new MessageChannel;c.port1.onmessage=()=>{c.port1.close(),c.port2.close(),u()},c.port2.postMessage(0)}};return{firedBefore(s,u){let c=a();if(c){let d=e.get(c);return d||(d=new Map,e.set(c,d)),r(d,s,u)}let l=r(t,s,u);return!l&&!n&&(n=!0,i()),l}}}var pr=new Set;function wi(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,a,i=()=>{if(o)return;let c=Pt();!c||c===a||(a=c,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${c}`))},s=[];for(let c of["pushState","replaceState"]){let l=r[c],d=function(...g){let x=l.apply(this,g);return i(),x};r[c]=d,s.push([c,l,d])}window.addEventListener("popstate",i);let u=Pt();return u&&pr.has(`${t}:${u}`)?a=u:i(),()=>{if(!o){o=!0,window.removeEventListener("popstate",i);for(let[c,l,d]of s)r[c]===d&&(r[c]=l)}}}var it={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}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Si(){try{return qn(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function mr(e){return e.replace(/\/events\/?$/,"")}function Ke(){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 hn(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:fr;if(!n){console.warn("[sentient] grantConsent() called before init()");return}let r=we.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&&Ke())return;let s=(i!=null?i:ut)(Re(B({},o),{consent:!0}));a(s);let u=(t=we.get(n))==null?void 0:t.dispose;we.set(n,{config:Re(B({},o),{consent:!0}),upgrade:null,dispose:u})}function Ei(e){var t;let n=e.preConsentBehavior==="statistical_winner",r=mr((t=e.ingestUrl)!=null?t:dr),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(f,m,E){if(!n)return Promise.resolve(null);let y=a.get(f);return y?Promise.resolve(y):fn(i,f,async()=>{try{let k=new URLSearchParams({componentId:f});for(let h of m!=null?m:[])k.append("variantIds[]",h);let w=await fetch(`${r}/winner?${k.toString()}`,{headers:o});if(!w.ok)return m!=null&&m[0]?{variantId:m[0],assignmentTtlMs:0}:null;let b={variantId:(await w.json()).variantId,assignmentTtlMs:0};return a.set(f,b),b}catch(k){return m!=null&&m[0]?{variantId:m[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},u=!1,c=new Set,l=[],d=[],g={track:f=>s.track(f),goal:((f,m,E,y)=>s.goal(f,m,E,y)),componentGoal:(f,m,E)=>s.componentGoal(f,m,E),identify:f=>s.identify(f),getAssignment:(f,m)=>s.getAssignment(f,m),assign:(f,m,E,y)=>s.assign(f,m,E,y),decide:f=>s.decide(f),getSlotResult:f=>s.getSlotResult(f),isSlotDecided:f=>{var m,E;return(E=(m=s.isSlotDecided)==null?void 0:m.call(s,f))!=null?E:!0},getSlotConfig:f=>s.getSlotConfig(f),getSitePalette:()=>s.getSitePalette(),getStyleVocabulary:()=>{var f,m;return(m=(f=s.getStyleVocabulary)==null?void 0:f.call(s))!=null?m:null},reportSlots:(f,m,E,y)=>s.reportSlots(f,m,E,y),reportSkeleton:(f,m)=>{var E;return(E=s.reportSkeleton)==null?void 0:E.call(s,f,m)},reportDrift:(f,m,E,y)=>{var k;return(k=s.reportDrift)==null?void 0:k.call(s,f,m,E,y)},requestSlots:(f,m,E)=>{var y;return u?(y=s.requestSlots)==null?void 0:y.call(s,f,m,E):l.push([f,m,E])},decideSlots:f=>{var m;return u?(m=s.decideSlots)==null?void 0:m.call(s,f):d.push(...f)},cancelSlots:f=>{var m;if(u)return(m=s.cancelSlots)==null?void 0:m.call(s,f);let E=new Set(f);for(let y of l)y[0]=y[0].filter(k=>!E.has(k));d=d.filter(y=>!E.has(y.id))},onSlotsChanged:f=>(c.add(f),()=>{c.delete(f)}),getPersona:()=>s.getPersona(),fetchWeights:()=>s.fetchWeights(),getGraph:()=>s.getGraph(),flush:()=>s.flush(),dispose:()=>s.dispose(),destroy:()=>s.destroy()};function x(f){var m,E,y;s=f,u=!0,(m=f.onSlotsChanged)==null||m.call(f,()=>c.forEach(k=>k()));for(let[k,w,b]of l.splice(0))k.length>0&&((E=f.requestSlots)==null||E.call(f,k,w,b));d.length>0&&((y=f.decideSlots)==null||y.call(f,d.splice(0)))}return{proxy:g,setInner:x}}function fn(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 ut(e){var t,n,r,o,a,i,s,u,c,l;if(typeof window=="undefined")return it;fr=e.apiKey||"local";let d=we.get(e.apiKey||"local");if(d!=null&&d.dispose)try{d.dispose()}catch(p){}let g=e.respectDoNotTrack!==!1&&Ke(),x=e.consent===!1||g,f=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!f&&e.localMode!==!1)return we.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."}),x?it:mi(e);if(x){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."),we.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."}),it;let{proxy:p,setInner:v}=Ei(e);return we.set(e.apiKey,{config:e,upgrade:g?null:v}),p}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."),it;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),it;let m=(t=e.ingestUrl)!=null?t:dr,E=Date.now(),y=ir({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),k=di(void 0,e.apiKey),w=si({ingestUrl:m,apiKey:e.apiKey}),b=mr(m),h={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},P=new Set,I=ui({url:`${b}/goals`,apiKey:e.apiKey,headers:h,onDrop:(p,v)=>{if(!e.debug){if(P.has(v))return;P.add(v)}console.warn(`[sentient] goal dropped (HTTP ${v}) \u2014 this will not be retried. `+(v===400?"The session was not found: call init() and let the session upsert complete before firing goals.":v===401||v===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),p)}}),F=Vn((n=navigator.userAgent)!=null?n:""),S=window.location.origin,J=Wn((r=document.referrer)!=null?r:"",S),z=(o=e.sessionSegment)!=null?o:`${F}:${J}`,K=new Map,oe=new Map,A=new Map,N=new Set,X=new Map,Y=null,ie=null,Z=null,L=new Set,_=new Set,U=new Map,Q=new Map,T=new Set,re=new Set,be=new Set,me=null,wt=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,xn=new Set,St=new Set,Et=new Set,tt=new Map,Qt=null,kt=new Set,nt=new Map,en=null,Eo=2,Cn=new Map,tn=!1,_n=(p,v,M)=>{var W;let G=new Set,C=1;for(let O of p){v.delete(O);let $=((W=Cn.get(O))!=null?W:0)+1;Cn.set(O,$),$<=Eo&&(G.add(O),$>C&&(C=$))}G.size>0&&setTimeout(()=>{tn||M(G)},ze(C))},On=p=>{for(let v of p)A.has(v.id)||A.set(v.id,sn(v))};if(e.initialSlots)for(let[p,v]of Object.entries(e.initialSlots))A.set(p,v),N.add(p);if(e.initialSlotConfig)for(let[p,v]of Object.entries(e.initialSlotConfig))X.set(p,v);e.initialPalette&&(Y=e.initialPalette),e.initialVocabulary&&(ie=e.initialVocabulary);let Ae=st(e.apiKey);if(Ae){for(let[p,v]of Object.entries(Ae.slots))A.has(p)||A.set(p,v);for(let[p,v]of Object.entries((a=Ae.slotConfig)!=null?a:{}))X.has(p)||X.set(p,v);!Y&&Ae.palette&&(Y=Ae.palette),!ie&&Ae.vocabulary&&(ie=Ae.vocabulary)}let In={low:.15,medium:.5,high:.85};if(e.initialPersona)Z=B({},e.initialPersona);else{let p=document.documentElement.dataset;p.sentientPersona?Z={persona:p.sentientPersona,confidence:(s=In[(i=p.sentientConfidence)!=null?i:"low"])!=null?s:.15}:Ae&&(Z={persona:Ae.persona,confidence:(u=In[Ae.band])!=null?u:.15})}if(e.initialAssignments)for(let[p,v]of Object.entries(e.initialAssignments))k.set(p,z,{variantId:v,assignedAt:Date.now(),segment:z,confidence:1});let Ie=Promise.resolve(),Ln=y.getSessionId();if(Ln){let p=Hn((c=document.referrer)!=null?c:""),{utmParams:v,clickIds:M}=Si(),W=B(B(B(B({sessionId:Ln,deviceClass:F,trafficSource:J,referrerDomain:p,utmParams:v,clickIds:M,timeOfDay:Jn(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:y.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||zn((l=navigator.userAgent)!=null?l:"")},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}:{}),G=async()=>{for(let C=0;;C++){try{let O=await fetch(`${b}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(W),headers:h});if(O.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(O.ok||pn(O)==="dropped")return}catch(O){}if(C>=vi){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(O=>setTimeout(O,ze(C+1)))}};try{Ie=G()}catch(C){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:w});let ko=bi(),rt=null,nn=!1,de={goal(p,v={},M=1,W=0){var G,C,O,$,H,ee,ae;let ue=y.getSessionId();if(!ue)return;let q=yi(v)?v:{metadata:v},ge=[p,(G=q.externalId)!=null?G:"",(C=q.stepIndex)!=null?C:W,(O=q.weight)!=null?O:M].join("\0"),Ee=q.value!==void 0?`${q.value}\0${($=q.currency)!=null?$:""}`:null;if(ko.firedBefore(ge,Ee)){e.debug&&console.log(`[sentient] goal("${p}") already recorded for this action \u2014 not sent twice`);return}let pe=cn(),D={sessionId:ue,name:p,metadata:(H=q.metadata)!=null?H:{},weight:(ee=q.weight)!=null?ee:M,stepIndex:(ae=q.stepIndex)!=null?ae:W,goalId:pe,value:q.value,currency:q.currency,externalId:q.externalId};e.debug&&console.log("[sentient] goal",D);let fe={id:pe,body:JSON.stringify(D)};Ie.then(()=>I.send(fe))},componentGoal(p,v,M){var W,G,C;let O=y.getSessionId();if(!O)return;let $=k.get(p,z),H=$?null:(W=A.get(p))!=null?W:null;if(!$&&H===null){e.debug&&console.warn(`[sentient] componentGoal("${p}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!$&&!N.has(p)){e.debug&&console.warn(`[sentient] componentGoal("${p}"): slot not decided this session \u2014 not attributed`);return}let ee=$?$.variantId:Yn(H),ae={id:cn(),sessionId:O,projectId:e.apiKey,componentId:p,variantId:ee,eventType:"goal_achieved",goalType:v,payload:B({reward:(G=M==null?void 0:M.reward)!=null?G:1,goalValue:M==null?void 0:M.value,currency:M==null?void 0:M.currency},(C=M==null?void 0:M.metadata)!=null?C:{}),timestamp:Date.now(),timeInSession:Date.now()-E,path:Pt()};e.debug&&console.log("[sentient] componentGoal",ae),Ie.then(()=>w.push(ae))},identify(p){let v=y.getSessionId();v&&Ie.then(()=>{fetch(`${b}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:v,userId:p,ephemeral:y.isEphemeral()}),headers:h}).catch(()=>{})})},track(p){let v=y.getSessionId();if(!v||p.eventType==="variant_assigned"&&A.get(p.componentId)!==void 0&&!N.has(p.componentId)&&!k.get(p.componentId,z))return;let M=Re(B({path:Pt()},p),{id:cn(),sessionId:v,timestamp:Date.now(),timeInSession:Date.now()-E});e.debug&&console.log("[sentient] track",M),Ie.then(()=>w.push(M))},getAssignment(p,v){return k.get(p,v)},async assign(p,v,M,W){let G=y.getSessionId();if(!G)return null;let C=k.get(p,z);if(C&&(v!=null&&v.length||C.content!==void 0)){let O=C.ttlMs&&C.ttlMs>0?Math.max(0,C.assignedAt+C.ttlMs-Date.now()):0;return{variantId:C.variantId,assignmentTtlMs:O,content:C.content}}return fn(K,p,async()=>{await Ie;try{let O={sessionId:G,componentId:p,variantIds:v};W!==void 0?O.agentDataByVariant=W:M!==void 0&&(O.agentData=M);let $=await fetch(`${b}/assign`,{method:"POST",body:JSON.stringify(O),headers:h});if(!$.ok)return null;let H=await $.json();return k.set(p,z,B({variantId:H.variantId,assignedAt:Date.now(),segment:z,confidence:1,content:H.content},H.assignmentTtlMs&&H.assignmentTtlMs>0?{ttlMs:H.assignmentTtlMs}:{})),H}catch(O){return null}})},async decide(p){var v,M;let W=y.getSessionId();if(!W)return null;let G=(v=p.slots)!=null?v:[],C={sessionId:W};p.sections&&p.sections.length>0&&(C.sections=p.sections.map($=>({id:$}))),C.components=(M=p.components)!=null?M:[],G.length>0&&(C.slots=G.map(on)),p.slotsFrom==="registry"&&(C.slotsFrom="registry",p.registrySlotIds&&(C.registrySlotIds=p.registrySlotIds),p.bootstrap===!1&&(C.bootstrap=!1),p.render&&Object.keys(p.render).length>0&&(C.render=p.render)),p.v&&(C.v=p.v),typeof p.pp=="number"&&(C.pp=p.pp),e.persona&&(C.persona=e.persona);let O=JSON.stringify(C);return fn(oe,O,async()=>{var $,H,ee,ae,ue,q,ge,Ee;await Ie;try{let pe=await fetch(`${b}/decide`,{method:"POST",body:O,headers:h});if(!pe.ok)return On(G),null;let D=await pe.json(),fe={};for(let te of G){let xe=($=D.slots)==null?void 0:$[te.id];if(xe!==void 0){fe[te.id]=xe,A.set(te.id,xe),N.add(te.id);continue}let Tn=A.get(te.id);if(Tn!==void 0)fe[te.id]=Tn;else{let Rn=sn(te);fe[te.id]=Rn,A.set(te.id,Rn)}}if(D.slots)for(let[te,xe]of Object.entries(D.slots))te in fe||(fe[te]=xe,A.set(te,xe),N.add(te));let Le=Z!=null&&Z.persona!=="unknown";D.persona&&!(D.persona==="unknown"&&Le)?Z={persona:D.persona,confidence:(H=D.confidence)!=null?H:0}:Z||(Z={persona:"unknown",confidence:0});for(let[te,xe]of Object.entries((ee=D.assignments)!=null?ee:{}))k.set(te,z,{variantId:xe,assignedAt:Date.now(),segment:z,confidence:1});if(D.slotConfig)for(let[te,xe]of Object.entries(D.slotConfig))X.set(te,xe);D.palette&&(Y=D.palette),D.vocabulary&&(ie=D.vocabulary);for(let te of(ae=p.registrySlotIds)!=null?ae:[])(ue=D.slotConfig)!=null&&ue[te]||(X.delete(te),A.delete(te),N.delete(te));return He(e.apiKey,B(B(B({v:1,persona:Z.persona,band:Be(Z.confidence),slots:Object.fromEntries(A),layoutOrder:(q=D.layoutOrder)!=null?q:null,savedAt:Date.now()},X.size>0?{slotConfig:Object.fromEntries(X)}:{}),Y?{palette:Y}:{}),ie?{vocabulary:ie}:{})),B(B(B(B(B({layoutOrder:(ge=D.layoutOrder)!=null?ge:null,assignments:(Ee=D.assignments)!=null?Ee:{},slots:fe,persona:Z.persona,confidence:Z.confidence},D.slotConfig?{slotConfig:D.slotConfig}:{}),D.goals?{goals:D.goals}:{}),D.sectionMap?{sectionMap:D.sectionMap}:{}),D.palette?{palette:D.palette}:{}),D.vocabulary?{vocabulary:D.vocabulary}:{})}catch(pe){return On(G),null}})},getSlotResult(p){var v;return(v=A.get(p))!=null?v:null},isSlotDecided(p){return N.has(p)},getSlotConfig(p){var v;return(v=X.get(p))!=null?v:null},reportSlots(p,v,M,W){var G;let C={};for(let[O,$]of Object.entries(W!=null?W:{}))for(let H of $){let ee=`${O}|${H.key}`;!wt.test(O)||be.has(ee)||(be.add(ee),((G=C[O])!=null?G:C[O]=[]).push(H))}Object.keys(C).length>0&&fetch(`${b}/slots/observed`,{method:"POST",headers:h,body:JSON.stringify({slotIds:Object.keys(C),authoredArms:C})}).catch(()=>{});for(let O of p)if(!(typeof O!="string"||O.length===0)){if(!wt.test(O)){hi()&&!xn.has(O)&&(xn.add(O),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(O)} 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(!L.has(O)){L.add(O),_.add(O);let $=v==null?void 0:v[O];if(typeof $=="string"){let ee=$.replace(/\s+/g," ").trim().slice(0,400);ee!==""&&U.set(O,ee)}let H=M==null?void 0:M[O];H!==void 0&&Q.set(O,H)}}_.size===0||me!=null||(me=setTimeout(()=>{me=null;let O=[..._];_.clear();for(let $=0;$<O.length;$+=20){let H=O.slice($,$+20),ee={},ae={};for(let ue of H){let q=U.get(ue);q!==void 0&&(ee[ue]=q,U.delete(ue));let ge=Q.get(ue);ge!==void 0&&(ae[ue]=ge,Q.delete(ue))}fetch(`${b}/slots/observed`,{method:"POST",headers:h,body:JSON.stringify(Re(B(B({slotIds:H},Object.keys(ee).length>0?{baselineTexts:ee}:{}),Object.keys(ae).length>0?{baselineSkeletons:ae}:{}),{pagePaths:Object.fromEntries(H.map(ue=>[ue,location.pathname]))}))}).catch(()=>{})}},1e3))},reportSkeleton(p,v){!wt.test(p)||T.has(p)||(T.add(p),fetch(`${b}/slots/observed`,{method:"POST",headers:h,body:JSON.stringify({slotIds:[p],baselineSkeletons:{[p]:v}})}).catch(()=>{}))},reportDrift(p,v,M,W){let G=`${p}|${v}`,C=y.getSessionId();!C||re.has(G)||(re.add(G),fetch(`${b}/slots/drift`,{method:"POST",headers:h,body:JSON.stringify({sessionId:C,reports:[{slotId:p,expectedFp:v,observedFp:M,reason:W}]})}).catch(()=>{}))},requestSlots(p,v,M){var W,G;for(let C of p)Et.has(C)||(Et.add(C),wt.test(C)?tt.set(C,{text:v==null?void 0:v[C],render:(W=M==null?void 0:M.render)==null?void 0:W[C],skeleton:(G=M==null?void 0:M.skeletons)==null?void 0:G[C]}):de.reportSlots([C]));tt.size===0||Qt!=null||(Qt=setTimeout(()=>{Qt=null;let C=[...tt];tt.clear();for(let O=0;O<C.length;O+=50){let $=C.slice(O,O+50),H={};for(let[ee,ae]of $)ae.render&&(H[ee]=ae.render);de.decide({slotsFrom:"registry",registrySlotIds:$.map(([ee])=>ee),bootstrap:!1,render:H}).then(ee=>{var ae,ue;if(ee){let q={},ge={},Ee=[];for(let[pe,D]of $){let fe=(ae=ee.slotConfig)==null?void 0:ae[pe];if(fe){fe.needsSkeleton&&D.skeleton&&((ue=de.reportSkeleton)==null||ue.call(de,pe,D.skeleton));continue}Ee.push(pe),D.text&&(q[pe]=D.text),D.skeleton&&(ge[pe]=D.skeleton)}Ee.length>0&&de.reportSlots(Ee,q,ge)}else _n($.map(([q])=>q),Et,q=>{var ge;let Ee={},pe={},D={};for(let[fe,Le]of $)q.has(fe)&&(Le.text&&(Ee[fe]=Le.text),Le.render&&(pe[fe]=Le.render),Le.skeleton&&(D[fe]=Le.skeleton));(ge=de.requestSlots)==null||ge.call(de,[...q],Ee,{render:pe,skeletons:D})});St.forEach(q=>q())})}},0))},decideSlots(p){for(let v of p)kt.has(v.id)||(kt.add(v.id),nt.set(v.id,v));nt.size===0||en!=null||(en=setTimeout(()=>{en=null;let v=[...nt.values()];nt.clear();for(let M=0;M<v.length;M+=30){let W=v.slice(M,M+30);de.decide({slots:W}).then(G=>{G||_n(W.map(C=>C.id),kt,C=>{var O;return(O=de.decideSlots)==null?void 0:O.call(de,W.filter($=>C.has($.id)))}),St.forEach(C=>C())})}},0))},cancelSlots(p){for(let v of p)tt.delete(v)&&Et.delete(v),nt.delete(v)&&kt.delete(v)},onSlotsChanged(p){return St.add(p),()=>{St.delete(p)}},getStyleVocabulary(){return ie},getSitePalette(){return Y},getPersona(){return Z?{persona:Z.persona,confidence:Z.confidence,band:Be(Z.confidence)}:null},async fetchWeights(){var p;try{let v=await fetch(`${b}/weights`,{headers:h});return v.ok?(p=(await v.json()).components)!=null?p:[]:[]}catch(v){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){w.flush(),I.flush()},dispose(){var p;rt==null||rt(),nn=!0,tn=!0,w.destroy(),I.destroy(),((p=we.get(e.apiKey))==null?void 0:p.dispose)===de.dispose&&we.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var p;rt==null||rt(),nn=!0,tn=!0,w.destroy(),I.destroy(),y.destroy(),k.clear(),((p=we.get(e.apiKey))==null?void 0:p.dispose)===de.dispose&&we.delete(e.apiKey);try{localStorage.removeItem(Dt+e.apiKey),localStorage.removeItem(lr(e.apiKey)),localStorage.removeItem(ur(e.apiKey))}catch(v){}e.debug&&console.log("[sentient] destroyed")}};if(we.set(e.apiKey,{config:e,upgrade:null,dispose:de.dispose}),rt=wi(de,e.apiKey,p=>{Ie.then(()=>{nn||pr.add(p)})}),e.debug){let p=window;p.__sentient&&(p.__sentient.client=de)}return de}function ki(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function gr(e,t){let n=t>>>0;for(let r=0;r<e.length;r++)n^=e.charCodeAt(r),n=Math.imul(n,16777619)>>>0;return n.toString(16).padStart(8,"0")}function Ai(e){let t=e.join("");return gr(t,2166136261)+gr(t,1523705862)}var xi=new Set(["A","BUTTON"]),Ci=/^H([1-6])$/,_i=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]);var Oi=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function Ii(e){return xi.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function Li(e){if(Ci.test(e.tagName)||_i.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function Ti(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(Ii(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||Li(r))return r;return t}function Mt(e,t=40){var n,r,o;let a=e.ownerDocument.createTreeWalker(e,4),i=[];for(let l=a.nextNode();l;l=a.nextNode())if(((n=l.nodeValue)!=null?n:"").trim()!==""&&!Oi.has((o=(r=l.parentElement)==null?void 0:r.tagName)!=null?o:"")&&(i.push(l),i.length>120))return{reason:"too_large"};if(i.length===0)return{reason:"empty"};let s=[],u=[];for(let l of i){let d=Ti(l,e),g=s.indexOf(d);g===-1&&(s.push(d),g=s.length-1),u.push(g)}if(s.length>t)return{reason:"too_large"};let c=i.map(l=>{var d;return ki((d=l.nodeValue)!=null?d:"")});return{textNodes:i,ownerEls:s,leafToNode:u,leaves:c,fp:Ai(c)}}var Ri=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function yn(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function Pi(e){return{tag:e.tagName.toLowerCase(),text:yn(e).slice(0,40)}}function hr(e){return e.replace(/["\\\]]/g,"\\$&")}function ct(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function yr(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(ct(t,s))return s;let i=e.parentElement;if(i&&i!==t){let s=yr(i,t);if(s){for(let d of a){let g=`${s} > ${d}`;if(ct(t,g))return g}let u=Array.from(i.children).filter(d=>d.tagName.toLowerCase()===r),c=u.indexOf(e),l=u.some(d=>d!==e&&yn(d)!==yn(e));if(c>=0&&l){let d=`${s} > ${r}:nth-of-type(${c+1})`;if(ct(t,d))return d}}}return null}function vr(e,t){let n=Pi(e),r=e.getAttribute("id");if(r&&ct(t,`#${hr(r)}`))return{v:1,id:r,fingerprint:n};for(let a of Ri){let i=e.getAttribute(a);if(i&&ct(t,`[${a}="${hr(i)}"]`))return{v:1,dataAttr:{name:a,value:i},fingerprint:n}}let o=yr(e,t);return o?{v:1,selector:o,fingerprint:n}:null}ot();var wr=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Di={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Ni(e){let t=e.ariaRole?Di[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 Mi(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var $i=[["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]],vn=[["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]],br={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function Bi(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=Ni(e);if(r)return{type:(t=br[r])!=null?t:"generic",strength:"strong"};let o=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,s]of $i)if(s.test(o))return{type:i,strength:"strong"};for(let[i,s]of vn)if(s.test(e.bodyText))return{type:i,strength:"strong"};let a=Mi(e);return{type:(n=br[a])!=null?n:"generic",strength:"weak"}}function Er(e){var t,n;let r=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),o=e.getAttribute("role");return B({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:Bi(e),bodyText:r.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:r.length},o?{ariaRole:o}:{})}ot();var kr=[100,300,1e3,3e3,1e4],Ki=250,ji=1e3,Ui=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function Ar(e,t){e.n++;let n=t-e.mean;e.mean+=n/e.n,e.m2+=n*(t-e.mean)}var xr=e=>e.n>1?Math.sqrt(e.m2/e.n):0;function Gi(e){var t;try{let n=e.createElement("canvas"),r=n.getContext("webgl")||n.getContext("experimental-webgl");if(!r)return"unknown";let o=r.getExtension("WEBGL_debug_renderer_info"),a=o?String((t=r.getParameter(o.UNMASKED_RENDERER_WEBGL))!=null?t:""):"";return a?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(a)?"sw":"hw":"unknown"}catch(n){return"unknown"}}function Fi(e,t=Date.now){var n,r;let o=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0,a={n:0,mean:0,m2:0},i={n:0,mean:0,m2:0},s=[0,0,0,0,0,0],u=0,c=0,l=0,d=0,g=0,x=0,f=0,m=0,E=0,y=0,k=-1/0,w=-1/0,b=null,h=null,P=null,I=(r=o==null?void 0:o.scrollY)!=null?r:0,F=0,S=e.hidden?null:t(),J=()=>{let T=t();if(P!=null){let re=T-P,be=0;for(;be<kr.length&&re>=kr[be];)be++;s[be]++}P=T},z=()=>{u++,k=t()},K=()=>{c++,w=t()},oe=()=>{b=t()},A=()=>{b!=null&&(Ar(a,t()-b),b=null)},N=()=>{let T=t();l++,T-k>Ki&&T-w>ji&&d++,J()},X=()=>{g++},Y=()=>{var T;let re=(T=o==null?void 0:o.scrollY)!=null?T:0;x+=Math.abs(re-I),I=re,J()},ie=T=>{let re=t();f++,(T.key==="Backspace"||T.key==="Delete")&&E++,Ui.has(T.key)&&y++,h!=null&&Ar(i,re-h),h=re,J()},Z=T=>{let re=T.data;typeof re=="string"&&(m+=re.length),J()},L=()=>{let T=t();e.hidden?S!=null&&(F+=T-S,S=null):S==null&&(S=T)},_={passive:!0,capture:!0};e.addEventListener("mousemove",z,_),e.addEventListener("touchstart",K,_),e.addEventListener("touchmove",X,_),e.addEventListener("mousedown",oe,_),e.addEventListener("mouseup",A,_),e.addEventListener("click",N,_),e.addEventListener("wheel",X,_),e.addEventListener("keydown",ie,_),e.addEventListener("input",Z,_),e.addEventListener("visibilitychange",L),o==null||o.addEventListener("scroll",Y,_);let U=Gi(e),Q=(()=>{var T;try{return((T=o==null?void 0:o.matchMedia)==null?void 0:T.call(o,"(prefers-reduced-motion: reduce)").matches)===!0}catch(re){return!1}})();return{snapshot(){var T,re;let be=t(),me=F+(S!=null?be-S:0);return{v:1,active_ms:Math.round(me),mm:u,mm_rate:me>0?Number((u*1e3/me).toFixed(2)):0,touches:c,clicks:l,hold_n:a.n,hold_mean:Math.round(a.mean),hold_std:Math.round(xr(a)),teleport:d,wheel:g,scroll_px:Math.round(x),keydowns:f,input_chars:m,ik_cv:i.mean>0?Number((xr(i)/i.mean).toFixed(2)):0,backspaces:E,gaps:[...s],reduced_motion:Q,kb_nav:y,renderer:U,vp:[(T=o==null?void 0:o.innerWidth)!=null?T:0,(re=o==null?void 0:o.innerHeight)!=null?re:0],dpr:(o==null?void 0:o.devicePixelRatio)||1}},stop(){e.removeEventListener("mousemove",z,_),e.removeEventListener("touchstart",K,_),e.removeEventListener("touchmove",X,_),e.removeEventListener("mousedown",oe,_),e.removeEventListener("mouseup",A,_),e.removeEventListener("click",N,_),e.removeEventListener("wheel",X,_),e.removeEventListener("keydown",ie,_),e.removeEventListener("input",Z,_),e.removeEventListener("visibilitychange",L),o==null||o.removeEventListener("scroll",Y,_)}}}var zi="section, header, footer, nav, main > div, [data-sentient-section]",Vi=2e4,Wi="__session__";function Hi(e){let t=Array.from(e.querySelectorAll(zi)),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 qi(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 Cr=()=>{};function _r(e,t){var n,r,o,a,i,s,u,c,l,d,g,x,f,m,E;let y=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!y||typeof IntersectionObserver=="undefined"||Ke()||!t.apiKey||!t.apiKey.startsWith("pk_"))return Cr;let k=((r=t.apiBase)!=null?r:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),w=Hi(y);if(w.length===0)return Cr;let b=new Map,h=[];for(let L of w){let _=(i=[(a=t.sectionTypes)==null?void 0:a[(o=L.getAttribute("data-sentient-id"))!=null?o:""],L.getAttribute("data-sentient-type")].find(me=>wr.includes(me)))!=null?i:null,U=Er(L),Q=(u=_!=null?_:(s=t.typeOf)==null?void 0:s.call(t,L))!=null?u:Sr(U).type,T=vr(L,y),re=T?`nc-${Q}-${Gn(JSON.stringify({id:(c=T.id)!=null?c:null,dataAttr:(l=T.dataAttr)!=null?l:null,selector:(d=T.selector)!=null?d:null})).toString(36)}`:`nc-${Q}`;b.set(L,re);let be=vn.filter(([,me])=>me.test(U.bodyText)).map(([me])=>me);h.push(Re(B({componentId:re,semanticType:Q,source:_?"markup":"auto"},T?{locator:T}:{}),{observation:B(B({tag:U.tag,idClass:U.idClass.slice(0,200),headingText:U.headingText,textLength:U.textLength,actionCount:U.actionCount},U.ariaRole?{ariaRole:U.ariaRole}:{}),be.length>0?{patternFlags:be}:{})}))}let P=(m=(f=(x=(g=y.defaultView)!=null?g:typeof window!="undefined"?window:void 0)==null?void 0:x.location)==null?void 0:f.pathname)!=null?m:"/";qi(t.apiKey,k,P,h);let I=Fi(y),F=()=>{let L;try{L=I.snapshot()}catch(_){return}try{e.track({projectId:t.apiKey,componentId:Wi,eventType:"interaction_stats",payload:L})}catch(_){}},S=new Map,J=L=>{let _=S.get(L);return _||(_={ms:0,scroll:0,enterAt:null,intersecting:!1},S.set(L,_)),_},z=new IntersectionObserver(L=>{for(let _ of L){let U=b.get(_.target);if(!U)continue;let Q=J(U);_.isIntersecting?(Q.intersecting=!0,Q.enterAt=Date.now(),_.intersectionRatio>Q.scroll&&(Q.scroll=_.intersectionRatio)):(Q.intersecting=!1,Q.enterAt!=null&&(Q.ms+=Date.now()-Q.enterAt,Q.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let L of b.keys())z.observe(L);let K=(L=!1)=>{var _;let U=Date.now();for(let[Q,T]of S)if(T.enterAt!=null&&(T.ms+=U-T.enterAt,T.enterAt=null),!(T.ms<=0)){try{e.track({projectId:t.apiKey,componentId:Q,eventType:"dwell",payload:{dwell_time:Math.round(T.ms),scroll_depth:Number(T.scroll.toFixed(2))}})}catch(re){}T.ms=0}if(F(),L)try{(_=e.flush)==null||_.call(e)}catch(Q){}},oe=()=>{if(y.hidden)K(!0);else{let L=Date.now();for(let _ of S.values())_.intersecting&&(_.enterAt=L)}},A=!1,N=L=>{if(K(!0),L!=null&&L.persisted){A=!0;return}try{z.disconnect()}catch(_){}},X=L=>{if(!(L!=null&&L.persisted)||!A)return;A=!1;let _=Date.now();for(let U of S.values())U.enterAt=U.intersecting&&!y.hidden?_:null};y.addEventListener("visibilitychange",oe);let Y=(E=y.defaultView)!=null?E:typeof window!="undefined"?window:void 0;Y==null||Y.addEventListener("pagehide",N),Y==null||Y.addEventListener("pageshow",X);let ie=setInterval(()=>{if(y.hidden||A)return;K();let L=Date.now();for(let _ of S.values())_.intersecting&&(_.enterAt=L)},Vi),Z=[];return t.microSignals&&[...b.entries()].forEach(([L,_],U)=>{Z.push(lt((Q,T={})=>{try{e.track({projectId:t.apiKey,componentId:_,eventType:"micro_signal",payload:B({signalType:Q},T)})}catch(re){}},L,void 0,{tabLoss:U===0}))}),()=>{K(!0),clearInterval(ie),I.stop(),y.removeEventListener("visibilitychange",oe),Y==null||Y.removeEventListener("pagehide",N),Y==null||Y.removeEventListener("pageshow",X);for(let L of Z)L();try{z.disconnect()}catch(L){}}}var Or=["cookiebot","onetrust","cookieyes","tcf","google-consent-mode"];function Ji(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 Yi(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function Xi(e){try{return e()}catch(t){return}}function $t(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[i,s]of Object.entries(t.slots)){if(typeof s!="object"||s===null)continue;let u=s,c=Ji(u.dims);if(!c||u.target!==void 0&&typeof u.target!="string")continue;let l=u.arms!==void 0?Yi(u.arms):null,d={dims:c};typeof u.target=="string"&&(d.target=u.target),l&&(d.arms=l),n[i]=d}let r={apiKey:t.apiKey,personaAttributes:t.personaAttributes===!0,slots:n};typeof t.consent=="boolean"&&(r.consent=t.consent);let o=t.consentFrom;if(typeof o=="string"&&Or.includes(o))r.consentFrom=o;else if(o&&typeof o=="object"&&!Array.isArray(o)){let i=o;(typeof i.cmp=="string"&&Or.includes(i.cmp)||i.cmp===void 0&&(typeof i.cookie=="string"||typeof i.check=="function"))&&(r.consentFrom=i)}(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 a=typeof t.persona=="function"?Xi(t.persona):t.persona;if(typeof a=="string"&&a.trim()!==""&&(r.persona=a),Array.isArray(t.sections)){let i=t.sections.filter(s=>typeof s=="string"&&s.trim()!=="").slice(0,50);i.length>=2&&(r.sections=i)}return r}var Ir=new WeakMap;function Lr(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Tr(e,t,n){var a,i,s;let r=Ir.get(e);if(r){if(r.fp!==n.fp||!Lr(r.leafToNode,n.leafToNode))return"mismatch"}else{let u=Mt(e);if(!("fp"in u)||(r={fp:u.fp,leafToNode:u.leafToNode,textNodes:u.textNodes,ownerEls:u.ownerEls,classes:u.ownerEls.map(c=>{var l;return(l=c.getAttribute("class"))!=null?l:""})},r.fp!==n.fp||!Lr(r.leafToNode,n.leafToNode)))return"mismatch";Ir.set(e,r)}let o=r;for(let[u,c]of Object.entries(t.nodes)){let l=Number(u),d=o.ownerEls[l];if(d){if(typeof c.text=="string"){let g=!0;o.leafToNode.forEach((x,f)=>{x===l&&(o.textNodes[f].nodeValue=g?c.text:"",g=!1)})}c.like!==void 0&&o.classes[c.like]!==void 0&&d.setAttribute("class",o.classes[c.like]),c.hidden&&((a=d.style)==null||a.setProperty("display","none","important"))}}for(let u of Object.values((i=t.order)!=null?i:{})){let c=u.map(f=>o.ownerEls[f]).filter(f=>!!f),l=(s=c[0])==null?void 0:s.parentElement;if(!l||c.length!==u.length||c.some(f=>f.parentElement!==l))continue;let d=new Set(c),g=0;Array.from(l.children).map(f=>d.has(f)?c[g++]:f).forEach((f,m)=>{var E;l.children[m]!==f&&l.insertBefore(f,(E=l.children[m])!=null?E:null)})}return"applied"}function dt(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 Zi(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 Bt(e,t){return!!(e!=null&&e.urlMatch)&&!dt(t).includes(e.urlMatch)}var Qi=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function Rr(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)&&Qi.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 Ce(e,t){if(e.urlMatch&&!dt(t).includes(e.urlMatch))return null;let n=Rr(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Zi(r,e.fingerprint)?null:r}function Pr(e,t){return Bt(e,t)?!1:!!e.selector&&!e.dataAttr&&!e.id&&!e.fingerprint&&e.page===void 0?Dr(e,t):Ce(e,t)!==null}function Dr(e,t){return Rr(e,t).length>0}function Kt(e,t){return Bt(e,t)?!1:e.page!==void 0&&Nt.test(e.page)?mn(e.page,dt(t)):Dr(e,t)}var Nr={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"},es=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function Mr(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(!es.test((r=n[1])!=null?r:""))return!1;return!0}var $r=/^https:\/\//i,Br=new Map,Pe=null;function ts(e){return e.replace(/["\\]/g,"\\$&")}function ns(e){var t;(!Pe||!Pe.isConnected)&&(Pe=e.querySelector("style[data-sentient-ops]"),Pe||(Pe=e.createElement("style"),Pe.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Pe))),Pe.textContent=[...Br.entries()].map(([n,r])=>`[data-snt-e="${ts(n)}"]{${r}}`).join(`
2
+ `)}function Kr(e,t,n,r){var s;let o=!1,a=(s=t.moveBefore)!=null?s:t.moveAfter;if(a){let u=Ce(a,r);!u||u===e||u.parentElement!==e.parentElement||!e.parentElement?o=!0:t.moveBefore?e.parentElement.insertBefore(e,u):e.parentElement.insertBefore(e,u.nextSibling)}typeof t.text=="string"&&(e.textContent=t.text),typeof t.href=="string"&&$r.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&$r.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[u,c]of Object.entries(t.style)){let l=Nr[u];l&&typeof c=="string"&&Mr(c)&&i.push(`${l}:${c.trim()} !important`)}return i.length>0&&(e.setAttribute("data-snt-e",n),Br.set(n,i.join(";")),ns(r)),{anchorMiss:o}}var ft="data-sentient-block-arm",R=null;function Je(e){R=e!=null?e:null}var je=null;function Ye(e){je=e!=null?e:null}var Fr=e=>{var t;return typeof e=="string"?(t=je==null?void 0:je.entries.find(n=>n.id===e))==null?void 0:t.classes:void 0},zr=e=>{let t=typeof e=="string"?je==null?void 0:je.entries.find(n=>n.id===e):void 0;return t!=null&&t.computed.inheritsColor?t.computed.color:void 0},Oe="data-sentient-blocks-hid",qe={none:"0",sm:"8px",md:"16px",lg:"24px"},bn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},jr={sm:"0.875em",md:"1em",lg:"1.25em"},rs={sm:"1.25em",md:"1.5em",lg:"2em"},os={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},Ur={sm:"8px",md:"16px",lg:"32px"},is={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},ss={normal:"400",medium:"500",bold:"700"};function he(e,t){for(let[n,r]of Object.entries(t))r!==void 0&&e.style.setProperty(n,r);return e}function Gr(e){return e==="muted"?R!=null&&R.muted?{color:R.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:R==null?void 0:R.accent}:{}}function Vr(e,t){let n=as(e,t),r=zr(e.like);return n&&r&&(n.style.color=r),n}function as(e,t){var n,r,o,a,i,s,u,c,l,d,g,x,f,m,E,y,k,w,b,h;try{let P=Fr(e.like),I=e.maxWidth==="measure"?"65ch":void 0,F=S=>(S.className=P,he(S,{"max-width":I}));switch(e.type){case"stack":case"grid":{let S=t.createElement("div");if(e.type==="stack"){let K=e;he(S,{display:"flex","flex-direction":K.direction,gap:(r=qe[(n=K.gap)!=null?n:"md"])!=null?r:qe.md,"align-items":K.align?bn[K.align]:void 0,"justify-content":K.justify?bn[K.justify]:void 0,"flex-wrap":K.wrap?"wrap":void 0})}else{let K=e,oe=(a=qe[(o=K.gap)!=null?o:"md"])!=null?a:qe.md;he(S,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${K.columns-1} * ${oe}) / ${K.columns})), 1fr))`,gap:oe,"align-items":K.align?bn[K.align]:void 0})}P&&(S.className=P);let J=!P&&e.type==="stack"&&e.surface==="raised",z=(i=e.pad)!=null?i:J?"md":void 0;z&&he(S,{padding:(s=qe[z])!=null?s:qe.md}),J&&he(S,{background:R==null?void 0:R.surface,color:R!=null&&R.surface?R==null?void 0:R.surfaceText:void 0,border:`1px solid ${(u=R==null?void 0:R.border)!=null?u:"currentColor"}`,"border-radius":(c=R==null?void 0:R.radius)!=null?c:"8px"});for(let K of(l=e.children)!=null?l:[]){let oe=Vr(K,t);oe&&S.appendChild(oe)}return S}case"text":{let S=t.createElement("p");return S.textContent=e.value,P?F(S):he(S,Te(V({margin:"0","font-size":e.size?jr[e.size]:void 0,"font-weight":e.weight?ss[e.weight]:void 0,"text-align":e.align},Gr(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let S=t.createElement(`h${e.level}`);return S.textContent=e.value,P?F(S):he(S,{margin:"0","font-size":rs[(d=e.size)!=null?d:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let S=t.createElement("a");if(S.textContent=e.label,S.href=e.href,e.tag&&S.setAttribute("data-sentient-tag",e.tag),P)return F(S);let J=(g=e.emphasis)!=null?g:"primary";return he(S,{display:"inline-block",padding:os[(x=e.size)!=null?x:"md"],"border-radius":(f=R==null?void 0:R.radius)!=null?f:"8px",font:"inherit","font-size":e.size?jr[e.size]:void 0,"text-decoration":J==="ghost"?"underline":"none",cursor:"pointer",background:J==="primary"?(m=R==null?void 0:R.primaryBg)!=null?m:"#111827":"transparent",color:J==="primary"?(E=R==null?void 0:R.primaryText)!=null?E:"#ffffff":(y=R==null?void 0:R.accent)!=null?y:"inherit",border:J==="secondary"?`1px solid ${(k=R==null?void 0:R.accent)!=null?k:"currentColor"}`:"none"})}case"link":{let S=t.createElement("a");return S.textContent=e.label,S.href=e.href,e.tag&&S.setAttribute("data-sentient-tag",e.tag),P?F(S):he(S,{color:"inherit","text-decoration":"underline"})}case"image":{let S=t.createElement("img");return S.src=e.src,S.alt=e.alt,P&&(S.className=P),he(S,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?is[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let S=t.createElement("span");return S.textContent=e.value,P?F(S):he(S,V({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(w=R==null?void 0:R.border)!=null?w:"currentColor"}`},Gr(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(b=Ur[e.size])!=null?b:Ur.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(h=R==null?void 0:R.border)!=null?h:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(P){return null}}function Wr(e,t,n,r){var o,a;try{let i=new Set;for(let u of Array.from(e.children)){let c=u.getAttribute(ft);c!==null&&(t[c]===void 0?u.remove():i.add(c))}for(let[u,c]of Object.entries(t)){if(i.has(u))continue;let l="tree"in c?c:null,d=Vr(l?l.tree:c,r);if(!d)continue;let g=r.createElement("div");g.setAttribute(ft,u),g.style.display="none";let x=l?Fr((o=l.surface)==null?void 0:o.like):void 0;if(x){let f=r.createElement("div");f.className=x;let m=zr((a=l.surface)==null?void 0:a.like);m&&(f.style.color=m),f.appendChild(d),g.appendChild(f)}else g.appendChild(d);e.appendChild(g)}let s=n!==void 0&&t[n]!==void 0;for(let u of Array.from(e.children)){let c=u.getAttribute(ft),l=u;c!==null?l.style.display=s&&c===n?"":"none":s?l.hasAttribute(Oe)||(l.setAttribute(Oe,l.style.display),l.style.display="none"):l.hasAttribute(Oe)&&(l.style.display=l.getAttribute(Oe),l.removeAttribute(Oe))}}catch(i){}}function ls(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(ft)!==null){n.remove();continue}n.hasAttribute(Oe)&&(n.style.display=n.getAttribute(Oe),n.removeAttribute(Oe))}}catch(t){}}function jt(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${ft}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${Oe}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||ls(r)}catch(n){}}function wn(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function Ut(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 Gt(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 u=wn(i.target,n);for(let c of u)for(let[l,d]of Object.entries(s))(o=i.dims[l])!=null&&o.includes(d)&&(c.setAttribute(`data-${l}`,d),r==null||r(c,`data-${l}`))}}function Ft(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=wn(a.target,n);for(let u of s)u.setAttribute("data-sentient-arm",i),r==null||r(u,"data-sentient-arm")}}function us(e,t){var o,a;let n=e.ownerDocument.createTreeWalker(e,4),r=null;for(let i=n.nextNode();i!==null;i=n.nextNode()){if(((o=i.nodeValue)!=null?o:"").trim()==="")continue;let s=(a=i.parentElement)==null?void 0:a.tagName;if(!(s==="SCRIPT"||s==="STYLE"||s==="TEMPLATE")){if(r!==null){e.textContent=t;return}r=i}}r!==null?r.nodeValue=t:e.textContent=t}function zt(e,t,n,r){var s,u,c,l,d,g,x;let o=new Set,a=(s=r==null?void 0:r.contentAndOps)!=null?s:!0,i=[];for(let[f,m]of Object.entries(t)){if(Bt(m.locator,n))continue;let E;if(m.locator){let k=Ce(m.locator,n);E=k?[k]:[],!k&&Kt(m.locator,n)&&i.push(f)}else E=wn(m.target,n);let y=e[f];for(let k of E){if(y!==void 0)if(typeof y=="string")k.setAttribute("data-sentient-arm",y),(u=r==null?void 0:r.onAttr)==null||u.call(r,k,"data-sentient-arm"),a&&((c=r==null?void 0:r.onApplied)==null||c.call(r,f,y,k));else for(let[b,h]of Object.entries(y))k.setAttribute(`data-${b}`,h),(l=r==null?void 0:r.onAttr)==null||l.call(r,k,`data-${b}`);if((m.blocks||m.compose)&&!ds(n)){let b=Object.fromEntries([...Object.entries((d=m.blocks)!=null?d:{}).filter(([,h])=>!at(h)),...Object.entries((g=m.compose)!=null?g:{}).filter(([,h])=>!at(h.tree))]);Object.keys(b).length>0&&(Wr(k,b,typeof y=="string"?y:void 0,n),o.add(k))}if(!a)continue;let w=k.textContent;m.edits?Tr(k,m.edits.edits,m.edits)==="mismatch"&&((x=r==null?void 0:r.onDrift)==null||x.call(r,f,m.edits.fp)):typeof m.content=="string"&&us(k,m.content),m.ops&&Kr(k,m.ops,f,n).anchorMiss&&!i.includes(f)&&i.push(f),gn(k,Te(V(V({previous:w},typeof y=="string"?{arm:y}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return jt(n,o),i}var cs=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function ds(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:cs.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var fs=800;function Vt(e,t,n){let r=[];return n.forEach(({slotId:o,arm:a,el:i},s)=>{r.push(lt((g,x={})=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"micro_signal",payload:V({signalType:g},x)})}catch(f){}},i,void 0,{tabLoss:s===0}));let u=null,c=0,l=()=>{c=Date.now(),u=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:a,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-c}})}catch(g){}u=null},fs)},d=()=>{u!==null&&(clearTimeout(u),u=null)};i.addEventListener("mouseenter",l),i.addEventListener("mouseleave",d),r.push(()=>{i.removeEventListener("mouseenter",l),i.removeEventListener("mouseleave",d),u!==null&&clearTimeout(u)})}),()=>{for(let o of r)o()}}function ps(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 qr(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var ms="_snt_fired_goals";function Jr(e,t){try{e==null||e.sessionStorage.removeItem(qr(t)),e==null||e.sessionStorage.removeItem(ms)}catch(n){}}function Hr(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function gs(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 hs(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function Wt(e,t,n,r){var y,k;let o=(y=n.defaultView)!=null?y:typeof window!="undefined"?window:null,a=qr(r),i=gs(o,a),s=w=>{let b=Hr(w);if(!i.has(b))try{w.slotId?t.componentGoal(w.slotId,w.goalId):t.goal(w.goalId),i.add(b),hs(o,a,i)}catch(h){}},u=e.filter(w=>w.event==="click"),c=e.filter(w=>w.event==="form_submit"),l=e.filter(w=>w.event==="url_reached"),d=e.filter(w=>w.event==="scroll_depth"),g=(w,b)=>{if(!w.locator)return!1;let h=Ce(w.locator,n);return!!h&&(h===b||h.contains(b))},x=w=>{let b=w.target;if(!(!b||typeof b.closest!="function"))for(let h of u)g(h,b)&&s(h)},f=w=>{let b=w.target;if(b)for(let h of c)g(h,b)&&s(h)},m=()=>{if(l.length===0)return;let w=dt(n);for(let b of l)b.urlPattern&&ps(b.urlPattern,w)&&s(b)},E=()=>{var h;let w=n.documentElement,b=w.scrollHeight>0?(w.scrollTop+w.clientHeight)/w.scrollHeight:0;for(let P of d)b>=((h=P.threshold)!=null?h:.75)&&s(P);d.every(P=>i.has(Hr(P)))&&n.removeEventListener("scroll",E)};return n.addEventListener("click",x,!0),n.addEventListener("submit",f,!0),(k=n.defaultView)==null||k.addEventListener("popstate",m),m(),d.length>0&&(n.addEventListener("scroll",E,{passive:!0}),E()),{checkUrl:m,teardown:()=>{var w;n.removeEventListener("click",x,!0),n.removeEventListener("submit",f,!0),(w=n.defaultView)==null||w.removeEventListener("popstate",m),d.length>0&&n.removeEventListener("scroll",E)}}}function Ht(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 Yr="__snt_editor_token";function Xr(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(Yr):null}catch(e){return null}}function Zr(e){try{sessionStorage.setItem(Yr,e)}catch(t){}}var gt="0.31.1",Yt=gt!=="0.0.0-dev"?{name:"snippet",version:gt}:void 0,so=gt!=="0.0.0-dev"?{v:gt}:{},ht=5e3,ys=50,ao=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),le=null,j=null,Se={},ve=null,se=null,De=null,ce=null,_e=null,ne=null,Ue=null,Qr=!1,Sn=null,qt=null,Xt=null,Ge=!1,pt=!1,Xe=null,Ne=!1,Fe=null,Me=[],Zt=null,mt=null,ye=null,vs=3e3,bs=100;function yt(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 ke(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Ze(e,t){return le?(le.personaAttributes&&ne&&Ut(ne.persona,ne.band,e,t==null?void 0:t.onAttr),Gt(Se,le.slots,e,t==null?void 0:t.onAttr),Ft(Se,le.slots,e,t==null?void 0:t.onAttr),ve?zt(Se,ve,e,V(Te(V({},t),{onDrift:(n,r)=>{var o,a;return(a=j==null?void 0:j.reportDrift)==null?void 0:a.call(j,n,r,(o=fo[n])!=null?o:null,"fp_mismatch")}}),ne?{persona:ne.persona}:{})):(jt(e,new Set),[])):[]}function lo(e){var n;let t=new Map;for(let r of(n=le==null?void 0:le.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function En(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=Ht(e,lo(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function ws(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 Ss(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function uo(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function vt(e){var t;return(t=e.apiBase)!=null?t:"https://api.sentient-ui.com"}function Es(e){return Promise.resolve().then(()=>fetch(`${vt(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 co(e,t){let n=[],r=[];for(let o of e)try{if(typeof(o==null?void 0:o.id)!="string")continue;!o.locator||Pr(o.locator,t)?n.push(o.id):Kt(o.locator,t)&&r.push(o.id)}catch(a){}return[n,r]}var fo={};function po(e,t){var r;let n={};for(let o of e){let a=(r=Fe==null?void 0:Fe.find(c=>c.id===o))==null?void 0:r.locator,i=a?Ce(a,t):null,s=i?Mt(i):null,u=s&&"fp"in s?s.fp:void 0;u&&(fo[o]=u),n[o]=Te(V({},u?{fp:u}:{}),{forms:!1,compose:!0,content:!0})}return n}function mo(e,t){let n=null;for(let r of t)e!=null&&e[r]&&((n!=null?n:n={})[r]=e[r]);return n}function go(){!Fe||!Ge||Zt===window.location.pathname||(Zt=window.location.pathname,ks())}function ks(){ye==null||ye();let e=le,t=Fe;if(!e||!t)return;let n,r,o=()=>{clearTimeout(n),clearTimeout(s),r==null||r.disconnect(),ye===o&&(ye=null)},a=null,i=u=>{let[c,l]=co(t,document),d=c.filter(g=>!Me.includes(g));a!==null&&c.some(g=>!a.has(g)&&!d.includes(g))&&bt(),a=new Set(c),d.length>0&&As(d).catch(()=>{}),(u||l.length===0&&!t.some(g=>!c.includes(g.id)&&!Me.includes(g.id)))&&(o(),ho(e,l))},s=setTimeout(()=>i(!0),vs);if(ye=o,i(),ye===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(i,bs)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(u){}}async function As(e){let t=le,n=j;if(!t||!n)return;Me=Me.concat(e);let r=await yt(n.decide(V({slotsFrom:"registry",registrySlotIds:e,render:po(e,document)},so)),ht);if(r||(Me=Me.filter(a=>!e.includes(a))),!r||Ne||j!==n)return;Se=V(V({},Se),r.slots);let o=mo(r.slotConfig,e);o&&(ve=V(V({},ve),o)),bt(),ke(t,"late decide",e),mt&&He(t.apiKey,mt=V(Te(V({},mt),{slots:Se,savedAt:Date.now()}),ve?{slotConfig:ve}:{}))}function ho(e,t){if(t.length!==0)try{fetch(`${vt(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 Qe(){return!!(le&&j&&le.sectionCapture!==!1&&(le.consent!==!1||pt)&&!Ke())}function xs(){if(!j||!le||!Qe()||_e)return;let e=[];Ze(document,{contentAndOps:Ge,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),kn();try{ce==null||ce(),ce=Vt(j,le.apiKey,e)}catch(t){}}function kn(){if(typeof document=="undefined"||!Qe())return;let e;try{if(qt&&qt.length>0){let t=new Map;for(let n of qt){if(n.urlMatch!==window.location.pathname)continue;let r=Ce(n.locator,document);r&&t.set(r,n.type)}t.size>0&&(e=n=>{var r;return(r=t.get(n))!=null?r:null})}}catch(t){}try{_e=_r(j,V({apiKey:le.apiKey,apiBase:le.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{})),Xt=window.location.pathname}catch(t){}}function bt(){try{let e=[];if(ce==null||ce(),ce=null,Ze(document,{contentAndOps:Ge,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),En(Ue,document),e.length>0&&Qe())try{ce=Vt(j,le.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Xt!==null&&window.location.pathname!==Xt&&Qe()&&(_e==null||_e(),_e=null,kn())}catch(t){}}catch(e){}}function eo(){Sn===null&&(Sn=setTimeout(()=>{Sn=null,bt();try{se==null||se.checkUrl()}catch(e){}go()},ys))}function An(){if(!(Qr||typeof window=="undefined"||typeof history=="undefined")){Qr=!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 eo(),i}};e("pushState"),e("replaceState"),window.addEventListener("popstate",eo)}catch(e){}}}function Jt(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 yo(e){return new URLSearchParams(e).get("sentient_editor")}function Cs(){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 _s(e,t){var n,r,o;try{window.__sentientEditor={token:t,apiBase:vt(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:Cs();if(!a){no();return}let i=document.createElement("script");i.src=a,i.async=!0,i.onerror=()=>no(),((o=document.head)!=null?o:document.documentElement).appendChild(i)}catch(a){}}var to="sentient-editor-load-notice",vo={position:"fixed",bottom:"16px",zIndex:"2147483647",background:"#111827",color:"#fff",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"};function no(){var e,t;try{if(typeof document=="undefined"||document.getElementById(to))return;(e=document.querySelector('meta[name="referrer"][data-sentient-editor]'))==null||e.remove();let n=document.createElement("div");n.id=to,n.textContent="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.",Object.assign(n.style,vo,{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 bo(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 u of i.split(",")){let[c,l]=u.split("=");c&&l&&(s[c]=l)}Object.keys(s).length&&(n[a]=s)}else n[a]=i}return Object.keys(n).length?n:null}function wo(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var ro="sentient-persona-preview-banner";function oo(e,t){var n;try{if(typeof document=="undefined"||document.getElementById(ro))return;let r=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),o=document.createElement("div");o.id=ro,o.setAttribute("role","status"),Object.assign(o.style,vo,{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 Os(e,t){var r;if((r=e.registry)!=null?r:Object.keys(e.slots).length===0){let o=vt(e),i=await yt(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),ht);if(!(i!=null&&i.slotConfig)){et(e),ke(e,"preview mode: slot config unavailable \u2014 page left as-is");return}ve=i.slotConfig,Je(i.palette),Ye(i.vocabulary)}Se=t,ne=null,Ze(document),An(),et(e),ke(e,"preview mode",t)}async function Is(e,t){var c,l,d,g,x,f,m,E,y;let n=vt(e),o=((c=e.registry)!=null?c:Object.keys(e.slots).length===0)?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(e.slots).map(([k,w])=>({id:k,dims:w.dims}))},a=await yt(fetch(`${n}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${e.apiKey}`},body:JSON.stringify(o)}).then(k=>k.ok?k.json():null).catch(()=>null),ht);if(!a){et(e),ke(e,"persona preview: explain unavailable \u2014 page left as-is");return}let i=a;Se=(l=i.slots)!=null?l:{},ve=(d=i.slotConfig)!=null?d:null,Je(i.palette),Ye(i.vocabulary);let s=(f=(x=(g=i.personaAttributes)==null?void 0:g.persona)!=null?x:i.persona)!=null?f:t,u=(E=(m=i.personaAttributes)==null?void 0:m.confidence)!=null?E:"high";ne={persona:s,band:u},Ze(document),Ge=!0,An(),et(e),i.recognized===!1?oo(t,!0):oo((y=i.personaDisplay)!=null?y:s)}function et(e){let t={consentWatcher:$e,goal(n,r){try{j==null||j.goal(n,r)}catch(o){}},componentGoal(n,r){try{j==null||j.componentGoal(n,r)}catch(o){}},grantConsent(){try{!j&&Ne?(j=ut(V({apiKey:e.apiKey,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,ingestUrl:uo(e)},Yt?{sdk:Yt}:{})),De&&De.length>0&&(se==null||se.teardown(),se=Wt(De,j,document,e.apiKey))):(hn(e.apiKey),j&&De&&De.length>0&&(se==null||se.teardown(),se=Wt(De,j,document,e.apiKey))),Ne=!1}catch(n){}pt=!0;try{xs()}catch(n){}},revokeConsent(){try{_e==null||_e(),_e=null,Xt=null,ce==null||ce(),ce=null,ye==null||ye(),se==null||se.teardown(),se=null,Jr(typeof window!="undefined"?window:null,e.apiKey),pt=!1,Ne=!0,j==null||j.destroy(),j=null}catch(n){}},reapply:bt,getState(){var n,r;try{return{apiKey:e.apiKey,persona:(n=ne==null?void 0:ne.persona)!=null?n:null,band:(r=ne==null?void 0:ne.band)!=null?r:null,slots:Se,matchCounts:Jt(e),consent:!Ne&&(e.consent!==!1||pt)}}catch(o){return{apiKey:e.apiKey,persona:null,band:null,slots:{},matchCounts:{},consent:!1}}}};if(window.SentientSnippet=t,e.consentFrom&&!Xe)try{let n=$e(e.consentFrom),r=e.consent!==!1;Xe=n.subscribe(()=>{let o=n.read();o===!0&&!r?(r=!0,t.grantConsent()):o===!1&&r&&(r=!1,t.revokeConsent())})}catch(n){}for(let n of ao.splice(0))try{n[0]==="goal"&&t.goal(n[1],n[2])}catch(r){}}function io(){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,consentWatcher:$e,getState:()=>({apiKey:"",persona:null,band:null,slots:{},matchCounts:{},consent:!1})},ao.length=0}catch(t){}}async function So(){var e,t;try{let n=$t(window.sentient);if(!n){io();return}if(le=n,Xe==null||Xe(),Xe=null,n.consentFrom&&n.consent===void 0)try{n.consent=$e(n.consentFrom).read()===!0}catch(h){n.consent=!1}Ge=!1,Ue=null,Je(null),Ye(null),pt=!1,Ne=!1,De=null,Fe=null,Me=[],Zt=null,mt=null,ye==null||ye();let r=typeof window!="undefined"?yo(window.location.search):null;if(r){Zr(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:Xr();if(o){_s(n,o),et(n),ke(n,"editor mode");return}let a=typeof window!="undefined"?bo(window.location.search):null;if(a){await Os(n,a);return}let i=typeof window!="undefined"?wo(window.location.search):null;if(i){await Is(n,i),ke(n,"persona preview",i);return}let s=(e=n.registry)!=null?e:Object.keys(n.slots).length===0;n.registry===void 0&&!s&&ke(n,"slots declared without registry: true, so dashboard-published components are not applied");let u=s?Es(n):null,c=Ss();try{(t=c==null?void 0:c.stop)==null||t.call(c)}catch(h){}let l=st(n.apiKey),d=[];l&&(ne={persona:l.persona,band:l.band},Se=l.slots,l.slotConfig&&(ve=l.slotConfig),l.palette&&Je(l.palette),l.vocabulary&&Ye(l.vocabulary),Ze(document,V({contentAndOps:!1},c?{onAttr:(h,P)=>d.push([h,P])}:{})),l.layoutOrder&&(Ue=l.layoutOrder,En(Ue,document))),c&&ws(c,d,document);let g=ut(V({apiKey:n.apiKey,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,ingestUrl:uo(n)},Yt?{sdk:Yt}:{}));j=g,et(n),An();let x=Object.entries(n.slots).map(([h,P])=>({id:h,dims:P.dims})),f=so,m={pp:c?c.v:0},E=Array.from(lo(document).keys()),y=[];if(u){let[h]=await Promise.all([yt(u,ht),document.readyState==="loading"?new Promise(P=>document.addEventListener("DOMContentLoaded",P,{once:!0})):null]);Fe=h,h&&(Me=y=co(h,document)[0]),ke(n,"registry scope",h&&y)}let k=g.decide(V(V(V(V({slots:x},f),m),E.length>=2?{sections:E}:{}),s?{slotsFrom:"registry",registrySlotIds:y,render:po(y,document)}:{})),w=await yt(k,ht),b=h=>{var F,S,J,z,K;let P=g.getPersona();P?ne={persona:P.persona,band:P.band}:h.persona&&(ne={persona:h.persona,band:"low"}),Se=h.slots,s?ve=mo(h.slotConfig,y):h.slotConfig&&(ve=h.slotConfig),h.palette&&Je(h.palette),h.vocabulary&&Ye(h.vocabulary),Ue=(F=h.layoutOrder)!=null?F:Ue;let I=()=>{let oe=[],A=Ze(document,{onApplied:(N,X,Y)=>oe.push({slotId:N,arm:X,el:Y})});if(s||ho(n,A),En(Ue,document),Ge=!0,Qe())try{ce==null||ce(),ce=Vt(j,n.apiKey,oe)}catch(N){}};if(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",I,{once:!0}):I(),De=(S=h.goals)!=null?S:null,h.goals&&h.goals.length>0&&n.consent!==!1&&j)try{se==null||se.teardown(),se=Wt(h.goals,j,document,n.apiKey)}catch(oe){}qt=(J=h.sectionMap)!=null?J:null,Qe()&&kn(),ke(n,"applied",{persona:ne,slots:Se,matches:Jt(n)}),!Ne&&(He(n.apiKey,mt=V(V(V({v:1,persona:(z=ne==null?void 0:ne.persona)!=null?z:h.persona,band:(K=ne==null?void 0:ne.band)!=null?K:"low",slots:h.slots,layoutOrder:h.layoutOrder,savedAt:Date.now()},ve?{slotConfig:ve}:{}),h.palette?{palette:h.palette}:{}),h.vocabulary?{vocabulary:h.vocabulary}:{})),Zt=null,go())};if(!w){ke(n,"decide timeout/null \u2014 snapshot state stands",Jt(n)),k.then(h=>{!h||Ge||Ne||j!==g||(b(h),ke(n,"late decide applied",Jt(n)))}).catch(()=>{});return}b(w)}catch(n){io()}}if(typeof window!="undefined"&&window.sentient){let e=window;e.__sentientInitialized||(e.__sentientInitialized=!0,Promise.resolve().then(()=>{So()}))}return Lo(Ls);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentientui/snippet",
3
- "version": "0.31.0",
3
+ "version": "0.31.1",
4
4
  "private": false,
5
5
  "description": "SentientUI Style-rung snippet for non-React sites — persona attributes and adaptive style tokens from one script tag",
6
6
  "license": "MIT",