define(["require","exports","tslib","../../Validation","./tools","./ArcGisApiVersion"],function(e,t,y,m,F,a){"use strict";function h(e,t){for(var i=e.attributes,r=0,s=t;r<s.length;r++)delete i[s[r]];a.isArcGisApiVersion3x?e.setAttributes(i):e.attributes=i}Object.defineProperty(t,"__esModule",{value:!0});var i=(r.prototype.execute=function(e,t){for(var i=F.featuresToArray(m.validation.exists("features",e.features)),r=m.validation.array("fields",e.fields,[]),s=m.validation.boolean("removeEmptyFields",e.removeEmptyFields,!1),a={},l=0,f=i;l<f.length;l++){var n,u=(c=f[l]).attributes;if(null!=u&&(h(c,r),s))for(var o in u)o in a||(a[o]=!1),a[o]||null!=(n=u[o])&&""!==n&&(a[o]=!0)}var d=[];if(s&&0<(d=Object.keys(a).filter(function(e){return!a[e]&&-1===r.indexOf(e)})).length)for(var c,v=0,A=i;v<A.length;v++)null!=(u=(c=A[v]).attributes)&&h(c,d);if(F.isFeatureSet(e.features)){var b=e.features,p=y.__spreadArrays(r,d);if(b.fields&&(b.fields=b.fields.filter(function(e){return-1===p.indexOf(e.name)})),b.fieldAliases){for(var e=b.fieldAliases,g=0,x=p;g<x.length;g++){o=x[g];delete b.fieldAliases[o]}b.fieldAliases=e}}i=i.slice(0);return{feature:i[0],features:i}},r.action="gcx:wf:arcgis::RemoveFeatureSetFields",r.suite="gcx:wf:builtin",r);function r(){}t.RemoveFeatureSetFields=i});