@arcgis/portal-components 5.2.0-next.54 → 5.2.0-next.55

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.
@@ -1,31 +1,29 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { c as ut } from "../../chunks/runtime.js";
3
- import { LitElement as ct, createEvent as pt } from "@arcgis/lumina";
4
- import { css as dt, render as mt, html as M } from "lit";
5
- import { createRef as G, ref as A } from "lit/directives/ref.js";
6
- import { u as gt } from "../../chunks/useT9n.js";
7
- import { a as T, t as ht, b as ft } from "../../chunks/functionalities.js";
8
- import { NodeInterrupt as J, Annotation as h, StateGraph as C, START as N, END as f } from "@langchain/langgraph/web";
9
- import { sendTraceMessage as g, invokeStructuredPrompt as b, sendUXSuggestion as $, createAgentRuntimeStateWithSharedState as P, createChatModel as E } from "@arcgis/ai-components/utils/index.js";
10
- import r from "zod";
11
- import { a as yt, c as wt, q as bt } from "../../chunks/groups2.js";
12
- import vt from "@arcgis/core/identity/IdentityManager.js";
13
- import O from "@arcgis/core/request.js";
14
- import { ChatPromptTemplate as D } from "@langchain/core/prompts";
15
- import { createAgent as U } from "langchain";
16
- import { tool as W } from "@langchain/core/tools";
17
- import { s as It, a as xt } from "../../chunks/item.js";
18
- import { Annotation as St } from "@langchain/langgraph";
19
- import { c as Mt, d as Gt, i as At, b as Tt, g as Ct } from "../../chunks/groups.js";
20
- const Y = (s) => {
21
- const { portal: t, user: e } = s ?? {};
22
- return !!s && !!t && !!e;
2
+ import { c as pt } from "../../chunks/runtime.js";
3
+ import { LitElement as dt, createEvent as mt } from "@arcgis/lumina";
4
+ import { css as gt, render as ht, html as M } from "lit";
5
+ import { createRef as T, ref as A } from "lit/directives/ref.js";
6
+ import { u as ft } from "../../chunks/useT9n.js";
7
+ import { a as C, t as yt, b as wt } from "../../chunks/functionalities.js";
8
+ import { NodeInterrupt as Y, Annotation as y, StateGraph as N, START as P, END as w } from "@langchain/langgraph/web";
9
+ import { sendTraceMessage as g, invokeStructuredPrompt as v, sendUXSuggestion as E, createAgentRuntimeStateWithSharedState as k, createChatModel as D } from "@arcgis/ai-components/utils/index.js";
10
+ import n from "zod";
11
+ import { a as bt, c as vt, q as It } from "../../chunks/groups2.js";
12
+ import xt from "@arcgis/core/identity/IdentityManager.js";
13
+ import F from "@arcgis/core/request.js";
14
+ import { ChatPromptTemplate as U } from "@langchain/core/prompts";
15
+ import { tool as _ } from "@langchain/core/tools";
16
+ import { s as St, a as Mt } from "../../chunks/item.js";
17
+ import { c as Gt, d as Tt, i as At, b as Ct, g as Nt } from "../../chunks/groups.js";
18
+ const H = (a) => {
19
+ const { portal: t, user: e } = a ?? {};
20
+ return !!a && !!t && !!e;
23
21
  };
24
- function v(s) {
25
- if (!Y(s))
22
+ function I(a) {
23
+ if (!H(a))
26
24
  throw new Error("Invalid context: PortalAssistantContext with portal and user is required.");
27
25
  }
28
- const Nt = `
26
+ const Pt = `
29
27
  Write a concise, friendly success message for adding members to a group.
30
28
 
31
29
  Rules:
@@ -40,83 +38,83 @@ Added members:
40
38
 
41
39
  Not added members:
42
40
  {notAddedMembers}
43
- `, Pt = (s) => s.map((t) => `"${t}"`).join(", "), kt = r.object({
44
- successMessage: r.string().default("")
45
- }), V = "portal-group-creation", j = "approveAddMembers", qt = async (s, t) => {
46
- if (s.intentParams.intent !== "addMembers")
41
+ `, kt = (a) => a.map((t) => `"${t}"`).join(", "), zt = n.object({
42
+ successMessage: n.string().default("")
43
+ }), V = "portal-group-creation", j = "approveAddMembers", qt = async (a, t) => {
44
+ if (a.intentParams.intent !== "addMembers")
47
45
  return {
48
46
  status: "success",
49
47
  outputMessage: "Use @mention usernames for the members you want to add."
50
48
  };
51
- const e = s.agentExecutionContext.sharedState.createdGroupId?.value;
49
+ const e = a.agentExecutionContext.sharedState.createdGroupId?.value;
52
50
  if (!e)
53
51
  return {
54
52
  status: "success",
55
53
  outputMessage: "Create a group first, then add members using @mention usernames."
56
54
  };
57
- const a = s.intentParams.memberInfo.memberIdentifiers.map((d) => d.trim()).filter(Boolean);
58
- if (!a.length)
55
+ const s = a.intentParams.memberInfo.memberIdentifiers.map((d) => d.trim()).filter(Boolean);
56
+ if (!s.length)
59
57
  return {
60
58
  status: "success",
61
59
  outputMessage: "Use @mention usernames for the members you want to add."
62
60
  };
63
- const i = `The following member(s) will be added to the newly created group:
61
+ const l = `The following member(s) will be added to the newly created group:
64
62
 
65
- ${a.map((d) => `- **@${d}**`).join(`
63
+ ${s.map((d) => `- **@${d}**`).join(`
66
64
  `)}
67
65
 
68
- Do you want to continue?`, { hitlResponse: u } = t?.configurable ?? {};
69
- if (u?.agentId !== V || u.id !== j) {
66
+ Do you want to continue?`, { hitlResponse: c } = t?.configurable ?? {};
67
+ if (c?.agentId !== V || c.id !== j) {
70
68
  const d = {
71
69
  agentId: V,
72
70
  id: j,
73
71
  kind: "booleanChoice",
74
- message: i,
72
+ message: l,
75
73
  metadata: {
76
74
  action: "addMembers",
77
75
  groupId: e,
78
- members: [...a]
76
+ members: [...s]
79
77
  }
80
78
  };
81
- throw new J(d);
79
+ throw new Y(d);
82
80
  }
83
- if (u.payload !== !0)
81
+ if (c.payload !== !0)
84
82
  return {
85
83
  status: "success",
86
84
  outputMessage: "Okay, I cancelled adding members to the group."
87
85
  };
88
86
  await g(
89
- { text: `Adding members ${Pt(a)}...`, agentName: "group-creation" },
87
+ { text: `Adding members ${kt(s)}...`, agentName: "group-creation" },
90
88
  t
91
89
  );
92
- const l = t?.configurable?.context;
93
- v(l);
94
- const { result: c, error: n } = await yt(l.portal, e, a);
95
- if (n || !c)
90
+ const i = t?.configurable?.context;
91
+ I(i);
92
+ const { result: u, error: r } = await bt(i.portal, e, s);
93
+ if (r || !u)
96
94
  return {
97
95
  status: "success",
98
96
  outputMessage: "I could not add members to that group. Please confirm group access and user accounts, then try again."
99
97
  };
100
- const { addedUsernames: p, notAddedUsers: m } = c;
98
+ const { addedUsernames: p, notAddedUsers: m } = u;
101
99
  try {
102
- const y = (await b({
103
- promptText: Nt,
104
- schema: kt,
100
+ const h = (await v({
101
+ promptText: Pt,
102
+ schema: zt,
105
103
  modelTier: "fast",
106
104
  inputVariables: {
107
105
  addedMembers: p.join(", "),
108
106
  notAddedMembers: JSON.stringify(
109
- m.map((x) => ({ username: x.username, reason: x.error.message }))
107
+ m.map((f) => ({ username: f.username, reason: f.error.message }))
110
108
  )
111
109
  }
112
110
  })).successMessage;
113
- if (y)
114
- return { status: "success", outputMessage: y };
111
+ if (h)
112
+ return { status: "success", outputMessage: h };
115
113
  } catch (d) {
116
114
  console.error("Error generating add-members success message:", d);
117
115
  }
118
116
  return {};
119
- }, zt = `
117
+ }, $t = `
120
118
  Write a concise, friendly success message after creating a portal group.
121
119
 
122
120
  Rules:
@@ -127,7 +125,7 @@ Rules:
127
125
 
128
126
  Group title:
129
127
  {groupTitle}
130
- `, $t = `
128
+ `, Et = `
131
129
  Write a concise, friendly failure message after an attempt to create a portal group.
132
130
 
133
131
  Rules:
@@ -142,36 +140,36 @@ Group title:
142
140
 
143
141
  Failure reason:
144
142
  {failureReason}
145
- `, L = "portal-group-creation", B = "approveCreateGroup", Et = r.object({
146
- successMessage: r.string().default("")
147
- }), Dt = r.object({
148
- failureMessage: r.string().default("")
149
- }), Ut = async (s, t) => {
150
- if (s.intentParams.intent !== "create")
143
+ `, L = "portal-group-creation", B = "approveCreateGroup", Dt = n.object({
144
+ successMessage: n.string().default("")
145
+ }), Ut = n.object({
146
+ failureMessage: n.string().default("")
147
+ }), Rt = async (a, t) => {
148
+ if (a.intentParams.intent !== "create")
151
149
  return {
152
150
  status: "success",
153
151
  outputMessage: "Tell me the group title you want to use."
154
152
  };
155
- const e = s.intentParams.title.trim();
153
+ const e = a.intentParams.title.trim();
156
154
  if (!e)
157
155
  return {
158
156
  status: "success",
159
157
  outputMessage: "What title would you like for the new group?"
160
158
  };
161
- const a = `A group with the title **${e}** will be created. Do you want to continue?`, { hitlResponse: o } = t?.configurable;
159
+ const s = `A group with the title **${e}** will be created. Do you want to continue?`, { hitlResponse: o } = t?.configurable;
162
160
  if (o?.agentId !== L || o.id !== B) {
163
- const n = {
161
+ const r = {
164
162
  agentId: L,
165
163
  id: B,
166
164
  kind: "booleanChoice",
167
- message: a,
165
+ message: s,
168
166
  metadata: {
169
167
  action: "createGroup",
170
168
  title: e,
171
169
  access: "private"
172
170
  }
173
171
  };
174
- throw new J(n);
172
+ throw new Y(r);
175
173
  }
176
174
  if (o.payload !== !0)
177
175
  return {
@@ -179,22 +177,22 @@ Failure reason:
179
177
  outputMessage: `Okay, I cancelled creating **${e}**.`
180
178
  };
181
179
  await g({ text: `Creating group "${e}"...`, agentName: "group-creation" }, t);
182
- const i = t?.configurable?.context;
183
- v(i);
184
- const { result: u, error: l } = await wt(i.portal, {
180
+ const l = t?.configurable?.context;
181
+ I(l);
182
+ const { result: c, error: i } = await vt(l.portal, {
185
183
  title: e,
186
184
  access: "private"
187
185
  });
188
- if (l || !u) {
189
- const n = l?.message?.trim() || "No additional details were provided.";
186
+ if (i || !c) {
187
+ const r = i?.message?.trim() || "No additional details were provided.";
190
188
  try {
191
- const m = (await b({
192
- promptText: $t,
193
- schema: Dt,
189
+ const m = (await v({
190
+ promptText: Et,
191
+ schema: Ut,
194
192
  modelTier: "fast",
195
193
  inputVariables: {
196
194
  groupTitle: e,
197
- failureReason: n
195
+ failureReason: r
198
196
  }
199
197
  })).failureMessage.trim();
200
198
  if (m)
@@ -210,11 +208,11 @@ Failure reason:
210
208
  outputMessage: "I could not create that group. Please confirm your permissions and try again with the group title."
211
209
  };
212
210
  }
213
- const c = u.id;
211
+ const u = c.id;
214
212
  try {
215
- const p = (await b({
216
- promptText: zt,
217
- schema: Et,
213
+ const p = (await v({
214
+ promptText: $t,
215
+ schema: Dt,
218
216
  modelTier: "fast",
219
217
  inputVariables: {
220
218
  groupTitle: e
@@ -224,28 +222,28 @@ Failure reason:
224
222
  return {
225
223
  status: "success",
226
224
  outputMessage: p,
227
- sharedStatePatch: { createdGroupId: { value: c } },
228
- createdGroupId: c
225
+ sharedStatePatch: { createdGroupId: { value: u } },
226
+ createdGroupId: u
229
227
  };
230
- } catch (n) {
231
- console.error("Error generating create-group success message:", n);
228
+ } catch (r) {
229
+ console.error("Error generating create-group success message:", r);
232
230
  }
233
231
  return {};
234
- }, I = (s) => {
235
- for (let t = s.length - 1; t >= 0; t -= 1) {
236
- const e = s[t];
232
+ }, x = (a) => {
233
+ for (let t = a.length - 1; t >= 0; t -= 1) {
234
+ const e = a[t];
237
235
  if (e.type !== "human")
238
236
  continue;
239
- const a = e.content;
240
- if (typeof a == "string")
241
- return a;
242
- if (Array.isArray(a))
243
- return a.map(
237
+ const s = e.content;
238
+ if (typeof s == "string")
239
+ return s;
240
+ if (Array.isArray(s))
241
+ return s.map(
244
242
  (o) => typeof o == "string" ? o : "text" in o && typeof o.text == "string" ? o.text : ""
245
243
  ).join(" ").trim();
246
244
  }
247
245
  return "";
248
- }, Rt = `
246
+ }, Ot = `
249
247
  You classify whether a user is asking to create a new ArcGIS Portal group or add members to an existing group.
250
248
 
251
249
  Rules:
@@ -271,25 +269,25 @@ Examples:
271
269
 
272
270
  User message:
273
271
  {userMessage}
274
- `, Ft = r.object({
275
- intent: r.enum(["clarify", "create", "addMembers"]).default("clarify"),
276
- title: r.string().default(""),
277
- memberIdentifiers: r.array(r.string()).default([]),
278
- clarifyMessage: r.string().default("")
279
- }), Ot = async (s, t) => {
272
+ `, Ft = n.object({
273
+ intent: n.enum(["clarify", "create", "addMembers"]).default("clarify"),
274
+ title: n.string().default(""),
275
+ memberIdentifiers: n.array(n.string()).default([]),
276
+ clarifyMessage: n.string().default("")
277
+ }), Vt = async (a, t) => {
280
278
  await g({ text: "Thinking about groups...", agentName: "group-creation" }, t);
281
- const e = I(s.agentExecutionContext.messages).trim(), a = await b({
282
- promptText: Rt,
279
+ const e = x(a.agentExecutionContext.messages).trim(), s = await v({
280
+ promptText: Ot,
283
281
  schema: Ft,
284
282
  modelTier: "default",
285
283
  inputVariables: { userMessage: e }
286
- }), o = a.title.trim(), i = a.memberIdentifiers.filter(Boolean), u = a.clarifyMessage.trim(), l = a.intent === "create" && !!o, c = a.intent === "addMembers" && i.length > 0;
284
+ }), o = s.title.trim(), l = s.memberIdentifiers.filter(Boolean), c = s.clarifyMessage.trim(), i = s.intent === "create" && !!o, u = s.intent === "addMembers" && l.length > 0;
287
285
  return {
288
- intentParams: l ? { intent: "create", title: o } : c ? { intent: "addMembers", memberInfo: { memberIdentifiers: i } } : { intent: "clarify" },
286
+ intentParams: i ? { intent: "create", title: o } : u ? { intent: "addMembers", memberInfo: { memberIdentifiers: l } } : { intent: "clarify" },
289
287
  status: "success",
290
- outputMessage: !l && !c ? u : ""
288
+ outputMessage: !i && !u ? c : ""
291
289
  };
292
- }, Vt = r.enum([
290
+ }, jt = n.enum([
293
291
  "portal-content",
294
292
  "portal-content-favorites",
295
293
  "portal-content-group",
@@ -304,158 +302,158 @@ User message:
304
302
  "portal-notebooks",
305
303
  "portal-scene-viewer",
306
304
  "portal-settings-security"
307
- ]), jt = r.object({
308
- destinationType: Vt
309
- }), Lt = r.union([
310
- jt,
311
- r.object({
312
- destinationType: r.literal("portal-item"),
313
- itemId: r.string().trim().min(1)
305
+ ]), Lt = n.object({
306
+ destinationType: jt
307
+ }), Bt = n.union([
308
+ Lt,
309
+ n.object({
310
+ destinationType: n.literal("portal-item"),
311
+ itemId: n.string().trim().min(1)
314
312
  }),
315
- r.object({
316
- destinationType: r.literal("portal-group"),
317
- groupId: r.string().trim().min(1)
313
+ n.object({
314
+ destinationType: n.literal("portal-group"),
315
+ groupId: n.string().trim().min(1)
318
316
  })
319
- ]), _ = "portal-navigation", R = async (s, t) => {
317
+ ]), X = "portal-navigation", R = async (a, t) => {
320
318
  const e = t?.configurable?.context;
321
- !Y(e) || !e.navigationTargetMap?.[s.destinationType] || await $({ type: _, data: { ...s } }, t);
322
- }, Bt = async (s, t) => {
323
- const e = s.createdGroupId ?? s.agentExecutionContext.sharedState.createdGroupId?.value;
319
+ !H(e) || !e.navigationTargetMap?.[a.destinationType] || await E({ type: X, data: { ...a } }, t);
320
+ }, Qt = async (a, t) => {
321
+ const e = a.createdGroupId ?? a.agentExecutionContext.sharedState.createdGroupId?.value;
324
322
  return e ? (await g({ text: "Preparing navigation...", agentName: "group-creation" }, t), await R({ destinationType: "portal-group", groupId: e }, t), {}) : {};
325
- }, Q = (s, t) => t ?? s, H = h.Root({
326
- ...P(),
323
+ }, Q = (a, t) => t ?? a, Z = y.Root({
324
+ ...k(),
327
325
  // * Shared state between nodes (but not persisted to the agent execution context)
328
326
  /** Parameters related to the user's intent for group creation actions */
329
- intentParams: h({ reducer: Q, default: () => ({ intent: "clarify" }) }),
327
+ intentParams: y({ reducer: Q, default: () => ({ intent: "clarify" }) }),
330
328
  /** The ID of the group that was created
331
329
  * even though we already have this in the shared state
332
330
  * we still need it here to also share between nodes
333
331
  */
334
- createdGroupId: h({ reducer: Q, default: () => "" })
335
- }), Qt = () => new C(H).addNode("detectGroupCreationIntent", Ot).addNode("createPortalGroup", Ut).addNode("addMembersToPortalGroup", qt).addNode("suggestCreatedGroupNavigation", Bt).addEdge(N, "detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent", (t) => {
332
+ createdGroupId: y({ reducer: Q, default: () => "" })
333
+ }), Kt = () => new N(Z).addNode("detectGroupCreationIntent", Vt).addNode("createPortalGroup", Rt).addNode("addMembersToPortalGroup", qt).addNode("suggestCreatedGroupNavigation", Qt).addEdge(P, "detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent", (t) => {
336
334
  switch (t.intentParams.intent) {
337
335
  case "create":
338
336
  return "createPortalGroup";
339
337
  case "addMembers":
340
338
  return "addMembersToPortalGroup";
341
339
  default:
342
- return f;
340
+ return w;
343
341
  }
344
- }).addEdge("createPortalGroup", "suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup", "suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation", f), Kt = String.raw`- **portal-group-creation** - Portal group creation assistant:
342
+ }).addEdge("createPortalGroup", "suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup", "suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation", w), Jt = String.raw`- **portal-group-creation** - Portal group creation assistant:
345
343
  - creates a new ArcGIS Portal group for the signed-in user
346
344
  - adds users to the newly created group using @mention usernames
347
- `, Jt = {
345
+ `, Wt = {
348
346
  id: "portal-group-creation",
349
347
  name: "Portal Group Creation",
350
- description: Kt,
351
- createGraph: Qt,
352
- workspace: H
353
- }, X = "portalDocAssistantMemory", Wt = () => ({ conversationId: "" }), Yt = (s) => {
354
- const t = s?.[X]?.value;
348
+ description: Jt,
349
+ createGraph: Kt,
350
+ workspace: Z
351
+ }, tt = "portalDocAssistantMemory", Yt = () => ({ conversationId: "" }), _t = (a) => {
352
+ const t = a?.[tt]?.value;
355
353
  if (!t || typeof t != "object")
356
- return Wt();
354
+ return Yt();
357
355
  const e = t;
358
356
  return {
359
357
  conversationId: typeof e.conversationId == "string" ? e.conversationId : ""
360
358
  };
361
- }, _t = (s) => ({
362
- [X]: { value: s }
359
+ }, Ht = (a) => ({
360
+ [tt]: { value: a }
363
361
  });
364
- async function Ht({
365
- portal: s,
362
+ async function Xt({
363
+ portal: a,
366
364
  question: t,
367
365
  persona: e,
368
- previousConversationId: a,
366
+ previousConversationId: s,
369
367
  signal: o,
370
- skillId: i
368
+ skillId: l
371
369
  }) {
372
- i ??= "doc_ai_assistant";
373
- const l = await Xt({
374
- portal: s,
375
- skillId: i,
370
+ l ??= "doc_ai_assistant";
371
+ const i = await Zt({
372
+ portal: a,
373
+ skillId: l,
376
374
  message: t,
377
375
  options: { context: {
378
376
  kind: "DocAIAssistantRequest",
379
377
  filters: { persona: { persona: e } }
380
- }, previousConversationId: a, signal: o }
378
+ }, previousConversationId: s, signal: o }
381
379
  });
382
380
  return {
383
- reply: Zt(l, i),
384
- conversationId: l[0]?.conversationId ?? ""
381
+ reply: te(i, l),
382
+ conversationId: i[0]?.conversationId ?? ""
385
383
  };
386
384
  }
387
- async function Xt({
388
- portal: s,
385
+ async function Zt({
386
+ portal: a,
389
387
  skillId: t,
390
388
  message: e,
391
- options: a
389
+ options: s
392
390
  }) {
393
- const i = `${s.helperServices.aiAssistantServices.url}/skills/${t}/chat`, u = {
391
+ const l = `${a.helperServices.aiAssistantServices.url}/skills/${t}/chat`, c = {
394
392
  "Content-Type": "application/json",
395
- token: vt.findCredential(s.url)?.token ?? ""
396
- }, l = await O(i, {
393
+ token: xt.findCredential(a.url)?.token ?? ""
394
+ }, i = await F(l, {
397
395
  method: "post",
398
396
  body: JSON.stringify({
399
397
  message: e,
400
- context: a.context,
401
- conversationId: a.previousConversationId
398
+ context: s.context,
399
+ conversationId: s.previousConversationId
402
400
  }),
403
- headers: u,
404
- signal: a.signal
401
+ headers: c,
402
+ signal: s.signal
405
403
  });
406
- if (l.httpStatus !== 200)
407
- throw new Error(`Doc assistant chat failed (${l.httpStatus})`, {
408
- cause: l.data
404
+ if (i.httpStatus !== 200)
405
+ throw new Error(`Doc assistant chat failed (${i.httpStatus})`, {
406
+ cause: i.data
409
407
  });
410
- const c = l.data, n = [c], { conversationId: p, inquiryId: m } = c, d = async (y, x) => {
411
- if (!x)
408
+ const u = i.data, r = [u], { conversationId: p, inquiryId: m } = u, d = async (h, f) => {
409
+ if (!f)
412
410
  return;
413
- await ht(1e3);
414
- const w = await O(i, {
411
+ await yt(1e3);
412
+ const b = await F(l, {
415
413
  method: "post",
416
- body: JSON.stringify({ conversationId: p, inquiryId: m, ackSequenceNumber: y }),
417
- headers: u,
418
- signal: a.signal
414
+ body: JSON.stringify({ conversationId: p, inquiryId: m, ackSequenceNumber: h }),
415
+ headers: c,
416
+ signal: s.signal
419
417
  });
420
- if (w.httpStatus !== 200)
421
- throw new Error(`Doc assistant poll failed (${w.httpStatus})`, {
422
- cause: w.data
418
+ if (b.httpStatus !== 200)
419
+ throw new Error(`Doc assistant poll failed (${b.httpStatus})`, {
420
+ cause: b.data
423
421
  });
424
- const S = w.data;
425
- n.push(S), await d(S.sequenceNumber, S.hasMore);
422
+ const S = b.data;
423
+ r.push(S), await d(S.sequenceNumber, S.hasMore);
426
424
  };
427
- return c.hasMore && await d(c.sequenceNumber, c.hasMore), n;
425
+ return u.hasMore && await d(u.sequenceNumber, u.hasMore), r;
428
426
  }
429
- function Zt(s, t) {
427
+ function te(a, t) {
430
428
  switch (t) {
431
429
  case "doc_chat":
432
- return s.find((e) => e.message != null)?.message ?? "";
430
+ return a.find((e) => e.message != null)?.message ?? "";
433
431
  case "doc_ai_assistant":
434
- for (let e = s.length - 1; e >= 0; e -= 1) {
435
- const a = s[e];
436
- if (a.context?.kind === "DocAIAssistantContext") {
437
- const o = a.context.results?.[0]?.reply;
432
+ for (let e = a.length - 1; e >= 0; e -= 1) {
433
+ const s = a[e];
434
+ if (s.context?.kind === "DocAIAssistantContext") {
435
+ const o = s.context.results?.[0]?.reply;
438
436
  if (o)
439
437
  return o;
440
438
  }
441
439
  }
442
440
  return "";
443
441
  default:
444
- return T(t);
442
+ return C(t);
445
443
  }
446
444
  }
447
- const te = async (s, t) => {
445
+ const ee = async (a, t) => {
448
446
  await g({ text: "Asking documentation assistant...", agentName: "doc-assistant" }, t);
449
- const e = I(s.agentExecutionContext.messages).trim();
447
+ const e = x(a.agentExecutionContext.messages).trim();
450
448
  if (!e)
451
449
  return {
452
450
  status: "success",
453
451
  outputMessage: "Please share your question and I can help with ArcGIS and Portal documentation."
454
452
  };
455
- const a = t?.configurable?.context;
456
- v(a);
457
- const o = Yt(s.agentExecutionContext.sharedState), { reply: i, conversationId: u } = await Ht({
458
- portal: a.portal,
453
+ const s = t?.configurable?.context;
454
+ I(s);
455
+ const o = _t(a.agentExecutionContext.sharedState), { reply: l, conversationId: c } = await Xt({
456
+ portal: s.portal,
459
457
  question: e,
460
458
  previousConversationId: o.conversationId || void 0,
461
459
  skillId: "doc_ai_assistant",
@@ -463,20 +461,20 @@ const te = async (s, t) => {
463
461
  });
464
462
  return {
465
463
  status: "success",
466
- outputMessage: i.trim() || "I could not retrieve a response from the documentation assistant.",
467
- sharedStatePatch: _t({
468
- conversationId: u || o.conversationId
464
+ outputMessage: l.trim() || "I could not retrieve a response from the documentation assistant.",
465
+ sharedStatePatch: Ht({
466
+ conversationId: c || o.conversationId
469
467
  })
470
468
  };
471
- }, Z = W(
472
- async ({ groupTitle: s }, t) => {
473
- const e = s.trim();
469
+ }, et = _(
470
+ async ({ groupTitle: a }, t) => {
471
+ const e = a.trim();
474
472
  if (!e)
475
473
  return null;
476
- const a = t?.configurable?.context;
477
- v(a);
474
+ const s = t?.configurable?.context;
475
+ I(s);
478
476
  try {
479
- return (await bt(a.portal, { query: `title:${e}`, num: 1 }))?.results[0]?.id || null;
477
+ return (await It(s.portal, { query: `title:${e}`, num: 1 }))?.results[0]?.id || null;
480
478
  } catch (o) {
481
479
  return console.error("Error searching for portal group by title:", o), null;
482
480
  }
@@ -484,28 +482,36 @@ const te = async (s, t) => {
484
482
  {
485
483
  name: "resolvePortalGroupIdByTitle",
486
484
  description: "Resolves an ArcGIS Portal group title to the best-match group id. Use this when a user references a group by title instead of an explicit group id.",
487
- schema: r.object({
488
- groupTitle: r.string().describe("The portal group title to resolve to a group id.")
485
+ schema: n.object({
486
+ groupTitle: n.string().describe("The portal group title to resolve to a group id.")
489
487
  })
490
488
  }
491
- ), tt = W(
492
- async ({ itemTitle: s }, t) => {
493
- const e = s.trim();
489
+ ), at = _(
490
+ async ({ itemTitle: a }, t) => {
491
+ const e = a.trim();
494
492
  if (!e)
495
493
  return null;
496
- const a = t?.configurable?.context;
497
- v(a);
498
- const { result: o, error: i } = await It(a.portal, e, { num: 1 });
499
- return i && console.error("Error searching for portal item by title:", i), o?.results[0]?.id || null;
494
+ const s = t?.configurable?.context;
495
+ I(s);
496
+ const { result: o, error: l } = await St(s.portal, e, { num: 1 });
497
+ return l && console.error("Error searching for portal item by title:", l), o?.results[0]?.id || null;
500
498
  },
501
499
  {
502
500
  name: "resolvePortalItemIdByTitle",
503
501
  description: 'Resolves an ArcGIS Portal item title to the best-match item id. Use this when a user references an item by title (including hash mentions like #title or #"title with spaces") instead of an explicit item id.',
504
- schema: r.object({
505
- itemTitle: r.string().describe("The portal item title to resolve to an item id.")
502
+ schema: n.object({
503
+ itemTitle: n.string().describe("The portal item title to resolve to an item id.")
506
504
  })
507
505
  }
508
- ), et = {
506
+ );
507
+ function G(a, t = "#") {
508
+ const e = a.match(new RegExp(`\\${t}"([^"]+)"`, "u"));
509
+ if (e?.[1])
510
+ return e[1].trim();
511
+ const s = a.match(new RegExp(`\\${t}([^\\s"']+)`, "u"));
512
+ return s?.[1] ? s[1].trim() : null;
513
+ }
514
+ const st = {
509
515
  "portal-content": {
510
516
  description: "The main content page of the portal.",
511
517
  hints: ["My content", "Content"],
@@ -586,10 +592,10 @@ const te = async (s, t) => {
586
592
  hints: ["Organization settings", "Security", "Organization > Settings > Security"],
587
593
  scope: "entity"
588
594
  }
589
- }, ee = ft(et), se = Object.entries(et).map(
590
- ([s, { description: t, hints: e, scope: a }]) => ` - ${s}: ${t} (scope: ${a}; hints: ${e.join(", ")})`
595
+ }, ae = wt(st), se = Object.entries(st).map(
596
+ ([a, { description: t, hints: e, scope: s }]) => ` - ${a}: ${t} (scope: ${s}; hints: ${e.join(", ")})`
591
597
  ).join(`
592
- `), ae = `
598
+ `), oe = `
593
599
  You decide whether the assistant response should include a navigation action to ArcGIS Portal.
594
600
 
595
601
  Given the user question and assistant response:
@@ -618,38 +624,40 @@ User question:
618
624
 
619
625
  Assistant response:
620
626
  {response}
621
- `, K = r.object({
622
- shouldSuggestNavigation: r.boolean().default(!1),
623
- destinationType: r.enum(["none", ...ee]).default("none"),
624
- itemId: r.string().default(""),
625
- groupId: r.string().default(""),
626
- confidence: r.number().min(0).max(1).default(0)
627
- }), oe = async (s, t) => {
627
+ `, K = n.object({
628
+ shouldSuggestNavigation: n.boolean().default(!1),
629
+ destinationType: n.enum(["none", ...ae]).default("none"),
630
+ itemId: n.string().default(""),
631
+ groupId: n.string().default(""),
632
+ confidence: n.number().min(0).max(1).default(0)
633
+ }), re = async (a, t) => {
628
634
  await g({ text: "Extracting navigation intent...", agentName: "doc-assistant" }, t);
629
- const e = s.outputMessage.trim();
635
+ const e = a.outputMessage.trim();
630
636
  if (!e)
631
637
  return {};
632
- const a = I(s.agentExecutionContext.messages).trim(), o = await D.fromTemplate(ae).format({
633
- question: a,
638
+ const s = x(a.agentExecutionContext.messages).trim(), o = await U.fromTemplate(oe).format({
639
+ question: s,
634
640
  response: e
635
- }), u = await U({
636
- model: await E({ modelTier: "default" }),
637
- tools: [tt, Z],
638
- systemPrompt: o,
639
- responseFormat: K,
640
- checkpointer: !0
641
- }).invoke({ messages: s.agentExecutionContext.messages }, t), l = K.parse(u.structuredResponse ?? {});
642
- if (!l.shouldSuggestNavigation || l.destinationType === "none")
641
+ }), c = (await D({ modelTier: "fast" })).withStructuredOutput(K), i = K.parse(await c.invoke(o));
642
+ if (!i.shouldSuggestNavigation || i.destinationType === "none")
643
643
  return {};
644
- const c = re(l);
645
- return c ? (await R(c, t), {}) : {};
644
+ if (i.destinationType === "portal-item" && !i.itemId) {
645
+ const r = G(s, "#");
646
+ r && (i.itemId = await at.invoke({ itemTitle: r }, t) ?? "");
647
+ }
648
+ if (i.destinationType === "portal-group" && !i.groupId) {
649
+ const r = G(s, "$") ?? G(s, "#");
650
+ r && (i.groupId = await et.invoke({ groupTitle: r }, t) ?? "");
651
+ }
652
+ const u = ne(i);
653
+ return u ? (await R(u, t), {}) : {};
646
654
  };
647
- function re({
648
- destinationType: s,
655
+ function ne({
656
+ destinationType: a,
649
657
  itemId: t,
650
658
  groupId: e
651
659
  }) {
652
- switch (s) {
660
+ switch (a) {
653
661
  case "portal-content":
654
662
  case "portal-content-favorites":
655
663
  case "portal-content-group":
@@ -664,7 +672,7 @@ function re({
664
672
  case "portal-notebooks":
665
673
  case "portal-scene-viewer":
666
674
  case "portal-settings-security":
667
- return { destinationType: s };
675
+ return { destinationType: a };
668
676
  case "portal-item":
669
677
  return t ? { destinationType: "portal-item", itemId: t } : null;
670
678
  case "portal-group":
@@ -672,34 +680,34 @@ function re({
672
680
  case "none":
673
681
  return null;
674
682
  default:
675
- return T(s);
683
+ return C(a);
676
684
  }
677
685
  }
678
- const st = St.Root({
679
- ...P()
680
- }), ne = () => new C(st).addNode("answerDocQuestion", te).addNode("extractNavigationIntent", oe).addEdge(N, "answerDocQuestion").addEdge("answerDocQuestion", "extractNavigationIntent").addEdge("extractNavigationIntent", f), ie = String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
686
+ const ot = y.Root({
687
+ ...k()
688
+ }), ie = () => new N(ot).addNode("answerDocQuestion", ee).addNode("extractNavigationIntent", re).addEdge(P, "answerDocQuestion").addEdge("answerDocQuestion", "extractNavigationIntent").addEdge("extractNavigationIntent", w), le = String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
681
689
  - answers general ArcGIS, Portal, Enterprise, and JavaScript SDK questions
682
690
  - acts as a fallback when specialized agents are not applicable
683
- `, le = {
691
+ `, ue = {
684
692
  id: "portal-doc-assistant",
685
693
  name: "Portal Doc Assistant",
686
- description: ie,
687
- createGraph: ne,
688
- workspace: st
689
- }, ue = () => ({ latestGroupId: null, memory: {} }), k = (s) => {
690
- const t = s?.agentExecutionContext.sharedState.portalGroupSummaryMemory?.value;
691
- return t ? { latestGroupId: t.latestGroupId, memory: t.memory } : ue();
692
- }, at = `
694
+ description: le,
695
+ createGraph: ie,
696
+ workspace: ot
697
+ }, ce = () => ({ latestGroupId: null, memory: {} }), z = (a) => {
698
+ const t = a?.agentExecutionContext.sharedState.portalGroupSummaryMemory?.value;
699
+ return t ? { latestGroupId: t.latestGroupId, memory: t.memory } : ce();
700
+ }, rt = `
693
701
  Shared markdown formatting rules:
694
702
  - Use clear markdown headings (##) to separate sections.
695
703
  - Use concise bullet points for lists of facts, counts, or signals.
696
704
  - Emphasize key metrics with bold labels (for example: **Recent items:** 4).
697
705
  - Keep wording direct and analytical; avoid filler language but make sure the language is friendly.
698
706
  - Do not include raw internal IDs unless explicitly requested.
699
- `, ce = `
707
+ `, pe = `
700
708
  You answer follow-up questions about ArcGIS group analytics.
701
709
 
702
- ${at}
710
+ ${rt}
703
711
 
704
712
  Ground your answer in the provided group analytics summary and context.
705
713
  If the answer is not available from the provided context, state that clearly and suggest what to check next.
@@ -721,18 +729,18 @@ Group full context:
721
729
 
722
730
  Question:
723
731
  {question}
724
- `, pe = async (s, t) => {
732
+ `, de = async (a, t) => {
725
733
  await g({ text: "Answering group follow-up...", agentName: "group-analytics" }, t);
726
- const e = k(s), a = s.groupSummaryGroupId ?? e.latestGroupId, o = a ? e.memory[a] : void 0, i = s.groupSummaryQuestion || I(s.agentExecutionContext.messages);
734
+ const e = z(a), s = a.groupSummaryGroupId ?? e.latestGroupId, o = s ? e.memory[s] : void 0, l = a.groupSummaryQuestion || x(a.agentExecutionContext.messages);
727
735
  return o ? {
728
736
  status: "success",
729
- outputMessage: (await b({
730
- promptText: ce,
731
- schema: de,
737
+ outputMessage: (await v({
738
+ promptText: pe,
739
+ schema: me,
732
740
  modelTier: "default",
733
741
  inputVariables: {
734
742
  summary: o.summary,
735
- question: i,
743
+ question: l,
736
744
  fullContext: JSON.stringify(o.fullContext)
737
745
  }
738
746
  })).answer
@@ -740,10 +748,10 @@ Question:
740
748
  status: "success",
741
749
  outputMessage: "I do not have group analytics context yet. Ask me to analyze a group first with analyze group <group id>."
742
750
  };
743
- }, de = r.object({
744
- answer: r.string(),
745
- isRelevant: r.boolean()
746
- }), me = `
751
+ }, me = n.object({
752
+ answer: n.string(),
753
+ isRelevant: n.boolean()
754
+ }), ge = `
747
755
  Classify the user's request for ArcGIS Portal group analytics.
748
756
 
749
757
  Rules:
@@ -772,58 +780,58 @@ hasAnalyticsContext:
772
780
 
773
781
  User message:
774
782
  {userMessage}
775
- `, ge = async (s, t) => {
783
+ `, he = async (a, t) => {
776
784
  await g({ text: "Analyzing group-analytics intent...", agentName: "group-analytics" }, t);
777
- const e = I(s.agentExecutionContext.messages), a = !!k(s).latestGroupId, o = await D.fromTemplate(me).format({
785
+ const e = x(a.agentExecutionContext.messages), s = !!z(a).latestGroupId, o = await U.fromTemplate(ge).format({
778
786
  userMessage: e,
779
- hasAnalyticsContext: String(a)
780
- }), u = await U({
781
- model: await E({ modelTier: "fast" }),
782
- tools: [Z],
783
- systemPrompt: o,
784
- responseFormat: he,
785
- checkpointer: !0
786
- }).invoke({ messages: s.agentExecutionContext.messages }, t), { intent: l, groupId: c, question: n } = u.structuredResponse, p = l === "summarize" && !c, m = l === "followUp" && !(n ?? "").trim(), d = l === "clarify" || p || m;
787
+ hasAnalyticsContext: String(s)
788
+ }), c = (await D({ modelTier: "fast" })).withStructuredOutput(J), i = J.parse(await c.invoke(o));
789
+ let u = i.groupId;
790
+ if ((i.intent === "summarize" || i.intent === "navigation") && !u) {
791
+ const f = G(e, "$");
792
+ f && (u = await et.invoke({ groupTitle: f }, t) ?? "");
793
+ }
794
+ const { intent: r, question: p } = i, m = r === "summarize" && !u, d = r === "followUp" && !(p ?? "").trim(), h = r === "clarify" || m || d;
787
795
  return {
788
- groupSummaryIntent: d ? "clarify" : l,
789
- groupSummaryGroupId: c || null,
790
- groupSummaryQuestion: n || "",
796
+ groupSummaryIntent: h ? "clarify" : r,
797
+ groupSummaryGroupId: u || null,
798
+ groupSummaryQuestion: p || "",
791
799
  status: "success",
792
- outputMessage: d ? "Please clarify with a group id or title" : ""
800
+ outputMessage: h ? "Please clarify with a group id or title" : ""
793
801
  };
794
- }, he = r.object({
795
- intent: r.enum(["summarize", "followUp", "navigation", "clarify"]),
796
- groupId: r.string().default(""),
797
- question: r.string().default("")
798
- }), fe = async (s, t) => {
799
- const e = k(s), a = s.groupSummaryGroupId ?? e.latestGroupId;
802
+ }, J = n.object({
803
+ intent: n.enum(["summarize", "followUp", "navigation", "clarify"]),
804
+ groupId: n.string().default(""),
805
+ question: n.string().default("")
806
+ }), fe = async (a, t) => {
807
+ const e = z(a), s = a.groupSummaryGroupId ?? e.latestGroupId;
800
808
  return await g({ text: "Preparing navigation...", agentName: "group-analytics" }, t), await R(
801
- a ? { destinationType: "portal-group", groupId: a } : { destinationType: "portal-groups" },
809
+ s ? { destinationType: "portal-group", groupId: s } : { destinationType: "portal-groups" },
802
810
  t
803
811
  ), { status: "success" };
804
812
  };
805
- function ot({ timestamp: s, now: t, windowMs: e }) {
806
- return s ? t - s <= e : !1;
813
+ function nt({ timestamp: a, now: t, windowMs: e }) {
814
+ return a ? t - a <= e : !1;
807
815
  }
808
816
  const ye = 720 * 60 * 60 * 1e3;
809
- function we(s) {
810
- const t = Mt(s);
817
+ function we(a) {
818
+ const t = Gt(a);
811
819
  return {
812
- id: s.id ?? "",
813
- title: s.title ?? "",
814
- description: s.description ?? "",
815
- snippet: s.snippet ?? "",
816
- access: s.access ?? null,
817
- owner: s.owner ?? "",
818
- tags: s.tags ?? [],
819
- created: s.created?.getTime(),
820
- modified: s.modified?.getTime(),
821
- isInvitationOnly: s.isInvitationOnly,
820
+ id: a.id ?? "",
821
+ title: a.title ?? "",
822
+ description: a.description ?? "",
823
+ snippet: a.snippet ?? "",
824
+ access: a.access ?? null,
825
+ owner: a.owner ?? "",
826
+ tags: a.tags ?? [],
827
+ created: a.created?.getTime(),
828
+ modified: a.modified?.getTime(),
829
+ isInvitationOnly: a.isInvitationOnly,
822
830
  sourceSignals: {
823
- capabilities: Ct(s),
824
- membershipAccess: Tt(s),
825
- isOpenData: At(s),
826
- isDistributedCollaborationGroup: Gt(s),
831
+ capabilities: Nt(a),
832
+ membershipAccess: Ct(a),
833
+ isOpenData: At(a),
834
+ isDistributedCollaborationGroup: Tt(a),
827
835
  orgId: t.orgId,
828
836
  hiddenMembers: t.hiddenMembers,
829
837
  isViewOnly: t.isViewOnly,
@@ -832,16 +840,16 @@ function we(s) {
832
840
  }
833
841
  };
834
842
  }
835
- async function be(s) {
836
- const t = { owner: s.owner ?? "", admins: [], users: [] };
843
+ async function be(a) {
844
+ const t = { owner: a.owner ?? "", admins: [], users: [] };
837
845
  try {
838
- return await s.fetchMembers();
846
+ return await a.fetchMembers();
839
847
  } catch (e) {
840
848
  return console.warn("Unable to fetch group members for analytics context", e), t;
841
849
  }
842
850
  }
843
- function ve(s) {
844
- return s.map((t) => ({
851
+ function ve(a) {
852
+ return a.map((t) => ({
845
853
  id: t.id ?? "",
846
854
  title: t.title ?? "Untitled",
847
855
  type: t.type ?? "Unknown",
@@ -850,35 +858,35 @@ function ve(s) {
850
858
  modified: t.modified?.getTime()
851
859
  }));
852
860
  }
853
- function Ie(s, t) {
854
- return s.filter(
855
- (e) => e.modified ? ot({ timestamp: e.modified, now: t, windowMs: ye }) : !1
861
+ function Ie(a, t) {
862
+ return a.filter(
863
+ (e) => e.modified ? nt({ timestamp: e.modified, now: t, windowMs: ye }) : !1
856
864
  );
857
865
  }
858
- function xe(s) {
866
+ function xe(a) {
859
867
  const t = /* @__PURE__ */ new Map();
860
- for (const e of s)
868
+ for (const e of a)
861
869
  t.set(e.type, (t.get(e.type) ?? 0) + 1);
862
- return [...t.entries()].sort((e, a) => a[1] - e[1] || e[0].localeCompare(a[0])).slice(0, 6).map(([e, a]) => ({ type: e, count: a }));
870
+ return [...t.entries()].sort((e, s) => s[1] - e[1] || e[0].localeCompare(s[0])).slice(0, 6).map(([e, s]) => ({ type: e, count: s }));
863
871
  }
864
- async function Se(s) {
865
- const t = await s.queryItems({ num: 20, sortField: "modified", sortOrder: "desc" }), e = ve(t.results), a = Date.now();
872
+ async function Se(a) {
873
+ const t = await a.queryItems({ num: 20, sortField: "modified", sortOrder: "desc" }), e = ve(t.results), s = Date.now();
866
874
  return {
867
875
  total: t.total,
868
876
  topItems: e,
869
- recentlyModifiedItems: Ie(e, a),
877
+ recentlyModifiedItems: Ie(e, s),
870
878
  topItemTypes: xe(e)
871
879
  };
872
880
  }
873
- async function Me(s, t) {
881
+ async function Me(a, t) {
874
882
  if (!t)
875
883
  return { error: { code: "missingGroupId", message: "Group id is required." } };
876
884
  try {
877
- const a = (await s.queryGroups({ query: `id:${t}`, num: 1 })).results[0];
878
- if (!a)
885
+ const s = (await a.queryGroups({ query: `id:${t}`, num: 1 })).results[0];
886
+ if (!s)
879
887
  return { error: { code: "groupNotFound", message: `No group found for id: ${t}` } };
880
- const o = we(a), i = await be(a), u = await Se(a);
881
- return { result: { group: o, members: i, items: u } };
888
+ const o = we(s), l = await be(s), c = await Se(s);
889
+ return { result: { group: o, members: l, items: c } };
882
890
  } catch (e) {
883
891
  return console.error("Error fetching portal group analytics context:", e), { error: { code: "unhandledError" } };
884
892
  }
@@ -886,7 +894,7 @@ async function Me(s, t) {
886
894
  const Ge = `
887
895
  You summarize ArcGIS Portal groups based on structured context and deterministic activity signals.
888
896
 
889
- ${at}
897
+ ${rt}
890
898
 
891
899
  Output format requirements:
892
900
  - Return concise markdown with clear sections in this order:
@@ -922,65 +930,65 @@ Group context:
922
930
 
923
931
  Deterministic signals:
924
932
  {deterministicSignals}
925
- `, Ae = 2160 * 60 * 60 * 1e3, Te = async (s, t) => {
926
- const e = s.groupSummaryGroupId;
933
+ `, Te = 2160 * 60 * 60 * 1e3, Ae = async (a, t) => {
934
+ const e = a.groupSummaryGroupId;
927
935
  if (!e)
928
936
  return {
929
937
  status: "success",
930
938
  outputMessage: 'Please clarify with analyze group <group id>, analyze group $<title>, or analyze group $"<title with spaces>".'
931
939
  };
932
940
  await g({ text: `Analyzing group ${e}...`, agentName: "group-analytics" }, t);
933
- const a = t?.configurable?.context;
934
- v(a);
935
- const { result: o, error: i } = await Me(a.portal, e);
936
- if (i || !o)
941
+ const s = t?.configurable?.context;
942
+ I(s);
943
+ const { result: o, error: l } = await Me(s.portal, e);
944
+ if (l || !o)
937
945
  return await g({ text: "Failed to fetch group context", agentName: "group-analytics" }, t), {
938
946
  status: "success",
939
947
  outputMessage: "Unable to retrieve group context for analytics."
940
948
  };
941
- const { group: u, items: l } = o, c = Date.now(), n = u.modified, p = n ? ot({ timestamp: n, now: c, windowMs: Ae }) : !1, m = l.recentlyModifiedItems.length, d = m > 0, y = p || d, x = await b({
949
+ const { group: c, items: i } = o, u = Date.now(), r = c.modified, p = r ? nt({ timestamp: r, now: u, windowMs: Te }) : !1, m = i.recentlyModifiedItems.length, d = m > 0, h = p || d, f = await v({
942
950
  promptText: Ge,
943
951
  schema: Ce,
944
952
  modelTier: "default",
945
953
  inputVariables: {
946
954
  context: JSON.stringify(o),
947
955
  deterministicSignals: JSON.stringify({
948
- isGroupActive: y,
956
+ isGroupActive: h,
949
957
  isGroupRecentlyModified: p,
950
958
  hasRecentlyAddedOrUpdatedContent: d,
951
959
  recentItemCount: m
952
960
  })
953
961
  }
954
- }), { followUpQuestions: w, summary: S } = x, it = k(s), lt = {
962
+ }), { followUpQuestions: b, summary: S } = f, ut = z(a), ct = {
955
963
  latestGroupId: e,
956
964
  memory: {
957
- ...it.memory,
958
- [e]: { summary: S, followUpQuestions: w, fullContext: o }
965
+ ...ut.memory,
966
+ [e]: { summary: S, followUpQuestions: b, fullContext: o }
959
967
  }
960
968
  };
961
- return w.length && await $({ type: "suggested-prompts", data: { prompts: w } }, t), {
969
+ return b.length && await E({ type: "suggested-prompts", data: { prompts: b } }, t), {
962
970
  status: "success",
963
971
  outputMessage: S,
964
- sharedStatePatch: { portalGroupSummaryMemory: { value: lt } }
972
+ sharedStatePatch: { portalGroupSummaryMemory: { value: ct } }
965
973
  };
966
- }, Ce = r.object({
967
- summary: r.string(),
968
- followUpQuestions: r.array(r.string()).default([])
969
- }), q = (s, t) => t ?? s, rt = h.Root({
970
- ...P(),
971
- groupSummaryIntent: h({
974
+ }, Ce = n.object({
975
+ summary: n.string(),
976
+ followUpQuestions: n.array(n.string()).default([])
977
+ }), q = (a, t) => t ?? a, it = y.Root({
978
+ ...k(),
979
+ groupSummaryIntent: y({
972
980
  reducer: q,
973
981
  default: () => "clarify"
974
982
  }),
975
- groupSummaryGroupId: h({
983
+ groupSummaryGroupId: y({
976
984
  reducer: q,
977
985
  default: () => null
978
986
  }),
979
- groupSummaryQuestion: h({
987
+ groupSummaryQuestion: y({
980
988
  reducer: q,
981
989
  default: () => ""
982
990
  })
983
- }), Ne = () => new C(rt).addNode("detectGroupSummaryIntent", ge).addNode("summarizePortalGroup", Te).addNode("answerGroupSummaryFollowUp", pe).addNode("suggestGroupSummaryNavigation", fe).addEdge(N, "detectGroupSummaryIntent").addConditionalEdges("detectGroupSummaryIntent", (t) => t.groupSummaryIntent === "summarize" ? "summarizePortalGroup" : t.groupSummaryIntent === "followUp" ? "answerGroupSummaryFollowUp" : t.groupSummaryIntent === "navigation" ? "suggestGroupSummaryNavigation" : f).addEdge("summarizePortalGroup", f).addEdge("answerGroupSummaryFollowUp", f).addEdge("suggestGroupSummaryNavigation", f), Pe = String.raw`- **portal-group-analytics** - Portal group analytics assistant:
991
+ }), Ne = () => new N(it).addNode("detectGroupSummaryIntent", he).addNode("summarizePortalGroup", Ae).addNode("answerGroupSummaryFollowUp", de).addNode("suggestGroupSummaryNavigation", fe).addEdge(P, "detectGroupSummaryIntent").addConditionalEdges("detectGroupSummaryIntent", (t) => t.groupSummaryIntent === "summarize" ? "summarizePortalGroup" : t.groupSummaryIntent === "followUp" ? "answerGroupSummaryFollowUp" : t.groupSummaryIntent === "navigation" ? "suggestGroupSummaryNavigation" : w).addEdge("summarizePortalGroup", w).addEdge("answerGroupSummaryFollowUp", w).addEdge("suggestGroupSummaryNavigation", w), Pe = String.raw`- **portal-group-analytics** - Portal group analytics assistant:
984
992
  - summarizes ArcGIS portal groups from group context and sourceJSON details
985
993
  - answers follow-up questions grounded in the summarized group
986
994
  - suggests navigation to groups when relevant
@@ -989,15 +997,15 @@ Deterministic signals:
989
997
  name: "Portal Group Analytics",
990
998
  description: Pe,
991
999
  createGraph: Ne,
992
- workspace: rt
993
- }, qe = () => ({ latestItemId: null, memory: {} }), F = (s) => {
994
- const t = s?.agentExecutionContext.sharedState.portalItemAnalyticsSummaryMemory?.value;
995
- return t ? { latestItemId: t.latestItemId, memory: t.memory } : qe();
996
- }, ze = r.object({
997
- intent: r.enum(["summarize", "followUp", "clarify"]),
998
- itemId: r.string().default(""),
999
- question: r.string().default("")
1000
- }), $e = r.object({ summary: r.string(), followUpQuestions: r.array(r.string()).default([]) }), Ee = r.object({ answer: r.string(), isRelevant: r.boolean() }), De = `
1000
+ workspace: it
1001
+ }, ze = () => ({ latestItemId: null, memory: {} }), O = (a) => {
1002
+ const t = a?.agentExecutionContext.sharedState.portalItemAnalyticsSummaryMemory?.value;
1003
+ return t ? { latestItemId: t.latestItemId, memory: t.memory } : ze();
1004
+ }, W = n.object({
1005
+ intent: n.enum(["summarize", "followUp", "clarify"]),
1006
+ itemId: n.string().default(""),
1007
+ question: n.string().default("")
1008
+ }), qe = n.object({ summary: n.string(), followUpQuestions: n.array(n.string()).default([]) }), $e = n.object({ answer: n.string(), isRelevant: n.boolean() }), Ee = `
1001
1009
  You answer follow-up questions about an ArcGIS item.
1002
1010
 
1003
1011
  Ground your answer in the provided item context.
@@ -1017,18 +1025,18 @@ Item full context
1017
1025
 
1018
1026
  Question:
1019
1027
  {question}
1020
- `, Ue = async (s, t) => {
1028
+ `, De = async (a, t) => {
1021
1029
  await g({ text: "Answering follow-up...", agentName: "analytics" }, t);
1022
- const e = F(s), a = s.analyticsItemId ?? e.latestItemId, o = a ? e.memory[a] : void 0, i = s.analyticsQuestion || I(s.agentExecutionContext.messages);
1030
+ const e = O(a), s = a.analyticsItemId ?? e.latestItemId, o = s ? e.memory[s] : void 0, l = a.analyticsQuestion || x(a.agentExecutionContext.messages);
1023
1031
  return o ? {
1024
1032
  status: "success",
1025
- outputMessage: (await b({
1026
- promptText: De,
1027
- schema: Ee,
1033
+ outputMessage: (await v({
1034
+ promptText: Ee,
1035
+ schema: $e,
1028
1036
  modelTier: "default",
1029
1037
  inputVariables: {
1030
1038
  summary: o.summary,
1031
- question: i,
1039
+ question: l,
1032
1040
  fullContext: JSON.stringify(o.fullContext)
1033
1041
  }
1034
1042
  })).answer
@@ -1036,7 +1044,7 @@ Question:
1036
1044
  status: "success",
1037
1045
  outputMessage: "I don't have enough information yet. Please ask me to summarize the item first using summarize item <item id>."
1038
1046
  };
1039
- }, Re = `
1047
+ }, Ue = `
1040
1048
  Classify the user analytics request.
1041
1049
 
1042
1050
  Rules:
@@ -1066,25 +1074,25 @@ hasSummaryContext:
1066
1074
 
1067
1075
  User message:
1068
1076
  {userMessage}
1069
- `, Fe = async (s, t) => {
1077
+ `, Re = async (a, t) => {
1070
1078
  await g({ text: "Analyzing intent...", agentName: "analytics" }, t);
1071
- const e = I(s.agentExecutionContext.messages), a = !!F(s).latestItemId, o = await D.fromTemplate(Re).format({
1079
+ const e = x(a.agentExecutionContext.messages), s = !!O(a).latestItemId, o = await U.fromTemplate(Ue).format({
1072
1080
  userMessage: e,
1073
- hasSummaryContext: String(a)
1074
- }), u = await U({
1075
- model: await E({ modelTier: "fast" }),
1076
- tools: [tt],
1077
- systemPrompt: o,
1078
- responseFormat: ze,
1079
- checkpointer: !0
1080
- }).invoke({ messages: s.agentExecutionContext.messages }, t), { intent: l, itemId: c, question: n } = u.structuredResponse, d = l === "clarify" || l === "summarize" && !c || l === "followUp" && !n;
1081
+ hasSummaryContext: String(s)
1082
+ }), c = (await D({ modelTier: "fast" })).withStructuredOutput(W), i = W.parse(await c.invoke(o));
1083
+ let u = i.itemId;
1084
+ if (i.intent === "summarize" && !u) {
1085
+ const f = G(e, "#");
1086
+ f && (u = await at.invoke({ itemTitle: f }, t) ?? "");
1087
+ }
1088
+ const { intent: r, question: p } = i, h = r === "clarify" || r === "summarize" && !u || r === "followUp" && !p;
1081
1089
  return {
1082
- agentExecutionContext: { ...s.agentExecutionContext },
1083
- analyticsIntent: d ? "clarify" : l,
1084
- analyticsItemId: c || null,
1085
- analyticsQuestion: n || "",
1090
+ agentExecutionContext: { ...a.agentExecutionContext },
1091
+ analyticsIntent: h ? "clarify" : r,
1092
+ analyticsItemId: u || null,
1093
+ analyticsQuestion: p || "",
1086
1094
  status: "success",
1087
- outputMessage: d ? 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".' : ""
1095
+ outputMessage: h ? 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".' : ""
1088
1096
  };
1089
1097
  }, Oe = `
1090
1098
  You are a item summary tool for ArcGIS. Your job is to summarize an item's info based on the provided context.
@@ -1101,70 +1109,70 @@ Do not include internal identifiers.
1101
1109
  If the user asks for a detailed summary, you may expand the response up to 300 words.
1102
1110
  Item context:
1103
1111
  {context}
1104
- `, Ve = async (s, t) => {
1105
- const e = s.analyticsItemId;
1112
+ `, Fe = async (a, t) => {
1113
+ const e = a.analyticsItemId;
1106
1114
  if (!e)
1107
1115
  return {
1108
1116
  status: "success",
1109
1117
  outputMessage: 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".'
1110
1118
  };
1111
1119
  await g({ text: `Summarizing item ${e}...`, agentName: "analytics" }, t);
1112
- const a = t?.configurable?.context;
1113
- v(a);
1114
- const { portal: o, user: i } = a, { result: u, error: l } = await xt(i, o, e);
1115
- if (l || !u)
1120
+ const s = t?.configurable?.context;
1121
+ I(s);
1122
+ const { portal: o, user: l } = s, { result: c, error: i } = await Mt(l, o, e);
1123
+ if (i || !c)
1116
1124
  return await g({ text: "Failed to get item context for summarization", agentName: "analytics" }, t), {
1117
1125
  status: "success",
1118
1126
  outputMessage: "Unable to retrieve item context for summarization."
1119
1127
  };
1120
- const { context: c } = u, n = await b({
1128
+ const { context: u } = c, r = await v({
1121
1129
  promptText: Oe,
1122
- schema: $e,
1130
+ schema: qe,
1123
1131
  modelTier: "default",
1124
- inputVariables: { context: JSON.stringify(c) }
1125
- }), { followUpQuestions: p, summary: m } = n, d = F(s), y = {
1132
+ inputVariables: { context: JSON.stringify(u) }
1133
+ }), { followUpQuestions: p, summary: m } = r, d = O(a), h = {
1126
1134
  latestItemId: e,
1127
1135
  memory: {
1128
1136
  ...d.memory,
1129
- [e]: { summary: m, followUpQuestions: p, fullContext: c }
1137
+ [e]: { summary: m, followUpQuestions: p, fullContext: u }
1130
1138
  }
1131
1139
  };
1132
- return p.length && await $({ type: "suggested-prompts", data: { prompts: p } }, t), {
1140
+ return p.length && await E({ type: "suggested-prompts", data: { prompts: p } }, t), {
1133
1141
  status: "success",
1134
1142
  outputMessage: m,
1135
- sharedStatePatch: { portalItemAnalyticsSummaryMemory: { value: y } }
1143
+ sharedStatePatch: { portalItemAnalyticsSummaryMemory: { value: h } }
1136
1144
  };
1137
- }, z = (s, t) => t ?? s, nt = h.Root({
1138
- ...P(),
1145
+ }, $ = (a, t) => t ?? a, lt = y.Root({
1146
+ ...k(),
1139
1147
  // States shared only across nodes in the graph, not between invocations
1140
- analyticsIntent: h({
1141
- reducer: z,
1148
+ analyticsIntent: y({
1149
+ reducer: $,
1142
1150
  default: () => "clarify"
1143
1151
  }),
1144
- analyticsItemId: h({
1145
- reducer: z,
1152
+ analyticsItemId: y({
1153
+ reducer: $,
1146
1154
  default: () => null
1147
1155
  }),
1148
- analyticsQuestion: h({
1149
- reducer: z,
1156
+ analyticsQuestion: y({
1157
+ reducer: $,
1150
1158
  default: () => ""
1151
1159
  })
1152
- }), je = () => new C(nt).addNode("detectAnalyticsIntent", Fe).addNode("summarizePortalItem", Ve).addNode("answerAnalyticsFollowUp", Ue).addEdge(N, "detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent", (t) => t.analyticsIntent === "summarize" ? "summarizePortalItem" : t.analyticsIntent === "followUp" ? "answerAnalyticsFollowUp" : f).addEdge("summarizePortalItem", f).addEdge("answerAnalyticsFollowUp", f), Le = String.raw`- **portal-item-analytics** - Portal item analytics assistant:
1160
+ }), Ve = () => new N(lt).addNode("detectAnalyticsIntent", Re).addNode("summarizePortalItem", Fe).addNode("answerAnalyticsFollowUp", De).addEdge(P, "detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent", (t) => t.analyticsIntent === "summarize" ? "summarizePortalItem" : t.analyticsIntent === "followUp" ? "answerAnalyticsFollowUp" : w).addEdge("summarizePortalItem", w).addEdge("answerAnalyticsFollowUp", w), je = String.raw`- **portal-item-analytics** - Portal item analytics assistant:
1153
1161
  - answers questions about one specific ArcGIS portal item when item context is present
1154
1162
  - summarizes item details, metadata, and context grounded in that item
1155
1163
  - suggests follow-up prompts grounded in the same item
1156
1164
  - use for item-specific requests, not for gallery browsing, featured content, or opening Map Viewer
1157
- `, Be = {
1165
+ `, Le = {
1158
1166
  id: "portal-item-analytics",
1159
1167
  name: "Portal Item Analytics",
1160
- description: Le,
1161
- createGraph: je,
1162
- workspace: nt
1163
- }, Qe = dt`:host{height:100%;border-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);display:block;width:100%;--tw-shadow: 0 1px 6px -1px rgba(0, 0, 0, .16), 0 1px 2px -1px rgba(0, 0, 0, .08);--tw-shadow-colored: 0 1px 6px -1px var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.chat-entry{display:flex;flex-direction:column;gap:.75rem;width:100%}.chat-actions{display:flex;justify-content:flex-end;gap:.5rem}.header-actions{display:flex;gap:.5rem;padding-inline-start:.75rem}.navigation-block{display:flex;flex-direction:column;align-items:stretch;gap:.35rem;margin-top:.5rem}.navigation-button{width:100%;margin-block:.25rem}.navigation-block-description{font-size:.75rem;color:var(--calcite-color-text-3)}`;
1164
- function Ke(s, t) {
1168
+ description: je,
1169
+ createGraph: Ve,
1170
+ workspace: lt
1171
+ }, Be = gt`:host{height:100%;border-width:1px;border-style:solid;border-color:var(--calcite-color-border-3);display:block;width:100%;--tw-shadow: 0 1px 6px -1px rgba(0, 0, 0, .16), 0 1px 2px -1px rgba(0, 0, 0, .08);--tw-shadow-colored: 0 1px 6px -1px var(--tw-shadow-color), 0 1px 2px -1px var(--tw-shadow-color);box-shadow:var(--tw-ring-offset-shadow, 0 0 #0000),var(--tw-ring-shadow, 0 0 #0000),var(--tw-shadow)}.chat-entry{display:flex;flex-direction:column;gap:.75rem;width:100%}.chat-actions{display:flex;justify-content:flex-end;gap:.5rem}.header-actions{display:flex;gap:.5rem;padding-inline-start:.75rem}.navigation-block{display:flex;flex-direction:column;align-items:stretch;gap:.35rem;margin-top:.5rem}.navigation-button{width:100%;margin-block:.25rem}.navigation-block-description{font-size:.75rem;color:var(--calcite-color-text-3)}`;
1172
+ function Qe(a, t) {
1165
1173
  if (!t)
1166
1174
  return;
1167
- const { destinationType: e } = s;
1175
+ const { destinationType: e } = a;
1168
1176
  switch (e) {
1169
1177
  case "portal-content":
1170
1178
  case "portal-content-favorites":
@@ -1182,50 +1190,50 @@ function Ke(s, t) {
1182
1190
  case "portal-settings-security":
1183
1191
  return t[e];
1184
1192
  case "portal-item":
1185
- return t[e]?.(s.itemId);
1193
+ return t[e]?.(a.itemId);
1186
1194
  case "portal-group":
1187
- return t[e]?.(s.groupId);
1195
+ return t[e]?.(a.groupId);
1188
1196
  default:
1189
- return T(e);
1197
+ return C(e);
1190
1198
  }
1191
1199
  }
1192
- function Je(s) {
1193
- const t = Lt.safeParse(s);
1200
+ function Ke(a) {
1201
+ const t = Bt.safeParse(a);
1194
1202
  return t.success ? t.data : void 0;
1195
1203
  }
1196
- class We extends ct {
1204
+ class Je extends dt {
1197
1205
  constructor() {
1198
- super(...arguments), this.t9n = gt({ blocking: !0 }), this.assistantEl = G(), this.formEl = G(), this.voiceInputEl = G(), this.inputEl = G(), this.navigationSlotElements = /* @__PURE__ */ new Map(), this.handleSlottableRequest = (t) => {
1199
- const e = t.detail, a = e.data?.block;
1200
- if (!a)
1206
+ super(...arguments), this.t9n = ft({ blocking: !0 }), this.assistantEl = T(), this.formEl = T(), this.voiceInputEl = T(), this.inputEl = T(), this.navigationSlotElements = /* @__PURE__ */ new Map(), this.handleSlottableRequest = (t) => {
1207
+ const e = t.detail, s = e.data?.block;
1208
+ if (!s)
1201
1209
  return;
1202
- const o = this.getNavigationAction(a);
1210
+ const o = this.getNavigationAction(s);
1203
1211
  o && this.upsertNavigationSlotElement(e.slotName, o);
1204
- }, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.defaultClosed = !1, this.arcgisPortalNavigationRequest = pt();
1212
+ }, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.defaultClosed = !1, this.arcgisPortalNavigationRequest = mt();
1205
1213
  }
1206
1214
  static {
1207
1215
  this.properties = { inputText: 16, showVoiceInput: 16, isListening: 16, isVoiceInputDisabled: 16, interrupt: 16, autoDestroyDisabled: 5, portal: 0, user: 0, config: 0, navigationTargetMap: 0, defaultClosed: 5 };
1208
1216
  }
1209
1217
  static {
1210
- this.styles = Qe;
1218
+ this.styles = Be;
1211
1219
  }
1212
1220
  getNavigationAction(t) {
1213
- if (t?.type !== _)
1221
+ if (t?.type !== X)
1214
1222
  return;
1215
- const e = Je(t.data);
1223
+ const e = Ke(t.data);
1216
1224
  if (!e)
1217
1225
  return;
1218
- const a = Ke(e, this.navigationTargetMap);
1219
- if (a)
1220
- return { href: a, targetDetail: e, label: this.getNavigationText(e.destinationType) };
1226
+ const s = Qe(e, this.navigationTargetMap);
1227
+ if (s)
1228
+ return { href: s, targetDetail: e, label: this.getNavigationText(e.destinationType) };
1221
1229
  }
1222
1230
  upsertNavigationSlotElement(t, e) {
1223
- const a = this.assistantEl.value;
1224
- if (!a)
1231
+ const s = this.assistantEl.value;
1232
+ if (!s)
1225
1233
  return;
1226
1234
  let o = this.navigationSlotElements.get(t);
1227
- o || (o = document.createElement("div"), o.slot = t, this.navigationSlotElements.set(t, o), a.append(o)), mt(M`<div><calcite-button class="navigation-button" appearance=outline width=full .href=${e.href} icon-end=launch @click=${(i) => {
1228
- i.preventDefault(), this.arcgisPortalNavigationRequest.emit({
1235
+ o || (o = document.createElement("div"), o.slot = t, this.navigationSlotElements.set(t, o), s.append(o)), ht(M`<div><calcite-button class="navigation-button" appearance=outline width=full .href=${e.href} icon-end=launch @click=${(l) => {
1236
+ l.preventDefault(), this.arcgisPortalNavigationRequest.emit({
1229
1237
  href: e.href,
1230
1238
  targetDetail: e.targetDetail
1231
1239
  });
@@ -1267,49 +1275,49 @@ class We extends ct {
1267
1275
  case "portal-group":
1268
1276
  return e.openGroup;
1269
1277
  default:
1270
- return T(t);
1278
+ return C(t);
1271
1279
  }
1272
1280
  }
1273
1281
  render() {
1274
- const { t9n: t, inputText: e, portal: a, user: o, navigationTargetMap: i, showVoiceInput: u, isListening: l, isVoiceInputDisabled: c } = this;
1275
- return M`<arcgis-assistant log-enabled keep-suggested-prompts .heading=${t.heading} .entryMessage=${t.entryMessage} @arcgisSlottableRequest=${this.handleSlottableRequest} @arcgisInterrupt=${({ detail: n }) => {
1276
- this.interrupt = n;
1282
+ const { t9n: t, inputText: e, portal: s, user: o, navigationTargetMap: l, showVoiceInput: c, isListening: i, isVoiceInputDisabled: u } = this;
1283
+ return M`<arcgis-assistant log-enabled keep-suggested-prompts .heading=${t.heading} .entryMessage=${t.entryMessage} @arcgisSlottableRequest=${this.handleSlottableRequest} @arcgisInterrupt=${({ detail: r }) => {
1284
+ this.interrupt = r;
1277
1285
  }} @arcgisInterruptCancel=${() => {
1278
1286
  this.interrupt = null;
1279
1287
  }} @arcgisInterruptSubmit=${() => {
1280
1288
  this.interrupt = null;
1281
- }} @arcgisPromptSelect=${({ detail: n }) => {
1282
- this.inputText = n.prompt, requestAnimationFrame(() => {
1289
+ }} @arcgisPromptSelect=${({ detail: r }) => {
1290
+ this.inputText = r.prompt, requestAnimationFrame(() => {
1283
1291
  this.inputEl.value?.focusTextArea();
1284
1292
  });
1285
- }} ${A(this.assistantEl)}><div slot=header-actions-start class="header-actions"><calcite-icon icon=effects></calcite-icon></div><form slot=chat-entry class="chat-entry" @submit=${(n) => {
1286
- n.preventDefault();
1293
+ }} ${A(this.assistantEl)}><div slot=header-actions-start class="header-actions"><calcite-icon icon=effects></calcite-icon></div><form slot=chat-entry class="chat-entry" @submit=${(r) => {
1294
+ r.preventDefault();
1287
1295
  const p = e.trim();
1288
1296
  p && (this.assistantEl.value?.submitMessage(p), this.inputText = "");
1289
- }} ${A(this.formEl)}><arcgis-portal-mentionable-text-area .portal=${a} .user=${o} rows=3 .popoverListLabel=${t.mentionEntities} .placeholder=${t.placeholder} .value=${e} @arcgisUserMentionableTextAreaKeyDown=${({ detail: n }) => {
1290
- n.key === "Enter" && !n.shiftKey && (n.preventDefault(), this.formEl.value?.requestSubmit());
1291
- }} @arcgisUserMentionableTextAreaChange=${({ detail: n }) => {
1292
- this.inputText = n ?? "";
1297
+ }} ${A(this.formEl)}><arcgis-portal-mentionable-text-area .portal=${s} .user=${o} rows=3 .popoverListLabel=${t.mentionEntities} .placeholder=${t.placeholder} .value=${e} @arcgisUserMentionableTextAreaKeyDown=${({ detail: r }) => {
1298
+ r.key === "Enter" && !r.shiftKey && (r.preventDefault(), this.formEl.value?.requestSubmit());
1299
+ }} @arcgisUserMentionableTextAreaChange=${({ detail: r }) => {
1300
+ this.inputText = r ?? "";
1293
1301
  }} ${A(this.inputEl)}></arcgis-portal-mentionable-text-area><div class="chat-actions"><arcgis-portal-voice-input @arcgisVoiceInputStart=${() => {
1294
1302
  this.isListening = !0, this.isVoiceInputDisabled = !1;
1295
1303
  }} @arcgisVoiceInputStop=${() => {
1296
1304
  this.isListening = !1, this.isVoiceInputDisabled = !1;
1297
- }} @arcgisVoiceInputError=${(n) => {
1298
- n.detail.errorCode === "not-supported" && (this.showVoiceInput = !1);
1299
- }} @arcgisVoiceInputInterimTranscription=${(n) => {
1300
- this.inputText = n.detail.text;
1301
- }} ${A(this.voiceInputEl)}></arcgis-portal-voice-input>${u && M`<calcite-button icon-start=microphone .label=${t.voiceInput} round .disabled=${c} .appearance=${l ? "solid" : "outline-fill"} @click=${async () => {
1305
+ }} @arcgisVoiceInputError=${(r) => {
1306
+ r.detail.errorCode === "not-supported" && (this.showVoiceInput = !1);
1307
+ }} @arcgisVoiceInputInterimTranscription=${(r) => {
1308
+ this.inputText = r.detail.text;
1309
+ }} ${A(this.voiceInputEl)}></arcgis-portal-voice-input>${c && M`<calcite-button icon-start=microphone .label=${t.voiceInput} round .disabled=${u} .appearance=${i ? "solid" : "outline-fill"} @click=${async () => {
1302
1310
  this.isVoiceInputDisabled = !0;
1303
- const n = this.voiceInputEl.value;
1304
- l ? await n?.stopListening() : await n?.startListening();
1305
- }}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!e.trim()} .label=${t.send}>${t.send}</calcite-button></div></form><arcgis-assistant-agent .agent=${Be} .context=${{ portal: a, user: o, navigationTargetMap: i }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${Jt} .context=${{ portal: a, user: o, navigationTargetMap: i }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${le} .context=${{ portal: a, user: o, navigationTargetMap: i }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${ke} .context=${{ portal: a, user: o, navigationTargetMap: i }}></arcgis-assistant-agent>${this.interrupt && M`<arcgis-portal-ai-assistant-interrupt slot=interrupt .type=${this.interrupt.type} .message=${this.interrupt.message} .options=${this.interrupt.options} @arcgisSubmit=${({ detail: n }) => {
1306
- this.assistantEl.value?.submitInterrupt(n);
1311
+ const r = this.voiceInputEl.value;
1312
+ i ? await r?.stopListening() : await r?.startListening();
1313
+ }}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!e.trim()} .label=${t.send}>${t.send}</calcite-button></div></form><arcgis-assistant-agent .agent=${Le} .context=${{ portal: s, user: o, navigationTargetMap: l }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${Wt} .context=${{ portal: s, user: o, navigationTargetMap: l }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${ue} .context=${{ portal: s, user: o, navigationTargetMap: l }}></arcgis-assistant-agent><arcgis-assistant-agent .agent=${ke} .context=${{ portal: s, user: o, navigationTargetMap: l }}></arcgis-assistant-agent>${this.interrupt && M`<arcgis-portal-ai-assistant-interrupt slot=interrupt .type=${this.interrupt.type} .message=${this.interrupt.message} .options=${this.interrupt.options} @arcgisSubmit=${({ detail: r }) => {
1314
+ this.assistantEl.value?.submitInterrupt(r);
1307
1315
  }} @arcgisCancel=${() => {
1308
1316
  this.assistantEl.value?.cancelInterrupt();
1309
1317
  }}></arcgis-portal-ai-assistant-interrupt>` || ""}</arcgis-assistant>`;
1310
1318
  }
1311
1319
  }
1312
- ut("arcgis-portal-ai-assistant", We);
1320
+ pt("arcgis-portal-ai-assistant", Je);
1313
1321
  export {
1314
- We as ArcgisPortalAiAssistant
1322
+ Je as ArcgisPortalAiAssistant
1315
1323
  };