@arcgis/coding-components 4.29.0-beta.47 → 4.29.0-beta.49

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/dist/arcgis-coding-components/arcgis-coding-components.esm.js +1 -1
  2. package/dist/arcgis-coding-components/assets/code-editor/arcade.worker.js +13 -13
  3. package/dist/arcgis-coding-components/index.esm.js +1 -1
  4. package/dist/arcgis-coding-components/{p-10a322ec.js → p-0d616249.js} +9 -9
  5. package/dist/arcgis-coding-components/p-2c0d6f15.js +2 -0
  6. package/dist/arcgis-coding-components/{p-71faf9a4.js → p-5802524a.js} +1 -1
  7. package/dist/arcgis-coding-components/{p-9eabda86.js → p-5ddccf04.js} +1 -1
  8. package/dist/arcgis-coding-components/p-7475f3a6.js +1 -0
  9. package/dist/arcgis-coding-components/{p-e6ede32d.js → p-7d8caba9.js} +1 -1
  10. package/dist/arcgis-coding-components/{p-f7d7d78d.js → p-9f6db08a.js} +1 -1
  11. package/dist/arcgis-coding-components/{p-e475e6cd.js → p-aefe77ce.js} +1 -1
  12. package/dist/arcgis-coding-components/p-ce2be55e.entry.js +1 -0
  13. package/dist/arcgis-coding-components/{p-ce586a8c.js → p-d425a387.js} +1 -1
  14. package/dist/arcgis-coding-components/{p-c084ada8.js → p-ff21f230.js} +1 -1
  15. package/dist/cjs/{arcade-defaults-8445d852.js → arcade-defaults-2d513b59.js} +1534 -1534
  16. package/dist/cjs/arcade-mode-6219f1b8.js +599 -0
  17. package/dist/cjs/arcgis-arcade-api_6.cjs.entry.js +1404 -1408
  18. package/dist/cjs/arcgis-coding-components.cjs.js +2 -2
  19. package/dist/cjs/{cssMode-e63287bb.js → cssMode-1ec48254.js} +2 -2
  20. package/dist/cjs/{html-c0d4db3b.js → html-0e1741fe.js} +2 -2
  21. package/dist/cjs/{htmlMode-fdc44d57.js → htmlMode-279d3c29.js} +2 -2
  22. package/dist/cjs/{index-6a382a34.js → index-ac186201.js} +67 -24
  23. package/dist/cjs/index.cjs.js +2 -2
  24. package/dist/cjs/{javascript-a419d064.js → javascript-04f1bce0.js} +3 -3
  25. package/dist/cjs/{jsonMode-73aee5d2.js → jsonMode-59322f7a.js} +2 -2
  26. package/dist/cjs/loader.cjs.js +1 -1
  27. package/dist/cjs/{tsMode-37d1b053.js → tsMode-17561f70.js} +2 -2
  28. package/dist/cjs/{typescript-53f9f36a.js → typescript-b7da8629.js} +2 -2
  29. package/dist/components/arcade-api.js +160 -160
  30. package/dist/components/arcade-contribution.js +60 -60
  31. package/dist/components/arcade-defaults.js +1240 -1240
  32. package/dist/components/arcade-mode.js +514 -513
  33. package/dist/components/arcade-results.js +426 -430
  34. package/dist/components/arcade-suggestions.js +130 -132
  35. package/dist/components/arcade-variables.js +157 -155
  36. package/dist/components/arcgis-arcade-api.d.ts +2 -2
  37. package/dist/components/arcgis-arcade-editor.d.ts +2 -2
  38. package/dist/components/arcgis-arcade-editor.js +391 -391
  39. package/dist/components/arcgis-arcade-results.d.ts +2 -2
  40. package/dist/components/arcgis-arcade-suggestions.d.ts +2 -2
  41. package/dist/components/arcgis-arcade-variables.d.ts +2 -2
  42. package/dist/components/arcgis-code-editor.d.ts +2 -2
  43. package/dist/components/code-editor.js +251 -251
  44. package/dist/components/fields.js +69 -69
  45. package/dist/components/functional-components.js +1 -1
  46. package/dist/components/index2.js +2 -2
  47. package/dist/components/markdown.js +28 -28
  48. package/dist/components/utilities.js +20 -20
  49. package/dist/esm/{arcade-defaults-d7893362.js → arcade-defaults-0bafa696.js} +1534 -1534
  50. package/dist/esm/arcade-mode-c17a1fa1.js +595 -0
  51. package/dist/esm/arcgis-arcade-api_6.entry.js +1404 -1408
  52. package/dist/esm/arcgis-coding-components.js +3 -3
  53. package/dist/esm/{cssMode-b1771f92.js → cssMode-3d18bd2b.js} +2 -2
  54. package/dist/esm/{html-af635d52.js → html-2bce5d77.js} +2 -2
  55. package/dist/esm/{htmlMode-3021c301.js → htmlMode-69d56956.js} +2 -2
  56. package/dist/esm/{index-fd6b2fd8.js → index-022fb97b.js} +67 -24
  57. package/dist/esm/index.js +2 -2
  58. package/dist/esm/{javascript-70589186.js → javascript-ded5c9d7.js} +3 -3
  59. package/dist/esm/{jsonMode-cb509b79.js → jsonMode-0bf84cb2.js} +2 -2
  60. package/dist/esm/loader.js +2 -2
  61. package/dist/esm/{tsMode-ed90c9aa.js → tsMode-15d4e936.js} +2 -2
  62. package/dist/esm/{typescript-db8a0b18.js → typescript-cc4d00f0.js} +2 -2
  63. package/dist/types/components/arcade-api/arcade-api.d.ts +40 -40
  64. package/dist/types/components/arcade-api/t9n-types.d.ts +6 -6
  65. package/dist/types/components/arcade-editor/arcade-editor.d.ts +127 -127
  66. package/dist/types/components/arcade-editor/t9n-types.d.ts +6 -6
  67. package/dist/types/components/arcade-results/arcade-results.d.ts +47 -47
  68. package/dist/types/components/arcade-results/t9n-types.d.ts +11 -11
  69. package/dist/types/components/arcade-suggestions/arcade-suggestions.d.ts +34 -34
  70. package/dist/types/components/arcade-suggestions/t9n-types.d.ts +4 -4
  71. package/dist/types/components/arcade-variables/arcade-variables.d.ts +41 -41
  72. package/dist/types/components/arcade-variables/t9n-types.d.ts +6 -6
  73. package/dist/types/components/code-editor/code-editor.d.ts +73 -73
  74. package/dist/types/stencil-public-runtime.d.ts +8 -0
  75. package/dist/types/utils/arcade-executor.d.ts +79 -79
  76. package/dist/types/utils/arcade-monaco/arcade-defaults.d.ts +66 -66
  77. package/dist/types/utils/arcade-monaco/arcade-language-features.d.ts +23 -23
  78. package/dist/types/utils/arcade-monaco/arcade-mode.d.ts +9 -9
  79. package/dist/types/utils/arcade-monaco/arcade-theme.d.ts +7 -7
  80. package/dist/types/utils/arcade-monaco/arcade-worker-manager.d.ts +9 -9
  81. package/dist/types/utils/arcade-monaco/arcade.worker.d.ts +12 -12
  82. package/dist/types/utils/arcade-monaco/types.d.ts +29 -29
  83. package/dist/types/utils/editor-suggestions.d.ts +24 -24
  84. package/dist/types/utils/functional-components.d.ts +1 -1
  85. package/dist/types/utils/markdown.d.ts +1 -1
  86. package/dist/types/utils/profile/editor-profile.d.ts +185 -185
  87. package/dist/types/utils/profile/types.d.ts +101 -101
  88. package/dist/types/utils/utilities.d.ts +1 -1
  89. package/package.json +7 -7
  90. package/dist/arcgis-coding-components/p-5d670bd2.js +0 -2
  91. package/dist/arcgis-coding-components/p-9e242e76.js +0 -1
  92. package/dist/arcgis-coding-components/p-ccdf0ac1.entry.js +0 -1
  93. package/dist/cjs/arcade-mode-b77afcc9.js +0 -598
  94. package/dist/esm/arcade-mode-70e22d22.js +0 -594
@@ -16,494 +16,490 @@ const MaxArrayItems = 100;
16
16
  const BatchSize = 100;
17
17
 
18
18
  function isArcadeFeatureSet(value) {
19
- return value.declaredRootClass === "esri.arcade.featureset.support.FeatureSet";
19
+ return value.declaredRootClass === "esri.arcade.featureset.support.FeatureSet";
20
20
  }
21
21
  function isArcadeFeature(value) {
22
- return value.arcadeDeclaredClass === "esri.arcade.Feature";
22
+ return value.arcadeDeclaredClass === "esri.arcade.Feature";
23
23
  }
24
24
  function isArcadeDictionary(value) {
25
- return value.declaredClass === "esri.arcade.Dictionary";
25
+ return value.declaredClass === "esri.arcade.Dictionary";
26
26
  }
27
27
  function isGeometry(value) {
28
- const declaredClass = value.declaredClass;
29
- return typeof declaredClass === "string" && declaredClass.startsWith("esri.geometry.");
28
+ const declaredClass = value.declaredClass;
29
+ return typeof declaredClass === "string" && declaredClass.startsWith("esri.geometry.");
30
30
  }
31
31
  function isArcadePortal(value) {
32
- const declaredClass = value.declaredClass;
33
- return typeof declaredClass === "string" && declaredClass === "esri.arcade.Portal";
32
+ const declaredClass = value.declaredClass;
33
+ return typeof declaredClass === "string" && declaredClass === "esri.arcade.Portal";
34
34
  }
35
35
  function isArcadeAttachment(value) {
36
- const declaredClass = value.declaredClass;
37
- return typeof declaredClass === "string" && declaredClass === "esri.arcade.Attachment";
36
+ const declaredClass = value.declaredClass;
37
+ return typeof declaredClass === "string" && declaredClass === "esri.arcade.Attachment";
38
38
  }
39
39
  function isArcadeDate(value) {
40
- const declaredRootClass = value.declaredRootClass;
41
- return typeof declaredRootClass === "string" && declaredRootClass === "esri.arcade.arcadedate";
40
+ const declaredRootClass = value.declaredRootClass;
41
+ return typeof declaredRootClass === "string" && declaredRootClass === "esri.arcade.arcadedate";
42
42
  }
43
43
  function isArcadeDateOnly(value) {
44
- const declaredRootClass = value.declaredRootClass;
45
- return typeof declaredRootClass === "string" && declaredRootClass === "esri.core.sql.dateonly";
44
+ const declaredRootClass = value.declaredRootClass;
45
+ return typeof declaredRootClass === "string" && declaredRootClass === "esri.core.sql.dateonly";
46
46
  }
47
47
  function isArcadeTimeOnly(value) {
48
- const declaredRootClass = value.declaredRootClass;
49
- return typeof declaredRootClass === "string" && declaredRootClass === "esri.core.sql.timeonly";
48
+ const declaredRootClass = value.declaredRootClass;
49
+ return typeof declaredRootClass === "string" && declaredRootClass === "esri.core.sql.timeonly";
50
50
  }
51
51
  function isArcadeImmutableArray(value) {
52
- return (typeof value.length === "function" &&
53
- typeof value.get === "function" &&
54
- typeof value.toArray === "function" &&
55
- Array.isArray(value._elements));
52
+ return (typeof value.length === "function" &&
53
+ typeof value.get === "function" &&
54
+ typeof value.toArray === "function" &&
55
+ Array.isArray(value._elements));
56
56
  }
57
57
  function valueToArcadeResult(value) {
58
- if (value == null || value === undefined) {
59
- return { type: "null" };
60
- }
61
- if (Array.isArray(value)) {
62
- return { type: "array", value };
63
- }
64
- if (isArcadeImmutableArray(value)) {
65
- return { type: "array", value: value.toArray() };
66
- }
67
- if (value instanceof Date) {
68
- return { type: "date", value };
69
- }
70
- if (typeof value === "string") {
71
- return { type: "text", value };
72
- }
73
- if (typeof value === "number") {
74
- return { type: "number", value };
75
- }
76
- if (typeof value === "boolean") {
77
- return { type: "boolean", value };
78
- }
79
- if (typeof value !== "object") {
58
+ if (value == null || value === undefined) {
59
+ return { type: "null" };
60
+ }
61
+ if (Array.isArray(value)) {
62
+ return { type: "array", value };
63
+ }
64
+ if (isArcadeImmutableArray(value)) {
65
+ return { type: "array", value: value.toArray() };
66
+ }
67
+ if (value instanceof Date) {
68
+ return { type: "date", value };
69
+ }
70
+ if (typeof value === "string") {
71
+ return { type: "text", value };
72
+ }
73
+ if (typeof value === "number") {
74
+ return { type: "number", value };
75
+ }
76
+ if (typeof value === "boolean") {
77
+ return { type: "boolean", value };
78
+ }
79
+ if (typeof value !== "object") {
80
+ return { type: "unknown" };
81
+ }
82
+ if (isArcadeDate(value)) {
83
+ return { type: "date", value };
84
+ }
85
+ if (isArcadeDateOnly(value)) {
86
+ return { type: "dateOnly", value };
87
+ }
88
+ if (isArcadeTimeOnly(value)) {
89
+ return { type: "time", value };
90
+ }
91
+ if (isArcadeAttachment(value)) {
92
+ return { type: "attachment", value };
93
+ }
94
+ if (isArcadePortal(value)) {
95
+ return { type: "portal", value };
96
+ }
97
+ if (isArcadeFeatureSet(value)) {
98
+ return { type: "featureSet", value, features: [], iterator: null };
99
+ }
100
+ if (isArcadeFeature(value)) {
101
+ return { type: "feature", value };
102
+ }
103
+ if (isArcadeDictionary(value)) {
104
+ return { type: "dictionary", value };
105
+ }
106
+ if (isGeometry(value)) {
107
+ return { type: "geometry", value };
108
+ }
80
109
  return { type: "unknown" };
81
- }
82
- if (isArcadeDate(value)) {
83
- return { type: "date", value };
84
- }
85
- if (isArcadeDateOnly(value)) {
86
- return { type: "dateOnly", value };
87
- }
88
- if (isArcadeTimeOnly(value)) {
89
- return { type: "time", value };
90
- }
91
- if (isArcadeAttachment(value)) {
92
- return { type: "attachment", value };
93
- }
94
- if (isArcadePortal(value)) {
95
- return { type: "portal", value };
96
- }
97
- if (isArcadeFeatureSet(value)) {
98
- return { type: "featureSet", value, features: [], iterator: null };
99
- }
100
- if (isArcadeFeature(value)) {
101
- return { type: "feature", value };
102
- }
103
- if (isArcadeDictionary(value)) {
104
- return { type: "dictionary", value };
105
- }
106
- if (isGeometry(value)) {
107
- return { type: "geometry", value };
108
- }
109
- return { type: "unknown" };
110
110
  }
111
111
  function formatArcadeResultDate(dateObject, lang = "en") {
112
- // Default to english
113
- if (dateObject.value instanceof Date) {
114
- return new Intl.DateTimeFormat(lang, { dateStyle: "medium", timeStyle: "long" }).format(dateObject.value);
115
- }
116
- return dateObject.value
117
- .toDateTime()
118
- .setLocale(lang)
119
- .toFormat(dateObject.value.isUnknownTimeZone ? "FF" : "FF ZZZZZ");
112
+ // Default to english
113
+ if (dateObject.value instanceof Date) {
114
+ return new Intl.DateTimeFormat(lang, { dateStyle: "medium", timeStyle: "long" }).format(dateObject.value);
115
+ }
116
+ return dateObject.value
117
+ .toDateTime()
118
+ .setLocale(lang)
119
+ .toFormat(dateObject.value.isUnknownTimeZone ? "FF" : "FF ZZZZZ");
120
120
  }
121
121
  function formatArcadeResultDateOnly(dateObject) {
122
- return dateObject.value.toString();
122
+ return dateObject.value.toString();
123
123
  }
124
124
  function formatArcadeResultTimeOnly(dateObject) {
125
- return dateObject.value.toString();
125
+ return dateObject.value.toString();
126
126
  }
127
127
  async function loadArcadeResult(result, timeZone = "system") {
128
- if (result.type !== "featureSet") {
129
- return result;
130
- }
131
- // Feature Set needs to be loaded
132
- await result.value.load();
133
- // Create the first iterator
134
- result.iterator = result.value.iterator({ aborted: false });
135
- if (result.iterator == null) {
128
+ if (result.type !== "featureSet") {
129
+ return result;
130
+ }
131
+ // Feature Set needs to be loaded
132
+ await result.value.load();
133
+ // Create the first iterator
134
+ result.iterator = result.value.iterator({ aborted: false });
135
+ if (result.iterator == null) {
136
+ return result;
137
+ }
138
+ // Load the first batch of items
139
+ result.features = (await result.iterator.nextBatchAsArcadeFeatures(BatchSize, timeZone)) ?? [];
136
140
  return result;
137
- }
138
- // Load the first batch of items
139
- result.features = (await result.iterator.nextBatchAsArcadeFeatures(BatchSize, timeZone)) ?? [];
140
- return result;
141
141
  }
142
142
  async function executeScript(editorProfile, script, testContext, console) {
143
- //
144
- const timeStamp = new Date();
145
- // Provide a default console function is missing
146
- console = console ?? (() => undefined);
147
- try {
148
- // We want to measure compilation time
149
- const t0 = performance.now();
150
- // Setup an executor with the script
151
- const arcade = await importArcade();
152
- const executor = await arcade.createArcadeExecutor(script ?? "", {
153
- variables: editorProfile?.variables ?? []
154
- });
155
- // We want to measure the execution time
156
- const t1 = performance.now();
157
- // Manufacture our execution context
158
- const { profileVariableInstances, spatialReference, timeZone } = testContext;
159
- const executeContext = {
160
- spatialReference,
161
- timeZone,
162
- rawOutput: true,
163
- console
164
- };
165
- // Execute the script
166
- const scriptOutput = await executor.executeAsync(profileVariableInstances ?? {}, executeContext);
167
- // Convert script output to arcade result object and load data if necessary
168
- const scriptResult = await loadArcadeResult(valueToArcadeResult(scriptOutput), timeZone);
169
- // Timestamp and measure cost
170
- scriptResult.timeStamp = timeStamp;
171
- scriptResult.compilationTime = t1 - t0;
172
- scriptResult.executionTime = performance.now() - t1;
173
- return scriptResult;
174
143
  //
175
- }
176
- catch (error) {
177
- let message = "Unknown Error";
178
- if (error instanceof Error) {
179
- message = error.message;
180
- }
181
- return {
182
- type: "error",
183
- value: message,
184
- error,
185
- timeStamp: timeStamp,
186
- compilationTime: 0,
187
- executionTime: 0
188
- };
189
- }
144
+ const timeStamp = new Date();
145
+ // Provide a default console function if missing
146
+ console ?? (console = () => undefined);
147
+ try {
148
+ // We want to measure compilation time
149
+ const t0 = performance.now();
150
+ // Setup an executor with the script
151
+ const arcade = await importArcade();
152
+ const executor = await arcade.createArcadeExecutor(script ?? "", {
153
+ variables: editorProfile?.variables ?? []
154
+ });
155
+ // We want to measure the execution time
156
+ const t1 = performance.now();
157
+ // Manufacture our execution context
158
+ const { profileVariableInstances, spatialReference, timeZone } = testContext;
159
+ const executeContext = {
160
+ spatialReference,
161
+ timeZone,
162
+ rawOutput: true,
163
+ console
164
+ };
165
+ // Execute the script
166
+ const scriptOutput = await executor.executeAsync(profileVariableInstances ?? {}, executeContext);
167
+ // Convert script output to arcade result object and load data if necessary
168
+ const scriptResult = await loadArcadeResult(valueToArcadeResult(scriptOutput), timeZone);
169
+ // Timestamp and measure cost
170
+ scriptResult.timeStamp = timeStamp;
171
+ scriptResult.compilationTime = t1 - t0;
172
+ scriptResult.executionTime = performance.now() - t1;
173
+ return scriptResult;
174
+ //
175
+ }
176
+ catch (error) {
177
+ let message = "Unknown Error";
178
+ if (error instanceof Error) {
179
+ message = error.message;
180
+ }
181
+ return {
182
+ type: "error",
183
+ value: message,
184
+ error,
185
+ timeStamp,
186
+ compilationTime: 0,
187
+ executionTime: 0
188
+ };
189
+ }
190
190
  }
191
191
 
192
192
  const indentSpecs = { char: " ", size: 2 };
193
193
  const indentType = new Array(indentSpecs.size + 1).join(indentSpecs.char);
194
194
  function createPushFunc(p) {
195
- return (substring) => "\\" + p.push(substring) + "\\";
195
+ return (substring) => `\\${p.push(substring)}\\`;
196
196
  }
197
197
  function createPopFunc(p) {
198
- return (_, offset) => p[offset - 1];
198
+ return (_, offset) => p[offset - 1];
199
199
  }
200
200
  function indent(index, indentType) {
201
- return new Array(index + 1).join(indentType);
201
+ return new Array(index + 1).join(indentType);
202
202
  }
203
203
  function jsonFormat(json) {
204
- // Convert to string and extract backslashes and strings
205
- const p = [];
206
- const pushFunc = createPushFunc(p);
207
- const jsonString = JSON.stringify(json)
208
- .replace(/\\./g, pushFunc)
209
- .replace(/(".*?"|'.*?')/g, pushFunc)
210
- .replace(/\s+/, "");
211
- // Indent and insert newlines
212
- let indentIndex = 0;
213
- let out = "";
214
- for (let i = 0; i < jsonString.length; i++) {
215
- const c = jsonString.charAt(i);
216
- switch (c) {
217
- case "{":
218
- case "[":
219
- out += c + "\n" + indent(++indentIndex, indentType);
220
- break;
221
- case "}":
222
- case "]":
223
- out += "\n" + indent(--indentIndex, indentType) + c;
224
- break;
225
- case ",":
226
- out += ",\n" + indent(indentIndex, indentType);
227
- break;
228
- case ":":
229
- out += ": ";
230
- break;
231
- default:
232
- out += c;
233
- break;
234
- }
235
- }
236
- // Strip whitespace from numeric arrays and put backslashes
237
- // and strings back in
238
- const popFunc = createPopFunc(p);
239
- return out
240
- .replace(/\[[\d,\s]+?\]/g, function (m) {
241
- return m.replace(/\s/g, "");
242
- })
243
- .replace(/\\(\d+)\\/g, popFunc) // strings
244
- .replace(/\\(\d+)\\/g, popFunc); // backslashes in strings
204
+ // Convert to string and extract backslashes and strings
205
+ const p = [];
206
+ const pushFunc = createPushFunc(p);
207
+ const jsonString = JSON.stringify(json)
208
+ .replace(/\\./gu, pushFunc)
209
+ .replace(/(".*?"|'.*?')/gu, pushFunc)
210
+ .replace(/\s+/u, "");
211
+ // Indent and insert newlines
212
+ let indentIndex = 0;
213
+ let out = "";
214
+ for (let i = 0; i < jsonString.length; i += 1) {
215
+ const c = jsonString.charAt(i);
216
+ switch (c) {
217
+ case "{":
218
+ case "[":
219
+ indentIndex += 1;
220
+ out += `${c}\n${indent(indentIndex, indentType)}`;
221
+ break;
222
+ case "}":
223
+ case "]":
224
+ indentIndex -= 1;
225
+ out += `\n${indent(indentIndex, indentType)}${c}`;
226
+ break;
227
+ case ",":
228
+ out += `,\n${indent(indentIndex, indentType)}`;
229
+ break;
230
+ case ":":
231
+ out += ": ";
232
+ break;
233
+ default:
234
+ out += c;
235
+ break;
236
+ }
237
+ }
238
+ // Strip whitespace from numeric arrays and put backslashes
239
+ // and strings back in
240
+ const popFunc = createPopFunc(p);
241
+ return out
242
+ .replace(/\[[\d,\s]+?\]/gu, (m) => m.replace(/\s/gu, ""))
243
+ .replace(/\\(\d+)\\/gu, popFunc) // strings
244
+ .replace(/\\(\d+)\\/gu, popFunc); // backslashes in strings
245
245
  }
246
246
 
247
247
  const arcadeResultsCss = ":host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-ui-foreground-1);color:var(--calcite-ui-text-2)}:host .flex-adjustable{flex:1 1 auto;overflow:hidden}:host .flex-row{display:flex;flex-direction:row;overflow:hidden}:host .flex-column{display:flex;flex-direction:column;overflow:hidden}:host .y-scrollable-container{overflow-y:auto;block-size:100%;background-color:var(--calcite-ui-foreground-1)}:host header{border-bottom:1px solid var(--calcite-ui-border-3);flex:0 0 auto}:host .ltr-container{direction:ltr}:host calcite-action-bar calcite-action-group{padding-inline-end:var(--calcite-spacing-half)}:host calcite-action-bar calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-half)}:host calcite-action-bar calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-half)}:host calcite-action-bar calcite-action-group:last-child{border-inline-end-width:0px}:host calcite-action-bar calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-half)}:host .notice-container{margin:var(--calcite-spacing-quarter);padding:var(--calcite-spacing-half);background-color:var(--calcite-ui-foreground-1)}:host .color-info{color:var(--calcite-ui-info)}:host .color-error{color:var(--calcite-ui-danger)}:host .color-success{color:var(--calcite-ui-success)}:host [class*=result-value-]{font-size:var(--calcite-font-size--2);line-height:1.25rem;background-color:var(--calcite-ui-foreground-1);margin:var(--calcite-spacing-three-quarter)}:host .console-logs-container{background-color:var(--calcite-ui-foreground-1);padding:0 var(--calcite-spacing-three-quarter);font-family:var(--calcite-code-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal)}:host .result-value-table table{display:block;max-width:fit-content;overflow-x:auto;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap}:host .result-value-table table thead{background-color:var(--calcite-ui-foreground-2)}:host .result-value-table table tr{border-top:1px solid var(--calcite-ui-border-3);border-bottom:1px solid var(--calcite-ui-border-3)}:host .result-value-table table th,:host .result-value-table table td{border-inline-start:1px solid var(--calcite-ui-border-3);border-inline-end:1px solid var(--calcite-ui-border-3);text-align:start;padding:var(--calcite-spacing-quarter)}:host .result-value-table table th .string-value,:host .result-value-table table td .string-value{white-space:pre}:host .result-value-table table th{font-weight:var(--calcite-font-weight-medium)}:host .tree-item-label,:host .number-value,:host .string-value,:host .boolean-value{font-family:var(--calcite-code-family)}:host .tree-item-label,:host .value-type{color:var(--calcite-text-2);font-weight:var(--calcite-font-weight-normal)}:host .dictionary-property{color:var(--arcgis-arcade-editor-identifier)}:host .number-value{color:var(--arcgis-arcade-editor-number)}:host .string-value{color:var(--arcgis-arcade-editor-string);white-space:pre-wrap}:host .constant-value{color:var(--arcgis-arcade-editor-constant)}:host .date-value{color:var(--arcgis-arcade-editor-date)}";
248
248
 
249
249
  //#region Specialized Constants
250
250
  const treeProps = {
251
- lines: true,
252
- selectionMode: "none",
253
- scale: "s",
254
- onCalciteTreeSelect: (e) => e.target.selectedItems.forEach((itemElt) => (itemElt.selected = false))
251
+ lines: true,
252
+ selectionMode: "none",
253
+ scale: "s",
254
+ onCalciteTreeSelect: (e) => e.target.selectedItems.forEach((itemElt) => (itemElt.selected = false))
255
255
  };
256
256
  const expandableTreeItemProps = {
257
- onClick: (e) => {
258
- const item = e.currentTarget;
259
- item.expanded = !item.expanded;
260
- }
257
+ onClick: (e) => {
258
+ const item = e.currentTarget;
259
+ item.expanded = !item.expanded;
260
+ }
261
261
  };
262
262
  const ArcgisArcadeResults = /*@__PURE__*/ proxyCustomElement(class ArcgisArcadeResults extends HTMLElement {
263
- constructor() {
264
- super();
265
- this.__registerHost();
266
- this.__attachShadow();
267
- this.openedResultPanelChange = createEvent(this, "openedResultPanelChange", 3);
268
- this.close = createEvent(this, "close", 3);
269
- this._switchResultPanel = (e) => {
270
- if (!e.target) {
271
- return;
272
- }
273
- const panelName = e.target?.dataset.panelName;
274
- if (!panelName) {
275
- return;
276
- }
277
- this.updateResultPanel(panelName);
278
- };
279
- this._emitClose = () => this.close.emit();
280
- this._lang = "";
281
- this._t9nLocale = "";
282
- this._t9nStrings = undefined;
283
- this.loading = true;
284
- this.openedResultPanel = "output";
285
- this.result = undefined;
286
- this.consoleLogs = undefined;
287
- }
288
- //#endregion
289
- // #region Component lifecycle events
290
- async componentWillLoad() {
291
- await F(this, getAssetPath("./assets"));
292
- }
293
- disconnectedCallback() {
294
- U(this);
295
- }
296
- // #endregion
297
- //#region Private Methods
298
- updateResultPanel(resultPanelType) {
299
- this.openedResultPanel = resultPanelType;
300
- this.openedResultPanelChange.emit(resultPanelType);
301
- }
302
- //#endregion
303
- //#region Rendering
304
- renderConsolePanel() {
305
- if (this.openedResultPanel !== "console") {
306
- return null;
307
- }
308
- if (this.loading && !this.consoleLogs?.length) {
309
- return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
310
- }
311
- return (h("div", { class: "console-logs-container ltr-container" }, this.consoleLogs?.length ? (this.consoleLogs.map((log) => {
312
- return h("p", null, log);
313
- })) : (h("p", null, this._t9nStrings?.consolemessage))));
314
- }
315
- renderLogPanel() {
316
- if (this.openedResultPanel !== "log") {
317
- return null;
318
- }
319
- if (this.loading) {
320
- return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
321
- }
322
- const iconClass = this.result?.type === "error" ? "color-error" : "color-success";
323
- return (h("calcite-list", null, this.result ? (h(Fragment, null, h("calcite-list-item", { label: H(this._t9nStrings?.lastexecutionformat, {
324
- timeStamp: new Intl.DateTimeFormat(this._t9nLocale, {
325
- dateStyle: "medium",
326
- timeStyle: "medium"
327
- }).format(this.result.timeStamp)
328
- }) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label: H(this._t9nStrings?.compilationtimeformat, {
329
- time: new Intl.NumberFormat(this._t9nLocale, {
330
- style: "unit",
331
- unit: "millisecond",
332
- maximumFractionDigits: 2
333
- }).format(this.result.compilationTime ?? 0)
334
- }) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label: H(this._t9nStrings?.executiontimeformat, {
335
- time: new Intl.NumberFormat(this._t9nLocale, {
336
- style: "unit",
337
- unit: "millisecond",
338
- maximumFractionDigits: 2
339
- }).format(this.result.executionTime ?? 0)
340
- }) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })))) : (h("calcite-list-item", { label: this._t9nStrings?.runscriptmessage ?? "No output, run the script once." }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: "color-info" })))));
341
- }
342
- renderOutputPanel() {
343
- if (this.openedResultPanel !== "output") {
344
- return null;
345
- }
346
- if (this.loading) {
347
- return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
348
- }
349
- switch (this.result?.type) {
350
- case "error":
351
- return (h("div", { class: "result-value-simple flex-adjustable" }, H(this._t9nStrings?.executionerrorformat, {
352
- message: this.result.value
353
- })));
354
- case "null":
355
- case "unknown":
356
- return h("div", { class: "result-value-simple ltr-container" }, this.renderSimpleValue(this.result));
357
- case "text":
358
- case "number":
359
- case "date":
360
- case "dateOnly":
361
- case "time":
362
- case "boolean":
363
- return (h("div", { class: "result-value-simple ltr-container" }, h("span", { class: "value-type" }, this.result.type, ":\u00A0"), this.renderSimpleValue(this.result)));
364
- case "array": {
365
- const items = this.result.value ?? [];
366
- const firstItems = items.slice(0, MaxArrayItems);
367
- return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderArrayHeader(this.result)), this.renderArrayTree(firstItems, true)))));
368
- }
369
- case "geometry":
370
- return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), this.renderGeometryTree(this.result.value, true)))));
371
- case "attachment":
372
- return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), this.renderDictionaryAsJsonTree(this.result.value, true)))));
373
- case "feature":
374
- case "dictionary":
375
- case "portal":
376
- return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), this.renderDictionaryTree(this.result.value, true)))));
377
- case "featureSet":
378
- return (h("div", { class: "result-value-table ltr-container" }, this.renderFeatureSetLabel(this.result), this.renderFeatureSetTable(this.result)));
379
- default:
380
- return (h("div", { class: "result-value-simple flex-adjustable ltr-container" }, this._t9nStrings?.runscriptmessage));
381
- }
382
- }
383
- renderDictionaryProperty(key) {
384
- return (h(Fragment, null, h("span", { class: "dictionary-property" }, key), h("span", null, ":\u00A0")));
385
- }
386
- renderSimpleValue(arcadeResult) {
387
- switch (arcadeResult.type) {
388
- case "unknown":
389
- case "null":
390
- return h("span", { class: "constant-value" }, arcadeResult.type);
391
- case "text":
392
- return h("span", { class: "string-value" }, z(arcadeResult.value));
393
- case "number":
394
- return h("span", { class: "number-value" }, arcadeResult.value.toString());
395
- case "boolean":
396
- return h("span", { class: "constant-value" }, arcadeResult.value.toString());
397
- case "date":
398
- return h("span", { class: "date-value" }, formatArcadeResultDate(arcadeResult));
399
- case "dateOnly":
400
- return h("span", { class: "string-value" }, z(formatArcadeResultDateOnly(arcadeResult)));
401
- case "time":
402
- return h("span", { class: "string-value" }, z(formatArcadeResultTimeOnly(arcadeResult)));
403
- default:
404
- return null;
405
- }
406
- }
407
- renderArrayHeader(arcadeResult) {
408
- const items = arcadeResult.value ?? [];
409
- const leftoverCount = Math.max(items.length - MaxArrayItems, 0);
410
- return (h(Fragment, null, h("span", null, `${arcadeResult.type}(${items.length ?? 0})`), leftoverCount > 0 ? (h("span", null, "\u00A0", H(this._t9nStrings?.showingfirstitemsformat, {
411
- count: MaxArrayItems.toString()
412
- }))) : null));
413
- }
414
- renderArrayTree(items, subtree = false) {
415
- return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, items.map((value, key) => {
416
- const arcadeValue = valueToArcadeResult(value);
417
- return this.renderTreeItem(arcadeValue, key, !subtree);
418
- })));
419
- }
420
- renderGeometryTree(value, subtree = false) {
421
- return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty("type"), value.type)), h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty("value"), h("span", { class: "string-value" }, jsonFormat(value.toJSON()))))));
422
- }
423
- renderDictionaryAsJsonTree(value, subtree = false) {
424
- return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", { class: "string-value" }, jsonFormat(value.castAsJson()))));
425
- }
426
- renderDictionaryTree(value, subtree = false) {
427
- const geometry = value.geometry?.();
428
- return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, value.keys().map((key) => {
429
- const arcadeValue = valueToArcadeResult(value.field(key));
430
- return this.renderTreeItem(arcadeValue, key);
431
- }), geometry ? this.renderTreeItem({ type: "geometry", value: geometry }, "geometry") : null));
432
- }
433
- renderTreeItem(arcadeResult, key, expanded = false) {
434
- switch (arcadeResult.type) {
435
- case "null":
436
- case "unknown":
437
- case "text":
438
- case "number":
439
- case "date":
440
- case "dateOnly":
441
- case "time":
442
- case "boolean":
443
- return (h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty(key), this.renderSimpleValue(arcadeResult))));
444
- case "array": {
445
- const items = arcadeResult.value ?? [];
446
- const firstItems = items.slice(0, MaxArrayItems);
447
- return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty(key), this.renderArrayHeader(arcadeResult)), this.renderArrayTree(firstItems, true)));
448
- }
449
- case "geometry":
450
- return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty(key), h("span", null, arcadeResult.type)), this.renderGeometryTree(arcadeResult.value, true)));
451
- case "attachment":
452
- return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty(key), h("span", null, arcadeResult.type)), this.renderDictionaryAsJsonTree(arcadeResult.value, true)));
453
- case "feature":
454
- case "dictionary":
455
- case "portal":
456
- return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty(key), h("span", null, arcadeResult.type)), this.renderDictionaryTree(arcadeResult.value, true)));
457
- default:
458
- return null;
459
- }
460
- }
461
- renderFeatureSetLabel(arcadeResult) {
462
- return (h("div", { class: "value-type" }, h("span", null, arcadeResult.type, ":"), arcadeResult.features.length >= BatchSize ? (h("span", null, "\u00A0", H(this._t9nStrings?.showingfirstitemsformat, {
463
- count: BatchSize.toString()
464
- }))) : null));
465
- }
466
- renderFeatureSetTable(arcadeResult) {
467
- const fields = supportedFields(arcadeResult.value.fields);
468
- return (h("table", null, h("thead", null, h("tr", null, fields.map((field) => (h("th", null, field.name))))), h("tbody", null, arcadeResult.features.map((feature) => {
469
- return (h("tr", null, fields.map((field) => {
470
- try {
471
- const arcadeResult = valueToArcadeResult(feature.field(field.name));
472
- return h("td", null, this.renderSimpleValue(arcadeResult));
263
+ constructor() {
264
+ super();
265
+ this.__registerHost();
266
+ this.__attachShadow();
267
+ this.openedResultPanelChange = createEvent(this, "openedResultPanelChange", 3);
268
+ this.close = createEvent(this, "close", 3);
269
+ this._switchResultPanel = (e) => {
270
+ if (!e.target) {
271
+ return;
272
+ }
273
+ const panelName = e.target?.dataset.panelName;
274
+ if (!panelName) {
275
+ return;
276
+ }
277
+ this.updateResultPanel(panelName);
278
+ };
279
+ this._emitClose = () => this.close.emit();
280
+ this._lang = "";
281
+ this._t9nLocale = "";
282
+ this._t9nStrings = undefined;
283
+ this.loading = true;
284
+ this.openedResultPanel = "output";
285
+ this.result = undefined;
286
+ this.consoleLogs = undefined;
287
+ }
288
+ //#endregion
289
+ // #region Component lifecycle events
290
+ async componentWillLoad() {
291
+ await F(this, getAssetPath("./assets"));
292
+ }
293
+ disconnectedCallback() {
294
+ U(this);
295
+ }
296
+ // #endregion
297
+ //#region Private Methods
298
+ updateResultPanel(resultPanelType) {
299
+ this.openedResultPanel = resultPanelType;
300
+ this.openedResultPanelChange.emit(resultPanelType);
301
+ }
302
+ //#endregion
303
+ //#region Rendering
304
+ renderConsolePanel() {
305
+ if (this.openedResultPanel !== "console") {
306
+ return null;
307
+ }
308
+ if (this.loading && !this.consoleLogs?.length) {
309
+ return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
310
+ }
311
+ return (h("div", { class: "console-logs-container ltr-container" }, this.consoleLogs?.length ? (this.consoleLogs.map((log) => h("p", null, log))) : (h("p", null, this._t9nStrings?.consolemessage))));
312
+ }
313
+ renderLogPanel() {
314
+ if (this.openedResultPanel !== "log") {
315
+ return null;
316
+ }
317
+ if (this.loading) {
318
+ return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
319
+ }
320
+ const iconClass = this.result?.type === "error" ? "color-error" : "color-success";
321
+ return (h("calcite-list", null, this.result ? (h(Fragment, null, h("calcite-list-item", { label: H(this._t9nStrings?.lastexecutionformat, {
322
+ timeStamp: new Intl.DateTimeFormat(this._t9nLocale, {
323
+ dateStyle: "medium",
324
+ timeStyle: "medium"
325
+ }).format(this.result.timeStamp)
326
+ }) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label: H(this._t9nStrings?.compilationtimeformat, {
327
+ time: new Intl.NumberFormat(this._t9nLocale, {
328
+ style: "unit",
329
+ unit: "millisecond",
330
+ maximumFractionDigits: 2
331
+ }).format(this.result.compilationTime ?? 0)
332
+ }) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })), h("calcite-list-item", { label: H(this._t9nStrings?.executiontimeformat, {
333
+ time: new Intl.NumberFormat(this._t9nLocale, {
334
+ style: "unit",
335
+ unit: "millisecond",
336
+ maximumFractionDigits: 2
337
+ }).format(this.result.executionTime ?? 0)
338
+ }) }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: iconClass })))) : (h("calcite-list-item", { label: this._t9nStrings?.runscriptmessage ?? "No output, run the script once." }, h("calcite-icon", { slot: "content-start", icon: "information", scale: "s", class: "color-info" })))));
339
+ }
340
+ renderOutputPanel() {
341
+ if (this.openedResultPanel !== "output") {
342
+ return null;
343
+ }
344
+ if (this.loading) {
345
+ return h("calcite-loader", { scale: "s", type: "indeterminate", label: "" });
346
+ }
347
+ switch (this.result?.type) {
348
+ case "error":
349
+ return (h("div", { class: "result-value-simple flex-adjustable" }, H(this._t9nStrings?.executionerrorformat, {
350
+ message: this.result.value
351
+ })));
352
+ case "null":
353
+ case "unknown":
354
+ return h("div", { class: "result-value-simple ltr-container" }, this.renderSimpleValue(this.result));
355
+ case "text":
356
+ case "number":
357
+ case "date":
358
+ case "dateOnly":
359
+ case "time":
360
+ case "boolean":
361
+ return (h("div", { class: "result-value-simple ltr-container" }, h("span", { class: "value-type" }, this.result.type, ":\u00A0"), this.renderSimpleValue(this.result)));
362
+ case "array": {
363
+ const items = this.result.value ?? [];
364
+ const firstItems = items.slice(0, MaxArrayItems);
365
+ return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderArrayHeader(this.result)), this.renderArrayTree(firstItems, true)))));
366
+ }
367
+ case "geometry":
368
+ return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), this.renderGeometryTree(this.result.value, true)))));
369
+ case "attachment":
370
+ return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), this.renderDictionaryAsJsonTree(this.result.value, true)))));
371
+ case "feature":
372
+ case "dictionary":
373
+ case "portal":
374
+ return (h("div", { class: "result-value-simple ltr-container" }, h("calcite-tree", { ...treeProps }, h("calcite-tree-item", { expanded: true, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.result.type), this.renderDictionaryTree(this.result.value, true)))));
375
+ case "featureSet":
376
+ return (h("div", { class: "result-value-table ltr-container" }, this.renderFeatureSetLabel(this.result), this.renderFeatureSetTable(this.result)));
377
+ default:
378
+ return (h("div", { class: "result-value-simple flex-adjustable ltr-container" }, this._t9nStrings?.runscriptmessage));
379
+ }
380
+ }
381
+ renderDictionaryProperty(key) {
382
+ return (h(Fragment, null, h("span", { class: "dictionary-property" }, key), h("span", null, ":\u00A0")));
383
+ }
384
+ renderSimpleValue(arcadeResult) {
385
+ switch (arcadeResult.type) {
386
+ case "unknown":
387
+ case "null":
388
+ return h("span", { class: "constant-value" }, arcadeResult.type);
389
+ case "text":
390
+ return h("span", { class: "string-value" }, z(arcadeResult.value));
391
+ case "number":
392
+ return h("span", { class: "number-value" }, arcadeResult.value.toString());
393
+ case "boolean":
394
+ return h("span", { class: "constant-value" }, arcadeResult.value.toString());
395
+ case "date":
396
+ return h("span", { class: "date-value" }, formatArcadeResultDate(arcadeResult));
397
+ case "dateOnly":
398
+ return h("span", { class: "string-value" }, z(formatArcadeResultDateOnly(arcadeResult)));
399
+ case "time":
400
+ return h("span", { class: "string-value" }, z(formatArcadeResultTimeOnly(arcadeResult)));
401
+ default:
402
+ return null;
473
403
  }
474
- catch (e) {
475
- return h("td", null);
404
+ }
405
+ renderArrayHeader(arcadeResult) {
406
+ const items = arcadeResult.value ?? [];
407
+ const leftoverCount = Math.max(items.length - MaxArrayItems, 0);
408
+ return (h(Fragment, null, h("span", null, `${arcadeResult.type}(${items.length ?? 0})`), leftoverCount > 0 ? (h("span", null, "\u00A0", H(this._t9nStrings?.showingfirstitemsformat, {
409
+ count: MaxArrayItems.toString()
410
+ }))) : null));
411
+ }
412
+ renderArrayTree(items, subtree = false) {
413
+ return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, items.map((value, key) => {
414
+ const arcadeValue = valueToArcadeResult(value);
415
+ return this.renderTreeItem(arcadeValue, key, !subtree);
416
+ })));
417
+ }
418
+ renderGeometryTree(value, subtree = false) {
419
+ return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty("type"), value.type)), h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty("value"), h("span", { class: "string-value" }, jsonFormat(value.toJSON()))))));
420
+ }
421
+ renderDictionaryAsJsonTree(value, subtree = false) {
422
+ return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, h("calcite-tree-item", { class: "string-value" }, jsonFormat(value.castAsJson()))));
423
+ }
424
+ renderDictionaryTree(value, subtree = false) {
425
+ const geometry = value.geometry?.();
426
+ return (h("calcite-tree", { slot: subtree ? "children" : undefined, ...treeProps }, value.keys().map((key) => {
427
+ const arcadeValue = valueToArcadeResult(value.field(key));
428
+ return this.renderTreeItem(arcadeValue, key);
429
+ }), geometry ? this.renderTreeItem({ type: "geometry", value: geometry }, "geometry") : null));
430
+ }
431
+ renderTreeItem(arcadeResult, key, expanded = false) {
432
+ switch (arcadeResult.type) {
433
+ case "null":
434
+ case "unknown":
435
+ case "text":
436
+ case "number":
437
+ case "date":
438
+ case "dateOnly":
439
+ case "time":
440
+ case "boolean":
441
+ return (h("calcite-tree-item", null, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty(key), this.renderSimpleValue(arcadeResult))));
442
+ case "array": {
443
+ const items = arcadeResult.value ?? [];
444
+ const firstItems = items.slice(0, MaxArrayItems);
445
+ return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty(key), this.renderArrayHeader(arcadeResult)), this.renderArrayTree(firstItems, true)));
446
+ }
447
+ case "geometry":
448
+ return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty(key), h("span", null, arcadeResult.type)), this.renderGeometryTree(arcadeResult.value, true)));
449
+ case "attachment":
450
+ return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty(key), h("span", null, arcadeResult.type)), this.renderDictionaryAsJsonTree(arcadeResult.value, true)));
451
+ case "feature":
452
+ case "dictionary":
453
+ case "portal":
454
+ return (h("calcite-tree-item", { expanded: expanded, ...expandableTreeItemProps }, h("div", { class: "tree-item-label" }, this.renderDictionaryProperty(key), h("span", null, arcadeResult.type)), this.renderDictionaryTree(arcadeResult.value, true)));
455
+ default:
456
+ return null;
476
457
  }
477
- })));
478
- }))));
479
- }
480
- render() {
481
- return (h(Host, null, h("header", { class: "flex-row" }, h("calcite-action-bar", { class: "flex-adjustable", layout: "horizontal", scale: "s", expanded: true, "expand-disabled": true }, h("calcite-action-group", { scale: "s" }, h("calcite-action", { active: this.openedResultPanel === "output", text: this._t9nStrings?.output ?? "Output", "text-enabled": true, scale: "s", icon: "list-show-all", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "output" }), h("calcite-action", { active: this.openedResultPanel === "console", text: this._t9nStrings?.console ?? "Console", "text-enabled": true, scale: "s", icon: "console", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "console" }), h("calcite-action", { active: this.openedResultPanel === "log", text: this._t9nStrings?.log ?? "Log", "text-enabled": true, scale: "s", icon: "list", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "log" }))), h("calcite-action", { scale: "s", icon: "x", text: this._t9nStrings?.close ?? "", onClick: this._emitClose })), h("article", { class: "flex-adjustable" }, this.loading ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: "" })) : (h("div", { class: "flex-column y-scrollable-container" }, this.renderOutputPanel(), this.renderConsolePanel(), this.renderLogPanel())))));
482
- }
483
- static get assetsDirs() { return ["assets"]; }
484
- get _hostElement() { return this; }
485
- static get style() { return arcadeResultsCss; }
458
+ }
459
+ renderFeatureSetLabel(arcadeResult) {
460
+ return (h("div", { class: "value-type" }, h("span", null, arcadeResult.type, ":"), arcadeResult.features.length >= BatchSize ? (h("span", null, "\u00A0", H(this._t9nStrings?.showingfirstitemsformat, {
461
+ count: BatchSize.toString()
462
+ }))) : null));
463
+ }
464
+ renderFeatureSetTable(arcadeResult) {
465
+ const fields = supportedFields(arcadeResult.value.fields);
466
+ return (h("table", null, h("thead", null, h("tr", null, fields.map((field) => (h("th", null, field.name))))), h("tbody", null, arcadeResult.features.map((feature) => (h("tr", null, fields.map((field) => {
467
+ try {
468
+ const arcadeResult = valueToArcadeResult(feature.field(field.name));
469
+ return h("td", null, this.renderSimpleValue(arcadeResult));
470
+ }
471
+ catch (e) {
472
+ return h("td", null);
473
+ }
474
+ })))))));
475
+ }
476
+ render() {
477
+ return (h(Host, null, h("header", { class: "flex-row" }, h("calcite-action-bar", { class: "flex-adjustable", layout: "horizontal", scale: "s", expanded: true, "expand-disabled": true }, h("calcite-action-group", { scale: "s" }, h("calcite-action", { active: this.openedResultPanel === "output", text: this._t9nStrings?.output ?? "Output", "text-enabled": true, scale: "s", icon: "list-show-all", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "output" }), h("calcite-action", { active: this.openedResultPanel === "console", text: this._t9nStrings?.console ?? "Console", "text-enabled": true, scale: "s", icon: "console", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "console" }), h("calcite-action", { active: this.openedResultPanel === "log", text: this._t9nStrings?.log ?? "Log", "text-enabled": true, scale: "s", icon: "list", iconFlipRtl: true, onClick: this._switchResultPanel, "data-panel-name": "log" }))), h("calcite-action", { scale: "s", icon: "x", text: this._t9nStrings?.close ?? "", onClick: this._emitClose })), h("article", { class: "flex-adjustable" }, this.loading ? (h("calcite-loader", { scale: "s", type: "indeterminate", label: "" })) : (h("div", { class: "flex-column y-scrollable-container" }, this.renderOutputPanel(), this.renderConsolePanel(), this.renderLogPanel())))));
478
+ }
479
+ static get assetsDirs() { return ["assets"]; }
480
+ get _hostElement() { return this; }
481
+ static get style() { return arcadeResultsCss; }
486
482
  }, [1, "arcgis-arcade-results", {
487
- "loading": [4],
488
- "openedResultPanel": [1537, "opened-result-panel"],
489
- "result": [16],
490
- "consoleLogs": [16],
491
- "_lang": [32],
492
- "_t9nLocale": [32],
493
- "_t9nStrings": [32]
494
- }]);
483
+ "loading": [4],
484
+ "openedResultPanel": [1537, "opened-result-panel"],
485
+ "result": [16],
486
+ "consoleLogs": [16],
487
+ "_lang": [32],
488
+ "_t9nLocale": [32],
489
+ "_t9nStrings": [32]
490
+ }]);
495
491
  function defineCustomElement() {
496
- if (typeof customElements === "undefined") {
497
- return;
498
- }
499
- const components = ["arcgis-arcade-results"];
500
- components.forEach(tagName => { switch (tagName) {
501
- case "arcgis-arcade-results":
502
- if (!customElements.get(tagName)) {
503
- customElements.define(tagName, ArcgisArcadeResults);
504
- }
505
- break;
506
- } });
492
+ if (typeof customElements === "undefined") {
493
+ return;
494
+ }
495
+ const components = ["arcgis-arcade-results"];
496
+ components.forEach(tagName => { switch (tagName) {
497
+ case "arcgis-arcade-results":
498
+ if (!customElements.get(tagName)) {
499
+ customElements.define(tagName, ArcgisArcadeResults);
500
+ }
501
+ break;
502
+ } });
507
503
  }
508
504
  defineCustomElement();
509
505