@arcgis/coding-components 5.1.0-next.105 → 5.1.0-next.107
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/dist/cdn/2CBDII2T.js +2 -0
- package/dist/cdn/3LHMOBGC.js +2 -0
- package/dist/cdn/{363GMMQ6.js → 5S2GF6U4.js} +1 -1
- package/dist/cdn/{TCLNQ7Z6.js → 66CFQA7G.js} +1 -1
- package/dist/cdn/{TSZHSRGH.js → 6DAYEZO3.js} +1 -1
- package/dist/cdn/{GZ6HZKQZ.js → AZR47E7L.js} +1 -1
- package/dist/cdn/CK7ERP6J.js +2 -0
- package/dist/cdn/{NWLOXWV6.js → DWYZXGBU.js} +1 -1
- package/dist/cdn/{GPIFJKPY.js → DX64LARM.js} +1 -1
- package/dist/cdn/E5OXH2IV.js +2 -0
- package/dist/cdn/{CHTL74L2.js → ETVSINLC.js} +1 -1
- package/dist/cdn/{G56LJGLK.js → HLDSPJ74.js} +1 -1
- package/dist/cdn/HUJVXIUS.js +2 -0
- package/dist/cdn/{PPV6RAZ3.js → IC45T3XF.js} +1 -1
- package/dist/cdn/{GHTOL7NB.js → KV35R64B.js} +1 -1
- package/dist/cdn/{GVMVHGSK.js → LT4IXMHV.js} +1 -1
- package/dist/cdn/MNHNQABP.js +4 -0
- package/dist/cdn/{OGS4AWC2.js → NMT25LRW.js} +1 -1
- package/dist/cdn/{NOHSS7JG.js → Q7MSRF5V.js} +1 -1
- package/dist/cdn/{P7I5ATMN.js → UN7LGHT2.js} +1 -1
- package/dist/cdn/{SATQDL5P.js → XDJFQDE6.js} +1 -1
- package/dist/cdn/{WL2QW4SI.js → ZSFJLQXB.js} +1 -1
- package/dist/cdn/assets/arcade-editor/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/code-editor/arcade.worker.js +2 -5
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +2440 -2410
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/arcade-mode.js +174 -142
- package/dist/chunks/sql-expr-defaults.js +97 -75
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +24 -13
- package/dist/components/arcgis-arcade-editor/customElement.d.ts +33 -1
- package/dist/components/arcgis-arcade-editor/customElement.js +311 -184
- package/dist/components/arcgis-code-editor/customElement.js +1 -1
- 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 +4 -4
- 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/arcade-executor.d.ts +44 -1
- package/package.json +5 -5
- package/dist/cdn/BWQEBSSL.js +0 -4
- package/dist/cdn/JQQBQXPD.js +0 -2
- package/dist/cdn/SKTKTWIV.js +0 -2
- package/dist/cdn/WP6BSOSW.js +0 -2
- package/dist/cdn/YJW6NUWX.js +0 -2
|
@@ -1,107 +1,126 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { g as
|
|
3
|
-
import { css as
|
|
4
|
-
import { i as
|
|
5
|
-
import { LitElement as
|
|
6
|
-
import { generateGuid as
|
|
7
|
-
import {
|
|
8
|
-
import { s as
|
|
2
|
+
import { g as Z, c as ee } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as te, html as d, nothing as O } from "lit";
|
|
4
|
+
import { i as se } from "../../chunks/monaco-importer.js";
|
|
5
|
+
import { LitElement as ie, createEvent as N, safeClassMap as x } from "@arcgis/lumina";
|
|
6
|
+
import { generateGuid as ae } from "@arcgis/toolkit/string";
|
|
7
|
+
import { i as v, D as ne, e as z } from "../../chunks/arcade-executor.js";
|
|
8
|
+
import { s as re, a as oe } from "../../chunks/arcade-service-accessors.js";
|
|
9
9
|
import { b as P } from "../../chunks/arcade-defaults.js";
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import {
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
|
|
10
|
+
import { setArcadeAskAiBinding as D, arcadeAskAiCommandId as ce, arcadeQuickFixKind as le } from "../../chunks/arcade-mode.js";
|
|
11
|
+
import { u as de } from "../../chunks/useT9n.js";
|
|
12
|
+
import { createRef as K, ref as H } from "lit/directives/ref.js";
|
|
13
|
+
import { load as ue } from "@arcgis/lumina/controllers";
|
|
14
|
+
import q from "@arcgis/core/identity/IdentityManager.js";
|
|
15
|
+
import { log as he, rethrowError as u } from "@arcgis/toolkit/log";
|
|
16
|
+
import { watch as I } from "@arcgis/core/core/reactiveUtils.js";
|
|
17
|
+
import m from "@arcgis/core/core/Accessor.js";
|
|
18
|
+
import { property as o, subclass as f } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
19
|
+
import { A as j } from "../../chunks/ArcadeDebuggerPreviewTabsState.js";
|
|
20
|
+
import { r as ge } from "../../chunks/utilities.js";
|
|
21
|
+
import { Range as V, KeyCode as pe, Uri as be } from "monaco-editor";
|
|
22
|
+
const _e = te`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}.main-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}.bottom-action-bar.is-collapsed{border-bottom:0}`, G = "https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0", p = (t, e) => {
|
|
23
|
+
he(t, "Arcade Assistant", e);
|
|
24
|
+
}, Q = [
|
|
25
|
+
"orgAiAssistantsEnabled",
|
|
26
|
+
"betaAppsAllowed",
|
|
27
|
+
"serviceUrlAvailable",
|
|
28
|
+
"userHasUseAiAssistantsPrivilege"
|
|
29
|
+
], me = Q, W = (t, e) => e.every((s) => t[s] === !0), fe = (t) => {
|
|
22
30
|
const { aiAssistantsEnabled: e } = t;
|
|
23
31
|
return e === void 0 ? (p("warn", "`areAiAssistantsEnabled` is not defined in the organizations settings."), !1) : e;
|
|
24
|
-
},
|
|
32
|
+
}, Se = (t) => !(!t || !("id" in t)), Ae = async (t) => (await q.getCredential(t, { oAuthPopupConfirmation: !1 })).token, xe = async (t) => {
|
|
25
33
|
try {
|
|
26
|
-
return !!await
|
|
34
|
+
return !!await q.checkSignInStatus(t);
|
|
27
35
|
} catch {
|
|
28
36
|
return p("warn", "User is not signed in."), !1;
|
|
29
37
|
}
|
|
30
38
|
};
|
|
31
|
-
async function
|
|
39
|
+
async function Pe({
|
|
32
40
|
portalUrl: t,
|
|
33
41
|
profile: e
|
|
34
42
|
}) {
|
|
35
|
-
if (!
|
|
43
|
+
if (!Se(e))
|
|
36
44
|
return p("warn", "Addon initialization failed. Reason: unsupported profile."), { shouldRender: !1 };
|
|
37
45
|
const s = t.replace(/\/sharing\/rest(\/.*)?$/iu, "").replace(/\/$/u, "");
|
|
38
|
-
if (!await
|
|
46
|
+
if (!await xe(s))
|
|
39
47
|
return { shouldRender: !1 };
|
|
40
|
-
const a = await
|
|
41
|
-
fetch(r, { credentials: "include" }).then((
|
|
42
|
-
fetch(n, { credentials: "include" }).then((
|
|
43
|
-
fetch(
|
|
44
|
-
]), [
|
|
45
|
-
if (
|
|
48
|
+
const a = await Ae(t), r = `${s}/sharing/rest/portals/self?f=json&token=${a}`, n = `${s}/sharing/rest/portals/self/settings?f=json&token=${a}`, c = `${s}/sharing/rest/portals/self/signinSettings?f=json&token=${a}`, Y = await Promise.allSettled([
|
|
49
|
+
fetch(r, { credentials: "include" }).then((A) => A.json()),
|
|
50
|
+
fetch(n, { credentials: "include" }).then((A) => A.json()),
|
|
51
|
+
fetch(c, { credentials: "include" }).then((A) => A.json())
|
|
52
|
+
]), [k, C, B] = Y, S = k.status === "fulfilled" ? k.value : (p("warn", `Failed to fetch selfUrl. Reason: ${k.reason}.`), {}), L = C.status === "fulfilled" ? C.value : (p("warn", `Failed to fetch settingsUrl. Reason: ${C.reason}.`), {}), J = B.status === "fulfilled" ? B.value : (p("warn", `Failed to fetch signinSettingsUrl. Reason: ${B.reason}.`), {});
|
|
53
|
+
if (S.isPortal)
|
|
46
54
|
return { shouldRender: !1 };
|
|
47
|
-
const
|
|
48
|
-
if (!
|
|
55
|
+
const T = S.helpBase || "";
|
|
56
|
+
if (!L)
|
|
49
57
|
return p("warn", "Settings response is not available."), { shouldRender: !1 };
|
|
50
|
-
|
|
51
|
-
|
|
58
|
+
const E = {
|
|
59
|
+
orgAiAssistantsEnabled: fe(L),
|
|
60
|
+
betaAppsAllowed: J.blockBetaApps !== !0,
|
|
61
|
+
serviceUrlAvailable: !!S?.helperServices?.aiAssistantServices?.url,
|
|
62
|
+
userHasUseAiAssistantsPrivilege: S?.user?.privileges?.includes("portal:user:useAIAssistants") === !0
|
|
63
|
+
};
|
|
64
|
+
E.betaAppsAllowed || p(
|
|
52
65
|
"warn",
|
|
53
66
|
"Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."
|
|
54
|
-
),
|
|
55
|
-
const
|
|
56
|
-
return
|
|
67
|
+
), E.userHasUseAiAssistantsPrivilege || p("warn", "User does not have the required privileges to use AI Assistants.");
|
|
68
|
+
const M = W(E, me), F = W(E, Q), U = S?.helperServices?.aiAssistantServices?.url;
|
|
69
|
+
return U ? {
|
|
57
70
|
shouldRender: !0,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
71
|
+
availableFeatures: {
|
|
72
|
+
codeActions: M,
|
|
73
|
+
prompting: F
|
|
74
|
+
},
|
|
75
|
+
serviceUrl: U,
|
|
76
|
+
helpBase: T,
|
|
77
|
+
feedbackServiceUrl: G
|
|
62
78
|
} : {
|
|
63
79
|
shouldRender: !0,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
80
|
+
availableFeatures: {
|
|
81
|
+
codeActions: M,
|
|
82
|
+
prompting: F
|
|
83
|
+
},
|
|
84
|
+
helpBase: T,
|
|
85
|
+
feedbackServiceUrl: G
|
|
67
86
|
};
|
|
68
87
|
}
|
|
69
|
-
var
|
|
70
|
-
for (var a = i > 1 ? void 0 : i ?
|
|
88
|
+
var ve = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, _ = (t, e, s, i) => {
|
|
89
|
+
for (var a = i > 1 ? void 0 : i ? ye(e, s) : e, r = t.length - 1, n; r >= 0; r--)
|
|
71
90
|
(n = t[r]) && (a = (i ? n(e, s, a) : n(a)) || a);
|
|
72
|
-
return i && a &&
|
|
91
|
+
return i && a && ve(e, s, a), a;
|
|
73
92
|
};
|
|
74
|
-
const
|
|
75
|
-
let
|
|
93
|
+
const X = 100;
|
|
94
|
+
let h = class extends m {
|
|
76
95
|
constructor(t) {
|
|
77
|
-
super(t), this.collectionItems = [], this.errorMessage = "", this.expanded = !1, this.requestId = 0, this.status = "idle", this.visibleChildCount =
|
|
96
|
+
super(t), this.collectionItems = [], this.errorMessage = "", this.expanded = !1, this.requestId = 0, this.status = "idle", this.visibleChildCount = X;
|
|
78
97
|
}
|
|
79
98
|
};
|
|
80
99
|
_([
|
|
81
100
|
o()
|
|
82
|
-
],
|
|
101
|
+
], h.prototype, "collectionItems", 2);
|
|
83
102
|
_([
|
|
84
103
|
o()
|
|
85
|
-
],
|
|
104
|
+
], h.prototype, "errorMessage", 2);
|
|
86
105
|
_([
|
|
87
106
|
o()
|
|
88
|
-
],
|
|
107
|
+
], h.prototype, "expanded", 2);
|
|
89
108
|
_([
|
|
90
109
|
o()
|
|
91
|
-
],
|
|
110
|
+
], h.prototype, "requestId", 2);
|
|
92
111
|
_([
|
|
93
112
|
o()
|
|
94
|
-
],
|
|
113
|
+
], h.prototype, "schemaValue", 2);
|
|
95
114
|
_([
|
|
96
115
|
o()
|
|
97
|
-
],
|
|
116
|
+
], h.prototype, "status", 2);
|
|
98
117
|
_([
|
|
99
118
|
o()
|
|
100
|
-
],
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
],
|
|
104
|
-
let
|
|
119
|
+
], h.prototype, "visibleChildCount", 2);
|
|
120
|
+
h = _([
|
|
121
|
+
f("ArcadeDebuggerLazyTreeNodeState")
|
|
122
|
+
], h);
|
|
123
|
+
let w = class extends m {
|
|
105
124
|
constructor(t) {
|
|
106
125
|
super(t), this.generation = 0, this.nodes = /* @__PURE__ */ new Map();
|
|
107
126
|
}
|
|
@@ -112,7 +131,7 @@ let A = class extends f {
|
|
|
112
131
|
const i = this.nodes.get(t);
|
|
113
132
|
if (i)
|
|
114
133
|
return i;
|
|
115
|
-
const a = new
|
|
134
|
+
const a = new h();
|
|
116
135
|
return a.expanded = e, this.nodes.set(t, a), e && s && this.loadNode(t, s), a;
|
|
117
136
|
}
|
|
118
137
|
setExpanded(t, e, s) {
|
|
@@ -125,7 +144,7 @@ let A = class extends f {
|
|
|
125
144
|
}
|
|
126
145
|
showMore(t, e) {
|
|
127
146
|
const s = this.ensureNode(t);
|
|
128
|
-
s.visibleChildCount >= e || (s.visibleChildCount = Math.min(e, s.visibleChildCount +
|
|
147
|
+
s.visibleChildCount >= e || (s.visibleChildCount = Math.min(e, s.visibleChildCount + X));
|
|
129
148
|
}
|
|
130
149
|
loadNode(t, e) {
|
|
131
150
|
switch (e.kind) {
|
|
@@ -147,8 +166,8 @@ let A = class extends f {
|
|
|
147
166
|
return;
|
|
148
167
|
const a = this.generation, r = i.requestId + 1;
|
|
149
168
|
i.requestId = r, i.status = "loading", i.errorMessage = "", i.schemaValue = void 0, i.collectionItems = [], e().then((n) => {
|
|
150
|
-
const
|
|
151
|
-
!
|
|
169
|
+
const c = this.nodes.get(t);
|
|
170
|
+
!c || this.generation !== a || c.requestId !== r || (s(c, n), c.status = "loaded");
|
|
152
171
|
}).catch(() => {
|
|
153
172
|
const n = this.nodes.get(t);
|
|
154
173
|
!n || this.generation !== a || n.requestId !== r || (n.status = "error");
|
|
@@ -160,15 +179,15 @@ let A = class extends f {
|
|
|
160
179
|
this.nodes.clear();
|
|
161
180
|
}
|
|
162
181
|
};
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
],
|
|
166
|
-
var
|
|
167
|
-
for (var a = i > 1 ? void 0 : i ?
|
|
182
|
+
w = _([
|
|
183
|
+
f("ArcadeDebuggerLazyTreeState")
|
|
184
|
+
], w);
|
|
185
|
+
var $e = Object.defineProperty, Ee = Object.getOwnPropertyDescriptor, l = (t, e, s, i) => {
|
|
186
|
+
for (var a = i > 1 ? void 0 : i ? Ee(e, s) : e, r = t.length - 1, n; r >= 0; r--)
|
|
168
187
|
(n = t[r]) && (a = (i ? n(e, s, a) : n(a)) || a);
|
|
169
|
-
return i && a &&
|
|
188
|
+
return i && a && $e(e, s, a), a;
|
|
170
189
|
};
|
|
171
|
-
let b = class extends
|
|
190
|
+
let b = class extends m {
|
|
172
191
|
constructor(t) {
|
|
173
192
|
super(t), this.phase = "idle", this.sessionId = 0, this.consoleLogs = [], this.hasExecuted = !1;
|
|
174
193
|
}
|
|
@@ -191,28 +210,28 @@ let b = class extends f {
|
|
|
191
210
|
this.consoleLogs = [...this.consoleLogs, t];
|
|
192
211
|
}
|
|
193
212
|
};
|
|
194
|
-
|
|
213
|
+
l([
|
|
195
214
|
o()
|
|
196
215
|
], b.prototype, "phase", 2);
|
|
197
|
-
|
|
216
|
+
l([
|
|
198
217
|
o()
|
|
199
218
|
], b.prototype, "mode", 2);
|
|
200
|
-
|
|
219
|
+
l([
|
|
201
220
|
o()
|
|
202
221
|
], b.prototype, "sessionId", 2);
|
|
203
|
-
|
|
222
|
+
l([
|
|
204
223
|
o()
|
|
205
224
|
], b.prototype, "result", 2);
|
|
206
|
-
|
|
225
|
+
l([
|
|
207
226
|
o()
|
|
208
227
|
], b.prototype, "consoleLogs", 2);
|
|
209
|
-
|
|
228
|
+
l([
|
|
210
229
|
o()
|
|
211
230
|
], b.prototype, "hasExecuted", 2);
|
|
212
|
-
b =
|
|
213
|
-
|
|
231
|
+
b = l([
|
|
232
|
+
f("ArcadeDebuggerExecutionModel")
|
|
214
233
|
], b);
|
|
215
|
-
let
|
|
234
|
+
let R = class extends m {
|
|
216
235
|
constructor(t) {
|
|
217
236
|
super(t), this.breakpoints = [];
|
|
218
237
|
}
|
|
@@ -227,27 +246,27 @@ let y = class extends f {
|
|
|
227
246
|
this.breakpoints = [];
|
|
228
247
|
}
|
|
229
248
|
};
|
|
230
|
-
|
|
249
|
+
l([
|
|
231
250
|
o()
|
|
232
|
-
],
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
],
|
|
236
|
-
let
|
|
251
|
+
], R.prototype, "breakpoints", 2);
|
|
252
|
+
R = l([
|
|
253
|
+
f("ArcadeDebuggerSessionModel")
|
|
254
|
+
], R);
|
|
255
|
+
let y = class extends m {
|
|
237
256
|
constructor(t) {
|
|
238
257
|
super(t), this.openedPanel = "output", this.showPanel = !1;
|
|
239
258
|
}
|
|
240
259
|
};
|
|
241
|
-
|
|
260
|
+
l([
|
|
242
261
|
o()
|
|
243
|
-
],
|
|
244
|
-
|
|
262
|
+
], y.prototype, "openedPanel", 2);
|
|
263
|
+
l([
|
|
245
264
|
o()
|
|
246
|
-
],
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
],
|
|
250
|
-
let $ = class extends
|
|
265
|
+
], y.prototype, "showPanel", 2);
|
|
266
|
+
y = l([
|
|
267
|
+
f("ArcadeDebuggerUiModel")
|
|
268
|
+
], y);
|
|
269
|
+
let $ = class extends m {
|
|
251
270
|
constructor(t) {
|
|
252
271
|
super(t);
|
|
253
272
|
}
|
|
@@ -264,18 +283,18 @@ let $ = class extends f {
|
|
|
264
283
|
this.pausedState = t, this.lastPausedState = t;
|
|
265
284
|
}
|
|
266
285
|
};
|
|
267
|
-
|
|
286
|
+
l([
|
|
268
287
|
o()
|
|
269
288
|
], $.prototype, "pausedState", 2);
|
|
270
|
-
|
|
289
|
+
l([
|
|
271
290
|
o()
|
|
272
291
|
], $.prototype, "lastPausedState", 2);
|
|
273
|
-
$ =
|
|
274
|
-
|
|
292
|
+
$ = l([
|
|
293
|
+
f("ArcadeDebuggerPausedFrameModel")
|
|
275
294
|
], $);
|
|
276
|
-
let
|
|
295
|
+
let g = class extends m {
|
|
277
296
|
constructor(t) {
|
|
278
|
-
super(t), this.execution = new b(), this.lazyTreeState = new
|
|
297
|
+
super(t), this.execution = new b(), this.lazyTreeState = new w(), this.pausedFrame = new $(), this.previewTabsState = new j(), this.session = new R(), this.ui = new y();
|
|
279
298
|
}
|
|
280
299
|
get breakpoints() {
|
|
281
300
|
return this.session.breakpoints;
|
|
@@ -354,8 +373,8 @@ let h = class extends f {
|
|
|
354
373
|
completeDebug(t) {
|
|
355
374
|
this.execution.mode = "debug", this.execution.result = { resultType: "debug", result: t }, this.execution.phase = "completed", this.ui.openedPanel = "output", this.pausedFrame.reset(), this.resetTransientDebuggerState();
|
|
356
375
|
}
|
|
357
|
-
completeRun(t) {
|
|
358
|
-
this.execution.mode = "run", this.execution.result = { resultType: "run", result: t }, this.execution.phase = "completed", this.pausedFrame.reset(), this.resetTransientDebuggerState();
|
|
376
|
+
completeRun(t, e = {}) {
|
|
377
|
+
this.execution.mode = "run", !e.useDebugRenderer && v(t) ? this.execution.result = { resultType: "run", result: t } : e.useDebugRenderer && !v(t) && (this.execution.result = { resultType: "debug", result: t }), this.execution.phase = "completed", this.pausedFrame.reset(), this.resetTransientDebuggerState();
|
|
359
378
|
}
|
|
360
379
|
continueDebug() {
|
|
361
380
|
const t = this.pausedFrame.pausedState?.continue;
|
|
@@ -423,42 +442,42 @@ let h = class extends f {
|
|
|
423
442
|
this.pausedLine = void 0, this.lazyTreeState.reset(), this.previewTabsState.clear();
|
|
424
443
|
}
|
|
425
444
|
replaceTransientDebuggerState() {
|
|
426
|
-
this.pausedLine = void 0, this.lazyTreeState = new
|
|
445
|
+
this.pausedLine = void 0, this.lazyTreeState = new w(), this.previewTabsState = new j();
|
|
427
446
|
}
|
|
428
447
|
};
|
|
429
|
-
|
|
448
|
+
l([
|
|
430
449
|
o()
|
|
431
|
-
],
|
|
432
|
-
|
|
450
|
+
], g.prototype, "execution", 2);
|
|
451
|
+
l([
|
|
433
452
|
o()
|
|
434
|
-
],
|
|
435
|
-
|
|
453
|
+
], g.prototype, "lazyTreeState", 2);
|
|
454
|
+
l([
|
|
436
455
|
o()
|
|
437
|
-
],
|
|
438
|
-
|
|
456
|
+
], g.prototype, "pausedLine", 2);
|
|
457
|
+
l([
|
|
439
458
|
o()
|
|
440
|
-
],
|
|
441
|
-
|
|
459
|
+
], g.prototype, "pausedFrame", 2);
|
|
460
|
+
l([
|
|
442
461
|
o()
|
|
443
|
-
],
|
|
444
|
-
|
|
462
|
+
], g.prototype, "previewTabsState", 2);
|
|
463
|
+
l([
|
|
445
464
|
o()
|
|
446
|
-
],
|
|
447
|
-
|
|
465
|
+
], g.prototype, "session", 2);
|
|
466
|
+
l([
|
|
448
467
|
o()
|
|
449
|
-
],
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
],
|
|
453
|
-
const
|
|
468
|
+
], g.prototype, "ui", 2);
|
|
469
|
+
g = l([
|
|
470
|
+
f("ArcadeDebuggerStore")
|
|
471
|
+
], g);
|
|
472
|
+
const De = {
|
|
454
473
|
glyphMargin: !0,
|
|
455
474
|
lineNumbersMinChars: 1
|
|
456
475
|
};
|
|
457
|
-
class
|
|
476
|
+
class we extends ie {
|
|
458
477
|
constructor() {
|
|
459
|
-
super(...arguments), this._codeEditorElt =
|
|
460
|
-
window.open(
|
|
461
|
-
}, this._decorations = void 0, this._monacoEditor =
|
|
478
|
+
super(...arguments), this._codeEditorElt = K(), this._arcadeAssistantElt = K(), this._componentReadyDefer = Promise.withResolvers(), this._disposables = [], this._editorProfilePromise = Promise.resolve(void 0), this._debuggerState = new g(), this.messages = de(), this._modelId = ae(), this._openArcadeHelp = () => {
|
|
479
|
+
window.open(ne, "Arcade Help");
|
|
480
|
+
}, this._decorations = void 0, this._monacoEditor = ue(se), this._editorOptions = {}, this._toggleSidePanel = (e) => {
|
|
462
481
|
e.currentTarget instanceof HTMLElement && this._setOpenedSidePanel(e.currentTarget.dataset.panelName ?? "none");
|
|
463
482
|
}, this._closeSidePanel = () => {
|
|
464
483
|
this._setOpenedSidePanel("none");
|
|
@@ -467,7 +486,7 @@ class Se extends K {
|
|
|
467
486
|
if (!e)
|
|
468
487
|
return;
|
|
469
488
|
const s = this._debuggerState.breakpoints.map((i) => ({
|
|
470
|
-
range: new
|
|
489
|
+
range: new V(i, 1, i, 1),
|
|
471
490
|
options: {
|
|
472
491
|
isWholeLine: !0,
|
|
473
492
|
glyphMarginClassName: "arcgis-code-editor__breakpoint-glyph"
|
|
@@ -476,13 +495,13 @@ class Se extends K {
|
|
|
476
495
|
this._decorations?.clear(), this._decorations = e.createDecorationsCollection(s);
|
|
477
496
|
}, this._clearDebuggerDecorations = () => {
|
|
478
497
|
this._decorations?.clear(), this._decorations = void 0, this._debuggerPausedLineDecoration?.clear(), this._debuggerPausedLineDecoration = void 0;
|
|
479
|
-
}, this._debuggerPausedLineDecoration = void 0, this._preparingArcade = !1, this._arcadeAssistantRemoteState = { shouldRender: !1 }, this.enableDebugger = !1, this.hideDocumentationActions = !1, this.hideSideBar = !1, this.openedSidePanel = "none", this.script = "", this.sideActionBarExpanded = !1, this.arcgisDiagnosticsChange =
|
|
498
|
+
}, this._debuggerPausedLineDecoration = void 0, this._preparingArcade = !1, this._arcadeAssistantRemoteState = { shouldRender: !1 }, this._diagnostics = [], this.enableDebugger = !1, this.hideDocumentationActions = !1, this.hideSideBar = !1, this.openedSidePanel = "none", this.script = "", this.sideActionBarExpanded = !1, this.arcgisDiagnosticsChange = N({ bubbles: !1 }), this.arcgisScriptChange = N({ bubbles: !1 });
|
|
480
499
|
}
|
|
481
500
|
static {
|
|
482
|
-
this.properties = { _apiLibrary: 16, _editorProfile: 16, _preparingArcade: 16, _arcadeAssistantRemoteState: 16, editorInstance: 32, editorOptions: 0, enableDebugger: 5, hideDocumentationActions: 5, hideSideBar: 5, messageOverrides: 0, openedSidePanel: 3, profile: 0, script: 1, sideActionBarExpanded: 7, snippets: 0, suggestions: 0, testData: 0, customPanels: 0, arcadeAssistant: 0 };
|
|
501
|
+
this.properties = { _apiLibrary: 16, _editorProfile: 16, _preparingArcade: 16, _arcadeAssistantRemoteState: 16, _diagnostics: 16, editorInstance: 32, editorOptions: 0, enableDebugger: 5, hideDocumentationActions: 5, hideSideBar: 5, messageOverrides: 0, openedSidePanel: 3, profile: 0, script: 1, sideActionBarExpanded: 7, snippets: 0, suggestions: 0, testData: 0, customPanels: 0, arcadeAssistant: 0, externalExecutor: 0 };
|
|
483
502
|
}
|
|
484
503
|
static {
|
|
485
|
-
this.styles = [
|
|
504
|
+
this.styles = [_e];
|
|
486
505
|
}
|
|
487
506
|
get _usesBottomExecutionDrawer() {
|
|
488
507
|
return this.enableDebugger && !!this.testData;
|
|
@@ -492,7 +511,7 @@ class Se extends K {
|
|
|
492
511
|
}
|
|
493
512
|
get editorOptions() {
|
|
494
513
|
return {
|
|
495
|
-
...
|
|
514
|
+
...De,
|
|
496
515
|
...this._editorOptions
|
|
497
516
|
};
|
|
498
517
|
}
|
|
@@ -506,18 +525,26 @@ class Se extends K {
|
|
|
506
525
|
if (!e)
|
|
507
526
|
return { type: "error", value: "Missing editor profile", error: null };
|
|
508
527
|
await this._componentReadyDefer.promise;
|
|
509
|
-
const s = this._codeEditorElt.value?.value, i = await
|
|
510
|
-
return
|
|
528
|
+
const s = this._codeEditorElt.value?.value, i = await z(e.definition, s, this.testData, { mode: "run" });
|
|
529
|
+
return v(i) ? i : { type: "error", value: "Unexpected debug result", error: null };
|
|
511
530
|
}
|
|
512
531
|
async setFocus() {
|
|
513
532
|
await this._componentReadyDefer.promise, await this._codeEditorElt.value?.setFocus();
|
|
514
533
|
}
|
|
534
|
+
async openArcadeAssistant(e) {
|
|
535
|
+
if (!this._arcadeAssistantRemoteState.shouldRender)
|
|
536
|
+
return !1;
|
|
537
|
+
if (this.openedSidePanel = "arcade-assistant", await this.updateComplete, !this._canPromptWithArcadeAssistant())
|
|
538
|
+
return !0;
|
|
539
|
+
const s = this._arcadeAssistantElt.value;
|
|
540
|
+
return e?.prompt && await s?.openPrompt(e.prompt), !0;
|
|
541
|
+
}
|
|
515
542
|
async load() {
|
|
516
|
-
const e =
|
|
517
|
-
|
|
518
|
-
for (; this._disposables.length; )
|
|
543
|
+
const e = Z("./assets");
|
|
544
|
+
re(e), await this._updateDataModelDeps(), await this._updateArcadeAssistantRemoteState(), this.manager.onLifecycle(() => (this.hasUpdated && this._connectMonacoCustomizations().catch(u(this)), () => {
|
|
545
|
+
for (this._askAiBindingKey && (D(this._askAiBindingKey, void 0), this._askAiBindingKey = void 0); this._disposables.length; )
|
|
519
546
|
this._disposables.pop()?.dispose();
|
|
520
|
-
this._connectMonacoCustomizationsPromise = void 0, this._executeScriptAction = void 0, this._clearDebuggerDecorations(), this._debuggerState.disconnect();
|
|
547
|
+
this._abortExternalExecution(), this._connectMonacoCustomizationsPromise = void 0, this._executeScriptAction = void 0, this._clearDebuggerDecorations(), this._debuggerState.disconnect();
|
|
521
548
|
}));
|
|
522
549
|
}
|
|
523
550
|
willUpdate(e) {
|
|
@@ -537,13 +564,15 @@ class Se extends K {
|
|
|
537
564
|
this._connectMonacoCustomizationsPromise = (async () => {
|
|
538
565
|
if (!this.isConnected)
|
|
539
566
|
return;
|
|
540
|
-
const e = await
|
|
541
|
-
this._disposables.push(e.onDiagnosticsChange((
|
|
542
|
-
|
|
567
|
+
const e = await oe();
|
|
568
|
+
this._disposables.push(e.onDiagnosticsChange((c) => {
|
|
569
|
+
this._preparingArcade || (this._diagnostics = c.diagnostics, this.arcgisDiagnosticsChange.emit(c.diagnostics));
|
|
570
|
+
})), this.testData && !this._executeScriptAction && this._addExecuteScriptAction(), this._syncAskAiAction();
|
|
571
|
+
const s = I(() => this._debuggerState.breakpoints, () => this._updateBreakpointsDecorations(), { sync: !0 }), i = I(() => this._debuggerState.debuggerLine, () => this._updateDebuggerPausedLineDecoration(), { sync: !0 }), a = I(() => this._debuggerState.consoleLogs.length, () => this.requestUpdate(), { sync: !0 });
|
|
543
572
|
this._disposables.push({ dispose: () => s.remove() }, { dispose: () => i.remove() }, { dispose: () => a.remove() });
|
|
544
|
-
const r = this.editorInstance?.onMouseDown((
|
|
573
|
+
const r = this.editorInstance?.onMouseDown((c) => this._onEditorMouseDown(c));
|
|
545
574
|
r && this._disposables.push(r);
|
|
546
|
-
const n = this.editorInstance?.onDidChangeModelContent((
|
|
575
|
+
const n = this.editorInstance?.onDidChangeModelContent((c) => this._onEditorModelContentChange(c));
|
|
547
576
|
n && this._disposables.push(n), this._updateBreakpointsDecorations(), this._updateDebuggerPausedLineDecoration();
|
|
548
577
|
})();
|
|
549
578
|
try {
|
|
@@ -565,7 +594,7 @@ class Se extends K {
|
|
|
565
594
|
_onEditorModelContentChange(e) {
|
|
566
595
|
if (!this.enableDebugger || !this._debuggerState.breakpoints.length || e.isFlush)
|
|
567
596
|
return;
|
|
568
|
-
const s =
|
|
597
|
+
const s = ge(this._debuggerState.breakpoints, e.changes);
|
|
569
598
|
s.length === this._debuggerState.breakpoints.length && s.every((i, a) => i === this._debuggerState.breakpoints[a]) || this._debuggerState.setBreakpoints(s);
|
|
570
599
|
}
|
|
571
600
|
_updateDebuggerPausedLineDecoration() {
|
|
@@ -576,7 +605,7 @@ class Se extends K {
|
|
|
576
605
|
const s = this._debuggerState.debuggerLine;
|
|
577
606
|
s != null ? this._debuggerPausedLineDecoration = e.createDecorationsCollection([
|
|
578
607
|
{
|
|
579
|
-
range: new
|
|
608
|
+
range: new V(s, 1, s, 1),
|
|
580
609
|
options: {
|
|
581
610
|
isWholeLine: !0,
|
|
582
611
|
className: "arcgis-code-editor__debugger-paused-line",
|
|
@@ -589,11 +618,14 @@ class Se extends K {
|
|
|
589
618
|
_continueDebugSession() {
|
|
590
619
|
this._debuggerState.continueDebug();
|
|
591
620
|
}
|
|
621
|
+
_abortExternalExecution() {
|
|
622
|
+
this._externalExecutionAbortController?.abort(), this._externalExecutionAbortController = void 0;
|
|
623
|
+
}
|
|
592
624
|
_stopDebugSession({ hideExecutionPanel: e = !0 } = {}) {
|
|
593
|
-
this._debuggerState.stopDebug({ hidePanel: e });
|
|
625
|
+
this._abortExternalExecution(), this._debuggerState.stopDebug({ hidePanel: e });
|
|
594
626
|
}
|
|
595
627
|
_resetDebugSession() {
|
|
596
|
-
this._debuggerState.resetDebug(), this._executeScript("debug").catch(
|
|
628
|
+
this._abortExternalExecution(), this._debuggerState.resetDebug(), this._executeScript("debug").catch(u(this));
|
|
597
629
|
}
|
|
598
630
|
async _handleDebugPause(e, s, i) {
|
|
599
631
|
if (!this._debuggerState.isDebugging || e !== this._debuggerState.sessionId)
|
|
@@ -608,8 +640,45 @@ class Se extends K {
|
|
|
608
640
|
async _updateDataModelDeps() {
|
|
609
641
|
await this._updateEditorProfile(), await this._updateApiLibrary();
|
|
610
642
|
}
|
|
643
|
+
async _executeWithExternalExecutor(e, s, i) {
|
|
644
|
+
if (!this.externalExecutor)
|
|
645
|
+
return { type: "error", value: "Missing external executor", error: null };
|
|
646
|
+
const a = new AbortController();
|
|
647
|
+
this._abortExternalExecution(), this._externalExecutionAbortController = a;
|
|
648
|
+
const r = i.console ?? (() => {
|
|
649
|
+
});
|
|
650
|
+
try {
|
|
651
|
+
if (e === "debug") {
|
|
652
|
+
const { breakpoints: n, onDebugPause: c } = i;
|
|
653
|
+
if (!n || !c)
|
|
654
|
+
throw new Error("Missing debug execution options");
|
|
655
|
+
return await this.externalExecutor.execute({
|
|
656
|
+
mode: "debug",
|
|
657
|
+
script: s,
|
|
658
|
+
console: r,
|
|
659
|
+
signal: a.signal,
|
|
660
|
+
breakpoints: n,
|
|
661
|
+
onDebugPause: c
|
|
662
|
+
});
|
|
663
|
+
}
|
|
664
|
+
return await this.externalExecutor.execute({
|
|
665
|
+
mode: "run",
|
|
666
|
+
script: s,
|
|
667
|
+
console: r,
|
|
668
|
+
signal: a.signal
|
|
669
|
+
});
|
|
670
|
+
} catch (n) {
|
|
671
|
+
return {
|
|
672
|
+
type: "error",
|
|
673
|
+
value: "Execution failed",
|
|
674
|
+
error: n instanceof Error ? n : new Error(String(n))
|
|
675
|
+
};
|
|
676
|
+
} finally {
|
|
677
|
+
this._externalExecutionAbortController === a && (this._externalExecutionAbortController = void 0);
|
|
678
|
+
}
|
|
679
|
+
}
|
|
611
680
|
_testDataChanged() {
|
|
612
|
-
!this.testData && this._executeScriptAction && (this._disposeSafely(this._executeScriptAction), this._executeScriptAction = void 0), this.testData && !this._executeScriptAction && this._addExecuteScriptAction(), !this.testData && this.enableDebugger && this._debuggerState.clearForMissingTestData(), this._debuggerState.showPanel && this._executeScript("run").catch(
|
|
681
|
+
!this.testData && this._executeScriptAction && (this._disposeSafely(this._executeScriptAction), this._executeScriptAction = void 0), this.testData && !this._executeScriptAction && this._addExecuteScriptAction(), !this.testData && this.enableDebugger && this._debuggerState.clearForMissingTestData(), this._debuggerState.showPanel && this._executeScript("run").catch(u(this));
|
|
613
682
|
}
|
|
614
683
|
async _updateEditorProfile() {
|
|
615
684
|
this._preparingArcade = !0;
|
|
@@ -634,30 +703,36 @@ class Se extends K {
|
|
|
634
703
|
const s = this.testData;
|
|
635
704
|
if (!this._codeEditorElt.value || !s)
|
|
636
705
|
return;
|
|
637
|
-
const i = e === "debug" ? this._debuggerState.startDebug() : this._debuggerState.startRun()
|
|
638
|
-
if (!a) {
|
|
639
|
-
this._debuggerState.fail({ type: "error", value: "Missing editor profile", error: null });
|
|
640
|
-
return;
|
|
641
|
-
}
|
|
706
|
+
const i = e === "debug" ? this._debuggerState.startDebug() : this._debuggerState.startRun();
|
|
642
707
|
setTimeout(() => {
|
|
643
708
|
(async () => {
|
|
644
|
-
const
|
|
709
|
+
const a = this._codeEditorElt.value?.value ?? this.script, r = {
|
|
645
710
|
mode: e,
|
|
646
|
-
console: (
|
|
711
|
+
console: (c) => this._debuggerState.addConsoleLog(c),
|
|
647
712
|
breakpoints: e === "debug" ? this._debuggerState.debuggerBreakpoints : void 0
|
|
648
713
|
};
|
|
649
|
-
e === "debug" && (
|
|
650
|
-
|
|
714
|
+
e === "debug" && (r.onDebugPause = this._handleDebugPause.bind(this, i));
|
|
715
|
+
let n;
|
|
716
|
+
if (this.externalExecutor)
|
|
717
|
+
n = await this._executeWithExternalExecutor(e, a, r);
|
|
718
|
+
else {
|
|
719
|
+
const c = await this._editorProfilePromise;
|
|
720
|
+
if (!c) {
|
|
721
|
+
this._debuggerState.fail({ type: "error", value: "Missing editor profile", error: null });
|
|
722
|
+
return;
|
|
723
|
+
}
|
|
724
|
+
n = await z(c.definition, a, s, r);
|
|
725
|
+
}
|
|
651
726
|
if (i === this._debuggerState.sessionId) {
|
|
652
727
|
if (e === "debug") {
|
|
653
|
-
if (
|
|
654
|
-
this._debuggerState.fail(
|
|
728
|
+
if (v(n)) {
|
|
729
|
+
this._debuggerState.fail(n);
|
|
655
730
|
return;
|
|
656
731
|
}
|
|
657
|
-
this._debuggerState.completeDebug(
|
|
732
|
+
this._debuggerState.completeDebug(n);
|
|
658
733
|
return;
|
|
659
734
|
}
|
|
660
|
-
|
|
735
|
+
v(n) ? this._debuggerState.completeRun(n) : this.externalExecutor ? this._debuggerState.completeRun(n, { useDebugRenderer: !0 }) : this._debuggerState.fail({ type: "error", value: "Unexpected debug result", error: null });
|
|
661
736
|
}
|
|
662
737
|
})();
|
|
663
738
|
}, 0);
|
|
@@ -672,13 +747,13 @@ class Se extends K {
|
|
|
672
747
|
e.stopPropagation(), this.script = e.detail, this.arcgisScriptChange.emit(e.detail);
|
|
673
748
|
}
|
|
674
749
|
_insertAsSnippet(e) {
|
|
675
|
-
this._codeEditorElt.value?.insertSnippet(e.detail).catch(
|
|
750
|
+
this._codeEditorElt.value?.insertSnippet(e.detail).catch(u(this));
|
|
676
751
|
}
|
|
677
752
|
_insertAsText(e) {
|
|
678
753
|
this._insertText(e.detail);
|
|
679
754
|
}
|
|
680
755
|
_insertText(e) {
|
|
681
|
-
this._codeEditorElt.value?.insertText(e).catch(
|
|
756
|
+
this._codeEditorElt.value?.insertText(e).catch(u(this));
|
|
682
757
|
}
|
|
683
758
|
_onResultPanelChange(e) {
|
|
684
759
|
const s = e.currentTarget;
|
|
@@ -692,38 +767,90 @@ class Se extends K {
|
|
|
692
767
|
// An unique identifier for the action.
|
|
693
768
|
id: "run-script",
|
|
694
769
|
label: "Run Arcade Expression",
|
|
695
|
-
keybindings: [
|
|
770
|
+
keybindings: [pe.F5],
|
|
696
771
|
contextMenuGroupId: "code",
|
|
697
772
|
contextMenuOrder: 1,
|
|
698
773
|
run: () => {
|
|
699
|
-
this.testData && this._executeScript("run").catch(
|
|
774
|
+
this.testData && this._executeScript("run").catch(u(this));
|
|
700
775
|
}
|
|
701
776
|
});
|
|
702
777
|
e && (this._executeScriptAction = e, this._disposables.push(e));
|
|
703
778
|
}
|
|
779
|
+
_getAskAiBindingKey() {
|
|
780
|
+
return be.parse(this._modelId).toString();
|
|
781
|
+
}
|
|
782
|
+
_canRenderAskAiCodeActions() {
|
|
783
|
+
const e = this._arcadeAssistantRemoteState;
|
|
784
|
+
return e.shouldRender ? e.availableFeatures.codeActions : !1;
|
|
785
|
+
}
|
|
786
|
+
_canPromptWithArcadeAssistant() {
|
|
787
|
+
const e = this._arcadeAssistantRemoteState;
|
|
788
|
+
return e.shouldRender ? e.availableFeatures.prompting : !1;
|
|
789
|
+
}
|
|
790
|
+
_getAskAiCodeActions(e) {
|
|
791
|
+
if (!this._canRenderAskAiCodeActions())
|
|
792
|
+
return [];
|
|
793
|
+
if (!e.markers.length)
|
|
794
|
+
return [];
|
|
795
|
+
const s = this.messages.askarcadeassistant ?? "Ask Arcade Assistant", i = this._getAskAiBindingKey();
|
|
796
|
+
return [
|
|
797
|
+
{
|
|
798
|
+
title: s,
|
|
799
|
+
kind: le,
|
|
800
|
+
diagnostics: e.markers,
|
|
801
|
+
isPreferred: !1,
|
|
802
|
+
// isAI adds the sparkle and adds it to the hover menu, but it changes the
|
|
803
|
+
// behavior in the code editing experience, it shows up as a sparkle next to the error.
|
|
804
|
+
// The sparkle doesn't explain what it does, and imo will cause confusion, thus we are opting to not use it for now.
|
|
805
|
+
isAI: !1,
|
|
806
|
+
command: {
|
|
807
|
+
id: ce,
|
|
808
|
+
title: s,
|
|
809
|
+
arguments: [i, this.messages.askarcadeassistantprompt ?? "Fix the errors in my script"]
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
];
|
|
813
|
+
}
|
|
814
|
+
_syncAskAiAction() {
|
|
815
|
+
if (!this.editorInstance)
|
|
816
|
+
return;
|
|
817
|
+
const s = this._getAskAiBindingKey();
|
|
818
|
+
if (!this._arcadeAssistantRemoteState.shouldRender) {
|
|
819
|
+
this._askAiBindingKey && (D(this._askAiBindingKey, void 0), this._askAiBindingKey = void 0);
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
this._askAiBindingKey && this._askAiBindingKey !== s && D(this._askAiBindingKey, void 0), D(s, {
|
|
823
|
+
provideCodeActions: ({ context: i }) => this._getAskAiCodeActions(i),
|
|
824
|
+
run: (i) => {
|
|
825
|
+
this.openArcadeAssistant({
|
|
826
|
+
prompt: i ?? this.messages.askarcadeassistantprompt ?? "Fix the errors in my script"
|
|
827
|
+
}).catch(u(this));
|
|
828
|
+
}
|
|
829
|
+
}), this._askAiBindingKey = s;
|
|
830
|
+
}
|
|
704
831
|
_disposeSafely(e) {
|
|
705
832
|
const s = this._disposables.indexOf(e);
|
|
706
833
|
s !== -1 && this._disposables.splice(s, 1), e.dispose();
|
|
707
834
|
}
|
|
708
835
|
async _updateArcadeAssistantRemoteState() {
|
|
709
|
-
this.arcadeAssistant
|
|
836
|
+
this.arcadeAssistant ? this._arcadeAssistantRemoteState = await Pe({
|
|
710
837
|
...this.arcadeAssistant,
|
|
711
838
|
profile: this.profile
|
|
712
|
-
}));
|
|
839
|
+
}) : this._arcadeAssistantRemoteState = { shouldRender: !1 }, this._syncAskAiAction();
|
|
713
840
|
}
|
|
714
841
|
renderMainActionBar() {
|
|
715
|
-
return this.enableDebugger || !this.testData ? null :
|
|
716
|
-
this._executeScript("run").catch(
|
|
717
|
-
}}></calcite-action>${this._debuggerState.result ?
|
|
842
|
+
return this.enableDebugger || !this.testData ? null : d`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run ?? ""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${() => {
|
|
843
|
+
this._executeScript("run").catch(u(this));
|
|
844
|
+
}}></calcite-action>${this._debuggerState.result ? d`<calcite-action .text=${this.messages.lastresults ?? ""} .active=${this._debuggerState.showPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>` : null}</calcite-action-group></calcite-action-bar>`;
|
|
718
845
|
}
|
|
719
846
|
renderMainPanel() {
|
|
720
|
-
return
|
|
847
|
+
return d`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${P.languageId} .value=${this.script ?? ""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${H(this._codeEditorElt)}></arcgis-code-editor>`;
|
|
721
848
|
}
|
|
722
|
-
renderAction({ id: e, label: s, icon: i, active: a, panelName: r, iconFlipRtl: n = !1, onClick:
|
|
723
|
-
return
|
|
849
|
+
renderAction({ id: e, label: s, icon: i, active: a, panelName: r, iconFlipRtl: n = !1, onClick: c = this._toggleSidePanel }) {
|
|
850
|
+
return d`<calcite-action id=${e ?? O} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${c} data-panel-name=${r ?? O} .iconFlipRtl=${n}></calcite-action>${!this.sideActionBarExpanded && d`<calcite-tooltip .referenceElement=${e}><span>${s}</span></calcite-tooltip>` || ""}`;
|
|
724
851
|
}
|
|
725
852
|
renderSideActionBar() {
|
|
726
|
-
return this.hideSideBar ? null :
|
|
853
|
+
return this.hideSideBar ? null : d`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({
|
|
727
854
|
id: "profile-variables-action",
|
|
728
855
|
label: this.messages.profilevariables ?? "",
|
|
729
856
|
icon: "profile-variables",
|
|
@@ -767,13 +894,13 @@ class Se extends K {
|
|
|
767
894
|
if (this.hideSideBar)
|
|
768
895
|
return null;
|
|
769
896
|
const { openedSidePanel: e } = this;
|
|
770
|
-
return
|
|
897
|
+
return d`<arcgis-language-api-panel slot=side-panel class=${x(e === "api" ? "" : "hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .closed=${e !== "api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${x(e === "variables" ? "" : "hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e !== "variables"} .messageOverrides=${{ profileempty: this.messages.profileempty }}></arcgis-editor-variables>${this.suggestions?.length && d`<arcgis-arcade-suggestions slot=side-panel class=${x(e === "suggestions" ? "" : "hidden")} .closed=${e !== "suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>` || ""}${this.arcadeAssistant && this._arcadeAssistantRemoteState.shouldRender && d`<arcgis-arcade-coding-assistant slot=side-panel class=${x(e === "arcade-assistant" ? "" : "hidden")} .closed=${e !== "arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${this.arcadeAssistant.portalUrl} .serviceUrl=${"serviceUrl" in this._arcadeAssistantRemoteState ? this._arcadeAssistantRemoteState.serviceUrl : void 0} .helpBase=${this._arcadeAssistantRemoteState.helpBase} .promptingEnabled=${this._canPromptWithArcadeAssistant()} .feedbackServiceUrl=${this._arcadeAssistantRemoteState.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant.disableQuestionAnswerLogging} .diagnostics=${this._diagnostics} ${H(this._arcadeAssistantElt)}></arcgis-arcade-coding-assistant>` || ""}${this.customPanels?.map((s) => d`<calcite-flow slot=side-panel class=${x(e === s.id ? "" : "hidden")}>${s?.useFlows ? s.renderer?.({
|
|
771
898
|
closePanel: this._toggleSidePanel,
|
|
772
899
|
insertText: this._insertText.bind(this),
|
|
773
900
|
closed: e !== s.id,
|
|
774
901
|
/** pass this.el instead of "this" as it is what actually gets attached to the dom */
|
|
775
902
|
editorRef: this.el
|
|
776
|
-
}) :
|
|
903
|
+
}) : d`<calcite-flow-item .heading=${s.name} heading-level=2 closable .closed=${e !== s.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${s.description}>${s.renderer?.({
|
|
777
904
|
closePanel: this._toggleSidePanel,
|
|
778
905
|
insertText: this._insertText.bind(this),
|
|
779
906
|
closed: e !== s.id,
|
|
@@ -787,27 +914,27 @@ class Se extends K {
|
|
|
787
914
|
if (!this._debuggerState.showPanel)
|
|
788
915
|
return null;
|
|
789
916
|
const e = this._debuggerState.openedPanel === "debug-console" ? "output" : this._debuggerState.openedPanel;
|
|
790
|
-
return
|
|
917
|
+
return d`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`;
|
|
791
918
|
}
|
|
792
919
|
renderBottomExecutionBody() {
|
|
793
920
|
const { showPanel: e, openedPanel: s, debugResult: i, isExecuting: a, mode: r } = this._debuggerState;
|
|
794
|
-
return e ? s === "debug-console" ?
|
|
921
|
+
return e ? s === "debug-console" ? d`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>` : s === "output" && (r === "debug" || i) ? d`<arcgis-arcade-debugger-output slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>` : d`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${s} .loading=${s === "console" && this._debuggerState.isPaused ? !1 : a} .result=${this._debuggerState.runResult} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>` : null;
|
|
795
922
|
}
|
|
796
923
|
renderBottomActionBar() {
|
|
797
924
|
if (!this._usesBottomExecutionDrawer)
|
|
798
925
|
return null;
|
|
799
926
|
const { showPanel: e, hasExecuted: s, openedPanel: i, isDebugging: a, isPaused: r, isExecuting: n } = this._debuggerState;
|
|
800
|
-
return
|
|
801
|
-
this._executeScript("run").catch(
|
|
927
|
+
return d`<calcite-action-bar slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e ? "" : "is-collapsed"}`} layout=horizontal scale=s expand-disabled><calcite-action-group scale=s>${a ? d`<calcite-action .text=${this.messages.continue ?? "Continue"} icon=forward scale=s .disabled=${!r} @click=${this._continueDebugSession}></calcite-action><calcite-action .text=${this.messages.reset ?? "Reset"} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-action .text=${this.messages.stop ?? "Stop"} icon=circle-stop scale=s @click=${() => this._stopDebugSession()}></calcite-action>` : d`<calcite-action .text=${this.messages.run ?? ""} text-enabled icon=play scale=s .loading=${this._preparingArcade || n} @click=${() => {
|
|
928
|
+
this._executeScript("run").catch(u(this));
|
|
802
929
|
}}></calcite-action><calcite-action .text=${this.messages.runanddebug ?? "Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade || n} @click=${() => {
|
|
803
|
-
this._executeScript("debug").catch(
|
|
804
|
-
}}></calcite-action>`}</calcite-action-group>${s ?
|
|
930
|
+
this._executeScript("debug").catch(u(this));
|
|
931
|
+
}}></calcite-action>`}</calcite-action-group>${s ? d`<calcite-action-group scale=s><calcite-action .active=${i === "output" && e} .text=${this.messages.output ?? "Output"} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${() => this._setExecutionPanel("output")}></calcite-action><calcite-action .active=${i === "console" && e} .text=${this.messages.console ?? "Console"} text-enabled scale=s icon=console icon-flip-rtl @click=${() => this._setExecutionPanel("console")}></calcite-action><calcite-action .active=${i === "log" && e} .text=${this.messages.log ?? "Log"} text-enabled scale=s icon=list icon-flip-rtl @click=${() => this._setExecutionPanel("log")}></calcite-action><calcite-action .active=${i === "debug-console" && e} .text=${this.messages.debugconsole ?? "Debug Console"} text-enabled scale=s icon=debug-script icon-flip-rtl .disabled=${this._debuggerState.mode !== "debug"} @click=${() => this._setExecutionPanel("debug-console")}></calcite-action></calcite-action-group>` : null}${e ? d`<calcite-action-group scale=s><calcite-action .text=${this.messages.close ?? "Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose}></calcite-action></calcite-action-group>` : null}</calcite-action-bar>`;
|
|
805
932
|
}
|
|
806
933
|
render() {
|
|
807
|
-
return
|
|
934
|
+
return d`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`;
|
|
808
935
|
}
|
|
809
936
|
}
|
|
810
|
-
|
|
937
|
+
ee("arcgis-arcade-editor", we);
|
|
811
938
|
export {
|
|
812
|
-
|
|
939
|
+
we as ArcgisArcadeEditor
|
|
813
940
|
};
|