@arcgis/ai-components 5.2.0-next.71 → 5.2.0-next.73
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.
- package/LICENSE.md +4 -2
- package/dist/agent-utils/LLMAgent.d.ts +5 -2
- package/dist/agent-utils/LLMAgent.js +1 -1
- package/dist/agent-utils/types.d.ts +1 -1
- package/dist/agentic-workflow/AgenticWorkflowRuntime.d.ts +24 -0
- package/dist/agentic-workflow/Edge.d.ts +16 -0
- package/dist/agentic-workflow/WebAgent.d.ts +39 -0
- package/dist/agentic-workflow/jsonTypes.d.ts +193 -0
- package/dist/agentic-workflow/nodes/AgentNode.d.ts +28 -0
- package/dist/agentic-workflow/nodes/BaseNode.d.ts +35 -0
- package/dist/agentic-workflow/nodes/EndMessageNode.d.ts +25 -0
- package/dist/agentic-workflow/nodes/StartNode.d.ts +21 -0
- package/dist/agentic-workflow/nodes/support/Prompt.d.ts +20 -0
- package/dist/agentic-workflow/nodes/tools/ArcgisTool.d.ts +21 -0
- package/dist/agentic-workflow/types.d.ts +29 -0
- package/dist/cdn/2EJROB32.js +2 -0
- package/dist/cdn/34O57OGV.js +2 -0
- package/dist/cdn/3LXXSMA5.js +2 -0
- package/dist/cdn/3MJQA533.js +2 -0
- package/dist/cdn/3U476GCP.js +5 -0
- package/dist/cdn/3XXZUQMQ.js +2 -0
- package/dist/cdn/4YDXYW4J.js +2 -0
- package/dist/cdn/4ZUUS4DH.js +2 -0
- package/dist/cdn/527C4GD2.js +36 -0
- package/dist/cdn/5RZGG4F2.js +2 -0
- package/dist/cdn/5SF6DEMO.js +2 -0
- package/dist/cdn/5Y6TQAJN.js +2 -0
- package/dist/cdn/65IWA2PM.js +2 -0
- package/dist/cdn/{MW5S2XCB.js → 67YCNNCN.js} +2 -2
- package/dist/cdn/6FKLWNGA.js +2 -0
- package/dist/cdn/6QJFOL6M.js +2 -0
- package/dist/cdn/6RDKDLSX.js +2 -0
- package/dist/cdn/6SGNSDLY.js +2 -0
- package/dist/cdn/7747YL7V.js +2 -0
- package/dist/cdn/7TO56JHS.js +2 -0
- package/dist/cdn/ABXLPDEK.js +2 -0
- package/dist/cdn/BBJDW6GC.js +2 -0
- package/dist/cdn/{PUFTYLJ2.js → C4FKFOU4.js} +4 -4
- package/dist/cdn/CCC6LBMY.js +2 -0
- package/dist/cdn/CGVVL52C.js +2 -0
- package/dist/cdn/DBHLKLKM.js +2 -0
- package/dist/cdn/DKLK4EUE.js +2 -0
- package/dist/cdn/E25RINU2.js +2 -0
- package/dist/cdn/E62P76TP.js +2 -0
- package/dist/cdn/E7JLG2A2.js +2 -0
- package/dist/cdn/{TFT6HK3O.js → E7KEOJZG.js} +1 -1
- package/dist/cdn/FDOMMK2M.js +2 -0
- package/dist/cdn/FSMHR7GK.js +2 -0
- package/dist/cdn/GG3AESSV.js +2 -0
- package/dist/cdn/H6JSNAT4.js +2 -0
- package/dist/cdn/HNMFFLSY.js +2 -0
- package/dist/cdn/HO2YDJI2.js +6 -0
- package/dist/cdn/{KQHLOYKL.js → I4L45WQS.js} +1 -1
- package/dist/cdn/ITBQGOMF.js +11 -0
- package/dist/cdn/JH6EAWB2.js +2 -0
- package/dist/cdn/JON2JHS2.js +2 -0
- package/dist/cdn/JWPB3XZM.js +2 -0
- package/dist/cdn/JXB4TNSG.js +2 -0
- package/dist/cdn/JYVBCHR6.js +6 -0
- package/dist/cdn/KRN6AFNB.js +18 -0
- package/dist/cdn/KZACIY2W.js +2 -0
- package/dist/cdn/MKJS7QYQ.js +2 -0
- package/dist/cdn/N735LT4S.js +2 -0
- package/dist/cdn/NP7DG7LQ.js +2 -0
- package/dist/cdn/NTZAOJH5.js +2 -0
- package/dist/cdn/{CXW5URTF.js → OHMNQ3RU.js} +5 -5
- package/dist/cdn/ONQ6JSBJ.js +2 -0
- package/dist/cdn/PAUIFUMO.js +2 -0
- package/dist/cdn/QNNGPA3Q.js +2 -0
- package/dist/cdn/RATZTLNX.js +2 -0
- package/dist/cdn/RU5DVLYG.js +156 -0
- package/dist/cdn/{YHQJ66WJ.js → S3XUYAUX.js} +1 -1
- package/dist/cdn/S6ZAQRC6.js +2 -0
- package/dist/cdn/SABZC4D4.js +2 -0
- package/dist/cdn/TYL5G7KR.js +2 -0
- package/dist/cdn/{XETNZW4D.js → UAZLKUFN.js} +1 -1
- package/dist/cdn/UZL6UVE4.js +2 -0
- package/dist/cdn/VBZ5XGAM.js +2 -0
- package/dist/cdn/VXBUMZYR.js +2 -0
- package/dist/cdn/W5FLNFSN.js +2 -0
- package/dist/cdn/W5J4Q3RO.js +14 -0
- package/dist/cdn/WQKNV6KK.js +2 -0
- package/dist/cdn/{ICYUPLZM.js → WZFC5HUX.js} +1 -1
- package/dist/cdn/XGBEHER5.js +2 -0
- package/dist/cdn/XPTCV6YV.js +2 -0
- package/dist/cdn/Y5UFOH54.js +2 -0
- package/dist/cdn/YGCTAIBS.js +2 -0
- package/dist/cdn/{SXHH575T.js → ZJEWP2ND.js} +20 -24
- package/dist/cdn/agent-utils/index.js +1 -1
- package/dist/cdn/agent-utils/middlewares/humanInTheLoop.js +1 -1
- package/dist/cdn/agent-utils/middlewares/middleware.js +1 -1
- package/dist/cdn/agent-utils/middlewares/trace.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/adapter.js +939 -1950
- package/dist/chunks/adapter10.js +21 -0
- package/dist/chunks/adapter11.js +30 -0
- package/dist/chunks/adapter12.js +22 -0
- package/dist/chunks/adapter13.js +22 -0
- package/dist/chunks/adapter14.js +109 -0
- package/dist/chunks/adapter15.js +40 -0
- package/dist/chunks/adapter16.js +154 -0
- package/dist/chunks/adapter17.js +141 -0
- package/dist/chunks/adapter18.js +127 -0
- package/dist/chunks/adapter2.js +52 -0
- package/dist/chunks/adapter3.js +30 -0
- package/dist/chunks/adapter4.js +50 -0
- package/dist/chunks/adapter5.js +27 -0
- package/dist/chunks/adapter6.js +24 -0
- package/dist/chunks/adapter7.js +26 -0
- package/dist/chunks/adapter8.js +21 -0
- package/dist/chunks/adapter9.js +42 -0
- package/dist/chunks/arcgisKnowledgeGraph.js +5 -5
- package/dist/chunks/baseAgentState.js +56 -0
- package/dist/chunks/dataExplorationGraph.js +34 -31
- package/dist/chunks/fetchAgentContext.js +13 -0
- package/dist/chunks/fetchService.js +10 -0
- package/dist/chunks/formatFeatureAttributes.js +132 -0
- package/dist/chunks/generateLayerDescriptions.js +189 -235
- package/dist/chunks/helpGraph.js +11 -9
- package/dist/chunks/layerStylingGraph.js +22 -21
- package/dist/chunks/mergeWhereClauses.js +15 -0
- package/dist/chunks/navigationGraph.js +81 -70
- package/dist/chunks/orchestrator.js +1 -1
- package/dist/chunks/state.js +20 -26
- package/dist/chunks/types.js +59 -0
- package/dist/chunks/utils2.js +3 -3
- package/dist/components/arcgis-assistant-agent/customElement.d.ts +13 -1
- package/dist/components/arcgis-assistant-agent/customElement.js +636 -10
- package/dist/components/arcgis-assistant-data-exploration-agent/customElement.js +15 -5
- package/dist/components/arcgis-assistant-help-agent/customElement.js +21 -5
- package/dist/components/arcgis-assistant-knowledge-agent/customElement.js +39 -22
- package/dist/components/arcgis-assistant-layer-styling-agent/customElement.js +22 -5
- package/dist/components/arcgis-assistant-navigation-agent/customElement.js +13 -5
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/vscode.html-custom-data.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/dist/loader.js +1 -1
- package/dist/types/lumina.d.ts +1 -1
- package/dist/types/preact.d.ts +1 -1
- package/dist/types/react.d.ts +1 -1
- package/dist/types/stencil.d.ts +1 -1
- package/dist/utils/index.js +26 -25
- package/package.json +4 -4
- package/dist/cdn/3DJDRAGV.js +0 -2
- package/dist/cdn/4CEMUECT.js +0 -2
- package/dist/cdn/4PCAK3ET.js +0 -2
- package/dist/cdn/57OMVTIU.js +0 -2
- package/dist/cdn/6U7TEAAJ.js +0 -2
- package/dist/cdn/BE7ZN5FZ.js +0 -2
- package/dist/cdn/BNSJO6X2.js +0 -2
- package/dist/cdn/CMDRED5H.js +0 -2
- package/dist/cdn/DTIVDIDY.js +0 -2
- package/dist/cdn/E5ZKBC24.js +0 -36
- package/dist/cdn/GP6NDTUE.js +0 -18
- package/dist/cdn/HBLRVXEB.js +0 -2
- package/dist/cdn/HQXPPYMD.js +0 -2
- package/dist/cdn/IEHPNCTL.js +0 -2
- package/dist/cdn/LHLO6PTD.js +0 -2
- package/dist/cdn/OWXCOUIQ.js +0 -2
- package/dist/cdn/PVE7Q43N.js +0 -2
- package/dist/cdn/ST5FQYT7.js +0 -180
- package/dist/cdn/WUNCZOGU.js +0 -2
- package/dist/cdn/WVPU4QOO.js +0 -2
- package/dist/cdn/WXWO5D3W.js +0 -2
- package/dist/cdn/XCRR2EEG.js +0 -6
- package/dist/cdn/ZS6SXJP2.js +0 -2
|
@@ -1,28 +1,31 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import { StateGraph as I, START as
|
|
3
|
-
import { g as T,
|
|
2
|
+
import { StateGraph as I, START as V, END as v } from "@langchain/langgraph/web";
|
|
3
|
+
import { g as T, y as R, t as C, z as k, r as D, D as N, A as z } from "./adapter.js";
|
|
4
4
|
import "@arcgis/core/identity/IdentityManager.js";
|
|
5
5
|
import "@arcgis/core/portal/Portal.js";
|
|
6
6
|
import "@arcgis/core/request.js";
|
|
7
7
|
import "@arcgis/toolkit/string";
|
|
8
|
-
import { h as
|
|
9
|
-
import { AIMessage as
|
|
8
|
+
import { h as b, e as P } from "./generateLayerDescriptions.js";
|
|
9
|
+
import { AIMessage as Q } from "@langchain/core/messages";
|
|
10
10
|
import { s as n } from "./index.js";
|
|
11
11
|
import "@langchain/openai";
|
|
12
12
|
import "@arcgis/core/config.js";
|
|
13
13
|
import "@arcgis/core/core/reactiveUtils.js";
|
|
14
14
|
import "@arcgis/core/layers/FeatureLayer.js";
|
|
15
15
|
import "@langchain/core/prompts";
|
|
16
|
-
import { h as
|
|
17
|
-
import {
|
|
18
|
-
import
|
|
19
|
-
import
|
|
16
|
+
import { h as A } from "./toolCallResponse.js";
|
|
17
|
+
import { b as _ } from "./formatFeatureAttributes.js";
|
|
18
|
+
import { ToolNode as O } from "@langchain/langgraph/prebuilt";
|
|
19
|
+
import j from "@arcgis/core/smartMapping/statistics/summaryStatistics.js";
|
|
20
|
+
import G from "@arcgis/core/smartMapping/statistics/uniqueValues.js";
|
|
21
|
+
import { f as U } from "./fetchAgentContext.js";
|
|
22
|
+
import { f } from "./fetchService.js";
|
|
20
23
|
const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e), t), B = async (t, e) => {
|
|
21
24
|
await n({ text: "Requesting LLM for layer filter results" }, e);
|
|
22
25
|
const d = await T("data_explore_filter_prompt");
|
|
23
26
|
if (!e?.configurable)
|
|
24
27
|
throw new Error("config.configurable is required for layer filter tools");
|
|
25
|
-
const { userTimezone: l, userTimezoneOffset: s } =
|
|
28
|
+
const { userTimezone: l, userTimezoneOffset: s } = _(), r = {
|
|
26
29
|
layerFieldInfo: t.layerFieldInfo,
|
|
27
30
|
userTimezone: l,
|
|
28
31
|
userTimezoneOffset: s,
|
|
@@ -30,13 +33,13 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
|
|
|
30
33
|
assignedTask: t.agentExecutionContext.assignedTask,
|
|
31
34
|
userRequest: t.agentExecutionContext.userRequest,
|
|
32
35
|
priorSteps: t.agentExecutionContext.priorSteps
|
|
33
|
-
}, o = await
|
|
36
|
+
}, o = await b({
|
|
34
37
|
promptText: d,
|
|
35
38
|
modelTier: "advanced",
|
|
36
39
|
config: e,
|
|
37
40
|
messages: t.dataExplorationMessages,
|
|
38
41
|
inputVariables: r,
|
|
39
|
-
tools:
|
|
42
|
+
tools: R
|
|
40
43
|
}), i = [...t.dataExplorationMessages, o];
|
|
41
44
|
if (!((o.tool_calls?.length ?? 0) > 0))
|
|
42
45
|
return await n({ text: "LLM determined no filter changes needed" }, e), {
|
|
@@ -45,13 +48,13 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
|
|
|
45
48
|
// Don't overwrite outputMessage if query already set it
|
|
46
49
|
};
|
|
47
50
|
const m = i, g = o.content.toString();
|
|
48
|
-
return await
|
|
51
|
+
return await A(o, e), { ...t, dataExplorationMessages: m, outputMessage: g };
|
|
49
52
|
}, H = async (t, e) => {
|
|
50
53
|
await n({ text: "Requesting LLM for layer query results" }, e);
|
|
51
54
|
const d = await T("data_explore_query_prompt");
|
|
52
55
|
if (!e?.configurable)
|
|
53
56
|
throw new Error("config.configurable is required for layer query tools");
|
|
54
|
-
const { userTimezone: l, userTimezoneOffset: s } =
|
|
57
|
+
const { userTimezone: l, userTimezoneOffset: s } = _(), r = t.agentExecutionContext.sharedState, o = r.lastNavigatedFeatures?.value, i = r.lastResolvedLocation?.value;
|
|
55
58
|
let c = "none";
|
|
56
59
|
if (o != null)
|
|
57
60
|
try {
|
|
@@ -78,22 +81,22 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
|
|
|
78
81
|
priorSteps: t.agentExecutionContext.priorSteps,
|
|
79
82
|
lastNavigatedFeatures: c,
|
|
80
83
|
lastResolvedLocation: m
|
|
81
|
-
}, y = await
|
|
84
|
+
}, y = await b({
|
|
82
85
|
promptText: d,
|
|
83
86
|
modelTier: "advanced",
|
|
84
87
|
config: e,
|
|
85
88
|
messages: t.dataExplorationMessages,
|
|
86
89
|
inputVariables: g,
|
|
87
|
-
tools:
|
|
90
|
+
tools: k
|
|
88
91
|
}), h = (y.tool_calls?.length ?? 0) > 0, p = y.content.toString();
|
|
89
|
-
return await
|
|
92
|
+
return await A(y, e), {
|
|
90
93
|
...t,
|
|
91
94
|
dataExplorationMessages: [...t.dataExplorationMessages, y],
|
|
92
95
|
// Only emit output here when no tools are being called.
|
|
93
96
|
// For tool-calling flows, downstream summarizer nodes provide the final user-facing message.
|
|
94
97
|
...h ? {} : { outputMessage: p },
|
|
95
98
|
status: "success",
|
|
96
|
-
summary: p && !h ?
|
|
99
|
+
summary: p && !h ? C(p) : "Query planning completed."
|
|
97
100
|
};
|
|
98
101
|
}, J = async (t, e) => {
|
|
99
102
|
try {
|
|
@@ -103,20 +106,20 @@ const W = async (t, e) => (await n({ text: "Exiting Data Exploration agent" }, e
|
|
|
103
106
|
assignedTask: t.agentExecutionContext.assignedTask,
|
|
104
107
|
userRequest: t.agentExecutionContext.userRequest,
|
|
105
108
|
priorSteps: t.agentExecutionContext.priorSteps
|
|
106
|
-
}, s = await
|
|
109
|
+
}, s = await P({
|
|
107
110
|
promptText: d,
|
|
108
111
|
modelTier: "fast",
|
|
109
112
|
config: e,
|
|
110
113
|
messages: t.dataExplorationMessages,
|
|
111
114
|
inputVariables: l
|
|
112
|
-
}), r = typeof s == "string" ? s : s.content, o = new
|
|
115
|
+
}), r = typeof s == "string" ? s : s.content, o = new Q(r);
|
|
113
116
|
await n({ text: `Received response from LLM: ${r}` }, e);
|
|
114
117
|
const i = r;
|
|
115
118
|
return {
|
|
116
119
|
...t,
|
|
117
120
|
outputMessage: i,
|
|
118
121
|
status: "success",
|
|
119
|
-
summary: i ?
|
|
122
|
+
summary: i ? C(i) : "Summary generated.",
|
|
120
123
|
dataExplorationMessages: [...t.dataExplorationMessages, o]
|
|
121
124
|
};
|
|
122
125
|
} catch (a) {
|
|
@@ -129,7 +132,7 @@ async function K(t, e) {
|
|
|
129
132
|
return typeof r == "object" && r !== null && "error" in r;
|
|
130
133
|
}))
|
|
131
134
|
return await n({ text: "Skipping layer filter tool because query response contains an error." }, e), { ...t };
|
|
132
|
-
const l = await new
|
|
135
|
+
const l = await new O(R, { handleToolErrors: !1 }).invoke(
|
|
133
136
|
{
|
|
134
137
|
messages: t.dataExplorationMessages
|
|
135
138
|
},
|
|
@@ -144,9 +147,9 @@ const X = 10, Y = ["string", "small-integer", "integer"], Z = async (t, e, { inc
|
|
|
144
147
|
let l = null, s = null;
|
|
145
148
|
try {
|
|
146
149
|
if (e.type !== "geometry" && e.type !== "oid" && e.type !== "global-id") {
|
|
147
|
-
a && (l = await
|
|
150
|
+
a && (l = await j({ layer: t, field: e.name }));
|
|
148
151
|
const r = e.domain?.type === "coded-value" ? e.domain : null;
|
|
149
|
-
d && (Y.includes(e.type) || r) && (s = (await
|
|
152
|
+
d && (Y.includes(e.type) || r) && (s = (await G({ layer: t, field: e.name })).uniqueValueInfos.sort((o, i) => i.count - o.count).slice(0, X), r && (s = s.map((o) => ({
|
|
150
153
|
...o,
|
|
151
154
|
value: r.getName(o.value) ?? o.value
|
|
152
155
|
}))));
|
|
@@ -192,7 +195,7 @@ async function te(t, e, a, d = !0) {
|
|
|
192
195
|
fieldName: u.name,
|
|
193
196
|
didFetchStatistics: q
|
|
194
197
|
}), q) {
|
|
195
|
-
const
|
|
198
|
+
const $ = Z(g, u, {
|
|
196
199
|
includeSummaryStatistics: E,
|
|
197
200
|
includeUniqueValues: w
|
|
198
201
|
}).then((F) => {
|
|
@@ -202,7 +205,7 @@ async function te(t, e, a, d = !0) {
|
|
|
202
205
|
};
|
|
203
206
|
E && (S.summaryStatistics = F.summaryStatistics), w && (S.uniqueValues = F.uniqueValues), y.set(u.name, { ...u, statistics: S }), u.statistics = S;
|
|
204
207
|
});
|
|
205
|
-
s.push(
|
|
208
|
+
s.push($);
|
|
206
209
|
}
|
|
207
210
|
h.fieldInfos.push(u);
|
|
208
211
|
}
|
|
@@ -220,7 +223,7 @@ function ae(t, e) {
|
|
|
220
223
|
const se = async (t, e) => {
|
|
221
224
|
try {
|
|
222
225
|
await n({ text: "Preparing field information for vector search results" }, e);
|
|
223
|
-
const a = f(e, "layersAndFieldsRegistry"), { mapView: d } =
|
|
226
|
+
const a = f(e, "layersAndFieldsRegistry"), { mapView: d } = U(e, ["mapView"]), { assignedTask: l, userRequest: s } = t.agentExecutionContext, r = ae(l, s), { layerFieldInfo: o, didFetchStatistics: i, fieldStatisticsFetchStatus: c } = await te(
|
|
224
227
|
t.vectorSearchFieldResults,
|
|
225
228
|
a,
|
|
226
229
|
d,
|
|
@@ -290,10 +293,10 @@ ${o}` : i = "Vector search completed. No matching layers found.", await n({ text
|
|
|
290
293
|
e
|
|
291
294
|
), new Error(`Vector search failed: ${a instanceof Error ? a.message : String(a)}`);
|
|
292
295
|
}
|
|
293
|
-
}, le = (t, e) =>
|
|
296
|
+
}, le = (t, e) => D(["layerSearch", "fieldSearch", "layersAndFieldsRegistry"], "Data Exploration Agent")(
|
|
294
297
|
t,
|
|
295
298
|
e
|
|
296
|
-
), ce = () => new I(
|
|
299
|
+
), ce = () => new I(N).addNode("requireDataExplorationServices", le).addNode("vectorSearchLayers", ne).addNode("vectorSearchFields", oe).addNode("fieldStatistics", se).addNode("queryAgent", H).addNode("queryTools", z).addNode("summarizeQueryResponseLLM", J).addNode("filterAgent", B).addNode("filterTools", K).addNode("earlyExit", W).addEdge(V, "requireDataExplorationServices").addEdge("requireDataExplorationServices", "vectorSearchLayers").addConditionalEdges(
|
|
297
300
|
"vectorSearchLayers",
|
|
298
301
|
(e) => e.vectorSearchLayerIds.length ? "vectorSearchFields" : "earlyExit"
|
|
299
302
|
).addConditionalEdges(
|
|
@@ -312,13 +315,13 @@ ${o}` : i = "Vector search completed. No matching layers found.", await n({ text
|
|
|
312
315
|
_Example: “What’s the average population?”_
|
|
313
316
|
_Example: “Which values are in the status field?”_
|
|
314
317
|
|
|
315
|
-
This agent does NOT handle help/metadata requests such as listing available layers, listing field names/columns/attributes for a layer, or capability guidance.`,
|
|
318
|
+
This agent does NOT handle help/metadata requests such as listing available layers, listing field names/columns/attributes for a layer, or capability guidance.`, Ae = {
|
|
316
319
|
id: "dataExploration",
|
|
317
320
|
name: "Data Exploration Agent",
|
|
318
321
|
description: de,
|
|
319
322
|
createGraph: ce,
|
|
320
|
-
workspace:
|
|
323
|
+
workspace: N
|
|
321
324
|
};
|
|
322
325
|
export {
|
|
323
|
-
|
|
326
|
+
Ae as D
|
|
324
327
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
function c(e, o) {
|
|
3
|
+
const t = e?.configurable?.context;
|
|
4
|
+
if (!t || typeof t != "object")
|
|
5
|
+
throw new Error("Agent context missing");
|
|
6
|
+
const n = o.filter((i) => !(i in t));
|
|
7
|
+
if (n.length)
|
|
8
|
+
throw new Error(`Agent context missing: ${n.join(", ")}`);
|
|
9
|
+
return t;
|
|
10
|
+
}
|
|
11
|
+
export {
|
|
12
|
+
c as f
|
|
13
|
+
};
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
+
import { formatDateOnly as F, convertDateFormatToIntlOptions as m, formatTimeOnly as T, formatDate as p } from "@arcgis/core/intl.js";
|
|
3
|
+
const w = /* @__PURE__ */ new Set([
|
|
4
|
+
"date",
|
|
5
|
+
"esrifieldtypedate",
|
|
6
|
+
"date-only",
|
|
7
|
+
"dateonly",
|
|
8
|
+
"esrifieldtypedateonly",
|
|
9
|
+
"time-only",
|
|
10
|
+
"timeonly",
|
|
11
|
+
"esrifieldtypetimeonly",
|
|
12
|
+
"timestamp-offset",
|
|
13
|
+
"timestampoffset",
|
|
14
|
+
"esrifieldtypetimestampoffset"
|
|
15
|
+
]), g = (t) => {
|
|
16
|
+
if (!t)
|
|
17
|
+
return !1;
|
|
18
|
+
const e = t.toLowerCase();
|
|
19
|
+
return w.has(e);
|
|
20
|
+
}, d = (t) => {
|
|
21
|
+
if (t instanceof Date)
|
|
22
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
23
|
+
if (typeof t == "number" && Number.isFinite(t)) {
|
|
24
|
+
const e = new Date(t);
|
|
25
|
+
return Number.isNaN(e.getTime()) ? null : e;
|
|
26
|
+
}
|
|
27
|
+
return null;
|
|
28
|
+
}, I = (t) => !t || t === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : t === "unknown" ? "UTC" : t, N = (t) => {
|
|
29
|
+
if (typeof t == "string" && t)
|
|
30
|
+
return t;
|
|
31
|
+
const e = d(t);
|
|
32
|
+
return e ? e.toISOString().slice(0, 10) : null;
|
|
33
|
+
}, k = () => {
|
|
34
|
+
const t = (/* @__PURE__ */ new Date()).getTimezoneOffset(), e = t <= 0 ? "+" : "-", n = Math.floor(Math.abs(t) / 60).toString().padStart(2, "0"), o = (Math.abs(t) % 60).toString().padStart(2, "0"), i = `${e}${n}:${o}`;
|
|
35
|
+
return { userTimezone: Intl.DateTimeFormat().resolvedOptions().timeZone, userTimezoneOffset: i };
|
|
36
|
+
}, S = (t, e, n) => {
|
|
37
|
+
const o = e?.toLowerCase();
|
|
38
|
+
if (o && !g(o))
|
|
39
|
+
return t;
|
|
40
|
+
if (o === "date-only") {
|
|
41
|
+
const s = N(t);
|
|
42
|
+
return s ? F(s, m("short-date")) : t;
|
|
43
|
+
}
|
|
44
|
+
if (o === "time-only") {
|
|
45
|
+
if (typeof t == "string" && t)
|
|
46
|
+
return T(t, m("long-time"));
|
|
47
|
+
const s = d(t);
|
|
48
|
+
return s ? p(s, {
|
|
49
|
+
...m("long-time"),
|
|
50
|
+
timeZone: "UTC"
|
|
51
|
+
}) : t;
|
|
52
|
+
}
|
|
53
|
+
const i = d(t);
|
|
54
|
+
return i ? p(i, {
|
|
55
|
+
...m("short-date-short-time"),
|
|
56
|
+
timeZone: I(n)
|
|
57
|
+
}) : t;
|
|
58
|
+
}, l = (t, e, n) => {
|
|
59
|
+
if (t && typeof t != "function") {
|
|
60
|
+
const o = "getField" in n && n.getField?.(t), i = o && "getFieldDomain" in n && n.getFieldDomain ? n.getFieldDomain(o.name) : null;
|
|
61
|
+
if (i?.type === "coded-value") {
|
|
62
|
+
const s = i.codedValues.find((r) => r.code === e);
|
|
63
|
+
return s ? s.name : null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return null;
|
|
67
|
+
}, O = (t) => !t || t === "system" ? Intl.DateTimeFormat().resolvedOptions().timeZone : t === "unknown" ? "UTC" : t, C = (t) => {
|
|
68
|
+
if (t instanceof Date)
|
|
69
|
+
return Number.isNaN(t.getTime()) ? null : t;
|
|
70
|
+
if (typeof t == "number" && Number.isFinite(t)) {
|
|
71
|
+
const e = new Date(t);
|
|
72
|
+
return Number.isNaN(e.getTime()) ? null : e;
|
|
73
|
+
}
|
|
74
|
+
if (typeof t == "string" && t) {
|
|
75
|
+
const e = new Date(t);
|
|
76
|
+
return Number.isNaN(e.getTime()) ? null : e;
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}, V = (t, e) => {
|
|
80
|
+
if (typeof t != "number")
|
|
81
|
+
return t;
|
|
82
|
+
const n = {};
|
|
83
|
+
e.minimumFractionDigits !== void 0 && (n.minimumFractionDigits = e.minimumFractionDigits), e.maximumFractionDigits !== void 0 && (n.maximumFractionDigits = e.maximumFractionDigits), e.useGrouping === "always" ? n.useGrouping = !0 : e.useGrouping === "never" && (n.useGrouping = !1);
|
|
84
|
+
try {
|
|
85
|
+
return new Intl.NumberFormat(void 0, n).format(t);
|
|
86
|
+
} catch {
|
|
87
|
+
return t;
|
|
88
|
+
}
|
|
89
|
+
}, x = (t, e, n) => {
|
|
90
|
+
const o = C(t);
|
|
91
|
+
if (!o)
|
|
92
|
+
return t;
|
|
93
|
+
const i = {};
|
|
94
|
+
e.dateStyle ? i.dateStyle = e.dateStyle : (e.year && (i.year = e.year), e.month && (i.month = e.month)), e.timeStyle && (i.timeStyle = e.timeStyle), e.timeStyle && e.hour12 === "always" ? i.hour12 = !0 : e.timeStyle && e.hour12 === "never" && (i.hour12 = !1), i.timeZone = O(n);
|
|
95
|
+
try {
|
|
96
|
+
return new Intl.DateTimeFormat(void 0, i).format(o);
|
|
97
|
+
} catch {
|
|
98
|
+
return t;
|
|
99
|
+
}
|
|
100
|
+
}, y = (t, e) => t.getFieldAlias?.(e) ?? t.fieldsIndex?.get(e)?.alias ?? t.fieldsIndex?.get(e)?.name ?? e, D = (t, e, n, o, i) => {
|
|
101
|
+
if (n == null)
|
|
102
|
+
return n;
|
|
103
|
+
const r = t.getFieldConfiguration?.(e)?.fieldFormat;
|
|
104
|
+
return r?.type === "number" ? V(n, r) : r?.type === "date-time" ? !o || g(o) ? x(n, r, i) : n : S(n, o, i);
|
|
105
|
+
}, L = (t, e, n, o) => {
|
|
106
|
+
const i = t.fieldsIndex?.get(e), s = l(e, n, t) ?? n;
|
|
107
|
+
return D(t, e, s, i?.type, o);
|
|
108
|
+
}, $ = (t, e) => y(t, e), j = (t, e, n) => {
|
|
109
|
+
const o = t.objectIdField, i = e.features.map(
|
|
110
|
+
(r) => r.attributes[o]
|
|
111
|
+
), s = e.features.map((r) => {
|
|
112
|
+
const u = r.attributes, c = {};
|
|
113
|
+
return t.fields.forEach((a) => {
|
|
114
|
+
if (!Object.hasOwn(u, a.name))
|
|
115
|
+
return;
|
|
116
|
+
const f = u[a.name];
|
|
117
|
+
if (a.name === o) {
|
|
118
|
+
c[a.name] = f;
|
|
119
|
+
return;
|
|
120
|
+
}
|
|
121
|
+
const b = l(a.name, f, t) ?? f, h = y(t, a.name);
|
|
122
|
+
c[h] = D(t, a.name, b, a.type, n);
|
|
123
|
+
}), c;
|
|
124
|
+
});
|
|
125
|
+
return { objectIds: i, attributes: s };
|
|
126
|
+
};
|
|
127
|
+
export {
|
|
128
|
+
j as a,
|
|
129
|
+
k as b,
|
|
130
|
+
L as f,
|
|
131
|
+
$ as g
|
|
132
|
+
};
|