@arcgis/coding-components 4.34.0-next.4 → 4.34.0-next.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/addons.js +1 -1
- package/dist/cdn/{5W5U53FB.js → 2YGBBKC6.js} +2 -2
- package/dist/cdn/{Q3JWFB47.js → 3P4SHQ4F.js} +2 -2
- package/dist/cdn/{RTPQ63T7.js → 4OWQEOVK.js} +2 -2
- package/dist/cdn/{LWATQ4SL.js → AADZGDTT.js} +2 -2
- package/dist/cdn/{L4H7IVWJ.js → AJO5MR2D.js} +2 -2
- package/dist/cdn/{UEPVWCWQ.js → CKQRKFCV.js} +1 -1
- package/dist/cdn/{ZB3QMM6Z.js → D7NHVE3F.js} +2 -2
- package/dist/cdn/{RGJGHR4B.js → DPJHX5QN.js} +2 -2
- package/dist/cdn/{LP5TBEVL.js → F3QQPAID.js} +1 -1
- package/dist/cdn/{7GKZUSUT.js → FL32SFRF.js} +2 -2
- package/dist/cdn/{BS7L4PFY.js → FLTEBLV3.js} +2 -2
- package/dist/cdn/{DC6AP4ZI.js → G7G2I77O.js} +4 -4
- package/dist/cdn/{O3SBRZL6.js → GYNWYL57.js} +2 -2
- package/dist/cdn/{POHSJQCF.js → H3SZYPLP.js} +2 -2
- package/dist/cdn/{PJX2MXZB.js → HEXUEJHB.js} +2 -2
- package/dist/cdn/{UHHP3BIV.js → HI5IRVPS.js} +2 -2
- package/dist/cdn/{ARM44GXS.js → IRHKOOPR.js} +2 -2
- package/dist/cdn/{54OCYIGS.js → ISHOFB3V.js} +1 -1
- package/dist/cdn/L4THRZDH.js +4 -0
- package/dist/cdn/{FYYRTZD6.js → LAJHA3QM.js} +2 -2
- package/dist/cdn/{E2QHGSDM.js → MJC4S5GE.js} +2 -2
- package/dist/cdn/{UKTZ6PS3.js → MLALS3HH.js} +2 -2
- package/dist/cdn/{N5CO2N5G.js → MNVZNW5A.js} +2 -2
- package/dist/cdn/{THSDKZAV.js → MSBFP3SG.js} +2 -2
- package/dist/cdn/{CX635E4R.js → P67HCZK6.js} +2 -2
- package/dist/cdn/{RJ5463RF.js → PLYBUKIY.js} +2 -2
- package/dist/cdn/{JETLFAWJ.js → PNXRGAXI.js} +2 -2
- package/dist/cdn/{OKNQSCLO.js → PPRDT36L.js} +2 -2
- package/dist/cdn/{RQ23YX4Y.js → PRSLFNKW.js} +2 -2
- package/dist/cdn/{JQOKZ66I.js → PXUWLZZA.js} +2 -2
- package/dist/cdn/{O74DGU7J.js → Q7IQOYZI.js} +1 -1
- package/dist/cdn/{WBN37U56.js → TA7H3XCV.js} +2 -2
- package/dist/cdn/{Z6JHW4EV.js → TBNI35J4.js} +2 -2
- package/dist/cdn/{FZSEXKIS.js → TP6M53SH.js} +2 -2
- package/dist/cdn/{EQJHFXEJ.js → U2FESHVZ.js} +2 -2
- package/dist/cdn/{APTPPRWK.js → V3ZGRUMF.js} +2 -2
- package/dist/cdn/{XFA77AWY.js → VDOOZTDB.js} +2 -2
- package/dist/cdn/{N2KHVO5S.js → VPMWJICM.js} +2 -2
- package/dist/cdn/{XJLYTCL5.js → XU6CB7N4.js} +1 -1
- package/dist/cdn/{GGHNFJSP.js → YUQSUNTL.js} +2 -2
- package/dist/cdn/index.js +2 -2
- package/dist/chunks/arcade-defaults.js +1 -1
- package/dist/chunks/arcade-executor.js +1 -1
- package/dist/chunks/arcade-mode.js +1 -1
- package/dist/chunks/arcade-service-accessors.js +1 -1
- package/dist/chunks/editor.js +1 -1
- package/dist/chunks/fields.js +1 -1
- package/dist/chunks/language-defaults-base.js +1 -1
- package/dist/chunks/markdown.js +1 -1
- package/dist/chunks/monaco-importer.js +1 -1
- package/dist/chunks/runtime.js +1 -1
- package/dist/chunks/setup-monaco.js +1 -1
- package/dist/chunks/sql-expr-contribution.js +1 -1
- package/dist/chunks/sql-expr-defaults.js +1 -1
- package/dist/chunks/sql-expr-mode.js +1 -1
- package/dist/chunks/useT9n.js +1 -1
- package/dist/components/arcgis-arcade-coding-assistant/customElement.js +129 -131
- package/dist/components/arcgis-arcade-coding-assistant/functional.d.ts +7 -2
- package/dist/components/arcgis-arcade-coding-assistant/index.d.ts +4 -2
- package/dist/components/arcgis-arcade-coding-assistant/index.js +4 -2
- package/dist/components/arcgis-arcade-editor/customElement.js +1 -1
- package/dist/components/arcgis-arcade-results/customElement.js +1 -1
- package/dist/components/arcgis-arcade-suggestions/customElement.js +1 -1
- package/dist/components/arcgis-code-editor/customElement.js +1 -1
- package/dist/components/arcgis-editor-variables/customElement.js +1 -1
- package/dist/components/arcgis-language-api-panel/customElement.js +1 -1
- package/dist/components/arcgis-sql-expression-editor/customElement.js +1 -1
- package/dist/components/arcgis-sql-expression-fields/customElement.js +1 -1
- package/dist/docs/api.json +2 -2
- package/dist/docs/docs.json +2 -2
- package/dist/docs/web-types.json +1 -1
- package/dist/index.js +1 -1
- package/dist/loader.js +1 -1
- package/package.json +5 -5
- package/dist/cdn/B5WKU3A7.js +0 -5
|
@@ -7,7 +7,7 @@ import { u as f } from "../../chunks/useT9n.js";
|
|
|
7
7
|
import { css as u } from "@lit/reactive-element/css-tag.js";
|
|
8
8
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
9
9
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
10
|
-
v4.34.0-next.
|
|
10
|
+
v4.34.0-next.5 */
|
|
11
11
|
const m = u`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-list-item-group{background-color:var(--calcite-color-foreground-2);word-break:break-word}}`;
|
|
12
12
|
function g(l) {
|
|
13
13
|
l.key === "Enter" && l.stopPropagation();
|
|
@@ -10,7 +10,7 @@ import { css as v } from "@lit/reactive-element/css-tag.js";
|
|
|
10
10
|
import { s as d } from "../../chunks/sql-expr-contribution.js";
|
|
11
11
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
12
12
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
13
|
-
v4.34.0-next.
|
|
13
|
+
v4.34.0-next.5 */
|
|
14
14
|
const y = v`:host{background-color:var(--calcite-color-foreground-1);.notice-container{margin:var(--calcite-spacing-xxs);padding:var(--calcite-spacing-sm);background-color:var(--calcite-color-foreground-1)}.sticky{position:sticky;top:0;z-index:10}calcite-flow{height:100%}calcite-block{p:first-of-type{margin-top:0}code{font-family:var(--calcite-code-family)}pre{direction:ltr;overflow-x:auto;background-color:var(--calcite-color-foreground-2);padding:var(--calcite-spacing-sm);code{font-size:var(--calcite-font-size--2)}}}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}}`;
|
|
15
15
|
class I extends f {
|
|
16
16
|
constructor() {
|
|
@@ -9,7 +9,7 @@ import { css as g } from "@lit/reactive-element/css-tag.js";
|
|
|
9
9
|
import { s as f } from "../../chunks/editor.js";
|
|
10
10
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
11
11
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
12
|
-
v4.34.0-next.
|
|
12
|
+
v4.34.0-next.5 */
|
|
13
13
|
const _ = g`@layer{arcgis-sql-expression-editor{display:flex;flex-direction:column;position:relative;overflow:hidden;border:var(--arcgis-coding-components-border)!important;box-sizing:border-box;background-color:var(--arcgis-coding-components-background-color);height:100%}}`;
|
|
14
14
|
class m extends r {
|
|
15
15
|
constructor() {
|
|
@@ -7,7 +7,7 @@ import { u as m } from "../../chunks/useT9n.js";
|
|
|
7
7
|
import { css as d } from "@lit/reactive-element/css-tag.js";
|
|
8
8
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
9
9
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
10
|
-
v4.34.0-next.
|
|
10
|
+
v4.34.0-next.5 */
|
|
11
11
|
const h = d`:host{calcite-flow{height:100%}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}}`;
|
|
12
12
|
class f extends r {
|
|
13
13
|
constructor() {
|
package/dist/docs/api.json
CHANGED
package/dist/docs/docs.json
CHANGED
package/dist/docs/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@arcgis/coding-components",
|
|
4
|
-
"version": "4.34.0-next.
|
|
4
|
+
"version": "4.34.0-next.5",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { a as c } from "./chunks/arcade-defaults.js";
|
|
|
3
3
|
import { s as p } from "./chunks/sql-expr-defaults.js";
|
|
4
4
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
5
5
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
6
|
-
v4.34.0-next.
|
|
6
|
+
v4.34.0-next.5 */
|
|
7
7
|
const a = s, r = t;
|
|
8
8
|
export {
|
|
9
9
|
c as arcade,
|
package/dist/loader.js
CHANGED
|
@@ -2,7 +2,7 @@ import { r as e } from "./chunks/runtime.js";
|
|
|
2
2
|
import { makeDefineCustomElements as i } from "@arcgis/lumina";
|
|
3
3
|
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
4
4
|
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
5
|
-
v4.34.0-next.
|
|
5
|
+
v4.34.0-next.5 */
|
|
6
6
|
const o = i(e, {
|
|
7
7
|
"arcgis-arcade-coding-assistant": [() => import("./components/arcgis-arcade-coding-assistant/customElement.js"), "appVersion,assistantsEnabled,closed,closePanel:,editorRef:,feedbackServiceUrl,insertText:,layer,orgBaseUrl,serviceUrl;destroy"],
|
|
8
8
|
"arcgis-arcade-editor": [() => import("./components/arcgis-arcade-editor/customElement.js"), "customPanels:,editorInstance:,editorOptions:,hideDocumentationActions,hideSideBar,openedSidePanel:,profile:,script,sideActionBarExpanded,snippets:,suggestions:,testData:;getEditorInstance,getScript,getTestResult,setFocus"],
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@arcgis/coding-components",
|
|
3
|
-
"version": "4.34.0-next.
|
|
3
|
+
"version": "4.34.0-next.5",
|
|
4
4
|
"description": "Contains components for editing code in different languages. The currently supported languages are html, css, json, TypeScript, JavaScript, and Arcade.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ArcGIS",
|
|
@@ -39,10 +39,10 @@
|
|
|
39
39
|
],
|
|
40
40
|
"license": "SEE LICENSE IN LICENSE.md",
|
|
41
41
|
"dependencies": {
|
|
42
|
-
"@arcgis/arcade-languageservice": "4.34.0-next.
|
|
43
|
-
"@arcgis/components-utils": "4.34.0-next.
|
|
44
|
-
"@arcgis/languages-api-utils": "4.34.0-next.
|
|
45
|
-
"@arcgis/lumina": "4.34.0-next.
|
|
42
|
+
"@arcgis/arcade-languageservice": "4.34.0-next.5",
|
|
43
|
+
"@arcgis/components-utils": "4.34.0-next.5",
|
|
44
|
+
"@arcgis/languages-api-utils": "4.34.0-next.5",
|
|
45
|
+
"@arcgis/lumina": "4.34.0-next.5",
|
|
46
46
|
"monaco-editor": "^0.52.0",
|
|
47
47
|
"tslib": "^2.8.1",
|
|
48
48
|
"vscode-languageserver-types": "^3.17.5"
|
package/dist/cdn/B5WKU3A7.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
|
|
2
|
-
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
|
|
3
|
-
v4.34.0-next.4 */
|
|
4
|
-
import b from"./LWATQ4SL.js";import{a as P,b as N}from"./RQ23YX4Y.js";import{a as _}from"./ARM44GXS.js";import"./E2QHGSDM.js";import a from"./5W5U53FB.js";import"./O74DGU7J.js";import{i as x,j as w}from"./DC6AP4ZI.js";import"./N5CO2N5G.js";import{C as D,a as T,b as n,c as V,d as y,p as C,q as E,r as q,y as I,z as F}from"./7GKZUSUT.js";import"./54OCYIGS.js";import"./WBN37U56.js";import"./XJLYTCL5.js";export default $arcgis.t(([G,U,J,W,,O])=>{var k=class extends q{constructor(e){if(super(e),this.it=y,e.type!==C.CHILD)throw Error(this.constructor.directiveName+"() can only be used in child bindings")}render(e){if(e===y||e==null)return this._t=void 0,this.it=e;if(e===V)return e;if(typeof e!="string")throw Error(this.constructor.directiveName+"() called with a non-string value");if(e===this.it)return this._t;this.it=e;let t=[e];return t.raw=t,this._t={_$litType$:this.constructor.resultType,strings:t,values:[]}}};k.directiveName="unsafeHTML",k.resultType=1;var Q=E(k);var Y=T`:host(:not([closed])){flex:1 0 auto;border-inline-start:var(--arcgis-coding-components-border);box-sizing:border-box;max-width:var(--arcgis-coding-components-side-panel-max-w);width:var(--arcgis-coding-components-side-panel-w)}:host([closed]){display:none}.response-actions{display:flex;align-items:center;padding:.5rem;gap:.5rem}.response-actions>div{display:flex;gap:.5rem}.prompt-list calcite-list-item{margin-block-end:.5rem;border-radius:var(--calcite-corner-radius-round);--calcite-color-border-3: transparent;overflow:hidden}.feedback-content{padding:1rem;display:flex;flex-direction:column;gap:.75rem}.feedback-sheet{--calcite-sheet-height: auto;--calcite-sheet-max-height: auto;--calcite-sheet-min-height: auto}calcite-chip[slot=header-actions-end]{align-self:center;margin-inline-end:.5rem}calcite-list-item:focus calcite-button{position:relative;top:-2px}.prompt-list calcite-list-item:last-of-type{margin-block-end:0}calcite-list{--calcite-color-foreground-1: transparent;background-color:transparent}calcite-list-item{--calcite-color-foreground-1: white}calcite-flow-item calcite-shell{background:transparent}calcite-block{width:100%;max-width:100%;align-self:flex-end;background-color:transparent}calcite-sheet{--calcite-sheet-scrim-background: rgba(200, 200, 200, .5)}.type-suggestion{--calcite-color-foreground-1: var(--calcite-color-foreground-current);--calcite-color-text-3: var(--calcite-color-text-2);--calcite-icon-color: var(--calcite-color-brand)}.type-history{--calcite-icon-color: var(--calcite-color-text-2)}.type-response{--calcite-icon-color: var(--calcite-color-brand);--calcite-font-family: monospace}.block-response{align-self:flex-start;margin-block-end:4rem;border-block-end:0;--calcite-block-text-color: var(--calcite-color-brand)}calcite-list-item calcite-button{margin-inline-end:.25rem}.type-docs{--calcite-color-foreground-1: var(--calcite-color-foreground-3);--calcite-icon-color: var(--calcite-color-text-1)}.type-error{--calcite-icon-color: var(--calcite-color-status-danger);--calcite-font-family: monospace;border:1px solid var(--calcite-color-status-danger)}#thumbs-up{margin-inline-start:auto;--calcite-icon-color: var(--calcite-color-border-input)}#thumbs-down{--calcite-icon-color: var(--calcite-color-border-input)}calcite-flow-item calcite-shell calcite-notice{margin-block:1rem}.no-space-block,.no-space-block[open]{margin:0}calcite-block[open]:last-of-type{border-block-end:0}.text-area-wrapper{display:flex;flex-direction:column;background:#fff;border-radius:4px;margin:.75rem;width:calc(100% - 1.5rem);overflow:hidden;max-width:calc(100% - 1.5rem);--calcite-color-border-input: transparent;--calcite-text-area-divider-color: transparent;position:sticky;align-self:flex-end;box-shadow:var(--calcite-shadow-sm);flex:none}.text-area-wrapper calcite-button:last-of-type{margin-inline-start:auto;align-self:flex-end}calcite-text-area{height:auto;min-height:5.75rem;overflow:hidden;border-radius:4px 4px 0 0;--calcite-font-weight-normal: 500;font-weight:500;line-height:1.2}calcite-tooltip{--calcite-tooltip-z-index: 1000}.standalone-list{margin:1rem;width:calc(100% - 2rem)}.result-disclaimer{display:block;width:24rem;max-width:90%;margin:2rem auto .25rem;text-align:center;line-height:1.125rem;font-size:.875rem;font-style:italic}calcite-flow{height:100%}calcite-popover calcite-list{--calcite-list-background-color: transparent;--calcite-input-border-color: transparent}calcite-popover calcite-list calcite-filter{--calcite-spacing-sm: 0}.break-spaces{white-space:break-spaces}.feedback-button-container{margin-inline-start:auto;gap:0}.info-heading{font-size:var(--calcite-font-size-1);color:var(--calcite-color-text-1)}`;function j(s){if(!s)return;let e=s.indexOf('{"error":');if(e!==-1)try{let t=s.slice(e),a=JSON.parse(t);if(a&&typeof a=="object"&&a.error)return a.error}catch{return}}async function K(s){let{baseUrl:e,skillId:t,message:a,authToken:o,previousConversationId:i,context:r}=s,c=t?`${e}/skills/${t}/chat`:`${e}/chat`,l=[],d={message:a,context:r};i&&(d.conversation_id=i);let p;try{p=await U(c,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(d),responseType:"json"})}catch(h){let b=h?.details?.rawResponse||h?.message||String(h),v=j(b),f=new Error(`Failed to send message: ${a}. Response: ${b}`);throw v&&(f.arcadeAssistantError=v),f}let m=p.data;if(!m.hasMore)throw new Error("Expected hasMore to be true");l.push(m);let L=m.conversationId,B=m.inquiryId,A=m.sequenceNumber;async function H(){let h=0,b=25;for(;h<b;){await new Promise(g=>setTimeout(g,1e3));let v=X(L,A,B),f;try{f=await U(c,{method:"post",headers:{"Content-Type":"application/json",token:o},body:JSON.stringify(v),responseType:"json"})}catch(g){let R=g?.details?.rawResponse||g?.message||String(g),S=j(R),M=new Error(`Polling failed. Response: ${R}`);throw S&&(M.arcadeAssistantError=S),M}let u=f.data;if(u.context&&u.context.kind==="ArcgisErrorAsContext"&&u.context.error)throw new Error(u.context.error.message||"ArcGIS Assistant error");if(l.push(u),A=u.sequenceNumber,h++,!u.hasMore)break}if(h===b)throw new Error("Request timed out")}return await H(),l}function X(s,e,t){return{conversationId:s,inquiryId:t,ackSequenceNumber:e}}var Z=s=>{let e=s.value.length,t=72,a=180,o=s.offsetWidth,i=Math.max(1,Math.floor(o/8)),r=Math.ceil(e/i),c=t+(r-2)*24;s.style.setProperty("--calcite-text-area-min-height",`${Math.min(c,a)}px`)};function ee({messages:s}){return n`<calcite-chip slot=header-actions-end scale=s appearance=outline-fill .label=${s.beta??"Beta"}>${s.beta??"Beta"}</calcite-chip>`}function te({messages:s}){return n`<calcite-action icon=information slot=header-actions-end id=legal-disclaimer text></calcite-action><calcite-tooltip reference-element=legal-disclaimer>${s.legaldisclaimer}</calcite-tooltip>`}function se({errorMessage:s}){return n`<calcite-input-message id=error-message status=invalid slot=footer-start icon=exclamation-mark-triangle scale=m>${s}</calcite-input-message>`}function ie({active:s,setActive:e,messages:t}){return n`<calcite-alert slot=alerts .open=${s} placement=bottom kind=success icon=check-circle-f auto-close @calciteAlertClose=${()=>e(!1)} label=confirmation-alert><div slot=message>${t.expressionapplied??"Expression applied to editor."}</div></calcite-alert>`}function ae({isDisabled:s,isReadOnly:e,setQuestion:t,setIsViewingResult:a,textAreaRef:o,question:i,errorMessage:r,setErrorMessage:c,submitQuestion:l,messages:d}){return n`<div class="text-area-wrapper"><calcite-text-area resize=none .readOnly=${s||e} class="styled-text-area" .placeholder=${d.askaquestion??`Specify the calculation or logic you need in an Arcade expression. (e.g., 'Return "Yes" if value > 10')`} .value=${i} @calciteTextAreaInput=${p=>{Z(p.target),t(p.target.value)}} ${N(o)}>${r&&se({errorMessage:r})||""}</calcite-text-area><div class="response-actions">${e?n`<calcite-button round appearance=outline-fill icon-start=speech-bubble-plus @click=${()=>{t(""),a(!1)}}>${d.askagain||"Ask again"}</calcite-button>`:n`<calcite-button alignment=end round icon-end=effects appearance=solid .loading=${s} .disabled=${s} @click=${async()=>{c(i?"":d.enteraprompt??"Please enter a prompt"),await l()}}>${d.ask||"Ask"}</calcite-button>`}</div></div>`}function ce({open:s,setOpen:e,messages:t,feedbackValue:a,setFeedbackValue:o,feedbackText:i,setFeedbackText:r,onSubmit:c}){return n`<calcite-sheet class="feedback-sheet" .label=${t.feedback??"Feedback"} slot=sheets display-mode=float position=block-end .open=${s} @calciteSheetClose=${()=>e(!1)}><calcite-panel .heading=${t.providefeedback??"Provide feedback"} .description=${t.experiencehelps??"Your experience helps guide future improvements"}><div class="feedback-content"><calcite-label>${t.experiencehelpful??"Was the assistant helpful?"}<calcite-segmented-control scale=l><calcite-segmented-control-item icon-start=thumbs-up .checked=${a==="good"} @click=${()=>o("good")}></calcite-segmented-control-item><calcite-segmented-control-item icon-start=thumbs-down .checked=${a==="bad"} @click=${()=>o("bad")}></calcite-segmented-control-item></calcite-segmented-control></calcite-label><calcite-label>${t.describeexperience??"Describe your experience"}<calcite-text-area resize=vertical .value=${i} @calciteTextAreaInput=${l=>r(l.target.value)}></calcite-text-area></calcite-label></div><calcite-button slot=footer width=full @click=${c}>${t.submitfeedback??"Submit Feedback"}</calcite-button></calcite-panel></calcite-sheet>`}var oe="arcade_generation",re="ArcadeCodeRequest",ne="visualization",le="ArcadeAssistant",de=["your_comments","user_evaluation","question","answer","useragent","_source","version","context","extras"],z=[],$=class extends I{constructor(){super(...arguments),this.textAreaRef=P(),this.messages=_(),this.feedbackService=void 0,this.handleFeedbackButton=e=>{this.feedbackValue===e&&this.feedbackActive?(this.feedbackActive=!1,this.feedbackValue=void 0,this.feedbackText=""):(this.feedbackValue=e,this.feedbackActive=!0)},this.handleFeedbackSheetClose=()=>{this.feedbackActive=!1,this.feedbackValue=void 0,this.feedbackText=""},this.handleFeedbackSubmit=async()=>{if(this.feedbackValue){if(this.feedbackServiceUrl){if(!this.feedbackService){let i=new J({url:this.feedbackServiceUrl});await i.load();let r=i.fields,c=[];if(de.forEach(l=>{r.some(d=>d.name===l)||c.push(l)}),c.length>0){console.error(`Missing the following fields in feedback service: ${c.join(", ")}.
|
|
5
|
-
Feedback will not be logged.`),this.handleFeedbackSheetClose();return}this.feedbackService=i}let e=this.getModel(),t=e?await this.getProfileAndMetadata(e.uri):void 0,a={user_evaluation:this.feedbackValue,your_comments:this.feedbackText,question:this.question,answer:this.history[0]?.script??"",useragent:navigator.userAgent,_source:le,version:this.appVersion??"",context:t?JSON.stringify(t):"",extras:t?.profileName??""},o=new W({attributes:a});try{await this.feedbackService?.applyEdits({addFeatures:[o]})}catch(i){console.error("Error submitting feedback:",i)}}this.handleFeedbackSheetClose()}},this.handleClose=e=>{this.closed=!0,this.closePanel?.(e)},this.setQuestion=e=>{this.question=e},this.isViewingResult=!1,this.confirmationActive=!1,this.isDisabled=!1,this.errorMessage=void 0,this.question="",this.history=[],this.feedbackActive=!1,this.feedbackValue=void 0,this.feedbackText="",this.copySuccess=!1,this.assistantsEnabled=!1,this.closed=!1}static{this.properties={isViewingResult:16,confirmationActive:16,isDisabled:16,errorMessage:16,question:16,history:16,feedbackActive:16,feedbackValue:16,feedbackText:16,copySuccess:16,closePanel:0,insertText:0,assistantsEnabled:5,layer:[1,{type:Object}],orgBaseUrl:1,serviceUrl:1,closed:7,editorRef:0,feedbackServiceUrl:1,appVersion:1}}static{this.styles=Y}async destroy(){}connectedCallback(){super.connectedCallback(),this.history=z}disconnectedCallback(){super.disconnectedCallback(),z=this.history}getModel(){return this.editorRef.editorInstance?.getModel()}async submitQuestion(){if(this.question){this.isDisabled=!0;try{let e=await this.getToken(),t=this.getModel();if(!t)return;let{profileName:a,metadata:o}=await this.getProfileAndMetadata(t.uri),i=(await K({baseUrl:this.serviceUrl,skillId:oe,message:this.question,authToken:e,context:{kind:re,context:{profile_name:a,metadata:o}}})).find(r=>r.context?.kind==="ArcadeCodeResponse");if(!i)return;i.context?.kind==="ArcadeCodeResponse"&&(this.history.unshift({script:i?.context?.arcadeCode?.code,error:void 0,question:this.question}),this.isViewingResult=!0,this.errorMessage=void 0)}catch(e){typeof e=="object"&&e&&"arcadeAssistantError"in e?this.errorMessage=e.arcadeAssistantError.message||this.messages.erroroccurred||"An error occurred.":e instanceof Error?this.errorMessage=this.messages.erroroccurred??"An error occurred.":this.errorMessage=this.messages.erroroccurred||"An error occurred.",console.error("Error in Arcade Assistant:",e)}finally{this.isDisabled=!1}}}async getToken(){let{token:e}=await G.getCredential(this.orgBaseUrl);return e}async getProfileAndMetadata(e){let t=ne,a=O.getEditorProfileForModel(e);a?.loaded||await a?.loadSource();let o=this.editorRef.profile;o&&"id"in o&&(t=o.id);let i=a?.definition?.variables?.find(c=>c.type==="feature"),r=[];return i?.definition&&"fields"in i.definition&&(r=i.definition.fields.map(c=>({name:c.name,type:c.type,alias:c.alias}))),{profileName:t,metadata:r}}render(){return this.closed?null:this.assistantsEnabled?n`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}>${ee({messages:this.messages})}${te({messages:this.messages})}${ie({active:this.confirmationActive,setActive:e=>this.confirmationActive=e,messages:this.messages})}${ae({isDisabled:this.isDisabled,isReadOnly:this.isViewingResult,setQuestion:this.setQuestion,setIsViewingResult:e=>this.isViewingResult=e,textAreaRef:this.textAreaRef,question:this.question,errorMessage:this.errorMessage,setErrorMessage:e=>this.errorMessage=e,submitQuestion:this.submitQuestion.bind(this),messages:this.messages})}<calcite-block .hidden=${!this.isDisabled} .heading=${this.messages.generatingresponse??"Generating response..."}></calcite-block>${this.isViewingResult&&n`<calcite-block class="block-response" icon-start=effects .heading=${this.messages.besteffort??"Here's the assistant's best effort"} expanded><calcite-list class="prompt-list" .label=${this.messages.promptlist??"Prompt list"}><calcite-list-item expanded class=${F(this.history[0]?.error?"type-error":"type-response")} .label=${w(this.history[0]?.script??"")||this.history[0]?.error} @calciteListItemSelect=${()=>{x(this.editorRef.editorInstance,this.history[0]?.script??"",this.messages.disclaimercomment??"Expression generated by ArcGIS Arcade Assistant (beta)"),this.isViewingResult=!1,this.setQuestion("")}}><code slot=content><pre class="break-spaces">${w(this.history[0]?.script??"")}</pre></code></calcite-list-item></calcite-list><div class="response-actions"><calcite-button icon-start=plus round kind=brand @click=${()=>{x(this.editorRef.editorInstance,this.history[0]?.script??"",this.messages.disclaimercomment??"Expression generated by ArcGIS Arcade Assistant (beta)"),this.isViewingResult=!1,this.setQuestion("")}}>${this.messages.addtoeditor??"Add to editor"}</calcite-button><calcite-button id=copy-to-clipboard icon-start=${this.copySuccess?"check":"copy-to-clipboard"} round kind=neutral @click=${async()=>{let e=this.history[0]?.script??"";e&&(await navigator.clipboard.writeText(e),this.copySuccess=!0,setTimeout(()=>{this.copySuccess=!1},1500))}}>${this.copySuccess?this.messages.copied??"Copied!":""}</calcite-button><div class="feedback-button-container" id=feedback-buttons><calcite-button id=thumbs-up icon-start=thumbs-up appearance=transparent @click=${()=>this.handleFeedbackButton("good")}></calcite-button><calcite-button id=thumbs-down appearance=transparent icon-start=thumbs-down @click=${()=>this.handleFeedbackButton("bad")}></calcite-button><calcite-tooltip reference-element=feedback-buttons>${this.messages.providefeedback??"Provide feedback"}</calcite-tooltip></div></div><span class="result-disclaimer">${this.messages.reviewcodedisclaimer??"Review AI-generated code for accuracy, coherence, and relevance before using it."}</span></calcite-block>`||""}<calcite-block .hidden=${this.isViewingResult||this.isDisabled||this.history.length<1} .disabled=${this.isViewingResult||this.isDisabled||this.history.length<1} class="no-space-block" collapsible .expanded=${this.history.length>0} .heading=${this.messages.recentprompts??"Recent prompts"}><calcite-list class="prompt-list" .label=${this.messages.historylist??"History list"}>${this.history.map(e=>n`<calcite-list-item class="type-history" .label=${e.question} @calciteListItemSelect=${()=>{this.errorMessage="",this.setQuestion(e.question),this.textAreaRef.value?.setFocus()}}><calcite-icon icon=recent scale=s slot=content-end></calcite-icon></calcite-list-item>`)}</calcite-list></calcite-block>${this.feedbackActive?n`<calcite-shell>${ce({open:this.feedbackActive,setOpen:this.handleFeedbackSheetClose,messages:this.messages,feedbackValue:this.feedbackValue??"good",setFeedbackValue:e=>this.feedbackValue=e,feedbackText:this.feedbackText??"",setFeedbackText:e=>this.feedbackText=e,onSubmit:this.handleFeedbackSubmit})}</calcite-shell>`:null}${!this.isViewingResult&&n`<span class="result-disclaimer">${this.messages.aigenerated} ${this.messages.seeterms}</span>`||""}</calcite-flow-item></calcite-flow>`:n`<calcite-flow><calcite-flow-item .selected=${!this.isViewingResult} closable .heading=${this.messages.arcadeassistant??"Arcade assistant"} @calciteFlowItemClose=${this.handleClose}><calcite-block label=info slot=content-top expanded><calcite-chip .label=${this.messages.new??"new"} kind=brand>${this.messages.new}</calcite-chip><h1 class="info-heading">${this.messages.introducing}</h1><p>${this.messages.capabilities}</p><p>${Q(this.messages.useofassistant?.replace("{aiassistants}",`<strong>${this.messages.aiassistants??"Ai Assistants"}</strong>`))}</p></calcite-block></calcite-flow-item></calcite-flow>`}};D("arcgis-arcade-coding-assistant",$);return $},"identity/IdentityManager","request","layers/FeatureLayer","Graphic",a,b)
|