@sentientui/core 0.28.0 → 0.29.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
- import{a as w}from"./chunk-WKXD7KI3.mjs";import{a as v,g as A}from"./chunk-Z6ILOYBD.mjs";import{A as qe,B as ze,C as Be,D as He,E as Ye,F as Q,G as x,H as _,I as Z,J as O,a as V,b as W,c as J,d as X,g as we,h as Te,i as ve,j as Ae,k as Ne,l as xe,m as _e,n as Oe,o as Re,p as Me,q as De,r as Pe,s as ke,t as Ge,u as $e,v as Le,w as je,x as Ke,y as Ue,z as Fe}from"./chunk-APVHRDKP.mjs";import{a as N,b as C,c as b,j,k as K,l as U,o as F,p as q,r as z,s as B,t as H,u as Y}from"./chunk-2NVSFI4V.mjs";import{a as y,b as E}from"./chunk-TMCGHANO.mjs";var R="_snt_graph_edges",ee={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function te(e){var t;return(t=ee[e])!=null?t:[]}function ne(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function oe(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var re=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function se(e){return re.has(e)?e:"generic"}function M(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function ae(e,t,n){let a=`${e}:${t}:${n.join(",")}`,c=5381;for(let i=0;i<a.length;i++)c=(c<<5)+c+a.charCodeAt(i)&4294967295;return(c>>>0).toString(16).padStart(8,"0")}function D(e){let t=new Map,n=new Map,a=`_snt_graph_nodes${N(e==null?void 0:e.apiKey)}`,c=()=>{typeof window!="undefined"&&oe(a,[...t.values()])};if(typeof window!="undefined"){let i=ne(a,[]);for(let o of i)t.set(o.componentId,o);try{localStorage.removeItem(R)}catch(o){}}return{addPageNode(i){t.set(i.componentId,i),c()},addStructuralEdge(i){let o=`${i.fromComponentId}->${i.toComponentId}`;n.set(o,i)},syncOnce(){var o,m;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let i=[...t.values()];if(i.length!==0)try{let u=new Map;for(let r of i){let p=(o=u.get(r.semanticType))!=null?o:[];p.push(r),u.set(r.semanticType,p)}let s=[],d=new Set;for(let r of i)for(let p of te(r.semanticType)){let l=(m=u.get(p))!=null?m:[];for(let h of l){if(h.componentId===r.componentId)continue;let S=`semantic:${r.componentId}->${h.componentId}`;d.has(S)||(d.add(S),s.push({fromComponentId:r.componentId,toComponentId:h.componentId,type:"semantic",weight:.4,confidence:.9}))}}let f=new Set(i.map(r=>r.componentId));for(let r of n.values()){if(!f.has(r.fromComponentId)||!f.has(r.toComponentId))continue;let p=`structural:${r.fromComponentId}->${r.toComponentId}`;d.has(p)||(d.add(p),s.push({fromComponentId:r.fromComponentId,toComponentId:r.toComponentId,type:"structural",weight:r.weight,confidence:1}))}let g=E(y(y({pageUrl:M(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:i.map(r=>{let p=se(r.semanticType);return{componentId:r.componentId,semanticType:p,answers:r.answers,contentHash:ae(r.componentId,p,r.answers),prominenceScore:r.prominenceScore,depthInPage:r.depth}}),edges:s});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:y({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(g)}).catch(()=>{})}catch(u){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(a),localStorage.removeItem(R)}catch(i){}}}}var ie=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),ce="h1, h2, h3",de="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",P=30,pe=1500,ue={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function k(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function le(e){var t,n,a;try{let c=e;for(let i of Object.keys(c)){if(!i.startsWith("__reactFiber")&&!i.startsWith("__reactInternalInstance"))continue;let o=c[i],m=(a=(t=o==null?void 0:o.type)==null?void 0:t.displayName)!=null?a:(n=o==null?void 0:o.type)==null?void 0:n.name;if(m&&m.length>1)return m}}catch(c){}}function me(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var G=new Set(v);function fe(e){let t=e.getAttribute("data-sentient-type");if(t&&G.has(t))return t;let n=e.getAttribute("role");return n&&G.has(n)?n:A(e)}function ge(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)&4294967295;return(t>>>0).toString(16).padStart(8,"0")}function he(e){let t=[],n=e;for(;n;){let a=n.parentElement;if(!a){t.push(n.tagName.toLowerCase());break}let c=Array.prototype.indexOf.call(a.children,n);t.push(`${n.tagName.toLowerCase()}[${c}]`),n=a}return t.reverse().join("/")}function Se(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${ge(he(e))}`}function ye(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function T(e,t){var a,c,i,o;let n=e.querySelector(ce);return{componentId:Se(e),semanticType:fe(e),ariaLabel:(a=e.getAttribute("aria-label"))!=null?a:void 0,headingText:(i=(c=n==null?void 0:n.textContent)==null?void 0:c.trim())!=null?i:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:ye(e),reactComponentName:le(e),dataAttributes:me(e),locator:(o=w(e,e.ownerDocument))!=null?o:void 0}}function $(e){var i;let t=[],n=new Set,a="__root__",c=new Map;for(let[o,m]of e){let u=o.parentElement,s=a;for(;u;){if(e.has(u)){s=e.get(u);let f=e.get(o),g=`${s}->${f}`;!n.has(g)&&s!==f&&(n.add(g),t.push({fromComponentId:s,toComponentId:f,weight:.6}));break}u=u.parentElement}let d=(i=c.get(s))!=null?i:[];d.push(o),c.set(s,d)}for(let o of c.values()){if(o.length<2)continue;let m=o.length>P?o.slice(0,P):o;for(let u=0;u<m.length;u++)for(let s=u+1;s<m.length;s++){if(t.length>=pe)return t;let d=e.get(m[u]),f=e.get(m[s]);if(d===f)continue;let g=`${d}->${f}::sib`,r=`${f}->${d}::sib`;n.has(g)||(n.add(g),t.push({fromComponentId:d,toComponentId:f,weight:.3})),n.has(r)||(n.add(r),t.push({fromComponentId:f,toComponentId:d,weight:.3}))}}return t}function Ee(e){let t=[],n=new Set,a=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(o=>{if(o instanceof Element&&!n.has(o)){n.add(o);let m=T(o,e);t.push(m),a.set(o,m.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(o=>{if(!(o instanceof Element)||n.has(o))return;let m=o.hasAttribute("aria-label"),u=o.hasAttribute("data-sentient-id");if(!m&&!u)return;n.add(o);let s=T(o,e);t.push(s),a.set(o,s.componentId)}),{nodes:t,edges:$(a),elementToId:a}}function L(){if(typeof window=="undefined")return ue;let e=null,t=0,n=null,a=new Map,c=u=>{try{let s=window.getComputedStyle(u),d=parseFloat(s.fontSize)||12,f=parseFloat(s.zIndex)||0,g=u.getBoundingClientRect(),r=Math.max(g.top,0),p=window.innerHeight||1,l=1/(r/p+1),h=k(d,12,48)*.4+l*.4+k(f,0,100)*.2;return Math.max(0,Math.min(1,h))}catch(s){return .5}};return{scan:()=>new Promise(u=>{let s=()=>{let{nodes:d,edges:f,elementToId:g}=Ee(c);a.clear();for(let[r,p]of g)a.set(r,p);u({nodes:d,edges:f,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?t=requestIdleCallback(s,{timeout:100}):s()}catch(d){s()}}),observe:u=>{n=u;try{e=new MutationObserver(s=>{let d=[],f=new Set;for(let r of s)r.type==="childList"&&r.addedNodes.forEach(p=>{if(!(p instanceof Element))return;let l=[];ie.has(p.tagName)&&(p.hasAttribute("data-sentient-id")||p.hasAttribute("aria-label"))&&l.push(p);try{p.querySelectorAll(de).forEach(h=>l.push(h))}catch(h){}for(let h of l){if(a.has(h))continue;let S=T(h,c);d.push(S),f.add(S.componentId),a.set(h,S.componentId)}});if(d.length===0||!n)return;for(let r of[...a.keys()])r.isConnected||a.delete(r);let g=$(a).filter(r=>f.has(r.fromComponentId)||f.has(r.toComponentId));n({nodes:d,edges:g,addedAt:Date.now()})}),e.observe(document.body,{childList:!0,subtree:!0})}catch(s){}},getProminenceScore:c,destroy:()=>{if(e&&(e.disconnect(),e=null),t&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(t)}catch(u){}t=0,n=null,a.clear()}}}var Ie="https://api.sentient-ui.com/v1/events";function Ce(e){var n;let t=a=>{try{let c=document.cookie.match(new RegExp(`(?:^|; )${a}=([^;]*)`));return c?decodeURIComponent(c[1]):void 0}catch(c){return}};return(n=e?t(b(e)):void 0)!=null?n:t(C)}var I=new Map;function be(e){var r;let t=O(e),n=e.respectDoNotTrack!==!1&&_(),a=e.consent===!1||n,c=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),i=e.localMode===!0||!c;if(!e.graph||i||typeof window=="undefined")return t;if(a)return n||x(e.apiKey,p=>be(p)),t;let o=I.get(e.apiKey);if(o)try{o()}catch(p){}let m=L(),u=(r=e.ingestUrl)!=null?r:Ie,s=D({syncUrl:u.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:Ce(e.apiKey)});m.scan().then(p=>{for(let l of p.nodes)s.addPageNode({id:l.componentId,componentId:l.componentId,semanticType:l.semanticType,answers:e.captureDomText&&l.headingText?[l.headingText]:[],prominenceScore:l.prominenceScore,depth:l.depth});for(let l of p.edges)s.addStructuralEdge(l);s.syncOnce()});let d=null,f=()=>{d!==null&&clearTimeout(d),d=setTimeout(()=>{d=null,s.syncOnce()},500)};m.observe(p=>{for(let l of p.nodes)s.addPageNode({id:l.componentId,componentId:l.componentId,semanticType:l.semanticType,answers:e.captureDomText&&l.headingText?[l.headingText]:[],prominenceScore:l.prominenceScore,depth:l.depth});for(let l of p.edges)s.addStructuralEdge(l);f()});let g=()=>{d!==null&&(clearTimeout(d),d=null),m.destroy(),s.destroy(),I.get(e.apiKey)===g&&I.delete(e.apiKey)};return I.set(e.apiKey,g),E(y({},t),{getGraph:()=>s.snapshot(),dispose:()=>{g(),t.dispose()},destroy:()=>{g(),t.destroy()}})}export{Te as BLOCK_ALIGNS,_e as BLOCK_EMPHASES,Me as BLOCK_FITS,we as BLOCK_GAPS,De as BLOCK_GRID_COLUMNS,Pe as BLOCK_HEADING_LEVELS,ve as BLOCK_JUSTIFIES,$e as BLOCK_MAX_WIDTHS,Ge as BLOCK_PADS,Re as BLOCK_RATIOS,Ae as BLOCK_SIZES,ke as BLOCK_SURFACES,Oe as BLOCK_TEXT_ALIGNS,xe as BLOCK_TONES,Ne as BLOCK_WEIGHTS,Le as FORM_FIELD_KINDS,je as FORM_INPUT_TYPES,C as LEGACY_SESSION_COOKIE_NAME,Be as MAX_BLOCK_ARMS,ze as MAX_BLOCK_CHILDREN,qe as MAX_BLOCK_DEPTH,Fe as MAX_BLOCK_NODES,He as MAX_BLOCK_TEXT_LEN,Ke as MAX_FORM_FIELDS,Ue as MAX_FORM_SELECT_OPTIONS,V as SNAPSHOT_STORAGE_KEY_PREFIX,Y as armOfResult,Q as attachMicroSignalDetectors,B as baselineResultFor,H as baselineSlots,Ye as containsFormBlock,q as deriveSessionSegment,j as detectDeviceClass,F as detectTimeOfDay,K as detectTrafficSource,Z as grantConsent,be as init,_ as isDoNotTrackEnabled,w as locatorFromElement,W as readSnapshot,U as referrerDomainFromReferer,X as renderPrePaintScript,M as sanitizePageUrl,b as sessionCookieName,z as toWireSlot,J as writeSnapshot};
1
+ import{a as w}from"./chunk-WKXD7KI3.mjs";import{a as v,g as A}from"./chunk-Z6ILOYBD.mjs";import{A as qe,B as ze,C as Be,D as He,E as Ye,I as Q,J as x,K as _,L as Z,M as O,a as V,b as W,c as J,d as X,g as we,h as Te,i as ve,j as Ae,k as Ne,l as xe,m as _e,n as Oe,o as Re,p as Me,q as De,r as Pe,s as ke,t as Ge,u as $e,v as Le,w as je,x as Ke,y as Ue,z as Fe}from"./chunk-HY23LTUY.mjs";import{a as N,b as C,c as b,j,k as K,l as U,o as F,p as q,r as z,s as B,t as H,u as Y}from"./chunk-2NVSFI4V.mjs";import{a as y,b as E}from"./chunk-TMCGHANO.mjs";var R="_snt_graph_edges",ee={pricing:["features","faq"],features:["pricing"],faq:["pricing"],social_proof:["cta"],cta:["social_proof","hero","trust"],hero:["cta"],comparison:["pricing"],trust:["cta"]};function te(e){var t;return(t=ee[e])!=null?t:[]}function ne(e,t){try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(n){return t}}function oe(e,t){try{localStorage.setItem(e,JSON.stringify(t))}catch(n){}}var re=new Set(["pricing","hero","social_proof","cta","features","faq","comparison","trust","navigation","generic"]);function se(e){return re.has(e)?e:"generic"}function M(e){try{let t=new URL(e);return`${t.origin}${t.pathname}`}catch(t){return"/"}}function ae(e,t,n){let a=`${e}:${t}:${n.join(",")}`,c=5381;for(let i=0;i<a.length;i++)c=(c<<5)+c+a.charCodeAt(i)&4294967295;return(c>>>0).toString(16).padStart(8,"0")}function D(e){let t=new Map,n=new Map,a=`_snt_graph_nodes${N(e==null?void 0:e.apiKey)}`,c=()=>{typeof window!="undefined"&&oe(a,[...t.values()])};if(typeof window!="undefined"){let i=ne(a,[]);for(let o of i)t.set(o.componentId,o);try{localStorage.removeItem(R)}catch(o){}}return{addPageNode(i){t.set(i.componentId,i),c()},addStructuralEdge(i){let o=`${i.fromComponentId}->${i.toComponentId}`;n.set(o,i)},syncOnce(){var o,m;if(!(e!=null&&e.syncUrl)||typeof window=="undefined")return;let i=[...t.values()];if(i.length!==0)try{let u=new Map;for(let r of i){let p=(o=u.get(r.semanticType))!=null?o:[];p.push(r),u.set(r.semanticType,p)}let s=[],d=new Set;for(let r of i)for(let p of te(r.semanticType)){let l=(m=u.get(p))!=null?m:[];for(let h of l){if(h.componentId===r.componentId)continue;let S=`semantic:${r.componentId}->${h.componentId}`;d.has(S)||(d.add(S),s.push({fromComponentId:r.componentId,toComponentId:h.componentId,type:"semantic",weight:.4,confidence:.9}))}}let f=new Set(i.map(r=>r.componentId));for(let r of n.values()){if(!f.has(r.fromComponentId)||!f.has(r.toComponentId))continue;let p=`structural:${r.fromComponentId}->${r.toComponentId}`;d.has(p)||(d.add(p),s.push({fromComponentId:r.fromComponentId,toComponentId:r.toComponentId,type:"structural",weight:r.weight,confidence:1}))}let g=E(y(y({pageUrl:M(window.location.href)},e.sessionId?{sessionId:e.sessionId}:{}),e.projectId?{projectId:e.projectId}:{}),{nodes:i.map(r=>{let p=se(r.semanticType);return{componentId:r.componentId,semanticType:p,answers:r.answers,contentHash:ae(r.componentId,p,r.answers),prominenceScore:r.prominenceScore,depthInPage:r.depth}}),edges:s});fetch(e.syncUrl,{method:"POST",keepalive:!0,headers:y({"Content-Type":"application/json"},e.apiKey?{Authorization:`Bearer ${e.apiKey}`}:{}),body:JSON.stringify(g)}).catch(()=>{})}catch(u){}},snapshot(){return{pageNodes:[...t.values()],capturedAt:Date.now()}},destroy(){if(typeof window!="undefined")try{localStorage.removeItem(a),localStorage.removeItem(R)}catch(i){}}}}var ie=new Set(["SECTION","ARTICLE","MAIN","DIV","ASIDE"]),ce="h1, h2, h3",de="[data-sentient-id], section[aria-label], article[aria-label], main[aria-label], aside[aria-label]",P=30,pe=1500,ue={scan:async()=>({nodes:[],edges:[],scannedAt:0}),observe:()=>{},getProminenceScore:()=>0,destroy:()=>{}};function k(e,t,n){return n<=t?0:Math.max(0,Math.min(1,(e-t)/(n-t)))}function le(e){var t,n,a;try{let c=e;for(let i of Object.keys(c)){if(!i.startsWith("__reactFiber")&&!i.startsWith("__reactInternalInstance"))continue;let o=c[i],m=(a=(t=o==null?void 0:o.type)==null?void 0:t.displayName)!=null?a:(n=o==null?void 0:o.type)==null?void 0:n.name;if(m&&m.length>1)return m}}catch(c){}}function me(e){let t={};for(let n of Array.from(e.attributes))n.name.startsWith("data-")&&(t[n.name]=n.value);return t}var G=new Set(v);function fe(e){let t=e.getAttribute("data-sentient-type");if(t&&G.has(t))return t;let n=e.getAttribute("role");return n&&G.has(n)?n:A(e)}function ge(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n)&4294967295;return(t>>>0).toString(16).padStart(8,"0")}function he(e){let t=[],n=e;for(;n;){let a=n.parentElement;if(!a){t.push(n.tagName.toLowerCase());break}let c=Array.prototype.indexOf.call(a.children,n);t.push(`${n.tagName.toLowerCase()}[${c}]`),n=a}return t.reverse().join("/")}function Se(e){var n;let t=(n=e.getAttribute("data-sentient-id"))!=null?n:e.getAttribute("id");return t||`${e.tagName.toLowerCase()}-${ge(he(e))}`}function ye(e){let t=0,n=e.parentElement;for(;n;)t++,n=n.parentElement;return t}function T(e,t){var a,c,i,o;let n=e.querySelector(ce);return{componentId:Se(e),semanticType:fe(e),ariaLabel:(a=e.getAttribute("aria-label"))!=null?a:void 0,headingText:(i=(c=n==null?void 0:n.textContent)==null?void 0:c.trim())!=null?i:void 0,isAboveFold:e.getBoundingClientRect().top<window.innerHeight,prominenceScore:t(e),depth:ye(e),reactComponentName:le(e),dataAttributes:me(e),locator:(o=w(e,e.ownerDocument))!=null?o:void 0}}function $(e){var i;let t=[],n=new Set,a="__root__",c=new Map;for(let[o,m]of e){let u=o.parentElement,s=a;for(;u;){if(e.has(u)){s=e.get(u);let f=e.get(o),g=`${s}->${f}`;!n.has(g)&&s!==f&&(n.add(g),t.push({fromComponentId:s,toComponentId:f,weight:.6}));break}u=u.parentElement}let d=(i=c.get(s))!=null?i:[];d.push(o),c.set(s,d)}for(let o of c.values()){if(o.length<2)continue;let m=o.length>P?o.slice(0,P):o;for(let u=0;u<m.length;u++)for(let s=u+1;s<m.length;s++){if(t.length>=pe)return t;let d=e.get(m[u]),f=e.get(m[s]);if(d===f)continue;let g=`${d}->${f}::sib`,r=`${f}->${d}::sib`;n.has(g)||(n.add(g),t.push({fromComponentId:d,toComponentId:f,weight:.3})),n.has(r)||(n.add(r),t.push({fromComponentId:f,toComponentId:d,weight:.3}))}}return t}function Ee(e){let t=[],n=new Set,a=new Map;return document.querySelectorAll("[data-sentient-id]").forEach(o=>{if(o instanceof Element&&!n.has(o)){n.add(o);let m=T(o,e);t.push(m),a.set(o,m.componentId)}}),document.querySelectorAll("section, article, main, aside").forEach(o=>{if(!(o instanceof Element)||n.has(o))return;let m=o.hasAttribute("aria-label"),u=o.hasAttribute("data-sentient-id");if(!m&&!u)return;n.add(o);let s=T(o,e);t.push(s),a.set(o,s.componentId)}),{nodes:t,edges:$(a),elementToId:a}}function L(){if(typeof window=="undefined")return ue;let e=null,t=0,n=null,a=new Map,c=u=>{try{let s=window.getComputedStyle(u),d=parseFloat(s.fontSize)||12,f=parseFloat(s.zIndex)||0,g=u.getBoundingClientRect(),r=Math.max(g.top,0),p=window.innerHeight||1,l=1/(r/p+1),h=k(d,12,48)*.4+l*.4+k(f,0,100)*.2;return Math.max(0,Math.min(1,h))}catch(s){return .5}};return{scan:()=>new Promise(u=>{let s=()=>{let{nodes:d,edges:f,elementToId:g}=Ee(c);a.clear();for(let[r,p]of g)a.set(r,p);u({nodes:d,edges:f,scannedAt:Date.now()})};try{typeof requestIdleCallback=="function"?t=requestIdleCallback(s,{timeout:100}):s()}catch(d){s()}}),observe:u=>{n=u;try{e=new MutationObserver(s=>{let d=[],f=new Set;for(let r of s)r.type==="childList"&&r.addedNodes.forEach(p=>{if(!(p instanceof Element))return;let l=[];ie.has(p.tagName)&&(p.hasAttribute("data-sentient-id")||p.hasAttribute("aria-label"))&&l.push(p);try{p.querySelectorAll(de).forEach(h=>l.push(h))}catch(h){}for(let h of l){if(a.has(h))continue;let S=T(h,c);d.push(S),f.add(S.componentId),a.set(h,S.componentId)}});if(d.length===0||!n)return;for(let r of[...a.keys()])r.isConnected||a.delete(r);let g=$(a).filter(r=>f.has(r.fromComponentId)||f.has(r.toComponentId));n({nodes:d,edges:g,addedAt:Date.now()})}),e.observe(document.body,{childList:!0,subtree:!0})}catch(s){}},getProminenceScore:c,destroy:()=>{if(e&&(e.disconnect(),e=null),t&&typeof cancelIdleCallback=="function")try{cancelIdleCallback(t)}catch(u){}t=0,n=null,a.clear()}}}var Ie="https://api.sentient-ui.com/v1/events";function Ce(e){var n;let t=a=>{try{let c=document.cookie.match(new RegExp(`(?:^|; )${a}=([^;]*)`));return c?decodeURIComponent(c[1]):void 0}catch(c){return}};return(n=e?t(b(e)):void 0)!=null?n:t(C)}var I=new Map;function be(e){var r;let t=O(e),n=e.respectDoNotTrack!==!1&&_(),a=e.consent===!1||n,c=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_"),i=e.localMode===!0||!c;if(!e.graph||i||typeof window=="undefined")return t;if(a)return n||x(e.apiKey,p=>be(p)),t;let o=I.get(e.apiKey);if(o)try{o()}catch(p){}let m=L(),u=(r=e.ingestUrl)!=null?r:Ie,s=D({syncUrl:u.replace(/\/events\/?$/,"/graph/sync"),apiKey:e.apiKey,projectId:e.apiKey,sessionId:Ce(e.apiKey)});m.scan().then(p=>{for(let l of p.nodes)s.addPageNode({id:l.componentId,componentId:l.componentId,semanticType:l.semanticType,answers:e.captureDomText&&l.headingText?[l.headingText]:[],prominenceScore:l.prominenceScore,depth:l.depth});for(let l of p.edges)s.addStructuralEdge(l);s.syncOnce()});let d=null,f=()=>{d!==null&&clearTimeout(d),d=setTimeout(()=>{d=null,s.syncOnce()},500)};m.observe(p=>{for(let l of p.nodes)s.addPageNode({id:l.componentId,componentId:l.componentId,semanticType:l.semanticType,answers:e.captureDomText&&l.headingText?[l.headingText]:[],prominenceScore:l.prominenceScore,depth:l.depth});for(let l of p.edges)s.addStructuralEdge(l);f()});let g=()=>{d!==null&&(clearTimeout(d),d=null),m.destroy(),s.destroy(),I.get(e.apiKey)===g&&I.delete(e.apiKey)};return I.set(e.apiKey,g),E(y({},t),{getGraph:()=>s.snapshot(),dispose:()=>{g(),t.dispose()},destroy:()=>{g(),t.destroy()}})}export{Te as BLOCK_ALIGNS,_e as BLOCK_EMPHASES,Me as BLOCK_FITS,we as BLOCK_GAPS,De as BLOCK_GRID_COLUMNS,Pe as BLOCK_HEADING_LEVELS,ve as BLOCK_JUSTIFIES,$e as BLOCK_MAX_WIDTHS,Ge as BLOCK_PADS,Re as BLOCK_RATIOS,Ae as BLOCK_SIZES,ke as BLOCK_SURFACES,Oe as BLOCK_TEXT_ALIGNS,xe as BLOCK_TONES,Ne as BLOCK_WEIGHTS,Le as FORM_FIELD_KINDS,je as FORM_INPUT_TYPES,C as LEGACY_SESSION_COOKIE_NAME,Be as MAX_BLOCK_ARMS,ze as MAX_BLOCK_CHILDREN,qe as MAX_BLOCK_DEPTH,Fe as MAX_BLOCK_NODES,He as MAX_BLOCK_TEXT_LEN,Ke as MAX_FORM_FIELDS,Ue as MAX_FORM_SELECT_OPTIONS,V as SNAPSHOT_STORAGE_KEY_PREFIX,Y as armOfResult,Q as attachMicroSignalDetectors,B as baselineResultFor,H as baselineSlots,Ye as containsFormBlock,q as deriveSessionSegment,j as detectDeviceClass,F as detectTimeOfDay,K as detectTrafficSource,Z as grantConsent,be as init,_ as isDoNotTrackEnabled,w as locatorFromElement,W as readSnapshot,U as referrerDomainFromReferer,X as renderPrePaintScript,M as sanitizePageUrl,b as sessionCookieName,z as toWireSlot,J as writeSnapshot};
2
2
  //# sourceMappingURL=index-graph.mjs.map
@@ -1,4 +1,4 @@
1
- import { d as DecideOutcome } from './index-qAywhZRg.cjs';
1
+ import { d as DecideOutcome } from './index-B0PkJoeB.cjs';
2
2
  import { a2 as SlotDeclInput } from './session-meta-CY_Luh5i.cjs';
3
3
  import '@sentientui/policy';
4
4
 
@@ -1,4 +1,4 @@
1
- import { d as DecideOutcome } from './index-C6tOKQ_H.js';
1
+ import { d as DecideOutcome } from './index-BIdUwF-v.js';
2
2
  import { a2 as SlotDeclInput } from './session-meta-CY_Luh5i.js';
3
3
  import '@sentientui/policy';
4
4
 
package/dist/index.d.cts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { A as AGENT_INTENTS, a as AgentIntent, B as BLOCK_ALIGNS, b as BLOCK_EMPHASES, c as BLOCK_FITS, d as BLOCK_GAPS, e as BLOCK_GRID_COLUMNS, f as BLOCK_HEADING_LEVELS, g as BLOCK_JUSTIFIES, h as BLOCK_MAX_WIDTHS, i as BLOCK_PADS, j as BLOCK_RATIOS, k as BLOCK_SIZES, l as BLOCK_SURFACES, m as BLOCK_TEXT_ALIGNS, n as BLOCK_TONES, o as BLOCK_WEIGHTS, p as BadgeBlock, q as BlockAlign, r as BlockEmphasis, s as BlockFit, t as BlockGap, u as BlockJustify, v as BlockMaxWidth, w as BlockNode, x as BlockPad, y as BlockRatio, z as BlockSize, C as BlockSurface, D as BlockTextAlign, E as BlockTone, F as BlockWeight, G as ButtonBlock, H as CLICK_ID_KEYS, I as CompoundLocator, J as DecisionSnapshot, K as DividerBlock, L as FORM_FIELD_KINDS, M as FORM_INPUT_TYPES, N as FormBlock, O as FormField, P as GridBlock, Q as HeadingBlock, R as ImageBlock, S as LinkBlock, T as MAX_BLOCK_ARMS, U as MAX_BLOCK_CHILDREN, V as MAX_BLOCK_DEPTH, W as MAX_BLOCK_NODES, X as MAX_BLOCK_TEXT_LEN, Y as MAX_FORM_FIELDS, Z as MAX_FORM_SELECT_OPTIONS, _ as SNAPSHOT_STORAGE_KEY_PREFIX, a0 as SitePalette, a1 as SlotConfigEntry, a2 as SlotDeclInput, a3 as SlotOps, a4 as SpacerBlock, a5 as StackBlock, a6 as TextBlock, a7 as agentIntent, a8 as agentUaList, a9 as armOfResult, aa as baselineResultFor, ab as baselineSlots, ad as classifiedAgents, ae as containsFormBlock, af as deriveSessionSegment, ag as detectDeviceClass, ah as detectTimeOfDay, ai as detectTrafficSource, aj as extractTrackedParams, ak as matchedAgentToken, al as readSnapshot, am as referrerDomainFromReferer, an as renderPrePaintScript, ao as toWireSlot, ap as uaTokenMatch, aq as writeSnapshot } from './session-meta-CY_Luh5i.cjs';
2
- export { A as AssignResult, a as Assignment, C as ComponentGoalOptions, c as ComponentWeightEntry, D as DecideInput, d as DecideOutcome, e as EventType, G as GoalDefinition, f as GoalOptions, h as GraphConfig, i as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, j as LOCAL_MODE_BANNER, M as MicroSignalEmitter, k as MicroSignalType, P as PROD_KEYLESS_ERROR, Q as QueueConfig, S as SectionMapEntry, m as SentientClient, n as SentientConfig, o as SentientEvent, p as SessionConfig, q as SessionManager, W as WeightEntry, _ as _registerConsentUpgradeInit, r as attachMicroSignalDetectors, s as grantConsent, t as init, u as isDoNotTrackEnabled, w as sessionCookieName } from './index-qAywhZRg.cjs';
2
+ export { A as AssignResult, a as Assignment, C as ComponentGoalOptions, c as ComponentWeightEntry, D as DecideInput, d as DecideOutcome, e as EventType, G as GoalDefinition, f as GoalOptions, h as GraphConfig, i as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, j as LOCAL_MODE_BANNER, M as MicroSignalEmitter, k as MicroSignalType, P as PROD_KEYLESS_ERROR, Q as QueueConfig, R as REVEAL_MS, m as RevealOptions, S as SectionMapEntry, n as SentientClient, o as SentientConfig, p as SentientEvent, q as SessionConfig, r as SessionManager, W as WeightEntry, _ as _registerConsentUpgradeInit, s as attachMicroSignalDetectors, t as grantConsent, u as init, v as isDoNotTrackEnabled, w as resetRevealStyles, x as reveal, z as sessionCookieName } from './index-B0PkJoeB.cjs';
3
3
  export { SlotResult } from '@sentientui/policy';
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { A as AGENT_INTENTS, a as AgentIntent, B as BLOCK_ALIGNS, b as BLOCK_EMPHASES, c as BLOCK_FITS, d as BLOCK_GAPS, e as BLOCK_GRID_COLUMNS, f as BLOCK_HEADING_LEVELS, g as BLOCK_JUSTIFIES, h as BLOCK_MAX_WIDTHS, i as BLOCK_PADS, j as BLOCK_RATIOS, k as BLOCK_SIZES, l as BLOCK_SURFACES, m as BLOCK_TEXT_ALIGNS, n as BLOCK_TONES, o as BLOCK_WEIGHTS, p as BadgeBlock, q as BlockAlign, r as BlockEmphasis, s as BlockFit, t as BlockGap, u as BlockJustify, v as BlockMaxWidth, w as BlockNode, x as BlockPad, y as BlockRatio, z as BlockSize, C as BlockSurface, D as BlockTextAlign, E as BlockTone, F as BlockWeight, G as ButtonBlock, H as CLICK_ID_KEYS, I as CompoundLocator, J as DecisionSnapshot, K as DividerBlock, L as FORM_FIELD_KINDS, M as FORM_INPUT_TYPES, N as FormBlock, O as FormField, P as GridBlock, Q as HeadingBlock, R as ImageBlock, S as LinkBlock, T as MAX_BLOCK_ARMS, U as MAX_BLOCK_CHILDREN, V as MAX_BLOCK_DEPTH, W as MAX_BLOCK_NODES, X as MAX_BLOCK_TEXT_LEN, Y as MAX_FORM_FIELDS, Z as MAX_FORM_SELECT_OPTIONS, _ as SNAPSHOT_STORAGE_KEY_PREFIX, a0 as SitePalette, a1 as SlotConfigEntry, a2 as SlotDeclInput, a3 as SlotOps, a4 as SpacerBlock, a5 as StackBlock, a6 as TextBlock, a7 as agentIntent, a8 as agentUaList, a9 as armOfResult, aa as baselineResultFor, ab as baselineSlots, ad as classifiedAgents, ae as containsFormBlock, af as deriveSessionSegment, ag as detectDeviceClass, ah as detectTimeOfDay, ai as detectTrafficSource, aj as extractTrackedParams, ak as matchedAgentToken, al as readSnapshot, am as referrerDomainFromReferer, an as renderPrePaintScript, ao as toWireSlot, ap as uaTokenMatch, aq as writeSnapshot } from './session-meta-CY_Luh5i.js';
2
- export { A as AssignResult, a as Assignment, C as ComponentGoalOptions, c as ComponentWeightEntry, D as DecideInput, d as DecideOutcome, e as EventType, G as GoalDefinition, f as GoalOptions, h as GraphConfig, i as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, j as LOCAL_MODE_BANNER, M as MicroSignalEmitter, k as MicroSignalType, P as PROD_KEYLESS_ERROR, Q as QueueConfig, S as SectionMapEntry, m as SentientClient, n as SentientConfig, o as SentientEvent, p as SessionConfig, q as SessionManager, W as WeightEntry, _ as _registerConsentUpgradeInit, r as attachMicroSignalDetectors, s as grantConsent, t as init, u as isDoNotTrackEnabled, w as sessionCookieName } from './index-C6tOKQ_H.js';
2
+ export { A as AssignResult, a as Assignment, C as ComponentGoalOptions, c as ComponentWeightEntry, D as DecideInput, d as DecideOutcome, e as EventType, G as GoalDefinition, f as GoalOptions, h as GraphConfig, i as GraphSnapshot, L as LEGACY_SESSION_COOKIE_NAME, j as LOCAL_MODE_BANNER, M as MicroSignalEmitter, k as MicroSignalType, P as PROD_KEYLESS_ERROR, Q as QueueConfig, R as REVEAL_MS, m as RevealOptions, S as SectionMapEntry, n as SentientClient, o as SentientConfig, p as SentientEvent, q as SessionConfig, r as SessionManager, W as WeightEntry, _ as _registerConsentUpgradeInit, s as attachMicroSignalDetectors, t as grantConsent, u as init, v as isDoNotTrackEnabled, w as resetRevealStyles, x as reveal, z as sessionCookieName } from './index-BIdUwF-v.js';
3
3
  export { SlotResult } from '@sentientui/policy';
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- "use strict";var Bt=Object.create;var ge=Object.defineProperty,Pt=Object.defineProperties,Dt=Object.getOwnPropertyDescriptor,Lt=Object.getOwnPropertyDescriptors,Mt=Object.getOwnPropertyNames,lt=Object.getOwnPropertySymbols,Nt=Object.getPrototypeOf,dt=Object.prototype.hasOwnProperty,Kt=Object.prototype.propertyIsEnumerable;var ct=(e,t,n)=>t in e?ge(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,w=(e,t)=>{for(var n in t||(t={}))dt.call(t,n)&&ct(e,n,t[n]);if(lt)for(var n of lt(t))Kt.call(t,n)&&ct(e,n,t[n]);return e},oe=(e,t)=>Pt(e,Lt(t));var Gt=(e,t)=>{for(var n in t)ge(e,n,{get:t[n],enumerable:!0})},ut=(e,t,n,d)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of Mt(t))!dt.call(e,u)&&u!==n&&ge(e,u,{get:()=>t[u],enumerable:!(d=Dt(t,u))||d.enumerable});return e};var Ut=(e,t,n)=>(n=e!=null?Bt(Nt(e)):{},ut(t||!e||!e.__esModule?ge(n,"default",{value:e,enumerable:!0}):n,e)),Ft=e=>ut(ge({},"__esModule",{value:!0}),e);var Fn={};Gt(Fn,{AGENT_INTENTS:()=>Be,BLOCK_ALIGNS:()=>cn,BLOCK_EMPHASES:()=>fn,BLOCK_FITS:()=>Sn,BLOCK_GAPS:()=>ln,BLOCK_GRID_COLUMNS:()=>hn,BLOCK_HEADING_LEVELS:()=>vn,BLOCK_JUSTIFIES:()=>dn,BLOCK_MAX_WIDTHS:()=>wn,BLOCK_PADS:()=>xn,BLOCK_RATIOS:()=>yn,BLOCK_SIZES:()=>un,BLOCK_SURFACES:()=>kn,BLOCK_TEXT_ALIGNS:()=>mn,BLOCK_TONES:()=>gn,BLOCK_WEIGHTS:()=>pn,CLICK_ID_KEYS:()=>je,FORM_FIELD_KINDS:()=>bn,FORM_INPUT_TYPES:()=>En,LEGACY_SESSION_COOKIE_NAME:()=>Ge,LOCAL_MODE_BANNER:()=>ze,MAX_BLOCK_ARMS:()=>Rn,MAX_BLOCK_CHILDREN:()=>On,MAX_BLOCK_DEPTH:()=>An,MAX_BLOCK_NODES:()=>_n,MAX_BLOCK_TEXT_LEN:()=>Tn,MAX_FORM_FIELDS:()=>In,MAX_FORM_SELECT_OPTIONS:()=>Cn,PROD_KEYLESS_ERROR:()=>Ne,SNAPSHOT_STORAGE_KEY_PREFIX:()=>ne,_registerConsentUpgradeInit:()=>Pn,agentIntent:()=>ht,agentUaList:()=>me,armOfResult:()=>De,attachMicroSignalDetectors:()=>Ct,baselineResultFor:()=>ae,baselineSlots:()=>xt,classifiedAgents:()=>vt,containsFormBlock:()=>It,deriveSessionSegment:()=>kt,detectDeviceClass:()=>Se,detectTimeOfDay:()=>ke,detectTrafficSource:()=>he,extractTrackedParams:()=>Pe,grantConsent:()=>Gn,init:()=>Tt,isDoNotTrackEnabled:()=>Xe,matchedAgentToken:()=>We,readSnapshot:()=>le,referrerDomainFromReferer:()=>ve,renderPrePaintScript:()=>wt,sessionCookieName:()=>Ce,toWireSlot:()=>xe,uaTokenMatch:()=>ye,writeSnapshot:()=>ce});module.exports=Ft(Fn);function Ie(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function fe(e){return e?`_${e.slice(0,12)}`:""}var Ge="_snt_uid";function Ce(e){return`${Ge}${fe(e)}`}var $t="_snt_uid",Wt=365,_e="_snt_uid";function jt(){return Ie()}function pt(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function zt(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(d){}}function Ue(e){try{return localStorage.getItem(e)}catch(t){return null}}function gt(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function ft(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function Ht(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Qt(e){try{sessionStorage.removeItem(e)}catch(t){}}function Jt(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=strict; path=/`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function Xt(e){try{localStorage.removeItem(e)}catch(t){}}function Vt(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var Yt={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function Ae(e){var E,P,D,I,U,$,A;if(typeof window=="undefined")return Yt;let t=fe(e==null?void 0:e.apiKey),n=(E=e==null?void 0:e.cookieName)!=null?E:Ce(e==null?void 0:e.apiKey),d=`${_e}${t}`,u=`${_e}_tomb${t}`,c=((P=e==null?void 0:e.cookieTTLDays)!=null?P:Wt)*24*60*60,a=R=>R&&R.length>0?R:null,p=()=>{var R,O;return t&&!(e!=null&&e.cookieName)&&Ue(u)===null?(O=(R=a(pt($t)))!=null?R:a(Ue(_e)))!=null?O:a(ft(_e)):null},s=(A=($=(U=(I=(D=a(pt(n)))!=null?D:a(Ue(d)))!=null?I:a(ft(d)))!=null?U:p())!=null?$:a(e==null?void 0:e.ssrSessionId))!=null?A:jt();zt(n,s,c);let r=gt(d,s),o=Jt(n),m=r?!1:Ht(d,s),k=!r&&!o&&!m;return{getSessionId:()=>s,isEphemeral:()=>k,destroy:()=>{s=null,Vt(n),Xt(d),Qt(d),t&&!(e!=null&&e.cookieName)&&gt(u,"1")}}}function Y(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function se(e){if(e.ok===!0)return"delivered";let{status:t}=e;return typeof t!="number"?"retry":t>=200&&t<300?"delivered":t>=400&&t<500&&t!==429?"dropped":"retry"}function Oe(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let d=JSON.parse(n);return Array.isArray(d)?(localStorage.removeItem(e),d.slice(-t)):[]}catch(n){return[]}}function q(e,t,n){try{let d=(()=>{try{let i=localStorage.getItem(n);if(!i)return[];let c=JSON.parse(i);return Array.isArray(c)?c:[]}catch(i){return[]}})(),u=new Map;for(let i of d)u.set(i.id,i);for(let i of e)u.set(i.id,i);localStorage.setItem(n,JSON.stringify([...u.values()].slice(-t)))}catch(d){}}function Re(e,t){try{let n=localStorage.getItem(t);if(!n)return;let d=JSON.parse(n);if(!Array.isArray(d))return;let u=new Set(e),i=d.filter(c=>!u.has(c.id));if(i.length===d.length)return;i.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(i))}catch(n){}}var qt=500,Zt=56*1024;function Fe(e){return`_snt_retry_${e.slice(0,12)}`}var en={push:()=>{},flush:()=>{},destroy:()=>{}};function mt(e){var Q,Z,de;if(typeof window=="undefined")return en;let t=(Q=e.flushIntervalMs)!=null?Q:5e3,n=(Z=e.maxBatchSize)!=null?Z:20,d=(de=e.maxRetrySize)!=null?de:100,u=e.ingestUrl,i=e.apiKey,c=Fe(i),a=[],p=new Set,s=[],r=S=>{for(let v of S)o.delete(v),!p.has(v)&&(p.add(v),s.push(v));for(;s.length>qt;){let v=s.shift();v&&p.delete(v)}Re(S,c)},o=new Set,m=()=>{for(;a.length>d;){let S=a.shift();S&&o.delete(S.id)}},k=S=>{p.has(S.id)||o.has(S.id)||(o.add(S.id),a.push(S),m())},E=S=>{for(let v of S)p.has(v.id)||(o.add(v.id),a.push(v));m()},P=Oe(c,d);for(let S of P)k(S);let D=0,I=0,U=(S,v=!0)=>{if(S.length===0)return;let J=JSON.stringify(S),N=S.map(K=>K.id),z;try{z=fetch(u,{method:"POST",keepalive:!0,body:J,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})}catch(K){q(S,d,c),E(S),I++,D=Date.now()+Y(I);return}let be=K=>{if(se(K)!=="retry"){if(!K.ok&&v){let ee=S.filter(F=>F.eventType!=="pageview");if(ee.length>0&&ee.length<S.length){r(S.filter(F=>F.eventType==="pageview").map(F=>F.id)),U(ee,!1);return}}r(N),I=0,D=0;return}q(S,d,c),E(S),I++,D=Date.now()+Y(I)};z instanceof Promise?z.then(be).catch(()=>{q(S,d,c),E(S),I++,D=Date.now()+Y(I)}):be(z)},$=typeof TextEncoder!="undefined"?new TextEncoder:null,A=S=>$?$.encode(S).length:S.length,R=S=>{let v=[],J=2;for(let N of S){let z=A(JSON.stringify(N))+1;if(v.length>0&&J+z>Zt||v.length>=n)break;v.push(N),J+=z}return v},O=()=>{try{if(Date.now()<D)return;for(;a.length>0&&!(Date.now()<D);){let S=a.filter(J=>!p.has(J.id));if(a.length=0,S.length===0)break;let v=R(S);if(v.length===0)break;v.length<S.length&&a.push(...S.slice(v.length)),U(v)}}catch(S){}},f=!0,T=null;T=setInterval(()=>{f&&O()},t);let W=()=>{document.visibilityState==="hidden"&&O()},j=()=>{O()};return document.addEventListener("visibilitychange",W),window.addEventListener("pagehide",j),{push(S){k(S),a.length>=n&&O()},flush:O,destroy(){f=!1,T!==null&&(clearInterval(T),T=null),document.removeEventListener("visibilitychange",W),window.removeEventListener("pagehide",j),O()}}}var tn=200;function $e(e){return`_snt_goal_retry_${e.slice(0,12)}`}var nn={send:()=>{},flush:()=>{},destroy:()=>{}};function yt(e){var A,R,O;if(typeof window=="undefined")return nn;let t=(A=e.flushIntervalMs)!=null?A:5e3,n=(R=e.maxRetrySize)!=null?R:100,d=(O=e.maxPerFlush)!=null?O:5,u=$e(e.apiKey),i=[],c=new Set,a=new Set,p=[],s=0,r=0,o=!1,m=f=>{for(c.delete(f.id),a.has(f.id)||(a.add(f.id),p.push(f.id));p.length>tn;){let T=p.shift();T&&a.delete(T)}Re([f.id],u)},k=f=>{q([f],n,u),!a.has(f.id)&&!c.has(f.id)&&(c.add(f.id),i.push(f)),Date.now()>=s&&(r++,s=Date.now()+Y(r))},E=f=>{let T;try{T=fetch(e.url,{method:"POST",keepalive:!0,body:f.body,headers:e.headers})}catch(j){k(f);return}let W=j=>{var Z;let Q=se(j);if(Q==="retry"){k(f);return}Q==="dropped"&&((Z=e.onDrop)==null||Z.call(e,f,j.status)),m(f),r=0,s=0};T instanceof Promise?T.then(W).catch(()=>k(f)):W(T)},P=()=>{try{if(o||Date.now()<s)return;let f=0;for(;i.length>0&&f<d&&!(Date.now()<s);){let T=i.shift();c.delete(T.id),!a.has(T.id)&&(f++,E(T))}}catch(f){}},D=Oe(u,n);for(let f of D)c.has(f.id)||(c.add(f.id),i.push(f));D.length>0&&q(D,n,u);let I=setInterval(P,t),U=()=>{document.visibilityState==="hidden"&&P()},$=()=>P();return document.addEventListener("visibilitychange",U),window.addEventListener("pagehide",$),{send(f){if(!o&&!(a.has(f.id)||c.has(f.id))){if(Date.now()<s){q([f],n,u),c.add(f.id),i.push(f);return}E(f)}},flush:P,destroy(){clearInterval(I),document.removeEventListener("visibilitychange",U),window.removeEventListener("pagehide",$),P(),o=!0}}}var rn=1800*1e3;function Te(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function St(e=rn,t){let n=new Map,d=`_snt_asgn${fe(t)}_`,u=(s,r)=>`${d}${encodeURIComponent(s)}:${encodeURIComponent(r)}`,i=s=>{let r=s.slice(d.length),o=r.indexOf(":");if(o<0)return null;try{return{componentId:decodeURIComponent(r.slice(0,o)),segment:decodeURIComponent(r.slice(o+1))}}catch(m){return null}},c=()=>{try{let s=[];for(let r=0;r<localStorage.length;r++){let o=localStorage.key(r);o!=null&&o.startsWith(d)&&s.push(o)}return s}catch(s){return[]}},a=s=>s.assignedAt+(s.ttlMs&&s.ttlMs>0?s.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let s of c())try{let r=localStorage.getItem(s);if(!r)continue;let o=JSON.parse(r);if(a(o)){localStorage.removeItem(s);continue}let m=i(s);if(!m)continue;n.set(Te(m.componentId,m.segment),o)}catch(r){}})(),{get(s,r){let o=n.get(Te(s,r));return o?a(o)?(n.delete(Te(s,r)),null):o:null},set(s,r,o){let m=Te(s,r);n.set(m,o);try{localStorage.setItem(u(s,r),JSON.stringify(o))}catch(k){}},clear(){n.clear();for(let s of c())try{localStorage.removeItem(s)}catch(r){}}}}var me=["GPTBot","ChatGPT-User","OAI-SearchBot","ClaudeBot","Claude-User","Claude-SearchBot","PerplexityBot","Perplexity-User","Google-Extended","Applebot-Extended","Meta-ExternalAgent","Bytespider","CCBot","Amazonbot","cohere-ai","Diffbot"];function ye(e){return We(e)!==null}function We(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=me.find(d=>t.includes(d.toLowerCase())))!=null?n:null}var Be={GPTBot:"training","ChatGPT-User":"user","OAI-SearchBot":"search",ClaudeBot:"training","Claude-User":"user","Claude-SearchBot":"search",PerplexityBot:"search","Perplexity-User":"user","Google-Extended":"training","Applebot-Extended":"training","Meta-ExternalAgent":"training",Bytespider:"training",CCBot:"training",Amazonbot:"other","cohere-ai":"training",Diffbot:"other"};function ht(e){if(!e)return"other";let t=me.find(n=>n.toLowerCase()===e.toLowerCase());return t&&Be[t]||"other"}function vt(){var t;let e={user:[],search:[],training:[],other:[]};for(let n of me)e[(t=Be[n])!=null?t:"other"].push(n);return e}function Se(e){let t=e.toLowerCase();return/ipad|tablet|playbook|kindle|silk/.test(t)?"tablet":/mobi|iphone|ipod|android.*mobile|phone/.test(t)?"mobile":"desktop"}function he(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(u){}let d=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(d)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(d)?"social":"referral"}catch(n){return"direct"}}function ve(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var je=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Pe(e){let t={},n={};try{let d=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([u,i])=>{let c=Array.isArray(i)?i[0]:i;return c===void 0?[]:[[u,c]]});for(let[u,i]of d)u.startsWith("utm_")?u in t||(t[u]=i):je.includes(u)&&(u in n||(n[u]=i))}catch(d){}return{utmParams:t,clickIds:n}}function ke(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function kt(e){let t=on("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function on(e,t){var i,c,a,p,s,r,o,m;let n=(c=(i=t==null?void 0:t.userAgent)==null?void 0:i.trim())!=null?c:"",d=(p=(a=t==null?void 0:t.referer)==null?void 0:a.trim())!=null?p:"",u=(s=t==null?void 0:t.now)!=null?s:new Date;return{sessionId:e,ephemeral:!1,utmParams:(r=t==null?void 0:t.utmParams)!=null?r:{},clickIds:(o=t==null?void 0:t.clickIds)!=null?o:{},deviceClass:n?Se(n):"desktop",trafficSource:d?he(d,t==null?void 0:t.appOrigin):"direct",referrerDomain:ve(d),timeOfDay:ke(u),dayOfWeek:(m=["sun","mon","tue","wed","thu","fri","sat"][u.getDay()])!=null?m:"sun",automation:(t==null?void 0:t.webdriver)===!0||ye(n)}}var ie=require("@sentientui/policy");function xe(e){return w(w(w({id:e.id},e.arms?{arms:[...e.arms]}:{}),e.dims?{dims:Object.fromEntries(Object.entries(e.dims).map(([t,n])=>[t,[...n]]))}:{}),e.baseline!==void 0?{baseline:e.baseline}:{})}function ae(e){let t=xe(e);return(0,ie.slotResultFor)(t,(0,ie.slotBaselineArm)(t))}function xt(e){let t={};for(let n of e)t[n.id]=ae(n);return t}function De(e){return typeof e=="string"?e:(0,ie.canonicalArm)(e)}var ne="_snt_snap:",sn=["low","medium","high"];function le(e){try{let t=localStorage.getItem(ne+e);if(!t)return null;let n=JSON.parse(t);return!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!sn.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig))?null:n}catch(t){return null}}function ce(e,t){try{localStorage.setItem(ne+e,JSON.stringify(t))}catch(n){}}function wt(e){return"(function(){try{var r=localStorage.getItem("+JSON.stringify(ne+e).replace(/</g,"\\u003c")+');if(!r)return;var s=JSON.parse(r);if(!s||s.v!==1||typeof s.persona!=="string"||typeof s.band!=="string")return;var d=document.documentElement;if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",s.persona);d.setAttribute("data-sentient-confidence",s.band);}catch(e){}})();'}var Qe=require("@sentientui/policy");var Me=require("@sentientui/policy");var Ne="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",ze="[sentient] Local mode \u2014 decisions are simulated on-device and nothing is sent over the network. Add an API key to learn from real traffic.",bt=!1,Le=!1;function an(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function Et(e){var s;let t=Ae({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(s=t.getSessionId())!=null?s:"local",d=an(),u=import("@sentientui/core/local").then(r=>{let o=r;return o.LOCAL_ENGINE_AVAILABLE?(bt||(bt=!0,console.info(ze)),o):(Le||(Le=!0,console.error(Ne)),null)}).catch(()=>(Le||(Le=!0,console.error(Ne)),null)),i=null,c={low:.15,medium:.5,high:.85},a=(()=>{var o;if(e.initialPersona)return w({},e.initialPersona);let r=le(e.apiKey||"local");return r?{persona:r.persona,confidence:(o=c[r.band])!=null?o:.15}:null})();function p(r){let o=document.documentElement;o.dataset.sentientPersona===void 0&&(o.dataset.sentientPersona=r.persona,o.dataset.sentientConfidence=(0,Me.confidenceBand)(r.confidence))}return{isLocal:!0,async decide(r){var k,E,P;let o=await u;if(!o)return null;let m=o.createLocalEngine({sessionId:n,forcedPersona:d}).decide(r);return i=oe(w({},m),{layoutOrder:(E=(k=m.layoutOrder)!=null?k:i==null?void 0:i.layoutOrder)!=null?E:null,slots:w(w({},(P=i==null?void 0:i.slots)!=null?P:{}),m.slots)}),ce(e.apiKey||"local",{v:1,persona:i.persona,band:(0,Me.confidenceBand)(i.confidence),slots:i.slots,layoutOrder:i.layoutOrder,savedAt:Date.now()}),p(m),m},getSlotResult(r){var o,m,k;return(k=(m=i==null?void 0:i.slots[r])!=null?m:(o=e.initialSlots)==null?void 0:o[r])!=null?k:null},getSlotConfig(r){var o,m;return(m=(o=e.initialSlotConfig)==null?void 0:o[r])!=null?m:null},getSitePalette(){var r;return(r=e.initialPalette)!=null?r:null},reportSlots(){},getPersona(){let r=i!=null?i:a;return r?{persona:r.persona,confidence:r.confidence,band:(0,Me.confidenceBand)(r.confidence)}:null},async assign(r,o){var E;let m=await u;return!m||!o||o.length===0?o!=null&&o[0]?{variantId:o[0],assignmentTtlMs:0}:null:{variantId:(E=m.createLocalEngine({sessionId:n,forcedPersona:d}).decide({components:[{id:r,variantIds:o}]}).assignments[r])!=null?E:o[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>t.destroy()}}var ln=["none","sm","md","lg"],cn=["start","center","end","stretch"],dn=["start","center","end","between"],un=["sm","md","lg"],pn=["normal","medium","bold"],gn=["default","muted","accent"],fn=["primary","secondary","ghost"],mn=["left","center","right"],yn=["auto","square","landscape","wide"],Sn=["cover","contain"],hn=[2,3,4],vn=[2,3,4],kn=["default","raised"],xn=["none","sm","md","lg"],wn=["measure"],bn=["input","textarea","select"],En=["text","email","number","tel"],In=5,Cn=8,_n=64,An=5,On=12,Rn=4,Tn=500;function It(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="form"?!0:Array.isArray(t.children)?t.children.some(It):!1}function Ct(e,t,n,d){let u=[];{let a=!1,p=[],s=()=>{if(a)return;let r=Date.now();for(p.push(r);p.length>0&&r-p[0]>500;)p.shift();p.length>=3&&(a=!0,e("rage_click"))};t.addEventListener("click",s),u.push(()=>t.removeEventListener("click",s))}{let i=!1,c=a=>{if(i||!(a.target instanceof Node)||!t.contains(a.target)&&t!==a.target)return;i=!0;let p=typeof window!="undefined"?window.getSelection():null,s=p?p.toString().length:0;e("text_copy",{selectionLength:s})};document.addEventListener("copy",c),u.push(()=>document.removeEventListener("copy",c))}{let i=!1,c=!1,a=null,p=()=>{a!==null&&(clearTimeout(a),a=null)},s=()=>{i||!c||(p(),a=setTimeout(()=>{!i&&c&&(i=!0,e("scroll_hesitation"))},3e3))},r=()=>{p(),s()},o=k=>{for(let E of k)c=E.intersectionRatio>.3,c?s():p()},m=new IntersectionObserver(o,{threshold:[.3]});m.observe(t),window.addEventListener("scroll",r,{passive:!0}),u.push(()=>{m.disconnect(),window.removeEventListener("scroll",r),p()})}if((d==null?void 0:d.tabLoss)!==!1){let i=!1,c=n!=null?n:Date.now(),a=()=>{if(i||document.visibilityState!=="hidden")return;let p=Date.now()-c;p<15e3&&(i=!0,e("tab_loss",{timeOnPage:p}))};document.addEventListener("visibilitychange",a),u.push(()=>document.removeEventListener("visibilitychange",a))}return()=>{for(let i of u)i()}}function Bn(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var _t="https://api.sentient-ui.com/v1/events",G=new Map,At=null;function Pn(e,t){let n=G.get(e);n&&n.upgrade&&(n.reinit=t)}function Dn(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Ln=3;function He(){return Ie()}function Ke(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Mn(){let e=new WeakMap,t=new Map,n=!1,d=(a,p,s)=>{let r=a.get(p);return s===null?r?!0:(a.set(p,new Set),!1):r?r.has(s)?!0:(r.add(s),!1):(a.set(p,new Set([s])),!1)},u=typeof window!="undefined"&&"event"in window,i=()=>{if(!u)return;let a=window.event;return typeof Event=="function"&&a instanceof Event?a:void 0},c=()=>{if(u){Promise.resolve().then(()=>{n=!1,t.clear()});return}let a=!1,p=()=>{a||(a=!0,n=!1,t.clear())};if(setTimeout(p,0),typeof MessageChannel=="function"){let s=new MessageChannel;s.port1.onmessage=()=>{s.port1.close(),s.port2.close(),p()},s.port2.postMessage(0)}};return{firedBefore(a,p){let s=i();if(s){let o=e.get(s);return o||(o=new Map,e.set(s,o)),d(o,a,p)}let r=d(t,a,p);return!r&&!n&&(n=!0,c()),r}}}var Ot=new Set;function Nn(e,t,n){let d=typeof window=="undefined"?null:window.history;if(!d)return()=>{};let u=!1,i,c=()=>{if(u)return;let s=Ke();!s||s===i||(i=s,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${s}`))},a=[];for(let s of["pushState","replaceState"]){let r=d[s],o=function(...m){let k=r.apply(this,m);return c(),k};d[s]=o,a.push([s,r,o])}window.addEventListener("popstate",c);let p=Ke();return p&&Ot.has(`${t}:${p}`)?i=p:c(),()=>{if(!u){u=!0,window.removeEventListener("popstate",c);for(let[s,r,o]of a)d[s]===o&&(d[s]=r)}}}var we={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}};function Kn(){try{return Pe(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Rt(e){return e.replace(/\/events\/?$/,"")}function Xe(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(t=>t==="1"||t==="yes")}function Gn(e){var p;if(typeof window=="undefined")return;let t=e!=null?e:At;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=G.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:d,upgrade:u,reinit:i}=n;if(!u){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(d.respectDoNotTrack!==!1&&Xe())return;let c=(i!=null?i:Tt)(oe(w({},d),{consent:!0}));u(c);let a=(p=G.get(t))==null?void 0:p.dispose;G.set(t,{config:oe(w({},d),{consent:!0}),upgrade:null,dispose:a})}function Un(e){var s;let t=e.preConsentBehavior==="statistical_winner",n=Rt((s=e.ingestUrl)!=null?s:_t),d={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},u=new Map,i=new Map,c={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(r,o,m){if(!t)return Promise.resolve(null);let k=u.get(r);return k?Promise.resolve(k):Je(i,r,async()=>{try{let E=new URLSearchParams({componentId:r});for(let U of o!=null?o:[])E.append("variantIds[]",U);let P=await fetch(`${n}/winner?${E.toString()}`,{headers:d});if(!P.ok)return o!=null&&o[0]?{variantId:o[0],assignmentTtlMs:0}:null;let I={variantId:(await P.json()).variantId,assignmentTtlMs:0};return u.set(r,I),I}catch(E){return o!=null&&o[0]?{variantId:o[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}},a={track:r=>c.track(r),goal:((r,o,m,k)=>c.goal(r,o,m,k)),componentGoal:(r,o,m)=>c.componentGoal(r,o,m),identify:r=>c.identify(r),getAssignment:(r,o)=>c.getAssignment(r,o),assign:(r,o,m,k)=>c.assign(r,o,m,k),decide:r=>c.decide(r),getSlotResult:r=>c.getSlotResult(r),getSlotConfig:r=>c.getSlotConfig(r),getSitePalette:()=>c.getSitePalette(),reportSlots:(r,o)=>c.reportSlots(r,o),getPersona:()=>c.getPersona(),fetchWeights:()=>c.fetchWeights(),getGraph:()=>c.getGraph(),dispose:()=>c.dispose(),destroy:()=>c.destroy()};function p(r){c=r}return{proxy:a,setInner:p}}function Je(e,t,n){let d=e.get(t);if(d)return d;let u=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,u),u}function Tt(e){var Ve,Ye,qe,Ze,et,tt,nt,rt,ot,st;if(typeof window=="undefined")return we;At=e.apiKey||"local";let t=G.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(l){}let n=e.respectDoNotTrack!==!1&&Xe(),d=e.consent===!1||n,u=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!u&&e.localMode!==!1)return G.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),d?we:Et(e);if(d){if(!e.apiKey||!e.apiKey.startsWith("pk_"))return e.preConsentBehavior==="statistical_winner"&&console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),G.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): the client was initialized with an invalid apiKey (expected a pk_ public key) \u2014 consent cannot enable tracking."}),we;let{proxy:l,setInner:g}=Un(e);return G.set(e.apiKey,{config:e,upgrade:n?null:g}),l}if(!e.apiKey||!e.apiKey.startsWith("pk_"))return console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),we;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),we;let i=(Ve=e.ingestUrl)!=null?Ve:_t,c=Date.now(),a=Ae({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),p=St(void 0,e.apiKey),s=mt({ingestUrl:i,apiKey:e.apiKey}),r=Rt(i),o={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},m=new Set,k=yt({url:`${r}/goals`,apiKey:e.apiKey,headers:o,onDrop:(l,g)=>{if(!e.debug){if(m.has(g))return;m.add(g)}console.warn(`[sentient] goal dropped (HTTP ${g}) \u2014 this will not be retried. `+(g===400?"The session was not found: call init() and let the session upsert complete before firing goals.":g===401||g===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),l)}}),E=Se((Ye=navigator.userAgent)!=null?Ye:""),P=window.location.origin,D=he((qe=document.referrer)!=null?qe:"",P),I=(Ze=e.sessionSegment)!=null?Ze:`${E}:${D}`,U=new Map,$=new Map,A=new Map,R=new Map,O=null,f=null,T=new Set,W=new Set,j=new Map,Q=null,Z=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,de=new Set,S=l=>{for(let g of l)A.has(g.id)||A.set(g.id,ae(g))};if(e.initialSlots)for(let[l,g]of Object.entries(e.initialSlots))A.set(l,g);if(e.initialSlotConfig)for(let[l,g]of Object.entries(e.initialSlotConfig))R.set(l,g);e.initialPalette&&(O=e.initialPalette);let v=le(e.apiKey);if(v){for(let[l,g]of Object.entries(v.slots))A.has(l)||A.set(l,g);for(let[l,g]of Object.entries((et=v.slotConfig)!=null?et:{}))R.has(l)||R.set(l,g);!O&&v.palette&&(O=v.palette)}let J={low:.15,medium:.5,high:.85};if(e.initialPersona)f=w({},e.initialPersona);else{let l=document.documentElement.dataset;l.sentientPersona?f={persona:l.sentientPersona,confidence:(nt=J[(tt=l.sentientConfidence)!=null?tt:"low"])!=null?nt:.15}:v&&(f={persona:v.persona,confidence:(rt=J[v.band])!=null?rt:.15})}if(e.initialAssignments)for(let[l,g]of Object.entries(e.initialAssignments))p.set(l,I,{variantId:g,assignedAt:Date.now(),segment:I,confidence:1});let N=Promise.resolve(),z=a.getSessionId();if(z){let l=ve((ot=document.referrer)!=null?ot:""),{utmParams:g,clickIds:y}=Kn(),x=w(w(w(w({sessionId:z,deviceClass:E,trafficSource:D,referrerDomain:l,utmParams:g,clickIds:y,timeOfDay:ke(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:a.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||ye((st=navigator.userAgent)!=null?st:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),_=async()=>{for(let h=0;;h++){try{let C=await fetch(`${r}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(x),headers:o});if(C.status===402){console.warn("[SentientUI] Session limit exceeded for this project. The bandit will stop learning until the limit resets. Upgrade at sentient-ui.com/pricing");return}if(C.ok||se(C)==="dropped")return}catch(C){}if(h>=Ln){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(C=>setTimeout(C,Y(h+1)))}};try{N=_()}catch(h){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:s});let be=Mn(),K=null,ee=!1,F={goal(l,g={},y=1,x=0){var ue,pe,re,b,X,Ee,B;let _=a.getSessionId();if(!_)return;let h=Dn(g)?g:{metadata:g},C=[l,(ue=h.externalId)!=null?ue:"",(pe=h.stepIndex)!=null?pe:x,(re=h.weight)!=null?re:y].join("\0"),L=h.value!==void 0?`${h.value}\0${(b=h.currency)!=null?b:""}`:null;if(be.firedBefore(C,L)){e.debug&&console.log(`[sentient] goal("${l}") already recorded for this action \u2014 not sent twice`);return}let M=He(),V={sessionId:_,name:l,metadata:(X=h.metadata)!=null?X:{},weight:(Ee=h.weight)!=null?Ee:y,stepIndex:(B=h.stepIndex)!=null?B:x,goalId:M,value:h.value,currency:h.currency,externalId:h.externalId};e.debug&&console.log("[sentient] goal",V);let te={id:M,body:JSON.stringify(V)};N.then(()=>k.send(te))},componentGoal(l,g,y){var M,V,te;let x=a.getSessionId();if(!x)return;let _=p.get(l,I),h=_?null:(M=A.get(l))!=null?M:null;if(!_&&h===null){e.debug&&console.warn(`[sentient] componentGoal("${l}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}let C=_?_.variantId:De(h),L={id:He(),sessionId:x,projectId:e.apiKey,componentId:l,variantId:C,eventType:"goal_achieved",goalType:g,payload:w({reward:(V=y==null?void 0:y.reward)!=null?V:1,goalValue:y==null?void 0:y.value,currency:y==null?void 0:y.currency},(te=y==null?void 0:y.metadata)!=null?te:{}),timestamp:Date.now(),timeInSession:Date.now()-c,path:Ke()};e.debug&&console.log("[sentient] componentGoal",L),N.then(()=>s.push(L))},identify(l){let g=a.getSessionId();g&&N.then(()=>{fetch(`${r}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:g,userId:l,ephemeral:a.isEphemeral()}),headers:o}).catch(()=>{})})},track(l){let g=a.getSessionId();if(!g)return;let y=oe(w({path:Ke()},l),{id:He(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-c});e.debug&&console.log("[sentient] track",y),N.then(()=>s.push(y))},getAssignment(l,g){return p.get(l,g)},async assign(l,g,y,x){let _=a.getSessionId();if(!_)return null;let h=p.get(l,I);if(h&&(g!=null&&g.length||h.content!==void 0)){let C=h.ttlMs&&h.ttlMs>0?Math.max(0,h.assignedAt+h.ttlMs-Date.now()):0;return{variantId:h.variantId,assignmentTtlMs:C,content:h.content}}return Je(U,l,async()=>{await N;try{let C={sessionId:_,componentId:l,variantIds:g};x!==void 0?C.agentDataByVariant=x:y!==void 0&&(C.agentData=y);let L=await fetch(`${r}/assign`,{method:"POST",body:JSON.stringify(C),headers:o});if(!L.ok)return null;let M=await L.json();return p.set(l,I,w({variantId:M.variantId,assignedAt:Date.now(),segment:I,confidence:1,content:M.content},M.assignmentTtlMs&&M.assignmentTtlMs>0?{ttlMs:M.assignmentTtlMs}:{})),M}catch(C){return null}})},async decide(l){var h,C;let g=a.getSessionId();if(!g)return null;let y=(h=l.slots)!=null?h:[],x={sessionId:g};l.sections&&l.sections.length>0&&(x.sections=l.sections.map(L=>({id:L}))),x.components=(C=l.components)!=null?C:[],y.length>0&&(x.slots=y.map(xe)),l.slotsFrom==="registry"&&(x.slotsFrom="registry"),l.v&&(x.v=l.v),typeof l.pp=="number"&&(x.pp=l.pp),e.persona&&(x.persona=e.persona);let _=JSON.stringify(x);return Je($,_,async()=>{var L,M,V,te,ue,pe;await N;try{let re=await fetch(`${r}/decide`,{method:"POST",body:_,headers:o});if(!re.ok)return S(y),null;let b=await re.json(),X={};for(let B of y){let H=(L=b.slots)==null?void 0:L[B.id];if(H!==void 0){X[B.id]=H,A.set(B.id,H);continue}let it=A.get(B.id);if(it!==void 0)X[B.id]=it;else{let at=ae(B);X[B.id]=at,A.set(B.id,at)}}if(b.slots)for(let[B,H]of Object.entries(b.slots))B in X||(X[B]=H,A.set(B,H));let Ee=f!=null&&f.persona!=="unknown";b.persona&&!(b.persona==="unknown"&&Ee)?f={persona:b.persona,confidence:(M=b.confidence)!=null?M:0}:f||(f={persona:"unknown",confidence:0});for(let[B,H]of Object.entries((V=b.assignments)!=null?V:{}))p.set(B,I,{variantId:H,assignedAt:Date.now(),segment:I,confidence:1});if(b.slotConfig)for(let[B,H]of Object.entries(b.slotConfig))R.set(B,H);return b.palette&&(O=b.palette),ce(e.apiKey,w(w({v:1,persona:f.persona,band:(0,Qe.confidenceBand)(f.confidence),slots:Object.fromEntries(A),layoutOrder:(te=b.layoutOrder)!=null?te:null,savedAt:Date.now()},R.size>0?{slotConfig:Object.fromEntries(R)}:{}),O?{palette:O}:{})),w(w(w(w({layoutOrder:(ue=b.layoutOrder)!=null?ue:null,assignments:(pe=b.assignments)!=null?pe:{},slots:X,persona:f.persona,confidence:f.confidence},b.slotConfig?{slotConfig:b.slotConfig}:{}),b.goals?{goals:b.goals}:{}),b.sectionMap?{sectionMap:b.sectionMap}:{}),b.palette?{palette:b.palette}:{})}catch(re){return S(y),null}})},getSlotResult(l){var g;return(g=A.get(l))!=null?g:null},getSlotConfig(l){var g;return(g=R.get(l))!=null?g:null},reportSlots(l,g){for(let y of l)if(!(typeof y!="string"||y.length===0)){if(!Z.test(y)){Bn()&&!de.has(y)&&(de.add(y),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(y)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!T.has(y)){T.add(y),W.add(y);let x=g==null?void 0:g[y];if(typeof x=="string"){let _=x.replace(/\s+/g," ").trim().slice(0,400);_!==""&&j.set(y,_)}}}W.size===0||Q!=null||(Q=setTimeout(()=>{Q=null;let y=[...W];W.clear();for(let x=0;x<y.length;x+=20){let _=y.slice(x,x+20),h={};for(let C of _){let L=j.get(C);L!==void 0&&(h[C]=L,j.delete(C))}fetch(`${r}/slots/observed`,{method:"POST",headers:o,body:JSON.stringify(w({slotIds:_},Object.keys(h).length>0?{baselineTexts:h}:{}))}).catch(()=>{})}},1e3))},getSitePalette(){return O},getPersona(){return f?{persona:f.persona,confidence:f.confidence,band:(0,Qe.confidenceBand)(f.confidence)}:null},async fetchWeights(){var l;try{let g=await fetch(`${r}/weights`,{headers:o});return g.ok?(l=(await g.json()).components)!=null?l:[]:[]}catch(g){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){var l;K==null||K(),ee=!0,s.destroy(),k.destroy(),((l=G.get(e.apiKey))==null?void 0:l.dispose)===F.dispose&&G.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var l;K==null||K(),ee=!0,s.destroy(),k.destroy(),a.destroy(),p.clear(),((l=G.get(e.apiKey))==null?void 0:l.dispose)===F.dispose&&G.delete(e.apiKey);try{localStorage.removeItem(ne+e.apiKey),localStorage.removeItem(Fe(e.apiKey)),localStorage.removeItem($e(e.apiKey))}catch(g){}e.debug&&console.log("[sentient] destroyed")}};if(G.set(e.apiKey,{config:e,upgrade:null,dispose:F.dispose}),K=Nn(F,e.apiKey,l=>{N.then(()=>{ee||Ot.add(l)})}),e.debug){let l=window;l.__sentient&&(l.__sentient.client=F)}return F}0&&(module.exports={AGENT_INTENTS,BLOCK_ALIGNS,BLOCK_EMPHASES,BLOCK_FITS,BLOCK_GAPS,BLOCK_GRID_COLUMNS,BLOCK_HEADING_LEVELS,BLOCK_JUSTIFIES,BLOCK_MAX_WIDTHS,BLOCK_PADS,BLOCK_RATIOS,BLOCK_SIZES,BLOCK_SURFACES,BLOCK_TEXT_ALIGNS,BLOCK_TONES,BLOCK_WEIGHTS,CLICK_ID_KEYS,FORM_FIELD_KINDS,FORM_INPUT_TYPES,LEGACY_SESSION_COOKIE_NAME,LOCAL_MODE_BANNER,MAX_BLOCK_ARMS,MAX_BLOCK_CHILDREN,MAX_BLOCK_DEPTH,MAX_BLOCK_NODES,MAX_BLOCK_TEXT_LEN,MAX_FORM_FIELDS,MAX_FORM_SELECT_OPTIONS,PROD_KEYLESS_ERROR,SNAPSHOT_STORAGE_KEY_PREFIX,_registerConsentUpgradeInit,agentIntent,agentUaList,armOfResult,attachMicroSignalDetectors,baselineResultFor,baselineSlots,classifiedAgents,containsFormBlock,deriveSessionSegment,detectDeviceClass,detectTimeOfDay,detectTrafficSource,extractTrackedParams,grantConsent,init,isDoNotTrackEnabled,matchedAgentToken,readSnapshot,referrerDomainFromReferer,renderPrePaintScript,sessionCookieName,toWireSlot,uaTokenMatch,writeSnapshot});
1
+ "use strict";var Kt=Object.create;var fe=Object.defineProperty,Gt=Object.defineProperties,Ut=Object.getOwnPropertyDescriptor,Ft=Object.getOwnPropertyDescriptors,$t=Object.getOwnPropertyNames,ut=Object.getOwnPropertySymbols,Wt=Object.getPrototypeOf,gt=Object.prototype.hasOwnProperty,jt=Object.prototype.propertyIsEnumerable;var pt=(e,t,n)=>t in e?fe(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,b=(e,t)=>{for(var n in t||(t={}))gt.call(t,n)&&pt(e,n,t[n]);if(ut)for(var n of ut(t))jt.call(t,n)&&pt(e,n,t[n]);return e},oe=(e,t)=>Gt(e,Ft(t));var zt=(e,t)=>{for(var n in t)fe(e,n,{get:t[n],enumerable:!0})},ft=(e,t,n,l)=>{if(t&&typeof t=="object"||typeof t=="function")for(let u of $t(t))!gt.call(e,u)&&u!==n&&fe(e,u,{get:()=>t[u],enumerable:!(l=Ut(t,u))||l.enumerable});return e};var Ht=(e,t,n)=>(n=e!=null?Kt(Wt(e)):{},ft(t||!e||!e.__esModule?fe(n,"default",{value:e,enumerable:!0}):n,e)),Qt=e=>ft(fe({},"__esModule",{value:!0}),e);var Jn={};zt(Jn,{AGENT_INTENTS:()=>Pe,BLOCK_ALIGNS:()=>mn,BLOCK_EMPHASES:()=>xn,BLOCK_FITS:()=>wn,BLOCK_GAPS:()=>fn,BLOCK_GRID_COLUMNS:()=>En,BLOCK_HEADING_LEVELS:()=>Cn,BLOCK_JUSTIFIES:()=>yn,BLOCK_MAX_WIDTHS:()=>An,BLOCK_PADS:()=>_n,BLOCK_RATIOS:()=>bn,BLOCK_SIZES:()=>Sn,BLOCK_SURFACES:()=>In,BLOCK_TEXT_ALIGNS:()=>kn,BLOCK_TONES:()=>vn,BLOCK_WEIGHTS:()=>hn,CLICK_ID_KEYS:()=>He,FORM_FIELD_KINDS:()=>Rn,FORM_INPUT_TYPES:()=>On,LEGACY_SESSION_COOKIE_NAME:()=>Fe,LOCAL_MODE_BANNER:()=>Qe,MAX_BLOCK_ARMS:()=>Mn,MAX_BLOCK_CHILDREN:()=>Dn,MAX_BLOCK_DEPTH:()=>Ln,MAX_BLOCK_NODES:()=>Pn,MAX_BLOCK_TEXT_LEN:()=>Nn,MAX_FORM_FIELDS:()=>Tn,MAX_FORM_SELECT_OPTIONS:()=>Bn,PROD_KEYLESS_ERROR:()=>Ke,REVEAL_MS:()=>Rt,SNAPSHOT_STORAGE_KEY_PREFIX:()=>ne,_registerConsentUpgradeInit:()=>Un,agentIntent:()=>kt,agentUaList:()=>ye,armOfResult:()=>De,attachMicroSignalDetectors:()=>Bt,baselineResultFor:()=>ae,baselineSlots:()=>Et,classifiedAgents:()=>bt,containsFormBlock:()=>At,deriveSessionSegment:()=>wt,detectDeviceClass:()=>he,detectTimeOfDay:()=>ke,detectTrafficSource:()=>ve,extractTrackedParams:()=>Le,grantConsent:()=>Hn,init:()=>Nt,isDoNotTrackEnabled:()=>qe,matchedAgentToken:()=>ze,readSnapshot:()=>le,referrerDomainFromReferer:()=>xe,renderPrePaintScript:()=>Ct,resetRevealStyles:()=>Ot,reveal:()=>Tt,sessionCookieName:()=>_e,toWireSlot:()=>be,uaTokenMatch:()=>Se,writeSnapshot:()=>ce});module.exports=Qt(Jn);function Ie(){try{if(typeof crypto!="undefined"&&typeof crypto.randomUUID=="function")return crypto.randomUUID()}catch(e){}try{if(typeof crypto!="undefined"&&typeof crypto.getRandomValues=="function"){let e=new Uint8Array(16);crypto.getRandomValues(e),e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t="";for(let n=0;n<16;n++)t+=e[n].toString(16).padStart(2,"0"),(n===3||n===5||n===7||n===9)&&(t+="-");return t}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let t=Math.random()*16|0;return(e==="x"?t:t&3|8).toString(16)})}function me(e){return e?`_${e.slice(0,12)}`:""}var Fe="_snt_uid";function _e(e){return`${Fe}${me(e)}`}var Jt="_snt_uid",Vt=365,Ae="_snt_uid";function Xt(){return Ie()}function mt(e){try{let t=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return t?decodeURIComponent(t[1]):null}catch(t){return null}}function Yt(e,t,n){try{document.cookie=`${e}=${encodeURIComponent(t)}; max-age=${n}; SameSite=strict; path=/`}catch(l){}}function $e(e){try{return localStorage.getItem(e)}catch(t){return null}}function yt(e,t){try{return localStorage.setItem(e,t),!0}catch(n){return!1}}function St(e){try{return sessionStorage.getItem(e)}catch(t){return null}}function qt(e,t){try{return sessionStorage.setItem(e,t),!0}catch(n){return!1}}function Zt(e){try{sessionStorage.removeItem(e)}catch(t){}}function en(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=strict; path=/`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(t){return!1}}function tn(e){try{localStorage.removeItem(e)}catch(t){}}function nn(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(t){}}var rn={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function Re(e){var E,P,L,C,U,$,A;if(typeof window=="undefined")return rn;let t=me(e==null?void 0:e.apiKey),n=(E=e==null?void 0:e.cookieName)!=null?E:_e(e==null?void 0:e.apiKey),l=`${Ae}${t}`,u=`${Ae}_tomb${t}`,d=((P=e==null?void 0:e.cookieTTLDays)!=null?P:Vt)*24*60*60,a=O=>O&&O.length>0?O:null,p=()=>{var O,R;return t&&!(e!=null&&e.cookieName)&&$e(u)===null?(R=(O=a(mt(Jt)))!=null?O:a($e(Ae)))!=null?R:a(St(Ae)):null},s=(A=($=(U=(C=(L=a(mt(n)))!=null?L:a($e(l)))!=null?C:a(St(l)))!=null?U:p())!=null?$:a(e==null?void 0:e.ssrSessionId))!=null?A:Xt();Yt(n,s,d);let r=yt(l,s),o=en(n),m=r?!1:qt(l,s),x=!r&&!o&&!m;return{getSessionId:()=>s,isEphemeral:()=>x,destroy:()=>{s=null,nn(n),tn(l),Zt(l),t&&!(e!=null&&e.cookieName)&&yt(u,"1")}}}function Y(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function se(e){if(e.ok===!0)return"delivered";let{status:t}=e;return typeof t!="number"?"retry":t>=200&&t<300?"delivered":t>=400&&t<500&&t!==429?"dropped":"retry"}function Oe(e,t){try{let n=localStorage.getItem(e);if(!n)return[];let l=JSON.parse(n);return Array.isArray(l)?(localStorage.removeItem(e),l.slice(-t)):[]}catch(n){return[]}}function q(e,t,n){try{let l=(()=>{try{let i=localStorage.getItem(n);if(!i)return[];let d=JSON.parse(i);return Array.isArray(d)?d:[]}catch(i){return[]}})(),u=new Map;for(let i of l)u.set(i.id,i);for(let i of e)u.set(i.id,i);localStorage.setItem(n,JSON.stringify([...u.values()].slice(-t)))}catch(l){}}function Te(e,t){try{let n=localStorage.getItem(t);if(!n)return;let l=JSON.parse(n);if(!Array.isArray(l))return;let u=new Set(e),i=l.filter(d=>!u.has(d.id));if(i.length===l.length)return;i.length===0?localStorage.removeItem(t):localStorage.setItem(t,JSON.stringify(i))}catch(n){}}var on=500,sn=56*1024;function We(e){return`_snt_retry_${e.slice(0,12)}`}var an={push:()=>{},flush:()=>{},destroy:()=>{}};function ht(e){var Q,Z,ue;if(typeof window=="undefined")return an;let t=(Q=e.flushIntervalMs)!=null?Q:5e3,n=(Z=e.maxBatchSize)!=null?Z:20,l=(ue=e.maxRetrySize)!=null?ue:100,u=e.ingestUrl,i=e.apiKey,d=We(i),a=[],p=new Set,s=[],r=S=>{for(let v of S)o.delete(v),!p.has(v)&&(p.add(v),s.push(v));for(;s.length>on;){let v=s.shift();v&&p.delete(v)}Te(S,d)},o=new Set,m=()=>{for(;a.length>l;){let S=a.shift();S&&o.delete(S.id)}},x=S=>{p.has(S.id)||o.has(S.id)||(o.add(S.id),a.push(S),m())},E=S=>{for(let v of S)p.has(v.id)||(o.add(v.id),a.push(v));m()},P=Oe(d,l);for(let S of P)x(S);let L=0,C=0,U=(S,v=!0)=>{if(S.length===0)return;let J=JSON.stringify(S),N=S.map(K=>K.id),z;try{z=fetch(u,{method:"POST",keepalive:!0,body:J,headers:{"Content-Type":"application/json",Authorization:`Bearer ${i}`}})}catch(K){q(S,l,d),E(S),C++,L=Date.now()+Y(C);return}let Ee=K=>{if(se(K)!=="retry"){if(!K.ok&&v){let ee=S.filter(F=>F.eventType!=="pageview");if(ee.length>0&&ee.length<S.length){r(S.filter(F=>F.eventType==="pageview").map(F=>F.id)),U(ee,!1);return}}r(N),C=0,L=0;return}q(S,l,d),E(S),C++,L=Date.now()+Y(C)};z instanceof Promise?z.then(Ee).catch(()=>{q(S,l,d),E(S),C++,L=Date.now()+Y(C)}):Ee(z)},$=typeof TextEncoder!="undefined"?new TextEncoder:null,A=S=>$?$.encode(S).length:S.length,O=S=>{let v=[],J=2;for(let N of S){let z=A(JSON.stringify(N))+1;if(v.length>0&&J+z>sn||v.length>=n)break;v.push(N),J+=z}return v},R=()=>{try{if(Date.now()<L)return;for(;a.length>0&&!(Date.now()<L);){let S=a.filter(J=>!p.has(J.id));if(a.length=0,S.length===0)break;let v=O(S);if(v.length===0)break;v.length<S.length&&a.push(...S.slice(v.length)),U(v)}}catch(S){}},f=!0,T=null;T=setInterval(()=>{f&&R()},t);let W=()=>{document.visibilityState==="hidden"&&R()},j=()=>{R()};return document.addEventListener("visibilitychange",W),window.addEventListener("pagehide",j),{push(S){x(S),a.length>=n&&R()},flush:R,destroy(){f=!1,T!==null&&(clearInterval(T),T=null),document.removeEventListener("visibilitychange",W),window.removeEventListener("pagehide",j),R()}}}var ln=200;function je(e){return`_snt_goal_retry_${e.slice(0,12)}`}var cn={send:()=>{},flush:()=>{},destroy:()=>{}};function vt(e){var A,O,R;if(typeof window=="undefined")return cn;let t=(A=e.flushIntervalMs)!=null?A:5e3,n=(O=e.maxRetrySize)!=null?O:100,l=(R=e.maxPerFlush)!=null?R:5,u=je(e.apiKey),i=[],d=new Set,a=new Set,p=[],s=0,r=0,o=!1,m=f=>{for(d.delete(f.id),a.has(f.id)||(a.add(f.id),p.push(f.id));p.length>ln;){let T=p.shift();T&&a.delete(T)}Te([f.id],u)},x=f=>{q([f],n,u),!a.has(f.id)&&!d.has(f.id)&&(d.add(f.id),i.push(f)),Date.now()>=s&&(r++,s=Date.now()+Y(r))},E=f=>{let T;try{T=fetch(e.url,{method:"POST",keepalive:!0,body:f.body,headers:e.headers})}catch(j){x(f);return}let W=j=>{var Z;let Q=se(j);if(Q==="retry"){x(f);return}Q==="dropped"&&((Z=e.onDrop)==null||Z.call(e,f,j.status)),m(f),r=0,s=0};T instanceof Promise?T.then(W).catch(()=>x(f)):W(T)},P=()=>{try{if(o||Date.now()<s)return;let f=0;for(;i.length>0&&f<l&&!(Date.now()<s);){let T=i.shift();d.delete(T.id),!a.has(T.id)&&(f++,E(T))}}catch(f){}},L=Oe(u,n);for(let f of L)d.has(f.id)||(d.add(f.id),i.push(f));L.length>0&&q(L,n,u);let C=setInterval(P,t),U=()=>{document.visibilityState==="hidden"&&P()},$=()=>P();return document.addEventListener("visibilitychange",U),window.addEventListener("pagehide",$),{send(f){if(!o&&!(a.has(f.id)||d.has(f.id))){if(Date.now()<s){q([f],n,u),d.add(f.id),i.push(f);return}E(f)}},flush:P,destroy(){clearInterval(C),document.removeEventListener("visibilitychange",U),window.removeEventListener("pagehide",$),P(),o=!0}}}var dn=1800*1e3;function Be(e,t){return`${encodeURIComponent(e)}:${encodeURIComponent(t)}`}function xt(e=dn,t){let n=new Map,l=`_snt_asgn${me(t)}_`,u=(s,r)=>`${l}${encodeURIComponent(s)}:${encodeURIComponent(r)}`,i=s=>{let r=s.slice(l.length),o=r.indexOf(":");if(o<0)return null;try{return{componentId:decodeURIComponent(r.slice(0,o)),segment:decodeURIComponent(r.slice(o+1))}}catch(m){return null}},d=()=>{try{let s=[];for(let r=0;r<localStorage.length;r++){let o=localStorage.key(r);o!=null&&o.startsWith(l)&&s.push(o)}return s}catch(s){return[]}},a=s=>s.assignedAt+(s.ttlMs&&s.ttlMs>0?s.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let s of d())try{let r=localStorage.getItem(s);if(!r)continue;let o=JSON.parse(r);if(a(o)){localStorage.removeItem(s);continue}let m=i(s);if(!m)continue;n.set(Be(m.componentId,m.segment),o)}catch(r){}})(),{get(s,r){let o=n.get(Be(s,r));return o?a(o)?(n.delete(Be(s,r)),null):o:null},set(s,r,o){let m=Be(s,r);n.set(m,o);try{localStorage.setItem(u(s,r),JSON.stringify(o))}catch(x){}},clear(){n.clear();for(let s of d())try{localStorage.removeItem(s)}catch(r){}}}}var ye=["GPTBot","ChatGPT-User","OAI-SearchBot","ClaudeBot","Claude-User","Claude-SearchBot","PerplexityBot","Perplexity-User","Google-Extended","Applebot-Extended","Meta-ExternalAgent","Bytespider","CCBot","Amazonbot","cohere-ai","Diffbot"];function Se(e){return ze(e)!==null}function ze(e){var n;if(!e)return null;let t=e.toLowerCase();return(n=ye.find(l=>t.includes(l.toLowerCase())))!=null?n:null}var Pe={GPTBot:"training","ChatGPT-User":"user","OAI-SearchBot":"search",ClaudeBot:"training","Claude-User":"user","Claude-SearchBot":"search",PerplexityBot:"search","Perplexity-User":"user","Google-Extended":"training","Applebot-Extended":"training","Meta-ExternalAgent":"training",Bytespider:"training",CCBot:"training",Amazonbot:"other","cohere-ai":"training",Diffbot:"other"};function kt(e){if(!e)return"other";let t=ye.find(n=>n.toLowerCase()===e.toLowerCase());return t&&Pe[t]||"other"}function bt(){var t;let e={user:[],search:[],training:[],other:[]};for(let n of ye)e[(t=Pe[n])!=null?t:"other"].push(n);return e}function he(e){let t=e.toLowerCase();return/ipad|tablet|playbook|kindle|silk/.test(t)?"tablet":/mobi|iphone|ipod|android.*mobile|phone/.test(t)?"mobile":"desktop"}function ve(e,t){if(!e)return"direct";try{let n=new URL(e);if(t)try{if(new URL(t).host===n.host)return"direct"}catch(u){}let l=n.hostname.toLowerCase();return/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(l)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(l)?"social":"referral"}catch(n){return"direct"}}function xe(e){if(!e)return null;try{return new URL(e).hostname}catch(t){return null}}var He=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function Le(e){let t={},n={};try{let l=typeof e=="string"||e instanceof URLSearchParams?new URLSearchParams(e):Object.entries(e).flatMap(([u,i])=>{let d=Array.isArray(i)?i[0]:i;return d===void 0?[]:[[u,d]]});for(let[u,i]of l)u.startsWith("utm_")?u in t||(t[u]=i):He.includes(u)&&(u in n||(n[u]=i))}catch(l){}return{utmParams:t,clickIds:n}}function ke(e){let t=e.getHours();return t<6?"night":t<12?"morning":t<18?"afternoon":"evening"}function wt(e){let t=un("__segment__",e);return`${t.deviceClass}:${t.trafficSource}`}function un(e,t){var i,d,a,p,s,r,o,m;let n=(d=(i=t==null?void 0:t.userAgent)==null?void 0:i.trim())!=null?d:"",l=(p=(a=t==null?void 0:t.referer)==null?void 0:a.trim())!=null?p:"",u=(s=t==null?void 0:t.now)!=null?s:new Date;return{sessionId:e,ephemeral:!1,utmParams:(r=t==null?void 0:t.utmParams)!=null?r:{},clickIds:(o=t==null?void 0:t.clickIds)!=null?o:{},deviceClass:n?he(n):"desktop",trafficSource:l?ve(l,t==null?void 0:t.appOrigin):"direct",referrerDomain:xe(l),timeOfDay:ke(u),dayOfWeek:(m=["sun","mon","tue","wed","thu","fri","sat"][u.getDay()])!=null?m:"sun",automation:(t==null?void 0:t.webdriver)===!0||Se(n)}}var ie=require("@sentientui/policy");function be(e){return b(b(b({id:e.id},e.arms?{arms:[...e.arms]}:{}),e.dims?{dims:Object.fromEntries(Object.entries(e.dims).map(([t,n])=>[t,[...n]]))}:{}),e.baseline!==void 0?{baseline:e.baseline}:{})}function ae(e){let t=be(e);return(0,ie.slotResultFor)(t,(0,ie.slotBaselineArm)(t))}function Et(e){let t={};for(let n of e)t[n.id]=ae(n);return t}function De(e){return typeof e=="string"?e:(0,ie.canonicalArm)(e)}var ne="_snt_snap:",pn=["low","medium","high"];function le(e){try{let t=localStorage.getItem(ne+e);if(!t)return null;let n=JSON.parse(t);return!n||typeof n!="object"||n.v!==1||typeof n.persona!="string"||typeof n.band!="string"||!pn.includes(n.band)||typeof n.slots!="object"||n.slots===null||Array.isArray(n.slots)||!(n.layoutOrder===null||Array.isArray(n.layoutOrder))||typeof n.savedAt!="number"||!(n.slotConfig===void 0||typeof n.slotConfig=="object"&&n.slotConfig!==null&&!Array.isArray(n.slotConfig))?null:n}catch(t){return null}}function ce(e,t){try{localStorage.setItem(ne+e,JSON.stringify(t))}catch(n){}}function Ct(e){return"(function(){try{var r=localStorage.getItem("+JSON.stringify(ne+e).replace(/</g,"\\u003c")+');if(!r)return;var s=JSON.parse(r);if(!s||s.v!==1||typeof s.persona!=="string"||typeof s.band!=="string")return;var d=document.documentElement;if(d.hasAttribute("data-sentient-persona"))return;d.setAttribute("data-sentient-persona",s.persona);d.setAttribute("data-sentient-confidence",s.band);}catch(e){}})();'}var Xe=require("@sentientui/policy");var Ne=require("@sentientui/policy");var Ke="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY or pass localMode: true for local development.",Qe="[sentient] Local mode \u2014 decisions are simulated on-device and nothing is sent over the network. Add an API key to learn from real traffic.",It=!1,Me=!1;function gn(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(t){return}}function _t(e){var s;let t=Re({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),n=(s=t.getSessionId())!=null?s:"local",l=gn(),u=import("@sentientui/core/local").then(r=>{let o=r;return o.LOCAL_ENGINE_AVAILABLE?(It||(It=!0,console.info(Qe)),o):(Me||(Me=!0,console.error(Ke)),null)}).catch(()=>(Me||(Me=!0,console.error(Ke)),null)),i=null,d={low:.15,medium:.5,high:.85},a=(()=>{var o;if(e.initialPersona)return b({},e.initialPersona);let r=le(e.apiKey||"local");return r?{persona:r.persona,confidence:(o=d[r.band])!=null?o:.15}:null})();function p(r){let o=document.documentElement;o.dataset.sentientPersona===void 0&&(o.dataset.sentientPersona=r.persona,o.dataset.sentientConfidence=(0,Ne.confidenceBand)(r.confidence))}return{isLocal:!0,async decide(r){var x,E,P;let o=await u;if(!o)return null;let m=o.createLocalEngine({sessionId:n,forcedPersona:l}).decide(r);return i=oe(b({},m),{layoutOrder:(E=(x=m.layoutOrder)!=null?x:i==null?void 0:i.layoutOrder)!=null?E:null,slots:b(b({},(P=i==null?void 0:i.slots)!=null?P:{}),m.slots)}),ce(e.apiKey||"local",{v:1,persona:i.persona,band:(0,Ne.confidenceBand)(i.confidence),slots:i.slots,layoutOrder:i.layoutOrder,savedAt:Date.now()}),p(m),m},getSlotResult(r){var o,m,x;return(x=(m=i==null?void 0:i.slots[r])!=null?m:(o=e.initialSlots)==null?void 0:o[r])!=null?x:null},getSlotConfig(r){var o,m;return(m=(o=e.initialSlotConfig)==null?void 0:o[r])!=null?m:null},getSitePalette(){var r;return(r=e.initialPalette)!=null?r:null},reportSlots(){},getPersona(){let r=i!=null?i:a;return r?{persona:r.persona,confidence:r.confidence,band:(0,Ne.confidenceBand)(r.confidence)}:null},async assign(r,o){var E;let m=await u;return!m||!o||o.length===0?o!=null&&o[0]?{variantId:o[0],assignmentTtlMs:0}:null:{variantId:(E=m.createLocalEngine({sessionId:n,forcedPersona:l}).decide({components:[{id:r,variantIds:o}]}).assignments[r])!=null?E:o[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>t.destroy()}}var fn=["none","sm","md","lg"],mn=["start","center","end","stretch"],yn=["start","center","end","between"],Sn=["sm","md","lg"],hn=["normal","medium","bold"],vn=["default","muted","accent"],xn=["primary","secondary","ghost"],kn=["left","center","right"],bn=["auto","square","landscape","wide"],wn=["cover","contain"],En=[2,3,4],Cn=[2,3,4],In=["default","raised"],_n=["none","sm","md","lg"],An=["measure"],Rn=["input","textarea","select"],On=["text","email","number","tel"],Tn=5,Bn=8,Pn=64,Ln=5,Dn=12,Mn=4,Nn=500;function At(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let t=e;return t.type==="form"?!0:Array.isArray(t.children)?t.children.some(At):!1}var Je="sentient-reveal",de="sentient-revealed",Rt=240,Ge=!1;function Ot(){var e;Ge=!1,typeof document!="undefined"&&((e=document.getElementById(Je))==null||e.remove())}function Kn(e){if(Ge||e.getElementById(Je)){Ge=!0;return}let t=e.createElement("style");t.id=Je,t.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${de}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${de}{animation:${de} 240ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(t),Ge=!0}function Tt(e,t={}){var u;let n=(u=t.doc)!=null?u:typeof document!="undefined"?document:void 0;if(!n||!(e instanceof Element)||(t.arm!==void 0&&e.setAttribute("data-sentient-arm",t.arm),t.persona!==void 0&&e.setAttribute("data-sentient-persona",t.persona),t.previous!==void 0&&t.previous===e.textContent))return!1;Kn(n),e.classList.remove(de),e.offsetWidth,e.classList.add(de);let l=()=>{e.classList.remove(de),e.removeEventListener("animationend",l)};return e.addEventListener("animationend",l),!0}function Bt(e,t,n,l){let u=[];{let a=!1,p=[],s=()=>{if(a)return;let r=Date.now();for(p.push(r);p.length>0&&r-p[0]>500;)p.shift();p.length>=3&&(a=!0,e("rage_click"))};t.addEventListener("click",s),u.push(()=>t.removeEventListener("click",s))}{let i=!1,d=a=>{if(i||!(a.target instanceof Node)||!t.contains(a.target)&&t!==a.target)return;i=!0;let p=typeof window!="undefined"?window.getSelection():null,s=p?p.toString().length:0;e("text_copy",{selectionLength:s})};document.addEventListener("copy",d),u.push(()=>document.removeEventListener("copy",d))}{let i=!1,d=!1,a=null,p=()=>{a!==null&&(clearTimeout(a),a=null)},s=()=>{i||!d||(p(),a=setTimeout(()=>{!i&&d&&(i=!0,e("scroll_hesitation"))},3e3))},r=()=>{p(),s()},o=x=>{for(let E of x)d=E.intersectionRatio>.3,d?s():p()},m=new IntersectionObserver(o,{threshold:[.3]});m.observe(t),window.addEventListener("scroll",r,{passive:!0}),u.push(()=>{m.disconnect(),window.removeEventListener("scroll",r),p()})}if((l==null?void 0:l.tabLoss)!==!1){let i=!1,d=n!=null?n:Date.now(),a=()=>{if(i||document.visibilityState!=="hidden")return;let p=Date.now()-d;p<15e3&&(i=!0,e("tab_loss",{timeOnPage:p}))};document.addEventListener("visibilitychange",a),u.push(()=>document.removeEventListener("visibilitychange",a))}return()=>{for(let i of u)i()}}function Gn(){var e;return typeof process=="undefined"||((e=process.env)==null?void 0:e.NODE_ENV)!=="production"}var Pt="https://api.sentient-ui.com/v1/events",G=new Map,Lt=null;function Un(e,t){let n=G.get(e);n&&n.upgrade&&(n.reinit=t)}function Fn(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var $n=3;function Ve(){return Ie()}function Ue(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Wn(){let e=new WeakMap,t=new Map,n=!1,l=(a,p,s)=>{let r=a.get(p);return s===null?r?!0:(a.set(p,new Set),!1):r?r.has(s)?!0:(r.add(s),!1):(a.set(p,new Set([s])),!1)},u=typeof window!="undefined"&&"event"in window,i=()=>{if(!u)return;let a=window.event;return typeof Event=="function"&&a instanceof Event?a:void 0},d=()=>{if(u){Promise.resolve().then(()=>{n=!1,t.clear()});return}let a=!1,p=()=>{a||(a=!0,n=!1,t.clear())};if(setTimeout(p,0),typeof MessageChannel=="function"){let s=new MessageChannel;s.port1.onmessage=()=>{s.port1.close(),s.port2.close(),p()},s.port2.postMessage(0)}};return{firedBefore(a,p){let s=i();if(s){let o=e.get(s);return o||(o=new Map,e.set(s,o)),l(o,a,p)}let r=l(t,a,p);return!r&&!n&&(n=!0,d()),r}}}var Dt=new Set;function jn(e,t,n){let l=typeof window=="undefined"?null:window.history;if(!l)return()=>{};let u=!1,i,d=()=>{if(u)return;let s=Ue();!s||s===i||(i=s,e.track({projectId:t,componentId:"__page__",eventType:"pageview",payload:{}}),n(`${t}:${s}`))},a=[];for(let s of["pushState","replaceState"]){let r=l[s],o=function(...m){let x=r.apply(this,m);return d(),x};l[s]=o,a.push([s,r,o])}window.addEventListener("popstate",d);let p=Ue();return p&&Dt.has(`${t}:${p}`)?i=p:d(),()=>{if(!u){u=!0,window.removeEventListener("popstate",d);for(let[s,r,o]of a)l[s]===o&&(l[s]=r)}}}var we={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}};function zn(){try{return Le(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Mt(e){return e.replace(/\/events\/?$/,"")}function qe(){return typeof navigator!="undefined"&&navigator.globalPrivacyControl===!0?!0:[typeof navigator!="undefined"?navigator.doNotTrack:void 0,typeof window!="undefined"?window.doNotTrack:void 0,typeof navigator!="undefined"?navigator.msDoNotTrack:void 0].some(t=>t==="1"||t==="yes")}function Hn(e){var p;if(typeof window=="undefined")return;let t=e!=null?e:Lt;if(!t){console.warn("[sentient] grantConsent() called before init()");return}let n=G.get(t);if(!n){console.warn("[sentient] grantConsent() called before init()");return}let{config:l,upgrade:u,reinit:i}=n;if(!u){n.upgradeBlockedReason&&console.warn(n.upgradeBlockedReason);return}if(l.respectDoNotTrack!==!1&&qe())return;let d=(i!=null?i:Nt)(oe(b({},l),{consent:!0}));u(d);let a=(p=G.get(t))==null?void 0:p.dispose;G.set(t,{config:oe(b({},l),{consent:!0}),upgrade:null,dispose:a})}function Qn(e){var s;let t=e.preConsentBehavior==="statistical_winner",n=Mt((s=e.ingestUrl)!=null?s:Pt),l={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},u=new Map,i=new Map,d={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(r,o,m){if(!t)return Promise.resolve(null);let x=u.get(r);return x?Promise.resolve(x):Ye(i,r,async()=>{try{let E=new URLSearchParams({componentId:r});for(let U of o!=null?o:[])E.append("variantIds[]",U);let P=await fetch(`${n}/winner?${E.toString()}`,{headers:l});if(!P.ok)return o!=null&&o[0]?{variantId:o[0],assignmentTtlMs:0}:null;let C={variantId:(await P.json()).variantId,assignmentTtlMs:0};return u.set(r,C),C}catch(E){return o!=null&&o[0]?{variantId:o[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>{}},a={track:r=>d.track(r),goal:((r,o,m,x)=>d.goal(r,o,m,x)),componentGoal:(r,o,m)=>d.componentGoal(r,o,m),identify:r=>d.identify(r),getAssignment:(r,o)=>d.getAssignment(r,o),assign:(r,o,m,x)=>d.assign(r,o,m,x),decide:r=>d.decide(r),getSlotResult:r=>d.getSlotResult(r),getSlotConfig:r=>d.getSlotConfig(r),getSitePalette:()=>d.getSitePalette(),reportSlots:(r,o)=>d.reportSlots(r,o),getPersona:()=>d.getPersona(),fetchWeights:()=>d.fetchWeights(),getGraph:()=>d.getGraph(),dispose:()=>d.dispose(),destroy:()=>d.destroy()};function p(r){d=r}return{proxy:a,setInner:p}}function Ye(e,t,n){let l=e.get(t);if(l)return l;let u=(async()=>{try{return await n()}finally{e.delete(t)}})();return e.set(t,u),u}function Nt(e){var Ze,et,tt,nt,rt,ot,st,it,at,lt;if(typeof window=="undefined")return we;Lt=e.apiKey||"local";let t=G.get(e.apiKey||"local");if(t!=null&&t.dispose)try{t.dispose()}catch(c){}let n=e.respectDoNotTrack!==!1&&qe(),l=e.consent===!1||n,u=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!u&&e.localMode!==!1)return G.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),l?we:_t(e);if(l){if(!e.apiKey||!e.apiKey.startsWith("pk_"))return e.preConsentBehavior==="statistical_winner"&&console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),G.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): the client was initialized with an invalid apiKey (expected a pk_ public key) \u2014 consent cannot enable tracking."}),we;let{proxy:c,setInner:g}=Qn(e);return G.set(e.apiKey,{config:e,upgrade:n?null:g}),c}if(!e.apiKey||!e.apiKey.startsWith("pk_"))return console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),we;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),we;let i=(Ze=e.ingestUrl)!=null?Ze:Pt,d=Date.now(),a=Re({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),p=xt(void 0,e.apiKey),s=ht({ingestUrl:i,apiKey:e.apiKey}),r=Mt(i),o={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},m=new Set,x=vt({url:`${r}/goals`,apiKey:e.apiKey,headers:o,onDrop:(c,g)=>{if(!e.debug){if(m.has(g))return;m.add(g)}console.warn(`[sentient] goal dropped (HTTP ${g}) \u2014 this will not be retried. `+(g===400?"The session was not found: call init() and let the session upsert complete before firing goals.":g===401||g===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),c)}}),E=he((et=navigator.userAgent)!=null?et:""),P=window.location.origin,L=ve((tt=document.referrer)!=null?tt:"",P),C=(nt=e.sessionSegment)!=null?nt:`${E}:${L}`,U=new Map,$=new Map,A=new Map,O=new Map,R=null,f=null,T=new Set,W=new Set,j=new Map,Q=null,Z=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,ue=new Set,S=c=>{for(let g of c)A.has(g.id)||A.set(g.id,ae(g))};if(e.initialSlots)for(let[c,g]of Object.entries(e.initialSlots))A.set(c,g);if(e.initialSlotConfig)for(let[c,g]of Object.entries(e.initialSlotConfig))O.set(c,g);e.initialPalette&&(R=e.initialPalette);let v=le(e.apiKey);if(v){for(let[c,g]of Object.entries(v.slots))A.has(c)||A.set(c,g);for(let[c,g]of Object.entries((rt=v.slotConfig)!=null?rt:{}))O.has(c)||O.set(c,g);!R&&v.palette&&(R=v.palette)}let J={low:.15,medium:.5,high:.85};if(e.initialPersona)f=b({},e.initialPersona);else{let c=document.documentElement.dataset;c.sentientPersona?f={persona:c.sentientPersona,confidence:(st=J[(ot=c.sentientConfidence)!=null?ot:"low"])!=null?st:.15}:v&&(f={persona:v.persona,confidence:(it=J[v.band])!=null?it:.15})}if(e.initialAssignments)for(let[c,g]of Object.entries(e.initialAssignments))p.set(c,C,{variantId:g,assignedAt:Date.now(),segment:C,confidence:1});let N=Promise.resolve(),z=a.getSessionId();if(z){let c=xe((at=document.referrer)!=null?at:""),{utmParams:g,clickIds:y}=zn(),k=b(b(b(b({sessionId:z,deviceClass:E,trafficSource:L,referrerDomain:c,utmParams:g,clickIds:y,timeOfDay:ke(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:a.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Se((lt=navigator.userAgent)!=null?lt:"")},e.userId?{userId:e.userId}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),_=async()=>{for(let h=0;;h++){try{let I=await fetch(`${r}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(k),headers:o});if(I.status===402){console.warn("[SentientUI] Session limit exceeded for this project. The bandit will stop learning until the limit resets. Upgrade at sentient-ui.com/pricing");return}if(I.ok||se(I)==="dropped")return}catch(I){}if(h>=$n){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(I=>setTimeout(I,Y(h+1)))}};try{N=_()}catch(h){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:s});let Ee=Wn(),K=null,ee=!1,F={goal(c,g={},y=1,k=0){var pe,ge,re,w,V,Ce,B;let _=a.getSessionId();if(!_)return;let h=Fn(g)?g:{metadata:g},I=[c,(pe=h.externalId)!=null?pe:"",(ge=h.stepIndex)!=null?ge:k,(re=h.weight)!=null?re:y].join("\0"),D=h.value!==void 0?`${h.value}\0${(w=h.currency)!=null?w:""}`:null;if(Ee.firedBefore(I,D)){e.debug&&console.log(`[sentient] goal("${c}") already recorded for this action \u2014 not sent twice`);return}let M=Ve(),X={sessionId:_,name:c,metadata:(V=h.metadata)!=null?V:{},weight:(Ce=h.weight)!=null?Ce:y,stepIndex:(B=h.stepIndex)!=null?B:k,goalId:M,value:h.value,currency:h.currency,externalId:h.externalId};e.debug&&console.log("[sentient] goal",X);let te={id:M,body:JSON.stringify(X)};N.then(()=>x.send(te))},componentGoal(c,g,y){var M,X,te;let k=a.getSessionId();if(!k)return;let _=p.get(c,C),h=_?null:(M=A.get(c))!=null?M:null;if(!_&&h===null){e.debug&&console.warn(`[sentient] componentGoal("${c}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}let I=_?_.variantId:De(h),D={id:Ve(),sessionId:k,projectId:e.apiKey,componentId:c,variantId:I,eventType:"goal_achieved",goalType:g,payload:b({reward:(X=y==null?void 0:y.reward)!=null?X:1,goalValue:y==null?void 0:y.value,currency:y==null?void 0:y.currency},(te=y==null?void 0:y.metadata)!=null?te:{}),timestamp:Date.now(),timeInSession:Date.now()-d,path:Ue()};e.debug&&console.log("[sentient] componentGoal",D),N.then(()=>s.push(D))},identify(c){let g=a.getSessionId();g&&N.then(()=>{fetch(`${r}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:g,userId:c,ephemeral:a.isEphemeral()}),headers:o}).catch(()=>{})})},track(c){let g=a.getSessionId();if(!g)return;let y=oe(b({path:Ue()},c),{id:Ve(),sessionId:g,timestamp:Date.now(),timeInSession:Date.now()-d});e.debug&&console.log("[sentient] track",y),N.then(()=>s.push(y))},getAssignment(c,g){return p.get(c,g)},async assign(c,g,y,k){let _=a.getSessionId();if(!_)return null;let h=p.get(c,C);if(h&&(g!=null&&g.length||h.content!==void 0)){let I=h.ttlMs&&h.ttlMs>0?Math.max(0,h.assignedAt+h.ttlMs-Date.now()):0;return{variantId:h.variantId,assignmentTtlMs:I,content:h.content}}return Ye(U,c,async()=>{await N;try{let I={sessionId:_,componentId:c,variantIds:g};k!==void 0?I.agentDataByVariant=k:y!==void 0&&(I.agentData=y);let D=await fetch(`${r}/assign`,{method:"POST",body:JSON.stringify(I),headers:o});if(!D.ok)return null;let M=await D.json();return p.set(c,C,b({variantId:M.variantId,assignedAt:Date.now(),segment:C,confidence:1,content:M.content},M.assignmentTtlMs&&M.assignmentTtlMs>0?{ttlMs:M.assignmentTtlMs}:{})),M}catch(I){return null}})},async decide(c){var h,I;let g=a.getSessionId();if(!g)return null;let y=(h=c.slots)!=null?h:[],k={sessionId:g};c.sections&&c.sections.length>0&&(k.sections=c.sections.map(D=>({id:D}))),k.components=(I=c.components)!=null?I:[],y.length>0&&(k.slots=y.map(be)),c.slotsFrom==="registry"&&(k.slotsFrom="registry"),c.v&&(k.v=c.v),typeof c.pp=="number"&&(k.pp=c.pp),e.persona&&(k.persona=e.persona);let _=JSON.stringify(k);return Ye($,_,async()=>{var D,M,X,te,pe,ge;await N;try{let re=await fetch(`${r}/decide`,{method:"POST",body:_,headers:o});if(!re.ok)return S(y),null;let w=await re.json(),V={};for(let B of y){let H=(D=w.slots)==null?void 0:D[B.id];if(H!==void 0){V[B.id]=H,A.set(B.id,H);continue}let ct=A.get(B.id);if(ct!==void 0)V[B.id]=ct;else{let dt=ae(B);V[B.id]=dt,A.set(B.id,dt)}}if(w.slots)for(let[B,H]of Object.entries(w.slots))B in V||(V[B]=H,A.set(B,H));let Ce=f!=null&&f.persona!=="unknown";w.persona&&!(w.persona==="unknown"&&Ce)?f={persona:w.persona,confidence:(M=w.confidence)!=null?M:0}:f||(f={persona:"unknown",confidence:0});for(let[B,H]of Object.entries((X=w.assignments)!=null?X:{}))p.set(B,C,{variantId:H,assignedAt:Date.now(),segment:C,confidence:1});if(w.slotConfig)for(let[B,H]of Object.entries(w.slotConfig))O.set(B,H);return w.palette&&(R=w.palette),ce(e.apiKey,b(b({v:1,persona:f.persona,band:(0,Xe.confidenceBand)(f.confidence),slots:Object.fromEntries(A),layoutOrder:(te=w.layoutOrder)!=null?te:null,savedAt:Date.now()},O.size>0?{slotConfig:Object.fromEntries(O)}:{}),R?{palette:R}:{})),b(b(b(b({layoutOrder:(pe=w.layoutOrder)!=null?pe:null,assignments:(ge=w.assignments)!=null?ge:{},slots:V,persona:f.persona,confidence:f.confidence},w.slotConfig?{slotConfig:w.slotConfig}:{}),w.goals?{goals:w.goals}:{}),w.sectionMap?{sectionMap:w.sectionMap}:{}),w.palette?{palette:w.palette}:{})}catch(re){return S(y),null}})},getSlotResult(c){var g;return(g=A.get(c))!=null?g:null},getSlotConfig(c){var g;return(g=O.get(c))!=null?g:null},reportSlots(c,g){for(let y of c)if(!(typeof y!="string"||y.length===0)){if(!Z.test(y)){Gn()&&!ue.has(y)&&(ue.add(y),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(y)} will not register \u2014 ids must start with a letter or digit and contain only letters, digits, '_' or '-' (max 128 chars): /^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/.`));continue}if(!T.has(y)){T.add(y),W.add(y);let k=g==null?void 0:g[y];if(typeof k=="string"){let _=k.replace(/\s+/g," ").trim().slice(0,400);_!==""&&j.set(y,_)}}}W.size===0||Q!=null||(Q=setTimeout(()=>{Q=null;let y=[...W];W.clear();for(let k=0;k<y.length;k+=20){let _=y.slice(k,k+20),h={};for(let I of _){let D=j.get(I);D!==void 0&&(h[I]=D,j.delete(I))}fetch(`${r}/slots/observed`,{method:"POST",headers:o,body:JSON.stringify(b({slotIds:_},Object.keys(h).length>0?{baselineTexts:h}:{}))}).catch(()=>{})}},1e3))},getSitePalette(){return R},getPersona(){return f?{persona:f.persona,confidence:f.confidence,band:(0,Xe.confidenceBand)(f.confidence)}:null},async fetchWeights(){var c;try{let g=await fetch(`${r}/weights`,{headers:o});return g.ok?(c=(await g.json()).components)!=null?c:[]:[]}catch(g){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){var c;K==null||K(),ee=!0,s.destroy(),x.destroy(),((c=G.get(e.apiKey))==null?void 0:c.dispose)===F.dispose&&G.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var c;K==null||K(),ee=!0,s.destroy(),x.destroy(),a.destroy(),p.clear(),((c=G.get(e.apiKey))==null?void 0:c.dispose)===F.dispose&&G.delete(e.apiKey);try{localStorage.removeItem(ne+e.apiKey),localStorage.removeItem(We(e.apiKey)),localStorage.removeItem(je(e.apiKey))}catch(g){}e.debug&&console.log("[sentient] destroyed")}};if(G.set(e.apiKey,{config:e,upgrade:null,dispose:F.dispose}),K=jn(F,e.apiKey,c=>{N.then(()=>{ee||Dt.add(c)})}),e.debug){let c=window;c.__sentient&&(c.__sentient.client=F)}return F}0&&(module.exports={AGENT_INTENTS,BLOCK_ALIGNS,BLOCK_EMPHASES,BLOCK_FITS,BLOCK_GAPS,BLOCK_GRID_COLUMNS,BLOCK_HEADING_LEVELS,BLOCK_JUSTIFIES,BLOCK_MAX_WIDTHS,BLOCK_PADS,BLOCK_RATIOS,BLOCK_SIZES,BLOCK_SURFACES,BLOCK_TEXT_ALIGNS,BLOCK_TONES,BLOCK_WEIGHTS,CLICK_ID_KEYS,FORM_FIELD_KINDS,FORM_INPUT_TYPES,LEGACY_SESSION_COOKIE_NAME,LOCAL_MODE_BANNER,MAX_BLOCK_ARMS,MAX_BLOCK_CHILDREN,MAX_BLOCK_DEPTH,MAX_BLOCK_NODES,MAX_BLOCK_TEXT_LEN,MAX_FORM_FIELDS,MAX_FORM_SELECT_OPTIONS,PROD_KEYLESS_ERROR,REVEAL_MS,SNAPSHOT_STORAGE_KEY_PREFIX,_registerConsentUpgradeInit,agentIntent,agentUaList,armOfResult,attachMicroSignalDetectors,baselineResultFor,baselineSlots,classifiedAgents,containsFormBlock,deriveSessionSegment,detectDeviceClass,detectTimeOfDay,detectTrafficSource,extractTrackedParams,grantConsent,init,isDoNotTrackEnabled,matchedAgentToken,readSnapshot,referrerDomainFromReferer,renderPrePaintScript,resetRevealStyles,reveal,sessionCookieName,toWireSlot,uaTokenMatch,writeSnapshot});
2
2
  //# sourceMappingURL=index.js.map