@arcgis/ai-components 5.1.0-next.138 → 5.1.0-next.139

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 (34) hide show
  1. package/dist/agent-utils/middlewares/trace.d.ts +2 -0
  2. package/dist/cdn/{U2CX3WH3.js → 3J5RM5OR.js} +1 -1
  3. package/dist/cdn/4BA4OUWC.js +134 -0
  4. package/dist/cdn/{YRJK6X3B.js → 5PCM536R.js} +1 -1
  5. package/dist/cdn/{DN7TVQ4I.js → 7UZXJ2NV.js} +1 -1
  6. package/dist/cdn/{6TEXUJFZ.js → BP3VTREO.js} +1 -1
  7. package/dist/cdn/BUTKUPXN.js +34 -0
  8. package/dist/cdn/CU2TRUZQ.js +99 -0
  9. package/dist/cdn/{5JNQ6ZXX.js → CY6TQNPZ.js} +1 -1
  10. package/dist/cdn/{AEJQUURR.js → DB2C7FK7.js} +1 -1
  11. package/dist/cdn/{RERLJUOH.js → ECRIHA3B.js} +1 -1
  12. package/dist/cdn/{6NSZUDHP.js → FDBWYCAB.js} +1 -1
  13. package/dist/cdn/{4NK7OFUN.js → MJM2MHJW.js} +5 -5
  14. package/dist/cdn/OP6ENMCN.js +180 -0
  15. package/dist/cdn/VDAF255D.js +22 -0
  16. package/dist/cdn/{TU2UCPP6.js → W2CWLWUT.js} +1 -1
  17. package/dist/cdn/{KV3KZOQY.js → W6HO4D6J.js} +1 -1
  18. package/dist/cdn/{XR2ONH3R.js → ZGQAMC2Z.js} +1 -1
  19. package/dist/cdn/agent-utils/index.js +1 -1
  20. package/dist/cdn/index.js +1 -1
  21. package/dist/chunks/adapter.js +1464 -1376
  22. package/dist/chunks/arcgisKnowledgeGraph.js +91 -74
  23. package/dist/chunks/arcgis_knowledge_current_lc_context.js +19 -2
  24. package/dist/chunks/arcgis_knowledge_current_map_context.js +31 -2
  25. package/dist/chunks/arcgis_knowledge_cypher_query_prompt.js +102 -0
  26. package/dist/chunks/arcgis_knowledge_summarize_result_prompt.js +116 -27
  27. package/dist/docs/api.json +1 -1
  28. package/dist/docs/docs.json +1 -1
  29. package/dist/docs/web-types.json +1 -1
  30. package/package.json +4 -4
  31. package/dist/cdn/GH7EROHP.js +0 -5
  32. package/dist/cdn/KDLJHH5V.js +0 -161
  33. package/dist/cdn/KWORBODI.js +0 -5
  34. package/dist/cdn/MFEAOGTZ.js +0 -45
@@ -1,78 +1,78 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import he from "@arcgis/core/identity/IdentityManager.js";
3
- import I from "@arcgis/core/portal/Portal.js";
4
- import { Annotation as b, messagesStateReducer as Te } from "@langchain/langgraph/web";
2
+ import pe from "@arcgis/core/identity/IdentityManager.js";
3
+ import k from "@arcgis/core/portal/Portal.js";
4
+ import { Annotation as b, messagesStateReducer as be } from "@langchain/langgraph/web";
5
5
  import "@arcgis/toolkit/string";
6
- import { k as qe, j as B, i as De } from "./generateLayerDescriptions.js";
6
+ import { k as De, j as H, i as Pe } from "./generateLayerDescriptions.js";
7
7
  import "@langchain/core/messages";
8
8
  import "@langchain/core/callbacks/dispatch/web";
9
9
  import "@langchain/openai";
10
10
  import X from "@arcgis/core/config.js";
11
11
  import * as Ae from "@arcgis/core/core/reactiveUtils.js";
12
12
  import "@arcgis/core/layers/FeatureLayer.js";
13
- import me from "@arcgis/core/request.js";
13
+ import he from "@arcgis/core/request.js";
14
14
  import "@langchain/core/prompts";
15
- import { tool as f } from "@langchain/core/tools";
16
- import Pe from "@arcgis/core/Graphic.js";
15
+ import { tool as w } from "@langchain/core/tools";
16
+ import je from "@arcgis/core/Graphic.js";
17
17
  import { addressToLocations as Le } from "@arcgis/core/rest/locator.js";
18
- import je from "@arcgis/core/symbols/PictureMarkerSymbol.js";
19
- import i, { z as E } from "zod";
20
- import Ge from "@arcgis/core/geometry/Extent.js";
21
- import ve from "@arcgis/core/geometry/Point.js";
22
- import { createRenderer as Oe } from "@arcgis/core/smartMapping/renderers/pieChart.js";
23
- import { getSchemesByTag as Me, getSchemes as Qe } from "@arcgis/core/smartMapping/symbology/pieChart.js";
24
- import { getBackgroundColorTheme as ye } from "@arcgis/core/views/support/colorUtils.js";
18
+ import Ge from "@arcgis/core/symbols/PictureMarkerSymbol.js";
19
+ import s, { z as E } from "zod";
20
+ import Oe from "@arcgis/core/geometry/Extent.js";
21
+ import Te from "@arcgis/core/geometry/Point.js";
22
+ import { createRenderer as Me } from "@arcgis/core/smartMapping/renderers/pieChart.js";
23
+ import { getSchemesByTag as Qe, getSchemes as _e } from "@arcgis/core/smartMapping/symbology/pieChart.js";
24
+ import { getBackgroundColorTheme as me } from "@arcgis/core/views/support/colorUtils.js";
25
25
  import { a as x, s as S } from "./index.js";
26
- import { createAgeRenderer as _e, createContinuousRenderer as We } from "@arcgis/core/smartMapping/renderers/color.js";
27
- import { getSchemesByTag as le } from "@arcgis/core/smartMapping/symbology/color.js";
28
- import { createContinuousRenderer as Ve } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
29
- import { createRenderer as Ue } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
26
+ import { createAgeRenderer as We, createContinuousRenderer as Ve } from "@arcgis/core/smartMapping/renderers/color.js";
27
+ import { getSchemesByTag as se } from "@arcgis/core/smartMapping/symbology/color.js";
28
+ import { createContinuousRenderer as Ue } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
29
+ import { createRenderer as Be } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
30
30
  import { getSchemesByTag as Ke } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
31
- import { createRenderer as Be } from "@arcgis/core/smartMapping/renderers/heatmap.js";
32
- import { getSchemesByTag as He } from "@arcgis/core/smartMapping/symbology/heatmap.js";
33
- import { createRenderer as Je } from "@arcgis/core/smartMapping/renderers/predominance.js";
34
- import { getSchemesByTag as Ze } from "@arcgis/core/smartMapping/symbology/predominance.js";
35
- import { createRenderer as Ye } from "@arcgis/core/smartMapping/renderers/relationship.js";
36
- import { getSchemesByTag as Xe } from "@arcgis/core/smartMapping/symbology/relationship.js";
37
- import { createAgeRenderer as et, createContinuousRenderer as tt } from "@arcgis/core/smartMapping/renderers/size.js";
38
- import { createRenderer as rt } from "@arcgis/core/smartMapping/renderers/type.js";
39
- import { getSchemesByTag as at } from "@arcgis/core/smartMapping/symbology/type.js";
40
- import { ToolNode as ot } from "@langchain/langgraph/prebuilt";
41
- import nt from "@arcgis/core/layers/support/FeatureEffect.js";
42
- import Se from "@arcgis/core/layers/support/FeatureFilter.js";
43
- import * as it from "@arcgis/core/geometry/operators/unionOperator.js";
44
- import { formatDateOnly as st, convertDateFormatToIntlOptions as Q, formatTimeOnly as lt, formatDate as fe } from "@arcgis/core/intl.js";
45
- import ct from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
46
- import ut from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
47
- import dt from "@arcgis/core/rest/support/TopFeaturesQuery.js";
48
- import pt from "@arcgis/core/rest/support/TopFilter.js";
49
- import ht from "@arcgis/core/WebLinkChart.js";
50
- import xe from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
31
+ import { createRenderer as He } from "@arcgis/core/smartMapping/renderers/heatmap.js";
32
+ import { getSchemesByTag as Je } from "@arcgis/core/smartMapping/symbology/heatmap.js";
33
+ import { createRenderer as Ze } from "@arcgis/core/smartMapping/renderers/predominance.js";
34
+ import { getSchemesByTag as Ye } from "@arcgis/core/smartMapping/symbology/predominance.js";
35
+ import { createRenderer as Xe } from "@arcgis/core/smartMapping/renderers/relationship.js";
36
+ import { getSchemesByTag as et } from "@arcgis/core/smartMapping/symbology/relationship.js";
37
+ import { createAgeRenderer as tt, createContinuousRenderer as rt } from "@arcgis/core/smartMapping/renderers/size.js";
38
+ import { createRenderer as at } from "@arcgis/core/smartMapping/renderers/type.js";
39
+ import { getSchemesByTag as ot } from "@arcgis/core/smartMapping/symbology/type.js";
40
+ import { ToolNode as nt } from "@langchain/langgraph/prebuilt";
41
+ import it from "@arcgis/core/layers/support/FeatureEffect.js";
42
+ import ve from "@arcgis/core/layers/support/FeatureFilter.js";
43
+ import * as st from "@arcgis/core/geometry/operators/unionOperator.js";
44
+ import { formatDateOnly as lt, convertDateFormatToIntlOptions as _, formatTimeOnly as ct, formatDate as ye } from "@arcgis/core/intl.js";
45
+ import ut from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
46
+ import dt from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
47
+ import pt from "@arcgis/core/rest/support/TopFeaturesQuery.js";
48
+ import ht from "@arcgis/core/rest/support/TopFilter.js";
49
+ import mt from "@arcgis/core/WebLinkChart.js";
50
+ import Se from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
51
51
  import "@arcgis/core/views/LinkChartView.js";
52
- import { fetchKnowledgeGraph as ge, executeQueryStreaming as mt, executeSearchStreaming as yt } from "@arcgis/core/rest/knowledgeGraphService.js";
53
- import ft from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
54
- const L = (e, t) => t ?? e, Rn = b.Root({
55
- ...qe(),
52
+ import { fetchKnowledgeGraph as fe, executeQueryStreaming as yt, executeSearchStreaming as ft } from "@arcgis/core/rest/knowledgeGraphService.js";
53
+ import gt from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
54
+ const j = (e, r) => r ?? e, $n = b.Root({
55
+ ...De(),
56
56
  // internal to the navigation agent
57
57
  intent: b({
58
- reducer: L
58
+ reducer: j
59
59
  }),
60
60
  vectorSearchLayerResults: b({
61
- reducer: L,
61
+ reducer: j,
62
62
  default: () => []
63
63
  }),
64
64
  vectorSearchFieldResults: b({
65
- reducer: L
65
+ reducer: j
66
66
  }),
67
67
  navigationInternalState: b({
68
- reducer: L,
68
+ reducer: j,
69
69
  default: () => ({
70
70
  toolCallMessage: void 0
71
71
  })
72
72
  })
73
73
  });
74
- async function gt(e, t) {
75
- const a = I.getDefault().helperServices, o = a.geocode.find((h) => h.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
74
+ async function wt(e, r) {
75
+ const a = k.getDefault().helperServices, o = a.geocode.find((h) => h.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
76
76
  if (!o)
77
77
  throw new Error("No geocoding service found in helperServices.");
78
78
  const n = o.url, l = `${X.assetsPath?.endsWith("/") ? X.assetsPath : `${X.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await Le(n, {
@@ -81,15 +81,15 @@ async function gt(e, t) {
81
81
  }))?.[0];
82
82
  if (!c?.extent || !c.location)
83
83
  throw new Error(`Could not find location for: ${e}`);
84
- const u = new je({
84
+ const u = new Ge({
85
85
  url: l,
86
86
  width: 24,
87
87
  height: 24
88
- }), d = new Pe({
88
+ }), d = new je({
89
89
  geometry: c.location,
90
90
  symbol: u
91
91
  });
92
- t.graphics.removeAll(), t.graphics.add(d), await t.goTo(c.extent);
92
+ r.graphics.removeAll(), r.graphics.add(d), await r.goTo(c.extent);
93
93
  const p = {
94
94
  address: c.address ?? "",
95
95
  location: c.location ? c.location.toJSON() : null,
@@ -100,29 +100,29 @@ async function gt(e, t) {
100
100
  sharedStatePatch: { lastResolvedLocation: { value: p } }
101
101
  };
102
102
  }
103
- const wt = ["mapView"];
104
- function $(e) {
105
- const r = e?.configurable?.context;
106
- if (!r || typeof r != "object")
103
+ const bt = ["mapView"];
104
+ function C(e) {
105
+ const t = e?.configurable?.context;
106
+ if (!t || typeof t != "object")
107
107
  throw new Error("NavigationAgent context missing");
108
- const a = wt.filter((o) => !(o in r));
108
+ const a = bt.filter((o) => !(o in t));
109
109
  if (a.length)
110
110
  throw new Error(`NavigationAgent context missing: ${a.join(", ")}`);
111
- return r;
111
+ return t;
112
112
  }
113
- async function bt({ address: e }, t) {
114
- const { mapView: r } = $(t);
115
- return await gt(e, r);
113
+ async function Tt({ address: e }, r) {
114
+ const { mapView: t } = C(r);
115
+ return await wt(e, t);
116
116
  }
117
- const Tt = i.object({
118
- address: i.string().describe("The full address or place name to locate.")
119
- }), $n = f(bt, {
117
+ const vt = s.object({
118
+ address: s.string().describe("The full address or place name to locate.")
119
+ }), Cn = w(Tt, {
120
120
  name: "goToAddress",
121
121
  description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
122
- schema: Tt
122
+ schema: vt
123
123
  });
124
- async function vt(e, t) {
125
- const a = t.map.bookmarks;
124
+ async function St(e, r) {
125
+ const a = r.map.bookmarks;
126
126
  if (!a || a.length === 0)
127
127
  throw new Error("No bookmarks found in the map.");
128
128
  const o = a.find((l) => l.name === e);
@@ -131,41 +131,41 @@ async function vt(e, t) {
131
131
  const n = o.viewpoint;
132
132
  if (!n)
133
133
  throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
134
- return await t.goTo(n), { text: `Navigated to bookmark: ${e}` };
134
+ return await r.goTo(n), { text: `Navigated to bookmark: ${e}` };
135
135
  }
136
- async function St({ bookmarkName: e }, t) {
137
- const { mapView: r } = $(t);
138
- return await Promise.resolve(vt(e, r));
136
+ async function xt({ bookmarkName: e }, r) {
137
+ const { mapView: t } = C(r);
138
+ return await Promise.resolve(St(e, t));
139
139
  }
140
- const xt = E.object({
140
+ const Rt = E.object({
141
141
  bookmarkName: E.string().describe("The name of the bookmark to navigate to.")
142
- }), Cn = f(St, {
142
+ }), En = w(xt, {
143
143
  name: "goToBookmark",
144
144
  description: "Go to the extent of the bookmark with the given name.",
145
- schema: xt
145
+ schema: Rt
146
146
  });
147
- async function Rt(e, t, r) {
148
- const a = r.map?.allLayers.find((l) => l.id === e);
147
+ async function $t(e, r, t) {
148
+ const a = t.map?.allLayers.find((l) => l.id === e);
149
149
  if (!a)
150
150
  return { text: `Error: Layer with id ${e} not found` };
151
- const o = t?.trim() ? t : "1=1", n = a.createQuery();
151
+ const o = r?.trim() ? r : "1=1", n = a.createQuery();
152
152
  n.where = o;
153
153
  try {
154
- const { extent: l, count: s } = await a.queryExtent(n);
155
- if (s === 0)
154
+ const { extent: l, count: i } = await a.queryExtent(n);
155
+ if (i === 0)
156
156
  return { text: `No features found in ${a.title} matching: ${o}`, where: o };
157
157
  if (l)
158
- await r.goTo(l);
158
+ await t.goTo(l);
159
159
  else
160
160
  return { text: `Error: Unable to determine extent for ${a.title}`, where: o };
161
161
  const c = {
162
162
  layerId: e,
163
163
  layerTitle: a.title ?? e,
164
164
  where: o,
165
- count: s
165
+ count: i
166
166
  };
167
167
  return {
168
- text: `Successfully zoomed to ${s} feature(s) in ${a.title} matching: ${o}`,
168
+ text: `Successfully zoomed to ${i} feature(s) in ${a.title} matching: ${o}`,
169
169
  where: o,
170
170
  sharedStatePatch: { lastNavigatedFeatures: { value: c } }
171
171
  };
@@ -173,137 +173,138 @@ async function Rt(e, t, r) {
173
173
  return console.error("Error in goToFeatures:", l), { text: `Error: ${l instanceof Error ? l.message : "Unknown error"}`, where: o };
174
174
  }
175
175
  }
176
- async function $t({ layerId: e, where: t }, r) {
177
- const { mapView: a } = $(r);
178
- return await Rt(e, t, a);
176
+ async function Ct({ layerId: e, where: r }, t) {
177
+ const { mapView: a } = C(t);
178
+ return await $t(e, r, a);
179
179
  }
180
- const Ct = E.object({
180
+ const Et = E.object({
181
181
  layerId: E.string().describe("The layerId of the layer to zoom to."),
182
182
  where: E.string().describe("The sql-92 where clause used to query features to zoom to")
183
- }), En = f($t, {
183
+ }), Fn = w(Ct, {
184
184
  name: "goToFeatures",
185
185
  description: "Go to the features that match the given filter related to the given layerId.",
186
- schema: Ct
186
+ schema: Et
187
187
  });
188
- async function Et(e) {
189
- const r = new Ge({
188
+ async function Ft(e) {
189
+ const t = new Oe({
190
190
  xmin: -180,
191
191
  ymin: -90,
192
192
  xmax: 180,
193
193
  ymax: 90,
194
194
  spatialReference: { wkid: 4326 }
195
195
  }).expand(0.7);
196
- return await e.goTo(r), { text: "Successfully zoomed to world extent" };
196
+ return await e.goTo(t), { text: "Successfully zoomed to world extent" };
197
197
  }
198
- async function Nt(e, t) {
199
- const { mapView: r } = $(t);
200
- return await Et(r);
198
+ async function kt(e, r) {
199
+ const { mapView: t } = C(r);
200
+ return await Ft(t);
201
201
  }
202
- const It = E.object({}), Nn = f(Nt, {
202
+ const Nt = E.object({}), kn = w(kt, {
203
203
  name: "goToFullExtent",
204
204
  description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
205
- schema: It
205
+ schema: Nt
206
206
  });
207
- async function kt(e) {
208
- const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
209
- if (r)
210
- await e.goTo(r);
207
+ async function qt(e) {
208
+ const t = e.map.initialViewProperties?.viewpoint?.targetGeometry;
209
+ if (t)
210
+ await e.goTo(t);
211
211
  else
212
212
  throw new Error("Initial extent is undefined");
213
213
  return { text: "Successfully zoomed to home extent" };
214
214
  }
215
- async function Ft(e, t) {
216
- const { mapView: r } = $(t);
217
- return await kt(r);
215
+ async function It(e, r) {
216
+ const { mapView: t } = C(r);
217
+ return await qt(t);
218
218
  }
219
- const zt = i.object({}), In = f(Ft, {
219
+ const zt = s.object({}), Nn = w(It, {
220
220
  name: "goToHomeExtent",
221
221
  description: "Go to the initial web map view extent",
222
222
  schema: zt
223
223
  });
224
- async function qt(e, t) {
225
- await t.when();
226
- const r = t.map?.allLayers.find((o) => o.id === e);
227
- if (!r)
224
+ async function Dt(e, r) {
225
+ await r.when();
226
+ const t = r.map?.allLayers.find((o) => o.id === e);
227
+ if (!t)
228
228
  return console.warn(`[goToLayer] No matching FeatureLayer found for: ${e}`), { text: `Could not find layer for: ${e}` };
229
229
  let a;
230
- return (r.type === "link-chart" || r.type === "knowledge-graph-sublayer") && t.map?.activeLinkChartLayer ? a = t.map.diagramNodesExtent : a = r.fullExtent, a ? (await t.goTo(a), r.visible = !0, { text: `Successfully zoomed to: ${r.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
230
+ return (t.type === "link-chart" || t.type === "knowledge-graph-sublayer") && r.map?.activeLinkChartLayer ? a = r.map.diagramNodesExtent : a = t.fullExtent, a ? (await r.goTo(a), t.visible = !0, { text: `Successfully zoomed to: ${t.title ?? ""}` }) : { text: "Layer has no defined extent. Cannot zoom to layer." };
231
231
  }
232
- async function Dt({ layerId: e }, t) {
233
- const { mapView: r } = $(t);
234
- return await qt(e, r);
232
+ async function Pt({ layerId: e }, r) {
233
+ const { mapView: t } = C(r);
234
+ return await Dt(e, t);
235
235
  }
236
236
  const At = E.object({
237
237
  layerId: E.string().describe("The id of the layer to navigate to")
238
- }), kn = f(Dt, {
238
+ }), qn = w(Pt, {
239
239
  name: "goToLayer",
240
240
  description: "Zooms the map view to the full extent of the top matching layer.",
241
241
  schema: At
242
242
  });
243
- async function Pt(e, t) {
244
- return await t.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
243
+ async function jt(e, r) {
244
+ return await r.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
245
245
  }
246
- async function Lt({ scale: e }, t) {
247
- const { mapView: r } = $(t);
248
- return await Pt(e, r);
246
+ async function Lt({ scale: e }, r) {
247
+ const { mapView: t } = C(r);
248
+ return await jt(e, t);
249
249
  }
250
- const jt = i.object({
251
- scale: i.number().describe("The map scale of the view to go to.")
252
- }), Fn = f(Lt, {
250
+ const Gt = s.object({
251
+ scale: s.number().describe("The map scale of the view to go to.")
252
+ }), In = w(Lt, {
253
253
  name: "goToScale",
254
254
  description: "Go to the specified view scale.",
255
- schema: jt
255
+ schema: Gt
256
256
  });
257
- async function Gt(e, t, r) {
257
+ async function Ot(e, r, t) {
258
258
  const o = {
259
- target: new ve({
259
+ target: new Te({
260
260
  longitude: e.longitude,
261
261
  latitude: e.latitude,
262
262
  spatialReference: { wkid: 4326 }
263
263
  })
264
264
  };
265
- return r?.zoom !== void 0 && (o.zoom = r.zoom), r?.scale !== void 0 && (o.scale = r.scale), await t.goTo(o), { text: `Successfully navigated to: ${[
265
+ return t?.zoom !== void 0 && (o.zoom = t.zoom), t?.scale !== void 0 && (o.scale = t.scale), await r.goTo(o), { text: `Successfully navigated to: ${[
266
266
  `(${e.latitude}°, ${e.longitude}°)`,
267
- r?.zoom !== void 0 ? `zoom ${r.zoom}` : "",
268
- r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
267
+ t?.zoom !== void 0 ? `zoom ${t.zoom}` : "",
268
+ t?.scale !== void 0 ? `scale 1:${t.scale}` : ""
269
269
  ].filter(Boolean).join(", ")}` };
270
270
  }
271
- async function Ot({
271
+ async function Mt({
272
272
  center: e,
273
- zoom: t,
274
- scale: r
273
+ zoom: r,
274
+ scale: t
275
275
  }, a) {
276
- const { mapView: o } = $(a);
277
- return await Gt(e, o, { zoom: t, scale: r });
276
+ const { mapView: o } = C(a);
277
+ return await Ot(e, o, { zoom: r, scale: t });
278
278
  }
279
- const Mt = i.object({
280
- center: i.object({
281
- longitude: i.number().describe("The longitude (x-coordinate) of the point to navigate to."),
282
- latitude: i.number().describe("The latitude (y-coordinate) of the point to navigate to.")
279
+ const Qt = s.object({
280
+ center: s.object({
281
+ longitude: s.number().describe("The longitude (x-coordinate) of the point to navigate to."),
282
+ latitude: s.number().describe("The latitude (y-coordinate) of the point to navigate to.")
283
283
  }),
284
- zoom: i.number().optional().describe("The zoom level. Higher values = more zoomed in."),
285
- scale: i.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
286
- }), zn = f(Ot, {
284
+ zoom: s.number().optional().describe("The zoom level. Higher values = more zoomed in."),
285
+ scale: s.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
286
+ }), zn = w(Mt, {
287
287
  name: "goToViewpoint",
288
288
  description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
289
- schema: Mt
289
+ schema: Qt
290
290
  });
291
- async function Qt(e, t) {
292
- return await t.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
291
+ async function _t(e, r) {
292
+ return await r.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
293
293
  }
294
- async function _t({ zoom: e }, t) {
295
- const { mapView: r } = $(t);
296
- return await Qt(e, r);
294
+ async function Wt({ zoom: e }, r) {
295
+ const { mapView: t } = C(r);
296
+ return await _t(e, t);
297
297
  }
298
- const Wt = i.object({
299
- zoom: i.number().min(1).max(20).describe("The zoom level of the view to go to.")
300
- }), qn = f(_t, {
298
+ const Vt = s.object({
299
+ zoom: s.number().min(1).max(20).describe("The zoom level of the view to go to.")
300
+ }), Dn = w(Wt, {
301
301
  name: "goToZoom",
302
302
  description: 'Go to the specified zoom level. If input is generic (e.g. "zoom in", then only zoom to the next appropriate level - increase level for zooming in and decrease for zooming out.).',
303
- schema: Wt
304
- }), we = /* @__PURE__ */ Object.assign({
303
+ schema: Vt
304
+ }), ge = /* @__PURE__ */ Object.assign({
305
305
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md": () => import("./arcgis_knowledge_current_lc_context.js").then((e) => e.default),
306
306
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md": () => import("./arcgis_knowledge_current_map_context.js").then((e) => e.default),
307
+ "../agents/arcgisKnowledge/prompts/arcgis_knowledge_cypher_query_prompt.md": () => import("./arcgis_knowledge_cypher_query_prompt.js").then((e) => e.default),
307
308
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_lucene_generation_prompt.md": () => import("./arcgis_knowledge_lucene_generation_prompt.js").then((e) => e.default),
308
309
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_summarize_result_prompt.md": () => import("./arcgis_knowledge_summarize_result_prompt.js").then((e) => e.default),
309
310
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_tool_prompt.md": () => import("./arcgis_knowledge_tool_prompt.js").then((e) => e.default),
@@ -315,48 +316,48 @@ const Wt = i.object({
315
316
  "../agents/navigation/prompts/navigation_intent_prompt.md": () => import("./navigation_intent_prompt.js").then((e) => e.default),
316
317
  "../agents/navigation/prompts/navigation_tool_prompt.md": () => import("./navigation_tool_prompt.js").then((e) => e.default)
317
318
  });
318
- async function te(e) {
319
- const t = Object.entries(we).find(([r]) => r.endsWith(`/${e}.md`));
320
- if (!t)
319
+ async function U(e) {
320
+ const r = Object.entries(ge).find(([t]) => t.endsWith(`/${e}.md`));
321
+ if (!r)
321
322
  throw new Error(`Prompt not found: ${e}
322
323
  Available prompts:
323
- ${Object.keys(we).join(`
324
+ ${Object.keys(ge).join(`
324
325
  `)}`);
325
- return await t[1]();
326
+ return await r[1]();
326
327
  }
327
- const Vt = (e, t = 300) => {
328
- const r = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
329
- return r.length > t ? `${r.slice(0, t)}...` : r;
330
- }, Re = (e, t) => {
331
- const a = e?.configurable?.services?.[t];
328
+ const Ut = (e, r = 300) => {
329
+ const t = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
330
+ return t.length > r ? `${t.slice(0, r)}...` : t;
331
+ }, xe = (e, r) => {
332
+ const a = e?.configurable?.services?.[r];
332
333
  if (a == null)
333
- throw new Error(`${t} missing in config.configurable.services`);
334
+ throw new Error(`${r} missing in config.configurable.services`);
334
335
  return a;
335
- }, Dn = (e, t) => (r, a) => {
336
+ }, Pn = (e, r) => (t, a) => {
336
337
  const o = a?.configurable?.services;
337
338
  for (const n of e)
338
339
  if (!o?.[n])
339
- throw new Error(`${t} requires services.${n} to be available.`);
340
- return r;
340
+ throw new Error(`${r} requires services.${n} to be available.`);
341
+ return t;
341
342
  };
342
- async function Ut(e) {
343
- const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
343
+ async function Bt(e) {
344
+ const { fields: r, layer: t, view: a, styleName: o, colorSchemeTags: n } = e;
344
345
  let l;
345
- return n ? l = Me({
346
- basemapTheme: await ye(a),
347
- geometryType: r.geometryType,
346
+ return n ? l = Qe({
347
+ basemapTheme: await me(a),
348
+ geometryType: t.geometryType,
348
349
  includedTags: n,
349
- numColors: Math.min(t.length, 8)
350
- })[0] : l = Qe({
351
- basemapTheme: await ye(a),
352
- geometryType: r.geometryType,
353
- numColors: Math.min(t.length, 8)
350
+ numColors: Math.min(r.length, 8)
351
+ })[0] : l = _e({
352
+ basemapTheme: await me(a),
353
+ geometryType: t.geometryType,
354
+ numColors: Math.min(r.length, 8)
354
355
  }).primaryScheme, {
355
- layer: r,
356
+ layer: t,
356
357
  view: a,
357
- attributes: t.map((s) => ({
358
- field: s,
359
- label: r.fields.find((c) => c.name === s)?.alias ?? ""
358
+ attributes: r.map((i) => ({
359
+ field: i,
360
+ label: t.fields.find((c) => c.name === i)?.alias ?? ""
360
361
  })).slice(0, 8),
361
362
  outlineOptimizationEnabled: !0,
362
363
  sizeOptimizationEnabled: !0,
@@ -365,65 +366,65 @@ async function Ut(e) {
365
366
  };
366
367
  }
367
368
  async function Kt(e) {
368
- return await Oe(e);
369
+ return await Me(e);
369
370
  }
370
- async function Bt({
371
+ async function Ht({
371
372
  arcgisMap: e,
372
- arcgisMapView: t,
373
- layerId: r,
373
+ arcgisMapView: r,
374
+ layerId: t,
374
375
  fields: a,
375
376
  colorSchemes: o,
376
377
  includeSize: n
377
378
  }) {
378
- const l = t, s = e?.allLayers.find((d) => d.id === r);
379
- if (!s)
380
- return `Could not find layer for id: ${r}`;
379
+ const l = r, i = e?.allLayers.find((d) => d.id === t);
380
+ if (!i)
381
+ return `Could not find layer for id: ${t}`;
381
382
  const u = {
382
383
  styleName: n ? "chart-size" : "chart",
383
384
  fields: a,
384
- layer: s,
385
+ layer: i,
385
386
  view: l,
386
387
  colorSchemeTags: o
387
388
  };
388
389
  try {
389
- const d = await Ut(u), p = await Kt(d);
390
- return s.renderer = p.renderer, s.visible = !0, `Chart renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
390
+ const d = await Bt(u), p = await Kt(d);
391
+ return i.renderer = p.renderer, i.visible = !0, `Chart renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
391
392
  } catch (d) {
392
393
  return `Error applying chart renderer: ${d instanceof Error ? d.message : String(d)}`;
393
394
  }
394
395
  }
395
- const Ht = ["mapView"];
396
+ const Jt = ["mapView"];
396
397
  function R(e) {
397
- const r = e?.configurable?.context;
398
- if (!r || typeof r != "object")
398
+ const t = e?.configurable?.context;
399
+ if (!t || typeof t != "object")
399
400
  throw new Error("LayerStylingAgent context missing");
400
- const a = Ht.filter((o) => !(o in r));
401
+ const a = Jt.filter((o) => !(o in t));
401
402
  if (a.length)
402
403
  throw new Error(`LayerStylingAgent context missing: ${a.join(", ")}`);
403
- return r;
404
+ return t;
404
405
  }
405
- async function Jt({
406
+ async function Zt({
406
407
  layerId: e,
407
- fields: t,
408
- colorSchemes: r,
408
+ fields: r,
409
+ colorSchemes: t,
409
410
  includeSize: a
410
411
  }, o) {
411
412
  const { mapView: n } = R(o);
412
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Bt({
413
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Ht({
413
414
  arcgisMap: n.map,
414
415
  arcgisMapView: n,
415
416
  layerId: e,
416
- fields: t,
417
- colorSchemes: r,
417
+ fields: r,
418
+ colorSchemes: t,
418
419
  includeSize: a
419
420
  });
420
421
  }
421
- const Zt = i.object({
422
- layerId: i.string().describe("The id of the layer to apply the chart renderer to"),
423
- fields: i.array(i.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
424
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
425
- includeSize: i.boolean().optional().describe("Whether to vary the chart size (chart-size)")
426
- }), An = f(Jt, {
422
+ const Yt = s.object({
423
+ layerId: s.string().describe("The id of the layer to apply the chart renderer to"),
424
+ fields: s.array(s.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
425
+ colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
426
+ includeSize: s.boolean().optional().describe("Whether to vary the chart size (chart-size)")
427
+ }), An = w(Zt, {
427
428
  name: "chart",
428
429
  description: `Label: Charts
429
430
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
@@ -436,98 +437,98 @@ const Zt = i.object({
436
437
  Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
437
438
  Example: Show the total number of homes built in each decade using a pie chart for each feature and vary the size of each chart based on the total of all categories.
438
439
  Fields: This style requires 2-8 number fields.`,
439
- schema: Zt
440
+ schema: Yt
440
441
  });
441
- function Yt(e) {
442
- const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: n } = e, l = t[0];
443
- let s;
444
- return n && (s = le({
445
- geometryType: r.geometryType,
442
+ function Xt(e) {
443
+ const { fields: r, layer: t, view: a, theme: o, colorSchemeTags: n } = e, l = r[0];
444
+ let i;
445
+ return n && (i = se({
446
+ geometryType: t.geometryType,
446
447
  includedTags: n,
447
448
  theme: o || "high-to-low"
448
449
  })[0]), {
449
- layer: r,
450
+ layer: t,
450
451
  view: a,
451
452
  startTime: l,
452
453
  endTime: /* @__PURE__ */ new Date(),
453
454
  theme: o,
454
455
  sizeOptimizationEnabled: !0,
455
456
  outlineOptimizationEnabled: !0,
456
- colorScheme: s
457
+ colorScheme: i
457
458
  };
458
459
  }
459
- async function Xt(e) {
460
- return await _e(e);
460
+ async function er(e) {
461
+ return await We(e);
461
462
  }
462
- async function er({
463
+ async function tr({
463
464
  arcgisMap: e,
464
- arcgisMapView: t,
465
- layerId: r,
465
+ arcgisMapView: r,
466
+ layerId: t,
466
467
  fields: a,
467
468
  colorSchemes: o,
468
469
  theme: n
469
470
  }) {
470
- const l = t, s = e?.allLayers.find((u) => u.id === r);
471
- if (!s)
472
- return `Could not find layer for id: ${r}`;
471
+ const l = r, i = e?.allLayers.find((u) => u.id === t);
472
+ if (!i)
473
+ return `Could not find layer for id: ${t}`;
473
474
  const c = {
474
475
  styleName: "color-age",
475
476
  fields: a,
476
- layer: s,
477
+ layer: i,
477
478
  view: l,
478
479
  colorSchemeTags: o,
479
480
  theme: n
480
481
  };
481
482
  try {
482
- const u = Yt(c), d = await Xt(u);
483
- return s.renderer = d.renderer, s.visible = !0, `Color-age renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
483
+ const u = Xt(c), d = await er(u);
484
+ return i.renderer = d.renderer, i.visible = !0, `Color-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
484
485
  } catch (u) {
485
486
  return `Error applying color-age renderer: ${u instanceof Error ? u.message : String(u)}`;
486
487
  }
487
488
  }
488
- async function tr({
489
+ async function rr({
489
490
  layerId: e,
490
- fields: t,
491
- colorSchemes: r,
491
+ fields: r,
492
+ colorSchemes: t,
492
493
  theme: a
493
494
  }, o) {
494
495
  const { mapView: n } = R(o);
495
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await er({
496
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await tr({
496
497
  arcgisMap: n.map,
497
498
  arcgisMapView: n,
498
499
  layerId: e,
499
- fields: t,
500
- colorSchemes: r,
500
+ fields: r,
501
+ colorSchemes: t,
501
502
  theme: a
502
503
  });
503
504
  }
504
- const rr = i.object({
505
- layerId: i.string().describe("The id of the layer to apply the color-age renderer to"),
506
- fields: i.array(i.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
507
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
508
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
509
- }), Pn = f(tr, {
505
+ const ar = s.object({
506
+ layerId: s.string().describe("The id of the layer to apply the color-age renderer to"),
507
+ fields: s.array(s.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
508
+ colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
509
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
510
+ }), jn = w(rr, {
510
511
  name: "color-age",
511
512
  description: `Label: Age (color)
512
513
  Description: Use colors along a continuous color ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
513
514
  Keywords: since, age, how old, how long
514
515
  Example: Show the age of each feature based on its reported date.
515
516
  Fields: This style requires at least one field with a date type.`,
516
- schema: rr
517
+ schema: ar
517
518
  });
518
- function ar(e) {
519
- const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
520
- let { theme: n } = e, l = t[1];
521
- const s = t[0];
519
+ function or(e) {
520
+ const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
521
+ let { theme: n } = e, l = r[1];
522
+ const i = r[0];
522
523
  let c;
523
- return o && (c = le({
524
- geometryType: r.geometryType,
524
+ return o && (c = se({
525
+ geometryType: t.geometryType,
525
526
  includedTags: o,
526
527
  theme: n || "high-to-low"
527
528
  })[0]), {
528
- layer: r,
529
+ layer: t,
529
530
  view: a,
530
- field: s,
531
+ field: i,
531
532
  normalizationField: l,
532
533
  theme: n,
533
534
  sizeOptimizationEnabled: !0,
@@ -535,177 +536,177 @@ function ar(e) {
535
536
  colorScheme: c
536
537
  };
537
538
  }
538
- async function or(e) {
539
- return await We(e);
539
+ async function nr(e) {
540
+ return await Ve(e);
540
541
  }
541
- async function nr({
542
+ async function ir({
542
543
  arcgisMap: e,
543
- arcgisMapView: t,
544
- layerId: r,
544
+ arcgisMapView: r,
545
+ layerId: t,
545
546
  fields: a,
546
547
  colorSchemes: o,
547
548
  theme: n
548
549
  }) {
549
- const l = t, s = e?.allLayers.find((u) => u.id === r);
550
- if (!s)
551
- return `Could not find layer for id: ${r}`;
550
+ const l = r, i = e?.allLayers.find((u) => u.id === t);
551
+ if (!i)
552
+ return `Could not find layer for id: ${t}`;
552
553
  const c = {
553
554
  styleName: "color",
554
555
  fields: a,
555
- layer: s,
556
+ layer: i,
556
557
  view: l,
557
558
  colorSchemeTags: o,
558
559
  theme: n
559
560
  };
560
561
  try {
561
- const u = ar(c), d = await or(u);
562
- return s.renderer = d.renderer, s.visible = !0, `Color renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
562
+ const u = or(c), d = await nr(u);
563
+ return i.renderer = d.renderer, i.visible = !0, `Color renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
563
564
  } catch (u) {
564
565
  return `Error applying color renderer: ${u instanceof Error ? u.message : String(u)}`;
565
566
  }
566
567
  }
567
- async function ir({
568
+ async function sr({
568
569
  layerId: e,
569
- fields: t,
570
- colorSchemes: r,
570
+ fields: r,
571
+ colorSchemes: t,
571
572
  theme: a
572
573
  }, o) {
573
574
  const { mapView: n } = R(o);
574
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await nr({
575
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await ir({
575
576
  arcgisMap: n.map,
576
577
  arcgisMapView: n,
577
578
  layerId: e,
578
- fields: t,
579
- colorSchemes: r,
579
+ fields: r,
580
+ colorSchemes: t,
580
581
  theme: a
581
582
  });
582
583
  }
583
- const sr = i.object({
584
- layerId: i.string().describe("The id of the layer to apply the color renderer to"),
585
- fields: i.array(i.string()).describe("The field(s) to use for the color renderer"),
586
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
587
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
588
- }), Ln = f(ir, {
584
+ const lr = s.object({
585
+ layerId: s.string().describe("The id of the layer to apply the color renderer to"),
586
+ fields: s.array(s.string()).describe("The field(s) to use for the color renderer"),
587
+ colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
588
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
589
+ }), Ln = w(sr, {
589
590
  name: "color",
590
591
  description: `Label: Counts and Amounts (color)
591
592
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
592
593
  Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
593
594
  Example: Color each feature based on the population density.
594
595
  Fields: This style requires a single field with a number type. A second number field may be specified for normalizing the value of the first field.`,
595
- schema: sr
596
+ schema: lr
596
597
  });
597
- function lr(e) {
598
- const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: n } = e;
599
- let l, s;
600
- const c = t[0];
601
- return o && (s = le({
602
- geometryType: r.geometryType,
598
+ function cr(e) {
599
+ const { fields: r, layer: t, view: a, colorSchemeTags: o, theme: n } = e;
600
+ let l, i;
601
+ const c = r[0];
602
+ return o && (i = se({
603
+ geometryType: t.geometryType,
603
604
  includedTags: o,
604
605
  theme: n || "high-to-low"
605
606
  })[0]), {
606
- layer: r,
607
+ layer: t,
607
608
  view: a,
608
609
  field: c,
609
610
  normalizationField: l,
610
611
  theme: n,
611
612
  colorOptions: {
612
- colorScheme: s
613
+ colorScheme: i
613
614
  }
614
615
  };
615
616
  }
616
- async function cr(e) {
617
- return await Ve(e);
617
+ async function ur(e) {
618
+ return await Ue(e);
618
619
  }
619
- async function ur({
620
+ async function dr({
620
621
  arcgisMap: e,
621
- arcgisMapView: t,
622
- layerId: r,
622
+ arcgisMapView: r,
623
+ layerId: t,
623
624
  fields: a,
624
625
  colorSchemes: o,
625
626
  theme: n
626
627
  }) {
627
- const l = t, s = e?.allLayers.find((u) => u.id === r);
628
- if (!s)
629
- return `Could not find layer for id: ${r}`;
628
+ const l = r, i = e?.allLayers.find((u) => u.id === t);
629
+ if (!i)
630
+ return `Could not find layer for id: ${t}`;
630
631
  const c = {
631
632
  styleName: "color-size-univariate",
632
633
  fields: a,
633
- layer: s,
634
+ layer: i,
634
635
  view: l,
635
636
  colorSchemeTags: o,
636
637
  theme: n
637
638
  };
638
639
  try {
639
- const u = lr(c), d = await cr(u);
640
- return s.renderer = d.renderer, s.visible = !0, `Color-size-univariate renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
640
+ const u = cr(c), d = await ur(u);
641
+ return i.renderer = d.renderer, i.visible = !0, `Color-size-univariate renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
641
642
  } catch (u) {
642
643
  return `Error applying color-size-univariate renderer: ${u instanceof Error ? u.message : String(u)}`;
643
644
  }
644
645
  }
645
- async function dr({
646
+ async function pr({
646
647
  layerId: e,
647
- fields: t,
648
- colorSchemes: r,
648
+ fields: r,
649
+ colorSchemes: t,
649
650
  theme: a
650
651
  }, o) {
651
652
  const { mapView: n } = R(o);
652
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await ur({
653
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await dr({
653
654
  arcgisMap: n.map,
654
655
  arcgisMapView: n,
655
656
  layerId: e,
656
- fields: t,
657
- colorSchemes: r,
657
+ fields: r,
658
+ colorSchemes: t,
658
659
  theme: a
659
660
  });
660
661
  }
661
- const pr = i.object({
662
- layerId: i.string().describe("The id of the layer to apply the color-size univariate renderer to"),
663
- fields: i.array(i.string()).describe("The fields to use for the color-size univariate renderer"),
664
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
665
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
666
- }), jn = f(dr, {
662
+ const hr = s.object({
663
+ layerId: s.string().describe("The id of the layer to apply the color-size univariate renderer to"),
664
+ fields: s.array(s.string()).describe("The fields to use for the color-size univariate renderer"),
665
+ colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
666
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color and size ramps")
667
+ }), Gn = w(pr, {
667
668
  name: "color-size-univariate",
668
669
  description: `Label: Color and Size (univariate)
669
670
  Description: Vary symbol size and color based on the values of two numeric attributes.
670
671
  Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
671
672
  Example: Color each feature based on the percentage of the population that owns a home and vary the size of each point based on total population.
672
673
  Fields: This style requires at least two fields: one determining the color of each feature, the other determining the size of each feature. Each field may be normalized by an additional normalization field.`,
673
- schema: pr
674
+ schema: hr
674
675
  });
675
- function hr(e) {
676
- const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
676
+ function mr(e) {
677
+ const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
677
678
  let n;
678
679
  return o && (n = Ke({
679
680
  includedTags: o,
680
- numColors: Math.min(t.length, 8)
681
+ numColors: Math.min(r.length, 8)
681
682
  })[0]), {
682
- layer: r,
683
+ layer: t,
683
684
  view: a,
684
685
  legendOptions: {
685
686
  unit: "units"
686
687
  },
687
- attributes: t.map((l) => ({
688
+ attributes: r.map((l) => ({
688
689
  field: l,
689
- label: r.fields.find((s) => s.name === l)?.alias ?? ""
690
+ label: t.fields.find((i) => i.name === l)?.alias ?? ""
690
691
  })).slice(0, 8),
691
692
  outlineOptimizationEnabled: !0,
692
693
  dotDensityScheme: n
693
694
  };
694
695
  }
695
- async function mr(e) {
696
- return await Ue(e);
696
+ async function yr(e) {
697
+ return await Be(e);
697
698
  }
698
- async function yr({
699
+ async function fr({
699
700
  arcgisMap: e,
700
- arcgisMapView: t,
701
- layerId: r,
701
+ arcgisMapView: r,
702
+ layerId: t,
702
703
  fields: a,
703
704
  colorSchemes: o
704
705
  }) {
705
- const n = t, l = e?.allLayers.find((c) => c.id === r);
706
+ const n = r, l = e?.allLayers.find((c) => c.id === t);
706
707
  if (!l)
707
- return `Could not find layer for id: ${r}`;
708
- const s = {
708
+ return `Could not find layer for id: ${t}`;
709
+ const i = {
709
710
  styleName: "dot-density",
710
711
  fields: a,
711
712
  layer: l,
@@ -713,31 +714,31 @@ async function yr({
713
714
  colorSchemeTags: o
714
715
  };
715
716
  try {
716
- const c = hr(s), u = await mr(c);
717
+ const c = mr(i), u = await yr(c);
717
718
  return l.renderer = u.renderer, l.visible = !0, `Dot Density renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
718
719
  } catch (c) {
719
720
  return `Error applying dot density renderer: ${c instanceof Error ? c.message : String(c)}`;
720
721
  }
721
722
  }
722
- async function fr({
723
+ async function gr({
723
724
  layerId: e,
724
- fields: t,
725
- colorSchemes: r
725
+ fields: r,
726
+ colorSchemes: t
726
727
  }, a) {
727
728
  const { mapView: o } = R(a);
728
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await yr({
729
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await fr({
729
730
  arcgisMap: o.map,
730
731
  arcgisMapView: o,
731
732
  layerId: e,
732
- fields: t,
733
- colorSchemes: r
733
+ fields: r,
734
+ colorSchemes: t
734
735
  });
735
736
  }
736
- const gr = i.object({
737
- layerId: i.string().describe("The id of the layer to apply the dot density renderer to"),
738
- fields: i.array(i.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
739
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
740
- }), Gn = f(fr, {
737
+ const wr = s.object({
738
+ layerId: s.string().describe("The id of the layer to apply the dot density renderer to"),
739
+ fields: s.array(s.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
740
+ colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
741
+ }), On = w(gr, {
741
742
  name: "dot-density",
742
743
  description: `Dot Density
743
744
  Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
@@ -751,36 +752,36 @@ const gr = i.object({
751
752
  - Display demographic patterns within census tracts
752
753
  **Fields:** Requires 2-8 number fields.
753
754
  **Keywords:** density, how much, how many, total, number, amount`,
754
- schema: gr
755
+ schema: wr
755
756
  });
756
- function wr(e) {
757
- const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
757
+ function br(e) {
758
+ const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
758
759
  let n;
759
- const l = t[0];
760
- return o && (n = He({
760
+ const l = r[0];
761
+ return o && (n = Je({
761
762
  includedTags: o,
762
763
  basemap: a.map?.basemap || "topo"
763
764
  })[0]), {
764
- layer: r,
765
+ layer: t,
765
766
  view: a,
766
767
  field: l,
767
768
  heatmapScheme: n
768
769
  };
769
770
  }
770
- async function br(e) {
771
- return await Be(e);
771
+ async function Tr(e) {
772
+ return await He(e);
772
773
  }
773
- async function Tr({
774
+ async function vr({
774
775
  arcgisMap: e,
775
- arcgisMapView: t,
776
- layerId: r,
776
+ arcgisMapView: r,
777
+ layerId: t,
777
778
  fields: a,
778
779
  colorSchemes: o
779
780
  }) {
780
- const n = t, l = e?.allLayers.find((c) => c.id === r);
781
+ const n = r, l = e?.allLayers.find((c) => c.id === t);
781
782
  if (!l)
782
- return `Could not find layer for id: ${r}`;
783
- const s = {
783
+ return `Could not find layer for id: ${t}`;
784
+ const i = {
784
785
  styleName: "heatmap",
785
786
  fields: a,
786
787
  layer: l,
@@ -788,106 +789,106 @@ async function Tr({
788
789
  colorSchemeTags: o
789
790
  };
790
791
  try {
791
- const c = wr(s), u = await br(c);
792
+ const c = br(i), u = await Tr(c);
792
793
  return l.renderer = u.renderer, l.visible = !0, `Heatmap renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
793
794
  } catch (c) {
794
795
  return `Error applying heatmap renderer: ${c instanceof Error ? c.message : String(c)}`;
795
796
  }
796
797
  }
797
- async function vr({
798
+ async function Sr({
798
799
  layerId: e,
799
- fields: t,
800
- colorSchemes: r
800
+ fields: r,
801
+ colorSchemes: t
801
802
  }, a) {
802
803
  const { mapView: o } = R(a);
803
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await Tr({
804
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await vr({
804
805
  arcgisMap: o.map,
805
806
  arcgisMapView: o,
806
807
  layerId: e,
807
- fields: t,
808
- colorSchemes: r
808
+ fields: r,
809
+ colorSchemes: t
809
810
  });
810
811
  }
811
- const Sr = i.object({
812
- layerId: i.string().describe("The id of the layer to apply the heatmap renderer to"),
813
- fields: i.array(i.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
814
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
815
- }), On = f(vr, {
812
+ const xr = s.object({
813
+ layerId: s.string().describe("The id of the layer to apply the heatmap renderer to"),
814
+ fields: s.array(s.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
815
+ colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
816
+ }), Mn = w(Sr, {
816
817
  name: "heatmap",
817
818
  description: `Label: Heat Map
818
819
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
819
820
  Keywords: density, heatmap, hot spots, pattern, cluster
820
821
  Example: Create a heatmap
821
822
  Fields: This typically requires zero or one field of type number.`,
822
- schema: Sr
823
+ schema: xr
823
824
  });
824
- function xr(e) {
825
- const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
825
+ function Rr(e) {
826
+ const { fields: r, layer: t, view: a, styleName: o, colorSchemeTags: n } = e;
826
827
  let l;
827
- return n && (l = Ze({
828
- geometryType: r.geometryType,
828
+ return n && (l = Ye({
829
+ geometryType: t.geometryType,
829
830
  includedTags: n,
830
- numColors: Math.min(t.length, 10)
831
+ numColors: Math.min(r.length, 10)
831
832
  })[0]), {
832
- layer: r,
833
+ layer: t,
833
834
  view: a,
834
- fields: t.map((s) => ({ name: s })).slice(0, 9),
835
+ fields: r.map((i) => ({ name: i })).slice(0, 9),
835
836
  outlineOptimizationEnabled: !0,
836
837
  sizeOptimizationEnabled: !0,
837
838
  includeSizeVariable: o.includes("Size"),
838
839
  predominanceScheme: l
839
840
  };
840
841
  }
841
- async function Rr(e) {
842
- return await Je(e);
842
+ async function $r(e) {
843
+ return await Ze(e);
843
844
  }
844
- async function $r({
845
+ async function Cr({
845
846
  arcgisMap: e,
846
- arcgisMapView: t,
847
- layerId: r,
847
+ arcgisMapView: r,
848
+ layerId: t,
848
849
  fields: a,
849
850
  colorSchemes: o,
850
851
  includeSize: n
851
852
  }) {
852
- const l = t, s = e?.allLayers.find((d) => d.id === r);
853
- if (!s)
854
- return `Could not find layer for id: ${r}`;
853
+ const l = r, i = e?.allLayers.find((d) => d.id === t);
854
+ if (!i)
855
+ return `Could not find layer for id: ${t}`;
855
856
  const u = {
856
857
  styleName: n ? "predominance-size" : "predominance",
857
858
  fields: a,
858
- layer: s,
859
+ layer: i,
859
860
  view: l,
860
861
  colorSchemeTags: o
861
862
  };
862
863
  try {
863
- const d = xr(u), p = await Rr(d);
864
- return s.renderer = p.renderer, s.visible = !0, `Predominance renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
864
+ const d = Rr(u), p = await $r(d);
865
+ return i.renderer = p.renderer, i.visible = !0, `Predominance renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
865
866
  } catch (d) {
866
867
  return `Error applying predominance renderer: ${d instanceof Error ? d.message : String(d)}`;
867
868
  }
868
869
  }
869
- async function Cr({
870
+ async function Er({
870
871
  layerId: e,
871
- fields: t,
872
- colorSchemes: r,
872
+ fields: r,
873
+ colorSchemes: t,
873
874
  includeSize: a
874
875
  }, o) {
875
876
  const { mapView: n } = R(o);
876
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await $r({
877
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Cr({
877
878
  arcgisMap: n.map,
878
879
  arcgisMapView: n,
879
880
  layerId: e,
880
- fields: t,
881
- colorSchemes: r,
881
+ fields: r,
882
+ colorSchemes: t,
882
883
  includeSize: a
883
884
  });
884
885
  }
885
- const Er = i.object({
886
- layerId: i.string().describe("The id of the layer to apply the predominance renderer to"),
887
- fields: i.array(i.string()).describe("The fields to use for the predominance renderer (competing categories)"),
888
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
889
- includeSize: i.boolean().optional().describe("Whether to include size visualization (predominance-size)")
890
- }), Mn = f(Cr, {
886
+ const Fr = s.object({
887
+ layerId: s.string().describe("The id of the layer to apply the predominance renderer to"),
888
+ fields: s.array(s.string()).describe("The fields to use for the predominance renderer (competing categories)"),
889
+ colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
890
+ includeSize: s.boolean().optional().describe("Whether to include size visualization (predominance-size)")
891
+ }), Qn = w(Er, {
891
892
  name: "predominance",
892
893
  description: `Label: Predominant category
893
894
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
@@ -900,43 +901,43 @@ const Er = i.object({
900
901
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
901
902
  Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
902
903
  Fields: This style relies on 2-10 number fields.`,
903
- schema: Er
904
+ schema: Fr
904
905
  });
905
- function Nr(e) {
906
- const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
906
+ function kr(e) {
907
+ const { fields: r, layer: t, view: a, colorSchemeTags: o } = e;
907
908
  let n;
908
909
  const l = {
909
- field: t[0]
910
- }, s = {
911
- field: t[1]
910
+ field: r[0]
911
+ }, i = {
912
+ field: r[1]
912
913
  };
913
- return o && (n = Xe({
914
- geometryType: r.geometryType,
914
+ return o && (n = et({
915
+ geometryType: t.geometryType,
915
916
  includedTags: o
916
917
  })[0]), {
917
- layer: r,
918
+ layer: t,
918
919
  view: a,
919
920
  field1: l,
920
- field2: s,
921
+ field2: i,
921
922
  outlineOptimizationEnabled: !0,
922
923
  sizeOptimizationEnabled: !0,
923
924
  relationshipScheme: n
924
925
  };
925
926
  }
926
- async function Ir(e) {
927
- return await Ye(e);
927
+ async function Nr(e) {
928
+ return await Xe(e);
928
929
  }
929
- async function kr({
930
+ async function qr({
930
931
  arcgisMap: e,
931
- arcgisMapView: t,
932
- layerId: r,
932
+ arcgisMapView: r,
933
+ layerId: t,
933
934
  fields: a,
934
935
  colorSchemes: o
935
936
  }) {
936
- const n = t, l = e?.allLayers.find((c) => c.id === r);
937
+ const n = r, l = e?.allLayers.find((c) => c.id === t);
937
938
  if (!l)
938
- return `Could not find layer for id: ${r}`;
939
- const s = {
939
+ return `Could not find layer for id: ${t}`;
940
+ const i = {
940
941
  styleName: "relationship",
941
942
  fields: a,
942
943
  layer: l,
@@ -944,31 +945,31 @@ async function kr({
944
945
  colorSchemeTags: o
945
946
  };
946
947
  try {
947
- const c = Nr(s), u = await Ir(c);
948
+ const c = kr(i), u = await Nr(c);
948
949
  return l.renderer = u.renderer, l.visible = !0, `Relationship renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
949
950
  } catch (c) {
950
951
  return `Error applying relationship renderer: ${c instanceof Error ? c.message : String(c)}`;
951
952
  }
952
953
  }
953
- async function Fr({
954
+ async function Ir({
954
955
  layerId: e,
955
- fields: t,
956
- colorSchemes: r
956
+ fields: r,
957
+ colorSchemes: t
957
958
  }, a) {
958
959
  const { mapView: o } = R(a);
959
- return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await kr({
960
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, a), await qr({
960
961
  arcgisMap: o.map,
961
962
  arcgisMapView: o,
962
963
  layerId: e,
963
- fields: t,
964
- colorSchemes: r
964
+ fields: r,
965
+ colorSchemes: t
965
966
  });
966
967
  }
967
- const zr = i.object({
968
- layerId: i.string().describe("The id of the layer to apply the relationship renderer to"),
969
- fields: i.array(i.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
970
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use")
971
- }), Qn = f(Fr, {
968
+ const zr = s.object({
969
+ layerId: s.string().describe("The id of the layer to apply the relationship renderer to"),
970
+ fields: s.array(s.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
971
+ colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
972
+ }), _n = w(Ir, {
972
973
  name: "relationship",
973
974
  description: `Label: Relationship
974
975
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
@@ -977,10 +978,10 @@ const zr = i.object({
977
978
  Fields: This style requires two number fields.`,
978
979
  schema: zr
979
980
  });
980
- function qr(e) {
981
- const { fields: t, layer: r, view: a, theme: o } = e, n = t[0];
981
+ function Dr(e) {
982
+ const { fields: r, layer: t, view: a, theme: o } = e, n = r[0];
982
983
  return {
983
- layer: r,
984
+ layer: t,
984
985
  view: a,
985
986
  startTime: n,
986
987
  endTime: /* @__PURE__ */ new Date(),
@@ -989,39 +990,39 @@ function qr(e) {
989
990
  outlineOptimizationEnabled: !0
990
991
  };
991
992
  }
992
- async function Dr(e) {
993
- return await et(e);
993
+ async function Pr(e) {
994
+ return await tt(e);
994
995
  }
995
996
  async function Ar({
996
997
  arcgisMap: e,
997
- arcgisMapView: t,
998
- layerId: r,
998
+ arcgisMapView: r,
999
+ layerId: t,
999
1000
  fields: a,
1000
1001
  colorSchemes: o,
1001
1002
  theme: n
1002
1003
  }) {
1003
- const l = t, s = e?.allLayers.find((u) => u.id === r);
1004
- if (!s)
1005
- return `Could not find layer for id: ${r}`;
1004
+ const l = r, i = e?.allLayers.find((u) => u.id === t);
1005
+ if (!i)
1006
+ return `Could not find layer for id: ${t}`;
1006
1007
  const c = {
1007
1008
  styleName: "size-age",
1008
1009
  fields: a,
1009
- layer: s,
1010
+ layer: i,
1010
1011
  view: l,
1011
1012
  colorSchemeTags: o,
1012
1013
  theme: n
1013
1014
  };
1014
1015
  try {
1015
- const u = qr(c), d = await Dr(u);
1016
- return s.renderer = d.renderer, s.visible = !0, `Size-age renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
1016
+ const u = Dr(c), d = await Pr(u);
1017
+ return i.renderer = d.renderer, i.visible = !0, `Size-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1017
1018
  } catch (u) {
1018
1019
  return `Error applying size-age renderer: ${u instanceof Error ? u.message : String(u)}`;
1019
1020
  }
1020
1021
  }
1021
- async function Pr({
1022
+ async function jr({
1022
1023
  layerId: e,
1023
- fields: t,
1024
- colorSchemes: r,
1024
+ fields: r,
1025
+ colorSchemes: t,
1025
1026
  theme: a
1026
1027
  }, o) {
1027
1028
  const { mapView: n } = R(o);
@@ -1029,17 +1030,17 @@ async function Pr({
1029
1030
  arcgisMap: n.map,
1030
1031
  arcgisMapView: n,
1031
1032
  layerId: e,
1032
- fields: t,
1033
- colorSchemes: r,
1033
+ fields: r,
1034
+ colorSchemes: t,
1034
1035
  theme: a
1035
1036
  });
1036
1037
  }
1037
- const Lr = i.object({
1038
- layerId: i.string().describe("The id of the layer to apply the size-age renderer to"),
1039
- fields: i.array(i.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
1040
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1041
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1042
- }), _n = f(Pr, {
1038
+ const Lr = s.object({
1039
+ layerId: s.string().describe("The id of the layer to apply the size-age renderer to"),
1040
+ fields: s.array(s.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
1041
+ colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1042
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1043
+ }), Wn = w(jr, {
1043
1044
  name: "size-age",
1044
1045
  description: `Label: Age (size)
1045
1046
  Description: Vary symbol sizes along a continuous ramp to represent the age of features. Age reflects the length of time from a start date to an end date.
@@ -1048,12 +1049,12 @@ const Lr = i.object({
1048
1049
  Fields: This style requires at least one field with a date type.`,
1049
1050
  schema: Lr
1050
1051
  });
1051
- function jr(e) {
1052
- const { fields: t, layer: r, view: a } = e;
1053
- let { theme: o } = e, n = t[1];
1054
- const l = t[0];
1052
+ function Gr(e) {
1053
+ const { fields: r, layer: t, view: a } = e;
1054
+ let { theme: o } = e, n = r[1];
1055
+ const l = r[0];
1055
1056
  return {
1056
- layer: r,
1057
+ layer: t,
1057
1058
  view: a,
1058
1059
  field: l,
1059
1060
  normalizationField: n,
@@ -1062,57 +1063,57 @@ function jr(e) {
1062
1063
  outlineOptimizationEnabled: !0
1063
1064
  };
1064
1065
  }
1065
- async function Gr(e) {
1066
- return await tt(e);
1066
+ async function Or(e) {
1067
+ return await rt(e);
1067
1068
  }
1068
- async function Or({
1069
+ async function Mr({
1069
1070
  arcgisMap: e,
1070
- arcgisMapView: t,
1071
- layerId: r,
1071
+ arcgisMapView: r,
1072
+ layerId: t,
1072
1073
  fields: a,
1073
1074
  colorSchemes: o,
1074
1075
  theme: n
1075
1076
  }) {
1076
- const l = t, s = e?.allLayers.find((u) => u.id === r);
1077
- if (!s)
1078
- return `Could not find layer for id: ${r}`;
1077
+ const l = r, i = e?.allLayers.find((u) => u.id === t);
1078
+ if (!i)
1079
+ return `Could not find layer for id: ${t}`;
1079
1080
  const c = {
1080
1081
  styleName: "size",
1081
1082
  fields: a,
1082
- layer: s,
1083
+ layer: i,
1083
1084
  view: l,
1084
1085
  colorSchemeTags: o,
1085
1086
  theme: n
1086
1087
  };
1087
1088
  try {
1088
- const u = jr(c), d = await Gr(u);
1089
- return s.renderer = d.renderer, s.visible = !0, `Size renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
1089
+ const u = Gr(c), d = await Or(u);
1090
+ return i.renderer = d.renderer, i.visible = !0, `Size renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1090
1091
  } catch (u) {
1091
1092
  return `Error applying size renderer: ${u instanceof Error ? u.message : String(u)}`;
1092
1093
  }
1093
1094
  }
1094
- async function Mr({
1095
+ async function Qr({
1095
1096
  layerId: e,
1096
- fields: t,
1097
- colorSchemes: r,
1097
+ fields: r,
1098
+ colorSchemes: t,
1098
1099
  theme: a
1099
1100
  }, o) {
1100
1101
  const { mapView: n } = R(o);
1101
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Or({
1102
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Mr({
1102
1103
  arcgisMap: n.map,
1103
1104
  arcgisMapView: n,
1104
1105
  layerId: e,
1105
- fields: t,
1106
- colorSchemes: r,
1106
+ fields: r,
1107
+ colorSchemes: t,
1107
1108
  theme: a
1108
1109
  });
1109
1110
  }
1110
- const Qr = i.object({
1111
- layerId: i.string().describe("The id of the layer to apply the size renderer to"),
1112
- fields: i.array(i.string()).describe("The field(s) to use for the size renderer (numeric data)"),
1113
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1114
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1115
- }), Wn = f(Mr, {
1111
+ const _r = s.object({
1112
+ layerId: s.string().describe("The id of the layer to apply the size renderer to"),
1113
+ fields: s.array(s.string()).describe("The field(s) to use for the size renderer (numeric data)"),
1114
+ colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1115
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1116
+ }), Vn = w(Qr, {
1116
1117
  name: "size",
1117
1118
  description: `Label: Counts and Amounts (size)
1118
1119
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
@@ -1125,76 +1126,76 @@ const Qr = i.object({
1125
1126
  Keywords: graduated size, proportional size, classed size, how much, total, number, when
1126
1127
  Example: Vary the size of each feature based on the date a ticket was completed.
1127
1128
  Fields: This style requires a single field with a date type.`,
1128
- schema: Qr
1129
+ schema: _r
1129
1130
  });
1130
- function _r(e) {
1131
- const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], l = t[1], s = t[2];
1131
+ function Wr(e) {
1132
+ const { fields: r, layer: t, view: a, colorSchemeTags: o } = e, n = r[0], l = r[1], i = r[2];
1132
1133
  let c;
1133
- return o && (c = at({
1134
- geometryType: r.geometryType,
1134
+ return o && (c = ot({
1135
+ geometryType: t.geometryType,
1135
1136
  includedTags: o
1136
1137
  })[0]), {
1137
- layer: r,
1138
+ layer: t,
1138
1139
  view: a,
1139
1140
  field: n,
1140
1141
  field2: l,
1141
- field3: s,
1142
+ field3: i,
1142
1143
  outlineOptimizationEnabled: !0,
1143
1144
  sizeOptimizationEnabled: !0,
1144
1145
  typeScheme: c
1145
1146
  };
1146
1147
  }
1147
- async function Wr(e) {
1148
- return await rt(e);
1148
+ async function Vr(e) {
1149
+ return await at(e);
1149
1150
  }
1150
- async function Vr({
1151
+ async function Ur({
1151
1152
  arcgisMap: e,
1152
- arcgisMapView: t,
1153
- layerId: r,
1153
+ arcgisMapView: r,
1154
+ layerId: t,
1154
1155
  fields: a,
1155
1156
  colorSchemes: o,
1156
1157
  theme: n
1157
1158
  }) {
1158
- const l = t, s = e?.allLayers.find((u) => u.id === r);
1159
- if (!s)
1160
- return `Could not find layer for id: ${r}`;
1159
+ const l = r, i = e?.allLayers.find((u) => u.id === t);
1160
+ if (!i)
1161
+ return `Could not find layer for id: ${t}`;
1161
1162
  const c = {
1162
1163
  styleName: "type",
1163
1164
  fields: a,
1164
- layer: s,
1165
+ layer: i,
1165
1166
  view: l,
1166
1167
  colorSchemeTags: o,
1167
1168
  theme: n
1168
1169
  };
1169
1170
  try {
1170
- const u = _r(c), d = await Wr(u);
1171
- return s.renderer = d.renderer, s.visible = !0, `Type renderer applied to layer: ${s.title ?? s.id} using fields ${a.join(", ")}`;
1171
+ const u = Wr(c), d = await Vr(u);
1172
+ return i.renderer = d.renderer, i.visible = !0, `Type renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1172
1173
  } catch (u) {
1173
1174
  return `Error applying type renderer: ${u instanceof Error ? u.message : String(u)}`;
1174
1175
  }
1175
1176
  }
1176
- async function Ur({
1177
+ async function Br({
1177
1178
  layerId: e,
1178
- fields: t,
1179
- colorSchemes: r,
1179
+ fields: r,
1180
+ colorSchemes: t,
1180
1181
  theme: a
1181
1182
  }, o) {
1182
1183
  const { mapView: n } = R(o);
1183
- return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Vr({
1184
+ return await x({ type: "show-legend", data: { layerIds: [e] } }, o), await Ur({
1184
1185
  arcgisMap: n.map,
1185
1186
  arcgisMapView: n,
1186
1187
  layerId: e,
1187
- fields: t,
1188
- colorSchemes: r,
1188
+ fields: r,
1189
+ colorSchemes: t,
1189
1190
  theme: a
1190
1191
  });
1191
1192
  }
1192
- const Kr = i.object({
1193
- layerId: i.string().describe("The id of the layer to apply the type renderer to"),
1194
- fields: i.array(i.string()).describe("The field(s) to use for the type renderer (categorical data)"),
1195
- colorSchemes: i.array(i.string()).optional().describe("Optional color scheme tags to use"),
1196
- theme: i.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
1197
- }), Vn = f(Ur, {
1193
+ const Kr = s.object({
1194
+ layerId: s.string().describe("The id of the layer to apply the type renderer to"),
1195
+ fields: s.array(s.string()).describe("The field(s) to use for the type renderer (categorical data)"),
1196
+ colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1197
+ theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
1198
+ }), Un = w(Br, {
1198
1199
  name: "type",
1199
1200
  description: `Label: Types (unique symbols)
1200
1201
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
@@ -1202,119 +1203,119 @@ Keywords: categorical, category, type, unique, discrete, point of interest, regi
1202
1203
  Example: Color each feature based on the region it belongs to
1203
1204
  Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
1204
1205
  schema: Kr
1205
- }), Un = b.Root({
1206
- ...B(),
1206
+ }), Bn = b.Root({
1207
+ ...H(),
1207
1208
  vectorSearchLayerIds: b(),
1208
1209
  vectorSearchFieldResults: b(),
1209
1210
  layerFieldInfo: b(),
1210
1211
  selectedLayerId: b()
1211
1212
  }), Kn = b.Root({
1212
- ...B(),
1213
+ ...H(),
1213
1214
  vectorSearchLayerIds: b(),
1214
1215
  vectorSearchFieldResults: b(),
1215
1216
  layerFieldInfo: b(),
1216
1217
  queryResponse: b(),
1217
1218
  dataExplorationMessages: b({
1218
- reducer: Te,
1219
+ reducer: be,
1219
1220
  default: () => []
1220
1221
  })
1221
- }), Br = ["mapView"];
1222
- function k(e) {
1223
- const r = e?.configurable?.context;
1224
- if (!r || typeof r != "object")
1222
+ }), Hr = ["mapView"];
1223
+ function N(e) {
1224
+ const t = e?.configurable?.context;
1225
+ if (!t || typeof t != "object")
1225
1226
  throw new Error("DataExplorationAgent context missing");
1226
- const a = Br.filter((o) => !(o in r));
1227
+ const a = Hr.filter((o) => !(o in t));
1227
1228
  if (a.length)
1228
1229
  throw new Error(`DataExplorationAgent context missing: ${a.join(", ")}`);
1229
- return r;
1230
+ return t;
1230
1231
  }
1231
- const Hr = (e) => {
1232
- const t = e.map?.allLayers.filter((a) => a.type === "feature");
1233
- let r = 0;
1234
- return t?.forEach((a) => {
1232
+ const Jr = (e) => {
1233
+ const r = e.map?.allLayers.filter((a) => a.type === "feature");
1234
+ let t = 0;
1235
+ return r?.forEach((a) => {
1235
1236
  const o = a;
1236
- o.featureEffect && (o.featureEffect = null, r++);
1237
- }), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
1238
- }, Jr = async (e, t) => {
1239
- const { mapView: r } = k(t);
1240
- return Hr(r);
1241
- }, Zr = f(Jr, {
1237
+ o.featureEffect && (o.featureEffect = null, t++);
1238
+ }), t > 0 ? `Cleared filters from ${t} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
1239
+ }, Zr = async (e, r) => {
1240
+ const { mapView: t } = N(r);
1241
+ return Jr(t);
1242
+ }, Yr = w(Zr, {
1242
1243
  name: "clearFilters",
1243
1244
  description: "Clears all feature effects/filters from the map but does NOT change the current view. Use when user says 'clear filters', 'reset filters', 'remove filters', 'show all features', or wants to remove emphasis without navigating anywhere.",
1244
- schema: i.object({})
1245
- }), Yr = async (e) => {
1245
+ schema: s.object({})
1246
+ }), Xr = async (e) => {
1246
1247
  e.map?.allLayers.filter((o) => o.type === "feature")?.forEach((o) => {
1247
1248
  const n = o;
1248
1249
  n.featureEffect && (n.featureEffect = null);
1249
1250
  });
1250
1251
  const a = e.map.initialViewProperties?.viewpoint?.targetGeometry;
1251
1252
  return a ? (await e.goTo(a), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
1252
- }, Xr = async (e, t) => {
1253
- const { mapView: r } = k(t);
1254
- return await Yr(r);
1255
- }, ea = f(Xr, {
1253
+ }, ea = async (e, r) => {
1254
+ const { mapView: t } = N(r);
1255
+ return await Xr(t);
1256
+ }, ta = w(ea, {
1256
1257
  name: "resetMap",
1257
1258
  description: "Clears all feature effects/filters from the map AND zooms to the home extent (initial map view). Use when user says 'reset map', 'reset the map', 'start over', or wants to both clear filters and return to the initial view.",
1258
- schema: i.object({})
1259
- }), be = 750;
1260
- function U(e) {
1259
+ schema: s.object({})
1260
+ }), we = 750;
1261
+ function B(e) {
1261
1262
  return "point" in e && e.point !== void 0;
1262
1263
  }
1263
- function j(e) {
1264
+ function L(e) {
1264
1265
  return "layerId" in e && e.layerId !== void 0;
1265
1266
  }
1266
- const H = async (e, t) => {
1267
- if (U(e)) {
1268
- const { point: r } = e;
1269
- return { geometry: new ve({
1270
- x: r.x,
1271
- y: r.y,
1272
- spatialReference: r.spatialReference ? { wkid: r.spatialReference.wkid } : t.spatialReference
1267
+ const J = async (e, r) => {
1268
+ if (B(e)) {
1269
+ const { point: t } = e;
1270
+ return { geometry: new Te({
1271
+ x: t.x,
1272
+ y: t.y,
1273
+ spatialReference: t.spatialReference ? { wkid: t.spatialReference.wkid } : r.spatialReference
1273
1274
  }) };
1274
1275
  }
1275
- if (j(e)) {
1276
- const r = t.map?.allLayers.find(
1276
+ if (L(e)) {
1277
+ const t = r.map?.allLayers.find(
1277
1278
  (n) => n.id === e.layerId
1278
1279
  );
1279
- if (!r)
1280
+ if (!t)
1280
1281
  return { error: `Could not find geometry layer with ID: ${e.layerId}` };
1281
- const a = r.title ?? r.id, o = e.where?.trim() || "1=1";
1282
+ const a = t.title ?? t.id, o = e.where?.trim() || "1=1";
1282
1283
  try {
1283
- const n = await r.queryFeatures({
1284
+ const n = await t.queryFeatures({
1284
1285
  where: o,
1285
1286
  returnGeometry: !0,
1286
- outSpatialReference: t.spatialReference,
1287
- num: be + 1
1287
+ outSpatialReference: r.spatialReference,
1288
+ num: we + 1
1288
1289
  });
1289
1290
  if (!n.features.length)
1290
1291
  return {
1291
1292
  error: `No features found in geometry layer "${a}" with the specified where clause: ${o}`
1292
1293
  };
1293
- if (n.features.length > be)
1294
+ if (n.features.length > we)
1294
1295
  return {
1295
1296
  error: `Geometry filter for layer "${a}" matched too many features (${n.features.length}+). Please narrow the geometry layer filter.`
1296
1297
  };
1297
1298
  const l = n.features.map((c) => c.geometry).filter((c) => !!c);
1298
1299
  if (!l.length)
1299
1300
  return { error: "No valid geometries found for the matched geometry layer features." };
1300
- const s = l.length === 1 ? l[0] : it.executeMany(l);
1301
- return s ? (s.spatialReference || (s.spatialReference = t.spatialReference), { geometry: s }) : { error: "Failed to combine geometries from geometry layer." };
1301
+ const i = l.length === 1 ? l[0] : st.executeMany(l);
1302
+ return i ? (i.spatialReference || (i.spatialReference = r.spatialReference), { geometry: i }) : { error: "Failed to combine geometries from geometry layer." };
1302
1303
  } catch (n) {
1303
1304
  return { error: `Failed to query geometry: ${String(n)}` };
1304
1305
  }
1305
1306
  }
1306
1307
  return { error: "Invalid geometry configuration provided" };
1307
- }, ta = async (e, t, r, a, o, n) => {
1308
- const l = e.map?.allLayers.find((c) => c.id === t);
1308
+ }, ra = async (e, r, t, a, o, n) => {
1309
+ const l = e.map?.allLayers.find((c) => c.id === r);
1309
1310
  if (!l)
1310
- return { success: !1, error: `Layer '${t}' not found.` };
1311
- const s = l.createQuery();
1312
- s.where = r ?? "1=1", a && (s.geometry = a, s.spatialRelationship = "intersects", o && (s.distance = o), n && (s.units = n));
1311
+ return { success: !1, error: `Layer '${r}' not found.` };
1312
+ const i = l.createQuery();
1313
+ i.where = t ?? "1=1", a && (i.geometry = a, i.spatialRelationship = "intersects", o && (i.distance = o), n && (i.units = n));
1313
1314
  try {
1314
- const { extent: c, count: u } = await l.queryExtent(s);
1315
+ const { extent: c, count: u } = await l.queryExtent(i);
1315
1316
  return !c || u === 0 ? {
1316
1317
  success: !1,
1317
- error: `No features found for filter (where: ${s.where}${a ? ", spatial filter used" : ""})`
1318
+ error: `No features found for filter (where: ${i.where}${a ? ", spatial filter used" : ""})`
1318
1319
  } : (await e.goTo(c), { success: !0 });
1319
1320
  } catch (c) {
1320
1321
  return {
@@ -1322,351 +1323,351 @@ const H = async (e, t) => {
1322
1323
  error: c instanceof Error ? c.message : String(c)
1323
1324
  };
1324
1325
  }
1325
- }, ra = async (e, t, r, a, o, n) => {
1326
- const l = t.map?.allLayers.find(
1326
+ }, aa = async (e, r, t, a, o, n) => {
1327
+ const l = r.map?.allLayers.find(
1327
1328
  (p) => p.id === e.layerId
1328
1329
  );
1329
1330
  if (!l)
1330
1331
  return `Could not find target layer with ID: ${e.layerId}`;
1331
- let s;
1332
+ let i;
1332
1333
  if (o) {
1333
- const p = await H(o, t);
1334
+ const p = await J(o, r);
1334
1335
  if ("error" in p)
1335
1336
  return p.error;
1336
- s = p.geometry;
1337
+ i = p.geometry;
1337
1338
  }
1338
- if (l.featureEffect = null, l.featureEffect = new nt({
1339
- filter: new Se({
1339
+ if (l.featureEffect = null, l.featureEffect = new it({
1340
+ filter: new ve({
1340
1341
  ...e.objectIds?.length ? { objectIds: e.objectIds } : { where: e.where },
1341
- geometry: s,
1342
+ geometry: i,
1342
1343
  spatialRelationship: "intersects",
1343
1344
  distance: o?.distance,
1344
1345
  units: o?.units
1345
1346
  }),
1346
- includedEffect: r,
1347
+ includedEffect: t,
1347
1348
  excludedEffect: a
1348
1349
  }), l.visible = !0, n)
1349
1350
  return `Applied feature effects to "${l.title ?? e.layerId}" within current map extent.`;
1350
- const c = e.objectIds?.length ? `${l.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await ta(
1351
- t,
1351
+ const c = e.objectIds?.length ? `${l.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await ra(
1352
+ r,
1352
1353
  e.layerId,
1353
1354
  c,
1354
- s,
1355
+ i,
1355
1356
  o?.distance,
1356
1357
  o?.units
1357
1358
  ), d = l.title ?? e.layerId;
1358
1359
  return u.success ? `Applied feature effects to target layer "${l.title ?? e.layerId}"${o && "layerId" in o ? ` using geometry from layer "${o.layerId}"` : ""}.` : `Applied filter to "${d}" but no features matched. ${u.error}`;
1359
- }, aa = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], N = i.enum(aa), oa = async ({
1360
+ }, oa = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], F = s.enum(oa), na = async ({
1360
1361
  targetLayer: e,
1361
- geometryFilter: t,
1362
- useCurrentExtent: r,
1362
+ geometryFilter: r,
1363
+ useCurrentExtent: t,
1363
1364
  includedEffect: a = "drop-shadow(2px, 2px, 2px, gray)",
1364
1365
  excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
1365
1366
  }, n) => {
1366
- const { mapView: l } = k(n);
1367
- return await ra(e, l, a, o, t, r);
1368
- }, na = i.object({
1369
- layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1370
- where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1371
- distance: i.number().optional().describe("The buffer distance around the geometry."),
1372
- units: N.optional().describe("The units for the distance buffer.")
1373
- }), ia = i.object({
1374
- point: i.object({
1375
- x: i.number().describe("X coordinate (longitude) from navigation result"),
1376
- y: i.number().describe("Y coordinate (latitude) from navigation result"),
1377
- spatialReference: i.object({
1378
- wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1367
+ const { mapView: l } = N(n);
1368
+ return await aa(e, l, a, o, r, t);
1369
+ }, ia = s.object({
1370
+ layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1371
+ where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1372
+ distance: s.number().optional().describe("The buffer distance around the geometry."),
1373
+ units: F.optional().describe("The units for the distance buffer.")
1374
+ }), sa = s.object({
1375
+ point: s.object({
1376
+ x: s.number().describe("X coordinate (longitude) from navigation result"),
1377
+ y: s.number().describe("Y coordinate (latitude) from navigation result"),
1378
+ spatialReference: s.object({
1379
+ wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1379
1380
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1380
1381
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1381
- distance: i.number().optional().describe("Optional buffer distance around the point."),
1382
- units: N.optional().describe("The units for the distance buffer.")
1383
- }), sa = i.object({
1384
- targetLayer: i.object({
1385
- layerId: i.string().describe("The layerId of the layer on which to set a feature effect."),
1386
- where: i.string().describe("The SQL-92 where clause representing the features to emphasize."),
1387
- objectIds: i.array(i.number()).optional().describe(
1382
+ distance: s.number().optional().describe("Optional buffer distance around the point."),
1383
+ units: F.optional().describe("The units for the distance buffer.")
1384
+ }), la = s.object({
1385
+ targetLayer: s.object({
1386
+ layerId: s.string().describe("The layerId of the layer on which to set a feature effect."),
1387
+ where: s.string().describe("The SQL-92 where clause representing the features to emphasize."),
1388
+ objectIds: s.array(s.number()).optional().describe(
1388
1389
  "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."
1389
1390
  )
1390
1391
  }),
1391
- geometryFilter: i.union([na, ia]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1392
- useCurrentExtent: i.boolean().optional().describe(
1392
+ geometryFilter: s.union([ia, sa]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1393
+ useCurrentExtent: s.boolean().optional().describe(
1393
1394
  "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."
1394
1395
  ),
1395
- includedEffect: i.string().default("drop-shadow(2px, 2px, 2px, gray)").describe(
1396
+ includedEffect: s.string().default("drop-shadow(2px, 2px, 2px, gray)").describe(
1396
1397
  "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."
1397
1398
  ),
1398
- excludedEffect: i.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
1399
+ excludedEffect: s.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
1399
1400
  "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."
1400
1401
  )
1401
- }), la = f(oa, {
1402
+ }), ca = w(na, {
1402
1403
  name: "setFeatureEffect",
1403
1404
  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.",
1404
- schema: sa
1405
- }), re = (e) => {
1405
+ schema: la
1406
+ }), te = (e) => {
1406
1407
  if (e instanceof Date)
1407
1408
  return Number.isNaN(e.getTime()) ? null : e;
1408
1409
  if (typeof e == "number" && Number.isFinite(e)) {
1409
- const t = new Date(e);
1410
- return Number.isNaN(t.getTime()) ? null : t;
1410
+ const r = new Date(e);
1411
+ return Number.isNaN(r.getTime()) ? null : r;
1411
1412
  }
1412
1413
  return null;
1413
- }, ca = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ua = (e) => {
1414
+ }, ua = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, da = (e) => {
1414
1415
  if (typeof e == "string" && e)
1415
1416
  return e;
1416
- const t = re(e);
1417
- return t ? t.toISOString().slice(0, 10) : null;
1418
- }, Bn = () => {
1419
- const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), t = e <= 0 ? "+" : "-", r = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), a = (Math.abs(e) % 60).toString().padStart(2, "0"), o = `${t}${r}:${a}`;
1417
+ const r = te(e);
1418
+ return r ? r.toISOString().slice(0, 10) : null;
1419
+ }, Hn = () => {
1420
+ const e = (/* @__PURE__ */ new Date()).getTimezoneOffset(), r = e <= 0 ? "+" : "-", t = Math.floor(Math.abs(e) / 60).toString().padStart(2, "0"), a = (Math.abs(e) % 60).toString().padStart(2, "0"), o = `${r}${t}:${a}`;
1420
1421
  return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
1421
- }, da = (e, t, r) => {
1422
- const a = t?.toLowerCase();
1422
+ }, pa = (e, r, t) => {
1423
+ const a = r?.toLowerCase();
1423
1424
  if (a === "date-only") {
1424
- const n = ua(e);
1425
- return n ? st(n, Q("short-date")) : e;
1425
+ const n = da(e);
1426
+ return n ? lt(n, _("short-date")) : e;
1426
1427
  }
1427
1428
  if (a === "time-only") {
1428
1429
  if (typeof e == "string" && e)
1429
- return lt(e, Q("long-time"));
1430
- const n = re(e);
1431
- return n ? fe(n, {
1432
- ...Q("long-time"),
1430
+ return ct(e, _("long-time"));
1431
+ const n = te(e);
1432
+ return n ? ye(n, {
1433
+ ..._("long-time"),
1433
1434
  timeZone: "UTC"
1434
1435
  }) : e;
1435
1436
  }
1436
- const o = re(e);
1437
- return o ? fe(o, {
1438
- ...Q("short-date-short-time"),
1439
- timeZone: ca(r)
1437
+ const o = te(e);
1438
+ return o ? ye(o, {
1439
+ ..._("short-date-short-time"),
1440
+ timeZone: ua(t)
1440
1441
  }) : e;
1441
- }, $e = (e, t, r) => {
1442
+ }, Re = (e, r, t) => {
1442
1443
  if (e && typeof e != "function") {
1443
- const a = "getField" in r && r.getField?.(e), o = a && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(a.name) : null;
1444
+ const a = "getField" in t && t.getField?.(e), o = a && "getFieldDomain" in t && t.getFieldDomain ? t.getFieldDomain(a.name) : null;
1444
1445
  if (o?.type === "coded-value") {
1445
- const l = o.codedValues.find((s) => s.code === t);
1446
+ const l = o.codedValues.find((i) => i.code === r);
1446
1447
  return l ? l.name : null;
1447
1448
  }
1448
1449
  }
1449
1450
  return null;
1450
- }, pa = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ha = (e) => {
1451
+ }, ha = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ma = (e) => {
1451
1452
  if (e instanceof Date)
1452
1453
  return Number.isNaN(e.getTime()) ? null : e;
1453
1454
  if (typeof e == "number" && Number.isFinite(e)) {
1454
- const t = new Date(e);
1455
- return Number.isNaN(t.getTime()) ? null : t;
1455
+ const r = new Date(e);
1456
+ return Number.isNaN(r.getTime()) ? null : r;
1456
1457
  }
1457
1458
  if (typeof e == "string" && e) {
1458
- const t = new Date(e);
1459
- return Number.isNaN(t.getTime()) ? null : t;
1459
+ const r = new Date(e);
1460
+ return Number.isNaN(r.getTime()) ? null : r;
1460
1461
  }
1461
1462
  return null;
1462
- }, ma = (e, t) => {
1463
+ }, ya = (e, r) => {
1463
1464
  if (typeof e != "number")
1464
1465
  return e;
1465
- const r = {};
1466
- t.minimumFractionDigits !== void 0 && (r.minimumFractionDigits = t.minimumFractionDigits), t.maximumFractionDigits !== void 0 && (r.maximumFractionDigits = t.maximumFractionDigits), t.useGrouping === "always" ? r.useGrouping = !0 : t.useGrouping === "never" && (r.useGrouping = !1);
1466
+ const t = {};
1467
+ r.minimumFractionDigits !== void 0 && (t.minimumFractionDigits = r.minimumFractionDigits), r.maximumFractionDigits !== void 0 && (t.maximumFractionDigits = r.maximumFractionDigits), r.useGrouping === "always" ? t.useGrouping = !0 : r.useGrouping === "never" && (t.useGrouping = !1);
1467
1468
  try {
1468
- return new Intl.NumberFormat(void 0, r).format(e);
1469
+ return new Intl.NumberFormat(void 0, t).format(e);
1469
1470
  } catch {
1470
1471
  return e;
1471
1472
  }
1472
- }, ya = (e, t, r) => {
1473
- const a = ha(e);
1473
+ }, fa = (e, r, t) => {
1474
+ const a = ma(e);
1474
1475
  if (!a)
1475
1476
  return e;
1476
1477
  const o = {};
1477
- t.dateStyle ? o.dateStyle = t.dateStyle : (t.year && (o.year = t.year), t.month && (o.month = t.month)), t.timeStyle && (o.timeStyle = t.timeStyle), t.timeStyle && t.hour12 === "always" ? o.hour12 = !0 : t.timeStyle && t.hour12 === "never" && (o.hour12 = !1), o.timeZone = pa(r);
1478
+ r.dateStyle ? o.dateStyle = r.dateStyle : (r.year && (o.year = r.year), r.month && (o.month = r.month)), r.timeStyle && (o.timeStyle = r.timeStyle), r.timeStyle && r.hour12 === "always" ? o.hour12 = !0 : r.timeStyle && r.hour12 === "never" && (o.hour12 = !1), o.timeZone = ha(t);
1478
1479
  try {
1479
1480
  return new Intl.DateTimeFormat(void 0, o).format(a);
1480
1481
  } catch {
1481
1482
  return e;
1482
1483
  }
1483
- }, Ce = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Ee = (e, t, r, a, o) => {
1484
- if (r == null)
1485
- return r;
1486
- const l = e.getFieldConfiguration?.(t)?.fieldFormat;
1487
- return l?.type === "number" ? ma(r, l) : l?.type === "date-time" ? ya(r, l, o) : da(r, a, o);
1488
- }, fa = (e, t, r, a) => {
1489
- const o = e.fieldsIndex?.get(t), n = $e(t, r, e) ?? r;
1490
- return Ee(e, t, n, o?.type, a);
1491
- }, ga = (e, t) => Ce(e, t), Ne = (e, t, r) => {
1492
- const a = e.objectIdField, o = t.features.map(
1484
+ }, $e = (e, r) => e.getFieldAlias?.(r) ?? e.fieldsIndex?.get(r)?.alias ?? e.fieldsIndex?.get(r)?.name ?? r, Ce = (e, r, t, a, o) => {
1485
+ if (t == null)
1486
+ return t;
1487
+ const l = e.getFieldConfiguration?.(r)?.fieldFormat;
1488
+ return l?.type === "number" ? ya(t, l) : l?.type === "date-time" ? fa(t, l, o) : pa(t, a, o);
1489
+ }, ga = (e, r, t, a) => {
1490
+ const o = e.fieldsIndex?.get(r), n = Re(r, t, e) ?? t;
1491
+ return Ce(e, r, n, o?.type, a);
1492
+ }, wa = (e, r) => $e(e, r), Ee = (e, r, t) => {
1493
+ const a = e.objectIdField, o = r.features.map(
1493
1494
  (l) => l.attributes[a]
1494
- ), n = t.features.map((l) => {
1495
- const s = l.attributes, c = {};
1495
+ ), n = r.features.map((l) => {
1496
+ const i = l.attributes, c = {};
1496
1497
  return e.fields.forEach((u) => {
1497
- if (!Object.hasOwn(s, u.name))
1498
+ if (!Object.hasOwn(i, u.name))
1498
1499
  return;
1499
- const d = s[u.name];
1500
+ const d = i[u.name];
1500
1501
  if (u.name === a) {
1501
1502
  c[u.name] = d;
1502
1503
  return;
1503
1504
  }
1504
- const p = $e(u.name, d, e) ?? d, h = Ce(e, u.name);
1505
- c[h] = Ee(e, u.name, p, u.type, r);
1505
+ const p = Re(u.name, d, e) ?? d, h = $e(e, u.name);
1506
+ c[h] = Ce(e, u.name, p, u.type, t);
1506
1507
  }), c;
1507
1508
  });
1508
1509
  return { objectIds: o, attributes: n };
1509
- }, wa = (e, t, r) => {
1510
+ }, ba = (e, r, t) => {
1510
1511
  const a = e.createQuery();
1511
- return a.outFields = [t], a.where = r || "1=1", a.num = 1, a;
1512
- }, ba = async (e, t, r, a) => {
1513
- const o = a.map?.allLayers.find((h) => h.id === e), n = wa(o, t, r.where), s = (await o.queryFeatures(n)).features[0], c = s ? s.attributes[t] : null, u = fa(o, t, c, a.timeZone), d = ga(o, t);
1512
+ return a.outFields = [r], a.where = t || "1=1", a.num = 1, a;
1513
+ }, Ta = async (e, r, t, a) => {
1514
+ const o = a.map?.allLayers.find((h) => h.id === e), n = ba(o, r, t.where), i = (await o.queryFeatures(n)).features[0], c = i ? i.attributes[r] : null, u = ga(o, r, c, a.timeZone), d = wa(o, r);
1514
1515
  return {
1515
1516
  tool: "getAttribute",
1516
1517
  layerName: o.title ?? e,
1517
1518
  summary: `${d} = ${u}`,
1518
1519
  details: {
1519
- fieldName: t,
1520
- fieldAlias: d !== t ? d : void 0,
1520
+ fieldName: r,
1521
+ fieldAlias: d !== r ? d : void 0,
1521
1522
  value: u,
1522
- where: r.where
1523
+ where: t.where
1523
1524
  }
1524
1525
  };
1525
1526
  };
1526
- async function Ta({ layerId: e, fieldName: t, query: r }, a) {
1527
- const { mapView: o } = k(a), n = await ba(e, t, r, o);
1527
+ async function va({ layerId: e, fieldName: r, query: t }, a) {
1528
+ const { mapView: o } = N(a), n = await Ta(e, r, t, o);
1528
1529
  return JSON.stringify(n, null, 2);
1529
1530
  }
1530
- const va = i.object({
1531
- layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1532
- fieldName: i.string().describe("The name of the field/attribute from which to get a field value."),
1533
- query: i.object({
1534
- where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1531
+ const Sa = s.object({
1532
+ layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1533
+ fieldName: s.string().describe("The name of the field/attribute from which to get a field value."),
1534
+ query: s.object({
1535
+ where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1535
1536
  })
1536
- }), Sa = f(Ta, {
1537
+ }), xa = w(va, {
1537
1538
  name: "getAttribute",
1538
1539
  description: "Returns an attribute value for a given feature.",
1539
- schema: va
1540
- }), ce = (e, t, r) => r ? e.hasAllFeaturesInView && e.availableFields === t : e.hasAllFeatures && e.availableFields === t;
1541
- function K(e, t) {
1542
- let r = e ?? "";
1543
- return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
1544
- }
1545
- const xa = async (e) => {
1546
- const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: l } = e, s = o.map?.allLayers.find((v) => v.id === t.layerId);
1547
- if (!s)
1548
- throw new Error(`Layer '${t.layerId}' not found.`);
1549
- const c = await o.whenLayerView(s), d = n.get(t.layerId)?.fieldRegistry.get(r), p = d?.alias;
1540
+ schema: Sa
1541
+ }), le = (e, r, t) => t ? e.hasAllFeaturesInView && e.availableFields === r : e.hasAllFeatures && e.availableFields === r;
1542
+ function K(e, r) {
1543
+ let t = e ?? "";
1544
+ return r != null && r && (t = t ? `(${t}) AND (${r})` : r), t || null;
1545
+ }
1546
+ const Ra = async (e) => {
1547
+ const { targetLayer: r, fieldName: t, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: l } = e, i = o.map?.allLayers.find((v) => v.id === r.layerId);
1548
+ if (!i)
1549
+ throw new Error(`Layer '${r.layerId}' not found.`);
1550
+ const c = await o.whenLayerView(i), d = n.get(r.layerId)?.fieldRegistry.get(t), p = d?.alias;
1550
1551
  if (!d)
1551
- throw new Error(`Field '${r}' not found.`);
1552
- let h, y;
1552
+ throw new Error(`Field '${t}' not found.`);
1553
+ let h, f;
1553
1554
  if (l) {
1554
- const v = await H(l, o);
1555
+ const v = await J(l, o);
1555
1556
  if ("error" in v)
1556
1557
  throw new Error(v.error);
1557
1558
  if (!v.geometry)
1558
- throw j(l) ? new Error(`No features found matching: ${l.where}`) : new Error("Failed to create geometry");
1559
- if (j(l)) {
1560
- const M = o.map?.allLayers.find((P) => P.id === l.layerId);
1559
+ throw L(l) ? new Error(`No features found matching: ${l.where}`) : new Error("Failed to create geometry");
1560
+ if (L(l)) {
1561
+ const Q = o.map?.allLayers.find((A) => A.id === l.layerId);
1561
1562
  h = {
1562
- geometryLayerName: M?.title ?? M?.id,
1563
+ geometryLayerName: Q?.title ?? Q?.id,
1563
1564
  geometryLayerId: l.layerId,
1564
1565
  geometryWhere: l.where,
1565
1566
  distance: l.distance,
1566
1567
  units: l.units,
1567
1568
  applied: !0
1568
1569
  };
1569
- } else U(l) && (h = {
1570
+ } else B(l) && (h = {
1570
1571
  point: l.point,
1571
1572
  distance: l.distance,
1572
1573
  units: l.units,
1573
1574
  applied: !0
1574
1575
  });
1575
- y = new Se({
1576
+ f = new ve({
1576
1577
  geometry: v.geometry,
1577
1578
  distance: l.distance,
1578
1579
  units: l.units,
1579
1580
  spatialRelationship: "intersects"
1580
1581
  });
1581
1582
  }
1582
- const g = ce(c, [r], !1);
1583
- let m = null, w = null;
1583
+ const y = le(c, [t], !1);
1584
+ let m = null, g = null;
1584
1585
  const T = 10;
1585
1586
  if (d.type !== "geometry" && d.type !== "oid" && d.type !== "global-id")
1586
1587
  try {
1587
1588
  const v = {
1588
- layer: s,
1589
- useFeaturesInView: g,
1590
- view: g ? o : void 0,
1591
- field: r,
1592
- sqlWhere: K(s.definitionExpression, t.where),
1593
- ...y && { filter: y },
1589
+ layer: i,
1590
+ useFeaturesInView: y,
1591
+ view: y ? o : void 0,
1592
+ field: t,
1593
+ sqlWhere: K(i.definitionExpression, r.where),
1594
+ ...f && { filter: f },
1594
1595
  outStatisticTypes: { include: [a] }
1595
1596
  };
1596
- m = await ct(v);
1597
- const M = ["string", "small-integer", "integer"], P = d.domain?.type === "coded-value" ? d.domain : null;
1598
- (M.includes(d.type) || P) && (w = (await ut({
1599
- layer: s,
1600
- useFeaturesInView: g,
1601
- view: g ? o : void 0,
1602
- field: r,
1603
- sqlWhere: K(s.definitionExpression, t.where),
1604
- ...y && { filter: y }
1605
- })).uniqueValueInfos.sort((z, ze) => ze.count - z.count).slice(0, T)), w && d.domain?.type === "coded-value" && (w = w.map((z) => ({
1606
- ...z,
1607
- value: P ? P.getName(z.value) ?? z.value : z.value
1597
+ m = await ut(v);
1598
+ const Q = ["string", "small-integer", "integer"], A = d.domain?.type === "coded-value" ? d.domain : null;
1599
+ (Q.includes(d.type) || A) && (g = (await dt({
1600
+ layer: i,
1601
+ useFeaturesInView: y,
1602
+ view: y ? o : void 0,
1603
+ field: t,
1604
+ sqlWhere: K(i.definitionExpression, r.where),
1605
+ ...f && { filter: f }
1606
+ })).uniqueValueInfos.sort((I, ze) => ze.count - I.count).slice(0, T)), g && d.domain?.type === "coded-value" && (g = g.map((I) => ({
1607
+ ...I,
1608
+ value: A ? A.getName(I.value) ?? I.value : I.value
1608
1609
  })));
1609
1610
  } catch (v) {
1610
1611
  console.error("Statistics error:", v);
1611
1612
  }
1612
1613
  return {
1613
1614
  tool: "getStatistics",
1614
- layerName: s.title ?? t.layerId,
1615
+ layerName: i.title ?? r.layerId,
1615
1616
  summary: `${a} = ${typeof m?.[a] == "number" ? m[a] : "N/A"}`,
1616
1617
  details: {
1617
- fieldName: r,
1618
+ fieldName: t,
1618
1619
  fieldAlias: p,
1619
1620
  statisticType: a,
1620
1621
  statistic: m?.[a] ?? null,
1621
1622
  summaryStatistics: m,
1622
- uniqueValues: w,
1623
- where: t.where,
1623
+ uniqueValues: g,
1624
+ where: r.where,
1624
1625
  spatialFilterInfo: h
1625
1626
  }
1626
1627
  };
1627
1628
  };
1628
- async function Ra({
1629
+ async function $a({
1629
1630
  targetLayer: e,
1630
- fieldName: t,
1631
- statisticType: r,
1631
+ fieldName: r,
1632
+ statisticType: t,
1632
1633
  geometryFilter: a
1633
1634
  }, o) {
1634
- const n = Re(o, "layersAndFieldsRegistry"), { mapView: l } = k(o), s = await xa({
1635
+ const n = xe(o, "layersAndFieldsRegistry"), { mapView: l } = N(o), i = await Ra({
1635
1636
  targetLayer: e,
1636
- fieldName: t,
1637
- statisticType: r,
1637
+ fieldName: r,
1638
+ statisticType: t,
1638
1639
  mapView: l,
1639
1640
  layersAndFieldsRegistry: n,
1640
1641
  geometryFilter: a
1641
1642
  });
1642
- return JSON.stringify(s, null, 2);
1643
- }
1644
- const $a = i.object({
1645
- layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1646
- where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1647
- distance: i.number().optional().describe("The buffer distance around the geometry."),
1648
- units: N.optional().describe("The units for the distance buffer.")
1649
- }), Ca = i.object({
1650
- point: i.object({
1651
- x: i.number().describe("X coordinate (longitude) from navigation result"),
1652
- y: i.number().describe("Y coordinate (latitude) from navigation result"),
1653
- spatialReference: i.object({
1654
- wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1643
+ return JSON.stringify(i, null, 2);
1644
+ }
1645
+ const Ca = s.object({
1646
+ layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1647
+ where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1648
+ distance: s.number().optional().describe("The buffer distance around the geometry."),
1649
+ units: F.optional().describe("The units for the distance buffer.")
1650
+ }), Ea = s.object({
1651
+ point: s.object({
1652
+ x: s.number().describe("X coordinate (longitude) from navigation result"),
1653
+ y: s.number().describe("Y coordinate (latitude) from navigation result"),
1654
+ spatialReference: s.object({
1655
+ wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1655
1656
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1656
1657
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1657
- distance: i.number().optional().describe("Optional buffer distance around the point."),
1658
- units: N.optional().describe("The units for the distance buffer.")
1659
- }), Ea = i.object({
1660
- targetLayer: i.object({
1661
- layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1662
- where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1658
+ distance: s.number().optional().describe("Optional buffer distance around the point."),
1659
+ units: F.optional().describe("The units for the distance buffer.")
1660
+ }), Fa = s.object({
1661
+ targetLayer: s.object({
1662
+ layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1663
+ where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1663
1664
  }),
1664
- geometryFilter: i.union([$a, Ca]).optional().describe(
1665
+ geometryFilter: s.union([Ca, Ea]).optional().describe(
1665
1666
  "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."
1666
1667
  ),
1667
- fieldName: i.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
1668
- statisticType: i.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1669
- }), Na = f(Ra, {
1668
+ fieldName: s.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
1669
+ statisticType: s.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1670
+ }), ka = w($a, {
1670
1671
  name: "getStatistics",
1671
1672
  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.
1672
1673
 
@@ -1681,35 +1682,35 @@ DO NOT USE FOR:
1681
1682
  - Simple counts of features matching a condition — use queryFeatures instead
1682
1683
 
1683
1684
  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.`,
1684
- schema: Ea
1685
- }), Ia = async (e, t, r, a, o) => {
1686
- const n = r.map?.allLayers.find((h) => h.id === e.layerId), l = await r.whenLayerView(n), s = n.title ?? e.layerId;
1685
+ schema: Fa
1686
+ }), Na = async (e, r, t, a, o) => {
1687
+ const n = t.map?.allLayers.find((h) => h.id === e.layerId), l = await t.whenLayerView(n), i = n.title ?? e.layerId;
1687
1688
  let c;
1688
1689
  if (a) {
1689
- const h = await H(a, r);
1690
+ const h = await J(a, t);
1690
1691
  if ("error" in h)
1691
1692
  return {
1692
1693
  tool: "getTopFeatures",
1693
- layerName: s,
1694
+ layerName: i,
1694
1695
  summary: "Geometry lookup failed",
1695
1696
  details: { error: h.error }
1696
1697
  };
1697
1698
  if (!h.geometry)
1698
1699
  return {
1699
1700
  tool: "getTopFeatures",
1700
- layerName: s,
1701
+ layerName: i,
1701
1702
  summary: "No features found for geometry filter",
1702
1703
  details: {
1703
1704
  error: `No features found matching: ${"where" in a ? a.where : "unknown criteria"}`
1704
1705
  }
1705
1706
  };
1706
1707
  c = h.geometry;
1707
- } else o && (c = r.extent.clone());
1708
- const u = t.groupByFields && t.groupByFields.length > 0, d = n.objectIdField, p = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])];
1708
+ } else o && (c = t.extent.clone());
1709
+ const u = r.groupByFields && r.groupByFields.length > 0, d = n.objectIdField, p = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])];
1709
1710
  try {
1710
1711
  let h;
1711
1712
  if (u) {
1712
- const m = new dt({
1713
+ const m = new pt({
1713
1714
  where: e.where || "1=1",
1714
1715
  outFields: p,
1715
1716
  orderByFields: e.orderByFields,
@@ -1717,139 +1718,139 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1717
1718
  spatialRelationship: c ? "intersects" : void 0,
1718
1719
  distance: a?.distance,
1719
1720
  units: a?.units,
1720
- topFilter: new pt({
1721
- topCount: t.topCount,
1722
- groupByFields: t.groupByFields,
1723
- orderByFields: t.orderByFields
1721
+ topFilter: new ht({
1722
+ topCount: r.topCount,
1723
+ groupByFields: r.groupByFields,
1724
+ orderByFields: r.orderByFields
1724
1725
  })
1725
1726
  });
1726
1727
  h = await n.queryTopFeatures(m);
1727
1728
  } else {
1728
1729
  const m = n.createQuery();
1729
- m.where = K(n.definitionExpression, e.where || "1=1"), m.outFields = p.length ? p : ["*"], m.orderByFields = t.orderByFields, m.num = t.topCount, c && (m.geometry = c, m.spatialRelationship = "intersects"), a?.distance && (m.distance = a.distance), a?.units && (m.units = a.units), m.outSpatialReference = r.spatialReference;
1730
- const w = ce(l, e.outFields, o ?? !1);
1730
+ m.where = K(n.definitionExpression, e.where || "1=1"), m.outFields = p.length ? p : ["*"], m.orderByFields = r.orderByFields, m.num = r.topCount, c && (m.geometry = c, m.spatialRelationship = "intersects"), a?.distance && (m.distance = a.distance), a?.units && (m.units = a.units), m.outSpatialReference = t.spatialReference;
1731
+ const g = le(l, e.outFields, o ?? !1);
1731
1732
  try {
1732
- h = w ? await l.queryFeatures(m) : await n.queryFeatures(m);
1733
+ h = g ? await l.queryFeatures(m) : await n.queryFeatures(m);
1733
1734
  } catch (T) {
1734
1735
  console.warn("Client-side query failed, falling back to server:", T), h = await n.queryFeatures(m);
1735
1736
  }
1736
1737
  }
1737
- const y = h.features.map((m) => m.attributes[d]), { attributes: g } = Ne(n, h, r.timeZone);
1738
+ const f = h.features.map((m) => m.attributes[d]), { attributes: y } = Ee(n, h, t.timeZone);
1738
1739
  return {
1739
1740
  tool: "getTopFeatures",
1740
- layerName: s,
1741
- summary: `Top ${t.topCount} features extracted`,
1741
+ layerName: i,
1742
+ summary: `Top ${r.topCount} features extracted`,
1742
1743
  details: {
1743
- topCount: t.topCount,
1744
- attributes: g,
1745
- objectIds: y,
1744
+ topCount: r.topCount,
1745
+ attributes: y,
1746
+ objectIds: f,
1746
1747
  objectIdField: d,
1747
1748
  where: e.where,
1748
- orderByFields: t.orderByFields,
1749
- ...u && { groupByFields: t.groupByFields }
1749
+ orderByFields: r.orderByFields,
1750
+ ...u && { groupByFields: r.groupByFields }
1750
1751
  }
1751
1752
  };
1752
1753
  } catch (h) {
1753
1754
  return {
1754
1755
  tool: "getTopFeatures",
1755
- layerName: s,
1756
+ layerName: i,
1756
1757
  summary: "Query failed",
1757
1758
  details: { error: h instanceof Error ? h.message : String(h) }
1758
1759
  };
1759
1760
  }
1760
- }, ka = async ({
1761
+ }, qa = async ({
1761
1762
  targetLayer: e,
1762
- topFilter: t,
1763
- geometryFilter: r,
1763
+ topFilter: r,
1764
+ geometryFilter: t,
1764
1765
  useCurrentExtent: a
1765
1766
  }, o) => {
1766
- const { mapView: n } = k(o), l = await Ia(e, t, n, r, a);
1767
+ const { mapView: n } = N(o), l = await Na(e, r, n, t, a);
1767
1768
  return JSON.stringify(l, null, 2);
1768
- }, Fa = i.object({
1769
- layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1770
- where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1771
- distance: i.number().optional().describe("The buffer distance around the geometry."),
1772
- units: N.optional().describe("The units for the distance buffer.")
1773
- }), za = i.object({
1774
- point: i.object({
1775
- x: i.number().describe("X coordinate (longitude) from navigation result"),
1776
- y: i.number().describe("Y coordinate (latitude) from navigation result"),
1777
- spatialReference: i.object({
1778
- wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1769
+ }, Ia = s.object({
1770
+ layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1771
+ where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1772
+ distance: s.number().optional().describe("The buffer distance around the geometry."),
1773
+ units: F.optional().describe("The units for the distance buffer.")
1774
+ }), za = s.object({
1775
+ point: s.object({
1776
+ x: s.number().describe("X coordinate (longitude) from navigation result"),
1777
+ y: s.number().describe("Y coordinate (latitude) from navigation result"),
1778
+ spatialReference: s.object({
1779
+ wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1779
1780
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1780
1781
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1781
- distance: i.number().optional().describe("Optional buffer distance around the point."),
1782
- units: N.optional().describe("The units for the distance buffer.")
1783
- }), qa = i.object({
1784
- targetLayer: i.object({
1785
- layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1786
- where: i.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
1787
- orderByFields: i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),
1788
- outFields: i.array(
1789
- i.string().describe(
1782
+ distance: s.number().optional().describe("Optional buffer distance around the point."),
1783
+ units: F.optional().describe("The units for the distance buffer.")
1784
+ }), Da = s.object({
1785
+ targetLayer: s.object({
1786
+ layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1787
+ where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
1788
+ orderByFields: s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),
1789
+ outFields: s.array(
1790
+ s.string().describe(
1790
1791
  '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 ("*").'
1791
1792
  ).default("*")
1792
1793
  )
1793
1794
  }),
1794
- geometryFilter: i.union([Fa, za]).optional().describe(
1795
+ geometryFilter: s.union([Ia, za]).optional().describe(
1795
1796
  "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."
1796
1797
  ),
1797
- topFilter: i.object({
1798
- topCount: i.number().describe("Number of top features to return per group."),
1799
- orderByFields: i.array(
1800
- i.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
1798
+ topFilter: s.object({
1799
+ topCount: s.number().describe("Number of top features to return per group."),
1800
+ orderByFields: s.array(
1801
+ s.string().describe("Field(s) to rank by with ASC/DESC. Must be existing field names, not aggregate functions.")
1801
1802
  ),
1802
- groupByFields: i.array(i.string().describe("Field(s) to group results by. Returns top N per group."))
1803
+ groupByFields: s.array(s.string().describe("Field(s) to group results by. Returns top N per group."))
1803
1804
  }).required(),
1804
- useCurrentExtent: i.boolean().optional().describe(
1805
+ useCurrentExtent: s.boolean().optional().describe(
1805
1806
  "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)."
1806
1807
  )
1807
- }), Da = f(ka, {
1808
+ }), Pa = w(qa, {
1808
1809
  name: "getTopFeatures",
1809
1810
  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.',
1810
- schema: qa
1811
- }), ee = 25, Aa = async (e, t, r, a) => {
1812
- const o = t.map?.allLayers.find((m) => m.id === e.layerId), n = await t.whenLayerView(o), l = o.title ?? e.layerId;
1813
- let s;
1814
- if (r) {
1815
- const m = await H(r, t);
1811
+ schema: Da
1812
+ }), ee = 25, Aa = async (e, r, t, a) => {
1813
+ const o = r.map?.allLayers.find((m) => m.id === e.layerId), n = await r.whenLayerView(o), l = o.title ?? e.layerId;
1814
+ let i;
1815
+ if (t) {
1816
+ const m = await J(t, r);
1816
1817
  if ("error" in m) {
1817
- const w = { error: m.error };
1818
- if (j(r)) {
1819
- const T = t.map?.allLayers.find((C) => C.id === r.layerId);
1820
- w.geometryLayerName = T?.title ?? T?.id, w.geometryLayerId = r.layerId, w.geometryWhere = r.where;
1821
- } else U(r) && (w.point = r.point);
1818
+ const g = { error: m.error };
1819
+ if (L(t)) {
1820
+ const T = r.map?.allLayers.find(($) => $.id === t.layerId);
1821
+ g.geometryLayerName = T?.title ?? T?.id, g.geometryLayerId = t.layerId, g.geometryWhere = t.where;
1822
+ } else B(t) && (g.point = t.point);
1822
1823
  return {
1823
1824
  tool: "queryFeatures",
1824
1825
  layerName: l,
1825
1826
  summary: "Geometry lookup failed",
1826
- details: w
1827
+ details: g
1827
1828
  };
1828
1829
  }
1829
1830
  if (!m.geometry) {
1830
- const w = {};
1831
- if (j(r)) {
1832
- const T = t.map?.allLayers.find((C) => C.id === r.layerId);
1833
- w.error = `No features found matching: ${r.where}`, w.geometryLayerName = T?.title ?? T?.id, w.geometryLayerId = r.layerId, w.geometryWhere = r.where;
1834
- } else U(r) && (w.error = "Failed to create point geometry", w.point = r.point);
1831
+ const g = {};
1832
+ if (L(t)) {
1833
+ const T = r.map?.allLayers.find(($) => $.id === t.layerId);
1834
+ g.error = `No features found matching: ${t.where}`, g.geometryLayerName = T?.title ?? T?.id, g.geometryLayerId = t.layerId, g.geometryWhere = t.where;
1835
+ } else B(t) && (g.error = "Failed to create point geometry", g.point = t.point);
1835
1836
  return {
1836
1837
  tool: "queryFeatures",
1837
1838
  layerName: l,
1838
1839
  summary: "No features found for geometry filter",
1839
- details: w
1840
+ details: g
1840
1841
  };
1841
1842
  }
1842
- s = m.geometry;
1843
- } else a && (s = t.extent.clone());
1844
- const c = ce(n, e.outFields, a ?? !1), u = o.objectIdField, d = o.createQuery();
1845
- d.where = K(o.definitionExpression, e.where || "1=1"), d.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, u])], d.orderByFields = e.orderByFields, s && (d.geometry = s, d.spatialRelationship = "intersects"), r?.distance && (d.distance = r.distance), r?.units && (d.units = r.units), d.outSpatialReference = t.spatialReference;
1843
+ i = m.geometry;
1844
+ } else a && (i = r.extent.clone());
1845
+ const c = le(n, e.outFields, a ?? !1), u = o.objectIdField, d = o.createQuery();
1846
+ d.where = K(o.definitionExpression, e.where || "1=1"), d.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, u])], d.orderByFields = e.orderByFields, i && (d.geometry = i, d.spatialRelationship = "intersects"), t?.distance && (d.distance = t.distance), t?.units && (d.units = t.units), d.outSpatialReference = r.spatialReference;
1846
1847
  let p, h;
1847
1848
  try {
1848
1849
  p = c ? await n.queryFeatureCount(d) : await o.queryFeatureCount(d), p > 0 && p <= ee && (h = c ? await n.queryFeatures(d) : await o.queryFeatures(d));
1849
1850
  } catch (m) {
1850
1851
  console.warn("Client-side query failed, falling back to server:", m), p = await o.queryFeatureCount(d), p > 0 && p <= ee && (h = await o.queryFeatures(d));
1851
1852
  }
1852
- const { objectIds: y, attributes: g } = h ? Ne(o, h, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1853
+ const { objectIds: f, attributes: y } = h ? Ee(o, h, r.timeZone) : { objectIds: void 0, attributes: void 0 };
1853
1854
  return {
1854
1855
  tool: "queryFeatures",
1855
1856
  layerName: l,
@@ -1859,57 +1860,57 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1859
1860
  where: e.where,
1860
1861
  orderByFields: e.orderByFields,
1861
1862
  outFields: e.outFields,
1862
- ...y && { objectIds: y, objectIdField: u },
1863
- ...g && { attributes: g },
1863
+ ...f && { objectIds: f, objectIdField: u },
1864
+ ...y && { attributes: y },
1864
1865
  ...p > ee && {
1865
1866
  note: `${p} features found.`
1866
1867
  }
1867
1868
  }
1868
1869
  };
1869
1870
  };
1870
- async function Pa({
1871
+ async function ja({
1871
1872
  targetLayer: e,
1872
- geometryFilter: t,
1873
- useCurrentExtent: r
1873
+ geometryFilter: r,
1874
+ useCurrentExtent: t
1874
1875
  }, a) {
1875
- const { mapView: o } = k(a), n = await Aa(e, o, t, r);
1876
+ const { mapView: o } = N(a), n = await Aa(e, o, r, t);
1876
1877
  return JSON.stringify(n, null, 2);
1877
1878
  }
1878
- const La = i.object({
1879
- layerId: i.string().describe("The layerId of the layer containing the geometry by which to filter."),
1880
- where: i.string().describe("The SQL-92 where clause representing the features from which to filter."),
1881
- distance: i.number().optional().describe("The buffer distance around the geometry."),
1882
- units: N.optional().describe("The units for the distance buffer.")
1883
- }), ja = i.object({
1884
- point: i.object({
1885
- x: i.number().describe("X coordinate (longitude) from navigation result"),
1886
- y: i.number().describe("Y coordinate (latitude) from navigation result"),
1887
- spatialReference: i.object({
1888
- wkid: i.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1879
+ const La = s.object({
1880
+ layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1881
+ where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1882
+ distance: s.number().optional().describe("The buffer distance around the geometry."),
1883
+ units: F.optional().describe("The units for the distance buffer.")
1884
+ }), Ga = s.object({
1885
+ point: s.object({
1886
+ x: s.number().describe("X coordinate (longitude) from navigation result"),
1887
+ y: s.number().describe("Y coordinate (latitude) from navigation result"),
1888
+ spatialReference: s.object({
1889
+ wkid: s.number().describe("Spatial reference WKID (e.g., 4326 for WGS84)")
1889
1890
  }).optional().describe("Spatial reference. Defaults to map's spatial reference if not provided.")
1890
1891
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1891
- distance: i.number().optional().describe("Optional buffer distance around the point."),
1892
- units: N.optional().describe("The units for the distance buffer.")
1893
- }), Ga = i.object({
1894
- targetLayer: i.object({
1895
- layerId: i.string().describe("The layerId of the layer containing the field from which to get a value."),
1896
- where: i.string().describe(
1892
+ distance: s.number().optional().describe("Optional buffer distance around the point."),
1893
+ units: F.optional().describe("The units for the distance buffer.")
1894
+ }), Oa = s.object({
1895
+ targetLayer: s.object({
1896
+ layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1897
+ where: s.string().describe(
1897
1898
  "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."
1898
1899
  ),
1899
- orderByFields: i.array(i.string().describe("The field(s) and order for which to sort the resulting features.")),
1900
- outFields: i.array(
1901
- i.string().describe(
1900
+ orderByFields: s.array(s.string().describe("The field(s) and order for which to sort the resulting features.")),
1901
+ outFields: s.array(
1902
+ s.string().describe(
1902
1903
  '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 ("*").'
1903
1904
  ).default("*")
1904
1905
  )
1905
1906
  }),
1906
- geometryFilter: i.union([La, ja]).optional().describe(
1907
+ geometryFilter: s.union([La, Ga]).optional().describe(
1907
1908
  "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."
1908
1909
  ),
1909
- useCurrentExtent: i.boolean().optional().describe(
1910
+ useCurrentExtent: s.boolean().optional().describe(
1910
1911
  "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)."
1911
1912
  )
1912
- }), Oa = f(Pa, {
1913
+ }), Ma = w(ja, {
1913
1914
  name: "queryFeatures",
1914
1915
  description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
1915
1916
 
@@ -1921,165 +1922,163 @@ USE THIS TOOL FOR:
1921
1922
  - Any question where the user wants to SEE or COUNT matching features
1922
1923
 
1923
1924
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1924
- schema: Ga
1925
- }), Ma = [Sa, Na, Da, Oa], Hn = [la, ea, Zr], Qa = new ot(Ma, { handleToolErrors: !1 });
1926
- async function Jn(e, t) {
1927
- const { messages: r } = await Qa.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
1928
- for (const n of r) {
1925
+ schema: Oa
1926
+ }), Qa = [xa, ka, Pa, Ma], Jn = [ca, ta, Yr], _a = new nt(Qa, { handleToolErrors: !1 });
1927
+ async function Zn(e, r) {
1928
+ const { messages: t } = await _a.invoke({ messages: e.dataExplorationMessages }, r), a = [], o = [];
1929
+ for (const n of t) {
1929
1930
  const l = n.content;
1930
- let s;
1931
- typeof l != "string" && (s = {
1931
+ let i;
1932
+ typeof l != "string" && (i = {
1932
1933
  tool: n.name ?? "unknown",
1933
1934
  layerName: "unknown",
1934
1935
  summary: "Query failed",
1935
1936
  details: { error: "Skipping non-string tool output:", raw: l }
1936
1937
  });
1937
1938
  try {
1938
- typeof l == "string" ? s = JSON.parse(l) : s = {
1939
+ typeof l == "string" ? i = JSON.parse(l) : i = {
1939
1940
  tool: n.name ?? "unknown",
1940
1941
  layerName: "unknown",
1941
1942
  summary: "Query failed",
1942
1943
  details: { error: "Invalid tool output type", raw: l }
1943
1944
  };
1944
1945
  } catch {
1945
- s = {
1946
+ i = {
1946
1947
  tool: n.name ?? "unknown",
1947
1948
  layerName: "unknown",
1948
1949
  summary: "Query failed",
1949
1950
  details: { error: l }
1950
1951
  };
1951
1952
  }
1952
- a.push(s), s.details && typeof s.details == "object" && "error" in s.details ? o.push(`- ${s.tool}: Error - ${String(s.details.error)}`) : o.push(`- ${s.layerName}: ${s.summary}`);
1953
+ a.push(i), i.details && typeof i.details == "object" && "error" in i.details ? o.push(`- ${i.tool}: Error - ${String(i.details.error)}`) : o.push(`- ${i.layerName}: ${i.summary}`);
1953
1954
  }
1954
- return await S({ text: `Finished executing layer query tool: ${o.join(", ")}` }, t), {
1955
+ return await S({ text: `Finished executing layer query tool: ${o.join(", ")}` }, r), {
1955
1956
  ...e,
1956
- dataExplorationMessages: [...e.dataExplorationMessages, ...r],
1957
+ dataExplorationMessages: [...e.dataExplorationMessages, ...t],
1957
1958
  queryResponse: a,
1958
1959
  status: "success",
1959
- summary: o.length > 0 ? Vt(o.join(`
1960
+ summary: o.length > 0 ? Ut(o.join(`
1960
1961
  `)) : "Query executed."
1961
1962
  };
1962
1963
  }
1963
- const Zn = b.Root({
1964
- ...B(),
1964
+ const Yn = b.Root({
1965
+ ...H(),
1965
1966
  // internal to the help agent
1966
1967
  helpInternalState: b({
1967
- reducer: L,
1968
+ reducer: j,
1968
1969
  default: () => ({
1969
1970
  toolCallMessage: void 0
1970
1971
  })
1971
1972
  })
1972
- }), _a = (e, t) => {
1973
- const r = Array.from(e.values()).find(
1974
- ({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
1973
+ }), Wa = (e, r) => {
1974
+ const t = Array.from(e.values()).find(
1975
+ ({ layerItem: n }) => n.title?.toLowerCase().includes(r.toLowerCase())
1975
1976
  );
1976
- if (!r) {
1977
+ if (!t) {
1977
1978
  const n = Array.from(e.values()).map((l) => l.layerItem.title).join(", ");
1978
- return `Could not find a layer matching "${t}". Available layers: ${n}`;
1979
+ return `Could not find a layer matching "${r}". Available layers: ${n}`;
1979
1980
  }
1980
- const a = Array.from(r.fieldRegistry.values()), o = a.map((n) => `- **${n.alias || n.name}** (\`${n.name}\`, ${n.type})${n.description ? `: ${n.description}` : ""}`).join(`
1981
+ const a = Array.from(t.fieldRegistry.values()), o = a.map((n) => `- **${n.alias || n.name}** (\`${n.name}\`, ${n.type})${n.description ? `: ${n.description}` : ""}`).join(`
1981
1982
  `);
1982
- return `**${r.layerItem.title}** has ${a.length} field(s):
1983
+ return `**${t.layerItem.title}** has ${a.length} field(s):
1983
1984
 
1984
1985
  ${o}`;
1985
- }, Wa = async ({ layerTitle: e }, t) => {
1986
- const r = Re(t, "layersAndFieldsRegistry");
1987
- return _a(r, e);
1988
- }, Yn = f(Wa, {
1986
+ }, Va = async ({ layerTitle: e }, r) => {
1987
+ const t = xe(r, "layersAndFieldsRegistry");
1988
+ return Wa(t, e);
1989
+ }, Xn = w(Va, {
1989
1990
  name: "listLayerFields",
1990
1991
  description: "Lists all fields for a given layer by title. Use ONLY when the user explicitly asks to see fields, columns, or attributes of a specific named layer. Do NOT call this tool for general help questions, capability overviews, or layer listing.",
1991
- schema: i.object({
1992
- layerTitle: i.string().describe("The title or partial title of the layer to list fields for.")
1992
+ schema: s.object({
1993
+ layerTitle: s.string().describe("The title or partial title of the layer to list fields for.")
1993
1994
  })
1994
- }), Xn = b.Root({
1995
- ...B(),
1995
+ }), ei = b.Root({
1996
+ ...H(),
1996
1997
  intent: b({
1997
- reducer: (e, t) => t
1998
+ reducer: (e, r) => r
1998
1999
  }),
1999
2000
  arcgisKnowledgeMessages: b({
2000
- reducer: Te,
2001
+ reducer: be,
2001
2002
  default: () => []
2002
2003
  }),
2003
2004
  arcgisKnowledgeToolResult: b({
2004
- reducer: (e, t) => t,
2005
+ reducer: (e, r) => r,
2005
2006
  default: () => null
2006
2007
  })
2007
- }), _ = {
2008
- conversationId: ""
2009
- };
2010
- function ue(e) {
2011
- const t = e.map?.allLayers.filter((r) => r.type === "knowledge-graph");
2012
- if (!t || t?.length !== 1)
2008
+ });
2009
+ function ce(e) {
2010
+ const r = e.map?.allLayers.filter((t) => t.type === "knowledge-graph");
2011
+ if (!r || r?.length !== 1)
2013
2012
  throw new Error("The Knowledge Agent currently only supports maps with exactly one Knowledge Graph Layer.");
2014
2013
  }
2015
- function F(e) {
2014
+ function q(e) {
2016
2015
  return !!e?.map && !("activeLinkChartLayer" in e.map);
2017
2016
  }
2018
- async function J(e) {
2019
- !e || F(e) || !e.map?.diagramNodesExtent || await e.goTo(e.map.diagramNodesExtent);
2017
+ async function Z(e) {
2018
+ !e || q(e) || !e.map?.diagramNodesExtent || await e.goTo(e.map.diagramNodesExtent);
2020
2019
  }
2021
- function Z(e) {
2022
- const r = e?.configurable?.context;
2023
- if (!r || typeof r != "object")
2020
+ function O(e) {
2021
+ const t = e?.configurable?.context;
2022
+ if (!t || typeof t != "object")
2024
2023
  throw new Error("ArcgisKnowledgeAgent context missing");
2025
- if (!("view" in r))
2024
+ if (!("view" in t))
2026
2025
  throw new Error("View context missing");
2027
- const a = r.view;
2028
- return a.map && !("activeLinkChartLayer" in a.map) && ue(a), {
2026
+ const a = t.view;
2027
+ return a.map && !("activeLinkChartLayer" in a.map) && ce(a), {
2029
2028
  view: a
2030
2029
  };
2031
2030
  }
2032
- function ei(e) {
2033
- const r = e?.configurable?.context;
2034
- if (Ie(e) === "knowledgeGraph")
2031
+ function ti(e) {
2032
+ const t = e?.configurable?.context;
2033
+ if (Fe(e) === "knowledgeGraph")
2035
2034
  return "knowledgeGraph";
2036
- const o = r.view;
2037
- return F(o) ? (ue(o), "map") : "linkChart";
2035
+ const o = t.view;
2036
+ return q(o) ? (ce(o), "map") : "linkChart";
2038
2037
  }
2039
- async function O(e) {
2040
- const r = e?.configurable?.context;
2041
- if (Ie(e) === "knowledgeGraph")
2042
- return r;
2038
+ async function M(e) {
2039
+ const t = e?.configurable?.context;
2040
+ if (Fe(e) === "knowledgeGraph")
2041
+ return t;
2043
2042
  {
2044
- const o = r.view.map;
2043
+ const o = t.view.map;
2045
2044
  if (o && "activeLinkChartLayer" in o) {
2046
2045
  const n = o.knowledgeGraph?.url;
2047
2046
  if (!n)
2048
2047
  throw new Error("Knowledge graph url missing from link chart.");
2049
2048
  return {
2050
- knowledgeGraph: await ge(n)
2049
+ knowledgeGraph: await fe(n)
2051
2050
  };
2052
2051
  } else {
2053
- ue(r.view);
2054
- const l = (r.view.map?.allLayers.find(
2052
+ ce(t.view);
2053
+ const l = (t.view.map?.allLayers.find(
2055
2054
  (c) => c.type === "knowledge-graph"
2056
2055
  )).url;
2057
2056
  if (!l)
2058
2057
  throw new Error("Knowledge graph url missing from map.");
2059
2058
  return {
2060
- knowledgeGraph: await ge(l)
2059
+ knowledgeGraph: await fe(l)
2061
2060
  };
2062
2061
  }
2063
2062
  }
2064
2063
  }
2065
- function Ie(e) {
2066
- const r = e?.configurable?.context;
2067
- if (!r || typeof r != "object")
2064
+ function Fe(e) {
2065
+ const t = e?.configurable?.context;
2066
+ if (!t || typeof t != "object")
2068
2067
  throw new Error("ArcgisKnowledgeAgent context missing");
2069
- if ("knowledgeGraph" in r && "view" in r)
2068
+ if ("knowledgeGraph" in t && "view" in t)
2070
2069
  throw new Error("Knowledge Graph context should only have a view or knowledgeGraph, but never both.");
2071
- if ("knowledgeGraph" in r)
2070
+ if ("knowledgeGraph" in t)
2072
2071
  return "knowledgeGraph";
2073
- if ("view" in r)
2072
+ if ("view" in t)
2074
2073
  return "view";
2075
2074
  throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.");
2076
2075
  }
2077
- class Va {
2078
- constructor(t) {
2079
- this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = de.fromDataModel(t);
2076
+ class Ua {
2077
+ constructor(r) {
2078
+ this.dataModel = r, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = ue.fromDataModel(r);
2080
2079
  }
2081
2080
  }
2082
- class de {
2081
+ class ue {
2083
2082
  constructor() {
2084
2083
  this.schemaType = "ArcgisGraphSchema", this.entityTypes = [], this.relationshipTypes = [], this.identifierInfo = {
2085
2084
  mappingInfo: {
@@ -2088,25 +2087,25 @@ class de {
2088
2087
  }
2089
2088
  };
2090
2089
  }
2091
- static fromDataModel(t) {
2092
- const r = new de();
2093
- for (const a of t.entityTypes)
2094
- r.entityTypes.push(G.fromEntityType(a));
2095
- for (const a of t.relationshipTypes)
2096
- r.relationshipTypes.push(Ua.fromRelationshipType(a));
2097
- return r.identifierInfo = {
2090
+ static fromDataModel(r) {
2091
+ const t = new ue();
2092
+ for (const a of r.entityTypes)
2093
+ t.entityTypes.push(G.fromEntityType(a));
2094
+ for (const a of r.relationshipTypes)
2095
+ t.relationshipTypes.push(Ba.fromRelationshipType(a));
2096
+ return t.identifierInfo = {
2098
2097
  mappingInfo: {
2099
2098
  identifierMapsTo: Ka(
2100
- t.identifierInfo.identifierMappingInfo.identifierInfoType
2099
+ r.identifierInfo.identifierMappingInfo.identifierInfoType
2101
2100
  ),
2102
- identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
2101
+ identifierPropertyName: r.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
2103
2102
  }
2104
- }, r.spatialReference = JSON.parse(JSON.stringify(t.spatialReference)), r;
2103
+ }, t.spatialReference = JSON.parse(JSON.stringify(r.spatialReference)), t;
2105
2104
  }
2106
2105
  // Generates a short summary of the types in the data model for LLM consumption.
2107
- static getDataModelTypesSummary(t) {
2108
- const r = t.entityTypes.map((o) => o.name).join(", "), a = t.relationshipTypes.map((o) => o.name).join(", ");
2109
- return `Entity Types: ${r}.
2106
+ static getDataModelTypesSummary(r) {
2107
+ const t = r.entityTypes.map((o) => o.name).join(", "), a = r.relationshipTypes.map((o) => o.name).join(", ");
2108
+ return `Entity Types: ${t}.
2110
2109
  Relationship Types: ${a}.`;
2111
2110
  }
2112
2111
  }
@@ -2114,39 +2113,39 @@ class G {
2114
2113
  constructor() {
2115
2114
  this.name = "", this.properties = [];
2116
2115
  }
2117
- static fromEntityType(t) {
2118
- const r = new G();
2119
- r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = Ba(t.role);
2120
- for (const a of t.properties) {
2116
+ static fromEntityType(r) {
2117
+ const t = new G();
2118
+ t.name = r.name, t.alias = r.alias ? r.alias : void 0, t.role = Ha(r.role);
2119
+ for (const a of r.properties) {
2121
2120
  const o = {
2122
2121
  name: a.name,
2123
2122
  alias: a.alias ? a.alias : void 0,
2124
2123
  fieldType: a.fieldType,
2125
- role: Ha(a.role),
2124
+ role: Ja(a.role),
2126
2125
  geometryDef: a.fieldType === "esriFieldTypeGeometry" ? {
2127
2126
  geometryType: a.geometryType ?? "esriGeometryAny",
2128
2127
  hasM: a.hasM ? a.hasM : void 0,
2129
2128
  hasZ: a.hasZ ? a.hasZ : void 0
2130
2129
  } : void 0
2131
2130
  };
2132
- r.properties.push(o);
2131
+ t.properties.push(o);
2133
2132
  }
2134
- return r;
2133
+ return t;
2135
2134
  }
2136
2135
  }
2137
- class Ua extends G {
2136
+ class Ba extends G {
2138
2137
  constructor() {
2139
2138
  super(...arguments), this.observedEndPoints = [];
2140
2139
  }
2141
- static fromRelationshipType(t) {
2142
- const r = G.fromEntityType(t);
2143
- r.observedEndPoints = [];
2144
- for (const a of t.endPoints)
2145
- r.observedEndPoints.push({
2140
+ static fromRelationshipType(r) {
2141
+ const t = G.fromEntityType(r);
2142
+ t.observedEndPoints = [];
2143
+ for (const a of r.endPoints)
2144
+ t.observedEndPoints.push({
2146
2145
  originEntityType: a.originEntityType,
2147
2146
  destinationEntityType: a.destinationEntityType
2148
2147
  });
2149
- return r;
2148
+ return t;
2150
2149
  }
2151
2150
  }
2152
2151
  const Ka = (e) => {
@@ -2160,7 +2159,7 @@ const Ka = (e) => {
2160
2159
  default:
2161
2160
  return e;
2162
2161
  }
2163
- }, Ba = (e) => {
2162
+ }, Ha = (e) => {
2164
2163
  switch (e) {
2165
2164
  case "Regular":
2166
2165
  return "esriGraphNamedObjectRegular";
@@ -2172,7 +2171,7 @@ const Ka = (e) => {
2172
2171
  return e;
2173
2172
  }
2174
2173
  };
2175
- function Ha(e) {
2174
+ function Ja(e) {
2176
2175
  switch (e) {
2177
2176
  case "esriGraphPropertyRegular":
2178
2177
  return "Regular";
@@ -2213,255 +2212,323 @@ function Ha(e) {
2213
2212
  function Y(e) {
2214
2213
  return e?.signal;
2215
2214
  }
2216
- function Ja(e, t) {
2217
- return t ? `${e}
2215
+ async function Za(e, r) {
2216
+ const t = await U("arcgis_knowledge_cypher_query_prompt");
2217
+ return r ? `${e} ${t}
2218
2218
 
2219
2219
  Your previous attempt to generate a cypher query failed. See the details below and generate a new cypher query that avoids this error.
2220
2220
 
2221
- Attempt Number: ${t.attemptCount}
2222
- Execution Error: ${t.executionError}
2221
+ Attempt Number: ${r.attemptCount}
2222
+ Execution Error: ${r.executionError}
2223
2223
  Failed Query:
2224
- ${t.failedGraphQuery}` : e;
2224
+ ${r.failedGraphQuery}` : `${e} ${t}`;
2225
2225
  }
2226
- async function Za(e, t, r, a) {
2227
- const { graphQuery: o, explanation: n } = await pe(e, t, r, a);
2226
+ async function Ya(e, r, t, a) {
2227
+ const { graphQuery: o, explanation: n } = await de(e, r, t, a);
2228
2228
  return { graphQuery: o, explanation: n };
2229
2229
  }
2230
- async function pe(e, t, r, a, o) {
2230
+ async function de(e, r, t, a, o) {
2231
2231
  const n = {
2232
- message: Ja(e, o),
2233
- context: new Va(t)
2234
- };
2235
- _.conversationId && (n.conversationId = _.conversationId);
2236
- const l = Y(a);
2232
+ message: await Za(e, o),
2233
+ context: new Ua(r)
2234
+ }, l = Y(a);
2237
2235
  await S({ text: "Attempting to generate a cypher query from your prompt..." }, a);
2238
- const s = await me(`${r}/chat`, {
2236
+ const i = await he(`${t}/chat`, {
2239
2237
  method: "post",
2240
2238
  body: JSON.stringify(n),
2241
2239
  headers: {
2242
2240
  "Content-Type": "application/json",
2243
- token: he.findCredential(I.getDefault().url)?.token ?? ""
2241
+ token: pe.findCredential(k.getDefault().url)?.token ?? ""
2244
2242
  },
2245
2243
  signal: l
2246
2244
  });
2247
- if (s.httpStatus !== 200)
2248
- throw new Error(`Graph query service returned an error: ${s.httpStatus}`, {
2249
- cause: s.data
2245
+ if (i.httpStatus !== 200)
2246
+ throw new Error(`Graph query service returned an error: ${i.httpStatus}`, {
2247
+ cause: i.data
2250
2248
  });
2251
- _.conversationId || (_.conversationId = s.data.conversationId);
2252
2249
  let c = !1;
2253
2250
  const u = Date.now();
2254
- let d = s.data.sequenceNumber, p = "", h = "", y = 1;
2251
+ let d = i.data.sequenceNumber, p = "", h = "", f = 1;
2255
2252
  for (; !c; ) {
2256
2253
  await new Promise((m) => setTimeout(m, 1e3)), await S(
2257
- { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, y)}` },
2254
+ { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, f)}` },
2258
2255
  a
2259
- ), y = y % 3 + 1;
2260
- const g = await me(`${r}/chat`, {
2256
+ ), f = f % 3 + 1;
2257
+ const y = await he(`${t}/chat`, {
2261
2258
  method: "post",
2262
2259
  body: JSON.stringify({
2263
- conversationId: s.data.conversationId,
2264
- inquiryId: s.data.inquiryId,
2260
+ conversationId: i.data.conversationId,
2261
+ inquiryId: i.data.inquiryId,
2265
2262
  ackSequenceNumber: d
2266
2263
  }),
2267
2264
  headers: {
2268
2265
  "Content-Type": "application/json",
2269
- token: he.findCredential(I.getDefault().url)?.token ?? ""
2266
+ token: pe.findCredential(k.getDefault().url)?.token ?? ""
2270
2267
  },
2271
2268
  signal: l
2272
2269
  });
2273
- if (g.httpStatus !== 200)
2274
- throw new Error(`Graph query service polling returned an error: ${g.httpStatus}`, {
2275
- cause: g.data
2270
+ if (y.httpStatus !== 200)
2271
+ throw new Error(`Graph query service polling returned an error: ${y.httpStatus}`, {
2272
+ cause: y.data
2276
2273
  });
2277
- if (g.data.context?.kind) {
2278
- if (g.data.context.kind !== "GraphQueryGenerationResponse")
2279
- throw new Error(`Unexpected response from graph query service polling. Message: ${g.data.message}`, {
2280
- cause: g.data
2274
+ if (y.data.context?.kind) {
2275
+ if (y.data.context.kind !== "GraphQueryGenerationResponse")
2276
+ throw new Error(`Unexpected response from graph query service polling. Message: ${y.data.message}`, {
2277
+ cause: y.data
2281
2278
  });
2282
- p = g.data.context.graphQuery, h = g.data.message || "", c = !0;
2283
- } else if (!g.data.hasMore)
2279
+ p = y.data.context.graphQuery, h = y.data.message || "", c = !0;
2280
+ } else if (!y.data.hasMore)
2284
2281
  c = !0;
2285
2282
  else if (Date.now() - u > 6e4)
2286
2283
  throw new Error("Graph query service polling timed out after 1 minute.");
2287
- d = g.data.sequenceNumber;
2284
+ d = y.data.sequenceNumber;
2288
2285
  }
2289
2286
  return { graphQuery: p, explanation: h };
2290
2287
  }
2291
- const q = 3;
2292
- function ke(e, t = 100) {
2293
- const r = {};
2288
+ function Xa(e, r) {
2289
+ z(e, (t) => {
2290
+ r.set(`${t.typeName}__${t.id}`, {
2291
+ id: t.id,
2292
+ typeName: t.typeName
2293
+ });
2294
+ });
2295
+ }
2296
+ function z(e, r) {
2297
+ if (!(!e || typeof e != "object")) {
2298
+ if (to(e))
2299
+ for (const t of e.path)
2300
+ z(t, r);
2301
+ else if (eo(e))
2302
+ r(e);
2303
+ else if (Array.isArray(e))
2304
+ for (const t of e)
2305
+ z(t, r);
2306
+ else if (ro(e))
2307
+ for (const t of Object.values(e.properties ?? {}))
2308
+ z(t, r);
2309
+ }
2310
+ }
2311
+ function eo(e) {
2312
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
2313
+ }
2314
+ function to(e) {
2315
+ return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
2316
+ }
2317
+ function ro(e) {
2318
+ return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
2319
+ }
2320
+ function ao(e, r) {
2321
+ const t = [], a = [], o = [
2322
+ [r.dataModel.entityTypes, t],
2323
+ [r.dataModel.relationshipTypes, a]
2324
+ ];
2325
+ for (const [n, l] of o)
2326
+ for (const i of n) {
2327
+ const c = e.getMemberIdsByType(i.name);
2328
+ l.push(...c);
2329
+ }
2330
+ return { entityIds: t, relationshipIds: a };
2331
+ }
2332
+ function oo(e, r) {
2333
+ const t = { entityIds: new Array(), relationshipIds: new Array() }, a = [], n = e?.allLayers.find((c) => c.type === "knowledge-graph")?.inclusionModeDefinition;
2334
+ if (!n)
2335
+ return { allNamedTypesFullyDynamic: !0, bindParameters: t, nonDynamicTypes: a };
2336
+ const l = [
2337
+ [r.dataModel.entityTypes, t.entityIds],
2338
+ [r.dataModel.relationshipTypes, t.relationshipIds]
2339
+ ];
2340
+ let i = !0;
2341
+ for (const [c, u] of l)
2342
+ for (const d of c) {
2343
+ const p = n.namedTypeDefinitions.get(d.name);
2344
+ if (!p) {
2345
+ i = !1, a.push(d.name);
2346
+ continue;
2347
+ }
2348
+ if (!p.useAllData) {
2349
+ i = !1, a.push(d.name);
2350
+ for (const [h] of p.members || [])
2351
+ u.push(h);
2352
+ }
2353
+ }
2354
+ return { allNamedTypesFullyDynamic: i, bindParameters: t, nonDynamicTypes: a };
2355
+ }
2356
+ const D = 3;
2357
+ function ke(e, r = 100) {
2358
+ const t = {};
2294
2359
  for (const a of Object.entries(e.properties ?? {})) {
2295
2360
  const [o, n] = a;
2296
- typeof n == "string" && n.length > t ? r[o] = `${n.slice(0, t)}... (truncated, original length: ${n.length})` : r[o] = n;
2361
+ typeof n == "string" && n.length > r ? t[o] = `${n.slice(0, r)}... (truncated, original length: ${n.length})` : t[o] = n;
2297
2362
  }
2298
- return e.properties = r, e;
2363
+ return e.properties = t, e;
2299
2364
  }
2300
- function A(e) {
2365
+ function P(e) {
2301
2366
  return typeof e != "object" || e === null ? String(e) : "details" in e && typeof e.details == "object" && e.details !== null && "errorMessage" in e.details && typeof e.details.errorMessage == "string" ? e.details.errorMessage : "message" in e && typeof e.message == "string" ? e.message : String(e);
2302
2367
  }
2303
- const Ya = async ({
2368
+ const no = async ({
2304
2369
  kg: e,
2305
- queryParams: t,
2306
- targetStructure: r,
2370
+ queryParams: r,
2371
+ targetStructure: t,
2307
2372
  targetStructureReducer: a,
2308
2373
  requestOptions: o,
2309
2374
  queryRowLimit: n,
2310
2375
  queryTimeoutMs: l
2311
2376
  }) => {
2312
- let s = null, c = r;
2377
+ let i = null, c = t;
2313
2378
  const u = new AbortController(), d = o?.signal, p = () => {
2314
2379
  u.abort(d?.reason);
2315
2380
  };
2316
2381
  d && (d.aborted ? u.abort(d.reason) : d.addEventListener("abort", p, { once: !0 }));
2317
2382
  try {
2318
- const h = await mt(e, t, o);
2319
- s = h.resultHeader;
2320
- const y = h.resultRowsStream.getReader();
2321
- let g = 0;
2322
- const m = Date.now(), w = !1;
2383
+ const h = await yt(e, r, o);
2384
+ i = h.resultHeader;
2385
+ const f = h.resultRowsStream.getReader();
2386
+ let y = 0;
2387
+ const m = Date.now(), g = !1;
2323
2388
  for (; ; ) {
2324
- const { done: T, value: C } = await y.read();
2389
+ const { done: T, value: $ } = await f.read();
2325
2390
  if (T)
2326
2391
  break;
2327
- if (!w && l && Date.now() - m > l)
2392
+ if (!g && l && Date.now() - m > l)
2328
2393
  return u.abort(), { type: "timeout" };
2329
- for (const v of C) {
2330
- if (g++, n && g > n)
2331
- return u.abort(), { type: "success", rowLimitReached: !0, resultHeader: s, processedResult: c };
2394
+ for (const v of $) {
2395
+ if (y++, n && y > n)
2396
+ return u.abort(), { type: "success", rowLimitReached: !0, resultHeader: i, processedResult: c };
2332
2397
  c = a(c, v);
2333
2398
  }
2334
2399
  }
2335
2400
  } catch (h) {
2336
- return u.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: A(h), error: h };
2401
+ return u.signal.aborted ? { type: "aborted" } : { type: "error", errorMessage: P(h), error: h };
2337
2402
  } finally {
2338
2403
  d?.removeEventListener("abort", p);
2339
2404
  }
2340
- return { type: "success", rowLimitReached: !1, resultHeader: s, processedResult: c };
2405
+ return { type: "success", rowLimitReached: !1, resultHeader: i, processedResult: c };
2341
2406
  };
2342
- async function Fe({
2407
+ async function Ne({
2343
2408
  prompt: e,
2409
+ bindParameters: r,
2344
2410
  kg: t,
2345
- graphQueryServiceUrl: r,
2346
- targetStructure: a,
2347
- targetStructureReducer: o,
2348
- requestOptions: n,
2349
- queryRowLimit: l,
2350
- queryTimeoutMs: s,
2351
- config: c
2411
+ graphQueryServiceUrl: a,
2412
+ targetStructure: o,
2413
+ targetStructureReducer: n,
2414
+ requestOptions: l,
2415
+ queryRowLimit: i,
2416
+ queryTimeoutMs: c,
2417
+ config: u
2352
2418
  }) {
2353
- let u;
2354
- for (let d = 1; d <= q; d++) {
2355
- let p;
2419
+ let d;
2420
+ for (let p = 1; p <= D; p++) {
2421
+ let h;
2356
2422
  try {
2357
- p = await pe(e, t.dataModel, r, c, u);
2358
- } catch (g) {
2423
+ h = await de(e, t.dataModel, a, u, d);
2424
+ } catch (m) {
2359
2425
  return {
2360
2426
  type: "generation-error",
2361
- errorMessage: A(g),
2362
- error: g
2427
+ errorMessage: P(m),
2428
+ error: m
2363
2429
  };
2364
2430
  }
2365
2431
  await S(
2366
2432
  {
2367
- text: `Attempting to execute query: ${p.graphQuery.substring(0, 500)}${p.graphQuery.length > 500 ? "..." : ""}`
2433
+ text: `Attempting to execute query: ${h.graphQuery.substring(0, 500)}${h.graphQuery.length > 500 ? "..." : ""}`
2368
2434
  },
2369
- c
2435
+ u
2370
2436
  );
2371
- const h = await Ya({
2437
+ const f = await no({
2372
2438
  kg: t,
2373
- queryParams: new xe({
2374
- openCypherQuery: p.graphQuery
2439
+ queryParams: new Se({
2440
+ openCypherQuery: h.graphQuery,
2441
+ bindParameters: r
2375
2442
  }),
2376
- targetStructure: a,
2377
- targetStructureReducer: o,
2378
- requestOptions: n,
2379
- queryRowLimit: l,
2380
- queryTimeoutMs: s
2381
- }), y = h.type === "aborted" ? "Query execution was aborted." : h.type === "timeout" ? "Query execution timed out." : h.type === "error" ? `Query failed with error: ${h.errorMessage}` : "";
2382
- if (h.type === "success")
2443
+ targetStructure: o,
2444
+ targetStructureReducer: n,
2445
+ requestOptions: l,
2446
+ queryRowLimit: i,
2447
+ queryTimeoutMs: c
2448
+ }), y = f.type === "aborted" ? "Query execution was aborted." : f.type === "timeout" ? "Query execution timed out." : f.type === "error" ? `Query failed with error: ${f.errorMessage}` : "";
2449
+ if (f.type === "success")
2383
2450
  return {
2384
2451
  type: "success",
2385
- graphQuery: p.graphQuery,
2386
- explanation: p.explanation,
2387
- rowLimitReached: h.rowLimitReached,
2388
- resultHeader: h.resultHeader,
2389
- processedResult: h.processedResult
2452
+ graphQuery: h.graphQuery,
2453
+ explanation: h.explanation,
2454
+ rowLimitReached: f.rowLimitReached,
2455
+ resultHeader: f.resultHeader,
2456
+ processedResult: f.processedResult
2390
2457
  };
2391
- if (h.type === "aborted")
2458
+ if (f.type === "aborted")
2392
2459
  return {
2393
2460
  type: "aborted",
2394
2461
  errorMessage: y,
2395
- graphQuery: p.graphQuery,
2396
- explanation: p.explanation
2462
+ graphQuery: h.graphQuery,
2463
+ explanation: h.explanation
2397
2464
  };
2398
- if (d >= q)
2399
- return h.type === "timeout" ? {
2465
+ if (p >= D)
2466
+ return f.type === "timeout" ? {
2400
2467
  type: "timeout",
2401
2468
  errorMessage: y,
2402
- graphQuery: p.graphQuery,
2403
- explanation: p.explanation
2469
+ graphQuery: h.graphQuery,
2470
+ explanation: h.explanation
2404
2471
  } : {
2405
2472
  type: "execution-error",
2406
2473
  errorMessage: y,
2407
- error: h.error,
2408
- graphQuery: p.graphQuery,
2409
- explanation: p.explanation
2474
+ error: f.error,
2475
+ graphQuery: h.graphQuery,
2476
+ explanation: h.explanation
2410
2477
  };
2411
- u = {
2412
- failedGraphQuery: p.graphQuery,
2478
+ d = {
2479
+ failedGraphQuery: h.graphQuery,
2413
2480
  executionError: y,
2414
- attemptCount: d
2481
+ attemptCount: p
2415
2482
  }, await S(
2416
- { text: `Attempt ${d} failed with error: ${y}. Retrying...` },
2417
- c
2483
+ { text: `Attempt ${p} failed with error: ${y}. Retrying...` },
2484
+ u
2418
2485
  );
2419
2486
  }
2420
2487
  throw new Error(
2421
- `Failed to execute generated cypher due to an unexpected error after ${q} attempts.`
2488
+ `Failed to execute generated cypher due to an unexpected error after ${D} attempts.`
2422
2489
  );
2423
2490
  }
2424
- const Xa = async ({
2491
+ const io = async ({
2425
2492
  kg: e,
2426
- searchQuery: t,
2427
- typeCategoryFilter: r,
2493
+ searchQuery: r,
2494
+ typeCategoryFilter: t,
2428
2495
  namedTypesFilter: a,
2429
2496
  searchResultLimit: o,
2430
2497
  requestOptions: n
2431
2498
  }) => {
2432
2499
  const l = [];
2433
- let s = [r];
2434
- r === "both" && !e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth") && (s = ["entity", "relationship"]);
2500
+ let i = [t];
2501
+ t === "both" && !e.serviceDefinition.serviceCapabilities.searchCapabilities.searchTypeFilterCapabilities.includes("esriTypeBoth") && (i = ["entity", "relationship"]);
2435
2502
  const c = o ?? 1 / 0;
2436
2503
  try {
2437
- for (const u of s) {
2504
+ for (const u of i) {
2438
2505
  const d = c - l.length;
2439
2506
  if (d <= 0)
2440
2507
  break;
2441
- const y = (await yt(
2508
+ const f = (await ft(
2442
2509
  e,
2443
- new ft({
2444
- searchQuery: t,
2510
+ new gt({
2511
+ searchQuery: r,
2445
2512
  typeCategoryFilter: u,
2446
2513
  namedTypesFilter: a ?? void 0,
2447
2514
  num: d
2448
2515
  }),
2449
2516
  n
2450
2517
  )).resultRowsStream.getReader();
2451
- let g = !1;
2452
- for (; !g; ) {
2453
- const { done: m, value: w } = await y.read();
2518
+ let y = !1;
2519
+ for (; !y; ) {
2520
+ const { done: m, value: g } = await f.read();
2454
2521
  if (m) {
2455
- g = !0;
2522
+ y = !0;
2456
2523
  break;
2457
2524
  }
2458
- for (const T of w)
2459
- for (const C of T)
2460
- l.push(C);
2525
+ for (const T of g)
2526
+ for (const $ of T)
2527
+ l.push($);
2461
2528
  }
2462
2529
  }
2463
2530
  } catch (u) {
2464
- const d = A(u);
2531
+ const d = P(u);
2465
2532
  return n?.signal?.aborted ? {
2466
2533
  type: "aborted",
2467
2534
  errorMessage: d,
@@ -2472,156 +2539,156 @@ const Xa = async ({
2472
2539
  type: "success",
2473
2540
  results: l
2474
2541
  };
2475
- };
2476
- function eo(e, t) {
2477
- D(e, (r) => {
2478
- t.set(`${r.typeName}__${r.id}`, {
2479
- id: r.id,
2480
- typeName: r.typeName
2481
- });
2482
- });
2483
- }
2484
- function D(e, t) {
2485
- if (!(!e || typeof e != "object")) {
2486
- if (ro(e))
2487
- for (const r of e.path)
2488
- D(r, t);
2489
- else if (to(e))
2490
- t(e);
2491
- else if (Array.isArray(e))
2492
- for (const r of e)
2493
- D(r, t);
2494
- else if (ao(e))
2495
- for (const r of Object.values(e.properties ?? {}))
2496
- D(r, t);
2497
- }
2498
- }
2499
- function to(e) {
2500
- return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
2501
- }
2502
- function ro(e) {
2503
- return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
2504
- }
2505
- function ao(e) {
2506
- return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
2507
- }
2508
- function oo(e, t) {
2509
- const r = [];
2510
- for (const a of [...t.dataModel.entityTypes, ...t.dataModel.relationshipTypes]) {
2511
- const o = e.getMemberIdsByType(a.name);
2512
- for (const n of o)
2513
- r.push({ id: n, typeName: a.name });
2542
+ }, qe = "IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";
2543
+ async function Ie({
2544
+ prompt: e,
2545
+ view: r,
2546
+ knowledgeGraph: t,
2547
+ includeReturnEntityAndRelationshipContext: a = !1
2548
+ }) {
2549
+ const o = [e];
2550
+ if (a && o.push(qe), !q(r)) {
2551
+ const d = await U("arcgis_knowledge_current_lc_context"), p = ao(r.map, t);
2552
+ return o.push(d), {
2553
+ enhancedPrompt: o.join(`
2554
+
2555
+ `),
2556
+ bindParameters: p,
2557
+ allNamedTypesFullyDynamic: !1
2558
+ };
2514
2559
  }
2515
- return r;
2516
- }
2517
- function no(e) {
2518
- const t = [], r = [], o = e?.allLayers.find((n) => n.type === "knowledge-graph")?.inclusionModeDefinition;
2519
- if (o?.generateAllSublayers)
2520
- return { allNamedTypesFullyDynamic: !0, idTypePairs: t, dynamicTypes: r };
2521
- for (const [n, l] of o?.namedTypeDefinitions ?? [])
2522
- if (l.useAllData)
2523
- r.push(n);
2524
- else
2525
- for (const [s] of l.members)
2526
- t.push({ id: s, typeName: n });
2527
- return { allNamedTypesFullyDynamic: !1, idTypePairs: t, dynamicTypes: r };
2560
+ const n = r.map, { allNamedTypesFullyDynamic: l, bindParameters: i, nonDynamicTypes: c } = oo(
2561
+ n,
2562
+ t
2563
+ );
2564
+ if (l)
2565
+ return {
2566
+ enhancedPrompt: o.join(`
2567
+
2568
+ `),
2569
+ bindParameters: i,
2570
+ allNamedTypesFullyDynamic: !0
2571
+ };
2572
+ const u = (await U("arcgis_knowledge_current_map_context")).replaceAll(
2573
+ "{nonDynamicTypes}",
2574
+ JSON.stringify(c)
2575
+ );
2576
+ return o.push(u), {
2577
+ enhancedPrompt: o.join(`
2578
+
2579
+ `),
2580
+ bindParameters: i,
2581
+ allNamedTypesFullyDynamic: l
2582
+ };
2528
2583
  }
2529
- async function io(e, t, r, a, o) {
2530
- const { view: n } = a, l = await Fe({
2584
+ async function so(e, r, t, a, o, n) {
2585
+ const { view: l } = o, i = await Ne({
2531
2586
  prompt: e,
2587
+ bindParameters: r,
2532
2588
  kg: t,
2533
- graphQueryServiceUrl: r,
2589
+ graphQueryServiceUrl: a,
2534
2590
  targetStructure: /* @__PURE__ */ new Map(),
2535
- targetStructureReducer: (p, h) => {
2536
- for (const y of h)
2537
- eo(y, p);
2538
- return p;
2591
+ targetStructureReducer: (h, f) => {
2592
+ for (const y of f)
2593
+ Xa(y, h);
2594
+ return h;
2539
2595
  },
2540
2596
  requestOptions: {
2541
- signal: Y(o),
2542
- timeout: o?.timeout
2597
+ signal: Y(n),
2598
+ timeout: n?.timeout
2543
2599
  },
2544
- config: o
2600
+ config: n
2545
2601
  });
2546
- if (l.type !== "success") {
2547
- const p = l.type === "generation-error" ? l.errorMessage : `${l.errorMessage} Cypher query: ${l.graphQuery}`;
2548
- throw new Error(`Failed to add records to the link chart. ${p}`);
2602
+ if (i.type !== "success") {
2603
+ const h = i.type === "generation-error" ? i.errorMessage : `${i.errorMessage} Cypher query: ${i.graphQuery}`;
2604
+ throw new Error(`Failed to add records to the link chart. ${h}`);
2549
2605
  }
2550
- const { graphQuery: s, explanation: c, processedResult: u } = l, d = Array.from(u.values());
2606
+ const { graphQuery: c, explanation: u, processedResult: d } = i, p = Array.from(d.values());
2551
2607
  return await S(
2552
2608
  {
2553
- text: `Query Results parsed into ${d.length} unique relationships and entities. Atempting to add to link chart...`
2609
+ text: `Query Results parsed into ${p.length} unique relationships and entities. Atempting to add to link chart...`
2554
2610
  },
2555
- o
2556
- ), !F(n) && n?.map ? (await n.map.addRecords(d), await J(n), { generatedQuery: s, explanation: c, addedIdTypePairs: d }) : (await n?.map?.allLayers.find(
2557
- (h) => h.type === "knowledge-graph"
2558
- )?.addRecords(d), { generatedQuery: s, explanation: c, addedIdTypePairs: d });
2559
- }
2560
- const W = "addRecords", so = i.object({
2561
- prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be run.")
2562
- }), lo = async ({ prompt: e }, t) => {
2563
- const { knowledgeGraph: r } = await O(t), a = Z(t), { view: o } = a, l = I.getDefault().helperServices;
2564
- let s = e;
2565
- if (F(o)) {
2566
- const c = o.map, { allNamedTypesFullyDynamic: u, idTypePairs: d, dynamicTypes: p } = no(c), h = await te("arcgis_knowledge_current_map_context");
2567
- if (s = `${e}
2568
-
2569
- ${h}${JSON.stringify(d)} and all entities or relationships with the the following typeNames in the array: ${JSON.stringify(p)}`, u)
2570
- return {
2571
- toolName: W,
2572
- status: "success",
2573
- summary: "No records have been added to the map because all data in the knowledge graph is contained in the map.",
2574
- details: {
2575
- generatedQuery: "N/A",
2576
- explanation: "All named types in the knowledge graph are fully dynamic and therefore all data is already contained in the map. No records have been added.",
2577
- addedIdTypePairs: []
2578
- }
2579
- };
2580
- } else {
2581
- const c = o.map, u = await te("arcgis_knowledge_current_lc_context"), d = oo(c, r);
2582
- s = `${e}
2583
-
2584
- ${u}${JSON.stringify(d)}`;
2585
- }
2611
+ n
2612
+ ), !q(l) && l?.map ? (await l.map.addRecords(p), await Z(l), { generatedQuery: c, explanation: u, addedIdTypePairs: p }) : (await l?.map?.allLayers.find(
2613
+ (f) => f.type === "knowledge-graph"
2614
+ )?.addRecords(p), { generatedQuery: c, explanation: u, addedIdTypePairs: p });
2615
+ }
2616
+ const W = "addRecords", lo = s.object({
2617
+ prompt: s.string().describe(
2618
+ "The user's inquiry and context required in order to generate a cypher query that will be used to add records to the link chart."
2619
+ )
2620
+ }), co = async ({ prompt: e }, r) => {
2621
+ const { knowledgeGraph: t } = await M(r), a = O(r), { view: o } = a, l = k.getDefault().helperServices, {
2622
+ enhancedPrompt: i,
2623
+ bindParameters: c,
2624
+ allNamedTypesFullyDynamic: u
2625
+ } = await Ie({
2626
+ prompt: e,
2627
+ view: o,
2628
+ knowledgeGraph: t,
2629
+ includeReturnEntityAndRelationshipContext: !0
2630
+ });
2631
+ if (u)
2632
+ return {
2633
+ toolName: W,
2634
+ status: "success",
2635
+ summary: "No records have been added to the map because all data in the knowledge graph is contained in the map.",
2636
+ details: {
2637
+ generatedQuery: "N/A",
2638
+ explanation: "All named types in the knowledge graph are fully dynamic and therefore all data is already contained in the map. No records have been added.",
2639
+ addedIdTypePairs: []
2640
+ }
2641
+ };
2586
2642
  try {
2587
- const { generatedQuery: c, explanation: u, addedIdTypePairs: d } = await io(
2588
- s,
2589
- r,
2643
+ const { generatedQuery: d, explanation: p, addedIdTypePairs: h } = await so(
2644
+ i,
2645
+ c,
2646
+ t,
2590
2647
  `${l.aiAssistantServices.url}${l.aiAssistantServices.graphQueryAssistant}`,
2591
2648
  a,
2592
- t
2649
+ r
2593
2650
  );
2594
2651
  return {
2595
2652
  toolName: W,
2596
2653
  status: "success",
2597
- summary: `Records added successfully. Cypher Query used: ${c}
2654
+ summary: `Records added successfully. Cypher Query used: ${d}
2598
2655
 
2599
- Number of records added: ${d.length}`,
2656
+ Number of records added: ${h.length}`,
2600
2657
  details: {
2601
- generatedQuery: c,
2602
- explanation: u,
2603
- addedIdTypePairs: d
2658
+ generatedQuery: d,
2659
+ explanation: p,
2660
+ addedIdTypePairs: h
2604
2661
  }
2605
2662
  };
2606
- } catch (c) {
2607
- const u = A(c);
2608
- return console.error(`Failed to add records to the link chart. ${u}`, c), {
2663
+ } catch (d) {
2664
+ const p = P(d);
2665
+ return {
2609
2666
  toolName: W,
2610
2667
  status: "error",
2611
- errorMessage: `Failed to add records to the link chart. ${u}`,
2612
- error: c
2668
+ errorMessage: `Failed to add records to the link chart. ${p}`,
2669
+ error: d
2613
2670
  };
2614
2671
  }
2615
- }, ti = f(lo, {
2672
+ }, ri = w(co, {
2616
2673
  name: W,
2617
- description: "Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt.",
2618
- schema: so
2674
+ description: `Adds records (entities or relationships) to the current link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the records to be added to the link chart. The user should have explicitly requested to add records to the current link chart from their prompt. "add to new link chart" is not a valid prompt for this tool.
2675
+
2676
+ example prompts:
2677
+ - "add all suppliers and the parts they produce to the link chart"
2678
+ - "show me the competitors of company x and add them to the link chart"
2679
+ - "add the relationships between company x and company y to the link chart"
2680
+ - "expand all the companies"
2681
+ - "expand company x through all the buildings it owns"
2682
+ - "connect company x and company y"
2683
+ - "connect all buildings on the link chart"
2684
+ `,
2685
+ schema: lo
2619
2686
  });
2620
- async function co(e, t) {
2621
- return await t.map?.applyLayout(e), await J(t), { appliedLayout: e };
2687
+ async function uo(e, r) {
2688
+ return await r.map?.applyLayout(e), await Z(r), { appliedLayout: e };
2622
2689
  }
2623
- const ae = "applyLayout", uo = i.object({
2624
- layout: i.enum([
2690
+ const re = "applyLayout", po = s.object({
2691
+ layout: s.enum([
2625
2692
  "organic-standard",
2626
2693
  "organic-community",
2627
2694
  "basic-grid",
@@ -2634,19 +2701,19 @@ const ae = "applyLayout", uo = i.object({
2634
2701
  ]).describe(
2635
2702
  "The layout mode to apply to the link chart. The value must be one of the following: organic-standard, organic-community, basic-grid, hierarchical-bottom-to-top, radial-root-centric, tree-left-to-right, geographic-organic-standard, chronological-mono-timeline, chronological-multi-timeline"
2636
2703
  )
2637
- }), po = async ({ layout: e }, t) => {
2638
- const { view: r } = Z(t);
2639
- if (F(r))
2704
+ }), ho = async ({ layout: e }, r) => {
2705
+ const { view: t } = O(r);
2706
+ if (q(t))
2640
2707
  return {
2641
- toolName: ae,
2708
+ toolName: re,
2642
2709
  status: "error",
2643
2710
  errorMessage: "The applyLayout tool can only be used with a LinkChartView.",
2644
2711
  error: new Error()
2645
2712
  };
2646
2713
  {
2647
- const { appliedLayout: a } = await co(e, r);
2714
+ const { appliedLayout: a } = await uo(e, t);
2648
2715
  return {
2649
- toolName: ae,
2716
+ toolName: re,
2650
2717
  status: "success",
2651
2718
  summary: `Successfully applied layout: ${a}.`,
2652
2719
  details: {
@@ -2654,29 +2721,29 @@ const ae = "applyLayout", uo = i.object({
2654
2721
  }
2655
2722
  };
2656
2723
  }
2657
- }, ri = f(po, {
2658
- name: ae,
2724
+ }, ai = w(ho, {
2725
+ name: re,
2659
2726
  description: "Apply a diagram layout to the link chart",
2660
- schema: uo
2727
+ schema: po
2661
2728
  });
2662
- async function ho(e, t) {
2663
- return t.map?.changeNonspatialDataDisplay(e), await J(t), { appliedNonspatialDataDisplayMode: e };
2664
- }
2665
- const oe = "changeNonspatialVisibility", mo = i.object({
2666
- setting: i.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
2667
- }), yo = async ({ setting: e }, t) => {
2668
- const { view: r } = Z(t);
2669
- if (F(r))
2729
+ async function mo(e, r) {
2730
+ return r.map?.changeNonspatialDataDisplay(e), await Z(r), { appliedNonspatialDataDisplayMode: e };
2731
+ }
2732
+ const ae = "changeNonspatialVisibility", yo = s.object({
2733
+ setting: s.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
2734
+ }), fo = async ({ setting: e }, r) => {
2735
+ const { view: t } = O(r);
2736
+ if (q(t))
2670
2737
  return {
2671
- toolName: oe,
2738
+ toolName: ae,
2672
2739
  status: "error",
2673
2740
  errorMessage: "The changeNonspatialVisibility tool can only be used with a LinkChartView.",
2674
2741
  error: new Error()
2675
2742
  };
2676
2743
  {
2677
- const { appliedNonspatialDataDisplayMode: a } = await ho(e, r);
2744
+ const { appliedNonspatialDataDisplayMode: a } = await mo(e, t);
2678
2745
  return {
2679
- toolName: oe,
2746
+ toolName: ae,
2680
2747
  status: "success",
2681
2748
  summary: `Successfully applied nonspatial visibility setting: ${a}.`,
2682
2749
  details: {
@@ -2684,26 +2751,26 @@ const oe = "changeNonspatialVisibility", mo = i.object({
2684
2751
  }
2685
2752
  };
2686
2753
  }
2687
- }, ai = f(yo, {
2688
- name: oe,
2754
+ }, oi = w(fo, {
2755
+ name: ae,
2689
2756
  description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
2690
- schema: mo
2757
+ schema: yo
2691
2758
  });
2692
- async function fo(e, t, r, a, o) {
2759
+ async function go(e, r, t, a, o) {
2693
2760
  let n, l = "";
2694
- for (let s = 1; s <= q; s++) {
2695
- const { graphQuery: c, explanation: u } = await pe(
2761
+ for (let i = 1; i <= D; i++) {
2762
+ const { graphQuery: c, explanation: u } = await de(
2696
2763
  e,
2697
- t.dataModel,
2698
- r,
2764
+ r.dataModel,
2765
+ t,
2699
2766
  o,
2700
2767
  n
2701
2768
  );
2702
2769
  try {
2703
2770
  await S({ text: `Attempting to create link chart from derived query: ${c}` }, o);
2704
- const d = await ht.fromCypherQuery(
2705
- t,
2706
- new xe({
2771
+ const d = await mt.fromCypherQuery(
2772
+ r,
2773
+ new Se({
2707
2774
  openCypherQuery: c
2708
2775
  })
2709
2776
  );
@@ -2715,39 +2782,39 @@ async function fo(e, t, r, a, o) {
2715
2782
  ${c}
2716
2783
 
2717
2784
  Explanation: ${u}`
2718
- }) : (await J(a), {
2785
+ }) : (await Z(a), {
2719
2786
  type: "success",
2720
2787
  graphQuery: c,
2721
2788
  explanation: u
2722
2789
  });
2723
2790
  } catch (d) {
2724
- const p = A(d);
2725
- if (s >= q) {
2791
+ const p = P(d);
2792
+ if (i >= D) {
2726
2793
  l = p;
2727
2794
  break;
2728
2795
  }
2729
2796
  n = {
2730
2797
  failedGraphQuery: c,
2731
2798
  executionError: p,
2732
- attemptCount: s
2799
+ attemptCount: i
2733
2800
  }, await S(
2734
- { text: `Attempt ${s} to create link chart failed with error: ${p}. Retrying ...` },
2801
+ { text: `Attempt ${i} to create link chart failed with error: ${p}. Retrying ...` },
2735
2802
  o
2736
2803
  );
2737
2804
  }
2738
2805
  }
2739
2806
  return {
2740
2807
  type: "error",
2741
- errorMessage: `Failed to create link chart after ${q} attempts. Last error: ${l}`
2808
+ errorMessage: `Failed to create link chart after ${D} attempts. Last error: ${l}`
2742
2809
  };
2743
2810
  }
2744
- const V = "createLinkChart", go = i.object({
2745
- prompt: i.string().describe(
2746
- "The user's inquiry into the knowledge graph that needs to be transformed into a link chart visualization."
2811
+ const V = "createLinkChart", wo = s.object({
2812
+ prompt: s.string().describe(
2813
+ "The user's inquiry and context required in order to generate a cypher query that will be used to create a link chart visualization. Only include information relevant to generating a cypher query. Do not suggest entity types, relationship types or properties. Do not include limits or formatting instructions for the query results unless specifically requested by the user. The prompt should be focused on the data the user wants to see in the link chart, not how to generate it."
2747
2814
  )
2748
- }), wo = async ({ prompt: e }, t) => {
2749
- const { knowledgeGraph: r } = await O(t), { view: a } = Z(t);
2750
- if (F(a))
2815
+ }), bo = async ({ prompt: e }, r) => {
2816
+ const { knowledgeGraph: t } = await M(r), { view: a } = O(r);
2817
+ if (q(a))
2751
2818
  return {
2752
2819
  toolName: V,
2753
2820
  status: "error",
@@ -2755,12 +2822,14 @@ const V = "createLinkChart", go = i.object({
2755
2822
  error: new Error()
2756
2823
  };
2757
2824
  {
2758
- const n = I.getDefault().helperServices, l = await fo(
2759
- e,
2760
- r,
2825
+ const n = k.getDefault().helperServices, l = await go(
2826
+ `${e}
2827
+
2828
+ ${qe}`,
2829
+ t,
2761
2830
  `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
2762
2831
  a,
2763
- t
2832
+ r
2764
2833
  );
2765
2834
  if (l.type === "error")
2766
2835
  return {
@@ -2769,107 +2838,116 @@ const V = "createLinkChart", go = i.object({
2769
2838
  errorMessage: l.errorMessage,
2770
2839
  error: new Error()
2771
2840
  };
2772
- const { graphQuery: s, explanation: c } = l;
2841
+ const { graphQuery: i, explanation: c } = l;
2773
2842
  return {
2774
2843
  toolName: V,
2775
2844
  status: "success",
2776
2845
  summary: `Link chart created successfully. Cypher Query used to create the link chart:
2777
- ${s}
2846
+ ${i}
2778
2847
 
2779
2848
  Explanation: ${c}`,
2780
2849
  details: {
2781
- generatedQuery: s,
2850
+ generatedQuery: i,
2782
2851
  explanation: c
2783
2852
  }
2784
2853
  };
2785
2854
  }
2786
- }, oi = f(wo, {
2855
+ }, ni = w(bo, {
2787
2856
  name: V,
2788
- description: "Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt.",
2789
- schema: go
2790
- }), ne = "queryGraphData", bo = i.object({
2791
- prompt: i.string().describe(
2792
- `The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. IMPORTANT:
2793
-
2794
- REQUEST LIMIT: If the user does not specifically request for no limits or an explicit limit to be placed on the query, or the number of rows will not be limited by e.g. the number of entity or relationship types in the graph, ensure that the generated query has a reasonable row limit (e.g. 10 rows).
2795
-
2796
- DESCRIPTIVE COLUMN NAMES: If the user's prompt does not explicitly request for specific column names in the result, ensure that the generated query has descriptive column names (using AS statements) to make the results easier to understand when displayed in a table format.`
2857
+ description: "Creates a new link chart visualization from an inquiry into the knowledge graph data. The inquiry will retrieve data from the graph database that will serve as the basis for the new link chart. The user should have explicitly requested the creation of a new link chart from their prompt using language like 'create new link chart' or 'add to new link chart'.",
2858
+ schema: wo
2859
+ }), oe = "queryGraphData", To = s.object({
2860
+ prompt: s.string().describe(
2861
+ "The user's inquiry into the knowledge graph, from which a cypher query will be generated and executed to answer the inquiry. Only include entity types, relationship types or properties if they are provided in the user prompt or prior steps. Do not suggest entity types, relationship types or properties. Do not include limits, information on what to return, instructions on how to write the query, or formatting instructions for the query results unless specifically requested by the user."
2797
2862
  )
2798
- }), To = async ({ prompt: e }, t) => {
2799
- const { knowledgeGraph: r } = await O(t), o = I.getDefault().helperServices, n = await Fe({
2863
+ }), vo = async ({ prompt: e }, r) => {
2864
+ const { knowledgeGraph: t } = await M(r), o = k.getDefault().helperServices;
2865
+ let n = e, l = null, i = null;
2866
+ try {
2867
+ ({ view: i } = O(r));
2868
+ } catch {
2869
+ }
2870
+ i && ({ enhancedPrompt: n, bindParameters: l } = await Ie({
2800
2871
  prompt: e,
2801
- kg: r,
2872
+ view: i,
2873
+ knowledgeGraph: t,
2874
+ includeReturnEntityAndRelationshipContext: !1
2875
+ }));
2876
+ const c = await Ne({
2877
+ prompt: n,
2878
+ bindParameters: l,
2879
+ kg: t,
2802
2880
  graphQueryServiceUrl: `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
2803
2881
  targetStructure: new Array(),
2804
- targetStructureReducer: (y, g) => (y.push(g), y),
2882
+ targetStructureReducer: (g, T) => (g.push(T), g),
2805
2883
  requestOptions: {
2806
- signal: Y(t),
2807
- timeout: t?.timeout
2884
+ signal: Y(r),
2885
+ timeout: r?.timeout
2808
2886
  },
2809
- config: t
2887
+ config: r
2810
2888
  });
2811
- if (n.type !== "success") {
2812
- const y = n.type === "generation-error" ? n.errorMessage : `${n.errorMessage} Cypher query: ${n.graphQuery}`;
2889
+ if (c.type !== "success") {
2890
+ const g = c.type === "generation-error" ? c.errorMessage : `${c.errorMessage} Cypher query: ${c.graphQuery}`;
2813
2891
  return {
2814
- toolName: ne,
2892
+ toolName: oe,
2815
2893
  status: "error",
2816
- errorMessage: `Failed to query the knowledge graph. ${y}`,
2817
- error: "error" in n ? n.error : null
2894
+ errorMessage: `Failed to query the knowledge graph. ${g}`,
2895
+ error: "error" in c ? c.error : null
2818
2896
  };
2819
2897
  }
2820
- const { graphQuery: l, explanation: s, processedResult: c, resultHeader: u } = n, d = u.headerKeys;
2821
- for (const y of c)
2822
- for (const g of y)
2823
- D(
2824
- g,
2825
- (m) => ke(m)
2898
+ const { graphQuery: u, explanation: d, processedResult: p, resultHeader: h } = c, f = h.headerKeys;
2899
+ for (const g of p)
2900
+ for (const T of g)
2901
+ z(
2902
+ T,
2903
+ ($) => ke($)
2826
2904
  );
2827
- const p = 50, h = c.slice(0, p).map((y) => JSON.stringify(y));
2905
+ const y = 50, m = p.slice(0, y).map((g) => JSON.stringify(g));
2828
2906
  return {
2829
- toolName: ne,
2907
+ toolName: oe,
2830
2908
  status: "success",
2831
2909
  summary: `To answer the inquiry, the following cypher query was executed against the knowledge graph:
2832
2910
 
2833
2911
  \`\`\`cypher
2834
- ${l}
2912
+ ${u}
2835
2913
  \`\`\`
2836
2914
 
2837
2915
  Query Results:
2838
- ${h.length} result(s) found.
2916
+ ${m.length} result(s) found.
2839
2917
 
2840
- Column Headers: ${d.join(", ")}
2918
+ Column Headers: ${f.join(", ")}
2841
2919
 
2842
- ${h.length > p ? `Showing top ${p} results:
2920
+ ${m.length > y ? `Showing top ${y} results:
2843
2921
 
2844
2922
  ` : `Results:
2845
2923
 
2846
- `}${h.join(`
2924
+ `}${m.join(`
2847
2925
  `)}
2848
2926
  `,
2849
2927
  details: {
2850
- generatedQuery: l,
2851
- explanation: s,
2852
- resultHeader: u,
2853
- queryResults: c
2928
+ generatedQuery: u,
2929
+ explanation: d,
2930
+ resultHeader: h,
2931
+ queryResults: p
2854
2932
  }
2855
2933
  };
2856
- }, ni = f(To, {
2857
- name: ne,
2934
+ }, ii = w(vo, {
2935
+ name: oe,
2858
2936
  description: "Allows users to explore the data in their knowledge graph via cypher query. Generates and executes a cypher query based on the user's inquiry into the knowledge graph, and displays the results in the chat pane without modifying the user's link chart if any. Use this tool when the user is asking an exploratory question about their data as a whole that can be answered via cypher query, for example 'What are the top 5 suppliers by total parts cost?' or 'How many employees do we have in each department?'.",
2859
- schema: bo
2860
- }), ie = "generateCypher", vo = i.object({
2861
- prompt: i.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
2862
- }), So = async ({ prompt: e }, t) => {
2863
- const { knowledgeGraph: r } = await O(t), o = I.getDefault().helperServices;
2937
+ schema: To
2938
+ }), ne = "generateCypher", So = s.object({
2939
+ prompt: s.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
2940
+ }), xo = async ({ prompt: e }, r) => {
2941
+ const { knowledgeGraph: t } = await M(r), o = k.getDefault().helperServices;
2864
2942
  try {
2865
- const { graphQuery: n, explanation: l } = await Za(
2943
+ const { graphQuery: n, explanation: l } = await Ya(
2866
2944
  e,
2867
- r.dataModel,
2945
+ t.dataModel,
2868
2946
  `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
2869
- t
2947
+ r
2870
2948
  );
2871
2949
  return {
2872
- toolName: ie,
2950
+ toolName: ne,
2873
2951
  status: "success",
2874
2952
  summary: `Generated Graph Query:
2875
2953
  ${n}
@@ -2881,94 +2959,95 @@ Explanation: ${l}`,
2881
2959
  }
2882
2960
  };
2883
2961
  } catch (n) {
2884
- const l = A(n);
2962
+ const l = P(n);
2885
2963
  return {
2886
- toolName: ie,
2964
+ toolName: ne,
2887
2965
  status: "error",
2888
2966
  errorMessage: `Failed to generate Cypher query. ${l}`,
2889
2967
  error: n
2890
2968
  };
2891
2969
  }
2892
- }, ii = f(So, {
2893
- name: ie,
2970
+ }, si = w(xo, {
2971
+ name: ne,
2894
2972
  description: "Generates an Open Cypher query based on the user's prompt which represents an inquiry into the data of the knowledge service and its graph database, attempting to filter based on certain conditions and traverse specified relationships. The generated query should be syntactically correct and optimized for performance.",
2895
- schema: vo
2896
- }), xo = (e) => {
2897
- const t = e.dataModel, r = /* @__PURE__ */ new Map();
2898
- for (const s of t.searchIndexes)
2899
- if (s.supportedCategory !== "esriTypeMetaEntityProvenance")
2900
- for (const [c, u] of s.searchProperties.entries()) {
2901
- const d = r.get(c) ?? /* @__PURE__ */ new Set();
2902
- u.propertyNames.forEach((p) => d.add(p)), r.set(c, d);
2973
+ schema: So
2974
+ }), Ro = (e) => {
2975
+ const r = e.dataModel, t = /* @__PURE__ */ new Map();
2976
+ for (const i of r.searchIndexes)
2977
+ if (i.supportedCategory !== "esriTypeMetaEntityProvenance")
2978
+ for (const [c, u] of i.searchProperties.entries()) {
2979
+ const d = t.get(c) ?? /* @__PURE__ */ new Set();
2980
+ u.propertyNames.forEach((p) => d.add(p)), t.set(c, d);
2903
2981
  }
2904
- const a = t.entityTypes.filter((s) => r.has(s.name)), o = t.relationshipTypes.filter((s) => r.has(s.name)), n = `Entity Types:
2905
- ${a.map(({ name: s }) => `${s}: [${Array.from(r.get(s) ?? []).join(", ")}]`).join(`
2982
+ const a = r.entityTypes.filter((i) => t.has(i.name)), o = r.relationshipTypes.filter((i) => t.has(i.name)), n = `Entity Types:
2983
+ ${a.map(({ name: i }) => `${i}: [${Array.from(t.get(i) ?? []).join(", ")}]`).join(`
2906
2984
  `)}`, l = `Relationship Types:
2907
- ${o.map(({ name: s }) => `${s}: [${Array.from(r.get(s) ?? []).join(", ")}]`).join(`
2985
+ ${o.map(({ name: i }) => `${i}: [${Array.from(t.get(i) ?? []).join(", ")}]`).join(`
2908
2986
  `)}`;
2909
2987
  return `${n}
2910
2988
 
2911
2989
  ${l}`;
2912
2990
  };
2913
- async function Ro(e, t) {
2914
- const r = await te("arcgis_knowledge_lucene_generation_prompt"), a = {
2991
+ async function $o(e, r, t) {
2992
+ const a = await U("arcgis_knowledge_lucene_generation_prompt"), o = {
2915
2993
  inquiry: e,
2916
- dataModelForSearch: xo(t)
2917
- }, o = i.enum(["entity", "relationship", "both"]).describe("The graph element category to search against - entity, relationship, or both"), n = i.number().int().positive().nullable().describe(
2994
+ dataModelForSearch: Ro(r)
2995
+ }, n = s.enum(["entity", "relationship", "both"]).describe("The graph element category to search against - entity, relationship, or both"), l = s.number().int().positive().nullable().describe(
2918
2996
  "The maximum number of search results to return. Default to 10 if not specified by the user, or set to null if the user specifically requests no limits or all results."
2919
- ), l = i.array(
2920
- i.enum(
2921
- t.dataModel.entityTypes.map((u) => u.name).concat(t.dataModel.relationshipTypes.map((u) => u.name))
2997
+ ), i = s.array(
2998
+ s.enum(
2999
+ r.dataModel.entityTypes.map((d) => d.name).concat(r.dataModel.relationshipTypes.map((d) => d.name))
2922
3000
  )
2923
- ).min(1), s = i.object({
2924
- query: i.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),
2925
- typeFilters: l.nullable().describe(
3001
+ ).min(1), c = s.object({
3002
+ query: s.string().describe("A lucene syntax query string to be executed against the knowledge graph search API"),
3003
+ typeFilters: i.nullable().describe(
2926
3004
  "Nullable list of entity or relationship types from the graph to limit the search to. If set to null, search will execute against all named types with indexed properties in the graph"
2927
3005
  ),
2928
- typeCategoryFilter: o,
2929
- resultLimit: n
3006
+ typeCategoryFilter: n,
3007
+ resultLimit: l
2930
3008
  });
2931
- return await De({
2932
- promptText: r,
2933
- inputVariables: a,
2934
- schema: s
3009
+ return await Pe({
3010
+ promptText: a,
3011
+ inputVariables: o,
3012
+ schema: c,
3013
+ config: t
2935
3014
  });
2936
3015
  }
2937
- const se = "searchGraphData", $o = i.object({
2938
- prompt: i.string().describe(
3016
+ const ie = "searchGraphData", Co = s.object({
3017
+ prompt: s.string().describe(
2939
3018
  "The user's inquiry into the knowledge graph, from which a lucene search query will be generated and executed against the graph to return relevant results."
2940
3019
  )
2941
- }), Co = async ({ prompt: e }, t) => {
2942
- const { knowledgeGraph: r } = await O(t);
2943
- await S({ text: "Generating search query for the user inquiry" }, t);
2944
- const a = await Ro(e, r);
2945
- await S({ text: "Executing graph search with generated search query" }, t);
2946
- const o = await Xa({
2947
- kg: r,
3020
+ }), Eo = async ({ prompt: e }, r) => {
3021
+ const { knowledgeGraph: t } = await M(r);
3022
+ await S({ text: "Generating search query for the user inquiry" }, r);
3023
+ const a = await $o(e, t, r);
3024
+ await S({ text: "Executing graph search with generated search query" }, r);
3025
+ const o = await io({
3026
+ kg: t,
2948
3027
  searchQuery: a.query,
2949
3028
  typeCategoryFilter: a.typeCategoryFilter,
2950
3029
  namedTypesFilter: a.typeFilters,
2951
3030
  searchResultLimit: a.resultLimit,
2952
3031
  requestOptions: {
2953
- signal: Y(t),
2954
- timeout: t?.timeout
3032
+ signal: Y(r),
3033
+ timeout: r?.timeout
2955
3034
  }
2956
3035
  });
2957
3036
  if (o.type !== "success")
2958
3037
  return {
2959
- toolName: se,
3038
+ toolName: ie,
2960
3039
  status: "error",
2961
3040
  errorMessage: o.errorMessage,
2962
3041
  error: "error" in o ? o.error : null
2963
3042
  };
2964
- for (const s of o.results)
2965
- D(
2966
- s,
3043
+ for (const i of o.results)
3044
+ z(
3045
+ i,
2967
3046
  (c) => ke(c)
2968
3047
  );
2969
3048
  const n = 10, l = o.results.slice(0, n);
2970
3049
  return {
2971
- toolName: se,
3050
+ toolName: ie,
2972
3051
  status: "success",
2973
3052
  summary: `To answer the query, the following lucene query was generated and executed:
2974
3053
  Query: ${a.query}
@@ -2980,63 +3059,72 @@ const se = "searchGraphData", $o = i.object({
2980
3059
 
2981
3060
  ${o.results.length > n ? `Showing top ${n} results:
2982
3061
 
2983
- ` : ""}${l.map((s) => JSON.stringify(s)).join(`
3062
+ ` : ""}${l.map((i) => JSON.stringify(i)).join(`
2984
3063
  `)}`,
2985
3064
  details: {
2986
3065
  generatedSearchQuery: a,
2987
3066
  searchResults: o.results
2988
3067
  }
2989
3068
  };
2990
- }, si = f(Co, {
2991
- name: se,
2992
- description: "Allows users to search the knowledge graph for text matching their inquiry, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.",
2993
- schema: $o
3069
+ }, li = w(Eo, {
3070
+ name: ie,
3071
+ description: `
3072
+ Search the knowledge graph using one or more search texts, using lucene search syntax, against indexed string properties defined on their entities and relationships. Use this tool when the user asks a question about their knowledge graph data as a whole, that could be answered via lucene text search of properties stored on graph elements, e.g requiring fuzzy matching. Otherwise if the inquiry is looking for connected records (e.g. paths), data aggregations, etc explore the data via the queryGraphData tool.
3073
+ Example prompts:
3074
+ - "Find 'Bradley'"
3075
+ - "find the person john smith"
3076
+ - "find all people named smith"
3077
+ - "Find all references to 'delayed parts shipment'"
3078
+ - "Find all reports authored by someone with the title of 'Researcher'"
3079
+ - "Find the first 5 reports where summary mentions flood zoning near Sacramento, and the organization name is the City of Sacramento Utilities, and tags containing stormwater".
3080
+ - "Search for all john smiths and show their global ids`,
3081
+ schema: Co
2994
3082
  });
2995
3083
  export {
2996
- Pn as A,
3084
+ jn as A,
2997
3085
  Ln as B,
2998
- jn as C,
2999
- Gn as D,
3000
- On as E,
3001
- Mn as F,
3002
- de as G,
3003
- Zn as H,
3004
- Qn as I,
3005
- _n as J,
3006
- Wn as K,
3007
- Vn as L,
3008
- Un as M,
3009
- Rn as N,
3010
- Bn as O,
3011
- Hn as P,
3012
- Ma as Q,
3013
- k as R,
3086
+ Gn as C,
3087
+ On as D,
3088
+ Mn as E,
3089
+ Qn as F,
3090
+ ue as G,
3091
+ Yn as H,
3092
+ _n as I,
3093
+ Wn as J,
3094
+ Vn as K,
3095
+ Un as L,
3096
+ Bn as M,
3097
+ $n as N,
3098
+ Hn as O,
3099
+ Jn as P,
3100
+ Qa as Q,
3101
+ N as R,
3014
3102
  Kn as S,
3015
- Jn as T,
3016
- ri as a,
3017
- ii as b,
3018
- ai as c,
3019
- oi as d,
3020
- ti as e,
3021
- Re as f,
3022
- te as g,
3023
- ei as h,
3024
- O as i,
3025
- Xn as j,
3026
- $n as k,
3027
- Yn as l,
3028
- Cn as m,
3029
- En as n,
3030
- Nn as o,
3031
- In as p,
3032
- ni as q,
3033
- Dn as r,
3034
- si as s,
3035
- Vt as t,
3036
- kn as u,
3037
- Fn as v,
3103
+ Zn as T,
3104
+ ai as a,
3105
+ si as b,
3106
+ oi as c,
3107
+ ni as d,
3108
+ ri as e,
3109
+ xe as f,
3110
+ U as g,
3111
+ ti as h,
3112
+ M as i,
3113
+ ei as j,
3114
+ Cn as k,
3115
+ Xn as l,
3116
+ En as m,
3117
+ Fn as n,
3118
+ kn as o,
3119
+ Nn as p,
3120
+ ii as q,
3121
+ Pn as r,
3122
+ li as s,
3123
+ Ut as t,
3124
+ qn as u,
3125
+ In as v,
3038
3126
  zn as w,
3039
- qn as x,
3040
- $ as y,
3127
+ Dn as x,
3128
+ C as y,
3041
3129
  An as z
3042
3130
  };