// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://js.arcgis.com/3.23/esri/copyright.txt for details.
//>>built
require({cache:{"url:esri/dijit/RasterFunctionEditor/templates/RFxRasterArrayEditor.html":'\x3cdiv class\x3d"esriRFxRasterArrayEditor"\x3e\r\n  \x3ctable class\x3d"esriRFxArgsEditor__table"\x3e\r\n    \x3ccol width\x3d"auto"\x3e\r\n    \x3ccol class\x3d"esriRFxRasterArrayEditor__td--btn"\x3e\r\n    \x3ctr\x3e\r\n      \x3ctd colspan\x3d"2"\x3e\r\n        \x3cdiv data-dojo-type\x3d"dijit/form/Select" data-dojo-attach-point\x3d"_layerSelect"\x3e\x3c/div\x3e\r\n      \x3c/td\x3e\r\n    \x3c/tr\x3e\r\n    \x3ctr\x3e\r\n      \x3ctd rowspan\x3d"3" class\x3d"esriRFxRasterArrayEditor__td--grid"\x3e\r\n        \x3cdiv class\x3d"esriRFxRasterArrayEditor__grid" data-dojo-attach-point\x3d"_gridNode"\x3e\x3c/div\x3e\r\n      \x3c/td\x3e\r\n      \x3ctd\x3e\r\n        \x3cdiv data-dojo-type\x3d"dijit/form/Button" class\x3d"esriActionButton esriRFxRasterArrayEditor__btn" data-dojo-attach-event\x3d"onClick: _onUpButtonClick" data-dojo-props\x3d"iconClass: \'iconMoveUp\'"\r\n        data-dojo-attach-point\x3d"_moveUpButton" title\x3d"${_i18n.rfxRasterArrayEditor.moveUp}"\x3e\x3c/div\x3e\r\n      \x3c/td\x3e\r\n    \x3c/tr\x3e\r\n    \x3ctr\x3e\r\n      \x3ctd\x3e\r\n        \x3cdiv data-dojo-type\x3d"dijit/form/Button" class\x3d"esriActionButton esriRFxRasterArrayEditor__btn" data-dojo-attach-event\x3d"onClick: _onDownButtonClick" data-dojo-props\x3d"iconClass: \'iconMoveDown\'"\r\n        data-dojo-attach-point\x3d"_moveDownButton" title\x3d"${_i18n.rfxRasterArrayEditor.moveDown}"\x3e\x3c/div\x3e\r\n      \x3c/td\x3e\r\n    \x3c/tr\x3e\r\n    \x3ctr\x3e\r\n      \x3ctd\x3e\r\n        \x3cdiv data-dojo-type\x3d"dijit/form/Button" class\x3d"esriActionButton esriRFxRasterArrayEditor__btn" data-dojo-attach-event\x3d"onClick: _onRemoveButtonClick" data-dojo-props\x3d"iconClass:\'esriAnalysisDeleteIcon\'"\r\n        data-dojo-attach-point\x3d"_removeButton" title\x3d"${_i18n.rfxRasterArrayEditor.remove}"\x3e\x3c/div\x3e\r\n      \x3c/td\x3e\r\n    \x3c/tr\x3e\r\n  \x3c/table\x3e\r\n\x3c/div\x3e'}});
define("esri/dijit/RasterFunctionEditor/RFxRasterArrayEditor","dojo/_base/declare dojo/has ../../kernel dojo/_base/lang dojo/_base/array dojo/store/Memory dojo/store/Observable dojo/data/ObjectStore dijit/form/Select dijit/form/Button dijit/_WidgetBase dijit/_TemplatedMixin dijit/_WidgetsInTemplateMixin dgrid/OnDemandGrid dgrid/Selection ./utils dojo/text!./templates/RFxRasterArrayEditor.html dojo/i18n!../../nls/jsapi".split(" "),function(g,l,m,h,d,k,n,p,f,z,q,r,t,u,v,w,x,y){f=g("RFxRasterArrayEditor",
[q,r,t],{templateString:x,inputLayers:null,value:[],_lastId:1,constructor:function(a){this.inherited(arguments);this._i18n=y.widgets.rasterFunctionEditor},postCreate:function(){this.inherited(arguments);this._populateLayerSelect();this._setupGrid()},_getInputLayersStore:function(){return new p(new k({data:this.inputLayers}))},_populateLayerSelect:function(){this._layerSelect.set("labelAttr","name");this._layerSelect.set("store",this._getInputLayersStore());this.own(this._layerSelect.on("change",h.hitch(this,
this._addLayer)))},_setupGrid:function(){this._layerStore=n(new k);this._layerGrid=new (g([u,v]))({selectionMode:"single",showHeader:!1,store:this._layerStore,queryOptions:{sort:[{attribute:"id"}]},columns:[{field:"name"}]},this._gridNode)},_addLayer:function(){var a=this._layerSelect.store.get(this._layerSelect.value),b=this._layerStore.data.length;a&&(a={id:b+1,name:a.name,url:a.url},this._layerStore.put(a),this._refreshGrid())},_onRemoveButtonClick:function(){var a=this._getSelectedId();this._layerStore.remove(a);
this._refreshGrid()},_adjustGridItemIds:function(){var a=this._layerStore&&this._layerStore.data;a&&d.map(a,function(a,c){a.id=c+1;return a})},_onUpButtonClick:function(){var a=this._getSelectedItem();if(this._layerStore&&this._layerStore.data&&a){var b,c=this._layerStore.data,e=d.indexOf(c,a);0>=e||(b=c[e-1],c[e-1]=a,c[e]=b,this._refreshGrid())}},_onDownButtonClick:function(){var a=this._getSelectedItem();if(this._layerStore&&this._layerStore.data&&a){var b=this._layerStore.data,c=d.indexOf(b,a);
c!==b.length-1&&(b[c]=b[c+1],b[c+1]=a,this._refreshGrid())}},_getSelectedId:function(){return Object.keys(this._layerGrid&&this._layerGrid.selection)[0]},_getSelectedItem:function(){var a=this._getSelectedId();return this._layerStore.get(a)},_refreshGrid:function(){this._adjustGridItemIds();this._updateValue();this._layerGrid.refresh()},_updateValue:function(){var a=this._layerStore&&this._layerStore.data,b=[];a&&(d.forEach(a,function(a){b.push(w.getRasterJsonFromLayer(a))},this),this.value=b)}});
l("extend-esri")&&h.setObject("dijit.RasterFunctionEditor.RFxNamedRasterEditor",f,m);return f});