@arcgis/coding-components 5.0.0-next.93 → 5.0.0-next.95
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 +3 -3
- package/dist/addons.js +26 -25
- package/dist/cdn/{ETMVFEBE.js → 26R4B4SR.js} +2 -2
- package/dist/cdn/{XOQ3RM5Y.js → 54FZPXUP.js} +2 -2
- package/dist/cdn/{ZBXNENKW.js → 5DAT5ZFW.js} +2 -2
- package/dist/cdn/{ITSWV2D2.js → BAKKWJI7.js} +2 -2
- package/dist/cdn/{BYEBULNN.js → CJ6SJGTO.js} +2 -2
- package/dist/cdn/{QONUPJDY.js → CLUG3LC4.js} +1 -1
- package/dist/cdn/{5XCYAKJJ.js → D5OWDVIG.js} +2 -2
- package/dist/cdn/{4P5HZOXS.js → DFLUHXMI.js} +2 -2
- package/dist/cdn/{LBTNX3UD.js → DIFXXFOE.js} +2 -2
- package/dist/cdn/{A323TEFP.js → DNW5A5G6.js} +2 -2
- package/dist/cdn/DPEHWNF4.js +14 -0
- package/dist/cdn/{QDDMGH2B.js → EMLWH6JD.js} +2 -2
- package/dist/cdn/{VAELJETA.js → FDTYASER.js} +2 -2
- package/dist/cdn/{UGVEW6ZQ.js → H44HKSEL.js} +1 -1
- package/dist/cdn/{5CEEVUCZ.js → HQO32HVD.js} +2 -2
- package/dist/cdn/{7FSEYOGD.js → HR7CEM5J.js} +2 -2
- package/dist/cdn/J5JG7YJY.js +4 -0
- package/dist/cdn/KFNUX4NF.js +4 -0
- package/dist/cdn/{I4JO32WF.js → KU2RSLW6.js} +2 -2
- package/dist/cdn/{PGSOHB37.js → KUOOSF2Y.js} +2 -2
- package/dist/cdn/MMTP5K7U.js +6 -0
- package/dist/cdn/{5EBSP7DM.js → NA3DW5WP.js} +2 -2
- package/dist/cdn/{V5FQNTXG.js → P3ADDEIL.js} +2 -2
- package/dist/cdn/{Z4L7OJKT.js → PJE2D7RB.js} +2 -2
- package/dist/cdn/{ZCT5XGMI.js → Q6M3EIWR.js} +1 -1
- package/dist/cdn/QGWBJM2F.js +4 -0
- package/dist/cdn/{GYL2QCR7.js → QNHGH7LN.js} +2 -2
- package/dist/cdn/{CT7TBHUK.js → QSZ5Q2P3.js} +2 -2
- package/dist/cdn/{CY2NIZSQ.js → QXAPL2AZ.js} +1 -1
- package/dist/cdn/{LC7PNNVV.js → R3ZFQ3NB.js} +3 -3
- package/dist/cdn/{N7HNKUKK.js → RTU52FLE.js} +2 -2
- package/dist/cdn/SE7546PF.js +4 -0
- package/dist/cdn/T5QY5OT3.js +4 -0
- package/dist/cdn/TBTRAJ2W.js +4 -0
- package/dist/cdn/{URZFEWH3.js → UEGR62F7.js} +2 -2
- package/dist/cdn/{PO35LCAS.js → UHWI5CWO.js} +2 -2
- package/dist/cdn/UQDJQX5N.js +4 -0
- package/dist/cdn/{K3L3TIEP.js → V5OOACSR.js} +2 -2
- package/dist/cdn/VLKLFWDG.js +4 -0
- package/dist/cdn/{2X52Y4DY.js → VYAAHXIM.js} +1 -1
- package/dist/cdn/W3HRDCHH.js +6 -0
- package/dist/cdn/{P6IUHZNJ.js → W5PCHPTR.js} +2 -2
- package/dist/cdn/{53OPBGH3.js → W6PBVDLA.js} +1 -1
- package/dist/cdn/WDT3UXU3.js +4 -0
- package/dist/cdn/WJOUYKK2.js +4 -0
- package/dist/cdn/{TRILF5XK.js → XLMLAWJH.js} +2 -2
- package/dist/cdn/{UTNSHEMF.js → XQXLHCC5.js} +1 -1
- package/dist/cdn/{2GQYFHB5.js → ZV42HAPL.js} +2 -2
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ar.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.bg.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.bs.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ca.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.cs.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.da.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.de.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.el.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.en.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.es.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.et.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.fi.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.fr.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.he.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.hr.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.hu.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.id.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.it.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ja.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ko.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.lt.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.lv.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.nl.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.no.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.pl.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.pt-BR.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.pt-PT.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ro.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.ru.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.sk.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.sl.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.sr.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.sv.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.th.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.tr.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.uk.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.vi.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.zh-CN.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.zh-HK.json +1 -1
- package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.zh-TW.json +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +759 -757
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/arcade-contribution.js +1 -1
- package/dist/chunks/arcade-defaults.js +1 -1
- package/dist/chunks/arcade-executor.js +1 -1
- package/dist/chunks/arcade-mode.js +55 -54
- package/dist/chunks/arcade-service-accessors.js +1 -1
- package/dist/chunks/colorize.js +1 -1
- package/dist/chunks/editor.js +1 -1
- package/dist/chunks/fields.js +1 -1
- package/dist/chunks/language-defaults-base.js +203 -202
- package/dist/chunks/markdown.js +1 -1
- package/dist/chunks/monaco-importer.js +1 -1
- package/dist/chunks/monaco-theme.js +1 -1
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/sql-expr-defaults.js +1 -1
- package/dist/chunks/sql-expr-mode.js +67 -66
- package/dist/chunks/sql-expr-service-accessors.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/chunks/utilities.js +1 -1
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +221 -110
- package/dist/components/arcgis-arcade-coding-assistant/types.d.ts +4 -4
- package/dist/components/arcgis-arcade-editor/customElement.js +67 -65
- package/dist/components/arcgis-arcade-results/customElement.js +1 -1
- package/dist/components/arcgis-arcade-suggestions/customElement.js +1 -1
- package/dist/components/arcgis-code-editor/customElement.js +1 -1
- package/dist/components/arcgis-code-viewer/customElement.js +15 -14
- package/dist/components/arcgis-editor-variables/customElement.js +10 -9
- package/dist/components/arcgis-language-api-panel/customElement.js +1 -1
- package/dist/components/arcgis-sql-expression-editor/customElement.js +22 -21
- package/dist/components/arcgis-sql-expression-fields/customElement.js +1 -1
- package/dist/docs/api.json +2 -2
- package/dist/docs/docs.json +2 -2
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/dist/monacoStyles.js +1 -1
- package/dist/utils/arcade-assistant/aiContext.d.ts +6 -0
- package/dist/utils/arcade-assistant/types.d.ts +39 -0
- package/package.json +5 -5
- package/dist/cdn/3AOVYJDA.js +0 -4
- package/dist/cdn/DGSXN3MJ.js +0 -6
- package/dist/cdn/HNHID2GQ.js +0 -4
- package/dist/cdn/IBBEGZKT.js +0 -4
- package/dist/cdn/MIV62SB5.js +0 -4
- package/dist/cdn/MNSM3SGU.js +0 -4
- package/dist/cdn/PQAIRRA6.js +0 -4
- package/dist/cdn/SYFORY5P.js +0 -4
- package/dist/cdn/UPIRR7NI.js +0 -14
- package/dist/cdn/UVW7RTZM.js +0 -4
- package/dist/cdn/VFIPWTCQ.js +0 -4
- package/dist/cdn/WSQRFXIA.js +0 -4
- package/dist/cdn/YNQH23OP.js +0 -6
|
@@ -1,26 +1,28 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { nothing as
|
|
3
|
-
import { ref as
|
|
4
|
-
import
|
|
5
|
-
import { u as
|
|
6
|
-
import { b as
|
|
7
|
-
import { css as
|
|
8
|
-
import T from "@arcgis/core/request.js";
|
|
9
|
-
import { e as J, a as K } from "../../chunks/utilities.js";
|
|
10
|
-
import { repeat as F } from "lit/directives/repeat.js";
|
|
11
|
-
import "@arcgis/toolkit/function";
|
|
12
|
-
import { generateGuid as Y } from "@arcgis/toolkit/string";
|
|
13
|
-
import { unsafeHTML as k } from "lit/directives/unsafe-html.js";
|
|
14
|
-
import X from "@arcgis/core/layers/FeatureLayer.js";
|
|
15
|
-
import Z from "@arcgis/core/config.js";
|
|
16
|
-
import ee from "@arcgis/core/Graphic.js";
|
|
17
|
-
import { b as te } from "../../chunks/language-defaults-base.js";
|
|
1
|
+
import { c as G } from "../../chunks/runtime.js";
|
|
2
|
+
import { nothing as V, LitElement as Q } from "@arcgis/lumina";
|
|
3
|
+
import { ref as J, createRef as K } from "lit/directives/ref.js";
|
|
4
|
+
import Y from "@arcgis/core/identity/IdentityManager.js";
|
|
5
|
+
import { u as X } from "../../chunks/useT9n.js";
|
|
6
|
+
import { b as T } from "../../chunks/arcade-defaults.js";
|
|
7
|
+
import { css as Z, html as c } from "lit";
|
|
18
8
|
import { log as b } from "@arcgis/toolkit/log";
|
|
9
|
+
import E from "@arcgis/core/request.js";
|
|
10
|
+
import { e as ee, a as te } from "../../chunks/utilities.js";
|
|
11
|
+
import { repeat as z } from "lit/directives/repeat.js";
|
|
12
|
+
import "@arcgis/toolkit/function";
|
|
13
|
+
import { generateGuid as ie } from "@arcgis/toolkit/string";
|
|
14
|
+
import { unsafeHTML as x } from "lit/directives/unsafe-html.js";
|
|
15
|
+
import oe from "@arcgis/core/layers/FeatureLayer.js";
|
|
16
|
+
import ae from "@arcgis/core/config.js";
|
|
17
|
+
import se from "@arcgis/core/Graphic.js";
|
|
18
|
+
import { b as re } from "../../chunks/language-defaults-base.js";
|
|
19
|
+
import { getDeclaredVoxelMembers as ce, getDeclaredPixelMembers as ne } from "@arcgis/core/applications/Components/arcadeEditorUtils.js";
|
|
20
|
+
import { s as le } from "../../chunks/fields.js";
|
|
19
21
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
20
22
|
See https://js.arcgis.com/5.0/esri/copyright.txt for details.
|
|
21
|
-
v5.0.0-next.
|
|
22
|
-
const
|
|
23
|
-
class
|
|
23
|
+
v5.0.0-next.95 */
|
|
24
|
+
const de = Z`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);flex:1 0 auto;border-inline-start:var(--arcgis-coding-components-border);box-sizing:border-box;max-width:var(--arcgis-coding-components-code-editor-side-panel-max-w);width:var(--arcgis-coding-components-code-editor-side-panel-w);.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.action .error-display{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:1rem;display:flex;flex-direction:column;gap:.75rem;max-height:30vh;overflow-y:auto}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}.type-suggestion{--calcite-color-foreground-1: var(--calcite-color-foreground-current);--calcite-color-text-3: var(--calcite-color-text-2);--calcite-icon-color: var(--calcite-color-brand)}.type-history{--calcite-icon-color: var(--calcite-color-text-2)}.type-response{--calcite-icon-color: var(--calcite-color-brand);--calcite-font-family: monospace}.block-response{align-self:flex-start;margin-block-end:4rem;border-block-end:0;--calcite-block-text-color: var(--calcite-color-brand)}calcite-list-item calcite-button{margin-inline-end:.25rem}.type-docs{--calcite-color-foreground-1: var(--calcite-color-foreground-3);--calcite-icon-color: var(--calcite-color-text-1)}.type-error{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-font-family: monospace;border:1px solid var(--calcite-color-status-danger)}#thumbs-up{margin-inline-start:auto;--calcite-icon-color: var(--calcite-color-border-input)}#thumbs-down{--calcite-icon-color: var(--calcite-color-border-input)}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}.no-space-block,.no-space-block[open]{margin:0}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none}calcite-text-area{height:auto;min-height:5.75rem;overflow:hidden;border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}.standalone-list{margin:1rem;width:calc(100% - 2rem)}.result-disclaimer{display:block;width:24rem;max-width:90%;margin:1rem auto;text-align:center;line-height:1.125rem;font-size:.875rem;font-style:italic}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.break-spaces{white-space:break-spaces}.feedback-button-container{margin-inline-start:auto;gap:0}.info-heading{font-size:var(--calcite-font-size-1);color:var(--calcite-color-text-1)}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.code-collapse{margin-inline-start:auto}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.collapsible-error{padding:.5rem}.collapsible-error summary{cursor:pointer;font-weight:500;color:var(--calcite-color-status-danger);outline:none;padding:.25rem 0}.collapsible-error[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}}:host([closed]){display:none}`;
|
|
25
|
+
class v extends Error {
|
|
24
26
|
constructor({
|
|
25
27
|
message: e,
|
|
26
28
|
code: t,
|
|
@@ -31,7 +33,7 @@ class y extends Error {
|
|
|
31
33
|
super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details = r, this.source = n;
|
|
32
34
|
}
|
|
33
35
|
}
|
|
34
|
-
function
|
|
36
|
+
function R(i) {
|
|
35
37
|
if (!i)
|
|
36
38
|
return;
|
|
37
39
|
const e = i.indexOf('{"error":');
|
|
@@ -44,7 +46,7 @@ function E(i) {
|
|
|
44
46
|
return;
|
|
45
47
|
}
|
|
46
48
|
}
|
|
47
|
-
async function
|
|
49
|
+
async function pe(i) {
|
|
48
50
|
const { baseUrl: e, skillId: t, message: o, authToken: r, previousConversationId: n, context: u } = i, d = t ? `${e}/skills/${t}/chat` : `${e}/chat`, s = [], a = {
|
|
49
51
|
message: o,
|
|
50
52
|
context: u
|
|
@@ -52,7 +54,7 @@ async function oe(i) {
|
|
|
52
54
|
n && (a.conversation_id = n);
|
|
53
55
|
let l;
|
|
54
56
|
try {
|
|
55
|
-
l = await
|
|
57
|
+
l = await E(d, {
|
|
56
58
|
method: "post",
|
|
57
59
|
headers: {
|
|
58
60
|
"Content-Type": "application/json",
|
|
@@ -62,103 +64,103 @@ async function oe(i) {
|
|
|
62
64
|
responseType: "json"
|
|
63
65
|
});
|
|
64
66
|
} catch (m) {
|
|
65
|
-
const f = m,
|
|
66
|
-
throw g ? new
|
|
67
|
+
const f = m, w = f.details?.rawResponse || f.message || String(m), g = R(w);
|
|
68
|
+
throw g ? new v(g) : m;
|
|
67
69
|
}
|
|
68
70
|
const p = l.data;
|
|
69
71
|
s.push(p);
|
|
70
|
-
const $ = p.conversationId,
|
|
71
|
-
let
|
|
72
|
-
async function
|
|
72
|
+
const $ = p.conversationId, H = p.inquiryId;
|
|
73
|
+
let C = p.sequenceNumber;
|
|
74
|
+
async function B() {
|
|
73
75
|
let m = 0;
|
|
74
76
|
const f = 25;
|
|
75
77
|
for (; m < f; ) {
|
|
76
|
-
await new Promise((
|
|
77
|
-
const
|
|
78
|
+
await new Promise((y) => setTimeout(y, 1e3));
|
|
79
|
+
const w = ue($, C, H);
|
|
78
80
|
let g;
|
|
79
81
|
try {
|
|
80
|
-
g = await
|
|
82
|
+
g = await E(d, {
|
|
81
83
|
method: "post",
|
|
82
84
|
headers: {
|
|
83
85
|
"Content-Type": "application/json",
|
|
84
86
|
token: r
|
|
85
87
|
},
|
|
86
|
-
body: JSON.stringify(
|
|
88
|
+
body: JSON.stringify(w),
|
|
87
89
|
responseType: "json"
|
|
88
90
|
});
|
|
89
|
-
} catch (
|
|
90
|
-
const
|
|
91
|
-
throw
|
|
91
|
+
} catch (y) {
|
|
92
|
+
const S = y, W = S.details?.rawResponse || S.message || String(y), I = R(W);
|
|
93
|
+
throw I ? new v(I) : y;
|
|
92
94
|
}
|
|
93
95
|
const h = g.data;
|
|
94
96
|
if (h.context?.kind === "ArcgisErrorAsContext" && h.context.error)
|
|
95
|
-
throw new
|
|
97
|
+
throw new v({
|
|
96
98
|
message: h.context.error.message || "ArcGIS Assistant error",
|
|
97
99
|
code: h.context.error.code,
|
|
98
100
|
subCode: h.context.error.subCode,
|
|
99
101
|
details: h.context.error.details,
|
|
100
102
|
source: "polling-response"
|
|
101
103
|
});
|
|
102
|
-
if (s.push(h),
|
|
104
|
+
if (s.push(h), C = h.sequenceNumber, m++, !h.hasMore)
|
|
103
105
|
break;
|
|
104
106
|
}
|
|
105
107
|
if (m === f)
|
|
106
|
-
throw new
|
|
108
|
+
throw new v({
|
|
107
109
|
message: "Request timed out",
|
|
108
110
|
code: "TIMEOUT",
|
|
109
111
|
source: "polling"
|
|
110
112
|
});
|
|
111
113
|
}
|
|
112
|
-
const
|
|
114
|
+
const j = 120 * 1e3;
|
|
113
115
|
return await Promise.race([
|
|
114
|
-
|
|
116
|
+
B(),
|
|
115
117
|
new Promise(
|
|
116
118
|
(m, f) => setTimeout(
|
|
117
119
|
() => f(
|
|
118
|
-
new
|
|
120
|
+
new v({
|
|
119
121
|
message: "Request timed out",
|
|
120
122
|
code: "TIMEOUT",
|
|
121
123
|
source: "hard-timeout"
|
|
122
124
|
})
|
|
123
125
|
),
|
|
124
|
-
|
|
126
|
+
j
|
|
125
127
|
)
|
|
126
128
|
)
|
|
127
129
|
]), s;
|
|
128
130
|
}
|
|
129
|
-
function
|
|
131
|
+
function ue(i, e, t) {
|
|
130
132
|
return {
|
|
131
133
|
conversationId: i,
|
|
132
134
|
inquiryId: t,
|
|
133
135
|
ackSequenceNumber: e
|
|
134
136
|
};
|
|
135
137
|
}
|
|
136
|
-
function
|
|
138
|
+
function he(i) {
|
|
137
139
|
return i.message.match(/Error in prompt shield/u) ? "I'm having trouble with this request. Try again by rephrasing the question." : i.code === "TIMEOUT" ? "I'm having trouble with this request. Try again by re-asking the same question or rephrasing it." : i.message;
|
|
138
140
|
}
|
|
139
|
-
const
|
|
141
|
+
const me = (i) => {
|
|
140
142
|
const e = i.value.length, t = 72, o = 180, r = i.offsetWidth, u = Math.max(1, Math.floor(r / 8)), d = Math.ceil(e / u), s = t + (d - 2) * 24;
|
|
141
143
|
i.style.setProperty("--calcite-text-area-min-height", `${Math.min(s, o)}px`);
|
|
142
144
|
};
|
|
143
|
-
function
|
|
145
|
+
function fe({ messages: i }) {
|
|
144
146
|
return c`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta ?? "Beta"}>${i.beta ?? "Beta"}</calcite-chip>`;
|
|
145
147
|
}
|
|
146
|
-
function
|
|
148
|
+
function be({ popoverContent: i }) {
|
|
147
149
|
return c`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer label=legal-disclaimer placement=bottom auto-close focus-trap-disabled><div class="contained">${i}</div></calcite-popover>`;
|
|
148
150
|
}
|
|
149
|
-
function
|
|
150
|
-
return c`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ??
|
|
151
|
+
function O({ errorMessage: i, slot: e }) {
|
|
152
|
+
return c`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ?? V}>${i}</calcite-input-message></div>`;
|
|
151
153
|
}
|
|
152
|
-
function
|
|
154
|
+
function ge({ active: i, setActive: e, messages: t }) {
|
|
153
155
|
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>`;
|
|
154
156
|
}
|
|
155
|
-
function
|
|
156
|
-
return i ? c`<div class="gaps">${i.
|
|
157
|
+
function ye({ context: i, messages: e }) {
|
|
158
|
+
return i ? c`<div class="gaps">${i.profileId && c`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button></calcite-button>` || ""}${i.layerName && c`<calcite-popover auto-close placement=top .label=${(e.layercontextlabel ?? "Layer context: {layerName}").replace("{layerName}", i.layerName)} reference-element=layer-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.layercontextlabel ?? "Layer context: {layerName}").replace("{layerName}", i.layerName)}</p></calcite-popover><calcite-button round kind=neutral icon-start=layers id=layer-context-button></calcite-button>` || ""}</div>` : null;
|
|
157
159
|
}
|
|
158
|
-
function
|
|
160
|
+
function ve({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef: r, question: n, errorMessage: u, setErrorMessage: d, submitQuestion: s, messages: a, mode: l, context: p }) {
|
|
159
161
|
return c`<div class="text-area-wrapper"><calcite-text-area resize=vertical .readOnly=${i || e} class="styled-text-area" .placeholder=${a.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${($) => {
|
|
160
|
-
|
|
161
|
-
}} ${
|
|
162
|
+
me($.target), t($.target.value);
|
|
163
|
+
}} ${J(r)}><div class="submission-actions-wrapper" slot=footer-start>${u && O({ errorMessage: u, slot: "footer-start" }) || ""}<div class="submission-actions">${ye({ context: p, messages: a })}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${l !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async () => {
|
|
162
164
|
o(!1), t("");
|
|
163
165
|
}} .label=${a.startover ?? "Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${a.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${l !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async () => {
|
|
164
166
|
o(!1), t("");
|
|
@@ -166,30 +168,30 @@ function pe({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult:
|
|
|
166
168
|
d(n ? "" : a.enteraprompt ?? "Please enter a prompt"), await s();
|
|
167
169
|
}}>${l === "prompt" ? a.ask ?? "Generate" : a.refine ?? "Refine"}</calcite-button></div></div></div></calcite-text-area></div>`;
|
|
168
170
|
}
|
|
169
|
-
const
|
|
170
|
-
function
|
|
171
|
+
const $e = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-statement", xe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement";
|
|
172
|
+
function we({ setOpen: i, messages: e, feedback: t, setFeedback: o, onSubmit: r }) {
|
|
171
173
|
return t.active ? 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 .disabled=${t.submitting}><calcite-segmented-control-item icon-start=thumbs-up .checked=${t.value === "good"} @click=${() => o({ ...t, value: "good" })}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${t.value === "bad"} @click=${() => o({ ...t, value: "bad" })}></calcite-segmented-control-item></calcite-segmented-control></calcite-label><calcite-label>${e.describeexperience ?? "Describe your experience"}<calcite-text-area resize=vertical .value=${t.text} @calciteTextAreaInput=${(n) => o({ ...t, text: n.target.value })} .disabled=${t.submitting}></calcite-text-area></calcite-label><calcite-label layout=inline scale=s><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(n) => {
|
|
172
174
|
o({ ...t, termsAccepted: n.target.checked });
|
|
173
|
-
}} .disabled=${t.submitting}></calcite-checkbox><span>${
|
|
175
|
+
}} .disabled=${t.submitting}></calcite-checkbox><span>${x((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${$e} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${xe} 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>` : null;
|
|
174
176
|
}
|
|
175
|
-
function
|
|
176
|
-
return c`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ??
|
|
177
|
+
function P({ assistantsEnabled: i, messages: e, slot: t, assistantHelpUrl: o, helpTopicUrl: r }) {
|
|
178
|
+
return c`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? V} expanded class="info-block"><calcite-chip .label=${e.new ?? "New"} kind=brand>${e.new ?? "New"}</calcite-chip><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p>${i ? 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>${x((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>` : c`<p>${x(e.useofassistant?.replace("{aiassistants}", `<strong>${e.aiassistants ?? "Ai Assistants"}</strong>`))}<calcite-link .href=${o} target=_blank icon-end=launch2>${e.configureassistants ?? "Configure Assistants"}</calcite-link></p>`}</calcite-block>`;
|
|
177
179
|
}
|
|
178
|
-
function
|
|
179
|
-
return c`<calcite-dialog close-disabled placement=top .heading=${i.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted ?? "Before you get started be aware:"}</h3><ul><li>${i.maybeincorrect ?? "AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${
|
|
180
|
+
function ke({ messages: i, onProceed: e, onExit: t, helpTopicUrl: o }) {
|
|
181
|
+
return c`<calcite-dialog close-disabled placement=top .heading=${i.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted ?? "Before you get started be aware:"}</h3><ul><li>${i.maybeincorrect ?? "AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${x((i.pleasereadhelp ?? "Read the Arcade Assistant (beta) {helpTopic} to get started and learn details on security, privacy and limitations.").replace("{helpTopic}", `<calcite-link href=${o} target="_blank">${i.helptopic ?? "help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${i.proceed ?? "Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${t} kind=neutral>${i.exit ?? "Exit"}</calcite-button></calcite-dialog>`;
|
|
180
182
|
}
|
|
181
|
-
function
|
|
182
|
-
return c`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block><calcite-chip-group class="suggestions" .label=${i.promptsuggestions ?? "Prompt Suggestions"}>${
|
|
183
|
+
function Ae({ messages: i, suggestions: e, onSuggestionClick: t }) {
|
|
184
|
+
return c`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block><calcite-chip-group class="suggestions" .label=${i.promptsuggestions ?? "Prompt Suggestions"}>${z(e, (o) => o, (o) => c`<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>`;
|
|
183
185
|
}
|
|
184
|
-
const
|
|
186
|
+
const M = 200;
|
|
185
187
|
function q({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: r, collapsible: n = !1, showEffectsIcon: u = !1, onCopyCode: d, standalone: s }) {
|
|
186
|
-
return c`<calcite-block .hidden=${i} id=result-block .heading=${r ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${u && c`<calcite-chip .label=${t.assistantresponses ?? "Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses ?? "Assistant responses"}>${
|
|
188
|
+
return c`<calcite-block .hidden=${i} id=result-block .heading=${r ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${u && c`<calcite-chip .label=${t.assistantresponses ?? "Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses ?? "Assistant responses"}>${z(o, (a) => a.conversationId, (a) => c`<calcite-card><div slot=heading><div class="prior-prompt"><span>${a.priorPrompt.length > M ? `${a.priorPrompt.slice(0, M)}...` : 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) => {
|
|
187
189
|
const p = l.currentTarget;
|
|
188
190
|
navigator.clipboard.writeText(a.priorPrompt).then(() => {
|
|
189
191
|
p.setAttribute("data-copied", "true"), setTimeout(() => p.removeAttribute("data-copied"), 1500);
|
|
190
192
|
});
|
|
191
|
-
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${a.message && s && c`<div class="response-error-container">${
|
|
192
|
-
const p =
|
|
193
|
+
}}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${a.message && s && c`<div class="response-error-container">${O({ 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 && c`<calcite-tooltip .referenceElement=${`response-chip-${a.conversationId}-error`} placement=top-start>${a.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${a.conversationId}-error`} .label=${t.error ?? "Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>` || ""}${a.chips?.map((l) => {
|
|
194
|
+
const p = ie();
|
|
193
195
|
return c`${l.tooltip && c`<calcite-tooltip .referenceElement=${`response-chip-${l.conversationId}-${p}`} placement=top-start class="contained-popover-or-tooltip">${l.tooltip}</calcite-tooltip>` || ""}<calcite-chip .label=${l.label} .scale=${l.scale ?? "s"} .appearance=${l.appearance ?? "outline"} .icon=${l.icon} .id=${`response-chip-${l.conversationId}-${p}`}>${l.label}</calcite-chip>`;
|
|
194
196
|
})}</calcite-chip-group></div><details class="collapsible-code" open><summary>Code response</summary><arcgis-code-viewer language=arcade round>${a.code}</arcgis-code-viewer></details></div></div><div slot=footer-start class="feedback-actions"><calcite-button class="add-to-editor-button hidden-above-380" @click=${() => a.onAddToEditor("add")} scale=s icon-start=plus round .label=${t.addtoeditor ?? "Add to editor"} .id=${`add-to-editor-button-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start>${t.addtoeditor ?? "Add to editor"}</calcite-tooltip><calcite-button class="add-to-editor-button hidden-below-380" @click=${() => a.onAddToEditor("add")} scale=s icon-start=plus round>${t.addtoeditor ?? "Add to editor"}</calcite-button><calcite-button round icon-start=file-code kind=neutral scale=s @click=${() => a.onAddToEditor("replace")} class="response-secondary-action-button" .id=${`replace-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start><span>${t.replaceineditor ?? "Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${(l) => {
|
|
195
197
|
const p = l.currentTarget;
|
|
@@ -198,7 +200,120 @@ function q({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: r
|
|
|
198
200
|
});
|
|
199
201
|
}} class="response-secondary-action-button" .id=${`copy-response-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${t.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${t.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copytoclipboard ?? "Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${t.thumbsup ?? "Thumbs up"} scale=s icon=thumbs-up @click=${a.onThumbsUp} .id=${`thumbs-up-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start><span>${t.helpful ?? "Helpful"}</span></calcite-tooltip><calcite-action .text=${t.thumbsdown ?? "Thumbs down"} scale=s icon=thumbs-down @click=${a.onThumbsDown} .id=${`thumbs-down-${a.conversationId}-${s ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${a.conversationId}-${s ? "standalone" : "list"}`} placement=top-start><span>${t.unhelpful ?? "Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
|
|
200
202
|
}
|
|
201
|
-
const
|
|
203
|
+
const F = (i) => i.type === "featureSet", Ce = (i) => le(i).map((e) => ({
|
|
204
|
+
alias: e.alias,
|
|
205
|
+
name: e.name,
|
|
206
|
+
type: e.type,
|
|
207
|
+
...e.domain ? { domain: e.domain } : {}
|
|
208
|
+
})), A = (i) => i ? { fields: Ce(i) } : {};
|
|
209
|
+
async function U(i) {
|
|
210
|
+
const e = await i.loadSource();
|
|
211
|
+
return {
|
|
212
|
+
name: i.name,
|
|
213
|
+
type: "featureSet",
|
|
214
|
+
...A(e?.fields)
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
async function L(i) {
|
|
218
|
+
switch (i.type) {
|
|
219
|
+
case "feature": {
|
|
220
|
+
const e = await i.loadSource();
|
|
221
|
+
return {
|
|
222
|
+
name: i.name,
|
|
223
|
+
type: i.type,
|
|
224
|
+
...A(e?.fields)
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
case "featureSet": {
|
|
228
|
+
const e = await i.loadSource();
|
|
229
|
+
return {
|
|
230
|
+
name: i.name,
|
|
231
|
+
type: "featureSet",
|
|
232
|
+
...A(e?.fields)
|
|
233
|
+
};
|
|
234
|
+
}
|
|
235
|
+
case "featureSetCollection": {
|
|
236
|
+
const e = await i.loadSource(), t = e?.layers.filter(F) ?? [], o = e?.tables.filter(F) ?? [], r = await Promise.all(t.map(U)), n = await Promise.all(o.map(U));
|
|
237
|
+
return {
|
|
238
|
+
name: i.name,
|
|
239
|
+
type: "featureSetCollection",
|
|
240
|
+
layers: r,
|
|
241
|
+
tables: n
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
case "dictionary": {
|
|
245
|
+
const e = await Promise.all(i.dictionaryVariables.map(L));
|
|
246
|
+
return {
|
|
247
|
+
name: i.name,
|
|
248
|
+
type: "dictionary",
|
|
249
|
+
attributes: e
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
case "pixel": {
|
|
253
|
+
const e = await i.loadSource();
|
|
254
|
+
if (!e)
|
|
255
|
+
return {
|
|
256
|
+
name: i.name,
|
|
257
|
+
type: "pixel"
|
|
258
|
+
};
|
|
259
|
+
const t = await ne(e);
|
|
260
|
+
return {
|
|
261
|
+
name: i.name,
|
|
262
|
+
type: "pixel",
|
|
263
|
+
members: t.map(N)
|
|
264
|
+
};
|
|
265
|
+
}
|
|
266
|
+
case "voxel": {
|
|
267
|
+
const e = await i.loadSource();
|
|
268
|
+
if (!e)
|
|
269
|
+
return {
|
|
270
|
+
name: i.name,
|
|
271
|
+
type: "voxel"
|
|
272
|
+
};
|
|
273
|
+
const t = await ce(e);
|
|
274
|
+
return {
|
|
275
|
+
name: i.name,
|
|
276
|
+
type: "voxel",
|
|
277
|
+
members: t.map(N)
|
|
278
|
+
};
|
|
279
|
+
}
|
|
280
|
+
case "array":
|
|
281
|
+
return {
|
|
282
|
+
name: i.name,
|
|
283
|
+
type: "array",
|
|
284
|
+
elementType: i.elementType.type
|
|
285
|
+
};
|
|
286
|
+
case "number":
|
|
287
|
+
case "text":
|
|
288
|
+
case "boolean":
|
|
289
|
+
case "date":
|
|
290
|
+
case "knowledgeGraph":
|
|
291
|
+
case "dateOnly":
|
|
292
|
+
case "geometry":
|
|
293
|
+
case "time":
|
|
294
|
+
return {
|
|
295
|
+
name: i.name,
|
|
296
|
+
type: i.type
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
function N(i) {
|
|
301
|
+
return i.type === "array" ? {
|
|
302
|
+
name: i.name,
|
|
303
|
+
type: "array",
|
|
304
|
+
elementType: i.elementType.type
|
|
305
|
+
} : {
|
|
306
|
+
name: i.name,
|
|
307
|
+
type: i.type
|
|
308
|
+
// casting bc member types shouldn't be feature, featureset, etc.
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
async function Se(i) {
|
|
312
|
+
return {
|
|
313
|
+
variables: await Promise.all(i.variables.map(L))
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
const Ie = "arcade_generation", Te = "ArcadeCodeRequest", k = "visualization", Ee = "ArcadeAssistant", Re = [
|
|
202
317
|
"your_comments",
|
|
203
318
|
"user_evaluation",
|
|
204
319
|
"question",
|
|
@@ -209,10 +324,10 @@ const ge = "arcade_generation", ve = "ArcadeCodeRequest", w = "visualization", y
|
|
|
209
324
|
"context",
|
|
210
325
|
"extras"
|
|
211
326
|
];
|
|
212
|
-
let
|
|
213
|
-
class
|
|
327
|
+
let D = [], _ = !0;
|
|
328
|
+
class Pe extends Q {
|
|
214
329
|
constructor() {
|
|
215
|
-
super(...arguments), this.textAreaRef =
|
|
330
|
+
super(...arguments), this.textAreaRef = K(), this.messages = X(), this._feedbackService = void 0, this.handleFeedbackButton = (e, t) => {
|
|
216
331
|
this.feedback = { active: !0, value: e, item: t, termsAccepted: !1, text: "", submitting: !1 };
|
|
217
332
|
}, this.handleFeedbackSheetClose = () => {
|
|
218
333
|
this.feedback = {
|
|
@@ -227,7 +342,7 @@ class ke extends H {
|
|
|
227
342
|
this.handleFeedbackSheetClose();
|
|
228
343
|
return;
|
|
229
344
|
}
|
|
230
|
-
const t = this.getModel(), o = t ? await this.getProfileAndMetadata(t.uri) : void 0, r =
|
|
345
|
+
const t = this.getModel(), o = t ? await this.getProfileAndMetadata(t.uri) : void 0, r = ae.applicationName;
|
|
231
346
|
!r && !this.appVersion && b("warn", this, "esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");
|
|
232
347
|
const n = {
|
|
233
348
|
user_evaluation: this.feedback.value,
|
|
@@ -241,17 +356,17 @@ class ke extends H {
|
|
|
241
356
|
*/
|
|
242
357
|
answer: encodeURIComponent(this.feedback.item?.formattedScript ?? ""),
|
|
243
358
|
useragent: navigator.userAgent,
|
|
244
|
-
_source:
|
|
359
|
+
_source: Ee,
|
|
245
360
|
version: this.appVersion || r || "NOT_SET",
|
|
246
361
|
context: o ? JSON.stringify(o) : "",
|
|
247
|
-
extras: o?.
|
|
362
|
+
extras: o?.profileId ?? "",
|
|
248
363
|
conversation_id: this.feedback.item?.conversationId ?? "",
|
|
249
364
|
privacy_statement: this.feedback.termsAccepted ? "I_agree" : ""
|
|
250
365
|
};
|
|
251
366
|
try {
|
|
252
|
-
await e.applyEdits({ addFeatures: [new
|
|
367
|
+
await e.applyEdits({ addFeatures: [new se({ attributes: n })] });
|
|
253
368
|
} catch (u) {
|
|
254
|
-
b("error", this,
|
|
369
|
+
b("error", this, "Error submitting feedback.", { detail: { error: u } });
|
|
255
370
|
}
|
|
256
371
|
this.handleFeedbackSheetClose();
|
|
257
372
|
}, this.handleClose = (e) => {
|
|
@@ -268,7 +383,7 @@ class ke extends H {
|
|
|
268
383
|
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 };
|
|
269
384
|
}
|
|
270
385
|
static {
|
|
271
|
-
this.styles =
|
|
386
|
+
this.styles = de;
|
|
272
387
|
}
|
|
273
388
|
get disclaimerComment() {
|
|
274
389
|
return `// ${this.messages.disclaimercomment}
|
|
@@ -296,10 +411,10 @@ class ke extends H {
|
|
|
296
411
|
this.context = o;
|
|
297
412
|
};
|
|
298
413
|
e().catch((t) => {
|
|
299
|
-
b("error", this,
|
|
300
|
-
}), this.manager.onLifecycle(() => ({ remove:
|
|
414
|
+
b("error", this, "Error setting initial context.", { detail: { error: t } });
|
|
415
|
+
}), this.manager.onLifecycle(() => ({ remove: T.onModelContextDidChange(async () => {
|
|
301
416
|
e().catch((o) => {
|
|
302
|
-
b("error", this,
|
|
417
|
+
b("error", this, "Error setting context.", { detail: { error: o } });
|
|
303
418
|
});
|
|
304
419
|
}).dispose }));
|
|
305
420
|
}
|
|
@@ -307,10 +422,10 @@ class ke extends H {
|
|
|
307
422
|
(e.has("history") || e.has("messages")) && (this.historyCards = this.getHistoryCards());
|
|
308
423
|
}
|
|
309
424
|
connectedCallback() {
|
|
310
|
-
super.connectedCallback(), this.history =
|
|
425
|
+
super.connectedCallback(), this.history = D, this.splashActive = _;
|
|
311
426
|
}
|
|
312
427
|
disconnectedCallback() {
|
|
313
|
-
super.disconnectedCallback(),
|
|
428
|
+
super.disconnectedCallback(), D = this.history, _ = this.splashActive, this.copySuccessTimer && (clearTimeout(this.copySuccessTimer), this.copySuccessTimer = void 0);
|
|
314
429
|
}
|
|
315
430
|
getHistoryCards() {
|
|
316
431
|
return this.history.reduce((e, t) => (!t.script || (e.push({
|
|
@@ -318,12 +433,12 @@ class ke extends H {
|
|
|
318
433
|
code: t.formattedScript || t.error || "",
|
|
319
434
|
chips: [
|
|
320
435
|
{
|
|
321
|
-
label: t.profile ??
|
|
436
|
+
label: t.profile ?? k,
|
|
322
437
|
icon: "map-information",
|
|
323
438
|
appearance: "outline",
|
|
324
439
|
scale: "s",
|
|
325
440
|
conversationId: t.conversationId ?? "",
|
|
326
|
-
tooltip: (this.messages.profilecontextlabel ?? "Profile context: {profileName}").replace("{profileName}", t.profile ??
|
|
441
|
+
tooltip: (this.messages.profilecontextlabel ?? "Profile context: {profileName}").replace("{profileName}", t.profile ?? k)
|
|
327
442
|
},
|
|
328
443
|
...t.layerName ? [
|
|
329
444
|
{
|
|
@@ -337,7 +452,7 @@ class ke extends H {
|
|
|
337
452
|
] : []
|
|
338
453
|
],
|
|
339
454
|
onAddToEditor: (o) => {
|
|
340
|
-
|
|
455
|
+
ee(this.editorRef.editorInstance, t.formattedScript ?? "", o, this.disclaimerComment);
|
|
341
456
|
},
|
|
342
457
|
onThumbsUp: () => this.handleFeedbackButton("good", t),
|
|
343
458
|
onThumbsDown: () => this.handleFeedbackButton("bad", t),
|
|
@@ -353,9 +468,9 @@ class ke extends H {
|
|
|
353
468
|
return this._feedbackService;
|
|
354
469
|
if (!this.feedbackServiceUrl)
|
|
355
470
|
return;
|
|
356
|
-
const e = new
|
|
471
|
+
const e = new oe({ url: this.feedbackServiceUrl });
|
|
357
472
|
await e.load();
|
|
358
|
-
const t =
|
|
473
|
+
const t = Re.filter((o) => !e.fields.some((r) => r.name === o));
|
|
359
474
|
if (t.length > 0) {
|
|
360
475
|
b("error", this, `Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
|
|
361
476
|
return;
|
|
@@ -372,16 +487,16 @@ class ke extends H {
|
|
|
372
487
|
const e = await this.getToken(), t = this.getModel();
|
|
373
488
|
if (!t)
|
|
374
489
|
return;
|
|
375
|
-
const {
|
|
490
|
+
const { profileId: o, metadata: r, layerName: n } = await this.getProfileAndMetadata(t.uri), d = (await pe({
|
|
376
491
|
baseUrl: this.serviceUrl,
|
|
377
|
-
skillId:
|
|
492
|
+
skillId: Ie,
|
|
378
493
|
message: this.question,
|
|
379
494
|
authToken: e,
|
|
380
495
|
context: {
|
|
381
|
-
kind:
|
|
496
|
+
kind: Te,
|
|
382
497
|
context: {
|
|
383
|
-
|
|
384
|
-
metadata: r
|
|
498
|
+
profile_id: o,
|
|
499
|
+
metadata: [r]
|
|
385
500
|
}
|
|
386
501
|
}
|
|
387
502
|
})).find((s) => s.context?.kind === "ArcadeCodeResponse");
|
|
@@ -390,7 +505,7 @@ class ke extends H {
|
|
|
390
505
|
d.context?.kind === "ArcadeCodeResponse" && (this.history = [
|
|
391
506
|
{
|
|
392
507
|
script: d?.context?.arcadeCode?.code,
|
|
393
|
-
formattedScript:
|
|
508
|
+
formattedScript: te(d?.context?.arcadeCode?.code ?? ""),
|
|
394
509
|
error: void 0,
|
|
395
510
|
question: this.question,
|
|
396
511
|
profile: o,
|
|
@@ -401,29 +516,25 @@ class ke extends H {
|
|
|
401
516
|
...this.history
|
|
402
517
|
], this.isViewingResult = !0, this.errorMessage = void 0);
|
|
403
518
|
} catch (e) {
|
|
404
|
-
e instanceof Error && e.name === "ArcadeAssistantError" ? this.errorMessage =
|
|
519
|
+
e instanceof Error && e.name === "ArcadeAssistantError" ? this.errorMessage = he(e) || this.messages.erroroccurred || "An error occurred." : this.errorMessage = this.messages.erroroccurred || "An error occurred.", b("error", this, "Error submitting question", { detail: { error: e } });
|
|
405
520
|
} finally {
|
|
406
521
|
this.isSubmitting = !1;
|
|
407
522
|
}
|
|
408
523
|
}
|
|
409
524
|
}
|
|
410
525
|
async getToken() {
|
|
411
|
-
const { token: e } = await
|
|
526
|
+
const { token: e } = await Y.getCredential(this.portalUrl);
|
|
412
527
|
return e;
|
|
413
528
|
}
|
|
414
529
|
async getProfileAndMetadata(e) {
|
|
415
|
-
let t =
|
|
416
|
-
const o =
|
|
530
|
+
let t = k;
|
|
531
|
+
const o = T.getEditorProfileForModel(e);
|
|
417
532
|
o?.loaded || await o?.loadSource();
|
|
418
533
|
const r = this.editorRef.profile;
|
|
419
534
|
r && "id" in r && (t = r.id);
|
|
420
|
-
const n = o?.definition?.variables?.find((s) => s.type === "feature");
|
|
421
|
-
let
|
|
422
|
-
return n?.definition &&
|
|
423
|
-
name: s.name,
|
|
424
|
-
type: s.type,
|
|
425
|
-
alias: s.alias
|
|
426
|
-
})), te(n?.definition) && (d = n.definition.title)), { profileName: t, metadata: u, layerName: d };
|
|
535
|
+
const n = o?.definition?.variables?.find((s) => s.type === "feature"), u = o ? await Se(o) : { variables: [] };
|
|
536
|
+
let d;
|
|
537
|
+
return re(n?.definition) && (d = n.definition.title), { profileId: t, metadata: u, layerName: d };
|
|
427
538
|
}
|
|
428
539
|
onCopyCode(e) {
|
|
429
540
|
const t = e ? `${this.disclaimerComment}
|
|
@@ -431,9 +542,9 @@ ${e}` : "";
|
|
|
431
542
|
return navigator.clipboard.writeText(t);
|
|
432
543
|
}
|
|
433
544
|
render() {
|
|
434
|
-
return this.closed ? null : this.assistantsEnabled ? c`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.splashActive && c`<calcite-scrim></calcite-scrim>` || ""}${
|
|
545
|
+
return this.closed ? null : this.assistantsEnabled ? c`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.splashActive && c`<calcite-scrim></calcite-scrim>` || ""}${fe({ messages: this.messages })}${be({ popoverContent: P({ assistantsEnabled: this.assistantsEnabled, messages: this.messages, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.splashActive && ke({ messages: this.messages, onProceed: () => {
|
|
435
546
|
this.splashActive = !1;
|
|
436
|
-
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (e) => this.closePanel?.(e) }) || ""}${
|
|
547
|
+
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (e) => this.closePanel?.(e) }) || ""}${ge({ active: this.confirmationActive, setActive: (e) => this.confirmationActive = e, messages: this.messages })}${ve({ isDisabled: this.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestion, setIsViewingResult: (e) => this.isViewingResult = e, mode: this.isViewingResult ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.question, errorMessage: this.errorMessage, setErrorMessage: (e) => this.errorMessage = e, submitQuestion: this.submitQuestion.bind(this), messages: this.messages, context: this.context })}<calcite-block-group label="interactive blocks">${!this.isViewingResult && !this.isSubmitting && Ae({ messages: this.messages, suggestions: [this.messages.prompsuggestion1 ?? "", this.messages.prompsuggestion2 ?? ""], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${q({
|
|
437
548
|
expanded: this.isViewingResult,
|
|
438
549
|
messages: this.messages,
|
|
439
550
|
collapsible: !0,
|
|
@@ -458,10 +569,10 @@ ${e}` : "";
|
|
|
458
569
|
heading: this.messages.recentprompts ?? "Recent prompts",
|
|
459
570
|
hidden: this.isSubmitting || this.history.length === 0,
|
|
460
571
|
onCopyCode: this.onCopyCode.bind(this)
|
|
461
|
-
})}</calcite-block-group>${this.feedback.active ?
|
|
572
|
+
})}</calcite-block-group>${this.feedback.active ? we({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, onSubmit: this.handleFeedbackSubmit, feedback: this.feedback, setFeedback: this.setFeedbackState.bind(this) }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : c`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${P({ slot: "content-top", messages: this.messages, assistantsEnabled: this.assistantsEnabled, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
|
|
462
573
|
}
|
|
463
574
|
}
|
|
464
|
-
|
|
575
|
+
G("arcgis-arcade-coding-assistant", Pe);
|
|
465
576
|
export {
|
|
466
|
-
|
|
577
|
+
Pe as ArcgisArcadeCodingAssistant
|
|
467
578
|
};
|