@arcgis/portal-components 5.2.0-next.90 → 5.2.0-next.93

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 (63) hide show
  1. package/dist/cdn/2T33E2DS.js +1 -1
  2. package/dist/cdn/47ZPCFHE.js +2 -0
  3. package/dist/cdn/{K6A3QM3A.js → 5Q7A62C3.js} +74 -74
  4. package/dist/cdn/7OR2HKBV.js +2 -0
  5. package/dist/cdn/7SB7JHBR.js +2 -0
  6. package/dist/cdn/{FDZ3XHNB.js → BMZFIENS.js} +24 -24
  7. package/dist/cdn/{EBYEZR4N.js → CVOWIH4J.js} +1 -1
  8. package/dist/cdn/DCIRWNQL.js +2 -0
  9. package/dist/cdn/DN2QW5FV.js +2 -0
  10. package/dist/cdn/{CYGZYLOQ.js → H4L2DX4R.js} +1 -1
  11. package/dist/cdn/K42KPAN7.js +2 -0
  12. package/dist/cdn/KA4XSW6O.js +2 -0
  13. package/dist/cdn/NVGQFC2K.js +1 -1
  14. package/dist/cdn/{V6VNED6L.js → OEMNHYK6.js} +1 -1
  15. package/dist/cdn/{7TXGDAEX.js → OOH5B3WJ.js} +1 -1
  16. package/dist/cdn/OUFIJDIW.js +2 -0
  17. package/dist/cdn/{QTFWIDAL.js → P6DWFLYH.js} +1 -1
  18. package/dist/cdn/QH47GJCC.js +2 -0
  19. package/dist/cdn/QNCSWTTL.js +2 -0
  20. package/dist/cdn/{JMPVXCF5.js → R5BQIF6P.js} +1 -1
  21. package/dist/cdn/RBGARTND.js +2 -0
  22. package/dist/cdn/SXBAVMP3.js +2 -0
  23. package/dist/cdn/T7FVQDHN.js +2 -0
  24. package/dist/cdn/YWNUWLOL.js +2 -0
  25. package/dist/cdn/{5IXABPXR.js → YZNRN2K5.js} +1 -1
  26. package/dist/cdn/assets/portal-add-gps-metadata/t9n/messages.en.json +1 -0
  27. package/dist/cdn/index.js +1 -1
  28. package/dist/cdn/main.css +1 -1
  29. package/dist/components/arcgis-portal-add-gps-metadata/customElement.d.ts +55 -0
  30. package/dist/components/arcgis-portal-add-gps-metadata/customElement.js +1242 -0
  31. package/dist/components/arcgis-portal-add-gps-metadata/index.d.ts +1 -0
  32. package/dist/components/arcgis-portal-add-gps-metadata/index.js +8 -0
  33. package/dist/components/arcgis-portal-ai-assistant/customElement.js +423 -400
  34. package/dist/components/arcgis-portal-group-browser/customElement.d.ts +5 -1
  35. package/dist/components/arcgis-portal-group-browser/customElement.js +272 -246
  36. package/dist/components/arcgis-portal-group-browser/types.d.ts +42 -12
  37. package/dist/components/arcgis-portal-navigation/customElement.d.ts +35 -5
  38. package/dist/components/arcgis-portal-navigation/customElement.js +413 -373
  39. package/dist/components/arcgis-portal-user-avatar/customElement.d.ts +9 -0
  40. package/dist/docs/api.json +1 -1
  41. package/dist/docs/docs.json +1 -1
  42. package/dist/docs/vscode.css-custom-data.json +1 -1
  43. package/dist/docs/vscode.html-custom-data.json +1 -1
  44. package/dist/docs/web-types.json +1 -1
  45. package/dist/index.d.ts +10 -0
  46. package/dist/loader.js +2 -1
  47. package/dist/types/lumina.d.ts +7 -0
  48. package/dist/types/preact.d.ts +8 -0
  49. package/dist/types/react.d.ts +9 -0
  50. package/dist/types/stencil.d.ts +7 -0
  51. package/package.json +6 -6
  52. package/dist/cdn/42FCLPNH.js +0 -2
  53. package/dist/cdn/4XSXCKIG.js +0 -2
  54. package/dist/cdn/G2G3GSS7.js +0 -2
  55. package/dist/cdn/GRZLC33Y.js +0 -2
  56. package/dist/cdn/IJUSJCYL.js +0 -2
  57. package/dist/cdn/OJCKEXGE.js +0 -2
  58. package/dist/cdn/QMA3U3H3.js +0 -2
  59. package/dist/cdn/STLVXLPU.js +0 -2
  60. package/dist/cdn/TGTT2CVD.js +0 -2
  61. package/dist/cdn/XAPOJUIC.js +0 -2
  62. package/dist/cdn/YUVVUBJB.js +0 -2
  63. package/dist/cdn/ZDU24JOQ.js +0 -2
@@ -1,30 +1,30 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import { c as Ue } from "../../chunks/runtime.js";
3
- import { LitElement as Fe, createEvent as Oe } from "@arcgis/lumina";
4
- import { css as Le, render as je, html as v } from "lit";
2
+ import { c as Fe } from "../../chunks/runtime.js";
3
+ import { LitElement as Oe, createEvent as Le } from "@arcgis/lumina";
4
+ import { css as je, render as Ve, html as v } from "lit";
5
5
  import { createRef as E, ref as k } from "lit/directives/ref.js";
6
- import { u as Ve } from "../../chunks/useT9n.js";
7
- import { NodeInterrupt as ve, Annotation as h, StateGraph as N, START as G, END as w } from "@langchain/langgraph/web";
8
- import { sendTraceMessage as g, invokeStructuredPrompt as b, sendUXSuggestion as J, createAgentRuntimeStateWithSharedState as P, createChatModel as _, getEmbeddings as Be } from "@arcgis/ai-components/utils/index.js";
6
+ import { u as Be } from "../../chunks/useT9n.js";
7
+ import { NodeInterrupt as be, Annotation as h, StateGraph as N, START as P, END as w } from "@langchain/langgraph/web";
8
+ import { sendTraceMessage as g, invokeStructuredPrompt as b, sendUXSuggestion as J, createAgentRuntimeStateWithSharedState as G, createChatModel as _, getEmbeddings as Ke } from "@arcgis/ai-components/utils/index.js";
9
9
  import s from "zod";
10
- import { a as Ke, c as Qe, q as We } from "../../chunks/groups2.js";
10
+ import { a as Qe, c as We, q as Je } from "../../chunks/groups2.js";
11
11
  import Z from "@arcgis/core/identity/IdentityManager.js";
12
12
  import ee from "@arcgis/core/request.js";
13
- import { a as U, t as Je, b as Q } from "../../chunks/functionalities.js";
13
+ import { a as U, t as _e, b as Q } from "../../chunks/functionalities.js";
14
14
  import { ChatPromptTemplate as Y } from "@langchain/core/prompts";
15
- import { tool as be } from "@langchain/core/tools";
16
- import { s as _e, a as Ye } from "../../chunks/item.js";
17
- import { g as He, e as Xe, i as Ze, c as et, a as tt } from "../../chunks/groups.js";
18
- import at from "@arcgis/core/portal/Portal.js";
19
- const Ie = (e) => {
15
+ import { tool as Ie } from "@langchain/core/tools";
16
+ import { s as Ye, a as He } from "../../chunks/item.js";
17
+ import { g as Xe, e as Ze, i as et, c as tt, a as at } from "../../chunks/groups.js";
18
+ import nt from "@arcgis/core/portal/Portal.js";
19
+ const Se = (e) => {
20
20
  const { portal: t, user: a } = e ?? {};
21
21
  return !!e && !!t && !!a;
22
22
  };
23
23
  function x(e) {
24
- if (!Ie(e))
24
+ if (!Se(e))
25
25
  throw new Error("Invalid context: PortalAssistantContext with portal and user is required.");
26
26
  }
27
- const nt = `
27
+ const ot = `
28
28
  Write a concise, friendly success message for adding members to a group.
29
29
 
30
30
  Rules:
@@ -39,9 +39,9 @@ Added members:
39
39
 
40
40
  Not added members:
41
41
  {notAddedMembers}
42
- `, ot = (e) => e.map((t) => `"${t}"`).join(", "), rt = s.object({
42
+ `, rt = (e) => e.map((t) => `"${t}"`).join(", "), st = s.object({
43
43
  successMessage: s.string().default("")
44
- }), te = "portal-group-creation", ae = "approveAddMembers", st = async (e, t) => {
44
+ }), te = "portal-group-creation", ae = "approveAddMembers", it = async (e, t) => {
45
45
  if (e.intentParams.intent !== "addMembers")
46
46
  return {
47
47
  status: "success",
@@ -77,7 +77,7 @@ Do you want to continue?`, { hitlResponse: i } = t?.configurable ?? {};
77
77
  members: [...n]
78
78
  }
79
79
  };
80
- throw new ve(m);
80
+ throw new be(m);
81
81
  }
82
82
  if (i.payload !== !0)
83
83
  return {
@@ -85,22 +85,22 @@ Do you want to continue?`, { hitlResponse: i } = t?.configurable ?? {};
85
85
  outputMessage: "Okay, I cancelled adding members to the group."
86
86
  };
87
87
  await g(
88
- { text: `Adding members ${ot(n)}...`, agentName: "group-creation" },
88
+ { text: `Adding members ${rt(n)}...`, agentName: "group-creation" },
89
89
  t
90
90
  );
91
- const c = t?.configurable?.context;
92
- x(c);
93
- const { result: u, error: d } = await Ke(c.portal, a, n);
94
- if (d || !u)
91
+ const u = t?.configurable?.context;
92
+ x(u);
93
+ const { result: c, error: d } = await Qe(u.portal, a, n);
94
+ if (d || !c)
95
95
  return {
96
96
  status: "success",
97
97
  outputMessage: "I could not add members to that group. Please confirm group access and user accounts, then try again."
98
98
  };
99
- const { addedUsernames: l, notAddedUsers: p } = u;
99
+ const { addedUsernames: l, notAddedUsers: p } = c;
100
100
  try {
101
101
  const f = (await b({
102
- promptText: nt,
103
- schema: rt,
102
+ promptText: ot,
103
+ schema: st,
104
104
  modelTier: "fast",
105
105
  inputVariables: {
106
106
  addedMembers: l.join(", "),
@@ -115,7 +115,7 @@ Do you want to continue?`, { hitlResponse: i } = t?.configurable ?? {};
115
115
  console.error("Error generating add-members success message:", m);
116
116
  }
117
117
  return {};
118
- }, it = `
118
+ }, ct = `
119
119
  Write a concise, friendly success message after creating a portal group.
120
120
 
121
121
  Rules:
@@ -126,7 +126,7 @@ Rules:
126
126
 
127
127
  Group title:
128
128
  {groupTitle}
129
- `, ct = `
129
+ `, ut = `
130
130
  Write a concise, friendly failure message after an attempt to create a portal group.
131
131
 
132
132
  Rules:
@@ -141,11 +141,11 @@ Group title:
141
141
 
142
142
  Failure reason:
143
143
  {failureReason}
144
- `, ne = "portal-group-creation", oe = "approveCreateGroup", ut = s.object({
144
+ `, ne = "portal-group-creation", oe = "approveCreateGroup", lt = s.object({
145
145
  successMessage: s.string().default("")
146
- }), lt = s.object({
146
+ }), dt = s.object({
147
147
  failureMessage: s.string().default("")
148
- }), dt = async (e, t) => {
148
+ }), pt = async (e, t) => {
149
149
  if (e.intentParams.intent !== "create")
150
150
  return {
151
151
  status: "success",
@@ -170,7 +170,7 @@ Failure reason:
170
170
  access: "private"
171
171
  }
172
172
  };
173
- throw new ve(d);
173
+ throw new be(d);
174
174
  }
175
175
  if (o.payload !== !0)
176
176
  return {
@@ -180,16 +180,16 @@ Failure reason:
180
180
  await g({ text: `Creating group "${a}"...`, agentName: "group-creation" }, t);
181
181
  const r = t?.configurable?.context;
182
182
  x(r);
183
- const { result: i, error: c } = await Qe(r.portal, {
183
+ const { result: i, error: u } = await We(r.portal, {
184
184
  title: a,
185
185
  access: "private"
186
186
  });
187
- if (c || !i) {
188
- const d = c?.message?.trim() || "No additional details were provided.";
187
+ if (u || !i) {
188
+ const d = u?.message?.trim() || "No additional details were provided.";
189
189
  try {
190
190
  const p = (await b({
191
- promptText: ct,
192
- schema: lt,
191
+ promptText: ut,
192
+ schema: dt,
193
193
  modelTier: "fast",
194
194
  inputVariables: {
195
195
  groupTitle: a,
@@ -209,11 +209,11 @@ Failure reason:
209
209
  outputMessage: "I could not create that group. Please confirm your permissions and try again with the group title."
210
210
  };
211
211
  }
212
- const u = i.id;
212
+ const c = i.id;
213
213
  try {
214
214
  const l = (await b({
215
- promptText: it,
216
- schema: ut,
215
+ promptText: ct,
216
+ schema: lt,
217
217
  modelTier: "fast",
218
218
  inputVariables: {
219
219
  groupTitle: a
@@ -223,8 +223,8 @@ Failure reason:
223
223
  return {
224
224
  status: "success",
225
225
  outputMessage: l,
226
- sharedStatePatch: { createdGroupId: { value: u } },
227
- createdGroupId: u
226
+ sharedStatePatch: { createdGroupId: { value: c } },
227
+ createdGroupId: c
228
228
  };
229
229
  } catch (d) {
230
230
  console.error("Error generating create-group success message:", d);
@@ -244,7 +244,7 @@ Failure reason:
244
244
  ).join(" ").trim();
245
245
  }
246
246
  return "";
247
- }, pt = `
247
+ }, mt = `
248
248
  You classify whether a user is asking to create a new ArcGIS Portal group or add members to an existing group.
249
249
 
250
250
  Rules:
@@ -270,25 +270,25 @@ Examples:
270
270
 
271
271
  User message:
272
272
  {userMessage}
273
- `, mt = s.object({
273
+ `, gt = s.object({
274
274
  intent: s.enum(["clarify", "create", "addMembers"]).default("clarify"),
275
275
  title: s.string().default(""),
276
276
  memberIdentifiers: s.array(s.string()).default([]),
277
277
  clarifyMessage: s.string().default("")
278
- }), gt = async (e, t) => {
278
+ }), ht = async (e, t) => {
279
279
  await g({ text: "Thinking about groups...", agentName: "group-creation" }, t);
280
280
  const a = I(e.agentExecutionContext.messages).trim(), n = await b({
281
- promptText: pt,
282
- schema: mt,
281
+ promptText: mt,
282
+ schema: gt,
283
283
  modelTier: "default",
284
284
  inputVariables: { userMessage: a }
285
- }), o = n.title.trim(), r = n.memberIdentifiers.filter(Boolean), i = n.clarifyMessage.trim(), c = n.intent === "create" && !!o, u = n.intent === "addMembers" && r.length > 0;
285
+ }), o = n.title.trim(), r = n.memberIdentifiers.filter(Boolean), i = n.clarifyMessage.trim(), u = n.intent === "create" && !!o, c = n.intent === "addMembers" && r.length > 0;
286
286
  return {
287
- intentParams: c ? { intent: "create", title: o } : u ? { intent: "addMembers", memberInfo: { memberIdentifiers: r } } : { intent: "clarify" },
287
+ intentParams: u ? { intent: "create", title: o } : c ? { intent: "addMembers", memberInfo: { memberIdentifiers: r } } : { intent: "clarify" },
288
288
  status: "success",
289
- outputMessage: !c && !u ? i : ""
289
+ outputMessage: !u && !c ? i : ""
290
290
  };
291
- }, ht = [
291
+ }, ft = [
292
292
  "general",
293
293
  "about",
294
294
  "homePage",
@@ -312,54 +312,54 @@ User message:
312
312
  "openData",
313
313
  "hub",
314
314
  "orgExtensions"
315
- ], ft = ["newItem", "createLayer", "developerCredentials"], yt = ["favorites", "group", "living-atlas", "org"], wt = ["featured", "my", "organization"], vt = ["licenses", "members", "overview", "reports", "settings", "status"], bt = s.object({
315
+ ], yt = ["newItem", "createLayer", "developerCredentials"], wt = ["favorites", "group", "living-atlas", "org"], vt = ["featured", "my", "organization"], bt = ["licenses", "members", "overview", "reports", "settings", "status"], It = s.object({
316
316
  destinationType: s.literal("portal-content"),
317
- hash: s.enum(yt).optional(),
317
+ hash: s.enum(wt).optional(),
318
318
  queryParams: s.object({
319
- newItem: s.enum(ft).optional()
319
+ newItem: s.enum(yt).optional()
320
320
  }).optional()
321
- }), It = s.object({
322
- destinationType: s.literal("portal-groups"),
323
- hash: s.enum(wt).optional()
324
321
  }), St = s.object({
322
+ destinationType: s.literal("portal-groups"),
323
+ hash: s.enum(vt).optional()
324
+ }), xt = s.object({
325
325
  destinationType: s.literal("portal-org"),
326
- hash: s.enum(vt).optional(),
326
+ hash: s.enum(bt).optional(),
327
327
  queryParams: s.object({
328
- tab: s.enum(ht).optional(),
328
+ tab: s.enum(ft).optional(),
329
329
  section: s.string().optional(),
330
330
  subsection: s.string().optional(),
331
331
  period: s.string().optional(),
332
332
  startTime: s.string().optional(),
333
333
  endTime: s.string().optional()
334
334
  }).optional()
335
- }), xt = s.object({
335
+ }), Tt = s.object({
336
336
  destinationType: s.literal("portal-item"),
337
337
  itemId: s.string().trim().min(1)
338
- }), Tt = s.object({
338
+ }), Mt = s.object({
339
339
  destinationType: s.literal("portal-group"),
340
340
  groupId: s.string().trim().min(1)
341
- }), Mt = s.object({
341
+ }), Ct = s.object({
342
342
  destinationType: s.union([
343
343
  s.literal("portal-gallery"),
344
344
  s.literal("portal-map-viewer"),
345
345
  s.literal("portal-notebooks"),
346
346
  s.literal("portal-scene-viewer")
347
347
  ])
348
- }), Ct = s.union([
349
- bt,
348
+ }), At = s.union([
350
349
  It,
351
350
  St,
352
351
  xt,
353
352
  Tt,
354
- Mt
355
- ]), Se = "portal-navigation", F = async (e, t) => {
353
+ Mt,
354
+ Ct
355
+ ]), xe = "portal-navigation", F = async (e, t) => {
356
356
  const a = t?.configurable?.context;
357
- !Ie(a) || !a.navigationTargetMap?.[e.destinationType] || await J({ type: Se, data: { ...e } }, t);
358
- }, At = async (e, t) => {
357
+ !Se(a) || !a.navigationTargetMap?.[e.destinationType] || await J({ type: xe, data: { ...e } }, t);
358
+ }, Nt = async (e, t) => {
359
359
  const a = e.createdGroupId ?? e.agentExecutionContext.sharedState.createdGroupId?.value;
360
360
  return a ? (await g({ text: "Preparing navigation...", agentName: "group-creation" }, t), await F({ destinationType: "portal-group", groupId: a }, t), {}) : {};
361
- }, re = (e, t) => t ?? e, xe = h.Root({
362
- ...P(),
361
+ }, re = (e, t) => t ?? e, Te = h.Root({
362
+ ...G(),
363
363
  // * Shared state between nodes (but not persisted to the agent execution context)
364
364
  /** Parameters related to the user's intent for group creation actions */
365
365
  intentParams: h({ reducer: re, default: () => ({ intent: "clarify" }) }),
@@ -368,7 +368,7 @@ User message:
368
368
  * we still need it here to also share between nodes
369
369
  */
370
370
  createdGroupId: h({ reducer: re, default: () => "" })
371
- }), Nt = () => new N(xe).addNode("detectGroupCreationIntent", gt).addNode("createPortalGroup", dt).addNode("addMembersToPortalGroup", st).addNode("suggestCreatedGroupNavigation", At).addEdge(G, "detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent", (t) => {
371
+ }), Pt = () => new N(Te).addNode("detectGroupCreationIntent", ht).addNode("createPortalGroup", pt).addNode("addMembersToPortalGroup", it).addNode("suggestCreatedGroupNavigation", Nt).addEdge(P, "detectGroupCreationIntent").addConditionalEdges("detectGroupCreationIntent", (t) => {
372
372
  switch (t.intentParams.intent) {
373
373
  case "create":
374
374
  return "createPortalGroup";
@@ -380,38 +380,38 @@ User message:
380
380
  }).addEdge("createPortalGroup", "suggestCreatedGroupNavigation").addEdge("addMembersToPortalGroup", "suggestCreatedGroupNavigation").addEdge("suggestCreatedGroupNavigation", w), Gt = String.raw`- **portal-group-creation** - Portal group creation assistant:
381
381
  - creates a new ArcGIS Portal group for the signed-in user
382
382
  - adds users to the newly created group using @mention usernames
383
- `, Pt = {
383
+ `, qt = {
384
384
  id: "portal-group-creation",
385
385
  name: "Portal Group Creation",
386
386
  description: Gt,
387
- createGraph: Nt,
388
- workspace: xe
389
- }, Te = "portalDocAssistantMemory", qt = () => ({ conversationId: "" }), Et = (e) => {
390
- const t = e?.[Te]?.value;
387
+ createGraph: Pt,
388
+ workspace: Te
389
+ }, Me = "portalDocAssistantMemory", Et = () => ({ conversationId: "" }), kt = (e) => {
390
+ const t = e?.[Me]?.value;
391
391
  if (!t || typeof t != "object")
392
- return qt();
392
+ return Et();
393
393
  const a = t;
394
394
  return {
395
395
  conversationId: typeof a.conversationId == "string" ? a.conversationId : ""
396
396
  };
397
- }, kt = (e) => ({
398
- [Te]: { value: e }
399
- }), zt = {
397
+ }, zt = (e) => ({
398
+ [Me]: { value: e }
399
+ }), $t = {
400
400
  pipeline: {
401
401
  follow_up: { allow: !1 }
402
402
  }
403
403
  };
404
- function $t(e) {
404
+ function Dt(e) {
405
405
  return {
406
406
  kind: "DocAIAssistantRequest",
407
407
  filters: {
408
- ...zt,
408
+ ...$t,
409
409
  persona: { persona: e }
410
410
  }
411
411
  };
412
412
  }
413
- const Dt = "https://www.arcgis.com/sharing/rest";
414
- async function Rt({
413
+ const Rt = "https://www.arcgis.com/sharing/rest";
414
+ async function Ut({
415
415
  portal: e,
416
416
  question: t,
417
417
  persona: a,
@@ -421,26 +421,26 @@ async function Rt({
421
421
  skillId: i
422
422
  }) {
423
423
  i ??= "doc_ai_assistant";
424
- const c = $t(a), u = await Ut({
424
+ const u = Dt(a), c = await Ft({
425
425
  portal: e,
426
426
  skillId: i,
427
427
  message: t,
428
- options: { context: c, previousConversationId: n, useProdDocAssistant: o, signal: r }
428
+ options: { context: u, previousConversationId: n, useProdDocAssistant: o, signal: r }
429
429
  });
430
430
  return {
431
- reply: Ft(u, i),
432
- conversationId: u[0]?.conversationId ?? ""
431
+ reply: Ot(c, i),
432
+ conversationId: c[0]?.conversationId ?? ""
433
433
  };
434
434
  }
435
- async function Ut({
435
+ async function Ft({
436
436
  portal: e,
437
437
  skillId: t,
438
438
  message: a,
439
439
  options: n
440
440
  }) {
441
- const o = e.helperServices.aiAssistantServices.url, i = `${n.useProdDocAssistant ? "https://aiservices-beta.arcgis.com" : o}/skills/${t}/chat`, u = {
441
+ const o = e.helperServices.aiAssistantServices.url, i = `${n.useProdDocAssistant ? "https://aiservices-beta.arcgis.com" : o}/skills/${t}/chat`, c = {
442
442
  "Content-Type": "application/json",
443
- token: n.useProdDocAssistant ? (await Z.getCredential(Dt, { oAuthPopupConfirmation: !1 })).token : Z.findCredential(e.url)?.token ?? ""
443
+ token: n.useProdDocAssistant ? (await Z.getCredential(Rt, { oAuthPopupConfirmation: !1 })).token : Z.findCredential(e.url)?.token ?? ""
444
444
  }, d = await ee(i, {
445
445
  method: "post",
446
446
  body: JSON.stringify({
@@ -448,7 +448,7 @@ async function Ut({
448
448
  context: n.context,
449
449
  conversationId: n.previousConversationId
450
450
  }),
451
- headers: u,
451
+ headers: c,
452
452
  signal: n.signal
453
453
  });
454
454
  if (d.httpStatus !== 200)
@@ -458,11 +458,11 @@ async function Ut({
458
458
  const l = d.data, p = [l], { conversationId: m, inquiryId: f } = l, y = async (M, q) => {
459
459
  if (!q)
460
460
  return;
461
- await Je(500);
461
+ await _e(500);
462
462
  const T = await ee(i, {
463
463
  method: "post",
464
464
  body: JSON.stringify({ conversationId: m, inquiryId: f, ackSequenceNumber: M }),
465
- headers: u,
465
+ headers: c,
466
466
  signal: n.signal
467
467
  });
468
468
  if (T.httpStatus !== 200)
@@ -474,7 +474,7 @@ async function Ut({
474
474
  };
475
475
  return l.hasMore && await y(l.sequenceNumber, l.hasMore), p;
476
476
  }
477
- function Ft(e, t) {
477
+ function Ot(e, t) {
478
478
  switch (t) {
479
479
  case "doc_chat":
480
480
  return e.find((a) => a.message != null)?.message ?? "";
@@ -492,32 +492,41 @@ function Ft(e, t) {
492
492
  return U(t);
493
493
  }
494
494
  }
495
- const Ot = async (e, t) => {
496
- await g({ text: "Asking documentation assistant...", agentName: "doc-assistant" }, t);
497
- const a = I(e.agentExecutionContext.messages).trim();
498
- if (!a)
495
+ const Lt = async (e, t) => {
496
+ const a = performance.now();
497
+ try {
498
+ await g({ text: "Asking documentation assistant...", agentName: "doc-assistant" }, t);
499
+ const n = I(e.agentExecutionContext.messages).trim();
500
+ if (!n)
501
+ return {
502
+ status: "success",
503
+ outputMessage: "Please share your question and I can help with ArcGIS and Portal documentation."
504
+ };
505
+ const o = t?.configurable?.context;
506
+ x(o);
507
+ const r = kt(e.agentExecutionContext.sharedState), { reply: i, conversationId: u } = await Ut({
508
+ portal: o.portal,
509
+ question: n,
510
+ previousConversationId: r.conversationId || void 0,
511
+ skillId: "doc_ai_assistant",
512
+ persona: "doc-online",
513
+ useProdDocAssistant: o.useProdDocAssistant
514
+ });
499
515
  return {
500
516
  status: "success",
501
- outputMessage: "Please share your question and I can help with ArcGIS and Portal documentation."
517
+ outputMessage: i.trim() || "I could not retrieve a response from the documentation assistant.",
518
+ sharedStatePatch: zt({
519
+ conversationId: u || r.conversationId
520
+ })
502
521
  };
503
- const n = t?.configurable?.context;
504
- x(n);
505
- const o = Et(e.agentExecutionContext.sharedState), { reply: r, conversationId: i } = await Rt({
506
- portal: n.portal,
507
- question: a,
508
- previousConversationId: o.conversationId || void 0,
509
- skillId: "doc_ai_assistant",
510
- persona: "doc-online",
511
- useProdDocAssistant: n.useProdDocAssistant
512
- });
513
- return {
514
- status: "success",
515
- outputMessage: r.trim() || "I could not retrieve a response from the documentation assistant.",
516
- sharedStatePatch: kt({
517
- conversationId: i || o.conversationId
518
- })
519
- };
520
- }, Me = be(
522
+ } finally {
523
+ console.info("[arcgis-portal-ai-assistant] node timing", {
524
+ agent: "portal-doc-assistant",
525
+ node: "answerDocQuestion",
526
+ durationMs: Number((performance.now() - a).toFixed(1))
527
+ });
528
+ }
529
+ }, Ce = Ie(
521
530
  async ({ groupTitle: e }, t) => {
522
531
  const a = e.trim();
523
532
  if (!a)
@@ -525,7 +534,7 @@ const Ot = async (e, t) => {
525
534
  const n = t?.configurable?.context;
526
535
  x(n);
527
536
  try {
528
- return (await We(n.portal, { query: `title:${a}`, num: 1 }))?.results[0]?.id || null;
537
+ return (await Je(n.portal, { query: `title:${a}`, num: 1 }))?.results[0]?.id || null;
529
538
  } catch (o) {
530
539
  return console.error("Error searching for portal group by title:", o), null;
531
540
  }
@@ -537,14 +546,14 @@ const Ot = async (e, t) => {
537
546
  groupTitle: s.string().describe("The portal group title to resolve to a group id.")
538
547
  })
539
548
  }
540
- ), Ce = be(
549
+ ), Ae = Ie(
541
550
  async ({ itemTitle: e }, t) => {
542
551
  const a = e.trim();
543
552
  if (!a)
544
553
  return null;
545
554
  const n = t?.configurable?.context;
546
555
  x(n);
547
- const { result: o, error: r } = await _e(n.portal, a, { num: 1 });
556
+ const { result: o, error: r } = await Ye(n.portal, a, { num: 1 });
548
557
  return r && console.error("Error searching for portal item by title:", r), o?.results[0]?.id || null;
549
558
  },
550
559
  {
@@ -562,7 +571,7 @@ function A(e, t = "#") {
562
571
  const n = e.match(new RegExp(`\\${t}([^\\s"']+)`, "u"));
563
572
  return n?.[1] ? n[1].trim() : null;
564
573
  }
565
- function Lt(e) {
574
+ function jt(e) {
566
575
  const t = Q(e).flatMap((a) => {
567
576
  const n = a, o = e[a], r = [
568
577
  n,
@@ -570,19 +579,19 @@ function Lt(e) {
570
579
  description: o.description,
571
580
  hints: o.hints
572
581
  }
573
- ], i = o.sections ? Q(o.sections).map((c) => {
574
- const u = o.sections?.[c];
575
- return [`${n}-${c}`, u];
582
+ ], i = o.sections ? Q(o.sections).map((u) => {
583
+ const c = o.sections?.[u];
584
+ return [`${n}-${u}`, c];
576
585
  }) : [];
577
586
  return [r, ...i];
578
587
  });
579
588
  return Object.fromEntries(t);
580
589
  }
581
- function jt(e) {
590
+ function Vt(e) {
582
591
  return Object.entries(e).map(([t, { description: a, hints: n }]) => ` - ${t}: ${a} (hints: ${n.join(", ")})`).join(`
583
592
  `);
584
593
  }
585
- const Vt = {
594
+ const Bt = {
586
595
  // Example prompt: "Take me to my content"
587
596
  "portal-content": {
588
597
  description: "The main content page of the portal.",
@@ -716,13 +725,13 @@ const Vt = {
716
725
  }
717
726
  }
718
727
  }
719
- }, Ae = Lt(Vt), Bt = Q(Ae), Kt = jt(Ae), Qt = `
728
+ }, Ne = jt(Bt), Kt = Q(Ne), Qt = Vt(Ne), Wt = `
720
729
  You decide whether the assistant response should include a navigation action to ArcGIS Portal.
721
730
 
722
731
  Given the user question and assistant response:
723
732
  - Decide if a navigation action would help the user complete the task.
724
733
  - If yes, choose one destinationType:
725
- ${Kt}
734
+ ${Qt}
726
735
 
727
736
  Rules:
728
737
  - Only suggest navigation when you are highly confident the destination will help complete the user's task.
@@ -747,33 +756,47 @@ Assistant response:
747
756
  {response}
748
757
  `, se = s.object({
749
758
  shouldSuggestNavigation: s.boolean().default(!1),
750
- destinationType: s.enum(["none", ...Bt]).default("none"),
759
+ destinationType: s.enum(["none", ...Kt]).default("none"),
751
760
  itemId: s.string().default(""),
752
761
  groupId: s.string().default(""),
753
762
  confidence: s.number().min(0).max(1).default(0)
754
- }), Wt = async (e, t) => {
755
- await g({ text: "Extracting navigation intent...", agentName: "doc-assistant" }, t);
756
- const a = e.outputMessage.trim();
757
- if (!a)
758
- return {};
759
- const n = I(e.agentExecutionContext.messages).trim(), o = await Y.fromTemplate(Qt).format({
760
- question: n,
761
- response: a
762
- }), i = (await _({ modelTier: "fast" })).withStructuredOutput(se), c = se.parse(await i.invoke(o));
763
- if (!c.shouldSuggestNavigation || c.destinationType === "none")
764
- return {};
765
- if (c.destinationType === "portal-item" && !c.itemId) {
766
- const d = A(n, "#");
767
- d && (c.itemId = await Ce.invoke({ itemTitle: d }, t) ?? "");
768
- }
769
- if (c.destinationType === "portal-group" && !c.groupId) {
770
- const d = A(n, "$") ?? A(n, "#");
771
- d && (c.groupId = await Me.invoke({ groupTitle: d }, t) ?? "");
763
+ });
764
+ let ie;
765
+ async function Jt() {
766
+ return ie ??= _({ modelTier: "fast" }), await ie;
767
+ }
768
+ const _t = async (e, t) => {
769
+ const a = performance.now();
770
+ try {
771
+ await g({ text: "Extracting navigation intent...", agentName: "doc-assistant" }, t);
772
+ const n = e.outputMessage.trim();
773
+ if (!n)
774
+ return {};
775
+ const o = I(e.agentExecutionContext.messages).trim(), r = await Y.fromTemplate(Wt).format({
776
+ question: o,
777
+ response: n
778
+ }), u = (await Jt()).withStructuredOutput(se), c = se.parse(await u.invoke(r));
779
+ if (!c.shouldSuggestNavigation || c.destinationType === "none")
780
+ return {};
781
+ if (c.destinationType === "portal-item" && !c.itemId) {
782
+ const l = A(o, "#");
783
+ l && (c.itemId = await Ae.invoke({ itemTitle: l }, t) ?? "");
784
+ }
785
+ if (c.destinationType === "portal-group" && !c.groupId) {
786
+ const l = A(o, "$") ?? A(o, "#");
787
+ l && (c.groupId = await Ce.invoke({ groupTitle: l }, t) ?? "");
788
+ }
789
+ const d = Yt(c);
790
+ return d ? (await F(d, t), {}) : {};
791
+ } finally {
792
+ console.info("[arcgis-portal-ai-assistant] node timing", {
793
+ agent: "portal-doc-assistant",
794
+ node: "extractNavigationIntent",
795
+ durationMs: Number((performance.now() - a).toFixed(1))
796
+ });
772
797
  }
773
- const u = Jt(c);
774
- return u ? (await F(u, t), {}) : {};
775
798
  };
776
- function Jt({
799
+ function Yt({
777
800
  destinationType: e,
778
801
  itemId: t,
779
802
  groupId: a
@@ -799,7 +822,7 @@ function Jt({
799
822
  case "portal-content-new-item-developer-credentials":
800
823
  return {
801
824
  queryParams: {
802
- newItem: _t[e]
825
+ newItem: Ht[e]
803
826
  },
804
827
  destinationType: "portal-content"
805
828
  };
@@ -807,11 +830,11 @@ function Jt({
807
830
  case "portal-content-group":
808
831
  case "portal-content-living-atlas":
809
832
  case "portal-content-organization":
810
- return { destinationType: "portal-content", hash: Yt[e] };
833
+ return { destinationType: "portal-content", hash: Xt[e] };
811
834
  case "portal-groups-featured":
812
835
  case "portal-groups-my":
813
836
  case "portal-groups-organization":
814
- return { destinationType: "portal-groups", hash: Ht[e] };
837
+ return { destinationType: "portal-groups", hash: Zt[e] };
815
838
  case "portal-org-security-custom-sign-in":
816
839
  case "portal-org-security-logins":
817
840
  case "portal-org-security-change-login-provider":
@@ -823,7 +846,7 @@ function Jt({
823
846
  hash: "settings",
824
847
  queryParams: {
825
848
  tab: "security",
826
- subsection: Xt[e]
849
+ subsection: ea[e]
827
850
  }
828
851
  };
829
852
  case "portal-item":
@@ -836,40 +859,40 @@ function Jt({
836
859
  return U(e);
837
860
  }
838
861
  }
839
- const _t = {
862
+ const Ht = {
840
863
  "portal-content-new-item": "newItem",
841
864
  "portal-content-new-item-feature-layer": "createLayer",
842
865
  "portal-content-new-item-developer-credentials": "developerCredentials"
843
- }, Yt = {
866
+ }, Xt = {
844
867
  "portal-content-favorites": "favorites",
845
868
  "portal-content-group": "group",
846
869
  "portal-content-living-atlas": "living-atlas",
847
870
  "portal-content-organization": "org"
848
- }, Ht = {
871
+ }, Zt = {
849
872
  "portal-groups-featured": "featured",
850
873
  "portal-groups-my": "my",
851
874
  "portal-groups-organization": "organization"
852
- }, Xt = {
875
+ }, ea = {
853
876
  "portal-org-security-custom-sign-in": "customSignInSection",
854
877
  "portal-org-security-logins": "loginsSection",
855
878
  "portal-org-security-change-login-provider": "changeLoginProviderSection",
856
879
  "portal-org-security-multifactor-auth": "multiFactorAuthSection",
857
880
  "portal-org-security-multifactor-enforcement": "multifactorEnforcementSection",
858
881
  "portal-org-security-multifactor-designated-admins": "multifactorDesignatedAdminsSection"
859
- }, Ne = h.Root({
860
- ...P()
861
- }), Zt = () => new N(Ne).addNode("answerDocQuestion", Ot).addNode("extractNavigationIntent", Wt).addEdge(G, "answerDocQuestion").addEdge("answerDocQuestion", "extractNavigationIntent").addEdge("extractNavigationIntent", w), ea = String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
882
+ }, Pe = h.Root({
883
+ ...G()
884
+ }), ta = () => new N(Pe).addNode("answerDocQuestion", Lt).addNode("extractNavigationIntent", _t).addEdge(P, "answerDocQuestion").addEdge("answerDocQuestion", "extractNavigationIntent").addEdge("extractNavigationIntent", w), aa = String.raw`- **portal-doc-assistant** - General ArcGIS documentation and Portal help assistant:
862
885
  - answers general ArcGIS, Portal, Enterprise, and JavaScript SDK questions
863
886
  - acts as a fallback when specialized agents are not applicable
864
- `, ta = {
887
+ `, na = {
865
888
  id: "portal-doc-assistant",
866
889
  name: "Portal Doc Assistant",
867
- description: ea,
868
- createGraph: Zt,
869
- workspace: Ne
870
- }, aa = () => ({ latestGroupId: null, memory: {} }), O = (e) => {
890
+ description: aa,
891
+ createGraph: ta,
892
+ workspace: Pe
893
+ }, oa = () => ({ latestGroupId: null, memory: {} }), O = (e) => {
871
894
  const t = e?.agentExecutionContext.sharedState.portalGroupSummaryMemory?.value;
872
- return t ? { latestGroupId: t.latestGroupId, memory: t.memory } : aa();
895
+ return t ? { latestGroupId: t.latestGroupId, memory: t.memory } : oa();
873
896
  }, Ge = `
874
897
  Shared markdown formatting rules:
875
898
  - Use clear markdown headings (##) to separate sections.
@@ -877,7 +900,7 @@ Shared markdown formatting rules:
877
900
  - Emphasize key metrics with bold labels (for example: **Recent items:** 4).
878
901
  - Keep wording direct and analytical; avoid filler language but make sure the language is friendly.
879
902
  - Do not include raw internal IDs unless explicitly requested.
880
- `, na = `
903
+ `, ra = `
881
904
  You answer follow-up questions about ArcGIS group analytics.
882
905
 
883
906
  ${Ge}
@@ -902,14 +925,14 @@ Group full context:
902
925
 
903
926
  Question:
904
927
  {question}
905
- `, oa = async (e, t) => {
928
+ `, sa = async (e, t) => {
906
929
  await g({ text: "Answering group follow-up...", agentName: "group-analytics" }, t);
907
930
  const a = O(e), n = e.groupSummaryGroupId ?? a.latestGroupId, o = n ? a.memory[n] : void 0, r = e.groupSummaryQuestion || I(e.agentExecutionContext.messages);
908
931
  return o ? {
909
932
  status: "success",
910
933
  outputMessage: (await b({
911
- promptText: na,
912
- schema: ra,
934
+ promptText: ra,
935
+ schema: ia,
913
936
  modelTier: "default",
914
937
  inputVariables: {
915
938
  summary: o.summary,
@@ -921,10 +944,10 @@ Question:
921
944
  status: "success",
922
945
  outputMessage: "I do not have group analytics context yet. Ask me to analyze a group first with analyze group <group id>."
923
946
  };
924
- }, ra = s.object({
947
+ }, ia = s.object({
925
948
  answer: s.string(),
926
949
  isRelevant: s.boolean()
927
- }), sa = `
950
+ }), ca = `
928
951
  Classify the user's request for ArcGIS Portal group analytics.
929
952
 
930
953
  Rules:
@@ -953,42 +976,42 @@ hasAnalyticsContext:
953
976
 
954
977
  User message:
955
978
  {userMessage}
956
- `, ia = async (e, t) => {
979
+ `, ua = async (e, t) => {
957
980
  await g({ text: "Analyzing group-analytics intent...", agentName: "group-analytics" }, t);
958
- const a = I(e.agentExecutionContext.messages), n = !!O(e).latestGroupId, o = await Y.fromTemplate(sa).format({
981
+ const a = I(e.agentExecutionContext.messages), n = !!O(e).latestGroupId, o = await Y.fromTemplate(ca).format({
959
982
  userMessage: a,
960
983
  hasAnalyticsContext: String(n)
961
- }), i = (await _({ modelTier: "fast" })).withStructuredOutput(ie), c = ie.parse(await i.invoke(o));
962
- let u = c.groupId;
963
- if ((c.intent === "summarize" || c.intent === "navigation") && !u) {
984
+ }), i = (await _({ modelTier: "fast" })).withStructuredOutput(ce), u = ce.parse(await i.invoke(o));
985
+ let c = u.groupId;
986
+ if ((u.intent === "summarize" || u.intent === "navigation") && !c) {
964
987
  const y = A(a, "$");
965
- y && (u = await Me.invoke({ groupTitle: y }, t) ?? "");
988
+ y && (c = await Ce.invoke({ groupTitle: y }, t) ?? "");
966
989
  }
967
- const { intent: d, question: l } = c, p = d === "summarize" && !u, m = d === "followUp" && !(l ?? "").trim(), f = d === "clarify" || p || m;
990
+ const { intent: d, question: l } = u, p = d === "summarize" && !c, m = d === "followUp" && !(l ?? "").trim(), f = d === "clarify" || p || m;
968
991
  return {
969
992
  groupSummaryIntent: f ? "clarify" : d,
970
- groupSummaryGroupId: u || null,
993
+ groupSummaryGroupId: c || null,
971
994
  groupSummaryQuestion: l || "",
972
995
  status: "success",
973
996
  outputMessage: f ? "Please clarify with a group id or title" : ""
974
997
  };
975
- }, ie = s.object({
998
+ }, ce = s.object({
976
999
  intent: s.enum(["summarize", "followUp", "navigation", "clarify"]),
977
1000
  groupId: s.string().default(""),
978
1001
  question: s.string().default("")
979
- }), ca = async (e, t) => {
1002
+ }), la = async (e, t) => {
980
1003
  const a = O(e), n = e.groupSummaryGroupId ?? a.latestGroupId;
981
1004
  return await g({ text: "Preparing navigation...", agentName: "group-analytics" }, t), await F(
982
1005
  n ? { destinationType: "portal-group", groupId: n } : { destinationType: "portal-groups" },
983
1006
  t
984
1007
  ), { status: "success" };
985
1008
  };
986
- function Pe({ timestamp: e, now: t, windowMs: a }) {
1009
+ function qe({ timestamp: e, now: t, windowMs: a }) {
987
1010
  return e ? t - e <= a : !1;
988
1011
  }
989
- const ua = 720 * 60 * 60 * 1e3;
990
- function la(e) {
991
- const t = He(e);
1012
+ const da = 720 * 60 * 60 * 1e3;
1013
+ function pa(e) {
1014
+ const t = Xe(e);
992
1015
  return {
993
1016
  id: e.id ?? "",
994
1017
  title: e.title ?? "",
@@ -1001,10 +1024,10 @@ function la(e) {
1001
1024
  modified: e.modified?.getTime(),
1002
1025
  isInvitationOnly: e.isInvitationOnly,
1003
1026
  sourceSignals: {
1004
- capabilities: tt(e),
1005
- membershipAccess: et(e),
1006
- isOpenData: Ze(e),
1007
- isDistributedCollaborationGroup: Xe(e),
1027
+ capabilities: at(e),
1028
+ membershipAccess: tt(e),
1029
+ isOpenData: et(e),
1030
+ isDistributedCollaborationGroup: Ze(e),
1008
1031
  orgId: t.orgId,
1009
1032
  hiddenMembers: t.hiddenMembers,
1010
1033
  isViewOnly: t.isViewOnly,
@@ -1013,7 +1036,7 @@ function la(e) {
1013
1036
  }
1014
1037
  };
1015
1038
  }
1016
- async function da(e) {
1039
+ async function ma(e) {
1017
1040
  const t = { owner: e.owner ?? "", admins: [], users: [] };
1018
1041
  try {
1019
1042
  return await e.fetchMembers();
@@ -1021,7 +1044,7 @@ async function da(e) {
1021
1044
  return console.warn("Unable to fetch group members for analytics context", a), t;
1022
1045
  }
1023
1046
  }
1024
- function pa(e) {
1047
+ function ga(e) {
1025
1048
  return e.map((t) => ({
1026
1049
  id: t.id ?? "",
1027
1050
  title: t.title ?? "Untitled",
@@ -1031,40 +1054,40 @@ function pa(e) {
1031
1054
  modified: t.modified?.getTime()
1032
1055
  }));
1033
1056
  }
1034
- function ma(e, t) {
1057
+ function ha(e, t) {
1035
1058
  return e.filter(
1036
- (a) => a.modified ? Pe({ timestamp: a.modified, now: t, windowMs: ua }) : !1
1059
+ (a) => a.modified ? qe({ timestamp: a.modified, now: t, windowMs: da }) : !1
1037
1060
  );
1038
1061
  }
1039
- function ga(e) {
1062
+ function fa(e) {
1040
1063
  const t = /* @__PURE__ */ new Map();
1041
1064
  for (const a of e)
1042
1065
  t.set(a.type, (t.get(a.type) ?? 0) + 1);
1043
1066
  return [...t.entries()].sort((a, n) => n[1] - a[1] || a[0].localeCompare(n[0])).slice(0, 6).map(([a, n]) => ({ type: a, count: n }));
1044
1067
  }
1045
- async function ha(e) {
1046
- const t = await e.queryItems({ num: 20, sortField: "modified", sortOrder: "desc" }), a = pa(t.results), n = Date.now();
1068
+ async function ya(e) {
1069
+ const t = await e.queryItems({ num: 20, sortField: "modified", sortOrder: "desc" }), a = ga(t.results), n = Date.now();
1047
1070
  return {
1048
1071
  total: t.total,
1049
1072
  topItems: a,
1050
- recentlyModifiedItems: ma(a, n),
1051
- topItemTypes: ga(a)
1073
+ recentlyModifiedItems: ha(a, n),
1074
+ topItemTypes: fa(a)
1052
1075
  };
1053
1076
  }
1054
- async function fa(e, t) {
1077
+ async function wa(e, t) {
1055
1078
  if (!t)
1056
1079
  return { error: { code: "missingGroupId", message: "Group id is required." } };
1057
1080
  try {
1058
1081
  const n = (await e.queryGroups({ query: `id:${t}`, num: 1 })).results[0];
1059
1082
  if (!n)
1060
1083
  return { error: { code: "groupNotFound", message: `No group found for id: ${t}` } };
1061
- const o = la(n), r = await da(n), i = await ha(n);
1084
+ const o = pa(n), r = await ma(n), i = await ya(n);
1062
1085
  return { result: { group: o, members: r, items: i } };
1063
1086
  } catch (a) {
1064
1087
  return console.error("Error fetching portal group analytics context:", a), { error: { code: "unhandledError" } };
1065
1088
  }
1066
1089
  }
1067
- const ya = `
1090
+ const va = `
1068
1091
  You summarize ArcGIS Portal groups based on structured context and deterministic activity signals.
1069
1092
 
1070
1093
  ${Ge}
@@ -1103,7 +1126,7 @@ Group context:
1103
1126
 
1104
1127
  Deterministic signals:
1105
1128
  {deterministicSignals}
1106
- `, wa = 2160 * 60 * 60 * 1e3, va = async (e, t) => {
1129
+ `, ba = 2160 * 60 * 60 * 1e3, Ia = async (e, t) => {
1107
1130
  const a = e.groupSummaryGroupId;
1108
1131
  if (!a)
1109
1132
  return {
@@ -1113,15 +1136,15 @@ Deterministic signals:
1113
1136
  await g({ text: `Analyzing group ${a}...`, agentName: "group-analytics" }, t);
1114
1137
  const n = t?.configurable?.context;
1115
1138
  x(n);
1116
- const { result: o, error: r } = await fa(n.portal, a);
1139
+ const { result: o, error: r } = await wa(n.portal, a);
1117
1140
  if (r || !o)
1118
1141
  return await g({ text: "Failed to fetch group context", agentName: "group-analytics" }, t), {
1119
1142
  status: "success",
1120
1143
  outputMessage: "Unable to retrieve group context for analytics."
1121
1144
  };
1122
- const { group: i, items: c } = o, u = Date.now(), d = i.modified, l = d ? Pe({ timestamp: d, now: u, windowMs: wa }) : !1, p = c.recentlyModifiedItems.length, m = p > 0, f = l || m, y = await b({
1123
- promptText: ya,
1124
- schema: ba,
1145
+ const { group: i, items: u } = o, c = Date.now(), d = i.modified, l = d ? qe({ timestamp: d, now: c, windowMs: ba }) : !1, p = u.recentlyModifiedItems.length, m = p > 0, f = l || m, y = await b({
1146
+ promptText: va,
1147
+ schema: Sa,
1125
1148
  modelTier: "default",
1126
1149
  inputVariables: {
1127
1150
  context: JSON.stringify(o),
@@ -1144,11 +1167,11 @@ Deterministic signals:
1144
1167
  outputMessage: q,
1145
1168
  sharedStatePatch: { portalGroupSummaryMemory: { value: C } }
1146
1169
  };
1147
- }, ba = s.object({
1170
+ }, Sa = s.object({
1148
1171
  summary: s.string(),
1149
1172
  followUpQuestions: s.array(s.string()).default([])
1150
- }), L = (e, t) => t ?? e, qe = h.Root({
1151
- ...P(),
1173
+ }), L = (e, t) => t ?? e, Ee = h.Root({
1174
+ ...G(),
1152
1175
  groupSummaryIntent: h({
1153
1176
  reducer: L,
1154
1177
  default: () => "clarify"
@@ -1161,24 +1184,24 @@ Deterministic signals:
1161
1184
  reducer: L,
1162
1185
  default: () => ""
1163
1186
  })
1164
- }), Ia = () => new N(qe).addNode("detectGroupSummaryIntent", ia).addNode("summarizePortalGroup", va).addNode("answerGroupSummaryFollowUp", oa).addNode("suggestGroupSummaryNavigation", ca).addEdge(G, "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), Sa = String.raw`- **portal-group-analytics** - Portal group analytics assistant:
1187
+ }), xa = () => new N(Ee).addNode("detectGroupSummaryIntent", ua).addNode("summarizePortalGroup", Ia).addNode("answerGroupSummaryFollowUp", sa).addNode("suggestGroupSummaryNavigation", la).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), Ta = String.raw`- **portal-group-analytics** - Portal group analytics assistant:
1165
1188
  - summarizes ArcGIS portal groups from group context and sourceJSON details
1166
1189
  - answers follow-up questions grounded in the summarized group
1167
1190
  - suggests navigation to groups when relevant
1168
- `, xa = {
1191
+ `, Ma = {
1169
1192
  id: "portal-group-analytics",
1170
1193
  name: "Portal Group Analytics",
1171
- description: Sa,
1172
- createGraph: Ia,
1173
- workspace: qe
1174
- }, Ta = () => ({ latestItemId: null, memory: {} }), H = (e) => {
1194
+ description: Ta,
1195
+ createGraph: xa,
1196
+ workspace: Ee
1197
+ }, Ca = () => ({ latestItemId: null, memory: {} }), H = (e) => {
1175
1198
  const t = e?.agentExecutionContext.sharedState.portalItemAnalyticsSummaryMemory?.value;
1176
- return t ? { latestItemId: t.latestItemId, memory: t.memory } : Ta();
1177
- }, ce = s.object({
1199
+ return t ? { latestItemId: t.latestItemId, memory: t.memory } : Ca();
1200
+ }, ue = s.object({
1178
1201
  intent: s.enum(["summarize", "followUp", "clarify"]),
1179
1202
  itemId: s.string().default(""),
1180
1203
  question: s.string().default("")
1181
- }), Ma = s.object({ summary: s.string(), followUpQuestions: s.array(s.string()).default([]) }), Ca = s.object({ answer: s.string(), isRelevant: s.boolean() }), Aa = `
1204
+ }), Aa = s.object({ summary: s.string(), followUpQuestions: s.array(s.string()).default([]) }), Na = s.object({ answer: s.string(), isRelevant: s.boolean() }), Pa = `
1182
1205
  You answer follow-up questions about an ArcGIS item.
1183
1206
 
1184
1207
  Ground your answer in the provided item context.
@@ -1198,14 +1221,14 @@ Item full context
1198
1221
 
1199
1222
  Question:
1200
1223
  {question}
1201
- `, Na = async (e, t) => {
1224
+ `, Ga = async (e, t) => {
1202
1225
  await g({ text: "Answering follow-up...", agentName: "analytics" }, t);
1203
1226
  const a = H(e), n = e.analyticsItemId ?? a.latestItemId, o = n ? a.memory[n] : void 0, r = e.analyticsQuestion || I(e.agentExecutionContext.messages);
1204
1227
  return o ? {
1205
1228
  status: "success",
1206
1229
  outputMessage: (await b({
1207
- promptText: Aa,
1208
- schema: Ca,
1230
+ promptText: Pa,
1231
+ schema: Na,
1209
1232
  modelTier: "default",
1210
1233
  inputVariables: {
1211
1234
  summary: o.summary,
@@ -1217,7 +1240,7 @@ Question:
1217
1240
  status: "success",
1218
1241
  outputMessage: "I don't have enough information yet. Please ask me to summarize the item first using summarize item <item id>."
1219
1242
  };
1220
- }, Ga = `
1243
+ }, qa = `
1221
1244
  Classify the user analytics request.
1222
1245
 
1223
1246
  Rules:
@@ -1247,27 +1270,27 @@ hasSummaryContext:
1247
1270
 
1248
1271
  User message:
1249
1272
  {userMessage}
1250
- `, Pa = async (e, t) => {
1273
+ `, Ea = async (e, t) => {
1251
1274
  await g({ text: "Analyzing intent...", agentName: "analytics" }, t);
1252
- const a = I(e.agentExecutionContext.messages), n = !!H(e).latestItemId, o = await Y.fromTemplate(Ga).format({
1275
+ const a = I(e.agentExecutionContext.messages), n = !!H(e).latestItemId, o = await Y.fromTemplate(qa).format({
1253
1276
  userMessage: a,
1254
1277
  hasSummaryContext: String(n)
1255
- }), i = (await _({ modelTier: "fast" })).withStructuredOutput(ce), c = ce.parse(await i.invoke(o));
1256
- let u = c.itemId;
1257
- if (c.intent === "summarize" && !u) {
1278
+ }), i = (await _({ modelTier: "fast" })).withStructuredOutput(ue), u = ue.parse(await i.invoke(o));
1279
+ let c = u.itemId;
1280
+ if (u.intent === "summarize" && !c) {
1258
1281
  const y = A(a, "#");
1259
- y && (u = await Ce.invoke({ itemTitle: y }, t) ?? "");
1282
+ y && (c = await Ae.invoke({ itemTitle: y }, t) ?? "");
1260
1283
  }
1261
- const { intent: d, question: l } = c, f = d === "clarify" || d === "summarize" && !u || d === "followUp" && !l;
1284
+ const { intent: d, question: l } = u, f = d === "clarify" || d === "summarize" && !c || d === "followUp" && !l;
1262
1285
  return {
1263
1286
  agentExecutionContext: { ...e.agentExecutionContext },
1264
1287
  analyticsIntent: f ? "clarify" : d,
1265
- analyticsItemId: u || null,
1288
+ analyticsItemId: c || null,
1266
1289
  analyticsQuestion: l || "",
1267
1290
  status: "success",
1268
1291
  outputMessage: f ? 'Please clarify with summarize item <item id>, summarize item #<title>, or summarize item #"<title with spaces>".' : ""
1269
1292
  };
1270
- }, qa = `
1293
+ }, ka = `
1271
1294
  You are a item summary tool for ArcGIS. Your job is to summarize an item's info based on the provided context.
1272
1295
  Summary rules:
1273
1296
  - The summary should be concise markdown, make sure to format the output nicely so it's easy to read.
@@ -1282,7 +1305,7 @@ Do not include internal identifiers.
1282
1305
  If the user asks for a detailed summary, you may expand the response up to 300 words.
1283
1306
  Item context:
1284
1307
  {context}
1285
- `, Ea = async (e, t) => {
1308
+ `, za = async (e, t) => {
1286
1309
  const a = e.analyticsItemId;
1287
1310
  if (!a)
1288
1311
  return {
@@ -1292,22 +1315,22 @@ Item context:
1292
1315
  await g({ text: `Summarizing item ${a}...`, agentName: "analytics" }, t);
1293
1316
  const n = t?.configurable?.context;
1294
1317
  x(n);
1295
- const { portal: o, user: r } = n, { result: i, error: c } = await Ye(r, o, a);
1296
- if (c || !i)
1318
+ const { portal: o, user: r } = n, { result: i, error: u } = await He(r, o, a);
1319
+ if (u || !i)
1297
1320
  return await g({ text: "Failed to get item context for summarization", agentName: "analytics" }, t), {
1298
1321
  status: "success",
1299
1322
  outputMessage: "Unable to retrieve item context for summarization."
1300
1323
  };
1301
- const { context: u } = i, d = await b({
1302
- promptText: qa,
1303
- schema: Ma,
1324
+ const { context: c } = i, d = await b({
1325
+ promptText: ka,
1326
+ schema: Aa,
1304
1327
  modelTier: "default",
1305
- inputVariables: { context: JSON.stringify(u) }
1328
+ inputVariables: { context: JSON.stringify(c) }
1306
1329
  }), { followUpQuestions: l, summary: p } = d, m = H(e), f = {
1307
1330
  latestItemId: a,
1308
1331
  memory: {
1309
1332
  ...m.memory,
1310
- [a]: { summary: p, followUpQuestions: l, fullContext: u }
1333
+ [a]: { summary: p, followUpQuestions: l, fullContext: c }
1311
1334
  }
1312
1335
  };
1313
1336
  return l.length && await J({ type: "suggested-prompts", data: { prompts: l } }, t), {
@@ -1315,8 +1338,8 @@ Item context:
1315
1338
  outputMessage: p,
1316
1339
  sharedStatePatch: { portalItemAnalyticsSummaryMemory: { value: f } }
1317
1340
  };
1318
- }, j = (e, t) => t ?? e, Ee = h.Root({
1319
- ...P(),
1341
+ }, j = (e, t) => t ?? e, ke = h.Root({
1342
+ ...G(),
1320
1343
  // States shared only across nodes in the graph, not between invocations
1321
1344
  analyticsIntent: h({
1322
1345
  reducer: j,
@@ -1330,18 +1353,18 @@ Item context:
1330
1353
  reducer: j,
1331
1354
  default: () => ""
1332
1355
  })
1333
- }), ka = () => new N(Ee).addNode("detectAnalyticsIntent", Pa).addNode("summarizePortalItem", Ea).addNode("answerAnalyticsFollowUp", Na).addEdge(G, "detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent", (t) => t.analyticsIntent === "summarize" ? "summarizePortalItem" : t.analyticsIntent === "followUp" ? "answerAnalyticsFollowUp" : w).addEdge("summarizePortalItem", w).addEdge("answerAnalyticsFollowUp", w), za = String.raw`- **portal-item-analytics** - Portal item analytics assistant:
1356
+ }), $a = () => new N(ke).addNode("detectAnalyticsIntent", Ea).addNode("summarizePortalItem", za).addNode("answerAnalyticsFollowUp", Ga).addEdge(P, "detectAnalyticsIntent").addConditionalEdges("detectAnalyticsIntent", (t) => t.analyticsIntent === "summarize" ? "summarizePortalItem" : t.analyticsIntent === "followUp" ? "answerAnalyticsFollowUp" : w).addEdge("summarizePortalItem", w).addEdge("answerAnalyticsFollowUp", w), Da = String.raw`- **portal-item-analytics** - Portal item analytics assistant:
1334
1357
  - answers questions about one specific ArcGIS portal item when item context is present
1335
1358
  - summarizes item details, metadata, and context grounded in that item
1336
1359
  - suggests follow-up prompts grounded in the same item
1337
1360
  - use for item-specific requests, not for gallery browsing, featured content, or opening Map Viewer
1338
- `, $a = {
1361
+ `, Ra = {
1339
1362
  id: "portal-item-analytics",
1340
1363
  name: "Portal Item Analytics",
1341
- description: za,
1342
- createGraph: ka,
1343
- workspace: Ee
1344
- }, Da = {
1364
+ description: Da,
1365
+ createGraph: $a,
1366
+ workspace: ke
1367
+ }, Ua = {
1345
1368
  schemaVersion: "1.0",
1346
1369
  capabilities: [
1347
1370
  {
@@ -1381,7 +1404,7 @@ Item context:
1381
1404
  }
1382
1405
  }
1383
1406
  ]
1384
- }, Ra = {
1407
+ }, Fa = {
1385
1408
  schemaVersion: "1.0",
1386
1409
  capabilities: [
1387
1410
  {
@@ -1435,7 +1458,7 @@ Item context:
1435
1458
  }
1436
1459
  }
1437
1460
  ]
1438
- }, Ua = {
1461
+ }, Oa = {
1439
1462
  schemaVersion: "1.0",
1440
1463
  capabilities: [
1441
1464
  {
@@ -1455,12 +1478,12 @@ Item context:
1455
1478
  }
1456
1479
  }
1457
1480
  ]
1458
- }, Fa = {
1459
- "contentRouteRegistry.ts": Da,
1460
- "groupsRouteRegistry.ts": Ra,
1461
- "orgSettingsRouteRegistry.ts": Ua
1481
+ }, La = {
1482
+ "contentRouteRegistry.ts": Ua,
1483
+ "groupsRouteRegistry.ts": Fa,
1484
+ "orgSettingsRouteRegistry.ts": Oa
1462
1485
  };
1463
- function ue(e) {
1486
+ function le(e) {
1464
1487
  const t = [], a = /* @__PURE__ */ new Set();
1465
1488
  for (const [n, o] of Object.entries(e))
1466
1489
  for (const r of o.capabilities) {
@@ -1472,17 +1495,17 @@ function ue(e) {
1472
1495
  }
1473
1496
  let z;
1474
1497
  function S(e) {
1475
- return e ? z = ue({ customCapabilities: e }) : z || (z = ue(Fa)), z;
1498
+ return e ? z = le({ customCapabilities: e }) : z || (z = le(La)), z;
1476
1499
  }
1477
- const Oa = /^(?:take me to|navigate to|go to|show me|open)\s+(?:the\s+)?/u;
1500
+ const ja = /^(?:take me to|navigate to|go to|show me|open)\s+(?:the\s+)?/u;
1478
1501
  function R(e) {
1479
- return e.toLowerCase().replace(/[^a-z0-9]+/gu, " ").trim().replace(Oa, "").trim();
1502
+ return e.toLowerCase().replace(/[^a-z0-9]+/gu, " ").trim().replace(ja, "").trim();
1480
1503
  }
1481
- const La = s.object({
1504
+ const Va = s.object({
1482
1505
  capabilityIds: s.array(s.string()).default([]),
1483
1506
  confidence: s.number().min(0).max(1).default(0),
1484
1507
  reason: s.string().default("")
1485
- }), le = 0.8, ja = String.raw`You select Portal navigation capabilities for a user's request.
1508
+ }), de = 0.8, Ba = String.raw`You select Portal navigation capabilities for a user's request.
1486
1509
 
1487
1510
  Select only capability IDs from the supplied candidates. Return an empty array when none fit.
1488
1511
  A named surface is required: do not select a capability on another Portal surface.
@@ -1492,10 +1515,10 @@ User request:
1492
1515
  {userRequest}
1493
1516
 
1494
1517
  Candidates:
1495
- {candidates}`, Va = async (e, t) => {
1518
+ {candidates}`, Ka = async (e, t) => {
1496
1519
  if (e.outputMessage || e.targets.length === 0)
1497
1520
  return {};
1498
- const a = I(e.agentExecutionContext.messages).trim(), n = Ba(a, e);
1521
+ const a = I(e.agentExecutionContext.messages).trim(), n = Qa(a, e);
1499
1522
  if (n.length === 1)
1500
1523
  return console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
1501
1524
  method: "exact-match",
@@ -1504,33 +1527,33 @@ Candidates:
1504
1527
  }), { chosenCapabilityIds: n };
1505
1528
  await g({ text: "Choosing a navigation destination...", agentName: "navigation" }, t);
1506
1529
  const o = JSON.stringify(
1507
- e.targets.map(({ capability: r, keywordScore: i, semanticScore: c }) => ({
1530
+ e.targets.map(({ capability: r, keywordScore: i, semanticScore: u }) => ({
1508
1531
  id: r.id,
1509
1532
  title: r.title,
1510
1533
  description: r.description,
1511
1534
  route: r.resolutions.navigate,
1512
1535
  keywordScore: i,
1513
- semanticScore: c
1536
+ semanticScore: u
1514
1537
  }))
1515
1538
  );
1516
1539
  try {
1517
1540
  const r = await b({
1518
- promptText: ja,
1519
- schema: La,
1541
+ promptText: Ba,
1542
+ schema: Va,
1520
1543
  modelTier: "fast",
1521
1544
  inputVariables: { candidates: o, userRequest: a }
1522
- }), i = new Set(e.targets.map(({ capability: u }) => u.id)), c = r.capabilityIds.filter((u) => i.has(u));
1545
+ }), i = new Set(e.targets.map(({ capability: c }) => c.id)), u = r.capabilityIds.filter((c) => i.has(c));
1523
1546
  return console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
1524
1547
  confidence: r.confidence,
1525
1548
  method: "structured-model",
1526
1549
  reason: r.reason,
1527
1550
  request: a,
1528
- selectedCapabilityIds: c
1529
- }), r.confidence < le ? {
1551
+ selectedCapabilityIds: u
1552
+ }), r.confidence < de ? {
1530
1553
  chosenCapabilityIds: [],
1531
1554
  status: "failed",
1532
- summary: `Navigation selection confidence ${r.confidence} is below the required ${le}; defer to the Portal Doc Assistant.`
1533
- } : { chosenCapabilityIds: c };
1555
+ summary: `Navigation selection confidence ${r.confidence} is below the required ${de}; defer to the Portal Doc Assistant.`
1556
+ } : { chosenCapabilityIds: u };
1534
1557
  } catch {
1535
1558
  return console.info("[arcgis-portal-ai-assistant] navigation capability selection:", {
1536
1559
  method: "structured-model-unavailable",
@@ -1539,7 +1562,7 @@ Candidates:
1539
1562
  }), { chosenCapabilityIds: [] };
1540
1563
  }
1541
1564
  };
1542
- function Ba(e, t) {
1565
+ function Qa(e, t) {
1543
1566
  const a = R(e);
1544
1567
  return t.targets.filter(
1545
1568
  ({ capability: n }) => [n.title, ...n.hints].some(
@@ -1547,11 +1570,11 @@ function Ba(e, t) {
1547
1570
  )
1548
1571
  ).map(({ capability: n }) => n.id);
1549
1572
  }
1550
- const ke = /* @__PURE__ */ new Set(["1d", "7d", "14d", "30d", "3m", "6m"]), Ka = s.object({
1573
+ const ze = /* @__PURE__ */ new Set(["1d", "7d", "14d", "30d", "3m", "6m"]), Wa = s.object({
1551
1574
  period: s.string(),
1552
1575
  startTime: s.string(),
1553
1576
  endTime: s.string()
1554
- }), Qa = String.raw`Extract temporal filters for an ArcGIS storage-credits query.
1577
+ }), Ja = String.raw`Extract temporal filters for an ArcGIS storage-credits query.
1555
1578
 
1556
1579
  Return JSON only with these optional string fields:
1557
1580
  - period
@@ -1577,14 +1600,14 @@ Now UTC:
1577
1600
 
1578
1601
  User request:
1579
1602
  {userRequest}`;
1580
- async function Wa(e, t = /* @__PURE__ */ new Date()) {
1603
+ async function _a(e, t = /* @__PURE__ */ new Date()) {
1581
1604
  const a = e.trim();
1582
1605
  if (!a)
1583
1606
  return {};
1584
1607
  try {
1585
1608
  const n = await b({
1586
- promptText: Qa,
1587
- schema: Ka,
1609
+ promptText: Ja,
1610
+ schema: Wa,
1588
1611
  modelTier: "fast",
1589
1612
  inputVariables: {
1590
1613
  nowEpochMs: String(t.getTime()),
@@ -1592,24 +1615,24 @@ async function Wa(e, t = /* @__PURE__ */ new Date()) {
1592
1615
  userRequest: a
1593
1616
  }
1594
1617
  });
1595
- return Ja(n, t);
1618
+ return Ya(n, t);
1596
1619
  } catch (n) {
1597
1620
  return console.error(n), {};
1598
1621
  }
1599
1622
  }
1600
- function Ja(e, t = /* @__PURE__ */ new Date()) {
1601
- const a = de(e.startTime), n = de(e.endTime), o = _a(e.period);
1623
+ function Ya(e, t = /* @__PURE__ */ new Date()) {
1624
+ const a = pe(e.startTime), n = pe(e.endTime), o = Ha(e.period);
1602
1625
  if (o) {
1603
1626
  if (a !== void 0 && n !== void 0 && a < n)
1604
1627
  return { period: o, startTime: String(a), endTime: String(n) };
1605
- const r = ke.has(o);
1606
- if (!r || n !== void 0 && !Ha(n, t.getTime())) {
1607
- const c = n ?? t.getTime(), u = Ya(o, new Date(c));
1608
- if (u !== void 0)
1628
+ const r = ze.has(o);
1629
+ if (!r || n !== void 0 && !Za(n, t.getTime())) {
1630
+ const u = n ?? t.getTime(), c = Xa(o, new Date(u));
1631
+ if (c !== void 0)
1609
1632
  return {
1610
1633
  period: o,
1611
- startTime: String(u),
1612
- endTime: String(c)
1634
+ startTime: String(c),
1635
+ endTime: String(u)
1613
1636
  };
1614
1637
  }
1615
1638
  return r ? {
@@ -1620,7 +1643,7 @@ function Ja(e, t = /* @__PURE__ */ new Date()) {
1620
1643
  }
1621
1644
  return a !== void 0 && n !== void 0 && a < n ? { startTime: String(a), endTime: String(n) } : a !== void 0 ? { startTime: String(a), endTime: String(t.getTime()) } : {};
1622
1645
  }
1623
- function _a(e) {
1646
+ function Ha(e) {
1624
1647
  const t = e?.trim().match(/^(\d+)\s*([dwm])$/iu);
1625
1648
  if (!t)
1626
1649
  return;
@@ -1630,12 +1653,12 @@ function _a(e) {
1630
1653
  const n = t[2].toLowerCase();
1631
1654
  if (n === "w") {
1632
1655
  const o = a * 7;
1633
- if (ke.has(`${o}d`))
1656
+ if (ze.has(`${o}d`))
1634
1657
  return `${o}d`;
1635
1658
  }
1636
1659
  return `${a}${n}`;
1637
1660
  }
1638
- function Ya(e, t) {
1661
+ function Xa(e, t) {
1639
1662
  const a = e.match(/^(\d+)([dwm])$/u);
1640
1663
  if (!a)
1641
1664
  return;
@@ -1650,25 +1673,25 @@ function Ya(e, t) {
1650
1673
  const r = new Date(t.getTime());
1651
1674
  return r.setUTCMonth(r.getUTCMonth() - n), r.getTime();
1652
1675
  }
1653
- function de(e) {
1676
+ function pe(e) {
1654
1677
  if (!e)
1655
1678
  return;
1656
1679
  const t = Number.parseInt(e, 10);
1657
1680
  if (!(!Number.isFinite(t) || t <= 0))
1658
1681
  return t;
1659
1682
  }
1660
- function Ha(e, t) {
1683
+ function Za(e, t) {
1661
1684
  const a = new Date(e), n = new Date(t);
1662
1685
  return a.getUTCFullYear() === n.getUTCFullYear() && a.getUTCMonth() === n.getUTCMonth() && a.getUTCDate() === n.getUTCDate();
1663
1686
  }
1664
- async function Xa(e, t, a) {
1687
+ async function en(e, t, a) {
1665
1688
  const n = S().find((r) => r.id === e);
1666
1689
  if (!n)
1667
1690
  return;
1668
- const o = await en(Za(n), a);
1669
- return o && an(o, t) ? { capability: n, target: o } : void 0;
1691
+ const o = await an(tn(n), a);
1692
+ return o && on(o, t) ? { capability: n, target: o } : void 0;
1670
1693
  }
1671
- function Za(e) {
1694
+ function tn(e) {
1672
1695
  const { hash: t, queryParams: a, routeKey: n } = e.resolutions.navigate;
1673
1696
  switch (n) {
1674
1697
  case "content":
@@ -1706,10 +1729,10 @@ function Za(e) {
1706
1729
  return;
1707
1730
  }
1708
1731
  }
1709
- async function en(e, t) {
1710
- if (!e || !t || !tn(e))
1732
+ async function an(e, t) {
1733
+ if (!e || !t || !nn(e))
1711
1734
  return e;
1712
- const a = await Wa(t);
1735
+ const a = await _a(t);
1713
1736
  if (!a.period && !a.startTime && !a.endTime)
1714
1737
  return e;
1715
1738
  const n = {
@@ -1720,24 +1743,24 @@ async function en(e, t) {
1720
1743
  };
1721
1744
  return { ...e, queryParams: n };
1722
1745
  }
1723
- function tn(e) {
1746
+ function nn(e) {
1724
1747
  return e.destinationType === "portal-org" && e.hash === "status";
1725
1748
  }
1726
- function an(e, t) {
1749
+ function on(e, t) {
1727
1750
  return !t || !!t[e.destinationType];
1728
1751
  }
1729
- const nn = async (e, t) => {
1752
+ const rn = async (e, t) => {
1730
1753
  if (e.outputMessage || e.status === "failed")
1731
1754
  return {};
1732
1755
  const a = e.targets.find(({ capability: r }) => e.chosenCapabilityIds.includes(r.id)) ?? e.targets[0];
1733
1756
  if (!a)
1734
1757
  return {
1735
1758
  outputMessage: "I couldn't find a matching Portal page. Try asking to open your content, groups, or organization settings.",
1736
- sharedStatePatch: { navLastAnsweredRequest: { value: pe(e) } },
1759
+ sharedStatePatch: { navLastAnsweredRequest: { value: me(e) } },
1737
1760
  status: "success",
1738
1761
  summary: "Navigation could not find a matching capability; route another agent if appropriate."
1739
1762
  };
1740
- const n = pe(e), o = await Xa(a.capability.id, void 0, n);
1763
+ const n = me(e), o = await en(a.capability.id, void 0, n);
1741
1764
  return o ? (await g({ text: "Preparing navigation...", agentName: "navigation" }, t), await F(o.target, t), {
1742
1765
  outputMessage: e.chosenCapabilityIds.length ? a.capability.description : `The closest place to start is ${a.capability.title}. Click the button below to open it.`,
1743
1766
  status: "success",
@@ -1750,17 +1773,17 @@ const nn = async (e, t) => {
1750
1773
  sharedStatePatch: { navLastAnsweredRequest: { value: n } }
1751
1774
  });
1752
1775
  };
1753
- function pe(e) {
1776
+ function me(e) {
1754
1777
  return I(e.agentExecutionContext.messages) || e.agentExecutionContext.userRequest;
1755
1778
  }
1756
- async function ze(e) {
1757
- return e.length === 0 ? [] : (await at.getDefault().load(), await Be(e));
1779
+ async function $e(e) {
1780
+ return e.length === 0 ? [] : (await nt.getDefault().load(), await Ke(e));
1758
1781
  }
1759
- const on = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1782
+ const sn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
1760
1783
  __proto__: null,
1761
- generateEmbeddings: ze
1784
+ generateEmbeddings: $e
1762
1785
  }, Symbol.toStringTag, { value: "Module" }));
1763
- function rn(e) {
1786
+ function cn(e) {
1764
1787
  const t = [], a = `${e.title}. ${e.description}`;
1765
1788
  a.trim().length > 0 && t.push({ field: "summary", text: a });
1766
1789
  const n = e.hints;
@@ -1770,20 +1793,20 @@ function rn(e) {
1770
1793
  return t;
1771
1794
  }
1772
1795
  let $, X, D = 0;
1773
- async function sn(e = {}) {
1796
+ async function un(e = {}) {
1774
1797
  const t = D;
1775
- return $ ??= un(e.embed ?? ln).then((a) => (t === D && (X = a), a)).catch((a) => {
1798
+ return $ ??= dn(e.embed ?? pn).then((a) => (t === D && (X = a), a)).catch((a) => {
1776
1799
  throw t === D && ($ = void 0), a;
1777
1800
  }), await $;
1778
1801
  }
1779
- function cn() {
1802
+ function ln() {
1780
1803
  return X;
1781
1804
  }
1782
- function me() {
1805
+ function ge() {
1783
1806
  D += 1, X = void 0, $ = void 0;
1784
1807
  }
1785
- async function un(e) {
1786
- const t = dn(), a = await e(t.map((n) => n.text));
1808
+ async function dn(e) {
1809
+ const t = mn(), a = await e(t.map((n) => n.text));
1787
1810
  if (a.length !== t.length)
1788
1811
  throw new Error(`Expected ${t.length} vectors, got ${a.length}`);
1789
1812
  return t.map((n, o) => ({
@@ -1791,46 +1814,46 @@ async function un(e) {
1791
1814
  vector: a[o]
1792
1815
  }));
1793
1816
  }
1794
- async function ln(e) {
1795
- const { generateEmbeddings: t } = await Promise.resolve().then(() => on);
1817
+ async function pn(e) {
1818
+ const { generateEmbeddings: t } = await Promise.resolve().then(() => sn);
1796
1819
  return await t(e);
1797
1820
  }
1798
- function dn() {
1821
+ function mn() {
1799
1822
  return S().flatMap(
1800
- (e) => rn(e).map(({ field: t, text: a }) => ({
1823
+ (e) => cn(e).map(({ field: t, text: a }) => ({
1801
1824
  capabilityId: e.id,
1802
1825
  field: t,
1803
1826
  text: a
1804
1827
  }))
1805
1828
  );
1806
1829
  }
1807
- const ge = 1.2, he = 0.75, pn = 60, mn = 0.65, V = {
1830
+ const he = 1.2, fe = 0.75, gn = 60, hn = 0.65, V = {
1808
1831
  description: 1,
1809
1832
  hint: 2,
1810
1833
  title: 3
1811
1834
  };
1812
1835
  let W;
1813
- function gn() {
1836
+ function fn() {
1814
1837
  W = void 0;
1815
1838
  }
1816
- async function hn(e, t = {}) {
1817
- const a = vn($e(e));
1839
+ async function yn(e, t = {}) {
1840
+ const a = In(De(e));
1818
1841
  let n = [], o = !1, r;
1819
1842
  if (e.trim()) {
1820
- const i = t.loadEmbeddings, c = cn();
1821
- if (!i && !c)
1843
+ const i = t.loadEmbeddings, u = ln();
1844
+ if (!i && !u)
1822
1845
  o = !0, r = "Capability embeddings are still loading.";
1823
1846
  else
1824
1847
  try {
1825
1848
  if (i) {
1826
- const [u, d] = await Promise.all([
1827
- (t.embedQuery ?? ye)(e),
1849
+ const [c, d] = await Promise.all([
1850
+ (t.embedQuery ?? we)(e),
1828
1851
  i()
1829
1852
  ]);
1830
- n = fe(u, d);
1831
- } else if (c) {
1832
- const u = await (t.embedQuery ?? ye)(e);
1833
- n = fe(u, c);
1853
+ n = ye(c, d);
1854
+ } else if (u) {
1855
+ const c = await (t.embedQuery ?? we)(e);
1856
+ n = ye(c, u);
1834
1857
  }
1835
1858
  } catch {
1836
1859
  o = !0, r = "Semantic search is unavailable.";
@@ -1841,13 +1864,13 @@ async function hn(e, t = {}) {
1841
1864
  ...r ? { degradedReason: r } : {},
1842
1865
  // RRF combines ranks rather than raw scores because BM25 and cosine
1843
1866
  // similarity are on different scales.
1844
- matches: In(a, n, t.topN ?? 5)
1867
+ matches: xn(a, n, t.topN ?? 5)
1845
1868
  };
1846
1869
  }
1847
- function fn() {
1848
- return W ??= yn(S()), W;
1870
+ function wn() {
1871
+ return W ??= vn(S()), W;
1849
1872
  }
1850
- function yn(e) {
1873
+ function vn(e) {
1851
1874
  const t = /* @__PURE__ */ new Map(), a = e.map((n) => {
1852
1875
  const o = /* @__PURE__ */ new Map();
1853
1876
  B(o, n.title, V.title), B(o, n.description, V.description);
@@ -1857,7 +1880,7 @@ function yn(e) {
1857
1880
  t.set(r, (t.get(r) ?? 0) + 1);
1858
1881
  return {
1859
1882
  capability: n,
1860
- length: wn(o),
1883
+ length: bn(o),
1861
1884
  termFrequencies: o
1862
1885
  };
1863
1886
  });
@@ -1868,33 +1891,33 @@ function yn(e) {
1868
1891
  };
1869
1892
  }
1870
1893
  function B(e, t, a) {
1871
- for (const n of $e(t))
1894
+ for (const n of De(t))
1872
1895
  e.set(n, (e.get(n) ?? 0) + a);
1873
1896
  }
1874
- function wn(e) {
1897
+ function bn(e) {
1875
1898
  return [...e.values()].reduce((t, a) => t + a, 0);
1876
1899
  }
1877
- function $e(e) {
1900
+ function De(e) {
1878
1901
  return e.toLowerCase().split(/[^a-z0-9]+/u).filter(Boolean);
1879
1902
  }
1880
- function vn(e) {
1881
- const t = fn(), a = new Set(e), n = t.documents.length;
1903
+ function In(e) {
1904
+ const t = wn(), a = new Set(e), n = t.documents.length;
1882
1905
  return t.documents.map(({ capability: o, length: r, termFrequencies: i }) => {
1883
- let c = 0;
1884
- for (const u of a) {
1885
- const d = i.get(u), l = t.documentFrequency.get(u);
1906
+ let u = 0;
1907
+ for (const c of a) {
1908
+ const d = i.get(c), l = t.documentFrequency.get(c);
1886
1909
  if (!d || !l)
1887
1910
  continue;
1888
- const p = Math.log(1 + (n - l + 0.5) / (l + 0.5)), m = ge * (1 - he + he * (r / t.averageDocumentLength));
1889
- c += p * (d * (ge + 1) / (d + m));
1911
+ const p = Math.log(1 + (n - l + 0.5) / (l + 0.5)), m = he * (1 - fe + fe * (r / t.averageDocumentLength));
1912
+ u += p * (d * (he + 1) / (d + m));
1890
1913
  }
1891
- return { capability: o, score: c };
1892
- }).filter(({ score: o }) => o > 0).sort(De);
1914
+ return { capability: o, score: u };
1915
+ }).filter(({ score: o }) => o > 0).sort(Re);
1893
1916
  }
1894
- function fe(e, t) {
1917
+ function ye(e, t) {
1895
1918
  const a = /* @__PURE__ */ new Map();
1896
1919
  for (const o of t) {
1897
- const r = bn(e, o.vector);
1920
+ const r = Sn(e, o.vector);
1898
1921
  if (r === void 0)
1899
1922
  continue;
1900
1923
  const i = a.get(o.capabilityId);
@@ -1903,10 +1926,10 @@ function fe(e, t) {
1903
1926
  const n = new Map(S().map((o) => [o.id, o]));
1904
1927
  return [...a.entries()].flatMap(([o, r]) => {
1905
1928
  const i = n.get(o);
1906
- return i && r >= mn ? [{ capability: i, score: r }] : [];
1907
- }).sort(De);
1929
+ return i && r >= hn ? [{ capability: i, score: r }] : [];
1930
+ }).sort(Re);
1908
1931
  }
1909
- function bn(e, t) {
1932
+ function Sn(e, t) {
1910
1933
  if (e.length === 0 || e.length !== t.length)
1911
1934
  return;
1912
1935
  let a = 0, n = 0, o = 0;
@@ -1915,43 +1938,43 @@ function bn(e, t) {
1915
1938
  const r = Math.sqrt(n) * Math.sqrt(o);
1916
1939
  return r === 0 ? void 0 : a / r;
1917
1940
  }
1918
- async function ye(e) {
1919
- const [t] = await ze([e]);
1941
+ async function we(e) {
1942
+ const [t] = await $e([e]);
1920
1943
  if (!t)
1921
1944
  throw new Error("Expected one query embedding.");
1922
1945
  return t;
1923
1946
  }
1924
- function In(e, t, a) {
1947
+ function xn(e, t, a) {
1925
1948
  const n = /* @__PURE__ */ new Map();
1926
- return we(n, e, "keyword"), we(n, t, "semantic"), [...n.values()].sort((o, r) => r.score !== o.score ? r.score - o.score : (r.semanticScore ?? 0) !== (o.semanticScore ?? 0) ? (r.semanticScore ?? 0) - (o.semanticScore ?? 0) : (r.keywordScore ?? 0) !== (o.keywordScore ?? 0) ? (r.keywordScore ?? 0) - (o.keywordScore ?? 0) : o.capability.id.localeCompare(r.capability.id)).slice(0, Math.max(0, a));
1949
+ return ve(n, e, "keyword"), ve(n, t, "semantic"), [...n.values()].sort((o, r) => r.score !== o.score ? r.score - o.score : (r.semanticScore ?? 0) !== (o.semanticScore ?? 0) ? (r.semanticScore ?? 0) - (o.semanticScore ?? 0) : (r.keywordScore ?? 0) !== (o.keywordScore ?? 0) ? (r.keywordScore ?? 0) - (o.keywordScore ?? 0) : o.capability.id.localeCompare(r.capability.id)).slice(0, Math.max(0, a));
1927
1950
  }
1928
- function we(e, t, a) {
1951
+ function ve(e, t, a) {
1929
1952
  for (const [n, { capability: o, score: r }] of t.entries()) {
1930
- const i = n + 1, c = e.get(o.id) ?? { capability: o, score: 0 };
1931
- c.score += 1 / (pn + i), a === "keyword" ? (c.keywordRank = i, c.keywordScore = r) : (c.semanticRank = i, c.semanticScore = r), e.set(o.id, c);
1953
+ const i = n + 1, u = e.get(o.id) ?? { capability: o, score: 0 };
1954
+ u.score += 1 / (gn + i), a === "keyword" ? (u.keywordRank = i, u.keywordScore = r) : (u.semanticRank = i, u.semanticScore = r), e.set(o.id, u);
1932
1955
  }
1933
1956
  }
1934
- function De(e, t) {
1957
+ function Re(e, t) {
1935
1958
  return t.score - e.score || e.capability.id.localeCompare(t.capability.id);
1936
1959
  }
1937
- const Sn = async (e, t) => {
1960
+ const Tn = async (e, t) => {
1938
1961
  await g({ text: "Finding a place to navigate...", agentName: "navigation" }, t);
1939
1962
  const a = I(e.agentExecutionContext.messages).trim();
1940
1963
  try {
1941
- const n = await hn(a, { topN: 5 });
1964
+ const n = await yn(a, { topN: 5 });
1942
1965
  return console.table(
1943
- n.matches.map(({ capability: o, keywordRank: r, keywordScore: i, semanticRank: c, semanticScore: u, score: d }) => ({
1966
+ n.matches.map(({ capability: o, keywordRank: r, keywordScore: i, semanticRank: u, semanticScore: c, score: d }) => ({
1944
1967
  capability: o.title,
1945
1968
  fusedScore: d,
1946
1969
  keywordRank: r,
1947
1970
  keywordScore: i,
1948
- semanticRank: c,
1949
- semanticScore: u
1971
+ semanticRank: u,
1972
+ semanticScore: c
1950
1973
  }))
1951
1974
  ), n.degradedReason && console.info("[arcgis-portal-ai-assistant] navigation semantic search:", n.degradedReason), {
1952
1975
  chosenCapabilityIds: [],
1953
1976
  retrievalDegraded: n.degradedReason ?? "",
1954
- targets: xn(a, n.matches)
1977
+ targets: Mn(a, n.matches)
1955
1978
  };
1956
1979
  } catch {
1957
1980
  return {
@@ -1962,7 +1985,7 @@ const Sn = async (e, t) => {
1962
1985
  };
1963
1986
  }
1964
1987
  };
1965
- function xn(e, t) {
1988
+ function Mn(e, t) {
1966
1989
  const a = R(e), n = t.filter(
1967
1990
  ({ capability: r }) => [r.title, ...r.hints].some(
1968
1991
  (i) => R(i) === a
@@ -1973,15 +1996,15 @@ function xn(e, t) {
1973
1996
  const [o] = n;
1974
1997
  return [o, ...t.filter((r) => r !== o)];
1975
1998
  }
1976
- const K = (e, t) => t ?? e, Re = h.Root({
1977
- ...P(),
1999
+ const K = (e, t) => t ?? e, Ue = h.Root({
2000
+ ...G(),
1978
2001
  chosenCapabilityIds: h({ reducer: K, default: () => [] }),
1979
2002
  // Empty when hybrid keyword-and-semantic retrieval succeeds; otherwise
1980
2003
  // contains the semantic-search failure reason for response diagnostics.
1981
2004
  retrievalDegraded: h({ reducer: K, default: () => "" }),
1982
2005
  targets: h({ reducer: K, default: () => [] })
1983
- }), Tn = () => new N(Re).addNode("retrieveNavigationTargets", Sn).addNode("chooseNavigationTargets", Va).addNode("respondWithNavigation", nn).addEdge(G, "retrieveNavigationTargets").addEdge("retrieveNavigationTargets", "chooseNavigationTargets").addEdge("chooseNavigationTargets", "respondWithNavigation").addEdge("respondWithNavigation", w);
1984
- function Mn() {
2006
+ }), Cn = () => new N(Ue).addNode("retrieveNavigationTargets", Tn).addNode("chooseNavigationTargets", Ka).addNode("respondWithNavigation", rn).addEdge(P, "retrieveNavigationTargets").addEdge("retrieveNavigationTargets", "chooseNavigationTargets").addEdge("chooseNavigationTargets", "respondWithNavigation").addEdge("respondWithNavigation", w);
2007
+ function An() {
1985
2008
  const e = S().map(({ hints: t, title: a }) => t[0] ?? a).join(", ");
1986
2009
  return String.raw`- **portal-navigation** - Portal page navigation assistant:
1987
2010
  - routes requests to open, show, or navigate to a Portal page, including creation-flow pages
@@ -1991,16 +2014,16 @@ function Mn() {
1991
2014
  - do not use for general "how do I" questions unless the user explicitly asks to reach a page
1992
2015
  `;
1993
2016
  }
1994
- const Cn = {
2017
+ const Nn = {
1995
2018
  id: "navigation",
1996
2019
  name: "Portal Navigation",
1997
2020
  get description() {
1998
- return Mn();
2021
+ return An();
1999
2022
  },
2000
- createGraph: Tn,
2001
- workspace: Re
2002
- }, An = Le`: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)}`;
2003
- function Nn(e, t) {
2023
+ createGraph: Cn,
2024
+ workspace: Ue
2025
+ }, Pn = je`: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)}`;
2026
+ function Gn(e, t) {
2004
2027
  if (!t)
2005
2028
  return;
2006
2029
  const { destinationType: a } = e;
@@ -2025,11 +2048,11 @@ function Nn(e, t) {
2025
2048
  return U(a);
2026
2049
  }
2027
2050
  }
2028
- function Gn(e) {
2029
- const t = Ct.safeParse(e);
2051
+ function qn(e) {
2052
+ const t = At.safeParse(e);
2030
2053
  return t.success ? t.data : void 0;
2031
2054
  }
2032
- function Pn(e, t) {
2055
+ function En(e, t) {
2033
2056
  const a = t.navigation;
2034
2057
  switch (e.destinationType) {
2035
2058
  case "portal-content":
@@ -2074,21 +2097,21 @@ function Pn(e, t) {
2074
2097
  return U(e);
2075
2098
  }
2076
2099
  }
2077
- class qn extends Fe {
2100
+ class kn extends Oe {
2078
2101
  constructor() {
2079
- super(), this.t9n = Ve({ blocking: !0 }), this.assistantEl = E(), this.formEl = E(), this.voiceInputEl = E(), this.inputEl = E(), this.navigationSlotElements = /* @__PURE__ */ new Map(), this.handleSlottableRequest = (t) => {
2102
+ super(), this.t9n = Be({ blocking: !0 }), this.assistantEl = E(), this.formEl = E(), this.voiceInputEl = E(), this.inputEl = E(), this.navigationSlotElements = /* @__PURE__ */ new Map(), this.handleSlottableRequest = (t) => {
2080
2103
  const a = t.detail, n = a.data?.block;
2081
2104
  if (!n)
2082
2105
  return;
2083
2106
  const o = this.getNavigationAction(n);
2084
2107
  o && this.upsertNavigationSlotElement(a.slotName, o);
2085
- }, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.defaultClosed = !1, this.useProdDocAssistant = !1, this.arcgisPortalNavigationRequest = Oe(), S();
2108
+ }, this.inputText = "", this.showVoiceInput = !0, this.isListening = !1, this.isVoiceInputDisabled = !1, this.interrupt = null, this.autoDestroyDisabled = !1, this.defaultClosed = !1, this.useProdDocAssistant = !1, this.arcgisPortalNavigationRequest = Le(), S();
2086
2109
  }
2087
2110
  static {
2088
2111
  this.properties = { inputText: 16, showVoiceInput: 16, isListening: 16, isVoiceInputDisabled: 16, interrupt: 16, autoDestroyDisabled: 5, portal: 0, user: 0, config: 0, navigationTargetMap: 0, disabledAgents: 0, defaultClosed: 5, navigationCapabilities: 0, useProdDocAssistant: 5 };
2089
2112
  }
2090
2113
  static {
2091
- this.styles = An;
2114
+ this.styles = Pn;
2092
2115
  }
2093
2116
  async load() {
2094
2117
  await this.refreshCapabilityEmbeddings();
@@ -2097,30 +2120,30 @@ class qn extends Fe {
2097
2120
  !this.hasUpdated || !t.has("navigationCapabilities") || this.refreshCapabilityEmbeddings();
2098
2121
  }
2099
2122
  async clearEmbeddingsCache() {
2100
- me();
2123
+ ge();
2101
2124
  }
2102
2125
  isAgentEnabled(t) {
2103
2126
  return !this.disabledAgents?.[t];
2104
2127
  }
2105
2128
  async refreshCapabilityEmbeddings() {
2106
2129
  try {
2107
- S(this.navigationCapabilities), gn(), me(), await sn();
2130
+ S(this.navigationCapabilities), fn(), ge(), await un();
2108
2131
  } catch (t) {
2109
2132
  console.warn("[arcgis-portal-ai-assistant] embeddings warm-up failed:", t);
2110
2133
  }
2111
2134
  }
2112
2135
  getNavigationAction(t) {
2113
- if (t?.type !== Se)
2136
+ if (t?.type !== xe)
2114
2137
  return;
2115
- const a = t.data, n = Gn(a);
2138
+ const a = t.data, n = qn(a);
2116
2139
  if (!n)
2117
2140
  return;
2118
- const o = Nn(a, this.navigationTargetMap);
2141
+ const o = Gn(a, this.navigationTargetMap);
2119
2142
  if (o)
2120
2143
  return {
2121
2144
  href: o,
2122
2145
  targetDetail: a,
2123
- label: a?.buttonLabel || Pn(n, this.t9n)
2146
+ label: a?.buttonLabel || En(n, this.t9n)
2124
2147
  };
2125
2148
  }
2126
2149
  upsertNavigationSlotElement(t, a) {
@@ -2129,7 +2152,7 @@ class qn extends Fe {
2129
2152
  return;
2130
2153
  const o = `navigation:${t}`;
2131
2154
  let r = this.navigationSlotElements.get(o);
2132
- r || (r = document.createElement("div"), r.slot = t, this.navigationSlotElements.set(o, r), n.append(r)), je(v`<div><calcite-button class="navigation-button" appearance=outline width=full .href=${a.href} icon-end=launch @click=${(i) => {
2155
+ r || (r = document.createElement("div"), r.slot = t, this.navigationSlotElements.set(o, r), n.append(r)), Ve(v`<div><calcite-button class="navigation-button" appearance=outline width=full .href=${a.href} icon-end=launch @click=${(i) => {
2133
2156
  i.preventDefault(), this.arcgisPortalNavigationRequest.emit({
2134
2157
  href: a.href,
2135
2158
  targetDetail: a.targetDetail
@@ -2137,7 +2160,7 @@ class qn extends Fe {
2137
2160
  }}>${a.label}</calcite-button>${a.description ? v`<div class="navigation-block-description">${a.description}</div>` : null}</div>`, r);
2138
2161
  }
2139
2162
  render() {
2140
- const { t9n: t, inputText: a, portal: n, user: o, navigationTargetMap: r, showVoiceInput: i, isListening: c, isVoiceInputDisabled: u, useProdDocAssistant: d } = this;
2163
+ const { t9n: t, inputText: a, portal: n, user: o, navigationTargetMap: r, showVoiceInput: i, isListening: u, isVoiceInputDisabled: c, useProdDocAssistant: d } = this;
2141
2164
  return v`<arcgis-assistant log-enabled keep-suggested-prompts .heading=${t.heading} .entryMessage=${t.entryMessage} @arcgisSlottableRequest=${this.handleSlottableRequest} @arcgisInterrupt=${({ detail: l }) => {
2142
2165
  this.interrupt = l;
2143
2166
  }} @arcgisInterruptCancel=${() => {
@@ -2164,18 +2187,18 @@ class qn extends Fe {
2164
2187
  l.detail.errorCode === "not-supported" && (this.showVoiceInput = !1);
2165
2188
  }} @arcgisVoiceInputInterimTranscription=${(l) => {
2166
2189
  this.inputText = l.detail.text;
2167
- }} ${k(this.voiceInputEl)}></arcgis-portal-voice-input>${i && v`<calcite-button icon-start=microphone .label=${t.voiceInput} round .disabled=${u} .appearance=${c ? "solid" : "outline-fill"} @click=${async () => {
2190
+ }} ${k(this.voiceInputEl)}></arcgis-portal-voice-input>${i && v`<calcite-button icon-start=microphone .label=${t.voiceInput} round .disabled=${c} .appearance=${u ? "solid" : "outline-fill"} @click=${async () => {
2168
2191
  this.isVoiceInputDisabled = !0;
2169
2192
  const l = this.voiceInputEl.value;
2170
- c ? await l?.stopListening() : await l?.startListening();
2171
- }}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!a.trim()} .label=${t.send}>${t.send}</calcite-button></div></form>${this.isAgentEnabled("itemAnalytics") && v`<arcgis-assistant-agent .agent=${$a} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupCreation") && v`<arcgis-assistant-agent .agent=${Pt} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("docAssistant") && v`<arcgis-assistant-agent .agent=${ta} .context=${{ portal: n, user: o, navigationTargetMap: r, useProdDocAssistant: d }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupAnalytics") && v`<arcgis-assistant-agent .agent=${xa} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("navigation") && v`<arcgis-assistant-agent .agent=${Cn} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.interrupt && v`<arcgis-portal-ai-assistant-interrupt slot=interrupt .type=${this.interrupt.type} .message=${this.interrupt.message} .options=${this.interrupt.options} @arcgisSubmit=${({ detail: l }) => {
2193
+ u ? await l?.stopListening() : await l?.startListening();
2194
+ }}></calcite-button>` || ""}<calcite-button type=submit icon-start=send round .disabled=${!a.trim()} .label=${t.send}>${t.send}</calcite-button></div></form>${this.isAgentEnabled("itemAnalytics") && v`<arcgis-assistant-agent .agent=${Ra} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupCreation") && v`<arcgis-assistant-agent .agent=${qt} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("docAssistant") && v`<arcgis-assistant-agent .agent=${na} .context=${{ portal: n, user: o, navigationTargetMap: r, useProdDocAssistant: d }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("groupAnalytics") && v`<arcgis-assistant-agent .agent=${Ma} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.isAgentEnabled("navigation") && v`<arcgis-assistant-agent .agent=${Nn} .context=${{ portal: n, user: o, navigationTargetMap: r }}></arcgis-assistant-agent>` || ""}${this.interrupt && v`<arcgis-portal-ai-assistant-interrupt slot=interrupt .type=${this.interrupt.type} .message=${this.interrupt.message} .options=${this.interrupt.options} @arcgisSubmit=${({ detail: l }) => {
2172
2195
  this.assistantEl.value?.submitInterrupt(l);
2173
2196
  }} @arcgisCancel=${() => {
2174
2197
  this.assistantEl.value?.cancelInterrupt();
2175
2198
  }}></arcgis-portal-ai-assistant-interrupt>` || ""}</arcgis-assistant>`;
2176
2199
  }
2177
2200
  }
2178
- Ue("arcgis-portal-ai-assistant", qn);
2201
+ Fe("arcgis-portal-ai-assistant", kn);
2179
2202
  export {
2180
- qn as ArcgisPortalAiAssistant
2203
+ kn as ArcgisPortalAiAssistant
2181
2204
  };