@arcgis/coding-components 5.1.0-next.55 → 5.1.0-next.56
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/{PKG2K3V2.js → 23B5EVBR.js} +1 -1
- package/dist/cdn/2RXM4OOZ.js +2 -0
- package/dist/cdn/2XTHR2WZ.js +2 -0
- package/dist/cdn/5PWITOEV.js +2 -0
- package/dist/cdn/A53COIII.js +6 -0
- package/dist/cdn/AESP7B22.js +2 -0
- package/dist/cdn/AHN2NEBT.js +2 -0
- package/dist/cdn/{54ZOADNQ.js → BXUVVQLE.js} +1 -1
- package/dist/cdn/BYHBHJML.js +2 -0
- package/dist/cdn/CLBLJN2Z.js +7 -0
- package/dist/cdn/CZ2DJPO4.js +2 -0
- package/dist/cdn/DGFH2WPL.js +2 -0
- package/dist/cdn/{RJRCBNNO.js → DJYSIOXC.js} +1 -1
- package/dist/cdn/FLNLMLTL.js +2 -0
- package/dist/cdn/ITDFOKJG.js +2 -0
- package/dist/cdn/MH4UADDE.js +2 -0
- package/dist/cdn/{UZJHWA6T.js → ODKUCLFB.js} +1 -1
- package/dist/cdn/{PVL67WGX.js → PD5NEK47.js} +1 -1
- package/dist/cdn/PRB6IWVU.js +2 -0
- package/dist/cdn/{4A2CLADY.js → QCARFVF7.js} +1 -1
- package/dist/cdn/{6YD47X7H.js → QF6ON7LK.js} +1 -1
- package/dist/cdn/QRDRCFJZ.js +2 -0
- package/dist/cdn/SV4IPD4A.js +2 -0
- package/dist/cdn/UH44LJA7.js +4 -0
- package/dist/cdn/VF7TALAI.js +12 -0
- package/dist/cdn/VPP77CFW.js +2 -0
- package/dist/cdn/YPMKBMXS.js +2 -0
- package/dist/cdn/ZHZFKZA7.js +2 -0
- package/dist/cdn/assets/arcade-editor/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +119 -116
- package/dist/cdn/assets/code-editor/sql-layer.worker.js +10087 -0
- package/dist/cdn/assets/editor-variables/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/sql-expression-editor/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/sql-layer-editor/t9n/messages.en.json +1 -0
- package/dist/cdn/index.js +1 -1
- package/dist/cdn/main.css +1 -1
- package/dist/chunks/arcade-defaults.js +98 -96
- package/dist/chunks/arcade-service-accessors.js +40 -28
- package/dist/chunks/bigquery.js +186 -0
- package/dist/chunks/colorize.js +1 -1
- package/dist/chunks/fields.js +2 -2
- package/dist/chunks/language-defaults-base.js +733 -464
- package/dist/chunks/postgres.js +209 -0
- package/dist/chunks/setup-monaco-theme.js +28 -20
- package/dist/chunks/sql-expr-defaults.js +11 -10
- package/dist/chunks/sql-layer-defaults.js +231 -0
- package/dist/chunks/sql-layer-mode.js +301 -0
- package/dist/chunks/sqlServer.js +288 -0
- package/dist/chunks/utils.js +184 -0
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +134 -123
- package/dist/components/arcgis-arcade-editor/customElement.d.ts +17 -0
- package/dist/components/arcgis-arcade-editor/customElement.js +22 -22
- package/dist/components/arcgis-code-editor/customElement.d.ts +2 -1
- package/dist/components/arcgis-code-editor/customElement.js +91 -71
- package/dist/components/arcgis-editor-variables/customElement.js +50 -47
- package/dist/components/arcgis-sql-expression-editor/customElement.d.ts +12 -0
- package/dist/components/arcgis-sql-expression-editor/customElement.js +17 -17
- package/dist/components/arcgis-sql-layer-editor/customElement.d.ts +50 -0
- package/dist/components/arcgis-sql-layer-editor/customElement.js +92 -0
- package/dist/components/arcgis-sql-layer-editor/index.d.ts +1 -0
- package/dist/components/arcgis-sql-layer-editor/index.js +7 -0
- package/dist/components/types.d.ts +79 -2
- 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/index.d.ts +10 -0
- package/dist/loader.js +6 -5
- package/dist/types/lumina.d.ts +9 -2
- package/dist/types/preact.d.ts +10 -2
- package/dist/types/react.d.ts +11 -2
- package/dist/types/stencil.d.ts +9 -2
- package/dist/utils/data-catalog-datastore.d.ts +170 -0
- package/package.json +5 -5
- package/dist/cdn/5CO7XWOT.js +0 -2
- package/dist/cdn/5FXY5U3T.js +0 -2
- package/dist/cdn/CYC4AWZE.js +0 -2
- package/dist/cdn/GVO3LEFV.js +0 -2
- package/dist/cdn/J5X2KSYD.js +0 -2
- package/dist/cdn/QHJAF7L3.js +0 -6
- package/dist/cdn/T7GEIGWF.js +0 -2
- package/dist/cdn/TAXRVBJC.js +0 -2
- package/dist/cdn/VR5CATAW.js +0 -2
- package/dist/cdn/WTNM2NCZ.js +0 -2
- package/dist/cdn/XEUG3X2W.js +0 -2
- package/dist/cdn/ZJCI6LP6.js +0 -12
- package/dist/cdn/ZSVJAJND.js +0 -4
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.1/LICENSE.txt */
|
|
2
|
-
import { c as
|
|
3
|
-
import { css as
|
|
4
|
-
import { nothing as q, safeClassMap as
|
|
5
|
-
import { ref as
|
|
6
|
-
import
|
|
7
|
-
import { u as
|
|
8
|
-
import { b as
|
|
2
|
+
import { c as ae } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as se, html as d } from "lit";
|
|
4
|
+
import { nothing as q, safeClassMap as ne, LitElement as re } from "@arcgis/lumina";
|
|
5
|
+
import { ref as ce, createRef as le } from "lit/directives/ref.js";
|
|
6
|
+
import de from "@arcgis/core/identity/IdentityManager.js";
|
|
7
|
+
import { u as pe } from "../../chunks/useT9n.js";
|
|
8
|
+
import { b as _ } from "../../chunks/arcade-defaults.js";
|
|
9
9
|
import N from "@arcgis/core/request.js";
|
|
10
|
-
import { e as
|
|
10
|
+
import { e as ue, a as he } from "../../chunks/utilities.js";
|
|
11
11
|
import { repeat as X } from "lit/directives/repeat.js";
|
|
12
12
|
import "@arcgis/toolkit/function";
|
|
13
|
-
import { generateGuid as
|
|
14
|
-
import { unsafeHTML as
|
|
15
|
-
import
|
|
13
|
+
import { generateGuid as me } from "@arcgis/toolkit/string";
|
|
14
|
+
import { unsafeHTML as C } from "lit/directives/unsafe-html.js";
|
|
15
|
+
import fe from "@arcgis/core/layers/FeatureLayer.js";
|
|
16
16
|
import U from "@arcgis/core/config.js";
|
|
17
17
|
import L from "@arcgis/core/Graphic.js";
|
|
18
18
|
import { log as w } from "@arcgis/toolkit/log";
|
|
19
|
-
import { getDeclaredVoxelMembers as
|
|
20
|
-
import { s as
|
|
21
|
-
import {
|
|
22
|
-
import
|
|
23
|
-
import { property as f, subclass as
|
|
24
|
-
const
|
|
25
|
-
class
|
|
19
|
+
import { getDeclaredVoxelMembers as be, getDeclaredPixelMembers as ge } from "@arcgis/core/applications/Components/arcadeEditorUtils.js";
|
|
20
|
+
import { s as ve } from "../../chunks/fields.js";
|
|
21
|
+
import { f as Z, m as ee, n as ye } from "../../chunks/utils.js";
|
|
22
|
+
import we from "@arcgis/core/core/Accessor.js";
|
|
23
|
+
import { property as f, subclass as $e } from "@arcgis/core/core/accessorSupport/decorators.js";
|
|
24
|
+
const xe = se`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`;
|
|
25
|
+
class A extends Error {
|
|
26
26
|
constructor({
|
|
27
27
|
message: e,
|
|
28
28
|
code: t,
|
|
@@ -46,7 +46,7 @@ function O(i) {
|
|
|
46
46
|
return;
|
|
47
47
|
}
|
|
48
48
|
}
|
|
49
|
-
async function
|
|
49
|
+
async function ke(i) {
|
|
50
50
|
const { baseUrl: e, skillId: t, message: o, authToken: a, previousConversationId: n, context: c } = i, p = t ? `${e}/skills/${t}/chat` : `${e}/chat`, r = [], s = {
|
|
51
51
|
message: o,
|
|
52
52
|
context: c
|
|
@@ -65,18 +65,18 @@ async function $e(i) {
|
|
|
65
65
|
});
|
|
66
66
|
} catch (b) {
|
|
67
67
|
const g = b, x = g.details?.rawResponse || g.message || String(b), k = O(x);
|
|
68
|
-
throw k ? new
|
|
68
|
+
throw k ? new A(k) : b;
|
|
69
69
|
}
|
|
70
70
|
const l = u.data;
|
|
71
71
|
r.push(l);
|
|
72
|
-
const v = l.conversationId,
|
|
72
|
+
const v = l.conversationId, V = l.inquiryId;
|
|
73
73
|
let $ = l.sequenceNumber;
|
|
74
74
|
async function T() {
|
|
75
75
|
let b = 0;
|
|
76
76
|
const g = 100;
|
|
77
77
|
for (; b < g; ) {
|
|
78
78
|
await new Promise((S) => setTimeout(S, 1e3));
|
|
79
|
-
const x =
|
|
79
|
+
const x = Se(v, $, V);
|
|
80
80
|
let k;
|
|
81
81
|
try {
|
|
82
82
|
k = await N(p, {
|
|
@@ -89,12 +89,12 @@ async function $e(i) {
|
|
|
89
89
|
responseType: "json"
|
|
90
90
|
});
|
|
91
91
|
} catch (S) {
|
|
92
|
-
const
|
|
93
|
-
throw
|
|
92
|
+
const P = S, oe = P.details?.rawResponse || P.message || String(S), D = O(oe);
|
|
93
|
+
throw D ? new A(D) : S;
|
|
94
94
|
}
|
|
95
95
|
const y = k.data;
|
|
96
96
|
if (y.context?.kind === "ArcgisErrorAsContext" && y.context.error)
|
|
97
|
-
throw new
|
|
97
|
+
throw new A({
|
|
98
98
|
message: y.context.error.message || "ArcGIS Assistant error",
|
|
99
99
|
code: y.context.error.code,
|
|
100
100
|
subCode: y.context.error.subCode,
|
|
@@ -105,7 +105,7 @@ async function $e(i) {
|
|
|
105
105
|
break;
|
|
106
106
|
}
|
|
107
107
|
if (b === g)
|
|
108
|
-
throw new
|
|
108
|
+
throw new A({
|
|
109
109
|
message: "Request timed out",
|
|
110
110
|
code: "TIMEOUT",
|
|
111
111
|
source: "polling"
|
|
@@ -117,7 +117,7 @@ async function $e(i) {
|
|
|
117
117
|
new Promise(
|
|
118
118
|
(b, g) => setTimeout(
|
|
119
119
|
() => g(
|
|
120
|
-
new
|
|
120
|
+
new A({
|
|
121
121
|
message: "Request timed out",
|
|
122
122
|
code: "TIMEOUT",
|
|
123
123
|
source: "hard-timeout"
|
|
@@ -128,20 +128,20 @@ async function $e(i) {
|
|
|
128
128
|
)
|
|
129
129
|
]), r;
|
|
130
130
|
}
|
|
131
|
-
function
|
|
131
|
+
function Se(i, e, t) {
|
|
132
132
|
return {
|
|
133
133
|
conversationId: i,
|
|
134
134
|
inquiryId: t,
|
|
135
135
|
ackSequenceNumber: e
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function Ae(i) {
|
|
139
139
|
return i.message.match(/Error in prompt shield/u) ? "I'm having trouble with this request. Try again by rephrasing the question." : i.code === "TIMEOUT" ? "Request timed out. Try again by re-asking the same question or rephrasing it." : i.message;
|
|
140
140
|
}
|
|
141
|
-
const
|
|
141
|
+
const Ce = ({ notices: i }) => i.length ? d`<div class="border-block-end">${X(i, (e) => e.id ?? e.title, (e) => d`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${() => e.onClose?.()}><div slot=title>${e.title}</div>${e.message && d`<div slot=message>${e.message}</div>` || ""}${e.actionLinkMessage && e.onAction && d`<calcite-link slot=link @click=${() => e.onAction?.()}>${e.actionLinkMessage}</calcite-link>` || ""}</calcite-notice>`)}</div>` : null, Te = (i) => {
|
|
142
142
|
const e = i.value.length, t = 72, o = 180, a = i.offsetWidth, c = Math.max(1, Math.floor(a / 8)), p = Math.ceil(e / c), r = t + (p - 2) * 24;
|
|
143
143
|
i.style.setProperty("--calcite-text-area-min-height", `${Math.min(r, o)}px`);
|
|
144
|
-
},
|
|
144
|
+
}, Ie = ({ promptValidationMessage: i, errorMessage: e, contextTooBig: t, contextReducedNoticeDismissed: o, setContextReducedNoticeDismissed: a, setErrorMessage: n, messages: c }) => {
|
|
145
145
|
const p = [];
|
|
146
146
|
if (i && p.push({
|
|
147
147
|
id: "prompt-validation",
|
|
@@ -170,23 +170,23 @@ const Se = ({ notices: i }) => i.length ? d`<div class="border-block-end">${X(i,
|
|
|
170
170
|
}
|
|
171
171
|
return p;
|
|
172
172
|
};
|
|
173
|
-
function
|
|
173
|
+
function Ee({ messages: i }) {
|
|
174
174
|
return d`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta ?? "Beta"}>${i.beta ?? "Beta"}</calcite-chip>`;
|
|
175
175
|
}
|
|
176
|
-
function
|
|
176
|
+
function Re({ popoverContent: i, messages: e }) {
|
|
177
177
|
return d`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer ?? "Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${i}</div></calcite-popover>`;
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function Fe({ errorMessage: i, slot: e }) {
|
|
180
180
|
return d`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ?? q}>${i}</calcite-input-message></div>`;
|
|
181
181
|
}
|
|
182
|
-
function
|
|
182
|
+
function Me({ active: i, setActive: e, messages: t }) {
|
|
183
183
|
return d`<calcite-alert slot=alerts .open=${i} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${() => e(!1)} .label=${t.expressionapplied ?? "Expression applied"}><div slot=message>${t.expressionapplied ?? "Expression applied to editor."}</div></calcite-alert>`;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function qe({ context: i, messages: e }) {
|
|
186
186
|
return i ? d`<div class="gaps">${i.profileId && d`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>` || ""}</div>` : null;
|
|
187
187
|
}
|
|
188
|
-
function
|
|
189
|
-
const b = $?.contextTooLarge ?? !1, g =
|
|
188
|
+
function Ve({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef: a, question: n, errorMessage: c, setErrorMessage: p, promptValidationMessage: r, setPromptValidationMessage: s, submitQuestion: u, messages: l, mode: v, assistantRef: V, context: $, contextReducedNoticeDismissed: T, setContextReducedNoticeDismissed: I }) {
|
|
189
|
+
const b = $?.contextTooLarge ?? !1, g = Ie({
|
|
190
190
|
promptValidationMessage: r,
|
|
191
191
|
errorMessage: c,
|
|
192
192
|
contextTooBig: b,
|
|
@@ -195,9 +195,9 @@ function Me({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult:
|
|
|
195
195
|
setErrorMessage: p,
|
|
196
196
|
messages: l
|
|
197
197
|
});
|
|
198
|
-
return d`<div class="text-area-wrapper">${
|
|
199
|
-
|
|
200
|
-
}} ${
|
|
198
|
+
return d`<div class="text-area-wrapper">${Ce({ notices: g })}<calcite-text-area scale=s resize=vertical .readOnly=${i || e} class=${ne(g.length ? "submission-text-area" : "submission-text-area round-top")} .placeholder=${l.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${(x) => {
|
|
199
|
+
Te(x.target), t(x.target.value);
|
|
200
|
+
}} ${ce(a)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${$ && qe({ context: $, messages: l }) || ""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${v !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${i} @click=${async () => {
|
|
201
201
|
o(!1), t("");
|
|
202
202
|
}} .label=${l.startover ?? "Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${v !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async () => {
|
|
203
203
|
o(!1), t("");
|
|
@@ -215,53 +215,57 @@ function Me({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult:
|
|
|
215
215
|
s(void 0), await u();
|
|
216
216
|
}} class="hidden-above-380" .label=${v === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${v === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-tooltip></div></div></div></calcite-text-area></div>`;
|
|
217
217
|
}
|
|
218
|
-
const
|
|
219
|
-
function
|
|
218
|
+
const Pe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement", De = "https://www.esri.com/en-us/privacy/privacy-statements";
|
|
219
|
+
function _e({ setOpen: i, messages: e, feedback: t, learnMoreUrl: o, setFeedback: a, onSubmit: n }) {
|
|
220
220
|
return t.active ? d`<calcite-sheet class="feedback-sheet" .label=${e.feedback ?? "Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${() => i(!1)}><calcite-panel .heading=${e.submitfeedback ?? "Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${t.text} @calciteTextAreaInput=${(c) => a({ ...t, text: c.target.value })} .disabled=${t.submitting} .placeholder=${e.donotincludepersonalinfo ?? "Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(c) => {
|
|
221
221
|
a({ ...t, termsAccepted: c.target.checked });
|
|
222
|
-
}} .disabled=${t.submitting}></calcite-checkbox><span>${
|
|
222
|
+
}} .disabled=${t.submitting}></calcite-checkbox><span>${C((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${De} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${Pe} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${C((e.feedbackhelps ?? "Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}", `<calcite-link href=${o} target="_blank">${e.learnmore ?? "Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${() => i(!1)} .disabled=${t.submitting}>${e.cancel ?? "Cancel"}</calcite-button><calcite-button @click=${n} .disabled=${!t.termsAccepted || t.submitting} .loading=${t.submitting} data-testid=submit-feedback-button>${e.submit ?? "Submit"}</calcite-button></div></calcite-panel></calcite-sheet>` : null;
|
|
223
223
|
}
|
|
224
224
|
function z({ assistantsEnabled: i, messages: e, slot: t, helpTopicUrl: o }) {
|
|
225
|
-
return d`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? q} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new ?? "New"} kind=brand scale=s>${e.new ?? "New"}</calcite-chip></div>${i ? d`<p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind ?? "Keep in mind the following:"}<ul><li>${e.beconsise ?? "Be concise, but also clear in your request"}</li><li>${e.avoidambiguity ?? "Avoid ambiguity and vagueness"}</li><li>${e.moredetails ?? "you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${
|
|
225
|
+
return d`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? q} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new ?? "New"} kind=brand scale=s>${e.new ?? "New"}</calcite-chip></div>${i ? d`<p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind ?? "Keep in mind the following:"}<ul><li>${e.beconsise ?? "Be concise, but also clear in your request"}</li><li>${e.avoidambiguity ?? "Avoid ambiguity and vagueness"}</li><li>${e.moredetails ?? "you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${C((e.seedocumentation ?? "Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}", `<calcite-link href=${o} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : d`<p>${e.useofassistant ?? "The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg ?? "AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps ?? "Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege ?? "Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`;
|
|
226
226
|
}
|
|
227
|
-
function
|
|
228
|
-
return d`<calcite-dialog close-disabled placement=top .heading=${i.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted ?? "Before you get started be aware:"}</h3><ul><li>${i.maybeincorrect ?? "AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${
|
|
227
|
+
function Ne({ messages: i, onProceed: e, onExit: t, helpTopicUrl: o }) {
|
|
228
|
+
return d`<calcite-dialog close-disabled placement=top .heading=${i.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted ?? "Before you get started be aware:"}</h3><ul><li>${i.maybeincorrect ?? "AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${C((i.pleasereadhelp ?? "Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}", `<calcite-link href=${o} target="_blank">${i.helptopic ?? "help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed ?? "Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit ?? "Exit"}</calcite-button></calcite-dialog>`;
|
|
229
229
|
}
|
|
230
|
-
function
|
|
230
|
+
function Ue({ messages: i, suggestions: e, onSuggestionClick: t }) {
|
|
231
231
|
return d`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map((o) => d`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${i.promptsuggestion} class="suggestion-button" @click=${() => t?.(o)}>${o}</calcite-button>`)}</div></calcite-block>`;
|
|
232
232
|
}
|
|
233
|
-
const
|
|
234
|
-
function
|
|
235
|
-
return d`<calcite-block .hidden=${i} id=result-block .heading=${a ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${c && d`<calcite-chip .label=${t.assistantresponses ?? "Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses ?? "Assistant responses"}>${X(o, (s) => s.conversationId, (s) => d`<calcite-card><div slot=heading><div class="prior-prompt"><span>${s.priorPrompt.length >
|
|
233
|
+
const B = 200;
|
|
234
|
+
function j({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: a, collapsible: n = !1, showEffectsIcon: c = !1, onCopyCode: p, standalone: r }) {
|
|
235
|
+
return d`<calcite-block .hidden=${i} id=result-block .heading=${a ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${c && d`<calcite-chip .label=${t.assistantresponses ?? "Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses ?? "Assistant responses"}>${X(o, (s) => s.conversationId, (s) => d`<calcite-card><div slot=heading><div class="prior-prompt"><span>${s.priorPrompt.length > B ? `${s.priorPrompt.slice(0, B)}...` : s.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${s.conversationId}-${r ? "standalone" : "list"}`} @click=${(u) => {
|
|
236
236
|
const l = u.currentTarget;
|
|
237
237
|
navigator.clipboard.writeText(s.priorPrompt).then(() => {
|
|
238
238
|
l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
|
|
239
239
|
});
|
|
240
|
-
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${s.message && r && d`<div class="response-error-container">${
|
|
240
|
+
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${s.message && r && d`<div class="response-error-container">${Fe({ errorMessage: s.message })}</div>` || ""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext ?? "Response Context"} scale=s>${s.message && !r && d`<calcite-tooltip .referenceElement=${`response-chip-${s.conversationId}-error`} placement=top-start>${s.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${s.conversationId}-error`} .label=${t.error ?? "Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>` || ""}${Le({ card: s, messages: t })}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${s.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${() => s.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor ?? "Add to editor"} .id=${`add-to-editor-button-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start>${t.addtoeditor ?? "Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${() => s.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor ?? "Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${() => s.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start><span>${t.replaceineditor ?? "Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${(u) => {
|
|
241
241
|
const l = u.currentTarget;
|
|
242
242
|
p(s.code).then(() => {
|
|
243
243
|
l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
|
|
244
244
|
});
|
|
245
245
|
}} class="response-secondary-action-button" .id=${`copy-response-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard ?? "Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup ?? "Thumbs up"} scale=s icon=thumbs-up @click=${s.onThumbsUp} .id=${`thumbs-up-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start><span>${t.helpful ?? "Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown ?? "Thumbs down"} scale=s icon=thumbs-down @click=${s.onThumbsDown} .id=${`thumbs-down-${s.conversationId}-${r ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${s.conversationId}-${r ? "standalone" : "list"}`} placement=top-start><span>${t.unhelpful ?? "Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
|
|
246
246
|
}
|
|
247
|
-
const
|
|
248
|
-
const t =
|
|
247
|
+
const Le = ({ card: i, messages: e }) => {
|
|
248
|
+
const t = me(), o = `response-chip-profile-${i.conversationId}-${t}`, a = (e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId);
|
|
249
249
|
return d`<calcite-tooltip .referenceElement=${o} placement=top-start class="contained-popover-or-tooltip">${a}</calcite-tooltip><calcite-chip .label=${i.profileId} scale=s appearance=outline icon=map-information id=${o ?? q}>${i.profileId}</calcite-chip>`;
|
|
250
|
-
}, H = (i) => i.type === "featureSet"
|
|
251
|
-
|
|
250
|
+
}, H = (i) => i.type === "featureSet";
|
|
251
|
+
function te(i) {
|
|
252
|
+
return i && i !== "dataCatalogDatastore" ? i : void 0;
|
|
253
|
+
}
|
|
254
|
+
const E = (i) => {
|
|
255
|
+
if (!ye(i))
|
|
252
256
|
return [];
|
|
253
257
|
const e = [];
|
|
254
258
|
return i.relationships?.forEach((t) => {
|
|
255
259
|
e.push(t.toJSON());
|
|
256
260
|
}), e;
|
|
257
|
-
}, R = (i) => i.length > 0 ? { relationships: i } : {},
|
|
261
|
+
}, R = (i) => i.length > 0 ? { relationships: i } : {}, Oe = (i) => ve(i).map((e) => ({
|
|
258
262
|
alias: e.alias,
|
|
259
263
|
name: e.name,
|
|
260
264
|
type: e.type,
|
|
261
265
|
...e.domain ? { domain: e.domain } : {}
|
|
262
|
-
})), F = (i) => i ? { fields:
|
|
266
|
+
})), F = (i) => i ? { fields: Oe(i) } : { fields: [] };
|
|
263
267
|
async function G(i) {
|
|
264
|
-
const e = await i.loadSource(), t =
|
|
268
|
+
const e = await i.loadSource(), t = ee(e) && e.isTable, o = E(e);
|
|
265
269
|
return {
|
|
266
270
|
name: i.name,
|
|
267
271
|
type: "featureSet",
|
|
@@ -270,77 +274,80 @@ async function G(i) {
|
|
|
270
274
|
...R(o)
|
|
271
275
|
};
|
|
272
276
|
}
|
|
273
|
-
async function
|
|
277
|
+
async function ie(i) {
|
|
274
278
|
switch (i.type) {
|
|
275
279
|
case "feature": {
|
|
276
|
-
const
|
|
280
|
+
const t = await i.loadSource(), o = E(t);
|
|
277
281
|
return {
|
|
278
282
|
name: i.name,
|
|
279
283
|
type: i.type,
|
|
280
|
-
...F(
|
|
281
|
-
...R(
|
|
284
|
+
...F(t?.fields),
|
|
285
|
+
...R(o)
|
|
282
286
|
};
|
|
283
287
|
}
|
|
284
288
|
case "featureSet": {
|
|
285
|
-
const
|
|
289
|
+
const t = await i.loadSource(), o = ee(t) && t.isTable;
|
|
286
290
|
return {
|
|
287
291
|
name: i.name,
|
|
288
292
|
type: "featureSet",
|
|
289
|
-
...
|
|
290
|
-
...F(
|
|
291
|
-
...R(E(
|
|
293
|
+
...o ? { isTable: o } : {},
|
|
294
|
+
...F(t?.fields),
|
|
295
|
+
...R(E(t))
|
|
292
296
|
};
|
|
293
297
|
}
|
|
294
298
|
case "featureSetCollection": {
|
|
295
|
-
const
|
|
299
|
+
const t = await i.loadSource(), o = t?.layers.filter(H) ?? [], a = t?.tables.filter(H) ?? [], n = await Promise.all(o.map(G)), c = await Promise.all(a.map(G));
|
|
296
300
|
return {
|
|
297
301
|
name: i.name,
|
|
298
302
|
type: "featureSetCollection",
|
|
299
|
-
layers:
|
|
300
|
-
tables:
|
|
303
|
+
layers: n,
|
|
304
|
+
tables: c
|
|
301
305
|
};
|
|
302
306
|
}
|
|
303
307
|
case "dictionary": {
|
|
304
|
-
const
|
|
308
|
+
const t = await Promise.all(
|
|
309
|
+
i.dictionaryVariables.filter(Z).map(ie)
|
|
310
|
+
);
|
|
305
311
|
return {
|
|
306
312
|
name: i.name,
|
|
307
313
|
type: "dictionary",
|
|
308
|
-
attributes:
|
|
314
|
+
attributes: t
|
|
309
315
|
};
|
|
310
316
|
}
|
|
311
317
|
case "pixel": {
|
|
312
|
-
const
|
|
313
|
-
if (!
|
|
318
|
+
const t = await i.loadSource();
|
|
319
|
+
if (!t)
|
|
314
320
|
return {
|
|
315
321
|
name: i.name,
|
|
316
322
|
type: "pixel"
|
|
317
323
|
};
|
|
318
|
-
const
|
|
324
|
+
const o = await ge(t);
|
|
319
325
|
return {
|
|
320
326
|
name: i.name,
|
|
321
327
|
type: "pixel",
|
|
322
|
-
members:
|
|
328
|
+
members: o.map(J)
|
|
323
329
|
};
|
|
324
330
|
}
|
|
325
331
|
case "voxel": {
|
|
326
|
-
const
|
|
327
|
-
if (!
|
|
332
|
+
const t = await i.loadSource();
|
|
333
|
+
if (!t)
|
|
328
334
|
return {
|
|
329
335
|
name: i.name,
|
|
330
336
|
type: "voxel"
|
|
331
337
|
};
|
|
332
|
-
const
|
|
338
|
+
const o = await be(t);
|
|
333
339
|
return {
|
|
334
340
|
name: i.name,
|
|
335
341
|
type: "voxel",
|
|
336
|
-
members:
|
|
342
|
+
members: o.map(J)
|
|
337
343
|
};
|
|
338
344
|
}
|
|
339
345
|
case "array":
|
|
346
|
+
const e = te(i.elementType.type);
|
|
340
347
|
return {
|
|
341
348
|
name: i.name,
|
|
342
349
|
type: "array",
|
|
343
|
-
elementType:
|
|
350
|
+
...e ? { elementType: e } : {}
|
|
344
351
|
};
|
|
345
352
|
case "number":
|
|
346
353
|
case "text":
|
|
@@ -357,30 +364,34 @@ async function ee(i) {
|
|
|
357
364
|
}
|
|
358
365
|
}
|
|
359
366
|
function J(i) {
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
367
|
+
if (i.type === "array") {
|
|
368
|
+
const t = te(i.elementType.type);
|
|
369
|
+
return {
|
|
370
|
+
name: i.name,
|
|
371
|
+
type: "array",
|
|
372
|
+
...t ? { elementType: t } : {}
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
return {
|
|
365
376
|
name: i.name,
|
|
366
377
|
type: i.type
|
|
367
378
|
// casting bc member types shouldn't be feature, featureset, etc.
|
|
368
379
|
};
|
|
369
380
|
}
|
|
370
|
-
async function
|
|
381
|
+
async function ze(i) {
|
|
371
382
|
return {
|
|
372
|
-
variables: await Promise.all(i.variables.map(
|
|
383
|
+
variables: await Promise.all(i.variables.filter(Z).map(ie))
|
|
373
384
|
};
|
|
374
385
|
}
|
|
375
|
-
const
|
|
376
|
-
function
|
|
386
|
+
const Be = 1e5;
|
|
387
|
+
function je(i) {
|
|
377
388
|
const e = new TextEncoder().encode(i).length;
|
|
378
389
|
return Math.ceil(e / 3.5);
|
|
379
390
|
}
|
|
380
391
|
function M(i) {
|
|
381
|
-
return
|
|
392
|
+
return je(JSON.stringify(i));
|
|
382
393
|
}
|
|
383
|
-
function
|
|
394
|
+
function He(i) {
|
|
384
395
|
const e = (o) => ({
|
|
385
396
|
name: o.name,
|
|
386
397
|
type: o.type,
|
|
@@ -430,7 +441,7 @@ function je(i) {
|
|
|
430
441
|
variables: i.variables.map(t)
|
|
431
442
|
};
|
|
432
443
|
}
|
|
433
|
-
function
|
|
444
|
+
function Ge(i) {
|
|
434
445
|
const e = i.variables, t = e.length, o = e.find((n) => n.name === "$feature") ?? e.find((n) => n.type === "feature") ?? e[0], a = o ? [o] : [];
|
|
435
446
|
return {
|
|
436
447
|
context: { variables: a },
|
|
@@ -438,15 +449,15 @@ function Be(i) {
|
|
|
438
449
|
reducedToVariableName: o?.name
|
|
439
450
|
};
|
|
440
451
|
}
|
|
441
|
-
function
|
|
442
|
-
return M(i) >
|
|
452
|
+
function Je(i) {
|
|
453
|
+
return M(i) > Be;
|
|
443
454
|
}
|
|
444
|
-
var
|
|
445
|
-
for (var a = o > 1 ? void 0 : o ?
|
|
455
|
+
var Qe = Object.defineProperty, We = Object.getOwnPropertyDescriptor, m = (i, e, t, o) => {
|
|
456
|
+
for (var a = o > 1 ? void 0 : o ? We(e, t) : e, n = i.length - 1, c; n >= 0; n--)
|
|
446
457
|
(c = i[n]) && (a = (o ? c(e, t, a) : c(a)) || a);
|
|
447
|
-
return o && a &&
|
|
458
|
+
return o && a && Qe(e, t, a), a;
|
|
448
459
|
};
|
|
449
|
-
let h = class extends
|
|
460
|
+
let h = class extends we {
|
|
450
461
|
constructor(i) {
|
|
451
462
|
super(i), this.viewMode = "prompt", this.confirmationActive = !1, this.contextReducedNoticeDismissed = !1, this.splashActive = !0, this.isSubmitting = !1, this.question = "", this.history = [], this.feedback = { active: !1 };
|
|
452
463
|
}
|
|
@@ -485,9 +496,9 @@ m([
|
|
|
485
496
|
f()
|
|
486
497
|
], h.prototype, "context", 2);
|
|
487
498
|
h = m([
|
|
488
|
-
|
|
499
|
+
$e("ArcadeAssistantViewState")
|
|
489
500
|
], h);
|
|
490
|
-
const
|
|
501
|
+
const Ye = "arcade_generation", Ke = "ArcadeCodeRequest", Q = "visualization", W = "ArcadeAssistant", Xe = [
|
|
491
502
|
"your_comments",
|
|
492
503
|
"user_evaluation",
|
|
493
504
|
"question",
|
|
@@ -501,9 +512,9 @@ const Qe = "arcade_generation", We = "ArcadeCodeRequest", Q = "visualization", W
|
|
|
501
512
|
"privacy_statement"
|
|
502
513
|
];
|
|
503
514
|
let Y = [], K = !0;
|
|
504
|
-
class
|
|
515
|
+
class Ze extends re {
|
|
505
516
|
constructor() {
|
|
506
|
-
super(...arguments), this.textAreaRef =
|
|
517
|
+
super(...arguments), this.textAreaRef = le(), this.messages = pe(), this._feedbackService = void 0, this.viewState = new h(), this.handleFeedbackButton = (e, t) => {
|
|
507
518
|
this.updateViewState({
|
|
508
519
|
feedback: { active: !0, value: e, item: t, termsAccepted: !1, text: "", submitting: !1 }
|
|
509
520
|
});
|
|
@@ -559,7 +570,7 @@ class Ke extends se {
|
|
|
559
570
|
this.properties = { closePanel: 0, insertText: 0, helpBase: 1, assistantsEnabled: 5, portalUrl: 1, serviceUrl: 1, closed: 7, editorRef: 0, feedbackServiceUrl: 1, appVersion: 1, disableQuestionAnswerLogging: 5 };
|
|
560
571
|
}
|
|
561
572
|
static {
|
|
562
|
-
this.styles =
|
|
573
|
+
this.styles = xe;
|
|
563
574
|
}
|
|
564
575
|
get disclaimerComment() {
|
|
565
576
|
return `// ${this.messages.disclaimercomment}
|
|
@@ -592,7 +603,7 @@ class Ke extends se {
|
|
|
592
603
|
e().catch((t) => {
|
|
593
604
|
w("error", this, "Error setting initial context.", { detail: { error: t } });
|
|
594
605
|
}), this.manager.onLifecycle(() => {
|
|
595
|
-
const t =
|
|
606
|
+
const t = _.onModelContextDidChange(async () => {
|
|
596
607
|
e().catch((a) => {
|
|
597
608
|
w("error", this, "Error setting context.", { detail: { error: a } });
|
|
598
609
|
});
|
|
@@ -606,7 +617,7 @@ class Ke extends se {
|
|
|
606
617
|
super.disconnectedCallback(), Y = this.viewState.history, K = this.viewState.splashActive, this.copySuccessTimer && (clearTimeout(this.copySuccessTimer), this.copySuccessTimer = void 0);
|
|
607
618
|
}
|
|
608
619
|
createFeedbackContextSnapshot(e) {
|
|
609
|
-
const t =
|
|
620
|
+
const t = He(e.metadata);
|
|
610
621
|
return {
|
|
611
622
|
...e,
|
|
612
623
|
metadata: t,
|
|
@@ -625,7 +636,7 @@ class Ke extends se {
|
|
|
625
636
|
code: t.formattedScript || t.error || "",
|
|
626
637
|
profileId: t.profile ?? Q,
|
|
627
638
|
onAddToEditor: (o) => {
|
|
628
|
-
|
|
639
|
+
ue(this.editorRef.editorInstance, t.formattedScript ?? "", o, this.disclaimerComment);
|
|
629
640
|
},
|
|
630
641
|
onThumbsUp: () => this.handleFeedbackButton("good", t),
|
|
631
642
|
onThumbsDown: () => this.handleFeedbackButton("bad", t),
|
|
@@ -638,9 +649,9 @@ class Ke extends se {
|
|
|
638
649
|
return this._feedbackService;
|
|
639
650
|
if (!this.feedbackServiceUrl)
|
|
640
651
|
return;
|
|
641
|
-
const e = new
|
|
652
|
+
const e = new fe({ url: this.feedbackServiceUrl });
|
|
642
653
|
await e.load();
|
|
643
|
-
const t =
|
|
654
|
+
const t = Xe.filter((o) => !e.fields.some((a) => a.name === o));
|
|
644
655
|
if (t.length > 0) {
|
|
645
656
|
w("error", this, `Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
|
|
646
657
|
return;
|
|
@@ -692,13 +703,13 @@ class Ke extends se {
|
|
|
692
703
|
return;
|
|
693
704
|
const n = this.viewState.context ?? await this.getProfileAndMetadata(a.uri);
|
|
694
705
|
t = this.createFeedbackContextSnapshot(n);
|
|
695
|
-
const c = await this.getToken(), p = await
|
|
706
|
+
const c = await this.getToken(), p = await ke({
|
|
696
707
|
baseUrl: this.serviceUrl,
|
|
697
|
-
skillId:
|
|
708
|
+
skillId: Ye,
|
|
698
709
|
message: e,
|
|
699
710
|
authToken: c,
|
|
700
711
|
context: {
|
|
701
|
-
kind:
|
|
712
|
+
kind: Ke,
|
|
702
713
|
context: {
|
|
703
714
|
profile_id: n.profileId,
|
|
704
715
|
metadata: [n.metadata]
|
|
@@ -717,7 +728,7 @@ class Ke extends se {
|
|
|
717
728
|
return;
|
|
718
729
|
}
|
|
719
730
|
if (r.context?.kind === "ArcadeCodeResponse") {
|
|
720
|
-
const s = this.createFeedbackContextSnapshot(n), u =
|
|
731
|
+
const s = this.createFeedbackContextSnapshot(n), u = he(r?.context?.arcadeCode?.code ?? "");
|
|
721
732
|
this.updateViewState({
|
|
722
733
|
history: [
|
|
723
734
|
{
|
|
@@ -742,7 +753,7 @@ class Ke extends se {
|
|
|
742
753
|
});
|
|
743
754
|
}
|
|
744
755
|
} catch (a) {
|
|
745
|
-
const n = a instanceof Error && a.name === "ArcadeAssistantError" ?
|
|
756
|
+
const n = a instanceof Error && a.name === "ArcadeAssistantError" ? Ae(a) || this.messages.erroroccurred || "An error occurred." : this.messages.erroroccurred || "An error occurred.";
|
|
746
757
|
this.updateViewState({ errorMessage: n }), await this.logInteractionToFeedbackService({
|
|
747
758
|
question: e,
|
|
748
759
|
answer: n,
|
|
@@ -754,16 +765,16 @@ class Ke extends se {
|
|
|
754
765
|
}
|
|
755
766
|
}
|
|
756
767
|
async getToken() {
|
|
757
|
-
const { token: e } = await
|
|
768
|
+
const { token: e } = await de.getCredential(this.portalUrl);
|
|
758
769
|
return e;
|
|
759
770
|
}
|
|
760
771
|
async getProfileAndMetadata(e) {
|
|
761
772
|
let t = Q;
|
|
762
|
-
const o =
|
|
773
|
+
const o = _.getEditorProfileForModel(e);
|
|
763
774
|
o?.loaded || await o?.loadSource();
|
|
764
775
|
const a = this.editorRef.profile;
|
|
765
776
|
a && "id" in a && (t = a.id);
|
|
766
|
-
const n = o ? await
|
|
777
|
+
const n = o ? await ze(o) : { variables: [] }, c = Je(n), p = c ? Ge(n) : void 0, s = p ? p.context : n, u = M(s);
|
|
767
778
|
return {
|
|
768
779
|
profileId: t,
|
|
769
780
|
metadata: s,
|
|
@@ -781,9 +792,9 @@ ${e}` : "";
|
|
|
781
792
|
if (this.closed)
|
|
782
793
|
return null;
|
|
783
794
|
const e = this.viewState.viewMode === "result", t = this.getHistoryCards();
|
|
784
|
-
return this.assistantsEnabled ? d`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive && d`<calcite-scrim></calcite-scrim>` || ""}${
|
|
795
|
+
return this.assistantsEnabled ? d`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive && d`<calcite-scrim></calcite-scrim>` || ""}${Ee({ messages: this.messages })}${Re({ messages: this.messages, popoverContent: z({ assistantsEnabled: this.assistantsEnabled, messages: this.messages, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.viewState.splashActive && Ne({ messages: this.messages, onProceed: () => {
|
|
785
796
|
this.updateViewState({ splashActive: !1 });
|
|
786
|
-
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${
|
|
797
|
+
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${Me({ active: this.viewState.confirmationActive, setActive: (o) => this.updateViewState({ confirmationActive: o }), messages: this.messages })}${Ve({ isDisabled: this.viewState.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestionState, setIsViewingResult: (o) => this.updateViewState({ viewMode: o ? "result" : "prompt" }), mode: e ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.viewState.question, errorMessage: this.viewState.errorMessage, setErrorMessage: (o) => this.updateViewState({ errorMessage: o }), promptValidationMessage: this.viewState.promptValidationMessage, setPromptValidationMessage: (o) => this.updateViewState({ promptValidationMessage: o }), submitQuestion: this.submitQuestion.bind(this), assistantRef: this.el, messages: this.messages, context: this.viewState.context, contextReducedNoticeDismissed: this.viewState.contextReducedNoticeDismissed, setContextReducedNoticeDismissed: (o) => this.updateViewState({ contextReducedNoticeDismissed: o }) })}<calcite-block-group .label=${this.messages.interactiveblocks ?? "interactive blocks"}>${!e && !this.viewState.isSubmitting && Ue({ messages: this.messages, suggestions: [this.messages.prompsuggestion1 ?? "", this.messages.prompsuggestion2 ?? ""], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${j({
|
|
787
798
|
expanded: e,
|
|
788
799
|
messages: this.messages,
|
|
789
800
|
collapsible: !0,
|
|
@@ -794,7 +805,7 @@ ${e}` : "";
|
|
|
794
805
|
hidden: this.viewState.isSubmitting || !e,
|
|
795
806
|
onCopyCode: this.onCopyCode.bind(this),
|
|
796
807
|
standalone: !0
|
|
797
|
-
})}${
|
|
808
|
+
})}${j({
|
|
798
809
|
expanded: !e,
|
|
799
810
|
messages: this.messages,
|
|
800
811
|
collapsible: !0,
|
|
@@ -808,10 +819,10 @@ ${e}` : "";
|
|
|
808
819
|
heading: this.messages.recentprompts ?? "Recent prompts",
|
|
809
820
|
hidden: this.viewState.isSubmitting || this.viewState.history.length === 0,
|
|
810
821
|
onCopyCode: this.onCopyCode.bind(this)
|
|
811
|
-
})}</calcite-block-group>${this.viewState.feedback.active ?
|
|
822
|
+
})}</calcite-block-group>${this.viewState.feedback.active ? _e({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, onSubmit: this.handleFeedbackSubmit, feedback: this.viewState.feedback, setFeedback: this.setFeedbackState, learnMoreUrl: this.assistantOverviewDocUrl }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : d`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${z({ slot: "content-top", messages: this.messages, assistantsEnabled: this.assistantsEnabled, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
|
|
812
823
|
}
|
|
813
824
|
}
|
|
814
|
-
|
|
825
|
+
ae("arcgis-arcade-coding-assistant", Ze);
|
|
815
826
|
export {
|
|
816
|
-
|
|
827
|
+
Ze as ArcgisArcadeCodingAssistant
|
|
817
828
|
};
|