/* COPYRIGHT Esri - https://js.arcgis.com/5.0/LICENSE.txt */
import a from"./UDSZJ5NU.js";import{b as m,c as y,d as h}from"./3YF4QLXU.js";import{g as f}from"./NMIFSDFV.js";import{K as u}from"./A4OQ6IM3.js";export default $arcgis.t(([{d:b,f:d,j:g,l:F,m:M}])=>{var w=o=>{let t=o.variables[0],i=t?.type==="featureSet"?A(t):void 0,{apiVersion:e,bundles:a,hiddenApiItems:r}=o.toEditorProfileDefinition();return{apiVersion:e,bundles:a,variables:i?[i]:[],hiddenApiItems:r?.map(s=>s.toLowerCase())}};function A(o){let{name:t}=o,i=o.getDescription(),{definition:e}=o.toProfileVariableDefinition(),a={label:t,detail:t,insertText:t,insertTextMode:h.asIs,insertTextFormat:y.PlainText,kind:m.Field},r={name:t,description:i,type:"dictionary",properties:[],completion:a};if(!e||!("fields"in e))return r;let[s,l]=g(e.fields,i);return r.properties=s,a.documentation={kind:"markdown",value:l},r}var P={id:"field-calculation",variables:[{name:"$layer",type:"featureSet",description:"The layer being calculated."}]};function T(){return P}function I(o){if(!d(o))return;let t=T();if(!t)return;let i={variables:[],hiddenApiItems:o.hiddenApiItems?.map(e=>e.toLowerCase())};return t.variables.forEach(e=>{if(o.disabledVariables?.includes(e.name))return;let a=o.definitions[e.name];switch(e.type){case"featureSet":return b(a)?i.variables.push({...e,type:e.type,definition:a}):void 0;default:throw Error(`sdkVariable type not supported (yet) type: ${e.type}`)}}),i}var x="arcgis-sql-expression",p=class extends M{constructor(){super(x,{apiPath:"./assets/sql-language/api",apiPrefix:"sql-api.t9n."}),this._languageId=x,this._layerMap=new Map}updateFeatureLayerForModel(t,i){let e=this._getApiKey(t);this._layerMap.set(e,i)}getFeatureLayerForModel(t){let i=this._getApiKey(t);return this._layerMap.get(i)}async setProfileForModel(t,i,e={locale:"en"}){d(i)&&(i=I(i));let a=await f(e.locale,u("./assets/editor-profile/t9n"),"messages.");if(!a)throw new Error(`Failed to load the language bundle for ${e.locale}`);this.disposeForModel(t);let r=this._getApiKey(t),s=new F(i,a);this._modelToProfileMap.set(r,s);let l=w(s);this.updateApiContextForModel(t,{locale:e.locale,profile:l});let c=i?.variables?.find(v=>v.name==="$layer");c&&this.updateFeatureLayerForModel(t,c.definition)}},n=new p,k={setProfileForModel:n.setProfileForModel.bind(n),getApiLibraryForModel:n.getApiLibraryForModel.bind(n)};async function C(){return await import("./EDJLCDYO.js").then(m=>m.default)}return{a:n,b:C}},a)