@arcgis/coding-components 5.1.0-next.0 → 5.1.0-next.10

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 (37) hide show
  1. package/dist/cdn/{UNTQC5M2.js → 44MLHT3A.js} +1 -1
  2. package/dist/cdn/{5JKSRJZY.js → 7YLRIYVH.js} +1 -1
  3. package/dist/cdn/{3B6KNFHK.js → BQLG62QR.js} +4 -4
  4. package/dist/cdn/{KKQIZTTK.js → F7IHWMK7.js} +1 -1
  5. package/dist/cdn/{NZY7KXAF.js → H75CMJQP.js} +1 -1
  6. package/dist/cdn/{Z56TGOZF.js → HVHTW7TF.js} +2 -2
  7. package/dist/cdn/JS62T4I5.js +4 -0
  8. package/dist/cdn/{N2FN7LBN.js → K7O73D3Q.js} +1 -1
  9. package/dist/cdn/{3YWUK77P.js → L2AQ5FXC.js} +1 -1
  10. package/dist/cdn/{DEWLD2VE.js → NXNOBP7G.js} +1 -1
  11. package/dist/cdn/{EPMYM35I.js → OPWQ5CNY.js} +1 -1
  12. package/dist/cdn/{3FSDLLYC.js → QWLPT7LO.js} +1 -1
  13. package/dist/cdn/{BYO7RLJT.js → T7GEIGWF.js} +1 -1
  14. package/dist/cdn/{QXQAIN3R.js → TDEKR2LM.js} +1 -1
  15. package/dist/cdn/TDYUEEOH.js +2 -0
  16. package/dist/cdn/WNUR7N3L.js +6 -0
  17. package/dist/cdn/XEUCI6KC.js +2 -0
  18. package/dist/cdn/{D2RP5367.js → ZGBZ6BXY.js} +1 -1
  19. package/dist/cdn/assets/code-editor/arcade.worker.js +8 -0
  20. package/dist/cdn/assets/code-editor/sql-expr.worker.js +2192 -2186
  21. package/dist/cdn/index.js +1 -1
  22. package/dist/chunks/arcade-defaults.js +84 -84
  23. package/dist/chunks/arcade-mode.js +2 -2
  24. package/dist/chunks/language-defaults-base.js +3 -2
  25. package/dist/components/arcgis-arcade-coding-assistant/customElement.js +101 -96
  26. package/dist/components/arcgis-arcade-editor/customElement.d.ts +5 -1
  27. package/dist/components/arcgis-arcade-editor/customElement.js +72 -59
  28. package/dist/components/arcgis-arcade-results/customElement.js +13 -13
  29. package/dist/docs/api.json +1 -1
  30. package/dist/docs/docs.json +1 -1
  31. package/dist/docs/vscode.html-custom-data.json +1 -1
  32. package/dist/docs/web-types.json +1 -1
  33. package/package.json +5 -5
  34. package/dist/cdn/6QWZ6LSH.js +0 -2
  35. package/dist/cdn/ASVCAO4G.js +0 -4
  36. package/dist/cdn/MY63AUW2.js +0 -2
  37. package/dist/cdn/RXNRHK3U.js +0 -6
@@ -1,7 +1,7 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
- import { g as R, c as w } from "../../chunks/runtime.js";
3
- import { css as y, html as i, nothing as P } from "lit";
4
- import { KeyCode as D } from "monaco-editor";
2
+ import { g as I, c as D } from "../../chunks/runtime.js";
3
+ import { css as C, html as s, nothing as b } from "lit";
4
+ import { KeyCode as B } from "monaco-editor";
5
5
  import "monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js";
6
6
  import "monaco-editor/esm/vs/editor/standalone/common/standaloneTheme.js";
7
7
  import "monaco-editor/esm/vs/platform/hover/browser/hover.js";
@@ -9,61 +9,74 @@ import "monaco-editor/esm/vs/editor/common/languages/supports/tokenization.js";
9
9
  import "monaco-editor/esm/vs/base/browser/dom.js";
10
10
  import "monaco-editor/esm/vs/editor/browser/editorDom.js";
11
11
  import "monaco-editor/esm/vs/editor/browser/controller/mouseTarget.js";
12
- import { LitElement as C, createEvent as b, safeClassMap as c } from "@arcgis/lumina";
13
- import { generateGuid as I } from "@arcgis/toolkit/string";
14
- import { D as B, e as v } from "../../chunks/arcade-executor.js";
15
- import { s as M, g as k } from "../../chunks/arcade-service-accessors.js";
16
- import { b as d } from "../../chunks/arcade-defaults.js";
17
- import { u as T } from "../../chunks/useT9n.js";
18
- import { createRef as L, ref as U } from "lit/directives/ref.js";
19
- import F from "@arcgis/core/identity/IdentityManager.js";
20
- import { log as N, rethrowError as o } from "@arcgis/toolkit/log";
21
- const H = y`: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)}}`, O = "https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0", a = (s, e) => N(s, "Arcade Assistant", e), j = (s) => {
22
- const { aiAssistantsEnabled: e } = s;
12
+ import { LitElement as k, createEvent as v, safeClassMap as l } from "@arcgis/lumina";
13
+ import { generateGuid as M } from "@arcgis/toolkit/string";
14
+ import { D as T, e as x } from "../../chunks/arcade-executor.js";
15
+ import { s as U, g as L } from "../../chunks/arcade-service-accessors.js";
16
+ import { b as c } from "../../chunks/arcade-defaults.js";
17
+ import { u as F } from "../../chunks/useT9n.js";
18
+ import { createRef as N, ref as H } from "lit/directives/ref.js";
19
+ import R from "@arcgis/core/identity/IdentityManager.js";
20
+ import { log as O, rethrowError as o } from "@arcgis/toolkit/log";
21
+ const j = C`: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)}}`, E = "https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0", a = (i, e) => O(i, "Arcade Assistant", e), z = (i) => {
22
+ const { aiAssistantsEnabled: e } = i;
23
23
  return e === void 0 ? (a("warn", "`areAiAssistantsEnabled` is not defined in the organizations settings."), !1) : e;
24
- }, z = (s) => !(!s || !("id" in s)), V = async (s) => (await F.getCredential(s)).token;
25
- async function G({
26
- portalUrl: s,
24
+ }, V = (i) => !(!i || !("id" in i)), G = async (i) => (await R.getCredential(i, { oAuthPopupConfirmation: !1 })).token, q = async (i) => {
25
+ try {
26
+ return !!await R.checkSignInStatus(i);
27
+ } catch {
28
+ return a("warn", "User is not signed in."), !1;
29
+ }
30
+ };
31
+ async function X({
32
+ portalUrl: i,
27
33
  profile: e
28
34
  }) {
29
- if (!z(e))
35
+ if (!V(e))
30
36
  return a("warn", "Addon initialization failed. Reason: unsupported profile."), { shouldRender: !1 };
31
- const t = s.replace(/\/sharing\/rest(\/.*)?$/iu, "").replace(/\/$/u, ""), n = await V(s), r = `${t}/sharing/rest/portals/self?f=json&token=${n}`, h = `${t}/sharing/rest/portals/self/settings?f=json&token=${n}`, p = `${t}/sharing/rest/portals/self/signinSettings?f=json&token=${n}`, u = await Promise.allSettled([
32
- fetch(r, { credentials: "include" }).then((l) => l.json()),
33
- fetch(h, { credentials: "include" }).then((l) => l.json()),
34
- fetch(p, { credentials: "include" }).then((l) => l.json())
35
- ]), [g, f, _] = u, m = g.status === "fulfilled" ? g.value : (a("warn", `Failed to fetch selfUrl. Reason: ${g.reason}.`), {}), $ = f.status === "fulfilled" ? f.value : (a("warn", `Failed to fetch settingsUrl. Reason: ${f.reason}.`), {}), x = _.status === "fulfilled" ? _.value : (a("warn", `Failed to fetch signinSettingsUrl. Reason: ${_.reason}.`), {}), S = m?.helperServices?.aiAssistantServices?.url;
37
+ const t = i.replace(/\/sharing\/rest(\/.*)?$/iu, "").replace(/\/$/u, "");
38
+ if (!await q(t))
39
+ return { shouldRender: !1 };
40
+ const n = await G(i), h = `${t}/sharing/rest/portals/self?f=json&token=${n}`, p = `${t}/sharing/rest/portals/self/settings?f=json&token=${n}`, u = `${t}/sharing/rest/portals/self/signinSettings?f=json&token=${n}`, w = await Promise.allSettled([
41
+ fetch(h, { credentials: "include" }).then((r) => r.json()),
42
+ fetch(p, { credentials: "include" }).then((r) => r.json()),
43
+ fetch(u, { credentials: "include" }).then((r) => r.json())
44
+ ]), [g, f, _] = w, m = g.status === "fulfilled" ? g.value : (a("warn", `Failed to fetch selfUrl. Reason: ${g.reason}.`), {}), S = f.status === "fulfilled" ? f.value : (a("warn", `Failed to fetch settingsUrl. Reason: ${f.reason}.`), {}), y = _.status === "fulfilled" ? _.value : (a("warn", `Failed to fetch signinSettingsUrl. Reason: ${_.reason}.`), {}), $ = m.helpBase || "";
36
45
  if (!S)
37
- return a("warn", "Service URL is not available in the portal self response."), { shouldRender: !1 };
38
- const E = m.helpBase || "";
39
- if (!$)
40
46
  return a("warn", "Settings response is not available."), { shouldRender: !1 };
41
- let A = j($);
42
- return x.blockBetaApps === !0 && (a(
47
+ let A = z(S);
48
+ y.blockBetaApps === !0 && (a(
43
49
  "warn",
44
50
  "Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."
45
- ), A = !1), m?.user?.privileges?.includes("portal:user:useAIAssistants") || (a("warn", "User does not have the required privileges to use AI Assistants."), A = !1), {
51
+ ), A = !1), m?.user?.privileges?.includes("portal:user:useAIAssistants") || (a("warn", "User does not have the required privileges to use AI Assistants."), A = !1);
52
+ const P = m?.helperServices?.aiAssistantServices?.url;
53
+ return P ? {
46
54
  shouldRender: !0,
47
- serviceUrl: S,
48
- helpBase: E,
55
+ serviceUrl: P,
56
+ helpBase: $,
49
57
  assistantsEnabled: A,
50
- feedbackServiceUrl: O
58
+ feedbackServiceUrl: E
59
+ } : {
60
+ shouldRender: !0,
61
+ assistantsEnabled: !1,
62
+ helpBase: $,
63
+ feedbackServiceUrl: E
51
64
  };
52
65
  }
53
- class q extends C {
66
+ class K extends k {
54
67
  constructor() {
55
- super(...arguments), this._codeEditorElt = L(), this._componentReadyDefer = Promise.withResolvers(), this._disposables = [], this._editorProfilePromise = Promise.resolve(void 0), this.messages = T(), this._modelId = I(), this._openArcadeHelp = () => void window.open(B, "Arcade Help"), this._toggleSidePanel = (e) => {
68
+ super(...arguments), this._codeEditorElt = N(), this._componentReadyDefer = Promise.withResolvers(), this._disposables = [], this._editorProfilePromise = Promise.resolve(void 0), this.messages = F(), this._modelId = M(), this._openArcadeHelp = () => void window.open(T, "Arcade Help"), this._toggleSidePanel = (e) => {
56
69
  if (!e.target)
57
70
  return;
58
71
  const t = e.target?.dataset.panelName ?? "none";
59
72
  this.openedSidePanel = t === this.openedSidePanel ? "none" : t, this.openedSidePanel === "none" && this._codeEditorElt.value?.setFocus().catch(o(this));
60
- }, this._consoleLogs = [], this._executingScript = !1, this._preparingArcade = !1, this._resultPanel = "output", this._showExecutionPanel = !1, this._arcadeAssistantRemoteState = { shouldRender: !1 }, this.hideDocumentationActions = !1, this.hideSideBar = !1, this.openedSidePanel = "none", this.script = "", this.sideActionBarExpanded = !1, this.arcgisDiagnosticsChange = b({ bubbles: !1 }), this.arcgisScriptChange = b({ bubbles: !1 });
73
+ }, this._consoleLogs = [], this._executingScript = !1, this._preparingArcade = !1, this._resultPanel = "output", this._showExecutionPanel = !1, this._arcadeAssistantRemoteState = { shouldRender: !1 }, this.hideDocumentationActions = !1, this.hideSideBar = !1, this.openedSidePanel = "none", this.script = "", this.sideActionBarExpanded = !1, this.arcgisDiagnosticsChange = v({ bubbles: !1 }), this.arcgisScriptChange = v({ bubbles: !1 });
61
74
  }
62
75
  static {
63
76
  this.properties = { _apiLibrary: 16, _consoleLogs: 16, _editorProfile: 16, _executingScript: 16, _executionResult: 16, _preparingArcade: 16, _resultPanel: 16, _showExecutionPanel: 16, _arcadeAssistantRemoteState: 16, editorInstance: 32, editorOptions: 0, hideDocumentationActions: 5, hideSideBar: 5, openedSidePanel: 3, profile: 0, script: 1, sideActionBarExpanded: 7, snippets: 0, suggestions: 0, testData: 0, customPanels: 0, arcadeAssistant: 0 };
64
77
  }
65
78
  static {
66
- this.styles = [H];
79
+ this.styles = [j];
67
80
  }
68
81
  get editorInstance() {
69
82
  return this._codeEditorElt.value?.editorInstance;
@@ -76,23 +89,23 @@ class q extends C {
76
89
  return { type: "error", value: "Missing editor profile", error: null };
77
90
  await this._componentReadyDefer.promise;
78
91
  const t = this._codeEditorElt.value?.value;
79
- return await v(e.definition, t, this.testData);
92
+ return await x(e.definition, t, this.testData);
80
93
  }
81
94
  async setFocus() {
82
95
  await this._componentReadyDefer.promise, await this._codeEditorElt.value?.setFocus();
83
96
  }
84
97
  async load() {
85
- const e = R("./assets");
86
- M(e), await this._updateDataModelDeps(), await this._updateArcadeAssistantRemoteState();
98
+ const e = I("./assets");
99
+ U(e), await this._updateDataModelDeps(), await this._updateArcadeAssistantRemoteState();
87
100
  }
88
101
  willUpdate(e) {
89
- (e.has("messages") || e.has("profile")) && this.hasUpdated && this._updateDataModelDeps(), e.has("testData") && this._testDataChanged(), e.has("snippets") && d.updateApiContextForModel(this._modelId, {
102
+ (e.has("messages") || e.has("profile")) && this.hasUpdated && this._updateDataModelDeps(), e.has("testData") && this._testDataChanged(), e.has("snippets") && c.updateApiContextForModel(this._modelId, {
90
103
  snippets: this.snippets
91
104
  }), e.has("arcadeAssistant") && this._updateArcadeAssistantRemoteState();
92
105
  }
93
106
  async loaded() {
94
107
  this._componentReadyDefer.resolve(), await this._updateApiLibrary();
95
- const e = await k();
108
+ const e = await L();
96
109
  this._disposables.push(e.onDiagnosticsChange((t) => !this._preparingArcade && this.arcgisDiagnosticsChange.emit(t.diagnostics))), this.testData && this._addExecuteScriptAction();
97
110
  }
98
111
  disconnectedCallback() {
@@ -108,10 +121,10 @@ class q extends C {
108
121
  async _updateEditorProfile() {
109
122
  this._preparingArcade = !0;
110
123
  try {
111
- await d.setProfileForModel(this._modelId, this.profile, {
124
+ await c.setProfileForModel(this._modelId, this.profile, {
112
125
  locale: this.messages._t9nLocale,
113
126
  snippets: this.snippets
114
- }), this._editorProfile = d.getEditorProfileForModel(this._modelId);
127
+ }), this._editorProfile = c.getEditorProfileForModel(this._modelId);
115
128
  } catch {
116
129
  this._editorProfile = void 0;
117
130
  } finally {
@@ -119,7 +132,7 @@ class q extends C {
119
132
  }
120
133
  }
121
134
  async _updateApiLibrary() {
122
- this._apiLibrary = await d.getApiLibraryForModel(this._modelId);
135
+ this._apiLibrary = await c.getApiLibraryForModel(this._modelId);
123
136
  }
124
137
  async _executeScript() {
125
138
  const e = this.testData;
@@ -131,8 +144,8 @@ class q extends C {
131
144
  return;
132
145
  }
133
146
  this._showExecutionPanel = !0, this._executingScript = !0, this._consoleLogs = [], setTimeout(() => void (async () => {
134
- const n = this._codeEditorElt.value?.value;
135
- this._executionResult = await v(t.definition, n, e, (r) => setTimeout(() => this._consoleLogs = [...this._consoleLogs, r], 0)), this._executingScript = !1;
147
+ const d = this._codeEditorElt.value?.value;
148
+ this._executionResult = await x(t.definition, d, e, (n) => setTimeout(() => this._consoleLogs = [...this._consoleLogs, n], 0)), this._executingScript = !1;
136
149
  })(), 0);
137
150
  }
138
151
  _toggleShowExecutionPanel() {
@@ -165,7 +178,7 @@ class q extends C {
165
178
  // An unique identifier for the action.
166
179
  id: "run-script",
167
180
  label: "Run Arcade Expression",
168
- keybindings: [D.F5],
181
+ keybindings: [B.F5],
169
182
  contextMenuGroupId: "code",
170
183
  contextMenuOrder: 1,
171
184
  run: () => {
@@ -179,22 +192,22 @@ class q extends C {
179
192
  t !== -1 && this._disposables.splice(t, 1), e.dispose();
180
193
  }
181
194
  async _updateArcadeAssistantRemoteState() {
182
- this.arcadeAssistant && (this._arcadeAssistantRemoteState = await G({
195
+ this.arcadeAssistant && (this._arcadeAssistantRemoteState = await X({
183
196
  ...this.arcadeAssistant,
184
197
  profile: this.profile
185
198
  }));
186
199
  }
187
200
  renderMainActionBar() {
188
- return this.testData ? i`<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=${() => void this._executeScript().catch(o(this))}></calcite-action>${this._executionResult ? i`<calcite-action .text=${this.messages.lastresults ?? ""} .active=${this._showExecutionPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>` : null}</calcite-action-group></calcite-action-bar>` : null;
201
+ return this.testData ? s`<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=${() => void this._executeScript().catch(o(this))}></calcite-action>${this._executionResult ? s`<calcite-action .text=${this.messages.lastresults ?? ""} .active=${this._showExecutionPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>` : null}</calcite-action-group></calcite-action-bar>` : null;
189
202
  }
190
203
  renderMainPanel() {
191
- return i`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${d.languageId} .value=${this.script ?? ""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${U(this._codeEditorElt)}></arcgis-code-editor>`;
204
+ return s`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${c.languageId} .value=${this.script ?? ""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${H(this._codeEditorElt)}></arcgis-code-editor>`;
192
205
  }
193
- renderAction({ id: e, label: t, icon: n, active: r, panelName: h, iconFlipRtl: p = !1, onClick: u = this._toggleSidePanel }) {
194
- return i`<calcite-action id=${e ?? P} .text=${t} .textEnabled=${this.sideActionBarExpanded} .icon=${n} .active=${r} @click=${u} data-panel-name=${h ?? P} .iconFlipRtl=${p}></calcite-action>${!this.sideActionBarExpanded && i`<calcite-tooltip .referenceElement=${e}><span>${t}</span></calcite-tooltip>` || ""}`;
206
+ renderAction({ id: e, label: t, icon: d, active: n, panelName: h, iconFlipRtl: p = !1, onClick: u = this._toggleSidePanel }) {
207
+ return s`<calcite-action id=${e ?? b} .text=${t} .textEnabled=${this.sideActionBarExpanded} .icon=${d} .active=${n} @click=${u} data-panel-name=${h ?? b} .iconFlipRtl=${p}></calcite-action>${!this.sideActionBarExpanded && s`<calcite-tooltip .referenceElement=${e}><span>${t}</span></calcite-tooltip>` || ""}`;
195
208
  }
196
209
  renderSideActionBar() {
197
- return this.hideSideBar ? null : i`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({
210
+ return this.hideSideBar ? null : s`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({
198
211
  id: "profile-variables-action",
199
212
  label: this.messages.profilevariables ?? "",
200
213
  icon: "profile-variables",
@@ -238,13 +251,13 @@ class q extends C {
238
251
  if (this.hideSideBar)
239
252
  return null;
240
253
  const { openedSidePanel: e } = this;
241
- return i`<arcgis-language-api-panel slot=side-panel class=${c(e === "api" ? "" : "hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .closed=${e !== "api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${c(e === "variables" ? "" : "hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e !== "variables"}></arcgis-editor-variables>${this.suggestions?.length && i`<arcgis-arcade-suggestions slot=side-panel class=${c(e === "suggestions" ? "" : "hidden")} .closed=${e !== "suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none></arcgis-arcade-suggestions>` || ""}${this.arcadeAssistant && this._arcadeAssistantRemoteState.shouldRender && i`<arcgis-arcade-coding-assistant slot=side-panel class=${c(e === "arcade-assistant" ? "" : "hidden")} .closed=${e !== "arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._toggleSidePanel} .portalUrl=${this.arcadeAssistant.portalUrl} .serviceUrl=${this._arcadeAssistantRemoteState.serviceUrl} .helpBase=${this._arcadeAssistantRemoteState.helpBase} .assistantsEnabled=${this._arcadeAssistantRemoteState.assistantsEnabled} .feedbackServiceUrl=${this._arcadeAssistantRemoteState.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant.appVersion}></arcgis-arcade-coding-assistant>` || ""}${this.customPanels?.map((t) => i`<calcite-flow slot=side-panel class=${c(e === t.id ? "" : "hidden")}>${t?.useFlows ? t.renderer?.({
254
+ return s`<arcgis-language-api-panel slot=side-panel class=${l(e === "api" ? "" : "hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .closed=${e !== "api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${l(e === "variables" ? "" : "hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e !== "variables"}></arcgis-editor-variables>${this.suggestions?.length && s`<arcgis-arcade-suggestions slot=side-panel class=${l(e === "suggestions" ? "" : "hidden")} .closed=${e !== "suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none></arcgis-arcade-suggestions>` || ""}${this.arcadeAssistant && this._arcadeAssistantRemoteState.shouldRender && s`<arcgis-arcade-coding-assistant slot=side-panel class=${l(e === "arcade-assistant" ? "" : "hidden")} .closed=${e !== "arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._toggleSidePanel} .portalUrl=${this.arcadeAssistant.portalUrl} .serviceUrl=${"serviceUrl" in this._arcadeAssistantRemoteState ? this._arcadeAssistantRemoteState.serviceUrl : void 0} .helpBase=${this._arcadeAssistantRemoteState.helpBase} .assistantsEnabled=${this._arcadeAssistantRemoteState.assistantsEnabled} .feedbackServiceUrl=${this._arcadeAssistantRemoteState.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant.appVersion}></arcgis-arcade-coding-assistant>` || ""}${this.customPanels?.map((t) => s`<calcite-flow slot=side-panel class=${l(e === t.id ? "" : "hidden")}>${t?.useFlows ? t.renderer?.({
242
255
  closePanel: this._toggleSidePanel,
243
256
  insertText: this._insertText.bind(this),
244
257
  closed: e !== t.id,
245
258
  /** pass this.el instead of "this" as it is what actually gets attached to the dom */
246
259
  editorRef: this.el
247
- }) : i`<calcite-flow-item .heading=${t.name} heading-level=2 closable .closed=${e !== t.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${t.description}>${t.renderer?.({
260
+ }) : s`<calcite-flow-item .heading=${t.name} heading-level=2 closable .closed=${e !== t.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${t.description}>${t.renderer?.({
248
261
  closePanel: this._toggleSidePanel,
249
262
  insertText: this._insertText.bind(this),
250
263
  closed: e !== t.id,
@@ -253,13 +266,13 @@ class q extends C {
253
266
  })}</calcite-flow-item>`}</calcite-flow>`)}`;
254
267
  }
255
268
  renderResultsPanel() {
256
- return this._showExecutionPanel ? i`<arcgis-arcade-results slot=results-panel .openedResultPanel=${this._resultPanel} .loading=${this._executingScript} .result=${this._executionResult} .consoleLogs=${this._consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>` : null;
269
+ return this._showExecutionPanel ? s`<arcgis-arcade-results slot=results-panel .openedResultPanel=${this._resultPanel} .loading=${this._executingScript} .result=${this._executionResult} .consoleLogs=${this._consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>` : null;
257
270
  }
258
271
  render() {
259
- return i`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`;
272
+ return s`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`;
260
273
  }
261
274
  }
262
- w("arcgis-arcade-editor", q);
275
+ D("arcgis-arcade-editor", K);
263
276
  export {
264
- q as ArcgisArcadeEditor
277
+ K as ArcgisArcadeEditor
265
278
  };
@@ -1,16 +1,16 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
2
2
  import { c as I } from "../../chunks/runtime.js";
3
- import { css as T, html as t, unsafeCSS as D } from "lit";
4
- import { nothing as w, LitElement as O, createEvent as y, safeClassMap as h } from "@arcgis/lumina";
3
+ import { css as w, html as t, unsafeCSS as D } from "lit";
4
+ import { nothing as T, LitElement as O, createEvent as y, safeClassMap as h } from "@arcgis/lumina";
5
5
  import { setValuesInString as o, quoteString as g } from "@arcgis/toolkit/string";
6
6
  import { B as x, v as b, M as m, f as L, a as A, b as F } from "../../chunks/arcade-executor.js";
7
7
  import { u as _ } from "../../chunks/useT9n.js";
8
8
  import { s as j } from "../../chunks/fields.js";
9
9
  import "@arcgis/toolkit/function";
10
- import { createRef as v, ref as $ } from "lit/directives/ref.js";
10
+ import { createRef as v, ref as f } from "lit/directives/ref.js";
11
11
  import { t as k } from "../../chunks/monaco-theme.js";
12
12
  import { observeAncestorsMutation as z, unsafeGetCalciteModeName as N } from "@arcgis/toolkit/dom";
13
- const E = T`:host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);.flex-adjustable{flex:1 1 auto;overflow:hidden}.flex-row{display:flex;flex-direction:row;overflow:hidden}.flex-column{display:flex;flex-direction:column;overflow:hidden}.y-scrollable-container{overflow-y:auto;block-size:100%;background-color:var(--calcite-color-foreground-1)}header{border-bottom:1px solid var(--calcite-color-border-3);flex:0 0 auto}.ltr-container{direction:ltr}calcite-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm);calcite-action{padding-inline-end:var(--calcite-spacing-sm)}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)}}.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.color-info{color:var(--calcite-color-status-info)}.color-error{color:var(--calcite-color-status-danger)}.color-success{color:var(--calcite-color-status-success)}[class*=result-value-]{font-size:var(--calcite-font-size--2);line-height:1.25rem;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-md)}.console-logs-container{background-color:var(--calcite-color-foreground-1);padding:0 var(--calcite-spacing-md);font-family:var(--calcite-code-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal)}.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;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}}.tree-item-label,.number-value,.string-value,.boolean-value{font-family:var(--calcite-code-family)}.tree-item-label,.value-type{color:var(--calcite-color-text-2);font-weight:var(--calcite-font-weight-normal)}.dictionary-property{color:var(--arcgis-editor-identifier)}.number-value{color:var(--arcgis-editor-number)}.string-value{color:var(--arcgis-editor-string);white-space:pre-wrap}.constant-value{color:var(--arcgis-editor-constant)}.date-value{color:var(--arcgis-editor-date)}}`, l = {
13
+ const E = w`:host{display:flex;flex-direction:column;width:100%;background-color:var(--calcite-color-foreground-1);color:var(--calcite-color-text-2);.flex-adjustable{flex:1 1 auto;overflow:hidden}.flex-row{display:flex;flex-direction:row;overflow:hidden}.flex-column{display:flex;flex-direction:column;overflow:hidden;min-height:0}.y-scrollable-container{overflow-y:auto;block-size:100%;background-color:var(--calcite-color-foreground-1)}header{border-bottom:1px solid var(--calcite-color-border-3);flex:0 0 auto}.ltr-container{direction:ltr}calcite-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm);calcite-action{padding-inline-end:var(--calcite-spacing-sm)}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)}}.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.color-info{color:var(--calcite-color-status-info)}.color-error{color:var(--calcite-color-status-danger)}.color-success{color:var(--calcite-color-status-success)}[class*=result-value-]{font-size:var(--calcite-font-size--2);line-height:1.25rem;background-color:var(--calcite-color-foreground-1);margin:var(--calcite-spacing-md)}.console-logs-container{background-color:var(--calcite-color-foreground-1);padding:0 var(--calcite-spacing-md);font-family:var(--calcite-code-family);font-size:var(--calcite-font-size--2);font-weight:var(--calcite-font-weight-normal)}.result-value-table{display:flex;flex-direction:column;min-height:0;.table-scroll{overflow:auto;flex:1 1 auto;min-height:0;max-width:100%;background-color:var(--calcite-color-foreground-1)}table{min-width:max-content;border-spacing:0;border-collapse:collapse;text-align:start;white-space:nowrap;thead{background-color:var(--calcite-color-foreground-2)}tr{border-top:1px solid var(--calcite-color-border-3);border-bottom:1px solid var(--calcite-color-border-3)}th,td{border-inline-start:1px solid var(--calcite-color-border-3);border-inline-end:1px solid var(--calcite-color-border-3);text-align:start;padding:var(--calcite-spacing-xxs);.string-value{white-space:pre}}th{font-weight:var(--calcite-font-weight-medium)}}}.tree-item-label,.number-value,.string-value,.boolean-value{font-family:var(--calcite-code-family)}.tree-item-label,.value-type{color:var(--calcite-color-text-2);font-weight:var(--calcite-font-weight-normal)}.dictionary-property{color:var(--arcgis-editor-identifier)}.number-value{color:var(--arcgis-editor-number)}.string-value{color:var(--arcgis-editor-string);white-space:pre-wrap}.constant-value{color:var(--arcgis-editor-constant)}.date-value{color:var(--arcgis-editor-date)}}`, l = {
14
14
  lines: !0,
15
15
  selectionMode: "none",
16
16
  scale: "s",
@@ -20,7 +20,7 @@ const E = T`:host{display:flex;flex-direction:column;width:100%;background-color
20
20
  const a = e.currentTarget;
21
21
  a.expanded = !a.expanded;
22
22
  }
23
- }, r = ({ name: e }) => t`<span class="dictionary-property">${e}</span><span>:&nbsp;</span>`, S = ({ value: e, subtree: a = !1 }) => t`<calcite-tree slot=${(a ? "children" : void 0) ?? w} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item class="string-value">${JSON.stringify(e.castAsJson(), void 0, 2)}</calcite-tree-item></calcite-tree>`, P = ({ value: e, subtree: a = !1 }) => t`<calcite-tree slot=${(a ? "children" : void 0) ?? w} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item><div class="tree-item-label">${r({ name: "type" })}${e.type}</div></calcite-tree-item><calcite-tree-item><div class="tree-item-label">${r({ name: "value" })}<span class="string-value">${JSON.stringify(e, void 0, 2)}</span></div></calcite-tree-item></calcite-tree>`, p = ({ arcadeResult: e }) => {
23
+ }, r = ({ name: e }) => t`<span class="dictionary-property">${e}</span><span>:&nbsp;</span>`, S = ({ value: e, subtree: a = !1 }) => t`<calcite-tree slot=${(a ? "children" : void 0) ?? T} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item class="string-value">${JSON.stringify(e.castAsJson(), void 0, 2)}</calcite-tree-item></calcite-tree>`, P = ({ value: e, subtree: a = !1 }) => t`<calcite-tree slot=${(a ? "children" : void 0) ?? T} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}><calcite-tree-item><div class="tree-item-label">${r({ name: "type" })}${e.type}</div></calcite-tree-item><calcite-tree-item><div class="tree-item-label">${r({ name: "value" })}<span class="string-value">${JSON.stringify(e, void 0, 2)}</span></div></calcite-tree-item></calcite-tree>`, p = ({ arcadeResult: e }) => {
24
24
  switch (e.type) {
25
25
  case "unknown":
26
26
  case "null":
@@ -49,14 +49,14 @@ const E = T`:host{display:flex;flex-direction:column;width:100%;background-color
49
49
  const i = e.geometry?.();
50
50
  return t`<calcite-tree slot=${"children"} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${e.keys().map((c) => {
51
51
  const n = b(e.field(c));
52
- return e.arcadeDeclaredClass === "esri.arcade.Feature" && n.type === "geometry" ? null : f({ arcadeResult: n, name: c, t9nStrings: s });
53
- })}${i ? f({ arcadeResult: { type: "geometry", value: i }, name: "geometry", t9nStrings: s }) : null}</calcite-tree>`;
52
+ return e.arcadeDeclaredClass === "esri.arcade.Feature" && n.type === "geometry" ? null : $({ arcadeResult: n, name: c, t9nStrings: s });
53
+ })}${i ? $({ arcadeResult: { type: "geometry", value: i }, name: "geometry", t9nStrings: s }) : null}</calcite-tree>`;
54
54
  }, V = ({ arcadeResult: e, t9nStrings: a }) => t`<div class="value-type"><span>${e.type}:</span>${e.features.length >= x ? t`<span>&nbsp;${o(a.showingfirstitemsformat, {
55
55
  count: x.toString()
56
56
  })}</span>` : null}</div>`, M = ({ items: e, subtree: a, t9nStrings: s }) => t`<calcite-tree slot=${"children"} .lines=${l.lines} .selectionMode=${l.selectionMode} .scale=${l.scale} @calciteTreeSelect=${l.oncalciteTreeSelect}>${e.map((i, c) => {
57
57
  const n = b(i);
58
- return f({ arcadeResult: n, name: c, expanded: !a, t9nStrings: s });
59
- })}</calcite-tree>`, f = ({ arcadeResult: e, name: a, expanded: s, t9nStrings: i }) => {
58
+ return $({ arcadeResult: n, name: c, expanded: !a, t9nStrings: s });
59
+ })}</calcite-tree>`, $ = ({ arcadeResult: e, name: a, expanded: s, t9nStrings: i }) => {
60
60
  switch (e.type) {
61
61
  case "null":
62
62
  case "unknown":
@@ -84,14 +84,14 @@ const E = T`:host{display:flex;flex-direction:column;width:100%;background-color
84
84
  }
85
85
  }, J = ({ arcadeResult: e }) => {
86
86
  const a = j(e.value.fields);
87
- return t`<table><thead><tr>${a.map((s) => t`<th>${s.name}</th>`)}</tr></thead><tbody>${e.features.map((s) => t`<tr>${a.map((i) => {
87
+ return t`<div class="table-scroll"><table><thead><tr>${a.map((s) => t`<th>${s.name}</th>`)}</tr></thead><tbody>${e.features.map((s) => t`<tr>${a.map((i) => {
88
88
  try {
89
89
  const c = b(s.field(i.name));
90
90
  return t`<td>${p({ arcadeResult: c })}</td>`;
91
91
  } catch {
92
92
  return t`<td></td>`;
93
93
  }
94
- })}</tr>`)}</tbody></table>`;
94
+ })}</tr>`)}</tbody></table></div>`;
95
95
  };
96
96
  function G() {
97
97
  let e = `:host {
@@ -109,7 +109,7 @@ function G() {
109
109
  --arcgis-editor-${i}: ${c};`;
110
110
  }), e += `
111
111
  }
112
- `, T`
112
+ `, w`
113
113
  ${D(e)}
114
114
  `;
115
115
  }
@@ -219,7 +219,7 @@ class B extends O {
219
219
  }
220
220
  }
221
221
  render() {
222
- return t`<header class="flex-row"><calcite-action-bar class="flex-adjustable" layout=horizontal scale=s expanded expand-disabled><calcite-action-group scale=s><calcite-action .active=${this.openedResultPanel === "output"} .text=${this.messages.output ?? ""} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=output ${$(this.outputRef)}></calcite-action><calcite-action .active=${this.openedResultPanel === "console"} .text=${this.messages.console ?? ""} text-enabled scale=s icon=console icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=console ${$(this.consoleRef)}></calcite-action><calcite-action .active=${this.openedResultPanel === "log"} .text=${this.messages.log ?? ""} text-enabled scale=s icon=list icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=log ${$(this.logRef)}></calcite-action></calcite-action-group></calcite-action-bar><calcite-action scale=s icon=x .text=${this.messages.close ?? ""} @click=${this._emitClose}></calcite-action></header><article class="flex-adjustable">${this.loading ? t`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading ?? "Loading"}></calcite-loader>` : t`<div class="flex-column y-scrollable-container">${this.renderOutputPanel()}${this.renderConsolePanel()}${this.renderLogPanel()}</div>`}</article>`;
222
+ return t`<header class="flex-row"><calcite-action-bar class="flex-adjustable" layout=horizontal scale=s expanded expand-disabled><calcite-action-group scale=s><calcite-action .active=${this.openedResultPanel === "output"} .text=${this.messages.output ?? ""} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=output ${f(this.outputRef)}></calcite-action><calcite-action .active=${this.openedResultPanel === "console"} .text=${this.messages.console ?? ""} text-enabled scale=s icon=console icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=console ${f(this.consoleRef)}></calcite-action><calcite-action .active=${this.openedResultPanel === "log"} .text=${this.messages.log ?? ""} text-enabled scale=s icon=list icon-flip-rtl @click=${this._switchResultPanel} data-panel-name=log ${f(this.logRef)}></calcite-action></calcite-action-group></calcite-action-bar><calcite-action scale=s icon=x .text=${this.messages.close ?? ""} @click=${this._emitClose}></calcite-action></header><article class="flex-adjustable">${this.loading ? t`<calcite-loader scale=s type=indeterminate .label=${this.messages.loading ?? "Loading"}></calcite-loader>` : t`<div class="flex-column y-scrollable-container">${this.renderOutputPanel()}${this.renderConsolePanel()}${this.renderLogPanel()}</div>`}</article>`;
223
223
  }
224
224
  }
225
225
  I("arcgis-arcade-results", B);