@arcgis/coding-components 4.34.0-next.28 → 4.34.0-next.29
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/temporary-strings.d.ts +7 -0
- package/dist/addons/arcade-coding-assistant/useArcadeAssistant.d.ts +7 -7
- package/dist/addons.js +6 -6
- package/dist/cdn/{475IPMML.js → 27GAK4UA.js} +2 -2
- package/dist/cdn/{BEGL3FU7.js → 32K7GHV2.js} +2 -2
- package/dist/cdn/{2XDZB5UQ.js → 3AJQCXP5.js} +2 -2
- package/dist/cdn/{S3MY5WE5.js → 3TTOOYTP.js} +2 -2
- package/dist/cdn/{BESGGIO2.js → 4L2UN6XN.js} +2 -2
- package/dist/cdn/4WAWANVL.js +4 -0
- package/dist/cdn/{G73IWMPI.js → 4ZYQLPBS.js} +2 -2
- package/dist/cdn/{2RPPBG3Z.js → 5WJIHGZ5.js} +2 -2
- package/dist/cdn/{YGJF52HO.js → 7MFY7SVP.js} +1 -1
- package/dist/cdn/AGG36YCW.js +6 -0
- package/dist/cdn/{2MRF3P66.js → C7VT5PS7.js} +2 -2
- package/dist/cdn/{IWQ72COU.js → CKIDAKUH.js} +2 -2
- package/dist/cdn/{OID2MENS.js → D73FQPYU.js} +2 -2
- package/dist/cdn/{7OYCH4TQ.js → EOGVGYOI.js} +2 -2
- package/dist/cdn/{DVW2PHRK.js → FGGZ6ITK.js} +2 -2
- package/dist/cdn/{U67EU75G.js → FWPZ2HNP.js} +4 -4
- package/dist/cdn/{M5Z3T5DX.js → GEIN3UXC.js} +2 -2
- package/dist/cdn/{LCPAYQJH.js → GRHTPUFF.js} +2 -2
- package/dist/cdn/{NE5OHGXE.js → HE7YSJQA.js} +1 -1
- package/dist/cdn/{QZPLC65Q.js → HRCFDZ46.js} +2 -2
- package/dist/cdn/{2UGQ3C7G.js → I6DHVCQY.js} +2 -2
- package/dist/cdn/{JO42YVEQ.js → I6FI33WX.js} +2 -2
- package/dist/cdn/{P5LZEBRO.js → IFLZLMBW.js} +2 -2
- package/dist/cdn/{JMJU7ABX.js → IO3D7ZCK.js} +2 -2
- package/dist/cdn/{KEOVPOJO.js → LFCFEBJK.js} +2 -2
- package/dist/cdn/{6C7FMEHE.js → LMWKAIC2.js} +2 -2
- package/dist/cdn/{63N6PP7R.js → MYYKZ75Z.js} +2 -2
- package/dist/cdn/{YHB3E7ZD.js → MZOXERQS.js} +2 -2
- package/dist/cdn/{X7Y3VVYJ.js → PHDE4DM7.js} +1 -1
- package/dist/cdn/{RRH2REKM.js → RKKERKA3.js} +2 -2
- package/dist/cdn/{WOUFKDRM.js → RQVDIT3M.js} +2 -2
- package/dist/cdn/{R6Q7EZ6N.js → TI34SVE6.js} +2 -2
- package/dist/cdn/{F4MFO2LZ.js → TJMELLUB.js} +1 -1
- package/dist/cdn/{DRMPQJGQ.js → TM64TRP3.js} +2 -2
- package/dist/cdn/{QPJMKT5M.js → UGTGDJNO.js} +2 -2
- package/dist/cdn/{AN2QOF3Y.js → VCTTJHKC.js} +2 -2
- package/dist/cdn/{LUFE3TRU.js → W2ED67UR.js} +2 -2
- package/dist/cdn/{GDS7XWPX.js → W2HPJPLQ.js} +2 -2
- package/dist/cdn/{GYFWXEV4.js → XJYQ6UUX.js} +2 -2
- package/dist/cdn/{X5DEZZPE.js → Y4QDA25T.js} +3 -3
- package/dist/cdn/{IDMILG4V.js → Z7QKSUKG.js} +2 -2
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +29320 -29298
- package/dist/cdn/index.js +2 -2
- 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/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/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 +1 -1
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +198 -168
- package/dist/components/arcgis-arcade-coding-assistant/functional.d.ts +4 -4
- package/dist/components/arcgis-arcade-coding-assistant/index.d.ts +0 -2
- package/dist/components/arcgis-arcade-coding-assistant/index.js +0 -2
- 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 +2 -2
- 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/package.json +5 -5
- package/dist/cdn/UAAKRZ52.js +0 -6
- package/dist/cdn/WTROCBGZ.js +0 -4
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { nothing as
|
|
3
|
-
import { ref as
|
|
1
|
+
import { c as V } from "../../chunks/runtime.js";
|
|
2
|
+
import { nothing as C, LitElement as L } from "@arcgis/lumina";
|
|
3
|
+
import { ref as B, createRef as j } from "lit/directives/ref.js";
|
|
4
4
|
import W from "@arcgis/core/identity/IdentityManager.js";
|
|
5
5
|
import { u as Q } from "../../chunks/useT9n.js";
|
|
6
|
-
import { b as
|
|
6
|
+
import { b as E } from "../../chunks/arcade-defaults.js";
|
|
7
7
|
import { css as G } from "@lit/reactive-element/css-tag.js";
|
|
8
|
-
import { html as
|
|
9
|
-
import
|
|
8
|
+
import { html as w } from "lit";
|
|
9
|
+
import T from "@arcgis/core/request.js";
|
|
10
10
|
import { e as J, a as Y } from "../../chunks/monaco-importer.js";
|
|
11
|
-
import { html as
|
|
12
|
-
import { repeat as
|
|
13
|
-
import "@arcgis/components-utils";
|
|
14
|
-
import { unsafeHTML as
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import { b as
|
|
11
|
+
import { html as n } from "lit-html";
|
|
12
|
+
import { repeat as F } from "lit-html/directives/repeat.js";
|
|
13
|
+
import { generateGuid as K } from "@arcgis/components-utils";
|
|
14
|
+
import { unsafeHTML as k } from "lit/directives/unsafe-html.js";
|
|
15
|
+
import X from "@arcgis/core/layers/FeatureLayer.js";
|
|
16
|
+
import Z from "@arcgis/core/Graphic.js";
|
|
17
|
+
import { b as ee } from "../../chunks/language-defaults-base.js";
|
|
18
18
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
19
19
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
20
|
-
v4.34.0-next.
|
|
21
|
-
const
|
|
20
|
+
v4.34.0-next.29 */
|
|
21
|
+
const te = G`:host(:not([closed])){--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-side-panel-max-w);width:var(--arcgis-coding-components-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}.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)}.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;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}.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-background-color: white;--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}}:host([closed]){display:none}`;
|
|
22
22
|
class $ extends Error {
|
|
23
23
|
constructor({
|
|
24
24
|
message: e,
|
|
25
25
|
code: t,
|
|
26
26
|
subCode: o,
|
|
27
|
-
details:
|
|
28
|
-
source:
|
|
27
|
+
details: r,
|
|
28
|
+
source: c
|
|
29
29
|
}) {
|
|
30
|
-
super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details =
|
|
30
|
+
super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details = r, this.source = c;
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
function P(i) {
|
|
@@ -43,65 +43,65 @@ function P(i) {
|
|
|
43
43
|
return;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
async function
|
|
47
|
-
const { baseUrl: e, skillId: t, message: o, authToken:
|
|
46
|
+
async function ie(i) {
|
|
47
|
+
const { baseUrl: e, skillId: t, message: o, authToken: r, previousConversationId: c, context: h } = i, d = t ? `${e}/skills/${t}/chat` : `${e}/chat`, s = [], m = {
|
|
48
48
|
message: o,
|
|
49
|
-
context:
|
|
49
|
+
context: h
|
|
50
50
|
};
|
|
51
|
-
|
|
52
|
-
let
|
|
51
|
+
c && (m.conversation_id = c);
|
|
52
|
+
let a;
|
|
53
53
|
try {
|
|
54
|
-
|
|
54
|
+
a = await T(d, {
|
|
55
55
|
method: "post",
|
|
56
56
|
headers: {
|
|
57
57
|
"Content-Type": "application/json",
|
|
58
|
-
token:
|
|
58
|
+
token: r
|
|
59
59
|
},
|
|
60
|
-
body: JSON.stringify(
|
|
60
|
+
body: JSON.stringify(m),
|
|
61
61
|
responseType: "json"
|
|
62
62
|
});
|
|
63
|
-
} catch (
|
|
64
|
-
const
|
|
65
|
-
throw
|
|
63
|
+
} catch (b) {
|
|
64
|
+
const g = b, x = g.details?.rawResponse || g.message || String(b), v = P(x);
|
|
65
|
+
throw v ? new $(v) : b;
|
|
66
66
|
}
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
const
|
|
70
|
-
let
|
|
71
|
-
async function
|
|
72
|
-
let
|
|
73
|
-
const
|
|
74
|
-
for (;
|
|
75
|
-
await new Promise((
|
|
76
|
-
const
|
|
77
|
-
let
|
|
67
|
+
const l = a.data;
|
|
68
|
+
s.push(l);
|
|
69
|
+
const p = l.conversationId, _ = l.inquiryId;
|
|
70
|
+
let S = l.sequenceNumber;
|
|
71
|
+
async function z() {
|
|
72
|
+
let b = 0;
|
|
73
|
+
const g = 25;
|
|
74
|
+
for (; b < g; ) {
|
|
75
|
+
await new Promise((y) => setTimeout(y, 1e3));
|
|
76
|
+
const x = oe(p, S, _);
|
|
77
|
+
let v;
|
|
78
78
|
try {
|
|
79
|
-
|
|
79
|
+
v = await T(d, {
|
|
80
80
|
method: "post",
|
|
81
81
|
headers: {
|
|
82
82
|
"Content-Type": "application/json",
|
|
83
|
-
token:
|
|
83
|
+
token: r
|
|
84
84
|
},
|
|
85
|
-
body: JSON.stringify(
|
|
85
|
+
body: JSON.stringify(x),
|
|
86
86
|
responseType: "json"
|
|
87
87
|
});
|
|
88
|
-
} catch (
|
|
89
|
-
const
|
|
90
|
-
throw
|
|
88
|
+
} catch (y) {
|
|
89
|
+
const R = y, H = R.details?.rawResponse || R.message || String(y), I = P(H);
|
|
90
|
+
throw I ? new $(I) : y;
|
|
91
91
|
}
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
92
|
+
const f = v.data;
|
|
93
|
+
if (f.context && f.context.kind === "ArcgisErrorAsContext" && f.context.error)
|
|
94
94
|
throw new $({
|
|
95
|
-
message:
|
|
96
|
-
code:
|
|
97
|
-
subCode:
|
|
98
|
-
details:
|
|
95
|
+
message: f.context.error.message || "ArcGIS Assistant error",
|
|
96
|
+
code: f.context.error.code,
|
|
97
|
+
subCode: f.context.error.subCode,
|
|
98
|
+
details: f.context.error.details,
|
|
99
99
|
source: "polling-response"
|
|
100
100
|
});
|
|
101
|
-
if (
|
|
101
|
+
if (s.push(f), S = f.sequenceNumber, b++, !f.hasMore)
|
|
102
102
|
break;
|
|
103
103
|
}
|
|
104
|
-
if (
|
|
104
|
+
if (b === g)
|
|
105
105
|
throw new $({
|
|
106
106
|
message: "Request timed out",
|
|
107
107
|
code: "TIMEOUT",
|
|
@@ -110,10 +110,10 @@ async function te(i) {
|
|
|
110
110
|
}
|
|
111
111
|
const O = 2 * 60 * 1e3;
|
|
112
112
|
return await Promise.race([
|
|
113
|
-
|
|
113
|
+
z(),
|
|
114
114
|
new Promise(
|
|
115
|
-
(
|
|
116
|
-
() =>
|
|
115
|
+
(b, g) => setTimeout(
|
|
116
|
+
() => g(
|
|
117
117
|
new $({
|
|
118
118
|
message: "Request timed out",
|
|
119
119
|
code: "TIMEOUT",
|
|
@@ -123,68 +123,79 @@ async function te(i) {
|
|
|
123
123
|
O
|
|
124
124
|
)
|
|
125
125
|
)
|
|
126
|
-
]),
|
|
126
|
+
]), s;
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function oe(i, e, t) {
|
|
129
129
|
return {
|
|
130
130
|
conversationId: i,
|
|
131
131
|
inquiryId: t,
|
|
132
132
|
ackSequenceNumber: e
|
|
133
133
|
};
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function ae(i) {
|
|
136
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
137
|
}
|
|
138
|
-
const
|
|
139
|
-
const e = i.value.length, t = 72, o = 180,
|
|
140
|
-
i.style.setProperty("--calcite-text-area-min-height", `${Math.min(
|
|
138
|
+
const se = (i) => {
|
|
139
|
+
const e = i.value.length, t = 72, o = 180, r = i.offsetWidth, h = Math.max(1, Math.floor(r / 8)), d = Math.ceil(e / h), s = t + (d - 2) * 24;
|
|
140
|
+
i.style.setProperty("--calcite-text-area-min-height", `${Math.min(s, o)}px`);
|
|
141
141
|
};
|
|
142
|
-
function
|
|
143
|
-
return
|
|
142
|
+
function re({ messages: i }) {
|
|
143
|
+
return n`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta ?? "Beta"}>${i.beta ?? "Beta"}</calcite-chip>`;
|
|
144
144
|
}
|
|
145
|
-
function
|
|
146
|
-
return
|
|
145
|
+
function ce({ popoverContent: i }) {
|
|
146
|
+
return n`<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>`;
|
|
147
147
|
}
|
|
148
|
-
function
|
|
149
|
-
return
|
|
148
|
+
function D({ errorMessage: i, slot: e }) {
|
|
149
|
+
return n`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ?? C}>${i}</calcite-input-message></div>`;
|
|
150
150
|
}
|
|
151
|
-
function
|
|
152
|
-
return
|
|
151
|
+
function ne({ active: i, setActive: e, messages: t }) {
|
|
152
|
+
return n`<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
153
|
}
|
|
154
|
-
function
|
|
155
|
-
return i ?
|
|
154
|
+
function le({ context: i, messages: e }) {
|
|
155
|
+
return i ? n`<div class="gaps">${i.profileName && n`<calcite-popover auto-close placement=top .label=${e.profilecontextlabel.replace("{profileName}", i.profileName)} reference-element=profile-context-button class="context-popover"><p>${e.profilecontextlabel.replace("{profileName}", i.profileName)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button></calcite-button>` || ""}${i.layerName && n`<calcite-popover auto-close placement=top .label=${e.layercontextlabel.replace("{layerName}", i.layerName)} reference-element=layer-context-button class="context-popover"><p>${e.layercontextlabel.replace("{layerName}", i.layerName)}</p></calcite-popover><calcite-button round kind=neutral icon-start=layers id=layer-context-button></calcite-button>` || ""}</div>` : null;
|
|
156
156
|
}
|
|
157
|
-
function
|
|
158
|
-
return
|
|
159
|
-
|
|
160
|
-
}} ${
|
|
157
|
+
function de({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef: r, question: c, errorMessage: h, setErrorMessage: d, submitQuestion: s, messages: m, mode: a, context: l }) {
|
|
158
|
+
return n`<div class="text-area-wrapper"><calcite-text-area resize=vertical .readOnly=${i || e} class="styled-text-area" .placeholder=${m.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${c} @calciteTextAreaInput=${(p) => {
|
|
159
|
+
se(p.target), t(p.target.value);
|
|
160
|
+
}} ${B(r)}><div class="submission-actions-wrapper" slot=footer-start>${h && D({ errorMessage: h, slot: "footer-start" }) || ""}<div class="submission-actions">${le({ context: l, messages: m })}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${a !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async () => {
|
|
161
161
|
o(!1), t("");
|
|
162
|
-
}}>${
|
|
163
|
-
c
|
|
164
|
-
}}>${
|
|
162
|
+
}}>${m.startover ?? "Start Over"}</calcite-button><calcite-button round icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async () => {
|
|
163
|
+
d(c ? "" : m.enteraprompt ?? "Please enter a prompt"), await s();
|
|
164
|
+
}}>${a === "prompt" ? m.ask ?? "Generate" : m.refine ?? "Refine"}</calcite-button></div></div></div></calcite-text-area></div>`;
|
|
165
165
|
}
|
|
166
|
-
const
|
|
167
|
-
function
|
|
168
|
-
return
|
|
169
|
-
o({ ...t, termsAccepted:
|
|
170
|
-
}}></calcite-checkbox><span>${
|
|
166
|
+
const pe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-statement", ue = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement";
|
|
167
|
+
function he({ setOpen: i, messages: e, feedback: t, setFeedback: o, onSubmit: r }) {
|
|
168
|
+
return n`<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=${() => 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=${(c) => o({ ...t, text: c.target.value })}></calcite-text-area></calcite-label><calcite-label layout=inline scale=s><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(c) => {
|
|
169
|
+
o({ ...t, termsAccepted: c.target.checked });
|
|
170
|
+
}}></calcite-checkbox><span>${k(e.agreement?.replace("{EsriPrivacyStatement}", `<calcite-link href=${pe} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${ue} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label></div><calcite-button slot=footer width=full @click=${r} .disabled=${!t.termsAccepted || t.submitting} .loading=${t.submitting}>${e.submitfeedback ?? "Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>`;
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
return
|
|
172
|
+
function q({ assistantsEnabled: i, messages: e, slot: t, assistantHelpUrl: o, helpTopicUrl: r }) {
|
|
173
|
+
return n`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? C} 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 ? n`<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=${r} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : n`<p>${k(e.useofassistant?.replace("{aiassistants}", `<strong>${e.aiassistants ?? "Ai Assistants"}</strong>`))}<calcite-link .href=${o} target=_blank icon-end=launch-2>${e.opensettings ?? "Open Settings"}</calcite-link></p>`}</calcite-block>`;
|
|
174
174
|
}
|
|
175
|
-
function
|
|
176
|
-
return
|
|
175
|
+
function me({ messages: i, onProceed: e, onExit: t, helpTopicUrl: o }) {
|
|
176
|
+
return n`<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>${k(i.pleasereadhelp.replace("{helpTopic}", `<calcite-link href=${o} 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>`;
|
|
177
177
|
}
|
|
178
|
-
function
|
|
179
|
-
return
|
|
178
|
+
function fe({ messages: i, suggestions: e, onSuggestionClick: t }) {
|
|
179
|
+
return n`<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) => n`<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>`;
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
const
|
|
183
|
-
return
|
|
184
|
-
|
|
185
|
-
|
|
181
|
+
function M({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: r, collapsible: c = !1, showEffectsIcon: h = !1, onCopyCode: d, standalone: s }) {
|
|
182
|
+
const m = t.addtoeditor ?? "Add to editor";
|
|
183
|
+
return n`<calcite-block .hidden=${i} id=result-block .heading=${r ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${c}>${h && n`<calcite-chip .label=${t.assistantresponses} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses}>${F(o, (a) => a.conversationId, (a) => n`<calcite-card><div slot=heading><div class="prior-prompt"><span>${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) => {
|
|
184
|
+
const p = l.currentTarget;
|
|
185
|
+
navigator.clipboard.writeText(a.priorPrompt).then(() => {
|
|
186
|
+
p.setAttribute("data-copied", "true"), setTimeout(() => p.removeAttribute("data-copied"), 1500);
|
|
187
|
+
});
|
|
188
|
+
}}></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}</calcite-tooltip></div>${a.message && s && n`<div class="response-error-container">${D({ 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 && n`<calcite-tooltip .referenceElement=${`response-chip-${a.conversationId}-error`} placement=top-start overlay-positioning=fixed>${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) => {
|
|
189
|
+
const p = K();
|
|
190
|
+
return n`${l.tooltip && n`<calcite-tooltip .referenceElement=${`response-chip-${l.conversationId}-${p}`} placement=top-start overlay-positioning=fixed>${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>`;
|
|
191
|
+
})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><code>${a.code}</code></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button primary-text=${m ?? C} class="add-to-editor-button" @click=${() => a.onAddToEditor("add")} overlay-positioning=fixed 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) => {
|
|
192
|
+
const p = l.currentTarget;
|
|
193
|
+
d(a.code).then(() => {
|
|
194
|
+
p.setAttribute("data-copied", "true"), setTimeout(() => p.removeAttribute("data-copied"), 1500);
|
|
195
|
+
});
|
|
196
|
+
}} 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}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup} 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} 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>`;
|
|
186
197
|
}
|
|
187
|
-
const
|
|
198
|
+
const u = {
|
|
188
199
|
welcome: "Welcome to the new assistant experience",
|
|
189
200
|
beforeyougetstarted: "Before you get started be aware:",
|
|
190
201
|
maybeincorrect: "AI generated code may occasionally be incorrect or biased. Review carefully.",
|
|
@@ -204,7 +215,7 @@ const d = {
|
|
|
204
215
|
esriprivacystatement: "Esri Privacy Statement",
|
|
205
216
|
supplement: "Supplement",
|
|
206
217
|
disclaimerpt2: "AI-generated content may be inaccurate. Review before using.",
|
|
207
|
-
replaceineditor: "Replace in editor",
|
|
218
|
+
replaceineditor: "Replace all code in editor",
|
|
208
219
|
keepinmind: "Keep in mind the following:",
|
|
209
220
|
beconsise: "Be concise, but also clear in your request",
|
|
210
221
|
avoidambiguity: "Avoid ambiguity and vagueness",
|
|
@@ -217,8 +228,15 @@ const d = {
|
|
|
217
228
|
layercontextlabel: "Layer context: {layerName}",
|
|
218
229
|
numlayers: "{numLayers} {layerOrLayers}",
|
|
219
230
|
numlayersplural: "layers",
|
|
220
|
-
numlayerssingular: "layer"
|
|
221
|
-
|
|
231
|
+
numlayerssingular: "layer",
|
|
232
|
+
responsecontext: "Response context",
|
|
233
|
+
error: "Error",
|
|
234
|
+
copytoclipboard: "Copy code to clipboard",
|
|
235
|
+
copyprompttoclipboard: "Copy prompt to clipboard",
|
|
236
|
+
copiedsuccessfully: "Copied successfully",
|
|
237
|
+
helpful: "Helpful",
|
|
238
|
+
unhelpful: "Unhelpful"
|
|
239
|
+
}, be = "arcade_generation", ge = "ArcadeCodeRequest", A = "visualization", ve = "ArcadeAssistant", ye = [
|
|
222
240
|
"your_comments",
|
|
223
241
|
"user_evaluation",
|
|
224
242
|
"question",
|
|
@@ -229,8 +247,8 @@ const d = {
|
|
|
229
247
|
"context",
|
|
230
248
|
"extras"
|
|
231
249
|
];
|
|
232
|
-
let
|
|
233
|
-
class
|
|
250
|
+
let U = [], N = !0;
|
|
251
|
+
class $e extends L {
|
|
234
252
|
constructor() {
|
|
235
253
|
super(...arguments), this.textAreaRef = j(), this.messages = Q(), this._feedbackService = void 0, this.handleFeedbackButton = (e, t) => {
|
|
236
254
|
this.feedback = { ...this.feedback, active: !0, value: e, item: t };
|
|
@@ -250,13 +268,13 @@ class ye extends H {
|
|
|
250
268
|
this.handleFeedbackSheetClose();
|
|
251
269
|
return;
|
|
252
270
|
}
|
|
253
|
-
const t = this.getModel(), o = t ? await this.getProfileAndMetadata(t.uri) : void 0,
|
|
271
|
+
const t = this.getModel(), o = t ? await this.getProfileAndMetadata(t.uri) : void 0, r = {
|
|
254
272
|
user_evaluation: this.feedback.value,
|
|
255
273
|
your_comments: this.feedback.text || void 0,
|
|
256
274
|
question: this.question,
|
|
257
|
-
answer: this.feedback.item?.script ?? "",
|
|
275
|
+
answer: this.feedback.item?.formattedScript ?? this.feedback.item?.script ?? "",
|
|
258
276
|
useragent: navigator.userAgent,
|
|
259
|
-
_source:
|
|
277
|
+
_source: ve,
|
|
260
278
|
version: this.appVersion ?? "",
|
|
261
279
|
context: o ? JSON.stringify(o) : "",
|
|
262
280
|
extras: o?.profileName ?? "",
|
|
@@ -264,9 +282,9 @@ class ye extends H {
|
|
|
264
282
|
privacy_statement: this.feedback.termsAccepted ? "I_agree" : ""
|
|
265
283
|
};
|
|
266
284
|
try {
|
|
267
|
-
await e.applyEdits({ addFeatures: [new
|
|
268
|
-
} catch (
|
|
269
|
-
console.error("Error submitting feedback:",
|
|
285
|
+
await e.applyEdits({ addFeatures: [new Z({ attributes: r })] });
|
|
286
|
+
} catch (c) {
|
|
287
|
+
console.error("Error submitting feedback:", c);
|
|
270
288
|
}
|
|
271
289
|
this.handleFeedbackSheetClose();
|
|
272
290
|
}, this.handleClose = (e) => {
|
|
@@ -282,23 +300,26 @@ class ye extends H {
|
|
|
282
300
|
item: void 0,
|
|
283
301
|
termsAccepted: !1,
|
|
284
302
|
submitting: !1
|
|
285
|
-
}, this.
|
|
303
|
+
}, this.splashActive = !0, this.context = void 0, this.historyCards = [], this.helpBase = "", this.assistantsEnabled = !1, this.closed = !1;
|
|
286
304
|
}
|
|
287
305
|
static {
|
|
288
|
-
this.properties = { isViewingResult: 16, confirmationActive: 16, isSubmitting: 16, errorMessage: 16, question: 16, history: 16, feedback: 16,
|
|
306
|
+
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 };
|
|
289
307
|
}
|
|
290
308
|
static {
|
|
291
|
-
this.styles =
|
|
309
|
+
this.styles = te;
|
|
292
310
|
}
|
|
293
311
|
get disclaimerComment() {
|
|
294
312
|
return `// ${this.messages.disclaimercomment}
|
|
295
|
-
// ${
|
|
313
|
+
// ${u.disclaimerpt2}`;
|
|
296
314
|
}
|
|
297
315
|
get assistantHelpUrl() {
|
|
298
316
|
return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}administer/configure-assistants.htm`;
|
|
299
317
|
}
|
|
300
|
-
get
|
|
301
|
-
return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}create-maps/arcade-assistant.htm`;
|
|
318
|
+
get assistantOverviewDocUrl() {
|
|
319
|
+
return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`;
|
|
320
|
+
}
|
|
321
|
+
get usingTheAssitantDocUrl() {
|
|
322
|
+
return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}create-maps/use-arcade-assistant.htm`;
|
|
302
323
|
}
|
|
303
324
|
async destroy() {
|
|
304
325
|
}
|
|
@@ -314,7 +335,7 @@ class ye extends H {
|
|
|
314
335
|
};
|
|
315
336
|
e().catch((t) => {
|
|
316
337
|
console.error("Error setting initial context in Arcade Assistant:", t);
|
|
317
|
-
}), this.manager.onLifecycle(() => ({ remove:
|
|
338
|
+
}), this.manager.onLifecycle(() => ({ remove: E.onModelContextDidChange(async () => {
|
|
318
339
|
e().catch((o) => {
|
|
319
340
|
console.error("Error setting context in Arcade Assistant:", o);
|
|
320
341
|
});
|
|
@@ -324,10 +345,10 @@ class ye extends H {
|
|
|
324
345
|
e.has("history") && (this.historyCards = this.getHistoryCards());
|
|
325
346
|
}
|
|
326
347
|
connectedCallback() {
|
|
327
|
-
super.connectedCallback(), this.history =
|
|
348
|
+
super.connectedCallback(), this.history = U, this.splashActive = N;
|
|
328
349
|
}
|
|
329
350
|
disconnectedCallback() {
|
|
330
|
-
super.disconnectedCallback(),
|
|
351
|
+
super.disconnectedCallback(), U = this.history, N = this.splashActive, this.copySuccessTimer && (clearTimeout(this.copySuccessTimer), this.copySuccessTimer = void 0);
|
|
331
352
|
}
|
|
332
353
|
getHistoryCards() {
|
|
333
354
|
return this.history.reduce((e, t) => (!t.script || (e.push({
|
|
@@ -335,35 +356,26 @@ class ye extends H {
|
|
|
335
356
|
code: t.formattedScript || t.error || "",
|
|
336
357
|
chips: [
|
|
337
358
|
{
|
|
338
|
-
label: t.profile ??
|
|
359
|
+
label: t.profile ?? A,
|
|
339
360
|
icon: "map-information",
|
|
340
361
|
appearance: "outline",
|
|
341
362
|
scale: "s",
|
|
342
363
|
conversationId: t.conversationId ?? "",
|
|
343
|
-
tooltip:
|
|
364
|
+
tooltip: u.profilecontextlabel.replace("{profileName}", t.profile ?? A)
|
|
344
365
|
},
|
|
345
366
|
...t.layerName ? [
|
|
346
367
|
{
|
|
347
|
-
label:
|
|
368
|
+
label: u.numlayers.replace("{numLayers}", "1").replace("{layerOrLayers}", u.numlayerssingular),
|
|
348
369
|
icon: "layer",
|
|
349
370
|
appearance: "outline",
|
|
350
371
|
scale: "s",
|
|
351
372
|
conversationId: t.conversationId ?? "",
|
|
352
|
-
tooltip:
|
|
373
|
+
tooltip: u.layercontextlabel.replace("{layerName}", t.layerName ?? "No layer")
|
|
353
374
|
}
|
|
354
375
|
] : []
|
|
355
376
|
],
|
|
356
|
-
onAddToEditor: () => {
|
|
357
|
-
J(this.editorRef.editorInstance, t.formattedScript ?? "",
|
|
358
|
-
},
|
|
359
|
-
onCopy: (o) => {
|
|
360
|
-
const a = t.formattedScript ? `${this.disclaimerComment}
|
|
361
|
-
${t.formattedScript}` : "";
|
|
362
|
-
a && navigator.clipboard.writeText(a).then(() => {
|
|
363
|
-
this.copySuccessConversationId = o, this.copySuccessTimer && clearTimeout(this.copySuccessTimer), this.copySuccessTimer = window.setTimeout(() => {
|
|
364
|
-
this.copySuccessConversationId = void 0, this.copySuccessTimer = void 0;
|
|
365
|
-
}, 1500);
|
|
366
|
-
});
|
|
377
|
+
onAddToEditor: (o) => {
|
|
378
|
+
J(this.editorRef.editorInstance, t.formattedScript ?? "", o, this.disclaimerComment);
|
|
367
379
|
},
|
|
368
380
|
onThumbsUp: () => this.handleFeedbackButton("good", t),
|
|
369
381
|
onThumbsDown: () => this.handleFeedbackButton("bad", t),
|
|
@@ -379,9 +391,9 @@ ${t.formattedScript}` : "";
|
|
|
379
391
|
return this._feedbackService;
|
|
380
392
|
if (!this.feedbackServiceUrl)
|
|
381
393
|
return;
|
|
382
|
-
const e = new
|
|
394
|
+
const e = new X({ url: this.feedbackServiceUrl });
|
|
383
395
|
await e.load();
|
|
384
|
-
const t =
|
|
396
|
+
const t = ye.filter((o) => !e.fields.some((r) => r.name === o));
|
|
385
397
|
if (t.length > 0) {
|
|
386
398
|
console.error(`Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
|
|
387
399
|
return;
|
|
@@ -398,78 +410,96 @@ ${t.formattedScript}` : "";
|
|
|
398
410
|
const e = await this.getToken(), t = this.getModel();
|
|
399
411
|
if (!t)
|
|
400
412
|
return;
|
|
401
|
-
const { profileName: o, metadata:
|
|
413
|
+
const { profileName: o, metadata: r, layerName: c } = await this.getProfileAndMetadata(t.uri), d = (await ie({
|
|
402
414
|
baseUrl: this.serviceUrl,
|
|
403
|
-
skillId:
|
|
415
|
+
skillId: be,
|
|
404
416
|
message: this.question,
|
|
405
417
|
authToken: e,
|
|
406
418
|
context: {
|
|
407
|
-
kind:
|
|
419
|
+
kind: ge,
|
|
408
420
|
context: {
|
|
409
421
|
profile_name: o,
|
|
410
|
-
metadata:
|
|
422
|
+
metadata: r
|
|
411
423
|
}
|
|
412
424
|
}
|
|
413
|
-
})).find((
|
|
414
|
-
if (!
|
|
425
|
+
})).find((s) => s.context?.kind === "ArcadeCodeResponse");
|
|
426
|
+
if (!d)
|
|
415
427
|
return;
|
|
416
|
-
|
|
428
|
+
d.context?.kind === "ArcadeCodeResponse" && (this.history = [
|
|
417
429
|
{
|
|
418
|
-
script:
|
|
419
|
-
formattedScript: Y(
|
|
430
|
+
script: d?.context?.arcadeCode?.code,
|
|
431
|
+
formattedScript: Y(d?.context?.arcadeCode?.code ?? ""),
|
|
420
432
|
error: void 0,
|
|
421
433
|
question: this.question,
|
|
422
434
|
profile: o,
|
|
423
|
-
conversationId:
|
|
424
|
-
layerName:
|
|
425
|
-
...
|
|
435
|
+
conversationId: d.conversationId,
|
|
436
|
+
layerName: c ?? void 0,
|
|
437
|
+
...d.message ? { message: d.message } : {}
|
|
426
438
|
},
|
|
427
439
|
...this.history
|
|
428
440
|
], this.isViewingResult = !0, this.errorMessage = void 0);
|
|
429
441
|
} catch (e) {
|
|
430
|
-
e instanceof Error && e.name === "ArcadeAssistantError" ? this.errorMessage =
|
|
442
|
+
e instanceof Error && e.name === "ArcadeAssistantError" ? this.errorMessage = ae(e) || this.messages.erroroccurred || "An error occurred." : this.errorMessage = this.messages.erroroccurred || "An error occurred.", console.error("Error in Arcade Assistant:", e);
|
|
431
443
|
} finally {
|
|
432
444
|
this.isSubmitting = !1;
|
|
433
445
|
}
|
|
434
446
|
}
|
|
435
447
|
}
|
|
436
448
|
async getToken() {
|
|
437
|
-
const { token: e } = await W.getCredential(this.
|
|
449
|
+
const { token: e } = await W.getCredential(this.portalUrl);
|
|
438
450
|
return e;
|
|
439
451
|
}
|
|
440
452
|
async getProfileAndMetadata(e) {
|
|
441
|
-
let t =
|
|
442
|
-
const o =
|
|
453
|
+
let t = A;
|
|
454
|
+
const o = E.getEditorProfileForModel(e);
|
|
443
455
|
o?.loaded || await o?.loadSource();
|
|
444
|
-
const
|
|
445
|
-
|
|
446
|
-
const
|
|
447
|
-
let
|
|
448
|
-
return
|
|
449
|
-
name:
|
|
450
|
-
type:
|
|
451
|
-
alias:
|
|
452
|
-
})),
|
|
456
|
+
const r = this.editorRef.profile;
|
|
457
|
+
r && "id" in r && (t = r.id);
|
|
458
|
+
const c = o?.definition?.variables?.find((s) => s.type === "feature");
|
|
459
|
+
let h = [], d;
|
|
460
|
+
return c?.definition && "fields" in c.definition && (h = c.definition.fields.map((s) => ({
|
|
461
|
+
name: s.name,
|
|
462
|
+
type: s.type,
|
|
463
|
+
alias: s.alias
|
|
464
|
+
})), ee(c?.definition) && (d = c.definition.title)), { profileName: t, metadata: h, layerName: d };
|
|
465
|
+
}
|
|
466
|
+
onCopyCode(e) {
|
|
467
|
+
const t = e ? `${this.disclaimerComment}
|
|
468
|
+
${e}` : "";
|
|
469
|
+
return navigator.clipboard.writeText(t);
|
|
453
470
|
}
|
|
454
471
|
render() {
|
|
455
|
-
return this.closed ? null : this.assistantsEnabled ?
|
|
472
|
+
return this.closed ? null : this.assistantsEnabled ? w`<calcite-flow><calcite-flow-item closable .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.splashActive && w`<calcite-scrim></calcite-scrim>` || ""}${re({ messages: this.messages })}${ce({ popoverContent: q({ assistantsEnabled: this.assistantsEnabled, messages: { ...this.messages, ...u }, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.splashActive && me({ messages: { ...u, ...this.messages }, onProceed: () => {
|
|
456
473
|
this.splashActive = !1;
|
|
457
|
-
}, helpTopicUrl: this.
|
|
474
|
+
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (e) => this.closePanel && this.closePanel(e) }) || ""}${ne({ active: this.confirmationActive, setActive: (e) => this.confirmationActive = e, messages: this.messages })}${de({ 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 }, context: this.context })}<calcite-block-group label="interactive blocks">${!this.isViewingResult && !this.isSubmitting && fe({ 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>${M({
|
|
458
475
|
expanded: this.isViewingResult,
|
|
459
|
-
messages: { ...this.messages, ...
|
|
476
|
+
messages: { ...this.messages, ...u },
|
|
460
477
|
collapsible: !0,
|
|
461
478
|
showEffectsIcon: !0,
|
|
462
|
-
editorInsertMode: this.editorInsertMode,
|
|
463
|
-
setEditorInsertMode: (e) => this.editorInsertMode = e,
|
|
464
479
|
/** Only show the latest history card */
|
|
465
480
|
cards: this.historyCards.length ? [this.historyCards[0]] : [],
|
|
466
481
|
heading: this.messages.besteffort ?? "Here's the assistant's best effort",
|
|
467
482
|
hidden: this.isSubmitting || !this.isViewingResult,
|
|
468
|
-
|
|
469
|
-
|
|
483
|
+
onCopyCode: this.onCopyCode.bind(this),
|
|
484
|
+
standalone: !0
|
|
485
|
+
})}${M({
|
|
486
|
+
expanded: !this.isViewingResult,
|
|
487
|
+
messages: { ...this.messages, ...u },
|
|
488
|
+
collapsible: !0,
|
|
489
|
+
/**
|
|
490
|
+
* When the user is viewing the latest result, we display the first history card
|
|
491
|
+
* (historyCards[0]) separately at the top in "standalone" mode.
|
|
492
|
+
* To avoid showing the same card twice, we remove (slice out) the first card
|
|
493
|
+
* from the list of recent prompts below.
|
|
494
|
+
*/
|
|
495
|
+
cards: this.isViewingResult ? this.historyCards.slice(1) : this.historyCards,
|
|
496
|
+
heading: this.messages.recentprompts ?? "Recent prompts",
|
|
497
|
+
hidden: this.isSubmitting || this.history.length === 0,
|
|
498
|
+
onCopyCode: this.onCopyCode.bind(this)
|
|
499
|
+
})}</calcite-block-group>${this.feedback.active ? he({ 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>` : w`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${q({ slot: "content-top", messages: { ...this.messages, ...u }, assistantsEnabled: this.assistantsEnabled, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
|
|
470
500
|
}
|
|
471
501
|
}
|
|
472
|
-
|
|
502
|
+
V("arcgis-arcade-coding-assistant", $e);
|
|
473
503
|
export {
|
|
474
|
-
|
|
504
|
+
$e as ArcgisArcadeCodingAssistant
|
|
475
505
|
};
|