@splunk/react-visualizations 25.7.2 → 25.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/Area.js +30 -56
  2. package/Area.js.map +1 -1
  3. package/Bar.js +26 -52
  4. package/Bar.js.map +1 -1
  5. package/Bubble.js +28 -54
  6. package/Bubble.js.map +1 -1
  7. package/Column.js +35 -62
  8. package/Column.js.map +1 -1
  9. package/FillerGauge.js +0 -2
  10. package/FillerGauge.js.map +1 -1
  11. package/GeoJsonChoropleth.js +89 -451
  12. package/GeoJsonChoropleth.js.map +1 -1
  13. package/Line.js +30 -56
  14. package/Line.js.map +1 -1
  15. package/MarkerGauge.js +0 -2
  16. package/MarkerGauge.js.map +1 -1
  17. package/Pie.js +23 -43
  18. package/Pie.js.map +1 -1
  19. package/Punchcard.js +3 -6
  20. package/Punchcard.js.map +1 -1
  21. package/Scatter.js +26 -52
  22. package/Scatter.js.map +1 -1
  23. package/SingleValue.js +13 -29
  24. package/SingleValue.js.map +1 -1
  25. package/SingleValueIcon.js +13 -30
  26. package/SingleValueIcon.js.map +1 -1
  27. package/SingleValueRadial.js +134 -182
  28. package/SingleValueRadial.js.map +1 -1
  29. package/SvgChoropleth.js +21 -69
  30. package/SvgChoropleth.js.map +1 -1
  31. package/SvgChoroplethDynamic.js +2 -11
  32. package/SvgChoroplethDynamic.js.map +1 -1
  33. package/common/Charting.js +36 -118
  34. package/common/Charting.js.map +1 -1
  35. package/common/ChartingApi.js +5 -15
  36. package/common/ChartingApi.js.map +1 -1
  37. package/common/EventsDoc.js +20 -61
  38. package/common/EventsDoc.js.map +1 -1
  39. package/common/OptionsDoc.js +5 -11
  40. package/common/OptionsDoc.js.map +1 -1
  41. package/common/props.js +0 -3
  42. package/common/props.js.map +1 -1
  43. package/package.json +9 -9
  44. package/utils/numberUtils.js +4 -4
  45. package/utils/numberUtils.js.map +1 -1
  46. package/utils/propUtils.js +2 -2
  47. package/utils/propUtils.js.map +1 -1
  48. package/utils/seriesUtils.js +0 -1
  49. package/utils/seriesUtils.js.map +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"@splunk/visualizations-shared/SanitizeProps\"","webpack:///external \"@babel/runtime/helpers/toConsumableArray\"","webpack:///external \"styled-components\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"lodash\"","webpack:///external \"@splunk/themes/variables\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/themes/pick\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/ICoordinateTransformation.ts","webpack:///./src/visualizations/SvgChoropleth/SvgChoropleth.tsx","webpack:///./src/visualizations/SvgChoropleth/src/utils/CoordinateTransformation.ts","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/TransformationChain.ts","webpack:///./src/visualizations/SvgChoropleth/src/utils/BoundsUtils.ts","webpack:///./src/visualizations/GeoJsonChoropleth/GeoJsonChoropleth.tsx","webpack:///external \"@babel/runtime/helpers/assertThisInitialized\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/GeoJsonFeatureCollection.ts","webpack:///external \"@turf/bbox-clip\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/MercatorTransformation.ts","webpack:///./src/visualizations/SvgChoropleth/src/utils/GeometryStreamSVGRenderer.ts","webpack:///external \"@babel/runtime/helpers/get\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/BoundsCollector.ts","webpack:///./src/visualizations/SvgChoropleth/src/utils/NodeTreeReactGenerator.ts","webpack:///external \"lodash/camelCase\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/LinearTransformation.ts","webpack:///./src/visualizations/SvgChoropleth/src/utils/Sc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Ad,EAAiC;AACpC,aAAO,WAAW,GAAG,KAAK,WAAnB,GAAiC,KAAK,MAA7C;AACH;AAED;;;;;AAKG;;;;WACI,aAAI,WAAJ,EAA2B,WAA3B,EAAyD;AAC5D,UAAM,cAAc,GAAG,WAAW,CAAC,GAAZ,GAAkB,WAAW,CAAC,GAArD;AACA,UAAM,QAAQ,GAAG,mBAAW,WAAX,CAAjB;AAEA,UAAM,cAAc,GAAG,QAAQ,CAAC,GAAT,GAAe,QAAQ,CAAC,GAA/C;AACA,UAAM,YAAY,GAAG,QAAQ,CAAC,GAA9B;AAEA,UAAM,KAAK,GAAG,cAAc,GAAG,cAA/B;AACA,WAAK,MAAL,CAAY,KAAZ,EAAmB,WAAW,CAAC,GAAZ,GAAkB,CAAC,YAAY,IAAI,CAAjB,IAAsB,KAA3D;AACH;AAED;;;;AAIG;;;;WACI,0BAAiB,YAAjB,EAAuC,QAAvC,EAAuD;AAC1D,WAAK,MAAL,GACI,CAAC,YAAY,IAAI,QAAQ,GAAG,KAAK,WAApB,CAAZ,GAA+C,KAAK,MAAL,GAAc,KAAK,WAAnE,IAAkF,QADtF;AAEA,WAAK,WAAL,GAAmB,QAAnB;AACH;AAED;;;AAGG;;;;WACI,sBAAa,WAAb,EAAgC;AACnC,WAAK,MAAL,IAAe,WAAW,GAAG,KAAK,WAAlC;AACH;;;;;;AAnEL,sB","file":"GeoJsonChoropleth.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 51);\n","module.exports = require(\"react\");","module.exports = require(\"@splunk/visualizations-shared/SanitizeProps\");","module.exports = require(\"@babel/runtime/helpers/toConsumableArray\");","module.exports = require(\"styled-components\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"lodash\");","module.exports = require(\"@splunk/themes/variables\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/themes/pick\");","import { mapValues, cloneDeep, isEqual } from 'lodash';\nimport { Interval } from './Scale';\n\nexport interface Dimension {\n unit: string;\n}\nexport interface Space {\n [axis: string]: Dimension;\n}\nexport interface DataPoint {\n [axis: string]: number;\n}\nexport interface Bounds {\n [axis: string]: Interval;\n}\n\nexport const screenSpace: Space = { x: { unit: 'pixel' }, y: { unit: 'pixel' } };\n\nexport const geoSpace: Space = {\n lat: { unit: '°' },\n long: { unit: '°' },\n};\n\nexport const logicalSpace: Space = {\n x: { unit: null },\n y: { unit: null },\n};\n\nexport const flipBounds = function (bounds: Bounds, flipAxis: string[]): Bounds {\n const result = cloneDeep(bounds);\n flipAxis.forEach((axis): void => {\n result[axis].min = bounds[axis].max;\n result[axis].max = bounds[axis].min;\n });\n return result;\n};\n\nexport default interface ICoordinateTransformation {\n sourceSpace: Space;\n targetSpace: Space;\n\n /**\n *\n * @param sourcePoint - coords in source space\n * @return coords in target dimensions\n */\n transform(sourcePoint: DataPoint): DataPoint;\n\n /**\n *\n * @param targetPoint - coords in target space\n * @return coords in source dimensions\n */\n transformBack(targetPoint: DataPoint): DataPoint;\n\n /**\n * returns a new TransformationChain without modifying this Transformation or Chain\n * @param {ICoordinateTransformation} transformation\n * @return {ICoordinateTransformation}\n */\n appendTransformation(transformation: ICoordinateTransformation): ICoordinateTransformation;\n}\n\nexport const visibleSourceBounds = function visibleSourceBounds(\n transformation: ICoordinateTransformation,\n targetBounds: Bounds\n): Bounds {\n const minTargetCoordinates = mapValues(targetBounds, (interval: Interval): number => interval.min);\n const maxTargetCoordinates = mapValues(targetBounds, (interval: Interval): number => interval.max);\n\n const minSourceCoordinates = transformation.transformBack(minTargetCoordinates);\n const maxSourceCoordinates = transformation.transformBack(maxTargetCoordinates);\n\n const result: Bounds = {};\n Object.keys(transformation.sourceSpace).forEach((axis): void => {\n result[axis] = { min: minSourceCoordinates[axis], max: maxSourceCoordinates[axis] };\n });\n\n return result;\n};\n\n/**\n * TODO: this is a suboptimal function name. It should be called transformBoundingBox. It's also a very\n * strange way to go about it. Impl seems counterintuitive\n * @param {ICoordinateTransformation} transformation\n * @param {Bounds} sourceBounds\n * @returns {Bounds}\n */\nexport const calculatedTargetBounds = function calculateTargetBounds(\n transformation: ICoordinateTransformation,\n sourceBounds: Bounds\n): Bounds {\n const minSourceCoordinates = mapValues(sourceBounds, (interval: Interval): number => interval.min);\n const maxSourceCoordinates = mapValues(sourceBounds, (interval: Interval): number => interval.max);\n\n const minTargetCoordinates = transformation.transform(minSourceCoordinates);\n const maxTargetCoordinates = transformation.transform(maxSourceCoordinates);\n\n const result: Bounds = {};\n Object.keys(transformation.targetSpace).forEach((axis): void => {\n result[axis] = { min: minTargetCoordinates[axis], max: maxTargetCoordinates[axis] };\n });\n\n return result;\n};\n\nexport function isSpaceCompatible(s1: Space, s2: Space): boolean {\n return isEqual(s1, s2);\n}\n","/* eslint-disable no-param-reassign */\nimport * as React from 'react';\nimport { get, isEqual } from 'lodash';\nimport styled from 'styled-components';\nimport { ISvgFeatureCollection } from './src/utils/ISvgFeatureCollection';\nimport { DataPoint } from './src/utils/ICoordinateTransformation';\n\nexport const DATA_ATTRIBUTE = 'data-value';\n\nexport interface SvgChoroplethProps {\n featureCollection: ISvgFeatureCollection;\n data: { featureIDs: string[]; fill: string[]; values: any[] };\n fillColor: string;\n strokeColor: string;\n strokeHighlightColor?: string;\n backgroundColor?: string;\n selector: string;\n onFeatureHover: (params: { featureId: string; value: any; label?: string }) => void;\n onClick?: (sourceCoordinates: DataPoint, featureId: string) => void;\n}\n\nexport interface SvgChoroplethState {\n svgNode: React.ReactNode;\n}\n\nexport { GeoFeatureGroup } from './src/utils/GeoTypes';\n\ninterface StyledSvgChoroplethProps {\n readonly backgroundColor: string;\n}\n\nconst StyledSvgChoropleth = styled.div<StyledSvgChoroplethProps>`\n display: flex;\n flex-direction: column;\n position: relative;\n background-color: ${(props): string => props.backgroundColor};\n`;\n\nexport default class SvgChoropleth extends React.Component<SvgChoroplethProps, SvgChoroplethState> {\n containerRef: React.RefObject<HTMLDivElement> = React.createRef();\n\n // lastFeatureStroke: string;\n svgDom: SVGElement;\n\n highlightedCountry: SVGElement = null;\n\n constructor(props: SvgChoroplethProps) {\n super(props);\n const { featureCollection } = props;\n this.state = { svgNode: featureCollection.getSvgNode(this.registerSvg) };\n }\n\n shouldComponentUpdate(nextProps: Readonly<SvgChoroplethProps>, nextState: SvgChoroplethState): boolean {\n const shouldUpdate =\n !isEqual(nextState.svgNode, this.state.svgNode) || !isEqual(nextProps, this.props);\n return shouldUpdate;\n }\n\n componentDidUpdate(prevProps): void {\n if (this.props !== prevProps) {\n if (prevProps.featureCollection !== this.props.featureCollection) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({\n svgNode: this.props.featureCollection.getSvgNode(this.registerSvg),\n });\n } else {\n this.updateSvg(this.props);\n }\n }\n }\n\n getLocalCoords = (clientX: number, clientY: number): { x: number; y: number } => {\n const rect = this.containerRef.current.getBoundingClientRect();\n const physX = rect.left;\n const physY = rect.top;\n return { x: clientX - physX, y: clientY - physY };\n };\n\n handleMapClick = (event: React.MouseEvent<HTMLInputElement>): void => {\n const { clientX, clientY } = event;\n const pos = this.getLocalCoords(clientX, clientY);\n const { featureCollection, onClick } = this.props;\n const clickedCoords: DataPoint = featureCollection.transformation.transformBack(pos);\n const feature: SVGSVGElement = event.target as SVGSVGElement;\n const wholeFeature: SVGElement = feature.id ? feature : (feature.parentNode as SVGElement);\n if (onClick) {\n onClick(clickedCoords, wholeFeature.id);\n }\n };\n\n handleFeatureEnter = (ev: MouseEvent): void => {\n const feature: SVGSVGElement = ev.target as SVGSVGElement;\n\n if (!feature.id && !feature.ownerSVGElement) {\n return;\n }\n\n const wholeFeature: SVGElement = feature.id ? feature : (feature.parentNode as SVGElement);\n // remove the highlighted country IF we are entering a different country\n if (this.highlightedCountry && wholeFeature.id !== this.highlightedCountry.id) {\n this.unHighlightCountry();\n }\n this.highlightCountry(wholeFeature);\n\n if (this.props.onFeatureHover) {\n this.props.onFeatureHover({\n featureId: wholeFeature.id,\n label: wholeFeature.getAttribute('label_en'),\n value: wholeFeature.getAttribute(DATA_ATTRIBUTE),\n });\n }\n };\n\n handleFeatureLeave = (ev: MouseEvent): void => {\n const feature: SVGSVGElement = ev.target as SVGSVGElement;\n\n if (!feature.id && !feature.ownerSVGElement) {\n return;\n }\n\n // 'wholeFeature' means the SVG <g> (group) of multipolygon features\n const wholeFeature: SVGElement = feature.id ? feature : (feature.parentNode as SVGElement);\n // handling feature leaving should always only deal with the highlighted feature\n if (wholeFeature !== this.highlightedCountry) {\n return;\n }\n this.unHighlightCountry();\n // wholeFeature.style.stroke = this.lastFeatureStroke;\n\n if (this.props.onFeatureHover) {\n this.props.onFeatureHover({ featureId: null, value: null, label: null });\n }\n };\n\n // allows a provided alias like 'US-CA' to get mapped to 'California' which is the element id for the SVG shape\n private getFeatureId(alias: string): string {\n return this.props.featureCollection.resolveAlias(alias);\n }\n\n registerSvg = (el: SVGSVGElement): void => {\n if (!el) return;\n\n this.svgDom = el;\n\n const { selector = '.feature', strokeColor, fillColor } = this.props;\n\n this.svgDom.onmouseover = this.handleFeatureEnter;\n this.svgDom.onmouseout = this.handleFeatureLeave;\n\n this.svgDom.querySelectorAll(selector).forEach((node: HTMLElement): void => {\n node.style.stroke = strokeColor;\n node.style.fill = fillColor;\n });\n\n this.updateSvg(this.props);\n };\n\n /**\n * this method renders a copy of the polygon on top of all the others, with a highlighted boundary.\n * Technically we don't render in on top of ALL the others. There are three totally landlocked countries,\n * the first of which in our geojson file is Lesotho. These are also the last three countries in the geojson\n * file. So when we insert the highlight shape into the dom, we inert it *before* these three countries.\n * So the highlight for South Africa will not cover up Lesotho.\n * @param {SVGElement} el\n */\n highlightCountry(el: SVGElement): void {\n if (this.highlightedCountry) {\n return; // do not add more than one hovered element at a time\n }\n\n const firstLandlockedCountry = this.svgDom.querySelector(`#Lesotho`);\n const parent = el.parentNode;\n const clone: SVGElement = el.cloneNode(true) as SVGElement;\n const strokeColor = this.props.strokeHighlightColor || '#000';\n clone.style.stroke = strokeColor;\n this.highlightedCountry = clone;\n\n parent.insertBefore(clone, firstLandlockedCountry);\n }\n\n unHighlightCountry(): void {\n if (this.highlightedCountry) {\n this.svgDom.removeChild(this.highlightedCountry);\n }\n this.highlightedCountry = null;\n }\n\n updateSvg(props: SvgChoroplethProps): void {\n if (!this.svgDom) {\n return;\n }\n\n const { selector = '.feature', fillColor, data } = props;\n\n if (!data) {\n return;\n }\n const dataHashMap = {};\n\n data.featureIDs.forEach((alias, index): void => {\n const featureId = this.getFeatureId(alias);\n dataHashMap[featureId] = { fill: data.fill[index], value: data.values[index] };\n });\n this.svgDom.querySelectorAll(selector).forEach((node: HTMLElement): void => {\n const nodeData = dataHashMap[node.id];\n node.style.fill = get(nodeData, 'fill') || fillColor;\n const value = get(nodeData, 'value');\n if (value) {\n node.setAttribute(DATA_ATTRIBUTE, value);\n } else {\n node.removeAttribute(DATA_ATTRIBUTE);\n }\n });\n }\n\n render(): JSX.Element {\n const { backgroundColor = 'transparent' } = this.props;\n // note: for some reason, onclick event can't be triggered on dashboard. So change it to onMouseDown\n return (\n <StyledSvgChoropleth\n data-test=\"styled-svg-choropleth\"\n backgroundColor={backgroundColor}\n onMouseDown={this.handleMapClick}\n ref={this.containerRef}\n >\n {this.state.svgNode}\n </StyledSvgChoropleth>\n );\n }\n}\n","import ICoordinateTransformation, { DataPoint, isSpaceCompatible, Space } from './ICoordinateTransformation';\nimport TransformationChain from './TransformationChain';\n\nexport default abstract class CoordinateTransformation implements ICoordinateTransformation {\n public sourceSpace: Space;\n\n public targetSpace: Space;\n\n static readonly INCOMPATIBLE_SPACES_ERROR =\n \"incompatible transformation (appended source space doesn't match chain's output space)\";\n\n protected constructor(sourceSpace: Space, targetSpace: Space) {\n this.sourceSpace = sourceSpace;\n this.targetSpace = targetSpace;\n }\n\n public appendTransformation(transformation: ICoordinateTransformation): ICoordinateTransformation {\n if (!isSpaceCompatible(this.targetSpace, transformation.sourceSpace)) {\n throw new Error(CoordinateTransformation.INCOMPATIBLE_SPACES_ERROR);\n }\n return new TransformationChain([this, transformation]);\n }\n\n abstract transform(sourcePoint: DataPoint): DataPoint;\n\n abstract transformBack(sourcePoint: DataPoint): DataPoint;\n}\n","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","import { isEqual, last } from 'lodash';\nimport ICoordinateTransformation, { DataPoint, Space } from './ICoordinateTransformation';\n\nexport default class TransformationChain implements ICoordinateTransformation {\n public sourceSpace: Space;\n\n public targetSpace: Space;\n\n public transformations: ICoordinateTransformation[];\n\n public constructor(transformations: ICoordinateTransformation[]) {\n this.transformations = [...transformations];\n this.sourceSpace = transformations[0].sourceSpace;\n this.targetSpace = last(transformations).targetSpace;\n }\n\n public appendTransformation(transformation: ICoordinateTransformation): TransformationChain {\n if (!isEqual(transformation.sourceSpace, last(this.transformations).targetSpace)) {\n throw new Error(`Can't chain transformations with incompatible spaces \n ${JSON.stringify(last(this.transformations).targetSpace)} -> ${JSON.stringify(\n transformation.sourceSpace\n )}`);\n }\n return new TransformationChain([...this.transformations, transformation]);\n }\n\n public transform(logicalCoords: DataPoint): DataPoint {\n let currentCoords = logicalCoords;\n this.transformations.forEach((transformation): void => {\n currentCoords = transformation.transform(currentCoords);\n });\n return currentCoords;\n }\n\n public transformBack(physicalCoords: DataPoint): DataPoint {\n let currentCoords = physicalCoords;\n for (let idx = this.transformations.length - 1; idx >= 0; idx -= 1) {\n currentCoords = this.transformations[idx].transformBack(currentCoords);\n }\n return currentCoords;\n }\n}\n","import { Bounds, DataPoint } from './ICoordinateTransformation';\nimport { Interval } from './Scale';\n\nexport default class BoundsUtils {\n /**\n * checks if a line segment [dp1, dp2] is fully within a Bounds\n * @param {Bounds} bounds\n * @param {DataPoint} dp1\n * @param {DataPoint} dp2\n * @returns {boolean}\n */\n public static contains(bounds: Bounds, dp1: DataPoint, dp2: DataPoint): boolean {\n return BoundsUtils.withinInterval(bounds, dp1) && BoundsUtils.withinInterval(bounds, dp2);\n }\n\n /**\n * returns a turf BBox from Bounds.\n * @param {Bounds} bounds Interval keys must be 'lat' and 'long'\n * @returns {number[]} formatted in single array as [long.min, lat.min, long.max, lat.max]\n */\n public static toTurfBBox(bounds: Bounds): number[] {\n const { long, lat } = bounds;\n return [long.min, lat.min, long.max, lat.max];\n }\n\n /**\n * tells if the number is within the inclusive Interval\n * @param {Interval} interval\n * @param {number} v\n * @returns {boolean}\n */\n public static within(interval: Interval, v: number): boolean {\n return interval.min <= v && interval.max >= v;\n }\n\n /**\n * returns the distance from interval min to max\n * @param {Interval} interval\n * @returns {number}\n */\n public static distance(interval: Interval): number {\n return interval.max - interval.min;\n }\n\n /**\n * A very special-purposed utility method that creates CSS style from the Bounds.\n * The 2-dimensional rectangular bounds are converted top, left, width, height\n * @param {Bounds} must use 'x' and 'y' axis and assumes x and y are screen-oriented with zero,zero being the top left\n * @returns {object}\n */\n public static logicalBoundsToCssStyle(logicalBounds: Bounds): Record<string, unknown> {\n if (!logicalBounds) {\n return {};\n }\n const xInterval = logicalBounds.x;\n const yInterval = logicalBounds.y;\n // use GeoJsonFeatureGrpup f's Bounds to create a CSS inline style to position the inset using a div\n return {\n position: 'absolute',\n top: yInterval.min,\n left: xInterval.min,\n width: BoundsUtils.distance(xInterval),\n height: BoundsUtils.distance(yInterval),\n border: 'solid 1px',\n };\n }\n\n private static withinInterval(bounds: Bounds, dp: DataPoint): boolean {\n const axis = Object.keys(dp)[0];\n return BoundsUtils.within(bounds[axis], dp[axis]);\n }\n}\n","/* eslint-disable max-classes-per-file */\nimport * as React from 'react';\nimport styled from 'styled-components';\nimport { omit, get, includes } from 'lodash';\nimport pick from '@splunk/themes/pick';\nimport variables from '@splunk/themes/variables';\nimport { withSanitizedProps } from '@splunk/visualizations-shared/SanitizeProps';\nimport SvgChoropleth, { SvgChoroplethProps } from '../SvgChoropleth';\nimport { Bounds, DataPoint } from '../SvgChoropleth/src/utils/ICoordinateTransformation';\nimport GeoJsonFeatureCollection from '../SvgChoropleth/src/utils/GeoJsonFeatureCollection';\nimport { GeoFeatureGroup } from '../SvgChoropleth/src/utils/GeoTypes';\nimport BoundsUtils from '../SvgChoropleth/src/utils/BoundsUtils';\n\nexport interface GeoJsonChoroplethProps {\n name: string;\n geoJson: { features: Record<string, unknown>[] };\n data: { featureIDs: string[]; values: any[]; fill: string[] };\n projection: string;\n sourceBounds: Bounds;\n logicalBounds: Bounds;\n fillColor: string;\n strokeColor: string;\n strokeHighlightColor?: string;\n backgroundColor?: string;\n selector: string;\n onFeatureHover?: (featureId: string) => void;\n onClick?: (sourceCoordinates: DataPoint, featureId: string) => void;\n geoFeatureGroups?: GeoFeatureGroup[];\n theme?: Record<string, unknown>;\n}\n\nexport interface GeoJsonChoroplethState {\n featureCollections: GeoJsonFeatureCollection[];\n toolTip: { label; value };\n}\n\nexport const LABEL_FONT_SIZE = 14;\n\nexport const round2 = function round2(value: number): number {\n return Math.round(value * 100) / 100;\n};\n\n// todo: maybe can refactor to use `computeTextSize` in @splunk/visualizations-shared/domUtils.js\nexport const estimateTextWidth = function estimateTextWidth(text: string, fontsize: number): number {\n if (text == null) {\n return 0;\n }\n const avgLowerCaseWidth = 0.55 * fontsize;\n const avgUpperCaseWidth = 0.7 * fontsize;\n let length = 0;\n for (let pos = 0; pos < text.length; pos += 1) {\n const c = text.charAt(pos);\n if (includes('Iij.,;:!lt/', c)) {\n length += 0.2 * fontsize;\n } else if (c === '_') {\n length += 0.8 * fontsize;\n } else {\n length += c === c.toUpperCase() ? avgUpperCaseWidth : avgLowerCaseWidth;\n }\n }\n return length;\n};\n\n// todo: maybe can refactor to use `formatNumber` in ../utils/numberUtils\nexport const valueText = function valueText(value: number): string {\n if (value === 0) {\n return '0';\n }\n\n if (typeof value === 'string') {\n return value;\n }\n\n const magnitude = Math.floor(Math.log10(Math.abs(value)) / 3);\n const divisor = 10 ** (3 * magnitude);\n\n const suffixList = ['', 'k', 'm', 'bn', 'tn', 'qn'];\n const suffix = magnitude < 0 ? `/${suffixList[-magnitude]}` : suffixList[magnitude];\n\n return `${round2(value / divisor)}${suffix}`;\n};\n\nexport function createFeatureCollections(props: GeoJsonChoroplethProps): GeoJsonFeatureCollection[] {\n const { sourceBounds, logicalBounds, projection, geoJson, geoFeatureGroups } = props;\n const featureCollections = [];\n if (geoFeatureGroups) {\n geoFeatureGroups.forEach((g: GeoFeatureGroup): void => {\n featureCollections.push(\n new GeoJsonFeatureCollection(\n `${props.name}.${g.name}`,\n logicalBounds,\n projection,\n geoJson,\n g,\n sourceBounds\n )\n );\n });\n } else {\n featureCollections.push(\n new GeoJsonFeatureCollection(\n props.name,\n logicalBounds,\n projection,\n geoJson,\n undefined,\n sourceBounds\n )\n );\n }\n return featureCollections;\n}\n\nclass TTArgType {\n reference: React.Ref<any>;\n\n left: number;\n\n top: number;\n\n label: string;\n\n value: any;\n}\n\nconst TooltipBubble = styled.div.attrs(() => ({\n key: 'bubble',\n}))<{\n maxTextWidth: number;\n}>`\n background-color: ${pick({\n enterprise: {\n light: variables.white, // #171d21, so enterpriseDark.defaultBackgroundColor\n dark: '#27292e', // enterpriseBackgroundColor\n },\n prisma: variables.backgroundColorPopup,\n })};\n border-radius: 5px;\n padding: 5px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n box-shadow: 0px 5px 14px 0 rgba(0, 0, 100, 0.12);\n width: ${props => props.maxTextWidth}px;\n transition: width 100ms;\n`;\n\nconst TooltipLabel = styled.div.attrs(() => ({\n 'data-test': 'geojson-choropleth-tooltip-label',\n}))<{\n maxTextWidth: number;\n}>`\n margin-bottom: 2px;\n width: ${props => props.maxTextWidth}px;\n text-align: center;\n color: ${pick({\n enterprise: {\n // unfortunately cannot access variables.textGray directly colors since variables are theme-aware\n light: 'rgba(0, 0, 0, 0.65)', // equivalent to enterpriseDark.textGray\n dark: 'rgba(255, 255, 255, 0.7)', // equivalent to enterprise.textGray\n },\n prisma: variables.contentColorDefault,\n })};\n`;\n\nconst ArrowDown = styled.div`\n position: relative;\n top: -1px;\n width: 0px;\n height: 0px;\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n border-top: 8px solid\n ${pick({\n enterprise: {\n light: variables.white, // #171d21, so enterpriseDark.defaultBackgroundColor\n dark: '#27292e', // enterpriseBackgroundColor\n },\n prisma: variables.backgroundColorPopup,\n })};\n`;\n\nconst TooltipValue = styled.div.attrs(() => ({\n 'data-test': 'geojson-choropleth-tooltip-value',\n}))`\n color: ${pick({\n enterprise: {\n // unfortunately cannot access variables.textGray directly colors since variables are theme-aware\n light: '#2c2c2c', // equivalent to enterpriseDark.textGray\n dark: 'rgba(255, 255, 255, 0.98)', // equivalent to enterprise.textGray\n },\n prisma: variables.contentColorActive,\n })};\n`;\n\ninterface GeoJsonChoroplethContainerProps {\n backgroundColor: string;\n}\n\nconst GeoJsonChoroplethContainer = styled.div.attrs(() => ({\n 'data-test': 'geojson-choropleth-container',\n}))<GeoJsonChoroplethContainerProps>`\n background-color: ${props =>\n props.backgroundColor ||\n pick({\n enterprise: {\n dark: variables.black,\n light: variables.backgroundColorSidebar,\n },\n prisma: variables.backgroundColorSidebar,\n })};\n position: relative;\n`;\n\nconst ToolTip = function ToolTip(arg: TTArgType): React.ReactElement {\n const { reference, left, top, label, value } = arg;\n\n const maxTextWidth =\n Math.max(estimateTextWidth(label, LABEL_FONT_SIZE), estimateTextWidth(value, LABEL_FONT_SIZE)) + 10;\n\n return (\n <div\n key=\"tooltip\"\n ref={reference}\n style={{\n position: 'absolute',\n top,\n left,\n pointerEvents: 'none',\n visibility: label || value ? 'visible' : 'hidden',\n }}\n >\n <div\n style={{\n position: 'relative',\n left: '-50%',\n top: '-56px',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'flex-start',\n fontSize: LABEL_FONT_SIZE,\n }}\n >\n <TooltipBubble maxTextWidth={maxTextWidth}>\n <TooltipLabel maxTextWidth={maxTextWidth}> {label} </TooltipLabel>\n <TooltipValue>{valueText(value)}</TooltipValue>\n </TooltipBubble>\n <ArrowDown />\n </div>\n </div>\n );\n};\n\nclass GeoJsonChoropleth extends React.Component<GeoJsonChoroplethProps, GeoJsonChoroplethState> {\n containerRef: React.RefObject<HTMLDivElement> = React.createRef();\n\n toolTipRef: React.RefObject<HTMLDivElement> = React.createRef();\n\n cursorPos: { x: number; y: number };\n\n constructor(props) {\n super(props);\n this.state = { featureCollections: createFeatureCollections(props), toolTip: null };\n this.cursorPos = { x: 0, y: 0 };\n\n this.handleMouseMove = this.handleMouseMove.bind(this);\n this.handleFeatureHover = this.handleFeatureHover.bind(this);\n }\n\n componentDidUpdate(prevProps): void {\n const { sourceBounds, logicalBounds, projection, geoJson } = this.props;\n if (\n prevProps.geoJson !== geoJson ||\n prevProps.sourceBounds !== sourceBounds ||\n prevProps.logicalBounds !== logicalBounds ||\n prevProps.projection !== projection\n ) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({ featureCollections: createFeatureCollections(this.props) });\n }\n }\n\n handleMouseMove(ev: React.MouseEvent<HTMLDivElement, MouseEvent>): void {\n this.cursorPos = this.getLocalCoords(ev.clientX, ev.clientY);\n if (this.toolTipRef.current) {\n this.toolTipRef.current.style.left = `${this.cursorPos.x}px`;\n this.toolTipRef.current.style.top = `${this.cursorPos.y}px`;\n }\n }\n\n handleFeatureHover({ featureId, value, label }): void {\n if (featureId) {\n this.setState({ toolTip: { label: label || featureId, value: value || '-no data-' } });\n } else {\n this.setState({ toolTip: null });\n }\n\n const externalHandler = this.props.onFeatureHover;\n if (externalHandler) {\n externalHandler(featureId);\n }\n }\n\n getLocalCoords(clientX: number, clientY: number): { x: number; y: number } {\n const rect = this.containerRef.current.getBoundingClientRect();\n const physX = rect.left;\n const physY = rect.top;\n const scaleX = this.containerRef.current.offsetWidth / rect.width;\n const scaleY = this.containerRef.current.offsetHeight / rect.height;\n return { x: (clientX - physX) * scaleX, y: (clientY - physY) * scaleY };\n }\n\n public render(): React.ReactElement {\n const children = [];\n const relevantProps = omit(this.props, ['sourceBounds', 'logicalBounds', 'projection']);\n const { toolTip } = this.state;\n\n // create one child SvgChoropleth for each GeoJsonFeatureCollection\n this.state.featureCollections.forEach((f: GeoJsonFeatureCollection): void => {\n const props: SvgChoroplethProps = {\n ...relevantProps,\n onFeatureHover: this.handleFeatureHover,\n featureCollection: f,\n };\n const svgChoropleth = React.createElement(SvgChoropleth, props);\n let style = {};\n const logicalBounds = get(f, ['group', 'logicalBounds']);\n if (logicalBounds) {\n style = BoundsUtils.logicalBoundsToCssStyle(logicalBounds);\n }\n children.push(React.createElement('div', { key: f.name, style }, svgChoropleth));\n });\n return (\n <GeoJsonChoroplethContainer\n ref={this.containerRef}\n onMouseMove={this.handleMouseMove}\n backgroundColor={this.props.backgroundColor}\n >\n {children}\n <ToolTip\n reference={this.toolTipRef}\n left={this.cursorPos.x}\n top={this.cursorPos.y}\n label={get(toolTip, 'label')}\n value={get(toolTip, 'value')}\n />\n </GeoJsonChoroplethContainer>\n );\n }\n}\n\nexport default withSanitizedProps(GeoJsonChoropleth);\n","module.exports = require(\"@babel/runtime/helpers/assertThisInitialized\");","import { get } from 'lodash';\nimport * as turf from '@turf/helpers';\nimport bboxClip from '@turf/bbox-clip';\nimport { ISvgFeatureCollection } from './ISvgFeatureCollection';\nimport { MercatorTransformation } from './MercatorTransformation';\nimport { GeometryStreamSVGRenderer, IdentityTransform } from './GeometryStreamSVGRenderer';\nimport ICoordinateTransformation, {\n Bounds,\n calculatedTargetBounds,\n flipBounds,\n logicalSpace,\n} from './ICoordinateTransformation';\nimport LinearTransformation from './LinearTransformation';\nimport TransformationChain from './TransformationChain';\nimport { GeometryStream } from './GeometryStream';\nimport { GeoFeatureGroup } from './GeoTypes';\nimport BoundsUtils from './BoundsUtils';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const MATCH_ALL_FEATUREGROUP_MATCHER = (feature: Record<string, unknown>): boolean => true;\nexport function featureGroupMatcher(g: GeoFeatureGroup): (feature: Record<string, any>) => boolean {\n if (!g || !g.featureMatcher || !g.featureMatcher.regex || !g.featureMatcher.property) {\n // if no matcher things defined, then we are not filtering features, and therefore should match all\n // eslint-disable-next-line\n return MATCH_ALL_FEATUREGROUP_MATCHER;\n }\n\n const matcher = new RegExp(g.featureMatcher.regex);\n return (feature: Record<string, any>): boolean => {\n const val = get(feature, ['properties', g.featureMatcher.property]);\n if (!val) {\n return false;\n }\n return matcher.test(val);\n };\n}\n\nexport const DEFAULT_LOGICAL_BOUNDS = { x: { min: 0, max: 800 }, y: { min: 0, max: 600 } }; // default logical bounds\n\n// same as with sourceBounds, logical bound can be global or local to the FeatureGroup. They also need to have defaults\n// which are provided here.\nexport function pickLogicalBnds(globalLogicalBnds: Bounds, g: GeoFeatureGroup): Bounds {\n if (g && g.logicalBounds) {\n return g.logicalBounds;\n }\n if (globalLogicalBnds) {\n return globalLogicalBnds;\n }\n\n return DEFAULT_LOGICAL_BOUNDS;\n}\n\nexport function ring(\n coords: number[][],\n renderer: GeometryStream,\n bounds?: Bounds,\n props?: Record<string, unknown>\n): void {\n // polygon coords is array of number array\n renderer.beginNode('polygon', props);\n for (let i = 0; i < coords.length; i += 1) {\n const [long, lat] = coords[i];\n if (bounds && !BoundsUtils.contains(bounds, { long }, { lat })) {\n // the polygon is not entirely contained by the bounds. We must cancel (remove) the polygon along with any\n // points that were previously added to it.\n renderer.cancelNode();\n console.warn(`out-of-bounds polygon dropped: ${JSON.stringify(props)}`);\n return; // bail ... we don't need to endNode() since we cancelled it\n }\n renderer.addPoint({ long, lat });\n }\n renderer.endNode();\n}\n\nexport function polygon(coords: number[][][], renderer: GeometryStream, bounds?: Bounds): void {\n // polygon coords is array of number array\n for (let poly = 0; poly < coords.length; poly += 1) {\n ring(coords[poly], renderer, bounds);\n }\n}\n\nexport function renderGeoJsonFeature(\n feature: Record<string, any>,\n renderer: GeometryStream,\n bounds?: Bounds\n): void {\n const bbox: turf.BBox = bounds ? (BoundsUtils.toTurfBBox(bounds) as turf.BBox) : undefined;\n const { type } = feature.geometry;\n\n if (get(feature, ['properties', 'name']) === 'Antarctica') {\n // skip shapes that cannot be mercator projected\n // no-op\n return;\n }\n // demo hack...\n const props = feature.properties;\n if (props.iso_3166_2) {\n props.id = props.iso_3166_2;\n } else {\n props.id = props.name;\n }\n props.className = 'feature';\n // end demo hack\n switch (type) {\n case 'MultiPolygon': {\n renderer.beginNode('g', props); // svg has groups ('g') but no polygon\n // eslint-disable-next-line no-param-reassign\n feature = bbox ? bboxClip(feature as turf.MultiPolygon, bbox) : feature;\n const multis = get(feature, ['geometry', 'coordinates']);\n multis.forEach((multi: number[][][]): void => polygon(multi, renderer, bounds));\n renderer.endNode();\n break;\n }\n case 'Polygon': {\n // eslint-disable-next-line no-param-reassign\n feature = bbox ? bboxClip(feature as turf.Polygon, bbox) : feature;\n const rings = get(feature, ['geometry', 'coordinates']);\n rings.forEach((r: number[][]): void => ring(r, renderer, bounds, props));\n break;\n }\n default: {\n throw new Error(`Unsupported geojson type: ${type}`);\n }\n }\n}\n\nfunction computeBounds(\n geoJson: Record<string, any>,\n matcher: (feature: Record<string, unknown>) => boolean\n): Bounds {\n // replace the renderer with one that is configured only to compute logicalBounds (for performance)\n const boundsComputer = new GeometryStreamSVGRenderer();\n boundsComputer.computeBoundsOnly = true;\n geoJson.features.forEach((feature: Record<string, unknown>): void => {\n if (matcher(feature)) {\n renderGeoJsonFeature(feature, boundsComputer);\n }\n });\n return boundsComputer.getBounds();\n}\n\n// the source bounds can be provided globally for all feature groups, or they can be provided within a FeatureGroup\n// or they can be omitted entirely which means they must be computed by parsing the geoJson\nfunction pickSrcBnds(\n geoJson: Record<string, unknown>,\n g: GeoFeatureGroup,\n globalSrcBnds: Bounds,\n featureMatcher: (feature: Record<string, unknown>) => boolean\n): Bounds {\n if (g && g.sourceBounds) {\n return g.sourceBounds; // return FeatureGroup \"local\" sourceBounds if they exist.\n }\n\n if (globalSrcBnds) {\n return globalSrcBnds; // return global bounds if they exist\n }\n\n // ...'auto' compute the source bounds from the data.\n const b = computeBounds(geoJson, featureMatcher); // automatically compute sourceBounds if not provided\n if (!b) {\n throw new Error(\n `Could not determine bounds for geoFeatureGroup name='${this.name}' (no features matched)`\n );\n }\n return b;\n}\n\nexport default class GeoJsonFeatureCollection implements ISvgFeatureCollection {\n public name: string;\n\n private readonly sourceBounds: Bounds;\n\n public logicalBounds: Bounds;\n\n private projectionType: string;\n\n public transformation: ICoordinateTransformation;\n\n private geoJson: { features: Record<string, unknown>[] };\n\n private readonly group: GeoFeatureGroup;\n\n private readonly featureMatcher: (feature: Record<string, unknown>) => boolean;\n\n private aliases: Map<string, string>;\n\n public constructor(\n name: string,\n globalLogicalBnds: Bounds,\n projectionType: string,\n geoJson: { features: Record<string, unknown>[] },\n g?: GeoFeatureGroup,\n globalSrcBounds?: Bounds\n ) {\n this.name = name;\n this.projectionType = projectionType || 'mercator';\n this.geoJson = geoJson;\n this.group = g;\n this.featureMatcher = featureGroupMatcher(g);\n this.logicalBounds = pickLogicalBnds(globalLogicalBnds, g);\n this.sourceBounds = pickSrcBnds(geoJson, g, globalSrcBounds, this.featureMatcher);\n const minLat = this.sourceBounds.lat.min;\n const maxLat = this.sourceBounds.lat.max;\n\n let projection: ICoordinateTransformation;\n\n switch (projectionType) {\n case 'equirectangular':\n projection = new IdentityTransform();\n break;\n case 'mercator':\n if (Math.abs(minLat) > 85 || Math.abs(maxLat) > 85) {\n throw new Error(\n `Invalid latitude boundaries for mercator projection : ${minLat}/${maxLat}`\n );\n }\n projection = new MercatorTransformation();\n break;\n default: {\n throw new Error(`Unsupported projection: ${projectionType}`);\n }\n }\n const projectedBounds = calculatedTargetBounds(projection, this.sourceBounds);\n const scaleTransformation = new LinearTransformation(\n logicalSpace,\n logicalSpace,\n flipBounds(projectedBounds, ['y']),\n this.logicalBounds,\n null,\n true\n );\n this.transformation = new TransformationChain([projection, scaleTransformation]);\n }\n\n public contains(x: number, y: number): boolean {\n const bounds = get(this.group, ['logicalBounds']);\n if (!bounds) {\n return true;\n }\n // return whether or not the x,y mouse screen location is inside this feature collection\n return BoundsUtils.contains(bounds, { x }, { y });\n }\n\n public getSvgNode(ref: (el: SVGSVGElement) => void): React.ReactNode {\n const { features } = this.geoJson;\n const renderer = new GeometryStreamSVGRenderer(this.transformation);\n renderer.beginNode('svg', {\n ref, // remember, 'ref' is a special attribute in react. It's a callback function called on node creation\n height: BoundsUtils.distance(this.logicalBounds.y),\n width: BoundsUtils.distance(this.logicalBounds.x),\n });\n features.forEach((feature: Record<string, unknown>): void => {\n if (this.featureMatcher(feature)) {\n renderGeoJsonFeature(feature, renderer, this.sourceBounds);\n }\n });\n renderer.endNode();\n return renderer.getRoot();\n }\n\n public resolveAlias(alias: string): string {\n if (!this.aliases) {\n this.aliases = GeoJsonFeatureCollection.makeAliasMap(this.geoJson.features); // memoize\n }\n\n const { aliases } = this;\n if (aliases) {\n return aliases.get(alias.toLocaleLowerCase()) || alias;\n }\n return alias;\n }\n\n static makeAliasMap(features: Record<string, any>[]): Map<string, string> {\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n return features.reduce((aliases: Map<string, string>, feature: Record<string, any>) => {\n const geoJsonProperties = feature.properties;\n const name = geoJsonProperties.iso_3166_2;\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n Object.keys(geoJsonProperties).forEach(k => {\n if (k !== name) {\n aliases.set(geoJsonProperties[k].toLowerCase(), name); // alias all the other properies to the name property\n }\n });\n return aliases;\n }, new Map()) as Map<string, string>;\n }\n}\n","module.exports = require(\"@turf/bbox-clip\");","/* eslint-disable class-methods-use-this */\nimport { DataPoint, geoSpace, logicalSpace } from './ICoordinateTransformation';\nimport CoordinateTransformation from './CoordinateTransformation';\n\n// transform converts degrees to an x,y mercator map whose units are radians. InverseTransform goes from radians on the x,y map back to degrees.\n\nexport class MercatorTransformation extends CoordinateTransformation {\n public constructor() {\n super(geoSpace, logicalSpace);\n }\n\n public transformBack(coord: DataPoint): DataPoint {\n const { x, y } = coord;\n return {\n long: (x * 180) / Math.PI,\n lat: ((2 * Math.atan(Math.exp(y)) - Math.PI / 2) * 180) / Math.PI,\n };\n }\n\n public transform(coord: DataPoint): DataPoint {\n let { lat, long } = coord;\n if (long > 180) {\n console.warn(`Mercator projection: Truncating illegal longitude to 180: long`);\n long = 180;\n }\n if (long < -180) {\n console.warn(`Mercator projection: Truncating illegal longitude to -180: long`);\n long = -180;\n }\n if (lat > 85) {\n console.warn(`Mercator projection: Truncating illegal latitude to 85: lat`);\n lat = 85;\n }\n if (lat < -85) {\n console.warn(`Mercator projection: Truncating illegal latitude to -85: lat`);\n lat = -85;\n }\n return {\n x: (Math.PI * long) / 180,\n y: Math.log(Math.tan(Math.PI / 4 + ((lat / 180) * Math.PI) / 2)),\n };\n }\n}\n","/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { GeometryStream } from './GeometryStream';\nimport ICoordinateTransformation, {\n geoSpace,\n logicalSpace,\n DataPoint,\n Bounds,\n} from './ICoordinateTransformation';\nimport CoordinateTransformation from './CoordinateTransformation';\nimport BoundsCollector from './BoundsCollector';\nimport { NodeTreeReactGenerator } from './NodeTreeReactGenerator';\n\n// fixme TODO: should the identity transform really have different source and target spaces? That's a bit confusing\n// as one would expect the identity transform could be inserted anywhere in a TransformationChain\nexport class IdentityTransform extends CoordinateTransformation {\n public constructor() {\n super(geoSpace, logicalSpace);\n }\n\n public transform(sourceCoords: DataPoint): DataPoint {\n return { x: sourceCoords.long, y: sourceCoords.lat };\n }\n\n public transformBack(targetCoords: DataPoint): DataPoint {\n return { lat: targetCoords.y, long: targetCoords.x };\n }\n}\n\nexport class GeometryStreamSVGRenderer extends NodeTreeReactGenerator implements GeometryStream {\n public transformer: ICoordinateTransformation = new IdentityTransform();\n\n public computeBoundsOnly = false;\n\n private boundsCollector = new BoundsCollector();\n\n public constructor(transformer?: ICoordinateTransformation) {\n super();\n if (transformer) {\n this.transformer = transformer;\n }\n }\n\n public addPoint(p: DataPoint): void {\n this.boundsCollector.addPoint(p);\n if (this.computeBoundsOnly) {\n return;\n }\n const el = super.peek();\n const { points } = el.attributes;\n if (points) {\n el.attributes.points += ' ';\n } else {\n el.attributes.points = ''; // initialize\n }\n const { x, y } = this.transformer.transform(p);\n /*\n if(!x || !y){\n throw new Error(\"DataPoint did not contain an x and y coordinate (cannot be rendered to SVG).: \" + JSON.stringify(p));\n }\n */\n el.attributes.points += `${x},${y}`; // FIXME TODO probably should not look for hard coded x and y in DataPoint\n }\n\n public beginNode(name: string, attributes = {}): void {\n if (this.computeBoundsOnly) {\n return;\n }\n super.beginNode(name, attributes);\n }\n\n public endNode(): void {\n if (this.computeBoundsOnly) {\n return;\n }\n super.endNode();\n }\n\n // automatically compute the logicalBounds based on the points that were added. This is 'auto' style of bounding box.\n public getBounds(): Bounds {\n return this.boundsCollector.getBounds();\n }\n\n public clear(): void {\n super.clear();\n this.boundsCollector = new BoundsCollector();\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/get\");","import { Bounds, DataPoint } from './ICoordinateTransformation';\nimport { Interval } from './Scale';\n\nexport default class BoundsCollector {\n public intervals: { [axis: string]: Interval } = {};\n\n public getBounds(): Bounds {\n return Object.keys(this.intervals).length > 0 ? this.intervals : undefined;\n }\n\n // expand the Bounds if the added point is outside the Bounds.\n // Since we don't know what they axes will be for a given DataPoint\n public addPoint(p: DataPoint): void {\n Object.keys(p).forEach((axis: string): void => {\n let interval: Interval = this.intervals[axis];\n if (!interval) {\n interval = { min: p[axis], max: p[axis] };\n this.intervals[axis] = interval;\n }\n if (p[axis] < interval.min) {\n interval.min = p[axis];\n }\n if (p[axis] > interval.max) {\n interval.max = p[axis];\n }\n });\n }\n}\n","/* eslint-disable max-classes-per-file */\n/* eslint-disable no-underscore-dangle */\n/* eslint-disable no-param-reassign */\nimport * as React from 'react';\nimport { SerializedTreeRenderer } from './SerializedTreeRenderer';\n// eslint-disable-next-line import/order\nimport camelCase = require('lodash/camelCase');\n\n/**\n * This class represents the structure of a React element.\n */\nexport class ElementStructure {\n public name: string;\n\n public attributes: Record<string, unknown> = {};\n\n public children: React.ReactNode[] = [];\n\n public textContent; // a node may have childen, or text content\n\n /**\n * @constructor\n * @param {string} name - the element's tag name\n * @param {object} attributes - the element's attributes\n * @param {string} textContent - optional text content for a node\n */\n constructor(name: string, attributes = {}, textContent?: string) {\n this.name = name;\n this.attributes = ElementStructure.processStyleAttributes(attributes);\n this.textContent = textContent;\n }\n\n private static processStyleAttributes(a: Record<string, any>): Record<string, any> {\n if (a.style) {\n a.style = ElementStructure.parseStyle(a.style);\n }\n return a;\n }\n\n /**\n * In react, the style attribute is an object, not an inline css style string. This function converts inline css\n * style string into discrete key-value object that plays nicely with react.\n * @param {string} style\n * @returns {object}\n */\n private static parseStyle(style: string): Record<string, unknown> {\n const o = {};\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n style.split(';').forEach(s => {\n const [k, v] = s.split(':');\n o[camelCase(k)] = v;\n });\n return o;\n }\n}\n\n/**\n * This class is used to build up a node tree. The node tree is turned into a ReactNode when the root node of the\n * tree is closed (aka the closing tag).\n */\nexport class NodeTreeReactGenerator implements SerializedTreeRenderer {\n protected _root: React.ReactElement;\n\n protected _stack: ElementStructure[] = [];\n\n decorator: (el: React.ReactElement) => React.ReactElement; // useful to wrap elements in tooltips\n\n /**\n * This method is called to indicate an opening element tag.\n * @param {string} name - the element's tag name\n * @param {object} attributes - the element's attributes\n * @param {string} textContent - optional text content for a node\n */\n beginNode(name: string, attributes = {}, textContent?: string): void {\n const attrCopy = { key: Math.random() };\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n Object.keys(attributes).forEach(k => {\n if (k.startsWith('data-')) {\n attrCopy[k] = attributes[k];\n } else {\n attrCopy[camelCase(k)] = attributes[k];\n }\n });\n\n this._stack.push(new ElementStructure(name, attrCopy, textContent));\n }\n\n /**\n * This method closes a tag. When a tag is closed its ElementStructure is converted to a ReactNode and added to the set of\n * child nodes tracked by the parent's ElementStructure. If the tag being closed is the root node, then the _root\n * is set and we are done, having created the ReactNode representing the entire tree.\n */\n endNode(): void {\n const popped = this._stack.pop();\n const { name, attributes, children, textContent } = popped;\n const el = this.peek();\n let reactNode: React.ReactElement = null;\n if (children.length === 0) {\n if (textContent) {\n reactNode = React.createElement(name, attributes, textContent);\n } else {\n reactNode = React.createElement(name, attributes);\n }\n } else {\n if (textContent) {\n throw new Error(`textContent can't be mixed with children on node ${name}`);\n }\n reactNode = React.createElement(name, attributes, children);\n }\n\n if (this.decorator) {\n reactNode = this.decorator(reactNode);\n }\n\n if (el) {\n el.children.push(reactNode);\n } else {\n this._root = reactNode;\n }\n }\n\n protected peek(): ElementStructure {\n if (this._stack.length === 0) {\n return null;\n }\n return this._stack[this._stack.length - 1];\n }\n\n /**\n * Returns the ReactNode representing the entire tree, or throws Error if tree is not fully processed.\n * @returns {React.ReactElement}\n */\n public getRoot(): React.ReactElement {\n if (this._root) {\n return this._root;\n }\n throw new Error(\n `Can't compute ReactElement until root node has been closed. Node stack: ${this._stack}`\n );\n }\n\n /**\n * Clears internal structures so this instance can be used to process a new tree.\n */\n public clear(): void {\n this._stack = [];\n this._root = null;\n }\n\n /**\n * Allows the current tag and all its children to be erased.\n */\n public cancelNode(): void {\n this._stack.pop();\n }\n}\n","module.exports = require(\"lodash/camelCase\");","import { mapValues } from 'lodash';\nimport { Bounds, DataPoint, Space } from './ICoordinateTransformation';\nimport { Interval, Scale, toInterval } from './Scale';\nimport CoordinateTransformation from './CoordinateTransformation';\n\nconst sign =\n Math.sign ||\n function (n: number): number {\n if (n < 0) return -1;\n if (n > 0) return 1;\n return 0;\n };\n\nconst signedDistance = function distance(interval: Interval): number {\n return interval.max - interval.min;\n};\n\nconst direction = function direction(interval: Interval): number {\n return sign(interval.max - interval.min);\n};\n\nexport interface BoundsInfo {\n sourceBounds: Bounds;\n scaleFactors: DataPoint;\n}\n\nexport const createBoundsInfo = function createBoundsInfo(\n sourceBounds: Bounds,\n transformation: LinearTransformation\n): BoundsInfo {\n return {\n sourceBounds,\n scaleFactors: mapValues(transformation.scales, (scale: Scale): number => scale.scaleFactor),\n };\n};\n\nexport default class LinearTransformation extends CoordinateTransformation {\n private targetCoordinate: { [sourceCoordinate: string]: string } = {};\n\n private sourceCoordinate: { [targetCoordinate: string]: string } = {};\n\n public scales: { [key: string]: Scale };\n\n private readonly preserveAspectRatio: boolean;\n\n public constructor(\n sourceDimensions: Space,\n targetDimensions: Space,\n sourceBounds?: Bounds,\n targetBounds?: Bounds,\n mapping?: { [sourceName: string]: string },\n preserveAspectRatio = true\n ) {\n super(sourceDimensions, targetDimensions);\n\n this.preserveAspectRatio = preserveAspectRatio;\n this.scales = {};\n Object.keys(sourceDimensions).forEach((sourceCoordinate): void => {\n const targetCoordinate = mapping ? mapping[sourceCoordinate] : sourceCoordinate;\n this.scales[sourceCoordinate] = new Scale();\n this.targetCoordinate[sourceCoordinate] = targetCoordinate;\n this.sourceCoordinate[targetCoordinate] = sourceCoordinate;\n });\n if (sourceBounds && targetBounds) {\n this.fit(sourceBounds, targetBounds);\n }\n }\n\n private fit(\n sourceRanges: Bounds,\n targetRanges: { [key: string]: number | Interval }\n ): LinearTransformation {\n if (this.preserveAspectRatio) {\n return this.fitUndistorted(sourceRanges, targetRanges);\n }\n return this.fitIndependently(sourceRanges, targetRanges);\n }\n\n private fitUndistorted(\n sourceRanges: Bounds,\n targetRanges: { [key: string]: number | Interval }\n ): LinearTransformation {\n let minScale = Number.MAX_VALUE;\n Object.keys(sourceRanges).forEach((dimension): void => {\n const targetDimension = this.targetCoordinate[dimension];\n if (!targetRanges[targetDimension]) {\n throw new Error(`Missing targetRanges for dimension ${targetDimension}`);\n }\n const range = sourceRanges[dimension];\n const sourceDistance = Math.abs(range.max - range.min);\n const targetBounds = toInterval(targetRanges[targetDimension]);\n minScale = Math.min(minScale, Math.abs(signedDistance(targetBounds)) / sourceDistance);\n });\n\n Object.keys(sourceRanges).forEach((dimension): void => {\n const targetDimension = this.targetCoordinate[dimension];\n this.scales[dimension].update(\n minScale * direction(toInterval(sourceRanges[targetDimension])),\n sourceRanges[dimension].min\n );\n });\n return this;\n }\n\n private fitIndependently(\n sourceRanges: Bounds,\n targetRanges: { [key: string]: Interval | number }\n ): LinearTransformation {\n Object.keys(sourceRanges).forEach((dimension): void => {\n const targetDimension = this.targetCoordinate[dimension];\n if (!targetRanges[targetDimension]) {\n throw new Error(`Missing parameter targetRanges for dimension ${dimension}`);\n }\n this.scales[dimension].fit(sourceRanges[dimension], targetRanges[targetDimension]);\n });\n return this;\n }\n\n public transform(sourcePoint: DataPoint): DataPoint {\n const result: DataPoint = {};\n Object.keys(this.sourceSpace).forEach(\n // TODO: move to explicit return\n // eslint-disable-next-line no-return-assign\n (dimension): number =>\n (result[this.targetCoordinate[dimension]] = this.scales[dimension].source2Target(\n sourcePoint[dimension]\n ))\n );\n return result;\n }\n\n public transformBack(targetPoint: DataPoint): DataPoint {\n const result: DataPoint = {};\n Object.keys(this.targetSpace).forEach((coordinate): void => {\n const sourceCoordinate = this.sourceCoordinate[coordinate];\n result[sourceCoordinate] = this.scales[sourceCoordinate].target2Source(targetPoint[coordinate]);\n });\n return result;\n }\n\n public zoomCoordinate(\n dimension: string,\n physicalCenter: number,\n factor: number,\n minScale?: number,\n maxScale?: number\n ): LinearTransformation {\n const scale = this.scales[this.sourceCoordinate[dimension]];\n const currentScale = scale.scaleFactor;\n\n const newScale = Math.min(\n maxScale || Number.MAX_VALUE,\n Math.max(currentScale * factor, minScale || 0)\n );\n\n const targetCenter = scale.target2Source(physicalCenter);\n scale.zoomAroundSource(targetCenter, newScale);\n\n return this;\n }\n\n public zoomAroundTarget(\n targetCenter: { x: number; y: number },\n factor: number,\n minScale?: number,\n maxScale?: number\n ): LinearTransformation {\n const currentScale = this.scales.x.scaleFactor;\n\n const newScale = Math.min(\n maxScale || Number.MAX_VALUE,\n Math.max(currentScale * factor, minScale || 0)\n );\n\n const sourceCenter = this.transformBack(targetCenter);\n\n ['x', 'y'].forEach((axis): void => {\n const dimension = this.sourceCoordinate[axis];\n this.scales[dimension].zoomAroundSource(sourceCenter[dimension], newScale);\n });\n return this;\n }\n\n public moveTargetWindowBy(delta: DataPoint): LinearTransformation {\n ['x', 'y'].forEach((axis): void => {\n const dimension = this.sourceCoordinate[axis];\n if (delta[axis] != null) {\n this.scales[dimension].moveTargetBy(delta[axis]);\n }\n });\n return this;\n }\n\n public getTransformString(): string {\n const dx = -this.scales.x.offset * this.scales.x.scaleFactor;\n const dy = -this.scales.y.offset * this.scales.y.scaleFactor;\n return `translate(${dx}px, ${dy}px) scale(${this.scales.x.scaleFactor})`;\n }\n}\n","export interface Interval {\n min: number;\n max: number;\n resolution?: number;\n}\nconst isInterval = function isInterval(object: Interval | number): boolean {\n return (object as Interval).min != null && (object as Interval).max != null;\n};\n\nexport const toInterval = function toInterval(object: Interval | number): Interval {\n if (isInterval(object)) {\n return object as Interval;\n }\n\n return { min: 0, max: object as number };\n};\n\nexport class Scale {\n /**\n * beginning of the target window in source coordinates\n */\n public offset: number;\n\n public scaleFactor: number;\n\n public constructor() {\n this.offset = 0;\n this.scaleFactor = 1;\n }\n\n /**\n *\n * @param {number} scaleFactor the ratio of target per source\n * @param {number} targetStart The source coordinate for which the target coordinate is 0\n * @return {this}\n */\n public update(scaleFactor: number, targetStart: number): Scale {\n this.offset = targetStart;\n this.scaleFactor = scaleFactor;\n return this;\n }\n\n public source2Target(sourceCoord: number): number {\n return (sourceCoord - this.offset) * this.scaleFactor;\n }\n\n public target2Source(targetCoord: number): number {\n return targetCoord / this.scaleFactor + this.offset;\n }\n\n /**\n * updates the scale and offset so that the specified source range is mapped to the target range.\n * If a number is specified as the target range, it is interpreted as the width of an interval starting at 0.\n * @param {Interval} sourceRange\n * @param {Interval | number} targetRange\n */\n public fit(sourceRange: Interval, targetRange: Interval | number): void {\n const targetDistance = sourceRange.max - sourceRange.min;\n const interval = toInterval(targetRange);\n\n const sourceDistance = interval.max - interval.min;\n const sourceOffset = interval.min;\n\n const scale = sourceDistance / targetDistance;\n this.update(scale, sourceRange.min - (sourceOffset || 0) / scale);\n }\n\n /**\n * adjusts scale factor and offset so that the target value for the specified source center does not change\n * @param {number} sourceCenter\n * @param {number} newScale\n */\n public zoomAroundSource(sourceCenter: number, newScale: number): void {\n this.offset =\n (sourceCenter * (newScale - this.scaleFactor) + this.offset * this.scaleFactor) / newScale;\n this.scaleFactor = newScale;\n }\n\n /**\n * moves the target range by the specified amount in target coordinates\n * @param {number} deltaTarget\n */\n public moveTargetBy(deltaTarget: number): void {\n this.offset += deltaTarget / this.scaleFactor;\n }\n}\n"],"sourceRoot":""}
1
+ {"version":3,"sources":["webpack:///webpack/bootstrap","webpack:///external \"react\"","webpack:///external \"@splunk/visualizations-shared/SanitizeProps\"","webpack:///external \"@babel/runtime/helpers/toConsumableArray\"","webpack:///external \"styled-components\"","webpack:///external \"@babel/runtime/helpers/createClass\"","webpack:///external \"@babel/runtime/helpers/classCallCheck\"","webpack:///external \"lodash\"","webpack:///external \"@splunk/themes/variables\"","webpack:///external \"@babel/runtime/helpers/inherits\"","webpack:///external \"@babel/runtime/helpers/possibleConstructorReturn\"","webpack:///external \"@babel/runtime/helpers/getPrototypeOf\"","webpack:///external \"@splunk/themes/pick\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/ICoordinateTransformation.ts","webpack:///./src/visualizations/SvgChoropleth/SvgChoropleth.tsx","webpack:///./src/visualizations/SvgChoropleth/src/utils/CoordinateTransformation.ts","webpack:///external \"@babel/runtime/helpers/slicedToArray\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/TransformationChain.ts","webpack:///./src/visualizations/SvgChoropleth/src/utils/BoundsUtils.ts","webpack:///./src/visualizations/GeoJsonChoropleth/GeoJsonChoropleth.tsx","webpack:///external \"@babel/runtime/helpers/assertThisInitialized\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/GeoJsonFeatureCollection.ts","webpack:///external \"@turf/bbox-clip\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/MercatorTransformation.ts","webpack:///./src/visualizations/SvgChoropleth/src/utils/GeometryStreamSVGRenderer.ts","webpack:///external \"@babel/runtime/helpers/get\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/BoundsCollector.ts","webpack:///./src/visualizations/SvgChoropleth/src/utils/NodeTreeReactGenerator.ts","webpack:///external \"lodash/camelCase\"","webpack:///./src/visualizations/SvgChoropleth/src/utils/LinearTransformation.ts","webpack:///./src/visualizations/SvgChoropleth/src/utils/Scale.ts"],"names":["lodash_1","require","exports","screenSpace","x","unit","y","geoSpace","lat","long","logicalSpace","flipBounds","bounds","flipAxis","result","cloneDeep","forEach","axis","min","max","visibleSourceBounds","transformation","targetBounds","minTargetCoordinates","mapValues","interval","maxTargetCoordinates","minSourceCoordinates","transformBack","maxSourceCoordinates","Object","keys","sourceSpace","calculatedTargetBounds","calculateTargetBounds","sourceBounds","transform","targetSpace","isSpaceCompatible","s1","s2","isEqual","React","styled_components_1","DATA_ATTRIBUTE","StyledSvgChoropleth","default","div","withConfig","displayName","componentId","props","backgroundColor","SvgChoropleth","_React$Component","_inherits","_super","_createSuper","_this","_classCallCheck","call","containerRef","createRef","highlightedCountry","getLocalCoords","clientX","clientY","rect","current","getBoundingClientRect","physX","left","physY","top","handleMapClick","event","pos","_this$props","featureCollection","onClick","clickedCoords","feature","target","wholeFeature","id","parentNode","handleFeatureEnter","ev","ownerSVGElement","unHighlightCountry","highlightCountry","onFeatureHover","featureId","label","getAttribute","value","handleFeatureLeave","registerSvg","el","svgDom","_this$props2","_this$props2$selector","selector","strokeColor","fillColor","onmouseover","onmouseout","querySelectorAll","node","style","stroke","fill","updateSvg","state","svgNode","getSvgNode","_createClass","key","shouldComponentUpdate","nextProps","nextState","shouldUpdate","componentDidUpdate","prevProps","setState","getFeatureId","alias","resolveAlias","firstLandlockedCountry","querySelector","parent","clone","cloneNode","strokeHighlightColor","insertBefore","removeChild","_this2","_props$selector","data","dataHashMap","featureIDs","index","values","nodeData","get","setAttribute","removeAttribute","render","_this$props$backgroun","createElement","onMouseDown","ref","Component","ICoordinateTransformation_1","TransformationChain_1","CoordinateTransformation","appendTransformation","Error","INCOMPATIBLE_SPACES_ERROR","TransformationChain","transformations","_toConsumableArray","last","concat","JSON","stringify","logicalCoords","currentCoords","physicalCoords","idx","length","BoundsUtils","contains","dp1","dp2","withinInterval","toTurfBBox","within","v","distance","logicalBoundsToCssStyle","logicalBounds","xInterval","yInterval","position","width","height","border","dp","pick_1","variables_1","SanitizeProps_1","SvgChoropleth_1","GeoJsonFeatureCollection_1","BoundsUtils_1","LABEL_FONT_SIZE","round2","Math","round","estimateTextWidth","text","fontsize","avgLowerCaseWidth","avgUpperCaseWidth","c","charAt","includes","toUpperCase","valueText","magnitude","floor","log10","abs","divisor","pow","suffixList","suffix","createFeatureCollections","projection","geoJson","geoFeatureGroups","featureCollections","g","push","name","undefined","TTArgType","TooltipBubble","attrs","enterprise","light","white","dark","prisma","backgroundColorPopup","maxTextWidth","TooltipLabel","contentColorDefault","ArrowDown","TooltipValue","contentColorActive","GeoJsonChoroplethContainer","black","backgroundColorSidebar","ToolTip","arg","reference","pointerEvents","visibility","display","flexDirection","alignItems","justifyContent","fontSize","GeoJsonChoropleth","toolTipRef","toolTip","cursorPos","handleMouseMove","bind","_assertThisInitialized","handleFeatureHover","_ref","externalHandler","scaleX","offsetWidth","scaleY","offsetHeight","children","relevantProps","omit","f","assign","svgChoropleth","onMouseMove","withSanitizedProps","bbox_clip_1","MercatorTransformation_1","GeometryStreamSVGRenderer_1","LinearTransformation_1","MATCH_ALL_FEATUREGROUP_MATCHER","featureGroupMatcher","featureMatcher","regex","property","matcher","RegExp","val","test","DEFAULT_LOGICAL_BOUNDS","pickLogicalBnds","globalLogicalBnds","ring","coords","renderer","beginNode","i","_coords$i","_slicedToArray","cancelNode","console","warn","addPoint","endNode","polygon","poly","renderGeoJsonFeature","bbox","type","geometry","properties","iso_3166_2","className","multis","multi","rings","r","computeBounds","boundsComputer","GeometryStreamSVGRenderer","computeBoundsOnly","features","getBounds","pickSrcBnds","globalSrcBnds","b","GeoJsonFeatureCollection","projectionType","globalSrcBounds","group","minLat","maxLat","IdentityTransform","MercatorTransformation","projectedBounds","scaleTransformation","getRoot","aliases","makeAliasMap","toLocaleLowerCase","reduce","geoJsonProperties","k","set","toLowerCase","Map","CoordinateTransformation_1","_CoordinateTransforma","coord","PI","atan","exp","log","tan","BoundsCollector_1","NodeTreeReactGenerator_1","sourceCoords","targetCoords","_NodeTreeReactGenerat","_super2","transformer","boundsCollector","p","_get","_getPrototypeOf","prototype","points","attributes","_this$transformer$tra","arguments","clear","NodeTreeReactGenerator","BoundsCollector","intervals","camelCase","ElementStructure","textContent","processStyleAttributes","a","parseStyle","o","split","s","_s$split","_s$split2","_stack","attrCopy","random","startsWith","popped","pop","peek","reactNode","decorator","_root","Scale_1","sign","n","signedDistance","direction","createBoundsInfo","scaleFactors","scales","scale","scaleFactor","LinearTransformation","sourceDimensions","targetDimensions","mapping","preserveAspectRatio","targetCoordinate","sourceCoordinate","Scale","fit","sourceRanges","targetRanges","fitUndistorted","fitIndependently","minScale","Number","MAX_VALUE","dimension","targetDimension","range","sourceDistance","toInterval","update","_this3","sourcePoint","_this4","source2Target","targetPoint","_this5","coordinate","target2Source","zoomCoordinate","physicalCenter","factor","maxScale","currentScale","newScale","targetCenter","zoomAroundSource","zoomAroundTarget","_this6","sourceCenter","moveTargetWindowBy","delta","_this7","moveTargetBy","getTransformString","dx","offset","dy","isInterval","object","targetStart","sourceCoord","targetCoord","sourceRange","targetRange","targetDistance","sourceOffset","deltaTarget"],"mappings":";;;;;;;QAAA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;;QAEA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;;;QAGA;QACA;;QAEA;QACA;;QAEA;QACA;QACA;QACA,0CAA0C,gCAAgC;QAC1E;QACA;;QAEA;QACA;QACA;QACA,wDAAwD,kBAAkB;QAC1E;QACA,iDAAiD,cAAc;QAC/D;;QAEA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA;QACA,yCAAyC,iCAAiC;QAC1E,gHAAgH,mBAAmB,EAAE;QACrI;QACA;;QAEA;QACA;QACA;QACA,2BAA2B,0BAA0B,EAAE;QACvD,iCAAiC,eAAe;QAChD;QACA;QACA;;QAEA;QACA,sDAAsD,+DAA+D;;QAErH;QACA;;;QAGA;QACA;;;;;;;;AClFA,kC;;;;;;;ACAA,wE;;;;;;;ACAA,qE;;;;;;;ACAA,8C;;;;;;;;;;;;;;ACAA,+D;;;;;;ACAA,kE;;;;;;;;;ACAA,mC;;;;;;ACAA,qD;;;;;;ACAA,4D;;;;;;ACAA,6E;;;;;;ACAA,kE;;;;;;;;;ACAA,gD;;;;;;;;;;;;;;ACAA,IAAAA,QAAA,GAAAC,mBAAA;AAgBaC,OAAA,CAAAC,WAAW,GAAU;EAAEC,CAAC,EAAE;IAAEC,IAAI,EAAE;EAAO,CAAE;EAAEC,CAAC,EAAE;IAAED,IAAI,EAAE;EAAO;AAAE,CAAE;AAEnEH,OAAA,CAAAK,QAAQ,GAAU;EAC3BC,GAAG,EAAE;IAAEH,IAAI,EAAE;EAAG,CAAE;EAClBI,IAAI,EAAE;IAAEJ,IAAI,EAAE;EAAG;CACpB;AAEYH,OAAA,CAAAQ,YAAY,GAAU;EAC/BN,CAAC,EAAE;IAAEC,IAAI,EAAE;EAAI,CAAE;EACjBC,CAAC,EAAE;IAAED,IAA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CAACgD,MAAM;IACvD;IAEA;;;;;;EAAA;IAAA/U,GAAA;IAAAtB,KAAA,EAMO,SAAA8T,IAAI8C,WAAqB,EAAEC,WAA8B;MAC5D,IAAMC,cAAc,GAAGF,WAAW,CAACxb,GAAG,GAAGwb,WAAW,CAACzb,GAAG;MACxD,IAAMO,QAAQ,GAAGvB,OAAA,CAAAua,UAAU,CAACmC,WAAW,CAAC;MAExC,IAAMpC,cAAc,GAAG/Y,QAAQ,CAACN,GAAG,GAAGM,QAAQ,CAACP,GAAG;MAClD,IAAM4b,YAAY,GAAGrb,QAAQ,CAACP,GAAG;MAEjC,IAAMiY,KAAK,GAAGqB,cAAc,GAAGqC,cAAc;MAC7C,IAAI,CAACnC,MAAM,CAACvB,KAAK,EAAEwD,WAAW,CAACzb,GAAG,GAAG,CAAC4b,YAAY,IAAI,CAAC,IAAI3D,KAAK,CAAC;IACrE;IAEA;;;;;EAAA;IAAA9R,GAAA;IAAAtB,KAAA,EAKO,SAAA2V,iBAAiBG,YAAoB,EAAEL,QAAgB;MAC1D,IAAI,CAACY,MAAM,GACP,CAACP,YAAY,IAAIL,QAAQ,GAAG,IAAI,CAACpC,WAAW,CAAC,GAAG,IAAI,CAACgD,MAAM,GAAG,IAAI,CAAChD,WAAW,IAAIoC,QAAQ;MAC9F,IAAI,CAACpC,WAAW,GAAGoC,QAAQ;IAC/B;IAEA;;;;EAAA;IAAAnU,GAAA;IAAAtB,KAAA,EAIO,SAAAkW,aAAac,WAAmB;MACnC,IAAI,CAACX,MAAM,IAAIW,WAAW,GAAG,IAAI,CAAC3D,WAAW;IACjD;EAAC;EAAA,OAAAQ,KAAA;AAAA;AAnEL1Z,OAAA,CAAA0Z,KAAA,GAAAA,KAAA,C","file":"GeoJsonChoropleth.js","sourcesContent":[" \t// The module cache\n \tvar installedModules = {};\n\n \t// The require function\n \tfunction __webpack_require__(moduleId) {\n\n \t\t// Check if module is in cache\n \t\tif(installedModules[moduleId]) {\n \t\t\treturn installedModules[moduleId].exports;\n \t\t}\n \t\t// Create a new module (and put it into the cache)\n \t\tvar module = installedModules[moduleId] = {\n \t\t\ti: moduleId,\n \t\t\tl: false,\n \t\t\texports: {}\n \t\t};\n\n \t\t// Execute the module function\n \t\tmodules[moduleId].call(module.exports, module, module.exports, __webpack_require__);\n\n \t\t// Flag the module as loaded\n \t\tmodule.l = true;\n\n \t\t// Return the exports of the module\n \t\treturn module.exports;\n \t}\n\n\n \t// expose the modules object (__webpack_modules__)\n \t__webpack_require__.m = modules;\n\n \t// expose the module cache\n \t__webpack_require__.c = installedModules;\n\n \t// define getter function for harmony exports\n \t__webpack_require__.d = function(exports, name, getter) {\n \t\tif(!__webpack_require__.o(exports, name)) {\n \t\t\tObject.defineProperty(exports, name, { enumerable: true, get: getter });\n \t\t}\n \t};\n\n \t// define __esModule on exports\n \t__webpack_require__.r = function(exports) {\n \t\tif(typeof Symbol !== 'undefined' && Symbol.toStringTag) {\n \t\t\tObject.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });\n \t\t}\n \t\tObject.defineProperty(exports, '__esModule', { value: true });\n \t};\n\n \t// create a fake namespace object\n \t// mode & 1: value is a module id, require it\n \t// mode & 2: merge all properties of value into the ns\n \t// mode & 4: return value when already ns object\n \t// mode & 8|1: behave like require\n \t__webpack_require__.t = function(value, mode) {\n \t\tif(mode & 1) value = __webpack_require__(value);\n \t\tif(mode & 8) return value;\n \t\tif((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;\n \t\tvar ns = Object.create(null);\n \t\t__webpack_require__.r(ns);\n \t\tObject.defineProperty(ns, 'default', { enumerable: true, value: value });\n \t\tif(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));\n \t\treturn ns;\n \t};\n\n \t// getDefaultExport function for compatibility with non-harmony modules\n \t__webpack_require__.n = function(module) {\n \t\tvar getter = module && module.__esModule ?\n \t\t\tfunction getDefault() { return module['default']; } :\n \t\t\tfunction getModuleExports() { return module; };\n \t\t__webpack_require__.d(getter, 'a', getter);\n \t\treturn getter;\n \t};\n\n \t// Object.prototype.hasOwnProperty.call\n \t__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };\n\n \t// __webpack_public_path__\n \t__webpack_require__.p = \"\";\n\n\n \t// Load entry module and return exports\n \treturn __webpack_require__(__webpack_require__.s = 51);\n","module.exports = require(\"react\");","module.exports = require(\"@splunk/visualizations-shared/SanitizeProps\");","module.exports = require(\"@babel/runtime/helpers/toConsumableArray\");","module.exports = require(\"styled-components\");","module.exports = require(\"@babel/runtime/helpers/createClass\");","module.exports = require(\"@babel/runtime/helpers/classCallCheck\");","module.exports = require(\"lodash\");","module.exports = require(\"@splunk/themes/variables\");","module.exports = require(\"@babel/runtime/helpers/inherits\");","module.exports = require(\"@babel/runtime/helpers/possibleConstructorReturn\");","module.exports = require(\"@babel/runtime/helpers/getPrototypeOf\");","module.exports = require(\"@splunk/themes/pick\");","import { mapValues, cloneDeep, isEqual } from 'lodash';\nimport { Interval } from './Scale';\n\nexport interface Dimension {\n unit: string;\n}\nexport interface Space {\n [axis: string]: Dimension;\n}\nexport interface DataPoint {\n [axis: string]: number;\n}\nexport interface Bounds {\n [axis: string]: Interval;\n}\n\nexport const screenSpace: Space = { x: { unit: 'pixel' }, y: { unit: 'pixel' } };\n\nexport const geoSpace: Space = {\n lat: { unit: '°' },\n long: { unit: '°' },\n};\n\nexport const logicalSpace: Space = {\n x: { unit: null },\n y: { unit: null },\n};\n\nexport const flipBounds = function (bounds: Bounds, flipAxis: string[]): Bounds {\n const result = cloneDeep(bounds);\n flipAxis.forEach((axis): void => {\n result[axis].min = bounds[axis].max;\n result[axis].max = bounds[axis].min;\n });\n return result;\n};\n\nexport default interface ICoordinateTransformation {\n sourceSpace: Space;\n targetSpace: Space;\n\n /**\n *\n * @param sourcePoint - coords in source space\n * @return coords in target dimensions\n */\n transform(sourcePoint: DataPoint): DataPoint;\n\n /**\n *\n * @param targetPoint - coords in target space\n * @return coords in source dimensions\n */\n transformBack(targetPoint: DataPoint): DataPoint;\n\n /**\n * returns a new TransformationChain without modifying this Transformation or Chain\n * @param {ICoordinateTransformation} transformation\n * @return {ICoordinateTransformation}\n */\n appendTransformation(transformation: ICoordinateTransformation): ICoordinateTransformation;\n}\n\nexport const visibleSourceBounds = function visibleSourceBounds(\n transformation: ICoordinateTransformation,\n targetBounds: Bounds\n): Bounds {\n const minTargetCoordinates = mapValues(targetBounds, (interval: Interval): number => interval.min);\n const maxTargetCoordinates = mapValues(targetBounds, (interval: Interval): number => interval.max);\n\n const minSourceCoordinates = transformation.transformBack(minTargetCoordinates);\n const maxSourceCoordinates = transformation.transformBack(maxTargetCoordinates);\n\n const result: Bounds = {};\n Object.keys(transformation.sourceSpace).forEach((axis): void => {\n result[axis] = { min: minSourceCoordinates[axis], max: maxSourceCoordinates[axis] };\n });\n\n return result;\n};\n\n/**\n * TODO: this is a suboptimal function name. It should be called transformBoundingBox. It's also a very\n * strange way to go about it. Impl seems counterintuitive\n * @param {ICoordinateTransformation} transformation\n * @param {Bounds} sourceBounds\n * @returns {Bounds}\n */\nexport const calculatedTargetBounds = function calculateTargetBounds(\n transformation: ICoordinateTransformation,\n sourceBounds: Bounds\n): Bounds {\n const minSourceCoordinates = mapValues(sourceBounds, (interval: Interval): number => interval.min);\n const maxSourceCoordinates = mapValues(sourceBounds, (interval: Interval): number => interval.max);\n\n const minTargetCoordinates = transformation.transform(minSourceCoordinates);\n const maxTargetCoordinates = transformation.transform(maxSourceCoordinates);\n\n const result: Bounds = {};\n Object.keys(transformation.targetSpace).forEach((axis): void => {\n result[axis] = { min: minTargetCoordinates[axis], max: maxTargetCoordinates[axis] };\n });\n\n return result;\n};\n\nexport function isSpaceCompatible(s1: Space, s2: Space): boolean {\n return isEqual(s1, s2);\n}\n","/* eslint-disable no-param-reassign */\nimport * as React from 'react';\nimport { get, isEqual } from 'lodash';\nimport styled from 'styled-components';\nimport { ISvgFeatureCollection } from './src/utils/ISvgFeatureCollection';\nimport { DataPoint } from './src/utils/ICoordinateTransformation';\n\nexport const DATA_ATTRIBUTE = 'data-value';\n\nexport interface SvgChoroplethProps {\n featureCollection: ISvgFeatureCollection;\n data: { featureIDs: string[]; fill: string[]; values: any[] };\n fillColor: string;\n strokeColor: string;\n strokeHighlightColor?: string;\n backgroundColor?: string;\n selector: string;\n onFeatureHover: (params: { featureId: string; value: any; label?: string }) => void;\n onClick?: (sourceCoordinates: DataPoint, featureId: string) => void;\n}\n\nexport interface SvgChoroplethState {\n svgNode: React.ReactNode;\n}\n\nexport { GeoFeatureGroup } from './src/utils/GeoTypes';\n\ninterface StyledSvgChoroplethProps {\n readonly backgroundColor: string;\n}\n\nconst StyledSvgChoropleth = styled.div<StyledSvgChoroplethProps>`\n display: flex;\n flex-direction: column;\n position: relative;\n background-color: ${(props): string => props.backgroundColor};\n`;\n\nexport default class SvgChoropleth extends React.Component<SvgChoroplethProps, SvgChoroplethState> {\n containerRef: React.RefObject<HTMLDivElement> = React.createRef();\n\n // lastFeatureStroke: string;\n svgDom: SVGElement;\n\n highlightedCountry: SVGElement = null;\n\n constructor(props: SvgChoroplethProps) {\n super(props);\n const { featureCollection } = props;\n this.state = { svgNode: featureCollection.getSvgNode(this.registerSvg) };\n }\n\n shouldComponentUpdate(nextProps: Readonly<SvgChoroplethProps>, nextState: SvgChoroplethState): boolean {\n const shouldUpdate =\n !isEqual(nextState.svgNode, this.state.svgNode) || !isEqual(nextProps, this.props);\n return shouldUpdate;\n }\n\n componentDidUpdate(prevProps): void {\n if (this.props !== prevProps) {\n if (prevProps.featureCollection !== this.props.featureCollection) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({\n svgNode: this.props.featureCollection.getSvgNode(this.registerSvg),\n });\n } else {\n this.updateSvg(this.props);\n }\n }\n }\n\n getLocalCoords = (clientX: number, clientY: number): { x: number; y: number } => {\n const rect = this.containerRef.current.getBoundingClientRect();\n const physX = rect.left;\n const physY = rect.top;\n return { x: clientX - physX, y: clientY - physY };\n };\n\n handleMapClick = (event: React.MouseEvent<HTMLInputElement>): void => {\n const { clientX, clientY } = event;\n const pos = this.getLocalCoords(clientX, clientY);\n const { featureCollection, onClick } = this.props;\n const clickedCoords: DataPoint = featureCollection.transformation.transformBack(pos);\n const feature: SVGSVGElement = event.target as SVGSVGElement;\n const wholeFeature: SVGElement = feature.id ? feature : (feature.parentNode as SVGElement);\n if (onClick) {\n onClick(clickedCoords, wholeFeature.id);\n }\n };\n\n handleFeatureEnter = (ev: MouseEvent): void => {\n const feature: SVGSVGElement = ev.target as SVGSVGElement;\n\n if (!feature.id && !feature.ownerSVGElement) {\n return;\n }\n\n const wholeFeature: SVGElement = feature.id ? feature : (feature.parentNode as SVGElement);\n // remove the highlighted country IF we are entering a different country\n if (this.highlightedCountry && wholeFeature.id !== this.highlightedCountry.id) {\n this.unHighlightCountry();\n }\n this.highlightCountry(wholeFeature);\n\n if (this.props.onFeatureHover) {\n this.props.onFeatureHover({\n featureId: wholeFeature.id,\n label: wholeFeature.getAttribute('label_en'),\n value: wholeFeature.getAttribute(DATA_ATTRIBUTE),\n });\n }\n };\n\n handleFeatureLeave = (ev: MouseEvent): void => {\n const feature: SVGSVGElement = ev.target as SVGSVGElement;\n\n if (!feature.id && !feature.ownerSVGElement) {\n return;\n }\n\n // 'wholeFeature' means the SVG <g> (group) of multipolygon features\n const wholeFeature: SVGElement = feature.id ? feature : (feature.parentNode as SVGElement);\n // handling feature leaving should always only deal with the highlighted feature\n if (wholeFeature !== this.highlightedCountry) {\n return;\n }\n this.unHighlightCountry();\n // wholeFeature.style.stroke = this.lastFeatureStroke;\n\n if (this.props.onFeatureHover) {\n this.props.onFeatureHover({ featureId: null, value: null, label: null });\n }\n };\n\n // allows a provided alias like 'US-CA' to get mapped to 'California' which is the element id for the SVG shape\n private getFeatureId(alias: string): string {\n return this.props.featureCollection.resolveAlias(alias);\n }\n\n registerSvg = (el: SVGSVGElement): void => {\n if (!el) return;\n\n this.svgDom = el;\n\n const { selector = '.feature', strokeColor, fillColor } = this.props;\n\n this.svgDom.onmouseover = this.handleFeatureEnter;\n this.svgDom.onmouseout = this.handleFeatureLeave;\n\n this.svgDom.querySelectorAll(selector).forEach((node: HTMLElement): void => {\n node.style.stroke = strokeColor;\n node.style.fill = fillColor;\n });\n\n this.updateSvg(this.props);\n };\n\n /**\n * this method renders a copy of the polygon on top of all the others, with a highlighted boundary.\n * Technically we don't render in on top of ALL the others. There are three totally landlocked countries,\n * the first of which in our geojson file is Lesotho. These are also the last three countries in the geojson\n * file. So when we insert the highlight shape into the dom, we inert it *before* these three countries.\n * So the highlight for South Africa will not cover up Lesotho.\n * @param {SVGElement} el\n */\n highlightCountry(el: SVGElement): void {\n if (this.highlightedCountry) {\n return; // do not add more than one hovered element at a time\n }\n\n const firstLandlockedCountry = this.svgDom.querySelector(`#Lesotho`);\n const parent = el.parentNode;\n const clone: SVGElement = el.cloneNode(true) as SVGElement;\n const strokeColor = this.props.strokeHighlightColor || '#000';\n clone.style.stroke = strokeColor;\n this.highlightedCountry = clone;\n\n parent.insertBefore(clone, firstLandlockedCountry);\n }\n\n unHighlightCountry(): void {\n if (this.highlightedCountry) {\n this.svgDom.removeChild(this.highlightedCountry);\n }\n this.highlightedCountry = null;\n }\n\n updateSvg(props: SvgChoroplethProps): void {\n if (!this.svgDom) {\n return;\n }\n\n const { selector = '.feature', fillColor, data } = props;\n\n if (!data) {\n return;\n }\n const dataHashMap = {};\n\n data.featureIDs.forEach((alias, index): void => {\n const featureId = this.getFeatureId(alias);\n dataHashMap[featureId] = { fill: data.fill[index], value: data.values[index] };\n });\n this.svgDom.querySelectorAll(selector).forEach((node: HTMLElement): void => {\n const nodeData = dataHashMap[node.id];\n node.style.fill = get(nodeData, 'fill') || fillColor;\n const value = get(nodeData, 'value');\n if (value) {\n node.setAttribute(DATA_ATTRIBUTE, value);\n } else {\n node.removeAttribute(DATA_ATTRIBUTE);\n }\n });\n }\n\n render(): JSX.Element {\n const { backgroundColor = 'transparent' } = this.props;\n // note: for some reason, onclick event can't be triggered on dashboard. So change it to onMouseDown\n return (\n <StyledSvgChoropleth\n data-test=\"styled-svg-choropleth\"\n backgroundColor={backgroundColor}\n onMouseDown={this.handleMapClick}\n ref={this.containerRef}\n >\n {this.state.svgNode}\n </StyledSvgChoropleth>\n );\n }\n}\n","import ICoordinateTransformation, { DataPoint, isSpaceCompatible, Space } from './ICoordinateTransformation';\nimport TransformationChain from './TransformationChain';\n\nexport default abstract class CoordinateTransformation implements ICoordinateTransformation {\n public sourceSpace: Space;\n\n public targetSpace: Space;\n\n static readonly INCOMPATIBLE_SPACES_ERROR =\n \"incompatible transformation (appended source space doesn't match chain's output space)\";\n\n protected constructor(sourceSpace: Space, targetSpace: Space) {\n this.sourceSpace = sourceSpace;\n this.targetSpace = targetSpace;\n }\n\n public appendTransformation(transformation: ICoordinateTransformation): ICoordinateTransformation {\n if (!isSpaceCompatible(this.targetSpace, transformation.sourceSpace)) {\n throw new Error(CoordinateTransformation.INCOMPATIBLE_SPACES_ERROR);\n }\n return new TransformationChain([this, transformation]);\n }\n\n abstract transform(sourcePoint: DataPoint): DataPoint;\n\n abstract transformBack(sourcePoint: DataPoint): DataPoint;\n}\n","module.exports = require(\"@babel/runtime/helpers/slicedToArray\");","import { isEqual, last } from 'lodash';\nimport ICoordinateTransformation, { DataPoint, Space } from './ICoordinateTransformation';\n\nexport default class TransformationChain implements ICoordinateTransformation {\n public sourceSpace: Space;\n\n public targetSpace: Space;\n\n public transformations: ICoordinateTransformation[];\n\n public constructor(transformations: ICoordinateTransformation[]) {\n this.transformations = [...transformations];\n this.sourceSpace = transformations[0].sourceSpace;\n this.targetSpace = last(transformations).targetSpace;\n }\n\n public appendTransformation(transformation: ICoordinateTransformation): TransformationChain {\n if (!isEqual(transformation.sourceSpace, last(this.transformations).targetSpace)) {\n throw new Error(`Can't chain transformations with incompatible spaces \n ${JSON.stringify(last(this.transformations).targetSpace)} -> ${JSON.stringify(\n transformation.sourceSpace\n )}`);\n }\n return new TransformationChain([...this.transformations, transformation]);\n }\n\n public transform(logicalCoords: DataPoint): DataPoint {\n let currentCoords = logicalCoords;\n this.transformations.forEach((transformation): void => {\n currentCoords = transformation.transform(currentCoords);\n });\n return currentCoords;\n }\n\n public transformBack(physicalCoords: DataPoint): DataPoint {\n let currentCoords = physicalCoords;\n for (let idx = this.transformations.length - 1; idx >= 0; idx -= 1) {\n currentCoords = this.transformations[idx].transformBack(currentCoords);\n }\n return currentCoords;\n }\n}\n","import { Bounds, DataPoint } from './ICoordinateTransformation';\nimport { Interval } from './Scale';\n\nexport default class BoundsUtils {\n /**\n * checks if a line segment [dp1, dp2] is fully within a Bounds\n * @param {Bounds} bounds\n * @param {DataPoint} dp1\n * @param {DataPoint} dp2\n * @returns {boolean}\n */\n public static contains(bounds: Bounds, dp1: DataPoint, dp2: DataPoint): boolean {\n return BoundsUtils.withinInterval(bounds, dp1) && BoundsUtils.withinInterval(bounds, dp2);\n }\n\n /**\n * returns a turf BBox from Bounds.\n * @param {Bounds} bounds Interval keys must be 'lat' and 'long'\n * @returns {number[]} formatted in single array as [long.min, lat.min, long.max, lat.max]\n */\n public static toTurfBBox(bounds: Bounds): number[] {\n const { long, lat } = bounds;\n return [long.min, lat.min, long.max, lat.max];\n }\n\n /**\n * tells if the number is within the inclusive Interval\n * @param {Interval} interval\n * @param {number} v\n * @returns {boolean}\n */\n public static within(interval: Interval, v: number): boolean {\n return interval.min <= v && interval.max >= v;\n }\n\n /**\n * returns the distance from interval min to max\n * @param {Interval} interval\n * @returns {number}\n */\n public static distance(interval: Interval): number {\n return interval.max - interval.min;\n }\n\n /**\n * A very special-purposed utility method that creates CSS style from the Bounds.\n * The 2-dimensional rectangular bounds are converted top, left, width, height\n * @param {Bounds} must use 'x' and 'y' axis and assumes x and y are screen-oriented with zero,zero being the top left\n * @returns {object}\n */\n public static logicalBoundsToCssStyle(logicalBounds: Bounds): Record<string, unknown> {\n if (!logicalBounds) {\n return {};\n }\n const xInterval = logicalBounds.x;\n const yInterval = logicalBounds.y;\n // use GeoJsonFeatureGrpup f's Bounds to create a CSS inline style to position the inset using a div\n return {\n position: 'absolute',\n top: yInterval.min,\n left: xInterval.min,\n width: BoundsUtils.distance(xInterval),\n height: BoundsUtils.distance(yInterval),\n border: 'solid 1px',\n };\n }\n\n private static withinInterval(bounds: Bounds, dp: DataPoint): boolean {\n const axis = Object.keys(dp)[0];\n return BoundsUtils.within(bounds[axis], dp[axis]);\n }\n}\n","/* eslint-disable max-classes-per-file */\nimport * as React from 'react';\nimport styled from 'styled-components';\nimport { omit, get, includes } from 'lodash';\nimport pick from '@splunk/themes/pick';\nimport variables from '@splunk/themes/variables';\nimport { withSanitizedProps } from '@splunk/visualizations-shared/SanitizeProps';\nimport SvgChoropleth, { SvgChoroplethProps } from '../SvgChoropleth';\nimport { Bounds, DataPoint } from '../SvgChoropleth/src/utils/ICoordinateTransformation';\nimport GeoJsonFeatureCollection from '../SvgChoropleth/src/utils/GeoJsonFeatureCollection';\nimport { GeoFeatureGroup } from '../SvgChoropleth/src/utils/GeoTypes';\nimport BoundsUtils from '../SvgChoropleth/src/utils/BoundsUtils';\n\nexport interface GeoJsonChoroplethProps {\n name: string;\n geoJson: { features: Record<string, unknown>[] };\n data: { featureIDs: string[]; values: any[]; fill: string[] };\n projection: string;\n sourceBounds: Bounds;\n logicalBounds: Bounds;\n fillColor: string;\n strokeColor: string;\n strokeHighlightColor?: string;\n backgroundColor?: string;\n selector: string;\n onFeatureHover?: (featureId: string) => void;\n onClick?: (sourceCoordinates: DataPoint, featureId: string) => void;\n geoFeatureGroups?: GeoFeatureGroup[];\n theme?: Record<string, unknown>;\n}\n\nexport interface GeoJsonChoroplethState {\n featureCollections: GeoJsonFeatureCollection[];\n toolTip: { label; value };\n}\n\nexport const LABEL_FONT_SIZE = 14;\n\nexport const round2 = function round2(value: number): number {\n return Math.round(value * 100) / 100;\n};\n\n// todo: maybe can refactor to use `computeTextSize` in @splunk/visualizations-shared/domUtils.js\nexport const estimateTextWidth = function estimateTextWidth(text: string, fontsize: number): number {\n if (text == null) {\n return 0;\n }\n const avgLowerCaseWidth = 0.55 * fontsize;\n const avgUpperCaseWidth = 0.7 * fontsize;\n let length = 0;\n for (let pos = 0; pos < text.length; pos += 1) {\n const c = text.charAt(pos);\n if (includes('Iij.,;:!lt/', c)) {\n length += 0.2 * fontsize;\n } else if (c === '_') {\n length += 0.8 * fontsize;\n } else {\n length += c === c.toUpperCase() ? avgUpperCaseWidth : avgLowerCaseWidth;\n }\n }\n return length;\n};\n\n// todo: maybe can refactor to use `formatNumber` in ../utils/numberUtils\nexport const valueText = function valueText(value: number): string {\n if (value === 0) {\n return '0';\n }\n\n if (typeof value === 'string') {\n return value;\n }\n\n const magnitude = Math.floor(Math.log10(Math.abs(value)) / 3);\n const divisor = 10 ** (3 * magnitude);\n\n const suffixList = ['', 'k', 'm', 'bn', 'tn', 'qn'];\n const suffix = magnitude < 0 ? `/${suffixList[-magnitude]}` : suffixList[magnitude];\n\n return `${round2(value / divisor)}${suffix}`;\n};\n\nexport function createFeatureCollections(props: GeoJsonChoroplethProps): GeoJsonFeatureCollection[] {\n const { sourceBounds, logicalBounds, projection, geoJson, geoFeatureGroups } = props;\n const featureCollections = [];\n if (geoFeatureGroups) {\n geoFeatureGroups.forEach((g: GeoFeatureGroup): void => {\n featureCollections.push(\n new GeoJsonFeatureCollection(\n `${props.name}.${g.name}`,\n logicalBounds,\n projection,\n geoJson,\n g,\n sourceBounds\n )\n );\n });\n } else {\n featureCollections.push(\n new GeoJsonFeatureCollection(\n props.name,\n logicalBounds,\n projection,\n geoJson,\n undefined,\n sourceBounds\n )\n );\n }\n return featureCollections;\n}\n\nclass TTArgType {\n reference: React.Ref<any>;\n\n left: number;\n\n top: number;\n\n label: string;\n\n value: any;\n}\n\nconst TooltipBubble = styled.div.attrs(() => ({\n key: 'bubble',\n}))<{\n maxTextWidth: number;\n}>`\n background-color: ${pick({\n enterprise: {\n light: variables.white, // #171d21, so enterpriseDark.defaultBackgroundColor\n dark: '#27292e', // enterpriseBackgroundColor\n },\n prisma: variables.backgroundColorPopup,\n })};\n border-radius: 5px;\n padding: 5px;\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n box-shadow: 0px 5px 14px 0 rgba(0, 0, 100, 0.12);\n width: ${props => props.maxTextWidth}px;\n transition: width 100ms;\n`;\n\nconst TooltipLabel = styled.div.attrs(() => ({\n 'data-test': 'geojson-choropleth-tooltip-label',\n}))<{\n maxTextWidth: number;\n}>`\n margin-bottom: 2px;\n width: ${props => props.maxTextWidth}px;\n text-align: center;\n color: ${pick({\n enterprise: {\n // unfortunately cannot access variables.textGray directly colors since variables are theme-aware\n light: 'rgba(0, 0, 0, 0.65)', // equivalent to enterpriseDark.textGray\n dark: 'rgba(255, 255, 255, 0.7)', // equivalent to enterprise.textGray\n },\n prisma: variables.contentColorDefault,\n })};\n`;\n\nconst ArrowDown = styled.div`\n position: relative;\n top: -1px;\n width: 0px;\n height: 0px;\n border-left: 8px solid transparent;\n border-right: 8px solid transparent;\n border-top: 8px solid\n ${pick({\n enterprise: {\n light: variables.white, // #171d21, so enterpriseDark.defaultBackgroundColor\n dark: '#27292e', // enterpriseBackgroundColor\n },\n prisma: variables.backgroundColorPopup,\n })};\n`;\n\nconst TooltipValue = styled.div.attrs(() => ({\n 'data-test': 'geojson-choropleth-tooltip-value',\n}))`\n color: ${pick({\n enterprise: {\n // unfortunately cannot access variables.textGray directly colors since variables are theme-aware\n light: '#2c2c2c', // equivalent to enterpriseDark.textGray\n dark: 'rgba(255, 255, 255, 0.98)', // equivalent to enterprise.textGray\n },\n prisma: variables.contentColorActive,\n })};\n`;\n\ninterface GeoJsonChoroplethContainerProps {\n backgroundColor: string;\n}\n\nconst GeoJsonChoroplethContainer = styled.div.attrs(() => ({\n 'data-test': 'geojson-choropleth-container',\n}))<GeoJsonChoroplethContainerProps>`\n background-color: ${props =>\n props.backgroundColor ||\n pick({\n enterprise: {\n dark: variables.black,\n light: variables.backgroundColorSidebar,\n },\n prisma: variables.backgroundColorSidebar,\n })};\n position: relative;\n`;\n\nconst ToolTip = function ToolTip(arg: TTArgType): React.ReactElement {\n const { reference, left, top, label, value } = arg;\n\n const maxTextWidth =\n Math.max(estimateTextWidth(label, LABEL_FONT_SIZE), estimateTextWidth(value, LABEL_FONT_SIZE)) + 10;\n\n return (\n <div\n key=\"tooltip\"\n ref={reference}\n style={{\n position: 'absolute',\n top,\n left,\n pointerEvents: 'none',\n visibility: label || value ? 'visible' : 'hidden',\n }}\n >\n <div\n style={{\n position: 'relative',\n left: '-50%',\n top: '-56px',\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'flex-start',\n fontSize: LABEL_FONT_SIZE,\n }}\n >\n <TooltipBubble maxTextWidth={maxTextWidth}>\n <TooltipLabel maxTextWidth={maxTextWidth}> {label} </TooltipLabel>\n <TooltipValue>{valueText(value)}</TooltipValue>\n </TooltipBubble>\n <ArrowDown />\n </div>\n </div>\n );\n};\n\nclass GeoJsonChoropleth extends React.Component<GeoJsonChoroplethProps, GeoJsonChoroplethState> {\n containerRef: React.RefObject<HTMLDivElement> = React.createRef();\n\n toolTipRef: React.RefObject<HTMLDivElement> = React.createRef();\n\n cursorPos: { x: number; y: number };\n\n constructor(props) {\n super(props);\n this.state = { featureCollections: createFeatureCollections(props), toolTip: null };\n this.cursorPos = { x: 0, y: 0 };\n\n this.handleMouseMove = this.handleMouseMove.bind(this);\n this.handleFeatureHover = this.handleFeatureHover.bind(this);\n }\n\n componentDidUpdate(prevProps): void {\n const { sourceBounds, logicalBounds, projection, geoJson } = this.props;\n if (\n prevProps.geoJson !== geoJson ||\n prevProps.sourceBounds !== sourceBounds ||\n prevProps.logicalBounds !== logicalBounds ||\n prevProps.projection !== projection\n ) {\n // eslint-disable-next-line react/no-did-update-set-state\n this.setState({ featureCollections: createFeatureCollections(this.props) });\n }\n }\n\n handleMouseMove(ev: React.MouseEvent<HTMLDivElement, MouseEvent>): void {\n this.cursorPos = this.getLocalCoords(ev.clientX, ev.clientY);\n if (this.toolTipRef.current) {\n this.toolTipRef.current.style.left = `${this.cursorPos.x}px`;\n this.toolTipRef.current.style.top = `${this.cursorPos.y}px`;\n }\n }\n\n handleFeatureHover({ featureId, value, label }): void {\n if (featureId) {\n this.setState({ toolTip: { label: label || featureId, value: value || '-no data-' } });\n } else {\n this.setState({ toolTip: null });\n }\n\n const externalHandler = this.props.onFeatureHover;\n if (externalHandler) {\n externalHandler(featureId);\n }\n }\n\n getLocalCoords(clientX: number, clientY: number): { x: number; y: number } {\n const rect = this.containerRef.current.getBoundingClientRect();\n const physX = rect.left;\n const physY = rect.top;\n const scaleX = this.containerRef.current.offsetWidth / rect.width;\n const scaleY = this.containerRef.current.offsetHeight / rect.height;\n return { x: (clientX - physX) * scaleX, y: (clientY - physY) * scaleY };\n }\n\n public render(): React.ReactElement {\n const children = [];\n const relevantProps = omit(this.props, ['sourceBounds', 'logicalBounds', 'projection']);\n const { toolTip } = this.state;\n\n // create one child SvgChoropleth for each GeoJsonFeatureCollection\n this.state.featureCollections.forEach((f: GeoJsonFeatureCollection): void => {\n const props: SvgChoroplethProps = {\n ...relevantProps,\n onFeatureHover: this.handleFeatureHover,\n featureCollection: f,\n };\n const svgChoropleth = React.createElement(SvgChoropleth, props);\n let style = {};\n const logicalBounds = get(f, ['group', 'logicalBounds']);\n if (logicalBounds) {\n style = BoundsUtils.logicalBoundsToCssStyle(logicalBounds);\n }\n children.push(React.createElement('div', { key: f.name, style }, svgChoropleth));\n });\n return (\n <GeoJsonChoroplethContainer\n ref={this.containerRef}\n onMouseMove={this.handleMouseMove}\n backgroundColor={this.props.backgroundColor}\n >\n {children}\n <ToolTip\n reference={this.toolTipRef}\n left={this.cursorPos.x}\n top={this.cursorPos.y}\n label={get(toolTip, 'label')}\n value={get(toolTip, 'value')}\n />\n </GeoJsonChoroplethContainer>\n );\n }\n}\n\nexport default withSanitizedProps(GeoJsonChoropleth);\n","module.exports = require(\"@babel/runtime/helpers/assertThisInitialized\");","import { get } from 'lodash';\nimport * as turf from '@turf/helpers';\nimport bboxClip from '@turf/bbox-clip';\nimport { ISvgFeatureCollection } from './ISvgFeatureCollection';\nimport { MercatorTransformation } from './MercatorTransformation';\nimport { GeometryStreamSVGRenderer, IdentityTransform } from './GeometryStreamSVGRenderer';\nimport ICoordinateTransformation, {\n Bounds,\n calculatedTargetBounds,\n flipBounds,\n logicalSpace,\n} from './ICoordinateTransformation';\nimport LinearTransformation from './LinearTransformation';\nimport TransformationChain from './TransformationChain';\nimport { GeometryStream } from './GeometryStream';\nimport { GeoFeatureGroup } from './GeoTypes';\nimport BoundsUtils from './BoundsUtils';\n\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nexport const MATCH_ALL_FEATUREGROUP_MATCHER = (feature: Record<string, unknown>): boolean => true;\nexport function featureGroupMatcher(g: GeoFeatureGroup): (feature: Record<string, any>) => boolean {\n if (!g || !g.featureMatcher || !g.featureMatcher.regex || !g.featureMatcher.property) {\n // if no matcher things defined, then we are not filtering features, and therefore should match all\n // eslint-disable-next-line\n return MATCH_ALL_FEATUREGROUP_MATCHER;\n }\n\n const matcher = new RegExp(g.featureMatcher.regex);\n return (feature: Record<string, any>): boolean => {\n const val = get(feature, ['properties', g.featureMatcher.property]);\n if (!val) {\n return false;\n }\n return matcher.test(val);\n };\n}\n\nexport const DEFAULT_LOGICAL_BOUNDS = { x: { min: 0, max: 800 }, y: { min: 0, max: 600 } }; // default logical bounds\n\n// same as with sourceBounds, logical bound can be global or local to the FeatureGroup. They also need to have defaults\n// which are provided here.\nexport function pickLogicalBnds(globalLogicalBnds: Bounds, g: GeoFeatureGroup): Bounds {\n if (g && g.logicalBounds) {\n return g.logicalBounds;\n }\n if (globalLogicalBnds) {\n return globalLogicalBnds;\n }\n\n return DEFAULT_LOGICAL_BOUNDS;\n}\n\nexport function ring(\n coords: number[][],\n renderer: GeometryStream,\n bounds?: Bounds,\n props?: Record<string, unknown>\n): void {\n // polygon coords is array of number array\n renderer.beginNode('polygon', props);\n for (let i = 0; i < coords.length; i += 1) {\n const [long, lat] = coords[i];\n if (bounds && !BoundsUtils.contains(bounds, { long }, { lat })) {\n // the polygon is not entirely contained by the bounds. We must cancel (remove) the polygon along with any\n // points that were previously added to it.\n renderer.cancelNode();\n console.warn(`out-of-bounds polygon dropped: ${JSON.stringify(props)}`);\n return; // bail ... we don't need to endNode() since we cancelled it\n }\n renderer.addPoint({ long, lat });\n }\n renderer.endNode();\n}\n\nexport function polygon(coords: number[][][], renderer: GeometryStream, bounds?: Bounds): void {\n // polygon coords is array of number array\n for (let poly = 0; poly < coords.length; poly += 1) {\n ring(coords[poly], renderer, bounds);\n }\n}\n\nexport function renderGeoJsonFeature(\n feature: Record<string, any>,\n renderer: GeometryStream,\n bounds?: Bounds\n): void {\n const bbox: turf.BBox = bounds ? (BoundsUtils.toTurfBBox(bounds) as turf.BBox) : undefined;\n const { type } = feature.geometry;\n\n if (get(feature, ['properties', 'name']) === 'Antarctica') {\n // skip shapes that cannot be mercator projected\n // no-op\n return;\n }\n // demo hack...\n const props = feature.properties;\n if (props.iso_3166_2) {\n props.id = props.iso_3166_2;\n } else {\n props.id = props.name;\n }\n props.className = 'feature';\n // end demo hack\n switch (type) {\n case 'MultiPolygon': {\n renderer.beginNode('g', props); // svg has groups ('g') but no polygon\n // eslint-disable-next-line no-param-reassign\n feature = bbox ? bboxClip(feature as turf.MultiPolygon, bbox) : feature;\n const multis = get(feature, ['geometry', 'coordinates']);\n multis.forEach((multi: number[][][]): void => polygon(multi, renderer, bounds));\n renderer.endNode();\n break;\n }\n case 'Polygon': {\n // eslint-disable-next-line no-param-reassign\n feature = bbox ? bboxClip(feature as turf.Polygon, bbox) : feature;\n const rings = get(feature, ['geometry', 'coordinates']);\n rings.forEach((r: number[][]): void => ring(r, renderer, bounds, props));\n break;\n }\n default: {\n throw new Error(`Unsupported geojson type: ${type}`);\n }\n }\n}\n\nfunction computeBounds(\n geoJson: Record<string, any>,\n matcher: (feature: Record<string, unknown>) => boolean\n): Bounds {\n // replace the renderer with one that is configured only to compute logicalBounds (for performance)\n const boundsComputer = new GeometryStreamSVGRenderer();\n boundsComputer.computeBoundsOnly = true;\n geoJson.features.forEach((feature: Record<string, unknown>): void => {\n if (matcher(feature)) {\n renderGeoJsonFeature(feature, boundsComputer);\n }\n });\n return boundsComputer.getBounds();\n}\n\n// the source bounds can be provided globally for all feature groups, or they can be provided within a FeatureGroup\n// or they can be omitted entirely which means they must be computed by parsing the geoJson\nfunction pickSrcBnds(\n geoJson: Record<string, unknown>,\n g: GeoFeatureGroup,\n globalSrcBnds: Bounds,\n featureMatcher: (feature: Record<string, unknown>) => boolean\n): Bounds {\n if (g && g.sourceBounds) {\n return g.sourceBounds; // return FeatureGroup \"local\" sourceBounds if they exist.\n }\n\n if (globalSrcBnds) {\n return globalSrcBnds; // return global bounds if they exist\n }\n\n // ...'auto' compute the source bounds from the data.\n const b = computeBounds(geoJson, featureMatcher); // automatically compute sourceBounds if not provided\n if (!b) {\n throw new Error(\n `Could not determine bounds for geoFeatureGroup name='${this.name}' (no features matched)`\n );\n }\n return b;\n}\n\nexport default class GeoJsonFeatureCollection implements ISvgFeatureCollection {\n public name: string;\n\n private readonly sourceBounds: Bounds;\n\n public logicalBounds: Bounds;\n\n private projectionType: string;\n\n public transformation: ICoordinateTransformation;\n\n private geoJson: { features: Record<string, unknown>[] };\n\n private readonly group: GeoFeatureGroup;\n\n private readonly featureMatcher: (feature: Record<string, unknown>) => boolean;\n\n private aliases: Map<string, string>;\n\n public constructor(\n name: string,\n globalLogicalBnds: Bounds,\n projectionType: string,\n geoJson: { features: Record<string, unknown>[] },\n g?: GeoFeatureGroup,\n globalSrcBounds?: Bounds\n ) {\n this.name = name;\n this.projectionType = projectionType || 'mercator';\n this.geoJson = geoJson;\n this.group = g;\n this.featureMatcher = featureGroupMatcher(g);\n this.logicalBounds = pickLogicalBnds(globalLogicalBnds, g);\n this.sourceBounds = pickSrcBnds(geoJson, g, globalSrcBounds, this.featureMatcher);\n const minLat = this.sourceBounds.lat.min;\n const maxLat = this.sourceBounds.lat.max;\n\n let projection: ICoordinateTransformation;\n\n switch (projectionType) {\n case 'equirectangular':\n projection = new IdentityTransform();\n break;\n case 'mercator':\n if (Math.abs(minLat) > 85 || Math.abs(maxLat) > 85) {\n throw new Error(\n `Invalid latitude boundaries for mercator projection : ${minLat}/${maxLat}`\n );\n }\n projection = new MercatorTransformation();\n break;\n default: {\n throw new Error(`Unsupported projection: ${projectionType}`);\n }\n }\n const projectedBounds = calculatedTargetBounds(projection, this.sourceBounds);\n const scaleTransformation = new LinearTransformation(\n logicalSpace,\n logicalSpace,\n flipBounds(projectedBounds, ['y']),\n this.logicalBounds,\n null,\n true\n );\n this.transformation = new TransformationChain([projection, scaleTransformation]);\n }\n\n public contains(x: number, y: number): boolean {\n const bounds = get(this.group, ['logicalBounds']);\n if (!bounds) {\n return true;\n }\n // return whether or not the x,y mouse screen location is inside this feature collection\n return BoundsUtils.contains(bounds, { x }, { y });\n }\n\n public getSvgNode(ref: (el: SVGSVGElement) => void): React.ReactNode {\n const { features } = this.geoJson;\n const renderer = new GeometryStreamSVGRenderer(this.transformation);\n renderer.beginNode('svg', {\n ref, // remember, 'ref' is a special attribute in react. It's a callback function called on node creation\n height: BoundsUtils.distance(this.logicalBounds.y),\n width: BoundsUtils.distance(this.logicalBounds.x),\n });\n features.forEach((feature: Record<string, unknown>): void => {\n if (this.featureMatcher(feature)) {\n renderGeoJsonFeature(feature, renderer, this.sourceBounds);\n }\n });\n renderer.endNode();\n return renderer.getRoot();\n }\n\n public resolveAlias(alias: string): string {\n if (!this.aliases) {\n this.aliases = GeoJsonFeatureCollection.makeAliasMap(this.geoJson.features); // memoize\n }\n\n const { aliases } = this;\n if (aliases) {\n return aliases.get(alias.toLocaleLowerCase()) || alias;\n }\n return alias;\n }\n\n static makeAliasMap(features: Record<string, any>[]): Map<string, string> {\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n return features.reduce((aliases: Map<string, string>, feature: Record<string, any>) => {\n const geoJsonProperties = feature.properties;\n const name = geoJsonProperties.iso_3166_2;\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n Object.keys(geoJsonProperties).forEach(k => {\n if (k !== name) {\n aliases.set(geoJsonProperties[k].toLowerCase(), name); // alias all the other properies to the name property\n }\n });\n return aliases;\n }, new Map()) as Map<string, string>;\n }\n}\n","module.exports = require(\"@turf/bbox-clip\");","/* eslint-disable class-methods-use-this */\nimport { DataPoint, geoSpace, logicalSpace } from './ICoordinateTransformation';\nimport CoordinateTransformation from './CoordinateTransformation';\n\n// transform converts degrees to an x,y mercator map whose units are radians. InverseTransform goes from radians on the x,y map back to degrees.\n\nexport class MercatorTransformation extends CoordinateTransformation {\n public constructor() {\n super(geoSpace, logicalSpace);\n }\n\n public transformBack(coord: DataPoint): DataPoint {\n const { x, y } = coord;\n return {\n long: (x * 180) / Math.PI,\n lat: ((2 * Math.atan(Math.exp(y)) - Math.PI / 2) * 180) / Math.PI,\n };\n }\n\n public transform(coord: DataPoint): DataPoint {\n let { lat, long } = coord;\n if (long > 180) {\n console.warn(`Mercator projection: Truncating illegal longitude to 180: long`);\n long = 180;\n }\n if (long < -180) {\n console.warn(`Mercator projection: Truncating illegal longitude to -180: long`);\n long = -180;\n }\n if (lat > 85) {\n console.warn(`Mercator projection: Truncating illegal latitude to 85: lat`);\n lat = 85;\n }\n if (lat < -85) {\n console.warn(`Mercator projection: Truncating illegal latitude to -85: lat`);\n lat = -85;\n }\n return {\n x: (Math.PI * long) / 180,\n y: Math.log(Math.tan(Math.PI / 4 + ((lat / 180) * Math.PI) / 2)),\n };\n }\n}\n","/* eslint-disable max-classes-per-file */\n/* eslint-disable class-methods-use-this */\nimport { GeometryStream } from './GeometryStream';\nimport ICoordinateTransformation, {\n geoSpace,\n logicalSpace,\n DataPoint,\n Bounds,\n} from './ICoordinateTransformation';\nimport CoordinateTransformation from './CoordinateTransformation';\nimport BoundsCollector from './BoundsCollector';\nimport { NodeTreeReactGenerator } from './NodeTreeReactGenerator';\n\n// fixme TODO: should the identity transform really have different source and target spaces? That's a bit confusing\n// as one would expect the identity transform could be inserted anywhere in a TransformationChain\nexport class IdentityTransform extends CoordinateTransformation {\n public constructor() {\n super(geoSpace, logicalSpace);\n }\n\n public transform(sourceCoords: DataPoint): DataPoint {\n return { x: sourceCoords.long, y: sourceCoords.lat };\n }\n\n public transformBack(targetCoords: DataPoint): DataPoint {\n return { lat: targetCoords.y, long: targetCoords.x };\n }\n}\n\nexport class GeometryStreamSVGRenderer extends NodeTreeReactGenerator implements GeometryStream {\n public transformer: ICoordinateTransformation = new IdentityTransform();\n\n public computeBoundsOnly = false;\n\n private boundsCollector = new BoundsCollector();\n\n public constructor(transformer?: ICoordinateTransformation) {\n super();\n if (transformer) {\n this.transformer = transformer;\n }\n }\n\n public addPoint(p: DataPoint): void {\n this.boundsCollector.addPoint(p);\n if (this.computeBoundsOnly) {\n return;\n }\n const el = super.peek();\n const { points } = el.attributes;\n if (points) {\n el.attributes.points += ' ';\n } else {\n el.attributes.points = ''; // initialize\n }\n const { x, y } = this.transformer.transform(p);\n /*\n if(!x || !y){\n throw new Error(\"DataPoint did not contain an x and y coordinate (cannot be rendered to SVG).: \" + JSON.stringify(p));\n }\n */\n el.attributes.points += `${x},${y}`; // FIXME TODO probably should not look for hard coded x and y in DataPoint\n }\n\n public beginNode(name: string, attributes = {}): void {\n if (this.computeBoundsOnly) {\n return;\n }\n super.beginNode(name, attributes);\n }\n\n public endNode(): void {\n if (this.computeBoundsOnly) {\n return;\n }\n super.endNode();\n }\n\n // automatically compute the logicalBounds based on the points that were added. This is 'auto' style of bounding box.\n public getBounds(): Bounds {\n return this.boundsCollector.getBounds();\n }\n\n public clear(): void {\n super.clear();\n this.boundsCollector = new BoundsCollector();\n }\n}\n","module.exports = require(\"@babel/runtime/helpers/get\");","import { Bounds, DataPoint } from './ICoordinateTransformation';\nimport { Interval } from './Scale';\n\nexport default class BoundsCollector {\n public intervals: { [axis: string]: Interval } = {};\n\n public getBounds(): Bounds {\n return Object.keys(this.intervals).length > 0 ? this.intervals : undefined;\n }\n\n // expand the Bounds if the added point is outside the Bounds.\n // Since we don't know what they axes will be for a given DataPoint\n public addPoint(p: DataPoint): void {\n Object.keys(p).forEach((axis: string): void => {\n let interval: Interval = this.intervals[axis];\n if (!interval) {\n interval = { min: p[axis], max: p[axis] };\n this.intervals[axis] = interval;\n }\n if (p[axis] < interval.min) {\n interval.min = p[axis];\n }\n if (p[axis] > interval.max) {\n interval.max = p[axis];\n }\n });\n }\n}\n","/* eslint-disable max-classes-per-file */\n/* eslint-disable no-underscore-dangle */\n/* eslint-disable no-param-reassign */\nimport * as React from 'react';\nimport { SerializedTreeRenderer } from './SerializedTreeRenderer';\n// eslint-disable-next-line import/order\nimport camelCase = require('lodash/camelCase');\n\n/**\n * This class represents the structure of a React element.\n */\nexport class ElementStructure {\n public name: string;\n\n public attributes: Record<string, unknown> = {};\n\n public children: React.ReactNode[] = [];\n\n public textContent; // a node may have childen, or text content\n\n /**\n * @constructor\n * @param {string} name - the element's tag name\n * @param {object} attributes - the element's attributes\n * @param {string} textContent - optional text content for a node\n */\n constructor(name: string, attributes = {}, textContent?: string) {\n this.name = name;\n this.attributes = ElementStructure.processStyleAttributes(attributes);\n this.textContent = textContent;\n }\n\n private static processStyleAttributes(a: Record<string, any>): Record<string, any> {\n if (a.style) {\n a.style = ElementStructure.parseStyle(a.style);\n }\n return a;\n }\n\n /**\n * In react, the style attribute is an object, not an inline css style string. This function converts inline css\n * style string into discrete key-value object that plays nicely with react.\n * @param {string} style\n * @returns {object}\n */\n private static parseStyle(style: string): Record<string, unknown> {\n const o = {};\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n style.split(';').forEach(s => {\n const [k, v] = s.split(':');\n o[camelCase(k)] = v;\n });\n return o;\n }\n}\n\n/**\n * This class is used to build up a node tree. The node tree is turned into a ReactNode when the root node of the\n * tree is closed (aka the closing tag).\n */\nexport class NodeTreeReactGenerator implements SerializedTreeRenderer {\n protected _root: React.ReactElement;\n\n protected _stack: ElementStructure[] = [];\n\n decorator: (el: React.ReactElement) => React.ReactElement; // useful to wrap elements in tooltips\n\n /**\n * This method is called to indicate an opening element tag.\n * @param {string} name - the element's tag name\n * @param {object} attributes - the element's attributes\n * @param {string} textContent - optional text content for a node\n */\n beginNode(name: string, attributes = {}, textContent?: string): void {\n const attrCopy = { key: Math.random() };\n // eslint-disable-next-line @typescript-eslint/explicit-function-return-type\n Object.keys(attributes).forEach(k => {\n if (k.startsWith('data-')) {\n attrCopy[k] = attributes[k];\n } else {\n attrCopy[camelCase(k)] = attributes[k];\n }\n });\n\n this._stack.push(new ElementStructure(name, attrCopy, textContent));\n }\n\n /**\n * This method closes a tag. When a tag is closed its ElementStructure is converted to a ReactNode and added to the set of\n * child nodes tracked by the parent's ElementStructure. If the tag being closed is the root node, then the _root\n * is set and we are done, having created the ReactNode representing the entire tree.\n */\n endNode(): void {\n const popped = this._stack.pop();\n const { name, attributes, children, textContent } = popped;\n const el = this.peek();\n let reactNode: React.ReactElement = null;\n if (children.length === 0) {\n if (textContent) {\n reactNode = React.createElement(name, attributes, textContent);\n } else {\n reactNode = React.createElement(name, attributes);\n }\n } else {\n if (textContent) {\n throw new Error(`textContent can't be mixed with children on node ${name}`);\n }\n reactNode = React.createElement(name, attributes, children);\n }\n\n if (this.decorator) {\n reactNode = this.decorator(reactNode);\n }\n\n if (el) {\n el.children.push(reactNode);\n } else {\n this._root = reactNode;\n }\n }\n\n protected peek(): ElementStructure {\n if (this._stack.length === 0) {\n return null;\n }\n return this._stack[this._stack.length - 1];\n }\n\n /**\n * Returns the ReactNode representing the entire tree, or throws Error if tree is not fully processed.\n * @returns {React.ReactElement}\n */\n public getRoot(): React.ReactElement {\n if (this._root) {\n return this._root;\n }\n throw new Error(\n `Can't compute ReactElement until root node has been closed. Node stack: ${this._stack}`\n );\n }\n\n /**\n * Clears internal structures so this instance can be used to process a new tree.\n */\n public clear(): void {\n this._stack = [];\n this._root = null;\n }\n\n /**\n * Allows the current tag and all its children to be erased.\n */\n public cancelNode(): void {\n this._stack.pop();\n }\n}\n","module.exports = require(\"lodash/camelCase\");","import { mapValues } from 'lodash';\nimport { Bounds, DataPoint, Space } from './ICoordinateTransformation';\nimport { Interval, Scale, toInterval } from './Scale';\nimport CoordinateTransformation from './CoordinateTransformation';\n\nconst sign =\n Math.sign ||\n function (n: number): number {\n if (n < 0) return -1;\n if (n > 0) return 1;\n return 0;\n };\n\nconst signedDistance = function distance(interval: Interval): number {\n return interval.max - interval.min;\n};\n\nconst direction = function direction(interval: Interval): number {\n return sign(interval.max - interval.min);\n};\n\nexport interface BoundsInfo {\n sourceBounds: Bounds;\n scaleFactors: DataPoint;\n}\n\nexport const createBoundsInfo = function createBoundsInfo(\n sourceBounds: Bounds,\n transformation: LinearTransformation\n): BoundsInfo {\n return {\n sourceBounds,\n scaleFactors: mapValues(transformation.scales, (scale: Scale): number => scale.scaleFactor),\n };\n};\n\nexport default class LinearTransformation extends CoordinateTransformation {\n private targetCoordinate: { [sourceCoordinate: string]: string } = {};\n\n private sourceCoordinate: { [targetCoordinate: string]: string } = {};\n\n public scales: { [key: string]: Scale };\n\n private readonly preserveAspectRatio: boolean;\n\n public constructor(\n sourceDimensions: Space,\n targetDimensions: Space,\n sourceBounds?: Bounds,\n targetBounds?: Bounds,\n mapping?: { [sourceName: string]: string },\n preserveAspectRatio = true\n ) {\n super(sourceDimensions, targetDimensions);\n\n this.preserveAspectRatio = preserveAspectRatio;\n this.scales = {};\n Object.keys(sourceDimensions).forEach((sourceCoordinate): void => {\n const targetCoordinate = mapping ? mapping[sourceCoordinate] : sourceCoordinate;\n this.scales[sourceCoordinate] = new Scale();\n this.targetCoordinate[sourceCoordinate] = targetCoordinate;\n this.sourceCoordinate[targetCoordinate] = sourceCoordinate;\n });\n if (sourceBounds && targetBounds) {\n this.fit(sourceBounds, targetBounds);\n }\n }\n\n private fit(\n sourceRanges: Bounds,\n targetRanges: { [key: string]: number | Interval }\n ): LinearTransformation {\n if (this.preserveAspectRatio) {\n return this.fitUndistorted(sourceRanges, targetRanges);\n }\n return this.fitIndependently(sourceRanges, targetRanges);\n }\n\n private fitUndistorted(\n sourceRanges: Bounds,\n targetRanges: { [key: string]: number | Interval }\n ): LinearTransformation {\n let minScale = Number.MAX_VALUE;\n Object.keys(sourceRanges).forEach((dimension): void => {\n const targetDimension = this.targetCoordinate[dimension];\n if (!targetRanges[targetDimension]) {\n throw new Error(`Missing targetRanges for dimension ${targetDimension}`);\n }\n const range = sourceRanges[dimension];\n const sourceDistance = Math.abs(range.max - range.min);\n const targetBounds = toInterval(targetRanges[targetDimension]);\n minScale = Math.min(minScale, Math.abs(signedDistance(targetBounds)) / sourceDistance);\n });\n\n Object.keys(sourceRanges).forEach((dimension): void => {\n const targetDimension = this.targetCoordinate[dimension];\n this.scales[dimension].update(\n minScale * direction(toInterval(sourceRanges[targetDimension])),\n sourceRanges[dimension].min\n );\n });\n return this;\n }\n\n private fitIndependently(\n sourceRanges: Bounds,\n targetRanges: { [key: string]: Interval | number }\n ): LinearTransformation {\n Object.keys(sourceRanges).forEach((dimension): void => {\n const targetDimension = this.targetCoordinate[dimension];\n if (!targetRanges[targetDimension]) {\n throw new Error(`Missing parameter targetRanges for dimension ${dimension}`);\n }\n this.scales[dimension].fit(sourceRanges[dimension], targetRanges[targetDimension]);\n });\n return this;\n }\n\n public transform(sourcePoint: DataPoint): DataPoint {\n const result: DataPoint = {};\n Object.keys(this.sourceSpace).forEach(\n // TODO: move to explicit return\n // eslint-disable-next-line no-return-assign\n (dimension): number =>\n (result[this.targetCoordinate[dimension]] = this.scales[dimension].source2Target(\n sourcePoint[dimension]\n ))\n );\n return result;\n }\n\n public transformBack(targetPoint: DataPoint): DataPoint {\n const result: DataPoint = {};\n Object.keys(this.targetSpace).forEach((coordinate): void => {\n const sourceCoordinate = this.sourceCoordinate[coordinate];\n result[sourceCoordinate] = this.scales[sourceCoordinate].target2Source(targetPoint[coordinate]);\n });\n return result;\n }\n\n public zoomCoordinate(\n dimension: string,\n physicalCenter: number,\n factor: number,\n minScale?: number,\n maxScale?: number\n ): LinearTransformation {\n const scale = this.scales[this.sourceCoordinate[dimension]];\n const currentScale = scale.scaleFactor;\n\n const newScale = Math.min(\n maxScale || Number.MAX_VALUE,\n Math.max(currentScale * factor, minScale || 0)\n );\n\n const targetCenter = scale.target2Source(physicalCenter);\n scale.zoomAroundSource(targetCenter, newScale);\n\n return this;\n }\n\n public zoomAroundTarget(\n targetCenter: { x: number; y: number },\n factor: number,\n minScale?: number,\n maxScale?: number\n ): LinearTransformation {\n const currentScale = this.scales.x.scaleFactor;\n\n const newScale = Math.min(\n maxScale || Number.MAX_VALUE,\n Math.max(currentScale * factor, minScale || 0)\n );\n\n const sourceCenter = this.transformBack(targetCenter);\n\n ['x', 'y'].forEach((axis): void => {\n const dimension = this.sourceCoordinate[axis];\n this.scales[dimension].zoomAroundSource(sourceCenter[dimension], newScale);\n });\n return this;\n }\n\n public moveTargetWindowBy(delta: DataPoint): LinearTransformation {\n ['x', 'y'].forEach((axis): void => {\n const dimension = this.sourceCoordinate[axis];\n if (delta[axis] != null) {\n this.scales[dimension].moveTargetBy(delta[axis]);\n }\n });\n return this;\n }\n\n public getTransformString(): string {\n const dx = -this.scales.x.offset * this.scales.x.scaleFactor;\n const dy = -this.scales.y.offset * this.scales.y.scaleFactor;\n return `translate(${dx}px, ${dy}px) scale(${this.scales.x.scaleFactor})`;\n }\n}\n","export interface Interval {\n min: number;\n max: number;\n resolution?: number;\n}\nconst isInterval = function isInterval(object: Interval | number): boolean {\n return (object as Interval).min != null && (object as Interval).max != null;\n};\n\nexport const toInterval = function toInterval(object: Interval | number): Interval {\n if (isInterval(object)) {\n return object as Interval;\n }\n\n return { min: 0, max: object as number };\n};\n\nexport class Scale {\n /**\n * beginning of the target window in source coordinates\n */\n public offset: number;\n\n public scaleFactor: number;\n\n public constructor() {\n this.offset = 0;\n this.scaleFactor = 1;\n }\n\n /**\n *\n * @param {number} scaleFactor the ratio of target per source\n * @param {number} targetStart The source coordinate for which the target coordinate is 0\n * @return {this}\n */\n public update(scaleFactor: number, targetStart: number): Scale {\n this.offset = targetStart;\n this.scaleFactor = scaleFactor;\n return this;\n }\n\n public source2Target(sourceCoord: number): number {\n return (sourceCoord - this.offset) * this.scaleFactor;\n }\n\n public target2Source(targetCoord: number): number {\n return targetCoord / this.scaleFactor + this.offset;\n }\n\n /**\n * updates the scale and offset so that the specified source range is mapped to the target range.\n * If a number is specified as the target range, it is interpreted as the width of an interval starting at 0.\n * @param {Interval} sourceRange\n * @param {Interval | number} targetRange\n */\n public fit(sourceRange: Interval, targetRange: Interval | number): void {\n const targetDistance = sourceRange.max - sourceRange.min;\n const interval = toInterval(targetRange);\n\n const sourceDistance = interval.max - interval.min;\n const sourceOffset = interval.min;\n\n const scale = sourceDistance / targetDistance;\n this.update(scale, sourceRange.min - (sourceOffset || 0) / scale);\n }\n\n /**\n * adjusts scale factor and offset so that the target value for the specified source center does not change\n * @param {number} sourceCenter\n * @param {number} newScale\n */\n public zoomAroundSource(sourceCenter: number, newScale: number): void {\n this.offset =\n (sourceCenter * (newScale - this.scaleFactor) + this.offset * this.scaleFactor) / newScale;\n this.scaleFactor = newScale;\n }\n\n /**\n * moves the target range by the specified amount in target coordinates\n * @param {number} deltaTarget\n */\n public moveTargetBy(deltaTarget: number): void {\n this.offset += deltaTarget / this.scaleFactor;\n }\n}\n"],"sourceRoot":""}