!function(e){"object"==typeof module&&"object"==typeof module.exports?e(require,exports):"function"==typeof define&&define.amd&&define(["require","exports","tslib","./esriDelegate!esri/tasks/support/RouteParameters","./ArcGisApiVersion","../../Validation","./tools","./MapProvider","../../Hooks","esri/tasks/RouteTask"],e)}(function(e,i){"use strict";Object.defineProperty(i,"__esModule",{value:!0});var t=e("tslib"),n=e("./esriDelegate!esri/tasks/support/RouteParameters"),s=e("./ArcGisApiVersion"),u=e("../../Validation"),d=e("./tools"),r=e("./MapProvider"),o=e("../../Hooks"),l=t.__importDefault(e("esri/tasks/RouteTask")),r=(a.prototype.execute=function(e,i,t){var r=u.validation.string("url",e.url,u.validation.never),o=new n.RouteParameters;o.stops=u.validation.exists("stops",e.stops),o.accumulateAttributes=u.validation.array("accumulateAttributes",e.accumulateAttributes),o.attributeParameterValues=u.validation.exists("attributeParameterValues",e.attributeParameterValues,void 0);var a=(a=u.validation.exists("pointBarriers",e.pointBarriers,void 0))||u.validation.exists("barriers",e.barriers,void 0);s.isArcGisApiVersionAtLeast("4.11")?o.pointBarriers=a:o.barriers=a,o.directionsLanguage=u.validation.string("directionsLanguage",e.directionsLanguage,void 0),o.directionsLengthUnits=u.validation.string("directionsLengthUnits",e.directionsLengthUnits,void 0),o.directionsOutputType=u.validation.string("directionsOutputType",e.directionsOutputType,void 0),o.directionsStyleName=u.validation.string("directionsStyleName",e.directionsStyleName,void 0),o.directionsTimeAttribute=u.validation.string("directionsTimeAttribute",e.directionsTimeAttribute,void 0),o.doNotLocateOnRestrictedElements=u.validation.boolean("doNotLocateOnRestrictedElements",e.doNotLocateOnRestrictedElements,void 0),o.findBestSequence=u.validation.boolean("findBestSequence",e.findBestSequence,void 0),o.ignoreInvalidLocations=u.validation.boolean("ignoreInvalidLocations",e.ignoreInvalidLocations,void 0),o.impedanceAttribute=u.validation.string("impedanceAttribute",e.impedanceAttribute,void 0),o.impedanceAttribute||(o.impedanceAttribute=u.validation.string("impedenceAttribute",e.impedenceAttribute,void 0)),o.outputGeometryPrecision=u.validation.number("outputGeometryPrecision",e.outputGeometryPrecision,void 0),o.outputGeometryPrecisionUnits=u.validation.string("outputGeometryPrecisionUnits",e.outputGeometryPrecisionUnits,void 0),o.outputLines=u.validation.string("outputLines",e.outputLines,void 0),o.polygonBarriers=u.validation.exists("polygonBarriers",e.polygonBarriers,void 0),o.polylineBarriers=u.validation.exists("polylineBarriers",e.polylineBarriers,void 0),o.preserveFirstStop=u.validation.boolean("preserveFirstStop",e.preserveFirstStop,void 0),o.preserveLastStop=u.validation.boolean("preserveLastStop",e.preserveLastStop,void 0),o.restrictionAttributes=u.validation.exists("restrictionAttributes",e.restrictionAttributes,void 0),o.restrictUTurns=u.validation.string("restrictUTurns",e.restrictUTurns,void 0),o.returnBarriers=u.validation.boolean("returnBarriers",e.returnBarriers,void 0),o.returnDirections=u.validation.boolean("returnDirections",e.returnDirections,void 0),o.returnPolygonBarriers=u.validation.boolean("returnPolygonBarriers",e.returnPolygonBarriers,void 0),o.returnPolylineBarriers=u.validation.boolean("returnPolylineBarriers",e.returnPolylineBarriers,void 0),o.returnRoutes=u.validation.boolean("returnRoutes",e.returnRoutes,void 0),o.returnStops=u.validation.boolean("returnStops",e.returnStops,void 0),o.returnZ=u.validation.boolean("returnZ",e.returnZ,void 0),o.startTime=u.validation.exists("startTime",e.startTime,void 0),o.startTimeIsUTC=u.validation.boolean("startTimeIsUTC",e.startTimeIsUTC,void 0),o.useHierarchy=u.validation.boolean("useHierarchy",e.useHierarchy,void 0),o.useTimeWindows=u.validation.boolean("useTimeWindows",e.useTimeWindows,void 0);e=u.validation.exists("outSpatialReference",e.outSpatialReference,void 0);o.outSpatialReference=t.getOutSR(e);e=new l.default(r),r=d.isAbortable(i.cancellationToken)?{signal:i.cancellationToken.signal}:void 0,r=e.solve(o,r);return d.schedulePromiseCancellation(i,r),d.inline(r,function(e){return{barriers:e.barriers,messages:e.messages,polygonBarriers:e.polygonBarriers,polylineBarriers:e.polylineBarriers,routeResults:e.routeResults}})},a.action="gcx:wf:arcgis::RouteTask",a.suite="gcx:wf:builtin",t.__decorate([o.activate(r.MapProvider)],a));function a(){}i.RouteTask=r});