// 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/Deferred jimu/BaseFeatureAction jimu/Role jimu/LayerInfos/LayerInfos jimu/WidgetManager".split(" "),function(l,m,h,k,n,p,q,r){return l(n,{map:null,iconClass:"icon-edit",isFeatureSupported:function(a,b){var c=new k,d=b||h.getObject("_wabProperties.popupInfo.layerForActionWithEmptyFeatures",!1,this.map.infoWindow);if(!d)return c.resolve(!1),c;var e=q.getInstanceSync().getLayerInfoByTopLayerId(d&&d.id);a=new k;e&&(e.isTable||e.isShowInMap())?
a=e.isEditable():a.resolve(!1);a.then(h.hitch(this,function(t){var f=!1,g=this.appConfig.getConfigElementById(this.widgetId).config;g.editor.layerInfos?0===g.editor.layerInfos.length?f=!0:m.forEach(g.editor.layerInfos.concat(g.editor.tableInfos||[]),function(u){d.id===u.featureLayer.id&&(f=!0)}):f=!1;f&&e&&e.getUrl()&&t?c.resolve(!0):c.resolve(!1)}));return c},onExecute:function(a,b){var c=b||h.getObject("_wabProperties.popupInfo.layerForActionWithEmptyFeatures",!1,this.map.infoWindow);b=new k;r.getInstance().triggerWidgetOpen(this.widgetId).then(function(d){d.beginEditingByFeatures(a.features,
c)});return b.promise},_checkEditPrivilege:function(a){var b=!0;a&&(b=new p({id:a.roleId?a.roleId:a.role,role:a.role}),a.privileges&&b.setPrivileges(a.privileges),b=b.canEditFeatures());return b}})});