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BsD,EAAS+E,EAAYrI,GAC3B,IAAK,MAAMwI,KAAa9I,EAAEM,EAAM,aAAc,CAC1C,MAAMuG,EAAUD,EAAakC,EAAW/D,EAAUnB,GAC9CiD,UACMA,EACd,CACA,IAAK,MAAMkC,KAAiB/I,EAAEM,EAAM,iBAAkB,CAClD,MAAMuG,EAAUyB,EAAiBS,EAAehE,EAAUnB,GACtDiD,UACMA,EACd,CACJ,CAWA,SAASmC,EAAI1I,GACT,MAAO,CACHwF,KAAM,oBACNmD,SAAUrd,MAAMgC,KAAKib,EAAOvI,IAEpC,C","sources":["webpack://solvi-web/./node_modules/react-range/lib/Range.js","webpack://solvi-web/./node_modules/react-range/lib/index.js","webpack://solvi-web/./node_modules/react-range/lib/types.js","webpack://solvi-web/./node_modules/react-range/lib/utils.js","webpack://solvi-web/./node_modules/@tmcw/togeojson/dist/togeojson.es.mjs"],"sourcesContent":["\"use strict\";\nvar __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n if (typeof b !== \"function\" && b !== null)\n throw new TypeError(\"Class extends value \" + String(b) + \" is not a constructor or null\");\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nvar __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n var desc = Object.getOwnPropertyDescriptor(m, k);\n if (!desc || (\"get\" in desc ? !m.__esModule : desc.writable || desc.configurable)) {\n desc = { enumerable: true, get: function() { return m[k]; } };\n }\n Object.defineProperty(o, k2, desc);\n}) : (function(o, m, k, k2) {\n if (k2 === undefined) k2 = k;\n o[k2] = m[k];\n}));\nvar __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {\n Object.defineProperty(o, \"default\", { enumerable: true, value: v });\n}) : function(o, v) {\n o[\"default\"] = v;\n});\nvar __importStar = (this && this.__importStar) || function (mod) {\n if (mod && mod.__esModule) return mod;\n var result = {};\n if (mod != null) for (var k in mod) if (k !== \"default\" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);\n __setModuleDefault(result, mod);\n return result;\n};\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nvar React = __importStar(require(\"react\"));\nvar utils_1 = require(\"./utils\");\nvar types_1 = require(\"./types\");\nvar INCREASE_KEYS = ['ArrowRight', 'ArrowUp', 'k', 'PageUp'];\nvar DECREASE_KEYS = ['ArrowLeft', 'ArrowDown', 'j', 'PageDown'];\nvar Range = /** @class */ (function (_super) {\n __extends(Range, _super);\n function Range(props) {\n var _this = _super.call(this, props) || this;\n _this.trackRef = React.createRef();\n _this.thumbRefs = [];\n _this.markRefs = [];\n _this.state = {\n draggedTrackPos: [-1, -1],\n draggedThumbIndex: -1,\n thumbZIndexes: new Array(_this.props.values.length).fill(0).map(function (t, i) { return i; }),\n isChanged: false,\n markOffsets: []\n };\n _this.getOffsets = function () {\n var _a = _this.props, direction = _a.direction, values = _a.values, min = _a.min, max = _a.max;\n var trackElement = _this.trackRef.current;\n var trackRect = trackElement.getBoundingClientRect();\n var trackPadding = (0, utils_1.getPaddingAndBorder)(trackElement);\n return _this.getThumbs().map(function (thumb, index) {\n var thumbOffsets = { x: 0, y: 0 };\n var thumbRect = thumb.getBoundingClientRect();\n var thumbMargins = (0, utils_1.getMargin)(thumb);\n switch (direction) {\n case types_1.Direction.Right:\n thumbOffsets.x = (thumbMargins.left + trackPadding.left) * -1;\n thumbOffsets.y =\n ((thumbRect.height - trackRect.height) / 2 + trackPadding.top) * -1;\n thumbOffsets.x +=\n trackRect.width * (0, utils_1.relativeValue)(values[index], min, max) -\n thumbRect.width / 2;\n return thumbOffsets;\n case types_1.Direction.Left:\n thumbOffsets.x = (thumbMargins.right + trackPadding.right) * -1;\n thumbOffsets.y =\n ((thumbRect.height - trackRect.height) / 2 + trackPadding.top) * -1;\n thumbOffsets.x +=\n trackRect.width -\n trackRect.width * (0, utils_1.relativeValue)(values[index], min, max) -\n thumbRect.width / 2;\n return thumbOffsets;\n case types_1.Direction.Up:\n thumbOffsets.x =\n ((thumbRect.width - trackRect.width) / 2 +\n thumbMargins.left +\n trackPadding.left) *\n -1;\n thumbOffsets.y = -trackPadding.left;\n thumbOffsets.y +=\n trackRect.height -\n trackRect.height * (0, utils_1.relativeValue)(values[index], min, max) -\n thumbRect.height / 2;\n return thumbOffsets;\n case types_1.Direction.Down:\n thumbOffsets.x =\n ((thumbRect.width - trackRect.width) / 2 +\n thumbMargins.left +\n trackPadding.left) *\n -1;\n thumbOffsets.y = -trackPadding.left;\n thumbOffsets.y +=\n trackRect.height * (0, utils_1.relativeValue)(values[index], min, max) -\n thumbRect.height / 2;\n return thumbOffsets;\n default:\n return (0, utils_1.assertUnreachable)(direction);\n }\n });\n };\n _this.getThumbs = function () {\n if (_this.trackRef && _this.trackRef.current) {\n return Array.from(_this.trackRef.current.children).filter(function (el) {\n return el.hasAttribute('aria-valuenow');\n });\n }\n console.warn('No thumbs found in the track container. Did you forget to pass & spread the `props` param in renderTrack?');\n return [];\n };\n _this.getTargetIndex = function (e) {\n return _this.getThumbs().findIndex(function (child) { return child === e.target || child.contains(e.target); });\n };\n _this.addTouchEvents = function (e) {\n document.addEventListener('touchmove', _this.schdOnTouchMove, {\n passive: false\n });\n document.addEventListener('touchend', _this.schdOnEnd, {\n passive: false\n });\n document.addEventListener('touchcancel', _this.schdOnEnd, {\n passive: false\n });\n };\n _this.addMouseEvents = function (e) {\n document.addEventListener('mousemove', _this.schdOnMouseMove);\n document.addEventListener('mouseup', _this.schdOnEnd);\n };\n _this.onMouseDownTrack = function (e) {\n var _a;\n if (e.button !== 0)\n return;\n e.persist();\n e.preventDefault();\n _this.addMouseEvents(e.nativeEvent);\n if (_this.props.values.length > 1 && _this.props.draggableTrack) {\n if (_this.thumbRefs.some(function (thumbRef) { var _a; return (_a = thumbRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target); }))\n return;\n // handle dragging the whole track\n _this.setState({\n draggedTrackPos: [e.clientX, e.clientY]\n }, function () { return _this.onMove(e.clientX, e.clientY); });\n }\n else {\n // get the index of the thumb that is closest to the place where the track is clicked\n var draggedThumbIndex = (0, utils_1.getClosestThumbIndex)(_this.thumbRefs.map(function (t) { return t.current; }), e.clientX, e.clientY, _this.props.direction);\n // move the thumb which is closest to the place where the track is clicked\n (_a = _this.thumbRefs[draggedThumbIndex].current) === null || _a === void 0 ? void 0 : _a.focus();\n _this.setState({\n draggedThumbIndex: draggedThumbIndex\n }, function () { return _this.onMove(e.clientX, e.clientY); });\n }\n };\n _this.onResize = function () {\n (0, utils_1.translateThumbs)(_this.getThumbs(), _this.getOffsets(), _this.props.rtl);\n _this.calculateMarkOffsets();\n };\n _this.onTouchStartTrack = function (e) {\n var _a;\n e.persist();\n _this.addTouchEvents(e.nativeEvent);\n if (_this.props.values.length > 1 && _this.props.draggableTrack) {\n if (_this.thumbRefs.some(function (thumbRef) { var _a; return (_a = thumbRef.current) === null || _a === void 0 ? void 0 : _a.contains(e.target); }))\n return;\n // handle dragging the whole track\n _this.setState({\n draggedTrackPos: [e.touches[0].clientX, e.touches[0].clientY]\n }, function () { return _this.onMove(e.touches[0].clientX, e.touches[0].clientY); });\n }\n else {\n // get the index of the thumb that is closest to the place where the track is clicked\n var draggedThumbIndex = (0, utils_1.getClosestThumbIndex)(_this.thumbRefs.map(function (t) { return t.current; }), e.touches[0].clientX, e.touches[0].clientY, _this.props.direction);\n // move the thumb which is closest to the place where the track is clicked\n (_a = _this.thumbRefs[draggedThumbIndex].current) === null || _a === void 0 ? void 0 : _a.focus();\n _this.setState({\n draggedThumbIndex: draggedThumbIndex\n }, function () { return _this.onMove(e.touches[0].clientX, e.touches[0].clientY); });\n }\n };\n _this.onMouseOrTouchStart = function (e) {\n if (_this.props.disabled)\n return;\n var isTouch = (0, utils_1.isTouchEvent)(e);\n if (!isTouch && e.button !== 0)\n return;\n var index = _this.getTargetIndex(e);\n if (index === -1)\n return;\n if (isTouch) {\n _this.addTouchEvents(e);\n }\n else {\n _this.addMouseEvents(e);\n }\n _this.setState({\n draggedThumbIndex: index,\n thumbZIndexes: _this.state.thumbZIndexes.map(function (t, i) {\n if (i === index) {\n return Math.max.apply(Math, _this.state.thumbZIndexes);\n }\n return t <= _this.state.thumbZIndexes[index] ? t : t - 1;\n })\n });\n };\n _this.onMouseMove = function (e) {\n e.preventDefault();\n _this.onMove(e.clientX, e.clientY);\n };\n _this.onTouchMove = function (e) {\n e.preventDefault();\n _this.onMove(e.touches[0].clientX, e.touches[0].clientY);\n };\n _this.onKeyDown = function (e) {\n var _a = _this.props, values = _a.values, onChange = _a.onChange, step = _a.step, rtl = _a.rtl, direction = _a.direction;\n var isChanged = _this.state.isChanged;\n var index = _this.getTargetIndex(e.nativeEvent);\n var inverter = rtl || direction === types_1.Direction.Left || direction === types_1.Direction.Down\n ? -1\n : 1;\n if (index === -1)\n return;\n if (INCREASE_KEYS.includes(e.key)) {\n e.preventDefault();\n _this.setState({\n draggedThumbIndex: index,\n isChanged: true\n });\n onChange((0, utils_1.replaceAt)(values, index, _this.normalizeValue(values[index] + inverter * (e.key === 'PageUp' ? step * 10 : step), index)));\n }\n else if (DECREASE_KEYS.includes(e.key)) {\n e.preventDefault();\n _this.setState({\n draggedThumbIndex: index,\n isChanged: true\n });\n onChange((0, utils_1.replaceAt)(values, index, _this.normalizeValue(values[index] -\n inverter * (e.key === 'PageDown' ? step * 10 : step), index)));\n }\n else if (e.key === 'Tab') {\n _this.setState({ draggedThumbIndex: -1 }, function () {\n // If key pressed when thumb was moving, fire onFinalChange\n if (isChanged) {\n _this.fireOnFinalChange();\n }\n });\n }\n else {\n if (isChanged) {\n _this.fireOnFinalChange();\n }\n }\n };\n _this.onKeyUp = function (e) {\n var isChanged = _this.state.isChanged;\n _this.setState({\n draggedThumbIndex: -1\n }, function () {\n if (isChanged) {\n _this.fireOnFinalChange();\n }\n });\n };\n _this.onMove = function (clientX, clientY) {\n var _a = _this.state, draggedThumbIndex = _a.draggedThumbIndex, draggedTrackPos = _a.draggedTrackPos;\n var _b = _this.props, direction = _b.direction, min = _b.min, max = _b.max, onChange = _b.onChange, values = _b.values, step = _b.step, rtl = _b.rtl;\n if (draggedThumbIndex === -1 &&\n draggedTrackPos[0] === -1 &&\n draggedTrackPos[1] === -1)\n return null;\n var trackElement = _this.trackRef.current;\n // If component was closed down prematurely, A last onMove could be triggered based on requestAnimationFrame()\n if (!trackElement)\n return null;\n var trackRect = trackElement.getBoundingClientRect();\n var trackLength = (0, utils_1.isVertical)(direction)\n ? trackRect.height\n : trackRect.width;\n if (draggedTrackPos[0] !== -1 && draggedTrackPos[1] !== -1) {\n // calculate how much it moved since the last update\n var dX = clientX - draggedTrackPos[0];\n var dY = clientY - draggedTrackPos[1];\n // calculate the delta of the value\n var deltaValue = 0;\n switch (direction) {\n case types_1.Direction.Right:\n case types_1.Direction.Left:\n deltaValue = (dX / trackLength) * (max - min);\n break;\n case types_1.Direction.Down:\n case types_1.Direction.Up:\n deltaValue = (dY / trackLength) * (max - min);\n break;\n default:\n (0, utils_1.assertUnreachable)(direction);\n }\n // invert for RTL\n if (rtl) {\n deltaValue *= -1;\n }\n if (Math.abs(deltaValue) >= step / 2) {\n // adjust delta so it fits into the range\n for (var i = 0; i < _this.thumbRefs.length; i++) {\n if ((values[i] === max && Math.sign(deltaValue) === 1) ||\n (values[i] === min && Math.sign(deltaValue) === -1))\n return;\n var thumbValue = values[i] + deltaValue;\n if (thumbValue > max)\n deltaValue = max - values[i];\n else if (thumbValue < min)\n deltaValue = min - values[i];\n }\n // add the delta to each thumb\n var newValues = values.slice(0);\n for (var i = 0; i < _this.thumbRefs.length; i++) {\n newValues = (0, utils_1.replaceAt)(newValues, i, _this.normalizeValue(values[i] + deltaValue, i));\n }\n _this.setState({\n draggedTrackPos: [clientX, clientY]\n });\n onChange(newValues);\n }\n }\n else {\n var newValue = 0;\n switch (direction) {\n case types_1.Direction.Right:\n newValue =\n ((clientX - trackRect.left) / trackLength) * (max - min) + min;\n break;\n case types_1.Direction.Left:\n newValue =\n ((trackLength - (clientX - trackRect.left)) / trackLength) *\n (max - min) +\n min;\n break;\n case types_1.Direction.Down:\n newValue =\n ((clientY - trackRect.top) / trackLength) * (max - min) + min;\n break;\n case types_1.Direction.Up:\n newValue =\n ((trackLength - (clientY - trackRect.top)) / trackLength) *\n (max - min) +\n min;\n break;\n default:\n (0, utils_1.assertUnreachable)(direction);\n }\n // invert for RTL\n if (rtl) {\n newValue = max + min - newValue;\n }\n if (Math.abs(values[draggedThumbIndex] - newValue) >= step / 2) {\n onChange((0, utils_1.replaceAt)(values, draggedThumbIndex, _this.normalizeValue(newValue, draggedThumbIndex)));\n }\n }\n };\n _this.normalizeValue = function (value, index) {\n var _a = _this.props, min = _a.min, max = _a.max, step = _a.step, allowOverlap = _a.allowOverlap, values = _a.values;\n return (0, utils_1.normalizeValue)(value, index, min, max, step, allowOverlap, values);\n };\n _this.onEnd = function (e) {\n e.preventDefault();\n document.removeEventListener('mousemove', _this.schdOnMouseMove);\n document.removeEventListener('touchmove', _this.schdOnTouchMove);\n document.removeEventListener('mouseup', _this.schdOnEnd);\n document.removeEventListener('touchend', _this.schdOnEnd);\n document.removeEventListener('touchcancel', _this.schdOnEnd);\n if (_this.state.draggedThumbIndex === -1 &&\n _this.state.draggedTrackPos[0] === -1 &&\n _this.state.draggedTrackPos[1] === -1)\n return null;\n _this.setState({ draggedThumbIndex: -1, draggedTrackPos: [-1, -1] }, function () {\n _this.fireOnFinalChange();\n });\n };\n _this.fireOnFinalChange = function () {\n _this.setState({ isChanged: false });\n var _a = _this.props, onFinalChange = _a.onFinalChange, values = _a.values;\n if (onFinalChange) {\n onFinalChange(values);\n }\n };\n _this.calculateMarkOffsets = function () {\n if (!_this.props.renderMark ||\n !_this.trackRef ||\n _this.trackRef.current === null)\n return;\n var elStyles = window.getComputedStyle(_this.trackRef.current);\n var trackWidth = parseInt(elStyles.width, 10);\n var trackHeight = parseInt(elStyles.height, 10);\n var paddingLeft = parseInt(elStyles.paddingLeft, 10);\n var paddingTop = parseInt(elStyles.paddingTop, 10);\n var res = [];\n for (var i = 0; i < _this.numOfMarks + 1; i++) {\n var markHeight = 9999;\n var markWidth = 9999;\n if (_this.markRefs[i].current) {\n var markRect = _this.markRefs[i].current.getBoundingClientRect();\n markHeight = markRect.height;\n markWidth = markRect.width;\n }\n if (_this.props.direction === types_1.Direction.Left ||\n _this.props.direction === types_1.Direction.Right) {\n res.push([\n Math.round((trackWidth / _this.numOfMarks) * i + paddingLeft - markWidth / 2),\n -Math.round((markHeight - trackHeight) / 2)\n ]);\n }\n else {\n res.push([\n Math.round((trackHeight / _this.numOfMarks) * i + paddingTop - markHeight / 2),\n -Math.round((markWidth - trackWidth) / 2)\n ]);\n }\n }\n _this.setState({ markOffsets: res });\n };\n if (props.step === 0) {\n throw new Error('\"step\" property should be a positive number');\n }\n _this.numOfMarks = (props.max - props.min) / _this.props.step;\n _this.schdOnMouseMove = (0, utils_1.schd)(_this.onMouseMove);\n _this.schdOnTouchMove = (0, utils_1.schd)(_this.onTouchMove);\n _this.schdOnEnd = (0, utils_1.schd)(_this.onEnd);\n _this.thumbRefs = props.values.map(function () { return React.createRef(); });\n for (var i = 0; i < _this.numOfMarks + 1; i++) {\n _this.markRefs[i] = React.createRef();\n }\n return _this;\n }\n Range.prototype.componentDidMount = function () {\n var _this = this;\n var _a = this.props, values = _a.values, min = _a.min, step = _a.step;\n this.resizeObserver = window.ResizeObserver\n ? new window.ResizeObserver(this.onResize)\n : {\n observe: function () { return window.addEventListener('resize', _this.onResize); },\n unobserve: function () { return window.removeEventListener('resize', _this.onResize); }\n };\n document.addEventListener('touchstart', this.onMouseOrTouchStart, {\n passive: false\n });\n document.addEventListener('mousedown', this.onMouseOrTouchStart, {\n passive: false\n });\n !this.props.allowOverlap && (0, utils_1.checkInitialOverlap)(this.props.values);\n this.props.values.forEach(function (value) {\n return (0, utils_1.checkBoundaries)(value, _this.props.min, _this.props.max);\n });\n this.resizeObserver.observe(this.trackRef.current);\n (0, utils_1.translateThumbs)(this.getThumbs(), this.getOffsets(), this.props.rtl);\n this.calculateMarkOffsets();\n values.forEach(function (value) {\n if (!(0, utils_1.isStepDivisible)(min, value, step)) {\n console.warn('The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.');\n }\n });\n };\n Range.prototype.componentDidUpdate = function (prevProps, prevState) {\n var _a = this.props, max = _a.max, min = _a.min, step = _a.step, values = _a.values, rtl = _a.rtl;\n if (prevProps.max !== max ||\n prevProps.min !== min ||\n prevProps.step !== step) {\n this.markRefs = [];\n this.numOfMarks = (max - min) / step;\n for (var i = 0; i < this.numOfMarks + 1; i++) {\n this.markRefs[i] = React.createRef();\n }\n }\n (0, utils_1.translateThumbs)(this.getThumbs(), this.getOffsets(), rtl);\n // ensure offsets are calculated when the refs for the marks have been created\n // and those refs have been mounted to the dom\n // on the state update in calculateOffsets with new markOffsets are calculated\n if (prevProps.max !== max ||\n prevProps.min !== min ||\n prevProps.step !== step ||\n prevState.markOffsets.length !== this.state.markOffsets.length) {\n this.calculateMarkOffsets();\n values.forEach(function (value) {\n if (!(0, utils_1.isStepDivisible)(min, value, step)) {\n console.warn('The `values` property is in conflict with the current `step`, `min`, and `max` properties. Please provide values that are accessible using the min, max, and step values.');\n }\n });\n }\n };\n Range.prototype.componentWillUnmount = function () {\n var options = {\n passive: false\n };\n document.removeEventListener('mousedown', this.onMouseOrTouchStart, options);\n // These need to be removed!!\n document.removeEventListener('mousemove', this.schdOnMouseMove);\n document.removeEventListener('touchmove', this.schdOnTouchMove);\n document.removeEventListener('touchstart', this.onMouseOrTouchStart);\n document.removeEventListener('mouseup', this.schdOnEnd);\n document.removeEventListener('touchend', this.schdOnEnd);\n this.resizeObserver.unobserve(this.trackRef.current);\n };\n Range.prototype.render = function () {\n var _this = this;\n var _a = this.props, renderTrack = _a.renderTrack, renderThumb = _a.renderThumb, _b = _a.renderMark, renderMark = _b === void 0 ? function () { return null; } : _b, values = _a.values, min = _a.min, max = _a.max, allowOverlap = _a.allowOverlap, disabled = _a.disabled;\n var _c = this.state, draggedThumbIndex = _c.draggedThumbIndex, thumbZIndexes = _c.thumbZIndexes, markOffsets = _c.markOffsets;\n return renderTrack({\n props: {\n style: {\n // creates stacking context that prevents z-index applied to thumbs\n // interfere with other elements\n transform: 'scale(1)',\n cursor: draggedThumbIndex > -1\n ? 'grabbing'\n : this.props.draggableTrack\n ? (0, utils_1.isVertical)(this.props.direction)\n ? 'ns-resize'\n : 'ew-resize'\n : values.length === 1 && !disabled\n ? 'pointer'\n : 'inherit'\n },\n onMouseDown: disabled ? utils_1.voidFn : this.onMouseDownTrack,\n onTouchStart: disabled ? utils_1.voidFn : this.onTouchStartTrack,\n ref: this.trackRef\n },\n isDragged: this.state.draggedThumbIndex > -1,\n disabled: disabled,\n children: __spreadArray(__spreadArray([], markOffsets.map(function (offset, index, arr) {\n return renderMark({\n props: {\n style: _this.props.direction === types_1.Direction.Left ||\n _this.props.direction === types_1.Direction.Right\n ? {\n position: 'absolute',\n left: \"\".concat(offset[0], \"px\"),\n marginTop: \"\".concat(offset[1], \"px\")\n }\n : {\n position: 'absolute',\n top: \"\".concat(offset[0], \"px\"),\n marginLeft: \"\".concat(offset[1], \"px\")\n },\n key: \"mark\".concat(index),\n ref: _this.markRefs[index]\n },\n index: index\n });\n }), true), values.map(function (value, index) {\n var isDragged = _this.state.draggedThumbIndex === index;\n return renderThumb({\n index: index,\n value: value,\n isDragged: isDragged,\n props: {\n style: {\n position: 'absolute',\n zIndex: thumbZIndexes[index],\n cursor: disabled ? 'inherit' : isDragged ? 'grabbing' : 'grab',\n userSelect: 'none',\n touchAction: 'none',\n WebkitUserSelect: 'none',\n MozUserSelect: 'none',\n msUserSelect: 'none'\n },\n key: index,\n tabIndex: disabled ? undefined : 0,\n 'aria-valuemax': allowOverlap ? max : values[index + 1] || max,\n 'aria-valuemin': allowOverlap ? min : values[index - 1] || min,\n 'aria-valuenow': value,\n draggable: false,\n ref: _this.thumbRefs[index],\n role: 'slider',\n onKeyDown: disabled ? utils_1.voidFn : _this.onKeyDown,\n onKeyUp: disabled ? utils_1.voidFn : _this.onKeyUp\n }\n });\n }), true)\n });\n };\n Range.defaultProps = {\n step: 1,\n direction: types_1.Direction.Right,\n rtl: false,\n disabled: false,\n allowOverlap: false,\n draggableTrack: false,\n min: 0,\n max: 100\n };\n return Range;\n}(React.Component));\nexports.default = Range;\n","\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.checkValuesAgainstBoundaries = exports.relativeValue = exports.useThumbOverlap = exports.Direction = exports.getTrackBackground = exports.Range = void 0;\nvar Range_1 = __importDefault(require(\"./Range\"));\nexports.Range = Range_1.default;\nvar utils_1 = require(\"./utils\");\nObject.defineProperty(exports, \"getTrackBackground\", { enumerable: true, get: function () { return utils_1.getTrackBackground; } });\nObject.defineProperty(exports, \"useThumbOverlap\", { enumerable: true, get: function () { return utils_1.useThumbOverlap; } });\nObject.defineProperty(exports, \"relativeValue\", { enumerable: true, get: function () { return utils_1.relativeValue; } });\nObject.defineProperty(exports, \"checkValuesAgainstBoundaries\", { enumerable: true, get: function () { return utils_1.checkValuesAgainstBoundaries; } });\nvar types_1 = require(\"./types\");\nObject.defineProperty(exports, \"Direction\", { enumerable: true, get: function () { return types_1.Direction; } });\n","\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.Direction = void 0;\nvar Direction;\n(function (Direction) {\n Direction[\"Right\"] = \"to right\";\n Direction[\"Left\"] = \"to left\";\n Direction[\"Down\"] = \"to bottom\";\n Direction[\"Up\"] = \"to top\";\n})(Direction = exports.Direction || (exports.Direction = {}));\n","\"use strict\";\nvar __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {\n if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {\n if (ar || !(i in from)) {\n if (!ar) ar = Array.prototype.slice.call(from, 0, i);\n ar[i] = from[i];\n }\n }\n return to.concat(ar || Array.prototype.slice.call(from));\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.useThumbOverlap = exports.assertUnreachable = exports.voidFn = exports.getTrackBackground = exports.replaceAt = exports.schd = exports.translate = exports.getClosestThumbIndex = exports.translateThumbs = exports.getPaddingAndBorder = exports.getMargin = exports.checkInitialOverlap = exports.checkValuesAgainstBoundaries = exports.checkBoundaries = exports.isVertical = exports.relativeValue = exports.normalizeValue = exports.isStepDivisible = exports.isTouchEvent = exports.getStepDecimals = void 0;\nvar react_1 = require(\"react\");\nvar types_1 = require(\"./types\");\nvar getStepDecimals = function (step) {\n var decimals = step.toString().split('.')[1];\n return decimals ? decimals.length : 0;\n};\nexports.getStepDecimals = getStepDecimals;\nfunction isTouchEvent(event) {\n return ((event.touches && event.touches.length) ||\n (event.changedTouches && event.changedTouches.length));\n}\nexports.isTouchEvent = isTouchEvent;\nfunction isStepDivisible(min, max, step) {\n var res = (max - min) / step;\n var precision = 8;\n var roundedRes = Number(res.toFixed(precision));\n return parseInt(roundedRes.toString(), 10) === roundedRes;\n}\nexports.isStepDivisible = isStepDivisible;\nfunction normalizeValue(value, index, min, max, step, allowOverlap, values) {\n var BIG_NUM = 10e10;\n value = Math.round(value * BIG_NUM) / BIG_NUM;\n if (!allowOverlap) {\n var prev = values[index - 1];\n var next = values[index + 1];\n if (prev && prev > value)\n return prev;\n if (next && next < value)\n return next;\n }\n if (value > max)\n return max;\n if (value < min)\n return min;\n // `remainder` is a difference between the given value and a full step value\n // that is closest lower to the given value and is in the range between the min value\n // and the given value\n var remainder = Math.floor(value * BIG_NUM - min * BIG_NUM) %\n Math.floor(step * BIG_NUM);\n var closestLowerNum = Math.floor(value * BIG_NUM - Math.abs(remainder));\n var rounded = remainder === 0 ? value : closestLowerNum / BIG_NUM;\n // Values with a remainder `< step/2` are rounded to the closest lower value\n // while values with a remainder `= > step/2` are rounded to the closest bigger value\n var res = Math.abs(remainder / BIG_NUM) < step / 2\n ? rounded\n : rounded + step;\n var decimalPlaces = (0, exports.getStepDecimals)(step);\n return parseFloat(res.toFixed(decimalPlaces));\n}\nexports.normalizeValue = normalizeValue;\nfunction relativeValue(value, min, max) {\n return (value - min) / (max - min);\n}\nexports.relativeValue = relativeValue;\nfunction isVertical(direction) {\n return direction === types_1.Direction.Up || direction === types_1.Direction.Down;\n}\nexports.isVertical = isVertical;\nfunction checkBoundaries(value, min, max) {\n if (min >= max) {\n throw new RangeError(\"min (\".concat(min, \") is equal/bigger than max (\").concat(max, \")\"));\n }\n if (value < min) {\n throw new RangeError(\"value (\".concat(value, \") is smaller than min (\").concat(min, \")\"));\n }\n if (value > max) {\n throw new RangeError(\"value (\".concat(value, \") is bigger than max (\").concat(max, \")\"));\n }\n}\nexports.checkBoundaries = checkBoundaries;\nfunction checkValuesAgainstBoundaries(value, min, max) {\n if (value < min) {\n // set selectedValue to min\n return min;\n }\n if (value > max) {\n // set selectedValue to max\n return max;\n }\n else {\n return value;\n }\n}\nexports.checkValuesAgainstBoundaries = checkValuesAgainstBoundaries;\nfunction checkInitialOverlap(values) {\n if (values.length < 2)\n return;\n if (!values.slice(1).every(function (item, i) { return values[i] <= item; })) {\n throw new RangeError(\"values={[\".concat(values, \"]} needs to be sorted when allowOverlap={false}\"));\n }\n}\nexports.checkInitialOverlap = checkInitialOverlap;\nfunction getMargin(element) {\n var style = window.getComputedStyle(element);\n return {\n top: parseInt(style['margin-top'], 10),\n bottom: parseInt(style['margin-bottom'], 10),\n left: parseInt(style['margin-left'], 10),\n right: parseInt(style['margin-right'], 10)\n };\n}\nexports.getMargin = getMargin;\nfunction getPaddingAndBorder(element) {\n var style = window.getComputedStyle(element);\n return {\n top: parseInt(style['padding-top'], 10) + parseInt(style['border-top-width'], 10),\n bottom: parseInt(style['padding-bottom'], 10) + parseInt(style['border-bottom-width'], 10),\n left: parseInt(style['padding-left'], 10) + parseInt(style['border-left-width'], 10),\n right: parseInt(style['padding-right'], 10) + parseInt(style['border-right-width'], 10),\n };\n}\nexports.getPaddingAndBorder = getPaddingAndBorder;\nfunction translateThumbs(elements, offsets, rtl) {\n var inverter = rtl ? -1 : 1;\n elements.forEach(function (element, index) {\n return translate(element, inverter * offsets[index].x, offsets[index].y);\n });\n}\nexports.translateThumbs = translateThumbs;\n/**\n * Util function for calculating the index of the thumb that is closes to a given position\n * @param thumbs - array of Thumb element to calculate the distance from\n * @param clientX - target x position (mouse/touch)\n * @param clientY - target y position (mouse/touch)\n * @param direction - the direction of the track\n */\nfunction getClosestThumbIndex(thumbs, clientX, clientY, direction) {\n var thumbIndex = 0;\n var minThumbDistance = getThumbDistance(thumbs[0], clientX, clientY, direction);\n for (var i = 1; i < thumbs.length; i++) {\n var thumbDistance = getThumbDistance(thumbs[i], clientX, clientY, direction);\n if (thumbDistance < minThumbDistance) {\n minThumbDistance = thumbDistance;\n thumbIndex = i;\n }\n }\n return thumbIndex;\n}\nexports.getClosestThumbIndex = getClosestThumbIndex;\nfunction translate(element, x, y) {\n element.style.transform = \"translate(\".concat(x, \"px, \").concat(y, \"px)\");\n}\nexports.translate = translate;\n// adapted from https://github.com/alexreardon/raf-schd\nvar schd = function (fn) {\n var lastArgs = [];\n var frameId = null;\n var wrapperFn = function () {\n var args = [];\n for (var _i = 0; _i < arguments.length; _i++) {\n args[_i] = arguments[_i];\n }\n lastArgs = args;\n if (frameId) {\n return;\n }\n frameId = requestAnimationFrame(function () {\n frameId = null;\n fn.apply(void 0, lastArgs);\n });\n };\n return wrapperFn;\n};\nexports.schd = schd;\nfunction replaceAt(values, index, value) {\n var ret = values.slice(0);\n ret[index] = value;\n return ret;\n}\nexports.replaceAt = replaceAt;\nfunction getTrackBackground(_a) {\n var values = _a.values, colors = _a.colors, min = _a.min, max = _a.max, _b = _a.direction, direction = _b === void 0 ? types_1.Direction.Right : _b, _c = _a.rtl, rtl = _c === void 0 ? false : _c;\n if (rtl && direction === types_1.Direction.Right) {\n direction = types_1.Direction.Left;\n }\n else if (rtl && types_1.Direction.Left) {\n direction = types_1.Direction.Right;\n }\n // sort values ascending\n var progress = values.slice(0).sort(function (a, b) { return a - b; }).map(function (value) { return ((value - min) / (max - min)) * 100; });\n var middle = progress.reduce(function (acc, point, index) {\n return \"\".concat(acc, \", \").concat(colors[index], \" \").concat(point, \"%, \").concat(colors[index + 1], \" \").concat(point, \"%\");\n }, '');\n return \"linear-gradient(\".concat(direction, \", \").concat(colors[0], \" 0%\").concat(middle, \", \").concat(colors[colors.length - 1], \" 100%)\");\n}\nexports.getTrackBackground = getTrackBackground;\nfunction voidFn() { }\nexports.voidFn = voidFn;\nfunction assertUnreachable(x) {\n throw new Error(\"Didn't expect to get here\");\n}\nexports.assertUnreachable = assertUnreachable;\n/**\n * Util function for grabbing the true largest width of a thumb\n * including the label\n * @param thumbEl - Thumb element to grab the largest width from\n * @param value - Thumb value, not label value\n * @param separator - Label separator value\n */\nvar getThumbWidth = function (thumbEl, value, separator, decimalPlaces, valueToLabel) {\n if (valueToLabel === void 0) { valueToLabel = function (value) { return value; }; }\n var width = Math.ceil(__spreadArray([thumbEl], Array.from(thumbEl.children), true).reduce(function (width, el) {\n var elWidth = Math.ceil(el.getBoundingClientRect().width);\n /**\n * If a label contains a merged label value, it won't return the true\n * label width for that Thumb. Clone the label and change the value\n * to that individual Thumb value in order to grab the true width.\n */\n if (el.innerText &&\n el.innerText.includes(separator) &&\n el.childElementCount === 0) {\n var elClone = el.cloneNode(true);\n elClone.innerHTML = valueToLabel(value.toFixed(decimalPlaces));\n elClone.style.visibility = 'hidden';\n document.body.appendChild(elClone);\n elWidth = Math.ceil(elClone.getBoundingClientRect().width);\n document.body.removeChild(elClone);\n }\n return elWidth > width ? elWidth : width;\n }, thumbEl.getBoundingClientRect().width));\n return width;\n};\n/**\n * Bulk of logic for thumb overlaps\n * Consider a scenario with 5 thumbs;\n * Thumb 1 overlaps with thumb 0 and thumb 2\n * Thumb 2 overlaps with thumb 3\n * We need an array that contains [0, 1, 2, 3]\n * The function needs to return the directly overlapping thumbs\n * and all thumbs overlapping linked to those and so on\n * @param index - Thumb index calculating overlaps for\n * @param offsets - Current Array of Thumb offsets for Range\n * @param thumbs - Array of Thumb elements\n * @param values - Array of Thumb values\n * @param separator - String separator for merged label values\n * @returns overlaps - Array of all overlapping thumbs from the index\n */\nvar getOverlaps = function (index, offsets, thumbs, values, separator, decimalPlaces, valueToLabel) {\n if (valueToLabel === void 0) { valueToLabel = function (value) { return value; }; }\n var overlaps = [];\n /**\n * Recursive function for building the overlaps Array\n * If an overlap is found, find the overlaps for that overlap\n * @param thumbIndex current Thumb index to find overlaps from\n */\n var buildOverlaps = function (thumbIndex) {\n var thumbXWidth = getThumbWidth(thumbs[thumbIndex], values[thumbIndex], separator, decimalPlaces, valueToLabel);\n var thumbX = offsets[thumbIndex].x;\n /**\n * Iterate through the Thumb offsets, if there is a match\n * add the thumbIndex and siblingIndex to the overlaps Array\n *\n * Then build overlaps from the overlapping siblingIndex\n */\n offsets.forEach(function (_a, siblingIndex) {\n var siblingX = _a.x;\n var siblingWidth = getThumbWidth(thumbs[siblingIndex], values[siblingIndex], separator, decimalPlaces, valueToLabel);\n if (thumbIndex !== siblingIndex &&\n ((thumbX >= siblingX && thumbX <= siblingX + siblingWidth) ||\n (thumbX + thumbXWidth >= siblingX &&\n thumbX + thumbXWidth <= siblingX + siblingWidth))) {\n if (!overlaps.includes(siblingIndex)) {\n overlaps.push(thumbIndex);\n overlaps.push(siblingIndex);\n overlaps = __spreadArray(__spreadArray([], overlaps, true), [thumbIndex, siblingIndex], false);\n buildOverlaps(siblingIndex);\n }\n }\n });\n };\n buildOverlaps(index);\n // Sort and remove duplicates from the built overlaps\n return Array.from(new Set(overlaps.sort()));\n};\n/**\n * A custom React Hook for calculating whether a thumb overlaps\n * another and whether labels could/should merge.\n * @param rangeRef - React ref value of Range component\n * @param values - current Range values Array\n * @param index - thumb index\n * @param step - step value, used to calculate the number of decimal places\n * @param separator - string to separate thumb values\n * @returns label value + styling for thumb label\n */\nvar useThumbOverlap = function (rangeRef, values, index, step, separator, valueToLabel) {\n if (step === void 0) { step = 0.1; }\n if (separator === void 0) { separator = ' - '; }\n if (valueToLabel === void 0) { valueToLabel = function (value) { return value; }; }\n var decimalPlaces = (0, exports.getStepDecimals)(step);\n // Create initial label style and value. Label value defaults to thumb value\n var _a = (0, react_1.useState)({}), labelStyle = _a[0], setLabelStyle = _a[1];\n var _b = (0, react_1.useState)(valueToLabel(values[index].toFixed(decimalPlaces))), labelValue = _b[0], setLabelValue = _b[1];\n // When the rangeRef or values change, update the Thumb label values and styling\n (0, react_1.useEffect)(function () {\n if (rangeRef) {\n var thumbs = rangeRef.getThumbs();\n if (thumbs.length < 1)\n return;\n var newStyle = {};\n var offsets_1 = rangeRef.getOffsets();\n /**\n * Get any overlaps for the given Thumb index. This must return all linked\n * Thumbs. So if there are 4 Thumbs and Thumbs 2, 3 and 4 overlap. If we are\n * getting the overlaps for Thumb 1 and it overlaps only Thumb 2, we must get\n * 2, 3 and 4 also.\n */\n var overlaps = getOverlaps(index, offsets_1, thumbs, values, separator, decimalPlaces, valueToLabel);\n // Set a default label value of the Thumb value\n var labelValue_1 = valueToLabel(values[index].toFixed(decimalPlaces));\n /**\n * If there are overlaps for the Thumb, we need to calculate the correct\n * Label value along with the relevant styling. We only want to show a Label\n * for the left most Thumb in an overlapping set.\n * All other Thumbs will be set to display: none.\n */\n if (overlaps.length) {\n /**\n * Get an Array of the offsets for the overlapping Thumbs\n * This is so we can determine if the Thumb we are looking at\n * is the left most thumb in an overlapping set\n */\n var offsetsX = overlaps.reduce(function (a, c, i, s) {\n return a.length ? __spreadArray(__spreadArray([], a, true), [offsets_1[s[i]].x], false) : [offsets_1[s[i]].x];\n }, []);\n /**\n * If our Thumb is the left most Thumb, we can build a Label value\n * and set the style for that Label\n */\n if (Math.min.apply(Math, offsetsX) === offsets_1[index].x) {\n /**\n * First calculate the Label value. To do this,\n * grab all the values for the Thumbs in our overlaps.\n * Then convert that to a Set and sort it whilst removing duplicates.\n */\n var labelValues_1 = [];\n overlaps.forEach(function (thumb) {\n labelValues_1.push(values[thumb].toFixed(decimalPlaces));\n });\n /**\n * Update the labelValue with the resulting Array\n * joined by our defined separator\n */\n labelValue_1 = Array.from(new Set(labelValues_1.sort(function (a, b) { return parseFloat(a) - parseFloat(b); })))\n .map(valueToLabel)\n .join(separator);\n /**\n * Lastly, build the label styling. The label styling will\n * position the label and apply a transform so that it's centered.\n * We want the center point between the left edge of the left most Thumb\n * and the right edge of the right most Thumb.\n */\n var first = Math.min.apply(Math, offsetsX);\n var last = Math.max.apply(Math, offsetsX);\n var lastWidth = thumbs[overlaps[offsetsX.indexOf(last)]].getBoundingClientRect().width;\n newStyle.left = \"\".concat(Math.abs(first - (last + lastWidth)) / 2, \"px\");\n newStyle.transform = 'translate(-50%, 0)';\n }\n else {\n // If the Thumb isn't the left most Thumb, hide the Label!\n newStyle.visibility = 'hidden';\n }\n }\n // Update the label value and style\n setLabelValue(labelValue_1);\n setLabelStyle(newStyle);\n }\n }, [rangeRef, values]);\n return [labelValue, labelStyle];\n};\nexports.useThumbOverlap = useThumbOverlap;\n/**\n * Util function for calculating the distance of the center of a thumb\n * form a given mouse/touch target's position\n * @param thumbEl - Thumb element to calculate the distance from\n * @param clientX - target x position (mouse/touch)\n * @param clientY - target y position (mouse/touch)\n * @param direction - the direction of the track\n */\nfunction getThumbDistance(thumbEl, clientX, clientY, direction) {\n var _a = thumbEl.getBoundingClientRect(), left = _a.left, top = _a.top, width = _a.width, height = _a.height;\n return isVertical(direction) ? Math.abs(clientY - (top + height / 2)) : Math.abs(clientX - (left + width / 2));\n}\n","function $(element, tagName) {\n return Array.from(element.getElementsByTagName(tagName));\n}\nfunction normalizeId(id) {\n return id[0] === \"#\" ? id : `#${id}`;\n}\nfunction $ns(element, tagName, ns) {\n return Array.from(element.getElementsByTagNameNS(ns, tagName));\n}\n/**\n * get the content of a text node, if any\n */\nfunction nodeVal(node) {\n node?.normalize();\n return (node && node.textContent) || \"\";\n}\n/**\n * Get one Y child of X, if any, otherwise null\n */\nfunction get1(node, tagName, callback) {\n const n = node.getElementsByTagName(tagName);\n const result = n.length ? n[0] : null;\n if (result && callback)\n callback(result);\n return result;\n}\nfunction get(node, tagName, callback) {\n const properties = {};\n if (!node)\n return properties;\n const n = node.getElementsByTagName(tagName);\n const result = n.length ? n[0] : null;\n if (result && callback) {\n return callback(result, properties);\n }\n return properties;\n}\nfunction val1(node, tagName, callback) {\n const val = nodeVal(get1(node, tagName));\n if (val && callback)\n return callback(val) || {};\n return {};\n}\nfunction $num(node, tagName, callback) {\n const val = parseFloat(nodeVal(get1(node, tagName)));\n if (isNaN(val))\n return undefined;\n if (val && callback)\n return callback(val) || {};\n return {};\n}\nfunction num1(node, tagName, callback) {\n const val = parseFloat(nodeVal(get1(node, tagName)));\n if (isNaN(val))\n return undefined;\n if (val && callback)\n callback(val);\n return val;\n}\nfunction getMulti(node, propertyNames) {\n const properties = {};\n for (const property of propertyNames) {\n val1(node, property, (val) => {\n properties[property] = val;\n });\n }\n return properties;\n}\nfunction isElement(node) {\n return node?.nodeType === 1;\n}\n\nfunction getLineStyle(node) {\n return get(node, \"line\", (lineStyle) => {\n const val = Object.assign({}, val1(lineStyle, \"color\", (color) => {\n return { stroke: `#${color}` };\n }), $num(lineStyle, \"opacity\", (opacity) => {\n return { \"stroke-opacity\": opacity };\n }), $num(lineStyle, \"width\", (width) => {\n // GPX width is in mm, convert to px with 96 px per inch\n return { \"stroke-width\": (width * 96) / 25.4 };\n }));\n return val;\n });\n}\n\nfunction getExtensions(node) {\n let values = [];\n if (node === null)\n return values;\n for (const child of Array.from(node.childNodes)) {\n if (!isElement(child))\n continue;\n const name = abbreviateName(child.nodeName);\n if (name === \"gpxtpx:TrackPointExtension\") {\n // loop again for nested garmin extensions (eg. \"gpxtpx:hr\")\n values = values.concat(getExtensions(child));\n }\n else {\n // push custom extension (eg. \"power\")\n const val = nodeVal(child);\n values.push([name, parseNumeric(val)]);\n }\n }\n return values;\n}\nfunction abbreviateName(name) {\n return [\"heart\", \"gpxtpx:hr\", \"hr\"].includes(name) ? \"heart\" : name;\n}\nfunction parseNumeric(val) {\n const num = parseFloat(val);\n return isNaN(num) ? val : num;\n}\n\nfunction coordPair$1(node) {\n const ll = [\n parseFloat(node.getAttribute(\"lon\") || \"\"),\n parseFloat(node.getAttribute(\"lat\") || \"\"),\n ];\n if (isNaN(ll[0]) || isNaN(ll[1])) {\n return null;\n }\n num1(node, \"ele\", (val) => {\n ll.push(val);\n });\n const time = get1(node, \"time\");\n return {\n coordinates: ll,\n time: time ? nodeVal(time) : null,\n extendedValues: getExtensions(get1(node, \"extensions\")),\n };\n}\n\nfunction extractProperties(node) {\n const properties = getMulti(node, [\n \"name\",\n \"cmt\",\n \"desc\",\n \"type\",\n \"time\",\n \"keywords\",\n ]);\n const extensions = Array.from(node.getElementsByTagNameNS(\"http://www.garmin.com/xmlschemas/GpxExtensions/v3\", \"*\"));\n for (const child of extensions) {\n if (child.parentNode?.parentNode === node) {\n properties[child.tagName.replace(\":\", \"_\")] = nodeVal(child);\n }\n }\n const links = $(node, \"link\");\n if (links.length) {\n properties.links = links.map((link) => Object.assign({ href: link.getAttribute(\"href\") }, getMulti(link, [\"text\", \"type\"])));\n }\n return properties;\n}\n\n/**\n * Extract points from a trkseg or rte element.\n */\nfunction getPoints$1(node, pointname) {\n const pts = $(node, pointname);\n const line = [];\n const times = [];\n const extendedValues = {};\n for (let i = 0; i < pts.length; i++) {\n const c = coordPair$1(pts[i]);\n if (!c) {\n continue;\n }\n line.push(c.coordinates);\n if (c.time)\n times.push(c.time);\n for (const [name, val] of c.extendedValues) {\n const plural = name === \"heart\" ? name : name.replace(\"gpxtpx:\", \"\") + \"s\";\n if (!extendedValues[plural]) {\n extendedValues[plural] = Array(pts.length).fill(null);\n }\n extendedValues[plural][i] = val;\n }\n }\n if (line.length < 2)\n return; // Invalid line in GeoJSON\n return {\n line: line,\n times: times,\n extendedValues: extendedValues,\n };\n}\n/**\n * Extract a LineString geometry from a rte\n * element.\n */\nfunction getRoute(node) {\n const line = getPoints$1(node, \"rtept\");\n if (!line)\n return;\n return {\n type: \"Feature\",\n properties: Object.assign({ _gpxType: \"rte\" }, extractProperties(node), getLineStyle(get1(node, \"extensions\"))),\n geometry: {\n type: \"LineString\",\n coordinates: line.line,\n },\n };\n}\nfunction getTrack(node) {\n const segments = $(node, \"trkseg\");\n const track = [];\n const times = [];\n const extractedLines = [];\n for (const segment of segments) {\n const line = getPoints$1(segment, \"trkpt\");\n if (line) {\n extractedLines.push(line);\n if (line.times && line.times.length)\n times.push(line.times);\n }\n }\n if (extractedLines.length === 0)\n return null;\n const multi = extractedLines.length > 1;\n const properties = Object.assign({ _gpxType: \"trk\" }, extractProperties(node), getLineStyle(get1(node, \"extensions\")), times.length\n ? {\n coordinateProperties: {\n times: multi ? times : times[0],\n },\n }\n : {});\n for (const line of extractedLines) {\n track.push(line.line);\n if (!properties.coordinateProperties) {\n properties.coordinateProperties = {};\n }\n const props = properties.coordinateProperties;\n const entries = Object.entries(line.extendedValues);\n for (let i = 0; i < entries.length; i++) {\n const [name, val] = entries[i];\n if (multi) {\n if (!props[name]) {\n props[name] = extractedLines.map((line) => new Array(line.line.length).fill(null));\n }\n props[name][i] = val;\n }\n else {\n props[name] = val;\n }\n }\n }\n return {\n type: \"Feature\",\n properties: properties,\n geometry: multi\n ? {\n type: \"MultiLineString\",\n coordinates: track,\n }\n : {\n type: \"LineString\",\n coordinates: track[0],\n },\n };\n}\n/**\n * Extract a point, if possible, from a given node,\n * which is usually a wpt or trkpt\n */\nfunction getPoint(node) {\n const properties = Object.assign(extractProperties(node), getMulti(node, [\"sym\"]));\n const pair = coordPair$1(node);\n if (!pair)\n return null;\n return {\n type: \"Feature\",\n properties,\n geometry: {\n type: \"Point\",\n coordinates: pair.coordinates,\n },\n };\n}\n/**\n * Convert GPX to GeoJSON incrementally, returning\n * a [Generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators)\n * that yields output feature by feature.\n */\nfunction* gpxGen(node) {\n for (const track of $(node, \"trk\")) {\n const feature = getTrack(track);\n if (feature)\n yield feature;\n }\n for (const route of $(node, \"rte\")) {\n const feature = getRoute(route);\n if (feature)\n yield feature;\n }\n for (const waypoint of $(node, \"wpt\")) {\n const point = getPoint(waypoint);\n if (point)\n yield point;\n }\n}\n/**\n *\n * Convert a GPX document to GeoJSON. The first argument, `doc`, must be a GPX\n * document as an XML DOM - not as a string. You can get this using jQuery's default\n * `.ajax` function or using a bare XMLHttpRequest with the `.response` property\n * holding an XML DOM.\n *\n * The output is a JavaScript object of GeoJSON data, same as `.kml` outputs, with the\n * addition of a `_gpxType` property on each `LineString` feature that indicates whether\n * the feature was encoded as a route (`rte`) or track (`trk`) in the GPX document.\n */\nfunction gpx(node) {\n return {\n type: \"FeatureCollection\",\n features: Array.from(gpxGen(node)),\n };\n}\n\nconst EXTENSIONS_NS = \"http://www.garmin.com/xmlschemas/ActivityExtension/v2\";\nconst TRACKPOINT_ATTRIBUTES = [\n [\"heartRate\", \"heartRates\"],\n [\"Cadence\", \"cadences\"],\n // Extended Trackpoint attributes\n [\"Speed\", \"speeds\"],\n [\"Watts\", \"watts\"],\n];\nconst LAP_ATTRIBUTES = [\n [\"TotalTimeSeconds\", \"totalTimeSeconds\"],\n [\"DistanceMeters\", \"distanceMeters\"],\n [\"MaximumSpeed\", \"maxSpeed\"],\n [\"AverageHeartRateBpm\", \"avgHeartRate\"],\n [\"MaximumHeartRateBpm\", \"maxHeartRate\"],\n // Extended Lap attributes\n [\"AvgSpeed\", \"avgSpeed\"],\n [\"AvgWatts\", \"avgWatts\"],\n [\"MaxWatts\", \"maxWatts\"],\n];\nfunction getProperties(node, attributeNames) {\n const properties = [];\n for (const [tag, alias] of attributeNames) {\n let elem = get1(node, tag);\n if (!elem) {\n const elements = node.getElementsByTagNameNS(EXTENSIONS_NS, tag);\n if (elements.length) {\n elem = elements[0];\n }\n }\n const val = parseFloat(nodeVal(elem));\n if (!isNaN(val)) {\n properties.push([alias, val]);\n }\n }\n return properties;\n}\nfunction coordPair(node) {\n const ll = [num1(node, \"LongitudeDegrees\"), num1(node, \"LatitudeDegrees\")];\n if (ll[0] === undefined ||\n isNaN(ll[0]) ||\n ll[1] === undefined ||\n isNaN(ll[1])) {\n return null;\n }\n const heartRate = get1(node, \"HeartRateBpm\");\n const time = nodeVal(get1(node, \"Time\"));\n get1(node, \"AltitudeMeters\", (alt) => {\n const a = parseFloat(nodeVal(alt));\n if (!isNaN(a)) {\n ll.push(a);\n }\n });\n return {\n coordinates: ll,\n time: time || null,\n heartRate: heartRate ? parseFloat(nodeVal(heartRate)) : null,\n extensions: getProperties(node, TRACKPOINT_ATTRIBUTES),\n };\n}\nfunction getPoints(node) {\n const pts = $(node, \"Trackpoint\");\n const line = [];\n const times = [];\n const heartRates = [];\n if (pts.length < 2)\n return null; // Invalid line in GeoJSON\n const extendedProperties = {};\n const result = { extendedProperties };\n for (let i = 0; i < pts.length; i++) {\n const c = coordPair(pts[i]);\n if (c === null)\n continue;\n line.push(c.coordinates);\n const { time, heartRate, extensions } = c;\n if (time)\n times.push(time);\n if (heartRate)\n heartRates.push(heartRate);\n for (const [alias, value] of extensions) {\n if (!extendedProperties[alias]) {\n extendedProperties[alias] = Array(pts.length).fill(null);\n }\n extendedProperties[alias][i] = value;\n }\n }\n if (line.length < 2)\n return null;\n return Object.assign(result, {\n line: line,\n times: times,\n heartRates: heartRates,\n });\n}\nfunction getLap(node) {\n const segments = $(node, \"Track\");\n const track = [];\n const times = [];\n const heartRates = [];\n const allExtendedProperties = [];\n let line;\n const properties = Object.assign(Object.fromEntries(getProperties(node, LAP_ATTRIBUTES)), get(node, \"Name\", (nameElement) => {\n return { name: nodeVal(nameElement) };\n }));\n for (const segment of segments) {\n line = getPoints(segment);\n if (line) {\n track.push(line.line);\n if (line.times.length)\n times.push(line.times);\n if (line.heartRates.length)\n heartRates.push(line.heartRates);\n allExtendedProperties.push(line.extendedProperties);\n }\n }\n for (let i = 0; i < allExtendedProperties.length; i++) {\n const extendedProperties = allExtendedProperties[i];\n for (const property in extendedProperties) {\n if (segments.length === 1) {\n if (line) {\n properties[property] = line.extendedProperties[property];\n }\n }\n else {\n if (!properties[property]) {\n properties[property] = track.map((track) => Array(track.length).fill(null));\n }\n properties[property][i] = extendedProperties[property];\n }\n }\n }\n if (track.length === 0)\n return null;\n if (times.length || heartRates.length) {\n properties.coordinateProperties = Object.assign(times.length\n ? {\n times: track.length === 1 ? times[0] : times,\n }\n : {}, heartRates.length\n ? {\n heart: track.length === 1 ? heartRates[0] : heartRates,\n }\n : {});\n }\n return {\n type: \"Feature\",\n properties: properties,\n geometry: track.length === 1\n ? {\n type: \"LineString\",\n coordinates: track[0],\n }\n : {\n type: \"MultiLineString\",\n coordinates: track,\n },\n };\n}\n/**\n * Incrementally convert a TCX document to GeoJSON. The\n * first argument, `doc`, must be a TCX\n * document as an XML DOM - not as a string.\n */\nfunction* tcxGen(node) {\n for (const lap of $(node, \"Lap\")) {\n const feature = getLap(lap);\n if (feature)\n yield feature;\n }\n for (const course of $(node, \"Courses\")) {\n const feature = getLap(course);\n if (feature)\n yield feature;\n }\n}\n/**\n * Convert a TCX document to GeoJSON. The first argument, `doc`, must be a TCX\n * document as an XML DOM - not as a string.\n */\nfunction tcx(node) {\n return {\n type: \"FeatureCollection\",\n features: Array.from(tcxGen(node)),\n };\n}\n\nfunction fixColor(v, prefix) {\n const properties = {};\n const colorProp = prefix == \"stroke\" || prefix === \"fill\" ? prefix : prefix + \"-color\";\n if (v[0] === \"#\") {\n v = v.substring(1);\n }\n if (v.length === 6 || v.length === 3) {\n properties[colorProp] = \"#\" + v;\n }\n else if (v.length === 8) {\n properties[prefix + \"-opacity\"] = parseInt(v.substring(0, 2), 16) / 255;\n properties[colorProp] =\n \"#\" + v.substring(6, 8) + v.substring(4, 6) + v.substring(2, 4);\n }\n return properties;\n}\n\nfunction numericProperty(node, source, target) {\n const properties = {};\n num1(node, source, (val) => {\n properties[target] = val;\n });\n return properties;\n}\nfunction getColor(node, output) {\n return get(node, \"color\", (elem) => fixColor(nodeVal(elem), output));\n}\nfunction extractIconHref(node) {\n return get(node, \"Icon\", (icon, properties) => {\n val1(icon, \"href\", (href) => {\n properties.icon = href;\n });\n return properties;\n });\n}\nfunction extractIcon(node) {\n return get(node, \"IconStyle\", (iconStyle) => {\n return Object.assign(getColor(iconStyle, \"icon\"), numericProperty(iconStyle, \"scale\", \"icon-scale\"), numericProperty(iconStyle, \"heading\", \"icon-heading\"), get(iconStyle, \"hotSpot\", (hotspot) => {\n const left = parseFloat(hotspot.getAttribute(\"x\") || \"\");\n const top = parseFloat(hotspot.getAttribute(\"y\") || \"\");\n const xunits = hotspot.getAttribute(\"xunits\") || \"\";\n const yunits = hotspot.getAttribute(\"yunits\") || \"\";\n if (!isNaN(left) && !isNaN(top))\n return {\n \"icon-offset\": [left, top],\n \"icon-offset-units\": [xunits, yunits],\n };\n return {};\n }), extractIconHref(iconStyle));\n });\n}\nfunction extractLabel(node) {\n return get(node, \"LabelStyle\", (labelStyle) => {\n return Object.assign(getColor(labelStyle, \"label\"), numericProperty(labelStyle, \"scale\", \"label-scale\"));\n });\n}\nfunction extractLine(node) {\n return get(node, \"LineStyle\", (lineStyle) => {\n return Object.assign(getColor(lineStyle, \"stroke\"), numericProperty(lineStyle, \"width\", \"stroke-width\"));\n });\n}\nfunction extractPoly(node) {\n return get(node, \"PolyStyle\", (polyStyle, properties) => {\n return Object.assign(properties, get(polyStyle, \"color\", (elem) => fixColor(nodeVal(elem), \"fill\")), val1(polyStyle, \"fill\", (fill) => {\n if (fill === \"0\")\n return { \"fill-opacity\": 0 };\n }), val1(polyStyle, \"outline\", (outline) => {\n if (outline === \"0\")\n return { \"stroke-opacity\": 0 };\n }));\n });\n}\nfunction extractStyle(node) {\n return Object.assign({}, extractPoly(node), extractLine(node), extractLabel(node), extractIcon(node));\n}\n\nconst toNumber = (x) => Number(x);\nconst typeConverters = {\n string: (x) => x,\n int: toNumber,\n uint: toNumber,\n short: toNumber,\n ushort: toNumber,\n float: toNumber,\n double: toNumber,\n bool: (x) => Boolean(x),\n};\nfunction extractExtendedData(node, schema) {\n return get(node, \"ExtendedData\", (extendedData, properties) => {\n for (const data of $(extendedData, \"Data\")) {\n properties[data.getAttribute(\"name\") || \"\"] = nodeVal(get1(data, \"value\"));\n }\n for (const simpleData of $(extendedData, \"SimpleData\")) {\n const name = simpleData.getAttribute(\"name\") || \"\";\n const typeConverter = schema[name] || typeConverters.string;\n properties[name] = typeConverter(nodeVal(simpleData));\n }\n return properties;\n });\n}\nfunction getMaybeHTMLDescription(node) {\n const descriptionNode = get1(node, \"description\");\n for (const c of Array.from(descriptionNode?.childNodes || [])) {\n if (c.nodeType === 4) {\n return {\n description: {\n \"@type\": \"html\",\n value: nodeVal(c),\n },\n };\n }\n }\n return {};\n}\nfunction extractTimeSpan(node) {\n return get(node, \"TimeSpan\", (timeSpan) => {\n return {\n timespan: {\n begin: nodeVal(get1(timeSpan, \"begin\")),\n end: nodeVal(get1(timeSpan, \"end\")),\n },\n };\n });\n}\nfunction extractTimeStamp(node) {\n return get(node, \"TimeStamp\", (timeStamp) => {\n return { timestamp: nodeVal(get1(timeStamp, \"when\")) };\n });\n}\nfunction extractCascadedStyle(node, styleMap) {\n return val1(node, \"styleUrl\", (styleUrl) => {\n styleUrl = normalizeId(styleUrl);\n if (styleMap[styleUrl]) {\n return Object.assign({ styleUrl }, styleMap[styleUrl]);\n }\n // For backward-compatibility. Should we still include\n // styleUrl even if it's not resolved?\n return { styleUrl };\n });\n}\n\nconst removeSpace = /\\s*/g;\nconst trimSpace = /^\\s*|\\s*$/g;\nconst splitSpace = /\\s+/;\n/**\n * Get one coordinate from a coordinate array, if any\n */\nfunction coord1(value) {\n return value\n .replace(removeSpace, \"\")\n .split(\",\")\n .map(parseFloat)\n .filter((num) => !isNaN(num))\n .slice(0, 3);\n}\n/**\n * Get all coordinates from a coordinate array as [[],[]]\n */\nfunction coord(value) {\n return value\n .replace(trimSpace, \"\")\n .split(splitSpace)\n .map(coord1)\n .filter((coord) => {\n return coord.length >= 2;\n });\n}\nfunction gxCoords(node) {\n let elems = $(node, \"coord\");\n if (elems.length === 0) {\n elems = $ns(node, \"coord\", \"*\");\n }\n const coordinates = elems.map((elem) => {\n return nodeVal(elem).split(\" \").map(parseFloat);\n });\n if (coordinates.length === 0) {\n return null;\n }\n return {\n geometry: coordinates.length > 2\n ? {\n type: \"LineString\",\n coordinates,\n }\n : {\n type: \"Point\",\n coordinates: coordinates[0],\n },\n times: $(node, \"when\").map((elem) => nodeVal(elem)),\n };\n}\nfunction fixRing(ring) {\n if (ring.length === 0)\n return ring;\n const first = ring[0];\n const last = ring[ring.length - 1];\n let equal = true;\n for (let i = 0; i < Math.max(first.length, last.length); i++) {\n if (first[i] !== last[i]) {\n equal = false;\n break;\n }\n }\n if (!equal) {\n return ring.concat([ring[0]]);\n }\n return ring;\n}\nfunction getCoordinates(node) {\n return nodeVal(get1(node, \"coordinates\"));\n}\nfunction getGeometry(node) {\n let geometries = [];\n let coordTimes = [];\n for (let i = 0; i < node.childNodes.length; i++) {\n const child = node.childNodes.item(i);\n if (isElement(child)) {\n switch (child.tagName) {\n case \"MultiGeometry\":\n case \"MultiTrack\":\n case \"gx:MultiTrack\": {\n const childGeometries = getGeometry(child);\n geometries = geometries.concat(childGeometries.geometries);\n coordTimes = coordTimes.concat(childGeometries.coordTimes);\n break;\n }\n case \"Point\": {\n const coordinates = coord1(getCoordinates(child));\n if (coordinates.length >= 2) {\n geometries.push({\n type: \"Point\",\n coordinates,\n });\n }\n break;\n }\n case \"LineString\": {\n const coordinates = coord(getCoordinates(child));\n if (coordinates.length >= 2) {\n geometries.push({\n type: \"LineString\",\n coordinates,\n });\n }\n break;\n }\n case \"Polygon\": {\n const coords = [];\n for (const linearRing of $(child, \"LinearRing\")) {\n const ring = fixRing(coord(getCoordinates(linearRing)));\n if (ring.length >= 4) {\n coords.push(ring);\n }\n }\n if (coords.length) {\n geometries.push({\n type: \"Polygon\",\n coordinates: coords,\n });\n }\n break;\n }\n case \"Track\":\n case \"gx:Track\": {\n const gx = gxCoords(child);\n if (!gx)\n break;\n const { times, geometry } = gx;\n geometries.push(geometry);\n if (times.length)\n coordTimes.push(times);\n break;\n }\n }\n }\n }\n return {\n geometries,\n coordTimes,\n };\n}\n\nfunction geometryListToGeometry(geometries) {\n return geometries.length === 0\n ? null\n : geometries.length === 1\n ? geometries[0]\n : {\n type: \"GeometryCollection\",\n geometries,\n };\n}\nfunction getPlacemark(node, styleMap, schema) {\n const { coordTimes, geometries } = getGeometry(node);\n const feature = {\n type: \"Feature\",\n geometry: geometryListToGeometry(geometries),\n properties: Object.assign(getMulti(node, [\n \"name\",\n \"address\",\n \"visibility\",\n \"open\",\n \"phoneNumber\",\n \"description\",\n ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node), coordTimes.length\n ? {\n coordinateProperties: {\n times: coordTimes.length === 1 ? coordTimes[0] : coordTimes,\n },\n }\n : {}),\n };\n if (feature.properties?.visibility !== undefined) {\n feature.properties.visibility = feature.properties.visibility !== \"0\";\n }\n const id = node.getAttribute(\"id\");\n if (id !== null && id !== \"\")\n feature.id = id;\n return feature;\n}\n\nfunction getGroundOverlayBox(node) {\n const latLonQuad = get1(node, \"gx:LatLonQuad\");\n if (latLonQuad) {\n const ring = fixRing(coord(getCoordinates(node)));\n return {\n type: \"Polygon\",\n coordinates: [ring],\n };\n }\n return getLatLonBox(node);\n}\nconst DEGREES_TO_RADIANS = Math.PI / 180;\nfunction rotateBox(bbox, coordinates, rotation) {\n const center = [(bbox[0] + bbox[2]) / 2, (bbox[1] + bbox[3]) / 2];\n return [\n coordinates[0].map((coordinate) => {\n const dy = coordinate[1] - center[1];\n const dx = coordinate[0] - center[0];\n const distance = Math.sqrt(Math.pow(dy, 2) + Math.pow(dx, 2));\n const angle = Math.atan2(dy, dx) - rotation * DEGREES_TO_RADIANS;\n return [\n center[0] + Math.cos(angle) * distance,\n center[1] + Math.sin(angle) * distance,\n ];\n }),\n ];\n}\nfunction getLatLonBox(node) {\n const latLonBox = get1(node, \"LatLonBox\");\n if (latLonBox) {\n const north = num1(latLonBox, \"north\");\n const west = num1(latLonBox, \"west\");\n const east = num1(latLonBox, \"east\");\n const south = num1(latLonBox, \"south\");\n const rotation = num1(latLonBox, \"rotation\");\n if (typeof north === \"number\" &&\n typeof south === \"number\" &&\n typeof west === \"number\" &&\n typeof east === \"number\") {\n const bbox = [west, south, east, north];\n let coordinates = [\n [\n [west, north],\n [east, north],\n [east, south],\n [west, south],\n [west, north], // top left (again)\n ],\n ];\n if (typeof rotation === \"number\") {\n coordinates = rotateBox(bbox, coordinates, rotation);\n }\n return {\n type: \"Polygon\",\n coordinates,\n };\n }\n }\n return null;\n}\nfunction getGroundOverlay(node, styleMap, schema) {\n const geometry = getGroundOverlayBox(node);\n const feature = {\n type: \"Feature\",\n geometry,\n properties: Object.assign(\n /**\n * Related to\n * https://gist.github.com/tmcw/037a1cb6660d74a392e9da7446540f46\n */\n { \"@geometry-type\": \"groundoverlay\" }, getMulti(node, [\n \"name\",\n \"address\",\n \"visibility\",\n \"open\",\n \"phoneNumber\",\n \"description\",\n ]), getMaybeHTMLDescription(node), extractCascadedStyle(node, styleMap), extractStyle(node), extractIconHref(node), extractExtendedData(node, schema), extractTimeSpan(node), extractTimeStamp(node)),\n };\n if (feature.properties?.visibility !== undefined) {\n feature.properties.visibility = feature.properties.visibility !== \"0\";\n }\n const id = node.getAttribute(\"id\");\n if (id !== null && id !== \"\")\n feature.id = id;\n return feature;\n}\n\nfunction getStyleId(style) {\n let id = style.getAttribute(\"id\");\n const parentNode = style.parentNode;\n if (!id &&\n isElement(parentNode) &&\n parentNode.localName === \"CascadingStyle\") {\n id = parentNode.getAttribute(\"kml:id\") || parentNode.getAttribute(\"id\");\n }\n return normalizeId(id || \"\");\n}\nfunction buildStyleMap(node) {\n const styleMap = {};\n for (const style of $(node, \"Style\")) {\n styleMap[getStyleId(style)] = extractStyle(style);\n }\n for (const map of $(node, \"StyleMap\")) {\n const id = normalizeId(map.getAttribute(\"id\") || \"\");\n val1(map, \"styleUrl\", (styleUrl) => {\n styleUrl = normalizeId(styleUrl);\n if (styleMap[styleUrl]) {\n styleMap[id] = styleMap[styleUrl];\n }\n });\n }\n return styleMap;\n}\nfunction buildSchema(node) {\n const schema = {};\n for (const field of $(node, \"SimpleField\")) {\n schema[field.getAttribute(\"name\") || \"\"] =\n typeConverters[field.getAttribute(\"type\") || \"\"] ||\n typeConverters[\"string\"];\n }\n return schema;\n}\nconst FOLDER_PROPS = [\n \"name\",\n \"visibility\",\n \"open\",\n \"address\",\n \"description\",\n \"phoneNumber\",\n \"visibility\",\n];\nfunction getFolder(node) {\n const meta = {};\n for (const child of Array.from(node.childNodes)) {\n if (isElement(child) && FOLDER_PROPS.includes(child.tagName)) {\n meta[child.tagName] = nodeVal(child);\n }\n }\n return {\n type: \"folder\",\n meta,\n children: [],\n };\n}\n/**\n * Yield a nested tree with KML folder structure\n *\n * This generates a tree with the given structure:\n *\n * ```js\n * {\n * \"type\": \"root\",\n * \"children\": [\n * {\n * \"type\": \"folder\",\n * \"meta\": {\n * \"name\": \"Test\"\n * },\n * \"children\": [\n * // ...features and folders\n * ]\n * }\n * // ...features\n * ]\n * }\n * ```\n *\n * ### GroundOverlay\n *\n * GroundOverlay elements are converted into\n * `Feature` objects with `Polygon` geometries,\n * a property like:\n *\n * ```json\n * {\n * \"@geometry-type\": \"groundoverlay\"\n * }\n * ```\n *\n * And the ground overlay's image URL in the `href`\n * property. Ground overlays will need to be displayed\n * with a separate method to other features, depending\n * on which map framework you're using.\n */\nfunction kmlWithFolders(node) {\n const styleMap = buildStyleMap(node);\n const schema = buildSchema(node);\n const tree = { type: \"root\", children: [] };\n function traverse(node, pointer) {\n if (isElement(node)) {\n switch (node.tagName) {\n case \"GroundOverlay\": {\n const placemark = getGroundOverlay(node, styleMap, schema);\n if (placemark) {\n pointer.children.push(placemark);\n }\n break;\n }\n case \"Placemark\": {\n const placemark = getPlacemark(node, styleMap, schema);\n if (placemark) {\n pointer.children.push(placemark);\n }\n break;\n }\n case \"Folder\": {\n const folder = getFolder(node);\n pointer.children.push(folder);\n pointer = folder;\n break;\n }\n }\n }\n if (node.childNodes) {\n for (let i = 0; i < node.childNodes.length; i++) {\n traverse(node.childNodes[i], pointer);\n }\n }\n }\n traverse(node, tree);\n return tree;\n}\n/**\n * Convert KML to GeoJSON incrementally, returning\n * a [Generator](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators)\n * that yields output feature by feature.\n */\nfunction* kmlGen(node) {\n const styleMap = buildStyleMap(node);\n const schema = buildSchema(node);\n for (const placemark of $(node, \"Placemark\")) {\n const feature = getPlacemark(placemark, styleMap, schema);\n if (feature)\n yield feature;\n }\n for (const groundOverlay of $(node, \"GroundOverlay\")) {\n const feature = getGroundOverlay(groundOverlay, styleMap, schema);\n if (feature)\n yield feature;\n }\n}\n/**\n * Convert a KML document to GeoJSON. The first argument, `doc`, must be a KML\n * document as an XML DOM - not as a string. You can get this using jQuery's default\n * `.ajax` function or using a bare XMLHttpRequest with the `.response` property\n * holding an XML DOM.\n *\n * The output is a JavaScript object of GeoJSON data. You can convert it to a string\n * with [JSON.stringify](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify)\n * or use it directly in libraries.\n */\nfunction kml(node) {\n return {\n type: \"FeatureCollection\",\n features: Array.from(kmlGen(node)),\n };\n}\n\nexport { gpx, gpxGen, kml, kmlGen, kmlWithFolders, tcx, tcxGen };\n//# sourceMappingURL=togeojson.es.mjs.map\n"],"names":["extendStatics","__extends","this","d","b","Object","setPrototypeOf","__proto__","Array","p","prototype","hasOwnProperty","call","TypeError","String","__","constructor","create","__createBinding","o","m","k","k2","undefined","desc","getOwnPropertyDescriptor","__esModule","writable","configurable","enumerable","get","defineProperty","__setModuleDefault","v","value","__importStar","mod","result","__spreadArray","to","from","pack","arguments","length","ar","i","l","slice","concat","exports","React","utils_1","types_1","INCREASE_KEYS","DECREASE_KEYS","Range","_super","props","_this","trackRef","createRef","thumbRefs","markRefs","state","draggedTrackPos","draggedThumbIndex","thumbZIndexes","values","fill","map","t","isChanged","markOffsets","getOffsets","_a","direction","min","max","trackElement","current","trackRect","getBoundingClientRect","trackPadding","getPaddingAndBorder","getThumbs","thumb","index","thumbOffsets","x","y","thumbRect","thumbMargins","getMargin","Direction","Right","left","height","top","width","relativeValue","Left","right","Up","Down","assertUnreachable","children","filter","el","hasAttribute","console","warn","getTargetIndex","e","findIndex","child","target","contains","addTouchEvents","document","addEventListener","schdOnTouchMove","passive","schdOnEnd","addMouseEvents","schdOnMouseMove","onMouseDownTrack","button","persist","preventDefault","nativeEvent","draggableTrack","some","thumbRef","setState","clientX","clientY","onMove","getClosestThumbIndex","focus","onResize","translateThumbs","rtl","calculateMarkOffsets","onTouchStartTrack","touches","onMouseOrTouchStart","disabled","isTouch","isTouchEvent","Math","apply","onMouseMove","onTouchMove","onKeyDown","onChange","step","inverter","includes","key","replaceAt","normalizeValue","fireOnFinalChange","onKeyUp","_b","trackLength","isVertical","dX","dY","deltaValue","abs","sign","thumbValue","newValues","newValue","allowOverlap","onEnd","removeEventListener","onFinalChange","renderMark","elStyles","window","getComputedStyle","trackWidth","parseInt","trackHeight","paddingLeft","paddingTop","res","numOfMarks","markHeight","markWidth","markRect","push","round","Error","schd","componentDidMount","resizeObserver","ResizeObserver","observe","unobserve","checkInitialOverlap","forEach","checkBoundaries","isStepDivisible","componentDidUpdate","prevProps","prevState","componentWillUnmount","render","renderTrack","renderThumb","_c","style","transform","cursor","onMouseDown","voidFn","onTouchStart","ref","isDragged","offset","arr","position","marginTop","marginLeft","zIndex","userSelect","touchAction","WebkitUserSelect","MozUserSelect","msUserSelect","tabIndex","draggable","role","defaultProps","Component","__importDefault","checkValuesAgainstBoundaries","useThumbOverlap","getTrackBackground","Range_1","default","translate","getStepDecimals","react_1","element","decimals","toString","split","event","changedTouches","roundedRes","Number","toFixed","BIG_NUM","prev","next","remainder","floor","closestLowerNum","rounded","decimalPlaces","parseFloat","RangeError","every","item","bottom","elements","offsets","thumbs","thumbIndex","minThumbDistance","getThumbDistance","thumbDistance","fn","lastArgs","frameId","args","_i","requestAnimationFrame","ret","colors","middle","sort","a","reduce","acc","point","getThumbWidth","thumbEl","separator","valueToLabel","ceil","elWidth","innerText","childElementCount","elClone","cloneNode","innerHTML","visibility","body","appendChild","removeChild","rangeRef","useState","labelStyle","setLabelStyle","labelValue","setLabelValue","useEffect","newStyle","offsets_1","overlaps","buildOverlaps","thumbXWidth","thumbX","siblingIndex","siblingX","siblingWidth","Set","getOverlaps","labelValue_1","offsetsX","c","s","labelValues_1","join","first","last","lastWidth","indexOf","$","tagName","getElementsByTagName","normalizeId","id","nodeVal","node","normalize","textContent","get1","callback","n","properties","val1","val","num1","isNaN","getMulti","propertyNames","property","isElement","nodeType","fixColor","prefix","colorProp","substring","numericProperty","source","getColor","output","elem","extractIconHref","icon","href","extractStyle","assign","polyStyle","outline","extractPoly","lineStyle","extractLine","extractLabel","iconStyle","hotspot","getAttribute","xunits","yunits","extractIcon","toNumber","typeConverters","string","int","uint","short","ushort","float","double","bool","Boolean","extractExtendedData","schema","extendedData","data","simpleData","name","typeConverter","getMaybeHTMLDescription","descriptionNode","childNodes","description","extractTimeSpan","timeSpan","timespan","begin","end","extractTimeStamp","timeStamp","timestamp","extractCascadedStyle","styleMap","styleUrl","removeSpace","trimSpace","splitSpace","coord1","replace","num","coord","gxCoords","elems","ns","getElementsByTagNameNS","coordinates","geometry","type","times","fixRing","ring","equal","getCoordinates","getGeometry","geometries","coordTimes","childGeometries","coords","linearRing","gx","geometryListToGeometry","getPlacemark","feature","coordinateProperties","getGroundOverlayBox","latLonBox","north","west","east","south","rotation","bbox","center","coordinate","dy","dx","distance","sqrt","pow","angle","atan2","DEGREES_TO_RADIANS","cos","sin","rotateBox","getLatLonBox","PI","getGroundOverlay","getStyleId","parentNode","localName","buildStyleMap","buildSchema","field","kmlGen","placemark","groundOverlay","kml","features"],"sourceRoot":""}