// 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
require({cache:{"url:widgets/NetworkTrace/setting/projectSetting.html":'\x3cdiv data-dojo-attach-point\x3d"ProjectSettings" class\x3d"esriCTProjectSettings"\x3e\r\n    \x3cdiv data-dojo-attach-point\x3d"layerSelectorWrapper" class\x3d"esriCTWrapper"\x3e\r\n        \x3cdiv class\x3d"esriCTLabel"\x3e${nls.projectSetting.projectPolygonLayer}\x3c/div\x3e\r\n        \x3cdiv class\x3d"esriCTSelect"\x3e\r\n            \x3cdiv class\x3d"esriCTlayerField" style\x3d"width: 100%"\x3e\r\n                \x3cselect data-dojo-attach-point\x3d"projetPolygonLayerSelect" data-dojo-type\x3d"dijit/form/Select"\r\n                    data-dojo-attach-event\x3d"change:projectSettingsChanged" style\x3d"width: 100%"\x3e\r\n                \x3c/select\x3e\r\n            \x3c/div\x3e\r\n        \x3c/div\x3e\r\n        \x3cdiv class\x3d"esriCTHelpIcon" data-dojo-attach-point\x3d"polygonLayerHelp"\x3e\x3c/div\x3e\r\n    \x3c/div\x3e\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n        \x3cdiv class\x3d"esriCTLabel"\x3e${nls.projectSetting.outputParameterName}\x3c/div\x3e\r\n        \x3cdiv class\x3d"esriCTSelect"\x3e\r\n            \x3cdiv class\x3d"esriCTlayerField" style\x3d"width: 100%"\x3e\r\n                \x3cselect data-dojo-attach-point\x3d"outputParameters" data-dojo-type\x3d"dijit/form/Select"\r\n                    data-dojo-attach-event\x3d"change:projectSettingsChanged" style\x3d"width: 100%"\x3e\r\n                \x3c/select\x3e\r\n            \x3c/div\x3e\r\n        \x3c/div\x3e\r\n        \x3cdiv class\x3d"esriCTHelpIcon" data-dojo-attach-point\x3d"outputParameterHelp"\x3e\x3c/div\x3e\r\n    \x3c/div\x3e\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n        \x3cdiv class\x3d"esriCTLabel"\x3e${nls.projectSetting.projectPointLayer}\x3c/div\x3e\r\n        \x3cdiv class\x3d"esriCTSelect"\x3e\r\n            \x3cdiv class\x3d"esriCTlayerField" style\x3d"width: 100%"\x3e\r\n                \x3cselect data-dojo-attach-point\x3d"projectPointLayerSelect" data-dojo-type\x3d"dijit/form/Select"\r\n                    data-dojo-attach-event\x3d"change:projectSettingsChanged" style\x3d"width: 100%"\x3e\r\n                \x3c/select\x3e\r\n            \x3c/div\x3e\r\n        \x3c/div\x3e\r\n        \x3cdiv class\x3d"esriCTHelpIcon" data-dojo-attach-point\x3d"pointLayerHelp"\x3e\x3c/div\x3e\r\n    \x3c/div\x3e\r\n\x3c/div\x3e'}});
define("dojo/_base/declare dojo/Evented dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dojo/text!./projectSetting.html dojo/_base/lang dojo/on dojo/_base/array jimu/dijit/Message".split(" "),function(k,l,m,n,p,q,d,g,h,r){return k([m,l,n,p],{templateString:q,baseClass:"jimu-widget-NetworkTrace-setting",projectPolygonLayerOptions:[],projectPointLayerOptions:[],outputParametersOptions:[],startup:function(){this.inherited(arguments)},postCreate:function(){this._defaultSelectOption=
{value:"",label:this.nls.projectSetting.selectLabel};this.outputParametersOptions=[d.clone(this._defaultSelectOption)];this.projectPolygonLayerOptions=[d.clone(this._defaultSelectOption)];this.projectPointLayerOptions=[d.clone(this._defaultSelectOption)];this.layers=this.map.itemInfo.itemData.operationalLayers;0<this.layers.length&&this._getLayerOptions(this.layers);this.populateLayerOptions();this.populateOutParams();this.own(g(this.polygonLayerHelp,"click",d.hitch(this,function(){this._showMessage(this.nls.projectSetting.polygonLayerHelp)})));
this.own(g(this.outputParameterHelp,"click",d.hitch(this,function(){this._showMessage(this.nls.projectSetting.outputParameterHelp)})));this.own(g(this.pointLayerHelp,"click",d.hitch(this,function(){this._showMessage(this.nls.projectSetting.pointLayerHelp)})));this.setProjectSettings(this.config)},enableDisableProjectSettings:function(a){a||(this.projetPolygonLayerSelect.set("value",""),this.projectPointLayerSelect.set("value",""),this.outputParameters.set("value",""));this.projetPolygonLayerSelect.set("disabled",
!a);this.projectPointLayerSelect.set("disabled",!a);this.outputParameters.set("disabled",!a)},getProjectSettings:function(){var a="",b="",c="";this.projetPolygonLayerSelect&&(a=this._getSelectedOptionValue(this.projetPolygonLayerSelect));this.projectPointLayerSelect&&(b=this._getSelectedOptionValue(this.projectPointLayerSelect));this.outputParameters&&(c=this._getSelectedOptionValue(this.outputParameters));return{polygonLayerId:a,pointLayerId:b,outputParamName:c}},setProjectSettings:function(a){a&&
(this.projetPolygonLayerSelect&&a.polygonLayerId&&this.projetPolygonLayerSelect.set("value",a.polygonLayerId),this.projectPointLayerSelect&&a.pointLayerId&&this.projectPointLayerSelect.set("value",a.pointLayerId),this.outputParameters&&a.outputParamName&&this.outputParameters.set("value",a.outputParamName))},_getSelectedOptionValue:function(a){var b="";a&&a.options&&1<a.options.length&&h.some(a.options,function(c){if(c.selected)return b=c.value,!0});return b},_showMessage:function(a){(new r({message:a})).message=
a},_getLayerOptions:function(a){var b;h.forEach(a,d.hitch(this,function(c){c&&c.layerObject&&c.layerObject.capabilities&&((b=c.layerObject.capabilities)&&b.indexOf&&-1<b.indexOf("Create")&&-1<b.indexOf("Delete")&&-1<b.indexOf("Update")&&"esriGeometryPolygon"===c.layerObject.geometryType&&this._isValidProjectPolygonLayer(c)&&this.projectPolygonLayerOptions.push({value:c.id,label:c.title}),b&&b.indexOf&&-1<b.indexOf("Create")&&-1<b.indexOf("Delete")&&-1<b.indexOf("Update")&&"esriGeometryPoint"===c.layerObject.geometryType&&
this._isValidProjectPointLayer(c)&&this.projectPointLayerOptions.push({value:c.id,label:c.title}))}))},populateLayerOptions:function(){0<this.projectPolygonLayerOptions.length&&(this.projetPolygonLayerSelect.set("options",this.projectPolygonLayerOptions),this.projetPolygonLayerSelect.set("value",this.projetPolygonLayerSelect.options[0]));0<this.projectPointLayerOptions.length&&(this.projectPointLayerSelect.set("options",this.projectPointLayerOptions),this.projectPointLayerSelect.set("value",this.projectPointLayerSelect.options[0]))},
_isValidProjectPolygonLayer:function(a){var b;a=a.layerObject.fields;var c=[];for(b in a){var f=a[b].type;var e=a[b].name.toLowerCase();("name"===e&&"esriFieldTypeString"===f||"esriFieldTypeGlobalID"===f)&&c.push(e)}return 2<=c.length?!0:!1},_isValidProjectPointLayer:function(a){var b;a=a.layerObject.fields;var c=[];for(b in a){var f=a[b].type;var e=a[b].name.toLowerCase();("inputtype"===e&&"esriFieldTypeString"===f||"projectid"===e&&"esriFieldTypeGUID"===f)&&c.push(e)}return 2===c.length?!0:!1},
populateOutParams:function(){var a=[d.clone(this._defaultSelectOption)];h.forEach(this.outputParametersArray,d.hitch(this,function(b){"esriGeometryPolygon"===b.defaultValue.geometryType&&"esriGPParameterDirectionOutput"===b.direction&&a.push({label:b.displayName,value:b.name})}));this.outputParameters.set("options",a);this.outputParameters.set("value",this.outputParameters.options[0])},projectSettingsChanged:function(){this.emit("settingsChanged",this.getProjectSettings())}})});