@arcgis/ai-components 5.2.0-next.25 → 5.2.0-next.26

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.
@@ -3,56 +3,57 @@ import pe from "@arcgis/core/identity/IdentityManager.js";
3
3
  import k from "@arcgis/core/portal/Portal.js";
4
4
  import { Annotation as T, messagesStateReducer as be } from "@langchain/langgraph/web";
5
5
  import "@arcgis/toolkit/string";
6
- import { k as De, j as H, i as Pe } from "./generateLayerDescriptions.js";
6
+ import { k as Pe, j as H, i as Ae } 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
- import * as Ae from "@arcgis/core/core/reactiveUtils.js";
11
+ import * as Le from "@arcgis/core/core/reactiveUtils.js";
12
12
  import "@arcgis/core/layers/FeatureLayer.js";
13
13
  import me from "@arcgis/core/request.js";
14
14
  import "@langchain/core/prompts";
15
- import { tool as g } from "@langchain/core/tools";
16
- import Le from "@arcgis/core/Graphic.js";
17
- import { addressToLocations as je } from "@arcgis/core/rest/locator.js";
18
- import Ge from "@arcgis/core/symbols/PictureMarkerSymbol.js";
15
+ import { tool as f } from "@langchain/core/tools";
16
+ import je from "@arcgis/core/Graphic.js";
17
+ import { addressToLocations as Ge } from "@arcgis/core/rest/locator.js";
18
+ import Oe from "@arcgis/core/symbols/PictureMarkerSymbol.js";
19
19
  import s, { z as E } from "zod";
20
- import Oe from "@arcgis/core/geometry/Extent.js";
20
+ import Me from "@arcgis/core/geometry/Extent.js";
21
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";
22
+ import { createRenderer as Qe } from "@arcgis/core/smartMapping/renderers/pieChart.js";
23
+ import { getSchemesByTag as _e, getSchemes as We } from "@arcgis/core/smartMapping/symbology/pieChart.js";
24
24
  import { getBackgroundColorTheme as he } from "@arcgis/core/views/support/colorUtils.js";
25
25
  import { a as R, s as x } from "./index.js";
26
- import { createAgeRenderer as We, createContinuousRenderer as Ve } from "@arcgis/core/smartMapping/renderers/color.js";
26
+ import { createAgeRenderer as Ve, createContinuousRenderer as Be } from "@arcgis/core/smartMapping/renderers/color.js";
27
27
  import { getSchemesByTag as se } from "@arcgis/core/smartMapping/symbology/color.js";
28
- import { createContinuousRenderer as Be } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
29
- import { createRenderer as Ue } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
30
- import { getSchemesByTag as Ke } from "@arcgis/core/smartMapping/symbology/dotDensity.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";
28
+ import { createContinuousRenderer as Ue } from "@arcgis/core/smartMapping/renderers/univariateColorSize.js";
29
+ import { createRenderer as Ke } from "@arcgis/core/smartMapping/renderers/dotDensity.js";
30
+ import { getSchemesByTag as He } from "@arcgis/core/smartMapping/symbology/dotDensity.js";
31
+ import { createRenderer as Je } from "@arcgis/core/smartMapping/renderers/heatmap.js";
32
+ import { getSchemesByTag as Ze } from "@arcgis/core/smartMapping/symbology/heatmap.js";
33
+ import { createRenderer as Ye } from "@arcgis/core/smartMapping/renderers/predominance.js";
34
+ import { getSchemesByTag as Xe } from "@arcgis/core/smartMapping/symbology/predominance.js";
35
+ import { createRenderer as et } from "@arcgis/core/smartMapping/renderers/relationship.js";
36
+ import { getSchemesByTag as tt } from "@arcgis/core/smartMapping/symbology/relationship.js";
37
+ import { createAgeRenderer as rt, createContinuousRenderer as at } from "@arcgis/core/smartMapping/renderers/size.js";
38
+ import { createRenderer as ot } from "@arcgis/core/smartMapping/renderers/type.js";
39
+ import { getSchemesByTag as nt } from "@arcgis/core/smartMapping/symbology/type.js";
40
+ import { ToolNode as it } from "@langchain/langgraph/prebuilt";
41
+ import st from "@arcgis/core/layers/support/FeatureEffect.js";
42
42
  import Se 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 mt from "@arcgis/core/rest/support/TopFilter.js";
49
- import ht from "@arcgis/core/WebLinkChart.js";
43
+ import * as lt from "@arcgis/core/geometry/operators/unionOperator.js";
44
+ import { formatDateOnly as ct, convertDateFormatToIntlOptions as _, formatTimeOnly as ut, formatDate as ye } from "@arcgis/core/intl.js";
45
+ import dt from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
46
+ import pt from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
47
+ import mt from "@arcgis/core/rest/support/TopFeaturesQuery.js";
48
+ import ht from "@arcgis/core/rest/support/TopFilter.js";
49
+ import yt from "@arcgis/core/WebLinkChart.js";
50
50
  import ve from "@arcgis/core/rest/knowledgeGraph/GraphQueryStreaming.js";
51
51
  import "@arcgis/core/views/LinkChartView.js";
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 L = (e, t) => t ?? e, En = T.Root({
55
- ...De(),
52
+ import { fetchKnowledgeGraph as fe, executeQueryStreaming as ft, executeSearchStreaming as gt } from "@arcgis/core/rest/knowledgeGraphService.js";
53
+ import wt from "@arcgis/core/rest/knowledgeGraph/GraphSearchStreaming.js";
54
+ import { getBindParametersFromCypherQuery as bt } from "@arcgis/core/applications/KnowledgeStudio/generalSharedKgUtils.js";
55
+ const L = (e, t) => t ?? e, zn = T.Root({
56
+ ...Pe(),
56
57
  // internal to the navigation agent
57
58
  intent: T({
58
59
  reducer: L
@@ -71,21 +72,21 @@ const L = (e, t) => t ?? e, En = T.Root({
71
72
  })
72
73
  })
73
74
  });
74
- async function wt(e, t) {
75
+ async function Tt(e, t) {
75
76
  const a = k.getDefault().helperServices, o = a.geocode.find((m) => m.name === "ArcGIS World Geocoding Service") ?? a.geocode[0];
76
77
  if (!o)
77
78
  throw new Error("No geocoding service found in helperServices.");
78
- const n = o.url, l = `${X.assetsPath?.endsWith("/") ? X.assetsPath : `${X.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await je(n, {
79
+ const n = o.url, l = `${X.assetsPath?.endsWith("/") ? X.assetsPath : `${X.assetsPath}/`}esri/images/search/search-symbol-32.png`, c = (await Ge(n, {
79
80
  address: { SingleLine: e },
80
81
  outFields: ["Match_addr"]
81
82
  }))?.[0];
82
83
  if (!c?.extent || !c.location)
83
84
  throw new Error(`Could not find location for: ${e}`);
84
- const u = new Ge({
85
+ const u = new Oe({
85
86
  url: l,
86
87
  width: 24,
87
88
  height: 24
88
- }), d = new Le({
89
+ }), d = new je({
89
90
  geometry: c.location,
90
91
  symbol: u
91
92
  });
@@ -100,28 +101,28 @@ async function wt(e, t) {
100
101
  sharedStatePatch: { lastResolvedLocation: { value: p } }
101
102
  };
102
103
  }
103
- const bt = ["mapView"];
104
+ const St = ["mapView"];
104
105
  function C(e) {
105
106
  const r = e?.configurable?.context;
106
107
  if (!r || typeof r != "object")
107
108
  throw new Error("NavigationAgent context missing");
108
- const a = bt.filter((o) => !(o in r));
109
+ const a = St.filter((o) => !(o in r));
109
110
  if (a.length)
110
111
  throw new Error(`NavigationAgent context missing: ${a.join(", ")}`);
111
112
  return r;
112
113
  }
113
- async function Tt({ address: e }, t) {
114
+ async function vt({ address: e }, t) {
114
115
  const { mapView: r } = C(t);
115
- return await wt(e, r);
116
+ return await Tt(e, r);
116
117
  }
117
- const St = s.object({
118
+ const xt = s.object({
118
119
  address: s.string().describe("The full address or place name to locate.")
119
- }), Fn = g(Tt, {
120
+ }), In = f(vt, {
120
121
  name: "goToAddress",
121
122
  description: "Geocodes an address using Esri's World Geocoding Service and zooms the map to that location.",
122
- schema: St
123
+ schema: xt
123
124
  });
124
- async function vt(e, t) {
125
+ async function Rt(e, t) {
125
126
  const a = t.map.bookmarks;
126
127
  if (!a || a.length === 0)
127
128
  throw new Error("No bookmarks found in the map.");
@@ -133,18 +134,18 @@ async function vt(e, t) {
133
134
  throw new Error(`Bookmark with name "${e}" does not have a valid viewpoint.`);
134
135
  return await t.goTo(n), { text: `Navigated to bookmark: ${e}` };
135
136
  }
136
- async function xt({ bookmarkName: e }, t) {
137
+ async function $t({ bookmarkName: e }, t) {
137
138
  const { mapView: r } = C(t);
138
- return await Promise.resolve(vt(e, r));
139
+ return await Promise.resolve(Rt(e, r));
139
140
  }
140
- const Rt = E.object({
141
+ const Ct = E.object({
141
142
  bookmarkName: E.string().describe("The name of the bookmark to navigate to.")
142
- }), kn = g(xt, {
143
+ }), Dn = f($t, {
143
144
  name: "goToBookmark",
144
145
  description: "Go to the extent of the bookmark with the given name.",
145
- schema: Rt
146
+ schema: Ct
146
147
  });
147
- async function $t(e, t, r) {
148
+ async function Et(e, t, r) {
148
149
  const a = r.map?.allLayers.find((l) => l.id === e);
149
150
  if (!a)
150
151
  return { text: `Error: Layer with id ${e} not found` };
@@ -173,20 +174,20 @@ async function $t(e, t, r) {
173
174
  return console.error("Error in goToFeatures:", l), { text: `Error: ${l instanceof Error ? l.message : "Unknown error"}`, where: o };
174
175
  }
175
176
  }
176
- async function Ct({ layerId: e, where: t }, r) {
177
+ async function Ft({ layerId: e, where: t }, r) {
177
178
  const { mapView: a } = C(r);
178
- return await $t(e, t, a);
179
+ return await Et(e, t, a);
179
180
  }
180
- const Et = E.object({
181
+ const kt = E.object({
181
182
  layerId: E.string().describe("The layerId of the layer to zoom to."),
182
183
  where: E.string().describe("The sql-92 where clause used to query features to zoom to")
183
- }), Nn = g(Ct, {
184
+ }), Pn = f(Ft, {
184
185
  name: "goToFeatures",
185
186
  description: "Go to the features that match the given filter related to the given layerId.",
186
- schema: Et
187
+ schema: kt
187
188
  });
188
- async function Ft(e) {
189
- const r = new Oe({
189
+ async function Nt(e) {
190
+ const r = new Me({
190
191
  xmin: -180,
191
192
  ymin: -90,
192
193
  xmax: 180,
@@ -195,16 +196,16 @@ async function Ft(e) {
195
196
  }).expand(0.7);
196
197
  return await e.goTo(r), { text: "Successfully zoomed to world extent" };
197
198
  }
198
- async function kt(e, t) {
199
+ async function qt(e, t) {
199
200
  const { mapView: r } = C(t);
200
- return await Ft(r);
201
+ return await Nt(r);
201
202
  }
202
- const Nt = E.object({}), qn = g(kt, {
203
+ const zt = E.object({}), An = f(qt, {
203
204
  name: "goToFullExtent",
204
205
  description: "Zooms the map to the full world extent using Esri's Geocoding Service.",
205
- schema: Nt
206
+ schema: zt
206
207
  });
207
- async function qt(e) {
208
+ async function It(e) {
208
209
  const r = e.map.initialViewProperties?.viewpoint?.targetGeometry;
209
210
  if (r)
210
211
  await e.goTo(r);
@@ -212,16 +213,16 @@ async function qt(e) {
212
213
  throw new Error("Initial extent is undefined");
213
214
  return { text: "Successfully zoomed to home extent" };
214
215
  }
215
- async function It(e, t) {
216
+ async function Dt(e, t) {
216
217
  const { mapView: r } = C(t);
217
- return await qt(r);
218
+ return await It(r);
218
219
  }
219
- const zt = s.object({}), In = g(It, {
220
+ const Pt = s.object({}), Ln = f(Dt, {
220
221
  name: "goToHomeExtent",
221
222
  description: "Go to the initial web map view extent",
222
- schema: zt
223
+ schema: Pt
223
224
  });
224
- async function Dt(e, t) {
225
+ async function At(e, t) {
225
226
  await t.when();
226
227
  const r = t.map?.allLayers.find((o) => o.id === e);
227
228
  if (!r)
@@ -229,32 +230,32 @@ async function Dt(e, t) {
229
230
  let a;
230
231
  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." };
231
232
  }
232
- async function Pt({ layerId: e }, t) {
233
+ async function Lt({ layerId: e }, t) {
233
234
  const { mapView: r } = C(t);
234
- return await Dt(e, r);
235
+ return await At(e, r);
235
236
  }
236
- const At = E.object({
237
+ const jt = E.object({
237
238
  layerId: E.string().describe("The id of the layer to navigate to")
238
- }), zn = g(Pt, {
239
+ }), jn = f(Lt, {
239
240
  name: "goToLayer",
240
241
  description: "Zooms the map view to the full extent of the top matching layer.",
241
- schema: At
242
+ schema: jt
242
243
  });
243
- async function Lt(e, t) {
244
+ async function Gt(e, t) {
244
245
  return await t.goTo({ scale: e }), { text: `Successfully zoomed to: ${e}` };
245
246
  }
246
- async function jt({ scale: e }, t) {
247
+ async function Ot({ scale: e }, t) {
247
248
  const { mapView: r } = C(t);
248
- return await Lt(e, r);
249
+ return await Gt(e, r);
249
250
  }
250
- const Gt = s.object({
251
+ const Mt = s.object({
251
252
  scale: s.number().describe("The map scale of the view to go to.")
252
- }), Dn = g(jt, {
253
+ }), Gn = f(Ot, {
253
254
  name: "goToScale",
254
255
  description: "Go to the specified view scale.",
255
- schema: Gt
256
+ schema: Mt
256
257
  });
257
- async function Ot(e, t, r) {
258
+ async function Qt(e, t, r) {
258
259
  const o = {
259
260
  target: new Te({
260
261
  longitude: e.longitude,
@@ -268,39 +269,39 @@ async function Ot(e, t, r) {
268
269
  r?.scale !== void 0 ? `scale 1:${r.scale}` : ""
269
270
  ].filter(Boolean).join(", ")}` };
270
271
  }
271
- async function Mt({
272
+ async function _t({
272
273
  center: e,
273
274
  zoom: t,
274
275
  scale: r
275
276
  }, a) {
276
277
  const { mapView: o } = C(a);
277
- return await Ot(e, o, { zoom: t, scale: r });
278
+ return await Qt(e, o, { zoom: t, scale: r });
278
279
  }
279
- const Qt = s.object({
280
+ const Wt = s.object({
280
281
  center: s.object({
281
282
  longitude: s.number().describe("The longitude (x-coordinate) of the point to navigate to."),
282
283
  latitude: s.number().describe("The latitude (y-coordinate) of the point to navigate to.")
283
284
  }),
284
285
  zoom: s.number().optional().describe("The zoom level. Higher values = more zoomed in."),
285
286
  scale: s.number().optional().describe("The map scale. Alternative to zoom. Smaller numbers = more zoomed in.")
286
- }), Pn = g(Mt, {
287
+ }), On = f(_t, {
287
288
  name: "goToViewpoint",
288
289
  description: "Go to the specified viewpoint. This can contain a combination of scale, center, zoom, etc.",
289
- schema: Qt
290
+ schema: Wt
290
291
  });
291
- async function _t(e, t) {
292
+ async function Vt(e, t) {
292
293
  return await t.goTo({ zoom: e }), { text: `Successfully zoomed to: ${e}` };
293
294
  }
294
- async function Wt({ zoom: e }, t) {
295
+ async function Bt({ zoom: e }, t) {
295
296
  const { mapView: r } = C(t);
296
- return await _t(e, r);
297
+ return await Vt(e, r);
297
298
  }
298
- const Vt = s.object({
299
+ const Ut = s.object({
299
300
  zoom: s.number().min(1).max(20).describe("The zoom level of the view to go to.")
300
- }), An = g(Wt, {
301
+ }), Mn = f(Bt, {
301
302
  name: "goToZoom",
302
303
  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: Vt
304
+ schema: Ut
304
305
  }), ge = /* @__PURE__ */ Object.assign({
305
306
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_lc_context.md": () => import("./arcgis_knowledge_current_lc_context.js").then((e) => e.default),
306
307
  "../agents/arcgisKnowledge/prompts/arcgis_knowledge_current_map_context.md": () => import("./arcgis_knowledge_current_map_context.js").then((e) => e.default),
@@ -325,7 +326,7 @@ ${Object.keys(ge).join(`
325
326
  `)}`);
326
327
  return await t[1]();
327
328
  }
328
- const Bt = (e, t = 300) => {
329
+ const Kt = (e, t = 300) => {
329
330
  const r = e.replace(/\s+/gu, " ").replace(/[*_`#>\-]/gu, "").trim();
330
331
  return r.length > t ? `${r.slice(0, t)}...` : r;
331
332
  }, xe = (e, t) => {
@@ -333,22 +334,22 @@ const Bt = (e, t = 300) => {
333
334
  if (a == null)
334
335
  throw new Error(`${t} missing in config.configurable.services`);
335
336
  return a;
336
- }, Ln = (e, t) => (r, a) => {
337
+ }, Qn = (e, t) => (r, a) => {
337
338
  const o = a?.configurable?.services;
338
339
  for (const n of e)
339
340
  if (!o?.[n])
340
341
  throw new Error(`${t} requires services.${n} to be available.`);
341
342
  return r;
342
343
  };
343
- async function Ut(e) {
344
+ async function Ht(e) {
344
345
  const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
345
346
  let l;
346
- return n ? l = Qe({
347
+ return n ? l = _e({
347
348
  basemapTheme: await he(a),
348
349
  geometryType: r.geometryType,
349
350
  includedTags: n,
350
351
  numColors: Math.min(t.length, 8)
351
- })[0] : l = _e({
352
+ })[0] : l = We({
352
353
  basemapTheme: await he(a),
353
354
  geometryType: r.geometryType,
354
355
  numColors: Math.min(t.length, 8)
@@ -365,10 +366,10 @@ async function Ut(e) {
365
366
  pieChartScheme: l
366
367
  };
367
368
  }
368
- async function Kt(e) {
369
- return await Me(e);
369
+ async function Jt(e) {
370
+ return await Qe(e);
370
371
  }
371
- async function Ht({
372
+ async function Zt({
372
373
  arcgisMap: e,
373
374
  arcgisMapView: t,
374
375
  layerId: r,
@@ -387,30 +388,30 @@ async function Ht({
387
388
  colorSchemeTags: o
388
389
  };
389
390
  try {
390
- const d = await Ut(u), p = await Kt(d);
391
+ const d = await Ht(u), p = await Jt(d);
391
392
  return i.renderer = p.renderer, i.visible = !0, `Chart renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
392
393
  } catch (d) {
393
394
  return `Error applying chart renderer: ${d instanceof Error ? d.message : String(d)}`;
394
395
  }
395
396
  }
396
- const Jt = ["mapView"];
397
+ const Yt = ["mapView"];
397
398
  function $(e) {
398
399
  const r = e?.configurable?.context;
399
400
  if (!r || typeof r != "object")
400
401
  throw new Error("LayerStylingAgent context missing");
401
- const a = Jt.filter((o) => !(o in r));
402
+ const a = Yt.filter((o) => !(o in r));
402
403
  if (a.length)
403
404
  throw new Error(`LayerStylingAgent context missing: ${a.join(", ")}`);
404
405
  return r;
405
406
  }
406
- async function Zt({
407
+ async function Xt({
407
408
  layerId: e,
408
409
  fields: t,
409
410
  colorSchemes: r,
410
411
  includeSize: a
411
412
  }, o) {
412
413
  const { mapView: n } = $(o);
413
- return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Ht({
414
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Zt({
414
415
  arcgisMap: n.map,
415
416
  arcgisMapView: n,
416
417
  layerId: e,
@@ -419,12 +420,12 @@ async function Zt({
419
420
  includeSize: a
420
421
  });
421
422
  }
422
- const Yt = s.object({
423
+ const er = s.object({
423
424
  layerId: s.string().describe("The id of the layer to apply the chart renderer to"),
424
425
  fields: s.array(s.string()).describe("The fields to use for the chart renderer (multiple numeric fields)"),
425
426
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
426
427
  includeSize: s.boolean().optional().describe("Whether to vary the chart size (chart-size)")
427
- }), jn = g(Zt, {
428
+ }), _n = f(Xt, {
428
429
  name: "chart",
429
430
  description: `Label: Charts
430
431
  Description: Show the values of two or more categories as a proportion of the total using a pie chart.
@@ -437,9 +438,9 @@ const Yt = s.object({
437
438
  Keywords: pie, chart, all categories, breakdown, proportion, total, amount, how much, sum, graduated size, proportional size
438
439
  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.
439
440
  Fields: This style requires 2-8 number fields.`,
440
- schema: Yt
441
+ schema: er
441
442
  });
442
- function Xt(e) {
443
+ function tr(e) {
443
444
  const { fields: t, layer: r, view: a, theme: o, colorSchemeTags: n } = e, l = t[0];
444
445
  let i;
445
446
  return n && (i = se({
@@ -457,10 +458,10 @@ function Xt(e) {
457
458
  colorScheme: i
458
459
  };
459
460
  }
460
- async function er(e) {
461
- return await We(e);
461
+ async function rr(e) {
462
+ return await Ve(e);
462
463
  }
463
- async function tr({
464
+ async function ar({
464
465
  arcgisMap: e,
465
466
  arcgisMapView: t,
466
467
  layerId: r,
@@ -480,20 +481,20 @@ async function tr({
480
481
  theme: n
481
482
  };
482
483
  try {
483
- const u = Xt(c), d = await er(u);
484
+ const u = tr(c), d = await rr(u);
484
485
  return i.renderer = d.renderer, i.visible = !0, `Color-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
485
486
  } catch (u) {
486
487
  return `Error applying color-age renderer: ${u instanceof Error ? u.message : String(u)}`;
487
488
  }
488
489
  }
489
- async function rr({
490
+ async function or({
490
491
  layerId: e,
491
492
  fields: t,
492
493
  colorSchemes: r,
493
494
  theme: a
494
495
  }, o) {
495
496
  const { mapView: n } = $(o);
496
- return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await tr({
497
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await ar({
497
498
  arcgisMap: n.map,
498
499
  arcgisMapView: n,
499
500
  layerId: e,
@@ -502,21 +503,21 @@ async function rr({
502
503
  theme: a
503
504
  });
504
505
  }
505
- const ar = s.object({
506
+ const nr = s.object({
506
507
  layerId: s.string().describe("The id of the layer to apply the color-age renderer to"),
507
508
  fields: s.array(s.string()).describe("The field(s) to use for the color-age renderer (temporal/date data)"),
508
509
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
509
510
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
510
- }), Gn = g(rr, {
511
+ }), Wn = f(or, {
511
512
  name: "color-age",
512
513
  description: `Label: Age (color)
513
514
  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.
514
515
  Keywords: since, age, how old, how long
515
516
  Example: Show the age of each feature based on its reported date.
516
517
  Fields: This style requires at least one field with a date type.`,
517
- schema: ar
518
+ schema: nr
518
519
  });
519
- function or(e) {
520
+ function ir(e) {
520
521
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
521
522
  let { theme: n } = e, l = t[1];
522
523
  const i = t[0];
@@ -536,10 +537,10 @@ function or(e) {
536
537
  colorScheme: c
537
538
  };
538
539
  }
539
- async function nr(e) {
540
- return await Ve(e);
540
+ async function sr(e) {
541
+ return await Be(e);
541
542
  }
542
- async function ir({
543
+ async function lr({
543
544
  arcgisMap: e,
544
545
  arcgisMapView: t,
545
546
  layerId: r,
@@ -559,20 +560,20 @@ async function ir({
559
560
  theme: n
560
561
  };
561
562
  try {
562
- const u = or(c), d = await nr(u);
563
+ const u = ir(c), d = await sr(u);
563
564
  return i.renderer = d.renderer, i.visible = !0, `Color renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
564
565
  } catch (u) {
565
566
  return `Error applying color renderer: ${u instanceof Error ? u.message : String(u)}`;
566
567
  }
567
568
  }
568
- async function sr({
569
+ async function cr({
569
570
  layerId: e,
570
571
  fields: t,
571
572
  colorSchemes: r,
572
573
  theme: a
573
574
  }, o) {
574
575
  const { mapView: n } = $(o);
575
- return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await ir({
576
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await lr({
576
577
  arcgisMap: n.map,
577
578
  arcgisMapView: n,
578
579
  layerId: e,
@@ -581,21 +582,21 @@ async function sr({
581
582
  theme: a
582
583
  });
583
584
  }
584
- const lr = s.object({
585
+ const ur = s.object({
585
586
  layerId: s.string().describe("The id of the layer to apply the color renderer to"),
586
587
  fields: s.array(s.string()).describe("The field(s) to use for the color renderer"),
587
588
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
588
589
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color ramp")
589
- }), On = g(sr, {
590
+ }), Vn = f(cr, {
590
591
  name: "color",
591
592
  description: `Label: Counts and Amounts (color)
592
593
  Description: Vary color along a continuous color ramp to represent numeric or ranked data.
593
594
  Keywords: graduated color, choropleth, continuous color, hue, color, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease
594
595
  Example: Color each feature based on the population density.
595
596
  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.`,
596
- schema: lr
597
+ schema: ur
597
598
  });
598
- function cr(e) {
599
+ function dr(e) {
599
600
  const { fields: t, layer: r, view: a, colorSchemeTags: o, theme: n } = e;
600
601
  let l, i;
601
602
  const c = t[0];
@@ -614,10 +615,10 @@ function cr(e) {
614
615
  }
615
616
  };
616
617
  }
617
- async function ur(e) {
618
- return await Be(e);
618
+ async function pr(e) {
619
+ return await Ue(e);
619
620
  }
620
- async function dr({
621
+ async function mr({
621
622
  arcgisMap: e,
622
623
  arcgisMapView: t,
623
624
  layerId: r,
@@ -637,20 +638,20 @@ async function dr({
637
638
  theme: n
638
639
  };
639
640
  try {
640
- const u = cr(c), d = await ur(u);
641
+ const u = dr(c), d = await pr(u);
641
642
  return i.renderer = d.renderer, i.visible = !0, `Color-size-univariate renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
642
643
  } catch (u) {
643
644
  return `Error applying color-size-univariate renderer: ${u instanceof Error ? u.message : String(u)}`;
644
645
  }
645
646
  }
646
- async function pr({
647
+ async function hr({
647
648
  layerId: e,
648
649
  fields: t,
649
650
  colorSchemes: r,
650
651
  theme: a
651
652
  }, o) {
652
653
  const { mapView: n } = $(o);
653
- return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await dr({
654
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await mr({
654
655
  arcgisMap: n.map,
655
656
  arcgisMapView: n,
656
657
  layerId: e,
@@ -659,24 +660,24 @@ async function pr({
659
660
  theme: a
660
661
  });
661
662
  }
662
- const mr = s.object({
663
+ const yr = s.object({
663
664
  layerId: s.string().describe("The id of the layer to apply the color-size univariate renderer to"),
664
665
  fields: s.array(s.string()).describe("The fields to use for the color-size univariate renderer"),
665
666
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
666
667
  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
- }), Mn = g(pr, {
668
+ }), Bn = f(hr, {
668
669
  name: "color-size-univariate",
669
670
  description: `Label: Color and Size (univariate)
670
671
  Description: Vary symbol size and color based on the values of two numeric attributes.
671
672
  Keywords: continuous color, hue, color, size, gradation, saturation, lightness, percent, rate, ratio, index, how much, increase, decrease, amount
672
673
  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.
673
674
  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.`,
674
- schema: mr
675
+ schema: yr
675
676
  });
676
- function hr(e) {
677
+ function fr(e) {
677
678
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
678
679
  let n;
679
- return o && (n = Ke({
680
+ return o && (n = He({
680
681
  includedTags: o,
681
682
  numColors: Math.min(t.length, 8)
682
683
  })[0]), {
@@ -693,10 +694,10 @@ function hr(e) {
693
694
  dotDensityScheme: n
694
695
  };
695
696
  }
696
- async function yr(e) {
697
- return await Ue(e);
697
+ async function gr(e) {
698
+ return await Ke(e);
698
699
  }
699
- async function fr({
700
+ async function wr({
700
701
  arcgisMap: e,
701
702
  arcgisMapView: t,
702
703
  layerId: r,
@@ -714,19 +715,19 @@ async function fr({
714
715
  colorSchemeTags: o
715
716
  };
716
717
  try {
717
- const c = hr(i), u = await yr(c);
718
+ const c = fr(i), u = await gr(c);
718
719
  return l.renderer = u.renderer, l.visible = !0, `Dot Density renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
719
720
  } catch (c) {
720
721
  return `Error applying dot density renderer: ${c instanceof Error ? c.message : String(c)}`;
721
722
  }
722
723
  }
723
- async function gr({
724
+ async function br({
724
725
  layerId: e,
725
726
  fields: t,
726
727
  colorSchemes: r
727
728
  }, a) {
728
729
  const { mapView: o } = $(a);
729
- return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await fr({
730
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await wr({
730
731
  arcgisMap: o.map,
731
732
  arcgisMapView: o,
732
733
  layerId: e,
@@ -734,11 +735,11 @@ async function gr({
734
735
  colorSchemes: r
735
736
  });
736
737
  }
737
- const wr = s.object({
738
+ const Tr = s.object({
738
739
  layerId: s.string().describe("The id of the layer to apply the dot density renderer to"),
739
740
  fields: s.array(s.string()).describe("The field(s) to use for the dot density renderer (population or count data)"),
740
741
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
741
- }), Qn = g(gr, {
742
+ }), Un = f(br, {
742
743
  name: "dot-density",
743
744
  description: `Dot Density
744
745
  Use dot density to visualize the distribution of one attribute or compare the density of multiple attributes. This is only valid for polygon layers.
@@ -752,13 +753,13 @@ const wr = s.object({
752
753
  - Display demographic patterns within census tracts
753
754
  **Fields:** Requires 2-8 number fields.
754
755
  **Keywords:** density, how much, how many, total, number, amount`,
755
- schema: wr
756
+ schema: Tr
756
757
  });
757
- function br(e) {
758
+ function Sr(e) {
758
759
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
759
760
  let n;
760
761
  const l = t[0];
761
- return o && (n = Je({
762
+ return o && (n = Ze({
762
763
  includedTags: o,
763
764
  basemap: a.map?.basemap || "topo"
764
765
  })[0]), {
@@ -768,10 +769,10 @@ function br(e) {
768
769
  heatmapScheme: n
769
770
  };
770
771
  }
771
- async function Tr(e) {
772
- return await He(e);
772
+ async function vr(e) {
773
+ return await Je(e);
773
774
  }
774
- async function Sr({
775
+ async function xr({
775
776
  arcgisMap: e,
776
777
  arcgisMapView: t,
777
778
  layerId: r,
@@ -789,19 +790,19 @@ async function Sr({
789
790
  colorSchemeTags: o
790
791
  };
791
792
  try {
792
- const c = br(i), u = await Tr(c);
793
+ const c = Sr(i), u = await vr(c);
793
794
  return l.renderer = u.renderer, l.visible = !0, `Heatmap renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
794
795
  } catch (c) {
795
796
  return `Error applying heatmap renderer: ${c instanceof Error ? c.message : String(c)}`;
796
797
  }
797
798
  }
798
- async function vr({
799
+ async function Rr({
799
800
  layerId: e,
800
801
  fields: t,
801
802
  colorSchemes: r
802
803
  }, a) {
803
804
  const { mapView: o } = $(a);
804
- return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await Sr({
805
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await xr({
805
806
  arcgisMap: o.map,
806
807
  arcgisMapView: o,
807
808
  layerId: e,
@@ -809,23 +810,23 @@ async function vr({
809
810
  colorSchemes: r
810
811
  });
811
812
  }
812
- const xr = s.object({
813
+ const $r = s.object({
813
814
  layerId: s.string().describe("The id of the layer to apply the heatmap renderer to"),
814
815
  fields: s.array(s.string()).describe("The field(s) to use for the heatmap renderer (typically point density)"),
815
816
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
816
- }), _n = g(vr, {
817
+ }), Kn = f(Rr, {
817
818
  name: "heatmap",
818
819
  description: `Label: Heat Map
819
820
  Description: Show areas of high density with colors that appear to glow hotter. This is only valid for point layers.
820
821
  Keywords: density, heatmap, hot spots, pattern, cluster
821
822
  Example: Create a heatmap
822
823
  Fields: This typically requires zero or one field of type number.`,
823
- schema: xr
824
+ schema: $r
824
825
  });
825
- function Rr(e) {
826
+ function Cr(e) {
826
827
  const { fields: t, layer: r, view: a, styleName: o, colorSchemeTags: n } = e;
827
828
  let l;
828
- return n && (l = Ye({
829
+ return n && (l = Xe({
829
830
  geometryType: r.geometryType,
830
831
  includedTags: n,
831
832
  numColors: Math.min(t.length, 10)
@@ -839,10 +840,10 @@ function Rr(e) {
839
840
  predominanceScheme: l
840
841
  };
841
842
  }
842
- async function $r(e) {
843
- return await Ze(e);
843
+ async function Er(e) {
844
+ return await Ye(e);
844
845
  }
845
- async function Cr({
846
+ async function Fr({
846
847
  arcgisMap: e,
847
848
  arcgisMapView: t,
848
849
  layerId: r,
@@ -861,20 +862,20 @@ async function Cr({
861
862
  colorSchemeTags: o
862
863
  };
863
864
  try {
864
- const d = Rr(u), p = await $r(d);
865
+ const d = Cr(u), p = await Er(d);
865
866
  return i.renderer = p.renderer, i.visible = !0, `Predominance renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
866
867
  } catch (d) {
867
868
  return `Error applying predominance renderer: ${d instanceof Error ? d.message : String(d)}`;
868
869
  }
869
870
  }
870
- async function Er({
871
+ async function kr({
871
872
  layerId: e,
872
873
  fields: t,
873
874
  colorSchemes: r,
874
875
  includeSize: a
875
876
  }, o) {
876
877
  const { mapView: n } = $(o);
877
- return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Cr({
878
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Fr({
878
879
  arcgisMap: n.map,
879
880
  arcgisMapView: n,
880
881
  layerId: e,
@@ -883,12 +884,12 @@ async function Er({
883
884
  includeSize: a
884
885
  });
885
886
  }
886
- const Fr = s.object({
887
+ const Nr = s.object({
887
888
  layerId: s.string().describe("The id of the layer to apply the predominance renderer to"),
888
889
  fields: s.array(s.string()).describe("The fields to use for the predominance renderer (competing categories)"),
889
890
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
890
891
  includeSize: s.boolean().optional().describe("Whether to include size visualization (predominance-size)")
891
- }), Wn = g(Er, {
892
+ }), Hn = f(kr, {
892
893
  name: "predominance",
893
894
  description: `Label: Predominant category
894
895
  Description: Compare attributes that share a common subject and unit of measurement to see which has the highest value.
@@ -901,9 +902,9 @@ const Fr = s.object({
901
902
  Keywords: predominant, winner, won, competing, most, most common, most frequent, dominant, prevalent, top, amount, total, how much, proportional size, graduated size, sum
902
903
  Example: Show the predominant crop in each area and vary the size of each symbol based on the total of all categories.
903
904
  Fields: This style relies on 2-10 number fields.`,
904
- schema: Fr
905
+ schema: Nr
905
906
  });
906
- function kr(e) {
907
+ function qr(e) {
907
908
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e;
908
909
  let n;
909
910
  const l = {
@@ -911,7 +912,7 @@ function kr(e) {
911
912
  }, i = {
912
913
  field: t[1]
913
914
  };
914
- return o && (n = et({
915
+ return o && (n = tt({
915
916
  geometryType: r.geometryType,
916
917
  includedTags: o
917
918
  })[0]), {
@@ -924,10 +925,10 @@ function kr(e) {
924
925
  relationshipScheme: n
925
926
  };
926
927
  }
927
- async function Nr(e) {
928
- return await Xe(e);
928
+ async function zr(e) {
929
+ return await et(e);
929
930
  }
930
- async function qr({
931
+ async function Ir({
931
932
  arcgisMap: e,
932
933
  arcgisMapView: t,
933
934
  layerId: r,
@@ -945,19 +946,19 @@ async function qr({
945
946
  colorSchemeTags: o
946
947
  };
947
948
  try {
948
- const c = kr(i), u = await Nr(c);
949
+ const c = qr(i), u = await zr(c);
949
950
  return l.renderer = u.renderer, l.visible = !0, `Relationship renderer applied to layer: ${l.title ?? l.id} using fields ${a.join(", ")}`;
950
951
  } catch (c) {
951
952
  return `Error applying relationship renderer: ${c instanceof Error ? c.message : String(c)}`;
952
953
  }
953
954
  }
954
- async function Ir({
955
+ async function Dr({
955
956
  layerId: e,
956
957
  fields: t,
957
958
  colorSchemes: r
958
959
  }, a) {
959
960
  const { mapView: o } = $(a);
960
- return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await qr({
961
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, a), await Ir({
961
962
  arcgisMap: o.map,
962
963
  arcgisMapView: o,
963
964
  layerId: e,
@@ -965,20 +966,20 @@ async function Ir({
965
966
  colorSchemes: r
966
967
  });
967
968
  }
968
- const zr = s.object({
969
+ const Pr = s.object({
969
970
  layerId: s.string().describe("The id of the layer to apply the relationship renderer to"),
970
971
  fields: s.array(s.string()).describe("The two fields to use for the relationship renderer (bivariate visualization)"),
971
972
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use")
972
- }), Vn = g(Ir, {
973
+ }), Jn = f(Dr, {
973
974
  name: "relationship",
974
975
  description: `Label: Relationship
975
976
  Description: Overlays two color ramps to represent the relationship between two numeric attributes.
976
977
  Keywords: relationship, correlation, compare, related, bivariate choropleth, bivariate color
977
978
  Example: Show the relationship between tree height and carbon storage
978
979
  Fields: This style requires two number fields.`,
979
- schema: zr
980
+ schema: Pr
980
981
  });
981
- function Dr(e) {
982
+ function Ar(e) {
982
983
  const { fields: t, layer: r, view: a, theme: o } = e, n = t[0];
983
984
  return {
984
985
  layer: r,
@@ -990,10 +991,10 @@ function Dr(e) {
990
991
  outlineOptimizationEnabled: !0
991
992
  };
992
993
  }
993
- async function Pr(e) {
994
- return await tt(e);
994
+ async function Lr(e) {
995
+ return await rt(e);
995
996
  }
996
- async function Ar({
997
+ async function jr({
997
998
  arcgisMap: e,
998
999
  arcgisMapView: t,
999
1000
  layerId: r,
@@ -1013,20 +1014,20 @@ async function Ar({
1013
1014
  theme: n
1014
1015
  };
1015
1016
  try {
1016
- const u = Dr(c), d = await Pr(u);
1017
+ const u = Ar(c), d = await Lr(u);
1017
1018
  return i.renderer = d.renderer, i.visible = !0, `Size-age renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1018
1019
  } catch (u) {
1019
1020
  return `Error applying size-age renderer: ${u instanceof Error ? u.message : String(u)}`;
1020
1021
  }
1021
1022
  }
1022
- async function Lr({
1023
+ async function Gr({
1023
1024
  layerId: e,
1024
1025
  fields: t,
1025
1026
  colorSchemes: r,
1026
1027
  theme: a
1027
1028
  }, o) {
1028
1029
  const { mapView: n } = $(o);
1029
- return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Ar({
1030
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await jr({
1030
1031
  arcgisMap: n.map,
1031
1032
  arcgisMapView: n,
1032
1033
  layerId: e,
@@ -1035,21 +1036,21 @@ async function Lr({
1035
1036
  theme: a
1036
1037
  });
1037
1038
  }
1038
- const jr = s.object({
1039
+ const Or = s.object({
1039
1040
  layerId: s.string().describe("The id of the layer to apply the size-age renderer to"),
1040
1041
  fields: s.array(s.string()).describe("The field(s) to use for the size-age renderer (temporal data with size)"),
1041
1042
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1042
1043
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1043
- }), Bn = g(Lr, {
1044
+ }), Zn = f(Gr, {
1044
1045
  name: "size-age",
1045
1046
  description: `Label: Age (size)
1046
1047
  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.
1047
1048
  Keywords: since, age, how old, how long
1048
1049
  Example: Change the size of features so older features are larger than new features.
1049
1050
  Fields: This style requires at least one field with a date type.`,
1050
- schema: jr
1051
+ schema: Or
1051
1052
  });
1052
- function Gr(e) {
1053
+ function Mr(e) {
1053
1054
  const { fields: t, layer: r, view: a } = e;
1054
1055
  let { theme: o } = e, n = t[1];
1055
1056
  const l = t[0];
@@ -1063,10 +1064,10 @@ function Gr(e) {
1063
1064
  outlineOptimizationEnabled: !0
1064
1065
  };
1065
1066
  }
1066
- async function Or(e) {
1067
- return await rt(e);
1067
+ async function Qr(e) {
1068
+ return await at(e);
1068
1069
  }
1069
- async function Mr({
1070
+ async function _r({
1070
1071
  arcgisMap: e,
1071
1072
  arcgisMapView: t,
1072
1073
  layerId: r,
@@ -1086,20 +1087,20 @@ async function Mr({
1086
1087
  theme: n
1087
1088
  };
1088
1089
  try {
1089
- const u = Gr(c), d = await Or(u);
1090
+ const u = Mr(c), d = await Qr(u);
1090
1091
  return i.renderer = d.renderer, i.visible = !0, `Size renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1091
1092
  } catch (u) {
1092
1093
  return `Error applying size renderer: ${u instanceof Error ? u.message : String(u)}`;
1093
1094
  }
1094
1095
  }
1095
- async function Qr({
1096
+ async function Wr({
1096
1097
  layerId: e,
1097
1098
  fields: t,
1098
1099
  colorSchemes: r,
1099
1100
  theme: a
1100
1101
  }, o) {
1101
1102
  const { mapView: n } = $(o);
1102
- return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Mr({
1103
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await _r({
1103
1104
  arcgisMap: n.map,
1104
1105
  arcgisMapView: n,
1105
1106
  layerId: e,
@@ -1108,12 +1109,12 @@ async function Qr({
1108
1109
  theme: a
1109
1110
  });
1110
1111
  }
1111
- const _r = s.object({
1112
+ const Vr = s.object({
1112
1113
  layerId: s.string().describe("The id of the layer to apply the size renderer to"),
1113
1114
  fields: s.array(s.string()).describe("The field(s) to use for the size renderer (numeric data)"),
1114
1115
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1115
1116
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the size ramp")
1116
- }), Un = g(Qr, {
1117
+ }), Yn = f(Wr, {
1117
1118
  name: "size",
1118
1119
  description: `Label: Counts and Amounts (size)
1119
1120
  Description: Vary symbol sizes along a continuous ramp to represent numeric or ranked data.
@@ -1126,12 +1127,12 @@ const _r = s.object({
1126
1127
  Keywords: graduated size, proportional size, classed size, how much, total, number, when
1127
1128
  Example: Vary the size of each feature based on the date a ticket was completed.
1128
1129
  Fields: This style requires a single field with a date type.`,
1129
- schema: _r
1130
+ schema: Vr
1130
1131
  });
1131
- function Wr(e) {
1132
+ function Br(e) {
1132
1133
  const { fields: t, layer: r, view: a, colorSchemeTags: o } = e, n = t[0], l = t[1], i = t[2];
1133
1134
  let c;
1134
- return o && (c = ot({
1135
+ return o && (c = nt({
1135
1136
  geometryType: r.geometryType,
1136
1137
  includedTags: o
1137
1138
  })[0]), {
@@ -1145,10 +1146,10 @@ function Wr(e) {
1145
1146
  typeScheme: c
1146
1147
  };
1147
1148
  }
1148
- async function Vr(e) {
1149
- return await at(e);
1149
+ async function Ur(e) {
1150
+ return await ot(e);
1150
1151
  }
1151
- async function Br({
1152
+ async function Kr({
1152
1153
  arcgisMap: e,
1153
1154
  arcgisMapView: t,
1154
1155
  layerId: r,
@@ -1168,20 +1169,20 @@ async function Br({
1168
1169
  theme: n
1169
1170
  };
1170
1171
  try {
1171
- const u = Wr(c), d = await Vr(u);
1172
+ const u = Br(c), d = await Ur(u);
1172
1173
  return i.renderer = d.renderer, i.visible = !0, `Type renderer applied to layer: ${i.title ?? i.id} using fields ${a.join(", ")}`;
1173
1174
  } catch (u) {
1174
1175
  return `Error applying type renderer: ${u instanceof Error ? u.message : String(u)}`;
1175
1176
  }
1176
1177
  }
1177
- async function Ur({
1178
+ async function Hr({
1178
1179
  layerId: e,
1179
1180
  fields: t,
1180
1181
  colorSchemes: r,
1181
1182
  theme: a
1182
1183
  }, o) {
1183
1184
  const { mapView: n } = $(o);
1184
- return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Br({
1185
+ return await R({ type: "show-legend", data: { layerIds: [e] } }, o), await Kr({
1185
1186
  arcgisMap: n.map,
1186
1187
  arcgisMapView: n,
1187
1188
  layerId: e,
@@ -1190,26 +1191,26 @@ async function Ur({
1190
1191
  theme: a
1191
1192
  });
1192
1193
  }
1193
- const Kr = s.object({
1194
+ const Jr = s.object({
1194
1195
  layerId: s.string().describe("The id of the layer to apply the type renderer to"),
1195
1196
  fields: s.array(s.string()).describe("The field(s) to use for the type renderer (categorical data)"),
1196
1197
  colorSchemes: s.array(s.string()).optional().describe("Optional color scheme tags to use"),
1197
1198
  theme: s.enum(["above-and-below", "above", "below", "centered-on", "extremes", "high-to-low"]).optional().describe("Optional theme for the color scheme")
1198
- }), Kn = g(Ur, {
1199
+ }), Xn = f(Hr, {
1199
1200
  name: "type",
1200
1201
  description: `Label: Types (unique symbols)
1201
1202
  Description: Represent features as categories with different symbol colors or shapes. Examples include type of tree, road class, or province name.
1202
1203
  Keywords: categorical, category, type, unique, discrete, point of interest, region, group
1203
1204
  Example: Color each feature based on the region it belongs to
1204
1205
  Fields: This style requires a single field which may be a string, number, or date type. It is usually a string.`,
1205
- schema: Kr
1206
- }), Hn = T.Root({
1206
+ schema: Jr
1207
+ }), ei = T.Root({
1207
1208
  ...H(),
1208
1209
  vectorSearchLayerIds: T(),
1209
1210
  vectorSearchFieldResults: T(),
1210
1211
  layerFieldInfo: T(),
1211
1212
  selectedLayerId: T()
1212
- }), Jn = T.Root({
1213
+ }), ti = T.Root({
1213
1214
  ...H(),
1214
1215
  vectorSearchLayerIds: T(),
1215
1216
  vectorSearchFieldResults: T(),
@@ -1219,41 +1220,41 @@ Fields: This style requires a single field which may be a string, number, or dat
1219
1220
  reducer: be,
1220
1221
  default: () => []
1221
1222
  })
1222
- }), Hr = ["mapView"];
1223
+ }), Zr = ["mapView"];
1223
1224
  function N(e) {
1224
1225
  const r = e?.configurable?.context;
1225
1226
  if (!r || typeof r != "object")
1226
1227
  throw new Error("DataExplorationAgent context missing");
1227
- const a = Hr.filter((o) => !(o in r));
1228
+ const a = Zr.filter((o) => !(o in r));
1228
1229
  if (a.length)
1229
1230
  throw new Error(`DataExplorationAgent context missing: ${a.join(", ")}`);
1230
1231
  return r;
1231
1232
  }
1232
- const Jr = (e) => {
1233
+ const Yr = (e) => {
1233
1234
  const t = e.map?.allLayers.filter((a) => a.type === "feature");
1234
1235
  let r = 0;
1235
1236
  return t?.forEach((a) => {
1236
1237
  const o = a;
1237
1238
  o.featureEffect && (o.featureEffect = null, r++);
1238
1239
  }), r > 0 ? `Cleared filters from ${r} layer(s). View unchanged.` : "No active filters to clear. View unchanged.";
1239
- }, Zr = async (e, t) => {
1240
+ }, Xr = async (e, t) => {
1240
1241
  const { mapView: r } = N(t);
1241
- return Jr(r);
1242
- }, Yr = g(Zr, {
1242
+ return Yr(r);
1243
+ }, ea = f(Xr, {
1243
1244
  name: "clearFilters",
1244
1245
  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.",
1245
1246
  schema: s.object({})
1246
- }), Xr = async (e) => {
1247
+ }), ta = async (e) => {
1247
1248
  e.map?.allLayers.filter((o) => o.type === "feature")?.forEach((o) => {
1248
1249
  const n = o;
1249
1250
  n.featureEffect && (n.featureEffect = null);
1250
1251
  });
1251
1252
  const a = e.map.initialViewProperties?.viewpoint?.targetGeometry;
1252
1253
  return a ? (await e.goTo(a), "Cleared all filters and returned to home extent.") : "Cleared all filters. Could not determine home extent.";
1253
- }, ea = async (e, t) => {
1254
+ }, ra = async (e, t) => {
1254
1255
  const { mapView: r } = N(t);
1255
- return await Xr(r);
1256
- }, ta = g(ea, {
1256
+ return await ta(r);
1257
+ }, aa = f(ra, {
1257
1258
  name: "resetMap",
1258
1259
  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.",
1259
1260
  schema: s.object({})
@@ -1298,14 +1299,14 @@ const J = async (e, t) => {
1298
1299
  const l = n.features.map((c) => c.geometry).filter((c) => !!c);
1299
1300
  if (!l.length)
1300
1301
  return { error: "No valid geometries found for the matched geometry layer features." };
1301
- const i = l.length === 1 ? l[0] : st.executeMany(l);
1302
+ const i = l.length === 1 ? l[0] : lt.executeMany(l);
1302
1303
  return i ? (i.spatialReference || (i.spatialReference = t.spatialReference), { geometry: i }) : { error: "Failed to combine geometries from geometry layer." };
1303
1304
  } catch (n) {
1304
1305
  return { error: `Failed to query geometry: ${String(n)}` };
1305
1306
  }
1306
1307
  }
1307
1308
  return { error: "Invalid geometry configuration provided" };
1308
- }, ra = async (e, t, r, a, o, n) => {
1309
+ }, oa = async (e, t, r, a, o, n) => {
1309
1310
  const l = e.map?.allLayers.find((c) => c.id === t);
1310
1311
  if (!l)
1311
1312
  return { success: !1, error: `Layer '${t}' not found.` };
@@ -1323,7 +1324,7 @@ const J = async (e, t) => {
1323
1324
  error: c instanceof Error ? c.message : String(c)
1324
1325
  };
1325
1326
  }
1326
- }, aa = async (e, t, r, a, o, n) => {
1327
+ }, na = async (e, t, r, a, o, n) => {
1327
1328
  const l = t.map?.allLayers.find(
1328
1329
  (p) => p.id === e.layerId
1329
1330
  );
@@ -1336,7 +1337,7 @@ const J = async (e, t) => {
1336
1337
  return p.error;
1337
1338
  i = p.geometry;
1338
1339
  }
1339
- if (l.featureEffect = null, l.featureEffect = new it({
1340
+ if (l.featureEffect = null, l.featureEffect = new st({
1340
1341
  filter: new Se({
1341
1342
  ...e.objectIds?.length ? { objectIds: e.objectIds } : { where: e.where },
1342
1343
  geometry: i,
@@ -1348,7 +1349,7 @@ const J = async (e, t) => {
1348
1349
  excludedEffect: a
1349
1350
  }), l.visible = !0, n)
1350
1351
  return `Applied feature effects to "${l.title ?? e.layerId}" within current map extent.`;
1351
- const c = e.objectIds?.length ? `${l.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await ra(
1352
+ const c = e.objectIds?.length ? `${l.objectIdField} IN (${e.objectIds.join(",")})` : e.where, u = await oa(
1352
1353
  t,
1353
1354
  e.layerId,
1354
1355
  c,
@@ -1357,7 +1358,7 @@ const J = async (e, t) => {
1357
1358
  o?.units
1358
1359
  ), d = l.title ?? e.layerId;
1359
1360
  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}`;
1360
- }, oa = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], F = s.enum(oa), na = async ({
1361
+ }, ia = ["feet", "kilometers", "meters", "miles", "nautical-miles", "us-nautical-miles"], F = s.enum(ia), sa = async ({
1361
1362
  targetLayer: e,
1362
1363
  geometryFilter: t,
1363
1364
  useCurrentExtent: r,
@@ -1365,13 +1366,13 @@ const J = async (e, t) => {
1365
1366
  excludedEffect: o = "grayscale(100%) opacity(60%) blur(2px)"
1366
1367
  }, n) => {
1367
1368
  const { mapView: l } = N(n);
1368
- return await aa(e, l, a, o, t, r);
1369
- }, ia = s.object({
1369
+ return await na(e, l, a, o, t, r);
1370
+ }, la = s.object({
1370
1371
  layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1371
1372
  where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1372
1373
  distance: s.number().optional().describe("The buffer distance around the geometry."),
1373
1374
  units: F.optional().describe("The units for the distance buffer.")
1374
- }), sa = s.object({
1375
+ }), ca = s.object({
1375
1376
  point: s.object({
1376
1377
  x: s.number().describe("X coordinate (longitude) from navigation result"),
1377
1378
  y: s.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1381,7 +1382,7 @@ const J = async (e, t) => {
1381
1382
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1382
1383
  distance: s.number().optional().describe("Optional buffer distance around the point."),
1383
1384
  units: F.optional().describe("The units for the distance buffer.")
1384
- }), la = s.object({
1385
+ }), ua = s.object({
1385
1386
  targetLayer: s.object({
1386
1387
  layerId: s.string().describe("The layerId of the layer on which to set a feature effect."),
1387
1388
  where: s.string().describe("The SQL-92 where clause representing the features to emphasize."),
@@ -1389,7 +1390,7 @@ const J = async (e, t) => {
1389
1390
  "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."
1390
1391
  )
1391
1392
  }),
1392
- geometryFilter: s.union([ia, sa]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1393
+ geometryFilter: s.union([la, ca]).optional().describe("Optional geometry-based filtering parameters for spatial queries."),
1393
1394
  useCurrentExtent: s.boolean().optional().describe(
1394
1395
  "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."
1395
1396
  ),
@@ -1399,11 +1400,28 @@ const J = async (e, t) => {
1399
1400
  excludedEffect: s.string().default("grayscale(100%) opacity(60%) blur(2px)").describe(
1400
1401
  "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."
1401
1402
  )
1402
- }), ca = g(na, {
1403
+ }), da = f(sa, {
1403
1404
  name: "setFeatureEffect",
1404
1405
  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.",
1405
- schema: la
1406
- }), te = (e) => {
1406
+ schema: ua
1407
+ }), pa = /* @__PURE__ */ new Set([
1408
+ "date",
1409
+ "esrifieldtypedate",
1410
+ "date-only",
1411
+ "dateonly",
1412
+ "esrifieldtypedateonly",
1413
+ "time-only",
1414
+ "timeonly",
1415
+ "esrifieldtypetimeonly",
1416
+ "timestamp-offset",
1417
+ "timestampoffset",
1418
+ "esrifieldtypetimestampoffset"
1419
+ ]), Re = (e) => {
1420
+ if (!e)
1421
+ return !1;
1422
+ const t = e.toLowerCase();
1423
+ return pa.has(t);
1424
+ }, te = (e) => {
1407
1425
  if (e instanceof Date)
1408
1426
  return Number.isNaN(e.getTime()) ? null : e;
1409
1427
  if (typeof e == "number" && Number.isFinite(e)) {
@@ -1411,23 +1429,25 @@ const J = async (e, t) => {
1411
1429
  return Number.isNaN(t.getTime()) ? null : t;
1412
1430
  }
1413
1431
  return null;
1414
- }, ua = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, da = (e) => {
1432
+ }, ma = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ha = (e) => {
1415
1433
  if (typeof e == "string" && e)
1416
1434
  return e;
1417
1435
  const t = te(e);
1418
1436
  return t ? t.toISOString().slice(0, 10) : null;
1419
- }, Zn = () => {
1437
+ }, ri = () => {
1420
1438
  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}`;
1421
1439
  return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: o };
1422
- }, pa = (e, t, r) => {
1440
+ }, ya = (e, t, r) => {
1423
1441
  const a = t?.toLowerCase();
1442
+ if (a && !Re(a))
1443
+ return e;
1424
1444
  if (a === "date-only") {
1425
- const n = da(e);
1426
- return n ? lt(n, _("short-date")) : e;
1445
+ const n = ha(e);
1446
+ return n ? ct(n, _("short-date")) : e;
1427
1447
  }
1428
1448
  if (a === "time-only") {
1429
1449
  if (typeof e == "string" && e)
1430
- return ct(e, _("long-time"));
1450
+ return ut(e, _("long-time"));
1431
1451
  const n = te(e);
1432
1452
  return n ? ye(n, {
1433
1453
  ..._("long-time"),
@@ -1437,9 +1457,9 @@ const J = async (e, t) => {
1437
1457
  const o = te(e);
1438
1458
  return o ? ye(o, {
1439
1459
  ..._("short-date-short-time"),
1440
- timeZone: ua(r)
1460
+ timeZone: ma(r)
1441
1461
  }) : e;
1442
- }, Re = (e, t, r) => {
1462
+ }, $e = (e, t, r) => {
1443
1463
  if (e && typeof e != "function") {
1444
1464
  const a = "getField" in r && r.getField?.(e), o = a && "getFieldDomain" in r && r.getFieldDomain ? r.getFieldDomain(a.name) : null;
1445
1465
  if (o?.type === "coded-value") {
@@ -1448,7 +1468,7 @@ const J = async (e, t) => {
1448
1468
  }
1449
1469
  }
1450
1470
  return null;
1451
- }, ma = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ha = (e) => {
1471
+ }, fa = (e) => !e || e === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : e === "unknown" ? "UTC" : e, ga = (e) => {
1452
1472
  if (e instanceof Date)
1453
1473
  return Number.isNaN(e.getTime()) ? null : e;
1454
1474
  if (typeof e == "number" && Number.isFinite(e)) {
@@ -1460,7 +1480,7 @@ const J = async (e, t) => {
1460
1480
  return Number.isNaN(t.getTime()) ? null : t;
1461
1481
  }
1462
1482
  return null;
1463
- }, ya = (e, t) => {
1483
+ }, wa = (e, t) => {
1464
1484
  if (typeof e != "number")
1465
1485
  return e;
1466
1486
  const r = {};
@@ -1470,26 +1490,26 @@ const J = async (e, t) => {
1470
1490
  } catch {
1471
1491
  return e;
1472
1492
  }
1473
- }, fa = (e, t, r) => {
1474
- const a = ha(e);
1493
+ }, ba = (e, t, r) => {
1494
+ const a = ga(e);
1475
1495
  if (!a)
1476
1496
  return e;
1477
1497
  const o = {};
1478
- 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 = ma(r);
1498
+ 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 = fa(r);
1479
1499
  try {
1480
1500
  return new Intl.DateTimeFormat(void 0, o).format(a);
1481
1501
  } catch {
1482
1502
  return e;
1483
1503
  }
1484
- }, $e = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Ce = (e, t, r, a, o) => {
1504
+ }, Ce = (e, t) => e.getFieldAlias?.(t) ?? e.fieldsIndex?.get(t)?.alias ?? e.fieldsIndex?.get(t)?.name ?? t, Ee = (e, t, r, a, o) => {
1485
1505
  if (r == null)
1486
1506
  return r;
1487
1507
  const l = e.getFieldConfiguration?.(t)?.fieldFormat;
1488
- return l?.type === "number" ? ya(r, l) : l?.type === "date-time" ? fa(r, l, o) : pa(r, a, o);
1489
- }, ga = (e, t, r, a) => {
1490
- const o = e.fieldsIndex?.get(t), n = Re(t, r, e) ?? r;
1491
- return Ce(e, t, n, o?.type, a);
1492
- }, wa = (e, t) => $e(e, t), Ee = (e, t, r) => {
1508
+ return l?.type === "number" ? wa(r, l) : l?.type === "date-time" ? !a || Re(a) ? ba(r, l, o) : r : ya(r, a, o);
1509
+ }, Ta = (e, t, r, a) => {
1510
+ const o = e.fieldsIndex?.get(t), n = $e(t, r, e) ?? r;
1511
+ return Ee(e, t, n, o?.type, a);
1512
+ }, Sa = (e, t) => Ce(e, t), Fe = (e, t, r) => {
1493
1513
  const a = e.objectIdField, o = t.features.map(
1494
1514
  (l) => l.attributes[a]
1495
1515
  ), n = t.features.map((l) => {
@@ -1502,16 +1522,16 @@ const J = async (e, t) => {
1502
1522
  c[u.name] = d;
1503
1523
  return;
1504
1524
  }
1505
- const p = Re(u.name, d, e) ?? d, m = $e(e, u.name);
1506
- c[m] = Ce(e, u.name, p, u.type, r);
1525
+ const p = $e(u.name, d, e) ?? d, m = Ce(e, u.name);
1526
+ c[m] = Ee(e, u.name, p, u.type, r);
1507
1527
  }), c;
1508
1528
  });
1509
1529
  return { objectIds: o, attributes: n };
1510
- }, ba = (e, t, r) => {
1530
+ }, va = (e, t, r) => {
1511
1531
  const a = e.createQuery();
1512
1532
  return a.outFields = [t], a.where = r || "1=1", a.num = 1, a;
1513
- }, Ta = async (e, t, r, a) => {
1514
- const o = a.map?.allLayers.find((m) => m.id === e), n = ba(o, t, r.where), i = (await o.queryFeatures(n)).features[0], c = i ? i.attributes[t] : null, u = ga(o, t, c, a.timeZone), d = wa(o, t);
1533
+ }, xa = async (e, t, r, a) => {
1534
+ const o = a.map?.allLayers.find((m) => m.id === e), n = va(o, t, r.where), i = (await o.queryFeatures(n)).features[0], c = i ? i.attributes[t] : null, u = Ta(o, t, c, a.timeZone), d = Sa(o, t);
1515
1535
  return {
1516
1536
  tool: "getAttribute",
1517
1537
  layerName: o.title ?? e,
@@ -1524,20 +1544,20 @@ const J = async (e, t) => {
1524
1544
  }
1525
1545
  };
1526
1546
  };
1527
- async function Sa({ layerId: e, fieldName: t, query: r }, a) {
1528
- const { mapView: o } = N(a), n = await Ta(e, t, r, o);
1547
+ async function Ra({ layerId: e, fieldName: t, query: r }, a) {
1548
+ const { mapView: o } = N(a), n = await xa(e, t, r, o);
1529
1549
  return JSON.stringify(n, null, 2);
1530
1550
  }
1531
- const va = s.object({
1551
+ const $a = s.object({
1532
1552
  layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1533
1553
  fieldName: s.string().describe("The name of the field/attribute from which to get a field value."),
1534
1554
  query: s.object({
1535
1555
  where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1536
1556
  })
1537
- }), xa = g(Sa, {
1557
+ }), Ca = f(Ra, {
1538
1558
  name: "getAttribute",
1539
1559
  description: "Returns an attribute value for a given feature.",
1540
- schema: va
1560
+ schema: $a
1541
1561
  }), le = (e, t, r) => {
1542
1562
  if (!(r ? e.hasAllFeaturesInView : e.hasAllFeatures))
1543
1563
  return !1;
@@ -1548,14 +1568,14 @@ function K(e, t) {
1548
1568
  let r = e ?? "";
1549
1569
  return t != null && t && (r = r ? `(${r}) AND (${t})` : t), r || null;
1550
1570
  }
1551
- const Ra = async (e) => {
1571
+ const Ea = async (e) => {
1552
1572
  const { targetLayer: t, fieldName: r, statisticType: a, mapView: o, layersAndFieldsRegistry: n, geometryFilter: l } = e, i = o.map?.allLayers.find((S) => S.id === t.layerId);
1553
1573
  if (!i)
1554
1574
  throw new Error(`Layer '${t.layerId}' not found.`);
1555
1575
  const c = await o.whenLayerView(i), d = n.get(t.layerId)?.fieldRegistry.get(r), p = d?.alias;
1556
1576
  if (!d)
1557
1577
  throw new Error(`Field '${r}' not found.`);
1558
- let m, y;
1578
+ let m, w;
1559
1579
  if (l) {
1560
1580
  const S = await J(l, o);
1561
1581
  if ("error" in S)
@@ -1578,39 +1598,39 @@ const Ra = async (e) => {
1578
1598
  units: l.units,
1579
1599
  applied: !0
1580
1600
  });
1581
- y = new Se({
1601
+ w = new Se({
1582
1602
  geometry: S.geometry,
1583
1603
  distance: l.distance,
1584
1604
  units: l.units,
1585
1605
  spatialRelationship: "intersects"
1586
1606
  });
1587
1607
  }
1588
- const f = le(c, [r], !1);
1589
- let h = null, w = null;
1608
+ const h = le(c, [r], !1);
1609
+ let y = null, g = null;
1590
1610
  const b = 10;
1591
1611
  if (d.type !== "geometry" && d.type !== "oid" && d.type !== "global-id")
1592
1612
  try {
1593
1613
  const S = {
1594
1614
  layer: i,
1595
- useFeaturesInView: f,
1596
- view: f ? o : void 0,
1615
+ useFeaturesInView: h,
1616
+ view: h ? o : void 0,
1597
1617
  field: r,
1598
1618
  sqlWhere: K(i.definitionExpression, t.where),
1599
- ...y && { filter: y },
1619
+ ...w && { filter: w },
1600
1620
  outStatisticTypes: { include: [a] }
1601
1621
  };
1602
- h = await ut(S);
1622
+ y = await dt(S);
1603
1623
  const Q = ["string", "small-integer", "integer"], A = d.domain?.type === "coded-value" ? d.domain : null;
1604
- (Q.includes(d.type) || A) && (w = (await dt({
1624
+ (Q.includes(d.type) || A) && (g = (await pt({
1605
1625
  layer: i,
1606
- useFeaturesInView: f,
1607
- view: f ? o : void 0,
1626
+ useFeaturesInView: h,
1627
+ view: h ? o : void 0,
1608
1628
  field: r,
1609
1629
  sqlWhere: K(i.definitionExpression, t.where),
1610
- ...y && { filter: y }
1611
- })).uniqueValueInfos.sort((I, ze) => ze.count - I.count).slice(0, b)), w && d.domain?.type === "coded-value" && (w = w.map((I) => ({
1612
- ...I,
1613
- value: A ? A.getName(I.value) ?? I.value : I.value
1630
+ ...w && { filter: w }
1631
+ })).uniqueValueInfos.sort((z, De) => De.count - z.count).slice(0, b)), g && d.domain?.type === "coded-value" && (g = g.map((z) => ({
1632
+ ...z,
1633
+ value: A ? A.getName(z.value) ?? z.value : z.value
1614
1634
  })));
1615
1635
  } catch (S) {
1616
1636
  console.error("Statistics error:", S);
@@ -1618,26 +1638,26 @@ const Ra = async (e) => {
1618
1638
  return {
1619
1639
  tool: "getStatistics",
1620
1640
  layerName: i.title ?? t.layerId,
1621
- summary: `${a} = ${typeof h?.[a] == "number" ? h[a] : "N/A"}`,
1641
+ summary: `${a} = ${typeof y?.[a] == "number" ? y[a] : "N/A"}`,
1622
1642
  details: {
1623
1643
  fieldName: r,
1624
1644
  fieldAlias: p,
1625
1645
  statisticType: a,
1626
- statistic: h?.[a] ?? null,
1627
- summaryStatistics: h,
1628
- uniqueValues: w,
1646
+ statistic: y?.[a] ?? null,
1647
+ summaryStatistics: y,
1648
+ uniqueValues: g,
1629
1649
  where: t.where,
1630
1650
  spatialFilterInfo: m
1631
1651
  }
1632
1652
  };
1633
1653
  };
1634
- async function $a({
1654
+ async function Fa({
1635
1655
  targetLayer: e,
1636
1656
  fieldName: t,
1637
1657
  statisticType: r,
1638
1658
  geometryFilter: a
1639
1659
  }, o) {
1640
- const n = xe(o, "layersAndFieldsRegistry"), { mapView: l } = N(o), i = await Ra({
1660
+ const n = xe(o, "layersAndFieldsRegistry"), { mapView: l } = N(o), i = await Ea({
1641
1661
  targetLayer: e,
1642
1662
  fieldName: t,
1643
1663
  statisticType: r,
@@ -1647,12 +1667,12 @@ async function $a({
1647
1667
  });
1648
1668
  return JSON.stringify(i, null, 2);
1649
1669
  }
1650
- const Ca = s.object({
1670
+ const ka = s.object({
1651
1671
  layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1652
1672
  where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1653
1673
  distance: s.number().optional().describe("The buffer distance around the geometry."),
1654
1674
  units: F.optional().describe("The units for the distance buffer.")
1655
- }), Ea = s.object({
1675
+ }), Na = s.object({
1656
1676
  point: s.object({
1657
1677
  x: s.number().describe("X coordinate (longitude) from navigation result"),
1658
1678
  y: s.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1662,17 +1682,17 @@ const Ca = s.object({
1662
1682
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1663
1683
  distance: s.number().optional().describe("Optional buffer distance around the point."),
1664
1684
  units: F.optional().describe("The units for the distance buffer.")
1665
- }), Fa = s.object({
1685
+ }), qa = s.object({
1666
1686
  targetLayer: s.object({
1667
1687
  layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1668
1688
  where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value.")
1669
1689
  }),
1670
- geometryFilter: s.union([Ca, Ea]).optional().describe(
1690
+ geometryFilter: s.union([ka, Na]).optional().describe(
1671
1691
  "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."
1672
1692
  ),
1673
1693
  fieldName: s.string().describe("The name of the field for which to get statistics. STRICTLY DO NOT use OBJECTID. Use any other field"),
1674
1694
  statisticType: s.enum(["avg", "max", "median", "min", "stddev", "sum", "variance", "nullcount", "count"]).describe("The statistic type to calculate.")
1675
- }), ka = g($a, {
1695
+ }), za = f(Fa, {
1676
1696
  name: "getStatistics",
1677
1697
  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.
1678
1698
 
@@ -1687,8 +1707,8 @@ DO NOT USE FOR:
1687
1707
  - Simple counts of features matching a condition — use queryFeatures instead
1688
1708
 
1689
1709
  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.`,
1690
- schema: Fa
1691
- }), Na = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), qa = async (e, t, r, a, o) => {
1710
+ schema: qa
1711
+ }), Ia = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), Da = async (e, t, r, a, o) => {
1692
1712
  const n = r.map?.allLayers.find((m) => m.id === e.layerId), l = await r.whenLayerView(n), i = n.title ?? e.layerId;
1693
1713
  let c;
1694
1714
  if (a) {
@@ -1715,7 +1735,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1715
1735
  try {
1716
1736
  let m;
1717
1737
  if (u) {
1718
- const h = new pt({
1738
+ const y = new mt({
1719
1739
  where: e.where || "1=1",
1720
1740
  outFields: p,
1721
1741
  orderByFields: e.orderByFields,
@@ -1723,34 +1743,34 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1723
1743
  spatialRelationship: c ? "intersects" : void 0,
1724
1744
  distance: a?.distance,
1725
1745
  units: a?.units,
1726
- topFilter: new mt({
1746
+ topFilter: new ht({
1727
1747
  topCount: t.topCount,
1728
1748
  groupByFields: t.groupByFields,
1729
1749
  orderByFields: t.orderByFields
1730
1750
  })
1731
1751
  });
1732
- m = await n.queryTopFeatures(h);
1752
+ m = await n.queryTopFeatures(y);
1733
1753
  } else {
1734
- const h = n.createQuery();
1735
- h.where = K(n.definitionExpression, e.where || "1=1"), h.outFields = p.length ? p : ["*"], h.orderByFields = t.orderByFields, h.returnGeometry = !1, h.num = t.topCount, c && (h.geometry = c, h.spatialRelationship = "intersects"), a?.distance && (h.distance = a.distance), a?.units && (h.units = a.units), h.outSpatialReference = r.spatialReference;
1736
- const w = [
1737
- .../* @__PURE__ */ new Set([...e.outFields, ...Na(t.orderByFields)])
1738
- ], b = le(l, w, o ?? !1);
1754
+ const y = n.createQuery();
1755
+ y.where = K(n.definitionExpression, e.where || "1=1"), y.outFields = p.length ? p : ["*"], y.orderByFields = t.orderByFields, y.returnGeometry = !1, y.num = t.topCount, c && (y.geometry = c, y.spatialRelationship = "intersects"), a?.distance && (y.distance = a.distance), a?.units && (y.units = a.units), y.outSpatialReference = r.spatialReference;
1756
+ const g = [
1757
+ .../* @__PURE__ */ new Set([...e.outFields, ...Ia(t.orderByFields)])
1758
+ ], b = le(l, g, o ?? !1);
1739
1759
  try {
1740
- m = b ? await l.queryFeatures(h) : await n.queryFeatures(h);
1760
+ m = b ? await l.queryFeatures(y) : await n.queryFeatures(y);
1741
1761
  } catch (v) {
1742
- console.warn("Client-side query failed, falling back to server:", v), m = await n.queryFeatures(h);
1762
+ console.warn("Client-side query failed, falling back to server:", v), m = await n.queryFeatures(y);
1743
1763
  }
1744
1764
  }
1745
- const y = m.features.map((h) => h.attributes[d]), { attributes: f } = Ee(n, m, r.timeZone);
1765
+ const w = m.features.map((y) => y.attributes[d]), { attributes: h } = Fe(n, m, r.timeZone);
1746
1766
  return {
1747
1767
  tool: "getTopFeatures",
1748
1768
  layerName: i,
1749
1769
  summary: `Top ${t.topCount} features extracted`,
1750
1770
  details: {
1751
1771
  topCount: t.topCount,
1752
- attributes: f,
1753
- objectIds: y,
1772
+ attributes: h,
1773
+ objectIds: w,
1754
1774
  objectIdField: d,
1755
1775
  where: e.where,
1756
1776
  orderByFields: t.orderByFields,
@@ -1765,20 +1785,20 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1765
1785
  details: { error: m instanceof Error ? m.message : String(m) }
1766
1786
  };
1767
1787
  }
1768
- }, Ia = async ({
1788
+ }, Pa = async ({
1769
1789
  targetLayer: e,
1770
1790
  topFilter: t,
1771
1791
  geometryFilter: r,
1772
1792
  useCurrentExtent: a
1773
1793
  }, o) => {
1774
- const { mapView: n } = N(o), l = await qa(e, t, n, r, a);
1794
+ const { mapView: n } = N(o), l = await Da(e, t, n, r, a);
1775
1795
  return JSON.stringify(l, null, 2);
1776
- }, za = s.object({
1796
+ }, Aa = s.object({
1777
1797
  layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1778
1798
  where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1779
1799
  distance: s.number().optional().describe("The buffer distance around the geometry."),
1780
1800
  units: F.optional().describe("The units for the distance buffer.")
1781
- }), Da = s.object({
1801
+ }), La = s.object({
1782
1802
  point: s.object({
1783
1803
  x: s.number().describe("X coordinate (longitude) from navigation result"),
1784
1804
  y: s.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1788,7 +1808,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1788
1808
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1789
1809
  distance: s.number().optional().describe("Optional buffer distance around the point."),
1790
1810
  units: F.optional().describe("The units for the distance buffer.")
1791
- }), Pa = s.object({
1811
+ }), ja = s.object({
1792
1812
  targetLayer: s.object({
1793
1813
  layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1794
1814
  where: s.string().describe("The SQL-92 where clause representing the feature from which to get an attribute value."),
@@ -1799,7 +1819,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1799
1819
  ).default("*")
1800
1820
  )
1801
1821
  }),
1802
- geometryFilter: s.union([za, Da]).optional().describe(
1822
+ geometryFilter: s.union([Aa, La]).optional().describe(
1803
1823
  "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."
1804
1824
  ),
1805
1825
  topFilter: s.object({
@@ -1812,17 +1832,17 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1812
1832
  useCurrentExtent: s.boolean().optional().describe(
1813
1833
  "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)."
1814
1834
  )
1815
- }), Aa = g(Ia, {
1835
+ }), Ga = f(Pa, {
1816
1836
  name: "getTopFeatures",
1817
1837
  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.',
1818
- schema: Pa
1819
- }), ee = 25, La = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), ja = async (e, t, r, a) => {
1820
- const o = t.map?.allLayers.find((w) => w.id === e.layerId), n = await t.whenLayerView(o), l = o.title ?? e.layerId;
1838
+ schema: ja
1839
+ }), ee = 25, Oa = (e) => e.flatMap((t) => t.split(",")).map((t) => t.trim()).map((t) => t.split(/\s+/u)[0]?.replace(/^"|"$/gu, "")).filter((t) => !!t), Ma = async (e, t, r, a) => {
1840
+ const o = t.map?.allLayers.find((g) => g.id === e.layerId), n = await t.whenLayerView(o), l = o.title ?? e.layerId;
1821
1841
  let i;
1822
1842
  if (r) {
1823
- const w = await J(r, t);
1824
- if ("error" in w) {
1825
- const b = { error: w.error };
1843
+ const g = await J(r, t);
1844
+ if ("error" in g) {
1845
+ const b = { error: g.error };
1826
1846
  if (j(r)) {
1827
1847
  const v = t.map?.allLayers.find((S) => S.id === r.layerId);
1828
1848
  b.geometryLayerName = v?.title ?? v?.id, b.geometryLayerId = r.layerId, b.geometryWhere = r.where;
@@ -1834,7 +1854,7 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1834
1854
  details: b
1835
1855
  };
1836
1856
  }
1837
- if (!w.geometry) {
1857
+ if (!g.geometry) {
1838
1858
  const b = {};
1839
1859
  if (j(r)) {
1840
1860
  const v = t.map?.allLayers.find((S) => S.id === r.layerId);
@@ -1847,19 +1867,19 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1847
1867
  details: b
1848
1868
  };
1849
1869
  }
1850
- i = w.geometry;
1870
+ i = g.geometry;
1851
1871
  } else a && (i = t.extent.clone());
1852
1872
  const c = [
1853
- .../* @__PURE__ */ new Set([...e.outFields, ...La(e.orderByFields)])
1873
+ .../* @__PURE__ */ new Set([...e.outFields, ...Oa(e.orderByFields)])
1854
1874
  ], u = le(n, c, a ?? !1), d = o.objectIdField, p = o.createQuery();
1855
1875
  p.where = K(o.definitionExpression, e.where || "1=1"), p.outFields = e.outFields.includes("*") ? ["*"] : [.../* @__PURE__ */ new Set([...e.outFields, d])], p.orderByFields = e.orderByFields, i && (p.geometry = i, p.spatialRelationship = "intersects"), r?.distance && (p.distance = r.distance), r?.units && (p.units = r.units), p.outSpatialReference = t.spatialReference;
1856
- let m, y;
1876
+ let m, w;
1857
1877
  try {
1858
- m = u ? await n.queryFeatureCount(p) : await o.queryFeatureCount(p), m > 0 && m <= ee && (y = u ? await n.queryFeatures(p) : await o.queryFeatures(p));
1859
- } catch (w) {
1860
- console.warn("Client-side query failed, falling back to server:", w), m = await o.queryFeatureCount(p), m > 0 && m <= ee && (y = await o.queryFeatures(p));
1878
+ m = u ? await n.queryFeatureCount(p) : await o.queryFeatureCount(p), m > 0 && m <= ee && (w = u ? await n.queryFeatures(p) : await o.queryFeatures(p));
1879
+ } catch (g) {
1880
+ console.warn("Client-side query failed, falling back to server:", g), m = await o.queryFeatureCount(p), m > 0 && m <= ee && (w = await o.queryFeatures(p));
1861
1881
  }
1862
- const { objectIds: f, attributes: h } = y ? Ee(o, y, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1882
+ const { objectIds: h, attributes: y } = w ? Fe(o, w, t.timeZone) : { objectIds: void 0, attributes: void 0 };
1863
1883
  return {
1864
1884
  tool: "queryFeatures",
1865
1885
  layerName: l,
@@ -1869,28 +1889,28 @@ Only call this tool when the answer requires computing an aggregate (avg, max, m
1869
1889
  where: e.where,
1870
1890
  orderByFields: e.orderByFields,
1871
1891
  outFields: e.outFields,
1872
- ...f && { objectIds: f, objectIdField: d },
1873
- ...h && { attributes: h },
1892
+ ...h && { objectIds: h, objectIdField: d },
1893
+ ...y && { attributes: y },
1874
1894
  ...m > ee && {
1875
1895
  note: `${m} features found.`
1876
1896
  }
1877
1897
  }
1878
1898
  };
1879
1899
  };
1880
- async function Ga({
1900
+ async function Qa({
1881
1901
  targetLayer: e,
1882
1902
  geometryFilter: t,
1883
1903
  useCurrentExtent: r
1884
1904
  }, a) {
1885
- const { mapView: o } = N(a), n = await ja(e, o, t, r);
1905
+ const { mapView: o } = N(a), n = await Ma(e, o, t, r);
1886
1906
  return JSON.stringify(n, null, 2);
1887
1907
  }
1888
- const Oa = s.object({
1908
+ const _a = s.object({
1889
1909
  layerId: s.string().describe("The layerId of the layer containing the geometry by which to filter."),
1890
1910
  where: s.string().describe("The SQL-92 where clause representing the features from which to filter."),
1891
1911
  distance: s.number().optional().describe("The buffer distance around the geometry."),
1892
1912
  units: F.optional().describe("The units for the distance buffer.")
1893
- }), Ma = s.object({
1913
+ }), Wa = s.object({
1894
1914
  point: s.object({
1895
1915
  x: s.number().describe("X coordinate (longitude) from navigation result"),
1896
1916
  y: s.number().describe("Y coordinate (latitude) from navigation result"),
@@ -1900,7 +1920,7 @@ const Oa = s.object({
1900
1920
  }).describe("Point coordinates from a previous navigation/geocoding result"),
1901
1921
  distance: s.number().optional().describe("Optional buffer distance around the point."),
1902
1922
  units: F.optional().describe("The units for the distance buffer.")
1903
- }), Qa = s.object({
1923
+ }), Va = s.object({
1904
1924
  targetLayer: s.object({
1905
1925
  layerId: s.string().describe("The layerId of the layer containing the field from which to get a value."),
1906
1926
  where: s.string().describe(
@@ -1913,13 +1933,13 @@ const Oa = s.object({
1913
1933
  ).default("*")
1914
1934
  )
1915
1935
  }),
1916
- geometryFilter: s.union([Oa, Ma]).optional().describe(
1936
+ geometryFilter: s.union([_a, Wa]).optional().describe(
1917
1937
  "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."
1918
1938
  ),
1919
1939
  useCurrentExtent: s.boolean().optional().describe(
1920
1940
  "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)."
1921
1941
  )
1922
- }), _a = g(Ga, {
1942
+ }), Ba = f(Qa, {
1923
1943
  name: "queryFeatures",
1924
1944
  description: `Queries features from a layer. Returns the total count of matching features, plus individual feature attributes if ≤25 features match.
1925
1945
 
@@ -1931,10 +1951,10 @@ USE THIS TOOL FOR:
1931
1951
  - Any question where the user wants to SEE or COUNT matching features
1932
1952
 
1933
1953
  This is the DEFAULT tool for most queries. When in doubt, use this tool.`,
1934
- schema: Qa
1935
- }), Wa = [xa, ka, Aa, _a], Yn = [ca, ta, Yr], Va = new nt(Wa, { handleToolErrors: !1 });
1936
- async function Xn(e, t) {
1937
- const { messages: r } = await Va.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
1954
+ schema: Va
1955
+ }), Ua = [Ca, za, Ga, Ba], ai = [da, aa, ea], Ka = new it(Ua, { handleToolErrors: !1 });
1956
+ async function oi(e, t) {
1957
+ const { messages: r } = await Ka.invoke({ messages: e.dataExplorationMessages }, t), a = [], o = [];
1938
1958
  for (const n of r) {
1939
1959
  const l = n.content;
1940
1960
  let i;
@@ -1966,11 +1986,11 @@ async function Xn(e, t) {
1966
1986
  dataExplorationMessages: [...e.dataExplorationMessages, ...r],
1967
1987
  queryResponse: a,
1968
1988
  status: "success",
1969
- summary: o.length > 0 ? Bt(o.join(`
1989
+ summary: o.length > 0 ? Kt(o.join(`
1970
1990
  `)) : "Query executed."
1971
1991
  };
1972
1992
  }
1973
- const ei = T.Root({
1993
+ const ni = T.Root({
1974
1994
  ...H(),
1975
1995
  // internal to the help agent
1976
1996
  helpInternalState: T({
@@ -1979,7 +1999,7 @@ const ei = T.Root({
1979
1999
  toolCallMessage: void 0
1980
2000
  })
1981
2001
  })
1982
- }), Ba = (e, t) => {
2002
+ }), Ha = (e, t) => {
1983
2003
  const r = Array.from(e.values()).find(
1984
2004
  ({ layerItem: n }) => n.title?.toLowerCase().includes(t.toLowerCase())
1985
2005
  );
@@ -1992,16 +2012,16 @@ const ei = T.Root({
1992
2012
  return `**${r.layerItem.title}** has ${a.length} field(s):
1993
2013
 
1994
2014
  ${o}`;
1995
- }, Ua = async ({ layerTitle: e }, t) => {
2015
+ }, Ja = async ({ layerTitle: e }, t) => {
1996
2016
  const r = xe(t, "layersAndFieldsRegistry");
1997
- return Ba(r, e);
1998
- }, ti = g(Ua, {
2017
+ return Ha(r, e);
2018
+ }, ii = f(Ja, {
1999
2019
  name: "listLayerFields",
2000
2020
  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.",
2001
2021
  schema: s.object({
2002
2022
  layerTitle: s.string().describe("The title or partial title of the layer to list fields for.")
2003
2023
  })
2004
- }), ri = T.Root({
2024
+ }), si = T.Root({
2005
2025
  ...H(),
2006
2026
  intent: T({
2007
2027
  reducer: (e, t) => t
@@ -2037,16 +2057,16 @@ function O(e) {
2037
2057
  view: a
2038
2058
  };
2039
2059
  }
2040
- function ai(e) {
2060
+ function li(e) {
2041
2061
  const r = e?.configurable?.context;
2042
- if (Fe(e) === "knowledgeGraph")
2062
+ if (ke(e) === "knowledgeGraph")
2043
2063
  return "knowledgeGraph";
2044
2064
  const o = r.view;
2045
2065
  return q(o) ? (ce(o), "map") : "linkChart";
2046
2066
  }
2047
2067
  async function M(e) {
2048
2068
  const r = e?.configurable?.context;
2049
- if (Fe(e) === "knowledgeGraph")
2069
+ if (ke(e) === "knowledgeGraph")
2050
2070
  return r;
2051
2071
  {
2052
2072
  const o = r.view.map;
@@ -2070,7 +2090,7 @@ async function M(e) {
2070
2090
  }
2071
2091
  }
2072
2092
  }
2073
- function Fe(e) {
2093
+ function ke(e) {
2074
2094
  const r = e?.configurable?.context;
2075
2095
  if (!r || typeof r != "object")
2076
2096
  throw new Error("ArcgisKnowledgeAgent context missing");
@@ -2082,7 +2102,7 @@ function Fe(e) {
2082
2102
  return "view";
2083
2103
  throw new Error("ArcgisKnowledgeAgent context must have either a view or knowledgeGraph property.");
2084
2104
  }
2085
- class Ka {
2105
+ class Za {
2086
2106
  constructor(t) {
2087
2107
  this.dataModel = t, this.kind = "GraphQueryGenerationRequest", this.explainQuery = !0, this.schemaInformation = ue.fromDataModel(t);
2088
2108
  }
@@ -2101,10 +2121,10 @@ class ue {
2101
2121
  for (const a of t.entityTypes)
2102
2122
  r.entityTypes.push(G.fromEntityType(a));
2103
2123
  for (const a of t.relationshipTypes)
2104
- r.relationshipTypes.push(Ha.fromRelationshipType(a));
2124
+ r.relationshipTypes.push(Ya.fromRelationshipType(a));
2105
2125
  return r.identifierInfo = {
2106
2126
  mappingInfo: {
2107
- identifierMapsTo: Ja(
2127
+ identifierMapsTo: Xa(
2108
2128
  t.identifierInfo.identifierMappingInfo.identifierInfoType
2109
2129
  ),
2110
2130
  identifierPropertyName: t.identifierInfo.identifierMappingInfo.uniformPropertyIdentifier.identifierPropertyName
@@ -2124,13 +2144,13 @@ class G {
2124
2144
  }
2125
2145
  static fromEntityType(t) {
2126
2146
  const r = new G();
2127
- r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = Za(t.role);
2147
+ r.name = t.name, r.alias = t.alias ? t.alias : void 0, r.role = eo(t.role);
2128
2148
  for (const a of t.properties) {
2129
2149
  const o = {
2130
2150
  name: a.name,
2131
2151
  alias: a.alias ? a.alias : void 0,
2132
2152
  fieldType: a.fieldType,
2133
- role: Ya(a.role),
2153
+ role: to(a.role),
2134
2154
  geometryDef: a.fieldType === "esriFieldTypeGeometry" ? {
2135
2155
  geometryType: a.geometryType ?? "esriGeometryAny",
2136
2156
  hasM: a.hasM ? a.hasM : void 0,
@@ -2142,7 +2162,7 @@ class G {
2142
2162
  return r;
2143
2163
  }
2144
2164
  }
2145
- class Ha extends G {
2165
+ class Ya extends G {
2146
2166
  constructor() {
2147
2167
  super(...arguments), this.observedEndPoints = [];
2148
2168
  }
@@ -2157,7 +2177,7 @@ class Ha extends G {
2157
2177
  return r;
2158
2178
  }
2159
2179
  }
2160
- const Ja = (e) => {
2180
+ const Xa = (e) => {
2161
2181
  switch (e) {
2162
2182
  case "esriIdentifierInfoTypeUNSPECIFIED":
2163
2183
  return "UNSPECIFIED";
@@ -2168,7 +2188,7 @@ const Ja = (e) => {
2168
2188
  default:
2169
2189
  return e;
2170
2190
  }
2171
- }, Za = (e) => {
2191
+ }, eo = (e) => {
2172
2192
  switch (e) {
2173
2193
  case "Regular":
2174
2194
  return "esriGraphNamedObjectRegular";
@@ -2180,7 +2200,7 @@ const Ja = (e) => {
2180
2200
  return e;
2181
2201
  }
2182
2202
  };
2183
- function Ya(e) {
2203
+ function to(e) {
2184
2204
  switch (e) {
2185
2205
  case "esriGraphPropertyRegular":
2186
2206
  return "Regular";
@@ -2221,7 +2241,7 @@ function Ya(e) {
2221
2241
  function Y(e) {
2222
2242
  return e?.signal;
2223
2243
  }
2224
- async function Xa(e, t) {
2244
+ async function ro(e, t) {
2225
2245
  const r = await B("arcgis_knowledge_cypher_query_prompt");
2226
2246
  return t ? `${e} ${r}
2227
2247
 
@@ -2232,14 +2252,14 @@ Execution Error: ${t.executionError}
2232
2252
  Failed Query:
2233
2253
  ${t.failedGraphQuery}` : `${e} ${r}`;
2234
2254
  }
2235
- async function eo(e, t, r, a) {
2255
+ async function ao(e, t, r, a) {
2236
2256
  const { graphQuery: o, explanation: n } = await de(e, t, r, a);
2237
2257
  return { graphQuery: o, explanation: n };
2238
2258
  }
2239
2259
  async function de(e, t, r, a, o) {
2240
2260
  const n = {
2241
- message: await Xa(e, o),
2242
- context: new Ka(t)
2261
+ message: await ro(e, o),
2262
+ context: new Za(t)
2243
2263
  }, l = Y(a);
2244
2264
  await x({ text: "Attempting to generate a cypher query from your prompt..." }, a);
2245
2265
  const i = await me(`${r}/chat`, {
@@ -2257,13 +2277,13 @@ async function de(e, t, r, a, o) {
2257
2277
  });
2258
2278
  let c = !1;
2259
2279
  const u = Date.now();
2260
- let d = i.data.sequenceNumber, p = "", m = "", y = 1;
2280
+ let d = i.data.sequenceNumber, p = "", m = "", w = 1;
2261
2281
  for (; !c; ) {
2262
- await new Promise((h) => setTimeout(h, 1e3)), await x(
2263
- { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, y)}` },
2282
+ await new Promise((y) => setTimeout(y, 1e3)), await x(
2283
+ { text: `Periodically requesting status of job from ArcGIS AI Services${"...".substring(0, w)}` },
2264
2284
  a
2265
- ), y = y % 3 + 1;
2266
- const f = await me(`${r}/chat`, {
2285
+ ), w = w % 3 + 1;
2286
+ const h = await me(`${r}/chat`, {
2267
2287
  method: "post",
2268
2288
  body: JSON.stringify({
2269
2289
  conversationId: i.data.conversationId,
@@ -2276,57 +2296,57 @@ async function de(e, t, r, a, o) {
2276
2296
  },
2277
2297
  signal: l
2278
2298
  });
2279
- if (f.httpStatus !== 200)
2280
- throw new Error(`Graph query service polling returned an error: ${f.httpStatus}`, {
2281
- cause: f.data
2299
+ if (h.httpStatus !== 200)
2300
+ throw new Error(`Graph query service polling returned an error: ${h.httpStatus}`, {
2301
+ cause: h.data
2282
2302
  });
2283
- if (f.data.context?.kind) {
2284
- if (f.data.context.kind !== "GraphQueryGenerationResponse")
2285
- throw new Error(`Unexpected response from graph query service polling. Message: ${f.data.message}`, {
2286
- cause: f.data
2303
+ if (h.data.context?.kind) {
2304
+ if (h.data.context.kind !== "GraphQueryGenerationResponse")
2305
+ throw new Error(`Unexpected response from graph query service polling. Message: ${h.data.message}`, {
2306
+ cause: h.data
2287
2307
  });
2288
- p = f.data.context.graphQuery, m = f.data.message || "", c = !0;
2289
- } else if (!f.data.hasMore)
2308
+ p = h.data.context.graphQuery, m = h.data.message || "", c = !0;
2309
+ } else if (!h.data.hasMore)
2290
2310
  c = !0;
2291
2311
  else if (Date.now() - u > 6e4)
2292
2312
  throw new Error("Graph query service polling timed out after 1 minute.");
2293
- d = f.data.sequenceNumber;
2313
+ d = h.data.sequenceNumber;
2294
2314
  }
2295
2315
  return { graphQuery: p, explanation: m };
2296
2316
  }
2297
- function to(e, t) {
2298
- z(e, (r) => {
2317
+ function oo(e, t) {
2318
+ I(e, (r) => {
2299
2319
  t.set(`${r.typeName}__${r.id}`, {
2300
2320
  id: r.id,
2301
2321
  typeName: r.typeName
2302
2322
  });
2303
2323
  });
2304
2324
  }
2305
- function z(e, t) {
2325
+ function I(e, t) {
2306
2326
  if (!(!e || typeof e != "object")) {
2307
- if (ao(e))
2327
+ if (io(e))
2308
2328
  for (const r of e.path)
2309
- z(r, t);
2310
- else if (ro(e))
2329
+ I(r, t);
2330
+ else if (no(e))
2311
2331
  t(e);
2312
2332
  else if (Array.isArray(e))
2313
2333
  for (const r of e)
2314
- z(r, t);
2315
- else if (oo(e))
2334
+ I(r, t);
2335
+ else if (so(e))
2316
2336
  for (const r of Object.values(e.properties ?? {}))
2317
- z(r, t);
2337
+ I(r, t);
2318
2338
  }
2319
2339
  }
2320
- function ro(e) {
2340
+ function no(e) {
2321
2341
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : "id" in e && "typeName" in e;
2322
2342
  }
2323
- function ao(e) {
2343
+ function io(e) {
2324
2344
  return !e || typeof e != "object" || Array.isArray(e) ? !1 : e && "path" in e && Array.isArray(e.path);
2325
2345
  }
2326
- function oo(e) {
2346
+ function so(e) {
2327
2347
  return !e || typeof e != "object" || Array.isArray(e) || "id" in e ? !1 : "properties" in e && typeof e.properties == "object";
2328
2348
  }
2329
- function no(e, t) {
2349
+ function lo(e, t) {
2330
2350
  const r = [], a = [], o = [
2331
2351
  [t.dataModel.entityTypes, r],
2332
2352
  [t.dataModel.relationshipTypes, a]
@@ -2338,7 +2358,7 @@ function no(e, t) {
2338
2358
  }
2339
2359
  return { entityIds: r, relationshipIds: a };
2340
2360
  }
2341
- function io(e, t) {
2361
+ function co(e, t) {
2342
2362
  const r = { entityIds: new Array(), relationshipIds: new Array() }, a = [], n = e?.allLayers.find((c) => c.type === "knowledge-graph")?.inclusionModeDefinition;
2343
2363
  if (!n)
2344
2364
  return { allNamedTypesFullyDynamic: !0, bindParameters: r, nonDynamicTypes: a };
@@ -2363,7 +2383,7 @@ function io(e, t) {
2363
2383
  return { allNamedTypesFullyDynamic: i, bindParameters: r, nonDynamicTypes: a };
2364
2384
  }
2365
2385
  const D = 3;
2366
- function ke(e, t = 100) {
2386
+ function Ne(e, t = 100) {
2367
2387
  const r = {};
2368
2388
  for (const a of Object.entries(e.properties ?? {})) {
2369
2389
  const [o, n] = a;
@@ -2374,7 +2394,7 @@ function ke(e, t = 100) {
2374
2394
  function P(e) {
2375
2395
  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);
2376
2396
  }
2377
- const so = async ({
2397
+ const uo = async ({
2378
2398
  kg: e,
2379
2399
  queryParams: t,
2380
2400
  targetStructure: r,
@@ -2389,19 +2409,19 @@ const so = async ({
2389
2409
  };
2390
2410
  d && (d.aborted ? u.abort(d.reason) : d.addEventListener("abort", p, { once: !0 }));
2391
2411
  try {
2392
- const m = await yt(e, t, o);
2412
+ const m = await ft(e, t, o);
2393
2413
  i = m.resultHeader;
2394
- const y = m.resultRowsStream.getReader();
2395
- let f = 0;
2396
- const h = Date.now(), w = !1;
2414
+ const w = m.resultRowsStream.getReader();
2415
+ let h = 0;
2416
+ const y = Date.now(), g = !1;
2397
2417
  for (; ; ) {
2398
- const { done: b, value: v } = await y.read();
2418
+ const { done: b, value: v } = await w.read();
2399
2419
  if (b)
2400
2420
  break;
2401
- if (!w && l && Date.now() - h > l)
2421
+ if (!g && l && Date.now() - y > l)
2402
2422
  return u.abort(), { type: "timeout" };
2403
2423
  for (const S of v) {
2404
- if (f++, n && f > n)
2424
+ if (h++, n && h > n)
2405
2425
  return u.abort(), { type: "success", rowLimitReached: !0, resultHeader: i, processedResult: c };
2406
2426
  c = a(c, S);
2407
2427
  }
@@ -2413,7 +2433,7 @@ const so = async ({
2413
2433
  }
2414
2434
  return { type: "success", rowLimitReached: !1, resultHeader: i, processedResult: c };
2415
2435
  };
2416
- async function Ne({
2436
+ async function qe({
2417
2437
  prompt: e,
2418
2438
  bindParameters: t,
2419
2439
  kg: r,
@@ -2430,11 +2450,11 @@ async function Ne({
2430
2450
  let m;
2431
2451
  try {
2432
2452
  m = await de(e, r.dataModel, a, u, d);
2433
- } catch (h) {
2453
+ } catch (g) {
2434
2454
  return {
2435
2455
  type: "generation-error",
2436
- errorMessage: P(h),
2437
- error: h
2456
+ errorMessage: P(g),
2457
+ error: g
2438
2458
  };
2439
2459
  }
2440
2460
  await x(
@@ -2443,53 +2463,53 @@ async function Ne({
2443
2463
  },
2444
2464
  u
2445
2465
  );
2446
- const y = await so({
2466
+ const w = await po(m.graphQuery, t), h = await uo({
2447
2467
  kg: r,
2448
2468
  queryParams: new ve({
2449
2469
  openCypherQuery: m.graphQuery,
2450
- bindParameters: t
2470
+ bindParameters: w
2451
2471
  }),
2452
2472
  targetStructure: o,
2453
2473
  targetStructureReducer: n,
2454
2474
  requestOptions: l,
2455
2475
  queryRowLimit: i,
2456
2476
  queryTimeoutMs: c
2457
- }), f = y.type === "aborted" ? "Query execution was aborted." : y.type === "timeout" ? "Query execution timed out." : y.type === "error" ? `Query failed with error: ${y.errorMessage}` : "";
2458
- if (y.type === "success")
2477
+ }), y = h.type === "aborted" ? "Query execution was aborted." : h.type === "timeout" ? "Query execution timed out." : h.type === "error" ? `Query failed with error: ${h.errorMessage}` : "";
2478
+ if (h.type === "success")
2459
2479
  return {
2460
2480
  type: "success",
2461
2481
  graphQuery: m.graphQuery,
2462
2482
  explanation: m.explanation,
2463
- rowLimitReached: y.rowLimitReached,
2464
- resultHeader: y.resultHeader,
2465
- processedResult: y.processedResult
2483
+ rowLimitReached: h.rowLimitReached,
2484
+ resultHeader: h.resultHeader,
2485
+ processedResult: h.processedResult
2466
2486
  };
2467
- if (y.type === "aborted")
2487
+ if (h.type === "aborted")
2468
2488
  return {
2469
2489
  type: "aborted",
2470
- errorMessage: f,
2490
+ errorMessage: y,
2471
2491
  graphQuery: m.graphQuery,
2472
2492
  explanation: m.explanation
2473
2493
  };
2474
2494
  if (p >= D)
2475
- return y.type === "timeout" ? {
2495
+ return h.type === "timeout" ? {
2476
2496
  type: "timeout",
2477
- errorMessage: f,
2497
+ errorMessage: y,
2478
2498
  graphQuery: m.graphQuery,
2479
2499
  explanation: m.explanation
2480
2500
  } : {
2481
2501
  type: "execution-error",
2482
- errorMessage: f,
2483
- error: y.error,
2502
+ errorMessage: y,
2503
+ error: h.error,
2484
2504
  graphQuery: m.graphQuery,
2485
2505
  explanation: m.explanation
2486
2506
  };
2487
2507
  d = {
2488
2508
  failedGraphQuery: m.graphQuery,
2489
- executionError: f,
2509
+ executionError: y,
2490
2510
  attemptCount: p
2491
2511
  }, await x(
2492
- { text: `Attempt ${p} failed with error: ${f}. Retrying...` },
2512
+ { text: `Attempt ${p} failed with error: ${y}. Retrying...` },
2493
2513
  u
2494
2514
  );
2495
2515
  }
@@ -2497,7 +2517,17 @@ async function Ne({
2497
2517
  `Failed to execute generated cypher due to an unexpected error after ${D} attempts.`
2498
2518
  );
2499
2519
  }
2500
- const lo = async ({
2520
+ const po = async (e, t) => {
2521
+ if (!t)
2522
+ return {};
2523
+ const { bindParameters: r, parseErrors: a } = await bt(e);
2524
+ if (a)
2525
+ return t;
2526
+ const o = {};
2527
+ for (const n of r)
2528
+ n in t && (o[n] = t[n]);
2529
+ return o;
2530
+ }, mo = async ({
2501
2531
  kg: e,
2502
2532
  searchQuery: t,
2503
2533
  typeCategoryFilter: r,
@@ -2514,9 +2544,9 @@ const lo = async ({
2514
2544
  const d = c - l.length;
2515
2545
  if (d <= 0)
2516
2546
  break;
2517
- const y = (await ft(
2547
+ const w = (await gt(
2518
2548
  e,
2519
- new gt({
2549
+ new wt({
2520
2550
  searchQuery: t,
2521
2551
  typeCategoryFilter: u,
2522
2552
  namedTypesFilter: a ?? void 0,
@@ -2524,14 +2554,14 @@ const lo = async ({
2524
2554
  }),
2525
2555
  n
2526
2556
  )).resultRowsStream.getReader();
2527
- let f = !1;
2528
- for (; !f; ) {
2529
- const { done: h, value: w } = await y.read();
2530
- if (h) {
2531
- f = !0;
2557
+ let h = !1;
2558
+ for (; !h; ) {
2559
+ const { done: y, value: g } = await w.read();
2560
+ if (y) {
2561
+ h = !0;
2532
2562
  break;
2533
2563
  }
2534
- for (const b of w)
2564
+ for (const b of g)
2535
2565
  for (const v of b)
2536
2566
  l.push(v);
2537
2567
  }
@@ -2548,7 +2578,7 @@ const lo = async ({
2548
2578
  type: "success",
2549
2579
  results: l
2550
2580
  };
2551
- }, qe = "IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";
2581
+ }, ze = "IMPORTANT: The generated cypher query must return entire entities and relationships ONLY.";
2552
2582
  async function Ie({
2553
2583
  prompt: e,
2554
2584
  view: t,
@@ -2556,8 +2586,8 @@ async function Ie({
2556
2586
  includeReturnEntityAndRelationshipContext: a = !1
2557
2587
  }) {
2558
2588
  const o = [e];
2559
- if (a && o.push(qe), !q(t) && t.map) {
2560
- const d = await B("arcgis_knowledge_current_lc_context"), p = no(t.map, r);
2589
+ if (a && o.push(ze), !q(t) && t.map) {
2590
+ const d = await B("arcgis_knowledge_current_lc_context"), p = lo(t.map, r);
2561
2591
  return o.push(d), {
2562
2592
  enhancedPrompt: o.join(`
2563
2593
 
@@ -2566,7 +2596,7 @@ async function Ie({
2566
2596
  allNamedTypesFullyDynamic: !1
2567
2597
  };
2568
2598
  }
2569
- const n = t.map, { allNamedTypesFullyDynamic: l, bindParameters: i, nonDynamicTypes: c } = io(
2599
+ const n = t.map, { allNamedTypesFullyDynamic: l, bindParameters: i, nonDynamicTypes: c } = co(
2570
2600
  n,
2571
2601
  r
2572
2602
  );
@@ -2590,16 +2620,16 @@ async function Ie({
2590
2620
  allNamedTypesFullyDynamic: l
2591
2621
  };
2592
2622
  }
2593
- async function co(e, t, r, a, o, n) {
2594
- const { view: l } = o, i = await Ne({
2623
+ async function ho(e, t, r, a, o, n) {
2624
+ const { view: l } = o, i = await qe({
2595
2625
  prompt: e,
2596
2626
  bindParameters: t,
2597
2627
  kg: r,
2598
2628
  graphQueryServiceUrl: a,
2599
2629
  targetStructure: /* @__PURE__ */ new Map(),
2600
- targetStructureReducer: (m, y) => {
2601
- for (const f of y)
2602
- to(f, m);
2630
+ targetStructureReducer: (m, w) => {
2631
+ for (const h of w)
2632
+ oo(h, m);
2603
2633
  return m;
2604
2634
  },
2605
2635
  requestOptions: {
@@ -2619,14 +2649,14 @@ async function co(e, t, r, a, o, n) {
2619
2649
  },
2620
2650
  n
2621
2651
  ), !q(l) && l?.map ? (await l.map.addRecords(p), await Z(l), { generatedQuery: c, explanation: u, addedIdTypePairs: p }) : (await l?.map?.allLayers.find(
2622
- (y) => y.type === "knowledge-graph"
2652
+ (w) => w.type === "knowledge-graph"
2623
2653
  )?.addRecords(p), { generatedQuery: c, explanation: u, addedIdTypePairs: p });
2624
2654
  }
2625
- const W = "addRecords", uo = s.object({
2655
+ const W = "addRecords", yo = s.object({
2626
2656
  prompt: s.string().describe(
2627
2657
  "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."
2628
2658
  )
2629
- }), po = async ({ prompt: e }, t) => {
2659
+ }), fo = async ({ prompt: e }, t) => {
2630
2660
  const { knowledgeGraph: r } = await M(t), a = O(t), { view: o } = a, l = k.getDefault().helperServices, {
2631
2661
  enhancedPrompt: i,
2632
2662
  bindParameters: c,
@@ -2649,7 +2679,7 @@ const W = "addRecords", uo = s.object({
2649
2679
  }
2650
2680
  };
2651
2681
  try {
2652
- const { generatedQuery: d, explanation: p, addedIdTypePairs: m } = await co(
2682
+ const { generatedQuery: d, explanation: p, addedIdTypePairs: m } = await ho(
2653
2683
  i,
2654
2684
  c,
2655
2685
  r,
@@ -2678,7 +2708,7 @@ Number of records added: ${m.length}`,
2678
2708
  error: d
2679
2709
  };
2680
2710
  }
2681
- }, oi = g(po, {
2711
+ }, ci = f(fo, {
2682
2712
  name: W,
2683
2713
  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.
2684
2714
 
@@ -2691,12 +2721,12 @@ Number of records added: ${m.length}`,
2691
2721
  - "connect company x and company y"
2692
2722
  - "connect all buildings on the link chart"
2693
2723
  `,
2694
- schema: uo
2724
+ schema: yo
2695
2725
  });
2696
- async function mo(e, t) {
2726
+ async function go(e, t) {
2697
2727
  return await t.map?.applyLayout(e), await Z(t), { appliedLayout: e };
2698
2728
  }
2699
- const re = "applyLayout", ho = s.object({
2729
+ const re = "applyLayout", wo = s.object({
2700
2730
  layout: s.enum([
2701
2731
  "organic-standard",
2702
2732
  "organic-community",
@@ -2710,7 +2740,7 @@ const re = "applyLayout", ho = s.object({
2710
2740
  ]).describe(
2711
2741
  "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"
2712
2742
  )
2713
- }), yo = async ({ layout: e }, t) => {
2743
+ }), bo = async ({ layout: e }, t) => {
2714
2744
  const { view: r } = O(t);
2715
2745
  if (q(r))
2716
2746
  return {
@@ -2720,7 +2750,7 @@ const re = "applyLayout", ho = s.object({
2720
2750
  error: new Error()
2721
2751
  };
2722
2752
  {
2723
- const { appliedLayout: a } = await mo(e, r);
2753
+ const { appliedLayout: a } = await go(e, r);
2724
2754
  return {
2725
2755
  toolName: re,
2726
2756
  status: "success",
@@ -2730,17 +2760,17 @@ const re = "applyLayout", ho = s.object({
2730
2760
  }
2731
2761
  };
2732
2762
  }
2733
- }, ni = g(yo, {
2763
+ }, ui = f(bo, {
2734
2764
  name: re,
2735
2765
  description: "Apply a diagram layout to the link chart",
2736
- schema: ho
2766
+ schema: wo
2737
2767
  });
2738
- async function fo(e, t) {
2768
+ async function To(e, t) {
2739
2769
  return t.map?.changeNonspatialDataDisplay(e), await Z(t), { appliedNonspatialDataDisplayMode: e };
2740
2770
  }
2741
- const ae = "changeNonspatialVisibility", go = s.object({
2771
+ const ae = "changeNonspatialVisibility", So = s.object({
2742
2772
  setting: s.enum(["hidden", "visible"]).describe("The setting of nonspatial visibility")
2743
- }), wo = async ({ setting: e }, t) => {
2773
+ }), vo = async ({ setting: e }, t) => {
2744
2774
  const { view: r } = O(t);
2745
2775
  if (q(r))
2746
2776
  return {
@@ -2750,7 +2780,7 @@ const ae = "changeNonspatialVisibility", go = s.object({
2750
2780
  error: new Error()
2751
2781
  };
2752
2782
  {
2753
- const { appliedNonspatialDataDisplayMode: a } = await fo(e, r);
2783
+ const { appliedNonspatialDataDisplayMode: a } = await To(e, r);
2754
2784
  return {
2755
2785
  toolName: ae,
2756
2786
  status: "success",
@@ -2760,12 +2790,12 @@ const ae = "changeNonspatialVisibility", go = s.object({
2760
2790
  }
2761
2791
  };
2762
2792
  }
2763
- }, ii = g(wo, {
2793
+ }, di = f(vo, {
2764
2794
  name: ae,
2765
2795
  description: "Change whether or not nonspatial data is visible in the link chart. The value must be either 'hidden' or 'visible'.",
2766
- schema: go
2796
+ schema: So
2767
2797
  });
2768
- async function bo(e, t, r, a, o) {
2798
+ async function xo(e, t, r, a, o) {
2769
2799
  let n, l = "";
2770
2800
  for (let i = 1; i <= D; i++) {
2771
2801
  const { graphQuery: c, explanation: u } = await de(
@@ -2777,7 +2807,7 @@ async function bo(e, t, r, a, o) {
2777
2807
  );
2778
2808
  try {
2779
2809
  await x({ text: `Attempting to create link chart from derived query: ${c}` }, o);
2780
- const d = await ht.fromCypherQuery(
2810
+ const d = await yt.fromCypherQuery(
2781
2811
  t,
2782
2812
  new ve({
2783
2813
  openCypherQuery: c
@@ -2785,7 +2815,7 @@ async function bo(e, t, r, a, o) {
2785
2815
  );
2786
2816
  await x({ text: "Link chart created successfully, loading..." }, o), await d.load();
2787
2817
  const p = a.map;
2788
- return a.map = d, await a.when(), await Ae.whenOnce(() => !a.updating), d.entityCount === 0 && d.relationshipCount === 0 ? (a.map === d && (a.map = p), d.destroy(), {
2818
+ return a.map = d, await a.when(), await Le.whenOnce(() => !a.updating), d.entityCount === 0 && d.relationshipCount === 0 ? (a.map === d && (a.map = p), d.destroy(), {
2789
2819
  type: "error",
2790
2820
  errorMessage: `Query returned no results. Cypher Query used to create the link chart:
2791
2821
  ${c}
@@ -2817,11 +2847,11 @@ Explanation: ${u}`
2817
2847
  errorMessage: `Failed to create link chart after ${D} attempts. Last error: ${l}`
2818
2848
  };
2819
2849
  }
2820
- const V = "createLinkChart", To = s.object({
2850
+ const V = "createLinkChart", Ro = s.object({
2821
2851
  prompt: s.string().describe(
2822
2852
  "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."
2823
2853
  )
2824
- }), So = async ({ prompt: e }, t) => {
2854
+ }), $o = async ({ prompt: e }, t) => {
2825
2855
  const { knowledgeGraph: r } = await M(t), { view: a } = O(t);
2826
2856
  if (q(a))
2827
2857
  return {
@@ -2831,10 +2861,10 @@ const V = "createLinkChart", To = s.object({
2831
2861
  error: new Error()
2832
2862
  };
2833
2863
  {
2834
- const n = k.getDefault().helperServices, l = await bo(
2864
+ const n = k.getDefault().helperServices, l = await xo(
2835
2865
  `${e}
2836
2866
 
2837
- ${qe}`,
2867
+ ${ze}`,
2838
2868
  r,
2839
2869
  `${n.aiAssistantServices.url}${n.aiAssistantServices.graphQueryAssistant}`,
2840
2870
  a,
@@ -2861,15 +2891,15 @@ Explanation: ${c}`,
2861
2891
  }
2862
2892
  };
2863
2893
  }
2864
- }, si = g(So, {
2894
+ }, pi = f($o, {
2865
2895
  name: V,
2866
2896
  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'.",
2867
- schema: To
2868
- }), oe = "queryGraphData", vo = s.object({
2897
+ schema: Ro
2898
+ }), oe = "queryGraphData", Co = s.object({
2869
2899
  prompt: s.string().describe(
2870
2900
  "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."
2871
2901
  )
2872
- }), xo = async ({ prompt: e }, t) => {
2902
+ }), Eo = async ({ prompt: e }, t) => {
2873
2903
  const { knowledgeGraph: r } = await M(t), o = k.getDefault().helperServices;
2874
2904
  let n = e, l = null, i = null;
2875
2905
  try {
@@ -2882,13 +2912,13 @@ Explanation: ${c}`,
2882
2912
  knowledgeGraph: r,
2883
2913
  includeReturnEntityAndRelationshipContext: !1
2884
2914
  }));
2885
- const c = await Ne({
2915
+ const c = await qe({
2886
2916
  prompt: n,
2887
2917
  bindParameters: l,
2888
2918
  kg: r,
2889
2919
  graphQueryServiceUrl: `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
2890
2920
  targetStructure: new Array(),
2891
- targetStructureReducer: (w, b) => (w.push(b), w),
2921
+ targetStructureReducer: (g, b) => (g.push(b), g),
2892
2922
  requestOptions: {
2893
2923
  signal: Y(t),
2894
2924
  timeout: t?.timeout
@@ -2896,22 +2926,22 @@ Explanation: ${c}`,
2896
2926
  config: t
2897
2927
  });
2898
2928
  if (c.type !== "success") {
2899
- const w = c.type === "generation-error" ? c.errorMessage : `${c.errorMessage} Cypher query: ${c.graphQuery}`;
2929
+ const g = c.type === "generation-error" ? c.errorMessage : `${c.errorMessage} Cypher query: ${c.graphQuery}`;
2900
2930
  return {
2901
2931
  toolName: oe,
2902
2932
  status: "error",
2903
- errorMessage: `Failed to query the knowledge graph. ${w}`,
2933
+ errorMessage: `Failed to query the knowledge graph. ${g}`,
2904
2934
  error: "error" in c ? c.error : null
2905
2935
  };
2906
2936
  }
2907
- const { graphQuery: u, explanation: d, processedResult: p, resultHeader: m } = c, y = m.headerKeys;
2908
- for (const w of p)
2909
- for (const b of w)
2910
- z(
2937
+ const { graphQuery: u, explanation: d, processedResult: p, resultHeader: m } = c, w = m.headerKeys;
2938
+ for (const g of p)
2939
+ for (const b of g)
2940
+ I(
2911
2941
  b,
2912
- (v) => ke(v)
2942
+ (v) => Ne(v)
2913
2943
  );
2914
- const f = 50, h = p.slice(0, f).map((w) => JSON.stringify(w));
2944
+ const h = 50, y = p.slice(0, h).map((g) => JSON.stringify(g));
2915
2945
  return {
2916
2946
  toolName: oe,
2917
2947
  status: "success",
@@ -2922,15 +2952,15 @@ ${u}
2922
2952
  \`\`\`
2923
2953
 
2924
2954
  Query Results:
2925
- ${h.length} result(s) found.
2955
+ ${y.length} result(s) found.
2926
2956
 
2927
- Column Headers: ${y.join(", ")}
2957
+ Column Headers: ${w.join(", ")}
2928
2958
 
2929
- ${h.length > f ? `Showing top ${f} results:
2959
+ ${y.length > h ? `Showing top ${h} results:
2930
2960
 
2931
2961
  ` : `Results:
2932
2962
 
2933
- `}${h.join(`
2963
+ `}${y.join(`
2934
2964
  `)}
2935
2965
  `,
2936
2966
  details: {
@@ -2940,16 +2970,16 @@ ${h.length > f ? `Showing top ${f} results:
2940
2970
  queryResults: p
2941
2971
  }
2942
2972
  };
2943
- }, li = g(xo, {
2973
+ }, mi = f(Eo, {
2944
2974
  name: oe,
2945
2975
  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?'.",
2946
- schema: vo
2947
- }), ne = "generateCypher", Ro = s.object({
2976
+ schema: Co
2977
+ }), ne = "generateCypher", Fo = s.object({
2948
2978
  prompt: s.string().describe("The user's inquiry into the knowledge graph that needs to be translated into a cypher query.")
2949
- }), $o = async ({ prompt: e }, t) => {
2979
+ }), ko = async ({ prompt: e }, t) => {
2950
2980
  const { knowledgeGraph: r } = await M(t), o = k.getDefault().helperServices;
2951
2981
  try {
2952
- const { graphQuery: n, explanation: l } = await eo(
2982
+ const { graphQuery: n, explanation: l } = await ao(
2953
2983
  e,
2954
2984
  r.dataModel,
2955
2985
  `${o.aiAssistantServices.url}${o.aiAssistantServices.graphQueryAssistant}`,
@@ -2976,11 +3006,11 @@ Explanation: ${l}`,
2976
3006
  error: n
2977
3007
  };
2978
3008
  }
2979
- }, ci = g($o, {
3009
+ }, hi = f(ko, {
2980
3010
  name: ne,
2981
3011
  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.",
2982
- schema: Ro
2983
- }), Co = (e) => {
3012
+ schema: Fo
3013
+ }), No = (e) => {
2984
3014
  const t = e.dataModel, r = /* @__PURE__ */ new Map();
2985
3015
  for (const i of t.searchIndexes)
2986
3016
  if (i.supportedCategory !== "esriTypeMetaEntityProvenance")
@@ -2997,10 +3027,10 @@ ${o.map(({ name: i }) => `${i}: [${Array.from(r.get(i) ?? []).join(", ")}]`).joi
2997
3027
 
2998
3028
  ${l}`;
2999
3029
  };
3000
- async function Eo(e, t, r) {
3030
+ async function qo(e, t, r) {
3001
3031
  const a = await B("arcgis_knowledge_lucene_generation_prompt"), o = {
3002
3032
  inquiry: e,
3003
- dataModelForSearch: Co(t)
3033
+ dataModelForSearch: No(t)
3004
3034
  }, 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(
3005
3035
  "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."
3006
3036
  ), i = s.array(
@@ -3015,23 +3045,23 @@ async function Eo(e, t, r) {
3015
3045
  typeCategoryFilter: n,
3016
3046
  resultLimit: l
3017
3047
  });
3018
- return await Pe({
3048
+ return await Ae({
3019
3049
  promptText: a,
3020
3050
  inputVariables: o,
3021
3051
  schema: c,
3022
3052
  config: r
3023
3053
  });
3024
3054
  }
3025
- const ie = "searchGraphData", Fo = s.object({
3055
+ const ie = "searchGraphData", zo = s.object({
3026
3056
  prompt: s.string().describe(
3027
3057
  "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."
3028
3058
  )
3029
- }), ko = async ({ prompt: e }, t) => {
3059
+ }), Io = async ({ prompt: e }, t) => {
3030
3060
  const { knowledgeGraph: r } = await M(t);
3031
3061
  await x({ text: "Generating search query for the user inquiry" }, t);
3032
- const a = await Eo(e, r, t);
3062
+ const a = await qo(e, r, t);
3033
3063
  await x({ text: "Executing graph search with generated search query" }, t);
3034
- const o = await lo({
3064
+ const o = await mo({
3035
3065
  kg: r,
3036
3066
  searchQuery: a.query,
3037
3067
  typeCategoryFilter: a.typeCategoryFilter,
@@ -3050,9 +3080,9 @@ const ie = "searchGraphData", Fo = s.object({
3050
3080
  error: "error" in o ? o.error : null
3051
3081
  };
3052
3082
  for (const i of o.results)
3053
- z(
3083
+ I(
3054
3084
  i,
3055
- (c) => ke(c)
3085
+ (c) => Ne(c)
3056
3086
  );
3057
3087
  const n = 10, l = o.results.slice(0, n);
3058
3088
  return {
@@ -3075,7 +3105,7 @@ const ie = "searchGraphData", Fo = s.object({
3075
3105
  searchResults: o.results
3076
3106
  }
3077
3107
  };
3078
- }, ui = g(ko, {
3108
+ }, yi = f(Io, {
3079
3109
  name: ie,
3080
3110
  description: `
3081
3111
  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.
@@ -3087,53 +3117,53 @@ const ie = "searchGraphData", Fo = s.object({
3087
3117
  - "Find all reports authored by someone with the title of 'Researcher'"
3088
3118
  - "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".
3089
3119
  - "Search for all john smiths and show their global ids`,
3090
- schema: Fo
3120
+ schema: zo
3091
3121
  });
3092
3122
  export {
3093
- Gn as A,
3094
- On as B,
3095
- Mn as C,
3096
- Qn as D,
3097
- _n as E,
3098
- Wn as F,
3123
+ Wn as A,
3124
+ Vn as B,
3125
+ Bn as C,
3126
+ Un as D,
3127
+ Kn as E,
3128
+ Hn as F,
3099
3129
  ue as G,
3100
- ei as H,
3101
- Vn as I,
3102
- Bn as J,
3103
- Un as K,
3104
- Kn as L,
3105
- Hn as M,
3106
- En as N,
3107
- Zn as O,
3108
- Yn as P,
3109
- Wa as Q,
3130
+ ni as H,
3131
+ Jn as I,
3132
+ Zn as J,
3133
+ Yn as K,
3134
+ Xn as L,
3135
+ ei as M,
3136
+ zn as N,
3137
+ ri as O,
3138
+ ai as P,
3139
+ Ua as Q,
3110
3140
  N as R,
3111
- Jn as S,
3112
- Xn as T,
3113
- ni as a,
3114
- ci as b,
3115
- ii as c,
3116
- si as d,
3117
- oi as e,
3141
+ ti as S,
3142
+ oi as T,
3143
+ ui as a,
3144
+ hi as b,
3145
+ di as c,
3146
+ pi as d,
3147
+ ci as e,
3118
3148
  xe as f,
3119
3149
  B as g,
3120
- ai as h,
3150
+ li as h,
3121
3151
  M as i,
3122
- ri as j,
3123
- Fn as k,
3124
- ti as l,
3125
- kn as m,
3126
- Nn as n,
3127
- qn as o,
3128
- In as p,
3129
- li as q,
3130
- Ln as r,
3131
- ui as s,
3132
- Bt as t,
3133
- zn as u,
3134
- Dn as v,
3135
- Pn as w,
3136
- An as x,
3152
+ si as j,
3153
+ In as k,
3154
+ ii as l,
3155
+ Dn as m,
3156
+ Pn as n,
3157
+ An as o,
3158
+ Ln as p,
3159
+ mi as q,
3160
+ Qn as r,
3161
+ yi as s,
3162
+ Kt as t,
3163
+ jn as u,
3164
+ Gn as v,
3165
+ On as w,
3166
+ Mn as x,
3137
3167
  C as y,
3138
- jn as z
3168
+ _n as z
3139
3169
  };