diff --git a/.vscode/settings.json b/.vscode/settings.json index 2ff4a0b..f4b6d1e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -13,6 +13,9 @@ "[yaml]": { "editor.defaultFormatter": "esbenp.prettier-vscode" }, + "prettier.packageManager": "yarn", + "eslint.packageManager": "yarn", + "npm.packageManager": "yarn", "eslint.nodePath": ".yarn/sdks", "prettier.prettierPath": ".yarn/sdks/prettier/index.js", "files.eol": "\n", diff --git a/build/Chart.Geo.esm.js b/build/Chart.Geo.esm.js deleted file mode 100644 index d85da66..0000000 --- a/build/Chart.Geo.esm.js +++ /dev/null @@ -1,1064 +0,0 @@ -import { Element, Rectangle, Scale, merge, LinearScale, LogarithmicScale, defaults, drawPoint, DatasetController, valueOrDefault, clipArea, unclipArea, registry, Chart, Point, BubbleController } from '@sgratzl/chartjs-esm-facade'; -import { geoContains, geoPath, geoAzimuthalEqualArea, geoAzimuthalEquidistant, geoGnomonic, geoOrthographic, geoStereographic, geoEqualEarth, geoAlbers, geoAlbersUsa, geoConicConformal, geoConicEqualArea, geoConicEquidistant, geoEquirectangular, geoMercator, geoTransverseMercator, geoNaturalEarth1, geoGraticule10, geoGraticule } from 'd3-geo'; -import { interpolateBlues, interpolateBrBG, interpolateBuGn, interpolateBuPu, interpolateCividis, interpolateCool, interpolateCubehelixDefault, interpolateGnBu, interpolateGreens, interpolateGreys, interpolateInferno, interpolateMagma, interpolateOrRd, interpolateOranges, interpolatePRGn, interpolatePiYG, interpolatePlasma, interpolatePuBu, interpolatePuBuGn, interpolatePuOr, interpolatePuRd, interpolatePurples, interpolateRainbow, interpolateRdBu, interpolateRdGy, interpolateRdPu, interpolateRdYlBu, interpolateRdYlGn, interpolateReds, interpolateSinebow, interpolateSpectral, interpolateTurbo, interpolateViridis, interpolateWarm, interpolateYlGn, interpolateYlGnBu, interpolateYlOrBr, interpolateYlOrRd } from 'd3-scale-chromatic'; -import * as t from 'topojson-client'; - -class GeoFeature extends Element { - inRange(mouseX, mouseY) { - const bb = this.getBounds(); - const r = - (Number.isNaN(mouseX) || (mouseX >= bb.x && mouseX <= bb.x2)) && - (Number.isNaN(mouseY) || (mouseY >= bb.y && mouseY <= bb.y2)); - - const projection = this.projectionScale.geoPath.projection(); - if (r && !Number.isNaN(mouseX) && !Number.isNaN(mouseY) && typeof projection.invert === 'function') { - // test for real if within the bounds - const longlat = projection.invert([mouseX, mouseY]); - return longlat && geoContains(this.feature, longlat); - } - - return r; - } - - inXRange(mouseX) { - return this.inRange(mouseX, Number.NaN); - } - - inYRange(mouseY) { - return this.inRange(Number.NaN, mouseY); - } - - getCenterPoint() { - if (this.cache && this.cache.center) { - return this.cache.center; - } - const centroid = this.projectionScale.geoPath.centroid(this.feature); - const center = { - x: centroid[0], - y: centroid[1], - }; - this.cache = Object.assign({}, this.cache || {}, { center }); - return center; - } - - getBounds() { - if (this.cache && this.cache.bounds) { - return this.cache.bounds; - } - const bb = this.projectionScale.geoPath.bounds(this.feature); - const bounds = { - x: bb[0][0], - x2: bb[1][0], - y: bb[0][1], - y2: bb[1][1], - width: bb[1][0] - bb[0][0], - height: bb[1][1] - bb[0][1], - }; - this.cache = Object.assign({}, this.cache || {}, { bounds }); - return bounds; - } - - tooltipPosition() { - return this.getCenterPoint(); - } - - _drawInCache(doc) { - const bounds = this.getBounds(); - if (!Number.isFinite(bounds.x)) { - return; - } - const canvas = this.cache && this.cache.canvas ? this.cache.canvas : doc.createElement('canvas'); - canvas.width = Math.max(Math.ceil(bounds.width), 1); - canvas.height = Math.max(Math.ceil(bounds.height), 1); - - const ctx = canvas.getContext('2d'); - ctx.clearRect(0, 0, canvas.width, canvas.height); - ctx.save(); - ctx.translate(-bounds.x, -bounds.y); - this._drawImpl(ctx); - ctx.restore(); - - this.cache = Object.assign({}, this.cache || {}, { - canvas, - canvasKey: this._optionsToKey(), - }); - } - - _optionsToKey() { - const options = this.options; - return `${options.backgroundColor};${options.borderColor};${options.borderWidth}`; - } - - _drawImpl(ctx) { - const options = this.options; - ctx.beginPath(); - this.projectionScale.geoPath.context(ctx)(this.feature); - if (options.backgroundColor) { - ctx.fillStyle = options.backgroundColor; - ctx.fill(); - } - if (options.borderColor) { - ctx.strokeStyle = options.borderColor; - ctx.lineWidth = options.borderWidth; - ctx.stroke(); - } - } - - draw(ctx) { - if (!this.feature) { - return; - } - if (!this.cache || this.cache.canvasKey !== this._optionsToKey()) { - this._drawInCache(ctx.canvas.ownerDocument); - } - const bounds = this.getBounds(); - if (this.cache && this.cache.canvas) { - ctx.drawImage(this.cache.canvas, bounds.x, bounds.y, bounds.width, bounds.height); - } else if (Number.isFinite(bounds.x)) { - ctx.save(); - this._drawImpl(ctx); - ctx.restore(); - } - } -} - -GeoFeature.id = 'geoFeature'; -GeoFeature.defaults = /*#__PURE__*/ Object.assign({}, Rectangle.defaults, { - outlineBackgroundColor: null, - outlineBorderWidth: 0, - - graticuleBorderColor: '#CCCCCC', - graticuleBorderWidth: 0, -}); -GeoFeature.defaultRoutes = Object.assign( - { - outlineBorderColor: 'color', - }, - Rectangle.defaultRoutes || {} -); - -const lookup = { - geoAzimuthalEqualArea, - geoAzimuthalEquidistant, - geoGnomonic, - geoOrthographic, - geoStereographic, - geoEqualEarth, - geoAlbers, - geoAlbersUsa, - geoConicConformal, - geoConicEqualArea, - geoConicEquidistant, - geoEquirectangular, - geoMercator, - geoTransverseMercator, - geoNaturalEarth1, -}; -Object.keys(lookup).forEach((key) => { - lookup[`${key.charAt(3).toLowerCase()}${key.slice(4)}`] = lookup[key]; -}); - -class ProjectionScale extends Scale { - constructor(cfg) { - super(cfg); - this.geoPath = geoPath(); - } - - init(options) { - options.position = 'chartArea'; - super.init(options); - if (typeof this.options.projection === 'string' && typeof lookup[this.options.projection] === 'function') { - this.projection = lookup[this.options.projection](); - } else { - this.projection = this.options.projection; - } - this.geoPath.projection(this.projection); - } - - computeBounds(outline) { - const bb = geoPath(this.projection.fitWidth(1000, outline)).bounds(outline); - const bHeight = Math.ceil(bb[1][1] - bb[0][1]); - const bWidth = Math.ceil(bb[1][0] - bb[0][0]); - const t = this.projection.translate(); - - this.outlineBounds = { - width: bWidth, - height: bHeight, - aspectRatio: bWidth / bHeight, - refScale: this.projection.scale(), - refX: t[0], - refY: t[1], - }; - } - - updateBounds() { - const area = this.chart.chartArea; - const bb = this.outlineBounds; - - const chartWidth = area.right - area.left; - const chartHeight = area.bottom - area.top; - - const bak = this.oldChartBounds; - this.oldChartBounds = { - chartWidth, - chartHeight, - }; - - const scale = Math.min(chartWidth / bb.width, chartHeight / bb.height); - const viewWidth = bb.width * scale; - const viewHeight = bb.height * scale; - - const x = (chartWidth - viewWidth) * 0.5; - const y = (chartHeight - viewHeight) * 0.5; - - // this.mapScale = scale; - // this.mapTranslate = {x, y}; - - this.projection.scale(bb.refScale * scale).translate([scale * bb.refX + x, scale * bb.refY + y]); - - return ( - !bak || bak.chartWidth !== this.oldChartBounds.chartWidth || bak.chartHeight !== this.oldChartBounds.chartHeight - ); - } -} -ProjectionScale.id = 'projection'; -ProjectionScale.defaults = { - projection: 'albersUsa', -}; - -const baseDefaults = { - position: 'chartArea', - property: 'value', - gridLines: { - drawOnChartArea: false, - }, - legend: { - align: 'right', - position: 'bottom-right', - length: 100, - width: 50, - margin: 8, - indicatorWidth: 10, - }, -}; - -function BaseMixin(superClass) { - return class extends superClass { - init(options) { - options.position = 'chartArea'; - super.init(options); - this.axis = 'r'; - } - - parse(raw, index) { - if (raw && typeof raw[this.options.property] === 'number') { - return raw[this.options.property]; - } - return super.parse(raw, index); - } - - isHorizontal() { - return this.options.legend.align === 'top' || this.options.legend.align === 'bottom'; - } - - _getNormalizedValue(v) { - if (v == null || Number.isNaN(v)) { - return null; - } - return (v - this._startValue) / this._valueRange; - } - - _getLegendMargin() { - const indicatorWidth = this.options.legend.indicatorWidth; - const pos = this.options.legend.align; - const margin = this.options.legend.margin; - - const left = (typeof margin === 'number' ? margin : margin.left) + (pos === 'right' ? indicatorWidth : 0); - const top = (typeof margin === 'number' ? margin : margin.top) + (pos === 'bottom' ? indicatorWidth : 0); - const right = (typeof margin === 'number' ? margin : margin.right) + (pos === 'left' ? indicatorWidth : 0); - const bottom = (typeof margin === 'number' ? margin : margin.bottom) + (pos === 'top' ? indicatorWidth : 0); - return { left, top, right, bottom }; - } - - _getLegendPosition(chartArea) { - const indicatorWidth = this.options.legend.indicatorWidth; - const axisPos = this.options.legend.align; - const isHor = this.isHorizontal(); - const w = (axisPos === 'left' ? this.legendSize.w : this.width) + (isHor ? indicatorWidth : 0); - const h = (axisPos === 'top' ? this.legendSize.h : this.height) + (!isHor ? indicatorWidth : 0); - const margin = this._getLegendMargin(); - const pos = this.options.legend.position; - - if (typeof pos === 'string') { - switch (pos) { - case 'top-left': - return [margin.left, margin.top]; - case 'top': - return [(chartArea.right - w) / 2, margin.top]; - case 'left': - return [margin.left, (chartArea.bottom - h) / 2]; - case 'top-right': - return [chartArea.right - w - margin.right, margin.top]; - case 'bottom-right': - return [chartArea.right - w - margin.right, chartArea.bottom - h - margin.bottom]; - case 'bottom': - return [(chartArea.right - w) / 2, chartArea.bottom - h - margin.bottom]; - case 'bottom-left': - return [margin.left, chartArea.bottom - h - margin.bottom]; - default: - // right - return [chartArea.right - w - margin.right, (chartArea.bottom - h) / 2]; - } - } - return [pos.x, pos.y]; - } - - update(maxWidth, maxHeight, margins) { - const ch = Math.min(maxHeight, this.bottom == null ? Number.POSITIVE_INFINITY : this.bottom); - const cw = Math.min(maxWidth, this.right == null ? Number.POSITIVE_INFINITY : this.right); - - const l = this.options.legend; - const isHor = this.isHorizontal(); - const factor = (v, full) => (v < 1 ? full * v : v); - const w = Math.min(cw, factor(isHor ? l.length : l.width, cw)) - (!isHor ? l.indicatorWidth : 0); - const h = Math.min(ch, factor(!isHor ? l.length : l.width, ch)) - (isHor ? l.indicatorWidth : 0); - this.legendSize = { w, h }; - this.bottom = this.height = h; - this.right = this.width = w; - - const bak = this.options.position; - this.options.position = this.options.legend.align; - super.update(w, h, margins); - this.options.position = bak; - this.height = Math.min(h, this.height); - this.width = Math.min(w, this.width); - } - - draw(chartArea) { - if (!this._isVisible()) { - return; - } - const pos = this._getLegendPosition(chartArea); - /** @type {CanvasRenderingContext2D} */ - const ctx = this.ctx; - ctx.save(); - ctx.translate(pos[0], pos[1]); - - const bak = this.options.position; - this.options.position = this.options.legend.align; - super.draw( - Object.assign({}, chartArea, { - bottom: this.height, - right: this.width, - }) - ); - this.options.position = bak; - const indicatorWidth = this.options.legend.indicatorWidth; - switch (this.options.legend.align) { - case 'left': - ctx.translate(this.legendSize.w, 0); - break; - case 'top': - ctx.translate(0, this.legendSize.h); - break; - case 'bottom': - ctx.translate(0, -indicatorWidth); - break; - default: - ctx.translate(-indicatorWidth, 0); - break; - } - this._drawIndicator(); - ctx.restore(); - } - }; -} - -const lookup$1 = { - interpolateBlues, - interpolateBrBG, - interpolateBuGn, - interpolateBuPu, - interpolateCividis, - interpolateCool, - interpolateCubehelixDefault, - interpolateGnBu, - interpolateGreens, - interpolateGreys, - interpolateInferno, - interpolateMagma, - interpolateOrRd, - interpolateOranges, - interpolatePRGn, - interpolatePiYG, - interpolatePlasma, - interpolatePuBu, - interpolatePuBuGn, - interpolatePuOr, - interpolatePuRd, - interpolatePurples, - interpolateRainbow, - interpolateRdBu, - interpolateRdGy, - interpolateRdPu, - interpolateRdYlBu, - interpolateRdYlGn, - interpolateReds, - interpolateSinebow, - interpolateSpectral, - interpolateTurbo, - interpolateViridis, - interpolateWarm, - interpolateYlGn, - interpolateYlGnBu, - interpolateYlOrBr, - interpolateYlOrRd, -}; - -Object.keys(lookup$1).forEach((key) => { - lookup$1[`${key.charAt(11).toLowerCase()}${key.slice(12)}`] = lookup$1[key]; - lookup$1[key.slice(11)] = lookup$1[key]; -}); - -function quantize(v, steps) { - const perStep = 1 / steps; - if (v <= perStep) { - return 0; - } - if (v >= 1 - perStep) { - return 1; - } - for (let acc = 0; acc < 1; acc += perStep) { - if (v < acc) { - return acc - perStep / 2; // center - } - } - return v; -} - -function ColorScaleMixin(superClass) { - return class extends BaseMixin(superClass) { - init(options) { - super.init(options); - if (typeof this.options.interpolate === 'string' && typeof lookup$1[this.options.interpolate] === 'function') { - this.interpolate = lookup$1[this.options.interpolate]; - } else { - this.interpolate = this.options.interpolate; - } - } - getColorForValue(value) { - const v = this._getNormalizedValue(value); - if (v == null || Number.isNaN(v)) { - return this.options.missing; - } - return this.getColor(v); - } - getColor(normalized) { - let v = normalized; - if (this.options.quantize > 0) { - v = quantize(v, this.options.quantize); - } - return this.interpolate(v); - } - - _drawIndicator() { - /** @type {CanvasRenderingContext2D} */ - const ctx = this.ctx; - const w = this.width; - const h = this.height; - const indicatorSize = this.options.legend.indicatorWidth; - const reverse = this._reversePixels; - - if (this.isHorizontal()) { - if (this.options.quantize > 0) { - const stepWidth = w / this.options.quantize; - const offset = !reverse ? (i) => i : (i) => w - stepWidth - i; - for (let i = 0; i < w; i += stepWidth) { - const v = (i + stepWidth / 2) / w; - ctx.fillStyle = this.getColor(v); - ctx.fillRect(offset(i), 0, stepWidth, indicatorSize); - } - } else { - const offset = !reverse ? (i) => i : (i) => w - 1 - i; - for (let i = 0; i < w; ++i) { - ctx.fillStyle = this.getColor((i + 0.5) / w); - ctx.fillRect(offset(i), 0, 1, indicatorSize); - } - } - } else if (this.options.quantize > 0) { - const stepWidth = h / this.options.quantize; - const offset = !reverse ? (i) => i : (i) => h - stepWidth - i; - for (let i = 0; i < h; i += stepWidth) { - const v = (i + stepWidth / 2) / h; - ctx.fillStyle = this.getColor(v); - ctx.fillRect(0, offset(i), indicatorSize, stepWidth); - } - } else { - const offset = !reverse ? (i) => i : (i) => h - 1 - i; - for (let i = 0; i < h; ++i) { - ctx.fillStyle = this.getColor((i + 0.5) / h); - ctx.fillRect(0, offset(i), indicatorSize, 1); - } - } - } - }; -} -class ColorScale extends ColorScaleMixin(LinearScale) {} - -const colorScaleDefaults = { - interpolate: 'blues', - missing: 'transparent', - quantize: 0, -}; -ColorScale.id = 'color'; -ColorScale.defaults = /*#__PURE__*/ merge({}, [LinearScale.defaults, baseDefaults, colorScaleDefaults]); - -class ColorLogarithmicScale extends ColorScaleMixin(LogarithmicScale) { - _getNormalizedValue(v) { - if (v == null || Number.isNaN(v)) { - return null; - } - return (Math.log10(v) - this._startValue) / this._valueRange; - } -} - -ColorLogarithmicScale.id = 'colorLogarithmic'; -ColorLogarithmicScale.defaults = /*#__PURE__*/ merge({}, [LogarithmicScale.defaults, baseDefaults, colorScaleDefaults]); - -function SizeSaleMixin(superClass) { - return class extends BaseMixin(superClass) { - getSizeForValue(value) { - const v = this._getNormalizedValue(value); - if (v == null || Number.isNaN(v)) { - return this.options.missing; - } - return this.getSizeImpl(v); - } - - getSizeImpl(normalized) { - const [r0, r1] = this.options.range; - if (this.options.mode === 'area') { - const a1 = r1 * r1 * Math.PI; - const a0 = r0 * r0 * Math.PI; - const range = a1 - a0; - const a = normalized * range + a0; - return Math.sqrt(a / Math.PI); - } - const range = r1 - r0; - return normalized * range + r0; - } - - _drawIndicator() { - /** @type {CanvasRenderingContext2D} */ - const ctx = this.ctx; - const shift = this.options.legend.indicatorWidth / 2; - - const isHor = this.isHorizontal(); - const values = this.ticks; - const positions = this._labelItems || values.map((_, i) => ({ [isHor ? 'x' : 'y']: this.getPixelForTick(i) })); - - (this._gridLineItems || []).forEach((item) => { - ctx.save(); - ctx.strokeStyle = item.color; - ctx.lineWidth = item.width; - - if (ctx.setLineDash) { - ctx.setLineDash(item.borderDash); - ctx.lineDashOffset = item.borderDashOffset; - } - - ctx.beginPath(); - - if (this.options.gridLines.drawTicks) { - switch (this.options.legend.align) { - case 'left': - ctx.moveTo(0, item.ty1); - ctx.lineTo(shift, item.ty2); - break; - case 'top': - ctx.moveTo(item.tx1, 0); - ctx.lineTo(item.tx2, shift); - break; - case 'bottom': - ctx.moveTo(item.tx1, shift); - ctx.lineTo(item.tx2, shift * 2); - break; - default: - // right - ctx.moveTo(shift, item.ty1); - ctx.lineTo(shift * 2, item.ty2); - break; - } - } - ctx.stroke(); - ctx.restore(); - }); - - if (this._model) { - const props = this._model; - ctx.strokeStyle = props.borderColor || defaults.color; - ctx.lineWidth = props.borderWidth || 0; - ctx.fillStyle = props.backgroundColor || defaults.color; - } else { - ctx.fillStyle = 'blue'; - } - - values.forEach((v, i) => { - const pos = positions[i]; - const radius = this.getSizeForValue(v.value); - const x = isHor ? pos.x : shift; - const y = isHor ? shift : pos.y; - const renderOptions = Object.assign({}, this._model || {}, { - radius, - }); - drawPoint(ctx, renderOptions, x, y); - }); - } - }; -} - -class SizeScale extends SizeSaleMixin(LinearScale) {} - -const scaleDefaults = { - missing: 1, - mode: 'area', // 'radius' - // mode: 'radius', - range: [2, 20], - legend: { - align: 'bottom', - length: 90, - width: 70, - indicatorWidth: 42, - }, -}; - -SizeScale.id = 'size'; -SizeScale.defaults = /*#__PURE__*/ merge({}, [LinearScale.defaults, baseDefaults, scaleDefaults]); - -class SizeLogarithmicScale extends SizeSaleMixin(LogarithmicScale) { - _getNormalizedValue(v) { - if (v == null || Number.isNaN(v)) { - return null; - } - return (Math.log10(v) - this._startValue) / this._valueRange; - } -} - -SizeLogarithmicScale.id = 'sizeLogarithmic'; -SizeLogarithmicScale.defaults = /*#__PURE__*/ merge({}, [LogarithmicScale.defaults, baseDefaults, scaleDefaults]); - -const geoDefaults = { - datasetElementOptions: [ - 'outlineBackgroundColor', - 'outlineBorderColor', - 'outlineBorderWidth', - 'graticuleBorderColor', - 'graticuleBorderWidth', - ], - showOutline: false, - showGraticule: false, - clipMap: true, - scales: { - xy: { - type: ProjectionScale.id, - position: 'chartArea', - display: false, - }, - }, -}; - -function patchDatasetElementOptions(options) { - // patch the options by removing the `outline` or `hoverOutline` option; - // see https://github.com/chartjs/Chart.js/issues/7362 - const r = {}; - Object.keys(options).forEach((key) => { - let targetKey = key; - if (key.startsWith('outline')) { - const sub = key.slice('outline'.length); - targetKey = sub[0].toLowerCase() + sub.slice(1); - } else if (key.startsWith('hoverOutline')) { - targetKey = 'hover' + key.slice('hoverOutline'.length); - } - r[targetKey] = options[key]; - }); - return r; -} - -class GeoController extends DatasetController { - getProjectionScale() { - return this.getScaleForId('xy'); - } - - linkScales() { - const dataset = this.getDataset(); - const meta = this.getMeta(); - meta.xAxisID = dataset.xAxisID = 'xy'; - meta.yAxisID = dataset.yAxisID = 'xy'; - meta.xScale = this.getScaleForId('xy'); - meta.yScale = this.getScaleForId('xy'); - - this.getProjectionScale().computeBounds(this.resolveOutline()); - } - - showOutline() { - return valueOrDefault(this.getDataset().showOutline, this.chart.options.showOutline); - } - - clipMap() { - return valueOrDefault(this.getDataset().clipMap, this.chart.options.clipMap); - } - - getGraticule() { - return valueOrDefault(this.getDataset().showGraticule, this.chart.options.showGraticule); - } - - update(mode) { - super.update(mode); - - const active = mode === 'active'; - const meta = this.getMeta(); - - const scale = this.getProjectionScale(); - const dirtyCache = scale.updateBounds(); - - if (this.showOutline()) { - const elem = meta.dataset; - if (dirtyCache) { - delete elem.cache; - } - elem.projectionScale = scale; - if (mode !== 'resize') { - const properties = { - feature: this.resolveOutline(), - options: patchDatasetElementOptions(this.resolveDatasetElementOptions(active)), - }; - this.updateElement(elem, undefined, properties, mode); - if (this.getGraticule()) { - meta.graticule = properties.options; - } - } - } else if (this.getGraticule() && mode !== 'resize') { - meta.graticule = patchDatasetElementOptions(this.resolveDatasetElementOptions(active)); - } - - this.updateElements(meta.data, 0, mode); - if (dirtyCache) { - meta.data.forEach((elem) => delete elem.cache); - } - } - - resolveOutline() { - const ds = this.getDataset(); - const outline = ds.outline || { type: 'Sphere' }; - if (Array.isArray(outline)) { - return { - type: 'FeatureCollection', - features: outline, - }; - } - return outline; - } - - showGraticule() { - const g = this.getGraticule(); - if (!g) { - return; - } - const ctx = this.chart.ctx; - const scale = this.getProjectionScale(); - const path = scale.geoPath.context(ctx); - - ctx.save(); - ctx.beginPath(); - - if (g === true) { - path(geoGraticule10()); - } else { - const geo = geoGraticule(); - if (g.stepMajor) { - geo.stepMajor(g.stepMajor); - } - if (g.stepMinor) { - geo.stepMinor(g.stepMinor); - } - path(geo); - } - - const options = this.getMeta().graticule; - ctx.strokeStyle = options.graticuleBorderColor; - ctx.lineWidth = options.graticuleBorderWidth; - ctx.stroke(); - ctx.restore(); - } - - draw() { - const chart = this.chart; - - const clipMap = this.clipMap(); - - // enable clipping based on the option - let enabled = false; - if (clipMap === true || clipMap === 'outline' || clipMap === 'outline+graticule') { - enabled = true; - clipArea(chart.ctx, chart.chartArea); - } - - if (this.showOutline()) { - this.getMeta().dataset.draw(chart.ctx); - } - - if (clipMap === true || clipMap === 'graticule' || clipMap === 'outline+graticule') { - if (!enabled) { - clipArea(chart.ctx, chart.chartArea); - } - } else if (enabled) { - enabled = false; - unclipArea(chart.ctx); - } - - this.showGraticule(); - - if (clipMap === true || clipMap === 'items') { - if (!enabled) { - clipArea(chart.ctx, chart.chartArea); - } - } else if (enabled) { - enabled = false; - unclipArea(chart.ctx); - } - - this.getMeta().data.forEach((elem) => elem.draw(chart.ctx)); - - if (enabled) { - enabled = false; - unclipArea(chart.ctx); - } - } -} - -function patchController(config, controller, elements = [], scales = []) { - registry.addControllers(controller); - registry.addElements(elements); - registry.addScales(scales); - config.type = controller.id; - return config; -} - -class ChoroplethController extends GeoController { - linkScales() { - super.linkScales(); - const dataset = this.getDataset(); - const meta = this.getMeta(); - meta.vAxisID = meta.rAxisID = 'color'; - dataset.vAxisID = dataset.rAxisID = 'color'; - meta.rScale = this.getScaleForId('color'); - meta.vScale = meta.rScale; - meta.iScale = meta.xScale; - meta.iAxisID = dataset.iAxisID = meta.xAxisID; - } - - parse(start, count) { - const rScale = this.getMeta().rScale; - const data = this.getDataset().data; - const meta = this._cachedMeta; - for (let i = start; i < start + count; ++i) { - meta._parsed[i] = { - [rScale.axis]: rScale.parse(data[i]), - }; - } - } - - updateElements(elems, start, mode) { - const firstOpts = this.resolveDataElementOptions(start, mode); - const sharedOptions = this.getSharedOptions(mode, elems[start], firstOpts); - const includeOptions = this.includeOptions(mode, sharedOptions); - const scale = this.getProjectionScale(); - - for (let i = 0; i < elems.length; i++) { - const index = start + i; - const elem = elems[i]; - elem.projectionScale = scale; - elem.feature = this._data[i].feature; - const center = elem.getCenterPoint(); - - const properties = { - x: center.x, - y: center.y, - }; - if (includeOptions) { - properties.options = this.resolveDataElementOptions(index, mode); - } - this.updateElement(elem, index, properties, mode); - } - this.updateSharedOptions(sharedOptions, mode); - } - - indexToColor(index) { - const rScale = this.getMeta().rScale; - return rScale.getColorForValue(this.getParsed(index)[rScale.axis]); - } -} - -ChoroplethController.id = 'choropleth'; -ChoroplethController.defaults = /*#__PURE__*/ merge({}, [ - geoDefaults, - { - datasetElementType: GeoFeature.id, - dataElementType: GeoFeature.id, - dataElementOptions: ['backgroundColor', 'borderColor', 'borderWidth'], - tooltips: { - callbacks: { - title() { - // Title doesn't make sense for scatter since we format the data as a point - return ''; - }, - label(item) { - if (item.formattedValue == null) { - return item.chart.data.labels[item.dataIndex]; - } - return `${item.chart.data.labels[item.dataIndex]}: ${item.formattedValue}`; - }, - }, - }, - scales: { - color: { - type: ColorScale.id, - }, - }, - elements: { - geoFeature: { - backgroundColor(context) { - if (context.dataIndex == null) { - return null; - } - const controller = context.chart.getDatasetMeta(context.datasetIndex).controller; - return controller.indexToColor(context.dataIndex); - }, - }, - }, - }, -]); - -class ChoroplethChart extends Chart { - constructor(item, config) { - super(item, patchController(config, ChoroplethController, GeoFeature, [ColorScale, ProjectionScale])); - } -} -ChoroplethChart.id = ChoroplethController.id; - -class BubbleMapController extends GeoController { - linkScales() { - super.linkScales(); - const dataset = this.getDataset(); - const meta = this.getMeta(); - meta.vAxisID = meta.rAxisID = 'r'; - dataset.vAxisID = dataset.rAxisID = 'r'; - meta.rScale = this.getScaleForId('r'); - meta.vScale = meta.rScale; - meta.iScale = meta.xScale; - meta.iAxisID = dataset.iAxisID = meta.xAxisID; - } - - parse(start, count) { - const rScale = this.getMeta().rScale; - const data = this.getDataset().data; - const meta = this._cachedMeta; - for (let i = start; i < start + count; ++i) { - const d = data[i]; - meta._parsed[i] = { - x: d.longitude == null ? d.x : d.longitude, - y: d.latitude == null ? d.y : d.latitude, - [rScale.axis]: rScale.parse(d), - }; - } - } - - updateElements(elems, start, mode) { - const reset = mode === 'reset'; - const firstOpts = this.resolveDataElementOptions(start, mode); - const sharedOptions = this.getSharedOptions(mode, elems[start], firstOpts); - const includeOptions = this.includeOptions(mode, sharedOptions); - const scale = this.getProjectionScale(); - - this.getMeta().rScale._model = firstOpts; // for legend rendering styling - - for (let i = 0; i < elems.length; i++) { - const index = start + i; - const elem = elems[i]; - const parsed = this.getParsed(i); - const xy = scale.projection([parsed.x, parsed.y]); - const properties = { - x: xy ? xy[0] : 0, - y: xy ? xy[1] : 0, - skip: Number.isNaN(parsed.x) || Number.isNaN(parsed.y), - }; - if (includeOptions) { - properties.options = this.resolveDataElementOptions(index, mode); - if (reset) { - properties.options.radius = 0; - } - } - this.updateElement(elem, index, properties, mode); - } - this.updateSharedOptions(sharedOptions, mode); - } - - indexToRadius(index) { - const rScale = this.getMeta().rScale; - return rScale.getSizeForValue(this.getParsed(index)[rScale.axis]); - } -} - -BubbleMapController.id = 'bubbleMap'; -BubbleMapController.defaults = merge({}, [ - geoDefaults, - { - dataElementType: Point.id, - dataElementOptions: BubbleController.defaults.dataElementOptions, - datasetElementType: GeoFeature.id, - showOutline: true, - clipMap: 'outline+graticule', - tooltips: { - callbacks: { - title() { - // Title doesn't make sense for scatter since we format the data as a point - return ''; - }, - label(item) { - if (item.formattedValue == null) { - return item.chart.data.labels[item.dataIndex]; - } - return `${item.chart.data.labels[item.dataIndex]}: ${item.formattedValue}`; - }, - }, - }, - scales: { - r: { - type: SizeScale.id, - }, - }, - elements: { - point: { - radius(context) { - if (context.dataIndex == null) { - return null; - } - const controller = context.chart.getDatasetMeta(context.datasetIndex).controller; - return controller.indexToRadius(context.dataIndex); - }, - hoverRadius: undefined, - }, - }, - }, -]); - -class BubbleMapChart extends Chart { - constructor(item, config) { - super(item, patchController(config, BubbleMapController, GeoFeature, [SizeScale, ProjectionScale])); - } -} -BubbleMapChart.id = BubbleMapController.id; - -const topojson = t; - -export { BubbleMapChart, BubbleMapController, ChoroplethChart, ChoroplethController, ColorLogarithmicScale, ColorScale, GeoController, GeoFeature, ProjectionScale, SizeLogarithmicScale, SizeScale, geoDefaults, topojson }; diff --git a/build/Chart.Geo.js b/build/Chart.Geo.js deleted file mode 100644 index 6d8babb..0000000 --- a/build/Chart.Geo.js +++ /dev/null @@ -1,5748 +0,0 @@ -(function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@sgratzl/chartjs-esm-facade')) : - typeof define === 'function' && define.amd ? define(['exports', '@sgratzl/chartjs-esm-facade'], factory) : - (global = global || self, factory(global.ChartGeo = {}, global.ChartESMFacade)); -}(this, (function (exports, chartjsEsmFacade) { 'use strict'; - - function _classCallCheck(instance, Constructor) { - if (!(instance instanceof Constructor)) { - throw new TypeError("Cannot call a class as a function"); - } - } - - var classCallCheck = _classCallCheck; - - function _defineProperties(target, props) { - for (var i = 0; i < props.length; i++) { - var descriptor = props[i]; - descriptor.enumerable = descriptor.enumerable || false; - descriptor.configurable = true; - if ("value" in descriptor) descriptor.writable = true; - Object.defineProperty(target, descriptor.key, descriptor); - } - } - - function _createClass(Constructor, protoProps, staticProps) { - if (protoProps) _defineProperties(Constructor.prototype, protoProps); - if (staticProps) _defineProperties(Constructor, staticProps); - return Constructor; - } - - var createClass = _createClass; - - function createCommonjsModule(fn, basedir, module) { - return module = { - path: basedir, - exports: {}, - require: function (path, base) { - return commonjsRequire(path, (base === undefined || base === null) ? module.path : base); - } - }, fn(module, module.exports), module.exports; - } - - function commonjsRequire () { - throw new Error('Dynamic requires are not currently supported by @rollup/plugin-commonjs'); - } - - var setPrototypeOf = createCommonjsModule(function (module) { - function _setPrototypeOf(o, p) { - module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { - o.__proto__ = p; - return o; - }; - - return _setPrototypeOf(o, p); - } - - module.exports = _setPrototypeOf; - }); - - function _inherits(subClass, superClass) { - if (typeof superClass !== "function" && superClass !== null) { - throw new TypeError("Super expression must either be null or a function"); - } - - subClass.prototype = Object.create(superClass && superClass.prototype, { - constructor: { - value: subClass, - writable: true, - configurable: true - } - }); - if (superClass) setPrototypeOf(subClass, superClass); - } - - var inherits = _inherits; - - var _typeof_1 = createCommonjsModule(function (module) { - function _typeof(obj) { - "@babel/helpers - typeof"; - - if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { - module.exports = _typeof = function _typeof(obj) { - return typeof obj; - }; - } else { - module.exports = _typeof = function _typeof(obj) { - return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; - }; - } - - return _typeof(obj); - } - - module.exports = _typeof; - }); - - function _assertThisInitialized(self) { - if (self === void 0) { - throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); - } - - return self; - } - - var assertThisInitialized = _assertThisInitialized; - - function _possibleConstructorReturn(self, call) { - if (call && (_typeof_1(call) === "object" || typeof call === "function")) { - return call; - } - - return assertThisInitialized(self); - } - - var possibleConstructorReturn = _possibleConstructorReturn; - - var getPrototypeOf = createCommonjsModule(function (module) { - function _getPrototypeOf(o) { - module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { - return o.__proto__ || Object.getPrototypeOf(o); - }; - return _getPrototypeOf(o); - } - - module.exports = _getPrototypeOf; - }); - - // Adds floating point numbers with twice the normal precision. - // Reference: J. R. Shewchuk, Adaptive Precision Floating-Point Arithmetic and - // Fast Robust Geometric Predicates, Discrete & Computational Geometry 18(3) - // 305–363 (1997). - // Code adapted from GeographicLib by Charles F. F. Karney, - // http://geographiclib.sourceforge.net/ - function adder () { - return new Adder(); - } - - function Adder() { - this.reset(); - } - - Adder.prototype = { - constructor: Adder, - reset: function reset() { - this.s = // rounded value - this.t = 0; // exact error - }, - add: function add(y) { - _add(temp, y, this.t); - - _add(this, temp.s, this.s); - - if (this.s) this.t += temp.t;else this.s = temp.t; - }, - valueOf: function valueOf() { - return this.s; - } - }; - var temp = new Adder(); - - function _add(adder, a, b) { - var x = adder.s = a + b, - bv = x - a, - av = x - bv; - adder.t = a - av + (b - bv); - } - - var epsilon = 1e-6; - var epsilon2 = 1e-12; - var pi = Math.PI; - var halfPi = pi / 2; - var quarterPi = pi / 4; - var tau = pi * 2; - var degrees = 180 / pi; - var radians = pi / 180; - var abs = Math.abs; - var atan = Math.atan; - var atan2 = Math.atan2; - var cos = Math.cos; - var ceil = Math.ceil; - var exp = Math.exp; - var log = Math.log; - var pow = Math.pow; - var sin = Math.sin; - var sign = Math.sign || function (x) { - return x > 0 ? 1 : x < 0 ? -1 : 0; - }; - var sqrt = Math.sqrt; - var tan = Math.tan; - function acos(x) { - return x > 1 ? 0 : x < -1 ? pi : Math.acos(x); - } - function asin(x) { - return x > 1 ? halfPi : x < -1 ? -halfPi : Math.asin(x); - } - - function noop() {} - - function streamGeometry(geometry, stream) { - if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { - streamGeometryType[geometry.type](geometry, stream); - } - } - - var streamObjectType = { - Feature: function Feature(object, stream) { - streamGeometry(object.geometry, stream); - }, - FeatureCollection: function FeatureCollection(object, stream) { - var features = object.features, - i = -1, - n = features.length; - - while (++i < n) { - streamGeometry(features[i].geometry, stream); - } - } - }; - var streamGeometryType = { - Sphere: function Sphere(object, stream) { - stream.sphere(); - }, - Point: function Point(object, stream) { - object = object.coordinates; - stream.point(object[0], object[1], object[2]); - }, - MultiPoint: function MultiPoint(object, stream) { - var coordinates = object.coordinates, - i = -1, - n = coordinates.length; - - while (++i < n) { - object = coordinates[i], stream.point(object[0], object[1], object[2]); - } - }, - LineString: function LineString(object, stream) { - streamLine(object.coordinates, stream, 0); - }, - MultiLineString: function MultiLineString(object, stream) { - var coordinates = object.coordinates, - i = -1, - n = coordinates.length; - - while (++i < n) { - streamLine(coordinates[i], stream, 0); - } - }, - Polygon: function Polygon(object, stream) { - streamPolygon(object.coordinates, stream); - }, - MultiPolygon: function MultiPolygon(object, stream) { - var coordinates = object.coordinates, - i = -1, - n = coordinates.length; - - while (++i < n) { - streamPolygon(coordinates[i], stream); - } - }, - GeometryCollection: function GeometryCollection(object, stream) { - var geometries = object.geometries, - i = -1, - n = geometries.length; - - while (++i < n) { - streamGeometry(geometries[i], stream); - } - } - }; - - function streamLine(coordinates, stream, closed) { - var i = -1, - n = coordinates.length - closed, - coordinate; - stream.lineStart(); - - while (++i < n) { - coordinate = coordinates[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); - } - - stream.lineEnd(); - } - - function streamPolygon(coordinates, stream) { - var i = -1, - n = coordinates.length; - stream.polygonStart(); - - while (++i < n) { - streamLine(coordinates[i], stream, 1); - } - - stream.polygonEnd(); - } - - function geoStream (object, stream) { - if (object && streamObjectType.hasOwnProperty(object.type)) { - streamObjectType[object.type](object, stream); - } else { - streamGeometry(object, stream); - } - } - - function spherical(cartesian) { - return [atan2(cartesian[1], cartesian[0]), asin(cartesian[2])]; - } - function cartesian(spherical) { - var lambda = spherical[0], - phi = spherical[1], - cosPhi = cos(phi); - return [cosPhi * cos(lambda), cosPhi * sin(lambda), sin(phi)]; - } - function cartesianDot(a, b) { - return a[0] * b[0] + a[1] * b[1] + a[2] * b[2]; - } - function cartesianCross(a, b) { - return [a[1] * b[2] - a[2] * b[1], a[2] * b[0] - a[0] * b[2], a[0] * b[1] - a[1] * b[0]]; - } // TODO return a - - function cartesianAddInPlace(a, b) { - a[0] += b[0], a[1] += b[1], a[2] += b[2]; - } - function cartesianScale(vector, k) { - return [vector[0] * k, vector[1] * k, vector[2] * k]; - } // TODO return d - - function cartesianNormalizeInPlace(d) { - var l = sqrt(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); - d[0] /= l, d[1] /= l, d[2] /= l; - } - - function compose (a, b) { - function compose(x, y) { - return x = a(x, y), b(x[0], x[1]); - } - - if (a.invert && b.invert) compose.invert = function (x, y) { - return x = b.invert(x, y), x && a.invert(x[0], x[1]); - }; - return compose; - } - - function rotationIdentity(lambda, phi) { - return [abs(lambda) > pi ? lambda + Math.round(-lambda / tau) * tau : lambda, phi]; - } - - rotationIdentity.invert = rotationIdentity; - function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { - return (deltaLambda %= tau) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; - } - - function forwardRotationLambda(deltaLambda) { - return function (lambda, phi) { - return lambda += deltaLambda, [lambda > pi ? lambda - tau : lambda < -pi ? lambda + tau : lambda, phi]; - }; - } - - function rotationLambda(deltaLambda) { - var rotation = forwardRotationLambda(deltaLambda); - rotation.invert = forwardRotationLambda(-deltaLambda); - return rotation; - } - - function rotationPhiGamma(deltaPhi, deltaGamma) { - var cosDeltaPhi = cos(deltaPhi), - sinDeltaPhi = sin(deltaPhi), - cosDeltaGamma = cos(deltaGamma), - sinDeltaGamma = sin(deltaGamma); - - function rotation(lambda, phi) { - var cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(phi), - k = z * cosDeltaPhi + x * sinDeltaPhi; - return [atan2(y * cosDeltaGamma - k * sinDeltaGamma, x * cosDeltaPhi - z * sinDeltaPhi), asin(k * cosDeltaGamma + y * sinDeltaGamma)]; - } - - rotation.invert = function (lambda, phi) { - var cosPhi = cos(phi), - x = cos(lambda) * cosPhi, - y = sin(lambda) * cosPhi, - z = sin(phi), - k = z * cosDeltaGamma - y * sinDeltaGamma; - return [atan2(y * cosDeltaGamma + z * sinDeltaGamma, x * cosDeltaPhi + k * sinDeltaPhi), asin(k * cosDeltaPhi - x * sinDeltaPhi)]; - }; - - return rotation; - } - - function rotation (rotate) { - rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0); - - function forward(coordinates) { - coordinates = rotate(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; - } - - forward.invert = function (coordinates) { - coordinates = rotate.invert(coordinates[0] * radians, coordinates[1] * radians); - return coordinates[0] *= degrees, coordinates[1] *= degrees, coordinates; - }; - - return forward; - } - - function circleStream(stream, radius, delta, direction, t0, t1) { - if (!delta) return; - var cosRadius = cos(radius), - sinRadius = sin(radius), - step = direction * delta; - - if (t0 == null) { - t0 = radius + direction * tau; - t1 = radius - step / 2; - } else { - t0 = circleRadius(cosRadius, t0); - t1 = circleRadius(cosRadius, t1); - if (direction > 0 ? t0 < t1 : t0 > t1) t0 += direction * tau; - } - - for (var point, t = t0; direction > 0 ? t > t1 : t < t1; t -= step) { - point = spherical([cosRadius, -sinRadius * cos(t), -sinRadius * sin(t)]); - stream.point(point[0], point[1]); - } - } // Returns the signed angle of a cartesian point relative to [cosRadius, 0, 0]. - - function circleRadius(cosRadius, point) { - point = cartesian(point), point[0] -= cosRadius; - cartesianNormalizeInPlace(point); - var radius = acos(-point[1]); - return ((-point[2] < 0 ? -radius : radius) + tau - epsilon) % tau; - } - - function clipBuffer () { - var lines = [], - line; - return { - point: function point(x, y, m) { - line.push([x, y, m]); - }, - lineStart: function lineStart() { - lines.push(line = []); - }, - lineEnd: noop, - rejoin: function rejoin() { - if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); - }, - result: function result() { - var result = lines; - lines = []; - line = null; - return result; - } - }; - } - - function pointEqual (a, b) { - return abs(a[0] - b[0]) < epsilon && abs(a[1] - b[1]) < epsilon; - } - - function Intersection(point, points, other, entry) { - this.x = point; - this.z = points; - this.o = other; // another intersection - - this.e = entry; // is an entry? - - this.v = false; // visited - - this.n = this.p = null; // next & previous - } // A generalized polygon clipping algorithm: given a polygon that has been cut - // into its visible line segments, and rejoins the segments by interpolating - // along the clip edge. - - - function clipRejoin (segments, compareIntersection, startInside, interpolate, stream) { - var subject = [], - clip = [], - i, - n; - segments.forEach(function (segment) { - if ((n = segment.length - 1) <= 0) return; - var n, - p0 = segment[0], - p1 = segment[n], - x; - - if (pointEqual(p0, p1)) { - if (!p0[2] && !p1[2]) { - stream.lineStart(); - - for (i = 0; i < n; ++i) { - stream.point((p0 = segment[i])[0], p0[1]); - } - - stream.lineEnd(); - return; - } // handle degenerate cases by moving the point - - - p1[0] += 2 * epsilon; - } - - subject.push(x = new Intersection(p0, segment, null, true)); - clip.push(x.o = new Intersection(p0, null, x, false)); - subject.push(x = new Intersection(p1, segment, null, false)); - clip.push(x.o = new Intersection(p1, null, x, true)); - }); - if (!subject.length) return; - clip.sort(compareIntersection); - link(subject); - link(clip); - - for (i = 0, n = clip.length; i < n; ++i) { - clip[i].e = startInside = !startInside; - } - - var start = subject[0], - points, - point; - - while (1) { - // Find first unvisited intersection. - var current = start, - isSubject = true; - - while (current.v) { - if ((current = current.n) === start) return; - } - - points = current.z; - stream.lineStart(); - - do { - current.v = current.o.v = true; - - if (current.e) { - if (isSubject) { - for (i = 0, n = points.length; i < n; ++i) { - stream.point((point = points[i])[0], point[1]); - } - } else { - interpolate(current.x, current.n.x, 1, stream); - } - - current = current.n; - } else { - if (isSubject) { - points = current.p.z; - - for (i = points.length - 1; i >= 0; --i) { - stream.point((point = points[i])[0], point[1]); - } - } else { - interpolate(current.x, current.p.x, -1, stream); - } - - current = current.p; - } - - current = current.o; - points = current.z; - isSubject = !isSubject; - } while (!current.v); - - stream.lineEnd(); - } - } - - function link(array) { - if (!(n = array.length)) return; - var n, - i = 0, - a = array[0], - b; - - while (++i < n) { - a.n = b = array[i]; - b.p = a; - a = b; - } - - a.n = b = array[0]; - b.p = a; - } - - var sum = adder(); - - function longitude(point) { - if (abs(point[0]) <= pi) return point[0];else return sign(point[0]) * ((abs(point[0]) + pi) % tau - pi); - } - - function polygonContains (polygon, point) { - var lambda = longitude(point), - phi = point[1], - sinPhi = sin(phi), - normal = [sin(lambda), -cos(lambda), 0], - angle = 0, - winding = 0; - sum.reset(); - if (sinPhi === 1) phi = halfPi + epsilon;else if (sinPhi === -1) phi = -halfPi - epsilon; - - for (var i = 0, n = polygon.length; i < n; ++i) { - if (!(m = (ring = polygon[i]).length)) continue; - var ring, - m, - point0 = ring[m - 1], - lambda0 = longitude(point0), - phi0 = point0[1] / 2 + quarterPi, - sinPhi0 = sin(phi0), - cosPhi0 = cos(phi0); - - for (var j = 0; j < m; ++j, lambda0 = lambda1, sinPhi0 = sinPhi1, cosPhi0 = cosPhi1, point0 = point1) { - var point1 = ring[j], - lambda1 = longitude(point1), - phi1 = point1[1] / 2 + quarterPi, - sinPhi1 = sin(phi1), - cosPhi1 = cos(phi1), - delta = lambda1 - lambda0, - sign = delta >= 0 ? 1 : -1, - absDelta = sign * delta, - antimeridian = absDelta > pi, - k = sinPhi0 * sinPhi1; - sum.add(atan2(k * sign * sin(absDelta), cosPhi0 * cosPhi1 + k * cos(absDelta))); - angle += antimeridian ? delta + sign * tau : delta; // Are the longitudes either side of the point’s meridian (lambda), - // and are the latitudes smaller than the parallel (phi)? - - if (antimeridian ^ lambda0 >= lambda ^ lambda1 >= lambda) { - var arc = cartesianCross(cartesian(point0), cartesian(point1)); - cartesianNormalizeInPlace(arc); - var intersection = cartesianCross(normal, arc); - cartesianNormalizeInPlace(intersection); - var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin(intersection[2]); - - if (phi > phiArc || phi === phiArc && (arc[0] || arc[1])) { - winding += antimeridian ^ delta >= 0 ? 1 : -1; - } - } - } - } // First, determine whether the South pole is inside or outside: - // - // It is inside if: - // * the polygon winds around it in a clockwise direction. - // * the polygon does not (cumulatively) wind around it, but has a negative - // (counter-clockwise) area. - // - // Second, count the (signed) number of times a segment crosses a lambda - // from the point to the South pole. If it is zero, then the point is the - // same side as the South pole. - - - return (angle < -epsilon || angle < epsilon && sum < -epsilon) ^ winding & 1; - } - - function ascending (a, b) { - return a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN; - } - - function bisector (compare) { - if (compare.length === 1) compare = ascendingComparator(compare); - return { - left: function left(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) hi = a.length; - - while (lo < hi) { - var mid = lo + hi >>> 1; - if (compare(a[mid], x) < 0) lo = mid + 1;else hi = mid; - } - - return lo; - }, - right: function right(a, x, lo, hi) { - if (lo == null) lo = 0; - if (hi == null) hi = a.length; - - while (lo < hi) { - var mid = lo + hi >>> 1; - if (compare(a[mid], x) > 0) hi = mid;else lo = mid + 1; - } - - return lo; - } - }; - } - - function ascendingComparator(f) { - return function (d, x) { - return ascending(f(d), x); - }; - } - - var ascendingBisect = bisector(ascending); - - function range (start, stop, step) { - start = +start, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start, start = 0, 1) : n < 3 ? 1 : +step; - var i = -1, - n = Math.max(0, Math.ceil((stop - start) / step)) | 0, - range = new Array(n); - - while (++i < n) { - range[i] = start + i * step; - } - - return range; - } - - function merge (arrays) { - var n = arrays.length, - m, - i = -1, - j = 0, - merged, - array; - - while (++i < n) { - j += arrays[i].length; - } - - merged = new Array(j); - - while (--n >= 0) { - array = arrays[n]; - m = array.length; - - while (--m >= 0) { - merged[--j] = array[m]; - } - } - - return merged; - } - - function clip (pointVisible, clipLine, interpolate, start) { - return function (sink) { - var line = clipLine(sink), - ringBuffer = clipBuffer(), - ringSink = clipLine(ringBuffer), - polygonStarted = false, - polygon, - segments, - ring; - var clip = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function polygonStart() { - clip.point = pointRing; - clip.lineStart = ringStart; - clip.lineEnd = ringEnd; - segments = []; - polygon = []; - }, - polygonEnd: function polygonEnd() { - clip.point = point; - clip.lineStart = lineStart; - clip.lineEnd = lineEnd; - segments = merge(segments); - var startInside = polygonContains(polygon, start); - - if (segments.length) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - clipRejoin(segments, compareIntersection, startInside, interpolate, sink); - } else if (startInside) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - } - - if (polygonStarted) sink.polygonEnd(), polygonStarted = false; - segments = polygon = null; - }, - sphere: function sphere() { - sink.polygonStart(); - sink.lineStart(); - interpolate(null, null, 1, sink); - sink.lineEnd(); - sink.polygonEnd(); - } - }; - - function point(lambda, phi) { - if (pointVisible(lambda, phi)) sink.point(lambda, phi); - } - - function pointLine(lambda, phi) { - line.point(lambda, phi); - } - - function lineStart() { - clip.point = pointLine; - line.lineStart(); - } - - function lineEnd() { - clip.point = point; - line.lineEnd(); - } - - function pointRing(lambda, phi) { - ring.push([lambda, phi]); - ringSink.point(lambda, phi); - } - - function ringStart() { - ringSink.lineStart(); - ring = []; - } - - function ringEnd() { - pointRing(ring[0][0], ring[0][1]); - ringSink.lineEnd(); - var clean = ringSink.clean(), - ringSegments = ringBuffer.result(), - i, - n = ringSegments.length, - m, - segment, - point; - ring.pop(); - polygon.push(ring); - ring = null; - if (!n) return; // No intersections. - - if (clean & 1) { - segment = ringSegments[0]; - - if ((m = segment.length - 1) > 0) { - if (!polygonStarted) sink.polygonStart(), polygonStarted = true; - sink.lineStart(); - - for (i = 0; i < m; ++i) { - sink.point((point = segment[i])[0], point[1]); - } - - sink.lineEnd(); - } - - return; - } // Rejoin connected segments. - // TODO reuse ringBuffer.rejoin()? - - - if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); - segments.push(ringSegments.filter(validSegment)); - } - - return clip; - }; - } - - function validSegment(segment) { - return segment.length > 1; - } // Intersections are sorted along the clip edge. For both antimeridian cutting - // and circle clipping, the same comparison is used. - - - function compareIntersection(a, b) { - return ((a = a.x)[0] < 0 ? a[1] - halfPi - epsilon : halfPi - a[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi - epsilon : halfPi - b[1]); - } - - var clipAntimeridian = clip(function () { - return true; - }, clipAntimeridianLine, clipAntimeridianInterpolate, [-pi, -halfPi]); // Takes a line and cuts into visible segments. Return values: 0 - there were - // intersections or the line was empty; 1 - no intersections; 2 - there were - // intersections, and the first and last segments should be rejoined. - - function clipAntimeridianLine(stream) { - var lambda0 = NaN, - phi0 = NaN, - sign0 = NaN, - _clean; // no intersections - - - return { - lineStart: function lineStart() { - stream.lineStart(); - _clean = 1; - }, - point: function point(lambda1, phi1) { - var sign1 = lambda1 > 0 ? pi : -pi, - delta = abs(lambda1 - lambda0); - - if (abs(delta - pi) < epsilon) { - // line crosses a pole - stream.point(lambda0, phi0 = (phi0 + phi1) / 2 > 0 ? halfPi : -halfPi); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - stream.point(lambda1, phi0); - _clean = 0; - } else if (sign0 !== sign1 && delta >= pi) { - // line crosses antimeridian - if (abs(lambda0 - sign0) < epsilon) lambda0 -= sign0 * epsilon; // handle degeneracies - - if (abs(lambda1 - sign1) < epsilon) lambda1 -= sign1 * epsilon; - phi0 = clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1); - stream.point(sign0, phi0); - stream.lineEnd(); - stream.lineStart(); - stream.point(sign1, phi0); - _clean = 0; - } - - stream.point(lambda0 = lambda1, phi0 = phi1); - sign0 = sign1; - }, - lineEnd: function lineEnd() { - stream.lineEnd(); - lambda0 = phi0 = NaN; - }, - clean: function clean() { - return 2 - _clean; // if intersections, rejoin first and last segments - } - }; - } - - function clipAntimeridianIntersect(lambda0, phi0, lambda1, phi1) { - var cosPhi0, - cosPhi1, - sinLambda0Lambda1 = sin(lambda0 - lambda1); - return abs(sinLambda0Lambda1) > epsilon ? atan((sin(phi0) * (cosPhi1 = cos(phi1)) * sin(lambda1) - sin(phi1) * (cosPhi0 = cos(phi0)) * sin(lambda0)) / (cosPhi0 * cosPhi1 * sinLambda0Lambda1)) : (phi0 + phi1) / 2; - } - - function clipAntimeridianInterpolate(from, to, direction, stream) { - var phi; - - if (from == null) { - phi = direction * halfPi; - stream.point(-pi, phi); - stream.point(0, phi); - stream.point(pi, phi); - stream.point(pi, 0); - stream.point(pi, -phi); - stream.point(0, -phi); - stream.point(-pi, -phi); - stream.point(-pi, 0); - stream.point(-pi, phi); - } else if (abs(from[0] - to[0]) > epsilon) { - var lambda = from[0] < to[0] ? pi : -pi; - phi = direction * lambda / 2; - stream.point(-lambda, phi); - stream.point(0, phi); - stream.point(lambda, phi); - } else { - stream.point(to[0], to[1]); - } - } - - function clipCircle (radius) { - var cr = cos(radius), - delta = 6 * radians, - smallRadius = cr > 0, - notHemisphere = abs(cr) > epsilon; // TODO optimise for this common case - - function interpolate(from, to, direction, stream) { - circleStream(stream, radius, delta, direction, from, to); - } - - function visible(lambda, phi) { - return cos(lambda) * cos(phi) > cr; - } // Takes a line and cuts into visible segments. Return values used for polygon - // clipping: 0 - there were intersections or the line was empty; 1 - no - // intersections 2 - there were intersections, and the first and last segments - // should be rejoined. - - - function clipLine(stream) { - var point0, // previous point - c0, // code for previous point - v0, // visibility of previous point - v00, // visibility of first point - _clean; // no intersections - - - return { - lineStart: function lineStart() { - v00 = v0 = false; - _clean = 1; - }, - point: function point(lambda, phi) { - var point1 = [lambda, phi], - point2, - v = visible(lambda, phi), - c = smallRadius ? v ? 0 : code(lambda, phi) : v ? code(lambda + (lambda < 0 ? pi : -pi), phi) : 0; - if (!point0 && (v00 = v0 = v)) stream.lineStart(); - - if (v !== v0) { - point2 = intersect(point0, point1); - if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) point1[2] = 1; - } - - if (v !== v0) { - _clean = 0; - - if (v) { - // outside going in - stream.lineStart(); - point2 = intersect(point1, point0); - stream.point(point2[0], point2[1]); - } else { - // inside going out - point2 = intersect(point0, point1); - stream.point(point2[0], point2[1], 2); - stream.lineEnd(); - } - - point0 = point2; - } else if (notHemisphere && point0 && smallRadius ^ v) { - var t; // If the codes for two points are different, or are both zero, - // and there this segment intersects with the small circle. - - if (!(c & c0) && (t = intersect(point1, point0, true))) { - _clean = 0; - - if (smallRadius) { - stream.lineStart(); - stream.point(t[0][0], t[0][1]); - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - } else { - stream.point(t[1][0], t[1][1]); - stream.lineEnd(); - stream.lineStart(); - stream.point(t[0][0], t[0][1], 3); - } - } - } - - if (v && (!point0 || !pointEqual(point0, point1))) { - stream.point(point1[0], point1[1]); - } - - point0 = point1, v0 = v, c0 = c; - }, - lineEnd: function lineEnd() { - if (v0) stream.lineEnd(); - point0 = null; - }, - // Rejoin first and last segments if there were intersections and the first - // and last points were visible. - clean: function clean() { - return _clean | (v00 && v0) << 1; - } - }; - } // Intersects the great circle between a and b with the clip circle. - - - function intersect(a, b, two) { - var pa = cartesian(a), - pb = cartesian(b); // We have two planes, n1.p = d1 and n2.p = d2. - // Find intersection line p(t) = c1 n1 + c2 n2 + t (n1 ⨯ n2). - - var n1 = [1, 0, 0], - // normal - n2 = cartesianCross(pa, pb), - n2n2 = cartesianDot(n2, n2), - n1n2 = n2[0], - // cartesianDot(n1, n2), - determinant = n2n2 - n1n2 * n1n2; // Two polar points. - - if (!determinant) return !two && a; - var c1 = cr * n2n2 / determinant, - c2 = -cr * n1n2 / determinant, - n1xn2 = cartesianCross(n1, n2), - A = cartesianScale(n1, c1), - B = cartesianScale(n2, c2); - cartesianAddInPlace(A, B); // Solve |p(t)|^2 = 1. - - var u = n1xn2, - w = cartesianDot(A, u), - uu = cartesianDot(u, u), - t2 = w * w - uu * (cartesianDot(A, A) - 1); - if (t2 < 0) return; - var t = sqrt(t2), - q = cartesianScale(u, (-w - t) / uu); - cartesianAddInPlace(q, A); - q = spherical(q); - if (!two) return q; // Two intersection points. - - var lambda0 = a[0], - lambda1 = b[0], - phi0 = a[1], - phi1 = b[1], - z; - if (lambda1 < lambda0) z = lambda0, lambda0 = lambda1, lambda1 = z; - var delta = lambda1 - lambda0, - polar = abs(delta - pi) < epsilon, - meridian = polar || delta < epsilon; - if (!polar && phi1 < phi0) z = phi0, phi0 = phi1, phi1 = z; // Check that the first point is between a and b. - - if (meridian ? polar ? phi0 + phi1 > 0 ^ q[1] < (abs(q[0] - lambda0) < epsilon ? phi0 : phi1) : phi0 <= q[1] && q[1] <= phi1 : delta > pi ^ (lambda0 <= q[0] && q[0] <= lambda1)) { - var q1 = cartesianScale(u, (-w + t) / uu); - cartesianAddInPlace(q1, A); - return [q, spherical(q1)]; - } - } // Generates a 4-bit vector representing the location of a point relative to - // the small circle's bounding box. - - - function code(lambda, phi) { - var r = smallRadius ? radius : pi - radius, - code = 0; - if (lambda < -r) code |= 1; // left - else if (lambda > r) code |= 2; // right - - if (phi < -r) code |= 4; // below - else if (phi > r) code |= 8; // above - - return code; - } - - return clip(visible, clipLine, interpolate, smallRadius ? [0, -radius] : [-pi, radius - pi]); - } - - function clipLine (a, b, x0, y0, x1, y1) { - var ax = a[0], - ay = a[1], - bx = b[0], - by = b[1], - t0 = 0, - t1 = 1, - dx = bx - ax, - dy = by - ay, - r; - r = x0 - ax; - if (!dx && r > 0) return; - r /= dx; - - if (dx < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dx > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = x1 - ax; - if (!dx && r < 0) return; - r /= dx; - - if (dx < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dx > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - r = y0 - ay; - if (!dy && r > 0) return; - r /= dy; - - if (dy < 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } else if (dy > 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } - - r = y1 - ay; - if (!dy && r < 0) return; - r /= dy; - - if (dy < 0) { - if (r > t1) return; - if (r > t0) t0 = r; - } else if (dy > 0) { - if (r < t0) return; - if (r < t1) t1 = r; - } - - if (t0 > 0) a[0] = ax + t0 * dx, a[1] = ay + t0 * dy; - if (t1 < 1) b[0] = ax + t1 * dx, b[1] = ay + t1 * dy; - return true; - } - - var clipMax = 1e9, - clipMin = -clipMax; // TODO Use d3-polygon’s polygonContains here for the ring check? - // TODO Eliminate duplicate buffering in clipBuffer and polygon.push? - - function clipRectangle(x0, y0, x1, y1) { - function visible(x, y) { - return x0 <= x && x <= x1 && y0 <= y && y <= y1; - } - - function interpolate(from, to, direction, stream) { - var a = 0, - a1 = 0; - - if (from == null || (a = corner(from, direction)) !== (a1 = corner(to, direction)) || comparePoint(from, to) < 0 ^ direction > 0) { - do { - stream.point(a === 0 || a === 3 ? x0 : x1, a > 1 ? y1 : y0); - } while ((a = (a + direction + 4) % 4) !== a1); - } else { - stream.point(to[0], to[1]); - } - } - - function corner(p, direction) { - return abs(p[0] - x0) < epsilon ? direction > 0 ? 0 : 3 : abs(p[0] - x1) < epsilon ? direction > 0 ? 2 : 1 : abs(p[1] - y0) < epsilon ? direction > 0 ? 1 : 0 : direction > 0 ? 3 : 2; // abs(p[1] - y1) < epsilon - } - - function compareIntersection(a, b) { - return comparePoint(a.x, b.x); - } - - function comparePoint(a, b) { - var ca = corner(a, 1), - cb = corner(b, 1); - return ca !== cb ? ca - cb : ca === 0 ? b[1] - a[1] : ca === 1 ? a[0] - b[0] : ca === 2 ? a[1] - b[1] : b[0] - a[0]; - } - - return function (stream) { - var activeStream = stream, - bufferStream = clipBuffer(), - segments, - polygon, - ring, - x__, - y__, - v__, - // first point - x_, - y_, - v_, - // previous point - first, - clean; - var clipStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: polygonStart, - polygonEnd: polygonEnd - }; - - function point(x, y) { - if (visible(x, y)) activeStream.point(x, y); - } - - function polygonInside() { - var winding = 0; - - for (var i = 0, n = polygon.length; i < n; ++i) { - for (var ring = polygon[i], j = 1, m = ring.length, point = ring[0], a0, a1, b0 = point[0], b1 = point[1]; j < m; ++j) { - a0 = b0, a1 = b1, point = ring[j], b0 = point[0], b1 = point[1]; - - if (a1 <= y1) { - if (b1 > y1 && (b0 - a0) * (y1 - a1) > (b1 - a1) * (x0 - a0)) ++winding; - } else { - if (b1 <= y1 && (b0 - a0) * (y1 - a1) < (b1 - a1) * (x0 - a0)) --winding; - } - } - } - - return winding; - } // Buffer geometry within a polygon and then clip it en masse. - - - function polygonStart() { - activeStream = bufferStream, segments = [], polygon = [], clean = true; - } - - function polygonEnd() { - var startInside = polygonInside(), - cleanInside = clean && startInside, - visible = (segments = merge(segments)).length; - - if (cleanInside || visible) { - stream.polygonStart(); - - if (cleanInside) { - stream.lineStart(); - interpolate(null, null, 1, stream); - stream.lineEnd(); - } - - if (visible) { - clipRejoin(segments, compareIntersection, startInside, interpolate, stream); - } - - stream.polygonEnd(); - } - - activeStream = stream, segments = polygon = ring = null; - } - - function lineStart() { - clipStream.point = linePoint; - if (polygon) polygon.push(ring = []); - first = true; - v_ = false; - x_ = y_ = NaN; - } // TODO rather than special-case polygons, simply handle them separately. - // Ideally, coincident intersection points should be jittered to avoid - // clipping issues. - - - function lineEnd() { - if (segments) { - linePoint(x__, y__); - if (v__ && v_) bufferStream.rejoin(); - segments.push(bufferStream.result()); - } - - clipStream.point = point; - if (v_) activeStream.lineEnd(); - } - - function linePoint(x, y) { - var v = visible(x, y); - if (polygon) ring.push([x, y]); - - if (first) { - x__ = x, y__ = y, v__ = v; - first = false; - - if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - } - } else { - if (v && v_) activeStream.point(x, y);else { - var a = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], - b = [x = Math.max(clipMin, Math.min(clipMax, x)), y = Math.max(clipMin, Math.min(clipMax, y))]; - - if (clipLine(a, b, x0, y0, x1, y1)) { - if (!v_) { - activeStream.lineStart(); - activeStream.point(a[0], a[1]); - } - - activeStream.point(b[0], b[1]); - if (!v) activeStream.lineEnd(); - clean = false; - } else if (v) { - activeStream.lineStart(); - activeStream.point(x, y); - clean = false; - } - } - } - - x_ = x, y_ = y, v_ = v; - } - - return clipStream; - }; - } - - var lengthSum = adder(), - lambda0, - sinPhi0, - cosPhi0; - var lengthStream = { - sphere: noop, - point: noop, - lineStart: lengthLineStart, - lineEnd: noop, - polygonStart: noop, - polygonEnd: noop - }; - - function lengthLineStart() { - lengthStream.point = lengthPointFirst; - lengthStream.lineEnd = lengthLineEnd; - } - - function lengthLineEnd() { - lengthStream.point = lengthStream.lineEnd = noop; - } - - function lengthPointFirst(lambda, phi) { - lambda *= radians, phi *= radians; - lambda0 = lambda, sinPhi0 = sin(phi), cosPhi0 = cos(phi); - lengthStream.point = lengthPoint; - } - - function lengthPoint(lambda, phi) { - lambda *= radians, phi *= radians; - var sinPhi = sin(phi), - cosPhi = cos(phi), - delta = abs(lambda - lambda0), - cosDelta = cos(delta), - sinDelta = sin(delta), - x = cosPhi * sinDelta, - y = cosPhi0 * sinPhi - sinPhi0 * cosPhi * cosDelta, - z = sinPhi0 * sinPhi + cosPhi0 * cosPhi * cosDelta; - lengthSum.add(atan2(sqrt(x * x + y * y), z)); - lambda0 = lambda, sinPhi0 = sinPhi, cosPhi0 = cosPhi; - } - - function length (object) { - lengthSum.reset(); - geoStream(object, lengthStream); - return +lengthSum; - } - - var coordinates = [null, null], - object = { - type: "LineString", - coordinates: coordinates - }; - function distance (a, b) { - coordinates[0] = a; - coordinates[1] = b; - return length(object); - } - - var containsObjectType = { - Feature: function Feature(object, point) { - return containsGeometry(object.geometry, point); - }, - FeatureCollection: function FeatureCollection(object, point) { - var features = object.features, - i = -1, - n = features.length; - - while (++i < n) { - if (containsGeometry(features[i].geometry, point)) return true; - } - - return false; - } - }; - var containsGeometryType = { - Sphere: function Sphere() { - return true; - }, - Point: function Point(object, point) { - return containsPoint(object.coordinates, point); - }, - MultiPoint: function MultiPoint(object, point) { - var coordinates = object.coordinates, - i = -1, - n = coordinates.length; - - while (++i < n) { - if (containsPoint(coordinates[i], point)) return true; - } - - return false; - }, - LineString: function LineString(object, point) { - return containsLine(object.coordinates, point); - }, - MultiLineString: function MultiLineString(object, point) { - var coordinates = object.coordinates, - i = -1, - n = coordinates.length; - - while (++i < n) { - if (containsLine(coordinates[i], point)) return true; - } - - return false; - }, - Polygon: function Polygon(object, point) { - return containsPolygon(object.coordinates, point); - }, - MultiPolygon: function MultiPolygon(object, point) { - var coordinates = object.coordinates, - i = -1, - n = coordinates.length; - - while (++i < n) { - if (containsPolygon(coordinates[i], point)) return true; - } - - return false; - }, - GeometryCollection: function GeometryCollection(object, point) { - var geometries = object.geometries, - i = -1, - n = geometries.length; - - while (++i < n) { - if (containsGeometry(geometries[i], point)) return true; - } - - return false; - } - }; - - function containsGeometry(geometry, point) { - return geometry && containsGeometryType.hasOwnProperty(geometry.type) ? containsGeometryType[geometry.type](geometry, point) : false; - } - - function containsPoint(coordinates, point) { - return distance(coordinates, point) === 0; - } - - function containsLine(coordinates, point) { - var ao, bo, ab; - - for (var i = 0, n = coordinates.length; i < n; i++) { - bo = distance(coordinates[i], point); - if (bo === 0) return true; - - if (i > 0) { - ab = distance(coordinates[i], coordinates[i - 1]); - if (ab > 0 && ao <= ab && bo <= ab && (ao + bo - ab) * (1 - Math.pow((ao - bo) / ab, 2)) < epsilon2 * ab) return true; - } - - ao = bo; - } - - return false; - } - - function containsPolygon(coordinates, point) { - return !!polygonContains(coordinates.map(ringRadians), pointRadians(point)); - } - - function ringRadians(ring) { - return ring = ring.map(pointRadians), ring.pop(), ring; - } - - function pointRadians(point) { - return [point[0] * radians, point[1] * radians]; - } - - function geoContains (object, point) { - return (object && containsObjectType.hasOwnProperty(object.type) ? containsObjectType[object.type] : containsGeometry)(object, point); - } - - function graticuleX(y0, y1, dy) { - var y = range(y0, y1 - epsilon, dy).concat(y1); - return function (x) { - return y.map(function (y) { - return [x, y]; - }); - }; - } - - function graticuleY(x0, x1, dx) { - var x = range(x0, x1 - epsilon, dx).concat(x1); - return function (y) { - return x.map(function (x) { - return [x, y]; - }); - }; - } - - function graticule() { - var x1, - x0, - X1, - X0, - y1, - y0, - Y1, - Y0, - dx = 10, - dy = dx, - DX = 90, - DY = 360, - x, - y, - X, - Y, - precision = 2.5; - - function graticule() { - return { - type: "MultiLineString", - coordinates: lines() - }; - } - - function lines() { - return range(ceil(X0 / DX) * DX, X1, DX).map(X).concat(range(ceil(Y0 / DY) * DY, Y1, DY).map(Y)).concat(range(ceil(x0 / dx) * dx, x1, dx).filter(function (x) { - return abs(x % DX) > epsilon; - }).map(x)).concat(range(ceil(y0 / dy) * dy, y1, dy).filter(function (y) { - return abs(y % DY) > epsilon; - }).map(y)); - } - - graticule.lines = function () { - return lines().map(function (coordinates) { - return { - type: "LineString", - coordinates: coordinates - }; - }); - }; - - graticule.outline = function () { - return { - type: "Polygon", - coordinates: [X(X0).concat(Y(Y1).slice(1), X(X1).reverse().slice(1), Y(Y0).reverse().slice(1))] - }; - }; - - graticule.extent = function (_) { - if (!arguments.length) return graticule.extentMinor(); - return graticule.extentMajor(_).extentMinor(_); - }; - - graticule.extentMajor = function (_) { - if (!arguments.length) return [[X0, Y0], [X1, Y1]]; - X0 = +_[0][0], X1 = +_[1][0]; - Y0 = +_[0][1], Y1 = +_[1][1]; - if (X0 > X1) _ = X0, X0 = X1, X1 = _; - if (Y0 > Y1) _ = Y0, Y0 = Y1, Y1 = _; - return graticule.precision(precision); - }; - - graticule.extentMinor = function (_) { - if (!arguments.length) return [[x0, y0], [x1, y1]]; - x0 = +_[0][0], x1 = +_[1][0]; - y0 = +_[0][1], y1 = +_[1][1]; - if (x0 > x1) _ = x0, x0 = x1, x1 = _; - if (y0 > y1) _ = y0, y0 = y1, y1 = _; - return graticule.precision(precision); - }; - - graticule.step = function (_) { - if (!arguments.length) return graticule.stepMinor(); - return graticule.stepMajor(_).stepMinor(_); - }; - - graticule.stepMajor = function (_) { - if (!arguments.length) return [DX, DY]; - DX = +_[0], DY = +_[1]; - return graticule; - }; - - graticule.stepMinor = function (_) { - if (!arguments.length) return [dx, dy]; - dx = +_[0], dy = +_[1]; - return graticule; - }; - - graticule.precision = function (_) { - if (!arguments.length) return precision; - precision = +_; - x = graticuleX(y0, y1, 90); - y = graticuleY(x0, x1, precision); - X = graticuleX(Y0, Y1, 90); - Y = graticuleY(X0, X1, precision); - return graticule; - }; - - return graticule.extentMajor([[-180, -90 + epsilon], [180, 90 - epsilon]]).extentMinor([[-180, -80 - epsilon], [180, 80 + epsilon]]); - } - function graticule10() { - return graticule()(); - } - - function identity (x) { - return x; - } - - var areaSum = adder(), - areaRingSum = adder(), - x00, - y00, - x0, - y0; - var areaStream = { - point: noop, - lineStart: noop, - lineEnd: noop, - polygonStart: function polygonStart() { - areaStream.lineStart = areaRingStart; - areaStream.lineEnd = areaRingEnd; - }, - polygonEnd: function polygonEnd() { - areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop; - areaSum.add(abs(areaRingSum)); - areaRingSum.reset(); - }, - result: function result() { - var area = areaSum / 2; - areaSum.reset(); - return area; - } - }; - - function areaRingStart() { - areaStream.point = areaPointFirst; - } - - function areaPointFirst(x, y) { - areaStream.point = areaPoint; - x00 = x0 = x, y00 = y0 = y; - } - - function areaPoint(x, y) { - areaRingSum.add(y0 * x - x0 * y); - x0 = x, y0 = y; - } - - function areaRingEnd() { - areaPoint(x00, y00); - } - - var x0$1 = Infinity, - y0$1 = x0$1, - x1 = -x0$1, - y1 = x1; - var boundsStream = { - point: boundsPoint, - lineStart: noop, - lineEnd: noop, - polygonStart: noop, - polygonEnd: noop, - result: function result() { - var bounds = [[x0$1, y0$1], [x1, y1]]; - x1 = y1 = -(y0$1 = x0$1 = Infinity); - return bounds; - } - }; - - function boundsPoint(x, y) { - if (x < x0$1) x0$1 = x; - if (x > x1) x1 = x; - if (y < y0$1) y0$1 = y; - if (y > y1) y1 = y; - } - - var X0 = 0, - Y0 = 0, - Z0 = 0, - X1 = 0, - Y1 = 0, - Z1 = 0, - X2 = 0, - Y2 = 0, - Z2 = 0, - x00$1, - y00$1, - x0$2, - y0$2; - var centroidStream = { - point: centroidPoint, - lineStart: centroidLineStart, - lineEnd: centroidLineEnd, - polygonStart: function polygonStart() { - centroidStream.lineStart = centroidRingStart; - centroidStream.lineEnd = centroidRingEnd; - }, - polygonEnd: function polygonEnd() { - centroidStream.point = centroidPoint; - centroidStream.lineStart = centroidLineStart; - centroidStream.lineEnd = centroidLineEnd; - }, - result: function result() { - var centroid = Z2 ? [X2 / Z2, Y2 / Z2] : Z1 ? [X1 / Z1, Y1 / Z1] : Z0 ? [X0 / Z0, Y0 / Z0] : [NaN, NaN]; - X0 = Y0 = Z0 = X1 = Y1 = Z1 = X2 = Y2 = Z2 = 0; - return centroid; - } - }; - - function centroidPoint(x, y) { - X0 += x; - Y0 += y; - ++Z0; - } - - function centroidLineStart() { - centroidStream.point = centroidPointFirstLine; - } - - function centroidPointFirstLine(x, y) { - centroidStream.point = centroidPointLine; - centroidPoint(x0$2 = x, y0$2 = y); - } - - function centroidPointLine(x, y) { - var dx = x - x0$2, - dy = y - y0$2, - z = sqrt(dx * dx + dy * dy); - X1 += z * (x0$2 + x) / 2; - Y1 += z * (y0$2 + y) / 2; - Z1 += z; - centroidPoint(x0$2 = x, y0$2 = y); - } - - function centroidLineEnd() { - centroidStream.point = centroidPoint; - } - - function centroidRingStart() { - centroidStream.point = centroidPointFirstRing; - } - - function centroidRingEnd() { - centroidPointRing(x00$1, y00$1); - } - - function centroidPointFirstRing(x, y) { - centroidStream.point = centroidPointRing; - centroidPoint(x00$1 = x0$2 = x, y00$1 = y0$2 = y); - } - - function centroidPointRing(x, y) { - var dx = x - x0$2, - dy = y - y0$2, - z = sqrt(dx * dx + dy * dy); - X1 += z * (x0$2 + x) / 2; - Y1 += z * (y0$2 + y) / 2; - Z1 += z; - z = y0$2 * x - x0$2 * y; - X2 += z * (x0$2 + x); - Y2 += z * (y0$2 + y); - Z2 += z * 3; - centroidPoint(x0$2 = x, y0$2 = y); - } - - function PathContext(context) { - this._context = context; - } - PathContext.prototype = { - _radius: 4.5, - pointRadius: function pointRadius(_) { - return this._radius = _, this; - }, - polygonStart: function polygonStart() { - this._line = 0; - }, - polygonEnd: function polygonEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._point = 0; - }, - lineEnd: function lineEnd() { - if (this._line === 0) this._context.closePath(); - this._point = NaN; - }, - point: function point(x, y) { - switch (this._point) { - case 0: - { - this._context.moveTo(x, y); - - this._point = 1; - break; - } - - case 1: - { - this._context.lineTo(x, y); - - break; - } - - default: - { - this._context.moveTo(x + this._radius, y); - - this._context.arc(x, y, this._radius, 0, tau); - - break; - } - } - }, - result: noop - }; - - var lengthSum$1 = adder(), - lengthRing, - x00$2, - y00$2, - x0$3, - y0$3; - var lengthStream$1 = { - point: noop, - lineStart: function lineStart() { - lengthStream$1.point = lengthPointFirst$1; - }, - lineEnd: function lineEnd() { - if (lengthRing) lengthPoint$1(x00$2, y00$2); - lengthStream$1.point = noop; - }, - polygonStart: function polygonStart() { - lengthRing = true; - }, - polygonEnd: function polygonEnd() { - lengthRing = null; - }, - result: function result() { - var length = +lengthSum$1; - lengthSum$1.reset(); - return length; - } - }; - - function lengthPointFirst$1(x, y) { - lengthStream$1.point = lengthPoint$1; - x00$2 = x0$3 = x, y00$2 = y0$3 = y; - } - - function lengthPoint$1(x, y) { - x0$3 -= x, y0$3 -= y; - lengthSum$1.add(sqrt(x0$3 * x0$3 + y0$3 * y0$3)); - x0$3 = x, y0$3 = y; - } - - function PathString() { - this._string = []; - } - PathString.prototype = { - _radius: 4.5, - _circle: circle(4.5), - pointRadius: function pointRadius(_) { - if ((_ = +_) !== this._radius) this._radius = _, this._circle = null; - return this; - }, - polygonStart: function polygonStart() { - this._line = 0; - }, - polygonEnd: function polygonEnd() { - this._line = NaN; - }, - lineStart: function lineStart() { - this._point = 0; - }, - lineEnd: function lineEnd() { - if (this._line === 0) this._string.push("Z"); - this._point = NaN; - }, - point: function point(x, y) { - switch (this._point) { - case 0: - { - this._string.push("M", x, ",", y); - - this._point = 1; - break; - } - - case 1: - { - this._string.push("L", x, ",", y); - - break; - } - - default: - { - if (this._circle == null) this._circle = circle(this._radius); - - this._string.push("M", x, ",", y, this._circle); - - break; - } - } - }, - result: function result() { - if (this._string.length) { - var result = this._string.join(""); - - this._string = []; - return result; - } else { - return null; - } - } - }; - - function circle(radius) { - return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z"; - } - - function geoPath (projection, context) { - var pointRadius = 4.5, - projectionStream, - contextStream; - - function path(object) { - if (object) { - if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); - geoStream(object, projectionStream(contextStream)); - } - - return contextStream.result(); - } - - path.area = function (object) { - geoStream(object, projectionStream(areaStream)); - return areaStream.result(); - }; - - path.measure = function (object) { - geoStream(object, projectionStream(lengthStream$1)); - return lengthStream$1.result(); - }; - - path.bounds = function (object) { - geoStream(object, projectionStream(boundsStream)); - return boundsStream.result(); - }; - - path.centroid = function (object) { - geoStream(object, projectionStream(centroidStream)); - return centroidStream.result(); - }; - - path.projection = function (_) { - return arguments.length ? (projectionStream = _ == null ? (projection = null, identity) : (projection = _).stream, path) : projection; - }; - - path.context = function (_) { - if (!arguments.length) return context; - contextStream = _ == null ? (context = null, new PathString()) : new PathContext(context = _); - if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); - return path; - }; - - path.pointRadius = function (_) { - if (!arguments.length) return pointRadius; - pointRadius = typeof _ === "function" ? _ : (contextStream.pointRadius(+_), +_); - return path; - }; - - return path.projection(projection).context(context); - } - - function transformer(methods) { - return function (stream) { - var s = new TransformStream(); - - for (var key in methods) { - s[key] = methods[key]; - } - - s.stream = stream; - return s; - }; - } - - function TransformStream() {} - - TransformStream.prototype = { - constructor: TransformStream, - point: function point(x, y) { - this.stream.point(x, y); - }, - sphere: function sphere() { - this.stream.sphere(); - }, - lineStart: function lineStart() { - this.stream.lineStart(); - }, - lineEnd: function lineEnd() { - this.stream.lineEnd(); - }, - polygonStart: function polygonStart() { - this.stream.polygonStart(); - }, - polygonEnd: function polygonEnd() { - this.stream.polygonEnd(); - } - }; - - function fit(projection, fitBounds, object) { - var clip = projection.clipExtent && projection.clipExtent(); - projection.scale(150).translate([0, 0]); - if (clip != null) projection.clipExtent(null); - geoStream(object, projection.stream(boundsStream)); - fitBounds(boundsStream.result()); - if (clip != null) projection.clipExtent(clip); - return projection; - } - - function fitExtent(projection, extent, object) { - return fit(projection, function (b) { - var w = extent[1][0] - extent[0][0], - h = extent[1][1] - extent[0][1], - k = Math.min(w / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), - x = +extent[0][0] + (w - k * (b[1][0] + b[0][0])) / 2, - y = +extent[0][1] + (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([x, y]); - }, object); - } - function fitSize(projection, size, object) { - return fitExtent(projection, [[0, 0], size], object); - } - function fitWidth(projection, width, object) { - return fit(projection, function (b) { - var w = +width, - k = w / (b[1][0] - b[0][0]), - x = (w - k * (b[1][0] + b[0][0])) / 2, - y = -k * b[0][1]; - projection.scale(150 * k).translate([x, y]); - }, object); - } - function fitHeight(projection, height, object) { - return fit(projection, function (b) { - var h = +height, - k = h / (b[1][1] - b[0][1]), - x = -k * b[0][0], - y = (h - k * (b[1][1] + b[0][1])) / 2; - projection.scale(150 * k).translate([x, y]); - }, object); - } - - var maxDepth = 16, - // maximum depth of subdivision - cosMinDistance = cos(30 * radians); // cos(minimum angular distance) - - function resample (project, delta2) { - return +delta2 ? resample$1(project, delta2) : resampleNone(project); - } - - function resampleNone(project) { - return transformer({ - point: function point(x, y) { - x = project(x, y); - this.stream.point(x[0], x[1]); - } - }); - } - - function resample$1(project, delta2) { - function resampleLineTo(x0, y0, lambda0, a0, b0, c0, x1, y1, lambda1, a1, b1, c1, depth, stream) { - var dx = x1 - x0, - dy = y1 - y0, - d2 = dx * dx + dy * dy; - - if (d2 > 4 * delta2 && depth--) { - var a = a0 + a1, - b = b0 + b1, - c = c0 + c1, - m = sqrt(a * a + b * b + c * c), - phi2 = asin(c /= m), - lambda2 = abs(abs(c) - 1) < epsilon || abs(lambda0 - lambda1) < epsilon ? (lambda0 + lambda1) / 2 : atan2(b, a), - p = project(lambda2, phi2), - x2 = p[0], - y2 = p[1], - dx2 = x2 - x0, - dy2 = y2 - y0, - dz = dy * dx2 - dx * dy2; - - if (dz * dz / d2 > delta2 // perpendicular projected distance - || abs((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 // midpoint close to an end - || a0 * a1 + b0 * b1 + c0 * c1 < cosMinDistance) { - // angular distance - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x2, y2, lambda2, a /= m, b /= m, c, depth, stream); - stream.point(x2, y2); - resampleLineTo(x2, y2, lambda2, a, b, c, x1, y1, lambda1, a1, b1, c1, depth, stream); - } - } - } - - return function (stream) { - var lambda00, x00, y00, a00, b00, c00, // first point - lambda0, x0, y0, a0, b0, c0; // previous point - - var resampleStream = { - point: point, - lineStart: lineStart, - lineEnd: lineEnd, - polygonStart: function polygonStart() { - stream.polygonStart(); - resampleStream.lineStart = ringStart; - }, - polygonEnd: function polygonEnd() { - stream.polygonEnd(); - resampleStream.lineStart = lineStart; - } - }; - - function point(x, y) { - x = project(x, y); - stream.point(x[0], x[1]); - } - - function lineStart() { - x0 = NaN; - resampleStream.point = linePoint; - stream.lineStart(); - } - - function linePoint(lambda, phi) { - var c = cartesian([lambda, phi]), - p = project(lambda, phi); - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x0 = p[0], y0 = p[1], lambda0 = lambda, a0 = c[0], b0 = c[1], c0 = c[2], maxDepth, stream); - stream.point(x0, y0); - } - - function lineEnd() { - resampleStream.point = point; - stream.lineEnd(); - } - - function ringStart() { - lineStart(); - resampleStream.point = ringPoint; - resampleStream.lineEnd = ringEnd; - } - - function ringPoint(lambda, phi) { - linePoint(lambda00 = lambda, phi), x00 = x0, y00 = y0, a00 = a0, b00 = b0, c00 = c0; - resampleStream.point = linePoint; - } - - function ringEnd() { - resampleLineTo(x0, y0, lambda0, a0, b0, c0, x00, y00, lambda00, a00, b00, c00, maxDepth, stream); - resampleStream.lineEnd = lineEnd; - lineEnd(); - } - - return resampleStream; - }; - } - - var transformRadians = transformer({ - point: function point(x, y) { - this.stream.point(x * radians, y * radians); - } - }); - - function transformRotate(rotate) { - return transformer({ - point: function point(x, y) { - var r = rotate(x, y); - return this.stream.point(r[0], r[1]); - } - }); - } - - function scaleTranslate(k, dx, dy, sx, sy) { - function transform(x, y) { - x *= sx; - y *= sy; - return [dx + k * x, dy - k * y]; - } - - transform.invert = function (x, y) { - return [(x - dx) / k * sx, (dy - y) / k * sy]; - }; - - return transform; - } - - function scaleTranslateRotate(k, dx, dy, sx, sy, alpha) { - var cosAlpha = cos(alpha), - sinAlpha = sin(alpha), - a = cosAlpha * k, - b = sinAlpha * k, - ai = cosAlpha / k, - bi = sinAlpha / k, - ci = (sinAlpha * dy - cosAlpha * dx) / k, - fi = (sinAlpha * dx + cosAlpha * dy) / k; - - function transform(x, y) { - x *= sx; - y *= sy; - return [a * x - b * y + dx, dy - b * x - a * y]; - } - - transform.invert = function (x, y) { - return [sx * (ai * x - bi * y + ci), sy * (fi - bi * x - ai * y)]; - }; - - return transform; - } - - function projection(project) { - return projectionMutator(function () { - return project; - })(); - } - function projectionMutator(projectAt) { - var project, - k = 150, - // scale - x = 480, - y = 250, - // translate - lambda = 0, - phi = 0, - // center - deltaLambda = 0, - deltaPhi = 0, - deltaGamma = 0, - rotate, - // pre-rotate - alpha = 0, - // post-rotate angle - sx = 1, - // reflectX - sy = 1, - // reflectX - theta = null, - preclip = clipAntimeridian, - // pre-clip angle - x0 = null, - y0, - x1, - y1, - postclip = identity, - // post-clip extent - delta2 = 0.5, - // precision - projectResample, - projectTransform, - projectRotateTransform, - cache, - cacheStream; - - function projection(point) { - return projectRotateTransform(point[0] * radians, point[1] * radians); - } - - function invert(point) { - point = projectRotateTransform.invert(point[0], point[1]); - return point && [point[0] * degrees, point[1] * degrees]; - } - - projection.stream = function (stream) { - return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); - }; - - projection.preclip = function (_) { - return arguments.length ? (preclip = _, theta = undefined, reset()) : preclip; - }; - - projection.postclip = function (_) { - return arguments.length ? (postclip = _, x0 = y0 = x1 = y1 = null, reset()) : postclip; - }; - - projection.clipAngle = function (_) { - return arguments.length ? (preclip = +_ ? clipCircle(theta = _ * radians) : (theta = null, clipAntimeridian), reset()) : theta * degrees; - }; - - projection.clipExtent = function (_) { - return arguments.length ? (postclip = _ == null ? (x0 = y0 = x1 = y1 = null, identity) : clipRectangle(x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reset()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - projection.scale = function (_) { - return arguments.length ? (k = +_, recenter()) : k; - }; - - projection.translate = function (_) { - return arguments.length ? (x = +_[0], y = +_[1], recenter()) : [x, y]; - }; - - projection.center = function (_) { - return arguments.length ? (lambda = _[0] % 360 * radians, phi = _[1] % 360 * radians, recenter()) : [lambda * degrees, phi * degrees]; - }; - - projection.rotate = function (_) { - return arguments.length ? (deltaLambda = _[0] % 360 * radians, deltaPhi = _[1] % 360 * radians, deltaGamma = _.length > 2 ? _[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees]; - }; - - projection.angle = function (_) { - return arguments.length ? (alpha = _ % 360 * radians, recenter()) : alpha * degrees; - }; - - projection.reflectX = function (_) { - return arguments.length ? (sx = _ ? -1 : 1, recenter()) : sx < 0; - }; - - projection.reflectY = function (_) { - return arguments.length ? (sy = _ ? -1 : 1, recenter()) : sy < 0; - }; - - projection.precision = function (_) { - return arguments.length ? (projectResample = resample(projectTransform, delta2 = _ * _), reset()) : sqrt(delta2); - }; - - projection.fitExtent = function (extent, object) { - return fitExtent(projection, extent, object); - }; - - projection.fitSize = function (size, object) { - return fitSize(projection, size, object); - }; - - projection.fitWidth = function (width, object) { - return fitWidth(projection, width, object); - }; - - projection.fitHeight = function (height, object) { - return fitHeight(projection, height, object); - }; - - function recenter() { - var center = scaleTranslateRotate(k, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi)), - transform = (alpha ? scaleTranslateRotate : scaleTranslate)(k, x - center[0], y - center[1], sx, sy, alpha); - rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma); - projectTransform = compose(project, transform); - projectRotateTransform = compose(rotate, projectTransform); - projectResample = resample(projectTransform, delta2); - return reset(); - } - - function reset() { - cache = cacheStream = null; - return projection; - } - - return function () { - project = projectAt.apply(this, arguments); - projection.invert = project.invert && invert; - return recenter(); - }; - } - - function conicProjection(projectAt) { - var phi0 = 0, - phi1 = pi / 3, - m = projectionMutator(projectAt), - p = m(phi0, phi1); - - p.parallels = function (_) { - return arguments.length ? m(phi0 = _[0] * radians, phi1 = _[1] * radians) : [phi0 * degrees, phi1 * degrees]; - }; - - return p; - } - - function cylindricalEqualAreaRaw(phi0) { - var cosPhi0 = cos(phi0); - - function forward(lambda, phi) { - return [lambda * cosPhi0, sin(phi) / cosPhi0]; - } - - forward.invert = function (x, y) { - return [x / cosPhi0, asin(y * cosPhi0)]; - }; - - return forward; - } - - function conicEqualAreaRaw(y0, y1) { - var sy0 = sin(y0), - n = (sy0 + sin(y1)) / 2; // Are the parallels symmetrical around the Equator? - - if (abs(n) < epsilon) return cylindricalEqualAreaRaw(y0); - var c = 1 + sy0 * (2 * n - sy0), - r0 = sqrt(c) / n; - - function project(x, y) { - var r = sqrt(c - 2 * n * sin(y)) / n; - return [r * sin(x *= n), r0 - r * cos(x)]; - } - - project.invert = function (x, y) { - var r0y = r0 - y, - l = atan2(x, abs(r0y)) * sign(r0y); - if (r0y * n < 0) l -= pi * sign(x) * sign(r0y); - return [l / n, asin((c - (x * x + r0y * r0y) * n * n) / (2 * n))]; - }; - - return project; - } - function geoConicEqualArea () { - return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]); - } - - function geoAlbers () { - return geoConicEqualArea().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]); - } - - // as this will avoid emitting interleaving lines and polygons. - - function multiplex(streams) { - var n = streams.length; - return { - point: function point(x, y) { - var i = -1; - - while (++i < n) { - streams[i].point(x, y); - } - }, - sphere: function sphere() { - var i = -1; - - while (++i < n) { - streams[i].sphere(); - } - }, - lineStart: function lineStart() { - var i = -1; - - while (++i < n) { - streams[i].lineStart(); - } - }, - lineEnd: function lineEnd() { - var i = -1; - - while (++i < n) { - streams[i].lineEnd(); - } - }, - polygonStart: function polygonStart() { - var i = -1; - - while (++i < n) { - streams[i].polygonStart(); - } - }, - polygonEnd: function polygonEnd() { - var i = -1; - - while (++i < n) { - streams[i].polygonEnd(); - } - } - }; - } // A composite projection for the United States, configured by default for - // 960×500. The projection also works quite well at 960×600 if you change the - // scale to 1285 and adjust the translate accordingly. The set of standard - // parallels for each region comes from USGS, which is published here: - // http://egsc.usgs.gov/isb/pubs/MapProjections/projections.html#albers - - - function geoAlbersUsa () { - var cache, - cacheStream, - lower48 = geoAlbers(), - lower48Point, - alaska = geoConicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), - alaskaPoint, - // EPSG:3338 - hawaii = geoConicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), - hawaiiPoint, - // ESRI:102007 - _point, - pointStream = { - point: function point(x, y) { - _point = [x, y]; - } - }; - - function albersUsa(coordinates) { - var x = coordinates[0], - y = coordinates[1]; - return _point = null, (lower48Point.point(x, y), _point) || (alaskaPoint.point(x, y), _point) || (hawaiiPoint.point(x, y), _point); - } - - albersUsa.invert = function (coordinates) { - var k = lower48.scale(), - t = lower48.translate(), - x = (coordinates[0] - t[0]) / k, - y = (coordinates[1] - t[1]) / k; - return (y >= 0.120 && y < 0.234 && x >= -0.425 && x < -0.214 ? alaska : y >= 0.166 && y < 0.234 && x >= -0.214 && x < -0.115 ? hawaii : lower48).invert(coordinates); - }; - - albersUsa.stream = function (stream) { - return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]); - }; - - albersUsa.precision = function (_) { - if (!arguments.length) return lower48.precision(); - lower48.precision(_), alaska.precision(_), hawaii.precision(_); - return reset(); - }; - - albersUsa.scale = function (_) { - if (!arguments.length) return lower48.scale(); - lower48.scale(_), alaska.scale(_ * 0.35), hawaii.scale(_); - return albersUsa.translate(lower48.translate()); - }; - - albersUsa.translate = function (_) { - if (!arguments.length) return lower48.translate(); - var k = lower48.scale(), - x = +_[0], - y = +_[1]; - lower48Point = lower48.translate(_).clipExtent([[x - 0.455 * k, y - 0.238 * k], [x + 0.455 * k, y + 0.238 * k]]).stream(pointStream); - alaskaPoint = alaska.translate([x - 0.307 * k, y + 0.201 * k]).clipExtent([[x - 0.425 * k + epsilon, y + 0.120 * k + epsilon], [x - 0.214 * k - epsilon, y + 0.234 * k - epsilon]]).stream(pointStream); - hawaiiPoint = hawaii.translate([x - 0.205 * k, y + 0.212 * k]).clipExtent([[x - 0.214 * k + epsilon, y + 0.166 * k + epsilon], [x - 0.115 * k - epsilon, y + 0.234 * k - epsilon]]).stream(pointStream); - return reset(); - }; - - albersUsa.fitExtent = function (extent, object) { - return fitExtent(albersUsa, extent, object); - }; - - albersUsa.fitSize = function (size, object) { - return fitSize(albersUsa, size, object); - }; - - albersUsa.fitWidth = function (width, object) { - return fitWidth(albersUsa, width, object); - }; - - albersUsa.fitHeight = function (height, object) { - return fitHeight(albersUsa, height, object); - }; - - function reset() { - cache = cacheStream = null; - return albersUsa; - } - - return albersUsa.scale(1070); - } - - function azimuthalRaw(scale) { - return function (x, y) { - var cx = cos(x), - cy = cos(y), - k = scale(cx * cy); - return [k * cy * sin(x), k * sin(y)]; - }; - } - function azimuthalInvert(angle) { - return function (x, y) { - var z = sqrt(x * x + y * y), - c = angle(z), - sc = sin(c), - cc = cos(c); - return [atan2(x * sc, z * cc), asin(z && y * sc / z)]; - }; - } - - var azimuthalEqualAreaRaw = azimuthalRaw(function (cxcy) { - return sqrt(2 / (1 + cxcy)); - }); - azimuthalEqualAreaRaw.invert = azimuthalInvert(function (z) { - return 2 * asin(z / 2); - }); - function geoAzimuthalEqualArea () { - return projection(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3); - } - - var azimuthalEquidistantRaw = azimuthalRaw(function (c) { - return (c = acos(c)) && c / sin(c); - }); - azimuthalEquidistantRaw.invert = azimuthalInvert(function (z) { - return z; - }); - function geoAzimuthalEquidistant () { - return projection(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3); - } - - function mercatorRaw(lambda, phi) { - return [lambda, log(tan((halfPi + phi) / 2))]; - } - - mercatorRaw.invert = function (x, y) { - return [x, 2 * atan(exp(y)) - halfPi]; - }; - - function geoMercator () { - return mercatorProjection(mercatorRaw).scale(961 / tau); - } - function mercatorProjection(project) { - var m = projection(project), - center = m.center, - scale = m.scale, - translate = m.translate, - clipExtent = m.clipExtent, - x0 = null, - y0, - x1, - y1; // clip extent - - m.scale = function (_) { - return arguments.length ? (scale(_), reclip()) : scale(); - }; - - m.translate = function (_) { - return arguments.length ? (translate(_), reclip()) : translate(); - }; - - m.center = function (_) { - return arguments.length ? (center(_), reclip()) : center(); - }; - - m.clipExtent = function (_) { - return arguments.length ? (_ == null ? x0 = y0 = x1 = y1 = null : (x0 = +_[0][0], y0 = +_[0][1], x1 = +_[1][0], y1 = +_[1][1]), reclip()) : x0 == null ? null : [[x0, y0], [x1, y1]]; - }; - - function reclip() { - var k = pi * scale(), - t = m(rotation(m.rotate()).invert([0, 0])); - return clipExtent(x0 == null ? [[t[0] - k, t[1] - k], [t[0] + k, t[1] + k]] : project === mercatorRaw ? [[Math.max(t[0] - k, x0), y0], [Math.min(t[0] + k, x1), y1]] : [[x0, Math.max(t[1] - k, y0)], [x1, Math.min(t[1] + k, y1)]]); - } - - return reclip(); - } - - function tany(y) { - return tan((halfPi + y) / 2); - } - - function conicConformalRaw(y0, y1) { - var cy0 = cos(y0), - n = y0 === y1 ? sin(y0) : log(cy0 / cos(y1)) / log(tany(y1) / tany(y0)), - f = cy0 * pow(tany(y0), n) / n; - if (!n) return mercatorRaw; - - function project(x, y) { - if (f > 0) { - if (y < -halfPi + epsilon) y = -halfPi + epsilon; - } else { - if (y > halfPi - epsilon) y = halfPi - epsilon; - } - - var r = f / pow(tany(y), n); - return [r * sin(n * x), f - r * cos(n * x)]; - } - - project.invert = function (x, y) { - var fy = f - y, - r = sign(n) * sqrt(x * x + fy * fy), - l = atan2(x, abs(fy)) * sign(fy); - if (fy * n < 0) l -= pi * sign(x) * sign(fy); - return [l / n, 2 * atan(pow(f / r, 1 / n)) - halfPi]; - }; - - return project; - } - function geoConicConformal () { - return conicProjection(conicConformalRaw).scale(109.5).parallels([30, 30]); - } - - function equirectangularRaw(lambda, phi) { - return [lambda, phi]; - } - equirectangularRaw.invert = equirectangularRaw; - function geoEquirectangular () { - return projection(equirectangularRaw).scale(152.63); - } - - function conicEquidistantRaw(y0, y1) { - var cy0 = cos(y0), - n = y0 === y1 ? sin(y0) : (cy0 - cos(y1)) / (y1 - y0), - g = cy0 / n + y0; - if (abs(n) < epsilon) return equirectangularRaw; - - function project(x, y) { - var gy = g - y, - nx = n * x; - return [gy * sin(nx), g - gy * cos(nx)]; - } - - project.invert = function (x, y) { - var gy = g - y, - l = atan2(x, abs(gy)) * sign(gy); - if (gy * n < 0) l -= pi * sign(x) * sign(gy); - return [l / n, g - sign(n) * sqrt(x * x + gy * gy)]; - }; - - return project; - } - function geoConicEquidistant () { - return conicProjection(conicEquidistantRaw).scale(131.154).center([0, 13.9389]); - } - - var A1 = 1.340264, - A2 = -0.081106, - A3 = 0.000893, - A4 = 0.003796, - M = sqrt(3) / 2, - iterations = 12; - function equalEarthRaw(lambda, phi) { - var l = asin(M * sin(phi)), - l2 = l * l, - l6 = l2 * l2 * l2; - return [lambda * cos(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2))]; - } - - equalEarthRaw.invert = function (x, y) { - var l = y, - l2 = l * l, - l6 = l2 * l2 * l2; - - for (var i = 0, delta, fy, fpy; i < iterations; ++i) { - fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y; - fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); - l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; - if (abs(delta) < epsilon2) break; - } - - return [M * x * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos(l), asin(sin(l) / M)]; - }; - - function geoEqualEarth () { - return projection(equalEarthRaw).scale(177.158); - } - - function gnomonicRaw(x, y) { - var cy = cos(y), - k = cos(x) * cy; - return [cy * sin(x) / k, sin(y) / k]; - } - gnomonicRaw.invert = azimuthalInvert(atan); - function geoGnomonic () { - return projection(gnomonicRaw).scale(144.049).clipAngle(60); - } - - function naturalEarth1Raw(lambda, phi) { - var phi2 = phi * phi, - phi4 = phi2 * phi2; - return [lambda * (0.8707 - 0.131979 * phi2 + phi4 * (-0.013791 + phi4 * (0.003971 * phi2 - 0.001529 * phi4))), phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4)))]; - } - - naturalEarth1Raw.invert = function (x, y) { - var phi = y, - i = 25, - delta; - - do { - var phi2 = phi * phi, - phi4 = phi2 * phi2; - phi -= delta = (phi * (1.007226 + phi2 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi2 - 0.005916 * phi4))) - y) / (1.007226 + phi2 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi2 - 0.005916 * 11 * phi4))); - } while (abs(delta) > epsilon && --i > 0); - - return [x / (0.8707 + (phi2 = phi * phi) * (-0.131979 + phi2 * (-0.013791 + phi2 * phi2 * phi2 * (0.003971 - 0.001529 * phi2)))), phi]; - }; - - function geoNaturalEarth1 () { - return projection(naturalEarth1Raw).scale(175.295); - } - - function orthographicRaw(x, y) { - return [cos(y) * sin(x), sin(y)]; - } - orthographicRaw.invert = azimuthalInvert(asin); - function geoOrthographic () { - return projection(orthographicRaw).scale(249.5).clipAngle(90 + epsilon); - } - - function stereographicRaw(x, y) { - var cy = cos(y), - k = 1 + cos(x) * cy; - return [cy * sin(x) / k, sin(y) / k]; - } - stereographicRaw.invert = azimuthalInvert(function (z) { - return 2 * atan(z); - }); - function geoStereographic () { - return projection(stereographicRaw).scale(250).clipAngle(142); - } - - function transverseMercatorRaw(lambda, phi) { - return [log(tan((halfPi + phi) / 2)), -lambda]; - } - - transverseMercatorRaw.invert = function (x, y) { - return [-y, 2 * atan(exp(x)) - halfPi]; - }; - - function geoTransverseMercator () { - var m = mercatorProjection(transverseMercatorRaw), - center = m.center, - rotate = m.rotate; - - m.center = function (_) { - return arguments.length ? center([-_[1], _[0]]) : (_ = center(), [_[1], -_[0]]); - }; - - m.rotate = function (_) { - return arguments.length ? rotate([_[0], _[1], _.length > 2 ? _[2] + 90 : 90]) : (_ = rotate(), [_[0], _[1], _[2] - 90]); - }; - - return rotate([0, 0, 90]).scale(159.155); - } - - function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; } - - function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - var GeoFeature = /*#__PURE__*/function (_Element) { - inherits(GeoFeature, _Element); - - var _super = _createSuper(GeoFeature); - - function GeoFeature() { - classCallCheck(this, GeoFeature); - - return _super.apply(this, arguments); - } - - createClass(GeoFeature, [{ - key: "inRange", - value: function inRange(mouseX, mouseY) { - var bb = this.getBounds(); - var r = (Number.isNaN(mouseX) || mouseX >= bb.x && mouseX <= bb.x2) && (Number.isNaN(mouseY) || mouseY >= bb.y && mouseY <= bb.y2); - var projection = this.projectionScale.geoPath.projection(); - - if (r && !Number.isNaN(mouseX) && !Number.isNaN(mouseY) && typeof projection.invert === 'function') { - // test for real if within the bounds - var longlat = projection.invert([mouseX, mouseY]); - return longlat && geoContains(this.feature, longlat); - } - - return r; - } - }, { - key: "inXRange", - value: function inXRange(mouseX) { - return this.inRange(mouseX, Number.NaN); - } - }, { - key: "inYRange", - value: function inYRange(mouseY) { - return this.inRange(Number.NaN, mouseY); - } - }, { - key: "getCenterPoint", - value: function getCenterPoint() { - if (this.cache && this.cache.center) { - return this.cache.center; - } - - var centroid = this.projectionScale.geoPath.centroid(this.feature); - var center = { - x: centroid[0], - y: centroid[1] - }; - this.cache = Object.assign({}, this.cache || {}, { - center: center - }); - return center; - } - }, { - key: "getBounds", - value: function getBounds() { - if (this.cache && this.cache.bounds) { - return this.cache.bounds; - } - - var bb = this.projectionScale.geoPath.bounds(this.feature); - var bounds = { - x: bb[0][0], - x2: bb[1][0], - y: bb[0][1], - y2: bb[1][1], - width: bb[1][0] - bb[0][0], - height: bb[1][1] - bb[0][1] - }; - this.cache = Object.assign({}, this.cache || {}, { - bounds: bounds - }); - return bounds; - } - }, { - key: "tooltipPosition", - value: function tooltipPosition() { - return this.getCenterPoint(); - } - }, { - key: "_drawInCache", - value: function _drawInCache(doc) { - var bounds = this.getBounds(); - - if (!Number.isFinite(bounds.x)) { - return; - } - - var canvas = this.cache && this.cache.canvas ? this.cache.canvas : doc.createElement('canvas'); - canvas.width = Math.max(Math.ceil(bounds.width), 1); - canvas.height = Math.max(Math.ceil(bounds.height), 1); - var ctx = canvas.getContext('2d'); - ctx.clearRect(0, 0, canvas.width, canvas.height); - ctx.save(); - ctx.translate(-bounds.x, -bounds.y); - - this._drawImpl(ctx); - - ctx.restore(); - this.cache = Object.assign({}, this.cache || {}, { - canvas: canvas, - canvasKey: this._optionsToKey() - }); - } - }, { - key: "_optionsToKey", - value: function _optionsToKey() { - var options = this.options; - return "".concat(options.backgroundColor, ";").concat(options.borderColor, ";").concat(options.borderWidth); - } - }, { - key: "_drawImpl", - value: function _drawImpl(ctx) { - var options = this.options; - ctx.beginPath(); - this.projectionScale.geoPath.context(ctx)(this.feature); - - if (options.backgroundColor) { - ctx.fillStyle = options.backgroundColor; - ctx.fill(); - } - - if (options.borderColor) { - ctx.strokeStyle = options.borderColor; - ctx.lineWidth = options.borderWidth; - ctx.stroke(); - } - } - }, { - key: "draw", - value: function draw(ctx) { - if (!this.feature) { - return; - } - - if (!this.cache || this.cache.canvasKey !== this._optionsToKey()) { - this._drawInCache(ctx.canvas.ownerDocument); - } - - var bounds = this.getBounds(); - - if (this.cache && this.cache.canvas) { - ctx.drawImage(this.cache.canvas, bounds.x, bounds.y, bounds.width, bounds.height); - } else if (Number.isFinite(bounds.x)) { - ctx.save(); - - this._drawImpl(ctx); - - ctx.restore(); - } - } - }]); - - return GeoFeature; - }(chartjsEsmFacade.Element); - GeoFeature.id = 'geoFeature'; - GeoFeature.defaults = /*#__PURE__*/Object.assign({}, chartjsEsmFacade.Rectangle.defaults, { - outlineBackgroundColor: null, - outlineBorderWidth: 0, - graticuleBorderColor: '#CCCCCC', - graticuleBorderWidth: 0 - }); - GeoFeature.defaultRoutes = Object.assign({ - outlineBorderColor: 'color' - }, chartjsEsmFacade.Rectangle.defaultRoutes || {}); - - function _superPropBase(object, property) { - while (!Object.prototype.hasOwnProperty.call(object, property)) { - object = getPrototypeOf(object); - if (object === null) break; - } - - return object; - } - - var superPropBase = _superPropBase; - - var get = createCommonjsModule(function (module) { - function _get(target, property, receiver) { - if (typeof Reflect !== "undefined" && Reflect.get) { - module.exports = _get = Reflect.get; - } else { - module.exports = _get = function _get(target, property, receiver) { - var base = superPropBase(target, property); - if (!base) return; - var desc = Object.getOwnPropertyDescriptor(base, property); - - if (desc.get) { - return desc.get.call(receiver); - } - - return desc.value; - }; - } - - return _get(target, property, receiver || target); - } - - module.exports = _get; - }); - - function _createSuper$1(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$1(); return function _createSuperInternal() { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; } - - function _isNativeReflectConstruct$1() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - var lookup = { - geoAzimuthalEqualArea: geoAzimuthalEqualArea, - geoAzimuthalEquidistant: geoAzimuthalEquidistant, - geoGnomonic: geoGnomonic, - geoOrthographic: geoOrthographic, - geoStereographic: geoStereographic, - geoEqualEarth: geoEqualEarth, - geoAlbers: geoAlbers, - geoAlbersUsa: geoAlbersUsa, - geoConicConformal: geoConicConformal, - geoConicEqualArea: geoConicEqualArea, - geoConicEquidistant: geoConicEquidistant, - geoEquirectangular: geoEquirectangular, - geoMercator: geoMercator, - geoTransverseMercator: geoTransverseMercator, - geoNaturalEarth1: geoNaturalEarth1 - }; - Object.keys(lookup).forEach(function (key) { - lookup["".concat(key.charAt(3).toLowerCase()).concat(key.slice(4))] = lookup[key]; - }); - var ProjectionScale = /*#__PURE__*/function (_Scale) { - inherits(ProjectionScale, _Scale); - - var _super = _createSuper$1(ProjectionScale); - - function ProjectionScale(cfg) { - var _this; - - classCallCheck(this, ProjectionScale); - - _this = _super.call(this, cfg); - _this.geoPath = geoPath(); - return _this; - } - - createClass(ProjectionScale, [{ - key: "init", - value: function init(options) { - options.position = 'chartArea'; - - get(getPrototypeOf(ProjectionScale.prototype), "init", this).call(this, options); - - if (typeof this.options.projection === 'string' && typeof lookup[this.options.projection] === 'function') { - this.projection = lookup[this.options.projection](); - } else { - this.projection = this.options.projection; - } - - this.geoPath.projection(this.projection); - } - }, { - key: "computeBounds", - value: function computeBounds(outline) { - var bb = geoPath(this.projection.fitWidth(1000, outline)).bounds(outline); - var bHeight = Math.ceil(bb[1][1] - bb[0][1]); - var bWidth = Math.ceil(bb[1][0] - bb[0][0]); - var t = this.projection.translate(); - this.outlineBounds = { - width: bWidth, - height: bHeight, - aspectRatio: bWidth / bHeight, - refScale: this.projection.scale(), - refX: t[0], - refY: t[1] - }; - } - }, { - key: "updateBounds", - value: function updateBounds() { - var area = this.chart.chartArea; - var bb = this.outlineBounds; - var chartWidth = area.right - area.left; - var chartHeight = area.bottom - area.top; - var bak = this.oldChartBounds; - this.oldChartBounds = { - chartWidth: chartWidth, - chartHeight: chartHeight - }; - var scale = Math.min(chartWidth / bb.width, chartHeight / bb.height); - var viewWidth = bb.width * scale; - var viewHeight = bb.height * scale; - var x = (chartWidth - viewWidth) * 0.5; - var y = (chartHeight - viewHeight) * 0.5; // this.mapScale = scale; - // this.mapTranslate = {x, y}; - - this.projection.scale(bb.refScale * scale).translate([scale * bb.refX + x, scale * bb.refY + y]); - return !bak || bak.chartWidth !== this.oldChartBounds.chartWidth || bak.chartHeight !== this.oldChartBounds.chartHeight; - } - }]); - - return ProjectionScale; - }(chartjsEsmFacade.Scale); - ProjectionScale.id = 'projection'; - ProjectionScale.defaults = { - projection: 'albersUsa' - }; - - function colors (specifier) { - var n = specifier.length / 6 | 0, - colors = new Array(n), - i = 0; - - while (i < n) { - colors[i] = "#" + specifier.slice(i * 6, ++i * 6); - } - - return colors; - } - - function define (constructor, factory, prototype) { - constructor.prototype = factory.prototype = prototype; - prototype.constructor = constructor; - } - function extend(parent, definition) { - var prototype = Object.create(parent.prototype); - - for (var key in definition) { - prototype[key] = definition[key]; - } - - return prototype; - } - - function Color() {} - var _darker = 0.7; - - var _brighter = 1 / _darker; - var reI = "\\s*([+-]?\\d+)\\s*", - reN = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)\\s*", - reP = "\\s*([+-]?\\d*\\.?\\d+(?:[eE][+-]?\\d+)?)%\\s*", - reHex = /^#([0-9a-f]{3,8})$/, - reRgbInteger = new RegExp("^rgb\\(" + [reI, reI, reI] + "\\)$"), - reRgbPercent = new RegExp("^rgb\\(" + [reP, reP, reP] + "\\)$"), - reRgbaInteger = new RegExp("^rgba\\(" + [reI, reI, reI, reN] + "\\)$"), - reRgbaPercent = new RegExp("^rgba\\(" + [reP, reP, reP, reN] + "\\)$"), - reHslPercent = new RegExp("^hsl\\(" + [reN, reP, reP] + "\\)$"), - reHslaPercent = new RegExp("^hsla\\(" + [reN, reP, reP, reN] + "\\)$"); - var named = { - aliceblue: 0xf0f8ff, - antiquewhite: 0xfaebd7, - aqua: 0x00ffff, - aquamarine: 0x7fffd4, - azure: 0xf0ffff, - beige: 0xf5f5dc, - bisque: 0xffe4c4, - black: 0x000000, - blanchedalmond: 0xffebcd, - blue: 0x0000ff, - blueviolet: 0x8a2be2, - brown: 0xa52a2a, - burlywood: 0xdeb887, - cadetblue: 0x5f9ea0, - chartreuse: 0x7fff00, - chocolate: 0xd2691e, - coral: 0xff7f50, - cornflowerblue: 0x6495ed, - cornsilk: 0xfff8dc, - crimson: 0xdc143c, - cyan: 0x00ffff, - darkblue: 0x00008b, - darkcyan: 0x008b8b, - darkgoldenrod: 0xb8860b, - darkgray: 0xa9a9a9, - darkgreen: 0x006400, - darkgrey: 0xa9a9a9, - darkkhaki: 0xbdb76b, - darkmagenta: 0x8b008b, - darkolivegreen: 0x556b2f, - darkorange: 0xff8c00, - darkorchid: 0x9932cc, - darkred: 0x8b0000, - darksalmon: 0xe9967a, - darkseagreen: 0x8fbc8f, - darkslateblue: 0x483d8b, - darkslategray: 0x2f4f4f, - darkslategrey: 0x2f4f4f, - darkturquoise: 0x00ced1, - darkviolet: 0x9400d3, - deeppink: 0xff1493, - deepskyblue: 0x00bfff, - dimgray: 0x696969, - dimgrey: 0x696969, - dodgerblue: 0x1e90ff, - firebrick: 0xb22222, - floralwhite: 0xfffaf0, - forestgreen: 0x228b22, - fuchsia: 0xff00ff, - gainsboro: 0xdcdcdc, - ghostwhite: 0xf8f8ff, - gold: 0xffd700, - goldenrod: 0xdaa520, - gray: 0x808080, - green: 0x008000, - greenyellow: 0xadff2f, - grey: 0x808080, - honeydew: 0xf0fff0, - hotpink: 0xff69b4, - indianred: 0xcd5c5c, - indigo: 0x4b0082, - ivory: 0xfffff0, - khaki: 0xf0e68c, - lavender: 0xe6e6fa, - lavenderblush: 0xfff0f5, - lawngreen: 0x7cfc00, - lemonchiffon: 0xfffacd, - lightblue: 0xadd8e6, - lightcoral: 0xf08080, - lightcyan: 0xe0ffff, - lightgoldenrodyellow: 0xfafad2, - lightgray: 0xd3d3d3, - lightgreen: 0x90ee90, - lightgrey: 0xd3d3d3, - lightpink: 0xffb6c1, - lightsalmon: 0xffa07a, - lightseagreen: 0x20b2aa, - lightskyblue: 0x87cefa, - lightslategray: 0x778899, - lightslategrey: 0x778899, - lightsteelblue: 0xb0c4de, - lightyellow: 0xffffe0, - lime: 0x00ff00, - limegreen: 0x32cd32, - linen: 0xfaf0e6, - magenta: 0xff00ff, - maroon: 0x800000, - mediumaquamarine: 0x66cdaa, - mediumblue: 0x0000cd, - mediumorchid: 0xba55d3, - mediumpurple: 0x9370db, - mediumseagreen: 0x3cb371, - mediumslateblue: 0x7b68ee, - mediumspringgreen: 0x00fa9a, - mediumturquoise: 0x48d1cc, - mediumvioletred: 0xc71585, - midnightblue: 0x191970, - mintcream: 0xf5fffa, - mistyrose: 0xffe4e1, - moccasin: 0xffe4b5, - navajowhite: 0xffdead, - navy: 0x000080, - oldlace: 0xfdf5e6, - olive: 0x808000, - olivedrab: 0x6b8e23, - orange: 0xffa500, - orangered: 0xff4500, - orchid: 0xda70d6, - palegoldenrod: 0xeee8aa, - palegreen: 0x98fb98, - paleturquoise: 0xafeeee, - palevioletred: 0xdb7093, - papayawhip: 0xffefd5, - peachpuff: 0xffdab9, - peru: 0xcd853f, - pink: 0xffc0cb, - plum: 0xdda0dd, - powderblue: 0xb0e0e6, - purple: 0x800080, - rebeccapurple: 0x663399, - red: 0xff0000, - rosybrown: 0xbc8f8f, - royalblue: 0x4169e1, - saddlebrown: 0x8b4513, - salmon: 0xfa8072, - sandybrown: 0xf4a460, - seagreen: 0x2e8b57, - seashell: 0xfff5ee, - sienna: 0xa0522d, - silver: 0xc0c0c0, - skyblue: 0x87ceeb, - slateblue: 0x6a5acd, - slategray: 0x708090, - slategrey: 0x708090, - snow: 0xfffafa, - springgreen: 0x00ff7f, - steelblue: 0x4682b4, - tan: 0xd2b48c, - teal: 0x008080, - thistle: 0xd8bfd8, - tomato: 0xff6347, - turquoise: 0x40e0d0, - violet: 0xee82ee, - wheat: 0xf5deb3, - white: 0xffffff, - whitesmoke: 0xf5f5f5, - yellow: 0xffff00, - yellowgreen: 0x9acd32 - }; - define(Color, color, { - copy: function copy(channels) { - return Object.assign(new this.constructor(), this, channels); - }, - displayable: function displayable() { - return this.rgb().displayable(); - }, - hex: color_formatHex, - // Deprecated! Use color.formatHex. - formatHex: color_formatHex, - formatHsl: color_formatHsl, - formatRgb: color_formatRgb, - toString: color_formatRgb - }); - - function color_formatHex() { - return this.rgb().formatHex(); - } - - function color_formatHsl() { - return hslConvert(this).formatHsl(); - } - - function color_formatRgb() { - return this.rgb().formatRgb(); - } - - function color(format) { - var m, l; - format = (format + "").trim().toLowerCase(); - return (m = reHex.exec(format)) ? (l = m[1].length, m = parseInt(m[1], 16), l === 6 ? rgbn(m) // #ff0000 - : l === 3 ? new Rgb(m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, (m & 0xf) << 4 | m & 0xf, 1) // #f00 - : l === 8 ? rgba(m >> 24 & 0xff, m >> 16 & 0xff, m >> 8 & 0xff, (m & 0xff) / 0xff) // #ff000000 - : l === 4 ? rgba(m >> 12 & 0xf | m >> 8 & 0xf0, m >> 8 & 0xf | m >> 4 & 0xf0, m >> 4 & 0xf | m & 0xf0, ((m & 0xf) << 4 | m & 0xf) / 0xff) // #f000 - : null // invalid hex - ) : (m = reRgbInteger.exec(format)) ? new Rgb(m[1], m[2], m[3], 1) // rgb(255, 0, 0) - : (m = reRgbPercent.exec(format)) ? new Rgb(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, 1) // rgb(100%, 0%, 0%) - : (m = reRgbaInteger.exec(format)) ? rgba(m[1], m[2], m[3], m[4]) // rgba(255, 0, 0, 1) - : (m = reRgbaPercent.exec(format)) ? rgba(m[1] * 255 / 100, m[2] * 255 / 100, m[3] * 255 / 100, m[4]) // rgb(100%, 0%, 0%, 1) - : (m = reHslPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, 1) // hsl(120, 50%, 50%) - : (m = reHslaPercent.exec(format)) ? hsla(m[1], m[2] / 100, m[3] / 100, m[4]) // hsla(120, 50%, 50%, 1) - : named.hasOwnProperty(format) ? rgbn(named[format]) // eslint-disable-line no-prototype-builtins - : format === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; - } - - function rgbn(n) { - return new Rgb(n >> 16 & 0xff, n >> 8 & 0xff, n & 0xff, 1); - } - - function rgba(r, g, b, a) { - if (a <= 0) r = g = b = NaN; - return new Rgb(r, g, b, a); - } - - function rgbConvert(o) { - if (!(o instanceof Color)) o = color(o); - if (!o) return new Rgb(); - o = o.rgb(); - return new Rgb(o.r, o.g, o.b, o.opacity); - } - function rgb(r, g, b, opacity) { - return arguments.length === 1 ? rgbConvert(r) : new Rgb(r, g, b, opacity == null ? 1 : opacity); - } - function Rgb(r, g, b, opacity) { - this.r = +r; - this.g = +g; - this.b = +b; - this.opacity = +opacity; - } - define(Rgb, rgb, extend(Color, { - brighter: function brighter(k) { - k = k == null ? _brighter : Math.pow(_brighter, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - darker: function darker(k) { - k = k == null ? _darker : Math.pow(_darker, k); - return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity); - }, - rgb: function rgb() { - return this; - }, - displayable: function displayable() { - return -0.5 <= this.r && this.r < 255.5 && -0.5 <= this.g && this.g < 255.5 && -0.5 <= this.b && this.b < 255.5 && 0 <= this.opacity && this.opacity <= 1; - }, - hex: rgb_formatHex, - // Deprecated! Use color.formatHex. - formatHex: rgb_formatHex, - formatRgb: rgb_formatRgb, - toString: rgb_formatRgb - })); - - function rgb_formatHex() { - return "#" + hex(this.r) + hex(this.g) + hex(this.b); - } - - function rgb_formatRgb() { - var a = this.opacity; - a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 1 ? "rgb(" : "rgba(") + Math.max(0, Math.min(255, Math.round(this.r) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.g) || 0)) + ", " + Math.max(0, Math.min(255, Math.round(this.b) || 0)) + (a === 1 ? ")" : ", " + a + ")"); - } - - function hex(value) { - value = Math.max(0, Math.min(255, Math.round(value) || 0)); - return (value < 16 ? "0" : "") + value.toString(16); - } - - function hsla(h, s, l, a) { - if (a <= 0) h = s = l = NaN;else if (l <= 0 || l >= 1) h = s = NaN;else if (s <= 0) h = NaN; - return new Hsl(h, s, l, a); - } - - function hslConvert(o) { - if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Color)) o = color(o); - if (!o) return new Hsl(); - if (o instanceof Hsl) return o; - o = o.rgb(); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - min = Math.min(r, g, b), - max = Math.max(r, g, b), - h = NaN, - s = max - min, - l = (max + min) / 2; - - if (s) { - if (r === max) h = (g - b) / s + (g < b) * 6;else if (g === max) h = (b - r) / s + 2;else h = (r - g) / s + 4; - s /= l < 0.5 ? max + min : 2 - max - min; - h *= 60; - } else { - s = l > 0 && l < 1 ? 0 : h; - } - - return new Hsl(h, s, l, o.opacity); - } - function hsl(h, s, l, opacity) { - return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s, l, opacity == null ? 1 : opacity); - } - - function Hsl(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; - } - - define(Hsl, hsl, extend(Color, { - brighter: function brighter(k) { - k = k == null ? _brighter : Math.pow(_brighter, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - darker: function darker(k) { - k = k == null ? _darker : Math.pow(_darker, k); - return new Hsl(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function rgb() { - var h = this.h % 360 + (this.h < 0) * 360, - s = isNaN(h) || isNaN(this.s) ? 0 : this.s, - l = this.l, - m2 = l + (l < 0.5 ? l : 1 - l) * s, - m1 = 2 * l - m2; - return new Rgb(hsl2rgb(h >= 240 ? h - 240 : h + 120, m1, m2), hsl2rgb(h, m1, m2), hsl2rgb(h < 120 ? h + 240 : h - 120, m1, m2), this.opacity); - }, - displayable: function displayable() { - return (0 <= this.s && this.s <= 1 || isNaN(this.s)) && 0 <= this.l && this.l <= 1 && 0 <= this.opacity && this.opacity <= 1; - }, - formatHsl: function formatHsl() { - var a = this.opacity; - a = isNaN(a) ? 1 : Math.max(0, Math.min(1, a)); - return (a === 1 ? "hsl(" : "hsla(") + (this.h || 0) + ", " + (this.s || 0) * 100 + "%, " + (this.l || 0) * 100 + "%" + (a === 1 ? ")" : ", " + a + ")"); - } - })); - /* From FvD 13.37, CSS Color Module Level 3 */ - - function hsl2rgb(h, m1, m2) { - return (h < 60 ? m1 + (m2 - m1) * h / 60 : h < 180 ? m2 : h < 240 ? m1 + (m2 - m1) * (240 - h) / 60 : m1) * 255; - } - - var deg2rad = Math.PI / 180; - var rad2deg = 180 / Math.PI; - - var A = -0.14861, - B = +1.78277, - C = -0.29227, - D = -0.90649, - E = +1.97294, - ED = E * D, - EB = E * B, - BC_DA = B * C - D * A; - - function cubehelixConvert(o) { - if (o instanceof Cubehelix) return new Cubehelix(o.h, o.s, o.l, o.opacity); - if (!(o instanceof Rgb)) o = rgbConvert(o); - var r = o.r / 255, - g = o.g / 255, - b = o.b / 255, - l = (BC_DA * b + ED * r - EB * g) / (BC_DA + ED - EB), - bl = b - l, - k = (E * (g - l) - C * bl) / D, - s = Math.sqrt(k * k + bl * bl) / (E * l * (1 - l)), - // NaN if l=0 or l=1 - h = s ? Math.atan2(k, bl) * rad2deg - 120 : NaN; - return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity); - } - - function cubehelix(h, s, l, opacity) { - return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s, l, opacity == null ? 1 : opacity); - } - function Cubehelix(h, s, l, opacity) { - this.h = +h; - this.s = +s; - this.l = +l; - this.opacity = +opacity; - } - define(Cubehelix, cubehelix, extend(Color, { - brighter: function brighter(k) { - k = k == null ? _brighter : Math.pow(_brighter, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - darker: function darker(k) { - k = k == null ? _darker : Math.pow(_darker, k); - return new Cubehelix(this.h, this.s, this.l * k, this.opacity); - }, - rgb: function rgb() { - var h = isNaN(this.h) ? 0 : (this.h + 120) * deg2rad, - l = +this.l, - a = isNaN(this.s) ? 0 : this.s * l * (1 - l), - cosh = Math.cos(h), - sinh = Math.sin(h); - return new Rgb(255 * (l + a * (A * cosh + B * sinh)), 255 * (l + a * (C * cosh + D * sinh)), 255 * (l + a * (E * cosh)), this.opacity); - } - })); - - function basis(t1, v0, v1, v2, v3) { - var t2 = t1 * t1, - t3 = t2 * t1; - return ((1 - 3 * t1 + 3 * t2 - t3) * v0 + (4 - 6 * t2 + 3 * t3) * v1 + (1 + 3 * t1 + 3 * t2 - 3 * t3) * v2 + t3 * v3) / 6; - } - function basis$1 (values) { - var n = values.length - 1; - return function (t) { - var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), - v1 = values[i], - v2 = values[i + 1], - v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, - v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; - return basis((t - i / n) * n, v0, v1, v2, v3); - }; - } - - function constant (x) { - return function () { - return x; - }; - } - - function linear(a, d) { - return function (t) { - return a + t * d; - }; - } - - function hue(a, b) { - var d = b - a; - return d ? linear(a, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant(isNaN(a) ? b : a); - } - function nogamma(a, b) { - var d = b - a; - return d ? linear(a, d) : constant(isNaN(a) ? b : a); - } - - function rgbSpline(spline) { - return function (colors) { - var n = colors.length, - r = new Array(n), - g = new Array(n), - b = new Array(n), - i, - color; - - for (i = 0; i < n; ++i) { - color = rgb(colors[i]); - r[i] = color.r || 0; - g[i] = color.g || 0; - b[i] = color.b || 0; - } - - r = spline(r); - g = spline(g); - b = spline(b); - color.opacity = 1; - return function (t) { - color.r = r(t); - color.g = g(t); - color.b = b(t); - return color + ""; - }; - }; - } - - var rgbBasis = rgbSpline(basis$1); - - function cubehelix$1(hue) { - return function cubehelixGamma(y) { - y = +y; - - function cubehelix$1(start, end) { - var h = hue((start = cubehelix(start)).h, (end = cubehelix(end)).h), - s = nogamma(start.s, end.s), - l = nogamma(start.l, end.l), - opacity = nogamma(start.opacity, end.opacity); - return function (t) { - start.h = h(t); - start.s = s(t); - start.l = l(Math.pow(t, y)); - start.opacity = opacity(t); - return start + ""; - }; - } - - cubehelix$1.gamma = cubehelixGamma; - return cubehelix$1; - }(1); - } - - cubehelix$1(hue); - var cubehelixLong = cubehelix$1(nogamma); - - function ramp (scheme) { - return rgbBasis(scheme[scheme.length - 1]); - } - - var scheme = new Array(3).concat("d8b365f5f5f55ab4ac", "a6611adfc27d80cdc1018571", "a6611adfc27df5f5f580cdc1018571", "8c510ad8b365f6e8c3c7eae55ab4ac01665e", "8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e", "8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e", "8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e", "5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30", "5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(colors); - var interpolateBrBG = ramp(scheme); - - var scheme$1 = new Array(3).concat("af8dc3f7f7f77fbf7b", "7b3294c2a5cfa6dba0008837", "7b3294c2a5cff7f7f7a6dba0008837", "762a83af8dc3e7d4e8d9f0d37fbf7b1b7837", "762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837", "762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837", "762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837", "40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b", "40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(colors); - var interpolatePRGn = ramp(scheme$1); - - var scheme$2 = new Array(3).concat("e9a3c9f7f7f7a1d76a", "d01c8bf1b6dab8e1864dac26", "d01c8bf1b6daf7f7f7b8e1864dac26", "c51b7de9a3c9fde0efe6f5d0a1d76a4d9221", "c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221", "c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221", "c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221", "8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419", "8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(colors); - var interpolatePiYG = ramp(scheme$2); - - var scheme$3 = new Array(3).concat("998ec3f7f7f7f1a340", "5e3c99b2abd2fdb863e66101", "5e3c99b2abd2f7f7f7fdb863e66101", "542788998ec3d8daebfee0b6f1a340b35806", "542788998ec3d8daebf7f7f7fee0b6f1a340b35806", "5427888073acb2abd2d8daebfee0b6fdb863e08214b35806", "5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806", "2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08", "2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(colors); - var interpolatePuOr = ramp(scheme$3); - - var scheme$4 = new Array(3).concat("ef8a62f7f7f767a9cf", "ca0020f4a58292c5de0571b0", "ca0020f4a582f7f7f792c5de0571b0", "b2182bef8a62fddbc7d1e5f067a9cf2166ac", "b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac", "b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac", "b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac", "67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061", "67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(colors); - var interpolateRdBu = ramp(scheme$4); - - var scheme$5 = new Array(3).concat("ef8a62ffffff999999", "ca0020f4a582bababa404040", "ca0020f4a582ffffffbababa404040", "b2182bef8a62fddbc7e0e0e09999994d4d4d", "b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d", "b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d", "b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d", "67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a", "67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(colors); - var interpolateRdGy = ramp(scheme$5); - - var scheme$6 = new Array(3).concat("fc8d59ffffbf91bfdb", "d7191cfdae61abd9e92c7bb6", "d7191cfdae61ffffbfabd9e92c7bb6", "d73027fc8d59fee090e0f3f891bfdb4575b4", "d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4", "d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4", "d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4", "a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695", "a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(colors); - var interpolateRdYlBu = ramp(scheme$6); - - var scheme$7 = new Array(3).concat("fc8d59ffffbf91cf60", "d7191cfdae61a6d96a1a9641", "d7191cfdae61ffffbfa6d96a1a9641", "d73027fc8d59fee08bd9ef8b91cf601a9850", "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850", "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850", "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850", "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837", "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(colors); - var interpolateRdYlGn = ramp(scheme$7); - - var scheme$8 = new Array(3).concat("fc8d59ffffbf99d594", "d7191cfdae61abdda42b83ba", "d7191cfdae61ffffbfabdda42b83ba", "d53e4ffc8d59fee08be6f59899d5943288bd", "d53e4ffc8d59fee08bffffbfe6f59899d5943288bd", "d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd", "d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd", "9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2", "9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(colors); - var interpolateSpectral = ramp(scheme$8); - - var scheme$9 = new Array(3).concat("e5f5f999d8c92ca25f", "edf8fbb2e2e266c2a4238b45", "edf8fbb2e2e266c2a42ca25f006d2c", "edf8fbccece699d8c966c2a42ca25f006d2c", "edf8fbccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(colors); - var interpolateBuGn = ramp(scheme$9); - - var scheme$a = new Array(3).concat("e0ecf49ebcda8856a7", "edf8fbb3cde38c96c688419d", "edf8fbb3cde38c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(colors); - var interpolateBuPu = ramp(scheme$a); - - var scheme$b = new Array(3).concat("e0f3dba8ddb543a2ca", "f0f9e8bae4bc7bccc42b8cbe", "f0f9e8bae4bc7bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(colors); - var interpolateGnBu = ramp(scheme$b); - - var scheme$c = new Array(3).concat("fee8c8fdbb84e34a33", "fef0d9fdcc8afc8d59d7301f", "fef0d9fdcc8afc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(colors); - var interpolateOrRd = ramp(scheme$c); - - var scheme$d = new Array(3).concat("ece2f0a6bddb1c9099", "f6eff7bdc9e167a9cf02818a", "f6eff7bdc9e167a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(colors); - var interpolatePuBuGn = ramp(scheme$d); - - var scheme$e = new Array(3).concat("ece7f2a6bddb2b8cbe", "f1eef6bdc9e174a9cf0570b0", "f1eef6bdc9e174a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(colors); - var interpolatePuBu = ramp(scheme$e); - - var scheme$f = new Array(3).concat("e7e1efc994c7dd1c77", "f1eef6d7b5d8df65b0ce1256", "f1eef6d7b5d8df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(colors); - var interpolatePuRd = ramp(scheme$f); - - var scheme$g = new Array(3).concat("fde0ddfa9fb5c51b8a", "feebe2fbb4b9f768a1ae017e", "feebe2fbb4b9f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(colors); - var interpolateRdPu = ramp(scheme$g); - - var scheme$h = new Array(3).concat("edf8b17fcdbb2c7fb8", "ffffcca1dab441b6c4225ea8", "ffffcca1dab441b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(colors); - var interpolateYlGnBu = ramp(scheme$h); - - var scheme$i = new Array(3).concat("f7fcb9addd8e31a354", "ffffccc2e69978c679238443", "ffffccc2e69978c67931a354006837", "ffffccd9f0a3addd8e78c67931a354006837", "ffffccd9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(colors); - var interpolateYlGn = ramp(scheme$i); - - var scheme$j = new Array(3).concat("fff7bcfec44fd95f0e", "ffffd4fed98efe9929cc4c02", "ffffd4fed98efe9929d95f0e993404", "ffffd4fee391fec44ffe9929d95f0e993404", "ffffd4fee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(colors); - var interpolateYlOrBr = ramp(scheme$j); - - var scheme$k = new Array(3).concat("ffeda0feb24cf03b20", "ffffb2fecc5cfd8d3ce31a1c", "ffffb2fecc5cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(colors); - var interpolateYlOrRd = ramp(scheme$k); - - var scheme$l = new Array(3).concat("deebf79ecae13182bd", "eff3ffbdd7e76baed62171b5", "eff3ffbdd7e76baed63182bd08519c", "eff3ffc6dbef9ecae16baed63182bd08519c", "eff3ffc6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(colors); - var interpolateBlues = ramp(scheme$l); - - var scheme$m = new Array(3).concat("e5f5e0a1d99b31a354", "edf8e9bae4b374c476238b45", "edf8e9bae4b374c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(colors); - var interpolateGreens = ramp(scheme$m); - - var scheme$n = new Array(3).concat("f0f0f0bdbdbd636363", "f7f7f7cccccc969696525252", "f7f7f7cccccc969696636363252525", "f7f7f7d9d9d9bdbdbd969696636363252525", "f7f7f7d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(colors); - var interpolateGreys = ramp(scheme$n); - - var scheme$o = new Array(3).concat("efedf5bcbddc756bb1", "f2f0f7cbc9e29e9ac86a51a3", "f2f0f7cbc9e29e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(colors); - var interpolatePurples = ramp(scheme$o); - - var scheme$p = new Array(3).concat("fee0d2fc9272de2d26", "fee5d9fcae91fb6a4acb181d", "fee5d9fcae91fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(colors); - var interpolateReds = ramp(scheme$p); - - var scheme$q = new Array(3).concat("fee6cefdae6be6550d", "feeddefdbe85fd8d3cd94701", "feeddefdbe85fd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(colors); - var interpolateOranges = ramp(scheme$q); - - function interpolateCividis (t) { - t = Math.max(0, Math.min(1, t)); - return "rgb(" + Math.max(0, Math.min(255, Math.round(-4.54 - t * (35.34 - t * (2381.73 - t * (6402.7 - t * (7024.72 - t * 2710.57))))))) + ", " + Math.max(0, Math.min(255, Math.round(32.49 + t * (170.73 + t * (52.82 - t * (131.46 - t * (176.58 - t * 67.37))))))) + ", " + Math.max(0, Math.min(255, Math.round(81.24 + t * (442.36 - t * (2482.43 - t * (6167.24 - t * (6614.94 - t * 2475.67))))))) + ")"; - } - - var interpolateCubehelixDefault = cubehelixLong(cubehelix(300, 0.5, 0.0), cubehelix(-240, 0.5, 1.0)); - - var warm = cubehelixLong(cubehelix(-100, 0.75, 0.35), cubehelix(80, 1.50, 0.8)); - var cool = cubehelixLong(cubehelix(260, 0.75, 0.35), cubehelix(80, 1.50, 0.8)); - var c = cubehelix(); - function interpolateRainbow (t) { - if (t < 0 || t > 1) t -= Math.floor(t); - var ts = Math.abs(t - 0.5); - c.h = 360 * t - 100; - c.s = 1.5 - 1.5 * ts; - c.l = 0.8 - 0.9 * ts; - return c + ""; - } - - var c$1 = rgb(), - pi_1_3 = Math.PI / 3, - pi_2_3 = Math.PI * 2 / 3; - function interpolateSinebow (t) { - var x; - t = (0.5 - t) * Math.PI; - c$1.r = 255 * (x = Math.sin(t)) * x; - c$1.g = 255 * (x = Math.sin(t + pi_1_3)) * x; - c$1.b = 255 * (x = Math.sin(t + pi_2_3)) * x; - return c$1 + ""; - } - - function interpolateTurbo (t) { - t = Math.max(0, Math.min(1, t)); - return "rgb(" + Math.max(0, Math.min(255, Math.round(34.61 + t * (1172.33 - t * (10793.56 - t * (33300.12 - t * (38394.49 - t * 14825.05))))))) + ", " + Math.max(0, Math.min(255, Math.round(23.31 + t * (557.33 + t * (1225.33 - t * (3574.96 - t * (1073.77 + t * 707.56))))))) + ", " + Math.max(0, Math.min(255, Math.round(27.2 + t * (3211.1 - t * (15327.97 - t * (27814 - t * (22569.18 - t * 6838.66))))))) + ")"; - } - - function ramp$1(range) { - var n = range.length; - return function (t) { - return range[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; - }; - } - - var interpolateViridis = ramp$1(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")); - var magma = ramp$1(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")); - var inferno = ramp$1(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")); - var plasma = ramp$1(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")); - - function _createSuper$2(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$2(); return function _createSuperInternal() { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; } - - function _isNativeReflectConstruct$2() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - - var baseDefaults = { - position: 'chartArea', - property: 'value', - gridLines: { - drawOnChartArea: false - }, - legend: { - align: 'right', - position: 'bottom-right', - length: 100, - width: 50, - margin: 8, - indicatorWidth: 10 - } - }; - function BaseMixin(superClass) { - return /*#__PURE__*/function (_superClass) { - inherits(_class, _superClass); - - var _super = _createSuper$2(_class); - - function _class() { - classCallCheck(this, _class); - - return _super.apply(this, arguments); - } - - createClass(_class, [{ - key: "init", - value: function init(options) { - options.position = 'chartArea'; - - get(getPrototypeOf(_class.prototype), "init", this).call(this, options); - - this.axis = 'r'; - } - }, { - key: "parse", - value: function parse(raw, index) { - if (raw && typeof raw[this.options.property] === 'number') { - return raw[this.options.property]; - } - - return get(getPrototypeOf(_class.prototype), "parse", this).call(this, raw, index); - } - }, { - key: "isHorizontal", - value: function isHorizontal() { - return this.options.legend.align === 'top' || this.options.legend.align === 'bottom'; - } - }, { - key: "_getNormalizedValue", - value: function _getNormalizedValue(v) { - if (v == null || Number.isNaN(v)) { - return null; - } - - return (v - this._startValue) / this._valueRange; - } - }, { - key: "_getLegendMargin", - value: function _getLegendMargin() { - var indicatorWidth = this.options.legend.indicatorWidth; - var pos = this.options.legend.align; - var margin = this.options.legend.margin; - var left = (typeof margin === 'number' ? margin : margin.left) + (pos === 'right' ? indicatorWidth : 0); - var top = (typeof margin === 'number' ? margin : margin.top) + (pos === 'bottom' ? indicatorWidth : 0); - var right = (typeof margin === 'number' ? margin : margin.right) + (pos === 'left' ? indicatorWidth : 0); - var bottom = (typeof margin === 'number' ? margin : margin.bottom) + (pos === 'top' ? indicatorWidth : 0); - return { - left: left, - top: top, - right: right, - bottom: bottom - }; - } - }, { - key: "_getLegendPosition", - value: function _getLegendPosition(chartArea) { - var indicatorWidth = this.options.legend.indicatorWidth; - var axisPos = this.options.legend.align; - var isHor = this.isHorizontal(); - var w = (axisPos === 'left' ? this.legendSize.w : this.width) + (isHor ? indicatorWidth : 0); - var h = (axisPos === 'top' ? this.legendSize.h : this.height) + (!isHor ? indicatorWidth : 0); - - var margin = this._getLegendMargin(); - - var pos = this.options.legend.position; - - if (typeof pos === 'string') { - switch (pos) { - case 'top-left': - return [margin.left, margin.top]; - - case 'top': - return [(chartArea.right - w) / 2, margin.top]; - - case 'left': - return [margin.left, (chartArea.bottom - h) / 2]; - - case 'top-right': - return [chartArea.right - w - margin.right, margin.top]; - - case 'bottom-right': - return [chartArea.right - w - margin.right, chartArea.bottom - h - margin.bottom]; - - case 'bottom': - return [(chartArea.right - w) / 2, chartArea.bottom - h - margin.bottom]; - - case 'bottom-left': - return [margin.left, chartArea.bottom - h - margin.bottom]; - - default: - // right - return [chartArea.right - w - margin.right, (chartArea.bottom - h) / 2]; - } - } - - return [pos.x, pos.y]; - } - }, { - key: "update", - value: function update(maxWidth, maxHeight, margins) { - var ch = Math.min(maxHeight, this.bottom == null ? Number.POSITIVE_INFINITY : this.bottom); - var cw = Math.min(maxWidth, this.right == null ? Number.POSITIVE_INFINITY : this.right); - var l = this.options.legend; - var isHor = this.isHorizontal(); - - var factor = function factor(v, full) { - return v < 1 ? full * v : v; - }; - - var w = Math.min(cw, factor(isHor ? l.length : l.width, cw)) - (!isHor ? l.indicatorWidth : 0); - var h = Math.min(ch, factor(!isHor ? l.length : l.width, ch)) - (isHor ? l.indicatorWidth : 0); - this.legendSize = { - w: w, - h: h - }; - this.bottom = this.height = h; - this.right = this.width = w; - var bak = this.options.position; - this.options.position = this.options.legend.align; - - get(getPrototypeOf(_class.prototype), "update", this).call(this, w, h, margins); - - this.options.position = bak; - this.height = Math.min(h, this.height); - this.width = Math.min(w, this.width); - } - }, { - key: "draw", - value: function draw(chartArea) { - if (!this._isVisible()) { - return; - } - - var pos = this._getLegendPosition(chartArea); - /** @type {CanvasRenderingContext2D} */ - - - var ctx = this.ctx; - ctx.save(); - ctx.translate(pos[0], pos[1]); - var bak = this.options.position; - this.options.position = this.options.legend.align; - - get(getPrototypeOf(_class.prototype), "draw", this).call(this, Object.assign({}, chartArea, { - bottom: this.height, - right: this.width - })); - - this.options.position = bak; - var indicatorWidth = this.options.legend.indicatorWidth; - - switch (this.options.legend.align) { - case 'left': - ctx.translate(this.legendSize.w, 0); - break; - - case 'top': - ctx.translate(0, this.legendSize.h); - break; - - case 'bottom': - ctx.translate(0, -indicatorWidth); - break; - - default: - ctx.translate(-indicatorWidth, 0); - break; - } - - this._drawIndicator(); - - ctx.restore(); - } - }]); - - return _class; - }(superClass); - } - - function _createSuper$3(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$3(); return function _createSuperInternal() { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; } - - function _isNativeReflectConstruct$3() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - var lookup$1 = { - interpolateBlues: interpolateBlues, - interpolateBrBG: interpolateBrBG, - interpolateBuGn: interpolateBuGn, - interpolateBuPu: interpolateBuPu, - interpolateCividis: interpolateCividis, - interpolateCool: cool, - interpolateCubehelixDefault: interpolateCubehelixDefault, - interpolateGnBu: interpolateGnBu, - interpolateGreens: interpolateGreens, - interpolateGreys: interpolateGreys, - interpolateInferno: inferno, - interpolateMagma: magma, - interpolateOrRd: interpolateOrRd, - interpolateOranges: interpolateOranges, - interpolatePRGn: interpolatePRGn, - interpolatePiYG: interpolatePiYG, - interpolatePlasma: plasma, - interpolatePuBu: interpolatePuBu, - interpolatePuBuGn: interpolatePuBuGn, - interpolatePuOr: interpolatePuOr, - interpolatePuRd: interpolatePuRd, - interpolatePurples: interpolatePurples, - interpolateRainbow: interpolateRainbow, - interpolateRdBu: interpolateRdBu, - interpolateRdGy: interpolateRdGy, - interpolateRdPu: interpolateRdPu, - interpolateRdYlBu: interpolateRdYlBu, - interpolateRdYlGn: interpolateRdYlGn, - interpolateReds: interpolateReds, - interpolateSinebow: interpolateSinebow, - interpolateSpectral: interpolateSpectral, - interpolateTurbo: interpolateTurbo, - interpolateViridis: interpolateViridis, - interpolateWarm: warm, - interpolateYlGn: interpolateYlGn, - interpolateYlGnBu: interpolateYlGnBu, - interpolateYlOrBr: interpolateYlOrBr, - interpolateYlOrRd: interpolateYlOrRd - }; - Object.keys(lookup$1).forEach(function (key) { - lookup$1["".concat(key.charAt(11).toLowerCase()).concat(key.slice(12))] = lookup$1[key]; - lookup$1[key.slice(11)] = lookup$1[key]; - }); - - function quantize(v, steps) { - var perStep = 1 / steps; - - if (v <= perStep) { - return 0; - } - - if (v >= 1 - perStep) { - return 1; - } - - for (var acc = 0; acc < 1; acc += perStep) { - if (v < acc) { - return acc - perStep / 2; // center - } - } - - return v; - } - - function ColorScaleMixin(superClass) { - return /*#__PURE__*/function (_BaseMixin) { - inherits(_class, _BaseMixin); - - var _super = _createSuper$3(_class); - - function _class() { - classCallCheck(this, _class); - - return _super.apply(this, arguments); - } - - createClass(_class, [{ - key: "init", - value: function init(options) { - get(getPrototypeOf(_class.prototype), "init", this).call(this, options); - - if (typeof this.options.interpolate === 'string' && typeof lookup$1[this.options.interpolate] === 'function') { - this.interpolate = lookup$1[this.options.interpolate]; - } else { - this.interpolate = this.options.interpolate; - } - } - }, { - key: "getColorForValue", - value: function getColorForValue(value) { - var v = this._getNormalizedValue(value); - - if (v == null || Number.isNaN(v)) { - return this.options.missing; - } - - return this.getColor(v); - } - }, { - key: "getColor", - value: function getColor(normalized) { - var v = normalized; - - if (this.options.quantize > 0) { - v = quantize(v, this.options.quantize); - } - - return this.interpolate(v); - } - }, { - key: "_drawIndicator", - value: function _drawIndicator() { - /** @type {CanvasRenderingContext2D} */ - var ctx = this.ctx; - var w = this.width; - var h = this.height; - var indicatorSize = this.options.legend.indicatorWidth; - var reverse = this._reversePixels; - - if (this.isHorizontal()) { - if (this.options.quantize > 0) { - var stepWidth = w / this.options.quantize; - var offset = !reverse ? function (i) { - return i; - } : function (i) { - return w - stepWidth - i; - }; - - for (var i = 0; i < w; i += stepWidth) { - var v = (i + stepWidth / 2) / w; - ctx.fillStyle = this.getColor(v); - ctx.fillRect(offset(i), 0, stepWidth, indicatorSize); - } - } else { - var _offset = !reverse ? function (i) { - return i; - } : function (i) { - return w - 1 - i; - }; - - for (var _i = 0; _i < w; ++_i) { - ctx.fillStyle = this.getColor((_i + 0.5) / w); - ctx.fillRect(_offset(_i), 0, 1, indicatorSize); - } - } - } else if (this.options.quantize > 0) { - var _stepWidth = h / this.options.quantize; - - var _offset2 = !reverse ? function (i) { - return i; - } : function (i) { - return h - _stepWidth - i; - }; - - for (var _i2 = 0; _i2 < h; _i2 += _stepWidth) { - var _v = (_i2 + _stepWidth / 2) / h; - - ctx.fillStyle = this.getColor(_v); - ctx.fillRect(0, _offset2(_i2), indicatorSize, _stepWidth); - } - } else { - var _offset3 = !reverse ? function (i) { - return i; - } : function (i) { - return h - 1 - i; - }; - - for (var _i3 = 0; _i3 < h; ++_i3) { - ctx.fillStyle = this.getColor((_i3 + 0.5) / h); - ctx.fillRect(0, _offset3(_i3), indicatorSize, 1); - } - } - } - }]); - - return _class; - }(BaseMixin(superClass)); - } - - var ColorScale = /*#__PURE__*/function (_ColorScaleMixin) { - inherits(ColorScale, _ColorScaleMixin); - - var _super2 = _createSuper$3(ColorScale); - - function ColorScale() { - classCallCheck(this, ColorScale); - - return _super2.apply(this, arguments); - } - - return ColorScale; - }(ColorScaleMixin(chartjsEsmFacade.LinearScale)); - var colorScaleDefaults = { - interpolate: 'blues', - missing: 'transparent', - quantize: 0 - }; - ColorScale.id = 'color'; - ColorScale.defaults = /*#__PURE__*/chartjsEsmFacade.merge({}, [chartjsEsmFacade.LinearScale.defaults, baseDefaults, colorScaleDefaults]); - var ColorLogarithmicScale = /*#__PURE__*/function (_ColorScaleMixin2) { - inherits(ColorLogarithmicScale, _ColorScaleMixin2); - - var _super3 = _createSuper$3(ColorLogarithmicScale); - - function ColorLogarithmicScale() { - classCallCheck(this, ColorLogarithmicScale); - - return _super3.apply(this, arguments); - } - - createClass(ColorLogarithmicScale, [{ - key: "_getNormalizedValue", - value: function _getNormalizedValue(v) { - if (v == null || Number.isNaN(v)) { - return null; - } - - return (Math.log10(v) - this._startValue) / this._valueRange; - } - }]); - - return ColorLogarithmicScale; - }(ColorScaleMixin(chartjsEsmFacade.LogarithmicScale)); - ColorLogarithmicScale.id = 'colorLogarithmic'; - ColorLogarithmicScale.defaults = /*#__PURE__*/chartjsEsmFacade.merge({}, [chartjsEsmFacade.LogarithmicScale.defaults, baseDefaults, colorScaleDefaults]); - - function _defineProperty(obj, key, value) { - if (key in obj) { - Object.defineProperty(obj, key, { - value: value, - enumerable: true, - configurable: true, - writable: true - }); - } else { - obj[key] = value; - } - - return obj; - } - - var defineProperty = _defineProperty; - - function _arrayWithHoles(arr) { - if (Array.isArray(arr)) return arr; - } - - var arrayWithHoles = _arrayWithHoles; - - function _iterableToArrayLimit(arr, i) { - if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; - var _arr = []; - var _n = true; - var _d = false; - var _e = undefined; - - try { - for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { - _arr.push(_s.value); - - if (i && _arr.length === i) break; - } - } catch (err) { - _d = true; - _e = err; - } finally { - try { - if (!_n && _i["return"] != null) _i["return"](); - } finally { - if (_d) throw _e; - } - } - - return _arr; - } - - var iterableToArrayLimit = _iterableToArrayLimit; - - function _arrayLikeToArray(arr, len) { - if (len == null || len > arr.length) len = arr.length; - - for (var i = 0, arr2 = new Array(len); i < len; i++) { - arr2[i] = arr[i]; - } - - return arr2; - } - - var arrayLikeToArray = _arrayLikeToArray; - - function _unsupportedIterableToArray(o, minLen) { - if (!o) return; - if (typeof o === "string") return arrayLikeToArray(o, minLen); - var n = Object.prototype.toString.call(o).slice(8, -1); - if (n === "Object" && o.constructor) n = o.constructor.name; - if (n === "Map" || n === "Set") return Array.from(o); - if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return arrayLikeToArray(o, minLen); - } - - var unsupportedIterableToArray = _unsupportedIterableToArray; - - function _nonIterableRest() { - throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); - } - - var nonIterableRest = _nonIterableRest; - - function _slicedToArray(arr, i) { - return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest(); - } - - var slicedToArray = _slicedToArray; - - function _createSuper$4(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$4(); return function _createSuperInternal() { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; } - - function _isNativeReflectConstruct$4() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - - function SizeSaleMixin(superClass) { - return /*#__PURE__*/function (_BaseMixin) { - inherits(_class, _BaseMixin); - - var _super = _createSuper$4(_class); - - function _class() { - classCallCheck(this, _class); - - return _super.apply(this, arguments); - } - - createClass(_class, [{ - key: "getSizeForValue", - value: function getSizeForValue(value) { - var v = this._getNormalizedValue(value); - - if (v == null || Number.isNaN(v)) { - return this.options.missing; - } - - return this.getSizeImpl(v); - } - }, { - key: "getSizeImpl", - value: function getSizeImpl(normalized) { - var _this$options$range = slicedToArray(this.options.range, 2), - r0 = _this$options$range[0], - r1 = _this$options$range[1]; - - if (this.options.mode === 'area') { - var a1 = r1 * r1 * Math.PI; - var a0 = r0 * r0 * Math.PI; - - var _range = a1 - a0; - - var a = normalized * _range + a0; - return Math.sqrt(a / Math.PI); - } - - var range = r1 - r0; - return normalized * range + r0; - } - }, { - key: "_drawIndicator", - value: function _drawIndicator() { - var _this = this; - - /** @type {CanvasRenderingContext2D} */ - var ctx = this.ctx; - var shift = this.options.legend.indicatorWidth / 2; - var isHor = this.isHorizontal(); - var values = this.ticks; - var positions = this._labelItems || values.map(function (_, i) { - return defineProperty({}, isHor ? 'x' : 'y', _this.getPixelForTick(i)); - }); - (this._gridLineItems || []).forEach(function (item) { - ctx.save(); - ctx.strokeStyle = item.color; - ctx.lineWidth = item.width; - - if (ctx.setLineDash) { - ctx.setLineDash(item.borderDash); - ctx.lineDashOffset = item.borderDashOffset; - } - - ctx.beginPath(); - - if (_this.options.gridLines.drawTicks) { - switch (_this.options.legend.align) { - case 'left': - ctx.moveTo(0, item.ty1); - ctx.lineTo(shift, item.ty2); - break; - - case 'top': - ctx.moveTo(item.tx1, 0); - ctx.lineTo(item.tx2, shift); - break; - - case 'bottom': - ctx.moveTo(item.tx1, shift); - ctx.lineTo(item.tx2, shift * 2); - break; - - default: - // right - ctx.moveTo(shift, item.ty1); - ctx.lineTo(shift * 2, item.ty2); - break; - } - } - - ctx.stroke(); - ctx.restore(); - }); - - if (this._model) { - var props = this._model; - ctx.strokeStyle = props.borderColor || chartjsEsmFacade.defaults.color; - ctx.lineWidth = props.borderWidth || 0; - ctx.fillStyle = props.backgroundColor || chartjsEsmFacade.defaults.color; - } else { - ctx.fillStyle = 'blue'; - } - - values.forEach(function (v, i) { - var pos = positions[i]; - - var radius = _this.getSizeForValue(v.value); - - var x = isHor ? pos.x : shift; - var y = isHor ? shift : pos.y; - var renderOptions = Object.assign({}, _this._model || {}, { - radius: radius - }); - chartjsEsmFacade.drawPoint(ctx, renderOptions, x, y); - }); - } - }]); - - return _class; - }(BaseMixin(superClass)); - } - - var SizeScale = /*#__PURE__*/function (_SizeSaleMixin) { - inherits(SizeScale, _SizeSaleMixin); - - var _super2 = _createSuper$4(SizeScale); - - function SizeScale() { - classCallCheck(this, SizeScale); - - return _super2.apply(this, arguments); - } - - return SizeScale; - }(SizeSaleMixin(chartjsEsmFacade.LinearScale)); - var scaleDefaults = { - missing: 1, - mode: 'area', - // 'radius' - // mode: 'radius', - range: [2, 20], - legend: { - align: 'bottom', - length: 90, - width: 70, - indicatorWidth: 42 - } - }; - SizeScale.id = 'size'; - SizeScale.defaults = /*#__PURE__*/chartjsEsmFacade.merge({}, [chartjsEsmFacade.LinearScale.defaults, baseDefaults, scaleDefaults]); - var SizeLogarithmicScale = /*#__PURE__*/function (_SizeSaleMixin2) { - inherits(SizeLogarithmicScale, _SizeSaleMixin2); - - var _super3 = _createSuper$4(SizeLogarithmicScale); - - function SizeLogarithmicScale() { - classCallCheck(this, SizeLogarithmicScale); - - return _super3.apply(this, arguments); - } - - createClass(SizeLogarithmicScale, [{ - key: "_getNormalizedValue", - value: function _getNormalizedValue(v) { - if (v == null || Number.isNaN(v)) { - return null; - } - - return (Math.log10(v) - this._startValue) / this._valueRange; - } - }]); - - return SizeLogarithmicScale; - }(SizeSaleMixin(chartjsEsmFacade.LogarithmicScale)); - SizeLogarithmicScale.id = 'sizeLogarithmic'; - SizeLogarithmicScale.defaults = /*#__PURE__*/chartjsEsmFacade.merge({}, [chartjsEsmFacade.LogarithmicScale.defaults, baseDefaults, scaleDefaults]); - - function _createSuper$5(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$5(); return function _createSuperInternal() { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; } - - function _isNativeReflectConstruct$5() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - var geoDefaults = { - datasetElementOptions: ['outlineBackgroundColor', 'outlineBorderColor', 'outlineBorderWidth', 'graticuleBorderColor', 'graticuleBorderWidth'], - showOutline: false, - showGraticule: false, - clipMap: true, - scales: { - xy: { - type: ProjectionScale.id, - position: 'chartArea', - display: false - } - } - }; - - function patchDatasetElementOptions(options) { - // patch the options by removing the `outline` or `hoverOutline` option; - // see https://github.com/chartjs/Chart.js/issues/7362 - var r = {}; - Object.keys(options).forEach(function (key) { - var targetKey = key; - - if (key.startsWith('outline')) { - var sub = key.slice('outline'.length); - targetKey = sub[0].toLowerCase() + sub.slice(1); - } else if (key.startsWith('hoverOutline')) { - targetKey = 'hover' + key.slice('hoverOutline'.length); - } - - r[targetKey] = options[key]; - }); - return r; - } - - var GeoController = /*#__PURE__*/function (_DatasetController) { - inherits(GeoController, _DatasetController); - - var _super = _createSuper$5(GeoController); - - function GeoController() { - classCallCheck(this, GeoController); - - return _super.apply(this, arguments); - } - - createClass(GeoController, [{ - key: "getProjectionScale", - value: function getProjectionScale() { - return this.getScaleForId('xy'); - } - }, { - key: "linkScales", - value: function linkScales() { - var dataset = this.getDataset(); - var meta = this.getMeta(); - meta.xAxisID = dataset.xAxisID = 'xy'; - meta.yAxisID = dataset.yAxisID = 'xy'; - meta.xScale = this.getScaleForId('xy'); - meta.yScale = this.getScaleForId('xy'); - this.getProjectionScale().computeBounds(this.resolveOutline()); - } - }, { - key: "showOutline", - value: function showOutline() { - return chartjsEsmFacade.valueOrDefault(this.getDataset().showOutline, this.chart.options.showOutline); - } - }, { - key: "clipMap", - value: function clipMap() { - return chartjsEsmFacade.valueOrDefault(this.getDataset().clipMap, this.chart.options.clipMap); - } - }, { - key: "getGraticule", - value: function getGraticule() { - return chartjsEsmFacade.valueOrDefault(this.getDataset().showGraticule, this.chart.options.showGraticule); - } - }, { - key: "update", - value: function update(mode) { - get(getPrototypeOf(GeoController.prototype), "update", this).call(this, mode); - - var active = mode === 'active'; - var meta = this.getMeta(); - var scale = this.getProjectionScale(); - var dirtyCache = scale.updateBounds(); - - if (this.showOutline()) { - var elem = meta.dataset; - - if (dirtyCache) { - delete elem.cache; - } - - elem.projectionScale = scale; - - if (mode !== 'resize') { - var properties = { - feature: this.resolveOutline(), - options: patchDatasetElementOptions(this.resolveDatasetElementOptions(active)) - }; - this.updateElement(elem, undefined, properties, mode); - - if (this.getGraticule()) { - meta.graticule = properties.options; - } - } - } else if (this.getGraticule() && mode !== 'resize') { - meta.graticule = patchDatasetElementOptions(this.resolveDatasetElementOptions(active)); - } - - this.updateElements(meta.data, 0, mode); - - if (dirtyCache) { - meta.data.forEach(function (elem) { - return delete elem.cache; - }); - } - } - }, { - key: "resolveOutline", - value: function resolveOutline() { - var ds = this.getDataset(); - var outline = ds.outline || { - type: 'Sphere' - }; - - if (Array.isArray(outline)) { - return { - type: 'FeatureCollection', - features: outline - }; - } - - return outline; - } - }, { - key: "showGraticule", - value: function showGraticule() { - var g = this.getGraticule(); - - if (!g) { - return; - } - - var ctx = this.chart.ctx; - var scale = this.getProjectionScale(); - var path = scale.geoPath.context(ctx); - ctx.save(); - ctx.beginPath(); - - if (g === true) { - path(graticule10()); - } else { - var geo = graticule(); - - if (g.stepMajor) { - geo.stepMajor(g.stepMajor); - } - - if (g.stepMinor) { - geo.stepMinor(g.stepMinor); - } - - path(geo); - } - - var options = this.getMeta().graticule; - ctx.strokeStyle = options.graticuleBorderColor; - ctx.lineWidth = options.graticuleBorderWidth; - ctx.stroke(); - ctx.restore(); - } - }, { - key: "draw", - value: function draw() { - var chart = this.chart; - var clipMap = this.clipMap(); // enable clipping based on the option - - var enabled = false; - - if (clipMap === true || clipMap === 'outline' || clipMap === 'outline+graticule') { - enabled = true; - chartjsEsmFacade.clipArea(chart.ctx, chart.chartArea); - } - - if (this.showOutline()) { - this.getMeta().dataset.draw(chart.ctx); - } - - if (clipMap === true || clipMap === 'graticule' || clipMap === 'outline+graticule') { - if (!enabled) { - chartjsEsmFacade.clipArea(chart.ctx, chart.chartArea); - } - } else if (enabled) { - enabled = false; - chartjsEsmFacade.unclipArea(chart.ctx); - } - - this.showGraticule(); - - if (clipMap === true || clipMap === 'items') { - if (!enabled) { - chartjsEsmFacade.clipArea(chart.ctx, chart.chartArea); - } - } else if (enabled) { - enabled = false; - chartjsEsmFacade.unclipArea(chart.ctx); - } - - this.getMeta().data.forEach(function (elem) { - return elem.draw(chart.ctx); - }); - - if (enabled) { - enabled = false; - chartjsEsmFacade.unclipArea(chart.ctx); - } - } - }]); - - return GeoController; - }(chartjsEsmFacade.DatasetController); - - function patchController(config, controller) { - var elements = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : []; - var scales = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : []; - chartjsEsmFacade.registry.addControllers(controller); - chartjsEsmFacade.registry.addElements(elements); - chartjsEsmFacade.registry.addScales(scales); - config.type = controller.id; - return config; - } - - function _createSuper$6(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$6(); return function _createSuperInternal() { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; } - - function _isNativeReflectConstruct$6() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - var ChoroplethController = /*#__PURE__*/function (_GeoController) { - inherits(ChoroplethController, _GeoController); - - var _super = _createSuper$6(ChoroplethController); - - function ChoroplethController() { - classCallCheck(this, ChoroplethController); - - return _super.apply(this, arguments); - } - - createClass(ChoroplethController, [{ - key: "linkScales", - value: function linkScales() { - get(getPrototypeOf(ChoroplethController.prototype), "linkScales", this).call(this); - - var dataset = this.getDataset(); - var meta = this.getMeta(); - meta.vAxisID = meta.rAxisID = 'color'; - dataset.vAxisID = dataset.rAxisID = 'color'; - meta.rScale = this.getScaleForId('color'); - meta.vScale = meta.rScale; - meta.iScale = meta.xScale; - meta.iAxisID = dataset.iAxisID = meta.xAxisID; - } - }, { - key: "parse", - value: function parse(start, count) { - var rScale = this.getMeta().rScale; - var data = this.getDataset().data; - var meta = this._cachedMeta; - - for (var i = start; i < start + count; ++i) { - meta._parsed[i] = defineProperty({}, rScale.axis, rScale.parse(data[i])); - } - } - }, { - key: "updateElements", - value: function updateElements(elems, start, mode) { - var firstOpts = this.resolveDataElementOptions(start, mode); - var sharedOptions = this.getSharedOptions(mode, elems[start], firstOpts); - var includeOptions = this.includeOptions(mode, sharedOptions); - var scale = this.getProjectionScale(); - - for (var i = 0; i < elems.length; i++) { - var index = start + i; - var elem = elems[i]; - elem.projectionScale = scale; - elem.feature = this._data[i].feature; - var center = elem.getCenterPoint(); - var properties = { - x: center.x, - y: center.y - }; - - if (includeOptions) { - properties.options = this.resolveDataElementOptions(index, mode); - } - - this.updateElement(elem, index, properties, mode); - } - - this.updateSharedOptions(sharedOptions, mode); - } - }, { - key: "indexToColor", - value: function indexToColor(index) { - var rScale = this.getMeta().rScale; - return rScale.getColorForValue(this.getParsed(index)[rScale.axis]); - } - }]); - - return ChoroplethController; - }(GeoController); - ChoroplethController.id = 'choropleth'; - ChoroplethController.defaults = /*#__PURE__*/chartjsEsmFacade.merge({}, [geoDefaults, { - datasetElementType: GeoFeature.id, - dataElementType: GeoFeature.id, - dataElementOptions: ['backgroundColor', 'borderColor', 'borderWidth'], - tooltips: { - callbacks: { - title: function title() { - // Title doesn't make sense for scatter since we format the data as a point - return ''; - }, - label: function label(item) { - if (item.formattedValue == null) { - return item.chart.data.labels[item.dataIndex]; - } - - return "".concat(item.chart.data.labels[item.dataIndex], ": ").concat(item.formattedValue); - } - } - }, - scales: { - color: { - type: ColorScale.id - } - }, - elements: { - geoFeature: { - backgroundColor: function backgroundColor(context) { - if (context.dataIndex == null) { - return null; - } - - var controller = context.chart.getDatasetMeta(context.datasetIndex).controller; - return controller.indexToColor(context.dataIndex); - } - } - } - }]); - var ChoroplethChart = /*#__PURE__*/function (_Chart) { - inherits(ChoroplethChart, _Chart); - - var _super2 = _createSuper$6(ChoroplethChart); - - function ChoroplethChart(item, config) { - classCallCheck(this, ChoroplethChart); - - return _super2.call(this, item, patchController(config, ChoroplethController, GeoFeature, [ColorScale, ProjectionScale])); - } - - return ChoroplethChart; - }(chartjsEsmFacade.Chart); - ChoroplethChart.id = ChoroplethController.id; - - function _createSuper$7(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct$7(); return function _createSuperInternal() { var Super = getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return possibleConstructorReturn(this, result); }; } - - function _isNativeReflectConstruct$7() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } - var BubbleMapController = /*#__PURE__*/function (_GeoController) { - inherits(BubbleMapController, _GeoController); - - var _super = _createSuper$7(BubbleMapController); - - function BubbleMapController() { - classCallCheck(this, BubbleMapController); - - return _super.apply(this, arguments); - } - - createClass(BubbleMapController, [{ - key: "linkScales", - value: function linkScales() { - get(getPrototypeOf(BubbleMapController.prototype), "linkScales", this).call(this); - - var dataset = this.getDataset(); - var meta = this.getMeta(); - meta.vAxisID = meta.rAxisID = 'r'; - dataset.vAxisID = dataset.rAxisID = 'r'; - meta.rScale = this.getScaleForId('r'); - meta.vScale = meta.rScale; - meta.iScale = meta.xScale; - meta.iAxisID = dataset.iAxisID = meta.xAxisID; - } - }, { - key: "parse", - value: function parse(start, count) { - var rScale = this.getMeta().rScale; - var data = this.getDataset().data; - var meta = this._cachedMeta; - - for (var i = start; i < start + count; ++i) { - var d = data[i]; - meta._parsed[i] = defineProperty({ - x: d.longitude == null ? d.x : d.longitude, - y: d.latitude == null ? d.y : d.latitude - }, rScale.axis, rScale.parse(d)); - } - } - }, { - key: "updateElements", - value: function updateElements(elems, start, mode) { - var reset = mode === 'reset'; - var firstOpts = this.resolveDataElementOptions(start, mode); - var sharedOptions = this.getSharedOptions(mode, elems[start], firstOpts); - var includeOptions = this.includeOptions(mode, sharedOptions); - var scale = this.getProjectionScale(); - this.getMeta().rScale._model = firstOpts; // for legend rendering styling - - for (var i = 0; i < elems.length; i++) { - var index = start + i; - var elem = elems[i]; - var parsed = this.getParsed(i); - var xy = scale.projection([parsed.x, parsed.y]); - var properties = { - x: xy ? xy[0] : 0, - y: xy ? xy[1] : 0, - skip: Number.isNaN(parsed.x) || Number.isNaN(parsed.y) - }; - - if (includeOptions) { - properties.options = this.resolveDataElementOptions(index, mode); - - if (reset) { - properties.options.radius = 0; - } - } - - this.updateElement(elem, index, properties, mode); - } - - this.updateSharedOptions(sharedOptions, mode); - } - }, { - key: "indexToRadius", - value: function indexToRadius(index) { - var rScale = this.getMeta().rScale; - return rScale.getSizeForValue(this.getParsed(index)[rScale.axis]); - } - }]); - - return BubbleMapController; - }(GeoController); - BubbleMapController.id = 'bubbleMap'; - BubbleMapController.defaults = chartjsEsmFacade.merge({}, [geoDefaults, { - dataElementType: chartjsEsmFacade.Point.id, - dataElementOptions: chartjsEsmFacade.BubbleController.defaults.dataElementOptions, - datasetElementType: GeoFeature.id, - showOutline: true, - clipMap: 'outline+graticule', - tooltips: { - callbacks: { - title: function title() { - // Title doesn't make sense for scatter since we format the data as a point - return ''; - }, - label: function label(item) { - if (item.formattedValue == null) { - return item.chart.data.labels[item.dataIndex]; - } - - return "".concat(item.chart.data.labels[item.dataIndex], ": ").concat(item.formattedValue); - } - } - }, - scales: { - r: { - type: SizeScale.id - } - }, - elements: { - point: { - radius: function radius(context) { - if (context.dataIndex == null) { - return null; - } - - var controller = context.chart.getDatasetMeta(context.datasetIndex).controller; - return controller.indexToRadius(context.dataIndex); - }, - hoverRadius: undefined - } - } - }]); - var BubbleMapChart = /*#__PURE__*/function (_Chart) { - inherits(BubbleMapChart, _Chart); - - var _super2 = _createSuper$7(BubbleMapChart); - - function BubbleMapChart(item, config) { - classCallCheck(this, BubbleMapChart); - - return _super2.call(this, item, patchController(config, BubbleMapController, GeoFeature, [SizeScale, ProjectionScale])); - } - - return BubbleMapChart; - }(chartjsEsmFacade.Chart); - BubbleMapChart.id = BubbleMapController.id; - - function identity$1 (x) { - return x; - } - - function transform (transform) { - if (transform == null) return identity$1; - var x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function (input, i) { - if (!i) x0 = y0 = 0; - var j = 2, - n = input.length, - output = new Array(n); - output[0] = (x0 += input[0]) * kx + dx; - output[1] = (y0 += input[1]) * ky + dy; - - while (j < n) { - output[j] = input[j], ++j; - } - - return output; - }; - } - - function bbox (topology) { - var t = transform(topology.transform), - key, - x0 = Infinity, - y0 = x0, - x1 = -x0, - y1 = -x0; - - function bboxPoint(p) { - p = t(p); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - - function bboxGeometry(o) { - switch (o.type) { - case "GeometryCollection": - o.geometries.forEach(bboxGeometry); - break; - - case "Point": - bboxPoint(o.coordinates); - break; - - case "MultiPoint": - o.coordinates.forEach(bboxPoint); - break; - } - } - - topology.arcs.forEach(function (arc) { - var i = -1, - n = arc.length, - p; - - while (++i < n) { - p = t(arc[i], i); - if (p[0] < x0) x0 = p[0]; - if (p[0] > x1) x1 = p[0]; - if (p[1] < y0) y0 = p[1]; - if (p[1] > y1) y1 = p[1]; - } - }); - - for (key in topology.objects) { - bboxGeometry(topology.objects[key]); - } - - return [x0, y0, x1, y1]; - } - - function reverse (array, n) { - var t, - j = array.length, - i = j - n; - - while (i < --j) { - t = array[i], array[i++] = array[j], array[j] = t; - } - } - - function feature (topology, o) { - if (typeof o === "string") o = topology.objects[o]; - return o.type === "GeometryCollection" ? { - type: "FeatureCollection", - features: o.geometries.map(function (o) { - return feature$1(topology, o); - }) - } : feature$1(topology, o); - } - - function feature$1(topology, o) { - var id = o.id, - bbox = o.bbox, - properties = o.properties == null ? {} : o.properties, - geometry = object$1(topology, o); - return id == null && bbox == null ? { - type: "Feature", - properties: properties, - geometry: geometry - } : bbox == null ? { - type: "Feature", - id: id, - properties: properties, - geometry: geometry - } : { - type: "Feature", - id: id, - bbox: bbox, - properties: properties, - geometry: geometry - }; - } - - function object$1(topology, o) { - var transformPoint = transform(topology.transform), - arcs = topology.arcs; - - function arc(i, points) { - if (points.length) points.pop(); - - for (var a = arcs[i < 0 ? ~i : i], k = 0, n = a.length; k < n; ++k) { - points.push(transformPoint(a[k], k)); - } - - if (i < 0) reverse(points, n); - } - - function point(p) { - return transformPoint(p); - } - - function line(arcs) { - var points = []; - - for (var i = 0, n = arcs.length; i < n; ++i) { - arc(arcs[i], points); - } - - if (points.length < 2) points.push(points[0]); // This should never happen per the specification. - - return points; - } - - function ring(arcs) { - var points = line(arcs); - - while (points.length < 4) { - points.push(points[0]); - } // This may happen if an arc has only two points. - - - return points; - } - - function polygon(arcs) { - return arcs.map(ring); - } - - function geometry(o) { - var type = o.type, - coordinates; - - switch (type) { - case "GeometryCollection": - return { - type: type, - geometries: o.geometries.map(geometry) - }; - - case "Point": - coordinates = point(o.coordinates); - break; - - case "MultiPoint": - coordinates = o.coordinates.map(point); - break; - - case "LineString": - coordinates = line(o.arcs); - break; - - case "MultiLineString": - coordinates = o.arcs.map(line); - break; - - case "Polygon": - coordinates = polygon(o.arcs); - break; - - case "MultiPolygon": - coordinates = o.arcs.map(polygon); - break; - - default: - return null; - } - - return { - type: type, - coordinates: coordinates - }; - } - - return geometry(o); - } - - function stitch (topology, arcs) { - var stitchedArcs = {}, - fragmentByStart = {}, - fragmentByEnd = {}, - fragments = [], - emptyIndex = -1; // Stitch empty arcs first, since they may be subsumed by other arcs. - - arcs.forEach(function (i, j) { - var arc = topology.arcs[i < 0 ? ~i : i], - t; - - if (arc.length < 3 && !arc[1][0] && !arc[1][1]) { - t = arcs[++emptyIndex], arcs[emptyIndex] = i, arcs[j] = t; - } - }); - arcs.forEach(function (i) { - var e = ends(i), - start = e[0], - end = e[1], - f, - g; - - if (f = fragmentByEnd[start]) { - delete fragmentByEnd[f.end]; - f.push(i); - f.end = end; - - if (g = fragmentByStart[end]) { - delete fragmentByStart[g.start]; - var fg = g === f ? f : f.concat(g); - fragmentByStart[fg.start = f.start] = fragmentByEnd[fg.end = g.end] = fg; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else if (f = fragmentByStart[end]) { - delete fragmentByStart[f.start]; - f.unshift(i); - f.start = start; - - if (g = fragmentByEnd[start]) { - delete fragmentByEnd[g.end]; - var gf = g === f ? f : g.concat(f); - fragmentByStart[gf.start = g.start] = fragmentByEnd[gf.end = f.end] = gf; - } else { - fragmentByStart[f.start] = fragmentByEnd[f.end] = f; - } - } else { - f = [i]; - fragmentByStart[f.start = start] = fragmentByEnd[f.end = end] = f; - } - }); - - function ends(i) { - var arc = topology.arcs[i < 0 ? ~i : i], - p0 = arc[0], - p1; - if (topology.transform) p1 = [0, 0], arc.forEach(function (dp) { - p1[0] += dp[0], p1[1] += dp[1]; - });else p1 = arc[arc.length - 1]; - return i < 0 ? [p1, p0] : [p0, p1]; - } - - function flush(fragmentByEnd, fragmentByStart) { - for (var k in fragmentByEnd) { - var f = fragmentByEnd[k]; - delete fragmentByStart[f.start]; - delete f.start; - delete f.end; - f.forEach(function (i) { - stitchedArcs[i < 0 ? ~i : i] = 1; - }); - fragments.push(f); - } - } - - flush(fragmentByEnd, fragmentByStart); - flush(fragmentByStart, fragmentByEnd); - arcs.forEach(function (i) { - if (!stitchedArcs[i < 0 ? ~i : i]) fragments.push([i]); - }); - return fragments; - } - - function mesh (topology) { - return object$1(topology, meshArcs.apply(this, arguments)); - } - function meshArcs(topology, object, filter) { - var arcs, i, n; - if (arguments.length > 1) arcs = extractArcs(topology, object, filter);else for (i = 0, arcs = new Array(n = topology.arcs.length); i < n; ++i) { - arcs[i] = i; - } - return { - type: "MultiLineString", - arcs: stitch(topology, arcs) - }; - } - - function extractArcs(topology, object, filter) { - var arcs = [], - geomsByArc = [], - geom; - - function extract0(i) { - var j = i < 0 ? ~i : i; - (geomsByArc[j] || (geomsByArc[j] = [])).push({ - i: i, - g: geom - }); - } - - function extract1(arcs) { - arcs.forEach(extract0); - } - - function extract2(arcs) { - arcs.forEach(extract1); - } - - function extract3(arcs) { - arcs.forEach(extract2); - } - - function geometry(o) { - switch (geom = o, o.type) { - case "GeometryCollection": - o.geometries.forEach(geometry); - break; - - case "LineString": - extract1(o.arcs); - break; - - case "MultiLineString": - case "Polygon": - extract2(o.arcs); - break; - - case "MultiPolygon": - extract3(o.arcs); - break; - } - } - - geometry(object); - geomsByArc.forEach(filter == null ? function (geoms) { - arcs.push(geoms[0].i); - } : function (geoms) { - if (filter(geoms[0].g, geoms[geoms.length - 1].g)) arcs.push(geoms[0].i); - }); - return arcs; - } - - function planarRingArea(ring) { - var i = -1, - n = ring.length, - a, - b = ring[n - 1], - area = 0; - - while (++i < n) { - a = b, b = ring[i], area += a[0] * b[1] - a[1] * b[0]; - } - - return Math.abs(area); // Note: doubled area! - } - - function merge$1 (topology) { - return object$1(topology, mergeArcs.apply(this, arguments)); - } - function mergeArcs(topology, objects) { - var polygonsByArc = {}, - polygons = [], - groups = []; - objects.forEach(geometry); - - function geometry(o) { - switch (o.type) { - case "GeometryCollection": - o.geometries.forEach(geometry); - break; - - case "Polygon": - extract(o.arcs); - break; - - case "MultiPolygon": - o.arcs.forEach(extract); - break; - } - } - - function extract(polygon) { - polygon.forEach(function (ring) { - ring.forEach(function (arc) { - (polygonsByArc[arc = arc < 0 ? ~arc : arc] || (polygonsByArc[arc] = [])).push(polygon); - }); - }); - polygons.push(polygon); - } - - function area(ring) { - return planarRingArea(object$1(topology, { - type: "Polygon", - arcs: [ring] - }).coordinates[0]); - } - - polygons.forEach(function (polygon) { - if (!polygon._) { - var group = [], - neighbors = [polygon]; - polygon._ = 1; - groups.push(group); - - while (polygon = neighbors.pop()) { - group.push(polygon); - polygon.forEach(function (ring) { - ring.forEach(function (arc) { - polygonsByArc[arc < 0 ? ~arc : arc].forEach(function (polygon) { - if (!polygon._) { - polygon._ = 1; - neighbors.push(polygon); - } - }); - }); - }); - } - } - }); - polygons.forEach(function (polygon) { - delete polygon._; - }); - return { - type: "MultiPolygon", - arcs: groups.map(function (polygons) { - var arcs = [], - n; // Extract the exterior (unique) arcs. - - polygons.forEach(function (polygon) { - polygon.forEach(function (ring) { - ring.forEach(function (arc) { - if (polygonsByArc[arc < 0 ? ~arc : arc].length < 2) { - arcs.push(arc); - } - }); - }); - }); // Stitch the arcs into one or more rings. - - arcs = stitch(topology, arcs); // If more than one ring is returned, - // at most one of these rings can be the exterior; - // choose the one with the greatest absolute area. - - if ((n = arcs.length) > 1) { - for (var i = 1, k = area(arcs[0]), ki, t; i < n; ++i) { - if ((ki = area(arcs[i])) > k) { - t = arcs[0], arcs[0] = arcs[i], arcs[i] = t, k = ki; - } - } - } - - return arcs; - }).filter(function (arcs) { - return arcs.length > 0; - }) - }; - } - - function bisect (a, x) { - var lo = 0, - hi = a.length; - - while (lo < hi) { - var mid = lo + hi >>> 1; - if (a[mid] < x) lo = mid + 1;else hi = mid; - } - - return lo; - } - - function neighbors (objects) { - var indexesByArc = {}, - // arc index -> array of object indexes - neighbors = objects.map(function () { - return []; - }); - - function line(arcs, i) { - arcs.forEach(function (a) { - if (a < 0) a = ~a; - var o = indexesByArc[a]; - if (o) o.push(i);else indexesByArc[a] = [i]; - }); - } - - function polygon(arcs, i) { - arcs.forEach(function (arc) { - line(arc, i); - }); - } - - function geometry(o, i) { - if (o.type === "GeometryCollection") o.geometries.forEach(function (o) { - geometry(o, i); - });else if (o.type in geometryType) geometryType[o.type](o.arcs, i); - } - - var geometryType = { - LineString: line, - MultiLineString: polygon, - Polygon: polygon, - MultiPolygon: function MultiPolygon(arcs, i) { - arcs.forEach(function (arc) { - polygon(arc, i); - }); - } - }; - objects.forEach(geometry); - - for (var i in indexesByArc) { - for (var indexes = indexesByArc[i], m = indexes.length, j = 0; j < m; ++j) { - for (var k = j + 1; k < m; ++k) { - var ij = indexes[j], - ik = indexes[k], - n; - if ((n = neighbors[ij])[i = bisect(n, ik)] !== ik) n.splice(i, 0, ik); - if ((n = neighbors[ik])[i = bisect(n, ij)] !== ij) n.splice(i, 0, ij); - } - } - } - - return neighbors; - } - - function untransform (transform) { - if (transform == null) return identity$1; - var x0, - y0, - kx = transform.scale[0], - ky = transform.scale[1], - dx = transform.translate[0], - dy = transform.translate[1]; - return function (input, i) { - if (!i) x0 = y0 = 0; - var j = 2, - n = input.length, - output = new Array(n), - x1 = Math.round((input[0] - dx) / kx), - y1 = Math.round((input[1] - dy) / ky); - output[0] = x1 - x0, x0 = x1; - output[1] = y1 - y0, y0 = y1; - - while (j < n) { - output[j] = input[j], ++j; - } - - return output; - }; - } - - function quantize$1 (topology, transform) { - if (topology.transform) throw new Error("already quantized"); - - if (!transform || !transform.scale) { - if (!((n = Math.floor(transform)) >= 2)) throw new Error("n must be ≥2"); - box = topology.bbox || bbox(topology); - var x0 = box[0], - y0 = box[1], - x1 = box[2], - y1 = box[3], - n; - transform = { - scale: [x1 - x0 ? (x1 - x0) / (n - 1) : 1, y1 - y0 ? (y1 - y0) / (n - 1) : 1], - translate: [x0, y0] - }; - } else { - box = topology.bbox; - } - - var t = untransform(transform), - box, - key, - inputs = topology.objects, - outputs = {}; - - function quantizePoint(point) { - return t(point); - } - - function quantizeGeometry(input) { - var output; - - switch (input.type) { - case "GeometryCollection": - output = { - type: "GeometryCollection", - geometries: input.geometries.map(quantizeGeometry) - }; - break; - - case "Point": - output = { - type: "Point", - coordinates: quantizePoint(input.coordinates) - }; - break; - - case "MultiPoint": - output = { - type: "MultiPoint", - coordinates: input.coordinates.map(quantizePoint) - }; - break; - - default: - return input; - } - - if (input.id != null) output.id = input.id; - if (input.bbox != null) output.bbox = input.bbox; - if (input.properties != null) output.properties = input.properties; - return output; - } - - function quantizeArc(input) { - var i = 0, - j = 1, - n = input.length, - p, - output = new Array(n); // pessimistic - - output[0] = t(input[0], 0); - - while (++i < n) { - if ((p = t(input[i], i))[0] || p[1]) output[j++] = p; - } // non-coincident points - - - if (j === 1) output[j++] = [0, 0]; // an arc must have at least two points - - output.length = j; - return output; - } - - for (key in inputs) { - outputs[key] = quantizeGeometry(inputs[key]); - } - - return { - type: "Topology", - bbox: box, - transform: transform, - objects: outputs, - arcs: topology.arcs.map(quantizeArc) - }; - } - - var t = /*#__PURE__*/Object.freeze({ - __proto__: null, - bbox: bbox, - feature: feature, - mesh: mesh, - meshArcs: meshArcs, - merge: merge$1, - mergeArcs: mergeArcs, - neighbors: neighbors, - quantize: quantize$1, - transform: transform, - untransform: untransform - }); - - var topojson = t; - - chartjsEsmFacade.registry.addControllers(ChoroplethController, BubbleMapController); - chartjsEsmFacade.registry.addScales(ColorLogarithmicScale, SizeLogarithmicScale, ProjectionScale, ColorScale, SizeScale); - chartjsEsmFacade.registry.addElements(GeoFeature); - - exports.BubbleMapChart = BubbleMapChart; - exports.BubbleMapController = BubbleMapController; - exports.ChoroplethChart = ChoroplethChart; - exports.ChoroplethController = ChoroplethController; - exports.ColorLogarithmicScale = ColorLogarithmicScale; - exports.ColorScale = ColorScale; - exports.GeoController = GeoController; - exports.GeoFeature = GeoFeature; - exports.ProjectionScale = ProjectionScale; - exports.SizeLogarithmicScale = SizeLogarithmicScale; - exports.SizeScale = SizeScale; - exports.geoDefaults = geoDefaults; - exports.topojson = topojson; - - Object.defineProperty(exports, '__esModule', { value: true }); - -}))); diff --git a/build/Chart.Geo.min.js b/build/Chart.Geo.min.js deleted file mode 100644 index c64891d..0000000 --- a/build/Chart.Geo.min.js +++ /dev/null @@ -1 +0,0 @@ -!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@sgratzl/chartjs-esm-facade")):"function"==typeof define&&define.amd?define(["exports","@sgratzl/chartjs-esm-facade"],t):t((e=e||self).ChartGeo={},e.ChartESMFacade)}(this,function(e,t){"use strict";var n=function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")};function r(e,t){for(var n=0;n0?1:e<0?-1:0},I=Math.sqrt,D=Math.tan;function z(e){return e>1?0:e<-1?y:Math.acos(e)}function B(e){return e>1?m:e<-1?-m:Math.asin(e)}function L(){}function G(e,t){e&&W.hasOwnProperty(e.type)&&W[e.type](e,t)}var T={Feature:function(e,t){G(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,a=n.length;++ry?e+Math.round(-e/x)*x:e,t]}function ee(e,t,n){return(e%=x)?t||n?J(ne(e),re(t,n)):ne(e):t||n?re(t,n):Q}function te(e){return function(t,n){return[(t+=e)>y?t-x:t<-y?t+x:t,n]}}function ne(e){var t=te(e);return t.invert=te(-e),t}function re(e,t){var n=P(e),r=j(e),a=P(t),i=j(t);function f(e,t){var f=P(t),c=P(e)*f,o=j(e)*f,u=j(t),d=u*n+c*r;return[N(o*a-d*i,c*n-u*r),B(d*a+o*i)]}return f.invert=function(e,t){var f=P(t),c=P(e)*f,o=j(e)*f,u=j(t),d=u*a-o*i;return[N(o*a+u*i,c*n+d*r),B(d*n-c*r)]},f}function ae(e,t){(t=Y(t))[0]-=e,Z(t);var n=z(-t[1]);return((-t[2]<0?-n:n)+x-g)%x}function ie(){var e,t=[];return{point:function(t,n,r){e.push([t,n,r])},lineStart:function(){t.push(e=[])},lineEnd:L,rejoin:function(){t.length>1&&t.push(t.pop().concat(t.shift()))},result:function(){var n=t;return t=[],e=null,n}}}function fe(e,t){return E(e[0]-t[0])=0;--i)a.point((d=u[i])[0],d[1]);else r(s.x,s.p.x,-1,a);s=s.p}u=(s=s.o).z,h=!h}while(!s.v);a.lineEnd()}}}function ue(e){if(t=e.length){for(var t,n,r=0,a=e[0];++r=0?1:-1,O=C*R,I=O>y,D=p*_;if(de.add(N(D*C*j(O),v*A+D*P(O))),f+=I?R+C*x:R,I^h>=n^E>=n){var z=K(Y(s),Y(M));Z(z);var L=K(i,z);Z(L);var G=(I^R>=0?-1:1)*B(L[2]);(r>G||r===G&&(z[0]||z[1]))&&(c+=I^R>=0?1:-1)}}return(f<-g||ft?1:e>=t?0:NaN}var be,pe;1===(be=he).length&&(pe=be,be=function(e,t){return he(pe(e),t)});function ge(e,t,n){e=+e,t=+t,n=(a=arguments.length)<2?(t=e,e=0,1):a<3?1:+n;for(var r=-1,a=0|Math.max(0,Math.ceil((t-e)/n)),i=new Array(a);++r=0;)for(t=(r=e[a]).length;--t>=0;)n[--f]=r[t];return n}function ye(e,t,n,r){return function(a){var i,f,c,o=t(a),u=ie(),d=t(u),l=!1,s={point:h,lineStart:p,lineEnd:g,polygonStart:function(){s.point=v,s.lineStart=y,s.lineEnd=m,f=[],i=[]},polygonEnd:function(){s.point=h,s.lineStart=p,s.lineEnd=g,f=ve(f);var e=se(i,r);f.length?(l||(a.polygonStart(),l=!0),oe(f,we,e,n,a)):e&&(l||(a.polygonStart(),l=!0),a.lineStart(),n(null,null,1,a),a.lineEnd()),l&&(a.polygonEnd(),l=!1),f=i=null},sphere:function(){a.polygonStart(),a.lineStart(),n(null,null,1,a),a.lineEnd(),a.polygonEnd()}};function h(t,n){e(t,n)&&a.point(t,n)}function b(e,t){o.point(e,t)}function p(){s.point=b,o.lineStart()}function g(){s.point=h,o.lineEnd()}function v(e,t){c.push([e,t]),d.point(e,t)}function y(){d.lineStart(),c=[]}function m(){v(c[0][0],c[0][1]),d.lineEnd();var e,t,n,r,o=d.clean(),s=u.result(),h=s.length;if(c.pop(),i.push(c),c=null,h)if(1&o){if((t=(n=s[0]).length-1)>0){for(l||(a.polygonStart(),l=!0),a.lineStart(),e=0;e1&&2&o&&s.push(s.pop().concat(s.shift())),f.push(s.filter(me))}return s}}function me(e){return e.length>1}function we(e,t){return((e=e.x)[0]<0?e[1]-m-g:m-e[1])-((t=t.x)[0]<0?t[1]-m-g:m-t[1])}var xe=ye(function(){return!0},function(e){var t,n=NaN,r=NaN,a=NaN;return{lineStart:function(){e.lineStart(),t=1},point:function(i,f){var c=i>0?y:-y,o=E(i-n);E(o-y)0?m:-m),e.point(a,r),e.lineEnd(),e.lineStart(),e.point(c,r),e.point(i,r),t=0):a!==c&&o>=y&&(E(n-a)g?k((j(t)*(i=P(r))*j(n)-j(r)*(a=P(t))*j(e))/(a*i*f)):(t+r)/2}(n,r,i,f),e.point(a,r),e.lineEnd(),e.lineStart(),e.point(c,r),t=0),e.point(n=i,r=f),a=c},lineEnd:function(){e.lineEnd(),n=r=NaN},clean:function(){return 2-t}}},function(e,t,n,r){var a;if(null==e)a=n*m,r.point(-y,a),r.point(0,a),r.point(y,a),r.point(y,0),r.point(y,-a),r.point(0,-a),r.point(-y,-a),r.point(-y,0),r.point(-y,a);else if(E(e[0]-t[0])>g){var i=e[0]0,a=E(t)>g;function i(e,n){return P(e)*P(n)>t}function f(e,n,r){var a=[1,0,0],i=K(Y(e),Y(n)),f=$(i,i),c=i[0],o=f-c*c;if(!o)return!r&&e;var u=t*f/o,d=-t*c/o,l=K(a,i),s=U(a,u);X(s,U(i,d));var h=l,b=$(s,h),p=$(h,h),v=b*b-p*($(s,s)-1);if(!(v<0)){var m=I(v),w=U(h,(-b-m)/p);if(X(w,s),w=H(w),!r)return w;var x,S=e[0],M=n[0],k=e[1],N=n[1];M0^w[1]<(E(w[0]-S)y^(S<=w[0]&&w[0]<=M)){var A=U(h,(-b+m)/p);return X(A,s),[w,H(A)]}}}function c(t,n){var a=r?e:y-e,i=0;return t<-a?i|=1:t>a&&(i|=2),n<-a?i|=4:n>a&&(i|=8),i}return ye(i,function(e){var t,n,o,u,d;return{lineStart:function(){u=o=!1,d=1},point:function(l,s){var h,b=[l,s],p=i(l,s),g=r?p?0:c(l,s):p?c(l+(l<0?y:-y),s):0;if(!t&&(u=o=p)&&e.lineStart(),p!==o&&(!(h=f(t,b))||fe(t,h)||fe(b,h))&&(b[2]=1),p!==o)d=0,p?(e.lineStart(),h=f(b,t),e.point(h[0],h[1])):(h=f(t,b),e.point(h[0],h[1],2),e.lineEnd()),t=h;else if(a&&t&&r^p){var v;g&n||!(v=f(b,t,!0))||(d=0,r?(e.lineStart(),e.point(v[0][0],v[0][1]),e.point(v[1][0],v[1][1]),e.lineEnd()):(e.point(v[1][0],v[1][1]),e.lineEnd(),e.lineStart(),e.point(v[0][0],v[0][1],3)))}!p||t&&fe(t,b)||e.point(b[0],b[1]),t=b,o=p,n=g},lineEnd:function(){o&&e.lineEnd(),t=null},clean:function(){return d|(u&&o)<<1}}},function(t,r,a,i){!function(e,t,n,r,a,i){if(n){var f=P(t),c=j(t),o=r*n;null==a?(a=t+r*x,i=t-o/2):(a=ae(f,a),i=ae(f,i),(r>0?ai)&&(a+=r*x));for(var u,d=a;r>0?d>i:d0)do{u.point(0===d||3===d?e:n,d>1?r:t)}while((d=(d+c+4)%4)!==l);else u.point(i[0],i[1])}function f(r,a){return E(r[0]-e)0?0:3:E(r[0]-n)0?2:1:E(r[1]-t)0?1:0:a>0?3:2}function c(e,t){return o(e.x,t.x)}function o(e,t){var n=f(e,1),r=f(t,1);return n!==r?n-r:0===n?t[1]-e[1]:1===n?e[0]-t[0]:2===n?e[1]-t[1]:t[0]-e[0]}return function(f){var o,u,d,l,s,h,b,p,g,v,y,m=f,w=ie(),x={point:S,lineStart:function(){x.point=M,u&&u.push(d=[]);v=!0,g=!1,b=p=NaN},lineEnd:function(){o&&(M(l,s),h&&g&&w.rejoin(),o.push(w.result()));x.point=S,g&&m.lineEnd()},polygonStart:function(){m=w,o=[],u=[],y=!0},polygonEnd:function(){var t=function(){for(var t=0,n=0,a=u.length;nr&&(s-i)*(r-f)>(h-f)*(e-i)&&++t:h<=r&&(s-i)*(r-f)<(h-f)*(e-i)&&--t;return t}(),n=y&&t,a=(o=ve(o)).length;(n||a)&&(f.polygonStart(),n&&(f.lineStart(),i(null,null,1,f),f.lineEnd()),a&&oe(o,c,t,i,f),f.polygonEnd());m=f,o=u=d=null}};function S(e,t){a(e,t)&&m.point(e,t)}function M(i,f){var c=a(i,f);if(u&&d.push([i,f]),v)l=i,s=f,h=c,v=!1,c&&(m.lineStart(),m.point(i,f));else if(c&&g)m.point(i,f);else{var o=[b=Math.max(Ee,Math.min(Me,b)),p=Math.max(Ee,Math.min(Me,p))],w=[i=Math.max(Ee,Math.min(Me,i)),f=Math.max(Ee,Math.min(Me,f))];!function(e,t,n,r,a,i){var f,c=e[0],o=e[1],u=0,d=1,l=t[0]-c,s=t[1]-o;if(f=n-c,l||!(f>0)){if(f/=l,l<0){if(f0){if(f>d)return;f>u&&(u=f)}if(f=a-c,l||!(f<0)){if(f/=l,l<0){if(f>d)return;f>u&&(u=f)}else if(l>0){if(f0)){if(f/=s,s<0){if(f0){if(f>d)return;f>u&&(u=f)}if(f=i-o,s||!(f<0)){if(f/=s,s<0){if(f>d)return;f>u&&(u=f)}else if(s>0){if(f0&&(e[0]=c+u*l,e[1]=o+u*s),d<1&&(t[0]=c+d*l,t[1]=o+d*s),!0}}}}}(o,w,e,t,n,r)?c&&(m.lineStart(),m.point(i,f),y=!1):(g||(m.lineStart(),m.point(o[0],o[1])),m.point(w[0],w[1]),c||m.lineEnd(),y=!1)}b=i,p=f,g=c}return x}}var Ne,Pe,_e,Ae=s(),Re={sphere:L,point:L,lineStart:function(){Re.point=je,Re.lineEnd=Ce},lineEnd:L,polygonStart:L,polygonEnd:L};function Ce(){Re.point=Re.lineEnd=L}function je(e,t){Ne=e*=M,Pe=j(t*=M),_e=P(t),Re.point=Oe}function Oe(e,t){e*=M;var n=j(t*=M),r=P(t),a=E(e-Ne),i=P(a),f=r*j(a),c=_e*n-Pe*r*i,o=Pe*n+_e*r*i;Ae.add(N(I(f*f+c*c),o)),Ne=e,Pe=n,_e=r}var Ie=[null,null],De={type:"LineString",coordinates:Ie};function ze(e,t){return Ie[0]=e,Ie[1]=t,function(e){return Ae.reset(),V(e,Re),+Ae}(De)}var Be={Feature:function(e,t){return Ge(e.geometry,t)},FeatureCollection:function(e,t){for(var n=e.features,r=-1,a=n.length;++r0&&(a=ze(e[i],e[i-1]))>0&&n<=a&&r<=a&&(n+r-a)*(1-Math.pow((n-r)/a,2))g}).map(o)).concat(ge(_(i/h)*h,a,h).filter(function(e){return E(e%p)>g}).map(u))}return y.lines=function(){return m().map(function(e){return{type:"LineString",coordinates:e}})},y.outline=function(){return{type:"Polygon",coordinates:[d(r).concat(l(f).slice(1),d(n).reverse().slice(1),l(c).reverse().slice(1))]}},y.extent=function(e){return arguments.length?y.extentMajor(e).extentMinor(e):y.extentMinor()},y.extentMajor=function(e){return arguments.length?(r=+e[0][0],n=+e[1][0],c=+e[0][1],f=+e[1][1],r>n&&(e=r,r=n,n=e),c>f&&(e=c,c=f,f=e),y.precision(v)):[[r,c],[n,f]]},y.extentMinor=function(n){return arguments.length?(t=+n[0][0],e=+n[1][0],i=+n[0][1],a=+n[1][1],t>e&&(n=t,t=e,e=n),i>a&&(n=i,i=a,a=n),y.precision(v)):[[t,i],[e,a]]},y.step=function(e){return arguments.length?y.stepMajor(e).stepMinor(e):y.stepMinor()},y.stepMajor=function(e){return arguments.length?(b=+e[0],p=+e[1],y):[b,p]},y.stepMinor=function(e){return arguments.length?(s=+e[0],h=+e[1],y):[s,h]},y.precision=function(s){return arguments.length?(v=+s,o=He(i,a,90),u=Ye(t,e,v),d=He(c,f,90),l=Ye(r,n,v),y):v},y.extentMajor([[-180,-90+g],[180,90-g]]).extentMinor([[-180,-80-g],[180,80+g]])}function Ke(e){return e}var Xe,Ue,Ze,Je,Qe=s(),et=s(),tt={point:L,lineStart:L,lineEnd:L,polygonStart:function(){tt.lineStart=nt,tt.lineEnd=it},polygonEnd:function(){tt.lineStart=tt.lineEnd=tt.point=L,Qe.add(E(et)),et.reset()},result:function(){var e=Qe/2;return Qe.reset(),e}};function nt(){tt.point=rt}function rt(e,t){tt.point=at,Xe=Ze=e,Ue=Je=t}function at(e,t){et.add(Je*e-Ze*t),Ze=e,Je=t}function it(){at(Xe,Ue)}var ft=1/0,ct=ft,ot=-ft,ut=ot,dt={point:function(e,t){eot&&(ot=e);tut&&(ut=t)},lineStart:L,lineEnd:L,polygonStart:L,polygonEnd:L,result:function(){var e=[[ft,ct],[ot,ut]];return ot=ut=-(ct=ft=1/0),e}};var lt,st,ht,bt,pt=0,gt=0,vt=0,yt=0,mt=0,wt=0,xt=0,St=0,Mt=0,Et={point:kt,lineStart:Nt,lineEnd:At,polygonStart:function(){Et.lineStart=Rt,Et.lineEnd=Ct},polygonEnd:function(){Et.point=kt,Et.lineStart=Nt,Et.lineEnd=At},result:function(){var e=Mt?[xt/Mt,St/Mt]:wt?[yt/wt,mt/wt]:vt?[pt/vt,gt/vt]:[NaN,NaN];return pt=gt=vt=yt=mt=wt=xt=St=Mt=0,e}};function kt(e,t){pt+=e,gt+=t,++vt}function Nt(){Et.point=Pt}function Pt(e,t){Et.point=_t,kt(ht=e,bt=t)}function _t(e,t){var n=e-ht,r=t-bt,a=I(n*n+r*r);yt+=a*(ht+e)/2,mt+=a*(bt+t)/2,wt+=a,kt(ht=e,bt=t)}function At(){Et.point=kt}function Rt(){Et.point=jt}function Ct(){Ot(lt,st)}function jt(e,t){Et.point=Ot,kt(lt=ht=e,st=bt=t)}function Ot(e,t){var n=e-ht,r=t-bt,a=I(n*n+r*r);yt+=a*(ht+e)/2,mt+=a*(bt+t)/2,wt+=a,xt+=(a=bt*e-ht*t)*(ht+e),St+=a*(bt+t),Mt+=3*a,kt(ht=e,bt=t)}function It(e){this._context=e}It.prototype={_radius:4.5,pointRadius:function(e){return this._radius=e,this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._context.closePath(),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._context.moveTo(e,t),this._point=1;break;case 1:this._context.lineTo(e,t);break;default:this._context.moveTo(e+this._radius,t),this._context.arc(e,t,this._radius,0,x)}},result:L};var Dt,zt,Bt,Lt,Gt,Tt=s(),Wt={point:L,lineStart:function(){Wt.point=qt},lineEnd:function(){Dt&&Ft(zt,Bt),Wt.point=L},polygonStart:function(){Dt=!0},polygonEnd:function(){Dt=null},result:function(){var e=+Tt;return Tt.reset(),e}};function qt(e,t){Wt.point=Ft,zt=Lt=e,Bt=Gt=t}function Ft(e,t){Lt-=e,Gt-=t,Tt.add(I(Lt*Lt+Gt*Gt)),Lt=e,Gt=t}function Vt(){this._string=[]}function Ht(e){return"m0,"+e+"a"+e+","+e+" 0 1,1 0,"+-2*e+"a"+e+","+e+" 0 1,1 0,"+2*e+"z"}function Yt(e,t){var n,r,a=4.5;function i(e){return e&&("function"==typeof a&&r.pointRadius(+a.apply(this,arguments)),V(e,n(r))),r.result()}return i.area=function(e){return V(e,n(tt)),tt.result()},i.measure=function(e){return V(e,n(Wt)),Wt.result()},i.bounds=function(e){return V(e,n(dt)),dt.result()},i.centroid=function(e){return V(e,n(Et)),Et.result()},i.projection=function(t){return arguments.length?(n=null==t?(e=null,Ke):(e=t).stream,i):e},i.context=function(e){return arguments.length?(r=null==e?(t=null,new Vt):new It(t=e),"function"!=typeof a&&r.pointRadius(a),i):t},i.pointRadius=function(e){return arguments.length?(a="function"==typeof e?e:(r.pointRadius(+e),+e),i):a},i.projection(e).context(t)}function $t(e){return function(t){var n=new Kt;for(var r in e)n[r]=e[r];return n.stream=t,n}}function Kt(){}function Xt(e,t,n){var r=e.clipExtent&&e.clipExtent();return e.scale(150).translate([0,0]),null!=r&&e.clipExtent(null),V(n,e.stream(dt)),t(dt.result()),null!=r&&e.clipExtent(r),e}function Ut(e,t,n){return Xt(e,function(n){var r=t[1][0]-t[0][0],a=t[1][1]-t[0][1],i=Math.min(r/(n[1][0]-n[0][0]),a/(n[1][1]-n[0][1])),f=+t[0][0]+(r-i*(n[1][0]+n[0][0]))/2,c=+t[0][1]+(a-i*(n[1][1]+n[0][1]))/2;e.scale(150*i).translate([f,c])},n)}function Zt(e,t,n){return Ut(e,[[0,0],t],n)}function Jt(e,t,n){return Xt(e,function(n){var r=+t,a=r/(n[1][0]-n[0][0]),i=(r-a*(n[1][0]+n[0][0]))/2,f=-a*n[0][1];e.scale(150*a).translate([i,f])},n)}function Qt(e,t,n){return Xt(e,function(n){var r=+t,a=r/(n[1][1]-n[0][1]),i=-a*n[0][0],f=(r-a*(n[1][1]+n[0][1]))/2;e.scale(150*a).translate([i,f])},n)}Vt.prototype={_radius:4.5,_circle:Ht(4.5),pointRadius:function(e){return(e=+e)!==this._radius&&(this._radius=e,this._circle=null),this},polygonStart:function(){this._line=0},polygonEnd:function(){this._line=NaN},lineStart:function(){this._point=0},lineEnd:function(){0===this._line&&this._string.push("Z"),this._point=NaN},point:function(e,t){switch(this._point){case 0:this._string.push("M",e,",",t),this._point=1;break;case 1:this._string.push("L",e,",",t);break;default:null==this._circle&&(this._circle=Ht(this._radius)),this._string.push("M",e,",",t,this._circle)}},result:function(){if(this._string.length){var e=this._string.join("");return this._string=[],e}return null}},Kt.prototype={constructor:Kt,point:function(e,t){this.stream.point(e,t)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};var en=16,tn=P(30*M);function nn(e,t){return+t?function(e,t){function n(r,a,i,f,c,o,u,d,l,s,h,b,p,v){var y=u-r,m=d-a,w=y*y+m*m;if(w>4*t&&p--){var x=f+s,S=c+h,M=o+b,k=I(x*x+S*S+M*M),P=B(M/=k),_=E(E(M)-1)t||E((y*j+m*O)/w-.5)>.3||f*s+c*h+o*b2?e[2]%360*M:0,C()):[g*S,v*S,y*S]},A.angle=function(e){return arguments.length?(m=e%360*M,C()):m*S},A.reflectX=function(e){return arguments.length?(w=e?-1:1,C()):w<0},A.reflectY=function(e){return arguments.length?(x=e?-1:1,C()):x<0},A.precision=function(e){return arguments.length?(f=nn(c,_=e*e),j()):I(_)},A.fitExtent=function(e,t){return Ut(A,e,t)},A.fitSize=function(e,t){return Zt(A,e,t)},A.fitWidth=function(e,t){return Jt(A,e,t)},A.fitHeight=function(e,t){return Qt(A,e,t)},function(){return t=e.apply(this,arguments),A.invert=t.invert&&R,C()}}function on(e){var t=0,n=y/3,r=cn(e),a=r(t,n);return a.parallels=function(e){return arguments.length?r(t=e[0]*M,n=e[1]*M):[t*S,n*S]},a}function un(e,t){var n=j(e),r=(n+j(t))/2;if(E(r)2?e[2]*M:0),t.invert=function(t){return(t=e.invert(t[0]*M,t[1]*M))[0]*=S,t[1]*=S,t},t}(a.rotate()).invert([0,0]));return o(null==u?[[c[0]-i,c[1]-i],[c[0]+i,c[1]+i]]:e===gn?[[Math.max(c[0]-i,u),t],[Math.min(c[0]+i,n),r]]:[[u,Math.max(c[1]-i,t)],[n,Math.min(c[1]+i,r)]])}return a.scale=function(e){return arguments.length?(f(e),d()):f()},a.translate=function(e){return arguments.length?(c(e),d()):c()},a.center=function(e){return arguments.length?(i(e),d()):i()},a.clipExtent=function(e){return arguments.length?(null==e?u=t=n=r=null:(u=+e[0][0],t=+e[0][1],n=+e[1][0],r=+e[1][1]),d()):null==u?null:[[u,t],[n,r]]},d()}function yn(e){return D((m+e)/2)}function mn(e,t){var n=P(e),r=e===t?j(e):R(n/P(t))/R(yn(t)/yn(e)),a=n*C(yn(e),r)/r;if(!r)return gn;function i(e,t){a>0?t<-m+g&&(t=-m+g):t>m-g&&(t=m-g);var n=a/C(yn(t),r);return[n*j(r*e),a-n*P(r*e)]}return i.invert=function(e,t){var n=a-t,i=O(r)*I(e*e+n*n),f=N(e,E(n))*O(n);return n*r<0&&(f-=y*O(e)*O(n)),[f/r,2*k(C(a/i,1/r))-m]},i}function wn(e,t){return[e,t]}function xn(e,t){var n=P(e),r=e===t?j(e):(n-P(t))/(t-e),a=n/r+e;if(E(r)g&&--a>0);return[e/(.8707+(i=r*r)*(i*(i*i*i*(.003971-.001529*i)-.013791)-.131979)),r]},Rn.invert=hn(B),Cn.invert=hn(function(e){return 2*k(e)}),jn.invert=function(e,t){return[-t,2*k(A(e))-m]};var In=function(e){c(r,e);var t=On(r);function r(){return n(this,r),t.apply(this,arguments)}return a(r,[{key:"inRange",value:function(e,t){var n,r,a=this.getBounds(),i=(Number.isNaN(e)||e>=a.x&&e<=a.x2)&&(Number.isNaN(t)||t>=a.y&&t<=a.y2),f=this.projectionScale.geoPath.projection();if(i&&!Number.isNaN(e)&&!Number.isNaN(t)&&"function"==typeof f.invert){var c=f.invert([e,t]);return c&&(n=this.feature,r=c,(n&&Be.hasOwnProperty(n.type)?Be[n.type]:Ge)(n,r))}return i}},{key:"inXRange",value:function(e){return this.inRange(e,Number.NaN)}},{key:"inYRange",value:function(e){return this.inRange(Number.NaN,e)}},{key:"getCenterPoint",value:function(){if(this.cache&&this.cache.center)return this.cache.center;var e=this.projectionScale.geoPath.centroid(this.feature),t={x:e[0],y:e[1]};return this.cache=Object.assign({},this.cache||{},{center:t}),t}},{key:"getBounds",value:function(){if(this.cache&&this.cache.bounds)return this.cache.bounds;var e=this.projectionScale.geoPath.bounds(this.feature),t={x:e[0][0],x2:e[1][0],y:e[0][1],y2:e[1][1],width:e[1][0]-e[0][0],height:e[1][1]-e[0][1]};return this.cache=Object.assign({},this.cache||{},{bounds:t}),t}},{key:"tooltipPosition",value:function(){return this.getCenterPoint()}},{key:"_drawInCache",value:function(e){var t=this.getBounds();if(Number.isFinite(t.x)){var n=this.cache&&this.cache.canvas?this.cache.canvas:e.createElement("canvas");n.width=Math.max(Math.ceil(t.width),1),n.height=Math.max(Math.ceil(t.height),1);var r=n.getContext("2d");r.clearRect(0,0,n.width,n.height),r.save(),r.translate(-t.x,-t.y),this._drawImpl(r),r.restore(),this.cache=Object.assign({},this.cache||{},{canvas:n,canvasKey:this._optionsToKey()})}}},{key:"_optionsToKey",value:function(){var e=this.options;return"".concat(e.backgroundColor,";").concat(e.borderColor,";").concat(e.borderWidth)}},{key:"_drawImpl",value:function(e){var t=this.options;e.beginPath(),this.projectionScale.geoPath.context(e)(this.feature),t.backgroundColor&&(e.fillStyle=t.backgroundColor,e.fill()),t.borderColor&&(e.strokeStyle=t.borderColor,e.lineWidth=t.borderWidth,e.stroke())}},{key:"draw",value:function(e){if(this.feature){this.cache&&this.cache.canvasKey===this._optionsToKey()||this._drawInCache(e.canvas.ownerDocument);var t=this.getBounds();this.cache&&this.cache.canvas?e.drawImage(this.cache.canvas,t.x,t.y,t.width,t.height):Number.isFinite(t.x)&&(e.save(),this._drawImpl(e),e.restore())}}}]),r}(t.Element);In.id="geoFeature",In.defaults=Object.assign({},t.Rectangle.defaults,{outlineBackgroundColor:null,outlineBorderWidth:0,graticuleBorderColor:"#CCCCCC",graticuleBorderWidth:0}),In.defaultRoutes=Object.assign({outlineBorderColor:"color"},t.Rectangle.defaultRoutes||{});var Dn=function(e,t){for(;!Object.prototype.hasOwnProperty.call(e,t)&&null!==(e=l(e)););return e},zn=i(function(e){function t(n,r,a){return"undefined"!=typeof Reflect&&Reflect.get?e.exports=t=Reflect.get:e.exports=t=function(e,t,n){var r=Dn(e,t);if(r){var a=Object.getOwnPropertyDescriptor(r,t);return a.get?a.get.call(n):a.value}},t(n,r,a||n)}e.exports=t});function Bn(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=l(e);if(t){var a=l(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return d(this,n)}}var Ln={geoAzimuthalEqualArea:function(){return fn(bn).scale(124.75).clipAngle(179.999)},geoAzimuthalEquidistant:function(){return fn(pn).scale(79.4188).clipAngle(179.999)},geoGnomonic:function(){return fn(_n).scale(144.049).clipAngle(60)},geoOrthographic:function(){return fn(Rn).scale(249.5).clipAngle(90+g)},geoStereographic:function(){return fn(Cn).scale(250).clipAngle(142)},geoEqualEarth:function(){return fn(Pn).scale(177.158)},geoAlbers:ln,geoAlbersUsa:function(){var e,t,n,r,a,i,f=ln(),c=dn().rotate([154,0]).center([-2,58.5]).parallels([55,65]),o=dn().rotate([157,0]).center([-3,19.9]).parallels([8,18]),u={point:function(e,t){i=[e,t]}};function d(e){var t=e[0],f=e[1];return i=null,n.point(t,f),i||(r.point(t,f),i)||(a.point(t,f),i)}function l(){return e=t=null,d}return d.invert=function(e){var t=f.scale(),n=f.translate(),r=(e[0]-n[0])/t,a=(e[1]-n[1])/t;return(a>=.12&&a<.234&&r>=-.425&&r<-.214?c:a>=.166&&a<.234&&r>=-.214&&r<-.115?o:f).invert(e)},d.stream=function(n){return e&&t===n?e:(r=[f.stream(t=n),c.stream(n),o.stream(n)],a=r.length,e={point:function(e,t){for(var n=-1;++n2?e[2]+90:90]):[(e=n())[0],e[1],e[2]-90]},n([0,0,90]).scale(159.155)},geoNaturalEarth1:function(){return fn(An).scale(175.295)}};Object.keys(Ln).forEach(function(e){Ln["".concat(e.charAt(3).toLowerCase()).concat(e.slice(4))]=Ln[e]});var Gn=function(e){c(r,e);var t=Bn(r);function r(e){var a;return n(this,r),(a=t.call(this,e)).geoPath=Yt(),a}return a(r,[{key:"init",value:function(e){e.position="chartArea",zn(l(r.prototype),"init",this).call(this,e),"string"==typeof this.options.projection&&"function"==typeof Ln[this.options.projection]?this.projection=Ln[this.options.projection]():this.projection=this.options.projection,this.geoPath.projection(this.projection)}},{key:"computeBounds",value:function(e){var t=Yt(this.projection.fitWidth(1e3,e)).bounds(e),n=Math.ceil(t[1][1]-t[0][1]),r=Math.ceil(t[1][0]-t[0][0]),a=this.projection.translate();this.outlineBounds={width:r,height:n,aspectRatio:r/n,refScale:this.projection.scale(),refX:a[0],refY:a[1]}}},{key:"updateBounds",value:function(){var e=this.chart.chartArea,t=this.outlineBounds,n=e.right-e.left,r=e.bottom-e.top,a=this.oldChartBounds;this.oldChartBounds={chartWidth:n,chartHeight:r};var i=Math.min(n/t.width,r/t.height),f=.5*(n-t.width*i),c=.5*(r-t.height*i);return this.projection.scale(t.refScale*i).translate([i*t.refX+f,i*t.refY+c]),!a||a.chartWidth!==this.oldChartBounds.chartWidth||a.chartHeight!==this.oldChartBounds.chartHeight}}]),r}(t.Scale);function Tn(e){for(var t=e.length/6|0,n=new Array(t),r=0;r>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===n?ir(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===n?ir(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=Kn.exec(e))?new or(t[1],t[2],t[3],1):(t=Xn.exec(e))?new or(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=Un.exec(e))?ir(t[1],t[2],t[3],t[4]):(t=Zn.exec(e))?ir(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=Jn.exec(e))?sr(t[1],t[2]/100,t[3]/100,1):(t=Qn.exec(e))?sr(t[1],t[2]/100,t[3]/100,t[4]):er.hasOwnProperty(e)?ar(er[e]):"transparent"===e?new or(NaN,NaN,NaN,0):null}function ar(e){return new or(e>>16&255,e>>8&255,255&e,1)}function ir(e,t,n,r){return r<=0&&(e=t=n=NaN),new or(e,t,n,r)}function fr(e){return e instanceof Fn||(e=rr(e)),e?new or((e=e.rgb()).r,e.g,e.b,e.opacity):new or}function cr(e,t,n,r){return 1===arguments.length?fr(e):new or(e,t,n,null==r?1:r)}function or(e,t,n,r){this.r=+e,this.g=+t,this.b=+n,this.opacity=+r}function ur(){return"#"+lr(this.r)+lr(this.g)+lr(this.b)}function dr(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"rgb(":"rgba(")+Math.max(0,Math.min(255,Math.round(this.r)||0))+", "+Math.max(0,Math.min(255,Math.round(this.g)||0))+", "+Math.max(0,Math.min(255,Math.round(this.b)||0))+(1===e?")":", "+e+")")}function lr(e){return((e=Math.max(0,Math.min(255,Math.round(e)||0)))<16?"0":"")+e.toString(16)}function sr(e,t,n,r){return r<=0?e=t=n=NaN:n<=0||n>=1?e=t=NaN:t<=0&&(e=NaN),new br(e,t,n,r)}function hr(e){if(e instanceof br)return new br(e.h,e.s,e.l,e.opacity);if(e instanceof Fn||(e=rr(e)),!e)return new br;if(e instanceof br)return e;var t=(e=e.rgb()).r/255,n=e.g/255,r=e.b/255,a=Math.min(t,n,r),i=Math.max(t,n,r),f=NaN,c=i-a,o=(i+a)/2;return c?(f=t===i?(n-r)/c+6*(n0&&o<1?0:f,new br(f,c,o,e.opacity)}function br(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function pr(e,t,n){return 255*(e<60?t+(n-t)*e/60:e<180?n:e<240?t+(n-t)*(240-e)/60:t)}Wn(Fn,rr,{copy:function(e){return Object.assign(new this.constructor,this,e)},displayable:function(){return this.rgb().displayable()},hex:tr,formatHex:tr,formatHsl:function(){return hr(this).formatHsl()},formatRgb:nr,toString:nr}),Wn(or,cr,qn(Fn,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new or(this.r*e,this.g*e,this.b*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new or(this.r*e,this.g*e,this.b*e,this.opacity)},rgb:function(){return this},displayable:function(){return-.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:ur,formatHex:ur,formatRgb:dr,toString:dr})),Wn(br,function(e,t,n,r){return 1===arguments.length?hr(e):new br(e,t,n,null==r?1:r)},qn(Fn,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new br(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new br(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=this.h%360+360*(this.h<0),t=isNaN(e)||isNaN(this.s)?0:this.s,n=this.l,r=n+(n<.5?n:1-n)*t,a=2*n-r;return new or(pr(e>=240?e-240:e+120,a,r),pr(e,a,r),pr(e<120?e+240:e-120,a,r),this.opacity)},displayable:function(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl:function(){var e=this.opacity;return(1===(e=isNaN(e)?1:Math.max(0,Math.min(1,e)))?"hsl(":"hsla(")+(this.h||0)+", "+100*(this.s||0)+"%, "+100*(this.l||0)+"%"+(1===e?")":", "+e+")")}}));var gr=Math.PI/180,vr=180/Math.PI,yr=-.14861,mr=1.78277,wr=-.29227,xr=-.90649,Sr=1.97294,Mr=Sr*xr,Er=Sr*mr,kr=mr*wr-xr*yr;function Nr(e,t,n,r){return 1===arguments.length?function(e){if(e instanceof Pr)return new Pr(e.h,e.s,e.l,e.opacity);e instanceof or||(e=fr(e));var t=e.r/255,n=e.g/255,r=e.b/255,a=(kr*r+Mr*t-Er*n)/(kr+Mr-Er),i=r-a,f=(Sr*(n-a)-wr*i)/xr,c=Math.sqrt(f*f+i*i)/(Sr*a*(1-a)),o=c?Math.atan2(f,i)*vr-120:NaN;return new Pr(o<0?o+360:o,c,a,e.opacity)}(e):new Pr(e,t,n,null==r?1:r)}function Pr(e,t,n,r){this.h=+e,this.s=+t,this.l=+n,this.opacity=+r}function _r(e){return function(){return e}}function Ar(e,t){return function(n){return e+n*t}}function Rr(e,t){var n=t-e;return n?Ar(e,n):_r(isNaN(e)?t:e)}Wn(Pr,Nr,qn(Fn,{brighter:function(e){return e=null==e?1/.7:Math.pow(1/.7,e),new Pr(this.h,this.s,this.l*e,this.opacity)},darker:function(e){return e=null==e?.7:Math.pow(.7,e),new Pr(this.h,this.s,this.l*e,this.opacity)},rgb:function(){var e=isNaN(this.h)?0:(this.h+120)*gr,t=+this.l,n=isNaN(this.s)?0:this.s*t*(1-t),r=Math.cos(e),a=Math.sin(e);return new or(255*(t+n*(yr*r+mr*a)),255*(t+n*(wr*r+xr*a)),255*(t+n*(Sr*r)),this.opacity)}}));var Cr,jr=(Cr=function(e){var t=e.length-1;return function(n){var r=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),a=e[r],i=e[r+1],f=r>0?e[r-1]:2*a-i,c=r180||n<-180?n-360*Math.round(n/360):n):_r(isNaN(e)?t:e)});var Ir=Or(Rr);function Dr(e){return jr(e[e.length-1])}var zr=Dr(new Array(3).concat("d8b365f5f5f55ab4ac","a6611adfc27d80cdc1018571","a6611adfc27df5f5f580cdc1018571","8c510ad8b365f6e8c3c7eae55ab4ac01665e","8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e","8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e","8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e","5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30","5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30").map(Tn)),Br=Dr(new Array(3).concat("af8dc3f7f7f77fbf7b","7b3294c2a5cfa6dba0008837","7b3294c2a5cff7f7f7a6dba0008837","762a83af8dc3e7d4e8d9f0d37fbf7b1b7837","762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837","762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837","762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837","40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b","40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b").map(Tn)),Lr=Dr(new Array(3).concat("e9a3c9f7f7f7a1d76a","d01c8bf1b6dab8e1864dac26","d01c8bf1b6daf7f7f7b8e1864dac26","c51b7de9a3c9fde0efe6f5d0a1d76a4d9221","c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221","c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221","c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221","8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419","8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419").map(Tn)),Gr=Dr(new Array(3).concat("998ec3f7f7f7f1a340","5e3c99b2abd2fdb863e66101","5e3c99b2abd2f7f7f7fdb863e66101","542788998ec3d8daebfee0b6f1a340b35806","542788998ec3d8daebf7f7f7fee0b6f1a340b35806","5427888073acb2abd2d8daebfee0b6fdb863e08214b35806","5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806","2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08","2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08").map(Tn)),Tr=Dr(new Array(3).concat("ef8a62f7f7f767a9cf","ca0020f4a58292c5de0571b0","ca0020f4a582f7f7f792c5de0571b0","b2182bef8a62fddbc7d1e5f067a9cf2166ac","b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac","b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac","b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac","67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061","67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061").map(Tn)),Wr=Dr(new Array(3).concat("ef8a62ffffff999999","ca0020f4a582bababa404040","ca0020f4a582ffffffbababa404040","b2182bef8a62fddbc7e0e0e09999994d4d4d","b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d","b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d","b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d","67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a","67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a").map(Tn)),qr=Dr(new Array(3).concat("fc8d59ffffbf91bfdb","d7191cfdae61abd9e92c7bb6","d7191cfdae61ffffbfabd9e92c7bb6","d73027fc8d59fee090e0f3f891bfdb4575b4","d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4","d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4","d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4","a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695","a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695").map(Tn)),Fr=Dr(new Array(3).concat("fc8d59ffffbf91cf60","d7191cfdae61a6d96a1a9641","d7191cfdae61ffffbfa6d96a1a9641","d73027fc8d59fee08bd9ef8b91cf601a9850","d73027fc8d59fee08bffffbfd9ef8b91cf601a9850","d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850","d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850","a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837","a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837").map(Tn)),Vr=Dr(new Array(3).concat("fc8d59ffffbf99d594","d7191cfdae61abdda42b83ba","d7191cfdae61ffffbfabdda42b83ba","d53e4ffc8d59fee08be6f59899d5943288bd","d53e4ffc8d59fee08bffffbfe6f59899d5943288bd","d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd","d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd","9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2","9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2").map(Tn)),Hr=Dr(new Array(3).concat("e5f5f999d8c92ca25f","edf8fbb2e2e266c2a4238b45","edf8fbb2e2e266c2a42ca25f006d2c","edf8fbccece699d8c966c2a42ca25f006d2c","edf8fbccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824","f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b").map(Tn)),Yr=Dr(new Array(3).concat("e0ecf49ebcda8856a7","edf8fbb3cde38c96c688419d","edf8fbb3cde38c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68856a7810f7c","edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b","f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b").map(Tn)),$r=Dr(new Array(3).concat("e0f3dba8ddb543a2ca","f0f9e8bae4bc7bccc42b8cbe","f0f9e8bae4bc7bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc443a2ca0868ac","f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e","f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081").map(Tn)),Kr=Dr(new Array(3).concat("fee8c8fdbb84e34a33","fef0d9fdcc8afc8d59d7301f","fef0d9fdcc8afc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59e34a33b30000","fef0d9fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000","fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000").map(Tn)),Xr=Dr(new Array(3).concat("ece2f0a6bddb1c9099","f6eff7bdc9e167a9cf02818a","f6eff7bdc9e167a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf1c9099016c59","f6eff7d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450","fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636").map(Tn)),Ur=Dr(new Array(3).concat("ece7f2a6bddb2b8cbe","f1eef6bdc9e174a9cf0570b0","f1eef6bdc9e174a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d","f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b","fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858").map(Tn)),Zr=Dr(new Array(3).concat("e7e1efc994c7dd1c77","f1eef6d7b5d8df65b0ce1256","f1eef6d7b5d8df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0dd1c77980043","f1eef6d4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f","f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f").map(Tn)),Jr=Dr(new Array(3).concat("fde0ddfa9fb5c51b8a","feebe2fbb4b9f768a1ae017e","feebe2fbb4b9f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1c51b8a7a0177","feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177","fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a").map(Tn)),Qr=Dr(new Array(3).concat("edf8b17fcdbb2c7fb8","ffffcca1dab441b6c4225ea8","ffffcca1dab441b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c42c7fb8253494","ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84","ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58").map(Tn)),ea=Dr(new Array(3).concat("f7fcb9addd8e31a354","ffffccc2e69978c679238443","ffffccc2e69978c67931a354006837","ffffccd9f0a3addd8e78c67931a354006837","ffffccd9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32","ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529").map(Tn)),ta=Dr(new Array(3).concat("fff7bcfec44fd95f0e","ffffd4fed98efe9929cc4c02","ffffd4fed98efe9929d95f0e993404","ffffd4fee391fec44ffe9929d95f0e993404","ffffd4fee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04","ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506").map(Tn)),na=Dr(new Array(3).concat("ffeda0feb24cf03b20","ffffb2fecc5cfd8d3ce31a1c","ffffb2fecc5cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cf03b20bd0026","ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026","ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026").map(Tn)),ra=Dr(new Array(3).concat("deebf79ecae13182bd","eff3ffbdd7e76baed62171b5","eff3ffbdd7e76baed63182bd08519c","eff3ffc6dbef9ecae16baed63182bd08519c","eff3ffc6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594","f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b").map(Tn)),aa=Dr(new Array(3).concat("e5f5e0a1d99b31a354","edf8e9bae4b374c476238b45","edf8e9bae4b374c47631a354006d2c","edf8e9c7e9c0a1d99b74c47631a354006d2c","edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32","f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b").map(Tn)),ia=Dr(new Array(3).concat("f0f0f0bdbdbd636363","f7f7f7cccccc969696525252","f7f7f7cccccc969696636363252525","f7f7f7d9d9d9bdbdbd969696636363252525","f7f7f7d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525","fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000").map(Tn)),fa=Dr(new Array(3).concat("efedf5bcbddc756bb1","f2f0f7cbc9e29e9ac86a51a3","f2f0f7cbc9e29e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8756bb154278f","f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486","fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d").map(Tn)),ca=Dr(new Array(3).concat("fee0d2fc9272de2d26","fee5d9fcae91fb6a4acb181d","fee5d9fcae91fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4ade2d26a50f15","fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d","fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d").map(Tn)),oa=Dr(new Array(3).concat("fee6cefdae6be6550d","feeddefdbe85fd8d3cd94701","feeddefdbe85fd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3ce6550da63603","feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04","fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704").map(Tn));var ua=Ir(Nr(300,.5,0),Nr(-240,.5,1)),da=Ir(Nr(-100,.75,.35),Nr(80,1.5,.8)),la=Ir(Nr(260,.75,.35),Nr(80,1.5,.8)),sa=Nr();var ha=cr(),ba=Math.PI/3,pa=2*Math.PI/3;function ga(e){var t=e.length;return function(n){return e[Math.max(0,Math.min(t-1,Math.floor(n*t)))]}}var va=ga(Tn("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")),ya=ga(Tn("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf"));function ma(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=l(e);if(t){var a=l(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return d(this,n)}}var wa={position:"chartArea",property:"value",gridLines:{drawOnChartArea:!1},legend:{align:"right",position:"bottom-right",length:100,width:50,margin:8,indicatorWidth:10}};function xa(e){return function(t){c(i,e);var r=ma(i);function i(){return n(this,i),r.apply(this,arguments)}return a(i,[{key:"init",value:function(e){e.position="chartArea",zn(l(i.prototype),"init",this).call(this,e),this.axis="r"}},{key:"parse",value:function(e,t){return e&&"number"==typeof e[this.options.property]?e[this.options.property]:zn(l(i.prototype),"parse",this).call(this,e,t)}},{key:"isHorizontal",value:function(){return"top"===this.options.legend.align||"bottom"===this.options.legend.align}},{key:"_getNormalizedValue",value:function(e){return null==e||Number.isNaN(e)?null:(e-this._startValue)/this._valueRange}},{key:"_getLegendMargin",value:function(){var e=this.options.legend.indicatorWidth,t=this.options.legend.align,n=this.options.legend.margin;return{left:("number"==typeof n?n:n.left)+("right"===t?e:0),top:("number"==typeof n?n:n.top)+("bottom"===t?e:0),right:("number"==typeof n?n:n.right)+("left"===t?e:0),bottom:("number"==typeof n?n:n.bottom)+("top"===t?e:0)}}},{key:"_getLegendPosition",value:function(e){var t=this.options.legend.indicatorWidth,n=this.options.legend.align,r=this.isHorizontal(),a=("left"===n?this.legendSize.w:this.width)+(r?t:0),i=("top"===n?this.legendSize.h:this.height)+(r?0:t),f=this._getLegendMargin(),c=this.options.legend.position;if("string"==typeof c)switch(c){case"top-left":return[f.left,f.top];case"top":return[(e.right-a)/2,f.top];case"left":return[f.left,(e.bottom-i)/2];case"top-right":return[e.right-a-f.right,f.top];case"bottom-right":return[e.right-a-f.right,e.bottom-i-f.bottom];case"bottom":return[(e.right-a)/2,e.bottom-i-f.bottom];case"bottom-left":return[f.left,e.bottom-i-f.bottom];default:return[e.right-a-f.right,(e.bottom-i)/2]}return[c.x,c.y]}},{key:"update",value:function(e,t,n){var r=Math.min(t,null==this.bottom?Number.POSITIVE_INFINITY:this.bottom),a=Math.min(e,null==this.right?Number.POSITIVE_INFINITY:this.right),f=this.options.legend,c=this.isHorizontal(),o=function(e,t){return e<1?t*e:e},u=Math.min(a,o(c?f.length:f.width,a))-(c?0:f.indicatorWidth),d=Math.min(r,o(c?f.width:f.length,r))-(c?f.indicatorWidth:0);this.legendSize={w:u,h:d},this.bottom=this.height=d,this.right=this.width=u;var s=this.options.position;this.options.position=this.options.legend.align,zn(l(i.prototype),"update",this).call(this,u,d,n),this.options.position=s,this.height=Math.min(d,this.height),this.width=Math.min(u,this.width)}},{key:"draw",value:function(e){if(this._isVisible()){var t=this._getLegendPosition(e),n=this.ctx;n.save(),n.translate(t[0],t[1]);var r=this.options.position;this.options.position=this.options.legend.align,zn(l(i.prototype),"draw",this).call(this,Object.assign({},e,{bottom:this.height,right:this.width})),this.options.position=r;var a=this.options.legend.indicatorWidth;switch(this.options.legend.align){case"left":n.translate(this.legendSize.w,0);break;case"top":n.translate(0,this.legendSize.h);break;case"bottom":n.translate(0,-a);break;default:n.translate(-a,0)}this._drawIndicator(),n.restore()}}}]),i}()}function Sa(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=l(e);if(t){var a=l(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return d(this,n)}}var Ma={interpolateBlues:ra,interpolateBrBG:zr,interpolateBuGn:Hr,interpolateBuPu:Yr,interpolateCividis:function(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(-4.54-e*(35.34-e*(2381.73-e*(6402.7-e*(7024.72-2710.57*e)))))))+", "+Math.max(0,Math.min(255,Math.round(32.49+e*(170.73+e*(52.82-e*(131.46-e*(176.58-67.37*e)))))))+", "+Math.max(0,Math.min(255,Math.round(81.24+e*(442.36-e*(2482.43-e*(6167.24-e*(6614.94-2475.67*e)))))))+")"},interpolateCool:la,interpolateCubehelixDefault:ua,interpolateGnBu:$r,interpolateGreens:aa,interpolateGreys:ia,interpolateInferno:ga(Tn("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")),interpolateMagma:ya,interpolateOrRd:Kr,interpolateOranges:oa,interpolatePRGn:Br,interpolatePiYG:Lr,interpolatePlasma:ga(Tn("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")),interpolatePuBu:Ur,interpolatePuBuGn:Xr,interpolatePuOr:Gr,interpolatePuRd:Zr,interpolatePurples:fa,interpolateRainbow:function(e){(e<0||e>1)&&(e-=Math.floor(e));var t=Math.abs(e-.5);return sa.h=360*e-100,sa.s=1.5-1.5*t,sa.l=.8-.9*t,sa+""},interpolateRdBu:Tr,interpolateRdGy:Wr,interpolateRdPu:Jr,interpolateRdYlBu:qr,interpolateRdYlGn:Fr,interpolateReds:ca,interpolateSinebow:function(e){var t;return e=(.5-e)*Math.PI,ha.r=255*(t=Math.sin(e))*t,ha.g=255*(t=Math.sin(e+ba))*t,ha.b=255*(t=Math.sin(e+pa))*t,ha+""},interpolateSpectral:Vr,interpolateTurbo:function(e){return e=Math.max(0,Math.min(1,e)),"rgb("+Math.max(0,Math.min(255,Math.round(34.61+e*(1172.33-e*(10793.56-e*(33300.12-e*(38394.49-14825.05*e)))))))+", "+Math.max(0,Math.min(255,Math.round(23.31+e*(557.33+e*(1225.33-e*(3574.96-e*(1073.77+707.56*e)))))))+", "+Math.max(0,Math.min(255,Math.round(27.2+e*(3211.1-e*(15327.97-e*(27814-e*(22569.18-6838.66*e)))))))+")"},interpolateViridis:va,interpolateWarm:da,interpolateYlGn:ea,interpolateYlGnBu:Qr,interpolateYlOrBr:ta,interpolateYlOrRd:na};function Ea(e){return function(e){c(r,e);var t=Sa(r);function r(){return n(this,r),t.apply(this,arguments)}return a(r,[{key:"init",value:function(e){zn(l(r.prototype),"init",this).call(this,e),"string"==typeof this.options.interpolate&&"function"==typeof Ma[this.options.interpolate]?this.interpolate=Ma[this.options.interpolate]:this.interpolate=this.options.interpolate}},{key:"getColorForValue",value:function(e){var t=this._getNormalizedValue(e);return null==t||Number.isNaN(t)?this.options.missing:this.getColor(t)}},{key:"getColor",value:function(e){var t=e;return this.options.quantize>0&&(t=function(e,t){var n=1/t;if(e<=n)return 0;if(e>=1-n)return 1;for(var r=0;r<1;r+=n)if(e0)for(var i=t/this.options.quantize,f=a?function(e){return t-i-e}:function(e){return e},c=0;c0)for(var l=n/this.options.quantize,s=a?function(e){return n-l-e}:function(e){return e},h=0;he.length)&&(t=e.length);for(var n=0,r=new Array(t);n2&&void 0!==arguments[2]?arguments[2]:[],a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:[];return t.registry.addControllers(n),t.registry.addElements(r),t.registry.addScales(a),e.type=n.id,e}function Ha(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch(e){return!1}}();return function(){var n,r=l(e);if(t){var a=l(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return d(this,n)}}var Ya=function(e){c(r,Fa);var t=Ha(r);function r(){return n(this,r),t.apply(this,arguments)}return a(r,[{key:"linkScales",value:function(){zn(l(r.prototype),"linkScales",this).call(this);var e=this.getDataset(),t=this.getMeta();t.vAxisID=t.rAxisID="color",e.vAxisID=e.rAxisID="color",t.rScale=this.getScaleForId("color"),t.vScale=t.rScale,t.iScale=t.xScale,t.iAxisID=e.iAxisID=t.xAxisID}},{key:"parse",value:function(e,t){for(var n=this.getMeta().rScale,r=this.getDataset().data,a=this._cachedMeta,i=e;ii&&(i=e[0]),e[1]f&&(f=e[1])}function o(e){switch(e.type){case"GeometryCollection":e.geometries.forEach(o);break;case"Point":c(e.coordinates);break;case"MultiPoint":e.coordinates.forEach(c)}}for(t in e.arcs.forEach(function(e){for(var t,c=-1,o=e.length;++ci&&(i=t[0]),t[1]f&&(f=t[1])}),e.objects)o(e.objects[t]);return[r,a,i,f]}function ei(e,t){var n=t.id,r=t.bbox,a=null==t.properties?{}:t.properties,i=ti(e,t);return null==n&&null==r?{type:"Feature",properties:a,geometry:i}:null==r?{type:"Feature",id:n,properties:a,geometry:i}:{type:"Feature",id:n,bbox:r,properties:a,geometry:i}}function ti(e,t){var n=Ja(e.transform),r=e.arcs;function a(e,t){t.length&&t.pop();for(var a=r[e<0?~e:e],i=0,f=a.length;i1)r=function(e,t,n){var r,a=[],i=[];function f(e){var t=e<0?~e:e;(i[t]||(i[t]=[])).push({i:e,g:r})}function c(e){e.forEach(f)}function o(e){e.forEach(c)}return function e(t){switch(r=t,t.type){case"GeometryCollection":t.geometries.forEach(e);break;case"LineString":c(t.arcs);break;case"MultiLineString":case"Polygon":o(t.arcs);break;case"MultiPolygon":t.arcs.forEach(o)}}(t),i.forEach(null==n?function(e){a.push(e[0].i)}:function(e){n(e[0].g,e[e.length-1].g)&&a.push(e[0].i)}),a}(0,t,n);else for(a=0,r=new Array(i=e.arcs.length);a1)for(var i,c,o=1,u=f(a[0]);ou&&(c=a[0],a[0]=a[o],a[o]=c,u=i);return a}).filter(function(e){return e.length>0})}}function ii(e,t){for(var n=0,r=e.length;n>>1;e[a]=2))throw new Error("n must be ≥2");var n,r=(c=e.bbox||Qa(e))[0],a=c[1],i=c[2],f=c[3];t={scale:[i-r?(i-r)/(n-1):1,f-a?(f-a)/(n-1):1],translate:[r,a]}}var c,o,u=fi(t),d=e.objects,l={};function s(e){return u(e)}function h(e){var t;switch(e.type){case"GeometryCollection":t={type:"GeometryCollection",geometries:e.geometries.map(h)};break;case"Point":t={type:"Point",coordinates:s(e.coordinates)};break;case"MultiPoint":t={type:"MultiPoint",coordinates:e.coordinates.map(s)};break;default:return e}return null!=e.id&&(t.id=e.id),null!=e.bbox&&(t.bbox=e.bbox),null!=e.properties&&(t.properties=e.properties),t}for(o in d)l[o]=h(d[o]);return{type:"Topology",bbox:c,transform:t,objects:l,arcs:e.arcs.map(function(e){var t,n=0,r=1,a=e.length,i=new Array(a);for(i[0]=u(e[0],0);++n (originalExternal(v) ? external.includes(v) : false); + const external = Object.keys(pkg.peerDependencies || {}); + config.external = (v) => external.includes(v); } else { const external = Object.keys(pkg.dependencies || {}).concat(Object.keys(pkg.peerDependencies || {})); - config.external = (v) => (originalExternal(v) ? external.includes(v) : false); + config.external = (v) => external.includes(v); } const c = config.plugins.findIndex((d) => d.name === 'commonjs'); @@ -32,6 +31,7 @@ module.exports = { cleanup({ comments: ['some', 'ts', 'ts3s'], extensions: ['ts', 'tsx', 'js', 'jsx'], + include: './src/**/*', }) ); config.output.banner = `/** diff --git a/yarn.lock b/yarn.lock index aef09c0..c7de450 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1974,25 +1974,17 @@ __metadata: languageName: node linkType: hard -"@sgratzl/chartjs-esm-facade@portal:/D:/w/chartjs/chartjs-esm-facade::locator=chartjs-chart-geo%40workspace%3A.": - version: 0.0.0-use.local - resolution: "@sgratzl/chartjs-esm-facade@portal:/D:/w/chartjs/chartjs-esm-facade::locator=chartjs-chart-geo%40workspace%3A." - dependencies: - "@yarnpkg/pnpify": ^2.0.0-rc.22 - chart.js: ^3.0.0-alpha.2 - eslint: ^7.0.0 - eslint-config-prettier: ^6.11.0 - eslint-plugin-prettier: ^3.1.3 - prettier: ^2.0.5 - release-it: ^13.6.0 - rimraf: ^3.0.2 +"@sgratzl/chartjs-esm-facade@npm:^3.0.0-alpha.20": + version: 3.0.0-alpha.21 + resolution: "@sgratzl/chartjs-esm-facade@npm:3.0.0-alpha.21" peerDependencies: chart.js: ^3.0.0-alpha.2 dependenciesMeta: chart.js: unplugged: true + checksum: 402815b1b7daaa20940b62e0fa97071661b52e38525c70f1edbc09c71869f833ac340a902a7fce69cf3556dafd632f5e9a98cd164493fa28e8cfc3f480971455 languageName: node - linkType: soft + linkType: hard "@sindresorhus/is@npm:^0.14.0": version: 0.14.0 @@ -2627,7 +2619,7 @@ __metadata: languageName: node linkType: hard -"@yarnpkg/pnpify@npm:^2.0.0-rc.22, @yarnpkg/pnpify@npm:^2.1.0": +"@yarnpkg/pnpify@npm:^2.1.0": version: 2.1.0 resolution: "@yarnpkg/pnpify@npm:2.1.0" dependencies: @@ -3802,7 +3794,7 @@ __metadata: us-atlas: ^3.0.0 world-atlas: ^2.0.2 peerDependencies: - "@sgratzl/chartjs-esm-facade": ^3.0.0-alpha.20 + "@sgratzl/chartjs-esm-facade": ^3.0.0-alpha.21 chart.js: ^3.0.0-alpha.2 dependenciesMeta: d3-geo: @@ -3875,13 +3867,6 @@ __metadata: languageName: node linkType: hard -"cli-spinners@npm:^2.2.0": - version: 2.3.0 - resolution: "cli-spinners@npm:2.3.0" - checksum: f2cb86cf2a413a101c0adbab5ad93025d9d16a148fc312fdc2bf7b5344ee4315bc88012eea5bd9b15adc158e54d70405a4234d644aab336e4db64f2f426bf263 - languageName: node - linkType: hard - "cli-width@npm:^3.0.0": version: 3.0.0 resolution: "cli-width@npm:3.0.0" @@ -4110,29 +4095,29 @@ __metadata: languageName: node linkType: hard -"cosmiconfig@npm:6.0.0, cosmiconfig@npm:^6.0.0": - version: 6.0.0 - resolution: "cosmiconfig@npm:6.0.0" +"cosmiconfig@npm:7.0.0": + version: 7.0.0 + resolution: "cosmiconfig@npm:7.0.0" dependencies: "@types/parse-json": ^4.0.0 - import-fresh: ^3.1.0 + import-fresh: ^3.2.1 parse-json: ^5.0.0 path-type: ^4.0.0 - yaml: ^1.7.2 - checksum: bbd6bbaefe15938107da21f2b5f2d5ede75c7ed4bca5af904d91987c59b050ac95f5e786d9021e16959e0119b36174b190f6040a1daf6fddc75361ab123c0d45 + yaml: ^1.10.0 + checksum: 151fcb91773c0ae826fc801eab86f8f818605dbf63c8e5515adf0ff0fec5ede8e614f387f93c088d65527a2ea9021f0cd8c6b6e5c7fef2b77480b5e2c33700dc languageName: node linkType: hard -"cosmiconfig@npm:7.0.0": - version: 7.0.0 - resolution: "cosmiconfig@npm:7.0.0" +"cosmiconfig@npm:^6.0.0": + version: 6.0.0 + resolution: "cosmiconfig@npm:6.0.0" dependencies: "@types/parse-json": ^4.0.0 - import-fresh: ^3.2.1 + import-fresh: ^3.1.0 parse-json: ^5.0.0 path-type: ^4.0.0 - yaml: ^1.10.0 - checksum: 151fcb91773c0ae826fc801eab86f8f818605dbf63c8e5515adf0ff0fec5ede8e614f387f93c088d65527a2ea9021f0cd8c6b6e5c7fef2b77480b5e2c33700dc + yaml: ^1.7.2 + checksum: bbd6bbaefe15938107da21f2b5f2d5ede75c7ed4bca5af904d91987c59b050ac95f5e786d9021e16959e0119b36174b190f6040a1daf6fddc75361ab123c0d45 languageName: node linkType: hard @@ -4858,7 +4843,7 @@ __metadata: languageName: node linkType: hard -"eslint-plugin-prettier@npm:^3.1.0, eslint-plugin-prettier@npm:^3.1.3, eslint-plugin-prettier@npm:^3.1.4": +"eslint-plugin-prettier@npm:^3.1.0, eslint-plugin-prettier@npm:^3.1.4": version: 3.1.4 resolution: "eslint-plugin-prettier@npm:3.1.4" dependencies: @@ -5019,52 +5004,6 @@ __metadata: languageName: node linkType: hard -"eslint@npm:^7.0.0": - version: 7.5.0 - resolution: "eslint@npm:7.5.0" - dependencies: - "@babel/code-frame": ^7.0.0 - ajv: ^6.10.0 - chalk: ^4.0.0 - cross-spawn: ^7.0.2 - debug: ^4.0.1 - doctrine: ^3.0.0 - enquirer: ^2.3.5 - eslint-scope: ^5.1.0 - eslint-utils: ^2.1.0 - eslint-visitor-keys: ^1.3.0 - espree: ^7.2.0 - esquery: ^1.2.0 - esutils: ^2.0.2 - file-entry-cache: ^5.0.1 - functional-red-black-tree: ^1.0.1 - glob-parent: ^5.0.0 - globals: ^12.1.0 - ignore: ^4.0.6 - import-fresh: ^3.0.0 - imurmurhash: ^0.1.4 - is-glob: ^4.0.0 - js-yaml: ^3.13.1 - json-stable-stringify-without-jsonify: ^1.0.1 - levn: ^0.4.1 - lodash: ^4.17.19 - minimatch: ^3.0.4 - natural-compare: ^1.4.0 - optionator: ^0.9.1 - progress: ^2.0.0 - regexpp: ^3.1.0 - semver: ^7.2.1 - strip-ansi: ^6.0.0 - strip-json-comments: ^3.1.0 - table: ^5.2.3 - text-table: ^0.2.0 - v8-compile-cache: ^2.0.3 - bin: - eslint: bin/eslint.js - checksum: 5a65f133db997f39e48082636496e11db168c7385839111b2ecbb9d4fa16d9eaeae9a88f0317ddcc5118fe388c2907ab0f302c752fb36e56ace6e3660070ea42 - languageName: node - linkType: hard - "eslint@npm:^7.7.0": version: 7.7.0 resolution: "eslint@npm:7.7.0" @@ -5473,16 +5412,6 @@ __metadata: languageName: node linkType: hard -"find-up@npm:4.1.0, find-up@npm:^4.0.0, find-up@npm:^4.1.0": - version: 4.1.0 - resolution: "find-up@npm:4.1.0" - dependencies: - locate-path: ^5.0.0 - path-exists: ^4.0.0 - checksum: d612d28e02eaca6cd7128fc9bc9b456e2547a3f9875b2b2ae2dbdc6b8cec52bc2885efcb3ac6c18954e838f4c8e20565d196784b190e1d38565f9dc39aade722 - languageName: node - linkType: hard - "find-up@npm:5.0.0": version: 5.0.0 resolution: "find-up@npm:5.0.0" @@ -5511,6 +5440,16 @@ __metadata: languageName: node linkType: hard +"find-up@npm:^4.0.0, find-up@npm:^4.1.0": + version: 4.1.0 + resolution: "find-up@npm:4.1.0" + dependencies: + locate-path: ^5.0.0 + path-exists: ^4.0.0 + checksum: d612d28e02eaca6cd7128fc9bc9b456e2547a3f9875b2b2ae2dbdc6b8cec52bc2885efcb3ac6c18954e838f4c8e20565d196784b190e1d38565f9dc39aade722 + languageName: node + linkType: hard + "flat-cache@npm:^2.0.1": version: 2.0.1 resolution: "flat-cache@npm:2.0.1" @@ -5764,15 +5703,6 @@ fsevents@^1.2.7: languageName: node linkType: hard -"git-url-parse@npm:11.1.2": - version: 11.1.2 - resolution: "git-url-parse@npm:11.1.2" - dependencies: - git-up: ^4.0.0 - checksum: 01d5ab08c08103878905f919a71ecc6c0cc6321b833b92f9cb3acbd034b9a67e4b503163f966bc0dbab05a9d07077845586034b751b4d22cd491b0e56813be8d - languageName: node - linkType: hard - "git-url-parse@npm:11.1.3": version: 11.1.3 resolution: "git-url-parse@npm:11.1.3" @@ -5888,25 +5818,6 @@ fsevents@^1.2.7: languageName: node linkType: hard -"got@npm:11.5.1": - version: 11.5.1 - resolution: "got@npm:11.5.1" - dependencies: - "@sindresorhus/is": ^3.0.0 - "@szmarczak/http-timer": ^4.0.5 - "@types/cacheable-request": ^6.0.1 - "@types/responselike": ^1.0.0 - cacheable-lookup: ^5.0.3 - cacheable-request: ^7.0.1 - decompress-response: ^6.0.0 - http2-wrapper: ^1.0.0-beta.5.0 - lowercase-keys: ^2.0.0 - p-cancelable: ^2.0.0 - responselike: ^2.0.0 - checksum: a746db1245438bfcdf97f093070dfb7fd731d7ba2d4be8eb505504dfb83def90f977688fb9c0fda879e261d2b2b641e915dd895d9d93a44a388dfe622b8a749d - languageName: node - linkType: hard - "got@npm:11.5.2": version: 11.5.2 resolution: "got@npm:11.5.2" @@ -7921,13 +7832,6 @@ fsevents@^1.2.7: languageName: node linkType: hard -"lodash@npm:4.17.19, lodash@npm:^4.17.19": - version: 4.17.19 - resolution: "lodash@npm:4.17.19" - checksum: ff2b7a95f0129dba9101e346d44e0eda0f159d76bbbf23721eec1969b87a32bde3de0cfef0733218c64620e9be08040a973278d46a686540233b356115f3527c - languageName: node - linkType: hard - "lodash@npm:4.17.20": version: 4.17.20 resolution: "lodash@npm:4.17.20" @@ -7942,6 +7846,13 @@ fsevents@^1.2.7: languageName: node linkType: hard +"lodash@npm:^4.17.19": + version: 4.17.19 + resolution: "lodash@npm:4.17.19" + checksum: ff2b7a95f0129dba9101e346d44e0eda0f159d76bbbf23721eec1969b87a32bde3de0cfef0733218c64620e9be08040a973278d46a686540233b356115f3527c + languageName: node + linkType: hard + "log-symbols@npm:^2.2.0": version: 2.2.0 resolution: "log-symbols@npm:2.2.0" @@ -7951,15 +7862,6 @@ fsevents@^1.2.7: languageName: node linkType: hard -"log-symbols@npm:^3.0.0": - version: 3.0.0 - resolution: "log-symbols@npm:3.0.0" - dependencies: - chalk: ^2.4.2 - checksum: bfa7cceaea16d7e378b4f6a16e22c5c78bc4250350a84d653766927bdf27e5b94015f616e193bc275e80d13f882867ddf224a3c6c152e24289ed5e58d84d306e - languageName: node - linkType: hard - "log-symbols@npm:^4.0.0": version: 4.0.0 resolution: "log-symbols@npm:4.0.0" @@ -8766,22 +8668,6 @@ fsevents@^1.2.7: languageName: node linkType: hard -"ora@npm:4.0.5": - version: 4.0.5 - resolution: "ora@npm:4.0.5" - dependencies: - chalk: ^3.0.0 - cli-cursor: ^3.1.0 - cli-spinners: ^2.2.0 - is-interactive: ^1.0.0 - log-symbols: ^3.0.0 - mute-stream: 0.0.8 - strip-ansi: ^6.0.0 - wcwidth: ^1.0.1 - checksum: f9910d588936783c2e9fadee2744685bb8836e1ef8a7d81ef751ef8ac5495d25422e8ea5a456b365f733bd48a02e7ffe9e3041b88db2fe34734a29795eb29cea - languageName: node - linkType: hard - "ora@npm:5.0.0": version: 5.0.0 resolution: "ora@npm:5.0.0" @@ -9726,47 +9612,6 @@ fsevents@^1.2.7: languageName: node linkType: hard -"release-it@npm:^13.6.0": - version: 13.6.6 - resolution: "release-it@npm:13.6.6" - dependencies: - "@iarna/toml": 2.2.5 - "@octokit/rest": 18.0.3 - async-retry: 1.3.1 - chalk: 4.1.0 - cosmiconfig: 6.0.0 - debug: 4.1.1 - deprecated-obj: 1.0.1 - detect-repo-changelog: 1.0.1 - execa: 4.0.3 - find-up: 4.1.0 - form-data: 3.0.0 - git-url-parse: 11.1.2 - globby: 11.0.1 - got: 11.5.1 - import-cwd: 3.0.0 - inquirer: 7.3.3 - is-ci: 2.0.0 - lodash: 4.17.19 - mime-types: 2.1.27 - ora: 4.0.5 - os-name: 3.1.0 - parse-json: 5.0.1 - semver: 7.3.2 - shelljs: 0.8.4 - supports-color: 7.1.0 - update-notifier: 4.1.0 - url-join: 4.0.1 - uuid: 8.2.0 - window-size: 1.1.1 - yaml: 1.10.0 - yargs-parser: 18.1.3 - bin: - release-it: bin/release-it.js - checksum: bd534a65d5014e0880a9bf7f0d7df7373d0511c4bc9e123944c88d9f1e252d918c464665f9f509c581cbaed810b2266f034858e4e785bae9c84d2474015c650d - languageName: node - linkType: hard - "release-it@npm:^13.6.7": version: 13.6.7 resolution: "release-it@npm:13.6.7" @@ -11648,15 +11493,6 @@ resolve@1.15.1: languageName: node linkType: hard -"uuid@npm:8.2.0": - version: 8.2.0 - resolution: "uuid@npm:8.2.0" - bin: - uuid: dist/bin/uuid - checksum: 6059ba10c32a42897af628b9e434ff523713614714d93845c76ee153f0d9c7e88ab47b8d03cadbe5f4c39a57abc4fbff46ae533fff6318cc6c907e4cd626fcb2 - languageName: node - linkType: hard - "uuid@npm:8.3.0": version: 8.3.0 resolution: "uuid@npm:8.3.0" @@ -12042,16 +11878,6 @@ resolve@1.15.1: languageName: node linkType: hard -"yargs-parser@npm:18.1.3": - version: 18.1.3 - resolution: "yargs-parser@npm:18.1.3" - dependencies: - camelcase: ^5.0.0 - decamelize: ^1.2.0 - checksum: 33871721679053cc38165afc6356c06c3e820459589b5db78f315886105070eb90cbb583cd6515fa4231937d60c80262ca2b7c486d5942576802446318a39597 - languageName: node - linkType: hard - "yargs-parser@npm:19.0.1": version: 19.0.1 resolution: "yargs-parser@npm:19.0.1"