// All material copyright Esri, All Rights Reserved, unless otherwise specified. // See https://js.arcgis.com/4.30/esri/copyright.txt for details. //>>built define("../../chunks/tslib.es6 ../../core/lang ../../core/accessorSupport/decorators/property ../../core/has ../../core/Logger ../../core/accessorSupport/decorators/subclass ./SearchSource ./support/layerSearchUtils".split(" "),function(c,h,d,b,n,l,m,k){var g;b=g=class extends m{constructor(a){super(a);this.suggestionTemplate=this.searchTemplate=this.searchFields=this.orderByFields=this.exactMatch=this.displayField=null;this.getResults=(f,e)=>k.getResults({source:this,...f},e);this.getSuggestions= (f,e)=>k.getSuggestions({source:this,...f},e)}set layer(a){this._set("layer",a);a&&a.load().catch(()=>{})}get name(){return this._getLayerTitle()??""}set name(a){this._overrideIfSome("name",a)}clone(){return new g({autoNavigate:this.autoNavigate,filter:this.filter,maxResults:this.maxResults,maxSuggestions:this.maxSuggestions,minSuggestCharacters:this.minSuggestCharacters,outFields:this.outFields?h.clone(this.outFields):null,placeholder:this.placeholder,popupEnabled:this.popupEnabled,prefix:this.prefix, resultGraphicEnabled:this.resultGraphicEnabled,resultSymbol:this.resultSymbol?this.resultSymbol.clone():null,suggestionsEnabled:this.suggestionsEnabled,suffix:this.suffix,withinViewEnabled:this.withinViewEnabled,displayField:this.displayField,exactMatch:this.exactMatch,layer:this.layer,searchFields:this.searchFields?h.clone(this.searchFields):null,suggestionTemplate:this.suggestionTemplate,zoomScale:this.zoomScale})}_getFirstStringField(){return this.layer.fieldsIndex?.fields.find(a=>"string"===a.type)?.name?? ""}_getDisplayField(){return this.displayField||this.layer.displayField||this._getFirstStringField()}_getSearchFieldsString(){const {layer:a,searchFields:f}=this;return a.loaded?`: ${(f||[this._getDisplayField()]).map(e=>a.getField(e)?.alias||e).join(", ")}`:""}_getLayerTitle(){var {layer:a}=this;if(a&&({title:a}=a,a))return`${a}${this._getSearchFieldsString()}`}};c.__decorate([d.property({json:{read:{source:"field.name"},write:{target:"field.name"}}})],b.prototype,"displayField",void 0);c.__decorate([d.property({json:{read:{source:"field.exactMatch"}, write:{target:"field.exactMatch"}}})],b.prototype,"exactMatch",void 0);c.__decorate([d.property({value:null})],b.prototype,"layer",null);c.__decorate([d.property()],b.prototype,"name",null);c.__decorate([d.property({type:[String],json:{write:!0}})],b.prototype,"orderByFields",void 0);c.__decorate([d.property()],b.prototype,"searchFields",void 0);c.__decorate([d.property()],b.prototype,"searchTemplate",void 0);c.__decorate([d.property()],b.prototype,"suggestionTemplate",void 0);return b=g=c.__decorate([l.subclass("esri.widgets.Search.LayerSearchSource")], b)});