/*! All material copyright Esri, All Rights Reserved, unless otherwise specified.
See https://js.arcgis.com/4.34/esri/copyright.txt for details.
v4.34.0-next.121 */
import{a}from"./O5PLGPIH.js";import{a as m}from"./ENOJEDEN.js";import"./NWW6FLDQ.js";import c from"./5BHNJWQL.js";import b from"./P6Z5HUIW.js";import"./UKCQ5YIH.js";import"./INNG7J5V.js";import"./5FYSIY5Z.js";import"./RVGYUGLD.js";import{D as d,g as r,h as i,l as s,z as n}from"./J6OWSSFX.js";import"./3OPP6LSE.js";import"./3GFSJLDE.js";import"./DFI3FVXK.js";export default $arcgis.t(([,h])=>{var g=r`:host{calcite-flow{height:100%}calcite-list-item-group{background-color:var(--calcite-color-foreground-2)}}`,c=class extends n{constructor(){super(...arguments),this.messages=m(),this._filterValue="",this._flowItemRenderers=[],this._mutationCounter=1,this.loading=!1,this.arcgisClose=s({bubbles:!1}),this.arcgisFieldSelected=s({bubbles:!1})}static{this.properties={_filterValue:16,_flowItemRenderers:16,_mutationCounter:16,loading:5,modelId:1}}static{this.styles=g}willUpdate(t){t.has("modelId")&&(this._flowItemRenderers=[])}disconnectedCallback(){super.disconnectedCallback(),this._flowObserver?.disconnect()}_handleSelectField(t){if(t.target instanceof HTMLElement)switch(t.target.tagName.toLowerCase()){case"calcite-list-item":{let e=t.target.value;this.arcgisFieldSelected.emit(e??"");break}case"calcite-action":t.stopPropagation();break}}_handleSelectDomain(t){let e=t.target.value;this.arcgisFieldSelected.emit(e?`'${e}'`:"")}_emitClose(){this.arcgisClose.emit()}render(){let t=h.getFeatureLayerForModel(this.modelId??"");return this.loading||!this.modelId||!t?i`<calcite-block .heading=${this.messages.availablefields??""}></calcite-block>`:i`<calcite-flow><calcite-flow-item .heading=${this.messages.availablefields??""} closable @calciteFlowItemClose=${this._emitClose}><calcite-list label=fields filter-enabled>${a(t.fields,e=>e.name,e=>i`<calcite-list-item @click=${this._handleSelectField} .label=${e.name} .description=${e.alias??""} .value=${e.name}>${e.domain&&i`<calcite-action slot=actions-end text=open icon=chevron-right @click=${()=>{let o=e.domain;o?.type==="coded-value"&&(this._flowItemRenderers=[...this._flowItemRenderers,()=>i`<calcite-flow-item closable .heading=${this.messages.domainvalues??""} .description=${e.name} @calciteFlowItemClose=${this._emitClose}><calcite-list label=domains>${a(o.codedValues,l=>l.code,l=>i`<calcite-list-item @click=${this._handleSelectDomain} .label=${l.name} .description=${String(l.code)} .value=${String(l.code)}></calcite-list-item>`)}</calcite-list></calcite-flow-item>`])}}></calcite-action>`||""}</calcite-list-item>`)}</calcite-list></calcite-flow-item>${this._flowItemRenderers.map(e=>e())}</calcite-flow>`}};d("arcgis-sql-expression-fields",c);return c},b,c)