@arcgis/coding-components 5.2.0-next.77 → 5.2.0-next.79
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/{6LPNGMDE.js → 3OR3WFUJ.js} +1 -1
- package/dist/cdn/{VD5OEXO6.js → 4L2GLNTS.js} +17 -17
- package/dist/cdn/{PR7KTMAS.js → 6EN2C75J.js} +1 -1
- package/dist/cdn/{N5BWDIMZ.js → BMH6Y42N.js} +1 -1
- package/dist/cdn/{TUB3DPGP.js → DGQ3XT5J.js} +1 -1
- package/dist/cdn/{JE3AYQH2.js → GATL6PSW.js} +2 -2
- package/dist/cdn/{BN5UJZOU.js → KUL43ADE.js} +1 -1
- package/dist/cdn/{6IKYN6UN.js → LJQ7Y6HB.js} +1 -1
- package/dist/cdn/{TOQ2QWTU.js → M5FGCA7R.js} +1 -1
- package/dist/cdn/{TNE7K4P6.js → MM63IOR3.js} +1 -1
- package/dist/cdn/{E4CYGXC6.js → RDHNSTZG.js} +1 -1
- package/dist/cdn/{4KQVV3YD.js → SUFCEUFA.js} +1 -1
- package/dist/cdn/{FP7M64L5.js → UM4DUHEA.js} +1 -1
- package/dist/cdn/{T7CCNYHK.js → VBQBE2ZZ.js} +1 -1
- package/dist/cdn/{AGTV2YKX.js → VJVVEOIA.js} +1 -1
- package/dist/cdn/{Q6573NF7.js → VVCAEHDP.js} +1 -1
- package/dist/cdn/assets/code-editor/sql-expr.worker.js +4567 -4570
- package/dist/cdn/assets/code-editor/sql-layer.worker.js +742 -703
- package/dist/cdn/index.js +1 -1
- package/dist/chunks/language-defaults-base.js +37 -32
- 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 +7 -7
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import e from"./
|
|
2
|
+
import e from"./KUL43ADE.js";import{a as c}from"./5HKDO4SX.js";import b from"./O5LFPM4K.js";import a from"./VJVVEOIA.js";import{a as t}from"./CMRUQ3BN.js";import{ul as d,xl as n}from"./DSQ2DQQL.js";export default $arcgis.t(([s,{c:m},{a:a,b:p}])=>{var k=["arcade","arcgis-sql-expression","sql-layer-sql-server","sql-layer-postgres","sql-layer-bigquery"],i=new Set,u=new Map;function l(e){let r=u.get(e);return r||(r=Promise.withResolvers(),u.set(e,r)),r}function f(e){l(e).resolve()}function T(e){return k.includes(e)?l(e).promise:Promise.resolve()}function h(e,r){return()=>{i.has(e)||i.add(e),r()}}async function U(e){i.has(e)||(await t()).createModel("",e,d.parse("")).dispose()}n.register({id:s.languageId,aliases:["Arcade","arcade"],extensions:[".arc"],mimetypes:["application/arcade"]});n.onLanguage(s.languageId,h(s.languageId,()=>{m().then(e=>{e.setupMode(s),f(s.languageId)}).catch(e=>{throw e})}));n.register({id:a.languageId,aliases:["EsiSqlExpression","sql-expression"],extensions:[".sql-expression"],mimetypes:["application/sql-expression"]});n.onLanguage(a.languageId,h(a.languageId,()=>{p().then(e=>{e.setupMode(a),f(a.languageId)}).catch(e=>{throw e})}));q();function q(){t().then(e=>{["light","dark"].forEach(r=>{let g=r==="light"?"vs":"vs-dark",o=c[`${r}-theme`];e.defineTheme(g,{base:g,inherit:!0,rules:[{token:"comment.arcgis",foreground:o.comment},{token:"constant.arcgis",foreground:o.constant},{token:"keyword.arcgis",foreground:o.keyword},{token:"identifier.arcgis",foreground:o.identifier},{token:"number.arcgis",foreground:o.number},{token:"string.arcgis",foreground:o.string},{token:"operator.arcgis",foreground:o.operator},{token:"predefined.arcgis",foreground:o.predefined},{token:"date.arcgis",foreground:o.date}],colors:{}})})})}return{a:f,b:T,c:h,d:U}},a,b,e)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{b as Se}from"./VYEWIX5W.js";import a from"./STN3LSQR.js";import{a as k,b as Fe,c as W,d as w,e as D}from"./MZMKV7FA.js";import{k as
|
|
2
|
+
import{b as Se}from"./VYEWIX5W.js";import a from"./STN3LSQR.js";import{a as k,b as Fe,c as W,d as w,e as D}from"./MZMKV7FA.js";import{k as N}from"./BHSILWSL.js";import{b as M,c as E,d as $,e as De}from"./BZWB7A55.js";import{a as Ce}from"./CMRUQ3BN.js";import{M as oe,s as ae,v as A}from"./SMZ3LNZE.js";import{a as h}from"./BFPEJYVB.js";import{ll as B,ul as H}from"./DSQ2DQQL.js";export default $arcgis.t(([Ve,Ae,Ne,K,{getDeclaredVoxelMembers:Oe,getDeclaredPixelMembers:qe},Ue,Re,{A:R,B:g,F:ge,H:G,I:we,a:O,b:ne,c:le,d:pe,e:ce,k:q,l:x,m:he,o:d,p:ue,q:de,r:P,s:U,t:b,u:fe,v:_e,w:me,y:ye,z:be}])=>{var S=s=>s!==void 0,m=s=>s!==null;function Ge(s){switch(s){case"esriFieldTypeOID":return"oid";case"esriFieldTypeSmallInteger":return"small-integer";case"esriFieldTypeInteger":return"integer";case"esriFieldTypeBigInteger":return"big-integer";case"esriFieldTypeSingle":return"single";case"esriFieldTypeDouble":return"double";case"esriFieldTypeDate":return"date";case"esriFieldTypeDateOnly":return"date-only";case"esriFieldTypeTimeOnly":return"time-only";case"esriFieldTypeTimestampOffset":return"timestamp-offset";case"esriFieldTypeGUID":return"guid";case"esriFieldTypeGlobalID":return"global-id";case"esriFieldTypeString":return"string";case"esriFieldTypeGeometry":return"geometry";case"esriFieldTypeBlob":return"blob";case"esriFieldTypeRaster":return"raster";case"esriFieldTypeXML":return"xml";default:return"string"}}function ke(s){return{fields:s.fields.map(e=>({name:e.name,type:Ge(e.type),serverType:e.type,nullable:e.nullable}))}}function ve(s){return typeof s?.query=="object"&&s.query?s.query:{}}var j=class{constructor(e){this.itemId=e.itemId,this.portal=e.portal,this.serviceUrl=e.serviceUrl,this._requestOptions=e.requestOptions}fetchInfo(e){return this.portal.request(this._datastoreUrl,this._createRequestOptions(e))}async fetchDatasets(e){return(await this.portal.request(z(this._datastoreUrl,"datasets"),this._createRequestOptions(e))).datasets}async fetchTableDescription(e,t){if(!e)throw new Ue("portal:invalid-parameter",'The "tableName" parameter must be provided.');let i=await this.portal.request(z(this._datastoreUrl,"tableDescription"),{...this._createRequestOptions(t),query:{...ve(this._requestOptions),...ve(t),tableName:e}});return ke(i)}get _datastoreUrl(){return z(this.serviceUrl,"datastores",encodeURIComponent(this.itemId))}_createRequestOptions(e){return{...this._requestOptions,...e}}};function z(s,...e){let t=s.replaceAll(/\/+$/gu,""),i=e.filter(r=>!!r).map(r=>r.replaceAll(/^\/+|\/+$/gu,""));return[t,...i].join("/")}var We={id:"ansi",keywords:[],functions:[],operators:[],specialChars:{likeWildcardAny:"%",likeWildcardOne:"_",identifierQuote:{start:'"',end:'"'},escapeKey:{start:null,end:null},escapeClause:{keyword:"ESCAPE",suffix:null}}},Ie=new Map,Be={ansi:async()=>await Promise.resolve(We),bigquery:async()=>(await import("./XG3S7JQW.js")).bigqueryDialect,postgres:async()=>(await import("./U2T7AGOO.js")).postgresDialect,sqlServer:async()=>(await import("./UZD32YRD.js")).sqlServerDialect,oracle:async()=>(await import("./TUQPDQ74.js")).oracleDialect};async function He(s){let e=Ie.get(s);if(e)return await e;let t=Be[s]();return Ie.set(s,t),await t}var ze=["WITH","SELECT","FROM","WHERE","GROUP","BY","HAVING","ORDER","OFFSET","FETCH","FIRST","NEXT","ROW","ROWS","ONLY","LIMIT","DISTINCT","AS","JOIN","LEFT","RIGHT","FULL","INNER","OUTER","CROSS","ON","USING","AND","OR","NOT","IN","IS","LIKE","ESCAPE","BETWEEN","NULL","TRUE","FALSE","DATE","TIMESTAMP","CASE","WHEN","THEN","ELSE","END","ASC","DESC"],Ke=["<=",">=","<>","!=","=","<",">","+","-","*","/","%","||"],je=(s,e={})=>{let t=new Set(e.baseKeywords??ze);for(let r of s.keywords)t.add(r.toUpperCase());let i=new Set(e.baseOperators??Ke);for(let r of s.operators)i.add(r);return{keywords:Array.from(t),functions:s.functions,operators:Array.from(i),specialChars:s.specialChars}},u={sqlServer:"sql-layer-sql-server",postgres:"sql-layer-postgres",bigquery:"sql-layer-bigquery",oracle:"sql-layer-oracle"},Te=u.postgres,Qe={[u.sqlServer]:"sqlServer",[u.postgres]:"postgres",[u.bigquery]:"bigquery",[u.oracle]:"oracle"};function Je(s){return Qe[s]}async function Xe(s){return je(await He(Je(s)))}var Ye=/^[A-Za-z_][A-Za-z0-9_$]*$/u;function Ze(s){return s==="esriDBMS_PostgreSQL"?Te:s==="esriDBMS_SQLServer"?u.sqlServer:s==="esriDBMS_BigQuery"?u.bigquery:s==="esriDBMS_Oracle"?u.oracle:Te}function At(s){return s.trim().toLowerCase()}function et(s){return s.specialChars.identifierQuote}function tt(s,e){let t=s.trim();return t?Ye.test(t)?e.keywords.includes(t.toUpperCase()):!0:!1}function $e(s,e){let t=s.trim();if(!t||!tt(t,e))return t;let i=et(e),r=t.replaceAll(i.end,`${i.end}${i.end}`);return`${i.start}${r}${i.end}`}function it(s,e){return s.split(".").map(t=>$e(t,e)).join(".")}function Nt(s){return s.split(".").at(-1)??s}function rt(s){return Xe(Ze(s))}async function st(s,e){let t=new K({url:`${s.url}/${e.relatedTableId}`});return await t.load(),t}function ie(s){return(e,t)=>{if(e.type==="oid")return-1;if(t.type==="oid")return 1;if(b(s)){if(e.name===s.subtypeField)return-1;if(t.name===s.subtypeField)return 1}if(P(s)){if(e.name===s.typeIdField)return-1;if(t.name===s.typeIdField)return 1}return e.name.localeCompare(t.name,"en",{sensitivity:"base"})}}function xe(s,e){return s?.every(t=>t.domains?.[e.name]?.type==="inherited")??!1}var at=/^[a-z_$][a-z0-9_$]*$/giu;function re(s,e=!0){return s.match(at)?`${e?".":""}${s}`:`["${s}"]`}function Le(s,e){return s?`${s}${re(e)}`:e}function Pe(s){return _e(s)?s.portalItem:null}function ot(s,e){return e?s?.nullable??"nullable":s?.notnull??"not nullable"}function Ot(s,e,t){let{includeAliases:i=!1,supportGeometryFields:r=!1}=t??{},a=e,n=[],_=[];return w(s,{supportGeometry:r}).forEach(o=>{a&&(a+=`
|
|
3
3
|
|
|
4
4
|
`),a+=`**${o.name}** (${o.alias})
|
|
5
5
|
${o.type}`,o.description&&(a+=`
|
|
@@ -9,4 +9,4 @@ ${o.type}`;o.description&&(se+=`
|
|
|
9
9
|
|
|
10
10
|
`),t+=`**${r.name}**
|
|
11
11
|
${r.type}`,r.name&&(t+=`
|
|
12
|
-
'${r.name}`),i.push({name:r.name,description:r.name,type:"array",completion:{label:r.name,detail:r.name,insertText:re(r.name,!1),insertTextMode:$.asIs,insertTextFormat:E.PlainText,kind:M.Field}})}),[i,t]}var L=class{constructor(e,t,i){this._profile=e,this._label=t,this.description=i,this.filterDescription=!1}getLabel(){return this._label==null?"":typeof this._label=="string"?ae(this._label):A(this._profile?.intlStrings[this._label.code],this._label.formatValues)}getDescription(){return this.description==null?"":typeof this.description=="string"?this.description:A(this._profile?.intlStrings[this.description.code],this.description.formatValues)}passFilter(e){return!e||e.test(this.getLabel())?!0:this.filterDescription&&e.test(this.getDescription())}},F=class extends L{constructor(e){super(e.profile,e.label,e.description??e.declaration?.description),this.declaration=e.declaration??{},this.name=e.declaration?.name??"",this.snippet=e.snippet??"",this.nonInteractive=e.nonInteractive??!1,this.filterDescription=e.filterDescription??!1,this.icon=e.icon}},l=class extends F{constructor(e){super(e),this.type="text",this.isCollection=!1,this.type=e.declaration?.type??"text"}getDescription(){return this.description==null?this._profile?.intlStrings[this.type.toLowerCase()]??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}},Q=class extends F{constructor(e){super(e),this.type="array",this.isCollection=!1,this.elementType=e.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return this.description==null?this._profile?.intlStrings[this.type.toLowerCase()]??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}},f=class extends F{constructor(e,t){super(t),this.owner=e,this.isCollection=!0,this._loaded=!0,this.variables=[]}get breadcrumb(){if(this.owner){let e=this.owner.breadcrumb;return e?`${e} / ${this.name}`:this.name}return this.name}get loaded(){return this._loaded}get informationUrl(){return null}get informationType(){return""}},p=class extends L{constructor(e,t,i=[],r=!1){super(e,t),this.variables=i,this.isHeader=r,this.type="group",this.isCollection=!0}passFilter(){return!0}},C=class s extends f{constructor(e,t){super(e,t),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(t.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new p(this._profile,this.snippet,this.dictionaryVariables)])}async loadSource(){}loadPropertyDeclarations(e){this.dictionaryVariables=this.createVariableInstances(e),this.variables=this.dictionaryVariables}createVariableInstances(e){if(!Array.isArray(e))return[];let t=[];return e.forEach(i=>{let r=this.createVariableInstance(i);r&&t.push(r)}),t}createVariableInstance(e){let t=Le(this.snippet,e.name);switch(e.type){case"number":case"text":case"boolean":case"date":case"dateOnly":case"time":case"geometry":case"knowledgeGraph":return new l({profile:this._profile,declaration:e,label:t,snippet:t});case"pixel":return new Y(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"voxel":return new X(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"feature":return new J(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"featureSet":return new I(this,{profile:this._profile,declaration:e,label:t,snippet:t},[new l({profile:this._profile,label:t,description:"",snippet:t})]);case"featureSetCollection":return new Z(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"dictionary":return new s(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"array":return new Q({profile:this._profile,declaration:e,label:t,snippet:t});case"dataCatalogDatastore":return new ee(this,{profile:this._profile,declaration:e,label:t,snippet:t});default:return h("error","Editor profile","Invalid profile variable",{detail:{declaration:e}}),null}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,properties:this.dictionaryVariables.map(e=>e.toProfileVariableDefinition())}}},V=class extends f{constructor(e,t,i){super(e,t),this.relationshipsProperties=i,this._source=null,this._loaded=!1,this._definition=t.declaration?.definition}get title(){return d(this._source)?this._source.title??"":""}get url(){return ue(this._source)?this._source.url??"":""}get informationUrl(){return!this.loaded||!this.url?null:de(this._source)?`${this.url}/${this._source.layerId}`:this.url}get informationType(){return this._profile?.intlStrings.layer??"layer"}async loadSource(){return m(this._loadPromise)&&S(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}_getValueSnippet(e){return["feature","voxel","pixel"].includes(this.type)?Le(this.snippet,e.name):e.name}_getSubtypeOrDomainNameSnippet(e){return this.type!=="feature"?null:b(this._source)&&e.name===this._source.subtypeField?`SubtypeName(${this.snippet})`:`DomainName(${this.snippet}, "${e.name}")`}_getFieldProperty(e,t){let i=this._getDomainDictionary(e);if(i)return i;let r=this._getValueSnippet(e);return new l({profile:this._profile,label:r,description:D(e),snippet:r,icon:k(e,t),filterDescription:!0})}_getMemberProperty(e){let t=this._getValueSnippet(e);return new l({profile:this._profile,label:t,description:e.name,snippet:t,icon:Fe(e),filterDescription:!0})}_getDomainDictionary(e){return U(this._source)?b(this._source)&&this._source.subtypeField?this._getSubtypeDomainDictionary(e):P(this._source)&&this._source.typeIdField?this._getFeatureTypeDomainDictionary(e):this._getFieldDomainDictionary(e):null}_getSubtypeDomainDictionary(e){if(!b(this._source))return null;if(!fe(this._source))return e.name===this._source.subtypeField?null:this._getFieldDomainDictionary(e);if(e.name===this._source.subtypeField){let r=this._createDomainDictionary(e);return r.icon="subtype",r.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.subtypes,e)),r}if(xe(this._source.subtypes,e))return this._getFieldDomainDictionary(e);let t=this._getDomainValuesGroup(this._source.subtypes,e);if(!t)return null;let i=this._createDomainDictionary(e);return i.variables.push(t),i}_getFeatureTypeDomainDictionary(e){if(!P(this._source))return null;if(e.name===this._source.typeIdField){let r=this._createDomainDictionary(e);return r.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.types,e)),r}if(xe(this._source.types,e))return this._getFieldDomainDictionary(e);let t=this._getDomainValuesGroup(this._source.types,e);if(!t)return null;let i=this._createDomainDictionary(e);return i.variables.push(t),i}_getFieldDomainDictionary(e){if(!U(this._source))return null;let t=this._source.getFieldDomain(e.name);if(!x(t))return null;let i=this._getCodedValueDomainGroup(t,{code:"domainvalues"}),r=this._createDomainDictionary(e);return r.variables.push(i),r}_getTypeOrSubtypeDomainGroup(e,t){if(x(t.domain))return this._getCodedValueDomainGroup(t.domain,{code:"subtypes"});let i=e?.map(r=>{let a=q(r)?r.code:r.id;return new l({profile:this._profile,label:`${a}`,description:r.name,snippet:`"${a}"`})})??[];return new p(this._profile,{code:"subtypes"},i)}_getCodedValueDomainGroup(e,t){let i=e.codedValues.map(r=>new l({profile:this._profile,label:`${r.code}`,description:r.name,snippet:`"${r.code}"`,filterDescription:!0}));return new p(this._profile,t,i)}_getDomainValuesGroup(e,t){let i=[];return!e||e.length===0||(e.forEach(r=>{let a=r.domains?.[t.name];if(!a||he(a)||!x(a))return;let n=D(t),_=this._getCodedValueDomainGroup(a,{code:"domainvaluesfortypeformat",formatValues:{fieldName:n,typeName:r.name}}),o=q(r)?r.code:r.id,c=`${o}`,T=`"${o}""`,y=new C(this,{profile:this._profile,label:c,snippet:T,description:r.name,declaration:{name:n}});y.variables=[_],i.push(y)}),!i.length)?null:new p(this._profile,{code:"domainvaluesbysubtypes"},i)}_createDomainDictionary(e){let t=this._getValueSnippet(e),i=D(e),r=new C(this,{profile:this._profile,label:t,description:i,snippet:t,icon:"form-dropdown",declaration:{name:e.name}}),a=new p(this._profile,i,[new l({profile:this._profile,label:t,description:"",snippet:t})]);r.variables=[a];let n=this._getSubtypeOrDomainNameSnippet(e);return n&&a.variables.push(new l({profile:this._profile,label:n,description:"",snippet:n})),r}async _getRelationshipsProperty(){if(!this.relationshipsProperties?.exposeRelationships||!this._profile?.supportFeatureSetFunctions)return null;let e=this._source;if(!me(e))return null;let t=new p(this._profile,{code:"relationships"}),i=await Promise.all(e.relationships?.map(async r=>{let a=await st(e,r);if(!N(a)||r.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;let n=`FeatureSetByRelationshipName(${this.snippet}, "${r.name}")`;return new I(this,{profile:this._profile,declaration:{definition:a},label:a.title,description:"",nonInteractive:!0},[new l({profile:this._profile,label:n,description:"",snippet:n})],{exposeRelationships:!0,sourceTableId:e.layerId})})??[]);return t.variables=i.filter(m),t.variables.length?t:null}},v=class extends V{constructor(e,t,i,r={exposeRelationships:!0}){super(e,t,r),this.type=i}get title(){return d(this._source)?this._source.title??"":{code:this.type}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}},J=class extends v{constructor(e,t){super(e,t,"feature",{exposeRelationships:!0}),this.type="feature"}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await G(this._definition),!this._source)throw new Error("Invalid definition");let e=d(this._source)?this._source.title??"":"";this.variables.push(new p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new p(this._profile,{code:"values"});if(this.variables.push(t),ye(this._source)){let a=`Geometry(${this.snippet})`,n=new l({profile:this._profile,declaration:{name:a},label:a,description:"Geometry",snippet:a,icon:"shapes",filterDescription:!0});t.variables.push(n)}let i=this._source;w(this._source.fields).map(a=>i.fields.find(n=>n.name===a.name)).sort(ie(i)).forEach(a=>{t.variables.push(this._getFieldProperty(a))});let r=await this._getRelationshipsProperty();r&&this.variables.push(r)}catch(e){h("error","FeatureVariable","Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}},X=class extends v{constructor(e,t){super(e,t,"voxel",{exposeRelationships:!1}),this.type="voxel",this._source=null}async _loadSource(){if(this.loaded)return this._source;try{if(!be(this._definition))throw new Error("Invalid definition - not a VoxelLayer");if(await this._definition.load(),this._source=this._definition,!this._source)throw new Error("Invalid definition");let e=d(this._source)?this._source.title??"":"";this.variables.push(new p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new p(this._profile,{code:"values"});this.variables.push(t);let i=await Ne(this._source),r=this._source;w(this._source.fields).map(a=>r.fields.find(n=>n.name===a.name)).sort(ie(r)).forEach(a=>{t.variables.push(this._getFieldProperty(a,i))})}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}},Y=class extends v{constructor(e,t){super(e,t,"pixel",{exposeRelationships:!1}),this.type="pixel",this._source=null}async _loadSource(){if(this.loaded)return this._source;try{if(!R(this._definition))throw new Error("Invalid definition - not an ImageryLayer");if(await this._definition.load(),this._source=this._definition,!this._source)throw new Error("Invalid definition");let e=d(this._source)?this._source.title??"":"";this.variables.push(new p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new p(this._profile,{code:"values"});if(this.variables.push(t),!R(this._source))throw new Error("Invalid definition - not an ImageryLayer");(await qe(this._source)).forEach(i=>{t.variables.push(this._getMemberProperty(i))})}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}},I=class extends V{constructor(e,t,i=[],r){super(e,t,r),this.featureSetSnippets=i,this.type="featureSet"}get title(){return d(this._source)?this._source.title??"":{code:"featureset"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await G(this._definition),!this._source)throw new Error("Invalid definition");this.variables.push(new p(this._profile,this.title,this.featureSetSnippets,!0));let e=new p(this._profile,{code:"fields"});this.variables.push(e);let t=this._profile?.policy,i=t&&"allowGeometryFields"in t?t.allowGeometryFields??!1:!1;e.variables=w(this._source.fields,{supportGeometry:i}).sort(ie(this._source)).map(a=>this._getFieldProperty(a));let r=await this._getRelationshipsProperty();r&&this.variables.push(r)}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}},Z=class extends f{constructor(e,t){super(e,t),this.type="featureSetCollection",this._featureSetCollections=null,this._loaded=!1,this._definition=t.declaration?.definition}get informationUrl(){return!this.loaded||!this._featureSetCollections?null:typeof this._featureSetCollections.source!="string"?Se(Pe(this._featureSetCollections.source)):null}get informationType(){if(!this.loaded||!this._featureSetCollections)return"";if(typeof this._featureSetCollections.source=="string")return this._profile?.intlStrings.featureservice??"featureservice";switch(this._featureSetCollections.source.declaredClass){case"esri.WebMap":return this._profile?.intlStrings.webmap??"webmap";case"esri.WebScene":return this._profile?.intlStrings.webscene??"webscene";default:return this._profile?.intlStrings.map??"map"}}async loadSource(){return m(this._loadPromise)&&S(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}async _loadSource(){if(this.loaded)return this._featureSetCollections;try{if(this._featureSetCollections=await this._featureSetCollectionsFromDefinition(),!this._featureSetCollections)throw new Error("Invalid definition");let e=typeof this._featureSetCollections.source=="string"?{code:this._featureSetCollections.source.endsWith("FeatureServer")?"featureservice":"mapservice"}:{code:"webmapformat",formatValues:{webMapTitle:Pe(this._featureSetCollections.source)?.title||"Untitled map"}},t=new p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),i=new p(this._profile,{code:"layers"},this._featureSetCollections.layers),r=new p(this._profile,{code:"tables"},this._featureSetCollections.tables);this.variables.push(t,i,r)}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._featureSetCollections=null}finally{this._loaded=!0}return this._featureSetCollections}async _featureSetCollectionsFromDefinition(){return this._definition?ne(this._definition)?await this._featureSetCollectionFromMap(this._definition):ce(this._definition)?await this._featureSetCollectionFromUrl(this._definition.url):pe(this._definition)?await this._featureSetCollectionFromPortalItem(this._definition.portalItem):null:null}async _featureSetCollectionFromMap(e){le(e)&&await e.loadAll(),await Promise.all(e.allTables.map(async r=>await r.load()));let t=this._profile?.policy,i=t&&"filterFsCollectionLayersFromMap"in t&&t.filterFsCollectionLayersFromMap?t.filterFsCollectionLayersFromMap:()=>!0;return{layers:this._convertWebMapLayersToVariables(e.allLayers.filter(i)),tables:this._convertWebMapLayersToVariables(e.allTables),source:e}}async _featureSetCollectionFromPortalItem(e){let t=new Ve(e);switch(await t.load(),t.type){case"Web Map":{let i=new Ae({portalItem:t});return await this._featureSetCollectionFromMap(i)}case"Web Scene":{let i=new Oe({portalItem:t});return await this._featureSetCollectionFromMap(i)}case"Feature Service":return await this._featureSetCollectionFromUrl(t.url);default:return h("error",this.type,"Unsupported portal item",{detail:{definition:e}}),null}}async _featureSetCollectionFromUrl(e){let t=e?.replace(/\/featureserver\/[0-9]*/iu,"/FeatureServer");if(t=t?.replace(/\/mapserver\/[0-9]*/iu,"/MapServer"),t=t?.split("?")[0],!t)return null;let i=await we(t),r=Promise.all(i.layers.map(async o=>{let c=new K({url:`${t}/${o.id}`});return await c.load(),this._createFeatureSetVariable(c)})),a=Promise.all(i.tables.map(async o=>{let c=new K({url:`${t}/${o.id}`});return await c.load(),this._createFeatureSetVariable(c)})),[n,_]=await Promise.all([r,a]);return{layers:n,tables:_,source:t}}_convertWebMapLayersToVariables(e){let t=[];return e.toArray().reverse().forEach(i=>{if(N(i)){t.push(this._createFeatureSetVariable(i,!0));return}}),t}_createFeatureSetVariable(e,t=!1){return new I(this,{profile:this._profile,declaration:{name:e.title??"",definition:e},label:t?e.title:e.sourceJSON.name??e.title,description:"",nonInteractive:!0},this._makeFeatureSetSnippets(e,t))}_makeFeatureSetSnippets(e,t=!1){if(!this._profile?.supportFeatureSetFunctions)return[];if(t){let i=`FeatureSetById(${this.snippet}, "${e.id}")`,r=`FeatureSetByName(${this.snippet}, "${e.title}")`;return[new l({profile:this._profile,label:i,description:"",snippet:i}),new l({profile:this._profile,label:r,description:"",snippet:r})]}else{let i=`FeatureSetById(${this.snippet}, "${e.layerId}")`;return[new l({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}},ee=class extends f{constructor(e,t){super(e,t),this.type="dataCatalogDatastore",this._catalogDatastore=null,this._datastore=null,this._loaded=!1,this._definition=t.declaration?.definition}_serializeDefinitionFromInstance(e){return{id:e.itemId??"",serviceUrl:e.serviceUrl??"",portal:{url:e.portal?.url??""}}}_getSerializedDefinition(){let e=this.declaration.definition;if(e)return g(e)?e:this._serializeDefinitionFromInstance(e);if(g(this._definition))return this._definition;if(this._catalogDatastore)return this._serializeDefinitionFromInstance(this._catalogDatastore);if(this._definition)return this._serializeDefinitionFromInstance(this._definition)}async loadSource(){return m(this._loadPromise)&&S(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}async _loadSource(){if(this.loaded)return this._datastore;try{if(!this._definition)throw new Error("No definition provided");g(this._definition)?this._catalogDatastore=await this._dataCatalogDatastoreFromDefinition(this._definition):this._catalogDatastore=this._definition;let e=this._catalogDatastore;if(!e)throw new Error("Invalid definition");let t=await e.fetchInfo();this._datastoreInfo=t;let i=await e.fetchDatasets(),r=await rt(t.databasePlatform),a=i.map(n=>new te(this,{profile:this._profile,declaration:{name:n.name},label:n.name,description:n.type,snippet:it(n.name,r)},e,n,r));this.variables=a,this._datastore={tables:a,source:g(this._definition)?this._definition:e,info:t}}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._datastore=null}finally{this._loaded=!0}return this._datastore}get datastoreInfo(){return this._datastoreInfo}get tableVariables(){return this.variables.filter(ge)}async _dataCatalogDatastoreFromDefinition(e){let t=new Re({url:e.portal.url});return await t.load(),new j({itemId:e.id,serviceUrl:e.serviceUrl,portal:t})}toProfileVariableDefinition(){let e=this.declaration,t=this._getSerializedDefinition();return{type:this.type,name:"",...e,...t?{definition:t}:{}}}},te=class extends f{constructor(e,t,i,r,a){super(e,t),this._catalogDatastore=i,this.datasetInfo=r,this._dialectSpec=a,this.type="dictionary",this._fieldInfos=[],this._loaded=!1}get fieldInfos(){return this._fieldInfos}async loadSource(){return m(this._loadPromise)&&S(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadFields(),await this._loadPromise)}async _loadFields(){if(this.loaded)return this._fieldInfos;try{let e=await this._catalogDatastore.fetchTableDescription(this.datasetInfo.name);this._fieldInfos=e.fields,this.variables=this._fieldInfos.map(t=>{let i={name:t.name,alias:t.name,type:t.type};return new l({profile:this._profile,declaration:{type:W(i,{supportGeometryFields:!0})},label:t.name,description:[t.serverType,ot(this._profile?.intlStrings,t.nullable)].filter(Boolean).join(" | "),snippet:$e(t.name,this._dialectSpec),icon:k(i),filterDescription:!0})})}catch(e){h("error","DataCatalogDatastoreTableVariable","Error loading dataset",{detail:{error:e,dataset:this.datasetInfo}}),this._fieldInfos=[]}finally{this._loaded=!0}return this._fieldInfos}toProfileVariableDefinition(){return{type:"dictionary",name:this.datasetInfo.name,description:this.datasetInfo.type}}},Me=class extends C{constructor(e,t,i="en",r={}){super(void 0,{profile:null,declaration:{properties:[]}}),this.definition=e,this.intlStrings=t,this.locale=i,this.policy=r,this.variables=[],this._profile=this,this.loadPropertyDeclarations(e?.variables)}get supportFeatureSetFunctions(){return this.definition?.bundles?.includes("data-access")??!1}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map(e=>e.toProfileVariableDefinition())}}},nt={locale:"en"},Ee=class{constructor(e,t){this.languageId=e,this._apiConfig=t,this._onDidChange=new B,this._modelToProfileMap=new Map,this._modelToApiContextMap=new Map,this._localeToApiLibraryPromiseMap=new Map,this._onModelContextDidChange=new B,this._onDidModelContextChangeTimeout=-1,Ce().then(i=>{i.onWillDisposeModel(r=>{this.disposeForModel(r.uri)})})}_fireModelContextDidChange(e){this._onDidModelContextChangeTimeout===-1&&(this._onDidModelContextChangeTimeout=window.setTimeout(()=>{this._onDidModelContextChangeTimeout=-1,this._onModelContextDidChange.fire(e)},0))}_getApiKey(e){return z.isUri(e)||(e=z.parse(e)),e.toString()}getWorkerHostExtension(){}get onDidChange(){return this._onDidChange.event}disposeForModel(e){let t=this._getApiKey(e);this._modelToProfileMap.delete(t),this._modelToApiContextMap.delete(t)&&this._fireModelContextDidChange(t)}getEditorProfileForModel(e){return this._modelToProfileMap.get(this._getApiKey(e))}getApiContextForModel(e){return this._modelToApiContextMap.get(this._getApiKey(e))??nt}updateApiContextForModel(e,t){let i=this._getApiKey(e),r=this._modelToApiContextMap.get(i)??{};this._modelToApiContextMap.set(i,{...r,...t}),this._fireModelContextDidChange(i)}get onModelContextDidChange(){return this._onModelContextDidChange.event}async getApiLibraryForModel(e){let t=this.getApiContextForModel(e),i=this.getApiLibrary(t.locale??"en");return(await De(i,t)).categories}get workerHost(){if(!this._workerHost){let e=Object.assign({getApiLibrary:async t=>await this.getApiLibrary(t),getLanguageId:()=>this.languageId},this.getWorkerHostExtension());this._workerHost=e}return this._workerHost}async fetchApiLibrary(e){try{let{apiPath:t,apiPrefix:i}=this._apiConfig,r=oe(`${t}/${i}${e}.json`),a=await fetch(r);return a.ok?await a.json():[]}catch{return[]}}async getApiLibrary(e){let t=O(e);return this._localeToApiLibraryPromiseMap.has(t)||this._localeToApiLibraryPromiseMap.set(t,this.fetchApiLibrary(t)),await this._localeToApiLibraryPromiseMap.get(t)??[]}};return{a:j,b:u,c:Te,d:Je,e:Xe,f:Ze,g:At,h:$e,i:it,j:Ot,k:re,l:Nt,m:qt,n:ee,o:Me,p:Ee}},"portal/PortalItem","WebMap","WebScene","layers/FeatureLayer","applications/Components/arcadeEditorUtils","core/Error","portal/Portal",a)
|
|
12
|
+
'${r.name}`),i.push({name:r.name,description:r.name,type:"array",completion:{label:r.name,detail:r.name,insertText:re(r.name,!1),insertTextMode:$.asIs,insertTextFormat:E.PlainText,kind:M.Field}})}),[i,t]}var L=class{constructor(e,t,i){this._profile=e,this._label=t,this.description=i,this.filterDescription=!1}getLabel(){return this._label==null?"":typeof this._label=="string"?ae(this._label):A(this._profile?.intlStrings[this._label.code],this._label.formatValues)}getDescription(){return this.description==null?"":typeof this.description=="string"?this.description:A(this._profile?.intlStrings[this.description.code],this.description.formatValues)}passFilter(e){return!e||e.test(this.getLabel())?!0:this.filterDescription&&e.test(this.getDescription())}},F=class extends L{constructor(e){super(e.profile,e.label,e.description??e.declaration?.description),this.declaration=e.declaration??{},this.name=e.declaration?.name??"",this.snippet=e.snippet??"",this.nonInteractive=e.nonInteractive??!1,this.filterDescription=e.filterDescription??!1,this.icon=e.icon}},l=class extends F{constructor(e){super(e),this.type="text",this.isCollection=!1,this.type=e.declaration?.type??"text"}getDescription(){return this.description==null?this._profile?.intlStrings[this.type.toLowerCase()]??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}},Q=class extends F{constructor(e){super(e),this.type="array",this.isCollection=!1,this.elementType=e.declaration?.elementType??{type:"number",name:"number"}}getDescription(){return this.description==null?this._profile?.intlStrings[this.type.toLowerCase()]??"":super.getDescription()}toProfileVariableDefinition(){return{type:this.type,elementType:this.elementType,name:"",...this.declaration}}},f=class extends F{constructor(e,t){super(t),this.owner=e,this.isCollection=!0,this._loaded=!0,this.variables=[]}get breadcrumb(){if(this.owner){let e=this.owner.breadcrumb;return e?`${e} / ${this.name}`:this.name}return this.name}get loaded(){return this._loaded}get informationUrl(){return null}get informationType(){return""}},p=class extends L{constructor(e,t,i=[],r=!1){super(e,t),this.variables=i,this.isHeader=r,this.type="group",this.isCollection=!0}passFilter(){return!0}},C=class s extends f{constructor(e,t){super(e,t),this.type="dictionary",this.dictionaryVariables=[],this.loadPropertyDeclarations(t.declaration?.properties),this.snippet&&this.dictionaryVariables.length&&(this.variables=[new p(this._profile,this.snippet,this.dictionaryVariables)])}async loadSource(){}loadPropertyDeclarations(e){this.dictionaryVariables=this.createVariableInstances(e),this.variables=this.dictionaryVariables}createVariableInstances(e){if(!Array.isArray(e))return[];let t=[];return e.forEach(i=>{let r=this.createVariableInstance(i);r&&t.push(r)}),t}createVariableInstance(e){let t=Le(this.snippet,e.name);switch(e.type){case"number":case"text":case"boolean":case"date":case"dateOnly":case"time":case"geometry":case"knowledgeGraph":return new l({profile:this._profile,declaration:e,label:t,snippet:t});case"pixel":return new Y(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"voxel":return new X(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"feature":return new J(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"featureSet":return new I(this,{profile:this._profile,declaration:e,label:t,snippet:t},[new l({profile:this._profile,label:t,description:"",snippet:t})]);case"featureSetCollection":return new Z(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"dictionary":return new s(this,{profile:this._profile,declaration:e,label:t,snippet:t});case"array":return new Q({profile:this._profile,declaration:e,label:t,snippet:t});case"dataCatalogDatastore":return new ee(this,{profile:this._profile,declaration:e,label:t,snippet:t});default:return h("error","Editor profile","Invalid profile variable",{detail:{declaration:e}}),null}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,properties:this.dictionaryVariables.map(e=>e.toProfileVariableDefinition())}}},V=class extends f{constructor(e,t,i){super(e,t),this.relationshipsProperties=i,this._source=null,this._loaded=!1,this._definition=t.declaration?.definition}get title(){return d(this._source)?this._source.title??"":""}get url(){return ue(this._source)?this._source.url??"":""}get informationUrl(){return!this.loaded||!this.url?null:de(this._source)?`${this.url}/${this._source.layerId}`:this.url}get informationType(){return this._profile?.intlStrings.layer??"layer"}async loadSource(){return m(this._loadPromise)&&S(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}_getValueSnippet(e){return["feature","voxel","pixel"].includes(this.type)?Le(this.snippet,e.name):e.name}_getSubtypeOrDomainNameSnippet(e){return this.type!=="feature"?null:b(this._source)&&e.name===this._source.subtypeField?`SubtypeName(${this.snippet})`:`DomainName(${this.snippet}, "${e.name}")`}_getFieldProperty(e,t){let i=this._getDomainDictionary(e);if(i)return i;let r=this._getValueSnippet(e);return new l({profile:this._profile,label:r,description:D(e),snippet:r,icon:k(e,t),filterDescription:!0})}_getMemberProperty(e){let t=this._getValueSnippet(e);return new l({profile:this._profile,label:t,description:e.name,snippet:t,icon:Fe(e),filterDescription:!0})}_getDomainDictionary(e){return U(this._source)?b(this._source)&&this._source.subtypeField?this._getSubtypeDomainDictionary(e):P(this._source)&&this._source.typeIdField?this._getFeatureTypeDomainDictionary(e):this._getFieldDomainDictionary(e):null}_getSubtypeDomainDictionary(e){if(!b(this._source))return null;if(!fe(this._source))return e.name===this._source.subtypeField?null:this._getFieldDomainDictionary(e);if(e.name===this._source.subtypeField){let r=this._createDomainDictionary(e);return r.icon="subtype",r.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.subtypes,e)),r}if(xe(this._source.subtypes,e))return this._getFieldDomainDictionary(e);let t=this._getDomainValuesGroup(this._source.subtypes,e);if(!t)return null;let i=this._createDomainDictionary(e);return i.variables.push(t),i}_getFeatureTypeDomainDictionary(e){if(!P(this._source))return null;if(e.name===this._source.typeIdField){let r=this._createDomainDictionary(e);return r.variables.push(this._getTypeOrSubtypeDomainGroup(this._source.types,e)),r}if(xe(this._source.types,e))return this._getFieldDomainDictionary(e);let t=this._getDomainValuesGroup(this._source.types,e);if(!t)return null;let i=this._createDomainDictionary(e);return i.variables.push(t),i}_getFieldDomainDictionary(e){if(!U(this._source))return null;let t=this._source.getFieldDomain(e.name);if(!x(t))return null;let i=this._getCodedValueDomainGroup(t,{code:"domainvalues"}),r=this._createDomainDictionary(e);return r.variables.push(i),r}_getTypeOrSubtypeDomainGroup(e,t){if(x(t.domain))return this._getCodedValueDomainGroup(t.domain,{code:"subtypes"});let i=e?.map(r=>{let a=q(r)?r.code:r.id;return new l({profile:this._profile,label:`${a}`,description:r.name,snippet:`"${a}"`})})??[];return new p(this._profile,{code:"subtypes"},i)}_getCodedValueDomainGroup(e,t){let i=e.codedValues.map(r=>new l({profile:this._profile,label:`${r.code}`,description:r.name,snippet:`"${r.code}"`,filterDescription:!0}));return new p(this._profile,t,i)}_getDomainValuesGroup(e,t){let i=[];return!e||e.length===0||(e.forEach(r=>{let a=r.domains?.[t.name];if(!a||he(a)||!x(a))return;let n=D(t),_=this._getCodedValueDomainGroup(a,{code:"domainvaluesfortypeformat",formatValues:{fieldName:n,typeName:r.name}}),o=q(r)?r.code:r.id,c=`${o}`,T=`"${o}""`,y=new C(this,{profile:this._profile,label:c,snippet:T,description:r.name,declaration:{name:n}});y.variables=[_],i.push(y)}),!i.length)?null:new p(this._profile,{code:"domainvaluesbysubtypes"},i)}_createDomainDictionary(e){let t=this._getValueSnippet(e),i=D(e),r=new C(this,{profile:this._profile,label:t,description:i,snippet:t,icon:"form-dropdown",declaration:{name:e.name}}),a=new p(this._profile,i,[new l({profile:this._profile,label:t,description:"",snippet:t})]);r.variables=[a];let n=this._getSubtypeOrDomainNameSnippet(e);return n&&a.variables.push(new l({profile:this._profile,label:n,description:"",snippet:n})),r}async _getRelationshipsProperty(){if(!this.relationshipsProperties?.exposeRelationships||!this._profile?.supportFeatureSetFunctions)return null;let e=this._source;if(!me(e))return null;let t=new p(this._profile,{code:"relationships"}),i=await Promise.all(e.relationships?.map(async r=>{let a=await st(e,r);if(!O(a)||r.relatedTableId===this.relationshipsProperties?.sourceTableId)return null;let n=`FeatureSetByRelationshipName(${this.snippet}, "${r.name}")`;return new I(this,{profile:this._profile,declaration:{definition:a},label:a.title,description:"",nonInteractive:!0},[new l({profile:this._profile,label:n,description:"",snippet:n})],{exposeRelationships:!0,sourceTableId:e.layerId})})??[]);return t.variables=i.filter(m),t.variables.length?t:null}},v=class extends V{constructor(e,t,i,r={exposeRelationships:!0}){super(e,t,r),this.type=i}get title(){return d(this._source)?this._source.title??"":{code:this.type}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration}}},J=class extends v{constructor(e,t){super(e,t,"feature",{exposeRelationships:!0}),this.type="feature"}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await G(this._definition),!this._source)throw new Error("Invalid definition");let e=d(this._source)?this._source.title??"":"";this.variables.push(new p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new p(this._profile,{code:"values"});if(this.variables.push(t),ye(this._source)){let a=`Geometry(${this.snippet})`,n=new l({profile:this._profile,declaration:{name:a},label:a,description:"Geometry",snippet:a,icon:"shapes",filterDescription:!0});t.variables.push(n)}let i=this._source;w(this._source.fields).map(a=>i.fields.find(n=>n.name===a.name)).sort(ie(i)).forEach(a=>{t.variables.push(this._getFieldProperty(a))});let r=await this._getRelationshipsProperty();r&&this.variables.push(r)}catch(e){h("error","FeatureVariable","Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}},X=class extends v{constructor(e,t){super(e,t,"voxel",{exposeRelationships:!1}),this.type="voxel",this._source=null}async _loadSource(){if(this.loaded)return this._source;try{if(!be(this._definition))throw new Error("Invalid definition - not a VoxelLayer");if(await this._definition.load(),this._source=this._definition,!this._source)throw new Error("Invalid definition");let e=d(this._source)?this._source.title??"":"";this.variables.push(new p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new p(this._profile,{code:"values"});this.variables.push(t);let i=await Oe(this._source),r=this._source;w(this._source.fields).map(a=>r.fields.find(n=>n.name===a.name)).sort(ie(r)).forEach(a=>{t.variables.push(this._getFieldProperty(a,i))})}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}},Y=class extends v{constructor(e,t){super(e,t,"pixel",{exposeRelationships:!1}),this.type="pixel",this._source=null}async _loadSource(){if(this.loaded)return this._source;try{if(!R(this._definition))throw new Error("Invalid definition - not an ImageryLayer");if(await this._definition.load(),this._source=this._definition,!this._source)throw new Error("Invalid definition");let e=d(this._source)?this._source.title??"":"";this.variables.push(new p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]));let t=new p(this._profile,{code:"values"});if(this.variables.push(t),!R(this._source))throw new Error("Invalid definition - not an ImageryLayer");(await qe(this._source)).forEach(i=>{t.variables.push(this._getMemberProperty(i))})}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}},I=class extends V{constructor(e,t,i=[],r){super(e,t,r),this.featureSetSnippets=i,this.type="featureSet"}get title(){return d(this._source)?this._source.title??"":{code:"featureset"}}async _loadSource(){if(this.loaded)return this._source;try{if(this._source=await G(this._definition),!this._source)throw new Error("Invalid definition");this.variables.push(new p(this._profile,this.title,this.featureSetSnippets,!0));let e=new p(this._profile,{code:"fields"});this.variables.push(e);let t=this._profile?.policy,i=t&&"allowGeometryFields"in t?t.allowGeometryFields??!1:!1;e.variables=w(this._source.fields,{supportGeometry:i}).sort(ie(this._source)).map(a=>this._getFieldProperty(a));let r=await this._getRelationshipsProperty();r&&this.variables.push(r)}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._source=null}finally{this._loaded=!0}return this._source}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}},Z=class extends f{constructor(e,t){super(e,t),this.type="featureSetCollection",this._featureSetCollections=null,this._loaded=!1,this._definition=t.declaration?.definition}get informationUrl(){return!this.loaded||!this._featureSetCollections?null:typeof this._featureSetCollections.source!="string"?Se(Pe(this._featureSetCollections.source)):null}get informationType(){if(!this.loaded||!this._featureSetCollections)return"";if(typeof this._featureSetCollections.source=="string")return this._profile?.intlStrings.featureservice??"featureservice";switch(this._featureSetCollections.source.declaredClass){case"esri.WebMap":return this._profile?.intlStrings.webmap??"webmap";case"esri.WebScene":return this._profile?.intlStrings.webscene??"webscene";default:return this._profile?.intlStrings.map??"map"}}async loadSource(){return m(this._loadPromise)&&S(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}async _loadSource(){if(this.loaded)return this._featureSetCollections;try{if(this._featureSetCollections=await this._featureSetCollectionsFromDefinition(),!this._featureSetCollections)throw new Error("Invalid definition");let e=typeof this._featureSetCollections.source=="string"?{code:this._featureSetCollections.source.endsWith("FeatureServer")?"featureservice":"mapservice"}:{code:"webmapformat",formatValues:{webMapTitle:Pe(this._featureSetCollections.source)?.title||"Untitled map"}},t=new p(this._profile,e,[new l({profile:this._profile,label:this.snippet,description:"",snippet:this.snippet})]),i=new p(this._profile,{code:"layers"},this._featureSetCollections.layers),r=new p(this._profile,{code:"tables"},this._featureSetCollections.tables);this.variables.push(t,i,r)}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._featureSetCollections=null}finally{this._loaded=!0}return this._featureSetCollections}async _featureSetCollectionsFromDefinition(){return this._definition?ne(this._definition)?await this._featureSetCollectionFromMap(this._definition):ce(this._definition)?await this._featureSetCollectionFromUrl(this._definition.url):pe(this._definition)?await this._featureSetCollectionFromPortalItem(this._definition.portalItem):null:null}async _featureSetCollectionFromMap(e){le(e)&&await e.loadAll(),await Promise.all(e.allTables.map(async r=>await r.load()));let t=this._profile?.policy,i=t&&"filterFsCollectionLayersFromMap"in t&&t.filterFsCollectionLayersFromMap?t.filterFsCollectionLayersFromMap:()=>!0;return{layers:this._convertWebMapLayersToVariables(e.allLayers.filter(i)),tables:this._convertWebMapLayersToVariables(e.allTables),source:e}}async _featureSetCollectionFromPortalItem(e){let t=new Ve(e);switch(await t.load(),t.type){case"Web Map":{let i=new Ae({portalItem:t});return await this._featureSetCollectionFromMap(i)}case"Web Scene":{let i=new Ne({portalItem:t});return await this._featureSetCollectionFromMap(i)}case"Feature Service":return await this._featureSetCollectionFromUrl(t.url);default:return h("error",this.type,"Unsupported portal item",{detail:{definition:e}}),null}}async _featureSetCollectionFromUrl(e){let t=e?.replace(/\/featureserver\/[0-9]*/iu,"/FeatureServer");if(t=t?.replace(/\/mapserver\/[0-9]*/iu,"/MapServer"),t=t?.split("?")[0],!t)return null;let i=await we(t),r=Promise.all(i.layers.map(async o=>{let c=new K({url:`${t}/${o.id}`});return await c.load(),this._createFeatureSetVariable(c)})),a=Promise.all(i.tables.map(async o=>{let c=new K({url:`${t}/${o.id}`});return await c.load(),this._createFeatureSetVariable(c)})),[n,_]=await Promise.all([r,a]);return{layers:n,tables:_,source:t}}_convertWebMapLayersToVariables(e){let t=[];return e.toArray().reverse().forEach(i=>{if(O(i)){t.push(this._createFeatureSetVariable(i,!0));return}}),t}_createFeatureSetVariable(e,t=!1){return new I(this,{profile:this._profile,declaration:{name:e.title??"",definition:e},label:t?e.title:e.sourceJSON.name??e.title,description:"",nonInteractive:!0},this._makeFeatureSetSnippets(e,t))}_makeFeatureSetSnippets(e,t=!1){if(!this._profile?.supportFeatureSetFunctions)return[];if(t){let i=`FeatureSetById(${this.snippet}, "${e.id}")`,r=`FeatureSetByName(${this.snippet}, "${e.title}")`;return[new l({profile:this._profile,label:i,description:"",snippet:i}),new l({profile:this._profile,label:r,description:"",snippet:r})]}else{let i=`FeatureSetById(${this.snippet}, "${e.layerId}")`;return[new l({profile:this._profile,label:i,description:"",snippet:i})]}}toProfileVariableDefinition(){return{type:this.type,name:"",...this.declaration,definition:this._definition}}},ee=class extends f{constructor(e,t){super(e,t),this.type="dataCatalogDatastore",this._catalogDatastore=null,this._datastore=null,this._loaded=!1,this._definition=t.declaration?.definition}_serializeDefinitionFromInstance(e){return{id:e.itemId??"",serviceUrl:e.serviceUrl??"",portal:{url:e.portal?.url??""}}}_getSerializedDefinition(){let e=this.declaration.definition;if(e)return g(e)?e:this._serializeDefinitionFromInstance(e);if(g(this._definition))return this._definition;if(this._catalogDatastore)return this._serializeDefinitionFromInstance(this._catalogDatastore);if(this._definition)return this._serializeDefinitionFromInstance(this._definition)}async loadSource(){return m(this._loadPromise)&&S(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadSource(),await this._loadPromise)}async _loadSource(){if(this.loaded)return this._datastore;try{if(!this._definition)throw new Error("No definition provided");g(this._definition)?this._catalogDatastore=await this._dataCatalogDatastoreFromDefinition(this._definition):this._catalogDatastore=this._definition;let e=this._catalogDatastore;if(!e)throw new Error("Invalid definition");let t=await e.fetchInfo();this._datastoreInfo=t;let i=await e.fetchDatasets(),r=await rt(t.databasePlatform),a=i.map(n=>new te(this,{profile:this._profile,declaration:{name:n.name},label:n.name,description:n.type,snippet:it(n.name,r)},e,n,r));this.variables=a,this._datastore={tables:a,source:g(this._definition)?this._definition:e,info:t}}catch(e){h("error",this.type,"Error with definition",{detail:{error:e,definition:this._definition}}),this._datastore=null}finally{this._loaded=!0}return this._datastore}get datastoreInfo(){return this._datastoreInfo}get tableVariables(){return this.variables.filter(ge)}async _dataCatalogDatastoreFromDefinition(e){let t=new Re({url:e.portal.url});return await t.load(),new j({itemId:e.id,serviceUrl:e.serviceUrl,portal:t})}toProfileVariableDefinition(){let e=this.declaration,t=this._getSerializedDefinition();return{type:this.type,name:"",...e,...t?{definition:t}:{}}}},te=class extends f{constructor(e,t,i,r,a){super(e,t),this._catalogDatastore=i,this.datasetInfo=r,this._dialectSpec=a,this.type="dictionary",this._fieldInfos=[],this._loaded=!1}get fieldInfos(){return this._fieldInfos}async loadSource(){return m(this._loadPromise)&&S(this._loadPromise)?await this._loadPromise:(this._loadPromise=this._loadFields(),await this._loadPromise)}async _loadFields(){if(this.loaded)return this._fieldInfos;try{let e=await this._catalogDatastore.fetchTableDescription(this.datasetInfo.name);this._fieldInfos=e.fields,this.variables=this._fieldInfos.map(t=>{let i={name:t.name,alias:t.name,type:t.type};return new l({profile:this._profile,declaration:{type:W(i,{supportGeometryFields:!0})},label:t.name,description:[t.serverType,ot(this._profile?.intlStrings,t.nullable)].filter(Boolean).join(" | "),snippet:$e(t.name,this._dialectSpec),icon:k(i),filterDescription:!0})})}catch(e){h("error","DataCatalogDatastoreTableVariable","Error loading dataset",{detail:{error:e,dataset:this.datasetInfo}}),this._fieldInfos=[]}finally{this._loaded=!0}return this._fieldInfos}toProfileVariableDefinition(){return{type:"dictionary",name:this.datasetInfo.name,description:this.datasetInfo.type}}},Me=class extends C{constructor(e,t,i="en",r={}){super(void 0,{profile:null,declaration:{properties:[]}}),this.definition=e,this.intlStrings=t,this.locale=i,this.policy=r,this.variables=[],this._profile=this,this.loadPropertyDeclarations(e?.variables)}get supportFeatureSetFunctions(){return this.definition?.bundles?.includes("data-access")??!1}toEditorProfileDefinition(){return{...this.definition,variables:this.dictionaryVariables.map(e=>e.toProfileVariableDefinition())}}},nt={locale:"en"},Ee=class{constructor(e,t){this.languageId=e,this._apiConfig=t,this._onDidChange=new B,this._modelToProfileMap=new Map,this._modelToApiContextMap=new Map,this._localeToApiLibraryPromiseMap=new Map,this._onModelContextDidChange=new B,this._onDidModelContextChangeTimeout=-1,Ce().then(i=>{i.onWillDisposeModel(r=>{this.disposeForModel(r.uri)})})}_fireModelContextDidChange(e){this._onDidModelContextChangeTimeout===-1&&(this._onDidModelContextChangeTimeout=window.setTimeout(()=>{this._onDidModelContextChangeTimeout=-1,this._onModelContextDidChange.fire(e)},0))}_getApiKey(e){return H.isUri(e)||(e=H.parse(e)),e.toString()}getWorkerHostExtension(){}get onDidChange(){return this._onDidChange.event}disposeForModel(e){let t=this._getApiKey(e);this._modelToProfileMap.delete(t),this._modelToApiContextMap.delete(t)&&this._fireModelContextDidChange(t)}getEditorProfileForModel(e){return this._modelToProfileMap.get(this._getApiKey(e))}getApiContextForModel(e){return this._modelToApiContextMap.get(this._getApiKey(e))??nt}updateApiContextForModel(e,t){let i=this._getApiKey(e),r=this._modelToApiContextMap.get(i)??{};this._modelToApiContextMap.set(i,{...r,...t}),this._fireModelContextDidChange(i)}get onModelContextDidChange(){return this._onModelContextDidChange.event}async getApiLibraryForModel(e){let t=this.getApiContextForModel(e),i=this.getApiLibrary(t.locale??"en");return(await De(i,t)).categories}get workerHost(){if(!this._workerHost){let e=Object.assign({getApiLibrary:async t=>await this.getApiLibrary(t),getLanguageId:()=>this.languageId},this.getWorkerHostExtension());this._workerHost=e}return this._workerHost}async fetchApiLibrary(e){try{let{apiPath:t,apiPrefix:i}=this._apiConfig,r=oe(`${t}/${i}${e}.json`),a=await fetch(r);return a.ok?await a.json():[]}catch{return[]}}async getApiLibrary(e){let t=N(e);return this._localeToApiLibraryPromiseMap.has(t)||this._localeToApiLibraryPromiseMap.set(t,this.fetchApiLibrary(t)),await this._localeToApiLibraryPromiseMap.get(t)??[]}};return{a:j,b:u,c:Te,d:Je,e:Xe,f:Ze,g:At,h:$e,i:it,j:Nt,k:re,l:Ot,m:qt,n:ee,o:Me,p:Ee}},"portal/PortalItem","WebMap","WebScene","layers/FeatureLayer","applications/Components/arcadeEditorUtils","core/Error","portal/Portal",a)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import c from"./
|
|
2
|
+
import c from"./GATL6PSW.js";import a from"./STN3LSQR.js";import{j as f}from"./BHSILWSL.js";import{b as y,c as h,d as b}from"./BZWB7A55.js";import{M as u}from"./SMZ3LNZE.js";export default $arcgis.t(([{i:m,n:l},{l:g,o:F,p:w}])=>{var T={allowAllRootBinaryOperators:!1,requiresPredicateRootNode:!1},M={"field-calculation":T,"where-clause":{allowAllRootBinaryOperators:!0,requiresPredicateRootNode:!0,allowGeometryFields:!0}};function I(i){return i&&i in M?M[i]:void 0}var L=i=>{let r=i.variables[0],t=r?.type==="featureSet"?_(r):void 0,{apiVersion:e,bundles:a,hiddenApiItems:o}=i.toEditorProfileDefinition();return{apiVersion:e,bundles:a,variables:t?[t]:[],hiddenApiItems:o?.map(s=>s.toLowerCase())}};function _(i){let{name:r}=i,t=i.getDescription(),{definition:e}=i.toProfileVariableDefinition(),a={label:r,detail:r,insertText:r,insertTextMode:b.asIs,insertTextFormat:h.PlainText,kind:y.Field},o={name:r,description:t,type:"dictionary",properties:[],completion:a};if(!e||!("fields"in e))return o;let[s,n]=g(e.fields,t,{includeAliases:!1,supportGeometryFields:!0});return o.properties=s,a.documentation={kind:"markdown",value:n},o}var v=[{name:"$layer",type:"featureSet",description:"The layer being calculated."}],q={"field-calculation":{id:"field-calculation",variables:v},"where-clause":{id:"where-clause",variables:v}};function E(i){return q[i]??null}function S(i){if(!l(i))return;let r=E(i.id);if(!r)return;let t={variables:[],hiddenApiItems:i.hiddenApiItems?.map(e=>e.toLowerCase())};return r.variables.forEach(e=>{if(i.disabledVariables?.includes(e.name))return;let a=i.definitions[e.name];if(e.type==="featureSet")return m(a)?t.variables.push({...e,type:e.type,definition:a}):void 0;throw Error(`sdkVariable type not supported (yet) type: ${e.type}`)}),t}var A="arcgis-sql-expression",p=class extends w{constructor(){super(A,{apiPath:"./assets/sql-language/api",apiPrefix:"sql-api.t9n."}),this._languageId=A,this._layerMap=new Map}updateFeatureLayerForModel(r,t){let e=this._getApiKey(r);this._layerMap.set(e,t)}getFeatureLayerForModel(r){let t=this._getApiKey(r);return this._layerMap.get(t)}async setProfileForModel(r,t,e={locale:"en"}){let a=l(t)?I(t.id):void 0;l(t)&&(t=S(t));let o=await f(e.locale,u("./assets/editor-profile/t9n"),"messages.");if(!o)throw new Error(`Failed to load the language bundle for ${e.locale}`);this.disposeForModel(r);let s=this._getApiKey(r),n=new F(t,o,e.locale,a);this._modelToProfileMap.set(s,n);let x=L(n);this.updateApiContextForModel(r,{locale:e.locale,profile:x,...a?{profilePolicy:a}:{}});let c=t?.variables?.find(P=>P.name==="$layer");c&&this.updateFeatureLayerForModel(r,c.definition)}},d=new p,K={setProfileForModel:d.setProfileForModel.bind(d),getApiLibraryForModel:d.getApiLibraryForModel.bind(d)};async function B(){return await import("./LJQ7Y6HB.js").then(m=>m.default)}return{a:d,b:B}},a,c)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import d from"./
|
|
2
|
+
import d from"./6EN2C75J.js";import c from"./KUL43ADE.js";import b from"./GATL6PSW.js";import"./VYEWIX5W.js";import a from"./STN3LSQR.js";import"./MZMKV7FA.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import"./SMZ3LNZE.js";import"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,,{a:a,b:b,c:c}])=>{return{getSqlExprDiagnosticService:b,getSqlExprWorker:a,setupMode:c}},a,b,c,d)
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{b as x}from"./43C5J4GE.js";import e from"./
|
|
2
|
+
import{b as x}from"./43C5J4GE.js";import e from"./SUFCEUFA.js";import c from"./GATL6PSW.js";import{c as v}from"./VYEWIX5W.js";import a from"./STN3LSQR.js";import"./MZMKV7FA.js";import{a as S}from"./E57Q2B63.js";import"./VK7LOSQ5.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as _,G as b,H as u,I as f,L as E,h as g,j as o,n as d,t as m}from"./SMZ3LNZE.js";import{b as r}from"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,,,,,,{E:n},{c:c},{a:$,b:y,c:I,d:P}])=>{var B=g`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,p=class extends u{constructor(){super(...arguments),this._codeEditorElt=_(),this._disposables=[],this._modelId=m(),this.messages=S(),this._preparing=!1,this._resolvedLanguage=c,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.openedSidePanel="none",this.arcgisDiagnosticsChange=d({bubbles:!1}),this.arcgisScriptChange=d({bubbles:!1})}static{this.properties={_editorProfile:16,_preparing:16,_resolvedLanguage:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5,messageOverrides:0,openedSidePanel:3,editorOptions:0,editorInstance:32}}static{this.styles=[B]}get editorInstance(){return this._codeEditorElt.value?.editorInstance}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateDataModelDeps().catch(r(this))}willUpdate(e){e.has("profile")&&this._updateDataModelDeps().catch(r(this))}async loaded(){let e=x();this._disposables.push(e.onDiagnosticsChange(t=>{t.uri.toString()===this._modelId&&!this._preparing&&this.arcgisDiagnosticsChange.emit(t.diagnostics)}))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose();P().forEach(e=>e.disposeForModel(this._modelId))}async _updateDataModelDeps(){this._preparing=!0;try{let e=await $(this.profile);e!==this._resolvedLanguage&&(I(this._resolvedLanguage)?.disposeForModel(this._modelId),this._resolvedLanguage=e);let t=y(this._resolvedLanguage);await t.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=t.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0,this._resolvedLanguage=c}finally{this._preparing=!1}}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_toggleSidePanel(e){this.openedSidePanel=this.openedSidePanel===e?"none":e}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}async _onItemSelected(e){e.stopPropagation();let t=this._getSelectedTableVariable(e.detail);if(!t){this._codeEditorElt.value?.insertText(e.detail).catch(r(this));return}await t.loadSource();let a,h=t.fieldInfos.filter(i=>i.type==="geometry"&&!a?(a=i.name,!0):i.type!=="geometry").map(i=>i.name).filter(Boolean),C=`select ${h.length?h.join(", "):"*"} from ${t.snippet}`,s=this._codeEditorElt.value?.editorInstance;v(s,C,"replace",""),s?.getAction("editor.action.formatDocument")?.run();let l=s?.getModel();if(l){let i=l.getLineCount(),L=l.getLineMaxColumn(i);s?.setPosition({lineNumber:i,column:L})}}_getTablesVariable(){return this._editorProfile?.variables.find(n)}_getSelectedTableVariable(e){let t=this._getTablesVariable();if(n(t))return t.tableVariables.find(a=>a.snippet===e)}render(){let e=this._getTablesVariable(),t=String(this.messages.placeholderexample??"Example: {sqlQueryExample}").replace("{sqlQueryExample}","select field1, field2 from db.dataset"),a=`${this.messages.placeholder??"Start filtering data using SQL query syntax"}
|
|
3
3
|
${t}`;return o`<arcgis-code-editor-shell><arcgis-code-editor slot=editor .language=${this._resolvedLanguage} .modelId=${this._modelId} .value=${this.script??""} @arcgisValueChange=${this._onCodeEditorValueChange} .editorOptions=${{placeholder:a,...this.editorOptions}} ${b(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar&&o`<arcgis-editor-variables slot=side-panel .variable=${e} .heading=${this.messages.tables??"Tables"} .messageOverrides=${{profileempty:this.messages.profileempty}} .closed=${this.openedSidePanel!=="variables"} class=${f(this.openedSidePanel==="variables"?"":"hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._onItemSelected} @arcgisInternalClosePanel=${()=>{this.openedSidePanel="none"}} data-panel-name=none></arcgis-editor-variables><calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action id=tables-action .text=${this.messages.tables??"Tables"} icon=table .active=${this.openedSidePanel==="variables"} data-panel-name=variables @click=${()=>this._toggleSidePanel("variables")}></calcite-action>${!this.sideActionBarExpanded&&o`<calcite-tooltip reference-element=tables-action><span>${this.messages.tables??"Tables"}</span></calcite-tooltip>`||""}</calcite-action-bar>`||""}</arcgis-code-editor-shell>`}};E("arcgis-sql-layer-editor",p);return p},"portal/PortalItem","WebMap","WebScene","layers/FeatureLayer","applications/Components/arcadeEditorUtils","core/Error","portal/Portal",a,c,e)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import h from"./O5LFPM4K.js";import e from"./AGTV2YKX.js";import d from"./JE3AYQH2.js";import{e as se}from"./VYEWIX5W.js";import c from"./STN3LSQR.js";import b from"./7Z6G332Z.js";import"./MZMKV7FA.js";import a from"./2WB7S5TQ.js";import{a as te}from"./E57Q2B63.js";import{a as ee}from"./VK7LOSQ5.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import{a as re,b as ce,c as E}from"./VZ6DLSKR.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import{a as ne}from"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as L,G as M,H as Y,I as f,L as J,M as Z,h as W,j as l,l as I,n as T,t as Q,u as X}from"./SMZ3LNZE.js";import{a as G,b as g}from"./BFPEJYVB.js";import{ml as ie,pl as F,ul as ae}from"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([_e,ge,{watch:O},S,{property:c,subclass:A},{a:oe,h:$,i:N},{b:U},,,v,{a:le,b:de}])=>{var xe=W`: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)}}.bottom-action-bar.is-collapsed{border-bottom:0}.bottom-action-bar{display:flex;.bottom-action-bar__actions{flex:1 1 auto;min-inline-size:0}}`,ue="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",p=(t,e)=>{G(t,"Arcade Assistant",e)},pe=["orgAiAssistantsEnabled","betaAppsAllowed","serviceUrlAvailable","userHasUseAiAssistantsPrivilege"],Se=pe,he=(t,e)=>e.every(s=>t[s]===!0),Ae=t=>{let{aiAssistantsEnabled:e}=t;return e===void 0?(p("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},Pe=async t=>(await ge.getCredential(t,{oAuthPopupConfirmation:!1})).token,fe=async t=>{try{return!!await ge.checkSignInStatus(t)}catch{return p("warn","User is not signed in."),!1}};async function ve({portalUrl:t}){t&&p("warn","The arcadeAssistant property is deprecated. Set esriConfig.portalUrl instead of arcadeAssistant.portalUrl.");let e=t||_e.portalUrl;if(!e)return p("warn","Arcade Assistant initialization failed. Reason: missing portal url."),{shouldRender:!1};let s=e.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await fe(s))return{shouldRender:!1};let i=await Pe(e),a=`${s}/sharing/rest/portals/self?f=json&token=${i}`,o=`${s}/sharing/rest/portals/self/settings?f=json&token=${i}`,n=`${s}/sharing/rest/portals/self/signinSettings?f=json&token=${i}`,r=await Promise.allSettled([fetch(a,{credentials:"include"}).then(y=>y.json()),fetch(o,{credentials:"include"}).then(y=>y.json()),fetch(n,{credentials:"include"}).then(y=>y.json())]),[h,u,R]=r,P=h.status==="fulfilled"?h.value:(p("warn",`Failed to fetch selfUrl. Reason: ${h.reason}.`),{}),K=u.status==="fulfilled"?u.value:(p("warn",`Failed to fetch settingsUrl. Reason: ${u.reason}.`),{}),me=R.status==="fulfilled"?R.value:(p("warn",`Failed to fetch signinSettingsUrl. Reason: ${R.reason}.`),{});if(P.isPortal&&!$e(P.enterpriseVersion))return{shouldRender:!1};let j=P.helpBase||"";if(!K)return p("warn","Settings response is not available."),{shouldRender:!1};let B={orgAiAssistantsEnabled:Ae(K),betaAppsAllowed:me.blockBetaApps!==!0,serviceUrlAvailable:!!P?.helperServices?.aiAssistantServices?.url,userHasUseAiAssistantsPrivilege:P?.user?.privileges?.includes("portal:user:useAIAssistants")===!0};B.betaAppsAllowed||p("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),B.userHasUseAiAssistantsPrivilege||p("warn","User does not have the required privileges to use AI Assistants.");let H=he(B,Se),V=he(B,pe),q=P?.helperServices?.aiAssistantServices?.url;return q?{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},serviceUrl:q,helpBase:j,feedbackServiceUrl:ue}:{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},helpBase:j,feedbackServiceUrl:ue}}function $e(t){let e=X(t),[s,i="0"]=e.split("."),a=Number.parseInt(s,10),o=Number.parseInt(i,10);return Number.isNaN(a)||Number.isNaN(o)?!1:a>12||a===12&&o>=2}var ye=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,x=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ee(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ye(e,s,a),a},be=100,b=class extends S{constructor(t){super(t),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=be}};x([c()],b.prototype,"collectionItems",2);x([c()],b.prototype,"errorMessage",2);x([c()],b.prototype,"expanded",2);x([c()],b.prototype,"requestId",2);x([c()],b.prototype,"schemaValue",2);x([c()],b.prototype,"status",2);x([c()],b.prototype,"visibleChildCount",2);b=x([A("ArcadeDebuggerLazyTreeNodeState")],b);var C=class extends S{constructor(t){super(t),this.generation=0,this.nodes=new Map}reset(){this.generation+=1,this.destroyNodes()}ensureNode(t,e=!1,s){let i=this.nodes.get(t);if(i)return i;let a=new b;return a.expanded=e,this.nodes.set(t,a),e&&s&&this.loadNode(t,s),a}setExpanded(t,e,s){let i=this.ensureNode(t,e,s);if(i.expanded===e){e&&s&&this.loadNode(t,s);return}i.expanded=e,e&&s&&this.loadNode(t,s)}showMore(t,e){let s=this.ensureNode(t);s.visibleChildCount>=e||(s.visibleChildCount=Math.min(e,s.visibleChildCount+be))}loadNode(t,e){switch(e.kind){case"collection":this.runLoad(t,e.load,(s,i)=>{s.collectionItems=i});return;case"schema":this.runLoad(t,e.load,(s,i)=>{s.schemaValue=i});return}}runLoad(t,e,s){let i=this.nodes.get(t);if(!i||i.status==="loading"||i.status==="loaded")return;let a=this.generation,o=i.requestId+1;i.requestId=o,i.status="loading",i.errorMessage="",i.schemaValue=void 0,i.collectionItems=[],e().then(n=>{let r=this.nodes.get(t);!r||this.generation!==a||r.requestId!==o||(s(r,n),r.status="loaded")}).catch(()=>{let n=this.nodes.get(t);!n||this.generation!==a||n.requestId!==o||(n.status="error")})}destroyNodes(){for(let t of this.nodes.values())t.destroy();this.nodes.clear()}};C=x([A("ArcadeDebuggerLazyTreeState")],C);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,d=(t,e,s,i)=>{for(var a=i>1?void 0:i?we(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&De(e,s,a),a},_=class extends S{constructor(t){super(t),this.phase="idle",this.sessionId=0,this.consoleLogs=[],this.hasExecuted=!1}get isExecuting(){return this.phase==="running"||this.phase==="debug-running"||this.phase==="debug-paused"}get isDebugging(){return this.phase==="debug-running"||this.phase==="debug-paused"}get isPaused(){return this.phase==="debug-paused"}get runResult(){return this.result?.resultType==="run"?this.result.result:void 0}get debugResult(){return this.result?.resultType==="debug"?this.result.result:void 0}get executionTiming(){return this.result?.timing}addConsoleLog(t){this.consoleLogs=[...this.consoleLogs,t]}};d([c()],_.prototype,"phase",2);d([c()],_.prototype,"mode",2);d([c()],_.prototype,"sessionId",2);d([c()],_.prototype,"result",2);d([c()],_.prototype,"consoleLogs",2);d([c()],_.prototype,"hasExecuted",2);_=d([A("ArcadeDebuggerExecutionModel")],_);var D=class extends S{constructor(t){super(t),this.editorBreakpoints=[],this.executionBreakpoints=[]}setBreakpoints(t,e){t==="editor"?this.editorBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i):this.executionBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i)}toggleBreakpoint(t,e){let s=new Set(t==="editor"?this.editorBreakpoints:this.executionBreakpoints);s.has(e)?s.delete(e):s.add(e),this.setBreakpoints(t,s)}clearBreakpoints(t){t==="editor"?this.editorBreakpoints=[]:this.executionBreakpoints=[]}syncExecutionBreakpointsFromEditor(){this.executionBreakpoints=this.editorBreakpoints}};d([c()],D.prototype,"editorBreakpoints",2);d([c()],D.prototype,"executionBreakpoints",2);D=d([A("ArcadeDebuggerSessionModel")],D);var w=class extends S{constructor(t){super(t),this.openedPanel="output",this.showPanel=!1}};d([c()],w.prototype,"openedPanel",2);d([c()],w.prototype,"showPanel",2);w=d([A("ArcadeDebuggerUiModel")],w);var k=class extends S{constructor(t){super(t)}get line(){return this.pausedState?.line}clearPausedState(){this.lastPausedState=this.pausedState,this.pausedState=void 0}reset(){this.pausedState=void 0,this.lastPausedState=void 0}setPausedState(t){this.pausedState=t,this.lastPausedState=t}};d([c()],k.prototype,"pausedState",2);d([c()],k.prototype,"lastPausedState",2);k=d([A("ArcadeDebuggerPausedFrameModel")],k);var m=class extends S{constructor(t){super(t),this.execution=new _,this.lazyTreeState=new C,this.pausedFrame=new k,this.previewTabsState=new U,this.session=new D,this.ui=new w}get editorBreakpoints(){return this.session.editorBreakpoints}get debuggerBreakpoints(){return this.isPaused?this.session.executionBreakpoints.map(t=>({line:t})):this.session.editorBreakpoints.map(t=>({line:t}))}get executionBreakpoints(){return this.session.executionBreakpoints}get consoleLogs(){return this.execution.consoleLogs}get debug(){if(!(!this.pausedFrame.pausedState&&!this.pausedFrame.lastPausedState))return{pausedState:this.pausedFrame.pausedState,lastPausedState:this.pausedFrame.lastPausedState}}get debugResult(){return this.execution.debugResult}get executionTiming(){return this.execution.executionTiming}get debuggerLine(){return this.pausedFrame.pausedState?.line}get executionState(){return this.pausedFrame.pausedState}get hasExecuted(){return this.execution.hasExecuted}get isDebugging(){return this.execution.isDebugging}get isExecuting(){return this.execution.isExecuting}get isPaused(){return this.execution.isPaused}get mode(){return this.execution.mode}get openedPanel(){return this.ui.openedPanel}get outputRenderer(){if(this.execution.result)return this.execution.result.resultType==="debug"?"debugger":"legacy"}get phase(){return this.execution.phase}get result(){return this.execution.result}get runResult(){return this.execution.runResult}get sessionId(){return this.execution.sessionId}get showPanel(){return this.ui.showPanel}addConsoleLog(t){this.execution.addConsoleLog(t)}clearBreakpoints(t){this.session.clearBreakpoints(t)}clearForMissingTestData(){this.stopDebug({hidePanel:!0}),this.execution.hasExecuted=!1,this.execution.result=void 0}closePanel(){this.ui.showPanel=!1}completeDebug(t,e){this.execution.mode="debug",this.execution.result={resultType:"debug",result:t,...e?{timing:e}:{}},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(t,e={}){this.execution.mode="run",!e.useDebugRenderer&&$(t)?this.execution.result={resultType:"run",result:t}:e.useDebugRenderer&&!$(t)&&(this.execution.result={resultType:"debug",result:t,...e.timing?{timing:e.timing}:{}}),this.execution.phase="completed",this.pausedFrame.reset(),this.ui.openedPanel="output",this.resetTransientDebuggerState()}continueDebug(){let t=this.pausedFrame.pausedState?.continue;t&&(this.execution.phase="debug-running",this.pausedFrame.clearPausedState(),t.resolve())}disableDebugger(){this.stopDebug({hidePanel:!0}),this.clearBreakpoints("execution"),this.clearBreakpoints("editor")}fail(t){this.completeRun(t)}pauseDebug(t){let e=this.pausedFrame.pausedState??this.pausedFrame.lastPausedState;this.syncPausedState(e,t),this.pausedFrame.setPausedState(t),this.execution.phase="debug-paused"}reset(){this.execution.phase="idle",this.execution.mode=void 0,this.execution.result=void 0,this.execution.consoleLogs=[],this.execution.hasExecuted=!1,this.execution.sessionId=0,this.ui.openedPanel="output",this.ui.showPanel=!1,this.pausedFrame.reset(),this.clearBreakpoints("execution"),this.clearBreakpoints("editor"),this.replaceTransientDebuggerState()}resetDebug(){this.stopDebug({hidePanel:!1}),this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="debug-console"}disconnect(){this.stopDebug({hidePanel:!0})}setBreakpoints(t){this.session.setBreakpoints("editor",t)}setPanel(t){this.execution.hasExecuted&&(this.ui.openedPanel=t,this.ui.showPanel=!0)}startDebug(){return this.execution.mode="debug",this.execution.phase="debug-running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.session.syncExecutionBreakpointsFromEditor(),this.execution.consoleLogs=[],this.ui.openedPanel="debug-console",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}startRun(){return this.execution.mode="run",this.execution.phase="running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="output",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}stopDebug({hidePanel:t=!0,invalidateSession:e=!0}={}){let s=this.pausedFrame.pausedState?.continue;e&&(this.execution.sessionId+=1),this.execution.phase=this.execution.hasExecuted?"completed":"idle",this.pausedFrame.reset(),this.resetTransientDebuggerState(),t&&(this.ui.showPanel=!1),this.ui.openedPanel==="debug-console"&&(this.ui.openedPanel="output"),s?.resolve()}syncPausedState(t,e){this.lazyTreeState.reset(),t&&e&&t!==e&&this.previewTabsState.invalidateAll(),this.pausedLine=e?.line}toggleBreakpoint(t){this.session.toggleBreakpoint("editor",t)}togglePanel(t){if(this.execution.hasExecuted){if(t==null){this.ui.showPanel=!this.ui.showPanel;return}if(this.ui.openedPanel===t&&this.ui.showPanel){this.ui.showPanel=!1;return}this.setPanel(t)}}resetTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState.reset(),this.previewTabsState.clear()}replaceTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState=new C,this.previewTabsState=new U}};d([c()],m.prototype,"execution",2);d([c()],m.prototype,"lazyTreeState",2);d([c()],m.prototype,"pausedLine",2);d([c()],m.prototype,"pausedFrame",2);d([c()],m.prototype,"previewTabsState",2);d([c()],m.prototype,"session",2);d([c()],m.prototype,"ui",2);m=d([A("ArcadeDebuggerStore")],m);var ke={glyphMargin:!0,lineNumbersMinChars:1},z=class extends Y{constructor(){super(...arguments),this._codeEditorElt=L(),this._arcadeAssistantElt=L(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._debuggerState=new m,this.messages=te(),this._modelId=Q(),this._openArcadeHelp=()=>{window.open(oe,"Arcade Help")},this._decorations=void 0,this._monacoEditor=ee(ne),this._editorOptions={},this._toggleSidePanel=e=>{e.currentTarget instanceof HTMLElement&&this._setOpenedSidePanel(e.currentTarget.dataset.panelName??"none")},this._closeSidePanel=()=>{this._setOpenedSidePanel("none")},this._updateBreakpointsDecorations=()=>{let e=this.editorInstance;if(!e)return;let s=this._debuggerState.editorBreakpoints.map(i=>({range:new F(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}));this._decorations?.clear(),this._decorations=e.createDecorationsCollection(s)},this._clearDebuggerDecorations=()=>{this._decorations?.clear(),this._decorations=void 0,this._debuggerPausedLineDecoration?.clear(),this._debuggerPausedLineDecoration=void 0},this._debuggerPausedLineDecoration=void 0,this._preparingArcade=!1,this._arcadeAssistantRemoteState={shouldRender:!1},this._diagnostics=[],this.enableDebugger=!1,this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.disableAssistant=!1,this.arcgisDiagnosticsChange=T({bubbles:!1}),this.arcgisScriptChange=T({bubbles:!1})}static{this.properties={_apiLibrary:16,_editorProfile:16,_preparingArcade:16,_arcadeAssistantRemoteState:16,_diagnostics:16,editorInstance:32,editorOptions:0,enableDebugger:5,hideDocumentationActions:5,hideSideBar:5,messageOverrides:0,openedSidePanel:3,profile:0,script:1,sideActionBarExpanded:7,snippets:0,suggestions:0,testData:0,customPanels:0,disableAssistant:5,arcadeAssistant:0,externalExecutor:0}}static{this.styles=[xe]}get _canExecute(){return!!(this.testData||this.externalExecutor)}get _usesBottomExecutionDrawer(){return this._canExecute&&(this.enableDebugger||!!this.externalExecutor)}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...ke,...this._editorOptions}}set editorOptions(e){this._editorOptions=e??{}}async getTestResult(){if(!this.testData)return{type:"error",value:"Missing test data",error:null};let e=await this._editorProfilePromise;if(!e)return{type:"error",value:"Missing editor profile",error:null};await this._componentReadyDefer.promise;let s=this._codeEditorElt.value?.value,i=await N(e.definition,s,this.testData,{mode:"run"});return $(i)?i:{type:"error",value:"Unexpected debug result",error:null}}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async openArcadeAssistant(e){if(!this._arcadeAssistantRemoteState.shouldRender)return!1;if(this.openedSidePanel="arcade-assistant",await this.updateComplete,!this._canPromptWithArcadeAssistant())return!0;let s=this._arcadeAssistantElt.value;return e?.prompt&&await s?.openPrompt(e.prompt),!0}async load(){let e=Z("./assets");le(e),await this._updateDataModelDeps(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(g(this)),()=>{for(this._askAiBindingKey&&(E(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);this._disposables.length;)this._disposables.pop()?.dispose();this._abortExternalExecution(),this._connectMonacoCustomizationsPromise=void 0,this._executeScriptAction=void 0,this._clearDebuggerDecorations(),this._debuggerState.disconnect()}))}willUpdate(e){(e.has("messages")||e.has("profile"))&&this._updateDataModelDeps(),(e.has("testData")||e.has("externalExecutor"))&&this._executionContextChanged(),e.has("enableDebugger")&&!this.enableDebugger&&this._debuggerState.disableDebugger(),e.has("snippets")&&v.updateApiContextForModel(this._modelId,{snippets:this.snippets}),(e.has("arcadeAssistant")||e.has("disableAssistant"))&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve()}_setOpenedSidePanel(e){this.openedSidePanel=e===this.openedSidePanel?"none":e}async _connectMonacoCustomizations(){if(this._connectMonacoCustomizationsPromise)return await this._connectMonacoCustomizationsPromise;this._connectMonacoCustomizationsPromise=(async()=>{if(!this.isConnected)return;let e=await de();this._disposables.push(e.onDiagnosticsChange(r=>{this._preparingArcade||(this._diagnostics=r.diagnostics,this.arcgisDiagnosticsChange.emit(r.diagnostics))})),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._syncAskAiAction();let s=O(()=>this._debuggerState.editorBreakpoints,()=>this._updateBreakpointsDecorations(),{sync:!0}),i=O(()=>this._debuggerState.debuggerLine,()=>this._updateDebuggerPausedLineDecoration(),{sync:!0}),a=O(()=>this._debuggerState.consoleLogs.length,()=>this.requestUpdate(),{sync:!0});this._disposables.push({dispose:()=>s.remove()},{dispose:()=>i.remove()},{dispose:()=>a.remove()});let o=this.editorInstance?.onMouseDown(r=>this._onEditorMouseDown(r));o&&this._disposables.push(o);let n=this.editorInstance?.onDidChangeModelContent(r=>this._onEditorModelContentChange(r));n&&this._disposables.push(n),this._updateBreakpointsDecorations(),this._updateDebuggerPausedLineDecoration()})();try{await this._connectMonacoCustomizationsPromise}finally{this._connectMonacoCustomizationsPromise=void 0}}_onEditorMouseDown(e){if(!this.enableDebugger||![this._monacoEditor.MouseTargetType.GUTTER_GLYPH_MARGIN].includes(e.target.type)||e.target.element?.classList.contains("codicon-gutter-lightbulb"))return;let s=e.target.position?.lineNumber;s&&this._debuggerState.toggleBreakpoint(s)}_onEditorModelContentChange(e){if(!this.enableDebugger||!this._debuggerState.editorBreakpoints.length||e.isFlush)return;let s=se(this._debuggerState.editorBreakpoints,e.changes);s.length===this._debuggerState.editorBreakpoints.length&&s.every((i,a)=>i===this._debuggerState.editorBreakpoints[a])||this._debuggerState.setBreakpoints(s)}_updateDebuggerPausedLineDecoration(){let e=this.editorInstance;if(!e)return;this._debuggerPausedLineDecoration?.clear();let s=this._debuggerState.debuggerLine;s!=null?this._debuggerPausedLineDecoration=e.createDecorationsCollection([{range:new F(s,1,s,1),options:{isWholeLine:!0,className:"arcgis-code-editor__debugger-paused-line",glyphMarginClassName:"arcgis-code-editor__debugger-paused-glyph",marginClassName:"arcgis-code-editor__debugger-paused-line arcgis-code-editor__debugger-paused-margin",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}]):this._debuggerPausedLineDecoration=void 0}_continueDebugSession(){this._debuggerState.continueDebug()}_abortExternalExecution(){this._externalExecutionAbortController?.abort(),this._externalExecutionAbortController=void 0}_stopDebugSession(){this._abortExternalExecution(),this._debuggerState.stopDebug({hidePanel:!1})}_resetDebugSession(){this._abortExternalExecution(),this._debuggerState.resetDebug(),this._executeScript("debug").catch(g(this))}async _handleDebugPause(e,s,i){if(!this._debuggerState.isDebugging||e!==this._debuggerState.sessionId)return;let a=Promise.withResolvers();return this._debuggerState.pauseDebug({line:s.line,result:i,continue:a}),await a.promise}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}async _executeWithExternalExecutor(e,s,i){if(!this.externalExecutor)return{type:"error",value:"Missing external executor",error:null};let a=new AbortController;this._abortExternalExecution(),this._externalExecutionAbortController=a;let o=i.console??(()=>{});try{if(e==="debug"){let{breakpoints:n,onDebugPause:r}=i;if(!n||!r)throw new Error("Missing debug execution options");return await this.externalExecutor.execute({mode:"debug",script:s,console:o,signal:a.signal,breakpoints:n,onDebugPause:r})}return await this.externalExecutor.execute({mode:"run",script:s,console:o,signal:a.signal})}catch(n){return{type:"error",value:(n instanceof Error?n:new Error(String(n))).message??"Execution failed",error:n instanceof Error?n:new Error(String(n)),compilationTime:0,executionTime:0,timeStamp:new Date}}finally{this._externalExecutionAbortController===a&&(this._externalExecutionAbortController=void 0)}}_executionContextChanged(){!this._canExecute&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.openedPanel==="debug-console"&&!this.enableDebugger&&this._debuggerState.closePanel(),this._debuggerState.showPanel&&this._executeScript("run").catch(g(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await v.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=v.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await v.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.setPanel(e)}async _executeScript(e){let s=this.testData,i=this.externalExecutor;if(!this._codeEditorElt.value||!s&&!i)return;let a=e==="debug"?this._debuggerState.startDebug():this._debuggerState.startRun();setTimeout(()=>{(async()=>{let o=this._codeEditorElt.value?.value??this.script,n={mode:e,console:u=>this._debuggerState.addConsoleLog(u),breakpoints:e==="debug"?this._debuggerState.debuggerBreakpoints:void 0};e==="debug"&&(n.onDebugPause=this._handleDebugPause.bind(this,a));let r,h;if(i){let u=await this._executeWithExternalExecutor(e,o,n);"result"in u?(r=u.result,h=u.timing):r=u}else if(s){let u=await this._editorProfilePromise;if(!u){this._debuggerState.fail({type:"error",value:"Missing editor profile",error:null});return}r=await N(u.definition,o,s,n)}else return;if(a===this._debuggerState.sessionId){if(e==="debug"){if($(r)){this._debuggerState.fail(r);return}this._debuggerState.completeDebug(r,h);return}if($(r))this._debuggerState.completeRun(r);else if(i){if(!h){this._debuggerState.fail({type:"error",value:"Missing execution timing",error:null});return}this._debuggerState.completeRun(r,{useDebugRenderer:!0,timing:h})}else this._debuggerState.fail({type:"error",value:"Unexpected debug result",error:null})}})()},0)}_toggleShowExecutionPanel(){this._debuggerState.togglePanel()}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}_insertAsSnippet(e){this._codeEditorElt.value?.insertSnippet(e.detail).catch(g(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(g(this))}_onResultPanelChange(e){let s=e.currentTarget;this._debuggerState.setPanel(s.openedResultPanel)}_onExecutionPanelClose(){this._debuggerState.closePanel()}_addExecuteScriptAction(){let e=this.editorInstance?.addAction({id:"run-script",label:"Run Arcade Expression",keybindings:[ie.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this._canExecute&&this._executeScript("run").catch(g(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_getAskAiBindingKey(){return ae.parse(this._modelId).toString()}_canRenderAskAiCodeActions(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.codeActions:!1}_canPromptWithArcadeAssistant(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.prompting:!1}_getAskAiCodeActions(e){if(!this._canRenderAskAiCodeActions())return[];if(!e.markers.length)return[];let s=this.messages.askarcadeassistant??"Ask Arcade Assistant",i=this._getAskAiBindingKey();return[{title:s,kind:re,diagnostics:e.markers,isPreferred:!1,isAI:!1,command:{id:ce,title:s,arguments:[i,this.messages.askarcadeassistantprompt??"Fix the errors in my script"]}}]}_syncAskAiAction(){if(!this.editorInstance)return;let e=this._getAskAiBindingKey();if(!this._arcadeAssistantRemoteState.shouldRender){this._askAiBindingKey&&(E(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);return}this._askAiBindingKey&&this._askAiBindingKey!==e&&E(this._askAiBindingKey,void 0),E(e,{provideCodeActions:({context:s})=>this._getAskAiCodeActions(s),run:s=>{this.openArcadeAssistant({prompt:s??this.messages.askarcadeassistantprompt??"Fix the errors in my script"}).catch(g(this))}}),this._askAiBindingKey=e}_disposeSafely(e){let s=this._disposables.indexOf(e);s!==-1&&this._disposables.splice(s,1),e.dispose()}async _updateArcadeAssistantRemoteState(){let e=this.arcadeAssistant;this.disableAssistant?this._arcadeAssistantRemoteState={shouldRender:!1}:this._arcadeAssistantRemoteState=await ve(e??{}),this._syncAskAiAction()}renderMainActionBar(){return this._usesBottomExecutionDrawer||!this._canExecute?null:l`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-toggle-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=${()=>{this._executeScript("run").catch(g(this))}}></calcite-action>${this._debuggerState.result?l`<calcite-action .text=${this.messages.lastresults??""} .active=${this._debuggerState.showPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>`:null}</calcite-action-group></calcite-action-bar>`}renderMainPanel(){return l`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${v.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${M(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:s,icon:i,active:a,panelName:o,iconFlipRtl:n=!1,onClick:r=this._toggleSidePanel}){return l`<calcite-action id=${e??I} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${r} data-panel-name=${o??I} .iconFlipRtl=${n}></calcite-action>${!this.sideActionBarExpanded&&l`<calcite-tooltip .referenceElement=${e}><span>${s}</span></calcite-tooltip>`||""}`}renderSideActionBar(){return this.hideSideBar?null:l`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({id:"profile-variables-action",label:this.messages.profilevariables??"",icon:"profile-variables",active:this.openedSidePanel==="variables",panelName:"variables"})}${this.renderAction({id:"function-action",label:this.messages.constantsandfunctions??"",icon:"function",active:this.openedSidePanel==="api",panelName:"api"})}${this.suggestions?.length?this.renderAction({id:"suggestions-action",label:this.messages.suggestions??"",icon:"lightbulb",active:this.openedSidePanel==="suggestions",panelName:"suggestions"}):null}${this._arcadeAssistantRemoteState.shouldRender&&this.renderAction({id:"arcade-assistant-action",label:this.messages.arcadeassistant??"Arcade assistant",icon:"effects",active:this.openedSidePanel==="arcade-assistant",panelName:"arcade-assistant"})||""}${this.customPanels?.map(e=>e.enabled===!1?null:this.renderAction({id:e.id,label:e.name,icon:e.icon,active:this.openedSidePanel===e.id,panelName:e.id}))}${this.hideDocumentationActions?null:this.renderAction({id:"developer-website-action",label:this.messages.help??"",icon:"question",active:!1,panelName:"none",iconFlipRtl:this.messages._lang==="ar",onClick:this._openArcadeHelp})}</calcite-action-group></calcite-action-bar>`}renderSidePanel(){if(this.hideSideBar)return null;let{openedSidePanel:e,_arcadeAssistantRemoteState:s}=this;return l`<arcgis-language-api-panel slot=side-panel class=${f(e==="api"?"":"hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .closed=${e!=="api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${f(e==="variables"?"":"hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e!=="variables"} .messageOverrides=${{profileempty:this.messages.profileempty,profilevariables:this.messages.profilevariables}}></arcgis-editor-variables>${this.suggestions?.length&&l`<arcgis-arcade-suggestions slot=side-panel class=${f(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${s?.shouldRender&&l`<arcgis-arcade-coding-assistant slot=side-panel class=${f(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${s.portalUrl} .serviceUrl=${"serviceUrl"in s?s.serviceUrl:void 0} .helpBase=${s.helpBase} .promptingEnabled=${this._canPromptWithArcadeAssistant()} .feedbackServiceUrl=${s.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant?.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant?.disableQuestionAnswerLogging} .diagnostics=${this._diagnostics} ${M(this._arcadeAssistantElt)}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(i=>l`<calcite-flow slot=side-panel class=${f(e===i.id?"":"hidden")}>${i?.useFlows?i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el}):l`<calcite-flow-item .heading=${i.name} heading-level=2 closable .closed=${e!==i.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${i.description}>${i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el})}</calcite-flow-item>`}</calcite-flow>`)}`}renderResultsPanel(){if(this._usesBottomExecutionDrawer)return this.renderBottomExecutionBody();if(!this._debuggerState.showPanel)return null;let e=this._debuggerState.openedPanel==="debug-console"?"output":this._debuggerState.openedPanel;return l`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.runResult} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`}renderBottomExecutionBody(){let{showPanel:e,openedPanel:s,debugResult:i,isExecuting:a,mode:o}=this._debuggerState;if(!e)return null;let n=s==="debug-console"?"output":s;return this.enableDebugger&&s==="debug-console"?l`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>`:s==="output"&&(o==="debug"||i)?l`<arcgis-arcade-debugger-output .outputTitle=${this.messages.output} slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:l`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${n} .loading=${s==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.runResult} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:s,openedPanel:i,isDebugging:a,isPaused:o,isExecuting:n}=this._debuggerState,r=this.messages.continue??"Continue",h=this.messages.reset??"Reset",u=this.messages.stop??"Stop";return l`<div slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e?"":"is-collapsed"}`}><calcite-action-bar class="bottom-action-bar__actions" layout=horizontal scale=s expand-toggle-disabled expanded><calcite-action-group scale=s>${this.enableDebugger&&a?l`<calcite-action id=debugger-continue-action .text=${r} icon=forward scale=s .disabled=${!o} @click=${this._continueDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-continue-action placement=top><span>${r}</span></calcite-tooltip><calcite-action id=debugger-reset-action .text=${h} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-reset-action placement=top><span>${h}</span></calcite-tooltip><calcite-action id=debugger-stop-action .text=${u} icon=circle-stop scale=s @click=${this._stopDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-stop-action placement=top><span>${u}</span></calcite-tooltip>`:l`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("run").catch(g(this))}}></calcite-action>${this.enableDebugger&&l`<calcite-action .disabled=${this._debuggerState.editorBreakpoints.length===0} .text=${this.messages.runanddebug??"Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("debug").catch(g(this))}}></calcite-action>`||""}`}</calcite-action-group>${s?l`<calcite-action-group scale=s><calcite-action .active=${i==="output"&&e} .text=${this.messages.output??"Output"} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${()=>this._setExecutionPanel("output")}></calcite-action><calcite-action .active=${i==="console"&&e} .text=${this.messages.console??"Console"} text-enabled scale=s icon=console icon-flip-rtl @click=${()=>this._setExecutionPanel("console")}></calcite-action><calcite-action .active=${i==="log"&&e} .text=${this.messages.log??"Log"} text-enabled scale=s icon=list icon-flip-rtl @click=${()=>this._setExecutionPanel("log")} .disabled=${this.enableDebugger&&this._debuggerState.mode==="debug"}></calcite-action>${this.enableDebugger&&l`<calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug Console"} text-enabled scale=s icon=debug-script .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action>`||""}</calcite-action-group>`:null}</calcite-action-bar>${e?l`<calcite-action .text=${this.messages.close??"Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose} slot=actions-end></calcite-action>`:null}</div>`}render(){return l`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};J("arcgis-arcade-editor",z);return z},"config","identity/IdentityManager","core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,c,d,e,h)
|
|
2
|
+
import h from"./O5LFPM4K.js";import e from"./VJVVEOIA.js";import d from"./GATL6PSW.js";import{e as se}from"./VYEWIX5W.js";import c from"./STN3LSQR.js";import b from"./7Z6G332Z.js";import"./MZMKV7FA.js";import a from"./2WB7S5TQ.js";import{a as te}from"./E57Q2B63.js";import{a as ee}from"./VK7LOSQ5.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import{a as re,b as ce,c as E}from"./VZ6DLSKR.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import{a as ne}from"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as L,G as M,H as Y,I as f,L as J,M as Z,h as W,j as l,l as I,n as T,t as Q,u as X}from"./SMZ3LNZE.js";import{a as G,b as g}from"./BFPEJYVB.js";import{ml as ie,pl as F,ul as ae}from"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([_e,ge,{watch:O},S,{property:c,subclass:A},{a:oe,h:$,i:N},{b:U},,,v,{a:le,b:de}])=>{var xe=W`: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)}}.bottom-action-bar.is-collapsed{border-bottom:0}.bottom-action-bar{display:flex;.bottom-action-bar__actions{flex:1 1 auto;min-inline-size:0}}`,ue="https://services6.arcgis.com/HXHga6CfMLMBOlBX/ArcGIS/rest/services/survey123_6e349a50b4504ca6b6107216d568db5f_form/FeatureServer/0",p=(t,e)=>{G(t,"Arcade Assistant",e)},pe=["orgAiAssistantsEnabled","betaAppsAllowed","serviceUrlAvailable","userHasUseAiAssistantsPrivilege"],Se=pe,he=(t,e)=>e.every(s=>t[s]===!0),Ae=t=>{let{aiAssistantsEnabled:e}=t;return e===void 0?(p("warn","`areAiAssistantsEnabled` is not defined in the organizations settings."),!1):e},Pe=async t=>(await ge.getCredential(t,{oAuthPopupConfirmation:!1})).token,fe=async t=>{try{return!!await ge.checkSignInStatus(t)}catch{return p("warn","User is not signed in."),!1}};async function ve({portalUrl:t}){t&&p("warn","The arcadeAssistant property is deprecated. Set esriConfig.portalUrl instead of arcadeAssistant.portalUrl.");let e=t||_e.portalUrl;if(!e)return p("warn","Arcade Assistant initialization failed. Reason: missing portal url."),{shouldRender:!1};let s=e.replace(/\/sharing\/rest(\/.*)?$/iu,"").replace(/\/$/u,"");if(!await fe(s))return{shouldRender:!1};let i=await Pe(e),a=`${s}/sharing/rest/portals/self?f=json&token=${i}`,o=`${s}/sharing/rest/portals/self/settings?f=json&token=${i}`,n=`${s}/sharing/rest/portals/self/signinSettings?f=json&token=${i}`,r=await Promise.allSettled([fetch(a,{credentials:"include"}).then(y=>y.json()),fetch(o,{credentials:"include"}).then(y=>y.json()),fetch(n,{credentials:"include"}).then(y=>y.json())]),[h,u,R]=r,P=h.status==="fulfilled"?h.value:(p("warn",`Failed to fetch selfUrl. Reason: ${h.reason}.`),{}),K=u.status==="fulfilled"?u.value:(p("warn",`Failed to fetch settingsUrl. Reason: ${u.reason}.`),{}),me=R.status==="fulfilled"?R.value:(p("warn",`Failed to fetch signinSettingsUrl. Reason: ${R.reason}.`),{});if(P.isPortal&&!$e(P.enterpriseVersion))return{shouldRender:!1};let j=P.helpBase||"";if(!K)return p("warn","Settings response is not available."),{shouldRender:!1};let B={orgAiAssistantsEnabled:Ae(K),betaAppsAllowed:me.blockBetaApps!==!0,serviceUrlAvailable:!!P?.helperServices?.aiAssistantServices?.url,userHasUseAiAssistantsPrivilege:P?.user?.privileges?.includes("portal:user:useAIAssistants")===!0};B.betaAppsAllowed||p("warn","Arcade Assistant is blocked by the organization settings. To enable it, do not block beta apps in the organization settings."),B.userHasUseAiAssistantsPrivilege||p("warn","User does not have the required privileges to use AI Assistants.");let H=he(B,Se),V=he(B,pe),q=P?.helperServices?.aiAssistantServices?.url;return q?{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},serviceUrl:q,helpBase:j,feedbackServiceUrl:ue}:{shouldRender:!0,portalUrl:e,availableFeatures:{codeActions:H,prompting:V},helpBase:j,feedbackServiceUrl:ue}}function $e(t){let e=X(t),[s,i="0"]=e.split("."),a=Number.parseInt(s,10),o=Number.parseInt(i,10);return Number.isNaN(a)||Number.isNaN(o)?!1:a>12||a===12&&o>=2}var ye=Object.defineProperty,Ee=Object.getOwnPropertyDescriptor,x=(t,e,s,i)=>{for(var a=i>1?void 0:i?Ee(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&ye(e,s,a),a},be=100,b=class extends S{constructor(t){super(t),this.collectionItems=[],this.errorMessage="",this.expanded=!1,this.requestId=0,this.status="idle",this.visibleChildCount=be}};x([c()],b.prototype,"collectionItems",2);x([c()],b.prototype,"errorMessage",2);x([c()],b.prototype,"expanded",2);x([c()],b.prototype,"requestId",2);x([c()],b.prototype,"schemaValue",2);x([c()],b.prototype,"status",2);x([c()],b.prototype,"visibleChildCount",2);b=x([A("ArcadeDebuggerLazyTreeNodeState")],b);var C=class extends S{constructor(t){super(t),this.generation=0,this.nodes=new Map}reset(){this.generation+=1,this.destroyNodes()}ensureNode(t,e=!1,s){let i=this.nodes.get(t);if(i)return i;let a=new b;return a.expanded=e,this.nodes.set(t,a),e&&s&&this.loadNode(t,s),a}setExpanded(t,e,s){let i=this.ensureNode(t,e,s);if(i.expanded===e){e&&s&&this.loadNode(t,s);return}i.expanded=e,e&&s&&this.loadNode(t,s)}showMore(t,e){let s=this.ensureNode(t);s.visibleChildCount>=e||(s.visibleChildCount=Math.min(e,s.visibleChildCount+be))}loadNode(t,e){switch(e.kind){case"collection":this.runLoad(t,e.load,(s,i)=>{s.collectionItems=i});return;case"schema":this.runLoad(t,e.load,(s,i)=>{s.schemaValue=i});return}}runLoad(t,e,s){let i=this.nodes.get(t);if(!i||i.status==="loading"||i.status==="loaded")return;let a=this.generation,o=i.requestId+1;i.requestId=o,i.status="loading",i.errorMessage="",i.schemaValue=void 0,i.collectionItems=[],e().then(n=>{let r=this.nodes.get(t);!r||this.generation!==a||r.requestId!==o||(s(r,n),r.status="loaded")}).catch(()=>{let n=this.nodes.get(t);!n||this.generation!==a||n.requestId!==o||(n.status="error")})}destroyNodes(){for(let t of this.nodes.values())t.destroy();this.nodes.clear()}};C=x([A("ArcadeDebuggerLazyTreeState")],C);var De=Object.defineProperty,we=Object.getOwnPropertyDescriptor,d=(t,e,s,i)=>{for(var a=i>1?void 0:i?we(e,s):e,o=t.length-1,n;o>=0;o--)(n=t[o])&&(a=(i?n(e,s,a):n(a))||a);return i&&a&&De(e,s,a),a},_=class extends S{constructor(t){super(t),this.phase="idle",this.sessionId=0,this.consoleLogs=[],this.hasExecuted=!1}get isExecuting(){return this.phase==="running"||this.phase==="debug-running"||this.phase==="debug-paused"}get isDebugging(){return this.phase==="debug-running"||this.phase==="debug-paused"}get isPaused(){return this.phase==="debug-paused"}get runResult(){return this.result?.resultType==="run"?this.result.result:void 0}get debugResult(){return this.result?.resultType==="debug"?this.result.result:void 0}get executionTiming(){return this.result?.timing}addConsoleLog(t){this.consoleLogs=[...this.consoleLogs,t]}};d([c()],_.prototype,"phase",2);d([c()],_.prototype,"mode",2);d([c()],_.prototype,"sessionId",2);d([c()],_.prototype,"result",2);d([c()],_.prototype,"consoleLogs",2);d([c()],_.prototype,"hasExecuted",2);_=d([A("ArcadeDebuggerExecutionModel")],_);var D=class extends S{constructor(t){super(t),this.editorBreakpoints=[],this.executionBreakpoints=[]}setBreakpoints(t,e){t==="editor"?this.editorBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i):this.executionBreakpoints=Array.from(new Set(e)).sort((s,i)=>s-i)}toggleBreakpoint(t,e){let s=new Set(t==="editor"?this.editorBreakpoints:this.executionBreakpoints);s.has(e)?s.delete(e):s.add(e),this.setBreakpoints(t,s)}clearBreakpoints(t){t==="editor"?this.editorBreakpoints=[]:this.executionBreakpoints=[]}syncExecutionBreakpointsFromEditor(){this.executionBreakpoints=this.editorBreakpoints}};d([c()],D.prototype,"editorBreakpoints",2);d([c()],D.prototype,"executionBreakpoints",2);D=d([A("ArcadeDebuggerSessionModel")],D);var w=class extends S{constructor(t){super(t),this.openedPanel="output",this.showPanel=!1}};d([c()],w.prototype,"openedPanel",2);d([c()],w.prototype,"showPanel",2);w=d([A("ArcadeDebuggerUiModel")],w);var k=class extends S{constructor(t){super(t)}get line(){return this.pausedState?.line}clearPausedState(){this.lastPausedState=this.pausedState,this.pausedState=void 0}reset(){this.pausedState=void 0,this.lastPausedState=void 0}setPausedState(t){this.pausedState=t,this.lastPausedState=t}};d([c()],k.prototype,"pausedState",2);d([c()],k.prototype,"lastPausedState",2);k=d([A("ArcadeDebuggerPausedFrameModel")],k);var m=class extends S{constructor(t){super(t),this.execution=new _,this.lazyTreeState=new C,this.pausedFrame=new k,this.previewTabsState=new U,this.session=new D,this.ui=new w}get editorBreakpoints(){return this.session.editorBreakpoints}get debuggerBreakpoints(){return this.isPaused?this.session.executionBreakpoints.map(t=>({line:t})):this.session.editorBreakpoints.map(t=>({line:t}))}get executionBreakpoints(){return this.session.executionBreakpoints}get consoleLogs(){return this.execution.consoleLogs}get debug(){if(!(!this.pausedFrame.pausedState&&!this.pausedFrame.lastPausedState))return{pausedState:this.pausedFrame.pausedState,lastPausedState:this.pausedFrame.lastPausedState}}get debugResult(){return this.execution.debugResult}get executionTiming(){return this.execution.executionTiming}get debuggerLine(){return this.pausedFrame.pausedState?.line}get executionState(){return this.pausedFrame.pausedState}get hasExecuted(){return this.execution.hasExecuted}get isDebugging(){return this.execution.isDebugging}get isExecuting(){return this.execution.isExecuting}get isPaused(){return this.execution.isPaused}get mode(){return this.execution.mode}get openedPanel(){return this.ui.openedPanel}get outputRenderer(){if(this.execution.result)return this.execution.result.resultType==="debug"?"debugger":"legacy"}get phase(){return this.execution.phase}get result(){return this.execution.result}get runResult(){return this.execution.runResult}get sessionId(){return this.execution.sessionId}get showPanel(){return this.ui.showPanel}addConsoleLog(t){this.execution.addConsoleLog(t)}clearBreakpoints(t){this.session.clearBreakpoints(t)}clearForMissingTestData(){this.stopDebug({hidePanel:!0}),this.execution.hasExecuted=!1,this.execution.result=void 0}closePanel(){this.ui.showPanel=!1}completeDebug(t,e){this.execution.mode="debug",this.execution.result={resultType:"debug",result:t,...e?{timing:e}:{}},this.execution.phase="completed",this.ui.openedPanel="output",this.pausedFrame.reset(),this.resetTransientDebuggerState()}completeRun(t,e={}){this.execution.mode="run",!e.useDebugRenderer&&$(t)?this.execution.result={resultType:"run",result:t}:e.useDebugRenderer&&!$(t)&&(this.execution.result={resultType:"debug",result:t,...e.timing?{timing:e.timing}:{}}),this.execution.phase="completed",this.pausedFrame.reset(),this.ui.openedPanel="output",this.resetTransientDebuggerState()}continueDebug(){let t=this.pausedFrame.pausedState?.continue;t&&(this.execution.phase="debug-running",this.pausedFrame.clearPausedState(),t.resolve())}disableDebugger(){this.stopDebug({hidePanel:!0}),this.clearBreakpoints("execution"),this.clearBreakpoints("editor")}fail(t){this.completeRun(t)}pauseDebug(t){let e=this.pausedFrame.pausedState??this.pausedFrame.lastPausedState;this.syncPausedState(e,t),this.pausedFrame.setPausedState(t),this.execution.phase="debug-paused"}reset(){this.execution.phase="idle",this.execution.mode=void 0,this.execution.result=void 0,this.execution.consoleLogs=[],this.execution.hasExecuted=!1,this.execution.sessionId=0,this.ui.openedPanel="output",this.ui.showPanel=!1,this.pausedFrame.reset(),this.clearBreakpoints("execution"),this.clearBreakpoints("editor"),this.replaceTransientDebuggerState()}resetDebug(){this.stopDebug({hidePanel:!1}),this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="debug-console"}disconnect(){this.stopDebug({hidePanel:!0})}setBreakpoints(t){this.session.setBreakpoints("editor",t)}setPanel(t){this.execution.hasExecuted&&(this.ui.openedPanel=t,this.ui.showPanel=!0)}startDebug(){return this.execution.mode="debug",this.execution.phase="debug-running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.session.syncExecutionBreakpointsFromEditor(),this.execution.consoleLogs=[],this.ui.openedPanel="debug-console",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}startRun(){return this.execution.mode="run",this.execution.phase="running",this.execution.hasExecuted=!0,this.execution.result=void 0,this.execution.consoleLogs=[],this.ui.openedPanel="output",this.ui.showPanel=!0,this.execution.sessionId+=1,this.pausedFrame.reset(),this.replaceTransientDebuggerState(),this.execution.sessionId}stopDebug({hidePanel:t=!0,invalidateSession:e=!0}={}){let s=this.pausedFrame.pausedState?.continue;e&&(this.execution.sessionId+=1),this.execution.phase=this.execution.hasExecuted?"completed":"idle",this.pausedFrame.reset(),this.resetTransientDebuggerState(),t&&(this.ui.showPanel=!1),this.ui.openedPanel==="debug-console"&&(this.ui.openedPanel="output"),s?.resolve()}syncPausedState(t,e){this.lazyTreeState.reset(),t&&e&&t!==e&&this.previewTabsState.invalidateAll(),this.pausedLine=e?.line}toggleBreakpoint(t){this.session.toggleBreakpoint("editor",t)}togglePanel(t){if(this.execution.hasExecuted){if(t==null){this.ui.showPanel=!this.ui.showPanel;return}if(this.ui.openedPanel===t&&this.ui.showPanel){this.ui.showPanel=!1;return}this.setPanel(t)}}resetTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState.reset(),this.previewTabsState.clear()}replaceTransientDebuggerState(){this.pausedLine=void 0,this.lazyTreeState=new C,this.previewTabsState=new U}};d([c()],m.prototype,"execution",2);d([c()],m.prototype,"lazyTreeState",2);d([c()],m.prototype,"pausedLine",2);d([c()],m.prototype,"pausedFrame",2);d([c()],m.prototype,"previewTabsState",2);d([c()],m.prototype,"session",2);d([c()],m.prototype,"ui",2);m=d([A("ArcadeDebuggerStore")],m);var ke={glyphMargin:!0,lineNumbersMinChars:1},z=class extends Y{constructor(){super(...arguments),this._codeEditorElt=L(),this._arcadeAssistantElt=L(),this._componentReadyDefer=Promise.withResolvers(),this._disposables=[],this._editorProfilePromise=Promise.resolve(void 0),this._debuggerState=new m,this.messages=te(),this._modelId=Q(),this._openArcadeHelp=()=>{window.open(oe,"Arcade Help")},this._decorations=void 0,this._monacoEditor=ee(ne),this._editorOptions={},this._toggleSidePanel=e=>{e.currentTarget instanceof HTMLElement&&this._setOpenedSidePanel(e.currentTarget.dataset.panelName??"none")},this._closeSidePanel=()=>{this._setOpenedSidePanel("none")},this._updateBreakpointsDecorations=()=>{let e=this.editorInstance;if(!e)return;let s=this._debuggerState.editorBreakpoints.map(i=>({range:new F(i,1,i,1),options:{isWholeLine:!0,glyphMarginClassName:"arcgis-code-editor__breakpoint-glyph",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}));this._decorations?.clear(),this._decorations=e.createDecorationsCollection(s)},this._clearDebuggerDecorations=()=>{this._decorations?.clear(),this._decorations=void 0,this._debuggerPausedLineDecoration?.clear(),this._debuggerPausedLineDecoration=void 0},this._debuggerPausedLineDecoration=void 0,this._preparingArcade=!1,this._arcadeAssistantRemoteState={shouldRender:!1},this._diagnostics=[],this.enableDebugger=!1,this.hideDocumentationActions=!1,this.hideSideBar=!1,this.openedSidePanel="none",this.script="",this.sideActionBarExpanded=!1,this.disableAssistant=!1,this.arcgisDiagnosticsChange=T({bubbles:!1}),this.arcgisScriptChange=T({bubbles:!1})}static{this.properties={_apiLibrary:16,_editorProfile:16,_preparingArcade:16,_arcadeAssistantRemoteState:16,_diagnostics:16,editorInstance:32,editorOptions:0,enableDebugger:5,hideDocumentationActions:5,hideSideBar:5,messageOverrides:0,openedSidePanel:3,profile:0,script:1,sideActionBarExpanded:7,snippets:0,suggestions:0,testData:0,customPanels:0,disableAssistant:5,arcadeAssistant:0,externalExecutor:0}}static{this.styles=[xe]}get _canExecute(){return!!(this.testData||this.externalExecutor)}get _usesBottomExecutionDrawer(){return this._canExecute&&(this.enableDebugger||!!this.externalExecutor)}get editorInstance(){return this._codeEditorElt.value?.editorInstance}get editorOptions(){return{...ke,...this._editorOptions}}set editorOptions(e){this._editorOptions=e??{}}async getTestResult(){if(!this.testData)return{type:"error",value:"Missing test data",error:null};let e=await this._editorProfilePromise;if(!e)return{type:"error",value:"Missing editor profile",error:null};await this._componentReadyDefer.promise;let s=this._codeEditorElt.value?.value,i=await N(e.definition,s,this.testData,{mode:"run"});return $(i)?i:{type:"error",value:"Unexpected debug result",error:null}}async setFocus(){await this._componentReadyDefer.promise,await this._codeEditorElt.value?.setFocus()}async openArcadeAssistant(e){if(!this._arcadeAssistantRemoteState.shouldRender)return!1;if(this.openedSidePanel="arcade-assistant",await this.updateComplete,!this._canPromptWithArcadeAssistant())return!0;let s=this._arcadeAssistantElt.value;return e?.prompt&&await s?.openPrompt(e.prompt),!0}async load(){let e=Z("./assets");le(e),await this._updateDataModelDeps(),this.manager.onLifecycle(()=>(this.hasUpdated&&this._connectMonacoCustomizations().catch(g(this)),()=>{for(this._askAiBindingKey&&(E(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);this._disposables.length;)this._disposables.pop()?.dispose();this._abortExternalExecution(),this._connectMonacoCustomizationsPromise=void 0,this._executeScriptAction=void 0,this._clearDebuggerDecorations(),this._debuggerState.disconnect()}))}willUpdate(e){(e.has("messages")||e.has("profile"))&&this._updateDataModelDeps(),(e.has("testData")||e.has("externalExecutor"))&&this._executionContextChanged(),e.has("enableDebugger")&&!this.enableDebugger&&this._debuggerState.disableDebugger(),e.has("snippets")&&v.updateApiContextForModel(this._modelId,{snippets:this.snippets}),(e.has("arcadeAssistant")||e.has("disableAssistant"))&&this._updateArcadeAssistantRemoteState()}async loaded(){await this._connectMonacoCustomizations(),this._componentReadyDefer.resolve()}_setOpenedSidePanel(e){this.openedSidePanel=e===this.openedSidePanel?"none":e}async _connectMonacoCustomizations(){if(this._connectMonacoCustomizationsPromise)return await this._connectMonacoCustomizationsPromise;this._connectMonacoCustomizationsPromise=(async()=>{if(!this.isConnected)return;let e=await de();this._disposables.push(e.onDiagnosticsChange(r=>{this._preparingArcade||(this._diagnostics=r.diagnostics,this.arcgisDiagnosticsChange.emit(r.diagnostics))})),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),this._syncAskAiAction();let s=O(()=>this._debuggerState.editorBreakpoints,()=>this._updateBreakpointsDecorations(),{sync:!0}),i=O(()=>this._debuggerState.debuggerLine,()=>this._updateDebuggerPausedLineDecoration(),{sync:!0}),a=O(()=>this._debuggerState.consoleLogs.length,()=>this.requestUpdate(),{sync:!0});this._disposables.push({dispose:()=>s.remove()},{dispose:()=>i.remove()},{dispose:()=>a.remove()});let o=this.editorInstance?.onMouseDown(r=>this._onEditorMouseDown(r));o&&this._disposables.push(o);let n=this.editorInstance?.onDidChangeModelContent(r=>this._onEditorModelContentChange(r));n&&this._disposables.push(n),this._updateBreakpointsDecorations(),this._updateDebuggerPausedLineDecoration()})();try{await this._connectMonacoCustomizationsPromise}finally{this._connectMonacoCustomizationsPromise=void 0}}_onEditorMouseDown(e){if(!this.enableDebugger||![this._monacoEditor.MouseTargetType.GUTTER_GLYPH_MARGIN].includes(e.target.type)||e.target.element?.classList.contains("codicon-gutter-lightbulb"))return;let s=e.target.position?.lineNumber;s&&this._debuggerState.toggleBreakpoint(s)}_onEditorModelContentChange(e){if(!this.enableDebugger||!this._debuggerState.editorBreakpoints.length||e.isFlush)return;let s=se(this._debuggerState.editorBreakpoints,e.changes);s.length===this._debuggerState.editorBreakpoints.length&&s.every((i,a)=>i===this._debuggerState.editorBreakpoints[a])||this._debuggerState.setBreakpoints(s)}_updateDebuggerPausedLineDecoration(){let e=this.editorInstance;if(!e)return;this._debuggerPausedLineDecoration?.clear();let s=this._debuggerState.debuggerLine;s!=null?this._debuggerPausedLineDecoration=e.createDecorationsCollection([{range:new F(s,1,s,1),options:{isWholeLine:!0,className:"arcgis-code-editor__debugger-paused-line",glyphMarginClassName:"arcgis-code-editor__debugger-paused-glyph",marginClassName:"arcgis-code-editor__debugger-paused-line arcgis-code-editor__debugger-paused-margin",stickiness:this._monacoEditor.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}]):this._debuggerPausedLineDecoration=void 0}_continueDebugSession(){this._debuggerState.continueDebug()}_abortExternalExecution(){this._externalExecutionAbortController?.abort(),this._externalExecutionAbortController=void 0}_stopDebugSession(){this._abortExternalExecution(),this._debuggerState.stopDebug({hidePanel:!1})}_resetDebugSession(){this._abortExternalExecution(),this._debuggerState.resetDebug(),this._executeScript("debug").catch(g(this))}async _handleDebugPause(e,s,i){if(!this._debuggerState.isDebugging||e!==this._debuggerState.sessionId)return;let a=Promise.withResolvers();return this._debuggerState.pauseDebug({line:s.line,result:i,continue:a}),await a.promise}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}async _executeWithExternalExecutor(e,s,i){if(!this.externalExecutor)return{type:"error",value:"Missing external executor",error:null};let a=new AbortController;this._abortExternalExecution(),this._externalExecutionAbortController=a;let o=i.console??(()=>{});try{if(e==="debug"){let{breakpoints:n,onDebugPause:r}=i;if(!n||!r)throw new Error("Missing debug execution options");return await this.externalExecutor.execute({mode:"debug",script:s,console:o,signal:a.signal,breakpoints:n,onDebugPause:r})}return await this.externalExecutor.execute({mode:"run",script:s,console:o,signal:a.signal})}catch(n){return{type:"error",value:(n instanceof Error?n:new Error(String(n))).message??"Execution failed",error:n instanceof Error?n:new Error(String(n)),compilationTime:0,executionTime:0,timeStamp:new Date}}finally{this._externalExecutionAbortController===a&&(this._externalExecutionAbortController=void 0)}}_executionContextChanged(){!this._canExecute&&this._executeScriptAction&&(this._disposeSafely(this._executeScriptAction),this._executeScriptAction=void 0),this._canExecute&&!this._executeScriptAction&&this._addExecuteScriptAction(),!this.testData&&this.enableDebugger&&this._debuggerState.clearForMissingTestData(),this._debuggerState.openedPanel==="debug-console"&&!this.enableDebugger&&this._debuggerState.closePanel(),this._debuggerState.showPanel&&this._executeScript("run").catch(g(this))}async _updateEditorProfile(){this._preparingArcade=!0;try{await v.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale,snippets:this.snippets}),this._editorProfile=v.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._editorProfilePromise=Promise.resolve(this._editorProfile),this._preparingArcade=!1}}async _updateApiLibrary(){this._apiLibrary=await v.getApiLibraryForModel(this._modelId)}_setExecutionPanel(e){this._debuggerState.setPanel(e)}async _executeScript(e){let s=this.testData,i=this.externalExecutor;if(!this._codeEditorElt.value||!s&&!i)return;let a=e==="debug"?this._debuggerState.startDebug():this._debuggerState.startRun();setTimeout(()=>{(async()=>{let o=this._codeEditorElt.value?.value??this.script,n={mode:e,console:u=>this._debuggerState.addConsoleLog(u),breakpoints:e==="debug"?this._debuggerState.debuggerBreakpoints:void 0};e==="debug"&&(n.onDebugPause=this._handleDebugPause.bind(this,a));let r,h;if(i){let u=await this._executeWithExternalExecutor(e,o,n);"result"in u?(r=u.result,h=u.timing):r=u}else if(s){let u=await this._editorProfilePromise;if(!u){this._debuggerState.fail({type:"error",value:"Missing editor profile",error:null});return}r=await N(u.definition,o,s,n)}else return;if(a===this._debuggerState.sessionId){if(e==="debug"){if($(r)){this._debuggerState.fail(r);return}this._debuggerState.completeDebug(r,h);return}if($(r))this._debuggerState.completeRun(r);else if(i){if(!h){this._debuggerState.fail({type:"error",value:"Missing execution timing",error:null});return}this._debuggerState.completeRun(r,{useDebugRenderer:!0,timing:h})}else this._debuggerState.fail({type:"error",value:"Unexpected debug result",error:null})}})()},0)}_toggleShowExecutionPanel(){this._debuggerState.togglePanel()}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}_onCodeEditorValueChange(e){e.stopPropagation(),this.script=e.detail,this.arcgisScriptChange.emit(e.detail)}_insertAsSnippet(e){this._codeEditorElt.value?.insertSnippet(e.detail).catch(g(this))}_insertAsText(e){this._insertText(e.detail)}_insertText(e){this._codeEditorElt.value?.insertText(e).catch(g(this))}_onResultPanelChange(e){let s=e.currentTarget;this._debuggerState.setPanel(s.openedResultPanel)}_onExecutionPanelClose(){this._debuggerState.closePanel()}_addExecuteScriptAction(){let e=this.editorInstance?.addAction({id:"run-script",label:"Run Arcade Expression",keybindings:[ie.F5],contextMenuGroupId:"code",contextMenuOrder:1,run:()=>{this._canExecute&&this._executeScript("run").catch(g(this))}});e&&(this._executeScriptAction=e,this._disposables.push(e))}_getAskAiBindingKey(){return ae.parse(this._modelId).toString()}_canRenderAskAiCodeActions(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.codeActions:!1}_canPromptWithArcadeAssistant(){let e=this._arcadeAssistantRemoteState;return e.shouldRender?e.availableFeatures.prompting:!1}_getAskAiCodeActions(e){if(!this._canRenderAskAiCodeActions())return[];if(!e.markers.length)return[];let s=this.messages.askarcadeassistant??"Ask Arcade Assistant",i=this._getAskAiBindingKey();return[{title:s,kind:re,diagnostics:e.markers,isPreferred:!1,isAI:!1,command:{id:ce,title:s,arguments:[i,this.messages.askarcadeassistantprompt??"Fix the errors in my script"]}}]}_syncAskAiAction(){if(!this.editorInstance)return;let e=this._getAskAiBindingKey();if(!this._arcadeAssistantRemoteState.shouldRender){this._askAiBindingKey&&(E(this._askAiBindingKey,void 0),this._askAiBindingKey=void 0);return}this._askAiBindingKey&&this._askAiBindingKey!==e&&E(this._askAiBindingKey,void 0),E(e,{provideCodeActions:({context:s})=>this._getAskAiCodeActions(s),run:s=>{this.openArcadeAssistant({prompt:s??this.messages.askarcadeassistantprompt??"Fix the errors in my script"}).catch(g(this))}}),this._askAiBindingKey=e}_disposeSafely(e){let s=this._disposables.indexOf(e);s!==-1&&this._disposables.splice(s,1),e.dispose()}async _updateArcadeAssistantRemoteState(){let e=this.arcadeAssistant;this.disableAssistant?this._arcadeAssistantRemoteState={shouldRender:!1}:this._arcadeAssistantRemoteState=await ve(e??{}),this._syncAskAiAction()}renderMainActionBar(){return this._usesBottomExecutionDrawer||!this._canExecute?null:l`<calcite-action-bar class="main-action-bar" layout=horizontal scale=s expanded expand-toggle-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=${()=>{this._executeScript("run").catch(g(this))}}></calcite-action>${this._debuggerState.result?l`<calcite-action .text=${this.messages.lastresults??""} .active=${this._debuggerState.showPanel} text-enabled icon=access-string-results icon-flip-rtl scale=s @click=${this._toggleShowExecutionPanel}></calcite-action>`:null}</calcite-action-group></calcite-action-bar>`}renderMainPanel(){return l`<arcgis-code-editor slot=editor .editorOptions=${this.editorOptions} .language=${v.languageId} .value=${this.script??""} .modelId=${this._modelId} @arcgisValueChange=${this._onCodeEditorValueChange} ${M(this._codeEditorElt)}></arcgis-code-editor>`}renderAction({id:e,label:s,icon:i,active:a,panelName:o,iconFlipRtl:n=!1,onClick:r=this._toggleSidePanel}){return l`<calcite-action id=${e??I} .text=${s} .textEnabled=${this.sideActionBarExpanded} .icon=${i} .active=${a} @click=${r} data-panel-name=${o??I} .iconFlipRtl=${n}></calcite-action>${!this.sideActionBarExpanded&&l`<calcite-tooltip .referenceElement=${e}><span>${s}</span></calcite-tooltip>`||""}`}renderSideActionBar(){return this.hideSideBar?null:l`<calcite-action-bar slot=side-action-bar class="side-action-bar" .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}><calcite-action-group>${this.renderAction({id:"profile-variables-action",label:this.messages.profilevariables??"",icon:"profile-variables",active:this.openedSidePanel==="variables",panelName:"variables"})}${this.renderAction({id:"function-action",label:this.messages.constantsandfunctions??"",icon:"function",active:this.openedSidePanel==="api",panelName:"api"})}${this.suggestions?.length?this.renderAction({id:"suggestions-action",label:this.messages.suggestions??"",icon:"lightbulb",active:this.openedSidePanel==="suggestions",panelName:"suggestions"}):null}${this._arcadeAssistantRemoteState.shouldRender&&this.renderAction({id:"arcade-assistant-action",label:this.messages.arcadeassistant??"Arcade assistant",icon:"effects",active:this.openedSidePanel==="arcade-assistant",panelName:"arcade-assistant"})||""}${this.customPanels?.map(e=>e.enabled===!1?null:this.renderAction({id:e.id,label:e.name,icon:e.icon,active:this.openedSidePanel===e.id,panelName:e.id}))}${this.hideDocumentationActions?null:this.renderAction({id:"developer-website-action",label:this.messages.help??"",icon:"question",active:!1,panelName:"none",iconFlipRtl:this.messages._lang==="ar",onClick:this._openArcadeHelp})}</calcite-action-group></calcite-action-bar>`}renderSidePanel(){if(this.hideSideBar)return null;let{openedSidePanel:e,_arcadeAssistantRemoteState:s}=this;return l`<arcgis-language-api-panel slot=side-panel class=${f(e==="api"?"":"hidden")} .loading=${this._preparingArcade} .apiLibrary=${this._apiLibrary} .hideDocumentationActions=${this.hideDocumentationActions} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .closed=${e!=="api"}></arcgis-language-api-panel><arcgis-editor-variables slot=side-panel class=${f(e==="variables"?"":"hidden")} .loading=${this._preparingArcade} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none .variable=${this._editorProfile} .closed=${e!=="variables"} .messageOverrides=${{profileempty:this.messages.profileempty,profilevariables:this.messages.profilevariables}}></arcgis-editor-variables>${this.suggestions?.length&&l`<arcgis-arcade-suggestions slot=side-panel class=${f(e==="suggestions"?"":"hidden")} .closed=${e!=="suggestions"} .suggestions=${this.suggestions} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${this._closeSidePanel} data-panel-name=none></arcgis-arcade-suggestions>`||""}${s?.shouldRender&&l`<arcgis-arcade-coding-assistant slot=side-panel class=${f(e==="arcade-assistant"?"":"hidden")} .closed=${e!=="arcade-assistant"} .insertText=${this._insertText.bind(this)} .closePanel=${this._closeSidePanel} .portalUrl=${s.portalUrl} .serviceUrl=${"serviceUrl"in s?s.serviceUrl:void 0} .helpBase=${s.helpBase} .promptingEnabled=${this._canPromptWithArcadeAssistant()} .feedbackServiceUrl=${s.feedbackServiceUrl} .editorRef=${this.el} .appVersion=${this.arcadeAssistant?.appVersion} .disableQuestionAnswerLogging=${this.arcadeAssistant?.disableQuestionAnswerLogging} .diagnostics=${this._diagnostics} ${M(this._arcadeAssistantElt)}></arcgis-arcade-coding-assistant>`||""}${this.customPanels?.map(i=>l`<calcite-flow slot=side-panel class=${f(e===i.id?"":"hidden")}>${i?.useFlows?i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el}):l`<calcite-flow-item .heading=${i.name} heading-level=2 closable .closed=${e!==i.id} @calciteFlowItemClose=${this._toggleSidePanel} .description=${i.description}>${i.renderer?.({closePanel:this._toggleSidePanel,insertText:this._insertText.bind(this),closed:e!==i.id,editorRef:this.el})}</calcite-flow-item>`}</calcite-flow>`)}`}renderResultsPanel(){if(this._usesBottomExecutionDrawer)return this.renderBottomExecutionBody();if(!this._debuggerState.showPanel)return null;let e=this._debuggerState.openedPanel==="debug-console"?"output":this._debuggerState.openedPanel;return l`<arcgis-arcade-results slot=results-panel .openedResultPanel=${e} .loading=${this._debuggerState.isExecuting} .result=${this._debuggerState.runResult} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange} @arcgisInternalClosePanel=${this._onExecutionPanelClose}></arcgis-arcade-results>`}renderBottomExecutionBody(){let{showPanel:e,openedPanel:s,debugResult:i,isExecuting:a,mode:o}=this._debuggerState;if(!e)return null;let n=s==="debug-console"?"output":s;return this.enableDebugger&&s==="debug-console"?l`<arcgis-arcade-debugger-console slot=results-panel .modelId=${this._modelId} .debuggerStore=${this._debuggerState}></arcgis-arcade-debugger-console>`:s==="output"&&(o==="debug"||i)?l`<arcgis-arcade-debugger-output .outputTitle=${this.messages.output} slot=results-panel .debuggerStore=${this._debuggerState} .result=${i}></arcgis-arcade-debugger-output>`:l`<arcgis-arcade-results slot=results-panel class="bottom-results" .openedResultPanel=${n} .loading=${s==="console"&&this._debuggerState.isPaused?!1:a} .result=${this._debuggerState.runResult} .executionTiming=${this._debuggerState.executionTiming} .consoleLogs=${this._debuggerState.consoleLogs} hide-header @arcgisInternalOpenedResultPanelChange=${this._onResultPanelChange}></arcgis-arcade-results>`}renderBottomActionBar(){if(!this._usesBottomExecutionDrawer)return null;let{showPanel:e,hasExecuted:s,openedPanel:i,isDebugging:a,isPaused:o,isExecuting:n}=this._debuggerState,r=this.messages.continue??"Continue",h=this.messages.reset??"Reset",u=this.messages.stop??"Stop";return l`<div slot=bottom-action-bar class=${`main-action-bar bottom-action-bar ${e?"":"is-collapsed"}`}><calcite-action-bar class="bottom-action-bar__actions" layout=horizontal scale=s expand-toggle-disabled expanded><calcite-action-group scale=s>${this.enableDebugger&&a?l`<calcite-action id=debugger-continue-action .text=${r} icon=forward scale=s .disabled=${!o} @click=${this._continueDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-continue-action placement=top><span>${r}</span></calcite-tooltip><calcite-action id=debugger-reset-action .text=${h} icon=reset scale=s @click=${this._resetDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-reset-action placement=top><span>${h}</span></calcite-tooltip><calcite-action id=debugger-stop-action .text=${u} icon=circle-stop scale=s @click=${this._stopDebugSession}></calcite-action><calcite-tooltip reference-element=debugger-stop-action placement=top><span>${u}</span></calcite-tooltip>`:l`<calcite-action .text=${this.messages.run??""} text-enabled icon=play scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("run").catch(g(this))}}></calcite-action>${this.enableDebugger&&l`<calcite-action .disabled=${this._debuggerState.editorBreakpoints.length===0} .text=${this.messages.runanddebug??"Run and Debug"} text-enabled icon=debug-script scale=s .loading=${this._preparingArcade||n} @click=${()=>{this._executeScript("debug").catch(g(this))}}></calcite-action>`||""}`}</calcite-action-group>${s?l`<calcite-action-group scale=s><calcite-action .active=${i==="output"&&e} .text=${this.messages.output??"Output"} text-enabled scale=s icon=list-show-all icon-flip-rtl @click=${()=>this._setExecutionPanel("output")}></calcite-action><calcite-action .active=${i==="console"&&e} .text=${this.messages.console??"Console"} text-enabled scale=s icon=console icon-flip-rtl @click=${()=>this._setExecutionPanel("console")}></calcite-action><calcite-action .active=${i==="log"&&e} .text=${this.messages.log??"Log"} text-enabled scale=s icon=list icon-flip-rtl @click=${()=>this._setExecutionPanel("log")} .disabled=${this.enableDebugger&&this._debuggerState.mode==="debug"}></calcite-action>${this.enableDebugger&&l`<calcite-action .active=${i==="debug-console"&&e} .text=${this.messages.debugconsole??"Debug Console"} text-enabled scale=s icon=debug-script .disabled=${this._debuggerState.mode!=="debug"} @click=${()=>this._setExecutionPanel("debug-console")}></calcite-action>`||""}</calcite-action-group>`:null}</calcite-action-bar>${e?l`<calcite-action .text=${this.messages.close??"Close"} scale=s icon=x icon-flip-rtl @click=${this._onExecutionPanelClose} slot=actions-end></calcite-action>`:null}</div>`}render(){return l`<arcgis-code-editor-shell>${this.renderMainActionBar()}${this.renderMainPanel()}${this.renderBottomActionBar()}${this.renderResultsPanel()}${this.renderSidePanel()}${this.renderSideActionBar()}</arcgis-code-editor-shell>`}};J("arcgis-arcade-editor",z);return z},"config","identity/IdentityManager","core/reactiveUtils","core/Accessor","core/accessorSupport/decorators",a,b,c,d,e,h)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import j from"./
|
|
2
|
+
import j from"./6EN2C75J.js";import i from"./KUL43ADE.js";import f from"./GATL6PSW.js";import"./VYEWIX5W.js";import b from"./STN3LSQR.js";import"./MZMKV7FA.js";import{a as _}from"./E57Q2B63.js";import"./VK7LOSQ5.js";import"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./XEK22IDA.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{F as l,G as h,H as p,I as r,L as g,h as c,j as e,n as o,t as d}from"./SMZ3LNZE.js";import{b as a}from"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,{a:s},{b:m}])=>{var f=c`:host{height:100%}calcite-tooltip:not([calcite-hydrated])>*{display:none}`,n=class extends p{constructor(){super(...arguments),this._codeEditorElt=l(),this._disposables=[],this.messages=_(),this._modelId=d(),this._preparing=!1,this.sideActionBarExpanded=!1,this.script="",this.hideSideBar=!1,this.hideDescriptionsInFieldsPanel=!1,this.arcgisDiagnosticsChange=o({bubbles:!1}),this.arcgisScriptChange=o({bubbles:!1})}static{this.properties={_activeAction:16,_apiLibrary:16,_editorProfile:16,_preparing:16,sideActionBarExpanded:16,profile:0,script:1,hideSideBar:5,messageOverrides:0,hideDescriptionsInFieldsPanel:5}}static{this.styles=[f]}async setFocus(){await this._codeEditorElt.value?.setFocus()}async load(){await this._updateEditorProfile().catch(a(this))}willUpdate(i){(i.has("messages")||i.has("profile"))&&this._updateDataModelDeps()}async loaded(){let i=await m();this._disposables.push(i.onDiagnosticsChange(t=>!this._preparing&&this.arcgisDiagnosticsChange.emit(t.diagnostics)))}disconnectedCallback(){for(super.disconnectedCallback();this._disposables.length;)this._disposables.pop()?.dispose()}async _updateDataModelDeps(){await this._updateEditorProfile(),await this._updateApiLibrary()}async _updateEditorProfile(){this._preparing=!0;try{await s.setProfileForModel(this._modelId,this.profile,{locale:this.messages._t9nLocale}),this._editorProfile=s.getEditorProfileForModel(this._modelId)}catch{this._editorProfile=void 0}finally{this._preparing=!1}}_setActiveAction(i){if(this._activeAction===i){this._activeAction=void 0;return}this._activeAction=i}_handleActionClick(i){let t=i.target;this._setActiveAction(t.dataset.panelName)}_insertAsSnippet(i){this._codeEditorElt.value?.insertSnippet(i.detail).catch(a(this))}_insertAsText(i){this._codeEditorElt.value?.insertText(i.detail.replaceAll('"',"'")).catch(a(this))}async _updateApiLibrary(){this._apiLibrary=await s.getApiLibraryForModel(this._modelId)}_onCodeEditorValueChange(i){i.stopPropagation(),this.script=i.detail,this.arcgisScriptChange.emit(i.detail)}_getFeatureSetVariable(){let i,t=s.getEditorProfileForModel(this._modelId);return t?.variables?.length&&t?.variables?.[0]?.type!=="featureSet"?a(this)("Encountered unexpected editor profile"):i=t?.variables?.[0],i}_toggleSideActionBarExpanded(){this.sideActionBarExpanded=!this.sideActionBarExpanded}render(){let i=this._getFeatureSetVariable();return e`<arcgis-code-editor-shell><arcgis-code-editor slot=editor language=arcgis-sql-expression .modelId=${this._modelId} .value=${this.script??""} @arcgisValueChange=${this._onCodeEditorValueChange} ${h(this._codeEditorElt)}></arcgis-code-editor>${!this.hideSideBar&&i&&e`<arcgis-editor-variables slot=side-panel .variable=${i} .hideDescriptions=${this.hideDescriptionsInFieldsPanel} .closed=${this._activeAction!=="fields"} class=${r(this._activeAction==="fields"?"":"hidden")} .loading=${this._preparing} .modelId=${this._modelId} @arcgisInternalItemSelected=${this._insertAsText} @arcgisInternalClosePanel=${()=>this._setActiveAction(void 0)} data-panel-name=none .messageOverrides=${{profileempty:this.messages.profileempty}}></arcgis-editor-variables>`||""}${!this.hideSideBar&&e`<arcgis-language-api-panel slot=side-panel class=${r(this._activeAction==="functions"?"":"hidden")} .closed=${this._activeAction!=="functions"} @arcgisInternalItemSelected=${this._insertAsSnippet} @arcgisInternalClosePanel=${()=>this._setActiveAction(void 0)} .loading=${this._preparing} .apiLibrary=${this._apiLibrary} data-panel-name=none hide-documentation-actions .languageId=${s.languageId}></arcgis-language-api-panel>`||""}${!this.hideSideBar&&e`<calcite-action-bar slot=side-action-bar .expanded=${this.sideActionBarExpanded} position=end @calciteActionBarToggle=${this._toggleSideActionBarExpanded}>${i&&e`<calcite-action id=fields-action .text=${this.messages.fields??"Fields"} icon=profile-variables .active=${this._activeAction==="fields"} data-panel-name=fields @click=${this._handleActionClick}></calcite-action>`||""}${i&&!this.sideActionBarExpanded&&e`<calcite-tooltip reference-element=fields-action><span>${this.messages.fields??"Fields"}</span></calcite-tooltip>`||""}<calcite-action id=functions-action .text=${this.messages.functions??"Functions"} icon=function .active=${this._activeAction==="functions"} data-panel-name=functions @click=${this._handleActionClick}></calcite-action>${!this.sideActionBarExpanded&&e`<calcite-tooltip reference-element=functions-action><span>${this.messages.functions??"Functions"}</span></calcite-tooltip>`||""}</calcite-action-bar>`||""}</arcgis-code-editor-shell>`}};g("arcgis-sql-expression-editor",n);return n},b,f,i,j)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./GATL6PSW.js";import a from"./STN3LSQR.js";import{j as q}from"./BHSILWSL.js";import{M as P}from"./SMZ3LNZE.js";export default $arcgis.t(([B,{substitute:E},{B:F},{a:T,d:C,e:N,f:b,g:g,h:$,i:x,j:L,n:_,o:D,p:A}])=>{function w(t,e,a){return t?.[e]??a}function h(t,e,a,n){return E(w(t,e,a),n)}function K(t,e){return w(t,e?"nullable":"notnull",e?"nullable":"not nullable")}function j(t,e){return w(t,e?"yes":"no",e?"yes":"no")}function v(t){for(let e of t){if(e instanceof _)return e;if(e.isCollection&&"variables"in e){let a=v(e.variables.filter(n=>n.type!=="group"));if(a)return a}}}function V(t,e){return`${t}:${e}`}function z(t){if(t){for(let e of t)if(e.type==="dataCatalogDatastore")return e.definition}}async function U(t){let e=new B({url:t.portal.url});return await e.load(),new T({itemId:t.id,serviceUrl:t.serviceUrl,portal:e})}async function k(t){return F(t)?await U(t):t}function H(t,e,a,n){let o=`**${t}**`;return e.type&&(o+=`
|
|
3
3
|
${e.type}`),a&&(o+=`
|
|
4
4
|
${h(n,"datastoreformat","Datastore: {datastoreName}",{datastoreName:a})}`),{value:o}}function W(t,e,a){let n=`**${t.name}**`;return t.serverType&&(n+=`
|
|
5
5
|
${t.serverType}`),n+=`
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as v}from"./
|
|
2
|
+
import{a as v}from"./4L2GLNTS.js";import{b,c as r,d as _}from"./O5VTBJWD.js";import{a as f}from"./VYEWIX5W.js";import{a as p}from"./E57Q2B63.js";import"./VK7LOSQ5.js";import{e as h,f as m}from"./BHSILWSL.js";import"./J4I4EROF.js";import"./BZWB7A55.js";import"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{G as c,H as d,L as u,h as g,j as s,l,n as a}from"./SMZ3LNZE.js";import"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";function S(o){return!Array.isArray(o)||!o.length?!1:Array.isArray(o[0].suggestions)}var $=g`: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)}calcite-flow{[slot=footer]{word-break:break-word}}}`,n=class extends d{constructor(){super(...arguments),this._beforeBack=async()=>{this._selectedSuggestion=void 0},this.messages=p(),this._colorizeStyle="",this._filterValue="",this.closed=!1,this.arcgisInternalClosePanel=a({bubbles:!1,composed:!1}),this.arcgisInternalItemSelected=a({bubbles:!1,composed:!1})}static{this.properties={_colorizeStyle:16,_filterValue:16,_selectedSuggestion:16,suggestions:0,closed:5}}static{this.styles=$}load(){this._colorizeStyle=r(),this._themeChangedListener=_(()=>this._colorizeStyle=r())}willUpdate(e){e.has("suggestions")&&this.suggestionsPropChanged()}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect(),this._themeChangedListener?.dispose()}suggestionsPropChanged(){this._selectedSuggestion=void 0}flowFocusHandler(e){if(!e){this._flowObserver?.disconnect(),this._flowObserver=void 0;return}this._flowObserver||(this._flowObserver=new MutationObserver(()=>{m(e.querySelector("calcite-flow-item:last-child"),"calcite-input")}),this._flowObserver.observe(e,{attributes:!0,attributeFilter:["id"],childList:!0}))}_updateFilterValue(e){this._filterValue=e.currentTarget?.value??""}_emitItemSelected(e,t){let i=e;(!i.key||i.key==="Enter")&&(e.preventDefault(),this.arcgisInternalItemSelected.emit(t.code))}_showSuggestionDetail(e,t){e.stopPropagation(),this._selectedSuggestion=t}_emitClose(){this.arcgisInternalClosePanel.emit()}_colorizeCode(e){e!==void 0&&b(e,this._selectedSuggestion.code,"arcade")}renderSuggestionGroups(){return this.suggestions===void 0?null:S(this.suggestions)?this.suggestions.map(e=>s`<calcite-list-item-group .heading=${e.label}>${this.renderSuggestionListItems(e.suggestions)}</calcite-list-item-group>`):this.renderSuggestionListItems(this.suggestions)}renderSuggestionListItems(e){return e=f(e,"label",this._filterValue),e.length?e.map(t=>s`<calcite-list-item .label=${t.label} .description=${t.description} @calciteListItemSelect=${i=>this._emitItemSelected(i,t)} @keydown=${i=>this._emitItemSelected(i,t)} data-item=${t??l}><calcite-action slot=actions-end .text=${this.messages.expand??""} scale=s icon=chevron-right icon-flip-rtl @click=${i=>this._showSuggestionDetail(i,t)} data-item=${t??l}></calcite-action></calcite-list-item>`):s`<div class="notice-container">${this.messages.noitems}</div>`}renderSuggestionFlowItem(){let e=this._selectedSuggestion;return e?s`<calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .beforeBack=${this._beforeBack} selected><calcite-button width=half slot=footer appearance=outline kind=brand icon-start=code scale=s @click=${t=>this._emitItemSelected(t,e)} data-item=${e??l} ${c(h)}>${this.messages.insert}</calcite-button><calcite-block open .heading=${e.label} .description=${e.description}><div .innerHTML=${v(e.documentation)??""}></div><pre><code ${c(this._colorizeCode)}></code></pre></calcite-block></calcite-flow-item>`:null}render(){return this.closed?null:s`<style>${this._colorizeStyle}</style><calcite-flow ${c(this.flowFocusHandler)}><calcite-flow-item heading-level=2 .heading=${this.messages.suggestions} closable @calciteFlowItemClose=${this._emitClose} .selected=${!this._selectedSuggestion}><calcite-input .value=${this._filterValue} icon=magnifying-glass clearable @calciteInputInput=${this._updateFilterValue} class="sticky" scale=m></calcite-input><calcite-list .label=${this.messages.suggestions??"Suggestions"}>${this.renderSuggestionGroups()}</calcite-list></calcite-flow-item>${this.renderSuggestionFlowItem()}</calcite-flow>`}};u("arcgis-arcade-suggestions",n);export{n as ArcgisArcadeSuggestions};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import{a as O,c as u,d as k}from"./O5VTBJWD.js";import i from"./
|
|
2
|
+
import{a as O,c as u,d as k}from"./O5VTBJWD.js";import i from"./DGQ3XT5J.js";import h from"./KUL43ADE.js";import"./5HKDO4SX.js";import e from"./O5LFPM4K.js";import d from"./VJVVEOIA.js";import c from"./GATL6PSW.js";import"./VYEWIX5W.js";import a from"./STN3LSQR.js";import"./MZMKV7FA.js";import{a as E}from"./VK7LOSQ5.js";import{b as T,d as w}from"./BHSILWSL.js";import{a as S}from"./J4I4EROF.js";import"./BZWB7A55.js";import{a as C}from"./XEK22IDA.js";import{a as N}from"./CMRUQ3BN.js";import"./UFF53OEH.js";import"./NHREAORV.js";import{H as v,L as b,M as y,h as g,i as f,j as n}from"./SMZ3LNZE.js";import{b as _}from"./BFPEJYVB.js";import"./DSQ2DQQL.js";import"./H6RQVSYM.js";export default $arcgis.t(([,,,{a:L},,{b:c,d:m}])=>{var x=Symbol(),l=class{get taskComplete(){return this.t||(this.i===1?this.t=new Promise(((t,e)=>{this.o=t,this.h=e})):this.i===3?this.t=Promise.reject(this.l):this.t=Promise.resolve(this.u)),this.t}constructor(t,e,s){this.p=0,this.i=0,(this._=t).addController(this);let i=typeof e=="object"?e:{task:e,args:s};this.v=i.task,this.j=i.args,this.m=i.argsEqual??M,this.k=i.onComplete,this.A=i.onError,this.autoRun=i.autoRun??!0,"initialValue"in i&&(this.u=i.initialValue,this.i=2,this.O=this.T?.())}hostUpdate(){this.autoRun===!0&&this.S()}hostUpdated(){this.autoRun==="afterUpdate"&&this.S()}T(){if(this.j===void 0)return;let t=this.j();if(!Array.isArray(t))throw Error("The args function must return an array");return t}async S(){let t=this.T(),e=this.O;this.O=t,t===e||t===void 0||e!==void 0&&this.m(e,t)||await this.run(t)}async run(t){let e,s;t??=this.T(),this.O=t,this.i===1?this.q?.abort():(this.t=void 0,this.o=void 0,this.h=void 0),this.i=1,this.autoRun==="afterUpdate"?queueMicrotask((()=>this._.requestUpdate())):this._.requestUpdate();let i=++this.p;this.q=new AbortController;let r=!1;try{e=await this.v(t,{signal:this.q.signal})}catch(d){r=!0,s=d}if(this.p===i){if(e===x)this.i=0;else{if(r===!1){try{this.k?.(e)}catch{}this.i=2,this.o?.(e)}else{try{this.A?.(s)}catch{}this.i=3,this.h?.(s)}this.u=e,this.l=s}this._.requestUpdate()}}abort(t){this.i===1&&this.q?.abort(t)}get value(){return this.u}get error(){return this.l}get status(){return this.i}render(t){switch(this.i){case 0:return t.initial?.();case 1:return t.pending?.();case 2:return t.complete?.(this.value);case 3:return t.error?.(this.error);default:throw Error("Unexpected status: "+this.i)}}},M=(h,t)=>h===t||h.length===t.length&&h.every(((e,s)=>!f(e,t[s])));var $=g`:host{display:block}.arcgis-code-viewer-container{display:flex;align-items:stretch;background-color:var(--calcite-color-foreground-2)}.arcgis-code-viewer__gutter{display:flex;min-width:var(--calcite-spacing-md);padding:0 var(--calcite-spacing-xs) 0 var(--calcite-spacing-sm);border-inline-end:1px solid var(--calcite-color-border-3);color:var(--calcite-color-text-3);font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code);user-select:none;justify-items:center;font-variant-numeric:tabular-nums}.arcgis-code-viewer__line-number{display:flex;align-items:center}pre.arcgis-code-viewer{display:flex;direction:ltr;overflow-x:auto;margin:0;padding:var(--calcite-spacing-sm);white-space:pre-line;code{font-size:var(--calcite-font-size--2);font-family:var(--calcite-font-family-code)}}:host([round]){.arcgis-code-viewer-container{border-radius:var(--calcite-corner-radius-round)}}`,p=class extends v{constructor(){super(...arguments),this._monacoEditor=E(N),this.#e=Promise.withResolvers(),this.#t="",this._slotContentObservers=[],this._onDefaultSlotChange=async t=>{S(t)||(this._codeFromSlot="");let e=t.target instanceof HTMLSlotElement?t.target:null,s=e?this._computeSlotText(e):"";e&&this._observeAssignedSlotNodes(e),s!==this._codeFromSlot&&(this._codeFromSlot=s),this.#e.resolve()},this._colorizeTask=new l(this,{task:async([t,e],{signal:s})=>{if(await this.#e.promise,s.aborted)return this.#t;if(await c(e),s.aborted)return this.#t;let i=await O(t,e);return s.aborted?this.#t:(this.#t=i,i)},args:()=>[this._codeFromSlot,this.language]}),this._codeFromSlot="",this.language="arcade",this.round=!1,this.lineNumbers="off"}static{this.properties={_codeFromSlot:16,language:1,round:7,lineNumbers:1}}static{this.styles=$}#e;#t;async load(){L(y("./assets")),await m(this.language),await c(this.language),this._applyColorizeStyles(u()),this.manager.onLifecycle(()=>(this._themeObserver=T(this.el,["class"],()=>this.updateTheme()),this._themeChangedListener=k(()=>{this._applyColorizeStyles(u())}),this.updateTheme(),()=>{this._themeObserver?.(),this._themeObserver=void 0,this._themeChangedListener?.dispose(),this._themeChangedListener=void 0}))}loaded(){this.el.hasChildNodes()||this.#e.resolve()}willUpdate(t){t.has("language")&&m(this.language).then(()=>c(this.language)).catch(_(this))}disconnectedCallback(){super.disconnectedCallback(),this._disposeSlotObservers()}_disposeSlotObservers(){this._slotContentObservers.length&&(this._slotContentObservers.forEach(t=>t.disconnect()),this._slotContentObservers=[])}_observeAssignedSlotNodes(t){this._disposeSlotObservers();let e=t.assignedNodes({flatten:!0});if(!e.length)return;let s=new Set;for(let o of e)o.nodeType===Node.ELEMENT_NODE?s.add(o):o.nodeType===Node.TEXT_NODE&&o.parentElement&&s.add(o.parentElement);let i={characterData:!0,childList:!0,subtree:!0},r=C(()=>{let o=this._computeSlotText(t);o!==this._codeFromSlot&&(this._codeFromSlot=o)},100),d=o=>{if(o.some(a=>a.type==="childList")){let a=this._computeSlotText(t);a!==this._codeFromSlot&&(this._codeFromSlot=a);return}r()};s.forEach(o=>{let a=new MutationObserver(d);a.observe(o,i),this._slotContentObservers.push(a)})}_computeSlotText(t){let e=t.assignedNodes({flatten:!0}).filter(s=>s.nodeType!==Node.COMMENT_NODE);if(this.language==="html"&&e.length){let s=e.find(r=>r.nodeType===Node.ELEMENT_NODE&&r.tagName==="TEMPLATE");if(s)return(s.innerHTML??"").trim();let i=e.map(r=>r.nodeType===Node.ELEMENT_NODE?r.outerHTML:r.nodeType===Node.TEXT_NODE?r.textContent??"":"").join("").trim();return i}return e.map(s=>s.textContent??"").join("").trim()}updateTheme(){let t=w(this.el)==="light"?"vs":"vs-dark";t!==this._currentTheme&&(this._currentTheme=t,this._monacoEditor.setTheme(t))}_applyColorizeStyles(t){if(!this._colorizeSheet){this._colorizeSheet=new CSSStyleSheet;let e=this.renderRoot;e.adoptedStyleSheets=[...e.adoptedStyleSheets,this._colorizeSheet]}this._colorizeSheet.replaceSync(t)}_showLineNumbers(){return typeof this.lineNumbers=="function"||this.lineNumbers==="on"}_getLineNumberLabel(t){return typeof this.lineNumbers=="function"?this.lineNumbers(t):`${t}`}_getRenderedLineNumbers(){if(!this._showLineNumbers())return[];let t=Math.max(this._codeFromSlot.split(/\r\n|\r|\n/u).length,1);return Array.from({length:t},(e,s)=>this._getLineNumberLabel(s+1))}render(){let t=this._getRenderedLineNumbers();return n`<div class=${`arcgis-code-viewer-container${t.length?" arcgis-code-viewer-container--with-line-numbers":""}`}><slot @slotchange=${this._onDefaultSlotChange} style="display:none" aria-hidden=true></slot>${t.length?n`<div class="arcgis-code-viewer__gutter" aria-hidden=true>${t.map(e=>n`<span class="arcgis-code-viewer__line-number">${e}</span>`)}</div>`:null}<pre class="arcgis-code-viewer" aria-label=${`${this.language} code snippet`}>${this._colorizeTask.render({error:()=>null,pending:()=>n`<code class=${`language-${this.language}`}></code>`,complete:e=>n`<code class=${`language-${this.language}`} .innerHTML=${e??""}></code>`})}</pre></div>`}};b("arcgis-code-viewer",p);return p},a,c,d,e,h,i)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* COPYRIGHT Esri - https://js.arcgis.com/5.2/LICENSE.txt */
|
|
2
|
-
import b from"./
|
|
2
|
+
import b from"./GATL6PSW.js";import a from"./STN3LSQR.js";import{i as v,j as T}from"./BHSILWSL.js";import{b as f,c as p,d as c}from"./BZWB7A55.js";import{M as m}from"./SMZ3LNZE.js";export default $arcgis.t(([{getDeclaredPixelMembers:$},{G:w,f:M,g:F,h:A,i:P,j:k,n:b},{k:I,l:L,m:V,o:C,p:D}])=>{async function K(e){let{apiVersion:i,bundles:t,hiddenApiItems:n}=e.toEditorProfileDefinition(),s=await E(e.dictionaryVariables.filter(w));return{apiVersion:i,bundles:t,variables:s,hiddenApiItems:n?.map(o=>o.toLowerCase())}}async function E(e,i=f.Variable){return await Promise.all(e.map(async t=>{switch(t.type){case"dictionary":return await B(t,i);case"pixel":return await q(t,i);case"voxel":case"feature":return await _(t,i);default:return U(t,i)}}))}function U(e,i){let{name:t,type:n}=e,s=e.getDescription(),o=i===f.Field?I(t,!1):t;return{name:t,description:s,type:n,completion:{label:t,detail:t,insertText:o,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i,documentation:{kind:"markdown",value:s}}}}async function _(e,i){let t=await e.loadSource(),{name:n}=e,s=e.getDescription(),o={label:n,detail:n,insertText:n,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},a={name:n,description:s,type:"dictionary",properties:[],completion:o};if(!t)return a;let[r,l]=L(t.fields,s,{includeAliases:!0});return a.properties=r,o.documentation={kind:"markdown",value:l},a}async function q(e,i){let t=await e.loadSource(),n=e.toProfileVariableDefinition();if(n.type!=="pixel")throw new Error("Incorrect definition passed to pixel variable");let{name:s}=e,o=e.getDescription(),a={label:s,detail:s,insertText:s,insertTextMode:c.asIs,insertTextFormat:p.PlainText,kind:i},r={name:s,description:o,type:"dictionary",properties:[],completion:a};if(!t||!n.definition)return r;let l=await $(t),[d,u]=V(l,o);return r.properties=d,a.documentation={kind:"markdown",value:u},r}async function B(e,i){let{name:t,dictionaryVariables:n}=e,s=e.getDescription(),o=n.reduce((a,r)=>{a!==""&&(a+=`
|
|
3
3
|
|
|
4
4
|
`),a+=`**${r.name}**
|
|
5
5
|
${r.type}`;let l=r.getDescription();return l&&(a+=`
|