// All material copyright ESRI, All Rights Reserved, unless otherwise specified.// See https://js.arcgis.com/4.6/esri/copyright.txt for details.//>>builtdefine("require exports ../core/tsSupport/extendsHelper ../core/tsSupport/decorateHelper ../core/typescript dojo/json dojo/Deferred ../renderers/support/jsonUtils ./core/messageHandler ./core/MessageReceiver ./core/errorMessages ../layers/support/Field ../tasks/support/FeatureSet".split(" "),function(t,u,l,g,h,m,e,n,d,p,f,q,r){returnfunction(k){functionc(a){a=k.call(this)||this;a.id=null;a.name=null;a.mapWidgetId=null;a.objectIdFieldName=null;a.displayFieldName=null;a.typeIdFieldName=null;a.fields=null;a.types=null;a.geometryType=null;a.supportsSelection=!1;a.isBroken=!1;a._popupInfo=null;a._renderer=null;a.advancedQueryCapabilities=null;returna}l(c,k);c.prototype.dojoConstructor=function(a){this.fields||(this.fields=[]);for(a=0;a<this.fields.length;a++){varb=this.fields[a];"string"===typeofb&&(b=m.parse(b));this.fields[a]=newq(b)}};c.prototype._findField=function(a){if(!a||!Array.isArray(this.fields))returnnull;for(varb=0;b<this.fields.length;b++)if(this.fields[b].name===a)returnthis.fields[b];returnnull};c.prototype._findType=function(a){if(!a||!Array.isArray(this.types))returnnull;for(varb=0;b<this.types.length;b++)if(this.types[b].id===a)returnthis.types[b];returnnull};c.prototype._getCodedValueFromCodedDomain=function(a,b){if(!b||"codedValue"!==b.type)returnnull;for(varc=0;c<b.codedValues.length;c++)if(b.codedValues[c].code===a)returnb.codedValues[c];returnnull};c.prototype.executeQuery=function(a){varb=this;returnd._sendMessageWithReply({functionName:"executeQuery",args:{dataSourceId:this.id,query:a}}).then(function(a){b.isBroken=!1;returnnewr(a.featureSet)}).otherwise(function(a){b.isBroken=!0;throwa;})};c.prototype.getAssociatedSelectionDataSourceId=function(){returnd._sendMessageWithReply({functionName:"getAssociatedSelectionDataSource",args:{dataSourceId:this.id}}).then(function(a){returna.dataSourceId})};c.prototype.selectFeaturesByObjectIds=function(a){if(!Array.isArray(a))throwError(f.invalidObjectIdArray);if(!this.supportsSelection)throwError(f.selectionNotSupported);d._sendMessage({functionName:"selectFeaturesByIds",args:{dataSourceId:this.id,objectIds:a}})};c.prototype.selectFeatures=function(a){if(!this.supportsSelection)throwError(f.selectionNotSupported);d._sendMessage({functionName:"selectFeatures",args:{dataSourceId:this.id,geometry:a}})};c.prototype.clearSelection=function(){this.supportsSelection&&d._sendMessage({functionName:"clearSelection",args:{dataSourceId:this.id}})};c.prototype.getPopupInfo=function(){vara=this;returnthis._popupInfo?(newe).resolve(this._popupInfo):d._sendMessageWithReply({functionName:"getPopupInfo",args:{dataSourceId:this.id}}).then(function(b){a._popupInfo=b.popupInfo;returna._popupInfo})};c.prototype.getRenderer=function(){vara=this;returnthis._renderer?(newe).resolve(this._renderer):d._sendMessageWithReply({functionName:"getRenderer",args:{dataSourceId:this.id}}).then(function(b){if(!b.renderer)returnnull;a._renderer=n.fromJSON(b.renderer);returna._renderer})};c.prototype.getAdvancedQueryCapabilities=function(){vara=this;returnthis.advancedQueryCapabilities?(newe).resolve(this.advancedQueryCapabilities):d.isNative?d._sendMessageWithReply({functionName:"getAdvancedQueryCapabilities",args:{dataSourceId:this.id}}).then(function(b){if(!b.advancedQueryCapabilities)returnnull;a.advancedQueryCapabilities=b.advancedQueryCapabilities;returna.advancedQueryCapabilities}):(newe).resolve(null)};c.prototype.getTypeFromFeature=function(a){returnthis.typeIdFieldName?this._findType(a.attributes[this.typeIdFieldName]):null};c.prototype.getValueFromFeature=function(a,b){varc=this._findField(b);if(!b||!c)returnnull;vard=a.attributes[b];if(!d&&(d=a.attributes[b.toUpperCase()],!d))returnnull;if(this.typeIdFieldName===b){vare=this._findType(d);if(e)returne.name}return(a=this.getTypeFromFeature(a))&&Array.isArray(a.domains)&&(b=this._getCodedValueFromCodedDomain(d,a.domains[b]))?b.name:(b=this._getCodedValueFromCodedDomain(d,c.domain))?b.name:d};g([h.shared("esri.opsdashboard.DataSourceProxy")],c.prototype,"declaredClass",void0);returnc=g([h.subclass()],c)}(p)});