@sentientui/snippet 0.31.1 → 0.32.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -8
- package/dist/consent.global.js +1 -0
- package/dist/editor.global.js +13 -13
- package/dist/engagement.global.js +1 -0
- package/dist/install.cjs +1 -1
- package/dist/install.js +1 -1
- package/dist/preview.global.js +1 -0
- package/dist/snippet.global.js +2 -2
- package/package.json +6 -3
package/dist/install.cjs
CHANGED
|
@@ -31,7 +31,7 @@ module.exports = __toCommonJS(install_exports);
|
|
|
31
31
|
// src/prepaint-script.ts
|
|
32
32
|
var SNIPPET_PREPAINT_VERSION = 1;
|
|
33
33
|
function renderSnippetPrePaintScript() {
|
|
34
|
-
return `(function(){try{var W=window,D=document,N=navigator,L=W.location,c=W.sentient,n=Date.now();if(!c||typeof c.apiKey!="string"||c.consent
|
|
34
|
+
return `(function(){try{var W=window,D=document,N=navigator,L=W.location,c=W.sentient,n=Date.now();if(!c||typeof c.apiKey!="string"||c.consentFrom!==void 0||(c.consent!==void 0?c.consent!==!0:W.Shopify&&W.Shopify.shop)||W.__sntPP)return;if(N.doNotTrack=="1"||N.doNotTrack=="yes"||W.doNotTrack=="1"||N.msDoNotTrack=="1"||N.globalPrivacyControl||N.webdriver)return;if(/[?&]sentient_(editor|preview|persona)=/.test(L.search))return;var s=JSON.parse(localStorage.getItem("_snt_snap:"+c.apiKey)),S=s.slots;if(s.v!==1||typeof s.persona!="string"||typeof s.band!="string"||!S||typeof S!="object"||!(2592e6>n-s.savedAt))return;var H=["data-sentient-persona","data-sentient-confidence"],d=D.documentElement,P=W.__sntPP={v:1,at:n,stamped:[],html:[],reordered:!1,done:!1,stop:function(){X()}},b=P.stamped,p=[],i,k,t,e,l,m,x,V=c.sections,O=s.layoutOrder,q=!(V&&V.length>1&&O&&O.length==V.length);if(c.personaAttributes&&!d.hasAttribute(H[0])){d.setAttribute(H[0],s.persona);d.setAttribute(H[1],s.band);P.html=H}var Q=function(v){return(""+v).replace(/["\\\\]/g,"\\\\$&")},A=function(t,v,g){if(typeof v=="string"){if(!g||(g.arms||[]).indexOf(v)>-1)p.push([t,"data-sentient-arm",v])}else if(v)for(k in v)if(!g||((g.dims||{})[k]||[]).indexOf(v[k])>-1)p.push([t,"data-"+k,v[k]])},U=function(t){var a=t[3];if(!a)return;a[2]==null?a[0].removeAttribute(a[1]):a[0].setAttribute(a[1],a[2]);x=b.indexOf(a);if(x>-1)b.splice(x,1);t[3]=0},R=function(){var g={},f=[],y,z,a,n=0;for(i in V){try{y=D.querySelectorAll(V[i])}catch(_){return 1}if(y.length==1){g[V[i]]=y[0];n++}}if(n!=V.length)return 0;for(i in O){z=g[O[i]];if(!z||~f.indexOf(z))return 1;f.push(z)}a=f[0].parentNode;if(!a)return 1;for(i in f)if(f[i].parentNode!=a)return 1;y=f.slice().sort(function(u,v){return u.compareDocumentPosition(v)&4?-1:1});for(i=0;i in f;i++){z=f[i];if(y[i]!=z){a.insertBefore(z,y[i]);y.splice(y.indexOf(z),1);y.splice(i,0,z)}}P.reordered=!0;return 1},F=function(){if(P.done)return;for(i=0;i in p;i++){t=p[i];if(!t)continue;try{m=D.querySelectorAll(t[0])}catch(_){p[i]=0;continue}if(m.length>1){U(t);p[i]=0}else if(m.length==1&&(!t[3]||t[3][0]!=m[0])){U(t);e=m[0];t[3]=[e,t[1],e.getAttribute(t[1])];e.setAttribute(t[1],t[2]);b.push(t[3])}}if(!q)q=R()},X=function(){if(P.done)return;P.done=!0;try{o.disconnect()}catch(_){}clearTimeout(T)},G=c.slots,C=s.slotConfig;for(i in G)if(G[i]&&G[i].target)A(G[i].target,S[i],G[i]);for(i in C){e=C[i]||{};l=e.locator;t=e.target;if(l){if(l.urlMatch&&!~L.pathname.indexOf(l.urlMatch))continue;t=l.id?'[id="'+Q(l.id)+'"]':l.dataAttr&&/^[\\w-]+$/.test(l.dataAttr.name)?"["+l.dataAttr.name+'="'+Q(l.dataAttr.value)+'"]':l.selector}if(t)A(t,S[i])}var o=new MutationObserver(F),T=setTimeout(X,3e3);o.observe(d,{childList:!0,subtree:!0});D.addEventListener("DOMContentLoaded",function(){F();X()});F();}catch(_){}})();`;
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// src/install.ts
|
package/dist/install.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// src/prepaint-script.ts
|
|
2
2
|
var SNIPPET_PREPAINT_VERSION = 1;
|
|
3
3
|
function renderSnippetPrePaintScript() {
|
|
4
|
-
return `(function(){try{var W=window,D=document,N=navigator,L=W.location,c=W.sentient,n=Date.now();if(!c||typeof c.apiKey!="string"||c.consent
|
|
4
|
+
return `(function(){try{var W=window,D=document,N=navigator,L=W.location,c=W.sentient,n=Date.now();if(!c||typeof c.apiKey!="string"||c.consentFrom!==void 0||(c.consent!==void 0?c.consent!==!0:W.Shopify&&W.Shopify.shop)||W.__sntPP)return;if(N.doNotTrack=="1"||N.doNotTrack=="yes"||W.doNotTrack=="1"||N.msDoNotTrack=="1"||N.globalPrivacyControl||N.webdriver)return;if(/[?&]sentient_(editor|preview|persona)=/.test(L.search))return;var s=JSON.parse(localStorage.getItem("_snt_snap:"+c.apiKey)),S=s.slots;if(s.v!==1||typeof s.persona!="string"||typeof s.band!="string"||!S||typeof S!="object"||!(2592e6>n-s.savedAt))return;var H=["data-sentient-persona","data-sentient-confidence"],d=D.documentElement,P=W.__sntPP={v:1,at:n,stamped:[],html:[],reordered:!1,done:!1,stop:function(){X()}},b=P.stamped,p=[],i,k,t,e,l,m,x,V=c.sections,O=s.layoutOrder,q=!(V&&V.length>1&&O&&O.length==V.length);if(c.personaAttributes&&!d.hasAttribute(H[0])){d.setAttribute(H[0],s.persona);d.setAttribute(H[1],s.band);P.html=H}var Q=function(v){return(""+v).replace(/["\\\\]/g,"\\\\$&")},A=function(t,v,g){if(typeof v=="string"){if(!g||(g.arms||[]).indexOf(v)>-1)p.push([t,"data-sentient-arm",v])}else if(v)for(k in v)if(!g||((g.dims||{})[k]||[]).indexOf(v[k])>-1)p.push([t,"data-"+k,v[k]])},U=function(t){var a=t[3];if(!a)return;a[2]==null?a[0].removeAttribute(a[1]):a[0].setAttribute(a[1],a[2]);x=b.indexOf(a);if(x>-1)b.splice(x,1);t[3]=0},R=function(){var g={},f=[],y,z,a,n=0;for(i in V){try{y=D.querySelectorAll(V[i])}catch(_){return 1}if(y.length==1){g[V[i]]=y[0];n++}}if(n!=V.length)return 0;for(i in O){z=g[O[i]];if(!z||~f.indexOf(z))return 1;f.push(z)}a=f[0].parentNode;if(!a)return 1;for(i in f)if(f[i].parentNode!=a)return 1;y=f.slice().sort(function(u,v){return u.compareDocumentPosition(v)&4?-1:1});for(i=0;i in f;i++){z=f[i];if(y[i]!=z){a.insertBefore(z,y[i]);y.splice(y.indexOf(z),1);y.splice(i,0,z)}}P.reordered=!0;return 1},F=function(){if(P.done)return;for(i=0;i in p;i++){t=p[i];if(!t)continue;try{m=D.querySelectorAll(t[0])}catch(_){p[i]=0;continue}if(m.length>1){U(t);p[i]=0}else if(m.length==1&&(!t[3]||t[3][0]!=m[0])){U(t);e=m[0];t[3]=[e,t[1],e.getAttribute(t[1])];e.setAttribute(t[1],t[2]);b.push(t[3])}}if(!q)q=R()},X=function(){if(P.done)return;P.done=!0;try{o.disconnect()}catch(_){}clearTimeout(T)},G=c.slots,C=s.slotConfig;for(i in G)if(G[i]&&G[i].target)A(G[i].target,S[i],G[i]);for(i in C){e=C[i]||{};l=e.locator;t=e.target;if(l){if(l.urlMatch&&!~L.pathname.indexOf(l.urlMatch))continue;t=l.id?'[id="'+Q(l.id)+'"]':l.dataAttr&&/^[\\w-]+$/.test(l.dataAttr.name)?"["+l.dataAttr.name+'="'+Q(l.dataAttr.value)+'"]':l.selector}if(t)A(t,S[i])}var o=new MutationObserver(F),T=setTimeout(X,3e3);o.observe(d,{childList:!0,subtree:!0});D.addEventListener("DOMContentLoaded",function(){F();X()});F();}catch(_){}})();`;
|
|
5
5
|
}
|
|
6
6
|
|
|
7
7
|
// src/install.ts
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var __sentientPreview=(()=>{var d=Object.defineProperty,j=Object.defineProperties,B=Object.getOwnPropertyDescriptor,H=Object.getOwnPropertyDescriptors,D=Object.getOwnPropertyNames,w=Object.getOwnPropertySymbols;var v=Object.prototype.hasOwnProperty,A=Object.prototype.propertyIsEnumerable;var x=(e,t,n)=>t in e?d(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,h=(e,t)=>{for(var n in t||(t={}))v.call(t,n)&&x(e,n,t[n]);if(w)for(var n of w(t))A.call(t,n)&&x(e,n,t[n]);return e},S=(e,t)=>j(e,H(t));var N=(e,t)=>{for(var n in t)d(e,n,{get:t[n],enumerable:!0})},L=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of D(t))!v.call(e,o)&&o!==n&&d(e,o,{get:()=>t[o],enumerable:!(r=B(t,o))||r.enumerable});return e};var G=e=>L(d({},"__esModule",{value:!0}),e);var J={};N(J,{parsePersonaPreview:()=>T,parsePreview:()=>R,runPreview:()=>F});var U="__snt_editor_token";function P(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(U):null}catch(e){return null}}function k(e){let t=null;try{let n=location.hash.slice(1),r=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(r){t=r[2];let o=n.slice(r.index+r[0].length);r[1]!="&"&&o[0]=="&"&&(o=r[1]+o.slice(1));let s=n.slice(0,r.index)+o;history.replaceState(history.state,"",s?"#"+s:location.pathname+location.search)}}catch(n){}return t}var z=5e3;function M(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})}var $={position:"fixed",bottom:"16px",zIndex:"2147483647",background:"#111827",color:"#fff",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"};async function F(e){let t=R(window.location.search);if(t)return await X(e,t),!0;let n=T(window.location.search);return n?(await Y(e,n),e.dbg("persona preview",n),!0):!1}function R(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(":"),s=o===-1?"":r.slice(0,o),i=o===-1?"":r.slice(o+1);if(!(!s||!i))if(i.includes("=")){let a={};for(let p of i.split(",")){let[l,c]=p.split("=");l&&c&&(a[l]=c)}Object.keys(a).length&&(n[s]=a)}else n[s]=i}return Object.keys(n).length?n:null}function T(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var E="sentient-persona-preview-banner";function C(e,t){var n;try{if(typeof document=="undefined"||document.getElementById(E))return;let r=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),o=document.createElement("div");o.id=E,o.setAttribute("role","status"),Object.assign(o.style,$,{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 s=document.createElement("span");s.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 a=new URL(window.location.href);a.searchParams.delete("sentient_persona"),window.location.href=a.pathname+a.search+a.hash}catch(a){}}),o.appendChild(s),o.appendChild(i),((n=document.body)!=null?n:document.documentElement).appendChild(o)}catch(r){}}function K(){var e;return(e=k("sentient_preview_token"))!=null?e:P()}function _(e,t){let n=e.cfg;return M(fetch(`${e.apiBase}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${n.apiKey}`},body:JSON.stringify(t)}).then(r=>r.ok?r.json():null).catch(()=>null),z)}async function X(e,t){var s;let n=e.cfg,r=(s=n.registry)!=null?s:Object.keys(n.slots).length===0,o=K();if(r){let i=await _(e,S(h({slotsFrom:"registry",includeDrafts:!0},o?{previewToken:o}:{}),{force:Object.fromEntries(Object.entries(t).filter(a=>typeof a[1]=="string"))}));if(!(i!=null&&i.slotConfig)){e.exposeGlobal(),e.dbg("preview mode: slot config unavailable \u2014 page left as-is");return}e.set({slotConfig:i.slotConfig,look:i})}e.set({slots:t,persona:null}),e.apply(),e.installSpaHooks(),e.exposeGlobal(),e.dbg("preview mode",t)}async function Y(e,t){var p,l,c,u,g,f,m,y,b;let n=e.cfg,r=(p=n.registry)!=null?p:Object.keys(n.slots).length===0,o=await _(e,r?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(n.slots).map(([O,I])=>({id:O,dims:I.dims}))});if(!o){e.exposeGlobal(),e.dbg("persona preview: explain unavailable \u2014 page left as-is");return}let s=o,i=(u=(c=(l=s.personaAttributes)==null?void 0:l.persona)!=null?c:s.persona)!=null?u:t,a=(f=(g=s.personaAttributes)==null?void 0:g.confidence)!=null?f:"high";e.set({slots:(m=s.slots)!=null?m:{},slotConfig:(y=s.slotConfig)!=null?y:null,look:s,persona:{persona:i,band:a},decided:!0}),e.apply(),e.installSpaHooks(),e.exposeGlobal(),s.recognized===!1?C(t,!0):C((b=s.personaDisplay)!=null?b:i)}return G(J);})();
|
package/dist/snippet.global.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
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);})();
|
|
1
|
+
"use strict";var SentientSnippet=(()=>{var Nt=Object.defineProperty,jo=Object.defineProperties,Go=Object.getOwnPropertyDescriptor,Fo=Object.getOwnPropertyDescriptors,Uo=Object.getOwnPropertyNames,cr=Object.getOwnPropertySymbols;var fr=Object.prototype.hasOwnProperty,zo=Object.prototype.propertyIsEnumerable;var dr=(e,t,n)=>t in e?Nt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||(t={}))fr.call(t,n)&&dr(e,n,t[n]);if(cr)for(var n of cr(t))zo.call(t,n)&&dr(e,n,t[n]);return e},Ke=(e,t)=>jo(e,Fo(t));var pr=(e,t)=>()=>(e&&(t=e(e=0)),t);var gr=(e,t)=>{for(var n in t)Nt(e,n,{get:t[n],enumerable:!0})},Wo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Uo(t))!fr.call(e,o)&&o!==n&&Nt(e,o,{get:()=>t[o],enumerable:!(r=Go(t,o))||r.enumerable});return e};var Vo=e=>Wo(Nt({},"__esModule",{value:!0}),e);var ei,ti,ni,Sr,ri,oi,br,F,qe,kn=pr(()=>{"use strict";ei=Object.defineProperty,ti=Object.defineProperties,ni=Object.getOwnPropertyDescriptors,Sr=Object.getOwnPropertySymbols,ri=Object.prototype.hasOwnProperty,oi=Object.prototype.propertyIsEnumerable,br=(e,t,n)=>t in e?ei(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,F=(e,t)=>{for(var n in t||(t={}))ri.call(t,n)&&br(e,n,t[n]);if(Sr)for(var n of Sr(t))oi.call(t,n)&&br(e,n,t[n]);return e},qe=(e,t)=>ti(e,ni(t))});var Tr={};gr(Tr,{LOCAL_ENGINE_AVAILABLE:()=>li,createLocalEngine:()=>ui});function ui(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var li,Lr=pr(()=>{"use strict";li=!1});var As={};gr(As,{applyPersonaAttributes:()=>en,applyRegistrySlots:()=>rn,applySlotArms:()=>nn,applySlotAttributes:()=>tn,consentWatcher:()=>Xe,parseSnippetConfig:()=>Jt,planReorder:()=>sn,reapply:()=>It,run:()=>Mo,version:()=>_t});function ze(e){return e?`_${e.slice(0,12)}`:""}var We="_snt_uid";function gt(e){return`${We}${ze(e)}`}var bn="__sntForgetGen",Ho=()=>{try{return window[bn]}catch(e){return}};function Dt(e){var t,n;try{let r=window,o=(t=r[bn])!=null?t:r[bn]={};o[e]=((n=o[e])!=null?n:0)+1}catch(r){}}function fe(e){var t,n;return(n=(t=Ho())==null?void 0:t[e])!=null?n:0}var rt="_snt_snap:",qo=["low","medium","high"];function ot(e){try{let t=localStorage.getItem(rt+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"||!qo.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(Date.now()-n.savedAt<2592e6)||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig)))return null;let 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(rt+e,JSON.stringify(t))}catch(n){}}function je(e){if(typeof AbortController!="function")return{clear:()=>{}};let t=new AbortController,n=setTimeout(()=>t.abort(),e);return{signal:t.signal,clear:()=>clearTimeout(n)}}function En(e,t){return new Promise(n=>{let r=setTimeout(()=>n(!1),t),o=()=>{clearTimeout(r),n(!0)};e.then(o,o)})}function Ve(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Mt(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 mr(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 wn(e,t,n){try{let r=(()=>{try{let s=localStorage.getItem(n);if(!s)return[];let a=JSON.parse(s);return Array.isArray(a)?a:[]}catch(s){return[]}})(),o=new Map;for(let s of r)o.set(s.id,s);for(let s of e)o.set(s.id,s);localStorage.setItem(n,JSON.stringify([...o.values()].slice(-t)))}catch(r){}}function hr(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),s=r.filter(a=>!o.has(a.id));if(s.length===r.length)return;s.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(s))}catch(n){}}var Jo=500,Yo=56*1024;function Bt(e){return`_snt_retry_${e.slice(0,12)}`}var Xo={push:()=>{},flush:()=>{},destroy:()=>{}};function yr(e){var t,n,r;if(typeof window=="undefined")return Xo;let o=(t=e.flushIntervalMs)!=null?t:5e3,s=(n=e.maxBatchSize)!=null?n:20,a=(r=e.maxRetrySize)!=null?r:100,u=e.ingestUrl,i=e.apiKey,c=Bt(i),l=!1,p=fe(i),h=(...O)=>{!l&&fe(i)===p&&wn(...O)},b=[],w=new Set,S=[],K=O=>{for(let B of O)L.delete(B),!w.has(B)&&(w.add(B),S.push(B));for(;S.length>Jo;){let B=S.shift();B&&w.delete(B)}hr(O,c)},L=new Set,D=()=>{for(;b.length>a;){let O=b.shift();O&&L.delete(O.id)}},_=O=>{w.has(O.id)||L.has(O.id)||(L.add(O.id),b.push(O),D())},A=O=>{for(let B of O)w.has(B.id)||(L.add(B.id),b.push(B));D()},x=mr(c,a);for(let O of x)_(O);let P=0,m=0,v=(O,B=!0)=>{if(O.length===0)return;let ne=JSON.stringify(O),ue=O.map(Me=>Me.id),Q,we=je(15e3);try{Q=fetch(u,{method:"POST",keepalive:!0,signal:we.signal,body:ne,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})}catch(Me){h(O,a,c),A(O),m++,P=Date.now()+Ve(m);return}Promise.resolve(Q).then(we.clear,we.clear);let ee=Me=>{if(Mt(Me)!=="retry"){if(!Me.ok&&B){let Be=O.filter(Le=>Le.eventType!=="pageview");if(Be.length>0&&Be.length<O.length){K(O.filter(Le=>Le.eventType==="pageview").map(Le=>Le.id)),v(Be,!1);return}}K(ue),m=0,P=0;return}h(O,a,c),A(O),m++,P=Date.now()+Ve(m)};Q&&typeof Q.then=="function"?Q.then(ee).catch(()=>{h(O,a,c),A(O),m++,P=Date.now()+Ve(m)}):ee(Q)},d=typeof TextEncoder!="undefined"?new TextEncoder:null,g=O=>d?d.encode(O).length:O.length,I=O=>{let B=[],ne=2;for(let ue of O){let Q=g(JSON.stringify(ue))+1;if(B.length>0&&ne+Q>Yo||B.length>=s)break;B.push(ue),ne+=Q}return B},M=()=>{try{if(Date.now()<P)return;for(;b.length>0&&!(Date.now()<P);){let O=b.filter(ne=>!w.has(ne.id));if(b.length=0,O.length===0)break;let B=I(O);if(B.length===0)break;B.length<O.length&&b.push(...O.slice(B.length)),v(B)}}catch(O){}},q=!0,J=null;J=setInterval(()=>{q&&M()},o);let Y=()=>{document.visibilityState==="hidden"&&M()},xe=()=>{M()};return document.addEventListener("visibilitychange",Y),window.addEventListener("pagehide",xe),{push(O){_(O),b.length>=s&&M()},flush:M,destroy(O){O!=null&&O.forget&&(l=!0),q=!1,J!==null&&(clearInterval(J),J=null),document.removeEventListener("visibilitychange",Y),window.removeEventListener("pagehide",xe),M()}}}var Zo=200;function $t(e){return`_snt_goal_retry_${e.slice(0,12)}`}var Qo={send:()=>{},flush:()=>{},destroy:()=>{}};function vr(e){var t,n,r;if(typeof window=="undefined")return Qo;let o=(t=e.flushIntervalMs)!=null?t:5e3,s=(n=e.maxRetrySize)!=null?n:100,a=(r=e.maxPerFlush)!=null?r:5,u=$t(e.apiKey),i=!1,c=fe(e.apiKey),l=(...g)=>{!i&&fe(e.apiKey)===c&&wn(...g)},p=[],h=new Set,b=new Set,w=[],S=0,K=0,L=!1,D=g=>{for(h.delete(g.id),b.has(g.id)||(b.add(g.id),w.push(g.id));w.length>Zo;){let I=w.shift();I&&b.delete(I)}hr([g.id],u)},_=g=>{l([g],s,u),!b.has(g.id)&&!h.has(g.id)&&(h.add(g.id),p.push(g)),Date.now()>=S&&(K++,S=Date.now()+Ve(K))},A=g=>{let I,M=je(15e3);try{I=fetch(e.url,{method:"POST",keepalive:!0,signal:M.signal,body:g.body,headers:e.headers})}catch(J){_(g);return}let q=J=>{var Y;let xe=Mt(J);if(xe==="retry"){_(g);return}xe==="dropped"&&((Y=e.onDrop)==null||Y.call(e,g,J.status)),D(g),K=0,S=0};Promise.resolve(I).then(M.clear,M.clear),I&&typeof I.then=="function"?I.then(q).catch(()=>_(g)):q(I)},x=()=>{try{if(L||Date.now()<S)return;let g=0;for(;p.length>0&&g<a&&!(Date.now()<S);){let I=p.shift();h.delete(I.id),!b.has(I.id)&&(g++,A(I))}}catch(g){}},P=mr(u,s);for(let g of P)h.has(g.id)||(h.add(g.id),p.push(g));P.length>0&&wn(P,s,u);let m=setInterval(x,o),v=()=>{document.visibilityState==="hidden"&&x()},d=()=>x();return document.addEventListener("visibilitychange",v),window.addEventListener("pagehide",d),{send(g){if(L){b.has(g.id)||l([g],s,u);return}if(!(b.has(g.id)||h.has(g.id))){if(Date.now()<S){l([g],s,u),h.add(g.id),p.push(g);return}A(g)}},flush:x,destroy(g){g!=null&&g.forget&&(i=!0),clearInterval(m),document.removeEventListener("visibilitychange",v),window.removeEventListener("pagehide",d),x(),L=!0}}}function it(e){if(typeof window=="undefined"||!e)return!1;Dt(e);let t=!1,n=gt(e);try{if(new RegExp(`(?:^|; )${n}=`).test(document.cookie)){let a=location.protocol==="https:"?"; Secure":"";document.cookie=`${n}=; max-age=0; SameSite=lax; path=/${a}`,t=!0}}catch(a){}let r=ze(e),o=[n,"_snt_graph_edges",rt+e,Bt(e),$t(e),`_snt_graph_nodes${r}`],s=[`_snt_asgn${r}_`];for(let a of["localStorage","sessionStorage"])try{let u=window[a];for(let i of o)u.getItem(i)!==null&&(u.removeItem(i),t=!0);for(let i=u.length-1;i>=0;i--){let c=u.key(i);c&&s.some(l=>c.startsWith(l))&&(u.removeItem(c),t=!0)}}catch(u){}try{(new RegExp(`(?:^|; )${We}=[^;]`).test(document.cookie)||localStorage.getItem(We)!==null||sessionStorage.getItem(We)!==null)&&localStorage.setItem(`${We}_tomb${r}`,"1")}catch(a){}return t}kn();function Kt(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function wr(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 _n(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 Kt(e.baseline);if(typeof e.baseline=="string")return e.baseline;let o={};for(let[s,a]of Object.entries((n=e.dims)!=null?n:{}))o[s]=(r=a[0])!=null?r:"";return Kt(o)}function Er(e,t){var n,r;return e.dims!=null?(r=(n=wr(t))!=null?n:wr(_n(e)))!=null?r:{}:t}function Je(e){return e>=.3?e<.7?"medium":"high":"low"}var ii=["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 kr(e){return si(e)!==null}function si(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=ii.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function _r(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 Ar(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 xr(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var ai=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Cr(e){let t={},n={};try{let r=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([o,s])=>{let a=Array.isArray(s)?s[0]:s;return a===void 0?[]:[[o,a]]});for(let[o,s]of r)o.startsWith("utm_")?o in t||(t[o]=s):ai.includes(o)&&(o in n||(n[o]=s))}catch(r){}return{utmParams:t,clickIds:n}}function Or(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function An(e){return F(F(F({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 xn(e){let t=An(e);return Er(t,_n(t))}function Ir(e){return typeof e=="string"?e:Kt(e)}kn();var Pn;function zt(e){Pn=typeof e=="string"&&e!==""?e:void 0}function Mr(e=document){if(Pn)return Pn;try{let t=e.querySelector("script[nonce]");return(t==null?void 0:t.nonce)||(t==null?void 0:t.getAttribute("nonce"))||void 0}catch(t){return}}function Ge(e,t=document){let n=Mr(t);return n&&e.setAttribute("nonce",n),e}function Br(){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 Pr="_snt_uid",ci=365,st="_snt_uid";function di(){return Br()}function Cn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Dn(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function fi(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${Dn()}`}catch(r){}}function jt(e){try{return localStorage.getItem(e)}catch(t){return null}}function Rr(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function On(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function pi(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function gi(e){try{sessionStorage.removeItem(e)}catch(t){}}function mi(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${Dn()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function hi(e){try{localStorage.removeItem(e)}catch(t){}}function yi(e){try{document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${Dn()}`}catch(t){}}var vi={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function $r(e){var t,n,r,o,s,a,u;if(typeof window=="undefined")return vi;let i=ze(e==null?void 0:e.apiKey),c=(t=e==null?void 0:e.cookieName)!=null?t:gt(e==null?void 0:e.apiKey),l=`${st}${i}`,p=`${st}_tomb${i}`,h=((n=e==null?void 0:e.cookieTTLDays)!=null?n:ci)*24*60*60,b=A=>A&&A.length>0?A:null,w=()=>{var A,x;return i&&!(e!=null&&e.cookieName)&&jt(p)===null?(x=(A=b(Cn(Pr)))!=null?A:b(jt(st)))!=null?x:b(On(st)):null},S=(u=(a=(s=(o=(r=b(Cn(c)))!=null?r:b(jt(l)))!=null?o:b(On(l)))!=null?s:w())!=null?a:b(e==null?void 0:e.ssrSessionId))!=null?u:di();fi(c,S,h);let K=Rr(l,S),L=mi(c),D=K?!1:pi(l,S),_=!K&&!L&&!D;return{getSessionId:()=>S,isEphemeral:()=>_,destroy:()=>{S=null,yi(c),hi(l),gi(l),i&&!(e!=null&&e.cookieName)&&(Cn(Pr)!==null||jt(st)!==null||On(st)!==null)&&Rr(p,"1")}}}var Si=1800*1e3;function Gt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function bi(e=Si,t){let n=new Map,r=`_snt_asgn${ze(t)}_`,o=(i,c)=>`${r}${encodeURIComponent(i)}:${encodeURIComponent(c)}`,s=i=>{let c=i.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(p){return null}},a=()=>{try{let i=[];for(let c=0;c<localStorage.length;c++){let l=localStorage.key(c);l!=null&&l.startsWith(r)&&i.push(l)}return i}catch(i){return[]}},u=i=>i.assignedAt+(i.ttlMs&&i.ttlMs>0?i.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let i of a())try{let c=localStorage.getItem(i);if(!c)continue;let l=JSON.parse(c);if(u(l)){localStorage.removeItem(i);continue}let p=s(i);if(!p)continue;n.set(Gt(p.componentId,p.segment),l)}catch(c){}})(),{get(i,c){let l=n.get(Gt(i,c));return l?u(l)?(n.delete(Gt(i,c)),null):l:null},set(i,c,l){let p=Gt(i,c);n.set(p,l);try{localStorage.setItem(o(i,c),JSON.stringify(l))}catch(h){}},clear(){n.clear();for(let i of a())try{localStorage.removeItem(i)}catch(c){}}}}var Rn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Kr="[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,Ft=!1;function wi(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function Ei(e){var t;let n=$r({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=wi(),s=Promise.resolve().then(()=>(Lr(),Tr)).then(l=>{let p=l;return p.LOCAL_ENGINE_AVAILABLE?(Nr||(Nr=!0,console.info(Kr)),p):(Ft||(Ft=!0,console.error(Rn)),null)}).catch(()=>(Ft||(Ft=!0,console.error(Rn)),null)),a=null,u={low:.15,medium:.5,high:.85},i=(()=>{var l;if(e.initialPersona)return F({},e.initialPersona);let p=ot(e.apiKey||"local");return p?{persona:p.persona,confidence:(l=u[p.band])!=null?l:.15}:null})();function c(l){let p=document.documentElement;p.dataset.sentientPersona===void 0&&(p.dataset.sentientPersona=l.persona,p.dataset.sentientConfidence=Je(l.confidence))}return{isLocal:!0,async decide(l){var p,h,b;let w=await s;if(!w)return null;let S=w.createLocalEngine({sessionId:r,forcedPersona:o}).decide(l);return a=qe(F({},S),{layoutOrder:(h=(p=S.layoutOrder)!=null?p:a==null?void 0:a.layoutOrder)!=null?h:null,slots:F(F({},(b=a==null?void 0:a.slots)!=null?b:{}),S.slots)}),He(e.apiKey||"local",{v:1,persona:a.persona,band:Je(a.confidence),slots:a.slots,layoutOrder:a.layoutOrder,savedAt:Date.now()}),c(S),S},getSlotResult(l){var p,h,b;return(b=(h=a==null?void 0:a.slots[l])!=null?h:(p=e.initialSlots)==null?void 0:p[l])!=null?b:null},getSlotConfig(l){var p,h;return(h=(p=e.initialSlotConfig)==null?void 0:p[l])!=null?h:null},getSitePalette(){var l;return(l=e.initialPalette)!=null?l:null},reportSlots(){},getPersona(){let l=a!=null?a:i;return l?{persona:l.persona,confidence:l.confidence,band:Je(l.confidence)}:null},async assign(l,p){var h;let b=await s;return!b||!p||p.length===0?p!=null&&p[0]?{variantId:p[0],assignmentTtlMs:0}:null:{variantId:(h=b.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:l,variantIds:p}]}).assignments[l])!=null?h:p[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>n.destroy()}}var Wt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function In(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function Mn(e,t){if(e===void 0||!Wt.test(e))return!1;if(e==="*")return!0;let n=In(t);if(e.endsWith("/*")){let r=In(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===In(e)}function ht(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(ht):!1}var Dr="sentient-reveal",at="sentient-revealed",jr=240,Tn=!1;function ki(e){if(Tn||e.getElementById(Dr)){Tn=!0;return}let t=Ge(e.createElement("style"),e);t.id=Dr,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${at}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${at}{animation:${at} ${jr}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),Tn=!0}function Bn(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;ki(r),e.classList.remove(at),e.offsetWidth,e.classList.add(at);let o=()=>{e.classList.remove(at),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function $n(e,t,n,r){let o=[];{let s=!1,a=[],u=()=>{if(s)return;let i=Date.now();for(a.push(i);a.length>0&&i-a[0]>500;)a.shift();a.length>=3&&(s=!0,e("rage_click"))};t.addEventListener("click",u),o.push(()=>t.removeEventListener("click",u))}{let s=!1,a=u=>{if(s||!(u.target instanceof Node)||!t.contains(u.target)&&t!==u.target)return;s=!0;let i=typeof window!="undefined"?window.getSelection():null,c=i?i.toString().length:0;e("text_copy",{selectionLength:c})};document.addEventListener("copy",a),o.push(()=>document.removeEventListener("copy",a))}{let s=!1,a=!1,u=null,i=()=>{u!==null&&(clearTimeout(u),u=null)},c=()=>{s||!a||(i(),u=setTimeout(()=>{!s&&a&&(s=!0,e("scroll_hesitation"))},3e3))},l=()=>{i(),c()},p=b=>{for(let w of b)a=w.intersectionRatio>.3,a?c():i()},h=new IntersectionObserver(p,{threshold:[.3]});h.observe(t),window.addEventListener("scroll",l,{passive:!0}),o.push(()=>{h.disconnect(),window.removeEventListener("scroll",l),i()})}if((r==null?void 0:r.tabLoss)!==!1){let s=!1,a=n!=null?n:Date.now(),u=()=>{if(s||document.visibilityState!=="hidden")return;let i=Date.now()-a;i<15e3&&(s=!0,e("tab_loss",{timeOnPage:i}))};document.addEventListener("visibilitychange",u),o.push(()=>document.removeEventListener("visibilitychange",u))}return()=>{for(let s of o)s()}}function _i(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Gr="https://api.sentient-ui.com/v1/events",pe=new Map,Fr=null;function Ai(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var xi=3;function Ln(){return Br()}function Ut(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Ci(){let e=new WeakMap,t=new Map,n=!1,r=(u,i,c)=>{let l=u.get(i);return c===null?l?!0:(u.set(i,new Set),!1):l?l.has(c)?!0:(l.add(c),!1):(u.set(i,new Set([c])),!1)},o=typeof window!="undefined"&&"event"in window,s=()=>{if(!o)return;let u=window.event;return typeof Event=="function"&&u instanceof Event?u:void 0},a=()=>{if(o){Promise.resolve().then(()=>{n=!1,t.clear()});return}let u=!1,i=()=>{u||(u=!0,n=!1,t.clear())};if(setTimeout(i,0),typeof MessageChannel=="function"){let c=new MessageChannel;c.port1.onmessage=()=>{c.port1.close(),c.port2.close(),i()},c.port2.postMessage(0)}};return{firedBefore(u,i){let c=s();if(c){let p=e.get(c);return p||(p=new Map,e.set(c,p)),r(p,u,i)}let l=r(t,u,i);return!l&&!n&&(n=!0,a()),l}}}var Ur=new Set;function Oi(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,s,a=()=>{if(o)return;let c=Ut();!c||c===s||(s=c,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${c}`))},u=[];for(let c of["pushState","replaceState"]){let l=r[c],p=function(...h){let b=l.apply(this,h);return a(),b};r[c]=p,u.push([c,l,p])}window.addEventListener("popstate",a);let i=Ut();return i&&Ur.has(`${t}:${i}`)?s=i:a(),()=>{if(!o){o=!0,window.removeEventListener("popstate",a);for(let[c,l,p]of u)r[c]===p&&(r[c]=l)}}}var mt={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 Ii(){try{return Cr(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function zr(e){return e.replace(/\/events\/?$/,"")}function Ye(){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 Kn(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=pe.get(n);if(!r){console.warn("[sentient] grantConsent() called before init()");return}let{config:o,upgrade:s,reinit:a}=r;if(!s){r.upgradeBlockedReason&&console.warn(r.upgradeBlockedReason);return}if(o.respectDoNotTrack!==!1&&Ye())return;let u=(a!=null?a:yt)(qe(F({},o),{consent:!0}));s(u);let i=(t=pe.get(n))==null?void 0:t.dispose;pe.set(n,{config:qe(F({},o),{consent:!0}),upgrade:null,dispose:i})}function Ti(e,t){var n;let r=e.preConsentBehavior==="statistical_winner",o=zr((n=e.ingestUrl)!=null?n:Gr),s={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},a=new Map,u=new Map,i={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(m,v,d){if(!r)return Promise.resolve(null);let g=a.get(m);return g?Promise.resolve(g):Nn(u,m,async()=>{try{let I=new URLSearchParams({componentId:m});for(let Y of v!=null?v:[])I.append("variantIds[]",Y);let M=je(5e3),q;try{let Y=await fetch(`${o}/winner?${I.toString()}`,{headers:s,signal:M.signal});if(!Y.ok)return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null;q=await Y.json()}finally{M.clear()}let J={variantId:q.variantId,assignmentTtlMs:0};return a.set(m,J),J}catch(I){return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},c=!1,l=new Set,p=[],h=[],b=[],w=()=>{for(let[,,m]of b.splice(0))m(null);S.length=0},S=[],K=!1,L=()=>{if(c)return;K=!0;let m=pe.get(e.apiKey);(m==null?void 0:m.upgrade)===P&&pe.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},D=[],_=()=>{setTimeout(()=>{var m;try{(m=D.shift())==null||m(i)}catch(v){}D.length&&_()})},A=m=>{c?D.length?D.push(m):m(i):!t&&!K&&S.length<100?S.push(m):K&&e.debug&&console.warn("[sentient] goal dropped: client released")},x={get gated(){return!c&&!t},get released(){return K&&!c},takeHeld:()=>S.splice(0),track:m=>i.track(m),goal:((m,v,d,g)=>A(I=>I.goal(m,v,d,g))),componentGoal:(m,v,d)=>i.componentGoal(m,v,d),identify:m=>i.identify(m),getAssignment:(m,v)=>i.getAssignment(m,v),assign:(m,v,d,g)=>i.assign(m,v,d,g),decide:m=>c?i.decide(m):K||t?Promise.resolve(null):new Promise(v=>b.push([m,Ie(),v])),getSlotResult:m=>i.getSlotResult(m),isSlotDecided:m=>{var v,d;return(d=(v=i.isSlotDecided)==null?void 0:v.call(i,m))!=null?d:!0},getSlotConfig:m=>i.getSlotConfig(m),getSitePalette:()=>i.getSitePalette(),getStyleVocabulary:()=>{var m,v;return(v=(m=i.getStyleVocabulary)==null?void 0:m.call(i))!=null?v:null},reportSlots:(m,v,d,g)=>i.reportSlots(m,v,d,g),reportSkeleton:(m,v)=>{var d;return(d=i.reportSkeleton)==null?void 0:d.call(i,m,v)},reportDrift:(m,v,d,g)=>{var I;return(I=i.reportDrift)==null?void 0:I.call(i,m,v,d,g)},requestSlots:(m,v,d)=>{var g;return c?(g=i.requestSlots)==null?void 0:g.call(i,m,v,d):p.push([m,v,d])},decideSlots:m=>{var v;return c?(v=i.decideSlots)==null?void 0:v.call(i,m):h.push(...m)},cancelSlots:m=>{var v;if(c)return(v=i.cancelSlots)==null?void 0:v.call(i,m);let d=new Set(m);for(let g of p)g[0]=g[0].filter(I=>!d.has(I));h=h.filter(g=>!d.has(g.id))},onSlotsChanged:m=>(l.add(m),()=>{l.delete(m)}),getPersona:()=>i.getPersona(),fetchWeights:()=>i.fetchWeights(),getGraph:()=>i.getGraph(),flush:()=>i.flush(),dispose:()=>(L(),w(),i.dispose()),destroy:()=>(L(),w(),c?i.destroy():it(e.apiKey))};function P(m){var v,d,g;i=m,c=!0,S.length&&(D.push(...S.splice(0)),_());let I=Ie();for(let[M,q,J]of b.splice(0))q!==I?J(null):m.decide(M).then(J,()=>J(null));(v=m.onSlotsChanged)==null||v.call(m,()=>l.forEach(M=>M()));for(let[M,q,J]of p.splice(0))M.length>0&&((d=m.requestSlots)==null||d.call(m,M,q,J));h.length>0&&((g=m.decideSlots)==null||g.call(m,h.splice(0)))}return{proxy:x,setInner:P}}function Ie(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Nn(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 yt(e){var t,n,r,o,s,a,u,i,c,l;if(typeof window=="undefined")return mt;e.nonce&&zt(e.nonce),Fr=e.apiKey||"local";let p=pe.get(e.apiKey||"local");if(p!=null&&p.dispose)try{p.dispose()}catch(f){}let h=e.respectDoNotTrack!==!1&&Ye(),b=e.consent===!1||h,w=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!w&&e.localMode!==!1)return pe.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."}),b?mt:Ei(e);if(b){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."),pe.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."}),mt;let{proxy:f,setInner:y}=Ti(e,h);return pe.set(e.apiKey,{config:e,upgrade:h?null:y}),f}if(!e.apiKey||!e.apiKey.startsWith("pk_"))return console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),mt;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),mt;let S=(t=e.ingestUrl)!=null?t:Gr,K=Date.now(),L=$r({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),D=bi(void 0,e.apiKey),_=!1,A=fe(e.apiKey),x=()=>!_&&fe(e.apiKey)===A,P=qe(F({},D),{set:(...f)=>{x()&&D.set(...f)}}),m=yr({ingestUrl:S,apiKey:e.apiKey}),v=zr(S),d={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},g=new Set,I=vr({url:`${v}/goals`,apiKey:e.apiKey,headers:d,onDrop:(f,y)=>{if(!e.debug){if(g.has(y))return;g.add(y)}console.warn(`[sentient] goal dropped (HTTP ${y}) \u2014 this will not be retried. `+(y===400?"The session was not found: call init() and let the session upsert complete before firing goals.":y===401||y===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),f)}}),M=_r((n=navigator.userAgent)!=null?n:""),q=window.location.origin,J=Ar((r=document.referrer)!=null?r:"",q),Y=(o=e.sessionSegment)!=null?o:`${M}:${J}`,xe=new Map,O=new Map,B=new Map,ne=new Set,ue=new Map,Q=null,we=null,ee=null,Me=new Set,Be=new Set,Le=new Map,gn=new Map,er=new Set,tr=new Set,nr=new Set,mn=null,Tt=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,rr=new Set,Lt=new Set,Pt=new Set,dt=new Map,hn=null,Rt=new Set,ft=new Map,yn=null,Bo=2,or=new Map,Ee=!1,ir=(f,y,N)=>{var z;let j=new Set,E=1;for(let C of f){y.delete(C);let T=((z=or.get(C))!=null?z:0)+1;or.set(C,T),T<=Bo&&(j.add(C),T>E&&(E=T))}j.size>0&&setTimeout(()=>{Ee||N(j)},Ve(E))},vn=f=>{for(let y of f)B.has(y.id)||B.set(y.id,xn(y))};if(e.initialSlots)for(let[f,y]of Object.entries(e.initialSlots))B.set(f,y),ne.add(f);if(e.initialSlotConfig)for(let[f,y]of Object.entries(e.initialSlotConfig))ue.set(f,y);e.initialPalette&&(Q=e.initialPalette),e.initialVocabulary&&(we=e.initialVocabulary);let Ce=ot(e.apiKey);if(Ce){for(let[f,y]of Object.entries(Ce.slots))B.has(f)||B.set(f,y);for(let[f,y]of Object.entries((s=Ce.slotConfig)!=null?s:{}))ue.has(f)||ue.set(f,y);!Q&&Ce.palette&&(Q=Ce.palette),!we&&Ce.vocabulary&&(we=Ce.vocabulary)}let sr={low:.15,medium:.5,high:.85};if(e.initialPersona)ee=F({},e.initialPersona);else{let f=document.documentElement.dataset;f.sentientPersona?ee={persona:f.sentientPersona,confidence:(u=sr[(a=f.sentientConfidence)!=null?a:"low"])!=null?u:.15}:Ce&&(ee={persona:Ce.persona,confidence:(i=sr[Ce.band])!=null?i:.15})}if(e.initialAssignments)for(let[f,y]of Object.entries(e.initialAssignments))P.set(f,Y,{variantId:y,assignedAt:Date.now(),segment:Y,confidence:1});let $e=Promise.resolve(),ar=L.getSessionId();if(ar){let f=xr((c=document.referrer)!=null?c:""),{utmParams:y,clickIds:N}=Ii(),z=F(F(F(F({sessionId:ar,deviceClass:M,trafficSource:J,referrerDomain:f,utmParams:y,clickIds:N,timeOfDay:Or(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:L.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||kr((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}:{}),j=async()=>{for(let E=0;;E++){if(Ee||!x())return;let C=je(5e3);try{let T=await fetch(`${v}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(z),headers:d,signal:C.signal});if(T.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(T.ok||Mt(T)==="dropped")return}catch(T){}finally{C.clear()}if(E>=xi){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(T=>setTimeout(T,Ve(E+1)))}};try{$e=j()}catch(E){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:m});let $o=Ci(),pt=null,Sn=!1,se={goal(f,y={},N=1,z=0){var j,E,C,T,V,G,te;let re=L.getSessionId();if(!re||Ee||!x())return;let W=Ai(y)?y:{metadata:y},ge=[f,(j=W.externalId)!=null?j:"",(E=W.stepIndex)!=null?E:z,(C=W.weight)!=null?C:N].join("\0"),ke=W.value!==void 0?`${W.value}\0${(T=W.currency)!=null?T:""}`:null;if($o.firedBefore(ge,ke)){e.debug&&console.log(`[sentient] goal("${f}") already recorded for this action \u2014 not sent twice`);return}let de=Ln(),ae={sessionId:re,name:f,metadata:(V=W.metadata)!=null?V:{},weight:(G=W.weight)!=null?G:N,stepIndex:(te=W.stepIndex)!=null?te:z,goalId:de,value:W.value,currency:W.currency,externalId:W.externalId};e.debug&&console.log("[sentient] goal",ae);let $={id:de,body:JSON.stringify(ae)};$e.then(()=>I.send($))},componentGoal(f,y,N){var z,j,E;let C=L.getSessionId();if(!C||Ee||!x())return;let T=P.get(f,Y),V=T?null:(z=B.get(f))!=null?z:null;if(!T&&V===null){e.debug&&console.warn(`[sentient] componentGoal("${f}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!T&&!ne.has(f)){e.debug&&console.warn(`[sentient] componentGoal("${f}"): slot not decided this session \u2014 not attributed`);return}let G=T?T.variantId:Ir(V),te={id:Ln(),sessionId:C,projectId:e.apiKey,componentId:f,variantId:G,eventType:"goal_achieved",goalType:y,payload:F({reward:(j=N==null?void 0:N.reward)!=null?j:1,goalValue:N==null?void 0:N.value,currency:N==null?void 0:N.currency},(E=N==null?void 0:N.metadata)!=null?E:{}),timestamp:Date.now(),timeInSession:Date.now()-K,path:Ut()};e.debug&&console.log("[sentient] componentGoal",te),$e.then(()=>{!Ee&&x()&&m.push(te)})},identify(f){let y=L.getSessionId();!y||Ee||!x()||$e.then(()=>{fetch(`${v}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:y,userId:f,ephemeral:L.isEphemeral()}),headers:d}).catch(()=>{})})},track(f){let y=L.getSessionId();if(!y||Ee||!x()||f.eventType==="variant_assigned"&&B.get(f.componentId)!==void 0&&!ne.has(f.componentId)&&!P.get(f.componentId,Y))return;let N=qe(F({path:Ut()},f),{id:Ln(),sessionId:y,timestamp:Date.now(),timeInSession:Date.now()-K});e.debug&&console.log("[sentient] track",N),$e.then(()=>m.push(N))},getAssignment(f,y){return P.get(f,y)},async assign(f,y,N,z){let j=L.getSessionId();if(!j)return null;let E=P.get(f,Y);if(E&&(y!=null&&y.length||E.content!==void 0)){let C=E.ttlMs&&E.ttlMs>0?Math.max(0,E.assignedAt+E.ttlMs-Date.now()):0;return{variantId:E.variantId,assignmentTtlMs:C,content:E.content}}return Nn(xe,f,async()=>{if(!await En($e,2500)||Ee||!x())return null;let C=je(3e4);try{let T={sessionId:j,componentId:f,variantIds:y};z!==void 0?T.agentDataByVariant=z:N!==void 0&&(T.agentData=N);let V=await fetch(`${v}/assign`,{method:"POST",body:JSON.stringify(T),headers:d,signal:C.signal});if(!V.ok)return null;let G=await V.json();return P.set(f,Y,F({variantId:G.variantId,assignedAt:Date.now(),segment:Y,confidence:1,content:G.content},G.assignmentTtlMs&&G.assignmentTtlMs>0?{ttlMs:G.assignmentTtlMs}:{})),G}catch(T){return null}finally{C.clear()}})},async decide(f){var y,N;let z=L.getSessionId();if(!z)return null;let j=(y=f.slots)!=null?y:[],E={sessionId:z};f.sections&&f.sections.length>0&&(E.sections=f.sections.map(T=>({id:T}))),E.components=(N=f.components)!=null?N:[],j.length>0&&(E.slots=j.map(An)),f.slotsFrom==="registry"&&(E.slotsFrom="registry",f.registrySlotIds&&(E.registrySlotIds=f.registrySlotIds),f.bootstrap===!1&&(E.bootstrap=!1),f.render&&Object.keys(f.render).length>0&&(E.render=f.render)),f.v&&(E.v=f.v),typeof f.pp=="number"&&(E.pp=f.pp),e.persona&&(E.persona=e.persona);let C=JSON.stringify(E);return Nn(O,C,async()=>{var T,V,G,te,re,W,ge,ke;if(!await En($e,2500)||Ee||!x())return vn(j),null;let de=je(3e4);try{let ae=await fetch(`${v}/decide`,{method:"POST",body:C,headers:d,signal:de.signal});if(!ae.ok)return vn(j),null;let $=await ae.json(),me={};for(let X of j){let Oe=(T=$.slots)==null?void 0:T[X.id];if(Oe!==void 0){me[X.id]=Oe,B.set(X.id,Oe),ne.add(X.id);continue}let lr=B.get(X.id);if(lr!==void 0)me[X.id]=lr;else{let ur=xn(X);me[X.id]=ur,B.set(X.id,ur)}}if($.slots)for(let[X,Oe]of Object.entries($.slots))X in me||(me[X]=Oe,B.set(X,Oe),ne.add(X));let Ko=ee!=null&&ee.persona!=="unknown";$.persona&&!($.persona==="unknown"&&Ko)?ee={persona:$.persona,confidence:(V=$.confidence)!=null?V:0}:ee||(ee={persona:"unknown",confidence:0});for(let[X,Oe]of Object.entries((G=$.assignments)!=null?G:{}))P.set(X,Y,{variantId:Oe,assignedAt:Date.now(),segment:Y,confidence:1});if($.slotConfig)for(let[X,Oe]of Object.entries($.slotConfig))ue.set(X,Oe);$.palette&&(Q=$.palette),$.vocabulary&&(we=$.vocabulary);for(let X of(te=f.registrySlotIds)!=null?te:[])(re=$.slotConfig)!=null&&re[X]||(ue.delete(X),B.delete(X),ne.delete(X));return x()&&He(e.apiKey,F(F(F({v:1,persona:ee.persona,band:Je(ee.confidence),slots:Object.fromEntries(B),layoutOrder:(W=$.layoutOrder)!=null?W:null,savedAt:Date.now()},ue.size>0?{slotConfig:Object.fromEntries(ue)}:{}),Q?{palette:Q}:{}),we?{vocabulary:we}:{})),F(F(F(F(F({layoutOrder:(ge=$.layoutOrder)!=null?ge:null,assignments:(ke=$.assignments)!=null?ke:{},slots:me,persona:ee.persona,confidence:ee.confidence},$.slotConfig?{slotConfig:$.slotConfig}:{}),$.goals?{goals:$.goals}:{}),$.sectionMap?{sectionMap:$.sectionMap}:{}),$.palette?{palette:$.palette}:{}),$.vocabulary?{vocabulary:$.vocabulary}:{})}catch(ae){return vn(j),null}finally{de.clear()}})},getSlotResult(f){var y;return(y=B.get(f))!=null?y:null},isSlotDecided(f){return ne.has(f)},getSlotConfig(f){var y;return(y=ue.get(f))!=null?y:null},reportSlots(f,y,N,z){var j;let E={};for(let[C,T]of Object.entries(z!=null?z:{}))for(let V of T){let G=`${C}|${V.key}`;!Tt.test(C)||nr.has(G)||(nr.add(G),((j=E[C])!=null?j:E[C]=[]).push(V))}Object.keys(E).length>0&&fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify({slotIds:Object.keys(E),authoredArms:E})}).catch(()=>{});for(let C of f)if(!(typeof C!="string"||C.length===0)){if(!Tt.test(C)){_i()&&!rr.has(C)&&(rr.add(C),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(C)} 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(!Me.has(C)){Me.add(C),Be.add(C);let T=y==null?void 0:y[C];if(typeof T=="string"){let G=T.replace(/\s+/g," ").trim().slice(0,400);G!==""&&Le.set(C,G)}let V=N==null?void 0:N[C];V!==void 0&&gn.set(C,V)}}Be.size===0||mn!=null||(mn=setTimeout(()=>{mn=null;let C=[...Be];Be.clear();for(let T=0;T<C.length;T+=20){let V=C.slice(T,T+20),G={},te={};for(let re of V){let W=Le.get(re);W!==void 0&&(G[re]=W,Le.delete(re));let ge=gn.get(re);ge!==void 0&&(te[re]=ge,gn.delete(re))}fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify(F(qe(F(F({slotIds:V},Object.keys(G).length>0?{baselineTexts:G}:{}),Object.keys(te).length>0?{baselineSkeletons:te}:{}),{pagePaths:Object.fromEntries(V.map(re=>[re,location.pathname]))}),Object.keys(G).length>0&&L.getSessionId()?{sessionId:L.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(f,y){!Tt.test(f)||er.has(f)||(er.add(f),fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify({slotIds:[f],baselineSkeletons:{[f]:y}})}).catch(()=>{}))},reportDrift(f,y,N,z){let j=`${f}|${y}`,E=L.getSessionId();!E||tr.has(j)||(tr.add(j),fetch(`${v}/slots/drift`,{method:"POST",headers:d,body:JSON.stringify({sessionId:E,reports:[{slotId:f,expectedFp:y,observedFp:N,reason:z}]})}).catch(()=>{}))},requestSlots(f,y,N){var z,j;for(let E of f)Pt.has(E)||(Pt.add(E),Tt.test(E)?dt.set(E,{text:y==null?void 0:y[E],render:(z=N==null?void 0:N.render)==null?void 0:z[E],skeleton:(j=N==null?void 0:N.skeletons)==null?void 0:j[E]}):se.reportSlots([E]));dt.size===0||hn!=null||(hn=setTimeout(()=>{hn=null;let E=[...dt];dt.clear();for(let C=0;C<E.length;C+=50){let T=E.slice(C,C+50),V={};for(let[G,te]of T)te.render&&(V[G]=te.render);se.decide({slotsFrom:"registry",registrySlotIds:T.map(([G])=>G),bootstrap:!1,render:V}).then(G=>{var te,re;if(G){let W={},ge={},ke=[];for(let[de,ae]of T){let $=(te=G.slotConfig)==null?void 0:te[de];if($){$.needsSkeleton&&ae.skeleton&&((re=se.reportSkeleton)==null||re.call(se,de,ae.skeleton));continue}ke.push(de),ae.text&&(W[de]=ae.text),ae.skeleton&&(ge[de]=ae.skeleton)}ke.length>0&&se.reportSlots(ke,W,ge)}else ir(T.map(([W])=>W),Pt,W=>{var ge;let ke={},de={},ae={};for(let[$,me]of T)W.has($)&&(me.text&&(ke[$]=me.text),me.render&&(de[$]=me.render),me.skeleton&&(ae[$]=me.skeleton));(ge=se.requestSlots)==null||ge.call(se,[...W],ke,{render:de,skeletons:ae})});Lt.forEach(W=>W())})}},0))},decideSlots(f){for(let y of f)Rt.has(y.id)||(Rt.add(y.id),ft.set(y.id,y));ft.size===0||yn!=null||(yn=setTimeout(()=>{yn=null;let y=[...ft.values()];ft.clear();for(let N=0;N<y.length;N+=30){let z=y.slice(N,N+30);se.decide({slots:z}).then(j=>{j||ir(z.map(E=>E.id),Rt,E=>{var C;return(C=se.decideSlots)==null?void 0:C.call(se,z.filter(T=>E.has(T.id)))}),Lt.forEach(E=>E())})}},0))},cancelSlots(f){for(let y of f)dt.delete(y)&&Pt.delete(y),ft.delete(y)&&Rt.delete(y)},onSlotsChanged(f){return Lt.add(f),()=>{Lt.delete(f)}},getStyleVocabulary(){return we},getSitePalette(){return Q},getPersona(){return ee?{persona:ee.persona,confidence:ee.confidence,band:Je(ee.confidence)}:null},async fetchWeights(){var f;let y=je(5e3);try{let N=await fetch(`${v}/weights`,{headers:d,signal:y.signal});return N.ok?(f=(await N.json()).components)!=null?f:[]:[]}catch(N){return[]}finally{y.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){m.flush(),I.flush()},dispose(){var f;pt==null||pt(),Sn=!0,Ee=!0,m.destroy(),I.destroy(),((f=pe.get(e.apiKey))==null?void 0:f.dispose)===se.dispose&&pe.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var f;pt==null||pt(),Sn=!0,Ee=!0,_=!0,Dt(e.apiKey),m.destroy({forget:!0}),I.destroy({forget:!0}),L.destroy(),P.clear(),((f=pe.get(e.apiKey))==null?void 0:f.dispose)===se.dispose&&pe.delete(e.apiKey);try{localStorage.removeItem(rt+e.apiKey),localStorage.removeItem(Bt(e.apiKey)),localStorage.removeItem($t(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${ze(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(y){}e.debug&&console.log("[sentient] destroyed")}};if(pe.set(e.apiKey,{config:e,upgrade:null,dispose:se.dispose}),pt=Oi(se,e.apiKey,f=>{$e.then(()=>{Sn||Ur.add(f)})}),e.debug){let f=window;f.__sentient&&(f.__sentient.client=se)}return se}var jn=/(^|\/)snippet(\.global)?(\.min)?\.js(\?|$)/,Li=(()=>{var e,t;try{return(t=(e=document.currentScript)==null?void 0:e.src)!=null?t:""}catch(n){return""}})(),Pi=/@\d+\.\d+\.\d+[^/]*\//;function Gn(e){var t;try{let n=Li||((t=Array.from(document.getElementsByTagName("script")).find(r=>jn.test(r.src)))==null?void 0:t.src);for(let r of n?[n]:[]){let o=jn.test(r)?r.replace(jn,`$1${e}$4`):r.replace(/[^/?#]*([?#].*)?$/,e),s=(e==="consent.global.js"?"sha384-+7/RqBOFLU5bMaQ6bcBAWzG589skmxN8tedG9hkoQQ6HaQkRRBJfoRVD94e/fJcM":e==="editor.global.js"?"sha384-hzkARTV3OE2fQ0qR7vEp4eiT34uJJUd9Vkw81SGlNv0HEOPKwX6uVT0kmzdfEBZW":e==="preview.global.js"?"sha384-vdxAPgchJj9TyoCfgD43y1powSvyp9HFnq+1YircrnoQ8LsCBH/RCei+cQHMjZ+r":"sha384-CU+t8gO/N2Dn7Y2o/b8yCMluhAX4D4sHp6d44eYOOC7780TATanFSAECAjSxzInC")||"";return Pi.test(o)&&s.indexOf("sha384-")===0?{src:o,integrity:s}:{src:o}}}catch(n){}return null}var Vt=new Map;function lt(e,t,n){let r=window[t];if(r)return Promise.resolve(r);let o=Vt.get(e);return o||(o=new Promise(s=>{var i;let a=n?{src:n}:Gn(e);if(!a)return s(null);let u=Ge(document.createElement("script"));Fn(u,a),u.async=!0,u.onload=()=>{var l;let c=(l=window[t])!=null?l:null;c||Vt.delete(e),s(c)},u.onerror=()=>{Vt.delete(e),s(null)},((i=document.head)!=null?i:document.documentElement).appendChild(u)}),Vt.set(e,o)),o}function Fn(e,t){t.integrity&&(e.integrity=t.integrity,e.crossOrigin="anonymous"),e.src=t.src}var Wr="__sentientConsent",Pe=null,Un=!1,Ht=new Set,zn=()=>{let e=window[Wr];return typeof(e==null?void 0:e.consentWatcher)=="function"?e.consentWatcher:null},vt;function Vr(e){vt=e}function Ri(){Pe||(Pe=zn())||Un||(Un=!0,lt("consent.global.js",Wr,vt).then(e=>{if(Un=!1,!e)return Ni(vt!=null?vt:"consent.global.js");if(Pe=zn(),Pe)for(let t of Array.from(Ht))t()}))}function Ni(e){console.warn(`[sentient] could not load ${e} \u2014 tracking stays off. Set window.sentient.consentSrc to its URL.`)}function Xe(e){Ri();let t=null,n=()=>(!t&&(Pe!=null?Pe:Pe=zn())&&(t=Pe(e)),t);return{read:()=>{var r,o;return(o=(r=n())==null?void 0:r.read())!=null?o:null},refused:()=>{var r,o;return(o=(r=n())==null?void 0:r.refused())!=null?o:!1},subscribe(r){let o,s=!1,a=()=>{Ht.delete(a);let u=n();s||!u||(o=u.subscribe(r),r())};return n()?(o=t.subscribe(r),Promise.resolve().then(()=>{s||r()})):Ht.add(a),()=>{s=!0,Ht.delete(a),o==null||o()}}}}function Di(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function Hr(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 Mi(e){let t=e.join("");return Hr(t,2166136261)+Hr(t,1523705862)}var Bi=new Set(["A","BUTTON"]),$i=/^H([1-6])$/,Ki=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]);var ji=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function Gi(e){return Bi.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function Fi(e){if($i.test(e.tagName)||Ki.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function Ui(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(Gi(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||Fi(r))return r;return t}function qt(e,t=40){var n,r,o;let s=e.ownerDocument.createTreeWalker(e,4),a=[];for(let l=s.nextNode();l;l=s.nextNode())if(((n=l.nodeValue)!=null?n:"").trim()!==""&&!ji.has((o=(r=l.parentElement)==null?void 0:r.tagName)!=null?o:"")&&(a.push(l),a.length>120))return{reason:"too_large"};if(a.length===0)return{reason:"empty"};let u=[],i=[];for(let l of a){let p=Ui(l,e),h=u.indexOf(p);h===-1&&(u.push(p),h=u.length-1),i.push(h)}if(u.length>t)return{reason:"too_large"};let c=a.map(l=>{var p;return Di((p=l.nodeValue)!=null?p:"")});return{textNodes:a,ownerEls:u,leafToNode:i,leaves:c,fp:Mi(c)}}var qr=["cookiebot","onetrust","cookieyes","tcf","google-consent-mode","shopify"];function zi(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(s=>typeof s=="string")||/[=|]/.test(r)||o.some(s=>/[=|]/.test(s)))return null;n[r]=o}return n}function Wi(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function Vi(e){try{return e()}catch(t){return}}function Jt(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[u,i]of Object.entries(t.slots)){if(typeof i!="object"||i===null)continue;let c=i,l=zi(c.dims);if(!l||c.target!==void 0&&typeof c.target!="string")continue;let p=c.arms!==void 0?Wi(c.arms):null,h={dims:l};typeof c.target=="string"&&(h.target=c.target),p&&(h.arms=p),n[u]=h}let r={apiKey:t.apiKey,personaAttributes:t.personaAttributes===!0,slots:n};typeof t.consent=="boolean"?r.consent=t.consent:t.consent!==void 0&&s("consent");let o=t.consentFrom;if(typeof o=="string"&&qr.includes(o))r.consentFrom=o;else if(o&&typeof o=="object"&&!Array.isArray(o)){let u=o;typeof u.cmp=="string"&&qr.includes(u.cmp)||u.cmp===void 0&&(typeof u.cookie=="string"||typeof u.check=="function")?r.consentFrom=u:s("consentFrom")}else o!==void 0&&s("consentFrom");function s(u){r.consent=!1,console.warn(`[sentient] invalid ${u} \u2014 tracking stays OFF until it is fixed (sentient-ui.com/docs#consent).`)}(t.preConsentBehavior==="statistical_winner"||t.preConsentBehavior==="control")&&(r.preConsentBehavior=t.preConsentBehavior),t.debug===!0&&(r.debug=!0),typeof t.registry=="boolean"&&(r.registry=t.registry),typeof t.editorSrc=="string"&&(r.editorSrc=t.editorSrc),typeof t.consentSrc=="string"&&(r.consentSrc=t.consentSrc),typeof t.nonce=="string"&&t.nonce!==""&&(r.nonce=t.nonce),typeof t.apiBase=="string"&&(r.apiBase=t.apiBase),typeof t.sectionCapture=="boolean"&&(r.sectionCapture=t.sectionCapture);let a=typeof t.persona=="function"?Vi(t.persona):t.persona;if(typeof a=="string"&&a.trim()!==""&&(r.persona=a),Array.isArray(t.sections)){let u=t.sections.filter(i=>typeof i=="string"&&i.trim()!=="").slice(0,50);u.length>=2&&(r.sections=u)}return r}var Jr=new WeakMap;function Yr(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Xr(e,t,n){var s,a,u;let r=Jr.get(e);if(r){if(r.fp!==n.fp||!Yr(r.leafToNode,n.leafToNode))return"mismatch"}else{let i=qt(e);if(!("fp"in i)||(r={fp:i.fp,leafToNode:i.leafToNode,textNodes:i.textNodes,ownerEls:i.ownerEls,classes:i.ownerEls.map(c=>{var l;return(l=c.getAttribute("class"))!=null?l:""})},r.fp!==n.fp||!Yr(r.leafToNode,n.leafToNode)))return"mismatch";Jr.set(e,r)}let o=r;for(let[i,c]of Object.entries(t.nodes)){let l=Number(i),p=o.ownerEls[l];if(p){if(typeof c.text=="string"){let h=!0;o.leafToNode.forEach((b,w)=>{b===l&&(o.textNodes[w].nodeValue=h?c.text:"",h=!1)})}c.like!==void 0&&o.classes[c.like]!==void 0&&p.setAttribute("class",o.classes[c.like]),c.hidden&&((s=p.style)==null||s.setProperty("display","none","important"))}}for(let i of Object.values((a=t.order)!=null?a:{})){let c=i.map(w=>o.ownerEls[w]).filter(w=>!!w),l=(u=c[0])==null?void 0:u.parentElement;if(!l||c.length!==i.length||c.some(w=>w.parentElement!==l))continue;let p=new Set(c),h=0;Array.from(l.children).map(w=>p.has(w)?c[h++]:w).forEach((w,S)=>{var K;l.children[S]!==w&&l.insertBefore(w,(K=l.children[S])!=null?K:null)})}return"applied"}function St(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 Hi(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 Yt(e,t){return!!(e!=null&&e.urlMatch)&&!St(t).includes(e.urlMatch)}var qi=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function Zr(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 Te(e,t){if(e.urlMatch&&!St(t).includes(e.urlMatch))return null;let n=Zr(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Hi(r,e.fingerprint)?null:r}function Qr(e,t){return Yt(e,t)?!1:!!e.selector&&!e.dataAttr&&!e.id&&!e.fingerprint&&e.page===void 0?eo(e,t):Te(e,t)!==null}function eo(e,t){return Zr(e,t).length>0}function Xt(e,t){return Yt(e,t)?!1:e.page!==void 0&&Wt.test(e.page)?Mn(e.page,St(t)):eo(e,t)}var to={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"},Ji=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function no(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(!Ji.test((r=n[1])!=null?r:""))return!1;return!0}function Yi(e){var r,o;let t=e.ownerDocument.createTreeWalker(e,4),n=null;for(let s=t.nextNode();s!==null;s=t.nextNode()){if(((r=s.nodeValue)!=null?r:"").trim()==="")continue;let a=(o=s.parentElement)==null?void 0:o.tagName;if(!(a==="SCRIPT"||a==="STYLE"||a==="TEMPLATE")){if(n!==null)return null;n=s}}return n}function bt(e,t){let n=Yi(e);n!==null?n.nodeValue=t:e.textContent=t}var Wn=/^https:\/\//i;function Zt(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(Wn.test(e)||e[0]==="/"&&e[1]!=="/")?e:null}var ro=new Map,Fe=null;function Xi(e){return e.replace(/["\\]/g,"\\$&")}function Zi(e){var t;(!Fe||!Fe.isConnected)&&(Fe=e.querySelector("style[data-sentient-ops]"),Fe||(Fe=Ge(e.createElement("style"),e),Fe.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Fe))),Fe.textContent=[...ro.entries()].map(([n,r])=>`[data-snt-e="${Xi(n)}"]{${r}}`).join(`
|
|
2
|
+
`)}function oo(e,t,n,r){var u;let o=!1,s=(u=t.moveBefore)!=null?u:t.moveAfter;if(s){let i=Te(s,r);!i||i===e||i.parentElement!==e.parentElement||!e.parentElement?o=!0:t.moveBefore?e.parentElement.insertBefore(e,i):e.parentElement.insertBefore(e,i.nextSibling)}typeof t.text=="string"&&bt(e,t.text),typeof t.href=="string"&&Wn.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&Wn.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let a=[];if(t.hidden&&a.push("display:none !important"),t.style)for(let[i,c]of Object.entries(t.style)){let l=to[i];l&&typeof c=="string"&&no(c)&&a.push(`${l}:${c.trim()} !important`)}return a.length>0&&(e.setAttribute("data-snt-e",n),ro.set(n,a.join(";")),Zi(r)),{anchorMiss:o}}var wt="data-sentient-block-arm",R=null;function Et(e){R=e!=null?e:null}var Ze=null;function kt(e){Ze=e!=null?e:null}var lo=e=>{var t;return typeof e=="string"?(t=Ze==null?void 0:Ze.entries.find(n=>n.id===e))==null?void 0:t.classes:void 0},uo=e=>{let t=typeof e=="string"?Ze==null?void 0:Ze.entries.find(n=>n.id===e):void 0;return t!=null&&t.computed.inheritsColor?t.computed.color:void 0},Re="data-sentient-blocks-hid",ut={none:"0",sm:"8px",md:"16px",lg:"24px"},Vn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},io={sm:"0.875em",md:"1em",lg:"1.25em"},Qi={sm:"1.25em",md:"1.5em",lg:"2em"},es={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},so={sm:"8px",md:"16px",lg:"32px"},ts={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},ns={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 ao(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 co(e,t){let n=rs(e,t),r=uo(e.like);return n&&r&&(n.style.color=r),n}function rs(e,t){var n,r,o,s,a,u,i,c,l,p,h,b,w,S,K,L,D,_,A,x;try{let P=lo(e.like),m=e.maxWidth==="measure"?"65ch":void 0,v=d=>(d.className=P,he(d,{"max-width":m}));switch(e.type){case"stack":case"grid":{let d=t.createElement("div");if(e.type==="stack"){let M=e;he(d,{display:"flex","flex-direction":M.direction,gap:(r=ut[(n=M.gap)!=null?n:"md"])!=null?r:ut.md,"align-items":M.align?Vn[M.align]:void 0,"justify-content":M.justify?Vn[M.justify]:void 0,"flex-wrap":M.wrap?"wrap":void 0})}else{let M=e,q=(s=ut[(o=M.gap)!=null?o:"md"])!=null?s:ut.md;he(d,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${M.columns-1} * ${q}) / ${M.columns})), 1fr))`,gap:q,"align-items":M.align?Vn[M.align]:void 0})}P&&(d.className=P);let g=!P&&e.type==="stack"&&e.surface==="raised",I=(a=e.pad)!=null?a:g?"md":void 0;I&&he(d,{padding:(u=ut[I])!=null?u:ut.md}),g&&he(d,{background:R==null?void 0:R.surface,color:R!=null&&R.surface?R==null?void 0:R.surfaceText:void 0,border:`1px solid ${(i=R==null?void 0:R.border)!=null?i:"currentColor"}`,"border-radius":(c=R==null?void 0:R.radius)!=null?c:"8px"});for(let M of(l=e.children)!=null?l:[]){let q=co(M,t);q&&d.appendChild(q)}return d}case"text":{let d=t.createElement("p");return d.textContent=e.value,P?v(d):he(d,Ke(U({margin:"0","font-size":e.size?io[e.size]:void 0,"font-weight":e.weight?ns[e.weight]:void 0,"text-align":e.align},ao(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let d=t.createElement(`h${e.level}`);return d.textContent=e.value,P?v(d):he(d,{margin:"0","font-size":Qi[(p=e.size)!=null?p:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let d=t.createElement("a");d.textContent=e.label;let g=Zt(e.href);if(g&&(d.href=g),e.tag&&d.setAttribute("data-sentient-tag",e.tag),P)return v(d);let I=(h=e.emphasis)!=null?h:"primary";return he(d,{display:"inline-block",padding:es[(b=e.size)!=null?b:"md"],"border-radius":(w=R==null?void 0:R.radius)!=null?w:"8px",font:"inherit","font-size":e.size?io[e.size]:void 0,"text-decoration":I==="ghost"?"underline":"none",cursor:"pointer",background:I==="primary"?(S=R==null?void 0:R.primaryBg)!=null?S:"#111827":"transparent",color:I==="primary"?(K=R==null?void 0:R.primaryText)!=null?K:"#ffffff":(L=R==null?void 0:R.accent)!=null?L:"inherit",border:I==="secondary"?`1px solid ${(D=R==null?void 0:R.accent)!=null?D:"currentColor"}`:"none"})}case"link":{let d=t.createElement("a");d.textContent=e.label;let g=Zt(e.href);return g&&(d.href=g),e.tag&&d.setAttribute("data-sentient-tag",e.tag),P?v(d):he(d,{color:"inherit","text-decoration":"underline"})}case"image":{let d=t.createElement("img"),g=Zt(e.src);return g&&(d.src=g),d.alt=e.alt,P&&(d.className=P),he(d,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?ts[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let d=t.createElement("span");return d.textContent=e.value,P?v(d):he(d,U({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(_=R==null?void 0:R.border)!=null?_:"currentColor"}`},ao(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(A=so[e.size])!=null?A:so.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(x=R==null?void 0:R.border)!=null?x:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(P){return null}}function fo(e,t,n,r){var o,s;try{let a=new Set;for(let i of Array.from(e.children)){let c=i.getAttribute(wt);c!==null&&(t[c]===void 0?i.remove():a.add(c))}for(let[i,c]of Object.entries(t)){if(a.has(i))continue;let l="tree"in c?c:null,p=co(l?l.tree:c,r);if(!p)continue;let h=r.createElement("div");h.setAttribute(wt,i),h.style.display="none";let b=l?lo((o=l.surface)==null?void 0:o.like):void 0;if(b){let w=r.createElement("div");w.className=b;let S=uo((s=l.surface)==null?void 0:s.like);S&&(w.style.color=S),w.appendChild(p),h.appendChild(w)}else h.appendChild(p);e.appendChild(h)}let u=n!==void 0&&t[n]!==void 0;for(let i of Array.from(e.children)){let c=i.getAttribute(wt),l=i;c!==null?l.style.display=u&&c===n?"":"none":u?l.hasAttribute(Re)||(l.setAttribute(Re,l.style.display),l.style.display="none"):l.hasAttribute(Re)&&(l.style.display=l.getAttribute(Re),l.removeAttribute(Re))}}catch(a){}}function os(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(wt)!==null){n.remove();continue}n.hasAttribute(Re)&&(n.style.display=n.getAttribute(Re),n.removeAttribute(Re))}}catch(t){}}function Qt(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${wt}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${Re}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||os(r)}catch(n){}}function Hn(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function en(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 tn(e,t,n,r){var o;for(let[s,a]of Object.entries(t)){let u=e[s];if(!u||typeof u=="string")continue;let i=Hn(a.target,n);for(let c of i)for(let[l,p]of Object.entries(u))(o=a.dims[l])!=null&&o.includes(p)&&(c.setAttribute(`data-${l}`,p),r==null||r(c,`data-${l}`))}}function nn(e,t,n,r){for(let[o,s]of Object.entries(t)){let a=e[o];if(typeof a!="string"||!s.arms||!s.arms.includes(a))continue;let u=Hn(s.target,n);for(let i of u)i.setAttribute("data-sentient-arm",a),r==null||r(i,"data-sentient-arm")}}function rn(e,t,n,r){var u,i,c,l,p,h,b;let o=new Set,s=(u=r==null?void 0:r.contentAndOps)!=null?u:!0,a=[];for(let[w,S]of Object.entries(t)){if(Yt(S.locator,n))continue;let K;if(S.locator){let D=Te(S.locator,n);K=D?[D]:[],!D&&Xt(S.locator,n)&&a.push(w)}else K=Hn(S.target,n);let L=e[w];for(let D of K){if(L!==void 0)if(typeof L=="string")D.setAttribute("data-sentient-arm",L),(i=r==null?void 0:r.onAttr)==null||i.call(r,D,"data-sentient-arm"),s&&((c=r==null?void 0:r.onApplied)==null||c.call(r,w,L,D));else for(let[A,x]of Object.entries(L))D.setAttribute(`data-${A}`,x),(l=r==null?void 0:r.onAttr)==null||l.call(r,D,`data-${A}`);if((S.blocks||S.compose)&&!ss(n)){let A=Object.fromEntries([...Object.entries((p=S.blocks)!=null?p:{}).filter(([,x])=>!ht(x)),...Object.entries((h=S.compose)!=null?h:{}).filter(([,x])=>!ht(x.tree))]);Object.keys(A).length>0&&(fo(D,A,typeof L=="string"?L:void 0,n),o.add(D))}if(!s)continue;let _=D.textContent;S.edits?Xr(D,S.edits.edits,S.edits)==="mismatch"&&((b=r==null?void 0:r.onDrift)==null||b.call(r,w,S.edits.fp)):typeof S.content=="string"&&bt(D,S.content),S.ops&&oo(D,S.ops,w,n).anchorMiss&&!a.includes(w)&&a.push(w),Bn(D,Ke(U(U({previous:_},typeof L=="string"?{arm:L}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return Qt(n,o),a}var is=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function ss(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:is.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var as=800;function on(e,t,n){let r=[];return n.forEach(({slotId:o,arm:s,el:a},u)=>{r.push($n((h,b={})=>{try{e.track({projectId:t,componentId:o,variantId:s,eventType:"micro_signal",payload:U({signalType:h},b)})}catch(w){}},a,void 0,{tabLoss:u===0}));let i=null,c=0,l=()=>{c=Date.now(),i=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:s,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-c}})}catch(h){}i=null},as)},p=()=>{i!==null&&(clearTimeout(i),i=null)};a.addEventListener("mouseenter",l),a.addEventListener("mouseleave",p),r.push(()=>{a.removeEventListener("mouseenter",l),a.removeEventListener("mouseleave",p),i!==null&&clearTimeout(i)})}),()=>{for(let o of r)o()}}function ls(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 go(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var us="_snt_fired_goals";function qn(e,t){try{e==null||e.sessionStorage.removeItem(go(t)),e==null||e.sessionStorage.removeItem(us)}catch(n){}}function po(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function cs(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 ds(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function mo(e,t,n,r){var L,D;let o=(L=n.defaultView)!=null?L:typeof window!="undefined"?window:null,s=go(r),a=cs(o,s),u=_=>{let A=po(_);if(!a.has(A))try{_.slotId?t.componentGoal(_.slotId,_.goalId):t.goal(_.goalId),a.add(A),ds(o,s,a)}catch(x){}},i=e.filter(_=>_.event==="click"),c=e.filter(_=>_.event==="form_submit"),l=e.filter(_=>_.event==="url_reached"),p=e.filter(_=>_.event==="scroll_depth"),h=(_,A)=>{if(!_.locator)return!1;let x=Te(_.locator,n);return!!x&&(x===A||x.contains(A))},b=_=>{let A=_.target;if(!(!A||typeof A.closest!="function"))for(let x of i)h(x,A)&&u(x)},w=_=>{let A=_.target;if(A)for(let x of c)h(x,A)&&u(x)},S=()=>{if(l.length===0)return;let _=St(n);for(let A of l)A.urlPattern&&ls(A.urlPattern,_)&&u(A)},K=()=>{var x;let _=n.documentElement,A=_.scrollHeight>0?(_.scrollTop+_.clientHeight)/_.scrollHeight:0;for(let P of p)A>=((x=P.threshold)!=null?x:.75)&&u(P);p.every(P=>a.has(po(P)))&&n.removeEventListener("scroll",K)};return n.addEventListener("click",b,!0),n.addEventListener("submit",w,!0),(D=n.defaultView)==null||D.addEventListener("popstate",S),S(),p.length>0&&(n.addEventListener("scroll",K,{passive:!0}),K()),{checkUrl:S,teardown:()=>{var _;n.removeEventListener("click",b,!0),n.removeEventListener("submit",w,!0),(_=n.defaultView)==null||_.removeEventListener("popstate",S),p.length>0&&n.removeEventListener("scroll",K)}}}function sn(e,t){if(!e||e.length<2||t.size!==e.length)return null;let n=[];for(let a of e){let u=t.get(a);if(!u||n.includes(u))return null;n.push(u)}let r=n[0].parentNode;if(!r||!n.every(a=>a.parentNode===r))return null;let o=n.slice().sort((a,u)=>a.compareDocumentPosition(u)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),s=[];for(let a=0;a<n.length;a++){let u=n[a];o[a]!==u&&(s.push({el:u,before:o[a]}),o.splice(o.indexOf(u),1),o.splice(a,0,u))}return s}var fs="__snt_editor_token";function ho(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(fs):null}catch(e){return null}}function yo(e){let t=null;try{let n=location.hash.slice(1),r=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(r){t=r[2];let o=n.slice(r.index+r[0].length);r[1]!="&"&&o[0]=="&"&&(o=r[1]+o.slice(1));let s=n.slice(0,r.index)+o;history.replaceState(history.state,"",s?"#"+s:location.pathname+location.search)}}catch(n){}return t}var _t="0.32.1",un=_t!=="0.0.0-dev"?{name:"snippet",version:_t}:void 0,Ao=_t!=="0.0.0-dev"?{v:_t}:{},vo=5e3,ps=50,xo=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),Z=null,k=null,Se={},ve=null,be=null,At=null,oe=null,ie=null,xt=0,H=null,Qe=null,So=!1,Jn=null,an=null,Ct=null,_e=!1,Ue=!1,cn=!1,dn=0,Co=e=>fe(e)===dn,ct=null,ce=!1,De=null,Ae=[],et=null,tt=null,ye=null,gs=3e3,ms=100;function bo(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 Ne(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Ot(e,t){return Z?(Z.personaAttributes&&H&&en(H.persona,H.band,e,t==null?void 0:t.onAttr),tn(Se,Z.slots,e,t==null?void 0:t.onAttr),nn(Se,Z.slots,e,t==null?void 0:t.onAttr),ve?rn(Se,ve,e,U(Ke(U({},t),{onDrift:(n,r)=>{var o,s;return(s=k==null?void 0:k.reportDrift)==null?void 0:s.call(k,n,r,(o=To[n])!=null?o:null,"fp_mismatch")}}),H?{persona:H.persona}:{})):(Qt(e,new Set),[])):[]}function Oo(e){var n;let t=new Map;for(let r of(n=Z==null?void 0:Z.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function Yn(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=sn(e,Oo(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function hs(e,t,n){let r=(o,s)=>t.some(([a,u])=>a===o&&u===s);try{if(Array.isArray(e.stamped))for(let o of e.stamped){if(!Array.isArray(o))continue;let[s,a,u]=o;!s||typeof a!="string"||r(s,a)||(u==null?s.removeAttribute(a):s.setAttribute(a,u))}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 ys(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function Io(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function pn(e){var t;return(t=e.apiBase)!=null?t:"https://api.sentient-ui.com"}function vs(e){return Promise.resolve().then(()=>fetch(`${pn(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 Xn(e,t){let n=[],r=[];for(let o of e)try{if(typeof(o==null?void 0:o.id)!="string")continue;!o.locator||Qr(o.locator,t)?n.push(o.id):Xt(o.locator,t)&&r.push(o.id)}catch(s){}return[n,r]}var To={};function Lo(e,t){var r;let n={};for(let o of e){let s=(r=De==null?void 0:De.find(c=>c.id===o))==null?void 0:r.locator,a=s?Te(s,t):null,u=a?qt(a):null,i=u&&"fp"in u?u.fp:void 0;i&&(To[o]=i),n[o]=Ke(U({},i?{fp:i}:{}),{forms:!1,compose:!0,content:!0})}return n}function Po(e,t){let n=null;for(let r of t)e!=null&&e[r]&&((n!=null?n:n={})[r]=e[r]);return n}var le=null;function Ro(){if(!_e){le&&et!==Ie()&&le(!0);return}!De||et===Ie()||(et=Ie(),Ss())}function Ss(){ye==null||ye();let e=Z,t=De;if(!e||!t)return;let n,r,o=()=>{clearTimeout(n),clearTimeout(u),r==null||r.disconnect(),ye===o&&(ye=null)},s=null,a=i=>{let[c,l]=Xn(t,document),p=c.filter(h=>!Ae.includes(h));s!==null&&c.some(h=>!s.has(h)&&!p.includes(h))&&It(),s=new Set(c),p.length>0&&bs(p).catch(()=>{}),(i||l.length===0&&!t.some(h=>!c.includes(h.id)&&!Ae.includes(h.id)))&&(o(),No(e,l))},u=setTimeout(()=>a(!0),gs);if(ye=o,a(),ye===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(a,ms)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(i){}}function fn(e,t){if(!(!e||e.length===0||!t||!Z))try{be==null||be.teardown(),be=mo(e,t,document,Z.apiKey)}catch(n){}}async function bs(e){let t=Z,n=k;if(!t||!n)return;Ae=Ae.concat(e);let r=await n.decide(U({slotsFrom:"registry",registrySlotIds:e,render:Lo(e,document)},Ao));if(r||(Ae=Ae.filter(s=>!e.includes(s))),!r||ce||k!==n)return;Se=U(U({},Se),r.slots),!be&&r.goals&&(t.consent!==!1||Ue)&&fn(At=r.goals,n);let o=Po(r.slotConfig,e);o&&(ve=U(U({},ve),o)),It(),Ne(t,"late decide",e),tt&&Co(t.apiKey)&&He(t.apiKey,tt=U(Ke(U({},tt),{slots:Se,savedAt:Date.now()}),ve?{slotConfig:ve}:{}))}function No(e,t){if(t.length!==0)try{fetch(`${pn(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 nt(){return!!(Z&&k&&Z.sectionCapture!==!1&&(Z.consent!==!1||Ue)&&!Ye())}function ws(){if(!k||!Z||!nt()||ie)return;let e=[];Ot(document,{contentAndOps:_e,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),Qn();try{oe==null||oe(),oe=on(k,Z.apiKey,e)}catch(t){}}function Qn(){if(typeof document=="undefined"||!nt())return;let e;try{if(an&&an.length>0){let r=new Map;for(let o of an){if(o.urlMatch!==window.location.pathname)continue;let s=Te(o.locator,document);s&&r.set(s,o.type)}r.size>0&&(e=o=>{var s;return(s=r.get(o))!=null?s:null})}}catch(r){}let t=k,n=++xt;Ct=window.location.pathname,lt("engagement.global.js","__sentientEngagement").then(r=>{if(!(!r||n!==xt||k!==t||!t||!nt()))try{ie==null||ie(),ie=r.startEngagementCapture(t,U({apiKey:Z.apiKey,apiBase:Z.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{}))}catch(o){}})}function It(){try{let e=[];if(oe==null||oe(),oe=null,Ot(document,{contentAndOps:_e,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),Yn(Qe,document),e.length>0&&nt())try{oe=on(k,Z.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Ct!==null&&window.location.pathname!==Ct&&nt()&&(ie==null||ie(),ie=null,xt++,Qn())}catch(t){}}catch(e){}}function wo(){Jn===null&&(Jn=setTimeout(()=>{Jn=null,It();try{be==null||be.checkUrl()}catch(e){}Ro()},ps))}function Do(){if(!(So||typeof window=="undefined"||typeof history=="undefined")){So=!0;try{let e=t=>{let n=history[t];history[t]=function(r,o,s){let a=n.call(this,r,o,s!=null?s:null);return wo(),a}};e("pushState"),e("replaceState"),window.addEventListener("popstate",wo)}catch(e){}}}function ln(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 Es(e,t,n){var r;try{window.__sentientEditor={token:t,code:n,apiBase:pn(e)};let o=e.editorSrc?{src:e.editorSrc}:Gn("editor.global.js");if(!o){ko();return}let s=Ge(document.createElement("script"));Fn(s,o),s.async=!0,s.onerror=()=>ko(),((r=document.head)!=null?r:document.documentElement).appendChild(s)}catch(o){}}var Eo="sentient-editor-load-notice";function ko(){var e;try{if(document.getElementById(Eo))return;let t=document.createElement("div");t.id=Eo,t.textContent="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.",t.style.cssText="position:fixed;bottom:16px;right:16px;z-index:2147483647;max-width:320px;padding:14px 16px;border-radius:14px;background:#111827;color:#fff;font:13px/1.45 system-ui,sans-serif;border:1px solid rgba(245,158,11,.6);cursor:pointer",t.onclick=()=>t.remove(),((e=document.body)!=null?e:document.documentElement).appendChild(t),setTimeout(()=>t.remove(),1e4)}catch(t){}}function ks(e){let t={cfg:e,apiBase:pn(e),set(n){n.slots!==void 0&&(Se=n.slots),n.slotConfig!==void 0&&(ve=n.slotConfig),n.persona!==void 0&&(H=n.persona),n.decided&&(_e=!0),n.look&&(Et(n.look.palette),kt(n.look.vocabulary))},apply:()=>Ot(document),installSpaHooks:Do,exposeGlobal:()=>{cn=!0,Zn(e)},dbg:(...n)=>Ne(e,...n)};return lt("preview.global.js","__sentientPreview").then(n=>n?n.runPreview(t):Promise.reject()).catch(()=>(t.exposeGlobal(),Ne(e,"preview chunk unavailable \u2014 page left as-is"),!0))}function Zn(e){let t=r=>{try{ie==null||ie(),ie=null,xt++,Ct=null,oe==null||oe(),oe=null,ye==null||ye(),be==null||be.teardown(),be=null,r&&qn(typeof window!="undefined"?window:null,e.apiKey),Ue=!1,ce=!0,r?(tt=null,H=null,k?k.destroy():it(e.apiKey)):k==null||k.dispose(),k=null}catch(o){}},n={consentWatcher:Xe,goal(r,o){try{k==null||k.goal(r,o)}catch(s){}},componentGoal(r,o){try{k==null||k.componentGoal(r,o)}catch(s){}},grantConsent(){try{if(!k&&ce||k!=null&&k.released)dn=fe(e.apiKey),k=yt(U({apiKey:e.apiKey,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,ingestUrl:Io(e)},un?{sdk:un}:{})),fn(At,k);else{let r=(k==null?void 0:k.gated)===!0;Kn(e.apiKey),r&&(dn=fe(e.apiKey)),fn(At,k)}ce=!1,le==null||le()}catch(r){}Ue=!0;try{ws()}catch(r){}},revokeConsent(){t(!0)},reapply:It,getState(){var r,o;try{return{apiKey:e.apiKey,persona:(r=H==null?void 0:H.persona)!=null?r:null,band:(o=H==null?void 0:H.band)!=null?o:null,slots:Se,matchCounts:ln(e),consent:!ce&&(e.consent!==!1||Ue)}}catch(s){return{apiKey:e.apiKey,persona:null,band:null,slots:{},matchCounts:{},consent:!1}}}};if(window.SentientSnippet=n,window.__sentientApi=n,e.consentFrom&&!ct&&!cn)try{let r=Xe(e.consentFrom),o=!1,s=!1,a=()=>!!k&&!ce&&(k.gated===void 0?e.consent!==!1||Ue:!k.gated);ct=r.subscribe(()=>{try{let u=r.read();u!==null&&(s=!0);let i=u!=null?u:s?!1:null,c=a(),l=!c&&i!==!0&&r.refused();if(l&&!o&&(k!=null&&k.gated?k.destroy():it(e.apiKey),qn(window,e.apiKey),tt=null,H=null),o=l,i===!0&&!c)n.grantConsent();else if(i===!1&&c){let p=r.refused();t(p),p&&(o=!0)}}catch(u){}})}catch(r){}for(let r of xo.splice(0))try{r[0]==="goal"?n.goal(r[1],r[2]):r[0]==="grantConsent"&&k?n.grantConsent():r[0]==="revokeConsent"&&k&&n.revokeConsent()}catch(o){}}function _o(){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:Xe,getState:()=>({apiKey:"",persona:null,band:null,slots:{},matchCounts:{},consent:!1})},xo.length=0}catch(t){}}function _s(){try{let e=window.Shopify;return typeof(e==null?void 0:e.shop)=="string"&&e.shop!==""}catch(e){return!1}}async function Mo(){var e,t;try{let n=Jt(window.sentient);if(!n){_o();return}Z=n,ct==null||ct(),ct=null,!n.consentFrom&&n.consent===void 0&&_s()&&(n.consentFrom="shopify"),Vr(n.consentSrc),zt(n.nonce),cn=!1,_e=!1,le=null,Qe=null,Se={},ve=null,Et(null),kt(null),Ue=!1,ce=!1,At=null,De=null,Ae=[],et=null,tt=null,ye==null||ye(),ie==null||ie(),ie=null,xt++,Ct=null;let r=yo("sentient_editor_code"),o=r?null:ho();if(r||o){Es(n,o,r),cn=!0,Zn(n),Ne(n,"editor mode");return}if(typeof window!="undefined"&&/[?&]sentient_(preview|persona)=[^&]/.test(window.location.search)&&await ks(n))return;if(n.consentFrom&&n.consent===void 0)try{n.consent=Xe(n.consentFrom).read()===!0}catch(d){n.consent=!1}n.consent!==!1&&n.sectionCapture!==!1&&!Ye()&<("engagement.global.js","__sentientEngagement");let s=(e=n.registry)!=null?e:Object.keys(n.slots).length===0;n.registry===void 0&&!s&&Ne(n,"slots declared without registry: true, so dashboard-published components are not applied");let a=s?vs(n):null,u=ys();try{(t=u==null?void 0:u.stop)==null||t.call(u)}catch(d){}let i=n.consent!==!1&&!Ye()?ot(n.apiKey):null,c=[];i&&(H={persona:i.persona,band:i.band},Se=i.slots,i.slotConfig&&(ve=i.slotConfig),i.palette&&Et(i.palette),i.vocabulary&&kt(i.vocabulary),Ot(document,U({contentAndOps:!1},u?{onAttr:(d,g)=>c.push([d,g])}:{})),i.layoutOrder&&(Qe=i.layoutOrder,Yn(Qe,document))),u&&hs(u,c,document);let l=yt(U({apiKey:n.apiKey,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,ingestUrl:Io(n)},un?{sdk:un}:{}));k=l,dn=fe(n.apiKey),Zn(n),Do();let p=Object.entries(n.slots).map(([d,g])=>({id:d,dims:g.dims})),h=Ao,b={pp:u?u.v:0},w=[];if(a){let[d]=await Promise.all([bo(a,vo),document.readyState==="loading"?new Promise(g=>document.addEventListener("DOMContentLoaded",g,{once:!0})):null]);De=d,d&&(Ae=w=Xn(d,document)[0]),Ne(n,"registry scope",d&&w)}let S=(d=l)=>{let g=Array.from(Oo(document).keys());return d.decide(U(U(U(U({slots:p},h),b),g.length>=2?{sections:g}:{}),s?{slotsFrom:"registry",registrySlotIds:w,render:Lo(w,document)}:{}))},K=Ie(),L=l.gated===!0,D=!1,_=!1,A=!1,x=!1;le=(d=!1)=>{let g=k;!D||_||x||_e||ce||!g||g.gated||!d&&!A||(A=!1,x=!0,K=et=Ie(),De&&(Ae=w=Xn(De,document)[0]),S(g).then(I=>{x=!1,I&&!_e&&!ce&&k===g?v(I):(I||(Ae=[]),!_e&&(g.released||k!==g||ce)&&(A=!0))}).catch(()=>{x=!1}))};let P=S();P.then(()=>{D=!0},()=>{D=!0});let m=await bo(P,vo),v=d=>{var M,q,J,Y,xe;_=!0;let g=(k!=null?k:l).getPersona();g?H={persona:g.persona,band:g.band}:d.persona&&(H={persona:d.persona,band:"low"}),Se=d.slots,s?ve=Po(d.slotConfig,w):d.slotConfig&&(ve=d.slotConfig),d.palette&&Et(d.palette),d.vocabulary&&kt(d.vocabulary),Qe=(M=d.layoutOrder)!=null?M:Qe;let I=()=>{let O=[],B=Ot(document,{onApplied:(ne,ue,Q)=>O.push({slotId:ne,arm:ue,el:Q})});if(s||No(n,B),Yn(Qe,document),_e=!0,nt())try{oe==null||oe(),oe=on(k,n.apiKey,O)}catch(ne){}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",I,{once:!0}):I(),At=(q=d.goals)!=null?q:null,(n.consent!==!1||Ue)&&!ce&&fn(d.goals,k),an=(J=d.sectionMap)!=null?J:null,nt()&&Qn(),Ne(n,"applied",{persona:H,slots:Se,matches:ln(n)}),!ce&&(Co(n.apiKey)&&He(n.apiKey,tt=U(U(U({v:1,persona:(Y=H==null?void 0:H.persona)!=null?Y:d.persona,band:(xe=H==null?void 0:H.band)!=null?xe:"low",slots:d.slots,layoutOrder:d.layoutOrder,savedAt:Date.now()},ve?{slotConfig:ve}:{}),d.palette?{palette:d.palette}:{}),d.vocabulary?{vocabulary:d.vocabulary}:{})),et=null,Ro())};if(!m){Ne(n,"decide timeout/null \u2014 snapshot state stands",ln(n)),P.then(d=>{if(!d){if(_e)return;Ae=[],l.released===!0||k!==l||ce||L&&Ie()!==K?(A=!0,le==null||le()):et=K;return}if(!(!d||_e||ce)){if(k!==l){A=!0,le==null||le();return}v(d),Ne(n,"late decide applied",ln(n))}}).catch(()=>{});return}if(ce||k!==l){A=!0,le==null||le();return}v(m)}catch(n){_o()}}if(typeof window!="undefined"&&window.sentient){let e=window;if(!e.__sentientInitialized)e.__sentientInitialized=!0,Promise.resolve().then(()=>{Mo()});else{let t=window.__sentientApi;t&&Promise.resolve().then(()=>{window.SentientSnippet=t})}}return Vo(As);})();
|
package/package.json
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentientui/snippet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.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",
|
|
7
|
+
"engines": {
|
|
8
|
+
"node": ">=18.18"
|
|
9
|
+
},
|
|
7
10
|
"homepage": "https://sentient-ui.com",
|
|
8
11
|
"repository": {
|
|
9
12
|
"type": "git",
|
|
@@ -38,10 +41,10 @@
|
|
|
38
41
|
"tsx": "^4.19.2",
|
|
39
42
|
"typescript": "^5.7.2",
|
|
40
43
|
"vitest": "^2.1.8",
|
|
41
|
-
"@sentientui/core": "0.
|
|
44
|
+
"@sentientui/core": "0.36.2"
|
|
42
45
|
},
|
|
43
46
|
"scripts": {
|
|
44
|
-
"build": "tsup",
|
|
47
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsup && node scripts/stamp-chunk-sri.mjs",
|
|
45
48
|
"test": "vitest run",
|
|
46
49
|
"typecheck": "tsc --noEmit",
|
|
47
50
|
"size-check": "tsx scripts/size-check.ts",
|