// 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/ThreatAnalysis/newZone.html":'\x3cdiv class\x3d"esriCTPopupNode"\x3e\r\n  \x3cdiv class\x3d"esriCTPopupContainer"\x3e\r\n\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n      \x3cdiv class\x3d"esriCTLabel"\x3e${nls.descriptionLabel}\x3c/div\x3e\r\n      \x3cdiv class\x3d"esriCTDijitControl"\x3e\r\n        \x3cdiv class\x3d"esriCTDijitWrapper"\x3e\r\n          \x3cdiv class\x3d"esriCTDijitWrapper" data-dojo-attach-point\x3d"zoneDescriptionTextBox"\r\n            data-dojo-type\x3d"dijit/form/ValidationTextBox" aria-label\x3d"${nls.descriptionLabel}" trim\x3d"true" required\x3d"true"\x3e\r\n          \x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n      \x3cdiv class\x3d"esriCTLabel" data-dojo-attach-point\x3d"zoneDistanceLabel"\x3e\x3c/div\x3e\r\n      \x3cdiv class\x3d"esriCTDijitControl"\x3e\r\n        \x3cdiv class\x3d"esriCTDijitWrapper"\x3e\r\n          \x3cdiv class\x3d"esriCTDijitWrapper" data-dojo-attach-point\x3d"zoneDistanceTextBox"\r\n          data-dojo-type\x3d"dijit/form/NumberTextBox" data-dojo-props\x3d"constraints:{min: 0.01}" trim\x3d"true" required\x3d"true"\x3e\r\n          \x3c/div\x3e\r\n        \x3c/div\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n      \x3cdiv class\x3d"esriCTSymbologyLabel" title\x3d"${nls.outline}"\x3e${nls.outline}\x3c/div\x3e\r\n      \x3cdiv class\x3d"colorPicker Line" id\x3d"outlineColor" data-dojo-attach-point\x3d"outlineColorPicker"\x3e\r\n      \x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n    \x3cdiv class\x3d"esriCTWrapper"\x3e\r\n      \x3cdiv class\x3d"esriCTSymbologyLabel" title\x3d"${nls.fill}"\x3e${nls.fill}\x3c/div\x3e\r\n      \x3cdiv class\x3d"colorPicker Fill" id\x3d"fillColor" data-dojo-attach-point\x3d"fillColorPicker"\x3e\x3c/div\x3e\r\n    \x3c/div\x3e\r\n\r\n  \x3c/div\x3e\r\n\r\n\x3c/div\x3e'}});
define("dojo/_base/declare dojo/_base/array ./js/ColorPickerEditor jimu/BaseWidget dijit/_WidgetsInTemplateMixin dojo/text!./newZone.html dojo/_base/lang dojo/Evented dojo/dom-class dojo/query dijit/registry jimu/dijit/Popup jimu/utils dojo/string dojo/on dojo/number dojo/keys dijit/form/NumberTextBox dijit/form/ValidationTextBox dijit/form/Select jimu/dijit/SymbolChooser".split(" "),function(p,e,q,r,t,u,c,v,w,h,g,x,d,y,f,k,n){return p([r,t,v],{baseClass:"jimu-widget-threatAnalysis-newZoneSettings",
templateString:u,selectedSettings:{},colorPickerNodes:[],dropdownNodes:[],prevZoneName:null,newZonePopup:null,constructor:function(a){c.mixin(this,a)},startup:function(){this._setSymbologySettings()},postCreate:function(){this.inherited(arguments);this.newZonePopup=this.prevZoneName=null;this.own(f(window,"resize",c.hitch(this,function(){this._setNewZonePopupDimensions()})));this.currentRowData&&this.currentRowData.zoneDescription&&(this.zoneDescriptionTextBox.set("value",this.currentRowData.zoneDescription),
this.zoneDescriptionTextBox.set("title",this.currentRowData.zoneDescription),this.prevZoneName=this.currentRowData.zoneDescription);this._zoneDescriptionTextBoxValidator();this.currentRowData&&this.currentRowData.distance&&(this.zoneDistanceTextBox.set("value",this.currentRowData.distance),this.zoneDistanceTextBox.set("title",this.currentRowData.distance));this.zoneDistanceLabel.innerHTML=y.substitute(this.nls.distanceLabel,{unitAbbr:this.unitAbbr});this.disableInputs&&(this.zoneDescriptionTextBox.set("disabled",
!0),this.zoneDistanceTextBox.set("disabled",!0),this.currentRowData&&this.currentRowData.distance&&(this.zoneDistanceTextBox.set("value",this._convertValue(this.currentRowData.distance)),this.zoneDistanceTextBox.set("title",this._convertValue(this.currentRowData.distance))));this.own(f(this.zoneDescriptionTextBox,"blur",c.hitch(this,function(){this.zoneDescriptionTextBox.set("value",d.stripHTML(d.sanitizeHTML(this.zoneDescriptionTextBox.value)));this.zoneDescriptionTextBox.set("title",d.stripHTML(d.sanitizeHTML(this.zoneDescriptionTextBox.value)))})));
this.own(f(this.zoneDescriptionTextBox,"change",c.hitch(this,function(a){this.zoneDescriptionTextBox.set("title",a)})));this.own(f(this.zoneDistanceTextBox,"change",c.hitch(this,function(){isNaN(this.zoneDistanceTextBox.value)?this.zoneDistanceTextBox.set("title",""):this.zoneDistanceTextBox.set("title",this.zoneDistanceTextBox.value)})));this._createPopUp()},_createPopUp:function(){this.newZonePopup=new x({titleLabel:this.isAddZone?this.nls.newThreatZonePopupLabel:this.nls.editThreatZonePopupLabel,
width:670,maxHeight:800,autoHeight:!0,"class":this.baseClass,content:this,buttons:[{label:this.nls.ok,onClick:c.hitch(this,function(){this.zoneDescriptionTextBox.isValid()?this.zoneDistanceTextBox.isValid()?this._validInputs()&&(this.emit("zoneInfoUpdated",{name:d.stripHTML(d.sanitizeHTML(this.zoneDescriptionTextBox.value)),distance:this.zoneDistanceTextBox.get("value"),symbol:this._getSymbologySettings()}),this.newZonePopup.close()):this.zoneDistanceTextBox.focus():this.zoneDescriptionTextBox.focus()})},
{label:this.nls.cancel,classNames:["jimu-btn-vacation"],onClick:c.hitch(this,function(){this.emit("cancelBtnClicked");this.newZonePopup.close()})}]});this._setNewZonePopupDimensions()},_setSymbologySettings:function(){var a={outlineColor:{color:"#d10e40",transparency:0,type:"esriSLSSolid"},fillColor:{color:"#d10e40",transparency:.88,type:"esriSFSSolid"}};this.colorPickerNodes=h(".colorPicker",this.domNode);this.dropdownNodes=h(".dropdown",this.domNode);e.forEach(this.colorPickerNodes,c.hitch(this,
function(b){b=new q({nls:this.nls,type:w.contains(b,"Line")?"line":"fill"},b);b.setValues({color:this.currentRow&&this.currentRow.symbol?this.currentRow.symbol[b.id].color:a[b.id].color,transparency:this.currentRow&&this.currentRow.symbol?this.currentRow.symbol[b.id].transparency:a[b.id].transparency});b.startup();var l=h(".jimu-color-pickerPopup",this.domNode);e.forEach(l,c.hitch(this,function(z){this.own(f(z,"keydown",c.hitch(this,function(m){m.keyCode!==n.ENTER&&m.keyCode!==n.SPACE||m.currentTarget.click()})))}));
b.dropdown.set("value",this.currentRow&&this.currentRow.symbol?this.currentRow.symbol[b.id].type:a[b.id].type)}))},_getSymbologySettings:function(){e.forEach(this.colorPickerNodes,c.hitch(this,function(a){var b={color:g.byId(a.id).getValues().color,transparency:g.byId(a.id).getValues().transparency,type:g.byId(a.id).dropdown.getValue()};this.selectedSettings[a.id]=b}));return this.selectedSettings},_isDuplicateZoneName:function(a){var b=!1;e.some(this.existingZoneNames,c.hitch(this,function(l){if(a.toLowerCase()===
l.toLowerCase())return b=!0}));return b},_zoneDescriptionTextBoxValidator:function(){this.zoneDescriptionTextBox.validator=c.hitch(this,function(a){return a?a!==this.prevZoneName&&this._isDuplicateZoneName(a)?(this.zoneDescriptionTextBox.set("invalidMessage",this.nls.uniqueZoneDescriptionMsg),!1):!0:(this.zoneDescriptionTextBox.set("invalidMessage",this.nls.requiredMsg),!1)})},_validInputs:function(){var a=!0;e.some(this.colorPickerNodes,function(b){if(!g.byId(b.id).validateSpinner())return a=!1,
!0},this);return a},_convertValue:function(a){a=this.unitAbbr===this.nls.metersAbbr?k.parse(a)/3.280839895:k.parse(a);return k.format(a,{places:2})},_setNewZonePopupDimensions:function(){this.newZonePopup&&(window.appInfo.isRunInMobile?(this.newZonePopup.set("width",window.innerWidth-100),this.newZonePopup.set("height",450)):this.newZonePopup.set("width",670))}})});