@syntrologie/adapt-chatbot 2.8.0-canary.62 → 2.8.0-canary.621

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.
Files changed (250) hide show
  1. package/dist/AdaptiveChatBar.composer.test.d.ts +2 -0
  2. package/dist/AdaptiveChatBar.composer.test.d.ts.map +1 -0
  3. package/dist/AdaptiveChatBar.d.ts +248 -0
  4. package/dist/AdaptiveChatBar.d.ts.map +1 -0
  5. package/dist/AdaptiveChatBar.interleave.test.d.ts +9 -0
  6. package/dist/AdaptiveChatBar.interleave.test.d.ts.map +1 -0
  7. package/dist/AdaptiveChatBar.js +12 -0
  8. package/dist/AdaptiveChatBar.js.map +7 -0
  9. package/dist/AdaptiveChatBarMountable.d.ts +93 -0
  10. package/dist/AdaptiveChatBarMountable.d.ts.map +1 -0
  11. package/dist/AdaptiveChatTrail.anchor-scroll.test.d.ts +2 -0
  12. package/dist/AdaptiveChatTrail.anchor-scroll.test.d.ts.map +1 -0
  13. package/dist/AdaptiveChatTrail.d.ts +539 -0
  14. package/dist/AdaptiveChatTrail.d.ts.map +1 -0
  15. package/dist/AdaptiveChatTrail.follow-bottom.test.d.ts +2 -0
  16. package/dist/AdaptiveChatTrail.follow-bottom.test.d.ts.map +1 -0
  17. package/dist/AdaptiveChatTrail.js +12 -0
  18. package/dist/AdaptiveChatTrail.js.map +7 -0
  19. package/dist/AdaptiveChatTrail.live-region.test.d.ts +2 -0
  20. package/dist/AdaptiveChatTrail.live-region.test.d.ts.map +1 -0
  21. package/dist/AdaptiveChatTrail.test.d.ts +2 -0
  22. package/dist/AdaptiveChatTrail.test.d.ts.map +1 -0
  23. package/dist/AdaptiveChipsStrip.d.ts +1156 -0
  24. package/dist/AdaptiveChipsStrip.d.ts.map +1 -0
  25. package/dist/AdaptiveChipsStrip.js +11 -0
  26. package/dist/AdaptiveChipsStrip.js.map +7 -0
  27. package/dist/AdaptiveChipsStripMountable.d.ts +24 -0
  28. package/dist/AdaptiveChipsStripMountable.d.ts.map +1 -0
  29. package/dist/ChatAssistantLit.d.ts +64 -0
  30. package/dist/ChatAssistantLit.d.ts.map +1 -0
  31. package/dist/ChatAssistantLit.js +14 -0
  32. package/dist/ChatAssistantLit.js.map +7 -0
  33. package/dist/ChatSession.d.ts +275 -0
  34. package/dist/ChatSession.d.ts.map +1 -0
  35. package/dist/ChatTransport.d.ts +448 -0
  36. package/dist/ChatTransport.d.ts.map +1 -0
  37. package/dist/InlineRegistryWidgetMount.test.d.ts +2 -0
  38. package/dist/InlineRegistryWidgetMount.test.d.ts.map +1 -0
  39. package/dist/InlineWidgetLiveMount.test.d.ts +2 -0
  40. package/dist/InlineWidgetLiveMount.test.d.ts.map +1 -0
  41. package/dist/LeaveAMessage.leadconnector.integration.test.d.ts +2 -0
  42. package/dist/LeaveAMessage.leadconnector.integration.test.d.ts.map +1 -0
  43. package/dist/LeaveAMessageLit.d.ts +329 -0
  44. package/dist/LeaveAMessageLit.d.ts.map +1 -0
  45. package/dist/LeaveAMessageLit.test.d.ts +2 -0
  46. package/dist/LeaveAMessageLit.test.d.ts.map +1 -0
  47. package/dist/LeaveAMessageMountable.test.d.ts +2 -0
  48. package/dist/LeaveAMessageMountable.test.d.ts.map +1 -0
  49. package/dist/NavLinkMountable.d.ts +25 -0
  50. package/dist/NavLinkMountable.d.ts.map +1 -0
  51. package/dist/NavLinkMountable.test.d.ts +2 -0
  52. package/dist/NavLinkMountable.test.d.ts.map +1 -0
  53. package/dist/TextAnswerMountable.d.ts +17 -0
  54. package/dist/TextAnswerMountable.d.ts.map +1 -0
  55. package/dist/TextAnswerMountable.test.d.ts +2 -0
  56. package/dist/TextAnswerMountable.test.d.ts.map +1 -0
  57. package/dist/Turnstile.d.ts +101 -0
  58. package/dist/Turnstile.d.ts.map +1 -0
  59. package/dist/cdn.d.ts +16 -8
  60. package/dist/cdn.d.ts.map +1 -1
  61. package/dist/chunk-4V5L7IRV.js +4711 -0
  62. package/dist/chunk-4V5L7IRV.js.map +7 -0
  63. package/dist/chunk-EWPPVPJ4.js +14 -0
  64. package/dist/chunk-EWPPVPJ4.js.map +7 -0
  65. package/dist/chunk-HD2NXGYO.js +8445 -0
  66. package/dist/chunk-HD2NXGYO.js.map +7 -0
  67. package/dist/chunk-HV52LYST.js +641 -0
  68. package/dist/chunk-HV52LYST.js.map +7 -0
  69. package/dist/chunk-LY5AGXVD.js +21 -0
  70. package/dist/chunk-LY5AGXVD.js.map +7 -0
  71. package/dist/chunk-T6VEDUXD.js +694 -0
  72. package/dist/chunk-T6VEDUXD.js.map +7 -0
  73. package/dist/chunk-UFTSEIQP.js +1877 -0
  74. package/dist/chunk-UFTSEIQP.js.map +7 -0
  75. package/dist/chunk-VIRIVP7H.js +898 -0
  76. package/dist/chunk-VIRIVP7H.js.map +7 -0
  77. package/dist/chunk-YFZCMLV6.js +4078 -0
  78. package/dist/chunk-YFZCMLV6.js.map +7 -0
  79. package/dist/editor-lit.d.ts +37 -0
  80. package/dist/editor-lit.d.ts.map +1 -0
  81. package/dist/editor-lit.js +134 -0
  82. package/dist/editor-lit.js.map +7 -0
  83. package/dist/editorToken.d.ts +23 -0
  84. package/dist/editorToken.d.ts.map +1 -0
  85. package/dist/element-session.d.ts +3 -0
  86. package/dist/element-session.d.ts.map +1 -0
  87. package/dist/element-session.js +9 -0
  88. package/dist/element-session.js.map +7 -0
  89. package/dist/elements/ActionHandler.d.ts +34 -0
  90. package/dist/elements/ActionHandler.d.ts.map +1 -0
  91. package/dist/elements/ElementInstanceStore.d.ts +232 -0
  92. package/dist/elements/ElementInstanceStore.d.ts.map +1 -0
  93. package/dist/elements/ElementInstanceStore.test.d.ts +2 -0
  94. package/dist/elements/ElementInstanceStore.test.d.ts.map +1 -0
  95. package/dist/elements/ElementSessionController.d.ts +37 -0
  96. package/dist/elements/ElementSessionController.d.ts.map +1 -0
  97. package/dist/elements/ElementSessionController.test.d.ts +2 -0
  98. package/dist/elements/ElementSessionController.test.d.ts.map +1 -0
  99. package/dist/elements/ElementTypeHandler.d.ts +77 -0
  100. package/dist/elements/ElementTypeHandler.d.ts.map +1 -0
  101. package/dist/elements/ItemHandler.d.ts +60 -0
  102. package/dist/elements/ItemHandler.d.ts.map +1 -0
  103. package/dist/elements/ItemHandler.test.d.ts +2 -0
  104. package/dist/elements/ItemHandler.test.d.ts.map +1 -0
  105. package/dist/elements/TileHandler.d.ts +52 -0
  106. package/dist/elements/TileHandler.d.ts.map +1 -0
  107. package/dist/elements/TileHandler.test.d.ts +2 -0
  108. package/dist/elements/TileHandler.test.d.ts.map +1 -0
  109. package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts +2 -0
  110. package/dist/elements/__tests__/ElementInstanceStore.recall.test.d.ts.map +1 -0
  111. package/dist/elements/blockRenderer.d.ts +46 -0
  112. package/dist/elements/blockRenderer.d.ts.map +1 -0
  113. package/dist/elements/blockRenderer.test.d.ts +13 -0
  114. package/dist/elements/blockRenderer.test.d.ts.map +1 -0
  115. package/dist/elements/blocks.d.ts +58 -0
  116. package/dist/elements/blocks.d.ts.map +1 -0
  117. package/dist/elements/createElementStore.d.ts +11 -0
  118. package/dist/elements/createElementStore.d.ts.map +1 -0
  119. package/dist/elements/envelope.d.ts +24 -0
  120. package/dist/elements/envelope.d.ts.map +1 -0
  121. package/dist/elements/fetcher.d.ts +43 -0
  122. package/dist/elements/fetcher.d.ts.map +1 -0
  123. package/dist/elements/index.d.ts +33 -0
  124. package/dist/elements/index.d.ts.map +1 -0
  125. package/dist/elements/store-singleton.d.ts +4 -0
  126. package/dist/elements/store-singleton.d.ts.map +1 -0
  127. package/dist/elements/tileLifecycleProps.d.ts +13 -0
  128. package/dist/elements/tileLifecycleProps.d.ts.map +1 -0
  129. package/dist/elements/types.d.ts +117 -0
  130. package/dist/elements/types.d.ts.map +1 -0
  131. package/dist/findSmartCanvas.d.ts +19 -0
  132. package/dist/findSmartCanvas.d.ts.map +1 -0
  133. package/dist/hostAgentController.d.ts +65 -0
  134. package/dist/hostAgentController.d.ts.map +1 -0
  135. package/dist/hostAgentController.test.d.ts +2 -0
  136. package/dist/hostAgentController.test.d.ts.map +1 -0
  137. package/dist/observer/__tests__/allowlist.test.d.ts +9 -0
  138. package/dist/observer/__tests__/allowlist.test.d.ts.map +1 -0
  139. package/dist/observer/__tests__/bus-translate.test.d.ts +16 -0
  140. package/dist/observer/__tests__/bus-translate.test.d.ts.map +1 -0
  141. package/dist/observer/__tests__/detector-observation-contract.test.d.ts +25 -0
  142. package/dist/observer/__tests__/detector-observation-contract.test.d.ts.map +1 -0
  143. package/dist/observer/__tests__/lifecycle.test.d.ts +2 -0
  144. package/dist/observer/__tests__/lifecycle.test.d.ts.map +1 -0
  145. package/dist/observer/__tests__/observer-enrich.test.d.ts +10 -0
  146. package/dist/observer/__tests__/observer-enrich.test.d.ts.map +1 -0
  147. package/dist/observer/__tests__/observer-isolation.test.d.ts +13 -0
  148. package/dist/observer/__tests__/observer-isolation.test.d.ts.map +1 -0
  149. package/dist/observer/__tests__/queue.test.d.ts +2 -0
  150. package/dist/observer/__tests__/queue.test.d.ts.map +1 -0
  151. package/dist/observer/__tests__/transport.test.d.ts +2 -0
  152. package/dist/observer/__tests__/transport.test.d.ts.map +1 -0
  153. package/dist/observer/allowlist.d.ts +32 -0
  154. package/dist/observer/allowlist.d.ts.map +1 -0
  155. package/dist/observer/bus-translate.d.ts +33 -0
  156. package/dist/observer/bus-translate.d.ts.map +1 -0
  157. package/dist/observer/index.d.ts +44 -0
  158. package/dist/observer/index.d.ts.map +1 -0
  159. package/dist/observer/queue.d.ts +63 -0
  160. package/dist/observer/queue.d.ts.map +1 -0
  161. package/dist/observer/transport.d.ts +27 -0
  162. package/dist/observer/transport.d.ts.map +1 -0
  163. package/dist/observer/wire.d.ts +54 -0
  164. package/dist/observer/wire.d.ts.map +1 -0
  165. package/dist/observer/wire.test.d.ts +2 -0
  166. package/dist/observer/wire.test.d.ts.map +1 -0
  167. package/dist/personas.d.ts +30 -0
  168. package/dist/personas.d.ts.map +1 -0
  169. package/dist/runtime-lit.d.ts +8 -0
  170. package/dist/runtime-lit.d.ts.map +1 -0
  171. package/dist/runtime.d.ts +63 -5
  172. package/dist/runtime.d.ts.map +1 -1
  173. package/dist/runtime.js +4439 -28
  174. package/dist/runtime.js.map +7 -0
  175. package/dist/schema.d.ts +3688 -11
  176. package/dist/schema.d.ts.map +1 -1
  177. package/dist/schema.js +578 -30
  178. package/dist/schema.js.map +7 -0
  179. package/dist/support-chat/__tests__/lc-fetch-stub.d.ts +52 -0
  180. package/dist/support-chat/__tests__/lc-fetch-stub.d.ts.map +1 -0
  181. package/dist/support-chat/boot.d.ts +47 -0
  182. package/dist/support-chat/boot.d.ts.map +1 -0
  183. package/dist/support-chat/boot.test.d.ts +2 -0
  184. package/dist/support-chat/boot.test.d.ts.map +1 -0
  185. package/dist/support-chat/crisp.d.ts +4 -0
  186. package/dist/support-chat/crisp.d.ts.map +1 -0
  187. package/dist/support-chat/crisp.test.d.ts +2 -0
  188. package/dist/support-chat/crisp.test.d.ts.map +1 -0
  189. package/dist/support-chat/inbox.d.ts +57 -0
  190. package/dist/support-chat/inbox.d.ts.map +1 -0
  191. package/dist/support-chat/inbox.test.d.ts +2 -0
  192. package/dist/support-chat/inbox.test.d.ts.map +1 -0
  193. package/dist/support-chat/leadconnector.d.ts +13 -0
  194. package/dist/support-chat/leadconnector.d.ts.map +1 -0
  195. package/dist/support-chat/leadconnector.test.d.ts +2 -0
  196. package/dist/support-chat/leadconnector.test.d.ts.map +1 -0
  197. package/dist/support-chat/registry.d.ts +5 -0
  198. package/dist/support-chat/registry.d.ts.map +1 -0
  199. package/dist/support-chat/registry.test.d.ts +2 -0
  200. package/dist/support-chat/registry.test.d.ts.map +1 -0
  201. package/dist/support-chat/schema-widgetid.test.d.ts +2 -0
  202. package/dist/support-chat/schema-widgetid.test.d.ts.map +1 -0
  203. package/dist/support-chat/types.d.ts +19 -0
  204. package/dist/support-chat/types.d.ts.map +1 -0
  205. package/dist/test/setup.d.ts +1 -0
  206. package/dist/test/setup.d.ts.map +1 -0
  207. package/dist/types.d.ts +89 -40
  208. package/dist/types.d.ts.map +1 -1
  209. package/package.json +49 -24
  210. package/dist/ChatAssistant.d.ts +0 -18
  211. package/dist/ChatAssistant.d.ts.map +0 -1
  212. package/dist/ChatAssistant.js +0 -178
  213. package/dist/SyntroChatbot.d.ts +0 -14
  214. package/dist/SyntroChatbot.d.ts.map +0 -1
  215. package/dist/SyntroChatbot.js +0 -56
  216. package/dist/actionParser.d.ts +0 -15
  217. package/dist/actionParser.d.ts.map +0 -1
  218. package/dist/actionParser.js +0 -52
  219. package/dist/apiClient.d.ts +0 -23
  220. package/dist/apiClient.d.ts.map +0 -1
  221. package/dist/apiClient.js +0 -51
  222. package/dist/cdn.js +0 -37
  223. package/dist/editor.d.ts +0 -17
  224. package/dist/editor.d.ts.map +0 -1
  225. package/dist/editor.js +0 -36
  226. package/dist/tools/bridge.d.ts +0 -26
  227. package/dist/tools/bridge.d.ts.map +0 -1
  228. package/dist/tools/bridge.js +0 -25
  229. package/dist/tools/expanders.d.ts +0 -17
  230. package/dist/tools/expanders.d.ts.map +0 -1
  231. package/dist/tools/expanders.js +0 -41
  232. package/dist/tools/index.d.ts +0 -14
  233. package/dist/tools/index.d.ts.map +0 -1
  234. package/dist/tools/index.js +0 -11
  235. package/dist/tools/registrations/GetContextTool.d.ts +0 -7
  236. package/dist/tools/registrations/GetContextTool.d.ts.map +0 -1
  237. package/dist/tools/registrations/GetContextTool.js +0 -18
  238. package/dist/tools/registrations/ScrollToTool.d.ts +0 -7
  239. package/dist/tools/registrations/ScrollToTool.d.ts.map +0 -1
  240. package/dist/tools/registrations/ScrollToTool.js +0 -38
  241. package/dist/tools/registrations/ShowOverlayTool.d.ts +0 -7
  242. package/dist/tools/registrations/ShowOverlayTool.d.ts.map +0 -1
  243. package/dist/tools/registrations/ShowOverlayTool.js +0 -47
  244. package/dist/tools/registrations/index.d.ts +0 -19
  245. package/dist/tools/registrations/index.d.ts.map +0 -1
  246. package/dist/tools/registrations/index.js +0 -7
  247. package/dist/types.js +0 -6
  248. package/dist/useChat.d.ts +0 -25
  249. package/dist/useChat.d.ts.map +0 -1
  250. package/dist/useChat.js +0 -106
@@ -0,0 +1,694 @@
1
+ import {
2
+ getElementInstanceStore
3
+ } from "./chunk-EWPPVPJ4.js";
4
+ import {
5
+ createDictation,
6
+ isDictationSupported
7
+ } from "./chunk-YFZCMLV6.js";
8
+ import {
9
+ __privateAdd,
10
+ __privateGet
11
+ } from "./chunk-LY5AGXVD.js";
12
+
13
+ // src/AdaptiveChatBar.ts
14
+ import { html, LitElement, nothing, svg } from "lit";
15
+ import { styleMap } from "lit/directives/style-map.js";
16
+
17
+ // src/personas.ts
18
+ var STORAGE_KEY = "syntro:persona";
19
+ function pickPersona(roster) {
20
+ if (!Array.isArray(roster) || roster.length === 0) return null;
21
+ let storedId = null;
22
+ try {
23
+ storedId = localStorage.getItem(STORAGE_KEY);
24
+ } catch {
25
+ }
26
+ const stored = storedId ? roster.find((p) => p.id === storedId) : void 0;
27
+ if (stored) return stored;
28
+ const pick = roster[Math.floor(Math.random() * roster.length)];
29
+ try {
30
+ localStorage.setItem(STORAGE_KEY, pick.id);
31
+ } catch {
32
+ }
33
+ return pick;
34
+ }
35
+
36
+ // src/AdaptiveChatBar.ts
37
+ var DEFAULT_PLACEHOLDER = "Ask, find, or navigate\u2026";
38
+ var DEFAULT_ASSISTANT_NAME = "Assistant";
39
+ var _AdaptiveChatBar_instances, trailVisible_get;
40
+ var AdaptiveChatBar = class extends LitElement {
41
+ constructor() {
42
+ super(...arguments);
43
+ __privateAdd(this, _AdaptiveChatBar_instances);
44
+ this.messages = [];
45
+ /**
46
+ * Mirrored from the chat session by the mountable. The bar keeps no
47
+ * counter of its own — this is the number of sends already committed;
48
+ * a send this bar makes opens turn `this.turn + 1`.
49
+ */
50
+ this.turn = 0;
51
+ this.maximized = false;
52
+ /** Preview frames: shows the given messages, accepts no input. */
53
+ this.readOnly = false;
54
+ /**
55
+ * Which trailing control the bar renders.
56
+ *
57
+ * An explicit literal, never inferred from the presence of a prop: a canvas
58
+ * that forgot to inject it would otherwise silently get the wrong control.
59
+ * Default keeps velvet's behaviour untouched.
60
+ */
61
+ this.chatControl = "maximize";
62
+ /** Reflected state for the interleave control. Owned by the canvas. */
63
+ this.interleaved = false;
64
+ this.tileReceipts = [];
65
+ /** Widgets rendered inline in the trail (reco carousel), sourced from
66
+ * the store's `chat-inline` slot mounts. Forwarded to the trail. */
67
+ this.inlineWidgets = [];
68
+ /** Registry-backed mounter for inline widgets whose id is not their
69
+ * custom-element tag (product card, comparison, FAQ). Set by the
70
+ * mountable from `runtime.widgets`; forwarded to the trail. */
71
+ this.mountInlineWidget = void 0;
72
+ /**
73
+ * Live reasoning narration from the model — streamed in via
74
+ * AG-UI THINKING_TEXT_MESSAGE_CONTENT events and forwarded by
75
+ * the ChatSession subscription on the host (mountable).
76
+ * Forwarded verbatim to the trail, which renders it in place of
77
+ * the silent loading dots between turns. Empty string when no
78
+ * thinking turn is active.
79
+ */
80
+ this.thinkingText = "";
81
+ /**
82
+ * Pre-conversation suggestion button — forwarded to the trail's
83
+ * empty-state pane. When the visitor clicks it the trail emits
84
+ * `trail-intro-suggestion`; we catch that here and submit the
85
+ * configured prompt through the normal send path.
86
+ */
87
+ this.introSuggestion = void 0;
88
+ /** Pass-through to {@link AdaptiveChatTrail}'s ``forceExpanded`` prop.
89
+ * Hosts that mount the chat-bar in a full-screen surface (mobile
90
+ * panel, agent app, etc.) set this to skip the collapse affordance
91
+ * — there is no smaller state to fall back to. */
92
+ this.forceExpanded = false;
93
+ this.placeholder = DEFAULT_PLACEHOLDER;
94
+ /**
95
+ * Name shown in the (forceExpanded) header. Defaults to a generic
96
+ * "Assistant". Hosts can override per-workspace (e.g. Vela sets
97
+ * "Vela Concierge") without inventing new SDK surface — it threads
98
+ * through the same mount config the placeholder does.
99
+ */
100
+ this.assistantName = DEFAULT_ASSISTANT_NAME;
101
+ /** Persona roster from config (FEAT-1784917430); one is sticky-assigned. */
102
+ this.personas = null;
103
+ /** @internal — the visitor's sticky persona, resolved from the roster. */
104
+ this._persona = null;
105
+ /**
106
+ * Initial assistant message shown before any real conversation
107
+ * starts. Renders inside the trail as a phantom assistant chip
108
+ * when messages.length === 0; auto-disappears as soon as the
109
+ * first user message lands. Mirrors ChatAssistantLit's greeting.
110
+ */
111
+ this.greeting = void 0;
112
+ /**
113
+ * Whether a chat round-trip is in flight (request sent, awaiting
114
+ * reply). The single send/stop button morphs accordingly: ↑ when
115
+ * ready, ⏹ when in-flight. Parent owns this state — set true after
116
+ * `chat-message-sent` fires, false when the reply lands or the
117
+ * request is aborted. Enter is inert while in-flight.
118
+ */
119
+ this.inFlight = false;
120
+ /** Show a dictation mic when the Web Speech API is available. Config-gated, default off. */
121
+ this.voiceInput = false;
122
+ this._input = "";
123
+ this._micListening = false;
124
+ this._micDisabled = false;
125
+ this._micBase = "";
126
+ this._micNetworkErrors = 0;
127
+ this._dictation = null;
128
+ /** True while focus is inside the composer row — drives the accent
129
+ * focus ring so the active text-entry surface is unmistakable on any
130
+ * theme (the idle pill is deliberately subtle). */
131
+ this._composerFocused = false;
132
+ // Host-level styling (display, width, height, flex, etc.) is owned
133
+ // by the container — SDK shadow root provides default rules, panel
134
+ // overrides via design tokens (--sc-chat-bar-host-*). This adaptive
135
+ // never sets inline styles on itself. See SmartCanvasElementLit's
136
+ // static styles for the rule.
137
+ this._onInput = (e) => {
138
+ if (this._micListening) this._dictation?.stop();
139
+ this._input = e.target.value;
140
+ };
141
+ this._onMicClick = () => {
142
+ if (this._micListening) {
143
+ this._dictation?.stop();
144
+ return;
145
+ }
146
+ this._micBase = this._input;
147
+ this._dictation = createDictation({
148
+ onTranscript: (text) => {
149
+ this._micNetworkErrors = 0;
150
+ this._input = this._micBase + (this._micBase ? " " : "") + text;
151
+ },
152
+ onEnd: () => {
153
+ this._micListening = false;
154
+ },
155
+ onError: (code) => {
156
+ this._micListening = false;
157
+ if (code === "not-allowed") this._micDisabled = true;
158
+ if (code === "network" && ++this._micNetworkErrors >= 2) this._micDisabled = true;
159
+ }
160
+ });
161
+ this._dictation.start();
162
+ this._micListening = this._dictation.listening;
163
+ };
164
+ this._onKeyDown = (e) => {
165
+ if (e.key === "Enter" && !e.shiftKey) {
166
+ e.preventDefault();
167
+ if (this.readOnly || this.inFlight) return;
168
+ this._send();
169
+ }
170
+ };
171
+ // Single button. Click delegates to send-or-interrupt based on
172
+ // current state. Same DOM node, different behavior — discoverability
173
+ // wins from the user not having to scan for which control is active.
174
+ this._onSendOrInterrupt = () => {
175
+ if (this.readOnly) return;
176
+ if (this.inFlight) {
177
+ this._queuedSuggestedReply = null;
178
+ this.dispatchEvent(new CustomEvent("chat-interrupt", { bubbles: true, composed: true }));
179
+ return;
180
+ }
181
+ this._send();
182
+ };
183
+ this._onTileReceiptActivate = (e) => {
184
+ const { instanceId } = e.detail;
185
+ getElementInstanceStore()?.recreate(instanceId);
186
+ this.dispatchEvent(
187
+ new CustomEvent("tile-recall", { detail: { instanceId }, bubbles: true, composed: true })
188
+ );
189
+ };
190
+ this._onAlertReceiptActivate = (e) => {
191
+ const { instanceId } = e.detail;
192
+ this.dispatchEvent(
193
+ new CustomEvent("alert-recall", { detail: { instanceId }, bubbles: true, composed: true })
194
+ );
195
+ };
196
+ this._onComposerFocusIn = () => {
197
+ this._composerFocused = true;
198
+ };
199
+ this._onComposerFocusOut = () => {
200
+ this._composerFocused = false;
201
+ };
202
+ this._onMaximizeToggle = () => {
203
+ this.dispatchEvent(new CustomEvent("chat-maximize-toggle", { bubbles: true, composed: true }));
204
+ };
205
+ this._onInterleaveToggle = () => {
206
+ this.dispatchEvent(
207
+ new CustomEvent("chat-interleave-toggle", { bubbles: true, composed: true })
208
+ );
209
+ };
210
+ /**
211
+ * Visitor tapped the intro suggestion button in the empty-state
212
+ * trail. Submit the configured prompt through the same channel as
213
+ * a typed message so listeners (mountable → chatSession.send) see
214
+ * a uniform shape — no need for a parallel "suggestion-sent" path.
215
+ * The trail's intro pane auto-disappears the moment the first
216
+ * message lands, so this also closes the empty state in one go.
217
+ */
218
+ this._onIntroSuggestion = (e) => {
219
+ const detail = e.detail;
220
+ if (!detail?.prompt) return;
221
+ e.stopPropagation();
222
+ if (this.inFlight) return;
223
+ this.inFlight = true;
224
+ this._dispatchSent(detail.prompt, "intro_suggestion");
225
+ };
226
+ /**
227
+ * Reply-chip tap that arrived during the run TAIL. Chips render the
228
+ * moment the reply text lands, but `inFlight` (which includes
229
+ * `runActive` — typing events, tool tail, RUN_FINISHED) can lag for
230
+ * seconds. The old `if (this.inFlight) return;` guard silently ATE
231
+ * those taps — the visitor's chosen reply never appeared as their
232
+ * message (live repro, deployed vela 2026-07-08). Now the tap queues
233
+ * (latest wins) and dispatches when `inFlight` clears.
234
+ */
235
+ this._queuedSuggestedReply = null;
236
+ /**
237
+ * Visitor tapped an inline `suggest_replies` chip in the trail. Submit
238
+ * the chip text through the SAME `chat-message-sent` channel a typed
239
+ * message uses, so the reply rides the existing send path (mountable →
240
+ * chatSession.send → transport) — no fabricated AG-UI events. The
241
+ * trail clears the chips on its own once the reply lands and a newer
242
+ * assistant turn becomes the latest.
243
+ *
244
+ * A tap while the previous run is still closing is QUEUED, never
245
+ * dropped — see `_queuedSuggestedReply`.
246
+ */
247
+ this._onSuggestedReply = (e) => {
248
+ const detail = e.detail;
249
+ if (!detail?.text) return;
250
+ e.stopPropagation();
251
+ if (this.inFlight) {
252
+ this._queuedSuggestedReply = detail.text;
253
+ return;
254
+ }
255
+ this.inFlight = true;
256
+ this._dispatchSent(detail.text, "pill");
257
+ };
258
+ }
259
+ createRenderRoot() {
260
+ return this;
261
+ }
262
+ connectedCallback() {
263
+ super.connectedCallback();
264
+ this.addEventListener("tile-receipt-activate", this._onTileReceiptActivate);
265
+ this.addEventListener("alert-receipt-activate", this._onAlertReceiptActivate);
266
+ }
267
+ disconnectedCallback() {
268
+ super.disconnectedCallback();
269
+ this.removeEventListener("tile-receipt-activate", this._onTileReceiptActivate);
270
+ this.removeEventListener("alert-receipt-activate", this._onAlertReceiptActivate);
271
+ }
272
+ /** The one channel every send path uses; `turn` is the turn this send opens. */
273
+ _dispatchSent(text, via) {
274
+ this.dispatchEvent(
275
+ new CustomEvent("chat-message-sent", {
276
+ detail: { text, via, turn: this.turn + 1 },
277
+ bubbles: true,
278
+ composed: true
279
+ })
280
+ );
281
+ }
282
+ _send() {
283
+ if (this.readOnly) return;
284
+ if (this._micListening) this._dictation?.stop();
285
+ const text = this._input.trim();
286
+ if (!text) return;
287
+ this._queuedSuggestedReply = null;
288
+ this._dispatchSent(text, "typed");
289
+ this._input = "";
290
+ const input = this.querySelector("input[data-chat-input]");
291
+ if (input) input.value = "";
292
+ }
293
+ willUpdate(changed) {
294
+ super.willUpdate?.(changed);
295
+ if (changed.has("personas")) {
296
+ this._persona = pickPersona(this.personas);
297
+ }
298
+ if (changed.has("inFlight") && changed.get("inFlight") === true && !this.inFlight && this._queuedSuggestedReply) {
299
+ const text = this._queuedSuggestedReply;
300
+ this._queuedSuggestedReply = null;
301
+ this.inFlight = true;
302
+ this._dispatchSent(text, "pill");
303
+ }
304
+ }
305
+ render() {
306
+ return html`
307
+ <div style=${styleMap(rootStyles(this.forceExpanded))}>
308
+ ${this.forceExpanded && __privateGet(this, _AdaptiveChatBar_instances, trailVisible_get) ? renderHeader(this.assistantName, this._persona) : nothing}
309
+ ${__privateGet(this, _AdaptiveChatBar_instances, trailVisible_get) ? html`<adaptive-chat-trail
310
+ .messages=${this.messages}
311
+ .greeting=${this._persona?.intro_line ?? this.greeting}
312
+ .forceExpanded=${this.forceExpanded}
313
+ .inFlight=${this.inFlight}
314
+ .thinkingText=${this.thinkingText}
315
+ .personaName=${this._persona?.name ?? ""}
316
+ .personaAvatarSm=${this._persona?.avatar?.sm ?? ""}
317
+ .introSuggestion=${this.introSuggestion}
318
+ .tileReceipts=${this.tileReceipts}
319
+ .inlineWidgets=${this.inlineWidgets}
320
+ .mountInlineWidget=${this.mountInlineWidget}
321
+ @trail-intro-suggestion=${this._onIntroSuggestion}
322
+ @trail-suggested-reply=${this._onSuggestedReply}
323
+ ></adaptive-chat-trail>` : nothing}
324
+ <div
325
+ style=${styleMap(rowStyles(this.forceExpanded, this._composerFocused))}
326
+ data-chat-row
327
+ @focusin=${this._onComposerFocusIn}
328
+ @focusout=${this._onComposerFocusOut}
329
+ >
330
+ ${this.readOnly ? nothing : this.chatControl === "interleave" ? html`<button
331
+ type="button"
332
+ data-chat-interleave
333
+ @click=${this._onInterleaveToggle}
334
+ aria-label=${this.interleaved ? "Hide the conversation" : "Show the conversation"}
335
+ title=${this.interleaved ? "Hide the conversation" : "Show the conversation"}
336
+ aria-pressed=${this.interleaved ? "true" : "false"}
337
+ style=${styleMap(maximizeStyles(this.interleaved))}
338
+ >${this.interleaved ? TRANSCRIPT_ON_ICON : TRANSCRIPT_OFF_ICON}</button>` : html`<button
339
+ type="button"
340
+ data-chat-maximize
341
+ @click=${this._onMaximizeToggle}
342
+ aria-label=${this.maximized ? "Exit full screen" : "Maximize chat"}
343
+ title=${this.maximized ? "Exit full screen" : "Maximize"}
344
+ aria-pressed=${this.maximized ? "true" : "false"}
345
+ style=${styleMap(maximizeStyles(this.maximized))}
346
+ >${this.maximized ? MINIMIZE_ICON : MAXIMIZE_ICON}</button>`}
347
+ <input
348
+ data-chat-input
349
+ ?disabled=${this.readOnly}
350
+ type="text"
351
+ placeholder=${this._micListening ? "Listening \u2014 tap the mic to stop" : this.placeholder}
352
+ .value=${this._input}
353
+ @input=${this._onInput}
354
+ @keydown=${this._onKeyDown}
355
+ style=${styleMap(inputStyles())}
356
+ aria-label="Chat input"
357
+ />
358
+ ${this.voiceInput && !this.readOnly && isDictationSupported() ? html`${MIC_RING_STYLES}<button
359
+ type="button"
360
+ data-chat-mic
361
+ data-listening=${this._micListening ? "true" : "false"}
362
+ ?disabled=${this._micDisabled}
363
+ @click=${this._onMicClick}
364
+ aria-pressed=${this._micListening ? "true" : "false"}
365
+ aria-label=${this._micListening ? "Stop dictation" : "Start dictation"}
366
+ title=${this._micDisabled ? "Microphone blocked" : this._micListening ? "Stop dictation" : "Dictate"}
367
+ style=${styleMap(micStyles(this._micListening, this._micDisabled))}
368
+ >${MIC_ICON}</button>` : nothing}
369
+ <button
370
+ type="button"
371
+ data-chat-send
372
+ ?disabled=${this.readOnly}
373
+ data-state=${this.inFlight ? "in-flight" : "ready"}
374
+ @click=${this._onSendOrInterrupt}
375
+ aria-label=${this.inFlight ? "Stop" : "Send message"}
376
+ title=${this.inFlight ? "Interrupt" : "Send"}
377
+ style=${styleMap(sendStyles(this.inFlight))}
378
+ >${this.inFlight ? "\u25A0" : "\u2191"}</button>
379
+ </div>
380
+ </div>
381
+ `;
382
+ }
383
+ };
384
+ _AdaptiveChatBar_instances = new WeakSet();
385
+ trailVisible_get = function() {
386
+ return this.chatControl !== "interleave" || this.interleaved;
387
+ };
388
+ AdaptiveChatBar.properties = {
389
+ personas: { attribute: false },
390
+ _persona: { state: true },
391
+ messages: { attribute: false },
392
+ placeholder: { type: String },
393
+ assistantName: { type: String },
394
+ greeting: { type: String },
395
+ inFlight: { type: Boolean, reflect: true },
396
+ turn: { type: Number },
397
+ thinkingText: { attribute: false },
398
+ introSuggestion: { attribute: false },
399
+ forceExpanded: { type: Boolean, reflect: true },
400
+ maximized: { type: Boolean },
401
+ readOnly: { type: Boolean, attribute: "read-only" },
402
+ chatControl: { type: String },
403
+ interleaved: { type: Boolean },
404
+ tileReceipts: { attribute: false },
405
+ inlineWidgets: { attribute: false },
406
+ mountInlineWidget: { attribute: false },
407
+ voiceInput: { type: Boolean },
408
+ _input: { state: true },
409
+ _composerFocused: { state: true },
410
+ _micListening: { state: true },
411
+ _micDisabled: { state: true }
412
+ };
413
+ function rootStyles(forceExpanded) {
414
+ if (!forceExpanded) {
415
+ return {
416
+ display: "flex",
417
+ flexDirection: "column",
418
+ gap: "6px",
419
+ width: "100%",
420
+ pointerEvents: "auto"
421
+ };
422
+ }
423
+ return {
424
+ position: "relative",
425
+ display: "flex",
426
+ flexDirection: "column",
427
+ gap: "8px",
428
+ width: "100%",
429
+ height: "100%",
430
+ boxSizing: "border-box",
431
+ flex: "1 1 auto",
432
+ minHeight: "0",
433
+ overflow: "hidden",
434
+ pointerEvents: "auto",
435
+ background: "var(--sc-tile-background, rgba(255, 255, 255, 0.92))",
436
+ border: "var(--sc-tile-border, 1px solid rgba(0, 0, 0, 0.06))",
437
+ borderRadius: "var(--sc-tile-border-radius, 14px)",
438
+ boxShadow: "var(--sc-tile-shadow, 0 12px 32px -16px rgba(0, 0, 0, 0.18))",
439
+ // Reserves room for the absolute-positioned input pill (36px high
440
+ // + 12px from bottom) plus a 16px visual gap above the input.
441
+ padding: "0.75rem 0.75rem calc(36px + 1.75rem)",
442
+ color: "var(--sc-tile-title-color, inherit)",
443
+ fontFamily: "var(--sc-font-family, inherit)",
444
+ // Override the trail's host-layout tokens so the trail (a flex item
445
+ // of this column) fills a definite-height parent AND contributes its
446
+ // content height in an indefinite one. basis AUTO (not 0) is
447
+ // load-bearing: grow:1 still fills a full-screen panel, but basis auto
448
+ // also lets the trail's content height propagate up the fill chain so a
449
+ // SHRINK-WRAP host (velvet's bottom sheet) hugs the content with no void.
450
+ // A basis-0 layer anywhere in the chain reports 0 min-content and
451
+ // collapses the sheet to header+input. shrink:1 + min-height:0 still lets
452
+ // the trail yield first when space is tight (input is absolute-pinned).
453
+ // The SDK-level rule in SmartCanvasElementLit consumes these tokens on
454
+ // adaptive-chat-trail's host element. Containers OWN host styling
455
+ // via tokens; the adaptive never sets inline styles on its host.
456
+ ["--sc-chat-trail-host-display"]: "flex",
457
+ ["--sc-chat-trail-host-flex-direction"]: "column",
458
+ ["--sc-chat-trail-host-flex"]: "1 1 auto",
459
+ ["--sc-chat-trail-host-min-height"]: "0",
460
+ ["--sc-chat-trail-host-overflow"]: "hidden"
461
+ };
462
+ }
463
+ var COMPOSER_FOCUS_BORDER = "1px solid hsl(var(--sc-accent-color) / 0.6)";
464
+ function rowStyles(forceExpanded, focused) {
465
+ if (forceExpanded) {
466
+ return {
467
+ position: "absolute",
468
+ left: "0.75rem",
469
+ right: "0.75rem",
470
+ bottom: "0.75rem",
471
+ display: "flex",
472
+ alignItems: "center",
473
+ gap: "8px",
474
+ padding: "6px 14px",
475
+ borderRadius: "9999px",
476
+ background: "var(--sc-chat-composer-background, color-mix(in srgb, currentColor 8%, transparent))",
477
+ border: focused ? COMPOSER_FOCUS_BORDER : "1px solid var(--sc-chat-composer-border, color-mix(in srgb, currentColor 22%, transparent))",
478
+ color: "var(--sc-content-text-color, inherit)",
479
+ fontFamily: "var(--sc-font-family, inherit)",
480
+ minHeight: "36px"
481
+ };
482
+ }
483
+ return {
484
+ display: "flex",
485
+ alignItems: "center",
486
+ gap: "8px",
487
+ padding: "10px 12px",
488
+ borderRadius: "var(--sc-tile-border-radius, 14px)",
489
+ background: "var(--sc-tile-background, rgba(15, 19, 24, 0.6))",
490
+ backdropFilter: "var(--sc-chat-bar-blur, blur(24px) saturate(140%))",
491
+ WebkitBackdropFilter: "var(--sc-chat-bar-blur, blur(24px) saturate(140%))",
492
+ border: focused ? COMPOSER_FOCUS_BORDER : "var(--sc-tile-border, 1px solid rgba(255, 255, 255, 0.08))",
493
+ boxShadow: "var(--sc-tile-shadow, 0 2px 12px rgba(0, 0, 0, 0.3))",
494
+ color: "var(--sc-tile-title-color, #fafafa)",
495
+ fontFamily: "var(--sc-font-family, inherit)"
496
+ };
497
+ }
498
+ var MIC_ICON = svg`<svg viewBox="0 0 16 16" width="16" height="16" fill="none" aria-hidden="true"><rect x="6" y="1.5" width="4" height="8" rx="2" stroke="currentColor" stroke-width="1.6"></rect><path d="M3.5 7.5a4.5 4.5 0 0 0 9 0M8 12v2.5" stroke="currentColor" stroke-width="1.6" stroke-linecap="round"></path></svg>`;
499
+ function micStyles(listening, disabled) {
500
+ return {
501
+ display: "inline-flex",
502
+ "align-items": "center",
503
+ "justify-content": "center",
504
+ width: "32px",
505
+ height: "32px",
506
+ border: "none",
507
+ "border-radius": "50%",
508
+ // Listening is a MODE: the mic flips to a filled primary chip with a
509
+ // ripple ring (MIC_RING_STYLES) so recording is unmissable, and the
510
+ // input placeholder says how to end it.
511
+ background: listening ? "var(--sc-color-primary, #6a59ce)" : "transparent",
512
+ color: listening ? "var(--sc-color-primary-text, var(--sc-accent-foreground, #ffffff))" : "currentColor",
513
+ opacity: disabled ? "0.3" : listening ? "1" : "0.65",
514
+ cursor: disabled ? "not-allowed" : "pointer",
515
+ transition: "color 150ms ease, background 150ms ease, opacity 150ms ease",
516
+ "flex-shrink": "0"
517
+ };
518
+ }
519
+ var MIC_RING_STYLES = html`<style>
520
+ [data-chat-mic][data-listening='true'] {
521
+ animation: sc-chatbar-mic-ring 1.5s ease-out infinite;
522
+ }
523
+ @keyframes sc-chatbar-mic-ring {
524
+ 0% {
525
+ box-shadow: 0 0 0 0 color-mix(in srgb, var(--sc-color-primary, #6a59ce) 45%, transparent);
526
+ transform: scale(1);
527
+ }
528
+ 50% { transform: scale(1.08); }
529
+ 70% { box-shadow: 0 0 0 12px transparent; }
530
+ 100% {
531
+ box-shadow: 0 0 0 0 transparent;
532
+ transform: scale(1);
533
+ }
534
+ }
535
+ @media (prefers-reduced-motion: reduce) {
536
+ [data-chat-mic][data-listening='true'] {
537
+ animation: none;
538
+ box-shadow: 0 0 0 3px color-mix(in srgb, var(--sc-color-primary, #6a59ce) 35%, transparent);
539
+ }
540
+ }
541
+ </style>`;
542
+ var MAXIMIZE_ICON = svg`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="15 3 21 3 21 9"></polyline><polyline points="9 21 3 21 3 15"></polyline><line x1="21" y1="3" x2="14" y2="10"></line><line x1="3" y1="21" x2="10" y2="14"></line></svg>`;
543
+ var TRANSCRIPT_OFF_ICON = svg`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"></path></svg>`;
544
+ var TRANSCRIPT_ON_ICON = svg`<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 11.5a8.38 8.38 0 0 1-.9 3.8 8.5 8.5 0 0 1-7.6 4.7 8.38 8.38 0 0 1-3.8-.9L3 21l1.9-5.7a8.38 8.38 0 0 1-.9-3.8 8.5 8.5 0 0 1 4.7-7.6 8.38 8.38 0 0 1 3.8-.9h.5a8.48 8.48 0 0 1 8 8v.5z"></path></svg>`;
545
+ var MINIMIZE_ICON = svg`<svg viewBox="0 0 24 24" width="16" height="16" fill="none" stroke="currentColor" stroke-width="2.25" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="4 14 10 14 10 20"></polyline><polyline points="20 10 14 10 14 4"></polyline><line x1="14" y1="10" x2="21" y2="3"></line><line x1="3" y1="21" x2="10" y2="14"></line></svg>`;
546
+ function maximizeStyles(maximized) {
547
+ return {
548
+ display: "inline-flex",
549
+ alignItems: "center",
550
+ justifyContent: "center",
551
+ width: "32px",
552
+ height: "32px",
553
+ borderRadius: "9999px",
554
+ // Active (maximized): filled accent chip. Idle: subtle accent chip with a
555
+ // visible ring. Colour is full-opacity in both states (no 0.95 ghosting).
556
+ background: maximized ? "hsl(var(--sc-accent-color) / 0.85)" : "hsl(var(--sc-accent-color) / 0.15)",
557
+ border: maximized ? "none" : "1px solid hsl(var(--sc-accent-color) / 0.45)",
558
+ color: maximized ? "var(--sc-accent-foreground, #fff)" : "hsl(var(--sc-accent-color))",
559
+ flexShrink: "0",
560
+ lineHeight: "1",
561
+ padding: "0",
562
+ cursor: "pointer",
563
+ transition: "background 150ms ease, color 150ms ease, border-color 150ms ease"
564
+ };
565
+ }
566
+ function inputStyles() {
567
+ return {
568
+ flex: "1",
569
+ minWidth: "0",
570
+ background: "transparent",
571
+ border: "none",
572
+ outline: "none",
573
+ color: "inherit",
574
+ // MUST be >= 16px. iOS Safari auto-zooms the page when a focused input has a
575
+ // font-size below 16px, then does NOT zoom back out on blur — so the composer
576
+ // zoomed in, the input ended up behind the keyboard (the zoom breaks the
577
+ // visualViewport keyboard-lift math), and tapping "Done" left the whole site
578
+ // stuck zoomed in. 16px is the standard, accessibility-safe fix (no
579
+ // user-scalable=no / maximum-scale hacks that would kill pinch-zoom).
580
+ fontSize: "16px",
581
+ // WCAG 2.2 AA, 2.5.8 — every pointer target is at least 24x24 CSS px, and
582
+ // an input's own box is what gets measured, not the bar it sits inside
583
+ // (BUG-1787284957: the manual keyboard walk measured 278x20 while the bar
584
+ // around it looked perfectly comfortable). A bare 16px input's line box is
585
+ // ~20px, so the floor has to be declared.
586
+ //
587
+ // Painted height is UNCHANGED in both composer variants: the pinned pill
588
+ // is already `min-height: 36px` with 6px block padding (24 + 12 = 36,
589
+ // exactly the floor it was already holding), and the floating row's
590
+ // tallest child is the 32px mic.
591
+ //
592
+ // The fallback is what carries the guarantee, and only for the UNSET case:
593
+ // a workspace that never publishes --sc-chat-input-min-height gets 24px and
594
+ // meets AA. A workspace that DOES publish it can set anything, including a
595
+ // value below 24 — CSS has no floor to enforce here. Catching that belongs
596
+ // at authoring time, in `validate-config.mjs` alongside the contrast
597
+ // warnings, per the repo's validators-at-authoring-time law; tracked
598
+ // follow-up, not something this declaration can promise.
599
+ minHeight: "var(--sc-chat-input-min-height, 24px)"
600
+ };
601
+ }
602
+ function sendStyles(inFlight) {
603
+ return {
604
+ width: "28px",
605
+ height: "28px",
606
+ display: "inline-flex",
607
+ alignItems: "center",
608
+ justifyContent: "center",
609
+ borderRadius: "9999px",
610
+ // Ready: filled accent (send is the affordance). In-flight: hollow
611
+ // ring + accent ring (stop is a one-of-a-kind disruptive action,
612
+ // styled differently so the user reads "this isn't just send").
613
+ background: inFlight ? "transparent" : "hsl(var(--sc-accent-color) / 0.85)",
614
+ color: inFlight ? "hsl(var(--sc-accent-color) / 0.95)" : "var(--sc-accent-foreground, #fff)",
615
+ border: inFlight ? "1px solid hsl(var(--sc-accent-color) / 0.55)" : "none",
616
+ cursor: "pointer",
617
+ flexShrink: "0",
618
+ transition: "background 150ms ease, color 150ms ease, border-color 150ms ease"
619
+ };
620
+ }
621
+ function renderHeader(assistantName, persona) {
622
+ const headerStyles = {
623
+ // Container-owned visibility: velvet's collapsed strip (V3 tight +
624
+ // deck focus) sets --sc-chat-bar-header-display: none so the strip is
625
+ // JUST the text entry (the header painted over the absolute-pinned
626
+ // input when the region was clamped to the strip height). Expanded
627
+ // chat keeps the header — the AI-disclosure microline must stay
628
+ // wherever a conversation is actually visible.
629
+ display: "var(--sc-chat-bar-header-display, flex)",
630
+ alignItems: "center",
631
+ gap: "7px",
632
+ // Halved vertical footprint: 6px total block padding vs the old 16px
633
+ // (4px top + 12px bottom). Horizontal padding unchanged.
634
+ padding: "3px 4px",
635
+ borderBottom: "1px solid var(--sc-content-divider-color, rgba(0, 0, 0, 0.08))",
636
+ flex: "0 0 auto"
637
+ };
638
+ const avatar = {
639
+ display: "inline-flex",
640
+ alignItems: "center",
641
+ justifyContent: "center",
642
+ width: "16px",
643
+ height: "16px",
644
+ borderRadius: "9999px",
645
+ background: "var(--sc-tile-icon-background, linear-gradient(135deg, var(--sc-color-primary, #5faf7d) 0%, var(--sc-color-primary-hover, #3d8a5e) 100%))",
646
+ color: "#fff",
647
+ flexShrink: "0",
648
+ fontSize: "9px",
649
+ lineHeight: "1"
650
+ };
651
+ const name = {
652
+ fontSize: "0.8rem",
653
+ fontWeight: "600",
654
+ color: "var(--sc-content-text-color, inherit)",
655
+ lineHeight: "1.2",
656
+ flexShrink: "0"
657
+ };
658
+ const personaImg = {
659
+ width: "22px",
660
+ height: "22px",
661
+ borderRadius: "9999px",
662
+ objectFit: "cover",
663
+ flexShrink: "0"
664
+ };
665
+ const disclosure = {
666
+ fontSize: "0.62rem",
667
+ fontWeight: "500",
668
+ color: "var(--sc-content-text-color, inherit)",
669
+ opacity: "0.55",
670
+ lineHeight: "1.2",
671
+ flexShrink: "0"
672
+ };
673
+ return html`
674
+ <div style=${styleMap(headerStyles)} data-chat-header>
675
+ ${persona?.avatar?.md || persona?.avatar?.sm ? html`<img
676
+ style=${styleMap(personaImg)}
677
+ src=${persona.avatar.md ?? persona.avatar.sm ?? ""}
678
+ alt=""
679
+ data-persona-avatar
680
+ />` : html`<span style=${styleMap(avatar)} aria-hidden="true">✦</span>`}
681
+ <span style=${styleMap(name)} data-persona-name>${persona?.name ?? assistantName}</span>
682
+ ${persona ? html`<span style=${styleMap(disclosure)} data-persona-disclosure>· AI concierge</span>` : nothing}
683
+ </div>
684
+ `;
685
+ }
686
+ if (!customElements.get("adaptive-chat-bar")) {
687
+ customElements.define("adaptive-chat-bar", AdaptiveChatBar);
688
+ }
689
+
690
+ export {
691
+ pickPersona,
692
+ AdaptiveChatBar
693
+ };
694
+ //# sourceMappingURL=chunk-T6VEDUXD.js.map