@sentientui/react 0.37.5 → 0.39.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- var Hn=Object.defineProperty,Xn=Object.defineProperties;var zn=Object.getOwnPropertyDescriptors;var Re=Object.getOwnPropertySymbols;var Ct=Object.prototype.hasOwnProperty,At=Object.prototype.propertyIsEnumerable;var Rt=(e,t,n)=>t in e?Hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t)=>{for(var n in t||(t={}))Ct.call(t,n)&&Rt(e,n,t[n]);if(Re)for(var n of Re(t))At.call(t,n)&&Rt(e,n,t[n]);return e},I=(e,t)=>Xn(e,zn(t));var Ce=(e,t)=>{var n={};for(var r in e)Ct.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Re)for(var r of Re(e))t.indexOf(r)<0&&At.call(e,r)&&(n[r]=e[r]);return n};import{createContext as rr,useContext as j,useEffect as Y,useMemo as en,useRef as Q,useState as be,useSyncExternalStore as ir}from"react";import{deriveSessionSegment as or,init as sr}from"@sentientui/core";var _t=new Map,Ae=new Map;function Ot(e,t){let n=Ae.get(e);return n||(n=new Set,Ae.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&Ae.delete(e)}}function Et(e,t){_t.set(e,t);let n=Ae.get(e);if(n)for(let r of n)try{r(t)}catch(i){}}function Je(e){var t;return(t=_t.get(e))!=null?t:null}var qn={on:!1,listeners:new Set};function Pt(){if(typeof window=="undefined")return qn;let e=window;return e.__sentient_preview||(e.__sentient_preview={on:!1,listeners:new Set}),e.__sentient_preview}function Ue(){return Pt().on}function Gt(e){let t=Pt().listeners;return t.add(e),()=>{t.delete(e)}}function Tt(e){return{isLocal:e.isLocal,track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},fetchWeights:()=>Promise.resolve([]),getAssignment:(t,n)=>e.getAssignment(t,n),assign:(t,n,r,i)=>e.assign(t,n,r,i),decide:()=>Promise.resolve(null),getSlotResult:t=>e.getSlotResult(t),getSlotConfig:t=>e.getSlotConfig(t),getSitePalette:()=>e.getSitePalette(),reportSlots:t=>e.reportSlots(t),getPersona:()=>e.getPersona(),getGraph:()=>e.getGraph(),flush:()=>e.flush(),dispose:()=>e.dispose(),destroy:()=>e.destroy()}}var He="sentient:overrides-changed";function Nt(){var e;return typeof window=="undefined"?0:(e=window.__sentient_overrides_version)!=null?e:0}function Xe(){var t;if(typeof window=="undefined")return;let e=window;e.__sentient_overrides_version=((t=e.__sentient_overrides_version)!=null?t:0)+1,window.dispatchEvent(new Event(He))}function K(e){return typeof window=="undefined"?()=>{}:(window.addEventListener(He,e),()=>window.removeEventListener(He,e))}function It(e){typeof window!="undefined"&&(window.__sentient_devtools_config=e)}function N(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}function J(e){return typeof e=="string"?{type:"click"}:e}function te(e){return typeof e=="string"?e:e.type}function z(e){if(typeof e!="string"&&(e.type==="click"||e.type==="form_submit"||e.type==="scroll_depth"))return e.value}var ze=new Set,qe=!1;function Lt(e){if(ze.has(e))return!0;if(ze.add(e),!qe){qe=!0;let t=()=>{qe=!1,ze.clear()};if(typeof MessageChannel=="function"){let n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),n.port2.close(),t()},n.port2.postMessage(0)}else setTimeout(t,0)}return!1}function Yn(e){if(!(e instanceof Element))return!1;let t=e.tagName.toLowerCase();return t==="a"||t==="button"?!0:e.getAttribute("role")==="button"}function Dt(e,t,n){if(n){try{let i=e;for(;i&&i!==t;){if(i.matches(n))return!0;i=i.parentElement}}catch(i){}return!1}let r=e;for(;r&&r!==t;){if(Yn(r))return!0;r=r.parentElement}return!1}function q(e,t,n,r){if(t.type==="weighted_composite"){let a=new Set,p=[];return t.steps.forEach(({goal:u,name:h,weight:A},w)=>{let o=(m=!1)=>{a.has(w)||m&&r!==void 0&&Lt(`step\0${h}\0${A}\0${w}`)||(a.add(w),n.fireStep(h,A,w))};if(u.type==="click"){let m=v=>{let f=v.target;f instanceof Element&&Dt(f,e,u.selector)&&o()};e.addEventListener("click",m),p.push(()=>e.removeEventListener("click",m));return}if(u.type==="form_submit"){let m=v=>{v.target instanceof HTMLFormElement&&e.contains(v.target)&&o()};e.addEventListener("submit",m),p.push(()=>e.removeEventListener("submit",m));return}if(u.type==="scroll_depth"){let m=Math.max(0,Math.min(1,u.threshold)),v=new IntersectionObserver(f=>{for(let b of f)if(b.intersectionRatio>=m){o(!0),v.disconnect();break}},{threshold:[m]});v.observe(e),p.push(()=>v.disconnect())}}),()=>{for(let u of p)u()}}let i=t.type==="composite"?t.all:[t],l=new Set(i.map((a,p)=>p)),d=()=>{r!==void 0&&Lt(r)||n.fireGoal()},c=(a,p=!1)=>{l.delete(a),l.size===0&&(p?d():n.fireGoal())},s=[];return i.forEach((a,p)=>{if(a.type==="click"){let u=h=>{let A=h.target;A instanceof Element&&Dt(A,e,a.selector)&&(t.type==="composite"?c(p):n.fireGoal())};e.addEventListener("click",u),s.push(()=>e.removeEventListener("click",u));return}if(a.type==="form_submit"){let u=h=>{h.target instanceof HTMLFormElement&&e.contains(h.target)&&(t.type==="composite"?c(p):n.fireGoal())};e.addEventListener("submit",u),s.push(()=>e.removeEventListener("submit",u));return}if(a.type==="scroll_depth"){let u=Math.max(0,Math.min(1,a.threshold)),h=new IntersectionObserver(A=>{for(let w of A)if(w.intersectionRatio>=u){t.type==="composite"?c(p,!0):d(),h.disconnect();break}},{threshold:[u]});h.observe(e),s.push(()=>h.disconnect());return}}),()=>{for(let a of s)a()}}var Vt=new Set,Ft=new Set;function ce(e,t,n,r,i){let l=`${r}|${n}`;if(Ft.has(l))return;Ft.add(l);let d=i.type==="weighted_composite"&&!Vt.has(r);d&&Vt.add(r),e.track({projectId:t,componentId:n,eventType:"funnel_declared",payload:d?{funnelId:r,steps:i.steps.map(c=>({goalId:c.name,weight:c.weight}))}:{funnelId:r}})}function ne(e,t,n,r){e.track({projectId:t,componentId:n,variantId:r,eventType:"variant_assigned",payload:{}})}var Zn={components:new Map,slots:new Map,sections:[],listeners:new Set,version:0};function oe(){if(typeof window=="undefined")return Zn;let e=window;return e.__sentient_registry||(e.__sentient_registry={components:new Map,slots:new Map,sections:[],listeners:new Set,version:0}),e.__sentient_registry}function he(){oe().version+=1;for(let e of oe().listeners)e()}var Mt=()=>{};function Bt(e){return N()?(oe().components.set(e.id,e),he(),()=>{oe().components.delete(e.id),he()}):Mt}function de(e){return N()?(oe().slots.set(e.id,e),he(),()=>{oe().slots.delete(e.id),he()}):Mt}function Ye(e){N()&&(oe().sections=[...e],he())}var $t="0.37.5",Ze=$t!=="0.0.0-dev"?{name:"react",version:$t}:void 0;function Qn(){let e=window;return e.__sentient_slot_config_overrides||(e.__sentient_slot_config_overrides={}),e.__sentient_slot_config_overrides}function fe(e,t){Qn()[e]=t}function jt(e){window.__sentient_vocabulary_override=e}function Wt(){var e;return typeof window=="undefined"?null:(e=window.__sentient_vocabulary_override)!=null?e:null}function er(){let e=window;return e.__sentient_slot_overrides||(e.__sentient_slot_overrides={}),e.__sentient_slot_overrides}function ge(e,t){er()[e]=t}function Kt(e){let t=null;try{let n=location.hash.slice(1),r=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(r){t=r[2];let i=n.slice(r.index+r[0].length);r[1]!="&"&&i[0]=="&"&&(i=r[1]+i.slice(1));let l=n.slice(0,r.index)+i;history.replaceState(history.state,"",l?"#"+l:location.pathname+location.search)}}catch(n){}return t}var et="__snt_editor_token",me=null,Qe=!1;function Jt(){return Qe}function tr(){try{return sessionStorage.getItem(et)}catch(e){return null}}function _e(e){if(me)return me;let t=typeof window=="undefined"?null:Kt("sentient_editor_code");if(!t){let n=typeof window=="undefined"?null:tr();return Qe=!!n,me=Promise.resolve(n?{token:n,fresh:!1}:null),me}return Qe=!0,me=fetch(`${e}/editor/exchange`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:t})}).then(async n=>{let r=n.ok?(await n.json()).token:void 0;if(!r)return{error:n.ok?500:n.status};try{sessionStorage.setItem(et,r)}catch(i){}return{token:r,fresh:!0}}).catch(()=>({error:0})),me}function Ut(){try{sessionStorage.removeItem(et)}catch(e){}}var Ht="sentient_preview_cell",Xt="sentient_refresh_region",tt="sentient-cell-preview-bar",se="__preview__",pe=null;function zt(e){if((pe==null?void 0:pe.slotId)!==e)return null;let t=pe;return pe=null,t}function qt(e,t){e.session.then(n=>{if(!n||!("token"in n))throw new Error("no editor session");return fetch(`${e.base}/editor/region-skeleton`,{method:"POST",headers:{authorization:`Bearer ${n.token}`,"content-type":"application/json"},body:JSON.stringify(y({slotId:e.slotId},t))})}).then(n=>ae(n.ok?"Region refreshed \u2014 you can regenerate its versions now.":"Couldn\u2019t refresh this region \u2014 reopen the link from your dashboard.")).catch(()=>ae("Couldn\u2019t refresh this region \u2014 check your connection and reopen the link from your dashboard."))}function Yt(e){if(typeof window=="undefined"||typeof document=="undefined"||document.getElementById(tt))return;let t,n;try{let s=new URLSearchParams(window.location.search);t=s.get(Ht),n=s.get(Xt)}catch(s){return}if(!t&&!n)return;let r=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,""),i=_e(r);if(!Jt())return;if(n){pe={slotId:n,session:i,base:r},fe(n,{kind:"arms"}),ge(n,se),Xe();return}if(!t)return;let l=t.lastIndexOf("~");if(l<=0)return;let d=t.slice(0,l),c=t.slice(l+1);i.then(s=>s?"token"in s?fetch(`${r}/editor/cell-preview?slotId=${encodeURIComponent(d)}&persona=${encodeURIComponent(c)}`,{headers:{authorization:`Bearer ${s.token}`}}):(ae(s.error===401?"This preview link has expired \u2014 reopen it from your dashboard.":"Couldn\u2019t load this preview \u2014 reopen it from your dashboard."),null):null).then(async s=>{if(!s)return;if(!s.ok){ae(s.status===401?"This preview link has expired \u2014 reopen it from your dashboard.":"Couldn\u2019t load this preview \u2014 reopen it from your dashboard.");return}let a=await s.json();if(a.vocabulary&&Array.isArray(a.vocabulary.entries)&&jt(a.vocabulary),a.compose!=null)fe(d,{kind:"arms",compose:{[se]:a.compose}}),ge(d,se);else if(a.edits!=null&&typeof a.skeletonFp=="string"&&Array.isArray(a.leafToNode))fe(d,{kind:"arms",edits:{edits:a.edits,fp:a.skeletonFp,leafToNode:a.leafToNode}}),ge(d,se);else if(a.blocks!=null)fe(d,{kind:"arms",blocks:{[se]:a.blocks}}),ge(d,se);else if(a.content!=null)fe(d,{kind:"arms",content:a.content}),ge(d,se);else{ae("Nothing to preview in that square yet.");return}Xe(),ae(`Previewing \u201C${a.slotName}\u201D for ${a.personaDisplay}${a.status==="review"?" \u2014 waiting for your approval":""}. Nothing is being tracked.`),setTimeout(()=>{var p;try{(p=document.querySelector(`[data-sentient-slot="${d}"]`))==null||p.scrollIntoView({block:"center"})}catch(u){}},300)}).catch(()=>ae("Couldn\u2019t load this preview \u2014 check your connection and reopen it from your dashboard."))}function ae(e){var i;if(document.getElementById(tt))return;let t=document.createElement("div");t.id=tt,Object.assign(t.style,{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"10px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",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)"});let n=document.createElement("span");n.textContent=e;let r=document.createElement("button");r.textContent="Exit preview",Object.assign(r.style,{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.35)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"}),r.onclick=()=>{Ut();let l=new URL(window.location.href);l.searchParams.delete(Ht),l.searchParams.delete(Xt),window.location.assign(l.toString())},t.append(n,r),((i=document.body)!=null?i:document.documentElement).append(t)}var Zt=!1;function Qt(e){if(Zt||typeof window=="undefined")return;Zt=!0;let t=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,"");_e(t).then(n=>{!n||!("token"in n)||!n.fresh||nr(t,n.token)})}function nr(e,t){let n=()=>{window.setTimeout(()=>{import("@sentientui/core/style-sample").then(({sampleStyleVocabulary:r})=>fetch(`${e}/editor/style-vocabulary`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify(r(document))})).catch(()=>{})},1e3)};document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}import{jsx as fr}from"react/jsx-runtime";function ar(){var e,t;if(typeof window=="undefined")return"desktop:direct";try{return or({userAgent:(e=navigator.userAgent)!=null?e:"",referer:(t=document.referrer)!=null?t:"",appOrigin:window.location.origin})}catch(n){return"desktop:direct"}}var nn="https://api.sentient-ui.com/v1",B=rr({client:null,apiKey:"",initialAssignments:{},sessionSegment:"desktop:direct",ssrFallback:"first",onAssignment:void 0,initialLayoutOrder:null,initialSlots:{},initialSlotConfig:{},initialPalette:null,initialVocabulary:null,initialPersona:null,apiBaseUrl:nn,debug:!1}),tn=!1,nt=new Set;function lr(e,t,n){let r=Q(n);r.current=n;let[i,l]=be(null),[d,c]=be(!1),s=Q(e);s.current=e;let a=e===void 0?"":typeof e=="string"?e:JSON.stringify(I(y({},e),{check:typeof e.check,refused:typeof e.refused}));return Y(()=>{let p=s.current;if(p===void 0||typeof window=="undefined")return;let u,h=!1;return import("@sentientui/core/consent").then(({consentWatcher:A,forgetVisitor:w})=>{if(h)return;let o=A(typeof p=="object"&&p.cmp===void 0&&p.check?y(I(y({},p),{check:()=>s.current.check()}),p.refused?{refused:()=>{var f,b;return((b=(f=s.current).refused)==null?void 0:b.call(f))===!0}}:{}):p),m=!1,v=()=>{let f=o.refused()&&o.read()!==!0;f&&!m&&(w(t),r.current()),m=f,c(f);let b=o.read();b!==null&&nt.add(t),l(b!=null?b:nt.has(t)?!1:null)};v(),u=o.subscribe(v)}),()=>{h=!0,u==null||u()}},[a,t]),{granted:i,refused:d}}function ur(e){var C,_,G;let[t,n]=be(null),[r]=be(()=>{var g;return(g=e.sessionSegment)!=null?g:ar()}),[i,l]=be(Ue());Y(()=>Gt(()=>l(Ue())),[]),Y(()=>{Yt(e.apiBaseUrl),Qt(e.apiBaseUrl)},[]);let d=Q(()=>{}),c=lr(e.consentFrom,e.apiKey,()=>d.current()),s=e.consentFrom?(C=c.granted)!=null?C:nt.has(e.apiKey)?!1:e.consent===!0:e.consent,a=e.consentFrom?c.refused:!0,p=Q(a);p.current=a;let u=Q(null),h=Q(!1),A=Q([]),w=Q(!1);d.current=()=>{var x;A.current=[],w.current=!0;let g=u.current;g!=null&&g.gated?g.dispose():(x=g==null?void 0:g.takeHeld)==null||x.call(g)},Y(()=>{var $,H;if(p.current&&s===!1&&(A.current=[]),s===!1&&h.current&&(p.current&&(($=u.current)==null||$.destroy()),u.current=null,h.current=!1),s===!1&&!e.preConsentBehavior){p.current&&((H=u.current)==null||H.destroy()),u.current=null,n(null);return}let g=s!==!1;g&&(w.current=!1);let x=L=>{!g&&w.current&&L.gated&&L.dispose()},S=y({apiKey:e.apiKey,context:e.context,debug:e.debug,initialAssignments:e.initialAssignments,sessionSegment:r,consent:s,preConsentBehavior:e.preConsentBehavior,respectDoNotTrack:e.respectDoNotTrack,ssrSessionId:e.ssrSessionId,country:e.country,persona:e.persona,localMode:e.localMode,initialSlots:e.initialSlots,initialSlotConfig:e.initialSlotConfig,initialPalette:e.initialPalette,initialVocabulary:e.initialVocabulary,initialPersona:e.initialPersona,ingestUrl:e.apiBaseUrl?`${e.apiBaseUrl.replace(/\/$/,"")}/events`:void 0,nonce:e.nonce},Ze?{sdk:Ze}:{}),k=!1,R=null,P=null,E=L=>{for(let M of A.current.splice(0))setTimeout(()=>{if(u.current!==L){w.current||A.current.push(M);return}try{M(L)}catch(ee){}},0)},F=L=>{e.engagement===!1||!g||import("@sentientui/core/engagement").then(({startEngagementCapture:M})=>{k||(P=M(L,{apiKey:e.apiKey,sectionTypes:e.sectionTypes,apiBase:e.apiBaseUrl?e.apiBaseUrl.replace(/\/$/,""):void 0}))})};return e.enableGraph!==!1?import("@sentientui/core/graph").then(({init:L})=>{k||(R=L(I(y({},S),{graph:!0,captureDomText:e.captureDomText===!0,sectionTypes:e.sectionTypes})),x(R),u.current=R,h.current=g,E(R),n(R),F(R))}):(R=sr(S),x(R),u.current=R,h.current=g,E(R),n(R),F(R)),()=>{var L,M;k=!0,P==null||P(),A.current=A.current.concat((M=(L=R==null?void 0:R.takeHeld)==null?void 0:L.call(R))!=null?M:[]),R==null||R.dispose()}},[s]),Y(()=>{if(!t)return;let g=!1,x=async()=>{if(g)return;let k;try{k=await t.fetchWeights()}catch(R){return}if(!g)for(let R of k){let P={componentId:R.componentId,updatedAt:R.updatedAt,variants:R.variants.map(E=>{var F;return{variantId:E.variantId,pulls:E.pulls,avgReward:(F=E.avgReward)!=null?F:0}})};Et(R.componentId,P)}};x();let S=setInterval(()=>{x()},6e4);return()=>{g=!0,clearInterval(S)}},[t]);let o=(_=e.ssrFallback)!=null?_:"first",m=((G=e.apiBaseUrl)!=null?G:nn).replace(/\/$/,""),v=Q(null);Y(()=>{var S;if(typeof process!="undefined"&&((S=process.env)==null?void 0:S.NODE_ENV)==="production")return;let g={apiKey:e.apiKey,context:e.context,country:e.country,persona:e.persona,apiBaseUrl:m},x=v.current;if(v.current=g,x!==null)for(let k of["apiKey","context","country","persona","apiBaseUrl"])Object.is(x[k],g[k])||console.warn(`[sentient] AdaptiveProvider: \`${k}\` changed after initialisation, but the SDK client is stable for the session and only re-inits on \`consent\` \u2014 the new value is ignored. Remount the provider (e.g. via a changing \`key\` prop) to apply it.`)},[e.apiKey,e.context,e.country,e.persona,m]),Y(()=>{var g;typeof process!="undefined"&&((g=process.env)==null?void 0:g.NODE_ENV)==="production"||It({apiKey:e.apiKey,apiBaseUrl:m,isLocal:(t==null?void 0:t.isLocal)===!0})},[t,e.apiKey,m]),Y(()=>{let g=e.initialLayoutOrder;if(g&&g.length>0){Ye(g);return}e.declaredSections&&e.declaredSections.length>0&&Ye(e.declaredSections)},[e.initialLayoutOrder,e.declaredSections]),Y(()=>{!N()||e.consent!==void 0||e.consentFrom!==void 0||tn||(tn=!0,console.warn('[SentientUI] No consent gate: every visitor is tracked from first paint. Pass consentFrom="<your CMP>" (or consent={true} to silence). https://sentient-ui.com/docs#consent'))},[]),Y(()=>{if(!N())return;let g=e.declaredSections;if(!g||g.length===0||typeof document=="undefined")return;let x=new Set(Array.from(document.querySelectorAll("[data-sentient-id]"),k=>k.getAttribute("data-sentient-id"))),S=g.filter(k=>!x.has(k));S.length>0&&console.warn(`[SentientUI] Declared section${S.length>1?"s":""} ${S.map(k=>`"${k}"`).join(", ")} ${S.length>1?"have":"has"} no matching data-sentient-id element, so the layout engine cannot learn what they are and will serve the same order to every persona. Add data-sentient-id="<sectionId>" to each section's element.`)},[e.declaredSections]);let f=en(()=>t&&i?Tt(t):t,[t,i]),b=en(()=>{var g,x,S,k,R,P,E,F;return{client:f,apiKey:e.apiKey,initialAssignments:(g=e.initialAssignments)!=null?g:{},sessionSegment:r,ssrFallback:o,onAssignment:e.onAssignment,initialLayoutOrder:(x=e.initialLayoutOrder)!=null?x:null,initialSlots:(S=e.initialSlots)!=null?S:{},initialSlotConfig:(k=e.initialSlotConfig)!=null?k:{},initialPalette:(R=e.initialPalette)!=null?R:null,initialVocabulary:(P=e.initialVocabulary)!=null?P:null,initialPersona:(E=e.initialPersona)!=null?E:null,apiBaseUrl:m,debug:(F=e.debug)!=null?F:!1}},[f,e.apiKey,e.initialAssignments,r,o,e.onAssignment,e.initialLayoutOrder,e.initialSlots,e.initialSlotConfig,e.initialPalette,e.initialVocabulary,e.initialPersona,m,e.debug]);return fr(B.Provider,{value:b,children:e.children})}function D(){return j(B).client}function Z(){return j(B).apiKey}function rt(){return j(B).initialAssignments}function xe(){return j(B).sessionSegment}function rn(){return j(B).ssrFallback}function Oe(){return j(B).onAssignment}function on(){return j(B).debug}function cr(){let e=j(B).initialLayoutOrder,t=ir(K,()=>{var n;return typeof window=="undefined"?null:(n=window.__sentient_layout_override)!=null?n:null},()=>null);return t!=null?t:e}function Ee(){return j(B).initialSlots}function sn(){return j(B).initialPersona}function an(){return j(B).initialSlotConfig}function ln(){return j(B).initialPalette}function un(){return j(B).initialVocabulary}function dr(){return j(B).apiBaseUrl}import{memo as Ir,useEffect as Lr,useState as Dr}from"react";import{useCallback as pr,useEffect as le,useMemo as dn,useRef as we,useState as yr}from"react";import{attachMicroSignalDetectors as vr}from"@sentientui/core";import{useEffect as Pe,useRef as cn,useState as gr,useSyncExternalStore as mr}from"react";import{pickFromWeights as it}from"@sentientui/policy";function ye(e){var n;if(typeof window=="undefined")return null;let t=(n=window.__sentient_overrides)==null?void 0:n[e];if(t)return t;if(!window.location.search)return null;try{let r=new URLSearchParams(window.location.search);for(let i of r.getAll("sentient_variant")){let l=i.indexOf(":");if(l!==-1&&i.slice(0,l)===e)return i.slice(l+1)}}catch(r){}return null}function ot(e,t,n,r){let i=rt(),l=rn(),d=D(),c=xe(),s=Oe(),a=on(),p=cn(null),u=mr(K,()=>ye(e),()=>null),h=u&&t.includes(u)?u:null,A=cn(null);Pe(()=>{a&&h&&A.current!==h&&(A.current=h,console.info(`[sentient] override active: ${e} -> ${h}`))},[a,h,e]);let[w,o]=gr(()=>{var b,C;if(h)return{variantId:h,content:null,isLoading:!1,settled:!0};if(!d){let _=i[e];return _&&t.includes(_)?{variantId:_,content:null,isLoading:!1,settled:!0}:l==="first"&&t.length>0?{variantId:t[0],content:null,isLoading:!1,settled:!1}:{variantId:null,content:null,isLoading:!0,settled:!1}}let v=d.getAssignment(e,c);if(v&&(t.includes(v.variantId)||v.content))return{variantId:v.variantId,content:(b=v.content)!=null?b:null,isLoading:!1,settled:!0};let f=Je(e);if(f){let _=it(f.variants,t);if(_)return{variantId:_,content:null,isLoading:!1,settled:!0}}return{variantId:(C=t[0])!=null?C:null,content:null,isLoading:!1,settled:!1}}),m=v=>{s&&p.current!==v&&(p.current=v,s(e,v))};return Pe(()=>{var b;if(h||!d)return;let v=d.getAssignment(e,c);if(v&&(t.includes(v.variantId)||v.content)){o({variantId:v.variantId,content:(b=v.content)!=null?b:null,isLoading:!1,settled:!0}),m(v.variantId);return}let f=Je(e);if(f&&w.settled&&w.variantId&&w.variantId===it(f.variants,t)){m(w.variantId);return}o(C=>{var _;return C.variantId?C:{variantId:(_=t[0])!=null?_:null,content:null,isLoading:!1,settled:!1}})},[h,d,e,c]),Pe(()=>{if(h||!d)return;let v=d.getAssignment(e,c);if(v&&t.includes(v.variantId))return;let f=!1;return d.assign(e,t,n,r).then(b=>{var C;f||b&&(!t.includes(b.variantId)&&!b.content||(o({variantId:b.variantId,content:(C=b.content)!=null?C:null,isLoading:!1,settled:!0}),m(b.variantId)))}),()=>{f=!0}},[h,d,e,c]),Pe(()=>{if(!h&&d)return Ot(e,v=>{var C;let f=d.getAssignment(e,c);if(f&&(t.includes(f.variantId)||f.content)){o({variantId:f.variantId,content:(C=f.content)!=null?C:null,isLoading:!1,settled:!0}),m(f.variantId);return}let b=it(v.variants,t);b&&(o({variantId:b,content:null,isLoading:!1,settled:!0}),m(b))})},[h,d,e,c]),h?{variantId:h,content:null,isLoading:!1,settled:!0,isOverride:!0}:w}function Ge(e,t,n){let r=D(),i=Z(),l=Object.keys(t).join("\0"),d=dn(()=>Object.keys(t),[l]),{variantId:c,content:s,isOverride:a=!1,settled:p}=ot(e,d,n.agentData,n.agentDataByVariant),[u,h]=yr(null),A=we(null),w=pr(k=>{A.current=k,h(k)},[]),o=n.goal,m=typeof o=="string"?o:JSON.stringify(o),v=dn(()=>o?J(o):null,[m]),f=o?te(o):"";le(()=>Bt({id:e,variantIds:d,goal:f}),[e,d,f]);let b=we(null);le(()=>{a||p&&(!r||!c||!i||!u||b.current!==c&&(b.current=c,ne(r,i,e,c)))},[r,c,i,e,u,a,p]);let C=we(!1),_=we(new Set);le(()=>{C.current=!1,_.current=new Set},[c,v]);let G=n.funnel;le(()=>{a||!p||!r||!G||!v||ce(r,i,e,G,v)},[r,i,e,G,v,a,p]);let g=n.cursorSignal===!0;le(()=>{if(!g||a||!p||!r||!c||!u)return;let k=null,R=0,P=()=>{R=Date.now(),k=setTimeout(()=>{r.track({projectId:i,componentId:e,variantId:c,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-R}}),k=null},800)},E=()=>{k!==null&&(clearTimeout(k),k=null)};return u.addEventListener("mouseenter",P),u.addEventListener("mouseleave",E),()=>{u.removeEventListener("mouseenter",P),u.removeEventListener("mouseleave",E),k!==null&&clearTimeout(k)}},[g,r,c,i,e,u,a,p]);let x=we(n.microSignalGoals);x.current=n.microSignalGoals;let S=n.microSignalGoals?JSON.stringify(n.microSignalGoals):"";return le(()=>{if(a||!p||!r||!c||!u)return;let k=Date.now();return vr((R,P={})=>{var L,M,ee;r.track({projectId:i,componentId:e,variantId:c,eventType:"micro_signal",payload:y({signalType:R},P)});let E=(L=x.current)==null?void 0:L[R];if(!E||_.current.has(R))return;_.current.add(R);let F=typeof E=="string"?E:E.name,$=typeof E=="string"?1:(M=E.weight)!=null?M:1,H=typeof E=="string"?0:(ee=E.stepIndex)!=null?ee:0;r.goal(F,{metadata:y({signalType:R},P),weight:$,stepIndex:H})},u,k)},[r,c,i,e,u,S,a,p]),le(()=>{if(a||!p||!r||!c||!u||!v)return;let k=z(v);return q(u,v,{fireGoal:()=>{C.current||(C.current=!0,r.track({projectId:i,componentId:e,variantId:c,eventType:"goal_achieved",goalType:f,payload:y({reward:1},k!==void 0?{goalValue:k}:{})}),r.goal(f,y({metadata:{componentId:e,variantId:c},weight:1,stepIndex:0},k!==void 0?{value:k}:{})))},fireStep:(R,P,E)=>{r.track({projectId:i,componentId:e,variantId:c,eventType:"goal_achieved",goalType:R,payload:{reward:P}}),r.goal(R,{metadata:{},weight:P,stepIndex:E})}},f)},[r,c,i,e,u,v,f,a,p]),{client:r,variantIds:d,variantId:c,content:s,settled:p,isOverride:a,goalLabel:f,ref:w,nodeRef:A}}import{useEffect as U,useMemo as pt,useRef as yt}from"react";import{containsFormBlock as _n,reveal as Tr}from"@sentientui/core";import{captureRegionSkeleton as On}from"@sentientui/core/region";import{useCallback as Sr,useEffect as fn,useRef as st,useSyncExternalStore as Te}from"react";import{armOfResult as hr}from"@sentientui/core";var gn=new Set;function mn(e,t){var C,_,G;let n=D(),r=st(t==null?void 0:t.baselineText);r.current=t==null?void 0:t.baselineText;let i=st(t==null?void 0:t.render);i.current=t==null?void 0:t.render;let l=st(t==null?void 0:t.skeleton);l.current=t==null?void 0:t.skeleton;let d=Ee(),c=an(),s=ln(),a=un(),p=Te(K,()=>{var g;return typeof window!="undefined"?(g=window.__sentient_slot_config_overrides)==null?void 0:g[e]:void 0},()=>{}),u=Te(K,()=>{var g;return typeof window!="undefined"?(g=window.__sentient_slot_overrides)==null?void 0:g[e]:void 0},()=>{}),h=g=>g==null?"":hr(g),A=Sr(g=>{var x,S;return(S=(x=n==null?void 0:n.onSlotsChanged)==null?void 0:x.call(n,g))!=null?S:(()=>{})},[n]);Te(A,()=>{var g;return(g=n==null?void 0:n.getSlotConfig(e))!=null?g:null},()=>null),Te(A,()=>h(n==null?void 0:n.getSlotResult(e)),()=>"");let w=p===void 0?c[e]:void 0,o=p===void 0&&w===void 0&&n?n.getSlotConfig(e):null,m=(C=s!=null?s:n==null?void 0:n.getSitePalette())!=null?C:null,v=(G=a!=null?a:(_=n==null?void 0:n.getStyleVocabulary)==null?void 0:_.call(n))!=null?G:null,f=(()=>{var g,x,S;if(p!==void 0)return{config:p,arm:h(u),palette:m,vocabulary:(g=Wt())!=null?g:v,source:"override"};if(w!==void 0)return{config:w,arm:h((x=d[e])!=null?x:n==null?void 0:n.getSlotResult(e)),palette:m,vocabulary:v,source:"preloaded"};if(o!==null){let k=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{config:o,arm:h((S=n==null?void 0:n.getSlotResult(e))!=null?S:d[e]),palette:m,vocabulary:v,source:k?"client":"seeded"}}return{config:null,arm:"",palette:m,vocabulary:v,source:"none"}})(),b=f.source==="preloaded"||f.source==="override";return fn(()=>{var F,$,H,L,M;if(!n||n.isLocal===!0||b)return;let g=f.source==="none",x=g&&($=(F=r.current)==null?void 0:F.call(r))!=null?$:null,S=x!=null&&x!==""?{[e]:x}:void 0,k=(H=i.current)==null?void 0:H.call(i),R=g&&(M=(L=l.current)==null?void 0:L.call(l))!=null?M:null,P=y(y({},k?{render:{[e]:k}}:{}),R?{skeletons:{[e]:R}}:{}),E=Object.keys(P).length>0;return n.requestSlots?E?n.requestSlots([e],S,P):S?n.requestSlots([e],S):n.requestSlots([e]):g&&(R?n.reportSlots([e],S!=null?S:{},{[e]:R}):S?n.reportSlots([e],S):n.reportSlots([e])),()=>{var ee;return(ee=n.cancelSlots)==null?void 0:ee.call(n,[e])}},[n,b,f.source,e]),fn(()=>{!N()||(n==null?void 0:n.isLocal)!==!0||f.source!=="none"||gn.has(e)||(gn.add(e),console.warn(`[sentient] <Adaptive id="${e}"> is rendering its baseline children: in local/keyless mode <Adaptive> serves ONLY what you pass as \`initialSlotConfig\` (there is no registry to decide from). Pass initialSlotConfig/initialSlots to <AdaptiveProvider> to preview arms locally.`))},[n,f.source,e]),f}import{cloneElement as br,Fragment as pn}from"react";import{jsx as V,jsxs as hn}from"react/jsx-runtime";function at(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(/^https:\/\//i.test(e)||e[0]==="/"&&e[1]!=="/")?e:void 0}var re={none:"0",sm:"8px",md:"16px",lg:"24px"},lt={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},bn={sm:"0.875em",md:"1em",lg:"1.25em"},xr={sm:"1.25em",md:"1.5em",lg:"2em"},yn={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},vn={sm:"8px",md:"16px",lg:"32px"},wr={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},kr={normal:"400",medium:"500",bold:"700"};function Sn(e,t){return y(y({},e==="muted"?t!=null&&t.muted?{color:t.muted}:{opacity:.7}:{}),e==="accent"?y({fontWeight:600},t!=null&&t.accent?{color:t.accent}:{}):{})}function xn(e,t,n){var i,l,d,c;let r=t==null?void 0:t.accent;return I(y({display:"inline-block",padding:(i=yn[n!=null?n:"md"])!=null?i:yn.md,borderRadius:(l=t==null?void 0:t.radius)!=null?l:"8px",font:"inherit"},n?{fontSize:bn[n]}:{}),{textDecoration:e==="ghost"?"underline":"none",cursor:"pointer",background:e==="primary"?(d=t==null?void 0:t.primaryBg)!=null?d:"#111827":"transparent",color:e==="primary"?(c=t==null?void 0:t.primaryText)!=null?c:"#ffffff":r!=null?r:"inherit",border:e==="secondary"?`1px solid ${r!=null?r:"currentColor"}`:"none"})}function Rr({node:e,opts:t}){var i,l,d,c,s;let n=(i=e.emphasis)!=null?i:"primary",r={padding:"8px 10px",font:"inherit",border:`1px solid ${(d=(l=t.palette)==null?void 0:l.border)!=null?d:"currentColor"}`,borderRadius:(s=(c=t.palette)==null?void 0:c.radius)!=null?s:"8px"};return hn("form",{onSubmit:a=>{var h,A,w;a.preventDefault();let p=new FormData(a.currentTarget),u={};for(let o of e.fields)u[o.name]=String((h=p.get(o.name))!=null?h:"");(A=t.onFormGoal)==null||A.call(t,e.submitGoal);try{(w=t.onFormSubmit)==null||w.call(t,u)}catch(o){}},style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.fields.map(a=>{var p,u;return hn("label",{style:{display:"flex",flexDirection:"column",gap:"4px",font:"inherit"},children:[a.label,a.kind==="textarea"?V("textarea",{name:a.name,required:a.required,placeholder:a.placeholder,rows:3,style:r}):a.kind==="select"?V("select",{name:a.name,required:a.required,style:r,children:((p=a.options)!=null?p:[]).map(h=>V("option",{value:h,children:h},h))}):V("input",{name:a.name,type:(u=a.inputType)!=null?u:"text",required:a.required,placeholder:a.placeholder,style:r})]},a.name)}),V("button",{type:"submit",style:xn(n,t.palette),children:e.submitLabel})]})}function Cr(e,t){var r,i;let n=e.like;return n?(i=(r=t.vocabulary)==null?void 0:r.entries.find(l=>l.id===n))==null?void 0:i.classes:void 0}function wn(e,t){var r;let n=e?(r=t.vocabulary)==null?void 0:r.entries.find(i=>i.id===e):void 0;return n!=null&&n.computed.inheritsColor?n.computed.color:void 0}function ve(e,t){var i;let n=Ar(e,t),r=wn(e.like,t);return n&&r?br(n,{style:I(y({},(i=n.props.style)!=null?i:{}),{color:r})}):n}function Ar(e,t){var n,r,i,l,d,c,s,a,p,u,h,A,w,o,m,v,f,b,C,_,G,g,x;try{let S=Cr(e,t);switch(e.type){case"stack":{let k=(r=re[(n=e.gap)!=null?n:"md"])!=null?r:re.md,R=e.surface==="raised"&&!S,P=(i=e.pad)!=null?i:R?"md":void 0;return V("div",I(y({},S?{className:S}:{}),{style:y(y(y(y(y({display:"flex",flexDirection:e.direction,gap:k},e.align?{alignItems:lt[e.align]}:{}),e.justify?{justifyContent:lt[e.justify]}:{}),e.wrap?{flexWrap:"wrap"}:{}),P?{padding:(l=re[P])!=null?l:re.md}:{}),R?I(y(y({},(d=t.palette)!=null&&d.surface?{background:t.palette.surface}:{}),(c=t.palette)!=null&&c.surface&&((s=t.palette)!=null&&s.surfaceText)?{color:t.palette.surfaceText}:{}),{border:`1px solid ${(p=(a=t.palette)==null?void 0:a.border)!=null?p:"currentColor"}`,borderRadius:(h=(u=t.palette)==null?void 0:u.radius)!=null?h:"8px"}):{}),children:((A=e.children)!=null?A:[]).map((E,F)=>{let $=ve(E,t);return $===null?null:V(pn,{children:$},F)})}))}case"grid":{let k=(o=re[(w=e.gap)!=null?w:"md"])!=null?o:re.md;return V("div",I(y({},S?{className:S}:{}),{style:y(y({display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(max(200px, calc((100% - ${e.columns-1} * ${k}) / ${e.columns})), 1fr))`,gap:k},e.align?{alignItems:lt[e.align]}:{}),e.pad?{padding:(m=re[e.pad])!=null?m:re.md}:{}),children:((v=e.children)!=null?v:[]).map((R,P)=>{let E=ve(R,t);return E===null?null:V(pn,{children:E},P)})}))}case"text":return S?V("p",{className:S,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):V("p",{style:y(y(y(y(y({margin:0},e.size?{fontSize:bn[e.size]}:{}),e.weight?{fontWeight:kr[e.weight]}:{}),e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),Sn(e.tone,t.palette)),children:e.value});case"heading":{let k=`h${e.level}`;return S?V(k,{className:S,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):V(k,{style:y(y({margin:0,fontSize:xr[(f=e.size)!=null?f:"md"]},e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),children:e.value})}case"button":{let k=(b=e.emphasis)!=null?b:"primary";return V("a",I(y(y({href:at(e.href)},e.tag?{"data-sentient-tag":e.tag}:{}),S?{className:S}:{style:xn(k,t.palette,e.size)}),{children:e.label}))}case"link":return V("a",I(y(y({href:at(e.href)},e.tag?{"data-sentient-tag":e.tag}:{}),S?{className:S}:{style:{color:"inherit",textDecoration:"underline"}}),{children:e.label}));case"image":return V("img",I(y({src:at(e.src),alt:e.alt},S?{className:S}:{}),{style:y(y({display:"block",maxWidth:"100%"},e.ratio&&e.ratio!=="auto"?{aspectRatio:wr[e.ratio],width:"100%"}:{}),e.fit?{objectFit:e.fit}:{})}));case"badge":return S?V("span",{className:S,children:e.value}):V("span",{style:y({display:"inline-block",padding:"2px 10px",borderRadius:"999px",fontSize:"0.75em",border:`1px solid ${(_=(C=t.palette)==null?void 0:C.border)!=null?_:"currentColor"}`},Sn(e.tone,t.palette)),children:e.value});case"spacer":return V("div",{style:{height:(G=vn[e.size])!=null?G:vn.md}});case"divider":return V("hr",{style:{border:"none",borderTop:`1px solid ${(x=(g=t.palette)==null?void 0:g.border)!=null?x:"currentColor"}`,margin:0,width:"100%"}});case"form":return V(Rr,{node:e,opts:t});default:return null}}catch(S){return null}}function ut(e,t){var l,d,c,s;let n=ve(e.tree,t);if(n===null)return null;let r=(l=e.surface)!=null&&l.like?(c=(d=t.vocabulary)==null?void 0:d.entries.find(a=>a.id===e.surface.like))==null?void 0:c.classes:void 0,i=wn((s=e.surface)==null?void 0:s.like,t);return r?V("div",I(y({className:r},i?{style:{color:i}}:{}),{children:n})):n}import{cloneElement as Ne,isValidElement as Ie}from"react";import{normalizeLeafText as _r,skeletonFingerprint as Or}from"@sentientui/core/region";function Le(e){return typeof e=="string"&&e.trim()!==""||typeof e=="number"}function De(e){let t=e.props;if(t.dangerouslySetInnerHTML==null)return t.children}function ue(e){return Le(e)?1:Array.isArray(e)?e.reduce((t,n)=>t+ue(n),0):Ie(e)?ue(De(e)):0}function Er(e,t){return Array.isArray(t)?Ne(e,void 0,...t):Ne(e,void 0,t)}function ct(e,t){if(Le(e))return t;if(Array.isArray(e))return e.map(n=>ct(n,t));if(Ie(e)){let n=De(e);return ue(n)===0?e:Er(e,ct(n,t))}return e}function kn(e,t){return ue(e)===1?ct(e,t):null}var W=e=>e.join("/");function dt(e,t,n){if(Le(e)){n.leafPaths.push(t),n.texts.push(_r(String(e)));return}if(Array.isArray(e)){e.forEach((r,i)=>dt(r,[...t,i],n));return}Ie(e)&&(n.elements.set(W(t),e),dt(De(e),[...t,"c"],n))}function gt(e){let t={leafPaths:[],texts:[],elements:new Map};return dt(e,[],t),t}function Pr(e){return gt(e).texts}function Rn(e){let t=Pr(e);return t.length===0?null:Or(t)}function Gr(e){let t=[];return e.forEach((n,r)=>{n==="c"&&t.push(e.slice(0,r))}),t}function Cn(e,t){let n=t.reduce((i,l)=>Math.max(i,l+1),0),r=[];for(let i=0;i<n;i++){let l=t.flatMap((c,s)=>c===i?[Gr(e.leafPaths[s])]:[]);if(l.length===0){r.push(null);continue}let d=l[0];for(let c of l.slice(1)){let s=new Set(c.map(W));d=d.filter(a=>s.has(W(a)))}r.push(d.length>0?d[d.length-1]:null)}return r}function ft(e){var n;let t=(n=e==null?void 0:e.props)==null?void 0:n.className;return typeof t=="string"?t:void 0}function mt(e,t){let n=gt(t);if(n.texts.length!==e.leaves.length||n.texts.some((l,d)=>l!==e.leaves[d]))return null;let r=Cn(n,e.leafToNode),i=e.nodes.map((l,d)=>{let c=r[d],s=c?n.elements.get(W(c)):void 0,a=!!s&&(typeof s.type=="string"||ft(s)!==void 0);return I(y({},l),{restylable:a})});return I(y({},e),{nodes:i})}function An(e,t,n){var w;let r=gt(e);if(r.leafPaths.length!==n.length)return null;let i=n.reduce((o,m)=>Math.max(o,m+1),0);for(let o of Object.keys(t.nodes))if(!/^\d+$/.test(o)||Number(o)>=i)return null;let l=Cn(r,n),d=new Map;n.forEach((o,m)=>{d.has(o)||d.set(o,m)});let c=new Map(r.leafPaths.map((o,m)=>[W(o),m])),s=new Set,a=new Map,p=!1;for(let[o,m]of Object.entries(t.nodes)){let v=Number(o),f=l[v];if(m.hidden&&(f?s.add(W(f)):p=!0),m.like!==void 0){let b=l[m.like],C=f?r.elements.get(W(f)):void 0,_=b?ft(r.elements.get(W(b))):void 0;!f||_===void 0||ft(C)===void 0?p=!0:a.set(W(f),_)}}let u=new Map(Object.entries((w=t.order)!=null?w:{})),h=(o,m)=>{var v;if(Le(o)){let f=c.get(W(m));if(f===void 0)return o;let b=n[f],C=(v=t.nodes[String(b)])==null?void 0:v.text;return C===void 0?o:d.get(b)===f?C:""}if(Array.isArray(o)){let f=o.map((b,C)=>h(b,[...m,C]));for(let[b,C]of u){let _=C.map(x=>{let S=l[x];return!S||S.length!==m.length+1||W(S.slice(0,-1))!==W(m)?-1:S[S.length-1]});if(_.some(x=>x<0))continue;let G=[..._].sort((x,S)=>x-S),g=[...f];G.forEach((x,S)=>{f[x]=g[_[S]]}),u.delete(b)}return f}if(Ie(o)){let f=W(m);if(s.has(f))return null;let b=De(o);if(ue(b)===0)return o;let C=h(b,[...m,"c"]),_=a.get(f),G=_!==void 0?{className:_}:void 0;return Array.isArray(C)?Ne(o,G,...C):Ne(o,G,C)}return o},A=h(e,[]);return p||u.size>0?null:A}import{jsx as Nr}from"react/jsx-runtime";var En=new Set,Pn=new Set,Gn=new Set,Tn="authored.";function Ve({id:e,children:t,variants:n,onFormSubmit:r,goal:i,className:l,as:d="div",reportBaselineText:c=!0}){var xt,wt;let s=D(),a=Z(),p=yt(null),u=pt(()=>Rn(t),[t]),h=n?Object.keys(n).join("|"):"",A=pt(()=>y({fp:u!=null?u:"0000000000000000",forms:!!r,compose:!0,content:ue(t)===1},h!==""?{authored:h.split("|"),children:!0}:{}),[u,t,r,h]),w=()=>{var X;let O=p.current;if(!O||!c)return null;let T=On(O);return T.skeleton?(X=mt(T.skeleton,t))!=null?X:I(y({},T.skeleton),{editable:!1,nodes:T.skeleton.nodes.map(ie=>I(y({},ie),{restylable:!1}))}):{status:T.reason}},{config:o,arm:m,palette:v,vocabulary:f,source:b}=mn(e,{baselineText:c?()=>{var O,T;return(T=(O=p.current)==null?void 0:O.textContent)!=null?T:null}:void 0,render:()=>A,skeleton:w}),C=m!==""?(xt=o==null?void 0:o.blocks)==null?void 0:xt[m]:void 0,_=m!==""?(wt=o==null?void 0:o.compose)==null?void 0:wt[m]:void 0,G=(C!==void 0&&_n(C)||_!==void 0&&_n(_.tree))&&!r;U(()=>{!G||!N()||En.has(e)||(En.add(e),console.warn(`[sentient] AdaptiveSlot "${e}" was served a form arm but has no onFormSubmit handler \u2014 rendering its baseline children instead. Pass onFormSubmit to render generated forms.`))},[G,e]);let g=O=>{!s||b==="override"||(b!=="seeded"&&s.componentGoal(e,O),s.goal(O,{metadata:{componentId:e,arm:m},weight:1,stepIndex:0}))},x=t,S=!1,k=m.startsWith(Tn)?m.slice(Tn.length):null;if((o==null?void 0:o.blocked)==="variant_history")S=!0;else if(k!==null)n&&Object.prototype.hasOwnProperty.call(n,k)?x=n[k]:S=!0;else if(_!==void 0){let O=G?null:ut(_,{palette:v,vocabulary:f,onFormSubmit:r,onFormGoal:g});O===null?S=!0:x=O}else if(C!==void 0){let O=G?null:ve(C,{palette:v,vocabulary:f,onFormSubmit:r,onFormGoal:g});O===null?S=!0:x=O}else if((o==null?void 0:o.edits)!==void 0&&b!=="none"){let O=o.edits,T=O.fp===u?An(t,O.edits,O.leafToNode):null;T===null?S=!0:x=T}else if((o==null?void 0:o.content)!==void 0&&b!=="none"){let O=kn(t,o.content);O===null?S=!0:x=O}let R=S&&C===void 0&&_===void 0&&(o==null?void 0:o.edits)===void 0&&k===null&&(o==null?void 0:o.blocked)===void 0;U(()=>{(o==null?void 0:o.blocked)!=="variant_history"||!N()||Gn.has(e)||(Gn.add(e),console.warn(`[sentient] <Adaptive id="${e}"> has results from its earlier variants experiment, so it is showing your original until you migrate it: Matrix \u2192 Components \u2192 "${e}" \u2192 Migrate. Deploying code never switches an experiment.`))},[o==null?void 0:o.blocked,e]);let P=k!==null&&!S?k:null;U(()=>{var Se;if(!P||!c||!s)return;let O=p.current;if(!O)return;let T=On(O),X=T.skeleton?mt(T.skeleton,n==null?void 0:n[P]):null,ie=(Se=O.textContent)==null?void 0:Se.trim();s.reportSlots([],void 0,void 0,{[e]:[y(y({key:P},ie?{text:ie}:{}),X?{skeleton:X}:{})]})},[P,s,e]);let E=S&&(o==null?void 0:o.edits)!==void 0&&(b==="preloaded"||b==="client");U(()=>{var O;!E||!(o!=null&&o.edits)||(O=s==null?void 0:s.reportDrift)==null||O.call(s,e,o.edits.fp,u,o.edits.fp===u?"unaddressable":"fp_mismatch")},[E,e,u,s]);let F=x===t;U(()=>{var T;if(!(o!=null&&o.needsSkeleton)||!F)return;let O=w();O&&((T=s==null?void 0:s.reportSkeleton)==null||T.call(s,e,O))},[o==null?void 0:o.needsSkeleton,F,e,s]),U(()=>{if(!F)return;let O=zt(e);if(!O)return;let T=w();qt(O,T&&"status"in T?{status:T.status}:{skeleton:T})},[e,F]),U(()=>{!R||!N()||Pn.has(e)||(Pn.add(e),console.warn(`[sentient] <Adaptive id="${e}"> was served a text version, but its children have several separate texts or none Sentient can reach \u2014 rendering the original instead. Regenerate the version (new versions edit each text in place), or put a single text inline.`))},[R,e]);let $=o!=null&&o.blocks?Object.keys(o.blocks).sort().join("|"):"";U(()=>de({id:e,arms:$===""?void 0:$.split("|")}),[e,$]);let H=yt(null);U(()=>{!s||b==="none"||b==="seeded"||b==="override"||m===""||S||H.current!==m&&(H.current=m,ne(s,a,e,m))},[s,a,e,m,b,S]);let L=b!=="none"&&b!=="seeded"&&!S,M=L?m:"",ee=i===void 0?null:typeof i=="string"?i:JSON.stringify(i);U(()=>{if(!s||!i||b==="override")return;let O=p.current;if(!O)return;let T=te(i),X=z(i),ie=!1;return q(O,J(i),{fireGoal:()=>{ie||(ie=!0,L&&(X!==void 0?s.componentGoal(e,T,{value:X}):s.componentGoal(e,T)),s.goal(T,y({metadata:{componentId:e,arm:M},weight:1,stepIndex:0},X!==void 0?{value:X}:{})))},fireStep:(Se,kt,Un)=>{L&&s.componentGoal(e,Se,{reward:kt}),s.goal(Se,{metadata:{componentId:e,arm:M},weight:kt,stepIndex:Un})}},T)},[s,e,ee,m,b,S,L,M]);let ke=yt(null);U(()=>{let O=p.current;if(O){if(ke.current===null){ke.current=m;return}ke.current!==m&&(ke.current=m,Tr(O))}},[m]);let Jn=pt(()=>y({"data-sentient-slot":e},m!==""?{"data-sentient-arm":m}:{}),[e,m]);return Nr(d,I(y({ref:p,className:l},Jn),{children:x}))}import{jsx as Fe}from"react/jsx-runtime";function Vr(e){var p,u;let{client:t,variantId:n,content:r,ref:i}=Ge(e.id,e.variants,{goal:e.goal,funnel:e.funnel,microSignalGoals:e.microSignalGoals,agentData:e.agentData,agentDataByVariant:e.agentDataByVariant,cursorSignal:!0}),[l,d]=Dr(!1);Lr(()=>{d(!0)},[]);let c=(p=e.as)!=null?p:"div";if(e.clientOnly&&(!l||!t)||!n)return null;let s=(u=e.variants[n])!=null?u:null,a=s===null?r:null;return N()&&s===null&&a===null&&console.warn(`[sentient] <Adaptive id="${e.id}"> was assigned variant "${n}" but no matching key exists in props.variants. If this is a dashboard-managed text variant, use <AdaptiveText id="${e.id}"> instead.`),Fe(c,{ref:i,className:e.className,"data-sentient-id":e.id,"data-sentient-variant":n,children:s!=null?s:a})}var Fr=Ir(Vr,(e,t)=>{if(e.id!==t.id||e.goal!==t.goal&&JSON.stringify(e.goal)!==JSON.stringify(t.goal)||e.microSignalGoals!==t.microSignalGoals||e.funnel!==t.funnel||e.clientOnly!==t.clientOnly||e.as!==t.as||e.className!==t.className||e.agentData!==t.agentData||e.agentDataByVariant!==t.agentDataByVariant)return!1;if(e.variants===t.variants)return!0;let n=Object.keys(e.variants),r=Object.keys(t.variants);return n.length!==r.length?!1:n.every(i=>i in t.variants&&Object.is(e.variants[i],t.variants[i]))});function Mr(e){if(e.variants===void 0)return Fe(Ve,y({},e));let t=e;if(t.children!=null){N()&&Br(t);let n=t,{funnel:r,microSignalGoals:i,agentData:l,agentDataByVariant:d,clientOnly:c,variants:s}=n,a=Ce(n,["funnel","microSignalGoals","agentData","agentDataByVariant","clientOnly","variants"]);return Fe(Ve,I(y({},a),{children:t.children,variants:s}))}return Fe(Fr,y({},t))}var Nn=new Set;function Br(e){let t=["funnel","microSignalGoals","agentData","agentDataByVariant","clientOnly"].filter(n=>e[n]!==void 0);t.length===0||Nn.has(e.id)||(Nn.add(e.id),console.warn(`[sentient] <Adaptive id="${e.id}"> has both variants and children, so it runs as one experiment with your original and generated versions. These props only apply to a variants-only component and are ignored here: ${t.join(", ")}.`))}import{useEffect as Me,useMemo as $r,useRef as vt,useState as In,useSyncExternalStore as jr}from"react";import{jsx as Kr}from"react/jsx-runtime";function Wr({id:e,default:t,component:n="span",className:r,goal:i}){var G;let l=D(),d=Z(),c=Oe(),s=xe(),a=vt(null),p=vt(null),u=jr(K,()=>ye(e),()=>null),[h,A]=In(()=>{var g,x;return(x=(g=l==null?void 0:l.getAssignment(e,s))==null?void 0:g.content)!=null?x:null}),[w,o]=In(()=>{var g,x;return(x=(g=l==null?void 0:l.getAssignment(e,s))==null?void 0:g.variantId)!=null?x:null});Me(()=>{if(u||!l)return;let g=l.getAssignment(e,s);if((g==null?void 0:g.content)!==void 0){o(g.variantId),A(g.content);return}let x=!1;return l.assign(e).then(S=>{if(!x){if(!S){N()&&console.warn(`[sentient] <AdaptiveText id="${e}"> assignment failed \u2014 showing default text.`);return}o(S.variantId),S.content&&A(S.content)}}),()=>{x=!0}},[l,e,s,u]),Me(()=>{u||!l||!w||!d||a.current!==w&&(a.current=w,l.track({projectId:d,componentId:e,variantId:w,eventType:"variant_assigned",payload:{}}),c==null||c(e,w))},[l,w,d,e,c,u]);let m=i===void 0?"":typeof i=="string"?i:JSON.stringify(i),v=$r(()=>i===void 0?null:J(i),[m]),f=i===void 0?null:typeof i=="string"?i:v.type,b=vt(!1);Me(()=>{b.current=!1},[w,m]),Me(()=>{if(u||!l||!w||!d||!v||!f)return;let g=p.current;if(!g)return;let x=z(v);return q(g,v,{fireGoal:()=>{b.current||(b.current=!0,l.track({projectId:d,componentId:e,variantId:w,eventType:"goal_achieved",goalType:f,payload:y({reward:1},x!==void 0?{goalValue:x}:{})}),l.goal(f,y({metadata:{componentId:e,variantId:w},weight:1,stepIndex:0},x!==void 0?{value:x}:{})))},fireStep:(S,k,R)=>{l.track({projectId:d,componentId:e,variantId:w,eventType:"goal_achieved",goalType:S,payload:{reward:k}}),l.goal(S,{metadata:{},weight:k,stepIndex:R})}})},[l,w,d,e,v,f,u]);let C=h!=null?h:t;if(u){let g=l==null?void 0:l.getAssignment(e,s);C=g&&g.variantId===u&&(G=g.content)!=null?G:t}return Kr(n,{ref:g=>{p.current=g},className:r,children:C})}import{useCallback as Jr,useRef as Ur}from"react";function St(e){let t=D(),n=Ur(new Set);return Jr((r,i)=>{var l,d;if(!ye(e)){if(i!=null&&i.once){if(n.current.has(r))return;n.current.add(r)}t==null||t.componentGoal(e,r,i),t==null||t.goal(r,y(y(y({metadata:(l=i==null?void 0:i.metadata)!=null?l:{},weight:(d=i==null?void 0:i.reward)!=null?d:1,stepIndex:0},(i==null?void 0:i.value)!==void 0?{value:i.value}:{}),(i==null?void 0:i.currency)!==void 0?{currency:i.currency}:{}),(i==null?void 0:i.externalId)!==void 0?{externalId:i.externalId}:{}))}},[t,e])}import{useEffect as Hr,useRef as Ln}from"react";function Xr(e,t={}){let s=t,{componentId:n}=s,r=Ce(s,["componentId"]),i=D(),l=St(n!=null?n:""),d=Ln(!1),c=Ln(r);c.current=r,Hr(()=>{if(!i||d.current||i.gated)return;d.current=!0;let{metadata:a,reward:p,value:u,currency:h,externalId:A}=c.current;if(n){l(e,c.current);return}i.goal(e,y(y(y({metadata:a!=null?a:{},weight:p!=null?p:1,stepIndex:0},u!==void 0?{value:u}:{}),h!==void 0?{currency:h}:{}),A!==void 0?{externalId:A}:{}))},[i,n,e,l])}import{renderPrePaintScript as zr}from"@sentientui/core";import{confidenceBand as qr}from"@sentientui/policy";import{jsx as Qr}from"react/jsx-runtime";function Dn(e){return JSON.stringify(e).replace(/</g,"\\u003c")}function Yr(e){return e.persona?'(function(){try{var d=document.documentElement;if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",'+Dn(e.persona.persona)+');d.setAttribute("data-sentient-confidence",'+Dn(qr(e.persona.confidence))+");}catch(e){}})();":zr(e.apiKey)}function Zr(e){return!e.persona&&(e.consent===!1||e.consentFrom!==void 0&&e.consent!==!0)?null:Qr("script",{"data-sentient-persona-script":"",nonce:e.nonce,dangerouslySetInnerHTML:{__html:Yr(e)}})}import{useEffect as je,useMemo as bt,useRef as si}from"react";import{validateSlotDecl as ai}from"@sentientui/policy";import{useEffect as ht,useReducer as ei,useState as ti,useSyncExternalStore as Vn}from"react";import{armOfResult as Be,baselineResultFor as ni}from"@sentientui/core";import{confidenceBand as ri}from"@sentientui/policy";function $e(e,t){let n=D(),r=Ee(),[,i]=ei(u=>u+1,0),l=Vn(K,()=>{var u;return typeof window!="undefined"?(u=window.__sentient_slot_overrides)==null?void 0:u[e]:void 0},()=>{}),d=l===void 0?r[e]:void 0,c=l===void 0&&d===void 0&&n?n.getSlotResult(e):null,s=(n==null?void 0:n.isLocal)===!0&&l===void 0&&d===void 0&&c===null;ht(()=>{if(!s||!n)return;let u=!1;return n.decide({slots:[t]}).then(h=>{!u&&h&&i()}),()=>{u=!0}},[n,e,s]);let a=(()=>{if(l!==void 0)return{result:l,arm:Be(l),source:"override"};if(d!==void 0)return{result:d,arm:Be(d),source:"preloaded"};if(c!==null){let h=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{result:c,arm:Be(c),source:h?"client":"seeded"}}let u=ni(t);return{result:u,arm:Be(u),source:"baseline"}})(),p=a.source==="preloaded"||a.source==="override";return ht(()=>{var h;if(!n||n.isLocal===!0||p||!n.decideSlots)return;let u=(h=n.onSlotsChanged)==null?void 0:h.call(n,i);return n.decideSlots([t]),()=>{var A;(A=n.cancelSlots)==null||A.call(n,[e]),u==null||u()}},[n,e,p]),a}function ii(){var t;if(typeof window=="undefined")return null;let e=window.__sentient_persona_override;if(e!=null&&e.persona)return{persona:e.persona,confidence:(t=e.confidence)!=null?t:1};try{let n=new URLSearchParams(window.location.search).get("sentient_persona");if(n)return{persona:n,confidence:1}}catch(n){}return null}function oi(){let e=D(),t=sn();Vn(K,Nt,()=>0);let[n,r]=ti(!1);ht(()=>r(!0),[]);let i=c=>({persona:c.persona,confidence:c.confidence,band:ri(c.confidence)});if(!n)return t?i(t):null;let l=ii();if(l)return i(l);if(t)return i(t);let d=e?e.getPersona():null;return d?i(d):null}var Fn=new Set;function li(e){return typeof CSS!="undefined"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/[\\"]/g,"\\$&")}function ui(e,t,n){let r=D(),i=Z(),l=JSON.stringify(t),d=bt(()=>({id:e,dims:t}),[e,l]),{result:c,arm:s,source:a}=$e(e,d),p=bt(()=>typeof c=="string"?{}:c,[s]);if(N()&&!Fn.has(e)){Fn.add(e);let o=ai({id:e,dims:Object.fromEntries(Object.entries(t).map(([v,f])=>[v,[...f]]))}),m=Object.values(t).reduce((v,f)=>v*f.length,1);o.ok?m>4&&console.warn(`[sentient] useAdaptiveTokens("${e}") declares ${m} combinations \u2014 more than the recommended 4. Each extra combination needs more traffic to learn; consider fewer dims/values.`):console.warn(`[sentient] useAdaptiveTokens("${e}"): invalid declaration \u2014 ${o.reason}. Serving baseline.`)}let u=(n==null?void 0:n.goal)===void 0?null:typeof n.goal=="string"?n.goal:JSON.stringify(n.goal);je(()=>de({id:e,dims:t}),[e]);let h=si(null);je(()=>{!r||a==="baseline"||a==="seeded"||a==="override"||h.current===s||(h.current=s,ne(r,i,e,s))},[r,i,e,s,a]);let A=n==null?void 0:n.funnel;je(()=>{var o;!r||!A||a==="override"||ce(r,i,e,A,J((o=n==null?void 0:n.goal)!=null?o:"click"))},[r,i,e,A,u,a]),je(()=>{if(!r||!(n!=null&&n.goal)||a==="override"||a==="baseline"||a==="seeded")return;let o=document.querySelector(`[data-sentient-slot="${li(e)}"]`);if(!o){N()&&console.warn(`[sentient] useAdaptiveTokens("${e}"): a goal is declared but no element carries the returned props \u2014 spread {...props} on the slot's element.`);return}let m=te(n.goal),v=z(n.goal),f=!1;return q(o,J(n.goal),{fireGoal:()=>{f||(f=!0,v!==void 0?r.componentGoal(e,m,{value:v}):r.componentGoal(e,m),r.goal(m,y({metadata:{componentId:e,arm:s},weight:1,stepIndex:0},v!==void 0?{value:v}:{})))},fireStep:(b,C,_)=>{r.componentGoal(e,b,{reward:C}),r.goal(b,{metadata:{componentId:e,arm:s},weight:C,stepIndex:_})}},m)},[r,e,u,s,a]);let w=bt(()=>{let o={"data-sentient-slot":e};for(let[m,v]of Object.entries(p))o[`data-${m}`]=v;return o},[e,p]);return{tokens:p,props:w}}import{useCallback as ci,useEffect as di,useMemo as fi}from"react";var Mn=new Set;function gi(e,t){var A;if(N()&&!t.goal)throw new Error(`[sentient] useAdaptive("${e}"): a goal is required \u2014 without one the optimizer accumulates exposures with no rewards and cannot learn. Pass e.g. goal: 'buy_click'.`);let{client:n,variantIds:r,variantId:i,isOverride:l,goalLabel:d,ref:c,nodeRef:s}=Ge(e,t.variants,{goal:t.goal,funnel:t.funnel,microSignalGoals:t.microSignalGoals}),a=(A=i!=null?i:r[0])!=null?A:"",p=t.variants[a];di(()=>{if(!N()||!n)return;let w=setTimeout(()=>{!s.current&&!Mn.has(e)&&(Mn.add(e),console.warn(`[sentient] useAdaptive("${e}"): bind was never attached \u2014 spread {...bind} on the rendered element, otherwise exposure and goal tracking cannot work and the optimizer learns nothing.`))},0);return()=>clearTimeout(w)},[n,e]);let u=ci((w,o)=>{var v,f;if(l)return;let m=w!=null?w:d;m&&(n==null||n.componentGoal(e,m,o),n==null||n.goal(m,y(y(y({metadata:(v=o==null?void 0:o.metadata)!=null?v:{},weight:(f=o==null?void 0:o.reward)!=null?f:1,stepIndex:0},(o==null?void 0:o.value)!==void 0?{value:o.value}:{}),(o==null?void 0:o.currency)!==void 0?{currency:o.currency}:{}),(o==null?void 0:o.externalId)!==void 0?{externalId:o.externalId}:{})))},[n,e,d,l]),h=fi(()=>({ref:c,"data-sentient-id":e,"data-sentient-variant":a}),[c,e,a]);return{variant:a,value:p,bind:h,fireGoal:u}}import{Children as mi,isValidElement as pi,useEffect as We,useMemo as Bn,useRef as $n}from"react";import{jsx as vi}from"react/jsx-runtime";var Ke=new Set;function yi(e){var v;let t=D(),n=Z(),r=$n(null),i=Object.keys(e.arrangements).join(" "),l=Bn(()=>Object.keys(e.arrangements),[i]),d=Bn(()=>y({id:e.id,arms:l},e.baseline!==void 0?{baseline:e.baseline}:{}),[e.id,l,e.baseline]),{arm:c,source:s}=$e(e.id,d);N()&&e.baseline!==void 0&&e.baseline!==l[0]&&!Ke.has(e.id+":baseline")&&(Ke.add(e.id+":baseline"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: baseline "${e.baseline}" is not the first-declared arrangement ("${l[0]}"). The first arrangement should usually be the page's real incumbent (the holdout sees it).`));let a=mi.toArray(e.children).filter(pi),p=new Map;for(let f of a)p.set(String((v=f.key)!=null?v:"").replace(/^\.\$/,""),f);let u=e.arrangements[c],h=u!==void 0&&u.length===a.length&&u.every(f=>p.has(f));N()&&u!==void 0&&!h&&!Ke.has(e.id+":keys")&&(Ke.add(e.id+":keys"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: arrangement "${c}" [${u.join(", ")}] does not match the children's keys \u2014 rendering declaration order (fail-safe).`));let A=h?u.map(f=>p.get(f)):a;We(()=>de({id:e.id,arms:Object.keys(e.arrangements)}),[e.id]);let w=$n(null);We(()=>{!t||s==="baseline"||s==="seeded"||s==="override"||w.current===c||(w.current=c,ne(t,n,e.id,c))},[t,n,e.id,c,s]);let o=e.funnel;We(()=>{var f;!t||!o||s==="override"||ce(t,n,e.id,o,J((f=e.goal)!=null?f:"click"))},[t,n,e.id,o,s]);let m=e.goal===void 0?null:typeof e.goal=="string"?e.goal:JSON.stringify(e.goal);return We(()=>{if(!t||e.goal===void 0||s==="override"||s==="baseline"||s==="seeded")return;let f=r.current;if(!f)return;let b=te(e.goal),C=z(e.goal),_=!1;return q(f,J(e.goal),{fireGoal:()=>{_||(_=!0,C!==void 0?t.componentGoal(e.id,b,{value:C}):t.componentGoal(e.id,b),t.goal(b,y({metadata:{componentId:e.id,arm:c},weight:1,stepIndex:0},C!==void 0?{value:C}:{})))},fireStep:(G,g,x)=>{t.componentGoal(e.id,G,{reward:g}),t.goal(G,{metadata:{componentId:e.id,arm:c},weight:g,stepIndex:x})}},b)},[t,e.id,m,c,s]),vi("div",{ref:r,"data-sentient-id":e.id,"data-sentient-variant":c,children:A})}import{deriveSessionSegment as Si}from"@sentientui/core";var hi=["page","blocks","layoutOrder"],jn=new Map;function bi(e,t){jn.set(e,t)}function Wn(e){return jn.get(e)}function xi(e){var i,l;let t=(l=(i=e.content)!=null?i:Wn(e.page))!=null?l:{},n={};for(let[d,c]of Object.entries(t))hi.includes(d)||(n[d]=c);let r=I(y({},n),{page:e.page,blocks:e.blocks});return e.layoutOrder&&(r.layoutOrder=e.layoutOrder),r}function wi(e){return`<script type="application/ld+json">${Kn(e)}</script>`}function Kn(e){return JSON.stringify(y({"@context":"https://schema.org","@type":"WebPage"},e)).replace(/</g,"\\u003c")}function ki(e){let t=[];e.title&&t.push(`# ${e.title}`,""),e.summary&&t.push(String(e.summary),"");for(let[n,r]of Object.entries(e))["page","title","summary","blocks","layoutOrder"].includes(n)||t.push(`## ${n}`,"","```json",JSON.stringify(r,null,2),"```","");if(e.blocks.length>0){t.push("## blocks","");for(let n of e.blocks)t.push(`- **${n.id}** \u2192 variant \`${n.variant}\``),n.content!==void 0&&t.push(""," ```json",JSON.stringify(n.content,null,2)," ```");t.push("")}return t.join(`
2
+ var Hn=Object.defineProperty,Xn=Object.defineProperties;var zn=Object.getOwnPropertyDescriptors;var Re=Object.getOwnPropertySymbols;var Ct=Object.prototype.hasOwnProperty,_t=Object.prototype.propertyIsEnumerable;var At=(e,t,n)=>t in e?Hn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,y=(e,t)=>{for(var n in t||(t={}))Ct.call(t,n)&&At(e,n,t[n]);if(Re)for(var n of Re(t))_t.call(t,n)&&At(e,n,t[n]);return e},I=(e,t)=>Xn(e,zn(t));var Ae=(e,t)=>{var n={};for(var r in e)Ct.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Re)for(var r of Re(e))t.indexOf(r)<0&&_t.call(e,r)&&(n[r]=e[r]);return n};import{createContext as rr,useContext as j,useEffect as Y,useMemo as tn,useRef as Q,useState as be,useSyncExternalStore as ir}from"react";import{deriveSessionSegment as or,init as sr}from"@sentientui/core";var Ot=new Map,Ce=new Map;function Et(e,t){let n=Ce.get(e);return n||(n=new Set,Ce.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&Ce.delete(e)}}function Pt(e,t){Ot.set(e,t);let n=Ce.get(e);if(n)for(let r of n)try{r(t)}catch(i){}}function Je(e){var t;return(t=Ot.get(e))!=null?t:null}var qn={on:!1,listeners:new Set};function Gt(){if(typeof window=="undefined")return qn;let e=window;return e.__sentient_preview||(e.__sentient_preview={on:!1,listeners:new Set}),e.__sentient_preview}function Ue(){return Gt().on}function Tt(e){let t=Gt().listeners;return t.add(e),()=>{t.delete(e)}}function Nt(e){return{isLocal:e.isLocal,track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},fetchWeights:()=>Promise.resolve([]),getAssignment:(t,n)=>e.getAssignment(t,n),assign:(t,n,r,i)=>e.assign(t,n,r,i),decide:()=>Promise.resolve(null),getSlotResult:t=>e.getSlotResult(t),getSlotConfig:t=>e.getSlotConfig(t),getSitePalette:()=>e.getSitePalette(),reportSlots:t=>e.reportSlots(t),getPersona:()=>e.getPersona(),getGraph:()=>e.getGraph(),flush:()=>e.flush(),dispose:()=>e.dispose(),destroy:()=>e.destroy()}}var He="sentient:overrides-changed";function It(){var e;return typeof window=="undefined"?0:(e=window.__sentient_overrides_version)!=null?e:0}function Xe(){var t;if(typeof window=="undefined")return;let e=window;e.__sentient_overrides_version=((t=e.__sentient_overrides_version)!=null?t:0)+1,window.dispatchEvent(new Event(He))}function K(e){return typeof window=="undefined"?()=>{}:(window.addEventListener(He,e),()=>window.removeEventListener(He,e))}function Lt(e){typeof window!="undefined"&&(window.__sentient_devtools_config=e)}function N(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}function J(e){return typeof e=="string"?{type:"click"}:e}function te(e){return typeof e=="string"?e:e.type}function z(e){if(typeof e!="string"&&(e.type==="click"||e.type==="form_submit"||e.type==="scroll_depth"))return e.value}var ze=new Set,qe=!1;function Dt(e){if(ze.has(e))return!0;if(ze.add(e),!qe){qe=!0;let t=()=>{qe=!1,ze.clear()};if(typeof MessageChannel=="function"){let n=new MessageChannel;n.port1.onmessage=()=>{n.port1.close(),n.port2.close(),t()},n.port2.postMessage(0)}else setTimeout(t,0)}return!1}function Yn(e){if(!(e instanceof Element))return!1;let t=e.tagName.toLowerCase();return t==="a"||t==="button"?!0:e.getAttribute("role")==="button"}function Vt(e,t,n){if(n){try{let i=e;for(;i&&i!==t;){if(i.matches(n))return!0;i=i.parentElement}}catch(i){}return!1}let r=e;for(;r&&r!==t;){if(Yn(r))return!0;r=r.parentElement}return!1}function q(e,t,n,r){if(t.type==="weighted_composite"){let a=new Set,p=[];return t.steps.forEach(({goal:u,name:h,weight:C},w)=>{let o=(m=!1)=>{a.has(w)||m&&r!==void 0&&Dt(`step\0${h}\0${C}\0${w}`)||(a.add(w),n.fireStep(h,C,w))};if(u.type==="click"){let m=v=>{let f=v.target;f instanceof Element&&Vt(f,e,u.selector)&&o()};e.addEventListener("click",m),p.push(()=>e.removeEventListener("click",m));return}if(u.type==="form_submit"){let m=v=>{v.target instanceof HTMLFormElement&&e.contains(v.target)&&o()};e.addEventListener("submit",m),p.push(()=>e.removeEventListener("submit",m));return}if(u.type==="scroll_depth"){let m=Math.max(0,Math.min(1,u.threshold)),v=new IntersectionObserver(f=>{for(let b of f)if(b.intersectionRatio>=m){o(!0),v.disconnect();break}},{threshold:[m]});v.observe(e),p.push(()=>v.disconnect())}}),()=>{for(let u of p)u()}}let i=t.type==="composite"?t.all:[t],l=new Set(i.map((a,p)=>p)),d=()=>{r!==void 0&&Dt(r)||n.fireGoal()},c=(a,p=!1)=>{l.delete(a),l.size===0&&(p?d():n.fireGoal())},s=[];return i.forEach((a,p)=>{if(a.type==="click"){let u=h=>{let C=h.target;C instanceof Element&&Vt(C,e,a.selector)&&(t.type==="composite"?c(p):n.fireGoal())};e.addEventListener("click",u),s.push(()=>e.removeEventListener("click",u));return}if(a.type==="form_submit"){let u=h=>{h.target instanceof HTMLFormElement&&e.contains(h.target)&&(t.type==="composite"?c(p):n.fireGoal())};e.addEventListener("submit",u),s.push(()=>e.removeEventListener("submit",u));return}if(a.type==="scroll_depth"){let u=Math.max(0,Math.min(1,a.threshold)),h=new IntersectionObserver(C=>{for(let w of C)if(w.intersectionRatio>=u){t.type==="composite"?c(p,!0):d(),h.disconnect();break}},{threshold:[u]});h.observe(e),s.push(()=>h.disconnect());return}}),()=>{for(let a of s)a()}}var Ft=new Set,Mt=new Set;function ce(e,t,n,r,i){let l=`${r}|${n}`;if(Mt.has(l))return;Mt.add(l);let d=i.type==="weighted_composite"&&!Ft.has(r);d&&Ft.add(r),e.track({projectId:t,componentId:n,eventType:"funnel_declared",payload:d?{funnelId:r,steps:i.steps.map(c=>({goalId:c.name,weight:c.weight}))}:{funnelId:r}})}function ne(e,t,n,r){e.track({projectId:t,componentId:n,variantId:r,eventType:"variant_assigned",payload:{}})}var Zn={components:new Map,slots:new Map,sections:[],listeners:new Set,version:0};function oe(){if(typeof window=="undefined")return Zn;let e=window;return e.__sentient_registry||(e.__sentient_registry={components:new Map,slots:new Map,sections:[],listeners:new Set,version:0}),e.__sentient_registry}function he(){oe().version+=1;for(let e of oe().listeners)e()}var Bt=()=>{};function $t(e){return N()?(oe().components.set(e.id,e),he(),()=>{oe().components.delete(e.id),he()}):Bt}function de(e){return N()?(oe().slots.set(e.id,e),he(),()=>{oe().slots.delete(e.id),he()}):Bt}function Ye(e){N()&&(oe().sections=[...e],he())}var jt="0.39.0",Ze=jt!=="0.0.0-dev"?{name:"react",version:jt}:void 0;function Qn(){let e=window;return e.__sentient_slot_config_overrides||(e.__sentient_slot_config_overrides={}),e.__sentient_slot_config_overrides}function fe(e,t){Qn()[e]=t}function Wt(e){window.__sentient_vocabulary_override=e}function Kt(){var e;return typeof window=="undefined"?null:(e=window.__sentient_vocabulary_override)!=null?e:null}function er(){let e=window;return e.__sentient_slot_overrides||(e.__sentient_slot_overrides={}),e.__sentient_slot_overrides}function ge(e,t){er()[e]=t}function Jt(e){let t=null;try{let n=location.hash.slice(1),r=RegExp("(^|[?&])"+e+"=([^&]*)").exec(n);if(r){t=r[2];let i=n.slice(r.index+r[0].length);r[1]!="&"&&i[0]=="&"&&(i=r[1]+i.slice(1));let l=n.slice(0,r.index)+i;history.replaceState(history.state,"",l?"#"+l:location.pathname+location.search)}}catch(n){}return t}var et="__snt_editor_token",me=null,Qe=!1;function Ut(){return Qe}function tr(){try{return sessionStorage.getItem(et)}catch(e){return null}}function _e(e){if(me)return me;let t=typeof window=="undefined"?null:Jt("sentient_editor_code");if(!t){let n=typeof window=="undefined"?null:tr();return Qe=!!n,me=Promise.resolve(n?{token:n,fresh:!1}:null),me}return Qe=!0,me=fetch(`${e}/editor/exchange`,{method:"POST",headers:{"content-type":"application/json"},body:JSON.stringify({code:t})}).then(async n=>{let r=n.ok?(await n.json()).token:void 0;if(!r)return{error:n.ok?500:n.status};try{sessionStorage.setItem(et,r)}catch(i){}return{token:r,fresh:!0}}).catch(()=>({error:0})),me}function Ht(){try{sessionStorage.removeItem(et)}catch(e){}}var Xt="sentient_preview_cell",zt="sentient_refresh_region",tt="sentient-cell-preview-bar",se="__preview__",pe=null;function qt(e){if((pe==null?void 0:pe.slotId)!==e)return null;let t=pe;return pe=null,t}function Yt(e,t){e.session.then(n=>{if(!n||!("token"in n))throw new Error("no editor session");return fetch(`${e.base}/editor/region-skeleton`,{method:"POST",headers:{authorization:`Bearer ${n.token}`,"content-type":"application/json"},body:JSON.stringify(y({slotId:e.slotId},t))})}).then(n=>ae(n.ok?"Region refreshed \u2014 you can regenerate its versions now.":"Couldn\u2019t refresh this region \u2014 reopen the link from your dashboard.")).catch(()=>ae("Couldn\u2019t refresh this region \u2014 check your connection and reopen the link from your dashboard."))}function Zt(e){if(typeof window=="undefined"||typeof document=="undefined"||document.getElementById(tt))return;let t,n;try{let s=new URLSearchParams(window.location.search);t=s.get(Xt),n=s.get(zt)}catch(s){return}if(!t&&!n)return;let r=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,""),i=_e(r);if(!Ut())return;if(n){pe={slotId:n,session:i,base:r},fe(n,{kind:"arms"}),ge(n,se),Xe();return}if(!t)return;let l=t.lastIndexOf("~");if(l<=0)return;let d=t.slice(0,l),c=t.slice(l+1);i.then(s=>s?"token"in s?fetch(`${r}/editor/cell-preview?slotId=${encodeURIComponent(d)}&persona=${encodeURIComponent(c)}`,{headers:{authorization:`Bearer ${s.token}`}}):(ae(s.error===401?"This preview link has expired \u2014 reopen it from your dashboard.":"Couldn\u2019t load this preview \u2014 reopen it from your dashboard."),null):null).then(async s=>{if(!s)return;if(!s.ok){ae(s.status===401?"This preview link has expired \u2014 reopen it from your dashboard.":"Couldn\u2019t load this preview \u2014 reopen it from your dashboard.");return}let a=await s.json();if(a.vocabulary&&Array.isArray(a.vocabulary.entries)&&Wt(a.vocabulary),a.compose!=null)fe(d,{kind:"arms",compose:{[se]:a.compose}}),ge(d,se);else if(a.edits!=null&&typeof a.skeletonFp=="string"&&Array.isArray(a.leafToNode))fe(d,{kind:"arms",edits:{edits:a.edits,fp:a.skeletonFp,leafToNode:a.leafToNode}}),ge(d,se);else if(a.blocks!=null)fe(d,{kind:"arms",blocks:{[se]:a.blocks}}),ge(d,se);else if(a.content!=null)fe(d,{kind:"arms",content:a.content}),ge(d,se);else{ae("Nothing to preview in that square yet.");return}Xe(),ae(`Previewing \u201C${a.slotName}\u201D for ${a.personaDisplay}${a.status==="review"?" \u2014 waiting for your approval":""}. Nothing is being tracked.`),setTimeout(()=>{var p;try{(p=document.querySelector(`[data-sentient-slot="${d}"]`))==null||p.scrollIntoView({block:"center"})}catch(u){}},300)}).catch(()=>ae("Couldn\u2019t load this preview \u2014 check your connection and reopen it from your dashboard."))}function ae(e){var i;if(document.getElementById(tt))return;let t=document.createElement("div");t.id=tt,Object.assign(t.style,{position:"fixed",bottom:"16px",left:"50%",transform:"translateX(-50%)",zIndex:"2147483647",display:"flex",alignItems:"center",gap:"10px",padding:"10px 14px",borderRadius:"12px",maxWidth:"90vw",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)"});let n=document.createElement("span");n.textContent=e;let r=document.createElement("button");r.textContent="Exit preview",Object.assign(r.style,{padding:"4px 10px",borderRadius:"999px",border:"1px solid rgba(255,255,255,0.35)",background:"transparent",color:"#fff",font:"12px system-ui, sans-serif",cursor:"pointer"}),r.onclick=()=>{Ht();let l=new URL(window.location.href);l.searchParams.delete(Xt),l.searchParams.delete(zt),window.location.assign(l.toString())},t.append(n,r),((i=document.body)!=null?i:document.documentElement).append(t)}var Qt=!1;function en(e){if(Qt||typeof window=="undefined")return;Qt=!0;let t=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,"");_e(t).then(n=>{!n||!("token"in n)||!n.fresh||nr(t,n.token)})}function nr(e,t){let n=()=>{window.setTimeout(()=>{import("@sentientui/core/style-sample").then(({sampleStyleVocabulary:r})=>fetch(`${e}/editor/style-vocabulary`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify(r(document))})).catch(()=>{})},1e3)};document.readyState==="complete"?n():window.addEventListener("load",n,{once:!0})}import{jsx as fr}from"react/jsx-runtime";function ar(){var e,t;if(typeof window=="undefined")return"desktop:direct";try{return or({userAgent:(e=navigator.userAgent)!=null?e:"",referer:(t=document.referrer)!=null?t:"",appOrigin:window.location.origin})}catch(n){return"desktop:direct"}}var rn="https://api.sentient-ui.com/v1",B=rr({client:null,apiKey:"",initialAssignments:{},sessionSegment:"desktop:direct",ssrFallback:"first",onAssignment:void 0,initialLayoutOrder:null,initialSlots:{},initialSlotConfig:{},initialPalette:null,initialVocabulary:null,initialPersona:null,apiBaseUrl:rn,debug:!1}),nn=!1,nt=new Set;function lr(e,t,n){let r=Q(n);r.current=n;let[i,l]=be(null),[d,c]=be(!1),s=Q(e);s.current=e;let a=e===void 0?"":typeof e=="string"?e:JSON.stringify(I(y({},e),{check:typeof e.check,refused:typeof e.refused}));return Y(()=>{let p=s.current;if(p===void 0||typeof window=="undefined")return;let u,h=!1;return import("@sentientui/core/consent").then(({consentWatcher:C,forgetVisitor:w})=>{if(h)return;let o=C(typeof p=="object"&&p.cmp===void 0&&p.check?y(I(y({},p),{check:()=>s.current.check()}),p.refused?{refused:()=>{var f,b;return((b=(f=s.current).refused)==null?void 0:b.call(f))===!0}}:{}):p),m=!1,v=()=>{let f=o.refused()&&o.read()!==!0;f&&!m&&(w(t),r.current()),m=f,c(f);let b=o.read();b!==null&&nt.add(t),l(b!=null?b:nt.has(t)?!1:null)};v(),u=o.subscribe(v)}),()=>{h=!0,u==null||u()}},[a,t]),{granted:i,refused:d}}function ur(e){var A,_,G;let[t,n]=be(null),[r]=be(()=>{var g;return(g=e.sessionSegment)!=null?g:ar()}),[i,l]=be(Ue());Y(()=>Tt(()=>l(Ue())),[]),Y(()=>{Zt(e.apiBaseUrl),en(e.apiBaseUrl)},[]);let d=Q(()=>{}),c=lr(e.consentFrom,e.apiKey,()=>d.current()),s=e.consentFrom?(A=c.granted)!=null?A:nt.has(e.apiKey)?!1:e.consent===!0:e.consent,a=e.consentFrom?c.refused:!0,p=Q(a);p.current=a;let u=Q(null),h=Q(!1),C=Q([]),w=Q(!1);d.current=()=>{var x;C.current=[],w.current=!0;let g=u.current;g!=null&&g.gated?g.dispose():(x=g==null?void 0:g.takeHeld)==null||x.call(g)},Y(()=>{var $,H;if(p.current&&s===!1&&(C.current=[]),s===!1&&h.current&&(p.current&&(($=u.current)==null||$.destroy()),u.current=null,h.current=!1),s===!1&&!e.preConsentBehavior){p.current&&((H=u.current)==null||H.destroy()),u.current=null,n(null);return}let g=s!==!1;g&&(w.current=!1);let x=L=>{!g&&w.current&&L.gated&&L.dispose()},S=y({apiKey:e.apiKey,context:e.context,debug:e.debug,initialAssignments:e.initialAssignments,sessionSegment:r,consent:s,preConsentBehavior:e.preConsentBehavior,respectDoNotTrack:e.respectDoNotTrack,ssrSessionId:e.ssrSessionId,country:e.country,persona:e.persona,stageAttributes:e.stageAttributes,localMode:e.localMode,initialSlots:e.initialSlots,initialSlotConfig:e.initialSlotConfig,initialPalette:e.initialPalette,initialVocabulary:e.initialVocabulary,initialPersona:e.initialPersona,ingestUrl:e.apiBaseUrl?`${e.apiBaseUrl.replace(/\/$/,"")}/events`:void 0,nonce:e.nonce},Ze?{sdk:Ze}:{}),k=!1,R=null,P=null,E=L=>{for(let M of C.current.splice(0))setTimeout(()=>{if(u.current!==L){w.current||C.current.push(M);return}try{M(L)}catch(ee){}},0)},F=L=>{e.engagement===!1||!g||import("@sentientui/core/engagement").then(({startEngagementCapture:M})=>{k||(P=M(L,{apiKey:e.apiKey,sectionTypes:e.sectionTypes,apiBase:e.apiBaseUrl?e.apiBaseUrl.replace(/\/$/,""):void 0}))})};return e.enableGraph!==!1?import("@sentientui/core/graph").then(({init:L})=>{k||(R=L(I(y({},S),{graph:!0,captureDomText:e.captureDomText===!0,sectionTypes:e.sectionTypes})),x(R),u.current=R,h.current=g,E(R),n(R),F(R))}):(R=sr(S),x(R),u.current=R,h.current=g,E(R),n(R),F(R)),()=>{var L,M;k=!0,P==null||P(),C.current=C.current.concat((M=(L=R==null?void 0:R.takeHeld)==null?void 0:L.call(R))!=null?M:[]),R==null||R.dispose()}},[s]),Y(()=>{if(!t)return;let g=!1,x=async()=>{if(g)return;let k;try{k=await t.fetchWeights()}catch(R){return}if(!g)for(let R of k){let P={componentId:R.componentId,updatedAt:R.updatedAt,variants:R.variants.map(E=>{var F;return{variantId:E.variantId,pulls:E.pulls,avgReward:(F=E.avgReward)!=null?F:0}})};Pt(R.componentId,P)}};x();let S=setInterval(()=>{x()},6e4);return()=>{g=!0,clearInterval(S)}},[t]);let o=(_=e.ssrFallback)!=null?_:"first",m=((G=e.apiBaseUrl)!=null?G:rn).replace(/\/$/,""),v=Q(null);Y(()=>{var S;if(typeof process!="undefined"&&((S=process.env)==null?void 0:S.NODE_ENV)==="production")return;let g={apiKey:e.apiKey,context:e.context,country:e.country,persona:e.persona,apiBaseUrl:m},x=v.current;if(v.current=g,x!==null)for(let k of["apiKey","context","country","persona","apiBaseUrl"])Object.is(x[k],g[k])||console.warn(`[sentient] AdaptiveProvider: \`${k}\` changed after initialisation, but the SDK client is stable for the session and only re-inits on \`consent\` \u2014 the new value is ignored. Remount the provider (e.g. via a changing \`key\` prop) to apply it.`)},[e.apiKey,e.context,e.country,e.persona,m]),Y(()=>{var g;typeof process!="undefined"&&((g=process.env)==null?void 0:g.NODE_ENV)==="production"||Lt({apiKey:e.apiKey,apiBaseUrl:m,isLocal:(t==null?void 0:t.isLocal)===!0})},[t,e.apiKey,m]),Y(()=>{let g=e.initialLayoutOrder;if(g&&g.length>0){Ye(g);return}e.declaredSections&&e.declaredSections.length>0&&Ye(e.declaredSections)},[e.initialLayoutOrder,e.declaredSections]),Y(()=>{!N()||e.consent!==void 0||e.consentFrom!==void 0||nn||(nn=!0,console.warn('[SentientUI] No consent gate: every visitor is tracked from first paint. Pass consentFrom="<your CMP>" (or consent={true} to silence). https://sentient-ui.com/docs#consent'))},[]),Y(()=>{if(!N())return;let g=e.declaredSections;if(!g||g.length===0||typeof document=="undefined")return;let x=new Set(Array.from(document.querySelectorAll("[data-sentient-id]"),k=>k.getAttribute("data-sentient-id"))),S=g.filter(k=>!x.has(k));S.length>0&&console.warn(`[SentientUI] Declared section${S.length>1?"s":""} ${S.map(k=>`"${k}"`).join(", ")} ${S.length>1?"have":"has"} no matching data-sentient-id element, so the layout engine cannot learn what they are and will serve the same order to every persona. Add data-sentient-id="<sectionId>" to each section's element.`)},[e.declaredSections]);let f=tn(()=>t&&i?Nt(t):t,[t,i]),b=tn(()=>{var g,x,S,k,R,P,E,F;return{client:f,apiKey:e.apiKey,initialAssignments:(g=e.initialAssignments)!=null?g:{},sessionSegment:r,ssrFallback:o,onAssignment:e.onAssignment,initialLayoutOrder:(x=e.initialLayoutOrder)!=null?x:null,initialSlots:(S=e.initialSlots)!=null?S:{},initialSlotConfig:(k=e.initialSlotConfig)!=null?k:{},initialPalette:(R=e.initialPalette)!=null?R:null,initialVocabulary:(P=e.initialVocabulary)!=null?P:null,initialPersona:(E=e.initialPersona)!=null?E:null,apiBaseUrl:m,debug:(F=e.debug)!=null?F:!1}},[f,e.apiKey,e.initialAssignments,r,o,e.onAssignment,e.initialLayoutOrder,e.initialSlots,e.initialSlotConfig,e.initialPalette,e.initialVocabulary,e.initialPersona,m,e.debug]);return fr(B.Provider,{value:b,children:e.children})}function D(){return j(B).client}function Z(){return j(B).apiKey}function rt(){return j(B).initialAssignments}function xe(){return j(B).sessionSegment}function on(){return j(B).ssrFallback}function Oe(){return j(B).onAssignment}function sn(){return j(B).debug}function cr(){let e=j(B).initialLayoutOrder,t=ir(K,()=>{var n;return typeof window=="undefined"?null:(n=window.__sentient_layout_override)!=null?n:null},()=>null);return t!=null?t:e}function Ee(){return j(B).initialSlots}function an(){return j(B).initialPersona}function ln(){return j(B).initialSlotConfig}function un(){return j(B).initialPalette}function cn(){return j(B).initialVocabulary}function dr(){return j(B).apiBaseUrl}import{memo as Ir,useEffect as Lr,useState as Dr}from"react";import{useCallback as pr,useEffect as le,useMemo as fn,useRef as we,useState as yr}from"react";import{attachMicroSignalDetectors as vr}from"@sentientui/core";import{useEffect as Pe,useRef as dn,useState as gr,useSyncExternalStore as mr}from"react";import{pickFromWeights as it}from"@sentientui/policy";function ye(e){var n;if(typeof window=="undefined")return null;let t=(n=window.__sentient_overrides)==null?void 0:n[e];if(t)return t;if(!window.location.search)return null;try{let r=new URLSearchParams(window.location.search);for(let i of r.getAll("sentient_variant")){let l=i.indexOf(":");if(l!==-1&&i.slice(0,l)===e)return i.slice(l+1)}}catch(r){}return null}function ot(e,t,n,r){let i=rt(),l=on(),d=D(),c=xe(),s=Oe(),a=sn(),p=dn(null),u=mr(K,()=>ye(e),()=>null),h=u&&t.includes(u)?u:null,C=dn(null);Pe(()=>{a&&h&&C.current!==h&&(C.current=h,console.info(`[sentient] override active: ${e} -> ${h}`))},[a,h,e]);let[w,o]=gr(()=>{var b,A;if(h)return{variantId:h,content:null,isLoading:!1,settled:!0};if(!d){let _=i[e];return _&&t.includes(_)?{variantId:_,content:null,isLoading:!1,settled:!0}:l==="first"&&t.length>0?{variantId:t[0],content:null,isLoading:!1,settled:!1}:{variantId:null,content:null,isLoading:!0,settled:!1}}let v=d.getAssignment(e,c);if(v&&(t.includes(v.variantId)||v.content))return{variantId:v.variantId,content:(b=v.content)!=null?b:null,isLoading:!1,settled:!0};let f=Je(e);if(f){let _=it(f.variants,t);if(_)return{variantId:_,content:null,isLoading:!1,settled:!0}}return{variantId:(A=t[0])!=null?A:null,content:null,isLoading:!1,settled:!1}}),m=v=>{s&&p.current!==v&&(p.current=v,s(e,v))};return Pe(()=>{var b;if(h||!d)return;let v=d.getAssignment(e,c);if(v&&(t.includes(v.variantId)||v.content)){o({variantId:v.variantId,content:(b=v.content)!=null?b:null,isLoading:!1,settled:!0}),m(v.variantId);return}let f=Je(e);if(f&&w.settled&&w.variantId&&w.variantId===it(f.variants,t)){m(w.variantId);return}o(A=>{var _;return A.variantId?A:{variantId:(_=t[0])!=null?_:null,content:null,isLoading:!1,settled:!1}})},[h,d,e,c]),Pe(()=>{if(h||!d)return;let v=d.getAssignment(e,c);if(v&&t.includes(v.variantId))return;let f=!1;return d.assign(e,t,n,r).then(b=>{var A;f||b&&(!t.includes(b.variantId)&&!b.content||(o({variantId:b.variantId,content:(A=b.content)!=null?A:null,isLoading:!1,settled:!0}),m(b.variantId)))}),()=>{f=!0}},[h,d,e,c]),Pe(()=>{if(!h&&d)return Et(e,v=>{var A;let f=d.getAssignment(e,c);if(f&&(t.includes(f.variantId)||f.content)){o({variantId:f.variantId,content:(A=f.content)!=null?A:null,isLoading:!1,settled:!0}),m(f.variantId);return}let b=it(v.variants,t);b&&(o({variantId:b,content:null,isLoading:!1,settled:!0}),m(b))})},[h,d,e,c]),h?{variantId:h,content:null,isLoading:!1,settled:!0,isOverride:!0}:w}function Ge(e,t,n){let r=D(),i=Z(),l=Object.keys(t).join("\0"),d=fn(()=>Object.keys(t),[l]),{variantId:c,content:s,isOverride:a=!1,settled:p}=ot(e,d,n.agentData,n.agentDataByVariant),[u,h]=yr(null),C=we(null),w=pr(k=>{C.current=k,h(k)},[]),o=n.goal,m=typeof o=="string"?o:JSON.stringify(o),v=fn(()=>o?J(o):null,[m]),f=o?te(o):"";le(()=>$t({id:e,variantIds:d,goal:f}),[e,d,f]);let b=we(null);le(()=>{a||p&&(!r||!c||!i||!u||b.current!==c&&(b.current=c,ne(r,i,e,c)))},[r,c,i,e,u,a,p]);let A=we(!1),_=we(new Set);le(()=>{A.current=!1,_.current=new Set},[c,v]);let G=n.funnel;le(()=>{a||!p||!r||!G||!v||ce(r,i,e,G,v)},[r,i,e,G,v,a,p]);let g=n.cursorSignal===!0;le(()=>{if(!g||a||!p||!r||!c||!u)return;let k=null,R=0,P=()=>{R=Date.now(),k=setTimeout(()=>{r.track({projectId:i,componentId:e,variantId:c,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-R}}),k=null},800)},E=()=>{k!==null&&(clearTimeout(k),k=null)};return u.addEventListener("mouseenter",P),u.addEventListener("mouseleave",E),()=>{u.removeEventListener("mouseenter",P),u.removeEventListener("mouseleave",E),k!==null&&clearTimeout(k)}},[g,r,c,i,e,u,a,p]);let x=we(n.microSignalGoals);x.current=n.microSignalGoals;let S=n.microSignalGoals?JSON.stringify(n.microSignalGoals):"";return le(()=>{if(a||!p||!r||!c||!u)return;let k=Date.now();return vr((R,P={})=>{var L,M,ee;r.track({projectId:i,componentId:e,variantId:c,eventType:"micro_signal",payload:y({signalType:R},P)});let E=(L=x.current)==null?void 0:L[R];if(!E||_.current.has(R))return;_.current.add(R);let F=typeof E=="string"?E:E.name,$=typeof E=="string"?1:(M=E.weight)!=null?M:1,H=typeof E=="string"?0:(ee=E.stepIndex)!=null?ee:0;r.goal(F,{metadata:y({signalType:R},P),weight:$,stepIndex:H})},u,k)},[r,c,i,e,u,S,a,p]),le(()=>{if(a||!p||!r||!c||!u||!v)return;let k=z(v);return q(u,v,{fireGoal:()=>{A.current||(A.current=!0,r.track({projectId:i,componentId:e,variantId:c,eventType:"goal_achieved",goalType:f,payload:y({reward:1},k!==void 0?{goalValue:k}:{})}),r.goal(f,y({metadata:{componentId:e,variantId:c},weight:1,stepIndex:0},k!==void 0?{value:k}:{})))},fireStep:(R,P,E)=>{r.track({projectId:i,componentId:e,variantId:c,eventType:"goal_achieved",goalType:R,payload:{reward:P}}),r.goal(R,{metadata:{},weight:P,stepIndex:E})}},f)},[r,c,i,e,u,v,f,a,p]),{client:r,variantIds:d,variantId:c,content:s,settled:p,isOverride:a,goalLabel:f,ref:w,nodeRef:C}}import{useEffect as U,useMemo as pt,useRef as yt}from"react";import{containsFormBlock as On,reveal as Tr}from"@sentientui/core";import{captureRegionSkeleton as En}from"@sentientui/core/region";import{useCallback as Sr,useEffect as gn,useRef as st,useSyncExternalStore as Te}from"react";import{armOfResult as hr}from"@sentientui/core";var mn=new Set;function pn(e,t){var A,_,G;let n=D(),r=st(t==null?void 0:t.baselineText);r.current=t==null?void 0:t.baselineText;let i=st(t==null?void 0:t.render);i.current=t==null?void 0:t.render;let l=st(t==null?void 0:t.skeleton);l.current=t==null?void 0:t.skeleton;let d=Ee(),c=ln(),s=un(),a=cn(),p=Te(K,()=>{var g;return typeof window!="undefined"?(g=window.__sentient_slot_config_overrides)==null?void 0:g[e]:void 0},()=>{}),u=Te(K,()=>{var g;return typeof window!="undefined"?(g=window.__sentient_slot_overrides)==null?void 0:g[e]:void 0},()=>{}),h=g=>g==null?"":hr(g),C=Sr(g=>{var x,S;return(S=(x=n==null?void 0:n.onSlotsChanged)==null?void 0:x.call(n,g))!=null?S:(()=>{})},[n]);Te(C,()=>{var g;return(g=n==null?void 0:n.getSlotConfig(e))!=null?g:null},()=>null),Te(C,()=>h(n==null?void 0:n.getSlotResult(e)),()=>"");let w=p===void 0?c[e]:void 0,o=p===void 0&&w===void 0&&n?n.getSlotConfig(e):null,m=(A=s!=null?s:n==null?void 0:n.getSitePalette())!=null?A:null,v=(G=a!=null?a:(_=n==null?void 0:n.getStyleVocabulary)==null?void 0:_.call(n))!=null?G:null,f=(()=>{var g,x,S;if(p!==void 0)return{config:p,arm:h(u),palette:m,vocabulary:(g=Kt())!=null?g:v,source:"override"};if(w!==void 0)return{config:w,arm:h((x=d[e])!=null?x:n==null?void 0:n.getSlotResult(e)),palette:m,vocabulary:v,source:"preloaded"};if(o!==null){let k=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{config:o,arm:h((S=n==null?void 0:n.getSlotResult(e))!=null?S:d[e]),palette:m,vocabulary:v,source:k?"client":"seeded"}}return{config:null,arm:"",palette:m,vocabulary:v,source:"none"}})(),b=f.source==="preloaded"||f.source==="override";return gn(()=>{var F,$,H,L,M;if(!n||n.isLocal===!0||b)return;let g=f.source==="none",x=g&&($=(F=r.current)==null?void 0:F.call(r))!=null?$:null,S=x!=null&&x!==""?{[e]:x}:void 0,k=(H=i.current)==null?void 0:H.call(i),R=g&&(M=(L=l.current)==null?void 0:L.call(l))!=null?M:null,P=y(y({},k?{render:{[e]:k}}:{}),R?{skeletons:{[e]:R}}:{}),E=Object.keys(P).length>0;return n.requestSlots?E?n.requestSlots([e],S,P):S?n.requestSlots([e],S):n.requestSlots([e]):g&&(R?n.reportSlots([e],S!=null?S:{},{[e]:R}):S?n.reportSlots([e],S):n.reportSlots([e])),()=>{var ee;return(ee=n.cancelSlots)==null?void 0:ee.call(n,[e])}},[n,b,f.source,e]),gn(()=>{!N()||(n==null?void 0:n.isLocal)!==!0||f.source!=="none"||mn.has(e)||(mn.add(e),console.warn(`[sentient] <Adaptive id="${e}"> is rendering its baseline children: in local/keyless mode <Adaptive> serves ONLY what you pass as \`initialSlotConfig\` (there is no registry to decide from). Pass initialSlotConfig/initialSlots to <AdaptiveProvider> to preview arms locally.`))},[n,f.source,e]),f}import{cloneElement as br,Fragment as yn}from"react";import{jsx as V,jsxs as bn}from"react/jsx-runtime";function at(e){return typeof e=="string"&&!/[\s\x00-\x1f\\]/.test(e)&&(/^https:\/\//i.test(e)||e[0]==="/"&&e[1]!=="/")?e:void 0}var re={none:"0",sm:"8px",md:"16px",lg:"24px"},lt={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},xn={sm:"0.875em",md:"1em",lg:"1.25em"},xr={sm:"1.25em",md:"1.5em",lg:"2em"},vn={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},Sn={sm:"8px",md:"16px",lg:"32px"},wr={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},kr={normal:"400",medium:"500",bold:"700"};function hn(e,t){return y(y({},e==="muted"?t!=null&&t.muted?{color:t.muted}:{opacity:.7}:{}),e==="accent"?y({fontWeight:600},t!=null&&t.accent?{color:t.accent}:{}):{})}function wn(e,t,n){var i,l,d,c;let r=t==null?void 0:t.accent;return I(y({display:"inline-block",padding:(i=vn[n!=null?n:"md"])!=null?i:vn.md,borderRadius:(l=t==null?void 0:t.radius)!=null?l:"8px",font:"inherit"},n?{fontSize:xn[n]}:{}),{textDecoration:e==="ghost"?"underline":"none",cursor:"pointer",background:e==="primary"?(d=t==null?void 0:t.primaryBg)!=null?d:"#111827":"transparent",color:e==="primary"?(c=t==null?void 0:t.primaryText)!=null?c:"#ffffff":r!=null?r:"inherit",border:e==="secondary"?`1px solid ${r!=null?r:"currentColor"}`:"none"})}function Rr({node:e,opts:t}){var i,l,d,c,s;let n=(i=e.emphasis)!=null?i:"primary",r={padding:"8px 10px",font:"inherit",border:`1px solid ${(d=(l=t.palette)==null?void 0:l.border)!=null?d:"currentColor"}`,borderRadius:(s=(c=t.palette)==null?void 0:c.radius)!=null?s:"8px"};return bn("form",{onSubmit:a=>{var h,C,w;a.preventDefault();let p=new FormData(a.currentTarget),u={};for(let o of e.fields)u[o.name]=String((h=p.get(o.name))!=null?h:"");(C=t.onFormGoal)==null||C.call(t,e.submitGoal);try{(w=t.onFormSubmit)==null||w.call(t,u)}catch(o){}},style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.fields.map(a=>{var p,u;return bn("label",{style:{display:"flex",flexDirection:"column",gap:"4px",font:"inherit"},children:[a.label,a.kind==="textarea"?V("textarea",{name:a.name,required:a.required,placeholder:a.placeholder,rows:3,style:r}):a.kind==="select"?V("select",{name:a.name,required:a.required,style:r,children:((p=a.options)!=null?p:[]).map(h=>V("option",{value:h,children:h},h))}):V("input",{name:a.name,type:(u=a.inputType)!=null?u:"text",required:a.required,placeholder:a.placeholder,style:r})]},a.name)}),V("button",{type:"submit",style:wn(n,t.palette),children:e.submitLabel})]})}function Ar(e,t){var r,i;let n=e.like;return n?(i=(r=t.vocabulary)==null?void 0:r.entries.find(l=>l.id===n))==null?void 0:i.classes:void 0}function kn(e,t){var r;let n=e?(r=t.vocabulary)==null?void 0:r.entries.find(i=>i.id===e):void 0;return n!=null&&n.computed.inheritsColor?n.computed.color:void 0}function ve(e,t){var i;let n=Cr(e,t),r=kn(e.like,t);return n&&r?br(n,{style:I(y({},(i=n.props.style)!=null?i:{}),{color:r})}):n}function Cr(e,t){var n,r,i,l,d,c,s,a,p,u,h,C,w,o,m,v,f,b,A,_,G,g,x;try{let S=Ar(e,t);switch(e.type){case"stack":{let k=(r=re[(n=e.gap)!=null?n:"md"])!=null?r:re.md,R=e.surface==="raised"&&!S,P=(i=e.pad)!=null?i:R?"md":void 0;return V("div",I(y({},S?{className:S}:{}),{style:y(y(y(y(y({display:"flex",flexDirection:e.direction,gap:k},e.align?{alignItems:lt[e.align]}:{}),e.justify?{justifyContent:lt[e.justify]}:{}),e.wrap?{flexWrap:"wrap"}:{}),P?{padding:(l=re[P])!=null?l:re.md}:{}),R?I(y(y({},(d=t.palette)!=null&&d.surface?{background:t.palette.surface}:{}),(c=t.palette)!=null&&c.surface&&((s=t.palette)!=null&&s.surfaceText)?{color:t.palette.surfaceText}:{}),{border:`1px solid ${(p=(a=t.palette)==null?void 0:a.border)!=null?p:"currentColor"}`,borderRadius:(h=(u=t.palette)==null?void 0:u.radius)!=null?h:"8px"}):{}),children:((C=e.children)!=null?C:[]).map((E,F)=>{let $=ve(E,t);return $===null?null:V(yn,{children:$},F)})}))}case"grid":{let k=(o=re[(w=e.gap)!=null?w:"md"])!=null?o:re.md;return V("div",I(y({},S?{className:S}:{}),{style:y(y({display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(max(200px, calc((100% - ${e.columns-1} * ${k}) / ${e.columns})), 1fr))`,gap:k},e.align?{alignItems:lt[e.align]}:{}),e.pad?{padding:(m=re[e.pad])!=null?m:re.md}:{}),children:((v=e.children)!=null?v:[]).map((R,P)=>{let E=ve(R,t);return E===null?null:V(yn,{children:E},P)})}))}case"text":return S?V("p",{className:S,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):V("p",{style:y(y(y(y(y({margin:0},e.size?{fontSize:xn[e.size]}:{}),e.weight?{fontWeight:kr[e.weight]}:{}),e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),hn(e.tone,t.palette)),children:e.value});case"heading":{let k=`h${e.level}`;return S?V(k,{className:S,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):V(k,{style:y(y({margin:0,fontSize:xr[(f=e.size)!=null?f:"md"]},e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),children:e.value})}case"button":{let k=(b=e.emphasis)!=null?b:"primary";return V("a",I(y(y({href:at(e.href)},e.tag?{"data-sentient-tag":e.tag}:{}),S?{className:S}:{style:wn(k,t.palette,e.size)}),{children:e.label}))}case"link":return V("a",I(y(y({href:at(e.href)},e.tag?{"data-sentient-tag":e.tag}:{}),S?{className:S}:{style:{color:"inherit",textDecoration:"underline"}}),{children:e.label}));case"image":return V("img",I(y({src:at(e.src),alt:e.alt},S?{className:S}:{}),{style:y(y({display:"block",maxWidth:"100%"},e.ratio&&e.ratio!=="auto"?{aspectRatio:wr[e.ratio],width:"100%"}:{}),e.fit?{objectFit:e.fit}:{})}));case"badge":return S?V("span",{className:S,children:e.value}):V("span",{style:y({display:"inline-block",padding:"2px 10px",borderRadius:"999px",fontSize:"0.75em",border:`1px solid ${(_=(A=t.palette)==null?void 0:A.border)!=null?_:"currentColor"}`},hn(e.tone,t.palette)),children:e.value});case"spacer":return V("div",{style:{height:(G=Sn[e.size])!=null?G:Sn.md}});case"divider":return V("hr",{style:{border:"none",borderTop:`1px solid ${(x=(g=t.palette)==null?void 0:g.border)!=null?x:"currentColor"}`,margin:0,width:"100%"}});case"form":return V(Rr,{node:e,opts:t});default:return null}}catch(S){return null}}function ut(e,t){var l,d,c,s;let n=ve(e.tree,t);if(n===null)return null;let r=(l=e.surface)!=null&&l.like?(c=(d=t.vocabulary)==null?void 0:d.entries.find(a=>a.id===e.surface.like))==null?void 0:c.classes:void 0,i=kn((s=e.surface)==null?void 0:s.like,t);return r?V("div",I(y({className:r},i?{style:{color:i}}:{}),{children:n})):n}import{cloneElement as Ne,isValidElement as Ie}from"react";import{normalizeLeafText as _r,skeletonFingerprint as Or}from"@sentientui/core/region";function Le(e){return typeof e=="string"&&e.trim()!==""||typeof e=="number"}function De(e){let t=e.props;if(t.dangerouslySetInnerHTML==null)return t.children}function ue(e){return Le(e)?1:Array.isArray(e)?e.reduce((t,n)=>t+ue(n),0):Ie(e)?ue(De(e)):0}function Er(e,t){return Array.isArray(t)?Ne(e,void 0,...t):Ne(e,void 0,t)}function ct(e,t){if(Le(e))return t;if(Array.isArray(e))return e.map(n=>ct(n,t));if(Ie(e)){let n=De(e);return ue(n)===0?e:Er(e,ct(n,t))}return e}function Rn(e,t){return ue(e)===1?ct(e,t):null}var W=e=>e.join("/");function dt(e,t,n){if(Le(e)){n.leafPaths.push(t),n.texts.push(_r(String(e)));return}if(Array.isArray(e)){e.forEach((r,i)=>dt(r,[...t,i],n));return}Ie(e)&&(n.elements.set(W(t),e),dt(De(e),[...t,"c"],n))}function gt(e){let t={leafPaths:[],texts:[],elements:new Map};return dt(e,[],t),t}function Pr(e){return gt(e).texts}function An(e){let t=Pr(e);return t.length===0?null:Or(t)}function Gr(e){let t=[];return e.forEach((n,r)=>{n==="c"&&t.push(e.slice(0,r))}),t}function Cn(e,t){let n=t.reduce((i,l)=>Math.max(i,l+1),0),r=[];for(let i=0;i<n;i++){let l=t.flatMap((c,s)=>c===i?[Gr(e.leafPaths[s])]:[]);if(l.length===0){r.push(null);continue}let d=l[0];for(let c of l.slice(1)){let s=new Set(c.map(W));d=d.filter(a=>s.has(W(a)))}r.push(d.length>0?d[d.length-1]:null)}return r}function ft(e){var n;let t=(n=e==null?void 0:e.props)==null?void 0:n.className;return typeof t=="string"?t:void 0}function mt(e,t){let n=gt(t);if(n.texts.length!==e.leaves.length||n.texts.some((l,d)=>l!==e.leaves[d]))return null;let r=Cn(n,e.leafToNode),i=e.nodes.map((l,d)=>{let c=r[d],s=c?n.elements.get(W(c)):void 0,a=!!s&&(typeof s.type=="string"||ft(s)!==void 0);return I(y({},l),{restylable:a})});return I(y({},e),{nodes:i})}function _n(e,t,n){var w;let r=gt(e);if(r.leafPaths.length!==n.length)return null;let i=n.reduce((o,m)=>Math.max(o,m+1),0);for(let o of Object.keys(t.nodes))if(!/^\d+$/.test(o)||Number(o)>=i)return null;let l=Cn(r,n),d=new Map;n.forEach((o,m)=>{d.has(o)||d.set(o,m)});let c=new Map(r.leafPaths.map((o,m)=>[W(o),m])),s=new Set,a=new Map,p=!1;for(let[o,m]of Object.entries(t.nodes)){let v=Number(o),f=l[v];if(m.hidden&&(f?s.add(W(f)):p=!0),m.like!==void 0){let b=l[m.like],A=f?r.elements.get(W(f)):void 0,_=b?ft(r.elements.get(W(b))):void 0;!f||_===void 0||ft(A)===void 0?p=!0:a.set(W(f),_)}}let u=new Map(Object.entries((w=t.order)!=null?w:{})),h=(o,m)=>{var v;if(Le(o)){let f=c.get(W(m));if(f===void 0)return o;let b=n[f],A=(v=t.nodes[String(b)])==null?void 0:v.text;return A===void 0?o:d.get(b)===f?A:""}if(Array.isArray(o)){let f=o.map((b,A)=>h(b,[...m,A]));for(let[b,A]of u){let _=A.map(x=>{let S=l[x];return!S||S.length!==m.length+1||W(S.slice(0,-1))!==W(m)?-1:S[S.length-1]});if(_.some(x=>x<0))continue;let G=[..._].sort((x,S)=>x-S),g=[...f];G.forEach((x,S)=>{f[x]=g[_[S]]}),u.delete(b)}return f}if(Ie(o)){let f=W(m);if(s.has(f))return null;let b=De(o);if(ue(b)===0)return o;let A=h(b,[...m,"c"]),_=a.get(f),G=_!==void 0?{className:_}:void 0;return Array.isArray(A)?Ne(o,G,...A):Ne(o,G,A)}return o},C=h(e,[]);return p||u.size>0?null:C}import{jsx as Nr}from"react/jsx-runtime";var Pn=new Set,Gn=new Set,Tn=new Set,Nn="authored.";function Ve({id:e,children:t,variants:n,onFormSubmit:r,goal:i,className:l,as:d="div",reportBaselineText:c=!0}){var wt,kt;let s=D(),a=Z(),p=yt(null),u=pt(()=>An(t),[t]),h=n?Object.keys(n).join("|"):"",C=pt(()=>y({fp:u!=null?u:"0000000000000000",forms:!!r,compose:!0,content:ue(t)===1},h!==""?{authored:h.split("|"),children:!0}:{}),[u,t,r,h]),w=()=>{var X;let O=p.current;if(!O||!c)return null;let T=En(O);return T.skeleton?(X=mt(T.skeleton,t))!=null?X:I(y({},T.skeleton),{editable:!1,nodes:T.skeleton.nodes.map(ie=>I(y({},ie),{restylable:!1}))}):{status:T.reason}},{config:o,arm:m,palette:v,vocabulary:f,source:b}=pn(e,{baselineText:c?()=>{var O,T;return(T=(O=p.current)==null?void 0:O.textContent)!=null?T:null}:void 0,render:()=>C,skeleton:w}),A=m!==""?(wt=o==null?void 0:o.blocks)==null?void 0:wt[m]:void 0,_=m!==""?(kt=o==null?void 0:o.compose)==null?void 0:kt[m]:void 0,G=(A!==void 0&&On(A)||_!==void 0&&On(_.tree))&&!r;U(()=>{!G||!N()||Pn.has(e)||(Pn.add(e),console.warn(`[sentient] AdaptiveSlot "${e}" was served a form arm but has no onFormSubmit handler \u2014 rendering its baseline children instead. Pass onFormSubmit to render generated forms.`))},[G,e]);let g=O=>{!s||b==="override"||(b!=="seeded"&&s.componentGoal(e,O),s.goal(O,{metadata:{componentId:e,arm:m},weight:1,stepIndex:0}))},x=t,S=!1,k=m.startsWith(Nn)?m.slice(Nn.length):null;if((o==null?void 0:o.blocked)==="variant_history")S=!0;else if(k!==null)n&&Object.prototype.hasOwnProperty.call(n,k)?x=n[k]:S=!0;else if(_!==void 0){let O=G?null:ut(_,{palette:v,vocabulary:f,onFormSubmit:r,onFormGoal:g});O===null?S=!0:x=O}else if(A!==void 0){let O=G?null:ve(A,{palette:v,vocabulary:f,onFormSubmit:r,onFormGoal:g});O===null?S=!0:x=O}else if((o==null?void 0:o.edits)!==void 0&&b!=="none"){let O=o.edits,T=O.fp===u?_n(t,O.edits,O.leafToNode):null;T===null?S=!0:x=T}else if((o==null?void 0:o.content)!==void 0&&b!=="none"){let O=Rn(t,o.content);O===null?S=!0:x=O}let R=S&&A===void 0&&_===void 0&&(o==null?void 0:o.edits)===void 0&&k===null&&(o==null?void 0:o.blocked)===void 0;U(()=>{(o==null?void 0:o.blocked)!=="variant_history"||!N()||Tn.has(e)||(Tn.add(e),console.warn(`[sentient] <Adaptive id="${e}"> has results from its earlier variants experiment, so it is showing your original until you migrate it: Matrix \u2192 Components \u2192 "${e}" \u2192 Migrate. Deploying code never switches an experiment.`))},[o==null?void 0:o.blocked,e]);let P=k!==null&&!S?k:null;U(()=>{var Se;if(!P||!c||!s)return;let O=p.current;if(!O)return;let T=En(O),X=T.skeleton?mt(T.skeleton,n==null?void 0:n[P]):null,ie=(Se=O.textContent)==null?void 0:Se.trim();s.reportSlots([],void 0,void 0,{[e]:[y(y({key:P},ie?{text:ie}:{}),X?{skeleton:X}:{})]})},[P,s,e]);let E=S&&(o==null?void 0:o.edits)!==void 0&&(b==="preloaded"||b==="client");U(()=>{var O;!E||!(o!=null&&o.edits)||(O=s==null?void 0:s.reportDrift)==null||O.call(s,e,o.edits.fp,u,o.edits.fp===u?"unaddressable":"fp_mismatch")},[E,e,u,s]);let F=x===t;U(()=>{var T;if(!(o!=null&&o.needsSkeleton)||!F)return;let O=w();O&&((T=s==null?void 0:s.reportSkeleton)==null||T.call(s,e,O))},[o==null?void 0:o.needsSkeleton,F,e,s]),U(()=>{if(!F)return;let O=qt(e);if(!O)return;let T=w();Yt(O,T&&"status"in T?{status:T.status}:{skeleton:T})},[e,F]),U(()=>{!R||!N()||Gn.has(e)||(Gn.add(e),console.warn(`[sentient] <Adaptive id="${e}"> was served a text version, but its children have several separate texts or none Sentient can reach \u2014 rendering the original instead. Regenerate the version (new versions edit each text in place), or put a single text inline.`))},[R,e]);let $=o!=null&&o.blocks?Object.keys(o.blocks).sort().join("|"):"";U(()=>de({id:e,arms:$===""?void 0:$.split("|")}),[e,$]);let H=yt(null);U(()=>{!s||b==="none"||b==="seeded"||b==="override"||m===""||S||H.current!==m&&(H.current=m,ne(s,a,e,m))},[s,a,e,m,b,S]);let L=b!=="none"&&b!=="seeded"&&!S,M=L?m:"",ee=i===void 0?null:typeof i=="string"?i:JSON.stringify(i);U(()=>{if(!s||!i||b==="override")return;let O=p.current;if(!O)return;let T=te(i),X=z(i),ie=!1;return q(O,J(i),{fireGoal:()=>{ie||(ie=!0,L&&(X!==void 0?s.componentGoal(e,T,{value:X}):s.componentGoal(e,T)),s.goal(T,y({metadata:{componentId:e,arm:M},weight:1,stepIndex:0},X!==void 0?{value:X}:{})))},fireStep:(Se,Rt,Un)=>{L&&s.componentGoal(e,Se,{reward:Rt}),s.goal(Se,{metadata:{componentId:e,arm:M},weight:Rt,stepIndex:Un})}},T)},[s,e,ee,m,b,S,L,M]);let ke=yt(null);U(()=>{let O=p.current;if(O){if(ke.current===null){ke.current=m;return}ke.current!==m&&(ke.current=m,Tr(O))}},[m]);let Jn=pt(()=>y({"data-sentient-slot":e},m!==""?{"data-sentient-arm":m}:{}),[e,m]);return Nr(d,I(y({ref:p,className:l},Jn),{children:x}))}import{jsx as Fe}from"react/jsx-runtime";function Vr(e){var p,u;let{client:t,variantId:n,content:r,ref:i}=Ge(e.id,e.variants,{goal:e.goal,funnel:e.funnel,microSignalGoals:e.microSignalGoals,agentData:e.agentData,agentDataByVariant:e.agentDataByVariant,cursorSignal:!0}),[l,d]=Dr(!1);Lr(()=>{d(!0)},[]);let c=(p=e.as)!=null?p:"div";if(e.clientOnly&&(!l||!t)||!n)return null;let s=(u=e.variants[n])!=null?u:null,a=s===null?r:null;return N()&&s===null&&a===null&&console.warn(`[sentient] <Adaptive id="${e.id}"> was assigned variant "${n}" but no matching key exists in props.variants. If this is a dashboard-managed text variant, use <AdaptiveText id="${e.id}"> instead.`),Fe(c,{ref:i,className:e.className,"data-sentient-id":e.id,"data-sentient-variant":n,children:s!=null?s:a})}var Fr=Ir(Vr,(e,t)=>{if(e.id!==t.id||e.goal!==t.goal&&JSON.stringify(e.goal)!==JSON.stringify(t.goal)||e.microSignalGoals!==t.microSignalGoals||e.funnel!==t.funnel||e.clientOnly!==t.clientOnly||e.as!==t.as||e.className!==t.className||e.agentData!==t.agentData||e.agentDataByVariant!==t.agentDataByVariant)return!1;if(e.variants===t.variants)return!0;let n=Object.keys(e.variants),r=Object.keys(t.variants);return n.length!==r.length?!1:n.every(i=>i in t.variants&&Object.is(e.variants[i],t.variants[i]))});function Mr(e){if(e.variants===void 0)return Fe(Ve,y({},e));let t=e;if(t.children!=null){N()&&Br(t);let n=t,{funnel:r,microSignalGoals:i,agentData:l,agentDataByVariant:d,clientOnly:c,variants:s}=n,a=Ae(n,["funnel","microSignalGoals","agentData","agentDataByVariant","clientOnly","variants"]);return Fe(Ve,I(y({},a),{children:t.children,variants:s}))}return Fe(Fr,y({},t))}var In=new Set;function Br(e){let t=["funnel","microSignalGoals","agentData","agentDataByVariant","clientOnly"].filter(n=>e[n]!==void 0);t.length===0||In.has(e.id)||(In.add(e.id),console.warn(`[sentient] <Adaptive id="${e.id}"> has both variants and children, so it runs as one experiment with your original and generated versions. These props only apply to a variants-only component and are ignored here: ${t.join(", ")}.`))}import{useEffect as Me,useMemo as $r,useRef as vt,useState as Ln,useSyncExternalStore as jr}from"react";import{jsx as Kr}from"react/jsx-runtime";function Wr({id:e,default:t,component:n="span",className:r,goal:i}){var G;let l=D(),d=Z(),c=Oe(),s=xe(),a=vt(null),p=vt(null),u=jr(K,()=>ye(e),()=>null),[h,C]=Ln(()=>{var g,x;return(x=(g=l==null?void 0:l.getAssignment(e,s))==null?void 0:g.content)!=null?x:null}),[w,o]=Ln(()=>{var g,x;return(x=(g=l==null?void 0:l.getAssignment(e,s))==null?void 0:g.variantId)!=null?x:null});Me(()=>{if(u||!l)return;let g=l.getAssignment(e,s);if((g==null?void 0:g.content)!==void 0){o(g.variantId),C(g.content);return}let x=!1;return l.assign(e).then(S=>{if(!x){if(!S){N()&&console.warn(`[sentient] <AdaptiveText id="${e}"> assignment failed \u2014 showing default text.`);return}o(S.variantId),S.content&&C(S.content)}}),()=>{x=!0}},[l,e,s,u]),Me(()=>{u||!l||!w||!d||a.current!==w&&(a.current=w,l.track({projectId:d,componentId:e,variantId:w,eventType:"variant_assigned",payload:{}}),c==null||c(e,w))},[l,w,d,e,c,u]);let m=i===void 0?"":typeof i=="string"?i:JSON.stringify(i),v=$r(()=>i===void 0?null:J(i),[m]),f=i===void 0?null:typeof i=="string"?i:v.type,b=vt(!1);Me(()=>{b.current=!1},[w,m]),Me(()=>{if(u||!l||!w||!d||!v||!f)return;let g=p.current;if(!g)return;let x=z(v);return q(g,v,{fireGoal:()=>{b.current||(b.current=!0,l.track({projectId:d,componentId:e,variantId:w,eventType:"goal_achieved",goalType:f,payload:y({reward:1},x!==void 0?{goalValue:x}:{})}),l.goal(f,y({metadata:{componentId:e,variantId:w},weight:1,stepIndex:0},x!==void 0?{value:x}:{})))},fireStep:(S,k,R)=>{l.track({projectId:d,componentId:e,variantId:w,eventType:"goal_achieved",goalType:S,payload:{reward:k}}),l.goal(S,{metadata:{},weight:k,stepIndex:R})}})},[l,w,d,e,v,f,u]);let A=h!=null?h:t;if(u){let g=l==null?void 0:l.getAssignment(e,s);A=g&&g.variantId===u&&(G=g.content)!=null?G:t}return Kr(n,{ref:g=>{p.current=g},className:r,children:A})}import{useCallback as Jr,useRef as Ur}from"react";function St(e){let t=D(),n=Ur(new Set);return Jr((r,i)=>{var l,d;if(!ye(e)){if(i!=null&&i.once){if(n.current.has(r))return;n.current.add(r)}t==null||t.componentGoal(e,r,i),t==null||t.goal(r,y(y(y({metadata:(l=i==null?void 0:i.metadata)!=null?l:{},weight:(d=i==null?void 0:i.reward)!=null?d:1,stepIndex:0},(i==null?void 0:i.value)!==void 0?{value:i.value}:{}),(i==null?void 0:i.currency)!==void 0?{currency:i.currency}:{}),(i==null?void 0:i.externalId)!==void 0?{externalId:i.externalId}:{}))}},[t,e])}import{useEffect as Hr,useRef as Dn}from"react";function Xr(e,t={}){let s=t,{componentId:n}=s,r=Ae(s,["componentId"]),i=D(),l=St(n!=null?n:""),d=Dn(!1),c=Dn(r);c.current=r,Hr(()=>{if(!i||d.current||i.gated)return;d.current=!0;let{metadata:a,reward:p,value:u,currency:h,externalId:C}=c.current;if(n){l(e,c.current);return}i.goal(e,y(y(y({metadata:a!=null?a:{},weight:p!=null?p:1,stepIndex:0},u!==void 0?{value:u}:{}),h!==void 0?{currency:h}:{}),C!==void 0?{externalId:C}:{}))},[i,n,e,l])}import{renderPrePaintScript as zr}from"@sentientui/core";import{confidenceBand as qr}from"@sentientui/policy";import{jsx as Qr}from"react/jsx-runtime";function ht(e){return JSON.stringify(e).replace(/</g,"\\u003c")}function Yr(e){return e.persona?"(function(){try{var d=document.documentElement;"+(e.stage?'if(!d.hasAttribute("data-sentient-stage"))d.setAttribute("data-sentient-stage",'+ht(e.stage)+");":"")+'if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",'+ht(e.persona.persona)+');d.setAttribute("data-sentient-confidence",'+ht(qr(e.persona.confidence))+");}catch(e){}})();":zr(e.apiKey,e.stageAttributes?{stage:!0}:void 0)}function Zr(e){return!e.persona&&(e.consent===!1||e.consentFrom!==void 0&&e.consent!==!0)?null:Qr("script",{"data-sentient-persona-script":"",nonce:e.nonce,dangerouslySetInnerHTML:{__html:Yr(e)}})}import{useEffect as je,useMemo as xt,useRef as si}from"react";import{validateSlotDecl as ai}from"@sentientui/policy";import{useEffect as bt,useReducer as ei,useState as ti,useSyncExternalStore as Vn}from"react";import{armOfResult as Be,baselineResultFor as ni}from"@sentientui/core";import{confidenceBand as ri}from"@sentientui/policy";function $e(e,t){let n=D(),r=Ee(),[,i]=ei(u=>u+1,0),l=Vn(K,()=>{var u;return typeof window!="undefined"?(u=window.__sentient_slot_overrides)==null?void 0:u[e]:void 0},()=>{}),d=l===void 0?r[e]:void 0,c=l===void 0&&d===void 0&&n?n.getSlotResult(e):null,s=(n==null?void 0:n.isLocal)===!0&&l===void 0&&d===void 0&&c===null;bt(()=>{if(!s||!n)return;let u=!1;return n.decide({slots:[t]}).then(h=>{!u&&h&&i()}),()=>{u=!0}},[n,e,s]);let a=(()=>{if(l!==void 0)return{result:l,arm:Be(l),source:"override"};if(d!==void 0)return{result:d,arm:Be(d),source:"preloaded"};if(c!==null){let h=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{result:c,arm:Be(c),source:h?"client":"seeded"}}let u=ni(t);return{result:u,arm:Be(u),source:"baseline"}})(),p=a.source==="preloaded"||a.source==="override";return bt(()=>{var h;if(!n||n.isLocal===!0||p||!n.decideSlots)return;let u=(h=n.onSlotsChanged)==null?void 0:h.call(n,i);return n.decideSlots([t]),()=>{var C;(C=n.cancelSlots)==null||C.call(n,[e]),u==null||u()}},[n,e,p]),a}function ii(){var t;if(typeof window=="undefined")return null;let e=window.__sentient_persona_override;if(e!=null&&e.persona)return{persona:e.persona,confidence:(t=e.confidence)!=null?t:1};try{let n=new URLSearchParams(window.location.search).get("sentient_persona");if(n)return{persona:n,confidence:1}}catch(n){}return null}function oi(){let e=D(),t=an();Vn(K,It,()=>0);let[n,r]=ti(!1);bt(()=>r(!0),[]);let i=c=>({persona:c.persona,confidence:c.confidence,band:ri(c.confidence)});if(!n)return t?i(t):null;let l=ii();if(l)return i(l);if(t)return i(t);let d=e?e.getPersona():null;return d?i(d):null}var Fn=new Set;function li(e){return typeof CSS!="undefined"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/[\\"]/g,"\\$&")}function ui(e,t,n){let r=D(),i=Z(),l=JSON.stringify(t),d=xt(()=>({id:e,dims:t}),[e,l]),{result:c,arm:s,source:a}=$e(e,d),p=xt(()=>typeof c=="string"?{}:c,[s]);if(N()&&!Fn.has(e)){Fn.add(e);let o=ai({id:e,dims:Object.fromEntries(Object.entries(t).map(([v,f])=>[v,[...f]]))}),m=Object.values(t).reduce((v,f)=>v*f.length,1);o.ok?m>4&&console.warn(`[sentient] useAdaptiveTokens("${e}") declares ${m} combinations \u2014 more than the recommended 4. Each extra combination needs more traffic to learn; consider fewer dims/values.`):console.warn(`[sentient] useAdaptiveTokens("${e}"): invalid declaration \u2014 ${o.reason}. Serving baseline.`)}let u=(n==null?void 0:n.goal)===void 0?null:typeof n.goal=="string"?n.goal:JSON.stringify(n.goal);je(()=>de({id:e,dims:t}),[e]);let h=si(null);je(()=>{!r||a==="baseline"||a==="seeded"||a==="override"||h.current===s||(h.current=s,ne(r,i,e,s))},[r,i,e,s,a]);let C=n==null?void 0:n.funnel;je(()=>{var o;!r||!C||a==="override"||ce(r,i,e,C,J((o=n==null?void 0:n.goal)!=null?o:"click"))},[r,i,e,C,u,a]),je(()=>{if(!r||!(n!=null&&n.goal)||a==="override"||a==="baseline"||a==="seeded")return;let o=document.querySelector(`[data-sentient-slot="${li(e)}"]`);if(!o){N()&&console.warn(`[sentient] useAdaptiveTokens("${e}"): a goal is declared but no element carries the returned props \u2014 spread {...props} on the slot's element.`);return}let m=te(n.goal),v=z(n.goal),f=!1;return q(o,J(n.goal),{fireGoal:()=>{f||(f=!0,v!==void 0?r.componentGoal(e,m,{value:v}):r.componentGoal(e,m),r.goal(m,y({metadata:{componentId:e,arm:s},weight:1,stepIndex:0},v!==void 0?{value:v}:{})))},fireStep:(b,A,_)=>{r.componentGoal(e,b,{reward:A}),r.goal(b,{metadata:{componentId:e,arm:s},weight:A,stepIndex:_})}},m)},[r,e,u,s,a]);let w=xt(()=>{let o={"data-sentient-slot":e};for(let[m,v]of Object.entries(p))o[`data-${m}`]=v;return o},[e,p]);return{tokens:p,props:w}}import{useCallback as ci,useEffect as di,useMemo as fi}from"react";var Mn=new Set;function gi(e,t){var C;if(N()&&!t.goal)throw new Error(`[sentient] useAdaptive("${e}"): a goal is required \u2014 without one the optimizer accumulates exposures with no rewards and cannot learn. Pass e.g. goal: 'buy_click'.`);let{client:n,variantIds:r,variantId:i,isOverride:l,goalLabel:d,ref:c,nodeRef:s}=Ge(e,t.variants,{goal:t.goal,funnel:t.funnel,microSignalGoals:t.microSignalGoals}),a=(C=i!=null?i:r[0])!=null?C:"",p=t.variants[a];di(()=>{if(!N()||!n)return;let w=setTimeout(()=>{!s.current&&!Mn.has(e)&&(Mn.add(e),console.warn(`[sentient] useAdaptive("${e}"): bind was never attached \u2014 spread {...bind} on the rendered element, otherwise exposure and goal tracking cannot work and the optimizer learns nothing.`))},0);return()=>clearTimeout(w)},[n,e]);let u=ci((w,o)=>{var v,f;if(l)return;let m=w!=null?w:d;m&&(n==null||n.componentGoal(e,m,o),n==null||n.goal(m,y(y(y({metadata:(v=o==null?void 0:o.metadata)!=null?v:{},weight:(f=o==null?void 0:o.reward)!=null?f:1,stepIndex:0},(o==null?void 0:o.value)!==void 0?{value:o.value}:{}),(o==null?void 0:o.currency)!==void 0?{currency:o.currency}:{}),(o==null?void 0:o.externalId)!==void 0?{externalId:o.externalId}:{})))},[n,e,d,l]),h=fi(()=>({ref:c,"data-sentient-id":e,"data-sentient-variant":a}),[c,e,a]);return{variant:a,value:p,bind:h,fireGoal:u}}import{Children as mi,isValidElement as pi,useEffect as We,useMemo as Bn,useRef as $n}from"react";import{jsx as vi}from"react/jsx-runtime";var Ke=new Set;function yi(e){var v;let t=D(),n=Z(),r=$n(null),i=Object.keys(e.arrangements).join(" "),l=Bn(()=>Object.keys(e.arrangements),[i]),d=Bn(()=>y({id:e.id,arms:l},e.baseline!==void 0?{baseline:e.baseline}:{}),[e.id,l,e.baseline]),{arm:c,source:s}=$e(e.id,d);N()&&e.baseline!==void 0&&e.baseline!==l[0]&&!Ke.has(e.id+":baseline")&&(Ke.add(e.id+":baseline"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: baseline "${e.baseline}" is not the first-declared arrangement ("${l[0]}"). The first arrangement should usually be the page's real incumbent (the holdout sees it).`));let a=mi.toArray(e.children).filter(pi),p=new Map;for(let f of a)p.set(String((v=f.key)!=null?v:"").replace(/^\.\$/,""),f);let u=e.arrangements[c],h=u!==void 0&&u.length===a.length&&u.every(f=>p.has(f));N()&&u!==void 0&&!h&&!Ke.has(e.id+":keys")&&(Ke.add(e.id+":keys"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: arrangement "${c}" [${u.join(", ")}] does not match the children's keys \u2014 rendering declaration order (fail-safe).`));let C=h?u.map(f=>p.get(f)):a;We(()=>de({id:e.id,arms:Object.keys(e.arrangements)}),[e.id]);let w=$n(null);We(()=>{!t||s==="baseline"||s==="seeded"||s==="override"||w.current===c||(w.current=c,ne(t,n,e.id,c))},[t,n,e.id,c,s]);let o=e.funnel;We(()=>{var f;!t||!o||s==="override"||ce(t,n,e.id,o,J((f=e.goal)!=null?f:"click"))},[t,n,e.id,o,s]);let m=e.goal===void 0?null:typeof e.goal=="string"?e.goal:JSON.stringify(e.goal);return We(()=>{if(!t||e.goal===void 0||s==="override"||s==="baseline"||s==="seeded")return;let f=r.current;if(!f)return;let b=te(e.goal),A=z(e.goal),_=!1;return q(f,J(e.goal),{fireGoal:()=>{_||(_=!0,A!==void 0?t.componentGoal(e.id,b,{value:A}):t.componentGoal(e.id,b),t.goal(b,y({metadata:{componentId:e.id,arm:c},weight:1,stepIndex:0},A!==void 0?{value:A}:{})))},fireStep:(G,g,x)=>{t.componentGoal(e.id,G,{reward:g}),t.goal(G,{metadata:{componentId:e.id,arm:c},weight:g,stepIndex:x})}},b)},[t,e.id,m,c,s]),vi("div",{ref:r,"data-sentient-id":e.id,"data-sentient-variant":c,children:C})}import{deriveSessionSegment as Si}from"@sentientui/core";var hi=["page","blocks","layoutOrder"],jn=new Map;function bi(e,t){jn.set(e,t)}function Wn(e){return jn.get(e)}function xi(e){var i,l;let t=(l=(i=e.content)!=null?i:Wn(e.page))!=null?l:{},n={};for(let[d,c]of Object.entries(t))hi.includes(d)||(n[d]=c);let r=I(y({},n),{page:e.page,blocks:e.blocks});return e.layoutOrder&&(r.layoutOrder=e.layoutOrder),r}function wi(e){return`<script type="application/ld+json">${Kn(e)}</script>`}function Kn(e){return JSON.stringify(y({"@context":"https://schema.org","@type":"WebPage"},e)).replace(/</g,"\\u003c")}function ki(e){let t=[];e.title&&t.push(`# ${e.title}`,""),e.summary&&t.push(String(e.summary),"");for(let[n,r]of Object.entries(e))["page","title","summary","blocks","layoutOrder"].includes(n)||t.push(`## ${n}`,"","```json",JSON.stringify(r,null,2),"```","");if(e.blocks.length>0){t.push("## blocks","");for(let n of e.blocks)t.push(`- **${n.id}** \u2192 variant \`${n.variant}\``),n.content!==void 0&&t.push(""," ```json",JSON.stringify(n.content,null,2)," ```");t.push("")}return t.join(`
3
3
  `).trimEnd()+`
4
- `}import{grantConsent as ka}from"@sentientui/core";import{consentWatcher as Aa}from"@sentientui/core/consent";export{Mr as Adaptive,yi as AdaptiveGroup,ur as AdaptiveProvider,Ve as AdaptiveSlot,Wr as AdaptiveText,Zr as SentientPersonaScript,xi as buildAgentFeed,Aa as consentWatcher,bi as defineAgentContent,Si as detectSegment,Wn as getAgentContent,ka as grantConsent,wi as renderAgentJsonLd,Kn as renderAgentJsonLdBody,ki as renderAgentMarkdown,ve as renderBlocks,ut as renderCompose,gi as useAdaptive,dr as useAdaptiveApiBaseUrl,St as useAdaptiveGoal,oi as useAdaptivePersona,ui as useAdaptiveTokens,ot as useAssignment,rt as useInitialAssignments,cr as useLayoutOrder,Xr as usePageGoal,D as useSentient,xe as useSessionSegment};
4
+ `}import{grantConsent as ka}from"@sentientui/core";import{consentWatcher as Ca}from"@sentientui/core/consent";export{Mr as Adaptive,yi as AdaptiveGroup,ur as AdaptiveProvider,Ve as AdaptiveSlot,Wr as AdaptiveText,Zr as SentientPersonaScript,xi as buildAgentFeed,Ca as consentWatcher,bi as defineAgentContent,Si as detectSegment,Wn as getAgentContent,ka as grantConsent,wi as renderAgentJsonLd,Kn as renderAgentJsonLdBody,ki as renderAgentMarkdown,ve as renderBlocks,ut as renderCompose,gi as useAdaptive,dr as useAdaptiveApiBaseUrl,St as useAdaptiveGoal,oi as useAdaptivePersona,ui as useAdaptiveTokens,ot as useAssignment,rt as useInitialAssignments,cr as useLayoutOrder,Xr as usePageGoal,D as useSentient,xe as useSessionSegment};
5
5
  //# sourceMappingURL=index.mjs.map