@sentientui/core 0.43.0 → 0.44.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-MDLYXFGL.mjs +2 -0
- package/dist/chunk-MDLYXFGL.mjs.map +1 -0
- package/dist/chunk-OT77D5DV.mjs +2 -0
- package/dist/chunk-OT77D5DV.mjs.map +1 -0
- package/dist/{index-CWHTKETi.d.cts → index-CPjHmDZO.d.cts} +1 -1
- package/dist/{index-cqfRT6LZ.d.ts → index-DnFJAMuK.d.ts} +1 -1
- package/dist/index-engagement.js.map +1 -1
- package/dist/index-engagement.mjs +1 -1
- package/dist/index-graph.d.cts +2 -2
- package/dist/index-graph.d.ts +2 -2
- package/dist/index-graph.js +1 -1
- package/dist/index-graph.js.map +1 -1
- package/dist/index-graph.mjs +1 -1
- package/dist/index-local.d.cts +1 -1
- package/dist/index-local.d.ts +1 -1
- package/dist/index-server.d.cts +37 -2
- package/dist/index-server.d.ts +37 -2
- package/dist/index-server.js +1 -1
- package/dist/index-server.js.map +1 -1
- package/dist/index-server.mjs +1 -1
- package/dist/index-server.mjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
- package/dist/chunk-3HMJERH4.mjs +0 -2
- package/dist/chunk-3HMJERH4.mjs.map +0 -1
- package/dist/chunk-5VIREVXA.mjs +0 -2
- package/dist/chunk-5VIREVXA.mjs.map +0 -1
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as s}from"./chunk-TMCGHANO.mjs";var c=["GPTBot","ChatGPT-User","OAI-SearchBot","ClaudeBot","Claude-User","Claude-SearchBot","Claude-Agent","PerplexityBot","Perplexity-User","Google-Agent","Google-Extended","Applebot-Extended","Meta-ExternalAgent","Bytespider","CCBot","Amazonbot","cohere-ai","Diffbot"];function y(t){return b(t)!==null}function b(t){var r;if(!t)return null;let e=t.toLowerCase();return(r=c.find(i=>e.includes(i.toLowerCase())))!=null?r:null}var S=["Googlebot","Bingbot","DuckDuckBot","YandexBot","Baiduspider","Applebot","Slurp","facebookexternalhit","LinkedInBot","Twitterbot"];function R(t){var i;let e=b(t);if(e)return e;if(!t)return null;let r=t.toLowerCase();return(i=S.find(n=>r.includes(n.toLowerCase())))!=null?i:null}var x={GPTBot:"training","ChatGPT-User":"user","OAI-SearchBot":"search",ClaudeBot:"training","Claude-User":"user","Claude-SearchBot":"search","Claude-Agent":"user",PerplexityBot:"search","Perplexity-User":"user","Google-Agent":"user","Google-Extended":"training","Applebot-Extended":"training","Meta-ExternalAgent":"training",Bytespider:"training",CCBot:"training",Amazonbot:"other","cohere-ai":"training",Diffbot:"other"};function U(t){if(!t)return"other";let e=c.find(r=>r.toLowerCase()===t.toLowerCase());return e&&x[e]||"other"}function O(){var e;let t={user:[],search:[],training:[],other:[]};for(let r of c)t[(e=x[r])!=null?e:"other"].push(r);return t}function C(t){let e=t.toLowerCase();return/ipad|tablet|playbook|kindle|silk/.test(e)?"tablet":/mobi|iphone|ipod|android.*mobile|phone/.test(e)?"mobile":"desktop"}function p(t,e,r){if(!t)return"direct";try{let i=new URL(t);if(e)try{if(new URL(e).host===i.host)return"direct"}catch(o){}let n=i.hostname.toLowerCase();return r&&`.${n}`.endsWith(`.${r}`)?"direct":/(^|\.)(google|bing|duckduckgo|yahoo)\./.test(n)?"search":/(^|\.)(twitter\.com|x\.com|facebook\.com|linkedin\.com|reddit\.com|t\.co)$/.test(n)?"social":"referral"}catch(i){return"direct"}}function k(t){if(!t)return null;try{return new URL(t).hostname}catch(e){return null}}var A=["gclid","gbraid","wbraid","fbclid","ttclid","msclkid","twclid","li_fat_id"];function E(t){let e={},r={};try{let i=typeof t=="string"||t instanceof URLSearchParams?new URLSearchParams(t):Object.entries(t).flatMap(([n,o])=>{let a=Array.isArray(o)?o[0]:o;return a===void 0?[]:[[n,a]]});for(let[n,o]of i)n.startsWith("utm_")?n in e||(e[n]=o):A.includes(n)&&(n in r||(r[n]=o))}catch(i){}return{utmParams:e,clickIds:r}}function P(t){let e=t.getHours();return e<6?"night":e<12?"morning":e<18?"afternoon":"evening"}function _(t){let e=I("__segment__",t);return`${e.deviceClass}:${e.trafficSource}`}function I(t,e){var a,l,g,u,d,f,m,h;let r=(l=(a=e==null?void 0:e.userAgent)==null?void 0:a.trim())!=null?l:"",i=(u=(g=e==null?void 0:e.referer)==null?void 0:g.trim())!=null?u:"",n=(d=e==null?void 0:e.now)!=null?d:new Date,o=R(r);return s(s({sessionId:t,ephemeral:!1,utmParams:(f=e==null?void 0:e.utmParams)!=null?f:{},clickIds:(m=e==null?void 0:e.clickIds)!=null?m:{},deviceClass:r?C(r):"desktop",trafficSource:i?p(i,e==null?void 0:e.appOrigin):"direct",referrerDomain:k(i),timeOfDay:P(n),dayOfWeek:(h=["sun","mon","tue","wed","thu","fri","sat"][n.getDay()])!=null?h:"sun",automation:(e==null?void 0:e.webdriver)===!0||y(r)},o?{agentToken:o}:{}),e!=null&&e.landingPath?{landingPath:e.landingPath.split(/[?#]/)[0]}:{})}import{canonicalArm as w,slotBaselineArm as D,slotResultFor as B}from"@sentientui/policy";function L(t){return s(s(s({id:t.id},t.arms?{arms:[...t.arms]}:{}),t.dims?{dims:Object.fromEntries(Object.entries(t.dims).map(([e,r])=>[e,[...r]]))}:{}),t.baseline!==void 0?{baseline:t.baseline}:{})}function T(t){let e=L(t);return B(e,D(e))}function $(t){let e={};for(let r of t)e[r.id]=T(r);return e}function M(t){return typeof t=="string"?t:w(t)}export{c as a,y as b,b as c,S as d,R as e,x as f,U as g,O as h,C as i,p as j,k,A as l,E as m,P as n,_ as o,I as p,L as q,T as r,$ as s,M as t};
|
|
2
|
+
//# sourceMappingURL=chunk-MDLYXFGL.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/session-meta.ts","../src/slots.ts"],"sourcesContent":["/** Session metadata helpers (browser + Node). No DOM APIs. */\n\n/**\n * Known AI-agent / crawler user-agent tokens. Matched case-insensitively as\n * substrings. This is maintained data — bot lists move monthly. Used both to\n * flag automation on sessions (agentic browsers that leak a token) and by the\n * server middleware / agent-feed route to identify crawler HTTP reads.\n */\n// Browser-relevant only: this list ships in the lean bundle (size budget) and\n// flags automation on sessions, so it holds crawlers plus agents that RUN the\n// snippet. Fetchers that never execute JavaScript, and agents named only by a\n// request header, live in signed-agents.ts on the server entry.\nexport const agentUaList: readonly string[] = [\n 'GPTBot',\n 'ChatGPT-User',\n 'OAI-SearchBot',\n 'ClaudeBot',\n 'Claude-User',\n 'Claude-SearchBot',\n // Anthropic's hosted browser: a real browser UA plus `compatible;\n // Claude-Agent/1.0` (support.claude.com/en/articles/18234133). It RUNS the\n // snippet, so without this token its visits scored as people.\n 'Claude-Agent',\n 'PerplexityBot',\n 'Perplexity-User',\n // User-triggered agent fetches, real browser with the token appended\n // (developers.google.com/crawling/docs/crawlers-fetchers/google-agent).\n 'Google-Agent',\n 'Google-Extended',\n 'Applebot-Extended',\n 'Meta-ExternalAgent',\n 'Bytespider',\n 'CCBot',\n 'Amazonbot',\n 'cohere-ai',\n 'Diffbot',\n];\n\n/** True when the user-agent contains a known AI-agent / crawler token. */\nexport function uaTokenMatch(userAgent: string): boolean {\n return matchedAgentToken(userAgent) !== null;\n}\n\n/** The first known agent token found in the user-agent, or null. */\nexport function matchedAgentToken(userAgent: string): string | null {\n if (!userAgent) return null;\n const s = userAgent.toLowerCase();\n return agentUaList.find((token) => s.includes(token.toLowerCase())) ?? null;\n}\n\n/**\n * Classic search / link-preview crawlers. DISPLAY-ONLY: these name a request in\n * the dashboard but must never join `agentUaList`, which also sets `automation`\n * (and so bandit exclusion) — a crawler that is merely named must not change\n * how the session is scored.\n */\nexport const CLASSIC_CRAWLER_TOKENS: readonly string[] = [\n 'Googlebot',\n 'Bingbot',\n 'DuckDuckBot',\n 'YandexBot',\n 'Baiduspider',\n 'Applebot',\n 'Slurp',\n 'facebookexternalhit',\n 'LinkedInBot',\n 'Twitterbot',\n];\n\n/**\n * Name the crawler behind a user-agent: AI-agent tokens first (so\n * `Applebot-Extended` is not swallowed by the shorter `Applebot`), then the\n * classic list. Returns the canonical spelling, or null.\n */\nexport function matchedCrawlerToken(userAgent: string): string | null {\n const agent = matchedAgentToken(userAgent);\n if (agent) return agent;\n if (!userAgent) return null;\n const s = userAgent.toLowerCase();\n return CLASSIC_CRAWLER_TOKENS.find((token) => s.includes(token.toLowerCase())) ?? null;\n}\n\n/**\n * Purpose category for an agent fetch, inferred from its published user-agent:\n * - `user` — a person asked an assistant to read the page, live (…-User UAs)\n * - `search` — indexing for an AI answer engine (…-SearchBot / SearchBot)\n * - `training` — model-training crawl (GPTBot, ClaudeBot, CCBot, …)\n * - `other` — not clearly AI, or an unknown/new token\n */\nexport type AgentIntent = 'user' | 'search' | 'training' | 'other';\n\n/** Intent per agent token. Maintained beside `agentUaList` — when you add or\n * rename a token above, set its intent here (a unit test enforces coverage). */\nexport const AGENT_INTENTS: Record<string, AgentIntent> = {\n 'GPTBot': 'training',\n 'ChatGPT-User': 'user',\n 'OAI-SearchBot': 'search',\n 'ClaudeBot': 'training',\n 'Claude-User': 'user',\n 'Claude-SearchBot': 'search',\n 'Claude-Agent': 'user',\n 'PerplexityBot': 'search',\n 'Perplexity-User': 'user',\n 'Google-Agent': 'user',\n 'Google-Extended': 'training',\n 'Applebot-Extended': 'training',\n 'Meta-ExternalAgent': 'training',\n 'Bytespider': 'training',\n 'CCBot': 'training',\n 'Amazonbot': 'other',\n 'cohere-ai': 'training',\n 'Diffbot': 'other',\n};\n\n/** Intent for a matched bot token (case-insensitive); `other` for null/unknown. */\nexport function agentIntent(botName: string | null): AgentIntent {\n if (!botName) return 'other';\n const hit = agentUaList.find((t) => t.toLowerCase() === botName.toLowerCase());\n return (hit && AGENT_INTENTS[hit]) || 'other';\n}\n\n/** `agentUaList` grouped by intent — the \"which crawlers do you classify?\" reference. */\nexport function classifiedAgents(): Record<AgentIntent, string[]> {\n const out: Record<AgentIntent, string[]> = { user: [], search: [], training: [], other: [] };\n for (const t of agentUaList) out[AGENT_INTENTS[t] ?? 'other'].push(t);\n return out;\n}\n\nexport function detectDeviceClass(userAgent: string): string {\n const s = userAgent.toLowerCase();\n if (/ipad|tablet|playbook|kindle|silk/.test(s)) return 'tablet';\n if (/mobi|iphone|ipod|android.*mobile|phone/.test(s)) return 'mobile';\n return 'desktop';\n}\n\nexport function detectTrafficSource(referrer: string, appOrigin?: string, siteDomain?: string | null): string {\n if (!referrer) return 'direct';\n try {\n const refUrl = new URL(referrer);\n if (appOrigin) {\n try {\n if (new URL(appOrigin).host === refUrl.host) return 'direct';\n } catch {\n /* ignore invalid appOrigin */\n }\n }\n const host = refUrl.hostname.toLowerCase();\n // Another host of the same site (the shared cookie domain): example.com →\n // app.example.com is a page view inside the site, scored like one.\n if (siteDomain && `.${host}`.endsWith(`.${siteDomain}`)) return 'direct';\n if (/(^|\\.)(google|bing|duckduckgo|yahoo)\\./.test(host)) return 'search';\n // Anchor to the registrable domain (exact host or a subdomain of it) so\n // hosts like `x.company.com`, `t.company.io` or `linkedinsights.com` are not\n // misclassified as social by an unbounded substring match.\n if (/(^|\\.)(twitter\\.com|x\\.com|facebook\\.com|linkedin\\.com|reddit\\.com|t\\.co)$/.test(host)) return 'social';\n return 'referral';\n } catch {\n return 'direct';\n }\n}\n\nexport function referrerDomainFromReferer(referrer: string): string | null {\n if (!referrer) return null;\n try {\n return new URL(referrer).hostname;\n } catch {\n return null;\n }\n}\n\n/**\n * Ad-platform click-ID query params worth keeping. An ALLOWLIST, unlike the\n * `utm_` prefix match: unknown query keys here are unbounded-cardinality junk\n * (session tokens, cache busters) that would bloat the sessions table, so only\n * the IDs the major ad platforms actually append survive.\n *\n * gclid / gbraid / wbraid — Google Ads auto-tagging (search, YouTube, Display;\n * gbraid/wbraid are the iOS-14 privacy variants)\n * fbclid — Meta (Facebook + Instagram). Appended to EVERY outbound Meta\n * click, paid and organic alike — it identifies the platform, never spend.\n * ttclid — TikTok Ads\n * msclkid — Microsoft Ads (Bing)\n * twclid — X/Twitter Ads\n * li_fat_id — LinkedIn Ads\n */\nexport const CLICK_ID_KEYS: readonly string[] = [\n 'gclid',\n 'gbraid',\n 'wbraid',\n 'fbclid',\n 'ttclid',\n 'msclkid',\n 'twclid',\n 'li_fat_id',\n];\n\n/**\n * Splits a URL query into the attribution params the session upsert carries:\n * every `utm_`-prefixed key, plus allowlisted ad click IDs (CLICK_ID_KEYS).\n * Accepts a raw search string (\"?a=b\" or \"a=b\"), a URLSearchParams, or a\n * Next.js `searchParams` object (whose values may be string arrays — the\n * first occurrence wins, matching URLSearchParams iteration order).\n * Node-safe: no DOM APIs.\n */\nexport function extractTrackedParams(\n search: string | URLSearchParams | Record<string, string | string[] | undefined>,\n): { utmParams: Record<string, string>; clickIds: Record<string, string> } {\n const utmParams: Record<string, string> = {};\n const clickIds: Record<string, string> = {};\n try {\n const entries: Iterable<[string, string]> =\n typeof search === 'string' || search instanceof URLSearchParams\n ? new URLSearchParams(search)\n : Object.entries(search).flatMap(([k, v]): Array<[string, string]> => {\n const first = Array.isArray(v) ? v[0] : v;\n return first === undefined ? [] : [[k, first]];\n });\n for (const [k, v] of entries) {\n // First occurrence wins for duplicates — a repeated gclid in a mangled\n // URL must not let the later value silently replace the real one.\n if (k.startsWith('utm_')) {\n if (!(k in utmParams)) utmParams[k] = v;\n } else if (CLICK_ID_KEYS.includes(k)) {\n if (!(k in clickIds)) clickIds[k] = v;\n }\n }\n } catch {\n /* malformed input → empty attribution, never a throw at init() */\n }\n return { utmParams, clickIds };\n}\n\nexport function detectTimeOfDay(d: Date): string {\n const h = d.getHours();\n if (h < 6) return 'night';\n if (h < 12) return 'morning';\n if (h < 18) return 'afternoon';\n return 'evening';\n}\n\nexport type SessionUpsertPayload = {\n sessionId: string;\n ephemeral: boolean;\n utmParams: Record<string, string>;\n /** Allowlisted ad-platform click IDs from the landing URL (CLICK_ID_KEYS). */\n clickIds: Record<string, string>;\n deviceClass: string;\n trafficSource: string;\n /** Landing page path, no query string (arrival classification). */\n landingPath?: string;\n referrerDomain: string | null;\n timeOfDay: string;\n dayOfWeek: string;\n /**\n * True when this session is likely driven by automation — either\n * `navigator.webdriver` was set, or the user-agent carried a known agent\n * token. Probabilistic: a flag for metrics + bandit exclusion, never a gate.\n */\n automation: boolean;\n /** Which crawler / AI assistant requested a server-rendered page (canonical\n * token). Absent for ordinary browsers. Naming only — never sets `automation`. */\n agentToken?: string;\n};\n\n/** Bandit segment key: `<device_class>:<traffic_source>`. */\nexport function deriveSessionSegment(opts?: {\n userAgent?: string;\n referer?: string;\n appOrigin?: string;\n}): string {\n const body = buildSessionUpsertPayload('__segment__', opts);\n return `${body.deviceClass}:${body.trafficSource}`;\n}\n\n/**\n * Builds a session upsert body aligned with the browser SDK so SSR assign uses\n * the same segment key (`device:source`) as the client after hydration.\n */\nexport function buildSessionUpsertPayload(\n sessionId: string,\n opts?: {\n userAgent?: string;\n referer?: string;\n appOrigin?: string;\n utmParams?: Record<string, string>;\n clickIds?: Record<string, string>;\n now?: Date;\n /** `navigator.webdriver` value from the browser, when available. */\n webdriver?: boolean;\n /** The landing page's path (no query string), when the caller knows it. */\n landingPath?: string;\n },\n): SessionUpsertPayload {\n const ua = opts?.userAgent?.trim() ?? '';\n const referer = opts?.referer?.trim() ?? '';\n const now = opts?.now ?? new Date();\n const agentToken = matchedCrawlerToken(ua);\n return {\n sessionId,\n ephemeral: false,\n utmParams: opts?.utmParams ?? {},\n clickIds: opts?.clickIds ?? {},\n deviceClass: ua ? detectDeviceClass(ua) : 'desktop',\n trafficSource: referer\n ? detectTrafficSource(referer, opts?.appOrigin)\n : 'direct',\n referrerDomain: referrerDomainFromReferer(referer),\n timeOfDay: detectTimeOfDay(now),\n dayOfWeek: ['sun', 'mon', 'tue', 'wed', 'thu', 'fri', 'sat'][now.getDay()] ?? 'sun',\n automation: opts?.webdriver === true || uaTokenMatch(ua),\n ...(agentToken ? { agentToken } : {}),\n ...(opts?.landingPath ? { landingPath: opts.landingPath.split(/[?#]/)[0] } : {}),\n };\n}\n","/**\n * Slot declaration helpers shared by the browser client (decide) and the\n * server preload path. Pure wrappers over @sentientui/policy.\n */\nimport {\n canonicalArm,\n slotBaselineArm,\n slotResultFor,\n type SlotDecl,\n type SlotResult,\n} from '@sentientui/policy';\n\n/** SDK-facing slot declaration. `dims` accepts readonly arrays (`as const`). */\nexport type SlotDeclInput = {\n id: string;\n arms?: string[];\n dims?: Record<string, readonly string[]>;\n baseline?: string | Record<string, string>;\n};\n\nexport type { SlotResult };\n\n/**\n * Whitelists the wire fields of a slot declaration. Anything an SDK layer\n * attached (goal configs, refs, …) is stripped so it never reaches the zod\n * schema on the API. Also normalizes readonly arrays to mutable ones.\n */\nexport function toWireSlot(d: SlotDeclInput): SlotDecl {\n return {\n id: d.id,\n ...(d.arms ? { arms: [...d.arms] } : {}),\n ...(d.dims\n ? {\n dims: Object.fromEntries(\n Object.entries(d.dims).map(([dim, values]) => [dim, [...values]]),\n ),\n }\n : {}),\n ...(d.baseline !== undefined ? { baseline: d.baseline } : {}),\n };\n}\n\n/** The declared (or default first-declared) baseline result for a slot. */\nexport function baselineResultFor(d: SlotDeclInput): SlotResult {\n const decl = toWireSlot(d);\n return slotResultFor(decl, slotBaselineArm(decl));\n}\n\n/** Baseline results for a whole declaration list, keyed by slot id. */\nexport function baselineSlots(decls: SlotDeclInput[]): Record<string, SlotResult> {\n const out: Record<string, SlotResult> = {};\n for (const d of decls) out[d.id] = baselineResultFor(d);\n return out;\n}\n\n/**\n * Canonical arm string of a slot result: dims results encode as sorted\n * `dim=value` pairs joined with '|'; arms results are the arm id verbatim.\n */\nexport function armOfResult(result: SlotResult): string {\n return typeof result === 'string' ? result : canonicalArm(result);\n}\n"],"mappings":"yCAYO,IAAMA,EAAiC,CAC5C,SACA,eACA,gBACA,YACA,cACA,mBAIA,eACA,gBACA,kBAGA,eACA,kBACA,oBACA,qBACA,aACA,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_a","s","token","CLASSIC_CRAWLER_TOKENS","matchedCrawlerToken","agent","AGENT_INTENTS","agentIntent","botName","hit","t","classifiedAgents","out","detectDeviceClass","detectTrafficSource","referrer","appOrigin","siteDomain","refUrl","e","host","referrerDomainFromReferer","CLICK_ID_KEYS","extractTrackedParams","search","utmParams","clickIds","entries","k","v","first","detectTimeOfDay","d","h","deriveSessionSegment","opts","body","buildSessionUpsertPayload","sessionId","_b","_c","_d","_e","_f","_g","_h","ua","referer","now","agentToken","__spreadValues","canonicalArm","slotBaselineArm","slotResultFor","toWireSlot","d","__spreadValues","dim","values","baselineResultFor","decl","slotResultFor","slotBaselineArm","baselineSlots","decls","out","armOfResult","result","canonicalArm"]}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as Ke,b as pe,c as ge,e as ie,f as Ee,g as Ne,h as Dt,i as Pt,j as Bt,k as Lt,l as Mt,m as Ge}from"./chunk-JNQY3XNF.mjs";import{a as Kt,e as Ce}from"./chunk-LCYGZNFI.mjs";import{b as $e,i as je,j as Ue,k as We,m as Fe,n as Ve,q as He,r as Ie,t as ze}from"./chunk-MDLYXFGL.mjs";import{a as ve,d as Ot,e as we}from"./chunk-WUFFNQHQ.mjs";import{a as v,b as te}from"./chunk-TMCGHANO.mjs";var qe;function Je(e){qe=typeof e=="string"&&e!==""?e:void 0}function Nt(e=document){if(qe)return qe;try{let s=e.querySelector("script[nonce]");return(s==null?void 0:s.nonce)||(s==null?void 0:s.getAttribute("nonce"))||void 0}catch(s){return}}function Xe(e,s=document){let g=Nt(s);return g&&e.setAttribute("nonce",g),e}var on=1800*1e3;function _e(e,s){return`${encodeURIComponent(e)}:${encodeURIComponent(s)}`}function Gt(e=on,s){let g=new Map,b=`_snt_asgn${ve(s)}_`,I=(a,i)=>`${b}${encodeURIComponent(a)}:${encodeURIComponent(i)}`,m=a=>{let i=a.slice(b.length),l=i.indexOf(":");if(l<0)return null;try{return{componentId:decodeURIComponent(i.slice(0,l)),segment:decodeURIComponent(i.slice(l+1))}}catch(w){return null}},x=()=>{try{let a=[];for(let i=0;i<localStorage.length;i++){let l=localStorage.key(i);l!=null&&l.startsWith(b)&&a.push(l)}return a}catch(a){return[]}},n=a=>a.assignedAt+(a.ttlMs&&a.ttlMs>0?a.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let a of x())try{let i=localStorage.getItem(a);if(!i)continue;let l=JSON.parse(i);if(n(l)){localStorage.removeItem(a);continue}let w=m(a);if(!w)continue;g.set(_e(w.componentId,w.segment),l)}catch(i){}})(),{get(a,i){let l=g.get(_e(a,i));return l?n(l)?(g.delete(_e(a,i)),null):l:null},set(a,i,l){let w=_e(a,i);g.set(w,l);try{localStorage.setItem(I(a,i),JSON.stringify(l))}catch(R){}},clear(){g.clear();for(let a of x())try{localStorage.removeItem(a)}catch(i){}}}}import{STAGE_KEYS as sn}from"@sentientui/policy";var Ye="data-sentient-stage";function Qe(e,s){return!s||typeof e!="string"||!(e==="returning"||sn.includes(e))?null:s!=="detailed"&&(e==="customer"||e==="lapsed")?"returning":e}function Ze(e,s=document){try{e?s.documentElement.setAttribute(Ye,e):s.documentElement.removeAttribute(Ye)}catch(g){}}import{confidenceBand as Ht}from"@sentientui/policy";import{confidenceBand as et}from"@sentientui/policy";var tt="[sentient] No API key configured \u2014 nothing is being learned. Set NEXT_PUBLIC_SENTIENT_API_KEY (Vite: VITE_SENTIENT_API_KEY) or localMode: true.",jt="[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.",$t=!1,xe=!1;function rn(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(s){return}}function Ut(e){var a;let s=Ce({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),g=(a=s.getSessionId())!=null?a:"local",b=rn(),I=import("@sentientui/core/local").then(i=>{let l=i;return l.LOCAL_ENGINE_AVAILABLE?($t||($t=!0,console.info(jt)),l):(xe||(xe=!0,console.error(tt)),null)}).catch(()=>(xe||(xe=!0,console.error(tt)),null)),m=null,x={low:.15,medium:.5,high:.85},n=(()=>{var l;if(e.initialPersona)return v({},e.initialPersona);let i=pe(e.apiKey||"local");return i?{persona:i.persona,confidence:(l=x[i.band])!=null?l:.15}:null})();function u(i){let l=document.documentElement;l.dataset.sentientPersona===void 0&&(l.dataset.sentientPersona=i.persona,l.dataset.sentientConfidence=et(i.confidence))}return{isLocal:!0,async decide(i){var R,L,K;let l=await I;if(!l)return null;let w=l.createLocalEngine({sessionId:g,forcedPersona:b}).decide(i);return m=te(v({},w),{layoutOrder:(L=(R=w.layoutOrder)!=null?R:m==null?void 0:m.layoutOrder)!=null?L:null,slots:v(v({},(K=m==null?void 0:m.slots)!=null?K:{}),w.slots)}),ge(e.apiKey||"local",{v:1,persona:m.persona,band:et(m.confidence),slots:m.slots,layoutOrder:m.layoutOrder,savedAt:Date.now()}),u(w),w},getSlotResult(i){var l,w,R;return(R=(w=m==null?void 0:m.slots[i])!=null?w:(l=e.initialSlots)==null?void 0:l[i])!=null?R:null},getSlotConfig(i){var l,w;return(w=(l=e.initialSlotConfig)==null?void 0:l[i])!=null?w:null},getSitePalette(){var i;return(i=e.initialPalette)!=null?i:null},reportSlots(){},getVisitorId:()=>null,getPersona(){let i=m!=null?m:n;return i?{persona:i.persona,confidence:i.confidence,band:et(i.confidence)}:null},async assign(i,l){var L;let w=await I;return!w||!l||l.length===0?l!=null&&l[0]?{variantId:l[0],assignmentTtlMs:0}:null:{variantId:(L=w.createLocalEngine({sessionId:g,forcedPersona:b}).decide({components:[{id:i,variantIds:l}]}).assignments[i])!=null?L:l[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>s.destroy()}}var Wt=/^(\*|\/[^\s?#*]*(\/\*)?)$/;function nt(e){let s=e.split(/[?#]/)[0]||"/";return s.length>1?s.replace(/\/+$/,"")||"/":s}function an(e,s){if(e===void 0||!Wt.test(e))return!1;if(e==="*")return!0;let g=nt(s);if(e.endsWith("/*")){let b=nt(e.slice(0,-2));return g.startsWith(b==="/"?"/":`${b}/`)&&g!==b}return g===nt(e)}function ln(e,s){if(!e)return!1;if(e==="/")return s==="/";let g=e.endsWith("/")?e.slice(0,-1):e;return s===g||s.startsWith(`${g}/`)}function cn(e){if(!/^https?:\/\//i.test(e))return e;try{return new URL(e).pathname||"/"}catch(s){return e}}var Ln=["none","sm","md","lg"],Mn=["start","center","end","stretch"],Kn=["start","center","end","between"],Nn=["sm","md","lg"],Gn=["normal","medium","bold"],$n=["default","muted","accent"],jn=["primary","secondary","ghost"],Un=["left","center","right"],Wn=["auto","square","landscape","wide"],Fn=["cover","contain"],Vn=[2,3,4],Hn=[1,2,3,4],zn=["default","raised"],qn=["none","sm","md","lg"],Jn=["measure"],Xn=["input","textarea","select"],Yn=["text","email","number","tel"],Qn=5,Zn=8,eo=64,to=5,no=12,oo=4,so=500;function dn(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let s=e;return s.type==="form"?!0:Array.isArray(s.children)?s.children.some(dn):!1}var ot="sentient-reveal",ae="sentient-revealed",Ft=240,Ae=!1;function un(){var e;Ae=!1,typeof document!="undefined"&&((e=document.getElementById(ot))==null||e.remove())}function pn(e){if(Ae||e.getElementById(ot)){Ae=!0;return}let s=Xe(e.createElement("style"),e);s.id=ot,s.textContent=`@media (prefers-reduced-motion: no-preference){@keyframes ${ae}{from{opacity:.55;transform:translateY(2px)}to{opacity:1;transform:none}}.${ae}{animation:${ae} ${Ft}ms cubic-bezier(.2,.6,.2,1) both}}`,e.head.appendChild(s),Ae=!0}function gn(e,s={}){var I;let g=(I=s.doc)!=null?I:typeof document!="undefined"?document:void 0;if(!g||!(e instanceof Element)||(s.arm!==void 0&&e.setAttribute("data-sentient-arm",s.arm),s.persona!==void 0&&e.setAttribute("data-sentient-persona",s.persona),s.previous!==void 0&&s.previous===e.textContent))return!1;pn(g),e.classList.remove(ae),e.offsetWidth,e.classList.add(ae);let b=()=>{e.classList.remove(ae),e.removeEventListener("animationend",b)};return e.addEventListener("animationend",b),!0}function fn(e,s,g,b){let I=[];{let n=!1,u=[],a=()=>{if(n)return;let i=Date.now();for(u.push(i);u.length>0&&i-u[0]>500;)u.shift();u.length>=3&&(n=!0,e("rage_click"))};s.addEventListener("click",a),I.push(()=>s.removeEventListener("click",a))}{let m=!1,x=n=>{if(m||!(n.target instanceof Node)||!s.contains(n.target)&&s!==n.target)return;m=!0;let u=typeof window!="undefined"?window.getSelection():null,a=u?u.toString().length:0;e("text_copy",{selectionLength:a})};document.addEventListener("copy",x),I.push(()=>document.removeEventListener("copy",x))}{let m=!1,x=!1,n=null,u=()=>{n!==null&&(clearTimeout(n),n=null)},a=()=>{m||!x||(u(),n=setTimeout(()=>{!m&&x&&(m=!0,e("scroll_hesitation"))},3e3))},i=()=>{u(),a()},l=R=>{for(let L of R)x=L.intersectionRatio>.3,x?a():u()},w=new IntersectionObserver(l,{threshold:[.3]});w.observe(s),window.addEventListener("scroll",i,{passive:!0}),I.push(()=>{w.disconnect(),window.removeEventListener("scroll",i),u()})}if((b==null?void 0:b.tabLoss)!==!1){let m=!1,x=g!=null?g:Date.now(),n=()=>{if(m||document.visibilityState!=="hidden")return;let u=Date.now()-x;u<15e3&&(m=!0,e("tab_loss",{timeOnPage:u}))};document.addEventListener("visibilitychange",n),I.push(()=>document.removeEventListener("visibilitychange",n))}return()=>{for(let m of I)m()}}function mn(){try{return process.env.NODE_ENV!=="production"}catch(e){return!0}}var Jt="https://api.sentient-ui.com/v1/events",zt=()=>import("@sentientui/core/internal-traffic"),F=new Map,Xt=null;function Go(e,s){let g=F.get(e);g&&g.upgrade&&(g.reinit=s)}function yn(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Sn=3;function rt(){return Kt()}function Re(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function hn(){let e=new WeakMap,s=new Map,g=!1,b=(n,u,a)=>{let i=n.get(u);return a===null?i?!0:(n.set(u,new Set),!1):i?i.has(a)?!0:(i.add(a),!1):(n.set(u,new Set([a])),!1)},I=typeof window!="undefined"&&"event"in window,m=()=>{if(!I)return;let n=window.event;return typeof Event=="function"&&n instanceof Event?n:void 0},x=()=>{if(I){Promise.resolve().then(()=>{g=!1,s.clear()});return}let n=!1,u=()=>{n||(n=!0,g=!1,s.clear())};if(setTimeout(u,0),typeof MessageChannel=="function"){let a=new MessageChannel;a.port1.onmessage=()=>{a.port1.close(),a.port2.close(),u()},a.port2.postMessage(0)}};return{firedBefore(n,u){let a=m();if(a){let l=e.get(a);return l||(l=new Map,e.set(a,l)),b(l,n,u)}let i=b(s,n,u);return!i&&!g&&(g=!0,x()),i}}}var Yt=new Set;function kn(e,s,g){let b=typeof window=="undefined"?null:window.history;if(!b)return()=>{};let I=!1,m,x=()=>{if(I)return;let a=Re();!a||a===m||(m=a,e.track({projectId:s,componentId:"__page__",eventType:"pageview",payload:{}}),g(`${s}:${a}`))},n=[];for(let a of["pushState","replaceState"]){let i=b[a],l=function(...w){let R=i.apply(this,w);return x(),R};b[a]=l,n.push([a,i,l])}window.addEventListener("popstate",x);let u=Re();return u&&Yt.has(`${s}:${u}`)?m=u:x(),()=>{if(!I){I=!0,window.removeEventListener("popstate",x);for(let[a,i,l]of n)b[a]===l&&(b[a]=i)}}}var fe={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,assign:()=>Promise.resolve(null),decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}};function bn(){try{return Fe(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function Qt(e){return e.replace(/\/events\/?$/,"")}function Zt(){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(s=>s==="1"||s==="yes")}function $o(e){var u;if(typeof window=="undefined")return;let s=e!=null?e:Xt;if(!s){console.warn("[sentient] grantConsent() called before init()");return}let g=F.get(s);if(!g){console.warn("[sentient] grantConsent() called before init()");return}let{config:b,upgrade:I,reinit:m}=g;if(!I){g.upgradeBlockedReason&&console.warn(g.upgradeBlockedReason);return}if(b.respectDoNotTrack!==!1&&Zt())return;let x=(m!=null?m:wn)(te(v({},b),{consent:!0}));I(x);let n=(u=F.get(s))==null?void 0:u.dispose;F.set(s,{config:te(v({},b),{consent:!0}),upgrade:null,dispose:n})}function vn(e,s){var ye;let g=e.preConsentBehavior==="statistical_winner",b=Qt((ye=e.ingestUrl)!=null?ye:Jt),I={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},m=new Map,x=new Map,n={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(r,c,E){if(!g)return Promise.resolve(null);let T=m.get(r);return T?Promise.resolve(T):at(x,r,async()=>{try{let _=new URLSearchParams({componentId:r});for(let q of c!=null?c:[])_.append("variantIds[]",q);let G=ie(5e3),W;try{let q=await fetch(`${b}/winner?${_.toString()}`,{headers:I,signal:G.signal});if(!q.ok)return c!=null&&c[0]?{variantId:c[0],assignmentTtlMs:0}:null;W=await q.json()}finally{G.clear()}let $={variantId:W.variantId,assignmentTtlMs:0};return m.set(r,$),$}catch(_){return c!=null&&c[0]?{variantId:c[0],assignmentTtlMs:0}:null}})},decide:()=>Promise.resolve(null),getSlotResult:()=>null,getSlotConfig:()=>null,getSitePalette:()=>null,reportSlots:()=>{},getPersona:()=>null,getVisitorId:()=>null,getGraph:()=>({pageNodes:[],capturedAt:0}),flush:()=>{},dispose:()=>{},destroy:()=>{}},u=!1,a=new Set,i=[],l=[],w=[],R=()=>{for(let[,,r]of w.splice(0))r(null);L.length=0},L=[],K=!1,ee=()=>{if(u)return;K=!0;let r=F.get(e.apiKey);(r==null?void 0:r.upgrade)===le&&F.set(e.apiKey,{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): client released before consent; call init() again"})},N=[],V=()=>{setTimeout(()=>{var r;try{(r=N.shift())==null||r(n)}catch(c){}N.length&&V()})},me=r=>{u?N.length?N.push(r):r(n):!s&&!K&&L.length<100?L.push(r):K&&e.debug&&console.warn("[sentient] goal dropped: client released")},se={get gated(){return!u&&!s},get released(){return K&&!u},takeHeld:()=>L.splice(0),track:r=>n.track(r),goal:((r,c,E,T)=>me(_=>_.goal(r,c,E,T))),componentGoal:(r,c,E)=>n.componentGoal(r,c,E),identify:(r,c)=>n.identify(r,c),getAssignment:(r,c)=>n.getAssignment(r,c),isUnified:r=>{var c,E;return(E=(c=n.isUnified)==null?void 0:c.call(n,r))!=null?E:!1},assign:(r,c,E,T,_)=>n.assign(r,c,E,T,_),decide:r=>u?n.decide(r):K||s?Promise.resolve(null):new Promise(c=>w.push([r,qt(),c])),getSlotResult:r=>n.getSlotResult(r),isSlotDecided:r=>{var c,E;return(E=(c=n.isSlotDecided)==null?void 0:c.call(n,r))!=null?E:!0},getSlotConfig:r=>n.getSlotConfig(r),getSitePalette:()=>n.getSitePalette(),getStyleVocabulary:()=>{var r,c;return(c=(r=n.getStyleVocabulary)==null?void 0:r.call(n))!=null?c:null},reportSlots:(r,c,E,T)=>n.reportSlots(r,c,E,T),reportSkeleton:(r,c)=>{var E;return(E=n.reportSkeleton)==null?void 0:E.call(n,r,c)},reportAgentData:(r,c,E)=>{var T;return(T=n.reportAgentData)==null?void 0:T.call(n,r,c,E)},reportDrift:(r,c,E,T)=>{var _;return(_=n.reportDrift)==null?void 0:_.call(n,r,c,E,T)},requestSlots:(r,c,E)=>{var T;return u?(T=n.requestSlots)==null?void 0:T.call(n,r,c,E):i.push([r,c,E])},decideSlots:r=>{var c;return u?(c=n.decideSlots)==null?void 0:c.call(n,r):l.push(...r)},cancelSlots:r=>{var E;if(u)return(E=n.cancelSlots)==null?void 0:E.call(n,r);let c=new Set(r);for(let T of i)T[0]=T[0].filter(_=>!c.has(_));l=l.filter(T=>!c.has(T.id))},onSlotsChanged:r=>(a.add(r),()=>{a.delete(r)}),getPersona:()=>n.getPersona(),getVisitorId:()=>{var r,c;return(c=(r=n.getVisitorId)==null?void 0:r.call(n))!=null?c:null},fetchWeights:()=>n.fetchWeights(),getGraph:()=>n.getGraph(),flush:()=>n.flush(),dispose:()=>(ee(),R(),n.dispose()),destroy:()=>(ee(),R(),u?n.destroy():Ge(e.apiKey))};function le(r){var E,T,_;n=r,u=!0,L.length&&(N.push(...L.splice(0)),V());let c=qt();for(let[G,W,$]of w.splice(0))W!==c?$(null):r.decide(G).then($,()=>$(null));(E=r.onSlotsChanged)==null||E.call(r,()=>a.forEach(G=>G()));for(let[G,W,$]of i.splice(0))G.length>0&&((T=r.requestSlots)==null||T.call(r,G,W,$));l.length>0&&((_=r.decideSlots)==null||_.call(r,l.splice(0)))}return{proxy:se,setInner:le}}function qt(){return typeof location=="undefined"?"":location.pathname+(/^#!?\//.test(location.hash)?location.hash:"")}function at(e,s,g){let b=e.get(s);if(b)return b;let I=(async()=>{try{return await g()}finally{e.delete(s)}})();return e.set(s,I),I}function wn(e){var ht,kt,bt,vt,wt,Et,Ct,It,_t,xt,At;if(typeof window=="undefined")return fe;e.nonce&&Je(e.nonce),Xt=e.apiKey||"local";let s=F.get(e.apiKey||"local");if(s!=null&&s.dispose)try{s.dispose()}catch(t){}let g=e.respectDoNotTrack!==!1&&Zt(),b=e.consent===!1||g,I=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!I&&e.localMode!==!1)return F.set(e.apiKey||"local",{config:e,upgrade:null,upgradeBlockedReason:"[sentient] grantConsent(): this client is keyless/local \u2014 there is no hosted client to upgrade to. Configure a pk_ API key to enable tracking."}),b?fe:Ut(e);if(b){if(!e.apiKey||!e.apiKey.startsWith("pk_"))return e.preConsentBehavior==="statistical_winner"&&console.warn("[sentient] init() called with an invalid apiKey \u2014 expected a pk_ public key. SDK disabled."),F.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."}),fe;let{proxy:t,setInner:o}=vn(e,g);return F.set(e.apiKey,{config:e,upgrade:g?null:o}),t}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."),fe;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),fe;let m=(ht=e.ingestUrl)!=null?ht:Jt,x=Date.now(),n=Ce({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey,cookieDomain:e.cookieDomain}),u={},a;try{/sentient_internal=/.test(location.search+document.cookie)&&(a=zt().then(async t=>{u.internalToken=await t.takeInternalToken(n.domain)||void 0}).catch(()=>{})),(typeof e.internal=="function"?e.internal():e.internal)===!0&&(u.internal=!0)}catch(t){}let i=Gt(void 0,e.apiKey),l=!1,w=we(e.apiKey),R=()=>!l&&we(e.apiKey)===w,L=new Set((kt=e.initialUnified)!=null?kt:[]),K=te(v({},i),{get:(t,o)=>L.has(t)?null:i.get(t,o),set:(...t)=>{R()&&i.set(...t)}}),ee=Bt({ingestUrl:m,apiKey:e.apiKey}),N=Qt(m),V={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},me=new Set,se=Mt({url:`${N}/goals`,apiKey:e.apiKey,headers:V,onDrop:(t,o)=>{if(!e.debug){if(me.has(o))return;me.add(o)}console.warn(`[sentient] goal dropped (HTTP ${o}) \u2014 this will not be retried. `+(o===400?"The session was not found: call init() and let the session upsert complete before firing goals.":o===401||o===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),t)}}),le=je((bt=navigator.userAgent)!=null?bt:""),ye=window.location.origin,r=Ue((vt=document.referrer)!=null?vt:"",ye,n.domain),c=(wt=e.sessionSegment)!=null?wt:`${le}:${r}`,E=new Map,T=new Map,_=new Map,G=new Set,W=new Map,$=null,q=null,j=null,lt=new Set,Se=new Set,Te=new Map,Oe=new Map,ct=new Set,dt=new Set,ut=new Set,pt=new Set,De=null,ce=/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,127}$/,gt=new Set,he=new Set,ke=new Set,de=new Map,Pe=null,be=new Set,ue=new Map,Be=null,en=2,ft=new Map,X=!1,mt=(t,o,d)=>{var p;let S=new Set,k=1;for(let f of t){o.delete(f);let y=((p=ft.get(f))!=null?p:0)+1;ft.set(f,y),y<=en&&(S.add(f),y>k&&(k=y))}S.size>0&&setTimeout(()=>{X||d(S)},Ne(k))},Le=t=>{for(let o of t)_.has(o.id)||_.set(o.id,Ie(o))};if(e.initialSlots)for(let[t,o]of Object.entries(e.initialSlots))_.set(t,o),G.add(t);if(e.initialSlotConfig)for(let[t,o]of Object.entries(e.initialSlotConfig))W.set(t,o);e.initialPalette&&($=e.initialPalette),e.initialVocabulary&&(q=e.initialVocabulary);let Y=pe(e.apiKey);if(Y){for(let[t,o]of Object.entries(Y.slots))_.has(t)||_.set(t,o);for(let[t,o]of Object.entries((Et=Y.slotConfig)!=null?Et:{}))W.has(t)||W.set(t,o);!$&&Y.palette&&($=Y.palette),!q&&Y.vocabulary&&(q=Y.vocabulary)}let yt={low:.15,medium:.5,high:.85};if(e.initialPersona)j=v({},e.initialPersona);else{let t=document.documentElement.dataset;t.sentientPersona?j={persona:t.sentientPersona,confidence:(It=yt[(Ct=t.sentientConfidence)!=null?Ct:"low"])!=null?It:.15}:Y&&(j={persona:Y.persona,confidence:(_t=yt[Y.band])!=null?_t:.15})}if(e.initialAssignments)for(let[t,o]of Object.entries(e.initialAssignments))K.set(t,c,{variantId:o,assignedAt:Date.now(),segment:c,confidence:1});let ne=Promise.resolve(),St=n.getSessionId();if(St){let t=We((xt=document.referrer)!=null?xt:""),{utmParams:o,clickIds:d}=bn(),S=v(v(v(v({sessionId:St,deviceClass:le,trafficSource:r,referrerDomain:t,utmParams:o,clickIds:d,landingPath:typeof location!="undefined"?location.pathname:void 0,timeOfDay:Ve(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:n.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||$e((At=navigator.userAgent)!=null?At:"")},e.userId?{userId:e.userId,userHash:e.userHash}:{}),e.persona?{persona:e.persona}:{}),e.country?{country:e.country}:{}),e.sdk?{sdk:e.sdk.name,sdkVersion:e.sdk.version}:{}),k=async()=>{a&&await Ee(a,2500);for(let p=0;;p++){if(X||!R())return;let f=ie(5e3);try{let y=await fetch(`${N}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(Object.assign(S,u)),headers:V,signal:f.signal});if(y.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(y.ok||Dt(y)==="dropped")return}catch(y){}finally{f.clear()}if(p>=Sn){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(y=>setTimeout(y,Ne(p+1)))}};try{ne=k()}catch(p){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:ee});let tn=hn(),oe=null,Me=!1,M={goal(t,o={},d=1,S=0){var B,A,H,J,z,U,h;let k=n.getSessionId();if(!k||X||!R())return;let p=yn(o)?o:{metadata:o},f=[t,(B=p.externalId)!=null?B:"",(A=p.stepIndex)!=null?A:S,(H=p.weight)!=null?H:d].join("\0"),y=p.value!==void 0?`${p.value}\0${(J=p.currency)!=null?J:""}`:null;if(tn.firedBefore(f,y)){e.debug&&console.log(`[sentient] goal("${t}") already recorded for this action \u2014 not sent twice`);return}let O=rt(),C={sessionId:k,name:t,metadata:(z=p.metadata)!=null?z:{},weight:(U=p.weight)!=null?U:d,stepIndex:(h=p.stepIndex)!=null?h:S,goalId:O,value:p.value,currency:p.currency,externalId:p.externalId};e.debug&&console.log("[sentient] goal",C);let D={id:O,body:JSON.stringify(C)};ne.then(()=>se.send(D))},componentGoal(t,o,d){var O,C,D;let S=n.getSessionId();if(!S||X||!R())return;let k=K.get(t,c),p=k?null:(O=_.get(t))!=null?O:null;if(!k&&p===null){e.debug&&console.warn(`[sentient] componentGoal("${t}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}if(!k&&!G.has(t)){e.debug&&console.warn(`[sentient] componentGoal("${t}"): slot not decided this session \u2014 not attributed`);return}let f=k?k.variantId:ze(p),y={id:rt(),sessionId:S,projectId:e.apiKey,componentId:t,variantId:f,eventType:"goal_achieved",goalType:o,payload:v({reward:(C=d==null?void 0:d.reward)!=null?C:1,goalValue:d==null?void 0:d.value,currency:d==null?void 0:d.currency},(D=d==null?void 0:d.metadata)!=null?D:{}),timestamp:Date.now(),timeInSession:Date.now()-x,path:Re()};e.debug&&console.log("[sentient] componentGoal",y),ne.then(()=>{!X&&R()&&ee.push(y)})},identify(t,o){let d=n.getSessionId();if(!d||X||!R())return;let S=(o==null?void 0:o.email)!==void 0?zt().then(k=>k.emailFields(o.email)).catch(()=>({})):{};Promise.all([ne,S]).then(([,k])=>{fetch(`${N}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(te(v(v({sessionId:d,userId:t,userHash:o==null?void 0:o.userHash},k),u),{ephemeral:n.isEphemeral()})),headers:V}).catch(()=>{})})},track(t){let o=n.getSessionId();if(!o||X||!R()||t.eventType==="variant_assigned"&&_.get(t.componentId)!==void 0&&!G.has(t.componentId)&&!K.get(t.componentId,c))return;let d=te(v({path:Re()},t),{id:rt(),sessionId:o,timestamp:Date.now(),timeInSession:Date.now()-x});e.debug&&console.log("[sentient] track",d),ne.then(()=>ee.push(d))},getAssignment(t,o){return K.get(t,o)},isUnified:t=>L.has(t),async assign(t,o,d,S,k){var O;let p=n.getSessionId();if(!p)return null;let f=(k==null?void 0:k.unified)===!0;if(f&&L.has(t))return{variantId:(O=o==null?void 0:o[0])!=null?O:"",assignmentTtlMs:0,unified:!0};let y=K.get(t,c);if(y&&(o!=null&&o.length||y.content!==void 0)){let C=y.ttlMs&&y.ttlMs>0?Math.max(0,y.assignedAt+y.ttlMs-Date.now()):0;return{variantId:y.variantId,assignmentTtlMs:C,content:y.content}}return at(E,f?`${t}\0unified`:t,async()=>{if(!await Ee(ne,2500)||X||!R())return null;let C=ie(3e4);try{let D={sessionId:p,componentId:t,variantIds:o};S!==void 0?D.agentDataByVariant=S:d!==void 0&&(D.agentData=d),f&&(D.caps={unified:!0});let B=await fetch(`${N}/assign`,{method:"POST",body:JSON.stringify(D),headers:V,signal:C.signal});if(!B.ok)return null;let A=await B.json();return A.unified===!0?f?(L.add(t),{variantId:A.variantId,assignmentTtlMs:0,unified:!0}):null:(K.set(t,c,v({variantId:A.variantId,assignedAt:Date.now(),segment:c,confidence:1,content:A.content},A.assignmentTtlMs&&A.assignmentTtlMs>0?{ttlMs:A.assignmentTtlMs}:{})),A)}catch(D){return null}finally{C.clear()}})},async decide(t){var p,f;let o=n.getSessionId();if(!o)return null;let d=(p=t.slots)!=null?p:[],S={sessionId:o};t.sections&&t.sections.length>0&&(S.sections=t.sections.map(y=>({id:y}))),S.components=(f=t.components)!=null?f:[],d.length>0&&(S.slots=d.map(He)),t.slotsFrom==="registry"&&(S.slotsFrom="registry",t.registrySlotIds&&(S.registrySlotIds=t.registrySlotIds),t.bootstrap===!1&&(S.bootstrap=!1),t.render&&Object.keys(t.render).length>0&&(S.render=t.render)),t.v&&(S.v=t.v),typeof t.pp=="number"&&(S.pp=t.pp),e.persona&&(S.persona=e.persona),Object.assign(S,u);let k=JSON.stringify(S);return at(T,k,async()=>{var O,C,D,B,A,H,J,z;if(!await Ee(ne,2500)||X||!R())return Le(d),null;let y=ie(3e4);try{let U=await fetch(`${N}/decide`,{method:"POST",body:k,headers:V,signal:y.signal});if(!U.ok)return Le(d),null;let h=await U.json(),Q=Qe(h.stage,e.stageAttributes);e.stageAttributes&&Ze(Q);let re={};for(let P of d){let Z=(O=h.slots)==null?void 0:O[P.id];if(Z!==void 0){re[P.id]=Z,_.set(P.id,Z),G.add(P.id);continue}let Rt=_.get(P.id);if(Rt!==void 0)re[P.id]=Rt;else{let Tt=Ie(P);re[P.id]=Tt,_.set(P.id,Tt)}}if(h.slots)for(let[P,Z]of Object.entries(h.slots))P in re||(re[P]=Z,_.set(P,Z),G.add(P));let nn=j!=null&&j.persona!=="unknown";h.persona&&!(h.persona==="unknown"&&nn)?j={persona:h.persona,confidence:(C=h.confidence)!=null?C:0}:j||(j={persona:"unknown",confidence:0});for(let[P,Z]of Object.entries((D=h.assignments)!=null?D:{}))K.set(P,c,{variantId:Z,assignedAt:Date.now(),segment:c,confidence:1});if(h.slotConfig)for(let[P,Z]of Object.entries(h.slotConfig))W.set(P,Z);h.palette&&($=h.palette),h.vocabulary&&(q=h.vocabulary);for(let P of(B=t.registrySlotIds)!=null?B:[])(A=h.slotConfig)!=null&&A[P]||(W.delete(P),_.delete(P),G.delete(P));return R()&&ge(e.apiKey,v(v(v(v({v:1,persona:j.persona,band:Ht(j.confidence),slots:Object.fromEntries(_),layoutOrder:(H=h.layoutOrder)!=null?H:null,savedAt:Date.now()},W.size>0?{slotConfig:Object.fromEntries(W)}:{}),$?{palette:$}:{}),q?{vocabulary:q}:{}),Q?{stage:Q}:{})),v(v(v(v(v(v(v({layoutOrder:(J=h.layoutOrder)!=null?J:null,assignments:(z=h.assignments)!=null?z:{},slots:re,persona:j.persona,confidence:j.confidence},h.slotConfig?{slotConfig:h.slotConfig}:{}),h.goals?{goals:h.goals}:{}),h.sectionMap?{sectionMap:h.sectionMap}:{}),h.palette?{palette:h.palette}:{}),h.vocabulary?{vocabulary:h.vocabulary}:{}),h.stage?{stage:h.stage}:{}),h.context?{context:h.context}:{})}catch(U){return Le(d),null}finally{y.clear()}})},getSlotResult(t){var o;return(o=_.get(t))!=null?o:null},isSlotDecided(t){return G.has(t)},getSlotConfig(t){var o;return(o=W.get(t))!=null?o:null},reportSlots(t,o,d,S){var p;let k={};for(let[f,y]of Object.entries(S!=null?S:{}))for(let O of y){let C=`${f}|${O.key}`;!ce.test(f)||ut.has(C)||(ut.add(C),((p=k[f])!=null?p:k[f]=[]).push(O))}Object.keys(k).length>0&&fetch(`${N}/slots/observed`,{method:"POST",headers:V,body:JSON.stringify({slotIds:Object.keys(k),authoredArms:k})}).catch(()=>{});for(let f of t)if(!(typeof f!="string"||f.length===0)){if(!ce.test(f)){mn()&&!gt.has(f)&&(gt.add(f),console.warn(`[sentient] reportSlots: slot id ${JSON.stringify(f)} 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(!lt.has(f)){lt.add(f),Se.add(f);let y=o==null?void 0:o[f];if(typeof y=="string"){let C=y.replace(/\s+/g," ").trim().slice(0,400);C!==""&&Te.set(f,C)}let O=d==null?void 0:d[f];O!==void 0&&Oe.set(f,O)}}Se.size===0||De!=null||(De=setTimeout(()=>{De=null;let f=[...Se];Se.clear();for(let y=0;y<f.length;y+=20){let O=f.slice(y,y+20),C={},D={};for(let B of O){let A=Te.get(B);A!==void 0&&(C[B]=A,Te.delete(B));let H=Oe.get(B);H!==void 0&&(D[B]=H,Oe.delete(B))}fetch(`${N}/slots/observed`,{method:"POST",headers:V,body:JSON.stringify(v(te(v(v({slotIds:O},Object.keys(C).length>0?{baselineTexts:C}:{}),Object.keys(D).length>0?{baselineSkeletons:D}:{}),{pagePaths:Object.fromEntries(O.map(B=>[B,location.pathname]))}),Object.keys(C).length>0&&n.getSessionId()?{sessionId:n.getSessionId()}:{}))}).catch(()=>{})}},1e3))},reportSkeleton(t,o){!ce.test(t)||ct.has(t)||(ct.add(t),fetch(`${N}/slots/observed`,{method:"POST",headers:V,body:JSON.stringify({slotIds:[t],baselineSkeletons:{[t]:o}})}).catch(()=>{}))},reportAgentData(t,o,d){let S=`${t}|${o}`;!ce.test(t)||pt.has(S)||(pt.add(S),fetch(`${N}/slots/observed`,{method:"POST",headers:V,body:JSON.stringify(v(v({slotIds:[t],agentData:{[t]:{[o]:d}}},o.startsWith("authored.")?{authoredArms:{[t]:[{key:o.slice(9)}]}}:{}),n.getSessionId()?{sessionId:n.getSessionId()}:{}))}).catch(()=>{}))},reportDrift(t,o,d,S){let k=`${t}|${o}`,p=n.getSessionId();!p||dt.has(k)||(dt.add(k),fetch(`${N}/slots/drift`,{method:"POST",headers:V,body:JSON.stringify({sessionId:p,reports:[{slotId:t,expectedFp:o,observedFp:d,reason:S}]})}).catch(()=>{}))},requestSlots(t,o,d){var S,k;for(let p of t)ke.has(p)||(ke.add(p),ce.test(p)?de.set(p,{text:o==null?void 0:o[p],render:(S=d==null?void 0:d.render)==null?void 0:S[p],skeleton:(k=d==null?void 0:d.skeletons)==null?void 0:k[p]}):M.reportSlots([p]));de.size===0||Pe!=null||(Pe=setTimeout(()=>{Pe=null;let p=[...de];de.clear();for(let f=0;f<p.length;f+=50){let y=p.slice(f,f+50),O={};for(let[C,D]of y)D.render&&(O[C]=D.render);M.decide({slotsFrom:"registry",registrySlotIds:y.map(([C])=>C),bootstrap:!1,render:O}).then(C=>{var D,B;if(C){let A={},H={},J=[];for(let[z,U]of y){let h=(D=C.slotConfig)==null?void 0:D[z];if(h){h.needsSkeleton&&U.skeleton&&((B=M.reportSkeleton)==null||B.call(M,z,U.skeleton));continue}J.push(z),U.text&&(A[z]=U.text),U.skeleton&&(H[z]=U.skeleton)}J.length>0&&M.reportSlots(J,A,H)}else mt(y.map(([A])=>A),ke,A=>{var U;let H={},J={},z={};for(let[h,Q]of y)A.has(h)&&(Q.text&&(H[h]=Q.text),Q.render&&(J[h]=Q.render),Q.skeleton&&(z[h]=Q.skeleton));(U=M.requestSlots)==null||U.call(M,[...A],H,{render:J,skeletons:z})});he.forEach(A=>A())})}},0))},decideSlots(t){for(let o of t)be.has(o.id)||(be.add(o.id),ue.set(o.id,o));ue.size===0||Be!=null||(Be=setTimeout(()=>{Be=null;let o=[...ue.values()];ue.clear();for(let d=0;d<o.length;d+=30){let S=o.slice(d,d+30);M.decide({slots:S}).then(k=>{k||mt(S.map(p=>p.id),be,p=>{var f;return(f=M.decideSlots)==null?void 0:f.call(M,S.filter(y=>p.has(y.id)))}),he.forEach(p=>p())})}},0))},cancelSlots(t){for(let o of t)de.delete(o)&&ke.delete(o),ue.delete(o)&&be.delete(o)},onSlotsChanged(t){return he.add(t),()=>{he.delete(t)}},getStyleVocabulary(){return q},getSitePalette(){return $},getVisitorId:()=>R()?n.getSessionId():null,getPersona(){return j?{persona:j.persona,confidence:j.confidence,band:Ht(j.confidence)}:null},async fetchWeights(){var o;let t=ie(5e3);try{let d=await fetch(`${N}/weights`,{headers:V,signal:t.signal});return d.ok?(o=(await d.json()).components)!=null?o:[]:[]}catch(d){return[]}finally{t.clear()}},getGraph(){return{pageNodes:[],capturedAt:0}},flush(){ee.flush(),se.flush()},dispose(){var t;oe==null||oe(),Me=!0,X=!0,ee.destroy(),se.destroy(),((t=F.get(e.apiKey))==null?void 0:t.dispose)===M.dispose&&F.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var t;oe==null||oe(),Me=!0,X=!0,l=!0,Ot(e.apiKey),ee.destroy({forget:!0}),se.destroy({forget:!0}),n.destroy(),K.clear(),((t=F.get(e.apiKey))==null?void 0:t.dispose)===M.dispose&&F.delete(e.apiKey);try{localStorage.removeItem(Ke+e.apiKey),localStorage.removeItem(Pt(e.apiKey)),localStorage.removeItem(Lt(e.apiKey)),localStorage.removeItem(`_snt_graph_nodes${ve(e.apiKey)}`),localStorage.removeItem("_snt_graph_edges")}catch(o){}e.debug&&console.log("[sentient] destroyed")}};if(F.set(e.apiKey,{config:e,upgrade:null,dispose:M.dispose}),oe=kn(M,e.apiKey,t=>{ne.then(()=>{Me||Yt.add(t)})}),e.debug){let t=window;t.__sentient&&(t.__sentient.client=M)}return M}export{Je as a,Nt as b,Xe as c,Ye as d,Qe as e,Ze as f,tt as g,jt as h,Wt as i,an as j,ln as k,cn as l,Ln as m,Mn as n,Kn as o,Nn as p,Gn as q,$n as r,jn as s,Un as t,Wn as u,Fn as v,Vn as w,Hn as x,zn as y,qn as z,Jn as A,Xn as B,Yn as C,Qn as D,Zn as E,eo as F,to as G,no as H,oo as I,so as J,dn as K,Ft as L,un as M,gn as N,fn as O,Go as P,Zt as Q,$o as R,qt as S,wn as T};
|
|
2
|
+
//# sourceMappingURL=chunk-OT77D5DV.mjs.map
|