@sentientui/snippet 0.33.0 → 0.33.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
- "use strict";var __sentientEditorBundle=(()=>{var Ft=Object.defineProperty,kr=Object.defineProperties,Sr=Object.getOwnPropertyDescriptor,Er=Object.getOwnPropertyDescriptors,Tr=Object.getOwnPropertyNames,Ut=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(Ut)for(var n of Ut(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&&Ut)for(var r of Ut(e))t.indexOf(r)<0&&co.call(e,r)&&(n[r]=e[r]);return n};var Cr=(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})},Ar=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Tr(t))!mn.call(e,s)&&s!==n&&Ft(e,s,{get:()=>t[s],enumerable:!(r=Sr(t,s))||r.enumerable});return e};var _r=e=>Ar(Ft({},"__esModule",{value:!0}),e);var Ir,$r,Br,fo,Or,Mr,go,de,lt,hn=Cr(()=>{"use strict";Ir=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?Ir(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:()=>Rn,clearTargetHighlights:()=>mt,computeMoveAnchors:()=>en,deriveSlotId:()=>Ce,drawTargetHighlights:()=>nr,exchangeCode:()=>er,isHex6:()=>Nn,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 _t(e,t=document){let n=ho(t);return n&&e.setAttribute("nonce",n),e}var Ri=1800*1e3;var yn=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Rr(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 Pr(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 Nr=/^[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)&&Nr.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&&!Rr(t).includes(e.urlMatch))return null;let n=Dr(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Pr(r,e.fingerprint)?null:r}var It={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,Ne=null;function zr(e){return e.replace(/["\\]/g,"\\$&")}function jr(e){var t;(!Ne||!Ne.isConnected)&&(Ne=e.querySelector("style[data-sentient-ops]"),Ne||(Ne=_t(e.createElement("style"),e),Ne.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Ne))),Ne.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=It[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"},Gr={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},xo={sm:"8px",md:"16px",lg:"32px"},Ur={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 To(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,U,X,ne,Q;try{let M=So(e.like),re=e.maxWidth==="measure"?"65ch":void 0,ie=I=>(I.className=M,he(I,{"max-width":re}));switch(e.type){case"stack":case"grid":{let I=t.createElement("div");if(e.type==="stack"){let B=e;he(I,{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(I,{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&&(I.className=M);let R=!M&&e.type==="stack"&&e.surface==="raised",q=(m=e.pad)!=null?m:R?"md":void 0;q&&he(I,{padding:(x=dt[q])!=null?x:dt.md}),R&&he(I,{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=To(B,t);V&&I.appendChild(V)}return I}case"text":{let I=t.createElement("p");return I.textContent=e.value,M?ie(I):he(I,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 I=t.createElement(`h${e.level}`);return I.textContent=e.value,M?ie(I):he(I,{margin:"0","font-size":Kr[($=e.size)!=null?$:"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 R=Wt(e.href);if(R&&(I.href=R),e.tag&&I.setAttribute("data-sentient-tag",e.tag),M)return ie(I);let q=(L=e.emphasis)!=null?L:"primary";return he(I,{display:"inline-block",padding:Gr[(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 ${(U=O==null?void 0:O.accent)!=null?U:"currentColor"}`:"none"})}case"link":{let I=t.createElement("a");I.textContent=e.label;let R=Wt(e.href);return R&&(I.href=R),e.tag&&I.setAttribute("data-sentient-tag",e.tag),M?ie(I):he(I,{color:"inherit","text-decoration":"underline"})}case"image":{let I=t.createElement("img"),R=Wt(e.src);return R&&(I.src=R),I.alt=e.alt,M&&(I.className=M),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,M?ie(I):he(I,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 Co(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,$=To(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 _o(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 Io(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 Ao(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 _o(($=y.nodeValue)!=null?$:"")});return{textNodes:m,ownerEls:x,leafToNode:g,leaves:k,fp:Io(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 U=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=_o(x.filter((ie,I)=>m[I]===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:!!U&&(!Oo(ke(U.backgroundColor,e.ownerDocument))||U.backgroundImage!==""&&U.backgroundImage!=="none")},Ao(E.getAttribute("href"),g)!==void 0?{href:Ao(E.getAttribute("href"),g)}:{}):{}),{color:ke(U==null?void 0:U.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:Io(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 Ro=new WeakMap;function Po(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function No(e,t,n){var c,m,x;let r=Ro.get(e);if(r){if(r.fp!==n.fp||!Po(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||!Po(r.leafToNode,n.leafToNode)))return"mismatch";Ro.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 Tn(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 Cn(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=Cn(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=Cn(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&&Tn(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&&Tn(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:Tn(z,E),view:$,vw:$.innerWidth||0},Z=(s=(r=$.location)==null?void 0:r.pathname)!=null?s:"/",U=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 R of M)try{if(R.tagName==="IMG"){let ee=R,Ie=((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(Ie&&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:Ie.slice(0,200),w:Y,h:et,seenOn:Z})}}let q=((x=R.getAttribute("class"))!=null?x:"").replace(/\s+/g," ").trim();if(q===""||si(R,$,J.vw))continue;let B=$.getComputedStyle(R),V=R.tagName==="IMG"?((g=R.getAttribute("alt"))!=null?g:"").trim()?"image":null:li(R,B,J);if(!V)continue;let Se=`${V}|${q}`,ze=R.getBoundingClientRect();ne.set(Se,Math.max((k=ne.get(Se))!=null?k:0,ze.width*ze.height));let _e=X.get(Se);if(_e){_e.seen.count++;continue}let ye=Cn(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)),Ie=Y=>Y.a<1?`rgba(${Y.r}, ${Y.g}, ${Y.b}, ${Y.a})`:`rgb(${Y.r}, ${Y.g}, ${Y.b})`;ue=Ie(ee[0]),ee.length>1&&(je=Ie(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)}:{}),R.parentElement&&$.getComputedStyle(R.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:U}})}catch(q){}let re=new Map;for(let R of X.values())re.set(R.role,[...(y=re.get(R.role))!=null?y:[],R]);let ie=[],I=R=>{var q;return(q=ne.get(`${R.role}|${R.classes}`))!=null?q:0};for(let[R,q]of re)q.sort((B,V)=>(R.startsWith("button-")?I(V)-I(B):0)||V.seen.count-B.seen.count).slice(0,ri).forEach((B,V)=>ie.push(lt(de({},B),{id:V===0?R:`${R}-${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 Go(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 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 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 Rt(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=Rt(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 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=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",_n="sentient-editor-styles",In="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(_n))return;let e=_t(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,Tr=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 Cr=(e,t)=>()=>(e&&(t=e(e=0)),t);var Ir=(e,t)=>{for(var n in t)Ft(e,n,{get:t[n],enumerable:!0})},Lr=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of Tr(t))!mn.call(e,s)&&s!==n&&Ft(e,s,{get:()=>t[s],enumerable:!(r=Sr(t,s))||r.enumerable});return e};var _r=e=>Lr(Ft({},"__esModule",{value:!0}),e);var Ar,$r,Br,fo,Mr,Or,go,de,lt,hn=Cr(()=>{"use strict";Ar=Object.defineProperty,$r=Object.defineProperties,Br=Object.getOwnPropertyDescriptors,fo=Object.getOwnPropertySymbols,Mr=Object.prototype.hasOwnProperty,Or=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={}))Mr.call(t,n)&&go(e,n,t[n]);if(fo)for(var n of fo(t))Or.call(t,n)&&go(e,n,t[n]);return e},lt=(e,t)=>$r(e,Br(t))});var Bi={};Ir(Bi,{buildStyleOps:()=>Pn,clearTargetHighlights:()=>mt,computeMoveAnchors:()=>en,deriveSlotId:()=>Ce,drawTargetHighlights:()=>nr,exchangeCode:()=>er,isHex6:()=>Nn,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 _t(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 Rr(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 Nr=/^[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)&&Nr.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&&!Rr(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,Ne=null;function zr(e){return e.replace(/["\\]/g,"\\$&")}function jr(e){var t;(!Ne||!Ne.isConnected)&&(Ne=e.querySelector("style[data-sentient-ops]"),Ne||(Ne=_t(e.createElement("style"),e),Ne.setAttribute("data-sentient-ops",""),((t=e.head)!=null?t:e.documentElement).appendChild(Ne))),Ne.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",M=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"?M!=null&&M.muted?{color:M.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:M==null?void 0:M.accent}:{}}function To(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,$,I,D,E,z,J,Z,G,X,ne,Q;try{let O=So(e.like),re=e.maxWidth==="measure"?"65ch":void 0,ie=A=>(A.className=O,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,q=(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} * ${q}) / ${B.columns})), 1fr))`,gap:q,"align-items":B.align?Sn[B.align]:void 0})}O&&(A.className=O);let P=!O&&e.type==="stack"&&e.surface==="raised",V=(m=e.pad)!=null?m:P?"md":void 0;V&&he(A,{padding:(x=dt[V])!=null?x:dt.md}),P&&he(A,{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":(k=M==null?void 0:M.radius)!=null?k:"8px"});for(let B of(y=e.children)!=null?y:[]){let q=To(B,t);q&&A.appendChild(q)}return A}case"text":{let A=t.createElement("p");return A.textContent=e.value,O?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,O?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),O)return ie(A);let V=(I=e.emphasis)!=null?I:"primary";return he(A,{display:"inline-block",padding:Ur[(D=e.size)!=null?D:"md"],"border-radius":(E=M==null?void 0:M.radius)!=null?E:"8px",font:"inherit","font-size":e.size?vo[e.size]:void 0,"text-decoration":V==="ghost"?"underline":"none",cursor:"pointer",background:V==="primary"?(z=M==null?void 0:M.primaryBg)!=null?z:"#111827":"transparent",color:V==="primary"?(J=M==null?void 0:M.primaryText)!=null?J:"#ffffff":(Z=M==null?void 0:M.accent)!=null?Z:"inherit",border:V==="secondary"?`1px solid ${(G=M==null?void 0:M.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),O?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,O&&(A.className=O),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,O?ie(A):he(A,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"}`},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=M==null?void 0:M.border)!=null?Q:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(O){return null}}function Co(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,$=To(y?y.tree:k,r);if(!$)continue;let I=r.createElement("div");I.setAttribute(kn,g),I.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($),I.appendChild(E)}else I.appendChild($);e.appendChild(I)}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 Vr=/(?: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 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(qr.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 Vt(e,t){var n;return!e||e==="none"||!/gradient/i.test(e)?[]:((n=e.match(Vr))!=null?n:[]).map(r=>ke(r,t)).filter(r=>r!=="")}hn();function _o(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function Io(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 Io(t,2166136261)+Io(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 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 Mo(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=Vt(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(!Mo(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),I=x.indexOf($);I===-1&&(x.push($),I=x.length-1),g.push(I)}if(x.length>t)return{reason:"too_large"};let k=m.map(y=>{var $;return _o(($=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),O=Bo(E)?"action":Q?"heading":Zr.has(E.tagName)?"label":"text",re=_o(x.filter((ie,A)=>m[A]===z).join(" "));return lt(de(lt(de({tag:E.tagName.toLowerCase(),role:O},Q?{level:Number(Q[1])}:{}),{text:re,classes:((Z=E.getAttribute("class"))!=null?Z:"").replace(/\s+/g," ").trim()}),O==="action"?de({filled:!!G&&(!Mo(ke(G.backgroundColor,e.ownerDocument))||G.backgroundImage!==""&&G.backgroundImage!=="none")},Lo(E.getAttribute("href"),g)!==void 0?{href:Lo(E.getAttribute("href"),g)}:{}):{}),{color:ke(G==null?void 0:G.color,e.ownerDocument),group:ne,restylable:!0})}),I=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:I.bg},I.alt?{ambientBgAlt:I.alt}:{}),{ambientText:ke(D==null?void 0:D.color,e.ownerDocument)}),nodes:$,leaves:x,leafToNode:m,fp:Ao(x)},textNodes:s,ownerEls:c}}function Oo(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 Ro(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function No(e,t,n){var c,m,x;let r=Po.get(e);if(r){if(r.fp!==n.fp||!Ro(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||!Ro(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 I=!0;s.leafToNode.forEach((D,E)=>{D===y&&(s.textNodes[E].nodeValue=I?k.text:"",I=!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),I=0;Array.from(y.children).map(E=>$.has(E)?k[I++]: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"},Mt=null;function He(e){let t=Mt?ke(e,Mt):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 Tn(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 Cn(e){return Mt?Vt(e,Mt):[]}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=Cn(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 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 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=Cn(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 I=He(t.backgroundColor),D=e.parentElement?Ho(e.parentElement,n.view):n.pageBg;return x&&I&&I.a>=.9&&Tn(I,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(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 $=e.nextElementSibling;if(qt(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"&&qt(e)){if(c>=1.1*n.bodySize)return"text-lead";if(c<=.85*n.bodySize)return"text-small";let I=He(t.color);return I&&Tn(I,Ho(e,n.view))<n.bodyContrast*.8?"text-muted":"text-body"}return(s==="SPAN"||s==="DIV")&&x&&qt(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:[]};Mt=e;let I=$.getComputedStyle(e.body),D=De(I.fontSize)||16,E=Jt(I.backgroundColor)?He(I.backgroundColor):{r:255,g:255,b:255,a:1},z=(n=He(I.color))!=null?n:{r:17,g:24,b:39,a:1},J={bodySize:D,pageBg:E,bodyContrast:Tn(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,O=Array.from(e.body.querySelectorAll("*")).slice(0,(c=t==null?void 0:t.maxElements)!=null?c:4e3);for(let P of O)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 V=((x=P.getAttribute("class"))!=null?x:"").replace(/\s+/g," ").trim();if(V===""||si(P,$,J.vw))continue;let B=$.getComputedStyle(P),q=P.tagName==="IMG"?((g=P.getAttribute("alt"))!=null?g:"").trim()?"image":null:li(P,B,J);if(!q)continue;let Se=`${q}|${V}`,ze=P.getBoundingClientRect();ne.set(Se,Math.max((k=ne.get(Se))!=null?k:0,ze.width*ze.height));let _e=X.get(Se);if(_e){_e.seen.count++;continue}let ye=Cn(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:q,role:q,classes:V,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(V){}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 V;return(V=ne.get(`${P.role}|${P.classes}`))!=null?V:0};for(let[P,V]of re)V.sort((B,q)=>(P.startsWith("button-")?A(q)-A(B):0)||q.seen.count-B.seen.count).slice(0,ri).forEach((B,q)=>ie.push(lt(de({},B),{id:q===0?P:`${P}-${q+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 Ot(){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 I of Array.from(c).slice(0,300)){let D=I.getBoundingClientRect();if(D.width>0&&(D.width<48||D.height<24))continue;let E=r.getComputedStyle(I),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[I,D]of m)D>g&&(x=I,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 In(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 Vo(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 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=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",_n="sentient-editor-styles",An="sentient-editor-target-highlight",mi=10,qo="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(_n))return;let e=_t(document.createElement("style"));e.id=_n,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); }
@@ -21,14 +21,14 @@
21
21
  @media (prefers-reduced-motion: reduce) {
22
22
  #${gt}, #${gt} .sntedi-dot, #${tn} { animation: none !important; }
23
23
  }
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,Go(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 Pn(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 Pn(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 Pn(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:Pn(r.status,s)}}catch(r){return{r:"error",data:null,outcome:{r:"error"}}}}var $n=[];function Nn(e){return/^#[0-9a-fA-F]{6}$/.test(e)}function Bn(e){let t=e.trim();if(Nn(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(`.${In}`)))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=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 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,Ti=/^(rgb|rgba|hsl|hsla)\(/i;function Ci(e){return Ei.test(e)||Ti.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 Ci(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 Rn(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 Pt={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),T("Selection paused \u2014 browse normally, then resume.")):T("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"),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"),I=d("button",F("#374151"),"Set up a funnel"),R=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"),_e=An("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,B,V])o.disabled=!0;let je=[U,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",R.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",{}),Ie=[{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 Ie){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(U),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(I,R,q);let xe=d("div",{});ve.get("drafts").append(xe);let Nt=()=>{var i,a;for(let l of Ie){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),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,C,w,v,b,A,P,H,G,N,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,Ae,Pe,Ve,At;return((Ae=(se=(j=_.draft_config)==null?void 0:j.arms)==null?void 0:se.length)!=null?Ae:0)>0||((At=(Ve=(Pe=_.published_config)==null?void 0:Pe.arms)==null?void 0:Ve.length)!=null?At: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 h=_=>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((S=_.display_name)!=null?S:_.slot_id);j.append(h(_.status==="published"));let se=(b=(v=(C=_.draft_config)==null?void 0:C.arms)!=null?v:(w=_.published_config)==null?void 0:w.arms)!=null?b:[],Ae=(H=(A=se[1])==null?void 0:A.id)!=null?H:(P=se[0])==null?void 0:P.id,Pe=Le("#374151","Preview");if(Pe.onclick=()=>zn(_.slot_id,Ae),j.append(Pe),_.status!=="published"&&((ge=(N=(G=_.draft_config)==null?void 0:G.arms)==null?void 0:N.length)!=null?ge:0)>0){let Ve=Le("#10b981","Publish");Ve.onclick=async()=>{Ve.disabled=!0;let At=await ce(e,`/v1/editor/slots/${encodeURIComponent(_.slot_id)}/publish`,{});Ve.disabled=!1,be(At,"\u2713 Published \u2014 live for new visitors."),At.r==="ok"&&(c("published",{kind:"slot"}),tt())},j.append(Ve)}_.status!=="published"&&j.append(Dt(`/v1/editor/slots/${encodeURIComponent(_.slot_id)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>{Yn(_.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(h(_.status==="active")),_.status==="draft"){let se=Le("#10b981","Start tracking");se.onclick=async()=>{se.disabled=!0;let Ae=await ce(e,`/v1/editor/goals/${encodeURIComponent(_.goal_id)}/publish`,{});se.disabled=!1,be(Ae,"\u2713 Tracking is live \u2014 it counts from your next visitor."),Ae.r==="ok"&&(c("published",{kind:"goal"}),tt())},j.append(se,Dt(`/v1/editor/goals/${encodeURIComponent(_.goal_id)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>{Jn(_.goal_id),tt()}))}xe.append(j)}}},ar=o=>{Y!==o&&(ae(),kt(),Y=o,Nt())},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 Gn=!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(Ai(26)),Be.title="Open the SentientUI editor",Be.setAttribute("aria-label","Open the SentientUI editor");let Un=An("minimize","Minimize");Un.onclick=()=>{y.style.display="none",Be.style.display="flex",Gn=E,E=!0,m.style.display="none",mt(document)},Be.onclick=()=>{y.style.display="block",Be.style.display="none",E=Gn},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,Un,_e);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 C;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 A=d("select",Pt);A.setAttribute("data-field",w.key);let P=document.createElement("option");P.value="",P.textContent="\u2014 no change \u2014",A.append(P);for(let H of(C=w.options)!=null?C:[]){let G=document.createElement("option");G.value=H,G.textContent=H,A.append(G)}u[w.key]=()=>A.value,W.append(A)}else if(w.type==="color"){let A=d("input",le(K({},Pt),{padding:"2px",height:"34px"}));A.type="color",A.setAttribute("data-field",w.key);let P=!1;A.addEventListener("input",()=>{P=!0}),u[w.key]=()=>P?A.value:"",W.append(A)}else{let A=d("input",Pt);A.setAttribute("data-field",w.key),w.value!==void 0&&(A.value=w.value),u[w.key]=()=>A.value,W.append(A)}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=Rt(location.pathname),a=d("div",{}),l=d("select",Pt);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,T=(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"?T(i,!0):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to save this. Your earlier changes are safe.",!1):T(sn(o,"save"),!1)},Ge=null,jt=o=>o.length>30?`${o.slice(0,27)}\u2026`:o,Yn=o=>{Ge===o&&(ht===o&&(zt(),ht=null),Ge=null,ye.style.display="none",R.style.display="none",Ke.textContent="")},Jn=o=>{at===o&&(at=null,ue.style.display="none",Ke.textContent="")},xt=(o,i,a)=>{Ge=o,ye.textContent=i?`Publish \u201C${jt(i)}\u201D \u2014 go live`:"Publish now \u2014 go live",ye.style.display="block",R.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(!Ge)return;ye.disabled=!0,T("Publishing\u2026");let o=await ce(e,`/v1/editor/slots/${encodeURIComponent(Ge)}/publish`,{});ye.disabled=!1,o.r==="ok"?(c("published",{kind:"slot"}),T("\u2713 Published \u2014 live for new visitors.",!0),ye.style.display="none",Ge=null,Ke.textContent=""):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to publish. Your saved draft is safe.",!1):T(sn(o,"publish"),!1)};let oe=null,Me=!1,ot=null,rt=null,Ee=null,Ue=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||!Ue,B.title=B.disabled?Xn(Ee,"above"):"",V.title=V.disabled?Xn(Ue,"below"):""},Te=null,ln=o=>{o&&!Te&&t&&oe?(Te=Vn(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",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,Ue=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`})},Re=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=Re(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${Re(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: ${Re(o)}`,dr(o),c("element_selected",{unique:i}),T(i?"\u2713 Matches exactly 1 element":"",i),i||ur(o),D.style.display="none",pn();for(let f of je)f.style.display="block";U.style.display="none",X.style.display="none";let a=vn(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");M.style.display=l?"block":"none",M.disabled=!l;let u=en(o,document);ot=u.prevEl,rt=u.nextEl,Ee=u.prevLocator,Ue=u.nextLocator,Zn(),Nt()},eo=()=>{kt(),ae(),t=null,oe=null,Me=!1,ot=null,rt=null,Ee=null,Ue=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",T(""),Nt()},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,T("Press Esc again to close the editor.");return}it=!1,(u=_e.onclick)==null||u.call(_e,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){T("\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,T("\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,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){T("\u26A0 Enter alternative wording to test.",!1);return}if(S===p.current.trim()){T("\u26A0 Enter different wording \u2014 the alternative matches the current text.",!1);return}let C=Ce("text",o,t);T("Saving\u2026");let w=await ce(e,`/v1/editor/slots/${encodeURIComponent(C)}`,{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(C,Re(t),"b")),be(w,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Ce("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 C="",w=p.getAttribute("href");if(w)try{let v=new URL(w,window.location.href);v.protocol==="https:"&&(C=v.href)}catch(v){}u.push({label:S,href:C})}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,C,w,v,b,A,P,H,G,N,ge,me,_,j,se;let a=Ae=>{var Pe;return i.paragraphs.length>=3&&(Pe=i.paragraphs[i.paragraphs.length-3+Ae])!=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(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=(C=i.links[1])==null?void 0:C.label)!=null?w:"";case"secondary_href":return(b=(v=i.links[1])==null?void 0:v.href)!=null?b:"";case"quote":case"q1":return(A=i.quotes[0])!=null?A:"";case"q2":return(P=i.quotes[1])!=null?P:"";case"q3":return(H=i.quotes[2])!=null?H:"";case"name":case"n1":return(G=i.attributions[0])!=null?G:"";case"n2":return(N=i.attributions[1])!=null?N:"";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""}},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 A,P,G,N,ge;let h=!1,p=!1;for(let me of o.fields){if(me.kind==="href"){let j=!1;try{j=new URL((A=u[me.id])!=null?A:"").protocol==="https:"}catch(se){}f(me.id,j?null:"Links need to start with https://"),j||(h=!0);continue}let _=((P=u[me.id])!=null?P:"").trim()==="";f(me.id,_?"Fill this in with your own words":null),_&&(p=!0)}if(h){T("\u26A0 Fix the highlighted link(s).",!1);return}if(p){T("\u26A0 Every field needs your own words \u2014 this layout re-arranges your copy, it doesn\u2019t write any.",!1);return}T("Saving\u2026");let H=u,{[bt]:S}=H,C=po(H,[uo(bt)]),w=await vi(e,`/v1/editor/arrangements/${encodeURIComponent(o.id)}/instantiate`,{fields:C});if(w.r!=="ok"||!((G=w.data)!=null&&G.blocks)){w.r==="expired"?be(w.outcome,""):T(`\u26A0 ${(ge=(N=w.data)==null?void 0:N.reason)!=null?ge:"Couldn\u2019t build the arrangement \u2014 check the fields."}`,!1);return}let v=Ce("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.")},Ce("arrange",i,a))};ne.onclick=async()=>{var f,h;if(!t||!oe)return;let o=oe,i=t;if(ae(),T("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){T("\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){T("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}T("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,T("Activating\u2026");let o=await ce(e,`/v1/editor/goals/${encodeURIComponent(at)}/publish`,{});ue.disabled=!1,o.r==="ok"?(c("published",{kind:"goal"}),T("\u2713 Tracking is live \u2014 it counts from your next visitor.",!0),ue.style.display="none",at=null,Ke.textContent=""):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to activate. Your saved goal is safe.",!1):T(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"},Tt=async(o,i,a)=>{T("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));Tt(o,{event:"click",locator:oe},Re(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";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 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);Tt(`read-${a}pct`,{event:"scroll_depth",threshold:i.value},`read ${a}%`),ae()})};let Gt=null,mr=o=>{Gt=o,q.style.display="block"};q.onclick=async()=>{if(!Gt)return;q.disabled=!0,T("Turning on\u2026");let o=await ce(e,`/v1/editor/funnels/${encodeURIComponent(Gt)}/publish`,{});q.disabled=!1,o.r==="ok"?(c("published",{kind:"funnel"}),T("\u2713 Funnel is on \u2014 the drop-off view fills in as visitors move through it.",!0),q.style.display="none",Gt=null):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to turn the funnel on. Your draft is safe.",!1):T("\u26A0 Couldn\u2019t turn the funnel on \u2014 try again.",!1)},I.onclick=async()=>{var w;T("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){T("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}T("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",Pt);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[A,P]of h){let H=a.indexOf(A),G=(b=(v=i.find(N=>N.goal_id===A))==null?void 0:v.display_name)!=null?b:A;P.textContent=H===-1?G:`${H+1}. ${G}`,P.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"),C=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");C.onclick=ae,S.onclick=async()=>{let v=qo(u.value,a);if(!v.ok){T(`\u26A0 ${v.error}`,!1);return}T("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,C)},R.onclick=async()=>{var p,S;let o=Ge;if(!o)return;T("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){T("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(C=>[C.goal_id,C.display_name]));yt([{key:"funnel",label:"Funnel",type:"select",options:a.map(C=>Xt(C))},{key:"step",label:"Which step does this element serve?",type:"select",options:Zt(a[0],u).map(C=>C.label)}],"Attach",async C=>{var A;let w=(A=a.find(P=>Xt(P)===C.funnel))!=null?A:a[0],v=Zt(w,u).findIndex(P=>P.label===C.step);if(v<0){T("\u26A0 Pick which step this element serves.",!1);return}T("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 C=(w=a.find(v=>Xt(v)===f.value))!=null?w:a[0];h.length=1;for(let v of Zt(C,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 A;let{style:S,errors:C}=Rn(h),w=!1;for(let P of Mn)p(P,(A=C[P])!=null?A:null),C[P]&&(w=!0);if(w){T("\u26A0 Fix the highlighted field(s).",!1);return}if(Object.keys(S).length===0){T("\u26A0 Enter at least one style change.",!1);return}let v=Ce("style",o,t);T("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,Re(t),"b")),be(b,"\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:h}=Rn(l);i.style.cssText=a;for(let[p,S]of Object.entries(h)){let C=It[p];C&&ct(S)&&i.style.setProperty(C,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)=>Nn(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 C of f){let w=d("button",{width:"22px",height:"22px",borderRadius:"6px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.35)",background:C,padding:"0"});w.title=C,w.onclick=()=>{p.value=Bn(C),p.dispatchEvent(new Event("input"))},S.append(w)}p.after(S)}};let We=[],Ct=new Map,un=!1,fe=null,te=null,Lt=null,hr=()=>{Ct.clear();let o=[],i=(a,l,u)=>{var p;if(o.length>=16||[...Ct.values()].some(S=>S.node===a))return;let f=a===t,h=f?"selected":`e${o.length}`;Ct.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:Rt(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: ${Re(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=It[f];p&&typeof h=="string"&&ct(h)&&o.style.setProperty(p,h.trim(),"important")}}},yr=async o=>{var A,P;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(H=>typeof H.ops.text=="string"),f=Ce(u?"text":"style",l,a),h=Ln(location.pathname,an[f])[0];T("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=a.textContent)!=null?A:"").trim()}:{}},...o.versions]}});if(be(p,"\u2713 Draft saved and previewing \u2014 nothing is live until you publish."),p.r!=="ok")return(P=Z.textContent)!=null?P:"\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 C=qe("assistant");C.textContent="",C.append(d("div",{fontWeight:"600",marginBottom:"6px"},`Draft: ${o.label}`));let w=d("div",{display:"flex",gap:"5px",flexWrap:"wrap"}),v=[],b=(H,G)=>{for(let N of v)N.style.background="#374151";H.style.background="#6366f1",io(S,G),ht=f};for(let[H,G]of[["Original",null],...o.versions.map(N=>[N.displayName,N.ops])]){let N=Le("#374151",H);N.onclick=()=>b(N,G),v.push(N),w.append(N)}return v[1].style.background="#6366f1",C.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,C,w;let i=null,a,l;if(o.event==="click"||o.event==="form_submit"){let v=o.ref?Ct.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 A=Xe(b,document);if(!ut(A,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(A)),l={event:"form_submit",locator:A}}}else if(o.event==="url_reached"){let v=(p=o.urlPattern)!=null?p:Rt(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:(C=o.threshold)!=null?C:.75};return(await Tt(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,C,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 A,P;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+=`
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 Rn(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 Rn(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 Rn(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:Rn(r.status,s)}}catch(r){return{r:"error",data:null,outcome:{r:"error"}}}}var $n=[];function Nn(e){return/^#[0-9a-fA-F]{6}$/.test(e)}function Bn(e){let t=e.trim();if(Nn(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,Mn=[];function tr(e){Mn=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 On=["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,Ti=/^(rgb|rgba|hsl|hsla)\(/i;function Ci(e){return Ei.test(e)||Ti.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 Ci(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 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=rr(r,c);if(m){n[r]=m;continue}t[r]=c}return{style:t,errors:n}}var Rt={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 I=d("div",{display:"flex",alignItems:"center",gap:"8px",fontWeight:"700",fontSize:"14px",marginBottom:"6px"});I.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),T("Selection paused \u2014 browse normally, then resume.")):T("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"),O=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"),V=d("button",F("#10b981"),"Turn the funnel on"),B=d("button",F("#374151"),"Move up"),q=d("button",F("#374151"),"Move down"),Se=d("button",F("#6366f1"),"Save this arrangement"),ze=d("button",F("#374151"),"Undo"),_e=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[G,X,ne,Q,B,q])o.disabled=!0;let je=[G,X,ne,Q,O,B,q];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",V.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,q,Se,ze),ve.get("goals").append(Q,O,re,ie),ve.get("funnels").append(A,P,V);let xe=d("div",{});ve.get("drafts").append(xe);let Nt=()=>{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()},Ie=(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=Ie("#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,C,w,v,b,L,R,H,U,N,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 _=Ie("#374151","Retry");_.onclick=()=>{tt()},xe.append(_)}return}let u=o.filter(_=>{var j,se,Le,Re,qe,Lt;return((Le=(se=(j=_.draft_config)==null?void 0:j.arms)==null?void 0:se.length)!=null?Le:0)>0||((Lt=(qe=(Re=_.published_config)==null?void 0:Re.arms)==null?void 0:qe.length)!=null?Lt: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 h=_=>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((S=_.display_name)!=null?S:_.slot_id);j.append(h(_.status==="published"));let se=(b=(v=(C=_.draft_config)==null?void 0:C.arms)!=null?v:(w=_.published_config)==null?void 0:w.arms)!=null?b:[],Le=(H=(L=se[1])==null?void 0:L.id)!=null?H:(R=se[0])==null?void 0:R.id,Re=Ie("#374151","Preview");if(Re.onclick=()=>zn(_.slot_id,Le),j.append(Re),_.status!=="published"&&((ge=(N=(U=_.draft_config)==null?void 0:U.arms)==null?void 0:N.length)!=null?ge:0)>0){let qe=Ie("#10b981","Publish");qe.onclick=async()=>{qe.disabled=!0;let Lt=await ce(e,`/v1/editor/slots/${encodeURIComponent(_.slot_id)}/publish`,{});qe.disabled=!1,be(Lt,"\u2713 Published \u2014 live for new visitors."),Lt.r==="ok"&&(c("published",{kind:"slot"}),tt())},j.append(qe)}_.status!=="published"&&j.append(Dt(`/v1/editor/slots/${encodeURIComponent(_.slot_id)}`,"\u{1F5D1} Draft discarded \u2014 nothing changed for your visitors.",()=>{Yn(_.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(h(_.status==="active")),_.status==="draft"){let se=Ie("#10b981","Start tracking");se.onclick=async()=>{se.disabled=!0;let Le=await ce(e,`/v1/editor/goals/${encodeURIComponent(_.goal_id)}/publish`,{});se.disabled=!1,be(Le,"\u2713 Tracking is live \u2014 it counts from your next visitor."),Le.r==="ok"&&(c("published",{kind:"goal"}),tt())},j.append(se,Dt(`/v1/editor/goals/${encodeURIComponent(_.goal_id)}`,"\u{1F5D1} Draft goal discarded \u2014 it never tracked anything.",()=>{Jn(_.goal_id),tt()}))}xe.append(j)}}},ar=o=>{Y!==o&&(ae(),kt(),Y=o,Nt())},Kn=d("div",{display:"flex",alignItems:"center",gap:"6px",marginBottom:"10px"});Object.assign(I.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(Li(26)),Be.title="Open the SentientUI editor",Be.setAttribute("aria-label","Open the SentientUI editor");let Gn=Ln("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(I,z,Gn,_e);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 Me=null,zt=()=>{Me==null||Me(),Me=null},Vn=()=>{Me=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 C;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 L=d("select",Rt);L.setAttribute("data-field",w.key);let R=document.createElement("option");R.value="",R.textContent="\u2014 no change \u2014",L.append(R);for(let H of(C=w.options)!=null?C:[]){let U=document.createElement("option");U.value=H,U.textContent=H,L.append(U)}u[w.key]=()=>L.value,W.append(L)}else if(w.type==="color"){let L=d("input",le(K({},Rt),{padding:"2px",height:"34px"}));L.type="color",L.setAttribute("data-field",w.key);let R=!1;L.addEventListener("input",()=>{R=!0}),u[w.key]=()=>R?L.value:"",W.append(L)}else{let L=d("input",Rt);L.setAttribute("data-field",w.key),w.value!==void 0&&(L.value=w.value),u[w.key]=()=>L.value,W.append(L)}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=qn(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 qn=o=>{let i=Pt(location.pathname),a=d("div",{}),l=d("select",Rt);l.setAttribute("data-field","page");for(let u of In(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,T=(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"?T(i,!0):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to save this. Your earlier changes are safe.",!1):T(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=Ie("#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,T("Publishing\u2026");let o=await ce(e,`/v1/editor/slots/${encodeURIComponent(Ue)}/publish`,{});ye.disabled=!1,o.r==="ok"?(c("published",{kind:"slot"}),T("\u2713 Published \u2014 live for new visitors.",!0),ye.style.display="none",Ue=null,Ke.textContent=""):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to publish. Your saved draft is safe.",!1):T(sn(o,"publish"),!1)};let oe=null,Oe=!1,ot=null,rt=null,Ee=null,Ge=null,wt=null,Kt=null,Fe=!1,Xn=(o,i)=>Oe?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=!Oe||!Ee,q.disabled=!Oe||!Ge,B.title=B.disabled?Xn(Ee,"above"):"",q.title=q.disabled?Xn(Ge,"below"):""},Te=null,ln=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",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);Oe=i,g(),J.style.display="block",J.textContent=`Selected: ${Pe(o)}`,dr(o),c("element_selected",{unique:i}),T(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");O.style.display=l?"block":"none",O.disabled=!l;let u=en(o,document);ot=u.prevEl,rt=u.nextEl,Ee=u.prevLocator,Ge=u.nextLocator,Zn(),Nt()},eo=()=>{kt(),ae(),t=null,oe=null,Oe=!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",T(""),Nt()},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,T("Press Esc again to close the editor.");return}it=!1,(u=_e.onclick)==null||u.call(_e,new MouseEvent("click"));return}if(it=!1,!(a||E)){if(o.key==="ArrowUp"||o.key==="ArrowDown"){if(!t||(o.key==="ArrowUp"?B:q).disabled)return;o.preventDefault(),fn(o.key==="ArrowUp"?"up":"down");return}if(o.key==="Tab"){let f=[];for(let p of Mn){let S=we(p.locator,document);S&&!f.includes(S)&&f.push(S)}if(f.length===0)return;if(nt){T("\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,T("\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){T("\u26A0 Enter alternative wording to test.",!1);return}if(S===p.current.trim()){T("\u26A0 Enter different wording \u2014 the alternative matches the current text.",!1);return}let C=Ce("text",o,t);T("Saving\u2026");let w=await ce(e,`/v1/editor/slots/${encodeURIComponent(C)}`,{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"}),Vn(),ae(),xt(C,Pe(t),"b")),be(w,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Ce("text",o,t));let a=t,l=xn(a);Me=()=>{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 C="",w=p.getAttribute("href");if(w)try{let v=new URL(w,window.location.href);v.protocol==="https:"&&(C=v.href)}catch(v){}u.push({label:S,href:C})}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,C,w,v,b,L,R,H,U,N,ge,me,_,j,se;let a=Le=>{var Re;return i.paragraphs.length>=3&&(Re=i.paragraphs[i.paragraphs.length-3+Le])!=null?Re:""};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=(C=i.links[1])==null?void 0:C.label)!=null?w:"";case"secondary_href":return(b=(v=i.links[1])==null?void 0:v.href)!=null?b:"";case"quote":case"q1":return(L=i.quotes[0])!=null?L:"";case"q2":return(R=i.quotes[1])!=null?R:"";case"q3":return(H=i.quotes[2])!=null?H:"";case"name":case"n1":return(U=i.attributions[0])!=null?U:"";case"n2":return(N=i.attributions[1])!=null?N:"";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""}},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 L,R,U,N,ge;let h=!1,p=!1;for(let me of o.fields){if(me.kind==="href"){let j=!1;try{j=new URL((L=u[me.id])!=null?L:"").protocol==="https:"}catch(se){}f(me.id,j?null:"Links need to start with https://"),j||(h=!0);continue}let _=((R=u[me.id])!=null?R:"").trim()==="";f(me.id,_?"Fill this in with your own words":null),_&&(p=!0)}if(h){T("\u26A0 Fix the highlighted link(s).",!1);return}if(p){T("\u26A0 Every field needs your own words \u2014 this layout re-arranges your copy, it doesn\u2019t write any.",!1);return}T("Saving\u2026");let H=u,{[bt]:S}=H,C=po(H,[uo(bt)]),w=await vi(e,`/v1/editor/arrangements/${encodeURIComponent(o.id)}/instantiate`,{fields:C});if(w.r!=="ok"||!((U=w.data)!=null&&U.blocks)){w.r==="expired"?be(w.outcome,""):T(`\u26A0 ${(ge=(N=w.data)==null?void 0:N.reason)!=null?ge:"Couldn\u2019t build the arrangement \u2014 check the fields."}`,!1);return}let v=Ce("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.")},Ce("arrange",i,a))};ne.onclick=async()=>{var f,h;if(!t||!oe)return;let o=oe,i=t;if(ae(),T("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){T("\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){T("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}T("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,T("Activating\u2026");let o=await ce(e,`/v1/editor/goals/${encodeURIComponent(at)}/publish`,{});ue.disabled=!1,o.r==="ok"?(c("published",{kind:"goal"}),T("\u2713 Tracking is live \u2014 it counts from your next visitor.",!0),ue.style.display="none",at=null,Ke.textContent=""):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to activate. Your saved goal is safe.",!1):T(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"},Tt=async(o,i,a)=>{T("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));Tt(o,{event:"click",locator:oe},Pe(t))},O.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 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);Tt(`read-${a}pct`,{event:"scroll_depth",threshold:i.value},`read ${a}%`),ae()})};let Ut=null,mr=o=>{Ut=o,V.style.display="block"};V.onclick=async()=>{if(!Ut)return;V.disabled=!0,T("Turning on\u2026");let o=await ce(e,`/v1/editor/funnels/${encodeURIComponent(Ut)}/publish`,{});V.disabled=!1,o.r==="ok"?(c("published",{kind:"funnel"}),T("\u2713 Funnel is on \u2014 the drop-off view fills in as visitors move through it.",!0),V.style.display="none",Ut=null):o.r==="expired"?T("Editor session expired \u2014 reopen it from your dashboard to turn the funnel on. Your draft is safe.",!1):T("\u26A0 Couldn\u2019t turn the funnel on \u2014 try again.",!1)},A.onclick=async()=>{var w;T("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){T("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}T("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",Rt);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[L,R]of h){let H=a.indexOf(L),U=(b=(v=i.find(N=>N.goal_id===L))==null?void 0:v.display_name)!=null?b:L;R.textContent=H===-1?U:`${H+1}. ${U}`,R.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"),C=d("button",le(K({},F("transparent")),{opacity:"0.6"}),"Cancel");C.onclick=ae,S.onclick=async()=>{let v=Vo(u.value,a);if(!v.ok){T(`\u26A0 ${v.error}`,!1);return}T("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,C)},P.onclick=async()=>{var p,S;let o=Ue;if(!o)return;T("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){T("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(C=>[C.goal_id,C.display_name]));yt([{key:"funnel",label:"Funnel",type:"select",options:a.map(C=>Xt(C))},{key:"step",label:"Which step does this element serve?",type:"select",options:Zt(a[0],u).map(C=>C.label)}],"Attach",async C=>{var L;let w=(L=a.find(R=>Xt(R)===C.funnel))!=null?L:a[0],v=Zt(w,u).findIndex(R=>R.label===C.step);if(v<0){T("\u26A0 Pick which step this element serves.",!1);return}T("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 C=(w=a.find(v=>Xt(v)===f.value))!=null?w:a[0];h.length=1;for(let v of Zt(C,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 L;let{style:S,errors:C}=Pn(h),w=!1;for(let R of On)p(R,(L=C[R])!=null?L:null),C[R]&&(w=!0);if(w){T("\u26A0 Fix the highlighted field(s).",!1);return}if(Object.keys(S).length===0){T("\u26A0 Enter at least one style change.",!1);return}let v=Ce("style",o,t);T("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"}),Vn(),ae(),xt(v,Pe(t),"b")),be(b,"\u2713 Saved as a draft. Click \u201CPublish\u201D below to go live.")},Ce("style",o,t));let i=t,a=i.style.cssText;Me=()=>{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 C=At[p];C&&ct(S)&&i.style.setProperty(C,S.trim(),"important")}};for(let h of On){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)=>Nn(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 C of f){let w=d("button",{width:"22px",height:"22px",borderRadius:"6px",cursor:"pointer",border:"1px solid rgba(255,255,255,0.35)",background:C,padding:"0"});w.title=C,w.onclick=()=>{p.value=Bn(C),p.dispatchEvent(new Event("input"))},S.append(w)}p.after(S)}};let We=[],Ct=new Map,un=!1,fe=null,te=null,It=null,hr=()=>{Ct.clear();let o=[],i=(a,l,u)=>{var p;if(o.length>=16||[...Ct.values()].some(S=>S.node===a))return;let f=a===t,h=f?"selected":`e${o.length}`;Ct.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&&Oe&&i(t,oe);for(let a of Mn){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}},Ve=(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=()=>{It&&(It.textContent=t?Oe?`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(Me=()=>{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 L,R;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(H=>typeof H.ops.text=="string"),f=Ce(u?"text":"style",l,a),h=In(location.pathname,an[f])[0];T("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:((L=a.textContent)!=null?L:"").trim()}:{}},...o.versions]}});if(be(p,"\u2713 Draft saved and previewing \u2014 nothing is live until you publish."),p.r!=="ok")return(R=Z.textContent)!=null?R:"\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 C=Ve("assistant");C.textContent="",C.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 N of v)N.style.background="#374151";H.style.background="#6366f1",io(S,U),ht=f};for(let[H,U]of[["Original",null],...o.versions.map(N=>[N.displayName,N.ops])]){let N=Ie("#374151",H);N.onclick=()=>b(N,U),v.push(N),w.append(N)}return v[1].style.background="#6366f1",C.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,C,w;let i=null,a,l;if(o.event==="click"||o.event==="form_submit"){let v=o.ref?Ct.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 L=Xe(b,document);if(!ut(L,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)),l={event:"form_submit",locator:L}}}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:(C=o.threshold)!=null?C:.75};return(await Tt(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,C,w;let i=o.trim();if(!i||un)return;un=!0,te&&(te.value="",te.disabled=!0),Ve("user",i),We.push({role:"user",content:i.slice(0,4e3)}),c("form_opened",{kind:"chat"});let a=Ve("assistant","\u2026"),l="",u=!1,f=[],h=[],p=v=>{var L,R;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+=b.text,a.textContent=l,fe&&(fe.scrollTop=fe.scrollHeight);else if(b.type==="tool_status")u=!0,b.state==="running"&&!l&&(a.textContent=(A=b.name)!=null&&A.startsWith("create_")?"Creating a draft\u2026":"Thinking\u2026");else if(b.type==="choice_prompt"&&b.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=(L=b.name)!=null&&L.startsWith("create_")?"Creating a draft\u2026":"Thinking\u2026");else if(b.type==="choice_prompt"&&b.question){l+=(l?`
27
27
 
28
- `:"")+b.question,a.textContent=l;let H=d("div",{display:"flex",gap:"5px",flexWrap:"wrap",marginTop:"6px"});for(let G of(P=b.options)!=null?P:[]){let N=Le("#374151",G.label);N.onclick=()=>{ao(G.label)},H.append(N)}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(G=>{f.push(G),G.startsWith("\u26A0")&&qe("note",G)}))}};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 N=(C=await b.json().catch(()=>null))==null?void 0:C.error;a.textContent=b.status===401?"Editor session expired \u2014 reopen it from your dashboard. Your drafts are safe.":N==="rate_limit"?"You\u2019ve used today\u2019s AI allowance \u2014 more tomorrow, or upgrade for a bigger daily budget.":N==="plan_required"?"AI chat isn\u2019t included in this plan.":N==="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 A=(w=b.body)==null?void 0:w.getReader(),P="",H=()=>{let N;for(;(N=P.indexOf(`
28
+ `:"")+b.question,a.textContent=l;let H=d("div",{display:"flex",gap:"5px",flexWrap:"wrap",marginTop:"6px"});for(let U of(R=b.options)!=null?R:[]){let N=Ie("#374151",U.label);N.onclick=()=>{ao(U.label)},H.append(N)}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")&&Ve("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 N=(C=await b.json().catch(()=>null))==null?void 0:C.error;a.textContent=b.status===401?"Editor session expired \u2014 reopen it from your dashboard. Your drafts are safe.":N==="rate_limit"?"You\u2019ve used today\u2019s AI allowance \u2014 more tomorrow, or upgrade for a bigger daily budget.":N==="plan_required"?"AI chat isn\u2019t included in this plan.":N==="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 L=(w=b.body)==null?void 0:w.getReader(),R="",H=()=>{let N;for(;(N=R.indexOf(`
29
29
 
30
- `))>=0;){for(let ge of P.slice(0,N).split(`
31
- `))ge.startsWith("data: ")&&p(ge.slice(6));P=P.slice(N+2)}};if(A){let N=new TextDecoder;for(;;){let{done:ge,value:me}=await A.read();if(ge)break;P+=N.decode(me,{stream:!0}),H()}}else P=await b.text();P+=`
30
+ `))>=0;){for(let ge of R.slice(0,N).split(`
31
+ `))ge.startsWith("data: ")&&p(ge.slice(6));R=R.slice(N+2)}};if(L){let N=new TextDecoder;for(;;){let{done:ge,value:me}=await L.read();if(ge)break;R+=N.decode(me,{stream:!0}),H()}}else R=await b.text();R+=`
32
32
 
33
- `,H(),await Promise.all(h),l||(a.textContent=f.some(N=>N.startsWith("["))?"Done \u2014 have a look at the page.":"No reply \u2014 try rephrasing.");for(let N of f)N.startsWith("\u26A0 The assistant")&&qe("note",N);let G=[l,...f.filter(N=>N.startsWith("["))].filter(Boolean).join(`
34
- `);We.push({role:"assistant",content:(G||"(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=An("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,Ue=a.nextLocator;try{t.scrollIntoView({block:"nearest",behavior:"smooth"})}catch(l){}g(),ln(!0),T("Previewing the new position \u2014 keep moving, save, or undo.")};B.onclick=()=>fn("up"),V.onclick=()=>fn("down"),ze.onclick=()=>{kt(),T("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:Ue;if(!i){T("\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);T("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,Kt=null,ln(!1),xt(a,Re(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(_n))==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;_e.onclick=()=>{if((nt||Fe)&&!gn){gn=!0,T("\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),Nt(),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 Ai(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 An(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 _i(e,t){var y,$,L,D,E,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(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=(U=(Z=m.find(M=>M.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 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 Ii(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(No(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),Co(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 _i(e,n);return}let r=new URLSearchParams(location.search).get("sentient_preview_cell");if(r){document.getElementById(nn)||await Ii(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=Uo(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 _r(Bi);})();
33
+ `,H(),await Promise.all(h),l||(a.textContent=f.some(N=>N.startsWith("["))?"Done \u2014 have a look at the page.":"No reply \u2014 try rephrasing.");for(let N of f)N.startsWith("\u26A0 The assistant")&&Ve("note",N);let U=[l,...f.filter(N=>N.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=Ln("close","Close AI chat");if(a.onclick=()=>{Ht.textContent="",fe=null,te=null,It=null},i.append(d("div",{fontWeight:"600",flex:"1 1 auto"},"\u2728 AI"),a),It=d("div",{fontSize:"11px",opacity:"0.7",marginBottom:"4px"}),pn(),fe=d("div",{maxHeight:"260px",overflowY:"auto",overscrollBehavior:"contain"}),We.length===0)Ve("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)Ve(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=Ie("#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,It,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),T("Previewing the new position \u2014 keep moving, save, or undo.")};B.onclick=()=>fn("up"),q.onclick=()=>fn("down"),ze.onclick=()=>{kt(),T("Move undone \u2014 back to the original position.")},Se.onclick=async()=>{if(!t||!oe||!Fe||!Oe)return;let o=Ee?"moveAfter":"moveBefore",i=Ee!=null?Ee:Ge;if(!i){T("\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);T("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,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(_n))==null||o.remove(),m.remove(),x.remove(),y.remove(),Be.remove(),window.__sentientEditor=null,(i=document.querySelector("meta[data-sentient-editor]"))==null||i.remove(),Ot()},gn=!1;_e.onclick=()=>{if((nt||Fe)&&!gn){gn=!0,T("\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),Nt(),c("editor_opened")}var Ii="http://www.w3.org/2000/svg";function Qe(e,t){let n=document.createElementNS(Ii,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 nn="sentient-preview-bar";async function _i(e,t){var y,$,I,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(O){}let n=null;try{let O=await fetch(`${e.apiBase}/v1/editor/slots`,{headers:{authorization:`Bearer ${e.token}`}});O.ok&&(n=($=((y=(await O.json()).slots)!=null?y:[]).find(ie=>ie.slot_id===t&&ie.kind==="arms"))!=null?$:null)}catch(O){}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=()=>{Ot();let O=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])O.searchParams.delete(re);location.assign(O.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 O=new URL(location.href);for(let re of["sentient_preview","sentient_arm"])O.searchParams.delete(re);location.assign(O.toString())};let m=(z=(E=(I=n==null?void 0:n.draft_config)==null?void 0:I.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(O=>O.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(O){}for(let O of m){let re=d("button",{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.3)",cursor:"pointer",background:O.id===g.id?"#6366f1":"transparent",color:"#fff",font:"12px system-ui, sans-serif"},(ne=O.displayName)!=null?ne:O.id);re.onclick=()=>{let ie=new URL(location.href);ie.searchParams.set("sentient_arm",O.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,$,I,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=()=>{Ot();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(No(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),Co(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 ${(I=g.personaDisplay)!=null?I: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=Oo(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?qo:Yo);return}}let t=await yi(e);if(!t.ok){t.unauthorized?(Ot(),Qt(qo)):Qt(Yo);return}let n=new URLSearchParams(location.search).get("sentient_preview");if(n){document.getElementById(nn)||await _i(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 _r(Bi);})();
@@ -1 +1 @@
1
- "use strict";var __sentientEngagement=(()=>{var q=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)q(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&&q(e,r,{get:()=>t[r],enumerable:!(l=ge(t,r))||l.enumerable});return e};var we=e=>be(q({},"__esModule",{value:!0}),e);var xe,_e,Ie,X,Ae,Ee,ee,O,te,Y=ve(()=>{"use strict";xe=Object.defineProperty,_e=Object.defineProperties,Ie=Object.getOwnPropertyDescriptors,X=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,ee=(e,t,n)=>t in e?xe(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))Ee.call(t,n)&&ee(e,n,t[n]);return e},te=(e,t)=>_e(e,Ie(t))});var ze={};ye(ze,{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"],Ce={banner:"hero",navigation:"navigation",contentinfo:"footer"};function $e(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 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=$e(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],Te=250,Pe=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 Re(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 Ke(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,P=0,N=0,h=0,z=-1/0,R=-1/0,k=null,L=null,K=null,D=(l=r==null?void 0:r.scrollY)!=null?l:0,G=0,v=e.hidden?null:t(),M=()=>{let o=t();if(K!=null){let g=o-K,x=0;for(;x<ue.length&&g>=ue[x];)x++;u[x]++}K=o},T=()=>{d++,z=t()},E=()=>{y++,R=t()},j=()=>{k=t()},C=()=>{k!=null&&(ce(c,t()-k),k=null)},F=()=>{let o=t();S++,o-z>Te&&o-R>Pe&&m++,M()},$=()=>{b++},w=()=>{var o;let g=(o=r==null?void 0:r.scrollY)!=null?o:0;I+=Math.abs(g-D),D=g,M()},W=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()},U=o=>{let g=o.data;typeof g=="string"&&(P+=g.length),M()},s=()=>{let o=t();e.hidden?v!=null&&(G+=o-v,v=null):v==null&&(v=o)},a={passive:!0,capture:!0};e.addEventListener("mousemove",T,a),e.addEventListener("touchstart",E,a),e.addEventListener("touchmove",$,a),e.addEventListener("mousedown",j,a),e.addEventListener("mouseup",C,a),e.addEventListener("click",F,a),e.addEventListener("wheel",$,a),e.addEventListener("keydown",W,a),e.addEventListener("input",U,a),e.addEventListener("visibilitychange",s),r==null||r.addEventListener("scroll",w,a);let f=Re(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 x=t(),_=G+(v!=null?x-v:0);return{v:1,active_ms:Math.round(_),mm:d,mm_rate:_>0?Number((d*1e3/_).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:P,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",T,a),e.removeEventListener("touchstart",E,a),e.removeEventListener("touchmove",$,a),e.removeEventListener("mousedown",j,a),e.removeEventListener("mouseup",C,a),e.removeEventListener("click",F,a),e.removeEventListener("wheel",$,a),e.removeEventListener("keydown",W,a),e.removeEventListener("input",U,a),e.removeEventListener("visibilitychange",s),r==null||r.removeEventListener("scroll",w,a)}}}var De="section, header, footer, nav, main > div, [data-sentient-section]",je=2e4,Fe="__session__";function Ue(e){let t=Array.from(e.querySelectorAll(De)),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,P,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 z=((l=t.apiBase)!=null?l:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),R=Ue(h);if(R.length===0)return fe;let k=new Map,L=[];for(let s of R){let a=(i=[(c=t.sectionTypes)==null?void 0:c[(r=s.getAttribute("data-sentient-id"))!=null?r:""],s.getAttribute("data-sentient-type")].find(_=>re.includes(_)))!=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 x=H.filter(([,_])=>_.test(f.bodyText)).map(([_])=>_);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}:{}),x.length>0?{patternFlags:x}:{})}))}let K=(P=(A=(I=(b=h.defaultView)!=null?b:typeof window!="undefined"?window:void 0)==null?void 0:I.location)==null?void 0:A.pathname)!=null?P:"/";Be(t.apiKey,z,K,L);let D=Ke(h),G=()=>{let s;try{s=D.snapshot()}catch(a){return}try{e.track({projectId:t.apiKey,componentId:Fe,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},T=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())T.observe(s);let E=(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(G(),s)try{(a=e.flush)==null||a.call(e)}catch(p){}},j=()=>{if(h.hidden)E(!0);else{let s=Date.now();for(let a of v.values())a.intersecting&&(a.enterAt=s)}},C=!1,F=s=>{if(E(!0),s!=null&&s.persisted){C=!0;return}try{T.disconnect()}catch(a){}},$=s=>{if(!(s!=null&&s.persisted)||!C)return;C=!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",F),w==null||w.addEventListener("pageshow",$);let W=setInterval(()=>{if(h.hidden||C)return;E();let s=Date.now();for(let a of v.values())a.intersecting&&(a.enterAt=s)},je),U=[];return t.microSignals&&[...k.entries()].forEach(([s,a],f)=>{U.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}))}),()=>{E(!0),clearInterval(W),D.stop(),h.removeEventListener("visibilitychange",j),w==null||w.removeEventListener("pagehide",F),w==null||w.removeEventListener("pageshow",$);for(let s of U)s();try{T.disconnect()}catch(s){}}}return we(ze);})();
1
+ "use strict";var __sentientEngagement=(()=>{var z=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)z(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&&z(e,r,{get:()=>t[r],enumerable:!(l=ge(t,r))||l.enumerable});return e};var we=e=>be(z({},"__esModule",{value:!0}),e);var _e,xe,Ie,X,Ae,$e,ee,O,te,H=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 Ve={};ye(Ve,{startEngagementCapture:()=>pe});var Se=["data-sentient-id","data-testid","data-test","data-id","data-name","data-cy"];function G(e){var t;return((t=e.textContent)!=null?t:"").replace(/\s+/g," ").trim()}function ke(e){return{tag:e.tagName.toLowerCase(),text:G(e).slice(0,40)}}function J(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 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(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 b=`${u} > ${m}`;if(F(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&&G(m)!==G(e));if(y>=0&&S){let m=`${u} > ${l}:nth-of-type(${y+1})`;if(F(t,m))return m}}}return null}function Q(e,t){let n=ke(e),l=e.getAttribute("id");if(l&&F(t,`#${J(l)}`))return{v:1,id:l,fingerprint:n};for(let c of Se){let i=e.getAttribute(c);if(i&&F(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}H();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]],Y=[["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 Y)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")}H();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 Re(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 Ke(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,V=-1/0,R=-1/0,k=null,L=null,K=null,D=(l=r==null?void 0:r.scrollY)!=null?l:0,W=0,v=e.hidden?null:t(),M=()=>{let o=t();if(K!=null){let g=o-K,_=0;for(;_<ue.length&&g>=ue[_];)_++;u[_]++}K=o},P=()=>{d++,V=t()},$=()=>{y++,R=t()},j=()=>{k=t()},E=()=>{k!=null&&(ce(c,t()-k),k=null)},U=()=>{let o=t();S++,o-V>Pe&&o-R>Te&&m++,M()},C=()=>{b++},w=()=>{var o;let g=(o=r==null?void 0:r.scrollY)!=null?o:0;I+=Math.abs(g-D),D=g,M()},q=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()},B=o=>{let g=o.data;typeof g=="string"&&(T+=g.length),M()},s=()=>{let o=t();e.hidden?v!=null&&(W+=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",q,a),e.addEventListener("input",B,a),e.addEventListener("visibilitychange",s),r==null||r.addEventListener("scroll",w,a);let f=Re(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=W+(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",q,a),e.removeEventListener("input",B,a),e.removeEventListener("visibilitychange",s),r==null||r.removeEventListener("scroll",w,a)}}}var De="section, header, footer, nav, main > div, [data-sentient-section]",je=2e4,Ue="__session__";function Be(e){let t=Array.from(e.querySelectorAll(De)),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 Fe(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 V=((l=t.apiBase)!=null?l:"https://api.sentient-ui.com").replace(/\/+$/,"").replace(/\/v1$/,""),R=Be(h);if(R.length===0)return fe;let k=new Map,L=[];for(let s of R){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 _=Y.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 K=(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:"/";Fe(t.apiKey,V,K,L);let D=Ke(h),W=()=>{let s;try{s=D.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(W(),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 q=setInterval(()=>{if(h.hidden||E)return;$();let s=Date.now();for(let a of v.values())a.intersecting&&(a.enterAt=s)},je),B=[];return t.microSignals&&[...k.entries()].forEach(([s,a],f)=>{B.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(q),D.stop(),h.removeEventListener("visibilitychange",j),w==null||w.removeEventListener("pagehide",U),w==null||w.removeEventListener("pageshow",C);for(let s of B)s();try{P.disconnect()}catch(s){}}}return we(Ve);})();
@@ -1 +1 @@
1
- "use strict";var __sentientPreview=(()=>{var f=Object.defineProperty,F=Object.defineProperties,U=Object.getOwnPropertyDescriptor,j=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,I=Object.getOwnPropertySymbols;var C=Object.prototype.hasOwnProperty,z=Object.prototype.propertyIsEnumerable;var E=(e,t,n)=>t in e?f(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var n in t||(t={}))C.call(t,n)&&E(e,n,t[n]);if(I)for(var n of I(t))z.call(t,n)&&E(e,n,t[n]);return e},A=(e,t)=>F(e,j(t));var H=(e,t)=>{for(var n in t)f(e,n,{get:t[n],enumerable:!0})},W=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!C.call(e,r)&&r!==n&&f(e,r,{get:()=>t[r],enumerable:!(a=U(t,r))||a.enumerable});return e};var V=e=>W(f({},"__esModule",{value:!0}),e);var ne={};H(ne,{parseContextPreview:()=>$,parsePersonaPreview:()=>N,parsePreview:()=>R,runPreview:()=>Z});var O=["new","browsing","carted","customer","lapsed"];var oe=1800*1e3;var p="data-sentient-stage";function g(e,t){return!t||typeof e!="string"||!(e==="returning"||O.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function m(e,t=document){try{e?t.documentElement.setAttribute(p,e):t.documentElement.removeAttribute(p)}catch(n){}}var Y="__snt_editor_token";function P(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(Y):null}catch(e){return null}}function T(e){let t=null;try{let n=location.hash.slice(1),a=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(a){t=a[2];let r=n.slice(a.index+a[0].length);a[1]!="&"&&r[0]=="&"&&(r=a[1]+r.slice(1));let l=n.slice(0,a.index)+r;history.replaceState(history.state,"",l?"#"+l:location.pathname+location.search)}}catch(n){}return t}var q=5e3;function X(e,t){let n,a=new Promise(r=>{n=setTimeout(()=>r(null),t)});return Promise.race([e,a]).then(r=>(clearTimeout(n),r),r=>{throw clearTimeout(n),r})}var J={position:"fixed",bottom:"16px",zIndex:"2147483647",background:"#111827",color:"#fff",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"};async function Z(e){let t=$(window.location.search),n=R(window.location.search);if(n)return await ee(e,n,t),!0;let a=N(window.location.search);return a||t?(await te(e,a!=null?a:"",t),e.dbg("persona preview",a,t),!0):!1}function $(e){try{let t=new URLSearchParams(e).get("sentient_context");return t&&/^[a-z_]{1,40}$/.test(t)?t:null}catch(t){return null}}function R(e){let t=new URLSearchParams(e).get("sentient_preview");if(!t)return null;let n={};for(let a of t.split("|")){let r=a.indexOf(":"),l=r===-1?"":a.slice(0,r),s=r===-1?"":a.slice(r+1);if(!(!l||!s))if(s.includes("=")){let o={};for(let u of s.split(",")){let[c,i]=u.split("=");c&&i&&(o[c]=i)}Object.keys(o).length&&(n[l]=o)}else n[l]=s}return Object.keys(n).length?n:null}function N(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var M="sentient-persona-preview-banner";function L(e,t,n,a){var r;try{if(typeof document=="undefined"||document.getElementById(M))return;let l=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),s=document.createElement("div");s.id=M,s.setAttribute("role","status"),Object.assign(s.style,J,{left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"12px",padding:"10px 14px",borderRadius:"999px",font:"13px/1 system-ui, sans-serif",border:"1px solid rgba(255,255,255,0.14)"});let o=document.createElement("span"),u=n?` \xB7 ${n.replace(/_/g," ")} visitors${a?" (not served until stage serving is on)":""}`:"";o.textContent=(t?`\u201C${e}\u201D isn\u2019t in your personas \u2014 showing the default experience`:e?`Previewing as ${l}`:"Previewing")+u;let c=document.createElement("button");c.type="button",c.textContent="Exit preview",Object.assign(c.style,{cursor:"pointer",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"inherit",padding:"4px 10px",borderRadius:"999px"}),c.addEventListener("click",()=>{try{let i=new URL(window.location.href);i.searchParams.delete("sentient_persona"),i.searchParams.delete("sentient_context"),window.location.href=i.pathname+i.search+i.hash}catch(i){}}),s.appendChild(o),s.appendChild(c),((r=document.body)!=null?r:document.documentElement).appendChild(s)}catch(l){}}function Q(){var e;return(e=T("sentient_preview_token"))!=null?e:P()}function K(e,t){let n=e.cfg;return X(fetch(`${e.apiBase}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${n.apiKey}`},body:JSON.stringify(t)}).then(a=>a.ok?a.json():null).catch(()=>null),q)}async function ee(e,t,n=null){var s;let a=e.cfg,r=(s=a.registry)!=null?s:Object.keys(a.slots).length===0,l=Q();if(r){let o=await K(e,A(d(d({slotsFrom:"registry",includeDrafts:!0},l?{previewToken:l}:{}),n?{context:n}:{}),{force:Object.fromEntries(Object.entries(t).filter(u=>typeof u[1]=="string"))}));if(!(o!=null&&o.slotConfig)){e.exposeGlobal(),e.dbg("preview mode: slot config unavailable \u2014 page left as-is");return}e.set({slotConfig:o.slotConfig,look:o})}e.set({slots:t,persona:null}),e.apply(),e.installSpaHooks(),e.exposeGlobal(),e.dbg("preview mode",t)}async function te(e,t,n=null){var h,v,y,S,b,w,_,x,k;let a=e.cfg,r=(h=a.registry)!=null?h:Object.keys(a.slots).length===0,l=n?{context:n}:{},s=await K(e,d(r?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(a.slots).map(([D,B])=>({id:D,dims:B.dims}))},l));if(!s){e.exposeGlobal(),e.dbg("persona preview: explain unavailable \u2014 page left as-is");return}let o=s,u=(S=(y=(v=o.personaAttributes)==null?void 0:v.persona)!=null?y:o.persona)!=null?S:t,c=(w=(b=o.personaAttributes)==null?void 0:b.confidence)!=null?w:"high";e.set({slots:(_=o.slots)!=null?_:{},slotConfig:(x=o.slotConfig)!=null?x:null,look:o,persona:{persona:u,band:c},decided:!0}),e.apply(),e.installSpaHooks(),e.exposeGlobal(),n&&a.stageAttributes&&m(g(n,a.stageAttributes));let i=o.contextServing===!1;t&&o.recognized===!1?L(t,!0,n,i):L(t?(k=o.personaDisplay)!=null?k:u:"",!1,n,i)}return V(ne);})();
1
+ "use strict";var __sentientPreview=(()=>{var p=Object.defineProperty,U=Object.defineProperties,j=Object.getOwnPropertyDescriptor,F=Object.getOwnPropertyDescriptors,G=Object.getOwnPropertyNames,I=Object.getOwnPropertySymbols;var A=Object.prototype.hasOwnProperty,H=Object.prototype.propertyIsEnumerable;var E=(e,t,n)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,d=(e,t)=>{for(var n in t||(t={}))A.call(t,n)&&E(e,n,t[n]);if(I)for(var n of I(t))H.call(t,n)&&E(e,n,t[n]);return e},O=(e,t)=>U(e,F(t));var V=(e,t)=>{for(var n in t)p(e,n,{get:t[n],enumerable:!0})},z=(e,t,n,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of G(t))!A.call(e,r)&&r!==n&&p(e,r,{get:()=>t[r],enumerable:!(a=j(t,r))||a.enumerable});return e};var W=e=>z(p({},"__esModule",{value:!0}),e);var ne={};V(ne,{parseContextPreview:()=>$,parsePersonaPreview:()=>K,parsePreview:()=>R,runPreview:()=>Z});var C=["new","browsing","carted","customer","lapsed"];var oe=1800*1e3;var f="data-sentient-stage";function g(e,t){return!t||typeof e!="string"||!(e==="returning"||C.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function m(e,t=document){try{e?t.documentElement.setAttribute(f,e):t.documentElement.removeAttribute(f)}catch(n){}}var q="__snt_editor_token";function P(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(q):null}catch(e){return null}}function T(e){let t=null;try{let n=location.hash.slice(1),a=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(a){t=a[2];let r=n.slice(a.index+a[0].length);a[1]!="&"&&r[0]=="&"&&(r=a[1]+r.slice(1));let l=n.slice(0,a.index)+r;history.replaceState(history.state,"",l?"#"+l:location.pathname+location.search)}}catch(n){}return t}var Y=5e3;function J(e,t){let n,a=new Promise(r=>{n=setTimeout(()=>r(null),t)});return Promise.race([e,a]).then(r=>(clearTimeout(n),r),r=>{throw clearTimeout(n),r})}var X={position:"fixed",bottom:"16px",zIndex:"2147483647",background:"#111827",color:"#fff",boxShadow:"0 10px 34px rgba(0,0,0,0.45)"};async function Z(e){let t=$(window.location.search),n=R(window.location.search);if(n)return await ee(e,n,t),!0;let a=K(window.location.search);return a||t?(await te(e,a!=null?a:"",t),e.dbg("persona preview",a,t),!0):!1}function $(e){try{let t=new URLSearchParams(e).get("sentient_context");return t&&/^[a-z_]{1,40}$/.test(t)?t:null}catch(t){return null}}function R(e){let t=new URLSearchParams(e).get("sentient_preview");if(!t)return null;let n={};for(let a of t.split("|")){let r=a.indexOf(":"),l=r===-1?"":a.slice(0,r),s=r===-1?"":a.slice(r+1);if(!(!l||!s))if(s.includes("=")){let o={};for(let c of s.split(",")){let[u,i]=c.split("=");u&&i&&(o[u]=i)}Object.keys(o).length&&(n[l]=o)}else n[l]=s}return Object.keys(n).length?n:null}function K(e){try{return new URLSearchParams(e).get("sentient_persona")||null}catch(t){return null}}var M="sentient-persona-preview-banner";function L(e,t,n,a){var r;try{if(typeof document=="undefined"||document.getElementById(M))return;let l=e.charAt(0).toUpperCase()+e.slice(1).replace(/[_-]+/g," "),s=document.createElement("div");s.id=M,s.setAttribute("role","status"),Object.assign(s.style,X,{left:"50%",transform:"translateX(-50%)",display:"flex",alignItems:"center",gap:"12px",padding:"10px 14px",borderRadius:"999px",font:"13px/1 system-ui, sans-serif",border:"1px solid rgba(255,255,255,0.14)"});let o=document.createElement("span"),c=n?` \xB7 ${n.replace(/_/g," ")} visitors${a?" (not served until stage serving is on)":""}`:"";o.textContent=(t?`\u201C${e}\u201D isn\u2019t in your personas \u2014 showing the default experience`:e?`Previewing as ${l}`:"Previewing")+c;let u=document.createElement("button");u.type="button",u.textContent="Exit preview",Object.assign(u.style,{cursor:"pointer",border:"1px solid rgba(255,255,255,0.3)",background:"transparent",color:"#fff",font:"inherit",padding:"4px 10px",borderRadius:"999px"}),u.addEventListener("click",()=>{try{let i=new URL(window.location.href);i.searchParams.delete("sentient_persona"),i.searchParams.delete("sentient_context"),window.location.href=i.pathname+i.search+i.hash}catch(i){}}),s.appendChild(o),s.appendChild(u),((r=document.body)!=null?r:document.documentElement).appendChild(s)}catch(l){}}function Q(){var e;return(e=T("sentient_preview_token"))!=null?e:P()}function N(e,t){let n=e.cfg;return J(fetch(`${e.apiBase}/v1/explain`,{method:"POST",headers:{"content-type":"application/json",authorization:`Bearer ${n.apiKey}`},body:JSON.stringify(t)}).then(a=>a.ok?a.json():null).catch(()=>null),Y)}async function ee(e,t,n=null){var s;let a=e.cfg,r=(s=a.registry)!=null?s:Object.keys(a.slots).length===0,l=Q();if(r){let o=await N(e,O(d(d({slotsFrom:"registry",includeDrafts:!0},l?{previewToken:l}:{}),n?{context:n}:{}),{force:Object.fromEntries(Object.entries(t).filter(c=>typeof c[1]=="string"))}));if(!(o!=null&&o.slotConfig)){e.exposeGlobal(),e.dbg("preview mode: slot config unavailable \u2014 page left as-is");return}e.set({slotConfig:o.slotConfig,look:o})}e.set({slots:t,persona:null}),e.apply(),e.installSpaHooks(),e.exposeGlobal(),e.dbg("preview mode",t)}async function te(e,t,n=null){var h,v,y,S,b,w,_,x,k;let a=e.cfg,r=(h=a.registry)!=null?h:Object.keys(a.slots).length===0,l=n?{context:n}:{},s=await N(e,d(r?{persona:t,slotsFrom:"registry"}:{persona:t,slots:Object.entries(a.slots).map(([D,B])=>({id:D,dims:B.dims}))},l));if(!s){e.exposeGlobal(),e.dbg("persona preview: explain unavailable \u2014 page left as-is");return}let o=s,c=(S=(y=(v=o.personaAttributes)==null?void 0:v.persona)!=null?y:o.persona)!=null?S:t,u=(w=(b=o.personaAttributes)==null?void 0:b.confidence)!=null?w:"high";e.set({slots:(_=o.slots)!=null?_:{},slotConfig:(x=o.slotConfig)!=null?x:null,look:o,persona:{persona:c,band:u},decided:!0}),e.apply(),e.installSpaHooks(),e.exposeGlobal(),n&&a.stageAttributes&&m(g(n,a.stageAttributes));let i=o.contextServing===!1;t&&o.recognized===!1?L(t,!0,n,i):L(t?(k=o.personaDisplay)!=null?k:c:"",!1,n,i)}return W(ne);})();
@@ -1,2 +1,2 @@
1
- "use strict";var SentientSnippet=(()=>{var Mt=Object.defineProperty,zo=Object.defineProperties,Ho=Object.getOwnPropertyDescriptor,Vo=Object.getOwnPropertyDescriptors,qo=Object.getOwnPropertyNames,mr=Object.getOwnPropertySymbols;var hr=Object.prototype.hasOwnProperty,Jo=Object.prototype.propertyIsEnumerable;var gr=(e,t,n)=>t in e?Mt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||(t={}))hr.call(t,n)&&gr(e,n,t[n]);if(mr)for(var n of mr(t))Jo.call(t,n)&&gr(e,n,t[n]);return e},Ke=(e,t)=>zo(e,Vo(t));var yr=(e,t)=>()=>(e&&(t=e(e=0)),t);var vr=(e,t)=>{for(var n in t)Mt(e,n,{get:t[n],enumerable:!0})},Yo=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of qo(t))!hr.call(e,o)&&o!==n&&Mt(e,o,{get:()=>t[o],enumerable:!(r=Ho(t,o))||r.enumerable});return e};var Xo=e=>Yo(Mt({},"__esModule",{value:!0}),e);var ii,si,ai,kr,li,ui,Er,j,qe,An=yr(()=>{"use strict";ii=Object.defineProperty,si=Object.defineProperties,ai=Object.getOwnPropertyDescriptors,kr=Object.getOwnPropertySymbols,li=Object.prototype.hasOwnProperty,ui=Object.prototype.propertyIsEnumerable,Er=(e,t,n)=>t in e?ii(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j=(e,t)=>{for(var n in t||(t={}))li.call(t,n)&&Er(e,n,t[n]);if(kr)for(var n of kr(t))ui.call(t,n)&&Er(e,n,t[n]);return e},qe=(e,t)=>si(e,ai(t))});var Dr={};vr(Dr,{LOCAL_ENGINE_AVAILABLE:()=>pi,createLocalEngine:()=>mi});function mi(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var pi,Mr=yr(()=>{"use strict";pi=!1});var Ts={};vr(Ts,{applyPersonaAttributes:()=>rn,applyRegistrySlots:()=>an,applySlotArms:()=>sn,applySlotAttributes:()=>on,consentWatcher:()=>Xe,parseSnippetConfig:()=>Zt,planReorder:()=>un,reapply:()=>Lt,run:()=>Go,version:()=>At});function We(e){return e?`_${e.slice(0,12)}`:""}var ze="_snt_uid";function gt(e){return`${ze}${We(e)}`}var kn="__sntForgetGen",Zo=()=>{try{return window[kn]}catch(e){return}};function $t(e){var t,n;try{let r=window,o=(t=r[kn])!=null?t:r[kn]={};o[e]=((n=o[e])!=null?n:0)+1}catch(r){}}function fe(e){var t,n;return(n=(t=Zo())==null?void 0:t[e])!=null?n:0}var ot="_snt_snap:",Qo=["low","medium","high"];function it(e){try{let t=localStorage.getItem(ot+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.stage!==void 0&&typeof n.stage!="string"&&delete n.stage,n}catch(t){return null}}function Ve(e,t){try{localStorage.setItem(ot+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 xn(e,t){return new Promise(n=>{let r=setTimeout(()=>n(!1),t),o=()=>{clearTimeout(r),n(!0)};e.then(o,o)})}function He(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Bt(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 br(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 En(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 Sr(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 ei=500,ti=56*1024;function Kt(e){return`_snt_retry_${e.slice(0,12)}`}var ni={push:()=>{},flush:()=>{},destroy:()=>{}};function wr(e){var t,n,r;if(typeof window=="undefined")return ni;let o=(t=e.flushIntervalMs)!=null?t:5e3,s=(n=e.maxBatchSize)!=null?n:20,a=(r=e.maxRetrySize)!=null?r:100,l=e.ingestUrl,i=e.apiKey,c=Kt(i),u=!1,p=fe(i),h=(...A)=>{!u&&fe(i)===p&&En(...A)},S=[],w=new Set,b=[],K=A=>{for(let B of A)L.delete(B),!w.has(B)&&(w.add(B),b.push(B));for(;b.length>ei;){let B=b.shift();B&&w.delete(B)}Sr(A,c)},L=new Set,M=()=>{for(;S.length>a;){let A=S.shift();A&&L.delete(A.id)}},E=A=>{w.has(A.id)||L.has(A.id)||(L.add(A.id),S.push(A),M())},x=A=>{for(let B of A)w.has(B.id)||(L.add(B.id),S.push(B));M()},C=br(c,a);for(let A of C)E(A);let R=0,g=0,v=(A,B=!0)=>{if(A.length===0)return;let ne=JSON.stringify(A),re=A.map(Me=>Me.id),Q,me=je(15e3);try{Q=fetch(l,{method:"POST",keepalive:!0,signal:me.signal,body:ne,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})}catch(Me){h(A,a,c),x(A),g++,R=Date.now()+He(g);return}Promise.resolve(Q).then(me.clear,me.clear);let ee=Me=>{if(Bt(Me)!=="retry"){if(!Me.ok&&B){let $e=A.filter(Le=>Le.eventType!=="pageview");if($e.length>0&&$e.length<A.length){K(A.filter(Le=>Le.eventType==="pageview").map(Le=>Le.id)),v($e,!1);return}}K(re),g=0,R=0;return}h(A,a,c),x(A),g++,R=Date.now()+He(g)};Q&&typeof Q.then=="function"?Q.then(ee).catch(()=>{h(A,a,c),x(A),g++,R=Date.now()+He(g)}):ee(Q)},d=typeof TextEncoder!="undefined"?new TextEncoder:null,m=A=>d?d.encode(A).length:A.length,O=A=>{let B=[],ne=2;for(let re of A){let Q=m(JSON.stringify(re))+1;if(B.length>0&&ne+Q>ti||B.length>=s)break;B.push(re),ne+=Q}return B},$=()=>{try{if(Date.now()<R)return;for(;S.length>0&&!(Date.now()<R);){let A=S.filter(ne=>!w.has(ne.id));if(S.length=0,A.length===0)break;let B=O(A);if(B.length===0)break;B.length<A.length&&S.push(...A.slice(B.length)),v(B)}}catch(A){}},q=!0,J=null;J=setInterval(()=>{q&&$()},o);let Y=()=>{document.visibilityState==="hidden"&&$()},xe=()=>{$()};return document.addEventListener("visibilitychange",Y),window.addEventListener("pagehide",xe),{push(A){E(A),S.length>=s&&$()},flush:$,destroy(A){A!=null&&A.forget&&(u=!0),q=!1,J!==null&&(clearInterval(J),J=null),document.removeEventListener("visibilitychange",Y),window.removeEventListener("pagehide",xe),$()}}}var ri=200;function jt(e){return`_snt_goal_retry_${e.slice(0,12)}`}var oi={send:()=>{},flush:()=>{},destroy:()=>{}};function _r(e){var t,n,r;if(typeof window=="undefined")return oi;let o=(t=e.flushIntervalMs)!=null?t:5e3,s=(n=e.maxRetrySize)!=null?n:100,a=(r=e.maxPerFlush)!=null?r:5,l=jt(e.apiKey),i=!1,c=fe(e.apiKey),u=(...m)=>{!i&&fe(e.apiKey)===c&&En(...m)},p=[],h=new Set,S=new Set,w=[],b=0,K=0,L=!1,M=m=>{for(h.delete(m.id),S.has(m.id)||(S.add(m.id),w.push(m.id));w.length>ri;){let O=w.shift();O&&S.delete(O)}Sr([m.id],l)},E=m=>{u([m],s,l),!S.has(m.id)&&!h.has(m.id)&&(h.add(m.id),p.push(m)),Date.now()>=b&&(K++,b=Date.now()+He(K))},x=m=>{let O,$=je(15e3);try{O=fetch(e.url,{method:"POST",keepalive:!0,signal:$.signal,body:m.body,headers:e.headers})}catch(J){E(m);return}let q=J=>{var Y;let xe=Bt(J);if(xe==="retry"){E(m);return}xe==="dropped"&&((Y=e.onDrop)==null||Y.call(e,m,J.status)),M(m),K=0,b=0};Promise.resolve(O).then($.clear,$.clear),O&&typeof O.then=="function"?O.then(q).catch(()=>E(m)):q(O)},C=()=>{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){}},R=br(l,s);for(let m of R)h.has(m.id)||(h.add(m.id),p.push(m));R.length>0&&En(R,s,l);let g=setInterval(C,o),v=()=>{document.visibilityState==="hidden"&&C()},d=()=>C();return document.addEventListener("visibilitychange",v),window.addEventListener("pagehide",d),{send(m){if(L){S.has(m.id)||u([m],s,l);return}if(!(S.has(m.id)||h.has(m.id))){if(Date.now()<b){u([m],s,l),h.add(m.id),p.push(m);return}x(m)}},flush:C,destroy(m){m!=null&&m.forget&&(i=!0),clearInterval(g),document.removeEventListener("visibilitychange",v),window.removeEventListener("pagehide",d),C(),L=!0}}}function st(e){if(typeof window=="undefined"||!e)return!1;$t(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=We(e),o=[n,"_snt_graph_edges",ot+e,Kt(e),jt(e),`_snt_graph_nodes${r}`],s=[`_snt_asgn${r}_`];for(let a of["localStorage","sessionStorage"])try{let l=window[a];for(let i of o)l.getItem(i)!==null&&(l.removeItem(i),t=!0);for(let i=l.length-1;i>=0;i--){let c=l.key(i);c&&s.some(u=>c.startsWith(u))&&(l.removeItem(c),t=!0)}}catch(l){}try{(new RegExp(`(?:^|; )${ze}=[^;]`).test(document.cookie)||localStorage.getItem(ze)!==null||sessionStorage.getItem(ze)!==null)&&localStorage.setItem(`${ze}_tomb${r}`,"1")}catch(a){}return t}An();function Gt(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function xr(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 Cn(e){var t,n,r;if(e.arms)return typeof e.baseline=="string"?e.baseline:(t=e.arms[0])!=null?t:"";if(e.baseline!==void 0&&typeof e.baseline=="object")return Gt(e.baseline);if(typeof e.baseline=="string")return e.baseline;let o={};for(let[s,a]of Object.entries((n=e.dims)!=null?n:{}))o[s]=(r=a[0])!=null?r:"";return Gt(o)}function Ar(e,t){var n,r;return e.dims!=null?(r=(n=xr(t))!=null?n:xr(Cn(e)))!=null?r:{}:t}function Je(e){return e>=.3?e<.7?"medium":"high":"low"}var Cr=["new","browsing","carted","customer","lapsed"];var ci=["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 Ir(e){return di(e)!==null}function di(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=ci.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function Or(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 Tr(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 Lr(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var fi=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Rr(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):fi.includes(o)&&(o in n||(n[o]=s))}catch(r){}return{utmParams:t,clickIds:n}}function Pr(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function In(e){return j(j(j({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 On(e){let t=In(e);return Ar(t,Cn(t))}function Nr(e){return typeof e=="string"?e:Gt(e)}An();var Dn;function Ht(e){Dn=typeof e=="string"&&e!==""?e:void 0}function Gr(e=document){if(Dn)return Dn;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=Gr(t);return n&&e.setAttribute("nonce",n),e}function Fr(){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 $r="_snt_uid",gi=365,at="_snt_uid";function hi(){return Fr()}function Tn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Kn(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function yi(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${Kn()}`}catch(r){}}function Ft(e){try{return localStorage.getItem(e)}catch(t){return null}}function Br(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Ln(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function vi(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function bi(e){try{sessionStorage.removeItem(e)}catch(t){}}function Si(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${Kn()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function wi(e){try{localStorage.removeItem(e)}catch(t){}}function _i(e){try{document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${Kn()}`}catch(t){}}var ki={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function Ur(e){var t,n,r,o,s,a,l;if(typeof window=="undefined")return ki;let i=We(e==null?void 0:e.apiKey),c=(t=e==null?void 0:e.cookieName)!=null?t:gt(e==null?void 0:e.apiKey),u=`${at}${i}`,p=`${at}_tomb${i}`,h=((n=e==null?void 0:e.cookieTTLDays)!=null?n:gi)*24*60*60,S=x=>x&&x.length>0?x:null,w=()=>{var x,C;return i&&!(e!=null&&e.cookieName)&&Ft(p)===null?(C=(x=S(Tn($r)))!=null?x:S(Ft(at)))!=null?C:S(Ln(at)):null},b=(l=(a=(s=(o=(r=S(Tn(c)))!=null?r:S(Ft(u)))!=null?o:S(Ln(u)))!=null?s:w())!=null?a:S(e==null?void 0:e.ssrSessionId))!=null?l:hi();yi(c,b,h);let K=Br(u,b),L=Si(c),M=K?!1:vi(u,b),E=!K&&!L&&!M;return{getSessionId:()=>b,isEphemeral:()=>E,destroy:()=>{b=null,_i(c),wi(u),bi(u),i&&!(e!=null&&e.cookieName)&&(Tn($r)!==null||Ft(at)!==null||Ln(at)!==null)&&Br(p,"1")}}}var Ei=1800*1e3;function Ut(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function xi(e=Ei,t){let n=new Map,r=`_snt_asgn${We(t)}_`,o=(i,c)=>`${r}${encodeURIComponent(i)}:${encodeURIComponent(c)}`,s=i=>{let c=i.slice(r.length),u=c.indexOf(":");if(u<0)return null;try{return{componentId:decodeURIComponent(c.slice(0,u)),segment:decodeURIComponent(c.slice(u+1))}}catch(p){return null}},a=()=>{try{let i=[];for(let c=0;c<localStorage.length;c++){let u=localStorage.key(c);u!=null&&u.startsWith(r)&&i.push(u)}return i}catch(i){return[]}},l=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 u=JSON.parse(c);if(l(u)){localStorage.removeItem(i);continue}let p=s(i);if(!p)continue;n.set(Ut(p.componentId,p.segment),u)}catch(c){}})(),{get(i,c){let u=n.get(Ut(i,c));return u?l(u)?(n.delete(Ut(i,c)),null):u:null},set(i,c,u){let p=Ut(i,c);n.set(p,u);try{localStorage.setItem(o(i,c),JSON.stringify(u))}catch(h){}},clear(){n.clear();for(let i of a())try{localStorage.removeItem(i)}catch(c){}}}}var Mn="data-sentient-stage";function yt(e,t){return!t||typeof e!="string"||!(e==="returning"||Cr.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function Vt(e,t=document){try{e?t.documentElement.setAttribute(Mn,e):t.documentElement.removeAttribute(Mn)}catch(n){}}var $n="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Wr="[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.",Kr=!1,Wt=!1;function Ai(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function Ci(e){var t;let n=Ur({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=Ai(),s=Promise.resolve().then(()=>(Mr(),Dr)).then(u=>{let p=u;return p.LOCAL_ENGINE_AVAILABLE?(Kr||(Kr=!0,console.info(Wr)),p):(Wt||(Wt=!0,console.error($n)),null)}).catch(()=>(Wt||(Wt=!0,console.error($n)),null)),a=null,l={low:.15,medium:.5,high:.85},i=(()=>{var u;if(e.initialPersona)return j({},e.initialPersona);let p=it(e.apiKey||"local");return p?{persona:p.persona,confidence:(u=l[p.band])!=null?u:.15}:null})();function c(u){let p=document.documentElement;p.dataset.sentientPersona===void 0&&(p.dataset.sentientPersona=u.persona,p.dataset.sentientConfidence=Je(u.confidence))}return{isLocal:!0,async decide(u){var p,h,S;let w=await s;if(!w)return null;let b=w.createLocalEngine({sessionId:r,forcedPersona:o}).decide(u);return a=qe(j({},b),{layoutOrder:(h=(p=b.layoutOrder)!=null?p:a==null?void 0:a.layoutOrder)!=null?h:null,slots:j(j({},(S=a==null?void 0:a.slots)!=null?S:{}),b.slots)}),Ve(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(u){var p,h,S;return(S=(h=a==null?void 0:a.slots[u])!=null?h:(p=e.initialSlots)==null?void 0:p[u])!=null?S:null},getSlotConfig(u){var p,h;return(h=(p=e.initialSlotConfig)==null?void 0:p[u])!=null?h:null},getSitePalette(){var u;return(u=e.initialPalette)!=null?u:null},reportSlots(){},getPersona(){let u=a!=null?a:i;return u?{persona:u.persona,confidence:u.confidence,band:Je(u.confidence)}:null},async assign(u,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:u,variantIds:p}]}).assignments[u])!=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 qt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Rn(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function jn(e,t){if(e===void 0||!qt.test(e))return!1;if(e==="*")return!0;let n=Rn(t);if(e.endsWith("/*")){let r=Rn(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===Rn(e)}function vt(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(vt):!1}var jr="sentient-reveal",lt="sentient-revealed",zr=240,Pn=!1;function Ii(e){if(Pn||e.getElementById(jr)){Pn=!0;return}let t=Ge(e.createElement("style"),e);t.id=jr,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${lt}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${lt}{animation:${lt} ${zr}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),Pn=!0}function Gn(e,t={}){var n;let r=(n=t.doc)!=null?n:typeof document!="undefined"?document:void 0;if(!r||!(e instanceof Element)||(t.arm!==void 0&&e.setAttribute("data-sentient-arm",t.arm),t.persona!==void 0&&e.setAttribute("data-sentient-persona",t.persona),t.previous!==void 0&&t.previous===e.textContent))return!1;Ii(r),e.classList.remove(lt),e.offsetWidth,e.classList.add(lt);let o=()=>{e.classList.remove(lt),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function Fn(e,t,n,r){let o=[];{let s=!1,a=[],l=()=>{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",l),o.push(()=>t.removeEventListener("click",l))}{let s=!1,a=l=>{if(s||!(l.target instanceof Node)||!t.contains(l.target)&&t!==l.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,l=null,i=()=>{l!==null&&(clearTimeout(l),l=null)},c=()=>{s||!a||(i(),l=setTimeout(()=>{!s&&a&&(s=!0,e("scroll_hesitation"))},3e3))},u=()=>{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",u,{passive:!0}),o.push(()=>{h.disconnect(),window.removeEventListener("scroll",u),i()})}if((r==null?void 0:r.tabLoss)!==!1){let s=!1,a=n!=null?n:Date.now(),l=()=>{if(s||document.visibilityState!=="hidden")return;let i=Date.now()-a;i<15e3&&(s=!0,e("tab_loss",{timeOnPage:i}))};document.addEventListener("visibilitychange",l),o.push(()=>document.removeEventListener("visibilitychange",l))}return()=>{for(let s of o)s()}}function Oi(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Hr="https://api.sentient-ui.com/v1/events",pe=new Map,Vr=null;function Ti(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Li=3;function Nn(){return Fr()}function zt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Ri(){let e=new WeakMap,t=new Map,n=!1,r=(l,i,c)=>{let u=l.get(i);return c===null?u?!0:(l.set(i,new Set),!1):u?u.has(c)?!0:(u.add(c),!1):(l.set(i,new Set([c])),!1)},o=typeof window!="undefined"&&"event"in window,s=()=>{if(!o)return;let l=window.event;return typeof Event=="function"&&l instanceof Event?l:void 0},a=()=>{if(o){Promise.resolve().then(()=>{n=!1,t.clear()});return}let l=!1,i=()=>{l||(l=!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(l,i){let c=s();if(c){let p=e.get(c);return p||(p=new Map,e.set(c,p)),r(p,l,i)}let u=r(t,l,i);return!u&&!n&&(n=!0,a()),u}}}var qr=new Set;function Pi(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,s,a=()=>{if(o)return;let c=zt();!c||c===s||(s=c,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${c}`))},l=[];for(let c of["pushState","replaceState"]){let u=r[c],p=function(...h){let S=u.apply(this,h);return a(),S};r[c]=p,l.push([c,u,p])}window.addEventListener("popstate",a);let i=zt();return i&&qr.has(`${t}:${i}`)?s=i:a(),()=>{if(!o){o=!0,window.removeEventListener("popstate",a);for(let[c,u,p]of l)r[c]===p&&(r[c]=u)}}}var ht={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 Ni(){try{return Rr(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Jr(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 Un(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:Vr;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 l=(a!=null?a:bt)(qe(j({},o),{consent:!0}));s(l);let i=(t=pe.get(n))==null?void 0:t.dispose;pe.set(n,{config:qe(j({},o),{consent:!0}),upgrade:null,dispose:i})}function Di(e,t){var n;let r=e.preConsentBehavior==="statistical_winner",o=Jr((n=e.ingestUrl)!=null?n:Hr),s={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},a=new Map,l=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):Bn(l,g,async()=>{try{let O=new URLSearchParams({componentId:g});for(let Y of v!=null?v:[])O.append("variantIds[]",Y);let $=je(5e3),q;try{let Y=await fetch(`${o}/winner?${O.toString()}`,{headers:s,signal:$.signal});if(!Y.ok)return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null;q=await Y.json()}finally{$.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,u=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)===R&&pe.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},M=[],E=()=>{setTimeout(()=>{var g;try{(g=M.shift())==null||g(i)}catch(v){}M.length&&E()})},x=g=>{c?M.length?M.push(g):g(i):!t&&!K&&b.length<100?b.push(g):K&&e.debug&&console.warn("[sentient] goal dropped: client released")},C={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=>(u.add(g),()=>{u.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():st(e.apiKey))};function R(g){var v,d,m;i=g,c=!0,b.length&&(M.push(...b.splice(0)),E());let O=Oe();for(let[$,q,J]of S.splice(0))q!==O?J(null):g.decide($).then(J,()=>J(null));(v=g.onSlotsChanged)==null||v.call(g,()=>u.forEach($=>$()));for(let[$,q,J]of p.splice(0))$.length>0&&((d=g.requestSlots)==null||d.call(g,$,q,J));h.length>0&&((m=g.decideSlots)==null||m.call(g,h.splice(0)))}return{proxy:C,setInner:R}}function Oe(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function Bn(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 bt(e){var t,n,r,o,s,a,l,i,c,u;if(typeof window=="undefined")return ht;e.nonce&&Ht(e.nonce),Vr=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?ht:Ci(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."}),ht;let{proxy:f,setInner:y}=Di(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."),ht;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),ht;let b=(t=e.ingestUrl)!=null?t:Hr,K=Date.now(),L=Ur({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),M=xi(void 0,e.apiKey),E=!1,x=fe(e.apiKey),C=()=>!E&&fe(e.apiKey)===x,R=qe(j({},M),{set:(...f)=>{C()&&M.set(...f)}}),g=wr({ingestUrl:b,apiKey:e.apiKey}),v=Jr(b),d={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},m=new Set,O=_r({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)}}),$=Or((n=navigator.userAgent)!=null?n:""),q=window.location.origin,J=Tr((r=document.referrer)!=null?r:"",q),Y=(o=e.sessionSegment)!=null?o:`${$}:${J}`,xe=new Map,A=new Map,B=new Map,ne=new Set,re=new Map,Q=null,me=null,ee=null,Me=new Set,$e=new Set,Le=new Map,yn=new Map,or=new Set,ir=new Set,sr=new Set,vn=null,Rt=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,ar=new Set,Pt=new Set,Nt=new Set,ft=new Map,bn=null,Dt=new Set,pt=new Map,Sn=null,Fo=2,lr=new Map,we=!1,ur=(f,y,N)=>{var W;let G=new Set,_=1;for(let I of f){y.delete(I);let T=((W=lr.get(I))!=null?W:0)+1;lr.set(I,T),T<=Fo&&(G.add(I),T>_&&(_=T))}G.size>0&&setTimeout(()=>{we||N(G)},He(_))},wn=f=>{for(let y of f)B.has(y.id)||B.set(y.id,On(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))re.set(f,y);e.initialPalette&&(Q=e.initialPalette),e.initialVocabulary&&(me=e.initialVocabulary);let Ae=it(e.apiKey);if(Ae){for(let[f,y]of Object.entries(Ae.slots))B.has(f)||B.set(f,y);for(let[f,y]of Object.entries((s=Ae.slotConfig)!=null?s:{}))re.has(f)||re.set(f,y);!Q&&Ae.palette&&(Q=Ae.palette),!me&&Ae.vocabulary&&(me=Ae.vocabulary)}let cr={low:.15,medium:.5,high:.85};if(e.initialPersona)ee=j({},e.initialPersona);else{let f=document.documentElement.dataset;f.sentientPersona?ee={persona:f.sentientPersona,confidence:(l=cr[(a=f.sentientConfidence)!=null?a:"low"])!=null?l:.15}:Ae&&(ee={persona:Ae.persona,confidence:(i=cr[Ae.band])!=null?i:.15})}if(e.initialAssignments)for(let[f,y]of Object.entries(e.initialAssignments))R.set(f,Y,{variantId:y,assignedAt:Date.now(),segment:Y,confidence:1});let Be=Promise.resolve(),dr=L.getSessionId();if(dr){let f=Lr((c=document.referrer)!=null?c:""),{utmParams:y,clickIds:N}=Ni(),W=j(j(j(j({sessionId:dr,deviceClass:$,trafficSource:J,referrerDomain:f,utmParams:y,clickIds:N,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:Pr(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:L.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Ir((u=navigator.userAgent)!=null?u:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),G=async()=>{for(let _=0;;_++){if(we||!C())return;let I=je(5e3);try{let T=await fetch(`${v}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(W),headers:d,signal:I.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||Bt(T)==="dropped")return}catch(T){}finally{I.clear()}if(_>=Li){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,He(_+1)))}};try{Be=G()}catch(_){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:g});let Uo=Ri(),mt=null,_n=!1,ae={goal(f,y={},N=1,W=0){var G,_,I,T,H,F,te;let oe=L.getSessionId();if(!oe||we||!C())return;let z=Ti(y)?y:{metadata:y},ge=[f,(G=z.externalId)!=null?G:"",(_=z.stepIndex)!=null?_:W,(I=z.weight)!=null?I:N].join("\0"),_e=z.value!==void 0?`${z.value}\0${(T=z.currency)!=null?T:""}`:null;if(Uo.firedBefore(ge,_e)){e.debug&&console.log(`[sentient] goal("${f}") already recorded for this action \u2014 not sent twice`);return}let de=Nn(),le={sessionId:oe,name:f,metadata:(H=z.metadata)!=null?H:{},weight:(F=z.weight)!=null?F:N,stepIndex:(te=z.stepIndex)!=null?te:W,goalId:de,value:z.value,currency:z.currency,externalId:z.externalId};e.debug&&console.log("[sentient] goal",le);let D={id:de,body:JSON.stringify(le)};Be.then(()=>O.send(D))},componentGoal(f,y,N){var W,G,_;let I=L.getSessionId();if(!I||we||!C())return;let T=R.get(f,Y),H=T?null:(W=B.get(f))!=null?W:null;if(!T&&H===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 F=T?T.variantId:Nr(H),te={id:Nn(),sessionId:I,projectId:e.apiKey,componentId:f,variantId:F,eventType:"goal_achieved",goalType:y,payload:j({reward:(G=N==null?void 0:N.reward)!=null?G: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:zt()};e.debug&&console.log("[sentient] componentGoal",te),Be.then(()=>{!we&&C()&&g.push(te)})},identify(f){let y=L.getSessionId();!y||we||!C()||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||we||!C()||f.eventType==="variant_assigned"&&B.get(f.componentId)!==void 0&&!ne.has(f.componentId)&&!R.get(f.componentId,Y))return;let N=qe(j({path:zt()},f),{id:Nn(),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 R.get(f,y)},async assign(f,y,N,W){let G=L.getSessionId();if(!G)return null;let _=R.get(f,Y);if(_&&(y!=null&&y.length||_.content!==void 0)){let I=_.ttlMs&&_.ttlMs>0?Math.max(0,_.assignedAt+_.ttlMs-Date.now()):0;return{variantId:_.variantId,assignmentTtlMs:I,content:_.content}}return Bn(xe,f,async()=>{if(!await xn(Be,2500)||we||!C())return null;let I=je(3e4);try{let T={sessionId:G,componentId:f,variantIds:y};W!==void 0?T.agentDataByVariant=W:N!==void 0&&(T.agentData=N);let H=await fetch(`${v}/assign`,{method:"POST",body:JSON.stringify(T),headers:d,signal:I.signal});if(!H.ok)return null;let F=await H.json();return R.set(f,Y,j({variantId:F.variantId,assignedAt:Date.now(),segment:Y,confidence:1,content:F.content},F.assignmentTtlMs&&F.assignmentTtlMs>0?{ttlMs:F.assignmentTtlMs}:{})),F}catch(T){return null}finally{I.clear()}})},async decide(f){var y,N;let W=L.getSessionId();if(!W)return null;let G=(y=f.slots)!=null?y:[],_={sessionId:W};f.sections&&f.sections.length>0&&(_.sections=f.sections.map(T=>({id:T}))),_.components=(N=f.components)!=null?N:[],G.length>0&&(_.slots=G.map(In)),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 I=JSON.stringify(_);return Bn(A,I,async()=>{var T,H,F,te,oe,z,ge,_e;if(!await xn(Be,2500)||we||!C())return wn(G),null;let de=je(3e4);try{let le=await fetch(`${v}/decide`,{method:"POST",body:I,headers:d,signal:de.signal});if(!le.ok)return wn(G),null;let D=await le.json(),Ce=yt(D.stage,e.stageAttributes);e.stageAttributes&&Vt(Ce);let rt={};for(let X of G){let Ie=(T=D.slots)==null?void 0:T[X.id];if(Ie!==void 0){rt[X.id]=Ie,B.set(X.id,Ie),ne.add(X.id);continue}let fr=B.get(X.id);if(fr!==void 0)rt[X.id]=fr;else{let pr=On(X);rt[X.id]=pr,B.set(X.id,pr)}}if(D.slots)for(let[X,Ie]of Object.entries(D.slots))X in rt||(rt[X]=Ie,B.set(X,Ie),ne.add(X));let Wo=ee!=null&&ee.persona!=="unknown";D.persona&&!(D.persona==="unknown"&&Wo)?ee={persona:D.persona,confidence:(H=D.confidence)!=null?H:0}:ee||(ee={persona:"unknown",confidence:0});for(let[X,Ie]of Object.entries((F=D.assignments)!=null?F:{}))R.set(X,Y,{variantId:Ie,assignedAt:Date.now(),segment:Y,confidence:1});if(D.slotConfig)for(let[X,Ie]of Object.entries(D.slotConfig))re.set(X,Ie);D.palette&&(Q=D.palette),D.vocabulary&&(me=D.vocabulary);for(let X of(te=f.registrySlotIds)!=null?te:[])(oe=D.slotConfig)!=null&&oe[X]||(re.delete(X),B.delete(X),ne.delete(X));return C()&&Ve(e.apiKey,j(j(j(j({v:1,persona:ee.persona,band:Je(ee.confidence),slots:Object.fromEntries(B),layoutOrder:(z=D.layoutOrder)!=null?z:null,savedAt:Date.now()},re.size>0?{slotConfig:Object.fromEntries(re)}:{}),Q?{palette:Q}:{}),me?{vocabulary:me}:{}),Ce?{stage:Ce}:{})),j(j(j(j(j(j(j({layoutOrder:(ge=D.layoutOrder)!=null?ge:null,assignments:(_e=D.assignments)!=null?_e:{},slots:rt,persona:ee.persona,confidence:ee.confidence},D.slotConfig?{slotConfig:D.slotConfig}:{}),D.goals?{goals:D.goals}:{}),D.sectionMap?{sectionMap:D.sectionMap}:{}),D.palette?{palette:D.palette}:{}),D.vocabulary?{vocabulary:D.vocabulary}:{}),D.stage?{stage:D.stage}:{}),D.context?{context:D.context}:{})}catch(le){return wn(G),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=re.get(f))!=null?y:null},reportSlots(f,y,N,W){var G;let _={};for(let[I,T]of Object.entries(W!=null?W:{}))for(let H of T){let F=`${I}|${H.key}`;!Rt.test(I)||sr.has(F)||(sr.add(F),((G=_[I])!=null?G:_[I]=[]).push(H))}Object.keys(_).length>0&&fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify({slotIds:Object.keys(_),authoredArms:_})}).catch(()=>{});for(let I of f)if(!(typeof I!="string"||I.length===0)){if(!Rt.test(I)){Oi()&&!ar.has(I)&&(ar.add(I),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(I)} 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(I)){Me.add(I),$e.add(I);let T=y==null?void 0:y[I];if(typeof T=="string"){let F=T.replace(/\s+/g," ").trim().slice(0,400);F!==""&&Le.set(I,F)}let H=N==null?void 0:N[I];H!==void 0&&yn.set(I,H)}}$e.size===0||vn!=null||(vn=setTimeout(()=>{vn=null;let I=[...$e];$e.clear();for(let T=0;T<I.length;T+=20){let H=I.slice(T,T+20),F={},te={};for(let oe of H){let z=Le.get(oe);z!==void 0&&(F[oe]=z,Le.delete(oe));let ge=yn.get(oe);ge!==void 0&&(te[oe]=ge,yn.delete(oe))}fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify(j(qe(j(j({slotIds:H},Object.keys(F).length>0?{baselineTexts:F}:{}),Object.keys(te).length>0?{baselineSkeletons:te}:{}),{pagePaths:Object.fromEntries(H.map(oe=>[oe,location.pathname]))}),Object.keys(F).length>0&&L.getSessionId()?{sessionId:L.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(f,y){!Rt.test(f)||or.has(f)||(or.add(f),fetch(`${v}/slots/observed`,{method:"POST",headers:d,body:JSON.stringify({slotIds:[f],baselineSkeletons:{[f]:y}})}).catch(()=>{}))},reportDrift(f,y,N,W){let G=`${f}|${y}`,_=L.getSessionId();!_||ir.has(G)||(ir.add(G),fetch(`${v}/slots/drift`,{method:"POST",headers:d,body:JSON.stringify({sessionId:_,reports:[{slotId:f,expectedFp:y,observedFp:N,reason:W}]})}).catch(()=>{}))},requestSlots(f,y,N){var W,G;for(let _ of f)Nt.has(_)||(Nt.add(_),Rt.test(_)?ft.set(_,{text:y==null?void 0:y[_],render:(W=N==null?void 0:N.render)==null?void 0:W[_],skeleton:(G=N==null?void 0:N.skeletons)==null?void 0:G[_]}):ae.reportSlots([_]));ft.size===0||bn!=null||(bn=setTimeout(()=>{bn=null;let _=[...ft];ft.clear();for(let I=0;I<_.length;I+=50){let T=_.slice(I,I+50),H={};for(let[F,te]of T)te.render&&(H[F]=te.render);ae.decide({slotsFrom:"registry",registrySlotIds:T.map(([F])=>F),bootstrap:!1,render:H}).then(F=>{var te,oe;if(F){let z={},ge={},_e=[];for(let[de,le]of T){let D=(te=F.slotConfig)==null?void 0:te[de];if(D){D.needsSkeleton&&le.skeleton&&((oe=ae.reportSkeleton)==null||oe.call(ae,de,le.skeleton));continue}_e.push(de),le.text&&(z[de]=le.text),le.skeleton&&(ge[de]=le.skeleton)}_e.length>0&&ae.reportSlots(_e,z,ge)}else ur(T.map(([z])=>z),Nt,z=>{var ge;let _e={},de={},le={};for(let[D,Ce]of T)z.has(D)&&(Ce.text&&(_e[D]=Ce.text),Ce.render&&(de[D]=Ce.render),Ce.skeleton&&(le[D]=Ce.skeleton));(ge=ae.requestSlots)==null||ge.call(ae,[...z],_e,{render:de,skeletons:le})});Pt.forEach(z=>z())})}},0))},decideSlots(f){for(let y of f)Dt.has(y.id)||(Dt.add(y.id),pt.set(y.id,y));pt.size===0||Sn!=null||(Sn=setTimeout(()=>{Sn=null;let y=[...pt.values()];pt.clear();for(let N=0;N<y.length;N+=30){let W=y.slice(N,N+30);ae.decide({slots:W}).then(G=>{G||ur(W.map(_=>_.id),Dt,_=>{var I;return(I=ae.decideSlots)==null?void 0:I.call(ae,W.filter(T=>_.has(T.id)))}),Pt.forEach(_=>_())})}},0))},cancelSlots(f){for(let y of f)ft.delete(y)&&Nt.delete(y),pt.delete(y)&&Dt.delete(y)},onSlotsChanged(f){return Pt.add(f),()=>{Pt.delete(f)}},getStyleVocabulary(){return me},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;mt==null||mt(),_n=!0,we=!0,g.destroy(),O.destroy(),((f=pe.get(e.apiKey))==null?void 0:f.dispose)===ae.dispose&&pe.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var f;mt==null||mt(),_n=!0,we=!0,E=!0,$t(e.apiKey),g.destroy({forget:!0}),O.destroy({forget:!0}),L.destroy(),R.clear(),((f=pe.get(e.apiKey))==null?void 0:f.dispose)===ae.dispose&&pe.delete(e.apiKey);try{localStorage.removeItem(ot+e.apiKey),localStorage.removeItem(Kt(e.apiKey)),localStorage.removeItem(jt(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${We(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:ae.dispose}),mt=Pi(ae,e.apiKey,f=>{Be.then(()=>{_n||qr.add(f)})}),e.debug){let f=window;f.__sentient&&(f.__sentient.client=ae)}return ae}var Wn=/(^|\/)snippet(\.global)?(\.min)?\.js(\?|$)/,Mi=(()=>{var e,t;try{return(t=(e=document.currentScript)==null?void 0:e.src)!=null?t:""}catch(n){return""}})(),$i=/@\d+\.\d+\.\d+[^/]*\//;function zn(e){var t;try{let n=Mi||((t=Array.from(document.getElementsByTagName("script")).find(r=>Wn.test(r.src)))==null?void 0:t.src);for(let r of n?[n]:[]){let o=Wn.test(r)?r.replace(Wn,`$1${e}$4`):r.replace(/[^/?#]*([?#].*)?$/,e),s=(e==="consent.global.js"?"sha384-+7/RqBOFLU5bMaQ6bcBAWzG589skmxN8tedG9hkoQQ6HaQkRRBJfoRVD94e/fJcM":e==="editor.global.js"?"sha384-EoAiSGo1RH6/ueo+geGaOGKbv4h6QraiVRGX0QgIrmw5zwy8fPclFnz8R8+4oa3I":e==="preview.global.js"?"sha384-wT7q44HEqP/ffe8U9vqOXtq/aqNKi6/kl4ymyk7J0FHXu/HEDkQCuMbgWYKVn6uT":"sha384-OAQ7UQm5r+48WW3TX1LtHxQVhOYcuHjXRFqRoE6GV1C9C9iH1O9UvVgsfRqSCD/t")||"";return $i.test(o)&&s.indexOf("sha384-")===0?{src:o,integrity:s}:{src:o}}}catch(n){}return null}var Jt=new Map;function ut(e,t,n){let r=window[t];if(r)return Promise.resolve(r);let o=Jt.get(e);return o||(o=new Promise(s=>{var i;let a=n?{src:n}:zn(e);if(!a)return s(null);let l=Ge(document.createElement("script"));Hn(l,a),l.async=!0,l.onload=()=>{var u;let c=(u=window[t])!=null?u:null;c||Jt.delete(e),s(c)},l.onerror=()=>{Jt.delete(e),s(null)},((i=document.head)!=null?i:document.documentElement).appendChild(l)}),Jt.set(e,o)),o}function Hn(e,t){t.integrity&&(e.integrity=t.integrity,e.crossOrigin="anonymous"),e.src=t.src}var Yr="__sentientConsent",Re=null,Vn=!1,Yt=new Set,qn=()=>{let e=window[Yr];return typeof(e==null?void 0:e.consentWatcher)=="function"?e.consentWatcher:null},St;function Xr(e){St=e}function Bi(){Re||(Re=qn())||Vn||(Vn=!0,ut("consent.global.js",Yr,St).then(e=>{if(Vn=!1,!e)return Ki(St!=null?St:"consent.global.js");if(Re=qn(),Re)for(let t of Array.from(Yt))t()}))}function Ki(e){console.warn(`[sentient] could not load ${e} \u2014 tracking stays off. Set window.sentient.consentSrc to its URL.`)}function Xe(e){Bi();let t=null,n=()=>(!t&&(Re!=null?Re:Re=qn())&&(t=Re(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=()=>{Yt.delete(a);let l=n();s||!l||(o=l.subscribe(r),r())};return n()?(o=t.subscribe(r),Promise.resolve().then(()=>{s||r()})):Yt.add(a),()=>{s=!0,Yt.delete(a),o==null||o()}}}}function ji(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function Zr(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 Gi(e){let t=e.join("");return Zr(t,2166136261)+Zr(t,1523705862)}var Fi=new Set(["A","BUTTON"]),Ui=/^H([1-6])$/,Wi=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]);var zi=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function Hi(e){return Fi.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function Vi(e){if(Ui.test(e.tagName)||Wi.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function qi(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(Hi(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||Vi(r))return r;return t}function Xt(e,t=40){var n,r,o;let s=e.ownerDocument.createTreeWalker(e,4),a=[];for(let u=s.nextNode();u;u=s.nextNode())if(((n=u.nodeValue)!=null?n:"").trim()!==""&&!zi.has((o=(r=u.parentElement)==null?void 0:r.tagName)!=null?o:"")&&(a.push(u),a.length>120))return{reason:"too_large"};if(a.length===0)return{reason:"empty"};let l=[],i=[];for(let u of a){let p=qi(u,e),h=l.indexOf(p);h===-1&&(l.push(p),h=l.length-1),i.push(h)}if(l.length>t)return{reason:"too_large"};let c=a.map(u=>{var p;return ji((p=u.nodeValue)!=null?p:"")});return{textNodes:a,ownerEls:l,leafToNode:i,leaves:c,fp:Gi(c)}}var Qr=["cookiebot","onetrust","cookieyes","tcf","google-consent-mode","shopify"];function Ji(e){if(typeof e!="object"||e===null||Array.isArray(e))return null;let t=Object.entries(e);if(t.length<1||t.length>4)return null;let n={};for(let[r,o]of t){if(!Array.isArray(o)||o.length<2||o.length>6||!o.every(s=>typeof s=="string")||/[=|]/.test(r)||o.some(s=>/[=|]/.test(s)))return null;n[r]=o}return n}function Yi(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function Xi(e){try{return e()}catch(t){return}}function Zt(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[l,i]of Object.entries(t.slots)){if(typeof i!="object"||i===null)continue;let c=i,u=Ji(c.dims);if(!u||c.target!==void 0&&typeof c.target!="string")continue;let p=c.arms!==void 0?Yi(c.arms):null,h={dims:u};typeof c.target=="string"&&(h.target=c.target),p&&(h.arms=p),n[l]=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 l=o;typeof l.cmp=="string"&&Qr.includes(l.cmp)||l.cmp===void 0&&(typeof l.cookie=="string"||typeof l.check=="function")?r.consentFrom=l:s("consentFrom")}else o!==void 0&&s("consentFrom");function s(l){r.consent=!1,console.warn(`[sentient] invalid ${l} \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),(t.stageAttributes===!0||t.stageAttributes==="detailed")&&(r.stageAttributes=t.stageAttributes),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"?Xi(t.persona):t.persona;if(typeof a=="string"&&a.trim()!==""&&(r.persona=a),Array.isArray(t.sections)){let l=t.sections.filter(i=>typeof i=="string"&&i.trim()!=="").slice(0,50);l.length>=2&&(r.sections=l)}return r}var eo=new WeakMap;function to(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function no(e,t,n){var s,a,l;let r=eo.get(e);if(r){if(r.fp!==n.fp||!to(r.leafToNode,n.leafToNode))return"mismatch"}else{let i=Xt(e);if(!("fp"in i)||(r={fp:i.fp,leafToNode:i.leafToNode,textNodes:i.textNodes,ownerEls:i.ownerEls,classes:i.ownerEls.map(c=>{var u;return(u=c.getAttribute("class"))!=null?u:""})},r.fp!==n.fp||!to(r.leafToNode,n.leafToNode)))return"mismatch";eo.set(e,r)}let o=r;for(let[i,c]of Object.entries(t.nodes)){let u=Number(i),p=o.ownerEls[u];if(p){if(typeof c.text=="string"){let h=!0;o.leafToNode.forEach((S,w)=>{S===u&&(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),u=(l=c[0])==null?void 0:l.parentElement;if(!u||c.length!==i.length||c.some(w=>w.parentElement!==u))continue;let p=new Set(c),h=0;Array.from(u.children).map(w=>p.has(w)?c[h++]:w).forEach((w,b)=>{var K;u.children[b]!==w&&u.insertBefore(w,(K=u.children[b])!=null?K:null)})}return"applied"}function wt(e){var n,r,o;let t=(r=(n=e.defaultView)!=null?n:typeof window!="undefined"?window:void 0)==null?void 0:r.location;return(o=t==null?void 0:t.pathname)!=null?o:""}function Zi(e,t){var n;if(t.tag&&e.tagName.toLowerCase()!==t.tag.toLowerCase())return!1;if(t.text){let r=((n=e.textContent)!=null?n:"").replace(/\s+/g," ").trim().toLowerCase(),o=t.text.replace(/\s+/g," ").trim().toLowerCase();if(!(r===o||r.startsWith(o)||o.startsWith(r)))return!1}return!0}function Qt(e,t){return!!(e!=null&&e.urlMatch)&&!wt(t).includes(e.urlMatch)}var Qi=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function ro(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&&!wt(t).includes(e.urlMatch))return null;let n=ro(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!Zi(r,e.fingerprint)?null:r}function oo(e,t){return Qt(e,t)?!1:!!e.selector&&!e.dataAttr&&!e.id&&!e.fingerprint&&e.page===void 0?io(e,t):Te(e,t)!==null}function io(e,t){return ro(e,t).length>0}function en(e,t){return Qt(e,t)?!1:e.page!==void 0&&qt.test(e.page)?jn(e.page,wt(t)):io(e,t)}var so={color:"color",background:"background",fontSize:"font-size",fontWeight:"font-weight",textAlign:"text-align",padding:"padding",margin:"margin",borderRadius:"border-radius",width:"width",height:"height",maxWidth:"max-width",border:"border",boxShadow:"box-shadow",opacity:"opacity",lineHeight:"line-height",letterSpacing:"letter-spacing",textTransform:"text-transform",gap:"gap",fontFamily:"font-family"},es=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function ao(e){var r;if(e.trim().length===0||/[;{}<>]/.test(e))return!1;let t=/([A-Za-z-]*)\(/g,n;for(;(n=t.exec(e))!==null;)if(!es.test((r=n[1])!=null?r:""))return!1;return!0}function ts(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 _t(e,t){let n=ts(e);n!==null?n.nodeValue=t:e.textContent=t}var Jn=/^https:\/\//i;function tn(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(Jn.test(e)||e[0]==="/"&&e[1]!=="/")?e:null}var lo=new Map,Fe=null;function ns(e){return e.replace(/["\\]/g,"\\$&")}function rs(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=[...lo.entries()].map(([n,r])=>`[data-snt-e="${ns(n)}"]{${r}}`).join(`
2
- `)}function uo(e,t,n,r){var l;let o=!1,s=(l=t.moveBefore)!=null?l: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"&&_t(e,t.text),typeof t.href=="string"&&Jn.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&Jn.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 u=so[i];u&&typeof c=="string"&&ao(c)&&a.push(`${u}:${c.trim()} !important`)}return a.length>0&&(e.setAttribute("data-snt-e",n),lo.set(n,a.join(";")),rs(r)),{anchorMiss:o}}var kt="data-sentient-block-arm",P=null;function Et(e){P=e!=null?e:null}var Ze=null;function xt(e){Ze=e!=null?e:null}var mo=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},go=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},Pe="data-sentient-blocks-hid",ct={none:"0",sm:"8px",md:"16px",lg:"24px"},Yn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},co={sm:"0.875em",md:"1em",lg:"1.25em"},os={sm:"1.25em",md:"1.5em",lg:"2em"},is={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},fo={sm:"8px",md:"16px",lg:"32px"},ss={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},as={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 po(e){return e==="muted"?P!=null&&P.muted?{color:P.muted}:{opacity:"0.7"}:e==="accent"?{"font-weight":"600",color:P==null?void 0:P.accent}:{}}function ho(e,t){let n=ls(e,t),r=go(e.like);return n&&r&&(n.style.color=r),n}function ls(e,t){var n,r,o,s,a,l,i,c,u,p,h,S,w,b,K,L,M,E,x,C;try{let R=mo(e.like),g=e.maxWidth==="measure"?"65ch":void 0,v=d=>(d.className=R,he(d,{"max-width":g}));switch(e.type){case"stack":case"grid":{let d=t.createElement("div");if(e.type==="stack"){let $=e;he(d,{display:"flex","flex-direction":$.direction,gap:(r=ct[(n=$.gap)!=null?n:"md"])!=null?r:ct.md,"align-items":$.align?Yn[$.align]:void 0,"justify-content":$.justify?Yn[$.justify]:void 0,"flex-wrap":$.wrap?"wrap":void 0})}else{let $=e,q=(s=ct[(o=$.gap)!=null?o:"md"])!=null?s:ct.md;he(d,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${$.columns-1} * ${q}) / ${$.columns})), 1fr))`,gap:q,"align-items":$.align?Yn[$.align]:void 0})}R&&(d.className=R);let m=!R&&e.type==="stack"&&e.surface==="raised",O=(a=e.pad)!=null?a:m?"md":void 0;O&&he(d,{padding:(l=ct[O])!=null?l:ct.md}),m&&he(d,{background:P==null?void 0:P.surface,color:P!=null&&P.surface?P==null?void 0:P.surfaceText:void 0,border:`1px solid ${(i=P==null?void 0:P.border)!=null?i:"currentColor"}`,"border-radius":(c=P==null?void 0:P.radius)!=null?c:"8px"});for(let $ of(u=e.children)!=null?u:[]){let q=ho($,t);q&&d.appendChild(q)}return d}case"text":{let d=t.createElement("p");return d.textContent=e.value,R?v(d):he(d,Ke(U({margin:"0","font-size":e.size?co[e.size]:void 0,"font-weight":e.weight?as[e.weight]:void 0,"text-align":e.align},po(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let d=t.createElement(`h${e.level}`);return d.textContent=e.value,R?v(d):he(d,{margin:"0","font-size":os[(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=tn(e.href);if(m&&(d.href=m),e.tag&&d.setAttribute("data-sentient-tag",e.tag),R)return v(d);let O=(h=e.emphasis)!=null?h:"primary";return he(d,{display:"inline-block",padding:is[(S=e.size)!=null?S:"md"],"border-radius":(w=P==null?void 0:P.radius)!=null?w:"8px",font:"inherit","font-size":e.size?co[e.size]:void 0,"text-decoration":O==="ghost"?"underline":"none",cursor:"pointer",background:O==="primary"?(b=P==null?void 0:P.primaryBg)!=null?b:"#111827":"transparent",color:O==="primary"?(K=P==null?void 0:P.primaryText)!=null?K:"#ffffff":(L=P==null?void 0:P.accent)!=null?L:"inherit",border:O==="secondary"?`1px solid ${(M=P==null?void 0:P.accent)!=null?M:"currentColor"}`:"none"})}case"link":{let d=t.createElement("a");d.textContent=e.label;let m=tn(e.href);return m&&(d.href=m),e.tag&&d.setAttribute("data-sentient-tag",e.tag),R?v(d):he(d,{color:"inherit","text-decoration":"underline"})}case"image":{let d=t.createElement("img"),m=tn(e.src);return m&&(d.src=m),d.alt=e.alt,R&&(d.className=R),he(d,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?ss[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,R?v(d):he(d,U({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(E=P==null?void 0:P.border)!=null?E:"currentColor"}`},po(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(x=fo[e.size])!=null?x:fo.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(C=P==null?void 0:P.border)!=null?C:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(R){return null}}function yo(e,t,n,r){var o,s;try{let a=new Set;for(let i of Array.from(e.children)){let c=i.getAttribute(kt);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 u="tree"in c?c:null,p=ho(u?u.tree:c,r);if(!p)continue;let h=r.createElement("div");h.setAttribute(kt,i),h.style.display="none";let S=u?mo((o=u.surface)==null?void 0:o.like):void 0;if(S){let w=r.createElement("div");w.className=S;let b=go((s=u.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 l=n!==void 0&&t[n]!==void 0;for(let i of Array.from(e.children)){let c=i.getAttribute(kt),u=i;c!==null?u.style.display=l&&c===n?"":"none":l?u.hasAttribute(Pe)||(u.setAttribute(Pe,u.style.display),u.style.display="none"):u.hasAttribute(Pe)&&(u.style.display=u.getAttribute(Pe),u.removeAttribute(Pe))}}catch(a){}}function us(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(kt)!==null){n.remove();continue}n.hasAttribute(Pe)&&(n.style.display=n.getAttribute(Pe),n.removeAttribute(Pe))}}catch(t){}}function nn(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${kt}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${Pe}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||us(r)}catch(n){}}function Xn(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function rn(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 on(e,t,n,r){var o;for(let[s,a]of Object.entries(t)){let l=e[s];if(!l||typeof l=="string")continue;let i=Xn(a.target,n);for(let c of i)for(let[u,p]of Object.entries(l))(o=a.dims[u])!=null&&o.includes(p)&&(c.setAttribute(`data-${u}`,p),r==null||r(c,`data-${u}`))}}function sn(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 l=Xn(s.target,n);for(let i of l)i.setAttribute("data-sentient-arm",a),r==null||r(i,"data-sentient-arm")}}function an(e,t,n,r){var l,i,c,u,p,h,S;let o=new Set,s=(l=r==null?void 0:r.contentAndOps)!=null?l:!0,a=[];for(let[w,b]of Object.entries(t)){if(Qt(b.locator,n))continue;let K;if(b.locator){let M=Te(b.locator,n);K=M?[M]:[],!M&&en(b.locator,n)&&a.push(w)}else K=Xn(b.target,n);let L=e[w];for(let M of K){if(L!==void 0)if(typeof L=="string")M.setAttribute("data-sentient-arm",L),(i=r==null?void 0:r.onAttr)==null||i.call(r,M,"data-sentient-arm"),s&&((c=r==null?void 0:r.onApplied)==null||c.call(r,w,L,M));else for(let[x,C]of Object.entries(L))M.setAttribute(`data-${x}`,C),(u=r==null?void 0:r.onAttr)==null||u.call(r,M,`data-${x}`);if((b.blocks||b.compose)&&!ds(n)){let x=Object.fromEntries([...Object.entries((p=b.blocks)!=null?p:{}).filter(([,C])=>!vt(C)),...Object.entries((h=b.compose)!=null?h:{}).filter(([,C])=>!vt(C.tree))]);Object.keys(x).length>0&&(yo(M,x,typeof L=="string"?L:void 0,n),o.add(M))}if(!s)continue;let E=M.textContent;b.edits?no(M,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"&&_t(M,b.content),b.ops&&uo(M,b.ops,w,n).anchorMiss&&!a.includes(w)&&a.push(w),Gn(M,Ke(U(U({previous:E},typeof L=="string"?{arm:L}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return nn(n,o),a}var cs=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function ds(e){var t,n,r;try{let o=(n=(t=e.defaultView)!=null?t:typeof window!="undefined"?window:void 0)==null?void 0:n.navigator;return o?o.webdriver===!0?!0:cs.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var fs=800;function ln(e,t,n){let r=[];return n.forEach(({slotId:o,arm:s,el:a},l)=>{r.push(Fn((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:l===0}));let i=null,c=0,u=()=>{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},fs)},p=()=>{i!==null&&(clearTimeout(i),i=null)};a.addEventListener("mouseenter",u),a.addEventListener("mouseleave",p),r.push(()=>{a.removeEventListener("mouseenter",u),a.removeEventListener("mouseleave",p),i!==null&&clearTimeout(i)})}),()=>{for(let o of r)o()}}function ps(e,t){if(!e)return!1;if(e==="/")return t==="/";let n=e.endsWith("/")?e.slice(0,-1):e;return t===n||t.startsWith(`${n}/`)}function bo(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var ms="_snt_fired_goals";function Zn(e,t){try{e==null||e.sessionStorage.removeItem(bo(t)),e==null||e.sessionStorage.removeItem(ms)}catch(n){}}function vo(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function gs(e,t){try{let n=e==null?void 0:e.sessionStorage.getItem(t);if(!n)return new Set;let r=JSON.parse(n);return Array.isArray(r)?new Set(r.filter(o=>typeof o=="string")):new Set}catch(n){return new Set}}function hs(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function So(e,t,n,r){var L,M;let o=(L=n.defaultView)!=null?L:typeof window!="undefined"?window:null,s=bo(r),a=gs(o,s),l=E=>{let x=vo(E);if(!a.has(x))try{E.slotId?t.componentGoal(E.slotId,E.goalId):t.goal(E.goalId),a.add(x),hs(o,s,a)}catch(C){}},i=e.filter(E=>E.event==="click"),c=e.filter(E=>E.event==="form_submit"),u=e.filter(E=>E.event==="url_reached"),p=e.filter(E=>E.event==="scroll_depth"),h=(E,x)=>{if(!E.locator)return!1;let C=Te(E.locator,n);return!!C&&(C===x||C.contains(x))},S=E=>{let x=E.target;if(!(!x||typeof x.closest!="function"))for(let C of i)h(C,x)&&l(C)},w=E=>{let x=E.target;if(x)for(let C of c)h(C,x)&&l(C)},b=()=>{if(u.length===0)return;let E=wt(n);for(let x of u)x.urlPattern&&ps(x.urlPattern,E)&&l(x)},K=()=>{var C;let E=n.documentElement,x=E.scrollHeight>0?(E.scrollTop+E.clientHeight)/E.scrollHeight:0;for(let R of p)x>=((C=R.threshold)!=null?C:.75)&&l(R);p.every(R=>a.has(vo(R)))&&n.removeEventListener("scroll",K)};return n.addEventListener("click",S,!0),n.addEventListener("submit",w,!0),(M=n.defaultView)==null||M.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 un(e,t){if(!e||e.length<2||t.size!==e.length)return null;let n=[];for(let a of e){let l=t.get(a);if(!l||n.includes(l))return null;n.push(l)}let r=n[0].parentNode;if(!r||!n.every(a=>a.parentNode===r))return null;let o=n.slice().sort((a,l)=>a.compareDocumentPosition(l)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),s=[];for(let a=0;a<n.length;a++){let l=n[a];o[a]!==l&&(s.push({el:l,before:o[a]}),o.splice(o.indexOf(l),1),o.splice(a,0,l))}return s}var ys="__snt_editor_token";function wo(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(ys):null}catch(e){return null}}function _o(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 At="0.33.0",fn=At!=="0.0.0-dev"?{name:"snippet",version:At}:void 0,To=At!=="0.0.0-dev"?{v:At}:{},ko=5e3,vs=50,Lo=(()=>{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,Ct=null,ie=null,se=null,It=0,V=null,Qe=null,Eo=!1,Qn=null,cn=null,Ot=null,ke=!1,Ue=!1,pn=!1,mn=0,Ro=e=>fe(e)===mn,dt=null,ce=!1,De=null,Ee=[],et=null,tt=null,ye=null,bs=3e3,Ss=100;function xo(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 Tt(e,t){return Z?(Z.personaAttributes&&V&&rn(V.persona,V.band,e,t==null?void 0:t.onAttr),on(be,Z.slots,e,t==null?void 0:t.onAttr),sn(be,Z.slots,e,t==null?void 0:t.onAttr),ve?an(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=Do[n])!=null?o:null,"fp_mismatch")}}),V?{persona:V.persona}:{})):(nn(e,new Set),[])):[]}function Po(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 er(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=un(e,Po(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function ws(e,t,n){let r=(o,s)=>t.some(([a,l])=>a===o&&l===s);try{if(Array.isArray(e.stamped))for(let o of e.stamped){if(!Array.isArray(o))continue;let[s,a,l]=o;!s||typeof a!="string"||r(s,a)||(l==null?s.removeAttribute(a):s.setAttribute(a,l))}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 _s(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function No(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function hn(e){var t;return(t=e.apiBase)!=null?t:"https://api.sentient-ui.com"}function ks(e){return Promise.resolve().then(()=>fetch(`${hn(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 tr(e,t){let n=[],r=[];for(let o of e)try{if(typeof(o==null?void 0:o.id)!="string")continue;!o.locator||oo(o.locator,t)?n.push(o.id):en(o.locator,t)&&r.push(o.id)}catch(s){}return[n,r]}var Do={};function Mo(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,l=a?Xt(a):null,i=l&&"fp"in l?l.fp:void 0;i&&(Do[o]=i),n[o]=Ke(U({},i?{fp:i}:{}),{forms:!1,compose:!0,content:!0})}return n}function $o(e,t){let n=null;for(let r of t)e!=null&&e[r]&&((n!=null?n:n={})[r]=e[r]);return n}var ue=null;function Bo(){if(!ke){ue&&et!==Oe()&&ue(!0);return}!De||et===Oe()||(et=Oe(),Es())}function Es(){ye==null||ye();let e=Z,t=De;if(!e||!t)return;let n,r,o=()=>{clearTimeout(n),clearTimeout(l),r==null||r.disconnect(),ye===o&&(ye=null)},s=null,a=i=>{let[c,u]=tr(t,document),p=c.filter(h=>!Ee.includes(h));s!==null&&c.some(h=>!s.has(h)&&!p.includes(h))&&Lt(),s=new Set(c),p.length>0&&xs(p).catch(()=>{}),(i||u.length===0&&!t.some(h=>!c.includes(h.id)&&!Ee.includes(h.id)))&&(o(),Ko(e,u))},l=setTimeout(()=>a(!0),bs);if(ye=o,a(),ye===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(a,Ss)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(i){}}function gn(e,t){if(!(!e||e.length===0||!t||!Z))try{Se==null||Se.teardown(),Se=So(e,t,document,Z.apiKey)}catch(n){}}async function xs(e){let t=Z,n=k;if(!t||!n)return;Ee=Ee.concat(e);let r=await n.decide(U({slotsFrom:"registry",registrySlotIds:e,render:Mo(e,document)},To));if(r||(Ee=Ee.filter(s=>!e.includes(s))),!r||ce||k!==n)return;be=U(U({},be),r.slots),!Se&&r.goals&&(t.consent!==!1||Ue)&&gn(Ct=r.goals,n);let o=$o(r.slotConfig,e);o&&(ve=U(U({},ve),o)),Lt(),Ne(t,"late decide",e),tt&&Ro(t.apiKey)&&Ve(t.apiKey,tt=U(Ke(U({},tt),{slots:be,savedAt:Date.now()}),ve?{slotConfig:ve}:{}))}function Ko(e,t){if(t.length!==0)try{fetch(`${hn(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 As(){if(!k||!Z||!nt()||se)return;let e=[];Tt(document,{contentAndOps:ke,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),rr();try{ie==null||ie(),ie=ln(k,Z.apiKey,e)}catch(t){}}function rr(){if(typeof document=="undefined"||!nt())return;let e;try{if(cn&&cn.length>0){let r=new Map;for(let o of cn){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=++It;Ot=window.location.pathname,ut("engagement.global.js","__sentientEngagement").then(r=>{if(!(!r||n!==It||k!==t||!t||!nt()))try{se==null||se(),se=r.startEngagementCapture(t,U({apiKey:Z.apiKey,apiBase:Z.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{}))}catch(o){}})}function Lt(){try{let e=[];if(ie==null||ie(),ie=null,Tt(document,{contentAndOps:ke,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),er(Qe,document),e.length>0&&nt())try{ie=ln(k,Z.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Ot!==null&&window.location.pathname!==Ot&&nt()&&(se==null||se(),se=null,It++,rr())}catch(t){}}catch(e){}}function Ao(){Qn===null&&(Qn=setTimeout(()=>{Qn=null,Lt();try{Se==null||Se.checkUrl()}catch(e){}Bo()},vs))}function jo(){if(!(Eo||typeof window=="undefined"||typeof history=="undefined")){Eo=!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 Ao(),a}};e("pushState"),e("replaceState"),window.addEventListener("popstate",Ao)}catch(e){}}}function dn(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 Cs(e,t,n){var r;try{window.__sentientEditor={token:t,code:n,apiBase:hn(e)};let o=e.editorSrc?{src:e.editorSrc}:zn("editor.global.js");if(!o){Io();return}let s=Ge(document.createElement("script"));Hn(s,o),s.async=!0,s.onerror=()=>Io(),((r=document.head)!=null?r:document.documentElement).appendChild(s)}catch(o){}}var Co="sentient-editor-load-notice";function Io(){var e;try{if(document.getElementById(Co))return;let t=document.createElement("div");t.id=Co,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 Is(e){let t={cfg:e,apiBase:hn(e),set(n){n.slots!==void 0&&(be=n.slots),n.slotConfig!==void 0&&(ve=n.slotConfig),n.persona!==void 0&&(V=n.persona),n.decided&&(ke=!0),n.look&&(Et(n.look.palette),xt(n.look.vocabulary))},apply:()=>Tt(document),installSpaHooks:jo,exposeGlobal:()=>{pn=!0,nr(e)},dbg:(...n)=>Ne(e,...n)};return ut("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 nr(e){let t=r=>{try{se==null||se(),se=null,It++,Ot=null,ie==null||ie(),ie=null,ye==null||ye(),Se==null||Se.teardown(),Se=null,r&&Zn(typeof window!="undefined"?window:null,e.apiKey),Ue=!1,ce=!0,r?(tt=null,V=null,k?k.destroy():st(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)mn=fe(e.apiKey),k=bt(U({apiKey:e.apiKey,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,ingestUrl:No(e)},fn?{sdk:fn}:{})),gn(Ct,k);else{let r=(k==null?void 0:k.gated)===!0;Un(e.apiKey),r&&(mn=fe(e.apiKey)),gn(Ct,k)}ce=!1,ue==null||ue()}catch(r){}Ue=!0;try{As()}catch(r){}},revokeConsent(){t(!0)},reapply:Lt,getState(){var r,o;try{return{apiKey:e.apiKey,persona:(r=V==null?void 0:V.persona)!=null?r:null,band:(o=V==null?void 0:V.band)!=null?o:null,slots:be,matchCounts:dn(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&&!dt&&!pn)try{let r=Xe(e.consentFrom),o=!1,s=!1,a=()=>!!k&&!ce&&(k.gated===void 0?e.consent!==!1||Ue:!k.gated);dt=r.subscribe(()=>{try{let l=r.read();l!==null&&(s=!0);let i=l!=null?l:s?!1:null,c=a(),u=!c&&i!==!0&&r.refused();if(u&&!o&&(k!=null&&k.gated?k.destroy():st(e.apiKey),Zn(window,e.apiKey),tt=null,V=null),o=u,i===!0&&!c)n.grantConsent();else if(i===!1&&c){let p=r.refused();t(p),p&&(o=!0)}}catch(l){}})}catch(r){}for(let r of Lo.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 Oo(){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})},Lo.length=0}catch(t){}}function Os(){try{let e=window.Shopify;return typeof(e==null?void 0:e.shop)=="string"&&e.shop!==""}catch(e){return!1}}async function Go(){var e,t;try{let n=Zt(window.sentient);if(!n){Oo();return}Z=n,dt==null||dt(),dt=null,!n.consentFrom&&n.consent===void 0&&Os()&&(n.consentFrom="shopify"),Xr(n.consentSrc),Ht(n.nonce),pn=!1,ke=!1,ue=null,Qe=null,be={},ve=null,Et(null),xt(null),Ue=!1,ce=!1,Ct=null,De=null,Ee=[],et=null,tt=null,ye==null||ye(),se==null||se(),se=null,It++,Ot=null;let r=_o("sentient_editor_code"),o=r?null:wo();if(r||o){Cs(n,o,r),pn=!0,nr(n),Ne(n,"editor mode");return}if(typeof window!="undefined"&&/[?&]sentient_(preview|persona|context)=[^&]/.test(window.location.search)&&await Is(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()&&ut("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?ks(n):null,l=_s();try{(t=l==null?void 0:l.stop)==null||t.call(l)}catch(d){}let i=n.consent!==!1&&!Ye()?it(n.apiKey):null,c=[];if(i){V={persona:i.persona,band:i.band},be=i.slots,i.slotConfig&&(ve=i.slotConfig),i.palette&&Et(i.palette),i.vocabulary&&xt(i.vocabulary),Tt(document,U({contentAndOps:!1},l?{onAttr:(m,O)=>c.push([m,O])}:{})),i.layoutOrder&&(Qe=i.layoutOrder,er(Qe,document));let d=yt(i.stage,n.stageAttributes);d&&(Vt(d),c.push([document.documentElement,"data-sentient-stage"]))}l&&ws(l,c,document);let u=bt(U({apiKey:n.apiKey,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,stageAttributes:n.stageAttributes,ingestUrl:No(n)},fn?{sdk:fn}:{}));k=u,mn=fe(n.apiKey),nr(n),jo();let p=Object.entries(n.slots).map(([d,m])=>({id:d,dims:m.dims})),h=To,S={pp:l?l.v:0},w=[];if(a){let[d]=await Promise.all([xo(a,ko),document.readyState==="loading"?new Promise(m=>document.addEventListener("DOMContentLoaded",m,{once:!0})):null]);De=d,d&&(Ee=w=tr(d,document)[0]),Ne(n,"registry scope",d&&w)}let b=(d=u)=>{let m=Array.from(Po(document).keys());return d.decide(U(U(U(U({slots:p},h),S),m.length>=2?{sections:m}:{}),s?{slotsFrom:"registry",registrySlotIds:w,render:Mo(w,document)}:{}))},K=Oe(),L=u.gated===!0,M=!1,E=!1,x=!1,C=!1;ue=(d=!1)=>{let m=k;!M||E||C||ke||ce||!m||m.gated||!d&&!x||(x=!1,C=!0,K=et=Oe(),De&&(Ee=w=tr(De,document)[0]),b(m).then(O=>{C=!1,O&&!ke&&!ce&&k===m?v(O):(O||(Ee=[]),!ke&&(m.released||k!==m||ce)&&(x=!0))}).catch(()=>{C=!1}))};let R=b();R.then(()=>{M=!0},()=>{M=!0});let g=await xo(R,ko),v=d=>{var $,q,J,Y,xe;E=!0;let m=(k!=null?k:u).getPersona();m?V={persona:m.persona,band:m.band}:d.persona&&(V={persona:d.persona,band:"low"}),be=d.slots,s?ve=$o(d.slotConfig,w):d.slotConfig&&(ve=d.slotConfig),d.palette&&Et(d.palette),d.vocabulary&&xt(d.vocabulary),Qe=($=d.layoutOrder)!=null?$:Qe;let O=()=>{var ne;let A=[],B=Tt(document,{onApplied:(re,Q,me)=>A.push({slotId:re,arm:Q,el:me})});s||Ko(n,B),er(Qe,document);try{(ne=l==null?void 0:l.reveal)==null||ne.call(l)}catch(re){}if(ke=!0,nt())try{ie==null||ie(),ie=ln(k,n.apiKey,A)}catch(re){}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",O,{once:!0}):O(),Ct=(q=d.goals)!=null?q:null,(n.consent!==!1||Ue)&&!ce&&gn(d.goals,k),cn=(J=d.sectionMap)!=null?J:null,nt()&&rr(),Ne(n,"applied",{persona:V,slots:be,matches:dn(n)}),!ce&&(Ro(n.apiKey)&&Ve(n.apiKey,tt=U(U(U(U({v:1,persona:(Y=V==null?void 0:V.persona)!=null?Y:d.persona,band:(xe=V==null?void 0:V.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}:{}),(A=>A?{stage:A}:{})(yt(d.stage,n.stageAttributes)))),et=null,Bo())};if(!g){Ne(n,"decide timeout/null \u2014 snapshot state stands",dn(n)),R.then(d=>{if(!d){if(ke)return;Ee=[],u.released===!0||k!==u||ce||L&&Oe()!==K?(x=!0,ue==null||ue()):et=K;return}if(!(!d||ke||ce)){if(k!==u){x=!0,ue==null||ue();return}v(d),Ne(n,"late decide applied",dn(n))}}).catch(()=>{});return}if(ce||k!==u){x=!0,ue==null||ue();return}v(g)}catch(n){Oo()}}if(typeof window!="undefined"&&window.sentient){let e=window;if(!e.__sentientInitialized)e.__sentientInitialized=!0,Promise.resolve().then(()=>{Go()});else{let t=window.__sentientApi;t&&Promise.resolve().then(()=>{window.SentientSnippet=t})}}return Xo(Ts);})();
1
+ "use strict";var SentientSnippet=(()=>{var $t=Object.defineProperty,Jo=Object.defineProperties,Yo=Object.getOwnPropertyDescriptor,Xo=Object.getOwnPropertyDescriptors,Zo=Object.getOwnPropertyNames,vr=Object.getOwnPropertySymbols;var Sr=Object.prototype.hasOwnProperty,Qo=Object.prototype.propertyIsEnumerable;var br=(e,t,n)=>t in e?$t(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,U=(e,t)=>{for(var n in t||(t={}))Sr.call(t,n)&&br(e,n,t[n]);if(vr)for(var n of vr(t))Qo.call(t,n)&&br(e,n,t[n]);return e},Ke=(e,t)=>Jo(e,Xo(t));var wr=(e,t)=>()=>(e&&(t=e(e=0)),t);var _r=(e,t)=>{for(var n in t)$t(e,n,{get:t[n],enumerable:!0})},ei=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of Zo(t))!Sr.call(e,o)&&o!==n&&$t(e,o,{get:()=>t[o],enumerable:!(r=Yo(t,o))||r.enumerable});return e};var ti=e=>ei($t({},"__esModule",{value:!0}),e);var ui,ci,di,Cr,fi,pi,Ir,j,qe,In=wr(()=>{"use strict";ui=Object.defineProperty,ci=Object.defineProperties,di=Object.getOwnPropertyDescriptors,Cr=Object.getOwnPropertySymbols,fi=Object.prototype.hasOwnProperty,pi=Object.prototype.propertyIsEnumerable,Ir=(e,t,n)=>t in e?ui(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,j=(e,t)=>{for(var n in t||(t={}))fi.call(t,n)&&Ir(e,n,t[n]);if(Cr)for(var n of Cr(t))pi.call(t,n)&&Ir(e,n,t[n]);return e},qe=(e,t)=>ci(e,di(t))});var Kr={};_r(Kr,{LOCAL_ENGINE_AVAILABLE:()=>yi,createLocalEngine:()=>vi});function vi(e){throw new Error("[sentient] createLocalEngine is not available in production builds. The local engine only exists under the `development` export condition.")}var yi,jr=wr(()=>{"use strict";yi=!1});var Rs={};_r(Rs,{applyPersonaAttributes:()=>on,applyRegistrySlots:()=>ln,applySlotArms:()=>an,applySlotAttributes:()=>sn,consentWatcher:()=>Xe,parseSnippetConfig:()=>Qt,planReorder:()=>cn,reapply:()=>Pt,run:()=>Wo,version:()=>Ct});function Ve(e){return e?`_${e.slice(0,12)}`:""}var We="_snt_uid";function ht(e){return`${We}${Ve(e)}`}var xn="__sntForgetGen",ni=()=>{try{return window[xn]}catch(e){return}};function Bt(e){var t,n;try{let r=window,o=(t=r[xn])!=null?t:r[xn]={};o[e]=((n=o[e])!=null?n:0)+1}catch(r){}}function fe(e){var t,n;return(n=(t=ni())==null?void 0:t[e])!=null?n:0}var ot="_snt_snap:",ri=["low","medium","high"];function it(e){try{let t=localStorage.getItem(ot+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"||!ri.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.stage!==void 0&&typeof n.stage!="string"&&delete n.stage,n}catch(t){return null}}function He(e,t){try{localStorage.setItem(ot+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 Cn(e,t){return new Promise(n=>{let r=setTimeout(()=>n(!1),t),o=()=>{clearTimeout(r),n(!0)};e.then(o,o)})}function ze(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function Kt(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 kr(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 An(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 Er(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 oi=500,ii=56*1024;function jt(e){return`_snt_retry_${e.slice(0,12)}`}var si={push:()=>{},flush:()=>{},destroy:()=>{}};function xr(e){var t,n,r;if(typeof window=="undefined")return si;let o=(t=e.flushIntervalMs)!=null?t:5e3,s=(n=e.maxBatchSize)!=null?n:20,a=(r=e.maxRetrySize)!=null?r:100,l=e.ingestUrl,i=e.apiKey,c=jt(i),u=!1,g=fe(i),y=(..._)=>{!u&&fe(i)===g&&An(..._)},S=[],w=new Set,b=[],$=_=>{for(let z of _)K.delete(z),!w.has(z)&&(w.add(z),b.push(z));for(;b.length>oi;){let z=b.shift();z&&w.delete(z)}Er(_,c)},K=new Set,A=()=>{for(;S.length>a;){let _=S.shift();_&&K.delete(_.id)}},C=_=>{w.has(_.id)||K.has(_.id)||(K.add(_.id),S.push(_),A())},I=_=>{for(let z of _)w.has(z.id)||(K.add(z.id),S.push(z));A()},M=kr(c,a);for(let _ of M)C(_);let L=0,m=0,v=(_,z=!0)=>{if(_.length===0)return;let _e=JSON.stringify(_),X=_.map(ge=>ge.id),ne,ce=je(15e3);try{ne=fetch(l,{method:"POST",keepalive:!0,signal:ce.signal,body:_e,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})}catch(ge){y(_,a,c),I(_),m++,L=Date.now()+ze(m);return}Promise.resolve(ne).then(ce.clear,ce.clear);let Ce=ge=>{if(Kt(ge)!=="retry"){if(!ge.ok&&z){let Q=_.filter($e=>$e.eventType!=="pageview");if(Q.length>0&&Q.length<_.length){$(_.filter($e=>$e.eventType==="pageview").map($e=>$e.id)),v(Q,!1);return}}$(X),m=0,L=0;return}y(_,a,c),I(_),m++,L=Date.now()+ze(m)};ne&&typeof ne.then=="function"?ne.then(Ce).catch(()=>{y(_,a,c),I(_),m++,L=Date.now()+ze(m)}):Ce(ne)},f=typeof TextEncoder!="undefined"?new TextEncoder:null,p=_=>f?f.encode(_).length:_.length,k=_=>{let z=[],_e=2;for(let X of _){let ne=p(JSON.stringify(X))+1;if(z.length>0&&_e+ne>ii||z.length>=s)break;z.push(X),_e+=ne}return z},D=()=>{try{if(Date.now()<L)return;for(;S.length>0&&!(Date.now()<L);){let _=S.filter(_e=>!w.has(_e.id));if(S.length=0,_.length===0)break;let z=k(_);if(z.length===0)break;z.length<_.length&&S.push(..._.slice(z.length)),v(z)}}catch(_){}},H=!0,Y=null;Y=setInterval(()=>{H&&D()},o);let le=()=>{document.visibilityState==="hidden"&&D()},we=()=>{D()};return document.addEventListener("visibilitychange",le),window.addEventListener("pagehide",we),{push(_){C(_),S.length>=s&&D()},flush:D,destroy(_){_!=null&&_.forget&&(u=!0),H=!1,Y!==null&&(clearInterval(Y),Y=null),document.removeEventListener("visibilitychange",le),window.removeEventListener("pagehide",we),D()}}}var ai=200;function Gt(e){return`_snt_goal_retry_${e.slice(0,12)}`}var li={send:()=>{},flush:()=>{},destroy:()=>{}};function Ar(e){var t,n,r;if(typeof window=="undefined")return li;let o=(t=e.flushIntervalMs)!=null?t:5e3,s=(n=e.maxRetrySize)!=null?n:100,a=(r=e.maxPerFlush)!=null?r:5,l=Gt(e.apiKey),i=!1,c=fe(e.apiKey),u=(...p)=>{!i&&fe(e.apiKey)===c&&An(...p)},g=[],y=new Set,S=new Set,w=[],b=0,$=0,K=!1,A=p=>{for(y.delete(p.id),S.has(p.id)||(S.add(p.id),w.push(p.id));w.length>ai;){let k=w.shift();k&&S.delete(k)}Er([p.id],l)},C=p=>{u([p],s,l),!S.has(p.id)&&!y.has(p.id)&&(y.add(p.id),g.push(p)),Date.now()>=b&&($++,b=Date.now()+ze($))},I=p=>{let k,D=je(15e3);try{k=fetch(e.url,{method:"POST",keepalive:!0,signal:D.signal,body:p.body,headers:e.headers})}catch(Y){C(p);return}let H=Y=>{var le;let we=Kt(Y);if(we==="retry"){C(p);return}we==="dropped"&&((le=e.onDrop)==null||le.call(e,p,Y.status)),A(p),$=0,b=0};Promise.resolve(k).then(D.clear,D.clear),k&&typeof k.then=="function"?k.then(H).catch(()=>C(p)):H(k)},M=()=>{try{if(K||Date.now()<b)return;let p=0;for(;g.length>0&&p<a&&!(Date.now()<b);){let k=g.shift();y.delete(k.id),!S.has(k.id)&&(p++,I(k))}}catch(p){}},L=kr(l,s);for(let p of L)y.has(p.id)||(y.add(p.id),g.push(p));L.length>0&&An(L,s,l);let m=setInterval(M,o),v=()=>{document.visibilityState==="hidden"&&M()},f=()=>M();return document.addEventListener("visibilitychange",v),window.addEventListener("pagehide",f),{send(p){if(K){S.has(p.id)||u([p],s,l);return}if(!(S.has(p.id)||y.has(p.id))){if(Date.now()<b){u([p],s,l),y.add(p.id),g.push(p);return}I(p)}},flush:M,destroy(p){p!=null&&p.forget&&(i=!0),clearInterval(m),document.removeEventListener("visibilitychange",v),window.removeEventListener("pagehide",f),M(),K=!0}}}function st(e){if(typeof window=="undefined"||!e)return!1;Bt(e);let t=!1,n=ht(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=Ve(e),o=[n,"_snt_graph_edges",ot+e,jt(e),Gt(e),`_snt_graph_nodes${r}`],s=[`_snt_asgn${r}_`];for(let a of["localStorage","sessionStorage"])try{let l=window[a];for(let i of o)l.getItem(i)!==null&&(l.removeItem(i),t=!0);for(let i=l.length-1;i>=0;i--){let c=l.key(i);c&&s.some(u=>c.startsWith(u))&&(l.removeItem(c),t=!0)}}catch(l){}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}In();function Ft(e){return Object.keys(e).sort().map(t=>`${t}=${e[t]}`).join("|")}function Or(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 On(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 Ft(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 Ft(o)}function Tr(e,t){var n,r;return e.dims!=null?(r=(n=Or(t))!=null?n:Or(On(e)))!=null?r:{}:t}function Je(e){return e>=.3?e<.7?"medium":"high":"low"}var Lr=["new","browsing","carted","customer","lapsed"];var gi=["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 Pr(e){return mi(e)!==null}function mi(e){var t;if(!e)return null;let n=e.toLowerCase();return(t=gi.find(r=>n.includes(r.toLowerCase())))!=null?t:null}function Rr(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 Nr(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 Mr(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var hi=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Dr(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):hi.includes(o)&&(o in n||(n[o]=s))}catch(r){}return{utmParams:t,clickIds:n}}function $r(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function Tn(e){return j(j(j({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 Ln(e){let t=Tn(e);return Tr(t,On(t))}function Br(e){return typeof e=="string"?e:Ft(e)}In();var $n;function Ht(e){$n=typeof e=="string"&&e!==""?e:void 0}function Wr(e=document){if($n)return $n;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=Wr(t);return n&&e.setAttribute("nonce",n),e}function zr(){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 Gr="_snt_uid",bi=365,at="_snt_uid";function Si(){return zr()}function Pn(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Gn(){try{return location.protocol==="https:"?"; Secure":""}catch(e){return""}}function wi(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=lax; path=/${Gn()}`}catch(r){}}function Ut(e){try{return localStorage.getItem(e)}catch(t){return null}}function Fr(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function Rn(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function _i(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function ki(e){try{sessionStorage.removeItem(e)}catch(t){}}function Ei(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=lax; path=/${Gn()}`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function xi(e){try{localStorage.removeItem(e)}catch(t){}}function Ai(e){try{document.cookie=`${e}=; max-age=0; SameSite=lax; path=/${Gn()}`}catch(t){}}var Ci={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function Hr(e){var t,n,r,o,s,a,l;if(typeof window=="undefined")return Ci;let i=Ve(e==null?void 0:e.apiKey),c=(t=e==null?void 0:e.cookieName)!=null?t:ht(e==null?void 0:e.apiKey),u=`${at}${i}`,g=`${at}_tomb${i}`,y=((n=e==null?void 0:e.cookieTTLDays)!=null?n:bi)*24*60*60,S=I=>I&&I.length>0?I:null,w=()=>{var I,M;return i&&!(e!=null&&e.cookieName)&&Ut(g)===null?(M=(I=S(Pn(Gr)))!=null?I:S(Ut(at)))!=null?M:S(Rn(at)):null},b=(l=(a=(s=(o=(r=S(Pn(c)))!=null?r:S(Ut(u)))!=null?o:S(Rn(u)))!=null?s:w())!=null?a:S(e==null?void 0:e.ssrSessionId))!=null?l:Si();wi(c,b,y);let $=Fr(u,b),K=Ei(c),A=$?!1:_i(u,b),C=!$&&!K&&!A;return{getSessionId:()=>b,isEphemeral:()=>C,destroy:()=>{b=null,Ai(c),xi(u),ki(u),i&&!(e!=null&&e.cookieName)&&(Pn(Gr)!==null||Ut(at)!==null||Rn(at)!==null)&&Fr(g,"1")}}}var Ii=1800*1e3;function Vt(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function Oi(e=Ii,t){let n=new Map,r=`_snt_asgn${Ve(t)}_`,o=(i,c)=>`${r}${encodeURIComponent(i)}:${encodeURIComponent(c)}`,s=i=>{let c=i.slice(r.length),u=c.indexOf(":");if(u<0)return null;try{return{componentId:decodeURIComponent(c.slice(0,u)),segment:decodeURIComponent(c.slice(u+1))}}catch(g){return null}},a=()=>{try{let i=[];for(let c=0;c<localStorage.length;c++){let u=localStorage.key(c);u!=null&&u.startsWith(r)&&i.push(u)}return i}catch(i){return[]}},l=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 u=JSON.parse(c);if(l(u)){localStorage.removeItem(i);continue}let g=s(i);if(!g)continue;n.set(Vt(g.componentId,g.segment),u)}catch(c){}})(),{get(i,c){let u=n.get(Vt(i,c));return u?l(u)?(n.delete(Vt(i,c)),null):u:null},set(i,c,u){let g=Vt(i,c);n.set(g,u);try{localStorage.setItem(o(i,c),JSON.stringify(u))}catch(y){}},clear(){n.clear();for(let i of a())try{localStorage.removeItem(i)}catch(c){}}}}var Bn="data-sentient-stage";function vt(e,t){return!t||typeof e!="string"||!(e==="returning"||Lr.includes(e))?null:t!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function qt(e,t=document){try{e?t.documentElement.setAttribute(Bn,e):t.documentElement.removeAttribute(Bn)}catch(n){}}var Kn="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",qr="[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.",Ur=!1,Wt=!1;function Ti(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function Li(e){var t;let n=Hr({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),r=(t=n.getSessionId())!=null?t:"local",o=Ti(),s=Promise.resolve().then(()=>(jr(),Kr)).then(u=>{let g=u;return g.LOCAL_ENGINE_AVAILABLE?(Ur||(Ur=!0,console.info(qr)),g):(Wt||(Wt=!0,console.error(Kn)),null)}).catch(()=>(Wt||(Wt=!0,console.error(Kn)),null)),a=null,l={low:.15,medium:.5,high:.85},i=(()=>{var u;if(e.initialPersona)return j({},e.initialPersona);let g=it(e.apiKey||"local");return g?{persona:g.persona,confidence:(u=l[g.band])!=null?u:.15}:null})();function c(u){let g=document.documentElement;g.dataset.sentientPersona===void 0&&(g.dataset.sentientPersona=u.persona,g.dataset.sentientConfidence=Je(u.confidence))}return{isLocal:!0,async decide(u){var g,y,S;let w=await s;if(!w)return null;let b=w.createLocalEngine({sessionId:r,forcedPersona:o}).decide(u);return a=qe(j({},b),{layoutOrder:(y=(g=b.layoutOrder)!=null?g:a==null?void 0:a.layoutOrder)!=null?y:null,slots:j(j({},(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(u){var g,y,S;return(S=(y=a==null?void 0:a.slots[u])!=null?y:(g=e.initialSlots)==null?void 0:g[u])!=null?S:null},getSlotConfig(u){var g,y;return(y=(g=e.initialSlotConfig)==null?void 0:g[u])!=null?y:null},getSitePalette(){var u;return(u=e.initialPalette)!=null?u:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let u=a!=null?a:i;return u?{persona:u.persona,confidence:u.confidence,band:Je(u.confidence)}:null},async assign(u,g){var y;let S=await s;return!S||!g||g.length===0?g!=null&&g[0]?{variantId:g[0],assignmentTtlMs:0}:null:{variantId:(y=S.createLocalEngine({sessionId:r,forcedPersona:o}).decide({components:[{id:u,variantIds:g}]}).assignments[u])!=null?y:g[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>n.destroy()}}var Jt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function Nn(e){let t=e.split(/[?#]/)[0]||"/";return t.length>1?t.replace(/\/+$/,"")||"/":t}function Fn(e,t){if(e===void 0||!Jt.test(e))return!1;if(e==="*")return!0;let n=Nn(t);if(e.endsWith("/*")){let r=Nn(e.slice(0,-2));return n.startsWith(r==="/"?"/":`${r}/`)&&n!==r}return n===Nn(e)}function Un(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 bt(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="form"?!0:Array.isArray(t.children)?t.children.some(bt):!1}var Vr="sentient-reveal",lt="sentient-revealed",Jr=240,Mn=!1;function Pi(e){if(Mn||e.getElementById(Vr)){Mn=!0;return}let t=Ge(e.createElement("style"),e);t.id=Vr,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${lt}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${lt}{animation:${lt} ${Jr}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),Mn=!0}function Vn(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;Pi(r),e.classList.remove(lt),e.offsetWidth,e.classList.add(lt);let o=()=>{e.classList.remove(lt),e.removeEventListener("animationend",o)};return e.addEventListener("animationend",o),!0}function Wn(e,t,n,r){let o=[];{let s=!1,a=[],l=()=>{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",l),o.push(()=>t.removeEventListener("click",l))}{let s=!1,a=l=>{if(s||!(l.target instanceof Node)||!t.contains(l.target)&&t!==l.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,l=null,i=()=>{l!==null&&(clearTimeout(l),l=null)},c=()=>{s||!a||(i(),l=setTimeout(()=>{!s&&a&&(s=!0,e("scroll_hesitation"))},3e3))},u=()=>{i(),c()},g=S=>{for(let w of S)a=w.intersectionRatio>.3,a?c():i()},y=new IntersectionObserver(g,{threshold:[.3]});y.observe(t),window.addEventListener("scroll",u,{passive:!0}),o.push(()=>{y.disconnect(),window.removeEventListener("scroll",u),i()})}if((r==null?void 0:r.tabLoss)!==!1){let s=!1,a=n!=null?n:Date.now(),l=()=>{if(s||document.visibilityState!=="hidden")return;let i=Date.now()-a;i<15e3&&(s=!0,e("tab_loss",{timeOnPage:i}))};document.addEventListener("visibilitychange",l),o.push(()=>document.removeEventListener("visibilitychange",l))}return()=>{for(let s of o)s()}}function Ri(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Yr="https://api.sentient-ui.com/v1/events",pe=new Map,Xr=null;function Ni(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Mi=3;function Dn(){return zr()}function zt(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Di(){let e=new WeakMap,t=new Map,n=!1,r=(l,i,c)=>{let u=l.get(i);return c===null?u?!0:(l.set(i,new Set),!1):u?u.has(c)?!0:(u.add(c),!1):(l.set(i,new Set([c])),!1)},o=typeof window!="undefined"&&"event"in window,s=()=>{if(!o)return;let l=window.event;return typeof Event=="function"&&l instanceof Event?l:void 0},a=()=>{if(o){Promise.resolve().then(()=>{n=!1,t.clear()});return}let l=!1,i=()=>{l||(l=!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(l,i){let c=s();if(c){let g=e.get(c);return g||(g=new Map,e.set(c,g)),r(g,l,i)}let u=r(t,l,i);return!u&&!n&&(n=!0,a()),u}}}var Zr=new Set;function $i(e,t,n){let r=typeof window=="undefined"?null:window.history;if(!r)return()=>{};let o=!1,s,a=()=>{if(o)return;let c=zt();!c||c===s||(s=c,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${c}`))},l=[];for(let c of["pushState","replaceState"]){let u=r[c],g=function(...y){let S=u.apply(this,y);return a(),S};r[c]=g,l.push([c,u,g])}window.addEventListener("popstate",a);let i=zt();return i&&Zr.has(`${t}:${i}`)?s=i:a(),()=>{if(!o){o=!0,window.removeEventListener("popstate",a);for(let[c,u,g]of l)r[c]===g&&(r[c]=u)}}}var yt={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function Bi(){try{return Dr(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Qr(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 zn(e){var t;if(typeof window=="undefined")return;let n=e!=null?e:Xr;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 l=(a!=null?a:St)(qe(j({},o),{consent:!0}));s(l);let i=(t=pe.get(n))==null?void 0:t.dispose;pe.set(n,{config:qe(j({},o),{consent:!0}),upgrade:null,dispose:i})}function Ki(e,t){var n;let r=e.preConsentBehavior==="statistical_winner",o=Qr((n=e.ingestUrl)!=null?n:Yr),s={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},a=new Map,l=new Map,i={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(m,v,f){if(!r)return Promise.resolve(null);let p=a.get(m);return p?Promise.resolve(p):jn(l,m,async()=>{try{let k=new URLSearchParams({componentId:m});for(let le of v!=null?v:[])k.append("variantIds[]",le);let D=je(5e3),H;try{let le=await fetch(`${o}/winner?${k.toString()}`,{headers:s,signal:D.signal});if(!le.ok)return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null;H=await le.json()}finally{D.clear()}let Y={variantId:H.variantId,assignmentTtlMs:0};return a.set(m,Y),Y}catch(k){return v!=null&&v[0]?{variantId:v[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},c=!1,u=new Set,g=[],y=[],S=[],w=()=>{for(let[,,m]of S.splice(0))m(null);b.length=0},b=[],$=!1,K=()=>{if(c)return;$=!0;let m=pe.get(e.apiKey);(m==null?void 0:m.upgrade)===L&&pe.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},A=[],C=()=>{setTimeout(()=>{var m;try{(m=A.shift())==null||m(i)}catch(v){}A.length&&C()})},I=m=>{c?A.length?A.push(m):m(i):!t&&!$&&b.length<100?b.push(m):$&&e.debug&&console.warn("[sentient] goal dropped: client released")},M={get gated(){return!c&&!t},get released(){return $&&!c},takeHeld:()=>b.splice(0),track:m=>i.track(m),goal:((m,v,f,p)=>I(k=>k.goal(m,v,f,p))),componentGoal:(m,v,f)=>i.componentGoal(m,v,f),identify:m=>i.identify(m),getAssignment:(m,v)=>i.getAssignment(m,v),isUnified:m=>{var v,f;return(f=(v=i.isUnified)==null?void 0:v.call(i,m))!=null?f:!1},assign:(m,v,f,p,k)=>i.assign(m,v,f,p,k),decide:m=>c?i.decide(m):$||t?Promise.resolve(null):new Promise(v=>S.push([m,Le(),v])),getSlotResult:m=>i.getSlotResult(m),isSlotDecided:m=>{var v,f;return(f=(v=i.isSlotDecided)==null?void 0:v.call(i,m))!=null?f:!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,f,p)=>i.reportSlots(m,v,f,p),reportSkeleton:(m,v)=>{var f;return(f=i.reportSkeleton)==null?void 0:f.call(i,m,v)},reportAgentData:(m,v,f)=>{var p;return(p=i.reportAgentData)==null?void 0:p.call(i,m,v,f)},reportDrift:(m,v,f,p)=>{var k;return(k=i.reportDrift)==null?void 0:k.call(i,m,v,f,p)},requestSlots:(m,v,f)=>{var p;return c?(p=i.requestSlots)==null?void 0:p.call(i,m,v,f):g.push([m,v,f])},decideSlots:m=>{var v;return c?(v=i.decideSlots)==null?void 0:v.call(i,m):y.push(...m)},cancelSlots:m=>{var v;if(c)return(v=i.cancelSlots)==null?void 0:v.call(i,m);let f=new Set(m);for(let p of g)p[0]=p[0].filter(k=>!f.has(k));y=y.filter(p=>!f.has(p.id))},onSlotsChanged:m=>(u.add(m),()=>{u.delete(m)}),getPersona:()=>i.getPersona(),getVisitorId:()=>{var m,v;return(v=(m=i.getVisitorId)==null?void 0:m.call(i))!=null?v:null},fetchWeights:()=>i.fetchWeights(),getGraph:()=>i.getGraph(),flush:()=>i.flush(),dispose:()=>(K(),w(),i.dispose()),destroy:()=>(K(),w(),c?i.destroy():st(e.apiKey))};function L(m){var v,f,p;i=m,c=!0,b.length&&(A.push(...b.splice(0)),C());let k=Le();for(let[D,H,Y]of S.splice(0))H!==k?Y(null):m.decide(D).then(Y,()=>Y(null));(v=m.onSlotsChanged)==null||v.call(m,()=>u.forEach(D=>D()));for(let[D,H,Y]of g.splice(0))D.length>0&&((f=m.requestSlots)==null||f.call(m,D,H,Y));y.length>0&&((p=m.decideSlots)==null||p.call(m,y.splice(0)))}return{proxy:M,setInner:L}}function Le(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function jn(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 St(e){var t,n,r,o,s,a,l,i,c,u,g;if(typeof window=="undefined")return yt;e.nonce&&Ht(e.nonce),Xr=e.apiKey||"local";let y=pe.get(e.apiKey||"local");if(y!=null&&y.dispose)try{y.dispose()}catch(d){}let S=e.respectDoNotTrack!==!1&&Ye(),w=e.consent===!1||S,b=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!b&&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."}),w?yt:Li(e);if(w){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."}),yt;let{proxy:d,setInner:h}=Ki(e,S);return pe.set(e.apiKey,{config:e,upgrade:S?null:h}),d}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."),yt;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),yt;let $=(t=e.ingestUrl)!=null?t:Yr,K=Date.now(),A=Hr({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),C=Oi(void 0,e.apiKey),I=!1,M=fe(e.apiKey),L=()=>!I&&fe(e.apiKey)===M,m=new Set((n=e.initialUnified)!=null?n:[]),v=qe(j({},C),{get:(d,h)=>m.has(d)?null:C.get(d,h),set:(...d)=>{L()&&C.set(...d)}}),f=xr({ingestUrl:$,apiKey:e.apiKey}),p=Qr($),k={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},D=new Set,H=Ar({url:`${p}/goals`,apiKey:e.apiKey,headers:k,onDrop:(d,h)=>{if(!e.debug){if(D.has(h))return;D.add(h)}console.warn(`[sentient] goal dropped (HTTP ${h}) \u2014 this will not be retried. `+(h===400?"The session was not found: call init() and let the session upsert complete before firing goals.":h===401||h===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),d)}}),Y=Rr((r=navigator.userAgent)!=null?r:""),le=window.location.origin,we=Nr((o=document.referrer)!=null?o:"",le),_=(s=e.sessionSegment)!=null?s:`${Y}:${we}`,z=new Map,_e=new Map,X=new Map,ne=new Set,ce=new Map,Ce=null,ge=null,Q=null,$e=new Set,Rt=new Set,vn=new Map,bn=new Map,ar=new Set,lr=new Set,ur=new Set,cr=new Set,Sn=null,ft=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,dr=new Set,Nt=new Set,Mt=new Set,pt=new Map,wn=null,Dt=new Set,gt=new Map,_n=null,zo=2,fr=new Map,ke=!1,pr=(d,h,P)=>{var F;let G=new Set,E=1;for(let O of d){h.delete(O);let T=((F=fr.get(O))!=null?F:0)+1;fr.set(O,T),T<=zo&&(G.add(O),T>E&&(E=T))}G.size>0&&setTimeout(()=>{ke||P(G)},ze(E))},kn=d=>{for(let h of d)X.has(h.id)||X.set(h.id,Ln(h))};if(e.initialSlots)for(let[d,h]of Object.entries(e.initialSlots))X.set(d,h),ne.add(d);if(e.initialSlotConfig)for(let[d,h]of Object.entries(e.initialSlotConfig))ce.set(d,h);e.initialPalette&&(Ce=e.initialPalette),e.initialVocabulary&&(ge=e.initialVocabulary);let Ie=it(e.apiKey);if(Ie){for(let[d,h]of Object.entries(Ie.slots))X.has(d)||X.set(d,h);for(let[d,h]of Object.entries((a=Ie.slotConfig)!=null?a:{}))ce.has(d)||ce.set(d,h);!Ce&&Ie.palette&&(Ce=Ie.palette),!ge&&Ie.vocabulary&&(ge=Ie.vocabulary)}let gr={low:.15,medium:.5,high:.85};if(e.initialPersona)Q=j({},e.initialPersona);else{let d=document.documentElement.dataset;d.sentientPersona?Q={persona:d.sentientPersona,confidence:(i=gr[(l=d.sentientConfidence)!=null?l:"low"])!=null?i:.15}:Ie&&(Q={persona:Ie.persona,confidence:(c=gr[Ie.band])!=null?c:.15})}if(e.initialAssignments)for(let[d,h]of Object.entries(e.initialAssignments))v.set(d,_,{variantId:h,assignedAt:Date.now(),segment:_,confidence:1});let Be=Promise.resolve(),mr=A.getSessionId();if(mr){let d=Mr((u=document.referrer)!=null?u:""),{utmParams:h,clickIds:P}=Bi(),F=j(j(j(j({sessionId:mr,deviceClass:Y,trafficSource:we,referrerDomain:d,utmParams:h,clickIds:P,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:$r(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:A.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Pr((g=navigator.userAgent)!=null?g:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),G=async()=>{for(let E=0;;E++){if(ke||!L())return;let O=je(5e3);try{let T=await fetch(`${p}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(F),headers:k,signal:O.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||Kt(T)==="dropped")return}catch(T){}finally{O.clear()}if(E>=Mi){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,ze(E+1)))}};try{Be=G()}catch(E){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:f});let Ho=Di(),mt=null,En=!1,ie={goal(d,h={},P=1,F=0){var G,E,O,T,V,W,q;let ee=A.getSessionId();if(!ee||ke||!L())return;let B=Ni(h)?h:{metadata:h},me=[d,(G=B.externalId)!=null?G:"",(E=B.stepIndex)!=null?E:F,(O=B.weight)!=null?O:P].join("\0"),Ee=B.value!==void 0?`${B.value}\0${(T=B.currency)!=null?T:""}`:null;if(Ho.firedBefore(me,Ee)){e.debug&&console.log(`[sentient] goal("${d}") already recorded for this action \u2014 not sent twice`);return}let de=Dn(),se={sessionId:ee,name:d,metadata:(V=B.metadata)!=null?V:{},weight:(W=B.weight)!=null?W:P,stepIndex:(q=B.stepIndex)!=null?q:F,goalId:de,value:B.value,currency:B.currency,externalId:B.externalId};e.debug&&console.log("[sentient] goal",se);let N={id:de,body:JSON.stringify(se)};Be.then(()=>H.send(N))},componentGoal(d,h,P){var F,G,E;let O=A.getSessionId();if(!O||ke||!L())return;let T=v.get(d,_),V=T?null:(F=X.get(d))!=null?F:null;if(!T&&V===null){e.debug&&console.warn(`[sentient] componentGoal("${d}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!T&&!ne.has(d)){e.debug&&console.warn(`[sentient] componentGoal("${d}"): slot not decided this session \u2014 not attributed`);return}let W=T?T.variantId:Br(V),q={id:Dn(),sessionId:O,projectId:e.apiKey,componentId:d,variantId:W,eventType:"goal_achieved",goalType:h,payload:j({reward:(G=P==null?void 0:P.reward)!=null?G:1,goalValue:P==null?void 0:P.value,currency:P==null?void 0:P.currency},(E=P==null?void 0:P.metadata)!=null?E:{}),timestamp:Date.now(),timeInSession:Date.now()-K,path:zt()};e.debug&&console.log("[sentient] componentGoal",q),Be.then(()=>{!ke&&L()&&f.push(q)})},identify(d){let h=A.getSessionId();!h||ke||!L()||Be.then(()=>{fetch(`${p}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:h,userId:d,ephemeral:A.isEphemeral()}),headers:k}).catch(()=>{})})},track(d){let h=A.getSessionId();if(!h||ke||!L()||d.eventType==="variant_assigned"&&X.get(d.componentId)!==void 0&&!ne.has(d.componentId)&&!v.get(d.componentId,_))return;let P=qe(j({path:zt()},d),{id:Dn(),sessionId:h,timestamp:Date.now(),timeInSession:Date.now()-K});e.debug&&console.log("[sentient] track",P),Be.then(()=>f.push(P))},getAssignment(d,h){return v.get(d,h)},isUnified:d=>m.has(d),async assign(d,h,P,F,G){var E;let O=A.getSessionId();if(!O)return null;let T=(G==null?void 0:G.unified)===!0;if(T&&m.has(d))return{variantId:(E=h==null?void 0:h[0])!=null?E:"",assignmentTtlMs:0,unified:!0};let V=v.get(d,_);if(V&&(h!=null&&h.length||V.content!==void 0)){let W=V.ttlMs&&V.ttlMs>0?Math.max(0,V.assignedAt+V.ttlMs-Date.now()):0;return{variantId:V.variantId,assignmentTtlMs:W,content:V.content}}return jn(z,T?`${d}\0unified`:d,async()=>{if(!await Cn(Be,2500)||ke||!L())return null;let W=je(3e4);try{let q={sessionId:O,componentId:d,variantIds:h};F!==void 0?q.agentDataByVariant=F:P!==void 0&&(q.agentData=P),T&&(q.caps={unified:!0});let ee=await fetch(`${p}/assign`,{method:"POST",body:JSON.stringify(q),headers:k,signal:W.signal});if(!ee.ok)return null;let B=await ee.json();return B.unified===!0?T?(m.add(d),{variantId:B.variantId,assignmentTtlMs:0,unified:!0}):null:(v.set(d,_,j({variantId:B.variantId,assignedAt:Date.now(),segment:_,confidence:1,content:B.content},B.assignmentTtlMs&&B.assignmentTtlMs>0?{ttlMs:B.assignmentTtlMs}:{})),B)}catch(q){return null}finally{W.clear()}})},async decide(d){var h,P;let F=A.getSessionId();if(!F)return null;let G=(h=d.slots)!=null?h:[],E={sessionId:F};d.sections&&d.sections.length>0&&(E.sections=d.sections.map(T=>({id:T}))),E.components=(P=d.components)!=null?P:[],G.length>0&&(E.slots=G.map(Tn)),d.slotsFrom==="registry"&&(E.slotsFrom="registry",d.registrySlotIds&&(E.registrySlotIds=d.registrySlotIds),d.bootstrap===!1&&(E.bootstrap=!1),d.render&&Object.keys(d.render).length>0&&(E.render=d.render)),d.v&&(E.v=d.v),typeof d.pp=="number"&&(E.pp=d.pp),e.persona&&(E.persona=e.persona);let O=JSON.stringify(E);return jn(_e,O,async()=>{var T,V,W,q,ee,B,me,Ee;if(!await Cn(Be,2500)||ke||!L())return kn(G),null;let de=je(3e4);try{let se=await fetch(`${p}/decide`,{method:"POST",body:O,headers:k,signal:de.signal});if(!se.ok)return kn(G),null;let N=await se.json(),Oe=vt(N.stage,e.stageAttributes);e.stageAttributes&&qt(Oe);let rt={};for(let Z of G){let Te=(T=N.slots)==null?void 0:T[Z.id];if(Te!==void 0){rt[Z.id]=Te,X.set(Z.id,Te),ne.add(Z.id);continue}let hr=X.get(Z.id);if(hr!==void 0)rt[Z.id]=hr;else{let yr=Ln(Z);rt[Z.id]=yr,X.set(Z.id,yr)}}if(N.slots)for(let[Z,Te]of Object.entries(N.slots))Z in rt||(rt[Z]=Te,X.set(Z,Te),ne.add(Z));let qo=Q!=null&&Q.persona!=="unknown";N.persona&&!(N.persona==="unknown"&&qo)?Q={persona:N.persona,confidence:(V=N.confidence)!=null?V:0}:Q||(Q={persona:"unknown",confidence:0});for(let[Z,Te]of Object.entries((W=N.assignments)!=null?W:{}))v.set(Z,_,{variantId:Te,assignedAt:Date.now(),segment:_,confidence:1});if(N.slotConfig)for(let[Z,Te]of Object.entries(N.slotConfig))ce.set(Z,Te);N.palette&&(Ce=N.palette),N.vocabulary&&(ge=N.vocabulary);for(let Z of(q=d.registrySlotIds)!=null?q:[])(ee=N.slotConfig)!=null&&ee[Z]||(ce.delete(Z),X.delete(Z),ne.delete(Z));return L()&&He(e.apiKey,j(j(j(j({v:1,persona:Q.persona,band:Je(Q.confidence),slots:Object.fromEntries(X),layoutOrder:(B=N.layoutOrder)!=null?B:null,savedAt:Date.now()},ce.size>0?{slotConfig:Object.fromEntries(ce)}:{}),Ce?{palette:Ce}:{}),ge?{vocabulary:ge}:{}),Oe?{stage:Oe}:{})),j(j(j(j(j(j(j({layoutOrder:(me=N.layoutOrder)!=null?me:null,assignments:(Ee=N.assignments)!=null?Ee:{},slots:rt,persona:Q.persona,confidence:Q.confidence},N.slotConfig?{slotConfig:N.slotConfig}:{}),N.goals?{goals:N.goals}:{}),N.sectionMap?{sectionMap:N.sectionMap}:{}),N.palette?{palette:N.palette}:{}),N.vocabulary?{vocabulary:N.vocabulary}:{}),N.stage?{stage:N.stage}:{}),N.context?{context:N.context}:{})}catch(se){return kn(G),null}finally{de.clear()}})},getSlotResult(d){var h;return(h=X.get(d))!=null?h:null},isSlotDecided(d){return ne.has(d)},getSlotConfig(d){var h;return(h=ce.get(d))!=null?h:null},reportSlots(d,h,P,F){var G;let E={};for(let[O,T]of Object.entries(F!=null?F:{}))for(let V of T){let W=`${O}|${V.key}`;!ft.test(O)||ur.has(W)||(ur.add(W),((G=E[O])!=null?G:E[O]=[]).push(V))}Object.keys(E).length>0&&fetch(`${p}/slots/observed`,{method:"POST",headers:k,body:JSON.stringify({slotIds:Object.keys(E),authoredArms:E})}).catch(()=>{});for(let O of d)if(!(typeof O!="string"||O.length===0)){if(!ft.test(O)){Ri()&&!dr.has(O)&&(dr.add(O),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(O)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!$e.has(O)){$e.add(O),Rt.add(O);let T=h==null?void 0:h[O];if(typeof T=="string"){let W=T.replace(/\s+/g," ").trim().slice(0,400);W!==""&&vn.set(O,W)}let V=P==null?void 0:P[O];V!==void 0&&bn.set(O,V)}}Rt.size===0||Sn!=null||(Sn=setTimeout(()=>{Sn=null;let O=[...Rt];Rt.clear();for(let T=0;T<O.length;T+=20){let V=O.slice(T,T+20),W={},q={};for(let ee of V){let B=vn.get(ee);B!==void 0&&(W[ee]=B,vn.delete(ee));let me=bn.get(ee);me!==void 0&&(q[ee]=me,bn.delete(ee))}fetch(`${p}/slots/observed`,{method:"POST",headers:k,body:JSON.stringify(j(qe(j(j({slotIds:V},Object.keys(W).length>0?{baselineTexts:W}:{}),Object.keys(q).length>0?{baselineSkeletons:q}:{}),{pagePaths:Object.fromEntries(V.map(ee=>[ee,location.pathname]))}),Object.keys(W).length>0&&A.getSessionId()?{sessionId:A.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(d,h){!ft.test(d)||ar.has(d)||(ar.add(d),fetch(`${p}/slots/observed`,{method:"POST",headers:k,body:JSON.stringify({slotIds:[d],baselineSkeletons:{[d]:h}})}).catch(()=>{}))},reportAgentData(d,h,P){let F=`${d}|${h}`;!ft.test(d)||cr.has(F)||(cr.add(F),fetch(`${p}/slots/observed`,{method:"POST",headers:k,body:JSON.stringify(j({slotIds:[d],agentData:{[d]:{[h]:P}}},h.startsWith("authored.")?{authoredArms:{[d]:[{key:h.slice(9)}]}}:{}))}).catch(()=>{}))},reportDrift(d,h,P,F){let G=`${d}|${h}`,E=A.getSessionId();!E||lr.has(G)||(lr.add(G),fetch(`${p}/slots/drift`,{method:"POST",headers:k,body:JSON.stringify({sessionId:E,reports:[{slotId:d,expectedFp:h,observedFp:P,reason:F}]})}).catch(()=>{}))},requestSlots(d,h,P){var F,G;for(let E of d)Mt.has(E)||(Mt.add(E),ft.test(E)?pt.set(E,{text:h==null?void 0:h[E],render:(F=P==null?void 0:P.render)==null?void 0:F[E],skeleton:(G=P==null?void 0:P.skeletons)==null?void 0:G[E]}):ie.reportSlots([E]));pt.size===0||wn!=null||(wn=setTimeout(()=>{wn=null;let E=[...pt];pt.clear();for(let O=0;O<E.length;O+=50){let T=E.slice(O,O+50),V={};for(let[W,q]of T)q.render&&(V[W]=q.render);ie.decide({slotsFrom:"registry",registrySlotIds:T.map(([W])=>W),bootstrap:!1,render:V}).then(W=>{var q,ee;if(W){let B={},me={},Ee=[];for(let[de,se]of T){let N=(q=W.slotConfig)==null?void 0:q[de];if(N){N.needsSkeleton&&se.skeleton&&((ee=ie.reportSkeleton)==null||ee.call(ie,de,se.skeleton));continue}Ee.push(de),se.text&&(B[de]=se.text),se.skeleton&&(me[de]=se.skeleton)}Ee.length>0&&ie.reportSlots(Ee,B,me)}else pr(T.map(([B])=>B),Mt,B=>{var me;let Ee={},de={},se={};for(let[N,Oe]of T)B.has(N)&&(Oe.text&&(Ee[N]=Oe.text),Oe.render&&(de[N]=Oe.render),Oe.skeleton&&(se[N]=Oe.skeleton));(me=ie.requestSlots)==null||me.call(ie,[...B],Ee,{render:de,skeletons:se})});Nt.forEach(B=>B())})}},0))},decideSlots(d){for(let h of d)Dt.has(h.id)||(Dt.add(h.id),gt.set(h.id,h));gt.size===0||_n!=null||(_n=setTimeout(()=>{_n=null;let h=[...gt.values()];gt.clear();for(let P=0;P<h.length;P+=30){let F=h.slice(P,P+30);ie.decide({slots:F}).then(G=>{G||pr(F.map(E=>E.id),Dt,E=>{var O;return(O=ie.decideSlots)==null?void 0:O.call(ie,F.filter(T=>E.has(T.id)))}),Nt.forEach(E=>E())})}},0))},cancelSlots(d){for(let h of d)pt.delete(h)&&Mt.delete(h),gt.delete(h)&&Dt.delete(h)},onSlotsChanged(d){return Nt.add(d),()=>{Nt.delete(d)}},getStyleVocabulary(){return ge},getSitePalette(){return Ce},getVisitorId:()=>L()?A.getSessionId():null,getPersona(){return Q?{persona:Q.persona,confidence:Q.confidence,band:Je(Q.confidence)}:null},async fetchWeights(){var d;let h=je(5e3);try{let P=await fetch(`${p}/weights`,{headers:k,signal:h.signal});return P.ok?(d=(await P.json()).components)!=null?d:[]:[]}catch(P){return[]}finally{h.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){f.flush(),H.flush()},dispose(){var d;mt==null||mt(),En=!0,ke=!0,f.destroy(),H.destroy(),((d=pe.get(e.apiKey))==null?void 0:d.dispose)===ie.dispose&&pe.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var d;mt==null||mt(),En=!0,ke=!0,I=!0,Bt(e.apiKey),f.destroy({forget:!0}),H.destroy({forget:!0}),A.destroy(),v.clear(),((d=pe.get(e.apiKey))==null?void 0:d.dispose)===ie.dispose&&pe.delete(e.apiKey);try{localStorage.removeItem(ot+e.apiKey),localStorage.removeItem(jt(e.apiKey)),localStorage.removeItem(Gt(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${Ve(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(h){}e.debug&&console.log("[sentient] destroyed")}};if(pe.set(e.apiKey,{config:e,upgrade:null,dispose:ie.dispose}),mt=$i(ie,e.apiKey,d=>{Be.then(()=>{En||Zr.add(d)})}),e.debug){let d=window;d.__sentient&&(d.__sentient.client=ie)}return ie}var Hn=/(^|\/)snippet(\.global)?(\.min)?\.js(\?|$)/,ji=(()=>{var e,t;try{return(t=(e=document.currentScript)==null?void 0:e.src)!=null?t:""}catch(n){return""}})(),Gi=/@\d+\.\d+\.\d+[^/]*\//;function qn(e){var t;try{let n=ji||((t=Array.from(document.getElementsByTagName("script")).find(r=>Hn.test(r.src)))==null?void 0:t.src);for(let r of n?[n]:[]){let o=Hn.test(r)?r.replace(Hn,`$1${e}$4`):r.replace(/[^/?#]*([?#].*)?$/,e),s=(e==="consent.global.js"?"sha384-+7/RqBOFLU5bMaQ6bcBAWzG589skmxN8tedG9hkoQQ6HaQkRRBJfoRVD94e/fJcM":e==="editor.global.js"?"sha384-72Hono7IkRYbjq4IW7kS54x23Y25GgaM7PBrQMFbhkh6hwhPmgMBWkiNA5GQHpgf":e==="preview.global.js"?"sha384-HXVsA3pP+RqWpZ/ydi1iDOLQQsWEQp5owt0/LwaWGSjxzXDFJZxxBuc/w9BkEqNL":"sha384-6/gH6glz7iEKNC/2t8v+wepAu08KsEzNhxY2hifY7Kud2GL4xUnl0ASRESRBtrZ6")||"";return Gi.test(o)&&s.indexOf("sha384-")===0?{src:o,integrity:s}:{src:o}}}catch(n){}return null}var Yt=new Map;function ut(e,t,n){let r=window[t];if(r)return Promise.resolve(r);let o=Yt.get(e);return o||(o=new Promise(s=>{var i;let a=n?{src:n}:qn(e);if(!a)return s(null);let l=Ge(document.createElement("script"));Jn(l,a),l.async=!0,l.onload=()=>{var u;let c=(u=window[t])!=null?u:null;c||Yt.delete(e),s(c)},l.onerror=()=>{Yt.delete(e),s(null)},((i=document.head)!=null?i:document.documentElement).appendChild(l)}),Yt.set(e,o)),o}function Jn(e,t){t.integrity&&(e.integrity=t.integrity,e.crossOrigin="anonymous"),e.src=t.src}var eo="__sentientConsent",Re=null,Yn=!1,Xt=new Set,Xn=()=>{let e=window[eo];return typeof(e==null?void 0:e.consentWatcher)=="function"?e.consentWatcher:null},wt;function to(e){wt=e}function Fi(){Re||(Re=Xn())||Yn||(Yn=!0,ut("consent.global.js",eo,wt).then(e=>{if(Yn=!1,!e)return Ui(wt!=null?wt:"consent.global.js");if(Re=Xn(),Re)for(let t of Array.from(Xt))t()}))}function Ui(e){console.warn(`[sentient] could not load ${e} \u2014 tracking stays off. Set window.sentient.consentSrc to its URL.`)}function Xe(e){Fi();let t=null,n=()=>(!t&&(Re!=null?Re:Re=Xn())&&(t=Re(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=()=>{Xt.delete(a);let l=n();s||!l||(o=l.subscribe(r),r())};return n()?(o=t.subscribe(r),Promise.resolve().then(()=>{s||r()})):Xt.add(a),()=>{s=!0,Xt.delete(a),o==null||o()}}}}function Vi(e){return e.replace(/\s+/g," ").trim().slice(0,300)}function no(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 Wi(e){let t=e.join("");return no(t,2166136261)+no(t,1523705862)}var zi=new Set(["A","BUTTON"]),Hi=/^H([1-6])$/,qi=new Set(["P","LI","LABEL","BLOCKQUOTE","FIGCAPTION","DT","DD","TD","TH"]);var Ji=new Set(["SCRIPT","STYLE","TEMPLATE","NOSCRIPT"]);function Yi(e){return zi.has(e.tagName)||e.getAttribute("role")==="button"?!0:e.tagName==="INPUT"&&/^(submit|button)$/i.test(e.type)}function Xi(e){if(Hi.test(e.tagName)||qi.has(e.tagName))return!0;let t=e.ownerDocument.defaultView,n=t?t.getComputedStyle(e).display:"";return n!==""&&n!=="inline"&&n!=="contents"}function Zi(e,t){let n=null;for(let r=e.parentElement;r&&r!==t.parentElement;r=r.parentElement){if(Yi(r)){n=r;break}if(r===t)break}if(n)return n;for(let r=e.parentElement;r;r=r.parentElement)if(r===t||Xi(r))return r;return t}function Zt(e,t=40){var n,r,o;let s=e.ownerDocument.createTreeWalker(e,4),a=[];for(let u=s.nextNode();u;u=s.nextNode())if(((n=u.nodeValue)!=null?n:"").trim()!==""&&!Ji.has((o=(r=u.parentElement)==null?void 0:r.tagName)!=null?o:"")&&(a.push(u),a.length>120))return{reason:"too_large"};if(a.length===0)return{reason:"empty"};let l=[],i=[];for(let u of a){let g=Zi(u,e),y=l.indexOf(g);y===-1&&(l.push(g),y=l.length-1),i.push(y)}if(l.length>t)return{reason:"too_large"};let c=a.map(u=>{var g;return Vi((g=u.nodeValue)!=null?g:"")});return{textNodes:a,ownerEls:l,leafToNode:i,leaves:c,fp:Wi(c)}}var ro=["cookiebot","onetrust","cookieyes","tcf","google-consent-mode","shopify"];function Qi(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 es(e){return!Array.isArray(e)||e.length<2||e.length>12||!e.every(t=>typeof t=="string")?null:e}function ts(e){try{return e()}catch(t){return}}function Qt(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[l,i]of Object.entries(t.slots)){if(typeof i!="object"||i===null)continue;let c=i,u=Qi(c.dims);if(!u||c.target!==void 0&&typeof c.target!="string")continue;let g=c.arms!==void 0?es(c.arms):null,y={dims:u};typeof c.target=="string"&&(y.target=c.target),g&&(y.arms=g),n[l]=y}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"&&ro.includes(o))r.consentFrom=o;else if(o&&typeof o=="object"&&!Array.isArray(o)){let l=o;typeof l.cmp=="string"&&ro.includes(l.cmp)||l.cmp===void 0&&(typeof l.cookie=="string"||typeof l.check=="function")?r.consentFrom=l:s("consentFrom")}else o!==void 0&&s("consentFrom");function s(l){r.consent=!1,console.warn(`[sentient] invalid ${l} \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),(t.stageAttributes===!0||t.stageAttributes==="detailed")&&(r.stageAttributes=t.stageAttributes),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"?ts(t.persona):t.persona;if(typeof a=="string"&&a.trim()!==""&&(r.persona=a),Array.isArray(t.sections)){let l=t.sections.filter(i=>typeof i=="string"&&i.trim()!=="").slice(0,50);l.length>=2&&(r.sections=l)}return r}var oo=new WeakMap;function io(e,t){return e.length===t.length&&e.every((n,r)=>n===t[r])}function so(e,t,n){var s,a,l;let r=oo.get(e);if(r){if(r.fp!==n.fp||!io(r.leafToNode,n.leafToNode))return"mismatch"}else{let i=Zt(e);if(!("fp"in i)||(r={fp:i.fp,leafToNode:i.leafToNode,textNodes:i.textNodes,ownerEls:i.ownerEls,classes:i.ownerEls.map(c=>{var u;return(u=c.getAttribute("class"))!=null?u:""})},r.fp!==n.fp||!io(r.leafToNode,n.leafToNode)))return"mismatch";oo.set(e,r)}let o=r;for(let[i,c]of Object.entries(t.nodes)){let u=Number(i),g=o.ownerEls[u];if(g){if(typeof c.text=="string"){let y=!0;o.leafToNode.forEach((S,w)=>{S===u&&(o.textNodes[w].nodeValue=y?c.text:"",y=!1)})}c.like!==void 0&&o.classes[c.like]!==void 0&&g.setAttribute("class",o.classes[c.like]),c.hidden&&((s=g.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),u=(l=c[0])==null?void 0:l.parentElement;if(!u||c.length!==i.length||c.some(w=>w.parentElement!==u))continue;let g=new Set(c),y=0;Array.from(u.children).map(w=>g.has(w)?c[y++]:w).forEach((w,b)=>{var $;u.children[b]!==w&&u.insertBefore(w,($=u.children[b])!=null?$:null)})}return"applied"}function _t(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 ns(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 en(e,t){return!!(e!=null&&e.urlMatch)&&!_t(t).includes(e.urlMatch)}var rs=/^[a-zA-Z_][-a-zA-Z0-9_]*$/;function ao(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)&&rs.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 Pe(e,t){if(e.urlMatch&&!_t(t).includes(e.urlMatch))return null;let n=ao(e,t);if(n.length!==1)return null;let r=n[0];return e.fingerprint&&!ns(r,e.fingerprint)?null:r}function lo(e,t){return en(e,t)?!1:!!e.selector&&!e.dataAttr&&!e.id&&!e.fingerprint&&e.page===void 0?uo(e,t):Pe(e,t)!==null}function uo(e,t){return ao(e,t).length>0}function tn(e,t){return en(e,t)?!1:e.page!==void 0&&Jt.test(e.page)?Fn(e.page,_t(t)):uo(e,t)}var co={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"},os=/^(rgb|rgba|hsl|hsla|calc|var|min|max|clamp)$/i;function fo(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(!os.test((r=n[1])!=null?r:""))return!1;return!0}function is(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 kt(e,t){let n=is(e);n!==null?n.nodeValue=t:e.textContent=t}var Zn=/^https:\/\//i;function nn(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(Zn.test(e)||e[0]==="/"&&e[1]!=="/")?e:null}var po=new Map,Fe=null;function ss(e){return e.replace(/["\\]/g,"\\$&")}function as(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=[...po.entries()].map(([n,r])=>`[data-snt-e="${ss(n)}"]{${r}}`).join(`
2
+ `)}function go(e,t,n,r){var l;let o=!1,s=(l=t.moveBefore)!=null?l:t.moveAfter;if(s){let i=Pe(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"&&kt(e,t.text),typeof t.href=="string"&&Zn.test(t.href)&&e.setAttribute("href",t.href),typeof t.imageSrc=="string"&&Zn.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 u=co[i];u&&typeof c=="string"&&fo(c)&&a.push(`${u}:${c.trim()} !important`)}return a.length>0&&(e.setAttribute("data-snt-e",n),po.set(n,a.join(";")),as(r)),{anchorMiss:o}}var Et="data-sentient-block-arm",R=null;function xt(e){R=e!=null?e:null}var Ze=null;function At(e){Ze=e!=null?e:null}var vo=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},bo=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},Ne="data-sentient-blocks-hid",ct={none:"0",sm:"8px",md:"16px",lg:"24px"},Qn={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},mo={sm:"0.875em",md:"1em",lg:"1.25em"},ls={sm:"1.25em",md:"1.5em",lg:"2em"},us={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},ho={sm:"8px",md:"16px",lg:"32px"},cs={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},ds={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 yo(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 So(e,t){let n=fs(e,t),r=bo(e.like);return n&&r&&(n.style.color=r),n}function fs(e,t){var n,r,o,s,a,l,i,c,u,g,y,S,w,b,$,K,A,C,I,M;try{let L=vo(e.like),m=e.maxWidth==="measure"?"65ch":void 0,v=f=>(f.className=L,he(f,{"max-width":m}));switch(e.type){case"stack":case"grid":{let f=t.createElement("div");if(e.type==="stack"){let D=e;he(f,{display:"flex","flex-direction":D.direction,gap:(r=ct[(n=D.gap)!=null?n:"md"])!=null?r:ct.md,"align-items":D.align?Qn[D.align]:void 0,"justify-content":D.justify?Qn[D.justify]:void 0,"flex-wrap":D.wrap?"wrap":void 0})}else{let D=e,H=(s=ct[(o=D.gap)!=null?o:"md"])!=null?s:ct.md;he(f,{display:"grid","grid-template-columns":`repeat(auto-fit, minmax(max(200px, calc((100% - ${D.columns-1} * ${H}) / ${D.columns})), 1fr))`,gap:H,"align-items":D.align?Qn[D.align]:void 0})}L&&(f.className=L);let p=!L&&e.type==="stack"&&e.surface==="raised",k=(a=e.pad)!=null?a:p?"md":void 0;k&&he(f,{padding:(l=ct[k])!=null?l:ct.md}),p&&he(f,{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 D of(u=e.children)!=null?u:[]){let H=So(D,t);H&&f.appendChild(H)}return f}case"text":{let f=t.createElement("p");return f.textContent=e.value,L?v(f):he(f,Ke(U({margin:"0","font-size":e.size?mo[e.size]:void 0,"font-weight":e.weight?ds[e.weight]:void 0,"text-align":e.align},yo(e.tone)),{"max-width":e.maxWidth==="measure"?"65ch":void 0}))}case"heading":{let f=t.createElement(`h${e.level}`);return f.textContent=e.value,L?v(f):he(f,{margin:"0","font-size":ls[(g=e.size)!=null?g:"md"],"text-align":e.align,"max-width":e.maxWidth==="measure"?"65ch":void 0})}case"button":{let f=t.createElement("a");f.textContent=e.label;let p=nn(e.href);if(p&&(f.href=p),e.tag&&f.setAttribute("data-sentient-tag",e.tag),L)return v(f);let k=(y=e.emphasis)!=null?y:"primary";return he(f,{display:"inline-block",padding:us[(S=e.size)!=null?S:"md"],"border-radius":(w=R==null?void 0:R.radius)!=null?w:"8px",font:"inherit","font-size":e.size?mo[e.size]:void 0,"text-decoration":k==="ghost"?"underline":"none",cursor:"pointer",background:k==="primary"?(b=R==null?void 0:R.primaryBg)!=null?b:"#111827":"transparent",color:k==="primary"?($=R==null?void 0:R.primaryText)!=null?$:"#ffffff":(K=R==null?void 0:R.accent)!=null?K:"inherit",border:k==="secondary"?`1px solid ${(A=R==null?void 0:R.accent)!=null?A:"currentColor"}`:"none"})}case"link":{let f=t.createElement("a");f.textContent=e.label;let p=nn(e.href);return p&&(f.href=p),e.tag&&f.setAttribute("data-sentient-tag",e.tag),L?v(f):he(f,{color:"inherit","text-decoration":"underline"})}case"image":{let f=t.createElement("img"),p=nn(e.src);return p&&(f.src=p),f.alt=e.alt,L&&(f.className=L),he(f,{display:"block","max-width":"100%","aspect-ratio":e.ratio&&e.ratio!=="auto"?cs[e.ratio]:void 0,"object-fit":e.fit,width:e.ratio&&e.ratio!=="auto"?"100%":void 0})}case"badge":{let f=t.createElement("span");return f.textContent=e.value,L?v(f):he(f,U({display:"inline-block",padding:"2px 10px","border-radius":"999px","font-size":"0.75em",border:`1px solid ${(C=R==null?void 0:R.border)!=null?C:"currentColor"}`},yo(e.tone)))}case"spacer":return he(t.createElement("div"),{height:(I=ho[e.size])!=null?I:ho.md});case"divider":return he(t.createElement("hr"),{border:"none","border-top":`1px solid ${(M=R==null?void 0:R.border)!=null?M:"currentColor"}`,margin:"0",width:"100%"});default:return null}}catch(L){return null}}function wo(e,t,n,r){var o,s;try{let a=new Set;for(let i of Array.from(e.children)){let c=i.getAttribute(Et);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 u="tree"in c?c:null,g=So(u?u.tree:c,r);if(!g)continue;let y=r.createElement("div");y.setAttribute(Et,i),y.style.display="none";let S=u?vo((o=u.surface)==null?void 0:o.like):void 0;if(S){let w=r.createElement("div");w.className=S;let b=bo((s=u.surface)==null?void 0:s.like);b&&(w.style.color=b),w.appendChild(g),y.appendChild(w)}else y.appendChild(g);e.appendChild(y)}let l=n!==void 0&&t[n]!==void 0;for(let i of Array.from(e.children)){let c=i.getAttribute(Et),u=i;c!==null?u.style.display=l&&c===n?"":"none":l?u.hasAttribute(Ne)||(u.setAttribute(Ne,u.style.display),u.style.display="none"):u.hasAttribute(Ne)&&(u.style.display=u.getAttribute(Ne),u.removeAttribute(Ne))}}catch(a){}}function ps(e){try{for(let t of Array.from(e.children)){let n=t;if(n.getAttribute(Et)!==null){n.remove();continue}n.hasAttribute(Ne)&&(n.style.display=n.getAttribute(Ne),n.removeAttribute(Ne))}}catch(t){}}function rn(e,t){try{let n=new Set;for(let r of Array.from(e.querySelectorAll(`[${Et}]`)))r.parentElement&&n.add(r.parentElement);for(let r of Array.from(e.querySelectorAll(`[${Ne}]`)))r.parentElement&&n.add(r.parentElement);for(let r of n)t.has(r)||ps(r)}catch(n){}}function er(e,t){if(!e)return[t.documentElement];try{return Array.from(t.querySelectorAll(e))}catch(n){return[]}}function on(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 sn(e,t,n,r){var o;for(let[s,a]of Object.entries(t)){let l=e[s];if(!l||typeof l=="string")continue;let i=er(a.target,n);for(let c of i)for(let[u,g]of Object.entries(l))(o=a.dims[u])!=null&&o.includes(g)&&(c.setAttribute(`data-${u}`,g),r==null||r(c,`data-${u}`))}}function an(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 l=er(s.target,n);for(let i of l)i.setAttribute("data-sentient-arm",a),r==null||r(i,"data-sentient-arm")}}function ln(e,t,n,r){var l,i,c,u,g,y,S;let o=new Set,s=(l=r==null?void 0:r.contentAndOps)!=null?l:!0,a=[];for(let[w,b]of Object.entries(t)){if(en(b.locator,n))continue;let $;if(b.locator){let A=Pe(b.locator,n);$=A?[A]:[],!A&&tn(b.locator,n)&&a.push(w)}else $=er(b.target,n);let K=e[w];for(let A of $){if(K!==void 0)if(typeof K=="string")A.setAttribute("data-sentient-arm",K),(i=r==null?void 0:r.onAttr)==null||i.call(r,A,"data-sentient-arm"),s&&((c=r==null?void 0:r.onApplied)==null||c.call(r,w,K,A));else for(let[I,M]of Object.entries(K))A.setAttribute(`data-${I}`,M),(u=r==null?void 0:r.onAttr)==null||u.call(r,A,`data-${I}`);if((b.blocks||b.compose)&&!ms(n)){let I=Object.fromEntries([...Object.entries((g=b.blocks)!=null?g:{}).filter(([,M])=>!bt(M)),...Object.entries((y=b.compose)!=null?y:{}).filter(([,M])=>!bt(M.tree))]);Object.keys(I).length>0&&(wo(A,I,typeof K=="string"?K:void 0,n),o.add(A))}if(!s)continue;let C=A.textContent;b.edits?so(A,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"&&kt(A,b.content),b.ops&&go(A,b.ops,w,n).anchorMiss&&!a.includes(w)&&a.push(w),Vn(A,Ke(U(U({previous:C},typeof K=="string"?{arm:K}:{}),(r==null?void 0:r.persona)!==void 0?{persona:r.persona}:{}),{doc:n}))}}return rn(n,o),a}var gs=/bot|crawler|spider|crawling|googlebot|bingbot|duckduckbot|baiduspider|yandexbot|slurp|gptbot|claudebot|anthropic|perplexity|ccbot|applebot|headlesschrome/i;function ms(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:gs.test((r=o.userAgent)!=null?r:""):!1}catch(o){return!1}}var hs=800;function un(e,t,n){let r=[];return n.forEach(({slotId:o,arm:s,el:a},l)=>{r.push(Wn((y,S={})=>{try{e.track({projectId:t,componentId:o,variantId:s,eventType:"micro_signal",payload:U({signalType:y},S)})}catch(w){}},a,void 0,{tabLoss:l===0}));let i=null,c=0,u=()=>{c=Date.now(),i=setTimeout(()=>{try{e.track({projectId:t,componentId:o,variantId:s,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-c}})}catch(y){}i=null},hs)},g=()=>{i!==null&&(clearTimeout(i),i=null)};a.addEventListener("mouseenter",u),a.addEventListener("mouseleave",g),r.push(()=>{a.removeEventListener("mouseenter",u),a.removeEventListener("mouseleave",g),i!==null&&clearTimeout(i)})}),()=>{for(let o of r)o()}}function ko(e){return e?`_snt_fired_goals_${e.slice(0,12)}`:"_snt_fired_goals"}var ys="_snt_fired_goals";function tr(e,t){try{e==null||e.sessionStorage.removeItem(ko(t)),e==null||e.sessionStorage.removeItem(ys)}catch(n){}}function _o(e){var t;return[(t=e.slotId)!=null?t:"",e.goalId,e.event,e.locator?JSON.stringify(e.locator):""].join("|")}function vs(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 bs(e,t,n){try{e==null||e.sessionStorage.setItem(t,JSON.stringify([...n]))}catch(r){}}function Eo(e,t,n,r){var K,A;let o=(K=n.defaultView)!=null?K:typeof window!="undefined"?window:null,s=ko(r),a=vs(o,s),l=C=>{let I=_o(C);if(!a.has(I))try{C.slotId?t.componentGoal(C.slotId,C.goalId):t.goal(C.goalId),a.add(I),bs(o,s,a)}catch(M){}},i=e.filter(C=>C.event==="click"),c=e.filter(C=>C.event==="form_submit"),u=e.filter(C=>C.event==="url_reached"),g=e.filter(C=>C.event==="scroll_depth"),y=(C,I)=>{if(!C.locator)return!1;let M=Pe(C.locator,n);return!!M&&(M===I||M.contains(I))},S=C=>{let I=C.target;if(!(!I||typeof I.closest!="function"))for(let M of i)y(M,I)&&l(M)},w=C=>{let I=C.target;if(I)for(let M of c)y(M,I)&&l(M)},b=()=>{if(u.length===0)return;let C=_t(n);for(let I of u)I.urlPattern&&Un(I.urlPattern,C)&&l(I)},$=()=>{var M;let C=n.documentElement,I=C.scrollHeight>0?(C.scrollTop+C.clientHeight)/C.scrollHeight:0;for(let L of g)I>=((M=L.threshold)!=null?M:.75)&&l(L);g.every(L=>a.has(_o(L)))&&n.removeEventListener("scroll",$)};return n.addEventListener("click",S,!0),n.addEventListener("submit",w,!0),(A=n.defaultView)==null||A.addEventListener("popstate",b),b(),g.length>0&&(n.addEventListener("scroll",$,{passive:!0}),$()),{checkUrl:b,teardown:()=>{var C;n.removeEventListener("click",S,!0),n.removeEventListener("submit",w,!0),(C=n.defaultView)==null||C.removeEventListener("popstate",b),g.length>0&&n.removeEventListener("scroll",$)}}}function cn(e,t){if(!e||e.length<2||t.size!==e.length)return null;let n=[];for(let a of e){let l=t.get(a);if(!l||n.includes(l))return null;n.push(l)}let r=n[0].parentNode;if(!r||!n.every(a=>a.parentNode===r))return null;let o=n.slice().sort((a,l)=>a.compareDocumentPosition(l)&Node.DOCUMENT_POSITION_FOLLOWING?-1:1),s=[];for(let a=0;a<n.length;a++){let l=n[a];o[a]!==l&&(s.push({el:l,before:o[a]}),o.splice(o.indexOf(l),1),o.splice(a,0,l))}return s}var Ss="__snt_editor_token";function xo(){try{return typeof sessionStorage!="undefined"?sessionStorage.getItem(Ss):null}catch(e){return null}}function Ao(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 Ct="0.33.1",pn=Ct!=="0.0.0-dev"?{name:"snippet",version:Ct}:void 0,No=Ct!=="0.0.0-dev"?{v:Ct}:{},Co=5e3,ws=50,Mo=(()=>{try{if(typeof window=="undefined")return[];let e=window.SentientSnippet;return Array.isArray(e==null?void 0:e.q)?e.q:[]}catch(e){return[]}})(),te=null,x=null,be={},ve=null,Se=null,It=null,re=null,oe=null,Ot=0,J=null,Qe=null,Io=!1,nr=null,dn=null,Tt=null,xe=!1,Ue=!1,gn=!1,mn=0,Do=e=>fe(e)===mn,dt=null,ue=!1,De=null,Ae=[],et=null,tt=null,ye=null,_s=3e3,ks=100;function Oo(e,t){let n,r=new Promise(o=>{n=setTimeout(()=>o(null),t)});return Promise.race([e,r]).then(o=>(clearTimeout(n),o),o=>{throw clearTimeout(n),o})}function Me(e,...t){e!=null&&e.debug&&console.log("[sentient-snippet]",...t)}function Lt(e,t){return te?(te.personaAttributes&&J&&on(J.persona,J.band,e,t==null?void 0:t.onAttr),sn(be,te.slots,e,t==null?void 0:t.onAttr),an(be,te.slots,e,t==null?void 0:t.onAttr),ve?ln(be,ve,e,U(Ke(U({},t),{onDrift:(n,r)=>{var o,s;return(s=x==null?void 0:x.reportDrift)==null?void 0:s.call(x,n,r,(o=Ko[n])!=null?o:null,"fp_mismatch")}}),J?{persona:J.persona}:{})):(rn(e,new Set),[])):[]}function $o(e){var n;let t=new Map;for(let r of(n=te==null?void 0:te.sections)!=null?n:[])try{let o=e.querySelectorAll(r);o.length===1&&t.set(r,o[0])}catch(o){}return t}function rr(e,t){var n,r;try{if(!e||e.length<2)return;for(let o of(n=cn(e,$o(t)))!=null?n:[])(r=o.before.parentNode)==null||r.insertBefore(o.el,o.before)}catch(o){}}function Es(e,t,n){let r=(o,s)=>t.some(([a,l])=>a===o&&l===s);try{if(Array.isArray(e.stamped))for(let o of e.stamped){if(!Array.isArray(o))continue;let[s,a,l]=o;!s||typeof a!="string"||r(s,a)||(l==null?s.removeAttribute(a):s.setAttribute(a,l))}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 xs(){try{let e=window.__sntPP;return e&&typeof e=="object"&&typeof e.v=="number"?e:null}catch(e){return null}}function Bo(e){return e.apiBase?`${e.apiBase.replace(/\/+$/,"")}/v1/events`:void 0}function yn(e){var t;return(t=e.apiBase)!=null?t:"https://api.sentient-ui.com"}function As(e){return Promise.resolve().then(()=>fetch(`${yn(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 or(e,t){let n=[],r=[];for(let o of e)try{if(typeof(o==null?void 0:o.id)!="string")continue;!o.locator||lo(o.locator,t)?n.push(o.id):tn(o.locator,t)&&r.push(o.id)}catch(s){}return[n,r]}var Ko={};function jo(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?Pe(s,t):null,l=a?Zt(a):null,i=l&&"fp"in l?l.fp:void 0;i&&(Ko[o]=i),n[o]=Ke(U({},i?{fp:i}:{}),{forms:!1,compose:!0,content:!0})}return n}function Go(e,t){let n=null;for(let r of t)e!=null&&e[r]&&((n!=null?n:n={})[r]=e[r]);return n}var ae=null;function Fo(){if(!xe){ae&&et!==Le()&&ae(!0);return}!De||et===Le()||(et=Le(),Cs())}function Cs(){ye==null||ye();let e=te,t=De;if(!e||!t)return;let n,r,o=()=>{clearTimeout(n),clearTimeout(l),r==null||r.disconnect(),ye===o&&(ye=null)},s=null,a=i=>{let[c,u]=or(t,document),g=c.filter(y=>!Ae.includes(y));s!==null&&c.some(y=>!s.has(y)&&!g.includes(y))&&Pt(),s=new Set(c),g.length>0&&Is(g).catch(()=>{}),(i||u.length===0&&!t.some(y=>!c.includes(y.id)&&!Ae.includes(y.id)))&&(o(),Uo(e,u))},l=setTimeout(()=>a(!0),_s);if(ye=o,a(),ye===o)try{r=new MutationObserver(()=>{clearTimeout(n),n=setTimeout(a,ks)}),r.observe(document.documentElement,{childList:!0,subtree:!0})}catch(i){}}function hn(e,t){if(!(!e||e.length===0||!t||!te))try{Se==null||Se.teardown(),Se=Eo(e,t,document,te.apiKey)}catch(n){}}async function Is(e){let t=te,n=x;if(!t||!n)return;Ae=Ae.concat(e);let r=await n.decide(U({slotsFrom:"registry",registrySlotIds:e,render:jo(e,document)},No));if(r||(Ae=Ae.filter(s=>!e.includes(s))),!r||ue||x!==n)return;be=U(U({},be),r.slots),!Se&&r.goals&&(t.consent!==!1||Ue)&&hn(It=r.goals,n);let o=Go(r.slotConfig,e);o&&(ve=U(U({},ve),o)),Pt(),Me(t,"late decide",e),tt&&Do(t.apiKey)&&He(t.apiKey,tt=U(Ke(U({},tt),{slots:be,savedAt:Date.now()}),ve?{slotConfig:ve}:{}))}function Uo(e,t){if(t.length!==0)try{fetch(`${yn(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!!(te&&x&&te.sectionCapture!==!1&&(te.consent!==!1||Ue)&&!Ye())}function Os(){if(!x||!te||!nt()||oe)return;let e=[];Lt(document,{contentAndOps:xe,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),sr();try{re==null||re(),re=un(x,te.apiKey,e)}catch(t){}}function sr(){if(typeof document=="undefined"||!nt())return;let e;try{if(dn&&dn.length>0){let r=new Map;for(let o of dn){if(o.urlMatch!==window.location.pathname)continue;let s=Pe(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=x,n=++Ot;Tt=window.location.pathname,ut("engagement.global.js","__sentientEngagement").then(r=>{if(!(!r||n!==Ot||x!==t||!t||!nt()))try{oe==null||oe(),oe=r.startEngagementCapture(t,U({apiKey:te.apiKey,apiBase:te.apiBase,doc:document,microSignals:!0},e?{typeOf:e}:{}))}catch(o){}})}function Pt(){try{let e=[];if(re==null||re(),re=null,Lt(document,{contentAndOps:xe,onApplied:(t,n,r)=>e.push({slotId:t,arm:n,el:r})}),rr(Qe,document),e.length>0&&nt())try{re=un(x,te.apiKey,e)}catch(t){}try{typeof window!="undefined"&&Tt!==null&&window.location.pathname!==Tt&&nt()&&(oe==null||oe(),oe=null,Ot++,sr())}catch(t){}}catch(e){}}function To(){nr===null&&(nr=setTimeout(()=>{nr=null,Pt();try{Se==null||Se.checkUrl()}catch(e){}Fo()},ws))}function Vo(){if(!(Io||typeof window=="undefined"||typeof history=="undefined")){Io=!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 To(),a}};e("pushState"),e("replaceState"),window.addEventListener("popstate",To)}catch(e){}}}function fn(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 Ts(e,t,n){var r;try{window.__sentientEditor={token:t,code:n,apiBase:yn(e)};let o=e.editorSrc?{src:e.editorSrc}:qn("editor.global.js");if(!o){Po();return}let s=Ge(document.createElement("script"));Jn(s,o),s.async=!0,s.onerror=()=>Po(),((r=document.head)!=null?r:document.documentElement).appendChild(s)}catch(o){}}var Lo="sentient-editor-load-notice";function Po(){var e;try{if(document.getElementById(Lo))return;let t=document.createElement("div");t.id=Lo,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 Ls(e){let t={cfg:e,apiBase:yn(e),set(n){n.slots!==void 0&&(be=n.slots),n.slotConfig!==void 0&&(ve=n.slotConfig),n.persona!==void 0&&(J=n.persona),n.decided&&(xe=!0),n.look&&(xt(n.look.palette),At(n.look.vocabulary))},apply:()=>Lt(document),installSpaHooks:Vo,exposeGlobal:()=>{gn=!0,ir(e)},dbg:(...n)=>Me(e,...n)};return ut("preview.global.js","__sentientPreview").then(n=>n?n.runPreview(t):Promise.reject()).catch(()=>(t.exposeGlobal(),Me(e,"preview chunk unavailable \u2014 page left as-is"),!0))}function ir(e){let t=r=>{try{oe==null||oe(),oe=null,Ot++,Tt=null,re==null||re(),re=null,ye==null||ye(),Se==null||Se.teardown(),Se=null,r&&tr(typeof window!="undefined"?window:null,e.apiKey),Ue=!1,ue=!0,r?(tt=null,J=null,x?x.destroy():st(e.apiKey)):x==null||x.dispose(),x=null}catch(o){}},n={consentWatcher:Xe,goal(r,o){try{x==null||x.goal(r,o)}catch(s){}},componentGoal(r,o){try{x==null||x.componentGoal(r,o)}catch(s){}},grantConsent(){try{if(!x&&ue||x!=null&&x.released)mn=fe(e.apiKey),x=St(U({apiKey:e.apiKey,consent:!0,preConsentBehavior:e.preConsentBehavior,debug:e.debug,persona:e.persona,ingestUrl:Bo(e)},pn?{sdk:pn}:{})),hn(It,x);else{let r=(x==null?void 0:x.gated)===!0;zn(e.apiKey),r&&(mn=fe(e.apiKey)),hn(It,x)}ue=!1,ae==null||ae()}catch(r){}Ue=!0;try{Os()}catch(r){}},revokeConsent(){t(!0)},reapply:Pt,getState(){var r,o;try{return{apiKey:e.apiKey,persona:(r=J==null?void 0:J.persona)!=null?r:null,band:(o=J==null?void 0:J.band)!=null?o:null,slots:be,matchCounts:fn(e),consent:!ue&&(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&&!dt&&!gn)try{let r=Xe(e.consentFrom),o=!1,s=!1,a=()=>!!x&&!ue&&(x.gated===void 0?e.consent!==!1||Ue:!x.gated);dt=r.subscribe(()=>{try{let l=r.read();l!==null&&(s=!0);let i=l!=null?l:s?!1:null,c=a(),u=!c&&i!==!0&&r.refused();if(u&&!o&&(x!=null&&x.gated?x.destroy():st(e.apiKey),tr(window,e.apiKey),tt=null,J=null),o=u,i===!0&&!c)n.grantConsent();else if(i===!1&&c){let g=r.refused();t(g),g&&(o=!0)}}catch(l){}})}catch(r){}for(let r of Mo.splice(0))try{r[0]==="goal"?n.goal(r[1],r[2]):r[0]==="grantConsent"&&x?n.grantConsent():r[0]==="revokeConsent"&&x&&n.revokeConsent()}catch(o){}}function Ro(){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})},Mo.length=0}catch(t){}}function Ps(){try{let e=window.Shopify;return typeof(e==null?void 0:e.shop)=="string"&&e.shop!==""}catch(e){return!1}}async function Wo(){var e,t;try{let n=Qt(window.sentient);if(!n){Ro();return}te=n,dt==null||dt(),dt=null,!n.consentFrom&&n.consent===void 0&&Ps()&&(n.consentFrom="shopify"),to(n.consentSrc),Ht(n.nonce),gn=!1,xe=!1,ae=null,Qe=null,be={},ve=null,xt(null),At(null),Ue=!1,ue=!1,It=null,De=null,Ae=[],et=null,tt=null,ye==null||ye(),oe==null||oe(),oe=null,Ot++,Tt=null;let r=Ao("sentient_editor_code"),o=r?null:xo();if(r||o){Ts(n,o,r),gn=!0,ir(n),Me(n,"editor mode");return}if(typeof window!="undefined"&&/[?&]sentient_(preview|persona|context)=[^&]/.test(window.location.search)&&await Ls(n))return;if(n.consentFrom&&n.consent===void 0)try{n.consent=Xe(n.consentFrom).read()===!0}catch(f){n.consent=!1}n.consent!==!1&&n.sectionCapture!==!1&&!Ye()&&ut("engagement.global.js","__sentientEngagement");let s=(e=n.registry)!=null?e:Object.keys(n.slots).length===0;n.registry===void 0&&!s&&Me(n,"slots declared without registry: true, so dashboard-published components are not applied");let a=s?As(n):null,l=xs();try{(t=l==null?void 0:l.stop)==null||t.call(l)}catch(f){}let i=n.consent!==!1&&!Ye()?it(n.apiKey):null,c=[];if(i){J={persona:i.persona,band:i.band},be=i.slots,i.slotConfig&&(ve=i.slotConfig),i.palette&&xt(i.palette),i.vocabulary&&At(i.vocabulary),Lt(document,U({contentAndOps:!1},l?{onAttr:(p,k)=>c.push([p,k])}:{})),i.layoutOrder&&(Qe=i.layoutOrder,rr(Qe,document));let f=vt(i.stage,n.stageAttributes);f&&(qt(f),c.push([document.documentElement,"data-sentient-stage"]))}l&&Es(l,c,document);let u=St(U({apiKey:n.apiKey,consent:n.consent,preConsentBehavior:n.preConsentBehavior,debug:n.debug,persona:n.persona,stageAttributes:n.stageAttributes,ingestUrl:Bo(n)},pn?{sdk:pn}:{}));x=u,mn=fe(n.apiKey),ir(n),Vo();let g=Object.entries(n.slots).map(([f,p])=>({id:f,dims:p.dims})),y=No,S={pp:l?l.v:0},w=[];if(a){let[f]=await Promise.all([Oo(a,Co),document.readyState==="loading"?new Promise(p=>document.addEventListener("DOMContentLoaded",p,{once:!0})):null]);De=f,f&&(Ae=w=or(f,document)[0]),Me(n,"registry scope",f&&w)}let b=(f=u)=>{let p=Array.from($o(document).keys());return f.decide(U(U(U(U({slots:g},y),S),p.length>=2?{sections:p}:{}),s?{slotsFrom:"registry",registrySlotIds:w,render:jo(w,document)}:{}))},$=Le(),K=u.gated===!0,A=!1,C=!1,I=!1,M=!1;ae=(f=!1)=>{let p=x;!A||C||M||xe||ue||!p||p.gated||!f&&!I||(I=!1,M=!0,$=et=Le(),De&&(Ae=w=or(De,document)[0]),b(p).then(k=>{M=!1,k&&!xe&&!ue&&x===p?v(k):(k||(Ae=[]),!xe&&(p.released||x!==p||ue)&&(I=!0))}).catch(()=>{M=!1}))};let L=b();L.then(()=>{A=!0},()=>{A=!0});let m=await Oo(L,Co),v=f=>{var D,H,Y,le,we;C=!0;let p=(x!=null?x:u).getPersona();p?J={persona:p.persona,band:p.band}:f.persona&&(J={persona:f.persona,band:"low"}),be=f.slots,s?ve=Go(f.slotConfig,w):f.slotConfig&&(ve=f.slotConfig),f.palette&&xt(f.palette),f.vocabulary&&At(f.vocabulary),Qe=(D=f.layoutOrder)!=null?D:Qe;let k=()=>{var _e;let _=[],z=Lt(document,{onApplied:(X,ne,ce)=>_.push({slotId:X,arm:ne,el:ce})});s||Uo(n,z),rr(Qe,document);try{(_e=l==null?void 0:l.reveal)==null||_e.call(l)}catch(X){}if(xe=!0,nt())try{re==null||re(),re=un(x,n.apiKey,_)}catch(X){}};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",k,{once:!0}):k(),It=(H=f.goals)!=null?H:null,(n.consent!==!1||Ue)&&!ue&&hn(f.goals,x),dn=(Y=f.sectionMap)!=null?Y:null,nt()&&sr(),Me(n,"applied",{persona:J,slots:be,matches:fn(n)}),!ue&&(Do(n.apiKey)&&He(n.apiKey,tt=U(U(U(U({v:1,persona:(le=J==null?void 0:J.persona)!=null?le:f.persona,band:(we=J==null?void 0:J.band)!=null?we:"low",slots:f.slots,layoutOrder:f.layoutOrder,savedAt:Date.now()},ve?{slotConfig:ve}:{}),f.palette?{palette:f.palette}:{}),f.vocabulary?{vocabulary:f.vocabulary}:{}),(_=>_?{stage:_}:{})(vt(f.stage,n.stageAttributes)))),et=null,Fo())};if(!m){Me(n,"decide timeout/null \u2014 snapshot state stands",fn(n)),L.then(f=>{if(!f){if(xe)return;Ae=[],u.released===!0||x!==u||ue||K&&Le()!==$?(I=!0,ae==null||ae()):et=$;return}if(!(!f||xe||ue)){if(x!==u){I=!0,ae==null||ae();return}v(f),Me(n,"late decide applied",fn(n))}}).catch(()=>{});return}if(ue||x!==u){I=!0,ae==null||ae();return}v(m)}catch(n){Ro()}}if(typeof window!="undefined"&&window.sentient){let e=window;if(!e.__sentientInitialized)e.__sentientInitialized=!0,Promise.resolve().then(()=>{Wo()});else{let t=window.__sentientApi;t&&Promise.resolve().then(()=>{window.SentientSnippet=t})}}return ti(Rs);})();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentientui/snippet",
3
- "version": "0.33.0",
3
+ "version": "0.33.1",
4
4
  "private": false,
5
5
  "description": "SentientUI Style-rung snippet for non-React sites — persona attributes and adaptive style tokens from one script tag",
6
6
  "license": "MIT",
@@ -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.38.0"
44
+ "@sentientui/core": "0.39.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",