import{__decorate}from"tslib";import{validation}from"../../Validation.js";import{inline}from"./tools.js";import{MapProvider}from"./MapProvider.js";import{activate}from"../../Hooks.js";import{isArcGisApiVersion3x}from"./ArcGisApiVersion.js";let GetGraphics=class{execute(i,r,e){const t=validation.id("layerId",i.layerId,void 0),o=validation.string("geometryType",i.geometryType,void 0),a=e.create();return inline(a.load(),function(){if(t){const r=a.findLayer(t);if(void 0!==r&&null!==r)return inline(r.load(),function(){let i=r.getFeatures();return void 0!==o&&(i=i.filter(i=>i.geometry.type===o)),void 0!==i&&null!==i?{features:i}:{}})}if(isArcGisApiVersion3x)return{features:a.map.graphics.graphics};{const e=[];return a.view.graphics.forEach(i=>{e.push(i)}),{features:e}}})}};GetGraphics.action="gcx:wf:arcgis::GetGraphicsLayerFeatures",GetGraphics.suite="gcx:wf:builtin",GetGraphics=__decorate([activate(MapProvider)],GetGraphics);export{GetGraphics};