@sentientui/react 0.35.0 → 0.35.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- "use strict";var Qn=Object.create;var Ce=Object.defineProperty,er=Object.defineProperties,tr=Object.getOwnPropertyDescriptor,nr=Object.getOwnPropertyDescriptors,rr=Object.getOwnPropertyNames,Te=Object.getOwnPropertySymbols,ir=Object.getPrototypeOf,Ze=Object.prototype.hasOwnProperty,Rt=Object.prototype.propertyIsEnumerable;var wt=(e,t,n)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v=(e,t)=>{for(var n in t||(t={}))Ze.call(t,n)&&wt(e,n,t[n]);if(Te)for(var n of Te(t))Rt.call(t,n)&&wt(e,n,t[n]);return e},M=(e,t)=>er(e,nr(t));var Le=(e,t)=>{var n={};for(var r in e)Ze.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Te)for(var r of Te(e))t.indexOf(r)<0&&Rt.call(e,r)&&(n[r]=e[r]);return n};var or=(e,t)=>{for(var n in t)Ce(e,n,{get:t[n],enumerable:!0})},kt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rr(t))!Ze.call(e,i)&&i!==n&&Ce(e,i,{get:()=>t[i],enumerable:!(r=tr(t,i))||r.enumerable});return e};var Ye=(e,t,n)=>(n=e!=null?Qn(ir(e)):{},kt(t||!e||!e.__esModule?Ce(n,"default",{value:e,enumerable:!0}):n,e)),sr=e=>kt(Ce({},"__esModule",{value:!0}),e);var Pr={};or(Pr,{Adaptive:()=>_n,AdaptiveGroup:()=>Kn,AdaptiveProvider:()=>Zt,AdaptiveSlot:()=>Ee,AdaptiveText:()=>On,SentientPersonaScript:()=>Dn,buildAgentFeed:()=>Hn,defineAgentContent:()=>Un,detectSegment:()=>yt.deriveSessionSegment,getAgentContent:()=>vt,grantConsent:()=>qn.grantConsent,renderAgentJsonLd:()=>zn,renderAgentJsonLdBody:()=>St,renderAgentMarkdown:()=>Xn,renderBlocks:()=>fe,renderCompose:()=>Ke,useAdaptive:()=>jn,useAdaptiveApiBaseUrl:()=>sn,useAdaptiveGoal:()=>ze,useAdaptivePersona:()=>Vn,useAdaptiveTokens:()=>$n,useAssignment:()=>Be,useInitialAssignments:()=>Ne,useLayoutOrder:()=>en,usePageGoal:()=>Pn,useSentient:()=>I});module.exports=sr(Pr);var C=require("react"),Ie=require("@sentientui/core");var At=new Map,De=new Map;function Ct(e,t){let n=De.get(e);return n||(n=new Set,De.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&De.delete(e)}}function _t(e,t){At.set(e,t);let n=De.get(e);if(n)for(let r of n)try{r(t)}catch(i){}}function Qe(e){var t;return(t=At.get(e))!=null?t:null}var ar={on:!1,listeners:new Set};function Ot(){if(typeof window=="undefined")return ar;let e=window;return e.__sentient_preview||(e.__sentient_preview={on:!1,listeners:new Set}),e.__sentient_preview}function et(){return Ot().on}function Et(e){let t=Ot().listeners;return t.add(e),()=>{t.delete(e)}}function Pt(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 tt="sentient:overrides-changed";function Gt(){var e;return typeof window=="undefined"?0:(e=window.__sentient_overrides_version)!=null?e:0}function nt(){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(tt))}function J(e){return typeof window=="undefined"?()=>{}:(window.addEventListener(tt,e),()=>window.removeEventListener(tt,e))}function Tt(e){typeof window!="undefined"&&(window.__sentient_devtools_config=e)}function G(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}function U(e){return typeof e=="string"?{type:"click"}:e}function se(e){return typeof e=="string"?e:e.type}function ee(e){if(typeof e!="string"&&(e.type==="click"||e.type==="form_submit"||e.type==="scroll_depth"))return e.value}var rt=new Set,it=!1;function Lt(e){if(rt.has(e))return!0;if(rt.add(e),!it){it=!0;let t=()=>{it=!1,rt.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 lr(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(lr(r))return!0;r=r.parentElement}return!1}function te(e,t,n,r){if(t.type==="weighted_composite"){let s=new Set,p=[];return t.steps.forEach(({goal:f,name:h,weight:k},c)=>{let u=(m=!1)=>{s.has(c)||m&&r!==void 0&&Lt(`step\0${h}\0${k}\0${c}`)||(s.add(c),n.fireStep(h,k,c))};if(f.type==="click"){let m=g=>{let a=g.target;a instanceof Element&&Dt(a,e,f.selector)&&u()};e.addEventListener("click",m),p.push(()=>e.removeEventListener("click",m));return}if(f.type==="form_submit"){let m=g=>{g.target instanceof HTMLFormElement&&e.contains(g.target)&&u()};e.addEventListener("submit",m),p.push(()=>e.removeEventListener("submit",m));return}if(f.type==="scroll_depth"){let m=Math.max(0,Math.min(1,f.threshold)),g=new IntersectionObserver(a=>{for(let S of a)if(S.intersectionRatio>=m){u(!0),g.disconnect();break}},{threshold:[m]});g.observe(e),p.push(()=>g.disconnect())}}),()=>{for(let f of p)f()}}let i=t.type==="composite"?t.all:[t],l=new Set(i.map((s,p)=>p)),d=()=>{r!==void 0&&Lt(r)||n.fireGoal()},o=(s,p=!1)=>{l.delete(s),l.size===0&&(p?d():n.fireGoal())},y=[];return i.forEach((s,p)=>{if(s.type==="click"){let f=h=>{let k=h.target;k instanceof Element&&Dt(k,e,s.selector)&&(t.type==="composite"?o(p):n.fireGoal())};e.addEventListener("click",f),y.push(()=>e.removeEventListener("click",f));return}if(s.type==="form_submit"){let f=h=>{h.target instanceof HTMLFormElement&&e.contains(h.target)&&(t.type==="composite"?o(p):n.fireGoal())};e.addEventListener("submit",f),y.push(()=>e.removeEventListener("submit",f));return}if(s.type==="scroll_depth"){let f=Math.max(0,Math.min(1,s.threshold)),h=new IntersectionObserver(k=>{for(let c of k)if(c.intersectionRatio>=f){t.type==="composite"?o(p,!0):d(),h.disconnect();break}},{threshold:[f]});h.observe(e),y.push(()=>h.disconnect());return}}),()=>{for(let s of y)s()}}var It=new Set,Nt=new Set;function pe(e,t,n,r,i){let l=`${r}|${n}`;if(Nt.has(l))return;Nt.add(l);let d=i.type==="weighted_composite"&&!It.has(r);d&&It.add(r),e.track({projectId:t,componentId:n,eventType:"funnel_declared",payload:d?{funnelId:r,steps:i.steps.map(o=>({goalId:o.name,weight:o.weight}))}:{funnelId:r}})}function ae(e,t,n,r){e.track({projectId:t,componentId:n,variantId:r,eventType:"variant_assigned",payload:{}})}var ur={components:new Map,slots:new Map,sections:[],listeners:new Set,version:0};function ce(){if(typeof window=="undefined")return ur;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 _e(){ce().version+=1;for(let e of ce().listeners)e()}var Vt=()=>{};function Ft(e){return G()?(ce().components.set(e.id,e),_e(),()=>{ce().components.delete(e.id),_e()}):Vt}function ye(e){return G()?(ce().slots.set(e.id,e),_e(),()=>{ce().slots.delete(e.id),_e()}):Vt}function ot(e){G()&&(ce().sections=[...e],_e())}var Mt="0.35.0",st=Mt!=="0.0.0-dev"?{name:"react",version:Mt}:void 0;function cr(){let e=window;return e.__sentient_slot_config_overrides||(e.__sentient_slot_config_overrides={}),e.__sentient_slot_config_overrides}function ve(e,t){cr()[e]=t}function $t(e){window.__sentient_vocabulary_override=e}function Bt(){var e;return typeof window=="undefined"?null:(e=window.__sentient_vocabulary_override)!=null?e:null}function dr(){let e=window;return e.__sentient_slot_overrides||(e.__sentient_slot_overrides={}),e.__sentient_slot_overrides}function Se(e,t){dr()[e]=t}var jt="sentient_editor",Kt="sentient_preview_cell",Wt="sentient_refresh_region",at="sentient-cell-preview-bar",de="__preview__",he=null;function Jt(e){if((he==null?void 0:he.slotId)!==e)return null;let t=he;return he=null,t}function Ut(e,t){fetch(`${e.base}/editor/region-skeleton`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify(v({slotId:e.slotId},t))}).then(n=>be(n.ok?"Region refreshed \u2014 you can regenerate its versions now.":"Couldn\u2019t refresh this region \u2014 reopen the link from your dashboard.")).catch(()=>be("Couldn\u2019t refresh this region \u2014 check your connection and reopen the link from your dashboard."))}function Ht(e){if(typeof window=="undefined"||typeof document=="undefined"||document.getElementById(at))return;let t,n,r;try{let y=new URLSearchParams(window.location.search);t=y.get(jt),n=y.get(Kt),r=y.get(Wt)}catch(y){return}if(t&&r){he={slotId:r,token:t,base:(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,"")},ve(r,{kind:"arms"}),Se(r,de),nt();return}if(!t||!n)return;let i=n.lastIndexOf("~");if(i<=0)return;let l=n.slice(0,i),d=n.slice(i+1),o=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,"");fetch(`${o}/editor/cell-preview?slotId=${encodeURIComponent(l)}&persona=${encodeURIComponent(d)}`,{headers:{authorization:`Bearer ${t}`}}).then(async y=>{if(!y.ok){be(y.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 s=await y.json();if(s.vocabulary&&Array.isArray(s.vocabulary.entries)&&$t(s.vocabulary),s.compose!=null)ve(l,{kind:"arms",compose:{[de]:s.compose}}),Se(l,de);else if(s.edits!=null&&typeof s.skeletonFp=="string"&&Array.isArray(s.leafToNode))ve(l,{kind:"arms",edits:{edits:s.edits,fp:s.skeletonFp,leafToNode:s.leafToNode}}),Se(l,de);else if(s.blocks!=null)ve(l,{kind:"arms",blocks:{[de]:s.blocks}}),Se(l,de);else if(s.content!=null)ve(l,{kind:"arms",content:s.content}),Se(l,de);else{be("Nothing to preview in that square yet.");return}nt(),be(`Previewing \u201C${s.slotName}\u201D for ${s.personaDisplay}${s.status==="review"?" \u2014 waiting for your approval":""}. Nothing is being tracked.`),setTimeout(()=>{var p;try{(p=document.querySelector(`[data-sentient-slot="${l}"]`))==null||p.scrollIntoView({block:"center"})}catch(f){}},300)}).catch(()=>be("Couldn\u2019t load this preview \u2014 check your connection and reopen it from your dashboard."))}function be(e){var i;if(document.getElementById(at))return;let t=document.createElement("div");t.id=at,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=()=>{let l=new URL(window.location.href);l.searchParams.delete(jt),l.searchParams.delete(Kt),l.searchParams.delete(Wt),window.location.assign(l.toString())},t.append(n,r),((i=document.body)!=null?i:document.documentElement).append(t)}var fr="sentient_editor",zt=!1;function Xt(e){if(zt||typeof window=="undefined")return;let t=null;try{t=new URLSearchParams(window.location.search).get(fr)}catch(i){return}if(!t)return;zt=!0;let n=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,""),r=()=>{window.setTimeout(()=>{import("@sentientui/core/style-sample").then(({sampleStyleVocabulary:i})=>fetch(`${n}/editor/style-vocabulary`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify(i(document))})).catch(()=>{})},1e3)};document.readyState==="complete"?r():window.addEventListener("load",r,{once:!0})}var an=require("react/jsx-runtime");function gr(){var e,t;if(typeof window=="undefined")return"desktop:direct";try{return(0,Ie.deriveSessionSegment)({userAgent:(e=navigator.userAgent)!=null?e:"",referer:(t=document.referrer)!=null?t:"",appOrigin:window.location.origin})}catch(n){return"desktop:direct"}}var qt="https://api.sentient-ui.com/v1",B=(0,C.createContext)({client:null,apiKey:"",initialAssignments:{},sessionSegment:"desktop:direct",ssrFallback:"first",onAssignment:void 0,initialLayoutOrder:null,initialSlots:{},initialSlotConfig:{},initialPalette:null,initialVocabulary:null,initialPersona:null,apiBaseUrl:qt,debug:!1});function mr(e){let[t,n]=(0,C.useState)(!1),r=(0,C.useRef)(e);r.current=e;let{cookie:i,value:l,event:d}=e!=null?e:{},o=typeof(e==null?void 0:e.check)=="function";return(0,C.useEffect)(()=>{let y=()=>{var h;let p=r.current;if(!p)return!1;if(p.check)return p.check()===!0;if(!p.cookie||typeof document=="undefined")return!1;let f=`${p.cookie}=${(h=p.value)!=null?h:"accepted"}`;return document.cookie.split("; ").some(k=>k.trim()===f)};if(n(y()),!d)return;let s=()=>{n(y())};return window.addEventListener(d,s),()=>window.removeEventListener(d,s)},[i,l,d,o]),t}function Zt(e){var c,u;let[t,n]=(0,C.useState)(null),[r]=(0,C.useState)(()=>{var m;return(m=e.sessionSegment)!=null?m:gr()}),[i,l]=(0,C.useState)(et());(0,C.useEffect)(()=>Et(()=>l(et())),[]),(0,C.useEffect)(()=>{Ht(e.apiBaseUrl),Xt(e.apiBaseUrl)},[]);let d=mr(e.consentFrom),o=e.consentFrom?e.consent===!0||d:e.consent,y=(0,C.useRef)(null);(0,C.useEffect)(()=>{var A;if(o===!1&&!e.preConsentBehavior){(A=y.current)==null||A.destroy(),y.current=null,n(null);return}let m=v({apiKey:e.apiKey,context:e.context,debug:e.debug,initialAssignments:e.initialAssignments,sessionSegment:r,consent:o,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},st?{sdk:st}:{}),g=!1,a=null,S=null,x=E=>{e.engagement!==!1&&import("@sentientui/core/engagement").then(({startEngagementCapture:b})=>{g||(S=b(E,{apiKey:e.apiKey,sectionTypes:e.sectionTypes,apiBase:e.apiBaseUrl?e.apiBaseUrl.replace(/\/$/,""):void 0}))})};return e.enableGraph!==!1?import("@sentientui/core/graph").then(({init:E})=>{g||(a=E(M(v({},m),{graph:!0,captureDomText:e.captureDomText===!0,sectionTypes:e.sectionTypes})),y.current=a,n(a),x(a))}):(a=(0,Ie.init)(m),y.current=a,n(a),x(a)),()=>{g=!0,S==null||S(),a==null||a.dispose()}},[o]),(0,C.useEffect)(()=>{if(!t)return;let m=!1,g=async()=>{if(m)return;let S;try{S=await t.fetchWeights()}catch(x){return}if(!m)for(let x of S){let A={componentId:x.componentId,updatedAt:x.updatedAt,variants:x.variants.map(E=>{var b;return{variantId:E.variantId,pulls:E.pulls,avgReward:(b=E.avgReward)!=null?b:0}})};_t(x.componentId,A)}};g();let a=setInterval(()=>{g()},6e4);return()=>{m=!0,clearInterval(a)}},[t]);let s=(c=e.ssrFallback)!=null?c:"first",p=((u=e.apiBaseUrl)!=null?u:qt).replace(/\/$/,""),f=(0,C.useRef)(null);(0,C.useEffect)(()=>{var a;if(typeof process!="undefined"&&((a=process.env)==null?void 0:a.NODE_ENV)==="production")return;let m={apiKey:e.apiKey,context:e.context,country:e.country,persona:e.persona,apiBaseUrl:p},g=f.current;if(f.current=m,g!==null)for(let S of["apiKey","context","country","persona","apiBaseUrl"])Object.is(g[S],m[S])||console.warn(`[sentient] AdaptiveProvider: \`${S}\` 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,p]),(0,C.useEffect)(()=>{var m;typeof process!="undefined"&&((m=process.env)==null?void 0:m.NODE_ENV)==="production"||Tt({apiKey:e.apiKey,apiBaseUrl:p,isLocal:(t==null?void 0:t.isLocal)===!0})},[t,e.apiKey,p]),(0,C.useEffect)(()=>{let m=e.initialLayoutOrder;if(m&&m.length>0){ot(m);return}e.declaredSections&&e.declaredSections.length>0&&ot(e.declaredSections)},[e.initialLayoutOrder,e.declaredSections]),(0,C.useEffect)(()=>{if(!G())return;let m=e.declaredSections;if(!m||m.length===0||typeof document=="undefined")return;let g=new Set(Array.from(document.querySelectorAll("[data-sentient-id]"),S=>S.getAttribute("data-sentient-id"))),a=m.filter(S=>!g.has(S));a.length>0&&console.warn(`[SentientUI] Declared section${a.length>1?"s":""} ${a.map(S=>`"${S}"`).join(", ")} ${a.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 h=(0,C.useMemo)(()=>t&&i?Pt(t):t,[t,i]),k=(0,C.useMemo)(()=>{var m,g,a,S,x,A,E,b;return{client:h,apiKey:e.apiKey,initialAssignments:(m=e.initialAssignments)!=null?m:{},sessionSegment:r,ssrFallback:s,onAssignment:e.onAssignment,initialLayoutOrder:(g=e.initialLayoutOrder)!=null?g:null,initialSlots:(a=e.initialSlots)!=null?a:{},initialSlotConfig:(S=e.initialSlotConfig)!=null?S:{},initialPalette:(x=e.initialPalette)!=null?x:null,initialVocabulary:(A=e.initialVocabulary)!=null?A:null,initialPersona:(E=e.initialPersona)!=null?E:null,apiBaseUrl:p,debug:(b=e.debug)!=null?b:!1}},[h,e.apiKey,e.initialAssignments,r,s,e.onAssignment,e.initialLayoutOrder,e.initialSlots,e.initialSlotConfig,e.initialPalette,e.initialVocabulary,e.initialPersona,p,e.debug]);return(0,an.jsx)(B.Provider,{value:k,children:e.children})}function I(){return(0,C.useContext)(B).client}function ne(){return(0,C.useContext)(B).apiKey}function Ne(){return(0,C.useContext)(B).initialAssignments}function Ve(){return(0,C.useContext)(B).sessionSegment}function Yt(){return(0,C.useContext)(B).ssrFallback}function Fe(){return(0,C.useContext)(B).onAssignment}function Qt(){return(0,C.useContext)(B).debug}function en(){let e=(0,C.useContext)(B).initialLayoutOrder,t=(0,C.useSyncExternalStore)(J,()=>{var n;return typeof window=="undefined"?null:(n=window.__sentient_layout_override)!=null?n:null},()=>null);return t!=null?t:e}function Me(){return(0,C.useContext)(B).initialSlots}function tn(){return(0,C.useContext)(B).initialPersona}function nn(){return(0,C.useContext)(B).initialSlotConfig}function rn(){return(0,C.useContext)(B).initialPalette}function on(){return(0,C.useContext)(B).initialVocabulary}function sn(){return(0,C.useContext)(B).apiBaseUrl}var we=require("react");var N=require("react"),ln=require("@sentientui/core");var H=require("react"),$e=require("@sentientui/policy");function xe(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 Be(e,t,n,r){let i=Ne(),l=Yt(),d=I(),o=Ve(),y=Fe(),s=Qt(),p=(0,H.useRef)(null),f=(0,H.useSyncExternalStore)(J,()=>xe(e),()=>null),h=f&&t.includes(f)?f:null,k=(0,H.useRef)(null);(0,H.useEffect)(()=>{s&&h&&k.current!==h&&(k.current=h,console.info(`[sentient] override active: ${e} -> ${h}`))},[s,h,e]);let[c,u]=(0,H.useState)(()=>{var S,x;if(h)return{variantId:h,content:null,isLoading:!1,settled:!0};if(!d){let A=i[e];return A&&t.includes(A)?{variantId:A,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 g=d.getAssignment(e,o);if(g&&(t.includes(g.variantId)||g.content))return{variantId:g.variantId,content:(S=g.content)!=null?S:null,isLoading:!1,settled:!0};let a=Qe(e);if(a){let A=(0,$e.pickFromWeights)(a.variants,t);if(A)return{variantId:A,content:null,isLoading:!1,settled:!0}}return{variantId:(x=t[0])!=null?x:null,content:null,isLoading:!1,settled:!1}}),m=g=>{y&&p.current!==g&&(p.current=g,y(e,g))};return(0,H.useEffect)(()=>{var S;if(h||!d)return;let g=d.getAssignment(e,o);if(g&&(t.includes(g.variantId)||g.content)){u({variantId:g.variantId,content:(S=g.content)!=null?S:null,isLoading:!1,settled:!0}),m(g.variantId);return}let a=Qe(e);if(a&&c.settled&&c.variantId&&c.variantId===(0,$e.pickFromWeights)(a.variants,t)){m(c.variantId);return}u(x=>{var A;return x.variantId?x:{variantId:(A=t[0])!=null?A:null,content:null,isLoading:!1,settled:!1}})},[h,d,e,o]),(0,H.useEffect)(()=>{if(h||!d)return;let g=d.getAssignment(e,o);if(g&&t.includes(g.variantId))return;let a=!1;return d.assign(e,t,n,r).then(S=>{var x;a||S&&(!t.includes(S.variantId)&&!S.content||(u({variantId:S.variantId,content:(x=S.content)!=null?x:null,isLoading:!1,settled:!0}),m(S.variantId)))}),()=>{a=!0}},[h,d,e,o]),(0,H.useEffect)(()=>{if(!h&&d)return Ct(e,g=>{var x;let a=d.getAssignment(e,o);if(a&&(t.includes(a.variantId)||a.content)){u({variantId:a.variantId,content:(x=a.content)!=null?x:null,isLoading:!1,settled:!0}),m(a.variantId);return}let S=(0,$e.pickFromWeights)(g.variants,t);S&&(u({variantId:S,content:null,isLoading:!1,settled:!0}),m(S))})},[h,d,e,o]),h?{variantId:h,content:null,isLoading:!1,settled:!0,isOverride:!0}:c}function je(e,t,n){let r=I(),i=ne(),l=Object.keys(t).join("\0"),d=(0,N.useMemo)(()=>Object.keys(t),[l]),{variantId:o,content:y,isOverride:s=!1,settled:p}=Be(e,d,n.agentData,n.agentDataByVariant),[f,h]=(0,N.useState)(null),k=(0,N.useRef)(null),c=(0,N.useCallback)(O=>{k.current=O,h(O)},[]),u=n.goal,m=typeof u=="string"?u:JSON.stringify(u),g=(0,N.useMemo)(()=>u?U(u):null,[m]),a=u?se(u):"";(0,N.useEffect)(()=>Ft({id:e,variantIds:d,goal:a}),[e,d,a]);let S=(0,N.useRef)(null);(0,N.useEffect)(()=>{s||p&&(!r||!o||!i||!f||S.current!==o&&(S.current=o,ae(r,i,e,o)))},[r,o,i,e,f,s,p]);let x=(0,N.useRef)(!1),A=(0,N.useRef)(new Set);(0,N.useEffect)(()=>{x.current=!1,A.current=new Set},[o,g]);let E=n.funnel;(0,N.useEffect)(()=>{s||!p||!r||!E||!g||pe(r,i,e,E,g)},[r,i,e,E,g,s,p]);let b=n.cursorSignal===!0;(0,N.useEffect)(()=>{if(!b||s||!p||!r||!o||!f)return;let O=null,P=0,F=()=>{P=Date.now(),O=setTimeout(()=>{r.track({projectId:i,componentId:e,variantId:o,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-P}}),O=null},800)},L=()=>{O!==null&&(clearTimeout(O),O=null)};return f.addEventListener("mouseenter",F),f.addEventListener("mouseleave",L),()=>{f.removeEventListener("mouseenter",F),f.removeEventListener("mouseleave",L),O!==null&&clearTimeout(O)}},[b,r,o,i,e,f,s,p]);let R=(0,N.useRef)(n.microSignalGoals);R.current=n.microSignalGoals;let w=n.microSignalGoals?JSON.stringify(n.microSignalGoals):"";return(0,N.useEffect)(()=>{if(s||!p||!r||!o||!f)return;let O=Date.now();return(0,ln.attachMicroSignalDetectors)((P,F={})=>{var oe,ue,Y;r.track({projectId:i,componentId:e,variantId:o,eventType:"micro_signal",payload:v({signalType:P},F)});let L=(oe=R.current)==null?void 0:oe[P];if(!L||A.current.has(P))return;A.current.add(P);let q=typeof L=="string"?L:L.name,Z=typeof L=="string"?1:(ue=L.weight)!=null?ue:1,ie=typeof L=="string"?0:(Y=L.stepIndex)!=null?Y:0;r.goal(q,{metadata:v({signalType:P},F),weight:Z,stepIndex:ie})},f,O)},[r,o,i,e,f,w,s,p]),(0,N.useEffect)(()=>{if(s||!p||!r||!o||!f||!g)return;let O=ee(g);return te(f,g,{fireGoal:()=>{x.current||(x.current=!0,r.track({projectId:i,componentId:e,variantId:o,eventType:"goal_achieved",goalType:a,payload:v({reward:1},O!==void 0?{goalValue:O}:{})}),r.goal(a,v({metadata:{componentId:e,variantId:o},weight:1,stepIndex:0},O!==void 0?{value:O}:{})))},fireStep:(P,F,L)=>{r.track({projectId:i,componentId:e,variantId:o,eventType:"goal_achieved",goalType:P,payload:{reward:F}}),r.goal(P,{metadata:{},weight:F,stepIndex:L})}},a)},[r,o,i,e,f,g,a,s,p]),{client:r,variantIds:d,variantId:o,content:y,settled:p,isOverride:s,goalLabel:a,ref:c,nodeRef:k}}var V=require("react"),Oe=require("@sentientui/core"),pt=require("@sentientui/core/region");var K=require("react"),cn=require("@sentientui/core");var un=new Set;function dn(e,t){var x,A,E;let n=I(),r=(0,K.useRef)(t==null?void 0:t.baselineText);r.current=t==null?void 0:t.baselineText;let i=(0,K.useRef)(t==null?void 0:t.render);i.current=t==null?void 0:t.render;let l=(0,K.useRef)(t==null?void 0:t.skeleton);l.current=t==null?void 0:t.skeleton;let d=Me(),o=nn(),y=rn(),s=on(),p=(0,K.useSyncExternalStore)(J,()=>{var b;return typeof window!="undefined"?(b=window.__sentient_slot_config_overrides)==null?void 0:b[e]:void 0},()=>{}),f=(0,K.useSyncExternalStore)(J,()=>{var b;return typeof window!="undefined"?(b=window.__sentient_slot_overrides)==null?void 0:b[e]:void 0},()=>{}),h=b=>b==null?"":(0,cn.armOfResult)(b),k=(0,K.useCallback)(b=>{var R,w;return(w=(R=n==null?void 0:n.onSlotsChanged)==null?void 0:R.call(n,b))!=null?w:(()=>{})},[n]);(0,K.useSyncExternalStore)(k,()=>{var b;return(b=n==null?void 0:n.getSlotConfig(e))!=null?b:null},()=>null),(0,K.useSyncExternalStore)(k,()=>h(n==null?void 0:n.getSlotResult(e)),()=>"");let c=p===void 0?o[e]:void 0,u=p===void 0&&c===void 0&&n?n.getSlotConfig(e):null,m=(x=y!=null?y:n==null?void 0:n.getSitePalette())!=null?x:null,g=(E=s!=null?s:(A=n==null?void 0:n.getStyleVocabulary)==null?void 0:A.call(n))!=null?E:null,a=(()=>{var b,R,w;if(p!==void 0)return{config:p,arm:h(f),palette:m,vocabulary:(b=Bt())!=null?b:g,source:"override"};if(c!==void 0)return{config:c,arm:h((R=d[e])!=null?R:n==null?void 0:n.getSlotResult(e)),palette:m,vocabulary:g,source:"preloaded"};if(u!==null){let O=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{config:u,arm:h((w=n==null?void 0:n.getSlotResult(e))!=null?w:d[e]),palette:m,vocabulary:g,source:O?"client":"seeded"}}return{config:null,arm:"",palette:m,vocabulary:g,source:"none"}})(),S=a.source==="preloaded"||a.source==="override";return(0,K.useEffect)(()=>{var q,Z,ie,oe,ue;if(!n||n.isLocal===!0||S)return;let b=a.source==="none",R=b&&(Z=(q=r.current)==null?void 0:q.call(r))!=null?Z:null,w=R!=null&&R!==""?{[e]:R}:void 0,O=(ie=i.current)==null?void 0:ie.call(i),P=b&&(ue=(oe=l.current)==null?void 0:oe.call(l))!=null?ue:null,F=v(v({},O?{render:{[e]:O}}:{}),P?{skeletons:{[e]:P}}:{}),L=Object.keys(F).length>0;return n.requestSlots?L?n.requestSlots([e],w,F):w?n.requestSlots([e],w):n.requestSlots([e]):b&&(P?n.reportSlots([e],w!=null?w:{},{[e]:P}):w?n.reportSlots([e],w):n.reportSlots([e])),()=>{var Y;return(Y=n.cancelSlots)==null?void 0:Y.call(n,[e])}},[n,S,a.source,e]),(0,K.useEffect)(()=>{!G()||(n==null?void 0:n.isLocal)!==!0||a.source!=="none"||un.has(e)||(un.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,a.source,e]),a}var ut=require("react");var T=require("react/jsx-runtime"),le={none:"0",sm:"8px",md:"16px",lg:"24px"},lt={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},pn={sm:"0.875em",md:"1em",lg:"1.25em"},pr={sm:"1.25em",md:"1.5em",lg:"2em"},fn={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},gn={sm:"8px",md:"16px",lg:"32px"},yr={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},vr={normal:"400",medium:"500",bold:"700"};function mn(e,t){return v(v({},e==="muted"?t!=null&&t.muted?{color:t.muted}:{opacity:.7}:{}),e==="accent"?v({fontWeight:600},t!=null&&t.accent?{color:t.accent}:{}):{})}function yn(e,t,n){var i,l,d,o;let r=t==null?void 0:t.accent;return M(v({display:"inline-block",padding:(i=fn[n!=null?n:"md"])!=null?i:fn.md,borderRadius:(l=t==null?void 0:t.radius)!=null?l:"8px",font:"inherit"},n?{fontSize:pn[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"?(o=t==null?void 0:t.primaryText)!=null?o:"#ffffff":r!=null?r:"inherit",border:e==="secondary"?`1px solid ${r!=null?r:"currentColor"}`:"none"})}function Sr({node:e,opts:t}){var i,l,d,o,y;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:(y=(o=t.palette)==null?void 0:o.radius)!=null?y:"8px"};return(0,T.jsxs)("form",{onSubmit:s=>{var h,k,c;s.preventDefault();let p=new FormData(s.currentTarget),f={};for(let u of e.fields)f[u.name]=String((h=p.get(u.name))!=null?h:"");(k=t.onFormGoal)==null||k.call(t,e.submitGoal);try{(c=t.onFormSubmit)==null||c.call(t,f)}catch(u){}},style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.fields.map(s=>{var p,f;return(0,T.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:"4px",font:"inherit"},children:[s.label,s.kind==="textarea"?(0,T.jsx)("textarea",{name:s.name,required:s.required,placeholder:s.placeholder,rows:3,style:r}):s.kind==="select"?(0,T.jsx)("select",{name:s.name,required:s.required,style:r,children:((p=s.options)!=null?p:[]).map(h=>(0,T.jsx)("option",{value:h,children:h},h))}):(0,T.jsx)("input",{name:s.name,type:(f=s.inputType)!=null?f:"text",required:s.required,placeholder:s.placeholder,style:r})]},s.name)}),(0,T.jsx)("button",{type:"submit",style:yn(n,t.palette),children:e.submitLabel})]})}function hr(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 fe(e,t){var n,r,i,l,d,o,y,s,p,f,h,k,c,u,m,g,a,S,x,A,E,b,R;try{let w=hr(e,t);switch(e.type){case"stack":{let O=(r=le[(n=e.gap)!=null?n:"md"])!=null?r:le.md,P=e.surface==="raised"&&!w,F=(i=e.pad)!=null?i:P?"md":void 0;return(0,T.jsx)("div",M(v({},w?{className:w}:{}),{style:v(v(v(v(v({display:"flex",flexDirection:e.direction,gap:O},e.align?{alignItems:lt[e.align]}:{}),e.justify?{justifyContent:lt[e.justify]}:{}),e.wrap?{flexWrap:"wrap"}:{}),F?{padding:(l=le[F])!=null?l:le.md}:{}),P?M(v(v({},(d=t.palette)!=null&&d.surface?{background:t.palette.surface}:{}),(o=t.palette)!=null&&o.surface&&((y=t.palette)!=null&&y.surfaceText)?{color:t.palette.surfaceText}:{}),{border:`1px solid ${(p=(s=t.palette)==null?void 0:s.border)!=null?p:"currentColor"}`,borderRadius:(h=(f=t.palette)==null?void 0:f.radius)!=null?h:"8px"}):{}),children:((k=e.children)!=null?k:[]).map((L,q)=>{let Z=fe(L,t);return Z===null?null:(0,T.jsx)(ut.Fragment,{children:Z},q)})}))}case"grid":{let O=(u=le[(c=e.gap)!=null?c:"md"])!=null?u:le.md;return(0,T.jsx)("div",M(v({},w?{className:w}:{}),{style:v(v({display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(max(200px, calc((100% - ${e.columns-1} * ${O}) / ${e.columns})), 1fr))`,gap:O},e.align?{alignItems:lt[e.align]}:{}),e.pad?{padding:(m=le[e.pad])!=null?m:le.md}:{}),children:((g=e.children)!=null?g:[]).map((P,F)=>{let L=fe(P,t);return L===null?null:(0,T.jsx)(ut.Fragment,{children:L},F)})}))}case"text":return w?(0,T.jsx)("p",{className:w,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):(0,T.jsx)("p",{style:v(v(v(v(v({margin:0},e.size?{fontSize:pn[e.size]}:{}),e.weight?{fontWeight:vr[e.weight]}:{}),e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),mn(e.tone,t.palette)),children:e.value});case"heading":{let O=`h${e.level}`;return w?(0,T.jsx)(O,{className:w,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):(0,T.jsx)(O,{style:v(v({margin:0,fontSize:pr[(a=e.size)!=null?a:"md"]},e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),children:e.value})}case"button":{let O=(S=e.emphasis)!=null?S:"primary";return(0,T.jsx)("a",M(v(v({href:e.href},e.tag?{"data-sentient-tag":e.tag}:{}),w?{className:w}:{style:yn(O,t.palette,e.size)}),{children:e.label}))}case"link":return(0,T.jsx)("a",M(v(v({href:e.href},e.tag?{"data-sentient-tag":e.tag}:{}),w?{className:w}:{style:{color:"inherit",textDecoration:"underline"}}),{children:e.label}));case"image":return(0,T.jsx)("img",M(v({src:e.src,alt:e.alt},w?{className:w}:{}),{style:v(v({display:"block",maxWidth:"100%"},e.ratio&&e.ratio!=="auto"?{aspectRatio:yr[e.ratio],width:"100%"}:{}),e.fit?{objectFit:e.fit}:{})}));case"badge":return w?(0,T.jsx)("span",{className:w,children:e.value}):(0,T.jsx)("span",{style:v({display:"inline-block",padding:"2px 10px",borderRadius:"999px",fontSize:"0.75em",border:`1px solid ${(A=(x=t.palette)==null?void 0:x.border)!=null?A:"currentColor"}`},mn(e.tone,t.palette)),children:e.value});case"spacer":return(0,T.jsx)("div",{style:{height:(E=gn[e.size])!=null?E:gn.md}});case"divider":return(0,T.jsx)("hr",{style:{border:"none",borderTop:`1px solid ${(R=(b=t.palette)==null?void 0:b.border)!=null?R:"currentColor"}`,margin:0,width:"100%"}});case"form":return(0,T.jsx)(Sr,{node:e,opts:t});default:return null}}catch(w){return null}}function Ke(e,t){var i,l,d;let n=fe(e.tree,t);if(n===null)return null;let r=(i=e.surface)!=null&&i.like?(d=(l=t.vocabulary)==null?void 0:l.entries.find(o=>o.id===e.surface.like))==null?void 0:d.classes:void 0;return r?(0,T.jsx)("div",{className:r,children:n}):n}var re=require("react"),We=require("@sentientui/core/region");function Je(e){return typeof e=="string"&&e.trim()!==""||typeof e=="number"}function Ue(e){let t=e.props;if(t.dangerouslySetInnerHTML==null)return t.children}function ge(e){return Je(e)?1:Array.isArray(e)?e.reduce((t,n)=>t+ge(n),0):(0,re.isValidElement)(e)?ge(Ue(e)):0}function br(e,t){return Array.isArray(t)?(0,re.cloneElement)(e,void 0,...t):(0,re.cloneElement)(e,void 0,t)}function ct(e,t){if(Je(e))return t;if(Array.isArray(e))return e.map(n=>ct(n,t));if((0,re.isValidElement)(e)){let n=Ue(e);return ge(n)===0?e:br(e,ct(n,t))}return e}function vn(e,t){return ge(e)===1?ct(e,t):null}var W=e=>e.join("/");function dt(e,t,n){if(Je(e)){n.leafPaths.push(t),n.texts.push((0,We.normalizeLeafText)(String(e)));return}if(Array.isArray(e)){e.forEach((r,i)=>dt(r,[...t,i],n));return}(0,re.isValidElement)(e)&&(n.elements.set(W(t),e),dt(Ue(e),[...t,"c"],n))}function gt(e){let t={leafPaths:[],texts:[],elements:new Map};return dt(e,[],t),t}function xr(e){return gt(e).texts}function Sn(e){let t=xr(e);return t.length===0?null:(0,We.skeletonFingerprint)(t)}function wr(e){let t=[];return e.forEach((n,r)=>{n==="c"&&t.push(e.slice(0,r))}),t}function hn(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((o,y)=>o===i?[wr(e.leafPaths[y])]:[]);if(l.length===0){r.push(null);continue}let d=l[0];for(let o of l.slice(1)){let y=new Set(o.map(W));d=d.filter(s=>y.has(W(s)))}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=hn(n,e.leafToNode),i=e.nodes.map((l,d)=>{let o=r[d],y=o?n.elements.get(W(o)):void 0,s=!!y&&(typeof y.type=="string"||ft(y)!==void 0);return M(v({},l),{restylable:s})});return M(v({},e),{nodes:i})}function bn(e,t,n){var c;let r=gt(e);if(r.leafPaths.length!==n.length)return null;let i=n.reduce((u,m)=>Math.max(u,m+1),0);for(let u of Object.keys(t.nodes))if(!/^\d+$/.test(u)||Number(u)>=i)return null;let l=hn(r,n),d=new Map;n.forEach((u,m)=>{d.has(u)||d.set(u,m)});let o=new Map(r.leafPaths.map((u,m)=>[W(u),m])),y=new Set,s=new Map,p=!1;for(let[u,m]of Object.entries(t.nodes)){let g=Number(u),a=l[g];if(m.hidden&&(a?y.add(W(a)):p=!0),m.like!==void 0){let S=l[m.like],x=a?r.elements.get(W(a)):void 0,A=S?ft(r.elements.get(W(S))):void 0;!a||A===void 0||ft(x)===void 0?p=!0:s.set(W(a),A)}}let f=new Map(Object.entries((c=t.order)!=null?c:{})),h=(u,m)=>{var g;if(Je(u)){let a=o.get(W(m));if(a===void 0)return u;let S=n[a],x=(g=t.nodes[String(S)])==null?void 0:g.text;return x===void 0?u:d.get(S)===a?x:""}if(Array.isArray(u)){let a=u.map((S,x)=>h(S,[...m,x]));for(let[S,x]of f){let A=x.map(R=>{let w=l[R];return!w||w.length!==m.length+1||W(w.slice(0,-1))!==W(m)?-1:w[w.length-1]});if(A.some(R=>R<0))continue;let E=[...A].sort((R,w)=>R-w),b=[...a];E.forEach((R,w)=>{a[R]=b[A[w]]}),f.delete(S)}return a}if((0,re.isValidElement)(u)){let a=W(m);if(y.has(a))return null;let S=Ue(u);if(ge(S)===0)return u;let x=h(S,[...m,"c"]),A=s.get(a),E=A!==void 0?{className:A}:void 0;return Array.isArray(x)?(0,re.cloneElement)(u,E,...x):(0,re.cloneElement)(u,E,x)}return u},k=h(e,[]);return p||f.size>0?null:k}var An=require("react/jsx-runtime"),xn=new Set,wn=new Set,Rn=new Set,kn="authored.";function Ee({id:e,children:t,variants:n,onFormSubmit:r,goal:i,className:l,reportBaselineText:d=!0}){var ht,bt;let o=I(),y=ne(),s=(0,V.useRef)(null),p=(0,V.useMemo)(()=>Sn(t),[t]),f=n?Object.keys(n).join("|"):"",h=(0,V.useMemo)(()=>v({fp:p!=null?p:"0000000000000000",forms:!!r,compose:!0,content:ge(t)===1},f!==""?{authored:f.split("|"),children:!0}:{}),[p,t,r,f]),k=()=>{var Q;let _=s.current;if(!_||!d)return null;let D=(0,pt.captureRegionSkeleton)(_);return D.skeleton?(Q=mt(D.skeleton,t))!=null?Q:{status:"unaddressable"}:{status:D.reason}},{config:c,arm:u,palette:m,vocabulary:g,source:a}=dn(e,{baselineText:d?()=>{var _,D;return(D=(_=s.current)==null?void 0:_.textContent)!=null?D:null}:void 0,render:()=>h,skeleton:k}),S=u!==""?(ht=c==null?void 0:c.blocks)==null?void 0:ht[u]:void 0,x=u!==""?(bt=c==null?void 0:c.compose)==null?void 0:bt[u]:void 0,A=(S!==void 0&&(0,Oe.containsFormBlock)(S)||x!==void 0&&(0,Oe.containsFormBlock)(x.tree))&&!r;(0,V.useEffect)(()=>{!A||!G()||xn.has(e)||(xn.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.`))},[A,e]);let E=_=>{!o||a==="override"||(a!=="seeded"&&o.componentGoal(e,_),o.goal(_,{metadata:{componentId:e,arm:u},weight:1,stepIndex:0}))},b=t,R=!1,w=u.startsWith(kn)?u.slice(kn.length):null;if((c==null?void 0:c.blocked)==="variant_history")R=!0;else if(w!==null)n&&Object.prototype.hasOwnProperty.call(n,w)?b=n[w]:R=!0;else if(x!==void 0){let _=A?null:Ke(x,{palette:m,vocabulary:g,onFormSubmit:r,onFormGoal:E});_===null?R=!0:b=_}else if(S!==void 0){let _=A?null:fe(S,{palette:m,vocabulary:g,onFormSubmit:r,onFormGoal:E});_===null?R=!0:b=_}else if((c==null?void 0:c.edits)!==void 0&&a!=="none"){let _=c.edits,D=_.fp===p?bn(t,_.edits,_.leafToNode):null;D===null?R=!0:b=D}else if((c==null?void 0:c.content)!==void 0&&a!=="none"){let _=vn(t,c.content);_===null?R=!0:b=_}let O=R&&S===void 0&&x===void 0&&(c==null?void 0:c.edits)===void 0&&w===null&&(c==null?void 0:c.blocked)===void 0;(0,V.useEffect)(()=>{(c==null?void 0:c.blocked)!=="variant_history"||!G()||Rn.has(e)||(Rn.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: Components \u2192 "${e}" \u2192 Migrate. Deploying code never switches an experiment.`))},[c==null?void 0:c.blocked,e]);let P=w!==null&&!R?w:null;(0,V.useEffect)(()=>{var Ae;if(!P||!d||!o)return;let _=s.current;if(!_)return;let D=(0,pt.captureRegionSkeleton)(_),Q=D.skeleton?mt(D.skeleton,n==null?void 0:n[P]):null,ke=(Ae=_.textContent)==null?void 0:Ae.trim();o.reportSlots([],void 0,void 0,{[e]:[v(v({key:P},ke?{text:ke}:{}),Q?{skeleton:Q}:{})]})},[P,o,e]);let F=R&&(c==null?void 0:c.edits)!==void 0&&(a==="preloaded"||a==="client");(0,V.useEffect)(()=>{var _;!F||!(c!=null&&c.edits)||(_=o==null?void 0:o.reportDrift)==null||_.call(o,e,c.edits.fp,p,c.edits.fp===p?"unaddressable":"fp_mismatch")},[F,e,p,o]);let L=b===t;(0,V.useEffect)(()=>{var D;if(!(c!=null&&c.needsSkeleton)||!L)return;let _=k();_&&((D=o==null?void 0:o.reportSkeleton)==null||D.call(o,e,_))},[c==null?void 0:c.needsSkeleton,L,e,o]),(0,V.useEffect)(()=>{if(!L)return;let _=Jt(e);if(!_)return;let D=k();Ut(_,D&&"status"in D?{status:D.status}:{skeleton:D})},[e,L]),(0,V.useEffect)(()=>{!O||!G()||wn.has(e)||(wn.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.`))},[O,e]);let q=c!=null&&c.blocks?Object.keys(c.blocks).sort().join("|"):"";(0,V.useEffect)(()=>ye({id:e,arms:q===""?void 0:q.split("|")}),[e,q]);let Z=(0,V.useRef)(null);(0,V.useEffect)(()=>{!o||a==="none"||a==="seeded"||a==="override"||u===""||R||Z.current!==u&&(Z.current=u,ae(o,y,e,u))},[o,y,e,u,a,R]);let ie=a!=="none"&&a!=="seeded"&&!R,oe=ie?u:"",ue=i===void 0?null:typeof i=="string"?i:JSON.stringify(i);(0,V.useEffect)(()=>{if(!o||!i||a==="override")return;let _=s.current;if(!_)return;let D=se(i),Q=ee(i),ke=!1;return te(_,U(i),{fireGoal:()=>{ke||(ke=!0,ie&&(Q!==void 0?o.componentGoal(e,D,{value:Q}):o.componentGoal(e,D)),o.goal(D,v({metadata:{componentId:e,arm:oe},weight:1,stepIndex:0},Q!==void 0?{value:Q}:{})))},fireStep:(Ae,xt,Yn)=>{ie&&o.componentGoal(e,Ae,{reward:xt}),o.goal(Ae,{metadata:{componentId:e,arm:oe},weight:xt,stepIndex:Yn})}},D)},[o,e,ue,u,a,R,ie,oe]);let Y=(0,V.useRef)(null);(0,V.useEffect)(()=>{let _=s.current;if(_){if(Y.current===null){Y.current=u;return}Y.current!==u&&(Y.current=u,(0,Oe.reveal)(_))}},[u]);let Zn=(0,V.useMemo)(()=>v({"data-sentient-slot":e},u!==""?{"data-sentient-arm":u}:{}),[e,u]);return(0,An.jsx)("div",M(v({ref:s,className:l},Zn),{children:b}))}var Pe=require("react/jsx-runtime");function Rr(e){var s;let{client:t,variantId:n,content:r,ref:i}=je(e.id,e.variants,{goal:e.goal,funnel:e.funnel,microSignalGoals:e.microSignalGoals,agentData:e.agentData,agentDataByVariant:e.agentDataByVariant,cursorSignal:!0}),[l,d]=(0,we.useState)(!1);if((0,we.useEffect)(()=>{d(!0)},[]),e.clientOnly&&(!l||!t)||!n)return null;let o=(s=e.variants[n])!=null?s:null,y=o===null?r:null;return G()&&o===null&&y===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.`),(0,Pe.jsx)("div",{ref:i,"data-sentient-id":e.id,"data-sentient-variant":n,children:o!=null?o:y})}var kr=(0,we.memo)(Rr,(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.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 _n(e){if(e.variants===void 0)return(0,Pe.jsx)(Ee,v({},e));let t=e;if(t.children!=null){G()&&Ar(t);let n=t,{funnel:r,microSignalGoals:i,agentData:l,agentDataByVariant:d,clientOnly:o,variants:y}=n,s=Le(n,["funnel","microSignalGoals","agentData","agentDataByVariant","clientOnly","variants"]);return(0,Pe.jsx)(Ee,M(v({},s),{children:t.children,variants:y}))}return(0,Pe.jsx)(kr,v({},t))}var Cn=new Set;function Ar(e){let t=["funnel","microSignalGoals","agentData","agentDataByVariant","clientOnly"].filter(n=>e[n]!==void 0);t.length===0||Cn.has(e.id)||(Cn.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(", ")}.`))}var $=require("react");var En=require("react/jsx-runtime");function On({id:e,default:t,component:n="span",className:r,goal:i}){var E;let l=I(),d=ne(),o=Fe(),y=Ve(),s=(0,$.useRef)(null),p=(0,$.useRef)(null),f=(0,$.useSyncExternalStore)(J,()=>xe(e),()=>null),[h,k]=(0,$.useState)(()=>{var b,R;return(R=(b=l==null?void 0:l.getAssignment(e,y))==null?void 0:b.content)!=null?R:null}),[c,u]=(0,$.useState)(()=>{var b,R;return(R=(b=l==null?void 0:l.getAssignment(e,y))==null?void 0:b.variantId)!=null?R:null});(0,$.useEffect)(()=>{if(f||!l)return;let b=l.getAssignment(e,y);if((b==null?void 0:b.content)!==void 0){u(b.variantId),k(b.content);return}let R=!1;return l.assign(e).then(w=>{if(!R){if(!w){G()&&console.warn(`[sentient] <AdaptiveText id="${e}"> assignment failed \u2014 showing default text.`);return}u(w.variantId),w.content&&k(w.content)}}),()=>{R=!0}},[l,e,y,f]),(0,$.useEffect)(()=>{f||!l||!c||!d||s.current!==c&&(s.current=c,l.track({projectId:d,componentId:e,variantId:c,eventType:"variant_assigned",payload:{}}),o==null||o(e,c))},[l,c,d,e,o,f]);let m=i===void 0?"":typeof i=="string"?i:JSON.stringify(i),g=(0,$.useMemo)(()=>i===void 0?null:U(i),[m]),a=i===void 0?null:typeof i=="string"?i:g.type,S=(0,$.useRef)(!1);(0,$.useEffect)(()=>{S.current=!1},[c,m]),(0,$.useEffect)(()=>{if(f||!l||!c||!d||!g||!a)return;let b=p.current;if(!b)return;let R=ee(g);return te(b,g,{fireGoal:()=>{S.current||(S.current=!0,l.track({projectId:d,componentId:e,variantId:c,eventType:"goal_achieved",goalType:a,payload:v({reward:1},R!==void 0?{goalValue:R}:{})}),l.goal(a,v({metadata:{componentId:e,variantId:c},weight:1,stepIndex:0},R!==void 0?{value:R}:{})))},fireStep:(w,O,P)=>{l.track({projectId:d,componentId:e,variantId:c,eventType:"goal_achieved",goalType:w,payload:{reward:O}}),l.goal(w,{metadata:{},weight:O,stepIndex:P})}})},[l,c,d,e,g,a,f]);let x=h!=null?h:t;if(f){let b=l==null?void 0:l.getAssignment(e,y);x=b&&b.variantId===f&&(E=b.content)!=null?E:t}return(0,En.jsx)(n,{ref:b=>{p.current=b},className:r,children:x})}var He=require("react");function ze(e){let t=I(),n=(0,He.useRef)(new Set);return(0,He.useCallback)((r,i)=>{var l,d;if(!xe(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,v(v(v({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])}var Ge=require("react");function Pn(e,t={}){let y=t,{componentId:n}=y,r=Le(y,["componentId"]),i=I(),l=ze(n!=null?n:""),d=(0,Ge.useRef)(!1),o=(0,Ge.useRef)(r);o.current=r,(0,Ge.useEffect)(()=>{if(!i||d.current)return;d.current=!0;let{metadata:s,reward:p,value:f,currency:h,externalId:k}=o.current;if(n){l(e,o.current);return}i.goal(e,v(v(v({metadata:s!=null?s:{},weight:p!=null?p:1,stepIndex:0},f!==void 0?{value:f}:{}),h!==void 0?{currency:h}:{}),k!==void 0?{externalId:k}:{}))},[i,n,e,l])}var Tn=require("@sentientui/core"),Ln=require("@sentientui/policy"),In=require("react/jsx-runtime");function Gn(e){return JSON.stringify(e).replace(/</g,"\\u003c")}function Cr(e){return e.persona?'(function(){try{var d=document.documentElement;if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",'+Gn(e.persona.persona)+');d.setAttribute("data-sentient-confidence",'+Gn((0,Ln.confidenceBand)(e.persona.confidence))+");}catch(e){}})();":(0,Tn.renderPrePaintScript)(e.apiKey)}function Dn(e){return(0,In.jsx)("script",{"data-sentient-persona-script":"",nonce:e.nonce,dangerouslySetInnerHTML:{__html:Cr(e)}})}var X=require("react"),Mn=require("@sentientui/policy");var z=require("react"),me=require("@sentientui/core"),Nn=require("@sentientui/policy");function Xe(e,t){let n=I(),r=Me(),[,i]=(0,z.useReducer)(f=>f+1,0),l=(0,z.useSyncExternalStore)(J,()=>{var f;return typeof window!="undefined"?(f=window.__sentient_slot_overrides)==null?void 0:f[e]:void 0},()=>{}),d=l===void 0?r[e]:void 0,o=l===void 0&&d===void 0&&n?n.getSlotResult(e):null,y=(n==null?void 0:n.isLocal)===!0&&l===void 0&&d===void 0&&o===null;(0,z.useEffect)(()=>{if(!y||!n)return;let f=!1;return n.decide({slots:[t]}).then(h=>{!f&&h&&i()}),()=>{f=!0}},[n,e,y]);let s=(()=>{if(l!==void 0)return{result:l,arm:(0,me.armOfResult)(l),source:"override"};if(d!==void 0)return{result:d,arm:(0,me.armOfResult)(d),source:"preloaded"};if(o!==null){let h=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{result:o,arm:(0,me.armOfResult)(o),source:h?"client":"seeded"}}let f=(0,me.baselineResultFor)(t);return{result:f,arm:(0,me.armOfResult)(f),source:"baseline"}})(),p=s.source==="preloaded"||s.source==="override";return(0,z.useEffect)(()=>{var h;if(!n||n.isLocal===!0||p||!n.decideSlots)return;let f=(h=n.onSlotsChanged)==null?void 0:h.call(n,i);return n.decideSlots([t]),()=>{var k;(k=n.cancelSlots)==null||k.call(n,[e]),f==null||f()}},[n,e,p]),s}function _r(){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 Vn(){let e=I(),t=tn();(0,z.useSyncExternalStore)(J,Gt,()=>0);let[n,r]=(0,z.useState)(!1);(0,z.useEffect)(()=>r(!0),[]);let i=o=>({persona:o.persona,confidence:o.confidence,band:(0,Nn.confidenceBand)(o.confidence)});if(!n)return t?i(t):null;let l=_r();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 Or(e){return typeof CSS!="undefined"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/[\\"]/g,"\\$&")}function $n(e,t,n){let r=I(),i=ne(),l=JSON.stringify(t),d=(0,X.useMemo)(()=>({id:e,dims:t}),[e,l]),{result:o,arm:y,source:s}=Xe(e,d),p=(0,X.useMemo)(()=>typeof o=="string"?{}:o,[y]);if(G()&&!Fn.has(e)){Fn.add(e);let u=(0,Mn.validateSlotDecl)({id:e,dims:Object.fromEntries(Object.entries(t).map(([g,a])=>[g,[...a]]))}),m=Object.values(t).reduce((g,a)=>g*a.length,1);u.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 ${u.reason}. Serving baseline.`)}let f=(n==null?void 0:n.goal)===void 0?null:typeof n.goal=="string"?n.goal:JSON.stringify(n.goal);(0,X.useEffect)(()=>ye({id:e,dims:t}),[e]);let h=(0,X.useRef)(null);(0,X.useEffect)(()=>{!r||s==="baseline"||s==="seeded"||s==="override"||h.current===y||(h.current=y,ae(r,i,e,y))},[r,i,e,y,s]);let k=n==null?void 0:n.funnel;(0,X.useEffect)(()=>{var u;!r||!k||s==="override"||pe(r,i,e,k,U((u=n==null?void 0:n.goal)!=null?u:"click"))},[r,i,e,k,f,s]),(0,X.useEffect)(()=>{if(!r||!(n!=null&&n.goal)||s==="override"||s==="baseline"||s==="seeded")return;let u=document.querySelector(`[data-sentient-slot="${Or(e)}"]`);if(!u){G()&&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=se(n.goal),g=ee(n.goal),a=!1;return te(u,U(n.goal),{fireGoal:()=>{a||(a=!0,g!==void 0?r.componentGoal(e,m,{value:g}):r.componentGoal(e,m),r.goal(m,v({metadata:{componentId:e,arm:y},weight:1,stepIndex:0},g!==void 0?{value:g}:{})))},fireStep:(S,x,A)=>{r.componentGoal(e,S,{reward:x}),r.goal(S,{metadata:{componentId:e,arm:y},weight:x,stepIndex:A})}},m)},[r,e,f,y,s]);let c=(0,X.useMemo)(()=>{let u={"data-sentient-slot":e};for(let[m,g]of Object.entries(p))u[`data-${m}`]=g;return u},[e,p]);return{tokens:p,props:c}}var Re=require("react");var Bn=new Set;function jn(e,t){var k;if(G()&&!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:o,nodeRef:y}=je(e,t.variants,{goal:t.goal,funnel:t.funnel,microSignalGoals:t.microSignalGoals}),s=(k=i!=null?i:r[0])!=null?k:"",p=t.variants[s];(0,Re.useEffect)(()=>{if(!G()||!n)return;let c=setTimeout(()=>{!y.current&&!Bn.has(e)&&(Bn.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(c)},[n,e]);let f=(0,Re.useCallback)((c,u)=>{var g,a;if(l)return;let m=c!=null?c:d;m&&(n==null||n.componentGoal(e,m,u),n==null||n.goal(m,v(v(v({metadata:(g=u==null?void 0:u.metadata)!=null?g:{},weight:(a=u==null?void 0:u.reward)!=null?a:1,stepIndex:0},(u==null?void 0:u.value)!==void 0?{value:u.value}:{}),(u==null?void 0:u.currency)!==void 0?{currency:u.currency}:{}),(u==null?void 0:u.externalId)!==void 0?{externalId:u.externalId}:{})))},[n,e,d,l]),h=(0,Re.useMemo)(()=>({ref:o,"data-sentient-id":e,"data-sentient-variant":s}),[o,e,s]);return{variant:s,value:p,bind:h,fireGoal:f}}var j=require("react");var Wn=require("react/jsx-runtime"),qe=new Set;function Kn(e){var g;let t=I(),n=ne(),r=(0,j.useRef)(null),i=Object.keys(e.arrangements).join(" "),l=(0,j.useMemo)(()=>Object.keys(e.arrangements),[i]),d=(0,j.useMemo)(()=>v({id:e.id,arms:l},e.baseline!==void 0?{baseline:e.baseline}:{}),[e.id,l,e.baseline]),{arm:o,source:y}=Xe(e.id,d);G()&&e.baseline!==void 0&&e.baseline!==l[0]&&!qe.has(e.id+":baseline")&&(qe.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 s=j.Children.toArray(e.children).filter(j.isValidElement),p=new Map;for(let a of s)p.set(String((g=a.key)!=null?g:"").replace(/^\.\$/,""),a);let f=e.arrangements[o],h=f!==void 0&&f.length===s.length&&f.every(a=>p.has(a));G()&&f!==void 0&&!h&&!qe.has(e.id+":keys")&&(qe.add(e.id+":keys"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: arrangement "${o}" [${f.join(", ")}] does not match the children's keys \u2014 rendering declaration order (fail-safe).`));let k=h?f.map(a=>p.get(a)):s;(0,j.useEffect)(()=>ye({id:e.id,arms:Object.keys(e.arrangements)}),[e.id]);let c=(0,j.useRef)(null);(0,j.useEffect)(()=>{!t||y==="baseline"||y==="seeded"||y==="override"||c.current===o||(c.current=o,ae(t,n,e.id,o))},[t,n,e.id,o,y]);let u=e.funnel;(0,j.useEffect)(()=>{var a;!t||!u||y==="override"||pe(t,n,e.id,u,U((a=e.goal)!=null?a:"click"))},[t,n,e.id,u,y]);let m=e.goal===void 0?null:typeof e.goal=="string"?e.goal:JSON.stringify(e.goal);return(0,j.useEffect)(()=>{if(!t||e.goal===void 0||y==="override"||y==="baseline"||y==="seeded")return;let a=r.current;if(!a)return;let S=se(e.goal),x=ee(e.goal),A=!1;return te(a,U(e.goal),{fireGoal:()=>{A||(A=!0,x!==void 0?t.componentGoal(e.id,S,{value:x}):t.componentGoal(e.id,S),t.goal(S,v({metadata:{componentId:e.id,arm:o},weight:1,stepIndex:0},x!==void 0?{value:x}:{})))},fireStep:(E,b,R)=>{t.componentGoal(e.id,E,{reward:b}),t.goal(E,{metadata:{componentId:e.id,arm:o},weight:b,stepIndex:R})}},S)},[t,e.id,m,o,y]),(0,Wn.jsx)("div",{ref:r,"data-sentient-id":e.id,"data-sentient-variant":o,children:k})}var yt=require("@sentientui/core");var Er=["page","blocks","layoutOrder"],Jn=new Map;function Un(e,t){Jn.set(e,t)}function vt(e){return Jn.get(e)}function Hn(e){var i,l;let t=(l=(i=e.content)!=null?i:vt(e.page))!=null?l:{},n={};for(let[d,o]of Object.entries(t))Er.includes(d)||(n[d]=o);let r=M(v({},n),{page:e.page,blocks:e.blocks});return e.layoutOrder&&(r.layoutOrder=e.layoutOrder),r}function zn(e){return`<script type="application/ld+json">${St(e)}</script>`}function St(e){return JSON.stringify(v({"@context":"https://schema.org","@type":"WebPage"},e)).replace(/</g,"\\u003c")}function Xn(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
+ "use strict";var Qn=Object.create;var Ce=Object.defineProperty,er=Object.defineProperties,tr=Object.getOwnPropertyDescriptor,nr=Object.getOwnPropertyDescriptors,rr=Object.getOwnPropertyNames,Te=Object.getOwnPropertySymbols,ir=Object.getPrototypeOf,Ze=Object.prototype.hasOwnProperty,kt=Object.prototype.propertyIsEnumerable;var wt=(e,t,n)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,v=(e,t)=>{for(var n in t||(t={}))Ze.call(t,n)&&wt(e,n,t[n]);if(Te)for(var n of Te(t))kt.call(t,n)&&wt(e,n,t[n]);return e},N=(e,t)=>er(e,nr(t));var Le=(e,t)=>{var n={};for(var r in e)Ze.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(e!=null&&Te)for(var r of Te(e))t.indexOf(r)<0&&kt.call(e,r)&&(n[r]=e[r]);return n};var or=(e,t)=>{for(var n in t)Ce(e,n,{get:t[n],enumerable:!0})},Rt=(e,t,n,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let i of rr(t))!Ze.call(e,i)&&i!==n&&Ce(e,i,{get:()=>t[i],enumerable:!(r=tr(t,i))||r.enumerable});return e};var Ye=(e,t,n)=>(n=e!=null?Qn(ir(e)):{},Rt(t||!e||!e.__esModule?Ce(n,"default",{value:e,enumerable:!0}):n,e)),sr=e=>Rt(Ce({},"__esModule",{value:!0}),e);var Pr={};or(Pr,{Adaptive:()=>_n,AdaptiveGroup:()=>Kn,AdaptiveProvider:()=>Zt,AdaptiveSlot:()=>Ee,AdaptiveText:()=>On,SentientPersonaScript:()=>Dn,buildAgentFeed:()=>Hn,defineAgentContent:()=>Un,detectSegment:()=>yt.deriveSessionSegment,getAgentContent:()=>vt,grantConsent:()=>qn.grantConsent,renderAgentJsonLd:()=>zn,renderAgentJsonLdBody:()=>St,renderAgentMarkdown:()=>Xn,renderBlocks:()=>ge,renderCompose:()=>Ke,useAdaptive:()=>jn,useAdaptiveApiBaseUrl:()=>sn,useAdaptiveGoal:()=>ze,useAdaptivePersona:()=>Vn,useAdaptiveTokens:()=>$n,useAssignment:()=>Be,useInitialAssignments:()=>Ne,useLayoutOrder:()=>en,usePageGoal:()=>Pn,useSentient:()=>I});module.exports=sr(Pr);var C=require("react"),Ie=require("@sentientui/core");var At=new Map,De=new Map;function Ct(e,t){let n=De.get(e);return n||(n=new Set,De.set(e,n)),n.add(t),()=>{n.delete(t),n.size===0&&De.delete(e)}}function _t(e,t){At.set(e,t);let n=De.get(e);if(n)for(let r of n)try{r(t)}catch(i){}}function Qe(e){var t;return(t=At.get(e))!=null?t:null}var ar={on:!1,listeners:new Set};function Ot(){if(typeof window=="undefined")return ar;let e=window;return e.__sentient_preview||(e.__sentient_preview={on:!1,listeners:new Set}),e.__sentient_preview}function et(){return Ot().on}function Et(e){let t=Ot().listeners;return t.add(e),()=>{t.delete(e)}}function Pt(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 tt="sentient:overrides-changed";function Gt(){var e;return typeof window=="undefined"?0:(e=window.__sentient_overrides_version)!=null?e:0}function nt(){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(tt))}function J(e){return typeof window=="undefined"?()=>{}:(window.addEventListener(tt,e),()=>window.removeEventListener(tt,e))}function Tt(e){typeof window!="undefined"&&(window.__sentient_devtools_config=e)}function T(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}function U(e){return typeof e=="string"?{type:"click"}:e}function se(e){return typeof e=="string"?e:e.type}function ee(e){if(typeof e!="string"&&(e.type==="click"||e.type==="form_submit"||e.type==="scroll_depth"))return e.value}var rt=new Set,it=!1;function Lt(e){if(rt.has(e))return!0;if(rt.add(e),!it){it=!0;let t=()=>{it=!1,rt.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 lr(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(lr(r))return!0;r=r.parentElement}return!1}function te(e,t,n,r){if(t.type==="weighted_composite"){let s=new Set,p=[];return t.steps.forEach(({goal:f,name:h,weight:R},c)=>{let u=(m=!1)=>{s.has(c)||m&&r!==void 0&&Lt(`step\0${h}\0${R}\0${c}`)||(s.add(c),n.fireStep(h,R,c))};if(f.type==="click"){let m=g=>{let a=g.target;a instanceof Element&&Dt(a,e,f.selector)&&u()};e.addEventListener("click",m),p.push(()=>e.removeEventListener("click",m));return}if(f.type==="form_submit"){let m=g=>{g.target instanceof HTMLFormElement&&e.contains(g.target)&&u()};e.addEventListener("submit",m),p.push(()=>e.removeEventListener("submit",m));return}if(f.type==="scroll_depth"){let m=Math.max(0,Math.min(1,f.threshold)),g=new IntersectionObserver(a=>{for(let S of a)if(S.intersectionRatio>=m){u(!0),g.disconnect();break}},{threshold:[m]});g.observe(e),p.push(()=>g.disconnect())}}),()=>{for(let f of p)f()}}let i=t.type==="composite"?t.all:[t],l=new Set(i.map((s,p)=>p)),d=()=>{r!==void 0&&Lt(r)||n.fireGoal()},o=(s,p=!1)=>{l.delete(s),l.size===0&&(p?d():n.fireGoal())},y=[];return i.forEach((s,p)=>{if(s.type==="click"){let f=h=>{let R=h.target;R instanceof Element&&Dt(R,e,s.selector)&&(t.type==="composite"?o(p):n.fireGoal())};e.addEventListener("click",f),y.push(()=>e.removeEventListener("click",f));return}if(s.type==="form_submit"){let f=h=>{h.target instanceof HTMLFormElement&&e.contains(h.target)&&(t.type==="composite"?o(p):n.fireGoal())};e.addEventListener("submit",f),y.push(()=>e.removeEventListener("submit",f));return}if(s.type==="scroll_depth"){let f=Math.max(0,Math.min(1,s.threshold)),h=new IntersectionObserver(R=>{for(let c of R)if(c.intersectionRatio>=f){t.type==="composite"?o(p,!0):d(),h.disconnect();break}},{threshold:[f]});h.observe(e),y.push(()=>h.disconnect());return}}),()=>{for(let s of y)s()}}var It=new Set,Nt=new Set;function ye(e,t,n,r,i){let l=`${r}|${n}`;if(Nt.has(l))return;Nt.add(l);let d=i.type==="weighted_composite"&&!It.has(r);d&&It.add(r),e.track({projectId:t,componentId:n,eventType:"funnel_declared",payload:d?{funnelId:r,steps:i.steps.map(o=>({goalId:o.name,weight:o.weight}))}:{funnelId:r}})}function ae(e,t,n,r){e.track({projectId:t,componentId:n,variantId:r,eventType:"variant_assigned",payload:{}})}var ur={components:new Map,slots:new Map,sections:[],listeners:new Set,version:0};function de(){if(typeof window=="undefined")return ur;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 _e(){de().version+=1;for(let e of de().listeners)e()}var Vt=()=>{};function Ft(e){return T()?(de().components.set(e.id,e),_e(),()=>{de().components.delete(e.id),_e()}):Vt}function ve(e){return T()?(de().slots.set(e.id,e),_e(),()=>{de().slots.delete(e.id),_e()}):Vt}function ot(e){T()&&(de().sections=[...e],_e())}var Mt="0.35.1",st=Mt!=="0.0.0-dev"?{name:"react",version:Mt}:void 0;function cr(){let e=window;return e.__sentient_slot_config_overrides||(e.__sentient_slot_config_overrides={}),e.__sentient_slot_config_overrides}function Se(e,t){cr()[e]=t}function $t(e){window.__sentient_vocabulary_override=e}function Bt(){var e;return typeof window=="undefined"?null:(e=window.__sentient_vocabulary_override)!=null?e:null}function dr(){let e=window;return e.__sentient_slot_overrides||(e.__sentient_slot_overrides={}),e.__sentient_slot_overrides}function he(e,t){dr()[e]=t}var jt="sentient_editor",Kt="sentient_preview_cell",Wt="sentient_refresh_region",at="sentient-cell-preview-bar",fe="__preview__",be=null;function Jt(e){if((be==null?void 0:be.slotId)!==e)return null;let t=be;return be=null,t}function Ut(e,t){fetch(`${e.base}/editor/region-skeleton`,{method:"POST",headers:{authorization:`Bearer ${e.token}`,"content-type":"application/json"},body:JSON.stringify(v({slotId:e.slotId},t))}).then(n=>xe(n.ok?"Region refreshed \u2014 you can regenerate its versions now.":"Couldn\u2019t refresh this region \u2014 reopen the link from your dashboard.")).catch(()=>xe("Couldn\u2019t refresh this region \u2014 check your connection and reopen the link from your dashboard."))}function Ht(e){if(typeof window=="undefined"||typeof document=="undefined"||document.getElementById(at))return;let t,n,r;try{let y=new URLSearchParams(window.location.search);t=y.get(jt),n=y.get(Kt),r=y.get(Wt)}catch(y){return}if(t&&r){be={slotId:r,token:t,base:(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,"")},Se(r,{kind:"arms"}),he(r,fe),nt();return}if(!t||!n)return;let i=n.lastIndexOf("~");if(i<=0)return;let l=n.slice(0,i),d=n.slice(i+1),o=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,"");fetch(`${o}/editor/cell-preview?slotId=${encodeURIComponent(l)}&persona=${encodeURIComponent(d)}`,{headers:{authorization:`Bearer ${t}`}}).then(async y=>{if(!y.ok){xe(y.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 s=await y.json();if(s.vocabulary&&Array.isArray(s.vocabulary.entries)&&$t(s.vocabulary),s.compose!=null)Se(l,{kind:"arms",compose:{[fe]:s.compose}}),he(l,fe);else if(s.edits!=null&&typeof s.skeletonFp=="string"&&Array.isArray(s.leafToNode))Se(l,{kind:"arms",edits:{edits:s.edits,fp:s.skeletonFp,leafToNode:s.leafToNode}}),he(l,fe);else if(s.blocks!=null)Se(l,{kind:"arms",blocks:{[fe]:s.blocks}}),he(l,fe);else if(s.content!=null)Se(l,{kind:"arms",content:s.content}),he(l,fe);else{xe("Nothing to preview in that square yet.");return}nt(),xe(`Previewing \u201C${s.slotName}\u201D for ${s.personaDisplay}${s.status==="review"?" \u2014 waiting for your approval":""}. Nothing is being tracked.`),setTimeout(()=>{var p;try{(p=document.querySelector(`[data-sentient-slot="${l}"]`))==null||p.scrollIntoView({block:"center"})}catch(f){}},300)}).catch(()=>xe("Couldn\u2019t load this preview \u2014 check your connection and reopen it from your dashboard."))}function xe(e){var i;if(document.getElementById(at))return;let t=document.createElement("div");t.id=at,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=()=>{let l=new URL(window.location.href);l.searchParams.delete(jt),l.searchParams.delete(Kt),l.searchParams.delete(Wt),window.location.assign(l.toString())},t.append(n,r),((i=document.body)!=null?i:document.documentElement).append(t)}var fr="sentient_editor",zt=!1;function Xt(e){if(zt||typeof window=="undefined")return;let t=null;try{t=new URLSearchParams(window.location.search).get(fr)}catch(i){return}if(!t)return;zt=!0;let n=(e!=null?e:"https://api.sentient-ui.com/v1").replace(/\/$/,""),r=()=>{window.setTimeout(()=>{import("@sentientui/core/style-sample").then(({sampleStyleVocabulary:i})=>fetch(`${n}/editor/style-vocabulary`,{method:"POST",headers:{authorization:`Bearer ${t}`,"content-type":"application/json"},body:JSON.stringify(i(document))})).catch(()=>{})},1e3)};document.readyState==="complete"?r():window.addEventListener("load",r,{once:!0})}var an=require("react/jsx-runtime");function gr(){var e,t;if(typeof window=="undefined")return"desktop:direct";try{return(0,Ie.deriveSessionSegment)({userAgent:(e=navigator.userAgent)!=null?e:"",referer:(t=document.referrer)!=null?t:"",appOrigin:window.location.origin})}catch(n){return"desktop:direct"}}var qt="https://api.sentient-ui.com/v1",B=(0,C.createContext)({client:null,apiKey:"",initialAssignments:{},sessionSegment:"desktop:direct",ssrFallback:"first",onAssignment:void 0,initialLayoutOrder:null,initialSlots:{},initialSlotConfig:{},initialPalette:null,initialVocabulary:null,initialPersona:null,apiBaseUrl:qt,debug:!1});function mr(e){let[t,n]=(0,C.useState)(!1),r=(0,C.useRef)(e);r.current=e;let{cookie:i,value:l,event:d}=e!=null?e:{},o=typeof(e==null?void 0:e.check)=="function";return(0,C.useEffect)(()=>{let y=()=>{var h;let p=r.current;if(!p)return!1;if(p.check)return p.check()===!0;if(!p.cookie||typeof document=="undefined")return!1;let f=`${p.cookie}=${(h=p.value)!=null?h:"accepted"}`;return document.cookie.split("; ").some(R=>R.trim()===f)};if(n(y()),!d)return;let s=()=>{n(y())};return window.addEventListener(d,s),()=>window.removeEventListener(d,s)},[i,l,d,o]),t}function Zt(e){var c,u;let[t,n]=(0,C.useState)(null),[r]=(0,C.useState)(()=>{var m;return(m=e.sessionSegment)!=null?m:gr()}),[i,l]=(0,C.useState)(et());(0,C.useEffect)(()=>Et(()=>l(et())),[]),(0,C.useEffect)(()=>{Ht(e.apiBaseUrl),Xt(e.apiBaseUrl)},[]);let d=mr(e.consentFrom),o=e.consentFrom?e.consent===!0||d:e.consent,y=(0,C.useRef)(null);(0,C.useEffect)(()=>{var A;if(o===!1&&!e.preConsentBehavior){(A=y.current)==null||A.destroy(),y.current=null,n(null);return}let m=v({apiKey:e.apiKey,context:e.context,debug:e.debug,initialAssignments:e.initialAssignments,sessionSegment:r,consent:o,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},st?{sdk:st}:{}),g=!1,a=null,S=null,x=E=>{e.engagement!==!1&&import("@sentientui/core/engagement").then(({startEngagementCapture:b})=>{g||(S=b(E,{apiKey:e.apiKey,sectionTypes:e.sectionTypes,apiBase:e.apiBaseUrl?e.apiBaseUrl.replace(/\/$/,""):void 0}))})};return e.enableGraph!==!1?import("@sentientui/core/graph").then(({init:E})=>{g||(a=E(N(v({},m),{graph:!0,captureDomText:e.captureDomText===!0,sectionTypes:e.sectionTypes})),y.current=a,n(a),x(a))}):(a=(0,Ie.init)(m),y.current=a,n(a),x(a)),()=>{g=!0,S==null||S(),a==null||a.dispose()}},[o]),(0,C.useEffect)(()=>{if(!t)return;let m=!1,g=async()=>{if(m)return;let S;try{S=await t.fetchWeights()}catch(x){return}if(!m)for(let x of S){let A={componentId:x.componentId,updatedAt:x.updatedAt,variants:x.variants.map(E=>{var b;return{variantId:E.variantId,pulls:E.pulls,avgReward:(b=E.avgReward)!=null?b:0}})};_t(x.componentId,A)}};g();let a=setInterval(()=>{g()},6e4);return()=>{m=!0,clearInterval(a)}},[t]);let s=(c=e.ssrFallback)!=null?c:"first",p=((u=e.apiBaseUrl)!=null?u:qt).replace(/\/$/,""),f=(0,C.useRef)(null);(0,C.useEffect)(()=>{var a;if(typeof process!="undefined"&&((a=process.env)==null?void 0:a.NODE_ENV)==="production")return;let m={apiKey:e.apiKey,context:e.context,country:e.country,persona:e.persona,apiBaseUrl:p},g=f.current;if(f.current=m,g!==null)for(let S of["apiKey","context","country","persona","apiBaseUrl"])Object.is(g[S],m[S])||console.warn(`[sentient] AdaptiveProvider: \`${S}\` 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,p]),(0,C.useEffect)(()=>{var m;typeof process!="undefined"&&((m=process.env)==null?void 0:m.NODE_ENV)==="production"||Tt({apiKey:e.apiKey,apiBaseUrl:p,isLocal:(t==null?void 0:t.isLocal)===!0})},[t,e.apiKey,p]),(0,C.useEffect)(()=>{let m=e.initialLayoutOrder;if(m&&m.length>0){ot(m);return}e.declaredSections&&e.declaredSections.length>0&&ot(e.declaredSections)},[e.initialLayoutOrder,e.declaredSections]),(0,C.useEffect)(()=>{if(!T())return;let m=e.declaredSections;if(!m||m.length===0||typeof document=="undefined")return;let g=new Set(Array.from(document.querySelectorAll("[data-sentient-id]"),S=>S.getAttribute("data-sentient-id"))),a=m.filter(S=>!g.has(S));a.length>0&&console.warn(`[SentientUI] Declared section${a.length>1?"s":""} ${a.map(S=>`"${S}"`).join(", ")} ${a.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 h=(0,C.useMemo)(()=>t&&i?Pt(t):t,[t,i]),R=(0,C.useMemo)(()=>{var m,g,a,S,x,A,E,b;return{client:h,apiKey:e.apiKey,initialAssignments:(m=e.initialAssignments)!=null?m:{},sessionSegment:r,ssrFallback:s,onAssignment:e.onAssignment,initialLayoutOrder:(g=e.initialLayoutOrder)!=null?g:null,initialSlots:(a=e.initialSlots)!=null?a:{},initialSlotConfig:(S=e.initialSlotConfig)!=null?S:{},initialPalette:(x=e.initialPalette)!=null?x:null,initialVocabulary:(A=e.initialVocabulary)!=null?A:null,initialPersona:(E=e.initialPersona)!=null?E:null,apiBaseUrl:p,debug:(b=e.debug)!=null?b:!1}},[h,e.apiKey,e.initialAssignments,r,s,e.onAssignment,e.initialLayoutOrder,e.initialSlots,e.initialSlotConfig,e.initialPalette,e.initialVocabulary,e.initialPersona,p,e.debug]);return(0,an.jsx)(B.Provider,{value:R,children:e.children})}function I(){return(0,C.useContext)(B).client}function ne(){return(0,C.useContext)(B).apiKey}function Ne(){return(0,C.useContext)(B).initialAssignments}function Ve(){return(0,C.useContext)(B).sessionSegment}function Yt(){return(0,C.useContext)(B).ssrFallback}function Fe(){return(0,C.useContext)(B).onAssignment}function Qt(){return(0,C.useContext)(B).debug}function en(){let e=(0,C.useContext)(B).initialLayoutOrder,t=(0,C.useSyncExternalStore)(J,()=>{var n;return typeof window=="undefined"?null:(n=window.__sentient_layout_override)!=null?n:null},()=>null);return t!=null?t:e}function Me(){return(0,C.useContext)(B).initialSlots}function tn(){return(0,C.useContext)(B).initialPersona}function nn(){return(0,C.useContext)(B).initialSlotConfig}function rn(){return(0,C.useContext)(B).initialPalette}function on(){return(0,C.useContext)(B).initialVocabulary}function sn(){return(0,C.useContext)(B).apiBaseUrl}var ke=require("react");var V=require("react"),ln=require("@sentientui/core");var H=require("react"),$e=require("@sentientui/policy");function we(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 Be(e,t,n,r){let i=Ne(),l=Yt(),d=I(),o=Ve(),y=Fe(),s=Qt(),p=(0,H.useRef)(null),f=(0,H.useSyncExternalStore)(J,()=>we(e),()=>null),h=f&&t.includes(f)?f:null,R=(0,H.useRef)(null);(0,H.useEffect)(()=>{s&&h&&R.current!==h&&(R.current=h,console.info(`[sentient] override active: ${e} -> ${h}`))},[s,h,e]);let[c,u]=(0,H.useState)(()=>{var S,x;if(h)return{variantId:h,content:null,isLoading:!1,settled:!0};if(!d){let A=i[e];return A&&t.includes(A)?{variantId:A,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 g=d.getAssignment(e,o);if(g&&(t.includes(g.variantId)||g.content))return{variantId:g.variantId,content:(S=g.content)!=null?S:null,isLoading:!1,settled:!0};let a=Qe(e);if(a){let A=(0,$e.pickFromWeights)(a.variants,t);if(A)return{variantId:A,content:null,isLoading:!1,settled:!0}}return{variantId:(x=t[0])!=null?x:null,content:null,isLoading:!1,settled:!1}}),m=g=>{y&&p.current!==g&&(p.current=g,y(e,g))};return(0,H.useEffect)(()=>{var S;if(h||!d)return;let g=d.getAssignment(e,o);if(g&&(t.includes(g.variantId)||g.content)){u({variantId:g.variantId,content:(S=g.content)!=null?S:null,isLoading:!1,settled:!0}),m(g.variantId);return}let a=Qe(e);if(a&&c.settled&&c.variantId&&c.variantId===(0,$e.pickFromWeights)(a.variants,t)){m(c.variantId);return}u(x=>{var A;return x.variantId?x:{variantId:(A=t[0])!=null?A:null,content:null,isLoading:!1,settled:!1}})},[h,d,e,o]),(0,H.useEffect)(()=>{if(h||!d)return;let g=d.getAssignment(e,o);if(g&&t.includes(g.variantId))return;let a=!1;return d.assign(e,t,n,r).then(S=>{var x;a||S&&(!t.includes(S.variantId)&&!S.content||(u({variantId:S.variantId,content:(x=S.content)!=null?x:null,isLoading:!1,settled:!0}),m(S.variantId)))}),()=>{a=!0}},[h,d,e,o]),(0,H.useEffect)(()=>{if(!h&&d)return Ct(e,g=>{var x;let a=d.getAssignment(e,o);if(a&&(t.includes(a.variantId)||a.content)){u({variantId:a.variantId,content:(x=a.content)!=null?x:null,isLoading:!1,settled:!0}),m(a.variantId);return}let S=(0,$e.pickFromWeights)(g.variants,t);S&&(u({variantId:S,content:null,isLoading:!1,settled:!0}),m(S))})},[h,d,e,o]),h?{variantId:h,content:null,isLoading:!1,settled:!0,isOverride:!0}:c}function je(e,t,n){let r=I(),i=ne(),l=Object.keys(t).join("\0"),d=(0,V.useMemo)(()=>Object.keys(t),[l]),{variantId:o,content:y,isOverride:s=!1,settled:p}=Be(e,d,n.agentData,n.agentDataByVariant),[f,h]=(0,V.useState)(null),R=(0,V.useRef)(null),c=(0,V.useCallback)(O=>{R.current=O,h(O)},[]),u=n.goal,m=typeof u=="string"?u:JSON.stringify(u),g=(0,V.useMemo)(()=>u?U(u):null,[m]),a=u?se(u):"";(0,V.useEffect)(()=>Ft({id:e,variantIds:d,goal:a}),[e,d,a]);let S=(0,V.useRef)(null);(0,V.useEffect)(()=>{s||p&&(!r||!o||!i||!f||S.current!==o&&(S.current=o,ae(r,i,e,o)))},[r,o,i,e,f,s,p]);let x=(0,V.useRef)(!1),A=(0,V.useRef)(new Set);(0,V.useEffect)(()=>{x.current=!1,A.current=new Set},[o,g]);let E=n.funnel;(0,V.useEffect)(()=>{s||!p||!r||!E||!g||ye(r,i,e,E,g)},[r,i,e,E,g,s,p]);let b=n.cursorSignal===!0;(0,V.useEffect)(()=>{if(!b||s||!p||!r||!o||!f)return;let O=null,P=0,M=()=>{P=Date.now(),O=setTimeout(()=>{r.track({projectId:i,componentId:e,variantId:o,eventType:"cursor_signal",payload:{hoverDuration:Date.now()-P}}),O=null},800)},D=()=>{O!==null&&(clearTimeout(O),O=null)};return f.addEventListener("mouseenter",M),f.addEventListener("mouseleave",D),()=>{f.removeEventListener("mouseenter",M),f.removeEventListener("mouseleave",D),O!==null&&clearTimeout(O)}},[b,r,o,i,e,f,s,p]);let k=(0,V.useRef)(n.microSignalGoals);k.current=n.microSignalGoals;let w=n.microSignalGoals?JSON.stringify(n.microSignalGoals):"";return(0,V.useEffect)(()=>{if(s||!p||!r||!o||!f)return;let O=Date.now();return(0,ln.attachMicroSignalDetectors)((P,M={})=>{var oe,ue,Y;r.track({projectId:i,componentId:e,variantId:o,eventType:"micro_signal",payload:v({signalType:P},M)});let D=(oe=k.current)==null?void 0:oe[P];if(!D||A.current.has(P))return;A.current.add(P);let q=typeof D=="string"?D:D.name,Z=typeof D=="string"?1:(ue=D.weight)!=null?ue:1,ie=typeof D=="string"?0:(Y=D.stepIndex)!=null?Y:0;r.goal(q,{metadata:v({signalType:P},M),weight:Z,stepIndex:ie})},f,O)},[r,o,i,e,f,w,s,p]),(0,V.useEffect)(()=>{if(s||!p||!r||!o||!f||!g)return;let O=ee(g);return te(f,g,{fireGoal:()=>{x.current||(x.current=!0,r.track({projectId:i,componentId:e,variantId:o,eventType:"goal_achieved",goalType:a,payload:v({reward:1},O!==void 0?{goalValue:O}:{})}),r.goal(a,v({metadata:{componentId:e,variantId:o},weight:1,stepIndex:0},O!==void 0?{value:O}:{})))},fireStep:(P,M,D)=>{r.track({projectId:i,componentId:e,variantId:o,eventType:"goal_achieved",goalType:P,payload:{reward:M}}),r.goal(P,{metadata:{},weight:M,stepIndex:D})}},a)},[r,o,i,e,f,g,a,s,p]),{client:r,variantIds:d,variantId:o,content:y,settled:p,isOverride:s,goalLabel:a,ref:c,nodeRef:R}}var F=require("react"),Oe=require("@sentientui/core"),pt=require("@sentientui/core/region");var K=require("react"),cn=require("@sentientui/core");var un=new Set;function dn(e,t){var x,A,E;let n=I(),r=(0,K.useRef)(t==null?void 0:t.baselineText);r.current=t==null?void 0:t.baselineText;let i=(0,K.useRef)(t==null?void 0:t.render);i.current=t==null?void 0:t.render;let l=(0,K.useRef)(t==null?void 0:t.skeleton);l.current=t==null?void 0:t.skeleton;let d=Me(),o=nn(),y=rn(),s=on(),p=(0,K.useSyncExternalStore)(J,()=>{var b;return typeof window!="undefined"?(b=window.__sentient_slot_config_overrides)==null?void 0:b[e]:void 0},()=>{}),f=(0,K.useSyncExternalStore)(J,()=>{var b;return typeof window!="undefined"?(b=window.__sentient_slot_overrides)==null?void 0:b[e]:void 0},()=>{}),h=b=>b==null?"":(0,cn.armOfResult)(b),R=(0,K.useCallback)(b=>{var k,w;return(w=(k=n==null?void 0:n.onSlotsChanged)==null?void 0:k.call(n,b))!=null?w:(()=>{})},[n]);(0,K.useSyncExternalStore)(R,()=>{var b;return(b=n==null?void 0:n.getSlotConfig(e))!=null?b:null},()=>null),(0,K.useSyncExternalStore)(R,()=>h(n==null?void 0:n.getSlotResult(e)),()=>"");let c=p===void 0?o[e]:void 0,u=p===void 0&&c===void 0&&n?n.getSlotConfig(e):null,m=(x=y!=null?y:n==null?void 0:n.getSitePalette())!=null?x:null,g=(E=s!=null?s:(A=n==null?void 0:n.getStyleVocabulary)==null?void 0:A.call(n))!=null?E:null,a=(()=>{var b,k,w;if(p!==void 0)return{config:p,arm:h(f),palette:m,vocabulary:(b=Bt())!=null?b:g,source:"override"};if(c!==void 0)return{config:c,arm:h((k=d[e])!=null?k:n==null?void 0:n.getSlotResult(e)),palette:m,vocabulary:g,source:"preloaded"};if(u!==null){let O=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{config:u,arm:h((w=n==null?void 0:n.getSlotResult(e))!=null?w:d[e]),palette:m,vocabulary:g,source:O?"client":"seeded"}}return{config:null,arm:"",palette:m,vocabulary:g,source:"none"}})(),S=a.source==="preloaded"||a.source==="override";return(0,K.useEffect)(()=>{var q,Z,ie,oe,ue;if(!n||n.isLocal===!0||S)return;let b=a.source==="none",k=b&&(Z=(q=r.current)==null?void 0:q.call(r))!=null?Z:null,w=k!=null&&k!==""?{[e]:k}:void 0,O=(ie=i.current)==null?void 0:ie.call(i),P=b&&(ue=(oe=l.current)==null?void 0:oe.call(l))!=null?ue:null,M=v(v({},O?{render:{[e]:O}}:{}),P?{skeletons:{[e]:P}}:{}),D=Object.keys(M).length>0;return n.requestSlots?D?n.requestSlots([e],w,M):w?n.requestSlots([e],w):n.requestSlots([e]):b&&(P?n.reportSlots([e],w!=null?w:{},{[e]:P}):w?n.reportSlots([e],w):n.reportSlots([e])),()=>{var Y;return(Y=n.cancelSlots)==null?void 0:Y.call(n,[e])}},[n,S,a.source,e]),(0,K.useEffect)(()=>{!T()||(n==null?void 0:n.isLocal)!==!0||a.source!=="none"||un.has(e)||(un.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,a.source,e]),a}var ut=require("react");var L=require("react/jsx-runtime"),le={none:"0",sm:"8px",md:"16px",lg:"24px"},lt={start:"flex-start",center:"center",end:"flex-end",stretch:"stretch",between:"space-between"},pn={sm:"0.875em",md:"1em",lg:"1.25em"},pr={sm:"1.25em",md:"1.5em",lg:"2em"},fn={sm:"6px 14px",md:"10px 20px",lg:"14px 28px"},gn={sm:"8px",md:"16px",lg:"32px"},yr={square:"1 / 1",landscape:"4 / 3",wide:"16 / 9"},vr={normal:"400",medium:"500",bold:"700"};function mn(e,t){return v(v({},e==="muted"?t!=null&&t.muted?{color:t.muted}:{opacity:.7}:{}),e==="accent"?v({fontWeight:600},t!=null&&t.accent?{color:t.accent}:{}):{})}function yn(e,t,n){var i,l,d,o;let r=t==null?void 0:t.accent;return N(v({display:"inline-block",padding:(i=fn[n!=null?n:"md"])!=null?i:fn.md,borderRadius:(l=t==null?void 0:t.radius)!=null?l:"8px",font:"inherit"},n?{fontSize:pn[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"?(o=t==null?void 0:t.primaryText)!=null?o:"#ffffff":r!=null?r:"inherit",border:e==="secondary"?`1px solid ${r!=null?r:"currentColor"}`:"none"})}function Sr({node:e,opts:t}){var i,l,d,o,y;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:(y=(o=t.palette)==null?void 0:o.radius)!=null?y:"8px"};return(0,L.jsxs)("form",{onSubmit:s=>{var h,R,c;s.preventDefault();let p=new FormData(s.currentTarget),f={};for(let u of e.fields)f[u.name]=String((h=p.get(u.name))!=null?h:"");(R=t.onFormGoal)==null||R.call(t,e.submitGoal);try{(c=t.onFormSubmit)==null||c.call(t,f)}catch(u){}},style:{display:"flex",flexDirection:"column",gap:"12px"},children:[e.fields.map(s=>{var p,f;return(0,L.jsxs)("label",{style:{display:"flex",flexDirection:"column",gap:"4px",font:"inherit"},children:[s.label,s.kind==="textarea"?(0,L.jsx)("textarea",{name:s.name,required:s.required,placeholder:s.placeholder,rows:3,style:r}):s.kind==="select"?(0,L.jsx)("select",{name:s.name,required:s.required,style:r,children:((p=s.options)!=null?p:[]).map(h=>(0,L.jsx)("option",{value:h,children:h},h))}):(0,L.jsx)("input",{name:s.name,type:(f=s.inputType)!=null?f:"text",required:s.required,placeholder:s.placeholder,style:r})]},s.name)}),(0,L.jsx)("button",{type:"submit",style:yn(n,t.palette),children:e.submitLabel})]})}function hr(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 ge(e,t){var n,r,i,l,d,o,y,s,p,f,h,R,c,u,m,g,a,S,x,A,E,b,k;try{let w=hr(e,t);switch(e.type){case"stack":{let O=(r=le[(n=e.gap)!=null?n:"md"])!=null?r:le.md,P=e.surface==="raised"&&!w,M=(i=e.pad)!=null?i:P?"md":void 0;return(0,L.jsx)("div",N(v({},w?{className:w}:{}),{style:v(v(v(v(v({display:"flex",flexDirection:e.direction,gap:O},e.align?{alignItems:lt[e.align]}:{}),e.justify?{justifyContent:lt[e.justify]}:{}),e.wrap?{flexWrap:"wrap"}:{}),M?{padding:(l=le[M])!=null?l:le.md}:{}),P?N(v(v({},(d=t.palette)!=null&&d.surface?{background:t.palette.surface}:{}),(o=t.palette)!=null&&o.surface&&((y=t.palette)!=null&&y.surfaceText)?{color:t.palette.surfaceText}:{}),{border:`1px solid ${(p=(s=t.palette)==null?void 0:s.border)!=null?p:"currentColor"}`,borderRadius:(h=(f=t.palette)==null?void 0:f.radius)!=null?h:"8px"}):{}),children:((R=e.children)!=null?R:[]).map((D,q)=>{let Z=ge(D,t);return Z===null?null:(0,L.jsx)(ut.Fragment,{children:Z},q)})}))}case"grid":{let O=(u=le[(c=e.gap)!=null?c:"md"])!=null?u:le.md;return(0,L.jsx)("div",N(v({},w?{className:w}:{}),{style:v(v({display:"grid",gridTemplateColumns:`repeat(auto-fit, minmax(max(200px, calc((100% - ${e.columns-1} * ${O}) / ${e.columns})), 1fr))`,gap:O},e.align?{alignItems:lt[e.align]}:{}),e.pad?{padding:(m=le[e.pad])!=null?m:le.md}:{}),children:((g=e.children)!=null?g:[]).map((P,M)=>{let D=ge(P,t);return D===null?null:(0,L.jsx)(ut.Fragment,{children:D},M)})}))}case"text":return w?(0,L.jsx)("p",{className:w,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):(0,L.jsx)("p",{style:v(v(v(v(v({margin:0},e.size?{fontSize:pn[e.size]}:{}),e.weight?{fontWeight:vr[e.weight]}:{}),e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),mn(e.tone,t.palette)),children:e.value});case"heading":{let O=`h${e.level}`;return w?(0,L.jsx)(O,{className:w,style:e.maxWidth==="measure"?{maxWidth:"65ch"}:void 0,children:e.value}):(0,L.jsx)(O,{style:v(v({margin:0,fontSize:pr[(a=e.size)!=null?a:"md"]},e.align?{textAlign:e.align}:{}),e.maxWidth==="measure"?{maxWidth:"65ch"}:{}),children:e.value})}case"button":{let O=(S=e.emphasis)!=null?S:"primary";return(0,L.jsx)("a",N(v(v({href:e.href},e.tag?{"data-sentient-tag":e.tag}:{}),w?{className:w}:{style:yn(O,t.palette,e.size)}),{children:e.label}))}case"link":return(0,L.jsx)("a",N(v(v({href:e.href},e.tag?{"data-sentient-tag":e.tag}:{}),w?{className:w}:{style:{color:"inherit",textDecoration:"underline"}}),{children:e.label}));case"image":return(0,L.jsx)("img",N(v({src:e.src,alt:e.alt},w?{className:w}:{}),{style:v(v({display:"block",maxWidth:"100%"},e.ratio&&e.ratio!=="auto"?{aspectRatio:yr[e.ratio],width:"100%"}:{}),e.fit?{objectFit:e.fit}:{})}));case"badge":return w?(0,L.jsx)("span",{className:w,children:e.value}):(0,L.jsx)("span",{style:v({display:"inline-block",padding:"2px 10px",borderRadius:"999px",fontSize:"0.75em",border:`1px solid ${(A=(x=t.palette)==null?void 0:x.border)!=null?A:"currentColor"}`},mn(e.tone,t.palette)),children:e.value});case"spacer":return(0,L.jsx)("div",{style:{height:(E=gn[e.size])!=null?E:gn.md}});case"divider":return(0,L.jsx)("hr",{style:{border:"none",borderTop:`1px solid ${(k=(b=t.palette)==null?void 0:b.border)!=null?k:"currentColor"}`,margin:0,width:"100%"}});case"form":return(0,L.jsx)(Sr,{node:e,opts:t});default:return null}}catch(w){return null}}function Ke(e,t){var i,l,d;let n=ge(e.tree,t);if(n===null)return null;let r=(i=e.surface)!=null&&i.like?(d=(l=t.vocabulary)==null?void 0:l.entries.find(o=>o.id===e.surface.like))==null?void 0:d.classes:void 0;return r?(0,L.jsx)("div",{className:r,children:n}):n}var re=require("react"),We=require("@sentientui/core/region");function Je(e){return typeof e=="string"&&e.trim()!==""||typeof e=="number"}function Ue(e){let t=e.props;if(t.dangerouslySetInnerHTML==null)return t.children}function me(e){return Je(e)?1:Array.isArray(e)?e.reduce((t,n)=>t+me(n),0):(0,re.isValidElement)(e)?me(Ue(e)):0}function br(e,t){return Array.isArray(t)?(0,re.cloneElement)(e,void 0,...t):(0,re.cloneElement)(e,void 0,t)}function ct(e,t){if(Je(e))return t;if(Array.isArray(e))return e.map(n=>ct(n,t));if((0,re.isValidElement)(e)){let n=Ue(e);return me(n)===0?e:br(e,ct(n,t))}return e}function vn(e,t){return me(e)===1?ct(e,t):null}var W=e=>e.join("/");function dt(e,t,n){if(Je(e)){n.leafPaths.push(t),n.texts.push((0,We.normalizeLeafText)(String(e)));return}if(Array.isArray(e)){e.forEach((r,i)=>dt(r,[...t,i],n));return}(0,re.isValidElement)(e)&&(n.elements.set(W(t),e),dt(Ue(e),[...t,"c"],n))}function gt(e){let t={leafPaths:[],texts:[],elements:new Map};return dt(e,[],t),t}function xr(e){return gt(e).texts}function Sn(e){let t=xr(e);return t.length===0?null:(0,We.skeletonFingerprint)(t)}function wr(e){let t=[];return e.forEach((n,r)=>{n==="c"&&t.push(e.slice(0,r))}),t}function hn(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((o,y)=>o===i?[wr(e.leafPaths[y])]:[]);if(l.length===0){r.push(null);continue}let d=l[0];for(let o of l.slice(1)){let y=new Set(o.map(W));d=d.filter(s=>y.has(W(s)))}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=hn(n,e.leafToNode),i=e.nodes.map((l,d)=>{let o=r[d],y=o?n.elements.get(W(o)):void 0,s=!!y&&(typeof y.type=="string"||ft(y)!==void 0);return N(v({},l),{restylable:s})});return N(v({},e),{nodes:i})}function bn(e,t,n){var c;let r=gt(e);if(r.leafPaths.length!==n.length)return null;let i=n.reduce((u,m)=>Math.max(u,m+1),0);for(let u of Object.keys(t.nodes))if(!/^\d+$/.test(u)||Number(u)>=i)return null;let l=hn(r,n),d=new Map;n.forEach((u,m)=>{d.has(u)||d.set(u,m)});let o=new Map(r.leafPaths.map((u,m)=>[W(u),m])),y=new Set,s=new Map,p=!1;for(let[u,m]of Object.entries(t.nodes)){let g=Number(u),a=l[g];if(m.hidden&&(a?y.add(W(a)):p=!0),m.like!==void 0){let S=l[m.like],x=a?r.elements.get(W(a)):void 0,A=S?ft(r.elements.get(W(S))):void 0;!a||A===void 0||ft(x)===void 0?p=!0:s.set(W(a),A)}}let f=new Map(Object.entries((c=t.order)!=null?c:{})),h=(u,m)=>{var g;if(Je(u)){let a=o.get(W(m));if(a===void 0)return u;let S=n[a],x=(g=t.nodes[String(S)])==null?void 0:g.text;return x===void 0?u:d.get(S)===a?x:""}if(Array.isArray(u)){let a=u.map((S,x)=>h(S,[...m,x]));for(let[S,x]of f){let A=x.map(k=>{let w=l[k];return!w||w.length!==m.length+1||W(w.slice(0,-1))!==W(m)?-1:w[w.length-1]});if(A.some(k=>k<0))continue;let E=[...A].sort((k,w)=>k-w),b=[...a];E.forEach((k,w)=>{a[k]=b[A[w]]}),f.delete(S)}return a}if((0,re.isValidElement)(u)){let a=W(m);if(y.has(a))return null;let S=Ue(u);if(me(S)===0)return u;let x=h(S,[...m,"c"]),A=s.get(a),E=A!==void 0?{className:A}:void 0;return Array.isArray(x)?(0,re.cloneElement)(u,E,...x):(0,re.cloneElement)(u,E,x)}return u},R=h(e,[]);return p||f.size>0?null:R}var An=require("react/jsx-runtime"),xn=new Set,wn=new Set,kn=new Set,Rn="authored.";function Ee({id:e,children:t,variants:n,onFormSubmit:r,goal:i,className:l,reportBaselineText:d=!0}){var ht,bt;let o=I(),y=ne(),s=(0,F.useRef)(null),p=(0,F.useMemo)(()=>Sn(t),[t]),f=n?Object.keys(n).join("|"):"",h=(0,F.useMemo)(()=>v({fp:p!=null?p:"0000000000000000",forms:!!r,compose:!0,content:me(t)===1},f!==""?{authored:f.split("|"),children:!0}:{}),[p,t,r,f]),R=()=>{var Q;let _=s.current;if(!_||!d)return null;let G=(0,pt.captureRegionSkeleton)(_);return G.skeleton?(Q=mt(G.skeleton,t))!=null?Q:N(v({},G.skeleton),{editable:!1,nodes:G.skeleton.nodes.map(ce=>N(v({},ce),{restylable:!1}))}):{status:G.reason}},{config:c,arm:u,palette:m,vocabulary:g,source:a}=dn(e,{baselineText:d?()=>{var _,G;return(G=(_=s.current)==null?void 0:_.textContent)!=null?G:null}:void 0,render:()=>h,skeleton:R}),S=u!==""?(ht=c==null?void 0:c.blocks)==null?void 0:ht[u]:void 0,x=u!==""?(bt=c==null?void 0:c.compose)==null?void 0:bt[u]:void 0,A=(S!==void 0&&(0,Oe.containsFormBlock)(S)||x!==void 0&&(0,Oe.containsFormBlock)(x.tree))&&!r;(0,F.useEffect)(()=>{!A||!T()||xn.has(e)||(xn.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.`))},[A,e]);let E=_=>{!o||a==="override"||(a!=="seeded"&&o.componentGoal(e,_),o.goal(_,{metadata:{componentId:e,arm:u},weight:1,stepIndex:0}))},b=t,k=!1,w=u.startsWith(Rn)?u.slice(Rn.length):null;if((c==null?void 0:c.blocked)==="variant_history")k=!0;else if(w!==null)n&&Object.prototype.hasOwnProperty.call(n,w)?b=n[w]:k=!0;else if(x!==void 0){let _=A?null:Ke(x,{palette:m,vocabulary:g,onFormSubmit:r,onFormGoal:E});_===null?k=!0:b=_}else if(S!==void 0){let _=A?null:ge(S,{palette:m,vocabulary:g,onFormSubmit:r,onFormGoal:E});_===null?k=!0:b=_}else if((c==null?void 0:c.edits)!==void 0&&a!=="none"){let _=c.edits,G=_.fp===p?bn(t,_.edits,_.leafToNode):null;G===null?k=!0:b=G}else if((c==null?void 0:c.content)!==void 0&&a!=="none"){let _=vn(t,c.content);_===null?k=!0:b=_}let O=k&&S===void 0&&x===void 0&&(c==null?void 0:c.edits)===void 0&&w===null&&(c==null?void 0:c.blocked)===void 0;(0,F.useEffect)(()=>{(c==null?void 0:c.blocked)!=="variant_history"||!T()||kn.has(e)||(kn.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: Components \u2192 "${e}" \u2192 Migrate. Deploying code never switches an experiment.`))},[c==null?void 0:c.blocked,e]);let P=w!==null&&!k?w:null;(0,F.useEffect)(()=>{var Ae;if(!P||!d||!o)return;let _=s.current;if(!_)return;let G=(0,pt.captureRegionSkeleton)(_),Q=G.skeleton?mt(G.skeleton,n==null?void 0:n[P]):null,ce=(Ae=_.textContent)==null?void 0:Ae.trim();o.reportSlots([],void 0,void 0,{[e]:[v(v({key:P},ce?{text:ce}:{}),Q?{skeleton:Q}:{})]})},[P,o,e]);let M=k&&(c==null?void 0:c.edits)!==void 0&&(a==="preloaded"||a==="client");(0,F.useEffect)(()=>{var _;!M||!(c!=null&&c.edits)||(_=o==null?void 0:o.reportDrift)==null||_.call(o,e,c.edits.fp,p,c.edits.fp===p?"unaddressable":"fp_mismatch")},[M,e,p,o]);let D=b===t;(0,F.useEffect)(()=>{var G;if(!(c!=null&&c.needsSkeleton)||!D)return;let _=R();_&&((G=o==null?void 0:o.reportSkeleton)==null||G.call(o,e,_))},[c==null?void 0:c.needsSkeleton,D,e,o]),(0,F.useEffect)(()=>{if(!D)return;let _=Jt(e);if(!_)return;let G=R();Ut(_,G&&"status"in G?{status:G.status}:{skeleton:G})},[e,D]),(0,F.useEffect)(()=>{!O||!T()||wn.has(e)||(wn.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.`))},[O,e]);let q=c!=null&&c.blocks?Object.keys(c.blocks).sort().join("|"):"";(0,F.useEffect)(()=>ve({id:e,arms:q===""?void 0:q.split("|")}),[e,q]);let Z=(0,F.useRef)(null);(0,F.useEffect)(()=>{!o||a==="none"||a==="seeded"||a==="override"||u===""||k||Z.current!==u&&(Z.current=u,ae(o,y,e,u))},[o,y,e,u,a,k]);let ie=a!=="none"&&a!=="seeded"&&!k,oe=ie?u:"",ue=i===void 0?null:typeof i=="string"?i:JSON.stringify(i);(0,F.useEffect)(()=>{if(!o||!i||a==="override")return;let _=s.current;if(!_)return;let G=se(i),Q=ee(i),ce=!1;return te(_,U(i),{fireGoal:()=>{ce||(ce=!0,ie&&(Q!==void 0?o.componentGoal(e,G,{value:Q}):o.componentGoal(e,G)),o.goal(G,v({metadata:{componentId:e,arm:oe},weight:1,stepIndex:0},Q!==void 0?{value:Q}:{})))},fireStep:(Ae,xt,Yn)=>{ie&&o.componentGoal(e,Ae,{reward:xt}),o.goal(Ae,{metadata:{componentId:e,arm:oe},weight:xt,stepIndex:Yn})}},G)},[o,e,ue,u,a,k,ie,oe]);let Y=(0,F.useRef)(null);(0,F.useEffect)(()=>{let _=s.current;if(_){if(Y.current===null){Y.current=u;return}Y.current!==u&&(Y.current=u,(0,Oe.reveal)(_))}},[u]);let Zn=(0,F.useMemo)(()=>v({"data-sentient-slot":e},u!==""?{"data-sentient-arm":u}:{}),[e,u]);return(0,An.jsx)("div",N(v({ref:s,className:l},Zn),{children:b}))}var Pe=require("react/jsx-runtime");function kr(e){var s;let{client:t,variantId:n,content:r,ref:i}=je(e.id,e.variants,{goal:e.goal,funnel:e.funnel,microSignalGoals:e.microSignalGoals,agentData:e.agentData,agentDataByVariant:e.agentDataByVariant,cursorSignal:!0}),[l,d]=(0,ke.useState)(!1);if((0,ke.useEffect)(()=>{d(!0)},[]),e.clientOnly&&(!l||!t)||!n)return null;let o=(s=e.variants[n])!=null?s:null,y=o===null?r:null;return T()&&o===null&&y===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.`),(0,Pe.jsx)("div",{ref:i,"data-sentient-id":e.id,"data-sentient-variant":n,children:o!=null?o:y})}var Rr=(0,ke.memo)(kr,(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.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 _n(e){if(e.variants===void 0)return(0,Pe.jsx)(Ee,v({},e));let t=e;if(t.children!=null){T()&&Ar(t);let n=t,{funnel:r,microSignalGoals:i,agentData:l,agentDataByVariant:d,clientOnly:o,variants:y}=n,s=Le(n,["funnel","microSignalGoals","agentData","agentDataByVariant","clientOnly","variants"]);return(0,Pe.jsx)(Ee,N(v({},s),{children:t.children,variants:y}))}return(0,Pe.jsx)(Rr,v({},t))}var Cn=new Set;function Ar(e){let t=["funnel","microSignalGoals","agentData","agentDataByVariant","clientOnly"].filter(n=>e[n]!==void 0);t.length===0||Cn.has(e.id)||(Cn.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(", ")}.`))}var $=require("react");var En=require("react/jsx-runtime");function On({id:e,default:t,component:n="span",className:r,goal:i}){var E;let l=I(),d=ne(),o=Fe(),y=Ve(),s=(0,$.useRef)(null),p=(0,$.useRef)(null),f=(0,$.useSyncExternalStore)(J,()=>we(e),()=>null),[h,R]=(0,$.useState)(()=>{var b,k;return(k=(b=l==null?void 0:l.getAssignment(e,y))==null?void 0:b.content)!=null?k:null}),[c,u]=(0,$.useState)(()=>{var b,k;return(k=(b=l==null?void 0:l.getAssignment(e,y))==null?void 0:b.variantId)!=null?k:null});(0,$.useEffect)(()=>{if(f||!l)return;let b=l.getAssignment(e,y);if((b==null?void 0:b.content)!==void 0){u(b.variantId),R(b.content);return}let k=!1;return l.assign(e).then(w=>{if(!k){if(!w){T()&&console.warn(`[sentient] <AdaptiveText id="${e}"> assignment failed \u2014 showing default text.`);return}u(w.variantId),w.content&&R(w.content)}}),()=>{k=!0}},[l,e,y,f]),(0,$.useEffect)(()=>{f||!l||!c||!d||s.current!==c&&(s.current=c,l.track({projectId:d,componentId:e,variantId:c,eventType:"variant_assigned",payload:{}}),o==null||o(e,c))},[l,c,d,e,o,f]);let m=i===void 0?"":typeof i=="string"?i:JSON.stringify(i),g=(0,$.useMemo)(()=>i===void 0?null:U(i),[m]),a=i===void 0?null:typeof i=="string"?i:g.type,S=(0,$.useRef)(!1);(0,$.useEffect)(()=>{S.current=!1},[c,m]),(0,$.useEffect)(()=>{if(f||!l||!c||!d||!g||!a)return;let b=p.current;if(!b)return;let k=ee(g);return te(b,g,{fireGoal:()=>{S.current||(S.current=!0,l.track({projectId:d,componentId:e,variantId:c,eventType:"goal_achieved",goalType:a,payload:v({reward:1},k!==void 0?{goalValue:k}:{})}),l.goal(a,v({metadata:{componentId:e,variantId:c},weight:1,stepIndex:0},k!==void 0?{value:k}:{})))},fireStep:(w,O,P)=>{l.track({projectId:d,componentId:e,variantId:c,eventType:"goal_achieved",goalType:w,payload:{reward:O}}),l.goal(w,{metadata:{},weight:O,stepIndex:P})}})},[l,c,d,e,g,a,f]);let x=h!=null?h:t;if(f){let b=l==null?void 0:l.getAssignment(e,y);x=b&&b.variantId===f&&(E=b.content)!=null?E:t}return(0,En.jsx)(n,{ref:b=>{p.current=b},className:r,children:x})}var He=require("react");function ze(e){let t=I(),n=(0,He.useRef)(new Set);return(0,He.useCallback)((r,i)=>{var l,d;if(!we(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,v(v(v({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])}var Ge=require("react");function Pn(e,t={}){let y=t,{componentId:n}=y,r=Le(y,["componentId"]),i=I(),l=ze(n!=null?n:""),d=(0,Ge.useRef)(!1),o=(0,Ge.useRef)(r);o.current=r,(0,Ge.useEffect)(()=>{if(!i||d.current)return;d.current=!0;let{metadata:s,reward:p,value:f,currency:h,externalId:R}=o.current;if(n){l(e,o.current);return}i.goal(e,v(v(v({metadata:s!=null?s:{},weight:p!=null?p:1,stepIndex:0},f!==void 0?{value:f}:{}),h!==void 0?{currency:h}:{}),R!==void 0?{externalId:R}:{}))},[i,n,e,l])}var Tn=require("@sentientui/core"),Ln=require("@sentientui/policy"),In=require("react/jsx-runtime");function Gn(e){return JSON.stringify(e).replace(/</g,"\\u003c")}function Cr(e){return e.persona?'(function(){try{var d=document.documentElement;if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",'+Gn(e.persona.persona)+');d.setAttribute("data-sentient-confidence",'+Gn((0,Ln.confidenceBand)(e.persona.confidence))+");}catch(e){}})();":(0,Tn.renderPrePaintScript)(e.apiKey)}function Dn(e){return(0,In.jsx)("script",{"data-sentient-persona-script":"",nonce:e.nonce,dangerouslySetInnerHTML:{__html:Cr(e)}})}var X=require("react"),Mn=require("@sentientui/policy");var z=require("react"),pe=require("@sentientui/core"),Nn=require("@sentientui/policy");function Xe(e,t){let n=I(),r=Me(),[,i]=(0,z.useReducer)(f=>f+1,0),l=(0,z.useSyncExternalStore)(J,()=>{var f;return typeof window!="undefined"?(f=window.__sentient_slot_overrides)==null?void 0:f[e]:void 0},()=>{}),d=l===void 0?r[e]:void 0,o=l===void 0&&d===void 0&&n?n.getSlotResult(e):null,y=(n==null?void 0:n.isLocal)===!0&&l===void 0&&d===void 0&&o===null;(0,z.useEffect)(()=>{if(!y||!n)return;let f=!1;return n.decide({slots:[t]}).then(h=>{!f&&h&&i()}),()=>{f=!0}},[n,e,y]);let s=(()=>{if(l!==void 0)return{result:l,arm:(0,pe.armOfResult)(l),source:"override"};if(d!==void 0)return{result:d,arm:(0,pe.armOfResult)(d),source:"preloaded"};if(o!==null){let h=n!=null&&n.isSlotDecided?n.isSlotDecided(e):!0;return{result:o,arm:(0,pe.armOfResult)(o),source:h?"client":"seeded"}}let f=(0,pe.baselineResultFor)(t);return{result:f,arm:(0,pe.armOfResult)(f),source:"baseline"}})(),p=s.source==="preloaded"||s.source==="override";return(0,z.useEffect)(()=>{var h;if(!n||n.isLocal===!0||p||!n.decideSlots)return;let f=(h=n.onSlotsChanged)==null?void 0:h.call(n,i);return n.decideSlots([t]),()=>{var R;(R=n.cancelSlots)==null||R.call(n,[e]),f==null||f()}},[n,e,p]),s}function _r(){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 Vn(){let e=I(),t=tn();(0,z.useSyncExternalStore)(J,Gt,()=>0);let[n,r]=(0,z.useState)(!1);(0,z.useEffect)(()=>r(!0),[]);let i=o=>({persona:o.persona,confidence:o.confidence,band:(0,Nn.confidenceBand)(o.confidence)});if(!n)return t?i(t):null;let l=_r();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 Or(e){return typeof CSS!="undefined"&&typeof CSS.escape=="function"?CSS.escape(e):e.replace(/[\\"]/g,"\\$&")}function $n(e,t,n){let r=I(),i=ne(),l=JSON.stringify(t),d=(0,X.useMemo)(()=>({id:e,dims:t}),[e,l]),{result:o,arm:y,source:s}=Xe(e,d),p=(0,X.useMemo)(()=>typeof o=="string"?{}:o,[y]);if(T()&&!Fn.has(e)){Fn.add(e);let u=(0,Mn.validateSlotDecl)({id:e,dims:Object.fromEntries(Object.entries(t).map(([g,a])=>[g,[...a]]))}),m=Object.values(t).reduce((g,a)=>g*a.length,1);u.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 ${u.reason}. Serving baseline.`)}let f=(n==null?void 0:n.goal)===void 0?null:typeof n.goal=="string"?n.goal:JSON.stringify(n.goal);(0,X.useEffect)(()=>ve({id:e,dims:t}),[e]);let h=(0,X.useRef)(null);(0,X.useEffect)(()=>{!r||s==="baseline"||s==="seeded"||s==="override"||h.current===y||(h.current=y,ae(r,i,e,y))},[r,i,e,y,s]);let R=n==null?void 0:n.funnel;(0,X.useEffect)(()=>{var u;!r||!R||s==="override"||ye(r,i,e,R,U((u=n==null?void 0:n.goal)!=null?u:"click"))},[r,i,e,R,f,s]),(0,X.useEffect)(()=>{if(!r||!(n!=null&&n.goal)||s==="override"||s==="baseline"||s==="seeded")return;let u=document.querySelector(`[data-sentient-slot="${Or(e)}"]`);if(!u){T()&&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=se(n.goal),g=ee(n.goal),a=!1;return te(u,U(n.goal),{fireGoal:()=>{a||(a=!0,g!==void 0?r.componentGoal(e,m,{value:g}):r.componentGoal(e,m),r.goal(m,v({metadata:{componentId:e,arm:y},weight:1,stepIndex:0},g!==void 0?{value:g}:{})))},fireStep:(S,x,A)=>{r.componentGoal(e,S,{reward:x}),r.goal(S,{metadata:{componentId:e,arm:y},weight:x,stepIndex:A})}},m)},[r,e,f,y,s]);let c=(0,X.useMemo)(()=>{let u={"data-sentient-slot":e};for(let[m,g]of Object.entries(p))u[`data-${m}`]=g;return u},[e,p]);return{tokens:p,props:c}}var Re=require("react");var Bn=new Set;function jn(e,t){var R;if(T()&&!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:o,nodeRef:y}=je(e,t.variants,{goal:t.goal,funnel:t.funnel,microSignalGoals:t.microSignalGoals}),s=(R=i!=null?i:r[0])!=null?R:"",p=t.variants[s];(0,Re.useEffect)(()=>{if(!T()||!n)return;let c=setTimeout(()=>{!y.current&&!Bn.has(e)&&(Bn.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(c)},[n,e]);let f=(0,Re.useCallback)((c,u)=>{var g,a;if(l)return;let m=c!=null?c:d;m&&(n==null||n.componentGoal(e,m,u),n==null||n.goal(m,v(v(v({metadata:(g=u==null?void 0:u.metadata)!=null?g:{},weight:(a=u==null?void 0:u.reward)!=null?a:1,stepIndex:0},(u==null?void 0:u.value)!==void 0?{value:u.value}:{}),(u==null?void 0:u.currency)!==void 0?{currency:u.currency}:{}),(u==null?void 0:u.externalId)!==void 0?{externalId:u.externalId}:{})))},[n,e,d,l]),h=(0,Re.useMemo)(()=>({ref:o,"data-sentient-id":e,"data-sentient-variant":s}),[o,e,s]);return{variant:s,value:p,bind:h,fireGoal:f}}var j=require("react");var Wn=require("react/jsx-runtime"),qe=new Set;function Kn(e){var g;let t=I(),n=ne(),r=(0,j.useRef)(null),i=Object.keys(e.arrangements).join(" "),l=(0,j.useMemo)(()=>Object.keys(e.arrangements),[i]),d=(0,j.useMemo)(()=>v({id:e.id,arms:l},e.baseline!==void 0?{baseline:e.baseline}:{}),[e.id,l,e.baseline]),{arm:o,source:y}=Xe(e.id,d);T()&&e.baseline!==void 0&&e.baseline!==l[0]&&!qe.has(e.id+":baseline")&&(qe.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 s=j.Children.toArray(e.children).filter(j.isValidElement),p=new Map;for(let a of s)p.set(String((g=a.key)!=null?g:"").replace(/^\.\$/,""),a);let f=e.arrangements[o],h=f!==void 0&&f.length===s.length&&f.every(a=>p.has(a));T()&&f!==void 0&&!h&&!qe.has(e.id+":keys")&&(qe.add(e.id+":keys"),console.warn(`[sentient] <AdaptiveGroup id="${e.id}">: arrangement "${o}" [${f.join(", ")}] does not match the children's keys \u2014 rendering declaration order (fail-safe).`));let R=h?f.map(a=>p.get(a)):s;(0,j.useEffect)(()=>ve({id:e.id,arms:Object.keys(e.arrangements)}),[e.id]);let c=(0,j.useRef)(null);(0,j.useEffect)(()=>{!t||y==="baseline"||y==="seeded"||y==="override"||c.current===o||(c.current=o,ae(t,n,e.id,o))},[t,n,e.id,o,y]);let u=e.funnel;(0,j.useEffect)(()=>{var a;!t||!u||y==="override"||ye(t,n,e.id,u,U((a=e.goal)!=null?a:"click"))},[t,n,e.id,u,y]);let m=e.goal===void 0?null:typeof e.goal=="string"?e.goal:JSON.stringify(e.goal);return(0,j.useEffect)(()=>{if(!t||e.goal===void 0||y==="override"||y==="baseline"||y==="seeded")return;let a=r.current;if(!a)return;let S=se(e.goal),x=ee(e.goal),A=!1;return te(a,U(e.goal),{fireGoal:()=>{A||(A=!0,x!==void 0?t.componentGoal(e.id,S,{value:x}):t.componentGoal(e.id,S),t.goal(S,v({metadata:{componentId:e.id,arm:o},weight:1,stepIndex:0},x!==void 0?{value:x}:{})))},fireStep:(E,b,k)=>{t.componentGoal(e.id,E,{reward:b}),t.goal(E,{metadata:{componentId:e.id,arm:o},weight:b,stepIndex:k})}},S)},[t,e.id,m,o,y]),(0,Wn.jsx)("div",{ref:r,"data-sentient-id":e.id,"data-sentient-variant":o,children:R})}var yt=require("@sentientui/core");var Er=["page","blocks","layoutOrder"],Jn=new Map;function Un(e,t){Jn.set(e,t)}function vt(e){return Jn.get(e)}function Hn(e){var i,l;let t=(l=(i=e.content)!=null?i:vt(e.page))!=null?l:{},n={};for(let[d,o]of Object.entries(t))Er.includes(d)||(n[d]=o);let r=N(v({},n),{page:e.page,blocks:e.blocks});return e.layoutOrder&&(r.layoutOrder=e.layoutOrder),r}function zn(e){return`<script type="application/ld+json">${St(e)}</script>`}function St(e){return JSON.stringify(v({"@context":"https://schema.org","@type":"WebPage"},e)).replace(/</g,"\\u003c")}function Xn(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
4
  `}var qn=require("@sentientui/core");0&&(module.exports={Adaptive,AdaptiveGroup,AdaptiveProvider,AdaptiveSlot,AdaptiveText,SentientPersonaScript,buildAgentFeed,defineAgentContent,detectSegment,getAgentContent,grantConsent,renderAgentJsonLd,renderAgentJsonLdBody,renderAgentMarkdown,renderBlocks,renderCompose,useAdaptive,useAdaptiveApiBaseUrl,useAdaptiveGoal,useAdaptivePersona,useAdaptiveTokens,useAssignment,useInitialAssignments,useLayoutOrder,usePageGoal,useSentient});
5
5
  //# sourceMappingURL=index.js.map