{
  "version": 3,
  "sources": ["route_cursor_map_core.js"],
  "sourcesContent": ["/*\n * static/js/route_cursor_map_core.js \u2014 the route cursor, placed on the map\n * (SNOW-1019).\n *\n * The route cursor (route_cursor_core.js) is one sample index, shared by\n * the map, the route panel and the point card. The panel draws\n * it by share along its own x-axis; the map draws it in GEOGRAPHY, from\n * the boundary points the slope record already carries:\n *\n *     properties.slope = { points: [[lon, lat], \u2026],   // N + 1\n *                          angles: [ \u2026 ] }             // N\n *\n * Segment i runs from points[i] to points[i + 1], and the cursor index i\n * is drawn at the middle of its segment. Since SNOW-1053 a segment follows\n * the route's own coordinates between the two (`seams`, and\n * `pwaRouteSlopeCore.segmentPaths`), so its middle is the point HALF WAY\n * ALONG that path rather than the average of its ends \u2014 which, on a bend,\n * is off the line the dot is meant to sit on. Without `seams`, or with no\n * slope core loaded, it is the average of the ends, as before. Going the other way, a pointer on the map is\n * converted to the sample whose segment middle is nearest on SCREEN,\n * which is the question a reader's pointer asks: \"which bit of line am I\n * on\", in the pixels they can see.\n *\n * A route with no slope record \u2014 never sampled \u2014 has no sample axis of\n * its own, and every slope function here answers null for it rather than\n * guessing a position. `shareMidpoints` is the one exception: the panel\n * still gives such a route a cursor, sized from its legs and drawn by\n * share of the distance, and the map matches it by share of the line.\n *\n * Pure: no DOM, no map, and one global read \u2014 `cursorPoint` looks the\n * segment's colour, and both it and `segmentMidpoints` the segment's path,\n * up in `self.pwaRouteSlopeCore` when called, never at parse time. map.js projects the midpoints (`map.project`) and hands\n * the pixels in.\n *\n * ## The dot is the colour of the ground under it (SNOW-1052)\n *\n * The cursor's feature carries `colour`: the hex of its segment's slope\n * class, `pwaRouteSlopeCore.CLASSES[classify(angle)].hex`, which mirrors\n * the `--color-slope-*` token the map's z14 slope line draws that segment\n * in \u2014 so the dot and the line under it are one colour. A\n * segment the terrain had no answer for takes `UNKNOWN_COLOUR`, as the\n * line does. With no slope core loaded it carries no `colour`, and map.js\n * falls back to the route's own colour.\n *\n * ## From z14 the cursor IS its segment (SNOW-1145)\n *\n * The point card describes one segment, 25 m of track, and from\n * ROUTE_SLOPE_MINZOOM the map draws the cursor as exactly that segment:\n * `cursorSegment` is the segment's own path, the one the slope line draws\n * it along, in its class colour. Two consecutive indices share a boundary\n * point, so their segments meet end to end with neither gap nor overlap,\n * and the reader can see where the segment the card is about starts and\n * stops. Below z14 the line is drawn in legs, a segment is a few pixels,\n * and the dot stays. This is not the highlighted run SNOW-1052\n * removed (`selectionLine`, a rail selection of many segments): it is the\n * one segment the cursor is on.\n *\n * Exports (frozen `self.pwaRouteCursorMapCore`):\n *\n *   sampleCount(slope)                   \u2192 N, or 0 with no usable record\n *   cursorPoint(slope, index, coords)    \u2192 Point Feature, or null; its\n *                                          `colour` is the segment's class\n *   cursorSegment(slope, index, coords)  \u2192 LineString Feature along the\n *                                          segment's path, or null\n *   segmentMidpoints(slope, coords)      \u2192 [[lon, lat]] per segment\n *   shareMidpoints(coords, count)        \u2192 [[lon, lat]] per equal share\n *   lineBounds(coords)                   \u2192 [w, s, e, n]; the bullseye's frame\n *   centreTarget(point, coords)          \u2192 where \"Zoom to point\" aims\n *   columnRect(canvas, column, topInset) \u2192 the map a desktop column leaves\n *   centreOffset(canvas, rect, padding)  \u2192 the easeTo offset to rect's middle\n *                                          of the line, for a route with\n *                                          no slope record\n *   nearestSample(midpointsPx, px, maxPx) \u2192 the nearest index, or null\n *   legAt(legs, index)                   \u2192 the leg holding an index, or null\n *   visibleRect(canvas, railTop, topInset) \u2192 the map the rails leave visible\n *   isInside(point, rect)                \u2192 whether a point is in a rect\n *   isVisible(point, rect, covers)       \u2192 in rect and under none of covers\n *   panOffset(point, rect, margin)       \u2192 the pan that brings it in, or null\n *\n * ## The visible map (SNOW-1019)\n *\n * On a phone, with a leg open, the rails cover the bottom two-thirds of\n * the map, and the cursor's dot can land behind them. The map that is\n * actually visible is the canvas above the rail's top edge and below the\n * top chrome. `panOffset` answers how far to pan so the dot is back\n * inside it, `margin` px in from every edge \u2014 in `panBy`'s own sign: a\n * dot below the rail's top gives a POSITIVE y, which moves the view down\n * the map and the dot up the screen.\n */\n\n// @ts-check\n\n(function () {\n  'use strict';\n\n  /**\n   * @typedef {{points?: Array<Array<number>>, angles?: Array<?number>,\n   *   seams?: Array<number>}} Slope\n   *   The slope record off a route feature, already parsed. `seams`\n   *   (SNOW-1053) index each boundary into the feature's coordinates.\n   */\n\n  /**\n   * @typedef {{type: 'Feature', geometry: {type: string,\n   *   coordinates: Array<*>}, properties: Object<string, *>}} Feature\n   */\n\n  /**\n   * Whether a value is a usable [lon, lat] pair.\n   *\n   * @param {*} point\n   * @returns {boolean}\n   */\n  function isPoint(point) {\n    return Array.isArray(point)\n      && point.length >= 2\n      && Number.isFinite(point[0])\n      && Number.isFinite(point[1]);\n  }\n\n  /**\n   * How many segments a slope record draws: one fewer than its points.\n   *\n   * @param {?Slope} slope\n   * @returns {number} 0 when there is no record or it has under two points.\n   */\n  function sampleCount(slope) {\n    if (!slope || !Array.isArray(slope.points)) return 0;\n    return Math.max(0, slope.points.length - 1);\n  }\n\n  /**\n   * The point a given share of the way along a path, by length.\n   *\n   * Planar, with longitude scaled by the cosine of the latitude so a\n   * degree east and a degree north weigh what they measure on the ground:\n   * a segment is about 25 m, far too short for the curve of a meridian to\n   * matter. A path with no length answers its first point.\n   *\n   * @param {Array<Array<number>>} path Usable [lon, lat] points, two or more.\n   * @param {number} share How far along, 0 (the start) to 1 (the end).\n   * @returns {Array<number>} The [lon, lat] that far along it.\n   */\n  function along(path, share) {\n    const scale = Math.cos((path[0][1] * Math.PI) / 180);\n    /** @type {Array<number>} */\n    const lengths = [];\n    let total = 0;\n    for (let i = 1; i < path.length; i += 1) {\n      const dx = (path[i][0] - path[i - 1][0]) * scale;\n      const dy = path[i][1] - path[i - 1][1];\n      const length = Math.hypot(dx, dy);\n      lengths.push(length);\n      total += length;\n    }\n    if (!(total > 0)) return [path[0][0], path[0][1]];\n    let remaining = total * share;\n    for (let i = 0; i < lengths.length; i += 1) {\n      if (remaining <= lengths[i] && lengths[i] > 0) {\n        const t = remaining / lengths[i];\n        const a = path[i];\n        const b = path[i + 1];\n        return [a[0] + (b[0] - a[0]) * t, a[1] + (b[1] - a[1]) * t];\n      }\n      remaining -= lengths[i];\n    }\n    const last = path[path.length - 1];\n    return [last[0], last[1]];\n  }\n\n  /**\n   * The point half way along a path, by length.\n   *\n   * @param {Array<Array<number>>} path Usable [lon, lat] points, two or more.\n   * @returns {Array<number>} The [lon, lat] half way along it.\n   */\n  function halfway(path) {\n    return along(path, 0.5);\n  }\n\n  /**\n   * The middle of each of `count` equal shares of a line, in [lon, lat].\n   *\n   * For a route with no slope record (never sampled, 2026-10-02): its\n   * cursor still runs over `count` segments, sized from its legs, and the\n   * panel places segment i at (i + 0.5) / count of the profile's width \u2014\n   * a share of the distance. Placing the same share along the line is the\n   * map's matching guess, so a tap on the line lands on the index the\n   * panel draws at that place.\n   *\n   * @param {*} coordinates The feature's `geometry.coordinates`.\n   * @param {number} count How many segments the cursor runs over.\n   * @returns {Array<Array<number>>} One per segment; empty with no usable\n   *   line or no count.\n   */\n  function shareMidpoints(coordinates, count) {\n    if (!Array.isArray(coordinates) || !Number.isInteger(count) || count < 1) return [];\n    const path = coordinates.filter(isPoint);\n    if (path.length < 2) return [];\n    /** @type {Array<Array<number>>} */\n    const out = [];\n    for (let i = 0; i < count; i += 1) out.push(along(path, (i + 0.5) / count));\n    return out;\n  }\n\n  /**\n   * The path each segment is drawn along, or null to use the chord.\n   *\n   * @param {?Slope} slope\n   * @param {*} coordinates The feature's `geometry.coordinates`, if any.\n   * @returns {?Array<Array<Array<number>>>} One path per segment from\n   *   `pwaRouteSlopeCore.segmentPaths`, or null with no core loaded.\n   */\n  function segmentPathsOf(slope, coordinates) {\n    const slopeCore = self.pwaRouteSlopeCore;\n    if (!slopeCore || typeof slopeCore.segmentPaths !== 'function') return null;\n    return slopeCore.segmentPaths(slope, coordinates);\n  }\n\n  /**\n   * The middle of one segment, in [lon, lat].\n   *\n   * Half way along its path where there is one, every point of it\n   * usable; the average of its two ends otherwise.\n   *\n   * @param {Array<*>} points The record's boundary points.\n   * @param {number} index The segment.\n   * @param {?Array<Array<Array<number>>>} paths Every segment's path, or\n   *   null for the chord.\n   * @returns {?Array<number>} Null where either end is not a usable point.\n   */\n  function midpointOf(points, index, paths) {\n    const a = points[index];\n    const b = points[index + 1];\n    if (!isPoint(a) || !isPoint(b)) return null;\n    const path = paths ? paths[index] : null;\n    if (Array.isArray(path) && path.length >= 2 && path.every(isPoint)) {\n      return halfway(path);\n    }\n    return [(a[0] + b[0]) / 2, (a[1] + b[1]) / 2];\n  }\n\n  /**\n   * The middle of each segment, in [lon, lat].\n   *\n   * Half way along the segment's path when `coordinates` and the record's\n   * `seams` place it on the track (SNOW-1053); the average of its two ends\n   * otherwise \u2014 the chord the segment is then drawn as.\n   *\n   * @param {?Slope} slope\n   * @param {*} [coordinates] The feature's `geometry.coordinates`.\n   * @returns {Array<?Array<number>>} One per segment; null where either end\n   *   is not a usable point.\n   */\n  function segmentMidpoints(slope, coordinates) {\n    const count = sampleCount(slope);\n    if (!count || !slope || !slope.points) return [];\n    const points = slope.points;\n    const paths = segmentPathsOf(slope, coordinates);\n    /** @type {Array<?Array<number>>} */\n    const out = [];\n    for (let i = 0; i < count; i += 1) out.push(midpointOf(points, i, paths));\n    return out;\n  }\n\n  /**\n   * The hex a segment is drawn in: its slope class's, or the unknown grey.\n   *\n   * @param {?Slope} slope\n   * @param {number} index\n   * @returns {?string} Null when no slope core is loaded.\n   */\n  function segmentColour(slope, index) {\n    const slopeCore = self.pwaRouteSlopeCore;\n    if (!slopeCore || !Array.isArray(slopeCore.CLASSES)) return null;\n    const angle = slope && Array.isArray(slope.angles) ? slope.angles[index] : null;\n    const classIndex = slopeCore.classify(angle);\n    if (classIndex === null) return slopeCore.UNKNOWN_COLOUR || null;\n    const entry = slopeCore.CLASSES[classIndex];\n    return entry && typeof entry.hex === 'string' ? entry.hex : null;\n  }\n\n  /**\n   * Where the cursor index sits: the middle of its segment, in its colour.\n   *\n   * @param {?Slope} slope\n   * @param {?number} index\n   * @param {*} [coordinates] The feature's `geometry.coordinates`, so the\n   *   dot sits on the path the segment is drawn along (SNOW-1053).\n   * @returns {?Feature} Null for a null index, no record, or an index\n   *   outside the route.\n   */\n  function cursorPoint(slope, index, coordinates) {\n    const count = sampleCount(slope);\n    if (index === null || !Number.isInteger(index) || !count) return null;\n    if (index < 0 || index >= count || !slope || !slope.points) return null;\n    const middle = midpointOf(slope.points, index, segmentPathsOf(slope, coordinates));\n    if (!middle) return null;\n    /** @type {Object<string, *>} */\n    const properties = { index: index };\n    const colour = segmentColour(slope, index);\n    if (colour) properties.colour = colour;\n    return {\n      type: 'Feature',\n      geometry: { type: 'Point', coordinates: middle },\n      properties: properties,\n    };\n  }\n\n  /**\n   * The cursor's segment as a line: its own path, in its colour (SNOW-1145).\n   *\n   * The path the slope line draws the segment along where the record's\n   * `seams` place it on the track, every point of it usable; the chord\n   * between its two ends otherwise, as the line is then drawn. Segment i\n   * ends on `points[i + 1]` and segment i + 1 starts on it, so the\n   * features for two consecutive indices meet end to end.\n   *\n   * @param {?Slope} slope\n   * @param {?number} index\n   * @param {*} [coordinates] The feature's `geometry.coordinates`.\n   * @returns {?Feature} Null for a null index, no record, an index outside\n   *   the route, or an end that is not a usable point.\n   */\n  function cursorSegment(slope, index, coordinates) {\n    const count = sampleCount(slope);\n    if (index === null || !Number.isInteger(index) || !count) return null;\n    if (index < 0 || index >= count || !slope || !slope.points) return null;\n    const a = slope.points[index];\n    const b = slope.points[index + 1];\n    if (!isPoint(a) || !isPoint(b)) return null;\n    const paths = segmentPathsOf(slope, coordinates);\n    const path = paths ? paths[index] : null;\n    const line = Array.isArray(path) && path.length >= 2 && path.every(isPoint)\n      ? path.map((p) => [p[0], p[1]])\n      : [[a[0], a[1]], [b[0], b[1]]];\n    /** @type {Object<string, *>} */\n    const properties = { index: index };\n    const colour = segmentColour(slope, index);\n    if (colour) properties.colour = colour;\n    return {\n      type: 'Feature',\n      geometry: { type: 'LineString', coordinates: line },\n      properties: properties,\n    };\n  }\n\n  /**\n   * The sample whose segment middle is nearest a screen point.\n   *\n   * @param {Array<?{x: number, y: number}>} midpointsPx Each segment's\n   *   middle, projected to screen pixels; null for one with no position.\n   * @param {{x: number, y: number}} px The pointer.\n   * @param {number} [maxPx] Beyond this distance nothing is near. Defaults\n   *   to no limit.\n   * @returns {?number} The index, or null when nothing is within `maxPx`.\n   */\n  function nearestSample(midpointsPx, px, maxPx) {\n    if (!Array.isArray(midpointsPx) || !px) return null;\n    const limit = maxPx === undefined ? Infinity : maxPx;\n    let best = null;\n    let bestDistance = Infinity;\n    for (let i = 0; i < midpointsPx.length; i += 1) {\n      const m = midpointsPx[i];\n      if (!m || !Number.isFinite(m.x) || !Number.isFinite(m.y)) continue;\n      const distance = Math.hypot(m.x - px.x, m.y - px.y);\n      if (distance < bestDistance) {\n        best = i;\n        bestDistance = distance;\n      }\n    }\n    return best !== null && bestDistance <= limit ? best : null;\n  }\n\n  /**\n   * The leg holding a sample index.\n   *\n   * @template {{from: number, to: number}} L\n   * @param {?Array<L>} legs A route's legs, in sample indices.\n   * @param {?number} index\n   * @returns {?L}\n   */\n  function legAt(legs, index) {\n    if (!Array.isArray(legs) || index === null || !Number.isInteger(index)) return null;\n    return legs.find((leg) => leg && index >= leg.from && index <= leg.to) || null;\n  }\n\n  /**\n   * @typedef {{left: number, top: number, right: number, bottom: number}} Rect\n   */\n\n  /**\n   * The part of the map canvas the rail and the top chrome leave visible.\n   *\n   * @param {?Rect} canvas The map container's rect, viewport px.\n   * @param {?number} railTop The rail's top edge, viewport px; null when\n   *   no rail is open.\n   * @param {number} topInset The top chrome's height, px.\n   * @returns {?Rect} Null for a canvas with no size (not laid out yet).\n   */\n  function visibleRect(canvas, railTop, topInset) {\n    if (!canvas || !(canvas.right > canvas.left) || !(canvas.bottom > canvas.top)) return null;\n    const bottom = typeof railTop === 'number' && Number.isFinite(railTop)\n      ? Math.min(canvas.bottom, railTop)\n      : canvas.bottom;\n    return {\n      left: canvas.left,\n      top: Math.min(bottom, canvas.top + (topInset || 0)),\n      right: canvas.right,\n      bottom: bottom,\n    };\n  }\n\n  /**\n   * Whether a point lies inside a rect, edges included.\n   *\n   * @param {?{x: number, y: number}} point\n   * @param {?Rect} rect\n   * @returns {boolean}\n   */\n  function isInside(point, rect) {\n    if (!point || !rect) return false;\n    return point.x >= rect.left && point.x <= rect.right\n      && point.y >= rect.top && point.y <= rect.bottom;\n  }\n\n  /**\n   * Whether a point is in the visible map and under none of the boxes\n   * covering it (SNOW-1354).\n   *\n   * The leader line asks this of the cursor dot: a dot BESIDE the route\n   * panel is in plain view, though it is above the panel's bottom edge,\n   * so only the panel's own box hides it \u2014 not the band across the map's\n   * width that `visibleRect` keeps clear for a pan.\n   *\n   * @param {?{x: number, y: number}} point\n   * @param {?Rect} rect The visible map.\n   * @param {Array<?Rect>} [covers] What lies over it, the route panel.\n   * @returns {boolean}\n   */\n  function isVisible(point, rect, covers) {\n    if (!isInside(point, rect)) return false;\n    return !(covers || []).some((box) => box && isInside(point, box));\n  }\n\n  /**\n   * One axis of `panOffset`.\n   *\n   * @param {number} value The point's coordinate.\n   * @param {number} low The rect's low edge.\n   * @param {number} high The rect's high edge.\n   * @param {number} margin\n   * @returns {number}\n   */\n  function axisOffset(value, low, high, margin) {\n    if (high - low <= margin * 2) return value - (low + high) / 2;\n    if (value < low + margin) return value - (low + margin);\n    if (value > high - margin) return value - (high - margin);\n    return 0;\n  }\n\n  /**\n   * The pan that brings a point `margin` px inside a rect.\n   *\n   * @param {?{x: number, y: number}} point The point, viewport px.\n   * @param {?Rect} rect The visible map, viewport px.\n   * @param {number} margin How far inside the edges to bring it.\n   * @returns {?{x: number, y: number}} `panBy`'s offset, or null when the\n   *   point is already inside (or either is unknown).\n   */\n  function panOffset(point, rect, margin) {\n    if (!point || !rect || !Number.isFinite(point.x) || !Number.isFinite(point.y)) return null;\n    const m = margin || 0;\n    const x = axisOffset(point.x, rect.left, rect.right, m);\n    const y = axisOffset(point.y, rect.top, rect.bottom, m);\n    if (Math.abs(x) < 0.5 && Math.abs(y) < 0.5) return null;\n    return { x: x, y: y };\n  }\n\n  /**\n   * Where \"Zoom to point\" aims (Hugo, 2026-10-31; one half of \"Centre on\n   * route\" until 2026-11-27): the placed point, or half way along the line by distance, not its middle vertex, which on\n   * an unevenly sampled GPX can sit near either end.\n   *\n   * @param {?Array<number>} point The placed point's [lon, lat], if any.\n   * @param {*} coordinates The route's `geometry.coordinates`.\n   * @returns {?Array<number>} [lon, lat], or null with nothing usable.\n   */\n  function centreTarget(point, coordinates) {\n    if (point && isPoint(point)) return [point[0], point[1]];\n    const half = shareMidpoints(coordinates, 1);\n    if (half.length) return half[0];\n    const only = Array.isArray(coordinates) ? coordinates.find(isPoint) : null;\n    return only ? [only[0], only[1]] : null;\n  }\n\n  /**\n   * The map a desktop route column leaves visible: right of the column and\n   * under the top chrome, viewport px. (On a phone the sheet covers the\n   * foot instead, and `visibleRect` answers.)\n   *\n   * @param {Rect} canvas The map container's rect.\n   * @param {?{right: number, width: number}} column The panel's rect.\n   * @param {number} topInset The top chrome's height, px.\n   * @returns {Rect}\n   */\n  function columnRect(canvas, column, topInset) {\n    const left = column && column.width > 0 ? Math.min(canvas.right, column.right) : canvas.left;\n    return {\n      left: left,\n      top: Math.min(canvas.bottom, canvas.top + (topInset || 0)),\n      right: canvas.right,\n      bottom: canvas.bottom,\n    };\n  }\n\n  /**\n   * The `easeTo` offset that lands the target mid-way across `rect`.\n   *\n   * MapLibre aims at the centre of the PADDED viewport (the padding\n   * map_sheet.js writes), so the offset is measured from there.\n   *\n   * @param {Rect} canvas The map container's rect, viewport px.\n   * @param {?Rect} rect The visible map, viewport px.\n   * @param {?{top?: number, right?: number, bottom?: number, left?: number}} padding\n   *   The map's camera padding.\n   * @returns {[number, number]} [x, y]; [0, 0] with no rect.\n   */\n  function centreOffset(canvas, rect, padding) {\n    if (!canvas || !rect) return [0, 0];\n    const p = { top: 0, right: 0, bottom: 0, left: 0, ...(padding || {}) };\n    const width = canvas.right - canvas.left;\n    const height = canvas.bottom - canvas.top;\n    const cameraX = p.left + (width - p.left - p.right) / 2;\n    const cameraY = p.top + (height - p.top - p.bottom) / 2;\n    const targetX = (rect.left + rect.right) / 2 - canvas.left;\n    const targetY = (rect.top + rect.bottom) / 2 - canvas.top;\n    return [Math.round(targetX - cameraX), Math.round(targetY - cameraY)];\n  }\n\n  /**\n   * A line's bounding box, [west, south, east, north]: what the panel's\n   * bullseye frames with no point placed (2026-10-31).\n   *\n   * @param {*} coordinates The route's `geometry.coordinates`.\n   * @returns {?Array<number>} Null with no usable point.\n   */\n  function lineBounds(coordinates) {\n    const path = Array.isArray(coordinates) ? coordinates.filter(isPoint) : [];\n    if (!path.length) return null;\n    let west = Infinity;\n    let south = Infinity;\n    let east = -Infinity;\n    let north = -Infinity;\n    for (const [lon, lat] of path) {\n      if (lon < west) west = lon;\n      if (lon > east) east = lon;\n      if (lat < south) south = lat;\n      if (lat > north) north = lat;\n    }\n    return [west, south, east, north];\n  }\n\n  self.pwaRouteCursorMapCore = Object.freeze({\n    lineBounds: lineBounds,\n    centreTarget: centreTarget,\n    columnRect: columnRect,\n    centreOffset: centreOffset,\n    visibleRect: visibleRect,\n    isInside: isInside,\n    isVisible: isVisible,\n    panOffset: panOffset,\n    sampleCount: sampleCount,\n    cursorPoint: cursorPoint,\n    cursorSegment: cursorSegment,\n    segmentMidpoints: segmentMidpoints,\n    shareMidpoints: shareMidpoints,\n    nearestSample: nearestSample,\n    legAt: legAt,\n  });\n})();\n"],
  "mappings": "CA4FC,UAAY,CACX,aAoBA,SAASA,EAAQC,EAAO,CACtB,OAAO,MAAM,QAAQA,CAAK,GACrBA,EAAM,QAAU,GAChB,OAAO,SAASA,EAAM,CAAC,CAAC,GACxB,OAAO,SAASA,EAAM,CAAC,CAAC,CAC/B,CAQA,SAASC,EAAYC,EAAO,CAC1B,MAAI,CAACA,GAAS,CAAC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,MAAO,EAAG,OAAQ,EAAG,KAAM,EAAG,GAAIqC,GAAW,CAAC,CAAG,EAC/DC,EAAQxB,EAAO,MAAQA,EAAO,KAC9ByB,EAASzB,EAAO,OAASA,EAAO,IAChC0B,EAAUxC,EAAE,MAAQsC,EAAQtC,EAAE,KAAOA,EAAE,OAAS,EAChDyC,EAAUzC,EAAE,KAAOuC,EAASvC,EAAE,IAAMA,EAAE,QAAU,EAChD0C,GAAWvB,EAAK,KAAOA,EAAK,OAAS,EAAIL,EAAO,KAChD6B,GAAWxB,EAAK,IAAMA,EAAK,QAAU,EAAIL,EAAO,IACtD,MAAO,CAAC,KAAK,MAAM4B,EAAUF,CAAO,EAAG,KAAK,MAAMG,EAAUF,CAAO,CAAC,CACtE,CASA,SAASG,EAAWhE,EAAa,CAC/B,MAAMhB,EAAO,MAAM,QAAQgB,CAAW,EAAIA,EAAY,OAAOrB,CAAO,EAAI,CAAC,EACzE,GAAI,CAACK,EAAK,OAAQ,OAAO,KACzB,IAAIiF,EAAO,IACPC,EAAQ,IACRC,EAAO,KACPC,EAAQ,KACZ,SAAW,CAACC,EAAKC,CAAG,IAAKtF,EACnBqF,EAAMJ,IAAMA,EAAOI,GACnBA,EAAMF,IAAMA,EAAOE,GACnBC,EAAMJ,IAAOA,EAAQI,GACrBA,EAAMF,IAAOA,EAAQE,GAE3B,MAAO,CAACL,EAAMC,EAAOC,EAAMC,CAAK,CAClC,CAEA,KAAK,sBAAwB,OAAO,OAAO,CACzC,WAAYJ,EACZ,aAAcb,EACd,WAAYG,EACZ,aAAcE,EACd,YAAavB,EACb,SAAUK,EACV,UAAWE,EACX,UAAWQ,EACX,YAAanE,EACb,YAAaiC,EACb,cAAeI,EACf,iBAAkBT,EAClB,eAAgBV,EAChB,cAAesB,EACf,MAAOS,CACT,CAAC,CACH,GAAG",
  "names": ["isPoint", "point", "sampleCount", "slope", "along", "path", "share", "scale", "lengths", "total", "i", "dx", "dy", "length", "remaining", "t", "a", "b", "last", "halfway", "shareMidpoints", "coordinates", "count", "out", "segmentPathsOf", "slopeCore", "midpointOf", "points", "index", "paths", "segmentMidpoints", "segmentColour", "angle", "classIndex", "entry", "cursorPoint", "middle", "properties", "colour", "cursorSegment", "line", "p", "nearestSample", "midpointsPx", "px", "maxPx", "limit", "best", "bestDistance", "m", "distance", "legAt", "legs", "leg", "visibleRect", "canvas", "railTop", "topInset", "bottom", "isInside", "rect", "isVisible", "covers", "box", "axisOffset", "value", "low", "high", "margin", "panOffset", "x", "y", "centreTarget", "half", "only", "columnRect", "column", "centreOffset", "padding", "width", "height", "cameraX", "cameraY", "targetX", "targetY", "lineBounds", "west", "south", "east", "north", "lon", "lat"]
}
