@runtypelabs/persona 3.6.0 → 3.7.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.
@@ -58,6 +58,7 @@ __export(theme_editor_exports, {
58
58
  ROLE_INTENSITIES: () => ROLE_INTENSITIES,
59
59
  ROLE_LINKS_FOCUS: () => ROLE_LINKS_FOCUS,
60
60
  ROLE_PRIMARY_ACTIONS: () => ROLE_PRIMARY_ACTIONS,
61
+ ROLE_SCROLL_TO_BOTTOM: () => ROLE_SCROLL_TO_BOTTOM,
61
62
  ROLE_SURFACES: () => ROLE_SURFACES,
62
63
  ROLE_USER_MESSAGES: () => ROLE_USER_MESSAGES,
63
64
  SEMANTIC_COLORS_SECTION: () => SEMANTIC_COLORS_SECTION,
@@ -466,6 +467,18 @@ var DEFAULT_COMPONENTS = {
466
467
  border: "palette.colors.gray.200"
467
468
  }
468
469
  },
470
+ scrollToBottom: {
471
+ background: "components.button.primary.background",
472
+ foreground: "components.button.primary.foreground",
473
+ border: "semantic.colors.primary",
474
+ size: "40px",
475
+ borderRadius: "palette.radius.full",
476
+ shadow: "palette.shadows.sm",
477
+ padding: "0.5rem 0.875rem",
478
+ gap: "0.5rem",
479
+ fontSize: "0.875rem",
480
+ iconSize: "14px"
481
+ },
469
482
  artifact: {
470
483
  pane: {
471
484
  background: "semantic.colors.container",
@@ -647,7 +660,7 @@ function createTheme(userConfig, options = {}) {
647
660
  return theme;
648
661
  }
649
662
  function themeToCssVariables(theme) {
650
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za;
663
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa;
651
664
  const resolved = resolveTokens(theme);
652
665
  const cssVars = {};
653
666
  for (const [path, token] of Object.entries(resolved)) {
@@ -687,44 +700,55 @@ function themeToCssVariables(theme) {
687
700
  cssVars["--persona-radius-md"] = (_B = cssVars["--persona-palette-radius-md"]) != null ? _B : "0.375rem";
688
701
  cssVars["--persona-radius-lg"] = (_C = cssVars["--persona-palette-radius-lg"]) != null ? _C : "0.5rem";
689
702
  cssVars["--persona-radius-xl"] = (_D = cssVars["--persona-palette-radius-xl"]) != null ? _D : "0.75rem";
690
- cssVars["--persona-launcher-radius"] = (_F = (_E = cssVars["--persona-components-launcher-borderRadius"]) != null ? _E : cssVars["--persona-palette-radius-full"]) != null ? _F : "9999px";
691
- cssVars["--persona-launcher-bg"] = (_G = cssVars["--persona-components-launcher-background"]) != null ? _G : cssVars["--persona-primary"];
692
- cssVars["--persona-launcher-fg"] = (_H = cssVars["--persona-components-launcher-foreground"]) != null ? _H : cssVars["--persona-text-inverse"];
693
- cssVars["--persona-launcher-border"] = (_I = cssVars["--persona-components-launcher-border"]) != null ? _I : cssVars["--persona-border"];
694
- cssVars["--persona-button-primary-bg"] = (_J = cssVars["--persona-components-button-primary-background"]) != null ? _J : cssVars["--persona-primary"];
695
- cssVars["--persona-button-primary-fg"] = (_K = cssVars["--persona-components-button-primary-foreground"]) != null ? _K : cssVars["--persona-text-inverse"];
696
- cssVars["--persona-button-radius"] = (_M = (_L = cssVars["--persona-components-button-primary-borderRadius"]) != null ? _L : cssVars["--persona-palette-radius-full"]) != null ? _M : "9999px";
697
- cssVars["--persona-panel-radius"] = (_O = (_N = cssVars["--persona-components-panel-borderRadius"]) != null ? _N : cssVars["--persona-radius-xl"]) != null ? _O : "0.75rem";
698
- cssVars["--persona-panel-border"] = (_P = cssVars["--persona-components-panel-border"]) != null ? _P : `1px solid ${cssVars["--persona-border"]}`;
699
- cssVars["--persona-panel-shadow"] = (_R = (_Q = cssVars["--persona-components-panel-shadow"]) != null ? _Q : cssVars["--persona-palette-shadows-xl"]) != null ? _R : "0 25px 50px -12px rgba(0, 0, 0, 0.25)";
700
- cssVars["--persona-input-radius"] = (_T = (_S = cssVars["--persona-components-input-borderRadius"]) != null ? _S : cssVars["--persona-radius-lg"]) != null ? _T : "0.5rem";
701
- cssVars["--persona-message-user-radius"] = (_V = (_U = cssVars["--persona-components-message-user-borderRadius"]) != null ? _U : cssVars["--persona-radius-lg"]) != null ? _V : "0.5rem";
702
- cssVars["--persona-message-assistant-radius"] = (_X = (_W = cssVars["--persona-components-message-assistant-borderRadius"]) != null ? _W : cssVars["--persona-radius-lg"]) != null ? _X : "0.5rem";
703
- cssVars["--persona-header-bg"] = (_Y = cssVars["--persona-components-header-background"]) != null ? _Y : cssVars["--persona-surface"];
704
- cssVars["--persona-header-border"] = (_Z = cssVars["--persona-components-header-border"]) != null ? _Z : cssVars["--persona-divider"];
705
- cssVars["--persona-header-icon-bg"] = (__ = cssVars["--persona-components-header-iconBackground"]) != null ? __ : cssVars["--persona-primary"];
706
- cssVars["--persona-header-icon-fg"] = (_$ = cssVars["--persona-components-header-iconForeground"]) != null ? _$ : cssVars["--persona-text-inverse"];
707
- cssVars["--persona-header-title-fg"] = (_aa = cssVars["--persona-components-header-titleForeground"]) != null ? _aa : cssVars["--persona-primary"];
708
- cssVars["--persona-header-subtitle-fg"] = (_ba = cssVars["--persona-components-header-subtitleForeground"]) != null ? _ba : cssVars["--persona-text-muted"];
709
- cssVars["--persona-header-action-icon-fg"] = (_ca = cssVars["--persona-components-header-actionIconForeground"]) != null ? _ca : cssVars["--persona-muted"];
710
- const headerTokens = (_da = theme.components) == null ? void 0 : _da.header;
703
+ cssVars["--persona-radius-full"] = (_E = cssVars["--persona-palette-radius-full"]) != null ? _E : "9999px";
704
+ cssVars["--persona-launcher-radius"] = (_G = (_F = cssVars["--persona-components-launcher-borderRadius"]) != null ? _F : cssVars["--persona-palette-radius-full"]) != null ? _G : "9999px";
705
+ cssVars["--persona-launcher-bg"] = (_H = cssVars["--persona-components-launcher-background"]) != null ? _H : cssVars["--persona-primary"];
706
+ cssVars["--persona-launcher-fg"] = (_I = cssVars["--persona-components-launcher-foreground"]) != null ? _I : cssVars["--persona-text-inverse"];
707
+ cssVars["--persona-launcher-border"] = (_J = cssVars["--persona-components-launcher-border"]) != null ? _J : cssVars["--persona-border"];
708
+ cssVars["--persona-button-primary-bg"] = (_K = cssVars["--persona-components-button-primary-background"]) != null ? _K : cssVars["--persona-primary"];
709
+ cssVars["--persona-button-primary-fg"] = (_L = cssVars["--persona-components-button-primary-foreground"]) != null ? _L : cssVars["--persona-text-inverse"];
710
+ cssVars["--persona-button-radius"] = (_N = (_M = cssVars["--persona-components-button-primary-borderRadius"]) != null ? _M : cssVars["--persona-palette-radius-full"]) != null ? _N : "9999px";
711
+ cssVars["--persona-panel-radius"] = (_P = (_O = cssVars["--persona-components-panel-borderRadius"]) != null ? _O : cssVars["--persona-radius-xl"]) != null ? _P : "0.75rem";
712
+ cssVars["--persona-panel-border"] = (_Q = cssVars["--persona-components-panel-border"]) != null ? _Q : `1px solid ${cssVars["--persona-border"]}`;
713
+ cssVars["--persona-panel-shadow"] = (_S = (_R = cssVars["--persona-components-panel-shadow"]) != null ? _R : cssVars["--persona-palette-shadows-xl"]) != null ? _S : "0 25px 50px -12px rgba(0, 0, 0, 0.25)";
714
+ cssVars["--persona-input-radius"] = (_U = (_T = cssVars["--persona-components-input-borderRadius"]) != null ? _T : cssVars["--persona-radius-lg"]) != null ? _U : "0.5rem";
715
+ cssVars["--persona-message-user-radius"] = (_W = (_V = cssVars["--persona-components-message-user-borderRadius"]) != null ? _V : cssVars["--persona-radius-lg"]) != null ? _W : "0.5rem";
716
+ cssVars["--persona-message-assistant-radius"] = (_Y = (_X = cssVars["--persona-components-message-assistant-borderRadius"]) != null ? _X : cssVars["--persona-radius-lg"]) != null ? _Y : "0.5rem";
717
+ cssVars["--persona-header-bg"] = (_Z = cssVars["--persona-components-header-background"]) != null ? _Z : cssVars["--persona-surface"];
718
+ cssVars["--persona-header-border"] = (__ = cssVars["--persona-components-header-border"]) != null ? __ : cssVars["--persona-divider"];
719
+ cssVars["--persona-header-icon-bg"] = (_$ = cssVars["--persona-components-header-iconBackground"]) != null ? _$ : cssVars["--persona-primary"];
720
+ cssVars["--persona-header-icon-fg"] = (_aa = cssVars["--persona-components-header-iconForeground"]) != null ? _aa : cssVars["--persona-text-inverse"];
721
+ cssVars["--persona-header-title-fg"] = (_ba = cssVars["--persona-components-header-titleForeground"]) != null ? _ba : cssVars["--persona-primary"];
722
+ cssVars["--persona-header-subtitle-fg"] = (_ca = cssVars["--persona-components-header-subtitleForeground"]) != null ? _ca : cssVars["--persona-text-muted"];
723
+ cssVars["--persona-header-action-icon-fg"] = (_da = cssVars["--persona-components-header-actionIconForeground"]) != null ? _da : cssVars["--persona-muted"];
724
+ const headerTokens = (_ea = theme.components) == null ? void 0 : _ea.header;
711
725
  if (headerTokens == null ? void 0 : headerTokens.shadow) cssVars["--persona-header-shadow"] = headerTokens.shadow;
712
726
  if (headerTokens == null ? void 0 : headerTokens.borderBottom) cssVars["--persona-header-border-bottom"] = headerTokens.borderBottom;
713
- cssVars["--persona-input-background"] = (_ea = cssVars["--persona-components-input-background"]) != null ? _ea : cssVars["--persona-surface"];
714
- cssVars["--persona-input-placeholder"] = (_fa = cssVars["--persona-components-input-placeholder"]) != null ? _fa : cssVars["--persona-text-muted"];
715
- cssVars["--persona-message-user-bg"] = (_ga = cssVars["--persona-components-message-user-background"]) != null ? _ga : cssVars["--persona-accent"];
716
- cssVars["--persona-message-user-text"] = (_ha = cssVars["--persona-components-message-user-text"]) != null ? _ha : cssVars["--persona-text-inverse"];
717
- cssVars["--persona-message-user-shadow"] = (_ia = cssVars["--persona-components-message-user-shadow"]) != null ? _ia : "0 5px 15px rgba(15, 23, 42, 0.08)";
718
- cssVars["--persona-message-assistant-bg"] = (_ja = cssVars["--persona-components-message-assistant-background"]) != null ? _ja : cssVars["--persona-surface"];
719
- cssVars["--persona-message-assistant-text"] = (_ka = cssVars["--persona-components-message-assistant-text"]) != null ? _ka : cssVars["--persona-text"];
720
- cssVars["--persona-message-assistant-border"] = (_la = cssVars["--persona-components-message-assistant-border"]) != null ? _la : cssVars["--persona-border"];
721
- cssVars["--persona-message-assistant-shadow"] = (_ma = cssVars["--persona-components-message-assistant-shadow"]) != null ? _ma : "0 1px 2px 0 rgb(0 0 0 / 0.05)";
722
- cssVars["--persona-tool-bubble-shadow"] = (_na = cssVars["--persona-components-toolBubble-shadow"]) != null ? _na : "0 5px 15px rgba(15, 23, 42, 0.08)";
723
- cssVars["--persona-reasoning-bubble-shadow"] = (_oa = cssVars["--persona-components-reasoningBubble-shadow"]) != null ? _oa : "0 5px 15px rgba(15, 23, 42, 0.08)";
724
- cssVars["--persona-composer-shadow"] = (_pa = cssVars["--persona-components-composer-shadow"]) != null ? _pa : "none";
725
- cssVars["--persona-md-inline-code-bg"] = (_qa = cssVars["--persona-components-markdown-inlineCode-background"]) != null ? _qa : cssVars["--persona-container"];
726
- cssVars["--persona-md-inline-code-color"] = (_ra = cssVars["--persona-components-markdown-inlineCode-foreground"]) != null ? _ra : cssVars["--persona-text"];
727
- cssVars["--persona-md-link-color"] = (_ta = (_sa = cssVars["--persona-components-markdown-link-foreground"]) != null ? _sa : cssVars["--persona-accent"]) != null ? _ta : "#0f0f0f";
727
+ cssVars["--persona-input-background"] = (_fa = cssVars["--persona-components-input-background"]) != null ? _fa : cssVars["--persona-surface"];
728
+ cssVars["--persona-input-placeholder"] = (_ga = cssVars["--persona-components-input-placeholder"]) != null ? _ga : cssVars["--persona-text-muted"];
729
+ cssVars["--persona-message-user-bg"] = (_ha = cssVars["--persona-components-message-user-background"]) != null ? _ha : cssVars["--persona-accent"];
730
+ cssVars["--persona-message-user-text"] = (_ia = cssVars["--persona-components-message-user-text"]) != null ? _ia : cssVars["--persona-text-inverse"];
731
+ cssVars["--persona-message-user-shadow"] = (_ja = cssVars["--persona-components-message-user-shadow"]) != null ? _ja : "0 5px 15px rgba(15, 23, 42, 0.08)";
732
+ cssVars["--persona-message-assistant-bg"] = (_ka = cssVars["--persona-components-message-assistant-background"]) != null ? _ka : cssVars["--persona-surface"];
733
+ cssVars["--persona-message-assistant-text"] = (_la = cssVars["--persona-components-message-assistant-text"]) != null ? _la : cssVars["--persona-text"];
734
+ cssVars["--persona-message-assistant-border"] = (_ma = cssVars["--persona-components-message-assistant-border"]) != null ? _ma : cssVars["--persona-border"];
735
+ cssVars["--persona-message-assistant-shadow"] = (_na = cssVars["--persona-components-message-assistant-shadow"]) != null ? _na : "0 1px 2px 0 rgb(0 0 0 / 0.05)";
736
+ cssVars["--persona-scroll-to-bottom-bg"] = (_pa = (_oa = cssVars["--persona-components-scrollToBottom-background"]) != null ? _oa : cssVars["--persona-button-primary-bg"]) != null ? _pa : cssVars["--persona-accent"];
737
+ cssVars["--persona-scroll-to-bottom-fg"] = (_ra = (_qa = cssVars["--persona-components-scrollToBottom-foreground"]) != null ? _qa : cssVars["--persona-button-primary-fg"]) != null ? _ra : cssVars["--persona-text-inverse"];
738
+ cssVars["--persona-scroll-to-bottom-border"] = (_sa = cssVars["--persona-components-scrollToBottom-border"]) != null ? _sa : cssVars["--persona-primary"];
739
+ cssVars["--persona-scroll-to-bottom-size"] = (_ta = cssVars["--persona-components-scrollToBottom-size"]) != null ? _ta : "40px";
740
+ cssVars["--persona-scroll-to-bottom-radius"] = (_wa = (_va = (_ua = cssVars["--persona-components-scrollToBottom-borderRadius"]) != null ? _ua : cssVars["--persona-button-radius"]) != null ? _va : cssVars["--persona-radius-full"]) != null ? _wa : "9999px";
741
+ cssVars["--persona-scroll-to-bottom-shadow"] = (_ya = (_xa = cssVars["--persona-components-scrollToBottom-shadow"]) != null ? _xa : cssVars["--persona-palette-shadows-sm"]) != null ? _ya : "0 1px 2px 0 rgb(0 0 0 / 0.05)";
742
+ cssVars["--persona-scroll-to-bottom-padding"] = (_za = cssVars["--persona-components-scrollToBottom-padding"]) != null ? _za : "0.5rem 0.875rem";
743
+ cssVars["--persona-scroll-to-bottom-gap"] = (_Aa = cssVars["--persona-components-scrollToBottom-gap"]) != null ? _Aa : "0.5rem";
744
+ cssVars["--persona-scroll-to-bottom-font-size"] = (_Ca = (_Ba = cssVars["--persona-components-scrollToBottom-fontSize"]) != null ? _Ba : cssVars["--persona-palette-typography-fontSize-sm"]) != null ? _Ca : "0.875rem";
745
+ cssVars["--persona-scroll-to-bottom-icon-size"] = (_Da = cssVars["--persona-components-scrollToBottom-iconSize"]) != null ? _Da : "14px";
746
+ cssVars["--persona-tool-bubble-shadow"] = (_Ea = cssVars["--persona-components-toolBubble-shadow"]) != null ? _Ea : "0 5px 15px rgba(15, 23, 42, 0.08)";
747
+ cssVars["--persona-reasoning-bubble-shadow"] = (_Fa = cssVars["--persona-components-reasoningBubble-shadow"]) != null ? _Fa : "0 5px 15px rgba(15, 23, 42, 0.08)";
748
+ cssVars["--persona-composer-shadow"] = (_Ga = cssVars["--persona-components-composer-shadow"]) != null ? _Ga : "none";
749
+ cssVars["--persona-md-inline-code-bg"] = (_Ha = cssVars["--persona-components-markdown-inlineCode-background"]) != null ? _Ha : cssVars["--persona-container"];
750
+ cssVars["--persona-md-inline-code-color"] = (_Ia = cssVars["--persona-components-markdown-inlineCode-foreground"]) != null ? _Ia : cssVars["--persona-text"];
751
+ cssVars["--persona-md-link-color"] = (_Ka = (_Ja = cssVars["--persona-components-markdown-link-foreground"]) != null ? _Ja : cssVars["--persona-accent"]) != null ? _Ka : "#0f0f0f";
728
752
  const mdH1Size = cssVars["--persona-components-markdown-heading-h1-fontSize"];
729
753
  if (mdH1Size) cssVars["--persona-md-h1-size"] = mdH1Size;
730
754
  const mdH1Weight = cssVars["--persona-components-markdown-heading-h1-fontWeight"];
@@ -783,23 +807,23 @@ function themeToCssVariables(theme) {
783
807
  if (t.copyPadding) cssVars["--persona-artifact-toolbar-copy-padding"] = t.copyPadding;
784
808
  if (t.copyMenuBackground) {
785
809
  cssVars["--persona-artifact-toolbar-copy-menu-bg"] = t.copyMenuBackground;
786
- cssVars["--persona-dropdown-bg"] = (_ua = cssVars["--persona-dropdown-bg"]) != null ? _ua : t.copyMenuBackground;
810
+ cssVars["--persona-dropdown-bg"] = (_La = cssVars["--persona-dropdown-bg"]) != null ? _La : t.copyMenuBackground;
787
811
  }
788
812
  if (t.copyMenuBorder) {
789
813
  cssVars["--persona-artifact-toolbar-copy-menu-border"] = t.copyMenuBorder;
790
- cssVars["--persona-dropdown-border"] = (_va = cssVars["--persona-dropdown-border"]) != null ? _va : t.copyMenuBorder;
814
+ cssVars["--persona-dropdown-border"] = (_Ma = cssVars["--persona-dropdown-border"]) != null ? _Ma : t.copyMenuBorder;
791
815
  }
792
816
  if (t.copyMenuShadow) {
793
817
  cssVars["--persona-artifact-toolbar-copy-menu-shadow"] = t.copyMenuShadow;
794
- cssVars["--persona-dropdown-shadow"] = (_wa = cssVars["--persona-dropdown-shadow"]) != null ? _wa : t.copyMenuShadow;
818
+ cssVars["--persona-dropdown-shadow"] = (_Na = cssVars["--persona-dropdown-shadow"]) != null ? _Na : t.copyMenuShadow;
795
819
  }
796
820
  if (t.copyMenuBorderRadius) {
797
821
  cssVars["--persona-artifact-toolbar-copy-menu-radius"] = t.copyMenuBorderRadius;
798
- cssVars["--persona-dropdown-radius"] = (_xa = cssVars["--persona-dropdown-radius"]) != null ? _xa : t.copyMenuBorderRadius;
822
+ cssVars["--persona-dropdown-radius"] = (_Oa = cssVars["--persona-dropdown-radius"]) != null ? _Oa : t.copyMenuBorderRadius;
799
823
  }
800
824
  if (t.copyMenuItemHoverBackground) {
801
825
  cssVars["--persona-artifact-toolbar-copy-menu-item-hover-bg"] = t.copyMenuItemHoverBackground;
802
- cssVars["--persona-dropdown-item-hover-bg"] = (_ya = cssVars["--persona-dropdown-item-hover-bg"]) != null ? _ya : t.copyMenuItemHoverBackground;
826
+ cssVars["--persona-dropdown-item-hover-bg"] = (_Pa = cssVars["--persona-dropdown-item-hover-bg"]) != null ? _Pa : t.copyMenuItemHoverBackground;
803
827
  }
804
828
  if (t.iconBackground) cssVars["--persona-artifact-toolbar-icon-bg"] = t.iconBackground;
805
829
  if (t.toolbarBorder) cssVars["--persona-artifact-toolbar-border"] = t.toolbarBorder;
@@ -819,7 +843,7 @@ function themeToCssVariables(theme) {
819
843
  if (artifact == null ? void 0 : artifact.pane) {
820
844
  const t = artifact.pane;
821
845
  if (t.toolbarBackground) {
822
- const toolbarBg = (_za = resolveTokenValue(theme, t.toolbarBackground)) != null ? _za : t.toolbarBackground;
846
+ const toolbarBg = (_Qa = resolveTokenValue(theme, t.toolbarBackground)) != null ? _Qa : t.toolbarBackground;
823
847
  cssVars["--persona-artifact-toolbar-bg"] = toolbarBg;
824
848
  }
825
849
  }
@@ -1136,7 +1160,12 @@ var DEFAULT_WIDGET_CONFIG = {
1136
1160
  },
1137
1161
  features: {
1138
1162
  showReasoning: true,
1139
- showToolCalls: true
1163
+ showToolCalls: true,
1164
+ scrollToBottom: {
1165
+ enabled: true,
1166
+ iconName: "arrow-down",
1167
+ label: ""
1168
+ }
1140
1169
  },
1141
1170
  suggestionChips: [
1142
1171
  "What can you help me with?",
@@ -1238,9 +1267,11 @@ function mergeWithDefaults(config) {
1238
1267
  ...config.voiceRecognition
1239
1268
  },
1240
1269
  features: (() => {
1241
- var _a2, _b2;
1270
+ var _a2, _b2, _c2, _d2;
1242
1271
  const da = (_a2 = DEFAULT_WIDGET_CONFIG.features) == null ? void 0 : _a2.artifacts;
1243
1272
  const ca = (_b2 = config.features) == null ? void 0 : _b2.artifacts;
1273
+ const dsb = (_c2 = DEFAULT_WIDGET_CONFIG.features) == null ? void 0 : _c2.scrollToBottom;
1274
+ const csb = (_d2 = config.features) == null ? void 0 : _d2.scrollToBottom;
1244
1275
  const mergedArtifacts = da === void 0 && ca === void 0 ? void 0 : {
1245
1276
  ...da,
1246
1277
  ...ca,
@@ -1249,9 +1280,14 @@ function mergeWithDefaults(config) {
1249
1280
  ...ca == null ? void 0 : ca.layout
1250
1281
  }
1251
1282
  };
1283
+ const mergedScrollToBottom = dsb === void 0 && csb === void 0 ? void 0 : {
1284
+ ...dsb,
1285
+ ...csb
1286
+ };
1252
1287
  return {
1253
1288
  ...DEFAULT_WIDGET_CONFIG.features,
1254
1289
  ...config.features,
1290
+ ...mergedScrollToBottom !== void 0 ? { scrollToBottom: mergedScrollToBottom } : {},
1255
1291
  ...mergedArtifacts !== void 0 ? { artifacts: mergedArtifacts } : {}
1256
1292
  };
1257
1293
  })(),
@@ -1780,6 +1816,16 @@ var ROLE_PRIMARY_ACTIONS = {
1780
1816
  { path: "semantic.colors.interactive.hover", kind: "accent" }
1781
1817
  ]
1782
1818
  };
1819
+ var ROLE_SCROLL_TO_BOTTOM = {
1820
+ roleId: "role-scroll-to-bottom",
1821
+ helper: "Scroll-to-bottom affordances in transcript and event stream",
1822
+ intensities: ROLE_INTENSITIES,
1823
+ targets: [
1824
+ { path: "components.scrollToBottom.background", kind: "background" },
1825
+ { path: "components.scrollToBottom.foreground", kind: "foreground" },
1826
+ { path: "components.scrollToBottom.border", kind: "border" }
1827
+ ]
1828
+ };
1783
1829
  var ROLE_INPUT = {
1784
1830
  roleId: "role-input",
1785
1831
  helper: "Message input field",
@@ -1818,6 +1864,7 @@ var ALL_ROLES = [
1818
1864
  ROLE_USER_MESSAGES,
1819
1865
  ROLE_ASSISTANT_MESSAGES,
1820
1866
  ROLE_PRIMARY_ACTIONS,
1867
+ ROLE_SCROLL_TO_BOTTOM,
1821
1868
  ROLE_INPUT,
1822
1869
  ROLE_LINKS_FOCUS,
1823
1870
  ROLE_BORDERS
@@ -2290,6 +2337,35 @@ var buttonColorsSectionDef = {
2290
2337
  { id: "btn-ghost-fg", label: "Ghost Foreground", type: "token-ref", path: "theme.components.button.ghost.foreground", defaultValue: "semantic.colors.text", tokenRef: { tokenType: "color" } }
2291
2338
  ]
2292
2339
  };
2340
+ var scrollToBottomSectionDef = {
2341
+ id: "scroll-to-bottom-style",
2342
+ title: "Scroll To Bottom",
2343
+ description: "Style the floating jump-to-latest affordance.",
2344
+ collapsed: true,
2345
+ fields: [
2346
+ { id: "scroll-bottom-bg", label: "Background", type: "token-ref", path: "theme.components.scrollToBottom.background", defaultValue: "components.button.primary.background", tokenRef: { tokenType: "color" } },
2347
+ { id: "scroll-bottom-fg", label: "Foreground", type: "token-ref", path: "theme.components.scrollToBottom.foreground", defaultValue: "components.button.primary.foreground", tokenRef: { tokenType: "color" } },
2348
+ { id: "scroll-bottom-border", label: "Border", type: "token-ref", path: "theme.components.scrollToBottom.border", defaultValue: "semantic.colors.primary", tokenRef: { tokenType: "color" } },
2349
+ { id: "scroll-bottom-size", label: "Size", type: "text", path: "theme.components.scrollToBottom.size", defaultValue: "40px" },
2350
+ { id: "scroll-bottom-radius", label: "Border Radius", type: "select", path: "theme.components.scrollToBottom.borderRadius", defaultValue: "palette.radius.full", options: [
2351
+ { value: "palette.radius.md", label: "Medium" },
2352
+ { value: "palette.radius.lg", label: "Large" },
2353
+ { value: "palette.radius.xl", label: "Extra Large" },
2354
+ { value: "palette.radius.full", label: "Full" }
2355
+ ] },
2356
+ { id: "scroll-bottom-shadow", label: "Shadow", type: "select", path: "theme.components.scrollToBottom.shadow", defaultValue: "palette.shadows.sm", options: [
2357
+ { value: "palette.shadows.none", label: "None" },
2358
+ { value: "palette.shadows.sm", label: "Small" },
2359
+ { value: "palette.shadows.md", label: "Medium" },
2360
+ { value: "palette.shadows.lg", label: "Large" },
2361
+ { value: "palette.shadows.xl", label: "Extra Large" }
2362
+ ] },
2363
+ { id: "scroll-bottom-padding", label: "Padding", type: "text", path: "theme.components.scrollToBottom.padding", defaultValue: "0.5rem 0.875rem" },
2364
+ { id: "scroll-bottom-gap", label: "Gap", type: "text", path: "theme.components.scrollToBottom.gap", defaultValue: "0.5rem" },
2365
+ { id: "scroll-bottom-font-size", label: "Font Size", type: "text", path: "theme.components.scrollToBottom.fontSize", defaultValue: "0.875rem" },
2366
+ { id: "scroll-bottom-icon-size", label: "Icon Size", type: "text", path: "theme.components.scrollToBottom.iconSize", defaultValue: "14px" }
2367
+ ]
2368
+ };
2293
2369
  var COMPONENT_SHAPE_SECTIONS = [
2294
2370
  panelLayoutSectionDef,
2295
2371
  launcherLayoutSectionDef,
@@ -2301,7 +2377,8 @@ var COMPONENT_COLOR_SECTIONS = [
2301
2377
  headerColorsSectionDef,
2302
2378
  messageColorsSectionDef,
2303
2379
  inputColorsSectionDef,
2304
- buttonColorsSectionDef
2380
+ buttonColorsSectionDef,
2381
+ scrollToBottomSectionDef
2305
2382
  ];
2306
2383
  var COMPONENTS_SECTIONS = [
2307
2384
  ...COMPONENT_SHAPE_SECTIONS,
@@ -2528,7 +2605,10 @@ var featuresSectionDef = {
2528
2605
  collapsed: true,
2529
2606
  fields: [
2530
2607
  { id: "feat-voice", label: "Voice Recognition", description: "Enable voice input", type: "toggle", path: "voiceRecognition.enabled", defaultValue: false },
2531
- { id: "feat-auto-focus", label: "Auto Focus Input", description: "Focus input after panel opens", type: "toggle", path: "autoFocusInput", defaultValue: false }
2608
+ { id: "feat-auto-focus", label: "Auto Focus Input", description: "Focus input after panel opens", type: "toggle", path: "autoFocusInput", defaultValue: false },
2609
+ { id: "feat-scroll-bottom-enabled", label: "Scroll To Bottom", description: "Show a jump-to-latest affordance when the user scrolls away from new content", type: "toggle", path: "features.scrollToBottom.enabled", defaultValue: true },
2610
+ { id: "feat-scroll-bottom-icon", label: "Scroll To Bottom Icon", type: "text", path: "features.scrollToBottom.iconName", defaultValue: "arrow-down" },
2611
+ { id: "feat-scroll-bottom-label", label: "Scroll To Bottom Label", description: "Leave empty for icon-only mode", type: "text", path: "features.scrollToBottom.label", defaultValue: "" }
2532
2612
  ]
2533
2613
  };
2534
2614
  var attachmentsSectionDef = {
@@ -2694,6 +2774,13 @@ var INTERFACE_ROLES_SECTION = {
2694
2774
  path: "theme.components.button.primary.background",
2695
2775
  roleAssignment: ROLE_PRIMARY_ACTIONS
2696
2776
  },
2777
+ {
2778
+ id: "role-scroll-to-bottom",
2779
+ label: "Scroll To Bottom",
2780
+ type: "role-assignment",
2781
+ path: "theme.components.scrollToBottom.background",
2782
+ roleAssignment: ROLE_SCROLL_TO_BOTTOM
2783
+ },
2697
2784
  {
2698
2785
  id: "role-input",
2699
2786
  label: "Input Field",
@@ -7639,6 +7726,72 @@ function pruneCache(cache, activeMessageIds) {
7639
7726
  }
7640
7727
  }
7641
7728
 
7729
+ // src/utils/auto-follow.ts
7730
+ function createFollowStateController(initiallyFollowing = true) {
7731
+ let following = initiallyFollowing;
7732
+ return {
7733
+ isFollowing: () => following,
7734
+ pause: () => {
7735
+ if (!following) return false;
7736
+ following = false;
7737
+ return true;
7738
+ },
7739
+ resume: () => {
7740
+ if (following) return false;
7741
+ following = true;
7742
+ return true;
7743
+ }
7744
+ };
7745
+ }
7746
+ function getScrollBottomOffset(element) {
7747
+ return Math.max(0, element.scrollHeight - element.clientHeight);
7748
+ }
7749
+ function isElementNearBottom(element, threshold) {
7750
+ return getScrollBottomOffset(element) - element.scrollTop <= threshold;
7751
+ }
7752
+ function resolveFollowStateFromScroll(input) {
7753
+ const {
7754
+ following,
7755
+ currentScrollTop,
7756
+ lastScrollTop,
7757
+ nearBottom,
7758
+ userScrollThreshold,
7759
+ isAutoScrolling = false,
7760
+ pauseOnUpwardScroll = false,
7761
+ pauseWhenAwayFromBottom = true,
7762
+ resumeRequiresDownwardScroll = false
7763
+ } = input;
7764
+ const delta = currentScrollTop - lastScrollTop;
7765
+ if (isAutoScrolling || Math.abs(delta) < userScrollThreshold) {
7766
+ return { action: "none", delta, nextLastScrollTop: currentScrollTop };
7767
+ }
7768
+ if (!following && nearBottom && (!resumeRequiresDownwardScroll || delta > 0)) {
7769
+ return { action: "resume", delta, nextLastScrollTop: currentScrollTop };
7770
+ }
7771
+ if (following && pauseOnUpwardScroll && delta < 0) {
7772
+ return { action: "pause", delta, nextLastScrollTop: currentScrollTop };
7773
+ }
7774
+ if (following && pauseWhenAwayFromBottom && !nearBottom) {
7775
+ return { action: "pause", delta, nextLastScrollTop: currentScrollTop };
7776
+ }
7777
+ return { action: "none", delta, nextLastScrollTop: currentScrollTop };
7778
+ }
7779
+ function resolveFollowStateFromWheel(input) {
7780
+ const {
7781
+ following,
7782
+ deltaY,
7783
+ nearBottom = false,
7784
+ resumeWhenNearBottom = false
7785
+ } = input;
7786
+ if (following && deltaY < 0) {
7787
+ return "pause";
7788
+ }
7789
+ if (!following && resumeWhenNearBottom && deltaY > 0 && nearBottom) {
7790
+ return "resume";
7791
+ }
7792
+ return "none";
7793
+ }
7794
+
7642
7795
  // src/utils/constants.ts
7643
7796
  var statusCopy = {
7644
7797
  idle: "Online",
@@ -10609,7 +10762,7 @@ function renderEventRow(event, index, firstTimestamp, esConfig, expandedSet, onT
10609
10762
  }
10610
10763
  }
10611
10764
  function createEventStreamView(options) {
10612
- var _a, _b;
10765
+ var _a, _b, _c, _d, _e;
10613
10766
  const {
10614
10767
  buffer,
10615
10768
  getFullHistory,
@@ -10617,7 +10770,11 @@ function createEventStreamView(options) {
10617
10770
  config,
10618
10771
  plugins = []
10619
10772
  } = options;
10620
- const esConfig = (_b = (_a = config == null ? void 0 : config.features) == null ? void 0 : _a.eventStream) != null ? _b : {};
10773
+ const scrollToBottomConfig = (_a = config == null ? void 0 : config.features) == null ? void 0 : _a.scrollToBottom;
10774
+ const scrollToBottomEnabled = (scrollToBottomConfig == null ? void 0 : scrollToBottomConfig.enabled) !== false;
10775
+ const scrollToBottomIconName = (_b = scrollToBottomConfig == null ? void 0 : scrollToBottomConfig.iconName) != null ? _b : "arrow-down";
10776
+ const scrollToBottomLabel = (_c = scrollToBottomConfig == null ? void 0 : scrollToBottomConfig.label) != null ? _c : "";
10777
+ const esConfig = (_e = (_d = config == null ? void 0 : config.features) == null ? void 0 : _d.eventStream) != null ? _e : {};
10621
10778
  const viewPlugin = plugins.find((p) => p.renderEventStreamView);
10622
10779
  if ((viewPlugin == null ? void 0 : viewPlugin.renderEventStreamView) && config) {
10623
10780
  const customView = viewPlugin.renderEventStreamView({
@@ -10651,7 +10808,7 @@ function createEventStreamView(options) {
10651
10808
  let lastKnownTypes = [];
10652
10809
  let lastTypeCounts = {};
10653
10810
  let lastFilteredCount = 0;
10654
- let userScrolledUp = false;
10811
+ const autoFollow = createFollowStateController();
10655
10812
  let newEventsSincePause = 0;
10656
10813
  let lastRenderTime = 0;
10657
10814
  let pendingUpdate = false;
@@ -10804,18 +10961,23 @@ function createEventStreamView(options) {
10804
10961
  eventsList.style.height = "100%";
10805
10962
  const scrollIndicator = createElement(
10806
10963
  "div",
10807
- "persona-absolute persona-bottom-3 persona-left-1/2 persona-transform persona--translate-x-1/2 persona-bg-persona-accent persona-text-white persona-text-xs persona-px-3 persona-py-1.5 persona-rounded-full persona-cursor-pointer persona-shadow-md persona-z-10 persona-flex persona-items-center persona-gap-1"
10964
+ "persona-scroll-to-bottom-indicator persona-absolute persona-bottom-3 persona-left-1/2 persona-transform persona--translate-x-1/2 persona-cursor-pointer persona-z-10 persona-text-xs"
10808
10965
  );
10809
10966
  applyCustomClasses(scrollIndicator, customClasses == null ? void 0 : customClasses.scrollIndicator);
10810
10967
  scrollIndicator.style.display = "none";
10968
+ scrollIndicator.setAttribute(
10969
+ "data-persona-scroll-to-bottom-has-label",
10970
+ scrollToBottomLabel ? "true" : "false"
10971
+ );
10811
10972
  const arrowIcon = renderLucideIcon(
10812
- "arrow-down",
10813
- "12px",
10973
+ scrollToBottomIconName,
10974
+ "14px",
10814
10975
  "currentColor",
10815
10976
  2
10816
10977
  );
10817
10978
  if (arrowIcon) scrollIndicator.appendChild(arrowIcon);
10818
10979
  const indicatorText = createElement("span", "");
10980
+ indicatorText.textContent = scrollToBottomLabel;
10819
10981
  scrollIndicator.appendChild(indicatorText);
10820
10982
  const noResultsMsg = createElement(
10821
10983
  "div",
@@ -10887,7 +11049,7 @@ function createEventStreamView(options) {
10887
11049
  function resetScrollState() {
10888
11050
  lastFilteredCount = 0;
10889
11051
  newEventsSincePause = 0;
10890
- userScrolledUp = false;
11052
+ autoFollow.resume();
10891
11053
  scrollIndicator.style.display = "none";
10892
11054
  }
10893
11055
  function toggleExpand(eventId) {
@@ -10898,17 +11060,18 @@ function createEventStreamView(options) {
10898
11060
  }
10899
11061
  dirtyExpandId = eventId;
10900
11062
  const savedScrollTop = eventsList.scrollTop;
10901
- const wasUserScrolledUp = userScrolledUp;
11063
+ const wasAutoFollowing = autoFollow.isFollowing();
10902
11064
  suppressScrollHandler = true;
10903
- userScrolledUp = true;
11065
+ autoFollow.pause();
10904
11066
  updateNow();
10905
11067
  eventsList.scrollTop = savedScrollTop;
10906
- userScrolledUp = wasUserScrolledUp;
11068
+ if (wasAutoFollowing) {
11069
+ autoFollow.resume();
11070
+ }
10907
11071
  suppressScrollHandler = false;
10908
11072
  }
10909
11073
  function isNearBottom() {
10910
- const threshold = 50;
10911
- return eventsList.scrollHeight - eventsList.scrollTop - eventsList.clientHeight <= threshold;
11074
+ return isElementNearBottom(eventsList, 50);
10912
11075
  }
10913
11076
  function updateNow() {
10914
11077
  lastRenderTime = Date.now();
@@ -10938,9 +11101,9 @@ function createEventStreamView(options) {
10938
11101
  if (copyAllBtn) {
10939
11102
  copyAllBtn.title = hasActiveFilters() ? `Copy Filtered (${newCount})` : "Copy All";
10940
11103
  }
10941
- if (userScrolledUp && newCount > lastFilteredCount) {
11104
+ if (scrollToBottomEnabled && !autoFollow.isFollowing() && newCount > lastFilteredCount) {
10942
11105
  newEventsSincePause += newCount - lastFilteredCount;
10943
- indicatorText.textContent = `${newEventsSincePause} new event${newEventsSincePause === 1 ? "" : "s"}`;
11106
+ indicatorText.textContent = scrollToBottomLabel ? `${scrollToBottomLabel}${newEventsSincePause > 0 ? ` (${newEventsSincePause})` : ""}` : "";
10944
11107
  scrollIndicator.style.display = "";
10945
11108
  }
10946
11109
  lastFilteredCount = newCount;
@@ -11024,7 +11187,7 @@ function createEventStreamView(options) {
11024
11187
  }
11025
11188
  }
11026
11189
  }
11027
- if (!userScrolledUp) {
11190
+ if (autoFollow.isFollowing()) {
11028
11191
  eventsList.scrollTop = eventsList.scrollHeight;
11029
11192
  }
11030
11193
  }
@@ -11133,24 +11296,50 @@ function createEventStreamView(options) {
11133
11296
  const handleListScroll = () => {
11134
11297
  if (suppressScrollHandler) return;
11135
11298
  const currentScrollTop = eventsList.scrollTop;
11136
- const scrollingDown = currentScrollTop > lastScrollTop;
11137
- lastScrollTop = currentScrollTop;
11138
- if (isNearBottom() && scrollingDown) {
11139
- userScrolledUp = false;
11299
+ const { action, nextLastScrollTop } = resolveFollowStateFromScroll({
11300
+ following: autoFollow.isFollowing(),
11301
+ currentScrollTop,
11302
+ lastScrollTop,
11303
+ nearBottom: isNearBottom(),
11304
+ userScrollThreshold: 1,
11305
+ resumeRequiresDownwardScroll: true
11306
+ });
11307
+ lastScrollTop = nextLastScrollTop;
11308
+ if (action === "resume") {
11309
+ autoFollow.resume();
11140
11310
  newEventsSincePause = 0;
11141
11311
  scrollIndicator.style.display = "none";
11142
- } else if (!isNearBottom()) {
11143
- userScrolledUp = true;
11312
+ } else if (action === "pause") {
11313
+ autoFollow.pause();
11314
+ if (scrollToBottomEnabled) {
11315
+ indicatorText.textContent = scrollToBottomLabel;
11316
+ scrollIndicator.style.display = "";
11317
+ }
11144
11318
  }
11145
11319
  };
11146
11320
  const handleWheel = (e) => {
11147
- if (e.deltaY < 0) {
11148
- userScrolledUp = true;
11321
+ const action = resolveFollowStateFromWheel({
11322
+ following: autoFollow.isFollowing(),
11323
+ deltaY: e.deltaY,
11324
+ nearBottom: isNearBottom(),
11325
+ resumeWhenNearBottom: true
11326
+ });
11327
+ if (action === "pause") {
11328
+ autoFollow.pause();
11329
+ if (scrollToBottomEnabled) {
11330
+ indicatorText.textContent = scrollToBottomLabel;
11331
+ scrollIndicator.style.display = "";
11332
+ }
11333
+ } else if (action === "resume") {
11334
+ autoFollow.resume();
11335
+ newEventsSincePause = 0;
11336
+ scrollIndicator.style.display = "none";
11149
11337
  }
11150
11338
  };
11151
11339
  const handleScrollIndicatorClick = () => {
11340
+ if (!scrollToBottomEnabled) return;
11152
11341
  eventsList.scrollTop = eventsList.scrollHeight;
11153
- userScrolledUp = false;
11342
+ autoFollow.resume();
11154
11343
  newEventsSincePause = 0;
11155
11344
  scrollIndicator.style.display = "none";
11156
11345
  };
@@ -12769,7 +12958,7 @@ var buildPostprocessor = (cfg, actionManager, onResubmitRequested) => {
12769
12958
  };
12770
12959
  };
12771
12960
  var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
12772
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L;
12961
+ var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N;
12773
12962
  if (mount.id && !mount.getAttribute("data-persona-instance")) {
12774
12963
  mount.setAttribute("data-persona-instance", mount.id);
12775
12964
  }
@@ -12887,10 +13076,11 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
12887
13076
  let showReasoning = (_l = (_k = config.features) == null ? void 0 : _k.showReasoning) != null ? _l : true;
12888
13077
  let showToolCalls = (_n = (_m = config.features) == null ? void 0 : _m.showToolCalls) != null ? _n : true;
12889
13078
  let showEventStreamToggle = (_p = (_o = config.features) == null ? void 0 : _o.showEventStreamToggle) != null ? _p : false;
12890
- const persistKeyPrefix = (_r = typeof config.persistState === "object" ? (_q = config.persistState) == null ? void 0 : _q.keyPrefix : void 0) != null ? _r : "persona-";
13079
+ let scrollToBottomFeature = (_r = (_q = config.features) == null ? void 0 : _q.scrollToBottom) != null ? _r : {};
13080
+ const persistKeyPrefix = (_t = typeof config.persistState === "object" ? (_s = config.persistState) == null ? void 0 : _s.keyPrefix : void 0) != null ? _t : "persona-";
12891
13081
  const eventStreamDbName = `${persistKeyPrefix}event-stream`;
12892
13082
  let eventStreamStore = showEventStreamToggle ? new EventStreamStore(eventStreamDbName) : null;
12893
- const eventStreamMaxEvents = (_u = (_t = (_s = config.features) == null ? void 0 : _s.eventStream) == null ? void 0 : _t.maxEvents) != null ? _u : 2e3;
13083
+ const eventStreamMaxEvents = (_w = (_v = (_u = config.features) == null ? void 0 : _u.eventStream) == null ? void 0 : _v.maxEvents) != null ? _w : 2e3;
12894
13084
  let eventStreamBuffer = showEventStreamToggle ? new EventStreamBuffer(eventStreamMaxEvents, eventStreamStore) : null;
12895
13085
  let eventStreamView = null;
12896
13086
  let eventStreamVisible = false;
@@ -12927,7 +13117,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
12927
13117
  (_b2 = (_a2 = config.messageActions) == null ? void 0 : _a2.onFeedback) == null ? void 0 : _b2.call(_a2, feedback);
12928
13118
  }
12929
13119
  };
12930
- const statusConfig = (_v = config.statusIndicator) != null ? _v : {};
13120
+ const statusConfig = (_x = config.statusIndicator) != null ? _x : {};
12931
13121
  const _getStatusText = (status) => {
12932
13122
  var _a2, _b2, _c2, _d2;
12933
13123
  if (status === "idle") return (_a2 = statusConfig.idleText) != null ? _a2 : statusCopy.idle;
@@ -12981,6 +13171,52 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
12981
13171
  let attachmentButtonWrapper = panelElements.attachmentButtonWrapper;
12982
13172
  let attachmentInput = panelElements.attachmentInput;
12983
13173
  let attachmentPreviewsContainer = panelElements.attachmentPreviewsContainer;
13174
+ container.classList.add("persona-relative");
13175
+ body.classList.add("persona-relative");
13176
+ const SCROLL_TO_BOTTOM_EDGE_OFFSET = 12;
13177
+ const getScrollToBottomLabel = () => {
13178
+ var _a2;
13179
+ return (_a2 = scrollToBottomFeature.label) != null ? _a2 : "";
13180
+ };
13181
+ const getScrollToBottomIconName = () => {
13182
+ var _a2;
13183
+ return (_a2 = scrollToBottomFeature.iconName) != null ? _a2 : "arrow-down";
13184
+ };
13185
+ const isScrollToBottomEnabled = () => scrollToBottomFeature.enabled !== false;
13186
+ const scrollToBottomButton = createElement(
13187
+ "button",
13188
+ "persona-scroll-to-bottom-indicator persona-absolute persona-bottom-3 persona-left-1/2 persona-z-10 persona-flex persona-items-center persona-gap-1 persona-text-xs persona-transform persona--translate-x-1/2 persona-cursor-pointer"
13189
+ );
13190
+ scrollToBottomButton.type = "button";
13191
+ scrollToBottomButton.style.display = "none";
13192
+ scrollToBottomButton.setAttribute("data-persona-scroll-to-bottom", "true");
13193
+ const scrollToBottomIcon = createElement("span", "persona-flex persona-items-center");
13194
+ const scrollToBottomLabel = createElement("span", "");
13195
+ scrollToBottomButton.append(scrollToBottomIcon, scrollToBottomLabel);
13196
+ container.appendChild(scrollToBottomButton);
13197
+ const updateScrollToBottomButtonOffset = () => {
13198
+ const footerHidden = footer.style.display === "none";
13199
+ const footerHeight = footerHidden ? 0 : footer.offsetHeight;
13200
+ scrollToBottomButton.style.bottom = `${footerHeight + SCROLL_TO_BOTTOM_EDGE_OFFSET}px`;
13201
+ };
13202
+ updateScrollToBottomButtonOffset();
13203
+ const renderScrollToBottomButton = () => {
13204
+ const hasLabel = Boolean(getScrollToBottomLabel());
13205
+ scrollToBottomButton.setAttribute("aria-label", getScrollToBottomLabel() || "Jump to latest");
13206
+ scrollToBottomButton.title = getScrollToBottomLabel();
13207
+ scrollToBottomButton.setAttribute("data-persona-scroll-to-bottom-has-label", hasLabel ? "true" : "false");
13208
+ scrollToBottomIcon.innerHTML = "";
13209
+ const icon = renderLucideIcon(getScrollToBottomIconName(), "14px", "currentColor", 2);
13210
+ if (icon) {
13211
+ scrollToBottomIcon.appendChild(icon);
13212
+ scrollToBottomIcon.style.display = "";
13213
+ } else {
13214
+ scrollToBottomIcon.style.display = "none";
13215
+ }
13216
+ scrollToBottomLabel.textContent = getScrollToBottomLabel();
13217
+ scrollToBottomLabel.style.display = hasLabel ? "" : "none";
13218
+ };
13219
+ renderScrollToBottomButton();
12984
13220
  let attachmentManager = null;
12985
13221
  let composerVoiceBridge = null;
12986
13222
  const headerPlugin = plugins.find((p) => p.renderHeader);
@@ -13036,6 +13272,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
13036
13272
  };
13037
13273
  eventStreamLastUpdate = 0;
13038
13274
  eventStreamRAF = requestAnimationFrame(rafLoop);
13275
+ syncScrollToBottomButton();
13039
13276
  eventBus.emit("eventStream:opened", { timestamp: Date.now() });
13040
13277
  };
13041
13278
  const toggleEventStreamOff = () => {
@@ -13055,11 +13292,12 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
13055
13292
  cancelAnimationFrame(eventStreamRAF);
13056
13293
  eventStreamRAF = null;
13057
13294
  }
13295
+ syncScrollToBottomButton();
13058
13296
  eventBus.emit("eventStream:closed", { timestamp: Date.now() });
13059
13297
  };
13060
13298
  let eventStreamToggleBtn = null;
13061
13299
  if (showEventStreamToggle) {
13062
- const esClassNames = (_x = (_w = config.features) == null ? void 0 : _w.eventStream) == null ? void 0 : _x.classNames;
13300
+ const esClassNames = (_z = (_y = config.features) == null ? void 0 : _y.eventStream) == null ? void 0 : _z.classNames;
13063
13301
  const toggleBtnClasses = "persona-inline-flex persona-items-center persona-justify-center persona-rounded-full hover:persona-opacity-80 persona-cursor-pointer persona-border-none persona-bg-transparent persona-p-1" + ((esClassNames == null ? void 0 : esClassNames.toggleButton) ? " " + esClassNames.toggleButton : "");
13064
13302
  eventStreamToggleBtn = createElement("button", toggleBtnClasses);
13065
13303
  eventStreamToggleBtn.style.width = "28px";
@@ -13138,7 +13376,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
13138
13376
  onModelChange: (modelId) => {
13139
13377
  config.composer = { ...config.composer, selectedModelId: modelId };
13140
13378
  },
13141
- onVoiceToggle: ((_y = config.voiceRecognition) == null ? void 0 : _y.enabled) === true ? () => {
13379
+ onVoiceToggle: ((_A = config.voiceRecognition) == null ? void 0 : _A.enabled) === true ? () => {
13142
13380
  composerVoiceBridge == null ? void 0 : composerVoiceBridge();
13143
13381
  } : void 0
13144
13382
  });
@@ -13177,7 +13415,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
13177
13415
  };
13178
13416
  ensureComposerAttachmentSurface(footer);
13179
13417
  bindComposerRefsFromFooter(footer);
13180
- const contentMaxWidth = (_z = config.layout) == null ? void 0 : _z.contentMaxWidth;
13418
+ const contentMaxWidth = (_B = config.layout) == null ? void 0 : _B.contentMaxWidth;
13181
13419
  if (contentMaxWidth && composerForm) {
13182
13420
  composerForm.style.maxWidth = contentMaxWidth;
13183
13421
  composerForm.style.marginLeft = "auto";
@@ -13188,7 +13426,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
13188
13426
  attachmentPreviewsContainer.style.marginLeft = "auto";
13189
13427
  attachmentPreviewsContainer.style.marginRight = "auto";
13190
13428
  }
13191
- if (((_A = config.attachments) == null ? void 0 : _A.enabled) && attachmentInput && attachmentPreviewsContainer) {
13429
+ if (((_C = config.attachments) == null ? void 0 : _C.enabled) && attachmentInput && attachmentPreviewsContainer) {
13192
13430
  attachmentManager = AttachmentManager.fromConfig(config.attachments);
13193
13431
  attachmentManager.setPreviewsContainer(attachmentPreviewsContainer);
13194
13432
  attachmentInput.addEventListener("change", (e) => {
@@ -13975,17 +14213,12 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
13975
14213
  let isStreaming = false;
13976
14214
  const messageCache = createMessageCache();
13977
14215
  let configVersion = 0;
13978
- let shouldAutoScroll = true;
14216
+ const autoFollow = createFollowStateController();
13979
14217
  let lastScrollTop = 0;
13980
- let lastAutoScrollTime = 0;
13981
14218
  let scrollRAF = null;
13982
- let isAutoScrollBlocked = false;
13983
- let blockUntilTime = 0;
13984
14219
  let isAutoScrolling = false;
13985
- const AUTO_SCROLL_THROTTLE = 125;
13986
- const AUTO_SCROLL_BLOCK_TIME = 2e3;
13987
- const USER_SCROLL_THRESHOLD = 5;
13988
- const BOTTOM_THRESHOLD = 50;
14220
+ const USER_SCROLL_THRESHOLD = 1;
14221
+ const BOTTOM_THRESHOLD = 8;
13989
14222
  const messageState = /* @__PURE__ */ new Map();
13990
14223
  const voiceState = {
13991
14224
  active: false,
@@ -13993,7 +14226,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
13993
14226
  lastUserMessageWasVoice: false,
13994
14227
  lastUserMessageId: null
13995
14228
  };
13996
- const voiceAutoResumeMode = (_C = (_B = config.voiceRecognition) == null ? void 0 : _B.autoResume) != null ? _C : false;
14229
+ const voiceAutoResumeMode = (_E = (_D = config.voiceRecognition) == null ? void 0 : _D.autoResume) != null ? _E : false;
13997
14230
  const emitVoiceState = (source) => {
13998
14231
  eventBus.emit("voice:state", {
13999
14232
  active: voiceState.active,
@@ -14059,56 +14292,78 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
14059
14292
  }
14060
14293
  }
14061
14294
  }
14062
- const scheduleAutoScroll = (force = false) => {
14063
- if (!shouldAutoScroll) return;
14064
- const now = Date.now();
14065
- if (isAutoScrollBlocked && now < blockUntilTime) {
14066
- if (!force) return;
14067
- }
14068
- if (isAutoScrollBlocked && now >= blockUntilTime) {
14069
- isAutoScrollBlocked = false;
14295
+ let smoothScrollRAF = null;
14296
+ const getScrollableContainer = () => {
14297
+ const scrollable = wrapper.querySelector("#persona-scroll-container");
14298
+ return scrollable || body;
14299
+ };
14300
+ const cancelSmoothScroll = () => {
14301
+ if (smoothScrollRAF !== null) {
14302
+ cancelAnimationFrame(smoothScrollRAF);
14303
+ smoothScrollRAF = null;
14070
14304
  }
14071
- if (!force && !isStreaming) return;
14072
- if (now - lastAutoScrollTime < AUTO_SCROLL_THROTTLE) return;
14073
- lastAutoScrollTime = now;
14074
- if (scrollRAF) {
14305
+ isAutoScrolling = false;
14306
+ };
14307
+ const cancelAutoScroll = () => {
14308
+ if (scrollRAF !== null) {
14075
14309
  cancelAnimationFrame(scrollRAF);
14310
+ scrollRAF = null;
14076
14311
  }
14312
+ cancelSmoothScroll();
14313
+ };
14314
+ const syncScrollToBottomButton = () => {
14315
+ if (!isScrollToBottomEnabled() || eventStreamVisible) {
14316
+ if (scrollToBottomButton.parentNode) {
14317
+ scrollToBottomButton.remove();
14318
+ }
14319
+ scrollToBottomButton.style.display = "none";
14320
+ return;
14321
+ }
14322
+ if (scrollToBottomButton.parentNode !== container) {
14323
+ container.appendChild(scrollToBottomButton);
14324
+ }
14325
+ updateScrollToBottomButtonOffset();
14326
+ scrollToBottomButton.style.display = autoFollow.isFollowing() ? "none" : "";
14327
+ };
14328
+ const pauseAutoScroll = () => {
14329
+ if (!autoFollow.pause()) return;
14330
+ cancelAutoScroll();
14331
+ syncScrollToBottomButton();
14332
+ };
14333
+ const resumeAutoScroll = () => {
14334
+ autoFollow.resume();
14335
+ syncScrollToBottomButton();
14336
+ };
14337
+ const scheduleAutoScroll = (force = false) => {
14338
+ if (!autoFollow.isFollowing()) return;
14339
+ if (!force && !isStreaming) return;
14340
+ cancelAutoScroll();
14077
14341
  scrollRAF = requestAnimationFrame(() => {
14078
- if (isAutoScrollBlocked || !shouldAutoScroll) return;
14079
- isAutoScrolling = true;
14080
- body.scrollTop = body.scrollHeight;
14081
- lastScrollTop = body.scrollTop;
14082
- requestAnimationFrame(() => {
14083
- isAutoScrolling = false;
14084
- });
14085
14342
  scrollRAF = null;
14343
+ if (!autoFollow.isFollowing()) return;
14344
+ smoothScrollToBottom(getScrollableContainer(), force ? 220 : 140);
14086
14345
  });
14087
14346
  };
14088
- let smoothScrollRAF = null;
14089
- const getScrollableContainer = () => {
14090
- const scrollable = wrapper.querySelector("#persona-scroll-container");
14091
- return scrollable || body;
14092
- };
14093
14347
  const smoothScrollToBottom = (element, duration = 500) => {
14094
14348
  const start = element.scrollTop;
14095
- const clientHeight = element.clientHeight;
14096
- let target = element.scrollHeight;
14349
+ let target = getScrollBottomOffset(element);
14097
14350
  let distance = target - start;
14098
- const isAtBottom = start + clientHeight >= target - 2;
14099
- if (isAtBottom || Math.abs(distance) < 5) {
14351
+ if (Math.abs(distance) < 1) {
14352
+ lastScrollTop = element.scrollTop;
14100
14353
  return;
14101
14354
  }
14102
- if (smoothScrollRAF !== null) {
14103
- cancelAnimationFrame(smoothScrollRAF);
14104
- smoothScrollRAF = null;
14105
- }
14355
+ cancelSmoothScroll();
14106
14356
  const startTime = performance.now();
14357
+ isAutoScrolling = true;
14107
14358
  const easeOutCubic = (t) => {
14108
14359
  return 1 - Math.pow(1 - t, 3);
14109
14360
  };
14110
14361
  const animate = (currentTime) => {
14111
- const currentTarget = element.scrollHeight;
14362
+ if (!autoFollow.isFollowing()) {
14363
+ cancelSmoothScroll();
14364
+ return;
14365
+ }
14366
+ const currentTarget = getScrollBottomOffset(element);
14112
14367
  if (currentTarget !== target) {
14113
14368
  target = currentTarget;
14114
14369
  distance = target - start;
@@ -14118,11 +14373,14 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
14118
14373
  const eased = easeOutCubic(progress);
14119
14374
  const currentScroll = start + distance * eased;
14120
14375
  element.scrollTop = currentScroll;
14376
+ lastScrollTop = element.scrollTop;
14121
14377
  if (progress < 1) {
14122
14378
  smoothScrollRAF = requestAnimationFrame(animate);
14123
14379
  } else {
14124
- element.scrollTop = element.scrollHeight;
14380
+ element.scrollTop = target;
14381
+ lastScrollTop = element.scrollTop;
14125
14382
  smoothScrollRAF = null;
14383
+ isAutoScrolling = false;
14126
14384
  }
14127
14385
  };
14128
14386
  smoothScrollRAF = requestAnimationFrame(animate);
@@ -14462,15 +14720,6 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
14462
14720
  }
14463
14721
  }
14464
14722
  morphMessages(container2, tempContainer);
14465
- if (shouldAutoScroll && !isAutoScrollBlocked) {
14466
- requestAnimationFrame(() => {
14467
- requestAnimationFrame(() => {
14468
- if (!shouldAutoScroll || isAutoScrollBlocked) return;
14469
- const scrollableContainer = getScrollableContainer();
14470
- smoothScrollToBottom(scrollableContainer);
14471
- });
14472
- });
14473
- }
14474
14723
  };
14475
14724
  const renderMessagesWithPlugins = renderMessagesWithPluginsImpl;
14476
14725
  const updateOpenState = () => {
@@ -14688,7 +14937,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
14688
14937
  }
14689
14938
  });
14690
14939
  sessionRef.current = session;
14691
- if (((_E = (_D = config.voiceRecognition) == null ? void 0 : _D.provider) == null ? void 0 : _E.type) === "runtype") {
14940
+ if (((_G = (_F = config.voiceRecognition) == null ? void 0 : _F.provider) == null ? void 0 : _G.type) === "runtype") {
14692
14941
  try {
14693
14942
  session.setupVoice();
14694
14943
  } catch (err) {
@@ -15259,38 +15508,70 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15259
15508
  panel.style.height = `${finalHeight}px`;
15260
15509
  }
15261
15510
  } finally {
15511
+ updateScrollToBottomButtonOffset();
15262
15512
  updateOpenState();
15263
15513
  }
15264
15514
  };
15265
15515
  recalcPanelHeight();
15266
- const ownerWindow = (_F = mount.ownerDocument.defaultView) != null ? _F : window;
15516
+ const ownerWindow = (_H = mount.ownerDocument.defaultView) != null ? _H : window;
15267
15517
  ownerWindow.addEventListener("resize", recalcPanelHeight);
15268
15518
  destroyCallbacks.push(() => ownerWindow.removeEventListener("resize", recalcPanelHeight));
15519
+ if (typeof ResizeObserver !== "undefined") {
15520
+ const footerResizeObserver = new ResizeObserver(() => {
15521
+ updateScrollToBottomButtonOffset();
15522
+ });
15523
+ footerResizeObserver.observe(footer);
15524
+ destroyCallbacks.push(() => footerResizeObserver.disconnect());
15525
+ }
15269
15526
  lastScrollTop = body.scrollTop;
15270
15527
  const handleScroll = () => {
15271
15528
  const scrollTop = body.scrollTop;
15272
- const scrollHeight = body.scrollHeight;
15273
- const clientHeight = body.clientHeight;
15274
- const distanceFromBottom = scrollHeight - scrollTop - clientHeight;
15275
- const delta = Math.abs(scrollTop - lastScrollTop);
15276
- lastScrollTop = scrollTop;
15277
- if (isAutoScrolling) return;
15278
- if (delta <= USER_SCROLL_THRESHOLD) return;
15279
- if (!shouldAutoScroll && distanceFromBottom < BOTTOM_THRESHOLD) {
15280
- isAutoScrollBlocked = false;
15281
- shouldAutoScroll = true;
15529
+ const { action, nextLastScrollTop } = resolveFollowStateFromScroll({
15530
+ following: autoFollow.isFollowing(),
15531
+ currentScrollTop: scrollTop,
15532
+ lastScrollTop,
15533
+ nearBottom: isElementNearBottom(body, BOTTOM_THRESHOLD),
15534
+ userScrollThreshold: USER_SCROLL_THRESHOLD,
15535
+ isAutoScrolling,
15536
+ pauseOnUpwardScroll: true,
15537
+ pauseWhenAwayFromBottom: false,
15538
+ resumeRequiresDownwardScroll: true
15539
+ });
15540
+ lastScrollTop = nextLastScrollTop;
15541
+ if (action === "resume") {
15542
+ resumeAutoScroll();
15282
15543
  return;
15283
15544
  }
15284
- if (shouldAutoScroll && distanceFromBottom > BOTTOM_THRESHOLD) {
15285
- isAutoScrollBlocked = true;
15286
- blockUntilTime = Date.now() + AUTO_SCROLL_BLOCK_TIME;
15287
- shouldAutoScroll = false;
15545
+ if (action === "pause") {
15546
+ pauseAutoScroll();
15288
15547
  }
15289
15548
  };
15290
15549
  body.addEventListener("scroll", handleScroll, { passive: true });
15291
15550
  destroyCallbacks.push(() => body.removeEventListener("scroll", handleScroll));
15551
+ const handleWheel = (event) => {
15552
+ const action = resolveFollowStateFromWheel({
15553
+ following: autoFollow.isFollowing(),
15554
+ deltaY: event.deltaY,
15555
+ nearBottom: isElementNearBottom(body, BOTTOM_THRESHOLD),
15556
+ resumeWhenNearBottom: true
15557
+ });
15558
+ if (action === "pause") {
15559
+ pauseAutoScroll();
15560
+ } else if (action === "resume") {
15561
+ resumeAutoScroll();
15562
+ }
15563
+ };
15564
+ body.addEventListener("wheel", handleWheel, { passive: true });
15565
+ destroyCallbacks.push(() => body.removeEventListener("wheel", handleWheel));
15566
+ scrollToBottomButton.addEventListener("click", () => {
15567
+ body.scrollTop = body.scrollHeight;
15568
+ lastScrollTop = body.scrollTop;
15569
+ resumeAutoScroll();
15570
+ scheduleAutoScroll(true);
15571
+ });
15572
+ destroyCallbacks.push(() => scrollToBottomButton.remove());
15292
15573
  destroyCallbacks.push(() => {
15293
- if (scrollRAF) cancelAnimationFrame(scrollRAF);
15574
+ cancelAutoScroll();
15294
15575
  });
15295
15576
  const refreshCloseButton = () => {
15296
15577
  if (!closeButton) return;
@@ -15386,7 +15667,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15386
15667
  }
15387
15668
  const controller = {
15388
15669
  update(nextConfig) {
15389
- var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2, _x2, _y2, _z2, _A2, _B2, _C2, _D2, _E2, _F2, _G2, _H2, _I2, _J2, _K2, _L2, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa;
15670
+ var _a2, _b2, _c2, _d2, _e2, _f2, _g2, _h2, _i2, _j2, _k2, _l2, _m2, _n2, _o2, _p2, _q2, _r2, _s2, _t2, _u2, _v2, _w2, _x2, _y2, _z2, _A2, _B2, _C2, _D2, _E2, _F2, _G2, _H2, _I2, _J2, _K2, _L2, _M2, _N2, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra, _sa, _ta, _ua, _va, _wa, _xa, _ya, _za, _Aa, _Ba, _Ca, _Da, _Ea, _Fa, _Ga, _Ha, _Ia, _Ja, _Ka, _La, _Ma, _Na, _Oa, _Pa, _Qa, _Ra;
15390
15671
  const previousToolCallConfig = config.toolCall;
15391
15672
  const previousMessageActions = config.messageActions;
15392
15673
  const previousLayoutMessages = (_a2 = config.layout) == null ? void 0 : _a2.messages;
@@ -15409,8 +15690,11 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15409
15690
  autoExpand = (_e2 = (_d2 = config.launcher) == null ? void 0 : _d2.autoExpand) != null ? _e2 : false;
15410
15691
  showReasoning = (_g2 = (_f2 = config.features) == null ? void 0 : _f2.showReasoning) != null ? _g2 : true;
15411
15692
  showToolCalls = (_i2 = (_h2 = config.features) == null ? void 0 : _h2.showToolCalls) != null ? _i2 : true;
15693
+ scrollToBottomFeature = (_k2 = (_j2 = config.features) == null ? void 0 : _j2.scrollToBottom) != null ? _k2 : {};
15694
+ renderScrollToBottomButton();
15695
+ syncScrollToBottomButton();
15412
15696
  const prevShowEventStreamToggle = showEventStreamToggle;
15413
- showEventStreamToggle = (_k2 = (_j2 = config.features) == null ? void 0 : _j2.showEventStreamToggle) != null ? _k2 : false;
15697
+ showEventStreamToggle = (_m2 = (_l2 = config.features) == null ? void 0 : _l2.showEventStreamToggle) != null ? _m2 : false;
15414
15698
  if (showEventStreamToggle && !prevShowEventStreamToggle) {
15415
15699
  if (!eventStreamBuffer) {
15416
15700
  eventStreamStore = new EventStreamStore(eventStreamDbName);
@@ -15427,7 +15711,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15427
15711
  });
15428
15712
  }
15429
15713
  if (!eventStreamToggleBtn && header) {
15430
- const dynEsClassNames = (_m2 = (_l2 = config.features) == null ? void 0 : _l2.eventStream) == null ? void 0 : _m2.classNames;
15714
+ const dynEsClassNames = (_o2 = (_n2 = config.features) == null ? void 0 : _n2.eventStream) == null ? void 0 : _o2.classNames;
15431
15715
  const dynToggleBtnClasses = "persona-inline-flex persona-items-center persona-justify-center persona-rounded-full hover:persona-opacity-80 persona-cursor-pointer persona-border-none persona-bg-transparent persona-p-1" + ((dynEsClassNames == null ? void 0 : dynEsClassNames.toggleButton) ? " " + dynEsClassNames.toggleButton : "");
15432
15716
  eventStreamToggleBtn = createElement("button", dynToggleBtnClasses);
15433
15717
  eventStreamToggleBtn.style.width = "28px";
@@ -15465,15 +15749,15 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15465
15749
  eventStreamBuffer = null;
15466
15750
  eventStreamStore = null;
15467
15751
  }
15468
- if (((_n2 = config.launcher) == null ? void 0 : _n2.enabled) === false && launcherButtonInstance) {
15752
+ if (((_p2 = config.launcher) == null ? void 0 : _p2.enabled) === false && launcherButtonInstance) {
15469
15753
  launcherButtonInstance.destroy();
15470
15754
  launcherButtonInstance = null;
15471
15755
  }
15472
- if (((_o2 = config.launcher) == null ? void 0 : _o2.enabled) === false && customLauncherElement) {
15756
+ if (((_q2 = config.launcher) == null ? void 0 : _q2.enabled) === false && customLauncherElement) {
15473
15757
  customLauncherElement.remove();
15474
15758
  customLauncherElement = null;
15475
15759
  }
15476
- if (((_p2 = config.launcher) == null ? void 0 : _p2.enabled) !== false && !launcherButtonInstance && !customLauncherElement) {
15760
+ if (((_r2 = config.launcher) == null ? void 0 : _r2.enabled) !== false && !launcherButtonInstance && !customLauncherElement) {
15477
15761
  const launcherPlugin = plugins.find((p) => p.renderLauncher);
15478
15762
  if (launcherPlugin == null ? void 0 : launcherPlugin.renderLauncher) {
15479
15763
  const customLauncher = launcherPlugin.renderLauncher({
@@ -15497,13 +15781,13 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15497
15781
  if (launcherButtonInstance) {
15498
15782
  launcherButtonInstance.update(config);
15499
15783
  }
15500
- if (headerTitle && ((_q2 = config.launcher) == null ? void 0 : _q2.title) !== void 0) {
15784
+ if (headerTitle && ((_s2 = config.launcher) == null ? void 0 : _s2.title) !== void 0) {
15501
15785
  headerTitle.textContent = config.launcher.title;
15502
15786
  }
15503
- if (headerSubtitle && ((_r2 = config.launcher) == null ? void 0 : _r2.subtitle) !== void 0) {
15787
+ if (headerSubtitle && ((_t2 = config.launcher) == null ? void 0 : _t2.subtitle) !== void 0) {
15504
15788
  headerSubtitle.textContent = config.launcher.subtitle;
15505
15789
  }
15506
- const headerLayoutConfig = (_s2 = config.layout) == null ? void 0 : _s2.header;
15790
+ const headerLayoutConfig = (_u2 = config.layout) == null ? void 0 : _u2.header;
15507
15791
  const headerLayoutChanged = (headerLayoutConfig == null ? void 0 : headerLayoutConfig.layout) !== prevHeaderLayout;
15508
15792
  if (headerLayoutChanged && header) {
15509
15793
  const newHeaderElements = headerLayoutConfig ? buildHeaderWithLayout(config, headerLayoutConfig, {
@@ -15549,14 +15833,16 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15549
15833
  }
15550
15834
  }
15551
15835
  }
15552
- const showHeader = ((_t2 = config.layout) == null ? void 0 : _t2.showHeader) !== false;
15836
+ const showHeader = ((_v2 = config.layout) == null ? void 0 : _v2.showHeader) !== false;
15553
15837
  if (header) {
15554
15838
  header.style.display = showHeader ? "" : "none";
15555
15839
  }
15556
- const showFooter = ((_u2 = config.layout) == null ? void 0 : _u2.showFooter) !== false;
15840
+ const showFooter = ((_w2 = config.layout) == null ? void 0 : _w2.showFooter) !== false;
15557
15841
  if (footer) {
15558
15842
  footer.style.display = showFooter ? "" : "none";
15559
15843
  }
15844
+ updateScrollToBottomButtonOffset();
15845
+ syncScrollToBottomButton();
15560
15846
  const launcherEnabledChanged = launcherEnabled !== prevLauncherEnabled;
15561
15847
  const autoExpandChanged = autoExpand !== prevAutoExpand;
15562
15848
  if (launcherEnabledChanged) {
@@ -15575,20 +15861,20 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15575
15861
  refreshCloseButton();
15576
15862
  const toolCallConfigChanged = JSON.stringify(nextConfig.toolCall) !== JSON.stringify(previousToolCallConfig);
15577
15863
  const messageActionsChanged = JSON.stringify(config.messageActions) !== JSON.stringify(previousMessageActions);
15578
- const layoutMessagesChanged = JSON.stringify((_v2 = config.layout) == null ? void 0 : _v2.messages) !== JSON.stringify(previousLayoutMessages);
15579
- const loadingIndicatorChanged = ((_w2 = config.loadingIndicator) == null ? void 0 : _w2.render) !== (previousLoadingIndicator == null ? void 0 : previousLoadingIndicator.render) || ((_x2 = config.loadingIndicator) == null ? void 0 : _x2.renderIdle) !== (previousLoadingIndicator == null ? void 0 : previousLoadingIndicator.renderIdle) || ((_y2 = config.loadingIndicator) == null ? void 0 : _y2.showBubble) !== (previousLoadingIndicator == null ? void 0 : previousLoadingIndicator.showBubble);
15864
+ const layoutMessagesChanged = JSON.stringify((_x2 = config.layout) == null ? void 0 : _x2.messages) !== JSON.stringify(previousLayoutMessages);
15865
+ const loadingIndicatorChanged = ((_y2 = config.loadingIndicator) == null ? void 0 : _y2.render) !== (previousLoadingIndicator == null ? void 0 : previousLoadingIndicator.render) || ((_z2 = config.loadingIndicator) == null ? void 0 : _z2.renderIdle) !== (previousLoadingIndicator == null ? void 0 : previousLoadingIndicator.renderIdle) || ((_A2 = config.loadingIndicator) == null ? void 0 : _A2.showBubble) !== (previousLoadingIndicator == null ? void 0 : previousLoadingIndicator.showBubble);
15580
15866
  const iterationDisplayChanged = config.iterationDisplay !== previousIterationDisplay;
15581
15867
  const messagesConfigChanged = toolCallConfigChanged || messageActionsChanged || layoutMessagesChanged || loadingIndicatorChanged || iterationDisplayChanged;
15582
15868
  if (messagesConfigChanged && session) {
15583
15869
  configVersion++;
15584
15870
  renderMessagesWithPlugins(messagesWrapper, session.getMessages(), postprocess);
15585
15871
  }
15586
- const launcher = (_z2 = config.launcher) != null ? _z2 : {};
15587
- const headerIconHidden = (_A2 = launcher.headerIconHidden) != null ? _A2 : false;
15588
- const layoutShowIcon = (_C2 = (_B2 = config.layout) == null ? void 0 : _B2.header) == null ? void 0 : _C2.showIcon;
15872
+ const launcher = (_B2 = config.launcher) != null ? _B2 : {};
15873
+ const headerIconHidden = (_C2 = launcher.headerIconHidden) != null ? _C2 : false;
15874
+ const layoutShowIcon = (_E2 = (_D2 = config.layout) == null ? void 0 : _D2.header) == null ? void 0 : _E2.showIcon;
15589
15875
  const shouldHideIcon = headerIconHidden || layoutShowIcon === false;
15590
15876
  const headerIconName = launcher.headerIconName;
15591
- const headerIconSize = (_D2 = launcher.headerIconSize) != null ? _D2 : "48px";
15877
+ const headerIconSize = (_F2 = launcher.headerIconSize) != null ? _F2 : "48px";
15592
15878
  if (iconHolder) {
15593
15879
  const headerEl = container.querySelector(".persona-border-b-persona-divider");
15594
15880
  const headerCopy = headerEl == null ? void 0 : headerEl.querySelector(".persona-flex-col");
@@ -15615,7 +15901,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15615
15901
  if (iconSvg) {
15616
15902
  iconHolder.replaceChildren(iconSvg);
15617
15903
  } else {
15618
- iconHolder.textContent = (_E2 = launcher.agentIconText) != null ? _E2 : "\u{1F4AC}";
15904
+ iconHolder.textContent = (_G2 = launcher.agentIconText) != null ? _G2 : "\u{1F4AC}";
15619
15905
  }
15620
15906
  } else if (launcher.iconUrl) {
15621
15907
  const img2 = iconHolder.querySelector("img");
@@ -15638,7 +15924,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15638
15924
  if (existingSvg || existingImg) {
15639
15925
  iconHolder.replaceChildren();
15640
15926
  }
15641
- iconHolder.textContent = (_F2 = launcher.agentIconText) != null ? _F2 : "\u{1F4AC}";
15927
+ iconHolder.textContent = (_H2 = launcher.agentIconText) != null ? _H2 : "\u{1F4AC}";
15642
15928
  }
15643
15929
  const img = iconHolder.querySelector("img");
15644
15930
  if (img) {
@@ -15647,8 +15933,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15647
15933
  }
15648
15934
  }
15649
15935
  }
15650
- const layoutShowTitle = (_H2 = (_G2 = config.layout) == null ? void 0 : _G2.header) == null ? void 0 : _H2.showTitle;
15651
- const layoutShowSubtitle = (_J2 = (_I2 = config.layout) == null ? void 0 : _I2.header) == null ? void 0 : _J2.showSubtitle;
15936
+ const layoutShowTitle = (_J2 = (_I2 = config.layout) == null ? void 0 : _I2.header) == null ? void 0 : _J2.showTitle;
15937
+ const layoutShowSubtitle = (_L2 = (_K2 = config.layout) == null ? void 0 : _K2.header) == null ? void 0 : _L2.showSubtitle;
15652
15938
  if (headerTitle) {
15653
15939
  headerTitle.style.display = layoutShowTitle === false ? "none" : "";
15654
15940
  }
@@ -15656,14 +15942,14 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15656
15942
  headerSubtitle.style.display = layoutShowSubtitle === false ? "none" : "";
15657
15943
  }
15658
15944
  if (closeButton) {
15659
- const layoutShowCloseButton = (_L2 = (_K2 = config.layout) == null ? void 0 : _K2.header) == null ? void 0 : _L2.showCloseButton;
15945
+ const layoutShowCloseButton = (_N2 = (_M2 = config.layout) == null ? void 0 : _M2.header) == null ? void 0 : _N2.showCloseButton;
15660
15946
  if (layoutShowCloseButton === false) {
15661
15947
  closeButton.style.display = "none";
15662
15948
  } else {
15663
15949
  closeButton.style.display = "";
15664
15950
  }
15665
- const closeButtonSize = (_M = launcher.closeButtonSize) != null ? _M : "32px";
15666
- const closeButtonPlacement = (_N = launcher.closeButtonPlacement) != null ? _N : "inline";
15951
+ const closeButtonSize = (_O = launcher.closeButtonSize) != null ? _O : "32px";
15952
+ const closeButtonPlacement = (_P = launcher.closeButtonPlacement) != null ? _P : "inline";
15667
15953
  closeButton.style.height = closeButtonSize;
15668
15954
  closeButton.style.width = closeButtonSize;
15669
15955
  const { closeButtonWrapper } = panelElements;
@@ -15676,8 +15962,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15676
15962
  container.style.position = "relative";
15677
15963
  container.appendChild(closeButtonWrapper);
15678
15964
  } else {
15679
- const clearChatPlacement = (_P = (_O = launcher.clearChat) == null ? void 0 : _O.placement) != null ? _P : "inline";
15680
- const clearChatEnabled = (_R = (_Q = launcher.clearChat) == null ? void 0 : _Q.enabled) != null ? _R : true;
15965
+ const clearChatPlacement = (_R = (_Q = launcher.clearChat) == null ? void 0 : _Q.placement) != null ? _R : "inline";
15966
+ const clearChatEnabled = (_T = (_S = launcher.clearChat) == null ? void 0 : _S.enabled) != null ? _T : true;
15681
15967
  closeButtonWrapper.className = clearChatEnabled && clearChatPlacement === "inline" ? "" : "persona-ml-auto";
15682
15968
  const header2 = container.querySelector(".persona-border-b-persona-divider");
15683
15969
  if (header2) {
@@ -15723,8 +16009,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15723
16009
  closeButton.style.paddingTop = "";
15724
16010
  closeButton.style.paddingBottom = "";
15725
16011
  }
15726
- const closeButtonIconName = (_S = launcher.closeButtonIconName) != null ? _S : "x";
15727
- const closeButtonIconText = (_T = launcher.closeButtonIconText) != null ? _T : "\xD7";
16012
+ const closeButtonIconName = (_U = launcher.closeButtonIconName) != null ? _U : "x";
16013
+ const closeButtonIconText = (_V = launcher.closeButtonIconText) != null ? _V : "\xD7";
15728
16014
  closeButton.innerHTML = "";
15729
16015
  const iconSvg = renderLucideIcon(closeButtonIconName, "20px", "currentColor", 2);
15730
16016
  if (iconSvg) {
@@ -15732,8 +16018,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15732
16018
  } else {
15733
16019
  closeButton.textContent = closeButtonIconText;
15734
16020
  }
15735
- const closeButtonTooltipText = (_U = launcher.closeButtonTooltipText) != null ? _U : "Close chat";
15736
- const closeButtonShowTooltip = (_V = launcher.closeButtonShowTooltip) != null ? _V : true;
16021
+ const closeButtonTooltipText = (_W = launcher.closeButtonTooltipText) != null ? _W : "Close chat";
16022
+ const closeButtonShowTooltip = (_X = launcher.closeButtonShowTooltip) != null ? _X : true;
15737
16023
  closeButton.setAttribute("aria-label", closeButtonTooltipText);
15738
16024
  if (closeButtonWrapper) {
15739
16025
  if (closeButtonWrapper._cleanupTooltip) {
@@ -15789,11 +16075,11 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15789
16075
  }
15790
16076
  const { clearChatButton, clearChatButtonWrapper } = panelElements;
15791
16077
  if (clearChatButton) {
15792
- const clearChatConfig = (_W = launcher.clearChat) != null ? _W : {};
15793
- const clearChatEnabled = (_X = clearChatConfig.enabled) != null ? _X : true;
15794
- const layoutShowClearChat = (_Z = (_Y = config.layout) == null ? void 0 : _Y.header) == null ? void 0 : _Z.showClearChat;
16078
+ const clearChatConfig = (_Y = launcher.clearChat) != null ? _Y : {};
16079
+ const clearChatEnabled = (_Z = clearChatConfig.enabled) != null ? _Z : true;
16080
+ const layoutShowClearChat = (_$ = (__ = config.layout) == null ? void 0 : __.header) == null ? void 0 : _$.showClearChat;
15795
16081
  const shouldShowClearChat = layoutShowClearChat !== void 0 ? layoutShowClearChat : clearChatEnabled;
15796
- const clearChatPlacement = (__ = clearChatConfig.placement) != null ? __ : "inline";
16082
+ const clearChatPlacement = (_aa = clearChatConfig.placement) != null ? _aa : "inline";
15797
16083
  if (clearChatButtonWrapper) {
15798
16084
  clearChatButtonWrapper.style.display = shouldShowClearChat ? "" : "none";
15799
16085
  const { closeButtonWrapper } = panelElements;
@@ -15835,11 +16121,11 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15835
16121
  }
15836
16122
  }
15837
16123
  if (shouldShowClearChat) {
15838
- const clearChatSize = (_$ = clearChatConfig.size) != null ? _$ : "32px";
16124
+ const clearChatSize = (_ba = clearChatConfig.size) != null ? _ba : "32px";
15839
16125
  clearChatButton.style.height = clearChatSize;
15840
16126
  clearChatButton.style.width = clearChatSize;
15841
- const clearChatIconName = (_aa = clearChatConfig.iconName) != null ? _aa : "refresh-cw";
15842
- const clearChatIconColor = (_ba = clearChatConfig.iconColor) != null ? _ba : "";
16127
+ const clearChatIconName = (_ca = clearChatConfig.iconName) != null ? _ca : "refresh-cw";
16128
+ const clearChatIconColor = (_da = clearChatConfig.iconColor) != null ? _da : "";
15843
16129
  clearChatButton.style.color = clearChatIconColor || HEADER_THEME_CSS.actionIconColor;
15844
16130
  clearChatButton.innerHTML = "";
15845
16131
  const iconSvg = renderLucideIcon(clearChatIconName, "20px", "currentColor", 2);
@@ -15883,8 +16169,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15883
16169
  clearChatButton.style.paddingTop = "";
15884
16170
  clearChatButton.style.paddingBottom = "";
15885
16171
  }
15886
- const clearChatTooltipText = (_ca = clearChatConfig.tooltipText) != null ? _ca : "Clear chat";
15887
- const clearChatShowTooltip = (_da = clearChatConfig.showTooltip) != null ? _da : true;
16172
+ const clearChatTooltipText = (_ea = clearChatConfig.tooltipText) != null ? _ea : "Clear chat";
16173
+ const clearChatShowTooltip = (_fa = clearChatConfig.showTooltip) != null ? _fa : true;
15888
16174
  clearChatButton.setAttribute("aria-label", clearChatTooltipText);
15889
16175
  if (clearChatButtonWrapper) {
15890
16176
  if (clearChatButtonWrapper._cleanupTooltip) {
@@ -15959,9 +16245,9 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15959
16245
  suggestionsManager.render(config.suggestionChips, session, textarea, void 0, config.suggestionChipsConfig);
15960
16246
  updateCopy();
15961
16247
  setComposerDisabled(session.isStreaming());
15962
- const voiceRecognitionEnabled = ((_ea = config.voiceRecognition) == null ? void 0 : _ea.enabled) === true;
16248
+ const voiceRecognitionEnabled = ((_ga = config.voiceRecognition) == null ? void 0 : _ga.enabled) === true;
15963
16249
  const hasSpeechRecognition = typeof window !== "undefined" && (typeof window.webkitSpeechRecognition !== "undefined" || typeof window.SpeechRecognition !== "undefined");
15964
- const hasRuntypeProvider = ((_ga = (_fa = config.voiceRecognition) == null ? void 0 : _fa.provider) == null ? void 0 : _ga.type) === "runtype";
16250
+ const hasRuntypeProvider = ((_ia = (_ha = config.voiceRecognition) == null ? void 0 : _ha.provider) == null ? void 0 : _ia.type) === "runtype";
15965
16251
  const hasVoiceInput = hasSpeechRecognition || hasRuntypeProvider;
15966
16252
  if (voiceRecognitionEnabled && hasVoiceInput) {
15967
16253
  if (!micButton || !micButtonWrapper) {
@@ -15974,17 +16260,17 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15974
16260
  micButton.disabled = session.isStreaming();
15975
16261
  }
15976
16262
  } else {
15977
- const voiceConfig = (_ha = config.voiceRecognition) != null ? _ha : {};
15978
- const sendButtonConfig2 = (_ia = config.sendButton) != null ? _ia : {};
15979
- const micIconName = (_ja = voiceConfig.iconName) != null ? _ja : "mic";
15980
- const buttonSize2 = (_ka = sendButtonConfig2.size) != null ? _ka : "40px";
15981
- const micIconSize = (_la = voiceConfig.iconSize) != null ? _la : buttonSize2;
16263
+ const voiceConfig = (_ja = config.voiceRecognition) != null ? _ja : {};
16264
+ const sendButtonConfig2 = (_ka = config.sendButton) != null ? _ka : {};
16265
+ const micIconName = (_la = voiceConfig.iconName) != null ? _la : "mic";
16266
+ const buttonSize2 = (_ma = sendButtonConfig2.size) != null ? _ma : "40px";
16267
+ const micIconSize = (_na = voiceConfig.iconSize) != null ? _na : buttonSize2;
15982
16268
  const micIconSizeNum = parseFloat(micIconSize) || 24;
15983
16269
  micButton.style.width = micIconSize;
15984
16270
  micButton.style.height = micIconSize;
15985
16271
  micButton.style.minWidth = micIconSize;
15986
16272
  micButton.style.minHeight = micIconSize;
15987
- const iconColor = (_na = (_ma = voiceConfig.iconColor) != null ? _ma : sendButtonConfig2.textColor) != null ? _na : "currentColor";
16273
+ const iconColor = (_pa = (_oa = voiceConfig.iconColor) != null ? _oa : sendButtonConfig2.textColor) != null ? _pa : "currentColor";
15988
16274
  micButton.innerHTML = "";
15989
16275
  const micIconSvg = renderLucideIcon(micIconName, micIconSizeNum, iconColor, 2);
15990
16276
  if (micIconSvg) {
@@ -15992,7 +16278,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
15992
16278
  } else {
15993
16279
  micButton.textContent = "\u{1F3A4}";
15994
16280
  }
15995
- const backgroundColor2 = (_oa = voiceConfig.backgroundColor) != null ? _oa : sendButtonConfig2.backgroundColor;
16281
+ const backgroundColor2 = (_qa = voiceConfig.backgroundColor) != null ? _qa : sendButtonConfig2.backgroundColor;
15996
16282
  if (backgroundColor2) {
15997
16283
  micButton.style.backgroundColor = backgroundColor2;
15998
16284
  } else {
@@ -16030,8 +16316,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16030
16316
  micButton.style.paddingBottom = "";
16031
16317
  }
16032
16318
  const tooltip2 = micButtonWrapper == null ? void 0 : micButtonWrapper.querySelector(".persona-send-button-tooltip");
16033
- const tooltipText2 = (_pa = voiceConfig.tooltipText) != null ? _pa : "Start voice recognition";
16034
- const showTooltip2 = (_qa = voiceConfig.showTooltip) != null ? _qa : false;
16319
+ const tooltipText2 = (_ra = voiceConfig.tooltipText) != null ? _ra : "Start voice recognition";
16320
+ const showTooltip2 = (_sa = voiceConfig.showTooltip) != null ? _sa : false;
16035
16321
  if (showTooltip2 && tooltipText2) {
16036
16322
  if (!tooltip2) {
16037
16323
  const newTooltip = document.createElement("div");
@@ -16051,19 +16337,19 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16051
16337
  } else {
16052
16338
  if (micButton && micButtonWrapper) {
16053
16339
  micButtonWrapper.style.display = "none";
16054
- if (((_sa = (_ra = config.voiceRecognition) == null ? void 0 : _ra.provider) == null ? void 0 : _sa.type) === "runtype") {
16340
+ if (((_ua = (_ta = config.voiceRecognition) == null ? void 0 : _ta.provider) == null ? void 0 : _ua.type) === "runtype") {
16055
16341
  if (session.isVoiceActive()) session.toggleVoice();
16056
16342
  } else if (isRecording) {
16057
16343
  stopVoiceRecognition();
16058
16344
  }
16059
16345
  }
16060
16346
  }
16061
- const attachmentsEnabled = ((_ta = config.attachments) == null ? void 0 : _ta.enabled) === true;
16347
+ const attachmentsEnabled = ((_va = config.attachments) == null ? void 0 : _va.enabled) === true;
16062
16348
  if (attachmentsEnabled) {
16063
16349
  if (!attachmentButtonWrapper || !attachmentButton) {
16064
- const attachmentsConfig = (_ua = config.attachments) != null ? _ua : {};
16065
- const sendButtonConfig2 = (_va = config.sendButton) != null ? _va : {};
16066
- const buttonSize2 = (_wa = sendButtonConfig2.size) != null ? _wa : "40px";
16350
+ const attachmentsConfig = (_wa = config.attachments) != null ? _wa : {};
16351
+ const sendButtonConfig2 = (_xa = config.sendButton) != null ? _xa : {};
16352
+ const buttonSize2 = (_ya = sendButtonConfig2.size) != null ? _ya : "40px";
16067
16353
  if (!attachmentPreviewsContainer) {
16068
16354
  attachmentPreviewsContainer = createElement("div", "persona-attachment-previews persona-flex persona-flex-wrap persona-gap-2 persona-mb-2");
16069
16355
  attachmentPreviewsContainer.style.display = "none";
@@ -16072,8 +16358,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16072
16358
  if (!attachmentInput) {
16073
16359
  attachmentInput = document.createElement("input");
16074
16360
  attachmentInput.type = "file";
16075
- attachmentInput.accept = ((_xa = attachmentsConfig.allowedTypes) != null ? _xa : ALL_SUPPORTED_MIME_TYPES).join(",");
16076
- attachmentInput.multiple = ((_ya = attachmentsConfig.maxFiles) != null ? _ya : 4) > 1;
16361
+ attachmentInput.accept = ((_za = attachmentsConfig.allowedTypes) != null ? _za : ALL_SUPPORTED_MIME_TYPES).join(",");
16362
+ attachmentInput.multiple = ((_Aa = attachmentsConfig.maxFiles) != null ? _Aa : 4) > 1;
16077
16363
  attachmentInput.style.display = "none";
16078
16364
  attachmentInput.setAttribute("aria-label", "Attach files");
16079
16365
  composerForm.insertBefore(attachmentInput, textarea);
@@ -16084,8 +16370,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16084
16370
  "persona-rounded-button persona-flex persona-items-center persona-justify-center disabled:persona-opacity-50 persona-cursor-pointer persona-attachment-button"
16085
16371
  );
16086
16372
  attachmentButton.type = "button";
16087
- attachmentButton.setAttribute("aria-label", (_za = attachmentsConfig.buttonTooltipText) != null ? _za : "Attach file");
16088
- const attachIconName = (_Aa = attachmentsConfig.buttonIconName) != null ? _Aa : "paperclip";
16373
+ attachmentButton.setAttribute("aria-label", (_Ba = attachmentsConfig.buttonTooltipText) != null ? _Ba : "Attach file");
16374
+ const attachIconName = (_Ca = attachmentsConfig.buttonIconName) != null ? _Ca : "paperclip";
16089
16375
  const attachIconSize = buttonSize2;
16090
16376
  const buttonSizeNum = parseFloat(attachIconSize) || 40;
16091
16377
  const attachIconSizeNum = Math.round(buttonSizeNum * 0.6);
@@ -16117,7 +16403,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16117
16403
  attachmentInput == null ? void 0 : attachmentInput.click();
16118
16404
  });
16119
16405
  attachmentButtonWrapper.appendChild(attachmentButton);
16120
- const attachTooltipText = (_Ba = attachmentsConfig.buttonTooltipText) != null ? _Ba : "Attach file";
16406
+ const attachTooltipText = (_Da = attachmentsConfig.buttonTooltipText) != null ? _Da : "Attach file";
16121
16407
  const tooltip2 = createElement("div", "persona-send-button-tooltip");
16122
16408
  tooltip2.textContent = attachTooltipText;
16123
16409
  attachmentButtonWrapper.appendChild(tooltip2);
@@ -16134,10 +16420,10 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16134
16420
  }
16135
16421
  } else {
16136
16422
  attachmentButtonWrapper.style.display = "";
16137
- const attachmentsConfig = (_Ca = config.attachments) != null ? _Ca : {};
16423
+ const attachmentsConfig = (_Ea = config.attachments) != null ? _Ea : {};
16138
16424
  if (attachmentInput) {
16139
- attachmentInput.accept = ((_Da = attachmentsConfig.allowedTypes) != null ? _Da : ALL_SUPPORTED_MIME_TYPES).join(",");
16140
- attachmentInput.multiple = ((_Ea = attachmentsConfig.maxFiles) != null ? _Ea : 4) > 1;
16425
+ attachmentInput.accept = ((_Fa = attachmentsConfig.allowedTypes) != null ? _Fa : ALL_SUPPORTED_MIME_TYPES).join(",");
16426
+ attachmentInput.multiple = ((_Ga = attachmentsConfig.maxFiles) != null ? _Ga : 4) > 1;
16141
16427
  }
16142
16428
  if (attachmentManager) {
16143
16429
  attachmentManager.updateConfig({
@@ -16155,13 +16441,13 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16155
16441
  attachmentManager.clearAttachments();
16156
16442
  }
16157
16443
  }
16158
- const sendButtonConfig = (_Fa = config.sendButton) != null ? _Fa : {};
16159
- const useIcon = (_Ga = sendButtonConfig.useIcon) != null ? _Ga : false;
16160
- const iconText = (_Ha = sendButtonConfig.iconText) != null ? _Ha : "\u2191";
16444
+ const sendButtonConfig = (_Ha = config.sendButton) != null ? _Ha : {};
16445
+ const useIcon = (_Ia = sendButtonConfig.useIcon) != null ? _Ia : false;
16446
+ const iconText = (_Ja = sendButtonConfig.iconText) != null ? _Ja : "\u2191";
16161
16447
  const iconName = sendButtonConfig.iconName;
16162
- const tooltipText = (_Ia = sendButtonConfig.tooltipText) != null ? _Ia : "Send message";
16163
- const showTooltip = (_Ja = sendButtonConfig.showTooltip) != null ? _Ja : false;
16164
- const buttonSize = (_Ka = sendButtonConfig.size) != null ? _Ka : "40px";
16448
+ const tooltipText = (_Ka = sendButtonConfig.tooltipText) != null ? _Ka : "Send message";
16449
+ const showTooltip = (_La = sendButtonConfig.showTooltip) != null ? _La : false;
16450
+ const buttonSize = (_Ma = sendButtonConfig.size) != null ? _Ma : "40px";
16165
16451
  const backgroundColor = sendButtonConfig.backgroundColor;
16166
16452
  const textColor = sendButtonConfig.textColor;
16167
16453
  if (useIcon) {
@@ -16198,7 +16484,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16198
16484
  sendButton.classList.add("persona-bg-persona-primary");
16199
16485
  }
16200
16486
  } else {
16201
- sendButton.textContent = (_Ma = (_La = config.copy) == null ? void 0 : _La.sendButtonLabel) != null ? _Ma : "Send";
16487
+ sendButton.textContent = (_Oa = (_Na = config.copy) == null ? void 0 : _Na.sendButtonLabel) != null ? _Oa : "Send";
16202
16488
  sendButton.style.width = "";
16203
16489
  sendButton.style.height = "";
16204
16490
  sendButton.style.minWidth = "";
@@ -16258,7 +16544,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16258
16544
  } else if (tooltip) {
16259
16545
  tooltip.style.display = "none";
16260
16546
  }
16261
- const updatedContentMaxWidth = (_Na = config.layout) == null ? void 0 : _Na.contentMaxWidth;
16547
+ const updatedContentMaxWidth = (_Pa = config.layout) == null ? void 0 : _Pa.contentMaxWidth;
16262
16548
  if (updatedContentMaxWidth) {
16263
16549
  messagesWrapper.style.maxWidth = updatedContentMaxWidth;
16264
16550
  messagesWrapper.style.marginLeft = "auto";
@@ -16280,8 +16566,8 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16280
16566
  composerForm.style.marginRight = "";
16281
16567
  }
16282
16568
  }
16283
- const statusIndicatorConfig = (_Oa = config.statusIndicator) != null ? _Oa : {};
16284
- const isVisible = (_Pa = statusIndicatorConfig.visible) != null ? _Pa : true;
16569
+ const statusIndicatorConfig = (_Qa = config.statusIndicator) != null ? _Qa : {};
16570
+ const isVisible = (_Ra = statusIndicatorConfig.visible) != null ? _Ra : true;
16285
16571
  statusText.style.display = isVisible ? "" : "none";
16286
16572
  if (session) {
16287
16573
  const currentStatus = session.getStatus();
@@ -16635,7 +16921,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16635
16921
  }
16636
16922
  }
16637
16923
  };
16638
- const shouldExposeDebugApi = ((_G = runtimeOptions == null ? void 0 : runtimeOptions.debugTools) != null ? _G : false) || Boolean(config.debug);
16924
+ const shouldExposeDebugApi = ((_I = runtimeOptions == null ? void 0 : runtimeOptions.debugTools) != null ? _I : false) || Boolean(config.debug);
16639
16925
  if (shouldExposeDebugApi && typeof window !== "undefined") {
16640
16926
  const previousDebug = window.AgentWidgetBrowser;
16641
16927
  const debugApi = {
@@ -16738,9 +17024,9 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16738
17024
  const voiceKey = `${persistConfig.keyPrefix}widget-voice`;
16739
17025
  const voiceModeKey = `${persistConfig.keyPrefix}widget-voice-mode`;
16740
17026
  if (storage) {
16741
- const wasOpen = ((_H = persistConfig.persist) == null ? void 0 : _H.openState) && storage.getItem(openKey) === "true";
16742
- const wasVoiceActive = ((_I = persistConfig.persist) == null ? void 0 : _I.voiceState) && storage.getItem(voiceKey) === "true";
16743
- const wasInVoiceMode = ((_J = persistConfig.persist) == null ? void 0 : _J.voiceState) && storage.getItem(voiceModeKey) === "true";
17027
+ const wasOpen = ((_J = persistConfig.persist) == null ? void 0 : _J.openState) && storage.getItem(openKey) === "true";
17028
+ const wasVoiceActive = ((_K = persistConfig.persist) == null ? void 0 : _K.voiceState) && storage.getItem(voiceKey) === "true";
17029
+ const wasInVoiceMode = ((_L = persistConfig.persist) == null ? void 0 : _L.voiceState) && storage.getItem(voiceModeKey) === "true";
16744
17030
  if (wasOpen) {
16745
17031
  setTimeout(() => {
16746
17032
  controller.open();
@@ -16757,7 +17043,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16757
17043
  }, 100);
16758
17044
  }, 0);
16759
17045
  }
16760
- if ((_K = persistConfig.persist) == null ? void 0 : _K.openState) {
17046
+ if ((_M = persistConfig.persist) == null ? void 0 : _M.openState) {
16761
17047
  eventBus.on("widget:opened", () => {
16762
17048
  storage.setItem(openKey, "true");
16763
17049
  });
@@ -16765,7 +17051,7 @@ var createAgentExperience = (mount, initialConfig, runtimeOptions) => {
16765
17051
  storage.setItem(openKey, "false");
16766
17052
  });
16767
17053
  }
16768
- if ((_L = persistConfig.persist) == null ? void 0 : _L.voiceState) {
17054
+ if ((_N = persistConfig.persist) == null ? void 0 : _N.voiceState) {
16769
17055
  eventBus.on("voice:state", (event) => {
16770
17056
  storage.setItem(voiceKey, event.active ? "true" : "false");
16771
17057
  });
@@ -17684,6 +17970,7 @@ function createThemePreview(container, initialOptions) {
17684
17970
  ROLE_INTENSITIES,
17685
17971
  ROLE_LINKS_FOCUS,
17686
17972
  ROLE_PRIMARY_ACTIONS,
17973
+ ROLE_SCROLL_TO_BOTTOM,
17687
17974
  ROLE_SURFACES,
17688
17975
  ROLE_USER_MESSAGES,
17689
17976
  SEMANTIC_COLORS_SECTION,