@arcgis/ai-components 5.2.0-next.93 → 5.2.0-next.95

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 (69) hide show
  1. package/dist/cdn/{HIPQ3VRW.js → 2O4DON37.js} +1 -1
  2. package/dist/cdn/{7DFXYMEA.js → 2XUL3RTX.js} +1 -1
  3. package/dist/cdn/{YQSU6IUO.js → 5HBAJ57P.js} +1 -1
  4. package/dist/cdn/{EYNEYD34.js → 5MK44FNO.js} +1 -1
  5. package/dist/cdn/{FDDQ67BG.js → 6ECRQVHY.js} +1 -1
  6. package/dist/cdn/{LPR72QZF.js → 6KN5LUAV.js} +1 -1
  7. package/dist/cdn/{V6F3HEK7.js → 6OOZSZRJ.js} +1 -1
  8. package/dist/cdn/{TMZ6DF22.js → 6P44KOKX.js} +1 -1
  9. package/dist/cdn/{QCFICJ7U.js → 6YYPVU7H.js} +1 -1
  10. package/dist/cdn/{OWTGH34K.js → 7VUSIGEM.js} +1 -1
  11. package/dist/cdn/{4EBLRHYE.js → AA4FBYKK.js} +1 -1
  12. package/dist/cdn/{VNJMTA6O.js → ANRQWYU2.js} +1 -1
  13. package/dist/cdn/{HKSFWTWK.js → ASR3I43T.js} +1 -1
  14. package/dist/cdn/{ZVGUAOXE.js → B2JDVLA6.js} +1 -1
  15. package/dist/cdn/{FQH3HOFH.js → B2T7D57Y.js} +1 -1
  16. package/dist/cdn/{AZCIDPML.js → C4FEETBZ.js} +1 -1
  17. package/dist/cdn/{X3COUAXY.js → COH3QXWG.js} +3 -3
  18. package/dist/cdn/{AT4XVTJR.js → D5UFYQHN.js} +1 -1
  19. package/dist/cdn/{COL6QYGQ.js → EKWM5K4K.js} +1 -1
  20. package/dist/cdn/{WNNMKCKS.js → EYOWRGDP.js} +1 -1
  21. package/dist/cdn/{RSNGZQCQ.js → F5NIRETW.js} +1 -1
  22. package/dist/cdn/{HMUWQCXU.js → FG647IP6.js} +1 -1
  23. package/dist/cdn/{6KFMRBAA.js → FUF3NAU7.js} +1 -1
  24. package/dist/cdn/G2EGT3CF.js +6 -0
  25. package/dist/cdn/{PEYYWXFE.js → G7OMHU2B.js} +1 -1
  26. package/dist/cdn/{OL5656NI.js → HAEFC2SJ.js} +1 -1
  27. package/dist/cdn/{ZQMBJ6MI.js → HDACNIZF.js} +1 -1
  28. package/dist/cdn/{WR2SQX3J.js → HHUQXL3R.js} +1 -1
  29. package/dist/cdn/{JJJZ7FOM.js → HNADFHYH.js} +1 -1
  30. package/dist/cdn/{C5ZL5Z52.js → IC3LG6TH.js} +1 -1
  31. package/dist/cdn/JCOA24UH.js +3 -0
  32. package/dist/cdn/{SUYWKYWI.js → LNCT4S4I.js} +1 -1
  33. package/dist/cdn/{OYSPNIJI.js → MX7OEO5Z.js} +1 -1
  34. package/dist/cdn/{EKB7CAMM.js → MXTXJKFE.js} +1 -1
  35. package/dist/cdn/MY47B3CE.js +3 -0
  36. package/dist/cdn/{KCU4FWF7.js → NEZXHUAL.js} +1 -1
  37. package/dist/cdn/{DP6O6PMH.js → NSHLOFIY.js} +1 -1
  38. package/dist/cdn/{PSYRZMX2.js → NZSOJ726.js} +1 -1
  39. package/dist/cdn/{SHD6YFSR.js → O4NVW75A.js} +1 -1
  40. package/dist/cdn/{4HDDRBIY.js → OE3GW5LE.js} +1 -1
  41. package/dist/cdn/{ZLWWWTH4.js → R2PQVY4O.js} +1 -1
  42. package/dist/cdn/{2PTPBAIN.js → SXM4NUT5.js} +1 -1
  43. package/dist/cdn/{FUZ77UGP.js → UAANWCMU.js} +1 -1
  44. package/dist/cdn/{WP7ORLSB.js → WGO5SER7.js} +1 -1
  45. package/dist/cdn/{4KOV2NEI.js → WJXXOKGA.js} +1 -1
  46. package/dist/cdn/{MKOQJXQQ.js → WSWB3B7B.js} +1 -1
  47. package/dist/cdn/{W5JPJWMM.js → YWN57GH4.js} +1 -1
  48. package/dist/cdn/{4NJ2FF7H.js → ZDV4K4WG.js} +1 -1
  49. package/dist/cdn/agent-utils/index.js +1 -1
  50. package/dist/cdn/index.js +1 -1
  51. package/dist/chunks/baseAgentState.js +32 -30
  52. package/dist/chunks/dataExplorationGraph.js +2 -2
  53. package/dist/chunks/orchestrator.js +301 -249
  54. package/dist/components/arcgis-assistant/customElement.d.ts +24 -0
  55. package/dist/components/arcgis-assistant/customElement.js +275 -270
  56. package/dist/docs/api.json +1 -1
  57. package/dist/docs/docs.json +1 -1
  58. package/dist/docs/vscode.html-custom-data.json +1 -1
  59. package/dist/docs/web-types.json +1 -1
  60. package/dist/loader.js +1 -1
  61. package/dist/types/lumina.d.ts +1 -1
  62. package/dist/types/preact.d.ts +1 -1
  63. package/dist/types/react.d.ts +1 -1
  64. package/dist/types/stencil.d.ts +1 -1
  65. package/dist/utils/index.d.ts +57 -30
  66. package/package.json +5 -5
  67. package/dist/cdn/6VJXUIXY.js +0 -3
  68. package/dist/cdn/7M6VKBTK.js +0 -6
  69. package/dist/cdn/PKUDO2RC.js +0 -3
@@ -1,76 +1,76 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { c as x } from "../../chunks/runtime.js";
3
- import { css as A, html as c } from "lit";
4
- import L from "@arcgis/core/core/Collection.js";
5
- import { whenOnce as T, watch as R, when as D } from "@arcgis/core/core/reactiveUtils.js";
6
- import M from "@arcgis/core/portal/Portal.js";
7
- import { LitElement as O, createEvent as p, nothing as f } from "@arcgis/lumina";
3
+ import { css as L, html as g } from "lit";
4
+ import T from "@arcgis/core/core/Collection.js";
5
+ import { whenOnce as R, watch as D, when as M } from "@arcgis/core/core/reactiveUtils.js";
6
+ import O from "@arcgis/core/portal/Portal.js";
7
+ import { LitElement as U, createEvent as d, nothing as _ } from "@arcgis/lumina";
8
8
  import * as B from "@arcgis/toolkit/log";
9
9
  import { rethrowError as z } from "@arcgis/toolkit/log";
10
- import { createRef as v, ref as k } from "lit/directives/ref.js";
11
- import { u as U } from "../../chunks/useT9n.js";
12
- import { O as q } from "../../chunks/orchestrator.js";
10
+ import { createRef as w, ref as k } from "lit/directives/ref.js";
11
+ import { u as q } from "../../chunks/useT9n.js";
12
+ import { O as N } from "../../chunks/orchestrator.js";
13
13
  import "@langchain/core/callbacks/dispatch/web";
14
14
  import "@langchain/core/prompts";
15
15
  import "@langchain/openai";
16
16
  import "@arcgis/core/request.js";
17
- import N from "@arcgis/core/identity/IdentityManager.js";
17
+ import V from "@arcgis/core/identity/IdentityManager.js";
18
18
  import "@arcgis/toolkit/string";
19
19
  import "@arcgis/core/config.js";
20
20
  import "@langchain/core/messages";
21
21
  import "@arcgis/core/layers/FeatureLayer.js";
22
22
  import "../../chunks/generateLayerDescriptions.js";
23
23
  import "@langchain/langgraph/web";
24
- import V from "@arcgis/core/core/Accessor.js";
25
- import { property as m, subclass as F } from "@arcgis/core/core/accessorSupport/decorators.js";
26
- import { marked as E } from "marked";
27
- import { g as j } from "../../chunks/utils3.js";
28
- import { g as $ } from "../../chunks/slottableRequestUtils.js";
29
- const H = A`: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)}`;
30
- function w(o) {
31
- return o.trim() ? E.lexer(o).filter((e) => e.type !== "space").map((e) => E.parser([e])) : [];
24
+ import F from "@arcgis/core/core/Accessor.js";
25
+ import { property as b, subclass as j } from "@arcgis/core/core/accessorSupport/decorators.js";
26
+ import { marked as $ } from "marked";
27
+ import { g as H } from "../../chunks/utils3.js";
28
+ import { g as I } from "../../chunks/slottableRequestUtils.js";
29
+ const W = L`: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)}`;
30
+ function E(o) {
31
+ return o.trim() ? $.lexer(o).filter((t) => t.type !== "space").map((t) => $.parser([t])) : [];
32
32
  }
33
- class C {
33
+ class A {
34
34
  constructor() {
35
35
  this._stableParts = [], this._stableText = "", this._rawText = "";
36
36
  }
37
37
  // full streamed markdown so far
38
38
  // Add one chunk and return all current segments.
39
- push(e) {
40
- return this._rawText += e, this._advanceStableBoundary(), this.getParts();
39
+ push(t) {
40
+ return this._rawText += t, this._advanceStableBoundary(), this.getParts();
41
41
  }
42
42
  // Parse the remaining live tail. Call once at stream end.
43
43
  finalize() {
44
- const e = this._rawText.slice(this._stableText.length);
45
- return e.trim() && (this._stableParts.push(...w(e)), this._stableText = this._rawText), this._stableParts;
44
+ const t = this._rawText.slice(this._stableText.length);
45
+ return t.trim() && (this._stableParts.push(...E(t)), this._stableText = this._rawText), this._stableParts;
46
46
  }
47
47
  // Get full output: stable segments + current live tail.
48
48
  getParts() {
49
- const e = this._trimIncompleteTail(this._rawText.slice(this._stableText.length)), s = e.trim() ? w(e) : [];
50
- return [...this._stableParts, ...s];
49
+ const t = this._trimIncompleteTail(this._rawText.slice(this._stableText.length)), e = t.trim() ? E(t) : [];
50
+ return [...this._stableParts, ...e];
51
51
  }
52
52
  reset() {
53
53
  this._stableParts = [], this._stableText = "", this._rawText = "";
54
54
  }
55
55
  // Move parse-safe content from live tail into stable content.
56
56
  _advanceStableBoundary() {
57
- const e = this._rawText.slice(this._stableText.length), s = this._lastSafeBoundary(e);
58
- if (s <= 0)
57
+ const t = this._rawText.slice(this._stableText.length), e = this._lastSafeBoundary(t);
58
+ if (e <= 0)
59
59
  return;
60
- const i = e.slice(0, s);
61
- this._stableParts.push(...w(i)), this._stableText += i;
60
+ const i = t.slice(0, e);
61
+ this._stableParts.push(...E(i)), this._stableText += i;
62
62
  }
63
63
  /**
64
64
  * Find the last blank-line boundary that is outside code fences.
65
65
  * Returns 0 if no safe boundary is available yet.
66
66
  */
67
- _lastSafeBoundary(e) {
68
- const s = e.split(`
67
+ _lastSafeBoundary(t) {
68
+ const e = t.split(`
69
69
  `);
70
- let i = !1, t = 0, n = 0;
71
- for (const r of s)
72
- /^\s*(```|~~~)/u.test(r) && (i = !i), n += r.length + 1, r.trim() === "" && !i && (t = n);
73
- return t < e.length ? t : 0;
70
+ let i = !1, r = 0, s = 0;
71
+ for (const l of e)
72
+ /^\s*(```|~~~)/u.test(l) && (i = !i), s += l.length + 1, l.trim() === "" && !i && (r = s);
73
+ return r < t.length ? r : 0;
74
74
  }
75
75
  /**
76
76
  * Remove incomplete syntax at the end so we do not render partial markup.
@@ -79,27 +79,27 @@ class C {
79
79
  * - HTML elements missing closing tags
80
80
  * - markdown links missing closing ')'
81
81
  */
82
- _trimIncompleteTail(e) {
83
- const s = e.lastIndexOf("<");
84
- if (s !== -1 && !e.includes(">", s))
85
- return e.slice(0, s);
86
- const i = this._earliestUnclosedTag(e);
82
+ _trimIncompleteTail(t) {
83
+ const e = t.lastIndexOf("<");
84
+ if (e !== -1 && !t.includes(">", e))
85
+ return t.slice(0, e);
86
+ const i = this._earliestUnclosedTag(t);
87
87
  if (i !== -1)
88
- return e.slice(0, i);
89
- const t = e.lastIndexOf("[");
90
- if (t !== -1) {
91
- const n = e.slice(t);
92
- if (!/\[[^\]]*\]\([^)]*\)/u.test(n))
93
- return e.slice(0, t);
88
+ return t.slice(0, i);
89
+ const r = t.lastIndexOf("[");
90
+ if (r !== -1) {
91
+ const s = t.slice(r);
92
+ if (!/\[[^\]]*\]\([^)]*\)/u.test(s))
93
+ return t.slice(0, r);
94
94
  }
95
- return e;
95
+ return t;
96
96
  }
97
97
  /**
98
98
  * Return the index of the earliest unclosed opening tag, or -1.
99
99
  * Ignores void elements (img, br, input, etc.) and self-closing tags.
100
100
  */
101
- _earliestUnclosedTag(e) {
102
- const s = /* @__PURE__ */ new Set([
101
+ _earliestUnclosedTag(t) {
102
+ const e = /* @__PURE__ */ new Set([
103
103
  "br",
104
104
  "img",
105
105
  "hr",
@@ -113,57 +113,57 @@ class C {
113
113
  "source",
114
114
  "track",
115
115
  "wbr"
116
- ]), i = /<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu, t = [];
117
- for (let n = i.exec(e); n; n = i.exec(e)) {
118
- const [, r, a, l] = n, h = a.toLowerCase();
119
- if (!(s.has(h) || l === "/"))
120
- if (r === "/") {
121
- for (let g = t.length - 1; g >= 0; g--)
122
- if (t[g].name === h) {
123
- t.splice(g);
116
+ ]), i = /<(\/?)([a-zA-Z][\w-]*)\b[^>]*?(\/?)>/gu, r = [];
117
+ for (let s = i.exec(t); s; s = i.exec(t)) {
118
+ const [, l, a, n] = s, c = a.toLowerCase();
119
+ if (!(e.has(c) || n === "/"))
120
+ if (l === "/") {
121
+ for (let h = r.length - 1; h >= 0; h--)
122
+ if (r[h].name === c) {
123
+ r.splice(h);
124
124
  break;
125
125
  }
126
126
  } else
127
- t.push({ name: h, index: n.index });
127
+ r.push({ name: c, index: s.index });
128
128
  }
129
- return t.length ? t[0].index : -1;
129
+ return r.length ? r[0].index : -1;
130
130
  }
131
131
  }
132
- function W(o) {
133
- const e = new C();
134
- return e.push(o), e.finalize();
132
+ function G(o) {
133
+ const t = new A();
134
+ return t.push(o), t.finalize();
135
135
  }
136
- const G = async (o) => await new Promise((e) => setTimeout(e, o));
137
- async function* Z(o, { chunkSize: e = 15, delay: s = 50 } = {}) {
138
- const i = new C();
139
- for (let t = 0; t < o.length; t += e)
140
- yield i.push(o.slice(t, t + e)), await G(s);
136
+ const Z = async (o) => await new Promise((t) => setTimeout(t, o));
137
+ async function* J(o, { chunkSize: t = 15, delay: e = 50 } = {}) {
138
+ const i = new A();
139
+ for (let r = 0; r < o.length; r += t)
140
+ yield i.push(o.slice(r, r + t)), await Z(e);
141
141
  yield i.finalize();
142
142
  }
143
- var J = Object.defineProperty, K = Object.getOwnPropertyDescriptor, u = (o, e, s, i) => {
144
- for (var t = i > 1 ? void 0 : i ? K(e, s) : e, n = o.length - 1, r; n >= 0; n--)
145
- (r = o[n]) && (t = (i ? r(e, s, t) : r(t)) || t);
146
- return i && t && J(e, s, t), t;
143
+ var K = Object.defineProperty, Q = Object.getOwnPropertyDescriptor, m = (o, t, e, i) => {
144
+ for (var r = i > 1 ? void 0 : i ? Q(t, e) : t, s = o.length - 1, l; s >= 0; s--)
145
+ (l = o[s]) && (r = (i ? l(t, e, r) : l(r)) || r);
146
+ return i && r && K(t, e, r), r;
147
147
  };
148
148
  const S = (o) => !o || typeof o != "object" ? !1 : o.name === "AbortError";
149
- async function* I(o, e, s, i, t = !1) {
150
- if (t) {
149
+ async function* C(o, t, e, i, r = !1) {
150
+ if (r) {
151
151
  if (i?.aborted) {
152
- yield { type: "cancelled", log: s, runId: e };
152
+ yield { type: "cancelled", log: e, runId: t };
153
153
  return;
154
154
  }
155
- yield { type: "block-data", blockType: "text", data: { parts: W(o) }, runId: e };
155
+ yield { type: "block-data", blockType: "text", data: { parts: G(o) }, runId: t };
156
156
  return;
157
157
  }
158
- for await (const n of Z(o)) {
158
+ for await (const s of J(o)) {
159
159
  if (i?.aborted) {
160
- yield { type: "cancelled", log: s, runId: e };
160
+ yield { type: "cancelled", log: e, runId: t };
161
161
  return;
162
162
  }
163
- yield { type: "block-data", blockType: "text", data: { parts: n }, runId: e };
163
+ yield { type: "block-data", blockType: "text", data: { parts: s }, runId: t };
164
164
  }
165
165
  }
166
- let d = class extends V {
166
+ let p = class extends F {
167
167
  constructor(o) {
168
168
  super(o), this.view = null, this.streamingDisabled = !1, this.runtimeEventsEnabled = !1, this.loading = !1, this.processing = !1, this.processingStep = "";
169
169
  }
@@ -179,15 +179,15 @@ let d = class extends V {
179
179
  this.orchestrator?.dispose(), super.destroy();
180
180
  }
181
181
  async _initialize() {
182
- this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await T(() => !this.view.updating), this._set(
182
+ this.removeHandles(), await Promise.all([this.portal.load(), this.view?.when()]), this.view && await R(() => !this.view.updating), this._set(
183
183
  "orchestrator",
184
- await q.init({
184
+ await N.init({
185
185
  agents: [...this.agents],
186
186
  runtimeEventsEnabled: this.runtimeEventsEnabled,
187
187
  view: this.view ?? void 0
188
188
  })
189
189
  ), this.addHandles([
190
- R(
190
+ D(
191
191
  () => [this.view, this.agents],
192
192
  () => {
193
193
  this._initialize();
@@ -198,95 +198,95 @@ let d = class extends V {
198
198
  clearChatHistory() {
199
199
  this.orchestrator?.newConversation();
200
200
  }
201
- async *ask(o, e) {
201
+ async *ask(o, t, e) {
202
202
  if (!this.orchestrator)
203
203
  throw new Error("Orchestrator not initialized yet.");
204
204
  this._set("processing", !0), this._set("processingStep", "");
205
- const s = [];
206
- let i, t = "pending";
205
+ const i = [];
206
+ let r, s = "pending";
207
207
  try {
208
- const n = this.orchestrator.ask(o);
209
- for await (const r of n)
210
- switch (t = r.runId, r.type) {
208
+ const l = this.orchestrator.ask(o, t);
209
+ for await (const a of l)
210
+ switch (s = a.runId, a.type) {
211
211
  case "runtime": {
212
- yield { type: "runtime", event: r, runId: t };
212
+ yield { type: "runtime", event: a, runId: s };
213
213
  break;
214
214
  }
215
215
  case "trace": {
216
- this._set("processingStep", r.data.text), s.push(r.data.text);
216
+ this._set("processingStep", a.data.text), i.push(a.data.text);
217
217
  break;
218
218
  }
219
219
  case "completed": {
220
220
  this._set("processing", !1), this._set("processingStep", "");
221
- const a = r.result, l = !!a.content.length, h = !!i?.length;
222
- if (!l && !h) {
223
- yield { type: "completed", error: "No response received.", log: s, runId: t };
221
+ const n = a.result, c = !!n.content.length, h = !!r?.length;
222
+ if (!c && !h) {
223
+ yield { type: "completed", error: "No response received.", log: i, runId: s };
224
224
  return;
225
225
  }
226
- const g = a.content;
227
- if (yield { type: "block-start", blockType: "text", runId: t }, yield* I(g, t, s, e, this.streamingDisabled), yield { type: "block-end", blockType: "text", runId: t }, h)
228
- for (const _ of i) {
226
+ const u = n.content;
227
+ if (yield { type: "block-start", blockType: "text", runId: s }, yield* C(u, s, i, e, this.streamingDisabled), yield { type: "block-end", blockType: "text", runId: s }, h)
228
+ for (const y of r) {
229
229
  if (e?.aborted) {
230
- yield { type: "cancelled", log: s, runId: t };
230
+ yield { type: "cancelled", log: i, runId: s };
231
231
  return;
232
232
  }
233
- const { type: b, data: y } = _;
234
- if (yield { type: "block-start", blockType: b, runId: t }, b === "text") {
235
- const P = typeof y?.content == "string" ? y.content : "";
236
- yield* I(P, t, s, e, this.streamingDisabled);
233
+ const { type: f, data: v } = y;
234
+ if (yield { type: "block-start", blockType: f, runId: s }, f === "text") {
235
+ const P = typeof v?.content == "string" ? v.content : "";
236
+ yield* C(P, s, i, e, this.streamingDisabled);
237
237
  } else
238
- yield { type: "block-data", blockType: b, data: y, runId: t };
239
- yield { type: "block-end", blockType: b, runId: t };
238
+ yield { type: "block-data", blockType: f, data: v, runId: s };
239
+ yield { type: "block-end", blockType: f, runId: s };
240
240
  }
241
- yield { type: "completed", response: g, blocks: i, log: s, runId: t };
241
+ yield { type: "completed", response: u, blocks: r, log: i, runId: s };
242
242
  return;
243
243
  }
244
244
  case "ux-suggestion": {
245
- const a = r.suggestion;
246
- i = i ? [...i, a] : [a];
245
+ const n = a.suggestion;
246
+ r = r ? [...r, n] : [n];
247
247
  break;
248
248
  }
249
249
  case "interrupt": {
250
- const { kind: a, message: l, metadata: h } = r.interrupt, g = Array.isArray(h) ? h.filter((b) => typeof b == "string") : [], _ = (() => {
251
- switch (a) {
250
+ const { kind: n, message: c, metadata: h } = a.interrupt, u = Array.isArray(h) ? h.filter((f) => typeof f == "string") : [], y = (() => {
251
+ switch (n) {
252
252
  case "booleanChoice":
253
- return { type: "boolean-choice", message: l, options: g };
253
+ return { type: "boolean-choice", message: c, options: u };
254
254
  case "singleSelection":
255
- return { type: "single-select", message: l, options: g };
255
+ return { type: "single-select", message: c, options: u };
256
256
  case "multipleSelection":
257
- return { type: "multi-select", message: l, options: g };
257
+ return { type: "multi-select", message: c, options: u };
258
258
  case "textInput":
259
- return { type: "text-input", message: l };
259
+ return { type: "text-input", message: c };
260
260
  default:
261
- return { type: a, message: l, options: g };
261
+ return { type: n, message: c, options: u };
262
262
  }
263
263
  })();
264
- this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: _, runId: t };
264
+ this._set("processingStep", "Waiting for user input..."), yield { type: "interrupt", payload: y, runId: s };
265
265
  break;
266
266
  }
267
267
  case "cancelled": {
268
- yield { type: "cancelled", log: s, runId: t };
268
+ yield { type: "cancelled", log: i, runId: s };
269
269
  return;
270
270
  }
271
271
  case "error": {
272
- if (e?.aborted || S(r.error)) {
273
- yield { type: "cancelled", log: s, runId: t };
272
+ if (e?.aborted || S(a.error)) {
273
+ yield { type: "cancelled", log: i, runId: s };
274
274
  return;
275
275
  }
276
- yield { type: "completed", error: r.error.message, log: s, runId: t };
276
+ yield { type: "completed", error: a.error.message, log: i, runId: s };
277
277
  return;
278
278
  }
279
279
  default: {
280
- console.warn("Unknown event type:", r);
280
+ console.warn("Unknown event type:", a);
281
281
  break;
282
282
  }
283
283
  }
284
- } catch (n) {
285
- if (e?.aborted || S(n)) {
286
- yield { type: "cancelled", log: s, runId: t };
284
+ } catch (l) {
285
+ if (e?.aborted || S(l)) {
286
+ yield { type: "cancelled", log: i, runId: s };
287
287
  return;
288
288
  }
289
- console.warn("Error during message processing:", n), yield { type: "completed", error: "An error occurred during message processing.", log: s, runId: "error" };
289
+ console.warn("Error during message processing:", l), yield { type: "completed", error: "An error occurred during message processing.", log: i, runId: "error" };
290
290
  return;
291
291
  } finally {
292
292
  this._set("processing", !1);
@@ -296,86 +296,86 @@ let d = class extends V {
296
296
  this.orchestrator?.cancel();
297
297
  }
298
298
  };
299
- u([
300
- m({ readOnly: !0 })
301
- ], d.prototype, "orchestrator", 2);
302
- u([
303
- m()
304
- ], d.prototype, "agents", 2);
305
- u([
306
- m()
307
- ], d.prototype, "portal", 2);
308
- u([
309
- m()
310
- ], d.prototype, "view", 2);
311
- u([
312
- m()
313
- ], d.prototype, "streamingDisabled", 2);
314
- u([
315
- m()
316
- ], d.prototype, "runtimeEventsEnabled", 2);
317
- u([
318
- m({ readOnly: !0 })
319
- ], d.prototype, "loading", 2);
320
- u([
321
- m({ readOnly: !0 })
322
- ], d.prototype, "processing", 2);
323
- u([
324
- m({ readOnly: !0 })
325
- ], d.prototype, "processingStep", 2);
326
- d = u([
327
- F("OrchestratorController")
328
- ], d);
329
- const Q = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", X = "Embeddings not found for this web map.", Y = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
330
- class ee extends O {
299
+ m([
300
+ b({ readOnly: !0 })
301
+ ], p.prototype, "orchestrator", 2);
302
+ m([
303
+ b()
304
+ ], p.prototype, "agents", 2);
305
+ m([
306
+ b()
307
+ ], p.prototype, "portal", 2);
308
+ m([
309
+ b()
310
+ ], p.prototype, "view", 2);
311
+ m([
312
+ b()
313
+ ], p.prototype, "streamingDisabled", 2);
314
+ m([
315
+ b()
316
+ ], p.prototype, "runtimeEventsEnabled", 2);
317
+ m([
318
+ b({ readOnly: !0 })
319
+ ], p.prototype, "loading", 2);
320
+ m([
321
+ b({ readOnly: !0 })
322
+ ], p.prototype, "processing", 2);
323
+ m([
324
+ b({ readOnly: !0 })
325
+ ], p.prototype, "processingStep", 2);
326
+ p = m([
327
+ j("OrchestratorController")
328
+ ], p);
329
+ const X = "Embeddings resource 'embeddings-v01.json' not found in the webmap portal item.", Y = "Embeddings not found for this web map.", tt = "https://developers.arcgis.com/javascript/latest/agentic-apps/ai-webmap-setup/#embeddings";
330
+ class et extends U {
331
331
  constructor() {
332
- super(...arguments), this._messages = U({ blocking: !0 }), this.#e = v(), this.#l = v(), this.#s = v(), this.#t = null, this.#r = /* @__PURE__ */ new Map(), this.#i = M.getDefault(), this.#a = (e) => {
333
- e.stopPropagation(), this.cancelInterrupt();
334
- }, this.#n = (e) => {
335
- e.stopPropagation();
336
- const s = e.detail;
337
- this.submitInterrupt(s);
338
- }, this.#c = (e) => {
339
- e.stopPropagation(), this.keepSuggestedPrompts || (this.suggestedPrompts = []);
340
- const s = e.detail;
341
- this._inputValue = "", this.arcgisSubmit.emit(s), this.submitMessage(s);
342
- }, this.#h = (e) => {
343
- if (this._canceling = !0, e.stopPropagation(), this.arcgisCancel.emit(), this._interrupt) {
332
+ super(...arguments), this._messages = q({ blocking: !0 }), this.#t = w(), this.#o = w(), this.#s = w(), this.#e = null, this.#r = /* @__PURE__ */ new Map(), this.#i = O.getDefault(), this.#a = (t) => {
333
+ t.stopPropagation(), this.cancelInterrupt();
334
+ }, this.#n = (t) => {
335
+ t.stopPropagation();
336
+ const e = t.detail;
337
+ this.submitInterrupt(e);
338
+ }, this.#l = (t) => {
339
+ t.stopPropagation(), this.keepSuggestedPrompts || (this.suggestedPrompts = []);
340
+ const e = t.detail;
341
+ this._inputValue = "", this.arcgisSubmit.emit(e), this.submitMessage(e);
342
+ }, this.#c = (t) => {
343
+ if (this._canceling = !0, t.stopPropagation(), this.arcgisCancel.emit(), this._interrupt) {
344
344
  this.orchestrator?.cancelInterrupt(), this._interrupt = null;
345
345
  return;
346
346
  }
347
- this._orchestratorController?.cancel(), this.#t?.abort(), this.#t = null;
348
- }, this.#g = (e) => {
349
- e.stopPropagation();
350
- const s = e.detail;
351
- this.arcgisFeedback.emit(s);
352
- }, this.#p = (e) => {
353
- e.stopPropagation();
354
- const s = e.detail;
355
- this._inputValue = s.prompt, this.arcgisPromptSelect.emit(s);
356
- }, this.#d = (e) => {
357
- this.arcgisSlottableRequest.emit(e.detail);
358
- }, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new L([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.streamingDisabled = !1, this.runtimeEventsEnabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.assistantAvatarEnabled = !1, this.userAvatarEnabled = !1, this.arcgisCancel = p(), this.arcgisError = p(), this.arcgisFeedback = p(), this.arcgisInterrupt = p(), this.arcgisInterruptCancel = p(), this.arcgisInterruptSubmit = p(), this.arcgisPromptSelect = p(), this.arcgisReady = p(), this.arcgisResponse = p(), this.arcgisRuntime = p({ bubbles: !1, composed: !1 }), this.arcgisSlottableRequest = p({ bubbles: !1, composed: !1 }), this.arcgisSubmit = p();
347
+ this._orchestratorController?.cancel(), this.#e?.abort(), this.#e = null;
348
+ }, this.#h = (t) => {
349
+ t.stopPropagation();
350
+ const e = t.detail;
351
+ this.arcgisFeedback.emit(e);
352
+ }, this.#g = (t) => {
353
+ t.stopPropagation();
354
+ const e = t.detail;
355
+ this._inputValue = e.prompt, this.arcgisPromptSelect.emit(e);
356
+ }, this.#u = (t) => {
357
+ this.arcgisSlottableRequest.emit(t.detail);
358
+ }, this._orchestratorController = null, this._interrupt = null, this._interruptDetails = [], this._error = null, this._inputValue = "", this._isAnswering = !1, this._canceling = !1, this.messages = new T([]), this.referenceElement = null, this.suggestedPrompts = [], this.feedbackEnabled = !1, this.keepSuggestedPrompts = !1, this.streamingDisabled = !1, this.runtimeEventsEnabled = !1, this.logEnabled = !1, this.copyEnabled = !1, this.voiceInputEnabled = !1, this.readAloudEnabled = !1, this.assistantAvatarEnabled = !1, this.userAvatarEnabled = !1, this.arcgisCancel = d(), this.arcgisError = d(), this.arcgisFeedback = d(), this.arcgisInterrupt = d(), this.arcgisInterruptCancel = d(), this.arcgisInterruptSubmit = d(), this.arcgisPromptSelect = d(), this.arcgisReady = d(), this.arcgisResponse = d(), this.arcgisRuntime = d({ bubbles: !1, composed: !1 }), this.arcgisSlottableRequest = d({ bubbles: !1, composed: !1 }), this.arcgisSubmit = d();
359
359
  }
360
360
  static {
361
- this.properties = { _orchestratorController: 16, _interrupt: 16, _interruptDetails: 16, _error: 16, _inputValue: 16, _isAnswering: 16, _signedInUserId: 16, _canceling: 16, _isSignedIn: 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, streamingDisabled: 5, runtimeEventsEnabled: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5, userAvatarEnabled: 5 };
361
+ this.properties = { _orchestratorController: 16, _interrupt: 16, _interruptDetails: 16, _error: 16, _inputValue: 16, _isAnswering: 16, _signedInUserId: 16, _canceling: 16, _isSignedIn: 16, _user: 16, awaitingResponse: 32, awaitingResponseStep: 32, interrupt: 32, messages: 0, orchestrator: 32, entryMessage: 1, heading: 1, description: 1, referenceElement: 1, alwaysUseAgentId: 1, allowedAgentIds: 0, suggestedPrompts: 0, feedbackEnabled: 5, keepSuggestedPrompts: 5, streamingDisabled: 5, runtimeEventsEnabled: 5, logEnabled: 5, copyEnabled: 5, voiceInputEnabled: 5, readAloudEnabled: 5, assistantAvatarEnabled: 5, userAvatarEnabled: 5 };
362
362
  }
363
363
  static {
364
- this.styles = H;
364
+ this.styles = W;
365
365
  }
366
- #e;
367
- #l;
368
- #s;
369
366
  #t;
367
+ #o;
368
+ #s;
369
+ #e;
370
370
  #r;
371
371
  #i;
372
372
  #a;
373
373
  #n;
374
+ #l;
374
375
  #c;
375
376
  #h;
376
377
  #g;
377
- #p;
378
- #d;
378
+ #u;
379
379
  get _isSignedIn() {
380
380
  return !!this.#i?.user || !!this._signedInUserId;
381
381
  }
@@ -400,174 +400,179 @@ class ee extends O {
400
400
  async clearChatHistory() {
401
401
  this._reset(), this._orchestratorController?.clearChatHistory();
402
402
  }
403
- register(e) {
404
- this.#r.set(e.agent.id, e), this._orchestratorController && this.#o();
403
+ register(t) {
404
+ this.#r.set(t.agent.id, t), this._orchestratorController && this.#d();
405
405
  }
406
- submitInterrupt(e) {
407
- this.arcgisInterruptSubmit.emit(e), this._interrupt && (this._interruptDetails = [...this._interruptDetails, { interrupt: this._interrupt, response: e }]), this.orchestrator?.resumeInterrupt(e), this._interrupt = null;
406
+ submitInterrupt(t) {
407
+ this.arcgisInterruptSubmit.emit(t), this._interrupt && (this._interruptDetails = [...this._interruptDetails, { interrupt: this._interrupt, response: t }]), this.orchestrator?.resumeInterrupt(t), this._interrupt = null;
408
408
  }
409
- async submitMessage(e) {
410
- const s = e.trim();
411
- if (!s || (this.messages.push({
409
+ async submitMessage(t) {
410
+ const e = t.trim();
411
+ if (!e || (this.messages.push({
412
412
  id: Date.now().toString(),
413
413
  // TODO: Replace with a more robust ID generation method or get from orchestrator
414
414
  role: "user",
415
- content: s
415
+ content: e
416
416
  }), !this._orchestratorController))
417
417
  return;
418
- this.#t = new AbortController(), this._orchestratorController.streamingDisabled = this.streamingDisabled;
419
- const i = this._orchestratorController.ask(s, this.#t?.signal);
420
- for await (const t of i) {
421
- const n = t.runId, r = this.messages.at(-1);
422
- switch (t.type) {
418
+ this.#e = new AbortController(), this._orchestratorController.streamingDisabled = this.streamingDisabled;
419
+ const i = this.alwaysUseAgentId ? { routing: "direct", agentId: this.alwaysUseAgentId } : { routing: "auto", agentIds: this.allowedAgentIds }, r = this._orchestratorController.ask(e, i, this.#e?.signal);
420
+ for await (const s of r) {
421
+ const l = s.runId, a = this.messages.at(-1);
422
+ switch (s.type) {
423
423
  case "runtime":
424
- this.arcgisRuntime.emit(t.event);
424
+ this.arcgisRuntime.emit(s.event);
425
425
  break;
426
426
  case "block-start": {
427
427
  this._isAnswering = !0;
428
- const a = { type: t.blockType, isPending: !0 };
429
- if (r?.role === "assistant" && r.id === n) {
430
- const l = [...r.blocks ?? [], a];
431
- this.messages.splice(-1, 1, { ...r, blocks: l });
428
+ const n = { type: s.blockType, isPending: !0 };
429
+ if (a?.role === "assistant" && a.id === l) {
430
+ const c = [...a.blocks ?? [], n];
431
+ this.messages.splice(-1, 1, { ...a, blocks: c });
432
432
  } else
433
433
  this.messages.push({
434
434
  role: "assistant",
435
- blocks: [a],
436
- id: n,
435
+ blocks: [n],
436
+ id: l,
437
437
  isStreaming: !0,
438
438
  interrupts: this._interruptDetails
439
439
  }), this._interruptDetails = [];
440
440
  break;
441
441
  }
442
442
  case "block-data": {
443
- if (r?.role !== "assistant" || r?.id !== n)
443
+ if (a?.role !== "assistant" || a?.id !== l)
444
444
  break;
445
- const a = [...r.blocks ?? []], l = a[a.length - 1], { blockType: h, data: g } = t;
446
- if (l?.type !== h || !l.isPending)
445
+ const n = [...a.blocks ?? []], c = n[n.length - 1], { blockType: h, data: u } = s;
446
+ if (c?.type !== h || !c.isPending)
447
447
  break;
448
- h === "text" ? a[a.length - 1] = {
449
- ...l,
448
+ h === "text" ? n[n.length - 1] = {
449
+ ...c,
450
450
  data: {
451
- ...l.data,
452
- parts: g?.parts
451
+ ...c.data,
452
+ parts: u?.parts
453
453
  }
454
- } : a[a.length - 1] = { ...l, data: { ...l.data, ...g ?? {} } }, this.messages.splice(-1, 1, { ...r, blocks: a });
454
+ } : n[n.length - 1] = { ...c, data: { ...c.data, ...u ?? {} } }, this.messages.splice(-1, 1, { ...a, blocks: n });
455
455
  break;
456
456
  }
457
457
  case "block-end": {
458
- if (r?.role !== "assistant" || r?.id !== n)
458
+ if (a?.role !== "assistant" || a?.id !== l)
459
459
  break;
460
- const a = [...r.blocks ?? []], l = a[a.length - 1];
461
- if (l?.type !== t.blockType || !l.isPending)
460
+ const n = [...a.blocks ?? []], c = n[n.length - 1];
461
+ if (c?.type !== s.blockType || !c.isPending)
462
462
  break;
463
- const h = l;
464
- a[a.length - 1] = { ...h, data: { ...h.data }, isPending: !1 }, this.messages.splice(-1, 1, { ...r, blocks: a });
463
+ const h = c;
464
+ n[n.length - 1] = { ...h, data: { ...h.data }, isPending: !1 }, this.messages.splice(-1, 1, { ...a, blocks: n });
465
465
  break;
466
466
  }
467
467
  case "completed":
468
- t.error ? (this.messages.push({
468
+ s.error ? (this.messages.push({
469
469
  role: "assistant",
470
- log: t.log,
471
- error: t.error,
472
- id: n,
470
+ log: s.log,
471
+ error: s.error,
472
+ id: l,
473
473
  interrupts: this._interruptDetails
474
- }), this._interruptDetails = []) : r?.role === "assistant" && r.id === n && this.messages.splice(-1, 1, {
475
- ...r,
476
- content: t.response,
477
- blocks: r.blocks?.map((a) => ({ ...a, data: { ...a.data }, isPending: !1 })) ?? [],
474
+ }), this._interruptDetails = []) : a?.role === "assistant" && a.id === l && this.messages.splice(-1, 1, {
475
+ ...a,
476
+ content: s.response,
477
+ blocks: a.blocks?.map((n) => ({ ...n, data: { ...n.data }, isPending: !1 })) ?? [],
478
478
  isStreaming: !1,
479
- log: t.log
480
- }), this._isAnswering = !1, this.#t = null, this._canceling = !1;
479
+ log: s.log
480
+ }), this._isAnswering = !1, this.#e = null, this._canceling = !1;
481
481
  break;
482
482
  case "interrupt":
483
- this._interrupt = { ...t.payload, id: n }, this.arcgisInterrupt.emit(this._interrupt);
483
+ this._interrupt = { ...s.payload, id: l }, this.arcgisInterrupt.emit(this._interrupt);
484
484
  break;
485
485
  case "cancelled":
486
- r?.role === "assistant" && r.id === n ? this.messages.splice(-1, 1, {
487
- ...r,
488
- blocks: r.blocks?.filter((a) => a.type === "text" || !a.isPending) ?? [],
486
+ a?.role === "assistant" && a.id === l ? this.messages.splice(-1, 1, {
487
+ ...a,
488
+ blocks: a.blocks?.filter((n) => n.type === "text" || !n.isPending) ?? [],
489
489
  isStreaming: !1,
490
- log: t.log,
490
+ log: s.log,
491
491
  error: `(${this._messages.stoppedByUserLabel})`
492
492
  }) : (this.messages.push({
493
493
  role: "assistant",
494
- log: t.log,
494
+ log: s.log,
495
495
  error: `(${this._messages.stoppedByUserLabel})`,
496
- id: n,
496
+ id: l,
497
497
  interrupts: this._interruptDetails
498
- }), this._interruptDetails = []), this._isAnswering = !1, this.#t = null, this._canceling = !1;
498
+ }), this._interruptDetails = []), this._isAnswering = !1, this.#e = null, this._canceling = !1;
499
499
  break;
500
500
  }
501
501
  }
502
502
  }
503
- unregister(e) {
504
- this.#r.delete(e), this._orchestratorController && this.#o();
503
+ unregister(t) {
504
+ this.#r.delete(t), this._orchestratorController && this.#d();
505
505
  }
506
506
  load() {
507
507
  this.manager.onLifecycle(this._reset.bind(this));
508
508
  }
509
509
  loaded() {
510
510
  this.manager.onLifecycle(() => {
511
- this.#e.value?.addEventListener("arcgisPromptSelect", this.#p), this.#e.value?.addEventListener("arcgisSubmit", this.#c), this.#e.value?.addEventListener("arcgisCancel", this.#h), this.#e.value?.addEventListener("arcgisFeedback", this.#g);
512
- const e = D(() => !!this._interrupt && !!this.#s.value, () => {
511
+ this.#t.value?.addEventListener("arcgisPromptSelect", this.#g), this.#t.value?.addEventListener("arcgisSubmit", this.#l), this.#t.value?.addEventListener("arcgisCancel", this.#c), this.#t.value?.addEventListener("arcgisFeedback", this.#h);
512
+ const t = M(() => !!this._interrupt && !!this.#s.value, () => {
513
513
  const i = this.#s.value;
514
514
  i.removeEventListener("arcgisSubmit", this.#n), i.removeEventListener("arcgisCancel", this.#a), i.addEventListener("arcgisSubmit", this.#n, { once: !0 }), i.addEventListener("arcgisCancel", this.#a, { once: !0 });
515
- }), s = this.messages.on("after-add", (i) => {
516
- const t = i.item;
517
- t.role === "assistant" && (t.error || t.content) && this.arcgisResponse.emit(t);
515
+ }), e = this.messages.on("after-add", (i) => {
516
+ const r = i.item;
517
+ r.role === "assistant" && (r.error || r.content) && this.arcgisResponse.emit(r);
518
518
  });
519
519
  return queueMicrotask(() => {
520
- this.#o().then((i) => {
521
- i ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
522
- });
520
+ this.#p();
523
521
  }), () => {
524
- e.remove(), s.remove(), this.#e.value?.removeEventListener("arcgisPromptSelect", this.#p), this.#s.value?.removeEventListener("arcgisSubmit", this.#n), this.#s.value?.removeEventListener("arcgisCancel", this.#a), this.#e.value?.removeEventListener("arcgisSubmit", this.#c), this.#e.value?.removeEventListener("arcgisCancel", this.#h), this.#e.value?.removeEventListener("arcgisFeedback", this.#g), this._orchestratorController?.destroy(), this._orchestratorController = null;
522
+ t.remove(), e.remove(), this.#t.value?.removeEventListener("arcgisPromptSelect", this.#g), this.#s.value?.removeEventListener("arcgisSubmit", this.#n), this.#s.value?.removeEventListener("arcgisCancel", this.#a), 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;
525
523
  };
526
524
  });
527
525
  }
528
- async #o() {
526
+ willUpdate(t) {
527
+ this.hasUpdated && t.has("runtimeEventsEnabled") && this._orchestratorController && (this._orchestratorController.destroy(), this._orchestratorController = null, this.#p());
528
+ }
529
+ async #d() {
529
530
  try {
530
- const e = j(this.el, this.referenceElement);
531
- await e?.componentOnReady();
532
- const s = [...this.#r.values()];
533
- return s.length ? (this._orchestratorController?.destroy(), this._orchestratorController = new d({
534
- agents: s,
531
+ this._error = null;
532
+ const t = H(this.el, this.referenceElement);
533
+ await t?.componentOnReady();
534
+ const e = [...this.#r.values()];
535
+ return e.length ? (this._orchestratorController?.destroy(), this._orchestratorController = new p({
536
+ agents: e,
535
537
  portal: this.#i,
536
538
  runtimeEventsEnabled: this.runtimeEventsEnabled,
537
539
  streamingDisabled: this.streamingDisabled,
538
- view: e?.view
540
+ view: t?.view
539
541
  }), await this._orchestratorController.load(), this.requestUpdate(), !0) : (this._error = this._messages.noAgentsFoundMessage, !1);
540
- } catch (e) {
541
- return this._error = e?.message ?? this._messages.orchestratorInitializationErrorMessage, z(this)(e), !1;
542
+ } catch (t) {
543
+ return this._error = t?.message ?? this._messages.orchestratorInitializationErrorMessage, z(this)(t), !1;
542
544
  }
543
545
  }
546
+ async #p() {
547
+ await this.#d() ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
548
+ }
544
549
  _reset() {
545
- this._orchestratorController?.cancel(), this.#t?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._inputValue = "", this._signedInUserId = void 0;
550
+ this._orchestratorController?.cancel(), this.#e?.abort(), this._interrupt = null, this.messages.removeAll(), this._error = null, this._inputValue = "", this._signedInUserId = void 0;
546
551
  }
547
552
  _renderEntryMessage() {
548
- return this._isSignedIn ? this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : c`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : c`<slot name=entry-message></slot>` : this._renderSignInNotice();
553
+ return this._isSignedIn ? this._error ? this._renderErrorNotice() : this.entryMessage ? this.messages.length > 0 ? null : g`<calcite-notice open kind=brand closable icon width=full><div slot=message>${this.entryMessage}</div></calcite-notice>` : g`<slot name=entry-message></slot>` : this._renderSignInNotice();
549
554
  }
550
555
  _renderSignInNotice() {
551
- const e = this.#i;
552
- return c`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${e ? c`<calcite-link slot=link @click=${async () => {
556
+ const t = this.#i;
557
+ return g`<calcite-notice slot=entry-message open kind=brand icon width=full><div slot=message>${this._messages.signInRequiredMessage}</div>${t ? g`<calcite-link slot=link @click=${async () => {
553
558
  try {
554
- const s = await N.getCredential(`${e.url}/sharing`);
555
- this._signedInUserId = s.userId, this._error = null, this.requestUpdate(), await this.#o() ? this.arcgisReady.emit() : this._error && this.arcgisError.emit(new Error(this._error));
556
- } catch (s) {
557
- this._error = s?.message ?? this._messages.signInErrorMessage, this.arcgisError.emit(new Error(this._error)), B.log("error", this, "Error signing in:", { detail: { error: s } });
559
+ const e = await V.getCredential(`${t.url}/sharing`);
560
+ this._signedInUserId = e.userId, this._error = null, this.requestUpdate(), await this.#p();
561
+ } catch (e) {
562
+ this._error = e?.message ?? this._messages.signInErrorMessage, this.arcgisError.emit(new Error(this._error)), B.log("error", this, "Error signing in:", { detail: { error: e } });
558
563
  }
559
- }} target=_blank title=${this._messages.signInToArcGISOnlineLabel ?? f}>${this._messages.signInLabel}</calcite-link>` : c`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`;
564
+ }} target=_blank title=${this._messages.signInToArcGISOnlineLabel ?? _}>${this._messages.signInLabel}</calcite-link>` : g`<div slot=link>${this._messages.noPortalInformationMessage}</div>`}</calcite-notice>`;
560
565
  }
561
566
  _renderErrorNotice() {
562
- return this._error ? c`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error === Q ? c`<div slot=message>${X}</div><calcite-link slot=link .href=${Y} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel ?? f}>${this._messages.readMoreLabel}</calcite-link>` : c`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
567
+ return this._error ? g`<calcite-notice slot=entry-message open kind=brand icon width=full>${this._error === X ? g`<div slot=message>${Y}</div><calcite-link slot=link .href=${tt} target=_blank title=${this._messages.learnAboutWebMapEmbeddingsLabel ?? _}>${this._messages.readMoreLabel}</calcite-link>` : g`<div slot=message>${this._error}</div>`}</calcite-notice>` : null;
563
568
  }
564
569
  render() {
565
- return c`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${k(this.#e)}><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((e) => e.role === "assistant" ? c`<arcgis-assistant-message .message=${e} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#d} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${e.blocks?.map((s, i) => c`<slot name=${$(e.id, i) ?? f} slot=${$(e.id, i) ?? f}><arcgis-assistant-message-block .block=${s}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : c`<arcgis-assistant-user-message .message=${e} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt ? c`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>` : c`<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 ? c`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${k(this.#s)}></arcgis-assistant-interrupt></slot>` : this.suggestedPrompts?.length ? c`<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._isSignedIn || !!this._interrupt} ${k(this.#l)}><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=${() => {
566
- this.#l.value?.submitMessage();
570
+ return g`<calcite-panel .loading=${!this._orchestratorController && !this._error || this._orchestratorController?.loading} .heading=${this.heading ?? this._messages.assistantLabel} .description=${this.description} ${k(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" ? g`<arcgis-assistant-message .message=${t} .feedbackEnabled=${this.feedbackEnabled} .logEnabled=${this.logEnabled} .copyEnabled=${this.copyEnabled} .readAloudEnabled=${this.readAloudEnabled} @arcgisSlottableRequest=${this.#u} .assistantAvatarEnabled=${this.assistantAvatarEnabled}>${t.blocks?.map((e, i) => g`<slot name=${I(t.id, i) ?? _} slot=${I(t.id, i) ?? _}><arcgis-assistant-message-block .block=${e}></arcgis-assistant-message-block></slot>`)}</arcgis-assistant-message>` : g`<arcgis-assistant-user-message .message=${t} .user=${this._user} .userAvatarEnabled=${this.userAvatarEnabled}></arcgis-assistant-user-message>`)}</slot>${this._interrupt ? g`<div slot=message-loading><div class="interrupt-waiting-message">${this._messages.waitingForUserInputMessage}</div></div>` : g`<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 ? g`<slot name=interrupt><arcgis-assistant-interrupt slot=content-bottom .type=${this._interrupt.type} .message=${this._interrupt.message} .options=${this._interrupt.options} ${k(this.#s)}></arcgis-assistant-interrupt></slot>` : this.suggestedPrompts?.length ? g`<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._isSignedIn || !!this._interrupt || !!this._error} ${k(this.#o)}><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=${() => {
571
+ this.#o.value?.submitMessage();
567
572
  }} 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>`;
568
573
  }
569
574
  }
570
- x("arcgis-assistant", ee);
575
+ x("arcgis-assistant", et);
571
576
  export {
572
- ee as ArcgisAssistant
577
+ et as ArcgisAssistant
573
578
  };