import{validation}from"../../Validation.js";import{featuresToArray}from"./tools.js";class SortFeatureSet{execute(t,e){const r=featuresToArray(validation.exists("features",t.features)),i=validation.string("sortAttribute",t.sortAttribute);t=validation.boolean("ascending",t.ascending,!0);const o=r.sort(function(t,e){let r=t.attributes?t.attributes[i]:void 0,o=e.attributes?e.attributes[i]:void 0;return void 0===r||null===r?void 0===o||null===o?0:-1:void 0===o||null===o?1:("string"==typeof r&&"string"==typeof o&&(r=r.toLowerCase(),o=o.toLowerCase()),r<o?-1:r>o?1:0)});return!1===t&&o.reverse(),{features:o}}}SortFeatureSet.action="gcx:wf:arcgis::SortFeatureSet",SortFeatureSet.suite="gcx:wf:builtin";export{SortFeatureSet};