@arcgis/ai-components 5.2.0-next.98 → 5.2.0-next.99

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 (44) hide show
  1. package/dist/agents/tools/filter/setFeatureEffect/adapter.js +52 -40
  2. package/dist/agents/tools/navigation/goToAddress/adapter.js +39 -31
  3. package/dist/agents/tools/query/getStatistics/adapter.js +59 -56
  4. package/dist/agents/tools/query/getTopFeatures/adapter.js +51 -48
  5. package/dist/agents/tools/query/queryFeatures/adapter.js +46 -43
  6. package/dist/cdn/22KHSDJI.js +2 -0
  7. package/dist/cdn/5K5ZY267.js +2 -0
  8. package/dist/cdn/{NSHLOFIY.js → 5XZLS7UO.js} +1 -1
  9. package/dist/cdn/655YIKL3.js +11 -0
  10. package/dist/cdn/AKD5UOVX.js +2 -0
  11. package/dist/cdn/{NEZXHUAL.js → BE7BRJZD.js} +1 -1
  12. package/dist/cdn/C4JT4S5E.js +2 -0
  13. package/dist/cdn/{UHZG7SKO.js → FJO4KNOZ.js} +1 -1
  14. package/dist/cdn/{MX7OEO5Z.js → FXP5UIQU.js} +1 -1
  15. package/dist/cdn/{CZM4URK7.js → G3SF6U2U.js} +1 -1
  16. package/dist/cdn/{HNADFHYH.js → ICQCK5D3.js} +1 -1
  17. package/dist/cdn/{ASR3I43T.js → IJVMUS2L.js} +1 -1
  18. package/dist/cdn/{UAANWCMU.js → LAYVGCPL.js} +1 -1
  19. package/dist/cdn/NNXISHCA.js +14 -0
  20. package/dist/cdn/{LNCT4S4I.js → OX64WOEL.js} +1 -1
  21. package/dist/cdn/{7ZFAFKJT.js → QUKNPVAF.js} +1 -1
  22. package/dist/cdn/{YWN57GH4.js → RVSTAUQS.js} +1 -1
  23. package/dist/cdn/{EKWM5K4K.js → TCH5I5LS.js} +1 -1
  24. package/dist/cdn/{B2T7D57Y.js → TEPP7YPR.js} +1 -1
  25. package/dist/cdn/{6KN5LUAV.js → TMVF2W5N.js} +15 -15
  26. package/dist/cdn/{IC3LG6TH.js → UHNVDALX.js} +1 -1
  27. package/dist/cdn/{4WIDLQUH.js → XX6GHMNR.js} +1 -1
  28. package/dist/cdn/{AA4FBYKK.js → Z5HWPSZN.js} +1 -1
  29. package/dist/cdn/{GFEOVHJK.js → ZRVZMPFN.js} +1 -1
  30. package/dist/cdn/agent-utils/index.js +1 -1
  31. package/dist/cdn/index.js +1 -1
  32. package/dist/chunks/navigationGraph.js +84 -81
  33. package/dist/chunks/resolvePointGeometryFilter.js +92 -0
  34. package/dist/docs/api.json +1 -1
  35. package/dist/docs/docs.json +1 -1
  36. package/dist/docs/web-types.json +1 -1
  37. package/package.json +5 -5
  38. package/dist/cdn/6HF36IKA.js +0 -2
  39. package/dist/cdn/JKIESH74.js +0 -2
  40. package/dist/cdn/OAKRPM7D.js +0 -2
  41. package/dist/cdn/QNNGPA3Q.js +0 -2
  42. package/dist/cdn/U2D53TAX.js +0 -14
  43. package/dist/cdn/V52XWEGV.js +0 -11
  44. package/dist/chunks/types.js +0 -59
@@ -1,57 +1,57 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
2
  import { tool as v } from "@langchain/core/tools";
3
3
  import { a as C } from "../../../../chunks/formatFeatureAttributes.js";
4
- import { g as O, i as S, a as F, d as I } from "../../../../chunks/types.js";
5
- import { c as j, m as N } from "../../../../chunks/mergeWhereClauses.js";
4
+ import { g as R, i as F, a as I, d as q, s as G, r as O } from "../../../../chunks/resolvePointGeometryFilter.js";
5
+ import { c as j, m as x } from "../../../../chunks/mergeWhereClauses.js";
6
6
  import t from "zod";
7
- import { f as R } from "../../../../chunks/fetchAgentContext.js";
8
- const p = 25, x = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map((r) => r.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((r) => !!r), W = async (i, r, e, f) => {
9
- const a = r.map?.allLayers.find((u) => u.id === i.layerId), l = await r.whenLayerView(a), y = a.title ?? i.layerId;
10
- let c;
7
+ import { f as N } from "../../../../chunks/fetchAgentContext.js";
8
+ const p = 25, W = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map((r) => r.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((r) => !!r), B = async (i, r, e, l) => {
9
+ const a = r.map?.allLayers.find((u) => u.id === i.layerId), d = await r.whenLayerView(a), f = a.title ?? i.layerId;
10
+ let h;
11
11
  if (e) {
12
- const u = await O(e, r);
12
+ const u = await R(e, r);
13
13
  if ("error" in u) {
14
14
  const s = { error: u.error };
15
- if (S(e)) {
16
- const d = r.map?.allLayers.find((m) => m.id === e.layerId);
17
- s.geometryLayerName = d?.title ?? d?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
18
- } else F(e) && (s.point = e.point);
15
+ if (F(e)) {
16
+ const c = r.map?.allLayers.find((y) => y.id === e.layerId);
17
+ s.geometryLayerName = c?.title ?? c?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
18
+ } else I(e) && (s.point = e.point);
19
19
  return {
20
20
  tool: "queryFeatures",
21
- layerName: y,
21
+ layerName: f,
22
22
  summary: "Geometry lookup failed",
23
23
  details: s
24
24
  };
25
25
  }
26
26
  if (!u.geometry) {
27
27
  const s = {};
28
- if (S(e)) {
29
- const d = r.map?.allLayers.find((m) => m.id === e.layerId);
30
- s.error = `No features found matching: ${e.where}`, s.geometryLayerName = d?.title ?? d?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
31
- } else F(e) && (s.error = "Failed to create point geometry", s.point = e.point);
28
+ if (F(e)) {
29
+ const c = r.map?.allLayers.find((y) => y.id === e.layerId);
30
+ s.error = `No features found matching: ${e.where}`, s.geometryLayerName = c?.title ?? c?.id, s.geometryLayerId = e.layerId, s.geometryWhere = e.where;
31
+ } else I(e) && (s.error = "Failed to create point geometry", s.point = e.point);
32
32
  return {
33
33
  tool: "queryFeatures",
34
- layerName: y,
34
+ layerName: f,
35
35
  summary: "No features found for geometry filter",
36
36
  details: s
37
37
  };
38
38
  }
39
- c = u.geometry;
40
- } else f && (c = r.extent.clone());
39
+ h = u.geometry;
40
+ } else l && (h = r.extent.clone());
41
41
  const T = [
42
- .../* @__PURE__ */ new Set([...i.outFields, ...x(i.orderByFields)])
43
- ], b = j(l, T, f ?? !1), w = a.objectIdField, o = a.createQuery();
44
- o.where = N(a.definitionExpression, i.where || "1=1"), o.outFields = i.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...i.outFields, w])], o.orderByFields = i.orderByFields, c && (o.geometry = c, o.spatialRelationship = "intersects"), e?.distance && (o.distance = e.distance), e?.units && (o.units = e.units), o.outSpatialReference = r.spatialReference;
45
- let n, h;
42
+ .../* @__PURE__ */ new Set([...i.outFields, ...W(i.orderByFields)])
43
+ ], b = j(d, T, l ?? !1), w = a.objectIdField, o = a.createQuery();
44
+ o.where = x(a.definitionExpression, i.where || "1=1"), o.outFields = i.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...i.outFields, w])], o.orderByFields = i.orderByFields, h && (o.geometry = h, o.spatialRelationship = "intersects"), e?.distance && (o.distance = e.distance), e?.units && (o.units = e.units), o.outSpatialReference = r.spatialReference;
45
+ let n, m;
46
46
  try {
47
- n = b ? await l.queryFeatureCount(o) : await a.queryFeatureCount(o), n > 0 && n <= p && (h = b ? await l.queryFeatures(o) : await a.queryFeatures(o));
47
+ n = b ? await d.queryFeatureCount(o) : await a.queryFeatureCount(o), n > 0 && n <= p && (m = b ? await d.queryFeatures(o) : await a.queryFeatures(o));
48
48
  } catch (u) {
49
- console.warn("Client-side query failed, falling back to server:", u), n = await a.queryFeatureCount(o), n > 0 && n <= p && (h = await a.queryFeatures(o));
49
+ console.warn("Client-side query failed, falling back to server:", u), n = await a.queryFeatureCount(o), n > 0 && n <= p && (m = await a.queryFeatures(o));
50
50
  }
51
- const { objectIds: g, attributes: q } = h ? C(a, h, r.timeZone) : { objectIds: void 0, attributes: void 0 };
51
+ const { objectIds: g, attributes: S } = m ? C(a, m, r.timeZone) : { objectIds: void 0, attributes: void 0 };
52
52
  return {
53
53
  tool: "queryFeatures",
54
- layerName: y,
54
+ layerName: f,
55
55
  summary: `${n} features found`,
56
56
  details: {
57
57
  totalCount: n,
@@ -59,27 +59,30 @@ const p = 25, x = (i) => i.flatMap((r) => r.split(",")).map((r) => r.trim()).map
59
59
  orderByFields: i.orderByFields,
60
60
  outFields: i.outFields,
61
61
  ...g && { objectIds: g, objectIdField: w },
62
- ...q && { attributes: q },
62
+ ...S && { attributes: S },
63
63
  ...n > p && {
64
64
  note: `${n} features found.`
65
65
  }
66
66
  }
67
67
  };
68
68
  };
69
- async function B({
69
+ async function k({
70
70
  targetLayer: i,
71
71
  geometryFilter: r,
72
72
  useCurrentExtent: e
73
- }, f) {
74
- const { mapView: a } = R(f, ["mapView"]), l = await W(i, a, r, e);
75
- return JSON.stringify(l, null, 2);
73
+ }, l) {
74
+ const { mapView: a } = N(l, ["mapView"]), d = O(
75
+ r,
76
+ l.state?.agentExecutionContext?.sharedResources
77
+ ), f = await B(i, a, d, e);
78
+ return JSON.stringify(f, null, 2);
76
79
  }
77
- const G = t.object({
80
+ const D = t.object({
78
81
  layerId: t.string().describe("The layerId of the layer containing the geometry by which to filter."),
79
82
  where: t.string().describe("The SQL-92 where clause representing the features from which to filter."),
80
83
  distance: t.number().optional().describe("The buffer distance around the geometry."),
81
- units: I.optional().describe("The units for the distance buffer.")
82
- }), k = t.object({
84
+ units: q.optional().describe("The units for the distance buffer.")
85
+ }), L = t.object({
83
86
  point: t.object({
84
87
  x: t.number().describe("X coordinate (longitude) from navigation result"),
85
88
  y: t.number().describe("Y coordinate (latitude) from navigation result"),
@@ -88,12 +91,12 @@ const G = t.object({
88
91
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
89
92
  }).describe("Point coordinates from a previous navigation/geocoding result"),
90
93
  distance: t.number().optional().describe("Optional buffer distance around the point."),
91
- units: I.optional().describe("The units for the distance buffer.")
92
- }), L = t.object({
94
+ units: q.optional().describe("The units for the distance buffer.")
95
+ }), U = t.object({
93
96
  targetLayer: t.object({
94
97
  layerId: t.string().describe("The layerId of the layer containing the field from which to get a value."),
95
98
  where: t.string().describe(
96
- "SQL-92 where clause. IMPORTANT: When using geometryFilter.point for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."
99
+ "SQL-92 where clause. IMPORTANT: When using geometryFilter.point or geometryFilter.sharedResourceId for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."
97
100
  ),
98
101
  orderByFields: t.array(t.string().describe("The field(s) and order for which to sort the resulting features.")),
99
102
  outFields: t.array(
@@ -102,13 +105,13 @@ const G = t.object({
102
105
  ).default("*")
103
106
  )
104
107
  }),
105
- geometryFilter: t.union([G, k]).optional().describe(
106
- "Geometry filter for spatial queries. Use 'point' option with x/y coordinates from navigation results to find features at that location (point-in-polygon). Use 'layerId/where' option to filter by features from another layer."
108
+ geometryFilter: t.union([D, L, G]).optional().describe(
109
+ "Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."
107
110
  ),
108
111
  useCurrentExtent: t.boolean().optional().describe(
109
112
  "Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer)."
110
113
  )
111
- }), P = v(B, {
114
+ }), H = v(k, {
112
115
  name: "queryFeatures",
113
116
  description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
114
117
 
@@ -120,8 +123,8 @@ USE THIS TOOL FOR:
120
123
  - Any question where the user wants to SEE or COUNT matching features
121
124
 
122
125
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
123
- schema: L
126
+ schema: U
124
127
  });
125
128
  export {
126
- P as queryFeaturesTool
129
+ H as queryFeaturesTool
127
130
  };
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import a from"./AKD5UOVX.js";import{a as h}from"./ONQ6JSBJ.js";import{Dc as p}from"./AI6DYOKR.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([w,I,{c:b,d:u,e:m,f:y}])=>{var x=async(t,o,f,n,r,c)=>{let a=t.map?.allLayers.find(s=>s.id===o);if(!a)return{success:!1,error:`Layer '${o}' not found.`};let i=a.createQuery();i.where=f??"1=1",n&&(i.geometry=n,i.spatialRelationship="intersects",r&&(i.distance=r),c&&(i.units=c));try{let{extent:s,count:l}=await a.queryExtent(i);return!s||l===0?{success:!1,error:`No features found for filter (where: ${i.where}${n?", spatial filter used":""})`}:(await t.goTo(s),{success:!0})}catch(s){return{success:!1,error:s instanceof Error?s.message:String(s)}}},v=async(t,o,f,n,r,c)=>{let a=o.map?.allLayers.find(d=>d.id===t.layerId);if(!a)return`Could not find target layer with ID: ${t.layerId}`;let i;if(r){let d=await b(r,o);if("error"in d)return d.error;i=d.geometry}if(a.featureEffect=null,a.featureEffect=new w({filter:new I({...t.objectIds?.length?{objectIds:t.objectIds}:{where:t.where},geometry:i,spatialRelationship:"intersects",distance:r?.distance,units:r?.units}),includedEffect:f,excludedEffect:n}),a.visible=!0,c)return`Applied feature effects to "${a.title??t.layerId}" within current map extent.`;let s=t.objectIds?.length?`${a.objectIdField} IN (${t.objectIds.join(",")})`:t.where,l=await x(o,t.layerId,s,i,r?.distance,r?.units),g=a.title??t.layerId;return l.success?`Applied feature effects to target layer "${a.title??t.layerId}"${r&&"layerId"in r?` using geometry from layer "${r.layerId}"`:""}.`:`Applied filter to "${g}" but no features matched. ${l.error}`},j=async({targetLayer:t,geometryFilter:o,useCurrentExtent:f,includedEffect:n="drop-shadow(2px, 2px, 2px, gray)",excludedEffect:r="grayscale(100%) opacity(60%) blur(2px)"},c)=>{let{mapView:a}=h(c,["mapView"]),i=y(o,c.state?.agentExecutionContext?.sharedResources);return await v(t,a,n,r,i,f)},E=e.object({layerId:e.string().describe("The layerId of the layer containing the geometry by which to filter."),where:e.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:e.number().optional().describe("The buffer distance around the geometry."),units:u.optional().describe("The units for the distance buffer.")}),T=e.object({point:e.object({x:e.number().describe("X coordinate (longitude) from navigation result"),y:e.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:e.object({wkid:e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:e.number().optional().describe("Optional buffer distance around the point."),units:u.optional().describe("The units for the distance buffer.")}),$=e.object({targetLayer:e.object({layerId:e.string().describe("The layerId of the layer on which to set a feature effect."),where:e.string().describe("The SQL-92 where clause representing the features to emphasize."),objectIds:e.array(e.number()).optional().describe("Array of objectIds from a previous query result. Use this instead of a where clause when the query returned objectIds (e.g. top N results). If provided, takes precedence over where clause.")}),geometryFilter:e.union([E,T,m]).optional().describe("Optional spatial filter. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location."),useCurrentExtent:e.boolean().optional().describe("Set to true when the previous query used the current map extent as a spatial filter. This ensures the feature effect applies only to features visible in the current view. Default is false."),includedEffect:e.string().default("drop-shadow(2px, 2px, 2px, gray)").describe("The effect applied to features that meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified."),excludedEffect:e.string().default("grayscale(100%) opacity(60%) blur(2px)").describe("The effect applied to features that do not meet the filter requirements. Valid effects include: bloom, blur, brightness, contrast, drop-shadow, grayscale, hue-rotate, invert, opacity, saturate, and sepia. Prefer default unless specified.")}),F=p(j,{name:"setFeatureEffect",description:"Sets a feature effect on a given layer with given filter parameters and feature effects to emphasize certain features that meet a filter requirement. If no feature effect information is provided, then use the default effect provided.",schema:$});return F},"layers/support/FeatureEffect","layers/support/FeatureFilter",a)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import b from"./CCC6LBMY.js";import{a as B,b as S}from"./34O57OGV.js";import a from"./AKD5UOVX.js";import{a as g}from"./ONQ6JSBJ.js";import{Dc as h}from"./AI6DYOKR.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([k,j,{c:b,d:y,e:w,f:F},{d:T}])=>{var q=i=>i.flatMap(t=>t.split(",")).map(t=>t.trim()).map(t=>t.split(/\s+/u)[0]?.replace(/^"|"$/gu,"")).filter(t=>!!t),R=async(i,t,n,a,d)=>{let s=n.map?.allLayers.find(o=>o.id===i.layerId),c=await n.whenLayerView(s),u=s.title??i.layerId,l;if(a){let o=await b(a,n);if("error"in o)return{tool:"getTopFeatures",layerName:u,summary:"Geometry lookup failed",details:{error:o.error}};if(!o.geometry)return{tool:"getTopFeatures",layerName:u,summary:"No features found for geometry filter",details:{error:`No features found matching: ${"where"in a?a.where:"unknown criteria"}`}};l=o.geometry}else d&&(l=n.extent.clone());let m=t.groupByFields&&t.groupByFields.length>0,f=s.objectIdField,p=i.outFields.includes("*")?["*"]:[...new Set([...i.outFields,f])];try{let o;if(m){let r=new k({where:i.where||"1=1",outFields:p,orderByFields:i.orderByFields,geometry:l,spatialRelationship:l?"intersects":void 0,distance:a?.distance,units:a?.units,topFilter:new j({topCount:t.topCount,groupByFields:t.groupByFields,orderByFields:t.orderByFields})});o=await s.queryTopFeatures(r)}else{let r=s.createQuery();r.where=S(s.definitionExpression,i.where||"1=1"),r.outFields=p.length?p:["*"],r.orderByFields=t.orderByFields,r.returnGeometry=!1,r.num=t.topCount,l&&(r.geometry=l,r.spatialRelationship="intersects"),a?.distance&&(r.distance=a.distance),a?.units&&(r.units=a.units),r.outSpatialReference=n.spatialReference;let v=[...new Set([...i.outFields,...q(t.orderByFields)])],N=B(c,v,d??!1);try{o=N?await c.queryFeatures(r):await s.queryFeatures(r)}catch(x){console.warn("Client-side query failed, falling back to server:",x),o=await s.queryFeatures(r)}}let C=o.features.map(r=>r.attributes[f]),{attributes:I}=T(s,o,n.timeZone);return{tool:"getTopFeatures",layerName:u,summary:`Top ${t.topCount} features extracted`,details:{topCount:t.topCount,attributes:I,objectIds:C,objectIdField:f,where:i.where,orderByFields:t.orderByFields,...m&&{groupByFields:t.groupByFields}}}}catch(o){return{tool:"getTopFeatures",layerName:u,summary:"Query failed",details:{error:o instanceof Error?o.message:String(o)}}}},D=async({targetLayer:i,topFilter:t,geometryFilter:n,useCurrentExtent:a},d)=>{let{mapView:s}=g(d,["mapView"]),c=F(n,d.state?.agentExecutionContext?.sharedResources),u=await R(i,t,s,c,a);return JSON.stringify(u,null,2)},E=e.object({layerId:e.string().describe("The layerId of the layer containing the geometry by which to filter."),where:e.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:e.number().optional().describe("The buffer distance around the geometry."),units:y.optional().describe("The units for the distance buffer.")}),L=e.object({point:e.object({x:e.number().describe("X coordinate (longitude) from navigation result"),y:e.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:e.object({wkid:e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:e.number().optional().describe("Optional buffer distance around the point."),units:y.optional().describe("The units for the distance buffer.")}),G=e.object({targetLayer:e.object({layerId:e.string().describe("The layerId of the layer containing the field from which to get a value."),where:e.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),orderByFields:e.array(e.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:e.array(e.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:e.union([E,L,w]).optional().describe("Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."),topFilter:e.object({topCount:e.number().describe("Number of top features to return per group."),orderByFields:e.array(e.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")),groupByFields:e.array(e.string().describe("Field(s) to group results by. Returns top N per group."))}).required(),useCurrentExtent:e.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at'. Default is false (queries entire layer).")}),W=h(D,{name:"getTopFeatures",description:'Returns top N features ranked by an existing field value. Use for "highest", "lowest", "top N" questions where ranking is based on a field that already exists in the data (e.g., population, value, date, depth). orderByFields must be actual field names with ASC/DESC. Do NOT use aggregate functions like COUNT(), SUM(), AVG() - those require getStatistics.',schema:G});return W},"rest/support/TopFeaturesQuery","rest/support/TopFilter",a,b)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import q from"./ASR3I43T.js";import p from"./SZ2QSSB3.js";import n from"./MX7OEO5Z.js";import{a as o,c as m}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,p])=>{var t=class extends i{constructor(){super(...arguments),this.agent=p}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-layer-styling-agent"),this.#i=m(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-layer-styling-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,n,p,q)
2
+ import q from"./IJVMUS2L.js";import p from"./SZ2QSSB3.js";import n from"./FXP5UIQU.js";import{a as o,c as m}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./NNXISHCA.js";import h from"./5K5ZY267.js";import g from"./655YIKL3.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./C4JT4S5E.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./22KHSDJI.js";import a from"./AKD5UOVX.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,p])=>{var t=class extends i{constructor(){super(...arguments),this.agent=p}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-layer-styling-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-layer-styling-agent"),this.#i=m(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-layer-styling-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,n,p,q)
@@ -0,0 +1,11 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import b from"./CCC6LBMY.js";import{a as x,b as O}from"./34O57OGV.js";import a from"./AKD5UOVX.js";import{a as L}from"./ONQ6JSBJ.js";import{Dc as S}from"./AI6DYOKR.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([{a:p,b:g,c:v,d:b,e:R,f:j},{d:N}])=>{var w=25,k=i=>i.flatMap(r=>r.split(",")).map(r=>r.trim()).map(r=>r.split(/\s+/u)[0]?.replace(/^"|"$/gu,"")).filter(r=>!!r),E=async(i,r,t,l)=>{let s=r.map?.allLayers.find(u=>u.id===i.layerId),d=await r.whenLayerView(s),f=s.title??i.layerId,h;if(t){let u=await v(t,r);if("error"in u){let o={error:u.error};if(g(t)){let c=r.map?.allLayers.find(m=>m.id===t.layerId);o.geometryLayerName=c?.title??c?.id,o.geometryLayerId=t.layerId,o.geometryWhere=t.where}else p(t)&&(o.point=t.point);return{tool:"queryFeatures",layerName:f,summary:"Geometry lookup failed",details:o}}if(!u.geometry){let o={};if(g(t)){let c=r.map?.allLayers.find(m=>m.id===t.layerId);o.error=`No features found matching: ${t.where}`,o.geometryLayerName=c?.title??c?.id,o.geometryLayerId=t.layerId,o.geometryWhere=t.where}else p(t)&&(o.error="Failed to create point geometry",o.point=t.point);return{tool:"queryFeatures",layerName:f,summary:"No features found for geometry filter",details:o}}h=u.geometry}else l&&(h=r.extent.clone());let C=[...new Set([...i.outFields,...k(i.orderByFields)])],F=x(d,C,l??!1),I=s.objectIdField,a=s.createQuery();a.where=O(s.definitionExpression,i.where||"1=1"),a.outFields=i.outFields.includes("*")?["*"]:[...new Set([...i.outFields,I])],a.orderByFields=i.orderByFields,h&&(a.geometry=h,a.spatialRelationship="intersects"),t?.distance&&(a.distance=t.distance),t?.units&&(a.units=t.units),a.outSpatialReference=r.spatialReference;let n,y;try{n=F?await d.queryFeatureCount(a):await s.queryFeatureCount(a),n>0&&n<=w&&(y=F?await d.queryFeatures(a):await s.queryFeatures(a))}catch(u){console.warn("Client-side query failed, falling back to server:",u),n=await s.queryFeatureCount(a),n>0&&n<=w&&(y=await s.queryFeatures(a))}let{objectIds:q,attributes:T}=y?N(s,y,r.timeZone):{objectIds:void 0,attributes:void 0};return{tool:"queryFeatures",layerName:f,summary:`${n} features found`,details:{totalCount:n,where:i.where,orderByFields:i.orderByFields,outFields:i.outFields,...q&&{objectIds:q,objectIdField:I},...T&&{attributes:T},...n>w&&{note:`${n} features found.`}}}};async function W({targetLayer:i,geometryFilter:r,useCurrentExtent:t},l){let{mapView:s}=L(l,["mapView"]),d=j(r,l.state?.agentExecutionContext?.sharedResources),f=await E(i,s,d,t);return JSON.stringify(f,null,2)}var B=e.object({layerId:e.string().describe("The layerId of the layer containing the geometry by which to filter."),where:e.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:e.number().optional().describe("The buffer distance around the geometry."),units:b.optional().describe("The units for the distance buffer.")}),D=e.object({point:e.object({x:e.number().describe("X coordinate (longitude) from navigation result"),y:e.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:e.object({wkid:e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:e.number().optional().describe("Optional buffer distance around the point."),units:b.optional().describe("The units for the distance buffer.")}),U=e.object({targetLayer:e.object({layerId:e.string().describe("The layerId of the layer containing the field from which to get a value."),where:e.string().describe("SQL-92 where clause. IMPORTANT: When using geometryFilter.point or geometryFilter.sharedResourceId for point-in-polygon queries, set this to '1=1' to return all features that intersect the point. Only add attribute filters if the user specifically requests them in addition to the spatial query."),orderByFields:e.array(e.string().describe("The field(s) and order for which to sort the resulting features.")),outFields:e.array(e.string().describe('The fields to include in the output that will be presented to the user. This should include identifying information about the resulting features, like a name or id, along with the values desired in the output. If unsure, choose all fields ("*").').default("*"))}),geometryFilter:e.union([B,D,R]).optional().describe("Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."),useCurrentExtent:e.boolean().optional().describe("Set to true ONLY when user explicitly asks about features 'in my view', 'on my map', 'I am looking at', OR when the user refers back to features previously identified using the current extent (e.g. 'these', 'those', 'them', 'the same ones'). Default is false (queries entire layer).")}),Y=S(W,{name:"queryFeatures",description:`Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if \u226425 features match.
3
+
4
+ USE THIS TOOL FOR:
5
+ - "Show / display / list features where..." \u2014 finding and listing features
6
+ - "How many X are Y?" \u2014 counting features that match a condition
7
+ - "Which features..." / "Find features..." \u2014 identifying specific features
8
+ - Spatial queries \u2014 finding features near/within/intersecting other features
9
+ - Any question where the user wants to SEE or COUNT matching features
10
+
11
+ This is the DEFAULT tool for most queries. When in doubt, use this tool.`,schema:U});return Y},a,b)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as r}from"./VXFQANGJ.js";export default $arcgis.t(([f,l])=>{var c=750;function m(e){return"point"in e&&e.point!==void 0}function y(e){return"layerId"in e&&e.layerId!==void 0}var I=async(e,a)=>{if(m(e)){let{point:t}=e;return{geometry:new f({x:t.x,y:t.y,spatialReference:t.spatialReference?{wkid:t.spatialReference.wkid}:a.spatialReference})}}if(y(e)){let t=a.map?.allLayers.find(o=>o.id===e.layerId);if(!t)return{error:`Could not find geometry layer with ID: ${e.layerId}`};let i=t.title??t.id,n=e.where?.trim()||"1=1";try{let o=await t.queryFeatures({where:n,returnGeometry:!0,outSpatialReference:a.spatialReference,num:c+1});if(!o.features.length)return{error:`No features found in geometry layer "${i}" with the specified where clause: ${n}`};if(o.features.length>c)return{error:`Geometry filter for layer "${i}" matched too many features (${o.features.length}+). Please narrow the geometry layer filter.`};let s=o.features.map(u=>u.geometry).filter(u=>!!u);if(!s.length)return{error:"No valid geometries found for the matched geometry layer features."};let d=s.length===1?s[0]:l.executeMany(s);return d?(d.spatialReference||(d.spatialReference=a.spatialReference),{geometry:d}):{error:"Failed to combine geometries from geometry layer."}}catch(o){return{error:`Failed to query geometry: ${String(o)}`}}}return{error:"Invalid geometry configuration provided"}},p=["feet","kilometers","meters","miles","nautical-miles","us-nautical-miles"],h=r.enum(p),g=r.object({id:r.string()}),b=r.object({id:r.string(),kind:r.literal("point"),payload:r.object({x:r.number(),y:r.number(),spatialReference:r.object({wkid:r.number()}).optional()})}),v=r.object({sharedResourceId:r.string().describe("ID of a point returned by listSharedResources for a previously geocoded address or place."),distance:r.number().optional().describe("Optional buffer distance around the point."),units:h.optional().describe("The units for the distance buffer.")}),$=(e,a)=>{if(!e||!("sharedResourceId"in e))return e;if(!a)throw new Error("Shared resources are unavailable in the tool runtime state.");let t=a.find(n=>{let o=g.safeParse(n);return o.success&&o.data.id===e.sharedResourceId});if(!t)throw new Error(`Shared resource not found: ${e.sharedResourceId}`);let i=b.safeParse(t);if(!i.success)throw new Error(`Shared resource ${e.sharedResourceId} does not contain a valid point.`);return{point:i.data.payload,distance:e.distance,units:e.units}};return{a:m,b:y,c:I,d:h,e:v,f:$}},"geometry/Point","geometry/operators/unionOperator")
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import{b as C,c as q}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import d from"./G7OMHU2B.js";import"./CP5BVGJU.js";import b from"./7VUSIGEM.js";import{a as R,b as F,e as L}from"./R2PQVY4O.js";import a from"./D5UFYQHN.js";import{e as P}from"./G2EGT3CF.js";import{v as A,z as J}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./HHFNQR6Z.js";import"./VOKXKU7M.js";import{W as I,ka as T}from"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import{Dd as c}from"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([W,K,{property:n,subclass:l},b,E,,,,,,,D,M])=>{var Q=Object.defineProperty,U=Object.getOwnPropertyDescriptor,f=(t,e,r,s)=>{for(var o=s>1?void 0:s?U(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&Q(e,r,o),o},p=class extends E{constructor(t){super(t)}static fromJSON(t){return new p({id:t.id,sourceAnchorId:t.source_anchor_id,sourceNodeId:t.source_node_id,targetAnchorId:t.target_anchor_id,targetNodeId:t.target_node_id})}};f([n()],p.prototype,"id",2);f([n()],p.prototype,"sourceAnchorId",2);f([n()],p.prototype,"sourceNodeId",2);f([n()],p.prototype,"targetAnchorId",2);f([n()],p.prototype,"targetNodeId",2);p=f([l("Edge")],p);var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,O=(t,e,r,s)=>{for(var o=s>1?void 0:s?Y(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&X(e,r,o),o},m=class extends E{constructor(t){super(t)}async load(){return await Promise.resolve(this)}compile(t){return{runtimeNode:this.createRuntimeNode(),edges:t.outgoingEdges.map(e=>({from:this.id,to:e.targetNodeId}))}}static fromJSON(t){throw new Error("BaseNode is abstract and cannot be instantiated directly.")}};O([n()],m.prototype,"id",2);O([n()],m.prototype,"label",2);O([n()],m.prototype,"type",2);m=O([l("BaseNode")],m);function G(t){let e=new Set(t.required),r=Object.fromEntries(Object.entries(t.properties).map(([s,o])=>{let a=$(o);return[s,e.has(s)?a:a.optional()]}));return c.object(r)}function $(t){let e;switch(t.type){case"array":e=c.array(t.items?$(t.items):c.unknown());break;case"boolean":e=c.boolean();break;case"number":e=c.number();break;case"object":e=G({properties:t.properties??{},required:t.required});break;case"string":e=t.enum?.length?c.enum(t.enum):c.string();break}return t.description?e.describe(t.description):e}var tt=new Map([["clear_filters",async()=>(await import("./RBE55SWR.js")).clearFiltersTool],["reset_map",async()=>(await import("./T4RIGOXB.js")).resetMapTool],["set_feature_effect",async()=>(await import("./UHZG7SKO.js").then(m=>m.default.then(e=>({setFeatureEffectTool:e})))).setFeatureEffectTool],["list_layer_fields",async()=>(await import("./CJMUJXPL.js")).listLayerFieldsTool],["go_to_address",async()=>(await import("./7ZFAFKJT.js").then(m=>m.default.then(e=>({goToAddressTool:e})))).goToAddressTool],["go_to_bookmark",async()=>(await import("./2EY3BQQX.js")).goToBookmarkTool],["go_to_features",async()=>(await import("./5X7EG7D2.js")).goToFeaturesTool],["go_to_full_extent",async()=>(await import("./YLVJA4ZE.js").then(m=>m.default.then(e=>({goToFullExtentTool:e})))).goToFullExtentTool],["go_to_home_extent",async()=>(await import("./JO5ETMPS.js")).goToHomeExtentTool],["go_to_layer",async()=>(await import("./Q57QWN5W.js")).goToLayerTool],["go_to_scale",async()=>(await import("./4OGR5QKS.js")).goToScaleTool],["go_to_viewpoint",async()=>(await import("./ZOEMBHRF.js").then(m=>m.default.then(e=>({goToViewpointTool:e})))).goToViewpointTool],["go_to_zoom",async()=>(await import("./PUHRBGKB.js")).goToZoomTool],["find_relevant_fields",async()=>(await import("./7BCQMK6D.js").then(m=>m.default.then(e=>({findRelevantFieldsTool:e})))).findRelevantFieldsTool],["find_relevant_layers",async()=>(await import("./IBZ2NEAO.js")).findRelevantLayersTool],["get_attribute",async()=>(await import("./7V6OSTFC.js").then(m=>m.default.then(e=>({getAttributeTool:e})))).getAttributeTool],["get_statistics",async()=>(await import("./4WIDLQUH.js").then(m=>m.default.then(e=>({getStatisticsTool:e})))).getStatisticsTool],["get_top_features",async()=>(await import("./GFEOVHJK.js").then(m=>m.default.then(e=>({getTopFeaturesTool:e})))).getTopFeaturesTool],["query_features",async()=>(await import("./CZM4URK7.js").then(m=>m.default.then(e=>({queryFeaturesTool:e})))).queryFeaturesTool]]);async function et(t){let e=tt.get(t);if(!e)throw new Error(`ArcGIS tool is not supported in the browser runtime: ${t}`);return await e()}var ot=Object.defineProperty,rt=Object.getOwnPropertyDescriptor,N=(t,e,r,s)=>{for(var o=s>1?void 0:s?rt(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&ot(e,r,o),o},u=class extends E{constructor(t){super(t),this.type="arcgis-tool"}async createRuntimeTools(){if(!this.name)throw new Error("ArcgisTool name is required");return[await et(this.name)]}static fromJSON(t){return new u({name:t.name,requireApproval:t.require_approval})}};N([n()],u.prototype,"name",2);N([n()],u.prototype,"requireApproval",2);N([n()],u.prototype,"type",2);u=N([l("ArcgisTool")],u);var st=Object.defineProperty,at=Object.getOwnPropertyDescriptor,B=t=>{throw TypeError(t)},w=(t,e,r,s)=>{for(var o=s>1?void 0:s?at(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&st(e,r,o),o},it=(t,e,r)=>e.has(t)||B("Cannot "+r),nt=(t,e,r)=>e.has(t)?B("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ct=(t,e,r)=>(it(t,e,"access private method"),r),S,z,d=class extends m{constructor(t){super(t),nt(this,S),this.type="agent-node"}createRuntimeNode(){let t;return async(e,r)=>{t??=ct(this,S,z).call(this);let s=await(await t).run(e,r),o=this.outputSchema?.safeParse(s);if(o&&!o.success)throw o.error;let a=o?.data,i=a??s.outputMessage;return{agentExecutionContext:s.agentExecutionContext,...a?{}:{outputMessage:s.outputMessage},status:s.status,summary:s.summary,nodes:{[this.id]:{output:i}}}}}compile(t){let e=t.outgoingEdges[0]?.targetNodeId;return{runtimeNode:this.createRuntimeNode(),edges:[{from:this.id,decide:r=>r.status==="failed"?void 0:e}],schemas:[c.object({output:this.outputSchema??c.string()})]}}static fromJSON(t){let e=new d({id:t.id,label:t.label,prompt:t.prompt?.content,type:"agent-node",modelTier:t.llm_model?.model_tier});return t.structured_output&&(e.outputSchema=G(t.structured_output)),e.tools=t.tools?.filter(r=>r.type==="arcgis_tool").map(r=>u.fromJSON(r)),e}};S=new WeakSet;z=async function(){let t=this.prompt;if(!t?.trim())throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);let e=[];if(this.tools)for(let r of this.tools){let s=await r.createRuntimeTools();e.push(...s)}return new M({name:this.id,outputSchema:this.outputSchema,modelTier:this.modelTier,prompt:t,tools:e})};w([n()],d.prototype,"type",2);w([n()],d.prototype,"prompt",2);w([n()],d.prototype,"outputSchema",2);w([n()],d.prototype,"tools",2);w([n()],d.prototype,"modelTier",2);d=w([l("AgentNode")],d);var pt=Object.defineProperty,dt=Object.getOwnPropertyDescriptor,k=(t,e,r,s)=>{for(var o=s>1?void 0:s?dt(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&pt(e,r,o),o},h=class extends m{constructor(t){super(t),this.type="end-message-node"}createRuntimeNode(){return async t=>{let e=await I.fromTemplate(this.message,{templateFormat:"mustache"}).format(t);return{outputMessage:e,status:"success",summary:e}}}compile(t){return{runtimeNode:this.createRuntimeNode(),edges:[]}}static fromJSON(t){let e=new h({id:t.id,label:t.label,type:"end-message-node"});return e.message=t.message,e}};k([n()],h.prototype,"type",2);k([n()],h.prototype,"message",2);h=k([l("EndMessageNode")],h);var mt=Object.defineProperty,ut=Object.getOwnPropertyDescriptor,H=(t,e,r,s)=>{for(var o=s>1?void 0:s?ut(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&mt(e,r,o),o},y=class extends m{constructor(t){super(t),this.type="start-node"}createRuntimeNode(){return t=>({question:t.agentExecutionContext.userRequest})}static fromJSON(t){return new y({id:t.id,label:t.label,type:"start-node"})}};H([n()],y.prototype,"type",2);y=H([l("StartNode")],y);function lt(t){switch(t.type){case"agent_node":return d.fromJSON(t);case"end_message_node":return h.fromJSON(t);case"start_node":return y.fromJSON(t);default:throw new Error(`WebAgent node "${t.id}" uses unsupported type "${t.type}".`)}}function ht(t={}){let e=Object.keys(t);if(R(e),e.includes("nodes"))throw new Error("node state cannot define reserved field: nodes.");let r=F(t);return T.Root({...r,nodes:T({reducer:(s,o)=>({...s,...o}),default:()=>({})}),...P()})}function V(t){let e=new Set;for(let s of t)for(let o of Object.keys(s.shape??{}))o!=="nodes"&&e.add(o);let r=Object.fromEntries([...e].map(s=>[s,void 0]));return ht(r)}var v=class t{constructor(e,r,s){this.sourceJSON=e,this.edges=r,this.nodes=s,this._loaded=!1}static fromJSON(e){return new t(e,e.graph.edges.map(r=>p.fromJSON(r)),e.graph.nodes.map(r=>lt(r)))}async load(){return this._loadPromise??=Promise.all(this.nodes.map(async e=>await e.load())).then(()=>{this._loaded=!0}),await this._loadPromise,this}getSchemas(){let e=Object.fromEntries(this._getNodeCompilations().flatMap((r,s)=>{let o=this.nodes[s];return r.schemas?.map(a=>[o.id,a])??[]}));return[c.object({loopCounts:c.record(c.string(),c.number()).optional(),nodes:c.object(e).partial().optional(),question:c.string().optional()})]}generate(){this._assertLoaded(),this._nodeCompilations=void 0;let e=this._getNodeCompilations(),r=V(this.getSchemas()),s=this.nodes.find(i=>i.type==="start-node")?.id,o={},a=[];for(let[i,Z]of this.nodes.entries()){let _=e[i];_&&(_.runtimeNode&&(o[Z.id]=_.runtimeNode),a.push(..._.edges))}return{createGraph:()=>L(o,a,r,{entryNode:s}),workspace:r}}_assertLoaded(){if(!this._loaded)throw new Error("AgenticWorkflowRuntime must be loaded before it can generate a graph.")}_getNodeCompilations(){return this._assertLoaded(),this._nodeCompilations??=this.nodes.map(e=>e.compile({outgoingEdges:this.edges.filter(r=>r.sourceNodeId===e.id)}))}},gt=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,x=(t,e,r,s)=>{for(var o=s>1?void 0:s?ft(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&gt(e,r,o),o},wt=()=>{throw new Error("WebAgent must be loaded before it can run.")},g=class extends D{constructor(t){super(t)}async load(){if(this.portalItem){try{await this.portalItem.load()}catch(r){throw new b("web-agent:load-portal-item","Failed to load portal item",{error:r})}let e=await this.portalItem.fetchData();if(this.sourceJSON=e,!this.portalItem.title)throw new b("web-agent:missing-title","The portal item is missing a title")}if(!this.sourceJSON)throw new b("web-agent:missing-source-json","The source JSON is missing");if(!this.sourceJSON.description)throw new b("web-agent:missing-description","The source JSON is missing a description");let t=v.fromJSON(this.sourceJSON);return await t.load(),this._runtime=t,this.description=this.sourceJSON.description,this.name=this.portalItem?.title??`web-agent-${Date.now()}`,this.generate(),this}getSchemas(){return this._runtime?.getSchemas()??[]}generate(){if(!this._runtime){this._set("workspace",V([])),this._set("createGraph",wt);return}let{createGraph:t,workspace:e}=this._runtime.generate();this._set("workspace",e),this._set("createGraph",t)}};x([n({type:W})],g.prototype,"portalItem",2);x([n()],g.prototype,"sourceJSON",2);g=x([l("WebAgent")],g);var j=class extends A{static{this.properties={agent:0,context:0,itemId:1,workflow:0}}#t;async getContext(){return C(this.context)?await this.context():this.context}async load(){let e;if(this.itemId){let r=K.getDefault();e=new g({portalItem:new W({id:this.itemId,portal:r})})}else this.workflow&&(e=new g({sourceJSON:this.workflow}));if(e&&(await e.load(),this.agent=e.registration),!this.agent)throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");this.#t=q(this)}disconnectedCallback(){this.#t?.unregister(this.agent.id),super.disconnectedCallback()}};J("arcgis-assistant-agent",j);return j},"portal/PortalItem","portal/Portal","core/accessorSupport/decorators","core/Error","core/Accessor","identity/IdentityManager","request","config","core/reactiveUtils","layers/FeatureLayer",a,b,d)
2
+ import{b as C,c as q}from"./V6HOUZPZ.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import d from"./G7OMHU2B.js";import"./CP5BVGJU.js";import b from"./7VUSIGEM.js";import{a as R,b as F,e as L}from"./R2PQVY4O.js";import a from"./D5UFYQHN.js";import{e as P}from"./G2EGT3CF.js";import{v as A,z as J}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./HHFNQR6Z.js";import"./VOKXKU7M.js";import{W as I,ka as T}from"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import{Dd as c}from"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([W,K,{property:n,subclass:l},b,E,,,,,,,D,M])=>{var Q=Object.defineProperty,U=Object.getOwnPropertyDescriptor,f=(t,e,r,s)=>{for(var o=s>1?void 0:s?U(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&Q(e,r,o),o},p=class extends E{constructor(t){super(t)}static fromJSON(t){return new p({id:t.id,sourceAnchorId:t.source_anchor_id,sourceNodeId:t.source_node_id,targetAnchorId:t.target_anchor_id,targetNodeId:t.target_node_id})}};f([n()],p.prototype,"id",2);f([n()],p.prototype,"sourceAnchorId",2);f([n()],p.prototype,"sourceNodeId",2);f([n()],p.prototype,"targetAnchorId",2);f([n()],p.prototype,"targetNodeId",2);p=f([l("Edge")],p);var X=Object.defineProperty,Y=Object.getOwnPropertyDescriptor,O=(t,e,r,s)=>{for(var o=s>1?void 0:s?Y(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&X(e,r,o),o},m=class extends E{constructor(t){super(t)}async load(){return await Promise.resolve(this)}compile(t){return{runtimeNode:this.createRuntimeNode(),edges:t.outgoingEdges.map(e=>({from:this.id,to:e.targetNodeId}))}}static fromJSON(t){throw new Error("BaseNode is abstract and cannot be instantiated directly.")}};O([n()],m.prototype,"id",2);O([n()],m.prototype,"label",2);O([n()],m.prototype,"type",2);m=O([l("BaseNode")],m);function G(t){let e=new Set(t.required),r=Object.fromEntries(Object.entries(t.properties).map(([s,o])=>{let a=$(o);return[s,e.has(s)?a:a.optional()]}));return c.object(r)}function $(t){let e;switch(t.type){case"array":e=c.array(t.items?$(t.items):c.unknown());break;case"boolean":e=c.boolean();break;case"number":e=c.number();break;case"object":e=G({properties:t.properties??{},required:t.required});break;case"string":e=t.enum?.length?c.enum(t.enum):c.string();break}return t.description?e.describe(t.description):e}var tt=new Map([["clear_filters",async()=>(await import("./RBE55SWR.js")).clearFiltersTool],["reset_map",async()=>(await import("./T4RIGOXB.js")).resetMapTool],["set_feature_effect",async()=>(await import("./FJO4KNOZ.js").then(m=>m.default.then(e=>({setFeatureEffectTool:e})))).setFeatureEffectTool],["list_layer_fields",async()=>(await import("./CJMUJXPL.js")).listLayerFieldsTool],["go_to_address",async()=>(await import("./QUKNPVAF.js").then(m=>m.default.then(e=>({goToAddressTool:e})))).goToAddressTool],["go_to_bookmark",async()=>(await import("./2EY3BQQX.js")).goToBookmarkTool],["go_to_features",async()=>(await import("./5X7EG7D2.js")).goToFeaturesTool],["go_to_full_extent",async()=>(await import("./YLVJA4ZE.js").then(m=>m.default.then(e=>({goToFullExtentTool:e})))).goToFullExtentTool],["go_to_home_extent",async()=>(await import("./JO5ETMPS.js")).goToHomeExtentTool],["go_to_layer",async()=>(await import("./Q57QWN5W.js")).goToLayerTool],["go_to_scale",async()=>(await import("./4OGR5QKS.js")).goToScaleTool],["go_to_viewpoint",async()=>(await import("./ZOEMBHRF.js").then(m=>m.default.then(e=>({goToViewpointTool:e})))).goToViewpointTool],["go_to_zoom",async()=>(await import("./PUHRBGKB.js")).goToZoomTool],["find_relevant_fields",async()=>(await import("./7BCQMK6D.js").then(m=>m.default.then(e=>({findRelevantFieldsTool:e})))).findRelevantFieldsTool],["find_relevant_layers",async()=>(await import("./IBZ2NEAO.js")).findRelevantLayersTool],["get_attribute",async()=>(await import("./7V6OSTFC.js").then(m=>m.default.then(e=>({getAttributeTool:e})))).getAttributeTool],["get_statistics",async()=>(await import("./XX6GHMNR.js").then(m=>m.default.then(e=>({getStatisticsTool:e})))).getStatisticsTool],["get_top_features",async()=>(await import("./ZRVZMPFN.js").then(m=>m.default.then(e=>({getTopFeaturesTool:e})))).getTopFeaturesTool],["query_features",async()=>(await import("./G3SF6U2U.js").then(m=>m.default.then(e=>({queryFeaturesTool:e})))).queryFeaturesTool]]);async function et(t){let e=tt.get(t);if(!e)throw new Error(`ArcGIS tool is not supported in the browser runtime: ${t}`);return await e()}var ot=Object.defineProperty,rt=Object.getOwnPropertyDescriptor,N=(t,e,r,s)=>{for(var o=s>1?void 0:s?rt(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&ot(e,r,o),o},u=class extends E{constructor(t){super(t),this.type="arcgis-tool"}async createRuntimeTools(){if(!this.name)throw new Error("ArcgisTool name is required");return[await et(this.name)]}static fromJSON(t){return new u({name:t.name,requireApproval:t.require_approval})}};N([n()],u.prototype,"name",2);N([n()],u.prototype,"requireApproval",2);N([n()],u.prototype,"type",2);u=N([l("ArcgisTool")],u);var st=Object.defineProperty,at=Object.getOwnPropertyDescriptor,B=t=>{throw TypeError(t)},w=(t,e,r,s)=>{for(var o=s>1?void 0:s?at(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&st(e,r,o),o},it=(t,e,r)=>e.has(t)||B("Cannot "+r),nt=(t,e,r)=>e.has(t)?B("Cannot add the same private member more than once"):e instanceof WeakSet?e.add(t):e.set(t,r),ct=(t,e,r)=>(it(t,e,"access private method"),r),S,z,d=class extends m{constructor(t){super(t),nt(this,S),this.type="agent-node"}createRuntimeNode(){let t;return async(e,r)=>{t??=ct(this,S,z).call(this);let s=await(await t).run(e,r),o=this.outputSchema?.safeParse(s);if(o&&!o.success)throw o.error;let a=o?.data,i=a??s.outputMessage;return{agentExecutionContext:s.agentExecutionContext,...a?{}:{outputMessage:s.outputMessage},status:s.status,summary:s.summary,nodes:{[this.id]:{output:i}}}}}compile(t){let e=t.outgoingEdges[0]?.targetNodeId;return{runtimeNode:this.createRuntimeNode(),edges:[{from:this.id,decide:r=>r.status==="failed"?void 0:e}],schemas:[c.object({output:this.outputSchema??c.string()})]}}static fromJSON(t){let e=new d({id:t.id,label:t.label,prompt:t.prompt?.content,type:"agent-node",modelTier:t.llm_model?.model_tier});return t.structured_output&&(e.outputSchema=G(t.structured_output)),e.tools=t.tools?.filter(r=>r.type==="arcgis_tool").map(r=>u.fromJSON(r)),e}};S=new WeakSet;z=async function(){let t=this.prompt;if(!t?.trim())throw new Error(`WebAgent agent node "${this.id}" requires a prompt.`);let e=[];if(this.tools)for(let r of this.tools){let s=await r.createRuntimeTools();e.push(...s)}return new M({name:this.id,outputSchema:this.outputSchema,modelTier:this.modelTier,prompt:t,tools:e})};w([n()],d.prototype,"type",2);w([n()],d.prototype,"prompt",2);w([n()],d.prototype,"outputSchema",2);w([n()],d.prototype,"tools",2);w([n()],d.prototype,"modelTier",2);d=w([l("AgentNode")],d);var pt=Object.defineProperty,dt=Object.getOwnPropertyDescriptor,k=(t,e,r,s)=>{for(var o=s>1?void 0:s?dt(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&pt(e,r,o),o},h=class extends m{constructor(t){super(t),this.type="end-message-node"}createRuntimeNode(){return async t=>{let e=await I.fromTemplate(this.message,{templateFormat:"mustache"}).format(t);return{outputMessage:e,status:"success",summary:e}}}compile(t){return{runtimeNode:this.createRuntimeNode(),edges:[]}}static fromJSON(t){let e=new h({id:t.id,label:t.label,type:"end-message-node"});return e.message=t.message,e}};k([n()],h.prototype,"type",2);k([n()],h.prototype,"message",2);h=k([l("EndMessageNode")],h);var mt=Object.defineProperty,ut=Object.getOwnPropertyDescriptor,H=(t,e,r,s)=>{for(var o=s>1?void 0:s?ut(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&mt(e,r,o),o},y=class extends m{constructor(t){super(t),this.type="start-node"}createRuntimeNode(){return t=>({question:t.agentExecutionContext.userRequest})}static fromJSON(t){return new y({id:t.id,label:t.label,type:"start-node"})}};H([n()],y.prototype,"type",2);y=H([l("StartNode")],y);function lt(t){switch(t.type){case"agent_node":return d.fromJSON(t);case"end_message_node":return h.fromJSON(t);case"start_node":return y.fromJSON(t);default:throw new Error(`WebAgent node "${t.id}" uses unsupported type "${t.type}".`)}}function ht(t={}){let e=Object.keys(t);if(R(e),e.includes("nodes"))throw new Error("node state cannot define reserved field: nodes.");let r=F(t);return T.Root({...r,nodes:T({reducer:(s,o)=>({...s,...o}),default:()=>({})}),...P()})}function V(t){let e=new Set;for(let s of t)for(let o of Object.keys(s.shape??{}))o!=="nodes"&&e.add(o);let r=Object.fromEntries([...e].map(s=>[s,void 0]));return ht(r)}var v=class t{constructor(e,r,s){this.sourceJSON=e,this.edges=r,this.nodes=s,this._loaded=!1}static fromJSON(e){return new t(e,e.graph.edges.map(r=>p.fromJSON(r)),e.graph.nodes.map(r=>lt(r)))}async load(){return this._loadPromise??=Promise.all(this.nodes.map(async e=>await e.load())).then(()=>{this._loaded=!0}),await this._loadPromise,this}getSchemas(){let e=Object.fromEntries(this._getNodeCompilations().flatMap((r,s)=>{let o=this.nodes[s];return r.schemas?.map(a=>[o.id,a])??[]}));return[c.object({loopCounts:c.record(c.string(),c.number()).optional(),nodes:c.object(e).partial().optional(),question:c.string().optional()})]}generate(){this._assertLoaded(),this._nodeCompilations=void 0;let e=this._getNodeCompilations(),r=V(this.getSchemas()),s=this.nodes.find(i=>i.type==="start-node")?.id,o={},a=[];for(let[i,Z]of this.nodes.entries()){let _=e[i];_&&(_.runtimeNode&&(o[Z.id]=_.runtimeNode),a.push(..._.edges))}return{createGraph:()=>L(o,a,r,{entryNode:s}),workspace:r}}_assertLoaded(){if(!this._loaded)throw new Error("AgenticWorkflowRuntime must be loaded before it can generate a graph.")}_getNodeCompilations(){return this._assertLoaded(),this._nodeCompilations??=this.nodes.map(e=>e.compile({outgoingEdges:this.edges.filter(r=>r.sourceNodeId===e.id)}))}},gt=Object.defineProperty,ft=Object.getOwnPropertyDescriptor,x=(t,e,r,s)=>{for(var o=s>1?void 0:s?ft(e,r):e,a=t.length-1,i;a>=0;a--)(i=t[a])&&(o=(s?i(e,r,o):i(o))||o);return s&&o&&gt(e,r,o),o},wt=()=>{throw new Error("WebAgent must be loaded before it can run.")},g=class extends D{constructor(t){super(t)}async load(){if(this.portalItem){try{await this.portalItem.load()}catch(r){throw new b("web-agent:load-portal-item","Failed to load portal item",{error:r})}let e=await this.portalItem.fetchData();if(this.sourceJSON=e,!this.portalItem.title)throw new b("web-agent:missing-title","The portal item is missing a title")}if(!this.sourceJSON)throw new b("web-agent:missing-source-json","The source JSON is missing");if(!this.sourceJSON.description)throw new b("web-agent:missing-description","The source JSON is missing a description");let t=v.fromJSON(this.sourceJSON);return await t.load(),this._runtime=t,this.description=this.sourceJSON.description,this.name=this.portalItem?.title??`web-agent-${Date.now()}`,this.generate(),this}getSchemas(){return this._runtime?.getSchemas()??[]}generate(){if(!this._runtime){this._set("workspace",V([])),this._set("createGraph",wt);return}let{createGraph:t,workspace:e}=this._runtime.generate();this._set("workspace",e),this._set("createGraph",t)}};x([n({type:W})],g.prototype,"portalItem",2);x([n()],g.prototype,"sourceJSON",2);g=x([l("WebAgent")],g);var j=class extends A{static{this.properties={agent:0,context:0,itemId:1,workflow:0}}#t;async getContext(){return C(this.context)?await this.context():this.context}async load(){let e;if(this.itemId){let r=K.getDefault();e=new g({portalItem:new W({id:this.itemId,portal:r})})}else this.workflow&&(e=new g({sourceJSON:this.workflow}));if(e&&(await e.load(),this.agent=e.registration),!this.agent)throw new Error("Failed to initialize the assistant agent because the agent registration is missing.");this.#t=q(this)}disconnectedCallback(){this.#t?.unregister(this.agent.id),super.disconnectedCallback()}};J("arcgis-assistant-agent",j);return j},"portal/PortalItem","portal/Portal","core/accessorSupport/decorators","core/Error","core/Accessor","identity/IdentityManager","request","config","core/reactiveUtils","layers/FeatureLayer",a,b,d)
@@ -0,0 +1,2 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as c}from"./ONQ6JSBJ.js";import{Dc as d}from"./AI6DYOKR.js";import{a}from"./VXFQANGJ.js";export default $arcgis.t(([i,u,w,{addressToLocations:S},v])=>{async function y(e,s){let r=w.getDefault().helperServices,n=r.geocode.find(g=>g.name==="ArcGIS World Geocoding Service")??r.geocode[0];if(!n)throw new Error("No geocoding service found in helperServices.");let l=n.url,m=`${i.assetsPath?.endsWith("/")?i.assetsPath:`${i.assetsPath}/`}esri/images/search/search-symbol-32.png`,o=(await S(l,{address:{SingleLine:e},outFields:["Match_addr"]}))?.[0];if(!o?.extent||!o.location)throw new Error(`Could not find location for: ${e}`);let h=new v({url:m,width:24,height:24}),p=new u({geometry:o.location,symbol:h});s.graphics.removeAll(),s.graphics.add(p),await s.goTo(o.extent);let t={address:o.address??e,location:o.location.toJSON(),extent:o.extent.toJSON()},f={value:t,sharedStatePatch:{lastResolvedLocation:{value:t}},sharedResourceAdditions:[{kind:"point",description:t.address,payload:t.location}]};return[`Successfully zoomed to ${t.address}.`,f]}async function T({address:e},s){let{mapView:r}=c(s,["mapView"]);return await y(e,r)}var A=a.object({address:a.string().describe("The full address or place name to locate.")}),W=d(T,{name:"goToAddress",description:"Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",schema:A,responseFormat:"content_and_artifact"});return W},"config","Graphic","portal/Portal","rest/locator","symbols/PictureMarkerSymbol")
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,a])=>{return a},a,b)
2
+ import b from"./22KHSDJI.js";import a from"./AKD5UOVX.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,a])=>{return a},a,b)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import i from"./KWD2ECTM.js";import h from"./U2D53TAX.js";import f from"./OAKRPM7D.js";import e from"./V52XWEGV.js";import c from"./D5UFYQHN.js";import{e as R,f as le}from"./G2EGT3CF.js";import{a as de}from"./5WYRJMBW.js";import{a as ue}from"./YEZ3AMNX.js";import a from"./JKIESH74.js";import{a as b,b as T}from"./7VAQUCBU.js";import{Fa as se,Sa as N,g as ne,j as D,k as P,ka as y,y as ie}from"./EWLXNGKH.js";import{Dc as g,S as $,W as B,fa as A}from"./AI6DYOKR.js";import{a as d}from"./VXFQANGJ.js";export default $arcgis.t(([ve,_,Se,,_e,,{createRenderer:Le},{getSchemesByTag:Fe,getSchemes:Qe},{getBackgroundColorTheme:xe},{createAgeRenderer:Ge,createContinuousRenderer:Ve},{getSchemesByTag:re},{createContinuousRenderer:Be},{createRenderer:Ke},{getSchemesByTag:Ue},{createRenderer:He},{getSchemesByTag:Je},{createRenderer:We},{getSchemesByTag:Ze},{createRenderer:Xe},{getSchemesByTag:Ye},{createAgeRenderer:et,createContinuousRenderer:tt},{createRenderer:rt},{getSchemesByTag:ot},at,ke,{fetchKnowledgeGraph:Ee,executeQueryStreaming:nt,executeSearchStreaming:it},st,{getBindParametersFromCypherQuery:lt},pe,{o:ce},fe,ye,me,he])=>{var Te=e=>Array.isArray(e)&&e.every($),De=e=>typeof e=="object"&&e!=null&&"messages"in e&&Te(e.messages),Pe=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,O=class extends se{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(i,s)=>this.run(i,s)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t,r){let o=this.tools.find(a=>a.name===e.name);try{if(o===void 0)throw new Error(`Tool "${e.name}" not found.`);let a={...e,type:"tool_call"},i={...t,state:r,toolCallId:e.id??"",config:t,context:t.context,store:t.store??null,writer:t.writer??t.configurable?.writer??null},s=await o.invoke(a,i);return $(s)&&s.getType()==="tool"||P(s)?s:new B({status:"success",name:o.name,content:typeof s=="string"?s:JSON.stringify(s),tool_call_id:e.id})}catch(a){if(!this.handleToolErrors||ie(a))throw a;return new B({status:"error",content:`Error: ${a.message}
2
+ import i from"./KWD2ECTM.js";import h from"./NNXISHCA.js";import f from"./5K5ZY267.js";import e from"./655YIKL3.js";import c from"./D5UFYQHN.js";import{e as R,f as le}from"./G2EGT3CF.js";import{a as de}from"./5WYRJMBW.js";import{a as ue}from"./YEZ3AMNX.js";import a from"./22KHSDJI.js";import{a as b,b as T}from"./7VAQUCBU.js";import{Fa as se,Sa as N,g as ne,j as D,k as P,ka as y,y as ie}from"./EWLXNGKH.js";import{Dc as g,S as $,W as B,fa as A}from"./AI6DYOKR.js";import{a as d}from"./VXFQANGJ.js";export default $arcgis.t(([ve,_,Se,,_e,,{createRenderer:Le},{getSchemesByTag:Fe,getSchemes:Qe},{getBackgroundColorTheme:xe},{createAgeRenderer:Ge,createContinuousRenderer:Ve},{getSchemesByTag:re},{createContinuousRenderer:Be},{createRenderer:Ke},{getSchemesByTag:Ue},{createRenderer:He},{getSchemesByTag:Je},{createRenderer:We},{getSchemesByTag:Ze},{createRenderer:Xe},{getSchemesByTag:Ye},{createAgeRenderer:et,createContinuousRenderer:tt},{createRenderer:rt},{getSchemesByTag:ot},at,ke,{fetchKnowledgeGraph:Ee,executeQueryStreaming:nt,executeSearchStreaming:it},st,{getBindParametersFromCypherQuery:lt},pe,{o:ce},fe,ye,me,he])=>{var Te=e=>Array.isArray(e)&&e.every($),De=e=>typeof e=="object"&&e!=null&&"messages"in e&&Te(e.messages),Pe=e=>typeof e=="object"&&e!=null&&"lg_tool_call"in e,O=class extends se{tools;handleToolErrors=!0;trace=!1;constructor(e,t){let{name:r,tags:o,handleToolErrors:a}=t??{};super({name:r,tags:o,func:(i,s)=>this.run(i,s)}),this.tools=e,this.handleToolErrors=a??this.handleToolErrors}async runTool(e,t,r){let o=this.tools.find(a=>a.name===e.name);try{if(o===void 0)throw new Error(`Tool "${e.name}" not found.`);let a={...e,type:"tool_call"},i={...t,state:r,toolCallId:e.id??"",config:t,context:t.context,store:t.store??null,writer:t.writer??t.configurable?.writer??null},s=await o.invoke(a,i);return $(s)&&s.getType()==="tool"||P(s)?s:new B({status:"success",name:o.name,content:typeof s=="string"?s:JSON.stringify(s),tool_call_id:e.id})}catch(a){if(!this.handleToolErrors||ie(a))throw a;return new B({status:"error",content:`Error: ${a.message}
3
3
  Please fix your mistakes.`,name:e.name,tool_call_id:e.id??""})}}async run(e,t){let r;if(Pe(e)){let{lg_tool_call:i,...s}=e;r=[await this.runTool(i,t,s)]}else{let i;if(Te(e))i=e;else if(De(e))i=e.messages;else throw new Error("ToolNode only accepts BaseMessage[] or { messages: BaseMessage[] } as input.");let s=new Set(i.filter(c=>c.getType()==="tool").map(c=>c.tool_call_id)),n;for(let c=i.length-1;c>=0;c-=1){let l=i[c];if(A(l)){n=l;break}}if(n==null||!A(n))throw new Error("ToolNode only accepts AIMessages as input.");r=await Promise.all(n.tool_calls?.filter(c=>c.id==null||!s.has(c.id)).map(c=>this.runTool(c,t,e))??[])}if(!r.some(P))return Array.isArray(e)?r:{messages:r};let o=[],a=null;for(let i of r)P(i)?i.graph===D.PARENT&&Array.isArray(i.goto)&&i.goto.every(s=>ne(s))?a?a.goto.push(...i.goto):a=new D({graph:D.PARENT,goto:i.goto}):o.push(i):o.push(Array.isArray(e)?[i]:{messages:[i]});return a&&o.push(a),o}};var zo=y.Root({llmInputMessages:y({reducer:(e,t)=>N([],t),default:()=>[]})});var I=(e,t)=>t??e,Fa=y.Root({...le(),intent:y({reducer:I}),vectorSearchLayerResults:y({reducer:I,default:()=>[]}),vectorSearchFieldResults:y({reducer:I}),navigationInternalState:y({reducer:I,default:()=>({toolCallMessage:void 0})})}),Me=Object.assign({"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md":()=>import("./J6A4AS7E.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md":()=>import("./TPULIO6I.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_cypher_query_prompt.md":()=>import("./IHP25JWI.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md":()=>import("./CEKOEHB3.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md":()=>import("./VAXH6RUQ.js").then(e=>e.default),"../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md":()=>import("./AOVJ34QE.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_filter_prompt.md":()=>import("./PQ2DPOFM.js").then(e=>e.default),"../agents/dataExploration/prompts/data_explore_query_prompt.md":()=>import("./SDWWUWAF.js").then(e=>e.default),"../agents/dataExploration/prompts/summarize_query_response_prompt.md":()=>import("./FYZATVB3.js").then(e=>e.default),"../agents/help/prompts/help_prompt.md":()=>import("./NEV6OZN3.js").then(e=>e.default),"../agents/layerStyling/prompts/layer_styling_prompt.md":()=>import("./ICBIUFK7.js").then(e=>e.default),"../agents/navigation/prompts/navigation_intent_prompt.md":()=>import("./JEBRN3EU.js").then(e=>e.default),"../agents/navigation/prompts/navigation_tool_prompt.md":()=>import("./UHEYPSOR.js").then(e=>e.default)});async function F(e){let t=Object.entries(Me).find(([r])=>r.endsWith(`/${e}.md`));if(!t)throw new Error(`Prompt not found: ${e}
4
4
  Available prompts:
5
5
  ${Object.keys(Me).join(`
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./V52XWEGV.js";import b from"./CCC6LBMY.js";import"./34O57OGV.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
2
+ import c from"./655YIKL3.js";import b from"./CCC6LBMY.js";import"./34O57OGV.js";import a from"./AKD5UOVX.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,a])=>{return a},a,b,c)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import p from"./6KN5LUAV.js";import n from"./SZ2QSSB3.js";import m from"./MX7OEO5Z.js";import{a as o,c as s}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,m])=>{var t=class extends i{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-navigation-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-navigation-agent"),this.#i=s(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-navigation-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n,p)
2
+ import p from"./TMVF2W5N.js";import n from"./SZ2QSSB3.js";import m from"./FXP5UIQU.js";import{a as o,c as s}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./NNXISHCA.js";import h from"./5K5ZY267.js";import g from"./655YIKL3.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./C4JT4S5E.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./22KHSDJI.js";import a from"./AKD5UOVX.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,m])=>{var t=class extends i{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-navigation-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-navigation-agent"),this.#i=s(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-navigation-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n,p)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import c from"./SZ2QSSB3.js";import b from"./MX7OEO5Z.js";import{a as g}from"./FDOMMK2M.js";import a from"./D5UFYQHN.js";import{a as s}from"./7VAQUCBU.js";import{Ya as S,a as u,b as p,s as f}from"./EWLXNGKH.js";export default $arcgis.t(([,,,,,,{p:x},{a:w,c:E,e:I,j:v,k:L,l:F,m:$,n:C,o:N,p:R,q:T,r:b,s:A,t:_,u:h},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await s({text:"Similarity search to find fields"},t);let e=g(t,"fieldSearch"),n=g(t,"layersAndFieldsRegistry"),o=g(t,"embeddingCache"),r=await e.searchFields({text:a.agentExecutionContext.assignedTask,layerIds:a.vectorSearchLayerIds,minScore:V,topResults:z,embeddingCache:o}),m=r.map(({layerId:d,results:c})=>{let y=c.map(i=>` - ${i.name} (${i.score.toFixed(2)})`).join(`
2
+ import c from"./SZ2QSSB3.js";import b from"./FXP5UIQU.js";import{a as g}from"./FDOMMK2M.js";import a from"./D5UFYQHN.js";import{a as s}from"./7VAQUCBU.js";import{Ya as S,a as u,b as p,s as f}from"./EWLXNGKH.js";export default $arcgis.t(([,,,,,,{p:x},{a:w,c:E,e:I,j:v,k:L,l:F,m:$,n:C,o:N,p:R,q:T,r:b,s:A,t:_,u:h},q])=>{var V=.7,z=10,D=async(a,t)=>{try{await s({text:"Similarity search to find fields"},t);let e=g(t,"fieldSearch"),n=g(t,"layersAndFieldsRegistry"),o=g(t,"embeddingCache"),r=await e.searchFields({text:a.agentExecutionContext.assignedTask,layerIds:a.vectorSearchLayerIds,minScore:V,topResults:z,embeddingCache:o}),m=r.map(({layerId:d,results:c})=>{let y=c.map(i=>` - ${i.name} (${i.score.toFixed(2)})`).join(`
3
3
  `);return`${n.get(d)?.layerItem.name??d}:
4
4
  ${y}`}).join(`
5
5
  `),l;return r.length>0?l=`Vector search completed. Matching layers and fields with scores:
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import b from"./MX7OEO5Z.js";import a from"./D5UFYQHN.js";import{a as c,b as k}from"./7VAQUCBU.js";import{Ya as x,a as w,b as d,j as f}from"./EWLXNGKH.js";import{ea as u}from"./AI6DYOKR.js";export default $arcgis.t(([,,,,,,{n:_,p:b},{A:M,B:T,C:E,D:C,E:G,F:N,G:R,a:v,c:m,d:h,e:A,w:y,x:K,y:q,z:S}])=>{var z=[T,E,N,C,M,R,G];async function $(e,a){let s=await m("arcgis_knowledge_tool_prompt"),o=K(a),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:o},r=await b({promptText:s,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:z,config:a}),i=(r.tool_calls?.length??0)>0,t=typeof r.text=="string"?r.text.trim():"",l=t.length>0,p=r.content.toString();return!i&&(o==="map"||o==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:o==="map"?"No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries.":"No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",status:"success"}:{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:i?p:t,status:i?e.status:l?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var L={generateCypher:"generated-cypher-query",queryGraphData:"graph-query-result",searchGraphData:"graph-search-result",addRecords:"added-records",applyLayout:"applied-layout",changeNonspatialVisibility:"changed-nonspatial-visibility",createLinkChart:"created-link-chart"};function I(e){return!!e&&e.status==="success"&&!!L[e.toolName]}function D(e){return{type:L[e.toolName],data:e.details}}async function F(e,a){let s=new v(z,{handleToolErrors:!1});try{let o=await s.invoke({messages:e.arcgisKnowledgeMessages},a),n=[];for(let t of o.messages){let l;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{l=JSON.parse(t.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name??"unknown"}.
2
+ import b from"./FXP5UIQU.js";import a from"./D5UFYQHN.js";import{a as c,b as k}from"./7VAQUCBU.js";import{Ya as x,a as w,b as d,j as f}from"./EWLXNGKH.js";import{ea as u}from"./AI6DYOKR.js";export default $arcgis.t(([,,,,,,{n:_,p:b},{A:M,B:T,C:E,D:C,E:G,F:N,G:R,a:v,c:m,d:h,e:A,w:y,x:K,y:q,z:S}])=>{var z=[T,E,N,C,M,R,G];async function $(e,a){let s=await m("arcgis_knowledge_tool_prompt"),o=K(a),n={assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps,contextType:o},r=await b({promptText:s,messages:e.arcgisKnowledgeMessages,inputVariables:n,tools:z,config:a}),i=(r.tool_calls?.length??0)>0,t=typeof r.text=="string"?r.text.trim():"",l=t.length>0,p=r.content.toString();return!i&&(o==="map"||o==="knowledgeGraph")?{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:o==="map"?"No tools were found for the current view and prompt. Maps do not support changing nonspatial visibility, layout changes, or generation from queries.":"No tools were found for the current prompt and knowledge graph service. A knowledge graph service only supports search and query.",status:"success"}:{...e,arcgisKnowledgeMessages:[...e.arcgisKnowledgeMessages,r],outputMessage:i?p:t,status:i?e.status:l?"success":"failed",summary:p?h(p):"ArcGIS Knowledge Agent tool executed."}}var L={generateCypher:"generated-cypher-query",queryGraphData:"graph-query-result",searchGraphData:"graph-search-result",addRecords:"added-records",applyLayout:"applied-layout",changeNonspatialVisibility:"changed-nonspatial-visibility",createLinkChart:"created-link-chart"};function I(e){return!!e&&e.status==="success"&&!!L[e.toolName]}function D(e){return{type:L[e.toolName],data:e.details}}async function F(e,a){let s=new v(z,{handleToolErrors:!1});try{let o=await s.invoke({messages:e.arcgisKnowledgeMessages},a),n=[];for(let t of o.messages){let l;if(typeof t.content!="string")throw new Error(`Unexpected tool message content type: ${typeof t.content}. Expected string.`);try{l=JSON.parse(t.content)}catch{throw new Error(`Failed to parse tool message content as JSON. Tool: ${t.name??"unknown"}.
3
3
 
4
4
  Original Content: ${t.content}`)}if(!l||typeof l!="object"||!("toolName"in l))throw new Error(`Parsed tool message content does not have expected structure. Parsed content: ${JSON.stringify(l)}`);n.push(l)}await c({text:`Finished executing ArcGIS Knowledge Agent tools: ${o.messages.filter(t=>t.name).map(t=>t.name).join(", ")}`},a);let r=n.filter(t=>typeof t!="string").map(t=>`- Called Tool: ${t.toolName}, Status: ${t.status}`),i=n[0];return i&&I(i)&&await k(D(i),a),{...e,outputMessage:r.join(`
5
5
  `),summary:r.length?h(r.join(`
@@ -0,0 +1,14 @@
1
+ /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
+ import{a as E,b as I}from"./34O57OGV.js";import{a as R}from"./FDOMMK2M.js";import a from"./AKD5UOVX.js";import{a as F}from"./ONQ6JSBJ.js";import{Dc as S}from"./AI6DYOKR.js";import{a as e}from"./VXFQANGJ.js";export default $arcgis.t(([A,D,W,{a:L,b:v,c:N,d:T,e:q,f:O}])=>{var C=async p=>{let{targetLayer:a,fieldName:n,statisticType:l,mapView:i,layersAndFieldsRegistry:h,geometryFilter:t}=p,s=i.map?.allLayers.find(r=>r.id===a.layerId);if(!s)throw new Error(`Layer '${a.layerId}' not found.`);let w=await i.whenLayerView(s),o=h.get(a.layerId)?.fieldRegistry.get(n),x=o?.alias;if(!o)throw new Error(`Field '${n}' not found.`);let b,c;if(t){let r=await N(t,i);if("error"in r)throw new Error(r.error);if(!r.geometry)throw v(t)?new Error(`No features found matching: ${t.where}`):new Error("Failed to create geometry");if(v(t)){let g=i.map?.allLayers.find(f=>f.id===t.layerId);b={geometryLayerName:g?.title??g?.id,geometryLayerId:t.layerId,geometryWhere:t.where,distance:t.distance,units:t.units,applied:!0}}else L(t)&&(b={point:t.point,distance:t.distance,units:t.units,applied:!0});c=new W({geometry:r.geometry,distance:t.distance,units:t.units,spatialRelationship:"intersects"})}let y=E(w,[n],!1),u=null,m=null,V=10;if(o.type!=="geometry"&&o.type!=="oid"&&o.type!=="global-id")try{let r={layer:s,useFeaturesInView:y,view:y?i:void 0,field:n,sqlWhere:I(s.definitionExpression,a.where),...c&&{filter:c},outStatisticTypes:{include:[l]}};u=await A(r);let g=["string","small-integer","integer"],f=o.domain?.type==="coded-value"?o.domain:null;(g.includes(o.type)||f)&&(m=(await D({layer:s,useFeaturesInView:y,view:y?i:void 0,field:n,sqlWhere:I(s.definitionExpression,a.where),...c&&{filter:c}})).uniqueValueInfos.sort((d,j)=>j.count-d.count).slice(0,V)),m&&o.domain?.type==="coded-value"&&(m=m.map(d=>({...d,value:f?f.getName(d.value)??d.value:d.value})))}catch(r){console.error("Statistics error:",r)}return{tool:"getStatistics",layerName:s.title??a.layerId,summary:`${l} = ${typeof u?.[l]=="number"?u[l]:"N/A"}`,details:{fieldName:n,fieldAlias:x,statisticType:l,statistic:u?.[l]??null,summaryStatistics:u,uniqueValues:m,where:a.where,spatialFilterInfo:b}}};async function U({targetLayer:p,fieldName:a,statisticType:n,geometryFilter:l},i){let h=R(i,"layersAndFieldsRegistry"),{mapView:t}=F(i,["mapView"]),s=O(l,i.state?.agentExecutionContext?.sharedResources),w=await C({targetLayer:p,fieldName:a,statisticType:n,mapView:t,layersAndFieldsRegistry:h,geometryFilter:s});return JSON.stringify(w,null,2)}var $=e.object({layerId:e.string().describe("The layerId of the layer containing the geometry by which to filter."),where:e.string().describe("The SQL-92 where clause representing the features from which to filter."),distance:e.number().optional().describe("The buffer distance around the geometry."),units:T.optional().describe("The units for the distance buffer.")}),G=e.object({point:e.object({x:e.number().describe("X coordinate (longitude) from navigation result"),y:e.number().describe("Y coordinate (latitude) from navigation result"),spatialReference:e.object({wkid:e.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")}).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")}).describe("Point coordinates from a previous navigation/geocoding result"),distance:e.number().optional().describe("Optional buffer distance around the point."),units:T.optional().describe("The units for the distance buffer.")}),Q=e.object({targetLayer:e.object({layerId:e.string().describe("The layerId of the layer containing the field from which to get a value."),where:e.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")}),geometryFilter:e.union([$,G,q]).optional().describe("Geometry filter for spatial queries. Use 'sharedResourceId' with an ID from listSharedResources for a previously geocoded location. Use 'point' for inline coordinates or 'layerId/where' for features from another layer."),fieldName:e.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),statisticType:e.enum(["avg","max","median","min","stddev","sum","variance","nullcount","count"]).describe("The statistic type to calculate.")}),_=S(U,{name:"getStatistics",description:`Computes a single aggregate statistic (max, min, avg, sum, median, stddev, variance) for a numeric field across matching features. Also returns frequency analysis for categorical fields.
3
+
4
+ USE THIS TOOL FOR:
5
+ - "What is the average/maximum/minimum/total [field]?" \u2014 aggregate computations
6
+ - "Most common/frequent value of [field]?" \u2014 frequency analysis
7
+ - Questions requiring a mathematical aggregation across many features
8
+
9
+ DO NOT USE FOR:
10
+ - "How many features match X?" \u2014 use queryFeatures instead (it returns totalCount)
11
+ - "Show / list / find features" \u2014 use queryFeatures instead
12
+ - Simple counts of features matching a condition \u2014 use queryFeatures instead
13
+
14
+ Only call this tool when the answer requires computing an aggregate (avg, max, min, sum, median, stddev) over a field's values, not just counting or listing features.`,schema:Q});return _},"smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","layers/support/FeatureFilter",a)
@@ -1,5 +1,5 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import d from"./SZ2QSSB3.js";import b from"./MX7OEO5Z.js";import{a as h}from"./7SRLZQVC.js";import{a as m}from"./FDOMMK2M.js";import a from"./D5UFYQHN.js";import{a as p}from"./7VAQUCBU.js";import{Ya as c,a as u,b as n}from"./EWLXNGKH.js";export default $arcgis.t(([,,,,,,{p:g},{a:f,c:y,d:x,e:E,v:d},S])=>{var _=[h],v=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:r,fieldRegistry:s},o)=>{let a=Array.from(s.values()).map(i=>i.name).slice(0,10).join(", "),l=s.size>10?` (and ${s.size-10} more)`:"";return`${o+1}. "${r.title}". Description: ${r.description}
2
+ import d from"./SZ2QSSB3.js";import b from"./FXP5UIQU.js";import{a as h}from"./7SRLZQVC.js";import{a as m}from"./FDOMMK2M.js";import a from"./D5UFYQHN.js";import{a as p}from"./7VAQUCBU.js";import{Ya as c,a as u,b as n}from"./EWLXNGKH.js";export default $arcgis.t(([,,,,,,{p:g},{a:f,c:y,d:x,e:E,v:d},S])=>{var _=[h],v=e=>{if(!e||e.size===0)return"No layers available in this map.";let t=Array.from(e.values()).map(({layerItem:r,fieldRegistry:s},o)=>{let a=Array.from(s.values()).map(i=>i.name).slice(0,10).join(", "),l=s.size>10?` (and ${s.size-10} more)`:"";return`${o+1}. "${r.title}". Description: ${r.description}
3
3
  Fields: ${a}${l}`}).join(`
4
4
 
5
5
  `);return`This map contains ${e.size} layer(s):
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import a from"./6HF36IKA.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([a])=>{return a},a)
2
+ import a from"./C4JT4S5E.js";import"./ONQ6JSBJ.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([a])=>{return a},a)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import s from"./IC3LG6TH.js";import q from"./SZ2QSSB3.js";import p from"./MX7OEO5Z.js";import{a as o,c as a}from"./V6HOUZPZ.js";import n from"./KITIP6J2.js";import"./Z5W4V7RC.js";import m from"./RHYNE5OE.js";import l from"./KWD2ECTM.js";import k from"./U2D53TAX.js";import j from"./OAKRPM7D.js";import h from"./V52XWEGV.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import e from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import d from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import c from"./JKIESH74.js";import b from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,s])=>{var t=class extends i{constructor(){super(...arguments),this.agent=s}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-data-exploration-agent"),this.#i=a(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-data-exploration-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","rest/knowledgeGraphService",b,c,d,e,f,g,h,j,k,l,m,n,p,q,s)
2
+ import s from"./UHNVDALX.js";import q from"./SZ2QSSB3.js";import p from"./FXP5UIQU.js";import{a as o,c as a}from"./V6HOUZPZ.js";import n from"./KITIP6J2.js";import"./Z5W4V7RC.js";import m from"./RHYNE5OE.js";import l from"./KWD2ECTM.js";import k from"./NNXISHCA.js";import j from"./5K5ZY267.js";import h from"./655YIKL3.js";import g from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./C4JT4S5E.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import e from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import d from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import c from"./22KHSDJI.js";import b from"./AKD5UOVX.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,s])=>{var t=class extends i{constructor(){super(...arguments),this.agent=s}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-data-exploration-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-data-exploration-agent"),this.#i=a(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-data-exploration-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","rest/knowledgeGraphService",b,c,d,e,f,g,h,j,k,l,m,n,p,q,s)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import w from"./UAANWCMU.js";import v from"./ASR3I43T.js";import t from"./6KN5LUAV.js";import s from"./IC3LG6TH.js";import r from"./LNCT4S4I.js";import q from"./SZ2QSSB3.js";import p from"./MX7OEO5Z.js";import o from"./KITIP6J2.js";import"./Z5W4V7RC.js";import n from"./RHYNE5OE.js";import m from"./KWD2ECTM.js";import l from"./U2D53TAX.js";import k from"./OAKRPM7D.js";import j from"./V52XWEGV.js";import i from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import e from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import d from"./JCOA24UH.js";import c from"./D5UFYQHN.js";import{e as g,f as h}from"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import"./R74ZHFA6.js";import{a as y,b as u}from"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([C,I,,,{d:w,g:v,h:A,i:b,j:S,k:d,l:f,m:M,n:E,o:P,p:T,q:x,r:D},{a:p,b:V},,,,,,,,,,,,W,R,O,L,k])=>{var U=async e=>{let a=e.allLayers.toArray(),o=[],r=new Map;for(let t of a)if(t instanceof C){let i=(async()=>{let n=await x(t),s=await D(t,n);r.set(t.id,{layerItem:s,fieldRegistry:n})})();o.push(i)}return await Promise.all(o),r},q=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:o}=await z(a),r={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:b,model:S,dimensions:A,templates:{layer:d,field:f}},layers:o},t=M.safeParse(r);if(!t.success)throw console.error("Schema Mismatch:",t.error.format()),new Error("Webmap embedding generation failed validation.");return t.data},z=async e=>{let a=[],o=[];for(let[i,{fieldRegistry:n,layerItem:s}]of e.entries()){let l=H(d,{name:s.name,title:s.title,description:s.description});a.push(l);let m={id:i,name:s.name??"",title:s.title,description:s.description,vector:[],fields:[]};for(let[,c]of n.entries()){let N=H(f,{name:c.name,alias:c.alias,description:c.description});a.push(N),m.fields.push({name:c.name,alias:c.alias,description:c.description,vector:[]})}o.push(m)}let r=await p(a),t=0;return{layers:o.map(i=>(i.vector=r[t++],i.fields.forEach(n=>{n.vector=r[t++]}),i))}},H=(e,a)=>e.replace(/\{(\w+)\}/gu,(o,r)=>a[r]??""),F=(e,a)=>{if(e.length!==a.length)throw new Error("Vectors must be the same length");let o=0,r=0,t=0;for(let s=0;s<e.length;++s){let l=e[s],m=a[s];o+=l*m,r+=l*l,t+=m*m}let i=Math.sqrt(r*t);if(i===0)return 0;let n=o/i;return Math.max(-1,Math.min(1,n))},ee=E,ae=P,te=T,se=y,re=p,oe=F,ie=O,ne=L,me=R,ce=W,le=k,de=q,fe=()=>g(),pe=()=>h(),ge=async(e,a)=>await u(e,a),he=async({modelTier:e="default",config:a}={})=>await w({modelTier:e,config:a});return{ArcgisKnowledgeAgent:le,DataExplorationAgent:me,HelpAgent:ce,LayerStylingAgent:ne,NavigationAgent:ie,Orchestrator:V,cosineSimilarity:oe,createAgentRuntimeState:fe,createAgentRuntimeStateWithSharedState:pe,createChatModel:he,createWebmapEmbeddings:de,getEmbeddings:re,invokeStructuredPrompt:ae,invokeTextPrompt:ee,invokeToolPrompt:te,sendTraceMessage:se,sendUXSuggestion:ge}},"layers/FeatureLayer","core/reactiveUtils",a,b,c,d,e,f,i,j,k,l,m,n,o,p,q,r,s,t,v,w)
2
+ import w from"./LAYVGCPL.js";import v from"./IJVMUS2L.js";import t from"./TMVF2W5N.js";import s from"./UHNVDALX.js";import r from"./OX64WOEL.js";import q from"./SZ2QSSB3.js";import p from"./FXP5UIQU.js";import o from"./KITIP6J2.js";import"./Z5W4V7RC.js";import n from"./RHYNE5OE.js";import m from"./KWD2ECTM.js";import l from"./NNXISHCA.js";import k from"./5K5ZY267.js";import j from"./655YIKL3.js";import i from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import f from"./C4JT4S5E.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import e from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import d from"./JCOA24UH.js";import c from"./D5UFYQHN.js";import{e as g,f as h}from"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./22KHSDJI.js";import a from"./AKD5UOVX.js";import"./ONQ6JSBJ.js";import"./R74ZHFA6.js";import{a as y,b as u}from"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([C,I,,,{d:w,g:v,h:A,i:b,j:S,k:d,l:f,m:M,n:E,o:P,p:T,q:x,r:D},{a:p,b:V},,,,,,,,,,,,W,R,O,L,k])=>{var U=async e=>{let a=e.allLayers.toArray(),o=[],r=new Map;for(let t of a)if(t instanceof C){let i=(async()=>{let n=await x(t),s=await D(t,n);r.set(t.id,{layerItem:s,fieldRegistry:n})})();o.push(i)}return await Promise.all(o),r},q=async e=>{await I.whenOnce(()=>e.ready);let a=await U(e.map),{layers:o}=await z(a),r={schemaVersion:v,modified:Date.now(),embeddings:{modelProvider:b,model:S,dimensions:A,templates:{layer:d,field:f}},layers:o},t=M.safeParse(r);if(!t.success)throw console.error("Schema Mismatch:",t.error.format()),new Error("Webmap embedding generation failed validation.");return t.data},z=async e=>{let a=[],o=[];for(let[i,{fieldRegistry:n,layerItem:s}]of e.entries()){let l=H(d,{name:s.name,title:s.title,description:s.description});a.push(l);let m={id:i,name:s.name??"",title:s.title,description:s.description,vector:[],fields:[]};for(let[,c]of n.entries()){let N=H(f,{name:c.name,alias:c.alias,description:c.description});a.push(N),m.fields.push({name:c.name,alias:c.alias,description:c.description,vector:[]})}o.push(m)}let r=await p(a),t=0;return{layers:o.map(i=>(i.vector=r[t++],i.fields.forEach(n=>{n.vector=r[t++]}),i))}},H=(e,a)=>e.replace(/\{(\w+)\}/gu,(o,r)=>a[r]??""),F=(e,a)=>{if(e.length!==a.length)throw new Error("Vectors must be the same length");let o=0,r=0,t=0;for(let s=0;s<e.length;++s){let l=e[s],m=a[s];o+=l*m,r+=l*l,t+=m*m}let i=Math.sqrt(r*t);if(i===0)return 0;let n=o/i;return Math.max(-1,Math.min(1,n))},ee=E,ae=P,te=T,se=y,re=p,oe=F,ie=O,ne=L,me=R,ce=W,le=k,de=q,fe=()=>g(),pe=()=>h(),ge=async(e,a)=>await u(e,a),he=async({modelTier:e="default",config:a}={})=>await w({modelTier:e,config:a});return{ArcgisKnowledgeAgent:le,DataExplorationAgent:me,HelpAgent:ce,LayerStylingAgent:ne,NavigationAgent:ie,Orchestrator:V,cosineSimilarity:oe,createAgentRuntimeState:fe,createAgentRuntimeStateWithSharedState:pe,createChatModel:he,createWebmapEmbeddings:de,getEmbeddings:re,invokeStructuredPrompt:ae,invokeTextPrompt:ee,invokeToolPrompt:te,sendTraceMessage:se,sendUXSuggestion:ge}},"layers/FeatureLayer","core/reactiveUtils",a,b,c,d,e,f,i,j,k,l,m,n,o,p,q,r,s,t,v,w)
@@ -1,2 +1,2 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import q from"./LNCT4S4I.js";import n from"./SZ2QSSB3.js";import m from"./MX7OEO5Z.js";import{a as o,c as p}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./U2D53TAX.js";import h from"./OAKRPM7D.js";import g from"./V52XWEGV.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./6HF36IKA.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./JKIESH74.js";import a from"./QNNGPA3Q.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,m])=>{var t=class extends i{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-help-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-help-agent"),this.#i=p(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-help-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n,q)
2
+ import q from"./OX64WOEL.js";import n from"./SZ2QSSB3.js";import m from"./FXP5UIQU.js";import{a as o,c as p}from"./V6HOUZPZ.js";import l from"./KITIP6J2.js";import"./Z5W4V7RC.js";import k from"./KWD2ECTM.js";import j from"./NNXISHCA.js";import h from"./5K5ZY267.js";import g from"./655YIKL3.js";import f from"./CCC6LBMY.js";import"./34O57OGV.js";import"./7SRLZQVC.js";import"./FDOMMK2M.js";import e from"./C4JT4S5E.js";import"./Y7XD7ZRD.js";import"./VLLZ2FFU.js";import d from"./5ZFUGNRN.js";import"./LLUGJKAQ.js";import"./WKTQVBFJ.js";import"./K2R6XVK3.js";import"./3UEKINYC.js";import"./RLEHNAIA.js";import c from"./D5UFYQHN.js";import"./G2EGT3CF.js";import"./5WYRJMBW.js";import"./YEZ3AMNX.js";import b from"./22KHSDJI.js";import a from"./AKD5UOVX.js";import"./ONQ6JSBJ.js";import{v as i,z as r}from"./COH3QXWG.js";import"./R74ZHFA6.js";import"./7VAQUCBU.js";import"./VOKXKU7M.js";import"./EWLXNGKH.js";import"./AI6DYOKR.js";import"./VXFQANGJ.js";import"./MWYBF3F3.js";import"./UZLQALHY.js";export default $arcgis.t(([,,,,,,,,,,,,,,,,,,,,,,,m])=>{var t=class extends i{constructor(){super(...arguments),this.agent=m}static{this.properties={referenceElement:1}}#t;#i;getContext(){if(!this.#t)throw new Error("arcgis-assistant-help-agent requires a mapView");return{mapView:this.#t}}load(){this.#t=o(this,"arcgis-assistant-help-agent"),this.#i=p(this)}disconnectedCallback(){this.#i?.unregister(this.agent.id),super.disconnectedCallback()}};r("arcgis-assistant-help-agent",t);return t},"identity/IdentityManager","portal/Portal","request","config","core/reactiveUtils","layers/FeatureLayer","intl","smartMapping/statistics/summaryStatistics","smartMapping/statistics/uniqueValues","rest/knowledgeGraphService",a,b,c,d,e,f,g,h,j,k,l,m,n,q)
@@ -1,20 +1,20 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
2
- import f from"./SZ2QSSB3.js";import e from"./MX7OEO5Z.js";import d from"./KITIP6J2.js";import{a as Z}from"./Z5W4V7RC.js";import{a as h}from"./FDOMMK2M.js";import c from"./6HF36IKA.js";import{a as F}from"./Y7XD7ZRD.js";import{a as C}from"./VLLZ2FFU.js";import b from"./5ZFUGNRN.js";import{a as R}from"./LLUGJKAQ.js";import{a as _}from"./WKTQVBFJ.js";import{a as I}from"./K2R6XVK3.js";import a from"./D5UFYQHN.js";import{a as x}from"./ONQ6JSBJ.js";import{a as g}from"./7VAQUCBU.js";import{Ya as E,a as w,b as k}from"./EWLXNGKH.js";import{a as y}from"./VXFQANGJ.js";export default $arcgis.t(([,,,,,,{o:$,p:N},L,b,M,{a:A,b:v,c:S,d:q,e:V},j])=>{var T=[b,F,C,L,R,_,I,M,Z];async function B(e,t){let a=await S("navigation_tool_prompt"),{mapView:s}=x(t,["mapView"]),c=s.map.bookmarks?.map(p=>p.name).filter(Boolean)??[],i=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((p,G)=>`${G+1}. layerId=${p.id} | title=${p.title??""} | name=${p.name??""} | score=${p.score.toFixed(2)}`).join(`
3
- `):"",l=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",n=e.intent==="goToBookmark"&&c.length?`Available bookmarks:
4
- ${c.map(p=>`- ${p}`).join(`
5
- `)}`:"",o=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
6
- ${i}`:"",m=e.intent==="goToFeatures"&&e.vectorSearchFieldResults?.length?`Candidate fields:
7
- ${l}`:"",u={intent:e.intent,bookmarksSection:n,layersSection:o,fieldsSection:m,currentZoom:s.zoom,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},r=await N({promptText:a,modelTier:"fast",config:t,inputVariables:u,tools:T});await j(r,t);let d=(r.tool_calls?.length??0)>0,f=typeof r.text=="string"?r.text.trim():"",z=f.length>0;return{...e,navigationInternalState:{...e.navigationInternalState,toolCallMessage:d?r:void 0},outputMessage:d?e.outputMessage:f,status:d?e.status:z?"success":"failed"}}var D=e=>{let t=typeof e=="string"?e:String(e);try{let a=JSON.parse(t);if(a&&typeof a=="object"&&typeof a.text=="string")return a}catch{console.warn("Failed to parse tool response as JSON:",t)}return{text:t}};async function J(e,t){let a=new A(T,{handleToolErrors:!1});try{let s=e.navigationInternalState.toolCallMessage;if(!s)throw new Error("navigationToolCalling: missing navigationInternalState.toolCallMessage");let{messages:c}=await a.invoke({messages:[s]},t),i="",l;for(let n of c){let o=D(n.content);o.text&&(i+=`${o.text}
8
- `),o.sharedStatePatch&&(l={...l,...o.sharedStatePatch})}return await g({text:`Finished executing navigation tool: ${i}`},t),{...e,outputMessage:i,sharedStatePatch:l,status:"success",summary:i?q(i):"Navigation executed.",navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}catch(s){let c=s instanceof Error?s.message:String(s);return await g({text:`Navigation tool execution failed: ${c}`},t),{...e,outputMessage:`Navigation tool execution failed: ${c}`,status:"failed",summary:`Navigation tool execution failed: ${c}`,navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}}async function P(e,t){let a=await S("navigation_intent_prompt"),{mapView:s}=x(t,["mapView"]),c=T.map(r=>({name:r.name,description:r.description,schema:r.schema})),i=s.map.bookmarks?.map(r=>r.name).filter(Boolean)??[],l=i.length?`Available bookmarks:
9
- ${i.map(r=>`- ${r}`).join(`
10
- `)}`:"No bookmarks are available in this map.",n={tools:c.map(({name:r,description:d,schema:f})=>`${r}: ${d}, ${JSON.stringify(f)}`).join(`
11
- `),bookmarks:l,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=y.object({intent:y.string()}),m=await $({promptText:a,config:t,inputVariables:n,schema:o,modelTier:"fast"}),u=typeof m.intent=="string"?m.intent.trim().replace(/^"|"$/gu,""):"";return{...e,intent:u||""}}var H=.7,W=async(e,t)=>{try{await g({text:`Similarity search to find layers: ${e.agentExecutionContext.assignedTask}`},t);let a=h(t,"layerSearch"),s=h(t,"layersAndFieldsRegistry"),c=h(t,"embeddingCache"),i=(await a.searchLayers({text:e.agentExecutionContext.assignedTask,minScore:H,embeddingCache:c})).map(({id:n,score:o})=>{let m=s.get(n)?.layerItem;return{id:n,title:m?.title,name:m?.name??void 0,score:o}}),l;return i.length>0?l=`Vector search completed. Matching layers:
12
- ${i.map(n=>`- layerId=${n.id} | title=${n.title??""} | name=${n.name??""} | score=${n.score.toFixed(2)}`).join(`
13
- `)}`:l="Vector search completed. No matching layers found.",await g({text:l},t),{...e,vectorSearchLayerResults:i}}catch(a){throw await g({text:`Error during vector search layers: ${a instanceof Error?a.message:String(a)}`},t),a}},O=.7,K=10,Q=async(e,t)=>{try{await g({text:`Similarity search to find fields: ${e.agentExecutionContext.assignedTask}`},t);let a=h(t,"fieldSearch"),s=h(t,"layersAndFieldsRegistry"),c=h(t,"embeddingCache"),i=e.vectorSearchLayerResults?.map(o=>o.id)??[];if(i.length===0)return await g({text:"No candidate layers for field search"},t),e;let l=(await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:i,minScore:O,topResults:K,embeddingCache:c})).map(({layerId:o,results:m})=>{let u=s.get(o)?.fieldRegistry;return{layerId:o,layerName:s.get(o)?.layerItem.name,results:m.map(r=>{let d=u?.get(r.name);return{name:r.name,score:r.score,type:d?.type,alias:d?.alias,description:d?.description,statistics:d?.statistics,domain:d?.domain}})}}),n;return l.length>0?n=`Vector search completed. Matching layers and fields:
14
- ${l.map(o=>`${o.layerName??o.layerId}:
15
- ${o.results.map(m=>` - ${m.name} (${m.score.toFixed(2)})`).join(`
2
+ import f from"./SZ2QSSB3.js";import e from"./FXP5UIQU.js";import d from"./KITIP6J2.js";import{a as M}from"./Z5W4V7RC.js";import{a as u}from"./FDOMMK2M.js";import c from"./C4JT4S5E.js";import{a as F}from"./Y7XD7ZRD.js";import{a as C}from"./VLLZ2FFU.js";import b from"./5ZFUGNRN.js";import{a as L}from"./LLUGJKAQ.js";import{a as _}from"./WKTQVBFJ.js";import{a as I}from"./K2R6XVK3.js";import a from"./D5UFYQHN.js";import{a as x}from"./ONQ6JSBJ.js";import{a as g}from"./7VAQUCBU.js";import{Ya as E,a as w,b as k}from"./EWLXNGKH.js";import{a as y}from"./VXFQANGJ.js";export default $arcgis.t(([,,,,,,{o:$,p:N},R,b,A,{a:Z,b:v,c:S,d:q,e:V},j])=>{var T=[b,F,C,R,L,_,I,A,M];async function B(e,t){let a=await S("navigation_tool_prompt"),{mapView:n}=x(t,["mapView"]),m=n.map.bookmarks?.map(p=>p.name).filter(Boolean)??[],s=e.vectorSearchLayerResults?.length>0?e.vectorSearchLayerResults.map((p,G)=>`${G+1}. layerId=${p.id} | title=${p.title??""} | name=${p.name??""} | score=${p.score.toFixed(2)}`).join(`
3
+ `):"",c=e.vectorSearchFieldResults?.length>0?JSON.stringify(e.vectorSearchFieldResults,null,2):"",r=e.intent==="goToBookmark"&&m.length?`Available bookmarks:
4
+ ${m.map(p=>`- ${p}`).join(`
5
+ `)}`:"",i=(e.intent==="goToLayer"||e.intent==="goToFeatures")&&e.vectorSearchLayerResults?.length?`Candidate layers:
6
+ ${s}`:"",l=e.intent==="goToFeatures"&&e.vectorSearchFieldResults?.length?`Candidate fields:
7
+ ${c}`:"",h={intent:e.intent,bookmarksSection:r,layersSection:i,fieldsSection:l,currentZoom:n.zoom,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},o=await N({promptText:a,modelTier:"fast",config:t,inputVariables:h,tools:T});await j(o,t);let d=(o.tool_calls?.length??0)>0,f=typeof o.text=="string"?o.text.trim():"",z=f.length>0;return{...e,navigationInternalState:{...e.navigationInternalState,toolCallMessage:d?o:void 0},outputMessage:d?e.outputMessage:f,status:d?e.status:z?"success":"failed"}}var D=e=>{let t=typeof e=="string"?e:String(e);try{let a=JSON.parse(t);if(a&&typeof a=="object"&&typeof a.text=="string")return a}catch{console.warn("Failed to parse tool response as JSON:",t)}return{text:t}};async function J(e,t){let a=new Z(T,{handleToolErrors:!1});try{let n=e.navigationInternalState.toolCallMessage;if(!n)throw new Error("navigationToolCalling: missing navigationInternalState.toolCallMessage");let{messages:m}=await a.invoke({messages:[n]},t),s="",c,r;for(let i of m){let l=D(i.content),h=i.artifact;l.text&&(s+=`${l.text}
8
+ `);let o=h?.sharedStatePatch??l.sharedStatePatch;o&&(c={...c,...o}),h?.sharedResourceAdditions&&(r=[...r??[],...h.sharedResourceAdditions])}return await g({text:`Finished executing navigation tool: ${s}`},t),{...e,outputMessage:s,sharedStatePatch:c,sharedResourceAdditions:r,status:"success",summary:s?q(s):"Navigation executed.",navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}catch(n){let m=n instanceof Error?n.message:String(n);return await g({text:`Navigation tool execution failed: ${m}`},t),{...e,outputMessage:`Navigation tool execution failed: ${m}`,status:"failed",summary:`Navigation tool execution failed: ${m}`,navigationInternalState:{...e.navigationInternalState,toolCallMessage:void 0}}}}async function P(e,t){let a=await S("navigation_intent_prompt"),{mapView:n}=x(t,["mapView"]),m=T.map(o=>({name:o.name,description:o.description,schema:o.schema})),s=n.map.bookmarks?.map(o=>o.name).filter(Boolean)??[],c=s.length?`Available bookmarks:
9
+ ${s.map(o=>`- ${o}`).join(`
10
+ `)}`:"No bookmarks are available in this map.",r={tools:m.map(({name:o,description:d,schema:f})=>`${o}: ${d}, ${JSON.stringify(f)}`).join(`
11
+ `),bookmarks:c,assignedTask:e.agentExecutionContext.assignedTask,userRequest:e.agentExecutionContext.userRequest,priorSteps:e.agentExecutionContext.priorSteps},i=y.object({intent:y.string()}),l=await $({promptText:a,config:t,inputVariables:r,schema:i,modelTier:"fast"}),h=typeof l.intent=="string"?l.intent.trim().replace(/^"|"$/gu,""):"";return{...e,intent:h||""}}var H=.7,W=async(e,t)=>{try{await g({text:`Similarity search to find layers: ${e.agentExecutionContext.assignedTask}`},t);let a=u(t,"layerSearch"),n=u(t,"layersAndFieldsRegistry"),m=u(t,"embeddingCache"),s=(await a.searchLayers({text:e.agentExecutionContext.assignedTask,minScore:H,embeddingCache:m})).map(({id:r,score:i})=>{let l=n.get(r)?.layerItem;return{id:r,title:l?.title,name:l?.name??void 0,score:i}}),c;return s.length>0?c=`Vector search completed. Matching layers:
12
+ ${s.map(r=>`- layerId=${r.id} | title=${r.title??""} | name=${r.name??""} | score=${r.score.toFixed(2)}`).join(`
13
+ `)}`:c="Vector search completed. No matching layers found.",await g({text:c},t),{...e,vectorSearchLayerResults:s}}catch(a){throw await g({text:`Error during vector search layers: ${a instanceof Error?a.message:String(a)}`},t),a}},O=.7,K=10,Q=async(e,t)=>{try{await g({text:`Similarity search to find fields: ${e.agentExecutionContext.assignedTask}`},t);let a=u(t,"fieldSearch"),n=u(t,"layersAndFieldsRegistry"),m=u(t,"embeddingCache"),s=e.vectorSearchLayerResults?.map(i=>i.id)??[];if(s.length===0)return await g({text:"No candidate layers for field search"},t),e;let c=(await a.searchFields({text:e.agentExecutionContext.assignedTask,layerIds:s,minScore:O,topResults:K,embeddingCache:m})).map(({layerId:i,results:l})=>{let h=n.get(i)?.fieldRegistry;return{layerId:i,layerName:n.get(i)?.layerItem.name,results:l.map(o=>{let d=h?.get(o.name);return{name:o.name,score:o.score,type:d?.type,alias:d?.alias,description:d?.description,statistics:d?.statistics,domain:d?.domain}})}}),r;return c.length>0?r=`Vector search completed. Matching layers and fields:
14
+ ${c.map(i=>`${i.layerName??i.layerId}:
15
+ ${i.results.map(l=>` - ${l.name} (${l.score.toFixed(2)})`).join(`
16
16
  `)}`).join(`
17
- `)}`:n=`No vector search field results found for score over ${O}.`,await g({text:n},t),{...e,vectorSearchFieldResults:l}}catch(a){throw await g({text:`Error during vector search fields: ${a instanceof Error?a.message:String(a)}`},t),a}},U=(e,t)=>V(["layerSearch","layersAndFieldsRegistry"],"Navigation Agent")(e,t),X=()=>new E(v).addNode("requireNavigationServices",U).addNode("intentLLM",P).addNode("vectorSearchLayers",W).addNode("vectorSearchFields",Q).addNode("agent",B).addNode("tools",J).addEdge(w,"requireNavigationServices").addEdge("requireNavigationServices","intentLLM").addConditionalEdges("intentLLM",e=>e.intent==="goToLayer"||e.intent==="goToFeatures"?"vectorSearchLayers":"agent",{vectorSearchLayers:"vectorSearchLayers",agent:"agent"}).addConditionalEdges("vectorSearchLayers",e=>e.intent==="goToFeatures"?"vectorSearchFields":"agent",{vectorSearchFields:"vectorSearchFields",agent:"agent"}).addEdge("vectorSearchFields","agent").addEdge("agent","tools").addEdge("tools",k),Y=String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
17
+ `)}`:r=`No vector search field results found for score over ${O}.`,await g({text:r},t),{...e,vectorSearchFieldResults:c}}catch(a){throw await g({text:`Error during vector search fields: ${a instanceof Error?a.message:String(a)}`},t),a}},U=(e,t)=>V(["layerSearch","layersAndFieldsRegistry"],"Navigation Agent")(e,t),X=()=>new E(v).addNode("requireNavigationServices",U).addNode("intentLLM",P).addNode("vectorSearchLayers",W).addNode("vectorSearchFields",Q).addNode("agent",B).addNode("tools",J).addEdge(w,"requireNavigationServices").addEdge("requireNavigationServices","intentLLM").addConditionalEdges("intentLLM",e=>e.intent==="goToLayer"||e.intent==="goToFeatures"?"vectorSearchLayers":"agent",{vectorSearchLayers:"vectorSearchLayers",agent:"agent"}).addConditionalEdges("vectorSearchLayers",e=>e.intent==="goToFeatures"?"vectorSearchFields":"agent",{vectorSearchFields:"vectorSearchFields",agent:"agent"}).addEdge("vectorSearchFields","agent").addEdge("agent","tools").addEdge("tools",k),Y=String.raw`- **navigation** — Enables users to interact with the map by navigating to specific locations, layers, features, or extents.
18
18
  This includes zooming, panning, centering, or geocoding based on user input. The agent is designed to handle explicit map movement requests. NOTE: DO NOT call this agent if the user asks "show me...", that is meant to be handled by another agent. If the query is about where a certain address is, call this agent.
19
19
 
20
20
  Supported actions: