// 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/lang dojo/_base/array dojo/_base/html dojo/on dojo/Deferred dojo/promise/all dojo/json dijit/form/NumberTextBox dijit/form/Select dijit/form/Textarea dijit/form/DateTextBox dijit/form/TimeTextBox jimu/dijit/CheckBox jimu/dijit/URLInput jimu/utils esri/tasks/LinearUnit esri/tasks/FeatureSet esri/geometry/Polygon esri/graphic ../BaseEditor".split(" "),function(f,l,h,d,r,w,x,t,k,m,y,z,A,B,C,u,D,E,F,G,g){function n(a,b){return new m({value:b,options:h.map(a,function(c){return{label:c,
value:c}})})}function p(a){return a.filter&&a.filter.type?a.filter.type.toLowerCase():null}function v(a){if(a.list&&2===a.list.length){var b=+a.list[0];a=+a.list[1]}else b=a.minimum,a=a.maximum;return isNaN(b)||isNaN(a)?null:(b=Math.min(b,a),a=Math.max(b,a),[b,a])}var e={};e.UnsupportEditor=f(g,{baseClass:"jimu-gp-editor-base jimu-gp-editor-unsupport",editorName:"UnsupportEditor",postCreate:function(){this.inherited(arguments);d.setAttr(this.domNode,"innerHTML",u.sanitizeHTML(this.message))},getValue:function(){return null}});
e.ShowMessage=f(g,{baseClass:"jimu-gp-editor-base jimu-gp-editor-message",editorName:"ShowMessage",postCreate:function(){this.inherited(arguments);d.setAttr(this.domNode,"innerHTML",u.sanitizeHTML(this.message))},getValue:function(){return null}});e.GeneralEditorWrapperEditor=f(g,{baseClass:"jimu-gp-editor-base jimu-gp-editor-wrapper",editorName:"GeneralEditorWrapperEditor",postCreate:function(){this.inherited(arguments);d.setStyle(this.gEditor.domNode,"width","100%");"Select"===this.editorName?d.addClass(this.gEditor.domNode,
"restrict-select-width"):"valuelist"===p(this.param)&&this.param.filter.list&&0<this.param.filter.list.length&&(this.gEditor=n(this.param.filter.list,this.param.defaultValue),d.addClass(this.gEditor.domNode,"restrict-select-width"));this.gEditor.placeAt(this.domNode)},reset:function(){this.gEditor.set("value","")},getValue:function(){var a=this.gEditor.getValue();return"string"===typeof a&&""===l.trim(a)?null:a}});e.LongNumberEditor=f(g,{baseClass:"jimu-gp-editor-base jimu-gp-editor-long",editorName:"LongNumberEditor",
postCreate:function(){this.inherited(arguments);this.value=isNaN(this.param.defaultValue)?NaN:this.param.defaultValue;var a=p(this.param);if("range"===a){if(a=v(this.param.filter))this.editor=new k({value:this.value,constraints:{places:0,min:a[0],max:a[1]}})}else"valuelist"===a&&this.param.filter.list&&0<this.param.filter.list.length&&(this.editor=n(this.param.filter.list,this.param.defaultValue));this.editor||(this.editor=new k({value:this.value,constraints:{places:0}}));this.editor.placeAt(this.domNode)},
reset:function(){this.editor.set("value",NaN)},getValue:function(){var a=this.editor.get("value");return isNaN(a)?null:a}});e.DoubleNumberEditor=f(g,{baseClass:"jimu-gp-editor-base jimu-gp-editor-double",editorName:"DoubleNumberEditor",postCreate:function(){this.inherited(arguments);this.value=isNaN(this.param.defaultValue)?NaN:this.param.defaultValue;var a=p(this.param);if("range"===a){if(a=v(this.param.filter))this.editor=new k({value:this.value,constraints:{places:"0,15",min:a[0],max:a[1]}})}else"valuelist"===
a&&this.param.filter.list&&0<this.param.filter.list.length&&(this.editor=n(this.param.filter.list,this.param.defaultValue));this.editor||(this.editor=new k({value:this.value,constraints:{places:"0,15"}}));this.editor.placeAt(this.domNode)},reset:function(){this.editor.set("value",NaN)},getValue:function(){var a=this.editor.get("value");return isNaN(a)?null:a}});e.MultiValueChooser=f(g,{baseClass:"jimu-gp-editor-base jimu-gp-editor-multivalue-chooser",editorName:"MultiValueChooser",postCreate:function(){this.inherited(arguments);
this.checkBoxs=[];h.forEach(this.param.choiceList,function(a){a=new B({label:a,checked:this.param.defaultValue&&-1<this.param.defaultValue.indexOf(a)?!0:!1});a.placeAt(this.domNode);this.checkBoxs.push(a)},this)},getValue:function(){var a=[];h.forEach(this.checkBoxs,function(b){b.checked&&a.push(b.label)},this);return a}});e.MultiValueEditor=f(g,{baseClass:"jimu-gp-editor-base jimu-gp-editor-multivalue",editorName:"MultiValueEditor",postCreate:function(){this.inherited(arguments);this.editors=[];
var a=d.create("div",{"class":"input-list"},this.domNode),b=l.clone(this.param,a);b.dataType=this.param.dataType.substr(13,this.param.dataType.length);b.originParam=this.param;this._initChildEditors(b,a);this._createAddInputNode(b,a)},_initChildEditors:function(a,b){this.param.defaultValue&&0<this.param.defaultValue.length?h.forEach(this.param.defaultValue,function(c){a.defaultValue=c;this._createSingleInputContainerNode(a,b)},this):(delete a.defaultValue,this._createSingleInputContainerNode(a,b))},
getValue:function(){var a=[];h.forEach(this.editors,function(b){(b=b.getValue())&&a.push(b)},this);return a},getGPValue:function(){var a=new w,b=[];h.forEach(this.editors,function(c){b.push(c.getGPValue())},this);x(b).then(function(c){a.resolve(c)},function(c){a.reject(c)});return a},destroy:function(){h.forEach(this.editors,function(a){a.destroy()});this.editors=[];this.inherited(arguments)},_createSingleInputContainerNode:function(a,b){b=d.create("div",{"class":"single-input"},b);a=this.editorManager.createEditor(a,
"input",this.context,{widgetUID:this.widgetUID,config:this.config});a.placeAt(b);this._createRemoveInputNode(b);b.inputEditor=a;this.editors.push(a);return b},_createRemoveInputNode:function(a){var b=d.create("div",{"class":"remove",innerHTML:"-"},a);this.own(r(b,"click",l.hitch(this,function(){this.editors.splice(this.editors.indexOf(a.inputEditor),1);a.inputEditor.destroy();d.destroy(a)})));return b},_createAddInputNode:function(a,b){var c=d.create("div",{"class":"add-input"},this.domNode),q=d.create("div",
{"class":"add-btn",innerHTML:"+"},c);this.own(r(q,"click",l.hitch(this,function(){this._createSingleInputContainerNode(a,b)})));return c}});e.LinerUnitEditor=f(g,{baseClass:"jimu-gp-editor-base jimu-gp-editor-liner-unit",editorName:"LinerUnitEditor",postCreate:function(){this.inherited(arguments);this.distance=this.param.defaultValue?this.param.defaultValue.distance:0;this.units=this.param.defaultValue?this.param.defaultValue.units:"esriMeters";this.inputDijit=new k({value:this.distance,constraints:{places:"0,15"}});
this.selectDijit=new m({value:this.units,options:[{label:this.nls.meters,value:"esriMeters"},{label:this.nls.kilometers,value:"esriKilometers"},{label:this.nls.feet,value:"esriFeet"},{label:this.nls.miles,value:"esriMiles"},{label:this.nls.nauticalMiles,value:"esriNauticalMiles"},{label:this.nls.yards,value:"esriYards"}]});d.addClass(this.selectDijit.domNode,"restrict-select-width");this.inputDijit.placeAt(this.domNode);this.selectDijit.placeAt(this.domNode)},getValue:function(){var a=new D;a.distance=
this.inputDijit.getValue();a.units=this.selectDijit.getValue();return a}});e.DateTimeEditor=f(g,{baseClass:"jimu-gp-editor-base jimu-gp-editor-datatime",editorName:"DateTimeEditor",postCreate:function(){var a=new Date(this.param.defaultValue);this.value=this.param.defaultValue?new Date(a.getFullYear(),a.getMonth(),a.getDate(),a.getHours(),a.getMinutes(),a.getSeconds()):null;this.inherited(arguments);this.dateDijit=new z({value:this.value,style:{width:"60%"}});this.timeDijit=new A({value:this.value,
style:{width:"40%"},constraints:{timePattern:"HH:mm:ss",clickableIncrement:"T00:15:00",visibleIncrement:"T00:15:00"}});this.dateDijit.placeAt(this.domNode);this.timeDijit.placeAt(this.domNode)},startup:function(){this.dateDijit.startup();this.timeDijit.startup()},reset:function(){this.dateDijit.set("value",void 0);this.timeDijit.set("value",void 0)},getValue:function(){var a=new Date,b=this.dateDijit.getValue(),c=this.timeDijit.getValue();return null!==b&&null!==c?(a.setFullYear(b.getFullYear()),
a.setMonth(b.getMonth()),a.setDate(b.getDate()),a.setHours(c.getHours()),a.setMinutes(c.getMinutes()),a.setSeconds(c.getSeconds()),a.getTime()):null}});e.GetUrlObjectFromLayer=f([g,m],{editorName:"GetUrlObjectFromLayer",postCreate:function(){this.options=[];h.forEach(this.map.graphicsLayerIds,function(a){a=this.map.getLayer(a);"esri.layers.FeatureLayer"!==a.declaredClass||this.geometryType&&a.geometryType!==this.geometryType||this.options.push({label:a.label||a.title||a.name||a.id,value:a.id})},this);
this.inherited(arguments);this.setValue(this.value);d.addClass(this.domNode,"jimu-gp-editor-sffl");d.addClass(this.domNode,"jimu-gp-editor-base")},getValue:function(){return this.value},getGPValue:function(){var a;h.forEach(this.map.graphicsLayerIds,function(c){var q=this.map.getLayer(c);c===this.getValue()&&(a=q.url)},this);var b={url:a};b=this.wrapGPValue(b);return this.wrapValueToDeferred(b)}});e.ObjectUrlEditor=f([g,C],{editorName:"ObjectUrlEditor",postCreate:function(){this.rest=!1;this.inherited(arguments);
d.addClass(this.domNode,"jimu-gp-editor-ourl");d.addClass(this.domNode,"jimu-gp-editor-base")},getValue:function(){return this.value},getGPValue:function(){var a=this.getValue()?{url:this.getValue()}:null;a=this.wrapGPValue(a);return this.wrapValueToDeferred(a)}});e.SimpleJsonEditor=f([g,y],{editorName:"SimpleJsonEditor",postMixInProperties:function(){this.inherited(arguments);"object"===typeof this.value&&(this.value=t.stringify(this.value))},postCreate:function(){this.inherited(arguments);d.addClass(this.domNode,
"jimu-gp-editor-json");d.addClass(this.domNode,"jimu-gp-editor-base");this.set("placeholder",this.nls.jsonPlaceholder)},getValue:function(){return this.value},getGPValue:function(){var a=this.getValue()?t.parse(this.getValue()):null;a=this.wrapGPValue(a);return this.wrapValueToDeferred(a)}});e.currentExtentEditor=f(g,{editorName:"SelectFeatureSetFromMap",postCreate:function(){this.inherited(arguments);d.setAttr(this.domNode,"innerHTML",this.message)},getValue:function(){var a=new E,b=[new G(F.fromExtent(this.map.extent))];
a.features=b;return a}});return e});