// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
define("dojo/_base/lang dojo/_base/array dojo/_base/declare ./BlankValueProvider ./SimpleValueProvider ./TwoNumbersValueProvider ./TwoDatesValueProvider ./ListValueProvider ./AdvancedListValueProvider ./PredefinedValueProvider ./NumberListValueProvider ./DateIsInValueProvider jimu/utils jimu/LayerInfos/LayerInfos".split(" "),function(k,q,t,u,v,w,x,y,n,z,A,B,C,D){var l={stringOperatorIs:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",codedValueProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,
supportCaseSensitive:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0,supportCaseSensitive:!0},uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0}},stringOperatorIsNot:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",codedValueProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},
unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0,supportCaseSensitive:!0},uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0}},stringOperatorStartsWith:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0},values:{normalProviderType:"SIMPLE_VALUE_PROVIDER"},uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0,
supportCaseSensitive:!0},multiplePredefined:{normalProviderType:"MULTIPLE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0}},stringOperatorEndsWith:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0},values:{normalProviderType:"SIMPLE_VALUE_PROVIDER"},uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0},multiplePredefined:{normalProviderType:"MULTIPLE_PREDEFINED_VALUE_PROVIDER",
supportAskForValue:!0,supportCaseSensitive:!0}},stringOperatorContains:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0},values:{normalProviderType:"SIMPLE_VALUE_PROVIDER"},uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0},multiplePredefined:{normalProviderType:"MULTIPLE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0}},stringOperatorDoesNotContain:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",
supportAskForValue:!0,supportCaseSensitive:!0},values:{normalProviderType:"SIMPLE_VALUE_PROVIDER"},uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0},multiplePredefined:{normalProviderType:"MULTIPLE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0}},stringOperatorIsAnyOf:{values:{normalProviderType:"SIMPLE_VALUE_PROVIDER"},multiple:{normalProviderType:"ADVANCED_LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0,
supportCaseSensitive:!0},multiplePredefined:{normalProviderType:"MULTIPLE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0}},stringOperatorIsNoneOf:{values:{normalProviderType:"SIMPLE_VALUE_PROVIDER"},multiple:{normalProviderType:"ADVANCED_LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0,supportCaseSensitive:!0},multiplePredefined:{normalProviderType:"MULTIPLE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0,supportCaseSensitive:!0}},stringOperatorIsBlank:{value:{normalProviderType:"BLANK_VALUE_PROVIDER"}},
stringOperatorIsNotBlank:{value:{normalProviderType:"BLANK_VALUE_PROVIDER"}},numberOperatorIs:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",codedValueProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0},uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0}},numberOperatorIsNot:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",
codedValueProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0},uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0}},numberOperatorIsAtLeast:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",supportAskForValue:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",
supportAskForValue:!0,filterCodedValueIfPossible:!0},uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0}},numberOperatorIsLessThan:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",supportAskForValue:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0},uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0}},numberOperatorIsAtMost:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",
supportAskForValue:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0},uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0}},numberOperatorIsGreaterThan:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",supportAskForValue:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0},
uniquePredefined:{normalProviderType:"UNIQUE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0}},numberOperatorIsAnyOf:{values:{normalProviderType:"SIMPLE_VALUE_PROVIDER"},multiple:{normalProviderType:"ADVANCED_LIST_VALUE_PROVIDER",supportAskForValue:!0},multiplePredefined:{normalProviderType:"MULTIPLE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0}},numberOperatorIsNoneOf:{values:{normalProviderType:"SIMPLE_VALUE_PROVIDER"},multiple:{normalProviderType:"ADVANCED_LIST_VALUE_PROVIDER",supportAskForValue:!0},
multiplePredefined:{normalProviderType:"MULTIPLE_PREDEFINED_VALUE_PROVIDER",supportAskForValue:!0}},numberOperatorIsBetween:{value:{normalProviderType:"TWO_NUMBERS_VALUE_PROVIDER",supportAskForValue:!0}},numberOperatorIsNotBetween:{value:{normalProviderType:"TWO_NUMBERS_VALUE_PROVIDER",supportAskForValue:!0}},numberOperatorIsBlank:{value:{normalProviderType:"BLANK_VALUE_PROVIDER"}},numberOperatorIsNotBlank:{value:{normalProviderType:"BLANK_VALUE_PROVIDER"}},dateOperatorIsOn:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",
supportAskForValue:!0,customVirtualDates:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0}},dateOperatorIsNotOn:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",supportAskForValue:!0,customVirtualDates:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0}},dateOperatorIsIn:{value:{normalProviderType:"DATE_IS_IN_VALUE_PROVIDER",
supportAskForValue:!0}},dateOperatorIsNotIn:{value:{normalProviderType:"DATE_IS_IN_VALUE_PROVIDER",supportAskForValue:!0}},dateOperatorIsBefore:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",supportAskForValue:!0,customVirtualDates:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0}},dateOperatorIsAfter:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",supportAskForValue:!0,customVirtualDates:!0},
field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0}},dateOperatorIsOnOrBefore:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",supportAskForValue:!0,customVirtualDates:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0}},dateOperatorIsOnOrAfter:{value:{normalProviderType:"SIMPLE_VALUE_PROVIDER",supportAskForValue:!0,
customVirtualDates:!0},field:{normalProviderType:"LIST_VALUE_PROVIDER"},unique:{normalProviderType:"LIST_VALUE_PROVIDER",supportAskForValue:!0,filterCodedValueIfPossible:!0}},dateOperatorInTheLast:{value:{normalProviderType:"NUMBER_LIST_VALUE_PROVIDER",supportAskForValue:!0}},dateOperatorNotInTheLast:{value:{normalProviderType:"NUMBER_LIST_VALUE_PROVIDER",supportAskForValue:!0}},dateOperatorIsBetween:{value:{normalProviderType:"TWO_DATES_VALUE_PROVIDER",supportAskForValue:!0,customVirtualDates:!0}},
dateOperatorIsNotBetween:{value:{normalProviderType:"TWO_DATES_VALUE_PROVIDER",supportAskForValue:!0,customVirtualDates:!0}},dateOperatorIsBlank:{value:{normalProviderType:"BLANK_VALUE_PROVIDER"}},dateOperatorIsNotBlank:{value:{normalProviderType:"BLANK_VALUE_PROVIDER"}}},g=t([],{nls:null,layerInfo:null,popupInfo:null,url:null,layerDefinition:null,featureLayerId:null,constructor:function(a){k.mixin(this,a);this.nls=window.jimuNls.filterBuilder;a=D.getInstanceSync();this.featureLayerId&&(this.layerInfo=
a.getLayerOrTableInfoById(this.featureLayerId))&&(this.popupInfo=this.layerInfo.getPopupInfo())},getSupportedValueTypes:function(a,c){var b=[];if(c=l[c])c.value&&b.push("value"),c.field&&0<this._getSameShortTypeFieldNames(a).length&&b.push("field"),c.unique&&this.url&&(this._isStreamServer(this.url)||b.push("unique")),c.multiple&&this.url&&(this._isStreamServer(this.url)||b.push("multiple")),c.uniquePredefined&&this.url&&(this._isStreamServer(this.url)||b.push("uniquePredefined")),c.multiplePredefined&&
this.url&&(this._isStreamServer(this.url)||b.push("multiplePredefined"));return b},_isStreamServer:function(a){a=(a||"").replace(/\/*$/g,"");return/\/StreamServer$/gi.test(a)},_getSameShortTypeFieldNames:function(a){var c=[],b=this._getFieldInfo(this.layerDefinition,a),f=g.getShortTypeByEsriType(b.type);q.forEach(this.layerDefinition.fields,k.hitch(this,function(e){e.name!==a&&g.getShortTypeByEsriType(e.type)===f&&c.push(e.name)}));return c},_getSameShortTypeFieldNameLabels:function(a){var c=[],b=
this._getFieldInfo(this.layerDefinition,a),f=g.getShortTypeByEsriType(b.type);q.forEach(this.layerDefinition.fields,k.hitch(this,function(e){e.name!==a&&g.getShortTypeByEsriType(e.type)===f&&c.push({value:e.name,label:e.alias})}));return c},getValueProvider:function(a,c){var b=null,f=k.clone(l[a.operator]);if(f){var e=a.valueObj.type,h=a.fieldObj.name,E=this._getFieldInfo(this.layerDefinition,h),m=f[e],d=m.normalProviderType,r=null,p=C.getCodedValueListForCodedValueOrSubTypes(this.layerDefinition,
h);"field"===e?(h=this._getSameShortTypeFieldNameLabels(h),0<h.length&&(r=h)):p&&0<p.length&&m.codedValueProviderType&&(d=m.codedValueProviderType);a={nls:this.nls,url:this.url,layerDefinition:this.layerDefinition,partObj:a,fieldInfo:E,codedValues:p,staticValues:r,layerInfo:this.layerInfo,popupInfo:this.popupInfo,operatorInfo:f,filterCodedValueIfPossible:!!m.filterCodedValueIfPossible,runtime:c};if("BLANK_VALUE_PROVIDER"===d)b=new u(a);else if("SIMPLE_VALUE_PROVIDER"===d)b=new v(a);else if("TWO_NUMBERS_VALUE_PROVIDER"===
d)b=new w(a);else if("TWO_DATES_VALUE_PROVIDER"===d)b=new x(a);else if("LIST_VALUE_PROVIDER"===d)a.showNullValues=!1,"value"===e||"field"===e?b=new y(a):(a.providerType=d,a.selectUI="dropdown",b=new n(a));else if("NUMBER_LIST_VALUE_PROVIDER"===d)b=new A(a);else if("DATE_IS_IN_VALUE_PROVIDER"===d)b=new B(a);else if("ADVANCED_LIST_VALUE_PROVIDER"===d)a.providerType=d,a.selectUI="dropdown",b=new n(a);else if("UNIQUE_PREDEFINED_VALUE_PROVIDER"===d||"MULTIPLE_PREDEFINED_VALUE_PROVIDER"===d)a.providerType=
d,a.selectUI=a.partObj.valueObj?a.partObj.valueObj.selectUI:null,b=c?new n(a):new z(a)}return b},_getFieldInfo:function(a,c){a=a.fields;for(var b=0;b<a.length;b++){var f=a[b];if(c===f.name)return f}return null}});g.getOperatorInfo=function(a){return k.clone(l[a])};g.isSupportVirtualDates=function(a){var c=l[a];return c&&c.value&&c.value.customVirtualDates?{status:!0,num:"dateOperatorIsBetween"===a||"dateOperatorIsNotBetween"===a?2:1}:{status:!1}};g.getOperatorsByShortType=function(a,c){var b=[];"string"===
a?b="stringOperatorIs stringOperatorIsNot stringOperatorStartsWith stringOperatorEndsWith stringOperatorContains stringOperatorDoesNotContain stringOperatorIsAnyOf stringOperatorIsNoneOf stringOperatorIsBlank stringOperatorIsNotBlank".split(" "):"number"===a?b="numberOperatorIs numberOperatorIsNot numberOperatorIsAtLeast numberOperatorIsAtMost numberOperatorIsLessThan numberOperatorIsGreaterThan numberOperatorIsAnyOf numberOperatorIsNoneOf numberOperatorIsBetween numberOperatorIsNotBetween numberOperatorIsBlank numberOperatorIsNotBlank".split(" "):
"date"===a&&(b="dateOperatorIsOn dateOperatorIsNotOn dateOperatorIsIn dateOperatorIsNotIn dateOperatorIsBefore dateOperatorIsAfter dateOperatorIsOnOrBefore dateOperatorIsOnOrAfter dateOperatorIsBetween dateOperatorIsNotBetween dateOperatorIsBlank dateOperatorIsNotBlank".split(" "),c&&b.splice(8,0,"dateOperatorInTheLast","dateOperatorNotInTheLast"));return b};g.getShortTypeByEsriType=function(a){var c=null;"esriFieldTypeString"===a?c="string":"esriFieldTypeDate"===a?c="date":0<=["esriFieldTypeOID",
"esriFieldTypeSmallInteger","esriFieldTypeInteger","esriFieldTypeSingle","esriFieldTypeDouble"].indexOf(a)&&(c="number");return c};return g});