import{__decorate}from"tslib";import{validation}from"../../Validation.js";import{inline,schedulePromiseCancellation,addToPath,fetch}from"./tools.js";import{MapProvider}from"./MapProvider.js";import{activate}from"../../Hooks.js";let ReverseGeocode=class{execute(e,o,t){var i=validation.string("url",e.url,validation.never),i=addToPath(i,"reverseGeocode");const n=validation.exists("location",e.location);var a=validation.number("distance",e.distance,void 0),r=validation.string("languageCode",e.languageCode,void 0),c=validation.boolean("returnIntersection",e.returnIntersection,!1),l=validation.number("timeout",e.timeout,void 0),c={location:n instanceof Array?n.toString():n,distance:a,outSR:t.getOutSR(e.outSpatialReference),langCode:r,returnIntersection:c},l=fetch(i,c,l,o.cancellationToken.signal);return schedulePromiseCancellation(o,l),inline(l,function(e){return{address:e.address,location:e.location}},e.continueOnError?function(){return{address:null,location:null}}:null)}};ReverseGeocode.action="gcx:wf:arcgis::ReverseGeocode",ReverseGeocode.suite="gcx:wf:builtin",ReverseGeocode=__decorate([activate(MapProvider)],ReverseGeocode);export{ReverseGeocode};