@arcgis/coding-components 5.0.0-next.156 → 5.0.0-next.158
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/cdn/{6MTR3FWI.js → ETXVDQJ6.js} +1 -1
- package/dist/cdn/{H75AOE6T.js → JTUZKSDX.js} +1 -1
- package/dist/cdn/{HS63YTYQ.js → NYQRFR77.js} +1 -1
- package/dist/cdn/P2MJ7R3U.js +2 -0
- package/dist/cdn/TT5CVMA2.js +2 -0
- package/dist/cdn/{6ZWHLB4O.js → WD3XRDKO.js} +2 -2
- package/dist/cdn/{QPOKIVLR.js → Y7IEIZNX.js} +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +1 -1
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/arcade-mode.js +2 -2
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +47 -47
- package/dist/components/arcgis-arcade-editor/customElement.d.ts +5 -1
- package/dist/components/arcgis-arcade-editor/customElement.js +41 -37
- package/dist/docs/api.json +1 -1
- package/dist/docs/docs.json +1 -1
- package/dist/docs/web-types.json +1 -1
- package/package.json +5 -5
- package/dist/cdn/EHTEMHJI.js +0 -2
- package/dist/cdn/RVGVRKXU.js +0 -2
|
@@ -18238,7 +18238,7 @@ function se(t, e, r, n) {
|
|
|
18238
18238
|
const fr = { apiKey: void 0, apiKeys: { scopes: [] }, applicationName: "", applicationUrl: globalThis.location?.href, assetsPath: "", fontsUrl: "https://static.arcgis.com/fonts", geometryServiceUrl: "https://utility.arcgisonline.com/arcgis/rest/services/Geometry/GeometryServer", geoRSSServiceUrl: "https://utility.arcgis.com/sharing/rss", kmlServiceUrl: "https://utility.arcgis.com/sharing/kml", userPrivilegesApplied: !0, portalUrl: "https://www.arcgis.com", respectPrefersReducedMotion: !0, routeServiceUrl: "https://route-api.arcgis.com/arcgis/rest/services/World/Route/NAServer/Route_World", workers: { loaderConfig: { has: {}, paths: {}, map: {}, packages: [] } }, request: { crossOriginNoCorsDomains: null, httpsDomains: ["arcgis.com", "arcgisonline.com", "esrikr.com", "premiumservices.blackbridge.com", "esripremium.accuweather.com", "gbm.digitalglobe.com", "firstlook.digitalglobe.com", "msi.digitalglobe.com"], interceptors: [], internalInterceptors: [], maxUrlLength: 2e3, priority: "high", proxyRules: [], proxyUrl: null, timeout: 62e3, trustedServers: [], useIdentity: !0 }, log: { interceptors: [], level: null } };
|
|
18239
18239
|
if (globalThis.esriConfig && (q4(fr, globalThis.esriConfig, !0), delete fr.has), !fr.assetsPath) {
|
|
18240
18240
|
{
|
|
18241
|
-
const t = "5.0.0-next.
|
|
18241
|
+
const t = "5.0.0-next.116";
|
|
18242
18242
|
fr.assetsPath = `https://cdn.jsdelivr.net/npm/@arcgis/core@${t}/assets`;
|
|
18243
18243
|
}
|
|
18244
18244
|
fr.defaultAssetsPath = fr.assetsPath;
|
package/dist/cdn/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import{I as s,u as e}from"./DDFKURLO.js";import"./RXOG5OZ7.js";import"./ALDX5YZO.js";var i=e(s,{"arcgis-arcade-coding-assistant":[()=>import("./
|
|
2
|
+
import{I as s,u as e}from"./DDFKURLO.js";import"./RXOG5OZ7.js";import"./ALDX5YZO.js";var i=e(s,{"arcgis-arcade-coding-assistant":[()=>import("./WD3XRDKO.js"),"appVersion,assistantsEnabled,closed,closePanel:,editorRef:,feedbackServiceUrl,helpBase,insertText:,portalUrl,serviceUrl;destroy"],"arcgis-arcade-editor":[()=>import("./P2MJ7R3U.js"),"arcadeAssistant:,customPanels:,editorInstance:,editorOptions:,hideDocumentationActions,hideSideBar,messages:,openedSidePanel,profile:,script,sideActionBarExpanded,snippets:,suggestions:,testData:;getTestResult,setFocus"],"arcgis-arcade-results":[()=>import("./IAMP2URN.js"),"calciteModeDark,consoleLogs:,loading,openedResultPanel,result:"],"arcgis-arcade-suggestions":[()=>import("./NEEMZKOL.js"),"closed,suggestions:"],"arcgis-code-editor":[()=>import("./Y7IEIZNX.js"),"editorInstance:,editorOptions:,language,modelId,value;insertSnippet,insertText,setFocus"],"arcgis-code-editor-shell":[()=>import("./QDE2LLCP.js")],"arcgis-code-viewer":[()=>import("./JTUZKSDX.js"),"language,round"],"arcgis-editor-variables":[()=>import("./NBNHNFDE.js"),"closed,loading,modelId,variable:"],"arcgis-language-api-panel":[()=>import("./BUY5C6Q3.js"),"apiLibrary:,closed,hideDocumentationActions,languageId,loading"],"arcgis-sql-expression-editor":[()=>import("./4Y2WQD7U.js"),"hideSideBar,messages:,profile:,script;setFocus"]});i({resourcesUrl:import.meta.url});var t=new CSSStyleSheet;t.replaceSync("@layer{:not([hydrated]):is(arcgis-arcade-editor,arcgis-code-editor,arcgis-code-editor-shell,arcgis-code-viewer,arcgis-sql-expression-editor){visibility:hidden}}");document.adoptedStyleSheets=[...document.adoptedStyleSheets,t];window.$arcgis||Object.defineProperty(window,"$arcgis",{configurable:!1,enumerable:!0,writable:!1,value:{}}),((a,r)=>{a.t=(c,...x)=>Promise.all(x.map(x=>x.then?x:(!a?.forceESM&&a?.import||(x=>import(x+".js").then(m=>m.default??m)))("@arcgis/core/"+x))).then(c);r.p=a.t(([m])=>{r.t=m.trackAccess;r.o=m.createObservable;r.c=m.createTrackingTarget;r.r=m.runTracked},"applications/Components/reactiveUtils")})($arcgis,s)
|
|
@@ -118,7 +118,7 @@ const F = [
|
|
|
118
118
|
{ include: "@whitespace" },
|
|
119
119
|
// regular expression: ensure it is terminated before beginning (otherwise it is an operator)
|
|
120
120
|
[
|
|
121
|
-
/\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(
|
|
121
|
+
/\/(?=([^\\\/]|\\.)+\/([gimsuy]*)(\s*)(\.|;|,|\)|\]|\}|$))/u,
|
|
122
122
|
{ token: "regexp", bracket: "@open", next: "@regexp" }
|
|
123
123
|
],
|
|
124
124
|
// delimiters and operators
|
|
@@ -161,7 +161,7 @@ const F = [
|
|
|
161
161
|
// whitespace
|
|
162
162
|
{ include: "@whitespace" },
|
|
163
163
|
// from keyword
|
|
164
|
-
[/from/u, { token: "keyword", next: "@popall" }]
|
|
164
|
+
[/from(?=\s)/u, { token: "keyword", next: "@popall" }]
|
|
165
165
|
],
|
|
166
166
|
// State after `for` keyword: expects '('
|
|
167
167
|
forLoopInit: [
|
|
@@ -1,6 +1,6 @@
|
|
|
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
|
|
3
|
+
import { css as ee, html as d } 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";
|
|
@@ -67,10 +67,10 @@ async function we(t) {
|
|
|
67
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
|
|
71
|
-
c.push(
|
|
72
|
-
const y =
|
|
73
|
-
let w =
|
|
70
|
+
const l = h.data;
|
|
71
|
+
c.push(l);
|
|
72
|
+
const y = l.conversationId, q = l.inquiryId;
|
|
73
|
+
let w = l.sequenceNumber;
|
|
74
74
|
async function T() {
|
|
75
75
|
let b = 0;
|
|
76
76
|
const g = 100;
|
|
@@ -138,7 +138,7 @@ function $e(t, e, i) {
|
|
|
138
138
|
function xe(t) {
|
|
139
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: t }) => t.length ?
|
|
141
|
+
const ke = ({ notices: t }) => t.length ? d`<div class="border-block-end">${Q(t, (e) => e.id ?? e.title, (e) => d`<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 && d`<div slot=message>${e.message}</div>` || ""}${e.actionLinkMessage && e.onAction && d`<calcite-link slot=link @click=${() => e.onAction?.()}>${e.actionLinkMessage}</calcite-link>` || ""}</calcite-notice>`)}</div>` : null, Se = (t) => {
|
|
142
142
|
const e = t.value.length, i = 72, o = 180, s = t.offsetWidth, r = Math.max(1, Math.floor(s / 8)), p = Math.ceil(e / r), c = i + (p - 2) * 24;
|
|
143
143
|
t.style.setProperty("--calcite-text-area-min-height", `${Math.min(c, o)}px`);
|
|
144
144
|
}, Ce = ({ promptValidationMessage: t, errorMessage: e, contextTooBig: i, contextReducedNoticeDismissed: o, setContextReducedNoticeDismissed: s, setErrorMessage: n, messages: r }) => {
|
|
@@ -171,21 +171,21 @@ const ke = ({ notices: t }) => t.length ? l`<div class="border-block-end">${Q(t,
|
|
|
171
171
|
return p;
|
|
172
172
|
};
|
|
173
173
|
function Ae({ messages: t }) {
|
|
174
|
-
return
|
|
174
|
+
return d`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${t.beta ?? "Beta"}>${t.beta ?? "Beta"}</calcite-chip>`;
|
|
175
175
|
}
|
|
176
176
|
function Te({ popoverContent: t, messages: e }) {
|
|
177
|
-
return
|
|
177
|
+
return d`<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
179
|
function Ie({ errorMessage: t, slot: e }) {
|
|
180
|
-
return
|
|
180
|
+
return d`<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
|
|
183
|
-
return
|
|
182
|
+
function Re({ active: t, setActive: e, messages: i }) {
|
|
183
|
+
return d`<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
|
|
186
|
-
return t ?
|
|
185
|
+
function Ee({ context: t, messages: e }) {
|
|
186
|
+
return t ? d`<div class="gaps">${t.profileId && d`<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: t, isReadOnly: e, setQuestion: i, setIsViewingResult: o, textAreaRef: s, question: n, errorMessage: r, setErrorMessage: p, promptValidationMessage: c, setPromptValidationMessage: a, submitQuestion: h, messages:
|
|
188
|
+
function Me({ isDisabled: t, isReadOnly: e, setQuestion: i, setIsViewingResult: o, textAreaRef: s, question: n, errorMessage: r, setErrorMessage: p, promptValidationMessage: c, setPromptValidationMessage: a, submitQuestion: h, messages: l, mode: y, assistantRef: q, context: w, contextReducedNoticeDismissed: T, setContextReducedNoticeDismissed: I }) {
|
|
189
189
|
const b = w?.contextTooLarge ?? !1, g = Ce({
|
|
190
190
|
promptValidationMessage: c,
|
|
191
191
|
errorMessage: r,
|
|
@@ -193,92 +193,92 @@ function Me({ isDisabled: t, isReadOnly: e, setQuestion: i, setIsViewingResult:
|
|
|
193
193
|
contextReducedNoticeDismissed: T,
|
|
194
194
|
setContextReducedNoticeDismissed: I,
|
|
195
195
|
setErrorMessage: p,
|
|
196
|
-
messages:
|
|
196
|
+
messages: l
|
|
197
197
|
});
|
|
198
|
-
return
|
|
198
|
+
return d`<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=${l.askaquestion ?? `Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${n} @calciteTextAreaInput=${($) => {
|
|
199
199
|
Se($.target), i($.target.value);
|
|
200
|
-
}} ${oe(s)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${w &&
|
|
200
|
+
}} ${oe(s)}><div class="submission-actions-wrapper" slot=footer-start><div class="submission-actions">${w && Ee({ context: w, 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=${t} @click=${async () => {
|
|
201
201
|
o(!1), i("");
|
|
202
|
-
}} .label=${
|
|
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=${t} @click=${async () => {
|
|
203
203
|
o(!1), i("");
|
|
204
|
-
}} class="hidden-below-380" scale=s>${
|
|
204
|
+
}} class="hidden-below-380" scale=s>${l.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(""), !n) {
|
|
206
|
-
a(
|
|
206
|
+
a(l.enteraprompt ?? "Please enter a prompt");
|
|
207
207
|
return;
|
|
208
208
|
}
|
|
209
209
|
a(void 0), await h();
|
|
210
|
-
}} class="hidden-below-380">${y === "prompt" ?
|
|
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=${t} .disabled=${t} id=small-submit-button @click=${async () => {
|
|
211
211
|
if (p(""), !n) {
|
|
212
|
-
a(
|
|
212
|
+
a(l.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" ?
|
|
216
|
+
}} class="hidden-above-380" .label=${y === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}></calcite-button><calcite-tooltip reference-element=small-submit-button placement=top-start class="hidden-above-380">${y === "prompt" ? l.ask ?? "Generate" : l.refine ?? "Refine"}</calcite-tooltip></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
219
|
function qe({ setOpen: t, messages: e, feedback: i, learnMoreUrl: o, setFeedback: s, onSubmit: n }) {
|
|
220
|
-
return i.active ?
|
|
220
|
+
return i.active ? d`<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) => s({ ...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
221
|
s({ ...i, termsAccepted: r.target.checked });
|
|
222
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=${n} .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
224
|
function O({ assistantsEnabled: t, messages: e, slot: i, helpTopicUrl: o }) {
|
|
225
|
-
return
|
|
225
|
+
return d`<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 ? d`<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>` : d`<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
227
|
function Fe({ messages: t, onProceed: e, onExit: i, helpTopicUrl: o }) {
|
|
228
|
-
return
|
|
228
|
+
return d`<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
230
|
function De({ messages: t, suggestions: e, onSuggestionClick: i }) {
|
|
231
|
-
return
|
|
231
|
+
return d`<calcite-block .heading=${t.promptsuggestions} expanded collapsible id=suggestion-block scale=s><div class="suggestions">${e.map((o) => d`<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
234
|
function L({ hidden: t = !1, expanded: e = !1, messages: i, cards: o, heading: s, collapsible: n = !1, showEffectsIcon: r = !1, onCopyCode: p, standalone: c }) {
|
|
235
|
-
return
|
|
236
|
-
const
|
|
235
|
+
return d`<calcite-block .hidden=${t} id=result-block .heading=${s ?? i.besteffort ?? "Here is the assistant's best effort"} .expanded=${e} .collapsible=${n}>${r && d`<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) => d`<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;
|
|
237
237
|
navigator.clipboard.writeText(a.priorPrompt).then(() => {
|
|
238
|
-
|
|
238
|
+
l.setAttribute("data-copied", "true"), setTimeout(() => l.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=${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 &&
|
|
241
|
-
const
|
|
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 && d`<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 && d`<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 l = h.currentTarget;
|
|
242
242
|
p(a.code).then(() => {
|
|
243
|
-
|
|
243
|
+
l.setAttribute("data-copied", "true"), setTimeout(() => l.removeAttribute("data-copied"), 1500);
|
|
244
244
|
});
|
|
245
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
247
|
const Ne = ({ card: t, messages: e }) => {
|
|
248
248
|
const i = le(), o = `response-chip-profile-${t.conversationId}-${i}`, s = (e.profilecontextlabel ?? "Profile context: {profileId}").replace("{profileId}", t.profileId);
|
|
249
|
-
return
|
|
250
|
-
}, B = (t) => t.type === "featureSet",
|
|
249
|
+
return d`<calcite-tooltip .referenceElement=${o} placement=top-start class="contained-popover-or-tooltip">${s}</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", R = (t) => {
|
|
251
251
|
if (!be(t))
|
|
252
252
|
return [];
|
|
253
253
|
const e = [];
|
|
254
254
|
return t.relationships?.forEach((i) => {
|
|
255
255
|
e.push(i.toJSON());
|
|
256
256
|
}), e;
|
|
257
|
-
},
|
|
257
|
+
}, E = (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
262
|
})), M = (t) => t ? { fields: _e(t) } : { fields: [] };
|
|
263
263
|
async function j(t) {
|
|
264
|
-
const e = await t.loadSource(), i = Y(e) && e.isTable, o =
|
|
264
|
+
const e = await t.loadSource(), i = Y(e) && e.isTable, o = R(e);
|
|
265
265
|
return {
|
|
266
266
|
name: t.name,
|
|
267
267
|
type: "featureSet",
|
|
268
268
|
isTable: i,
|
|
269
269
|
...M(e?.fields),
|
|
270
|
-
...
|
|
270
|
+
...E(o)
|
|
271
271
|
};
|
|
272
272
|
}
|
|
273
273
|
async function K(t) {
|
|
274
274
|
switch (t.type) {
|
|
275
275
|
case "feature": {
|
|
276
|
-
const e = await t.loadSource(), i =
|
|
276
|
+
const e = await t.loadSource(), i = R(e);
|
|
277
277
|
return {
|
|
278
278
|
name: t.name,
|
|
279
279
|
type: t.type,
|
|
280
280
|
...M(e?.fields),
|
|
281
|
-
...
|
|
281
|
+
...E(i)
|
|
282
282
|
};
|
|
283
283
|
}
|
|
284
284
|
case "featureSet": {
|
|
@@ -288,7 +288,7 @@ async function K(t) {
|
|
|
288
288
|
type: "featureSet",
|
|
289
289
|
...i ? { isTable: i } : {},
|
|
290
290
|
...M(e?.fields),
|
|
291
|
-
...R(
|
|
291
|
+
...E(R(e))
|
|
292
292
|
};
|
|
293
293
|
}
|
|
294
294
|
case "featureSetCollection": {
|
|
@@ -539,8 +539,8 @@ class Ke extends ie {
|
|
|
539
539
|
};
|
|
540
540
|
try {
|
|
541
541
|
await e.applyEdits({ addFeatures: [new ue({ attributes: h })] });
|
|
542
|
-
} catch (
|
|
543
|
-
x("error", this, "Error submitting feedback.", { detail: { error:
|
|
542
|
+
} catch (l) {
|
|
543
|
+
x("error", this, "Error submitting feedback.", { detail: { error: l } });
|
|
544
544
|
}
|
|
545
545
|
this.handleFeedbackSheetClose();
|
|
546
546
|
}, this.handleClose = (e) => {
|
|
@@ -650,7 +650,7 @@ class Ke extends ie {
|
|
|
650
650
|
this.updateViewState({ isSubmitting: !0, errorMessage: void 0 });
|
|
651
651
|
try {
|
|
652
652
|
const e = await this.getToken(), i = this.getModel();
|
|
653
|
-
if (!i)
|
|
653
|
+
if (!i || !this.serviceUrl)
|
|
654
654
|
return;
|
|
655
655
|
const o = this.viewState.context ?? await this.getProfileAndMetadata(i.uri), n = (await we({
|
|
656
656
|
baseUrl: this.serviceUrl,
|
|
@@ -724,9 +724,9 @@ ${e}` : "";
|
|
|
724
724
|
if (this.closed)
|
|
725
725
|
return null;
|
|
726
726
|
const e = this.viewState.viewMode === "result", i = this.getHistoryCards();
|
|
727
|
-
return this.assistantsEnabled ?
|
|
727
|
+
return this.assistantsEnabled ? d`<calcite-flow><calcite-flow-item closable heading-level=2 .heading=${this.messages.arcadeassistant ?? "Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${this.viewState.splashActive && d`<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: () => {
|
|
728
728
|
this.updateViewState({ splashActive: !1 });
|
|
729
|
-
}, helpTopicUrl: this.assistantOverviewDocUrl, onExit: (o) => this.closePanel?.(o) }) || ""}${
|
|
729
|
+
}, 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=${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({
|
|
730
730
|
expanded: e,
|
|
731
731
|
messages: this.messages,
|
|
732
732
|
collapsible: !0,
|
|
@@ -751,7 +751,7 @@ ${e}` : "";
|
|
|
751
751
|
heading: this.messages.recentprompts ?? "Recent prompts",
|
|
752
752
|
hidden: this.viewState.isSubmitting || this.viewState.history.length === 0,
|
|
753
753
|
onCopyCode: this.onCopyCode.bind(this)
|
|
754
|
-
})}</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>` :
|
|
754
|
+
})}</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>` : d`<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>`;
|
|
755
755
|
}
|
|
756
756
|
}
|
|
757
757
|
Z("arcgis-arcade-coding-assistant", Ke);
|
|
@@ -31,7 +31,11 @@ import type { T9nMeta } from "@arcgis/lumina/controllers";
|
|
|
31
31
|
* - Support for many [languages and directionality](https://developers.arcgis.com/javascript/latest/localization/)
|
|
32
32
|
*/
|
|
33
33
|
export abstract class ArcgisArcadeEditor<T extends WithCustomPanels = object> extends LitElement {
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* enables and configures the arcade assistant
|
|
36
|
+
*
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
35
39
|
accessor arcadeAssistant: ArcadeAssistantConfig | undefined;
|
|
36
40
|
/**
|
|
37
41
|
* Custom panels to be displayed in the side panel.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
|
|
2
|
-
import { g as
|
|
3
|
-
import { css as
|
|
4
|
-
import { KeyCode as
|
|
2
|
+
import { g as I, c as D } from "../../chunks/runtime.js";
|
|
3
|
+
import { css as C, html as s, nothing as b } from "lit";
|
|
4
|
+
import { KeyCode as B } from "monaco-editor";
|
|
5
5
|
import "monaco-editor/esm/vs/editor/standalone/browser/standaloneServices.js";
|
|
6
6
|
import "monaco-editor/esm/vs/editor/standalone/common/standaloneTheme.js";
|
|
7
7
|
import "monaco-editor/esm/vs/platform/hover/browser/hover.js";
|
|
@@ -9,21 +9,21 @@ import "monaco-editor/esm/vs/editor/common/languages/supports/tokenization.js";
|
|
|
9
9
|
import "monaco-editor/esm/vs/base/browser/dom.js";
|
|
10
10
|
import "monaco-editor/esm/vs/editor/browser/editorDom.js";
|
|
11
11
|
import "monaco-editor/esm/vs/editor/browser/controller/mouseTarget.js";
|
|
12
|
-
import { LitElement as
|
|
13
|
-
import { generateGuid as
|
|
14
|
-
import { D as
|
|
15
|
-
import { s as
|
|
12
|
+
import { LitElement as k, createEvent as v, safeClassMap as l } from "@arcgis/lumina";
|
|
13
|
+
import { generateGuid as M } from "@arcgis/toolkit/string";
|
|
14
|
+
import { D as T, e as x } from "../../chunks/arcade-executor.js";
|
|
15
|
+
import { s as U, g as L } from "../../chunks/arcade-service-accessors.js";
|
|
16
16
|
import { b as c } from "../../chunks/arcade-defaults.js";
|
|
17
|
-
import { u as
|
|
18
|
-
import { createRef as
|
|
19
|
-
import
|
|
20
|
-
import { log as
|
|
21
|
-
const
|
|
17
|
+
import { u as F } from "../../chunks/useT9n.js";
|
|
18
|
+
import { createRef as N, ref as H } from "lit/directives/ref.js";
|
|
19
|
+
import R from "@arcgis/core/identity/IdentityManager.js";
|
|
20
|
+
import { log as O, rethrowError as o } from "@arcgis/toolkit/log";
|
|
21
|
+
const j = C`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}.main-action-bar{calcite-action-group{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action{padding-inline-end:var(--calcite-spacing-sm)}calcite-action-group calcite-action:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}calcite-action-group:last-child{border-inline-end-width:0px}calcite-action-group:not(:first-child){padding-inline-start:var(--calcite-spacing-sm)}}`, E = "https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0", a = (i, e) => O(i, "Arcade Assistant", e), z = (i) => {
|
|
22
22
|
const { aiAssistantsEnabled: e } = i;
|
|
23
23
|
return e === void 0 ? (a("warn", "`areAiAssistantsEnabled` is not defined in the organizations settings."), !1) : e;
|
|
24
|
-
}, V = (i) => !(!i || !("id" in i)), G = async (i) => (await
|
|
24
|
+
}, V = (i) => !(!i || !("id" in i)), G = async (i) => (await R.getCredential(i, { oAuthPopupConfirmation: !1 })).token, q = async (i) => {
|
|
25
25
|
try {
|
|
26
|
-
return !!await
|
|
26
|
+
return !!await R.checkSignInStatus(i);
|
|
27
27
|
} catch {
|
|
28
28
|
return a("warn", "User is not signed in."), !1;
|
|
29
29
|
}
|
|
@@ -37,42 +37,46 @@ async function X({
|
|
|
37
37
|
const t = i.replace(/\/sharing\/rest(\/.*)?$/iu, "").replace(/\/$/u, "");
|
|
38
38
|
if (!await q(t))
|
|
39
39
|
return { shouldRender: !1 };
|
|
40
|
-
const n = await G(i), h = `${t}/sharing/rest/portals/self?f=json&token=${n}`, p = `${t}/sharing/rest/portals/self/settings?f=json&token=${n}`, u = `${t}/sharing/rest/portals/self/signinSettings?f=json&token=${n}`,
|
|
40
|
+
const n = await G(i), h = `${t}/sharing/rest/portals/self?f=json&token=${n}`, p = `${t}/sharing/rest/portals/self/settings?f=json&token=${n}`, u = `${t}/sharing/rest/portals/self/signinSettings?f=json&token=${n}`, w = await Promise.allSettled([
|
|
41
41
|
fetch(h, { credentials: "include" }).then((r) => r.json()),
|
|
42
42
|
fetch(p, { credentials: "include" }).then((r) => r.json()),
|
|
43
43
|
fetch(u, { credentials: "include" }).then((r) => r.json())
|
|
44
|
-
]), [g, f, _] =
|
|
45
|
-
if (!$)
|
|
46
|
-
return a("warn", "Service URL is not available in the portal self response."), { shouldRender: !1 };
|
|
47
|
-
const w = m.helpBase || "";
|
|
44
|
+
]), [g, f, _] = w, m = g.status === "fulfilled" ? g.value : (a("warn", `Failed to fetch selfUrl. Reason: ${g.reason}.`), {}), S = f.status === "fulfilled" ? f.value : (a("warn", `Failed to fetch settingsUrl. Reason: ${f.reason}.`), {}), y = _.status === "fulfilled" ? _.value : (a("warn", `Failed to fetch signinSettingsUrl. Reason: ${_.reason}.`), {}), $ = m.helpBase || "";
|
|
48
45
|
if (!S)
|
|
49
46
|
return a("warn", "Settings response is not available."), { shouldRender: !1 };
|
|
50
47
|
let A = z(S);
|
|
51
|
-
|
|
48
|
+
y.blockBetaApps === !0 && (a(
|
|
52
49
|
"warn",
|
|
53
50
|
"Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."
|
|
54
|
-
), A = !1), m?.user?.privileges?.includes("portal:user:useAIAssistants") || (a("warn", "User does not have the required privileges to use AI Assistants."), A = !1)
|
|
51
|
+
), A = !1), m?.user?.privileges?.includes("portal:user:useAIAssistants") || (a("warn", "User does not have the required privileges to use AI Assistants."), A = !1);
|
|
52
|
+
const P = m?.helperServices?.aiAssistantServices?.url;
|
|
53
|
+
return P ? {
|
|
55
54
|
shouldRender: !0,
|
|
56
|
-
serviceUrl:
|
|
57
|
-
helpBase:
|
|
55
|
+
serviceUrl: P,
|
|
56
|
+
helpBase: $,
|
|
58
57
|
assistantsEnabled: A,
|
|
59
|
-
feedbackServiceUrl:
|
|
58
|
+
feedbackServiceUrl: E
|
|
59
|
+
} : {
|
|
60
|
+
shouldRender: !0,
|
|
61
|
+
assistantsEnabled: !1,
|
|
62
|
+
helpBase: $,
|
|
63
|
+
feedbackServiceUrl: E
|
|
60
64
|
};
|
|
61
65
|
}
|
|
62
|
-
class K extends
|
|
66
|
+
class K extends k {
|
|
63
67
|
constructor() {
|
|
64
|
-
super(...arguments), this._codeEditorElt =
|
|
68
|
+
super(...arguments), this._codeEditorElt = N(), this._componentReadyDefer = Promise.withResolvers(), this._disposables = [], this._editorProfilePromise = Promise.resolve(void 0), this.messages = F(), this._modelId = M(), this._openArcadeHelp = () => void window.open(T, "Arcade Help"), this._toggleSidePanel = (e) => {
|
|
65
69
|
if (!e.target)
|
|
66
70
|
return;
|
|
67
71
|
const t = e.target?.dataset.panelName ?? "none";
|
|
68
72
|
this.openedSidePanel = t === this.openedSidePanel ? "none" : t, this.openedSidePanel === "none" && this._codeEditorElt.value?.setFocus().catch(o(this));
|
|
69
|
-
}, this._consoleLogs = [], this._executingScript = !1, this._preparingArcade = !1, this._resultPanel = "output", this._showExecutionPanel = !1, this._arcadeAssistantRemoteState = { shouldRender: !1 }, this.hideDocumentationActions = !1, this.hideSideBar = !1, this.openedSidePanel = "none", this.script = "", this.sideActionBarExpanded = !1, this.arcgisDiagnosticsChange =
|
|
73
|
+
}, this._consoleLogs = [], this._executingScript = !1, this._preparingArcade = !1, this._resultPanel = "output", this._showExecutionPanel = !1, this._arcadeAssistantRemoteState = { shouldRender: !1 }, this.hideDocumentationActions = !1, this.hideSideBar = !1, this.openedSidePanel = "none", this.script = "", this.sideActionBarExpanded = !1, this.arcgisDiagnosticsChange = v({ bubbles: !1 }), this.arcgisScriptChange = v({ bubbles: !1 });
|
|
70
74
|
}
|
|
71
75
|
static {
|
|
72
76
|
this.properties = { _apiLibrary: 16, _consoleLogs: 16, _editorProfile: 16, _executingScript: 16, _executionResult: 16, _preparingArcade: 16, _resultPanel: 16, _showExecutionPanel: 16, _arcadeAssistantRemoteState: 16, editorInstance: 32, editorOptions: 0, hideDocumentationActions: 5, hideSideBar: 5, openedSidePanel: 3, profile: 0, script: 1, sideActionBarExpanded: 7, snippets: 0, suggestions: 0, testData: 0, customPanels: 0, arcadeAssistant: 0 };
|
|
73
77
|
}
|
|
74
78
|
static {
|
|
75
|
-
this.styles = [
|
|
79
|
+
this.styles = [j];
|
|
76
80
|
}
|
|
77
81
|
get editorInstance() {
|
|
78
82
|
return this._codeEditorElt.value?.editorInstance;
|
|
@@ -85,14 +89,14 @@ class K extends B {
|
|
|
85
89
|
return { type: "error", value: "Missing editor profile", error: null };
|
|
86
90
|
await this._componentReadyDefer.promise;
|
|
87
91
|
const t = this._codeEditorElt.value?.value;
|
|
88
|
-
return await
|
|
92
|
+
return await x(e.definition, t, this.testData);
|
|
89
93
|
}
|
|
90
94
|
async setFocus() {
|
|
91
95
|
await this._componentReadyDefer.promise, await this._codeEditorElt.value?.setFocus();
|
|
92
96
|
}
|
|
93
97
|
async load() {
|
|
94
|
-
const e =
|
|
95
|
-
|
|
98
|
+
const e = I("./assets");
|
|
99
|
+
U(e), await this._updateDataModelDeps(), await this._updateArcadeAssistantRemoteState();
|
|
96
100
|
}
|
|
97
101
|
willUpdate(e) {
|
|
98
102
|
(e.has("messages") || e.has("profile")) && this.hasUpdated && this._updateDataModelDeps(), e.has("testData") && this._testDataChanged(), e.has("snippets") && c.updateApiContextForModel(this._modelId, {
|
|
@@ -141,7 +145,7 @@ class K extends B {
|
|
|
141
145
|
}
|
|
142
146
|
this._showExecutionPanel = !0, this._executingScript = !0, this._consoleLogs = [], setTimeout(() => void (async () => {
|
|
143
147
|
const d = this._codeEditorElt.value?.value;
|
|
144
|
-
this._executionResult = await
|
|
148
|
+
this._executionResult = await x(t.definition, d, e, (n) => setTimeout(() => this._consoleLogs = [...this._consoleLogs, n], 0)), this._executingScript = !1;
|
|
145
149
|
})(), 0);
|
|
146
150
|
}
|
|
147
151
|
_toggleShowExecutionPanel() {
|
|
@@ -174,7 +178,7 @@ class K extends B {
|
|
|
174
178
|
// An unique identifier for the action.
|
|
175
179
|
id: "run-script",
|
|
176
180
|
label: "Run Arcade Expression",
|
|
177
|
-
keybindings: [
|
|
181
|
+
keybindings: [B.F5],
|
|
178
182
|
contextMenuGroupId: "code",
|
|
179
183
|
contextMenuOrder: 1,
|
|
180
184
|
run: () => {
|
|
@@ -197,10 +201,10 @@ class K extends B {
|
|
|
197
201
|
return this.testData ? s`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-disabled slot=top-action-bar><calcite-action-group scale=s><calcite-action .text=${this.messages.run ?? ""} text-enabled icon=play scale=s .loading=${this._preparingArcade} @click=${() => void this._executeScript().catch(o(this))}></calcite-action>${this._executionResult ? s`<calcite-action .text=${this.messages.lastresults ?? ""} .active=${this._showExecutionPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>` : null}</calcite-action-group></calcite-action-bar>` : null;
|
|
198
202
|
}
|
|
199
203
|
renderMainPanel() {
|
|
200
|
-
return s`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${c.languageId} .value=${this.script ?? ""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${
|
|
204
|
+
return s`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${c.languageId} .value=${this.script ?? ""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${H(this._codeEditorElt)}></arcgis-code-editor>`;
|
|
201
205
|
}
|
|
202
206
|
renderAction({ id: e, label: t, icon: d, active: n, panelName: h, iconFlipRtl: p = !1, onClick: u = this._toggleSidePanel }) {
|
|
203
|
-
return s`<calcite-action id=${e ??
|
|
207
|
+
return s`<calcite-action id=${e ?? b} .text=${t} .textEnabled=${this.sideActionBarExpanded} .icon=${d} .active=${n} @click=${u} data-panel-name=${h ?? b} .iconFlipRtl=${p}></calcite-action>${!this.sideActionBarExpanded && s`<calcite-tooltip .referenceElement=${e}><span>${t}</span></calcite-tooltip>` || ""}`;
|
|
204
208
|
}
|
|
205
209
|
renderSideActionBar() {
|
|
206
210
|
return this.hideSideBar ? null : s`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({
|
|
@@ -247,7 +251,7 @@ class K extends B {
|
|
|
247
251
|
if (this.hideSideBar)
|
|
248
252
|
return null;
|
|
249
253
|
const { openedSidePanel: e } = this;
|
|
250
|
-
return s`<arcgis-language-api-panel slot=side-panel class=${l(e === "api" ? "" : "hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .closed=${e !== "api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${l(e === "variables" ? "" : "hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e !== "variables"}></arcgis-editor-variables>${this.suggestions?.length && s`<arcgis-arcade-suggestions slot=side-panel class=${l(e === "suggestions" ? "" : "hidden")} .closed=${e !== "suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none></arcgis-arcade-suggestions>` || ""}${this.arcadeAssistant && this._arcadeAssistantRemoteState.shouldRender && s`<arcgis-arcade-coding-assistant slot=side-panel class=${l(e === "arcade-assistant" ? "" : "hidden")} .closed=${e !== "arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._toggleSidePanel} .portalUrl=${this.arcadeAssistant.portalUrl} .serviceUrl=${this._arcadeAssistantRemoteState.serviceUrl} .helpBase=${this._arcadeAssistantRemoteState.helpBase} .assistantsEnabled=${this._arcadeAssistantRemoteState.assistantsEnabled} .feedbackServiceUrl=${this._arcadeAssistantRemoteState.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant.appVersion}></arcgis-arcade-coding-assistant>` || ""}${this.customPanels?.map((t) => s`<calcite-flow slot=side-panel class=${l(e === t.id ? "" : "hidden")}>${t?.useFlows ? t.renderer?.({
|
|
254
|
+
return s`<arcgis-language-api-panel slot=side-panel class=${l(e === "api" ? "" : "hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .closed=${e !== "api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${l(e === "variables" ? "" : "hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e !== "variables"}></arcgis-editor-variables>${this.suggestions?.length && s`<arcgis-arcade-suggestions slot=side-panel class=${l(e === "suggestions" ? "" : "hidden")} .closed=${e !== "suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._toggleSidePanel} data-panel-name=none></arcgis-arcade-suggestions>` || ""}${this.arcadeAssistant && this._arcadeAssistantRemoteState.shouldRender && s`<arcgis-arcade-coding-assistant slot=side-panel class=${l(e === "arcade-assistant" ? "" : "hidden")} .closed=${e !== "arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._toggleSidePanel} .portalUrl=${this.arcadeAssistant.portalUrl} .serviceUrl=${"serviceUrl" in this._arcadeAssistantRemoteState ? this._arcadeAssistantRemoteState.serviceUrl : void 0} .helpBase=${this._arcadeAssistantRemoteState.helpBase} .assistantsEnabled=${this._arcadeAssistantRemoteState.assistantsEnabled} .feedbackServiceUrl=${this._arcadeAssistantRemoteState.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant.appVersion}></arcgis-arcade-coding-assistant>` || ""}${this.customPanels?.map((t) => s`<calcite-flow slot=side-panel class=${l(e === t.id ? "" : "hidden")}>${t?.useFlows ? t.renderer?.({
|
|
251
255
|
closePanel: this._toggleSidePanel,
|
|
252
256
|
insertText: this._insertText.bind(this),
|
|
253
257
|
closed: e !== t.id,
|
|
@@ -268,7 +272,7 @@ class K extends B {
|
|
|
268
272
|
return s`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`;
|
|
269
273
|
}
|
|
270
274
|
}
|
|
271
|
-
|
|
275
|
+
D("arcgis-arcade-editor", K);
|
|
272
276
|
export {
|
|
273
277
|
K as ArcgisArcadeEditor
|
|
274
278
|
};
|