!function(i){"object"==typeof module&&"object"==typeof module.exports?i(require,exports):"function"==typeof define&&define.amd&&define(["require","exports","tslib","./esriDelegate!esri/tasks/support/ClosestFacilityParameters","../../Validation","./tools","./MapProvider","../../Hooks","esri/tasks/ClosestFacilityTask"],i)}(function(i,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var e=i("tslib"),a=i("./esriDelegate!esri/tasks/support/ClosestFacilityParameters"),n=i("../../Validation"),s=i("./tools"),r=i("./MapProvider"),o=i("../../Hooks"),l=e.__importDefault(i("esri/tasks/ClosestFacilityTask")),r=(u.prototype.execute=function(i,t,e){var r=n.validation.string("url",i.url,n.validation.never),o=new a.ClosestFacilityParameters;o.facilities=n.validation.exists("facilities",i.facilities),o.incidents=n.validation.exists("incidents",i.incidents),o.accumulateAttributes=n.validation.array("accumulateAttributes",i.accumulateAttributes,void 0),o.attributeParameterValues=n.validation.exists("attributeParameterValues",i.attributeParameterValues,void 0),o.defaultCutoff=n.validation.number("defaultCutoff",i.defaultCutoff,void 0),o.defaultTargetFacilityCount=n.validation.number("defaultTargetFacilityCount",i.defaultTargetFacilityCount,void 0),o.directionsLanguage=n.validation.string("directionsLanguage",i.directionsLanguage,void 0),o.directionsLengthUnits=n.validation.string("directionsLengthUnits",i.directionsLengthUnits,void 0),o.directionsOutputType=n.validation.string("directionsOutputType",i.directionsOutputType,void 0),o.directionsStyleName=n.validation.string("directionsStyleName",i.directionsStyleName,void 0),o.directionsTimeAttribute=n.validation.string("directionsTimeAttribute",i.directionsTimeAttribute,void 0),o.doNotLocateOnRestrictedElements=n.validation.boolean("doNotLocateOnRestrictedElements",i.doNotLocateOnRestrictedElements,void 0),o.impedanceAttribute=n.validation.string("impedanceAttribute",i.impedanceAttribute,void 0),o.impedanceAttribute||(o.impedanceAttribute=n.validation.string("impedenceAttribute",i.impedenceAttribute,void 0)),o.outputGeometryPrecision=n.validation.number("outputGeometryPrecision",i.outputGeometryPrecision,void 0),o.outputGeometryPrecisionUnits=n.validation.string("outputGeometryPrecisionUnits",i.outputGeometryPrecisionUnits,void 0),o.outputLines=n.validation.string("outputLines",i.outputLines,void 0),o.pointBarriers=n.validation.exists("pointBarriers",i.pointBarriers,void 0),o.polygonBarriers=n.validation.exists("polygonBarriers",i.polygonBarriers,void 0),o.polylineBarriers=n.validation.exists("polylineBarriers",i.polylineBarriers,void 0),o.restrictionAttributes=n.validation.exists("restrictionAttributes",i.restrictionAttributes,void 0),o.restrictUTurns=n.validation.string("restrictUTurns",i.restrictUTurns,void 0),o.returnDirections=n.validation.boolean("returnDirections",i.returnDirections,void 0),o.returnFacilities=n.validation.boolean("returnFacilities",i.returnFacilities,void 0),o.returnIncidents=n.validation.boolean("returnIncidents",i.returnIncidents,void 0),o.returnPointBarriers=n.validation.boolean("returnPointBarriers",i.returnPointBarriers,void 0),o.returnPolygonBarriers=n.validation.boolean("returnPolygonBarriers",i.returnPolygonBarriers,void 0),o.returnPolylineBarriers=n.validation.boolean("returnPolylineBarriers",i.returnPolylineBarriers,void 0),o.returnRoutes=n.validation.boolean("returnRoutes",i.returnRoutes,!0),o.timeOfDay=n.validation.exists("timeOfDay",i.timeOfDay,void 0),o.timeOfDayUsage=n.validation.string("timeOfDayUsage",i.timeOfDayUsage,void 0),o.travelDirection=n.validation.string("travelDirection",i.travelDirection,void 0),o.useHierarchy=n.validation.boolean("useHierarchy",i.useHierarchy,void 0);i=n.validation.exists("outSpatialReference",i.outSpatialReference,void 0);o.outSpatialReference=e.getOutSR(i);i=new l.default(r),r=s.isAbortable(t.cancellationToken)?{signal:t.cancellationToken.signal}:void 0,r=i.solve(o,r);return s.schedulePromiseCancellation(t,r),s.inline(r,function(i){return{directions:i.directions,facilities:i.facilities,incidents:i.incidents,messages:i.messages,pointBarriers:i.pointBarriers,polygonBarriers:i.polygonBarriers,polylineBarriers:i.polylineBarriers,routes:i.routes}})},u.action="gcx:wf:arcgis::ClosestFacilityTask",u.suite="gcx:wf:builtin",e.__decorate([o.activate(r.MapProvider)],u));function u(){}t.ClosestFacilityTask=r});