@sentientui/snippet 0.32.1 → 0.32.3

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 CHANGED
@@ -25,7 +25,7 @@ so it is not reproduced here):
25
25
  apiKey: 'pk_your_key', // sentient-ui.com → Settings
26
26
  personaAttributes: true, // sets data-sentient-persona / -confidence on <html>
27
27
  persona: () => window.myApp?.role, // optional: declare the role your site already knows
28
- // (string or function; must be a key from Settings → Personas)
28
+ // (string or function; must be a key from Matrix → Audiences)
29
29
  sections: ['#hero', '#pricing', '#faq'], // optional: sections eligible for reordering,
30
30
  // CSS selectors in your theme's natural order
31
31
  slots: {
@@ -98,7 +98,7 @@ up new snippet versions on its own and this tag is pasted once. That is the reco
98
98
  and what the Shopify app embed and the dashboard's install page both hand out.
99
99
 
100
100
  **Pinning instead.** Add `@<version>` to the package path
101
- (`@sentientui/snippet@0.21.0/dist/snippet.global.js`) when you want a controlled rollout, or
101
+ (`@sentientui/snippet@0.32.2/dist/snippet.global.js`) when you want a controlled rollout, or
102
102
  when you want Subresource Integrity — an SRI hash is only possible on a pinned URL, since the
103
103
  hash changes with every release. Compute it from the published file
104
104
  (`openssl dgst -sha384 -binary dist/snippet.global.js | openssl base64 -A`) and pass it as
@@ -132,7 +132,7 @@ session and learned per visitor type on the SentientUI API: a first visit sees y
132
132
 
133
133
  `persona` declares the visitor type your site already knows (e.g. a role from your own
134
134
  session state) instead of waiting for it to be inferred. It must be a key in the project's
135
- persona vocabulary (dashboard → Settings → Personas); unrecognized values are ignored
135
+ persona vocabulary (dashboard → Matrix → Audiences); unrecognized values are ignored
136
136
  server-side and surfaced in the dashboard so you can add them. Keep it a low-cardinality
137
137
  role label — never a user id or email.
138
138
 
@@ -1,5 +1,5 @@
1
- "use strict";var __sentientEditorBundle=(()=>{var Gt=Object.defineProperty,wr=Object.defineProperties,kr=Object.getOwnPropertyDescriptor,Sr=Object.getOwnPropertyDescriptors,Er=Object.getOwnPropertyNames,Ut=Object.getOwnPropertySymbols;var gn=Object.prototype.hasOwnProperty,lo=Object.prototype.propertyIsEnumerable;var so=(e,t,n)=>t in e?Gt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,K=(e,t)=>{for(var n in t||(t={}))gn.call(t,n)&&so(e,n,t[n]);if(Ut)for(var n of Ut(t))lo.call(t,n)&&so(e,n,t[n]);return e},le=(e,t)=>wr(e,Sr(t));var co=e=>typeof e=="symbol"?e:e+"",uo=(e,t)=>{var n={};for(var r in e)gn.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Ut)for(var r of Ut(e))t.indexOf(r)<0&&lo.call(e,r)&&(n[r]=e[r]);return n};var Tr=(e,t)=>()=>(e&&(t=e(e=0)),t);var Cr=(e,t)=>{for(var n in t)Gt(e,n,{get:t[n],enumerable:!0})},Lr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Er(t))!gn.call(e,s)&&s!==n&&Gt(e,s,{get:()=>t[s],enumerable:!(r=kr(t,s))||r.enumerable});return e};var _r=e=>Lr(Gt({},"__esModule",{value:!0}),e);var Ir,Ar,$r,po,Br,Or,fo,de,lt,mn=Tr(()=>{"use strict";Ir=Object.defineProperty,Ar=Object.defineProperties,$r=Object.getOwnPropertyDescriptors,po=Object.getOwnPropertySymbols,Br=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,fo=(e,t,n)=>t in e?Ir(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,de=(e,t)=>{for(var n in t||(t={}))Br.call(t,n)&&fo(e,n,t[n]);if(po)for(var n of po(t))Or.call(t,n)&&fo(e,n,t[n]);return e},lt=(e,t)=>Ar(e,$r(t))});var $i={};Cr($i,{buildStyleOps:()=>Mn,clearTargetHighlights:()=>mt,computeMoveAnchors:()=>Qt,deriveSlotId:()=>Ce,drawTargetHighlights:()=>tr,exchangeCode:()=>Qo,isHex6:()=>Pn,mount:()=>rr,registerAuditTargets:()=>er,sectionTypesFor:()=>nr,styleFieldError:()=>or,toHexColor:()=>$n});var go;function mo(e=document){if(go)return go;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 It(e,t=document){let n=mo(t);return n&&e.setAttribute("nonce",n),e}var Mi=1800*1e3;var hn=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Mr(e){var n,r,s;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(s=t==null?void 0:t.pathname)!=null?s:""}function Nr(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(),s=t.text.replace(/\s+/g," ").trim().toLowerCase();if(!(r===s||r.startsWith(s)||s.startsWith(r)))return!1}return!0}var Pr=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function Rr(e,t){var r;let n=[];if(e.id){let s=t.getElementById(e.id);n=s?[s]:[]}if(n.length===0&&((r=e.dataAttr)!=null&&r.name)&&Pr.test(e.dataAttr.name))try{let s=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${s}"]`))}catch(s){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(s){n=[]}return n}function we(e,t){if(e.urlMatch&&!Mr(t).includes(e.urlMatch))return null;let n=Rr(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Nr(r,e.fingerprint)?null:r}var At={color:"color",background:"background",fontSize:"font-size",fontWeight:"font-weight",textAlign:"text-align",padding:"padding",margin:"margin",borderRadius:"border-radius",width:"width",height:"height",maxWidth:"max-width",border:"border",boxShadow:"box-shadow",opacity:"opacity",lineHeight:"line-height",letterSpacing:"letter-spacing",textTransform:"text-transform",gap:"gap",fontFamily:"font-family"},Dr=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function ct(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(!Dr.test((r=n[1])!=null?r:""))return!1;return!0}function yn(e){var r,s;let t=e.ownerDocument.createTreeWalker(e,4),n=null;for(let c=t.nextNode();c!==null;c=t.nextNode()){if(((r=c.nodeValue)!=null?r:"").trim()==="")continue;let m=(s=c.parentElement)==null?void 0:s.tagName;if(!(m==="SCRIPT"||m==="STYLE"||m==="TEMPLATE")){if(n!==null)return null;n=c}}return n}function bn(e){return e.childElementCount===0||yn(e)!==null}function vn(e){var t,n,r;return(r=(n=(t=yn(e))==null?void 0:t.nodeValue)!=null?n:e.textContent)!=null?r:""}function Ye(e,t){let n=yn(e);n!==null?n.nodeValue=t:e.textContent=t}var xn=/^https:\/\//i;function Ft(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(xn.test(e)||e[0]==="/"&&e[1]!=="/")?e:null}var ho=new Map,Re=null;function Hr(e){return e.replace(/["\\]/g,"\\$&")}function zr(e){var t;(!Re||!Re.isConnected)&&(Re=e.querySelector("style[data-sentient-ops]"),Re||(Re=It(e.createElement("style"),e),Re.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Re))),Re.textContent=[...ho.entries()].map(([n,r])=>`[data-snt-e="${Hr(n)}"]{${r}}`).join(`
2
- `)}function yo(e,t,n,r){var x;let s=!1,c=(x=t.moveBefore)!=null?x:t.moveAfter;if(c){let g=we(c,r);!g||g===e||g.parentElement!==e.parentElement||!e.parentElement?s=!0:t.moveBefore?e.parentElement.insertBefore(e,g):e.parentElement.insertBefore(e,g.nextSibling)}typeof t.text=="string"&&Ye(e,t.text),typeof t.href=="string"&&xn.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&xn.test(t.imageSrc)&&e.setAttribute("src",t.imageSrc),typeof t.imageAlt=="string"&&e.setAttribute("alt",t.imageAlt);let m=[];if(t.hidden&&m.push("display:none !important"),t.style)for(let[g,w]of Object.entries(t.style)){let b=At[g];b&&typeof w=="string"&&ct(w)&&m.push(`${b}:${w.trim()} !important`)}return m.length>0&&(e.setAttribute("data-snt-e",n),ho.set(n,m.join(";")),zr(r)),{anchorMiss:s}}var wn="data-sentient-block-arm",M=null;var Je=null;function wo(e){Je=e!=null?e:null}var ko=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},So=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},$t="data-sentient-blocks-hid",dt={none:"0",sm:"8px",md:"16px",lg:"24px"},kn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},bo={sm:"0.875em",md:"1em",lg:"1.25em"},jr={sm:"1.25em",md:"1.5em",lg:"2em"},Kr={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},vo={sm:"8px",md:"16px",lg:"32px"},Ur={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},Gr={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 xo(e){return e==="muted"?M!=null&&M.muted?{color:M.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:M==null?void 0:M.accent}:{}}function Eo(e,t){let n=Fr(e,t),r=So(e.like);return n&&r&&(n.style.color=r),n}function Fr(e,t){var n,r,s,c,m,x,g,w,b,B,L,H,S,z,J,Z,U,X,ne,Q;try{let N=ko(e.like),re=e.maxWidth==="measure"?"65ch":void 0,ie=I=>(I.className=N,he(I,{"max-width":re}));switch(e.type){case"stack":case"grid":{let I=t.createElement("div");if(e.type==="stack"){let O=e;he(I,{display:"flex","flex-direction":O.direction,gap:(r=dt[(n=O.gap)!=null?n:"md"])!=null?r:dt.md,"align-items":O.align?kn[O.align]:void 0,"justify-content":O.justify?kn[O.justify]:void 0,"flex-wrap":O.wrap?"wrap":void 0})}else{let O=e,V=(c=dt[(s=O.gap)!=null?s:"md"])!=null?c:dt.md;he(I,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${O.columns-1} * ${V}) / ${O.columns})), 1fr))`,gap:V,"align-items":O.align?kn[O.align]:void 0})}N&&(I.className=N);let P=!N&&e.type==="stack"&&e.surface==="raised",q=(m=e.pad)!=null?m:P?"md":void 0;q&&he(I,{padding:(x=dt[q])!=null?x:dt.md}),P&&he(I,{background:M==null?void 0:M.surface,color:M!=null&&M.surface?M==null?void 0:M.surfaceText:void 0,border:`1px solid ${(g=M==null?void 0:M.border)!=null?g:"currentColor"}`,"border-radius":(w=M==null?void 0:M.radius)!=null?w:"8px"});for(let O of(b=e.children)!=null?b:[]){let V=Eo(O,t);V&&I.appendChild(V)}return I}case"text":{let I=t.createElement("p");return I.textContent=e.value,N?ie(I):he(I,le(K({margin:"0","font-size":e.size?bo[e.size]:void 0,"font-weight":e.weight?Gr[e.weight]:void 0,"text-align":e.align},xo(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let I=t.createElement(`h${e.level}`);return I.textContent=e.value,N?ie(I):he(I,{margin:"0","font-size":jr[(B=e.size)!=null?B:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let I=t.createElement("a");I.textContent=e.label;let P=Ft(e.href);if(P&&(I.href=P),e.tag&&I.setAttribute("data-sentient-tag",e.tag),N)return ie(I);let q=(L=e.emphasis)!=null?L:"primary";return he(I,{display:"inline-block",padding:Kr[(H=e.size)!=null?H:"md"],"border-radius":(S=M==null?void 0:M.radius)!=null?S:"8px",font:"inherit","font-size":e.size?bo[e.size]:void 0,"text-decoration":q==="ghost"?"underline":"none",cursor:"pointer",background:q==="primary"?(z=M==null?void 0:M.primaryBg)!=null?z:"#111827":"transparent",color:q==="primary"?(J=M==null?void 0:M.primaryText)!=null?J:"#ffffff":(Z=M==null?void 0:M.accent)!=null?Z:"inherit",border:q==="secondary"?`1px solid ${(U=M==null?void 0:M.accent)!=null?U:"currentColor"}`:"none"})}case"link":{let I=t.createElement("a");I.textContent=e.label;let P=Ft(e.href);return P&&(I.href=P),e.tag&&I.setAttribute("data-sentient-tag",e.tag),N?ie(I):he(I,{color:"inherit","text-decoration":"underline"})}case"image":{let I=t.createElement("img"),P=Ft(e.src);return P&&(I.src=P),I.alt=e.alt,N&&(I.className=N),he(I,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?Ur[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let I=t.createElement("span");return I.textContent=e.value,N?ie(I):he(I,K({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(X=M==null?void 0:M.border)!=null?X:"currentColor"}`},xo(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(ne=vo[e.size])!=null?ne:vo.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(Q=M==null?void 0:M.border)!=null?Q:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(N){return null}}function To(e,t,n,r){var s,c;try{let m=new Set;for(let g of Array.from(e.children)){let w=g.getAttribute(wn);w!==null&&(t[w]===void 0?g.remove():m.add(w))}for(let[g,w]of Object.entries(t)){if(m.has(g))continue;let b="tree"in w?w:null,B=Eo(b?b.tree:w,r);if(!B)continue;let L=r.createElement("div");L.setAttribute(wn,g),L.style.display="none";let H=b?ko((s=b.surface)==null?void 0:s.like):void 0;if(H){let S=r.createElement("div");S.className=H;let z=So((c=b.surface)==null?void 0:c.like);z&&(S.style.color=z),S.appendChild(B),L.appendChild(S)}else L.appendChild(B);e.appendChild(L)}let x=n!==void 0&&t[n]!==void 0;for(let g of Array.from(e.children)){let w=g.getAttribute(wn),b=g;w!==null?b.style.display=x&&w===n?"":"none":x?b.hasAttribute($t)||(b.setAttribute($t,b.style.display),b.style.display="none"):b.hasAttribute($t)&&(b.style.display=b.getAttribute($t),b.removeAttribute($t))}}catch(m){}}var Wr=/(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)|#[0-9a-f]{3,8}\b/gi,qr=/^rgba?\(\s*[\d.]+[,\s]+[\d.]+[,\s]+[\d.]+(?:[,\s/]+[\d.]+%?)?\s*\)$/i,Bt;function Vr(e){if(Bt!==void 0)return Bt;try{let t=e.createElement("canvas");t.width=t.height=1,Bt=t.getContext("2d",{willReadFrequently:!0})}catch(t){Bt=null}return Bt}function ke(e,t){let n=(e!=null?e:"").trim();if(n===""||n==="transparent")return n==="transparent"?"rgba(0, 0, 0, 0)":"";if(qr.test(n)||/^#[0-9a-f]{3,8}$/i.test(n))return n;let r=Vr(t);if(!r)return"";try{if(r.fillStyle="#010203",r.fillStyle=n,String(r.fillStyle).toLowerCase()==="#010203"&&n.toLowerCase()!=="#010203")return"";r.clearRect(0,0,1,1),r.fillRect(0,0,1,1);let[s,c,m,x]=r.getImageData(0,0,1,1).data;return x===255?`rgb(${s}, ${c}, ${m})`:`rgba(${s}, ${c}, ${m}, ${Math.round(x/255*1e3)/1e3})`}catch(s){return""}}function Wt(e,t){var n;return!e||e==="none"||!/gradient/i.test(e)?[]:((n=e.match(Wr))!=null?n:[]).map(r=>ke(r,t)).filter(r=>r!=="")}mn();function _o(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function Co(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 Io(e){let t=e.join("");return Co(t,2166136261)+Co(t,1523705862)}var Yr=new Set(["A","BUTTON"]),Ao=/^H([1-6])$/,Jr=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]),Xr=new Set(["LABEL","FIGCAPTION","DT"]),Zr=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function $o(e){return Yr.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function Qr(e){if(Ao.test(e.tagName)||Jr.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function ei(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if($o(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||Qr(r))return r;return t}function Lo(e,t){var n,r;if(e)try{let s=new URL(e,(r=(n=t.location)==null?void 0:n.href)!=null?r:"https://relative.invalid/");return s.protocol!=="https:"&&s.protocol!=="http:"?void 0:t.location&&s.origin===t.location.origin?s.pathname:`${s.origin}${s.pathname}`}catch(s){return}}function Bo(e){return e===""||e==="transparent"||/rgba\([^)]*,\s*0\)$/.test(e)}function ti(e){let t=e.ownerDocument,n=t.defaultView;if(!n)return{bg:null};for(let r=e;r;r=r.parentElement){let s=n.getComputedStyle(r),c=Wt(s.backgroundImage,t);if(c.length>0)return de({bg:c[0]},c.length>1?{alt:c[c.length-1]}:{});let m=ke(s.backgroundColor,t);if(!Bo(m))return{bg:m}}return{bg:null}}function Sn(e,t=40){var n,r,s;let c=e.ownerDocument.createTreeWalker(e,4),m=[];for(let b=c.nextNode();b;b=c.nextNode())if(((n=b.nodeValue)!=null?n:"").trim()!==""&&!Zr.has((s=(r=b.parentElement)==null?void 0:r.tagName)!=null?s:"")&&(m.push(b),m.length>120))return{reason:"too_large"};if(m.length===0)return{reason:"empty"};let x=[],g=[];for(let b of m){let B=ei(b,e),L=x.indexOf(B);L===-1&&(x.push(B),L=x.length-1),g.push(L)}if(x.length>t)return{reason:"too_large"};let w=m.map(b=>{var B;return _o((B=b.nodeValue)!=null?B:"")});return{textNodes:m,ownerEls:x,leafToNode:g,leaves:w,fp:Io(w)}}function ni(e,t=40){var n;let r=Sn(e,t);if(!("fp"in r))return{skeleton:null,reason:r.reason};let{textNodes:s,ownerEls:c,leafToNode:m,leaves:x}=r,g=e.ownerDocument,w=g.defaultView,b=[],B=c.map((S,z)=>{var J,Z;let U=w==null?void 0:w.getComputedStyle(S),X=(J=S.parentElement)!=null?J:e,ne=b.indexOf(X);ne===-1&&(b.push(X),ne=b.length-1);let Q=Ao.exec(S.tagName),N=$o(S)?"action":Q?"heading":Xr.has(S.tagName)?"label":"text",re=_o(x.filter((ie,I)=>m[I]===z).join(" "));return lt(de(lt(de({tag:S.tagName.toLowerCase(),role:N},Q?{level:Number(Q[1])}:{}),{text:re,classes:((Z=S.getAttribute("class"))!=null?Z:"").replace(/\s+/g," ").trim()}),N==="action"?de({filled:!!U&&(!Bo(ke(U.backgroundColor,e.ownerDocument))||U.backgroundImage!==""&&U.backgroundImage!=="none")},Lo(S.getAttribute("href"),g)!==void 0?{href:Lo(S.getAttribute("href"),g)}:{}):{}),{color:ke(U==null?void 0:U.color,e.ownerDocument),group:ne,restylable:!0})}),L=ti(e),H=w==null?void 0:w.getComputedStyle(e);return{skeleton:{v:1,root:lt(de({tag:e.tagName.toLowerCase(),classes:((n=e.getAttribute("class"))!=null?n:"").replace(/\s+/g," ").trim(),ambientBg:L.bg},L.alt?{ambientBgAlt:L.alt}:{}),{ambientText:ke(H==null?void 0:H.color,e.ownerDocument)}),nodes:B,leaves:x,leafToNode:m,fp:Io(x)},textNodes:s,ownerEls:c}}function Oo(e,t){try{let n=ni(e,t==null?void 0:t.maxNodes);return n.skeleton?{skeleton:n.skeleton}:n}catch(n){return{skeleton:null,reason:"unaddressable"}}}var Mo=new WeakMap;function No(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Po(e,t,n){var c,m,x;let r=Mo.get(e);if(r){if(r.fp!==n.fp||!No(r.leafToNode,n.leafToNode))return"mismatch"}else{let g=Sn(e);if(!("fp"in g)||(r={fp:g.fp,leafToNode:g.leafToNode,textNodes:g.textNodes,ownerEls:g.ownerEls,classes:g.ownerEls.map(w=>{var b;return(b=w.getAttribute("class"))!=null?b:""})},r.fp!==n.fp||!No(r.leafToNode,n.leafToNode)))return"mismatch";Mo.set(e,r)}let s=r;for(let[g,w]of Object.entries(t.nodes)){let b=Number(g),B=s.ownerEls[b];if(B){if(typeof w.text=="string"){let L=!0;s.leafToNode.forEach((H,S)=>{H===b&&(s.textNodes[S].nodeValue=L?w.text:"",L=!1)})}w.like!==void 0&&s.classes[w.like]!==void 0&&B.setAttribute("class",s.classes[w.like]),w.hidden&&((c=B.style)==null||c.setProperty("display","none","important"))}}for(let g of Object.values((m=t.order)!=null?m:{})){let w=g.map(S=>s.ownerEls[S]).filter(S=>!!S),b=(x=w[0])==null?void 0:x.parentElement;if(!b||w.length!==g.length||w.some(S=>S.parentElement!==b))continue;let B=new Set(w),L=0;Array.from(b.children).map(S=>B.has(S)?w[L++]:S).forEach((S,z)=>{var J;b.children[z]!==S&&b.insertBefore(S,(J=b.children[z])!=null?J:null)})}return"applied"}mn();var oi=4,ri=new Set(["inline-block","block","flex","inline-flex"]),Ro={H1:"heading-1",H2:"heading-2",H3:"heading-3"},Ot=null;function He(e){let t=Ot?ke(e,Ot):e,n=/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+%?))?\s*\)/i.exec(t);if(!n)return null;let r=n[4]===void 0?1:n[4].endsWith("%")?Number.parseFloat(n[4])/100:Number(n[4]);return{r:Number(n[1]),g:Number(n[2]),b:Number(n[3]),a:r}}function Vt(e){let t=n=>{let r=n/255;return r<=.03928?r/12.92:((r+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function En(e,t){let[n,r]=[Vt(e),Vt(t)].sort((s,c)=>c-s);return(n+.05)/(r+.05)}var Yt=e=>{let t=He(e);return t!==null&&t.a>0};function Tn(e){return Ot?Wt(e,Ot):[]}var De=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0};function Do(e,t){for(let n=e;n;n=n.parentElement){let r=t.getComputedStyle(n);if(Yt(r.backgroundColor))return He(r.backgroundColor);let s=Tn(r.backgroundImage);if(s.length>0)return He(s[0])}return{r:255,g:255,b:255,a:1}}var ii='#CybotCookiebotDialog, #onetrust-consent-sdk, #usercentrics-root, #usercentrics-cmp-ui, .cky-consent-container, .cky-modal, #didomi-host, #qc-cmp2-container, #cmplz-cookiebanner-container, .cc-window, #cc-main, #iubenda-cs-banner, #truste-consent-track, [id^="sp_message_container"], #termly-code-snippet-support';function ai(e,t,n){if(e.closest(ii))return!0;for(let r=e;r&&r!==e.ownerDocument.body;r=r.parentElement){let s=t.getComputedStyle(r).position;if(s==="fixed"||s==="sticky"){let c=r.getBoundingClientRect().width;return c>0&&n>0&&c<.6*n}}return!1}function qt(e){var t;for(let n of Array.from(e.childNodes))if(n.nodeType===3&&((t=n.nodeValue)!=null?t:"").trim()!=="")return!0;return!1}function si(e,t,n){var r;let s=e.tagName,c=De(t.fontSize)||n.bodySize,m=Number(t.fontWeight)||400,x=Yt(t.backgroundColor),g=Tn(t.backgroundImage).length>0,w=De(t.borderTopLeftRadius||t.borderRadius),b=e.getBoundingClientRect().width;if(s==="BUTTON"||e.getAttribute("role")==="button"||s==="INPUT"&&/^(submit|button)$/i.test(e.type)||s==="A"&&ri.has(t.display)&&De(t.paddingLeft)>=8){if(((r=e.textContent)!=null?r:"").trim()==="")return null;let L=He(t.backgroundColor),H=e.parentElement?Do(e.parentElement,n.view):n.pageBg;return x&&L&&L.a>=.9&&En(L,H)>=1.5?"button-primary":x||De(t.borderTopWidth)>0?"button-secondary":"button-ghost"}if(s==="A")return"link";if(Ro[s])return Ro[s];if(qt(e)&&c>=1.8*n.bodySize&&m>=600)return c>=2.5*n.bodySize?"heading-1":c>=2*n.bodySize?"heading-2":"heading-3";let B=e.nextElementSibling;if(qt(e)&&c<=.9*n.bodySize&&(t.textTransform==="uppercase"||De(t.letterSpacing)>.05*c)&&B!==null&&/^H[1-4]$/.test(B.tagName))return"eyebrow";if(s==="UL"||s==="OL")return e.querySelectorAll(":scope > li").length>=2?"list":null;if(s==="P"&&qt(e)){if(c>=1.1*n.bodySize)return"text-lead";if(c<=.85*n.bodySize)return"text-small";let L=He(t.color);return L&&En(L,Do(e,n.view))<n.bodyContrast*.8?"text-muted":"text-body"}return(s==="SPAN"||s==="DIV")&&x&&qt(e)&&e.children.length===0&&w>=999?"badge":/^(DIV|ARTICLE|LI|SECTION|ASIDE)$/.test(s)&&(x||g)&&w>0&&De(t.paddingTop)>=16&&!(b>0&&b>=.9*n.vw)?"card":/^(SECTION|DIV|HEADER|MAIN|ASIDE)$/.test(s)&&(x||g)&&e.querySelector("h1,h2,h3")!==null&&(b===0||b>=.9*n.vw)?"section":null}function Ho(e,t){var n,r,s,c,m,x,g,w,b;let B=e.defaultView;if(!B||!e.body)return{entries:[],images:[]};Ot=e;let L=B.getComputedStyle(e.body),H=De(L.fontSize)||16,S=Yt(L.backgroundColor)?He(L.backgroundColor):{r:255,g:255,b:255,a:1},z=(n=He(L.color))!=null?n:{r:17,g:24,b:39,a:1},J={bodySize:H,pageBg:S,bodyContrast:En(z,S),view:B,vw:B.innerWidth||0},Z=(s=(r=B.location)==null?void 0:r.pathname)!=null?s:"/",U=new Date().toISOString(),X=new Map,ne=new Map,Q=new Map,N=Array.from(e.body.querySelectorAll("*")).slice(0,(c=t==null?void 0:t.maxElements)!=null?c:4e3);for(let P of N)try{if(P.tagName==="IMG"){let ee=P,Ae=((m=ee.getAttribute("alt"))!=null?m:"").trim(),Y=ee.naturalWidth||Number(ee.getAttribute("width"))||0,et=ee.naturalHeight||Number(ee.getAttribute("height"))||0,ve=ee.getAttribute("src");if(Ae&&Y>=200&&ve){let $e=new URL(ve,e.baseURI).href;$e.startsWith("https://")&&!Q.has($e)&&Q.set($e,{id:`img-${Q.size+1}`,src:$e,alt:Ae.slice(0,200),w:Y,h:et,seenOn:Z})}}let q=((x=P.getAttribute("class"))!=null?x:"").replace(/\s+/g," ").trim();if(q===""||ai(P,B,J.vw))continue;let O=B.getComputedStyle(P),V=P.tagName==="IMG"?((g=P.getAttribute("alt"))!=null?g:"").trim()?"image":null:si(P,O,J);if(!V)continue;let Se=`${V}|${q}`,ze=P.getBoundingClientRect();ne.set(Se,Math.max((w=ne.get(Se))!=null?w:0,ze.width*ze.height));let Ie=X.get(Se);if(Ie){Ie.seen.count++;continue}let ye=Tn(O.backgroundImage).map(He).filter(ee=>ee!==null),ue,je;if(Yt(O.backgroundColor))ue=ke(O.backgroundColor,e);else if(ye.length>0){let ee=[...ye].sort((Y,et)=>Vt(Y)-Vt(et)),Ae=Y=>Y.a<1?`rgba(${Y.r}, ${Y.g}, ${Y.b}, ${Y.a})`:`rgb(${Y.r}, ${Y.g}, ${Y.b})`;ue=Ae(ee[0]),ee.length>1&&(je=Ae(ee[ee.length-1]))}let pe=O.borderTopLeftRadius||O.borderRadius;X.set(Se,{id:V,role:V,classes:q,computed:de(de(de(de(de(de(de({},ke(O.color,e)?{color:ke(O.color,e)}:{}),P.parentElement&&B.getComputedStyle(P.parentElement).color===O.color?{inheritsColor:!0}:{}),ue?{bg:ue}:{}),je?{bgDark:je}:{}),O.fontSize?{fontSize:O.fontSize}:{}),O.fontWeight?{fontWeight:O.fontWeight}:{}),pe&&De(pe)>0?{radius:pe}:{}),seen:{url:Z,count:1,at:U}})}catch(q){}let re=new Map;for(let P of X.values())re.set(P.role,[...(b=re.get(P.role))!=null?b:[],P]);let ie=[],I=P=>{var q;return(q=ne.get(`${P.role}|${P.classes}`))!=null?q:0};for(let[P,q]of re)q.sort((O,V)=>(P.startsWith("button-")?I(V)-I(O):0)||V.seen.count-O.seen.count).slice(0,oi).forEach((O,V)=>ie.push(lt(de({},O),{id:V===0?P:`${P}-${V+1}`})));return{entries:ie,images:[...Q.values()]}}function zo(e){let t=globalThis;if(t.CSS&&typeof t.CSS.escape=="function")return t.CSS.escape(e);let n="";for(let r=0;r<e.length;r++){let s=e[r],c=s>="0"&&s<="9";r===0&&c||r===1&&c&&e[0]==="-"?n+=`\\3${s} `:r===0&&s==="-"&&e.length===1?n+="\\-":/[a-zA-Z0-9_-]/.test(s)?n+=s:n+=`\\${s}`}return n}function li(e,t){if(e.id)return`#${zo(e.id)}`;let n=[],r=e,s=0;for(;r&&r!==t.body&&r!==t.documentElement&&s<6;){if(r.id){n.unshift(`#${zo(r.id)}`);break}let c=r.tagName.toLowerCase(),m=r.parentElement;if(m){let x=Array.from(m.children).filter(g=>g.tagName===r.tagName);x.length>1&&(c+=`:nth-of-type(${x.indexOf(r)+1})`)}n.unshift(c),r=r.parentElement,s++}return n.join(" > ")}function Xe(e,t){var s;let n={v:1};e.id&&(n.id=e.id);for(let c of["data-framer-name","data-w-id","data-sentient-name"]){let m=e.getAttribute(c);if(m){n.dataAttr={name:c,value:m};break}}n.selector=li(e,t);let r=((s=e.textContent)!=null?s:"").trim().replace(/\s+/g," ").slice(0,80);return n.fingerprint=K({tag:e.tagName.toLowerCase()},r?{text:r}:{}),n}function ut(e,t,n){return we(e,n)===t}var jo="__snt_editor_token";function Ko(e){try{sessionStorage.setItem(jo,e)}catch(t){}}function Mt(){try{sessionStorage.removeItem(jo)}catch(e){}}var ci=/rgba\([^)]*,\s*0\s*\)$/,di=/^\d+(\.\d+)?px$/;function Uo(e){var t,n;try{let r=e.defaultView;if(!r||!e.body)return null;let s=r.getComputedStyle(e.body).backgroundColor,c=e.querySelectorAll('button, [role="button"], input[type="submit"], a[class*="btn" i], a[class*="button" i]'),m=new Map;for(let L of Array.from(c).slice(0,300)){let H=L.getBoundingClientRect();if(H.width>0&&(H.width<48||H.height<24))continue;let S=r.getComputedStyle(L),z=S.backgroundColor;if(!z||z==="transparent"||z===s||ci.test(z))continue;let J=(t=(S.borderRadius||"").split(" ")[0])!=null?t:"",Z=`${z}|${S.color}|${di.test(J)?J:"8px"}`;m.set(Z,((n=m.get(Z))!=null?n:0)+1)}let x=null,g=0;for(let[L,H]of m)H>g&&(x=L,g=H);if(!x)return null;let[w,b,B]=x.split("|");return{primaryBg:w,primaryText:b,radius:B}}catch(r){return null}}function Nt(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function Go(e,t){return e==="*"?"Every page":e.endsWith("/*")?`All pages under ${e.slice(0,-1)}`:e===t?`This page (${e})`:`Only on ${e}`}function Cn(e,t){let n=Nt(e),r=n.split("/").filter(Boolean),s=[n,"*"];return r.length>=2&&s.push(`/${r[0]}/*`),(t?[t,...s.filter(c=>c!==t)]:s).filter(c=>hn.test(c))}function Jt(e){let t=e.steps.length,n=e.status==="active"?"":` (${e.status})`;return`${e.display_name} \u2014 ${t} step${t===1?"":"s"}${n}`}function Xt(e,t){return e.steps.map(n=>{var r;return{value:n.step_index,label:`${n.step_index+1}. ${(r=t.get(n.goal_id))!=null?r:n.goal_id}`}})}function Fo(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function ui(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"funnel"}function Wo(e,t){let n=e.trim();return n?t.length<2?{ok:!1,error:"Pick at least 2 goals \u2014 a funnel is a sequence."}:t.length>12?{ok:!1,error:"A funnel can have at most 12 steps."}:{ok:!0,funnelId:ui(n),body:{displayName:n.slice(0,128),steps:t.map(r=>({goalId:r}))}}:{ok:!1,error:"Give the funnel a name."}}function Xo(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return t.toString(36)}function pt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function Ce(e,t,n){var x,g;let r=t.id||((x=t.dataAttr)==null?void 0:x.value)||((g=n.textContent)!=null?g:"").trim()||n.tagName,s=pt(r)||"el",c=Xo(JSON.stringify(t));return`${e}-${s}-${c}`.slice(0,128)}var pi="sentient-editor-highlight",fi="sentient-editor-selection",gt="sentient-editor-panel",en="sentient-editor-toast",_n="sentient-editor-styles",In="sentient-editor-target-highlight",gi=10,qo="Editor session expired. Reopen it from your dashboard to keep editing \u2014 your saved changes are safe.",Vo="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.";function Zo(){var t;if(document.getElementById(_n))return;let e=It(document.createElement("style"));e.id=_n,e.textContent=`
1
+ "use strict";var __sentientEditorBundle=(()=>{var Ft=Object.defineProperty,kr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptor,Er=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertyNames,Gt=Object.getOwnPropertySymbols;var mn=Object.prototype.hasOwnProperty,co=Object.prototype.propertyIsEnumerable;var lo=(e,t,n)=>t in e?Ft(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,K=(e,t)=>{for(var n in t||(t={}))mn.call(t,n)&&lo(e,n,t[n]);if(Gt)for(var n of Gt(t))co.call(t,n)&&lo(e,n,t[n]);return e},le=(e,t)=>kr(e,Er(t));var uo=e=>typeof e=="symbol"?e:e+"",po=(e,t)=>{var n={};for(var r in e)mn.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Gt)for(var r of Gt(e))t.indexOf(r)<0&&co.call(e,r)&&(n[r]=e[r]);return n};var Tr=(e,t)=>()=>(e&&(t=e(e=0)),t);var Lr=(e,t)=>{for(var n in t)Ft(e,n,{get:t[n],enumerable:!0})},_r=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Cr(t))!mn.call(e,s)&&s!==n&&Ft(e,s,{get:()=>t[s],enumerable:!(r=Sr(t,s))||r.enumerable});return e};var Ir=e=>_r(Ft({},"__esModule",{value:!0}),e);var Ar,$r,Br,fo,Or,Mr,go,de,lt,hn=Tr(()=>{"use strict";Ar=Object.defineProperty,$r=Object.defineProperties,Br=Object.getOwnPropertyDescriptors,fo=Object.getOwnPropertySymbols,Or=Object.prototype.hasOwnProperty,Mr=Object.prototype.propertyIsEnumerable,go=(e,t,n)=>t in e?Ar(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,de=(e,t)=>{for(var n in t||(t={}))Or.call(t,n)&&go(e,n,t[n]);if(fo)for(var n of fo(t))Mr.call(t,n)&&go(e,n,t[n]);return e},lt=(e,t)=>$r(e,Br(t))});var Bi={};Lr(Bi,{buildStyleOps:()=>Pn,clearTargetHighlights:()=>mt,computeMoveAnchors:()=>en,deriveSlotId:()=>Te,drawTargetHighlights:()=>nr,exchangeCode:()=>er,isHex6:()=>Rn,mount:()=>ir,registerAuditTargets:()=>tr,sectionTypesFor:()=>or,styleFieldError:()=>rr,toHexColor:()=>Bn});var mo;function ho(e=document){if(mo)return mo;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 It(e,t=document){let n=ho(t);return n&&e.setAttribute("nonce",n),e}var Pi=1800*1e3;var yn=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Pr(e){var n,r,s;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(s=t==null?void 0:t.pathname)!=null?s:""}function Nr(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(),s=t.text.replace(/\s+/g," ").trim().toLowerCase();if(!(r===s||r.startsWith(s)||s.startsWith(r)))return!1}return!0}var Rr=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function Dr(e,t){var r;let n=[];if(e.id){let s=t.getElementById(e.id);n=s?[s]:[]}if(n.length===0&&((r=e.dataAttr)!=null&&r.name)&&Rr.test(e.dataAttr.name))try{let s=e.dataAttr.value.replace(/["\\]/g,"\\$&");n=Array.from(t.querySelectorAll(`[${e.dataAttr.name}="${s}"]`))}catch(s){n=[]}if(n.length===0&&e.selector)try{n=Array.from(t.querySelectorAll(e.selector))}catch(s){n=[]}return n}function we(e,t){if(e.urlMatch&&!Pr(t).includes(e.urlMatch))return null;let n=Dr(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Nr(r,e.fingerprint)?null:r}var At={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"},Hr=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function ct(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(!Hr.test((r=n[1])!=null?r:""))return!1;return!0}function bn(e){var r,s;let t=e.ownerDocument.createTreeWalker(e,4),n=null;for(let c=t.nextNode();c!==null;c=t.nextNode()){if(((r=c.nodeValue)!=null?r:"").trim()==="")continue;let m=(s=c.parentElement)==null?void 0:s.tagName;if(!(m==="SCRIPT"||m==="STYLE"||m==="TEMPLATE")){if(n!==null)return null;n=c}}return n}function vn(e){return e.childElementCount===0||bn(e)!==null}function xn(e){var t,n,r;return(r=(n=(t=bn(e))==null?void 0:t.nodeValue)!=null?n:e.textContent)!=null?r:""}function Ye(e,t){let n=bn(e);n!==null?n.nodeValue=t:e.textContent=t}var wn=/^https:\/\//i;function Wt(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(wn.test(e)||e[0]==="/"&&e[1]!=="/")?e:null}var yo=new Map,Re=null;function zr(e){return e.replace(/["\\]/g,"\\$&")}function jr(e){var t;(!Re||!Re.isConnected)&&(Re=e.querySelector("style[data-sentient-ops]"),Re||(Re=It(e.createElement("style"),e),Re.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Re))),Re.textContent=[...yo.entries()].map(([n,r])=>`[data-snt-e="${zr(n)}"]{${r}}`).join(`
2
+ `)}function bo(e,t,n,r){var x;let s=!1,c=(x=t.moveBefore)!=null?x:t.moveAfter;if(c){let g=we(c,r);!g||g===e||g.parentElement!==e.parentElement||!e.parentElement?s=!0:t.moveBefore?e.parentElement.insertBefore(e,g):e.parentElement.insertBefore(e,g.nextSibling)}typeof t.text=="string"&&Ye(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 m=[];if(t.hidden&&m.push("display:none !important"),t.style)for(let[g,k]of Object.entries(t.style)){let y=At[g];y&&typeof k=="string"&&ct(k)&&m.push(`${y}:${k.trim()} !important`)}return m.length>0&&(e.setAttribute("data-snt-e",n),yo.set(n,m.join(";")),jr(r)),{anchorMiss:s}}var kn="data-sentient-block-arm",O=null;var Je=null;function ko(e){Je=e!=null?e:null}var So=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},Eo=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},$t="data-sentient-blocks-hid",dt={none:"0",sm:"8px",md:"16px",lg:"24px"},Sn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},vo={sm:"0.875em",md:"1em",lg:"1.25em"},Kr={sm:"1.25em",md:"1.5em",lg:"2em"},Ur={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},xo={sm:"8px",md:"16px",lg:"32px"},Gr={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},Fr={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 wo(e){return e==="muted"?O!=null&&O.muted?{color:O.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:O==null?void 0:O.accent}:{}}function Co(e,t){let n=Wr(e,t),r=Eo(e.like);return n&&r&&(n.style.color=r),n}function Wr(e,t){var n,r,s,c,m,x,g,k,y,$,L,D,E,z,J,Z,G,X,ne,Q;try{let M=So(e.like),re=e.maxWidth==="measure"?"65ch":void 0,ie=A=>(A.className=M,he(A,{"max-width":re}));switch(e.type){case"stack":case"grid":{let A=t.createElement("div");if(e.type==="stack"){let B=e;he(A,{display:"flex","flex-direction":B.direction,gap:(r=dt[(n=B.gap)!=null?n:"md"])!=null?r:dt.md,"align-items":B.align?Sn[B.align]:void 0,"justify-content":B.justify?Sn[B.justify]:void 0,"flex-wrap":B.wrap?"wrap":void 0})}else{let B=e,V=(c=dt[(s=B.gap)!=null?s:"md"])!=null?c:dt.md;he(A,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${B.columns-1} * ${V}) / ${B.columns})), 1fr))`,gap:V,"align-items":B.align?Sn[B.align]:void 0})}M&&(A.className=M);let P=!M&&e.type==="stack"&&e.surface==="raised",q=(m=e.pad)!=null?m:P?"md":void 0;q&&he(A,{padding:(x=dt[q])!=null?x:dt.md}),P&&he(A,{background:O==null?void 0:O.surface,color:O!=null&&O.surface?O==null?void 0:O.surfaceText:void 0,border:`1px solid ${(g=O==null?void 0:O.border)!=null?g:"currentColor"}`,"border-radius":(k=O==null?void 0:O.radius)!=null?k:"8px"});for(let B of(y=e.children)!=null?y:[]){let V=Co(B,t);V&&A.appendChild(V)}return A}case"text":{let A=t.createElement("p");return A.textContent=e.value,M?ie(A):he(A,le(K({margin:"0","font-size":e.size?vo[e.size]:void 0,"font-weight":e.weight?Fr[e.weight]:void 0,"text-align":e.align},wo(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let A=t.createElement(`h${e.level}`);return A.textContent=e.value,M?ie(A):he(A,{margin:"0","font-size":Kr[($=e.size)!=null?$:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let A=t.createElement("a");A.textContent=e.label;let P=Wt(e.href);if(P&&(A.href=P),e.tag&&A.setAttribute("data-sentient-tag",e.tag),M)return ie(A);let q=(L=e.emphasis)!=null?L:"primary";return he(A,{display:"inline-block",padding:Ur[(D=e.size)!=null?D:"md"],"border-radius":(E=O==null?void 0:O.radius)!=null?E:"8px",font:"inherit","font-size":e.size?vo[e.size]:void 0,"text-decoration":q==="ghost"?"underline":"none",cursor:"pointer",background:q==="primary"?(z=O==null?void 0:O.primaryBg)!=null?z:"#111827":"transparent",color:q==="primary"?(J=O==null?void 0:O.primaryText)!=null?J:"#ffffff":(Z=O==null?void 0:O.accent)!=null?Z:"inherit",border:q==="secondary"?`1px solid ${(G=O==null?void 0:O.accent)!=null?G:"currentColor"}`:"none"})}case"link":{let A=t.createElement("a");A.textContent=e.label;let P=Wt(e.href);return P&&(A.href=P),e.tag&&A.setAttribute("data-sentient-tag",e.tag),M?ie(A):he(A,{color:"inherit","text-decoration":"underline"})}case"image":{let A=t.createElement("img"),P=Wt(e.src);return P&&(A.src=P),A.alt=e.alt,M&&(A.className=M),he(A,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?Gr[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let A=t.createElement("span");return A.textContent=e.value,M?ie(A):he(A,K({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(X=O==null?void 0:O.border)!=null?X:"currentColor"}`},wo(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(ne=xo[e.size])!=null?ne:xo.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(Q=O==null?void 0:O.border)!=null?Q:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(M){return null}}function To(e,t,n,r){var s,c;try{let m=new Set;for(let g of Array.from(e.children)){let k=g.getAttribute(kn);k!==null&&(t[k]===void 0?g.remove():m.add(k))}for(let[g,k]of Object.entries(t)){if(m.has(g))continue;let y="tree"in k?k:null,$=Co(y?y.tree:k,r);if(!$)continue;let L=r.createElement("div");L.setAttribute(kn,g),L.style.display="none";let D=y?So((s=y.surface)==null?void 0:s.like):void 0;if(D){let E=r.createElement("div");E.className=D;let z=Eo((c=y.surface)==null?void 0:c.like);z&&(E.style.color=z),E.appendChild($),L.appendChild(E)}else L.appendChild($);e.appendChild(L)}let x=n!==void 0&&t[n]!==void 0;for(let g of Array.from(e.children)){let k=g.getAttribute(kn),y=g;k!==null?y.style.display=x&&k===n?"":"none":x?y.hasAttribute($t)||(y.setAttribute($t,y.style.display),y.style.display="none"):y.hasAttribute($t)&&(y.style.display=y.getAttribute($t),y.removeAttribute($t))}}catch(m){}}var qr=/(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^()]*\)|#[0-9a-f]{3,8}\b/gi,Vr=/^rgba?\(\s*[\d.]+[,\s]+[\d.]+[,\s]+[\d.]+(?:[,\s/]+[\d.]+%?)?\s*\)$/i,Bt;function Yr(e){if(Bt!==void 0)return Bt;try{let t=e.createElement("canvas");t.width=t.height=1,Bt=t.getContext("2d",{willReadFrequently:!0})}catch(t){Bt=null}return Bt}function ke(e,t){let n=(e!=null?e:"").trim();if(n===""||n==="transparent")return n==="transparent"?"rgba(0, 0, 0, 0)":"";if(Vr.test(n)||/^#[0-9a-f]{3,8}$/i.test(n))return n;let r=Yr(t);if(!r)return"";try{if(r.fillStyle="#010203",r.fillStyle=n,String(r.fillStyle).toLowerCase()==="#010203"&&n.toLowerCase()!=="#010203")return"";r.clearRect(0,0,1,1),r.fillRect(0,0,1,1);let[s,c,m,x]=r.getImageData(0,0,1,1).data;return x===255?`rgb(${s}, ${c}, ${m})`:`rgba(${s}, ${c}, ${m}, ${Math.round(x/255*1e3)/1e3})`}catch(s){return""}}function qt(e,t){var n;return!e||e==="none"||!/gradient/i.test(e)?[]:((n=e.match(qr))!=null?n:[]).map(r=>ke(r,t)).filter(r=>r!=="")}hn();function Io(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function Lo(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 Ao(e){let t=e.join("");return Lo(t,2166136261)+Lo(t,1523705862)}var Jr=new Set(["A","BUTTON"]),$o=/^H([1-6])$/,Xr=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]),Zr=new Set(["LABEL","FIGCAPTION","DT"]),Qr=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function Bo(e){return Jr.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function ei(e){if($o.test(e.tagName)||Xr.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(Bo(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||ei(r))return r;return t}function _o(e,t){var n,r;if(e)try{let s=new URL(e,(r=(n=t.location)==null?void 0:n.href)!=null?r:"https://relative.invalid/");return s.protocol!=="https:"&&s.protocol!=="http:"?void 0:t.location&&s.origin===t.location.origin?s.pathname:`${s.origin}${s.pathname}`}catch(s){return}}function Oo(e){return e===""||e==="transparent"||/rgba\([^)]*,\s*0\)$/.test(e)}function ni(e){let t=e.ownerDocument,n=t.defaultView;if(!n)return{bg:null};for(let r=e;r;r=r.parentElement){let s=n.getComputedStyle(r),c=qt(s.backgroundImage,t);if(c.length>0)return de({bg:c[0]},c.length>1?{alt:c[c.length-1]}:{});let m=ke(s.backgroundColor,t);if(!Oo(m))return{bg:m}}return{bg:null}}function En(e,t=40){var n,r,s;let c=e.ownerDocument.createTreeWalker(e,4),m=[];for(let y=c.nextNode();y;y=c.nextNode())if(((n=y.nodeValue)!=null?n:"").trim()!==""&&!Qr.has((s=(r=y.parentElement)==null?void 0:r.tagName)!=null?s:"")&&(m.push(y),m.length>120))return{reason:"too_large"};if(m.length===0)return{reason:"empty"};let x=[],g=[];for(let y of m){let $=ti(y,e),L=x.indexOf($);L===-1&&(x.push($),L=x.length-1),g.push(L)}if(x.length>t)return{reason:"too_large"};let k=m.map(y=>{var $;return Io(($=y.nodeValue)!=null?$:"")});return{textNodes:m,ownerEls:x,leafToNode:g,leaves:k,fp:Ao(k)}}function oi(e,t=40){var n;let r=En(e,t);if(!("fp"in r))return{skeleton:null,reason:r.reason};let{textNodes:s,ownerEls:c,leafToNode:m,leaves:x}=r,g=e.ownerDocument,k=g.defaultView,y=[],$=c.map((E,z)=>{var J,Z;let G=k==null?void 0:k.getComputedStyle(E),X=(J=E.parentElement)!=null?J:e,ne=y.indexOf(X);ne===-1&&(y.push(X),ne=y.length-1);let Q=$o.exec(E.tagName),M=Bo(E)?"action":Q?"heading":Zr.has(E.tagName)?"label":"text",re=Io(x.filter((ie,A)=>m[A]===z).join(" "));return lt(de(lt(de({tag:E.tagName.toLowerCase(),role:M},Q?{level:Number(Q[1])}:{}),{text:re,classes:((Z=E.getAttribute("class"))!=null?Z:"").replace(/\s+/g," ").trim()}),M==="action"?de({filled:!!G&&(!Oo(ke(G.backgroundColor,e.ownerDocument))||G.backgroundImage!==""&&G.backgroundImage!=="none")},_o(E.getAttribute("href"),g)!==void 0?{href:_o(E.getAttribute("href"),g)}:{}):{}),{color:ke(G==null?void 0:G.color,e.ownerDocument),group:ne,restylable:!0})}),L=ni(e),D=k==null?void 0:k.getComputedStyle(e);return{skeleton:{v:1,root:lt(de({tag:e.tagName.toLowerCase(),classes:((n=e.getAttribute("class"))!=null?n:"").replace(/\s+/g," ").trim(),ambientBg:L.bg},L.alt?{ambientBgAlt:L.alt}:{}),{ambientText:ke(D==null?void 0:D.color,e.ownerDocument)}),nodes:$,leaves:x,leafToNode:m,fp:Ao(x)},textNodes:s,ownerEls:c}}function Mo(e,t){try{let n=oi(e,t==null?void 0:t.maxNodes);return n.skeleton?{skeleton:n.skeleton}:n}catch(n){return{skeleton:null,reason:"unaddressable"}}}var Po=new WeakMap;function No(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function Ro(e,t,n){var c,m,x;let r=Po.get(e);if(r){if(r.fp!==n.fp||!No(r.leafToNode,n.leafToNode))return"mismatch"}else{let g=En(e);if(!("fp"in g)||(r={fp:g.fp,leafToNode:g.leafToNode,textNodes:g.textNodes,ownerEls:g.ownerEls,classes:g.ownerEls.map(k=>{var y;return(y=k.getAttribute("class"))!=null?y:""})},r.fp!==n.fp||!No(r.leafToNode,n.leafToNode)))return"mismatch";Po.set(e,r)}let s=r;for(let[g,k]of Object.entries(t.nodes)){let y=Number(g),$=s.ownerEls[y];if($){if(typeof k.text=="string"){let L=!0;s.leafToNode.forEach((D,E)=>{D===y&&(s.textNodes[E].nodeValue=L?k.text:"",L=!1)})}k.like!==void 0&&s.classes[k.like]!==void 0&&$.setAttribute("class",s.classes[k.like]),k.hidden&&((c=$.style)==null||c.setProperty("display","none","important"))}}for(let g of Object.values((m=t.order)!=null?m:{})){let k=g.map(E=>s.ownerEls[E]).filter(E=>!!E),y=(x=k[0])==null?void 0:x.parentElement;if(!y||k.length!==g.length||k.some(E=>E.parentElement!==y))continue;let $=new Set(k),L=0;Array.from(y.children).map(E=>$.has(E)?k[L++]:E).forEach((E,z)=>{var J;y.children[z]!==E&&y.insertBefore(E,(J=y.children[z])!=null?J:null)})}return"applied"}hn();var ri=4,ii=new Set(["inline-block","block","flex","inline-flex"]),Do={H1:"heading-1",H2:"heading-2",H3:"heading-3"},Ot=null;function He(e){let t=Ot?ke(e,Ot):e,n=/rgba?\(\s*([\d.]+)[,\s]+([\d.]+)[,\s]+([\d.]+)(?:[,\s/]+([\d.]+%?))?\s*\)/i.exec(t);if(!n)return null;let r=n[4]===void 0?1:n[4].endsWith("%")?Number.parseFloat(n[4])/100:Number(n[4]);return{r:Number(n[1]),g:Number(n[2]),b:Number(n[3]),a:r}}function Yt(e){let t=n=>{let r=n/255;return r<=.03928?r/12.92:((r+.055)/1.055)**2.4};return .2126*t(e.r)+.7152*t(e.g)+.0722*t(e.b)}function Cn(e,t){let[n,r]=[Yt(e),Yt(t)].sort((s,c)=>c-s);return(n+.05)/(r+.05)}var Jt=e=>{let t=He(e);return t!==null&&t.a>0};function Tn(e){return Ot?qt(e,Ot):[]}var De=e=>{let t=Number.parseFloat(e);return Number.isFinite(t)?t:0};function Ho(e,t){for(let n=e;n;n=n.parentElement){let r=t.getComputedStyle(n);if(Jt(r.backgroundColor))return He(r.backgroundColor);let s=Tn(r.backgroundImage);if(s.length>0)return He(s[0])}return{r:255,g:255,b:255,a:1}}var ai='#CybotCookiebotDialog, #onetrust-consent-sdk, #usercentrics-root, #usercentrics-cmp-ui, .cky-consent-container, .cky-modal, #didomi-host, #qc-cmp2-container, #cmplz-cookiebanner-container, .cc-window, #cc-main, #iubenda-cs-banner, #truste-consent-track, [id^="sp_message_container"], #termly-code-snippet-support';function si(e,t,n){if(e.closest(ai))return!0;for(let r=e;r&&r!==e.ownerDocument.body;r=r.parentElement){let s=t.getComputedStyle(r).position;if(s==="fixed"||s==="sticky"){let c=r.getBoundingClientRect().width;return c>0&&n>0&&c<.6*n}}return!1}function Vt(e){var t;for(let n of Array.from(e.childNodes))if(n.nodeType===3&&((t=n.nodeValue)!=null?t:"").trim()!=="")return!0;return!1}function li(e,t,n){var r;let s=e.tagName,c=De(t.fontSize)||n.bodySize,m=Number(t.fontWeight)||400,x=Jt(t.backgroundColor),g=Tn(t.backgroundImage).length>0,k=De(t.borderTopLeftRadius||t.borderRadius),y=e.getBoundingClientRect().width;if(s==="BUTTON"||e.getAttribute("role")==="button"||s==="INPUT"&&/^(submit|button)$/i.test(e.type)||s==="A"&&ii.has(t.display)&&De(t.paddingLeft)>=8){if(((r=e.textContent)!=null?r:"").trim()==="")return null;let L=He(t.backgroundColor),D=e.parentElement?Ho(e.parentElement,n.view):n.pageBg;return x&&L&&L.a>=.9&&Cn(L,D)>=1.5?"button-primary":x||De(t.borderTopWidth)>0?"button-secondary":"button-ghost"}if(s==="A")return"link";if(Do[s])return Do[s];if(Vt(e)&&c>=1.8*n.bodySize&&m>=600)return c>=2.5*n.bodySize?"heading-1":c>=2*n.bodySize?"heading-2":"heading-3";let $=e.nextElementSibling;if(Vt(e)&&c<=.9*n.bodySize&&(t.textTransform==="uppercase"||De(t.letterSpacing)>.05*c)&&$!==null&&/^H[1-4]$/.test($.tagName))return"eyebrow";if(s==="UL"||s==="OL")return e.querySelectorAll(":scope > li").length>=2?"list":null;if(s==="P"&&Vt(e)){if(c>=1.1*n.bodySize)return"text-lead";if(c<=.85*n.bodySize)return"text-small";let L=He(t.color);return L&&Cn(L,Ho(e,n.view))<n.bodyContrast*.8?"text-muted":"text-body"}return(s==="SPAN"||s==="DIV")&&x&&Vt(e)&&e.children.length===0&&k>=999?"badge":/^(DIV|ARTICLE|LI|SECTION|ASIDE)$/.test(s)&&(x||g)&&k>0&&De(t.paddingTop)>=16&&!(y>0&&y>=.9*n.vw)?"card":/^(SECTION|DIV|HEADER|MAIN|ASIDE)$/.test(s)&&(x||g)&&e.querySelector("h1,h2,h3")!==null&&(y===0||y>=.9*n.vw)?"section":null}function zo(e,t){var n,r,s,c,m,x,g,k,y;let $=e.defaultView;if(!$||!e.body)return{entries:[],images:[]};Ot=e;let L=$.getComputedStyle(e.body),D=De(L.fontSize)||16,E=Jt(L.backgroundColor)?He(L.backgroundColor):{r:255,g:255,b:255,a:1},z=(n=He(L.color))!=null?n:{r:17,g:24,b:39,a:1},J={bodySize:D,pageBg:E,bodyContrast:Cn(z,E),view:$,vw:$.innerWidth||0},Z=(s=(r=$.location)==null?void 0:r.pathname)!=null?s:"/",G=new Date().toISOString(),X=new Map,ne=new Map,Q=new Map,M=Array.from(e.body.querySelectorAll("*")).slice(0,(c=t==null?void 0:t.maxElements)!=null?c:4e3);for(let P of M)try{if(P.tagName==="IMG"){let ee=P,Ae=((m=ee.getAttribute("alt"))!=null?m:"").trim(),Y=ee.naturalWidth||Number(ee.getAttribute("width"))||0,et=ee.naturalHeight||Number(ee.getAttribute("height"))||0,ve=ee.getAttribute("src");if(Ae&&Y>=200&&ve){let $e=new URL(ve,e.baseURI).href;$e.startsWith("https://")&&!Q.has($e)&&Q.set($e,{id:`img-${Q.size+1}`,src:$e,alt:Ae.slice(0,200),w:Y,h:et,seenOn:Z})}}let q=((x=P.getAttribute("class"))!=null?x:"").replace(/\s+/g," ").trim();if(q===""||si(P,$,J.vw))continue;let B=$.getComputedStyle(P),V=P.tagName==="IMG"?((g=P.getAttribute("alt"))!=null?g:"").trim()?"image":null:li(P,B,J);if(!V)continue;let Se=`${V}|${q}`,ze=P.getBoundingClientRect();ne.set(Se,Math.max((k=ne.get(Se))!=null?k:0,ze.width*ze.height));let Ie=X.get(Se);if(Ie){Ie.seen.count++;continue}let ye=Tn(B.backgroundImage).map(He).filter(ee=>ee!==null),ue,je;if(Jt(B.backgroundColor))ue=ke(B.backgroundColor,e);else if(ye.length>0){let ee=[...ye].sort((Y,et)=>Yt(Y)-Yt(et)),Ae=Y=>Y.a<1?`rgba(${Y.r}, ${Y.g}, ${Y.b}, ${Y.a})`:`rgb(${Y.r}, ${Y.g}, ${Y.b})`;ue=Ae(ee[0]),ee.length>1&&(je=Ae(ee[ee.length-1]))}let pe=B.borderTopLeftRadius||B.borderRadius;X.set(Se,{id:V,role:V,classes:q,computed:de(de(de(de(de(de(de({},ke(B.color,e)?{color:ke(B.color,e)}:{}),P.parentElement&&$.getComputedStyle(P.parentElement).color===B.color?{inheritsColor:!0}:{}),ue?{bg:ue}:{}),je?{bgDark:je}:{}),B.fontSize?{fontSize:B.fontSize}:{}),B.fontWeight?{fontWeight:B.fontWeight}:{}),pe&&De(pe)>0?{radius:pe}:{}),seen:{url:Z,count:1,at:G}})}catch(q){}let re=new Map;for(let P of X.values())re.set(P.role,[...(y=re.get(P.role))!=null?y:[],P]);let ie=[],A=P=>{var q;return(q=ne.get(`${P.role}|${P.classes}`))!=null?q:0};for(let[P,q]of re)q.sort((B,V)=>(P.startsWith("button-")?A(V)-A(B):0)||V.seen.count-B.seen.count).slice(0,ri).forEach((B,V)=>ie.push(lt(de({},B),{id:V===0?P:`${P}-${V+1}`})));return{entries:ie,images:[...Q.values()]}}function jo(e){let t=globalThis;if(t.CSS&&typeof t.CSS.escape=="function")return t.CSS.escape(e);let n="";for(let r=0;r<e.length;r++){let s=e[r],c=s>="0"&&s<="9";r===0&&c||r===1&&c&&e[0]==="-"?n+=`\\3${s} `:r===0&&s==="-"&&e.length===1?n+="\\-":/[a-zA-Z0-9_-]/.test(s)?n+=s:n+=`\\${s}`}return n}function ci(e,t){if(e.id)return`#${jo(e.id)}`;let n=[],r=e,s=0;for(;r&&r!==t.body&&r!==t.documentElement&&s<6;){if(r.id){n.unshift(`#${jo(r.id)}`);break}let c=r.tagName.toLowerCase(),m=r.parentElement;if(m){let x=Array.from(m.children).filter(g=>g.tagName===r.tagName);x.length>1&&(c+=`:nth-of-type(${x.indexOf(r)+1})`)}n.unshift(c),r=r.parentElement,s++}return n.join(" > ")}function Xe(e,t){var s;let n={v:1};e.id&&(n.id=e.id);for(let c of["data-framer-name","data-w-id","data-sentient-name"]){let m=e.getAttribute(c);if(m){n.dataAttr={name:c,value:m};break}}n.selector=ci(e,t);let r=((s=e.textContent)!=null?s:"").trim().replace(/\s+/g," ").slice(0,80);return n.fingerprint=K({tag:e.tagName.toLowerCase()},r?{text:r}:{}),n}function ut(e,t,n){return we(e,n)===t}var Ko="__snt_editor_token";function Uo(e){try{sessionStorage.setItem(Ko,e)}catch(t){}}function Mt(){try{sessionStorage.removeItem(Ko)}catch(e){}}var di=/rgba\([^)]*,\s*0\s*\)$/,ui=/^\d+(\.\d+)?px$/;function Go(e){var t,n;try{let r=e.defaultView;if(!r||!e.body)return null;let s=r.getComputedStyle(e.body).backgroundColor,c=e.querySelectorAll('button, [role="button"], input[type="submit"], a[class*="btn" i], a[class*="button" i]'),m=new Map;for(let L of Array.from(c).slice(0,300)){let D=L.getBoundingClientRect();if(D.width>0&&(D.width<48||D.height<24))continue;let E=r.getComputedStyle(L),z=E.backgroundColor;if(!z||z==="transparent"||z===s||di.test(z))continue;let J=(t=(E.borderRadius||"").split(" ")[0])!=null?t:"",Z=`${z}|${E.color}|${ui.test(J)?J:"8px"}`;m.set(Z,((n=m.get(Z))!=null?n:0)+1)}let x=null,g=0;for(let[L,D]of m)D>g&&(x=L,g=D);if(!x)return null;let[k,y,$]=x.split("|");return{primaryBg:k,primaryText:y,radius:$}}catch(r){return null}}function Pt(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function Fo(e,t){return e==="*"?"Every page":e.endsWith("/*")?`All pages under ${e.slice(0,-1)}`:e===t?`This page (${e})`:`Only on ${e}`}function Ln(e,t){let n=Pt(e),r=n.split("/").filter(Boolean),s=[n,"*"];return r.length>=2&&s.push(`/${r[0]}/*`),(t?[t,...s.filter(c=>c!==t)]:s).filter(c=>yn.test(c))}function Xt(e){let t=e.steps.length,n=e.status==="active"?"":` (${e.status})`;return`${e.display_name} \u2014 ${t} step${t===1?"":"s"}${n}`}function Zt(e,t){return e.steps.map(n=>{var r;return{value:n.step_index,label:`${n.step_index+1}. ${(r=t.get(n.goal_id))!=null?r:n.goal_id}`}})}function Wo(e,t){return e.includes(t)?e.filter(n=>n!==t):[...e,t]}function pi(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"funnel"}function qo(e,t){let n=e.trim();return n?t.length<2?{ok:!1,error:"Pick at least 2 goals \u2014 a funnel is a sequence."}:t.length>12?{ok:!1,error:"A funnel can have at most 12 steps."}:{ok:!0,funnelId:pi(n),body:{displayName:n.slice(0,128),steps:t.map(r=>({goalId:r}))}}:{ok:!1,error:"Give the funnel a name."}}function Zo(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)>>>0;return t.toString(36)}function pt(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,40)}function Te(e,t,n){var x,g;let r=t.id||((x=t.dataAttr)==null?void 0:x.value)||((g=n.textContent)!=null?g:"").trim()||n.tagName,s=pt(r)||"el",c=Zo(JSON.stringify(t));return`${e}-${s}-${c}`.slice(0,128)}var fi="sentient-editor-highlight",gi="sentient-editor-selection",gt="sentient-editor-panel",tn="sentient-editor-toast",In="sentient-editor-styles",An="sentient-editor-target-highlight",mi=10,Vo="Editor session expired. Reopen it from your dashboard to keep editing \u2014 your saved changes are safe.",Yo="Couldn\u2019t load the editor \u2014 check your connection and reopen it from your dashboard.";function Qo(){var t;if(document.getElementById(In))return;let e=It(document.createElement("style"));e.id=In,e.textContent=`
3
3
  @keyframes sntedi-in {
4
4
  from { opacity: 0; transform: translateY(28px) scale(0.94); }
5
5
  to { opacity: 1; transform: translateY(0) scale(1); }
@@ -17,18 +17,18 @@
17
17
  sntedi-attn 1.7s ease-in-out 0.42s 3;
18
18
  }
19
19
  #${gt} .sntedi-dot { animation: sntedi-dot 1.4s ease-in-out infinite; }
20
- #${en} { animation: sntedi-in 0.42s cubic-bezier(0.2,0.9,0.25,1.15) both; }
20
+ #${tn} { animation: sntedi-in 0.42s cubic-bezier(0.2,0.9,0.25,1.15) both; }
21
21
  @media (prefers-reduced-motion: reduce) {
22
- #${gt}, #${gt} .sntedi-dot, #${en} { animation: none !important; }
22
+ #${gt}, #${gt} .sntedi-dot, #${tn} { animation: none !important; }
23
23
  }
24
- `,((t=document.head)!=null?t:document.documentElement).appendChild(e)}function Zt(e){var r,s;Zo(),(r=document.getElementById(en))==null||r.remove();let t=d("div",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",maxWidth:"320px",padding:"14px 16px",borderRadius:"14px",background:"#111827",color:"#fff",font:"13px/1.45 system-ui, sans-serif",border:"1px solid rgba(245,158,11,0.6)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",display:"flex",gap:"10px",alignItems:"flex-start",cursor:"pointer"});t.id=en;let n=d("span",{width:"9px",height:"9px",marginTop:"4px",borderRadius:"50%",background:"#f59e0b",flex:"0 0 auto"});t.append(n,d("div",{},e)),((s=document.body)!=null?s:document.documentElement).appendChild(t),t.addEventListener("click",()=>t.remove()),setTimeout(()=>t.remove(),1e4)}function mi(){let e=window.__sentientEditor;return e&&typeof e.apiBase=="string"&&(typeof e.token=="string"||typeof e.code=="string")?e:null}async function Qo(e){try{let t=await fetch(`${e.apiBase}/v1/editor/exchange`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:e.code})}),n=t.ok?(await t.json()).token:null;return e.code=null,n?(e.token=n,Ko(n),200):t.ok?500:t.status}catch(t){return 0}}async function hi(e){try{let t=await fetch(`${e.apiBase}/v1/editor/verify`,{headers:{authorization:`Bearer ${e.token}`}});if(t.status===401)return{ok:!1,unauthorized:!0};if(!t.ok)return{ok:!1,unauthorized:!1};let n=(await t.json()).projectId;return n?{ok:!0,projectId:n}:{ok:!1,unauthorized:!1}}catch(t){return{ok:!1,unauthorized:!1}}}function Nn(e,t){return K(K(K(K({r:e===401?"expired":"error",status:e},typeof(t==null?void 0:t.error)=="string"?{code:t.error}:{}),typeof(t==null?void 0:t.message)=="string"?{message:t.message}:{}),typeof(t==null?void 0:t.feature)=="string"?{feature:t.feature}:{}),typeof(t==null?void 0:t.plan)=="string"?{plan:t.plan}:{})}async function ce(e,t,n){try{let r=await fetch(`${e.apiBase}${t}`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify(n)});if(r.ok)return{r:"ok"};let s=await r.json().catch(()=>null);return Nn(r.status,s)}catch(r){return{r:"error"}}}async function yi(e,t){try{let n=await fetch(`${e.apiBase}${t}`,{method:"DELETE",headers:{authorization:`Bearer ${e.token}`}});if(n.ok)return{r:"ok"};let r=await n.json().catch(()=>null);return Nn(n.status,r)}catch(n){return{r:"error"}}}async function bi(e,t,n){try{let r=await fetch(`${e.apiBase}${t}`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify(n)}),s=await r.json().catch(()=>null);return r.ok?{r:"ok",data:s,outcome:{r:"ok"}}:{r:r.status===401?"expired":"error",data:s,outcome:Nn(r.status,s)}}catch(r){return{r:"error",data:null,outcome:{r:"error"}}}}var An=[];function Pn(e){return/^#[0-9a-fA-F]{6}$/.test(e)}function $n(e){let t=e.trim();if(Pn(t))return t;let n=/^#([0-9a-fA-F]{3})$/.exec(t);if(n)return`#${n[1].split("").map(c=>c+c).join("")}`;let r=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/.exec(t);if(!r)return t;let s=c=>Math.min(255,Number(c)).toString(16).padStart(2,"0");return`#${s(r[1])}${s(r[2])}${s(r[3])}`}var Ze=null,Bn=[];function er(e){Bn=e}async function vi(e){try{let t=await fetch(`${e.apiBase}/v1/editor/targets`,{headers:{authorization:`Bearer ${e.token}`}});if(!t.ok)return[];let n=await t.json();return An=Array.isArray(n.fonts)?n.fonts.filter(r=>typeof r=="string"):[],Array.isArray(n.targets)?n.targets:[]}catch(t){return[]}}async function ft(e,t){try{let n=await fetch(`${e.apiBase}${t}`,{headers:{authorization:`Bearer ${e.token}`}});return n.ok?await n.json():null}catch(n){return null}}function mt(e=document){for(let t of Array.from(e.querySelectorAll(`.${In}`)))t.remove()}function tr(e,t=document){var r;mt(t);let n=0;for(let s of e){if(n>=gi)break;let c=we(s.locator,t);if(!c)continue;let m=c.getBoundingClientRect(),x=d("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483645",left:`${m.left}px`,top:`${m.top}px`,width:`${m.width}px`,height:`${m.height}px`,border:"2px dashed #10b981",background:"rgba(16,185,129,0.08)"});x.className=In;let g=d("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483645",left:`${m.left}px`,top:`${Math.max(0,m.top-20)}px`,padding:"2px 6px",borderRadius:"4px",background:"#10b981",color:"#fff",font:"11px system-ui, sans-serif",whiteSpace:"nowrap"},s.label);g.className=In,((r=t.body)!=null?r:t.documentElement).append(x,g),n+=1}}function Qt(e,t){let n=e.previousElementSibling,r=e.nextElementSibling,s=n?Xe(n,t):null,c=r?Xe(r,t):null;return{prevEl:n,nextEl:r,prevLocator:n&&s&&ut(s,n,t)?s:null,nextLocator:r&&c&&ut(c,r,t)?c:null}}var xi=/testimonial|review|quote/i;function nr(e){let t=[],n=e.headings.length>=1,r=e.links.length>=1;return n&&r&&t.push("hero","cta_band"),e.headings.length>=2&&e.paragraphs.length>=2&&t.push("feature_grid"),e.quotes.length>=1&&t.push("testimonial"),t}var On=["color","background","fontSize","fontWeight","borderRadius","textAlign","fontFamily"],wi=/^(0|\d*\.?\d+(px|rem|em|%|vh|vw|vmin|vmax|ch|pt))$/i,ki=new Set(["left","center","right","justify","start","end"]),Si=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ei=/^(rgb|rgba|hsl|hsla)\(/i;function Ti(e){return Si.test(e)||Ei.test(e)}function or(e,t){switch(e){case"fontSize":case"borderRadius":return wi.test(t)?null:"Add a unit, e.g. 20px or 1.5rem.";case"fontWeight":return/^(normal|bold|bolder|lighter)$/i.test(t)||/^\d{1,4}$/.test(t)&&+t>=1&&+t<=1e3?null:"Use 100\u2013900, or normal/bold.";case"textAlign":return ki.has(t.toLowerCase())?null:"Choose left, center, right, or justify.";case"color":case"background":return Ti(t)?null:"Enter a colour, e.g. #1a1a1a.";case"fontFamily":{let n=t.split(",").map(r=>r.trim().replace(/^['"]|['"]$/g,""));return t.length<=120&&n.length>=1&&n.length<=5&&n.every(r=>/^[A-Za-z0-9][A-Za-z0-9 -]*$/.test(r))?null:"Use a font name, e.g. Georgia, serif."}default:return null}}function Mn(e){let t={},n={};for(let r of On){let s=e[r];if(typeof s!="string")continue;let c=s.trim();if(c==="")continue;if(!ct(c)){n[r]="That value isn\u2019t allowed.";continue}let m=or(r,c);if(m){n[r]=m;continue}t[r]=c}return{style:t,errors:n}}function d(e,t,n){let r=document.createElement(e);return Object.assign(r.style,t),n!==void 0&&(r.textContent=n),r}function rr(e){var ao;let t=null,n=[],r=null,s=()=>{for(;n.length>0;){let o=n.splice(0,20);try{fetch(`${e.apiBase}/v1/editor/telemetry`,{method:"POST",keepalive:!0,headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({events:o})}).catch(()=>{})}catch(i){}}},c=(o,i)=>{n.push(K({kind:o},i?{meta:i}:{})),r&&clearTimeout(r),r=setTimeout(s,2e3)};window.addEventListener("pagehide",s);let m=d("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483646",border:"2px solid #6366f1",background:"rgba(99,102,241,0.12)",display:"none"});m.id=pi;let x=d("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483646",border:"2px solid #10b981",background:"rgba(16,185,129,0.10)",borderRadius:"4px",display:"none"});x.id=fi;let g=()=>{if(!t||!t.isConnected){x.style.display="none";return}let o=t.getBoundingClientRect();Object.assign(x.style,{display:"block",left:`${o.left-2}px`,top:`${o.top-2}px`,width:`${o.width}px`,height:`${o.height}px`})},w=()=>g();Zo();let b=d("div",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",width:"min(408px, calc(100vw - 32px))",padding:"16px",borderRadius:"14px",background:"#111827",color:"#fff",font:"13px/1.4 system-ui, sans-serif",border:"1px solid rgba(99,102,241,0.55)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",maxHeight:"calc(100vh - 32px)",overflowY:"auto",overscrollBehavior:"contain"});b.id=gt;let B=d("span",{width:"9px",height:"9px",borderRadius:"50%",background:"#34d399",display:"inline-block",flex:"0 0 auto"});B.className="sntedi-dot";let L=d("div",{display:"flex",alignItems:"center",gap:"8px",fontWeight:"700",fontSize:"14px",marginBottom:"6px"});L.append(B,d("span",{},"SentientUI"));let H=d("div",{opacity:"0.85",marginBottom:"8px"},"Click any element on the page to adapt it."),S=!1,z=d("button",F("#374151"),"Pause selecting");z.onclick=()=>{S=!S,z.textContent=S?"Resume selecting":"Pause selecting",S?(m.style.display="none",mt(document),E("Selection paused \u2014 browse normally, then resume.")):E("Click any element on the page to adapt it.")};let J=d("div",{fontSize:"12px",marginBottom:"6px",padding:"5px 8px",borderRadius:"8px",background:"rgba(16,185,129,0.14)",border:"1px solid rgba(16,185,129,0.45)",display:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),Z=d("div",{fontSize:"12px",marginBottom:"8px",minHeight:"16px"}),U=d("button",F("#6366f1"),"Test different text here"),X=d("button",F("#374151"),"Change style"),ne=d("button",F("#374151"),"Try a different layout for this section"),Q=d("button",F("#374151"),"Track clicks as a goal"),N=d("button",F("#374151"),"Track form submissions as a goal"),re=d("button",F("#374151"),"Track page visits as a goal"),ie=d("button",F("#374151"),"Track reading this far as a goal"),I=d("button",F("#374151"),"Set up a funnel"),P=d("button",F("#374151"),"Attach this test to a funnel step"),q=d("button",F("#10b981"),"Turn the funnel on"),O=d("button",F("#374151"),"Move up"),V=d("button",F("#374151"),"Move down"),Se=d("button",F("#6366f1"),"Save this arrangement"),ze=d("button",F("#374151"),"Undo"),Ie=Ln("close","Close editor"),ye=d("button",F("#10b981"),"Publish now \u2014 go live"),ue=d("button",F("#10b981"),"Start tracking now");for(let o of[U,X,ne,Q,O,V])o.disabled=!0;let je=[U,X,ne,Q,N,O,V];for(let o of je)o.style.display="none";Se.style.display="none",ze.style.display="none",ye.style.display="none",ue.style.display="none",P.style.display="none",q.style.display="none";let pe=d("div",{display:"none",fontSize:"11px",opacity:"0.75",marginBottom:"2px",lineHeight:"1.8",overflow:"hidden",textOverflow:"ellipsis"}),ee=d("div",{}),Ae=[{id:"text",label:"Text",icon:"\u270F\uFE0F"},{id:"style",label:"Style",icon:"\u{1F3A8}"},{id:"layout",label:"Layout",icon:"\u{1F9F1}"},{id:"goals",label:"Goals",icon:"\u{1F3AF}"},{id:"funnels",label:"Funnels",icon:"\u{1F9ED}"},{id:"drafts",label:"Drafts",icon:"\u{1F5C2}\uFE0F"}],Y="text",et=new Map,ve=new Map,$e=new Map,Rn=d("div",{display:"flex",gap:"0",margin:"10px 0 0",justifyContent:"space-between",borderBottom:"1px solid rgba(255,255,255,0.1)"}),Dn=d("div",{paddingTop:"10px"});for(let o of Ae){let i=d("button",{background:"transparent",border:"none",cursor:"pointer",font:"600 11.5px system-ui, sans-serif",color:"#9ca3af",whiteSpace:"nowrap",padding:"7px 5px",borderBottom:"2px solid transparent",marginBottom:"-1px"});i.append(d("span",{fontSize:"11px",marginRight:"3px"},o.icon),d("span",{},o.label)),i.onclick=()=>ir(o.id),et.set(o.id,i),Rn.append(i);let a=d("div",{display:"none"}),l=d("div",{fontSize:"12px",opacity:"0.7",padding:"2px 0 6px",display:"none"});a.append(l),$e.set(o.id,l),ve.set(o.id,a),Dn.append(a)}ve.get("text").append(U),ve.get("style").append(X),ve.get("layout").append(ne,O,V,Se,ze),ve.get("goals").append(Q,N,re,ie),ve.get("funnels").append(I,P,q);let xe=d("div",{});ve.get("drafts").append(xe);let Pt=()=>{var i,a;for(let l of Ae){let u=l.id===Y,f=et.get(l.id);f.style.color=u?"#ffffff":"#9ca3af",f.style.borderBottom=u?"2px solid #6366f1":"2px solid transparent",ve.get(l.id).style.display=u?"block":"none",$e.get(l.id).style.display="none"}let o=l=>{let u=$e.get(Y);u.textContent=l,u.style.display="block"};Y==="text"?t?U.disabled?o(U.title||"This element can\u2019t be targeted reliably \u2014 try its heading or a button."):(i=U.onclick)==null||i.call(U,new MouseEvent("click")):o("Click any text on the page to test a different wording."):Y==="style"?t?X.disabled?o("This element can\u2019t be targeted reliably \u2014 try a heading, a button, or a whole section."):(a=X.onclick)==null||a.call(X,new MouseEvent("click")):o("Click any element on the page to change how it looks."):Y==="layout"?t||o("Click a section to move it or lay it out differently. Layouts re-arrange the words already on the page \u2014 they never add a section you don\u2019t have."):Y==="goals"?t||o("Page-level goals work right away; click a button or form to track it specifically."):Y==="funnels"?o("Chain tracked goals into a journey \u2014 the drop-off view fills in as visitors move through it."):Y==="drafts"&&tt()},Le=(o,i)=>d("button",le(K({},F(o)),{display:"inline-block",width:"auto",margin:"0",padding:"4px 9px",fontSize:"11px",flex:"0 0 auto"}),i),Hn=(o,i)=>{let a=new URL(window.location.href);a.searchParams.set("sentient_preview",o),i&&a.searchParams.set("sentient_arm",i),window.location.assign(a.toString())},Rt=(o,i,a)=>{let l=Le("#374151","Discard");return l.onclick=async()=>{l.disabled=!0;let u=await yi(e,o);l.disabled=!1,be(u,i),u.r==="ok"&&a()},l},zn=(o,i)=>{Ke.textContent="";let a=d("div",{margin:"0 0 6px",padding:"8px 10px",borderRadius:"8px",fontSize:"12px",background:"rgba(99,102,241,0.10)",border:"1px solid rgba(99,102,241,0.35)"}),l=d("div",{display:"flex",gap:"6px",flexWrap:"wrap"});l.append(...i),a.append(d("div",{marginBottom:"6px"},o),l),Ke.append(a)},tt=async()=>{var k,T,A,h,v,R,C,D,G,$,ge,me;xe.textContent="",xe.append(d("div",{fontSize:"12px",opacity:"0.6",padding:"4px 0"},"Loading\u2026"));let o=[],i=[],a=null,l=!1;if(await Promise.all([(async()=>{var _;try{let j=await fetch(`${e.apiBase}/v1/editor/slots`,{headers:{authorization:`Bearer ${e.token}`}});j.ok?o=(_=(await j.json()).slots)!=null?_:[]:a=j.status===401?"expired":"error"}catch(j){a="error"}})(),(async()=>{var _;try{let j=await fetch(`${e.apiBase}/v1/editor/goals`,{headers:{authorization:`Bearer ${e.token}`}});j.ok?i=(_=(await j.json()).goals)!=null?_:[]:l=!0}catch(j){l=!0}})()]),Y!=="drafts")return;if(xe.textContent="",a){if(xe.append(d("div",{fontSize:"12px",opacity:"0.8",padding:"4px 0"},a==="expired"?"Editor session expired \u2014 reopen it from your dashboard to see your drafts. They\u2019re safe.":"Couldn\u2019t load your drafts \u2014 they\u2019re safe; check your connection and retry.")),a==="error"){let _=Le("#374151","Retry");_.onclick=()=>{tt()},xe.append(_)}return}let u=o.filter(_=>{var j,se,_e,Pe,Ve,_t;return((_e=(se=(j=_.draft_config)==null?void 0:j.arms)==null?void 0:se.length)!=null?_e:0)>0||((_t=(Ve=(Pe=_.published_config)==null?void 0:Pe.arms)==null?void 0:Ve.length)!=null?_t:0)>0}),f=i.filter(_=>_.event!=="custom"&&(_.status==="draft"||_.status==="active"));if(u.length===0&&f.length===0&&!l){xe.append(d("div",{fontSize:"12px",opacity:"0.7",padding:"4px 0"},"Nothing saved yet \u2014 changes and goals you save land here, previewable before they go live."));return}let y=_=>d("span",{fontSize:"10px",padding:"2px 7px",borderRadius:"999px",flex:"0 0 auto",background:_?"rgba(16,185,129,0.2)":"rgba(99,102,241,0.25)",color:_?"#6ee7b7":"#c7d2fe"},_?"live":"draft"),p=_=>{let j=d("div",{display:"flex",alignItems:"center",gap:"6px",padding:"7px 0",borderBottom:"1px solid rgba(255,255,255,0.08)",fontSize:"12px"}),se=d("div",{flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},_);return j.append(se),{row:j,name:se}};for(let _ of u){let{row:j}=p((k=_.display_name)!=null?k:_.slot_id);j.append(y(_.status==="published"));let se=(v=(h=(T=_.draft_config)==null?void 0:T.arms)!=null?h:(A=_.published_config)==null?void 0:A.arms)!=null?v:[],_e=(D=(R=se[1])==null?void 0:R.id)!=null?D:(C=se[0])==null?void 0:C.id,Pe=Le("#374151","Preview");if(Pe.onclick=()=>Hn(_.slot_id,_e),j.append(Pe),_.status!=="published"&&((ge=($=(G=_.draft_config)==null?void 0:G.arms)==null?void 0:$.length)!=null?ge:0)>0){let Ve=Le("#10b981","Publish");Ve.onclick=async()=>{Ve.disabled=!0;let _t=await ce(e,`/v1/editor/slots/${encodeURIComponent(_.slot_id)}/publish`,{});Ve.disabled=!1,be(_t,"\u2713 Published \u2014 live for new visitors."),_t.r==="ok"&&(c("published",{kind:"slot"}),tt())},j.append(Ve)}_.status!=="published"&&j.append(Rt(`/v1/editor/slots/${encodeURIComponent(_.slot_id)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>{Vn(_.slot_id),tt()})),xe.append(j)}if(l)xe.append(d("div",{fontSize:"11px",opacity:"0.6",padding:"6px 0 2px"},"Couldn\u2019t load your goals right now \u2014 they\u2019re safe."));else if(f.length>0){xe.append(d("div",{fontSize:"11px",opacity:"0.6",padding:"8px 0 2px"},"Goals"));for(let _ of f){let{row:j}=p((me=_.display_name)!=null?me:_.goal_id);if(j.append(y(_.status==="active")),_.status==="draft"){let se=Le("#10b981","Start tracking");se.onclick=async()=>{se.disabled=!0;let _e=await ce(e,`/v1/editor/goals/${encodeURIComponent(_.goal_id)}/publish`,{});se.disabled=!1,be(_e,"\u2713 Tracking is live \u2014 it counts from your next visitor."),_e.r==="ok"&&(c("published",{kind:"goal"}),tt())},j.append(se,Rt(`/v1/editor/goals/${encodeURIComponent(_.goal_id)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>{Yn(_.goal_id),tt()}))}xe.append(j)}}},ir=o=>{Y!==o&&(ae(),kt(),Y=o,Pt())},jn=d("div",{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"});Object.assign(L.style,{marginBottom:"0",flex:"1 1 auto",fontSize:"13px",whiteSpace:"nowrap"});let Kn=!1,Be=d("button",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",width:"44px",height:"44px",borderRadius:"12px",border:"1px solid #2a2a2a",background:"#000",cursor:"pointer",display:"none",padding:"0",alignItems:"center",justifyContent:"center",boxShadow:"0 6px 18px rgba(0,0,0,0.4)"});Be.append(Li(26)),Be.title="Open the SentientUI editor",Be.setAttribute("aria-label","Open the SentientUI editor");let Un=Ln("minimize","Minimize");Un.onclick=()=>{b.style.display="none",Be.style.display="flex",Kn=S,S=!0,m.style.display="none",mt(document)},Be.onclick=()=>{b.style.display="block",Be.style.display="none",S=Kn},Object.assign(z.style,{display:"inline-block",width:"auto",margin:"0",padding:"3px 8px",fontSize:"10.5px",borderRadius:"999px",background:"#374151",whiteSpace:"nowrap"}),jn.append(L,z,Un,Ie);let Gn=d("div",{marginTop:"10px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"8px"}),Ke=d("div",{});Object.assign(Z.style,{marginBottom:"4px"}),Gn.append(Ke,Z,ye,ue);let Fn=d("button",{display:"inline-block",width:"auto",margin:"0",padding:"5px 10px",flex:"0 0 auto",fontSize:"11px",borderRadius:"999px",background:"rgba(250,204,21,0.15)",border:"1px solid rgba(250,204,21,0.45)",color:"#fde68a",cursor:"pointer",whiteSpace:"nowrap"},"\u2728 Ask AI"),nn=d("div",{display:"flex",alignItems:"center",gap:"6px"});Object.assign(J.style,{flex:"1 1 auto",marginBottom:"0"}),nn.append(J,Fn),Object.assign(nn.style,{marginBottom:"6px"});let Dt=d("div",{}),W=d("div",{marginTop:"4px"});W.addEventListener("input",()=>{nt=!0}),W.addEventListener("change",()=>{nt=!0}),b.append(jn,H,nn,pe,ee,Dt,Rn,Dn,W,Gn),((ao=document.body)!=null?ao:document.documentElement).append(m,x,b,Be);let Oe=null,Ht=()=>{Oe==null||Oe(),Oe=null},Wn=()=>{Oe=null},ht=null,nt=!1,on=null,ae=()=>{Ht(),ht=null,W.textContent="",nt=!1,on=null,fn=!1},yt=(o,i,a,l)=>{var A;ae();let u={},f={},y={display:"block",width:"100%",marginTop:"4px",padding:"7px 9px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.18)",background:"#1f2937",color:"#fff",font:"13px system-ui, sans-serif"};for(let h of o){let v=d("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},h.label);if(W.append(v),h.type==="select"){let C=d("select",y);C.setAttribute("data-field",h.key);let D=document.createElement("option");D.value="",D.textContent="\u2014 no change \u2014",C.append(D);for(let G of(A=h.options)!=null?A:[]){let $=document.createElement("option");$.value=G,$.textContent=G,C.append($)}u[h.key]=()=>C.value,W.append(C)}else if(h.type==="color"){let C=d("input",le(K({},y),{padding:"2px",height:"34px"}));C.type="color",C.setAttribute("data-field",h.key);let D=!1;C.addEventListener("input",()=>{D=!0}),u[h.key]=()=>D?C.value:"",W.append(C)}else{let C=d("input",y);C.setAttribute("data-field",h.key),h.value!==void 0&&(C.value=h.value),u[h.key]=()=>C.value,W.append(C)}let R=d("div",{fontSize:"11px",color:"#fca5a5",marginTop:"3px",display:"none"});R.setAttribute("data-feedback",h.key),f[h.key]=R,W.append(R)}let p=(h,v)=>{let R=f[h];R&&(R.textContent=v!=null?v:"",R.style.display=v?"block":"none")};if(l){let h=qn(l);W.append(h.node),u[bt]=h.value}let k=d("button",F("#6366f1"),i),T=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");k.onclick=()=>a(Object.fromEntries(Object.entries(u).map(([h,v])=>[h,v()])),p),T.onclick=ae,W.append(k,T)},bt="__page",rn={},ar=o=>{var i;for(let a of o!=null?o:[])rn[a.slot_id]=(i=a.target)==null?void 0:i.page};ft(e,"/v1/editor/slots").then(o=>ar(o==null?void 0:o.slots));let qn=o=>{let i=Nt(location.pathname),a=d("div",{}),l=d("select",{display:"block",width:"100%",marginTop:"4px",padding:"7px 9px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.18)",background:"#1f2937",color:"#fff",font:"13px system-ui, sans-serif"});l.setAttribute("data-field","page");for(let u of Cn(i,rn[o])){let f=document.createElement("option");f.value=u,f.textContent=Go(u,i),l.append(f)}return a.append(d("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},"Where does this appear?"),l,d("div",{fontSize:"11px",opacity:"0.6",marginTop:"3px"},"Helps us tell a moved element from a page it isn\u2019t on.")),{node:a,value:()=>l.value}},vt=(o,i)=>i?le(K({},o),{page:i}):o,E=(o,i=!0)=>{Z.textContent=o,Z.style.color=i?"#a7f3d0":"#fca5a5"},an=(o,i)=>{var l,u;if(c("error_shown",{code:(u=o.code)!=null?u:`http_${(l=o.status)!=null?l:"network"}`}),o.code==="plan_limit_reached"){let f=o.feature==="live_goals"?"live goal":"of these",y=o.plan?`${o.plan} plan`:"plan";return o.feature==="live_goals"?`Your ${y} includes 1 live goal. Pause another goal in your dashboard, or upgrade to track more.`:`Your ${y} has reached its limit for ${f}. Manage them in your dashboard, or upgrade for more.`}if(o.code==="role_required")return"Your account can view but not edit this project \u2014 ask an admin for editor access.";if(o.code==="demo_read_only"&&o.message)return o.message;let a=o.status?` (HTTP ${o.status})`:"";return`\u26A0 Couldn\u2019t ${i} \u2014 try again.${a}`},be=(o,i)=>{o.r==="ok"?E(i,!0):o.r==="expired"?E("Editor session expired \u2014 reopen it from your dashboard to save this. Your earlier changes are safe.",!1):E(an(o,"save"),!1)},Ue=null,zt=o=>o.length>30?`${o.slice(0,27)}\u2026`:o,Vn=o=>{Ue===o&&(ht===o&&(Ht(),ht=null),Ue=null,ye.style.display="none",P.style.display="none",Ke.textContent="")},Yn=o=>{at===o&&(at=null,ue.style.display="none",Ke.textContent="")},xt=(o,i,a)=>{Ue=o,ye.textContent=i?`Publish \u201C${zt(i)}\u201D \u2014 go live`:"Publish now \u2014 go live",ye.style.display="block",P.style.display="block";let l=[];if(a){let u=Le("#374151","Preview");u.onclick=()=>Hn(o,a),l.push(u)}l.push(Rt(`/v1/editor/slots/${encodeURIComponent(o)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>Vn(o))),zn(i?`Draft saved for \u201C${zt(i)}\u201D \u2014 nothing is live for visitors yet.`:"Draft saved \u2014 nothing is live for visitors yet.",l)};ye.onclick=async()=>{if(!Ue)return;ye.disabled=!0,E("Publishing\u2026");let o=await ce(e,`/v1/editor/slots/${encodeURIComponent(Ue)}/publish`,{});ye.disabled=!1,o.r==="ok"?(c("published",{kind:"slot"}),E("\u2713 Published \u2014 live for new visitors.",!0),ye.style.display="none",Ue=null,Ke.textContent=""):o.r==="expired"?E("Editor session expired \u2014 reopen it from your dashboard to publish. Your saved draft is safe.",!1):E(an(o,"publish"),!1)};let oe=null,Me=!1,ot=null,rt=null,Ee=null,Ge=null,wt=null,jt=null,Fe=!1,Jn=(o,i)=>Me?o?"":`Nothing to swap with ${i} \u2014 it\u2019s at the edge, or that neighbor can\u2019t be targeted reliably.`:"This element can\u2019t be targeted reliably, so it can\u2019t be moved.",Xn=()=>{O.disabled=!Me||!Ee,V.disabled=!Me||!Ge,O.title=O.disabled?Jn(Ee,"above"):"",V.title=V.disabled?Jn(Ge,"below"):""},Te=null,sn=o=>{o&&!Te&&t&&oe?(Te=qn(Ce("move",oe,t)),Se.before(Te.node)):o||(Te==null||Te.node.remove(),Te=null),Se.style.display=o?"block":"none",ze.style.display=o?"block":"none",Xn()},kt=()=>{if(Fe&&t&&wt&&wt.insertBefore(t,jt),Fe=!1,wt=null,jt=null,t){let o=Qt(t,document);ot=o.prevEl,rt=o.nextEl,Ee=o.prevLocator,Ge=o.nextLocator}g(),sn(!1)},Zn=o=>{if(S)return;let i=o.target;if(!i||b.contains(i)||i===m)return;mt(document);let a=i.getBoundingClientRect();Object.assign(m.style,{display:"block",left:`${a.left}px`,top:`${a.top}px`,width:`${a.width}px`,height:`${a.height}px`})},Ne=o=>{var a;let i=((a=o.textContent)!=null?a:"").trim().replace(/\s+/g," ");return i?i.length>40?`${i.slice(0,37)}\u2026`:i:o.tagName.toLowerCase()},sr=o=>!!o.id||["section","header","footer","nav","main","form","article","aside"].includes(o.tagName.toLowerCase())||!!o.querySelector(":scope > h1, :scope > h2, :scope > h3"),lr=o=>{var l;let i=o.querySelector("h1, h2, h3"),a=(l=i==null?void 0:i.textContent)==null?void 0:l.replace(/\s+/g," ").trim();return a?a.length>28?`${a.slice(0,25)}\u2026`:a:o.id?`#${o.id.length>24?`${o.id.slice(0,21)}\u2026`:o.id}`:`<${o.tagName.toLowerCase()}>`},cr=o=>{pe.textContent="";let i=[];for(let y=o.parentElement;y&&y!==document.body&&i.length<3;y=y.parentElement)sr(y)&&i.push(y);let a=Ne(o),l=()=>d("span",{opacity:"0.5",margin:"0 4px"},"\u2039"),u=!0;for(let y of i){let p=lr(y);if(p===a||a.startsWith(p))continue;let k=d("button",{background:"transparent",border:"none",color:"#a5b4fc",cursor:"pointer",font:"inherit",padding:"0",textDecoration:"underline"},p);k.onclick=()=>St(y),u||pe.append(l()),pe.append(k),u=!1}u||pe.append(l());let f=d("button",{background:"transparent",border:"none",color:"#a5b4fc",cursor:"pointer",font:"inherit",padding:"0",textDecoration:"underline",opacity:"0.7"},"Page");f.onclick=()=>Qn(),pe.append(f),pe.style.display="block"},dr=o=>{ee.textContent="";let i=null,a=0;for(let u=o.parentElement;u&&u!==document.body&&a<6;u=u.parentElement,a++)if(ut(Xe(u,document),u,document)){i=u;break}let l=d("div",{marginBottom:"8px",padding:"8px 10px",borderRadius:"8px",fontSize:"12px",background:"rgba(252,165,165,0.12)",border:"1px solid rgba(252,165,165,0.4)"});if(i){let u=i;l.append(d("div",{marginBottom:"6px"},"This exact element can\u2019t be tracked safely \u2014 it looks identical to others on the page. You can pick something more specific inside it, or work with the whole block, which we can target reliably."));let f=d("button",le(K({},F("#6366f1")),{marginTop:"0"}),`Select \u201C${Ne(u)}\u201D instead`);f.onclick=()=>St(u);let y=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Pick something else");y.onclick=()=>{ee.textContent=""},l.append(f,y)}else l.append(d("div",{},"This part of the page can\u2019t be targeted reliably \u2014 try a heading, a button, or a whole section instead."));ee.append(l)},St=o=>{kt(),ae(),ee.textContent="",t=o,oe=Xe(o,document);let i=ut(oe,o,document);Me=i,g(),J.style.display="block",J.textContent=`Selected: ${Ne(o)}`,cr(o),c("element_selected",{unique:i}),E(i?"\u2713 Matches exactly 1 element":"",i),i||dr(o),H.style.display="none",un();for(let f of je)f.style.display="block";U.style.display="none",X.style.display="none";let a=bn(o);U.disabled=!i||!a,U.title=i?a?"":"This element contains other elements, so testing text here would replace them. Pick the text itself (e.g. the heading), not its container.":"",X.disabled=!i,ne.disabled=!i,Q.disabled=!i;let l=o.closest("form");N.style.display=l?"block":"none",N.disabled=!l;let u=Qt(o,document);ot=u.prevEl,rt=u.nextEl,Ee=u.prevLocator,Ge=u.nextLocator,Xn(),Pt()},Qn=()=>{kt(),ae(),t=null,oe=null,Me=!1,ot=null,rt=null,Ee=null,Ge=null,g(),ee.textContent="",un(),pe.textContent="",pe.style.display="none",J.textContent="",J.style.display="none";for(let o of je)o.style.display="none";H.style.display="block",E(""),Pt()},it=!1,ln=-1,eo=o=>{var l,u;let i=o.target,a=!!((l=i==null?void 0:i.closest)!=null&&l.call(i,'input, textarea, select, [contenteditable="true"]'));if(o.key==="Escape"){if(W.childElementCount>0){ae(),it=!1;return}if(t){Qn(),it=!1;return}if(!it){it=!0,E("Press Esc again to close the editor.");return}it=!1,(u=Ie.onclick)==null||u.call(Ie,new MouseEvent("click"));return}if(it=!1,!(a||S)){if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!t||(o.key==="ArrowUp"?O:V).disabled)return;o.preventDefault(),pn(o.key==="ArrowUp"?"up":"down");return}if(o.key==="Tab"){let f=[];for(let p of Bn){let k=we(p.locator,document);k&&!f.includes(k)&&f.push(k)}if(f.length===0)return;if(nt){E("\u26A0 You have unsaved changes \u2014 Save or Cancel before picking another element.",!1),o.preventDefault();return}o.preventDefault(),ln=(ln+(o.shiftKey?-1:1)+f.length)%f.length;let y=f[ln];St(y);try{y.scrollIntoView({block:"center",behavior:"smooth"})}catch(p){}}}},to=o=>{if(S)return;let i=o.target;if(!(!i||b.contains(i))){if(o.preventDefault(),o.stopPropagation(),nt&&i!==t&&on!==i){on=i,E("\u26A0 You have unsaved changes \u2014 Save or Cancel first, or click that element again to discard them.",!1);return}St(i)}};U.onclick=()=>{var f,y;if(!t||!oe)return;c("form_opened",{kind:"text"});let o=oe,i=(y=(f=t.textContent)==null?void 0:f.trim())!=null?y:"";yt([{key:"current",label:"Current wording",value:i},{key:"alt",label:"Alternative wording to test",value:""}],"Save draft",async p=>{let k=p.alt.trim();if(!k){E("\u26A0 Enter alternative wording to test.",!1);return}if(k===p.current.trim()){E("\u26A0 Enter different wording \u2014 the alternative matches the current text.",!1);return}let T=Ce("text",o,t);E("Saving\u2026");let A=await ce(e,`/v1/editor/slots/${encodeURIComponent(T)}`,{kind:"arms",target:vt(o,p[bt]),draftConfig:{arms:[{id:"a",displayName:"Original",ops:{text:p.current}},{id:"b",displayName:"Alternative",ops:{text:p.alt}}]}});A.r==="ok"&&(c("draft_saved",{kind:"slot"}),Wn(),ae(),xt(T,Ne(t),"b")),be(A,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Ce("text",o,t));let a=t,l=vn(a);Oe=()=>{Ye(a,l)};let u=W.querySelector('input[data-field="alt"]');u==null||u.addEventListener("input",()=>{Ye(a,u.value.trim()===""?l:u.value)})};let Et=null,no=o=>{let i=p=>{var k;return((k=p.textContent)!=null?k:"").replace(/\s+/g," ").trim()},a=Array.from(o.querySelectorAll("h1,h2,h3,h4")).map(i).filter(Boolean);if(a.length===0){let p=o.closest("h1,h2,h3,h4");p&&a.push(i(p))}let l=Array.from(o.querySelectorAll("p")).map(i).filter(p=>p.length>0&&p.length<=300),u=[];for(let p of Array.from(o.querySelectorAll("a[href], button"))){let k=i(p);if(!k||k.length>60)continue;let T="",A=p.getAttribute("href");if(A)try{let h=new URL(A,window.location.href);h.protocol==="https:"&&(T=h.href)}catch(h){}u.push({label:k,href:T})}let f=Array.from(o.querySelectorAll("blockquote, q")).map(i).filter(Boolean);if(f.length===0&&xi.test(`${o.className} ${o.id}`))for(let p of l)p.length>=20&&f.push(p);let y=Array.from(o.querySelectorAll('cite, figcaption, footer, [class*="author"]')).map(i).filter(p=>p.length>0&&p.length<=80);return{headings:a,paragraphs:l,links:u,quotes:f,attributions:y}},ur=(o,i)=>{var l,u,f,y,p,k,T,A,h,v,R,C,D,G,$,ge,me,_,j,se;let a=_e=>{var Pe;return i.paragraphs.length>=3&&(Pe=i.paragraphs[i.paragraphs.length-3+_e])!=null?Pe:""};switch(o){case"headline":return(l=i.headings[0])!=null?l:"";case"supporting":return(u=i.paragraphs[0])!=null?u:"";case"cta_label":return(y=(f=i.links[0])==null?void 0:f.label)!=null?y:"";case"cta_href":return(k=(p=i.links[0])==null?void 0:p.href)!=null?k:"";case"secondary_label":return(A=(T=i.links[1])==null?void 0:T.label)!=null?A:"";case"secondary_href":return(v=(h=i.links[1])==null?void 0:h.href)!=null?v:"";case"quote":case"q1":return(R=i.quotes[0])!=null?R:"";case"q2":return(C=i.quotes[1])!=null?C:"";case"q3":return(D=i.quotes[2])!=null?D:"";case"name":case"n1":return(G=i.attributions[0])!=null?G:"";case"n2":return($=i.attributions[1])!=null?$:"";case"n3":return(ge=i.attributions[2])!=null?ge:"";case"role":return(me=i.attributions[1])!=null?me:"";case"eyebrow":return"";case"f1_title":return(_=i.headings[1])!=null?_:"";case"f2_title":return(j=i.headings[2])!=null?j:"";case"f3_title":return(se=i.headings[3])!=null?se:"";case"f1_body":return a(0);case"f2_body":return a(1);case"f3_body":return a(2);default:return""}},pr=(o,i,a)=>{c("form_opened",{kind:"arrangement"});let l=no(a);yt(o.fields.map(u=>({key:u.id,label:u.kind==="href"?`${u.label} (https link \u2014 required)`:u.label,value:ur(u.id,l)})),"Save draft",async(u,f)=>{var R,C,G,$,ge;let y=!1,p=!1;for(let me of o.fields){if(me.kind==="href"){let j=!1;try{j=new URL((R=u[me.id])!=null?R:"").protocol==="https:"}catch(se){}f(me.id,j?null:"Links need to start with https://"),j||(y=!0);continue}let _=((C=u[me.id])!=null?C:"").trim()==="";f(me.id,_?"Fill this in with your own words":null),_&&(p=!0)}if(y){E("\u26A0 Fix the highlighted link(s).",!1);return}if(p){E("\u26A0 Every field needs your own words \u2014 this layout re-arranges your copy, it doesn\u2019t write any.",!1);return}E("Saving\u2026");let D=u,{[bt]:k}=D,T=uo(D,[co(bt)]),A=await bi(e,`/v1/editor/arrangements/${encodeURIComponent(o.id)}/instantiate`,{fields:T});if(A.r!=="ok"||!((G=A.data)!=null&&G.blocks)){A.r==="expired"?be(A.outcome,""):E(`\u26A0 ${(ge=($=A.data)==null?void 0:$.reason)!=null?ge:"Couldn\u2019t build the arrangement \u2014 check the fields."}`,!1);return}let h=Ce("arrange",i,a),v=await ce(e,`/v1/editor/slots/${encodeURIComponent(h)}`,{kind:"arms",target:vt(i,k),draftConfig:{arms:[{id:"original",displayName:"Your page today"},{id:o.id,displayName:o.name,blocks:A.data.blocks}],baseline:"original"}});v.r==="ok"&&(c("draft_saved",{kind:"arrangement"}),ae(),xt(h,o.name,o.id)),be(v,"\u2713 Saved as a draft \u2014 it will test against this section as it is today. Click \u201CPublish\u201D below to go live.")},Ce("arrange",i,a))};ne.onclick=async()=>{var f,y;if(!t||!oe)return;let o=oe,i=t;if(ae(),E("Loading arrangements\u2026"),!Et){let p=await ft(e,"/v1/editor/arrangements");Et=(f=p==null?void 0:p.arrangements)!=null?f:null}if(!Et||Et.length===0){E("\u26A0 Couldn\u2019t load the arrangements \u2014 try again.",!1);return}let a=nr(no(i)),l=Et.filter(p=>a.includes(p.sectionType));if(l.length===0){E("No other layout fits this section. Layouts re-arrange the words already here \u2014 they don\u2019t add sections your page doesn\u2019t have.",!1);return}E("Pick a layout for this section \u2014 your own words are carried across.");for(let p of l){let k=d("button",le(K({},F("#374151")),{textAlign:"left"}));k.append(d("div",{fontWeight:"600"},p.name),d("div",{fontSize:"11px",opacity:"0.7"},p.description)),k.onclick=()=>pr(p,o,i),W.append(k)}let u=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");u.onclick=ae,W.append(u),(y=W.scrollIntoView)==null||y.call(W,{block:"nearest"})};let at=null,fr=(o,i)=>{at=o,ue.textContent=i?`Start tracking \u201C${zt(i)}\u201D now`:"Start tracking now",ue.style.display="block",zn(i?`Goal \u201C${zt(i)}\u201D saved \u2014 it isn\u2019t counting anything until you start it.`:"Goal saved \u2014 it isn\u2019t counting anything until you start it.",[Rt(`/v1/editor/goals/${encodeURIComponent(o)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>Yn(o))])};ue.onclick=async()=>{if(!at)return;ue.disabled=!0,E("Activating\u2026");let o=await ce(e,`/v1/editor/goals/${encodeURIComponent(at)}/publish`,{});ue.disabled=!1,o.r==="ok"?(c("published",{kind:"goal"}),E("\u2713 Tracking is live \u2014 it counts from your next visitor.",!0),ue.style.display="none",at=null,Ke.textContent=""):o.r==="expired"?E("Editor session expired \u2014 reopen it from your dashboard to activate. Your saved goal is safe.",!1):E(an(o,"activate"),!1)};let st=(o,i)=>`${pt(o)||"goal"}-${Xo(i)}`.slice(0,128),oo=o=>{var l,u,f;let i=((l=o.textContent)!=null?l:"").replace(/\s+/g," ").trim();return i&&i.length<=60?i:((f=(u=o.getAttribute("aria-label"))!=null?u:o.getAttribute("id"))!=null?f:"").trim()||"element-clicked"},Tt=async(o,i,a)=>{E("Saving\u2026");let l=await ce(e,`/v1/editor/goals/${encodeURIComponent(o)}`,i);return l.r==="ok"&&(c("draft_saved",{kind:"goal"}),fr(o,a)),be(l,"\u2713 Goal saved. Click \u201CStart tracking\u201D below to go live."),l};Q.onclick=()=>{if(!t||!oe)return;let o=st(oo(t),JSON.stringify(oe));Tt(o,{event:"click",locator:oe},Ne(t))},N.onclick=()=>{var l,u;let o=t==null?void 0:t.closest("form");if(!o)return;let i=Xe(o,document),a=(u=(l=o.getAttribute("id"))!=null?l:o.getAttribute("name"))!=null?u:"form-submitted";Tt(st(a,JSON.stringify(i)),{event:"form_submit",locator:i},a)},re.onclick=()=>{let o=window.location.pathname||"/",i=pt(o)?`reached-${pt(o)}`:"page-visited";Tt(st(i,o),{event:"url_reached",urlPattern:o},o)};let cn=[{label:"25% \u2014 skimmed the top",value:.25},{label:"50% \u2014 read halfway",value:.5},{label:"75% \u2014 read most of the page",value:.75},{label:"90% \u2014 read to the end",value:.9}];ie.onclick=()=>{yt([{key:"depth",label:"Counts once a visitor reads",type:"select",options:cn.map(o=>o.label)}],"Track it",o=>{var l;let i=(l=cn.find(u=>u.label===o.depth))!=null?l:cn[2],a=Math.round(i.value*100);Tt(`read-${a}pct`,{event:"scroll_depth",threshold:i.value},`read ${a}%`),ae()})};let Kt=null,gr=o=>{Kt=o,q.style.display="block"};q.onclick=async()=>{if(!Kt)return;q.disabled=!0,E("Turning on\u2026");let o=await ce(e,`/v1/editor/funnels/${encodeURIComponent(Kt)}/publish`,{});q.disabled=!1,o.r==="ok"?(c("published",{kind:"funnel"}),E("\u2713 Funnel is on \u2014 the drop-off view fills in as visitors move through it.",!0),q.style.display="none",Kt=null):o.r==="expired"?E("Editor session expired \u2014 reopen it from your dashboard to turn the funnel on. Your draft is safe.",!1):E("\u26A0 Couldn\u2019t turn the funnel on \u2014 try again.",!1)},I.onclick=async()=>{var A;E("Loading your goals\u2026");let o=await ft(e,"/v1/editor/goals"),i=(A=o==null?void 0:o.goals)!=null?A:[];if(i.length<2){E("Track at least 2 goals first \u2014 a funnel is a sequence of them (e.g. \u201Cviewed pricing\u201D \u2192 \u201Csigned up\u201D).",!1);return}E("Pick the steps in order \u2014 first click = first step."),ae();let a=[],l=d("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},"Funnel name"),u=d("input",{display:"block",width:"100%",marginTop:"4px",padding:"7px 9px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.18)",background:"#1f2937",color:"#fff",font:"13px system-ui, sans-serif"});W.append(l,u);let f=d("div",{fontSize:"11px",opacity:"0.7",marginTop:"6px"},"Steps (click in journey order):");W.append(f);let y=new Map,p=()=>{var h,v;for(let[R,C]of y){let D=a.indexOf(R),G=(v=(h=i.find($=>$.goal_id===R))==null?void 0:h.display_name)!=null?v:R;C.textContent=D===-1?G:`${D+1}. ${G}`,C.style.background=D===-1?"#374151":"#6366f1"}};for(let h of i){let v=d("button",le(K({},F("#374151")),{textAlign:"left"}));y.set(h.goal_id,v),v.onclick=()=>{a=Fo(a,h.goal_id),p()},W.append(v)}p();let k=d("button",F("#6366f1"),"Save funnel"),T=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");T.onclick=ae,k.onclick=async()=>{let h=Wo(u.value,a);if(!h.ok){E(`\u26A0 ${h.error}`,!1);return}E("Saving\u2026");let v=await ce(e,`/v1/editor/funnels/${encodeURIComponent(h.funnelId)}`,h.body);v.r==="ok"&&(c("draft_saved",{kind:"funnel"}),ae(),gr(h.funnelId)),be(v,"\u2713 Funnel saved as a draft. Click \u201CTurn the funnel on\u201D to start measuring.")},W.append(k,T)},P.onclick=async()=>{var p,k;let o=Ue;if(!o)return;E("Loading funnels\u2026");let i=await ft(e,"/v1/editor/funnels"),a=(p=i==null?void 0:i.funnels)!=null?p:[];if(a.length===0){E("No funnels yet \u2014 click \u201CSet up a funnel\u201D first.",!1);return}let l=await ft(e,"/v1/editor/goals"),u=new Map(((k=l==null?void 0:l.goals)!=null?k:[]).map(T=>[T.goal_id,T.display_name]));yt([{key:"funnel",label:"Funnel",type:"select",options:a.map(T=>Jt(T))},{key:"step",label:"Which step does this element serve?",type:"select",options:Xt(a[0],u).map(T=>T.label)}],"Attach",async T=>{var R;let A=(R=a.find(C=>Jt(C)===T.funnel))!=null?R:a[0],h=Xt(A,u).findIndex(C=>C.label===T.step);if(h<0){E("\u26A0 Pick which step this element serves.",!1);return}E("Attaching\u2026");let v=await ce(e,`/v1/editor/funnels/${encodeURIComponent(A.funnel_id)}/assign`,{slotId:o,stepIndex:h});v.r==="ok"&&ae(),be(v,`\u2713 Attached \u2014 this test now works toward \u201C${A.display_name}\u201D.`)});let f=W.querySelector('select[data-field="funnel"]'),y=W.querySelector('select[data-field="step"]');f&&y&&f.addEventListener("change",()=>{var A;let T=(A=a.find(h=>Jt(h)===f.value))!=null?A:a[0];y.length=1;for(let h of Xt(T,u)){let v=document.createElement("option");v.value=h.label,v.textContent=h.label,y.append(v)}})},X.onclick=()=>{if(!t||!oe)return;c("form_opened",{kind:"style"});let o=oe;yt([{key:"color",label:"Text colour",type:"color"},{key:"background",label:"Background colour",type:"color"},{key:"fontSize",label:"Font size (e.g. 20px)"},{key:"fontWeight",label:"Font weight (e.g. 700)"},{key:"fontFamily",label:An.length?`Font (this site has: ${An.slice(0,3).join(", ")})`:"Font (e.g. Georgia, serif)"},{key:"borderRadius",label:"Corner radius (e.g. 8px)"},{key:"textAlign",label:"Alignment",type:"select",options:["left","center","right","justify"]}],"Save draft",async(y,p)=>{var R;let{style:k,errors:T}=Mn(y),A=!1;for(let C of On)p(C,(R=T[C])!=null?R:null),T[C]&&(A=!0);if(A){E("\u26A0 Fix the highlighted field(s).",!1);return}if(Object.keys(k).length===0){E("\u26A0 Enter at least one style change.",!1);return}let h=Ce("style",o,t);E("Saving\u2026");let v=await ce(e,`/v1/editor/slots/${encodeURIComponent(h)}`,{kind:"arms",target:vt(o,y[bt]),draftConfig:{arms:[{id:"a",displayName:"Current look",ops:{}},{id:"b",displayName:"New look",ops:{style:k}}]}});v.r==="ok"&&(c("draft_saved",{kind:"slot"}),Wn(),ae(),xt(h,Ne(t),"b")),be(v,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Ce("style",o,t));let i=t,a=i.style.cssText;Oe=()=>{i.style.cssText=a};let l={},u=()=>{let{style:y}=Mn(l);i.style.cssText=a;for(let[p,k]of Object.entries(y)){let T=At[p];T&&ct(k)&&i.style.setProperty(T,k.trim(),"important")}};for(let y of On){let p=W.querySelector(`[data-field="${y}"]`);if(!p)continue;let k=()=>{l[y]=p.value,u()};p.addEventListener("input",k),p.addEventListener("change",k)}let f=[Ze==null?void 0:Ze.primaryBg,Ze==null?void 0:Ze.primaryText,"#ffffff"].filter(y=>!!y).map($n).filter((y,p,k)=>Pn(y)&&k.indexOf(y)===p);for(let y of["color","background"]){let p=W.querySelector(`input[data-field="${y}"]`);if(!p)continue;let k=d("div",{display:"flex",gap:"6px",marginTop:"4px"});for(let T of f){let A=d("button",{width:"22px",height:"22px",borderRadius:"6px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.35)",background:T,padding:"0"});A.title=T,A.onclick=()=>{p.value=$n(T),p.dispatchEvent(new Event("input"))},k.append(A)}p.after(k)}};let We=[],Ct=new Map,dn=!1,fe=null,te=null,Lt=null,mr=()=>{Ct.clear();let o=[],i=(a,l,u)=>{var p;if(o.length>=16||[...Ct.values()].some(k=>k.node===a))return;let f=a===t,y=f?"selected":`e${o.length}`;Ct.set(y,{node:a,locator:l}),o.push(K(K({ref:y,tag:a.tagName.toLowerCase().slice(0,16),text:((p=a.textContent)!=null?p:"").replace(/\s+/g," ").trim().slice(0,300),isLeaf:bn(a),inForm:!!a.closest("form")},f?{selected:!0}:{}),u?{label:u.slice(0,120)}:{}))};t&&oe&&Me&&i(t,oe);for(let a of Bn){let l=we(a.locator,document);l&&i(l,a.locator,a.label)}return{pagePath:Nt(location.pathname),pageTitle:document.title.slice(0,200),elements:o}},qe=(o,i="")=>{let a=o==="user",l=d("div",{margin:"6px 0",padding:"7px 10px",borderRadius:"10px",fontSize:"12px",lineHeight:"1.45",whiteSpace:"pre-wrap",wordBreak:"break-word",maxWidth:"88%",marginLeft:a?"auto":"0",background:a?"#6366f1":o==="note"?"transparent":"rgba(255,255,255,0.07)",opacity:o==="note"?"0.75":"1"},i);return fe==null||fe.append(l),fe&&(fe.scrollTop=fe.scrollHeight),l},un=()=>{Lt&&(Lt.textContent=t?Me?`Looking at: ${Ne(t)}`:"This element can\u2019t be targeted reliably \u2014 pick a heading, button, or section.":"Nothing selected \u2014 click an element, or ask for a page goal.")},ro=(o,i)=>{var u;Ht();let a=vn(o),l=o.style.cssText;if(Oe=()=>{Ye(o,a),o.style.cssText=l},!!i){typeof i.text=="string"&&Ye(o,i.text);for(let[f,y]of Object.entries((u=i.style)!=null?u:{})){let p=At[f];p&&typeof y=="string"&&ct(y)&&o.style.setProperty(p,y.trim(),"important")}}},hr=async o=>{var R,C;let i=Ct.get(o.ref);if(!i||!i.node.isConnected)return"\u26A0 That element is no longer on the page \u2014 click it and ask again.";let{node:a,locator:l}=i,u=o.versions.some(D=>typeof D.ops.text=="string"),f=Ce(u?"text":"style",l,a),y=Cn(location.pathname,rn[f])[0];E("Saving\u2026");let p=await ce(e,`/v1/editor/slots/${encodeURIComponent(f)}`,{kind:"arms",target:vt(l,y),draftConfig:{arms:[{id:"a",displayName:"Original",ops:u?{text:((R=a.textContent)!=null?R:"").trim()}:{}},...o.versions]}});if(be(p,"\u2713 Draft saved and previewing \u2014 nothing is live until you publish."),p.r!=="ok")return(C=Z.textContent)!=null?C:"\u26A0 Couldn\u2019t save the draft.";c("draft_saved",{kind:"slot",via:"chat"}),a!==t&&St(a),ae();let k=a;ro(k,o.versions[0].ops),ht=f;try{k.scrollIntoView({block:"center",behavior:"smooth"})}catch(D){}xt(f,o.label,o.versions[0].id);let T=qe("assistant");T.textContent="",T.append(d("div",{fontWeight:"600",marginBottom:"6px"},`Draft: ${o.label}`));let A=d("div",{display:"flex",gap:"5px",flexWrap:"wrap"}),h=[],v=(D,G)=>{for(let $ of h)$.style.background="#374151";D.style.background="#6366f1",ro(k,G),ht=f};for(let[D,G]of[["Original",null],...o.versions.map($=>[$.displayName,$.ops])]){let $=Le("#374151",D);$.onclick=()=>v($,G),h.push($),A.append($)}return h[1].style.background="#6366f1",T.append(A),`[Created draft "${o.label}" with ${o.versions.length} version(s)]`},yr=(o,i,a)=>{var y;let l=[],u={position:"absolute",pointerEvents:"none",zIndex:"2147483645",padding:"2px 6px",borderRadius:"4px",background:"#f59e0b",color:"#111827",font:"600 11px system-ui, sans-serif",whiteSpace:"nowrap"},f=null;if(o){let p=o.getBoundingClientRect();f=p.top+window.scrollY,l.push(d("div",{position:"absolute",pointerEvents:"none",zIndex:"2147483645",left:`${p.left+window.scrollX-3}px`,top:`${f-3}px`,width:`${p.width+6}px`,height:`${p.height+6}px`,border:"2px dashed #f59e0b",borderRadius:"6px"}),d("div",le(K({},u),{left:`${p.left+window.scrollX}px`,top:`${Math.max(0,f-24)}px`}),`Goal: ${a}`))}else i!==void 0&&(f=Math.round(document.documentElement.scrollHeight*i),l.push(d("div",{position:"absolute",pointerEvents:"none",zIndex:"2147483645",left:"0",right:"0",top:`${f}px`,borderTop:"2px dashed #f59e0b"}),d("div",le(K({},u),{left:"16px",top:`${f+4}px`}),`Goal counts here: ${a}`)));if(l.length!==0){if(((y=document.body)!=null?y:document.documentElement).append(...l),f!==null)try{window.scrollTo({top:Math.max(0,f-window.innerHeight/3),behavior:"smooth"})}catch(p){}setTimeout(()=>{for(let p of l)p.remove()},6e3)}},br=async o=>{var f,y,p,k,T,A;let i=null,a,l;if(o.event==="click"||o.event==="form_submit"){let h=o.ref?Ct.get(o.ref):void 0;if(!h||!h.node.isConnected)return"\u26A0 That element is no longer on the page \u2014 click it and ask again.";if(o.event==="click")i=h.node,a=st(oo(i),JSON.stringify(h.locator)),l={event:"click",locator:h.locator};else{let v=h.node.closest("form");if(!v)return"\u26A0 That element isn\u2019t inside a form.";let R=Xe(v,document);if(!ut(R,v,document))return"\u26A0 This form can\u2019t be targeted reliably, so it can\u2019t be tracked.";i=v,a=st((y=(f=v.getAttribute("id"))!=null?f:v.getAttribute("name"))!=null?y:"form-submitted",JSON.stringify(R)),l={event:"form_submit",locator:R}}}else if(o.event==="url_reached"){let h=(p=o.urlPattern)!=null?p:Nt(location.pathname);a=st(pt(h)?`reached-${pt(h)}`:"page-visited",h),l={event:"url_reached",urlPattern:h}}else a=`read-${Math.round(((k=o.threshold)!=null?k:.75)*100)}pct`,l={event:"scroll_depth",threshold:(T=o.threshold)!=null?T:.75};return(await Tt(a,le(K({},l),{displayName:o.displayName}),o.displayName)).r!=="ok"?(A=Z.textContent)!=null?A:"\u26A0 Couldn\u2019t save the goal.":(yr(i,o.event==="scroll_depth"?l.threshold:void 0,o.displayName),`[Created draft goal "${o.displayName}"]`)},io=async o=>{var k,T,A;let i=o.trim();if(!i||dn)return;dn=!0,te&&(te.value="",te.disabled=!0),qe("user",i),We.push({role:"user",content:i.slice(0,4e3)}),c("form_opened",{kind:"chat"});let a=qe("assistant","\u2026"),l="",u=!1,f=[],y=[],p=h=>{var R,C;if(h==="[DONE]")return;let v;try{v=JSON.parse(h)}catch(D){return}if(v.error){f.push("\u26A0 The assistant hit a problem \u2014 try again.");return}if(v.type==="delta"&&v.text)u&&l&&(l+=`
24
+ `,((t=document.head)!=null?t:document.documentElement).appendChild(e)}function Qt(e){var r,s;Qo(),(r=document.getElementById(tn))==null||r.remove();let t=d("div",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",maxWidth:"320px",padding:"14px 16px",borderRadius:"14px",background:"#111827",color:"#fff",font:"13px/1.45 system-ui, sans-serif",border:"1px solid rgba(245,158,11,0.6)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",display:"flex",gap:"10px",alignItems:"flex-start",cursor:"pointer"});t.id=tn;let n=d("span",{width:"9px",height:"9px",marginTop:"4px",borderRadius:"50%",background:"#f59e0b",flex:"0 0 auto"});t.append(n,d("div",{},e)),((s=document.body)!=null?s:document.documentElement).appendChild(t),t.addEventListener("click",()=>t.remove()),setTimeout(()=>t.remove(),1e4)}function hi(){let e=window.__sentientEditor;return e&&typeof e.apiBase=="string"&&(typeof e.token=="string"||typeof e.code=="string")?e:null}async function er(e){try{let t=await fetch(`${e.apiBase}/v1/editor/exchange`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:e.code})}),n=t.ok?(await t.json()).token:null;return e.code=null,n?(e.token=n,Uo(n),200):t.ok?500:t.status}catch(t){return 0}}async function yi(e){try{let t=await fetch(`${e.apiBase}/v1/editor/verify`,{headers:{authorization:`Bearer ${e.token}`}});if(t.status===401)return{ok:!1,unauthorized:!0};if(!t.ok)return{ok:!1,unauthorized:!1};let n=(await t.json()).projectId;return n?{ok:!0,projectId:n}:{ok:!1,unauthorized:!1}}catch(t){return{ok:!1,unauthorized:!1}}}function Nn(e,t){return K(K(K(K({r:e===401?"expired":"error",status:e},typeof(t==null?void 0:t.error)=="string"?{code:t.error}:{}),typeof(t==null?void 0:t.message)=="string"?{message:t.message}:{}),typeof(t==null?void 0:t.feature)=="string"?{feature:t.feature}:{}),typeof(t==null?void 0:t.plan)=="string"?{plan:t.plan}:{})}async function ce(e,t,n){try{let r=await fetch(`${e.apiBase}${t}`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify(n)});if(r.ok)return{r:"ok"};let s=await r.json().catch(()=>null);return Nn(r.status,s)}catch(r){return{r:"error"}}}async function bi(e,t){try{let n=await fetch(`${e.apiBase}${t}`,{method:"DELETE",headers:{authorization:`Bearer ${e.token}`}});if(n.ok)return{r:"ok"};let r=await n.json().catch(()=>null);return Nn(n.status,r)}catch(n){return{r:"error"}}}async function vi(e,t,n){try{let r=await fetch(`${e.apiBase}${t}`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify(n)}),s=await r.json().catch(()=>null);return r.ok?{r:"ok",data:s,outcome:{r:"ok"}}:{r:r.status===401?"expired":"error",data:s,outcome:Nn(r.status,s)}}catch(r){return{r:"error",data:null,outcome:{r:"error"}}}}var $n=[];function Rn(e){return/^#[0-9a-fA-F]{6}$/.test(e)}function Bn(e){let t=e.trim();if(Rn(t))return t;let n=/^#([0-9a-fA-F]{3})$/.exec(t);if(n)return`#${n[1].split("").map(c=>c+c).join("")}`;let r=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)/.exec(t);if(!r)return t;let s=c=>Math.min(255,Number(c)).toString(16).padStart(2,"0");return`#${s(r[1])}${s(r[2])}${s(r[3])}`}var Ze=null,On=[];function tr(e){On=e}async function xi(e){try{let t=await fetch(`${e.apiBase}/v1/editor/targets`,{headers:{authorization:`Bearer ${e.token}`}});if(!t.ok)return[];let n=await t.json();return $n=Array.isArray(n.fonts)?n.fonts.filter(r=>typeof r=="string"):[],Array.isArray(n.targets)?n.targets:[]}catch(t){return[]}}async function ft(e,t){try{let n=await fetch(`${e.apiBase}${t}`,{headers:{authorization:`Bearer ${e.token}`}});return n.ok?await n.json():null}catch(n){return null}}function mt(e=document){for(let t of Array.from(e.querySelectorAll(`.${An}`)))t.remove()}function nr(e,t=document){var r;mt(t);let n=0;for(let s of e){if(n>=mi)break;let c=we(s.locator,t);if(!c)continue;let m=c.getBoundingClientRect(),x=d("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483645",left:`${m.left}px`,top:`${m.top}px`,width:`${m.width}px`,height:`${m.height}px`,border:"2px dashed #10b981",background:"rgba(16,185,129,0.08)"});x.className=An;let g=d("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483645",left:`${m.left}px`,top:`${Math.max(0,m.top-20)}px`,padding:"2px 6px",borderRadius:"4px",background:"#10b981",color:"#fff",font:"11px system-ui, sans-serif",whiteSpace:"nowrap"},s.label);g.className=An,((r=t.body)!=null?r:t.documentElement).append(x,g),n+=1}}function en(e,t){let n=e.previousElementSibling,r=e.nextElementSibling,s=n?Xe(n,t):null,c=r?Xe(r,t):null;return{prevEl:n,nextEl:r,prevLocator:n&&s&&ut(s,n,t)?s:null,nextLocator:r&&c&&ut(c,r,t)?c:null}}var wi=/testimonial|review|quote/i;function or(e){let t=[],n=e.headings.length>=1,r=e.links.length>=1;return n&&r&&t.push("hero","cta_band"),e.headings.length>=2&&e.paragraphs.length>=2&&t.push("feature_grid"),e.quotes.length>=1&&t.push("testimonial"),t}var Mn=["color","background","fontSize","fontWeight","borderRadius","textAlign","fontFamily"],ki=/^(0|\d*\.?\d+(px|rem|em|%|vh|vw|vmin|vmax|ch|pt))$/i,Si=new Set(["left","center","right","justify","start","end"]),Ei=/^#([0-9a-f]{3}|[0-9a-f]{4}|[0-9a-f]{6}|[0-9a-f]{8})$/i,Ci=/^(rgb|rgba|hsl|hsla)\(/i;function Ti(e){return Ei.test(e)||Ci.test(e)}function rr(e,t){switch(e){case"fontSize":case"borderRadius":return ki.test(t)?null:"Add a unit, e.g. 20px or 1.5rem.";case"fontWeight":return/^(normal|bold|bolder|lighter)$/i.test(t)||/^\d{1,4}$/.test(t)&&+t>=1&&+t<=1e3?null:"Use 100\u2013900, or normal/bold.";case"textAlign":return Si.has(t.toLowerCase())?null:"Choose left, center, right, or justify.";case"color":case"background":return Ti(t)?null:"Enter a colour, e.g. #1a1a1a.";case"fontFamily":{let n=t.split(",").map(r=>r.trim().replace(/^['"]|['"]$/g,""));return t.length<=120&&n.length>=1&&n.length<=5&&n.every(r=>/^[A-Za-z0-9][A-Za-z0-9 -]*$/.test(r))?null:"Use a font name, e.g. Georgia, serif."}default:return null}}function Pn(e){let t={},n={};for(let r of Mn){let s=e[r];if(typeof s!="string")continue;let c=s.trim();if(c==="")continue;if(!ct(c)){n[r]="That value isn\u2019t allowed.";continue}let m=rr(r,c);if(m){n[r]=m;continue}t[r]=c}return{style:t,errors:n}}var Nt={display:"block",width:"100%",boxSizing:"border-box",marginTop:"4px",padding:"7px 9px",borderRadius:"8px",border:"1px solid rgba(255,255,255,0.18)",background:"#1f2937",color:"#fff",font:"13px system-ui, sans-serif"};function d(e,t,n){let r=document.createElement(e);return Object.assign(r.style,t),n!==void 0&&(r.textContent=n),r}function ir(e){var so;let t=null,n=[],r=null,s=()=>{for(;n.length>0;){let o=n.splice(0,20);try{fetch(`${e.apiBase}/v1/editor/telemetry`,{method:"POST",keepalive:!0,headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({events:o})}).catch(()=>{})}catch(i){}}},c=(o,i)=>{n.push(K({kind:o},i?{meta:i}:{})),r&&clearTimeout(r),r=setTimeout(s,2e3)};window.addEventListener("pagehide",s);let m=d("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483646",border:"2px solid #6366f1",background:"rgba(99,102,241,0.12)",display:"none"});m.id=fi;let x=d("div",{position:"fixed",pointerEvents:"none",zIndex:"2147483646",border:"2px solid #10b981",background:"rgba(16,185,129,0.10)",borderRadius:"4px",display:"none"});x.id=gi;let g=()=>{if(!t||!t.isConnected){x.style.display="none";return}let o=t.getBoundingClientRect();Object.assign(x.style,{display:"block",left:`${o.left-2}px`,top:`${o.top-2}px`,width:`${o.width}px`,height:`${o.height}px`})},k=()=>g();Qo();let y=d("div",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",width:"min(408px, calc(100vw - 32px))",padding:"16px",borderRadius:"14px",background:"#111827",color:"#fff",font:"13px/1.4 system-ui, sans-serif",border:"1px solid rgba(99,102,241,0.55)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)",maxHeight:"calc(100vh - 32px)",overflowY:"auto",overscrollBehavior:"contain"});y.id=gt;let $=d("span",{width:"9px",height:"9px",borderRadius:"50%",background:"#34d399",display:"inline-block",flex:"0 0 auto"});$.className="sntedi-dot";let L=d("div",{display:"flex",alignItems:"center",gap:"8px",fontWeight:"700",fontSize:"14px",marginBottom:"6px"});L.append($,d("span",{},"SentientUI"));let D=d("div",{opacity:"0.85",marginBottom:"8px"},"Click any element on the page to adapt it."),E=!1,z=d("button",F("#374151"),"Pause selecting");z.onclick=()=>{E=!E,z.textContent=E?"Resume selecting":"Pause selecting",E?(m.style.display="none",mt(document),C("Selection paused \u2014 browse normally, then resume.")):C("Click any element on the page to adapt it.")};let J=d("div",{fontSize:"12px",marginBottom:"6px",padding:"5px 8px",borderRadius:"8px",background:"rgba(16,185,129,0.14)",border:"1px solid rgba(16,185,129,0.45)",display:"none",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"}),Z=d("div",{fontSize:"12px",marginBottom:"8px",minHeight:"16px"}),G=d("button",F("#6366f1"),"Test different text here"),X=d("button",F("#374151"),"Change style"),ne=d("button",F("#374151"),"Try a different layout for this section"),Q=d("button",F("#374151"),"Track clicks as a goal"),M=d("button",F("#374151"),"Track form submissions as a goal"),re=d("button",F("#374151"),"Track page visits as a goal"),ie=d("button",F("#374151"),"Track reading this far as a goal"),A=d("button",F("#374151"),"Set up a funnel"),P=d("button",F("#374151"),"Attach this test to a funnel step"),q=d("button",F("#10b981"),"Turn the funnel on"),B=d("button",F("#374151"),"Move up"),V=d("button",F("#374151"),"Move down"),Se=d("button",F("#6366f1"),"Save this arrangement"),ze=d("button",F("#374151"),"Undo"),Ie=_n("close","Close editor"),ye=d("button",F("#10b981"),"Publish now \u2014 go live"),ue=d("button",F("#10b981"),"Start tracking now");for(let o of[G,X,ne,Q,B,V])o.disabled=!0;let je=[G,X,ne,Q,M,B,V];for(let o of je)o.style.display="none";Se.style.display="none",ze.style.display="none",ye.style.display="none",ue.style.display="none",P.style.display="none",q.style.display="none";let pe=d("div",{display:"none",fontSize:"11px",opacity:"0.75",marginBottom:"2px",lineHeight:"1.8",overflow:"hidden",textOverflow:"ellipsis"}),ee=d("div",{}),Ae=[{id:"text",label:"Text",icon:"\u270F\uFE0F"},{id:"style",label:"Style",icon:"\u{1F3A8}"},{id:"layout",label:"Layout",icon:"\u{1F9F1}"},{id:"goals",label:"Goals",icon:"\u{1F3AF}"},{id:"funnels",label:"Funnels",icon:"\u{1F9ED}"},{id:"drafts",label:"Drafts",icon:"\u{1F5C2}\uFE0F"}],Y="text",et=new Map,ve=new Map,$e=new Map,Dn=d("div",{display:"flex",gap:"0",margin:"10px 0 0",justifyContent:"space-between",borderBottom:"1px solid rgba(255,255,255,0.1)"}),Hn=d("div",{paddingTop:"10px"});for(let o of Ae){let i=d("button",{background:"transparent",border:"none",cursor:"pointer",font:"600 11.5px system-ui, sans-serif",color:"#9ca3af",whiteSpace:"nowrap",padding:"7px 5px",borderBottom:"2px solid transparent",marginBottom:"-1px"});i.append(d("span",{fontSize:"11px",marginRight:"3px"},o.icon),d("span",{},o.label)),i.onclick=()=>ar(o.id),et.set(o.id,i),Dn.append(i);let a=d("div",{display:"none"}),l=d("div",{fontSize:"12px",opacity:"0.7",padding:"2px 0 6px",display:"none"});a.append(l),$e.set(o.id,l),ve.set(o.id,a),Hn.append(a)}ve.get("text").append(G),ve.get("style").append(X),ve.get("layout").append(ne,B,V,Se,ze),ve.get("goals").append(Q,M,re,ie),ve.get("funnels").append(A,P,q);let xe=d("div",{});ve.get("drafts").append(xe);let Rt=()=>{var i,a;for(let l of Ae){let u=l.id===Y,f=et.get(l.id);f.style.color=u?"#ffffff":"#9ca3af",f.style.borderBottom=u?"2px solid #6366f1":"2px solid transparent",ve.get(l.id).style.display=u?"block":"none",$e.get(l.id).style.display="none"}let o=l=>{let u=$e.get(Y);u.textContent=l,u.style.display="block"};Y==="text"?t?G.disabled?o(G.title||"This element can\u2019t be targeted reliably \u2014 try its heading or a button."):(i=G.onclick)==null||i.call(G,new MouseEvent("click")):o("Click any text on the page to test a different wording."):Y==="style"?t?X.disabled?o("This element can\u2019t be targeted reliably \u2014 try a heading, a button, or a whole section."):(a=X.onclick)==null||a.call(X,new MouseEvent("click")):o("Click any element on the page to change how it looks."):Y==="layout"?t||o("Click a section to move it or lay it out differently. Layouts re-arrange the words already on the page \u2014 they never add a section you don\u2019t have."):Y==="goals"?t||o("Page-level goals work right away; click a button or form to track it specifically."):Y==="funnels"?o("Chain tracked goals into a journey \u2014 the drop-off view fills in as visitors move through it."):Y==="drafts"&&tt()},Le=(o,i)=>d("button",le(K({},F(o)),{display:"inline-block",width:"auto",margin:"0",padding:"4px 9px",fontSize:"11px",flex:"0 0 auto"}),i),zn=(o,i)=>{let a=new URL(window.location.href);a.searchParams.set("sentient_preview",o),i&&a.searchParams.set("sentient_arm",i),window.location.assign(a.toString())},Dt=(o,i,a)=>{let l=Le("#374151","Discard");return l.onclick=async()=>{l.disabled=!0;let u=await bi(e,o);l.disabled=!1,be(u,i),u.r==="ok"&&a()},l},jn=(o,i)=>{Ke.textContent="";let a=d("div",{margin:"0 0 6px",padding:"8px 10px",borderRadius:"8px",fontSize:"12px",background:"rgba(99,102,241,0.10)",border:"1px solid rgba(99,102,241,0.35)"}),l=d("div",{display:"flex",gap:"6px",flexWrap:"wrap"});l.append(...i),a.append(d("div",{marginBottom:"6px"},o),l),Ke.append(a)},tt=async()=>{var S,T,w,v,b,_,N,H,U,R,ge,me;xe.textContent="",xe.append(d("div",{fontSize:"12px",opacity:"0.6",padding:"4px 0"},"Loading\u2026"));let o=[],i=[],a=null,l=!1;if(await Promise.all([(async()=>{var I;try{let j=await fetch(`${e.apiBase}/v1/editor/slots`,{headers:{authorization:`Bearer ${e.token}`}});j.ok?o=(I=(await j.json()).slots)!=null?I:[]:a=j.status===401?"expired":"error"}catch(j){a="error"}})(),(async()=>{var I;try{let j=await fetch(`${e.apiBase}/v1/editor/goals`,{headers:{authorization:`Bearer ${e.token}`}});j.ok?i=(I=(await j.json()).goals)!=null?I:[]:l=!0}catch(j){l=!0}})()]),Y!=="drafts")return;if(xe.textContent="",a){if(xe.append(d("div",{fontSize:"12px",opacity:"0.8",padding:"4px 0"},a==="expired"?"Editor session expired \u2014 reopen it from your dashboard to see your drafts. They\u2019re safe.":"Couldn\u2019t load your drafts \u2014 they\u2019re safe; check your connection and retry.")),a==="error"){let I=Le("#374151","Retry");I.onclick=()=>{tt()},xe.append(I)}return}let u=o.filter(I=>{var j,se,_e,Ne,Ve,_t;return((_e=(se=(j=I.draft_config)==null?void 0:j.arms)==null?void 0:se.length)!=null?_e:0)>0||((_t=(Ve=(Ne=I.published_config)==null?void 0:Ne.arms)==null?void 0:Ve.length)!=null?_t:0)>0}),f=i.filter(I=>I.event!=="custom"&&(I.status==="draft"||I.status==="active"));if(u.length===0&&f.length===0&&!l){xe.append(d("div",{fontSize:"12px",opacity:"0.7",padding:"4px 0"},"Nothing saved yet \u2014 changes and goals you save land here, previewable before they go live."));return}let h=I=>d("span",{fontSize:"10px",padding:"2px 7px",borderRadius:"999px",flex:"0 0 auto",background:I?"rgba(16,185,129,0.2)":"rgba(99,102,241,0.25)",color:I?"#6ee7b7":"#c7d2fe"},I?"live":"draft"),p=I=>{let j=d("div",{display:"flex",alignItems:"center",gap:"6px",padding:"7px 0",borderBottom:"1px solid rgba(255,255,255,0.08)",fontSize:"12px"}),se=d("div",{flex:"1 1 auto",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},I);return j.append(se),{row:j,name:se}};for(let I of u){let{row:j}=p((S=I.display_name)!=null?S:I.slot_id);j.append(h(I.status==="published"));let se=(b=(v=(T=I.draft_config)==null?void 0:T.arms)!=null?v:(w=I.published_config)==null?void 0:w.arms)!=null?b:[],_e=(H=(_=se[1])==null?void 0:_.id)!=null?H:(N=se[0])==null?void 0:N.id,Ne=Le("#374151","Preview");if(Ne.onclick=()=>zn(I.slot_id,_e),j.append(Ne),I.status!=="published"&&((ge=(R=(U=I.draft_config)==null?void 0:U.arms)==null?void 0:R.length)!=null?ge:0)>0){let Ve=Le("#10b981","Publish");Ve.onclick=async()=>{Ve.disabled=!0;let _t=await ce(e,`/v1/editor/slots/${encodeURIComponent(I.slot_id)}/publish`,{});Ve.disabled=!1,be(_t,"\u2713 Published \u2014 live for new visitors."),_t.r==="ok"&&(c("published",{kind:"slot"}),tt())},j.append(Ve)}I.status!=="published"&&j.append(Dt(`/v1/editor/slots/${encodeURIComponent(I.slot_id)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>{Yn(I.slot_id),tt()})),xe.append(j)}if(l)xe.append(d("div",{fontSize:"11px",opacity:"0.6",padding:"6px 0 2px"},"Couldn\u2019t load your goals right now \u2014 they\u2019re safe."));else if(f.length>0){xe.append(d("div",{fontSize:"11px",opacity:"0.6",padding:"8px 0 2px"},"Goals"));for(let I of f){let{row:j}=p((me=I.display_name)!=null?me:I.goal_id);if(j.append(h(I.status==="active")),I.status==="draft"){let se=Le("#10b981","Start tracking");se.onclick=async()=>{se.disabled=!0;let _e=await ce(e,`/v1/editor/goals/${encodeURIComponent(I.goal_id)}/publish`,{});se.disabled=!1,be(_e,"\u2713 Tracking is live \u2014 it counts from your next visitor."),_e.r==="ok"&&(c("published",{kind:"goal"}),tt())},j.append(se,Dt(`/v1/editor/goals/${encodeURIComponent(I.goal_id)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>{Jn(I.goal_id),tt()}))}xe.append(j)}}},ar=o=>{Y!==o&&(ae(),kt(),Y=o,Rt())},Kn=d("div",{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"});Object.assign(L.style,{marginBottom:"0",flex:"1 1 auto",fontSize:"13px",whiteSpace:"nowrap"});let Un=!1,Be=d("button",{position:"fixed",bottom:"16px",right:"16px",zIndex:"2147483647",width:"44px",height:"44px",borderRadius:"12px",border:"1px solid #2a2a2a",background:"#000",cursor:"pointer",display:"none",padding:"0",alignItems:"center",justifyContent:"center",boxShadow:"0 6px 18px rgba(0,0,0,0.4)"});Be.append(_i(26)),Be.title="Open the SentientUI editor",Be.setAttribute("aria-label","Open the SentientUI editor");let Gn=_n("minimize","Minimize");Gn.onclick=()=>{y.style.display="none",Be.style.display="flex",Un=E,E=!0,m.style.display="none",mt(document)},Be.onclick=()=>{y.style.display="block",Be.style.display="none",E=Un},Object.assign(z.style,{display:"inline-block",width:"auto",margin:"0",padding:"3px 8px",fontSize:"10.5px",borderRadius:"999px",background:"#374151",whiteSpace:"nowrap"}),Kn.append(L,z,Gn,Ie);let Fn=d("div",{marginTop:"10px",borderTop:"1px solid rgba(255,255,255,0.1)",paddingTop:"8px"}),Ke=d("div",{});Object.assign(Z.style,{marginBottom:"4px"}),Fn.append(Ke,Z,ye,ue);let Wn=d("button",{display:"inline-block",width:"auto",margin:"0",padding:"5px 10px",flex:"0 0 auto",fontSize:"11px",borderRadius:"999px",background:"rgba(250,204,21,0.15)",border:"1px solid rgba(250,204,21,0.45)",color:"#fde68a",cursor:"pointer",whiteSpace:"nowrap"},"\u2728 Ask AI"),on=d("div",{display:"flex",alignItems:"center",gap:"6px"});Object.assign(J.style,{flex:"1 1 auto",marginBottom:"0"}),on.append(J,Wn),Object.assign(on.style,{marginBottom:"6px"});let Ht=d("div",{}),W=d("div",{marginTop:"4px"});W.addEventListener("input",()=>{nt=!0}),W.addEventListener("change",()=>{nt=!0}),y.append(Kn,D,on,pe,ee,Ht,Dn,Hn,W,Fn),((so=document.body)!=null?so:document.documentElement).append(m,x,y,Be);let Oe=null,zt=()=>{Oe==null||Oe(),Oe=null},qn=()=>{Oe=null},ht=null,nt=!1,rn=null,ae=()=>{zt(),ht=null,W.textContent="",nt=!1,rn=null,gn=!1},yt=(o,i,a,l)=>{var T;ae();let u={},f={};for(let w of o){let v=d("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},w.label);if(W.append(v),w.type==="select"){let _=d("select",Nt);_.setAttribute("data-field",w.key);let N=document.createElement("option");N.value="",N.textContent="\u2014 no change \u2014",_.append(N);for(let H of(T=w.options)!=null?T:[]){let U=document.createElement("option");U.value=H,U.textContent=H,_.append(U)}u[w.key]=()=>_.value,W.append(_)}else if(w.type==="color"){let _=d("input",le(K({},Nt),{padding:"2px",height:"34px"}));_.type="color",_.setAttribute("data-field",w.key);let N=!1;_.addEventListener("input",()=>{N=!0}),u[w.key]=()=>N?_.value:"",W.append(_)}else{let _=d("input",Nt);_.setAttribute("data-field",w.key),w.value!==void 0&&(_.value=w.value),u[w.key]=()=>_.value,W.append(_)}let b=d("div",{fontSize:"11px",color:"#fca5a5",marginTop:"3px",display:"none"});b.setAttribute("data-feedback",w.key),f[w.key]=b,W.append(b)}let h=(w,v)=>{let b=f[w];b&&(b.textContent=v!=null?v:"",b.style.display=v?"block":"none")};if(l){let w=Vn(l);W.append(w.node),u[bt]=w.value}let p=d("button",F("#6366f1"),i),S=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");p.onclick=()=>a(Object.fromEntries(Object.entries(u).map(([w,v])=>[w,v()])),h),S.onclick=ae,W.append(p,S)},bt="__page",an={},sr=o=>{var i;for(let a of o!=null?o:[])an[a.slot_id]=(i=a.target)==null?void 0:i.page};ft(e,"/v1/editor/slots").then(o=>sr(o==null?void 0:o.slots));let Vn=o=>{let i=Pt(location.pathname),a=d("div",{}),l=d("select",Nt);l.setAttribute("data-field","page");for(let u of Ln(i,an[o])){let f=document.createElement("option");f.value=u,f.textContent=Fo(u,i),l.append(f)}return a.append(d("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},"Where does this appear?"),l,d("div",{fontSize:"11px",opacity:"0.6",marginTop:"3px"},"Helps us tell a moved element from a page it isn\u2019t on.")),{node:a,value:()=>l.value}},vt=(o,i)=>i?le(K({},o),{page:i}):o,C=(o,i=!0)=>{Z.textContent=o,Z.style.color=i?"#a7f3d0":"#fca5a5"},sn=(o,i)=>{var l,u;if(c("error_shown",{code:(u=o.code)!=null?u:`http_${(l=o.status)!=null?l:"network"}`}),o.code==="plan_limit_reached"){let f=o.feature==="live_goals"?"live goal":"of these",h=o.plan?`${o.plan} plan`:"plan";return o.feature==="live_goals"?`Your ${h} includes 1 live goal. Pause another goal in your dashboard, or upgrade to track more.`:`Your ${h} has reached its limit for ${f}. Manage them in your dashboard, or upgrade for more.`}if(o.code==="role_required")return"Your account can view but not edit this project \u2014 ask an admin for editor access.";if(o.code==="demo_read_only"&&o.message)return o.message;let a=o.status?` (HTTP ${o.status})`:"";return`\u26A0 Couldn\u2019t ${i} \u2014 try again.${a}`},be=(o,i)=>{o.r==="ok"?C(i,!0):o.r==="expired"?C("Editor session expired \u2014 reopen it from your dashboard to save this. Your earlier changes are safe.",!1):C(sn(o,"save"),!1)},Ue=null,jt=o=>o.length>30?`${o.slice(0,27)}\u2026`:o,Yn=o=>{Ue===o&&(ht===o&&(zt(),ht=null),Ue=null,ye.style.display="none",P.style.display="none",Ke.textContent="")},Jn=o=>{at===o&&(at=null,ue.style.display="none",Ke.textContent="")},xt=(o,i,a)=>{Ue=o,ye.textContent=i?`Publish \u201C${jt(i)}\u201D \u2014 go live`:"Publish now \u2014 go live",ye.style.display="block",P.style.display="block";let l=[];if(a){let u=Le("#374151","Preview");u.onclick=()=>zn(o,a),l.push(u)}l.push(Dt(`/v1/editor/slots/${encodeURIComponent(o)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>Yn(o))),jn(i?`Draft saved for \u201C${jt(i)}\u201D \u2014 nothing is live for visitors yet.`:"Draft saved \u2014 nothing is live for visitors yet.",l)};ye.onclick=async()=>{if(!Ue)return;ye.disabled=!0,C("Publishing\u2026");let o=await ce(e,`/v1/editor/slots/${encodeURIComponent(Ue)}/publish`,{});ye.disabled=!1,o.r==="ok"?(c("published",{kind:"slot"}),C("\u2713 Published \u2014 live for new visitors.",!0),ye.style.display="none",Ue=null,Ke.textContent=""):o.r==="expired"?C("Editor session expired \u2014 reopen it from your dashboard to publish. Your saved draft is safe.",!1):C(sn(o,"publish"),!1)};let oe=null,Me=!1,ot=null,rt=null,Ee=null,Ge=null,wt=null,Kt=null,Fe=!1,Xn=(o,i)=>Me?o?"":`Nothing to swap with ${i} \u2014 it\u2019s at the edge, or that neighbor can\u2019t be targeted reliably.`:"This element can\u2019t be targeted reliably, so it can\u2019t be moved.",Zn=()=>{B.disabled=!Me||!Ee,V.disabled=!Me||!Ge,B.title=B.disabled?Xn(Ee,"above"):"",V.title=V.disabled?Xn(Ge,"below"):""},Ce=null,ln=o=>{o&&!Ce&&t&&oe?(Ce=Vn(Te("move",oe,t)),Se.before(Ce.node)):o||(Ce==null||Ce.node.remove(),Ce=null),Se.style.display=o?"block":"none",ze.style.display=o?"block":"none",Zn()},kt=()=>{if(Fe&&t&&wt&&wt.insertBefore(t,Kt),Fe=!1,wt=null,Kt=null,t){let o=en(t,document);ot=o.prevEl,rt=o.nextEl,Ee=o.prevLocator,Ge=o.nextLocator}g(),ln(!1)},Qn=o=>{if(E)return;let i=o.target;if(!i||y.contains(i)||i===m)return;mt(document);let a=i.getBoundingClientRect();Object.assign(m.style,{display:"block",left:`${a.left}px`,top:`${a.top}px`,width:`${a.width}px`,height:`${a.height}px`})},Pe=o=>{var a;let i=((a=o.textContent)!=null?a:"").trim().replace(/\s+/g," ");return i?i.length>40?`${i.slice(0,37)}\u2026`:i:o.tagName.toLowerCase()},lr=o=>!!o.id||["section","header","footer","nav","main","form","article","aside"].includes(o.tagName.toLowerCase())||!!o.querySelector(":scope > h1, :scope > h2, :scope > h3"),cr=o=>{var l;let i=o.querySelector("h1, h2, h3"),a=(l=i==null?void 0:i.textContent)==null?void 0:l.replace(/\s+/g," ").trim();return a?a.length>28?`${a.slice(0,25)}\u2026`:a:o.id?`#${o.id.length>24?`${o.id.slice(0,21)}\u2026`:o.id}`:`<${o.tagName.toLowerCase()}>`},dr=o=>{pe.textContent="";let i=[];for(let h=o.parentElement;h&&h!==document.body&&i.length<3;h=h.parentElement)lr(h)&&i.push(h);let a=Pe(o),l=()=>d("span",{opacity:"0.5",margin:"0 4px"},"\u2039"),u=!0;for(let h of i){let p=cr(h);if(p===a||a.startsWith(p))continue;let S=d("button",{background:"transparent",border:"none",color:"#a5b4fc",cursor:"pointer",font:"inherit",padding:"0",textDecoration:"underline"},p);S.onclick=()=>St(h),u||pe.append(l()),pe.append(S),u=!1}u||pe.append(l());let f=d("button",{background:"transparent",border:"none",color:"#a5b4fc",cursor:"pointer",font:"inherit",padding:"0",textDecoration:"underline",opacity:"0.7"},"Page");f.onclick=()=>eo(),pe.append(f),pe.style.display="block"},ur=o=>{ee.textContent="";let i=null,a=0;for(let u=o.parentElement;u&&u!==document.body&&a<6;u=u.parentElement,a++)if(ut(Xe(u,document),u,document)){i=u;break}let l=d("div",{marginBottom:"8px",padding:"8px 10px",borderRadius:"8px",fontSize:"12px",background:"rgba(252,165,165,0.12)",border:"1px solid rgba(252,165,165,0.4)"});if(i){let u=i;l.append(d("div",{marginBottom:"6px"},"This exact element can\u2019t be tracked safely \u2014 it looks identical to others on the page. You can pick something more specific inside it, or work with the whole block, which we can target reliably."));let f=d("button",le(K({},F("#6366f1")),{marginTop:"0"}),`Select \u201C${Pe(u)}\u201D instead`);f.onclick=()=>St(u);let h=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Pick something else");h.onclick=()=>{ee.textContent=""},l.append(f,h)}else l.append(d("div",{},"This part of the page can\u2019t be targeted reliably \u2014 try a heading, a button, or a whole section instead."));ee.append(l)},St=o=>{kt(),ae(),ee.textContent="",t=o,oe=Xe(o,document);let i=ut(oe,o,document);Me=i,g(),J.style.display="block",J.textContent=`Selected: ${Pe(o)}`,dr(o),c("element_selected",{unique:i}),C(i?"\u2713 Matches exactly 1 element":"",i),i||ur(o),D.style.display="none",pn();for(let f of je)f.style.display="block";G.style.display="none",X.style.display="none";let a=vn(o);G.disabled=!i||!a,G.title=i?a?"":"This element contains other elements, so testing text here would replace them. Pick the text itself (e.g. the heading), not its container.":"",X.disabled=!i,ne.disabled=!i,Q.disabled=!i;let l=o.closest("form");M.style.display=l?"block":"none",M.disabled=!l;let u=en(o,document);ot=u.prevEl,rt=u.nextEl,Ee=u.prevLocator,Ge=u.nextLocator,Zn(),Rt()},eo=()=>{kt(),ae(),t=null,oe=null,Me=!1,ot=null,rt=null,Ee=null,Ge=null,g(),ee.textContent="",pn(),pe.textContent="",pe.style.display="none",J.textContent="",J.style.display="none";for(let o of je)o.style.display="none";D.style.display="block",C(""),Rt()},it=!1,cn=-1,to=o=>{var l,u;let i=o.target,a=!!((l=i==null?void 0:i.closest)!=null&&l.call(i,'input, textarea, select, [contenteditable="true"]'));if(o.key==="Escape"){if(W.childElementCount>0){ae(),it=!1;return}if(t){eo(),it=!1;return}if(!it){it=!0,C("Press Esc again to close the editor.");return}it=!1,(u=Ie.onclick)==null||u.call(Ie,new MouseEvent("click"));return}if(it=!1,!(a||E)){if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!t||(o.key==="ArrowUp"?B:V).disabled)return;o.preventDefault(),fn(o.key==="ArrowUp"?"up":"down");return}if(o.key==="Tab"){let f=[];for(let p of On){let S=we(p.locator,document);S&&!f.includes(S)&&f.push(S)}if(f.length===0)return;if(nt){C("\u26A0 You have unsaved changes \u2014 Save or Cancel before picking another element.",!1),o.preventDefault();return}o.preventDefault(),cn=(cn+(o.shiftKey?-1:1)+f.length)%f.length;let h=f[cn];St(h);try{h.scrollIntoView({block:"center",behavior:"smooth"})}catch(p){}}}},no=o=>{if(E)return;let i=o.target;if(!(!i||y.contains(i))){if(o.preventDefault(),o.stopPropagation(),nt&&i!==t&&rn!==i){rn=i,C("\u26A0 You have unsaved changes \u2014 Save or Cancel first, or click that element again to discard them.",!1);return}St(i)}};G.onclick=()=>{var f,h;if(!t||!oe)return;c("form_opened",{kind:"text"});let o=oe,i=(h=(f=t.textContent)==null?void 0:f.trim())!=null?h:"";yt([{key:"current",label:"Current wording",value:i},{key:"alt",label:"Alternative wording to test",value:""}],"Save draft",async p=>{let S=p.alt.trim();if(!S){C("\u26A0 Enter alternative wording to test.",!1);return}if(S===p.current.trim()){C("\u26A0 Enter different wording \u2014 the alternative matches the current text.",!1);return}let T=Te("text",o,t);C("Saving\u2026");let w=await ce(e,`/v1/editor/slots/${encodeURIComponent(T)}`,{kind:"arms",target:vt(o,p[bt]),draftConfig:{arms:[{id:"a",displayName:"Original",ops:{text:p.current}},{id:"b",displayName:"Alternative",ops:{text:p.alt}}]}});w.r==="ok"&&(c("draft_saved",{kind:"slot"}),qn(),ae(),xt(T,Pe(t),"b")),be(w,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Te("text",o,t));let a=t,l=xn(a);Oe=()=>{Ye(a,l)};let u=W.querySelector('input[data-field="alt"]');u==null||u.addEventListener("input",()=>{Ye(a,u.value.trim()===""?l:u.value)})};let Et=null,oo=o=>{let i=p=>{var S;return((S=p.textContent)!=null?S:"").replace(/\s+/g," ").trim()},a=Array.from(o.querySelectorAll("h1,h2,h3,h4")).map(i).filter(Boolean);if(a.length===0){let p=o.closest("h1,h2,h3,h4");p&&a.push(i(p))}let l=Array.from(o.querySelectorAll("p")).map(i).filter(p=>p.length>0&&p.length<=300),u=[];for(let p of Array.from(o.querySelectorAll("a[href], button"))){let S=i(p);if(!S||S.length>60)continue;let T="",w=p.getAttribute("href");if(w)try{let v=new URL(w,window.location.href);v.protocol==="https:"&&(T=v.href)}catch(v){}u.push({label:S,href:T})}let f=Array.from(o.querySelectorAll("blockquote, q")).map(i).filter(Boolean);if(f.length===0&&wi.test(`${o.className} ${o.id}`))for(let p of l)p.length>=20&&f.push(p);let h=Array.from(o.querySelectorAll('cite, figcaption, footer, [class*="author"]')).map(i).filter(p=>p.length>0&&p.length<=80);return{headings:a,paragraphs:l,links:u,quotes:f,attributions:h}},pr=(o,i)=>{var l,u,f,h,p,S,T,w,v,b,_,N,H,U,R,ge,me,I,j,se;let a=_e=>{var Ne;return i.paragraphs.length>=3&&(Ne=i.paragraphs[i.paragraphs.length-3+_e])!=null?Ne:""};switch(o){case"headline":return(l=i.headings[0])!=null?l:"";case"supporting":return(u=i.paragraphs[0])!=null?u:"";case"cta_label":return(h=(f=i.links[0])==null?void 0:f.label)!=null?h:"";case"cta_href":return(S=(p=i.links[0])==null?void 0:p.href)!=null?S:"";case"secondary_label":return(w=(T=i.links[1])==null?void 0:T.label)!=null?w:"";case"secondary_href":return(b=(v=i.links[1])==null?void 0:v.href)!=null?b:"";case"quote":case"q1":return(_=i.quotes[0])!=null?_:"";case"q2":return(N=i.quotes[1])!=null?N:"";case"q3":return(H=i.quotes[2])!=null?H:"";case"name":case"n1":return(U=i.attributions[0])!=null?U:"";case"n2":return(R=i.attributions[1])!=null?R:"";case"n3":return(ge=i.attributions[2])!=null?ge:"";case"role":return(me=i.attributions[1])!=null?me:"";case"eyebrow":return"";case"f1_title":return(I=i.headings[1])!=null?I:"";case"f2_title":return(j=i.headings[2])!=null?j:"";case"f3_title":return(se=i.headings[3])!=null?se:"";case"f1_body":return a(0);case"f2_body":return a(1);case"f3_body":return a(2);default:return""}},fr=(o,i,a)=>{c("form_opened",{kind:"arrangement"});let l=oo(a);yt(o.fields.map(u=>({key:u.id,label:u.kind==="href"?`${u.label} (https link \u2014 required)`:u.label,value:pr(u.id,l)})),"Save draft",async(u,f)=>{var _,N,U,R,ge;let h=!1,p=!1;for(let me of o.fields){if(me.kind==="href"){let j=!1;try{j=new URL((_=u[me.id])!=null?_:"").protocol==="https:"}catch(se){}f(me.id,j?null:"Links need to start with https://"),j||(h=!0);continue}let I=((N=u[me.id])!=null?N:"").trim()==="";f(me.id,I?"Fill this in with your own words":null),I&&(p=!0)}if(h){C("\u26A0 Fix the highlighted link(s).",!1);return}if(p){C("\u26A0 Every field needs your own words \u2014 this layout re-arranges your copy, it doesn\u2019t write any.",!1);return}C("Saving\u2026");let H=u,{[bt]:S}=H,T=po(H,[uo(bt)]),w=await vi(e,`/v1/editor/arrangements/${encodeURIComponent(o.id)}/instantiate`,{fields:T});if(w.r!=="ok"||!((U=w.data)!=null&&U.blocks)){w.r==="expired"?be(w.outcome,""):C(`\u26A0 ${(ge=(R=w.data)==null?void 0:R.reason)!=null?ge:"Couldn\u2019t build the arrangement \u2014 check the fields."}`,!1);return}let v=Te("arrange",i,a),b=await ce(e,`/v1/editor/slots/${encodeURIComponent(v)}`,{kind:"arms",target:vt(i,S),draftConfig:{arms:[{id:"original",displayName:"Your page today"},{id:o.id,displayName:o.name,blocks:w.data.blocks}],baseline:"original"}});b.r==="ok"&&(c("draft_saved",{kind:"arrangement"}),ae(),xt(v,o.name,o.id)),be(b,"\u2713 Saved as a draft \u2014 it will test against this section as it is today. Click \u201CPublish\u201D below to go live.")},Te("arrange",i,a))};ne.onclick=async()=>{var f,h;if(!t||!oe)return;let o=oe,i=t;if(ae(),C("Loading arrangements\u2026"),!Et){let p=await ft(e,"/v1/editor/arrangements");Et=(f=p==null?void 0:p.arrangements)!=null?f:null}if(!Et||Et.length===0){C("\u26A0 Couldn\u2019t load the arrangements \u2014 try again.",!1);return}let a=or(oo(i)),l=Et.filter(p=>a.includes(p.sectionType));if(l.length===0){C("No other layout fits this section. Layouts re-arrange the words already here \u2014 they don\u2019t add sections your page doesn\u2019t have.",!1);return}C("Pick a layout for this section \u2014 your own words are carried across.");for(let p of l){let S=d("button",le(K({},F("#374151")),{textAlign:"left"}));S.append(d("div",{fontWeight:"600"},p.name),d("div",{fontSize:"11px",opacity:"0.7"},p.description)),S.onclick=()=>fr(p,o,i),W.append(S)}let u=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");u.onclick=ae,W.append(u),(h=W.scrollIntoView)==null||h.call(W,{block:"nearest"})};let at=null,gr=(o,i)=>{at=o,ue.textContent=i?`Start tracking \u201C${jt(i)}\u201D now`:"Start tracking now",ue.style.display="block",jn(i?`Goal \u201C${jt(i)}\u201D saved \u2014 it isn\u2019t counting anything until you start it.`:"Goal saved \u2014 it isn\u2019t counting anything until you start it.",[Dt(`/v1/editor/goals/${encodeURIComponent(o)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>Jn(o))])};ue.onclick=async()=>{if(!at)return;ue.disabled=!0,C("Activating\u2026");let o=await ce(e,`/v1/editor/goals/${encodeURIComponent(at)}/publish`,{});ue.disabled=!1,o.r==="ok"?(c("published",{kind:"goal"}),C("\u2713 Tracking is live \u2014 it counts from your next visitor.",!0),ue.style.display="none",at=null,Ke.textContent=""):o.r==="expired"?C("Editor session expired \u2014 reopen it from your dashboard to activate. Your saved goal is safe.",!1):C(sn(o,"activate"),!1)};let st=(o,i)=>`${pt(o)||"goal"}-${Zo(i)}`.slice(0,128),ro=o=>{var l,u,f;let i=((l=o.textContent)!=null?l:"").replace(/\s+/g," ").trim();return i&&i.length<=60?i:((f=(u=o.getAttribute("aria-label"))!=null?u:o.getAttribute("id"))!=null?f:"").trim()||"element-clicked"},Ct=async(o,i,a)=>{C("Saving\u2026");let l=await ce(e,`/v1/editor/goals/${encodeURIComponent(o)}`,i);return l.r==="ok"&&(c("draft_saved",{kind:"goal"}),gr(o,a)),be(l,"\u2713 Goal saved. Click \u201CStart tracking\u201D below to go live."),l};Q.onclick=()=>{if(!t||!oe)return;let o=st(ro(t),JSON.stringify(oe));Ct(o,{event:"click",locator:oe},Pe(t))},M.onclick=()=>{var l,u;let o=t==null?void 0:t.closest("form");if(!o)return;let i=Xe(o,document),a=(u=(l=o.getAttribute("id"))!=null?l:o.getAttribute("name"))!=null?u:"form-submitted";Ct(st(a,JSON.stringify(i)),{event:"form_submit",locator:i},a)},re.onclick=()=>{let o=window.location.pathname||"/",i=pt(o)?`reached-${pt(o)}`:"page-visited";Ct(st(i,o),{event:"url_reached",urlPattern:o},o)};let dn=[{label:"25% \u2014 skimmed the top",value:.25},{label:"50% \u2014 read halfway",value:.5},{label:"75% \u2014 read most of the page",value:.75},{label:"90% \u2014 read to the end",value:.9}];ie.onclick=()=>{yt([{key:"depth",label:"Counts once a visitor reads",type:"select",options:dn.map(o=>o.label)}],"Track it",o=>{var l;let i=(l=dn.find(u=>u.label===o.depth))!=null?l:dn[2],a=Math.round(i.value*100);Ct(`read-${a}pct`,{event:"scroll_depth",threshold:i.value},`read ${a}%`),ae()})};let Ut=null,mr=o=>{Ut=o,q.style.display="block"};q.onclick=async()=>{if(!Ut)return;q.disabled=!0,C("Turning on\u2026");let o=await ce(e,`/v1/editor/funnels/${encodeURIComponent(Ut)}/publish`,{});q.disabled=!1,o.r==="ok"?(c("published",{kind:"funnel"}),C("\u2713 Funnel is on \u2014 the drop-off view fills in as visitors move through it.",!0),q.style.display="none",Ut=null):o.r==="expired"?C("Editor session expired \u2014 reopen it from your dashboard to turn the funnel on. Your draft is safe.",!1):C("\u26A0 Couldn\u2019t turn the funnel on \u2014 try again.",!1)},A.onclick=async()=>{var w;C("Loading your goals\u2026");let o=await ft(e,"/v1/editor/goals"),i=(w=o==null?void 0:o.goals)!=null?w:[];if(i.length<2){C("Track at least 2 goals first \u2014 a funnel is a sequence of them (e.g. \u201Cviewed pricing\u201D \u2192 \u201Csigned up\u201D).",!1);return}C("Pick the steps in order \u2014 first click = first step."),ae();let a=[],l=d("label",{display:"block",fontSize:"12px",opacity:"0.85",marginTop:"8px"},"Funnel name"),u=d("input",Nt);W.append(l,u);let f=d("div",{fontSize:"11px",opacity:"0.7",marginTop:"6px"},"Steps (click in journey order):");W.append(f);let h=new Map,p=()=>{var v,b;for(let[_,N]of h){let H=a.indexOf(_),U=(b=(v=i.find(R=>R.goal_id===_))==null?void 0:v.display_name)!=null?b:_;N.textContent=H===-1?U:`${H+1}. ${U}`,N.style.background=H===-1?"#374151":"#6366f1"}};for(let v of i){let b=d("button",le(K({},F("#374151")),{textAlign:"left"}));h.set(v.goal_id,b),b.onclick=()=>{a=Wo(a,v.goal_id),p()},W.append(b)}p();let S=d("button",F("#6366f1"),"Save funnel"),T=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");T.onclick=ae,S.onclick=async()=>{let v=qo(u.value,a);if(!v.ok){C(`\u26A0 ${v.error}`,!1);return}C("Saving\u2026");let b=await ce(e,`/v1/editor/funnels/${encodeURIComponent(v.funnelId)}`,v.body);b.r==="ok"&&(c("draft_saved",{kind:"funnel"}),ae(),mr(v.funnelId)),be(b,"\u2713 Funnel saved as a draft. Click \u201CTurn the funnel on\u201D to start measuring.")},W.append(S,T)},P.onclick=async()=>{var p,S;let o=Ue;if(!o)return;C("Loading funnels\u2026");let i=await ft(e,"/v1/editor/funnels"),a=(p=i==null?void 0:i.funnels)!=null?p:[];if(a.length===0){C("No funnels yet \u2014 click \u201CSet up a funnel\u201D first.",!1);return}let l=await ft(e,"/v1/editor/goals"),u=new Map(((S=l==null?void 0:l.goals)!=null?S:[]).map(T=>[T.goal_id,T.display_name]));yt([{key:"funnel",label:"Funnel",type:"select",options:a.map(T=>Xt(T))},{key:"step",label:"Which step does this element serve?",type:"select",options:Zt(a[0],u).map(T=>T.label)}],"Attach",async T=>{var _;let w=(_=a.find(N=>Xt(N)===T.funnel))!=null?_:a[0],v=Zt(w,u).findIndex(N=>N.label===T.step);if(v<0){C("\u26A0 Pick which step this element serves.",!1);return}C("Attaching\u2026");let b=await ce(e,`/v1/editor/funnels/${encodeURIComponent(w.funnel_id)}/assign`,{slotId:o,stepIndex:v});b.r==="ok"&&ae(),be(b,`\u2713 Attached \u2014 this test now works toward \u201C${w.display_name}\u201D.`)});let f=W.querySelector('select[data-field="funnel"]'),h=W.querySelector('select[data-field="step"]');f&&h&&f.addEventListener("change",()=>{var w;let T=(w=a.find(v=>Xt(v)===f.value))!=null?w:a[0];h.length=1;for(let v of Zt(T,u)){let b=document.createElement("option");b.value=v.label,b.textContent=v.label,h.append(b)}})},X.onclick=()=>{if(!t||!oe)return;c("form_opened",{kind:"style"});let o=oe;yt([{key:"color",label:"Text colour",type:"color"},{key:"background",label:"Background colour",type:"color"},{key:"fontSize",label:"Font size (e.g. 20px)"},{key:"fontWeight",label:"Font weight (e.g. 700)"},{key:"fontFamily",label:$n.length?`Font (this site has: ${$n.slice(0,3).join(", ")})`:"Font (e.g. Georgia, serif)"},{key:"borderRadius",label:"Corner radius (e.g. 8px)"},{key:"textAlign",label:"Alignment",type:"select",options:["left","center","right","justify"]}],"Save draft",async(h,p)=>{var _;let{style:S,errors:T}=Pn(h),w=!1;for(let N of Mn)p(N,(_=T[N])!=null?_:null),T[N]&&(w=!0);if(w){C("\u26A0 Fix the highlighted field(s).",!1);return}if(Object.keys(S).length===0){C("\u26A0 Enter at least one style change.",!1);return}let v=Te("style",o,t);C("Saving\u2026");let b=await ce(e,`/v1/editor/slots/${encodeURIComponent(v)}`,{kind:"arms",target:vt(o,h[bt]),draftConfig:{arms:[{id:"a",displayName:"Current look",ops:{}},{id:"b",displayName:"New look",ops:{style:S}}]}});b.r==="ok"&&(c("draft_saved",{kind:"slot"}),qn(),ae(),xt(v,Pe(t),"b")),be(b,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Te("style",o,t));let i=t,a=i.style.cssText;Oe=()=>{i.style.cssText=a};let l={},u=()=>{let{style:h}=Pn(l);i.style.cssText=a;for(let[p,S]of Object.entries(h)){let T=At[p];T&&ct(S)&&i.style.setProperty(T,S.trim(),"important")}};for(let h of Mn){let p=W.querySelector(`[data-field="${h}"]`);if(!p)continue;let S=()=>{l[h]=p.value,u()};p.addEventListener("input",S),p.addEventListener("change",S)}let f=[Ze==null?void 0:Ze.primaryBg,Ze==null?void 0:Ze.primaryText,"#ffffff"].filter(h=>!!h).map(Bn).filter((h,p,S)=>Rn(h)&&S.indexOf(h)===p);for(let h of["color","background"]){let p=W.querySelector(`input[data-field="${h}"]`);if(!p)continue;let S=d("div",{display:"flex",gap:"6px",marginTop:"4px"});for(let T of f){let w=d("button",{width:"22px",height:"22px",borderRadius:"6px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.35)",background:T,padding:"0"});w.title=T,w.onclick=()=>{p.value=Bn(T),p.dispatchEvent(new Event("input"))},S.append(w)}p.after(S)}};let We=[],Tt=new Map,un=!1,fe=null,te=null,Lt=null,hr=()=>{Tt.clear();let o=[],i=(a,l,u)=>{var p;if(o.length>=16||[...Tt.values()].some(S=>S.node===a))return;let f=a===t,h=f?"selected":`e${o.length}`;Tt.set(h,{node:a,locator:l}),o.push(K(K({ref:h,tag:a.tagName.toLowerCase().slice(0,16),text:((p=a.textContent)!=null?p:"").replace(/\s+/g," ").trim().slice(0,300),isLeaf:vn(a),inForm:!!a.closest("form")},f?{selected:!0}:{}),u?{label:u.slice(0,120)}:{}))};t&&oe&&Me&&i(t,oe);for(let a of On){let l=we(a.locator,document);l&&i(l,a.locator,a.label)}return{pagePath:Pt(location.pathname),pageTitle:document.title.slice(0,200),elements:o}},qe=(o,i="")=>{let a=o==="user",l=d("div",{margin:"6px 0",padding:"7px 10px",borderRadius:"10px",fontSize:"12px",lineHeight:"1.45",whiteSpace:"pre-wrap",wordBreak:"break-word",maxWidth:"88%",marginLeft:a?"auto":"0",background:a?"#6366f1":o==="note"?"transparent":"rgba(255,255,255,0.07)",opacity:o==="note"?"0.75":"1"},i);return fe==null||fe.append(l),fe&&(fe.scrollTop=fe.scrollHeight),l},pn=()=>{Lt&&(Lt.textContent=t?Me?`Looking at: ${Pe(t)}`:"This element can\u2019t be targeted reliably \u2014 pick a heading, button, or section.":"Nothing selected \u2014 click an element, or ask for a page goal.")},io=(o,i)=>{var u;zt();let a=xn(o),l=o.style.cssText;if(Oe=()=>{Ye(o,a),o.style.cssText=l},!!i){typeof i.text=="string"&&Ye(o,i.text);for(let[f,h]of Object.entries((u=i.style)!=null?u:{})){let p=At[f];p&&typeof h=="string"&&ct(h)&&o.style.setProperty(p,h.trim(),"important")}}},yr=async o=>{var _,N;let i=Tt.get(o.ref);if(!i||!i.node.isConnected)return"\u26A0 That element is no longer on the page \u2014 click it and ask again.";let{node:a,locator:l}=i,u=o.versions.some(H=>typeof H.ops.text=="string"),f=Te(u?"text":"style",l,a),h=Ln(location.pathname,an[f])[0];C("Saving\u2026");let p=await ce(e,`/v1/editor/slots/${encodeURIComponent(f)}`,{kind:"arms",target:vt(l,h),draftConfig:{arms:[{id:"a",displayName:"Original",ops:u?{text:((_=a.textContent)!=null?_:"").trim()}:{}},...o.versions]}});if(be(p,"\u2713 Draft saved and previewing \u2014 nothing is live until you publish."),p.r!=="ok")return(N=Z.textContent)!=null?N:"\u26A0 Couldn\u2019t save the draft.";c("draft_saved",{kind:"slot",via:"chat"}),a!==t&&St(a),ae();let S=a;io(S,o.versions[0].ops),ht=f;try{S.scrollIntoView({block:"center",behavior:"smooth"})}catch(H){}xt(f,o.label,o.versions[0].id);let T=qe("assistant");T.textContent="",T.append(d("div",{fontWeight:"600",marginBottom:"6px"},`Draft: ${o.label}`));let w=d("div",{display:"flex",gap:"5px",flexWrap:"wrap"}),v=[],b=(H,U)=>{for(let R of v)R.style.background="#374151";H.style.background="#6366f1",io(S,U),ht=f};for(let[H,U]of[["Original",null],...o.versions.map(R=>[R.displayName,R.ops])]){let R=Le("#374151",H);R.onclick=()=>b(R,U),v.push(R),w.append(R)}return v[1].style.background="#6366f1",T.append(w),`[Created draft "${o.label}" with ${o.versions.length} version(s)]`},br=(o,i,a)=>{var h;let l=[],u={position:"absolute",pointerEvents:"none",zIndex:"2147483645",padding:"2px 6px",borderRadius:"4px",background:"#f59e0b",color:"#111827",font:"600 11px system-ui, sans-serif",whiteSpace:"nowrap"},f=null;if(o){let p=o.getBoundingClientRect();f=p.top+window.scrollY,l.push(d("div",{position:"absolute",pointerEvents:"none",zIndex:"2147483645",left:`${p.left+window.scrollX-3}px`,top:`${f-3}px`,width:`${p.width+6}px`,height:`${p.height+6}px`,border:"2px dashed #f59e0b",borderRadius:"6px"}),d("div",le(K({},u),{left:`${p.left+window.scrollX}px`,top:`${Math.max(0,f-24)}px`}),`Goal: ${a}`))}else i!==void 0&&(f=Math.round(document.documentElement.scrollHeight*i),l.push(d("div",{position:"absolute",pointerEvents:"none",zIndex:"2147483645",left:"0",right:"0",top:`${f}px`,borderTop:"2px dashed #f59e0b"}),d("div",le(K({},u),{left:"16px",top:`${f+4}px`}),`Goal counts here: ${a}`)));if(l.length!==0){if(((h=document.body)!=null?h:document.documentElement).append(...l),f!==null)try{window.scrollTo({top:Math.max(0,f-window.innerHeight/3),behavior:"smooth"})}catch(p){}setTimeout(()=>{for(let p of l)p.remove()},6e3)}},vr=async o=>{var f,h,p,S,T,w;let i=null,a,l;if(o.event==="click"||o.event==="form_submit"){let v=o.ref?Tt.get(o.ref):void 0;if(!v||!v.node.isConnected)return"\u26A0 That element is no longer on the page \u2014 click it and ask again.";if(o.event==="click")i=v.node,a=st(ro(i),JSON.stringify(v.locator)),l={event:"click",locator:v.locator};else{let b=v.node.closest("form");if(!b)return"\u26A0 That element isn\u2019t inside a form.";let _=Xe(b,document);if(!ut(_,b,document))return"\u26A0 This form can\u2019t be targeted reliably, so it can\u2019t be tracked.";i=b,a=st((h=(f=b.getAttribute("id"))!=null?f:b.getAttribute("name"))!=null?h:"form-submitted",JSON.stringify(_)),l={event:"form_submit",locator:_}}}else if(o.event==="url_reached"){let v=(p=o.urlPattern)!=null?p:Pt(location.pathname);a=st(pt(v)?`reached-${pt(v)}`:"page-visited",v),l={event:"url_reached",urlPattern:v}}else a=`read-${Math.round(((S=o.threshold)!=null?S:.75)*100)}pct`,l={event:"scroll_depth",threshold:(T=o.threshold)!=null?T:.75};return(await Ct(a,le(K({},l),{displayName:o.displayName}),o.displayName)).r!=="ok"?(w=Z.textContent)!=null?w:"\u26A0 Couldn\u2019t save the goal.":(br(i,o.event==="scroll_depth"?l.threshold:void 0,o.displayName),`[Created draft goal "${o.displayName}"]`)},ao=async o=>{var S,T,w;let i=o.trim();if(!i||un)return;un=!0,te&&(te.value="",te.disabled=!0),qe("user",i),We.push({role:"user",content:i.slice(0,4e3)}),c("form_opened",{kind:"chat"});let a=qe("assistant","\u2026"),l="",u=!1,f=[],h=[],p=v=>{var _,N;if(v==="[DONE]")return;let b;try{b=JSON.parse(v)}catch(H){return}if(b.error){f.push("\u26A0 The assistant hit a problem \u2014 try again.");return}if(b.type==="delta"&&b.text)u&&l&&(l+=`
25
25
 
26
- `),u=!1,l+=v.text,a.textContent=l,fe&&(fe.scrollTop=fe.scrollHeight);else if(v.type==="tool_status")u=!0,v.state==="running"&&!l&&(a.textContent=(R=v.name)!=null&&R.startsWith("create_")?"Creating a draft\u2026":"Thinking\u2026");else if(v.type==="choice_prompt"&&v.question){l+=(l?`
26
+ `),u=!1,l+=b.text,a.textContent=l,fe&&(fe.scrollTop=fe.scrollHeight);else if(b.type==="tool_status")u=!0,b.state==="running"&&!l&&(a.textContent=(_=b.name)!=null&&_.startsWith("create_")?"Creating a draft\u2026":"Thinking\u2026");else if(b.type==="choice_prompt"&&b.question){l+=(l?`
27
27
 
28
- `:"")+v.question,a.textContent=l;let D=d("div",{display:"flex",gap:"5px",flexWrap:"wrap",marginTop:"6px"});for(let G of(C=v.options)!=null?C:[]){let $=Le("#374151",G.label);$.onclick=()=>{io(G.label)},D.append($)}a.append(D)}else if(v.type==="artifact"&&v.artifact){let D=v.artifact.type==="editor_component_draft"?hr(v.artifact.payload):v.artifact.type==="editor_goal_draft"?br(v.artifact.payload):null;D&&y.push(D.then(G=>{f.push(G),G.startsWith("\u26A0")&&qe("note",G)}))}};try{let h=We.slice(-20);for(;((k=h[0])==null?void 0:k.role)==="assistant";)h=h.slice(1);let v=await fetch(`${e.apiBase}/v1/editor/chat`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({messages:h,context:mr()})});if(!v.ok){let $=(T=await v.json().catch(()=>null))==null?void 0:T.error;a.textContent=v.status===401?"Editor session expired \u2014 reopen it from your dashboard. Your drafts are safe.":$==="rate_limit"?"You\u2019ve used today\u2019s AI allowance \u2014 more tomorrow, or upgrade for a bigger daily budget.":$==="plan_required"?"AI chat isn\u2019t included in this plan.":$==="ai_unavailable"?"The assistant is unavailable right now \u2014 try again later.":`\u26A0 Couldn\u2019t reach the assistant \u2014 try again. (HTTP ${v.status})`,We.pop();return}let R=(A=v.body)==null?void 0:A.getReader(),C="",D=()=>{let $;for(;($=C.indexOf(`
28
+ `:"")+b.question,a.textContent=l;let H=d("div",{display:"flex",gap:"5px",flexWrap:"wrap",marginTop:"6px"});for(let U of(N=b.options)!=null?N:[]){let R=Le("#374151",U.label);R.onclick=()=>{ao(U.label)},H.append(R)}a.append(H)}else if(b.type==="artifact"&&b.artifact){let H=b.artifact.type==="editor_component_draft"?yr(b.artifact.payload):b.artifact.type==="editor_goal_draft"?vr(b.artifact.payload):null;H&&h.push(H.then(U=>{f.push(U),U.startsWith("\u26A0")&&qe("note",U)}))}};try{let v=We.slice(-20);for(;((S=v[0])==null?void 0:S.role)==="assistant";)v=v.slice(1);let b=await fetch(`${e.apiBase}/v1/editor/chat`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({messages:v,context:hr()})});if(!b.ok){let R=(T=await b.json().catch(()=>null))==null?void 0:T.error;a.textContent=b.status===401?"Editor session expired \u2014 reopen it from your dashboard. Your drafts are safe.":R==="rate_limit"?"You\u2019ve used today\u2019s AI allowance \u2014 more tomorrow, or upgrade for a bigger daily budget.":R==="plan_required"?"AI chat isn\u2019t included in this plan.":R==="ai_unavailable"?"The assistant is unavailable right now \u2014 try again later.":`\u26A0 Couldn\u2019t reach the assistant \u2014 try again. (HTTP ${b.status})`,We.pop();return}let _=(w=b.body)==null?void 0:w.getReader(),N="",H=()=>{let R;for(;(R=N.indexOf(`
29
29
 
30
- `))>=0;){for(let ge of C.slice(0,$).split(`
31
- `))ge.startsWith("data: ")&&p(ge.slice(6));C=C.slice($+2)}};if(R){let $=new TextDecoder;for(;;){let{done:ge,value:me}=await R.read();if(ge)break;C+=$.decode(me,{stream:!0}),D()}}else C=await v.text();C+=`
30
+ `))>=0;){for(let ge of N.slice(0,R).split(`
31
+ `))ge.startsWith("data: ")&&p(ge.slice(6));N=N.slice(R+2)}};if(_){let R=new TextDecoder;for(;;){let{done:ge,value:me}=await _.read();if(ge)break;N+=R.decode(me,{stream:!0}),H()}}else N=await b.text();N+=`
32
32
 
33
- `,D(),await Promise.all(y),l||(a.textContent=f.some($=>$.startsWith("["))?"Done \u2014 have a look at the page.":"No reply \u2014 try rephrasing.");for(let $ of f)$.startsWith("\u26A0 The assistant")&&qe("note",$);let G=[l,...f.filter($=>$.startsWith("["))].filter(Boolean).join(`
34
- `);We.push({role:"assistant",content:(G||"(no reply)").slice(0,4e3)})}catch(h){a.textContent="\u26A0 Couldn\u2019t reach the assistant \u2014 check your connection and try again.",We.pop()}finally{dn=!1,te&&(te.disabled=!1,te.focus())}},vr=()=>{if(fe){te==null||te.focus();return}let o=d("div",{margin:"0 0 8px",padding:"9px 11px",borderRadius:"10px",background:"rgba(250,204,21,0.06)",border:"1px solid rgba(250,204,21,0.3)"});o.setAttribute("data-sentient-chat","");let i=d("div",{display:"flex",alignItems:"center",gap:"6px",marginBottom:"4px"}),a=Ln("close","Close AI chat");if(a.onclick=()=>{Dt.textContent="",fe=null,te=null,Lt=null},i.append(d("div",{fontWeight:"600",flex:"1 1 auto"},"\u2728 AI"),a),Lt=d("div",{fontSize:"11px",opacity:"0.7",marginBottom:"4px"}),un(),fe=d("div",{maxHeight:"260px",overflowY:"auto",overscrollBehavior:"contain"}),We.length===0)qe("note","Tell me what to try \u2014 e.g. \u201Cmake this headline more urgent\u201D or \u201Ctrack clicks on the signup button\u201D. I\u2019ll create a draft and show it on the page. Nothing goes live until you publish.");else for(let f of We)qe(f.role,f.content);let l=d("div",{display:"flex",gap:"6px",marginTop:"6px"});te=d("input",{flex:"1 1 auto",minWidth:"0",boxSizing:"border-box",padding:"6px 8px",borderRadius:"7px",border:"1px solid rgba(255,255,255,0.18)",background:"rgba(0,0,0,0.25)",color:"#fff",font:"12px system-ui, sans-serif"}),te.type="text",te.maxLength=1e3,te.placeholder="What do you want to change or track?",te.setAttribute("data-field","ai-chat");let u=Le("#6366f1","Send");u.setAttribute("data-action","ai-send"),u.onclick=()=>{te&&io(te.value)},te.onkeydown=f=>{var y;f.key==="Enter"&&(f.preventDefault(),(y=u.onclick)==null||y.call(u,new MouseEvent("click")))},l.append(te,u),o.append(i,Lt,fe,l),Dt.textContent="",Dt.append(o),te.focus()};Fn.onclick=()=>vr();let pn=o=>{if(!t)return;let i=t.parentElement;if(!i)return;Fe||(wt=i,jt=t.nextSibling,Fe=!0),o==="up"&&ot?i.insertBefore(t,ot):o==="down"&&rt&&i.insertBefore(t,rt.nextSibling);let a=Qt(t,document);ot=a.prevEl,rt=a.nextEl,Ee=a.prevLocator,Ge=a.nextLocator;try{t.scrollIntoView({block:"nearest",behavior:"smooth"})}catch(l){}g(),sn(!0),E("Previewing the new position \u2014 keep moving, save, or undo.")};O.onclick=()=>pn("up"),V.onclick=()=>pn("down"),ze.onclick=()=>{kt(),E("Move undone \u2014 back to the original position.")},Se.onclick=async()=>{if(!t||!oe||!Fe||!Me)return;let o=Ee?"moveAfter":"moveBefore",i=Ee!=null?Ee:Ge;if(!i){E("\u26A0 Couldn\u2019t anchor the new position \u2014 nudge it next to a section with an id.",!1);return}let a=Ce("move",oe,t);E("Saving\u2026");let l=await ce(e,`/v1/editor/slots/${encodeURIComponent(a)}`,{kind:"arms",target:vt(oe,Te==null?void 0:Te.value()),draftConfig:{arms:[{id:"a",ops:{}},{id:"b",ops:{[o]:i}}]}});l.r==="ok"&&(c("draft_saved",{kind:"move"}),Fe=!1,wt=null,jt=null,sn(!1),xt(a,Ne(t),"b")),be(l,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")};let xr=()=>{var o,i;c("editor_closed"),s(),window.removeEventListener("pagehide",s),r&&clearTimeout(r),kt(),Ht(),document.removeEventListener("mousemove",Zn,!0),document.removeEventListener("click",to,!0),document.removeEventListener("keydown",eo,!0),window.removeEventListener("scroll",w,!0),window.removeEventListener("resize",w),mt(document),(o=document.getElementById(_n))==null||o.remove(),m.remove(),x.remove(),b.remove(),Be.remove(),window.__sentientEditor=null,(i=document.querySelector("meta[data-sentient-editor]"))==null||i.remove(),Mt()},fn=!1;Ie.onclick=()=>{if((nt||Fe)&&!fn){fn=!0,E("\u26A0 Unsaved changes \u2014 click \xD7 again to discard them.",!1);return}xr()},document.addEventListener("mousemove",Zn,!0),document.addEventListener("click",to,!0),document.addEventListener("keydown",eo,!0),window.addEventListener("scroll",w,!0),window.addEventListener("resize",w),Pt(),c("editor_opened")}var Ci="http://www.w3.org/2000/svg";function Qe(e,t){let n=document.createElementNS(Ci,e);for(let[r,s]of Object.entries(t))n.setAttribute(r,s);return n}function Li(e){let t=Qe("svg",{width:String(e),height:String(e),viewBox:"0 0 32 32",fill:"none","aria-hidden":"true"}),n={stroke:"#fff","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"};return t.append(Qe("path",K({d:"M21 9H14C11.2 9 9.8 10.8 9.8 13C9.8 15.4 11.6 16.6 14.5 16.6H18.5C20.5 16.6 20.7 18.2 20.4 19.6"},n)),Qe("path",K({d:"M10 22H17"},n)),Qe("circle",{cx:"20.6",cy:"22",r:"2.1",fill:"#fff"})),t}function Ln(e,t){let n=d("button",{display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",width:"24px",height:"24px",margin:"0",padding:"0",borderRadius:"6px",background:"transparent",border:"none",color:"#9ca3af",cursor:"pointer"});n.setAttribute("aria-label",t),n.title=t;let r=Qe("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true"}),s={stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"};return e==="minimize"?r.append(Qe("path",K({d:"M3 7h8"},s))):r.append(Qe("path",K({d:"M3.5 3.5l7 7M10.5 3.5l-7 7"},s))),n.append(r),n.onmouseenter=()=>{n.style.background="rgba(255,255,255,0.1)",n.style.color="#fff"},n.onmouseleave=()=>{n.style.background="transparent",n.style.color="#9ca3af"},n}function F(e){return{display:"block",width:"100%",marginTop:"8px",padding:"8px 10px",borderRadius:"8px",border:"none",background:e,color:"#fff",font:"13px system-ui, sans-serif",cursor:"pointer",textAlign:"left"}}var tn="sentient-preview-bar";async function _i(e,t){var b,B,L,H,S,z,J,Z,U,X,ne,Q;try{fetch(`${e.apiBase}/v1/editor/telemetry`,{method:"POST",keepalive:!0,headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({events:[{kind:"previewed"}]})}).catch(()=>{})}catch(N){}let n=null;try{let N=await fetch(`${e.apiBase}/v1/editor/slots`,{headers:{authorization:`Bearer ${e.token}`}});N.ok&&(n=(B=((b=(await N.json()).slots)!=null?b:[]).find(ie=>ie.slot_id===t&&ie.kind==="arms"))!=null?B:null)}catch(N){}let r=d("div",{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"8px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",flexWrap:"wrap",background:"#111827",color:"#fff",font:"13px system-ui, sans-serif",border:"1px solid rgba(99,102,241,0.55)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"});r.id=tn;let s=d("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer",opacity:"0.7"},"Exit preview");s.onclick=()=>{Mt();let N=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])N.searchParams.delete(re);location.assign(N.toString())};let c=d("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"#6366f1",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"},"Back to editor");c.onclick=()=>{let N=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])N.searchParams.delete(re);location.assign(N.toString())};let m=(z=(S=(L=n==null?void 0:n.draft_config)==null?void 0:L.arms)!=null?S:(H=n==null?void 0:n.published_config)==null?void 0:H.arms)!=null?z:[];if(!n||m.length===0){r.append(d("span",{},"Couldn\u2019t load this preview \u2014 reopen it from your dashboard."),c,s),((J=document.body)!=null?J:document.documentElement).append(r);return}let x=new URLSearchParams(location.search).get("sentient_arm"),g=(U=(Z=m.find(N=>N.id===x))!=null?Z:m[1])!=null?U:m[0];r.append(d("span",{fontWeight:"700"},`Previewing: ${(X=n.display_name)!=null?X:n.slot_id}`));let w=n.target&&typeof n.target=="object"?we(n.target,document):null;if(!w)r.append(d("span",{opacity:"0.85"},"\u2014 we couldn\u2019t find this component on this page. It may live on another page, or the page changed."));else{yo(w,g.ops,`preview-${n.slot_id}`,document);try{w.scrollIntoView({block:"center"})}catch(N){}for(let N of m){let re=d("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",cursor:"pointer",background:N.id===g.id?"#6366f1":"transparent",color:"#fff",font:"12px system-ui, sans-serif"},(ne=N.displayName)!=null?ne:N.id);re.onclick=()=>{let ie=new URL(location.href);ie.searchParams.set("sentient_arm",N.id),location.assign(ie.toString())},r.append(re)}}r.append(c,s),((Q=document.body)!=null?Q:document.documentElement).append(r)}async function Ii(e,t){var b,B,L,H;let n=t.lastIndexOf("~"),r=n>0?t.slice(0,n):t,s=n>0?t.slice(n+1):"",c=d("div",{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"8px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",flexWrap:"wrap",background:"#111827",color:"#fff",font:"13px system-ui, sans-serif",border:"1px solid rgba(139,92,246,0.6)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"});c.id=tn;let m=d("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"},"Exit preview");m.onclick=()=>{Mt();let S=new URL(location.href);for(let z of["sentient_preview_cell","sentient_refresh_region"])S.searchParams.delete(z);location.assign(S.toString())};let x=S=>{var z;c.append(d("span",{},S),m),((z=document.body)!=null?z:document.documentElement).append(c)},g=null;try{let S=await fetch(`${e.apiBase}/v1/editor/cell-preview?slotId=${encodeURIComponent(r)}&persona=${encodeURIComponent(s)}`,{headers:{authorization:`Bearer ${e.token}`}});S.ok&&(g=await S.json())}catch(S){}if(!g)return x("Couldn\u2019t load this preview \u2014 reopen it from your dashboard.");let w=g.target&&typeof g.target=="object"?we(g.target,document):null;if(!w)return x("\u2014 we couldn\u2019t find this part of the page here. It may live on another page.");if(g.edits!=null&&typeof g.skeletonFp=="string"&&Array.isArray(g.leafToNode)){if(Po(w,g.edits,{fp:g.skeletonFp,leafToNode:g.leafToNode})==="mismatch")return x("This part of the page changed since this version was written \u2014 regenerate it from your dashboard.")}else if(g.compose!=null||g.blocks!=null)g.vocabulary&&Array.isArray(g.vocabulary.entries)&&wo(g.vocabulary),To(w,{preview:(b=g.compose)!=null?b:g.blocks},"preview",document);else if(typeof g.content=="string")w.textContent=g.content;else return x("Nothing to preview in that square yet.");try{w.scrollIntoView({block:"center"})}catch(S){}c.append(d("span",{fontWeight:"700"},`Previewing: ${(B=g.slotName)!=null?B:r}`),d("span",{opacity:"0.85"},`for ${(L=g.personaDisplay)!=null?L:s}${g.status==="review"?" \u2014 waiting for your approval":""}. Nothing is being tracked.`),m),((H=document.body)!=null?H:document.documentElement).append(c)}async function Yo(e,t){var c;let n=await ft(e,"/v1/editor/slots"),r=((c=n==null?void 0:n.slots)!=null?c:[]).filter(m=>t?m.slot_id===t:m.region_skeleton_status==null),s=r.length===0&&t?"missing":"none";for(let m of r){let x=m.target&&typeof m.target=="object"?we(m.target,document):null;if(!x){t&&(s="missing");continue}let g=Oo(x),w=g.skeleton?{slotId:m.slot_id,skeleton:g.skeleton}:{slotId:m.slot_id,status:g.reason};s=(await ce(e,"/v1/editor/region-skeleton",w)).r==="ok"?"ok":"failed"}return s}async function Jo(e){try{await ce(e,"/v1/editor/style-vocabulary",Ho(document))}catch(t){}}async function Ai(){if(typeof document=="undefined")return;let e=mi();if(!e)return;if(e.code){let x=await Qo(e);if(x!==200){Zt(x===401?qo:Vo);return}}let t=await hi(e);if(!t.ok){t.unauthorized?(Mt(),Zt(qo)):Zt(Vo);return}let n=new URLSearchParams(location.search).get("sentient_preview");if(n){document.getElementById(tn)||await _i(e,n);return}let r=new URLSearchParams(location.search).get("sentient_preview_cell");if(r){document.getElementById(tn)||await Ii(e,r),Jo(e);return}let s=new URLSearchParams(location.search).get("sentient_refresh_region");if(s){let x=await Yo(e,s);Zt(x==="ok"?"Region refreshed \u2014 you can regenerate its versions now.":x==="missing"?"We couldn\u2019t find that part of the page here. It may live on another page.":"Couldn\u2019t refresh this region \u2014 reopen the link from your dashboard.");return}if(document.getElementById(gt))return;rr(e);let c=Uo(document);Ze=c,c&&ce(e,"/v1/editor/palette",c),Jo(e),Yo(e).catch(()=>{});let m=await vi(e);er(m),tr(m,document)}Ai();return _r($i);})();
33
+ `,H(),await Promise.all(h),l||(a.textContent=f.some(R=>R.startsWith("["))?"Done \u2014 have a look at the page.":"No reply \u2014 try rephrasing.");for(let R of f)R.startsWith("\u26A0 The assistant")&&qe("note",R);let U=[l,...f.filter(R=>R.startsWith("["))].filter(Boolean).join(`
34
+ `);We.push({role:"assistant",content:(U||"(no reply)").slice(0,4e3)})}catch(v){a.textContent="\u26A0 Couldn\u2019t reach the assistant \u2014 check your connection and try again.",We.pop()}finally{un=!1,te&&(te.disabled=!1,te.focus())}},xr=()=>{if(fe){te==null||te.focus();return}let o=d("div",{margin:"0 0 8px",padding:"9px 11px",borderRadius:"10px",background:"rgba(250,204,21,0.06)",border:"1px solid rgba(250,204,21,0.3)"});o.setAttribute("data-sentient-chat","");let i=d("div",{display:"flex",alignItems:"center",gap:"6px",marginBottom:"4px"}),a=_n("close","Close AI chat");if(a.onclick=()=>{Ht.textContent="",fe=null,te=null,Lt=null},i.append(d("div",{fontWeight:"600",flex:"1 1 auto"},"\u2728 AI"),a),Lt=d("div",{fontSize:"11px",opacity:"0.7",marginBottom:"4px"}),pn(),fe=d("div",{maxHeight:"260px",overflowY:"auto",overscrollBehavior:"contain"}),We.length===0)qe("note","Tell me what to try \u2014 e.g. \u201Cmake this headline more urgent\u201D or \u201Ctrack clicks on the signup button\u201D. I\u2019ll create a draft and show it on the page. Nothing goes live until you publish.");else for(let f of We)qe(f.role,f.content);let l=d("div",{display:"flex",gap:"6px",marginTop:"6px"});te=d("input",{flex:"1 1 auto",minWidth:"0",boxSizing:"border-box",padding:"6px 8px",borderRadius:"7px",border:"1px solid rgba(255,255,255,0.18)",background:"rgba(0,0,0,0.25)",color:"#fff",font:"12px system-ui, sans-serif"}),te.type="text",te.maxLength=1e3,te.placeholder="What do you want to change or track?",te.setAttribute("data-field","ai-chat");let u=Le("#6366f1","Send");u.setAttribute("data-action","ai-send"),u.onclick=()=>{te&&ao(te.value)},te.onkeydown=f=>{var h;f.key==="Enter"&&(f.preventDefault(),(h=u.onclick)==null||h.call(u,new MouseEvent("click")))},l.append(te,u),o.append(i,Lt,fe,l),Ht.textContent="",Ht.append(o),te.focus()};Wn.onclick=()=>xr();let fn=o=>{if(!t)return;let i=t.parentElement;if(!i)return;Fe||(wt=i,Kt=t.nextSibling,Fe=!0),o==="up"&&ot?i.insertBefore(t,ot):o==="down"&&rt&&i.insertBefore(t,rt.nextSibling);let a=en(t,document);ot=a.prevEl,rt=a.nextEl,Ee=a.prevLocator,Ge=a.nextLocator;try{t.scrollIntoView({block:"nearest",behavior:"smooth"})}catch(l){}g(),ln(!0),C("Previewing the new position \u2014 keep moving, save, or undo.")};B.onclick=()=>fn("up"),V.onclick=()=>fn("down"),ze.onclick=()=>{kt(),C("Move undone \u2014 back to the original position.")},Se.onclick=async()=>{if(!t||!oe||!Fe||!Me)return;let o=Ee?"moveAfter":"moveBefore",i=Ee!=null?Ee:Ge;if(!i){C("\u26A0 Couldn\u2019t anchor the new position \u2014 nudge it next to a section with an id.",!1);return}let a=Te("move",oe,t);C("Saving\u2026");let l=await ce(e,`/v1/editor/slots/${encodeURIComponent(a)}`,{kind:"arms",target:vt(oe,Ce==null?void 0:Ce.value()),draftConfig:{arms:[{id:"a",ops:{}},{id:"b",ops:{[o]:i}}]}});l.r==="ok"&&(c("draft_saved",{kind:"move"}),Fe=!1,wt=null,Kt=null,ln(!1),xt(a,Pe(t),"b")),be(l,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")};let wr=()=>{var o,i;c("editor_closed"),s(),window.removeEventListener("pagehide",s),r&&clearTimeout(r),kt(),zt(),document.removeEventListener("mousemove",Qn,!0),document.removeEventListener("click",no,!0),document.removeEventListener("keydown",to,!0),window.removeEventListener("scroll",k,!0),window.removeEventListener("resize",k),mt(document),(o=document.getElementById(In))==null||o.remove(),m.remove(),x.remove(),y.remove(),Be.remove(),window.__sentientEditor=null,(i=document.querySelector("meta[data-sentient-editor]"))==null||i.remove(),Mt()},gn=!1;Ie.onclick=()=>{if((nt||Fe)&&!gn){gn=!0,C("\u26A0 Unsaved changes \u2014 click \xD7 again to discard them.",!1);return}wr()},document.addEventListener("mousemove",Qn,!0),document.addEventListener("click",no,!0),document.addEventListener("keydown",to,!0),window.addEventListener("scroll",k,!0),window.addEventListener("resize",k),Rt(),c("editor_opened")}var Li="http://www.w3.org/2000/svg";function Qe(e,t){let n=document.createElementNS(Li,e);for(let[r,s]of Object.entries(t))n.setAttribute(r,s);return n}function _i(e){let t=Qe("svg",{width:String(e),height:String(e),viewBox:"0 0 32 32",fill:"none","aria-hidden":"true"}),n={stroke:"#fff","stroke-width":"2.2","stroke-linecap":"round","stroke-linejoin":"round"};return t.append(Qe("path",K({d:"M21 9H14C11.2 9 9.8 10.8 9.8 13C9.8 15.4 11.6 16.6 14.5 16.6H18.5C20.5 16.6 20.7 18.2 20.4 19.6"},n)),Qe("path",K({d:"M10 22H17"},n)),Qe("circle",{cx:"20.6",cy:"22",r:"2.1",fill:"#fff"})),t}function _n(e,t){let n=d("button",{display:"inline-flex",alignItems:"center",justifyContent:"center",flex:"0 0 auto",width:"24px",height:"24px",margin:"0",padding:"0",borderRadius:"6px",background:"transparent",border:"none",color:"#9ca3af",cursor:"pointer"});n.setAttribute("aria-label",t),n.title=t;let r=Qe("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none","aria-hidden":"true"}),s={stroke:"currentColor","stroke-width":"1.8","stroke-linecap":"round"};return e==="minimize"?r.append(Qe("path",K({d:"M3 7h8"},s))):r.append(Qe("path",K({d:"M3.5 3.5l7 7M10.5 3.5l-7 7"},s))),n.append(r),n.onmouseenter=()=>{n.style.background="rgba(255,255,255,0.1)",n.style.color="#fff"},n.onmouseleave=()=>{n.style.background="transparent",n.style.color="#9ca3af"},n}function F(e){return{display:"block",width:"100%",marginTop:"8px",padding:"8px 10px",borderRadius:"8px",border:"none",background:e,color:"#fff",font:"13px system-ui, sans-serif",cursor:"pointer",textAlign:"left"}}var nn="sentient-preview-bar";async function Ii(e,t){var y,$,L,D,E,z,J,Z,G,X,ne,Q;try{fetch(`${e.apiBase}/v1/editor/telemetry`,{method:"POST",keepalive:!0,headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify({events:[{kind:"previewed"}]})}).catch(()=>{})}catch(M){}let n=null;try{let M=await fetch(`${e.apiBase}/v1/editor/slots`,{headers:{authorization:`Bearer ${e.token}`}});M.ok&&(n=($=((y=(await M.json()).slots)!=null?y:[]).find(ie=>ie.slot_id===t&&ie.kind==="arms"))!=null?$:null)}catch(M){}let r=d("div",{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"8px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",flexWrap:"wrap",background:"#111827",color:"#fff",font:"13px system-ui, sans-serif",border:"1px solid rgba(99,102,241,0.55)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"});r.id=nn;let s=d("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer",opacity:"0.7"},"Exit preview");s.onclick=()=>{Mt();let M=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])M.searchParams.delete(re);location.assign(M.toString())};let c=d("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"#6366f1",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"},"Back to editor");c.onclick=()=>{let M=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])M.searchParams.delete(re);location.assign(M.toString())};let m=(z=(E=(L=n==null?void 0:n.draft_config)==null?void 0:L.arms)!=null?E:(D=n==null?void 0:n.published_config)==null?void 0:D.arms)!=null?z:[];if(!n||m.length===0){r.append(d("span",{},"Couldn\u2019t load this preview \u2014 reopen it from your dashboard."),c,s),((J=document.body)!=null?J:document.documentElement).append(r);return}let x=new URLSearchParams(location.search).get("sentient_arm"),g=(G=(Z=m.find(M=>M.id===x))!=null?Z:m[1])!=null?G:m[0];r.append(d("span",{fontWeight:"700"},`Previewing: ${(X=n.display_name)!=null?X:n.slot_id}`));let k=n.target&&typeof n.target=="object"?we(n.target,document):null;if(!k)r.append(d("span",{opacity:"0.85"},"\u2014 we couldn\u2019t find this component on this page. It may live on another page, or the page changed."));else{bo(k,g.ops,`preview-${n.slot_id}`,document);try{k.scrollIntoView({block:"center"})}catch(M){}for(let M of m){let re=d("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",cursor:"pointer",background:M.id===g.id?"#6366f1":"transparent",color:"#fff",font:"12px system-ui, sans-serif"},(ne=M.displayName)!=null?ne:M.id);re.onclick=()=>{let ie=new URL(location.href);ie.searchParams.set("sentient_arm",M.id),location.assign(ie.toString())},r.append(re)}}r.append(c,s),((Q=document.body)!=null?Q:document.documentElement).append(r)}async function Ai(e,t){var y,$,L,D;let n=t.lastIndexOf("~"),r=n>0?t.slice(0,n):t,s=n>0?t.slice(n+1):"",c=d("div",{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"8px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",flexWrap:"wrap",background:"#111827",color:"#fff",font:"13px system-ui, sans-serif",border:"1px solid rgba(139,92,246,0.6)",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"});c.id=nn;let m=d("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"},"Exit preview");m.onclick=()=>{Mt();let E=new URL(location.href);for(let z of["sentient_preview_cell","sentient_refresh_region"])E.searchParams.delete(z);location.assign(E.toString())};let x=E=>{var z;c.append(d("span",{},E),m),((z=document.body)!=null?z:document.documentElement).append(c)},g=null;try{let E=await fetch(`${e.apiBase}/v1/editor/cell-preview?slotId=${encodeURIComponent(r)}&persona=${encodeURIComponent(s)}`,{headers:{authorization:`Bearer ${e.token}`}});E.ok&&(g=await E.json())}catch(E){}if(!g)return x("Couldn\u2019t load this preview \u2014 reopen it from your dashboard.");let k=g.target&&typeof g.target=="object"?we(g.target,document):null;if(!k)return x("\u2014 we couldn\u2019t find this part of the page here. It may live on another page.");if(g.edits!=null&&typeof g.skeletonFp=="string"&&Array.isArray(g.leafToNode)){if(Ro(k,g.edits,{fp:g.skeletonFp,leafToNode:g.leafToNode})==="mismatch")return x("This part of the page changed since this version was written \u2014 regenerate it from your dashboard.")}else if(g.compose!=null||g.blocks!=null)g.vocabulary&&Array.isArray(g.vocabulary.entries)&&ko(g.vocabulary),To(k,{preview:(y=g.compose)!=null?y:g.blocks},"preview",document);else if(typeof g.content=="string")k.textContent=g.content;else return x("Nothing to preview in that square yet.");try{k.scrollIntoView({block:"center"})}catch(E){}c.append(d("span",{fontWeight:"700"},`Previewing: ${($=g.slotName)!=null?$:r}`),d("span",{opacity:"0.85"},`for ${(L=g.personaDisplay)!=null?L:s}${g.status==="review"?" \u2014 waiting for your approval":""}. Nothing is being tracked.`),m),((D=document.body)!=null?D:document.documentElement).append(c)}async function Jo(e,t){var c;let n=await ft(e,"/v1/editor/slots"),r=((c=n==null?void 0:n.slots)!=null?c:[]).filter(m=>t?m.slot_id===t:m.region_skeleton_status==null),s=r.length===0&&t?"missing":"none";for(let m of r){let x=m.target&&typeof m.target=="object"?we(m.target,document):null;if(!x){t&&(s="missing");continue}let g=Mo(x),k=g.skeleton?{slotId:m.slot_id,skeleton:g.skeleton}:{slotId:m.slot_id,status:g.reason};s=(await ce(e,"/v1/editor/region-skeleton",k)).r==="ok"?"ok":"failed"}return s}async function Xo(e){try{await ce(e,"/v1/editor/style-vocabulary",zo(document))}catch(t){}}async function $i(){if(typeof document=="undefined")return;let e=hi();if(!e)return;if(e.code){let x=await er(e);if(x!==200){Qt(x===401?Vo:Yo);return}}let t=await yi(e);if(!t.ok){t.unauthorized?(Mt(),Qt(Vo)):Qt(Yo);return}let n=new URLSearchParams(location.search).get("sentient_preview");if(n){document.getElementById(nn)||await Ii(e,n);return}let r=new URLSearchParams(location.search).get("sentient_preview_cell");if(r){document.getElementById(nn)||await Ai(e,r),Xo(e);return}let s=new URLSearchParams(location.search).get("sentient_refresh_region");if(s){let x=await Jo(e,s);Qt(x==="ok"?"Region refreshed \u2014 you can regenerate its versions now.":x==="missing"?"We couldn\u2019t find that part of the page here. It may live on another page.":"Couldn\u2019t refresh this region \u2014 reopen the link from your dashboard.");return}if(document.getElementById(gt))return;ir(e);let c=Go(document);Ze=c,c&&ce(e,"/v1/editor/palette",c),Xo(e),Jo(e).catch(()=>{});let m=await xi(e);tr(m),nr(m,document)}$i();return Ir(Bi);})();
@@ -1 +1 @@
1
- "use strict";var __sentientEngagement=(()=>{var V=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var ve=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>{for(var n in t)V(e,n,{get:t[n],enumerable:!0})},we=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!he.call(e,r)&&r!==n&&V(e,r,{get:()=>t[r],enumerable:!(a=ge(t,r))||a.enumerable});return e};var be=e=>we(V({},"__esModule",{value:!0}),e);var Ie,xe,_e,X,Ae,Ee,ee,$,te,Y=ve(()=>{"use strict";Ie=Object.defineProperty,xe=Object.defineProperties,_e=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,ee=(e,t,n)=>t in e?Ie(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,$=(e,t)=>{for(var n in t||(t={}))Ae.call(t,n)&&ee(e,n,t[n]);if(X)for(var n of X(t))Ee.call(t,n)&&ee(e,n,t[n]);return e},te=(e,t)=>xe(e,_e(t))});var qe={};ye(qe,{startEngagementCapture:()=>pe});var Se=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function W(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function ke(e){return{tag:e.tagName.toLowerCase(),text:W(e).slice(0,40)}}function H(e){return e.replace(/["\\\]]/g,"\\$&")}function F(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Z(e,t){var n;let a=e.tagName.toLowerCase();if(!a)return null;let r=((n=e.getAttribute("class"))!=null?n:"").split(/\s+/).filter(u=>/^[a-zA-Z][\w-]*$/.test(u)),c=[a,...r.map(u=>`${a}.${u}`)];for(let u of c)if(F(t,u))return u;let i=e.parentElement;if(i&&i!==t){let u=Z(i,t);if(u){for(let m of c){let w=`${u} > ${m}`;if(F(t,w))return w}let d=Array.from(i.children).filter(m=>m.tagName.toLowerCase()===a),y=d.indexOf(e),S=d.some(m=>m!==e&&W(m)!==W(e));if(y>=0&&S){let m=`${u} > ${a}:nth-of-type(${y+1})`;if(F(t,m))return m}}}return null}function Q(e,t){let n=ke(e),a=e.getAttribute("id");if(a&&F(t,`#${H(a)}`))return{v:1,id:a,fingerprint:n};for(let c of Se){let i=e.getAttribute(c);if(i&&F(t,`[${c}="${H(i)}"]`))return{v:1,dataAttr:{name:c,value:i},fingerprint:n}}let r=Z(e,t);return r?{v:1,selector:r,fingerprint:n}:null}Y();var re=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Ce={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Oe(e){let t=e.ariaRole?Ce[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 $e(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var Le=[["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]],J=[["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]],ne={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function Me(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function oe(e){var t,n;let a=Oe(e);if(a)return{type:(t=ne[a])!=null?t:"generic",strength:"strong"};let r=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,u]of Le)if(u.test(r))return{type:i,strength:"strong"};for(let[i,u]of J)if(u.test(e.bodyText))return{type:i,strength:"strong"};let c=$e(e);return{type:(n=ne[c])!=null?n:"generic",strength:"weak"}}function le(e){var t,n;let a=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),r=e.getAttribute("role");return $({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:Me(e),bodyText:a.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:a.length},r?{ariaRole:r}:{})}function ae(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}var He=1800*1e3;function ie(e,t,n,a){let r=[];{let c=!1,i=[],u=()=>{if(c)return;let d=Date.now();for(i.push(d);i.length>0&&d-i[0]>500;)i.shift();i.length>=3&&(c=!0,e("rage_click"))};t.addEventListener("click",u),r.push(()=>t.removeEventListener("click",u))}{let c=!1,i=u=>{if(c||!(u.target instanceof Node)||!t.contains(u.target)&&t!==u.target)return;c=!0;let d=typeof window!="undefined"?window.getSelection():null,y=d?d.toString().length:0;e("text_copy",{selectionLength:y})};document.addEventListener("copy",i),r.push(()=>document.removeEventListener("copy",i))}{let c=!1,i=!1,u=null,d=()=>{u!==null&&(clearTimeout(u),u=null)},y=()=>{c||!i||(d(),u=setTimeout(()=>{!c&&i&&(c=!0,e("scroll_hesitation"))},3e3))},S=()=>{d(),y()},m=_=>{for(let A of _)i=A.intersectionRatio>.3,i?y():d()},w=new IntersectionObserver(m,{threshold:[.3]});w.observe(t),window.addEventListener("scroll",S,{passive:!0}),r.push(()=>{w.disconnect(),window.removeEventListener("scroll",S),d()})}if((a==null?void 0:a.tabLoss)!==!1){let c=!1,i=n!=null?n:Date.now(),u=()=>{if(c||document.visibilityState!=="hidden")return;let d=Date.now()-i;d<15e3&&(c=!0,e("tab_loss",{timeOnPage:d}))};document.addEventListener("visibilitychange",u),r.push(()=>document.removeEventListener("visibilitychange",u))}return()=>{for(let c of r)c()}}function se(){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")}Y();var ue=[100,300,1e3,3e3,1e4],Pe=250,Te=1e3,Ne=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function ce(e,t){e.n++;let n=t-e.mean;e.mean+=n/e.n,e.m2+=n*(t-e.mean)}var de=e=>e.n>1?Math.sqrt(e.m2/e.n):0;function Ke(e){var t;try{let n=e.createElement("canvas"),a=n.getContext("webgl")||n.getContext("experimental-webgl");if(!a)return"unknown";let r=a.getExtension("WEBGL_debug_renderer_info"),c=r?String((t=a.getParameter(r.UNMASKED_RENDERER_WEBGL))!=null?t:""):"";return c?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(c)?"sw":"hw":"unknown"}catch(n){return"unknown"}}function De(e,t=Date.now){var n,a;let r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0,c={n:0,mean:0,m2:0},i={n:0,mean:0,m2:0},u=[0,0,0,0,0,0],d=0,y=0,S=0,m=0,w=0,_=0,A=0,T=0,N=0,h=0,q=-1/0,K=-1/0,k=null,L=null,D=null,R=(a=r==null?void 0:r.scrollY)!=null?a:0,z=0,v=e.hidden?null:t(),M=()=>{let l=t();if(D!=null){let g=l-D,I=0;for(;I<ue.length&&g>=ue[I];)I++;u[I]++}D=l},P=()=>{d++,q=t()},E=()=>{y++,K=t()},j=()=>{k=t()},C=()=>{k!=null&&(ce(c,t()-k),k=null)},U=()=>{let l=t();S++,l-q>Pe&&l-K>Te&&m++,M()},O=()=>{w++},b=()=>{var l;let g=(l=r==null?void 0:r.scrollY)!=null?l:0;_+=Math.abs(g-R),R=g,M()},G=l=>{let g=t();A++,(l.key==="Backspace"||l.key==="Delete")&&N++,Ne.has(l.key)&&h++,L!=null&&ce(i,g-L),L=g,M()},B=l=>{let g=l.data;typeof g=="string"&&(T+=g.length),M()},s=()=>{let l=t();e.hidden?v!=null&&(z+=l-v,v=null):v==null&&(v=l)},o={passive:!0,capture:!0};e.addEventListener("mousemove",P,o),e.addEventListener("touchstart",E,o),e.addEventListener("touchmove",O,o),e.addEventListener("mousedown",j,o),e.addEventListener("mouseup",C,o),e.addEventListener("click",U,o),e.addEventListener("wheel",O,o),e.addEventListener("keydown",G,o),e.addEventListener("input",B,o),e.addEventListener("visibilitychange",s),r==null||r.addEventListener("scroll",b,o);let f=Ke(e),p=(()=>{var l;try{return((l=r==null?void 0:r.matchMedia)==null?void 0:l.call(r,"(prefers-reduced-motion: reduce)").matches)===!0}catch(g){return!1}})();return{snapshot(){var l,g;let I=t(),x=z+(v!=null?I-v:0);return{v:1,active_ms:Math.round(x),mm:d,mm_rate:x>0?Number((d*1e3/x).toFixed(2)):0,touches:y,clicks:S,hold_n:c.n,hold_mean:Math.round(c.mean),hold_std:Math.round(de(c)),teleport:m,wheel:w,scroll_px:Math.round(_),keydowns:A,input_chars:T,ik_cv:i.mean>0?Number((de(i)/i.mean).toFixed(2)):0,backspaces:N,gaps:[...u],reduced_motion:p,kb_nav:h,renderer:f,vp:[(l=r==null?void 0:r.innerWidth)!=null?l:0,(g=r==null?void 0:r.innerHeight)!=null?g:0],dpr:(r==null?void 0:r.devicePixelRatio)||1}},stop(){e.removeEventListener("mousemove",P,o),e.removeEventListener("touchstart",E,o),e.removeEventListener("touchmove",O,o),e.removeEventListener("mousedown",j,o),e.removeEventListener("mouseup",C,o),e.removeEventListener("click",U,o),e.removeEventListener("wheel",O,o),e.removeEventListener("keydown",G,o),e.removeEventListener("input",B,o),e.removeEventListener("visibilitychange",s),r==null||r.removeEventListener("scroll",b,o)}}}var Re="section, header, footer, nav, main > div, [data-sentient-section]",je=2e4,Ue="__session__";function Be(e){let t=Array.from(e.querySelectorAll(Re)),n=t.filter(a=>t.filter(r=>r!==a&&a.contains(r)).length<2);return n.filter(a=>!n.some(r=>r!==a&&r.contains(a)))}function Fe(e,t,n,a){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:a})}).catch(()=>{})}catch(r){}}var fe=()=>{};function pe(e,t){var n,a,r,c,i,u,d,y,S,m,w,_,A,T,N;let h=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!h||typeof IntersectionObserver=="undefined"||se()||!t.apiKey||!t.apiKey.startsWith("pk_"))return fe;let q=((a=t.apiBase)!=null?a:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),K=Be(h);if(K.length===0)return fe;let k=new Map,L=[];for(let s of K){let o=(i=[(c=t.sectionTypes)==null?void 0:c[(r=s.getAttribute("data-sentient-id"))!=null?r:""],s.getAttribute("data-sentient-type")].find(x=>re.includes(x)))!=null?i:null,f=le(s),p=(d=o!=null?o:(u=t.typeOf)==null?void 0:u.call(t,s))!=null?d:oe(f).type,l=Q(s,h),g=l?`nc-${p}-${ae(JSON.stringify({id:(y=l.id)!=null?y:null,dataAttr:(S=l.dataAttr)!=null?S:null,selector:(m=l.selector)!=null?m:null})).toString(36)}`:`nc-${p}`;k.set(s,g);let I=J.filter(([,x])=>x.test(f.bodyText)).map(([x])=>x);L.push(te($({componentId:g,semanticType:p,source:o?"markup":"auto"},l?{locator:l}:{}),{observation:$($({tag:f.tag,idClass:f.idClass.slice(0,200),headingText:f.headingText,textLength:f.textLength,actionCount:f.actionCount},f.ariaRole?{ariaRole:f.ariaRole}:{}),I.length>0?{patternFlags:I}:{})}))}let D=(T=(A=(_=(w=h.defaultView)!=null?w:typeof window!="undefined"?window:void 0)==null?void 0:_.location)==null?void 0:A.pathname)!=null?T:"/";Fe(t.apiKey,q,D,L);let R=De(h),z=()=>{let s;try{s=R.snapshot()}catch(o){return}try{e.track({projectId:t.apiKey,componentId:Ue,eventType:"interaction_stats",payload:s})}catch(o){}},v=new Map,M=s=>{let o=v.get(s);return o||(o={ms:0,scroll:0,enterAt:null,intersecting:!1},v.set(s,o)),o},P=new IntersectionObserver(s=>{for(let o of s){let f=k.get(o.target);if(!f)continue;let p=M(f);o.isIntersecting?(p.intersecting=!0,p.enterAt=Date.now(),o.intersectionRatio>p.scroll&&(p.scroll=o.intersectionRatio)):(p.intersecting=!1,p.enterAt!=null&&(p.ms+=Date.now()-p.enterAt,p.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let s of k.keys())P.observe(s);let E=(s=!1)=>{var o;let f=Date.now();for(let[p,l]of v)if(l.enterAt!=null&&(l.ms+=f-l.enterAt,l.enterAt=null),!(l.ms<=0)){try{e.track({projectId:t.apiKey,componentId:p,eventType:"dwell",payload:{dwell_time:Math.round(l.ms),scroll_depth:Number(l.scroll.toFixed(2))}})}catch(g){}l.ms=0}if(z(),s)try{(o=e.flush)==null||o.call(e)}catch(p){}},j=()=>{if(h.hidden)E(!0);else{let s=Date.now();for(let o of v.values())o.intersecting&&(o.enterAt=s)}},C=!1,U=s=>{if(E(!0),s!=null&&s.persisted){C=!0;return}try{P.disconnect()}catch(o){}},O=s=>{if(!(s!=null&&s.persisted)||!C)return;C=!1;let o=Date.now();for(let f of v.values())f.enterAt=f.intersecting&&!h.hidden?o:null};h.addEventListener("visibilitychange",j);let b=(N=h.defaultView)!=null?N:typeof window!="undefined"?window:void 0;b==null||b.addEventListener("pagehide",U),b==null||b.addEventListener("pageshow",O);let G=setInterval(()=>{if(h.hidden||C)return;E();let s=Date.now();for(let o of v.values())o.intersecting&&(o.enterAt=s)},je),B=[];return t.microSignals&&[...k.entries()].forEach(([s,o],f)=>{B.push(ie((p,l={})=>{try{e.track({projectId:t.apiKey,componentId:o,eventType:"micro_signal",payload:$({signalType:p},l)})}catch(g){}},s,void 0,{tabLoss:f===0}))}),()=>{E(!0),clearInterval(G),R.stop(),h.removeEventListener("visibilitychange",j),b==null||b.removeEventListener("pagehide",U),b==null||b.removeEventListener("pageshow",O);for(let s of B)s();try{P.disconnect()}catch(s){}}}return be(qe);})();
1
+ "use strict";var __sentientEngagement=(()=>{var W=Object.defineProperty;var ge=Object.getOwnPropertyDescriptor;var me=Object.getOwnPropertyNames;var he=Object.prototype.hasOwnProperty;var ve=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>{for(var n in t)W(e,n,{get:t[n],enumerable:!0})},be=(e,t,n,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of me(t))!he.call(e,r)&&r!==n&&W(e,r,{get:()=>t[r],enumerable:!(l=ge(t,r))||l.enumerable});return e};var we=e=>be(W({},"__esModule",{value:!0}),e);var _e,xe,Ie,X,Ae,$e,ee,O,te,Y=ve(()=>{"use strict";_e=Object.defineProperty,xe=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,$e=Object.prototype.propertyIsEnumerable,ee=(e,t,n)=>t in e?_e(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,O=(e,t)=>{for(var n in t||(t={}))Ae.call(t,n)&&ee(e,n,t[n]);if(X)for(var n of X(t))$e.call(t,n)&&ee(e,n,t[n]);return e},te=(e,t)=>xe(e,Ie(t))});var qe={};ye(qe,{startEngagementCapture:()=>pe});var Se=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function V(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function ke(e){return{tag:e.tagName.toLowerCase(),text:V(e).slice(0,40)}}function J(e){return e.replace(/["\\\]]/g,"\\$&")}function B(e,t){try{return e.querySelectorAll(t).length===1}catch(n){return!1}}function Z(e,t){var n;let l=e.tagName.toLowerCase();if(!l)return null;let r=((n=e.getAttribute("class"))!=null?n:"").split(/\s+/).filter(u=>/^[a-zA-Z][\w-]*$/.test(u)),c=[l,...r.map(u=>`${l}.${u}`)];for(let u of c)if(B(t,u))return u;let i=e.parentElement;if(i&&i!==t){let u=Z(i,t);if(u){for(let m of c){let b=`${u} > ${m}`;if(B(t,b))return b}let d=Array.from(i.children).filter(m=>m.tagName.toLowerCase()===l),y=d.indexOf(e),S=d.some(m=>m!==e&&V(m)!==V(e));if(y>=0&&S){let m=`${u} > ${l}:nth-of-type(${y+1})`;if(B(t,m))return m}}}return null}function Q(e,t){let n=ke(e),l=e.getAttribute("id");if(l&&B(t,`#${J(l)}`))return{v:1,id:l,fingerprint:n};for(let c of Se){let i=e.getAttribute(c);if(i&&B(t,`[${c}="${J(i)}"]`))return{v:1,dataAttr:{name:c,value:i},fingerprint:n}}let r=Z(e,t);return r?{v:1,selector:r,fingerprint:n}:null}Y();var re=["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"],Ee={banner:"hero",navigation:"navigation",contentinfo:"footer"};function Ce(e){let t=e.ariaRole?Ee[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 Oe(e){return e.actionCount>=1&&e.textLength>0&&e.textLength<200?"cta":"generic"}var Le=[["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]],H=[["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]],ne={navigation:"navigation",footer:"navigation",hero:"hero",cta:"cta",generic:"generic"};function Me(e){var t;let n=e.querySelector("h1, h2, h3");return((t=n==null?void 0:n.textContent)!=null?t:"").slice(0,160)}function ae(e){var t,n;let l=Ce(e);if(l)return{type:(t=ne[l])!=null?t:"generic",strength:"strong"};let r=`${e.idClass} ${e.headingText}`.toLowerCase();for(let[i,u]of Le)if(u.test(r))return{type:i,strength:"strong"};for(let[i,u]of H)if(u.test(e.bodyText))return{type:i,strength:"strong"};let c=Oe(e);return{type:(n=ne[c])!=null?n:"generic",strength:"weak"}}function oe(e){var t,n;let l=((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim(),r=e.getAttribute("role");return O({tag:e.tagName.toLowerCase(),idClass:`${e.id} ${String((n=e.className)!=null?n:"")}`,headingText:Me(e),bodyText:l.slice(0,2e3),actionCount:e.querySelectorAll('a, button, [role="button"]').length,textLength:l.length},r?{ariaRole:r}:{})}function le(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}var Je=1800*1e3;function ie(e,t,n,l){let r=[];{let c=!1,i=[],u=()=>{if(c)return;let d=Date.now();for(i.push(d);i.length>0&&d-i[0]>500;)i.shift();i.length>=3&&(c=!0,e("rage_click"))};t.addEventListener("click",u),r.push(()=>t.removeEventListener("click",u))}{let c=!1,i=u=>{if(c||!(u.target instanceof Node)||!t.contains(u.target)&&t!==u.target)return;c=!0;let d=typeof window!="undefined"?window.getSelection():null,y=d?d.toString().length:0;e("text_copy",{selectionLength:y})};document.addEventListener("copy",i),r.push(()=>document.removeEventListener("copy",i))}{let c=!1,i=!1,u=null,d=()=>{u!==null&&(clearTimeout(u),u=null)},y=()=>{c||!i||(d(),u=setTimeout(()=>{!c&&i&&(c=!0,e("scroll_hesitation"))},3e3))},S=()=>{d(),y()},m=I=>{for(let A of I)i=A.intersectionRatio>.3,i?y():d()},b=new IntersectionObserver(m,{threshold:[.3]});b.observe(t),window.addEventListener("scroll",S,{passive:!0}),r.push(()=>{b.disconnect(),window.removeEventListener("scroll",S),d()})}if((l==null?void 0:l.tabLoss)!==!1){let c=!1,i=n!=null?n:Date.now(),u=()=>{if(c||document.visibilityState!=="hidden")return;let d=Date.now()-i;d<15e3&&(c=!0,e("tab_loss",{timeOnPage:d}))};document.addEventListener("visibilitychange",u),r.push(()=>document.removeEventListener("visibilitychange",u))}return()=>{for(let c of r)c()}}function se(){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")}Y();var ue=[100,300,1e3,3e3,1e4],Pe=250,Te=1e3,Ne=new Set(["Tab","ArrowUp","ArrowDown","ArrowLeft","ArrowRight"]);function ce(e,t){e.n++;let n=t-e.mean;e.mean+=n/e.n,e.m2+=n*(t-e.mean)}var de=e=>e.n>1?Math.sqrt(e.m2/e.n):0;function Ke(e){var t;try{let n=e.createElement("canvas"),l=n.getContext("webgl")||n.getContext("experimental-webgl");if(!l)return"unknown";let r=l.getExtension("WEBGL_debug_renderer_info"),c=r?String((t=l.getParameter(r.UNMASKED_RENDERER_WEBGL))!=null?t:""):"";return c?/swiftshader|llvmpipe|softpipe|software|mesa offscreen/i.test(c)?"sw":"hw":"unknown"}catch(n){return"unknown"}}function De(e,t=Date.now){var n,l;let r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0,c={n:0,mean:0,m2:0},i={n:0,mean:0,m2:0},u=[0,0,0,0,0,0],d=0,y=0,S=0,m=0,b=0,I=0,A=0,T=0,N=0,h=0,q=-1/0,K=-1/0,k=null,L=null,D=null,R=(l=r==null?void 0:r.scrollY)!=null?l:0,z=0,v=e.hidden?null:t(),M=()=>{let o=t();if(D!=null){let g=o-D,_=0;for(;_<ue.length&&g>=ue[_];)_++;u[_]++}D=o},P=()=>{d++,q=t()},$=()=>{y++,K=t()},j=()=>{k=t()},E=()=>{k!=null&&(ce(c,t()-k),k=null)},U=()=>{let o=t();S++,o-q>Pe&&o-K>Te&&m++,M()},C=()=>{b++},w=()=>{var o;let g=(o=r==null?void 0:r.scrollY)!=null?o:0;I+=Math.abs(g-R),R=g,M()},G=o=>{let g=t();A++,(o.key==="Backspace"||o.key==="Delete")&&N++,Ne.has(o.key)&&h++,L!=null&&ce(i,g-L),L=g,M()},F=o=>{let g=o.data;typeof g=="string"&&(T+=g.length),M()},s=()=>{let o=t();e.hidden?v!=null&&(z+=o-v,v=null):v==null&&(v=o)},a={passive:!0,capture:!0};e.addEventListener("mousemove",P,a),e.addEventListener("touchstart",$,a),e.addEventListener("touchmove",C,a),e.addEventListener("mousedown",j,a),e.addEventListener("mouseup",E,a),e.addEventListener("click",U,a),e.addEventListener("wheel",C,a),e.addEventListener("keydown",G,a),e.addEventListener("input",F,a),e.addEventListener("visibilitychange",s),r==null||r.addEventListener("scroll",w,a);let f=Ke(e),p=(()=>{var o;try{return((o=r==null?void 0:r.matchMedia)==null?void 0:o.call(r,"(prefers-reduced-motion: reduce)").matches)===!0}catch(g){return!1}})();return{snapshot(){var o,g;let _=t(),x=z+(v!=null?_-v:0);return{v:1,active_ms:Math.round(x),mm:d,mm_rate:x>0?Number((d*1e3/x).toFixed(2)):0,touches:y,clicks:S,hold_n:c.n,hold_mean:Math.round(c.mean),hold_std:Math.round(de(c)),teleport:m,wheel:b,scroll_px:Math.round(I),keydowns:A,input_chars:T,ik_cv:i.mean>0?Number((de(i)/i.mean).toFixed(2)):0,backspaces:N,gaps:[...u],reduced_motion:p,kb_nav:h,renderer:f,vp:[(o=r==null?void 0:r.innerWidth)!=null?o:0,(g=r==null?void 0:r.innerHeight)!=null?g:0],dpr:(r==null?void 0:r.devicePixelRatio)||1}},stop(){e.removeEventListener("mousemove",P,a),e.removeEventListener("touchstart",$,a),e.removeEventListener("touchmove",C,a),e.removeEventListener("mousedown",j,a),e.removeEventListener("mouseup",E,a),e.removeEventListener("click",U,a),e.removeEventListener("wheel",C,a),e.removeEventListener("keydown",G,a),e.removeEventListener("input",F,a),e.removeEventListener("visibilitychange",s),r==null||r.removeEventListener("scroll",w,a)}}}var Re="section, header, footer, nav, main > div, [data-sentient-section]",je=2e4,Ue="__session__";function Fe(e){let t=Array.from(e.querySelectorAll(Re)),n=t.filter(l=>t.filter(r=>r!==l&&l.contains(r)).length<2);return n.filter(l=>!n.some(r=>r!==l&&r.contains(l)))}function Be(e,t,n,l){try{fetch(`${t}/v1/section-map`,{method:"POST",keepalive:!0,headers:{"content-type":"application/json",authorization:`Bearer ${e}`},body:JSON.stringify({pageUrl:n,sections:l})}).catch(()=>{})}catch(r){}}var fe=()=>{};function pe(e,t){var n,l,r,c,i,u,d,y,S,m,b,I,A,T,N;let h=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!h||typeof IntersectionObserver=="undefined"||se()||!t.apiKey||!t.apiKey.startsWith("pk_"))return fe;let q=((l=t.apiBase)!=null?l:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),K=Fe(h);if(K.length===0)return fe;let k=new Map,L=[];for(let s of K){let a=(i=[(c=t.sectionTypes)==null?void 0:c[(r=s.getAttribute("data-sentient-id"))!=null?r:""],s.getAttribute("data-sentient-type")].find(x=>re.includes(x)))!=null?i:null,f=oe(s),p=(d=a!=null?a:(u=t.typeOf)==null?void 0:u.call(t,s))!=null?d:ae(f).type,o=Q(s,h),g=o?`nc-${p}-${le(JSON.stringify({id:(y=o.id)!=null?y:null,dataAttr:(S=o.dataAttr)!=null?S:null,selector:(m=o.selector)!=null?m:null})).toString(36)}`:`nc-${p}`;k.set(s,g);let _=H.filter(([,x])=>x.test(f.bodyText)).map(([x])=>x);L.push(te(O({componentId:g,semanticType:p,source:a?"markup":"auto"},o?{locator:o}:{}),{observation:O(O({tag:f.tag,idClass:f.idClass.slice(0,200),headingText:f.headingText,textLength:f.textLength,actionCount:f.actionCount},f.ariaRole?{ariaRole:f.ariaRole}:{}),_.length>0?{patternFlags:_}:{})}))}let D=(T=(A=(I=(b=h.defaultView)!=null?b:typeof window!="undefined"?window:void 0)==null?void 0:I.location)==null?void 0:A.pathname)!=null?T:"/";Be(t.apiKey,q,D,L);let R=De(h),z=()=>{let s;try{s=R.snapshot()}catch(a){return}try{e.track({projectId:t.apiKey,componentId:Ue,eventType:"interaction_stats",payload:s})}catch(a){}},v=new Map,M=s=>{let a=v.get(s);return a||(a={ms:0,scroll:0,enterAt:null,intersecting:!1},v.set(s,a)),a},P=new IntersectionObserver(s=>{for(let a of s){let f=k.get(a.target);if(!f)continue;let p=M(f);a.isIntersecting?(p.intersecting=!0,p.enterAt=Date.now(),a.intersectionRatio>p.scroll&&(p.scroll=a.intersectionRatio)):(p.intersecting=!1,p.enterAt!=null&&(p.ms+=Date.now()-p.enterAt,p.enterAt=null))}},{threshold:[0,.25,.5,.75,1]});for(let s of k.keys())P.observe(s);let $=(s=!1)=>{var a;let f=Date.now();for(let[p,o]of v)if(o.enterAt!=null&&(o.ms+=f-o.enterAt,o.enterAt=null),!(o.ms<=0)){try{e.track({projectId:t.apiKey,componentId:p,eventType:"dwell",payload:{dwell_time:Math.round(o.ms),scroll_depth:Number(o.scroll.toFixed(2))}})}catch(g){}o.ms=0}if(z(),s)try{(a=e.flush)==null||a.call(e)}catch(p){}},j=()=>{if(h.hidden)$(!0);else{let s=Date.now();for(let a of v.values())a.intersecting&&(a.enterAt=s)}},E=!1,U=s=>{if($(!0),s!=null&&s.persisted){E=!0;return}try{P.disconnect()}catch(a){}},C=s=>{if(!(s!=null&&s.persisted)||!E)return;E=!1;let a=Date.now();for(let f of v.values())f.enterAt=f.intersecting&&!h.hidden?a:null};h.addEventListener("visibilitychange",j);let w=(N=h.defaultView)!=null?N:typeof window!="undefined"?window:void 0;w==null||w.addEventListener("pagehide",U),w==null||w.addEventListener("pageshow",C);let G=setInterval(()=>{if(h.hidden||E)return;$();let s=Date.now();for(let a of v.values())a.intersecting&&(a.enterAt=s)},je),F=[];return t.microSignals&&[...k.entries()].forEach(([s,a],f)=>{F.push(ie((p,o={})=>{try{e.track({projectId:t.apiKey,componentId:a,eventType:"micro_signal",payload:O({signalType:p},o)})}catch(g){}},s,void 0,{tabLoss:f===0}))}),()=>{$(!0),clearInterval(G),R.stop(),h.removeEventListener("visibilitychange",j),w==null||w.removeEventListener("pagehide",U),w==null||w.removeEventListener("pageshow",C);for(let s of F)s();try{P.disconnect()}catch(s){}}}return we(qe);})();
@@ -1,2 +1,2 @@
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()&&lt("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);})();
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 mr=(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,br,ri,oi,Sr,F,qe,kn=pr(()=>{"use strict";ei=Object.defineProperty,ti=Object.defineProperties,ni=Object.getOwnPropertyDescriptors,br=Object.getOwnPropertySymbols,ri=Object.prototype.hasOwnProperty,oi=Object.prototype.propertyIsEnumerable,Sr=(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)&&Sr(e,n,t[n]);if(br)for(var n of br(t))oi.call(t,n)&&Sr(e,n,t[n]);return e},qe=(e,t)=>ti(e,ni(t))});var Tr={};mr(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 xs={};mr(xs,{applyPersonaAttributes:()=>en,applyRegistrySlots:()=>rn,applySlotArms:()=>nn,applySlotAttributes:()=>tn,consentWatcher:()=>Xe,parseSnippetConfig:()=>Jt,planReorder:()=>sn,reapply:()=>Ot,run:()=>Mo,version:()=>Et});function ze(e){return e?`_${e.slice(0,12)}`:""}var We="_snt_uid";function mt(e){return`${We}${ze(e)}`}var Sn="__sntForgetGen",Ho=()=>{try{return window[Sn]}catch(e){return}};function Dt(e){var t,n;try{let r=window,o=(t=r[Sn])!=null?t:r[Sn]={};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 _n(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 gr(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 $t(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=$t(i),l=!1,p=fe(i),h=(...I)=>{!l&&fe(i)===p&&wn(...I)},S=[],w=new Set,b=[],K=I=>{for(let $ of I)L.delete($),!w.has($)&&(w.add($),b.push($));for(;b.length>Jo;){let $=b.shift();$&&w.delete($)}hr(I,c)},L=new Set,D=()=>{for(;S.length>a;){let I=S.shift();I&&L.delete(I.id)}},E=I=>{w.has(I.id)||L.has(I.id)||(L.add(I.id),S.push(I),D())},x=I=>{for(let $ of I)w.has($.id)||(L.add($.id),S.push($));D()},A=gr(c,a);for(let I of A)E(I);let P=0,g=0,v=(I,$=!0)=>{if(I.length===0)return;let ne=JSON.stringify(I),ue=I.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(I,a,c),x(I),g++,P=Date.now()+Ve(g);return}Promise.resolve(Q).then(we.clear,we.clear);let ee=Me=>{if(Mt(Me)!=="retry"){if(!Me.ok&&$){let $e=I.filter(Le=>Le.eventType!=="pageview");if($e.length>0&&$e.length<I.length){K(I.filter(Le=>Le.eventType==="pageview").map(Le=>Le.id)),v($e,!1);return}}K(ue),g=0,P=0;return}h(I,a,c),x(I),g++,P=Date.now()+Ve(g)};Q&&typeof Q.then=="function"?Q.then(ee).catch(()=>{h(I,a,c),x(I),g++,P=Date.now()+Ve(g)}):ee(Q)},d=typeof TextEncoder!="undefined"?new TextEncoder:null,m=I=>d?d.encode(I).length:I.length,O=I=>{let $=[],ne=2;for(let ue of I){let Q=m(JSON.stringify(ue))+1;if($.length>0&&ne+Q>Yo||$.length>=s)break;$.push(ue),ne+=Q}return $},M=()=>{try{if(Date.now()<P)return;for(;S.length>0&&!(Date.now()<P);){let I=S.filter(ne=>!w.has(ne.id));if(S.length=0,I.length===0)break;let $=O(I);if($.length===0)break;$.length<I.length&&S.push(...I.slice($.length)),v($)}}catch(I){}},q=!0,J=null;J=setInterval(()=>{q&&M()},o);let Y=()=>{document.visibilityState==="hidden"&&M()},Ae=()=>{M()};return document.addEventListener("visibilitychange",Y),window.addEventListener("pagehide",Ae),{push(I){E(I),S.length>=s&&M()},flush:M,destroy(I){I!=null&&I.forget&&(l=!0),q=!1,J!==null&&(clearInterval(J),J=null),document.removeEventListener("visibilitychange",Y),window.removeEventListener("pagehide",Ae),M()}}}var Zo=200;function Bt(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=Bt(e.apiKey),i=!1,c=fe(e.apiKey),l=(...m)=>{!i&&fe(e.apiKey)===c&&wn(...m)},p=[],h=new Set,S=new Set,w=[],b=0,K=0,L=!1,D=m=>{for(h.delete(m.id),S.has(m.id)||(S.add(m.id),w.push(m.id));w.length>Zo;){let O=w.shift();O&&S.delete(O)}hr([m.id],u)},E=m=>{l([m],s,u),!S.has(m.id)&&!h.has(m.id)&&(h.add(m.id),p.push(m)),Date.now()>=b&&(K++,b=Date.now()+Ve(K))},x=m=>{let O,M=je(15e3);try{O=fetch(e.url,{method:"POST",keepalive:!0,signal:M.signal,body:m.body,headers:e.headers})}catch(J){E(m);return}let q=J=>{var Y;let Ae=Mt(J);if(Ae==="retry"){E(m);return}Ae==="dropped"&&((Y=e.onDrop)==null||Y.call(e,m,J.status)),D(m),K=0,b=0};Promise.resolve(O).then(M.clear,M.clear),O&&typeof O.then=="function"?O.then(q).catch(()=>E(m)):q(O)},A=()=>{try{if(L||Date.now()<b)return;let m=0;for(;p.length>0&&m<a&&!(Date.now()<b);){let O=p.shift();h.delete(O.id),!S.has(O.id)&&(m++,x(O))}}catch(m){}},P=gr(u,s);for(let m of P)h.has(m.id)||(h.add(m.id),p.push(m));P.length>0&&wn(P,s,u);let g=setInterval(A,o),v=()=>{document.visibilityState==="hidden"&&A()},d=()=>A();return document.addEventListener("visibilitychange",v),window.addEventListener("pagehide",d),{send(m){if(L){S.has(m.id)||l([m],s,u);return}if(!(S.has(m.id)||h.has(m.id))){if(Date.now()<b){l([m],s,u),h.add(m.id),p.push(m);return}x(m)}},flush:A,destroy(m){m!=null&&m.forget&&(i=!0),clearInterval(g),document.removeEventListener("visibilitychange",v),window.removeEventListener("pagehide",d),A(),L=!0}}}function it(e){if(typeof window=="undefined"||!e)return!1;Dt(e);let t=!1,n=mt(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,$t(e),Bt(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 En(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 _r(e,t){var n,r;return e.dims!=null?(r=(n=wr(t))!=null?n:wr(En(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 Er(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 xr(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 Ar(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 Ir(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function xn(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 An(e){let t=xn(e);return _r(t,En(t))}function Or(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 $r(){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 $r()}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 In(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 mi(e){try{sessionStorage.removeItem(e)}catch(t){}}function gi(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 Br(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:mt(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,S=x=>x&&x.length>0?x:null,w=()=>{var x,A;return i&&!(e!=null&&e.cookieName)&&jt(p)===null?(A=(x=S(Cn(Pr)))!=null?x:S(jt(st)))!=null?A:S(In(st)):null},b=(u=(a=(s=(o=(r=S(Cn(c)))!=null?r:S(jt(l)))!=null?o:S(In(l)))!=null?s:w())!=null?a:S(e==null?void 0:e.ssrSessionId))!=null?u:di();fi(c,b,h);let K=Rr(l,b),L=gi(c),D=K?!1:pi(l,b),E=!K&&!L&&!D;return{getSessionId:()=>b,isEphemeral:()=>E,destroy:()=>{b=null,yi(c),hi(l),mi(l),i&&!(e!=null&&e.cookieName)&&(Cn(Pr)!==null||jt(st)!==null||In(st)!==null)&&Rr(p,"1")}}}var bi=1800*1e3;function Gt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function Si(e=bi,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 _i(e){var t;let n=Br({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,S;let w=await s;if(!w)return null;let b=w.createLocalEngine({sessionId:r,forcedPersona:o}).decide(l);return a=qe(F({},b),{layoutOrder:(h=(p=b.layoutOrder)!=null?p:a==null?void 0:a.layoutOrder)!=null?h:null,slots:F(F({},(S=a==null?void 0:a.slots)!=null?S:{}),b.slots)}),He(e.apiKey||"local",{v:1,persona:a.persona,band:Je(a.confidence),slots:a.slots,layoutOrder:a.layoutOrder,savedAt:Date.now()}),c(b),b},getSlotResult(l){var p,h,S;return(S=(h=a==null?void 0:a.slots[l])!=null?h:(p=e.initialSlots)==null?void 0:p[l])!=null?S: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 S=await s;return!S||!p||p.length===0?p!=null&&p[0]?{variantId:p[0],assignmentTtlMs:0}:null:{variantId:(h=S.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 On(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=On(t);if(e.endsWith("/*")){let r=On(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===On(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 $n(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 Bn(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=S=>{for(let w of S)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 Ei(){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 xi(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Ai=3;function Ln(){return $r()}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 Ii(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 S=l.apply(this,h);return a(),S};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 gt={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 Oi(){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(g,v,d){if(!r)return Promise.resolve(null);let m=a.get(g);return m?Promise.resolve(m):Nn(u,g,async()=>{try{let O=new URLSearchParams({componentId:g});for(let Y of v!=null?v:[])O.append("variantIds[]",Y);let M=je(5e3),q;try{let Y=await fetch(`${o}/winner?${O.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(g,J),J}catch(O){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=[],S=[],w=()=>{for(let[,,g]of S.splice(0))g(null);b.length=0},b=[],K=!1,L=()=>{if(c)return;K=!0;let g=pe.get(e.apiKey);(g==null?void 0:g.upgrade)===P&&pe.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},D=[],E=()=>{setTimeout(()=>{var g;try{(g=D.shift())==null||g(i)}catch(v){}D.length&&E()})},x=g=>{c?D.length?D.push(g):g(i):!t&&!K&&b.length<100?b.push(g):K&&e.debug&&console.warn("[sentient] goal dropped: client released")},A={get gated(){return!c&&!t},get released(){return K&&!c},takeHeld:()=>b.splice(0),track:g=>i.track(g),goal:((g,v,d,m)=>x(O=>O.goal(g,v,d,m))),componentGoal:(g,v,d)=>i.componentGoal(g,v,d),identify:g=>i.identify(g),getAssignment:(g,v)=>i.getAssignment(g,v),assign:(g,v,d,m)=>i.assign(g,v,d,m),decide:g=>c?i.decide(g):K||t?Promise.resolve(null):new Promise(v=>S.push([g,Oe(),v])),getSlotResult:g=>i.getSlotResult(g),isSlotDecided:g=>{var v,d;return(d=(v=i.isSlotDecided)==null?void 0:v.call(i,g))!=null?d:!0},getSlotConfig:g=>i.getSlotConfig(g),getSitePalette:()=>i.getSitePalette(),getStyleVocabulary:()=>{var g,v;return(v=(g=i.getStyleVocabulary)==null?void 0:g.call(i))!=null?v:null},reportSlots:(g,v,d,m)=>i.reportSlots(g,v,d,m),reportSkeleton:(g,v)=>{var d;return(d=i.reportSkeleton)==null?void 0:d.call(i,g,v)},reportDrift:(g,v,d,m)=>{var O;return(O=i.reportDrift)==null?void 0:O.call(i,g,v,d,m)},requestSlots:(g,v,d)=>{var m;return c?(m=i.requestSlots)==null?void 0:m.call(i,g,v,d):p.push([g,v,d])},decideSlots:g=>{var v;return c?(v=i.decideSlots)==null?void 0:v.call(i,g):h.push(...g)},cancelSlots:g=>{var v;if(c)return(v=i.cancelSlots)==null?void 0:v.call(i,g);let d=new Set(g);for(let m of p)m[0]=m[0].filter(O=>!d.has(O));h=h.filter(m=>!d.has(m.id))},onSlotsChanged:g=>(l.add(g),()=>{l.delete(g)}),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(g){var v,d,m;i=g,c=!0,b.length&&(D.push(...b.splice(0)),E());let O=Oe();for(let[M,q,J]of S.splice(0))q!==O?J(null):g.decide(M).then(J,()=>J(null));(v=g.onSlotsChanged)==null||v.call(g,()=>l.forEach(M=>M()));for(let[M,q,J]of p.splice(0))M.length>0&&((d=g.requestSlots)==null||d.call(g,M,q,J));h.length>0&&((m=g.decideSlots)==null||m.call(g,h.splice(0)))}return{proxy:A,setInner:P}}function Oe(){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 gt;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(),S=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."}),S?gt:_i(e);if(S){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."}),gt;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."),gt;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),gt;let b=(t=e.ingestUrl)!=null?t:Gr,K=Date.now(),L=Br({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),D=Si(void 0,e.apiKey),E=!1,x=fe(e.apiKey),A=()=>!E&&fe(e.apiKey)===x,P=qe(F({},D),{set:(...f)=>{A()&&D.set(...f)}}),g=yr({ingestUrl:b,apiKey:e.apiKey}),v=zr(b),d={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},m=new Set,O=vr({url:`${v}/goals`,apiKey:e.apiKey,headers:d,onDrop:(f,y)=>{if(!e.debug){if(m.has(y))return;m.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=Er((n=navigator.userAgent)!=null?n:""),q=window.location.origin,J=xr((r=document.referrer)!=null?r:"",q),Y=(o=e.sessionSegment)!=null?o:`${M}:${J}`,Ae=new Map,I=new Map,$=new Map,ne=new Set,ue=new Map,Q=null,we=null,ee=null,Me=new Set,$e=new Set,Le=new Map,mn=new Map,er=new Set,tr=new Set,nr=new Set,gn=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,$o=2,or=new Map,_e=!1,ir=(f,y,N)=>{var z;let j=new Set,_=1;for(let C of f){y.delete(C);let T=((z=or.get(C))!=null?z:0)+1;or.set(C,T),T<=$o&&(j.add(C),T>_&&(_=T))}j.size>0&&setTimeout(()=>{_e||N(j)},Ve(_))},vn=f=>{for(let y of f)$.has(y.id)||$.set(y.id,An(y))};if(e.initialSlots)for(let[f,y]of Object.entries(e.initialSlots))$.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))$.has(f)||$.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 Be=Promise.resolve(),ar=L.getSessionId();if(ar){let f=Ar((c=document.referrer)!=null?c:""),{utmParams:y,clickIds:N}=Oi(),z=F(F(F(F({sessionId:ar,deviceClass:M,trafficSource:J,referrerDomain:f,utmParams:y,clickIds:N,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:Ir(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 _=0;;_++){if(_e||!A())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(_>=Ai){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(_+1)))}};try{Be=j()}catch(_){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:g});let Bo=Ci(),pt=null,bn=!1,se={goal(f,y={},N=1,z=0){var j,_,C,T,V,G,te;let re=L.getSessionId();if(!re||_e||!A())return;let W=xi(y)?y:{metadata:y},me=[f,(j=W.externalId)!=null?j:"",(_=W.stepIndex)!=null?_:z,(C=W.weight)!=null?C:N].join("\0"),ke=W.value!==void 0?`${W.value}\0${(T=W.currency)!=null?T:""}`:null;if(Bo.firedBefore(me,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 B={id:de,body:JSON.stringify(ae)};Be.then(()=>O.send(B))},componentGoal(f,y,N){var z,j,_;let C=L.getSessionId();if(!C||_e||!A())return;let T=P.get(f,Y),V=T?null:(z=$.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:Or(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},(_=N==null?void 0:N.metadata)!=null?_:{}),timestamp:Date.now(),timeInSession:Date.now()-K,path:Ut()};e.debug&&console.log("[sentient] componentGoal",te),Be.then(()=>{!_e&&A()&&g.push(te)})},identify(f){let y=L.getSessionId();!y||_e||!A()||Be.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||_e||!A()||f.eventType==="variant_assigned"&&$.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),Be.then(()=>g.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 _=P.get(f,Y);if(_&&(y!=null&&y.length||_.content!==void 0)){let C=_.ttlMs&&_.ttlMs>0?Math.max(0,_.assignedAt+_.ttlMs-Date.now()):0;return{variantId:_.variantId,assignmentTtlMs:C,content:_.content}}return Nn(Ae,f,async()=>{if(!await _n(Be,2500)||_e||!A())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:[],_={sessionId:z};f.sections&&f.sections.length>0&&(_.sections=f.sections.map(T=>({id:T}))),_.components=(N=f.components)!=null?N:[],j.length>0&&(_.slots=j.map(xn)),f.slotsFrom==="registry"&&(_.slotsFrom="registry",f.registrySlotIds&&(_.registrySlotIds=f.registrySlotIds),f.bootstrap===!1&&(_.bootstrap=!1),f.render&&Object.keys(f.render).length>0&&(_.render=f.render)),f.v&&(_.v=f.v),typeof f.pp=="number"&&(_.pp=f.pp),e.persona&&(_.persona=e.persona);let C=JSON.stringify(_);return Nn(I,C,async()=>{var T,V,G,te,re,W,me,ke;if(!await _n(Be,2500)||_e||!A())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 B=await ae.json(),ge={};for(let X of j){let Ie=(T=B.slots)==null?void 0:T[X.id];if(Ie!==void 0){ge[X.id]=Ie,$.set(X.id,Ie),ne.add(X.id);continue}let lr=$.get(X.id);if(lr!==void 0)ge[X.id]=lr;else{let ur=An(X);ge[X.id]=ur,$.set(X.id,ur)}}if(B.slots)for(let[X,Ie]of Object.entries(B.slots))X in ge||(ge[X]=Ie,$.set(X,Ie),ne.add(X));let Ko=ee!=null&&ee.persona!=="unknown";B.persona&&!(B.persona==="unknown"&&Ko)?ee={persona:B.persona,confidence:(V=B.confidence)!=null?V:0}:ee||(ee={persona:"unknown",confidence:0});for(let[X,Ie]of Object.entries((G=B.assignments)!=null?G:{}))P.set(X,Y,{variantId:Ie,assignedAt:Date.now(),segment:Y,confidence:1});if(B.slotConfig)for(let[X,Ie]of Object.entries(B.slotConfig))ue.set(X,Ie);B.palette&&(Q=B.palette),B.vocabulary&&(we=B.vocabulary);for(let X of(te=f.registrySlotIds)!=null?te:[])(re=B.slotConfig)!=null&&re[X]||(ue.delete(X),$.delete(X),ne.delete(X));return A()&&He(e.apiKey,F(F(F({v:1,persona:ee.persona,band:Je(ee.confidence),slots:Object.fromEntries($),layoutOrder:(W=B.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:(me=B.layoutOrder)!=null?me:null,assignments:(ke=B.assignments)!=null?ke:{},slots:ge,persona:ee.persona,confidence:ee.confidence},B.slotConfig?{slotConfig:B.slotConfig}:{}),B.goals?{goals:B.goals}:{}),B.sectionMap?{sectionMap:B.sectionMap}:{}),B.palette?{palette:B.palette}:{}),B.vocabulary?{vocabulary:B.vocabulary}:{})}catch(ae){return vn(j),null}finally{de.clear()}})},getSlotResult(f){var y;return(y=$.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 _={};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=_[C])!=null?j:_[C]=[]).push(V))}Object.keys(_).length>0&&fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify({slotIds:Object.keys(_),authoredArms:_})}).catch(()=>{});for(let C of f)if(!(typeof C!="string"||C.length===0)){if(!Tt.test(C)){Ei()&&!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),$e.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&&mn.set(C,V)}}$e.size===0||gn!=null||(gn=setTimeout(()=>{gn=null;let C=[...$e];$e.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 me=mn.get(re);me!==void 0&&(te[re]=me,mn.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}`,_=L.getSessionId();!_||tr.has(j)||(tr.add(j),fetch(`${v}/slots/drift`,{method:"POST",headers:d,body:JSON.stringify({sessionId:_,reports:[{slotId:f,expectedFp:y,observedFp:N,reason:z}]})}).catch(()=>{}))},requestSlots(f,y,N){var z,j;for(let _ of f)Pt.has(_)||(Pt.add(_),Tt.test(_)?dt.set(_,{text:y==null?void 0:y[_],render:(z=N==null?void 0:N.render)==null?void 0:z[_],skeleton:(j=N==null?void 0:N.skeletons)==null?void 0:j[_]}):se.reportSlots([_]));dt.size===0||hn!=null||(hn=setTimeout(()=>{hn=null;let _=[...dt];dt.clear();for(let C=0;C<_.length;C+=50){let T=_.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={},me={},ke=[];for(let[de,ae]of T){let B=(te=G.slotConfig)==null?void 0:te[de];if(B){B.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&&(me[de]=ae.skeleton)}ke.length>0&&se.reportSlots(ke,W,me)}else ir(T.map(([W])=>W),Pt,W=>{var me;let ke={},de={},ae={};for(let[B,ge]of T)W.has(B)&&(ge.text&&(ke[B]=ge.text),ge.render&&(de[B]=ge.render),ge.skeleton&&(ae[B]=ge.skeleton));(me=se.requestSlots)==null||me.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(_=>_.id),Rt,_=>{var C;return(C=se.decideSlots)==null?void 0:C.call(se,z.filter(T=>_.has(T.id)))}),Lt.forEach(_=>_())})}},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(){g.flush(),O.flush()},dispose(){var f;pt==null||pt(),bn=!0,_e=!0,g.destroy(),O.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(),bn=!0,_e=!0,E=!0,Dt(e.apiKey),g.destroy({forget:!0}),O.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($t(e.apiKey)),localStorage.removeItem(Bt(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=Ii(se,e.apiKey,f=>{Be.then(()=>{bn||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-XLLAS7vqqePHuskmX+G5fmU5eciF9fQ3fyv3Vgik9GzlCARhllOEArkRMVjWpI57":e==="preview.global.js"?"sha384-vdxAPgchJj9TyoCfgD43y1powSvyp9HFnq+1YircrnoQ8LsCBH/RCei+cQHMjZ+r":"sha384-IvppyTM8u+UjRX/4uXVUtX6ZJnYYroFQ+KwMkSwhfVKi+ffQfDd1QdJwd7VUNI+e")||"";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 $i=new Set(["A","BUTTON"]),Bi=/^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 $i.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function Fi(e){if(Bi.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((S,w)=>{S===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,b)=>{var K;l.children[b]!==w&&l.insertBefore(w,(K=l.children[b])!=null?K:null)})}return"applied"}function bt(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)&&!bt(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&&!bt(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,bt(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 St(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"&&St(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 _t(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,S,w,b,K,L,D,E,x,A;try{let P=lo(e.like),g=e.maxWidth==="measure"?"65ch":void 0,v=d=>(d.className=P,he(d,{"max-width":g}));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 m=!P&&e.type==="stack"&&e.surface==="raised",O=(a=e.pad)!=null?a:m?"md":void 0;O&&he(d,{padding:(u=ut[O])!=null?u:ut.md}),m&&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 m=Zt(e.href);if(m&&(d.href=m),e.tag&&d.setAttribute("data-sentient-tag",e.tag),P)return v(d);let O=(h=e.emphasis)!=null?h:"primary";return he(d,{display:"inline-block",padding:es[(S=e.size)!=null?S:"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":O==="ghost"?"underline":"none",cursor:"pointer",background:O==="primary"?(b=R==null?void 0:R.primaryBg)!=null?b:"#111827":"transparent",color:O==="primary"?(K=R==null?void 0:R.primaryText)!=null?K:"#ffffff":(L=R==null?void 0:R.accent)!=null?L:"inherit",border:O==="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 m=Zt(e.href);return m&&(d.href=m),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"),m=Zt(e.src);return m&&(d.src=m),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 ${(E=R==null?void 0:R.border)!=null?E:"currentColor"}`},ao(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(x=so[e.size])!=null?x:so.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(A=R==null?void 0:R.border)!=null?A:"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 S=l?lo((o=l.surface)==null?void 0:o.like):void 0;if(S){let w=r.createElement("div");w.className=S;let b=uo((s=l.surface)==null?void 0:s.like);b&&(w.style.color=b),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,S;let o=new Set,s=(u=r==null?void 0:r.contentAndOps)!=null?u:!0,a=[];for(let[w,b]of Object.entries(t)){if(Yt(b.locator,n))continue;let K;if(b.locator){let D=Te(b.locator,n);K=D?[D]:[],!D&&Xt(b.locator,n)&&a.push(w)}else K=Hn(b.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[x,A]of Object.entries(L))D.setAttribute(`data-${x}`,A),(l=r==null?void 0:r.onAttr)==null||l.call(r,D,`data-${x}`);if((b.blocks||b.compose)&&!ss(n)){let x=Object.fromEntries([...Object.entries((p=b.blocks)!=null?p:{}).filter(([,A])=>!ht(A)),...Object.entries((h=b.compose)!=null?h:{}).filter(([,A])=>!ht(A.tree))]);Object.keys(x).length>0&&(fo(D,x,typeof L=="string"?L:void 0,n),o.add(D))}if(!s)continue;let E=D.textContent;b.edits?Xr(D,b.edits.edits,b.edits)==="mismatch"&&((S=r==null?void 0:r.onDrift)==null||S.call(r,w,b.edits.fp)):typeof b.content=="string"&&St(D,b.content),b.ops&&oo(D,b.ops,w,n).anchorMiss&&!a.includes(w)&&a.push(w),$n(D,Ke(U(U({previous:E},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(Bn((h,S={})=>{try{e.track({projectId:t,componentId:o,variantId:s,eventType:"micro_signal",payload:U({signalType:h},S)})}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 mo(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(mo(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 go(e,t,n,r){var L,D;let o=(L=n.defaultView)!=null?L:typeof window!="undefined"?window:null,s=mo(r),a=cs(o,s),u=E=>{let x=po(E);if(!a.has(x))try{E.slotId?t.componentGoal(E.slotId,E.goalId):t.goal(E.goalId),a.add(x),ds(o,s,a)}catch(A){}},i=e.filter(E=>E.event==="click"),c=e.filter(E=>E.event==="form_submit"),l=e.filter(E=>E.event==="url_reached"),p=e.filter(E=>E.event==="scroll_depth"),h=(E,x)=>{if(!E.locator)return!1;let A=Te(E.locator,n);return!!A&&(A===x||A.contains(x))},S=E=>{let x=E.target;if(!(!x||typeof x.closest!="function"))for(let A of i)h(A,x)&&u(A)},w=E=>{let x=E.target;if(x)for(let A of c)h(A,x)&&u(A)},b=()=>{if(l.length===0)return;let E=bt(n);for(let x of l)x.urlPattern&&ls(x.urlPattern,E)&&u(x)},K=()=>{var A;let E=n.documentElement,x=E.scrollHeight>0?(E.scrollTop+E.clientHeight)/E.scrollHeight:0;for(let P of p)x>=((A=P.threshold)!=null?A:.75)&&u(P);p.every(P=>a.has(po(P)))&&n.removeEventListener("scroll",K)};return n.addEventListener("click",S,!0),n.addEventListener("submit",w,!0),(D=n.defaultView)==null||D.addEventListener("popstate",b),b(),p.length>0&&(n.addEventListener("scroll",K,{passive:!0}),K()),{checkUrl:b,teardown:()=>{var E;n.removeEventListener("click",S,!0),n.removeEventListener("submit",w,!0),(E=n.defaultView)==null||E.removeEventListener("popstate",b),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 Et="0.32.3",un=Et!=="0.0.0-dev"?{name:"snippet",version:Et}:void 0,xo=Et!=="0.0.0-dev"?{v:Et}:{},vo=5e3,ps=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[]}})(),Z=null,k=null,be={},ve=null,Se=null,xt=null,oe=null,ie=null,At=0,H=null,Qe=null,bo=!1,Jn=null,an=null,Ct=null,Ee=!1,Ue=!1,cn=!1,dn=0,Co=e=>fe(e)===dn,ct=null,ce=!1,De=null,xe=[],et=null,tt=null,ye=null,ms=3e3,gs=100;function So(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 It(e,t){return Z?(Z.personaAttributes&&H&&en(H.persona,H.band,e,t==null?void 0:t.onAttr),tn(be,Z.slots,e,t==null?void 0:t.onAttr),nn(be,Z.slots,e,t==null?void 0:t.onAttr),ve?rn(be,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 Io(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,Io(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 Oo(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(!Ee){le&&et!==Oe()&&le(!0);return}!De||et===Oe()||(et=Oe(),bs())}function bs(){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=>!xe.includes(h));s!==null&&c.some(h=>!s.has(h)&&!p.includes(h))&&Ot(),s=new Set(c),p.length>0&&Ss(p).catch(()=>{}),(i||l.length===0&&!t.some(h=>!c.includes(h.id)&&!xe.includes(h.id)))&&(o(),No(e,l))},u=setTimeout(()=>a(!0),ms);if(ye=o,a(),ye===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(a,gs)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(i){}}function fn(e,t){if(!(!e||e.length===0||!t||!Z))try{Se==null||Se.teardown(),Se=go(e,t,document,Z.apiKey)}catch(n){}}async function Ss(e){let t=Z,n=k;if(!t||!n)return;xe=xe.concat(e);let r=await n.decide(U({slotsFrom:"registry",registrySlotIds:e,render:Lo(e,document)},xo));if(r||(xe=xe.filter(s=>!e.includes(s))),!r||ce||k!==n)return;be=U(U({},be),r.slots),!Se&&r.goals&&(t.consent!==!1||Ue)&&fn(xt=r.goals,n);let o=Po(r.slotConfig,e);o&&(ve=U(U({},ve),o)),Ot(),Ne(t,"late decide",e),tt&&Co(t.apiKey)&&He(t.apiKey,tt=U(Ke(U({},tt),{slots:be,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=[];It(document,{contentAndOps:Ee,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=++At;Ct=window.location.pathname,lt("engagement.global.js","__sentientEngagement").then(r=>{if(!(!r||n!==At||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 Ot(){try{let e=[];if(oe==null||oe(),oe=null,It(document,{contentAndOps:Ee,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,At++,Qn())}catch(t){}}catch(e){}}function wo(){Jn===null&&(Jn=setTimeout(()=>{Jn=null,Ot();try{Se==null||Se.checkUrl()}catch(e){}Ro()},ps))}function Do(){if(!(bo||typeof window=="undefined"||typeof history=="undefined")){bo=!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 _s(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 _o="sentient-editor-load-notice";function ko(){var e;try{if(document.getElementById(_o))return;let t=document.createElement("div");t.id=_o,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&&(be=n.slots),n.slotConfig!==void 0&&(ve=n.slotConfig),n.persona!==void 0&&(H=n.persona),n.decided&&(Ee=!0),n.look&&(_t(n.look.palette),kt(n.look.vocabulary))},apply:()=>It(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,At++,Ct=null,oe==null||oe(),oe=null,ye==null||ye(),Se==null||Se.teardown(),Se=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:Oo(e)},un?{sdk:un}:{})),fn(xt,k);else{let r=(k==null?void 0:k.gated)===!0;Kn(e.apiKey),r&&(dn=fe(e.apiKey)),fn(xt,k)}ce=!1,le==null||le()}catch(r){}Ue=!0;try{ws()}catch(r){}},revokeConsent(){t(!0)},reapply:Ot,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:be,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 Ao.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 Eo(){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})},Ao.length=0}catch(t){}}function Es(){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){Eo();return}Z=n,ct==null||ct(),ct=null,!n.consentFrom&&n.consent===void 0&&Es()&&(n.consentFrom="shopify"),Vr(n.consentSrc),zt(n.nonce),cn=!1,Ee=!1,le=null,Qe=null,be={},ve=null,_t(null),kt(null),Ue=!1,ce=!1,xt=null,De=null,xe=[],et=null,tt=null,ye==null||ye(),ie==null||ie(),ie=null,At++,Ct=null;let r=yo("sentient_editor_code"),o=r?null:ho();if(r||o){_s(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()&&lt("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},be=i.slots,i.slotConfig&&(ve=i.slotConfig),i.palette&&_t(i.palette),i.vocabulary&&kt(i.vocabulary),It(document,U({contentAndOps:!1},u?{onAttr:(d,m)=>c.push([d,m])}:{})),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:Oo(n)},un?{sdk:un}:{}));k=l,dn=fe(n.apiKey),Zn(n),Do();let p=Object.entries(n.slots).map(([d,m])=>({id:d,dims:m.dims})),h=xo,S={pp:u?u.v:0},w=[];if(a){let[d]=await Promise.all([So(a,vo),document.readyState==="loading"?new Promise(m=>document.addEventListener("DOMContentLoaded",m,{once:!0})):null]);De=d,d&&(xe=w=Xn(d,document)[0]),Ne(n,"registry scope",d&&w)}let b=(d=l)=>{let m=Array.from(Io(document).keys());return d.decide(U(U(U(U({slots:p},h),S),m.length>=2?{sections:m}:{}),s?{slotsFrom:"registry",registrySlotIds:w,render:Lo(w,document)}:{}))},K=Oe(),L=l.gated===!0,D=!1,E=!1,x=!1,A=!1;le=(d=!1)=>{let m=k;!D||E||A||Ee||ce||!m||m.gated||!d&&!x||(x=!1,A=!0,K=et=Oe(),De&&(xe=w=Xn(De,document)[0]),b(m).then(O=>{A=!1,O&&!Ee&&!ce&&k===m?v(O):(O||(xe=[]),!Ee&&(m.released||k!==m||ce)&&(x=!0))}).catch(()=>{A=!1}))};let P=b();P.then(()=>{D=!0},()=>{D=!0});let g=await So(P,vo),v=d=>{var M,q,J,Y,Ae;E=!0;let m=(k!=null?k:l).getPersona();m?H={persona:m.persona,band:m.band}:d.persona&&(H={persona:d.persona,band:"low"}),be=d.slots,s?ve=Po(d.slotConfig,w):d.slotConfig&&(ve=d.slotConfig),d.palette&&_t(d.palette),d.vocabulary&&kt(d.vocabulary),Qe=(M=d.layoutOrder)!=null?M:Qe;let O=()=>{let I=[],$=It(document,{onApplied:(ne,ue,Q)=>I.push({slotId:ne,arm:ue,el:Q})});if(s||No(n,$),Yn(Qe,document),Ee=!0,nt())try{oe==null||oe(),oe=on(k,n.apiKey,I)}catch(ne){}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",O,{once:!0}):O(),xt=(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:be,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:(Ae=H==null?void 0:H.band)!=null?Ae:"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(!g){Ne(n,"decide timeout/null \u2014 snapshot state stands",ln(n)),P.then(d=>{if(!d){if(Ee)return;xe=[],l.released===!0||k!==l||ce||L&&Oe()!==K?(x=!0,le==null||le()):et=K;return}if(!(!d||Ee||ce)){if(k!==l){x=!0,le==null||le();return}v(d),Ne(n,"late decide applied",ln(n))}}).catch(()=>{});return}if(ce||k!==l){x=!0,le==null||le();return}v(g)}catch(n){Eo()}}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(xs);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentientui/snippet",
3
- "version": "0.32.1",
3
+ "version": "0.32.3",
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",
@@ -41,7 +41,7 @@
41
41
  "tsx": "^4.19.2",
42
42
  "typescript": "^5.7.2",
43
43
  "vitest": "^2.1.8",
44
- "@sentientui/core": "0.36.2"
44
+ "@sentientui/core": "0.37.0"
45
45
  },
46
46
  "scripts": {
47
47
  "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsup && node scripts/stamp-chunk-sri.mjs",