@arcgis/coding-components 5.0.0-next.149 → 5.0.0-next.150

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.
Files changed (41) hide show
  1. package/README.md +2 -4
  2. package/dist/cdn/2U3UUVRF.js +4 -0
  3. package/dist/cdn/2ZFTV536.js +2 -0
  4. package/dist/cdn/{4EAONLKN.js → 3IYCM3T5.js} +1 -1
  5. package/dist/cdn/{G3HPFTUI.js → 55JG5GGC.js} +1 -1
  6. package/dist/cdn/{2XS25MHS.js → CRFEM3QK.js} +1 -1
  7. package/dist/cdn/{6KH4ZJW7.js → DUDPRVQB.js} +1 -1
  8. package/dist/cdn/{5GJXU26T.js → EVSXXHQ5.js} +1 -1
  9. package/dist/cdn/{MGMAMY5S.js → HDPC4QT2.js} +1 -1
  10. package/dist/cdn/HUEGOCW7.js +2 -0
  11. package/dist/cdn/IAMP2URN.js +11 -0
  12. package/dist/cdn/{LLWOE2G5.js → JQCRR5L6.js} +1 -1
  13. package/dist/cdn/{S5ZW4OSD.js → K6IFHJHH.js} +1 -1
  14. package/dist/cdn/{CVGNKT6A.js → LSN2L6MF.js} +1 -1
  15. package/dist/cdn/{H25NK6KP.js → M5R2ARCR.js} +1 -1
  16. package/dist/cdn/{CDKPJGE2.js → NBNHNFDE.js} +1 -1
  17. package/dist/cdn/{WWB7CXZN.js → QDE2LLCP.js} +1 -1
  18. package/dist/cdn/{47B6HD75.js → RHWX2DDB.js} +1 -1
  19. package/dist/cdn/{HFY5V4YQ.js → YK255XEU.js} +1 -1
  20. package/dist/cdn/{GPCAV243.js → YPRQHETI.js} +1 -1
  21. package/dist/cdn/assets/arcade-coding-assistant/t9n/messages.en.json +1 -1
  22. package/dist/cdn/assets/arcade-results/t9n/messages.en.json +1 -1
  23. package/dist/cdn/assets/language-api-panel/t9n/messages.en.json +1 -1
  24. package/dist/cdn/index.js +1 -1
  25. package/dist/components/arcgis-arcade-coding-assistant/customElement.js +207 -210
  26. package/dist/components/arcgis-arcade-coding-assistant/index.js +0 -2
  27. package/dist/components/arcgis-arcade-editor/customElement.js +18 -18
  28. package/dist/components/arcgis-arcade-results/customElement.js +17 -17
  29. package/dist/components/arcgis-arcade-suggestions/customElement.js +4 -4
  30. package/dist/components/arcgis-editor-variables/customElement.js +1 -1
  31. package/dist/components/arcgis-language-api-panel/customElement.js +4 -4
  32. package/dist/docs/api.json +1 -1
  33. package/dist/docs/docs.json +1 -1
  34. package/dist/docs/vscode.html-custom-data.json +1 -1
  35. package/dist/docs/web-types.json +1 -1
  36. package/package.json +5 -5
  37. package/dist/cdn/LDDFFER6.js +0 -11
  38. package/dist/cdn/TJHFVCKN.js +0 -2
  39. package/dist/cdn/V2FCS4O5.js +0 -4
  40. package/dist/cdn/XKNRIGBN.js +0 -2
  41. /package/dist/cdn/{VZCGFCMK.js → DDFKURLO.js} +0 -0
@@ -1,12 +1,12 @@
1
1
  /* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
2
2
  import { c as Z } from "../../chunks/runtime.js";
3
- import { css as ee, html as r } from "lit";
3
+ import { css as ee, html as l } from "lit";
4
4
  import { nothing as V, safeClassMap as te, LitElement as ie } from "@arcgis/lumina";
5
5
  import { ref as oe, createRef as ae } from "lit/directives/ref.js";
6
6
  import se from "@arcgis/core/identity/IdentityManager.js";
7
7
  import { u as ne } from "../../chunks/useT9n.js";
8
8
  import { b as N } from "../../chunks/arcade-defaults.js";
9
- import U from "@arcgis/core/request.js";
9
+ import _ from "@arcgis/core/request.js";
10
10
  import { e as ce, a as re } from "../../chunks/utilities.js";
11
11
  import { repeat as Q } from "lit/directives/repeat.js";
12
12
  import "@arcgis/toolkit/function";
@@ -18,43 +18,43 @@ import ue from "@arcgis/core/Graphic.js";
18
18
  import { log as x } from "@arcgis/toolkit/log";
19
19
  import { getDeclaredVoxelMembers as he, getDeclaredPixelMembers as me } from "@arcgis/core/applications/Components/arcadeEditorUtils.js";
20
20
  import { s as fe } from "../../chunks/fields.js";
21
- import { g as K, h as be } from "../../chunks/language-defaults-base.js";
21
+ import { g as Y, h as be } from "../../chunks/language-defaults-base.js";
22
22
  import ge from "@arcgis/core/core/Accessor.js";
23
23
  import { property as f, subclass as ve } from "@arcgis/core/core/accessorSupport/decorators.js";
24
- const ye = ee`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding: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)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`;
24
+ const ye = ee`:host(:not([closed])){container-type:size;--calcite-block-border-color: var(--calcite-color-transparent);box-sizing:border-box;.submission-actions-wrapper{display:flex;flex-direction:column;width:100%;gap:.75rem}.submission-actions{display:flex;flex-direction:row;gap:.5rem;justify-content:space-between}@container (max-width: 380px){.hidden-below-380{display:none}}@container (min-width: 380px){.hidden-above-380{display:none}}.gaps{display:flex;gap:.25rem}.align-inline-end{margin-inline-start:auto}.context-popover p{padding:0 .5rem;font-size:var(--calcite-font-size-sm)}.feedback-content{padding:var(--calcite-spacing-sm);display:flex;flex-direction:column;max-height:75cqb;overflow-y:auto;>*{margin-block-end:.5rem}>*:last-child,.terms-label{margin-block-end:0}calcite-text-area{--calcite-text-area-min-height: 4rem}calcite-notice{margin-block-start:0}}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: 100%;--calcite-sheet-min-height: auto}.feedback-footer{display:flex;justify-content:flex-end;gap:.5rem;width:100%}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent;margin-block:0}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}calcite-list-item calcite-button{margin-inline-end:.25rem}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;border-radius:var(--calcite-corner-radius-round);margin:.75rem;overflow:hidden;--calcite-color-border-input: transparent;position:sticky;box-shadow:var(--calcite-shadow-sm);flex:none;flex-direction:column}calcite-text-area{height:auto;overflow:hidden;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.contained-popover-or-tooltip{--calcite-popover-max-size-x: 100%;--calcite-tooltip-max-size-x: 100%}.info-heading{font-size:var(--calcite-font-size-0);color:var(--calcite-color-text-1);margin:0}.info-heading-row{display:flex;align-items:center;gap:var(--calcite-spacing-sm);flex-wrap:wrap}.unstyled-h3{margin:unset;font-size:var(--calcite-font-size-md)}.unstyled-shell{position:unset;inset:unset;display:unset;block-size:unset;inline-size:unset}.suggestion-button{font-weight:var(--calcite-font-weight-medium)}.suggestions{display:flex;flex-direction:row;gap:var(--calcite-spacing-xs);flex-wrap:wrap}.info-block{max-width:450px}#result-block{calcite-card-group{--calcite-card-group-gap: 1.25rem}calcite-card{--calcite-card-corner-radius: var(--calcite-corner-radius-round);--calcite-card-border-color: transparent;width:100%}.positioned-code-content{display:flex;flex-direction:row;gap:.5rem;padding:.5rem}calcite-card [slot=heading] calcite-chip{margin-block-start:.25rem}.code-response-wrapper{position:relative;background:var(--calcite-color-foreground-2);border-radius:var(--calcite-corner-radius-round);margin-top:-1.5rem}.prior-prompt{display:flex;flex-direction:row;padding:0;overflow-y:hidden;overflow-x:auto;margin:.25rem 0 .75rem;align-items:center;max-width:100%;span{overflow-x:auto;overflow-y:hidden}}.copy-feedback{display:none}.copy-prompt-button{align-self:flex-start;margin-inline-start:auto}.response-secondary-action-button[data-copied]+.copy-feedback,.copy-prompt-button[data-copied]+.copy-feedback{display:block;span{padding:.75rem 1rem;font-size:var(--calcite-font-size--2);line-height:1.375;color:var(--calcite-color-text--2);font-weight:var(--calcite-font-weight-medium)}}.copy-prompt-button[data-copied]~.copy-tooltip,.response-secondary-action-button[data-copied]~.copy-tooltip{display:none}code{white-space:pre;font-size:12px;margin:0;overflow-x:auto;font-family:Fira Mono,Consolas,Menlo,monospace;display:block;max-height:12rem;position:relative;padding:.5rem}.response-secondary-action-button{margin-left:.5rem}.add-to-editor-button{--calcite-internal-button-border-color: unset}}.collapsible-code{padding:.5rem}.collapsible-code summary{cursor:pointer;font-weight:500;color:var(--calcite-color-brand);outline:none;padding:.25rem 0}.collapsible-code[open] summary{color:var(--calcite-color-text-2)}.response-error-container{padding:.5rem;background:color-mix(in srgb,var(--calcite-color-status-warning) 10%,transparent);border-radius:var(--calcite-corner-radius-round);margin:1rem 0;font-size:var(--calcite-font-size--2);--calcite-input-message-icon-color: var(--calcite-color-status-warning)}.response-error-chip{--calcite-internal-chip-background-color: var(--calcite-color-status-warning);--calcite-chip-icon-color: var(--calcite-color-foreground-1);--calcite-chip-border-color: var(--calcite-color-transparent)}.feedback-actions{gap:unset}.contained{max-width:100%;max-height:100%;max-width:100cqi;max-height:75cqb;overflow-y:auto}.submission-notice{--calcite-notice-border-color: transparent;margin-block:0;width:100%;--calcite-font-size-relative-base: var(--calcite-font-size--2)}.border-block-end{border-block-end:1px solid var(--calcite-color-border-3)}.round-top{border-radius:var(--calcite-corner-radius-round) var(--calcite-corner-radius-round) 0 0}}:host([closed]){display:none}`;
25
25
  class C extends Error {
26
26
  constructor({
27
27
  message: e,
28
- code: t,
28
+ code: i,
29
29
  subCode: o,
30
30
  details: n,
31
31
  source: s
32
32
  }) {
33
- super(e), this.name = "ArcadeAssistantError", this.code = t, this.subCode = o, this.details = n, this.source = s;
33
+ super(e), this.name = "ArcadeAssistantError", this.code = i, this.subCode = o, this.details = n, this.source = s;
34
34
  }
35
35
  }
36
- function _(i) {
37
- if (!i)
36
+ function U(t) {
37
+ if (!t)
38
38
  return;
39
- const e = i.indexOf('{"error":');
39
+ const e = t.indexOf('{"error":');
40
40
  if (e !== -1)
41
41
  try {
42
- const t = i.slice(e), o = JSON.parse(t);
42
+ const i = t.slice(e), o = JSON.parse(i);
43
43
  if (o && typeof o == "object" && o.error)
44
44
  return o.error;
45
45
  } catch {
46
46
  return;
47
47
  }
48
48
  }
49
- async function $e(i) {
50
- const { baseUrl: e, skillId: t, message: o, authToken: n, previousConversationId: s, context: d } = i, p = t ? `${e}/skills/${t}/chat` : `${e}/chat`, c = [], a = {
49
+ async function we(t) {
50
+ const { baseUrl: e, skillId: i, message: o, authToken: n, previousConversationId: s, context: r } = t, p = i ? `${e}/skills/${i}/chat` : `${e}/chat`, c = [], a = {
51
51
  message: o,
52
- context: d
52
+ context: r
53
53
  };
54
54
  s && (a.conversation_id = s);
55
55
  let h;
56
56
  try {
57
- h = await U(p, {
57
+ h = await _(p, {
58
58
  method: "post",
59
59
  headers: {
60
60
  "Content-Type": "application/json",
@@ -64,32 +64,32 @@ async function $e(i) {
64
64
  responseType: "json"
65
65
  });
66
66
  } catch (b) {
67
- const g = b, w = g.details?.rawResponse || g.message || String(b), k = _(w);
67
+ const g = b, $ = g.details?.rawResponse || g.message || String(b), k = U($);
68
68
  throw k ? new C(k) : b;
69
69
  }
70
- const l = h.data;
71
- c.push(l);
72
- const y = l.conversationId, q = l.inquiryId;
73
- let $ = l.sequenceNumber;
70
+ const d = h.data;
71
+ c.push(d);
72
+ const y = d.conversationId, q = d.inquiryId;
73
+ let w = d.sequenceNumber;
74
74
  async function T() {
75
75
  let b = 0;
76
- const g = 25;
76
+ const g = 100;
77
77
  for (; b < g; ) {
78
78
  await new Promise((S) => setTimeout(S, 1e3));
79
- const w = we(y, $, q);
79
+ const $ = $e(y, w, q);
80
80
  let k;
81
81
  try {
82
- k = await U(p, {
82
+ k = await _(p, {
83
83
  method: "post",
84
84
  headers: {
85
85
  "Content-Type": "application/json",
86
86
  token: n
87
87
  },
88
- body: JSON.stringify(w),
88
+ body: JSON.stringify($),
89
89
  responseType: "json"
90
90
  });
91
91
  } catch (S) {
92
- const F = S, X = F.details?.rawResponse || F.message || String(S), D = _(X);
92
+ const F = S, X = F.details?.rawResponse || F.message || String(S), D = U(X);
93
93
  throw D ? new C(D) : S;
94
94
  }
95
95
  const v = k.data;
@@ -101,7 +101,7 @@ async function $e(i) {
101
101
  details: v.context.error.details,
102
102
  source: "polling-response"
103
103
  });
104
- if (c.push(v), $ = v.sequenceNumber, b++, !v.hasMore)
104
+ if (c.push(v), w = v.sequenceNumber, b++, !v.hasMore)
105
105
  break;
106
106
  }
107
107
  if (b === g)
@@ -128,26 +128,26 @@ async function $e(i) {
128
128
  )
129
129
  ]), c;
130
130
  }
131
- function we(i, e, t) {
131
+ function $e(t, e, i) {
132
132
  return {
133
- conversationId: i,
134
- inquiryId: t,
133
+ conversationId: t,
134
+ inquiryId: i,
135
135
  ackSequenceNumber: e
136
136
  };
137
137
  }
138
- function xe(i) {
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
+ function xe(t) {
139
+ return t.message.match(/Error in prompt shield/u) ? "I'm having trouble with this request. Try again by rephrasing the question." : t.code === "TIMEOUT" ? "Request timed out. Try again by re-asking the same question or rephrasing it." : t.message;
140
140
  }
141
- const ke = ({ notices: i }) => i.length ? r`<div class="border-block-end">${Q(i, (e) => e.id ?? e.title, (e) => r`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${() => e.onClose?.()}><div slot=title>${e.title}</div>${e.message && r`<div slot=message>${e.message}</div>` || ""}${e.actionLinkMessage && e.onAction && r`<calcite-link slot=link @click=${() => e.onAction?.()}>${e.actionLinkMessage}</calcite-link>` || ""}</calcite-notice>`)}</div>` : null, Se = (i) => {
142
- const e = i.value.length, t = 72, o = 180, n = i.offsetWidth, d = Math.max(1, Math.floor(n / 8)), p = Math.ceil(e / d), c = t + (p - 2) * 24;
143
- i.style.setProperty("--calcite-text-area-min-height", `${Math.min(c, o)}px`);
144
- }, Ce = ({ promptValidationMessage: i, errorMessage: e, contextTooBig: t, contextReducedNoticeDismissed: o, setContextReducedNoticeDismissed: n, setErrorMessage: s, messages: d }) => {
141
+ const ke = ({ notices: t }) => t.length ? l`<div class="border-block-end">${Q(t, (e) => e.id ?? e.title, (e) => l`<calcite-notice class="submission-notice" .icon=${e.icon} .kind=${e.kind} scale=s open .closable=${e.closable} @calciteNoticeClose=${() => e.onClose?.()}><div slot=title>${e.title}</div>${e.message && l`<div slot=message>${e.message}</div>` || ""}${e.actionLinkMessage && e.onAction && l`<calcite-link slot=link @click=${() => e.onAction?.()}>${e.actionLinkMessage}</calcite-link>` || ""}</calcite-notice>`)}</div>` : null, Se = (t) => {
142
+ const e = t.value.length, i = 72, o = 180, n = t.offsetWidth, r = Math.max(1, Math.floor(n / 8)), p = Math.ceil(e / r), c = i + (p - 2) * 24;
143
+ t.style.setProperty("--calcite-text-area-min-height", `${Math.min(c, o)}px`);
144
+ }, Ce = ({ promptValidationMessage: t, errorMessage: e, contextTooBig: i, contextReducedNoticeDismissed: o, setContextReducedNoticeDismissed: n, setErrorMessage: s, messages: r }) => {
145
145
  const p = [];
146
- if (i && p.push({
146
+ if (t && p.push({
147
147
  id: "prompt-validation",
148
148
  kind: "danger",
149
149
  icon: "exclamation-mark-triangle",
150
- title: i,
150
+ title: t,
151
151
  closable: !0
152
152
  }), e && p.push({
153
153
  id: "assistant-error",
@@ -156,8 +156,8 @@ const ke = ({ notices: i }) => i.length ? r`<div class="border-block-end">${Q(i,
156
156
  title: e,
157
157
  closable: !0,
158
158
  onClose: () => s(void 0)
159
- }), t && !o) {
160
- const c = d.contextreduced ?? "Context reduced", a = d.contextreducedmessage ?? "The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";
159
+ }), i && !o) {
160
+ const c = r.contextreduced ?? "Context reduced", a = r.contextreducedmessage ?? "The editor profile is too large for the assistant. It has been reduced in the assistant in order to ensure a successful request.";
161
161
  p.push({
162
162
  id: "context-reduced",
163
163
  kind: "warning",
@@ -170,177 +170,177 @@ const ke = ({ notices: i }) => i.length ? r`<div class="border-block-end">${Q(i,
170
170
  }
171
171
  return p;
172
172
  };
173
- function Ae({ messages: i }) {
174
- return r`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${i.beta ?? "Beta"}>${i.beta ?? "Beta"}</calcite-chip>`;
173
+ function Ae({ messages: t }) {
174
+ return l`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${t.beta ?? "Beta"}>${t.beta ?? "Beta"}</calcite-chip>`;
175
175
  }
176
- function Te({ popoverContent: i }) {
177
- return r`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer label=legal-disclaimer placement=bottom auto-close focus-trap-disabled><div class="contained">${i}</div></calcite-popover>`;
176
+ function Te({ popoverContent: t, messages: e }) {
177
+ return l`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-popover reference-element=legal-disclaimer .label=${e.legaldisclaimer ?? "Legal disclaimer"} placement=bottom auto-close focus-trap-disabled><div class="contained">${t}</div></calcite-popover>`;
178
178
  }
179
- function Ie({ errorMessage: i, slot: e }) {
180
- return r`<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>`;
179
+ function Ie({ errorMessage: t, slot: e }) {
180
+ return l`<div class="error-display"><calcite-input-message id=error-message status=invalid icon=exclamation-mark-triangle scale=m slot=${e ?? V}>${t}</calcite-input-message></div>`;
181
181
  }
182
- function Re({ active: i, setActive: e, messages: t }) {
183
- return r`<calcite-alert slot=alerts .open=${i} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${() => e(!1)} .label=${t.expressionapplied ?? "Expression applied"}><div slot=message>${t.expressionapplied ?? "Expression applied to editor."}</div></calcite-alert>`;
182
+ function Ee({ active: t, setActive: e, messages: i }) {
183
+ return l`<calcite-alert slot=alerts .open=${t} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${() => e(!1)} .label=${i.expressionapplied ?? "Expression applied"}><div slot=message>${i.expressionapplied ?? "Expression applied to editor."}</div></calcite-alert>`;
184
184
  }
185
- function Ee({ context: i, messages: e }) {
186
- return i ? r`<div class="gaps">${i.profileId && r`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>` || ""}</div>` : null;
185
+ function Re({ context: t, messages: e }) {
186
+ return t ? l`<div class="gaps">${t.profileId && l`<calcite-popover auto-close placement=top .label=${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", t.profileId)} reference-element=profile-context-button class="context-popover contained-popover-or-tooltip"><p>${(e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", t.profileId)}</p></calcite-popover><calcite-button round kind=neutral icon-start=map-information id=profile-context-button scale=s></calcite-button>` || ""}</div>` : null;
187
187
  }
188
- function Me({ isDisabled: i, isReadOnly: e, setQuestion: t, setIsViewingResult: o, textAreaRef: n, question: s, errorMessage: d, setErrorMessage: p, promptValidationMessage: c, setPromptValidationMessage: a, submitQuestion: h, messages: l, mode: y, assistantRef: q, context: $, contextReducedNoticeDismissed: T, setContextReducedNoticeDismissed: I }) {
189
- const b = $?.contextTooLarge ?? !1, g = Ce({
188
+ function Me({ isDisabled: t, isReadOnly: e, setQuestion: i, setIsViewingResult: o, textAreaRef: n, question: s, errorMessage: r, setErrorMessage: p, promptValidationMessage: c, setPromptValidationMessage: a, submitQuestion: h, messages: d, mode: y, assistantRef: q, context: w, contextReducedNoticeDismissed: T, setContextReducedNoticeDismissed: I }) {
189
+ const b = w?.contextTooLarge ?? !1, g = Ce({
190
190
  promptValidationMessage: c,
191
- errorMessage: d,
191
+ errorMessage: r,
192
192
  contextTooBig: b,
193
193
  contextReducedNoticeDismissed: T,
194
194
  setContextReducedNoticeDismissed: I,
195
195
  setErrorMessage: p,
196
- messages: l
196
+ messages: d
197
197
  });
198
- return r`<div class="text-area-wrapper">${ke({ notices: g })}<calcite-text-area scale=s resize=vertical .readOnly=${i || e} class=${te(g.length ? "submission-text-area" : "submission-text-area round-top")} .placeholder=${l.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${s} @calciteTextAreaInput=${(w) => {
199
- Se(w.target), t(w.target.value);
200
- }} ${oe(n)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${$ && Ee({ context: $, messages: l }) || ""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${y !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${i} @click=${async () => {
201
- o(!1), t("");
202
- }} .label=${l.startover ?? "Start Over"} class="hidden-above-380" id=small-start-over-button></calcite-button><calcite-tooltip reference-element=small-start-over-button placement=top-start class="hidden-above-380">${l.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${y !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${i} @click=${async () => {
203
- o(!1), t("");
204
- }} class="hidden-below-380" scale=s>${l.startover ?? "Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async () => {
198
+ return l`<div class="text-area-wrapper">${ke({ notices: g })}<calcite-text-area scale=s resize=vertical .readOnly=${t || e} class=${te(g.length ? "submission-text-area" : "submission-text-area round-top")} .placeholder=${d.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${s} @calciteTextAreaInput=${($) => {
199
+ Se($.target), i($.target.value);
200
+ }} ${oe(n)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${w && Re({ context: w, messages: d }) || ""}<div class="align-inline-end gaps"><calcite-button round kind=neutral .hidden=${y !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid scale=s .disabled=${t} @click=${async () => {
201
+ o(!1), i("");
202
+ }} .label=${d.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">${d.startover ?? "Start Over"}</calcite-tooltip><calcite-button round kind=neutral .hidden=${y !== "refine"} icon-start=arrow-left icon-flip-rtl=both appearance=solid .disabled=${t} @click=${async () => {
203
+ o(!1), i("");
204
+ }} class="hidden-below-380" scale=s>${d.startover ?? "Start Over"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${t} .disabled=${t} @click=${async () => {
205
205
  if (p(""), !s) {
206
- a(l.enteraprompt ?? "Please enter a prompt");
206
+ a(d.enteraprompt ?? "Please enter a prompt");
207
207
  return;
208
208
  }
209
209
  a(void 0), await h();
210
- }} class="hidden-below-380">${y === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${i} .disabled=${i} @click=${async () => {
210
+ }} class="hidden-below-380">${y === "prompt" ? d.ask ?? "Generate" : d.refine ?? "Refine"}</calcite-button><calcite-button round scale=s icon-end=effects appearance=solid .loading=${t} .disabled=${t} @click=${async () => {
211
211
  if (p(""), !s) {
212
- a(l.enteraprompt ?? "Please enter a prompt");
212
+ a(d.enteraprompt ?? "Please enter a prompt");
213
213
  return;
214
214
  }
215
215
  a(void 0), await h();
216
- }} class="hidden-above-380" .label=${y === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}></calcite-button></div></div></div></calcite-text-area></div>`;
216
+ }} class="hidden-above-380" .label=${y === "prompt" ? d.ask ?? "Generate" : d.refine ?? "Refine"}></calcite-button></div></div></div></calcite-text-area></div>`;
217
217
  }
218
218
  const Pe = "https://www.esri.com/en-us/privacy/privacy-statements/privacy-supplement", Ve = "https://www.esri.com/en-us/privacy/privacy-statements";
219
- function qe({ setOpen: i, messages: e, feedback: t, setFeedback: o, onSubmit: n }) {
220
- return t.active ? r`<calcite-sheet class="feedback-sheet" .label=${e.feedback ?? "Feedback"} slot=sheets display-mode=float position=block-end .open=${t.active} @calciteSheetClose=${() => i(!1)}><calcite-panel .heading=${e.providefeedback ?? "Provide feedback"} .description=${e.experiencehelps ?? "Your experience helps guide future improvements"}><div class="feedback-content"><calcite-label>${e.experiencehelpful ?? "Was the assistant helpful?"}<calcite-segmented-control scale=l .disabled=${t.submitting}><calcite-segmented-control-item icon-start=thumbs-up .checked=${t.value === "good"} @click=${() => o({ ...t, value: "good" })}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${t.value === "bad"} @click=${() => o({ ...t, value: "bad" })}></calcite-segmented-control-item></calcite-segmented-control></calcite-label><calcite-label>${e.describeexperience ?? "Describe your experience"}<calcite-text-area resize=vertical .value=${t.text} @calciteTextAreaInput=${(s) => o({ ...t, text: s.target.value })} .disabled=${t.submitting}></calcite-text-area></calcite-label><calcite-label layout=inline scale=s><calcite-checkbox scale=l .checked=${t.termsAccepted} @calciteCheckboxChange=${(s) => {
221
- o({ ...t, termsAccepted: s.target.checked });
222
- }} .disabled=${t.submitting}></calcite-checkbox><span>${A((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${Ve} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${Pe} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label></div><calcite-button slot=footer width=full @click=${n} .disabled=${!t.termsAccepted || t.submitting} .loading=${t.submitting}>${e.submitfeedback ?? "Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>` : null;
219
+ function qe({ setOpen: t, messages: e, feedback: i, learnMoreUrl: o, setFeedback: n, onSubmit: s }) {
220
+ return i.active ? l`<calcite-sheet class="feedback-sheet" .label=${e.feedback ?? "Feedback"} slot=sheets display-mode=float position=block-end .open=${i.active} @calciteSheetClose=${() => t(!1)}><calcite-panel .heading=${e.submitfeedback ?? "Submit feedback to Esri"} scale=s><div class="feedback-content"><calcite-text-area scale=s resize=vertical .value=${i.text} @calciteTextAreaInput=${(r) => n({ ...i, text: r.target.value })} .disabled=${i.submitting} .placeholder=${e.donotincludepersonalinfo ?? "Do not include personal or sensitive information"} rows=3></calcite-text-area><calcite-label layout=inline scale=s class="terms-label"><calcite-checkbox scale=l .checked=${i.termsAccepted} @calciteCheckboxChange=${(r) => {
221
+ n({ ...i, termsAccepted: r.target.checked });
222
+ }} .disabled=${i.submitting}></calcite-checkbox><span>${A((e.agreement ?? "I agree to the {EsriPrivacyStatement} (and {Supplement}).").replace("{EsriPrivacyStatement}", `<calcite-link href=${Ve} target="_blank">${e.esriprivacystatement ?? "Esri Privacy Statement"}</calcite-link>`).replace("{Supplement}", `<calcite-link href=${Pe} target="_blank">${e.supplement ?? "Supplement"}</calcite-link>`))}</span></calcite-label><calcite-notice scale=s open closable><span slot=message>${A((e.feedbackhelps ?? "Your feedback will be used to improve Esri products and services. {LearnMore} about how this data is used.").replace("{LearnMore}", `<calcite-link href=${o} target="_blank">${e.learnmore ?? "Learn more"}</calcite-link>`))}</span></calcite-notice></div><div slot=footer class="feedback-footer"><calcite-button kind=neutral appearance=outline @click=${() => t(!1)} .disabled=${i.submitting}>${e.cancel ?? "Cancel"}</calcite-button><calcite-button @click=${s} .disabled=${!i.termsAccepted || i.submitting} .loading=${i.submitting} data-testid=submit-feedback-button>${e.submit ?? "Submit"}</calcite-button></div></calcite-panel></calcite-sheet>` : null;
223
223
  }
224
- function O({ assistantsEnabled: i, messages: e, slot: t, assistantHelpUrl: o, helpTopicUrl: n }) {
225
- return r`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${t ?? V} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new ?? "New"} kind=brand scale=s>${e.new ?? "New"}</calcite-chip></div><p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p>${i ? r`<p>${e.keepinmind ?? "Keep in mind the following:"}<ul><li>${e.beconsise ?? "Be concise, but also clear in your request"}</li><li>${e.avoidambiguity ?? "Avoid ambiguity and vagueness"}</li><li>${e.moredetails ?? "you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${A((e.seedocumentation ?? "Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}", `<calcite-link href=${n} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : r`<p>${A(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>`;
224
+ function O({ assistantsEnabled: t, messages: e, slot: i, helpTopicUrl: o }) {
225
+ return l`<calcite-block .label=${e.assistantinformation ?? "Assistant information"} slot=${i ?? V} expanded class="info-block" scale=s><div class="info-heading-row"><h1 class="info-heading">${e.introducing ?? "Introducing Arcade Assistant (beta)"}</h1><calcite-chip .label=${e.new ?? "New"} kind=brand scale=s>${e.new ?? "New"}</calcite-chip></div>${t ? l`<p>${e.capabilities ?? "The assistant uses artificial intelligence to generate Arcade expressions."}</p><p>${e.keepinmind ?? "Keep in mind the following:"}<ul><li>${e.beconsise ?? "Be concise, but also clear in your request"}</li><li>${e.avoidambiguity ?? "Avoid ambiguity and vagueness"}</li><li>${e.moredetails ?? "you do not need to use exact field names in your instructions, but more detail is generally better"}</li></ul>${A((e.seedocumentation ?? "Please see the {documentation} for more information, including limitations and additional resources.").replace("{documentation}", `<calcite-link href=${o} target="_blank">${e.documentation ?? "documentation"}</calcite-link>`))}</p>` : l`<p>${e.useofassistant ?? "The assistant uses artificial intelligence to generate Arcade expressions. To enable Arcade Assistant (beta), the following must be true:"}</p><ul><li>${e.enabledinorg ?? "AI assistants are enabled in the organization settings"}</li><li>${e.enabledbetaapps ?? "Beta apps and capabilities are not blocked"}</li><li>${e.enabledroleprivilege ?? "Your role privilege allows you to use AI assistants"}</li></ul>`}</calcite-block>`;
226
226
  }
227
- function Fe({ messages: i, onProceed: e, onExit: t, helpTopicUrl: o }) {
228
- return r`<calcite-dialog close-disabled placement=top .heading=${i.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${i.beforeyougetstarted ?? "Before you get started be aware:"}</h3><ul><li>${i.maybeincorrect ?? "AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${A((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>`;
227
+ function Fe({ messages: t, onProceed: e, onExit: i, helpTopicUrl: o }) {
228
+ return l`<calcite-dialog close-disabled placement=top .heading=${t.welcome ?? "Welcome to the new assistant experience"} slot=dialogs open width-scale=m id=welcome-dialog><h3 class="unstyled-h3">${t.beforeyougetstarted ?? "Before you get started be aware:"}</h3><ul><li>${t.maybeincorrect ?? "AI generated code may occasionally be incorrect or biased. Review carefully."}</li><li>${A((t.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">${t.helptopic ?? "help topic"}</calcite-link>`))}</li></ul><calcite-button id=welcome-proceed slot=footer-end @click=${e}>${t.proceed ?? "Proceed"}</calcite-button><calcite-button id=welcome-decline slot=footer-start @click=${i} kind=neutral>${t.exit ?? "Exit"}</calcite-button></calcite-dialog>`;
229
229
  }
230
- function De({ messages: i, suggestions: e, onSuggestionClick: t }) {
231
- return r`<calcite-block .heading=${i.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map((o) => r`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${i.promptsuggestion} class="suggestion-button" @click=${() => t?.(o)}>${o}</calcite-button>`)}</div></calcite-block>`;
230
+ function De({ messages: t, suggestions: e, onSuggestionClick: i }) {
231
+ return l`<calcite-block .heading=${t.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map((o) => l`<calcite-button round scale=s appearance=outline-fill kind=neutral .label=${t.promptsuggestion} class="suggestion-button" @click=${() => i?.(o)}>${o}</calcite-button>`)}</div></calcite-block>`;
232
232
  }
233
233
  const z = 200;
234
- function L({ hidden: i = !1, expanded: e = !1, messages: t, cards: o, heading: n, collapsible: s = !1, showEffectsIcon: d = !1, onCopyCode: p, standalone: c }) {
235
- return r`<calcite-block .hidden=${i} id=result-block .heading=${n ?? t.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${s}>${d && r`<calcite-chip .label=${t.assistantresponses ?? "Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${t.assistantresponses ?? "Assistant responses"}>${Q(o, (a) => a.conversationId, (a) => r`<calcite-card><div slot=heading><div class="prior-prompt"><span>${a.priorPrompt.length > z ? `${a.priorPrompt.slice(0, z)}...` : a.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${a.conversationId}-${c ? "standalone" : "list"}`} @click=${(h) => {
236
- const l = h.currentTarget;
234
+ function L({ hidden: t = !1, expanded: e = !1, messages: i, cards: o, heading: n, collapsible: s = !1, showEffectsIcon: r = !1, onCopyCode: p, standalone: c }) {
235
+ return l`<calcite-block .hidden=${t} id=result-block .heading=${n ?? i.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${s}>${r && l`<calcite-chip .label=${i.assistantresponses ?? "Assistant responses"} slot=content-start icon=effects scale=m class="suggestion-chips"></calcite-chip>` || ""}<calcite-card-group .label=${i.assistantresponses ?? "Assistant responses"}>${Q(o, (a) => a.conversationId, (a) => l`<calcite-card><div slot=heading><div class="prior-prompt"><span>${a.priorPrompt.length > z ? `${a.priorPrompt.slice(0, z)}...` : a.priorPrompt}</span><calcite-action icon=duplicate scale=s slot=actions-end class="copy-prompt-button" text .id=${`copy-prompt-${a.conversationId}-${c ? "standalone" : "list"}`} @click=${(h) => {
236
+ const d = h.currentTarget;
237
237
  navigator.clipboard.writeText(a.priorPrompt).then(() => {
238
- l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
238
+ d.setAttribute("data-copied", "true"), setTimeout(() => d.removeAttribute("data-copied"), 1500);
239
239
  });
240
- }}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${c ? "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}-${c ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${t.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${a.message && c && r`<div class="response-error-container">${Ie({ 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 && !c && r`<calcite-tooltip .referenceElement=${`response-chip-${a.conversationId}-error`} placement=top-start>${a.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${a.conversationId}-error`} .label=${t.error ?? "Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>` || ""}${Ne({ card: a, messages: t })}</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}-${c ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${a.conversationId}-${c ? "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}-${c ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${a.conversationId}-${c ? "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=${(h) => {
241
- const l = h.currentTarget;
240
+ }}></calcite-action><calcite-popover .referenceElement=${`copy-prompt-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${i.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${i.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-prompt-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${i.copyprompttoclipboard ?? "Copy prompt to clipboard"}</calcite-tooltip></div>${a.message && c && l`<div class="response-error-container">${Ie({ errorMessage: a.message })}</div>` || ""}</div><div><div class="code-response-wrapper"><div class="positioned-code-content"><calcite-chip-group .label=${i.responsecontext ?? "Response Context"} scale=s>${a.message && !c && l`<calcite-tooltip .referenceElement=${`response-chip-${a.conversationId}-error`} placement=top-start>${a.message}</calcite-tooltip><calcite-chip .id=${`response-chip-${a.conversationId}-error`} .label=${i.error ?? "Error"} scale=s appearance=outline icon=exclamation-mark-triangle-f class="response-error-chip"></calcite-chip>` || ""}${Ne({ card: a, messages: i })}</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=${i.addtoeditor ?? "Add to editor"} .id=${`add-to-editor-button-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-button><calcite-tooltip class="hidden-above-380" .referenceElement=${`add-to-editor-button-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start>${i.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>${i.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}-${c ? "standalone" : "list"}`}></calcite-button><calcite-tooltip .referenceElement=${`replace-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start><span>${i.replaceineditor ?? "Replace all code in editor"}</span></calcite-tooltip><calcite-button round icon-start=copy-to-clipboard kind=neutral scale=s @click=${(h) => {
241
+ const d = h.currentTarget;
242
242
  p(a.code).then(() => {
243
- l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
243
+ d.setAttribute("data-copied", "true"), setTimeout(() => d.removeAttribute("data-copied"), 1500);
244
244
  });
245
- }} class="response-secondary-action-button" .id=${`copy-response-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${a.conversationId}-${c ? "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}-${c ? "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}-${c ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${a.conversationId}-${c ? "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}-${c ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start><span>${t.unhelpful ?? "Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
245
+ }} class="response-secondary-action-button" .id=${`copy-response-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-button><calcite-popover .referenceElement=${`copy-response-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start class="copy-feedback" .label=${i.copiedsuccessfully ?? "copied successfully"} open trigger-disabled><span>${i.copiedsuccessfully ?? "copied successfully"}</span></calcite-popover><calcite-tooltip .referenceElement=${`copy-response-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start class="copy-tooltip">${i.copytoclipboard ?? "Copy code to clipboard"}</calcite-tooltip></div><div slot=footer-end class="feedback-actions"><calcite-action .text=${i.thumbsup ?? "Thumbs up"} scale=s icon=thumbs-up @click=${a.onThumbsUp} .id=${`thumbs-up-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-up-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start><span>${i.helpful ?? "Helpful"}</span></calcite-tooltip><calcite-action .text=${i.thumbsdown ?? "Thumbs down"} scale=s icon=thumbs-down @click=${a.onThumbsDown} .id=${`thumbs-down-${a.conversationId}-${c ? "standalone" : "list"}`}></calcite-action><calcite-tooltip .referenceElement=${`thumbs-down-${a.conversationId}-${c ? "standalone" : "list"}`} placement=top-start><span>${i.unhelpful ?? "Unhelpful"}</span></calcite-tooltip></div></calcite-card>`)}</calcite-card-group></calcite-block>`;
246
246
  }
247
- const Ne = ({ card: i, messages: e }) => {
248
- const t = le(), o = `response-chip-profile-${i.conversationId}-${t}`, n = (e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", i.profileId);
249
- return r`<calcite-tooltip .referenceElement=${o} placement=top-start class="contained-popover-or-tooltip">${n}</calcite-tooltip><calcite-chip .label=${i.profileId} scale=s appearance=outline icon=map-information id=${o ?? V}>${i.profileId}</calcite-chip>`;
250
- }, H = (i) => i.type === "featureSet", R = (i) => {
251
- if (!be(i))
247
+ const Ne = ({ card: t, messages: e }) => {
248
+ const i = le(), o = `response-chip-profile-${t.conversationId}-${i}`, n = (e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", t.profileId);
249
+ return l`<calcite-tooltip .referenceElement=${o} placement=top-start class="contained-popover-or-tooltip">${n}</calcite-tooltip><calcite-chip .label=${t.profileId} scale=s appearance=outline icon=map-information id=${o ?? V}>${t.profileId}</calcite-chip>`;
250
+ }, B = (t) => t.type === "featureSet", E = (t) => {
251
+ if (!be(t))
252
252
  return [];
253
253
  const e = [];
254
- return i.relationships?.forEach((t) => {
255
- e.push(t.toJSON());
254
+ return t.relationships?.forEach((i) => {
255
+ e.push(i.toJSON());
256
256
  }), e;
257
- }, E = (i) => i.length > 0 ? { relationships: i } : {}, Ue = (i) => fe(i).map((e) => ({
257
+ }, R = (t) => t.length > 0 ? { relationships: t } : {}, _e = (t) => fe(t).map((e) => ({
258
258
  alias: e.alias,
259
259
  name: e.name,
260
260
  type: e.type,
261
261
  ...e.domain ? { domain: e.domain } : {}
262
- })), M = (i) => i ? { fields: Ue(i) } : { fields: [] };
263
- async function B(i) {
264
- const e = await i.loadSource(), t = K(e) && e.isTable, o = R(e);
262
+ })), M = (t) => t ? { fields: _e(t) } : { fields: [] };
263
+ async function j(t) {
264
+ const e = await t.loadSource(), i = Y(e) && e.isTable, o = E(e);
265
265
  return {
266
- name: i.name,
266
+ name: t.name,
267
267
  type: "featureSet",
268
- isTable: t,
268
+ isTable: i,
269
269
  ...M(e?.fields),
270
- ...E(o)
270
+ ...R(o)
271
271
  };
272
272
  }
273
- async function Y(i) {
274
- switch (i.type) {
273
+ async function K(t) {
274
+ switch (t.type) {
275
275
  case "feature": {
276
- const e = await i.loadSource(), t = R(e);
276
+ const e = await t.loadSource(), i = E(e);
277
277
  return {
278
- name: i.name,
279
- type: i.type,
278
+ name: t.name,
279
+ type: t.type,
280
280
  ...M(e?.fields),
281
- ...E(t)
281
+ ...R(i)
282
282
  };
283
283
  }
284
284
  case "featureSet": {
285
- const e = await i.loadSource(), t = K(e) && e.isTable;
285
+ const e = await t.loadSource(), i = Y(e) && e.isTable;
286
286
  return {
287
- name: i.name,
287
+ name: t.name,
288
288
  type: "featureSet",
289
- ...t ? { isTable: t } : {},
289
+ ...i ? { isTable: i } : {},
290
290
  ...M(e?.fields),
291
- ...E(R(e))
291
+ ...R(E(e))
292
292
  };
293
293
  }
294
294
  case "featureSetCollection": {
295
- const e = await i.loadSource(), t = e?.layers.filter(H) ?? [], o = e?.tables.filter(H) ?? [], n = await Promise.all(t.map(B)), s = await Promise.all(o.map(B));
295
+ const e = await t.loadSource(), i = e?.layers.filter(B) ?? [], o = e?.tables.filter(B) ?? [], n = await Promise.all(i.map(j)), s = await Promise.all(o.map(j));
296
296
  return {
297
- name: i.name,
297
+ name: t.name,
298
298
  type: "featureSetCollection",
299
299
  layers: n,
300
300
  tables: s
301
301
  };
302
302
  }
303
303
  case "dictionary": {
304
- const e = await Promise.all(i.dictionaryVariables.map(Y));
304
+ const e = await Promise.all(t.dictionaryVariables.map(K));
305
305
  return {
306
- name: i.name,
306
+ name: t.name,
307
307
  type: "dictionary",
308
308
  attributes: e
309
309
  };
310
310
  }
311
311
  case "pixel": {
312
- const e = await i.loadSource();
312
+ const e = await t.loadSource();
313
313
  if (!e)
314
314
  return {
315
- name: i.name,
315
+ name: t.name,
316
316
  type: "pixel"
317
317
  };
318
- const t = await me(e);
318
+ const i = await me(e);
319
319
  return {
320
- name: i.name,
320
+ name: t.name,
321
321
  type: "pixel",
322
- members: t.map(j)
322
+ members: i.map(H)
323
323
  };
324
324
  }
325
325
  case "voxel": {
326
- const e = await i.loadSource();
326
+ const e = await t.loadSource();
327
327
  if (!e)
328
328
  return {
329
- name: i.name,
329
+ name: t.name,
330
330
  type: "voxel"
331
331
  };
332
- const t = await he(e);
332
+ const i = await he(e);
333
333
  return {
334
- name: i.name,
334
+ name: t.name,
335
335
  type: "voxel",
336
- members: t.map(j)
336
+ members: i.map(H)
337
337
  };
338
338
  }
339
339
  case "array":
340
340
  return {
341
- name: i.name,
341
+ name: t.name,
342
342
  type: "array",
343
- elementType: i.elementType.type
343
+ elementType: t.elementType.type
344
344
  };
345
345
  case "number":
346
346
  case "text":
@@ -351,42 +351,42 @@ async function Y(i) {
351
351
  case "geometry":
352
352
  case "time":
353
353
  return {
354
- name: i.name,
355
- type: i.type
354
+ name: t.name,
355
+ type: t.type
356
356
  };
357
357
  }
358
358
  }
359
- function j(i) {
360
- return i.type === "array" ? {
361
- name: i.name,
359
+ function H(t) {
360
+ return t.type === "array" ? {
361
+ name: t.name,
362
362
  type: "array",
363
- elementType: i.elementType.type
363
+ elementType: t.elementType.type
364
364
  } : {
365
- name: i.name,
366
- type: i.type
365
+ name: t.name,
366
+ type: t.type
367
367
  // casting bc member types shouldn't be feature, featureset, etc.
368
368
  };
369
369
  }
370
- async function _e(i) {
370
+ async function Ue(t) {
371
371
  return {
372
- variables: await Promise.all(i.variables.map(Y))
372
+ variables: await Promise.all(t.variables.map(K))
373
373
  };
374
374
  }
375
375
  const Oe = 1e5;
376
- function ze(i) {
377
- const e = new TextEncoder().encode(i).length;
376
+ function ze(t) {
377
+ const e = new TextEncoder().encode(t).length;
378
378
  return Math.ceil(e / 3.5);
379
379
  }
380
- function P(i) {
381
- return ze(JSON.stringify(i));
380
+ function P(t) {
381
+ return ze(JSON.stringify(t));
382
382
  }
383
- function Le(i) {
383
+ function Le(t) {
384
384
  const e = (o) => ({
385
385
  name: o.name,
386
386
  type: o.type,
387
387
  ...o.isTable ? { isTable: o.isTable } : {},
388
388
  ...o.relationships ? { relationships: o.relationships } : {}
389
- }), t = (o) => {
389
+ }), i = (o) => {
390
390
  switch (o.type) {
391
391
  case "feature":
392
392
  case "featureSet":
@@ -408,7 +408,7 @@ function Le(i) {
408
408
  return {
409
409
  name: o.name,
410
410
  type: "dictionary",
411
- attributes: o.attributes.map(t)
411
+ attributes: o.attributes.map(i)
412
412
  };
413
413
  case "pixel":
414
414
  case "voxel":
@@ -427,28 +427,28 @@ function Le(i) {
427
427
  }
428
428
  };
429
429
  return {
430
- variables: i.variables.map(t)
430
+ variables: t.variables.map(i)
431
431
  };
432
432
  }
433
- function He(i) {
434
- const e = i.variables, t = e.length, o = e.find((s) => s.name === "$feature") ?? e.find((s) => s.type === "feature") ?? e[0], n = o ? [o] : [];
433
+ function Be(t) {
434
+ const e = t.variables, i = e.length, o = e.find((s) => s.name === "$feature") ?? e.find((s) => s.type === "feature") ?? e[0], n = o ? [o] : [];
435
435
  return {
436
436
  context: { variables: n },
437
- wasReduced: t !== n.length,
437
+ wasReduced: i !== n.length,
438
438
  reducedToVariableName: o?.name
439
439
  };
440
440
  }
441
- function Be(i) {
442
- return P(i) > Oe;
441
+ function je(t) {
442
+ return P(t) > Oe;
443
443
  }
444
- var je = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, m = (i, e, t, o) => {
445
- for (var n = o > 1 ? void 0 : o ? Ge(e, t) : e, s = i.length - 1, d; s >= 0; s--)
446
- (d = i[s]) && (n = (o ? d(e, t, n) : d(n)) || n);
447
- return o && n && je(e, t, n), n;
444
+ var He = Object.defineProperty, Ge = Object.getOwnPropertyDescriptor, m = (t, e, i, o) => {
445
+ for (var n = o > 1 ? void 0 : o ? Ge(e, i) : e, s = t.length - 1, r; s >= 0; s--)
446
+ (r = t[s]) && (n = (o ? r(e, i, n) : r(n)) || n);
447
+ return o && n && He(e, i, n), n;
448
448
  };
449
449
  let u = class extends ge {
450
- constructor(i) {
451
- super(i), this.viewMode = "prompt", this.confirmationActive = !1, this.contextReducedNoticeDismissed = !1, this.splashActive = !0, this.isSubmitting = !1, this.question = "", this.history = [], this.feedback = { active: !1 };
450
+ constructor(t) {
451
+ super(t), this.viewMode = "prompt", this.confirmationActive = !1, this.contextReducedNoticeDismissed = !1, this.splashActive = !0, this.isSubmitting = !1, this.question = "", this.history = [], this.feedback = { active: !1 };
452
452
  }
453
453
  };
454
454
  m([
@@ -487,7 +487,7 @@ m([
487
487
  u = m([
488
488
  ve("ArcadeAssistantViewState")
489
489
  ], u);
490
- const We = "arcade_generation", Je = "ArcadeCodeRequest", G = "visualization", Qe = "ArcadeAssistant", Ke = [
490
+ const Je = "arcade_generation", We = "ArcadeCodeRequest", G = "visualization", Qe = "ArcadeAssistant", Ye = [
491
491
  "your_comments",
492
492
  "user_evaluation",
493
493
  "question",
@@ -498,12 +498,12 @@ const We = "arcade_generation", Je = "ArcadeCodeRequest", G = "visualization", Q
498
498
  "context",
499
499
  "extras"
500
500
  ];
501
- let W = [], J = !0;
502
- class Ye extends ie {
501
+ let J = [], W = !0;
502
+ class Ke extends ie {
503
503
  constructor() {
504
- super(...arguments), this.textAreaRef = ae(), this.messages = ne(), this._feedbackService = void 0, this.viewState = new u(), this.handleFeedbackButton = (e, t) => {
504
+ super(...arguments), this.textAreaRef = ae(), this.messages = ne(), this._feedbackService = void 0, this.viewState = new u(), this.handleFeedbackButton = (e, i) => {
505
505
  this.updateViewState({
506
- feedback: { active: !0, value: e, item: t, termsAccepted: !1, text: "", submitting: !1 }
506
+ feedback: { active: !0, value: e, item: i, termsAccepted: !1, text: "", submitting: !1 }
507
507
  });
508
508
  }, this.handleFeedbackSheetClose = () => {
509
509
  this.updateViewState({ feedback: { active: !1 } });
@@ -516,9 +516,9 @@ class Ye extends ie {
516
516
  this.handleFeedbackSheetClose();
517
517
  return;
518
518
  }
519
- const t = this.viewState.feedback.item.contextSnapshot, o = pe.applicationName;
519
+ const i = this.viewState.feedback.item.contextSnapshot, o = pe.applicationName;
520
520
  !o && !this.appVersion && x("warn", this, "esriConfig.applicationName is not set. Consider setting it to help identify the application version in feedback.");
521
- const { value: n, text: s, termsAccepted: d, item: { question: p, formattedScript: c, conversationId: a } } = this.viewState.feedback, h = {
521
+ const { value: n, text: s, termsAccepted: r, item: { question: p, formattedScript: c, conversationId: a } } = this.viewState.feedback, h = {
522
522
  user_evaluation: n,
523
523
  your_comments: s || void 0,
524
524
  question: p ?? "",
@@ -532,15 +532,15 @@ class Ye extends ie {
532
532
  useragent: navigator.userAgent,
533
533
  _source: Qe,
534
534
  version: this.appVersion || o || "NOT_SET",
535
- context: t ? JSON.stringify(t) : "",
536
- extras: t?.profileId ?? "",
535
+ context: i ? JSON.stringify(i) : "",
536
+ extras: i?.profileId ?? "",
537
537
  conversation_id: a ?? "",
538
- privacy_statement: d ? "I_agree" : ""
538
+ privacy_statement: r ? "I_agree" : ""
539
539
  };
540
540
  try {
541
541
  await e.applyEdits({ addFeatures: [new ue({ attributes: h })] });
542
- } catch (l) {
543
- x("error", this, "Error submitting feedback.", { detail: { error: l } });
542
+ } catch (d) {
543
+ x("error", this, "Error submitting feedback.", { detail: { error: d } });
544
544
  }
545
545
  this.handleFeedbackSheetClose();
546
546
  }, this.handleClose = (e) => {
@@ -563,9 +563,6 @@ class Ye extends ie {
563
563
  return `// ${this.messages.disclaimercomment}
564
564
  // ${this.messages.disclaimerpt2 ?? "AI-generated content may be inaccurate. Review before using."}`;
565
565
  }
566
- get assistantHelpUrl() {
567
- return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}administer/configure-assistants.htm`;
568
- }
569
566
  get assistantOverviewDocUrl() {
570
567
  return `${this.helpBase ?? "https://doc.arcgis.com/en/arcgis-online/"}create-maps/understand-arcade-assistant.htm`;
571
568
  }
@@ -575,23 +572,23 @@ class Ye extends ie {
575
572
  async destroy() {
576
573
  }
577
574
  connectedCallback() {
578
- super.connectedCallback(), this.updateViewState({ history: W, splashActive: J });
575
+ super.connectedCallback(), this.updateViewState({ history: J, splashActive: W });
579
576
  }
580
577
  load() {
581
578
  const e = async () => {
582
- const t = this.getModel();
583
- if (!t) {
579
+ const i = this.getModel();
580
+ if (!i) {
584
581
  this.updateViewState({ context: void 0 });
585
582
  return;
586
583
  }
587
- const o = await this.getProfileAndMetadata(t.uri);
584
+ const o = await this.getProfileAndMetadata(i.uri);
588
585
  this.updateViewState({
589
586
  context: o,
590
587
  contextReducedNoticeDismissed: o.contextTooLarge ? !1 : this.viewState.contextReducedNoticeDismissed
591
588
  });
592
589
  };
593
- e().catch((t) => {
594
- x("error", this, "Error setting initial context.", { detail: { error: t } });
590
+ e().catch((i) => {
591
+ x("error", this, "Error setting initial context.", { detail: { error: i } });
595
592
  }), this.manager.onLifecycle(() => ({ remove: N.onModelContextDidChange(async () => {
596
593
  e().catch((o) => {
597
594
  x("error", this, "Error setting context.", { detail: { error: o } });
@@ -599,31 +596,31 @@ class Ye extends ie {
599
596
  }).dispose }));
600
597
  }
601
598
  disconnectedCallback() {
602
- super.disconnectedCallback(), W = this.viewState.history, J = this.viewState.splashActive, this.copySuccessTimer && (clearTimeout(this.copySuccessTimer), this.copySuccessTimer = void 0);
599
+ super.disconnectedCallback(), J = this.viewState.history, W = this.viewState.splashActive, this.copySuccessTimer && (clearTimeout(this.copySuccessTimer), this.copySuccessTimer = void 0);
603
600
  }
604
601
  createFeedbackContextSnapshot(e) {
605
- const t = Le(e.metadata);
602
+ const i = Le(e.metadata);
606
603
  return {
607
604
  ...e,
608
- metadata: t,
609
- estimatedTokens: P(t)
605
+ metadata: i,
606
+ estimatedTokens: P(i)
610
607
  };
611
608
  }
612
609
  updateViewState(e) {
613
610
  this.viewState.set(e);
614
611
  }
615
612
  getHistoryCards() {
616
- return this.viewState.history.reduce((e, t) => (!t.script || (e.push({
617
- priorPrompt: t.question,
618
- code: t.formattedScript || t.error || "",
619
- profileId: t.profile ?? G,
613
+ return this.viewState.history.reduce((e, i) => (!i.script || (e.push({
614
+ priorPrompt: i.question,
615
+ code: i.formattedScript || i.error || "",
616
+ profileId: i.profile ?? G,
620
617
  onAddToEditor: (o) => {
621
- ce(this.editorRef.editorInstance, t.formattedScript ?? "", o, this.disclaimerComment);
618
+ ce(this.editorRef.editorInstance, i.formattedScript ?? "", o, this.disclaimerComment);
622
619
  },
623
- onThumbsUp: () => this.handleFeedbackButton("good", t),
624
- onThumbsDown: () => this.handleFeedbackButton("bad", t),
625
- conversationId: t.conversationId ?? "",
626
- message: t.message
620
+ onThumbsUp: () => this.handleFeedbackButton("good", i),
621
+ onThumbsDown: () => this.handleFeedbackButton("bad", i),
622
+ conversationId: i.conversationId ?? "",
623
+ message: i.message
627
624
  }), this.viewState.viewMode === "result"), e), []);
628
625
  }
629
626
  async ensureFeedbackService() {
@@ -633,9 +630,9 @@ class Ye extends ie {
633
630
  return;
634
631
  const e = new de({ url: this.feedbackServiceUrl });
635
632
  await e.load();
636
- const t = Ke.filter((o) => !e.fields.some((n) => n.name === o));
637
- if (t.length > 0) {
638
- x("error", this, `Missing the following fields in feedback service: ${t.join(", ")}. Feedback will not be logged.`);
633
+ const i = Ye.filter((o) => !e.fields.some((n) => n.name === o));
634
+ if (i.length > 0) {
635
+ x("error", this, `Missing the following fields in feedback service: ${i.join(", ")}. Feedback will not be logged.`);
639
636
  return;
640
637
  }
641
638
  return this._feedbackService = e, e;
@@ -647,26 +644,26 @@ class Ye extends ie {
647
644
  if (this.viewState.question) {
648
645
  this.updateViewState({ isSubmitting: !0, errorMessage: void 0 });
649
646
  try {
650
- const e = await this.getToken(), t = this.getModel();
651
- if (!t)
647
+ const e = await this.getToken(), i = this.getModel();
648
+ if (!i)
652
649
  return;
653
- const o = this.viewState.context ?? await this.getProfileAndMetadata(t.uri), s = (await $e({
650
+ const o = this.viewState.context ?? await this.getProfileAndMetadata(i.uri), s = (await we({
654
651
  baseUrl: this.serviceUrl,
655
- skillId: We,
652
+ skillId: Je,
656
653
  message: this.viewState.question,
657
654
  authToken: e,
658
655
  context: {
659
- kind: Je,
656
+ kind: We,
660
657
  context: {
661
658
  profile_id: o.profileId,
662
659
  metadata: [o.metadata]
663
660
  }
664
661
  }
665
- })).find((d) => d.context?.kind === "ArcadeCodeResponse");
662
+ })).find((r) => r.context?.kind === "ArcadeCodeResponse");
666
663
  if (!s)
667
664
  return;
668
665
  if (s.context?.kind === "ArcadeCodeResponse") {
669
- const d = this.createFeedbackContextSnapshot(o);
666
+ const r = this.createFeedbackContextSnapshot(o);
670
667
  this.updateViewState({
671
668
  history: [
672
669
  {
@@ -676,7 +673,7 @@ class Ye extends ie {
676
673
  question: this.viewState.question,
677
674
  profile: o.profileId,
678
675
  conversationId: s.conversationId,
679
- contextSnapshot: d,
676
+ contextSnapshot: r,
680
677
  ...s.message ? { message: s.message } : {}
681
678
  },
682
679
  ...this.viewState.history
@@ -699,38 +696,38 @@ class Ye extends ie {
699
696
  return e;
700
697
  }
701
698
  async getProfileAndMetadata(e) {
702
- let t = G;
699
+ let i = G;
703
700
  const o = N.getEditorProfileForModel(e);
704
701
  o?.loaded || await o?.loadSource();
705
702
  const n = this.editorRef.profile;
706
- n && "id" in n && (t = n.id);
707
- const s = o ? await _e(o) : { variables: [] }, d = Be(s), p = d ? He(s) : void 0, a = p ? p.context : s, h = P(a);
703
+ n && "id" in n && (i = n.id);
704
+ const s = o ? await Ue(o) : { variables: [] }, r = je(s), p = r ? Be(s) : void 0, a = p ? p.context : s, h = P(a);
708
705
  return {
709
- profileId: t,
706
+ profileId: i,
710
707
  metadata: a,
711
- contextTooLarge: d,
708
+ contextTooLarge: r,
712
709
  reducedToVariableName: p?.reducedToVariableName,
713
710
  estimatedTokens: h
714
711
  };
715
712
  }
716
713
  onCopyCode(e) {
717
- const t = e ? `${this.disclaimerComment}
714
+ const i = e ? `${this.disclaimerComment}
718
715
  ${e}` : "";
719
- return navigator.clipboard.writeText(t);
716
+ return navigator.clipboard.writeText(i);
720
717
  }
721
718
  render() {
722
719
  if (this.closed)
723
720
  return null;
724
- const e = this.viewState.viewMode === "result", t = this.getHistoryCards();
725
- return this.assistantsEnabled ? r`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive && r`<calcite-scrim></calcite-scrim>` || ""}${Ae({ messages: this.messages })}${Te({ popoverContent: O({ assistantsEnabled: this.assistantsEnabled, messages: this.messages, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.viewState.splashActive && Fe({ messages: this.messages, onProceed: () => {
721
+ const e = this.viewState.viewMode === "result", i = this.getHistoryCards();
722
+ return this.assistantsEnabled ? l`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive && l`<calcite-scrim></calcite-scrim>` || ""}${Ae({ messages: this.messages })}${Te({ messages: this.messages, popoverContent: O({ assistantsEnabled: this.assistantsEnabled, messages: this.messages, helpTopicUrl: this.usingTheAssitantDocUrl }) })}<calcite-shell class="unstyled-shell">${this.viewState.splashActive && Fe({ messages: this.messages, onProceed: () => {
726
723
  this.updateViewState({ splashActive: !1 });
727
- }, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${Re({ active: this.viewState.confirmationActive, setActive: (o) => this.updateViewState({ confirmationActive: o }), messages: this.messages })}${Me({ isDisabled: this.viewState.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestionState, setIsViewingResult: (o) => this.updateViewState({ viewMode: o ? "result" : "prompt" }), mode: e ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.viewState.question, errorMessage: this.viewState.errorMessage, setErrorMessage: (o) => this.updateViewState({ errorMessage: o }), promptValidationMessage: this.viewState.promptValidationMessage, setPromptValidationMessage: (o) => this.updateViewState({ promptValidationMessage: o }), submitQuestion: this.submitQuestion.bind(this), assistantRef: this.el, messages: this.messages, context: this.viewState.context, contextReducedNoticeDismissed: this.viewState.contextReducedNoticeDismissed, setContextReducedNoticeDismissed: (o) => this.updateViewState({ contextReducedNoticeDismissed: o }) })}<calcite-block-group label="interactive blocks">${!e && !this.viewState.isSubmitting && De({ messages: this.messages, suggestions: [this.messages.prompsuggestion1 ?? "", this.messages.prompsuggestion2 ?? ""], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${L({
724
+ }, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${Ee({ active: this.viewState.confirmationActive, setActive: (o) => this.updateViewState({ confirmationActive: o }), messages: this.messages })}${Me({ isDisabled: this.viewState.isSubmitting, isReadOnly: !1, setQuestion: this.setQuestionState, setIsViewingResult: (o) => this.updateViewState({ viewMode: o ? "result" : "prompt" }), mode: e ? "refine" : "prompt", textAreaRef: this.textAreaRef, question: this.viewState.question, errorMessage: this.viewState.errorMessage, setErrorMessage: (o) => this.updateViewState({ errorMessage: o }), promptValidationMessage: this.viewState.promptValidationMessage, setPromptValidationMessage: (o) => this.updateViewState({ promptValidationMessage: o }), submitQuestion: this.submitQuestion.bind(this), assistantRef: this.el, messages: this.messages, context: this.viewState.context, contextReducedNoticeDismissed: this.viewState.contextReducedNoticeDismissed, setContextReducedNoticeDismissed: (o) => this.updateViewState({ contextReducedNoticeDismissed: o }) })}<calcite-block-group .label=${this.messages.interactiveblocks ?? "interactive blocks"}>${!e && !this.viewState.isSubmitting && De({ messages: this.messages, suggestions: [this.messages.prompsuggestion1 ?? "", this.messages.prompsuggestion2 ?? ""], onSuggestionClick: this.onSuggestionClick }) || ""}<calcite-block .hidden=${!this.viewState.isSubmitting} .heading=${this.messages.generatingresponse ?? "Generating response..."}></calcite-block>${L({
728
725
  expanded: e,
729
726
  messages: this.messages,
730
727
  collapsible: !0,
731
728
  showEffectsIcon: !0,
732
729
  /** Only show the latest history card */
733
- cards: t.length ? [t[0]] : [],
730
+ cards: i.length ? [i[0]] : [],
734
731
  heading: this.messages.besteffort ?? "Here's the assistant's best effort",
735
732
  hidden: this.viewState.isSubmitting || !e,
736
733
  onCopyCode: this.onCopyCode.bind(this),
@@ -745,14 +742,14 @@ ${e}` : "";
745
742
  * To avoid showing the same card twice, we remove (slice out) the first card
746
743
  * from the list of recent prompts below.
747
744
  */
748
- cards: e ? t.slice(1) : t,
745
+ cards: e ? i.slice(1) : i,
749
746
  heading: this.messages.recentprompts ?? "Recent prompts",
750
747
  hidden: this.viewState.isSubmitting || this.viewState.history.length === 0,
751
748
  onCopyCode: this.onCopyCode.bind(this)
752
- })}</calcite-block-group>${this.viewState.feedback.active ? qe({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, onSubmit: this.handleFeedbackSubmit, feedback: this.viewState.feedback, setFeedback: this.setFeedbackState }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : r`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${O({ slot: "content-top", messages: this.messages, assistantsEnabled: this.assistantsEnabled, assistantHelpUrl: this.assistantHelpUrl, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
749
+ })}</calcite-block-group>${this.viewState.feedback.active ? qe({ setOpen: this.handleFeedbackSheetClose, messages: this.messages, onSubmit: this.handleFeedbackSubmit, feedback: this.viewState.feedback, setFeedback: this.setFeedbackState, learnMoreUrl: this.assistantOverviewDocUrl }) : null}</calcite-shell></calcite-flow-item></calcite-flow>` : l`<calcite-flow><calcite-flow-item .selected=${!e} closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${O({ slot: "content-top", messages: this.messages, assistantsEnabled: this.assistantsEnabled, helpTopicUrl: this.usingTheAssitantDocUrl })}</calcite-flow-item></calcite-flow>`;
753
750
  }
754
751
  }
755
- Z("arcgis-arcade-coding-assistant", Ye);
752
+ Z("arcgis-arcade-coding-assistant", Ke);
756
753
  export {
757
- Ye as ArcgisArcadeCodingAssistant
754
+ Ke as ArcgisArcadeCodingAssistant
758
755
  };