@arcgis/coding-components 4.34.0-next.21 → 4.34.0-next.23
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/arcade-coding-assistant/chat-helper.d.ts +24 -7
- package/dist/addons/arcade-coding-assistant/temporary-strings.d.ts +18 -3
- package/dist/addons.js +21 -20
- package/dist/cdn/{AWIFVV3B.js → 2FQ7YVLC.js} +2 -2
- package/dist/cdn/{D6HEWBPW.js → 2IOR5QSL.js} +1 -1
- package/dist/cdn/{LFWH37K6.js → 2KJOX5IZ.js} +2 -2
- package/dist/cdn/{2OY2OOHB.js → 3FPGUCCL.js} +2 -2
- package/dist/cdn/{RK2DRTIK.js → 5F4DCFVZ.js} +2 -2
- package/dist/cdn/{PML43ZG4.js → 7ISXZSA5.js} +2 -2
- package/dist/cdn/{2MBS54CP.js → 7KNYRKG2.js} +2 -2
- package/dist/cdn/{HXOGCC2Y.js → 7NVGKOCX.js} +2 -2
- package/dist/cdn/{D2XTCFJF.js → ANR5ASXO.js} +6 -5
- package/dist/cdn/{WQI5U62H.js → B4J3SZXA.js} +2 -2
- package/dist/cdn/{ZM4PE572.js → BFJLU5TB.js} +2 -2
- package/dist/cdn/{AXYFA76H.js → CFCOBW6Q.js} +2 -2
- package/dist/cdn/{OO6NPCQP.js → D62LM645.js} +3 -3
- package/dist/cdn/{4RVJX5WW.js → DBB7NRVS.js} +2 -2
- package/dist/cdn/{RUQSKYNM.js → EO3WOJPZ.js} +2 -2
- package/dist/cdn/{FT3O4I6P.js → F7267OEU.js} +2 -2
- package/dist/cdn/{T7TBIZIA.js → H4JKERKZ.js} +2 -2
- package/dist/cdn/{7OW3V2VS.js → IHPGB43C.js} +2 -2
- package/dist/cdn/{JZ3AKIKL.js → IIOP6XY2.js} +2 -2
- package/dist/cdn/{MHHNM6IR.js → JBNYS5F2.js} +2 -2
- package/dist/cdn/{V4Y6OY32.js → JBZ2GMUK.js} +1 -1
- package/dist/cdn/KLOZJ77F.js +6 -0
- package/dist/cdn/{APPIAUW3.js → N4DVN3GS.js} +2 -2
- package/dist/cdn/{JUPBFVGO.js → O2YL2JUQ.js} +2 -2
- package/dist/cdn/{W7IU44PK.js → OXVGTT4W.js} +2 -2
- package/dist/cdn/{4DWQHJO3.js → PHBNYBCC.js} +2 -2
- package/dist/cdn/{N3TJ3VAW.js → PTG75MHZ.js} +2 -2
- package/dist/cdn/PXA3YLUR.js +4 -0
- package/dist/cdn/{S22HBPCN.js → Q6FCWZFM.js} +2 -2
- package/dist/cdn/{7BH6A67O.js → QSFG2YIG.js} +1 -1
- package/dist/cdn/{P7WXJALE.js → TBWX2USS.js} +2 -2
- package/dist/cdn/{MWPPYTAZ.js → TE4SY2SU.js} +2 -2
- package/dist/cdn/{AMWSSI6Z.js → UWDUHENZ.js} +2 -2
- package/dist/cdn/{4I55HTRW.js → VCRMY6J2.js} +2 -2
- package/dist/cdn/{GCKT6QGO.js → W7MARMNE.js} +2 -2
- package/dist/cdn/{CK4ZO3NV.js → WJAMK7MI.js} +2 -2
- package/dist/cdn/{3D4I7ZIH.js → WS7AZJK4.js} +2 -2
- package/dist/cdn/{4FGPQQ2A.js → XFR5OYYY.js} +2 -2
- package/dist/cdn/{GSBW6FVS.js → XQDRSKSG.js} +1 -1
- package/dist/cdn/{DES4FCYE.js → XV3ND7JN.js} +2 -2
- package/dist/cdn/{T6QGH7YS.js → YVP7VF6D.js} +2 -2
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +37715 -37637
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/arcade-defaults.js +2 -2
- package/dist/chunks/arcade-executor.js +42 -41
- package/dist/chunks/arcade-mode.js +1 -1
- package/dist/chunks/arcade-service-accessors.js +1 -1
- package/dist/chunks/editor.js +1 -1
- package/dist/chunks/fields.js +1 -1
- package/dist/chunks/language-defaults-base.js +4 -3
- package/dist/chunks/markdown.js +1 -1
- package/dist/chunks/monaco-importer.js +64 -44
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/setup-monaco.js +1 -1
- package/dist/chunks/sql-expr-contribution.js +1 -1
- package/dist/chunks/sql-expr-defaults.js +1 -1
- package/dist/chunks/sql-expr-mode.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/components/arcgis-arcade-coding-assistant/customElement.d.ts +3 -8
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +245 -155
- package/dist/components/arcgis-arcade-coding-assistant/functional.d.ts +17 -11
- package/dist/components/arcgis-arcade-coding-assistant/index.d.ts +5 -2
- package/dist/components/arcgis-arcade-coding-assistant/index.js +5 -2
- package/dist/components/arcgis-arcade-coding-assistant/types.d.ts +36 -0
- 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-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 +4 -4
- package/dist/utils/arcade-executor.d.ts +4 -0
- package/dist/utils/utilities.d.ts +1 -1
- package/package.json +6 -6
- package/dist/cdn/AD6BSLAM.js +0 -4
- package/dist/cdn/UPGWCEYX.js +0 -4
|
@@ -1,24 +1,36 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { html as
|
|
3
|
-
import { nothing as
|
|
4
|
-
import { ref as
|
|
5
|
-
import
|
|
1
|
+
import { c as N } from "../../chunks/runtime.js";
|
|
2
|
+
import { html as c } from "lit-html";
|
|
3
|
+
import { nothing as U, LitElement as V } from "@arcgis/lumina";
|
|
4
|
+
import { ref as D, createRef as O } from "lit/directives/ref.js";
|
|
5
|
+
import B from "@arcgis/core/identity/IdentityManager.js";
|
|
6
6
|
import { u as z } from "../../chunks/useT9n.js";
|
|
7
|
-
import { b as
|
|
8
|
-
import { css as
|
|
7
|
+
import { b as H } from "../../chunks/arcade-defaults.js";
|
|
8
|
+
import { css as L } from "@lit/reactive-element/css-tag.js";
|
|
9
9
|
import "lit";
|
|
10
|
-
import
|
|
11
|
-
import { a as
|
|
12
|
-
import { repeat as
|
|
10
|
+
import C from "@arcgis/core/request.js";
|
|
11
|
+
import { a as j, e as W } from "../../chunks/monaco-importer.js";
|
|
12
|
+
import { repeat as Q } from "lit-html/directives/repeat.js";
|
|
13
13
|
import "@arcgis/components-utils";
|
|
14
|
-
import { unsafeHTML as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
14
|
+
import { unsafeHTML as S } from "lit/directives/unsafe-html.js";
|
|
15
|
+
import G from "@arcgis/core/layers/FeatureLayer.js";
|
|
16
|
+
import J from "@arcgis/core/Graphic.js";
|
|
17
|
+
import { b as Y } from "../../chunks/language-defaults-base.js";
|
|
17
18
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
18
19
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
19
|
-
v4.34.0-next.
|
|
20
|
-
const
|
|
21
|
-
|
|
20
|
+
v4.34.0-next.23 */
|
|
21
|
+
const K = L`:host(:not([closed])){flex:1 0 auto;border-inline-start:var(--arcgis-coding-components-border);box-sizing:border-box;max-width:var(--arcgis-coding-components-side-panel-max-w);width:var(--arcgis-coding-components-side-panel-w);.response-actions{display:flex;align-items:center;padding:.5rem;gap:.5rem}.response-actions>div{display:flex;gap:.5rem}.prompt-list calcite-list-item{margin-block-end:.5rem;border-radius:var(--calcite-corner-radius-round);--calcite-color-border-3: transparent;overflow:hidden}.feedback-content{padding:1rem;display:flex;flex-direction:column;gap:.75rem}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: auto;--calcite-sheet-min-height: auto}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-list-item:focus calcite-button{position:relative;top:-2px}.prompt-list calcite-list-item:last-of-type{margin-block-end:0}calcite-list{--calcite-color-foreground-1: transparent;background-color:transparent}calcite-list-item{--calcite-color-foreground-1: white}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent}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;flex-direction:column;background:#fff;border-radius:var(--calcite-corner-radius-round);margin:.75rem;width:calc(100% - 1.5rem);overflow:hidden;max-width:calc(100% - 1.5rem);--calcite-color-border-input: transparent;--calcite-text-area-divider-color: transparent;position:sticky;align-self:flex-end;box-shadow:var(--calcite-shadow-sm);flex:none}.text-area-wrapper calcite-button:last-of-type{margin-inline-start:auto;align-self:flex-end}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}.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-chips{--calcite-chip-background-color: var(--calcite-color-foreground-current);--calcite-chip-text-color: var(--calcite-color-brand);calcite-chip{cursor:pointer}}.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-background-color: white;--calcite-card-border-color: transparent;width:100%}.positioned-code-content{flex-direction:row;gap:.5rem;display:flex;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{margin:.25rem 0 .75rem;max-width:95%;overflow-y:hidden;overflow-x:auto;padding:0}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}.copy-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}}:host([closed]){display:none}`;
|
|
22
|
+
class x extends Error {
|
|
23
|
+
constructor({
|
|
24
|
+
message: e,
|
|
25
|
+
code: t,
|
|
26
|
+
subCode: a,
|
|
27
|
+
details: s,
|
|
28
|
+
source: o
|
|
29
|
+
}) {
|
|
30
|
+
super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = a, this.details = s, this.source = o;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function E(i) {
|
|
22
34
|
if (!i)
|
|
23
35
|
return;
|
|
24
36
|
const e = i.indexOf('{"error":');
|
|
@@ -31,132 +43,149 @@ function R(i) {
|
|
|
31
43
|
return;
|
|
32
44
|
}
|
|
33
45
|
}
|
|
34
|
-
async function
|
|
35
|
-
const { baseUrl: e, skillId: t, message: a, authToken:
|
|
46
|
+
async function X(i) {
|
|
47
|
+
const { baseUrl: e, skillId: t, message: a, authToken: s, previousConversationId: o, context: l } = i, r = t ? `${e}/skills/${t}/chat` : `${e}/chat`, n = [], d = {
|
|
36
48
|
message: a,
|
|
37
|
-
context:
|
|
49
|
+
context: l
|
|
38
50
|
};
|
|
39
|
-
o && (
|
|
40
|
-
let
|
|
51
|
+
o && (d.conversation_id = o);
|
|
52
|
+
let b;
|
|
41
53
|
try {
|
|
42
|
-
|
|
54
|
+
b = await C(r, {
|
|
43
55
|
method: "post",
|
|
44
56
|
headers: {
|
|
45
57
|
"Content-Type": "application/json",
|
|
46
|
-
token:
|
|
58
|
+
token: s
|
|
47
59
|
},
|
|
48
|
-
body: JSON.stringify(
|
|
60
|
+
body: JSON.stringify(d),
|
|
49
61
|
responseType: "json"
|
|
50
62
|
});
|
|
51
|
-
} catch (
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
);
|
|
55
|
-
throw v && (g.arcadeAssistantError = v), g;
|
|
63
|
+
} catch (g) {
|
|
64
|
+
const v = g, A = v.details?.rawResponse || v.message || String(g), y = E(A);
|
|
65
|
+
throw y ? new x(y) : g;
|
|
56
66
|
}
|
|
57
|
-
const
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
const v = L(T, w, M);
|
|
69
|
-
let g;
|
|
67
|
+
const f = b.data;
|
|
68
|
+
n.push(f);
|
|
69
|
+
const h = f.conversationId, $ = f.inquiryId;
|
|
70
|
+
let p = f.sequenceNumber;
|
|
71
|
+
async function w() {
|
|
72
|
+
let g = 0;
|
|
73
|
+
const v = 25;
|
|
74
|
+
for (; g < v; ) {
|
|
75
|
+
await new Promise((k) => setTimeout(k, 1e3));
|
|
76
|
+
const A = Z(h, p, $);
|
|
77
|
+
let y;
|
|
70
78
|
try {
|
|
71
|
-
|
|
79
|
+
y = await C(r, {
|
|
72
80
|
method: "post",
|
|
73
81
|
headers: {
|
|
74
82
|
"Content-Type": "application/json",
|
|
75
|
-
token:
|
|
83
|
+
token: s
|
|
76
84
|
},
|
|
77
|
-
body: JSON.stringify(
|
|
85
|
+
body: JSON.stringify(A),
|
|
78
86
|
responseType: "json"
|
|
79
87
|
});
|
|
80
|
-
} catch (
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
);
|
|
84
|
-
throw $ && (A.arcadeAssistantError = $), A;
|
|
85
|
-
}
|
|
86
|
-
const u = g.data;
|
|
87
|
-
if (u.context && u.context.kind === "ArcgisErrorAsContext" && u.context.error) {
|
|
88
|
-
const h = new Error(
|
|
89
|
-
u.context.error.message || "ArcGIS Assistant error"
|
|
90
|
-
);
|
|
91
|
-
throw h.arcadeAssistantError = { message: u.context.error.message ?? "ArcGIS Assistant error" }, h;
|
|
88
|
+
} catch (k) {
|
|
89
|
+
const T = k, _ = T.details?.rawResponse || T.message || String(k), I = E(_);
|
|
90
|
+
throw I ? new x(I) : k;
|
|
92
91
|
}
|
|
93
|
-
|
|
92
|
+
const m = y.data;
|
|
93
|
+
if (m.context && m.context.kind === "ArcgisErrorAsContext" && m.context.error)
|
|
94
|
+
throw new x({
|
|
95
|
+
message: m.context.error.message || "ArcGIS Assistant error",
|
|
96
|
+
code: m.context.error.code,
|
|
97
|
+
subCode: m.context.error.subCode,
|
|
98
|
+
details: m.context.error.details,
|
|
99
|
+
source: "polling-response"
|
|
100
|
+
});
|
|
101
|
+
if (n.push(m), p = m.sequenceNumber, g++, !m.hasMore)
|
|
94
102
|
break;
|
|
95
103
|
}
|
|
96
|
-
if (
|
|
97
|
-
throw new
|
|
104
|
+
if (g === v)
|
|
105
|
+
throw new x({
|
|
106
|
+
message: "Request timed out",
|
|
107
|
+
code: "TIMEOUT",
|
|
108
|
+
source: "polling"
|
|
109
|
+
});
|
|
98
110
|
}
|
|
99
|
-
|
|
111
|
+
const F = 2 * 60 * 1e3;
|
|
112
|
+
return await Promise.race([
|
|
113
|
+
w(),
|
|
114
|
+
new Promise(
|
|
115
|
+
(g, v) => setTimeout(
|
|
116
|
+
() => v(
|
|
117
|
+
new x({
|
|
118
|
+
message: "Request timed out",
|
|
119
|
+
code: "TIMEOUT",
|
|
120
|
+
source: "hard-timeout"
|
|
121
|
+
})
|
|
122
|
+
),
|
|
123
|
+
F
|
|
124
|
+
)
|
|
125
|
+
)
|
|
126
|
+
]), n;
|
|
100
127
|
}
|
|
101
|
-
function
|
|
128
|
+
function Z(i, e, t) {
|
|
102
129
|
return {
|
|
103
130
|
conversationId: i,
|
|
104
131
|
inquiryId: t,
|
|
105
132
|
ackSequenceNumber: e
|
|
106
133
|
};
|
|
107
134
|
}
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
135
|
+
function ee(i) {
|
|
136
|
+
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
|
+
const te = (i) => {
|
|
139
|
+
const e = i.value.length, t = 72, a = 180, s = i.offsetWidth, l = Math.max(1, Math.floor(s / 8)), r = Math.ceil(e / l), n = t + (r - 2) * 24;
|
|
140
|
+
i.style.setProperty("--calcite-text-area-min-height", `${Math.min(n, a)}px`);
|
|
111
141
|
};
|
|
112
|
-
function
|
|
113
|
-
return
|
|
142
|
+
function ie({ messages: i }) {
|
|
143
|
+
return c`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta ?? "Beta"}>${i.beta ?? "Beta"}</calcite-chip>`;
|
|
114
144
|
}
|
|
115
|
-
function
|
|
116
|
-
return
|
|
145
|
+
function ae({ popoverContent: i }) {
|
|
146
|
+
return c`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer overlay-positioning=fixed label=legal-disclaimer placement=bottom auto-close>${i}</calcite-popover>`;
|
|
117
147
|
}
|
|
118
|
-
function
|
|
119
|
-
return
|
|
148
|
+
function oe({ errorMessage: i }) {
|
|
149
|
+
return c`<calcite-input-message id=error-message status=invalid slot=footer-start icon=exclamation-mark-triangle scale=m>${i}</calcite-input-message>`;
|
|
120
150
|
}
|
|
121
|
-
function
|
|
122
|
-
return
|
|
151
|
+
function se({ active: i, setActive: e, messages: t }) {
|
|
152
|
+
return c`<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>`;
|
|
123
153
|
}
|
|
124
|
-
function
|
|
125
|
-
return
|
|
126
|
-
|
|
127
|
-
}} ${
|
|
154
|
+
function ce({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: a, textAreaRef: s, question: o, errorMessage: l, setErrorMessage: r, submitQuestion: n, messages: d, mode: b }) {
|
|
155
|
+
return c`<div class="text-area-wrapper"><calcite-text-area resize=vertical .readOnly=${i || e} class="styled-text-area" .placeholder=${d.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${o} @calciteTextAreaInput=${(f) => {
|
|
156
|
+
te(f.target), t(f.target.value);
|
|
157
|
+
}} ${D(s)}>${l && oe({ errorMessage: l }) || ""}</calcite-text-area><div class="response-actions" slot=footer-end><calcite-button round kind=neutral .hidden=${b !== "refine"} icon-start=arrow-left appearance=solid .disabled=${i} @click=${async () => {
|
|
128
158
|
a(!1), t("");
|
|
129
|
-
}}>${
|
|
130
|
-
|
|
131
|
-
}}>${
|
|
159
|
+
}}>${d.startover ?? "Start Over"}</calcite-button><calcite-button round icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async () => {
|
|
160
|
+
r(o ? "" : d.enteraprompt ?? "Please enter a prompt"), await n();
|
|
161
|
+
}}>${b === "prompt" ? d.ask ?? "Generate" : d.refine ?? "Refine"}</calcite-button></div></div>`;
|
|
132
162
|
}
|
|
133
|
-
|
|
134
|
-
|
|
163
|
+
const re = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-statement", ne = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement";
|
|
164
|
+
function le({ setOpen: i, messages: e, feedback: t, setFeedback: a, onSubmit: s }) {
|
|
165
|
+
return c`<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><calcite-segmented-control-item icon-start=thumbs-up .checked=${t.value === "good"} @click=${() => a({ ...t, value: "good" })}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${t.value === "bad"} @click=${() => a({ ...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=${(o) => a({ ...t, text: o.target.value })}></calcite-text-area></calcite-label><calcite-label layout=inline scale=s><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(o) => {
|
|
166
|
+
a({ ...t, termsAccepted: o.target.checked });
|
|
167
|
+
}}></calcite-checkbox><span>${S(e.agreement?.replace("{EsriPrivacyStatement}", `<calcite-link href=${re} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${ne} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label></div><calcite-button slot=footer width=full @click=${s} .disabled=${!t.termsAccepted || t.submitting} .loading=${t.submitting}>${e.submitfeedback ?? "Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>`;
|
|
135
168
|
}
|
|
136
|
-
function
|
|
137
|
-
return
|
|
169
|
+
function M({ assistantsEnabled: i, messages: e, slot: t, assistantHelpUrl: a, helpTopicUrl: s }) {
|
|
170
|
+
return c`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? U} expanded class="info-block"><calcite-chip .label=${e.new ?? "new"} kind=brand>${e.new}</calcite-chip><h1 class="info-heading">${e.introducing}</h1><p>${e.capabilities}</p>${i ? c`<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>${S((e.seedocumentation ?? "Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}", `<calcite-link href=${s} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : c`<p>${S(e.useofassistant?.replace("{aiassistants}", `<strong>${e.aiassistants ?? "Ai Assistants"}</strong>`))}<calcite-link .href=${a} target=_blank icon-end=launch-2>${e.opensettings ?? "Open Settings"}</calcite-link></p>`}</calcite-block>`;
|
|
138
171
|
}
|
|
139
|
-
function
|
|
140
|
-
return
|
|
141
|
-
"{privacyStatement}",
|
|
142
|
-
// TODO get correct link
|
|
143
|
-
`<calcite-link href="https://www.esri.com/en-us/privacy/arcgis-online-privacy-statement" target="_blank">${i.privacyStatement}</calcite-link>`
|
|
144
|
-
).replace("{privacySupplement}", `<calcite-link href="https://www.esri.com/en-us/privacy/arcgis-online-privacy-supplement" target="_blank">${i.privacySupplement}</calcite-link>`))}</div><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit}</calcite-button></calcite-dialog>`;
|
|
172
|
+
function de({ messages: i, onProceed: e, onExit: t, helpTopicUrl: a }) {
|
|
173
|
+
return c`<calcite-dialog close-disabled placement=top .heading=${i.welcome} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted}</h3><ul><li>${i.maybeincorrect}</li><li>${S(i.pleasereadhelp.replace("{helpTopic}", `<calcite-link href=${a} target="_blank">${i.helptopic}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit}</calcite-button></calcite-dialog>`;
|
|
145
174
|
}
|
|
146
|
-
function
|
|
147
|
-
return
|
|
175
|
+
function pe({ messages: i, suggestions: e, onSuggestionClick: t }) {
|
|
176
|
+
return c`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block><calcite-chip-group .label=${i.promptsuggestions} class="suggestion-chips">${Q(e, (a) => a, (a) => c`<calcite-chip .label=${i.promptsuggestion} .value=${a} icon=effects @click=${() => t?.(a)}>${a}</calcite-chip>`)}</calcite-chip-group></calcite-block>`;
|
|
148
177
|
}
|
|
149
|
-
function
|
|
150
|
-
|
|
178
|
+
function ue({ hidden: i = !1, expanded: e = !1, messages: t, cards: a, heading: s, collapsible: o = !1, showEffectsIcon: l = !1, editorInsertMode: r = "add", setEditorInsertMode: n }) {
|
|
179
|
+
const d = r === "replace", b = d ? t.replaceineditor ?? "Replace in editor" : t.addtoeditor ?? "Add to editor", f = d ? t.addtoeditor ?? "Add to editor" : t.replaceineditor ?? "Replace in editor";
|
|
180
|
+
return c`<calcite-block .hidden=${i} id=result-block .heading=${s ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${o}>${l && c`<calcite-chip label slot=content-start icon=effects kind=brand></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses}>${a.map((h, $) => c`<calcite-card><div slot=heading><div class="prior-prompt">${h.priorPrompt}</div></div><div><div class="code-response-wrapper"><div class="positioned-code-content">${h.chips?.map((p, w) => c`${p.tooltip && c`<calcite-tooltip .referenceElement=${`response-chip-${p.conversationId}-${w}`}>${p.tooltip}</calcite-tooltip>` || ""}<calcite-chip .label=${p.label} .scale=${p.scale ?? "s"} .appearance=${p.appearance ?? "outline"} .icon=${p.icon} .id=${`response-chip-${p.conversationId}-${w}`}>${p.label}</calcite-chip>`)}</div><code>${h.code}</code></div></div><div slot=footer-start><calcite-split-button primary-text=${b ?? U} appearance=outline-fill class="add-to-editor-button" @calciteSplitButtonPrimaryClick=${() => h.onAddToEditor()} overlay-positioning=fixed><calcite-dropdown-item @calciteDropdownItemSelect=${() => {
|
|
181
|
+
n?.(d ? "add" : "replace");
|
|
182
|
+
}}>${f}</calcite-dropdown-item></calcite-split-button><calcite-button round icon-start=copy-to-clipboard kind=neutral @click=${() => h.onCopy($)} class="copy-button">${h.copySuccessIndex === $ ? t.copied ?? "copied" : ""}</calcite-button></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup} scale=s icon=thumbs-up @click=${h.onThumbsUp}></calcite-action><calcite-action .text=${t.thumbsdown} scale=s icon=thumbs-down @click=${h.onThumbsDown}></calcite-action></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
|
|
151
183
|
}
|
|
152
|
-
const
|
|
184
|
+
const u = {
|
|
153
185
|
welcome: "Welcome to the new assistant experience",
|
|
154
186
|
beforeyougetstarted: "Before you get started be aware:",
|
|
155
187
|
maybeincorrect: "AI generated code may occasionally be incorrect or biased. Review carefully.",
|
|
156
|
-
pleasereadhelp: "
|
|
157
|
-
consultprivacy: "Consult the {privacyStatement} and {privacySupplement}.",
|
|
158
|
-
privacyStatement: "privacy statement",
|
|
159
|
-
privacySupplement: "privacy supplement",
|
|
188
|
+
pleasereadhelp: "Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.",
|
|
160
189
|
proceed: "Proceed",
|
|
161
190
|
exit: "Exit",
|
|
162
191
|
promptsuggestions: "Prompt suggestions",
|
|
@@ -167,8 +196,26 @@ const k = {
|
|
|
167
196
|
thumbsdown: "Thumbs down",
|
|
168
197
|
refine: "Refine",
|
|
169
198
|
startover: "Start over",
|
|
170
|
-
helptopic: "help topic"
|
|
171
|
-
|
|
199
|
+
helptopic: "help topic",
|
|
200
|
+
agreement: "I agree to the {EsriPrivacyStatement} (and {Supplement}).",
|
|
201
|
+
esriprivacystatement: "Esri Privacy Statement",
|
|
202
|
+
supplement: "Supplement",
|
|
203
|
+
disclaimerpt2: "AI-generated content may be inaccurate. Review before using.",
|
|
204
|
+
replaceineditor: "Replace in editor",
|
|
205
|
+
keepinmind: "Keep in mind the following:",
|
|
206
|
+
beconsise: "Be concise, but also clear in your request",
|
|
207
|
+
avoidambiguity: "Avoid ambiguity and vagueness",
|
|
208
|
+
documentation: "documentation",
|
|
209
|
+
useexamples: "Use examples to clarify your request",
|
|
210
|
+
moredetails: "You do not need to use exact field names in your instructions, but more detail is generally better",
|
|
211
|
+
seedocumentation: "Please see the {documentation} for more information, including limitations and additional resources.",
|
|
212
|
+
assistantinformation: "Assistant information",
|
|
213
|
+
profilecontextlabel: "Profile context: {profileName}",
|
|
214
|
+
layercontextlabel: "Layer context: {layerName}",
|
|
215
|
+
numlayers: "{numLayers} {layerOrLayers}",
|
|
216
|
+
numlayersplural: "layers",
|
|
217
|
+
numlayerssingular: "layer"
|
|
218
|
+
}, he = "arcade_generation", me = "ArcadeCodeRequest", R = "visualization", fe = "ArcadeAssistant", ge = [
|
|
172
219
|
"your_comments",
|
|
173
220
|
"user_evaluation",
|
|
174
221
|
"question",
|
|
@@ -179,33 +226,42 @@ const k = {
|
|
|
179
226
|
"context",
|
|
180
227
|
"extras"
|
|
181
228
|
];
|
|
182
|
-
let
|
|
183
|
-
class
|
|
229
|
+
let q = [], P = !0;
|
|
230
|
+
class be extends V {
|
|
184
231
|
constructor() {
|
|
185
|
-
super(...arguments), this.textAreaRef =
|
|
186
|
-
this.feedback
|
|
232
|
+
super(...arguments), this.textAreaRef = O(), this.messages = z(), this._feedbackService = void 0, this.handleFeedbackButton = (e, t) => {
|
|
233
|
+
this.feedback = { ...this.feedback, active: !0, value: e, item: t };
|
|
187
234
|
}, this.handleFeedbackSheetClose = () => {
|
|
188
|
-
this.feedback = {
|
|
235
|
+
this.feedback = {
|
|
236
|
+
active: !1,
|
|
237
|
+
value: void 0,
|
|
238
|
+
text: "",
|
|
239
|
+
item: void 0,
|
|
240
|
+
submitting: !1,
|
|
241
|
+
termsAccepted: !1
|
|
242
|
+
};
|
|
189
243
|
}, this.handleFeedbackSubmit = async () => {
|
|
244
|
+
this.feedback = { ...this.feedback, submitting: !0 };
|
|
190
245
|
const e = await this.ensureFeedbackService();
|
|
191
246
|
if (!e) {
|
|
192
247
|
this.handleFeedbackSheetClose();
|
|
193
248
|
return;
|
|
194
249
|
}
|
|
195
|
-
const t = this.getModel(), a = t ? await this.getProfileAndMetadata(t.uri) : void 0,
|
|
250
|
+
const t = this.getModel(), a = t ? await this.getProfileAndMetadata(t.uri) : void 0, s = {
|
|
196
251
|
user_evaluation: this.feedback.value,
|
|
197
252
|
your_comments: this.feedback.text || void 0,
|
|
198
253
|
question: this.question,
|
|
199
254
|
answer: this.feedback.item?.script ?? "",
|
|
200
255
|
useragent: navigator.userAgent,
|
|
201
|
-
_source:
|
|
256
|
+
_source: fe,
|
|
202
257
|
version: this.appVersion ?? "",
|
|
203
258
|
context: a ? JSON.stringify(a) : "",
|
|
204
259
|
extras: a?.profileName ?? "",
|
|
205
|
-
conversation_id: this.feedback.item?.conversationId ?? ""
|
|
260
|
+
conversation_id: this.feedback.item?.conversationId ?? "",
|
|
261
|
+
privacy_statement: this.feedback.termsAccepted ? "I_agree" : ""
|
|
206
262
|
};
|
|
207
263
|
try {
|
|
208
|
-
await e.applyEdits({ addFeatures: [new
|
|
264
|
+
await e.applyEdits({ addFeatures: [new J({ attributes: s })] });
|
|
209
265
|
} catch (o) {
|
|
210
266
|
console.error("Error submitting feedback:", o);
|
|
211
267
|
}
|
|
@@ -216,30 +272,50 @@ class pe extends V {
|
|
|
216
272
|
this.question = e;
|
|
217
273
|
}, this.onSuggestionClick = (e) => {
|
|
218
274
|
this.textAreaRef.value && (this.textAreaRef.value.value = e, this.textAreaRef.value.setFocus(), this.setQuestion(e));
|
|
219
|
-
}, this.isViewingResult = !1, this.confirmationActive = !1, this.isSubmitting = !1, this.errorMessage = void 0, this.question = "", this.history = [], this.feedback = {
|
|
275
|
+
}, this.isViewingResult = !1, this.confirmationActive = !1, this.isSubmitting = !1, this.errorMessage = void 0, this.question = "", this.history = [], this.feedback = {
|
|
276
|
+
active: !1,
|
|
277
|
+
value: void 0,
|
|
278
|
+
text: "",
|
|
279
|
+
item: void 0,
|
|
280
|
+
termsAccepted: !1,
|
|
281
|
+
submitting: !1
|
|
282
|
+
}, this.copySuccessIndex = -1, this.splashActive = !0, this.editorInsertMode = "add", this.helpBase = "", this.assistantsEnabled = !1, this.closed = !1;
|
|
220
283
|
}
|
|
221
284
|
static {
|
|
222
|
-
this.properties = { isViewingResult: 16, confirmationActive: 16, isSubmitting: 16, errorMessage: 16, question: 16, history: 16, feedback: 16,
|
|
285
|
+
this.properties = { isViewingResult: 16, confirmationActive: 16, isSubmitting: 16, errorMessage: 16, question: 16, history: 16, feedback: 16, copySuccessIndex: 16, splashActive: 16, editorInsertMode: 16, closePanel: 0, insertText: 0, helpBase: 1, assistantsEnabled: 5, layer: [1, { type: Object }], orgBaseUrl: 1, serviceUrl: 1, closed: 7, editorRef: 0, feedbackServiceUrl: 1, appVersion: 1 };
|
|
223
286
|
}
|
|
224
287
|
static {
|
|
225
|
-
this.styles =
|
|
288
|
+
this.styles = K;
|
|
289
|
+
}
|
|
290
|
+
get disclaimerComment() {
|
|
291
|
+
return `// ${this.messages.disclaimercomment}
|
|
292
|
+
// ${u.disclaimerpt2}`;
|
|
293
|
+
}
|
|
294
|
+
get assistantHelpUrl() {
|
|
295
|
+
return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}administer/configure-assistants.htm`;
|
|
296
|
+
}
|
|
297
|
+
get helpTopicUrl() {
|
|
298
|
+
return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}create-maps/arcade-assistant.htm`;
|
|
226
299
|
}
|
|
227
300
|
async destroy() {
|
|
228
301
|
}
|
|
229
302
|
connectedCallback() {
|
|
230
|
-
super.connectedCallback(), this.history =
|
|
303
|
+
super.connectedCallback(), this.history = q, this.splashActive = P;
|
|
231
304
|
}
|
|
232
305
|
disconnectedCallback() {
|
|
233
|
-
super.disconnectedCallback(),
|
|
306
|
+
super.disconnectedCallback(), q = this.history, P = this.splashActive, this.copySuccessTimer && (clearTimeout(this.copySuccessTimer), this.copySuccessTimer = void 0);
|
|
307
|
+
}
|
|
308
|
+
setFeedbackState(e) {
|
|
309
|
+
this.feedback = e;
|
|
234
310
|
}
|
|
235
311
|
async ensureFeedbackService() {
|
|
236
312
|
if (this._feedbackService)
|
|
237
313
|
return this._feedbackService;
|
|
238
314
|
if (!this.feedbackServiceUrl)
|
|
239
315
|
return;
|
|
240
|
-
const e = new
|
|
316
|
+
const e = new G({ url: this.feedbackServiceUrl });
|
|
241
317
|
await e.load();
|
|
242
|
-
const t =
|
|
318
|
+
const t = ge.filter((a) => !e.fields.some((s) => s.name === a));
|
|
243
319
|
if (t.length > 0) {
|
|
244
320
|
console.error(`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
|
|
245
321
|
return;
|
|
@@ -256,87 +332,101 @@ class pe extends V {
|
|
|
256
332
|
const e = await this.getToken(), t = this.getModel();
|
|
257
333
|
if (!t)
|
|
258
334
|
return;
|
|
259
|
-
const { profileName: a, metadata:
|
|
335
|
+
const { profileName: a, metadata: s, layerName: o } = await this.getProfileAndMetadata(t.uri), r = (await X({
|
|
260
336
|
baseUrl: this.serviceUrl,
|
|
261
|
-
skillId:
|
|
337
|
+
skillId: he,
|
|
262
338
|
message: this.question,
|
|
263
339
|
authToken: e,
|
|
264
340
|
context: {
|
|
265
|
-
kind:
|
|
341
|
+
kind: me,
|
|
266
342
|
context: {
|
|
267
343
|
profile_name: a,
|
|
268
|
-
metadata:
|
|
344
|
+
metadata: s
|
|
269
345
|
}
|
|
270
346
|
}
|
|
271
|
-
})).find((
|
|
347
|
+
})).find((n) => n.context?.kind === "ArcadeCodeResponse");
|
|
272
348
|
if (!r)
|
|
273
349
|
return;
|
|
274
350
|
r.context?.kind === "ArcadeCodeResponse" && (this.history.unshift({
|
|
275
351
|
script: r?.context?.arcadeCode?.code,
|
|
352
|
+
formattedScript: j(r?.context?.arcadeCode?.code ?? ""),
|
|
276
353
|
error: void 0,
|
|
277
354
|
question: this.question,
|
|
278
355
|
profile: a,
|
|
279
|
-
conversationId: r.conversationId
|
|
356
|
+
conversationId: r.conversationId,
|
|
357
|
+
layerName: o ?? void 0
|
|
280
358
|
}), this.isViewingResult = !0, this.errorMessage = void 0);
|
|
281
359
|
} catch (e) {
|
|
282
|
-
|
|
360
|
+
e instanceof Error && e.name === "ArcadeAssistantError" ? this.errorMessage = ee(e) || this.messages.erroroccurred || "An error occurred." : this.errorMessage = this.messages.erroroccurred || "An error occurred.", console.error("Error in Arcade Assistant:", e);
|
|
283
361
|
} finally {
|
|
284
362
|
this.isSubmitting = !1;
|
|
285
363
|
}
|
|
286
364
|
}
|
|
287
365
|
}
|
|
288
366
|
async getToken() {
|
|
289
|
-
const { token: e } = await
|
|
367
|
+
const { token: e } = await B.getCredential(this.orgBaseUrl);
|
|
290
368
|
return e;
|
|
291
369
|
}
|
|
292
370
|
async getProfileAndMetadata(e) {
|
|
293
|
-
let t =
|
|
294
|
-
const a =
|
|
371
|
+
let t = R;
|
|
372
|
+
const a = H.getEditorProfileForModel(e);
|
|
295
373
|
a?.loaded || await a?.loadSource();
|
|
296
|
-
const
|
|
297
|
-
|
|
298
|
-
const o = a?.definition?.variables?.find((
|
|
299
|
-
let
|
|
300
|
-
return o?.definition && "fields" in o.definition && (
|
|
301
|
-
name:
|
|
302
|
-
type:
|
|
303
|
-
alias:
|
|
304
|
-
}))), { profileName: t, metadata: r };
|
|
374
|
+
const s = this.editorRef.profile;
|
|
375
|
+
s && "id" in s && (t = s.id);
|
|
376
|
+
const o = a?.definition?.variables?.find((n) => n.type === "feature");
|
|
377
|
+
let l = [], r;
|
|
378
|
+
return o?.definition && "fields" in o.definition && (l = o.definition.fields.map((n) => ({
|
|
379
|
+
name: n.name,
|
|
380
|
+
type: n.type,
|
|
381
|
+
alias: n.alias
|
|
382
|
+
})), Y(o?.definition) && (r = o.definition.title)), { profileName: t, metadata: l, layerName: r };
|
|
305
383
|
}
|
|
306
384
|
render() {
|
|
307
|
-
return this.closed ? null : this.assistantsEnabled ?
|
|
385
|
+
return this.closed ? null : this.assistantsEnabled ? c`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.splashActive && c`<calcite-scrim></calcite-scrim>` || ""}${ie({ messages: this.messages })}${ae({ popoverContent: M({ assistantsEnabled: this.assistantsEnabled, messages: { ...this.messages, ...u }, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.helpTopicUrl }) })}<calcite-shell class="unstyled-shell">${this.splashActive && de({ messages: { ...u, ...this.messages }, onProceed: () => {
|
|
308
386
|
this.splashActive = !1;
|
|
309
|
-
}, onExit: (e) => this.closePanel && this.closePanel(e) }) || ""}${
|
|
387
|
+
}, helpTopicUrl: this.helpTopicUrl, onExit: (e) => this.closePanel && this.closePanel(e) }) || ""}${se({ active: this.confirmationActive, setActive: (e) => this.confirmationActive = e, messages: this.messages })}${ce({ 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: { ...u, ...this.messages } })}<calcite-block-group label="interactive blocks">${!this.isViewingResult && !this.isSubmitting && pe({ messages: { ...this.messages, ...u }, suggestions: ["Round value to one decimal place", 'Return "Yes" if value > 10'], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${ue({ expanded: this.isViewingResult || this.history.length > 0, messages: { ...this.messages, ...u }, collapsible: !0, showEffectsIcon: this.isViewingResult, editorInsertMode: this.editorInsertMode, setEditorInsertMode: (e) => this.editorInsertMode = e, cards: this.history.reduce((e, t, a) => (!t.script || this.isViewingResult && a > 0 || (e.push({
|
|
310
388
|
priorPrompt: t.question,
|
|
311
|
-
code:
|
|
389
|
+
code: t.formattedScript || t.error || "",
|
|
312
390
|
chips: [
|
|
313
391
|
// TODO implement profile and layer chips
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
392
|
+
{
|
|
393
|
+
label: t.profile ?? R,
|
|
394
|
+
icon: "map-information",
|
|
395
|
+
appearance: "outline",
|
|
396
|
+
scale: "s",
|
|
397
|
+
conversationId: t.conversationId ?? "",
|
|
398
|
+
tooltip: u.profilecontextlabel.replace("{profileName}", t.profile ?? R)
|
|
399
|
+
},
|
|
400
|
+
...t.layerName ? [
|
|
401
|
+
{
|
|
402
|
+
label: u.numlayers.replace("{numLayers}", "1").replace("{layerOrLayers}", u.numlayerssingular),
|
|
403
|
+
icon: "layer",
|
|
404
|
+
appearance: "outline",
|
|
405
|
+
scale: "s",
|
|
406
|
+
conversationId: t.conversationId ?? "",
|
|
407
|
+
tooltip: u.layercontextlabel.replace("{layerName}", t.layerName ?? "No layer")
|
|
408
|
+
}
|
|
409
|
+
] : []
|
|
321
410
|
],
|
|
322
411
|
onAddToEditor: () => {
|
|
323
|
-
|
|
412
|
+
W(this.editorRef.editorInstance, t.formattedScript ?? "", this.editorInsertMode, this.disclaimerComment);
|
|
324
413
|
},
|
|
325
|
-
onCopy: (
|
|
326
|
-
const o = t.
|
|
414
|
+
onCopy: (s) => {
|
|
415
|
+
const o = t.formattedScript ? `${this.disclaimerComment}
|
|
416
|
+
${t.formattedScript}` : "";
|
|
327
417
|
o && navigator.clipboard.writeText(o).then(() => {
|
|
328
|
-
this.
|
|
329
|
-
this.
|
|
418
|
+
this.copySuccessIndex = s, this.copySuccessTimer && clearTimeout(this.copySuccessTimer), this.copySuccessTimer = window.setTimeout(() => {
|
|
419
|
+
this.copySuccessIndex = -1, this.copySuccessTimer = void 0;
|
|
330
420
|
}, 1500);
|
|
331
421
|
});
|
|
332
422
|
},
|
|
333
423
|
onThumbsUp: () => this.handleFeedbackButton("good", t),
|
|
334
424
|
onThumbsDown: () => this.handleFeedbackButton("bad", t),
|
|
335
|
-
copySuccessIndex: this.
|
|
336
|
-
}), this.isViewingResult), e), []), heading: this.isViewingResult ? this.messages.besteffort ?? "Here's the assistant's best effort" : this.messages.recentprompts ?? "Recent prompts", hidden: this.isViewingResult ? !this.isViewingResult : !1 })}</calcite-block-group
|
|
425
|
+
copySuccessIndex: this.copySuccessIndex
|
|
426
|
+
}), this.isViewingResult), e), []), heading: this.isViewingResult ? this.messages.besteffort ?? "Here's the assistant's best effort" : this.messages.recentprompts ?? "Recent prompts", hidden: this.isViewingResult ? !this.isViewingResult : !1 })}</calcite-block-group>${this.feedback.active ? le({ setOpen: this.handleFeedbackSheetClose, messages: { ...this.messages, ...u }, onSubmit: this.handleFeedbackSubmit, feedback: this.feedback, setFeedback: this.setFeedbackState.bind(this) }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : c`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${M({ slot: "content-top", messages: { ...this.messages, ...u }, assistantsEnabled: this.assistantsEnabled, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.helpTopicUrl })}</calcite-flow-item></calcite-flow>`;
|
|
337
427
|
}
|
|
338
428
|
}
|
|
339
|
-
|
|
429
|
+
N("arcgis-arcade-coding-assistant", be);
|
|
340
430
|
export {
|
|
341
|
-
|
|
431
|
+
be as ArcgisArcadeCodingAssistant
|
|
342
432
|
};
|