@mgamadeus/ddd-agents 0.1.0-alpha.22 → 0.1.0-alpha.23

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 (143) hide show
  1. package/README.md +3 -2
  2. package/dist/chat.js +22 -72
  3. package/dist/chat.js.map +1 -1
  4. package/dist/chunks/{ConversationMarkdown-W7NHglmL.js → ConversationMarkdown-CJhAnuVa.js} +110 -8
  5. package/dist/chunks/ConversationMarkdown-CJhAnuVa.js.map +1 -0
  6. package/dist/chunks/{WebSearchResultsConversationWidget-BvnLWHyi.js → WebSearchResultsConversationWidget-DRBQvycE.js} +140 -1125
  7. package/dist/chunks/WebSearchResultsConversationWidget-DRBQvycE.js.map +1 -0
  8. package/dist/chunks/{canvasBodies-9SuF6NAB.js → canvasBodies-DLjDkviP.js} +9 -6
  9. package/dist/chunks/canvasBodies-DLjDkviP.js.map +1 -0
  10. package/dist/chunks/{canvas-behaviours-BRFR1ALE.js → decide-canvas-open-DBWoWtAC.js} +18 -2
  11. package/dist/chunks/decide-canvas-open-DBWoWtAC.js.map +1 -0
  12. package/dist/chunks/entity-detail-name-3A82gDAp.js +15 -0
  13. package/dist/chunks/entity-detail-name-3A82gDAp.js.map +1 -0
  14. package/dist/chunks/icon-names-Di6c4zLo.js +86 -0
  15. package/dist/chunks/icon-names-Di6c4zLo.js.map +1 -0
  16. package/dist/chunks/index-7Qc_3GbG.js +1046 -0
  17. package/dist/chunks/index-7Qc_3GbG.js.map +1 -0
  18. package/dist/chunks/{widget-image-readiness-signal-DeOuL89j.js → widget-image-readiness-signal-D3ci53xr.js} +2 -2
  19. package/dist/chunks/{widget-image-readiness-signal-DeOuL89j.js.map → widget-image-readiness-signal-D3ci53xr.js.map} +1 -1
  20. package/dist/chunks/{widget-name-resolver-DyIY6Zu4.js → widget-name-resolver-C8SfpiR5.js} +48 -116
  21. package/dist/chunks/widget-name-resolver-C8SfpiR5.js.map +1 -0
  22. package/dist/client-testing.js +68 -1
  23. package/dist/client-testing.js.map +1 -1
  24. package/dist/files/chat/Conversation.module.scss +268 -0
  25. package/dist/files/chat/ConversationViewBody/ConversationViewBody.module.scss +336 -0
  26. package/dist/files/chat/_conversation-tokens.scss +37 -0
  27. package/dist/files/image-render/WidgetImageRender.module.scss +22 -0
  28. package/dist/files/kit/ComposedViewConversationWidget.md +59 -0
  29. package/dist/files/kit/components/data/data.preview-fixtures.json +3298 -0
  30. package/dist/files/kit/components/embedding/widget.preview-fixtures.json +147 -0
  31. package/dist/files/kit/components/entity/entity-link.preview-fixtures.json +340 -0
  32. package/dist/files/kit/components/form/form.preview-fixtures.json +319 -0
  33. package/dist/files/kit/components/inputs/button.preview-fixtures.json +301 -0
  34. package/dist/files/kit/components/inputs/checkbox.preview-fixtures.json +35 -0
  35. package/dist/files/kit/components/inputs/date-picker.preview-fixtures.json +36 -0
  36. package/dist/files/kit/components/inputs/input.preview-fixtures.json +55 -0
  37. package/dist/files/kit/components/inputs/radio-group.preview-fixtures.json +76 -0
  38. package/dist/files/kit/components/inputs/select.preview-fixtures.json +314 -0
  39. package/dist/files/kit/components/inputs/slider.preview-fixtures.json +178 -0
  40. package/dist/files/kit/components/inputs/tabs.preview-fixtures.json +304 -0
  41. package/dist/files/kit/components/inputs/textarea.preview-fixtures.json +37 -0
  42. package/dist/files/kit/components/layout/layout.preview-fixtures.json +892 -0
  43. package/dist/files/kit/components/map/map.preview-fixtures.json +339 -0
  44. package/dist/files/kit/components/media/image-group.preview-fixtures.json +228 -0
  45. package/dist/files/kit/components/media/image.preview-fixtures.json +61 -0
  46. package/dist/files/kit/components/media/video-card/video-card.preview-fixtures.json +121 -0
  47. package/dist/files/kit/components/media/video.preview-fixtures.json +68 -0
  48. package/dist/files/kit/components/rich/code.preview-fixtures.json +105 -0
  49. package/dist/files/kit/components/rich/diagram.preview-fixtures.json +89 -0
  50. package/dist/files/kit/components/rich/math.preview-fixtures.json +152 -0
  51. package/dist/files/kit/components/rich/svg.preview-fixtures.json +243 -0
  52. package/dist/files/kit/components/text/badge.preview-fixtures.json +44 -0
  53. package/dist/files/kit/components/text/caption.preview-fixtures.json +31 -0
  54. package/dist/files/kit/components/text/favicon.preview-fixtures.json +69 -0
  55. package/dist/files/kit/components/text/label.preview-fixtures.json +48 -0
  56. package/dist/files/kit/components/text/link.preview-fixtures.json +103 -0
  57. package/dist/files/kit/components/text/markdown.preview-fixtures.json +29 -0
  58. package/dist/files/kit/components/text/source-ref.preview-fixtures.json +51 -0
  59. package/dist/files/kit/components/text/text.preview-fixtures.json +106 -0
  60. package/dist/files/kit/components/text/title.preview-fixtures.json +172 -0
  61. package/dist/files/kit/composed-view-widget-contract.json +88 -0
  62. package/dist/files/kit/composed-view.preview-fixtures.json +376 -0
  63. package/dist/files/renderer/conversation-widget-layout.module.scss +47 -0
  64. package/dist/files/renderer/widget-tree/composed-node-schema.json +3428 -0
  65. package/dist/files/styles/_conversation-widget-container.scss +6 -0
  66. package/dist/files/styles/_media.scss +50 -0
  67. package/dist/files/styles/_spacings.scss +23 -0
  68. package/dist/files/styles/_surfaces.scss +28 -0
  69. package/dist/files/widgets/ClockConversationWidget/ClockConversationWidget.md +53 -0
  70. package/dist/files/widgets/ClockConversationWidget/clock.preview-fixtures.json +76 -0
  71. package/dist/files/widgets/ConceptExplainerConversationWidget/ConceptExplainerConversationWidget.md +86 -0
  72. package/dist/files/widgets/ConceptExplainerConversationWidget/concept-explainer.preview-fixtures.json +23 -0
  73. package/dist/files/widgets/ConversationSearchResultsConversationWidget/ConversationSearchResultsConversationWidget.md +59 -0
  74. package/dist/files/widgets/ConversationSearchResultsConversationWidget/conversation-search-results.preview-fixtures.json +85 -0
  75. package/dist/files/widgets/CurrencyConverterConversationWidget/CurrencyConverterConversationWidget.md +51 -0
  76. package/dist/files/widgets/CurrencyConverterConversationWidget/currency-converter.preview-fixtures.json +73 -0
  77. package/dist/files/widgets/CustomVisualizationConversationWidget/CustomVisualizationConversationWidget.md +83 -0
  78. package/dist/files/widgets/CustomVisualizationConversationWidget/custom-visualization.preview-fixtures.json +227 -0
  79. package/dist/files/widgets/CustomVisualizationConversationWidget/sandbox-frame/custom-visualization-frame.html +188 -0
  80. package/dist/files/widgets/EntityMentionConversationWidget/EntityMentionConversationWidget.md +55 -0
  81. package/dist/files/widgets/EntityMentionConversationWidget/entity-mention.preview-fixtures.json +55 -0
  82. package/dist/files/widgets/MultiChoiceConversationWidget/MultiChoiceConversationWidget.md +61 -0
  83. package/dist/files/widgets/MultiChoiceConversationWidget/multi-choice-widget-contract.json +43 -0
  84. package/dist/files/widgets/MultiChoiceConversationWidget/multi-choice.preview-fixtures.json +103 -0
  85. package/dist/files/widgets/QuickRepliesConversationWidget/QuickRepliesConversationWidget.md +65 -0
  86. package/dist/files/widgets/QuickRepliesConversationWidget/quick-replies-widget-contract.json +43 -0
  87. package/dist/files/widgets/QuickRepliesConversationWidget/quick-replies.preview-fixtures.json +45 -0
  88. package/dist/files/widgets/SuggestedActions/SuggestedActions.md +60 -0
  89. package/dist/files/widgets/SuggestedActions/suggested-actions.preview-fixtures.json +19 -0
  90. package/dist/files/widgets/ToolTraceConversationWidget/ToolTraceConversationWidget.md +48 -0
  91. package/dist/files/widgets/ToolTraceConversationWidget/tool-trace.preview-fixtures.json +32 -0
  92. package/dist/files/widgets/WebSearchResultsConversationWidget/WebSearchResultsConversationWidget.md +49 -0
  93. package/dist/files/widgets/WebSearchResultsConversationWidget/web-search-results.preview-fixtures.json +57 -0
  94. package/dist/files/widgets/WritingDraftConversationWidget/WritingDraftConversationWidget.md +66 -0
  95. package/dist/files/widgets/WritingDraftConversationWidget/writing-draft.preview-fixtures.json +129 -0
  96. package/dist/image-render.js +11 -10
  97. package/dist/image-render.js.map +1 -1
  98. package/dist/index.js +32 -28
  99. package/dist/index.js.map +1 -1
  100. package/dist/kit.js +11 -2
  101. package/dist/kit.js.map +1 -1
  102. package/dist/preview.js +7 -6
  103. package/dist/provider.js +71 -0
  104. package/dist/provider.js.map +1 -0
  105. package/dist/renderer.js +138 -63
  106. package/dist/renderer.js.map +1 -1
  107. package/dist/styles.css +32 -17
  108. package/dist/types/client/testing/test-conversation-widgets.d.ts +25 -0
  109. package/dist/types/client/testing/widget-hydration-stand-ins.d.ts +33 -0
  110. package/dist/types/entries/chat.d.ts +10 -0
  111. package/dist/types/entries/client-testing.d.ts +2 -0
  112. package/dist/types/entries/index.d.ts +4 -3
  113. package/dist/types/entries/kit.d.ts +7 -0
  114. package/dist/types/entries/preview.d.ts +1 -0
  115. package/dist/types/entries/provider.d.ts +1 -0
  116. package/dist/types/entries/renderer.d.ts +16 -0
  117. package/dist/types/entries/widgets.d.ts +13 -0
  118. package/dist/types/kit/components/data/apex-chart-component.d.ts +3 -0
  119. package/dist/types/kit/components/data/chart-model.d.ts +164 -0
  120. package/dist/types/kit/components/data/data-value-format.d.ts +44 -0
  121. package/dist/types/kit/components/data/use-chart-palette.d.ts +9 -0
  122. package/dist/types/kit/components/data/use-number-locale.d.ts +5 -0
  123. package/dist/types/provider/index.d.ts +1 -0
  124. package/dist/types/renderer/_access/ConversationWidgetGateSkeleton.d.ts +6 -0
  125. package/dist/types/renderer/_agent-space/use-conversation-widget-agent-space-fallback.d.ts +16 -0
  126. package/dist/types/renderer/canvas/use-anchor-widget-agent-space-key.d.ts +17 -0
  127. package/dist/types/renderer/conversationWidgetRegistry.d.ts +6 -0
  128. package/dist/types/renderer/read-conversation-widget-variant.d.ts +22 -0
  129. package/dist/types/widgets/_shared/CardFooter.d.ts +6 -0
  130. package/dist/types/widgets/_shared/WidgetLabel.d.ts +8 -0
  131. package/dist/types/widgets/_shared/entity-update-channel.d.ts +17 -0
  132. package/dist/types/widgets/_shared/use-element-visible.d.ts +6 -0
  133. package/dist/widgets.js +120 -27
  134. package/dist/widgets.js.map +1 -1
  135. package/package.json +74 -1
  136. package/public-api.json +761 -0
  137. package/dist/chunks/ConversationMarkdown-W7NHglmL.js.map +0 -1
  138. package/dist/chunks/WebSearchResultsConversationWidget-BvnLWHyi.js.map +0 -1
  139. package/dist/chunks/canvas-behaviours-BRFR1ALE.js.map +0 -1
  140. package/dist/chunks/canvasBodies-9SuF6NAB.js.map +0 -1
  141. package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js +0 -20
  142. package/dist/chunks/decide-canvas-open-Ct-wnNEJ.js.map +0 -1
  143. package/dist/chunks/widget-name-resolver-DyIY6Zu4.js.map +0 -1
@@ -0,0 +1,1046 @@
1
+ "use client";
2
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
3
+ import { useSyncExternalStore, useMemo, useState, useContext, createContext } from "react";
4
+ import { A as AgentsConversationClientProvider } from "./AgentsConversationClientContext-C4T7g_Qk.js";
5
+ import ReactMarkdown from "react-markdown";
6
+ import remarkGfm from "remark-gfm";
7
+ const SLICE_NAME = "widgetHydrationSlice";
8
+ const emptyMemory = () => {
9
+ return {
10
+ data: null,
11
+ status: "idle",
12
+ error: null,
13
+ loadingInstanceId: null,
14
+ inFlight: false,
15
+ requestId: 0,
16
+ lastLoadedAt: null
17
+ };
18
+ };
19
+ const initialState = {
20
+ widgets: {}
21
+ };
22
+ const readMemory = (state, key) => state.widgets[key] ?? emptyMemory();
23
+ const withMemory = (state, key, memory) => ({
24
+ ...state,
25
+ widgets: { ...state.widgets, [key]: memory }
26
+ });
27
+ const isCurrentRequest = (memory, requestId) => memory.requestId === 0 || memory.requestId === requestId;
28
+ const actionType = (name) => `${SLICE_NAME}/${name}`;
29
+ const WidgetHydrationSlice = {
30
+ memoryEnsured: (payload) => ({ type: actionType("memoryEnsured"), payload }),
31
+ instanceAttached: (payload) => ({
32
+ type: actionType("instanceAttached"),
33
+ payload
34
+ }),
35
+ hydrationStarted: (payload) => ({
36
+ type: actionType("hydrationStarted"),
37
+ payload
38
+ }),
39
+ hydrationSucceeded: (payload) => ({
40
+ type: actionType("hydrationSucceeded"),
41
+ payload
42
+ }),
43
+ hydrationFailed: (payload) => ({
44
+ type: actionType("hydrationFailed"),
45
+ payload
46
+ }),
47
+ widgetReset: (payload) => ({ type: actionType("widgetReset"), payload }),
48
+ allWidgetsReset: () => ({ type: actionType("allWidgetsReset") })
49
+ };
50
+ const WidgetHydrationReducer = (state = initialState, action) => {
51
+ switch (action.type) {
52
+ case actionType("memoryEnsured"): {
53
+ const { key } = action.payload;
54
+ return state.widgets[key] ? state : withMemory(state, key, emptyMemory());
55
+ }
56
+ case actionType("instanceAttached"): {
57
+ const { key, instanceId } = action.payload;
58
+ return withMemory(state, key, { ...readMemory(state, key), loadingInstanceId: instanceId });
59
+ }
60
+ case actionType("hydrationStarted"): {
61
+ const { key, instanceId, requestId } = action.payload;
62
+ return withMemory(state, key, {
63
+ ...readMemory(state, key),
64
+ status: "loading",
65
+ error: null,
66
+ inFlight: true,
67
+ loadingInstanceId: instanceId,
68
+ requestId
69
+ });
70
+ }
71
+ case actionType("hydrationSucceeded"): {
72
+ const { key, requestId, data } = action.payload;
73
+ const memory = readMemory(state, key);
74
+ if (!isCurrentRequest(memory, requestId)) return state.widgets[key] ? state : withMemory(state, key, memory);
75
+ return withMemory(state, key, {
76
+ ...memory,
77
+ status: "success",
78
+ error: null,
79
+ inFlight: false,
80
+ data,
81
+ loadingInstanceId: null,
82
+ requestId,
83
+ lastLoadedAt: Date.now()
84
+ });
85
+ }
86
+ case actionType("hydrationFailed"): {
87
+ const { key, requestId, error } = action.payload;
88
+ const memory = readMemory(state, key);
89
+ if (!isCurrentRequest(memory, requestId)) return state.widgets[key] ? state : withMemory(state, key, memory);
90
+ return withMemory(state, key, {
91
+ ...memory,
92
+ status: "error",
93
+ error,
94
+ inFlight: false,
95
+ loadingInstanceId: null,
96
+ requestId
97
+ });
98
+ }
99
+ case actionType("widgetReset"): {
100
+ const { key } = action.payload;
101
+ if (!(key in state.widgets)) return state;
102
+ const { [key]: removedMemory, ...remainingWidgets } = state.widgets;
103
+ return { ...state, widgets: remainingWidgets };
104
+ }
105
+ case actionType("allWidgetsReset"):
106
+ return { ...state, widgets: {} };
107
+ default:
108
+ return state;
109
+ }
110
+ };
111
+ class AgentsWidgetHydrationStateContainer {
112
+ constructor() {
113
+ this.state = {
114
+ AIExtensionsWidgetHydration: WidgetHydrationReducer(void 0, { type: "agents/widgetHydrationStoreCreated" })
115
+ };
116
+ this.listeners = /* @__PURE__ */ new Set();
117
+ this.getState = () => this.state;
118
+ this.subscribe = (listener) => {
119
+ this.listeners.add(listener);
120
+ return () => {
121
+ this.listeners.delete(listener);
122
+ };
123
+ };
124
+ this.dispatch = (action) => {
125
+ const nextHydrationState = WidgetHydrationReducer(this.state.AIExtensionsWidgetHydration, action);
126
+ if (nextHydrationState === this.state.AIExtensionsWidgetHydration) return action;
127
+ this.state = { AIExtensionsWidgetHydration: nextHydrationState };
128
+ for (const notifyListener of [...this.listeners]) notifyListener();
129
+ return action;
130
+ };
131
+ this.useSelector = (selector) => {
132
+ const readSelectedValue = () => selector(this.state);
133
+ return useSyncExternalStore(this.subscribe, readSelectedValue, readSelectedValue);
134
+ };
135
+ this.useDispatch = () => this.dispatch;
136
+ }
137
+ }
138
+ const createAgentsWidgetHydrationStateStore = () => new AgentsWidgetHydrationStateContainer();
139
+ let defaultStateStore = null;
140
+ const getDefaultAgentsStateStore = () => {
141
+ defaultStateStore ??= createAgentsWidgetHydrationStateStore();
142
+ return defaultStateStore;
143
+ };
144
+ const readClassNamesOfValue = (value) => {
145
+ if (typeof value === "string") return value.length > 0 ? [value] : [];
146
+ if (!value) return [];
147
+ return Object.keys(value).filter((className) => className.length > 0 && Boolean(value[className]));
148
+ };
149
+ const classNames = (...args) => args.flatMap(readClassNamesOfValue).join(" ");
150
+ const TEXT_ELEMENT_BY_ROLE = {
151
+ title: "h4",
152
+ intro: "p",
153
+ body: "span",
154
+ help: "span",
155
+ caption: "span"
156
+ };
157
+ const readCssColor = (color) => color?.startsWith("--") ? `var(${color})` : color;
158
+ const readPlainReplacements = (replacements) => {
159
+ const plainReplacements = {};
160
+ for (const [name, value] of Object.entries(replacements ?? {})) {
161
+ if (typeof value === "string" || typeof value === "number") plainReplacements[name] = value;
162
+ }
163
+ return plainReplacements;
164
+ };
165
+ const useTranslatedText = (text, translate = true, replacements, context) => {
166
+ const texts = useAgentsTexts();
167
+ if (text === void 0) return void 0;
168
+ return translate ? texts.translate(text, readPlainReplacements(replacements), context) : text;
169
+ };
170
+ const DefaultText = (props) => {
171
+ const {
172
+ children,
173
+ role = "body",
174
+ weight,
175
+ color,
176
+ translate = true,
177
+ replacements,
178
+ context,
179
+ ellipsis,
180
+ display,
181
+ textAlign,
182
+ textWrap,
183
+ allowNewLines,
184
+ headingLevel,
185
+ ariaHidden,
186
+ className,
187
+ testId
188
+ } = props;
189
+ const texts = useAgentsTexts();
190
+ const Element = TEXT_ELEMENT_BY_ROLE[role];
191
+ const content = typeof children === "string" && translate ? texts.translate(children, readPlainReplacements(replacements), context) : children;
192
+ return /* @__PURE__ */ jsx(
193
+ Element,
194
+ {
195
+ "data-testid": testId,
196
+ role: headingLevel ? "heading" : void 0,
197
+ "aria-level": headingLevel,
198
+ "aria-hidden": ariaHidden || void 0,
199
+ className: classNames(
200
+ "agents-text",
201
+ `agents-text--${role}`,
202
+ weight && `agents-text--weight-${weight}`,
203
+ ellipsis && "agents-text--ellipsis",
204
+ allowNewLines && "agents-text--new-lines",
205
+ className
206
+ ),
207
+ style: {
208
+ color: readCssColor(color),
209
+ display,
210
+ textAlign,
211
+ whiteSpace: textWrap === "nowrap" || ellipsis ? "nowrap" : allowNewLines ? "pre-line" : void 0
212
+ },
213
+ children: content
214
+ }
215
+ );
216
+ };
217
+ const DefaultIcon = (props) => {
218
+ const { name, hostIconName, size, pixelSize, color, className, style } = props;
219
+ const iconName = name ?? hostIconName;
220
+ return /* @__PURE__ */ jsx(
221
+ "span",
222
+ {
223
+ "aria-hidden": true,
224
+ "data-icon": iconName,
225
+ className: classNames("agents-icon", size && `agents-icon--${size}`, className),
226
+ style: { color: readCssColor(color), ...pixelSize ? { width: pixelSize, height: pixelSize } : null, ...style }
227
+ }
228
+ );
229
+ };
230
+ const DefaultButton = (props) => {
231
+ const {
232
+ children,
233
+ variant = "primary",
234
+ size = "medium",
235
+ onClick,
236
+ disabled,
237
+ isLoading,
238
+ rounded,
239
+ pressed,
240
+ onDark,
241
+ blurred,
242
+ inverted,
243
+ icon,
244
+ iconPosition = "left",
245
+ htmlType = "button",
246
+ fullWidth,
247
+ wrapsLabel,
248
+ translate,
249
+ replacements,
250
+ className,
251
+ testId,
252
+ ariaLabel
253
+ } = props;
254
+ const label = useTranslatedText(children, translate, replacements);
255
+ return /* @__PURE__ */ jsxs(
256
+ "button",
257
+ {
258
+ type: htmlType,
259
+ "aria-label": ariaLabel,
260
+ "aria-pressed": pressed,
261
+ "aria-busy": isLoading || void 0,
262
+ disabled: disabled || isLoading,
263
+ "data-testid": testId,
264
+ onClick,
265
+ className: classNames(
266
+ "agents-button",
267
+ `agents-button--${variant}`,
268
+ `agents-button--${size}`,
269
+ rounded && "agents-button--rounded",
270
+ pressed && "agents-button--pressed",
271
+ onDark && "agents-button--on-dark",
272
+ blurred && "agents-button--blurred",
273
+ inverted && "agents-button--inverted",
274
+ fullWidth && "agents-button--full-width",
275
+ wrapsLabel && "agents-button--wraps-label",
276
+ className
277
+ ),
278
+ children: [
279
+ icon && iconPosition === "left" ? /* @__PURE__ */ jsx(DefaultIcon, { name: icon, size: "small" }) : null,
280
+ label,
281
+ icon && iconPosition === "right" ? /* @__PURE__ */ jsx(DefaultIcon, { name: icon, size: "small" }) : null
282
+ ]
283
+ }
284
+ );
285
+ };
286
+ const DefaultInteractiveSurface = (props) => {
287
+ const { children, hoverable, className, style, testId } = props;
288
+ return /* @__PURE__ */ jsx(
289
+ "div",
290
+ {
291
+ "data-testid": testId,
292
+ className: classNames("agents-interactive-surface", hoverable && "agents-interactive-surface--hoverable", className),
293
+ style,
294
+ children
295
+ }
296
+ );
297
+ };
298
+ const DefaultSkeleton = (props) => {
299
+ const { width, height, borderRadius = 4, className, style } = props;
300
+ return /* @__PURE__ */ jsx(
301
+ "div",
302
+ {
303
+ "aria-hidden": true,
304
+ className: classNames("agents-skeleton", className),
305
+ style: { width, height, borderRadius, ...style }
306
+ }
307
+ );
308
+ };
309
+ const DefaultLoadingSpinner = (_props) => /* @__PURE__ */ jsx("span", { role: "progressbar", "aria-busy": true, className: "agents-loading-spinner" });
310
+ const DefaultTooltip = (props) => {
311
+ const { children, text, replacements, placement = "top", dark } = props;
312
+ const [isShown, setIsShown] = useState(false);
313
+ const shownText = useTranslatedText(text, true, replacements);
314
+ return /* @__PURE__ */ jsxs(
315
+ "span",
316
+ {
317
+ className: "agents-tooltip",
318
+ style: { position: "relative", display: "inline-flex" },
319
+ onMouseEnter: () => setIsShown(true),
320
+ onMouseLeave: () => setIsShown(false),
321
+ onFocus: () => setIsShown(true),
322
+ onBlur: () => setIsShown(false),
323
+ children: [
324
+ children,
325
+ shownText && isShown ? /* @__PURE__ */ jsx(
326
+ "span",
327
+ {
328
+ role: "tooltip",
329
+ className: classNames("agents-tooltip__panel", `agents-tooltip__panel--${placement}`, dark && "agents-tooltip__panel--dark"),
330
+ style: { position: "absolute", bottom: "100%", left: "50%", transform: "translateX(-50%)" },
331
+ children: shownText
332
+ }
333
+ ) : null
334
+ ]
335
+ }
336
+ );
337
+ };
338
+ const DefaultGlowFrame = (props) => {
339
+ const { children, className, color, borderRadius, borderWidth } = props;
340
+ return /* @__PURE__ */ jsx(
341
+ "div",
342
+ {
343
+ className: classNames("agents-glow-frame", className),
344
+ style: { borderRadius, borderWidth, borderStyle: borderWidth ? "solid" : void 0, borderColor: color },
345
+ children
346
+ }
347
+ );
348
+ };
349
+ const DefaultProgressBar = (props) => {
350
+ const { value, height, color, indeterminate } = props;
351
+ return /* @__PURE__ */ jsx(
352
+ "progress",
353
+ {
354
+ className: "agents-progress-bar",
355
+ max: 100,
356
+ value: indeterminate ? void 0 : value,
357
+ style: { height, accentColor: color, width: "100%" }
358
+ }
359
+ );
360
+ };
361
+ const DefaultSplitView = (props) => {
362
+ const { isSideOpen, main, side, sideToggle } = props;
363
+ return /* @__PURE__ */ jsxs("div", { className: "agents-split-view", style: { display: "flex", width: "100%", height: "100%" }, children: [
364
+ /* @__PURE__ */ jsx(
365
+ "div",
366
+ {
367
+ className: "agents-split-view__main",
368
+ style: { width: isSideOpen ? main.narrowedWidth ?? main.width : main.width, background: main.background },
369
+ children: main.content
370
+ }
371
+ ),
372
+ sideToggle ? /* @__PURE__ */ jsx("button", { type: "button", className: "agents-split-view__toggle", onClick: sideToggle.onToggle, "aria-expanded": isSideOpen }) : null,
373
+ isSideOpen ? /* @__PURE__ */ jsx("div", { className: "agents-split-view__side", style: { width: side.narrowedWidth ?? side.width, background: side.background }, children: side.content }) : null
374
+ ] });
375
+ };
376
+ const DefaultTrendDelta = (props) => {
377
+ const { current, previous = 0, higherIsBetter = true, format } = props;
378
+ const change = current - previous;
379
+ const magnitude = Math.abs(change);
380
+ const isGood = change === 0 ? void 0 : change > 0 === higherIsBetter;
381
+ return /* @__PURE__ */ jsxs(
382
+ "span",
383
+ {
384
+ className: classNames(
385
+ "agents-trend-delta",
386
+ isGood === true && "agents-trend-delta--good",
387
+ isGood === false && "agents-trend-delta--bad"
388
+ ),
389
+ children: [
390
+ change > 0 ? "▲ " : change < 0 ? "▼ " : "",
391
+ format ? format(magnitude) : String(magnitude)
392
+ ]
393
+ }
394
+ );
395
+ };
396
+ const DefaultCheckbox = (props) => {
397
+ const { checked, disabled, label, translate, onChange, testId } = props;
398
+ const translatedLabel = useTranslatedText(typeof label === "string" ? label : void 0, translate);
399
+ return /* @__PURE__ */ jsxs("label", { className: "agents-checkbox", "data-testid": testId, children: [
400
+ /* @__PURE__ */ jsx("input", { type: "checkbox", checked: checked ?? false, disabled, onChange }),
401
+ typeof label === "string" ? translatedLabel : label
402
+ ] });
403
+ };
404
+ const DefaultTextInput = (props) => {
405
+ const { id, value, type = "text", label, placeholder, maxLength, onChange, testId } = props;
406
+ const translatedLabel = useTranslatedText(label);
407
+ return /* @__PURE__ */ jsxs("label", { className: "agents-text-input", children: [
408
+ translatedLabel ? /* @__PURE__ */ jsx("span", { className: "agents-text-input__label", children: translatedLabel }) : null,
409
+ /* @__PURE__ */ jsx(
410
+ "input",
411
+ {
412
+ id,
413
+ type,
414
+ value: value ?? "",
415
+ placeholder,
416
+ maxLength,
417
+ "data-testid": testId,
418
+ onChange: (event) => onChange?.(event.target.value)
419
+ }
420
+ )
421
+ ] });
422
+ };
423
+ const DefaultTextArea = (props) => {
424
+ const { id, value, label, placeholder, maxLength, rows, minRows, showsCounter, autoFocus, onChange, testId } = props;
425
+ const translatedLabel = useTranslatedText(label);
426
+ return /* @__PURE__ */ jsxs("label", { className: "agents-text-area", children: [
427
+ translatedLabel ? /* @__PURE__ */ jsx("span", { className: "agents-text-area__label", children: translatedLabel }) : null,
428
+ /* @__PURE__ */ jsx(
429
+ "textarea",
430
+ {
431
+ id,
432
+ value: value ?? "",
433
+ placeholder,
434
+ maxLength,
435
+ rows: rows ?? minRows,
436
+ autoFocus,
437
+ "data-testid": testId,
438
+ onChange: (event) => onChange?.(event.target.value)
439
+ }
440
+ ),
441
+ showsCounter && maxLength ? /* @__PURE__ */ jsx("span", { className: "agents-text-area__counter", children: `${(value ?? "").length} / ${maxLength}` }) : null
442
+ ] });
443
+ };
444
+ const DefaultRangeSlider = (props) => {
445
+ const { value, min, max, step, onMove, onRelease } = props;
446
+ return /* @__PURE__ */ jsx(
447
+ "input",
448
+ {
449
+ type: "range",
450
+ className: "agents-range-slider",
451
+ value,
452
+ min,
453
+ max,
454
+ step,
455
+ onChange: (event) => onMove?.(Number(event.target.value)),
456
+ onPointerUp: (event) => onRelease?.(Number(event.currentTarget.value)),
457
+ onKeyUp: (event) => onRelease?.(Number(event.currentTarget.value))
458
+ }
459
+ );
460
+ };
461
+ const toIsoDay = (timestamp) => {
462
+ if (timestamp === void 0) return void 0;
463
+ const day = new Date(timestamp);
464
+ const month = String(day.getMonth() + 1).padStart(2, "0");
465
+ const dayOfMonth = String(day.getDate()).padStart(2, "0");
466
+ return `${day.getFullYear()}-${month}-${dayOfMonth}`;
467
+ };
468
+ const DefaultDateInput = (props) => {
469
+ const { value, minDate, maxDate, onChange } = props;
470
+ return /* @__PURE__ */ jsx(
471
+ "input",
472
+ {
473
+ type: "date",
474
+ className: "agents-date-input",
475
+ value: toIsoDay(value) ?? "",
476
+ min: toIsoDay(minDate),
477
+ max: toIsoDay(maxDate),
478
+ onChange: (event) => {
479
+ const [year, month, day] = event.target.value.split("-").map(Number);
480
+ onChange?.(event.target.value ? new Date(year, month - 1, day).getTime() : null);
481
+ }
482
+ }
483
+ );
484
+ };
485
+ const DefaultRadioGroup = (props) => {
486
+ const { name, value, options, direction = "column", onChange } = props;
487
+ return /* @__PURE__ */ jsx("div", { className: "agents-radio-group", style: { display: "flex", flexDirection: direction }, children: options.map((option) => /* @__PURE__ */ jsxs("label", { className: "agents-radio-group__option", children: [
488
+ /* @__PURE__ */ jsx(
489
+ "input",
490
+ {
491
+ type: "radio",
492
+ name,
493
+ value: option.value,
494
+ checked: option.value === value,
495
+ disabled: option.disabled,
496
+ onChange: () => onChange(option.value)
497
+ }
498
+ ),
499
+ option.label
500
+ ] }, option.value)) });
501
+ };
502
+ const DefaultSelect = (props) => {
503
+ const { id, value, options, placeholder, onChange, testId } = props;
504
+ return /* @__PURE__ */ jsxs(
505
+ "select",
506
+ {
507
+ id,
508
+ className: "agents-select",
509
+ value,
510
+ "data-testid": testId,
511
+ onChange: (event) => onChange(event.target.value),
512
+ children: [
513
+ placeholder !== void 0 ? /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: placeholder }) : null,
514
+ options.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, disabled: option.disabled, title: option.description, children: option.label }, option.value))
515
+ ]
516
+ }
517
+ );
518
+ };
519
+ const DefaultTabs = (props) => {
520
+ const { options, value, onChange, ariaLabel } = props;
521
+ return /* @__PURE__ */ jsx("div", { role: "tablist", "aria-label": ariaLabel, className: "agents-tabs", children: options.filter((option) => !option.disabled).map((option) => /* @__PURE__ */ jsx(
522
+ "button",
523
+ {
524
+ type: "button",
525
+ role: "tab",
526
+ "aria-selected": option.value === value,
527
+ "data-testid": option.testId,
528
+ className: classNames("agents-tabs__tab", option.value === value && "agents-tabs__tab--selected"),
529
+ onClick: () => onChange(option.value),
530
+ children: option.label
531
+ },
532
+ option.value
533
+ )) });
534
+ };
535
+ const DefaultStatusBadge = (props) => {
536
+ const { status, text, translate, size, className } = props;
537
+ const shownText = useTranslatedText(text, translate);
538
+ return /* @__PURE__ */ jsx(
539
+ "span",
540
+ {
541
+ className: classNames(
542
+ "agents-status-badge",
543
+ `agents-status-badge--${status}`,
544
+ size && `agents-status-badge--${size}`,
545
+ className
546
+ ),
547
+ children: shownText
548
+ }
549
+ );
550
+ };
551
+ const DefaultMap = (props) => {
552
+ const { className, testId } = props;
553
+ const noMapText = useTranslatedText("No map available.");
554
+ return /* @__PURE__ */ jsx("div", { className: classNames("agents-map-placeholder", className), "data-testid": testId, "data-map": "none", children: noMapText });
555
+ };
556
+ const DefaultMapMarker = (_props) => null;
557
+ const DefaultModalLayer = (props) => {
558
+ const { children } = props;
559
+ return /* @__PURE__ */ jsx(Fragment, { children });
560
+ };
561
+ const DefaultHeroRow = (props) => {
562
+ const { children, className } = props;
563
+ return /* @__PURE__ */ jsx("div", { "data-hero-row": "", className: classNames("agents-hero-row", className), children });
564
+ };
565
+ const DefaultHeroValue = (props) => {
566
+ const { children, color } = props;
567
+ return /* @__PURE__ */ jsx("span", { "data-hero": "", "data-hero-value": "", className: "agents-hero-value", style: { color: readCssColor(color) }, children });
568
+ };
569
+ const DefaultWidgetText = (props) => {
570
+ const {
571
+ children,
572
+ variant = "inherit",
573
+ tone,
574
+ color,
575
+ weight,
576
+ uppercase,
577
+ tabular,
578
+ strikethrough,
579
+ inline = variant === "inherit",
580
+ translate = typeof children === "string",
581
+ context,
582
+ replacements,
583
+ className,
584
+ testId
585
+ } = props;
586
+ const texts = useAgentsTexts();
587
+ const plainReplacements = {};
588
+ for (const [name, value] of Object.entries(replacements ?? {})) {
589
+ if (value !== null && value !== void 0) plainReplacements[name] = value;
590
+ }
591
+ const content = typeof children === "string" && translate ? texts.translate(children, plainReplacements, context) : children;
592
+ const Element = inline ? "span" : "div";
593
+ return /* @__PURE__ */ jsx(
594
+ Element,
595
+ {
596
+ "data-testid": testId,
597
+ className: classNames(
598
+ "agents-widget-text",
599
+ `agents-widget-text--${variant}`,
600
+ tone && !color && `agents-widget-text--${tone}`,
601
+ weight && `agents-widget-text--weight-${weight}`,
602
+ uppercase && "agents-widget-text--uppercase",
603
+ tabular && "agents-widget-text--tabular",
604
+ strikethrough && "agents-widget-text--strikethrough",
605
+ className
606
+ ),
607
+ style: color ? { color: readCssColor(color) } : void 0,
608
+ children: content
609
+ }
610
+ );
611
+ };
612
+ const DefaultSkeletonText = (props) => {
613
+ const { width = "4.5em", height = "1em", className } = props;
614
+ return /* @__PURE__ */ jsx(
615
+ "span",
616
+ {
617
+ "aria-hidden": true,
618
+ className: classNames("agents-skeleton", className),
619
+ style: { display: "inline-block", width, height, borderRadius: 999 }
620
+ }
621
+ );
622
+ };
623
+ const STATUS_BADGE_STATUS_BY_CHIP_TONE = {
624
+ success: "success",
625
+ warning: "warning",
626
+ danger: "danger",
627
+ neutral: "neutral",
628
+ info: "info",
629
+ error: "danger"
630
+ };
631
+ const DefaultStatusChip = (props) => {
632
+ const { tone = "neutral", children, compact = false, translate = true } = props;
633
+ return /* @__PURE__ */ jsx(
634
+ DefaultStatusBadge,
635
+ {
636
+ status: STATUS_BADGE_STATUS_BY_CHIP_TONE[tone],
637
+ text: children,
638
+ translate,
639
+ size: "small",
640
+ hideIcon: compact || tone !== "error"
641
+ }
642
+ );
643
+ };
644
+ const DefaultSegmentBar = (props) => {
645
+ const { segments, height = 6, className, loading = false, testId } = props;
646
+ const total = segments.reduce((sum, segment) => sum + Math.max(0, segment.value), 0);
647
+ return /* @__PURE__ */ jsx(
648
+ "div",
649
+ {
650
+ className: classNames("agents-segment-bar", className),
651
+ style: { display: "flex", height, borderRadius: height, overflow: "hidden" },
652
+ "data-segment-bar": "",
653
+ "data-testid": testId,
654
+ children: total > 0 || loading ? segments.map((segment, segmentIndex) => /* @__PURE__ */ jsx(
655
+ "div",
656
+ {
657
+ style: {
658
+ width: loading ? `${100 / segments.length}%` : `${Math.max(0, segment.value) / total * 100}%`,
659
+ background: segment.color,
660
+ opacity: segment.muted || loading ? 0.5 : void 0
661
+ }
662
+ },
663
+ segmentIndex
664
+ )) : null
665
+ }
666
+ );
667
+ };
668
+ const NO_MARKDOWN_PLUGINS = [];
669
+ const MarkdownImage = (imageProps) => {
670
+ const { src, node, ...otherProps } = imageProps;
671
+ return src ? /* @__PURE__ */ jsx("img", { src, ...otherProps }) : null;
672
+ };
673
+ const DefaultMarkdown = (props) => {
674
+ const { markdown, color, remarkPlugins = NO_MARKDOWN_PLUGINS, rehypePlugins = NO_MARKDOWN_PLUGINS, components } = props;
675
+ const markdownComponents = useMemo(() => ({ img: MarkdownImage, ...components }), [components]);
676
+ const markdownRemarkPlugins = useMemo(() => [remarkGfm, ...remarkPlugins], [remarkPlugins]);
677
+ return /* @__PURE__ */ jsx("div", { style: { color }, className: "agents-markdown", "data-markdown-blocks-root": true, children: /* @__PURE__ */ jsx(
678
+ ReactMarkdown,
679
+ {
680
+ remarkPlugins: markdownRemarkPlugins,
681
+ rehypePlugins,
682
+ components: markdownComponents,
683
+ children: markdown
684
+ }
685
+ ) });
686
+ };
687
+ const DefaultWidgetFeatureGate = (props) => {
688
+ const { children } = props;
689
+ return /* @__PURE__ */ jsx(Fragment, { children });
690
+ };
691
+ const DefaultConversationSearchResultsList = (props) => {
692
+ const { groups, onOpenConversation } = props;
693
+ return /* @__PURE__ */ jsx("ul", { className: "agents-conversation-search-results", children: groups.map((group, groupIndex) => /* @__PURE__ */ jsxs("li", { className: "agents-conversation-search-results__group", children: [
694
+ /* @__PURE__ */ jsx(DefaultText, { role: "body", weight: "bold", translate: false, children: group.title ?? "" }),
695
+ group.hits.map((hit, hitIndex) => /* @__PURE__ */ jsx(
696
+ "button",
697
+ {
698
+ type: "button",
699
+ className: "agents-conversation-search-results__hit",
700
+ onClick: () => {
701
+ if (group.conversationId !== void 0) onOpenConversation(group.conversationId, hit.messageId);
702
+ },
703
+ children: /* @__PURE__ */ jsx(DefaultText, { role: "help", translate: false, children: hit.excerpt ?? "" })
704
+ },
705
+ hit.messageId ?? hitIndex
706
+ ))
707
+ ] }, group.conversationId ?? groupIndex)) });
708
+ };
709
+ const DEFAULT_AGENTS_COMPONENTS = {
710
+ Text: DefaultText,
711
+ Button: DefaultButton,
712
+ Icon: DefaultIcon,
713
+ InteractiveSurface: DefaultInteractiveSurface,
714
+ Skeleton: DefaultSkeleton,
715
+ LoadingSpinner: DefaultLoadingSpinner,
716
+ Tooltip: DefaultTooltip,
717
+ GlowFrame: DefaultGlowFrame,
718
+ ProgressBar: DefaultProgressBar,
719
+ SplitView: DefaultSplitView,
720
+ TrendDelta: DefaultTrendDelta,
721
+ Checkbox: DefaultCheckbox,
722
+ TextInput: DefaultTextInput,
723
+ TextArea: DefaultTextArea,
724
+ RangeSlider: DefaultRangeSlider,
725
+ DateInput: DefaultDateInput,
726
+ RadioGroup: DefaultRadioGroup,
727
+ Select: DefaultSelect,
728
+ Tabs: DefaultTabs,
729
+ StatusBadge: DefaultStatusBadge,
730
+ Map: DefaultMap,
731
+ MapMarker: DefaultMapMarker,
732
+ ModalLayer: DefaultModalLayer,
733
+ HeroRow: DefaultHeroRow,
734
+ HeroValue: DefaultHeroValue,
735
+ WidgetText: DefaultWidgetText,
736
+ SkeletonText: DefaultSkeletonText,
737
+ StatusChip: DefaultStatusChip,
738
+ SegmentBar: DefaultSegmentBar,
739
+ Markdown: DefaultMarkdown,
740
+ WidgetFeatureGate: DefaultWidgetFeatureGate,
741
+ ConversationSearchResultsList: DefaultConversationSearchResultsList
742
+ };
743
+ let appEnvironment = {};
744
+ const environmentListeners = /* @__PURE__ */ new Set();
745
+ const setAgentsEnvironment = (environment) => {
746
+ appEnvironment = environment;
747
+ for (const notifyListener of environmentListeners) notifyListener();
748
+ };
749
+ const getAgentsEnvironment = () => appEnvironment;
750
+ const subscribeToAgentsEnvironment = (listener) => {
751
+ environmentListeners.add(listener);
752
+ return () => {
753
+ environmentListeners.delete(listener);
754
+ };
755
+ };
756
+ const substitutePlaceholders = (key, replacements) => replacements ? key.replace(
757
+ /%([A-Za-z0-9_]+)%/g,
758
+ (placeholder, name) => name in replacements ? String(replacements[name]) : placeholder
759
+ ) : key;
760
+ const DEFAULT_AGENTS_TEXTS = { translate: substitutePlaceholders };
761
+ const translateText = (key, replacements, context) => (appEnvironment.texts ?? DEFAULT_AGENTS_TEXTS).translate(key, replacements, context);
762
+ const escapePlainTextForText = (text) => appEnvironment.escapePlainTextForText ? appEnvironment.escapePlainTextForText(text) : text;
763
+ const openImageGallery = (images, startIndex) => {
764
+ if (appEnvironment.openImageGallery) {
765
+ appEnvironment.openImageGallery(images, startIndex);
766
+ return;
767
+ }
768
+ const startImage = images[startIndex];
769
+ if (startImage) window.open(startImage.url, "_blank", "noopener,noreferrer");
770
+ };
771
+ const DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME = "agentSpaceId";
772
+ const getWidgetSelfHydrationKeyFieldName = () => appEnvironment.widgetSelfHydrationKeyFieldName ?? DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME;
773
+ const appendAnotherAgentSpaceToOwnerText = (ownerText, anotherAgentSpaceKey) => appEnvironment.appendAnotherAgentSpaceToOwnerText ? appEnvironment.appendAnotherAgentSpaceToOwnerText(ownerText, anotherAgentSpaceKey) : ownerText;
774
+ const buildUnnamedAgentSpaceLabel = (agentSpaceKey) => appEnvironment.buildUnnamedAgentSpaceLabel ? appEnvironment.buildUnnamedAgentSpaceLabel(agentSpaceKey) : `#${agentSpaceKey}`;
775
+ const buildWidgetOfAnotherAgentSpaceExplanation = (agentSpaceLabel) => appEnvironment.buildWidgetOfAnotherAgentSpaceExplanation ? appEnvironment.buildWidgetOfAnotherAgentSpaceExplanation(agentSpaceLabel) : translateText("This widget shows data for %label%, not for what you currently have selected.", {
776
+ label: agentSpaceLabel
777
+ });
778
+ const getSandboxLegacyAliases = () => appEnvironment.sandboxLegacyAliases ?? {};
779
+ const DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX = "/api/";
780
+ const getWidgetImageCaptureReadPathPrefix = () => appEnvironment.widgetImageCaptureReadPathPrefix ?? DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX;
781
+ const getGoogleMapWidgetNames = () => appEnvironment.googleMapWidgetNames ?? [];
782
+ const getFurtherWidgetClickSignalSources = () => appEnvironment.furtherWidgetClickSignalSources ?? [];
783
+ const getFurtherCanvasBehaviours = () => appEnvironment.furtherCanvasBehaviours ?? {};
784
+ const getAgentDisplayName = () => appEnvironment.agentDisplayName ?? translateText("the assistant");
785
+ const reportRunningTurn = () => appEnvironment.reportRunningTurn?.();
786
+ const reportWidgetCrash = (widgetName, error, errorInfo) => {
787
+ appEnvironment.reportWidgetCrash?.(widgetName, error, errorInfo);
788
+ };
789
+ const AgentsEnvironmentContext = createContext(null);
790
+ const NO_SUBTREE_ENVIRONMENT = {};
791
+ const AgentsProvider = (props) => {
792
+ const { environment = NO_SUBTREE_ENVIRONMENT, client, children } = props;
793
+ const environmentTree = /* @__PURE__ */ jsx(AgentsEnvironmentContext.Provider, { value: environment, children });
794
+ return client ? /* @__PURE__ */ jsx(AgentsConversationClientProvider, { client, children: environmentTree }) : environmentTree;
795
+ };
796
+ const useAppEnvironment = () => useSyncExternalStore(subscribeToAgentsEnvironment, getAgentsEnvironment, getAgentsEnvironment);
797
+ const useAgentsComponents = () => {
798
+ const subtreeEnvironment = useContext(AgentsEnvironmentContext);
799
+ const appEnvironment2 = useAppEnvironment();
800
+ return useMemo(
801
+ () => ({ ...DEFAULT_AGENTS_COMPONENTS, ...appEnvironment2.components, ...subtreeEnvironment?.components }),
802
+ [appEnvironment2, subtreeEnvironment]
803
+ );
804
+ };
805
+ const useAgentsTexts = () => {
806
+ const subtreeEnvironment = useContext(AgentsEnvironmentContext);
807
+ const appEnvironment2 = useAppEnvironment();
808
+ return subtreeEnvironment?.texts ?? appEnvironment2.texts ?? DEFAULT_AGENTS_TEXTS;
809
+ };
810
+ const useAgentsEnvironment = () => {
811
+ const subtreeEnvironment = useContext(AgentsEnvironmentContext);
812
+ const appEnvironment2 = useAppEnvironment();
813
+ return useMemo(
814
+ () => subtreeEnvironment ? { ...appEnvironment2, ...subtreeEnvironment } : appEnvironment2,
815
+ [appEnvironment2, subtreeEnvironment]
816
+ );
817
+ };
818
+ const readStateStore = (environment) => environment.stateStore ?? getDefaultAgentsStateStore();
819
+ const useAgentsStateSelector = (selector) => readStateStore(useAgentsEnvironment()).useSelector(selector);
820
+ const useAgentsStateDispatch = () => readStateStore(useAgentsEnvironment()).useDispatch();
821
+ const NO_OWNER_SETTINGS = {};
822
+ const useNoOwnerSettings = () => NO_OWNER_SETTINGS;
823
+ const useAgentsOwnerSettings = () => {
824
+ const useOwnerSettings = useAgentsEnvironment().useOwnerSettings ?? useNoOwnerSettings;
825
+ return useOwnerSettings();
826
+ };
827
+ const useNoActiveAgentSpaceKey = () => void 0;
828
+ const useAgentsActiveAgentSpaceKey = () => {
829
+ const useActiveAgentSpaceKey = useAgentsEnvironment().useActiveAgentSpaceKey ?? useNoActiveAgentSpaceKey;
830
+ return useActiveAgentSpaceKey();
831
+ };
832
+ const NO_MAPS = {
833
+ isLoaded: false,
834
+ loadError: new Error("The agents environment has no maps loader."),
835
+ languageCode: void 0
836
+ };
837
+ const useNoMapsLoader = () => NO_MAPS;
838
+ const useAgentsMapsLoader = () => {
839
+ const useMapsLoader = useAgentsEnvironment().useMapsLoader ?? useNoMapsLoader;
840
+ return useMapsLoader();
841
+ };
842
+ const NO_BUDGET_UPGRADE = { canUpgrade: false, openUpgrade: () => void 0, showsFairUseWording: false };
843
+ const useNoBudgetLimit = () => NO_BUDGET_UPGRADE;
844
+ const useAgentsBudgetLimit = () => {
845
+ const useBudgetLimit = useAgentsEnvironment().useBudgetLimit ?? useNoBudgetLimit;
846
+ return useBudgetLimit();
847
+ };
848
+ const Text = (props) => {
849
+ const { Text: TextComponent } = useAgentsComponents();
850
+ return /* @__PURE__ */ jsx(TextComponent, { ...props });
851
+ };
852
+ const Button = (props) => {
853
+ const { Button: ButtonComponent } = useAgentsComponents();
854
+ return /* @__PURE__ */ jsx(ButtonComponent, { ...props });
855
+ };
856
+ const Icon = (props) => {
857
+ const { Icon: IconComponent } = useAgentsComponents();
858
+ return /* @__PURE__ */ jsx(IconComponent, { ...props });
859
+ };
860
+ const InteractiveSurface = (props) => {
861
+ const { InteractiveSurface: InteractiveSurfaceComponent } = useAgentsComponents();
862
+ return /* @__PURE__ */ jsx(InteractiveSurfaceComponent, { ...props });
863
+ };
864
+ const Skeleton = (props) => {
865
+ const { Skeleton: SkeletonComponent } = useAgentsComponents();
866
+ return /* @__PURE__ */ jsx(SkeletonComponent, { ...props });
867
+ };
868
+ const LoadingSpinner = (props) => {
869
+ const { LoadingSpinner: LoadingSpinnerComponent } = useAgentsComponents();
870
+ return /* @__PURE__ */ jsx(LoadingSpinnerComponent, { ...props });
871
+ };
872
+ const Tooltip = (props) => {
873
+ const { Tooltip: TooltipComponent } = useAgentsComponents();
874
+ return /* @__PURE__ */ jsx(TooltipComponent, { ...props });
875
+ };
876
+ const GlowFrame = (props) => {
877
+ const { GlowFrame: GlowFrameComponent } = useAgentsComponents();
878
+ return /* @__PURE__ */ jsx(GlowFrameComponent, { ...props });
879
+ };
880
+ const ProgressBar = (props) => {
881
+ const { ProgressBar: ProgressBarComponent } = useAgentsComponents();
882
+ return /* @__PURE__ */ jsx(ProgressBarComponent, { ...props });
883
+ };
884
+ const SplitView = (props) => {
885
+ const { SplitView: SplitViewComponent } = useAgentsComponents();
886
+ return /* @__PURE__ */ jsx(SplitViewComponent, { ...props });
887
+ };
888
+ const TrendDelta = (props) => {
889
+ const { TrendDelta: TrendDeltaComponent } = useAgentsComponents();
890
+ return /* @__PURE__ */ jsx(TrendDeltaComponent, { ...props });
891
+ };
892
+ const Checkbox = (props) => {
893
+ const { Checkbox: CheckboxComponent } = useAgentsComponents();
894
+ return /* @__PURE__ */ jsx(CheckboxComponent, { ...props });
895
+ };
896
+ const TextInput = (props) => {
897
+ const { TextInput: TextInputComponent } = useAgentsComponents();
898
+ return /* @__PURE__ */ jsx(TextInputComponent, { ...props });
899
+ };
900
+ const TextArea = (props) => {
901
+ const { TextArea: TextAreaComponent } = useAgentsComponents();
902
+ return /* @__PURE__ */ jsx(TextAreaComponent, { ...props });
903
+ };
904
+ const RangeSlider = (props) => {
905
+ const { RangeSlider: RangeSliderComponent } = useAgentsComponents();
906
+ return /* @__PURE__ */ jsx(RangeSliderComponent, { ...props });
907
+ };
908
+ const DateInput = (props) => {
909
+ const { DateInput: DateInputComponent } = useAgentsComponents();
910
+ return /* @__PURE__ */ jsx(DateInputComponent, { ...props });
911
+ };
912
+ const RadioGroup = (props) => {
913
+ const { RadioGroup: RadioGroupComponent } = useAgentsComponents();
914
+ return /* @__PURE__ */ jsx(RadioGroupComponent, { ...props });
915
+ };
916
+ const Select = (props) => {
917
+ const { Select: SelectComponent } = useAgentsComponents();
918
+ return /* @__PURE__ */ jsx(SelectComponent, { ...props });
919
+ };
920
+ const Tabs = (props) => {
921
+ const { Tabs: TabsComponent } = useAgentsComponents();
922
+ return /* @__PURE__ */ jsx(TabsComponent, { ...props });
923
+ };
924
+ const StatusBadge = (props) => {
925
+ const { StatusBadge: StatusBadgeComponent } = useAgentsComponents();
926
+ return /* @__PURE__ */ jsx(StatusBadgeComponent, { ...props });
927
+ };
928
+ const Map = (props) => {
929
+ const { Map: MapComponent } = useAgentsComponents();
930
+ return /* @__PURE__ */ jsx(MapComponent, { ...props });
931
+ };
932
+ const MapMarker = (props) => {
933
+ const { MapMarker: MapMarkerComponent } = useAgentsComponents();
934
+ return /* @__PURE__ */ jsx(MapMarkerComponent, { ...props });
935
+ };
936
+ const ModalLayer = (props) => {
937
+ const { ModalLayer: ModalLayerComponent } = useAgentsComponents();
938
+ return /* @__PURE__ */ jsx(ModalLayerComponent, { ...props });
939
+ };
940
+ const HeroRow = (props) => {
941
+ const { HeroRow: HeroRowComponent } = useAgentsComponents();
942
+ return /* @__PURE__ */ jsx(HeroRowComponent, { ...props });
943
+ };
944
+ const HeroValue = (props) => {
945
+ const { HeroValue: HeroValueComponent } = useAgentsComponents();
946
+ return /* @__PURE__ */ jsx(HeroValueComponent, { ...props });
947
+ };
948
+ const WidgetText = (props) => {
949
+ const { WidgetText: WidgetTextComponent } = useAgentsComponents();
950
+ return /* @__PURE__ */ jsx(WidgetTextComponent, { ...props });
951
+ };
952
+ const SkeletonText = (props) => {
953
+ const { SkeletonText: SkeletonTextComponent } = useAgentsComponents();
954
+ return /* @__PURE__ */ jsx(SkeletonTextComponent, { ...props });
955
+ };
956
+ const StatusChip = (props) => {
957
+ const { StatusChip: StatusChipComponent } = useAgentsComponents();
958
+ return /* @__PURE__ */ jsx(StatusChipComponent, { ...props });
959
+ };
960
+ const SegmentBar = (props) => {
961
+ const { SegmentBar: SegmentBarComponent } = useAgentsComponents();
962
+ return /* @__PURE__ */ jsx(SegmentBarComponent, { ...props });
963
+ };
964
+ const Markdown = (props) => {
965
+ const { Markdown: MarkdownComponent } = useAgentsComponents();
966
+ return /* @__PURE__ */ jsx(MarkdownComponent, { ...props });
967
+ };
968
+ const WidgetFeatureGate = (props) => {
969
+ const { WidgetFeatureGate: WidgetFeatureGateComponent } = useAgentsComponents();
970
+ return /* @__PURE__ */ jsx(WidgetFeatureGateComponent, { ...props });
971
+ };
972
+ const ConversationSearchResultsList = (props) => {
973
+ const { ConversationSearchResultsList: ConversationSearchResultsListComponent } = useAgentsComponents();
974
+ return /* @__PURE__ */ jsx(ConversationSearchResultsListComponent, { ...props });
975
+ };
976
+ export {
977
+ translateText as $,
978
+ AgentsProvider as A,
979
+ Button as B,
980
+ Checkbox as C,
981
+ DEFAULT_AGENTS_TEXTS as D,
982
+ escapePlainTextForText as E,
983
+ getAgentDisplayName as F,
984
+ GlowFrame as G,
985
+ HeroRow as H,
986
+ Icon as I,
987
+ getAgentsEnvironment as J,
988
+ getFurtherCanvasBehaviours as K,
989
+ LoadingSpinner as L,
990
+ Map as M,
991
+ getFurtherWidgetClickSignalSources as N,
992
+ getGoogleMapWidgetNames as O,
993
+ ProgressBar as P,
994
+ getSandboxLegacyAliases as Q,
995
+ RadioGroup as R,
996
+ SegmentBar as S,
997
+ Tabs as T,
998
+ getWidgetImageCaptureReadPathPrefix as U,
999
+ getWidgetSelfHydrationKeyFieldName as V,
1000
+ WidgetFeatureGate as W,
1001
+ openImageGallery as X,
1002
+ reportRunningTurn as Y,
1003
+ reportWidgetCrash as Z,
1004
+ setAgentsEnvironment as _,
1005
+ ConversationSearchResultsList as a,
1006
+ useAgentsActiveAgentSpaceKey as a0,
1007
+ useAgentsBudgetLimit as a1,
1008
+ useAgentsComponents as a2,
1009
+ useAgentsEnvironment as a3,
1010
+ useAgentsMapsLoader as a4,
1011
+ useAgentsOwnerSettings as a5,
1012
+ useAgentsStateDispatch as a6,
1013
+ useAgentsStateSelector as a7,
1014
+ useAgentsTexts as a8,
1015
+ AgentsWidgetHydrationStateContainer as a9,
1016
+ WidgetHydrationReducer as aa,
1017
+ WidgetHydrationSlice as ab,
1018
+ createAgentsWidgetHydrationStateStore as ac,
1019
+ getDefaultAgentsStateStore as ad,
1020
+ DEFAULT_WIDGET_IMAGE_CAPTURE_READ_PATH_PREFIX as b,
1021
+ DEFAULT_WIDGET_SELF_HYDRATION_KEY_FIELD_NAME as c,
1022
+ DateInput as d,
1023
+ HeroValue as e,
1024
+ InteractiveSurface as f,
1025
+ MapMarker as g,
1026
+ Markdown as h,
1027
+ ModalLayer as i,
1028
+ RangeSlider as j,
1029
+ Select as k,
1030
+ Skeleton as l,
1031
+ SkeletonText as m,
1032
+ SplitView as n,
1033
+ StatusBadge as o,
1034
+ StatusChip as p,
1035
+ Text as q,
1036
+ TextArea as r,
1037
+ TextInput as s,
1038
+ Tooltip as t,
1039
+ TrendDelta as u,
1040
+ WidgetText as v,
1041
+ appendAnotherAgentSpaceToOwnerText as w,
1042
+ buildUnnamedAgentSpaceLabel as x,
1043
+ buildWidgetOfAnotherAgentSpaceExplanation as y,
1044
+ classNames as z
1045
+ };
1046
+ //# sourceMappingURL=index-7Qc_3GbG.js.map