@runtypelabs/persona 4.23.2 → 4.24.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/animations/glyph-cycle.d.cts +1 -1
- package/dist/animations/glyph-cycle.d.ts +1 -1
- package/dist/animations/{types-CI7OckWI.d.cts → types-Db61aI9J.d.cts} +2 -0
- package/dist/animations/{types-CI7OckWI.d.ts → types-Db61aI9J.d.ts} +2 -0
- package/dist/animations/wipe.d.cts +1 -1
- package/dist/animations/wipe.d.ts +1 -1
- package/dist/animations-extra.d.cts +2 -0
- package/dist/animations-extra.d.ts +2 -0
- package/dist/approval-ui-3NMYNXBD.js +1 -0
- package/dist/approval-ui.cjs +2 -2
- package/dist/approval-ui.d.cts +215 -37
- package/dist/approval-ui.d.ts +215 -37
- package/dist/approval-ui.js +2 -2
- package/dist/{artifacts-ui-F4N6VMKF.js → artifacts-ui-IGB5YKLO.js} +4 -4
- package/dist/artifacts-ui.d.cts +210 -25
- package/dist/artifacts-ui.d.ts +210 -25
- package/dist/{chunk-NIKYKSNZ.js → chunk-7CO4T5KB.js} +1 -1
- package/dist/codegen.cjs +11 -11
- package/dist/codegen.js +13 -13
- package/dist/context-mentions.d.cts +210 -25
- package/dist/context-mentions.d.ts +210 -25
- package/dist/event-stream-view.d.cts +210 -25
- package/dist/event-stream-view.d.ts +210 -25
- package/dist/forms-ui.d.cts +245 -27
- package/dist/forms-ui.d.ts +245 -27
- package/dist/history-view.d.cts +2 -0
- package/dist/history-view.d.ts +2 -0
- package/dist/index.cjs +70 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +270 -39
- package/dist/index.d.ts +270 -39
- package/dist/index.global.js +57 -54
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +70 -69
- package/dist/index.js.map +1 -1
- package/dist/install.global.js +1 -1
- package/dist/install.global.js.map +1 -1
- package/dist/launcher.global.js +2 -2
- package/dist/launcher.global.js.map +1 -1
- package/dist/session-reconnect.d.cts +210 -25
- package/dist/session-reconnect.d.ts +210 -25
- package/dist/smart-dom-reader.d.cts +210 -25
- package/dist/smart-dom-reader.d.ts +210 -25
- package/dist/theme-editor-preview.cjs +74 -73
- package/dist/theme-editor-preview.d.cts +217 -25
- package/dist/theme-editor-preview.d.ts +217 -25
- package/dist/theme-editor-preview.js +51 -50
- package/dist/theme-editor.cjs +10 -10
- package/dist/theme-editor.d.cts +230 -27
- package/dist/theme-editor.d.ts +230 -27
- package/dist/theme-editor.js +10 -10
- package/dist/theme-reference.cjs +1 -1
- package/dist/theme-reference.d.cts +1522 -11
- package/dist/theme-reference.d.ts +1522 -11
- package/dist/theme-reference.js +1 -1
- package/dist/widget.css +1 -1
- package/package.json +3 -2
- package/src/__fixtures__/defaults-parity.v4.json +776 -0
- package/src/approval-ui-entry.ts +0 -1
- package/src/approval-ui-loader.ts +5 -4
- package/src/approval-ui.ts +0 -1
- package/src/client-identity-proof.test.ts +193 -0
- package/src/client-session-warm.test.ts +216 -0
- package/src/client-visitor-history.test.ts +6 -0
- package/src/client.ts +122 -30
- package/src/codegen.test.ts +24 -0
- package/src/components/activity-row.test.ts +100 -0
- package/src/components/activity-row.ts +136 -0
- package/src/components/approval-actions.test.ts +8 -5
- package/src/components/approval-actions.ts +19 -6
- package/src/components/approval-bubble.test.ts +56 -9
- package/src/components/approval-bubble.ts +36 -41
- package/src/components/composer-builder.ts +5 -2
- package/src/components/composer-parts.ts +10 -2
- package/src/components/header-builder.test.ts +32 -0
- package/src/components/header-builder.ts +7 -4
- package/src/components/header-layouts.test.ts +12 -0
- package/src/components/header-layouts.ts +3 -2
- package/src/components/launcher.ts +11 -2
- package/src/components/message-bubble.test.ts +22 -0
- package/src/components/message-bubble.ts +7 -3
- package/src/components/panel.test.ts +52 -1
- package/src/components/panel.ts +47 -8
- package/src/components/pill-composer-builder.test.ts +2 -0
- package/src/components/pill-composer-builder.ts +0 -1
- package/src/components/reasoning-bubble.ts +29 -17
- package/src/components/suggestions.test.ts +1 -0
- package/src/components/suggestions.ts +0 -16
- package/src/components/tool-bubble.ts +131 -114
- package/src/components/tool-details.test.ts +87 -0
- package/src/components/tool-details.ts +102 -0
- package/src/components/welcome.test.ts +8 -0
- package/src/components/welcome.ts +4 -2
- package/src/defaults-parity.test.ts +158 -0
- package/src/defaults.test.ts +69 -0
- package/src/defaults.ts +128 -49
- package/src/generated/runtype-openapi-contract.ts +2 -2
- package/src/index-core.ts +2 -0
- package/src/install.test.ts +24 -0
- package/src/install.ts +3 -1
- package/src/launcher-global.ts +2 -1
- package/src/launcher-variants.test.ts +52 -0
- package/src/runtime/init-update-reset.test.ts +21 -0
- package/src/session.ts +29 -6
- package/src/styles/widget-styles.test.ts +19 -0
- package/src/styles/widget.css +295 -23
- package/src/theme-editor/index.ts +2 -0
- package/src/theme-editor/preview-utils.test.ts +8 -0
- package/src/theme-editor/preview-utils.ts +7 -3
- package/src/theme-editor/sections.test.ts +31 -0
- package/src/theme-editor/sections.ts +55 -1
- package/src/theme-editor/state-preferences.test.ts +49 -0
- package/src/theme-editor/state.ts +73 -15
- package/src/theme-reference.test.ts +20 -0
- package/src/theme-reference.ts +11 -5
- package/src/tool-call-display-defaults.test.ts +33 -1
- package/src/types/theme.ts +80 -3
- package/src/types.ts +136 -22
- package/src/ui.activity-row.test.ts +91 -0
- package/src/ui.approval-plugin.test.ts +63 -0
- package/src/ui.composer-compact.test.ts +24 -2
- package/src/ui.composer-placement.test.ts +23 -0
- package/src/ui.detached-panel.test.ts +33 -6
- package/src/ui.docked.test.ts +19 -0
- package/src/ui.header-update-stability.test.ts +25 -0
- package/src/ui.identity-proof.test.ts +58 -0
- package/src/ui.launcher-teaser.test.ts +25 -0
- package/src/ui.message-width.test.ts +17 -2
- package/src/ui.reasoning-display.test.ts +92 -0
- package/src/ui.rebuild-composer.test.ts +20 -3
- package/src/ui.scroll.test.ts +32 -0
- package/src/ui.session-init.test.ts +312 -0
- package/src/ui.status-indicator.test.ts +82 -0
- package/src/ui.suggest-replies.test.ts +11 -0
- package/src/ui.ts +363 -74
- package/src/ui.v5-defaults.test.ts +144 -0
- package/src/ui.welcome.test.ts +92 -3
- package/src/utils/__snapshots__/tokens-parity.test.ts.snap +811 -140
- package/src/utils/code-generators.ts +14 -0
- package/src/utils/composer-compact.test.ts +0 -2
- package/src/utils/composer-compact.ts +2 -4
- package/src/utils/composer-placement.ts +2 -3
- package/src/utils/config-merge.test.ts +81 -5
- package/src/utils/config-merge.ts +13 -3
- package/src/utils/defaults-provenance.ts +67 -0
- package/src/utils/dock.ts +7 -1
- package/src/utils/launcher-variant.ts +16 -0
- package/src/utils/panel-config.ts +97 -0
- package/src/utils/status-indicator.ts +39 -0
- package/src/utils/theme.test.ts +182 -0
- package/src/utils/theme.ts +131 -18
- package/src/utils/tokens.test.ts +122 -1
- package/src/utils/tokens.ts +177 -17
- package/src/welcome.test.ts +23 -0
- package/src/welcome.ts +16 -9
- package/dist/approval-ui-K7R5Q5OC.js +0 -1
package/dist/artifacts-ui.d.ts
CHANGED
|
@@ -23,6 +23,7 @@ interface ResolvedWelcomeConfig {
|
|
|
23
23
|
* Optional on the interface, always populated by `resolveWelcomeConfig`:
|
|
24
24
|
* a plugin literal built against an older minor must still type-check.
|
|
25
25
|
*/
|
|
26
|
+
layout?: "top" | "centered";
|
|
26
27
|
anchor?: AgentWidgetWelcomeAnchor;
|
|
27
28
|
/** Percentage string; validated, falls back to "44%". */
|
|
28
29
|
anchorComposerTop?: string;
|
|
@@ -794,6 +795,8 @@ interface InputTokens extends ComponentTokenSet {
|
|
|
794
795
|
backdropFilter?: string;
|
|
795
796
|
}
|
|
796
797
|
interface LauncherTokens extends ComponentTokenSet {
|
|
798
|
+
/** Distance from the viewport edges. Circle default: 20px; pill: 24px. */
|
|
799
|
+
offset?: string;
|
|
797
800
|
size: string;
|
|
798
801
|
iconSize: string;
|
|
799
802
|
shadow: TokenReference<'shadow'>;
|
|
@@ -816,6 +819,15 @@ interface PanelTokens extends ComponentTokenSet {
|
|
|
816
819
|
inset?: string;
|
|
817
820
|
/** Background of the region revealed behind a detached panel. */
|
|
818
821
|
canvasBackground?: string;
|
|
822
|
+
/** Chrome defaults by rendered panel mode. */
|
|
823
|
+
modes?: Partial<Record<'floating' | 'inline' | 'sidebar' | 'docked' | 'mobile', {
|
|
824
|
+
/** Full border shorthand (for example, `"1px solid var(--persona-border)"`). */
|
|
825
|
+
border?: string;
|
|
826
|
+
/** Box-shadow token reference or raw CSS shadow. */
|
|
827
|
+
shadow?: string;
|
|
828
|
+
/** Corner radius token reference or raw CSS radius. */
|
|
829
|
+
borderRadius?: TokenReference<'radius'>;
|
|
830
|
+
}>>;
|
|
819
831
|
}
|
|
820
832
|
/** Per-element text styling shared by themable text surfaces. */
|
|
821
833
|
interface TextStyleTokens {
|
|
@@ -842,10 +854,16 @@ interface HeaderTokens extends ComponentTokenSet {
|
|
|
842
854
|
*/
|
|
843
855
|
border?: TokenReference<'color'>;
|
|
844
856
|
borderRadius: TokenReference<'radius'>;
|
|
857
|
+
/** Standard-header padding. @default "20px 24px" */
|
|
858
|
+
padding?: string;
|
|
859
|
+
/** Minimal-header padding. Explicitly wins over `padding`. @default "16px 24px" */
|
|
860
|
+
minimalPadding?: string;
|
|
845
861
|
/** Background of the rounded avatar tile next to the title (Lucide / emoji / image). */
|
|
846
862
|
iconBackground: TokenReference<'color'>;
|
|
847
863
|
/** Foreground (glyph stroke or emoji text) on the header avatar tile. */
|
|
848
864
|
iconForeground: TokenReference<'color'>;
|
|
865
|
+
/** Header identity glyph size as a fraction of its icon box. @default "0.6" */
|
|
866
|
+
iconScale?: string;
|
|
849
867
|
/**
|
|
850
868
|
* Legacy alias of `title.color`; `title.color` wins when both are set.
|
|
851
869
|
* Unset, the title takes `foreground`, then the primary color.
|
|
@@ -884,6 +902,14 @@ interface HeaderTokens extends ComponentTokenSet {
|
|
|
884
902
|
* sibling. @default "1.5"
|
|
885
903
|
*/
|
|
886
904
|
controlStrokeWidth?: string;
|
|
905
|
+
/** Header control corner radius. Per-control radius overrides win. */
|
|
906
|
+
controlBorderRadius?: string;
|
|
907
|
+
/** Default control hover/focus fill. Explicit button backgrounds win. */
|
|
908
|
+
controlHoverBackground?: TokenReference<'color'>;
|
|
909
|
+
/** Default control hover/focus icon color. Explicit button colors win. */
|
|
910
|
+
controlHoverForeground?: TokenReference<'color'>;
|
|
911
|
+
/** Keyboard focus outline; unset preserves the browser default. */
|
|
912
|
+
controlFocusOutline?: string;
|
|
887
913
|
/** Box-shadow on the header (e.g., a fade shadow to replace the default border). */
|
|
888
914
|
shadow?: string;
|
|
889
915
|
/** Override the header bottom border (e.g., `none`). */
|
|
@@ -1058,6 +1084,12 @@ interface MessageGeometryTokens {
|
|
|
1058
1084
|
lineHeight?: string;
|
|
1059
1085
|
}
|
|
1060
1086
|
interface MessageTokens {
|
|
1087
|
+
/** Height of the optional transcript top fade. Default 18px. */
|
|
1088
|
+
topFadeHeight?: string;
|
|
1089
|
+
/** Vertical gap between transcript turns. @default "12px" */
|
|
1090
|
+
gap?: string;
|
|
1091
|
+
/** Gap between turns in fullscreen mode; falls back to `gap`. */
|
|
1092
|
+
fullscreenGap?: string;
|
|
1061
1093
|
user: MessageGeometryTokens & {
|
|
1062
1094
|
background: TokenReference<'color'>;
|
|
1063
1095
|
text: TokenReference<'color'>;
|
|
@@ -1071,6 +1103,8 @@ interface MessageTokens {
|
|
|
1071
1103
|
borderRadius: TokenReference<'radius'>;
|
|
1072
1104
|
/** Assistant bubble border color (CSS color). */
|
|
1073
1105
|
border?: TokenReference<'color'>;
|
|
1106
|
+
/** Border width; set to 0px for a flat assistant response. @default "1px" */
|
|
1107
|
+
borderWidth?: string;
|
|
1074
1108
|
/** Assistant bubble box-shadow (token ref or raw CSS, e.g. `none`). */
|
|
1075
1109
|
shadow?: string;
|
|
1076
1110
|
};
|
|
@@ -1189,12 +1223,40 @@ interface AttachmentTokens {
|
|
|
1189
1223
|
};
|
|
1190
1224
|
}
|
|
1191
1225
|
/** Tool-call row chrome (collapsible tool bubbles). */
|
|
1192
|
-
interface
|
|
1226
|
+
interface ActivityTokens {
|
|
1227
|
+
/** Minimum activity row height. */
|
|
1228
|
+
rowHeight?: string;
|
|
1229
|
+
/** Group child indentation; falls back to indent when unset. V5: 0px. */
|
|
1230
|
+
groupIndent?: string;
|
|
1231
|
+
/** Extra vertical gap between grouped rows. V5: 0px. */
|
|
1232
|
+
groupGap?: string;
|
|
1233
|
+
/** Padding around expanded group children. V5: 0px. */
|
|
1234
|
+
groupPadding?: string;
|
|
1235
|
+
/** Gap between consecutive activity entries. V5: 0px. */
|
|
1236
|
+
transcriptGap?: string;
|
|
1237
|
+
/** Gap from activity to an assistant response. V5: 12px. */
|
|
1238
|
+
responseGap?: string;
|
|
1239
|
+
/** Expanded body padding. V5: 4px 0. */
|
|
1240
|
+
bodyPadding?: string;
|
|
1241
|
+
/** Expanded reasoning text size. V5: 13px. */
|
|
1242
|
+
bodySize?: string;
|
|
1243
|
+
/** Expanded reasoning line height. V5: 1.5. */
|
|
1244
|
+
bodyLineHeight?: string;
|
|
1245
|
+
/** Expanded reasoning font weight. V5: 400. */
|
|
1246
|
+
bodyFontWeight?: string;
|
|
1247
|
+
/** Gap between expanded detail sections. V5: 8px. */
|
|
1248
|
+
sectionGap?: string;
|
|
1249
|
+
labelSize?: string;
|
|
1250
|
+
iconSize?: string;
|
|
1251
|
+
indent?: string;
|
|
1252
|
+
bodySurface?: TokenReference<'color'>;
|
|
1253
|
+
}
|
|
1254
|
+
interface ToolBubbleTokens extends ActivityTokens {
|
|
1193
1255
|
/** Box-shadow for tool bubbles (token ref or raw CSS, e.g. `none`). */
|
|
1194
1256
|
shadow: string;
|
|
1195
1257
|
}
|
|
1196
1258
|
/** Reasoning / “thinking” row chrome. */
|
|
1197
|
-
interface ReasoningBubbleTokens {
|
|
1259
|
+
interface ReasoningBubbleTokens extends ActivityTokens {
|
|
1198
1260
|
shadow: string;
|
|
1199
1261
|
}
|
|
1200
1262
|
/** One event-stream badge chip: fill + text pair. The chip border derives
|
|
@@ -1328,6 +1390,10 @@ interface ComposerChromeTokens {
|
|
|
1328
1390
|
shadow: string;
|
|
1329
1391
|
/** Border color of the composer form. @default semantic.colors.border */
|
|
1330
1392
|
borderColor?: TokenReference<'color'>;
|
|
1393
|
+
/** Focused form border color; falls back to borderColor. V5: a stronger neutral border. */
|
|
1394
|
+
focusBorderColor?: TokenReference<'color'>;
|
|
1395
|
+
/** Outer focus ring (CSS outline shorthand). V4: none; V5: a thin neutral ring. */
|
|
1396
|
+
focusRing?: string;
|
|
1331
1397
|
/** Inner padding of the composer form (raw CSS shorthand). @default "0.75rem 1rem" */
|
|
1332
1398
|
padding?: string;
|
|
1333
1399
|
/** Gap between the textarea row and the actions row. @default "0.5rem" */
|
|
@@ -1346,12 +1412,18 @@ interface ComposerChromeTokens {
|
|
|
1346
1412
|
controlSize?: string;
|
|
1347
1413
|
/** Glyph box inside those controls. @default "24px" */
|
|
1348
1414
|
controlIconSize?: string;
|
|
1415
|
+
/** Send/stop glyph size. Explicit sendButton.iconSize wins. V5: 18px. */
|
|
1416
|
+
sendIconSize?: string;
|
|
1417
|
+
/** Icon-mode submit button radius. V4 inherits the primary button; V5: 9999px. */
|
|
1418
|
+
sendButtonRadius?: string;
|
|
1419
|
+
/** Footer top border (CSS shorthand). V4: 1px solid divider; V5: none. */
|
|
1420
|
+
footerBorder?: string;
|
|
1349
1421
|
/**
|
|
1350
1422
|
* Background painted behind an overlaid composer footer
|
|
1351
1423
|
* (`composer.placement: "overlay"`). Any CSS `background` value, gradients
|
|
1352
1424
|
* included — same convention as the shadow tokens. Inert under
|
|
1353
1425
|
* `placement: "block"`.
|
|
1354
|
-
* @default "transparent"
|
|
1426
|
+
* @default "transparent" (V4); a theme-aware 24px fade (V5)
|
|
1355
1427
|
*/
|
|
1356
1428
|
overlayBand?: string;
|
|
1357
1429
|
/** Segmented mode-group track. */
|
|
@@ -1527,6 +1599,8 @@ interface ScrollToBottomTokens extends ComponentTokenSet {
|
|
|
1527
1599
|
}
|
|
1528
1600
|
/** Visual tokens shared by one suggestion presentation variant. */
|
|
1529
1601
|
interface SuggestionVariantTokens extends ComponentTokenSet {
|
|
1602
|
+
/** Label weight. V4: 500; V5: 400. */
|
|
1603
|
+
fontWeight?: string;
|
|
1530
1604
|
/** Space inside one item, between its icon and its copy. */
|
|
1531
1605
|
gap?: string;
|
|
1532
1606
|
/** Space between suggestion items in the container. */
|
|
@@ -1575,6 +1649,7 @@ interface ComponentTokens {
|
|
|
1575
1649
|
voice: VoiceTokens;
|
|
1576
1650
|
approval: ApprovalTokens;
|
|
1577
1651
|
attachment: AttachmentTokens;
|
|
1652
|
+
activity?: ActivityTokens;
|
|
1578
1653
|
toolBubble: ToolBubbleTokens;
|
|
1579
1654
|
reasoningBubble: ReasoningBubbleTokens;
|
|
1580
1655
|
/** Event-stream inspector badge chips. */
|
|
@@ -4295,6 +4370,14 @@ type AgentWidgetToolCallCollapsedMode = "tool-call" | "tool-name" | "tool-previe
|
|
|
4295
4370
|
*/
|
|
4296
4371
|
type AgentWidgetToolCallLoadingAnimation = "none" | "pulse" | "shimmer" | "shimmer-color" | "rainbow";
|
|
4297
4372
|
type AgentWidgetToolCallDisplayFeature = {
|
|
4373
|
+
/** Activity chrome. Defaults to card in V4 and row with future.v5Defaults. */
|
|
4374
|
+
variant?: "card" | "row";
|
|
4375
|
+
/** Row status icons: always, active/attention-needed only, or never. V5 defaults to active; V4 to always. */
|
|
4376
|
+
iconVisibility?: "always" | "active" | "never";
|
|
4377
|
+
/** Row variant: open when the first content chunk arrives. Default false in V5; true in V4. */
|
|
4378
|
+
autoExpand?: boolean;
|
|
4379
|
+
/** Row variant: collapse once after completion, in ms; false disables. Default 1000. */
|
|
4380
|
+
autoCollapseDelay?: number | false;
|
|
4298
4381
|
/**
|
|
4299
4382
|
* Controls what collapsed tool call rows show in their header/summary area.
|
|
4300
4383
|
* @default "tool-call"
|
|
@@ -4325,9 +4408,10 @@ type AgentWidgetToolCallDisplayFeature = {
|
|
|
4325
4408
|
* Controls how a grouped tool sequence is rendered.
|
|
4326
4409
|
* - `"stack"`: show the group summary and each child tool row.
|
|
4327
4410
|
* - `"summary"`: show one consolidated summary row only.
|
|
4411
|
+
* - `"collapsible"`: expandable activity group (V5 default).
|
|
4328
4412
|
* @default "stack"
|
|
4329
4413
|
*/
|
|
4330
|
-
groupedMode?: "stack" | "summary";
|
|
4414
|
+
groupedMode?: "stack" | "summary" | "collapsible";
|
|
4331
4415
|
/**
|
|
4332
4416
|
* What happens to a tool call row once it completes.
|
|
4333
4417
|
*
|
|
@@ -4358,6 +4442,14 @@ type AgentWidgetToolCallDisplayFeature = {
|
|
|
4358
4442
|
/** See `features.toolCallDisplay.completedVisibility`. */
|
|
4359
4443
|
type AgentWidgetToolCallCompletedVisibility = "kept" | "removed";
|
|
4360
4444
|
type AgentWidgetReasoningDisplayFeature = {
|
|
4445
|
+
/** Activity chrome. Defaults to card in V4 and row with future.v5Defaults. */
|
|
4446
|
+
variant?: "card" | "row";
|
|
4447
|
+
/** Row status icons: always, active/attention-needed only, or never. V5 defaults to active; V4 to always. */
|
|
4448
|
+
iconVisibility?: "always" | "active" | "never";
|
|
4449
|
+
/** Row variant: open when the first content chunk arrives. Default false in V5; true in V4. */
|
|
4450
|
+
autoExpand?: boolean;
|
|
4451
|
+
/** Row variant: collapse once after completion, in ms; false disables. Default 1000. */
|
|
4452
|
+
autoCollapseDelay?: number | false;
|
|
4361
4453
|
/**
|
|
4362
4454
|
* When true, active collapsed reasoning rows can render a lightweight preview block.
|
|
4363
4455
|
* @default false
|
|
@@ -5053,8 +5145,8 @@ interface AgentWidgetHistoryFeature {
|
|
|
5053
5145
|
* otherwise `"browser"`) and narrows it to what the provider advertises, so a
|
|
5054
5146
|
* browser-only provider is never asked for a scope it cannot serve. An
|
|
5055
5147
|
* explicit `features.history.scope` is a hard request and still fails closed
|
|
5056
|
-
* with `unsupported_scope`.
|
|
5057
|
-
*
|
|
5148
|
+
* with `unsupported_scope`. History operations on a supplied provider never
|
|
5149
|
+
* call `getIdentityProof`, and `HistoryOperationContext` carries only the resolved scope;
|
|
5058
5150
|
* report your own identity through `getIdentityStatus()` /
|
|
5059
5151
|
* `subscribeIdentityStatus()`, which is what the scope banner and its retry
|
|
5060
5152
|
* affordance read.
|
|
@@ -5438,7 +5530,7 @@ type EventStreamConfig = {
|
|
|
5438
5530
|
/**
|
|
5439
5531
|
* Fields to extract from event payloads for description text.
|
|
5440
5532
|
* The first matching field value is displayed after the badge.
|
|
5441
|
-
* @default ["flowName", "stepName", "name", "tool", "toolName"]
|
|
5533
|
+
* @default ["flowName", "stepName", "reasoningText", "text", "name", "tool", "toolName"]
|
|
5442
5534
|
*/
|
|
5443
5535
|
descriptionFields?: string[];
|
|
5444
5536
|
/**
|
|
@@ -5649,6 +5741,8 @@ type AgentWidgetComposerBarPeekConfig = {
|
|
|
5649
5741
|
streamAnimation?: AgentWidgetStreamAnimationFeature;
|
|
5650
5742
|
};
|
|
5651
5743
|
type AgentWidgetLauncherConfig = {
|
|
5744
|
+
/** Collapsed launcher shape. V4 defaults to pill; V5 defaults to circle. */
|
|
5745
|
+
variant?: "pill" | "circle";
|
|
5652
5746
|
enabled?: boolean;
|
|
5653
5747
|
title?: string;
|
|
5654
5748
|
subtitle?: string;
|
|
@@ -6392,9 +6486,9 @@ type AgentWidgetComposerConfig = {
|
|
|
6392
6486
|
/**
|
|
6393
6487
|
* Where the composer footer sits relative to the transcript.
|
|
6394
6488
|
*
|
|
6395
|
-
* - `"block"` (default): the footer is a flex sibling below the scroll body.
|
|
6489
|
+
* - `"block"` (V4 default): the footer is a flex sibling below the scroll body.
|
|
6396
6490
|
* Nothing scrolls behind it.
|
|
6397
|
-
* - `"overlay"
|
|
6491
|
+
* - `"overlay"` (V5 default): the footer is absolutely overlaid on the scroll body, so the
|
|
6398
6492
|
* transcript scrolls behind it (the chatgpt.com / claude.ai model, where the
|
|
6399
6493
|
* composer is sticky inside the scroller). The widget reserves the footer's
|
|
6400
6494
|
* live height as bottom padding on the scroll body and on a plugin welcome
|
|
@@ -6406,7 +6500,7 @@ type AgentWidgetComposerConfig = {
|
|
|
6406
6500
|
* included) and `theme.components.input.backdropFilter`.
|
|
6407
6501
|
*
|
|
6408
6502
|
* Ignored in composer-bar mount mode, which owns its own geometry.
|
|
6409
|
-
* @default "block"
|
|
6503
|
+
* @default "block" (V4), "overlay" (V5)
|
|
6410
6504
|
*/
|
|
6411
6505
|
placement?: ComposerPlacement;
|
|
6412
6506
|
/**
|
|
@@ -6420,8 +6514,9 @@ type AgentWidgetComposerConfig = {
|
|
|
6420
6514
|
*
|
|
6421
6515
|
* `"single-row"` describes the IDLE composer only. It composes with the
|
|
6422
6516
|
* compact state, so a wrapped draft, chips, attachment previews, a quote, a
|
|
6423
|
-
* pending card
|
|
6424
|
-
* as `data-persona-composer-compact` does today.
|
|
6517
|
+
* pending card all fall back to the stacked card, exactly
|
|
6518
|
+
* as `data-persona-composer-compact` does today. Recording alone does not
|
|
6519
|
+
* expand the composer; dictated text expands it when it wraps.
|
|
6425
6520
|
*
|
|
6426
6521
|
* Ignored in composer-bar mount mode, whose pill is already one row.
|
|
6427
6522
|
* @default "stacked"
|
|
@@ -6463,7 +6558,14 @@ type AgentWidgetClearChatConfig = {
|
|
|
6463
6558
|
showTooltip?: boolean;
|
|
6464
6559
|
};
|
|
6465
6560
|
type AgentWidgetStatusIndicatorConfig = {
|
|
6561
|
+
/** Show the indicator. Explicit false also hides transient connection states. */
|
|
6466
6562
|
visible?: boolean;
|
|
6563
|
+
/**
|
|
6564
|
+
* "always" shows status beneath the composer; "transient" shows connecting,
|
|
6565
|
+
* reconnecting, and error status above it, hiding normal idle/streaming status.
|
|
6566
|
+
* Available in both defaults states. Default: "always" in v4, "transient" in v5.
|
|
6567
|
+
*/
|
|
6568
|
+
mode?: "always" | "transient";
|
|
6467
6569
|
/** Text alignment. Default: 'right'. */
|
|
6468
6570
|
align?: 'left' | 'center' | 'right';
|
|
6469
6571
|
idleText?: string;
|
|
@@ -7238,7 +7340,8 @@ type AgentWidgetResolvedSuggestion = {
|
|
|
7238
7340
|
};
|
|
7239
7341
|
/** Presentation keys shared by every suggestion surface. */
|
|
7240
7342
|
type AgentWidgetSuggestionSurfaceConfig = {
|
|
7241
|
-
/** Item density.
|
|
7343
|
+
/** Item density. V4 starters: card. V5 starters: chip, or card in fullscreen.
|
|
7344
|
+
* Follow-ups default to chip. */
|
|
7242
7345
|
variant?: AgentWidgetSuggestionVariant;
|
|
7243
7346
|
/** Default click behavior, overridable per item. Defaults to `send`. */
|
|
7244
7347
|
behavior?: AgentWidgetSuggestionBehavior;
|
|
@@ -7249,7 +7352,7 @@ type AgentWidgetSuggestionSurfaceConfig = {
|
|
|
7249
7352
|
* own stacking.
|
|
7250
7353
|
*/
|
|
7251
7354
|
overflow?: "scroll" | "wrap";
|
|
7252
|
-
/** Maximum visible items. Defaults to 4. */
|
|
7355
|
+
/** Maximum visible items. Defaults to 4, or 3 for V5 non-fullscreen starters. */
|
|
7253
7356
|
maxItems?: number;
|
|
7254
7357
|
};
|
|
7255
7358
|
type AgentWidgetStarterSuggestionsConfig = AgentWidgetSuggestionSurfaceConfig & {
|
|
@@ -7303,8 +7406,8 @@ type AgentWidgetSuggestionsConfig = {
|
|
|
7303
7406
|
type AgentWidgetWelcomeVariant = "card" | "hero" | "none";
|
|
7304
7407
|
/**
|
|
7305
7408
|
* When the welcome surface goes away. `"never"` is the default for `"card"`;
|
|
7306
|
-
* `"on-first-message"` is
|
|
7307
|
-
*
|
|
7409
|
+
* `"on-first-message"` is forced for legacy V4 `"hero"`. V5 defaults every
|
|
7410
|
+
* variant to `"on-first-message"`. Explicit layout opts into overridable dismissal.
|
|
7308
7411
|
*/
|
|
7309
7412
|
type AgentWidgetWelcomeDismiss = "never" | "on-first-message";
|
|
7310
7413
|
/**
|
|
@@ -7358,7 +7461,10 @@ type AgentWidgetWelcomeAlign = "start" | "center";
|
|
|
7358
7461
|
* host-set value from a filled-in default.
|
|
7359
7462
|
*/
|
|
7360
7463
|
interface AgentWidgetWelcomeConfig {
|
|
7361
|
-
/**
|
|
7464
|
+
/** Vertical placement: V4 defaults to top; V5 to centered. Fullscreen centered
|
|
7465
|
+
* welcomes also raise the empty composer unless `anchor` is explicitly set. */
|
|
7466
|
+
layout?: "top" | "centered";
|
|
7467
|
+
/** Card or hero title. V4: "Hello 👋". V5: "What can I help with?". */
|
|
7362
7468
|
title?: string;
|
|
7363
7469
|
/**
|
|
7364
7470
|
* Small muted line above the title, e.g. a section name. Omitted when unset
|
|
@@ -7371,19 +7477,22 @@ interface AgentWidgetWelcomeConfig {
|
|
|
7371
7477
|
icon?: AgentWidgetWelcomeIcon;
|
|
7372
7478
|
/**
|
|
7373
7479
|
* Horizontal alignment of the kicker, title, subtitle, and starter
|
|
7374
|
-
* suggestions.
|
|
7480
|
+
* suggestions. Centered layouts default to center. Otherwise unset follows
|
|
7481
|
+
* the variant: `card` starts, `hero` centers.
|
|
7375
7482
|
*/
|
|
7376
7483
|
align?: AgentWidgetWelcomeAlign;
|
|
7377
7484
|
/** @default "card" */
|
|
7378
7485
|
variant?: AgentWidgetWelcomeVariant;
|
|
7379
|
-
/**
|
|
7486
|
+
/** V4: never for card, forced on-first-message for hero. V5: on-first-message
|
|
7487
|
+
* for all variants; explicit values win. Explicit layout also allows overriding
|
|
7488
|
+
* the legacy hero dismissal in V4. */
|
|
7380
7489
|
dismiss?: AgentWidgetWelcomeDismiss;
|
|
7381
7490
|
/**
|
|
7382
7491
|
* Vertical anchoring of the greeting-plus-composer pair in the EMPTY
|
|
7383
7492
|
* conversation only. On the first message the pair drops to the bottom
|
|
7384
7493
|
* (animated; see `data-persona-conversation-state`).
|
|
7385
7494
|
*
|
|
7386
|
-
* - `"bottom"
|
|
7495
|
+
* - `"bottom"`: the composer stays pinned at the bottom.
|
|
7387
7496
|
* - `"center"`: greeting and composer float together so the composer's top
|
|
7388
7497
|
* edge lands at `anchorComposerTop` of the panel column, and the welcome
|
|
7389
7498
|
* surface is end-anchored `composerGap` above it.
|
|
@@ -7391,7 +7500,8 @@ interface AgentWidgetWelcomeConfig {
|
|
|
7391
7500
|
* Composes with either `composer.placement`. Ignored in composer-bar mount
|
|
7392
7501
|
* mode. `renderWelcome` plugin content inherits the anchor: the widget
|
|
7393
7502
|
* positions the overlay host and reserves the composer zone.
|
|
7394
|
-
*
|
|
7503
|
+
* Defaults to bottom, except centered fullscreen layouts, which center the
|
|
7504
|
+
* measured greeting/composer group when no anchor override is supplied.
|
|
7395
7505
|
*/
|
|
7396
7506
|
anchor?: AgentWidgetWelcomeAnchor;
|
|
7397
7507
|
/**
|
|
@@ -7883,6 +7993,9 @@ type AgentWidgetLayoutConfig = {
|
|
|
7883
7993
|
* `launcher.composerBar.contentMaxWidth`)
|
|
7884
7994
|
*/
|
|
7885
7995
|
contentMaxWidth?: string;
|
|
7996
|
+
/** Fade the transcript's top edge when content is scrolled above it.
|
|
7997
|
+
* Defaults to false in V4 and true with future.v5Defaults. */
|
|
7998
|
+
topFade?: boolean;
|
|
7886
7999
|
};
|
|
7887
8000
|
/**
|
|
7888
8001
|
* Token types for marked renderer methods
|
|
@@ -8496,7 +8609,30 @@ type AgentWidgetLoadingIndicatorConfig = {
|
|
|
8496
8609
|
*/
|
|
8497
8610
|
renderIdle?: (context: IdleIndicatorRenderContext) => HTMLElement | null;
|
|
8498
8611
|
};
|
|
8612
|
+
/** Built-in `sessionInit` triggers. See {@link AgentWidgetConfig.sessionInit}. */
|
|
8613
|
+
type AgentWidgetSessionInitTrigger = 'input' | 'focus' | 'mount' | 'send';
|
|
8614
|
+
/**
|
|
8615
|
+
* Custom `sessionInit` trigger. Runs when the widget mounts in client token mode,
|
|
8616
|
+
* and again if `update()` swaps in a different function. Call `warm()` whenever
|
|
8617
|
+
* the visitor shows intent (it is safe to call repeatedly). Return a cleanup to
|
|
8618
|
+
* run when the widget is destroyed or the hook is replaced.
|
|
8619
|
+
*/
|
|
8620
|
+
type AgentWidgetSessionInitHook = (context: {
|
|
8621
|
+
/** Fire-and-forget early session init; latched and error-swallowing. */
|
|
8622
|
+
warm: () => void;
|
|
8623
|
+
/** The widget's mount element. */
|
|
8624
|
+
mount: HTMLElement;
|
|
8625
|
+
}) => void | (() => void);
|
|
8499
8626
|
type AgentWidgetConfig = {
|
|
8627
|
+
/** Opt in to upcoming major-version defaults without changing explicit settings. */
|
|
8628
|
+
future?: {
|
|
8629
|
+
/**
|
|
8630
|
+
* Use the v5 default styling as it rolls out in 4.x. Every affected setting
|
|
8631
|
+
* remains independently configurable. Explicit options and theme tokens win.
|
|
8632
|
+
* @default false
|
|
8633
|
+
*/
|
|
8634
|
+
v5Defaults?: boolean;
|
|
8635
|
+
};
|
|
8500
8636
|
apiUrl?: string;
|
|
8501
8637
|
flowId?: string;
|
|
8502
8638
|
/**
|
|
@@ -8651,6 +8787,46 @@ type AgentWidgetConfig = {
|
|
|
8651
8787
|
* ```
|
|
8652
8788
|
*/
|
|
8653
8789
|
onSessionExpired?: () => void;
|
|
8790
|
+
/**
|
|
8791
|
+
* When the widget calls `/v1/client/init` in client token mode, ahead of the
|
|
8792
|
+
* first send. Ignored outside client token mode.
|
|
8793
|
+
*
|
|
8794
|
+
* - `'input'` (default): on the composer's first user keystroke that leaves
|
|
8795
|
+
* non-empty text. Programmatic value changes (restored drafts,
|
|
8796
|
+
* `setMessage()`, history recall) do not count.
|
|
8797
|
+
* - `'focus'`: when the visitor focuses the composer by pointer or Tab (and
|
|
8798
|
+
* on first input, as a fallback). Programmatic focus, such as
|
|
8799
|
+
* `autoFocusInput` on open or mount, does not count.
|
|
8800
|
+
* - `'mount'`: as soon as the widget mounts (the behavior before this option
|
|
8801
|
+
* existed). Use it when a server-configured welcome message, which arrives
|
|
8802
|
+
* with the init response, must show before the visitor types.
|
|
8803
|
+
* - `'send'`: no early init; the first send initializes the session.
|
|
8804
|
+
* - A function: custom trigger. Called on mount (and when `update()` swaps
|
|
8805
|
+
* in a different function) with a `warm` callback to call whenever you
|
|
8806
|
+
* decide (e.g. on hover); may return a cleanup that runs on destroy or
|
|
8807
|
+
* replacement. Replaces the built-in triggers.
|
|
8808
|
+
*
|
|
8809
|
+
* The early init is fire-and-forget: it runs at most once per session
|
|
8810
|
+
* lifetime (re-armed after expiry or a new conversation), sends exactly the
|
|
8811
|
+
* same request the send would, and swallows errors. A failure resurfaces
|
|
8812
|
+
* when the send retries init. A send during an in-flight early init reuses
|
|
8813
|
+
* it, so only one `/v1/client/init` is issued. When visitor history is
|
|
8814
|
+
* enabled the widget still initializes on mount to restore the conversation.
|
|
8815
|
+
* Hosts can also trigger it imperatively with `controller.warmSession()`.
|
|
8816
|
+
*
|
|
8817
|
+
* @default 'input'
|
|
8818
|
+
*
|
|
8819
|
+
* @example
|
|
8820
|
+
* ```typescript
|
|
8821
|
+
* config: {
|
|
8822
|
+
* clientToken: 'ct_live_...',
|
|
8823
|
+
* sessionInit: ({ warm, mount }) => {
|
|
8824
|
+
* mount.addEventListener('pointerenter', warm, { once: true });
|
|
8825
|
+
* }
|
|
8826
|
+
* }
|
|
8827
|
+
* ```
|
|
8828
|
+
*/
|
|
8829
|
+
sessionInit?: AgentWidgetSessionInitTrigger | AgentWidgetSessionInitHook;
|
|
8654
8830
|
/**
|
|
8655
8831
|
* Get stored session ID for session resumption (client token mode only).
|
|
8656
8832
|
* Called when initializing a new session to check if there's a previous session_id
|
|
@@ -8683,13 +8859,20 @@ type AgentWidgetConfig = {
|
|
|
8683
8859
|
*/
|
|
8684
8860
|
setStoredSessionId?: (sessionId: string) => void;
|
|
8685
8861
|
/**
|
|
8686
|
-
*
|
|
8862
|
+
* With identityProvider, called before every client-token chat POST, including retries, independently of history.
|
|
8863
|
+
* Also called immediately before any cross-device history request and before a
|
|
8687
8864
|
* conversationId resume of a conversation discovered on another device.
|
|
8688
|
-
* Return a fresh end-user access token (rt_eu_… / JWT). Null
|
|
8689
|
-
*
|
|
8690
|
-
* until resetHistoryIdentity()
|
|
8865
|
+
* Return a fresh end-user access token (rt_eu_… / JWT). Null stops identity-enabled chat.
|
|
8866
|
+
* For history only, null uses exact-browser scope for a never-bound visitor;
|
|
8867
|
+
* a bound visitor fails closed until resetHistoryIdentity(). Never cached.
|
|
8691
8868
|
*/
|
|
8692
8869
|
getIdentityProof?: () => string | null | Promise<string | null>;
|
|
8870
|
+
/**
|
|
8871
|
+
* Provider name registered with Runtype, for example "clerk". Enables per-request
|
|
8872
|
+
* chat identity through getIdentityProof without enabling history. A missing or
|
|
8873
|
+
* failed proof stops the turn; omitting this preserves history-only callbacks.
|
|
8874
|
+
*/
|
|
8875
|
+
identityProvider?: string;
|
|
8693
8876
|
/**
|
|
8694
8877
|
* Read the persisted active conversation id (client token mode only).
|
|
8695
8878
|
* Called only after the internal stored-state bootstrap gate resolves.
|
|
@@ -9363,6 +9546,8 @@ type AgentWidgetReasoning = {
|
|
|
9363
9546
|
durationMs?: number;
|
|
9364
9547
|
};
|
|
9365
9548
|
type AgentWidgetToolCall = {
|
|
9549
|
+
/** Optional approval state for activity-row status chrome. */
|
|
9550
|
+
approvalStatus?: "pending" | "approved" | "denied" | "timeout";
|
|
9366
9551
|
id: string;
|
|
9367
9552
|
name?: string;
|
|
9368
9553
|
status: "pending" | "running" | "complete";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as I}from"./chunk-7NQ4ZTHF.js";import{a as f,d as z}from"./chunk-76IELU7F.js";var A=o=>{let{fallbackImport:e,resetOnSetLoader:n=!1}=o,t=null,r=null,s=null;return{setLoader:a=>{t=a,n&&(r=null,s=null)},load:()=>r?Promise.resolve(r):s||(s=(t??e)().then(d=>(r=d,d)).catch(d=>{throw s=null,d}),s),provide:a=>{r=a},getSync:()=>r}};var{setLoader:dt,load:U,provide:G,getSync:T}=A({fallbackImport:()=>import("./markdown-parsers-entry-NVFT3TE6.js")}),E=new Set,F=()=>{let o=[...E];E.clear();for(let e of o)try{e()}catch{}};var pt=()=>{let o=T();return o?Promise.resolve(o):U().then(e=>(F(),e))},ut=o=>T()?()=>{}:(E.add(o),()=>{E.delete(o)}),gt=o=>{G(o),F()},L=T;var{setLoader:$,load:V}=A({fallbackImport:()=>import("./icons-extra-UKCDOG7Q.js")}),bt=$,W=V;var X=o=>{if(!o)return;let e={},n=o;if(n.heading){let t=n.heading;e.heading=(r,s,l)=>t({type:"heading",raw:l,depth:s,text:r,tokens:[]})}if(n.code){let t=n.code;e.code=(r,s,l)=>t({type:"code",raw:"",text:r,lang:s,escaped:l})}if(n.blockquote){let t=n.blockquote;e.blockquote=r=>t({type:"blockquote",raw:"",text:r,tokens:[]})}if(n.table){let t=n.table;e.table=(r,s)=>t({type:"table",raw:"",header:[],rows:[],align:[],headerHtml:r,bodyHtml:s})}if(n.link){let t=n.link;e.link=(r,s,l)=>t({type:"link",raw:"",href:r,title:s??null,text:l,tokens:[]})}if(n.image){let t=n.image;e.image=(r,s,l)=>t({type:"image",raw:"",href:r,title:s??null,text:l})}if(n.list){let t=n.list;e.list=(r,s,l)=>t({type:"list",raw:"",ordered:s,start:l,loose:!1,items:[],itemsHtml:r})}if(n.listitem){let t=n.listitem;e.listitem=(r,s,l)=>t({type:"list_item",raw:"",task:s,checked:l,loose:!1,text:r,tokens:[]})}if(n.paragraph){let t=n.paragraph;e.paragraph=r=>t({type:"paragraph",raw:"",text:r,tokens:[]})}if(n.codespan){let t=n.codespan;e.codespan=r=>t({type:"codespan",raw:"",text:r})}if(n.strong){let t=n.strong;e.strong=r=>t({type:"strong",raw:"",text:r,tokens:[]})}if(n.em){let t=n.em;e.em=r=>t({type:"em",raw:"",text:r,tokens:[]})}if(n.del){let t=n.del;e.del=r=>t({type:"del",raw:"",text:r,tokens:[]})}if(n.html){let t=n.html;e.html=r=>t({type:"html",raw:r,text:r})}if(n.text){let t=n.text;e.text=r=>t({type:"text",raw:r,text:r})}if(n.checkbox){let t=n.checkbox;e.checkbox=r=>t({checked:r})}return n.hr&&(e.hr=n.hr),n.br&&(e.br=n.br),e},R=o=>{let e=null;return n=>{let t=L();if(!t)return P(n);if(!e){let{Marked:r}=t,s=o?.markedOptions;e=new r({gfm:s?.gfm??!0,breaks:s?.breaks??!0,pedantic:s?.pedantic,silent:s?.silent});let l=X(o?.renderer);l&&e.use({renderer:l})}return e.parse(n)}},vt=o=>o?R({markedOptions:o.options,renderer:o.renderer}):R(),kt=R();var P=o=>o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");var Y={ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","p","br","hr","div","span","ul","ol","li","dl","dt","dd","strong","em","b","i","u","s","del","ins","mark","small","sub","sup","abbr","kbd","var","samp","code","a","img","blockquote","pre","details","summary","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","input","label","select","option","textarea","button"],ALLOWED_ATTR:["href","src","alt","title","target","rel","loading","width","height","colspan","rowspan","scope","class","id","type","name","value","placeholder","disabled","checked","for","aria-label","aria-hidden","aria-expanded","role","tabindex","data-tv-form","data-message-id","data-persona-component-directive","data-preserve-animation","data-persona-instance"]},Z=/^data:image\/(?:png|jpe?g|gif|webp|bmp|x-icon|avif)/i,J=()=>{let o=null;return e=>{let n=L();if(!n)return P(e);if(!o){let{DOMPurify:t}=n;o=t(typeof window<"u"?window:void 0),o.addHook("uponSanitizeAttribute",(r,s)=>{if(s.attrName==="src"||s.attrName==="href"){let l=s.attrValue;l.toLowerCase().startsWith("data:")&&!Z.test(l)&&(s.attrValue="",s.keepAttr=!1)}})}return o.sanitize(e,Y)}},Mt=o=>o===!1?null:typeof o=="function"?o:J();import{Activity as K,ArrowDown as Q,ArrowLeft as ee,ArrowRight as te,ArrowUp as ne,ArrowUpRight as oe,AtSign as re,Bot as ie,Check as se,ChevronDown as ae,ChevronLeft as le,ChevronRight as ce,ChevronUp as de,Clipboard as pe,ClipboardCopy as ue,CodeXml as ge,Copy as me,Download as fe,Ellipsis as be,EllipsisVertical as he,ExternalLink as ye,Eye as ve,File as ke,FileCode as we,FileSpreadsheet as xe,FileText as Ce,History as Me,ImagePlus as Ae,Loader as Ee,LoaderCircle as Le,Maximize as Se,Menu as Oe,MessageSquare as Ie,Mic as Te,Minimize as Re,Minus as Pe,PanelLeft as Ne,Paperclip as De,Pencil as He,Plus as _e,Quote as Be,RefreshCw as ze,Search as Fe,Send as We,ShieldAlert as qe,ShieldCheck as je,ShieldX as Ue,Square as Ge,Star as $e,ThumbsDown as Ve,ThumbsUp as Xe,Trash as Ye,Trash2 as Ze,Upload as Je,Volume2 as Ke,X as Qe}from"lucide";var et={activity:K,"arrow-down":Q,"arrow-up":ne,"arrow-up-right":oe,bot:ie,"chevron-down":ae,"chevron-up":de,"chevron-right":ce,"chevron-left":le,check:se,clipboard:pe,"clipboard-copy":ue,"code-xml":ge,copy:me,file:ke,"file-code":we,"file-spreadsheet":xe,"file-text":Ce,"image-plus":Ae,loader:Ee,"loader-circle":Le,mic:Te,paperclip:De,quote:Be,"refresh-cw":ze,search:Fe,send:We,"shield-alert":qe,"shield-check":je,"shield-x":Ue,square:Ge,"thumbs-down":Ve,"thumbs-up":Xe,upload:Je,"volume-2":Ke,x:Qe,"at-sign":re,"arrow-left":ee,"arrow-right":te,"external-link":ye,ellipsis:be,"ellipsis-vertical":he,menu:Oe,"panel-left":Ne,plus:_e,minus:Pe,pencil:He,trash:Ye,"trash-2":Ze,download:fe,maximize:Se,minimize:Re,"message-square":Ie,star:$e,eye:ve,history:Me},tt=["user","mail","phone","calendar","clock","building","map-pin","lock","key","credit-card","hash","globe","link","circle-check","circle-x","triangle-alert","info","ban","shield","house","pen-line","save","share","funnel","settings","rotate-cw","shopping-cart","shopping-bag","package","truck","tag","gift","receipt","wallet","store","dollar-sign","percent","play","pause","volume-x","camera","image","film","headphones","message-circle","bell","heart","eye-off","bookmark","calendar-days","timer","folder","folder-open","files","chart-column","sparkles","zap","sun","moon","flag","lightbulb","monitor","smartphone"],S=new Map(Object.entries(et)),k=new Set,N=!1,O=new Set,nt=o=>{let e=[...O];o&&O.clear();for(let n of e)try{n()}catch{}},Ot=o=>N?()=>{}:(O.add(o),()=>{O.delete(o)}),ot=()=>{let o=0;for(let e of[...k]){let n=S.get(e.name);if(!n)continue;k.delete(e),o++;let t=I(n,e.size,e.color,e.strokeWidth);if(t)for(e.el.removeAttribute("data-persona-icon-pending");t.firstChild;)e.el.appendChild(t.firstChild)}return o};var D=!1,rt=()=>{W().then(o=>{if(!N){for(let[e,n]of Object.entries(o.EXTRA_LUCIDE_ICONS))S.has(e)||S.set(e,n);N=!0,ot(),nt(!0)}}).catch(o=>{D=!0,console.warn("[Persona] Failed to load the icons-extra chunk",o)})},it=(o,e,n)=>{let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("width",String(o)),t.setAttribute("height",String(o)),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.setAttribute("stroke",e),t.setAttribute("stroke-width",String(n)),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round"),t.setAttribute("aria-hidden","true"),t.setAttribute("data-persona-icon-pending","true"),t},w=(o,e=24,n="currentColor",t=2)=>{let r=S.get(o);if(r)return I(r,e,n,t);if(tt.includes(o)){D&&(D=!1);let s=it(e,n,t);if(k.size>=500){let l=k.values().next().value;l&&k.delete(l)}return k.add({el:s,name:o,size:e,color:n,strokeWidth:t}),rt(),s}return console.warn(`Lucide icon "${o}" is not in the Persona registry. Register it via registerIcons(), or add it to packages/widget/src/utils/icons.ts (see docs/icon-registry-shortlist.md).`),null};var Tt={idle:"Online",connecting:"Connecting\u2026",connected:"Streaming\u2026",error:"Offline",paused:"Connection lost\u2026",resuming:"Reconnecting\u2026"},st=1e5,q=st+1;function H(o){let{items:e,onSelect:n,anchor:t,position:r="bottom-left",portal:s,onOpenChange:l}=o,c=f("div","persona-dropdown-menu persona-hidden");c.setAttribute("role","menu"),c.setAttribute("data-persona-theme-zone","dropdown"),s?(c.style.position="fixed",c.style.zIndex=String(q)):(c.style.position="absolute",c.style.top="100%",c.style.marginTop="4px",r==="bottom-right"?c.style.right="0":c.style.left="0");for(let p of e){if(p.dividerBefore){let b=document.createElement("hr");c.appendChild(b)}let m=document.createElement("button");if(m.type="button",m.setAttribute("role","menuitem"),m.setAttribute("data-dropdown-item-id",p.id),p.destructive&&m.setAttribute("data-destructive",""),p.icon){let b=w(p.icon,16,"currentColor",1.5);b&&m.appendChild(b)}let y=document.createElement("span");y.textContent=p.label,m.appendChild(y),m.addEventListener("click",b=>{b.stopPropagation(),d(),n(p.id)}),c.appendChild(m)}let u=null;function i(){if(!s)return;let p=t.getBoundingClientRect();c.style.top=`${p.bottom+4}px`,r==="bottom-right"?(c.style.right=`${window.innerWidth-p.right}px`,c.style.left="auto"):(c.style.left=`${p.left}px`,c.style.right="auto")}function a(){let p=c.classList.contains("persona-hidden");i(),c.classList.remove("persona-hidden"),p&&l?.(!0),requestAnimationFrame(()=>{let m=y=>{!c.contains(y.target)&&!t.contains(y.target)&&d()};document.addEventListener("click",m,!0),u=()=>document.removeEventListener("click",m,!0)})}function d(){let p=!c.classList.contains("persona-hidden");c.classList.add("persona-hidden"),u?.(),u=null,p&&l?.(!1)}function g(){c.classList.contains("persona-hidden")?a():d()}function h(){d(),c.remove()}return s&&s.appendChild(c),{element:c,show:a,hide:d,toggle:g,destroy:h}}function _(o){let{icon:e,label:n,size:t,strokeWidth:r,className:s,chromeless:l,onClick:c,aria:u}=o,i=f("button",z(!l&&"persona-icon-btn",s));i.type="button",i.setAttribute("aria-label",n),i.title=n;let a=w(e,t??16,"currentColor",r??2);if(a&&i.appendChild(a),c&&i.addEventListener("click",c),u)for(let[d,g]of Object.entries(u))i.setAttribute(d,g);return i}function at(o){let{icon:e,label:n,variant:t="default",size:r="sm",iconSize:s,className:l,onClick:c,aria:u}=o,i="persona-label-btn";t!=="default"&&(i+=" persona-label-btn--"+t),i+=" persona-label-btn--"+r,l&&(i+=" "+l);let a=f("button",i);if(a.type="button",a.setAttribute("aria-label",n),e){let g=w(e,s??14,"currentColor",2);g&&a.appendChild(g)}let d=f("span");if(d.textContent=n,a.appendChild(d),c&&a.addEventListener("click",c),u)for(let[g,h]of Object.entries(u))a.setAttribute(g,h);return a}function Ft(o){let{items:e,selectedId:n,onSelect:t,className:r}=o,s=f("div","persona-toggle-group"+(r?" "+r:""));s.setAttribute("role","group");let l=n,c=[];function u(){for(let a of c)a.btn.setAttribute("aria-pressed",a.id===l?"true":"false")}for(let a of e){let d;a.icon?d=_({icon:a.icon,label:a.label,className:a.className,onClick:()=>{l=a.id,u(),t(a.id)}}):(d=f("button","persona-icon-btn"+(a.className?" "+a.className:"")),d.type="button",d.setAttribute("aria-label",a.label),d.title=a.label,d.textContent=a.label,d.addEventListener("click",()=>{l=a.id,u(),t(a.id)})),d.setAttribute("aria-pressed",a.id===l?"true":"false"),c.push({id:a.id,btn:d}),s.appendChild(d)}function i(a){l=a,u()}return{element:s,setSelected:i}}function Wt(o){let{label:e,icon:n,iconSize:t,iconOnly:r,menuItems:s,onSelect:l,onPrimary:c,position:u="bottom-left",portal:i,chevronLabel:a="More options",chevronIconSize:d,className:g,primaryClassName:h,chevronClassName:p}=o,m=f("div","persona-split-btn"+(g?" "+g:"")),y={label:e,className:"persona-split-btn-primary"+(h?" "+h:""),onClick:c},b=r&&n?_({...y,icon:n,size:t??14}):at({...y,icon:n,iconSize:t??14}),C=_({icon:"chevron-down",label:a,size:d??14,className:"persona-split-btn-chevron"+(p?" "+p:""),aria:{"aria-haspopup":"true","aria-expanded":"false"}});m.append(b,C);let v=null,x=()=>{if(v)return v;let M=(typeof i=="function"?i():i)??void 0;return v=H({items:s,onSelect:l,anchor:m,position:u,portal:M,onOpenChange:j=>{C.setAttribute("aria-expanded",j?"true":"false")}}),M||m.appendChild(v.element),v};return m.isConnected?x():requestAnimationFrame(()=>{v||x()}),C.addEventListener("click",M=>{M.stopPropagation(),x().toggle()}),{element:m,primaryButton:b,chevronButton:C,openMenu:()=>x().show(),closeMenu:()=>v?.hide(),toggleMenu:()=>x().toggle(),destroy:()=>{v?.destroy(),m.remove()}}}function qt(o){let{label:e,icon:n="chevron-down",menuItems:t,onSelect:r,position:s="bottom-left",portal:l,className:c,hover:u}=o,i=f("div","persona-combo-btn"+(c?" "+c:""));i.style.position="relative",i.style.display="inline-flex",i.style.alignItems="center",i.style.cursor="pointer",i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-haspopup","true"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label",e);let a=f("span","persona-combo-btn-label");a.textContent=e,i.appendChild(a);let d=w(n,14,"currentColor",2);d&&(d.style.marginLeft="4px",d.style.opacity="0.6",i.appendChild(d)),u&&(i.style.borderRadius=u.borderRadius??"10px",i.style.padding=u.padding??"6px 4px 6px 12px",i.style.border="1px solid transparent",i.style.transition="background-color 0.15s ease, border-color 0.15s ease",i.addEventListener("mouseenter",()=>{i.style.backgroundColor=u.background??"",i.style.borderColor=u.border??""}),i.addEventListener("mouseleave",()=>{i.style.backgroundColor="",i.style.borderColor="transparent"}));let g=H({items:t,onSelect:p=>{i.setAttribute("aria-expanded","false"),r(p)},anchor:i,position:s,portal:l});l||i.appendChild(g.element);let h=()=>i.getAttribute("data-persona-menu-locked")==="true";return i.addEventListener("click",p=>{if(p.stopPropagation(),h())return;let m=!g.element.classList.contains("persona-hidden");i.setAttribute("aria-expanded",m?"false":"true"),g.toggle()}),i.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i.click())}),{element:i,setLabel:p=>{a.textContent=p,i.setAttribute("aria-label",p)},open:()=>{i.setAttribute("aria-expanded","true"),g.show()},close:()=>{i.setAttribute("aria-expanded","false"),g.hide()},toggle:()=>{let p=!g.element.classList.contains("persona-hidden");i.setAttribute("aria-expanded",p?"false":"true"),g.toggle()},destroy:()=>{g.destroy(),i.remove()}}}var B=class{constructor(){this.components=new Map;this.options=new Map}register(e,n,t){this.components.has(e)&&console.warn(`[ComponentRegistry] Component "${e}" is already registered. Overwriting.`),this.components.set(e,n),t?this.options.set(e,t):this.options.delete(e)}unregister(e){this.components.delete(e),this.options.delete(e)}get(e){return this.components.get(e)}has(e){return this.components.has(e)}getOptions(e){return this.options.get(e)}getAllNames(){return Array.from(this.components.keys())}clear(){this.components.clear(),this.options.clear()}registerAll(e){Object.entries(e).forEach(([n,t])=>{this.register(n,t)})}},Ut=new B;var Vt=(o,e,n)=>{let t=n;for(let r of e){let s=f("span","persona-tool-char");s.style.setProperty("--char-index",String(t)),s.textContent=r===" "?"\xA0":r,o.appendChild(s),t++}return t};export{A as a,pt as b,ut as c,gt as d,L as e,vt as f,P as g,Mt as h,bt as i,W as j,Ot as k,w as l,Tt as m,st as n,q as o,H as p,_ as q,at as r,Ft as s,Wt as t,qt as u,Vt as v,Ut as w};
|
|
1
|
+
import{a as I}from"./chunk-7NQ4ZTHF.js";import{a as f,d as z}from"./chunk-76IELU7F.js";var A=o=>{let{fallbackImport:e,resetOnSetLoader:n=!1}=o,t=null,r=null,s=null;return{setLoader:a=>{t=a,n&&(r=null,s=null)},load:()=>r?Promise.resolve(r):s||(s=(t??e)().then(d=>(r=d,d)).catch(d=>{throw s=null,d}),s),provide:a=>{r=a},getSync:()=>r}};var{setLoader:U,load:G}=A({fallbackImport:()=>import("./icons-extra-UKCDOG7Q.js")}),dt=U,F=G;var{setLoader:gt,load:$,provide:V,getSync:T}=A({fallbackImport:()=>import("./markdown-parsers-entry-NVFT3TE6.js")}),E=new Set,W=()=>{let o=[...E];E.clear();for(let e of o)try{e()}catch{}};var mt=()=>{let o=T();return o?Promise.resolve(o):$().then(e=>(W(),e))},ft=o=>T()?()=>{}:(E.add(o),()=>{E.delete(o)}),bt=o=>{V(o),W()},L=T;var X=o=>{if(!o)return;let e={},n=o;if(n.heading){let t=n.heading;e.heading=(r,s,l)=>t({type:"heading",raw:l,depth:s,text:r,tokens:[]})}if(n.code){let t=n.code;e.code=(r,s,l)=>t({type:"code",raw:"",text:r,lang:s,escaped:l})}if(n.blockquote){let t=n.blockquote;e.blockquote=r=>t({type:"blockquote",raw:"",text:r,tokens:[]})}if(n.table){let t=n.table;e.table=(r,s)=>t({type:"table",raw:"",header:[],rows:[],align:[],headerHtml:r,bodyHtml:s})}if(n.link){let t=n.link;e.link=(r,s,l)=>t({type:"link",raw:"",href:r,title:s??null,text:l,tokens:[]})}if(n.image){let t=n.image;e.image=(r,s,l)=>t({type:"image",raw:"",href:r,title:s??null,text:l})}if(n.list){let t=n.list;e.list=(r,s,l)=>t({type:"list",raw:"",ordered:s,start:l,loose:!1,items:[],itemsHtml:r})}if(n.listitem){let t=n.listitem;e.listitem=(r,s,l)=>t({type:"list_item",raw:"",task:s,checked:l,loose:!1,text:r,tokens:[]})}if(n.paragraph){let t=n.paragraph;e.paragraph=r=>t({type:"paragraph",raw:"",text:r,tokens:[]})}if(n.codespan){let t=n.codespan;e.codespan=r=>t({type:"codespan",raw:"",text:r})}if(n.strong){let t=n.strong;e.strong=r=>t({type:"strong",raw:"",text:r,tokens:[]})}if(n.em){let t=n.em;e.em=r=>t({type:"em",raw:"",text:r,tokens:[]})}if(n.del){let t=n.del;e.del=r=>t({type:"del",raw:"",text:r,tokens:[]})}if(n.html){let t=n.html;e.html=r=>t({type:"html",raw:r,text:r})}if(n.text){let t=n.text;e.text=r=>t({type:"text",raw:r,text:r})}if(n.checkbox){let t=n.checkbox;e.checkbox=r=>t({checked:r})}return n.hr&&(e.hr=n.hr),n.br&&(e.br=n.br),e},R=o=>{let e=null;return n=>{let t=L();if(!t)return P(n);if(!e){let{Marked:r}=t,s=o?.markedOptions;e=new r({gfm:s?.gfm??!0,breaks:s?.breaks??!0,pedantic:s?.pedantic,silent:s?.silent});let l=X(o?.renderer);l&&e.use({renderer:l})}return e.parse(n)}},vt=o=>o?R({markedOptions:o.options,renderer:o.renderer}):R(),kt=R();var P=o=>o.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");var Y={ALLOWED_TAGS:["h1","h2","h3","h4","h5","h6","p","br","hr","div","span","ul","ol","li","dl","dt","dd","strong","em","b","i","u","s","del","ins","mark","small","sub","sup","abbr","kbd","var","samp","code","a","img","blockquote","pre","details","summary","table","thead","tbody","tfoot","tr","th","td","caption","colgroup","col","input","label","select","option","textarea","button"],ALLOWED_ATTR:["href","src","alt","title","target","rel","loading","width","height","colspan","rowspan","scope","class","id","type","name","value","placeholder","disabled","checked","for","aria-label","aria-hidden","aria-expanded","role","tabindex","data-tv-form","data-message-id","data-persona-component-directive","data-preserve-animation","data-persona-instance"]},Z=/^data:image\/(?:png|jpe?g|gif|webp|bmp|x-icon|avif)/i,J=()=>{let o=null;return e=>{let n=L();if(!n)return P(e);if(!o){let{DOMPurify:t}=n;o=t(typeof window<"u"?window:void 0),o.addHook("uponSanitizeAttribute",(r,s)=>{if(s.attrName==="src"||s.attrName==="href"){let l=s.attrValue;l.toLowerCase().startsWith("data:")&&!Z.test(l)&&(s.attrValue="",s.keepAttr=!1)}})}return o.sanitize(e,Y)}},Mt=o=>o===!1?null:typeof o=="function"?o:J();import{Activity as K,ArrowDown as Q,ArrowLeft as ee,ArrowRight as te,ArrowUp as ne,ArrowUpRight as oe,AtSign as re,Bot as ie,Check as se,ChevronDown as ae,ChevronLeft as le,ChevronRight as ce,ChevronUp as de,Clipboard as pe,ClipboardCopy as ue,CodeXml as ge,Copy as me,Download as fe,Ellipsis as be,EllipsisVertical as he,ExternalLink as ye,Eye as ve,File as ke,FileCode as we,FileSpreadsheet as xe,FileText as Ce,History as Me,ImagePlus as Ae,Loader as Ee,LoaderCircle as Le,Maximize as Se,Menu as Oe,MessageSquare as Ie,Mic as Te,Minimize as Re,Minus as Pe,PanelLeft as Ne,Paperclip as De,Pencil as He,Plus as _e,Quote as Be,RefreshCw as ze,Search as Fe,Send as We,ShieldAlert as qe,ShieldCheck as je,ShieldX as Ue,Square as Ge,Star as $e,ThumbsDown as Ve,ThumbsUp as Xe,Trash as Ye,Trash2 as Ze,Upload as Je,Volume2 as Ke,X as Qe}from"lucide";var et={activity:K,"arrow-down":Q,"arrow-up":ne,"arrow-up-right":oe,bot:ie,"chevron-down":ae,"chevron-up":de,"chevron-right":ce,"chevron-left":le,check:se,clipboard:pe,"clipboard-copy":ue,"code-xml":ge,copy:me,file:ke,"file-code":we,"file-spreadsheet":xe,"file-text":Ce,"image-plus":Ae,loader:Ee,"loader-circle":Le,mic:Te,paperclip:De,quote:Be,"refresh-cw":ze,search:Fe,send:We,"shield-alert":qe,"shield-check":je,"shield-x":Ue,square:Ge,"thumbs-down":Ve,"thumbs-up":Xe,upload:Je,"volume-2":Ke,x:Qe,"at-sign":re,"arrow-left":ee,"arrow-right":te,"external-link":ye,ellipsis:be,"ellipsis-vertical":he,menu:Oe,"panel-left":Ne,plus:_e,minus:Pe,pencil:He,trash:Ye,"trash-2":Ze,download:fe,maximize:Se,minimize:Re,"message-square":Ie,star:$e,eye:ve,history:Me},tt=["user","mail","phone","calendar","clock","building","map-pin","lock","key","credit-card","hash","globe","link","circle-check","circle-x","triangle-alert","info","ban","shield","house","pen-line","save","share","funnel","settings","rotate-cw","shopping-cart","shopping-bag","package","truck","tag","gift","receipt","wallet","store","dollar-sign","percent","play","pause","volume-x","camera","image","film","headphones","message-circle","bell","heart","eye-off","bookmark","calendar-days","timer","folder","folder-open","files","chart-column","sparkles","zap","sun","moon","flag","lightbulb","monitor","smartphone"],S=new Map(Object.entries(et)),k=new Set,N=!1,O=new Set,nt=o=>{let e=[...O];o&&O.clear();for(let n of e)try{n()}catch{}},Ot=o=>N?()=>{}:(O.add(o),()=>{O.delete(o)}),ot=()=>{let o=0;for(let e of[...k]){let n=S.get(e.name);if(!n)continue;k.delete(e),o++;let t=I(n,e.size,e.color,e.strokeWidth);if(t)for(e.el.removeAttribute("data-persona-icon-pending");t.firstChild;)e.el.appendChild(t.firstChild)}return o};var D=!1,rt=()=>{F().then(o=>{if(!N){for(let[e,n]of Object.entries(o.EXTRA_LUCIDE_ICONS))S.has(e)||S.set(e,n);N=!0,ot(),nt(!0)}}).catch(o=>{D=!0,console.warn("[Persona] Failed to load the icons-extra chunk",o)})},it=(o,e,n)=>{let t=document.createElementNS("http://www.w3.org/2000/svg","svg");return t.setAttribute("width",String(o)),t.setAttribute("height",String(o)),t.setAttribute("viewBox","0 0 24 24"),t.setAttribute("fill","none"),t.setAttribute("stroke",e),t.setAttribute("stroke-width",String(n)),t.setAttribute("stroke-linecap","round"),t.setAttribute("stroke-linejoin","round"),t.setAttribute("aria-hidden","true"),t.setAttribute("data-persona-icon-pending","true"),t},w=(o,e=24,n="currentColor",t=2)=>{let r=S.get(o);if(r)return I(r,e,n,t);if(tt.includes(o)){D&&(D=!1);let s=it(e,n,t);if(k.size>=500){let l=k.values().next().value;l&&k.delete(l)}return k.add({el:s,name:o,size:e,color:n,strokeWidth:t}),rt(),s}return console.warn(`Lucide icon "${o}" is not in the Persona registry. Register it via registerIcons(), or add it to packages/widget/src/utils/icons.ts (see docs/icon-registry-shortlist.md).`),null};var Tt={idle:"Online",connecting:"Connecting\u2026",connected:"Streaming\u2026",error:"Offline",paused:"Connection lost\u2026",resuming:"Reconnecting\u2026"},st=1e5,q=st+1;function H(o){let{items:e,onSelect:n,anchor:t,position:r="bottom-left",portal:s,onOpenChange:l}=o,c=f("div","persona-dropdown-menu persona-hidden");c.setAttribute("role","menu"),c.setAttribute("data-persona-theme-zone","dropdown"),s?(c.style.position="fixed",c.style.zIndex=String(q)):(c.style.position="absolute",c.style.top="100%",c.style.marginTop="4px",r==="bottom-right"?c.style.right="0":c.style.left="0");for(let p of e){if(p.dividerBefore){let b=document.createElement("hr");c.appendChild(b)}let m=document.createElement("button");if(m.type="button",m.setAttribute("role","menuitem"),m.setAttribute("data-dropdown-item-id",p.id),p.destructive&&m.setAttribute("data-destructive",""),p.icon){let b=w(p.icon,16,"currentColor",1.5);b&&m.appendChild(b)}let y=document.createElement("span");y.textContent=p.label,m.appendChild(y),m.addEventListener("click",b=>{b.stopPropagation(),d(),n(p.id)}),c.appendChild(m)}let u=null;function i(){if(!s)return;let p=t.getBoundingClientRect();c.style.top=`${p.bottom+4}px`,r==="bottom-right"?(c.style.right=`${window.innerWidth-p.right}px`,c.style.left="auto"):(c.style.left=`${p.left}px`,c.style.right="auto")}function a(){let p=c.classList.contains("persona-hidden");i(),c.classList.remove("persona-hidden"),p&&l?.(!0),requestAnimationFrame(()=>{let m=y=>{!c.contains(y.target)&&!t.contains(y.target)&&d()};document.addEventListener("click",m,!0),u=()=>document.removeEventListener("click",m,!0)})}function d(){let p=!c.classList.contains("persona-hidden");c.classList.add("persona-hidden"),u?.(),u=null,p&&l?.(!1)}function g(){c.classList.contains("persona-hidden")?a():d()}function h(){d(),c.remove()}return s&&s.appendChild(c),{element:c,show:a,hide:d,toggle:g,destroy:h}}function _(o){let{icon:e,label:n,size:t,strokeWidth:r,className:s,chromeless:l,onClick:c,aria:u}=o,i=f("button",z(!l&&"persona-icon-btn",s));i.type="button",i.setAttribute("aria-label",n),i.title=n;let a=w(e,t??16,"currentColor",r??2);if(a&&i.appendChild(a),c&&i.addEventListener("click",c),u)for(let[d,g]of Object.entries(u))i.setAttribute(d,g);return i}function at(o){let{icon:e,label:n,variant:t="default",size:r="sm",iconSize:s,className:l,onClick:c,aria:u}=o,i="persona-label-btn";t!=="default"&&(i+=" persona-label-btn--"+t),i+=" persona-label-btn--"+r,l&&(i+=" "+l);let a=f("button",i);if(a.type="button",a.setAttribute("aria-label",n),e){let g=w(e,s??14,"currentColor",2);g&&a.appendChild(g)}let d=f("span");if(d.textContent=n,a.appendChild(d),c&&a.addEventListener("click",c),u)for(let[g,h]of Object.entries(u))a.setAttribute(g,h);return a}function Ft(o){let{items:e,selectedId:n,onSelect:t,className:r}=o,s=f("div","persona-toggle-group"+(r?" "+r:""));s.setAttribute("role","group");let l=n,c=[];function u(){for(let a of c)a.btn.setAttribute("aria-pressed",a.id===l?"true":"false")}for(let a of e){let d;a.icon?d=_({icon:a.icon,label:a.label,className:a.className,onClick:()=>{l=a.id,u(),t(a.id)}}):(d=f("button","persona-icon-btn"+(a.className?" "+a.className:"")),d.type="button",d.setAttribute("aria-label",a.label),d.title=a.label,d.textContent=a.label,d.addEventListener("click",()=>{l=a.id,u(),t(a.id)})),d.setAttribute("aria-pressed",a.id===l?"true":"false"),c.push({id:a.id,btn:d}),s.appendChild(d)}function i(a){l=a,u()}return{element:s,setSelected:i}}function Wt(o){let{label:e,icon:n,iconSize:t,iconOnly:r,menuItems:s,onSelect:l,onPrimary:c,position:u="bottom-left",portal:i,chevronLabel:a="More options",chevronIconSize:d,className:g,primaryClassName:h,chevronClassName:p}=o,m=f("div","persona-split-btn"+(g?" "+g:"")),y={label:e,className:"persona-split-btn-primary"+(h?" "+h:""),onClick:c},b=r&&n?_({...y,icon:n,size:t??14}):at({...y,icon:n,iconSize:t??14}),C=_({icon:"chevron-down",label:a,size:d??14,className:"persona-split-btn-chevron"+(p?" "+p:""),aria:{"aria-haspopup":"true","aria-expanded":"false"}});m.append(b,C);let v=null,x=()=>{if(v)return v;let M=(typeof i=="function"?i():i)??void 0;return v=H({items:s,onSelect:l,anchor:m,position:u,portal:M,onOpenChange:j=>{C.setAttribute("aria-expanded",j?"true":"false")}}),M||m.appendChild(v.element),v};return m.isConnected?x():requestAnimationFrame(()=>{v||x()}),C.addEventListener("click",M=>{M.stopPropagation(),x().toggle()}),{element:m,primaryButton:b,chevronButton:C,openMenu:()=>x().show(),closeMenu:()=>v?.hide(),toggleMenu:()=>x().toggle(),destroy:()=>{v?.destroy(),m.remove()}}}function qt(o){let{label:e,icon:n="chevron-down",menuItems:t,onSelect:r,position:s="bottom-left",portal:l,className:c,hover:u}=o,i=f("div","persona-combo-btn"+(c?" "+c:""));i.style.position="relative",i.style.display="inline-flex",i.style.alignItems="center",i.style.cursor="pointer",i.setAttribute("role","button"),i.setAttribute("tabindex","0"),i.setAttribute("aria-haspopup","true"),i.setAttribute("aria-expanded","false"),i.setAttribute("aria-label",e);let a=f("span","persona-combo-btn-label");a.textContent=e,i.appendChild(a);let d=w(n,14,"currentColor",2);d&&(d.style.marginLeft="4px",d.style.opacity="0.6",i.appendChild(d)),u&&(i.style.borderRadius=u.borderRadius??"10px",i.style.padding=u.padding??"6px 4px 6px 12px",i.style.border="1px solid transparent",i.style.transition="background-color 0.15s ease, border-color 0.15s ease",i.addEventListener("mouseenter",()=>{i.style.backgroundColor=u.background??"",i.style.borderColor=u.border??""}),i.addEventListener("mouseleave",()=>{i.style.backgroundColor="",i.style.borderColor="transparent"}));let g=H({items:t,onSelect:p=>{i.setAttribute("aria-expanded","false"),r(p)},anchor:i,position:s,portal:l});l||i.appendChild(g.element);let h=()=>i.getAttribute("data-persona-menu-locked")==="true";return i.addEventListener("click",p=>{if(p.stopPropagation(),h())return;let m=!g.element.classList.contains("persona-hidden");i.setAttribute("aria-expanded",m?"false":"true"),g.toggle()}),i.addEventListener("keydown",p=>{(p.key==="Enter"||p.key===" ")&&(p.preventDefault(),i.click())}),{element:i,setLabel:p=>{a.textContent=p,i.setAttribute("aria-label",p)},open:()=>{i.setAttribute("aria-expanded","true"),g.show()},close:()=>{i.setAttribute("aria-expanded","false"),g.hide()},toggle:()=>{let p=!g.element.classList.contains("persona-hidden");i.setAttribute("aria-expanded",p?"false":"true"),g.toggle()},destroy:()=>{g.destroy(),i.remove()}}}var B=class{constructor(){this.components=new Map;this.options=new Map}register(e,n,t){this.components.has(e)&&console.warn(`[ComponentRegistry] Component "${e}" is already registered. Overwriting.`),this.components.set(e,n),t?this.options.set(e,t):this.options.delete(e)}unregister(e){this.components.delete(e),this.options.delete(e)}get(e){return this.components.get(e)}has(e){return this.components.has(e)}getOptions(e){return this.options.get(e)}getAllNames(){return Array.from(this.components.keys())}clear(){this.components.clear(),this.options.clear()}registerAll(e){Object.entries(e).forEach(([n,t])=>{this.register(n,t)})}},Ut=new B;var Vt=(o,e,n)=>{let t=n;for(let r of e){let s=f("span","persona-tool-char");s.style.setProperty("--char-index",String(t)),s.textContent=r===" "?"\xA0":r,o.appendChild(s),t++}return t};export{A as a,dt as b,F as c,Ot as d,w as e,mt as f,ft as g,bt as h,L as i,vt as j,P as k,Mt as l,Tt as m,st as n,q as o,H as p,_ as q,at as r,Ft as s,Wt as t,qt as u,Vt as v,Ut as w};
|