UNPKG

@graphhopper/directions-api-js-client

Version:
109 lines (80 loc) 140 kB
/* * ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development"). * This devtool is neither made for production nor for readable output files. * It uses "eval()" calls to create a separate source file in the browser devtools. * If you are trying to read the output file, select a different devtool (https://webpack.js.org/configuration/devtool/) * or disable the default devtool with "devtool: false". * If you are looking for production-ready output files, see mode: "production" (https://webpack.js.org/configuration/mode/). */ /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./src/GHInput.js": /*!************************!*\ !*** ./src/GHInput.js ***! \************************/ /***/ ((module) => { eval("GHInput = function GHInput(input, input2) {\n this.set(input, input2);\n};\nGHInput.prototype.round = function (val, precision) {\n if (precision === undefined) precision = 1e6;\n return Math.round(val * precision) / precision;\n};\nGHInput.prototype.setCoord = function (lat, lng) {\n this.lat = this.round(lat);\n this.lng = this.round(lng);\n this.input = this.toString();\n};\nGHInput.isObject = function (value) {\n var stringValue = Object.prototype.toString.call(value);\n return stringValue.toLowerCase() === \"[object object]\";\n};\nGHInput.isString = function (value) {\n var stringValue = Object.prototype.toString.call(value);\n return stringValue.toLowerCase() === \"[object string]\";\n};\nGHInput.prototype.set = function (strOrObject, input2) {\n if (input2) {\n this.setCoord(strOrObject, input2);\n return;\n }\n\n // either text or coordinates or object\n this.input = strOrObject;\n if (GHInput.isObject(strOrObject)) {\n this.setCoord(strOrObject.lat, strOrObject.lng);\n } else if (GHInput.isString(strOrObject)) {\n var index = strOrObject.indexOf(\",\");\n if (index >= 0) {\n this.lat = this.round(parseFloat(strOrObject.substr(0, index)));\n this.lng = this.round(parseFloat(strOrObject.substr(index + 1)));\n }\n }\n};\nGHInput.prototype.toString = function () {\n if (this.lat !== undefined && this.lng !== undefined) return this.lat + \",\" + this.lng;\n return undefined;\n};\nmodule.exports = GHInput;\n\n//# sourceURL=webpack://@graphhopper/directions-api-js-client/./src/GHInput.js?"); /***/ }), /***/ "./src/GHUtil.js": /*!***********************!*\ !*** ./src/GHUtil.js ***! \***********************/ /***/ ((module) => { eval("var GHUtil = function GHUtil() {};\nGHUtil.prototype.clone = function (obj) {\n var newObj = {};\n for (var prop in obj) {\n if (obj.hasOwnProperty(prop)) {\n newObj[prop] = obj[prop];\n }\n }\n return newObj;\n};\nGHUtil.prototype.decodePath = function (encoded, is3D) {\n var len = encoded.length;\n var index = 0;\n var array = [];\n var lat = 0;\n var lng = 0;\n var ele = 0;\n while (index < len) {\n var b = void 0;\n var shift = 0;\n var result = 0;\n do {\n b = encoded.charCodeAt(index++) - 63;\n result |= (b & 0x1f) << shift;\n shift += 5;\n } while (b >= 0x20);\n var deltaLat = result & 1 ? ~(result >> 1) : result >> 1;\n lat += deltaLat;\n shift = 0;\n result = 0;\n do {\n b = encoded.charCodeAt(index++) - 63;\n result |= (b & 0x1f) << shift;\n shift += 5;\n } while (b >= 0x20);\n var deltaLon = result & 1 ? ~(result >> 1) : result >> 1;\n lng += deltaLon;\n if (is3D) {\n // elevation\n shift = 0;\n result = 0;\n do {\n b = encoded.charCodeAt(index++) - 63;\n result |= (b & 0x1f) << shift;\n shift += 5;\n } while (b >= 0x20);\n var deltaEle = result & 1 ? ~(result >> 1) : result >> 1;\n ele += deltaEle;\n array.push([lng * 1e-5, lat * 1e-5, ele / 100]);\n } else array.push([lng * 1e-5, lat * 1e-5]);\n }\n // let end = new Date().getTime();\n // console.log(\"decoded \" + len + \" coordinates in \" + ((end - start) / 1000) + \"s\");\n return array;\n};\nGHUtil.prototype.extractError = function (res, url) {\n var msg;\n if (res && res.data) {\n msg = res.data;\n if (msg.hints && msg.hints[0] && msg.hints[0].message) msg = msg.hints[0].message;else if (msg.message) msg = msg.message;\n } else {\n msg = res;\n }\n return new Error(msg + \" - for url \" + url);\n};\nGHUtil.prototype.isArray = function (value) {\n var stringValue = Object.prototype.toString.call(value);\n return stringValue.toLowerCase() === \"[object array]\";\n};\nGHUtil.prototype.isObject = function (value) {\n var stringValue = Object.prototype.toString.call(value);\n return stringValue.toLowerCase() === \"[object object]\";\n};\nGHUtil.prototype.isString = function (value) {\n return typeof value === 'string';\n};\nmodule.exports = GHUtil;\n\n//# sourceURL=webpack://@graphhopper/directions-api-js-client/./src/GHUtil.js?"); /***/ }), /***/ "./src/GraphHopperGeocoding.js": /*!*************************************!*\ !*** ./src/GraphHopperGeocoding.js ***! \*************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { eval("var request = __webpack_require__(/*! axios */ \"./node_modules/axios/dist/browser/axios.cjs\");\nvar GHUtil = __webpack_require__(/*! ./GHUtil */ \"./src/GHUtil.js\");\nvar ghUtil = new GHUtil();\nGraphHopperGeocoding = function GraphHopperGeocoding(args, requestDefaults) {\n var _this = this;\n this.defaults = {\n debug: false,\n locale: \"en\"\n };\n if (requestDefaults) Object.keys(requestDefaults).forEach(function (key) {\n _this.defaults[key] = requestDefaults[key];\n });\n this.key = args.key;\n this.host = args.host ? args.host : \"https://graphhopper.com/api/1\";\n this.endpoint = args.endpoint ? args.endpoint : '/geocode';\n this.timeout = args.timeout ? args.timeout : 10000;\n};\nGraphHopperGeocoding.prototype.getParametersAsQueryString = function (args) {\n var qString = \"locale=\" + args.locale;\n if (args.query) {\n qString += \"&q=\" + encodeURIComponent(args.query);\n if (args.location_bias) qString += \"&point=\" + encodeURIComponent(args.location_bias.toString());else if (args.point) qString += \"&point=\" + encodeURIComponent(args.point.toString());\n } else {\n qString += \"&reverse=true\";\n if (args.point) qString += \"&point=\" + encodeURIComponent(args.point.toString());\n }\n if (args.debug) qString += \"&debug=true\";\n if (args.limit) qString += \"&limit=\" + args.limit;\n return qString;\n};\nGraphHopperGeocoding.prototype.doRequest = function (reqArgs) {\n var _this2 = this;\n if (!reqArgs) reqArgs = {};\n Object.keys(this.defaults).forEach(function (key) {\n if (!reqArgs[key]) reqArgs[key] = _this2.defaults[key];\n });\n var url = this.host + this.endpoint + \"?\" + this.getParametersAsQueryString(reqArgs) + \"&key=\" + this.key;\n var that = this;\n return new Promise(function (resolve, reject) {\n request.get(url, {\n timeout: that.timeout\n }).then(function (res) {\n if (res.status !== 200) {\n reject(ghUtil.extractError(res, url));\n } else if (res) {\n resolve(res.data);\n }\n })[\"catch\"](function (err) {\n reject(ghUtil.extractError(err.response, url));\n });\n });\n};\nmodule.exports = GraphHopperGeocoding;\n\n//# sourceURL=webpack://@graphhopper/directions-api-js-client/./src/GraphHopperGeocoding.js?"); /***/ }), /***/ "./src/GraphHopperIsochrone.js": /*!*************************************!*\ !*** ./src/GraphHopperIsochrone.js ***! \*************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { eval("var request = __webpack_require__(/*! axios */ \"./node_modules/axios/dist/browser/axios.cjs\");\nvar GHUtil = __webpack_require__(/*! ./GHUtil */ \"./src/GHUtil.js\");\nvar ghUtil = new GHUtil();\nGraphHopperIsochrone = function GraphHopperIsochrone(args, requestDefaults) {\n var _this = this;\n this.defaults = {\n time_limit: 600,\n distance_limit: 0,\n buckets: 3,\n profile: \"car\",\n debug: false,\n reverse_flow: false\n };\n if (requestDefaults) Object.keys(requestDefaults).forEach(function (key) {\n _this.defaults[key] = requestDefaults[key];\n });\n this.key = args.key;\n this.host = args.host ? args.host : \"https://graphhopper.com/api/1\";\n this.endpoint = args.endpoint ? args.endpoint : '/isochrone';\n this.timeout = args.timeout ? args.timeout : 30000;\n};\nGraphHopperIsochrone.prototype.getParametersAsQueryString = function (args) {\n var qString = \"point=\" + args.point;\n qString += \"&time_limit=\" + args.time_limit;\n qString += \"&distance_limit=\" + args.distance_limit;\n qString += \"&buckets=\" + args.buckets;\n qString += \"&profile=\" + args.profile;\n qString += \"&reverse_flow=\" + args.reverse_flow;\n if (args.debug) qString += \"&debug=true\";\n return qString;\n};\nGraphHopperIsochrone.prototype.doRequest = function (reqArgs) {\n var _this2 = this;\n Object.keys(this.defaults).forEach(function (key) {\n if (!reqArgs[key]) reqArgs[key] = _this2.defaults[key];\n });\n var url = this.host + this.endpoint + \"?\" + this.getParametersAsQueryString(reqArgs) + \"&key=\" + this.key;\n var that = this;\n return new Promise(function (resolve, reject) {\n request.get(url, {\n timeout: that.timeout\n }).then(function (res) {\n if (res.status !== 200) {\n reject(ghUtil.extractError(res, url));\n } else if (res) {\n resolve(res.data);\n }\n })[\"catch\"](function (err) {\n reject(ghUtil.extractError(err.response, url));\n });\n });\n};\nmodule.exports = GraphHopperIsochrone;\n\n//# sourceURL=webpack://@graphhopper/directions-api-js-client/./src/GraphHopperIsochrone.js?"); /***/ }), /***/ "./src/GraphHopperMapMatching.js": /*!***************************************!*\ !*** ./src/GraphHopperMapMatching.js ***! \***************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { eval("var request = __webpack_require__(/*! axios */ \"./node_modules/axios/dist/browser/axios.cjs\");\nvar GHUtil = __webpack_require__(/*! ./GHUtil */ \"./src/GHUtil.js\");\nvar ghUtil = new GHUtil();\nGraphHopperMapMatching = function GraphHopperMapMatching(args, requestDefaults) {\n var _this = this;\n this.defaults = {\n profile: \"car\",\n gps_accuracy: 20,\n debug: false,\n max_visited_nodes: 3000,\n locale: \"en\",\n points_encoded: true,\n instructions: true,\n elevation: true,\n data_type: \"json\"\n };\n if (requestDefaults) Object.keys(requestDefaults).forEach(function (key) {\n _this.defaults[key] = requestDefaults[key];\n });\n this.key = args.key;\n this.host = args.host ? args.host : \"https://graphhopper.com/api/1\";\n this.endpoint = args.endpoint ? args.endpoint : '/match';\n this.timeout = args.timeout ? args.timeout : 100000;\n};\nGraphHopperMapMatching.prototype.getParametersAsQueryString = function (args) {\n var qString = \"locale=\" + args.locale;\n // TODO NOW: profile not yet supported in API\n qString += \"&vehicle=\" + args.profile;\n qString += \"&gps_accuracy=\" + args.gps_accuracy;\n qString += \"&max_visited_nodes=\" + args.max_visited_nodes;\n qString += \"&type=\" + args.data_type;\n qString += \"&instructions=\" + args.instructions;\n qString += \"&points_encoded=\" + args.points_encoded;\n qString += \"&elevation=\" + args.elevation;\n if (args.debug) qString += \"&debug=true\";\n return qString;\n};\nGraphHopperMapMatching.prototype.doRequest = function (content, reqArgs) {\n var _this2 = this;\n if (!reqArgs) reqArgs = {};\n Object.keys(this.defaults).forEach(function (key) {\n if (!reqArgs[key]) reqArgs[key] = _this2.defaults[key];\n });\n var url = this.host + this.endpoint + \"?\" + this.getParametersAsQueryString(reqArgs) + \"&key=\" + this.key;\n var timeout = this.timeout;\n return new Promise(function (resolve, reject) {\n request.post(url, content, {\n timeout: timeout,\n headers: {\n 'Content-Type': 'application/xml'\n }\n }).then(function (res) {\n if (res.status !== 200) {\n reject(ghUtil.extractError(res, url));\n } else if (res) {\n if (res.data.paths) {\n for (var i = 0; i < res.data.paths.length; i++) {\n var path = res.data.paths[i];\n // convert encoded polyline to geo json\n if (path.points_encoded) {\n var tmpArray = ghUtil.decodePath(path.points, reqArgs.elevation);\n path.points = {\n \"type\": \"LineString\",\n \"coordinates\": tmpArray\n };\n\n // for now delete this\n delete path.snapped_waypoints;\n }\n }\n }\n resolve(res.data);\n }\n })[\"catch\"](function (err) {\n reject(ghUtil.extractError(err.response, url));\n });\n });\n};\nmodule.exports = GraphHopperMapMatching;\n\n//# sourceURL=webpack://@graphhopper/directions-api-js-client/./src/GraphHopperMapMatching.js?"); /***/ }), /***/ "./src/GraphHopperMatrix.js": /*!**********************************!*\ !*** ./src/GraphHopperMatrix.js ***! \**********************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { eval("var request = __webpack_require__(/*! axios */ \"./node_modules/axios/dist/browser/axios.cjs\");\nvar GHUtil = __webpack_require__(/*! ./GHUtil */ \"./src/GHUtil.js\");\nvar ghUtil = new GHUtil();\nGraphHopperMatrix = function GraphHopperMatrix(args, requestDefaults) {\n var _this = this;\n this.defaults = {\n profile: \"car\",\n debug: false,\n out_arrays: [\"times\"]\n };\n if (requestDefaults) Object.keys(requestDefaults).forEach(function (key) {\n _this.defaults[key] = requestDefaults[key];\n });\n this.key = args.key;\n this.host = args.host ? args.host : \"https://graphhopper.com/api/1\";\n this.endpoint = args.endpoint ? args.endpoint : '/matrix';\n this.timeout = args.timeout ? args.timeout : 30000;\n};\nGraphHopperMatrix.prototype.doRequest = function (reqArgs) {\n var _this2 = this;\n Object.keys(this.defaults).forEach(function (key) {\n if (!reqArgs[key]) reqArgs[key] = _this2.defaults[key];\n });\n if (!reqArgs.from_points && !reqArgs.to_points) {\n reqArgs.from_points = reqArgs.points;\n reqArgs.to_points = reqArgs.points;\n delete reqArgs[\"points\"];\n }\n var url = this.host + this.endpoint + \"?key=\" + this.key;\n var that = this;\n return new Promise(function (resolve, reject) {\n request.post(url, reqArgs, {\n timeout: that.timeout,\n headers: {\n 'Content-Type': 'application/json'\n }\n }).then(function (res) {\n if (res.status !== 200) {\n reject(ghUtil.extractError(res, url));\n } else if (res) {\n resolve(res.data);\n }\n })[\"catch\"](function (err) {\n reject(ghUtil.extractError(err.response, url));\n });\n });\n};\nGraphHopperMatrix.prototype.toHtmlTable = function (request, doubleArray) {\n var to_points = request.to_points,\n from_points = request.from_points;\n var htmlOut = \"<table border='1' cellpadding='10'>\";\n\n // header => to points\n htmlOut += \"<tr>\";\n\n // upper left corner:\n htmlOut += \"<td>&#8595; from &#92; to &#8594;</td>\";\n\n // header with to points\n for (var idxTo in to_points) {\n htmlOut += \"<td><b>\" + to_points[idxTo][1] + \",\" + to_points[idxTo][0] + \"</b></td>\";\n }\n htmlOut += \"</tr>\";\n for (var idxFrom in doubleArray) {\n htmlOut += \"<tr>\";\n htmlOut += \"<td><b>\" + from_points[idxFrom][1] + \",\" + from_points[idxFrom][0] + \"</b></td>\";\n var res = doubleArray[idxFrom];\n for (var _idxTo in res) {\n var mapsURL = \"https://graphhopper.com/maps?\" + \"point=\" + encodeURIComponent(from_points[idxFrom][1] + \",\" + from_points[idxFrom][0]) + \"&point=\" + encodeURIComponent(to_points[_idxTo][1] + \",\" + to_points[_idxTo][0]) + \"&profile=\" + request.profile;\n htmlOut += \"<td> <a href='\" + mapsURL + \"'>\" + res[_idxTo] + \"</a> </td>\";\n }\n htmlOut += \"</tr>\\n\";\n }\n htmlOut += \"</table>\";\n return htmlOut;\n};\nmodule.exports = GraphHopperMatrix;\n\n//# sourceURL=webpack://@graphhopper/directions-api-js-client/./src/GraphHopperMatrix.js?"); /***/ }), /***/ "./src/GraphHopperOptimization.js": /*!****************************************!*\ !*** ./src/GraphHopperOptimization.js ***! \****************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { eval("var request = __webpack_require__(/*! axios */ \"./node_modules/axios/dist/browser/axios.cjs\");\nvar GHUtil = __webpack_require__(/*! ./GHUtil */ \"./src/GHUtil.js\");\nvar ghUtil = new GHUtil();\nGraphHopperOptimization = function GraphHopperOptimization(args) {\n this.key = args.key;\n this.host = args.host ? args.host : \"https://graphhopper.com/api/1\";\n this.endpoint = args.endpoint ? args.endpoint : '/vrp';\n this.timeout = args.timeout ? args.timeout : 10000;\n this.waitInMillis = args.waitInMillis ? args.waitInMillis : 1000;\n this.postTimeout = args.postTimeout ? args.postTimeout : 10000;\n};\nGraphHopperOptimization.prototype.doVRPRequest = function (points, vehicles) {\n var that = this;\n var firstPoint = points[0];\n var servicesArray = [];\n for (var pointIndex in points) {\n if (pointIndex < 1) continue;\n var point = points[pointIndex];\n var obj = {\n \"id\": \"_\" + pointIndex,\n \"type\": \"pickup\",\n \"name\": \"maintenance \" + pointIndex,\n \"address\": {\n \"location_id\": \"_location_\" + pointIndex,\n \"lon\": point[0],\n \"lat\": point[1]\n }\n };\n servicesArray.push(obj);\n }\n var list = [];\n for (var i = 0; i < vehicles; i++) {\n list.push({\n \"vehicle_id\": \"_vehicle_\" + i,\n \"start_address\": {\n \"location_id\": \"_start_location\",\n \"lon\": firstPoint[0],\n \"lat\": firstPoint[1]\n },\n \"type_id\": \"_vtype_1\"\n });\n }\n var jsonInput = {\n \"algorithm\": {\n \"problem_type\": \"min-max\"\n },\n \"vehicles\": list,\n \"vehicle_types\": [{\n \"type_id\": \"_vtype_1\",\n \"profile\": \"car\"\n }],\n \"services\": servicesArray\n };\n //console.log(jsonInput);\n\n return that.doRequest(jsonInput);\n};\nGraphHopperOptimization.prototype.doRawRequest = function (jsonInput) {\n var that = this;\n return new Promise(function (resolve, reject) {\n var postURL = that.host + that.endpoint + \"/optimize?key=\" + that.key;\n request.post(postURL, jsonInput, {\n timeout: that.postTimeout,\n headers: {\n 'Content-Type': 'application/json'\n }\n }).then(function (res) {\n if (res.status !== 200) {\n reject(ghUtil.extractError(res, postURL));\n } else if (res) {\n var solutionUrl = that.host + that.endpoint + \"/solution/\" + res.data.job_id + \"?key=\" + that.key;\n var timerRet;\n var pollTrigger = function pollTrigger() {\n // console.log(\"poll solution \" + solutionUrl);\n request.get(solutionUrl, {\n timeout: that.timeout\n }).then(function (res) {\n if (res.status !== 200 || res.data === undefined) {\n clearInterval(timerRet);\n reject(ghUtil.extractError(res, solutionUrl));\n } else if (res) {\n //console.log(res.body);\n if (res.data.status === \"finished\") {\n //console.log(\"finished\");\n clearInterval(timerRet);\n resolve(res.data);\n } else if (res.data.message) {\n clearInterval(timerRet);\n resolve(res.data);\n }\n }\n });\n };\n if (that.waitInMillis > 0) timerRet = setInterval(pollTrigger, that.waitInMillis);else pollTrigger();\n }\n })[\"catch\"](function (err) {\n reject(ghUtil.extractError(err.response, postURL));\n });\n });\n};\nGraphHopperOptimization.prototype.doRequest = function (jsonInput) {\n var vehicleTypeProfileMap = {};\n var vehicleTypeMap = {};\n var vehicleProfileMap = {};\n var serviceMap = {};\n var shipmentMap = {};\n var locationMap = {};\n var hasGeometries = false;\n var hasCustomCostMatrix = false;\n if (jsonInput.cost_matrices && jsonInput.cost_matrices.length > 0) hasCustomCostMatrix = true;\n if (jsonInput.configuration && !hasCustomCostMatrix) if (jsonInput.configuration.routing.calc_points === true) hasGeometries = true;\n if (!hasGeometries) {\n if (!jsonInput.configuration && !hasCustomCostMatrix) {\n jsonInput.configuration = {\n \"routing\": {\n \"calc_points\": true\n }\n };\n }\n }\n if (jsonInput.vehicle_types) {\n for (var typeIndex = 0; typeIndex < jsonInput.vehicle_types.length; typeIndex++) {\n var type = jsonInput.vehicle_types[typeIndex];\n vehicleTypeProfileMap[type.type_id] = type.profile;\n vehicleTypeMap[type.type_id] = type;\n }\n }\n if (jsonInput.services) {\n for (var serviceIndex = 0; serviceIndex < jsonInput.services.length; serviceIndex++) {\n var service = jsonInput.services[serviceIndex];\n locationMap[service.address.location_id] = service.address;\n serviceMap[service.id] = service;\n }\n }\n if (jsonInput.shipments) {\n for (var shipmentIndex = 0; shipmentIndex < jsonInput.shipments.length; shipmentIndex++) {\n var shipment = jsonInput.shipments[shipmentIndex];\n locationMap[shipment.pickup.address.location_id] = shipment.pickup.address;\n locationMap[shipment.delivery.address.location_id] = shipment.delivery.address;\n shipmentMap[shipment.id] = shipment;\n }\n }\n var breakMap = {};\n var vehicleMap = {};\n if (jsonInput.vehicles) {\n for (var vehicleIndex = 0; vehicleIndex < jsonInput.vehicles.length; vehicleIndex++) {\n var vehicle = jsonInput.vehicles[vehicleIndex];\n vehicleMap[vehicle.vehicle_id] = vehicle;\n var profile = null;\n if (vehicle.type_id !== null) {\n profile = vehicleTypeProfileMap[vehicle.type_id];\n if (profile !== null) {\n vehicleProfileMap[vehicle.vehicle_id] = profile;\n } else {\n vehicleProfileMap[vehicle.vehicle_id] = \"car\";\n }\n } else vehicleProfileMap[vehicle.vehicle_id] = \"car\";\n if (vehicle.start_address) {\n locationMap[vehicle.start_address.location_id] = vehicle.start_address;\n }\n if (vehicle.end_address) {\n locationMap[vehicle.end_address.location_id] = vehicle.end_address;\n }\n if (vehicle[\"break\"]) {\n var break_id = vehicle.vehicle_id + \"_break\";\n breakMap[break_id] = vehicle[\"break\"];\n }\n }\n }\n var promise = this.doRawRequest(jsonInput);\n promise.then(function (json) {\n if (json.solution) {\n var sol = json.solution;\n json.raw_solution = JSON.parse(JSON.stringify(sol));\n sol[\"calc_points\"] = hasGeometries;\n for (var routeIndex = 0; routeIndex < sol.routes.length; routeIndex++) {\n var route = sol.routes[routeIndex];\n var vehicleId = route.vehicle_id;\n var _profile = vehicleProfileMap[vehicleId];\n route[\"profile\"] = _profile;\n for (var actIndex = 0; actIndex < route.activities.length; actIndex++) {\n var act = route.activities[actIndex];\n act[\"address\"] = locationMap[act.location_id];\n if (act.id) {\n var driverBreak = breakMap[act.id];\n // console.log(act.id + \" \" + driverBreak);\n if (driverBreak) {\n act[\"break\"] = breakMap[act.id];\n } else if (serviceMap[act.id]) {\n act[\"service\"] = serviceMap[act.id];\n } else if (shipmentMap[act.id]) {\n act[\"shipment\"] = shipmentMap[act.id];\n }\n } else {\n var _vehicle = vehicleMap[vehicleId];\n act[\"vehicle\"] = _vehicle;\n act[\"vehicle_type\"] = vehicleTypeMap[_vehicle.type_id];\n }\n }\n }\n var unassignedServices = new Array();\n for (var i = 0; i < sol.unassigned.services.length; i++) {\n var serviceId = sol.unassigned.services[i];\n unassignedServices.push(serviceMap[serviceId]);\n unassignedServices.push(serviceMap[serviceId]);\n }\n sol[\"unassigned_services\"] = unassignedServices;\n var unassignedShipments = new Array();\n for (var _i = 0; _i < sol.unassigned.shipments.length; _i++) {\n var shipmentId = sol.unassigned.shipments[_i];\n unassignedShipments.push(shipmentMap[shipmentId]);\n }\n sol[\"unassigned_shipments\"] = unassignedShipments;\n }\n return json;\n });\n return promise;\n};\nmodule.exports = GraphHopperOptimization;\n\n//# sourceURL=webpack://@graphhopper/directions-api-js-client/./src/GraphHopperOptimization.js?"); /***/ }), /***/ "./src/GraphHopperRouting.js": /*!***********************************!*\ !*** ./src/GraphHopperRouting.js ***! \***********************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { eval("var request = __webpack_require__(/*! axios */ \"./node_modules/axios/dist/browser/axios.cjs\");\nvar GHUtil = __webpack_require__(/*! ./GHUtil */ \"./src/GHUtil.js\");\nvar ghUtil = new GHUtil();\nGraphHopperRouting = function GraphHopperRouting(args, requestDefaults) {\n var _this = this;\n this.defaults = {\n profile: \"car\",\n debug: false,\n locale: \"en\",\n points_encoded: true,\n instructions: true,\n elevation: true,\n optimize: \"false\"\n };\n if (requestDefaults) Object.keys(requestDefaults).forEach(function (key) {\n _this.defaults[key] = requestDefaults[key];\n });\n\n // required API key\n this.key = args.key;\n this.host = args.host ? args.host : \"https://graphhopper.com/api/1\";\n this.endpoint = args.endpoint ? args.endpoint : '/route';\n this.timeout = args.timeout ? args.timeout : 10000;\n this.turn_sign_map = args.turn_sign_map ? args.turn_sign_map : {\n \"-6\": \"leave roundabout\",\n \"-3\": \"turn sharp left\",\n \"-2\": \"turn left\",\n \"-1\": \"turn slight left\",\n 0: \"continue\",\n 1: \"turn slight right\",\n 2: \"turn right\",\n 3: \"turn sharp right\",\n 4: \"finish\",\n 5: \"reached via point\",\n 6: \"enter roundabout\"\n };\n};\n\n/**\n * Execute the routing request using the provided args.\n */\nGraphHopperRouting.prototype.doRequest = function (reqArgs) {\n var _this2 = this;\n Object.keys(this.defaults).forEach(function (key) {\n if (!reqArgs[key]) reqArgs[key] = _this2.defaults[key];\n });\n var url = this.host + this.endpoint + \"?key=\" + this.key;\n var that = this;\n return new Promise(function (resolve, reject) {\n request.post(url, reqArgs, {\n timeout: that.timeout,\n headers: {\n 'Content-Type': 'application/json'\n }\n }).then(function (res) {\n if (res.status !== 200) {\n reject(ghUtil.extractError(res, url));\n return;\n }\n if (res.data.paths) {\n for (var i = 0; i < res.data.paths.length; i++) {\n var path = res.data.paths[i];\n // convert encoded polyline to geo json\n if (path.points_encoded) {\n var tmpArray = ghUtil.decodePath(path.points, reqArgs.elevation);\n path.points = {\n \"type\": \"LineString\",\n \"coordinates\": tmpArray\n };\n var tmpSnappedArray = ghUtil.decodePath(path.snapped_waypoints, reqArgs.elevation);\n path.snapped_waypoints = {\n \"type\": \"LineString\",\n \"coordinates\": tmpSnappedArray\n };\n }\n if (path.instructions) {\n for (var j = 0; j < path.instructions.length; j++) {\n // Add a LngLat to every instruction\n var interval = path.instructions[j].interval;\n // The second parameter of slice is non inclusive, therefore we have to add +1\n path.instructions[j].points = path.points.coordinates.slice(interval[0], interval[1] + 1);\n }\n }\n }\n }\n resolve(res.data);\n })[\"catch\"](function (err) {\n reject(ghUtil.extractError(err.response, url));\n });\n });\n};\nGraphHopperRouting.prototype.info = function () {\n var that = this;\n return new Promise(function (resolve, reject) {\n var url = that.host + \"/info?key=\" + that.key;\n request.get(url, {\n timeout: that.timeout,\n headers: {\n 'Content-Type': 'application/json'\n }\n }).then(function (res) {\n if (res.status !== 200) {\n reject(ghUtil.extractError(res, url));\n return;\n }\n resolve(res.data);\n })[\"catch\"](function (err) {\n console.log(err);\n reject(ghUtil.extractError(err.response, url));\n });\n });\n};\nGraphHopperRouting.prototype.i18n = function (args) {\n var locale = args && args.locale ? args.locale : this.defaults.locale;\n var that = this;\n return new Promise(function (resolve, reject) {\n var url = that.host + \"/i18n/\" + locale + \"?key=\" + that.key;\n request.get(url, {\n timeout: that.timeout,\n headers: {\n 'Content-Type': 'application/json'\n }\n }).then(function (res) {\n if (res.status !== 200) {\n reject(ghUtil.extractError(res, url));\n return;\n }\n resolve(res.data);\n })[\"catch\"](function (err) {\n reject(ghUtil.extractError(err.response, url));\n });\n });\n};\nGraphHopperRouting.prototype.getTurnText = function (sign) {\n return this.turn_sign_map[sign];\n};\nmodule.exports = GraphHopperRouting;\n\n//# sourceURL=webpack://@graphhopper/directions-api-js-client/./src/GraphHopperRouting.js?"); /***/ }), /***/ "./src/main-template.js": /*!******************************!*\ !*** ./src/main-template.js ***! \******************************/ /***/ ((module, exports, __webpack_require__) => { eval("/* module decorator */ module = __webpack_require__.nmd(module);\nvar __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;function _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nvar GHUtil = __webpack_require__(/*! ./GHUtil.js */ \"./src/GHUtil.js\");\nvar GHInput = __webpack_require__(/*! ./GHInput.js */ \"./src/GHInput.js\");\nvar GraphHopperGeocoding = __webpack_require__(/*! ./GraphHopperGeocoding.js */ \"./src/GraphHopperGeocoding.js\");\nvar GraphHopperIsochrone = __webpack_require__(/*! ./GraphHopperIsochrone.js */ \"./src/GraphHopperIsochrone.js\");\nvar GraphHopperMapMatching = __webpack_require__(/*! ./GraphHopperMapMatching.js */ \"./src/GraphHopperMapMatching.js\");\nvar GraphHopperMatrix = __webpack_require__(/*! ./GraphHopperMatrix.js */ \"./src/GraphHopperMatrix.js\");\nvar GraphHopperOptimization = __webpack_require__(/*! ./GraphHopperOptimization.js */ \"./src/GraphHopperOptimization.js\");\nvar GraphHopperRouting = __webpack_require__(/*! ./GraphHopperRouting.js */ \"./src/GraphHopperRouting.js\");\nvar GraphHopper = {\n \"Util\": GHUtil,\n \"Input\": GHInput,\n \"Geocoding\": GraphHopperGeocoding,\n \"Isochrone\": GraphHopperIsochrone,\n \"MapMatching\": GraphHopperMapMatching,\n \"Optimization\": GraphHopperOptimization,\n \"Routing\": GraphHopperRouting,\n \"Matrix\": GraphHopperMatrix\n};\n\n// define GraphHopper for Node module pattern loaders, including Browserify\nif (( false ? 0 : _typeof(module)) === 'object' && _typeof(module.exports) === 'object') {\n module.exports.GraphHopper = GraphHopper;\n\n // define GraphHopper as an AMD module\n} else if (true) {\n !(__WEBPACK_AMD_DEFINE_FACTORY__ = (GraphHopper),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ?\n\t\t(__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) :\n\t\t__WEBPACK_AMD_DEFINE_FACTORY__),\n\t\t__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));\n}\nif (typeof window !== 'undefined') {\n window.GraphHopper = GraphHopper;\n}\n\n//# sourceURL=webpack://@graphhopper/directions-api-js-client/./src/main-template.js?"); /***/ }), /***/ "./node_modules/axios/dist/browser/axios.cjs": /*!***************************************************!*\ !*** ./node_modules/axios/dist/browser/axios.cjs ***! \***************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { "use strict"; eval("/*! Axios v1.12.2 Copyright (c) 2025 Matt Zabriskie and contributors */\n\n\nfunction bind(fn, thisArg) {\n return function wrap() {\n return fn.apply(thisArg, arguments);\n };\n}\n\n// utils is a library of generic helper functions non-specific to axios\n\nconst {toString} = Object.prototype;\nconst {getPrototypeOf} = Object;\nconst {iterator, toStringTag} = Symbol;\n\nconst kindOf = (cache => thing => {\n const str = toString.call(thing);\n return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());\n})(Object.create(null));\n\nconst kindOfTest = (type) => {\n type = type.toLowerCase();\n return (thing) => kindOf(thing) === type\n};\n\nconst typeOfTest = type => thing => typeof thing === type;\n\n/**\n * Determine if a value is an Array\n *\n * @param {Object} val The value to test\n *\n * @returns {boolean} True if value is an Array, otherwise false\n */\nconst {isArray} = Array;\n\n/**\n * Determine if a value is undefined\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if the value is undefined, otherwise false\n */\nconst isUndefined = typeOfTest('undefined');\n\n/**\n * Determine if a value is a Buffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Buffer, otherwise false\n */\nfunction isBuffer(val) {\n return val !== null && !isUndefined(val) && val.constructor !== null && !isUndefined(val.constructor)\n && isFunction$1(val.constructor.isBuffer) && val.constructor.isBuffer(val);\n}\n\n/**\n * Determine if a value is an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an ArrayBuffer, otherwise false\n */\nconst isArrayBuffer = kindOfTest('ArrayBuffer');\n\n\n/**\n * Determine if a value is a view on an ArrayBuffer\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a view on an ArrayBuffer, otherwise false\n */\nfunction isArrayBufferView(val) {\n let result;\n if ((typeof ArrayBuffer !== 'undefined') && (ArrayBuffer.isView)) {\n result = ArrayBuffer.isView(val);\n } else {\n result = (val) && (val.buffer) && (isArrayBuffer(val.buffer));\n }\n return result;\n}\n\n/**\n * Determine if a value is a String\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a String, otherwise false\n */\nconst isString = typeOfTest('string');\n\n/**\n * Determine if a value is a Function\n *\n * @param {*} val The value to test\n * @returns {boolean} True if value is a Function, otherwise false\n */\nconst isFunction$1 = typeOfTest('function');\n\n/**\n * Determine if a value is a Number\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Number, otherwise false\n */\nconst isNumber = typeOfTest('number');\n\n/**\n * Determine if a value is an Object\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an Object, otherwise false\n */\nconst isObject = (thing) => thing !== null && typeof thing === 'object';\n\n/**\n * Determine if a value is a Boolean\n *\n * @param {*} thing The value to test\n * @returns {boolean} True if value is a Boolean, otherwise false\n */\nconst isBoolean = thing => thing === true || thing === false;\n\n/**\n * Determine if a value is a plain Object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a plain Object, otherwise false\n */\nconst isPlainObject = (val) => {\n if (kindOf(val) !== 'object') {\n return false;\n }\n\n const prototype = getPrototypeOf(val);\n return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(toStringTag in val) && !(iterator in val);\n};\n\n/**\n * Determine if a value is an empty object (safely handles Buffers)\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is an empty object, otherwise false\n */\nconst isEmptyObject = (val) => {\n // Early return for non-objects or Buffers to prevent RangeError\n if (!isObject(val) || isBuffer(val)) {\n return false;\n }\n\n try {\n return Object.keys(val).length === 0 && Object.getPrototypeOf(val) === Object.prototype;\n } catch (e) {\n // Fallback for any other objects that might cause RangeError with Object.keys()\n return false;\n }\n};\n\n/**\n * Determine if a value is a Date\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Date, otherwise false\n */\nconst isDate = kindOfTest('Date');\n\n/**\n * Determine if a value is a File\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFile = kindOfTest('File');\n\n/**\n * Determine if a value is a Blob\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Blob, otherwise false\n */\nconst isBlob = kindOfTest('Blob');\n\n/**\n * Determine if a value is a FileList\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a File, otherwise false\n */\nconst isFileList = kindOfTest('FileList');\n\n/**\n * Determine if a value is a Stream\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a Stream, otherwise false\n */\nconst isStream = (val) => isObject(val) && isFunction$1(val.pipe);\n\n/**\n * Determine if a value is a FormData\n *\n * @param {*} thing The value to test\n *\n * @returns {boolean} True if value is an FormData, otherwise false\n */\nconst isFormData = (thing) => {\n let kind;\n return thing && (\n (typeof FormData === 'function' && thing instanceof FormData) || (\n isFunction$1(thing.append) && (\n (kind = kindOf(thing)) === 'formdata' ||\n // detect form-data instance\n (kind === 'object' && isFunction$1(thing.toString) && thing.toString() === '[object FormData]')\n )\n )\n )\n};\n\n/**\n * Determine if a value is a URLSearchParams object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a URLSearchParams object, otherwise false\n */\nconst isURLSearchParams = kindOfTest('URLSearchParams');\n\nconst [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream', 'Request', 'Response', 'Headers'].map(kindOfTest);\n\n/**\n * Trim excess whitespace off the beginning and end of a string\n *\n * @param {String} str The String to trim\n *\n * @returns {String} The String freed of excess whitespace\n */\nconst trim = (str) => str.trim ?\n str.trim() : str.replace(/^[\\s\\uFEFF\\xA0]+|[\\s\\uFEFF\\xA0]+$/g, '');\n\n/**\n * Iterate over an Array or an Object invoking a function for each item.\n *\n * If `obj` is an Array callback will be called passing\n * the value, index, and complete array for each item.\n *\n * If 'obj' is an Object callback will be called passing\n * the value, key, and complete object for each property.\n *\n * @param {Object|Array} obj The object to iterate\n * @param {Function} fn The callback to invoke for each item\n *\n * @param {Boolean} [allOwnKeys = false]\n * @returns {any}\n */\nfunction forEach(obj, fn, {allOwnKeys = false} = {}) {\n // Don't bother if no value provided\n if (obj === null || typeof obj === 'undefined') {\n return;\n }\n\n let i;\n let l;\n\n // Force an array if not already something iterable\n if (typeof obj !== 'object') {\n /*eslint no-param-reassign:0*/\n obj = [obj];\n }\n\n if (isArray(obj)) {\n // Iterate over array values\n for (i = 0, l = obj.length; i < l; i++) {\n fn.call(null, obj[i], i, obj);\n }\n } else {\n // Buffer check\n if (isBuffer(obj)) {\n return;\n }\n\n // Iterate over object keys\n const keys = allOwnKeys ? Object.getOwnPropertyNames(obj) : Object.keys(obj);\n const len = keys.length;\n let key;\n\n for (i = 0; i < len; i++) {\n key = keys[i];\n fn.call(null, obj[key], key, obj);\n }\n }\n}\n\nfunction findKey(obj, key) {\n if (isBuffer(obj)){\n return null;\n }\n\n key = key.toLowerCase();\n const keys = Object.keys(obj);\n let i = keys.length;\n let _key;\n while (i-- > 0) {\n _key = keys[i];\n if (key === _key.toLowerCase()) {\n return _key;\n }\n }\n return null;\n}\n\nconst _global = (() => {\n /*eslint no-undef:0*/\n if (typeof globalThis !== \"undefined\") return globalThis;\n return typeof self !== \"undefined\" ? self : (typeof window !== 'undefined' ? window : __webpack_require__.g)\n})();\n\nconst isContextDefined = (context) => !isUndefined(context) && context !== _global;\n\n/**\n * Accepts varargs expecting each argument to be an object, then\n * immutably merges the properties of each object and returns result.\n *\n * When multiple objects contain the same key the later object in\n * the arguments list will take precedence.\n *\n * Example:\n *\n * ```js\n * var result = merge({foo: 123}, {foo: 456});\n * console.log(result.foo); // outputs 456\n * ```\n *\n * @param {Object} obj1 Object to merge\n *\n * @returns {Object} Result of all merge properties\n */\nfunction merge(/* obj1, obj2, obj3, ... */) {\n const {caseless, skipUndefined} = isContextDefined(this) && this || {};\n const result = {};\n const assignValue = (val, key) => {\n const targetKey = caseless && findKey(result, key) || key;\n if (isPlainObject(result[targetKey]) && isPlainObject(val)) {\n result[targetKey] = merge(result[targetKey], val);\n } else if (isPlainObject(val)) {\n result[targetKey] = merge({}, val);\n } else if (isArray(val)) {\n result[targetKey] = val.slice();\n } else if (!skipUndefined || !isUndefined(val)) {\n result[targetKey] = val;\n }\n };\n\n for (let i = 0, l = arguments.length; i < l; i++) {\n arguments[i] && forEach(arguments[i], assignValue);\n }\n return result;\n}\n\n/**\n * Extends object a by mutably adding to it the properties of object b.\n *\n * @param {Object} a The object to be extended\n * @param {Object} b The object to copy properties from\n * @param {Object} thisArg The object to bind function to\n *\n * @param {Boolean} [allOwnKeys]\n * @returns {Object} The resulting value of object a\n */\nconst extend = (a, b, thisArg, {allOwnKeys}= {}) => {\n forEach(b, (val, key) => {\n if (thisArg && isFunction$1(val)) {\n a[key] = bind(val, thisArg);\n } else {\n a[key] = val;\n }\n }, {allOwnKeys});\n return a;\n};\n\n/**\n * Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)\n *\n * @param {string} content with BOM\n *\n * @returns {string} content value without BOM\n */\nconst stripBOM = (content) => {\n if (content.charCodeAt(0) === 0xFEFF) {\n content = content.slice(1);\n }\n return content;\n};\n\n/**\n * Inherit the prototype methods from one constructor into another\n * @param {function} constructor\n * @param {function} superConstructor\n * @param {object} [props]\n * @param {object} [descriptors]\n *\n * @returns {void}\n */\nconst inherits = (constructor, superConstructor, props, descriptors) => {\n constructor.prototype = Object.create(superConstructor.prototype, descriptors);\n constructor.prototype.constructor = constructor;\n Object.defineProperty(constructor, 'super', {\n value: superConstructor.prototype\n });\n props && Object.assign(constructor.prototype, props);\n};\n\n/**\n * Resolve object with deep prototype chain to a flat object\n * @param {Object} sourceObj source object\n * @param {Object} [destObj]\n * @param {Function|Boolean} [filter]\n * @param {Function} [propFilter]\n *\n * @returns {Object}\n */\nconst toFlatObject = (sourceObj, destObj, filter, propFilter) => {\n let props;\n let i;\n let prop;\n const merged = {};\n\n destObj = destObj || {};\n // eslint-disable-next-line no-eq-null,eqeqeq\n if (sourceObj == null) return destObj;\n\n do {\n props = Object.getOwnPropertyNames(sourceObj);\n i = props.length;\n while (i-- > 0) {\n prop = props[i];\n if ((!propFilter || propFilter(prop, sourceObj, destObj)) && !merged[prop]) {\n destObj[prop] = sourceObj[prop];\n merged[prop] = true;\n }\n }\n sourceObj = filter !== false && getPrototypeOf(sourceObj);\n } while (sourceObj && (!filter || filter(sourceObj, destObj)) && sourceObj !== Object.prototype);\n\n return destObj;\n};\n\n/**\n * Determines whether a string ends with the characters of a specified string\n *\n * @param {String} str\n * @param {String} searchString\n * @param {Number} [position= 0]\n *\n * @returns {boolean}\n */\nconst endsWith = (str, searchString, position) => {\n str = String(str);\n if (position === undefined || position > str.length) {\n position = str.length;\n }\n position -= searchString.length;\n const lastIndex = str.indexOf(searchString, position);\n return lastIndex !== -1 && lastIndex === position;\n};\n\n\n/**\n * Returns new array from array like object or null if failed\n *\n * @param {*} [thing]\n *\n * @returns {?Array}\n */\nconst toArray = (thing) => {\n if (!thing) return null;\n if (isArray(thing)) return thing;\n let i = thing.length;\n if (!isNumber(i)) return null;\n const arr = new Array(i);\n while (i-- > 0) {\n arr[i] = thing[i];\n }\n return arr;\n};\n\n/**\n * Checking if the Uint8Array exists and if it does, it returns a function that checks if the\n * thing passed in is an instance of Uint8Array\n *\n * @param {TypedArray}\n *\n * @returns {Array}\n */\n// eslint-disable-next-line func-names\nconst isTypedArray = (TypedArray => {\n // eslint-disable-next-line func-names\n return thing => {\n return TypedArray && thing instanceof TypedArray;\n };\n})(typeof Uint8Array !== 'undefined' && getPrototypeOf(Uint8Array));\n\n/**\n * For each entry in the object, call the function with the key and value.\n *\n * @param {Object<any, any>} obj - The object to iterate over.\n * @param {Function} fn - The function to call for each entry.\n *\n * @returns {void}\n */\nconst forEachEntry = (obj, fn) => {\n const generator = obj && obj[iterator];\n\n const _iterator = generator.call(obj);\n\n let result;\n\n while ((result = _iterator.next()) && !result.done) {\n const pair = result.value;\n fn.call(obj, pair[0], pair[1]);\n }\n};\n\n/**\n * It takes a regular expression and a string, and returns an array of all the matches\n *\n * @param {string} regExp - The regular expression to match against.\n * @param {string} str - The string to search.\n *\n * @returns {Array<boolean>}\n */\nconst matchAll = (regExp, str) => {\n let matches;\n const arr = [];\n\n while ((matches = regExp.exec(str)) !== null) {\n arr.push(matches);\n }\n\n return arr;\n};\n\n/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */\nconst isHTMLForm = kindOfTest('HTMLFormElement');\n\nconst toCamelCase = str => {\n return str.toLowerCase().replace(/[-_\\s]([a-z\\d])(\\w*)/g,\n function replacer(m, p1, p2) {\n return p1.toUpperCase() + p2;\n }\n );\n};\n\n/* Creating a function that will check if an object has a property. */\nconst hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnProperty.call(obj, prop))(Object.prototype);\n\n/**\n * Determine if a value is a RegExp object\n *\n * @param {*} val The value to test\n *\n * @returns {boolean} True if value is a RegExp object, otherwise false\n */\nconst isRegExp = kindOfTest('RegExp');\n\nconst reduceDescriptors = (obj, reducer) => {\n const descriptors = Object.getOwnPropertyDescriptors(obj);\n const reducedDescriptors = {};\n\n forEach(descriptors, (descriptor, name) => {\n let ret;\n if ((ret = reducer(descriptor, name, obj)) !== false) {\n reducedDescriptors[name] = ret || descriptor;\n }\n });\n\n Object.defineProperties(obj, reducedDescriptors);\n};\n\n/**\n * Makes all methods read-only\n * @param {Object} obj\n */\n\nconst freezeMethods = (obj) => {\n reduceDescriptors(obj, (descriptor, name) => {\n // skip restricted props in strict mode\n if (isFunction$1(obj) && ['arguments', 'caller', 'callee'].indexOf(name) !== -1) {\n return false;\n }\n\n const value = obj[name];\n\n if (!isFunction$1(value)) return;\n\n descriptor.enumerable = false;\n\n if ('writable' in descriptor) {\n descriptor.writable = false;\n return;\n }\n\n if (!descriptor.set) {\n descriptor.set = () => {\n throw Error('Can not rewrite read-only method \\'' + name + '\\'');\n };\n }\n });\n};\n\nconst toObjectSet = (arrayOrString, delimiter) => {\n const obj = {};\n\n const define = (arr) => {\n arr.forEach(value => {\n obj[value] = true;\n });\n };\n\n isArray(arrayOrString) ? define(arrayOrString) : define(String(arrayOrString).split(delimiter));\n\n return obj;\n};\n\nconst noop = () => {}