@arcgis/ai-components 5.2.0-next.1 → 5.2.0-next.11

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 (162) hide show
  1. package/dist/agent-utils/FunctionAgent.d.ts +2 -2
  2. package/dist/agent-utils/LLMAgent.d.ts +2 -2
  3. package/dist/agent-utils/LLMAgent.js +22 -22
  4. package/dist/agent-utils/WorkflowAgent.d.ts +2 -2
  5. package/dist/agent-utils/index.d.ts +99 -0
  6. package/dist/agent-utils/index.js +148 -0
  7. package/dist/agent-utils/middlewares/trace.js +25 -33
  8. package/dist/agent-utils/tools/FunctionTool.d.ts +2 -2
  9. package/dist/agent-utils/types.d.ts +30 -1
  10. package/dist/agent-utils/workflows/ConditionalWorkflow.d.ts +2 -2
  11. package/dist/agent-utils/workflows/LoopWorkflow.d.ts +2 -2
  12. package/dist/agent-utils/workflows/ParallelWorkflow.d.ts +2 -2
  13. package/dist/agent-utils/workflows/RouterWorkflow.d.ts +2 -2
  14. package/dist/agent-utils/workflows/SequentialWorkflow.d.ts +2 -2
  15. package/dist/agent-utils/workflows/SwitchWorkflow.d.ts +2 -2
  16. package/dist/cdn/{V2P4AIGG.js → 24QNMEFG.js} +1 -1
  17. package/dist/cdn/{NAUXSHIE.js → 34SG44C3.js} +2 -2
  18. package/dist/cdn/3JGWGKT6.js +2 -0
  19. package/dist/cdn/3NBDVZ2I.js +2 -0
  20. package/dist/cdn/3VOQD2MR.js +2 -0
  21. package/dist/cdn/434TAA3J.js +2 -0
  22. package/dist/cdn/53NTYC4I.js +2 -0
  23. package/dist/cdn/{4HU7735A.js → 5CV7R5IS.js} +6 -4
  24. package/dist/cdn/{AMP6IALT.js → 5W7S2RS4.js} +1 -1
  25. package/dist/cdn/{FL4W4VYN.js → 6ZW7Z36F.js} +16 -0
  26. package/dist/cdn/7CYGX4F4.js +2 -0
  27. package/dist/cdn/{DHOVCT6R.js → AZGGTNA3.js} +1 -1
  28. package/dist/cdn/B7WJFBOZ.js +2 -0
  29. package/dist/cdn/BX7FSMUU.js +56 -0
  30. package/dist/cdn/CHPQM77M.js +181 -0
  31. package/dist/cdn/DHKUXLU3.js +179 -0
  32. package/dist/cdn/DQSEBKOX.js +2 -0
  33. package/dist/cdn/DXVU45KM.js +2 -0
  34. package/dist/cdn/{P6OPJQMC.js → DZ2QWNUA.js} +1 -1
  35. package/dist/cdn/EBISDZ5H.js +2 -0
  36. package/dist/cdn/{MDVYQQUG.js → ERL2CB2Y.js} +5 -5
  37. package/dist/cdn/F6QHMKF5.js +2 -0
  38. package/dist/cdn/FUIGPHBH.js +2 -0
  39. package/dist/cdn/{AO7BQHKC.js → H2CHHGGH.js} +1 -1
  40. package/dist/cdn/{OH64RMOR.js → HWKDNS4K.js} +2 -2
  41. package/dist/cdn/IMQ4TVHF.js +16 -0
  42. package/dist/cdn/IOD3GDA7.js +2 -0
  43. package/dist/cdn/IR7PTESF.js +2 -0
  44. package/dist/cdn/IRZDTYO2.js +2 -0
  45. package/dist/cdn/JIWK6QK6.js +2 -0
  46. package/dist/cdn/{S6W6HV4T.js → JLKGS6Y5.js} +12 -12
  47. package/dist/cdn/K3JCH4XW.js +2 -0
  48. package/dist/cdn/KHXUWZHB.js +2 -0
  49. package/dist/cdn/LIFK3QSD.js +2 -0
  50. package/dist/cdn/NXKKG5TK.js +2 -0
  51. package/dist/cdn/{FX5JFRDL.js → O3EN27N5.js} +1 -1
  52. package/dist/cdn/O3RFFPU3.js +6 -0
  53. package/dist/cdn/P7DG5T3Z.js +9 -0
  54. package/dist/cdn/PBO6FZN6.js +2 -0
  55. package/dist/cdn/Q3ZW4FYA.js +3 -0
  56. package/dist/cdn/Q6LRANX6.js +2 -0
  57. package/dist/cdn/Q7TL5Q5N.js +2 -0
  58. package/dist/cdn/QCSN44H4.js +2 -0
  59. package/dist/cdn/R56X6ZKR.js +161 -0
  60. package/dist/cdn/{HB5A5R2E.js → RUURNLTP.js} +1 -1
  61. package/dist/cdn/T43LEBBE.js +47 -0
  62. package/dist/cdn/{ZLXN7NMF.js → T537PKP4.js} +9 -7
  63. package/dist/cdn/TR4GFL7X.js +2 -0
  64. package/dist/cdn/{3PKJWIC3.js → UPEEHMSY.js} +1 -1
  65. package/dist/cdn/WAIFKDR3.js +2 -0
  66. package/dist/cdn/WNS5ZUF5.js +2 -0
  67. package/dist/cdn/X4XY5HIE.js +2 -0
  68. package/dist/cdn/XOH56EQ2.js +2 -0
  69. package/dist/cdn/XON27U6U.js +2 -0
  70. package/dist/cdn/{H7422XUG.js → YLN2BZ5J.js} +1 -1
  71. package/dist/cdn/{2AXF774U.js → YUKR4AZW.js} +1 -1
  72. package/dist/cdn/{JY6LLOUJ.js → Z2G7MP5L.js} +3 -3
  73. package/dist/cdn/ZEYIBYSF.js +66 -0
  74. package/dist/cdn/agent-utils/index.js +2 -0
  75. package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +3 -0
  76. package/dist/cdn/agent-utils/middlewares/middleware.js +2 -0
  77. package/dist/cdn/agent-utils/middlewares/trace.js +2 -0
  78. package/dist/cdn/index.js +1 -1
  79. package/dist/cdn/main.css +1 -1
  80. package/dist/chunks/adapter.js +1390 -1323
  81. package/dist/chunks/arcgisKnowledgeGraph.js +109 -72
  82. package/dist/chunks/dataExplorationGraph.js +108 -96
  83. package/dist/chunks/generateLayerDescriptions.js +206 -168
  84. package/dist/chunks/helpGraph.js +16 -13
  85. package/dist/chunks/index.js +11 -0
  86. package/dist/chunks/intent_prompt.js +16 -0
  87. package/dist/chunks/layerStylingGraph.js +23 -20
  88. package/dist/chunks/navigationGraph.js +34 -30
  89. package/dist/chunks/orchestrator.js +241 -201
  90. package/dist/chunks/slottableRequestUtils.js +3 -7
  91. package/dist/chunks/summarize_query_response_prompt.js +9 -7
  92. package/dist/chunks/toolCallResponse.js +5 -3
  93. package/dist/components/arcgis-assistant/customElement.d.ts +15 -0
  94. package/dist/components/arcgis-assistant/customElement.js +228 -127
  95. package/dist/components/arcgis-assistant/index.js +2 -3
  96. package/dist/components/arcgis-assistant/types.d.ts +14 -1
  97. package/dist/components/arcgis-assistant-chat/customElement.d.ts +8 -2
  98. package/dist/components/arcgis-assistant-chat/customElement.js +7 -7
  99. package/dist/components/arcgis-assistant-chat-entry/customElement.d.ts +4 -1
  100. package/dist/components/arcgis-assistant-chat-entry/customElement.js +25 -18
  101. package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +1 -0
  102. package/dist/components/arcgis-assistant-help-agent/customElement.js +1 -0
  103. package/dist/components/arcgis-assistant-interrupt/customElement.d.ts +4 -1
  104. package/dist/components/arcgis-assistant-interrupt/customElement.js +13 -9
  105. package/dist/components/arcgis-assistant-interrupt-preview/customElement.js +20 -0
  106. package/dist/components/arcgis-assistant-interrupt-preview/index.js +2 -0
  107. package/dist/components/arcgis-assistant-knowledge-agent/customElement.d.ts +7 -7
  108. package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +1 -0
  109. package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +1 -0
  110. package/dist/components/arcgis-assistant-message/customElement.d.ts +23 -0
  111. package/dist/components/arcgis-assistant-message/customElement.js +28 -26
  112. package/dist/components/arcgis-assistant-message/index.d.ts +1 -0
  113. package/dist/components/arcgis-assistant-message/index.js +2 -0
  114. package/dist/components/arcgis-assistant-message-block/customElement.d.ts +1 -1
  115. package/dist/components/arcgis-assistant-message-block/customElement.js +18 -11
  116. package/dist/components/arcgis-assistant-message-block/index.js +1 -0
  117. package/dist/components/arcgis-assistant-message-feedback/customElement.d.ts +4 -1
  118. package/dist/components/arcgis-assistant-message-footer/customElement.d.ts +4 -1
  119. package/dist/components/arcgis-assistant-message-loading/customElement.d.ts +8 -1
  120. package/dist/components/arcgis-assistant-message-loading/customElement.js +8 -8
  121. package/dist/components/arcgis-assistant-message-loading/index.js +1 -0
  122. package/dist/components/arcgis-assistant-message-log/customElement.d.ts +4 -1
  123. package/dist/components/arcgis-assistant-message-read-aloud/customElement.d.ts +4 -1
  124. package/dist/components/arcgis-assistant-message-text/customElement.d.ts +4 -1
  125. package/dist/components/arcgis-assistant-navigation-agent/customElement.js +1 -0
  126. package/dist/components/arcgis-assistant-speech-input/customElement.d.ts +6 -1
  127. package/dist/components/arcgis-assistant-suggested-prompts/customElement.d.ts +4 -1
  128. package/dist/components/arcgis-assistant-suggested-prompts/customElement.js +8 -8
  129. package/dist/components/arcgis-assistant-user-message/customElement.d.ts +4 -1
  130. package/dist/components/arcgis-assistant-user-message/customElement.js +1 -1
  131. package/dist/docs/api.json +1 -1
  132. package/dist/docs/docs.json +1 -1
  133. package/dist/docs/vscode.html-custom-data.json +1 -1
  134. package/dist/docs/web-types.json +1 -1
  135. package/dist/index.d.ts +4 -0
  136. package/dist/loader.js +6 -5
  137. package/dist/orchestrator/registry/agentRegistry.d.ts +33 -0
  138. package/dist/types/lumina.d.ts +10 -4
  139. package/dist/types/preact.d.ts +11 -4
  140. package/dist/types/react.d.ts +12 -4
  141. package/dist/types/stencil.d.ts +10 -4
  142. package/dist/utils/index.d.ts +87 -43
  143. package/dist/utils/index.js +54 -49
  144. package/package.json +8 -7
  145. package/dist/cdn/462JBSEV.js +0 -422
  146. package/dist/cdn/7BCR6TUO.js +0 -2
  147. package/dist/cdn/7GH7VSB2.js +0 -2
  148. package/dist/cdn/7PLV4QH6.js +0 -2
  149. package/dist/cdn/DDLZOMUY.js +0 -2
  150. package/dist/cdn/FHVXO2WG.js +0 -166
  151. package/dist/cdn/GSEPHN3A.js +0 -106
  152. package/dist/cdn/MH5RPXHM.js +0 -2
  153. package/dist/cdn/NVI3I46B.js +0 -2
  154. package/dist/cdn/OAVEHGB6.js +0 -2
  155. package/dist/cdn/ON2V5XI2.js +0 -3
  156. package/dist/cdn/QR54T33D.js +0 -2
  157. package/dist/cdn/RVOAPUBN.js +0 -2
  158. package/dist/cdn/SXDLXCIM.js +0 -2
  159. package/dist/cdn/USMDJUFS.js +0 -2
  160. package/dist/cdn/V5YEZSRY.js +0 -16
  161. package/dist/cdn/Y333DGV6.js +0 -2
  162. package/dist/cdn/YY2SBO3V.js +0 -2
@@ -1,11 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- function a(e) {
3
- return `message-${e}`;
4
- }
5
- function o(e, t) {
6
- return `block-${e}-${t}`;
2
+ function e(o, t) {
3
+ return `block-${o}-${t}`;
7
4
  }
8
5
  export {
9
- o as a,
10
- a as g
6
+ e as g
11
7
  };
@@ -22,13 +22,15 @@ Use chat history only when necessary to understand conversational references, an
22
22
 
23
23
  ### Your goal:
24
24
 
25
- 1. If the assigned task is about a **specific calculation** (e.g., average, total, count, min, max), return only the **direct numeric answer** short and clear.
26
- - Example: “The average price is $4.00.”
27
- - When a value is already present in \`queryResponse\` (for example in \`details.value\` or \`summary\`), copy that value **verbatim**.
28
- - Do NOT reformat values (including numbers, dates, and times):
29
- - Do not add/remove grouping commas.
30
- - Do not change decimals, round values, or change numeric type/text.
31
- - Do not change date/time format, timezone notation, separators, or precision.
25
+ 1. If the assigned task is about a **specific calculation** (e.g., average, total, count, min, max), return a **single concise sentence** that includes the numeric result.
26
+
27
+ - Example: “The average price is $4.00.”
28
+ - Never return a bare number by itself (for example: \`4\`).
29
+ - When a value is already present in \`queryResponse\` (for example in \`details.value\` or \`summary\`), copy that value **verbatim**.
30
+ - Do NOT reformat values (including numbers, dates, and times):
31
+ - Do not add/remove grouping commas.
32
+ - Do not change decimals, round values, or change numeric type/text.
33
+ - Do not change date/time format, timezone notation, separators, or precision.
32
34
 
33
35
  2. If the question is more general or there are **multiple features with varying attributes**, write a **brief summary** (2–3 sentences max) that highlights key patterns or insights.
34
36
 
@@ -2,14 +2,16 @@
2
2
  import "@arcgis/core/identity/IdentityManager.js";
3
3
  import "@arcgis/core/portal/Portal.js";
4
4
  import "@langchain/langgraph/web";
5
- import { s as r } from "./generateLayerDescriptions.js";
5
+ import "./generateLayerDescriptions.js";
6
6
  import "@langchain/core/messages";
7
+ import { s as r } from "./index.js";
7
8
  import "@langchain/openai";
9
+ import "@arcgis/core/config.js";
8
10
  import "@arcgis/core/core/reactiveUtils.js";
9
11
  import "@arcgis/core/layers/FeatureLayer.js";
10
12
  import "@arcgis/core/request.js";
11
13
  import "@langchain/core/prompts";
12
- const u = async (t, o) => {
14
+ const y = async (t, o) => {
13
15
  const a = t.tool_calls ?? [];
14
16
  if (a.length === 0) {
15
17
  await r({ text: `LLM did not request any tool calls: ${String(t?.content)}` }, o);
@@ -25,5 +27,5 @@ const u = async (t, o) => {
25
27
  );
26
28
  };
27
29
  export {
28
- u as h
30
+ y as h
29
31
  };
@@ -89,6 +89,13 @@ export abstract class ArcgisAssistant extends LitElement {
89
89
  stopButtonLabel: string;
90
90
  askButtonLabel: string;
91
91
  }>;
92
+ /**
93
+ * When `true`, disables the assistant avatar in the chat interface.
94
+ *
95
+ * @default false
96
+ * @since 5.1
97
+ */
98
+ accessor assistantAvatarEnabled: boolean;
92
99
  /**
93
100
  * Indicates whether the assistant is currently processing a user message.
94
101
  * This value is `true` while the assistant is generating a response and `false` when idle.
@@ -454,6 +461,13 @@ export abstract class ArcgisAssistant extends LitElement {
454
461
  * ```
455
462
  */
456
463
  readonly arcgisReady: import("@arcgis/lumina").TargetedEvent<this, void>;
464
+ /**
465
+ * Emitted when the assistant generates a response to a user message. The event detail includes an AssistantMessage object that contains the assistant's response,
466
+ * along with any relevant logs or errors. This allows app developers to capture the assistant's responses.
467
+ *
468
+ * @since 5.1
469
+ */
470
+ readonly arcgisResponse: import("@arcgis/lumina").TargetedEvent<this, AssistantMessage>;
457
471
  /**
458
472
  * Emitted when the assistant requests custom slotted content for an assistant message.
459
473
  *
@@ -508,6 +522,7 @@ export abstract class ArcgisAssistant extends LitElement {
508
522
  arcgisInterruptSubmit: ArcgisAssistant["arcgisInterruptSubmit"]["detail"];
509
523
  arcgisPromptSelect: ArcgisAssistant["arcgisPromptSelect"]["detail"];
510
524
  arcgisReady: ArcgisAssistant["arcgisReady"]["detail"];
525
+ arcgisResponse: ArcgisAssistant["arcgisResponse"]["detail"];
511
526
  arcgisSlottableRequest: ArcgisAssistant["arcgisSlottableRequest"]["detail"];
512
527
  arcgisSubmit: ArcgisAssistant["arcgisSubmit"]["detail"];
513
528
  };
@@ -1,35 +1,56 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { c as $ } from "../../chunks/runtime.js";
3
- import { css as k, html as a } from "lit";
4
- import S from "@arcgis/core/core/Collection.js";
5
- import { whenOnce as C, watch as L, when as I } from "@arcgis/core/core/reactiveUtils.js";
6
- import P from "@arcgis/core/portal/Portal.js";
7
- import { LitElement as R, createEvent as o, nothing as b } from "@arcgis/lumina";
8
- import { rethrowError as x } from "@arcgis/toolkit/log";
9
- import { createRef as f, ref as y } from "lit/directives/ref.js";
3
+ import { css as C, html as l } from "lit";
4
+ import I from "@arcgis/core/core/Collection.js";
5
+ import { whenOnce as P, watch as A, when as x } from "@arcgis/core/core/reactiveUtils.js";
6
+ import L from "@arcgis/core/portal/Portal.js";
7
+ import { LitElement as R, createEvent as g, nothing as k } from "@arcgis/lumina";
8
+ import { rethrowError as O } from "@arcgis/toolkit/log";
9
+ import { createRef as _, ref as v } from "lit/directives/ref.js";
10
10
  import { u as M } from "../../chunks/useT9n.js";
11
- import { O } from "../../chunks/orchestrator.js";
11
+ import { O as D } from "../../chunks/orchestrator.js";
12
12
  import "@langchain/core/callbacks/dispatch/web";
13
13
  import "@langchain/core/prompts";
14
14
  import "@langchain/openai";
15
- import "@arcgis/core/identity/IdentityManager.js";
15
+ import T from "@arcgis/core/identity/IdentityManager.js";
16
+ import "@arcgis/core/config.js";
16
17
  import "@langchain/core/messages";
17
18
  import "@arcgis/core/layers/FeatureLayer.js";
18
19
  import "../../chunks/generateLayerDescriptions.js";
19
20
  import "@langchain/langgraph/web";
20
- import A from "@arcgis/core/core/Accessor.js";
21
- import { property as u, subclass as q } from "@arcgis/core/core/accessorSupport/decorators.js";
22
- import { g as z } from "../../chunks/utils3.js";
23
- import { g as v, a as _ } from "../../chunks/slottableRequestUtils.js";
24
- const V = k`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%)}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}`;
25
- var N = Object.defineProperty, j = Object.getOwnPropertyDescriptor, h = (p, t, e, i) => {
26
- for (var s = i > 1 ? void 0 : i ? j(t, e) : t, r = p.length - 1, n; r >= 0; r--)
27
- (n = p[r]) && (s = (i ? n(t, e, s) : n(s)) || s);
28
- return i && s && N(t, e, s), s;
21
+ import N from "@arcgis/core/core/Accessor.js";
22
+ import { property as b, subclass as B } from "@arcgis/core/core/accessorSupport/decorators.js";
23
+ import { g as V } from "../../chunks/utils3.js";
24
+ import { g as w } from "../../chunks/slottableRequestUtils.js";
25
+ const z = C`:host{display:block;width:var(--arcgis-internal-panel-width, 100%);height:var(--arcgis-internal-expand-max-height, 100%);--calcite-panel-content-bottom-space: 0}.footer-container{display:flex;flex-direction:column;flex:1 1 0;gap:var(--calcite-spacing-md)}.content-container{display:flex;flex-direction:column;flex:1 1 0;min-height:0;position:relative;overflow:auto}.suggested-prompts-container{display:flex;justify-content:center;width:100%;background:var(--calcite-panel-background-color, var(--calcite-color-background))}.suggested-prompts{display:block;padding:var(--calcite-spacing-md);max-width:100%;box-sizing:border-box}.error-notice{padding:var(--calcite-spacing-sm)}.interrupt-waiting-message{font-style:italic;color:var(--calcite-color-text-2)}`;
26
+ var H = Object.defineProperty, j = Object.getOwnPropertyDescriptor, m = (c, t, e, i) => {
27
+ for (var r = i > 1 ? void 0 : i ? j(t, e) : t, n = c.length - 1, s; n >= 0; n--)
28
+ (s = c[n]) && (r = (i ? s(t, e, r) : s(r)) || r);
29
+ return i && r && H(t, e, r), r;
29
30
  };
30
- let l = class extends A {
31
- constructor(p) {
32
- super(p), this.view = null, this.loading = !1, this.processing = !1, this.processingStep = "";
31
+ const q = async (c) => await new Promise((t) => setTimeout(t, c));
32
+ async function* F(c, {
33
+ chunkSize: t = 5,
34
+ // chars per "token"
35
+ delay: e = 20
36
+ // ms between chunks
37
+ } = {}) {
38
+ let i = 0;
39
+ for (; i < c.length; )
40
+ yield c.slice(i, i + t), i += t, await q(e);
41
+ }
42
+ async function* E(c, t, e, i) {
43
+ for await (const r of F(c)) {
44
+ if (i?.aborted) {
45
+ yield { type: "cancelled", log: e, runId: t };
46
+ return;
47
+ }
48
+ yield { type: "block-data", blockType: "text", data: { content: r }, runId: t };
49
+ }
50
+ }
51
+ let d = class extends N {
52
+ constructor(c) {
53
+ super(c), this.view = null, this.loading = !1, this.processing = !1, this.processingStep = "";
33
54
  }
34
55
  async load() {
35
56
  this._set("loading", !0);
@@ -43,14 +64,14 @@ let l = class extends A {
43
64
  this.orchestrator?.dispose(), super.destroy();
44
65
  }
45
66
  async _initialize() {
46
- this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await C(() => !this.view.updating), this._set(
67
+ this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await P(() => !this.view.updating), this._set(
47
68
  "orchestrator",
48
- await O.init({
69
+ await D.init({
49
70
  agents: [...this.agents],
50
71
  view: this.view ?? void 0
51
72
  })
52
73
  ), this.addHandles([
53
- L(
74
+ A(
54
75
  () => [this.view, this.agents],
55
76
  () => {
56
77
  this._initialize();
@@ -61,108 +82,122 @@ let l = class extends A {
61
82
  clearChatHistory() {
62
83
  this.orchestrator?.newConversation();
63
84
  }
64
- async *ask(p, t) {
85
+ async *ask(c, t) {
65
86
  if (!this.orchestrator)
66
87
  throw new Error("Orchestrator not initialized yet.");
67
88
  this._set("processing", !0), this._set("processingStep", "");
68
89
  const e = [];
69
90
  let i;
70
91
  try {
71
- const s = this.orchestrator.ask(p);
72
- for await (const r of s) {
73
- const n = r.runId;
74
- if (t?.aborted) {
75
- yield { type: "cancelled", runId: n };
76
- break;
77
- }
78
- switch (r.type) {
92
+ const r = this.orchestrator.ask(c);
93
+ for await (const n of r) {
94
+ const s = n.runId;
95
+ switch (n.type) {
79
96
  case "trace": {
80
- this._set("processingStep", r.data.text), e.push(r.data.text);
97
+ this._set("processingStep", n.data.text), e.push(n.data.text);
81
98
  break;
82
99
  }
83
100
  case "completed": {
84
- const c = r.result, g = !!c.content.length, m = !!i?.length;
85
- if (!g && !m) {
86
- yield { type: "completed", error: "Could not process the request.", log: e, runId: n };
101
+ this._set("processing", !1), this._set("processingStep", "");
102
+ const a = n.result, o = !!a.content.length, h = !!i?.length;
103
+ if (!o && !h) {
104
+ yield { type: "completed", error: "No response received.", log: e, runId: s };
87
105
  return;
88
106
  }
89
- const d = c.content;
90
- this._set("processingStep", ""), yield { type: "completed", response: d, blocks: i, log: e, runId: n };
107
+ const p = a.content;
108
+ if (yield { type: "block-start", blockType: "text", runId: s }, yield* E(p, s, e, t), yield { type: "block-end", blockType: "text", runId: s }, h)
109
+ for (const f of i) {
110
+ if (t?.aborted) {
111
+ yield { type: "cancelled", log: e, runId: s };
112
+ return;
113
+ }
114
+ const { type: u, data: y } = f;
115
+ if (yield { type: "block-start", blockType: u, runId: s }, u === "text") {
116
+ const S = typeof y?.content == "string" ? y.content : "";
117
+ yield* E(S, s, e, t);
118
+ } else
119
+ yield { type: "block-data", blockType: u, data: y, runId: s };
120
+ yield { type: "block-end", blockType: u, runId: s };
121
+ }
122
+ yield { type: "completed", response: p, blocks: i, log: e, runId: s };
91
123
  return;
92
124
  }
93
125
  case "ux-suggestion": {
94
- const c = r.suggestion;
95
- i = i ? [...i, c] : [c];
126
+ const a = n.suggestion;
127
+ i = i ? [...i, a] : [a];
96
128
  break;
97
129
  }
98
130
  case "interrupt": {
99
- const { kind: c, message: g, metadata: m } = r.interrupt, d = Array.isArray(m) ? m.filter((E) => typeof E == "string") : [], w = (() => {
100
- switch (c) {
131
+ const { kind: a, message: o, metadata: h } = n.interrupt, p = Array.isArray(h) ? h.filter((u) => typeof u == "string") : [], f = (() => {
132
+ switch (a) {
101
133
  case "booleanChoice":
102
- return { type: "boolean-choice", message: g, options: d };
134
+ return { type: "boolean-choice", message: o, options: p };
103
135
  case "singleSelection":
104
- return { type: "single-select", message: g, options: d };
136
+ return { type: "single-select", message: o, options: p };
105
137
  case "multipleSelection":
106
- return { type: "multi-select", message: g, options: d };
138
+ return { type: "multi-select", message: o, options: p };
107
139
  case "textInput":
108
- return { type: "text-input", message: g };
140
+ return { type: "text-input", message: o };
109
141
  default:
110
- return { type: c, message: g, options: d };
142
+ return { type: a, message: o, options: p };
111
143
  }
112
144
  })();
113
- this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: w, runId: n };
145
+ this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: f, runId: s };
114
146
  break;
115
147
  }
116
148
  case "cancelled": {
117
- yield { type: "cancelled", runId: n };
149
+ yield { type: "cancelled", log: e, runId: s };
118
150
  return;
119
151
  }
120
152
  case "error": {
121
- yield { type: "completed", error: r.error.message, log: e, runId: n };
153
+ yield { type: "completed", error: n.error.message, log: e, runId: s };
122
154
  return;
123
155
  }
124
156
  default: {
125
- console.warn("Unknown event type:", r);
157
+ console.warn("Unknown event type:", n);
126
158
  break;
127
159
  }
128
160
  }
129
161
  }
130
- } catch (s) {
131
- console.warn("Error during message processing:", s), yield { type: "completed", error: "An error occurred during message processing.", log: e, runId: "error" };
162
+ } catch (r) {
163
+ console.warn("Error during message processing:", r), yield { type: "completed", error: "An error occurred during message processing.", log: e, runId: "error" };
132
164
  return;
133
165
  } finally {
134
166
  this._set("processing", !1);
135
167
  }
136
168
  }
169
+ cancel() {
170
+ this.orchestrator?.cancel();
171
+ }
137
172
  };
138
- h([
139
- u({ readOnly: !0 })
140
- ], l.prototype, "orchestrator", 2);
141
- h([
142
- u()
143
- ], l.prototype, "agents", 2);
144
- h([
145
- u()
146
- ], l.prototype, "portal", 2);
147
- h([
148
- u()
149
- ], l.prototype, "view", 2);
150
- h([
151
- u({ readOnly: !0 })
152
- ], l.prototype, "loading", 2);
153
- h([
154
- u({ readOnly: !0 })
155
- ], l.prototype, "processing", 2);
156
- h([
157
- u({ readOnly: !0 })
158
- ], l.prototype, "processingStep", 2);
159
- l = h([
160
- q("OrchestratorController")
161
- ], l);
162
- const B = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", H = "Embeddings not found for this web map.", D = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
163
- class F extends R {
173
+ m([
174
+ b({ readOnly: !0 })
175
+ ], d.prototype, "orchestrator", 2);
176
+ m([
177
+ b()
178
+ ], d.prototype, "agents", 2);
179
+ m([
180
+ b()
181
+ ], d.prototype, "portal", 2);
182
+ m([
183
+ b()
184
+ ], d.prototype, "view", 2);
185
+ m([
186
+ b({ readOnly: !0 })
187
+ ], d.prototype, "loading", 2);
188
+ m([
189
+ b({ readOnly: !0 })
190
+ ], d.prototype, "processing", 2);
191
+ m([
192
+ b({ readOnly: !0 })
193
+ ], d.prototype, "processingStep", 2);
194
+ d = m([
195
+ B("OrchestratorController")
196
+ ], d);
197
+ const G = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", U = "Embeddings not found for this web map.", W = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
198
+ class Y extends R {
164
199
  constructor() {
165
- super(...arguments), this._messages = M({ blocking: !0 }), this.#t = f(), this.#n = f(), this.#e = f(), this.#s = null, this.#o = /* @__PURE__ */ new Map(), this.#r = P.getDefault(), this.#i = (t) => {
200
+ super(...arguments), this._messages = M({ blocking: !0 }), this.#t = _(), this.#n = _(), this.#s = _(), this.#e = null, this.#o = /* @__PURE__ */ new Map(), this.#i = L.getDefault(), this.#r = (t) => {
166
201
  t.stopPropagation(), this.cancelInterrupt();
167
202
  }, this.#a = (t) => {
168
203
  t.stopPropagation();
@@ -173,11 +208,11 @@ class F extends R {
173
208
  const e = t.detail;
174
209
  this._inputValue = "", this.arcgisSubmit.emit(e), this.submitMessage(e);
175
210
  }, this.#c = (t) => {
176
- if (t.stopPropagation(), this.arcgisCancel.emit(), this._interrupt) {
211
+ if (this._canceling = !0, t.stopPropagation(), this.arcgisCancel.emit(), this._interrupt) {
177
212
  this.orchestrator?.cancelInterrupt(), this._interrupt = null;
178
213
  return;
179
214
  }
180
- this.#s?.abort();
215
+ this._orchestratorController?.cancel(), this.#e?.abort(), this.#e = null;
181
216
  }, this.#h = (t) => {
182
217
  t.stopPropagation();
183
218
  const e = t.detail;
@@ -188,43 +223,43 @@ class F extends R {
188
223
  this._inputValue = e.prompt, this.arcgisPromptSelect.emit(e);
189
224
  }, this.#g = (t) => {
190
225
  this.arcgisSlottableRequest.emit(t.detail);
191
- }, this._orchestratorController = null, this._interrupt = null, this._error = null, this._inputValue = "", this.messages = new S([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.arcgisCancel = o(), this.arcgisError = o(), this.arcgisFeedback = o(), this.arcgisInterrupt = o(), this.arcgisInterruptCancel = o(), this.arcgisInterruptSubmit = o(), this.arcgisPromptSelect = o(), this.arcgisReady = o(), this.arcgisSubmit = o(), this.arcgisSlottableRequest = o({ bubbles: !1, composed: !1 });
226
+ }, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new I([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.assistantAvatarEnabled = !1, this.arcgisCancel = g(), this.arcgisError = g(), this.arcgisFeedback = g(), this.arcgisInterrupt = g(), this.arcgisInterruptCancel = g(), this.arcgisInterruptSubmit = g(), this.arcgisPromptSelect = g(), this.arcgisReady = g(), this.arcgisSubmit = g(), this.arcgisSlottableRequest = g({ bubbles: !1, composed: !1 }), this.arcgisResponse = g();
192
227
  }
193
228
  static {
194
- this.properties = { _orchestratorController: 16, _interrupt: 16, _error: 16, _inputValue: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5 };
229
+ this.properties = { _orchestratorController: 16, _interrupt: 16, _interruptDetails: 16, _error: 16, _inputValue: 16, _isAnswering: 16, _canceling: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5 };
195
230
  }
196
231
  static {
197
- this.styles = V;
232
+ this.styles = z;
198
233
  }
199
234
  #t;
200
235
  #n;
201
- #e;
202
236
  #s;
237
+ #e;
203
238
  #o;
204
- #r;
205
239
  #i;
240
+ #r;
206
241
  #a;
207
242
  #l;
208
243
  #c;
209
244
  #h;
210
245
  #p;
211
246
  #g;
212
- async #u() {
247
+ async #d() {
213
248
  try {
214
- const t = z(this.el, this.referenceElement);
249
+ const t = V(this.el, this.referenceElement);
215
250
  await t?.componentOnReady();
216
251
  const e = [...this.#o.values()];
217
- return e.length ? (this._orchestratorController = new l({
252
+ return e.length ? (this._orchestratorController = new d({
218
253
  agents: e,
219
- portal: this.#r,
254
+ portal: this.#i,
220
255
  view: t?.view
221
256
  }), await this._orchestratorController.load(), !0) : (this._error = "No agents found.", !1);
222
257
  } catch (t) {
223
- return this._error = t?.message ?? "Error initializing orchestrator.", x(this)(t), !1;
258
+ return this._error = t?.message ?? "Error initializing orchestrator.", O(this)(t), !1;
224
259
  }
225
260
  }
226
261
  get _user() {
227
- return this.#r?.user?.fullName || this.#r?.user?.username;
262
+ return this.#i?.user?.fullName || this.#i?.user?.username;
228
263
  }
229
264
  get awaitingResponse() {
230
265
  return this._orchestratorController?.processing ?? !1;
@@ -256,35 +291,91 @@ class F extends R {
256
291
  content: e
257
292
  }), !this._orchestratorController))
258
293
  return;
259
- const i = this._orchestratorController.ask(e, this.#s?.signal);
260
- for await (const s of i) {
261
- const r = s.runId;
262
- switch (s.type) {
294
+ this.#e = new AbortController();
295
+ const i = this._orchestratorController.ask(e, this.#e?.signal);
296
+ for await (const r of i) {
297
+ const n = r.runId, s = this.messages.at(-1);
298
+ switch (r.type) {
299
+ case "block-start": {
300
+ this._isAnswering = !0;
301
+ const a = { type: r.blockType, isPending: !0 };
302
+ if (s?.role === "assistant" && s.id === n) {
303
+ const o = [...s.blocks ?? [], a];
304
+ this.messages.splice(-1, 1, { ...s, blocks: o });
305
+ } else
306
+ this.messages.push({
307
+ role: "assistant",
308
+ blocks: [a],
309
+ id: n,
310
+ isStreaming: !0,
311
+ interrupts: this._interruptDetails
312
+ }), this._interruptDetails = [];
313
+ break;
314
+ }
315
+ case "block-data": {
316
+ if (s?.role !== "assistant" || s?.id !== n)
317
+ break;
318
+ const a = [...s.blocks ?? []], o = a[a.length - 1], { blockType: h, data: p } = r;
319
+ if (o?.type !== h || !o.isPending)
320
+ break;
321
+ if (h === "text") {
322
+ const f = typeof o.data?.content == "string" ? o.data.content : "", u = typeof p?.content == "string" ? p.content : "";
323
+ a[a.length - 1] = { ...o, data: { ...o.data, content: f + u } };
324
+ } else
325
+ a[a.length - 1] = { ...o, data: { ...o.data, ...p ?? {} } };
326
+ this.messages.splice(-1, 1, { ...s, blocks: a });
327
+ break;
328
+ }
329
+ case "block-end": {
330
+ if (s?.role !== "assistant" || s?.id !== n)
331
+ break;
332
+ const a = [...s.blocks ?? []], o = a[a.length - 1];
333
+ if (o?.type !== r.blockType || !o.isPending)
334
+ break;
335
+ const h = o;
336
+ a[a.length - 1] = { ...h, data: { ...h.data }, isPending: !1 }, this.messages.splice(-1, 1, { ...s, blocks: a });
337
+ break;
338
+ }
263
339
  case "completed":
264
- this.messages.push({
340
+ r.error ? (this.messages.push({
265
341
  role: "assistant",
266
- content: s.response,
267
- blocks: s.blocks,
268
- log: s.log,
269
- error: s.error,
270
- id: r
271
- });
342
+ log: r.log,
343
+ error: r.error,
344
+ id: n,
345
+ interrupts: this._interruptDetails
346
+ }), this._interruptDetails = []) : s?.role === "assistant" && s.id === n && this.messages.splice(-1, 1, {
347
+ ...s,
348
+ content: r.response,
349
+ blocks: s.blocks?.map((a) => ({ ...a, isPending: !1 })) ?? [],
350
+ isStreaming: !1,
351
+ log: r.log
352
+ }), this._isAnswering = !1, this.#e = null, this._canceling = !1;
272
353
  break;
273
354
  case "interrupt":
274
- this._interrupt = { ...s.payload, id: r }, this.arcgisInterrupt.emit(this._interrupt);
355
+ this._interrupt = { ...r.payload, id: n }, this.arcgisInterrupt.emit(this._interrupt);
275
356
  break;
276
357
  case "cancelled":
277
- this.messages.push({
358
+ s?.role === "assistant" && s.id === n ? this.messages.splice(-1, 1, {
359
+ ...s,
360
+ blocks: s.blocks?.filter((a) => a.type === "text" || !a.isPending) ?? [],
361
+ isStreaming: !1,
362
+ log: r.log,
363
+ error: "(Stopped by user)"
364
+ // TODO: use strings from t9n
365
+ }) : (this.messages.push({
278
366
  role: "assistant",
279
- error: "Request cancelled.",
280
- id: r
281
- });
367
+ log: r.log,
368
+ error: "(Stopped by user)",
369
+ // TODO: use strings from t9n
370
+ id: n,
371
+ interrupts: this._interruptDetails
372
+ }), this._interruptDetails = []), this._isAnswering = !1, this.#e = null, this._canceling = !1;
282
373
  break;
283
374
  }
284
375
  }
285
376
  }
286
377
  submitInterrupt(t) {
287
- this.arcgisInterruptSubmit.emit(t), this.orchestrator?.resumeInterrupt(t), this._interrupt = null;
378
+ this.arcgisInterruptSubmit.emit(t), this._interrupt && (this._interruptDetails = [...this._interruptDetails, { interrupt: this._interrupt, response: t }]), this.orchestrator?.resumeInterrupt(t), this._interrupt = null;
288
379
  }
289
380
  load() {
290
381
  this.manager.onLifecycle(this._reset.bind(this));
@@ -292,38 +383,48 @@ class F extends R {
292
383
  loaded() {
293
384
  this.manager.onLifecycle(() => {
294
385
  this.#t.value?.addEventListener("arcgisPromptSelect", this.#p), this.#t.value?.addEventListener("arcgisSubmit", this.#l), this.#t.value?.addEventListener("arcgisCancel", this.#c), this.#t.value?.addEventListener("arcgisFeedback", this.#h);
295
- const t = I(() => !!this._interrupt && !!this.#e.value, () => {
296
- const e = this.#e.value;
297
- e.removeEventListener("arcgisSubmit", this.#a), e.removeEventListener("arcgisCancel", this.#i), e.addEventListener("arcgisSubmit", this.#a, { once: !0 }), e.addEventListener("arcgisCancel", this.#i, { once: !0 });
386
+ const t = x(() => !!this._interrupt && !!this.#s.value, () => {
387
+ const i = this.#s.value;
388
+ i.removeEventListener("arcgisSubmit", this.#a), i.removeEventListener("arcgisCancel", this.#r), i.addEventListener("arcgisSubmit", this.#a, { once: !0 }), i.addEventListener("arcgisCancel", this.#r, { once: !0 });
389
+ }), e = this.messages.on("after-add", (i) => {
390
+ const r = i.item;
391
+ r.role === "assistant" && (r.error || r.content) && this.arcgisResponse.emit(r);
298
392
  });
299
393
  return queueMicrotask(() => {
300
- this.#u().then((e) => {
301
- e ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
394
+ this.#d().then((i) => {
395
+ i ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
302
396
  });
303
397
  }), () => {
304
- t.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#p), this.#e.value?.removeEventListener("arcgisSubmit", this.#a), this.#e.value?.removeEventListener("arcgisCancel", this.#i), this.#t.value?.removeEventListener("arcgisSubmit", this.#l), this.#t.value?.removeEventListener("arcgisCancel", this.#c), this.#t.value?.removeEventListener("arcgisFeedback", this.#h), this._orchestratorController?.destroy(), this._orchestratorController = null;
398
+ t.remove(), e.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#p), this.#s.value?.removeEventListener("arcgisSubmit", this.#a), this.#s.value?.removeEventListener("arcgisCancel", this.#r), this.#t.value?.removeEventListener("arcgisSubmit", this.#l), this.#t.value?.removeEventListener("arcgisCancel", this.#c), this.#t.value?.removeEventListener("arcgisFeedback", this.#h), this._orchestratorController?.destroy(), this._orchestratorController = null;
305
399
  };
306
400
  });
307
401
  }
308
402
  _reset() {
309
- this.#s?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._inputValue = "";
403
+ this._orchestratorController?.cancel(), this.#e?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._inputValue = "";
310
404
  }
311
405
  _renderEntryMessage() {
312
- return this._interrupt ? a`<slot name=interrupt><arcgis-assistant-interrupt .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${y(this.#e)}></arcgis-assistant-interrupt></slot>` : this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : a`<calcite-notice open kind=info closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : a`<slot name=entry-message></slot>`;
406
+ return !this._user ? this._renderSignInNotice() : this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : l`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : l`<slot name=entry-message></slot>`;
313
407
  }
314
- _renderErrorNotice() {
315
- return this._error ? a`<calcite-notice closable slot=entry-message open kind=danger icon width=full>${this._error === B ? a`<div slot=message>${H}</div><calcite-link slot=link .href=${D} target=_blank title="Learn about web map embeddings">Read more</calcite-link>` : a`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
408
+ _renderSignInNotice() {
409
+ const t = this.#i;
410
+ return l`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>You need to sign in to use the assistant chat.</div>${t ? l`<calcite-link slot=link @click=${async () => {
411
+ try {
412
+ await T.getCredential(t.url), this._error = null, await this.#d(), this.arcgisReady.emit();
413
+ } catch (e) {
414
+ console.error("Error signing in:", e);
415
+ }
416
+ }} target=_blank title="Sign in to ArcGIS Online">Sign in</calcite-link>` : l`<div slot=link>No portal information available</div>`}</calcite-notice>`;
316
417
  }
317
- _renderSuggestedPrompts() {
318
- return this.suggestedPrompts?.length ? a`<div class="suggested-prompts-container"><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>` : null;
418
+ _renderErrorNotice() {
419
+ return this._error ? l`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error === G ? l`<div slot=message>${U}</div><calcite-link slot=link .href=${W} target=_blank title="Learn about web map embeddings">Read more</calcite-link>` : l`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
319
420
  }
320
421
  render() {
321
- return a`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${y(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map((t) => t.role === "assistant" ? a`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#g}><slot name=${v(t.id) ?? b} slot=${v(t.id) ?? b}>${t?.error ? a`<calcite-notice class="error-notice" open icon kind=warning width=full><div slot=message>${t.error}</div></calcite-notice>` : a`<arcgis-assistant-message-text .content=${t?.content}></arcgis-assistant-message-text>`}</slot>${t.blocks?.map((e, i) => a`<slot name=${_(t.id, i) ?? b} slot=${_(t.id, i) ?? b}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : a`<arcgis-assistant-user-message .message=${t} .user=${this._user}></arcgis-assistant-user-message>`)}</slot><slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep}></arcgis-assistant-message-loading></slot></arcgis-assistant-chat></div>${this._renderSuggestedPrompts()}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} ${y(this.#n)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse ? "circle-stop" : "send"} @click=${() => {
422
+ return l`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${v(this.#t)}><slot name=header-actions-start slot=header-actions-start></slot><slot name=header-actions-end slot=header-actions-end></slot><div class="content-container"><arcgis-assistant-chat .loading=${this.awaitingResponse} .messages=${this.messages} .interrupt=${this._interrupt}><slot name=message-starter slot=message-starter></slot><slot name=messages slot=messages>${this.messages.map((t) => t.role === "assistant" ? l`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#g} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((e, i) => l`<slot name=${w(t.id, i) ?? k} slot=${w(t.id, i) ?? k}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : l`<arcgis-assistant-user-message .message=${t} .user=${this._user}></arcgis-assistant-user-message>`)}</slot>${this._interrupt ? l`<div slot=message-loading><div class="interrupt-waiting-message">waiting for user input...</div> // TODO: use t9n strings</div>` : l`<slot name=message-loading slot=message-loading><arcgis-assistant-message-loading .loading=${this.awaitingResponse} .loadingMessage=${this.awaitingResponseStep} .assistantAvatarEnabled=${this.assistantAvatarEnabled} .interrupts=${this._interruptDetails}></arcgis-assistant-message-loading></slot>`}</arcgis-assistant-chat></div>${this._interrupt ? l`<arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${v(this.#s)}></arcgis-assistant-interrupt>` : this.suggestedPrompts?.length ? l`<div class="suggested-prompts-container" slot=content-bottom><arcgis-assistant-suggested-prompts class="suggested-prompts" .prompts=${this.suggestedPrompts}></arcgis-assistant-suggested-prompts></div>` : null}<div class="footer-container" slot=footer>${this._renderEntryMessage()}<slot name=chat-entry><arcgis-assistant-chat-entry .awaitingResponse=${this.awaitingResponse || this._isAnswering} .inputValue=${this._inputValue} .messages=${this.messages} .voiceInputEnabled=${this.voiceInputEnabled} .disabled=${this._canceling || !this._user || !!this._interrupt} ${v(this.#n)}><slot name=entry-actions-start slot=entry-actions-start></slot><slot name=entry-actions-end slot=entry-actions-end><calcite-button .iconStart=${this.awaitingResponse || this._isAnswering ? "circle-stop" : "send"} @click=${() => {
322
423
  this.#n.value?.submitMessage();
323
- }} round>${this.awaitingResponse ? this._messages.stopButtonLabel : this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`;
424
+ }} round>${this.awaitingResponse || this._isAnswering ? this._messages.stopButtonLabel : this._messages.askButtonLabel}</calcite-button></slot></arcgis-assistant-chat-entry></slot><slot name=footer-content></slot></div></calcite-panel>`;
324
425
  }
325
426
  }
326
- $("arcgis-assistant", F);
427
+ $("arcgis-assistant", Y);
327
428
  export {
328
- F as ArcgisAssistant
429
+ Y as ArcgisAssistant
329
430
  };