@sentientui/core 0.27.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.
- package/dist/chunk-HY23LTUY.mjs +2 -0
- package/dist/chunk-HY23LTUY.mjs.map +1 -0
- package/dist/{index-NqZbPgmm.d.ts → index-B0PkJoeB.d.cts} +61 -4
- package/dist/{index-B5b5LlRJ.d.cts → index-BIdUwF-v.d.ts} +61 -4
- package/dist/index-engagement.js +1 -1
- package/dist/index-engagement.js.map +1 -1
- package/dist/index-engagement.mjs +1 -1
- package/dist/index-graph.d.cts +4 -4
- package/dist/index-graph.d.ts +4 -4
- 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-graph.mjs.map +1 -1
- package/dist/index-local.d.cts +2 -2
- package/dist/index-local.d.ts +2 -2
- package/dist/index-server.d.cts +2 -2
- package/dist/index-server.d.ts +2 -2
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/{session-meta-dN92q19_.d.ts → session-meta-CY_Luh5i.d.cts} +40 -4
- package/dist/{session-meta-dN92q19_.d.cts → session-meta-CY_Luh5i.d.ts} +40 -4
- package/package.json +1 -1
- package/dist/chunk-TRBPPGFT.mjs +0 -2
- package/dist/chunk-TRBPPGFT.mjs.map +0 -1
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{A as T,B as U,C as V,D as W,E as X,F as Y,G as Z,a as t,b as u,c as v,d as w,e as x,f as y,g as z,h as A,i as B,j as C,k as D,l as E,m as F,n as G,o as H,p as I,q as J,r as K,s as L,t as M,u as N,v as O,w as P,x as Q,y as R,z as S}from"./chunk-
|
|
1
|
+
import{A as T,B as U,C as V,D as W,E as X,F as Y,G as Z,H as _,I as $,J as aa,K as ba,L as ca,M as da,a as t,b as u,c as v,d as w,e as x,f as y,g as z,h as A,i as B,j as C,k as D,l as E,m as F,n as G,o as H,p as I,q as J,r as K,s as L,t as M,u as N,v as O,w as P,x as Q,y as R,z as S}from"./chunk-HY23LTUY.mjs";import{b as a,c as b,d as c,e as d,f as e,g as f,h as g,i as h,j as i,k as j,l as k,m as l,n as m,o as n,p as o,r as p,s as q,t as r,u as s}from"./chunk-2NVSFI4V.mjs";import"./chunk-TMCGHANO.mjs";export{f as AGENT_INTENTS,A as BLOCK_ALIGNS,F as BLOCK_EMPHASES,I as BLOCK_FITS,z as BLOCK_GAPS,J as BLOCK_GRID_COLUMNS,K as BLOCK_HEADING_LEVELS,B as BLOCK_JUSTIFIES,N as BLOCK_MAX_WIDTHS,M as BLOCK_PADS,H as BLOCK_RATIOS,C as BLOCK_SIZES,L as BLOCK_SURFACES,G as BLOCK_TEXT_ALIGNS,E as BLOCK_TONES,D as BLOCK_WEIGHTS,l as CLICK_ID_KEYS,O as FORM_FIELD_KINDS,P as FORM_INPUT_TYPES,a as LEGACY_SESSION_COOKIE_NAME,y as LOCAL_MODE_BANNER,V as MAX_BLOCK_ARMS,U as MAX_BLOCK_CHILDREN,T as MAX_BLOCK_DEPTH,S as MAX_BLOCK_NODES,W as MAX_BLOCK_TEXT_LEN,Q as MAX_FORM_FIELDS,R as MAX_FORM_SELECT_OPTIONS,x as PROD_KEYLESS_ERROR,Y as REVEAL_MS,t as SNAPSHOT_STORAGE_KEY_PREFIX,aa as _registerConsentUpgradeInit,g as agentIntent,c as agentUaList,s as armOfResult,$ as attachMicroSignalDetectors,q as baselineResultFor,r as baselineSlots,h as classifiedAgents,X as containsFormBlock,o as deriveSessionSegment,i as detectDeviceClass,n as detectTimeOfDay,j as detectTrafficSource,m as extractTrackedParams,ca as grantConsent,da as init,ba as isDoNotTrackEnabled,e as matchedAgentToken,u as readSnapshot,k as referrerDomainFromReferer,w as renderPrePaintScript,Z as resetRevealStyles,_ as reveal,b as sessionCookieName,p as toWireSlot,d as uaTokenMatch,v as writeSnapshot};
|
|
2
2
|
//# sourceMappingURL=index.mjs.map
|
|
@@ -30,6 +30,9 @@ declare const BLOCK_RATIOS: readonly ["auto", "square", "landscape", "wide"];
|
|
|
30
30
|
declare const BLOCK_FITS: readonly ["cover", "contain"];
|
|
31
31
|
declare const BLOCK_GRID_COLUMNS: readonly [2, 3, 4];
|
|
32
32
|
declare const BLOCK_HEADING_LEVELS: readonly [2, 3, 4];
|
|
33
|
+
declare const BLOCK_SURFACES: readonly ["default", "raised"];
|
|
34
|
+
declare const BLOCK_PADS: readonly ["none", "sm", "md", "lg"];
|
|
35
|
+
declare const BLOCK_MAX_WIDTHS: readonly ["measure"];
|
|
33
36
|
type BlockGap = (typeof BLOCK_GAPS)[number];
|
|
34
37
|
type BlockAlign = (typeof BLOCK_ALIGNS)[number];
|
|
35
38
|
type BlockJustify = (typeof BLOCK_JUSTIFIES)[number];
|
|
@@ -40,7 +43,13 @@ type BlockEmphasis = (typeof BLOCK_EMPHASES)[number];
|
|
|
40
43
|
type BlockTextAlign = (typeof BLOCK_TEXT_ALIGNS)[number];
|
|
41
44
|
type BlockRatio = (typeof BLOCK_RATIOS)[number];
|
|
42
45
|
type BlockFit = (typeof BLOCK_FITS)[number];
|
|
43
|
-
|
|
46
|
+
type BlockSurface = (typeof BLOCK_SURFACES)[number];
|
|
47
|
+
type BlockPad = (typeof BLOCK_PADS)[number];
|
|
48
|
+
type BlockMaxWidth = (typeof BLOCK_MAX_WIDTHS)[number];
|
|
49
|
+
/** Flex row/column container. `surface: 'raised'` renders it as a card
|
|
50
|
+
* (palette surface bg + border hairline + radius + readable text pairing);
|
|
51
|
+
* a raised stack with no `pad` defaults to `md` — a zero-padding card is a
|
|
52
|
+
* design bug both renderers refuse to reproduce. */
|
|
44
53
|
type StackBlock = {
|
|
45
54
|
type: 'stack';
|
|
46
55
|
direction: 'row' | 'column';
|
|
@@ -49,6 +58,8 @@ type StackBlock = {
|
|
|
49
58
|
align?: BlockAlign;
|
|
50
59
|
justify?: BlockJustify;
|
|
51
60
|
wrap?: boolean;
|
|
61
|
+
surface?: BlockSurface;
|
|
62
|
+
pad?: BlockPad;
|
|
52
63
|
};
|
|
53
64
|
/** 2–4 equal-column grid container. */
|
|
54
65
|
type GridBlock = {
|
|
@@ -57,8 +68,9 @@ type GridBlock = {
|
|
|
57
68
|
children: BlockNode[];
|
|
58
69
|
gap?: BlockGap;
|
|
59
70
|
align?: BlockAlign;
|
|
71
|
+
pad?: BlockPad;
|
|
60
72
|
};
|
|
61
|
-
/** Paragraph / label. */
|
|
73
|
+
/** Paragraph / label. `maxWidth: 'measure'` caps long copy at a readable 65ch. */
|
|
62
74
|
type TextBlock = {
|
|
63
75
|
type: 'text';
|
|
64
76
|
value: string;
|
|
@@ -66,6 +78,7 @@ type TextBlock = {
|
|
|
66
78
|
weight?: BlockWeight;
|
|
67
79
|
tone?: BlockTone;
|
|
68
80
|
align?: BlockTextAlign;
|
|
81
|
+
maxWidth?: BlockMaxWidth;
|
|
69
82
|
};
|
|
70
83
|
/** h2–h4 — never h1 (the page owns its h1). */
|
|
71
84
|
type HeadingBlock = {
|
|
@@ -74,6 +87,7 @@ type HeadingBlock = {
|
|
|
74
87
|
level: (typeof BLOCK_HEADING_LEVELS)[number];
|
|
75
88
|
size?: BlockSize;
|
|
76
89
|
align?: BlockTextAlign;
|
|
90
|
+
maxWidth?: BlockMaxWidth;
|
|
77
91
|
};
|
|
78
92
|
/** Link styled as a button. `tag` feeds agent legibility (agentDataByVariant). */
|
|
79
93
|
type ButtonBlock = {
|
|
@@ -111,6 +125,12 @@ type SpacerBlock = {
|
|
|
111
125
|
type: 'spacer';
|
|
112
126
|
size: BlockSize;
|
|
113
127
|
};
|
|
128
|
+
/** Section separation — a 1px hairline in the palette border color. No props:
|
|
129
|
+
* anything a divider could be configured with is a styling decision, and
|
|
130
|
+
* styling decisions live in tokens, not on nodes. */
|
|
131
|
+
type DividerBlock = {
|
|
132
|
+
type: 'divider';
|
|
133
|
+
};
|
|
114
134
|
declare const FORM_FIELD_KINDS: readonly ["input", "textarea", "select"];
|
|
115
135
|
declare const FORM_INPUT_TYPES: readonly ["text", "email", "number", "tel"];
|
|
116
136
|
declare const MAX_FORM_FIELDS = 5;
|
|
@@ -141,7 +161,7 @@ type FormBlock = {
|
|
|
141
161
|
fields: FormField[];
|
|
142
162
|
emphasis?: BlockEmphasis;
|
|
143
163
|
};
|
|
144
|
-
type BlockNode = StackBlock | GridBlock | TextBlock | HeadingBlock | ButtonBlock | LinkBlock | ImageBlock | BadgeBlock | SpacerBlock | FormBlock;
|
|
164
|
+
type BlockNode = StackBlock | GridBlock | TextBlock | HeadingBlock | ButtonBlock | LinkBlock | ImageBlock | BadgeBlock | SpacerBlock | DividerBlock | FormBlock;
|
|
145
165
|
/** The derived site palette (spec §4 "Colour and type: derived, not chosen").
|
|
146
166
|
* Sampled by the on-site editor from the live page's own buttons — computed
|
|
147
167
|
* styles, so values are plain colors (rgb/hex), never var()/url() — validated
|
|
@@ -152,6 +172,22 @@ type SitePalette = {
|
|
|
152
172
|
primaryBg: string;
|
|
153
173
|
primaryText: string;
|
|
154
174
|
radius: string;
|
|
175
|
+
/** Brand accent — resolves `tone: 'accent'` and secondary/ghost button color.
|
|
176
|
+
* Optional: sites tokenized before brand-token extraction shipped carry
|
|
177
|
+
* only the three fields above, and every renderer keeps its neutral
|
|
178
|
+
* fallback for them. */
|
|
179
|
+
accent?: string;
|
|
180
|
+
/** Readable text color on the accent (contrast-derived when not declared). */
|
|
181
|
+
accentText?: string;
|
|
182
|
+
/** Card/section background. */
|
|
183
|
+
surface?: string;
|
|
184
|
+
/** Readable text color on the surface (contrast-derived when not declared).
|
|
185
|
+
* Resolves the text pairing of `surface: 'raised'` stacks. */
|
|
186
|
+
surfaceText?: string;
|
|
187
|
+
/** Hairline border color (form fields, dividers). */
|
|
188
|
+
border?: string;
|
|
189
|
+
/** Muted text color — resolves `tone: 'muted'` (fallback: opacity 0.7). */
|
|
190
|
+
muted?: string;
|
|
155
191
|
};
|
|
156
192
|
declare const MAX_BLOCK_NODES = 64;
|
|
157
193
|
declare const MAX_BLOCK_DEPTH = 5;
|
|
@@ -375,4 +411,4 @@ declare function buildSessionUpsertPayload(sessionId: string, opts?: {
|
|
|
375
411
|
webdriver?: boolean;
|
|
376
412
|
}): SessionUpsertPayload;
|
|
377
413
|
|
|
378
|
-
export { type
|
|
414
|
+
export { type SessionUpsertPayload as $, AGENT_INTENTS as A, BLOCK_ALIGNS as B, type BlockSurface as C, type BlockTextAlign as D, type BlockTone as E, type BlockWeight as F, type ButtonBlock as G, CLICK_ID_KEYS as H, type CompoundLocator as I, type DecisionSnapshot as J, type DividerBlock as K, FORM_FIELD_KINDS as L, FORM_INPUT_TYPES as M, type FormBlock as N, type FormField as O, type GridBlock as P, type HeadingBlock as Q, type ImageBlock as R, type LinkBlock as S, MAX_BLOCK_ARMS as T, MAX_BLOCK_CHILDREN as U, MAX_BLOCK_DEPTH as V, MAX_BLOCK_NODES as W, MAX_BLOCK_TEXT_LEN as X, MAX_FORM_FIELDS as Y, MAX_FORM_SELECT_OPTIONS as Z, SNAPSHOT_STORAGE_KEY_PREFIX as _, type AgentIntent as a, type SitePalette as a0, type SlotConfigEntry as a1, type SlotDeclInput as a2, type SlotOps as a3, type SpacerBlock as a4, type StackBlock as a5, type TextBlock as a6, agentIntent as a7, agentUaList as a8, armOfResult as a9, baselineResultFor as aa, baselineSlots as ab, buildSessionUpsertPayload as ac, classifiedAgents as ad, containsFormBlock as ae, deriveSessionSegment as af, detectDeviceClass as ag, detectTimeOfDay as ah, detectTrafficSource as ai, extractTrackedParams as aj, matchedAgentToken as ak, readSnapshot as al, referrerDomainFromReferer as am, renderPrePaintScript as an, toWireSlot as ao, uaTokenMatch as ap, writeSnapshot as aq, BLOCK_EMPHASES as b, BLOCK_FITS as c, BLOCK_GAPS as d, BLOCK_GRID_COLUMNS as e, BLOCK_HEADING_LEVELS as f, BLOCK_JUSTIFIES as g, BLOCK_MAX_WIDTHS as h, BLOCK_PADS as i, BLOCK_RATIOS as j, BLOCK_SIZES as k, BLOCK_SURFACES as l, BLOCK_TEXT_ALIGNS as m, BLOCK_TONES as n, BLOCK_WEIGHTS as o, type BadgeBlock as p, type BlockAlign as q, type BlockEmphasis as r, type BlockFit as s, type BlockGap as t, type BlockJustify as u, type BlockMaxWidth as v, type BlockNode as w, type BlockPad as x, type BlockRatio as y, type BlockSize as z };
|
|
@@ -30,6 +30,9 @@ declare const BLOCK_RATIOS: readonly ["auto", "square", "landscape", "wide"];
|
|
|
30
30
|
declare const BLOCK_FITS: readonly ["cover", "contain"];
|
|
31
31
|
declare const BLOCK_GRID_COLUMNS: readonly [2, 3, 4];
|
|
32
32
|
declare const BLOCK_HEADING_LEVELS: readonly [2, 3, 4];
|
|
33
|
+
declare const BLOCK_SURFACES: readonly ["default", "raised"];
|
|
34
|
+
declare const BLOCK_PADS: readonly ["none", "sm", "md", "lg"];
|
|
35
|
+
declare const BLOCK_MAX_WIDTHS: readonly ["measure"];
|
|
33
36
|
type BlockGap = (typeof BLOCK_GAPS)[number];
|
|
34
37
|
type BlockAlign = (typeof BLOCK_ALIGNS)[number];
|
|
35
38
|
type BlockJustify = (typeof BLOCK_JUSTIFIES)[number];
|
|
@@ -40,7 +43,13 @@ type BlockEmphasis = (typeof BLOCK_EMPHASES)[number];
|
|
|
40
43
|
type BlockTextAlign = (typeof BLOCK_TEXT_ALIGNS)[number];
|
|
41
44
|
type BlockRatio = (typeof BLOCK_RATIOS)[number];
|
|
42
45
|
type BlockFit = (typeof BLOCK_FITS)[number];
|
|
43
|
-
|
|
46
|
+
type BlockSurface = (typeof BLOCK_SURFACES)[number];
|
|
47
|
+
type BlockPad = (typeof BLOCK_PADS)[number];
|
|
48
|
+
type BlockMaxWidth = (typeof BLOCK_MAX_WIDTHS)[number];
|
|
49
|
+
/** Flex row/column container. `surface: 'raised'` renders it as a card
|
|
50
|
+
* (palette surface bg + border hairline + radius + readable text pairing);
|
|
51
|
+
* a raised stack with no `pad` defaults to `md` — a zero-padding card is a
|
|
52
|
+
* design bug both renderers refuse to reproduce. */
|
|
44
53
|
type StackBlock = {
|
|
45
54
|
type: 'stack';
|
|
46
55
|
direction: 'row' | 'column';
|
|
@@ -49,6 +58,8 @@ type StackBlock = {
|
|
|
49
58
|
align?: BlockAlign;
|
|
50
59
|
justify?: BlockJustify;
|
|
51
60
|
wrap?: boolean;
|
|
61
|
+
surface?: BlockSurface;
|
|
62
|
+
pad?: BlockPad;
|
|
52
63
|
};
|
|
53
64
|
/** 2–4 equal-column grid container. */
|
|
54
65
|
type GridBlock = {
|
|
@@ -57,8 +68,9 @@ type GridBlock = {
|
|
|
57
68
|
children: BlockNode[];
|
|
58
69
|
gap?: BlockGap;
|
|
59
70
|
align?: BlockAlign;
|
|
71
|
+
pad?: BlockPad;
|
|
60
72
|
};
|
|
61
|
-
/** Paragraph / label. */
|
|
73
|
+
/** Paragraph / label. `maxWidth: 'measure'` caps long copy at a readable 65ch. */
|
|
62
74
|
type TextBlock = {
|
|
63
75
|
type: 'text';
|
|
64
76
|
value: string;
|
|
@@ -66,6 +78,7 @@ type TextBlock = {
|
|
|
66
78
|
weight?: BlockWeight;
|
|
67
79
|
tone?: BlockTone;
|
|
68
80
|
align?: BlockTextAlign;
|
|
81
|
+
maxWidth?: BlockMaxWidth;
|
|
69
82
|
};
|
|
70
83
|
/** h2–h4 — never h1 (the page owns its h1). */
|
|
71
84
|
type HeadingBlock = {
|
|
@@ -74,6 +87,7 @@ type HeadingBlock = {
|
|
|
74
87
|
level: (typeof BLOCK_HEADING_LEVELS)[number];
|
|
75
88
|
size?: BlockSize;
|
|
76
89
|
align?: BlockTextAlign;
|
|
90
|
+
maxWidth?: BlockMaxWidth;
|
|
77
91
|
};
|
|
78
92
|
/** Link styled as a button. `tag` feeds agent legibility (agentDataByVariant). */
|
|
79
93
|
type ButtonBlock = {
|
|
@@ -111,6 +125,12 @@ type SpacerBlock = {
|
|
|
111
125
|
type: 'spacer';
|
|
112
126
|
size: BlockSize;
|
|
113
127
|
};
|
|
128
|
+
/** Section separation — a 1px hairline in the palette border color. No props:
|
|
129
|
+
* anything a divider could be configured with is a styling decision, and
|
|
130
|
+
* styling decisions live in tokens, not on nodes. */
|
|
131
|
+
type DividerBlock = {
|
|
132
|
+
type: 'divider';
|
|
133
|
+
};
|
|
114
134
|
declare const FORM_FIELD_KINDS: readonly ["input", "textarea", "select"];
|
|
115
135
|
declare const FORM_INPUT_TYPES: readonly ["text", "email", "number", "tel"];
|
|
116
136
|
declare const MAX_FORM_FIELDS = 5;
|
|
@@ -141,7 +161,7 @@ type FormBlock = {
|
|
|
141
161
|
fields: FormField[];
|
|
142
162
|
emphasis?: BlockEmphasis;
|
|
143
163
|
};
|
|
144
|
-
type BlockNode = StackBlock | GridBlock | TextBlock | HeadingBlock | ButtonBlock | LinkBlock | ImageBlock | BadgeBlock | SpacerBlock | FormBlock;
|
|
164
|
+
type BlockNode = StackBlock | GridBlock | TextBlock | HeadingBlock | ButtonBlock | LinkBlock | ImageBlock | BadgeBlock | SpacerBlock | DividerBlock | FormBlock;
|
|
145
165
|
/** The derived site palette (spec §4 "Colour and type: derived, not chosen").
|
|
146
166
|
* Sampled by the on-site editor from the live page's own buttons — computed
|
|
147
167
|
* styles, so values are plain colors (rgb/hex), never var()/url() — validated
|
|
@@ -152,6 +172,22 @@ type SitePalette = {
|
|
|
152
172
|
primaryBg: string;
|
|
153
173
|
primaryText: string;
|
|
154
174
|
radius: string;
|
|
175
|
+
/** Brand accent — resolves `tone: 'accent'` and secondary/ghost button color.
|
|
176
|
+
* Optional: sites tokenized before brand-token extraction shipped carry
|
|
177
|
+
* only the three fields above, and every renderer keeps its neutral
|
|
178
|
+
* fallback for them. */
|
|
179
|
+
accent?: string;
|
|
180
|
+
/** Readable text color on the accent (contrast-derived when not declared). */
|
|
181
|
+
accentText?: string;
|
|
182
|
+
/** Card/section background. */
|
|
183
|
+
surface?: string;
|
|
184
|
+
/** Readable text color on the surface (contrast-derived when not declared).
|
|
185
|
+
* Resolves the text pairing of `surface: 'raised'` stacks. */
|
|
186
|
+
surfaceText?: string;
|
|
187
|
+
/** Hairline border color (form fields, dividers). */
|
|
188
|
+
border?: string;
|
|
189
|
+
/** Muted text color — resolves `tone: 'muted'` (fallback: opacity 0.7). */
|
|
190
|
+
muted?: string;
|
|
155
191
|
};
|
|
156
192
|
declare const MAX_BLOCK_NODES = 64;
|
|
157
193
|
declare const MAX_BLOCK_DEPTH = 5;
|
|
@@ -375,4 +411,4 @@ declare function buildSessionUpsertPayload(sessionId: string, opts?: {
|
|
|
375
411
|
webdriver?: boolean;
|
|
376
412
|
}): SessionUpsertPayload;
|
|
377
413
|
|
|
378
|
-
export { type
|
|
414
|
+
export { type SessionUpsertPayload as $, AGENT_INTENTS as A, BLOCK_ALIGNS as B, type BlockSurface as C, type BlockTextAlign as D, type BlockTone as E, type BlockWeight as F, type ButtonBlock as G, CLICK_ID_KEYS as H, type CompoundLocator as I, type DecisionSnapshot as J, type DividerBlock as K, FORM_FIELD_KINDS as L, FORM_INPUT_TYPES as M, type FormBlock as N, type FormField as O, type GridBlock as P, type HeadingBlock as Q, type ImageBlock as R, type LinkBlock as S, MAX_BLOCK_ARMS as T, MAX_BLOCK_CHILDREN as U, MAX_BLOCK_DEPTH as V, MAX_BLOCK_NODES as W, MAX_BLOCK_TEXT_LEN as X, MAX_FORM_FIELDS as Y, MAX_FORM_SELECT_OPTIONS as Z, SNAPSHOT_STORAGE_KEY_PREFIX as _, type AgentIntent as a, type SitePalette as a0, type SlotConfigEntry as a1, type SlotDeclInput as a2, type SlotOps as a3, type SpacerBlock as a4, type StackBlock as a5, type TextBlock as a6, agentIntent as a7, agentUaList as a8, armOfResult as a9, baselineResultFor as aa, baselineSlots as ab, buildSessionUpsertPayload as ac, classifiedAgents as ad, containsFormBlock as ae, deriveSessionSegment as af, detectDeviceClass as ag, detectTimeOfDay as ah, detectTrafficSource as ai, extractTrackedParams as aj, matchedAgentToken as ak, readSnapshot as al, referrerDomainFromReferer as am, renderPrePaintScript as an, toWireSlot as ao, uaTokenMatch as ap, writeSnapshot as aq, BLOCK_EMPHASES as b, BLOCK_FITS as c, BLOCK_GAPS as d, BLOCK_GRID_COLUMNS as e, BLOCK_HEADING_LEVELS as f, BLOCK_JUSTIFIES as g, BLOCK_MAX_WIDTHS as h, BLOCK_PADS as i, BLOCK_RATIOS as j, BLOCK_SIZES as k, BLOCK_SURFACES as l, BLOCK_TEXT_ALIGNS as m, BLOCK_TONES as n, BLOCK_WEIGHTS as o, type BadgeBlock as p, type BlockAlign as q, type BlockEmphasis as r, type BlockFit as s, type BlockGap as t, type BlockJustify as u, type BlockMaxWidth as v, type BlockNode as w, type BlockPad as x, type BlockRatio as y, type BlockSize as z };
|
package/package.json
CHANGED
package/dist/chunk-TRBPPGFT.mjs
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
import{a as fe,c as Ee,e as Ie,j as Ce,k as _e,l as Te,n as Oe,o as Ae,r as Re,s as me,u as Pe}from"./chunk-2NVSFI4V.mjs";import{a as E,b as se}from"./chunk-TMCGHANO.mjs";function ye(){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 n="";for(let s=0;s<16;s++)n+=e[s].toString(16).padStart(2,"0"),(s===3||s===5||s===7||s===9)&&(n+="-");return n}}catch(e){}return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,e=>{let n=Math.random()*16|0;return(e==="x"?n:n&3|8).toString(16)})}var dt="_snt_uid",ut=365,Se="_snt_uid";function pt(){return ye()}function Xe(e){try{let n=document.cookie.match(new RegExp(`(?:^|; )${e}=([^;]*)`));return n?decodeURIComponent(n[1]):null}catch(n){return null}}function gt(e,n,s){try{document.cookie=`${e}=${encodeURIComponent(n)}; max-age=${s}; SameSite=strict; path=/`}catch(p){}}function Be(e){try{return localStorage.getItem(e)}catch(n){return null}}function Ve(e,n){try{return localStorage.setItem(e,n),!0}catch(s){return!1}}function Ye(e){try{return sessionStorage.getItem(e)}catch(n){return null}}function ft(e,n){try{return sessionStorage.setItem(e,n),!0}catch(s){return!1}}function mt(e){try{sessionStorage.removeItem(e)}catch(n){}}function yt(e){try{return document.cookie=`${e}_probe=1; max-age=1; SameSite=strict; path=/`,document.cookie.indexOf(`${e}_probe=1`)!==-1}catch(n){return!1}}function St(e){try{localStorage.removeItem(e)}catch(n){}}function ht(e){try{document.cookie=`${e}=; max-age=0; SameSite=strict; path=/`}catch(n){}}var vt={getSessionId:()=>null,isEphemeral:()=>!1,destroy:()=>{}};function he(e){var b,P,B,x,N,$,I;if(typeof window=="undefined")return vt;let n=fe(e==null?void 0:e.apiKey),s=(b=e==null?void 0:e.cookieName)!=null?b:Ee(e==null?void 0:e.apiKey),p=`${Se}${n}`,m=`${Se}_tomb${n}`,c=((P=e==null?void 0:e.cookieTTLDays)!=null?P:ut)*24*60*60,i=T=>T&&T.length>0?T:null,u=()=>{var T,C;return n&&!(e!=null&&e.cookieName)&&Be(m)===null?(C=(T=i(Xe(dt)))!=null?T:i(Be(Se)))!=null?C:i(Ye(Se)):null},r=(I=($=(N=(x=(B=i(Xe(s)))!=null?B:i(Be(p)))!=null?x:i(Ye(p)))!=null?N:u())!=null?$:i(e==null?void 0:e.ssrSessionId))!=null?I:pt();gt(s,r,c);let t=Ve(p,r),o=yt(s),y=t?!1:ft(p,r),h=!t&&!o&&!y;return{getSessionId:()=>r,isEphemeral:()=>h,destroy:()=>{r=null,ht(s),St(p),mt(p),n&&!(e!=null&&e.cookieName)&&Ve(m,"1")}}}function Z(e){return Math.min(6e4,1e3*2**Math.min(e,6))}function re(e){if(e.ok===!0)return"delivered";let{status:n}=e;return typeof n!="number"?"retry":n>=200&&n<300?"delivered":n>=400&&n<500&&n!==429?"dropped":"retry"}function ve(e,n){try{let s=localStorage.getItem(e);if(!s)return[];let p=JSON.parse(s);return Array.isArray(p)?(localStorage.removeItem(e),p.slice(-n)):[]}catch(s){return[]}}function ee(e,n,s){try{let p=(()=>{try{let l=localStorage.getItem(s);if(!l)return[];let c=JSON.parse(l);return Array.isArray(c)?c:[]}catch(l){return[]}})(),m=new Map;for(let l of p)m.set(l.id,l);for(let l of e)m.set(l.id,l);localStorage.setItem(s,JSON.stringify([...m.values()].slice(-n)))}catch(p){}}function we(e,n){try{let s=localStorage.getItem(n);if(!s)return;let p=JSON.parse(s);if(!Array.isArray(p))return;let m=new Set(e),l=p.filter(c=>!m.has(c.id));if(l.length===p.length)return;l.length===0?localStorage.removeItem(n):localStorage.setItem(n,JSON.stringify(l))}catch(s){}}var wt=500,kt=56*1024;function Le(e){return`_snt_retry_${e.slice(0,12)}`}var bt={push:()=>{},flush:()=>{},destroy:()=>{}};function qe(e){var J,M,ae;if(typeof window=="undefined")return bt;let n=(J=e.flushIntervalMs)!=null?J:5e3,s=(M=e.maxBatchSize)!=null?M:20,p=(ae=e.maxRetrySize)!=null?ae:100,m=e.ingestUrl,l=e.apiKey,c=Le(l),i=[],u=new Set,r=[],t=f=>{for(let w of f)o.delete(w),!u.has(w)&&(u.add(w),r.push(w));for(;r.length>wt;){let w=r.shift();w&&u.delete(w)}we(f,c)},o=new Set,y=()=>{for(;i.length>p;){let f=i.shift();f&&o.delete(f.id)}},h=f=>{u.has(f.id)||o.has(f.id)||(o.add(f.id),i.push(f),y())},b=f=>{for(let w of f)u.has(w.id)||(o.add(w.id),i.push(w));y()},P=ve(c,p);for(let f of P)h(f);let B=0,x=0,N=(f,w=!0)=>{if(f.length===0)return;let X=JSON.stringify(f),G=f.map(V=>V.id),U;try{U=fetch(m,{method:"POST",keepalive:!0,body:X,headers:{"Content-Type":"application/json",Authorization:`Bearer ${l}`}})}catch(V){ee(f,p,c),b(f),x++,B=Date.now()+Z(x);return}let z=V=>{if(re(V)!=="retry"){if(!V.ok&&w){let ne=f.filter(Y=>Y.eventType!=="pageview");if(ne.length>0&&ne.length<f.length){t(f.filter(Y=>Y.eventType==="pageview").map(Y=>Y.id)),N(ne,!1);return}}t(G),x=0,B=0;return}ee(f,p,c),b(f),x++,B=Date.now()+Z(x)};U instanceof Promise?U.then(z).catch(()=>{ee(f,p,c),b(f),x++,B=Date.now()+Z(x)}):z(U)},$=typeof TextEncoder!="undefined"?new TextEncoder:null,I=f=>$?$.encode(f).length:f.length,T=f=>{let w=[],X=2;for(let G of f){let U=I(JSON.stringify(G))+1;if(w.length>0&&X+U>kt||w.length>=s)break;w.push(G),X+=U}return w},C=()=>{try{if(Date.now()<B)return;for(;i.length>0&&!(Date.now()<B);){let f=i.filter(X=>!u.has(X.id));if(i.length=0,f.length===0)break;let w=T(f);if(w.length===0)break;w.length<f.length&&i.push(...f.slice(w.length)),N(w)}}catch(f){}},g=!0,O=null;O=setInterval(()=>{g&&C()},n);let j=()=>{document.visibilityState==="hidden"&&C()},W=()=>{C()};return document.addEventListener("visibilitychange",j),window.addEventListener("pagehide",W),{push(f){h(f),i.length>=s&&C()},flush:C,destroy(){g=!1,O!==null&&(clearInterval(O),O=null),document.removeEventListener("visibilitychange",j),window.removeEventListener("pagehide",W),C()}}}var xt=200;function De(e){return`_snt_goal_retry_${e.slice(0,12)}`}var Et={send:()=>{},flush:()=>{},destroy:()=>{}};function Ze(e){var I,T,C;if(typeof window=="undefined")return Et;let n=(I=e.flushIntervalMs)!=null?I:5e3,s=(T=e.maxRetrySize)!=null?T:100,p=(C=e.maxPerFlush)!=null?C:5,m=De(e.apiKey),l=[],c=new Set,i=new Set,u=[],r=0,t=0,o=!1,y=g=>{for(c.delete(g.id),i.has(g.id)||(i.add(g.id),u.push(g.id));u.length>xt;){let O=u.shift();O&&i.delete(O)}we([g.id],m)},h=g=>{ee([g],s,m),!i.has(g.id)&&!c.has(g.id)&&(c.add(g.id),l.push(g)),Date.now()>=r&&(t++,r=Date.now()+Z(t))},b=g=>{let O;try{O=fetch(e.url,{method:"POST",keepalive:!0,body:g.body,headers:e.headers})}catch(W){h(g);return}let j=W=>{var M;let J=re(W);if(J==="retry"){h(g);return}J==="dropped"&&((M=e.onDrop)==null||M.call(e,g,W.status)),y(g),t=0,r=0};O instanceof Promise?O.then(j).catch(()=>h(g)):j(O)},P=()=>{try{if(o||Date.now()<r)return;let g=0;for(;l.length>0&&g<p&&!(Date.now()<r);){let O=l.shift();c.delete(O.id),!i.has(O.id)&&(g++,b(O))}}catch(g){}},B=ve(m,s);for(let g of B)c.has(g.id)||(c.add(g.id),l.push(g));B.length>0&&ee(B,s,m);let x=setInterval(P,n),N=()=>{document.visibilityState==="hidden"&&P()},$=()=>P();return document.addEventListener("visibilitychange",N),window.addEventListener("pagehide",$),{send(g){if(!o&&!(i.has(g.id)||c.has(g.id))){if(Date.now()<r){ee([g],s,m),c.add(g.id),l.push(g);return}b(g)}},flush:P,destroy(){clearInterval(x),document.removeEventListener("visibilitychange",N),window.removeEventListener("pagehide",$),P(),o=!0}}}var It=1800*1e3;function ke(e,n){return`${encodeURIComponent(e)}:${encodeURIComponent(n)}`}function et(e=It,n){let s=new Map,p=`_snt_asgn${fe(n)}_`,m=(r,t)=>`${p}${encodeURIComponent(r)}:${encodeURIComponent(t)}`,l=r=>{let t=r.slice(p.length),o=t.indexOf(":");if(o<0)return null;try{return{componentId:decodeURIComponent(t.slice(0,o)),segment:decodeURIComponent(t.slice(o+1))}}catch(y){return null}},c=()=>{try{let r=[];for(let t=0;t<localStorage.length;t++){let o=localStorage.key(t);o!=null&&o.startsWith(p)&&r.push(o)}return r}catch(r){return[]}},i=r=>r.assignedAt+(r.ttlMs&&r.ttlMs>0?r.ttlMs:e)<Date.now();return typeof window!="undefined"&&(()=>{for(let r of c())try{let t=localStorage.getItem(r);if(!t)continue;let o=JSON.parse(t);if(i(o)){localStorage.removeItem(r);continue}let y=l(r);if(!y)continue;s.set(ke(y.componentId,y.segment),o)}catch(t){}})(),{get(r,t){let o=s.get(ke(r,t));return o?i(o)?(s.delete(ke(r,t)),null):o:null},set(r,t,o){let y=ke(r,t);s.set(y,o);try{localStorage.setItem(m(r,t),JSON.stringify(o))}catch(h){}},clear(){s.clear();for(let r of c())try{localStorage.removeItem(r)}catch(t){}}}}var ie="_snt_snap:",Ct=["low","medium","high"];function de(e){try{let n=localStorage.getItem(ie+e);if(!n)return null;let s=JSON.parse(n);return!s||typeof s!="object"||s.v!==1||typeof s.persona!="string"||typeof s.band!="string"||!Ct.includes(s.band)||typeof s.slots!="object"||s.slots===null||Array.isArray(s.slots)||!(s.layoutOrder===null||Array.isArray(s.layoutOrder))||typeof s.savedAt!="number"||!(s.slotConfig===void 0||typeof s.slotConfig=="object"&&s.slotConfig!==null&&!Array.isArray(s.slotConfig))?null:s}catch(n){return null}}function ue(e,n){try{localStorage.setItem(ie+e,JSON.stringify(n))}catch(s){}}function _t(e){return"(function(){try{var r=localStorage.getItem("+JSON.stringify(ie+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){}})();'}import{confidenceBand as st}from"@sentientui/policy";import{confidenceBand as Me}from"@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.",nt="[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.",tt=!1,be=!1;function Tt(){var e;try{return(e=new URLSearchParams(window.location.search).get("sentient_persona"))!=null?e:void 0}catch(n){return}}function ot(e){var r;let n=he({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),s=(r=n.getSessionId())!=null?r:"local",p=Tt(),m=import("@sentientui/core/local").then(t=>{let o=t;return o.LOCAL_ENGINE_AVAILABLE?(tt||(tt=!0,console.info(nt)),o):(be||(be=!0,console.error(Ke)),null)}).catch(()=>(be||(be=!0,console.error(Ke)),null)),l=null,c={low:.15,medium:.5,high:.85},i=(()=>{var o;if(e.initialPersona)return E({},e.initialPersona);let t=de(e.apiKey||"local");return t?{persona:t.persona,confidence:(o=c[t.band])!=null?o:.15}:null})();function u(t){let o=document.documentElement;o.dataset.sentientPersona===void 0&&(o.dataset.sentientPersona=t.persona,o.dataset.sentientConfidence=Me(t.confidence))}return{isLocal:!0,async decide(t){var h,b,P;let o=await m;if(!o)return null;let y=o.createLocalEngine({sessionId:s,forcedPersona:p}).decide(t);return l=se(E({},y),{layoutOrder:(b=(h=y.layoutOrder)!=null?h:l==null?void 0:l.layoutOrder)!=null?b:null,slots:E(E({},(P=l==null?void 0:l.slots)!=null?P:{}),y.slots)}),ue(e.apiKey||"local",{v:1,persona:l.persona,band:Me(l.confidence),slots:l.slots,layoutOrder:l.layoutOrder,savedAt:Date.now()}),u(y),y},getSlotResult(t){var o,y,h;return(h=(y=l==null?void 0:l.slots[t])!=null?y:(o=e.initialSlots)==null?void 0:o[t])!=null?h:null},getSlotConfig(t){var o,y;return(y=(o=e.initialSlotConfig)==null?void 0:o[t])!=null?y:null},getSitePalette(){var t;return(t=e.initialPalette)!=null?t:null},reportSlots(){},getPersona(){let t=l!=null?l:i;return t?{persona:t.persona,confidence:t.confidence,band:Me(t.confidence)}:null},async assign(t,o){var b;let y=await m;return!y||!o||o.length===0?o!=null&&o[0]?{variantId:o[0],assignmentTtlMs:0}:null:{variantId:(b=y.createLocalEngine({sessionId:s,forcedPersona:p}).decide({components:[{id:t,variantIds:o}]}).assignments[t])!=null?b:o[0],assignmentTtlMs:0}},track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),getGraph:()=>({pageNodes:[],capturedAt:0}),dispose:()=>{},destroy:()=>n.destroy()}}var tn=["none","sm","md","lg"],nn=["start","center","end","stretch"],on=["start","center","end","between"],sn=["sm","md","lg"],rn=["normal","medium","bold"],an=["default","muted","accent"],ln=["primary","secondary","ghost"],cn=["left","center","right"],dn=["auto","square","landscape","wide"],un=["cover","contain"],pn=[2,3,4],gn=[2,3,4],fn=["input","textarea","select"],mn=["text","email","number","tel"],yn=5,Sn=8,hn=64,vn=5,wn=12,kn=4,bn=500;function Ot(e){if(e==null||typeof e!="object"||Array.isArray(e))return!1;let n=e;return n.type==="form"?!0:Array.isArray(n.children)?n.children.some(Ot):!1}function At(e,n,s,p){let m=[];{let i=!1,u=[],r=()=>{if(i)return;let t=Date.now();for(u.push(t);u.length>0&&t-u[0]>500;)u.shift();u.length>=3&&(i=!0,e("rage_click"))};n.addEventListener("click",r),m.push(()=>n.removeEventListener("click",r))}{let l=!1,c=i=>{if(l||!(i.target instanceof Node)||!n.contains(i.target)&&n!==i.target)return;l=!0;let u=typeof window!="undefined"?window.getSelection():null,r=u?u.toString().length:0;e("text_copy",{selectionLength:r})};document.addEventListener("copy",c),m.push(()=>document.removeEventListener("copy",c))}{let l=!1,c=!1,i=null,u=()=>{i!==null&&(clearTimeout(i),i=null)},r=()=>{l||!c||(u(),i=setTimeout(()=>{!l&&c&&(l=!0,e("scroll_hesitation"))},3e3))},t=()=>{u(),r()},o=h=>{for(let b of h)c=b.intersectionRatio>.3,c?r():u()},y=new IntersectionObserver(o,{threshold:[.3]});y.observe(n),window.addEventListener("scroll",t,{passive:!0}),m.push(()=>{y.disconnect(),window.removeEventListener("scroll",t),u()})}if((p==null?void 0:p.tabLoss)!==!1){let l=!1,c=s!=null?s:Date.now(),i=()=>{if(l||document.visibilityState!=="hidden")return;let u=Date.now()-c;u<15e3&&(l=!0,e("tab_loss",{timeOnPage:u}))};document.addEventListener("visibilitychange",i),m.push(()=>document.removeEventListener("visibilitychange",i))}return()=>{for(let l of m)l()}}var rt="https://api.sentient-ui.com/v1/events",K=new Map,it=null;function Hn(e,n){let s=K.get(e);s&&s.upgrade&&(s.reinit=n)}function Rt(e){return"value"in e||"currency"in e||"externalId"in e||"metadata"in e||"weight"in e||"stepIndex"in e}var Pt=3;function Ne(){return ye()}function xe(){var e;if(typeof window!="undefined")return((e=window.location)==null?void 0:e.pathname)||void 0}function Bt(){let e=new WeakMap,n=new Map,s=!1,p=(i,u,r)=>{let t=i.get(u);return r===null?t?!0:(i.set(u,new Set),!1):t?t.has(r)?!0:(t.add(r),!1):(i.set(u,new Set([r])),!1)},m=typeof window!="undefined"&&"event"in window,l=()=>{if(!m)return;let i=window.event;return typeof Event=="function"&&i instanceof Event?i:void 0},c=()=>{if(m){Promise.resolve().then(()=>{s=!1,n.clear()});return}let i=!1,u=()=>{i||(i=!0,s=!1,n.clear())};if(setTimeout(u,0),typeof MessageChannel=="function"){let r=new MessageChannel;r.port1.onmessage=()=>{r.port1.close(),r.port2.close(),u()},r.port2.postMessage(0)}};return{firedBefore(i,u){let r=l();if(r){let o=e.get(r);return o||(o=new Map,e.set(r,o)),p(o,i,u)}let t=p(n,i,u);return!t&&!s&&(s=!0,c()),t}}}var at=new Set;function Lt(e,n,s){let p=typeof window=="undefined"?null:window.history;if(!p)return()=>{};let m=!1,l,c=()=>{if(m)return;let r=xe();!r||r===l||(l=r,e.track({projectId:n,componentId:"__page__",eventType:"pageview",payload:{}}),s(`${n}:${r}`))},i=[];for(let r of["pushState","replaceState"]){let t=p[r],o=function(...y){let h=t.apply(this,y);return c(),h};p[r]=o,i.push([r,t,o])}window.addEventListener("popstate",c);let u=xe();return u&&at.has(`${n}:${u}`)?l=u:c(),()=>{if(!m){m=!0,window.removeEventListener("popstate",c);for(let[r,t,o]of i)p[r]===o&&(p[r]=t)}}}var pe={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 Dt(){try{return Oe(window.location.search)}catch(e){return{utmParams:{},clickIds:{}}}}function lt(e){return e.replace(/\/events\/?$/,"")}function ct(){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(n=>n==="1"||n==="yes")}function zn(e){var u;if(typeof window=="undefined")return;let n=e!=null?e:it;if(!n){console.warn("[sentient] grantConsent() called before init()");return}let s=K.get(n);if(!s){console.warn("[sentient] grantConsent() called before init()");return}let{config:p,upgrade:m,reinit:l}=s;if(!m){s.upgradeBlockedReason&&console.warn(s.upgradeBlockedReason);return}if(p.respectDoNotTrack!==!1&&ct())return;let c=(l!=null?l:Kt)(se(E({},p),{consent:!0}));m(c);let i=(u=K.get(n))==null?void 0:u.dispose;K.set(n,{config:se(E({},p),{consent:!0}),upgrade:null,dispose:i})}function Mt(e){var r;let n=e.preConsentBehavior==="statistical_winner",s=lt((r=e.ingestUrl)!=null?r:rt),p={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},m=new Map,l=new Map,c={track:()=>{},goal:()=>{},componentGoal:()=>{},identify:()=>{},getAssignment:()=>null,fetchWeights:()=>Promise.resolve([]),assign(t,o,y){if(!n)return Promise.resolve(null);let h=m.get(t);return h?Promise.resolve(h):Ge(l,t,async()=>{try{let b=new URLSearchParams({componentId:t});for(let N of o!=null?o:[])b.append("variantIds[]",N);let P=await fetch(`${s}/winner?${b.toString()}`,{headers:p});if(!P.ok)return o!=null&&o[0]?{variantId:o[0],assignmentTtlMs:0}:null;let x={variantId:(await P.json()).variantId,assignmentTtlMs:0};return m.set(t,x),x}catch(b){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:()=>{}},i={track:t=>c.track(t),goal:((t,o,y,h)=>c.goal(t,o,y,h)),componentGoal:(t,o,y)=>c.componentGoal(t,o,y),identify:t=>c.identify(t),getAssignment:(t,o)=>c.getAssignment(t,o),assign:(t,o,y,h)=>c.assign(t,o,y,h),decide:t=>c.decide(t),getSlotResult:t=>c.getSlotResult(t),getSlotConfig:t=>c.getSlotConfig(t),getSitePalette:()=>c.getSitePalette(),reportSlots:t=>c.reportSlots(t),getPersona:()=>c.getPersona(),fetchWeights:()=>c.fetchWeights(),getGraph:()=>c.getGraph(),dispose:()=>c.dispose(),destroy:()=>c.destroy()};function u(t){c=t}return{proxy:i,setInner:u}}function Ge(e,n,s){let p=e.get(n);if(p)return p;let m=(async()=>{try{return await s()}finally{e.delete(n)}})();return e.set(n,m),m}function Kt(e){var V,ne,Y,Fe,Ue,$e,je,We,He,ze;if(typeof window=="undefined")return pe;it=e.apiKey||"local";let n=K.get(e.apiKey||"local");if(n!=null&&n.dispose)try{n.dispose()}catch(a){}let s=e.respectDoNotTrack!==!1&&ct(),p=e.consent===!1||s,m=typeof e.apiKey=="string"&&e.apiKey.startsWith("pk_");if(e.localMode===!0||!m&&e.localMode!==!1)return K.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."}),p?pe:ot(e);if(p){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."),K.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."}),pe;let{proxy:a,setInner:d}=Mt(e);return K.set(e.apiKey,{config:e,upgrade:s?null:d}),a}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."),pe;if(e.ingestUrl==="")return console.warn("[sentient] init() called with an empty ingestUrl. SDK disabled."),pe;let l=(V=e.ingestUrl)!=null?V:rt,c=Date.now(),i=he({ssrSessionId:e.ssrSessionId,apiKey:e.apiKey}),u=et(void 0,e.apiKey),r=qe({ingestUrl:l,apiKey:e.apiKey}),t=lt(l),o={"Content-Type":"application/json",Authorization:`Bearer ${e.apiKey}`},y=new Set,h=Ze({url:`${t}/goals`,apiKey:e.apiKey,headers:o,onDrop:(a,d)=>{if(!e.debug){if(y.has(d))return;y.add(d)}console.warn(`[sentient] goal dropped (HTTP ${d}) \u2014 this will not be retried. `+(d===400?"The session was not found: call init() and let the session upsert complete before firing goals.":d===401||d===403?"Check the API key and that this origin is on the project allowlist.":"See the response status for the cause."),a)}}),b=Ce((ne=navigator.userAgent)!=null?ne:""),P=window.location.origin,B=_e((Y=document.referrer)!=null?Y:"",P),x=(Fe=e.sessionSegment)!=null?Fe:`${b}:${B}`,N=new Map,$=new Map,I=new Map,T=new Map,C=null,g=null,O=new Set,j=new Set,W=null,J=a=>{for(let d of a)I.has(d.id)||I.set(d.id,me(d))};if(e.initialSlots)for(let[a,d]of Object.entries(e.initialSlots))I.set(a,d);if(e.initialSlotConfig)for(let[a,d]of Object.entries(e.initialSlotConfig))T.set(a,d);e.initialPalette&&(C=e.initialPalette);let M=de(e.apiKey);if(M){for(let[a,d]of Object.entries(M.slots))I.has(a)||I.set(a,d);for(let[a,d]of Object.entries((Ue=M.slotConfig)!=null?Ue:{}))T.has(a)||T.set(a,d);!C&&M.palette&&(C=M.palette)}let ae={low:.15,medium:.5,high:.85};if(e.initialPersona)g=E({},e.initialPersona);else{let a=document.documentElement.dataset;a.sentientPersona?g={persona:a.sentientPersona,confidence:(je=ae[($e=a.sentientConfidence)!=null?$e:"low"])!=null?je:.15}:M&&(g={persona:M.persona,confidence:(We=ae[M.band])!=null?We:.15})}if(e.initialAssignments)for(let[a,d]of Object.entries(e.initialAssignments))u.set(a,x,{variantId:d,assignedAt:Date.now(),segment:x,confidence:1});let f=Promise.resolve(),w=i.getSessionId();if(w){let a=Te((He=document.referrer)!=null?He:""),{utmParams:d,clickIds:v}=Dt(),A=E(E(E(E({sessionId:w,deviceClass:b,trafficSource:B,referrerDomain:a,utmParams:d,clickIds:v,timeOfDay:Ae(new Date),dayOfWeek:["sun","mon","tue","wed","thu","fri","sat"][new Date().getDay()],ephemeral:i.isEphemeral(),automation:typeof navigator!="undefined"&&navigator.webdriver===!0||Ie((ze=navigator.userAgent)!=null?ze:"")},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}:{}),L=async()=>{for(let S=0;;S++){try{let _=await fetch(`${t}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify(A),headers:o});if(_.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(_.ok||re(_)==="dropped")return}catch(_){}if(S>=Pt){console.warn("[SentientUI] Could not register the session after retries. Conversions in this visit may not be recorded.");return}await new Promise(_=>setTimeout(_,Z(S+1)))}};try{f=L()}catch(S){}}e.debug&&(console.log("[sentient] initialized",{context:e.context}),window.__sentient={client:null,queue:r});let X=Bt(),G=null,U=!1,z={goal(a,d={},v=1,A=0){var le,ce,oe,k,Q,ge,R;let L=i.getSessionId();if(!L)return;let S=Rt(d)?d:{metadata:d},_=[a,(le=S.externalId)!=null?le:"",(ce=S.stepIndex)!=null?ce:A,(oe=S.weight)!=null?oe:v].join("\0"),F=S.value!==void 0?`${S.value}\0${(k=S.currency)!=null?k:""}`:null;if(X.firedBefore(_,F)){e.debug&&console.log(`[sentient] goal("${a}") already recorded for this action \u2014 not sent twice`);return}let D=Ne(),q={sessionId:L,name:a,metadata:(Q=S.metadata)!=null?Q:{},weight:(ge=S.weight)!=null?ge:v,stepIndex:(R=S.stepIndex)!=null?R:A,goalId:D,value:S.value,currency:S.currency,externalId:S.externalId};e.debug&&console.log("[sentient] goal",q);let te={id:D,body:JSON.stringify(q)};f.then(()=>h.send(te))},componentGoal(a,d,v){var D,q,te;let A=i.getSessionId();if(!A)return;let L=u.get(a,x),S=L?null:(D=I.get(a))!=null?D:null;if(!L&&S===null){e.debug&&console.warn(`[sentient] componentGoal("${a}"): no assignment or slot decision yet \u2014 render its <Adaptive>/adaptive hook or call assign()/decide() before recording a goal.`);return}let _=L?L.variantId:Pe(S),F={id:Ne(),sessionId:A,projectId:e.apiKey,componentId:a,variantId:_,eventType:"goal_achieved",goalType:d,payload:E({reward:(q=v==null?void 0:v.reward)!=null?q:1,goalValue:v==null?void 0:v.value,currency:v==null?void 0:v.currency},(te=v==null?void 0:v.metadata)!=null?te:{}),timestamp:Date.now(),timeInSession:Date.now()-c,path:xe()};e.debug&&console.log("[sentient] componentGoal",F),f.then(()=>r.push(F))},identify(a){let d=i.getSessionId();d&&f.then(()=>{fetch(`${t}/sessions`,{method:"POST",keepalive:!0,body:JSON.stringify({sessionId:d,userId:a,ephemeral:i.isEphemeral()}),headers:o}).catch(()=>{})})},track(a){let d=i.getSessionId();if(!d)return;let v=se(E({path:xe()},a),{id:Ne(),sessionId:d,timestamp:Date.now(),timeInSession:Date.now()-c});e.debug&&console.log("[sentient] track",v),f.then(()=>r.push(v))},getAssignment(a,d){return u.get(a,d)},async assign(a,d,v,A){let L=i.getSessionId();if(!L)return null;let S=u.get(a,x);if(S&&(d!=null&&d.length||S.content!==void 0)){let _=S.ttlMs&&S.ttlMs>0?Math.max(0,S.assignedAt+S.ttlMs-Date.now()):0;return{variantId:S.variantId,assignmentTtlMs:_,content:S.content}}return Ge(N,a,async()=>{await f;try{let _={sessionId:L,componentId:a,variantIds:d};A!==void 0?_.agentDataByVariant=A:v!==void 0&&(_.agentData=v);let F=await fetch(`${t}/assign`,{method:"POST",body:JSON.stringify(_),headers:o});if(!F.ok)return null;let D=await F.json();return u.set(a,x,E({variantId:D.variantId,assignedAt:Date.now(),segment:x,confidence:1,content:D.content},D.assignmentTtlMs&&D.assignmentTtlMs>0?{ttlMs:D.assignmentTtlMs}:{})),D}catch(_){return null}})},async decide(a){var S,_;let d=i.getSessionId();if(!d)return null;let v=(S=a.slots)!=null?S:[],A={sessionId:d};a.sections&&a.sections.length>0&&(A.sections=a.sections.map(F=>({id:F}))),A.components=(_=a.components)!=null?_:[],v.length>0&&(A.slots=v.map(Re)),a.slotsFrom==="registry"&&(A.slotsFrom="registry"),a.v&&(A.v=a.v),typeof a.pp=="number"&&(A.pp=a.pp),e.persona&&(A.persona=e.persona);let L=JSON.stringify(A);return Ge($,L,async()=>{var F,D,q,te,le,ce;await f;try{let oe=await fetch(`${t}/decide`,{method:"POST",body:L,headers:o});if(!oe.ok)return J(v),null;let k=await oe.json(),Q={};for(let R of v){let H=(F=k.slots)==null?void 0:F[R.id];if(H!==void 0){Q[R.id]=H,I.set(R.id,H);continue}let Qe=I.get(R.id);if(Qe!==void 0)Q[R.id]=Qe;else{let Je=me(R);Q[R.id]=Je,I.set(R.id,Je)}}if(k.slots)for(let[R,H]of Object.entries(k.slots))R in Q||(Q[R]=H,I.set(R,H));let ge=g!=null&&g.persona!=="unknown";k.persona&&!(k.persona==="unknown"&&ge)?g={persona:k.persona,confidence:(D=k.confidence)!=null?D:0}:g||(g={persona:"unknown",confidence:0});for(let[R,H]of Object.entries((q=k.assignments)!=null?q:{}))u.set(R,x,{variantId:H,assignedAt:Date.now(),segment:x,confidence:1});if(k.slotConfig)for(let[R,H]of Object.entries(k.slotConfig))T.set(R,H);return k.palette&&(C=k.palette),ue(e.apiKey,E(E({v:1,persona:g.persona,band:st(g.confidence),slots:Object.fromEntries(I),layoutOrder:(te=k.layoutOrder)!=null?te:null,savedAt:Date.now()},T.size>0?{slotConfig:Object.fromEntries(T)}:{}),C?{palette:C}:{})),E(E(E(E({layoutOrder:(le=k.layoutOrder)!=null?le:null,assignments:(ce=k.assignments)!=null?ce:{},slots:Q,persona:g.persona,confidence:g.confidence},k.slotConfig?{slotConfig:k.slotConfig}:{}),k.goals?{goals:k.goals}:{}),k.sectionMap?{sectionMap:k.sectionMap}:{}),k.palette?{palette:k.palette}:{})}catch(oe){return J(v),null}})},getSlotResult(a){var d;return(d=I.get(a))!=null?d:null},getSlotConfig(a){var d;return(d=T.get(a))!=null?d:null},reportSlots(a){for(let d of a)typeof d=="string"&&d.length>0&&!O.has(d)&&(O.add(d),j.add(d));j.size===0||W!=null||(W=setTimeout(()=>{W=null;let d=[...j].slice(0,20);j.clear(),d.length!==0&&fetch(`${t}/slots/observed`,{method:"POST",headers:o,body:JSON.stringify({slotIds:d})}).catch(()=>{})},1e3))},getSitePalette(){return C},getPersona(){return g?{persona:g.persona,confidence:g.confidence,band:st(g.confidence)}:null},async fetchWeights(){var a;try{let d=await fetch(`${t}/weights`,{headers:o});return d.ok?(a=(await d.json()).components)!=null?a:[]:[]}catch(d){return[]}},getGraph(){return{pageNodes:[],capturedAt:0}},dispose(){var a;G==null||G(),U=!0,r.destroy(),h.destroy(),((a=K.get(e.apiKey))==null?void 0:a.dispose)===z.dispose&&K.delete(e.apiKey),e.debug&&console.log("[sentient] disposed")},destroy(){var a;G==null||G(),U=!0,r.destroy(),h.destroy(),i.destroy(),u.clear(),((a=K.get(e.apiKey))==null?void 0:a.dispose)===z.dispose&&K.delete(e.apiKey);try{localStorage.removeItem(ie+e.apiKey),localStorage.removeItem(Le(e.apiKey)),localStorage.removeItem(De(e.apiKey))}catch(d){}e.debug&&console.log("[sentient] destroyed")}};if(K.set(e.apiKey,{config:e,upgrade:null,dispose:z.dispose}),G=Lt(z,e.apiKey,a=>{f.then(()=>{U||at.add(a)})}),e.debug){let a=window;a.__sentient&&(a.__sentient.client=z)}return z}export{ie as a,de as b,ue as c,_t as d,Ke as e,nt as f,tn as g,nn as h,on as i,sn as j,rn as k,an as l,ln as m,cn as n,dn as o,un as p,pn as q,gn as r,fn as s,mn as t,yn as u,Sn as v,hn as w,vn as x,wn as y,kn as z,bn as A,Ot as B,At as C,Hn as D,ct as E,zn as F,Kt as G};
|
|
2
|
-
//# sourceMappingURL=chunk-TRBPPGFT.mjs.map
|