@arcgis/coding-components 5.0.0-next.80 → 5.0.0-next.82
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/addons.js +1 -1
- package/dist/cdn/{ZY5H6E7G.js → 2C2ENEMF.js} +2 -2
- package/dist/cdn/{DEZZKBLL.js → 4TUWROZW.js} +2 -2
- package/dist/cdn/{X5QIB2JX.js → 533JL44O.js} +1 -1
- package/dist/cdn/{4ZWZQF7V.js → 5JHTHOWX.js} +2 -2
- package/dist/cdn/{2TVQ64DO.js → 6BGVUTLZ.js} +2 -2
- package/dist/cdn/{75MCESFA.js → 6D3UZWOI.js} +2 -2
- package/dist/cdn/{LUCNYRCM.js → 6FCM52GB.js} +2 -2
- package/dist/cdn/{ULAYRUKP.js → 7KK7ZKLY.js} +2 -2
- package/dist/cdn/{SUR5H5OB.js → AHXQ5W7R.js} +2 -2
- package/dist/cdn/{T2YHKIJB.js → AU43R6H2.js} +2 -2
- package/dist/cdn/{73DDFW6R.js → BLO67VQG.js} +2 -2
- package/dist/cdn/{ZVNO56TX.js → CF6XAW6G.js} +2 -2
- package/dist/cdn/{EYQTULWW.js → CG5HV6HN.js} +2 -2
- package/dist/cdn/{JQAFFJHL.js → DGLUBXDV.js} +2 -2
- package/dist/cdn/{QGZVHIT4.js → EMKGHLIH.js} +2 -2
- package/dist/cdn/{HKJXFH7N.js → F3TQXIU3.js} +1 -1
- package/dist/cdn/{VXZKUNCP.js → FCRDLETH.js} +2 -2
- package/dist/cdn/{5C6Z44EJ.js → FSMRNHL2.js} +2 -2
- package/dist/cdn/{MSTFKRO2.js → FV2NHXGO.js} +2 -2
- package/dist/cdn/JALGRFL4.js +6 -0
- package/dist/cdn/{EOYLIGUC.js → JPZTOH4J.js} +2 -2
- package/dist/cdn/{LMUTMR4J.js → JQR7V3LJ.js} +1 -1
- package/dist/cdn/{CBOJ526N.js → JV26DVDY.js} +1 -1
- package/dist/cdn/{PVFJQC2P.js → KMLIRZOK.js} +2 -2
- package/dist/cdn/{TMOXDDHR.js → LERZZUAA.js} +2 -2
- package/dist/cdn/{PKB6RPC4.js → MAVMC7R6.js} +1 -1
- package/dist/cdn/{ZGAIJ72R.js → MKQ7WT5B.js} +2 -2
- package/dist/cdn/{G5DTZU4H.js → N5S77RST.js} +2 -2
- package/dist/cdn/{2BIE5Q3F.js → NKIWVTCW.js} +2 -2
- package/dist/cdn/{3CD6VIHW.js → NOKZ6IVL.js} +2 -2
- package/dist/cdn/{JH5LL3J4.js → NRNTMGTU.js} +2 -2
- package/dist/cdn/{FZ2B3SDP.js → PHVPS3ZP.js} +1 -1
- package/dist/cdn/{SUKRIOWT.js → R6SIAMGY.js} +2 -2
- package/dist/cdn/{VV5KEZ7G.js → TESEUIXJ.js} +2 -2
- package/dist/cdn/{BNPPVIPE.js → TFKCYYL2.js} +2 -2
- package/dist/cdn/{RDN65M23.js → U2LEBJAH.js} +2 -2
- package/dist/cdn/{GJI4PBIJ.js → UJG2Q7GL.js} +3 -3
- package/dist/cdn/{EEWSMPHK.js → UQ7XUSRF.js} +2 -2
- package/dist/cdn/{5KDIG2UL.js → VKQ33L2V.js} +1 -1
- package/dist/cdn/{AWGJ4ILV.js → VUX4U6UV.js} +2 -2
- package/dist/cdn/VWKRSQWG.js +4 -0
- package/dist/cdn/{CCLOHCOZ.js → XFBZ3W5A.js} +3 -3
- package/dist/cdn/{BQAK3VWU.js → XGAO23JL.js} +2 -2
- package/dist/cdn/{LTDIOLXD.js → YNEZBNKX.js} +2 -2
- package/dist/cdn/{O2RYN6PT.js → YXC6IAMD.js} +2 -2
- package/dist/cdn/{I26OEL6J.js → ZEJHNFHY.js} +1 -1
- package/dist/cdn/{5RRLYDHG.js → ZHLLRZB3.js} +2 -2
- package/dist/cdn/{OAXKRKRW.js → ZI4YGYDX.js} +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +1675 -1676
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/arcade-contribution.js +1 -1
- package/dist/chunks/arcade-defaults.js +1 -1
- package/dist/chunks/arcade-executor.js +1 -1
- package/dist/chunks/arcade-mode.js +1 -1
- package/dist/chunks/arcade-service-accessors.js +1 -1
- package/dist/chunks/colorize.js +1 -1
- package/dist/chunks/editor.js +1 -1
- package/dist/chunks/fields.js +1 -1
- package/dist/chunks/language-defaults-base.js +1 -1
- package/dist/chunks/markdown.js +1 -1
- package/dist/chunks/monaco-importer.js +1 -1
- package/dist/chunks/monaco-theme.js +1 -1
- package/dist/chunks/runtime.js +2 -2
- package/dist/chunks/sql-expr-defaults.js +1 -1
- package/dist/chunks/sql-expr-mode.js +1 -1
- package/dist/chunks/sql-expr-service-accessors.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/chunks/utilities.js +1 -1
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +107 -106
- package/dist/components/arcgis-arcade-editor/customElement.js +1 -1
- package/dist/components/arcgis-arcade-results/customElement.js +1 -1
- package/dist/components/arcgis-arcade-suggestions/customElement.js +1 -1
- package/dist/components/arcgis-code-editor/customElement.js +1 -1
- package/dist/components/arcgis-code-viewer/customElement.js +1 -1
- package/dist/components/arcgis-editor-variables/customElement.js +1 -1
- package/dist/components/arcgis-language-api-panel/customElement.js +1 -1
- package/dist/components/arcgis-sql-expression-editor/customElement.js +1 -1
- package/dist/components/arcgis-sql-expression-fields/customElement.js +1 -1
- package/dist/docs/api.json +2 -2
- package/dist/docs/docs.json +2 -2
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/dist/monacoStyles.js +1 -1
- package/dist/utils/arcade-executor.d.ts +3 -3
- package/dist/utils/language-defaults-base.d.ts +1 -1
- package/dist/utils/profile/utils.d.ts +2 -0
- package/dist/utils/typing.d.ts +21 -0
- package/package.json +5 -5
- package/dist/cdn/4KXLTNNI.js +0 -4
- package/dist/cdn/BLKCQ6JT.js +0 -6
|
@@ -1,25 +1,26 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { nothing as
|
|
3
|
-
import { ref as
|
|
4
|
-
import
|
|
5
|
-
import { u as
|
|
6
|
-
import { b as
|
|
7
|
-
import { css as
|
|
8
|
-
import
|
|
9
|
-
import { e as
|
|
10
|
-
import { repeat as
|
|
1
|
+
import { c as V } from "../../chunks/runtime.js";
|
|
2
|
+
import { nothing as U, LitElement as H } from "@arcgis/lumina";
|
|
3
|
+
import { ref as B, createRef as j } from "lit/directives/ref.js";
|
|
4
|
+
import W from "@arcgis/core/identity/IdentityManager.js";
|
|
5
|
+
import { u as G } from "../../chunks/useT9n.js";
|
|
6
|
+
import { b as I } from "../../chunks/arcade-defaults.js";
|
|
7
|
+
import { css as Q, html as r } from "lit";
|
|
8
|
+
import T from "@arcgis/core/request.js";
|
|
9
|
+
import { e as J, a as K } from "../../chunks/utilities.js";
|
|
10
|
+
import { repeat as F } from "lit/directives/repeat.js";
|
|
11
11
|
import "@arcgis/toolkit/function";
|
|
12
|
-
import { generateGuid as
|
|
13
|
-
import { unsafeHTML as
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { b as
|
|
12
|
+
import { generateGuid as Y } from "@arcgis/toolkit/string";
|
|
13
|
+
import { unsafeHTML as k } from "lit/directives/unsafe-html.js";
|
|
14
|
+
import X from "@arcgis/core/layers/FeatureLayer.js";
|
|
15
|
+
import Z from "@arcgis/core/config.js";
|
|
16
|
+
import ee from "@arcgis/core/Graphic.js";
|
|
17
|
+
import { b as te } from "../../chunks/language-defaults-base.js";
|
|
18
|
+
import { log as b } from "@arcgis/toolkit/log";
|
|
18
19
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
19
20
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
20
|
-
v5.0.0-next.
|
|
21
|
-
const
|
|
22
|
-
class
|
|
21
|
+
v5.0.0-next.82 */
|
|
22
|
+
const ie = Q`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);flex:1 0 auto;border-inline-start:var(--arcgis-coding-components-border);box-sizing:border-box;max-width:var(--arcgis-coding-components-code-editor-side-panel-max-w);width:var(--arcgis-coding-components-code-editor-side-panel-w);.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}.action .error-display{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:1rem;display:flex;flex-direction:column;gap:.75rem;max-height:30vh;overflow-y:auto}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}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)}.type-suggestion{--calcite-color-foreground-1: var(--calcite-color-foreground-current);--calcite-color-text-3: var(--calcite-color-text-2);--calcite-icon-color: var(--calcite-color-brand)}.type-history{--calcite-icon-color: var(--calcite-color-text-2)}.type-response{--calcite-icon-color: var(--calcite-color-brand);--calcite-font-family: monospace}.block-response{align-self:flex-start;margin-block-end:4rem;border-block-end:0;--calcite-block-text-color: var(--calcite-color-brand)}calcite-list-item calcite-button{margin-inline-end:.25rem}.type-docs{--calcite-color-foreground-1: var(--calcite-color-foreground-3);--calcite-icon-color: var(--calcite-color-text-1)}.type-error{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-font-family: monospace;border:1px solid var(--calcite-color-status-danger)}#thumbs-up{margin-inline-start:auto;--calcite-icon-color: var(--calcite-color-border-input)}#thumbs-down{--calcite-icon-color: var(--calcite-color-border-input)}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}.no-space-block,.no-space-block[open]{margin:0}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}calcite-text-area{height:auto;min-height:5.75rem;overflow:hidden;border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-tooltip{--calcite-tooltip-z-index: 1000}.standalone-list{margin:1rem;width:calc(100% - 2rem)}.result-disclaimer{display:block;width:24rem;max-width:90%;margin:1rem auto;text-align:center;line-height:1.125rem;font-size:.875rem;font-style:italic}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%}.break-spaces{white-space:break-spaces}.feedback-button-container{margin-inline-start:auto;gap:0}.info-heading{font-size:var(--calcite-font-size-1);color:var(--calcite-color-text-1)}.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)}.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=title] 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}.code-collapse{margin-inline-start:auto}.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)}.collapsible-error{padding:.5rem}.collapsible-error summary{cursor:pointer;font-weight:500;color:var(--calcite-color-status-danger);outline:none;padding:.25rem 0}.collapsible-error[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}}:host([closed]){display:none}`;
|
|
23
|
+
class y extends Error {
|
|
23
24
|
constructor({
|
|
24
25
|
message: e,
|
|
25
26
|
code: t,
|
|
@@ -30,7 +31,7 @@ class v extends Error {
|
|
|
30
31
|
super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details = c, this.source = n;
|
|
31
32
|
}
|
|
32
33
|
}
|
|
33
|
-
function
|
|
34
|
+
function E(i) {
|
|
34
35
|
if (!i)
|
|
35
36
|
return;
|
|
36
37
|
const e = i.indexOf('{"error":');
|
|
@@ -43,7 +44,7 @@ function T(i) {
|
|
|
43
44
|
return;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
46
|
-
async function
|
|
47
|
+
async function oe(i) {
|
|
47
48
|
const { baseUrl: e, skillId: t, message: o, authToken: c, previousConversationId: n, context: u } = i, d = t ? `${e}/skills/${t}/chat` : `${e}/chat`, s = [], a = {
|
|
48
49
|
message: o,
|
|
49
50
|
context: u
|
|
@@ -51,7 +52,7 @@ async function ie(i) {
|
|
|
51
52
|
n && (a.conversation_id = n);
|
|
52
53
|
let l;
|
|
53
54
|
try {
|
|
54
|
-
l = await
|
|
55
|
+
l = await T(d, {
|
|
55
56
|
method: "post",
|
|
56
57
|
headers: {
|
|
57
58
|
"Content-Type": "application/json",
|
|
@@ -61,103 +62,103 @@ async function ie(i) {
|
|
|
61
62
|
responseType: "json"
|
|
62
63
|
});
|
|
63
64
|
} catch (m) {
|
|
64
|
-
const f = m,
|
|
65
|
-
throw
|
|
65
|
+
const f = m, x = f.details?.rawResponse || f.message || String(m), g = E(x);
|
|
66
|
+
throw g ? new y(g) : m;
|
|
66
67
|
}
|
|
67
68
|
const p = l.data;
|
|
68
69
|
s.push(p);
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
async function
|
|
70
|
+
const $ = p.conversationId, z = p.inquiryId;
|
|
71
|
+
let A = p.sequenceNumber;
|
|
72
|
+
async function D() {
|
|
72
73
|
let m = 0;
|
|
73
74
|
const f = 25;
|
|
74
75
|
for (; m < f; ) {
|
|
75
|
-
await new Promise((
|
|
76
|
-
const
|
|
77
|
-
let
|
|
76
|
+
await new Promise((v) => setTimeout(v, 1e3));
|
|
77
|
+
const x = ae($, A, z);
|
|
78
|
+
let g;
|
|
78
79
|
try {
|
|
79
|
-
|
|
80
|
+
g = await T(d, {
|
|
80
81
|
method: "post",
|
|
81
82
|
headers: {
|
|
82
83
|
"Content-Type": "application/json",
|
|
83
84
|
token: c
|
|
84
85
|
},
|
|
85
|
-
body: JSON.stringify(
|
|
86
|
+
body: JSON.stringify(x),
|
|
86
87
|
responseType: "json"
|
|
87
88
|
});
|
|
88
|
-
} catch (
|
|
89
|
-
const
|
|
90
|
-
throw
|
|
89
|
+
} catch (v) {
|
|
90
|
+
const C = v, L = C.details?.rawResponse || C.message || String(v), S = E(L);
|
|
91
|
+
throw S ? new y(S) : v;
|
|
91
92
|
}
|
|
92
|
-
const h =
|
|
93
|
+
const h = g.data;
|
|
93
94
|
if (h.context && h.context.kind === "ArcgisErrorAsContext" && h.context.error)
|
|
94
|
-
throw new
|
|
95
|
+
throw new y({
|
|
95
96
|
message: h.context.error.message || "ArcGIS Assistant error",
|
|
96
97
|
code: h.context.error.code,
|
|
97
98
|
subCode: h.context.error.subCode,
|
|
98
99
|
details: h.context.error.details,
|
|
99
100
|
source: "polling-response"
|
|
100
101
|
});
|
|
101
|
-
if (s.push(h),
|
|
102
|
+
if (s.push(h), A = h.sequenceNumber, m++, !h.hasMore)
|
|
102
103
|
break;
|
|
103
104
|
}
|
|
104
105
|
if (m === f)
|
|
105
|
-
throw new
|
|
106
|
+
throw new y({
|
|
106
107
|
message: "Request timed out",
|
|
107
108
|
code: "TIMEOUT",
|
|
108
109
|
source: "polling"
|
|
109
110
|
});
|
|
110
111
|
}
|
|
111
|
-
const
|
|
112
|
+
const O = 120 * 1e3;
|
|
112
113
|
return await Promise.race([
|
|
113
|
-
|
|
114
|
+
D(),
|
|
114
115
|
new Promise(
|
|
115
116
|
(m, f) => setTimeout(
|
|
116
117
|
() => f(
|
|
117
|
-
new
|
|
118
|
+
new y({
|
|
118
119
|
message: "Request timed out",
|
|
119
120
|
code: "TIMEOUT",
|
|
120
121
|
source: "hard-timeout"
|
|
121
122
|
})
|
|
122
123
|
),
|
|
123
|
-
|
|
124
|
+
O
|
|
124
125
|
)
|
|
125
126
|
)
|
|
126
127
|
]), s;
|
|
127
128
|
}
|
|
128
|
-
function
|
|
129
|
+
function ae(i, e, t) {
|
|
129
130
|
return {
|
|
130
131
|
conversationId: i,
|
|
131
132
|
inquiryId: t,
|
|
132
133
|
ackSequenceNumber: e
|
|
133
134
|
};
|
|
134
135
|
}
|
|
135
|
-
function
|
|
136
|
+
function se(i) {
|
|
136
137
|
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" ? "I'm having trouble with this request. Try again by re-asking the same question or rephrasing it." : i.message;
|
|
137
138
|
}
|
|
138
|
-
const
|
|
139
|
+
const ce = (i) => {
|
|
139
140
|
const e = i.value.length, t = 72, o = 180, c = i.offsetWidth, u = Math.max(1, Math.floor(c / 8)), d = Math.ceil(e / u), s = t + (d - 2) * 24;
|
|
140
141
|
i.style.setProperty("--calcite-text-area-min-height", `${Math.min(s, o)}px`);
|
|
141
142
|
};
|
|
142
|
-
function
|
|
143
|
+
function re({ messages: i }) {
|
|
143
144
|
return r`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta ?? "Beta"}>${i.beta ?? "Beta"}</calcite-chip>`;
|
|
144
145
|
}
|
|
145
|
-
function
|
|
146
|
+
function ne({ popoverContent: i }) {
|
|
146
147
|
return r`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer label=legal-disclaimer placement=bottom auto-close focus-trap-disabled><div class="contained">${i}</div></calcite-popover>`;
|
|
147
148
|
}
|
|
148
|
-
function
|
|
149
|
-
return r`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ??
|
|
149
|
+
function _({ errorMessage: i, slot: e }) {
|
|
150
|
+
return r`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ?? U}>${i}</calcite-input-message></div>`;
|
|
150
151
|
}
|
|
151
|
-
function
|
|
152
|
+
function le({ active: i, setActive: e, messages: t }) {
|
|
152
153
|
return r`<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>`;
|
|
153
154
|
}
|
|
154
|
-
function
|
|
155
|
+
function de({ context: i, messages: e }) {
|
|
155
156
|
return i ? r`<div class="gaps">${i.profileName && r`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileName}").replace("{profileName}", i.profileName)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel ?? "Profile context: {profileName}").replace("{profileName}", i.profileName)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button></calcite-button>` || ""}${i.layerName && r`<calcite-popover auto-close placement=top .label=${(e.layercontextlabel ?? "Layer context: {layerName}").replace("{layerName}", i.layerName)} reference-element=layer-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.layercontextlabel ?? "Layer context: {layerName}").replace("{layerName}", i.layerName)}</p></calcite-popover><calcite-button round kind=neutral icon-start=layers id=layer-context-button></calcite-button>` || ""}</div>` : null;
|
|
156
157
|
}
|
|
157
|
-
function
|
|
158
|
-
return r`<div class="text-area-wrapper"><calcite-text-area resize=vertical .readOnly=${i || e} class="styled-text-area" .placeholder=${a.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${(
|
|
159
|
-
|
|
160
|
-
}} ${
|
|
158
|
+
function pe({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef: c, question: n, errorMessage: u, setErrorMessage: d, submitQuestion: s, messages: a, mode: l, context: p }) {
|
|
159
|
+
return r`<div class="text-area-wrapper"><calcite-text-area resize=vertical .readOnly=${i || e} class="styled-text-area" .placeholder=${a.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${($) => {
|
|
160
|
+
ce($.target), t($.target.value);
|
|
161
|
+
}} ${B(c)}><div class="submission-actions-wrapper" slot=footer-start>${u && _({ errorMessage: u, slot: "footer-start" }) || ""}<div class="submission-actions">${de({ context: p, messages: a })}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${l !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async () => {
|
|
161
162
|
o(!1), t("");
|
|
162
163
|
}} .label=${a.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">${a.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${l !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async () => {
|
|
163
164
|
o(!1), t("");
|
|
@@ -165,30 +166,30 @@ function de({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult:
|
|
|
165
166
|
d(n ? "" : a.enteraprompt ?? "Please enter a prompt"), await s();
|
|
166
167
|
}}>${l === "prompt" ? a.ask ?? "Generate" : a.refine ?? "Refine"}</calcite-button></div></div></div></calcite-text-area></div>`;
|
|
167
168
|
}
|
|
168
|
-
const
|
|
169
|
-
function
|
|
169
|
+
const ue = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-statement", he = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement";
|
|
170
|
+
function me({ setOpen: i, messages: e, feedback: t, setFeedback: o, onSubmit: c }) {
|
|
170
171
|
return t.active ? r`<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.providefeedback ?? "Provide feedback"} .description=${e.experiencehelps ?? "Your experience helps guide future improvements"}><div class="feedback-content"><calcite-label>${e.experiencehelpful ?? "Was the assistant helpful?"}<calcite-segmented-control scale=l .disabled=${t.submitting}><calcite-segmented-control-item icon-start=thumbs-up .checked=${t.value === "good"} @click=${() => o({ ...t, value: "good" })}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${t.value === "bad"} @click=${() => o({ ...t, value: "bad" })}></calcite-segmented-control-item></calcite-segmented-control></calcite-label><calcite-label>${e.describeexperience ?? "Describe your experience"}<calcite-text-area resize=vertical .value=${t.text} @calciteTextAreaInput=${(n) => o({ ...t, text: n.target.value })} .disabled=${t.submitting}></calcite-text-area></calcite-label><calcite-label layout=inline scale=s><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(n) => {
|
|
171
172
|
o({ ...t, termsAccepted: n.target.checked });
|
|
172
|
-
}} .disabled=${t.submitting}></calcite-checkbox><span>${
|
|
173
|
+
}} .disabled=${t.submitting}></calcite-checkbox><span>${k((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${ue} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${he} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label></div><calcite-button slot=footer width=full @click=${c} .disabled=${!t.termsAccepted || t.submitting} .loading=${t.submitting}>${e.submitfeedback ?? "Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>` : null;
|
|
173
174
|
}
|
|
174
|
-
function
|
|
175
|
-
return r`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ??
|
|
175
|
+
function R({ assistantsEnabled: i, messages: e, slot: t, assistantHelpUrl: o, helpTopicUrl: c }) {
|
|
176
|
+
return r`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? U} expanded class="info-block"><calcite-chip .label=${e.new ?? "New"} kind=brand>${e.new ?? "New"}</calcite-chip><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p>${i ? r`<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>${k((e.seedocumentation ?? "Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}", `<calcite-link href=${c} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : r`<p>${k(e.useofassistant?.replace("{aiassistants}", `<strong>${e.aiassistants ?? "Ai Assistants"}</strong>`))}<calcite-link .href=${o} target=_blank icon-end=launch-2>${e.configureassistants ?? "Configure Assistants"}</calcite-link></p>`}</calcite-block>`;
|
|
176
177
|
}
|
|
177
|
-
function
|
|
178
|
-
return r`<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>${
|
|
178
|
+
function fe({ messages: i, onProceed: e, onExit: t, helpTopicUrl: o }) {
|
|
179
|
+
return r`<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>${k((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>`;
|
|
179
180
|
}
|
|
180
|
-
function
|
|
181
|
-
return r`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block><calcite-chip-group class="suggestions" .label=${i.promptsuggestions ?? "Prompt Suggestions"}>${
|
|
181
|
+
function be({ messages: i, suggestions: e, onSuggestionClick: t }) {
|
|
182
|
+
return r`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block><calcite-chip-group class="suggestions" .label=${i.promptsuggestions ?? "Prompt Suggestions"}>${F(e, (o) => o, (o) => r`<calcite-button round appearance=outline-fill kind=neutral .label=${i.promptsuggestion} class="suggestion-button" @click=${() => t?.(o)}>${o}</calcite-button>`)}</calcite-chip-group></calcite-block>`;
|
|
182
183
|
}
|
|
183
|
-
const
|
|
184
|
-
function
|
|
185
|
-
return r`<calcite-block .hidden=${i} id=result-block .heading=${c ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${u && r`<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"}>${
|
|
184
|
+
const N = 200;
|
|
185
|
+
function q({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: c, collapsible: n = !1, showEffectsIcon: u = !1, onCopyCode: d, standalone: s }) {
|
|
186
|
+
return r`<calcite-block .hidden=${i} id=result-block .heading=${c ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${u && r`<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"}>${F(o, (a) => a.conversationId, (a) => r`<calcite-card><div slot=heading><div class="prior-prompt"><span>${a.priorPrompt.length > N ? `${a.priorPrompt.slice(0, N)}...` : a.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} @click=${(l) => {
|
|
186
187
|
const p = l.currentTarget;
|
|
187
188
|
navigator.clipboard.writeText(a.priorPrompt).then(() => {
|
|
188
189
|
p.setAttribute("data-copied", "true"), setTimeout(() => p.removeAttribute("data-copied"), 1500);
|
|
189
190
|
});
|
|
190
|
-
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "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-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${a.message && s && r`<div class="response-error-container">${
|
|
191
|
-
const p =
|
|
191
|
+
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "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-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${a.message && s && r`<div class="response-error-container">${_({ errorMessage: a.message })}</div>` || ""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${t.responsecontext ?? "Response Context"} scale=s>${a.message && !s && r`<calcite-tooltip .referenceElement=${`response-chip-${a.conversationId}-error`} placement=top-start>${a.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${a.conversationId}-error`} .label=${t.error ?? "Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>` || ""}${a.chips?.map((l) => {
|
|
192
|
+
const p = Y();
|
|
192
193
|
return r`${l.tooltip && r`<calcite-tooltip .referenceElement=${`response-chip-${l.conversationId}-${p}`} placement=top-start class="contained-popover-or-tooltip">${l.tooltip}</calcite-tooltip>` || ""}<calcite-chip .label=${l.label} .scale=${l.scale ?? "s"} .appearance=${l.appearance ?? "outline"} .icon=${l.icon} .id=${`response-chip-${l.conversationId}-${p}`}>${l.label}</calcite-chip>`;
|
|
193
194
|
})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${a.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=${() => a.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor ?? "Add to editor"} .id=${`add-to-editor-button-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start>${t.addtoeditor ?? "Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${() => a.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=${() => a.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${a.conversationId}-${s ? "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=${(l) => {
|
|
194
195
|
const p = l.currentTarget;
|
|
@@ -197,7 +198,7 @@ function N({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: c
|
|
|
197
198
|
});
|
|
198
199
|
}} class="response-secondary-action-button" .id=${`copy-response-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${a.conversationId}-${s ? "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-${a.conversationId}-${s ? "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=${a.onThumbsUp} .id=${`thumbs-up-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${a.conversationId}-${s ? "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=${a.onThumbsDown} .id=${`thumbs-down-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start><span>${t.unhelpful ?? "Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
|
|
199
200
|
}
|
|
200
|
-
const
|
|
201
|
+
const ge = "arcade_generation", ve = "ArcadeCodeRequest", w = "visualization", ye = "ArcadeAssistant", $e = [
|
|
201
202
|
"your_comments",
|
|
202
203
|
"user_evaluation",
|
|
203
204
|
"question",
|
|
@@ -208,10 +209,10 @@ const be = "arcade_generation", ge = "ArcadeCodeRequest", x = "visualization", v
|
|
|
208
209
|
"context",
|
|
209
210
|
"extras"
|
|
210
211
|
];
|
|
211
|
-
let P = [],
|
|
212
|
-
class
|
|
212
|
+
let P = [], M = !0;
|
|
213
|
+
class ke extends H {
|
|
213
214
|
constructor() {
|
|
214
|
-
super(...arguments), this.textAreaRef =
|
|
215
|
+
super(...arguments), this.textAreaRef = j(), this.messages = G(), this._feedbackService = void 0, this.handleFeedbackButton = (e, t) => {
|
|
215
216
|
this.feedback = { active: !0, value: e, item: t, termsAccepted: !1, text: "", submitting: !1 };
|
|
216
217
|
}, this.handleFeedbackSheetClose = () => {
|
|
217
218
|
this.feedback = {
|
|
@@ -226,8 +227,8 @@ class $e extends V {
|
|
|
226
227
|
this.handleFeedbackSheetClose();
|
|
227
228
|
return;
|
|
228
229
|
}
|
|
229
|
-
const t = this.getModel(), o = t ? await this.getProfileAndMetadata(t.uri) : void 0, c =
|
|
230
|
-
!c && !this.appVersion &&
|
|
230
|
+
const t = this.getModel(), o = t ? await this.getProfileAndMetadata(t.uri) : void 0, c = Z.applicationName;
|
|
231
|
+
!c && !this.appVersion && b("warn", this, "esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");
|
|
231
232
|
const n = {
|
|
232
233
|
user_evaluation: this.feedback.value,
|
|
233
234
|
your_comments: this.feedback.text || void 0,
|
|
@@ -240,7 +241,7 @@ class $e extends V {
|
|
|
240
241
|
*/
|
|
241
242
|
answer: encodeURIComponent(this.feedback.item?.formattedScript ?? ""),
|
|
242
243
|
useragent: navigator.userAgent,
|
|
243
|
-
_source:
|
|
244
|
+
_source: ye,
|
|
244
245
|
version: this.appVersion || c || "NOT_SET",
|
|
245
246
|
context: o ? JSON.stringify(o) : "",
|
|
246
247
|
extras: o?.profileName ?? "",
|
|
@@ -248,9 +249,9 @@ class $e extends V {
|
|
|
248
249
|
privacy_statement: this.feedback.termsAccepted ? "I_agree" : ""
|
|
249
250
|
};
|
|
250
251
|
try {
|
|
251
|
-
await e.applyEdits({ addFeatures: [new
|
|
252
|
+
await e.applyEdits({ addFeatures: [new ee({ attributes: n })] });
|
|
252
253
|
} catch (u) {
|
|
253
|
-
|
|
254
|
+
b("error", this, `Error submitting feedback. ${String(u)}`);
|
|
254
255
|
}
|
|
255
256
|
this.handleFeedbackSheetClose();
|
|
256
257
|
}, this.handleClose = (e) => {
|
|
@@ -267,7 +268,7 @@ class $e extends V {
|
|
|
267
268
|
this.properties = { isViewingResult: 16, confirmationActive: 16, isSubmitting: 16, errorMessage: 16, question: 16, history: 16, feedback: 16, splashActive: 16, context: 16, historyCards: 16, closePanel: 0, insertText: 0, helpBase: 1, assistantsEnabled: 5, layer: [1, { type: Object }], portalUrl: 1, serviceUrl: 1, closed: 7, editorRef: 0, feedbackServiceUrl: 1, appVersion: 1 };
|
|
268
269
|
}
|
|
269
270
|
static {
|
|
270
|
-
this.styles =
|
|
271
|
+
this.styles = ie;
|
|
271
272
|
}
|
|
272
273
|
get disclaimerComment() {
|
|
273
274
|
return `// ${this.messages.disclaimercomment}
|
|
@@ -295,10 +296,10 @@ class $e extends V {
|
|
|
295
296
|
this.context = o;
|
|
296
297
|
};
|
|
297
298
|
e().catch((t) => {
|
|
298
|
-
|
|
299
|
-
}), this.manager.onLifecycle(() => ({ remove:
|
|
299
|
+
b("error", this, `Error setting initial context. ${String(t)}`);
|
|
300
|
+
}), this.manager.onLifecycle(() => ({ remove: I.onModelContextDidChange(async () => {
|
|
300
301
|
e().catch((o) => {
|
|
301
|
-
|
|
302
|
+
b("error", this, `Error setting context. ${String(o)}`);
|
|
302
303
|
});
|
|
303
304
|
}).dispose }));
|
|
304
305
|
}
|
|
@@ -306,10 +307,10 @@ class $e extends V {
|
|
|
306
307
|
(e.has("history") || e.has("messages")) && (this.historyCards = this.getHistoryCards());
|
|
307
308
|
}
|
|
308
309
|
connectedCallback() {
|
|
309
|
-
super.connectedCallback(), this.history = P, this.splashActive =
|
|
310
|
+
super.connectedCallback(), this.history = P, this.splashActive = M;
|
|
310
311
|
}
|
|
311
312
|
disconnectedCallback() {
|
|
312
|
-
super.disconnectedCallback(), P = this.history,
|
|
313
|
+
super.disconnectedCallback(), P = this.history, M = this.splashActive, this.copySuccessTimer && (clearTimeout(this.copySuccessTimer), this.copySuccessTimer = void 0);
|
|
313
314
|
}
|
|
314
315
|
getHistoryCards() {
|
|
315
316
|
return this.history.reduce((e, t) => (!t.script || (e.push({
|
|
@@ -317,12 +318,12 @@ class $e extends V {
|
|
|
317
318
|
code: t.formattedScript || t.error || "",
|
|
318
319
|
chips: [
|
|
319
320
|
{
|
|
320
|
-
label: t.profile ??
|
|
321
|
+
label: t.profile ?? w,
|
|
321
322
|
icon: "map-information",
|
|
322
323
|
appearance: "outline",
|
|
323
324
|
scale: "s",
|
|
324
325
|
conversationId: t.conversationId ?? "",
|
|
325
|
-
tooltip: (this.messages.profilecontextlabel ?? "Profile context: {profileName}").replace("{profileName}", t.profile ??
|
|
326
|
+
tooltip: (this.messages.profilecontextlabel ?? "Profile context: {profileName}").replace("{profileName}", t.profile ?? w)
|
|
326
327
|
},
|
|
327
328
|
...t.layerName ? [
|
|
328
329
|
{
|
|
@@ -336,7 +337,7 @@ class $e extends V {
|
|
|
336
337
|
] : []
|
|
337
338
|
],
|
|
338
339
|
onAddToEditor: (o) => {
|
|
339
|
-
|
|
340
|
+
J(this.editorRef.editorInstance, t.formattedScript ?? "", o, this.disclaimerComment);
|
|
340
341
|
},
|
|
341
342
|
onThumbsUp: () => this.handleFeedbackButton("good", t),
|
|
342
343
|
onThumbsDown: () => this.handleFeedbackButton("bad", t),
|
|
@@ -352,11 +353,11 @@ class $e extends V {
|
|
|
352
353
|
return this._feedbackService;
|
|
353
354
|
if (!this.feedbackServiceUrl)
|
|
354
355
|
return;
|
|
355
|
-
const e = new
|
|
356
|
+
const e = new X({ url: this.feedbackServiceUrl });
|
|
356
357
|
await e.load();
|
|
357
|
-
const t =
|
|
358
|
+
const t = $e.filter((o) => !e.fields.some((c) => c.name === o));
|
|
358
359
|
if (t.length > 0) {
|
|
359
|
-
|
|
360
|
+
b("error", this, `Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
|
|
360
361
|
return;
|
|
361
362
|
}
|
|
362
363
|
return this._feedbackService = e, e;
|
|
@@ -371,13 +372,13 @@ class $e extends V {
|
|
|
371
372
|
const e = await this.getToken(), t = this.getModel();
|
|
372
373
|
if (!t)
|
|
373
374
|
return;
|
|
374
|
-
const { profileName: o, metadata: c, layerName: n } = await this.getProfileAndMetadata(t.uri), d = (await
|
|
375
|
+
const { profileName: o, metadata: c, layerName: n } = await this.getProfileAndMetadata(t.uri), d = (await oe({
|
|
375
376
|
baseUrl: this.serviceUrl,
|
|
376
|
-
skillId:
|
|
377
|
+
skillId: ge,
|
|
377
378
|
message: this.question,
|
|
378
379
|
authToken: e,
|
|
379
380
|
context: {
|
|
380
|
-
kind:
|
|
381
|
+
kind: ve,
|
|
381
382
|
context: {
|
|
382
383
|
profile_name: o,
|
|
383
384
|
metadata: c
|
|
@@ -389,7 +390,7 @@ class $e extends V {
|
|
|
389
390
|
d.context?.kind === "ArcadeCodeResponse" && (this.history = [
|
|
390
391
|
{
|
|
391
392
|
script: d?.context?.arcadeCode?.code,
|
|
392
|
-
formattedScript:
|
|
393
|
+
formattedScript: K(d?.context?.arcadeCode?.code ?? ""),
|
|
393
394
|
error: void 0,
|
|
394
395
|
question: this.question,
|
|
395
396
|
profile: o,
|
|
@@ -400,19 +401,19 @@ class $e extends V {
|
|
|
400
401
|
...this.history
|
|
401
402
|
], this.isViewingResult = !0, this.errorMessage = void 0);
|
|
402
403
|
} catch (e) {
|
|
403
|
-
e instanceof Error && e.name === "ArcadeAssistantError" ? this.errorMessage =
|
|
404
|
+
e instanceof Error && e.name === "ArcadeAssistantError" ? this.errorMessage = se(e) || this.messages.erroroccurred || "An error occurred." : this.errorMessage = this.messages.erroroccurred || "An error occurred.", b("error", this, e);
|
|
404
405
|
} finally {
|
|
405
406
|
this.isSubmitting = !1;
|
|
406
407
|
}
|
|
407
408
|
}
|
|
408
409
|
}
|
|
409
410
|
async getToken() {
|
|
410
|
-
const { token: e } = await
|
|
411
|
+
const { token: e } = await W.getCredential(this.portalUrl);
|
|
411
412
|
return e;
|
|
412
413
|
}
|
|
413
414
|
async getProfileAndMetadata(e) {
|
|
414
|
-
let t =
|
|
415
|
-
const o =
|
|
415
|
+
let t = w;
|
|
416
|
+
const o = I.getEditorProfileForModel(e);
|
|
416
417
|
o?.loaded || await o?.loadSource();
|
|
417
418
|
const c = this.editorRef.profile;
|
|
418
419
|
c && "id" in c && (t = c.id);
|
|
@@ -422,7 +423,7 @@ class $e extends V {
|
|
|
422
423
|
name: s.name,
|
|
423
424
|
type: s.type,
|
|
424
425
|
alias: s.alias
|
|
425
|
-
})),
|
|
426
|
+
})), te(n?.definition) && (d = n.definition.title)), { profileName: t, metadata: u, layerName: d };
|
|
426
427
|
}
|
|
427
428
|
onCopyCode(e) {
|
|
428
429
|
const t = e ? `${this.disclaimerComment}
|
|
@@ -430,9 +431,9 @@ ${e}` : "";
|
|
|
430
431
|
return navigator.clipboard.writeText(t);
|
|
431
432
|
}
|
|
432
433
|
render() {
|
|
433
|
-
return this.closed ? null : this.assistantsEnabled ? r`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.splashActive && r`<calcite-scrim></calcite-scrim>` || ""}${
|
|
434
|
+
return this.closed ? null : this.assistantsEnabled ? r`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.splashActive && r`<calcite-scrim></calcite-scrim>` || ""}${re({ messages: this.messages })}${ne({ popoverContent: R({ assistantsEnabled: this.assistantsEnabled, messages: this.messages, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.splashActive && fe({ messages: this.messages, onProceed: () => {
|
|
434
435
|
this.splashActive = !1;
|
|
435
|
-
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (e) => this.closePanel
|
|
436
|
+
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (e) => this.closePanel?.(e) }) || ""}${le({ active: this.confirmationActive, setActive: (e) => this.confirmationActive = e, messages: this.messages })}${pe({ isDisabled: this.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestion, setIsViewingResult: (e) => this.isViewingResult = e, mode: this.isViewingResult ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.question, errorMessage: this.errorMessage, setErrorMessage: (e) => this.errorMessage = e, submitQuestion: this.submitQuestion.bind(this), messages: this.messages, context: this.context })}<calcite-block-group label="interactive blocks">${!this.isViewingResult && !this.isSubmitting && be({ messages: this.messages, suggestions: [this.messages.prompsuggestion1 ?? "", this.messages.prompsuggestion2 ?? ""], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${q({
|
|
436
437
|
expanded: this.isViewingResult,
|
|
437
438
|
messages: this.messages,
|
|
438
439
|
collapsible: !0,
|
|
@@ -443,7 +444,7 @@ ${e}` : "";
|
|
|
443
444
|
hidden: this.isSubmitting || !this.isViewingResult,
|
|
444
445
|
onCopyCode: this.onCopyCode.bind(this),
|
|
445
446
|
standalone: !0
|
|
446
|
-
})}${
|
|
447
|
+
})}${q({
|
|
447
448
|
expanded: !this.isViewingResult,
|
|
448
449
|
messages: this.messages,
|
|
449
450
|
collapsible: !0,
|
|
@@ -457,10 +458,10 @@ ${e}` : "";
|
|
|
457
458
|
heading: this.messages.recentprompts ?? "Recent prompts",
|
|
458
459
|
hidden: this.isSubmitting || this.history.length === 0,
|
|
459
460
|
onCopyCode: this.onCopyCode.bind(this)
|
|
460
|
-
})}</calcite-block-group>${this.feedback.active ?
|
|
461
|
+
})}</calcite-block-group>${this.feedback.active ? me({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, onSubmit: this.handleFeedbackSubmit, feedback: this.feedback, setFeedback: this.setFeedbackState.bind(this) }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : r`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${R({ slot: "content-top", messages: this.messages, assistantsEnabled: this.assistantsEnabled, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
|
|
461
462
|
}
|
|
462
463
|
}
|
|
463
|
-
|
|
464
|
+
V("arcgis-arcade-coding-assistant", ke);
|
|
464
465
|
export {
|
|
465
|
-
|
|
466
|
+
ke as ArcgisArcadeCodingAssistant
|
|
466
467
|
};
|
|
@@ -17,7 +17,7 @@ import { s as U } from "../../chunks/editor.js";
|
|
|
17
17
|
import j from "@arcgis/core/identity/IdentityManager.js";
|
|
18
18
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
19
19
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
20
|
-
v5.0.0-next.
|
|
20
|
+
v5.0.0-next.82 */
|
|
21
21
|
const z = w`@layer{arcgis-arcade-editor{display:flex;flex-direction:column;position:relative;overflow:hidden;border:var(--arcgis-coding-components-border)!important;box-sizing:border-box;background-color:var(--arcgis-coding-components-background-color);height:100%;.sticky{position:sticky;top:0;z-index:10}.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1);text-align:center}.main-action-bar{border-bottom:var(--arcgis-coding-components-border)!important;flex:0 0 auto;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)}}arcgis-arcade-results{border-top:var(--arcgis-coding-components-border)!important;box-sizing:border-box;max-height:50%;min-height:50%;margin-bottom:-1px}calcite-flow{[slot=footer]{word-break:break-word}}.hidden{display:none}}}`, N = "https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0", O = (s) => {
|
|
22
22
|
const { aiAssistantsEnabled: e } = s;
|
|
23
23
|
return e === void 0 ? (console.warn("areAiAssistantsEnabled is not defined in the organizations settings."), !1) : e;
|
|
@@ -11,7 +11,7 @@ import { t as k } from "../../chunks/monaco-theme.js";
|
|
|
11
11
|
import { observeAncestorsMutation as z, unsafeGetCalciteModeName as N } from "@arcgis/toolkit/dom";
|
|
12
12
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
13
13
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
14
|
-
v5.0.0-next.
|
|
14
|
+
v5.0.0-next.82 */
|
|
15
15
|
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}.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 = {
|
|
16
16
|
lines: !0,
|
|
17
17
|
selectionMode: "none",
|
|
@@ -9,7 +9,7 @@ import { c as b } from "../../chunks/markdown.js";
|
|
|
9
9
|
import { u as _ } from "../../chunks/useT9n.js";
|
|
10
10
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
11
11
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
12
|
-
v5.0.0-next.
|
|
12
|
+
v5.0.0-next.82 */
|
|
13
13
|
function v(o) {
|
|
14
14
|
return !Array.isArray(o) || !o.length ? !1 : Array.isArray(o[0].suggestions);
|
|
15
15
|
}
|
|
@@ -10,7 +10,7 @@ import { load as I } from "@arcgis/lumina/controllers";
|
|
|
10
10
|
import { Range as v, Uri as s, KeyMod as n, KeyCode as r } from "monaco-editor";
|
|
11
11
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
12
12
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
13
|
-
v5.0.0-next.
|
|
13
|
+
v5.0.0-next.82 */
|
|
14
14
|
const M = f`@layer{arcgis-code-editor{display:flex;width:100%;height:100%;flex-direction:column;direction:ltr;.monaco-editor{flex:1 1 auto;.monaco-hover,.editor-widget,.suggest-details-container{z-index:9999}div[widgetid="editor.contrib.resizableContentHoverWidget"],div[widgetid="editor.widget.suggestWidget"],div[widgetid="suggest.details"]{z-index:calc(var(--calcite-z-index-header) + 1)!important}}}}`, y = {
|
|
15
15
|
autoIndent: "advanced",
|
|
16
16
|
automaticLayout: !0,
|
|
@@ -11,7 +11,7 @@ import { debounce as y } from "@arcgis/toolkit/function";
|
|
|
11
11
|
import { Task as N } from "@lit/task";
|
|
12
12
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
13
13
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
14
|
-
v5.0.0-next.
|
|
14
|
+
v5.0.0-next.82 */
|
|
15
15
|
const O = E`pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);white-space:pre-line;code{font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code)}}:host([round]){pre{border-radius:var(--calcite-corner-radius-round)}}`;
|
|
16
16
|
class w extends p {
|
|
17
17
|
constructor() {
|
|
@@ -7,7 +7,7 @@ import { createFilterExpression as f } from "@arcgis/toolkit/string";
|
|
|
7
7
|
import { u as m } from "../../chunks/useT9n.js";
|
|
8
8
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
9
9
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
10
|
-
v5.0.0-next.
|
|
10
|
+
v5.0.0-next.82 */
|
|
11
11
|
const u = n`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-list-item-group{background-color:var(--calcite-color-foreground-2);word-break:break-word}}`;
|
|
12
12
|
function g(l) {
|
|
13
13
|
l.key === "Enter" && l.stopPropagation();
|