// 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/declare dojo/_base/array dojo/_base/lang dojo/topic dojo/Deferred esri/graphicsUtils dojo/aspect ./LayerInfo ./LayerInfoForDefaultWMS esri/layers/FeatureLayer esri/lang".split(" "),function(k,f,g,l,m,r,n,p,t,u,q){return k(p,{constructor:function(a,b){},_getExtent:function(){var a=new m;a.resolve(this.layerObject.extent||this.layerObject.fullExtent);return a},_initVisible:function(){this._visible=this.layerObject.visible},_setTopLayerVisible:function(a){this._visible=a;this.layerObject.setVisibility(a)},
_setSubLayerVisible:function(a){var b=[];b=g.clone(this.originOperLayer.layerObject.visibleLayers);for(var c in a)if(a.hasOwnProperty(c)&&"function"!==typeof a[c]){var d=a[c],h=c.toString();var e=f.indexOf(b,h);d?0>e&&b.push(h):0<=e&&b.splice(e,1)}this._setVisibleLayersBySelfFlag=!0;this.layerObject.setVisibleLayers(b)},_resetLayerObjectVisiblity:function(a){var b=a?a[this.id]:null,c=!1;if(a){b&&this.layerObject.setVisibility(b.visible);b={};for(var d in a)a.hasOwnProperty(d)&&"function"!==typeof a[d]&&
(c=!0,b[d]=a[d].visible);c&&this._setSubLayerVisibleByCheckedInfo(b)}},_setSubLayerVisibleByCheckedInfo:function(a){var b={};this.traversal(function(c){c.isRootLayer()||q.isDefined(a[c.id])&&c._setVisible(a[c.id])});this.traversal(function(c){0===c.getSubLayers().length&&(b[c.subId]=c._isAllSubLayerVisibleOnPath())});this._setSubLayerVisible(b)},_getServiceDefinition:function(){var a=this.getUrl();return this._serviceDefinitionBuffer.getRequest(this.subId).request(a)},_serviceDefinitionRequest:function(a){return this._normalRequest(a,
{SERVICE:"WMS",REQUEST:"GetCapabilities"},"xml")},obtainNewSubLayers:function(){var a=[];f.forEach(this.layerObject.layerInfos,function(b,c){b=this._getOperLayerFromWMSLayerInfo(b,this);b=this._layerInfoFactory.create(b);a.push(b);b.init()},this);a.reverse();return a},_getOperLayerFromWMSLayerInfo:function(a,b){return{layerObject:this.layerObject,title:a.label||a.title||a.name||" ",id:this.id+"_"+(a.name||a.title+"-"+Math.random()),subId:a.name||"-",wms:{layerInfo:this,subId:a.name||"-",wmsLayerInfo:a},
selfType:"wms",parentLayerInfo:b}},_bindEvent:function(){this.inherited(arguments);this.layerObject&&!this.layerObject.empty&&n.after(this.layerObject,"setVisibleLayers",g.hitch(this,this._onVisibleLayersChanged))},_onVisibleLayersChanged:function(){var a=[];this._setVisibleLayersBySelfFlag||(this.traversal(function(b){b.isRootLayer()||b._initVisible()}),this._setVisibleLayersBySelfFlag=!1);this.traversal(function(b){b.isRootLayer()||a.push(b)});this._setVisibleLayersBySelfFlag=!1;l.publish("layerInfos/layerInfo/visibleChanged",
a);this._isShowInMapChanged2()}})});