UNPKG

@dkkoval/react-md-stats-map

Version:

A React component for visualizing data on a map of Moldova by raion.

55,732 lines 777 kB
import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
import React, { createContext, useMemo, useState, useCallback, forwardRef, useContext, useRef, useInsertionEffect, useEffect, Fragment as Fragment$1, useLayoutEffect, createElement, useId, Component } from 'react';
import ReactDOM from 'react-dom';

/******************************************************************************
Copyright (c) Microsoft Corporation.

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
***************************************************************************** */
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */


var __assign = function() {
    __assign = Object.assign || function __assign(t) {
        for (var s, i = 1, n = arguments.length; i < n; i++) {
            s = arguments[i];
            for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
        }
        return t;
    };
    return __assign.apply(this, arguments);
};

typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
    var e = new Error(message);
    return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
};

function identity$2(x) {
  return x;
}

function transform$1(transform) {
  if (transform == null) return identity$2;
  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 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(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(topology, o) {
  var transformPoint = transform$1(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);
}

var type = "Topology";
var arcs = [
	[
		[
			21411,
			3033
		],
		[
			49,
			10
		],
		[
			8,
			3
		],
		[
			163,
			37
		],
		[
			100,
			19
		],
		[
			20,
			7
		],
		[
			190,
			-789
		],
		[
			79,
			-299
		]
	],
	[
		[
			22020,
			2021
		],
		[
			-877,
			-201
		],
		[
			-97,
			-272
		],
		[
			-149,
			-34
		],
		[
			2,
			44
		],
		[
			-55,
			11
		],
		[
			20,
			103
		],
		[
			0,
			0
		],
		[
			-82,
			97
		],
		[
			75,
			477
		],
		[
			20,
			37
		],
		[
			43,
			3
		],
		[
			7,
			0
		],
		[
			-55,
			292
		],
		[
			-4,
			19
		],
		[
			2,
			6
		],
		[
			28,
			95
		],
		[
			-29,
			150
		],
		[
			-12,
			57
		],
		[
			4,
			1
		],
		[
			550,
			127
		]
	],
	[
		[
			21631,
			10088
		],
		[
			-3,
			-9
		],
		[
			-24,
			-69
		],
		[
			106,
			-117
		],
		[
			-117,
			109
		],
		[
			-17,
			-16
		],
		[
			122,
			-96
		],
		[
			-127,
			-33
		],
		[
			20,
			-46
		],
		[
			-49,
			41
		],
		[
			-144,
			-45
		],
		[
			325,
			-286
		],
		[
			448,
			92
		],
		[
			5,
			1
		],
		[
			-4,
			-288
		],
		[
			134,
			-150
		],
		[
			-6,
			-10
		],
		[
			-28,
			-53
		],
		[
			-323,
			-99
		],
		[
			30,
			-119
		],
		[
			-214,
			-51
		],
		[
			-34,
			92
		],
		[
			-162,
			-43
		]
	],
	[
		[
			21569,
			8893
		],
		[
			-260,
			534
		],
		[
			-308,
			40
		],
		[
			-62,
			-534
		],
		[
			-117,
			-528
		],
		[
			59,
			-177
		],
		[
			-3,
			-580
		],
		[
			74,
			-387
		],
		[
			-54,
			-15
		],
		[
			72,
			-256
		],
		[
			165,
			14
		],
		[
			45,
			-263
		]
	],
	[
		[
			21180,
			6741
		],
		[
			-490,
			-157
		],
		[
			-87,
			-28
		],
		[
			-252,
			-81
		],
		[
			15,
			-133
		],
		[
			-151,
			-29
		],
		[
			57,
			-219
		]
	],
	[
		[
			20272,
			6094
		],
		[
			39,
			-164
		],
		[
			187,
			63
		],
		[
			-11,
			-527
		],
		[
			519,
			206
		],
		[
			17,
			-61
		],
		[
			90,
			43
		],
		[
			45,
			-68
		],
		[
			30,
			-415
		],
		[
			678,
			48
		],
		[
			64,
			-329
		],
		[
			-73,
			-16
		],
		[
			23,
			-134
		],
		[
			86,
			-4
		],
		[
			38,
			-90
		],
		[
			59,
			-29
		],
		[
			146,
			-381
		]
	],
	[
		[
			22209,
			4236
		],
		[
			-8,
			-3
		],
		[
			-8,
			-2
		],
		[
			-20,
			-5
		],
		[
			-44,
			-7
		],
		[
			-48,
			-8
		],
		[
			-68,
			-8
		],
		[
			-13,
			-10
		],
		[
			-8,
			-4
		],
		[
			-22,
			-5
		],
		[
			-11,
			-2
		],
		[
			-13,
			3
		],
		[
			-11,
			3
		],
		[
			-11,
			3
		],
		[
			-69,
			60
		],
		[
			-10,
			4
		],
		[
			-16,
			5
		],
		[
			-19,
			-6
		],
		[
			-13,
			-14
		],
		[
			-13,
			-50
		],
		[
			-37,
			-105
		],
		[
			-30,
			-119
		]
	],
	[
		[
			21717,
			3966
		],
		[
			-1016,
			-62
		],
		[
			-40,
			7
		],
		[
			-40,
			173
		],
		[
			-135,
			-26
		],
		[
			3,
			-159
		],
		[
			-165,
			4
		],
		[
			-29,
			1
		],
		[
			-41,
			2
		],
		[
			-6,
			0
		],
		[
			-17,
			145
		],
		[
			-460,
			-53
		],
		[
			-126,
			435
		],
		[
			-336,
			-83
		],
		[
			51,
			-195
		],
		[
			-49,
			22
		],
		[
			181,
			-786
		],
		[
			-148,
			-31
		],
		[
			273,
			-1208
		],
		[
			-354,
			-71
		],
		[
			-68,
			-58
		],
		[
			147,
			-769
		]
	],
	[
		[
			19342,
			1254
		],
		[
			-34,
			-16
		],
		[
			-9,
			-8
		],
		[
			-65,
			-58
		],
		[
			-56,
			-49
		],
		[
			-120,
			-98
		],
		[
			-34,
			-28
		],
		[
			-7,
			-6
		],
		[
			-42,
			-35
		],
		[
			-60,
			-51
		],
		[
			-116,
			-115
		],
		[
			-87,
			-114
		],
		[
			-13,
			-27
		],
		[
			-23,
			-40
		],
		[
			-7,
			-14
		],
		[
			-16,
			-28
		],
		[
			-13,
			-20
		],
		[
			-56,
			-84
		],
		[
			-12,
			-17
		],
		[
			-16,
			-24
		],
		[
			-53,
			-80
		],
		[
			-193,
			-288
		],
		[
			-4,
			-26
		],
		[
			-4,
			-22
		],
		[
			-34,
			-6
		],
		[
			-32,
			11
		],
		[
			-4,
			3
		],
		[
			-15,
			15
		],
		[
			-13,
			7
		],
		[
			-52,
			15
		],
		[
			-24,
			7
		],
		[
			-35,
			10
		],
		[
			-47,
			11
		],
		[
			-49,
			17
		],
		[
			-14,
			7
		],
		[
			-8,
			10
		],
		[
			-12,
			27
		],
		[
			-25,
			49
		],
		[
			-15,
			31
		],
		[
			-7,
			12
		],
		[
			-12,
			24
		],
		[
			-11,
			30
		],
		[
			-9,
			52
		],
		[
			-5,
			48
		],
		[
			-14,
			54
		],
		[
			-8,
			22
		],
		[
			-35,
			63
		],
		[
			-16,
			9
		],
		[
			-22,
			-5
		],
		[
			-18,
			-11
		],
		[
			-58,
			-4
		],
		[
			-5,
			8
		],
		[
			0,
			8
		],
		[
			3,
			73
		],
		[
			0,
			21
		],
		[
			2,
			29
		],
		[
			3,
			49
		],
		[
			0,
			11
		],
		[
			16,
			38
		],
		[
			22,
			54
		],
		[
			1,
			11
		],
		[
			1,
			12
		],
		[
			-5,
			41
		],
		[
			-4,
			35
		],
		[
			7,
			78
		],
		[
			-1,
			31
		],
		[
			-1,
			34
		],
		[
			-2,
			52
		],
		[
			3,
			78
		],
		[
			-1,
			9
		],
		[
			-8,
			44
		],
		[
			-4,
			8
		],
		[
			-33,
			30
		],
		[
			-9,
			10
		],
		[
			-21,
			25
		],
		[
			-9,
			15
		],
		[
			-13,
			33
		],
		[
			-16,
			40
		],
		[
			-17,
			41
		],
		[
			0,
			8
		],
		[
			2,
			48
		],
		[
			2,
			54
		],
		[
			6,
			17
		],
		[
			10,
			33
		],
		[
			0,
			2
		],
		[
			1,
			4
		],
		[
			6,
			42
		],
		[
			0,
			26
		],
		[
			0,
			19
		],
		[
			-6,
			15
		],
		[
			-14,
			-2
		],
		[
			-1,
			0
		],
		[
			-17,
			-18
		],
		[
			-5,
			-6
		],
		[
			-14,
			-20
		],
		[
			-18,
			-31
		],
		[
			-16,
			-39
		],
		[
			-9,
			-11
		],
		[
			-3,
			-3
		],
		[
			-18,
			-14
		],
		[
			-11,
			-6
		],
		[
			-9,
			5
		],
		[
			-26,
			91
		],
		[
			-23,
			70
		],
		[
			-6,
			8
		],
		[
			-15,
			6
		],
		[
			-27,
			5
		],
		[
			-12,
			-4
		],
		[
			-7,
			-10
		],
		[
			-9,
			-10
		],
		[
			-22,
			-25
		],
		[
			-2,
			-3
		],
		[
			-7,
			-8
		],
		[
			-58,
			-36
		],
		[
			-5,
			0
		],
		[
			-19,
			2
		],
		[
			-18,
			1
		],
		[
			-16,
			8
		],
		[
			-39,
			39
		],
		[
			-1,
			13
		],
		[
			3,
			16
		],
		[
			10,
			12
		],
		[
			-4,
			32
		],
		[
			-1,
			14
		],
		[
			-29,
			51
		],
		[
			-19,
			32
		],
		[
			-3,
			4
		],
		[
			-14,
			12
		],
		[
			-2,
			1
		],
		[
			-93,
			70
		],
		[
			-1,
			1
		],
		[
			-46,
			48
		],
		[
			-27,
			28
		],
		[
			-7,
			8
		],
		[
			-65,
			47
		],
		[
			-9,
			21
		],
		[
			-18,
			42
		],
		[
			-5,
			20
		],
		[
			0,
			23
		],
		[
			1,
			43
		],
		[
			1,
			6
		],
		[
			14,
			19
		],
		[
			4,
			4
		],
		[
			21,
			16
		],
		[
			87,
			82
		],
		[
			76,
			40
		],
		[
			22,
			12
		],
		[
			20,
			21
		],
		[
			12,
			15
		],
		[
			2,
			8
		],
		[
			2,
			9
		],
		[
			-1,
			19
		],
		[
			4,
			16
		],
		[
			11,
			9
		],
		[
			42,
			7
		],
		[
			36,
			4
		],
		[
			7,
			-1
		],
		[
			3,
			-1
		],
		[
			5,
			-7
		],
		[
			2,
			-8
		],
		[
			6,
			-28
		],
		[
			18,
			-29
		],
		[
			31,
			-26
		],
		[
			35,
			-23
		],
		[
			20,
			-11
		],
		[
			14,
			9
		],
		[
			0,
			20
		],
		[
			5,
			20
		],
		[
			3,
			13
		],
		[
			6,
			24
		],
		[
			48,
			21
		],
		[
			11,
			3
		],
		[
			2,
			0
		],
		[
			13,
			-5
		],
		[
			11,
			-17
		],
		[
			28,
			-14
		],
		[
			28,
			-14
		],
		[
			19,
			23
		],
		[
			5,
			6
		],
		[
			20,
			23
		],
		[
			4,
			7
		],
		[
			3,
			5
		],
		[
			2,
			4
		],
		[
			10,
			33
		],
		[
			17,
			40
		],
		[
			23,
			38
		],
		[
			24,
			36
		],
		[
			2,
			3
		],
		[
			7,
			9
		],
		[
			15,
			5
		],
		[
			4,
			1
		],
		[
			20,
			4
		],
		[
			57,
			23
		],
		[
			39,
			21
		],
		[
			42,
			24
		],
		[
			16,
			32
		],
		[
			4,
			14
		],
		[
			-6,
			19
		],
		[
			-3,
			7
		],
		[
			-15,
			26
		],
		[
			-18,
			12
		],
		[
			-13,
			3
		],
		[
			-55,
			-2
		],
		[
			-43,
			6
		],
		[
			-17,
			2
		],
		[
			-18,
			14
		],
		[
			-4,
			14
		],
		[
			6,
			8
		],
		[
			4,
			1
		],
		[
			8,
			1
		],
		[
			28,
			24
		],
		[
			12,
			10
		],
		[
			11,
			23
		],
		[
			11,
			22
		],
		[
			-1,
			11
		],
		[
			-1,
			16
		],
		[
			-2,
			26
		],
		[
			5,
			52
		],
		[
			11,
			41
		],
		[
			7,
			31
		],
		[
			4,
			13
		],
		[
			21,
			61
		],
		[
			0,
			3
		],
		[
			-2,
			36
		],
		[
			-2,
			44
		],
		[
			0,
			14
		],
		[
			-1,
			27
		],
		[
			-17,
			58
		],
		[
			-13,
			49
		],
		[
			-13,
			40
		],
		[
			-20,
			60
		],
		[
			0,
			21
		],
		[
			0,
			71
		],
		[
			0,
			7
		],
		[
			0,
			3
		],
		[
			6,
			47
		],
		[
			3,
			22
		],
		[
			29,
			19
		],
		[
			3,
			1
		],
		[
			40,
			26
		],
		[
			12,
			17
		],
		[
			-1,
			22
		],
		[
			-5,
			6
		],
		[
			-36,
			47
		],
		[
			-27,
			45
		],
		[
			-6,
			16
		],
		[
			-9,
			32
		],
		[
			-12,
			44
		],
		[
			-10,
			35
		],
		[
			22,
			61
		],
		[
			18,
			51
		],
		[
			2,
			5
		],
		[
			-4,
			12
		],
		[
			-12,
			43
		],
		[
			-3,
			4
		],
		[
			-32,
			48
		],
		[
			-83,
			82
		],
		[
			-26,
			68
		],
		[
			0,
			7
		],
		[
			-1,
			53
		],
		[
			0,
			5
		],
		[
			-12,
			21
		],
		[
			-26,
			43
		],
		[
			-33,
			36
		],
		[
			-15,
			19
		],
		[
			1,
			24
		],
		[
			4,
			15
		],
		[
			5,
			19
		],
		[
			5,
			8
		],
		[
			23,
			37
		],
		[
			18,
			31
		],
		[
			7,
			9
		],
		[
			27,
			38
		],
		[
			11,
			17
		],
		[
			14,
			19
		],
		[
			7,
			41
		],
		[
			7,
			41
		],
		[
			-7,
			37
		],
		[
			-5,
			23
		],
		[
			-2,
			2
		],
		[
			-9,
			9
		],
		[
			-12,
			3
		],
		[
			-18,
			-6
		],
		[
			-20,
			-17
		],
		[
			-33,
			-15
		],
		[
			-63,
			-28
		],
		[
			-48,
			-18
		],
		[
			-11,
			2
		],
		[
			-58,
			46
		],
		[
			-33,
			31
		],
		[
			-36,
			60
		],
		[
			-2,
			2
		],
		[
			-31,
			52
		],
		[
			-6,
			8
		],
		[
			-10,
			0
		],
		[
			-39,
			-16
		],
		[
			-16,
			-1
		],
		[
			-15,
			13
		],
		[
			-9,
			38
		],
		[
			-2,
			31
		],
		[
			1,
			2
		],
		[
			5,
			12
		],
		[
			15,
			4
		],
		[
			86,
			45
		],
		[
			-1,
			14
		],
		[
			-3,
			62
		],
		[
			-1,
			12
		],
		[
			-3,
			19
		],
		[
			-16,
			91
		],
		[
			-43,
			45
		],
		[
			-50,
			25
		],
		[
			-24,
			31
		],
		[
			5,
			15
		],
		[
			16,
			48
		],
		[
			2,
			7
		],
		[
			-11,
			53
		],
		[
			-4,
			23
		],
		[
			0,
			1
		],
		[
			17,
			52
		],
		[
			11,
			33
		],
		[
			-10,
			41
		],
		[
			-5,
			23
		],
		[
			-4,
			61
		],
		[
			1,
			6
		],
		[
			2,
			9
		],
		[
			6,
			41
		],
		[
			9,
			15
		],
		[
			-2,
			65
		],
		[
			-4,
			8
		],
		[
			-27,
			52
		],
		[
			-41,
			76
		],
		[
			-4,
			12
		],
		[
			1,
			12
		],
		[
			7,
			6
		],
		[
			3,
			2
		],
		[
			16,
			4
		],
		[
			79,
			16
		],
		[
			43,
			7
		],
		[
			18,
			3
		],
		[
			11,
			9
		],
		[
			49,
			39
		],
		[
			19,
			50
		],
		[
			12,
			55
		],
		[
			16,
			82
		],
		[
			1,
			5
		],
		[
			5,
			39
		],
		[
			3,
			21
		],
		[
			-2,
			23
		],
		[
			-11,
			16
		],
		[
			-2,
			3
		],
		[
			-21,
			19
		],
		[
			-1,
			1
		],
		[
			-9,
			3
		],
		[
			-1,
			-1
		],
		[
			-47,
			-32
		],
		[
			-60,
			-8
		],
		[
			-22,
			0
		],
		[
			-19,
			14
		],
		[
			-12,
			18
		],
		[
			10,
			16
		],
		[
			5,
			7
		],
		[
			25,
			35
		],
		[
			19,
			26
		],
		[
			-37,
			60
		],
		[
			9,
			57
		],
		[
			2,
			5
		],
		[
			11,
			31
		],
		[
			13,
			39
		],
		[
			8,
			34
		],
		[
			4,
			18
		],
		[
			-6,
			47
		],
		[
			-1,
			31
		],
		[
			0,
			18
		],
		[
			5,
			15
		],
		[
			2,
			9
		],
		[
			17,
			56
		],
		[
			4,
			10
		],
		[
			9,
			18
		],
		[
			12,
			15
		],
		[
			11,
			46
		],
		[
			0,
			23
		],
		[
			0,
			27
		],
		[
			-16,
			62
		],
		[
			-3,
			14
		],
		[
			-11,
			22
		],
		[
			-18,
			17
		],
		[
			-2,
			3
		],
		[
			-19,
			52
		],
		[
			-4,
			25
		],
		[
			0,
			5
		],
		[
			-4,
			28
		],
		[
			1,
			16
		],
		[
			6,
			89
		],
		[
			-1,
			8
		],
		[
			-3,
			16
		],
		[
			-10,
			58
		],
		[
			-12,
			27
		],
		[
			-3,
			5
		],
		[
			-30,
			54
		],
		[
			-49,
			46
		],
		[
			-15,
			71
		],
		[
			-10,
			49
		],
		[
			-1,
			5
		],
		[
			-3,
			60
		],
		[
			0,
			8
		],
		[
			0,
			3
		],
		[
			-10,
			54
		],
		[
			-6,
			15
		],
		[
			-13,
			33
		],
		[
			-7,
			59
		],
		[
			1,
			12
		],
		[
			3,
			25
		],
		[
			3,
			22
		],
		[
			0,
			3
		],
		[
			-9,
			46
		],
		[
			-3,
			5
		],
		[
			-1,
			2
		],
		[
			-7,
			12
		],
		[
			-49,
			90
		],
		[
			-5,
			15
		],
		[
			-6,
			16
		],
		[
			-42,
			84
		],
		[
			-38,
			29
		],
		[
			-10,
			46
		],
		[
			-3,
			13
		],
		[
			35,
			25
		],
		[
			59,
			43
		],
		[
			7,
			19
		],
		[
			-2,
			6
		],
		[
			-7,
			18
		],
		[
			-10,
			5
		],
		[
			-12,
			6
		],
		[
			-19,
			8
		],
		[
			-8,
			4
		],
		[
			-11,
			5
		],
		[
			-21,
			16
		],
		[
			-6,
			16
		],
		[
			19,
			82
		],
		[
			4,
			17
		],
		[
			5,
			83
		],
		[
			1,
			13
		],
		[
			3,
			20
		],
		[
			1,
			8
		],
		[
			2,
			13
		],
		[
			52,
			65
		],
		[
			27,
			44
		],
		[
			34,
			56
		],
		[
			4,
			10
		],
		[
			23,
			50
		],
		[
			11,
			24
		],
		[
			-48,
			19
		],
		[
			-11,
			1
		],
		[
			-55,
			9
		],
		[
			-19,
			3
		],
		[
			-28,
			39
		],
		[
			-12,
			30
		],
		[
			-2,
			22
		],
		[
			12,
			13
		],
		[
			3,
			0
		],
		[
			22,
			3
		],
		[
			62,
			-3
		],
		[
			19,
			9
		],
		[
			7,
			15
		],
		[
			12,
			30
		],
		[
			-1,
			17
		],
		[
			-12,
			6
		],
		[
			-3,
			2
		],
		[
			-33,
			8
		],
		[
			-21,
			10
		],
		[
			-19,
			9
		],
		[
			-38,
			23
		],
		[
			-3,
			6
		],
		[
			-4,
			9
		],
		[
			6,
			27
		],
		[
			18,
			44
		],
		[
			3,
			8
		],
		[
			25,
			62
		],
		[
			5,
			13
		],
		[
			21,
			6
		],
		[
			29,
			7
		],
		[
			16,
			1
		],
		[
			27,
			1
		],
		[
			45,
			-5
		],
		[
			2,
			0
		],
		[
			2,
			0
		],
		[
			27,
			16
		],
		[
			10,
			66
		],
		[
			-11,
			58
		],
		[
			-4,
			15
		],
		[
			-11,
			39
		],
		[
			-5,
			15
		],
		[
			-7,
			49
		],
		[
			-2,
			11
		],
		[
			-4,
			26
		],
		[
			29,
			48
		],
		[
			25,
			5
		],
		[
			20,
			4
		],
		[
			21,
			5
		],
		[
			50,
			28
		],
		[
			22,
			33
		]
	],
	[
		[
			17224,
			10051
		],
		[
			869,
			-89
		],
		[
			52,
			0
		],
		[
			4,
			0
		],
		[
			15,
			22
		],
		[
			15,
			20
		],
		[
			3,
			0
		],
		[
			240,
			-11
		],
		[
			166,
			41
		],
		[
			59,
			198
		],
		[
			38,
			-4
		],
		[
			121,
			248
		],
		[
			279,
			-15
		],
		[
			-14,
			107
		],
		[
			113,
			-11
		],
		[
			150,
			244
		],
		[
			49,
			-211
		],
		[
			98,
			22
		],
		[
			51,
			-206
		],
		[
			166,
			-117
		],
		[
			25,
			10
		],
		[
			30,
			-130
		],
		[
			163,
			22
		],
		[
			14,
			-25
		],
		[
			-7,
			86
		],
		[
			32,
			1
		],
		[
			160,
			-400
		],
		[
			299,
			84
		],
		[
			93,
			-263
		],
		[
			18,
			-49
		],
		[
			273,
			-1
		],
		[
			5,
			122
		],
		[
			44,
			3
		],
		[
			54,
			606
		],
		[
			482,
			-90
		],
		[
			111,
			-57
		],
		[
			46,
			11
		],
		[
			6,
			1
		],
		[
			85,
			-132
		]
	],
	[
		[
			22020,
			2021
		],
		[
			2,
			-9
		],
		[
			59,
			-246
		],
		[
			-606,
			-136
		],
		[
			3,
			-13
		],
		[
			63,
			-270
		],
		[
			135,
			-565
		],
		[
			47,
			-195
		],
		[
			15,
			-63
		],
		[
			4,
			-16
		],
		[
			-10,
			-4
		],
		[
			-60,
			-12
		],
		[
			-40,
			-8
		],
		[
			-218,
			-48
		],
		[
			-213,
			-49
		],
		[
			-331,
			-81
		],
		[
			-46,
			-11
		],
		[
			-18,
			-1
		],
		[
			-43,
			-5
		],
		[
			-20,
			-1
		],
		[
			-36,
			-4
		],
		[
			-42,
			-4
		],
		[
			-3,
			145
		],
		[
			-12,
			150
		],
		[
			5,
			68
		],
		[
			11,
			71
		],
		[
			-12,
			8
		],
		[
			-11,
			5
		],
		[
			-13,
			6
		],
		[
			-16,
			7
		],
		[
			-17,
			7
		],
		[
			-26,
			8
		],
		[
			-25,
			13
		],
		[
			-34,
			14
		],
		[
			-29,
			12
		],
		[
			-49,
			23
		],
		[
			-25,
			9
		],
		[
			-68,
			27
		],
		[
			-9,
			4
		],
		[
			-58,
			22
		],
		[
			-86,
			36
		],
		[
			-98,
			39
		],
		[
			-28,
			11
		],
		[
			-77,
			31
		],
		[
			-38,
			16
		],
		[
			-46,
			20
		],
		[
			-86,
			34
		],
		[
			-48,
			19
		],
		[
			-82,
			33
		],
		[
			-161,
			64
		],
		[
			-96,
			39
		],
		[
			-60,
			24
		],
		[
			-23,
			8
		],
		[
			-3,
			1
		]
	],
	[
		[
			21717,
			3966
		],
		[
			-29,
			-126
		],
		[
			-43,
			-107
		],
		[
			-27,
			-68
		],
		[
			-23,
			-57
		],
		[
			-72,
			-84
		],
		[
			-49,
			-48
		],
		[
			-10,
			-9
		],
		[
			-12,
			-5
		],
		[
			-24,
			-15
		],
		[
			-44,
			-39
		],
		[
			-35,
			-87
		],
		[
			3,
			-20
		],
		[
			4,
			-27
		],
		[
			6,
			-53
		],
		[
			16,
			-57
		],
		[
			6,
			-24
		],
		[
			15,
			-58
		],
		[
			12,
			-49
		]
	],
	[
		[
			23834,
			5514
		],
		[
			-1059,
			-227
		],
		[
			-6,
			23
		],
		[
			-304,
			-9
		],
		[
			-25,
			0
		],
		[
			15,
			311
		],
		[
			-91,
			7
		],
		[
			-28,
			-57
		],
		[
			-253,
			-39
		],
		[
			-119,
			480
		],
		[
			497,
			134
		],
		[
			4,
			-362
		],
		[
			42,
			3
		],
		[
			6,
			1
		],
		[
			-3,
			170
		],
		[
			36,
			50
		],
		[
			93,
			-27
		],
		[
			30,
			158
		],
		[
			0,
			0
		],
		[
			0,
			0
		],
		[
			1980,
			434
		]
	],
	[
		[
			24649,
			6564
		],
		[
			45,
			-191
		],
		[
			41,
			-172
		],
		[
			53,
			-225
		],
		[
			54,
			-236
		],
		[
			-146,
			-25
		],
		[
			-77,
			-23
		],
		[
			-120,
			-26
		],
		[
			-226,
			-48
		],
		[
			-212,
			-48
		],
		[
			-94,
			-25
		],
		[
			-133,
			-31
		]
	],
	[
		[
			21180,
			6741
		],
		[
			165,
			50
		],
		[
			48,
			-120
		],
		[
			78,
			24
		],
		[
			62,
			-294
		],
		[
			-220,
			-72
		],
		[
			-5,
			-64
		],
		[
			-258,
			-92
		],
		[
			-53,
			84
		],
		[
			-8,
			11
		],
		[
			0,
			2
		],
		[
			-1,
			0
		],
		[
			-124,
			-80
		],
		[
			20,
			-65
		],
		[
			-121,
			-42
		],
		[
			-39,
			110
		],
		[
			-10,
			-32
		],
		[
			-56,
			61
		],
		[
			-386,
			-128
		]
	],
	[
		[
			21631,
			10088
		],
		[
			19,
			-27
		],
		[
			-37,
			408
		],
		[
			-341,
			732
		],
		[
			133,
			129
		],
		[
			54,
			52
		],
		[
			58,
			23
		],
		[
			71,
			28
		],
		[
			136,
			15
		],
		[
			474,
			52
		],
		[
			-50,
			779
		],
		[
			68,
			672
		],
		[
			-512,
			29
		],
		[
			-25,
			2
		],
		[
			-8,
			0
		],
		[
			-6,
			158
		],
		[
			-2,
			49
		],
		[
			-4,
			114
		],
		[
			-1,
			1
		],
		[
			-35,
			93
		],
		[
			48,
			122
		],
		[
			27,
			70
		],
		[
			7,
			19
		],
		[
			37,
			236
		]
	],
	[
		[
			21742,
			13844
		],
		[
			15,
			-7
		],
		[
			355,
			-161
		],
		[
			263,
			603
		],
		[
			49,
			271
		],
		[
			-308,
			580
		],
		[
			-289,
			-3
		],
		[
			113,
			363
		],
		[
			12,
			198
		],
		[
			114,
			3
		],
		[
			82,
			-36
		],
		[
			15,
			73
		]
	],
	[
		[
			22163,
			15728
		],
		[
			587,
			68
		],
		[
			574,
			-305
		],
		[
			1173,
			-622
		],
		[
			20,
			3
		],
		[
			755,
			143
		]
	],
	[
		[
			25272,
			15015
		],
		[
			59,
			-56
		],
		[
			67,
			-61
		],
		[
			34,
			-32
		],
		[
			170,
			-295
		],
		[
			58,
			-172
		],
		[
			30,
			-92
		],
		[
			73,
			-217
		],
		[
			34,
			-178
		],
		[
			2,
			-8
		],
		[
			38,
			-195
		],
		[
			-4,
			0
		],
		[
			-1239,
			-278
		],
		[
			-25,
			53
		],
		[
			11,
			-46
		],
		[
			-2,
			-1
		],
		[
			-396,
			-99
		],
		[
			99,
			-135
		],
		[
			-39,
			-582
		],
		[
			391,
			85
		],
		[
			1496,
			322
		],
		[
			67,
			-73
		],
		[
			147,
			-159
		],
		[
			2,
			-5
		],
		[
			43,
			-93
		],
		[
			3,
			4
		],
		[
			19,
			25
		],
		[
			339,
			-264
		]
	],
	[
		[
			26749,
			12463
		],
		[
			545,
			-412
		],
		[
			32,
			-25
		]
	],
	[
		[
			27326,
			12026
		],
		[
			-913,
			-1106
		],
		[
			-78,
			-147
		],
		[
			343,
			-793
		],
		[
			-886,
			-197
		],
		[
			372,
			-1551
		]
	],
	[
		[
			26164,
			8232
		],
		[
			-133,
			-29
		],
		[
			-43,
			-11
		],
		[
			-30,
			-4
		],
		[
			-145,
			-32
		],
		[
			-7,
			-2
		],
		[
			-124,
			-26
		],
		[
			-88,
			-18
		],
		[
			-80,
			-19
		],
		[
			-41,
			-8
		],
		[
			-283,
			-62
		],
		[
			-144,
			-31
		]
	],
	[
		[
			25046,
			7990
		],
		[
			-198,
			795
		],
		[
			-130,
			521
		],
		[
			-228,
			-50
		],
		[
			-45,
			-10
		],
		[
			-40,
			-8
		],
		[
			-490,
			-108
		],
		[
			220,
			-887
		],
		[
			107,
			-433
		],
		[
			-1011,
			-225
		],
		[
			-329,
			-72
		],
		[
			-108,
			-24
		],
		[
			-43,
			36
		],
		[
			-15,
			11
		],
		[
			-5,
			49
		],
		[
			-15,
			138
		],
		[
			-55,
			80
		],
		[
			-3,
			4
		],
		[
			-136,
			-6
		],
		[
			-135,
			-6
		],
		[
			-4,
			-130
		],
		[
			-441,
			-42
		],
		[
			-161,
			298
		],
		[
			621,
			-3
		],
		[
			4,
			100
		],
		[
			-175,
			25
		],
		[
			0,
			92
		],
		[
			50,
			-9
		],
		[
			-16,
			198
		],
		[
			113,
			16
		],
		[
			-10,
			123
		],
		[
			-261,
			-60
		],
		[
			-171,
			32
		],
		[
			-177,
			-34
		],
		[
			-190,
			492
		]
	],
	[
		[
			25046,
			7990
		],
		[
			-181,
			-41
		],
		[
			-124,
			-27
		],
		[
			40,
			-160
		],
		[
			-266,
			-53
		],
		[
			40,
			-197
		],
		[
			32,
			-135
		],
		[
			3,
			-21
		],
		[
			-1,
			-6
		],
		[
			-8,
			-46
		],
		[
			-11,
			-19
		],
		[
			-26,
			-13
		],
		[
			-14,
			-4
		],
		[
			-16,
			-5
		],
		[
			-11,
			-5
		],
		[
			-9,
			-7
		],
		[
			-3,
			-2
		],
		[
			-1,
			-1
		],
		[
			6,
			-26
		],
		[
			3,
			-11
		],
		[
			13,
			-59
		],
		[
			22,
			-99
		],
		[
			11,
			-46
		],
		[
			46,
			-191
		],
		[
			58,
			-252
		]
	],
	[
		[
			23834,
			5514
		],
		[
			29,
			-132
		],
		[
			22,
			-88
		],
		[
			13,
			-63
		],
		[
			72,
			-309
		],
		[
			-233,
			-53
		],
		[
			-147,
			-32
		],
		[
			-401,
			-92
		],
		[
			-185,
			-38
		],
		[
			-16,
			1
		],
		[
			-38,
			8
		],
		[
			-25,
			6
		],
		[
			-29,
			6
		],
		[
			-108,
			24
		],
		[
			-15,
			4
		],
		[
			-39,
			9
		],
		[
			-71,
			18
		],
		[
			-36,
			9
		],
		[
			-76,
			13
		],
		[
			-54,
			-30
		],
		[
			-17,
			-9
		],
		[
			18,
			-8
		],
		[
			55,
			-89
		],
		[
			42,
			-101
		],
		[
			17,
			-43
		],
		[
			3,
			-15
		],
		[
			14,
			-65
		],
		[
			3,
			-18
		],
		[
			13,
			-61
		],
		[
			15,
			-76
		],
		[
			2,
			-45
		],
		[
			1,
			-8
		],
		[
			0,
			-6
		],
		[
			-1,
			-7
		],
		[
			-5,
			-19
		],
		[
			-8,
			-13
		],
		[
			-10,
			-12
		],
		[
			-13,
			-14
		],
		[
			-30,
			-40
		],
		[
			-37,
			-8
		],
		[
			-10,
			-2
		],
		[
			-22,
			-5
		],
		[
			-136,
			-24
		],
		[
			-83,
			-20
		],
		[
			-13,
			39
		],
		[
			-30,
			51
		],
		[
			-33,
			47
		],
		[
			-23,
			32
		]
	],
	[
		[
			27326,
			12026
		],
		[
			53,
			-40
		],
		[
			101,
			-78
		],
		[
			29,
			-22
		],
		[
			13,
			-10
		],
		[
			164,
			-127
		],
		[
			312,
			-235
		],
		[
			71,
			-57
		],
		[
			-257,
			-310
		],
		[
			-88,
			-104
		],
		[
			-2,
			-2
		],
		[
			-1,
			-2
		],
		[
			-24,
			-28
		],
		[
			-14,
			-18
		],
		[
			-102,
			-123
		],
		[
			-20,
			-24
		],
		[
			-22,
			-27
		],
		[
			-121,
			-141
		],
		[
			-66,
			-80
		],
		[
			-17,
			-20
		],
		[
			-60,
			-72
		],
		[
			-10,
			-12
		],
		[
			-130,
			-156
		],
		[
			-31,
			-37
		],
		[
			-57,
			-69
		],
		[
			-53,
			-62
		],
		[
			-11,
			-14
		],
		[
			-251,
			-301
		],
		[
			13,
			-15
		],
		[
			191,
			-212
		],
		[
			333,
			-369
		],
		[
			94,
			-101
		],
		[
			-121,
			-286
		],
		[
			-26,
			-69
		],
		[
			-26,
			-60
		],
		[
			-99,
			-231
		],
		[
			-34,
			-75
		],
		[
			-95,
			-25
		],
		[
			-147,
			-33
		],
		[
			-48,
			-12
		],
		[
			-76,
			-18
		],
		[
			-50,
			-11
		],
		[
			-22,
			-4
		],
		[
			-28,
			-6
		],
		[
			-21,
			-4
		],
		[
			-64,
			-16
		],
		[
			-26,
			-5
		],
		[
			-231,
			-52
		],
		[
			-85,
			-19
		]
	],
	[
		[
			17224,
			10051
		],
		[
			1,
			5
		],
		[
			2,
			12
		],
		[
			1,
			5
		],
		[
			6,
			37
		],
		[
			5,
			19
		],
		[
			5,
			15
		],
		[
			5,
			16
		],
		[
			35,
			108
		],
		[
			42,
			88
		],
		[
			4,
			61
		],
		[
			1,
			25
		],
		[
			-14,
			5
		],
		[
			-9,
			19
		],
		[
			-17,
			41
		],
		[
			-7,
			26
		],
		[
			-2,
			24
		],
		[
			0,
			3
		],
		[
			4,
			5
		],
		[
			11,
			12
		],
		[
			18,
			24
		],
		[
			11,
			21
		],
		[
			-2,
			31
		],
		[
			-6,
			11
		],
		[
			-11,
			8
		],
		[
			-17,
			7
		],
		[
			-7,
			4
		],
		[
			-9,
			5
		],
		[
			-8,
			5
		],
		[
			-5,
			28
		],
		[
			4,
			17
		],
		[
			8,
			36
		],
		[
			13,
			30
		],
		[
			3,
			7
		],
		[
			2,
			7
		],
		[
			6,
			8
		],
		[
			15,
			0
		],
		[
			20,
			16
		],
		[
			56,
			44
		],
		[
			42,
			34
		],
		[
			24,
			19
		],
		[
			30,
			24
		],
		[
			-1,
			11
		],
		[
			-6,
			11
		],
		[
			-35,
			65
		],
		[
			-30,
			36
		],
		[
			-34,
			15
		],
		[
			-31,
			16
		],
		[
			-20,
			15
		],
		[
			-10,
			19
		],
		[
			-3,
			16
		],
		[
			2,
			10
		],
		[
			2,
			7
		],
		[
			9,
			11
		],
		[
			7,
			3
		],
		[
			4,
			2
		],
		[
			9,
			-3
		],
		[
			5,
			-4
		],
		[
			6,
			-4
		],
		[
			28,
			-19
		],
		[
			30,
			-14
		],
		[
			28,
			-8
		],
		[
			20,
			2
		],
		[
			17,
			7
		],
		[
			11,
			13
		],
		[
			2,
			8
		],
		[
			3,
			16
		],
		[
			-5,
			11
		],
		[
			-22,
			7
		],
		[
			-72,
			11
		],
		[
			-18,
			6
		],
		[
			-18,
			11
		],
		[
			-11,
			18
		],
		[
			-6,
			22
		],
		[
			1,
			19
		],
		[
			8,
			8
		],
		[
			4,
			0
		],
		[
			18,
			1
		],
		[
			20,
			-9
		],
		[
			11,
			-4
		],
		[
			2,
			-3
		],
		[
			28,
			-30
		],
		[
			12,
			-5
		],
		[
			10,
			4
		],
		[
			7,
			13
		],
		[
			1,
			10
		],
		[
			5,
			41
		],
		[
			2,
			18
		],
		[
			0,
			42
		],
		[
			-4,
			17
		],
		[
			-3,
			3
		],
		[
			-76,
			51
		],
		[
			-10,
			4
		],
		[
			-30,
			-7
		],
		[
			-51,
			-28
		],
		[
			-50,
			-25
		],
		[
			-8,
			-3
		],
		[
			-20,
			-6
		],
		[
			-10,
			2
		],
		[
			-5,
			6
		],
		[
			-12,
			41
		],
		[
			3,
			23
		],
		[
			30,
			22
		],
		[
			36,
			42
		],
		[
			13,
			33
		],
		[
			9,
			32
		],
		[
			3,
			15
		],
		[
			-1,
			49
		],
		[
			-3,
			17
		],
		[
			-14,
			17
		],
		[
			-7,
			10
		],
		[
			-5,
			3
		],
		[
			-16,
			10
		],
		[
			-15,
			6
		],
		[
			-15,
			2
		],
		[
			-15,
			-5
		],
		[
			-13,
			-11
		],
		[
			-4,
			-15
		],
		[
			0,
			-1
		],
		[
			0,
			-24
		],
		[
			7,
			-15
		],
		[
			6,
			-14
		],
		[
			4,
			-23
		],
		[
			-8,
			-25
		],
		[
			-16,
			-18
		],
		[
			-20,
			-13
		],
		[
			-10,
			0
		],
		[
			-9,
			4
		],
		[
			-18,
			20
		],
		[
			-6,
			7
		],
		[
			-10,
			18
		],
		[
			0,
			13
		],
		[
			0,
			1
		],
		[
			18,
			32
		],
		[
			1,
			12
		],
		[
			4,
			45
		],
		[
			4,
			46
		],
		[
			-5,
			22
		],
		[
			-5,
			20
		],
		[
			-13,
			54
		],
		[
			2,
			26
		],
		[
			5,
			75
		],
		[
			9,
			31
		],
		[
			8,
			41
		],
		[
			-2,
			25
		],
		[
			-4,
			12
		],
		[
			-12,
			37
		],
		[
			-10,
			36
		],
		[
			0,
			27
		],
		[
			0,
			12
		],
		[
			2,
			20
		],
		[
			6,
			20
		],
		[
			26,
			34
		],
		[
			12,
			5
		],
		[
			1,
			0
		],
		[
			8,
			-6
		],
		[
			2,
			-8
		],
		[
			8,
			-31
		],
		[
			2,
			-6
		],
		[
			13,
			-44
		],
		[
			7,
			-11
		],
		[
			5,
			-8
		],
		[
			12,
			-6
		],
		[
			7,
			4
		],
		[
			8,
			9
		],
		[
			2,
			2
		],
		[
			3,
			4
		],
		[
			22,
			24
		],
		[
			13,
			14
		],
		[
			28,
			39
		],
		[
			1,
			2
		],
		[
			8,
			8
		],
		[
			9,
			10
		],
		[
			16,
			18
		],
		[
			48,
			26
		],
		[
			45,
			-1
		],
		[
			10,
			-8
		],
		[
			13,
			5
		],
		[
			21,
			8
		],
		[
			64,
			40
		],
		[
			3,
			3
		],
		[
			1,
			3
		],
		[
			2,
			5
		],
		[
			-11,
			27
		],
		[
			-38,
			42
		],
		[
			-15,
			12
		],
		[
			-22,
			1
		],
		[
			-32,
			-6
		],
		[
			-47,
			-16
		],
		[
			-13,
			-1
		],
		[
			-12,
			17
		],
		[
			-23,
			40
		],
		[
			-5,
			9
		],
		[
			30,
			39
		],
		[
			39,
			10
		],
		[
			22,
			14
		],
		[
			5,
			13
		],
		[
			6,
			68
		],
		[
			1,
			2
		],
		[
			1,
			15
		],
		[
			-2,
			101
		],
		[
			-2,
			52
		],
		[
			12,
			47
		],
		[
			25,
			31
		],
		[
			33,
			22
		],
		[
			33,
			-1
		],
		[
			10,
			-3
		],
		[
			11,
			-3
		],
		[
			1,
			-11
		],
		[
			-9,
			-15
		],
		[
			-18,
			-32
		],
		[
			-16,
			-38
		],
		[
			3,
			-22
		],
		[
			20,
			-5
		],
		[
			53,
			2
		],
		[
			12,
			1
		],
		[
			13,
			10
		],
		[
			3,
			13
		],
		[
			3,
			10
		],
		[
			0,
			26
		],
		[
			-6,
			26
		],
		[
			-6,
			16
		],
		[
			-18,
			51
		],
		[
			-18,
			38
		],
		[
			2,
			21
		],
		[
			18,
			13
		],
		[
			15,
			1
		],
		[
			3,
			0
		],
		[
			17,
			-17
		],
		[
			15,
			-23
		],
		[
			14,
			-24
		],
		[
			21,
			-37
		],
		[
			15,
			-21
		],
		[
			31,
			-43
		],
		[
			1,
			-2
		],
		[
			3,
			-2
		],
		[
			7,
			-3
		],
		[
			16,
			2
		],
		[
			44,
			8
		],
		[
			13,
			3
		],
		[
			7,
			14
		],
		[
			-1,
			7
		],
		[
			-12,
			95
		],
		[
			3,
			53
		],
		[
			5,
			31
		],
		[
			2,
			12
		],
		[
			5,
			8
		],
		[
			10,
			19
		],
		[
			16,
			2
		],
		[
			23,
			-10
		],
		[
			28,
			-29
		],
		[
			2,
			-5
		],
		[
			2,
			-7
		],
		[
			-4,
			-15
		],
		[
			-17,
			-21
		],
		[
			-18,
			-11
		],
		[
			-7,
			-3
		],
		[
			-10,
			-12
		],
		[
			73,
			-80
		],
		[
			16,
			-3
		],
		[
			3,
			8
		],
		[
			11,
			41
		],
		[
			6,
			23
		],
		[
			0,
			18
		],
		[
			-2,
			49
		],
		[
			-28,
			26
		],
		[
			-13,
			34
		],
		[
			2,
			27
		],
		[
			5,
			8
		],
		[
			6,
			6
		],
		[
			3,
			1
		],
		[
			49,
			16
		],
		[
			32,
			8
		],
		[
			18,
			5
		],
		[
			32,
			9
		],
		[
			56,
			23
		],
		[
			13,
			5
		],
		[
			46,
			67
		],
		[
			17,
			24
		],
		[
			34,
			65
		],
		[
			1,
			3
		],
		[
			3,
			58
		],
		[
			-2,
			5
		],
		[
			-8,
			21
		],
		[
			-13,
			18
		],
		[
			-3,
			4
		],
		[
			-5,
			4
		],
		[
			-4,
			3
		],
		[
			-30,
			23
		],
		[
			-16,
			7
		],
		[
			-36,
			14
		],
		[
			-42,
			26
		],
		[
			-13,
			8
		],
		[
			-13,
			9
		],
		[
			-12,
			7
		],
		[
			-36,
			22
		],
		[
			-3,
			2
		],
		[
			8,
			21
		],
		[
			7,
			19
		],
		[
			29,
			80
		],
		[
			50,
			14
		],
		[
			11,
			4
		],
		[
			23,
			6
		],
		[
			-3,
			13
		],
		[
			-3,
			12
		],
		[
			-4,
			13
		],
		[
			-3,
			12
		],
		[
			-4,
			14
		],
		[
			0,
			3
		],
		[
			-9,
			-11
		],
		[
			-15,
			2
		],
		[
			-28,
			19
		],
		[
			-31,
			24
		],
		[
			-8,
			27
		],
		[
			-3,
			14
		],
		[
			-19,
			34
		],
		[
			-18,
			23
		],
		[
			-9,
			9
		],
		[
			2,
			13
		],
		[
			12,
			6
		],
		[
			39,
			8
		],
		[
			14,
			-3
		],
		[
			5,
			-1
		],
		[
			2,
			-13
		],
		[
			-20,
			-7
		],
		[
			-7,
			-1
		],
		[
			-20,
			0
		],
		[
			1,
			-10
		],
		[
			8,
			-9
		],
		[
			26,
			-11
		],
		[
			8,
			-4
		],
		[
			30,
			-9
		],
		[
			7,
			-2
		],
		[
			11,
			0
		],
		[
			23,
			1
		],
		[
			13,
			6
		],
		[
			-4,
			5
		],
		[
			-16,
			25
		],
		[
			-26,
			31
		],
		[
			-12,
			40
		],
		[
			0,
			15
		],
		[
			0,
			5
		],
		[
			3,
			18
		],
		[
			14,
			13
		],
		[
			10,
			2
		],
		[
			-8,
			-17
		],
		[
			-5,
			-9
		],
		[
			2,
			-10
		],
		[
			12,
			-7
		],
		[
			23,
			-5
		],
		[
			58,
			-3
		],
		[
			42,
			9
		],
		[
			40,
			26
		],
		[
			12,
			15
		],
		[
			-7,
			11
		],
		[
			-3,
			4
		],
		[
			-23,
			36
		],
		[
			-1,
			1
		],
		[
			-22,
			21
		],
		[
			-3,
			5
		],
		[
			-10,
			22
		],
		[
			-6,
			12
		],
		[
			-1,
			2
		],
		[
			-6,
			15
		],
		[
			-10,
			23
		],
		[
			-3,
			9
		],
		[
			27,
			35
		],
		[
			23,
			31
		],
		[
			33,
			34
		],
		[
			32,
			35
		],
		[
			29,
			29
		],
		[
			28,
			29
		],
		[
			10,
			11
		],
		[
			15,
			15
		],
		[
			24,
			27
		],
		[
			28,
			29
		],
		[
			-15,
			17
		],
		[
			-33,
			39
		],
		[
			7,
			49
		],
		[
			2,
			0
		],
		[
			32,
			2
		],
		[
			79,
			-39
		],
		[
			46,
			-12
		],
		[
			25,
			5
		]
	],
	[
		[
			18535,
			14533
		],
		[
			36,
			-75
		],
		[
			77,
			-9
		],
		[
			11,
			6
		],
		[
			83,
			44
		],
		[
			83,
			-24
		],
		[
			25,
			3
		],
		[
			214,
			27
		],
		[
			18,
			23
		],
		[
			135,
			180
		],
		[
			14,
			19
		],
		[
			38,
			12
		],
		[
			74,
			-125
		],
		[
			56,
			63
		],
		[
			55,
			-60
		],
		[
			96,
			104
		],
		[
			161,
			85
		],
		[
			176,
			-602
		],
		[
			62,
			-19
		],
		[
			53,
			-16
		],
		[
			74,
			37
		],
		[
			159,
			-14
		],
		[
			-2,
			34
		],
		[
			242,
			133
		],
		[
			163,
			162
		],
		[
			-73,
			109
		],
		[
			113,
			150
		],
		[
			-76,
			115
		],
		[
			127,
			-28
		],
		[
			97,
			22
		],
		[
			158,
			109
		],
		[
			97,
			-111
		],
		[
			217,
			-79
		],
		[
			178,
			-287
		],
		[
			-396,
			-271
		],
		[
			346,
			-321
		],
		[
			316,
			-85
		]
	],
	[
		[
			25272,
			15015
		],
		[
			-320,
			373
		],
		[
			628,
			335
		],
		[
			121,
			64
		],
		[
			-23,
			40
		],
		[
			327,
			173
		],
		[
			-106,
			181
		],
		[
			452,
			237
		],
		[
			-39,
			65
		],
		[
			214,
			115
		],
		[
			-18,
			144
		],
		[
			2,
			0
		],
		[
			42,
			6
		],
		[
			14,
			-47
		],
		[
			63,
			53
		],
		[
			-24,
			41
		],
		[
			-64,
			-4
		],
		[
			-3,
			37
		],
		[
			259,
			7
		],
		[
			86,
			-32
		],
		[
			272,
			-451
		],
		[
			-66,
			-281
		]
	],
	[
		[
			27089,
			16071
		],
		[
			-14,
			-38
		],
		[
			-10,
			-28
		],
		[
			-19,
			-54
		],
		[
			49,
			-32
		],
		[
			38,
			-26
		],
		[
			45,
			1
		],
		[
			-2,
			24
		],
		[
			188,
			8
		],
		[
			15,
			0
		],
		[
			28,
			1
		],
		[
			162,
			7
		],
		[
			9,
			-114
		],
		[
			11,
			-101
		],
		[
			4,
			-65
		],
		[
			-17,
			-2
		],
		[
			-112,
			-13
		],
		[
			-181,
			-22
		],
		[
			-103,
			-4
		],
		[
			-261,
			-10
		],
		[
			-31,
			-1
		],
		[
			-35,
			-4
		],
		[
			-25,
			-1
		],
		[
			-67,
			-3
		],
		[
			-72,
			-4
		],
		[
			-92,
			-4
		],
		[
			-89,
			-5
		],
		[
			71,
			-91
		],
		[
			13,
			-86
		],
		[
			16,
			-101
		],
		[
			12,
			-82
		],
		[
			10,
			-61
		],
		[
			22,
			-68
		],
		[
			58,
			-175
		],
		[
			86,
			-259
		],
		[
			55,
			-171
		],
		[
			39,
			-115
		],
		[
			27,
			-78
		],
		[
			97,
			-213
		],
		[
			55,
			-120
		],
		[
			24,
			-57
		],
		[
			56,
			-133
		],
		[
			7,
			0
		],
		[
			16,
			17
		],
		[
			-2,
			27
		],
		[
			19,
			0
		],
		[
			5,
			-29
		],
		[
			25,
			-35
		],
		[
			11,
			-137
		],
		[
			32,
			-93
		],
		[
			1,
			-34
		],
		[
			4,
			-23
		],
		[
			10,
			-8
		],
		[
			-11,
			-34
		],
		[
			74,
			-48
		],
		[
			2,
			-16
		],
		[
			-32,
			-10
		],
		[
			-27,
			-2
		],
		[
			-36,
			6
		],
		[
			-59,
			15
		],
		[
			-46,
			13
		],
		[
			-27,
			-27
		],
		[
			-59,
			-132
		],
		[
			-13,
			-27
		],
		[
			-155,
			-344
		],
		[
			-126,
			-297
		],
		[
			-13,
			-90
		]
	],
	[
		[
			18535,
			14533
		],
		[
			16,
			3
		],
		[
			6,
			1
		],
		[
			6,
			5
		],
		[
			29,
			23
		],
		[
			27,
			20
		],
		[
			11,
			9
		],
		[
			2,
			12
		],
		[
			-4,
			7
		],
		[
			-4,
			9
		],
		[
			-29,
			38
		],
		[
			-66,
			16
		],
		[
			-58,
			-25
		],
		[
			-27,
			-2
		],
		[
			-21,
			9
		],
		[
			-6,
			14
		],
		[
			3,
			28
		],
		[
			7,
			12
		],
		[
			14,
			13
		],
		[
			22,
			56
		],
		[
			5,
			12
		],
		[
			13,
			34
		],
		[
			0,
			39
		],
		[
			0,
			3
		],
		[
			4,
			50
		],
		[
			10,
			11
		],
		[
			23,
			6
		],
		[
			63,
			4
		],
		[
			49,
			-2
		],
		[
			21,
			-7
		],
		[
			37,
			14
		],
		[
			22,
			12
		],
		[
			9,
			10
		],
		[
			9,
			12
		],
		[
			8,
			8
		],
		[
			40,
			48
		],
		[
			10,
			14
		],
		[
			10,
			16
		],
		[
			8,
			21
		],
		[
			0,
			6
		],
		[
			0,
			11
		],
		[
			2,
			29
		],
		[
			9,
			105
		],
		[
			1,
			34
		],
		[
			0,
			11
		],
		[
			-7,
			48
		],
		[
			-11,
			59
		],
		[
			-98,
			24
		],
		[
			-76,
			3
		],
		[
			-9,
			5
		],
		[
			-12,
			27
		],
		[
			-7,
			30
		],
		[
			-1,
			18
		],
		[
			4,
			3
		],
		[
			6,
			5
		],
		[
			67,
			52
		],
		[
			43,
			25
		],
		[
			30,
			4
		],
		[
			24,
			7
		],
		[
			20,
			18
		],
		[
			14,
			19
		],
		[
			2,
			16
		],
		[
			-2,
			12
		],
		[
			-10,
			5
		],
		[
			-105,
			21
		],
		[
			-27,
			5
		],
		[
			2,
			24
		],
		[
			4,
			36
		],
		[
			2,
			79
		],
		[
			1,
			29
		],
		[
			-8,
			27
		],
		[
			-50,
			40
		],
		[
			-15,
			2
		],
		[
			-19,
			-11
		],
		[
			-10,
			-15
		],
		[
			-5,
			-8
		],
		[
			-7,
			0
		],
		[
			-53,
			-3
		],
		[
			-40,
			39
		],
		[
			-13,
			20
		],
		[
			-5,
			9
		],
		[
			11,
			55
		],
		[
			8,
			38
		],
		[
			2,
			22
		],
		[
			3,
			28
		],
		[
			1,
			18
		],
		[
			-3,
			8
		],
		[
			-10,
			25
		],
		[
			-8,
			18
		],
		[
			-1,
			2
		],
		[
			-45,
			67
		],
		[
			-31,
			20
		],
		[
			-3,
			2
		],
		[
			-22,
			14
		],
		[
			-40,
			-13
		],
		[
			-10,
			4
		],
		[
			-9,
			4
		],
		[
			-20,
			25
		],
		[
			-26,
			34
		],
		[
			2,
			21
		],
		[
			17,
			23
		],
		[
			6,
			9
		],
		[
			29,
			35
		],
		[
			41,
			19
		],
		[
			13,
			11
		],
		[
			19,
			16
		],
		[
			23,
			51
		],
		[
			22,
			51
		],
		[
			26,
			19
		],
		[
			24,
			31
		],
		[
			6,
			7
		],
		[
			1,
			1
		],
		[
			8,
			29
		],
		[
			5,
			45
		],
		[
			1,
			20
		],
		[
			-53,
			48
		],
		[
			-9,
			8
		],
		[
			-1,
			1
		],
		[
			-51,
			22
		],
		[
			-24,
			39
		],
		[
			0,
			10
		],
		[
			0,
			42
		],
		[
			18,
			52
		],
		[
			10,
			30
		],
		[
			12,
			32
		],
		[
			28,
			49
		],
		[
			14,
			24
		],
		[
			16,
			16
		],
		[
			4,
			3
		],
		[
			12,
			-1
		],
		[
			49,
			-12
		],
		[
			6,
			4
		],
		[
			17,
			9
		],
		[
			-18,
			71
		],
		[
			-57,
			98
		],
		[
			-11,
			34
		],
		[
			-18,
			59
		],
		[
			-2,
			8
		],
		[
			-27,
			112
		],
		[
			-2,
			19
		],
		[
			3,
			11
		],
		[
			11,
			6
		],
		[
			5,
			3
		],
		[
			42,
			2
		],
		[
			57,
			-6
		],
		[
			36,
			22
		],
		[
			2,
			1
		],
		[
			4,
			19
		],
		[
			20,
			87
		],
		[
			1,
			9
		],
		[
			3,
			44
		],
		[
			1,
			4
		],
		[
			6,
			34
		],
		[
			1,
			7
		],
		[
			4,
			16
		],
		[
			12,
			57
		],
		[
			7,
			30
		],
		[
			16,
			53
		],
		[
			13,
			43
		],
		[
			12,
			20
		],
		[
			43,
			30
		],
		[
			2,
			4
		],
		[
			23,
			40
		],
		[
			3,
			5
		],
		[
			2,
			76
		],
		[
			1,
			15
		],
		[
			0,
			19
		],
		[
			-1,
			6
		],
		[
			-3,
			15
		],
		[
			-12,
			39
		],
		[
			-15,
			34
		],
		[
			-13,
			24
		],
		[
			-15,
			52
		],
		[
			-13,
			42
		],
		[
			-9,
			31
		],
		[
			1,
			8
		],
		[
			0,
			1
		]
	],
	[
		[
			18648,
			18395
		],
		[
			214,
			51
		],
		[
			415,
			-51
		],
		[
			32,
			-4
		],
		[
			7,
			-125
		],
		[
			3,
			-53
		],
		[
			1,
			-23
		],
		[
			-6,
			-8
		],
		[
			-73,
			-82
		],
		[
			-22,
			-199
		],
		[
			20,
			0
		],
		[
			352,
			-12
		],
		[
			320,
			78
		],
		[
			89,
			-7
		],
		[
			33,
			-3
		],
		[
			164,
			104
		],
		[
			186,
			63
		],
		[
			-186,
			211
		],
		[
			54,
			239
		],
		[
			-198,
			488
		],
		[
			198,
			134
		],
		[
			306,
			70
		],
		[
			-129,
			49
		],
		[
			-22,
			138
		],
		[
			126,
			47
		],
		[
			135,
			-54
		],
		[
			25,
			24
		],
		[
			73,
			-127
		],
		[
			146,
			71
		],
		[
			78,
			38
		],
		[
			-7,
			-132
		],
		[
			215,
			-66
		],
		[
			33,
			-138
		],
		[
			145,
			-68
		],
		[
			50,
			-156
		],
		[
			62,
			-48
		],
		[
			178,
			-50
		],
		[
			73,
			-20
		],
		[
			5,
			38
		],
		[
			170,
			100
		],
		[
			366,
			-35
		],
		[
			-2,
			28
		],
		[
			34,
			-39
		],
		[
			-38,
			-106
		],
		[
			165,
			-10
		]
	],
	[
		[
			22438,
			18750
		],
		[
			-20,
			-355
		],
		[
			72,
			21
		],
		[
			-3,
			-545
		],
		[
			-45,
			4
		],
		[
			-27,
			-118
		],
		[
			-73,
			-583
		],
		[
			151,
			-9
		],
		[
			-82,
			-195
		],
		[
			42,
			-483
		],
		[
			-25,
			-98
		],
		[
			-143,
			-228
		],
		[
			-145,
			-68
		],
		[
			23,
			-365
		]
	],
	[
		[
			22438,
			18750
		],
		[
			2,
			48
		],
		[
			474,
			0
		],
		[
			25,
			37
		],
		[
			-34,
			159
		],
		[
			-139,
			146
		],
		[
			56,
			145
		],
		[
			22,
			296
		],
		[
			-37,
			169
		],
		[
			-78,
			60
		],
		[
			44,
			107
		],
		[
			213,
			59
		],
		[
			112,
			-165
		],
		[
			140,
			60
		],
		[
			68,
			-130
		],
		[
			229,
			117
		],
		[
			-27,
			53
		],
		[
			-51,
			100
		],
		[
			-7,
			14
		],
		[
			4,
			1
		],
		[
			27,
			10
		],
		[
			31,
			-40
		],
		[
			88,
			55
		],
		[
			-90,
			115
		],
		[
			146,
			101
		],
		[
			28,
			-35
		],
		[
			96,
			62
		],
		[
			353,
			229
		]
	],
	[
		[
			24133,
			20523
		],
		[
			107,
			-119
		],
		[
			-5,
			-52
		],
		[
			-144,
			-88
		],
		[
			87,
			-134
		],
		[
			233,
			204
		],
		[
			41,
			-34
		],
		[
			-68,
			-53
		],
		[
			70,
			-100
		],
		[
			157,
			-106
		],
		[
			105,
			-156
		],
		[
			64,
			1
		],
		[
			70,
			82
		],
		[
			90,
			-67
		],
		[
			81,
			-237
		],
		[
			-109,
			-1
		],
		[
			-6,
			-48
		],
		[
			240,
			-6
		],
		[
			25,
			-72
		],
		[
			106,
			-38
		],
		[
			26,
			-133
		],
		[
			68,
			-11
		],
		[
			75,
			56
		],
		[
			-109,
			44
		],
		[
			143,
			-6
		],
		[
			113,
			-116
		],
		[
			71,
			169
		],
		[
			-26,
			18
		],
		[
			91,
			79
		],
		[
			255,
			-200
		],
		[
			103,
			8
		],
		[
			120,
			-46
		],
		[
			-10,
			-26
		],
		[
			-68,
			21
		],
		[
			26,
			-39
		],
		[
			-52,
			-66
		],
		[
			69,
			-104
		],
		[
			130,
			-399
		],
		[
			71,
			-42
		],
		[
			97,
			91
		]
	],
	[
		[
			26470,
			18797
		],
		[
			117,
			113
		],
		[
			67,
			-125
		],
		[
			-24,
			-35
		],
		[
			21,
			-156
		],
		[
			172,
			-252
		],
		[
			50,
			25
		],
		[
			49,
			-100
		],
		[
			-21,
			-414
		],
		[
			310,
			74
		],
		[
			461,
			38
		],
		[
			282,
			-26
		],
		[
			0,
			-172
		],
		[
			-92,
			-67
		],
		[
			47,
			-7
		],
		[
			-2,
			-208
		],
		[
			66,
			-2
		],
		[
			38,
			-851
		],
		[
			-41,
			-6
		],
		[
			42,
			-53
		],
		[
			9,
			-132
		]
	],
	[
		[
			28021,
			16441
		],
		[
			3,
			-85
		],
		[
			-85,
			-3
		],
		[
			-42,
			-2
		],
		[
			-101,
			-6
		],
		[
			-19,
			0
		],
		[
			-20,
			1
		],
		[
			-10,
			0
		],
		[
			-5,
			-74
		],
		[
			1,
			-128
		],
		[
			-60,
			-3
		],
		[
			2,
			-41
		],
		[
			-202,
			-12
		],
		[
			-38,
			-1
		],
		[
			-78,
			-3
		],
		[
			-20,
			-1
		],
		[
			-115,
			-5
		],
		[
			-59,
			-3
		],
		[
			-84,
			-4
		]
	],
	[
		[
			36886,
			17657
		],
		[
			-3,
			-13
		],
		[
			-103,
			-61
		],
		[
			20,
			-71
		],
		[
			83,
			22
		],
		[
			8,
			2
		],
		[
			8,
			7
		],
		[
			22,
			17
		],
		[
			108,
			82
		],
		[
			9,
			7
		],
		[
			3,
			-8
		],
		[
			26,
			-60
		],
		[
			32,
			-74
		],
		[
			115,
			-21
		],
		[
			15,
			-3
		],
		[
			25,
			11
		],
		[
			22,
			10
		],
		[
			5,
			2
		],
		[
			-1,
			10
		],
		[
			-9,
			63
		],
		[
			-4,
			34
		],
		[
			36,
			7
		],
		[
			2,
			0
		],
		[
			5,
			-6
		],
		[
			35,
			-43
		],
		[
			8,
			-10
		],
		[
			-1,
			-8
		],
		[
			-6,
			-43
		],
		[
			-3,
			-20
		],
		[
			-176,
			-89
		],
		[
			-8,
			-4
		],
		[
			11,
			-13
		],
		[
			19,
			-21
		],
		[
			4,
			-4
		],
		[
			12,
			-2
		],
		[
			14,
			-3
		],
		[
			72,
			-16
		],
		[
			15,
			-2
		],
		[
			-13,
			0
		],
		[
			-116,
			2
		],
		[
			-23,
			0
		],
		[
			-2,
			0
		],
		[
			0,
			-4
		],
		[
			-4,
			-35
		],
		[
			0,
			-4
		],
		[
			5,
			-3
		],
		[
			126,
			-70
		],
		[
			112,
			17
		],
		[
			37,
			6
		],
		[
			4,
			0
		],
		[
			2,
			-2
		],
		[
			5,
			-4
		],
		[
			110,
			-106
		],
		[
			13,
			-60
		],
		[
			-3,
			-6
		],
		[
			-5,
			-9
		],
		[
			-13,
			-22
		],
		[
			-15,
			5
		],
		[
			-11,
			4
		],
		[
			-133,
			45
		],
		[
			0,
			3
		],
		[
			10,
			76
		],
		[
			-65,
			15
		],
		[
			-2,
			-4
		],
		[
			-47,
			-71
		],
		[
			-2,
			-3
		],
		[
			2,
			-4
		],
		[
			51,
			-122
		]
	],
	[
		[
			37329,
			16980
		],
		[
			5,
			-15
		],
		[
			15,
			-40
		],
		[
			3,
			-9
		],
		[
			6,
			-8
		],
		[
			9,
			-6
		],
		[
			7,
			-1
		],
		[
			8,
			0
		],
		[
			6,
			4
		],
		[
			6,
			10
		],
		[
			10,
			16
		],
		[
			11,
			18
		],
		[
			16,
			24
		],
		[
			11,
			10
		],
		[
			6,
			4
		],
		[
			6,
			1
		],
		[
			6,
			0
		],
		[
			4,
			-1
		],
		[
			5,
			-3
		],
		[
			3,
			-4
		],
		[
			8,
			-9
		],
		[
			11,
			-19
		],
		[
			8,
			-14
		],
		[
			5,
			-8
		],
		[
			8,
			-21
		],
		[
			8,
			-22
		],
		[
			6,
			-14
		],
		[
			6,
			-8
		],
		[
			4,
			-6
		],
		[
			10,
			-10
		],
		[
			19,
			-15
		],
		[
			15,
			-14
		],
		[
			28,
			-31
		],
		[
			13,
			-15
		],
		[
			10,
			-13
		],
		[
			1,
			-6
		],
		[
			-2,
			-5
		],
		[
			-7,
			-5
		],
		[
			-9,
			-3
		],
		[
			-9,
			-2
		],
		[
			-17,
			-3
		],
		[
			-28,
			-5
		],
		[
			-7,
			-2
		],
		[
			-5,
			-9
		],
		[
			-1,
			-19
		],
		[
			0,
			-7
		],
		[
			4,
			-14
		],
		[
			9,
			-12
		],
		[
			18,
			-13
		],
		[
			9,
			-5
		],
		[
			29,
			-15
		],
		[
			16,
			-5
		],
		[
			17,
			-4
		],
		[
			38,
			-10
		],
		[
			37,
			-12
		],
		[
			9,
			-3
		],
		[
			12,
			-8
		],
		[
			8,
			-6
		],
		[
			1,
			-3
		],
		[
			1,
			-8
		],
		[
			-2,
			-7
		],
		[
			-2,
			-4
		],
		[
			-14,
			-16
		],
		[
			-13,
			-8
		],
		[
			-22,
			-8
		],
		[
			-15,
			-4
		],
		[
			-11,
			-5
		],
		[
			-7,
			-5
		],
		[
			-5,
			-5
		],
		[
			-5,
			-9
		],
		[
			0,
			-10
		],
		[
			4,
			-10
		],
		[
			6,
			-10
		],
		[
			9,
			-9
		],
		[
			8,
			-7
		],
		[
			10,
			-6
		],
		[
			11,
			-5
		],
		[
			9,
			-3
		],
		[
			10,
			-3
		],
		[
			10,
			-1
		],
		[
			21,
			0
		],
		[
			34,
			3
		],
		[
			38,
			2
		],
		[
			54,
			2
		],
		[
			22,
			0
		],
		[
			14,
			-1
		],
		[
			4,
			-4
		],
		[
			4,
			-7
		],
		[
			1,
			-4
		],
		[
			-1,
			-5
		],
		[
			-3,
			-10
		],
		[
			-8,
			-15
		],
		[
			-12,
			-19
		],
		[
			-13,
			-20
		],
		[
			-14,
			-22
		],
		[
			-8,
			-13
		],
		[
			-2,
			-8
		],
		[
			1,
			-8
		],
		[
			7,
			-13
		],
		[
			11,
			-12
		],
		[
			13,
			-8
		],
		[
			18,
			-6
		],
		[
			32,
			-9
		],
		[
			17,
			-5
		],
		[
			8,
			-3
		],
		[
			11,
			-1
		],
		[
			12,
			-1
		],
		[
			13,
			3
		],
		[
			13,
			2
		],
		[
			16,
			3
		],
		[
			17,
			6
		],
		[
			20,
			7
		],
		[
			13,
			4
		],
		[
			7,
			-1
		],
		[
			6,
			-3
		],
		[
			5,
			-5
		],
		[
			1,
			-3
		],
		[
			-2,
			-8
		],
		[
			-3,
			-7
		],
		[
			-15,
			-12
		],
		[
			-18,
			-11
		],
		[
			-31,
			-19
		],
		[
			-25,
			-16
		],
		[
			-9,
			-8
		],
		[
			-3,
			-8
		],
		[
			1,
			-10
		],
		[
			9,
			-15
		],
		[
			11,
			-8
		],
		[
			13,
			-3
		],
		[
			11,
			0
		],
		[
			10,
			1
		],
		[
			20,
			3
		],
		[
			16,
			3
		],
		[
			21,
			6
		],
		[
			18,
			7
		],
		[
			21,
			10
		],
		[
			21,
			12
		],
		[
			18,
			13
		],
		[
			11,
			9
		],
		[
			12,
			11
		],
		[
			7,
			9
		],
		[
			11,
			13
		],
		[
			10,
			14
		],
		[
			10,
			15
		],
		[
			6,
			15
		],
		[
			3,
			13
		],
		[
			3,
			11
		],
		[
			3,
			19
		],
		[
			1,
			16
		],
		[
			1,
			26
		],
		[
			2,
			17
		],
		[
			2,
			5
		],
		[
			3,
			3
		],
		[
			4,
			3
		],
		[
			10,
			3
		],
		[
			9,
			1
		],
		[
			6,
			0
		],
		[
			10,
			-2
		],
		[
			9,
			-4
		],
		[
			6,
			-4
		],
		[
			11,
			-11
		],
		[
			4,
			-8
		],
		[
			2,
			-10
		],
		[
			1,
			-18
		],
		[
			-3,
			-16
		],
		[
			-4,
			-12
		],
		[
			-9,
			-15
		],
		[
			-14,
			-18
		],
		[
			-20,
			-22
		],
		[
			-15,
			-20
		],
		[
			-17,
			-25
		],
		[
			-14,
			-26
		],
		[
			-8,
			-23
		],
		[
			-8,
			-23
		],
		[
			-10,
			-15
		],
		[
			-10,
			-11
		],
		[
			-7,
			-9
		],
		[
			-2,
			-3
		],
		[
			-1,
			-5
		],
		[
			0,
			-3
		],
		[
			1,
			-5
		],
		[
			5,
			-4
		],
		[
			7,
			-3
		],
		[
			15,
			-2
		],
		[
			11,
			-1
		],
		[
			13,
			1
		],
		[
			8,
			0
		],
		[
			11,
			3
		],
		[
			10,
			3
		],
		[
			19,
			7
		],
		[
			10,
			4
		],
		[
			11,
			7
		],
		[
			10,
			9
		],
		[
			17,
			15
		],
		[
			13,
			15
		],
		[
			4,
			7
		],
		[
			18,
			32
		],
		[
			5,
			10
		],
		[
			3,
			9
		],
		[
			6,
			17
		],
		[
			4,
			12
		],
		[
			6,
			20
		],
		[
			3,
			8
		],
		[
			4,
			5
		],
		[
			5,
			4
		],
		[
			4,
			1
		],
		[
			6,
			1
		],
		[
			12,
			-1
		],
		[
			21,
			-7
		],
		[
			16,
			-6
		],
		[
			12,
			-6
		],
		[
			16,
			-10
		],
		[
			10,
			-7
		],
		[
			12,
			-8
		],
		[
			7,
			-4
		],
		[
			5,
			-2
		],
		[
			4,
			0
		],
		[
			5,
			3
		],
		[
			3,
			6
		],
		[
			1,
			6
		],
		[
			0,
			10
		],
		[
			-3,
			21
		],
		[
			-1,
			30
		],
		[
			-1,
			18
		],
		[
			2,
			29
		],
		[
			6,
			28
		],
		[
			4,
			13
		],
		[
			4,
			11
		],
		[
			2,
			4
		],
		[
			4,
			4
		],
		[
			6,
			3
		],
		[
			5,
			0
		],
		[
			7,
			-4
		],
		[
			6,
			-6
		],
		[
			8,
			-8
		],
		[
			3,
			-5
		],
		[
			9,
			-17
		],
		[
			18,
			-39
		],
		[
			9,
			-18
		],
		[
			7,
			-15
		],
		[
			5,
			-15
		],
		[
			2,
			-12
		],
		[
			-1,
			-18
		],
		[
			-4,
			-11
		],
		[
			-9,
			-12
		],
		[
			-16,
			-18
		],
		[
			-19,
			-18
		],
		[
			-10,
			-12
		],
		[
			-1,
			-6
		],
		[
			-1,
			-13
		],
		[
			2,
			-8
		],
		[
			8,
			-7
		],
		[
			8,
			-5
		],
		[
			9,
			-2
		],
		[
			10,
			1
		],
		[
			13,
			5
		],
		[
			20,
			10
		],
		[
			13,
			6
		],
		[
			9,
			5
		],
		[
			29,
			18
		],
		[
			13,
			8
		],
		[
			8,
			0
		],
		[
			8,
			-3
		],
		[
			5,
			-3
		],
		[
			3,
			-4
		],
		[
			1,
			-4
		],
		[
			-1,
			-7
		],
		[
			-5,
			-10
		],
		[
			-10,
			-12
		],
		[
			-8,
			-8
		],
		[
			-18,
			-14
		],
		[
			-24,
			-19
		],
		[
			-23,
			-19
		],
		[
			-19,
			-23
		],
		[
			-10,
			-12
		],
		[
			-6,
			-13
		],
		[
			-4,
			-11
		],
		[
			-2,
			-12
		],
		[
			-1,
			-27
		],
		[
			0,
			-23
		],
		[
			4,
			-24
		],
		[
			8,
			-25
		],
		[
			5,
			-10
		],
		[
			8,
			-10
		],
		[
			7,
			-8
		],
		[
			7,
			-4
		],
		[
			7,
			-3
		],
		[
			4,
			-4
		],
		[
			3,
			-7
		],
		[
			2,
			-19
		],
		[
			0,
			-12
		],
		[
			3,
			-7
		],
		[
			8,
			-12
		],
		[
			11,
			-10
		],
		[
			12,
			-11
		],
		[
			10,
			-7
		],
		[
			14,
			-7
		],
		[
			11,
			-4
		],
		[
			9,
			-1
		],
		[
			9,
			-1
		],
		[
			10,
			0
		],
		[
			17,
			2
		],
		[
			35,
			6
		],
		[
			19,
			4
		],
		[
			35,
			3
		],
		[
			25,
			3
		],
		[
			22,
			1
		],
		[
			23,
			-2
		],
		[
			11,
			-1
		],
		[
			13,
			-3
		],
		[
			10,
			-4
		],
		[
			9,
			-7
		],
		[
			5,
			-7
		],
		[
			4,
			-5
		],
		[
			4,
			-11
		],
		[
			1,
			-7
		],
		[
			1,
			-17
		],
		[
			-2,
			-13
		],
		[
			-5,
			-13
		],
		[
			-13,
			-12
		],
		[
			-10,
			-4
		],
		[
			-15,
			-1
		],
		[
			-18,
			1
		],
		[
			-47,
			2
		],
		[
			-37,
			1
		],
		[
			-60,
			0
		],
		[
			-34,
			-1
		],
		[
			-31,
			-2
		],
		[
			-18,
			-2
		],
		[
			-24,
			-5
		],
		[
			-13,
			-5
		],
		[
			-6,
			-4
		],
		[
			-3,
			-4
		],
		[
			-1,
			-7
		],
		[
			-1,
			-7
		],
		[
			1,
			-8
		],
		[
			4,
			-10
		],
		[
			2,
			-6
		],
		[
			7,
			-9
		],
		[
			13,
			-14
		],
		[
			10,
			-10
		],
		[
			10,
			-9
		],
		[
			11,
			-10
		],
		[
			23,
			-18
		],
		[
			21,
			-17
		],
		[
			16,
			-13
		],
		[
			16,
			-9
		],
		[
			16,
			-9
		],
		[
			16,
			-7
		],
		[
			9,
			-2
		],
		[
			6,
			-1
		],
		[
			7,
			2
		],
		[
			18,
			8
		],
		[
			14,
			6
		],
		[
			16,
			5
		],
		[
			15,
			4
		],
		[
			15,
			3
		],
		[
			17,
			0
		],
		[
			12,
			-1
		],
		[
			11,
			-2
		],
		[
			14,
			-4
		],
		[
			20,
			-6
		],
		[
			15,
			-7
		],
		[
			8,
			-4
		],
		[
			6,
			-5
		],
		[
			5,
			-6
		],
		[
			1,
			-4
		],
		[
			1,
			-5
		],
		[
			-1,
			-8
		],
		[
			-1,
			-8
		],
		[
			-6,
			-12
		],
		[
			-9,
			-14
		],
		[
			-13,
			-23
		],
		[
			-10,
			-20
		],
		[
			-7,
			-15
		],
		[
			-4,
			-16
		],
		[
			-1,
			-10
		],
		[
			-1,
			-15
		],
		[
			2,
			-9
		],
		[
			5,
			-8
		],
		[
			4,
			-5
		],
		[
			6,
			-2
		],
		[
			7,
			0
		],
		[
			47,
			0
		],
		[
			29,
			-1
		],
		[
			16,
			0
		],
		[
			15,
			1
		],
		[
			18,
			3
		],
		[
			29,
			5
		],
		[
			41,
			7
		],
		[
			28,
			5
		],
		[
			20,
			2
		],
		[
			15,
			2
		],
		[
			11,
			1
		],
		[
			12,
			1
		],
		[
			6,
			0
		],
		[
			13,
			-1
		],
		[
			23,
			0
		],
		[
			29,
			-1
		],
		[
			21,
			-1
		],
		[
			20,
			-2
		],
		[
			35,
			-2
		],
		[
			16,
			-1
		],
		[
			13,
			-1
		],
		[
			7,
			-4
		],
		[
			4,
			-4
		],
		[
			1,
			-7
		],
		[
			-1,
			-8
		],
		[
			-2,
			-5
		],
		[
			-4,
			-8
		],
		[
			-6,
			-6
		],
		[
			-5,
			-6
		],
		[
			-5,
			-5
		],
		[
			-6,
			-5
		],
		[
			-14,
			-9
		],
		[
			-13,
			-9
		],
		[
			-16,
			-9
		],
		[
			-9,
			-6
		],
		[
			-13,
			-7
		],
		[
			-5,
			-4
		],
		[
			-5,
			-6
		],
		[
			-4,
			-5
		],
		[
			-2,
			-7
		],
		[
			-2,
			-8
		],
		[
			-1,
			-9
		],
		[
			1,
			-27
		],
		[
			1,
			-17
		],
		[
			3,
			-24
		],
		[
			6,
			-19
		],
		[
			2,
			-6
		],
		[
			7,
			-12
		],
		[
			8,
			-8
		],
		[
			10,
			-6
		],
		[
			7,
			-2
		],
		[
			7,
			-1
		],
		[
			21,
			-1
		],
		[
			49,
			-2
		],
		[
			20,
			-1
		],
		[
			19,
			-2
		],
		[
			13,
			-2
		],
		[
			16,
			-4
		],
		[
			17,
			-6
		],
		[
			17,
			-7
		],
		[
			21,
			-10
		],
		[
			19,
			-7
		],
		[
			6,
			0
		],
		[
			5,
			2
		],
		[
			6,
			3
		],
		[
			5,
			5
		],
		[
			3,
			7
		],
		[
			2,
			7
		],
		[
			0,
			7
		],
		[
			-1,
			6
		],
		[
			-4,
			24
		],
		[
			-3,
			18
		],
		[
			-3,
			24
		],
		[
			-1,
			10
		],
		[
			1,
			13
		],
		[
			3,
			13
		],
		[
			3,
			11
		],
		[
			5,
			9
		],
		[
			8,
			7
		],
		[
			11,
			5
		],
		[
			14,
			3
		],
		[
			8,
			1
		],
		[
			9,
			-2
		],
		[
			7,
			-2
		],
		[
			7,
			-3
		],
		[
			5,
			-3
		],
		[
			14,
			-13
		],
		[
			10,
			-13
		],
		[
			5,
			-14
		],
		[
			7,
			-19
		],
		[
			5,
			-19
		],
		[
			6,
			-20
		],
		[
			7,
			-20
		],
		[
			7,
			-10
		],
		[
			8,
			-6
		],
		[
			8,
			-5
		],
		[
			11,
			0
		],
		[
			9,
			0
		],
		[
			9,
			3
		],
		[
			16,
			9
		],
		[
			6,
			5
		],
		[
			6,
			7
		],
		[
			4,
			6
		],
		[
			2,
			7
		],
		[
			3,
			19
		],
		[
			-1,
			15
		],
		[
			-2,
			9
		],
		[
			-3,
			10
		],
		[
			-10,
			22
		],
		[
			-12,
			18
		],
		[
			-15,
			17
		],
		[
			-19,
			19
		],
		[
			-15,
			16
		],
		[
			-13,
			14
		],
		[
			-5,
			10
		],
		[
			-3,
			6
		],
		[
			0,
			4
		],
		[
			2,
			5
		],
		[
			3,
			4
		],
		[
			5,
			3
		],
		[
			8,
			3
		],
		[
			6,
			1
		],
		[
			9,
			1
		],
		[
			12,
			0
		],
		[
			13,
			-3
		],
		[
			7,
			-2
		],
		[
			7,
			-3
		],
		[
			9,
			-5
		],
		[
			12,
			-10
		],
		[
			14,
			-18
		],
		[
			12,
			-18
		],
		[
			10,
			-25
		],
		[
			8,
			-25
		],
		[
			13,
			-46
		],
		[
			5,
			-19
		],
		[
			8,
			-16
		],
		[
			7,
			-8
		],
		[
			5,
			-3
		],
		[
			7,
			-1
		],
		[
			5,
			0
		],
		[
			5,
			2
		],
		[
			5,
			2
		],
		[
			3,
			4
		],
		[
			7,
			9
		],
		[
			7,
			14
		],
		[
			8,
			15
		],
		[
			7,
			11
		],
		[
			3,
			3
		],
		[
			6,
			3
		],
		[
			5,
			1
		],
		[
			4,
			-1
		],
		[
			7,
			-1
		],
		[
			17,
			-6
		],
		[
			21,
			-10
		],
		[
			23,
			-13
		],
		[
			19,
			-13
		],
		[
			33,
			-27
		],
		[
			12,
			-11
		],
		[
			25,
			-28
		],
		[
			25,
			-31
		],
		[
			22,
			-25
		],
		[
			16,
			-15
		],
		[
			31,
			-26
		],
		[
			13,
			-10
		],
		[
			4,
			-7
		],
		[
			3,
			-6
		],
		[
			0,
			-8
		],
		[
			-2,
			-7
		],
		[
			-9,
			-5
		],
		[
			-8,
			-4
		],
		[
			-16,
			-4
		],
		[
			-16,
			-6
		],
		[
			-10,
			-5
		],
		[
			-5,
			-7
		],
		[
			-2,
			-12
		],
		[
			1,
			-6
		],
		[
			2,
			-5
		],
		[
			5,
			-6
		],
		[
			21,
			-12
		],
		[
			21,
			-5
		],
		[
			38,
			1
		],
		[
			23,
			5
		],
		[
			21,
			7
		],
		[
			26,
			13
		],
		[
			18,
			13
		],
		[
			17,
			15
		],
		[
			14,
			16
		],
		[
			11,
			22
		],
		[
			5,
			22
		],
		[
			2,
			9
		],
		[
			2,
			35
		],
		[
			0,
			19
		],
		[
			0,
			31
		],
		[
			1,
			27
		],
		[
			3,
			21
		],
		[
			7,
			15
		],
		[
			7,
			7
		],
		[
			11,
			5
		],
		[
			24,
			6
		],
		[
			15,
			-1
		],
		[
			18,
			-3
		],
		[
			11,
			-6
		],
		[
			13,
			-8
		],
		[
			10,
			-11
		],
		[
			6,
			-12
		],
		[
			3,
			-15
		],
		[
			2,
			-26
		],
		[
			0,
			-30
		],
		[
			-2,
			-14
		],
		[
			-2,
			-31
		],
		[
			-1,
			-30
		],
		[
			3,
			-21
		],
		[
			3,
			-11
		],
		[
			8,
			-15
		],
		[
			10,
			-10
		],
		[
			10,
			-5
		],
		[
			-5,
			-3
		],
		[
			-4,
			-3
		],
		[
			-110,
			-68
		],
		[
			-78,
			-48
		],
		[
			-260,
			-156
		],
		[
			-188,
			-66
		],
		[
			-35,
			-79
		],
		[
			-80,
			-175
		],
		[
			-6,
			7
		],
		[
			-5,
			20
		],
		[
			-19,
			22
		],
		[
			-16,
			26
		],
		[
			-23,
			34
		],
		[
			4,
			15
		],
		[
			-39,
			34
		],
		[
			-6,
			6
		],
		[
			-45,
			43
		],
		[
			-24,
			23
		],
		[
			-116,
			109
		],
		[
			-148,
			29
		],
		[
			-414,
			-248
		],
		[
			-209,
			75
		],
		[
			-77,
			27
		],
		[
			-104,
			-85
		],
		[
			-80,
			35
		],
		[
			-20,
			9
		],
		[
			-51,
			22
		],
		[
			-344,
			151
		],
		[
			-67,
			49
		],
		[
			-177,
			-138
		],
		[
			-16,
			-12
		],
		[
			-19,
			-14
		],
		[
			-383,
			-299
		],
		[
			49,
			-299
		],
		[
			-238,
			124
		],
		[
			-60,
			30
		],
		[
			-89,
			45
		],
		[
			-19,
			12
		],
		[
			-79,
			40
		],
		[
			-53,
			30
		],
		[
			-446,
			240
		],
		[
			204,
			158
		],
		[
			-142,
			153
		],
		[
			-151,
			170
		],
		[
			-39,
			-31
		],
		[
			-84,
			89
		],
		[
			34,
			33
		],
		[
			-153,
			518
		],
		[
			-97,
			-27
		],
		[
			-206,
			258
		],
		[
			-9,
			12
		],
		[
			-15,
			6
		],
		[
			-26,
			12
		],
		[
			-36,
			16
		],
		[
			-13,
			5
		],
		[
			-103,
			-59
		],
		[
			-25,
			-14
		],
		[
			-27,
			-16
		],
		[
			-12,
			-6
		],
		[
			177,
			-365
		],
		[
			-126,
			-57
		],
		[
			40,
			-79
		],
		[
			-321,
			-76
		],
		[
			-30,
			-8
		],
		[
			-56,
			-15
		],
		[
			-153,
			-41
		],
		[
			-5,
			94
		],
		[
			-46,
			-14
		],
		[
			-29,
			170
		],
		[
			-200,
			-87
		],
		[
			-10,
			-4
		],
		[
			25,
			-144
		],
		[
			48,
			-277
		],
		[
			44,
			-224
		],
		[
			38,
			-190
		],
		[
			54,
			-341
		],
		[
			-33,
			-5
		],
		[
			-113,
			-19
		],
		[
			-92,
			-12
		],
		[
			-239,
			-33
		],
		[
			-161,
			-18
		],
		[
			-135,
			-20
		],
		[
			-18,
			-3
		],
		[
			-73,
			-11
		],
		[
			-35,
			145
		],
		[
			-227,
			-31
		],
		[
			-165,
			873
		],
		[
			-537,
			85
		],
		[
			-15,
			3
		],
		[
			-14,
			2
		],
		[
			-17,
			3
		],
		[
			-70,
			11
		],
		[
			-31,
			5
		],
		[
			-96,
			94
		],
		[
			-23,
			-15
		],
		[
			-13,
			-8
		],
		[
			-47,
			102
		],
		[
			-18,
			37
		],
		[
			-5,
			14
		],
		[
			-32,
			111
		],
		[
			-12,
			43
		],
		[
			10,
			11
		],
		[
			146,
			160
		],
		[
			46,
			50
		],
		[
			-46,
			44
		],
		[
			-51,
			47
		],
		[
			-58,
			55
		],
		[
			-8,
			8
		],
		[
			-59,
			55
		],
		[
			-169,
			158
		],
		[
			-23,
			21
		],
		[
			-24,
			23
		],
		[
			-8,
			7
		],
		[
			-12,
			12
		],
		[
			-25,
			23
		],
		[
			-28,
			27
		],
		[
			-110,
			103
		],
		[
			-55,
			-63
		],
		[
			-14,
			-18
		]
	],
	[
		[
			32364,
			16142
		],
		[
			-527,
			620
		],
		[
			365,
			286
		],
		[
			-248,
			429
		],
		[
			273,
			234
		],
		[
			-19,
			40
		],
		[
			276,
			-4
		],
		[
			37,
			43
		],
		[
			119,
			139
		],
		[
			134,
			71
		],
		[
			-15,
			28
		],
		[
			94,
			-25
		],
		[
			115,
			-213
		],
		[
			554,
			499
		],
		[
			-5,
			51
		],
		[
			-59,
			30
		],
		[
			158,
			70
		],
		[
			36,
			-63
		],
		[
			60,
			13
		],
		[
			13,
			-102
		],
		[
			80,
			12
		],
		[
			-31,
			98
		],
		[
			147,
			11
		],
		[
			52,
			-30
		],
		[
			24,
			-102
		],
		[
			116,
			-12
		],
		[
			-9,
			-37
		],
		[
			72,
			-56
		],
		[
			45,
			244
		],
		[
			93,
			59
		],
		[
			-28,
			140
		],
		[
			99,
			-30
		],
		[
			3,
			89
		],
		[
			0,
			3
		],
		[
			70,
			2
		],
		[
			13,
			166
		],
		[
			78,
			-28
		],
		[
			33,
			111
		],
		[
			111,
			98
		],
		[
			227,
			-9
		],
		[
			3,
			-1
		]
	],
	[
		[
			34923,
			19016
		],
		[
			124,
			11
		],
		[
			2,
			-2
		],
		[
			60,
			-59
		],
		[
			5,
			-1
		],
		[
			39,
			-9
		],
		[
			28,
			-6
		],
		[
			9,
			4
		],
		[
			32,
			15
		],
		[
			17,
			8
		],
		[
			2,
			6
		],
		[
			14,
			57
		],
		[
			3,
			17
		],
		[
			36,
			1
		],
		[
			3,
			0
		],
		[
			4,
			-6
		],
		[
			32,
			-57
		],
		[
			0,
			-1
		],
		[
			0,
			0
		],
		[
			-2,
			-11
		],
		[
			-26,
			-128
		],
		[
			0,
			0
		],
		[
			1,
			-1
		],
		[
			92,
			-22
		],
		[
			118,
			-107
		],
		[
			98,
			61
		],
		[
			10,
			6
		],
		[
			-8,
			17
		],
		[
			-17,
			36
		],
		[
			-20,
			41
		],
		[
			-5,
			10
		],
		[
			5,
			5
		],
		[
			39,
			49
		],
		[
			3,
			3
		],
		[
			12,
			-2
		],
		[
			40,
			-10
		],
		[
			16,
			-4
		],
		[
			19,
			-16
		],
		[
			22,
			-19
		],
		[
			61,
			-54
		],
		[
			6,
			-6
		],
		[
			6,
			7
		],
		[
			39,
			45
		],
		[
			2,
			2
		],
		[
			173,
			7
		],
		[
			18,
			1
		],
		[
			2,
			-6
		],
		[
			15,
			-37
		],
		[
			6,
			-16
		],
		[
			-1,
			-1
		],
		[
			0,
			-1
		],
		[
			-107,
			-256
		],
		[
			-2,
			-4
		],
		[
			3,
			1
		],
		[
			158,
			80
		],
		[
			53,
			26
		],
		[
			6,
			4
		],
		[
			1,
			-32
		],
		[
			1,
			-53
		],
		[
			0,
			-9
		],
		[
			-12,
			-3
		],
		[
			-74,
			-17
		],
		[
			-97,
			-22
		],
		[
			-3,
			-1
		],
		[
			1,
			-2
		],
		[
			101,
			-134
		],
		[
			8,
			-11
		],
		[
			6,
			3
		],
		[
			19,
			9
		],
		[
			65,
			31
		],
		[
			1,
			1
		],
		[
			2,
			-5
		],
		[
			32,
			-96
		],
		[
			1,
			-4
		],
		[
			-1,
			0
		],
		[
			-183,
			11
		],
		[
			-30,
			2
		],
		[
			-93,
			-63
		],
		[
			63,
			-54
		],
		[
			34,
			-28
		],
		[
			14,
			-13
		],
		[
			1,
			-5
		],
		[
			14,
			-60
		],
		[
			0,
			-3
		],
		[
			-6,
			3
		],
		[
			-95,
			49
		],
		[
			-61,
			32
		],
		[
			-4,
			2
		],
		[
			-1,
			0
		],
		[
			-76,
			-6
		],
		[
			0,
			0
		],
		[
			0,
			0
		],
		[
			43,
			-75
		],
		[
			18,
			-11
		],
		[
			82,
			-54
		],
		[
			12,
			-7
		],
		[
			-17,
			-6
		],
		[
			-56,
			-18
		],
		[
			-12,
			-4
		],
		[
			34,
			-43
		],
		[
			-5,
			-7
		],
		[
			-26,
			-31
		],
		[
			-12,
			-16
		],
		[
			-27,
			-9
		],
		[
			-19,
			-7
		],
		[
			-4,
			-2
		],
		[
			-80,
			30
		],
		[
			-1,
			1
		],
		[
			0,
			-2
		],
		[
			-23,
			-81
		],
		[
			-4,
			-16
		],
		[
			-2,
			-8
		],
		[
			-42,
			-23
		],
		[
			-8,
			4
		],
		[
			-63,
			30
		],
		[
			-2,
			-7
		],
		[
			-8,
			-33
		],
		[
			-1,
			-2
		],
		[
			9,
			-4
		],
		[
			229,
			-120
		],
		[
			19,
			-10
		],
		[
			31,
			-4
		],
		[
			207,
			-23
		],
		[
			3,
			-7
		],
		[
			9,
			-26
		],
		[
			15,
			-43
		],
		[
			1,
			-3
		],
		[
			11,
			-4
		],
		[
			207,
			-78
		],
		[
			13,
			-5
		],
		[
			2,
			3
		],
		[
			17,
			24
		],
		[
			21,
			30
		],
		[
			8,
			10
		],
		[
			51,
			-18
		],
		[
			3,
			-2
		],
		[
			-2,
			10
		],
		[
			-14,
			71
		],
		[
			-13,
			59
		],
		[
			-1,
			6
		],
		[
			6,
			12
		],
		[
			19,
			38
		],
		[
			1,
			3
		],
		[
			5,
			-2
		],
		[
			54,
			-33
		],
		[
			31,
			-18
		],
		[
			8,
			-16
		],
		[
			0,
			-1
		],
		[
			23,
			-49
		],
		[
			4,
			-7
		],
		[
			22,
			16
		],
		[
			-3,
			15
		],
		[
			-10,
			47
		],
		[
			-33,
			158
		],
		[
			-13,
			1
		],
		[
			-32,
			2
		],
		[
			-36,
			2
		],
		[
			52,
			49
		],
		[
			154,
			-68
		],
		[
			2,
			-1
		],
		[
			-1,
			-3
		],
		[
			-20,
			-57
		],
		[
			-30,
			-89
		],
		[
			25,
			-83
		],
		[
			2,
			-10
		],
		[
			4,
			4
		],
		[
			86,
			103
		],
		[
			4,
			4
		],
		[
			1,
			13
		],
		[
			5,
			52
		],
		[
			9,
			91
		],
		[
			0,
			5
		],
		[
			2,
			-1
		],
		[
			39,
			-16
		],
		[
			23,
			-9
		],
		[
			3,
			-7
		],
		[
			9,
			-24
		],
		[
			18,
			-50
		],
		[
			4,
			-10
		],
		[
			73,
			9
		],
		[
			2,
			0
		],
		[
			-5,
			-19
		],
		[
			-20,
			-79
		]
	],
	[
		[
			32904,
			21810
		],
		[
			114,
			-265
		],
		[
			-83,
			-28
		],
		[
			-9,
			-4
		],
		[
			3,
			-22
		],
		[
			8,
			-50
		],
		[
			43,
			-276
		],
		[
			2,
			-11
		],
		[
			-2,
			-13
		],
		[
			-12,
			-149
		],
		[
			-3,
			-36
		],
		[
			-2,
			-17
		],
		[
			11,
			-2
		],
		[
			96,
			-22
		],
		[
			15,
			-3
		],
		[
			10,
			-2
		],
		[
			7,
			-8
		],
		[
			6,
			-6
		],
		[
			38,
			-41
		]
	],
	[
		[
			33146,
			20855
		],
		[
			-94,
			9
		],
		[
			-17,
			2
		],
		[
			-44,
			4
		],
		[
			-1,
			1
		],
		[
			-20,
			1
		],
		[
			-23,
			-166
		],
		[
			0,
			-1
		],
		[
			-1,
			0
		],
		[
			-118,
			18
		],
		[
			-8,
			-7
		],
		[
			-1,
			0
		],
		[
			-59,
			-46
		],
		[
			-1,
			95
		],
		[
			0,
			144
		],
		[
			0,
			23
		],
		[
			0,
			27
		],
		[
			-144,
			10
		],
		[
			0,
			0
		],
		[
			-37,
			2
		],
		[
			1,
			2
		],
		[
			72,
			104
		],
		[
			-2,
			1
		],
		[
			-95,
			20
		],
		[
			0,
			4
		],
		[
			-4,
			56
		],
		[
			-20,
			9
		],
		[
			-62,
			29
		],
		[
			-14,
			6
		],
		[
			-20,
			-29
		],
		[
			-156,
			2
		],
		[
			-256,
			-74
		],
		[
			-77,
			102
		]
	],
	[
		[
			31945,
			21203
		],
		[
			17,
			147
		],
		[
			-138,
			159
		],
		[
			19,
			220
		],
		[
			156,
			-28
		],
		[
			310,
			39
		],
		[
			-63,
			224
		],
		[
			169,
			-166
		],
		[
			88,
			55
		],
		[
			106,
			12
		],
		[
			25,
			3
		],
		[
			17,
			2
		],
		[
			58,
			6
		],
		[
			0,
			0
		],
		[
			0,
			-1
		],
		[
			-22,
			-96
		],
		[
			13,
			1
		],
		[
			9,
			1
		],
		[
			23,
			1
		],
		[
			1,
			0
		],
		[
			1,
			-5
		],
		[
			2,
			-18
		],
		[
			4,
			-41
		],
		[
			2,
			53
		],
		[
			0,
			0
		],
		[
			120,
			29
		],
		[
			42,
			10
		]
	],
	[
		[
			26470,
			18797
		],
		[
			-50,
			72
		],
		[
			132,
			118
		],
		[
			-73,
			108
		],
		[
			35,
			117
		],
		[
			38,
			-5
		],
		[
			44,
			-75
		],
		[
			94,
			-25
		],
		[
			26,
			-84
		],
		[
			30,
			-2
		],
		[
			8,
			126
		],
		[
			32,
			22
		],
		[
			111,
			-96
		],
		[
			98,
			116
		],
		[
			129,
			-20
		],
		[
			32,
			32
		],
		[
			67,
			-60
		],
		[
			36,
			52
		],
		[
			60,
			-110
		],
		[
			234,
			368
		],
		[
			85,
			-117
		],
		[
			247,
			216
		],
		[
			267,
			233
		],
		[
			-76,
			109
		],
		[
			152,
			132
		]
	],
	[
		[
			28228,
			20024
		],
		[
			32,
			-43
		],
		[
			378,
			214
		],
		[
			53,
			-131
		],
		[
			214,
			121
		],
		[
			145,
			3
		],
		[
			137,
			-520
		],
		[
			54,
			13
		],
		[
			50,
			-166
		],
		[
			454,
			77
		],
		[
			99,
			17
		],
		[
			8,
			77
		],
		[
			41,
			6
		],
		[
			-115,
			402
		],
		[
			94,
			48
		],
		[
			-27,
			99
		],
		[
			100,
			35
		],
		[
			-31,
			111
		],
		[
			71,
			43
		],
		[
			71,
			-113
		],
		[
			597,
			216
		],
		[
			-71,
			198
		],
		[
			-192,
			2
		],
		[
			18,
			170
		],
		[
			279,
			-69
		],
		[
			-46,
			122
		],
		[
			257,
			-54
		],
		[
			-7,
			41
		],
		[
			56,
			-12
		],
		[
			-66,
			144
		],
		[
			32,
			11
		],
		[
			46,
			-48
		],
		[
			56,
			28
		],
		[
			83,
			-64
		],
		[
			139,
			59
		],
		[
			530,
			-91
		],
		[
			60,
			-10
		],
		[
			29,
			282
		],
		[
			89,
			-39
		]
	],
	[
		[
			33146,
			20855
		],
		[
			17,
			-40
		],
		[
			41,
			-98
		],
		[
			2,
			-5
		],
		[
			102,
			-49
		],
		[
			79,
			-38
		],
		[
			4,
			-2
		],
		[
			11,
			-1
		],
		[
			87,
			-5
		],
		[
			12,
			-1
		],
		[
			35,
			38
		],
		[
			2,
			99
		],
		[
			-8,
			17
		],
		[
			-40,
			77
		],
		[
			-19,
			37
		],
		[
			-9,
			16
		],
		[
			8,
			1
		],
		[
			24,
			4
		],
		[
			10,
			2
		],
		[
			4,
			-5
		],
		[
			96,
			-107
		],
		[
			16,
			-17
		],
		[
			7,
			-24
		],
		[
			42,
			-147
		],
		[
			4,
			-1
		],
		[
			18,
			-9
		],
		[
			13,
			-6
		],
		[
			0,
			9
		],
		[
			-1,
			221
		],
		[
			0,
			23
		],
		[
			0,
			12
		],
		[
			8,
			19
		],
		[
			24,
			51
		],
		[
			92,
			59
		],
		[
			147,
			-39
		],
		[
			7,
			2
		],
		[
			40,
			12
		],
		[
			6,
			2
		],
		[
			8,
			40
		],
		[
			8,
			48
		],
		[
			6,
			33
		],
		[
			-8,
			22
		],
		[
			-62,
			167
		],
		[
			-19,
			52
		],
		[
			-4,
			10
		],
		[
			6,
			2
		],
		[
			110,
			37
		],
		[
			2,
			1
		],
		[
			23,
			7
		],
		[
			8,
			6
		],
		[
			93,
			71
		],
		[
			55,
			41
		],
		[
			8,
			6
		],
		[
			21,
			-7
		],
		[
			27,
			-9
		],
		[
			22,
			-7
		],
		[
			4,
			-11
		],
		[
			3,
			-7
		],
		[
			8,
			-21
		],
		[
			-15,
			-10
		],
		[
			-76,
			-57
		],
		[
			-69,
			-51
		],
		[
			-13,
			-50
		],
		[
			-5,
			-18
		],
		[
			11,
			-14
		],
		[
			23,
			-32
		],
		[
			6,
			-8
		],
		[
			5,
			0
		],
		[
			115,
			-13
		],
		[
			8,
			-1
		],
		[
			5,
			3
		],
		[
			3,
			2
		],
		[
			172,
			98
		],
		[
			9,
			4
		],
		[
			7,
			-10
		],
		[
			40,
			-48
		],
		[
			-37,
			-91
		],
		[
			-4,
			-8
		],
		[
			-5,
			-14
		],
		[
			8,
			-12
		],
		[
			29,
			-41
		],
		[
			2,
			-4
		],
		[
			6,
			-1
		],
		[
			135,
			-30
		],
		[
			13,
			-2
		],
		[
			-41,
			176
		],
		[
			-3,
			12
		],
		[
			8,
			6
		],
		[
			9,
			6
		],
		[
			7,
			6
		],
		[
			11,
			-7
		],
		[
			215,
			-145
		],
		[
			4,
			-2
		],
		[
			0,
			-1
		],
		[
			5,
			-107
		],
		[
			1,
			-13
		],
		[
			-4,
			-3
		],
		[
			-86,
			-63
		],
		[
			-86,
			-63
		],
		[
			0,
			0
		],
		[
			0,
			0
		],
		[
			30,
			-34
		],
		[
			117,
			-134
		],
		[
			20,
			-22
		],
		[
			40,
			-14
		],
		[
			37,
			-14
		],
		[
			13,
			-4
		],
		[
			-83,
			-351
		],
		[
			-1,
			-5
		],
		[
			72,
			-271
		],
		[
			9,
			-36
		],
		[
			3,
			-9
		],
		[
			38,
			-5
		],
		[
			0,
			1
		],
		[
			3,
			3
		],
		[
			51,
			80
		],
		[
			7,
			11
		],
		[
			8,
			-10
		],
		[
			40,
			-52
		],
		[
			35,
			-45
		],
		[
			-2,
			-9
		],
		[
			-21,
			-120
		],
		[
			-2,
			-10
		],
		[
			49,
			-149
		],
		[
			29,
			-91
		],
		[
			5,
			-14
		],
		[
			-5,
			-11
		],
		[
			-72,
			-154
		],
		[
			-3,
			-5
		],
		[
			-3,
			-2
		],
		[
			-151,
			-100
		],
		[
			-35,
			-23
		],
		[
			-3,
			-2
		],
		[
			3,
			-80
		],
		[
			1,
			-9
		],
		[
			-65,
			-131
		]
	],
	[
		[
			32364,
			16142
		],
		[
			-208,
			-242
		],
		[
			-301,
			-349
		],
		[
			-125,
			-144
		],
		[
			142,
			-322
		],
		[
			-34,
			-13
		],
		[
			-231,
			523
		],
		[
			33,
			11
		],
		[
			-135,
			301
		],
		[
			-182,
			407
		],
		[
			-186,
			-106
		],
		[
			-41,
			-24
		],
		[
			6,
			-20
		],
		[
			7,
			-24
		],
		[
			1,
			-4
		],
		[
			24,
			-67
		],
		[
			38,
			-110
		],
		[
			-22,
			-22
		],
		[
			-40,
			-21
		],
		[
			43,
			-79
		],
		[
			-110,
			-54
		],
		[
			-14,
			3
		],
		[
			-54,
			-26
		],
		[
			-143,
			-60
		],
		[
			31,
			-49
		],
		[
			9,
			-70
		],
		[
			7,
			-22
		],
		[
			18,
			-17
		],
		[
			50,
			-120
		],
		[
			-143,
			-51
		],
		[
			62,
			-137
		],
		[
			92,
			-209
		],
		[
			55,
			-119
		],
		[
			-242,
			-100
		],
		[
			-77,
			138
		],
		[
			-356,
			-167
		],
		[
			-13,
			-12
		],
		[
			44,
			-62
		],
		[
			-56,
			-37
		],
		[
			-5,
			-3
		],
		[
			62,
			-88
		],
		[
			-39,
			-37
		],
		[
			-69,
			-63
		],
		[
			-33,
			-32
		],
		[
			-173,
			-144
		],
		[
			-305,
			108
		],
		[
			-69,
			27
		],
		[
			-12,
			24
		],
		[
			127,
			139
		],
		[
			79,
			84
		],
		[
			144,
			154
		],
		[
			40,
			42
		],
		[
			27,
			29
		],
		[
			29,
			31
		],
		[
			-6,
			21
		],
		[
			-10,
			21
		],
		[
			-10,
			9
		],
		[
			-8,
			7
		],
		[
			-38,
			30
		],
		[
			-23,
			19
		],
		[
			-23,
			16
		],
		[
			-17,
			13
		],
		[
			-17,
			13
		],
		[
			-6,
			7
		],
		[
			-38,
			60
		],
		[
			-14,
			24
		],
		[
			23,
			13
		],
		[
			23,
			14
		],
		[
			6,
			4
		],
		[
			-23,
			41
		],
		[
			-3,
			208
		],
		[
			-4,
			133
		],
		[
			-112,
			83
		],
		[
			331,
			281
		],
		[
			75,
			61
		],
		[
			-63,
			238
		],
		[
			-99,
			-15
		],
		[
			-16,
			139
		],
		[
			-43,
			724
		],
		[
			-1,
			27
		],
		[
			-2,
			36
		],
		[
			-83,
			-23
		],
		[
			-45,
			-12
		],
		[
			-60,
			-15
		],
		[
			-249,
			-63
		],
		[
			-337,
			-89
		],
		[
			-71,
			-16
		],
		[
			10,
			-270
		],
		[
			11,
			-186
		],
		[
			-121,
			-7
		],
		[
			-34,
			-1
		],
		[
			-590,
			-25
		],
		[
			-92,
			-3
		],
		[
			-94,
			-4
		],
		[
			-152,
			-6
		],
		[
			-70,
			-3
		]
	],
	[
		[
			18648,
			18395
		],
		[
			0,
			12
		],
		[
			-1,
			19
		],
		[
			-1,
			4
		],
		[
			-8,
			48
		],
		[
			-3,
			20
		],
		[
			-7,
			40
		],
		[
			-6,
			8
		],
		[
			-17,
			24
		],
		[
			-22,
			31
		],
		[
			-5,
			10
		],
		[
			-13,
			28
		],
		[
			-10,
			123
		],
		[
			0,
			73
		],
		[
			21,
			16
		],
		[
			6,
			5
		],
		[
			7,
			14
		],
		[
			2,
			23
		],
		[
			-1,
			2
		],
		[
			-5,
			24
		],
		[
			-36,
			96
		],
		[
			-1,
			2
		],
		[
			-3,
			5
		],
		[
			-23,
			36
		],
		[
			-9,
			4
		],
		[
			-25,
			11
		],
		[
			11,
			-33
		],
		[
			1,
			-12
		],
		[
			1,
			-6
		],
		[
			0,
			-23
		],
		[
			-7,
			-19
		],
		[
			-10,
			-5
		],
		[
			-11,
			0
		],
		[
			-21,
			3
		],
		[
			-20,
			14
		],
		[
			-19,
			21
		],
		[
			0,
			8
		],
		[
			0,
			2
		],
		[
			-3,
			49
		],
		[
			-1,
			32
		],
		[
			-16,
			67
		],
		[
			-5,
			20
		],
		[
			-1,
			1
		],
		[
			-33,
			19
		],
		[
			-27,
			16
		],
		[
			-12,
			14
		],
		[
			-17,
			19
		],
		[
			-5,
			19
		],
		[
			-5,
			23
		],
		[
			-4,
			19
		],
		[
			-6,
			27
		],
		[
			-2,
			9
		],
		[
			-11,
			63
		],
		[
			-11,
			58
		],
		[
			0,
			13
		],
		[
			-2,
			47
		],
		[
			0,
			7
		],
		[
			-10,
			40
		],
		[
			-10,
			18
		],
		[
			-11,
			13
		],
		[
			-18,
			20
		],
		[
			-45,
			49
		],
		[
			-3,
			3
		],
		[
			-30,
			17
		],
		[
			-37,
			22
		],
		[
			-24,
			6
		],
		[
			-25,
			7
		],
		[
			-39,
			11
		],
		[
			-18,
			9
		],
		[
			0,
			10
		],
		[
			0,
			12
		],
		[
			7,
			20
		],
		[
			8,
			15
		],
		[
			8,
			15
		],
		[
			10,
			8
		],
		[
			12,
			11
		],
		[
			11,
			1
		],
		[
			13,
			1
		],
		[
			23,
			-2
		],
		[
			6,
			8
		],
		[
			5,
			14
		],
		[
			-2,
			31
		],
		[
			-9,
			26
		],
		[
			-9,
			16
		],
		[
			-12,
			12
		],
		[
			-15,
			-1
		],
		[
			-3,
			-2
		],
		[
			-14,
			-8
		],
		[
			-15,
			-11
		],
		[
			-35,
			-15
		],
		[
			-15,
			2
		],
		[
			-18,
			12
		],
		[
			-4,
			7
		],
		[
			-17,
			31
		],
		[
			-17,
			43
		],
		[
			-5,
			18
		],
		[
			-10,
			32
		],
		[
			-8,
			19
		],
		[
			-14,
			31
		],
		[
			-6,
			13
		],
		[
			-2,
			6
		],
		[
			-12,
			28
		],
		[
			-6,
			13
		],
		[
			13,
			38
		],
		[
			5,
			15
		],
		[
			9,
			28
		],
		[
			9,
			27
		],
		[
			7,
			7
		],
		[
			1,
			1
		],
		[
			12,
			13
		],
		[
			3,
			3
		],
		[
			41,
			41
		],
		[
			-7,
			18
		],
		[
			-22,
			54
		],
		[
			-12,
			31
		],
		[
			-44,
			35
		],
		[
			-54,
			32
		],
		[
			-26,
			13
		],
		[
			-48,
			30
		],
		[
			-16,
			13
		],
		[
			-12,
			18
		],
		[
			-9,
			16
		],
		[
			10,
			11
		],
		[
			9,
			0
		],
		[
			66,
			0
		],
		[
			11,
			-2
		],
		[
			35,
			-6
		],
		[
			30,
			-5
		],
		[
			-12,
			24
		],
		[
			-27,
			58
		],
		[
			-47,
			43
		],
		[
			-16,
			14
		],
		[
			-5,
			4
		],
		[
			-9,
			5
		],
		[
			-9,
			4
		],
		[
			-13,
			6
		],
		[
			-30,
			-4
		],
		[
			-38,
			34
		],
		[
			-22,
			23
		],
		[
			-9,
			9
		],
		[
			-18,
			19
		],
		[
			-36,
			51
		],
		[
			-2,
			3
		],
		[
			-6,
			35
		],
		[
			-3,
			15
		],
		[
			-3,
			21
		],
		[
			-49,
			10
		],
		[
			-34,
			6
		],
		[
			-17,
			4
		],
		[
			-46,
			3
		],
		[
			-34,
			27
		],
		[
			-26,
			34
		],
		[
			-17,
			29
		],
		[
			-5,
			25
		],
		[
			-1,
			2
		],
		[
			-11,
			37
		],
		[
			-8,
			27
		],
		[
			-12,
			30
		],
		[
			-11,
			25
		],
		[
			-8,
			3
		],
		[
			-8,
			3
		],
		[
			-2,
			0
		],
		[
			-5,
			2
		],
		[
			-45,
			17
		],
		[
			-18,
			15
		],
		[
			-15,
			24
		],
		[
			-7,
			9
		],
		[
			-7,
			12
		],
		[
			0,
			20
		],
		[
			0,
			2
		],
		[
			15,
			44
		],
		[
			1,
			38
		],
		[
			0,
			11
		],
		[
			-5,
			106
		],
		[
			0,
			6
		],
		[
			-17,
			28
		],
		[
			-11,
			19
		],
		[
			-3,
			5
		],
		[
			-4,
			9
		],
		[
			-3,
			5
		],
		[
			-3,
			5
		],
		[
			38,
			92
		],
		[
			17,
			26
		],
		[
			16,
			12
		],
		[
			5,
			4
		],
		[
			16,
			1
		],
		[
			2,
			0
		],
		[
			29,
			0
		],
		[
			3,
			6
		],
		[
			11,
			19
		],
		[
			13,
			25
		],
		[
			-5,
			5
		],
		[
			-25,
			26
		],
		[
			-17,
			18
		],
		[
			-17,
			17
		],
		[
			-13,
			14
		],
		[
			-29,
			30
		],
		[
			-93,
			87
		],
		[
			-11,
			9
		],
		[
			-41,
			35
		],
		[
			-19,
			15
		],
		[
			-5,
			5
		],
		[
			15,
			20
		],
		[
			9,
			12
		],
		[
			23,
			31
		],
		[
			8,
			3
		],
		[
			91,
			36
		],
		[
			11,
			4
		],
		[
			-3,
			34
		],
		[
			-3,
			37
		],
		[
			0,
			3
		],
		[
			-5,
			68
		],
		[
			-2,
			27
		],
		[
			12,
			63
		],
		[
			-13,
			36
		],
		[
			-1,
			1
		],
		[
			-26,
			33
		],
		[
			-15,
			-1
		],
		[
			-74,
			-14
		],
		[
			-12,
			-2
		],
		[
			-42,
			2
		],
		[
			-55,
			3
		],
		[
			-25,
			1
		],
		[
			-6,
			6
		],
		[
			-1,
			1
		],
		[
			0,
			0
		],
		[
			-11,
			11
		],
		[
			-19,
			19
		],
		[
			-7,
			7
		],
		[
			-10,
			11
		],
		[
			-17,
			20
		],
		[
			-21,
			26
		],
		[
			-4,
			15
		],
		[
			-4,
			12
		],
		[
			4,
			6
		],
		[
			38,
			60
		],
		[
			3,
			6
		],
		[
			11,
			0
		],
		[
			2,
			0
		],
		[
			83,
			-17
		],
		[
			4,
			3
		],
		[
			59,
			57
		],
		[
			16,
			15
		],
		[
			39,
			29
		],
		[
			42,
			56
		],
		[
			36,
			62
		],
		[
			7,
			23
		],
		[
			-18,
			17
		],
		[
			-4,
			1
		],
		[
			-6,
			2
		]
	],
	[
		[
			17111,
			22904
		],
		[
			205,
			109
		],
		[
			90,
			-152
		],
		[
			162,
			40
		],
		[
			98,
			-98
		],
		[
			25,
			-113
		],
		[
			94,
			23
		],
		[
			72,
			47
		],
		[
			-100,
			117
		],
		[
			-67,
			18
		],
		[
			-33,
			74
		],
		[
			47,
			15
		],
		[
			-4,
			142
		],
		[
			102,
			-23
		],
		[
			61,
			37
		],
		[
			75,
			-106
		],
		[
			151,
			-15
		],
		[
			62,
			-6
		],
		[
			60,
			-180
		],
		[
			111,
			-101
		],
		[
			71,
			19
		],
		[
			45,
			-123
		],
		[
			120,
			44
		],
		[
			60,
			172
		],
		[
			-40,
			208
		],
		[
			44,
			209
		],
		[
			-37,
			82
		],
		[
			78,
			8
		],
		[
			-29,
			447
		],
		[
			54,
			313
		],
		[
			433,
			31
		],
		[
			1,
			-26
		],
		[
			37,
			18
		],
		[
			-28,
			45
		],
		[
			47,
			23
		],
		[
			144,
			-44
		],
		[
			106,
			-154
		],
		[
			169,
			174
		],
		[
			1,
			5
		],
		[
			16,
			44
		],
		[
			-277,
			335
		],
		[
			-52,
			389
		],
		[
			251,
			482
		]
	],
	[
		[
			19536,
			25433
		],
		[
			43,
			6
		],
		[
			31,
			-50
		],
		[
			15,
			-46
		],
		[
			-51,
			16
		],
		[
			-16,
			-56
		],
		[
			88,
			-93
		],
		[
			181,
			77
		],
		[
			37,
			-78
		],
		[
			25,
			31
		],
		[
			-44,
			66
		],
		[
			44,
			40
		],
		[
			-11,
			36
		],
		[
			48,
			9
		],
		[
			49,
			-178
		],
		[
			91,
			76
		],
		[
			89,
			-193
		],
		[
			42,
			10
		],
		[
			-31,
			82
		],
		[
			56,
			-16
		],
		[
			-17,
			31
		],
		[
			34,
			12
		],
		[
			-68,
			84
		],
		[
			-60,
			-4
		],
		[
			-44,
			74
		],
		[
			29,
			18
		],
		[
			107,
			-68
		],
		[
			67,
			58
		],
		[
			116,
			-128
		],
		[
			53,
			-147
		],
		[
			44,
			59
		],
		[
			-62,
			78
		],
		[
			19,
			16
		],
		[
			-77,
			222
		],
		[
			-21,
			19
		],
		[
			-44,
			-93
		],
		[
			-15,
			27
		],
		[
			-49,
			-12
		],
		[
			111,
			104
		],
		[
			119,
			-195
		],
		[
			317,
			-369
		],
		[
			245,
			290
		],
		[
			180,
			-135
		],
		[
			50,
			30
		],
		[
			47,
			-34
		]
	],
	[
		[
			21303,
			25109
		],
		[
			-140,
			-148
		],
		[
			137,
			-80
		],
		[
			15,
			-92
		],
		[
			261,
			-149
		],
		[
			66,
			-81
		],
		[
			115,
			-15
		],
		[
			122,
			-120
		],
		[
			-61,
			-48
		],
		[
			31,
			-45
		],
		[
			-98,
			-114
		],
		[
			31,
			-48
		],
		[
			-49,
			-39
		],
		[
			201,
			-132
		],
		[
			206,
			-52
		],
		[
			-5,
			-22
		],
		[
			-45,
			16
		],
		[
			-108,
			-122
		],
		[
			108,
			-110
		],
		[
			140,
			-55
		],
		[
			-19,
			-32
		],
		[
			83,
			-55
		],
		[
			-101,
			-226
		],
		[
			169,
			-227
		],
		[
			-24,
			-56
		],
		[
			50,
			-76
		],
		[
			81,
			167
		],
		[
			14,
			-41
		],
		[
			68,
			52
		],
		[
			69,
			3
		],
		[
			-35,
			-188
		],
		[
			73,
			-87
		],
		[
			24,
			14
		],
		[
			47,
			-74
		],
		[
			110,
			-43
		],
		[
			101,
			-108
		],
		[
			35,
			31
		],
		[
			29,
			-15
		],
		[
			30,
			-139
		],
		[
			40,
			-18
		],
		[
			49,
			66
		],
		[
			148,
			-93
		],
		[
			-91,
			-70
		],
		[
			52,
			-96
		],
		[
			-55,
			-47
		],
		[
			106,
			-112
		],
		[
			-85,
			-131
		],
		[
			213,
			-177
		],
		[
			125,
			67
		],
		[
			-76,
			160
		],
		[
			-80,
			-13
		],
		[
			95,
			143
		],
		[
			57,
			13
		],
		[
			117,
			-78
		],
		[
			60,
			63
		],
		[
			67,
			-91
		],
		[
			124,
			5
		],
		[
			7,
			-109
		],
		[
			33,
			7
		],
		[
			5,
			-68
		],
		[
			79,
			-76
		],
		[
			28,
			-139
		],
		[
			168,
			-166
		],
		[
			134,
			-249
		],
		[
			-33,
			-59
		],
		[
			-96,
			33
		],
		[
			-92,
			-49
		],
		[
			68,
			-183
		],
		[
			-28,
			-56
		],
		[
			-76,
			-44
		],
		[
			-115,
			10
		],
		[
			-69,
			-51
		],
		[
			42,
			-80
		],
		[
			124,
			-93
		],
		[
			125,
			-208
		],
		[
			-71,
			-41
		]
	],
	[
		[
			21303,
			25109
		],
		[
			321,
			-313
		],
		[
			43,
			29
		],
		[
			-19,
			48
		],
		[
			-55,
			60
		],
		[
			-47,
			0
		],
		[
			-58,
			98
		],
		[
			99,
			46
		],
		[
			24,
			33
		],
		[
			143,
			193
		],
		[
			32,
			-98
		],
		[
			107,
			-125
		],
		[
			-40,
			-104
		],
		[
			55,
			-116
		],
		[
			750,
			-666
		],
		[
			229,
			-266
		],
		[
			213,
			132
		],
		[
			-173,
			227
		],
		[
			-117,
			18
		],
		[
			-55,
			61
		],
		[
			20,
			37
		],
		[
			69,
			15
		],
		[
			88,
			-30
		],
		[
			37,
			54
		],
		[
			-163,
			106
		],
		[
			217,
			188
		],
		[
			50,
			-44
		],
		[
			91,
			44
		],
		[
			39,
			18
		],
		[
			16,
			-92
		],
		[
			59,
			-79
		],
		[
			176,
			75
		],
		[
			21,
			-156
		],
		[
			64,
			61
		]
	],
	[
		[
			23539,
			24563
		],
		[
			41,
			46
		],
		[
			111,
			-111
		],
		[
			-30,
			-55
		],
		[
			74,
			-58
		],
		[
			79,
			49
		],
		[
			141,
			-222
		],
		[
			85,
			29
		],
		[
			260,
			-314
		],
		[
			211,
			-372
		],
		[
			108,
			144
		],
		[
			93,
			-105
		],
		[
			56,
			51
		],
		[
			71,
			-54
		],
		[
			-96,
			-67
		],
		[
			8,
			-63
		],
		[
			95,
			35
		],
		[
			4,
			-102
		],
		[
			86,
			172
		],
		[
			108,
			-50
		],
		[
			103,
			-118
		],
		[
			129,
			-57
		],
		[
			17,
			-21
		],
		[
			-60,
			-110
		],
		[
			128,
			-48
		],
		[
			-17,
			-65
		],
		[
			55,
			-3
		],
		[
			-38,
			-294
		],
		[
			-34,
			-259
		],
		[
			248,
			-14
		],
		[
			-15,
			-308
		],
		[
			561,
			-145
		],
		[
			56,
			77
		],
		[
			84,
			-12
		],
		[
			80,
			-55
		],
		[
			126,
			-172
		],
		[
			127,
			-6
		],
		[
			53,
			37
		],
		[
			23,
			-49
		],
		[
			168,
			89
		],
		[
			89,
			-65
		],
		[
			499,
			-10
		]
	],
	[
		[
			27426,
			21908
		],
		[
			16,
			-116
		],
		[
			154,
			78
		],
		[
			167,
			-16
		],
		[
			1,
			121
		],
		[
			103,
			0
		],
		[
			41,
			60
		],
		[
			38,
			-107
		],
		[
			40,
			2
		],
		[
			6,
			104
		],
		[
			140,
			-30
		],
		[
			-42,
			-90
		],
		[
			41,
			-61
		],
		[
			-95,
			-51
		],
		[
			-67,
			51
		],
		[
			-31,
			-104
		],
		[
			70,
			-26
		],
		[
			102,
			52
		],
		[
			71,
			-82
		],
		[
			-33,
			-5
		],
		[
			-8,
			-44
		],
		[
			-91,
			-8
		],
		[
			-14,
			-39
		],
		[
			144,
			-191
		],
		[
			206,
			-106
		],
		[
			-125,
			-306
		],
		[
			38,
			-117
		],
		[
			60,
			-32
		],
		[
			122,
			-202
		],
		[
			-29,
			-13
		],
		[
			-96,
			-43
		],
		[
			-90,
			-41
		],
		[
			49,
			-89
		],
		[
			-56,
			-34
		],
		[
			85,
			-179
		],
		[
			-185,
			-113
		],
		[
			70,
			-107
		]
	],
	[
		[
			17111,
			22904
		],
		[
			-62,
			25
		],
		[
			-54,
			25
		],
		[
			-13,
			6
		],
		[
			-24,
			11
		],
		[
			-11,
			14
		],
		[
			-1,
			12
		],
		[
			17,
			11
		],
		[
			22,
			11
		],
		[
			14,
			-1
		],
		[
			13,
			-13
		],
		[
			1,
			-4
		],
		[
			2,
			-18
		],
		[
			10,
			-9
		],
		[
			22,
			3
		],
		[
			15,
			13
		],
		[
			2,
			17
		],
		[
			-9,
			14
		],
		[
			-4,
			7
		],
		[
			-3,
			3
		],
		[
			-25,
			21
		],
		[
			-39,
			10
		],
		[
			-132,
			7
		],
		[
			-41,
			4
		],
		[
			-15,
			14
		],
		[
			-15,
			23
		],
		[
			-6,
			23
		],
		[
			19,
			16
		],
		[
			12,
			3
		],
		[
			13,
			-2
		],
		[
			13,
			-17
		],
		[
			3,
			0
		],
		[
			38,
			8
		],
		[
			12,
			5
		],
		[
			12,
			5
		],
		[
			39,
			16
		],
		[
			13,
			10
		],
		[
			26,
			109
		],
		[
			-4,
			25
		],
		[
			-6,
			7
		],
		[
			-9,
			10
		],
		[
			-52,
			34
		],
		[
			-41,
			26
		],
		[
			-10,
			8
		],
		[
			-39,
			32
		],
		[
			-5,
			3
		],
		[
			-15,
			12
		],
		[
			-20,
			20
		],
		[
			-16,
			23
		],
		[
			-15,
			29
		],
		[
			0,
			12
		],
		[
			1,
			9
		],
		[
			13,
			14
		],
		[
			68,
			66
		],
		[
			7,
			8
		],
		[
			14,
			14
		],
		[
			65,
			70
		],
		[
			19,
			16
		],
		[
			16,
			20
		],
		[
			3,
			13
		],
		[
			-1,
			7
		],
		[
			-1,
			10
		],
		[
			-16,
			16
		],
		[
			-60,
			45
		],
		[
			-9,
			7
		],
		[
			-28,
			21
		],
		[
			-22,
			37
		],
		[
			-23,
			40
		],
		[
			-35,
			18
		],
		[
			-8,
			4
		],
		[
			-32,
			17
		],
		[
			-69,
			41
		],
		[
			-5,
			3
		],
		[
			-52,
			32
		],
		[
			-60,
			39
		],
		[
			-9,
			6
		],
		[
			-15,
			9
		],
		[
			-17,
			10
		],
		[
			-11,
			6
		],
		[
			-6,
			4
		],
		[
			-12,
			7
		],
		[
			-6,
			-4
		],
		[
			-5,
			-3
		],
		[
			-25,
			4
		],
		[
			-32,
			15
		],
		[
			-20,
			11
		],
		[
			-22,
			24
		],
		[
			-3,
			3
		],
		[
			-14,
			15
		],
		[
			-25,
			22
		],
		[
			-16,
			15
		],
		[
			-31,
			22
		],
		[
			-12,
			9
		],
		[
			-23,
			10
		],
		[
			-6,
			20
		],
		[
			3,
			11
		],
		[
			6,
			13
		],
		[
			5,
			12
		],
		[
			8,
			9
		],
		[
			22,
			29
		],
		[
			20,
			24
		],
		[
			36,
			17
		],
		[
			47,
			-9
		],
		[
			36,
			-38
		],
		[
			24,
			-34
		],
		[
			6,
			-8
		],
		[
			14,
			-5
		],
		[
			12,
			3
		],
		[
			7,
			18
		],
		[
			-4,
			16
		],
		[
			-16,
			67
		],
		[
			-39,
			66
		],
		[
			-4,
			6
		],
		[
			-13,
			6
		],
		[
			-10,
			-3
		],
		[
			-4,
			-1
		],
		[
			-42,
			10
		],
		[
			-13,
			12
		],
		[
			-32,
			29
		],
		[
			-27,
			27
		],
		[
			-12,
			10
		]
	],
	[
		[
			16248,
			24586
		],
		[
			119,
			-44
		],
		[
			18,
			54
		],
		[
			-73,
			49
		],
		[
			18,
			44
		],
		[
			141,
			5
		],
		[
			-116,
			332
		],
		[
			-239,
			5
		],
		[
			-223,
			5
		],
		[
			-27,
			123
		],
		[
			66,
			213
		],
		[
			-102,
			222
		],
		[
			-121,
			28
		],
		[
			35,
			117
		],
		[
			-12,
			138
		],
		[
			-189,
			118
		],
		[
			-16,
			5
		],
		[
			-297,
			101
		],
		[
			-17,
			115
		],
		[
			87,
			210
		],
		[
			56,
			53
		],
		[
			-70,
			33
		],
		[
			-6,
			40
		],
		[
			37,
			223
		],
		[
			-16,
			149
		],
		[
			193,
			26
		],
		[
			254,
			-56
		],
		[
			-4,
			115
		],
		[
			-32,
			35
		],
		[
			45,
			154
		],
		[
			-162,
			48
		],
		[
			-51,
			92
		],
		[
			-36,
			200
		],
		[
			80,
			374
		],
		[
			138,
			99
		],
		[
			182,
			27
		],
		[
			210,
			115
		],
		[
			265,
			43
		]
	],
	[
		[
			16383,
			28196
		],
		[
			50,
			-28
		],
		[
			-7,
			-60
		],
		[
			88,
			1
		],
		[
			53,
			-62
		],
		[
			-74,
			-46
		],
		[
			235,
			-78
		],
		[
			15,
			-47
		],
		[
			52,
			27
		],
		[
			36,
			-214
		],
		[
			84,
			-55
		],
		[
			75,
			-4
		],
		[
			20,
			-41
		],
		[
			35,
			30
		],
		[
			177,
			-27
		],
		[
			29,
			-144
		],
		[
			25,
			-119
		],
		[
			151,
			-22
		],
		[
			53,
			30
		],
		[
			140,
			-65
		],
		[
			214,
			-262
		],
		[
			21,
			44
		],
		[
			55,
			-52
		],
		[
			92,
			24
		],
		[
			23,
			66
		],
		[
			91,
			-67
		],
		[
			67,
			47
		],
		[
			61,
			-37
		],
		[
			46,
			13
		],
		[
			153,
			-106
		],
		[
			91,
			25
		],
		[
			152,
			-122
		],
		[
			13,
			20
		],
		[
			286,
			-113
		],
		[
			16,
			-139
		]
	],
	[
		[
			19001,
			26613
		],
		[
			-12,
			-81
		],
		[
			69,
			-45
		],
		[
			-111,
			-10
		],
		[
			12,
			-69
		],
		[
			-53,
			-13
		],
		[
			-23,
			-150
		],
		[
			-135,
			3
		],
		[
			-69,
			109
		],
		[
			-118,
			45
		],
		[
			-50,
			-302
		],
		[
			37,
			-9
		],
		[
			-18,
			-65
		],
		[
			50,
			-74
		],
		[
			42,
			40
		],
		[
			70,
			-48
		],
		[
			-57,
			-50
		],
		[
			125,
			-61
		],
		[
			41,
			-106
		],
		[
			88,
			-20
		],
		[
			62,
			-89
		],
		[
			103,
			15
		],
		[
			75,
			90
		],
		[
			171,
			60
		],
		[
			152,
			-62
		],
		[
			14,
			-187
		],
		[
			70,
			-101
		]
	],
	[
		[
			23539,
			24563
		],
		[
			-42,
			242
		],
		[
			-92,
			-14
		],
		[
			43,
			-47
		],
		[
			-35,
			-24
		],
		[
			-61,
			19
		],
		[
			-131,
			321
		],
		[
			-107,
			42
		],
		[
			-41,
			55
		],
		[
			95,
			67
		],
		[
			96,
			-33
		],
		[
			92,
			207
		],
		[
			56,
			18
		],
		[
			397,
			-29
		],
		[
			88,
			76
		],
		[
			149,
			-49
		],
		[
			-45,
			52
		],
		[
			-28,
			32
		],
		[
			-30,
			35
		],
		[
			39,
			51
		],
		[
			-79,
			128
		],
		[
			-118,
			136
		],
		[
			-83,
			65
		],
		[
			-122,
			95
		],
		[
			-44,
			34
		],
		[
			-107,
			145
		],
		[
			25,
			31
		],
		[
			-25,
			20
		],
		[
			17,
			18
		],
		[
			31,
			33
		],
		[
			157,
			-162
		],
		[
			150,
			-69
		],
		[
			67,
			-82
		],
		[
			212,
			-131
		],
		[
			210,
			-256
		],
		[
			-12,
			42
		],
		[
			82,
			103
		],
		[
			36,
			153
		],
		[
			158,
			180
		],
		[
			89,
			22
		],
		[
			-77,
			122
		]
	],
	[
		[
			24549,
			26211
		],
		[
			49,
			79
		],
		[
			168,
			-126
		],
		[
			63,
			111
		],
		[
			29,
			-6
		],
		[
			113,
			-112
		],
		[
			29,
			48
		],
		[
			120,
			-127
		],
		[
			256,
			-171
		],
		[
			25,
			211
		],
		[
			36,
			54
		],
		[
			35,
			-54
		],
		[
			50,
			54
		],
		[
			-65,
			123
		],
		[
			73,
			-16
		],
		[
			19,
			23
		],
		[
			-82,
			249
		],
		[
			-3,
			6
		],
		[
			99,
			-31
		],
		[
			54,
			22
		],
		[
			129,
			-72
		],
		[
			23,
			25
		],
		[
			81,
			-85
		],
		[
			109,
			35
		],
		[
			70,
			-68
		],
		[
			35,
			67
		],
		[
			101,
			-36
		],
		[
			-37,
			69
		],
		[
			56,
			-85
		],
		[
			-13,
			-107
		],
		[
			118,
			-7
		],
		[
			0,
			-19
		],
		[
			-4,
			-94
		],
		[
			27,
			-41
		],
		[
			38,
			6
		],
		[
			0,
			-24
		],
		[
			-84,
			-15
		],
		[
			3,
			-53
		],
		[
			151,
			-143
		],
		[
			-56,
			8
		],
		[
			-79,
			-102
		],
		[
			-76,
			7
		],
		[
			-45,
			-39
		],
		[
			-8,
			-89
		],
		[
			150,
			-10
		],
		[
			-2,
			-48
		],
		[
			-41,
			6
		],
		[
			-8,
			-106
		],
		[
			197,
			-15
		],
		[
			3,
			38
		],
		[
			105,
			-12
		],
		[
			57,
			212
		],
		[
			292,
			-52
		],
		[
			-104,
			131
		],
		[
			186,
			-45
		],
		[
			-30,
			-100
		],
		[
			64,
			-17
		],
		[
			59,
			88
		],
		[
			61,
			-53
		],
		[
			-28,
			-59
		],
		[
			310,
			-78
		],
		[
			139,
			145
		],
		[
			67,
			125
		],
		[
			16,
			0
		],
		[
			111,
			-3
		],
		[
			15,
			0
		],
		[
			13,
			8
		],
		[
			125,
			79
		],
		[
			20,
			13
		],
		[
			5,
			3
		],
		[
			2,
			-3
		],
		[
			77,
			-123
		],
		[
			32,
			14
		]
	],
	[
		[
			28049,
			25824
		],
		[
			5,
			-9
		],
		[
			59,
			-105
		],
		[
			13,
			-22
		],
		[
			179,
			-158
		],
		[
			68,
			-27
		],
		[
			22,
			-9
		],
		[
			4,
			-1
		],
		[
			218,
			-7
		],
		[
			-23,
			-87
		],
		[
			-5,
			-20
		],
		[
			-8,
			-29
		],
		[
			6,
			-3
		],
		[
			110,
			-53
		]
	],
	[
		[
			28697,
			25294
		],
		[
			2,
			-5
		],
		[
			15,
			-28
		],
		[
			-20,
			-34
		],
		[
			-49,
			-80
		],
		[
			-435,
			134
		],
		[
			-67,
			48
		],
		[
			-82,
			-12
		],
		[
			12,
			-102
		],
		[
			148,
			-38
		],
		[
			-46,
			-73
		],
		[
			-95,
			18
		],
		[
			-6,
			-37
		],
		[
			-81,
			10
		],
		[
			-3,
			-29
		],
		[
			-161,
			15
		],
		[
			21,
			123
		],
		[
			-153,
			20
		],
		[
			-22,
			-105
		],
		[
			-17,
			34
		],
		[
			-23,
			-92
		],
		[
			-61,
			-43
		],
		[
			-37,
			-27
		],
		[
			-37,
			-197
		],
		[
			-119,
			6
		],
		[
			0,
			31
		],
		[
			-145,
			-9
		],
		[
			-62,
			32
		],
		[
			18,
			84
		],
		[
			-225,
			14
		],
		[
			-6,
			-36
		],
		[
			62,
			-5
		],
		[
			-45,
			-219
		],
		[
			29,
			-38
		],
		[
			-62,
			-42
		],
		[
			22,
			-42
		],
		[
			-6,
			-3
		],
		[
			-46,
			-26
		],
		[
			148,
			-216
		],
		[
			-146,
			-54
		],
		[
			196,
			-149
		],
		[
			34,
			-42
		],
		[
			-19,
			-37
		],
		[
			148,
			-45
		]
	],
	[
		[
			27276,
			23998
		],
		[
			-80,
			-202
		],
		[
			36,
			-205
		],
		[
			-263,
			-15
		],
		[
			38,
			-264
		],
		[
			-209,
			-28
		],
		[
			-70,
			-79
		],
		[
			-3,
			-4
		],
		[
			201,
			-104
		],
		[
			74,
			-38
		],
		[
			259,
			-82
		],
		[
			349,
			-22
		],
		[
			0,
			-5
		],
		[
			22,
			-751
		],
		[
			-75,
			-1
		],
		[
			-24,
			-48
		],
		[
			170,
			-162
		],
		[
			-39,
			-108
		],
		[
			-15,
			132
		],
		[
			-99,
			-25
		],
		[
			-35,
			26
		],
		[
			-87,
			-105
		]
	],
	[
		[
			27276,
			23998
		],
		[
			113,
			-32
		],
		[
			49,
			-13
		],
		[
			-30,
			116
		],
		[
			-28,
			-30
		],
		[
			-37,
			73
		],
		[
			-54,
			188
		],
		[
			130,
			77
		],
		[
			-21,
			138
		],
		[
			33,
			51
		],
		[
			183,
			-205
		],
		[
			118,
			-35
		],
		[
			240,
			2
		],
		[
			314,
			52
		],
		[
			127,
			-185
		],
		[
			53,
			-218
		],
		[
			92,
			-64
		],
		[
			-97,
			-261
		],
		[
			73,
			-20
		],
		[
			27,
			88
		],
		[
			77,
			-21
		],
		[
			136,
			42
		],
		[
			-59,
			87
		],
		[
			86,
			74
		],
		[
			58,
			-92
		],
		[
			40,
			57
		],
		[
			36,
			-31
		],
		[
			78,
			67
		],
		[
			-67,
			124
		],
		[
			364,
			305
		],
		[
			-47,
			169
		],
		[
			111,
			-17
		],
		[
			237,
			98
		],
		[
			67,
			-33
		],
		[
			46,
			20
		],
		[
			87,
			-88
		],
		[
			10,
			56
		],
		[
			50,
			26
		],
		[
			117,
			-58
		],
		[
			-32,
			89
		],
		[
			77,
			-70
		],
		[
			34,
			39
		],
		[
			-32,
			79
		],
		[
			34,
			-22
		],
		[
			27,
			27
		],
		[
			47,
			-39
		],
		[
			98,
			99
		],
		[
			-140,
			29
		],
		[
			73,
			32
		],
		[
			-85,
			382
		],
		[
			339,
			824
		],
		[
			110,
			-20
		],
		[
			138,
			-133
		],
		[
			-126,
			163
		],
		[
			-116,
			65
		],
		[
			159,
			253
		],
		[
			97,
			-108
		],
		[
			1,
			0
		]
	],
	[
		[
			30691,
			26194
		],
		[
			-2,
			-6
		],
		[
			-8,
			-43
		],
		[
			-27,
			-135
		],
		[
			-7,
			-37
		],
		[
			-13,
			-63
		],
		[
			8,
			-13
		],
		[
			6,
			-9
		],
		[
			27,
			-44
		],
		[
			71,
			-64
		],
		[
			14,
			-5
		],
		[
			102,
			-38
		],
		[
			18,
			-6
		],
		[
			18,
			4
		],
		[
			235,
			60
		],
		[
			5,
			-1
		],
		[
			108,
			-23
		],
		[
			98,
			-143
		],
		[
			63,
			-246
		],
		[
			3,
			-14
		],
		[
			83,
			-141
		],
		[
			40,
			-68
		],
		[
			21,
			-19
		],
		[
			47,
			-43
		],
		[
			20,
			-18
		],
		[
			21,
			-2
		],
		[
			71,
			-10
		],
		[
			52,
			-7
		],
		[
			9,
			-1
		],
		[
			3,
			-7
		],
		[
			7,
			-15
		],
		[
			3,
			-5
		],
		[
			-9,
			-4
		],
		[
			-73,
			-37
		],
		[
			-4,
			-2
		],
		[
			-7,
			-4
		],
		[
			-50,
			-89
		],
		[
			-2,
			-127
		],
		[
			8,
			-10
		],
		[
			60,
			-81
		],
		[
			40,
			-53
		],
		[
			0,
			-1
		],
		[
			-1,
			-1
		],
		[
			-37,
			-72
		],
		[
			-9,
			-18
		],
		[
			-24,
			-8
		],
		[
			-34,
			-12
		],
		[
			-18,
			-6
		],
		[
			-162,
			55
		],
		[
			-4,
			30
		],
		[
			-13,
			80
		],
		[
			-8,
			51
		],
		[
			-42,
			27
		],
		[
			0,
			0
		],
		[
			-2,
			-2
		],
		[
			-31,
			-37
		],
		[
			-1,
			-2
		],
		[
			5,
			-11
		],
		[
			153,
			-358
		],
		[
			84,
			-196
		],
		[
			10,
			-24
		],
		[
			0,
			-1
		],
		[
			-14,
			-91
		],
		[
			0,
			-1
		],
		[
			-5,
			0
		],
		[
			-429,
			-31
		],
		[
			-33,
			-3
		],
		[
			-36,
			8
		],
		[
			-107,
			23
		],
		[
			-117,
			25
		],
		[
			-15,
			-13
		],
		[
			-25,
			-22
		],
		[
			-2,
			-16
		],
		[
			0,
			-1
		],
		[
			-8,
			-107
		],
		[
			-32,
			-35
		],
		[
			-9,
			-10
		],
		[
			-10,
			8
		],
		[
			-25,
			22
		],
		[
			-25,
			21
		],
		[
			2,
			4
		],
		[
			78,
			152
		],
		[
			-3,
			5
		],
		[
			-31,
			56
		],
		[
			-110,
			-61
		],
		[
			-11,
			-6
		],
		[
			-1,
			-14
		],
		[
			-6,
			-89
		],
		[
			-4,
			-61
		],
		[
			6,
			-17
		],
		[
			15,
			-38
		],
		[
			9,
			-22
		],
		[
			333,
			-446
		],
		[
			246,
			-187
		],
		[
			37,
			-17
		],
		[
			165,
			-77
		],
		[
			22,
			-11
		],
		[
			37,
			1
		],
		[
			104,
			3
		],
		[
			37,
			1
		],
		[
			18,
			8
		],
		[
			119,
			52
		],
		[
			0,
			0
		],
		[
			0,
			0
		],
		[
			238,
			271
		],
		[
			41,
			47
		],
		[
			48,
			54
		],
		[
			4,
			2
		],
		[
			103,
			50
		],
		[
			157,
			-22
		],
		[
			157,
			-166
		],
		[
			17,
			-3
		],
		[
			114,
			-24
		],
		[
			11,
			-3
		],
		[
			51,
			-92
		],
		[
			25,
			-168
		],
		[
			-96,
			-359
		],
		[
			-17,
			-61
		],
		[
			-17,
			-64
		],
		[
			-3,
			-14
		],
		[
			26,
			-60
		],
		[
			12,
			-28
		],
		[
			9,
			-19
		],
		[
			27,
			-11
		],
		[
			89,
			-36
		],
		[
			22,
			-9
		],
		[
			6,
			-3
		],
		[
			41,
			-154
		],
		[
			0,
			-5
		],
		[
			-12,
			-227
		],
		[
			1,
			-4
		],
		[
			57,
			-189
		],
		[
			7,
			-25
		]
	],
	[
		[
			28697,
			25294
		],
		[
			54,
			23
		],
		[
			1,
			1
		],
		[
			4,
			10
		],
		[
			24,
			65
		],
		[
			94,
			246
		],
		[
			68,
			31
		],
		[
			108,
			49
		],
		[
			11,
			5
		],
		[
			1,
			130
		],
		[
			1,
			30
		],
		[
			9,
			22
		],
		[
			77,
			176
		],
		[
			1,
			2
		],
		[
			2,
			1
		],
		[
			55,
			20
		],
		[
			3,
			1
		],
		[
			1,
			0
		],
		[
			54,
			-31
		],
		[
			8,
			-5
		],
		[
			0,
			-3
		],
		[
			30,
			-245
		],
		[
			5,
			-44
		],
		[
			2,
			-17
		],
		[
			4,
			4
		],
		[
			130,
			161
		],
		[
			2,
			3
		],
		[
			0,
			0
		],
		[
			19,
			139
		],
		[
			-107,
			432
		],
		[
			6,
			19
		],
		[
			27,
			99
		],
		[
			3,
			8
		],
		[
			13,
			4
		],
		[
			138,
			48
		],
		[
			187,
			-29
		],
		[
			103,
			-79
		],
		[
			42,
			-106
		],
		[
			27,
			-70
		],
		[
			4,
			-11
		],
		[
			6,
			5
		],
		[
			120,
			126
		],
		[
			30,
			89
		],
		[
			-25,
			63
		],
		[
			-101,
			44
		],
		[
			-12,
			5
		],
		[
			-7,
			3
		],
		[
			-11,
			49
		],
		[
			6,
			0
		],
		[
			93,
			-3
		],
		[
			169,
			-97
		]
	],
	[
		[
			30176,
			26667
		],
		[
			40,
			-29
		],
		[
			32,
			-23
		],
		[
			64,
			-45
		],
		[
			226,
			-161
		],
		[
			108,
			-76
		],
		[
			44,
			-138
		],
		[
			1,
			-1
		]
	],
	[
		[
			24549,
			26211
		],
		[
			-143,
			165
		],
		[
			127,
			126
		],
		[
			158,
			273
		],
		[
			-15,
			86
		],
		[
			-65,
			28
		],
		[
			26,
			53
		],
		[
			60,
			69
		],
		[
			19,
			22
		],
		[
			70,
			-53
		]
	],
	[
		[
			24786,
			26980
		],
		[
			86,
			-59
		],
		[
			186,
			257
		],
		[
			-210,
			236
		],
		[
			21,
			459
		],
		[
			-53,
			3
		],
		[
			-1,
			50
		],
		[
			58,
			-2
		],
		[
			8,
			148
		],
		[
			31,
			-7
		],
		[
			42,
			136
		],
		[
			78,
			-51
		],
		[
			2,
			66
		],
		[
			137,
			-45
		],
		[
			3,
			-78
		],
		[
			48,
			-10
		],
		[
			40,
			127
		],
		[
			233,
			-94
		],
		[
			96,
			10
		],
		[
			4,
			49
		],
		[
			45,
			-10
		],
		[
			3,
			-63
		],
		[
			159,
			-6
		],
		[
			0,
			49
		],
		[
			135,
			3
		],
		[
			61,
			253
		],
		[
			101,
			64
		],
		[
			77,
			-47
		],
		[
			109,
			84
		],
		[
			-35,
			49
		],
		[
			59,
			26
		],
		[
			-23,
			33
		],
		[
			146,
			1
		],
		[
			-22,
			77
		],
		[
			149,
			30
		],
		[
			44,
			-77
		],
		[
			77,
			62
		],
		[
			51,
			182
		],
		[
			311,
			-97
		],
		[
			218,
			0
		],
		[
			68,
			0
		],
		[
			-68,
			140
		],
		[
			28,
			38
		],
		[
			-16,
			82
		],
		[
			40,
			4
		],
		[
			-15,
			47
		],
		[
			61,
			-47
		],
		[
			-22,
			63
		],
		[
			36,
			-4
		],
		[
			54,
			-58
		],
		[
			49,
			83
		],
		[
			2,
			96
		],
		[
			93,
			26
		]
	],
	[
		[
			27570,
			29258
		],
		[
			39,
			-248
		],
		[
			132,
			16
		],
		[
			19,
			-116
		],
		[
			227,
			-30
		],
		[
			231,
			-208
		],
		[
			28,
			-492
		],
		[
			-83,
			-3
		],
		[
			-5,
			-7
		],
		[
			-120,
			-166
		],
		[
			-10,
			-13
		],
		[
			-5,
			-59
		],
		[
			76,
			-16
		],
		[
			109,
			-22
		],
		[
			40,
			-337
		],
		[
			300,
			34
		],
		[
			-38,
			71
		],
		[
			281,
			62
		],
		[
			-48,
			172
		],
		[
			-33,
			-88
		],
		[
			-184,
			-71
		],
		[
			-45,
			-1
		],
		[
			-14,
			53
		],
		[
			10,
			5
		],
		[
			125,
			65
		],
		[
			22,
			11
		],
		[
			45,
			44
		],
		[
			37,
			38
		],
		[
			72,
			71
		],
		[
			12,
			59
		],
		[
			2,
			8
		],
		[
			7,
			-2
		],
		[
			68,
			-18
		],
		[
			25,
			-7
		],
		[
			16,
			-14
		],
		[
			36,
			-32
		],
		[
			59,
			-52
		]
	],
	[
		[
			29003,
			27965
		],
		[
			2,
			-2
		],
		[
			122,
			-144
		],
		[
			5,
			-5
		],
		[
			24,
			-72
		],
		[
			46,
			-132
		],
		[
			13,
			-39
		],
		[
			14,
			-40
		],
		[
			14,
			-7
		],
		[
			85,
			-38
		],
		[
			16,
			-7
		],
		[
			16,
			-8
		],
		[
			1,
			-4
		],
		[
			4,
			-27
		]
	],
	[
		[
			29365,
			27440
		],
		[
			-15,
			-114
		],
		[
			-103,
			-227
		],
		[
			-3,
			-6
		],
		[
			-5,
			-6
		],
		[
			-83,
			-92
		],
		[
			-48,
			-53
		],
		[
			-33,
			-37
		],
		[
			-25,
			-47
		],
		[
			-3,
			-6
		],
		[
			-89,
			-167
		],
		[
			-8,
			-16
		],
		[
			-19,
			-17
		],
		[
			-137,
			-126
		],
		[
			-56,
			-17
		],
		[
			-153,
			-48
		],
		[
			-129,
			-40
		],
		[
			-100,
			-236
		],
		[
			-10,
			-25
		],
		[
			-215,
			-208
		],
		[
			-13,
			-12
		],
		[
			-21,
			-21
		],
		[
			-4,
			-7
		],
		[
			-28,
			-55
		],
		[
			-16,
			-33
		]
	],
	[
		[
			19001,
			26613
		],
		[
			126,
			35
		],
		[
			139,
			-30
		],
		[
			105,
			40
		],
		[
			46,
			-36
		],
		[
			21,
			24
		],
		[
			46,
			-18
		],
		[
			40,
			69
		],
		[
			109,
			190
		],
		[
			179,
			-118
		],
		[
			49,
			-100
		],
		[
			43,
			34
		],
		[
			-48,
			78
		],
		[
			124,
			70
		],
		[
			70,
			2
		],
		[
			212,
			-125
		],
		[
			46,
			10
		],
		[
			202,
			329
		],
		[
			119,
			-100
		],
		[
			59,
			33
		],
		[
			-109,
			136
		],
		[
			97,
			103
		],
		[
			15,
			16
		],
		[
			-152,
			133
		],
		[
			149,
			180
		],
		[
			94,
			-74
		],
		[
			-27,
			-33
		],
		[
			43,
			-30
		],
		[
			25,
			30
		],
		[
			79,
			-118
		],
		[
			264,
			-224
		],
		[
			41,
			30
		],
		[
			-19,
			50
		],
		[
			42,
			-34
		],
		[
			97,
			77
		],
		[
			-163,
			318
		],
		[
			101,
			79
		],
		[
			-28,
			66
		],
		[
			63,
			50
		],
		[
			68,
			-72
		],
		[
			60,
			43
		],
		[
			-190,
			199
		],
		[
			-80,
			144
		],
		[
			48,
			28
		],
		[
			-162,
			188
		],
		[
			88,
			9
		],
		[
			-4,
			47
		],
		[
			-141,
			41
		],
		[
			-70,
			-57
		],
		[
			-14,
			39
		],
		[
			-59,
			-3
		],
		[
			-8,
			35
		],
		[
			-5,
			17
		],
		[
			-37,
			10
		],
		[
			-20,
			91
		],
		[
			91,
			31
		],
		[
			16,
			-76
		],
		[
			39,
			14
		],
		[
			0,
			82
		],
		[
			107,
			23
		],
		[
			8,
			-79
		],
		[
			71,
			10
		],
		[
			4,
			63
		],
		[
			68,
			-69
		],
		[
			-45,
			105
		],
		[
			28,
			15
		],
		[
			65,
			-56
		],
		[
			31,
			148
		],
		[
			219,
			-51
		],
		[
			7,
			126
		],
		[
			-168,
			67
		],
		[
			-6,
			89
		],
		[
			-104,
			34
		],
		[
			17,
			22
		],
		[
			67,
			88
		],
		[
			81,
			-70
		],
		[
			-11,
			-44
		],
		[
			143,
			-100
		],
		[
			83,
			84
		],
		[
			23,
			-20
		],
		[
			29,
			26
		],
		[
			98,
			-91
		],
		[
			24,
			81
		],
		[
			-103,
			116
		],
		[
			43,
			23
		],
		[
			214,
			-103
		],
		[
			30,
			-43
		],
		[
			148,
			-7
		],
		[
			30,
			-33
		],
		[
			67,
			33
		],
		[
			-64,
			157
		],
		[
			-130,
			89
		],
		[
			-10,
			68
		],
		[
			-110,
			11
		],
		[
			30,
			46
		]
	],
	[
		[
			21904,
			29323
		],
		[
			94,
			-7
		],
		[
			92,
			-103
		],
		[
			77,
			26
		],
		[
			-6,
			49
		],
		[
			52,
			10
		],
		[
			22,
			-41
		],
		[
			-35,
			-52
		],
		[
			39,
			-29
		],
		[
			149,
			75
		],
		[
			9,
			-63
		],
		[
			120,
			5
		],
		[
			-28,
			77
		],
		[
			-2,
			6
		],
		[
			103,
			28
		],
		[
			4,
			-14
		],
		[
			7,
			-28
		],
		[
			103,
			79
		],
		[
			169,
			43
		],
		[
			40,
			-189
		],
		[
			-5,
			-319
		],
		[
			-57,
			3
		],
		[
			43,
			-102
		],
		[
			78,
			-73
		],
		[
			276,
			-16
		],
		[
			190,
			-237
		],
		[
			-26,
			-40
		],
		[
			-62,
			63
		],
		[
			-67,
			-59
		],
		[
			115,
			-111
		],
		[
			-56,
			-82
		],
		[
			194,
			-147
		],
		[
			-36,
			-79
		],
		[
			86,
			-48
		],
		[
			-39,
			-58
		],
		[
			158,
			-202
		],
		[
			32,
			130
		],
		[
			73,
			-2
		],
		[
			141,
			116
		],
		[
			107,
			-90
		],
		[
			65,
			30
		],
		[
			12,
			-52
		],
		[
			116,
			4
		],
		[
			-10,
			-139
		],
		[
			-40,
			4
		],
		[
			-20,
			-68
		],
		[
			64,
			-168
		],
		[
			119,
			-90
		],
		[
			230,
			102
		],
		[
			104,
			-322
		],
		[
			69,
			36
		],
		[
			73,
			-140
		],
		[
			-54,
			-59
		]
	],
	[
		[
			16248,
			24586
		],
		[
			-54,
			0
		],
		[
			-13,
			1
		],
		[
			-16,
			0
		],
		[
			-32,
			-19
		],
		[
			-13,
			-20
		],
		[
			-2,
			-19
		],
		[
			1,
			-4
		],
		[
			4,
			-18
		],
		[
			-1,
			-15
		],
		[
			-15,
			-14
		],
		[
			-28,
			-5
		],
		[
			-22,
			1
		],
		[
			-8,
			0
		],
		[
			-4,
			1
		],
		[
			-15,
			1
		],
		[
			-57,
			30
		],
		[
			-45,
			23
		],
		[
			-34,
			11
		],
		[
			-10,
			4
		],
		[
			-64,
			21
		],
		[
			-10,
			29
		],
		[
			-1,
			2
		],
		[
			-11,
			31
		],
		[
			3,
			20
		],
		[
			-2,
			16
		],
		[
			-14,
			17
		],
		[
			-21,
			19
		],
		[
			-29,
			11
		],
		[
			-9,
			-4
		],
		[
			-12,
			-6
		],
		[
			-14,
			-20
		],
		[
			-1,
			-24
		],
		[
			-17,
			-7
		],
		[
			-33,
			9
		],
		[
			-46,
			27
		],
		[
			-18,
			27
		],
		[
			-3,
			4
		],
		[
			-8,
			26
		],
		[
			-33,
			40
		],
		[
			-14,
			13
		],
		[
			-22,
			19
		],
		[
			-104,
			27
		],
		[
			-8,
			2
		],
		[
			-44,
			2
		],
		[
			-47,
			2
		],
		[
			-21,
			0
		],
		[
			-30,
			20
		],
		[
			-5,
			3
		],
		[
			-31,
			21
		],
		[
			-6,
			4
		],
		[
			-3,
			14
		],
		[
			13,
			22
		],
		[
			36,
			21
		],
		[
			39,
			18
		],
		[
			9,
			2
		],
		[
			12,
			-6
		],
		[
			32,
			-12
		],
		[
			30,
			6
		],
		[
			14,
			11
		],
		[
			-2,
			25
		],
		[
			-14,
			19
		],
		[
			-4,
			1
		],
		[
			-21,
			9
		],
		[
			-32,
			14
		],
		[
			-1,
			1
		],
		[
			-3,
			1
		],
		[
			-113,
			43
		],
		[
			-1,
			0
		],
		[
			-40,
			8
		],
		[
			-75,
			14
		],
		[
			-43,
			3
		],
		[
			-14,
			2
		],
		[
			-101,
			68
		],
		[
			-2,
			1
		],
		[
			-42,
			25
		],
		[
			-50,
			31
		],
		[
			-81,
			36
		],
		[
			-28,
			12
		],
		[
			-38,
			17
		],
		[
			-3,
			8
		],
		[
			-18,
			40
		],
		[
			-11,
			71
		],
		[
			-20,
			42
		],
		[
			-11,
			15
		],
		[
			-11,
			15
		],
		[
			-28,
			39
		],
		[
			-12,
			6
		],
		[
			-8,
			0
		],
		[
			-5,
			0
		],
		[
			-27,
			-12
		],
		[
			-25,
			-1
		],
		[
			-29,
			16
		],
		[
			-13,
			21
		],
		[
			1,
			2
		],
		[
			3,
			15
		],
		[
			28,
			93
		],
		[
			-5,
			3
		],
		[
			-26,
			18
		],
		[
			-30,
			20
		],
		[
			-1,
			0
		],
		[
			-27,
			20
		],
		[
			0,
			4
		],
		[
			-2,
			15
		],
		[
			-1,
			13
		],
		[
			7,
			11
		],
		[
			8,
			11
		],
		[
			-1,
			15
		],
		[
			-13,
			7
		],
		[
			-6,
			3
		],
		[
			-69,
			0
		],
		[
			-7,
			-9
		],
		[
			-9,
			-13
		],
		[
			-23,
			-31
		],
		[
			-2,
			-7
		],
		[
			-2,
			-8
		],
		[
			-20,
			-8
		],
		[
			-24,
			0
		],
		[
			-36,
			27
		],
		[
			-25,
			31
		],
		[
			-7,
			21
		],
		[
			4,
			8
		],
		[
			11,
			21
		],
		[
			-26,
			30
		],
		[
			-10,
			13
		],
		[
			-91,
			18
		],
		[
			-103,
			13
		],
		[
			-38,
			20
		],
		[
			-5,
			2
		],
		[
			-32,
			35
		],
		[
			-11,
			17
		],
		[
			-13,
			21
		],
		[
			-2,
			3
		],
		[
			-9,
			16
		],
		[
			2,
			6
		],
		[
			1,
			8
		],
		[
			18,
			12
		],
		[
			98,
			38
		],
		[
			17,
			-9
		],
		[
			25,
			-14
		],
		[
			6,
			-3
		],
		[
			36,
			-21
		],
		[
			21,
			-11
		],
		[
			17,
			-3
		],
		[
			20,
			13
		],
		[
			25,
			25
		],
		[
			11,
			38
		],
		[
			1,
			6
		],
		[
			-6,
			20
		],
		[
			-7,
			18
		],
		[
			-40,
			45
		],
		[
			-11,
			9
		],
		[
			-44,
			36
		],
		[
			-15,
			-2
		],
		[
			-3,
			-3
		],
		[
			-14,
			-12
		],
		[
			-38,
			-22
		],
		[
			-39,
			-3
		],
		[
			-26,
			5
		],
		[
			-11,
			4
		],
		[
			-44,
			14
		],
		[
			-26,
			9
		],
		[
			-60,
			36
		],
		[
			-18,
			11
		],
		[
			-6,
			1
		],
		[
			-27,
			3
		],
		[
			-53,
			-7
		],
		[
			-62,
			-3
		],
		[
			-47,
			7
		],
		[
			-77,
			30
		],
		[
			-63,
			8
		],
		[
			-28,
			0
		],
		[
			-27,
			12
		],
		[
			-18,
			21
		],
		[
			-4,
			22
		],
		[
			6,
			3
		],
		[
			14,
			9
		],
		[
			28,
			-1
		],
		[
			39,
			-12
		],
		[
			48,
			-17
		],
		[
			55,
			-20
		],
		[
			18,
			1
		],
		[
			14,
			14
		],
		[
			0,
			32
		],
		[
			-53,
			77
		],
		[
			-19,
			6
		],
		[
			-19,
			-11
		],
		[
			-1,
			0
		],
		[
			-37,
			-31
		],
		[
			-21,
			-4
		],
		[
			-24,
			10
		],
		[
			-10,
			25
		],
		[
			9,
			29
		],
		[
			32,
			39
		],
		[
			27,
			7
		],
		[
			40,
			-8
		],
		[
			44,
			-8
		],
		[
			46,
			9
		],
		[
			2,
			42
		],
		[
			7,
			12
		],
		[
			8,
			13
		],
		[
			20,
			18
		],
		[
			44,
			42
		],
		[
			-1,
			46
		],
		[
			-9,
			7
		],
		[
			-22,
			17
		],
		[
			-26,
			12
		],
		[
			-5,
			3
		],
		[
			-44,
			25
		],
		[
			-18,
			10
		],
		[
			-14,
			14
		],
		[
			0,
			6
		],
		[
			-2,
			33
		],
		[
			20,
			98
		],
		[
			2,
			8
		],
		[
			1,
			2
		],
		[
			6,
			22
		],
		[
			5,
			9
		],
		[
			29,
			58
		],
		[
			-4,
			47
		],
		[
			-9,
			3
		],
		[
			-25,
			8
		],
		[
			-28,
			-12
		],
		[
			-31,
			-6
		],
		[
			-56,
			23
		],
		[
			-21,
			26
		],
		[
			-1,
			9
		],
		[
			-4,
			65
		],
		[
			9,
			59
		],
		[
			3,
			12
		],
		[
			14,
			58
		],
		[
			22,
			35
		],
		[
			2,
			22
		],
		[
			-14,
			12
		],
		[
			-9,
			1
		],
		[
			-17,
			1
		],
		[
			-50,
			-37
		],
		[
			-24,
			-23
		],
		[
			-16,
			-10
		],
		[
			-14,
			1
		],
		[
			-10,
			16
		],
		[
			2,
			9
		],
		[
			8,
			27
		],
		[
			18,
			37
		],
		[
			74,
			82
		],
		[
			8,
			24
		],
		[
			0,
			27
		],
		[
			-3,
			12
		],
		[
			-21,
			17
		],
		[
			-17,
			14
		],
		[
			-2,
			0
		],
		[
			-27,
			3
		],
		[
			-47,
			33
		],
		[
			-14,
			15
		],
		[
			-21,
			24
		],
		[
			27,
			58
		],
		[
			-5,
			23
		],
		[
			-31,
			18
		],
		[
			-39,
			4
		],
		[
			-37,
			-9
		],
		[
			-63,
			-20
		],
		[
			-40,
			-2
		],
		[
			-27,
			11
		],
		[
			-1,
			15
		],
		[
			-2,
			15
		],
		[
			-1,
			2
		],
		[
			-15,
			46
		],
		[
			-6,
			11
		],
		[
			-14,
			26
		],
		[
			-35,
			27
		],
		[
			-22,
			25
		],
		[
			-9,
			23
		],
		[
			-1,
			13
		],
		[
			-2,
			16
		],
		[
			3,
			24
		],
		[
			23,
			24
		],
		[
			3,
			0
		],
		[
			27,
			-1
		],
		[
			7,
			0
		],
		[
			13,
			-19
		],
		[
			19,
			-6
		],
		[
			28,
			12
		],
		[
			14,
			34
		],
		[
			-1,
			22
		],
		[
			-2,
			19
		],
		[
			-23,
			30
		],
		[
			-30,
			18
		],
		[
			-1,
			0
		],
		[
			-1,
			1
		],
		[
			-23,
			5
		],
		[
			-29,
			-15
		],
		[
			-3,
			-5
		],
		[
			-3,
			-6
		],
		[
			-3,
			-15
		],
		[
			2,
			-11
		],
		[
			-6,
			-6
		],
		[
			-13,
			-1
		],
		[
			-12,
			6
		],
		[
			-7,
			13
		],
		[
			-5,
			9
		],
		[
			-8,
			20
		],
		[
			-3,
			39
		],
		[
			24,
			17
		],
		[
			2,
			1
		],
		[
			20,
			2
		],
		[
			19,
			1
		],
		[
			14,
			-9
		],
		[
			11,
			-8
		],
		[
			11,
			-8
		],
		[
			10,
			-8
		],
		[
			19,
			-5
		],
		[
			34,
			3
		],
		[
			24,
			15
		],
		[
			3,
			23
		],
		[
			-27,
			24
		],
		[
			-12,
			5
		],
		[
			-83,
			35
		],
		[
			-31,
			24
		],
		[
			-7,
			16
		],
		[
			-4,
			7
		],
		[
			1,
			35
		],
		[
			33,
			59
		],
		[
			11,
			68
		],
		[
			-8,
			22
		],
		[
			-19,
			10
		],
		[
			-9,
			-1
		],
		[
			-4,
			0
		],
		[
			-4,
			0
		],
		[
			-40,
			28
		],
		[
			-2,
			4
		],
		[
			-27,
			43
		],
		[
			-7,
			46
		],
		[
			-14,
			32
		],
		[
			-6,
			12
		],
		[
			-41,
			73
		],
		[
			-12,
			10
		],
		[
			-29,
			25
		],
		[
			-8,
			7
		],
		[
			-5,
			1
		],
		[
			-13,
			3
		],
		[
			-13,
			-5
		],
		[
			-11,
			-6
		],
		[
			-82,
			33
		],
		[
			-42,
			17
		],
		[
			-10,
			6
		],
		[
			-13,
			8
		],
		[
			-21,
			13
		],
		[
			-52,
			6
		],
		[
			-25,
			-15
		],
		[
			-4,
			-2
		],
		[
			0,
			-5
		],
		[
			1,
			-22
		],
		[
			13,
			-53
		],
		[
			-6,
			-43
		],
		[
			-48,
			-12
		],
		[
			-25,
			7
		],
		[
			-26,
			7
		],
		[
			-46,
			7
		],
		[
			-12,
			-9
		],
		[
			-6,
			-5
		],
		[
			-13,
			-29
		],
		[
			2,
			-21
		],
		[
			2,
			-15
		],
		[
			-4,
			-24
		],
		[
			-14,
			-14
		],
		[
			-17,
			-1
		],
		[
			-18,
			19
		],
		[
			-15,
			51
		],
		[
			-9,
			49
		],
		[
			-12,
			65
		],
		[
			-4,
			22
		],
		[
			0,
			60
		],
		[
			0,
			43
		],
		[
			-13,
			16
		],
		[
			-14,
			18
		],
		[
			-4,
			5
		],
		[
			-3,
			-4
		],
		[
			-1,
			-2
		],
		[
			-8,
			-9
		],
		[
			-2,
			-31
		],
		[
			-2,
			-30
		],
		[
			-14,
			-29
		],
		[
			-27,
			-11
		],
		[
			-31,
			15
		],
		[
			-25,
			38
		],
		[
			-4,
			7
		],
		[
			-35,
			38
		],
		[
			-16,
			9
		],
		[
			-16,
			9
		],
		[
			-58,
			15
		],
		[
			-4,
			1
		],
		[
			-31,
			7
		],
		[
			-44,
			0
		],
		[
			-20,
			-8
		],
		[
			-14,
			-5
		],
		[
			-6,
			-19
		],
		[
			0,
			-7
		],
		[
			-1,
			-46
		],
		[
			-31,
			-27
		],
		[
			-103,
			24
		],
		[
			-14,
			15
		],
		[
			-1,
			16
		],
		[
			-1,
			4
		],
		[
			-18,
			63
		],
		[
			-5,
			17
		],
		[
			-9,
			22
		],
		[
			-9,
			22
		],
		[
			-11,
			28
		],
		[
			-11,
			27
		],
		[
			-11,
			60
		],
		[
			-10,
			30
		],
		[
			-19,
			31
		],
		[
			-21,
			35
		],
		[
			-2,
			0
		],
		[
			-12,
			-1
		],
		[
			-9,
			-18
		],
		[
			-13,
			-35
		],
		[
			-19,
			-42
		],
		[
			-46,
			-20
		],
		[
			-33,
			-13
		],
		[
			-23,
			-9
		],
		[
			-34,
			-1
		],
		[
			-7,
			12
		],
		[
			5,
			16
		],
		[
			17,
			18
		],
		[
			28,
			29
		],
		[
			13,
			18
		],
		[
			6,
			19
		],
		[
			-2,
			27
		],
		[
			-9,
			23
		],
		[
			-23,
			21
		],
		[
			-24,
			5
		],
		[
			-6,
			-2
		],
		[
			-15,
			-6
		],
		[
			-38,
			-52
		],
		[
			-17,
			-23
		],
		[
			-2,
			-22
		],
		[
			4,
			-5
		],
		[
			21,
			-24
		],
		[
			6,
			-12
		],
		[
			2,
			-17
		],
		[
			-12,
			-19
		],
		[
			-20,
			-4
		],
		[
			-22,
			5
		],
		[
			-20,
			14
		],
		[
			-17,
			14
		],
		[
			-17,
			26
		],
		[
			-3,
			15
		],
		[
			8,
			11
		],
		[
			22,
			13
		],
		[
			10,
			5
		],
		[
			10,
			15
		],
		[
			-2,
			22
		],
		[
			-8,
			10
		],
		[
			-3,
			3
		],
		[
			-4,
			4
		],
		[
			-25,
			10
		],
		[
			-2,
			1
		],
		[
			-22,
			-2
		],
		[
			-16,
			0
		],
		[
			-48,
			-13
		],
		[
			-36,
			2
		],
		[
			-12,
			11
		],
		[
			-6,
			23
		],
		[
			8,
			17
		],
		[
			30,
			21
		],
		[
			35,
			5
		],
		[
			41,
			6
		],
		[
			50,
			-2
		],
		[
			1,
			-1
		],
		[
			2,
			0
		],
		[
			55,
			2
		],
		[
			61,
			9
		],
		[
			105,
			84
		],
		[
			7,
			16
		],
		[
			-1,
			30
		],
		[
			-7,
			16
		],
		[
			-14,
			9
		],
		[
			-71,
			43
		],
		[
			0,
			0
		],
		[
			-29,
			5
		],
		[
			-3,
			1
		],
		[
			-18,
			3
		],
		[
			-55,
			3
		],
		[
			-22,
			1
		],
		[
			-17,
			27
		],
		[
			5,
			29
		],
		[
			17,
			38
		],
		[
			12,
			23
		],
		[
			9,
			26
		],
		[
			10,
			77
		],
		[
			2,
			15
		],
		[
			3,
			35
		],
		[
			-2,
			16
		],
		[
			-4,
			27
		],
		[
			-2,
			4
		],
		[
			-22,
			51
		],
		[
			-6,
			3
		],
		[
			-4,
			2
		],
		[
			-10,
			5
		],
		[
			-1,
			-1
		],
		[
			-42,
			-18
		],
		[
			-67,
			-29
		],
		[
			-13,
			0
		],
		[
			-31,
			2
		],
		[
			-9,
			0
		],
		[
			-57,
			3
		],
		[
			-14,
			5
		],
		[
			-14,
			20
		],
		[
			1,
			26
		],
		[
			18,
			14
		],
		[
			9,
			3
		],
		[
			69,
			25
		],
		[
			20,
			24
		],
		[
			2,
			18
		]
	],
	[
		[
			11079,
			30026
		],
		[
			93,
			44
		],
		[
			83,
			40
		],
		[
			217,
			70
		],
		[
			20,
			-27
		],
		[
			372,
			138
		],
		[
			140,
			52
		],
		[
			-18,
			298
		],
		[
			167,
			-11
		],
		[
			84,
			69
		],
		[
			393,
			-3
		],
		[
			15,
			154
		],
		[
			90,
			60
		],
		[
			103,
			68
		],
		[
			118,
			4
		],
		[
			246,
			-104
		],
		[
			43,
			-49
		],
		[
			130,
			222
		],
		[
			161,
			-197
		],
		[
			1,
			-1
		],
		[
			1,
			-1
		],
		[
			18,
			-4
		],
		[
			38,
			-8
		],
		[
			63,
			63
		],
		[
			89,
			29
		],
		[
			35,
			-20
		],
		[
			64,
			45
		],
		[
			-22,
			74
		],
		[
			66,
			94
		],
		[
			77,
			-38
		],
		[
			4,
			-61
		],
		[
			-48,
			20
		],
		[
			-40,
			-26
		],
		[
			171,
			-156
		],
		[
			273,
			223
		],
		[
			40,
			-98
		],
		[
			153,
			51
		],
		[
			-94,
			216
		],
		[
			1,
			373
		],
		[
			94,
			205
		],
		[
			435,
			-170
		],
		[
			258,
			32
		]
	],
	[
		[
			15213,
			31696
		],
		[
			18,
			-62
		],
		[
			-158,
			-16
		],
		[
			42,
			-196
		],
		[
			171,
			20
		],
		[
			-3,
			45
		],
		[
			257,
			63
		],
		[
			-25,
			66
		],
		[
			165,
			52
		],
		[
			9,
			-42
		],
		[
			217,
			-56
		],
		[
			128,
			34
		],
		[
			144,
			-38
		],
		[
			239,
			-621
		],
		[
			137,
			22
		],
		[
			-15,
			426
		],
		[
			36,
			6
		],
		[
			-3,
			76
		],
		[
			189,
			13
		],
		[
			15,
			40
		],
		[
			100,
			10
		],
		[
			91,
			-234
		],
		[
			556,
			27
		],
		[
			80,
			-39
		]
	],
	[
		[
			17603,
			31292
		],
		[
			270,
			-126
		],
		[
			96,
			-145
		]
	],
	[
		[
			17969,
			31021
		],
		[
			105,
			-318
		],
		[
			5,
			-68
		],
		[
			12,
			-185
		],
		[
			-124,
			-541
		],
		[
			-7,
			-31
		],
		[
			-56,
			-27
		],
		[
			9,
			56
		],
		[
			-181,
			24
		],
		[
			-3,
			-23
		],
		[
			-55,
			29
		],
		[
			-97,
			-230
		],
		[
			-25,
			18
		],
		[
			-10,
			-51
		],
		[
			-12,
			39
		],
		[
			-39,
			3
		],
		[
			1,
			-35
		],
		[
			-52,
			-31
		],
		[
			2,
			-41
		],
		[
			93,
			-18
		],
		[
			-56,
			-6
		],
		[
			-17,
			-56
		],
		[
			32,
			-9
		],
		[
			-35,
			-187
		],
		[
			-112,
			110
		],
		[
			-87,
			22
		],
		[
			-38,
			-36
		],
		[
			26,
			-42
		],
		[
			-36,
			-47
		],
		[
			5,
			-75
		],
		[
			-102,
			16
		],
		[
			-113,
			146
		],
		[
			-120,
			-105
		],
		[
			-105,
			40
		],
		[
			-58,
			-67
		],
		[
			3,
			-37
		],
		[
			30,
			-1
		],
		[
			-18,
			-79
		],
		[
			52,
			12
		],
		[
			26,
			-39
		],
		[
			76,
			56
		],
		[
			126,
			-190
		],
		[
			-26,
			-37
		],
		[
			-83,
			66
		],
		[
			-87,
			-50
		],
		[
			154,
			-121
		],
		[
			-2,
			-15
		],
		[
			-16,
			-139
		],
		[
			54,
			45
		],
		[
			133,
			5
		],
		[
			10,
			-101
		],
		[
			45,
			0
		],
		[
			-17,
			137
		],
		[
			120,
			11
		],
		[
			-124,
			27
		],
		[
			4,
			21
		],
		[
			4,
			19
		],
		[
			244,
			-14
		],
		[
			-11,
			-20
		],
		[
			-11,
			-20
		],
		[
			72,
			-12
		],
		[
			-96,
			-107
		],
		[
			-22,
			-110
		],
		[
			-171,
			12
		],
		[
			-78,
			-60
		],
		[
			-172,
			15
		],
		[
			-71,
			57
		],
		[
			-81,
			3
		],
		[
			-121,
			-150
		],
		[
			68,
			-91
		],
		[
			-5,
			-47
		],
		[
			-42,
			-28
		],
		[
			-182,
			100
		],
		[
			-35,
			-126
		],
		[
			-86,
			-91
		]
	],
	[
		[
			29365,
			27440
		],
		[
			1,
			0
		],
		[
			44,
			7
		],
		[
			13,
			76
		],
		[
			53,
			-125
		],
		[
			145,
			94
		],
		[
			-21,
			29
		],
		[
			330,
			319
		],
		[
			-10,
			72
		],
		[
			42,
			-9
		],
		[
			115,
			140
		],
		[
			4,
			0
		],
		[
			87,
			6
		],
		[
			99,
			-87
		],
		[
			197,
			222
		],
		[
			206,
			-177
		],
		[
			110,
			124
		],
		[
			71,
			-55
		],
		[
			81,
			134
		],
		[
			56,
			-31
		],
		[
			199,
			327
		],
		[
			275,
			-149
		],
		[
			-208,
			-356
		],
		[
			-15,
			-18
		],
		[
			-68,
			41
		],
		[
			-287,
			-367
		],
		[
			-151,
			63
		],
		[
			-10,
			-163
		],
		[
			-78,
			-160
		],
		[
			34,
			-106
		],
		[
			-149,
			-180
		],
		[
			-90,
			-28
		],
		[
			-73,
			-80
		],
		[
			-94,
			65
		],
		[
			-24,
			-59
		],
		[
			-99,
			91
		],
		[
			-76,
			-16
		],
		[
			-7,
			-41
		],
		[
			97,
			-91
		],
		[
			-77,
			-115
		],
		[
			-4,
			-6
		],
		[
			118,
			-127
		],
		[
			1,
			-2
		],
		[
			-6,
			-8
		],
		[
			-16,
			-21
		],
		[
			-4,
			-6
		]
	],
	[
		[
			27570,
			29258
		],
		[
			-30,
			82
		],
		[
			-48,
			-4
		],
		[
			-21,
			441
		],
		[
			32,
			108
		],
		[
			-230,
			-75
		],
		[
			-78,
			227
		],
		[
			305,
			22
		],
		[
			20,
			475
		],
		[
			72,
			9
		],
		[
			55,
			-179
		],
		[
			40,
			16
		],
		[
			31,
			-55
		],
		[
			-62,
			-17
		],
		[
			-64,
			28
		],
		[
			-64,
			-75
		],
		[
			153,
			-127
		],
		[
			-46,
			-157
		],
		[
			231,
			227
		],
		[
			176,
			-13
		],
		[
			-71,
			30
		],
		[
			-147,
			259
		],
		[
			166,
			58
		],
		[
			-6,
			-64
		],
		[
			151,
			52
		],
		[
			-55,
			77
		],
		[
			52,
			20
		],
		[
			35,
			14
		]
	],
	[
		[
			28167,
			30637
		],
		[
			3,
			-5
		],
		[
			48,
			-73
		],
		[
			12,
			-19
		],
		[
			3,
			-2
		],
		[
			88,
			-61
		],
		[
			301,
			-208
		],
		[
			26,
			-18
		],
		[
			136,
			-94
		],
		[
			240,
			-246
		],
		[
			130,
			-282
		],
		[
			-16,
			-195
		],
		[
			8,
			-5
		],
		[
			44,
			-25
		],
		[
			28,
			8
		],
		[
			89,
			25
		],
		[
			6,
			-29
		],
		[
			262,
			112
		],
		[
			51,
			22
		],
		[
			21,
			-39
		],
		[
			151,
			25
		],
		[
			53,
			81
		],
		[
			42,
			16
		],
		[
			146,
			55
		],
		[
			-30,
			85
		],
		[
			49,
			56
		],
		[
			64,
			-38
		],
		[
			113,
			11
		],
		[
			79,
			-120
		],
		[
			-59,
			-66
		],
		[
			44,
			-36
		],
		[
			60,
			66
		],
		[
			22,
			-19
		],
		[
			376,
			413
		],
		[
			91,
			-85
		],
		[
			300,
			88
		]
	],
	[
		[
			31148,
			30035
		],
		[
			15,
			-98
		]
	],
	[
		[
			31163,
			29937
		],
		[
			4,
			-123
		],
		[
			-705,
			-317
		],
		[
			-87,
			-96
		],
		[
			-112,
			87
		],
		[
			-332,
			-364
		],
		[
			-55,
			75
		],
		[
			-205,
			-236
		],
		[
			-38,
			-169
		],
		[
			-392,
			-207
		],
		[
			39,
			-49
		],
		[
			-59,
			-48
		],
		[
			-95,
			103
		],
		[
			-211,
			-112
		],
		[
			16,
			-69
		],
		[
			-87,
			-106
		],
		[
			3,
			-3
		],
		[
			81,
			-104
		],
		[
			30,
			-38
		],
		[
			2,
			-11
		],
		[
			34,
			-144
		],
		[
			7,
			-32
		],
		[
			2,
			-9
		]
	],
	[
		[
			17969,
			31021
		],
		[
			77,
			17
		],
		[
			-8,
			89
		],
		[
			139,
			9
		],
		[
			83,
			-163
		],
		[
			350,
			-30
		],
		[
			27,
			5
		],
		[
			-8,
			79
		],
		[
			103,
			-85
		],
		[
			228,
			-53
		],
		[
			112,
			-103
		],
		[
			221,
			0
		],
		[
			127,
			-88
		],
		[
			124,
			-9
		],
		[
			97,
			-104
		],
		[
			74,
			123
		],
		[
			237,
			-150
		],
		[
			80,
			277
		],
		[
			93,
			-18
		],
		[
			102,
			-49
		],
		[
			-7,
			-26
		],
		[
			61,
			-17
		],
		[
			8,
			31
		],
		[
			174,
			-48
		],
		[
			17,
			-82
		],
		[
			88,
			11
		],
		[
			7,
			-46
		],
		[
			88,
			-5
		],
		[
			9,
			-57
		],
		[
			27,
			13
		],
		[
			59,
			-52
		],
		[
			82,
			41
		],
		[
			242,
			-207
		],
		[
			45,
			174
		],
		[
			-176,
			162
		],
		[
			25,
			114
		],
		[
			21,
			15
		],
		[
			9,
			6
		],
		[
			2,
			2
		],
		[
			44,
			-33
		],
		[
			29,
			14
		],
		[
			36,
			147
		],
		[
			82,
			-70
		],
		[
			341,
			31
		]
	],
	[
		[
			21540,
			30886
		],
		[
			-3,
			-155
		],
		[
			88,
			-108
		],
		[
			-34,
			-83
		],
		[
			61,
			-372
		],
		[
			51,
			-311
		],
		[
			92,
			18
		],
		[
			43,
			-140
		],
		[
			45,
			5
		],
		[
			28,
			-90
		],
		[
			140,
			-66
		],
		[
			63,
			33
		],
		[
			-55,
			277
		],
		[
			34,
			29
		],
		[
			72,
			-300
		],
		[
			133,
			-123
		],
		[
			14,
			-70
		],
		[
			-103,
			1
		],
		[
			23,
			-112
		],
		[
			-48,
			0
		],
		[
			-64,
			160
		],
		[
			-9,
			-53
		],
		[
			-68,
			17
		],
		[
			92,
			-138
		],
		[
			-119,
			19
		],
		[
			-32,
			54
		],
		[
			-45,
			0
		],
		[
			-14,
			51
		],
		[
			-100,
			-50
		],
		[
			64,
			0
		],
		[
			15,
			-56
		]
	],
	[
		[
			31163,
			29937
		],
		[
			16,
			2
		],
		[
			264,
			46
		],
		[
			-5,
			36
		],
		[
			94,
			18
		],
		[
			237,
			45
		],
		[
			5,
			1
		],
		[
			46,
			-226
		],
		[
			38,
			-184
		],
		[
			-165,
			-137
		],
		[
			-1,
			-1
		],
		[
			5,
			-20
		],
		[
			55,
			-225
		],
		[
			35,
			-144
		],
		[
			76,
			-311
		],
		[
			63,
			16
		],
		[
			93,
			23
		],
		[
			132,
			33
		],
		[
			1,
			-4
		],
		[
			18,
			-91
		],
		[
			21,
			-105
		],
		[
			218,
			36
		],
		[
			-13,
			83
		],
		[
			151,
			20
		],
		[
			317,
			73
		],
		[
			-8,
			85
		],
		[
			-11,
			161
		],
		[
			23,
			6
		],
		[
			-1,
			6
		],
		[
			-10,
			45
		],
		[
			-11,
			-2
		],
		[
			-10,
			120
		],
		[
			90,
			7
		],
		[
			28,
			76
		],
		[
			-75,
			20
		],
		[
			54,
			160
		],
		[
			-61,
			8
		],
		[
			11,
			99
		],
		[
			53,
			-4
		],
		[
			30,
			4
		],
		[
			9,
			29
		],
		[
			248,
			108
		],
		[
			80,
			11
		],
		[
			12,
			2
		],
		[
			560,
			79
		],
		[
			80,
			-414
		],
		[
			9,
			-62
		],
		[
			32,
			-236
		],
		[
			15,
			-114
		],
		[
			6,
			-36
		],
		[
			9,
			-69
		],
		[
			41,
			-290
		],
		[
			46,
			-257
		],
		[
			47,
			-301
		],
		[
			-129,
			-29
		],
		[
			-244,
			-39
		],
		[
			-166,
			-26
		],
		[
			79,
			-428
		],
		[
			103,
			-585
		],
		[
			60,
			-340
		],
		[
			82,
			-471
		],
		[
			-442,
			-56
		],
		[
			-90,
			-12
		],
		[
			-39,
			-5
		],
		[
			-39,
			-5
		],
		[
			-117,
			-15
		],
		[
			-9,
			-1
		],
		[
			-120,
			-16
		],
		[
			-114,
			52
		],
		[
			1,
			-5
		],
		[
			5,
			-42
		],
		[
			13,
			-113
		],
		[
			26,
			-196
		],
		[
			112,
			32
		],
		[
			72,
			21
		],
		[
			159,
			-486
		],
		[
			11,
			-98
		],
		[
			225,
			7
		],
		[
			-28,
			282
		],
		[
			297,
			40
		],
		[
			249,
			33
		],
		[
			101,
			15
		],
		[
			45,
			7
		],
		[
			47,
			7
		],
		[
			9,
			-39
		],
		[
			10,
			-47
		],
		[
			174,
			-790
		],
		[
			-106,
			-12
		],
		[
			-197,
			-34
		],
		[
			-7,
			-100
		],
		[
			-4,
			-45
		],
		[
			-17,
			-229
		],
		[
			-10,
			-138
		],
		[
			-21,
			-404
		],
		[
			-16,
			-312
		],
		[
			-456,
			-91
		],
		[
			177,
			-279
		],
		[
			13,
			4
		],
		[
			773,
			235
		],
		[
			91,
			-559
		],
		[
			600,
			81
		],
		[
			8,
			-24
		],
		[
			102,
			11
		],
		[
			-13,
			63
		],
		[
			103,
			62
		],
		[
			5,
			2
		],
		[
			33,
			-206
		],
		[
			2,
			-12
		],
		[
			111,
			17
		],
		[
			119,
			-514
		],
		[
			23,
			-103
		],
		[
			74,
			-300
		],
		[
			340,
			65
		],
		[
			262,
			51
		],
		[
			158,
			32
		],
		[
			374,
			77
		],
		[
			-23,
			104
		],
		[
			172,
			26
		],
		[
			9,
			1
		],
		[
			60,
			9
		],
		[
			184,
			27
		],
		[
			10,
			-68
		],
		[
			3,
			-44
		],
		[
			14,
			-86
		],
		[
			4,
			-20
		],
		[
			3,
			-11
		],
		[
			48,
			-239
		],
		[
			9,
			-43
		],
		[
			-57,
			-19
		],
		[
			-41,
			-14
		],
		[
			9,
			-33
		],
		[
			6,
			-14
		],
		[
			22,
			-38
		],
		[
			75,
			-143
		],
		[
			135,
			-264
		],
		[
			288,
			130
		],
		[
			-7,
			14
		],
		[
			-46,
			86
		],
		[
			35,
			13
		],
		[
			39,
			14
		],
		[
			70,
			25
		],
		[
			14,
			5
		],
		[
			116,
			54
		],
		[
			27,
			-50
		],
		[
			22,
			8
		],
		[
			11,
			-7
		],
		[
			21,
			-13
		],
		[
			22,
			-9
		],
		[
			25,
			-41
		],
		[
			84,
			-42
		],
		[
			28,
			-53
		],
		[
			11,
			-67
		],
		[
			4,
			-7
		],
		[
			88,
			-72
		],
		[
			-12,
			-48
		],
		[
			-55,
			10
		],
		[
			-42,
			7
		],
		[
			-81,
			15
		],
		[
			-4,
			-2
		],
		[
			-62,
			-39
		],
		[
			-166,
			-103
		],
		[
			-88,
			-52
		],
		[
			100,
			-144
		],
		[
			-19,
			-12
		],
		[
			49,
			-50
		],
		[
			76,
			-97
		],
		[
			39,
			-54
		],
		[
			39,
			-57
		],
		[
			43,
			-76
		],
		[
			33,
			-61
		],
		[
			-4,
			-119
		],
		[
			-1,
			-42
		],
		[
			-2,
			-42
		],
		[
			7,
			-38
		],
		[
			51,
			-18
		],
		[
			39,
			-13
		],
		[
			3,
			-26
		],
		[
			1,
			-5
		],
		[
			-6,
			-41
		],
		[
			-5,
			-37
		],
		[
			-1,
			-9
		],
		[
			-6,
			-24
		],
		[
			-10,
			-41
		],
		[
			-7,
			-30
		],
		[
			-8,
			-31
		],
		[
			-3,
			-13
		],
		[
			-27,
			-114
		],
		[
			-1,
			-118
		],
		[
			0,
			-29
		],
		[
			-3,
			-45
		],
		[
			-2,
			-22
		],
		[
			-12,
			-55
		],
		[
			-3,
			-30
		],
		[
			-2,
			-19
		],
		[
			3,
			-28
		],
		[
			29,
			-108
		],
		[
			9,
			-86
		],
		[
			7,
			-72
		],
		[
			3,
			-26
		],
		[
			0,
			-42
		],
		[
			-1,
			-17
		],
		[
			-8,
			-16
		],
		[
			-17,
			-15
		],
		[
			-47,
			-34
		],
		[
			-42,
			-40
		],
		[
			-20,
			-22
		],
		[
			-16,
			-46
		],
		[
			4,
			-71
		],
		[
			-1,
			-53
		],
		[
			-21,
			-97
		],
		[
			-11,
			-32
		],
		[
			-11,
			-23
		],
		[
			-13,
			-18
		],
		[
			-55,
			-54
		],
		[
			-17,
			-27
		],
		[
			-7,
			-22
		],
		[
			-2,
			-18
		],
		[
			1,
			-34
		],
		[
			9,
			-34
		],
		[
			15,
			-27
		],
		[
			6,
			-11
		],
		[
			74,
			-112
		],
		[
			2,
			-19
		],
		[
			4,
			-26
		],
		[
			0,
			-51
		],
		[
			-16,
			-110
		],
		[
			1,
			-21
		],
		[
			12,
			-42
		],
		[
			14,
			-34
		],
		[
			31,
			-75
		],
		[
			5,
			-11
		],
		[
			20,
			-44
		],
		[
			13,
			-37
		],
		[
			42,
			-61
		],
		[
			21,
			-50
		],
		[
			-11,
			-45
		],
		[
			-28,
			-51
		],
		[
			-14,
			-109
		],
		[
			-9,
			0
		],
		[
			0,
			4
		],
		[
			-87,
			2
		],
		[
			-17,
			3
		],
		[
			-82,
			34
		],
		[
			-13,
			-31
		],
		[
			-64,
			26
		],
		[
			13,
			31
		],
		[
			-36,
			15
		],
		[
			-17,
			-14
		],
		[
			16,
			-60
		],
		[
			5,
			-19
		],
		[
			-10,
			-30
		],
		[
			-20,
			-5
		],
		[
			-3,
			-29
		],
		[
			11,
			-28
		],
		[
			6,
			-30
		],
		[
			9,
			-32
		],
		[
			2,
			-8
		],
		[
			5,
			-30
		],
		[
			8,
			-37
		],
		[
			3,
			-11
		],
		[
			1,
			-5
		],
		[
			26,
			-2
		],
		[
			8,
			-2
		],
		[
			13,
			-5
		],
		[
			14,
			-3
		],
		[
			8,
			7
		],
		[
			10,
			10
		],
		[
			17,
			9
		],
		[
			5,
			-2
		],
		[
			7,
			-11
		],
		[
			-3,
			-16
		],
		[
			-10,
			-11
		],
		[
			-11,
			-9
		],
		[
			-12,
			5
		],
		[
			-9,
			-2
		],
		[
			-14,
			-11
		],
		[
			-7,
			-15
		],
		[
			0,
			-27
		],
		[
			-3,
			-30
		],
		[
			-5,
			-8
		],
		[
			-15,
			-8
		],
		[
			-6,
			-10
		],
		[
			2,
			-5
		],
		[
			7,
			-2
		],
		[
			18,
			1
		],
		[
			30,
			14
		],
		[
			15,
			13
		],
		[
			21,
			11
		],
		[
			4,
			-10
		],
		[
			-3,
			-10
		],
		[
			-12,
			-10
		],
		[
			-20,
			-32
		],
		[
			-2,
			-37
		],
		[
			-179,
			-28
		],
		[
			-11,
			-1
		],
		[
			-11,
			-2
		],
		[
			-41,
			-6
		],
		[
			-351,
			-66
		],
		[
			-137,
			-13
		],
		[
			-57,
			-16
		],
		[
			-7,
			-1
		],
		[
			-4,
			-1
		]
	],
	[
		[
			28167,
			30637
		],
		[
			4,
			11
		],
		[
			48,
			149
		],
		[
			11,
			35
		],
		[
			122,
			130
		],
		[
			129,
			137
		],
		[
			161,
			171
		],
		[
			8,
			147
		],
		[
			-213,
			264
		],
		[
			-16,
			19
		],
		[
			-38,
			26
		],
		[
			-378,
			255
		],
		[
			-166,
			112
		],
		[
			-223,
			151
		],
		[
			-81,
			102
		],
		[
			-30,
			120
		]
	],
	[
		[
			27505,
			32466
		],
		[
			7,
			35
		],
		[
			69,
			338
		],
		[
			25,
			117
		],
		[
			-6,
			163
		],
		[
			-2,
			76
		],
		[
			-76,
			119
		],
		[
			-31,
			30
		],
		[
			-291,
			280
		],
		[
			-76,
			140
		],
		[
			-7,
			166
		],
		[
			104,
			213
		],
		[
			22,
			45
		],
		[
			15,
			141
		],
		[
			-60,
			195
		],
		[
			-40,
			128
		],
		[
			-28,
			91
		],
		[
			-66,
			216
		],
		[
			-108,
			350
		],
		[
			-28,
			90
		],
		[
			-9,
			31
		],
		[
			6,
			14
		],
		[
			130,
			340
		],
		[
			8,
			19
		],
		[
			10,
			26
		],
		[
			1,
			10
		],
		[
			13,
			160
		],
		[
			15,
			181
		],
		[
			0,
			6
		],
		[
			115,
			476
		],
		[
			3,
			12
		],
		[
			2,
			4
		],
		[
			84,
			159
		],
		[
			110,
			209
		],
		[
			115,
			218
		],
		[
			2,
			7
		],
		[
			42,
			155
		],
		[
			-91,
			197
		],
		[
			-2,
			4
		],
		[
			-3,
			2
		],
		[
			-190,
			165
		],
		[
			-21,
			18
		],
		[
			-74,
			30
		],
		[
			-213,
			88
		],
		[
			-16,
			6
		],
		[
			-20,
			3
		],
		[
			-486,
			85
		]
	],
	[
		[
			26459,
			38024
		],
		[
			-60,
			9
		],
		[
			-221,
			33
		],
		[
			-28,
			5
		],
		[
			-45,
			14
		],
		[
			-18,
			7
		],
		[
			-347,
			116
		],
		[
			-282,
			18
		],
		[
			-110,
			37
		],
		[
			-18,
			19
		],
		[
			-69,
			70
		],
		[
			-33,
			96
		],
		[
			36,
			133
		],
		[
			110,
			178
		],
		[
			10,
			17
		],
		[
			21,
			35
		],
		[
			0,
			34
		],
		[
			-1,
			55
		],
		[
			-1,
			27
		],
		[
			-56,
			38
		],
		[
			-82,
			54
		],
		[
			-190,
			127
		],
		[
			-172,
			383
		],
		[
			-40,
			89
		],
		[
			-6,
			14
		],
		[
			-40,
			-5
		],
		[
			-33,
			-4
		],
		[
			-52,
			-6
		],
		[
			-25,
			-15
		],
		[
			-16,
			-9
		],
		[
			-217,
			-128
		]
	],
	[
		[
			24474,
			39465
		],
		[
			-105,
			6
		],
		[
			-195,
			106
		],
		[
			-258,
			299
		],
		[
			-30,
			35
		],
		[
			-3,
			26
		],
		[
			-1,
			8
		],
		[
			-5,
			40
		],
		[
			6,
			14
		],
		[
			43,
			108
		],
		[
			-4,
			17
		],
		[
			-15,
			55
		],
		[
			-198,
			84
		],
		[
			-439,
			-27
		],
		[
			-311,
			74
		],
		[
			-118,
			61
		],
		[
			-45,
			24
		],
		[
			-153,
			0
		],
		[
			-1,
			-6
		],
		[
			-52,
			-209
		],
		[
			-40,
			-74
		],
		[
			-69,
			-125
		],
		[
			-70,
			-126
		],
		[
			-27,
			-48
		],
		[
			0,
			-1
		],
		[
			0,
			0
		],
		[
			-114,
			-66
		],
		[
			-140,
			47
		],
		[
			-39,
			12
		],
		[
			-69,
			23
		],
		[
			-20,
			18
		],
		[
			-86,
			77
		],
		[
			-9,
			128
		],
		[
			8,
			11
		],
		[
			105,
			157
		],
		[
			41,
			60
		],
		[
			26,
			150
		],
		[
			19,
			15
		],
		[
			36,
			27
		],
		[
			120,
			5
		],
		[
			6,
			0
		],
		[
			93,
			4
		],
		[
			49,
			27
		],
		[
			25,
			13
		],
		[
			108,
			59
		],
		[
			8,
			21
		],
		[
			92,
			265
		]
	],
	[
		[
			22643,
			40859
		],
		[
			40,
			83
		],
		[
			46,
			98
		],
		[
			44,
			20
		],
		[
			56,
			-92
		],
		[
			61,
			-100
		],
		[
			9,
			-14
		],
		[
			18,
			6
		],
		[
			124,
			36
		],
		[
			2,
			1
		],
		[
			3,
			7
		],
		[
			60,
			120
		],
		[
			18,
			36
		],
		[
			-21,
			78
		],
		[
			-17,
			62
		],
		[
			-67,
			75
		],
		[
			-16,
			19
		],
		[
			-36,
			9
		],
		[
			-149,
			42
		],
		[
			-126,
			34
		],
		[
			-50,
			14
		],
		[
			-513,
			293
		],
		[
			-344,
			63
		],
		[
			-160,
			-30
		],
		[
			-61,
			-65
		]
	],
	[
		[
			21564,
			41654
		],
		[
			-20,
			13
		],
		[
			-63,
			46
		],
		[
			32,
			11
		],
		[
			11,
			-7
		],
		[
			32,
			20
		],
		[
			19,
			15
		],
		[
			-4,
			28
		],
		[
			-9,
			66
		],
		[
			47,
			42
		],
		[
			16,
			13
		],
		[
			54,
			37
		],
		[
			44,
			28
		],
		[
			49,
			38
		],
		[
			39,
			11
		],
		[
			-15,
			15
		],
		[
			-88,
			86
		],
		[
			-42,
			43
		],
		[
			-60,
			62
		],
		[
			5,
			5
		],
		[
			21,
			11
		],
		[
			19,
			4
		],
		[
			19,
			0
		],
		[
			27,
			-3
		],
		[
			9,
			-1
		],
		[
			37,
			-2
		],
		[
			3,
			1
		],
		[
			7,
			2
		],
		[
			7,
			0
		],
		[
			17,
			1
		],
		[
			23,
			-1
		],
		[
			27,
			8
		],
		[
			21,
			4
		],
		[
			18,
			-2
		],
		[
			17,
			9
		],
		[
			16,
			11
		],
		[
			11,
			14
		],
		[
			4,
			9
		],
		[
			15,
			18
		],
		[
			4,
			3
		],
		[
			5,
			3
		],
		[
			4,
			2
		],
		[
			5,
			1
		],
		[
			8,
			-1
		],
		[
			4,
			1
		],
		[
			6,
			6
		],
		[
			8,
			24
		],
		[
			0,
			11
		],
		[
			-2,
			6
		],
		[
			6,
			9
		],
		[
			14,
			17
		],
		[
			10,
			9
		],
		[
			16,
			14
		],
		[
			21,
			14
		],
		[
			10,
			4
		],
		[
			13,
			6
		],
		[
			6,
			5
		],
		[
			9,
			25
		],
		[
			6,
			25
		],
		[
			-1,
			5
		],
		[
			6,
			9
		],
		[
			3,
			3
		],
		[
			29,
			16
		],
		[
			21,
			5
		],
		[
			7,
			-3
		],
		[
			41,
			4
		],
		[
			28,
			5
		],
		[
			20,
			15
		],
		[
			27,
			11
		],
		[
			28,
			22
		],
		[
			13,
			9
		],
		[
			11,
			4
		],
		[
			13,
			-2
		],
		[
			8,
			2
		],
		[
			3,
			0
		],
		[
			24,
			14
		],
		[
			14,
			9
		],
		[
			17,
			29
		],
		[
			30,
			25
		],
		[
			16,
			21
		],
		[
			19,
			13
		],
		[
			12,
			-17
		],
		[
			-11,
			-30
		],
		[
			-19,
			-35
		],
		[
			3,
			-43
		],
		[
			-32,
			22
		],
		[
			-29,
			-23
		],
		[
			7,
			-8
		],
		[
			94,
			-112
		],
		[
			143,
			107
		],
		[
			51,
			-59
		],
		[
			154,
			-177
		],
		[
			19,
			-22
		],
		[
			36,
			42
		],
		[
			71,
			-26
		],
		[
			25,
			-14
		],
		[
			86,
			-46
		],
		[
			23,
			-3
		],
		[
			26,
			-2
		],
		[
			4,
			17
		],
		[
			38,
			-12
		],
		[
			6,
			-2
		],
		[
			8,
			-3
		],
		[
			80,
			-24
		],
		[
			26,
			-4
		],
		[
			-16,
			-139
		],
		[
			64,
			8
		],
		[
			34,
			5
		],
		[
			21,
			5
		],
		[
			217,
			30
		],
		[
			62,
			9
		],
		[
			-53,
			-64
		],
		[
			17,
			-45
		],
		[
			6,
			-38
		],
		[
			7,
			-44
		],
		[
			51,
			-89
		],
		[
			9,
			-16
		],
		[
			29,
			-56
		],
		[
			46,
			13
		],
		[
			47,
			10
		],
		[
			65,
			27
		],
		[
			11,
			16
		],
		[
			42,
			14
		],
		[
			46,
			-1
		],
		[
			110,
			-45
		],
		[
			15,
			-5
		],
		[
			7,
			-3
		],
		[
			56,
			41
		],
		[
			14,
			10
		],
		[
			72,
			53
		],
		[
			23,
			11
		],
		[
			47,
			11
		],
		[
			88,
			18
		],
		[
			32,
			7
		],
		[
			50,
			4
		],
		[
			69,
			-70
		],
		[
			52,
			-53
		],
		[
			22,
			-17
		],
		[
			29,
			-23
		],
		[
			35,
			-12
		],
		[
			211,
			10
		],
		[
			34,
			11
		],
		[
			0,
			54
		],
		[
			56,
			4
		],
		[
			26,
			25
		],
		[
			50,
			48
		],
		[
			15,
			-28
		],
		[
			72,
			-135
		],
		[
			84,
			26
		],
		[
			69,
			21
		],
		[
			72,
			22
		],
		[
			41,
			-74
		],
		[
			44,
			28
		],
		[
			69,
			-158
		],
		[
			1,
			-1
		],
		[
			11,
			-13
		],
		[
			81,
			-102
		],
		[
			20,
			-64
		],
		[
			7,
			-25
		],
		[
			-8,
			-49
		],
		[
			-24,
			-71
		],
		[
			-55,
			-165
		],
		[
			-3,
			-28
		],
		[
			-14,
			-40
		],
		[
			-6,
			-16
		],
		[
			-80,
			-1
		],
		[
			-11,
			-5
		],
		[
			-8,
			-16
		],
		[
			-10,
			-9
		],
		[
			-30,
			-27
		],
		[
			-30,
			-41
		],
		[
			41,
			-25
		],
		[
			60,
			63
		],
		[
			39,
			-42
		],
		[
			47,
			-31
		],
		[
			-69,
			-77
		],
		[
			97,
			-77
		],
		[
			-9,
			-46
		],
		[
			-16,
			-73
		],
		[
			-40,
			-112
		],
		[
			-76,
			-175
		],
		[
			-2,
			-4
		],
		[
			3,
			-3
		],
		[
			98,
			-65
		],
		[
			38,
			-24
		],
		[
			47,
			-30
		],
		[
			2,
			-27
		],
		[
			3,
			-25
		],
		[
			-3,
			-29
		],
		[
			-2,
			-27
		],
		[
			13,
			-10
		],
		[
			25,
			15
		],
		[
			18,
			10
		],
		[
			39,
			-1
		],
		[
			54,
			-31
		],
		[
			-7,
			-10
		],
		[
			-3,
			-5
		],
		[
			76,
			-53
		],
		[
			51,
			-36
		],
		[
			29,
			-21
		],
		[
			13,
			-10
		],
		[
			22,
			17
		],
		[
			31,
			34
		],
		[
			26,
			7
		],
		[
			17,
			-3
		],
		[
			33,
			-14
		],
		[
			37,
			1
		],
		[
			40,
			-8
		],
		[
			14,
			-1
		],
		[
			-9,
			-34
		],
		[
			-70,
			-14
		],
		[
			-19,
			4
		],
		[
			-35,
			32
		],
		[
			-67,
			-58
		],
		[
			34,
			-31
		],
		[
			-26,
			-39
		],
		[
			-21,
			-14
		],
		[
			-36,
			-18
		],
		[
			-28,
			-13
		],
		[
			27,
			-28
		],
		[
			12,
			-23
		],
		[
			18,
			-35
		],
		[
			116,
			-123
		],
		[
			77,
			-81
		],
		[
			50,
			-58
		],
		[
			5,
			-6
		],
		[
			5,
			-5
		],
		[
			140,
			-162
		],
		[
			85,
			-99
		],
		[
			18,
			-21
		],
		[
			225,
			159
		],
		[
			114,
			80
		],
		[
			67,
			65
		],
		[
			118,
			-42
		],
		[
			29,
			-45
		],
		[
			5,
			-7
		],
		[
			117,
			-94
		],
		[
			16,
			-14
		],
		[
			43,
			-38
		],
		[
			40,
			-36
		],
		[
			15,
			11
		],
		[
			4,
			7
		],
		[
			18,
			2
		],
		[
			15,
			-8
		],
		[
			22,
			-38
		],
		[
			12,
			-18
		],
		[
			28,
			-19
		],
		[
			2,
			-1
		],
		[
			69,
			-14
		],
		[
			18,
			-4
		],
		[
			20,
			-11
		],
		[
			26,
			-24
		],
		[
			35,
			-44
		],
		[
			26,
			-24
		],
		[
			42,
			-44
		],
		[
			19,
			-20
		],
		[
			62,
			-41
		],
		[
			17,
			-11
		],
		[
			9,
			-2
		],
		[
			18,
			26
		],
		[
			11,
			11
		],
		[
			14,
			11
		],
		[
			15,
			12
		],
		[
			7,
			6
		],
		[
			20,
			-1
		],
		[
			54,
			-26
		],
		[
			16,
			-16
		],
		[
			52,
			-19
		],
		[
			79,
			-2
		],
		[
			45,
			7
		],
		[
			11,
			4
		],
		[
			91,
			8
		],
		[
			26,
			3
		],
		[
			68,
			28
		],
		[
			79,
			13
		],
		[
			-1,
			12
		],
		[
			-25,
			196
		],
		[
			-31,
			76
		],
		[
			-37,
			48
		],
		[
			10,
			22
		],
		[
			-16,
			20
		],
		[
			22,
			19
		],
		[
			26,
			2
		],
		[
			10,
			-9
		],
		[
			16,
			-22
		],
		[
			33,
			-26
		],
		[
			7,
			-1
		],
		[
			38,
			5
		],
		[
			10,
			-9
		],
		[
			5,
			-25
		],
		[
			25,
			-48
		],
		[
			0,
			-17
		],
		[
			1,
			-16
		],
		[
			1,
			-9
		],
		[
			11,
			-13
		],
		[
			27,
			5
		],
		[
			-16,
			109
		],
		[
			-5,
			30
		],
		[
			3,
			27
		],
		[
			-4,
			46
		],
		[
			-53,
			-5
		],
		[
			-13,
			21
		],
		[
			-29,
			34
		],
		[
			-13,
			-1
		],
		[
			-16,
			-21
		],
		[
			-17,
			33
		],
		[
			68,
			64
		],
		[
			9,
			1
		],
		[
			13,
			-20
		],
		[
			6,
			0
		],
		[
			1,
			41
		],
		[
			33,
			5
		],
		[
			27,
			-14
		],
		[
			49,
			10
		],
		[
			0,
			-9
		],
		[
			2,
			-7
		],
		[
			4,
			-2
		],
		[
			8,
			2
		],
		[
			27,
			10
		],
		[
			35,
			28
		],
		[
			73,
			-14
		],
		[
			7,
			-1
		],
		[
			39,
			6
		],
		[
			90,
			-23
		],
		[
			13,
			-1
		],
		[
			35,
			2
		],
		[
			0,
			2
		],
		[
			4,
			24
		],
		[
			-14,
			31
		],
		[
			-13,
			17
		],
		[
			-3,
			4
		],
		[
			-28,
			19
		],
		[
			-13,
			2
		],
		[
			-12,
			0
		],
		[
			10,
			79
		],
		[
			130,
			-1
		],
		[
			8,
			0
		],
		[
			4,
			0
		],
		[
			179,
			-1
		],
		[
			58,
			0
		],
		[
			116,
			0
		],
		[
			33,
			0
		],
		[
			47,
			4
		],
		[
			1,
			-4
		],
		[
			2,
			-21
		],
		[
			15,
			-123
		],
		[
			14,
			-118
		],
		[
			20,
			-160
		],
		[
			10,
			-37
		],
		[
			18,
			1
		],
		[
			12,
			0
		],
		[
			24,
			1
		],
		[
			26,
			-209
		],
		[
			26,
			-227
		],
		[
			3,
			-29
		],
		[
			2,
			-14
		],
		[
			0,
			-6
		],
		[
			2,
			-15
		],
		[
			6,
			-46
		],
		[
			8,
			-72
		],
		[
			11,
			-87
		],
		[
			16,
			-91
		],
		[
			13,
			-73
		],
		[
			8,
			-47
		],
		[
			55,
			-345
		],
		[
			20,
			1
		],
		[
			21,
			5
		],
		[
			103,
			16
		],
		[
			1,
			0
		],
		[
			-2,
			45
		],
		[
			13,
			2
		],
		[
			9,
			13
		],
		[
			8,
			28
		],
		[
			0,
			43
		],
		[
			6,
			31
		],
		[
			11,
			-2
		],
		[
			14,
			-14
		],
		[
			26,
			-15
		],
		[
			33,
			-49
		],
		[
			-11,
			-26
		],
		[
			-15,
			-7
		],
		[
			-23,
			0
		],
		[
			-22,
			-5
		],
		[
			-15,
			-18
		],
		[
			-3,
			-23
		],
		[
			7,
			1
		],
		[
			37,
			4
		],
		[
			22,
			3
		],
		[
			152,
			19
		],
		[
			55,
			7
		],
		[
			17,
			3
		],
		[
			366,
			33
		],
		[
			49,
			-2
		],
		[
			30,
			-12
		],
		[
			1,
			-1
		],
		[
			17,
			-26
		],
		[
			-14,
			-7
		],
		[
			-31,
			-15
		],
		[
			-5,
			-40
		],
		[
			-36,
			-64
		],
		[
			-11,
			-3
		],
		[
			-49,
			-10
		],
		[
			-22,
			-56
		],
		[
			-283,
			-137
		],
		[
			-26,
			-15
		],
		[
			-41,
			-46
		],
		[
			7,
			-10
		],
		[
			-23,
			-46
		],
		[
			-17,
			-16
		],
		[
			-14,
			-7
		],
		[
			-26,
			-13
		],
		[
			-33,
			-25
		],
		[
			-21,
			-21
		],
		[
			-13,
			-20
		],
		[
			-16,
			-35
		],
		[
			-11,
			-33
		],
		[
			-3,
			-12
		],
		[
			-34,
			-50
		],
		[
			-7,
			-11
		],
		[
			-21,
			-34
		],
		[
			-7,
			-12
		],
		[
			-3,
			-5
		],
		[
			-9,
			-8
		],
		[
			-39,
			-37
		],
		[
			-32,
			-43
		],
		[
			-11,
			-13
		],
		[
			-29,
			-37
		],
		[
			-26,
			-42
		],
		[
			-11,
			-48
		],
		[
			-5,
			-21
		],
		[
			-16,
			-79
		],
		[
			-3,
			-17
		],
		[
			18,
			-27
		],
		[
			35,
			-49
		],
		[
			36,
			-52
		],
		[
			57,
			-81
		],
		[
			10,
			-14
		],
		[
			34,
			-44
		],
		[
			38,
			-51
		],
		[
			138,
			-14
		],
		[
			17,
			-2
		],
		[
			91,
			120
		],
		[
			29,
			38
		],
		[
			44,
			58
		],
		[
			30,
			-10
		],
		[
			32,
			-12
		],
		[
			260,
			-89
		],
		[
			15,
			-32
		],
		[
			-51,
			-130
		],
		[
			-197,
			-498
		],
		[
			-16,
			-41
		],
		[
			-8,
			-19
		],
		[
			-5,
			-13
		],
		[
			-39,
			-68
		],
		[
			-6,
			-29
		],
		[
			-157,
			-82
		],
		[
			-40,
			-21
		],
		[
			-182,
			-96
		],
		[
			-124,
			-306
		],
		[
			82,
			-135
		],
		[
			8,
			-14
		],
		[
			29,
			-47
		],
		[
			19,
			-29
		],
		[
			14,
			-25
		],
		[
			55,
			-89
		],
		[
			-26,
			-16
		],
		[
			123,
			-200
		],
		[
			-33,
			-22
		],
		[
			-100,
			1
		],
		[
			1,
			-66
		],
		[
			0,
			-28
		],
		[
			2,
			-290
		],
		[
			-117,
			0
		],
		[
			-1,
			-63
		],
		[
			0,
			-9
		],
		[
			-2,
			-177
		],
		[
			284,
			-4
		],
		[
			-124,
			-115
		],
		[
			-45,
			-121
		],
		[
			-64,
			-20
		],
		[
			-48,
			45
		],
		[
			-2,
			-12
		],
		[
			5,
			-6
		],
		[
			15,
			-50
		],
		[
			6,
			-18
		],
		[
			6,
			-15
		],
		[
			31,
			-79
		],
		[
			32,
			-79
		],
		[
			-33,
			-22
		],
		[
			-57,
			-47
		],
		[
			-42,
			-42
		],
		[
			-42,
			-29
		],
		[
			-20,
			-13
		],
		[
			17,
			-36
		],
		[
			15,
			-21
		],
		[
			1,
			-15
		],
		[
			-23,
			-21
		],
		[
			-19,
			-32
		],
		[
			-4,
			-5
		],
		[
			-8,
			-9
		],
		[
			-10,
			-7
		],
		[
			-6,
			-4
		],
		[
			-31,
			-10
		],
		[
			-28,
			-17
		],
		[
			-6,
			-3
		],
		[
			-8,
			-11
		],
		[
			-6,
			-9
		],
		[
			-26,
			-34
		],
		[
			-14,
			-12
		],
		[
			-10,
			-10
		],
		[
			2,
			-20
		],
		[
			4,
			-5
		],
		[
			11,
			-6
		],
		[
			7,
			-3
		],
		[
			1,
			-13
		],
		[
			-11,
			-46
		],
		[
			-6,
			-9
		],
		[
			-11,
			-8
		],
		[
			-5,
			-6
		],
		[
			-6,
			-11
		],
		[
			1,
			-16
		],
		[
			2,
			-21
		],
		[
			6,
			-24
		],
		[
			-4,
			-13
		],
		[
			-10,
			-23
		],
		[
			-28,
			-12
		],
		[
			-126,
			-56
		],
		[
			-18,
			18
		],
		[
			-19,
			31
		],
		[
			-14,
			10
		],
		[
			-146,
			-70
		],
		[
			-201,
			-94
		],
		[
			-16,
			-8
		],
		[
			-203,
			-95
		],
		[
			266,
			-503
		],
		[
			3,
			-8
		],
		[
			71,
			-134
		],
		[
			5,
			-11
		],
		[
			50,
			-95
		],
		[
			154,
			77
		],
		[
			49,
			25
		],
		[
			33,
			17
		],
		[
			46,
			23
		],
		[
			61,
			31
		],
		[
			28,
			14
		],
		[
			17,
			-13
		],
		[
			8,
			-10
		],
		[
			13,
			-17
		],
		[
			29,
			-34
		],
		[
			-3,
			-11
		],
		[
			-17,
			-10
		],
		[
			-18,
			-4
		],
		[
			-12,
			-5
		],
		[
			-8,
			-11
		],
		[
			-1,
			-18
		],
		[
			4,
			-18
		],
		[
			6,
			-33
		],
		[
			2,
			-32
		],
		[
			-8,
			-33
		],
		[
			-4,
			-29
		],
		[
			0,
			-2
		],
		[
			-3,
			-9
		],
		[
			-6,
			-22
		],
		[
			-9,
			-23
		],
		[
			-6,
			-27
		],
		[
			0,
			-26
		],
		[
			1,
			-12
		],
		[
			31,
			-35
		],
		[
			23,
			-14
		],
		[
			9,
			-2
		],
		[
			9,
			1
		],
		[
			23,
			-15
		],
		[
			15,
			-21
		],
		[
			0,
			-15
		],
		[
			-15,
			-23
		],
		[
			-30,
			-32
		],
		[
			-25,
			-19
		],
		[
			-12,
			-14
		],
		[
			-12,
			-19
		],
		[
			-4,
			-14
		],
		[
			0,
			-16
		],
		[
			28,
			-25
		],
		[
			18,
			-19
		],
		[
			-30,
			-21
		],
		[
			-263,
			-191
		],
		[
			-8,
			-6
		],
		[
			-47,
			-34
		],
		[
			54,
			-102
		],
		[
			45,
			33
		],
		[
			86,
			61
		],
		[
			26,
			19
		],
		[
			80,
			61
		],
		[
			32,
			24
		],
		[
			19,
			9
		],
		[
			37,
			18
		],
		[
			3,
			-9
		],
		[
			-8,
			-5
		],
		[
			-5,
			-7
		],
		[
			-7,
			-20
		],
		[
			-1,
			-20
		],
		[
			7,
			-21
		],
		[
			15,
			-13
		],
		[
			7,
			-5
		],
		[
			11,
			-4
		],
		[
			12,
			-7
		],
		[
			-22,
			-29
		],
		[
			-16,
			-21
		],
		[
			-94,
			-122
		],
		[
			69,
			-157
		],
		[
			-10,
			-5
		],
		[
			-34,
			-34
		],
		[
			-9,
			-9
		],
		[
			25,
			-54
		],
		[
			-2,
			-27
		],
		[
			15,
			-22
		],
		[
			24,
			-37
		],
		[
			8,
			-21
		],
		[
			5,
			-5
		],
		[
			24,
			1
		],
		[
			50,
			50
		],
		[
			45,
			45
		],
		[
			40,
			40
		],
		[
			21,
			20
		],
		[
			38,
			38
		],
		[
			382,
			380
		],
		[
			1,
			-359
		],
		[
			6,
			-126
		],
		[
			8,
			-148
		],
		[
			4,
			-93
		],
		[
			0,
			-8
		],
		[
			72,
			7
		],
		[
			12,
			8
		],
		[
			3,
			3
		],
		[
			11,
			12
		],
		[
			11,
			16
		],
		[
			3,
			11
		],
		[
			-1,
			16
		],
		[
			-5,
			18
		],
		[
			1,
			24
		],
		[
			11,
			12
		],
		[
			10,
			10
		],
		[
			21,
			19
		],
		[
			29,
			13
		],
		[
			28,
			21
		],
		[
			17,
			23
		],
		[
			48,
			38
		],
		[
			17,
			14
		],
		[
			16,
			16
		],
		[
			24,
			25
		],
		[
			26,
			13
		],
		[
			29,
			11
		],
		[
			56,
			8
		],
		[
			30,
			-1
		],
		[
			43,
			-4
		],
		[
			6,
			2
		],
		[
			32,
			25
		],
		[
			10,
			23
		],
		[
			13,
			13
		],
		[
			38,
			11
		],
		[
			22,
			8
		],
		[
			19,
			8
		],
		[
			31,
			7
		],
		[
			14,
			7
		],
		[
			9,
			8
		],
		[
			17,
			22
		],
		[
			19,
			26
		],
		[
			15,
			5
		],
		[
			29,
			11
		],
		[
			56,
			25
		],
		[
			10,
			-33
		],
		[
			10,
			-36
		],
		[
			3,
			-13
		],
		[
			23,
			-129
		],
		[
			3,
			-16
		],
		[
			4,
			-24
		],
		[
			12,
			-72
		],
		[
			30,
			-167
		],
		[
			12,
			-67
		],
		[
			19,
			-103
		],
		[
			11,
			-62
		],
		[
			24,
			-133
		],
		[
			4,
			-21
		],
		[
			4,
			-23
		],
		[
			29,
			-167
		],
		[
			14,
			-78
		]
	],
	[
		[
			11079,
			30026
		],
		[
			2,
			30
		],
		[
			-13,
			15
		],
		[
			-19,
			3
		],
		[
			-8,
			-6
		],
		[
			-6,
			-4
		],
		[
			-8,
			-28
		],
		[
			-17,
			-23
		],
		[
			-30,
			-29
		],
		[
			-12,
			-9
		],
		[
			-13,
			-10
		],
		[
			-20,
			-2
		],
		[
			-24,
			13
		],
		[
			-4,
			20
		],
		[
			0,
			21
		],
		[
			1,
			42
		],
		[
			0,
			20
		],
		[
			-2,
			26
		],
		[
			-2,
			41
		],
		[
			-1,
			16
		],
		[
			5,
			122
		],
		[
			1,
			5
		],
		[
			0,
			3
		],
		[
			5,
			25
		],
		[
			29,
			31
		],
		[
			6,
			7
		],
		[
			28,
			20
		],
		[
			10,
			7
		],
		[
			20,
			2
		],
		[
			2,
			0
		],
		[
			27,
			-12
		],
		[
			18,
			7
		],
		[
			8,
			13
		],
		[
			6,
			24
		],
		[
			5,
			29
		],
		[
			1,
			11
		],
		[
			7,
			47
		],
		[
			3,
			38
		],
		[
			-8,
			8
		],
		[
			-10,
			12
		],
		[
			-12,
			1
		],
		[
			-4,
			0
		],
		[
			0,
			-1
		],
		[
			-1,
			-12
		],
		[
			-13,
			-20
		],
		[
			-29,
			-7
		],
		[
			-22,
			15
		],
		[
			-22,
			35
		],
		[
			0,
			24
		],
		[
			4,
			44
		],
		[
			3,
			10
		],
		[
			-6,
			17
		],
		[
			-9,
			23
		],
		[
			-4,
			10
		],
		[
			-22,
			52
		],
		[
			-2,
			5
		],
		[
			-37,
			23
		],
		[
			-3,
			0
		],
		[
			-65,
			-5
		],
		[
			0,
			0
		],
		[
			-32,
			17
		],
		[
			-20,
			10
		],
		[
			-13,
			14
		],
		[
			-12,
			18
		],
		[
			-13,
			32
		],
		[
			-12,
			57
		],
		[
			11,
			23
		],
		[
			27,
			35
		],
		[
			3,
			5
		],
		[
			49,
			65
		],
		[
			43,
			59
		],
		[
			35,
			49
		],
		[
			17,
			9
		],
		[
			18,
			17
		],
		[
			29,
			74
		],
		[
			17,
			52
		],
		[
			1,
			3
		],
		[
			-5,
			28
		],
		[
			-9,
			46
		],
		[
			0,
			1
		],
		[
			-19,
			11
		],
		[
			-27,
			16
		],
		[
			-7,
			4
		],
		[
			-31,
			-23
		],
		[
			-32,
			-12
		],
		[
			-34,
			8
		],
		[
			-24,
			28
		],
		[
			-6,
			24
		],
		[
			-35,
			44
		],
		[
			-5,
			5
		],
		[
			-6,
			6
		],
		[
			-42,
			40
		],
		[
			-35,
			25
		],
		[
			-28,
			30
		],
		[
			-27,
			52
		],
		[
			-14,
			66
		],
		[
			1,
			44
		],
		[
			0,
			7
		],
		[
			-49,
			8
		],
		[
			-51,
			-11
		],
		[
			-34,
			-37
		],
		[
			-80,
			-88
		],
		[
			-23,
			-25
		],
		[
			-21,
			-23
		],
		[
			-14,
			-22
		],
		[
			-24,
			-3
		],
		[
			-16,
			11
		],
		[
			-10,
			20
		],
		[
			-6,
			42
		],
		[
			6,
			61
		],
		[
			15,
			52
		],
		[
			23,
			26
		],
		[
			5,
			5
		],
		[
			10,
			13
		],
		[
			2,
			19
		],
		[
			-12,
			19
		],
		[
			-21,
			5
		],
		[
			-16,
			-11
		],
		[
			-8,
			-12
		],
		[
			-25,
			-36
		],
		[
			-6,
			-8
		],
		[
			-5,
			-63
		],
		[
			-2,
			-18
		],
		[
			-5,
			-27
		],
		[
			-25,
			-24
		],
		[
			-39,
			-3
		],
		[
			-72,
			14
		],
		[
			-25,
			8
		],
		[
			-19,
			13
		],
		[
			-18,
			28
		],
		[
			0,
			24
		],
		[
			23,
			16
		],
		[
			4,
			3
		],
		[
			16,
			10
		],
		[
			8,
			15
		],
		[
			-8,
			22
		],
		[
			-12,
			8
		],
		[
			-2,
			2
		],
		[
			-30,
			1
		],
		[
			-26,
			-8
		],
		[
			-51,
			-18
		],
		[
			-62,
			-22
		],
		[
			-39,
			-11
		],
		[
			-22,
			17
		],
		[
			-11,
			20
		],
		[
			-31,
			53
		],
		[
			-17,
			28
		],
		[
			-14,
			27
		],
		[
			1,
			18
		],
		[
			0,
			3
		],
		[
			0,
			12
		],
		[
			6,
			24
		],
		[
			2,
			9
		],
		[
			-1,
			3
		],
		[
			-13,
			25
		],
		[
			-24,
			18
		],
		[
			-54,
			24
		],
		[
			-48,
			42
		],
		[
			-19,
			31
		],
		[
			1,
			9
		],
		[
			2,
			25
		],
		[
			7,
			93
		],
		[
			2,
			29
		],
		[
			10,
			25
		],
		[
			0,
			3
		],
		[
			0,
			1
		],
		[
			-1,
			13
		],
		[
			0,
			18
		],
		[
			-1,
			14
		],
		[
			-26,
			27
		],
		[
			-17,
			14
		],
		[
			-22,
			18
		],
		[
			-15,
			15
		],
		[
			-50,
			46
		],
		[
			-7,
			11
		],
		[
			3,
			10
		],
		[
			13,
			13
		],
		[
			12,
			3
		],
		[
			32,
			6
		],
		[
			46,
			10
		],
		[
			16,
			4
		],
		[
			19,
			10
		],
		[
			9,
			13
		],
		[
			-5,
			26
		],
		[
			-10,
			5
		],
		[
			-16,
			9
		],
		[
			-29,
			-11
		],
		[
			-55,
			-3
		],
		[
			-22,
			4
		],
		[
			-31,
			5
		],
		[
			-17,
			14
		],
		[
			-79,
			62
		],
		[
			-32,
			29
		],
		[
			-10,
			10
		],
		[
			-10,
			29
		],
		[
			-7,
			23
		],
		[
			-18,
			59
		],
		[
			-11,
			35
		],
		[
			-1,
			3
		],
		[
			-8,
			26
		],
		[
			-19,
			38
		],
		[
			-18,
			36
		],
		[
			-25,
			50
		],
		[
			-19,
			21
		],
		[
			-9,
			23
		],
		[
			-15,
			78
		],
		[
			9,
			23
		],
		[
			9,
			9
		],
		[
			46,
			45
		],
		[
			55,
			47
		],
		[
			18,
			18
		],
		[
			1,
			30
		],
		[
			-16,
			21
		],
		[
			-17,
			9
		],
		[
			-58,
			1
		],
		[
			-35,
			-7
		],
		[
			-60,
			-13
		],
		[
			-73,
			-1
		],
		[
			-33,
			12
		],
		[
			-21,
			17
		]
	],
	[
		[
			8988,
			33305
		],
		[
			280,
			176
		],
		[
			1,
			4
		],
		[
			13,
			31
		],
		[
			3,
			9
		],
		[
			42,
			19
		],
		[
			134,
			62
		],
		[
			858,
			553
		],
		[
			165,
			-40
		],
		[
			44,
			138
		],
		[
			68,
			-18
		],
		[
			26,
			96
		],
		[
			148,
			-109
		],
		[
			167,
			-38
		],
		[
			215,
			-49
		],
		[
			49,
			-82
		],
		[
			89,
			75
		],
		[
			82,
			-79
		],
		[
			309,
			280
		],
		[
			-161,
			154
		],
		[
			44,
			41
		],
		[
			-39,
			36
		],
		[
			1,
			68
		],
		[
			318,
			576
		],
		[
			338,
			437
		],
		[
			180,
			-244
		],
		[
			-35,
			-35
		],
		[
			137,
			-88
		],
		[
			284,
			37
		],
		[
			104,
			125
		],
		[
			85,
			-3
		],
		[
			38,
			55
		],
		[
			140,
			319
		],
		[
			43,
			262
		],
		[
			209,
			269
		]
	],
	[
		[
			13367,
			36342
		],
		[
			98,
			-141
		],
		[
			359,
			-80
		],
		[
			301,
			-138
		],
		[
			101,
			-110
		],
		[
			151,
			-82
		],
		[
			-255,
			-116
		],
		[
			-25,
			-11
		],
		[
			-28,
			-13
		],
		[
			71,
			-66
		],
		[
			19,
			9
		],
		[
			45,
			20
		],
		[
			14,
			7
		],
		[
			26,
			11
		],
		[
			72,
			33
		],
		[
			23,
			11
		],
		[
			-4,
			-5
		],
		[
			-20,
			-25
		],
		[
			-17,
			-22
		],
		[
			151,
			-50
		],
		[
			159,
			116
		],
		[
			93,
			-94
		],
		[
			7,
			13
		],
		[
			38,
			63
		],
		[
			3,
			1
		],
		[
			223,
			48
		]
	],
	[
		[
			14972,
			35721
		],
		[
			204,
			-248
		],
		[
			-364,
			-299
		],
		[
			55,
			-50
		],
		[
			-53,
			-52
		],
		[
			96,
			-85
		],
		[
			-37,
			-68
		],
		[
			111,
			-101
		],
		[
			-3,
			-65
		],
		[
			89,
			-142
		],
		[
			159,
			164
		],
		[
			21,
			-31
		],
		[
			104,
			-8
		],
		[
			109,
			-256
		],
		[
			0,
			-11
		],
		[
			-1,
			-185
		],
		[
			54,
			11
		],
		[
			31,
			-94
		],
		[
			83,
			22
		],
		[
			204,
			-119
		],
		[
			50,
			-76
		],
		[
			-59,
			-20
		],
		[
			18,
			-168
		],
		[
			-308,
			-83
		],
		[
			-61,
			82
		],
		[
			-161,
			-65
		],
		[
			-28,
			-445
		],
		[
			-28,
			-63
		],
		[
			-65,
			-145
		],
		[
			-171,
			3
		],
		[
			-225,
			-127
		],
		[
			-57,
			84
		],
		[
			-195,
			-158
		],
		[
			139,
			-407
		],
		[
			281,
			-131
		],
		[
			4,
			66
		],
		[
			-47,
			5
		],
		[
			0,
			56
		],
		[
			142,
			-18
		],
		[
			28,
			-109
		],
		[
			407,
			-36
		],
		[
			-31,
			-406
		],
		[
			-100,
			-89
		],
		[
			-81,
			-22
		],
		[
			5,
			-54
		],
		[
			-78,
			-82
		]
	],
	[
		[
			21540,
			30886
		],
		[
			563,
			85
		],
		[
			114,
			160
		],
		[
			-69,
			38
		],
		[
			-1,
			1
		],
		[
			-98,
			132
		],
		[
			106,
			313
		],
		[
			-16,
			40
		],
		[
			102,
			47
		],
		[
			-55,
			185
		],
		[
			192,
			87
		],
		[
			2,
			1
		],
		[
			353,
			273
		],
		[
			-63,
			74
		],
		[
			124,
			98
		],
		[
			73,
			-81
		],
		[
			1054,
			536
		],
		[
			-193,
			118
		],
		[
			96,
			900
		]
	],
	[
		[
			23824,
			33893
		],
		[
			717,
			-552
		],
		[
			-42,
			-182
		],
		[
			14,
			-2
		],
		[
			400,
			-56
		],
		[
			15,
			-60
		],
		[
			184,
			-43
		],
		[
			67,
			-129
		],
		[
			155,
			56
		],
		[
			-121,
			250
		],
		[
			86,
			72
		],
		[
			112,
			-178
		],
		[
			80,
			58
		],
		[
			267,
			-75
		],
		[
			-57,
			108
		],
		[
			199,
			44
		],
		[
			14,
			121
		],
		[
			170,
			187
		],
		[
			62,
			-69
		],
		[
			-64,
			-108
		],
		[
			96,
			-14
		],
		[
			62,
			28
		],
		[
			51,
			-44
		],
		[
			78,
			40
		],
		[
			23,
			-112
		],
		[
			91,
			-95
		],
		[
			205,
			94
		],
		[
			146,
			-349
		],
		[
			72,
			26
		],
		[
			24,
			-79
		],
		[
			41,
			16
		],
		[
			34,
			-66
		],
		[
			-109,
			-82
		],
		[
			104,
			-257
		],
		[
			110,
			39
		],
		[
			86,
			-111
		],
		[
			267,
			84
		],
		[
			42,
			13
		]
	],
	[
		[
			8988,
			33305
		],
		[
			-10,
			8
		],
		[
			-61,
			47
		],
		[
			-43,
			24
		],
		[
			-34,
			19
		],
		[
			-61,
			28
		],
		[
			-83,
			47
		],
		[
			-5,
			4
		],
		[
			-27,
			22
		],
		[
			-9,
			12
		],
		[
			-7,
			12
		],
		[
			-2,
			6
		],
		[
			-13,
			37
		],
		[
			-15,
			46
		],
		[
			-15,
			24
		],
		[
			-3,
			6
		],
		[
			-18,
			31
		],
		[
			-8,
			14
		],
		[
			-11,
			21
		],
		[
			-9,
			38
		],
		[
			0,
			1
		],
		[
			1,
			6
		],
		[
			3,
			19
		],
		[
			-5,
			28
		],
		[
			-18,
			42
		],
		[
			-29,
			24
		],
		[
			-21,
			14
		],
		[
			-68,
			19
		],
		[
			-127,
			38
		],
		[
			-45,
			20
		],
		[
			-40,
			23
		],
		[
			-25,
			29
		],
		[
			-4,
			8
		],
		[
			-14,
			25
		],
		[
			-41,
			62
		],
		[
			-32,
			45
		],
		[
			-22,
			19
		],
		[
			-47,
			31
		],
		[
			-15,
			13
		],
		[
			-9,
			8
		],
		[
			-1,
			39
		],
		[
			4,
			36
		],
		[
			-5,
			35
		],
		[
			-2,
			8
		],
		[
			-15,
			46
		],
		[
			-13,
			36
		],
		[
			-13,
			19
		],
		[
			-18,
			28
		],
		[
			-6,
			10
		],
		[
			-70,
			29
		],
		[
			-13,
			0
		],
		[
			-26,
			-2
		],
		[
			-28,
			6
		],
		[
			-16,
			7
		],
		[
			-6,
			15
		],
		[
			-12,
			33
		],
		[
			-5,
			14
		],
		[
			-4,
			23
		],
		[
			6,
			20
		],
		[
			21,
			45
		],
		[
			11,
			23
		],
		[
			0,
			8
		],
		[
			4,
			64
		],
		[
			1,
			18
		],
		[
			-2,
			22
		],
		[
			-14,
			16
		],
		[
			-12,
			5
		],
		[
			-16,
			7
		],
		[
			-7,
			1
		],
		[
			-3,
			1
		],
		[
			-33,
			5
		],
		[
			-16,
			-2
		],
		[
			-16,
			-1
		],
		[
			-47,
			5
		],
		[
			-29,
			14
		],
		[
			-26,
			33
		],
		[
			-10,
			13
		],
		[
			-27,
			37
		],
		[
			-7,
			10
		],
		[
			-2,
			16
		],
		[
			9,
			14
		],
		[
			5,
			6
		],
		[
			26,
			36
		],
		[
			21,
			28
		],
		[
			10,
			16
		],
		[
			1,
			23
		],
		[
			1,
			26
		],
		[
			-7,
			1
		],
		[
			-29,
			6
		],
		[
			-8,
			-5
		],
		[
			-7,
			-4
		],
		[
			-37,
			-1
		],
		[
			-44,
			50
		],
		[
			-6,
			14
		],
		[
			8,
			28
		],
		[
			6,
			20
		],
		[
			-1,
			18
		],
		[
			-2,
			18
		],
		[
			-8,
			33
		],
		[
			-10,
			21
		],
		[
			-32,
			21
		],
		[
			-30,
			9
		],
		[
			-6,
			2
		],
		[
			-43,
			17
		],
		[
			-13,
			7
		],
		[
			-17,
			10
		],
		[
			-18,
			14
		],
		[
			-22,
			31
		],
		[
			0,
			11
		],
		[
			47,
			45
		],
		[
			19,
			63
		],
		[
			7,
			22
		],
		[
			30,
			43
		],
		[
			35,
			28
		],
		[
			31,
			5
		],
		[
			5,
			-3
		],
		[
			11,
			-5
		],
		[
			13,
			-10
		],
		[
			31,
			-25
		],
		[
			32,
			-25
		],
		[
			3,
			-2
		],
		[
			12,
			-9
		],
		[
			105,
			-69
		],
		[
			15,
			-5
		],
		[
			19,
			-7
		],
		[
			4,
			-1
		],
		[
			37,
			0
		],
		[
			4,
			2
		],
		[
			14,
			7
		],
		[
			19,
			13
		],
		[
			9,
			24
		],
		[
			0,
			11
		],
		[
			0,
			16
		],
		[
			-14,
			23
		],
		[
			-27,
			8
		],
		[
			-35,
			3
		],
		[
			-27,
			7
		],
		[
			-29,
			20
		],
		[
			-17,
			21
		],
		[
			-2,
			3
		],
		[
			-1,
			3
		],
		[
			-8,
			20
		],
		[
			-2,
			5
		],
		[
			-3,
			33
		],
		[
			10,
			27
		],
		[
			41,
			85
		],
		[
			14,
			16
		],
		[
			24,
			10
		],
		[
			15,
			0
		],
		[
			15,
			1
		],
		[
			47,
			8
		],
		[
			28,
			15
		],
		[
			3,
			13
		],
		[
			0,
			27
		],
		[
			-5,
			30
		],
		[
			-6,
			16
		],
		[
			-17,
			7
		],
		[
			-23,
			-2
		],
		[
			-15,
			-7
		],
		[
			-19,
			-27
		],
		[
			-2,
			-2
		],
		[
			-12,
			-20
		],
		[
			-14,
			-10
		],
		[
			-19,
			-8
		],
		[
			-26,
			3
		],
		[
			-30,
			7
		],
		[
			-25,
			18
		],
		[
			-9,
			19
		],
		[
			5,
			19
		],
		[
			14,
			5
		],
		[
			22,
			6
		],
		[
			11,
			3
		],
		[
			31,
			15
		],
		[
			9,
			21
		],
		[
			-5,
			26
		],
		[
			-6,
			10
		],
		[
			-6,
			9
		]
	],
	[
		[
			7657,
			36041
		],
		[
			71,
			22
		],
		[
			74,
			146
		],
		[
			43,
			11
		],
		[
			-55,
			176
		],
		[
			302,
			-43
		],
		[
			-4,
			209
		],
		[
			-138,
			53
		],
		[
			96,
			236
		],
		[
			192,
			-69
		],
		[
			297,
			681
		],
		[
			188,
			-165
		],
		[
			0,
			0
		],
		[
			19,
			7
		],
		[
			66,
			22
		],
		[
			24,
			62
		],
		[
			2,
			-1
		],
		[
			82,
			-17
		],
		[
			355,
			-341
		],
		[
			1,
			0
		],
		[
			0,
			1
		],
		[
			7,
			25
		],
		[
			23,
			81
		],
		[
			14,
			51
		],
		[
			18,
			14
		],
		[
			97,
			72
		],
		[
			1,
			6
		],
		[
			8,
			65
		],
		[
			1,
			1
		],
		[
			72,
			59
		],
		[
			39,
			92
		],
		[
			85,
			203
		],
		[
			41,
			99
		],
		[
			257,
			-192
		],
		[
			265,
			-54
		],
		[
			6,
			-1
		],
		[
			25,
			103
		],
		[
			444,
			-93
		],
		[
			13,
			-95
		],
		[
			88,
			-15
		],
		[
			-17,
			-46
		],
		[
			106,
			-101
		],
		[
			6,
			4
		],
		[
			367,
			228
		],
		[
			522,
			-522
		],
		[
			127,
			96
		],
		[
			58,
			-43
		],
		[
			369,
			245
		],
		[
			93,
			81
		],
		[
			225,
			196
		],
		[
			187,
			-197
		],
		[
			65,
			55
		],
		[
			100,
			-86
		],
		[
			43,
			-281
		],
		[
			79,
			6
		],
		[
			217,
			-271
		],
		[
			-16,
			-69
		],
		[
			106,
			-55
		],
		[
			3,
			4
		],
		[
			21,
			31
		],
		[
			62,
			-34
		],
		[
			15,
			-8
		],
		[
			10,
			-5
		],
		[
			74,
			-40
		]
	],
	[
		[
			13598,
			36640
		],
		[
			-38,
			14
		],
		[
			-64,
			-44
		],
		[
			3,
			-92
		],
		[
			-132,
			-176
		]
	],
	[
		[
			13598,
			36640
		],
		[
			-67,
			-87
		],
		[
			347,
			-183
		],
		[
			121,
			3
		],
		[
			-12,
			-56
		],
		[
			103,
			-55
		],
		[
			55,
			-74
		],
		[
			-44,
			-64
		],
		[
			183,
			-136
		],
		[
			18,
			1
		],
		[
			40,
			2
		],
		[
			9,
			1
		],
		[
			61,
			3
		],
		[
			9,
			24
		],
		[
			15,
			35
		],
		[
			21,
			-26
		],
		[
			4,
			-5
		],
		[
			65,
			64
		],
		[
			37,
			36
		],
		[
			1,
			7
		],
		[
			6,
			48
		],
		[
			0,
			1
		],
		[
			31,
			-9
		],
		[
			7,
			-3
		],
		[
			31,
			33
		],
		[
			-6,
			7
		],
		[
			-128,
			153
		],
		[
			4,
			5
		],
		[
			66,
			65
		],
		[
			-24,
			78
		],
		[
			-2,
			4
		],
		[
			117,
			120
		],
		[
			37,
			37
		],
		[
			105,
			39
		],
		[
			10,
			-5
		],
		[
			79,
			-32
		],
		[
			33,
			-13
		]
	],
	[
		[
			14930,
			36658
		],
		[
			9,
			-4
		],
		[
			5,
			-1
		],
		[
			332,
			-120
		],
		[
			43,
			28
		],
		[
			77,
			-75
		],
		[
			21,
			-20
		],
		[
			24,
			-24
		],
		[
			102,
			28
		],
		[
			100,
			45
		],
		[
			-229,
			223
		],
		[
			52,
			106
		],
		[
			65,
			92
		],
		[
			84,
			-94
		],
		[
			26,
			88
		],
		[
			239,
			157
		],
		[
			370,
			-330
		],
		[
			-93,
			-75
		],
		[
			266,
			-129
		],
		[
			6,
			-3
		],
		[
			-84,
			-138
		],
		[
			-298,
			-243
		],
		[
			-9,
			-7
		],
		[
			-1,
			-1
		],
		[
			-12,
			-3
		],
		[
			-92,
			-20
		],
		[
			-77,
			13
		],
		[
			-230,
			214
		],
		[
			21,
			47
		],
		[
			-46,
			58
		],
		[
			-194,
			-65
		],
		[
			112,
			-219
		],
		[
			-32,
			3
		],
		[
			30,
			-116
		],
		[
			25,
			-94
		],
		[
			-151,
			-8
		],
		[
			-66,
			-169
		],
		[
			-106,
			-80
		],
		[
			-44,
			46
		],
		[
			-203,
			-47
		]
	],
	[
		[
			17603,
			31292
		],
		[
			17,
			501
		],
		[
			-6,
			82
		],
		[
			-40,
			602
		],
		[
			-103,
			36
		],
		[
			46,
			225
		],
		[
			73,
			356
		],
		[
			193,
			-100
		],
		[
			-7,
			-51
		],
		[
			93,
			-26
		],
		[
			4,
			-30
		],
		[
			27,
			28
		],
		[
			359,
			-177
		],
		[
			87,
			220
		],
		[
			-35,
			100
		],
		[
			38,
			55
		],
		[
			238,
			-30
		],
		[
			33,
			-30
		],
		[
			74,
			29
		],
		[
			506,
			-10
		],
		[
			743,
			-179
		],
		[
			40,
			159
		],
		[
			101,
			404
		],
		[
			21,
			392
		],
		[
			180,
			-18
		],
		[
			48,
			-96
		],
		[
			175,
			-65
		],
		[
			-109,
			295
		],
		[
			-73,
			402
		],
		[
			43,
			27
		],
		[
			52,
			32
		],
		[
			77,
			-27
		],
		[
			-123,
			614
		]
	],
	[
		[
			20375,
			35012
		],
		[
			-32,
			101
		],
		[
			40,
			12
		],
		[
			378,
			43
		],
		[
			149,
			-62
		],
		[
			32,
			-13
		],
		[
			300,
			61
		],
		[
			-4,
			61
		],
		[
			-31,
			16
		],
		[
			-11,
			7
		],
		[
			436,
			479
		],
		[
			90,
			-64
		]
	],
	[
		[
			21722,
			35653
		],
		[
			163,
			-107
		],
		[
			131,
			175
		],
		[
			210,
			-150
		],
		[
			283,
			-128
		],
		[
			136,
			-62
		],
		[
			-16,
			-27
		],
		[
			304,
			-180
		]
	],
	[
		[
			22933,
			35174
		],
		[
			-49,
			-53
		],
		[
			-221,
			-540
		],
		[
			592,
			-224
		],
		[
			62,
			71
		],
		[
			146,
			-109
		],
		[
			8,
			-6
		],
		[
			-4,
			23
		],
		[
			-6,
			32
		],
		[
			-6,
			38
		],
		[
			50,
			7
		],
		[
			405,
			-56
		],
		[
			-188,
			-330
		],
		[
			115,
			-32
		],
		[
			-13,
			-102
		]
	],
	[
		[
			14930,
			36658
		],
		[
			-25,
			130
		],
		[
			24,
			165
		],
		[
			-36,
			106
		],
		[
			-122,
			-36
		]
	],
	[
		[
			14771,
			37023
		],
		[
			122,
			489
		],
		[
			303,
			195
		],
		[
			151,
			-210
		],
		[
			418,
			256
		],
		[
			265,
			216
		],
		[
			2,
			2
		],
		[
			32,
			96
		],
		[
			20,
			58
		],
		[
			4,
			12
		],
		[
			-11,
			10
		],
		[
			-6,
			6
		],
		[
			-87,
			82
		],
		[
			130,
			125
		]
	],
	[
		[
			16114,
			38360
		],
		[
			78,
			-73
		],
		[
			166,
			144
		],
		[
			77,
			-252
		],
		[
			97,
			-77
		],
		[
			-101,
			-101
		],
		[
			9,
			-73
		],
		[
			113,
			-127
		],
		[
			150,
			90
		],
		[
			98,
			-99
		],
		[
			-68,
			-132
		],
		[
			-82,
			-161
		],
		[
			436,
			-289
		],
		[
			44,
			-30
		],
		[
			215,
			-143
		],
		[
			0,
			7
		],
		[
			8,
			71
		],
		[
			0,
			2
		],
		[
			0,
			0
		],
		[
			19,
			16
		],
		[
			148,
			126
		],
		[
			113,
			22
		],
		[
			13,
			2
		],
		[
			208,
			-515
		],
		[
			18,
			-401
		],
		[
			534,
			11
		],
		[
			445,
			-37
		],
		[
			35,
			-37
		],
		[
			-188,
			-159
		],
		[
			-80,
			72
		],
		[
			-326,
			-349
		],
		[
			74,
			-24
		],
		[
			144,
			129
		],
		[
			133,
			-125
		],
		[
			50,
			43
		],
		[
			157,
			-149
		],
		[
			-41,
			-35
		],
		[
			115,
			-112
		],
		[
			48,
			38
		],
		[
			49,
			40
		],
		[
			65,
			10
		],
		[
			442,
			-203
		],
		[
			221,
			-190
		],
		[
			56,
			53
		],
		[
			165,
			-137
		],
		[
			8,
			-22
		],
		[
			29,
			-80
		],
		[
			150,
			62
		],
		[
			57,
			-185
		],
		[
			160,
			31
		]
	],
	[
		[
			7657,
			36041
		],
		[
			-34,
			57
		],
		[
			-16,
			23
		],
		[
			-2,
			1
		],
		[
			-13,
			10
		],
		[
			-18,
			-2
		],
		[
			-17,
			-6
		],
		[
			-27,
			-19
		],
		[
			-12,
			-9
		],
		[
			-41,
			-38
		],
		[
			-15,
			-4
		],
		[
			-22,
			2
		],
		[
			-8,
			9
		],
		[
			-10,
			18
		],
		[
			-2,
			27
		],
		[
			13,
			23
		],
		[
			19,
			18
		],
		[
			5,
			11
		],
		[
			5,
			13
		],
		[
			-1,
			5
		],
		[
			-2,
			15
		],
		[
			-10,
			41
		],
		[
			-11,
			40
		],
		[
			-33,
			77
		],
		[
			-5,
			10
		],
		[
			-1,
			4
		],
		[
			-65,
			29
		],
		[
			-56,
			45
		],
		[
			-4,
			5
		],
		[
			-3,
			3
		],
		[
			-22,
			30
		],
		[
			-3,
			10
		],
		[
			-7,
			23
		],
		[
			9,
			30
		],
		[
			10,
			22
		],
		[
			4,
			9
		],
		[
			-3,
			17
		],
		[
			-12,
			14
		],
		[
			-19,
			12
		],
		[
			-36,
			17
		],
		[
			-49,
			22
		],
		[
			-21,
			0
		],
		[
			-43,
			15
		],
		[
			-32,
			18
		],
		[
			-5,
			2
		],
		[
			-3,
			76
		],
		[
			5,
			10
		],
		[
			18,
			35
		],
		[
			25,
			29
		],
		[
			40,
			29
		],
		[
			27,
			17
		],
		[
			11,
			25
		],
		[
			1,
			3
		],
		[
			-6,
			30
		],
		[
			-27,
			15
		],
		[
			-26,
			5
		],
		[
			-24,
			-7
		],
		[
			-69,
			-21
		],
		[
			-59,
			-16
		],
		[
			-11,
			-3
		],
		[
			-49,
			19
		],
		[
			-23,
			28
		],
		[
			-21,
			42
		],
		[
			-7,
			40
		],
		[
			20,
			61
		],
		[
			51,
			54
		],
		[
			41,
			31
		],
		[
			32,
			-9
		],
		[
			4,
			-8
		],
		[
			12,
			-24
		],
		[
			9,
			-45
		],
		[
			21,
			-18
		],
		[
			38,
			-3
		],
		[
			20,
			6
		],
		[
			3,
			1
		],
		[
			82,
			46
		],
		[
			10,
			6
		],
		[
			27,
			17
		],
		[
			7,
			12
		],
		[
			7,
			14
		],
		[
			4,
			30
		],
		[
			-11,
			36
		],
		[
			-9,
			11
		],
		[
			-8,
			12
		],
		[
			-17,
			7
		],
		[
			-12,
			2
		],
		[
			-26,
			3
		],
		[
			-65,
			4
		],
		[
			-62,
			3
		],
		[
			-38,
			23
		],
		[
			-9,
			5
		],
		[
			-69,
			42
		],
		[
			-103,
			62
		],
		[
			-121,
			864
		],
		[
			0,
			1
		],
		[
			-12,
			7
		],
		[
			-68,
			38
		],
		[
			-470,
			264
		],
		[
			132,
			179
		],
		[
			129,
			173
		]
	],
	[
		[
			6393,
			38953
		],
		[
			135,
			-34
		],
		[
			63,
			-16
		],
		[
			385,
			243
		],
		[
			-14,
			24
		],
		[
			135,
			99
		],
		[
			-147,
			177
		],
		[
			74,
			51
		],
		[
			-61,
			67
		],
		[
			299,
			239
		],
		[
			-80,
			154
		],
		[
			131,
			93
		],
		[
			36,
			-50
		],
		[
			66,
			31
		],
		[
			-16,
			32
		],
		[
			436,
			324
		],
		[
			107,
			-143
		],
		[
			49,
			-35
		],
		[
			28,
			29
		],
		[
			142,
			-120
		],
		[
			18,
			53
		],
		[
			0,
			0
		],
		[
			3,
			9
		],
		[
			57,
			9
		],
		[
			1,
			-1
		],
		[
			140,
			-191
		],
		[
			40,
			28
		],
		[
			135,
			-172
		],
		[
			352,
			424
		],
		[
			223,
			-229
		],
		[
			421,
			292
		],
		[
			-38,
			51
		],
		[
			56,
			40
		],
		[
			400,
			184
		],
		[
			24,
			-40
		],
		[
			403,
			193
		],
		[
			-26,
			538
		]
	],
	[
		[
			10370,
			41306
		],
		[
			137,
			-26
		],
		[
			164,
			-121
		],
		[
			-42,
			-44
		],
		[
			133,
			-98
		],
		[
			36,
			-77
		],
		[
			97,
			-21
		],
		[
			107,
			-99
		],
		[
			65,
			20
		],
		[
			88,
			-50
		],
		[
			178,
			4
		],
		[
			48,
			18
		],
		[
			68,
			26
		],
		[
			70,
			26
		],
		[
			2,
			4
		],
		[
			32,
			55
		],
		[
			99,
			38
		],
		[
			14,
			5
		],
		[
			196,
			-100
		],
		[
			0,
			-38
		],
		[
			62,
			-5
		],
		[
			149,
			-125
		],
		[
			67,
			-10
		]
	],
	[
		[
			12140,
			40688
		],
		[
			-295,
			-216
		],
		[
			-11,
			-167
		],
		[
			-6,
			-80
		],
		[
			-100,
			-74
		],
		[
			58,
			-94
		],
		[
			-248,
			-209
		],
		[
			314,
			-438
		],
		[
			-312,
			-159
		],
		[
			218,
			-316
		],
		[
			79,
			69
		],
		[
			86,
			-134
		],
		[
			120,
			38
		],
		[
			26,
			-53
		],
		[
			113,
			61
		],
		[
			187,
			-62
		],
		[
			105,
			8
		],
		[
			411,
			-89
		],
		[
			76,
			-16
		],
		[
			1,
			0
		],
		[
			31,
			-47
		],
		[
			5,
			-8
		],
		[
			-41,
			-13
		],
		[
			-16,
			-5
		],
		[
			1,
			-1
		],
		[
			26,
			-50
		],
		[
			-82,
			1
		],
		[
			-10,
			0
		],
		[
			-10,
			-212
		],
		[
			18,
			-17
		],
		[
			47,
			-42
		],
		[
			24,
			-22
		],
		[
			37,
			-7
		],
		[
			14,
			-2
		],
		[
			46,
			-8
		],
		[
			1,
			0
		],
		[
			0,
			0
		],
		[
			-16,
			-50
		],
		[
			-27,
			-85
		],
		[
			-2,
			-8
		],
		[
			47,
			-3
		],
		[
			64,
			-4
		],
		[
			3,
			0
		],
		[
			58,
			-81
		],
		[
			136,
			-22
		],
		[
			16,
			-2
		],
		[
			10,
			-9
		],
		[
			131,
			-110
		],
		[
			68,
			-58
		],
		[
			3,
			-2
		],
		[
			7,
			-6
		],
		[
			-2,
			-3
		],
		[
			-33,
			-57
		],
		[
			3,
			-12
		],
		[
			11,
			-47
		],
		[
			11,
			-47
		],
		[
			9,
			-9
		],
		[
			56,
			-58
		],
		[
			76,
			-77
		],
		[
			6,
			-22
		],
		[
			54,
			-182
		],
		[
			5,
			-16
		],
		[
			21,
			-3
		],
		[
			128,
			-18
		],
		[
			436,
			265
		],
		[
			146,
			39
		],
		[
			8,
			-73
		],
		[
			70,
			9
		],
		[
			11,
			-240
		],
		[
			133,
			18
		],
		[
			14,
			-337
		],
		[
			57,
			9
		]
	],
	[
		[
			22933,
			35174
		],
		[
			254,
			147
		],
		[
			101,
			251
		],
		[
			177,
			242
		],
		[
			-39,
			-4
		],
		[
			56,
			108
		],
		[
			144,
			-80
		],
		[
			9,
			-56
		],
		[
			529,
			-264
		],
		[
			88,
			-217
		],
		[
			249,
			-12
		],
		[
			-65,
			106
		],
		[
			-88,
			-23
		],
		[
			-57,
			93
		],
		[
			430,
			58
		],
		[
			-97,
			261
		],
		[
			-37,
			99
		],
		[
			-53,
			56
		],
		[
			6,
			184
		],
		[
			-92,
			-10
		],
		[
			77,
			303
		],
		[
			132,
			39
		],
		[
			-4,
			-79
		],
		[
			284,
			-11
		],
		[
			168,
			118
		],
		[
			116,
			-100
		],
		[
			264,
			411
		],
		[
			81,
			6
		],
		[
			-12,
			35
		],
		[
			60,
			38
		],
		[
			-19,
			55
		],
		[
			24,
			22
		],
		[
			37,
			33
		],
		[
			216,
			-66
		],
		[
			39,
			27
		],
		[
			146,
			-66
		],
		[
			53,
			15
		],
		[
			70,
			-66
		],
		[
			11,
			604
		],
		[
			87,
			-40
		],
		[
			186,
			201
		],
		[
			127,
			-101
		],
		[
			156,
			143
		],
		[
			210,
			-231
		],
		[
			65,
			38
		],
		[
			-298,
			331
		],
		[
			-134,
			92
		],
		[
			-121,
			33
		],
		[
			20,
			66
		],
		[
			-29,
			5
		],
		[
			-1,
			56
		]
	],
	[
		[
			21722,
			35653
		],
		[
			141,
			190
		],
		[
			-66,
			52
		],
		[
			-21,
			203
		],
		[
			-182,
			298
		],
		[
			-241,
			628
		],
		[
			-230,
			-115
		],
		[
			-117,
			98
		],
		[
			-241,
			-110
		],
		[
			-90,
			127
		],
		[
			-24,
			-49
		],
		[
			-1,
			-1
		],
		[
			-63,
			12
		],
		[
			-26,
			-32
		],
		[
			-4,
			-4
		],
		[
			62,
			-96
		],
		[
			9,
			-89
		],
		[
			-36,
			-49
		],
		[
			-9,
			-13
		],
		[
			-12,
			-1
		],
		[
			0,
			0
		],
		[
			-35,
			-1
		],
		[
			-3,
			7
		],
		[
			-39,
			115
		],
		[
			-19,
			54
		],
		[
			-9,
			24
		],
		[
			-3,
			10
		],
		[
			43,
			207
		],
		[
			6,
			29
		],
		[
			0,
			0
		],
		[
			0,
			0
		],
		[
			48,
			37
		],
		[
			13,
			10
		],
		[
			4,
			3
		],
		[
			-5,
			5
		],
		[
			-34,
			34
		],
		[
			9,
			3
		],
		[
			178,
			79
		],
		[
			73,
			128
		],
		[
			52,
			-15
		],
		[
			16,
			-4
		],
		[
			86,
			53
		],
		[
			45,
			287
		],
		[
			23,
			-22
		],
		[
			264,
			114
		],
		[
			114,
			16
		],
		[
			216,
			321
		],
		[
			120,
			-119
		],
		[
			211,
			127
		],
		[
			52,
			-35
		],
		[
			1,
			1
		],
		[
			71,
			60
		],
		[
			228,
			-164
		],
		[
			81,
			118
		],
		[
			140,
			-268
		],
		[
			114,
			-16
		],
		[
			35,
			-108
		],
		[
			98,
			-63
		],
		[
			21,
			-76
		],
		[
			178,
			181
		],
		[
			-4,
			145
		],
		[
			589,
			173
		],
		[
			-15,
			442
		],
		[
			-5,
			145
		],
		[
			10,
			50
		],
		[
			52,
			17
		],
		[
			24,
			119
		],
		[
			223,
			-15
		],
		[
			54,
			174
		],
		[
			33,
			-64
		],
		[
			105,
			166
		],
		[
			227,
			-39
		],
		[
			62,
			22
		],
		[
			205,
			141
		],
		[
			-50,
			154
		],
		[
			0,
			1
		]
	],
	[
		[
			16114,
			38360
		],
		[
			407,
			327
		],
		[
			-369,
			531
		],
		[
			-33,
			506
		]
	],
	[
		[
			16119,
			39724
		],
		[
			620,
			25
		],
		[
			506,
			-25
		],
		[
			-5,
			-69
		],
		[
			0,
			0
		],
		[
			-1,
			-10
		],
		[
			8,
			0
		],
		[
			1055,
			13
		],
		[
			38,
			-48
		],
		[
			94,
			3
		],
		[
			302,
			155
		],
		[
			-13,
			64
		],
		[
			346,
			235
		],
		[
			5,
			3
		],
		[
			64,
			-154
		],
		[
			23,
			-58
		],
		[
			3,
			2
		],
		[
			51,
			33
		],
		[
			100,
			-178
		],
		[
			120,
			80
		],
		[
			256,
			-3
		],
		[
			24,
			-163
		],
		[
			182,
			21
		],
		[
			-14,
			113
		],
		[
			387,
			60
		],
		[
			-14,
			-133
		],
		[
			251,
			22
		],
		[
			200,
			-258
		],
		[
			127,
			43
		],
		[
			-3,
			193
		],
		[
			78,
			1
		],
		[
			14,
			199
		],
		[
			-115,
			17
		],
		[
			-64,
			182
		],
		[
			84,
			-54
		],
		[
			265,
			60
		],
		[
			484,
			278
		],
		[
			-22,
			21
		],
		[
			231,
			72
		],
		[
			101,
			169
		],
		[
			11,
			95
		],
		[
			198,
			226
		],
		[
			142,
			-170
		],
		[
			179,
			125
		],
		[
			31,
			-44
		],
		[
			81,
			59
		],
		[
			114,
			-67
		]
	],
	[
		[
			12140,
			40688
		],
		[
			228,
			-106
		],
		[
			30,
			17
		],
		[
			-4,
			9
		],
		[
			-25,
			67
		],
		[
			-25,
			65
		],
		[
			-1,
			1
		],
		[
			23,
			39
		],
		[
			-6,
			2
		],
		[
			-59,
			15
		],
		[
			-23,
			42
		],
		[
			-8,
			14
		],
		[
			46,
			66
		],
		[
			2,
			4
		],
		[
			3,
			4
		],
		[
			-13,
			5
		],
		[
			-120,
			44
		],
		[
			0,
			8
		],
		[
			-2,
			83
		],
		[
			-1,
			1
		],
		[
			-85,
			64
		],
		[
			-60,
			46
		],
		[
			-10,
			3
		],
		[
			-1,
			0
		],
		[
			-52,
			16
		],
		[
			-44,
			13
		],
		[
			-54,
			73
		],
		[
			-9,
			12
		],
		[
			-2,
			0
		],
		[
			-76,
			4
		],
		[
			-16,
			29
		],
		[
			-20,
			35
		],
		[
			242,
			345
		],
		[
			4,
			72
		],
		[
			397,
			333
		],
		[
			113,
			-68
		],
		[
			140,
			327
		],
		[
			-9,
			202
		],
		[
			153,
			-22
		],
		[
			-43,
			99
		],
		[
			18,
			65
		],
		[
			-29,
			13
		],
		[
			142,
			256
		],
		[
			-42,
			58
		],
		[
			-91,
			28
		],
		[
			-117,
			-27
		],
		[
			-51,
			29
		],
		[
			-60,
			147
		],
		[
			114,
			37
		],
		[
			385,
			-184
		],
		[
			148,
			210
		],
		[
			-22,
			12
		],
		[
			-25,
			16
		],
		[
			-2,
			0
		],
		[
			1,
			1
		],
		[
			28,
			13
		],
		[
			22,
			10
		],
		[
			309,
			147
		],
		[
			141,
			66
		],
		[
			263,
			38
		],
		[
			298,
			42
		]
	],
	[
		[
			14183,
			43628
		],
		[
			85,
			-197
		],
		[
			34,
			9
		],
		[
			24,
			-139
		],
		[
			188,
			-200
		],
		[
			16,
			-103
		],
		[
			215,
			-198
		],
		[
			18,
			-8
		],
		[
			47,
			-22
		],
		[
			17,
			-7
		],
		[
			295,
			252
		],
		[
			485,
			-451
		],
		[
			141,
			194
		],
		[
			178,
			-316
		],
		[
			378,
			-135
		],
		[
			127,
			-393
		],
		[
			122,
			-222
		],
		[
			230,
			-22
		],
		[
			-10,
			-533
		],
		[
			49,
			-75
		],
		[
			62,
			-265
		],
		[
			-403,
			-94
		],
		[
			-397,
			-94
		],
		[
			64,
			-179
		],
		[
			-418,
			-110
		],
		[
			81,
			-220
		],
		[
			117,
			10
		],
		[
			77,
			-180
		],
		[
			-30,
			-212
		],
		[
			144,
			6
		]
	],
	[
		[
			6393,
			38953
		],
		[
			35,
			47
		],
		[
			6,
			8
		],
		[
			-59,
			42
		],
		[
			-238,
			169
		],
		[
			-25,
			17
		],
		[
			-67,
			63
		],
		[
			-30,
			28
		],
		[
			13,
			7
		],
		[
			116,
			65
		],
		[
			63,
			213
		],
		[
			0,
			3
		],
		[
			59,
			117
		],
		[
			14,
			27
		],
		[
			-139,
			-13
		],
		[
			-194,
			-39
		],
		[
			-88,
			21
		],
		[
			-83,
			22
		],
		[
			-27,
			30
		],
		[
			-14,
			33
		],
		[
			-4,
			27
		],
		[
			8,
			24
		],
		[
			11,
			16
		],
		[
			33,
			46
		],
		[
			23,
			21
		],
		[
			31,
			24
		],
		[
			14,
			10
		],
		[
			20,
			19
		],
		[
			14,
			13
		],
		[
			11,
			16
		],
		[
			1,
			21
		],
		[
			-7,
			9
		],
		[
			-24,
			17
		],
		[
			-33,
			14
		],
		[
			-31,
			6
		],
		[
			-27,
			-4
		],
		[
			-51,
			-15
		],
		[
			-44,
			-24
		],
		[
			-37,
			-26
		],
		[
			-13,
			-14
		],
		[
			-7,
			-8
		],
		[
			-11,
			-16
		],
		[
			-4,
			-6
		],
		[
			-15,
			-18
		],
		[
			-14,
			-12
		],
		[
			-22,
			-15
		],
		[
			-31,
			-8
		],
		[
			-25,
			-2
		],
		[
			-26,
			6
		],
		[
			-25,
			20
		],
		[
			-22,
			21
		],
		[
			-9,
			21
		],
		[
			13,
			102
		],
		[
			19,
			66
		],
		[
			11,
			30
		],
		[
			20,
			14
		],
		[
			5,
			1
		],
		[
			52,
			10
		],
		[
			30,
			17
		],
		[
			49,
			39
		],
		[
			14,
			20
		],
		[
			7,
			23
		],
		[
			-10,
			33
		],
		[
			-19,
			18
		],
		[
			-21,
			3
		],
		[
			-2,
			0
		],
		[
			-31,
			-1
		],
		[
			-65,
			-11
		],
		[
			-29,
			-3
		],
		[
			-12,
			-1
		],
		[
			-26,
			7
		],
		[
			-41,
			14
		],
		[
			-29,
			22
		],
		[
			-16,
			31
		],
		[
			-2,
			59
		],
		[
			12,
			68
		],
		[
			0,
			25
		],
		[
			-6,
			29
		],
		[
			-21,
			30
		],
		[
			-57,
			58
		],
		[
			-97,
			76
		],
		[
			-52,
			43
		],
		[
			-6,
			4
		],
		[
			-44,
			28
		],
		[
			-18,
			8
		],
		[
			-4,
			1
		],
		[
			-18,
			6
		],
		[
			-79,
			44
		],
		[
			-28,
			18
		],
		[
			-16,
			20
		],
		[
			-9,
			25
		],
		[
			-1,
			29
		],
		[
			-1,
			30
		],
		[
			-1,
			67
		],
		[
			-4,
			16
		],
		[
			-10,
			15
		],
		[
			-15,
			13
		],
		[
			-5,
			3
		],
		[
			-37,
			19
		],
		[
			-36,
			12
		],
		[
			-42,
			19
		],
		[
			-46,
			33
		],
		[
			-10,
			19
		],
		[
			6,
			23
		],
		[
			8,
			7
		],
		[
			51,
			47
		],
		[
			39,
			30
		],
		[
			28,
			26
		],
		[
			3,
			3
		],
		[
			13,
			18
		],
		[
			2,
			3
		],
		[
			18,
			38
		],
		[
			11,
			35
		],
		[
			-2,
			29
		],
		[
			-12,
			26
		],
		[
			-9,
			16
		],
		[
			-1,
			0
		],
		[
			-22,
			40
		],
		[
			-33,
			48
		],
		[
			-7,
			21
		],
		[
			0,
			27
		],
		[
			1,
			5
		],
		[
			1,
			4
		],
		[
			11,
			41
		],
		[
			32,
			64
		],
		[
			24,
			43
		],
		[
			3,
			5
		],
		[
			4,
			6
		],
		[
			3,
			14
		],
		[
			-5,
			16
		],
		[
			-14,
			8
		],
		[
			-16,
			3
		],
		[
			-3,
			-2
		],
		[
			-13,
			-4
		],
		[
			-23,
			-23
		],
		[
			-28,
			-35
		],
		[
			-5,
			-9
		],
		[
			-4,
			-9
		],
		[
			-2,
			-6
		],
		[
			-16,
			-18
		],
		[
			-15,
			-5
		],
		[
			-31,
			8
		],
		[
			-20,
			15
		],
		[
			-8,
			18
		],
		[
			4,
			22
		],
		[
			3,
			5
		],
		[
			14,
			23
		],
		[
			29,
			32
		],
		[
			17,
			21
		],
		[
			8,
			35
		],
		[
			-1,
			28
		],
		[
			-10,
			15
		]
	],
	[
		[
			4718,
			42004
		],
		[
			72,
			48
		],
		[
			-49,
			25
		],
		[
			102,
			197
		],
		[
			-43,
			44
		],
		[
			94,
			14
		],
		[
			42,
			6
		],
		[
			310,
			169
		],
		[
			124,
			214
		],
		[
			64,
			3
		],
		[
			-4,
			507
		],
		[
			-36,
			140
		],
		[
			-165,
			211
		],
		[
			166,
			245
		],
		[
			53,
			78
		],
		[
			97,
			145
		],
		[
			161,
			-24
		],
		[
			304,
			-45
		],
		[
			106,
			-91
		],
		[
			-33,
			-208
		],
		[
			69,
			-5
		],
		[
			19,
			-104
		],
		[
			-45,
			-77
		],
		[
			103,
			-47
		],
		[
			10,
			-48
		],
		[
			143,
			-49
		],
		[
			108,
			-8
		],
		[
			34,
			-3
		],
		[
			68,
			-4
		],
		[
			199,
			-15
		],
		[
			-39,
			88
		],
		[
			175,
			237
		],
		[
			65,
			-89
		],
		[
			10,
			-13
		],
		[
			7,
			-10
		],
		[
			82,
			-112
		],
		[
			328,
			93
		],
		[
			137,
			79
		],
		[
			-178,
			359
		],
		[
			92,
			64
		],
		[
			-123,
			132
		],
		[
			-8,
			9
		],
		[
			13,
			231
		],
		[
			218,
			36
		],
		[
			16,
			59
		],
		[
			-10,
			96
		],
		[
			-93,
			147
		],
		[
			0,
			179
		]
	],
	[
		[
			7483,
			44907
		],
		[
			160,
			159
		],
		[
			453,
			268
		],
		[
			80,
			-67
		],
		[
			243,
			-88
		],
		[
			128,
			-46
		],
		[
			-16,
			-44
		],
		[
			56,
			-35
		],
		[
			33,
			71
		],
		[
			79,
			-66
		],
		[
			-71,
			-54
		],
		[
			59,
			-84
		],
		[
			-30,
			-332
		],
		[
			-127,
			-13
		],
		[
			-13,
			75
		],
		[
			-108,
			44
		],
		[
			-50,
			-120
		],
		[
			93,
			-36
		],
		[
			-21,
			-84
		],
		[
			158,
			19
		],
		[
			-10,
			-174
		],
		[
			-73,
			-1
		],
		[
			-5,
			-400
		],
		[
			55,
			-2
		],
		[
			1,
			-135
		],
		[
			720,
			-442
		],
		[
			18,
			-3
		],
		[
			708,
			-90
		]
	],
	[
		[
			10003,
			43227
		],
		[
			-33,
			-138
		],
		[
			58,
			-13
		],
		[
			56,
			-139
		],
		[
			103,
			51
		],
		[
			223,
			-168
		],
		[
			55,
			30
		],
		[
			128,
			-140
		],
		[
			-39,
			-43
		],
		[
			29,
			-22
		],
		[
			-88,
			-96
		],
		[
			105,
			-149
		],
		[
			-282,
			110
		],
		[
			-88,
			-171
		],
		[
			-27,
			0
		],
		[
			142,
			-518
		],
		[
			25,
			-515
		]
	],
	[
		[
			4718,
			42004
		],
		[
			-5,
			7
		],
		[
			-21,
			10
		],
		[
			-27,
			3
		],
		[
			-34,
			-3
		],
		[
			-35,
			-14
		],
		[
			-9,
			-13
		],
		[
			-7,
			-8
		],
		[
			-7,
			-9
		],
		[
			-27,
			-53
		],
		[
			-44,
			-77
		],
		[
			-38,
			-55
		],
		[
			-23,
			-25
		],
		[
			-25,
			-10
		],
		[
			-22,
			2
		],
		[
			-23,
			6
		],
		[
			-8,
			2
		],
		[
			-20,
			15
		],
		[
			-16,
			21
		],
		[
			-4,
			6
		],
		[
			-24,
			18
		],
		[
			-24,
			16
		],
		[
			-38,
			18
		],
		[
			-32,
			9
		],
		[
			-22,
			3
		],
		[
			-70,
			-5
		],
		[
			-40,
			0
		],
		[
			-33,
			5
		],
		[
			-11,
			3
		],
		[
			-41,
			23
		],
		[
			-47,
			28
		],
		[
			-40,
			33
		],
		[
			-24,
			30
		],
		[
			-9,
			27
		],
		[
			-14,
			41
		],
		[
			-8,
			26
		],
		[
			-7,
			34
		],
		[
			-4,
			37
		],
		[
			0,
			24
		],
		[
			6,
			20
		],
		[
			18,
			21
		],
		[
			28,
			13
		],
		[
			25,
			4
		],
		[
			15,
			-7
		],
		[
			1,
			-1
		],
		[
			15,
			-11
		],
		[
			19,
			-19
		],
		[
			44,
			-29
		],
		[
			64,
			-38
		],
		[
			50,
			-23
		],
		[
			41,
			-8
		],
		[
			33,
			4
		],
		[
			1,
			0
		],
		[
			34,
			13
		],
		[
			33,
			19
		],
		[
			17,
			13
		],
		[
			16,
			30
		],
		[
			4,
			25
		],
		[
			-13,
			36
		],
		[
			-29,
			38
		],
		[
			-30,
			34
		],
		[
			-27,
			17
		],
		[
			-39,
			21
		],
		[
			-46,
			19
		],
		[
			-28,
			10
		],
		[
			-5,
			1
		],
		[
			-27,
			8
		],
		[
			-48,
			-4
		],
		[
			-23,
			-2
		],
		[
			-104,
			-9
		],
		[
			-41,
			-6
		],
		[
			-55,
			-4
		],
		[
			-44,
			10
		],
		[
			-5,
			2
		],
		[
			-37,
			15
		],
		[
			-26,
			18
		],
		[
			-15,
			12
		],
		[
			-11,
			9
		],
		[
			-17,
			24
		],
		[
			-9,
			29
		],
		[
			-1,
			22
		],
		[
			1,
			17
		],
		[
			20,
			23
		],
		[
			17,
			15
		],
		[
			23,
			20
		],
		[
			28,
			23
		],
		[
			12,
			11
		],
		[
			30,
			28
		],
		[
			29,
			32
		],
		[
			24,
			33
		],
		[
			13,
			23
		],
		[
			1,
			2
		],
		[
			3,
			25
		],
		[
			2,
			39
		],
		[
			-12,
			26
		],
		[
			-22,
			47
		],
		[
			-21,
			27
		],
		[
			-40,
			41
		],
		[
			-9,
			6
		],
		[
			-22,
			14
		],
		[
			-24,
			11
		],
		[
			-22,
			6
		],
		[
			-19,
			4
		],
		[
			-15,
			4
		],
		[
			-31,
			4
		],
		[
			-22,
			-1
		],
		[
			-100,
			-6
		],
		[
			-25,
			-2
		],
		[
			-6,
			-1
		],
		[
			-22,
			-11
		],
		[
			-4,
			-5
		],
		[
			-5,
			-6
		],
		[
			-2,
			-14
		],
		[
			3,
			-18
		],
		[
			16,
			-26
		],
		[
			21,
			-41
		],
		[
			38,
			-85
		],
		[
			8,
			-26
		],
		[
			2,
			-5
		],
		[
			0,
			-3
		],
		[
			1,
			-18
		],
		[
			-9,
			-16
		],
		[
			-14,
			-8
		],
		[
			-24,
			-11
		],
		[
			-22,
			-8
		],
		[
			-61,
			-5
		],
		[
			-43,
			5
		],
		[
			-23,
			6
		],
		[
			-31,
			25
		],
		[
			-5,
			4
		],
		[
			-34,
			30
		],
		[
			-50,
			69
		],
		[
			-9,
			32
		],
		[
			1,
			24
		],
		[
			11,
			17
		],
		[
			13,
			10
		],
		[
			26,
			5
		],
		[
			21,
			-1
		],
		[
			35,
			0
		],
		[
			17,
			4
		],
		[
			20,
			10
		],
		[
			14,
			11
		],
		[
			17,
			20
		],
		[
			11,
			27
		],
		[
			3,
			34
		],
		[
			-7,
			13
		],
		[
			-12,
			3
		],
		[
			-13,
			4
		],
		[
			-28,
			1
		],
		[
			-36,
			-4
		],
		[
			-26,
			-10
		],
		[
			-16,
			-3
		],
		[
			-22,
			-5
		],
		[
			-1,
			0
		],
		[
			-61,
			-2
		],
		[
			-43,
			10
		],
		[
			-22,
			15
		],
		[
			-53,
			51
		],
		[
			-8,
			9
		],
		[
			-17,
			19
		],
		[
			-26,
			25
		],
		[
			-61,
			61
		],
		[
			-45,
			30
		],
		[
			-16,
			15
		],
		[
			-22,
			21
		],
		[
			-11,
			15
		],
		[
			-8,
			15
		],
		[
			-27,
			64
		],
		[
			-8,
			85
		],
		[
			-13,
			44
		],
		[
			-20,
			23
		],
		[
			-22,
			18
		],
		[
			-14,
			4
		],
		[
			-10,
			4
		],
		[
			-22,
			-8
		],
		[
			-22,
			-17
		],
		[
			-22,
			-22
		],
		[
			-12,
			-19
		],
		[
			-30,
			-23
		],
		[
			-42,
			-25
		],
		[
			-14,
			-8
		],
		[
			-22,
			-3
		],
		[
			-12,
			3
		],
		[
			-14,
			3
		],
		[
			-9,
			5
		],
		[
			-4,
			3
		],
		[
			-11,
			19
		],
		[
			-8,
			22
		],
		[
			-4,
			9
		],
		[
			-3,
			36
		],
		[
			2,
			41
		],
		[
			-5,
			63
		],
		[
			-8,
			38
		],
		[
			-10,
			29
		],
		[
			-8,
			7
		],
		[
			-11,
			9
		],
		[
			-26,
			9
		],
		[
			-6,
			0
		],
		[
			-21,
			1
		],
		[
			-34,
			13
		],
		[
			-27,
			26
		],
		[
			-23,
			39
		],
		[
			-2,
			5
		],
		[
			-33,
			51
		],
		[
			-22,
			11
		],
		[
			-23,
			4
		],
		[
			-7,
			-1
		],
		[
			-13,
			-3
		],
		[
			-18,
			-11
		],
		[
			-25,
			-11
		],
		[
			-48,
			-23
		],
		[
			-2,
			0
		],
		[
			-8,
			-4
		],
		[
			-42,
			-20
		],
		[
			-30,
			-19
		],
		[
			-11,
			-7
		],
		[
			-2,
			-1
		],
		[
			-3,
			-2
		],
		[
			-4,
			-5
		],
		[
			-11,
			-14
		],
		[
			-15,
			-17
		],
		[
			-51,
			-9
		],
		[
			-14,
			2
		],
		[
			-22,
			4
		],
		[
			-26,
			4
		],
		[
			-38,
			20
		],
		[
			-46,
			16
		],
		[
			-36,
			2
		],
		[
			-2,
			0
		],
		[
			-60,
			1
		],
		[
			-70,
			2
		],
		[
			-19,
			-4
		],
		[
			-15,
			-6
		],
		[
			-32,
			-13
		],
		[
			-58,
			-28
		],
		[
			-20,
			-7
		],
		[
			-26,
			-5
		],
		[
			-31,
			4
		],
		[
			-23,
			6
		],
		[
			-11,
			7
		],
		[
			-5,
			8
		],
		[
			-2,
			8
		],
		[
			4,
			8
		],
		[
			14,
			12
		],
		[
			3,
			2
		],
		[
			42,
			20
		],
		[
			20,
			14
		],
		[
			11,
			14
		],
		[
			14,
			22
		],
		[
			3,
			11
		],
		[
			2,
			7
		],
		[
			-6,
			17
		],
		[
			-15,
			11
		],
		[
			-97,
			39
		],
		[
			-23,
			6
		],
		[
			-5,
			1
		],
		[
			-17,
			-3
		],
		[
			-11,
			-7
		],
		[
			-11,
			-13
		],
		[
			-5,
			-19
		],
		[
			0,
			-16
		],
		[
			11,
			-18
		],
		[
			39,
			-35
		],
		[
			6,
			-6
		],
		[
			9,
			-14
		],
		[
			-1,
			-16
		],
		[
			-13,
			-19
		],
		[
			-6,
			-8
		],
		[
			-7,
			-11
		],
		[
			-15,
			-13
		],
		[
			-24,
			-7
		],
		[
			-30,
			1
		],
		[
			-39,
			11
		],
		[
			-29,
			20
		],
		[
			-94,
			76
		],
		[
			-13,
			24
		],
		[
			-8,
			19
		],
		[
			-10,
			22
		],
		[
			-26,
			99
		],
		[
			-7,
			21
		],
		[
			-13,
			10
		],
		[
			-23,
			5
		],
		[
			-21,
			-3
		],
		[
			-15,
			-6
		],
		[
			-12,
			-13
		],
		[
			-11,
			-19
		],
		[
			-1,
			-2
		],
		[
			-9,
			-27
		],
		[
			-17,
			-61
		],
		[
			-10,
			-24
		],
		[
			-1,
			-2
		],
		[
			-8,
			-10
		],
		[
			-11,
			-15
		],
		[
			-18,
			-16
		],
		[
			-29,
			-24
		],
		[
			-32,
			-26
		],
		[
			-8,
			-6
		],
		[
			-21,
			-10
		],
		[
			-147,
			-26
		],
		[
			-21,
			1
		],
		[
			-22,
			9
		],
		[
			-13,
			16
		],
		[
			-6,
			26
		],
		[
			2,
			27
		],
		[
			6,
			27
		],
		[
			30,
			68
		],
		[
			2,
			23
		],
		[
			-5,
			19
		],
		[
			-12,
			23
		],
		[
			-16,
			17
		],
		[
			-15,
			8
		],
		[
			-19,
			2
		],
		[
			-7,
			-1
		],
		[
			-6,
			-1
		],
		[
			-8,
			-6
		],
		[
			0,
			-2
		],
		[
			-10,
			-20
		],
		[
			-11,
			-50
		],
		[
			-16,
			-38
		],
		[
			-20,
			-22
		],
		[
			-1,
			0
		],
		[
			-23,
			-17
		],
		[
			-21,
			-11
		],
		[
			-39,
			-11
		],
		[
			-11,
			0
		],
		[
			-9,
			12
		],
		[
			-3,
			15
		],
		[
			-1,
			33
		],
		[
			-2,
			13
		],
		[
			-17,
			26
		],
		[
			-2,
			1
		],
		[
			-20,
			22
		],
		[
			-34,
			25
		],
		[
			-19,
			4
		],
		[
			-24,
			-1
		],
		[
			-22,
			-13
		],
		[
			-11,
			-14
		],
		[
			-10,
			8
		],
		[
			-3,
			5
		],
		[
			-9,
			13
		],
		[
			-8,
			12
		],
		[
			-20,
			29
		],
		[
			-11,
			15
		],
		[
			-10,
			15
		],
		[
			-92,
			134
		],
		[
			121,
			97
		],
		[
			94,
			77
		],
		[
			67,
			60
		],
		[
			17,
			21
		],
		[
			39,
			59
		],
		[
			44,
			56
		],
		[
			-10,
			16
		],
		[
			19,
			26
		],
		[
			-26,
			68
		],
		[
			141,
			84
		],
		[
			63,
			38
		],
		[
			112,
			76
		],
		[
			1,
			12
		],
		[
			-4,
			32
		],
		[
			2,
			36
		],
		[
			8,
			26
		],
		[
			7,
			10
		],
		[
			86,
			19
		],
		[
			50,
			6
		],
		[
			80,
			11
		],
		[
			-15,
			80
		],
		[
			-56,
			195
		],
		[
			-20,
			47
		],
		[
			-31,
			59
		],
		[
			-33,
			65
		],
		[
			22,
			12
		],
		[
			86,
			45
		],
		[
			27,
			14
		],
		[
			80,
			-129
		],
		[
			32,
			-48
		],
		[
			32,
			-32
		],
		[
			24,
			-17
		],
		[
			33,
			-45
		],
		[
			66,
			-93
		],
		[
			23,
			-31
		],
		[
			124,
			-193
		],
		[
			14,
			-21
		],
		[
			31,
			-45
		],
		[
			27,
			-86
		],
		[
			8,
			3
		],
		[
			34,
			18
		],
		[
			53,
			28
		],
		[
			149,
			123
		],
		[
			15,
			-22
		],
		[
			8,
			-13
		],
		[
			6,
			-18
		],
		[
			9,
			-28
		],
		[
			6,
			-25
		],
		[
			-2,
			-24
		],
		[
			-7,
			-22
		],
		[
			5,
			-25
		],
		[
			13,
			-31
		],
		[
			52,
			-133
		],
		[
			7,
			-3
		],
		[
			124,
			-45
		],
		[
			4,
			-2
		],
		[
			78,
			-45
		],
		[
			22,
			-20
		],
		[
			26,
			-18
		],
		[
			46,
			-31
		],
		[
			223,
			33
		],
		[
			13,
			4
		],
		[
			40,
			35
		],
		[
			46,
			73
		],
		[
			15,
			22
		],
		[
			36,
			32
		],
		[
			-28,
			91
		],
		[
			2,
			19
		],
		[
			10,
			15
		],
		[
			34,
			13
		],
		[
			34,
			3
		],
		[
			0,
			12
		],
		[
			-9,
			21
		],
		[
			-11,
			-4
		],
		[
			-14,
			1
		],
		[
			-15,
			8
		],
		[
			-15,
			17
		],
		[
			-23,
			39
		],
		[
			-6,
			82
		],
		[
			46,
			3
		],
		[
			-3,
			23
		],
		[
			-7,
			173
		],
		[
			-22,
			114
		],
		[
			-50,
			29
		],
		[
			-16,
			10
		],
		[
			-36,
			21
		],
		[
			-16,
			10
		],
		[
			-18,
			13
		],
		[
			-49,
			31
		],
		[
			-21,
			-18
		],
		[
			-18,
			-15
		],
		[
			-27,
			-22
		],
		[
			-49,
			-38
		],
		[
			-20,
			-41
		],
		[
			-10,
			2
		],
		[
			-21,
			4
		],
		[
			-28,
			20
		],
		[
			-62,
			45
		],
		[
			-18,
			11
		],
		[
			-50,
			31
		],
		[
			-53,
			27
		],
		[
			-59,
			20
		],
		[
			-56,
			5
		],
		[
			-34,
			59
		],
		[
			-13,
			49
		],
		[
			-25,
			30
		],
		[
			-25,
			18
		],
		[
			-36,
			29
		],
		[
			-42,
			65
		],
		[
			-45,
			56
		],
		[
			-67,
			97
		],
		[
			-115,
			133
		],
		[
			-71,
			82
		],
		[
			-108,
			126
		],
		[
			-20,
			15
		],
		[
			-39,
			54
		],
		[
			76,
			55
		],
		[
			60,
			29
		],
		[
			18,
			6
		],
		[
			27,
			10
		],
		[
			67,
			-47
		],
		[
			51,
			-36
		],
		[
			49,
			-32
		],
		[
			65,
			-38
		],
		[
			97,
			-49
		],
		[
			13,
			13
		],
		[
			43,
			42
		],
		[
			33,
			36
		],
		[
			10,
			18
		],
		[
			26,
			39
		],
		[
			41,
			-18
		],
		[
			12,
			28
		],
		[
			17,
			38
		],
		[
			6,
			12
		],
		[
			18,
			41
		],
		[
			14,
			30
		],
		[
			13,
			27
		],
		[
			45,
			5
		],
		[
			70,
			6
		],
		[
			27,
			3
		],
		[
			11,
			0
		],
		[
			38,
			-4
		],
		[
			32,
			-4
		],
		[
			49,
			-6
		],
		[
			32,
			-4
		],
		[
			21,
			-1
		],
		[
			41,
			-5
		],
		[
			79,
			-9
		],
		[
			64,
			-8
		],
		[
			45,
			-4
		],
		[
			39,
			-8
		],
		[
			43,
			-4
		],
		[
			91,
			-15
		],
		[
			48,
			-7
		],
		[
			100,
			-17
		],
		[
			24,
			8
		],
		[
			18,
			7
		],
		[
			37,
			12
		],
		[
			59,
			24
		],
		[
			50,
			20
		],
		[
			33,
			39
		],
		[
			12,
			-1
		],
		[
			15,
			-5
		],
		[
			91,
			-60
		],
		[
			23,
			-19
		],
		[
			47,
			-52
		],
		[
			31,
			-31
		],
		[
			16,
			-47
		],
		[
			4,
			-11
		],
		[
			3,
			-8
		],
		[
			31,
			-39
		],
		[
			44,
			-53
		],
		[
			32,
			-41
		],
		[
			-14,
			-18
		],
		[
			-19,
			-14
		],
		[
			-13,
			-47
		],
		[
			-8,
			-24
		],
		[
			-15,
			-54
		],
		[
			-8,
			-32
		],
		[
			-2,
			-19
		],
		[
			22,
			-18
		],
		[
			43,
			-31
		],
		[
			60,
			-45
		],
		[
			59,
			-41
		],
		[
			75,
			-56
		],
		[
			62,
			-45
		],
		[
			57,
			-44
		],
		[
			31,
			-25
		],
		[
			15,
			-10
		],
		[
			23,
			2
		],
		[
			-22,
			46
		],
		[
			-11,
			19
		],
		[
			-11,
			77
		],
		[
			44,
			-20
		],
		[
			91,
			-26
		],
		[
			41,
			-8
		],
		[
			39,
			-6
		],
		[
			72,
			-22
		],
		[
			54,
			-15
		],
		[
			31,
			-9
		],
		[
			73,
			-19
		],
		[
			43,
			-14
		],
		[
			34,
			-11
		],
		[
			72,
			-16
		],
		[
			77,
			-18
		],
		[
			81,
			-19
		],
		[
			28,
			46
		],
		[
			27,
			41
		],
		[
			21,
			-16
		],
		[
			-14,
			112
		],
		[
			0,
			101
		],
		[
			12,
			26
		],
		[
			34,
			16
		],
		[
			41,
			11
		],
		[
			77,
			17
		],
		[
			46,
			-6
		],
		[
			9,
			-2
		],
		[
			14,
			0
		],
		[
			26,
			22
		],
		[
			29,
			0
		],
		[
			25,
			-3
		],
		[
			13,
			-7
		],
		[
			13,
			-9
		],
		[
			28,
			-23
		],
		[
			18,
			-17
		],
		[
			22,
			-14
		],
		[
			34,
			-18
		],
		[
			18,
			-14
		],
		[
			56,
			-37
		],
		[
			8,
			34
		],
		[
			12,
			39
		],
		[
			-3,
			56
		],
		[
			-13,
			146
		],
		[
			-1,
			20
		],
		[
			-3,
			48
		],
		[
			-6,
			104
		],
		[
			-29,
			69
		],
		[
			-26,
			60
		],
		[
			-131,
			93
		],
		[
			-27,
			18
		],
		[
			-42,
			-6
		],
		[
			-36,
			13
		],
		[
			-26,
			26
		],
		[
			-19,
			12
		],
		[
			-21,
			2
		],
		[
			-11,
			13
		],
		[
			-10,
			28
		],
		[
			24,
			24
		],
		[
			3,
			1
		],
		[
			169,
			32
		],
		[
			14,
			-7
		],
		[
			18,
			-16
		],
		[
			11,
			-10
		],
		[
			34,
			-17
		],
		[
			8,
			-3
		],
		[
			11,
			0
		],
		[
			30,
			5
		],
		[
			20,
			6
		],
		[
			21,
			9
		],
		[
			24,
			2
		],
		[
			26,
			-5
		],
		[
			34,
			11
		],
		[
			16,
			4
		],
		[
			19,
			-21
		],
		[
			38,
			-26
		],
		[
			37,
			-18
		],
		[
			39,
			9
		],
		[
			0,
			29
		],
		[
			15,
			84
		],
		[
			22,
			13
		],
		[
			21,
			12
		],
		[
			2,
			15
		],
		[
			-3,
			10
		],
		[
			28,
			6
		],
		[
			11,
			2
		],
		[
			13,
			3
		],
		[
			69,
			13
		],
		[
			60,
			10
		],
		[
			10,
			-114
		],
		[
			3,
			-42
		],
		[
			10,
			-130
		],
		[
			3,
			-52
		],
		[
			39,
			-43
		],
		[
			11,
			-14
		],
		[
			11,
			-11
		],
		[
			28,
			-33
		],
		[
			23,
			-27
		],
		[
			12,
			-17
		],
		[
			15,
			-19
		],
		[
			17,
			-15
		],
		[
			9,
			-9
		],
		[
			21,
			-23
		],
		[
			40,
			-51
		],
		[
			23,
			-34
		],
		[
			38,
			-59
		],
		[
			46,
			-63
		],
		[
			75,
			-107
		],
		[
			5,
			-3
		],
		[
			6,
			-6
		],
		[
			106,
			-46
		],
		[
			70,
			-31
		],
		[
			25,
			7
		],
		[
			41,
			18
		],
		[
			9,
			3
		],
		[
			18,
			1
		],
		[
			38,
			5
		],
		[
			18,
			7
		],
		[
			38,
			12
		],
		[
			13,
			7
		],
		[
			40,
			36
		],
		[
			13,
			-28
		],
		[
			50,
			19
		],
		[
			33,
			13
		],
		[
			32,
			28
		],
		[
			54,
			46
		],
		[
			47,
			40
		],
		[
			32,
			28
		],
		[
			9,
			8
		],
		[
			52,
			43
		],
		[
			43,
			29
		],
		[
			8,
			-10
		],
		[
			9,
			-13
		],
		[
			31,
			-35
		],
		[
			25,
			-23
		],
		[
			12,
			-6
		],
		[
			9,
			-5
		],
		[
			61,
			7
		],
		[
			24,
			3
		],
		[
			40,
			14
		],
		[
			23,
			9
		],
		[
			22,
			-26
		],
		[
			100,
			-109
		],
		[
			1,
			-1
		],
		[
			71,
			-77
		],
		[
			6,
			-6
		],
		[
			6,
			-7
		],
		[
			22,
			-25
		],
		[
			7,
			-8
		],
		[
			27,
			-29
		]
	],
	[
		[
			7096,
			45708
		],
		[
			-69,
			-310
		],
		[
			-153,
			-81
		],
		[
			368,
			-282
		],
		[
			53,
			-40
		],
		[
			188,
			-88
		]
	],
	[
		[
			14183,
			43628
		],
		[
			121,
			64
		],
		[
			-16,
			46
		],
		[
			42,
			49
		],
		[
			44,
			12
		],
		[
			30,
			-61
		],
		[
			79,
			-17
		],
		[
			1,
			55
		],
		[
			66,
			1
		],
		[
			1,
			37
		],
		[
			226,
			97
		],
		[
			-12,
			26
		],
		[
			93,
			27
		],
		[
			20,
			-23
		],
		[
			231,
			20
		],
		[
			-12,
			120
		],
		[
			224,
			-101
		],
		[
			-5,
			115
		],
		[
			-119,
			76
		],
		[
			-116,
			18
		],
		[
			-64,
			-45
		],
		[
			-30,
			22
		],
		[
			-153,
			357
		],
		[
			-116,
			-79
		],
		[
			-20,
			87
		],
		[
			-291,
			-49
		],
		[
			-124,
			177
		],
		[
			-139,
			-63
		],
		[
			-16,
			28
		],
		[
			-73,
			-15
		],
		[
			-17,
			34
		],
		[
			-243,
			-17
		],
		[
			-12,
			65
		],
		[
			-35,
			1
		],
		[
			57,
			12
		],
		[
			39,
			111
		],
		[
			56,
			27
		],
		[
			94,
			-31
		],
		[
			15,
			37
		],
		[
			76,
			-34
		],
		[
			52,
			89
		],
		[
			59,
			-50
		],
		[
			42,
			24
		],
		[
			92,
			84
		],
		[
			-30,
			14
		],
		[
			96,
			67
		],
		[
			-8,
			32
		],
		[
			-66,
			6
		],
		[
			142,
			76
		],
		[
			-110,
			89
		],
		[
			399,
			162
		]
	],
	[
		[
			14753,
			45407
		],
		[
			22,
			-14
		],
		[
			22,
			-3
		],
		[
			15,
			-7
		],
		[
			17,
			-13
		],
		[
			22,
			-19
		],
		[
			20,
			-23
		],
		[
			30,
			-21
		],
		[
			26,
			-20
		],
		[
			66,
			-44
		],
		[
			27,
			-15
		],
		[
			39,
			-21
		],
		[
			31,
			-22
		],
		[
			35,
			-21
		],
		[
			34,
			-26
		],
		[
			28,
			-19
		],
		[
			23,
			-23
		],
		[
			36,
			-34
		],
		[
			32,
			-29
		],
		[
			26,
			-22
		],
		[
			17,
			-10
		],
		[
			39,
			-16
		],
		[
			36,
			-18
		],
		[
			19,
			-8
		],
		[
			33,
			-10
		],
		[
			32,
			-4
		],
		[
			41,
			-3
		],
		[
			40,
			-1
		],
		[
			34,
			1
		],
		[
			20,
			4
		],
		[
			12,
			2
		],
		[
			12,
			5
		],
		[
			24,
			3
		],
		[
			24,
			0
		],
		[
			27,
			-1
		],
		[
			26,
			-6
		],
		[
			36,
			-3
		],
		[
			36,
			1
		],
		[
			34,
			1
		],
		[
			19,
			6
		],
		[
			13,
			5
		],
		[
			15,
			5
		],
		[
			13,
			3
		],
		[
			28,
			4
		],
		[
			23,
			0
		],
		[
			38,
			-1
		],
		[
			74,
			-1
		],
		[
			48,
			1
		],
		[
			25,
			-1
		],
		[
			33,
			-3
		],
		[
			35,
			-4
		],
		[
			54,
			4
		],
		[
			41,
			-2
		],
		[
			34,
			-5
		],
		[
			22,
			-1
		],
		[
			15,
			-2
		],
		[
			55,
			-16
		],
		[
			41,
			-10
		],
		[
			35,
			-5
		],
		[
			28,
			-7
		],
		[
			34,
			-14
		],
		[
			41,
			-18
		],
		[
			34,
			-18
		],
		[
			23,
			-16
		],
		[
			16,
			-15
		],
		[
			23,
			-28
		],
		[
			3,
			-4
		],
		[
			15,
			-17
		],
		[
			17,
			-17
		],
		[
			7,
			-7
		],
		[
			18,
			-21
		],
		[
			21,
			-23
		],
		[
			24,
			-26
		],
		[
			11,
			-16
		],
		[
			5,
			-6
		],
		[
			15,
			-32
		],
		[
			16,
			-46
		],
		[
			11,
			-24
		],
		[
			7,
			-22
		],
		[
			14,
			-25
		],
		[
			16,
			-32
		],
		[
			6,
			-39
		],
		[
			-2,
			-28
		],
		[
			-5,
			-28
		],
		[
			-7,
			-23
		],
		[
			-10,
			-33
		],
		[
			1,
			-43
		],
		[
			-10,
			-57
		],
		[
			-9,
			-32
		],
		[
			-3,
			-28
		],
		[
			-1,
			-47
		],
		[
			-1,
			-27
		],
		[
			-31,
			-64
		],
		[
			-20,
			-48
		],
		[
			-16,
			-44
		],
		[
			-23,
			-77
		],
		[
			-7,
			-69
		],
		[
			-8,
			-59
		],
		[
			0,
			-70
		],
		[
			17,
			-45
		],
		[
			20,
			-43
		],
		[
			30,
			-30
		],
		[
			48,
			-24
		],
		[
			27,
			-7
		],
		[
			17,
			-4
		],
		[
			64,
			-31
		],
		[
			38,
			-12
		],
		[
			49,
			8
		],
		[
			52,
			25
		],
		[
			41,
			30
		],
		[
			31,
			23
		],
		[
			76,
			41
		],
		[
			87,
			58
		],
		[
			55,
			56
		],
		[
			27,
			61
		],
		[
			11,
			40
		],
		[
			4,
			44
		],
		[
			5,
			64
		],
		[
			24,
			31
		],
		[
			28,
			22
		],
		[
			29,
			3
		],
		[
			37,
			-5
		],
		[
			35,
			-8
		],
		[
			51,
			-9
		],
		[
			44,
			-17
		],
		[
			36,
			-13
		],
		[
			27,
			-7
		],
		[
			48,
			-13
		],
		[
			64,
			-21
		],
		[
			18,
			-8
		],
		[
			29,
			-17
		],
		[
			37,
			-24
		],
		[
			21,
			-26
		],
		[
			4,
			-36
		],
		[
			-13,
			-43
		],
		[
			-32,
			-61
		],
		[
			-16,
			-55
		],
		[
			0,
			-73
		],
		[
			2,
			-17
		],
		[
			13,
			-37
		],
		[
			15,
			-66
		],
		[
			0,
			-34
		],
		[
			10,
			-20
		],
		[
			-3,
			-51
		],
		[
			5,
			-58
		],
		[
			15,
			-44
		],
		[
			35,
			-39
		],
		[
			21,
			-18
		],
		[
			47,
			-38
		],
		[
			77,
			-40
		],
		[
			72,
			-17
		],
		[
			53,
			4
		],
		[
			61,
			17
		],
		[
			39,
			17
		],
		[
			39,
			17
		],
		[
			84,
			39
		],
		[
			33,
			21
		],
		[
			73,
			44
		],
		[
			42,
			21
		],
		[
			44,
			21
		],
		[
			42,
			22
		],
		[
			51,
			34
		],
		[
			34,
			24
		],
		[
			24,
			20
		],
		[
			93,
			60
		],
		[
			45,
			16
		],
		[
			45,
			15
		],
		[
			34,
			11
		],
		[
			45,
			16
		],
		[
			23,
			17
		],
		[
			40,
			38
		],
		[
			45,
			36
		],
		[
			41,
			38
		],
		[
			39,
			27
		],
		[
			27,
			7
		],
		[
			43,
			-3
		],
		[
			24,
			-15
		],
		[
			21,
			-33
		],
		[
			8,
			-25
		],
		[
			11,
			-21
		],
		[
			22,
			-12
		],
		[
			28,
			-18
		],
		[
			39,
			-11
		],
		[
			33,
			13
		],
		[
			30,
			22
		],
		[
			23,
			31
		],
		[
			22,
			44
		],
		[
			30,
			33
		],
		[
			28,
			27
		],
		[
			39,
			21
		],
		[
			24,
			11
		],
		[
			28,
			13
		],
		[
			40,
			7
		],
		[
			32,
			-2
		],
		[
			25,
			-11
		],
		[
			33,
			-18
		],
		[
			19,
			-16
		],
		[
			12,
			-10
		],
		[
			28,
			-41
		],
		[
			25,
			-49
		],
		[
			44,
			-95
		],
		[
			22,
			-54
		],
		[
			12,
			-72
		],
		[
			7,
			-62
		],
		[
			0,
			-55
		],
		[
			-2,
			-46
		],
		[
			-11,
			-69
		],
		[
			-9,
			-51
		],
		[
			-31,
			-75
		],
		[
			-25,
			-56
		],
		[
			-9,
			-44
		],
		[
			-4,
			-43
		],
		[
			-16,
			-29
		],
		[
			-19,
			-28
		],
		[
			-72,
			-100
		],
		[
			-45,
			-40
		],
		[
			-48,
			-31
		],
		[
			-71,
			-43
		],
		[
			-57,
			-26
		],
		[
			-50,
			-35
		],
		[
			-25,
			-13
		],
		[
			-43,
			-23
		],
		[
			-60,
			-34
		],
		[
			-40,
			-17
		],
		[
			-38,
			-28
		],
		[
			-28,
			-17
		],
		[
			-22,
			-29
		],
		[
			-12,
			-36
		],
		[
			0,
			-48
		],
		[
			14,
			-47
		],
		[
			3,
			-51
		],
		[
			-12,
			-39
		],
		[
			-13,
			-31
		],
		[
			-5,
			-32
		],
		[
			10,
			-23
		],
		[
			15,
			-34
		],
		[
			28,
			-22
		],
		[
			38,
			-18
		],
		[
			2,
			-1
		],
		[
			36,
			-22
		],
		[
			10,
			-6
		],
		[
			60,
			-24
		],
		[
			53,
			-3
		],
		[
			40,
			4
		],
		[
			31,
			0
		],
		[
			63,
			5
		],
		[
			23,
			8
		],
		[
			19,
			6
		],
		[
			72,
			20
		],
		[
			64,
			32
		],
		[
			35,
			35
		],
		[
			9,
			8
		],
		[
			41,
			71
		],
		[
			25,
			56
		],
		[
			6,
			16
		],
		[
			19,
			43
		],
		[
			22,
			48
		],
		[
			10,
			52
		],
		[
			10,
			50
		],
		[
			22,
			53
		],
		[
			18,
			22
		],
		[
			28,
			17
		],
		[
			19,
			33
		],
		[
			32,
			42
		],
		[
			31,
			36
		],
		[
			18,
			12
		],
		[
			27,
			11
		],
		[
			44,
			12
		],
		[
			50,
			7
		],
		[
			32,
			-4
		],
		[
			41,
			-2
		],
		[
			45,
			4
		],
		[
			34,
			4
		],
		[
			45,
			-6
		],
		[
			11,
			-1
		],
		[
			49,
			-12
		],
		[
			44,
			-17
		],
		[
			51,
			-20
		],
		[
			49,
			-27
		],
		[
			27,
			-29
		],
		[
			22,
			-32
		],
		[
			16,
			-38
		],
		[
			4,
			-49
		],
		[
			3,
			-72
		],
		[
			0,
			-20
		],
		[
			-1,
			-15
		],
		[
			7,
			-46
		],
		[
			17,
			-57
		],
		[
			13,
			-42
		],
		[
			10,
			-40
		],
		[
			-6,
			-24
		],
		[
			-19,
			-38
		],
		[
			-39,
			-27
		],
		[
			-38,
			-25
		],
		[
			-35,
			-24
		],
		[
			-29,
			-33
		],
		[
			-24,
			-33
		],
		[
			-12,
			-32
		],
		[
			-7,
			-22
		],
		[
			-5,
			-41
		],
		[
			-1,
			-37
		],
		[
			14,
			-32
		],
		[
			21,
			-25
		],
		[
			25,
			-18
		],
		[
			18,
			-23
		],
		[
			28,
			-38
		],
		[
			24,
			-31
		],
		[
			28,
			-50
		],
		[
			11,
			-41
		],
		[
			-1,
			-22
		],
		[
			-4,
			-52
		],
		[
			16,
			-54
		],
		[
			30,
			-54
		],
		[
			17,
			-20
		],
		[
			18,
			-11
		],
		[
			39,
			-54
		],
		[
			19,
			-44
		],
		[
			16,
			-41
		],
		[
			14,
			-29
		],
		[
			16,
			-27
		],
		[
			31,
			-31
		],
		[
			32,
			-21
		],
		[
			22,
			-14
		],
		[
			62,
			-28
		],
		[
			66,
			-20
		],
		[
			61,
			-9
		],
		[
			50,
			-22
		],
		[
			41,
			-26
		],
		[
			26,
			-24
		],
		[
			28,
			-20
		],
		[
			38,
			-14
		],
		[
			33,
			-7
		],
		[
			30,
			0
		],
		[
			26,
			9
		],
		[
			18,
			16
		],
		[
			5,
			19
		],
		[
			-6,
			20
		],
		[
			-13,
			11
		],
		[
			-22,
			7
		],
		[
			-28,
			19
		],
		[
			-27,
			29
		],
		[
			-15,
			34
		],
		[
			-1,
			36
		],
		[
			11,
			39
		],
		[
			20,
			31
		],
		[
			20,
			36
		],
		[
			1,
			6
		],
		[
			6,
			26
		],
		[
			9,
			34
		],
		[
			2,
			21
		],
		[
			-7,
			33
		],
		[
			-13,
			38
		],
		[
			-3,
			33
		],
		[
			-10,
			17
		],
		[
			-4,
			46
		],
		[
			5,
			25
		],
		[
			3,
			13
		],
		[
			8,
			37
		],
		[
			1,
			49
		],
		[
			4,
			29
		],
		[
			3,
			24
		],
		[
			8,
			19
		],
		[
			10,
			12
		],
		[
			13,
			9
		]
	],
	[
		[
			10003,
			43227
		],
		[
			44,
			387
		],
		[
			125,
			374
		],
		[
			55,
			40
		],
		[
			-30,
			65
		],
		[
			-106,
			16
		],
		[
			-73,
			325
		],
		[
			203,
			-11
		],
		[
			81,
			419
		],
		[
			-78,
			39
		],
		[
			227,
			65
		],
		[
			29,
			39
		],
		[
			54,
			-55
		],
		[
			79,
			36
		],
		[
			-102,
			83
		],
		[
			-105,
			-32
		],
		[
			26,
			56
		],
		[
			-70,
			17
		],
		[
			36,
			73
		],
		[
			46,
			-14
		],
		[
			-15,
			29
		],
		[
			45,
			20
		],
		[
			-4,
			113
		],
		[
			40,
			83
		],
		[
			165,
			-44
		],
		[
			187,
			50
		],
		[
			312,
			-180
		],
		[
			52,
			80
		],
		[
			67,
			-76
		],
		[
			150,
			-62
		],
		[
			186,
			-20
		],
		[
			51,
			100
		],
		[
			2,
			4
		],
		[
			211,
			203
		],
		[
			47,
			-54
		],
		[
			83,
			167
		],
		[
			123,
			-39
		],
		[
			169,
			98
		],
		[
			-59,
			115
		],
		[
			949,
			-525
		],
		[
			133,
			-123
		],
		[
			71,
			57
		],
		[
			44,
			36
		],
		[
			-152,
			188
		],
		[
			94,
			32
		],
		[
			59,
			-38
		],
		[
			569,
			548
		],
		[
			196,
			-54
		],
		[
			-7,
			65
		],
		[
			234,
			-16
		]
	],
	[
		[
			14446,
			45906
		],
		[
			1,
			-40
		],
		[
			2,
			-36
		],
		[
			12,
			-42
		],
		[
			15,
			-46
		],
		[
			13,
			-29
		],
		[
			12,
			-21
		],
		[
			32,
			-38
		],
		[
			26,
			-39
		],
		[
			12,
			-15
		],
		[
			14,
			-11
		],
		[
			12,
			-12
		],
		[
			14,
			-21
		],
		[
			16,
			-20
		],
		[
			24,
			-29
		],
		[
			30,
			-28
		],
		[
			31,
			-37
		],
		[
			37,
			-32
		],
		[
			4,
			-3
		]
	],
	[
		[
			7096,
			45708
		],
		[
			54,
			30
		],
		[
			8,
			4
		],
		[
			20,
			3
		],
		[
			10,
			2
		],
		[
			40,
			2
		],
		[
			30,
			2
		],
		[
			33,
			15
		],
		[
			97,
			44
		],
		[
			27,
			18
		],
		[
			225,
			-126
		],
		[
			16,
			-8
		],
		[
			15,
			-5
		],
		[
			90,
			412
		],
		[
			36,
			168
		],
		[
			8,
			23
		],
		[
			76,
			81
		],
		[
			10,
			10
		],
		[
			99,
			106
		],
		[
			-4,
			14
		],
		[
			-23,
			80
		],
		[
			10,
			24
		],
		[
			21,
			31
		],
		[
			14,
			20
		],
		[
			14,
			49
		],
		[
			7,
			22
		],
		[
			24,
			90
		],
		[
			207,
			-41
		],
		[
			12,
			19
		],
		[
			-38,
			26
		],
		[
			41,
			66
		],
		[
			87,
			-63
		],
		[
			31,
			-19
		],
		[
			16,
			-15
		],
		[
			14,
			-22
		],
		[
			24,
			3
		],
		[
			-18,
			26
		],
		[
			1,
			24
		],
		[
			-24,
			13
		],
		[
			-5,
			32
		],
		[
			40,
			37
		],
		[
			51,
			-41
		],
		[
			13,
			-23
		],
		[
			48,
			-37
		],
		[
			25,
			-6
		],
		[
			18,
			-5
		],
		[
			13,
			-7
		],
		[
			61,
			7
		],
		[
			13,
			-46
		],
		[
			13,
			-90
		],
		[
			5,
			-42
		],
		[
			3,
			-14
		],
		[
			7,
			2
		],
		[
			11,
			-87
		],
		[
			-6,
			-27
		],
		[
			13,
			-113
		],
		[
			5,
			-23
		],
		[
			27,
			-28
		],
		[
			21,
			-22
		],
		[
			22,
			-3
		],
		[
			38,
			-9
		],
		[
			19,
			6
		],
		[
			38,
			20
		],
		[
			29,
			18
		],
		[
			18,
			1
		],
		[
			22,
			-3
		],
		[
			22,
			-11
		],
		[
			32,
			-15
		],
		[
			15,
			-5
		],
		[
			15,
			-2
		],
		[
			19,
			6
		],
		[
			20,
			8
		],
		[
			21,
			10
		],
		[
			11,
			5
		],
		[
			23,
			17
		],
		[
			25,
			4
		],
		[
			38,
			-4
		],
		[
			25,
			-11
		],
		[
			-4,
			-6
		],
		[
			18,
			-10
		],
		[
			21,
			-4
		],
		[
			24,
			-2
		],
		[
			3,
			9
		],
		[
			38,
			1
		],
		[
			18,
			0
		],
		[
			17,
			-4
		],
		[
			17,
			-5
		],
		[
			0,
			-10
		],
		[
			59,
			-21
		],
		[
			40,
			-7
		],
		[
			7,
			1
		],
		[
			13,
			5
		],
		[
			20,
			17
		],
		[
			17,
			38
		],
		[
			16,
			30
		],
		[
			41,
			87
		],
		[
			61,
			136
		],
		[
			13,
			30
		],
		[
			10,
			25
		],
		[
			9,
			28
		],
		[
			10,
			52
		],
		[
			2,
			23
		],
		[
			1,
			37
		],
		[
			18,
			99
		],
		[
			14,
			19
		],
		[
			35,
			26
		],
		[
			52,
			34
		],
		[
			49,
			23
		],
		[
			40,
			15
		],
		[
			13,
			6
		],
		[
			33,
			18
		],
		[
			16,
			8
		],
		[
			44,
			20
		],
		[
			91,
			-33
		],
		[
			34,
			-12
		],
		[
			18,
			-6
		],
		[
			9,
			2
		],
		[
			10,
			5
		],
		[
			3,
			1
		],
		[
			24,
			15
		],
		[
			25,
			15
		],
		[
			28,
			18
		],
		[
			83,
			53
		],
		[
			12,
			6
		],
		[
			23,
			13
		],
		[
			43,
			18
		],
		[
			0,
			5
		],
		[
			0,
			9
		],
		[
			51,
			29
		],
		[
			17,
			10
		],
		[
			30,
			19
		],
		[
			30,
			31
		],
		[
			55,
			30
		],
		[
			46,
			27
		],
		[
			74,
			43
		],
		[
			39,
			25
		],
		[
			17,
			19
		],
		[
			41,
			28
		],
		[
			22,
			11
		],
		[
			18,
			8
		],
		[
			43,
			20
		],
		[
			11,
			5
		],
		[
			57,
			42
		],
		[
			32,
			23
		],
		[
			27,
			17
		],
		[
			43,
			16
		],
		[
			52,
			10
		],
		[
			45,
			-2
		],
		[
			49,
			-8
		],
		[
			20,
			-7
		],
		[
			27,
			-15
		],
		[
			30,
			-24
		],
		[
			11,
			-17
		],
		[
			3,
			-11
		],
		[
			0,
			-17
		],
		[
			-9,
			-16
		],
		[
			-25,
			-25
		],
		[
			-53,
			-57
		],
		[
			-14,
			-32
		],
		[
			-48,
			-96
		],
		[
			-18,
			-36
		],
		[
			-18,
			-26
		],
		[
			0,
			-24
		],
		[
			8,
			-17
		],
		[
			4,
			-9
		],
		[
			11,
			-34
		],
		[
			16,
			-20
		],
		[
			61,
			-34
		],
		[
			23,
			-10
		],
		[
			27,
			-17
		],
		[
			54,
			-18
		],
		[
			28,
			-8
		],
		[
			43,
			-27
		],
		[
			35,
			-24
		],
		[
			42,
			-29
		],
		[
			72,
			-34
		],
		[
			34,
			-17
		],
		[
			13,
			-9
		],
		[
			10,
			-6
		],
		[
			20,
			-7
		],
		[
			22,
			-9
		],
		[
			57,
			-28
		],
		[
			48,
			-23
		],
		[
			52,
			-9
		],
		[
			76,
			-5
		],
		[
			32,
			1
		],
		[
			35,
			-4
		],
		[
			32,
			-6
		],
		[
			29,
			-5
		],
		[
			24,
			-1
		],
		[
			23,
			3
		],
		[
			41,
			3
		],
		[
			45,
			1
		],
		[
			49,
			0
		],
		[
			26,
			4
		],
		[
			24,
			16
		],
		[
			20,
			8
		],
		[
			33,
			23
		],
		[
			22,
			11
		],
		[
			37,
			20
		],
		[
			3,
			1
		],
		[
			14,
			8
		],
		[
			10,
			6
		],
		[
			27,
			15
		],
		[
			23,
			12
		],
		[
			13,
			5
		],
		[
			23,
			8
		],
		[
			48,
			24
		],
		[
			31,
			13
		],
		[
			42,
			11
		],
		[
			32,
			12
		],
		[
			24,
			6
		],
		[
			34,
			12
		],
		[
			58,
			15
		],
		[
			25,
			5
		],
		[
			30,
			12
		],
		[
			43,
			12
		],
		[
			11,
			1
		],
		[
			29,
			3
		],
		[
			24,
			9
		],
		[
			27,
			6
		],
		[
			21,
			1
		],
		[
			4,
			0
		],
		[
			19,
			-2
		],
		[
			18,
			-2
		],
		[
			60,
			-10
		],
		[
			44,
			-12
		],
		[
			34,
			-12
		],
		[
			27,
			-18
		],
		[
			19,
			-20
		],
		[
			23,
			-19
		],
		[
			27,
			-16
		],
		[
			22,
			-12
		],
		[
			35,
			-11
		],
		[
			35,
			-11
		],
		[
			37,
			-17
		],
		[
			28,
			-14
		],
		[
			14,
			-5
		],
		[
			20,
			-10
		],
		[
			18,
			-14
		],
		[
			24,
			-24
		],
		[
			29,
			-35
		],
		[
			33,
			-34
		],
		[
			25,
			-19
		],
		[
			24,
			-21
		],
		[
			15,
			-9
		],
		[
			18,
			-7
		],
		[
			12,
			-5
		],
		[
			5,
			-5
		],
		[
			17,
			-16
		],
		[
			17,
			-17
		],
		[
			16,
			-16
		],
		[
			43,
			-52
		],
		[
			21,
			-28
		],
		[
			11,
			-44
		],
		[
			10,
			-30
		],
		[
			12,
			-20
		],
		[
			19,
			-20
		],
		[
			22,
			-12
		],
		[
			25,
			-8
		],
		[
			22,
			-9
		],
		[
			26,
			-11
		],
		[
			42,
			-11
		],
		[
			22,
			-9
		],
		[
			22,
			-5
		],
		[
			14,
			-2
		],
		[
			20,
			5
		],
		[
			21,
			0
		],
		[
			20,
			-3
		],
		[
			34,
			-8
		],
		[
			31,
			-10
		],
		[
			3,
			-1
		],
		[
			20,
			-5
		],
		[
			21,
			-10
		],
		[
			26,
			-13
		],
		[
			38,
			-22
		],
		[
			35,
			-15
		],
		[
			27,
			-10
		],
		[
			43,
			-22
		],
		[
			16,
			-9
		],
		[
			20,
			-14
		],
		[
			22,
			-16
		],
		[
			17,
			-14
		],
		[
			18,
			-25
		],
		[
			5,
			-12
		],
		[
			22,
			-40
		],
		[
			8,
			-25
		],
		[
			10,
			-24
		],
		[
			11,
			-21
		],
		[
			6,
			-22
		],
		[
			-2,
			-20
		],
		[
			-5,
			-24
		],
		[
			-11,
			-25
		],
		[
			-6,
			-21
		],
		[
			-2,
			-24
		],
		[
			1,
			-9
		]
	]
];
var transform = {
	scale: [
		0.00008731188764708788,
		0.00006356739884407854
	],
	translate: [
		26.616354999999775,
		45.46727999905676
	]
};
var objects = {
	moldova: {
		type: "GeometryCollection",
		geometries: [
			{
				arcs: [
					[
						[
							0,
							1
						]
					],
					[
						[
							2,
							3,
							4,
							5,
							6,
							7,
							8,
							9
						]
					]
				],
				type: "MultiPolygon",
				properties: {
					shapeName: "Cahul",
					shapeISO: "CA",
					shapeID: "25212430B51059014460141",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						[
							-2,
							10,
							-8,
							11
						]
					],
					[
						[
							12,
							13
						]
					],
					[
						[
							-5,
							14
						]
					],
					[
						[
							-3,
							15,
							16,
							17,
							18,
							19,
							20,
							21,
							22
						]
					]
				],
				type: "MultiPolygon",
				properties: {
					shapeName: "Gagauzia",
					shapeISO: "GA",
					shapeID: "25212430B55748044124793",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						[
							-4,
							-23,
							23,
							-13,
							24,
							-6,
							-15
						]
					],
					[
						[
							-21,
							25
						]
					]
				],
				type: "MultiPolygon",
				properties: {
					shapeName: "Taraclia",
					shapeISO: "TA",
					shapeID: "25212430B43456438192105",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-10,
						26,
						27,
						-16
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Cantemir",
					shapeISO: "CT",
					shapeID: "25212430B81482951983667",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-19,
						28,
						29
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Basarabeasca",
					shapeISO: "BS",
					shapeID: "25212430B41329206409501",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-17,
						-28,
						30,
						31,
						32
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Leova",
					shapeISO: "LE",
					shapeID: "25212430B269818099865",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-18,
						-33,
						33,
						34,
						35,
						36,
						-29
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Cimislia",
					shapeISO: "CM",
					shapeID: "25212430B51243918943413",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						37,
						38,
						39,
						40
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Stefan Voda",
					shapeISO: "SV",
					shapeID: "25212430B10989766506063",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						41,
						42,
						43
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Bender",
					shapeISO: "BD",
					shapeID: "25212430B95154791539173",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-36,
						44,
						45,
						-43,
						46,
						-40,
						47
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Causeni",
					shapeISO: "CS",
					shapeID: "25212430B31479954216778",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-32,
						48,
						49,
						50,
						51,
						-34
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Hincesti",
					shapeISO: "HI",
					shapeID: "25212430B73317679220215",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-35,
						-52,
						52,
						53,
						54,
						-45
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Ialoveni",
					shapeISO: "IA",
					shapeID: "25212430B74275153833775",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-50,
						55,
						56,
						57,
						58
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Nisporeni",
					shapeISO: "NI",
					shapeID: "25212430B5738533784066",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-54,
						59,
						60,
						61,
						62,
						63
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Chisinau",
					shapeISO: "CU",
					shapeID: "25212430B29368029244886",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-44,
						-46,
						-55,
						-64,
						64,
						65
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Anenii Noi",
					shapeISO: "AN",
					shapeID: "25212430B26910735221199",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						[
							-63,
							66,
							67,
							-65
						]
					],
					[
						[
							-61,
							68,
							69,
							70,
							71,
							72
						]
					]
				],
				type: "MultiPolygon",
				properties: {
					shapeName: "Criuleni",
					shapeISO: "CR",
					shapeID: "25212430B57403780332927",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-51,
						-59,
						73,
						74,
						-69,
						-60,
						-53
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Straseni",
					shapeISO: "ST",
					shapeID: "25212430B9063126289167",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-57,
						75,
						76,
						77,
						78,
						79
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Ungheni",
					shapeISO: "UN",
					shapeID: "25212430B23943377724140",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						[
							-62,
							-73,
							80,
							-67
						]
					],
					[
						[
							-71,
							81,
							82,
							83,
							84
						]
					]
				],
				type: "MultiPolygon",
				properties: {
					shapeName: "Dubasari",
					shapeISO: "DU",
					shapeID: "25212430B37177221829666",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-58,
						-80,
						85,
						86,
						-74
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Calarasi",
					shapeISO: "CL",
					shapeID: "25212430B70495112373630",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						[
							-38,
							-41,
							-47,
							-42,
							-66,
							-68,
							-81,
							-72,
							-85,
							87
						]
					],
					[
						[
							-83,
							88,
							89,
							90,
							91,
							92,
							93
						]
					]
				],
				type: "MultiPolygon",
				properties: {
					shapeName: "Transnistria",
					shapeISO: "SN",
					shapeID: "25212430B22111314945643",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-77,
						94,
						95,
						96,
						97
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Falesti",
					shapeISO: "FA",
					shapeID: "25212430B61222791146584",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-70,
						-75,
						-87,
						98,
						99,
						-89,
						-82
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Orhei",
					shapeISO: "OR",
					shapeID: "25212430B45328982281571",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-96,
						100,
						101,
						102
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Glodeni",
					shapeISO: "GL",
					shapeID: "25212430B89307550133505",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-97,
						-103,
						103,
						104
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Balti",
					shapeISO: "BA",
					shapeID: "25212430B53322619224262",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-79,
						105,
						106,
						107,
						108,
						-99,
						-86
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Telenesti",
					shapeISO: "TE",
					shapeID: "25212430B80524279714584",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-78,
						-98,
						-105,
						109,
						110,
						111,
						-106
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "SIngerei",
					shapeISO: "SI",
					shapeID: "25212430B37613660942888",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-102,
						112,
						113,
						114,
						115,
						-110,
						-104
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "RIscani",
					shapeISO: "RI",
					shapeID: "25212430B1615629371845",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-90,
						-100,
						-109,
						116
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Rezina",
					shapeISO: "RE",
					shapeID: "25212430B36697629718061",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-91,
						-117,
						-108,
						117
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Soldanesti",
					shapeISO: "SD",
					shapeID: "25212430B52468939139965",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-92,
						-118,
						-107,
						-112,
						118,
						119
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Floresti",
					shapeISO: "FL",
					shapeID: "25212430B38040597710669",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-111,
						-116,
						120,
						121,
						-119
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Drochia",
					shapeISO: "DR",
					shapeID: "25212430B3857280687737",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-114,
						122,
						123,
						124,
						125
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Edinet",
					shapeISO: "ED",
					shapeID: "25212430B65458906379390",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-124,
						126,
						127
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Briceni",
					shapeISO: "BR",
					shapeID: "25212430B46101437811477",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-93,
						-120,
						-122,
						128,
						129
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Soroca",
					shapeISO: "SO",
					shapeID: "25212430B70903588336793",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-115,
						-126,
						130,
						131,
						-129,
						-121
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Donduseni",
					shapeISO: "DO",
					shapeID: "25212430B39831138215863",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			},
			{
				arcs: [
					[
						-125,
						-128,
						132,
						-131
					]
				],
				type: "Polygon",
				properties: {
					shapeName: "Ocnita",
					shapeISO: "OC",
					shapeID: "25212430B35951071556291",
					shapeGroup: "MDA",
					shapeType: "ADM1"
				}
			}
		]
	}
};
var topology = {
	type: type,
	arcs: arcs,
	transform: transform,
	objects: objects
};

const warned = new Set();
function warnOnce(condition, message, element) {
    if (condition || warned.has(message))
        return;
    console.warn(message);
    warned.add(message);
}

function createDOMMotionComponentProxy(componentFactory) {
    if (typeof Proxy === "undefined") {
        return componentFactory;
    }
    /**
     * A cache of generated `motion` components, e.g `motion.div`, `motion.input` etc.
     * Rather than generating them anew every render.
     */
    const componentCache = new Map();
    const deprecatedFactoryFunction = (...args) => {
        if (process.env.NODE_ENV !== "production") {
            warnOnce(false, "motion() is deprecated. Use motion.create() instead.");
        }
        return componentFactory(...args);
    };
    return new Proxy(deprecatedFactoryFunction, {
        /**
         * Called when `motion` is referenced with a prop: `motion.div`, `motion.input` etc.
         * The prop name is passed through as `key` and we can use that to generate a `motion`
         * DOM component with that name.
         */
        get: (_target, key) => {
            if (key === "create")
                return componentFactory;
            /**
             * If this element doesn't exist in the component cache, create it and cache.
             */
            if (!componentCache.has(key)) {
                componentCache.set(key, componentFactory(key));
            }
            return componentCache.get(key);
        },
    });
}

function isAnimationControls(v) {
    return (v !== null &&
        typeof v === "object" &&
        typeof v.start === "function");
}

const isKeyframesTarget = (v) => {
    return Array.isArray(v);
};

function shallowCompare(next, prev) {
    if (!Array.isArray(prev))
        return false;
    const prevLength = prev.length;
    if (prevLength !== next.length)
        return false;
    for (let i = 0; i < prevLength; i++) {
        if (prev[i] !== next[i])
            return false;
    }
    return true;
}

/**
 * Decides if the supplied variable is variant label
 */
function isVariantLabel(v) {
    return typeof v === "string" || Array.isArray(v);
}

function getValueState(visualElement) {
    const state = [{}, {}];
    visualElement === null || visualElement === void 0 ? void 0 : visualElement.values.forEach((value, key) => {
        state[0][key] = value.get();
        state[1][key] = value.getVelocity();
    });
    return state;
}
function resolveVariantFromProps(props, definition, custom, visualElement) {
    /**
     * If the variant definition is a function, resolve.
     */
    if (typeof definition === "function") {
        const [current, velocity] = getValueState(visualElement);
        definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
    }
    /**
     * If the variant definition is a variant label, or
     * the function returned a variant label, resolve.
     */
    if (typeof definition === "string") {
        definition = props.variants && props.variants[definition];
    }
    /**
     * At this point we've resolved both functions and variant labels,
     * but the resolved variant label might itself have been a function.
     * If so, resolve. This can only have returned a valid target object.
     */
    if (typeof definition === "function") {
        const [current, velocity] = getValueState(visualElement);
        definition = definition(custom !== undefined ? custom : props.custom, current, velocity);
    }
    return definition;
}

function resolveVariant(visualElement, definition, custom) {
    const props = visualElement.getProps();
    return resolveVariantFromProps(props, definition, custom !== undefined ? custom : props.custom, visualElement);
}

const variantPriorityOrder = [
    "animate",
    "whileInView",
    "whileFocus",
    "whileHover",
    "whileTap",
    "whileDrag",
    "exit",
];
const variantProps = ["initial", ...variantPriorityOrder];

/**
 * Generate a list of every possible transform key.
 */
const transformPropOrder = [
    "transformPerspective",
    "x",
    "y",
    "z",
    "translateX",
    "translateY",
    "translateZ",
    "scale",
    "scaleX",
    "scaleY",
    "rotate",
    "rotateX",
    "rotateY",
    "rotateZ",
    "skew",
    "skewX",
    "skewY",
];
/**
 * A quick lookup for transform props.
 */
const transformProps = new Set(transformPropOrder);

/**
 * Converts seconds to milliseconds
 *
 * @param seconds - Time in seconds.
 * @return milliseconds - Converted time in milliseconds.
 */
const secondsToMilliseconds = (seconds) => seconds * 1000;
const millisecondsToSeconds = (milliseconds) => milliseconds / 1000;

const underDampedSpring = {
    type: "spring",
    stiffness: 500,
    damping: 25,
    restSpeed: 10,
};
const criticallyDampedSpring = (target) => ({
    type: "spring",
    stiffness: 550,
    damping: target === 0 ? 2 * Math.sqrt(550) : 30,
    restSpeed: 10,
});
const keyframesTransition = {
    type: "keyframes",
    duration: 0.8,
};
/**
 * Default easing curve is a slightly shallower version of
 * the default browser easing curve.
 */
const ease = {
    type: "keyframes",
    ease: [0.25, 0.1, 0.35, 1],
    duration: 0.3,
};
const getDefaultTransition = (valueKey, { keyframes }) => {
    if (keyframes.length > 2) {
        return keyframesTransition;
    }
    else if (transformProps.has(valueKey)) {
        return valueKey.startsWith("scale")
            ? criticallyDampedSpring(keyframes[1])
            : underDampedSpring;
    }
    return ease;
};

function getValueTransition(transition, key) {
    return transition
        ? transition[key] ||
            transition["default"] ||
            transition
        : undefined;
}

const MotionGlobalConfig = {
    skipAnimations: false,
    useManualTiming: false,
};

const isNotNull = (value) => value !== null;
function getFinalKeyframe(keyframes, { repeat, repeatType = "loop" }, finalKeyframe) {
    const resolvedKeyframes = keyframes.filter(isNotNull);
    const index = repeat && repeatType !== "loop" && repeat % 2 === 1
        ? 0
        : resolvedKeyframes.length - 1;
    return !index || finalKeyframe === undefined
        ? resolvedKeyframes[index]
        : finalKeyframe;
}

const noop$1 = (any) => any;

function createRenderStep(runNextFrame) {
    /**
     * We create and reuse two queues, one to queue jobs for the current frame
     * and one for the next. We reuse to avoid triggering GC after x frames.
     */
    let thisFrame = new Set();
    let nextFrame = new Set();
    /**
     * Track whether we're currently processing jobs in this step. This way
     * we can decide whether to schedule new jobs for this frame or next.
     */
    let isProcessing = false;
    let flushNextFrame = false;
    /**
     * A set of processes which were marked keepAlive when scheduled.
     */
    const toKeepAlive = new WeakSet();
    let latestFrameData = {
        delta: 0.0,
        timestamp: 0.0,
        isProcessing: false,
    };
    function triggerCallback(callback) {
        if (toKeepAlive.has(callback)) {
            step.schedule(callback);
            runNextFrame();
        }
        callback(latestFrameData);
    }
    const step = {
        /**
         * Schedule a process to run on the next frame.
         */
        schedule: (callback, keepAlive = false, immediate = false) => {
            const addToCurrentFrame = immediate && isProcessing;
            const queue = addToCurrentFrame ? thisFrame : nextFrame;
            if (keepAlive)
                toKeepAlive.add(callback);
            if (!queue.has(callback))
                queue.add(callback);
            return callback;
        },
        /**
         * Cancel the provided callback from running on the next frame.
         */
        cancel: (callback) => {
            nextFrame.delete(callback);
            toKeepAlive.delete(callback);
        },
        /**
         * Execute all schedule callbacks.
         */
        process: (frameData) => {
            latestFrameData = frameData;
            /**
             * If we're already processing we've probably been triggered by a flushSync
             * inside an existing process. Instead of executing, mark flushNextFrame
             * as true and ensure we flush the following frame at the end of this one.
             */
            if (isProcessing) {
                flushNextFrame = true;
                return;
            }
            isProcessing = true;
            [thisFrame, nextFrame] = [nextFrame, thisFrame];
            // Clear the next frame queue
            nextFrame.clear();
            // Execute this frame
            thisFrame.forEach(triggerCallback);
            isProcessing = false;
            if (flushNextFrame) {
                flushNextFrame = false;
                step.process(frameData);
            }
        },
    };
    return step;
}

const stepsOrder = [
    "read", // Read
    "resolveKeyframes", // Write/Read/Write/Read
    "update", // Compute
    "preRender", // Compute
    "render", // Write
    "postRender", // Compute
];
const maxElapsed = 40;
function createRenderBatcher(scheduleNextBatch, allowKeepAlive) {
    let runNextFrame = false;
    let useDefaultElapsed = true;
    const state = {
        delta: 0.0,
        timestamp: 0.0,
        isProcessing: false,
    };
    const flagRunNextFrame = () => (runNextFrame = true);
    const steps = stepsOrder.reduce((acc, key) => {
        acc[key] = createRenderStep(flagRunNextFrame);
        return acc;
    }, {});
    const { read, resolveKeyframes, update, preRender, render, postRender } = steps;
    const processBatch = () => {
        const timestamp = performance.now();
        runNextFrame = false;
        state.delta = useDefaultElapsed
            ? 1000 / 60
            : Math.max(Math.min(timestamp - state.timestamp, maxElapsed), 1);
        state.timestamp = timestamp;
        state.isProcessing = true;
        // Unrolled render loop for better per-frame performance
        read.process(state);
        resolveKeyframes.process(state);
        update.process(state);
        preRender.process(state);
        render.process(state);
        postRender.process(state);
        state.isProcessing = false;
        if (runNextFrame && allowKeepAlive) {
            useDefaultElapsed = false;
            scheduleNextBatch(processBatch);
        }
    };
    const wake = () => {
        runNextFrame = true;
        useDefaultElapsed = true;
        if (!state.isProcessing) {
            scheduleNextBatch(processBatch);
        }
    };
    const schedule = stepsOrder.reduce((acc, key) => {
        const step = steps[key];
        acc[key] = (process, keepAlive = false, immediate = false) => {
            if (!runNextFrame)
                wake();
            return step.schedule(process, keepAlive, immediate);
        };
        return acc;
    }, {});
    const cancel = (process) => {
        for (let i = 0; i < stepsOrder.length; i++) {
            steps[stepsOrder[i]].cancel(process);
        }
    };
    return { schedule, cancel, state, steps };
}

const { schedule: frame, cancel: cancelFrame, state: frameData, steps: frameSteps, } = createRenderBatcher(typeof requestAnimationFrame !== "undefined" ? requestAnimationFrame : noop$1, true);

/*
  Bezier function generator
  This has been modified from Gaëtan Renaudeau's BezierEasing
  https://github.com/gre/bezier-easing/blob/master/src/index.js
  https://github.com/gre/bezier-easing/blob/master/LICENSE
  
  I've removed the newtonRaphsonIterate algo because in benchmarking it
  wasn't noticiably faster than binarySubdivision, indeed removing it
  usually improved times, depending on the curve.
  I also removed the lookup table, as for the added bundle size and loop we're
  only cutting ~4 or so subdivision iterations. I bumped the max iterations up
  to 12 to compensate and this still tended to be faster for no perceivable
  loss in accuracy.
  Usage
    const easeOut = cubicBezier(.17,.67,.83,.67);
    const x = easeOut(0.5); // returns 0.627...
*/
// Returns x(t) given t, x1, and x2, or y(t) given t, y1, and y2.
const calcBezier = (t, a1, a2) => (((1.0 - 3.0 * a2 + 3.0 * a1) * t + (3.0 * a2 - 6.0 * a1)) * t + 3.0 * a1) *
    t;
const subdivisionPrecision = 0.0000001;
const subdivisionMaxIterations = 12;
function binarySubdivide(x, lowerBound, upperBound, mX1, mX2) {
    let currentX;
    let currentT;
    let i = 0;
    do {
        currentT = lowerBound + (upperBound - lowerBound) / 2.0;
        currentX = calcBezier(currentT, mX1, mX2) - x;
        if (currentX > 0.0) {
            upperBound = currentT;
        }
        else {
            lowerBound = currentT;
        }
    } while (Math.abs(currentX) > subdivisionPrecision &&
        ++i < subdivisionMaxIterations);
    return currentT;
}
function cubicBezier(mX1, mY1, mX2, mY2) {
    // If this is a linear gradient, return linear easing
    if (mX1 === mY1 && mX2 === mY2)
        return noop$1;
    const getTForX = (aX) => binarySubdivide(aX, 0, 1, mX1, mX2);
    // If animation is at start/end, return t without easing
    return (t) => t === 0 || t === 1 ? t : calcBezier(getTForX(t), mY1, mY2);
}

// Accepts an easing function and returns a new one that outputs mirrored values for
// the second half of the animation. Turns easeIn into easeInOut.
const mirrorEasing = (easing) => (p) => p <= 0.5 ? easing(2 * p) / 2 : (2 - easing(2 * (1 - p))) / 2;

// Accepts an easing function and returns a new one that outputs reversed values.
// Turns easeIn into easeOut.
const reverseEasing = (easing) => (p) => 1 - easing(1 - p);

const backOut = /*@__PURE__*/ cubicBezier(0.33, 1.53, 0.69, 0.99);
const backIn = /*@__PURE__*/ reverseEasing(backOut);
const backInOut = /*@__PURE__*/ mirrorEasing(backIn);

const anticipate = (p) => (p *= 2) < 1 ? 0.5 * backIn(p) : 0.5 * (2 - Math.pow(2, -10 * (p - 1)));

const circIn = (p) => 1 - Math.sin(Math.acos(p));
const circOut = reverseEasing(circIn);
const circInOut = mirrorEasing(circIn);

/**
 * Check if the value is a zero value string like "0px" or "0%"
 */
const isZeroValueString = (v) => /^0[^.\s]+$/u.test(v);

function isNone(value) {
    if (typeof value === "number") {
        return value === 0;
    }
    else if (value !== null) {
        return value === "none" || value === "0" || isZeroValueString(value);
    }
    else {
        return true;
    }
}

let warning = noop$1;
let invariant = noop$1;
if (process.env.NODE_ENV !== "production") {
    warning = (check, message) => {
        if (!check && typeof console !== "undefined") {
            console.warn(message);
        }
    };
    invariant = (check, message) => {
        if (!check) {
            throw new Error(message);
        }
    };
}

/**
 * Check if value is a numerical string, ie a string that is purely a number eg "100" or "-100.1"
 */
const isNumericalString = (v) => /^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(v);

const checkStringStartsWith = (token) => (key) => typeof key === "string" && key.startsWith(token);
const isCSSVariableName = 
/*@__PURE__*/ checkStringStartsWith("--");
const startsAsVariableToken = 
/*@__PURE__*/ checkStringStartsWith("var(--");
const isCSSVariableToken = (value) => {
    const startsWithToken = startsAsVariableToken(value);
    if (!startsWithToken)
        return false;
    // Ensure any comments are stripped from the value as this can harm performance of the regex.
    return singleCssVariableRegex.test(value.split("/*")[0].trim());
};
const singleCssVariableRegex = /var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu;

/**
 * Parse Framer's special CSS variable format into a CSS token and a fallback.
 *
 * ```
 * `var(--foo, #fff)` => [`--foo`, '#fff']
 * ```
 *
 * @param current
 */
const splitCSSVariableRegex = 
// eslint-disable-next-line redos-detector/no-unsafe-regex -- false positive, as it can match a lot of words
/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;
function parseCSSVariable(current) {
    const match = splitCSSVariableRegex.exec(current);
    if (!match)
        return [,];
    const [, token1, token2, fallback] = match;
    return [`--${token1 !== null && token1 !== void 0 ? token1 : token2}`, fallback];
}
const maxDepth$1 = 4;
function getVariableValue(current, element, depth = 1) {
    invariant(depth <= maxDepth$1, `Max CSS variable fallback depth detected in property "${current}". This may indicate a circular fallback dependency.`);
    const [token, fallback] = parseCSSVariable(current);
    // No CSS variable detected
    if (!token)
        return;
    // Attempt to read this CSS variable off the element
    const resolved = window.getComputedStyle(element).getPropertyValue(token);
    if (resolved) {
        const trimmed = resolved.trim();
        return isNumericalString(trimmed) ? parseFloat(trimmed) : trimmed;
    }
    return isCSSVariableToken(fallback)
        ? getVariableValue(fallback, element, depth + 1)
        : fallback;
}

const clamp = (min, max, v) => {
    if (v > max)
        return max;
    if (v < min)
        return min;
    return v;
};

const number$1 = {
    test: (v) => typeof v === "number",
    parse: parseFloat,
    transform: (v) => v,
};
const alpha = {
    ...number$1,
    transform: (v) => clamp(0, 1, v),
};
const scale = {
    ...number$1,
    default: 1,
};

const createUnitType = (unit) => ({
    test: (v) => typeof v === "string" && v.endsWith(unit) && v.split(" ").length === 1,
    parse: parseFloat,
    transform: (v) => `${v}${unit}`,
});
const degrees$2 = /*@__PURE__*/ createUnitType("deg");
const percent = /*@__PURE__*/ createUnitType("%");
const px = /*@__PURE__*/ createUnitType("px");
const vh = /*@__PURE__*/ createUnitType("vh");
const vw = /*@__PURE__*/ createUnitType("vw");
const progressPercentage = {
    ...percent,
    parse: (v) => percent.parse(v) / 100,
    transform: (v) => percent.transform(v * 100),
};

const positionalKeys = new Set([
    "width",
    "height",
    "top",
    "left",
    "right",
    "bottom",
    "x",
    "y",
    "translateX",
    "translateY",
]);
const isNumOrPxType = (v) => v === number$1 || v === px;
const getPosFromMatrix = (matrix, pos) => parseFloat(matrix.split(", ")[pos]);
const getTranslateFromMatrix = (pos2, pos3) => (_bbox, { transform }) => {
    if (transform === "none" || !transform)
        return 0;
    const matrix3d = transform.match(/^matrix3d\((.+)\)$/u);
    if (matrix3d) {
        return getPosFromMatrix(matrix3d[1], pos3);
    }
    else {
        const matrix = transform.match(/^matrix\((.+)\)$/u);
        if (matrix) {
            return getPosFromMatrix(matrix[1], pos2);
        }
        else {
            return 0;
        }
    }
};
const transformKeys = new Set(["x", "y", "z"]);
const nonTranslationalTransformKeys = transformPropOrder.filter((key) => !transformKeys.has(key));
function removeNonTranslationalTransform(visualElement) {
    const removedTransforms = [];
    nonTranslationalTransformKeys.forEach((key) => {
        const value = visualElement.getValue(key);
        if (value !== undefined) {
            removedTransforms.push([key, value.get()]);
            value.set(key.startsWith("scale") ? 1 : 0);
        }
    });
    return removedTransforms;
}
const positionalValues = {
    // Dimensions
    width: ({ x }, { paddingLeft = "0", paddingRight = "0" }) => x.max - x.min - parseFloat(paddingLeft) - parseFloat(paddingRight),
    height: ({ y }, { paddingTop = "0", paddingBottom = "0" }) => y.max - y.min - parseFloat(paddingTop) - parseFloat(paddingBottom),
    top: (_bbox, { top }) => parseFloat(top),
    left: (_bbox, { left }) => parseFloat(left),
    bottom: ({ y }, { top }) => parseFloat(top) + (y.max - y.min),
    right: ({ x }, { left }) => parseFloat(left) + (x.max - x.min),
    // Transform
    x: getTranslateFromMatrix(4, 13),
    y: getTranslateFromMatrix(5, 14),
};
// Alias translate longform names
positionalValues.translateX = positionalValues.x;
positionalValues.translateY = positionalValues.y;

/**
 * Tests a provided value against a ValueType
 */
const testValueType = (v) => (type) => type.test(v);

/**
 * ValueType for "auto"
 */
const auto = {
    test: (v) => v === "auto",
    parse: (v) => v,
};

/**
 * A list of value types commonly used for dimensions
 */
const dimensionValueTypes = [number$1, px, percent, degrees$2, vw, vh, auto];
/**
 * Tests a dimensional value against the list of dimension ValueTypes
 */
const findDimensionValueType = (v) => dimensionValueTypes.find(testValueType(v));

const toResolve = new Set();
let isScheduled = false;
let anyNeedsMeasurement = false;
function measureAllKeyframes() {
    if (anyNeedsMeasurement) {
        const resolversToMeasure = Array.from(toResolve).filter((resolver) => resolver.needsMeasurement);
        const elementsToMeasure = new Set(resolversToMeasure.map((resolver) => resolver.element));
        const transformsToRestore = new Map();
        /**
         * Write pass
         * If we're measuring elements we want to remove bounding box-changing transforms.
         */
        elementsToMeasure.forEach((element) => {
            const removedTransforms = removeNonTranslationalTransform(element);
            if (!removedTransforms.length)
                return;
            transformsToRestore.set(element, removedTransforms);
            element.render();
        });
        // Read
        resolversToMeasure.forEach((resolver) => resolver.measureInitialState());
        // Write
        elementsToMeasure.forEach((element) => {
            element.render();
            const restore = transformsToRestore.get(element);
            if (restore) {
                restore.forEach(([key, value]) => {
                    var _a;
                    (_a = element.getValue(key)) === null || _a === void 0 ? void 0 : _a.set(value);
                });
            }
        });
        // Read
        resolversToMeasure.forEach((resolver) => resolver.measureEndState());
        // Write
        resolversToMeasure.forEach((resolver) => {
            if (resolver.suspendedScrollY !== undefined) {
                window.scrollTo(0, resolver.suspendedScrollY);
            }
        });
    }
    anyNeedsMeasurement = false;
    isScheduled = false;
    toResolve.forEach((resolver) => resolver.complete());
    toResolve.clear();
}
function readAllKeyframes() {
    toResolve.forEach((resolver) => {
        resolver.readKeyframes();
        if (resolver.needsMeasurement) {
            anyNeedsMeasurement = true;
        }
    });
}
function flushKeyframeResolvers() {
    readAllKeyframes();
    measureAllKeyframes();
}
class KeyframeResolver {
    constructor(unresolvedKeyframes, onComplete, name, motionValue, element, isAsync = false) {
        /**
         * Track whether this resolver has completed. Once complete, it never
         * needs to attempt keyframe resolution again.
         */
        this.isComplete = false;
        /**
         * Track whether this resolver is async. If it is, it'll be added to the
         * resolver queue and flushed in the next frame. Resolvers that aren't going
         * to trigger read/write thrashing don't need to be async.
         */
        this.isAsync = false;
        /**
         * Track whether this resolver needs to perform a measurement
         * to resolve its keyframes.
         */
        this.needsMeasurement = false;
        /**
         * Track whether this resolver is currently scheduled to resolve
         * to allow it to be cancelled and resumed externally.
         */
        this.isScheduled = false;
        this.unresolvedKeyframes = [...unresolvedKeyframes];
        this.onComplete = onComplete;
        this.name = name;
        this.motionValue = motionValue;
        this.element = element;
        this.isAsync = isAsync;
    }
    scheduleResolve() {
        this.isScheduled = true;
        if (this.isAsync) {
            toResolve.add(this);
            if (!isScheduled) {
                isScheduled = true;
                frame.read(readAllKeyframes);
                frame.resolveKeyframes(measureAllKeyframes);
            }
        }
        else {
            this.readKeyframes();
            this.complete();
        }
    }
    readKeyframes() {
        const { unresolvedKeyframes, name, element, motionValue } = this;
        /**
         * If a keyframe is null, we hydrate it either by reading it from
         * the instance, or propagating from previous keyframes.
         */
        for (let i = 0; i < unresolvedKeyframes.length; i++) {
            if (unresolvedKeyframes[i] === null) {
                /**
                 * If the first keyframe is null, we need to find its value by sampling the element
                 */
                if (i === 0) {
                    const currentValue = motionValue === null || motionValue === void 0 ? void 0 : motionValue.get();
                    const finalKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
                    if (currentValue !== undefined) {
                        unresolvedKeyframes[0] = currentValue;
                    }
                    else if (element && name) {
                        const valueAsRead = element.readValue(name, finalKeyframe);
                        if (valueAsRead !== undefined && valueAsRead !== null) {
                            unresolvedKeyframes[0] = valueAsRead;
                        }
                    }
                    if (unresolvedKeyframes[0] === undefined) {
                        unresolvedKeyframes[0] = finalKeyframe;
                    }
                    if (motionValue && currentValue === undefined) {
                        motionValue.set(unresolvedKeyframes[0]);
                    }
                }
                else {
                    unresolvedKeyframes[i] = unresolvedKeyframes[i - 1];
                }
            }
        }
    }
    setFinalKeyframe() { }
    measureInitialState() { }
    renderEndStyles() { }
    measureEndState() { }
    complete() {
        this.isComplete = true;
        this.onComplete(this.unresolvedKeyframes, this.finalKeyframe);
        toResolve.delete(this);
    }
    cancel() {
        if (!this.isComplete) {
            this.isScheduled = false;
            toResolve.delete(this);
        }
    }
    resume() {
        if (!this.isComplete)
            this.scheduleResolve();
    }
}

// If this number is a decimal, make it just five decimal places
// to avoid exponents
const sanitize = (v) => Math.round(v * 100000) / 100000;

const floatRegex = /-?(?:\d+(?:\.\d+)?|\.\d+)/gu;

function isNullish(v) {
    return v == null;
}

const singleColorRegex = /^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu;

/**
 * Returns true if the provided string is a color, ie rgba(0,0,0,0) or #000,
 * but false if a number or multiple colors
 */
const isColorString = (type, testProp) => (v) => {
    return Boolean((typeof v === "string" &&
        singleColorRegex.test(v) &&
        v.startsWith(type)) ||
        (testProp &&
            !isNullish(v) &&
            Object.prototype.hasOwnProperty.call(v, testProp)));
};
const splitColor = (aName, bName, cName) => (v) => {
    if (typeof v !== "string")
        return v;
    const [a, b, c, alpha] = v.match(floatRegex);
    return {
        [aName]: parseFloat(a),
        [bName]: parseFloat(b),
        [cName]: parseFloat(c),
        alpha: alpha !== undefined ? parseFloat(alpha) : 1,
    };
};

const clampRgbUnit = (v) => clamp(0, 255, v);
const rgbUnit = {
    ...number$1,
    transform: (v) => Math.round(clampRgbUnit(v)),
};
const rgba$1 = {
    test: /*@__PURE__*/ isColorString("rgb", "red"),
    parse: /*@__PURE__*/ splitColor("red", "green", "blue"),
    transform: ({ red, green, blue, alpha: alpha$1 = 1 }) => "rgba(" +
        rgbUnit.transform(red) +
        ", " +
        rgbUnit.transform(green) +
        ", " +
        rgbUnit.transform(blue) +
        ", " +
        sanitize(alpha.transform(alpha$1)) +
        ")",
};

function parseHex(v) {
    let r = "";
    let g = "";
    let b = "";
    let a = "";
    // If we have 6 characters, ie #FF0000
    if (v.length > 5) {
        r = v.substring(1, 3);
        g = v.substring(3, 5);
        b = v.substring(5, 7);
        a = v.substring(7, 9);
        // Or we have 3 characters, ie #F00
    }
    else {
        r = v.substring(1, 2);
        g = v.substring(2, 3);
        b = v.substring(3, 4);
        a = v.substring(4, 5);
        r += r;
        g += g;
        b += b;
        a += a;
    }
    return {
        red: parseInt(r, 16),
        green: parseInt(g, 16),
        blue: parseInt(b, 16),
        alpha: a ? parseInt(a, 16) / 255 : 1,
    };
}
const hex$1 = {
    test: /*@__PURE__*/ isColorString("#"),
    parse: parseHex,
    transform: rgba$1.transform,
};

const hsla$1 = {
    test: /*@__PURE__*/ isColorString("hsl", "hue"),
    parse: /*@__PURE__*/ splitColor("hue", "saturation", "lightness"),
    transform: ({ hue, saturation, lightness, alpha: alpha$1 = 1 }) => {
        return ("hsla(" +
            Math.round(hue) +
            ", " +
            percent.transform(sanitize(saturation)) +
            ", " +
            percent.transform(sanitize(lightness)) +
            ", " +
            sanitize(alpha.transform(alpha$1)) +
            ")");
    },
};

const color$1 = {
    test: (v) => rgba$1.test(v) || hex$1.test(v) || hsla$1.test(v),
    parse: (v) => {
        if (rgba$1.test(v)) {
            return rgba$1.parse(v);
        }
        else if (hsla$1.test(v)) {
            return hsla$1.parse(v);
        }
        else {
            return hex$1.parse(v);
        }
    },
    transform: (v) => {
        return typeof v === "string"
            ? v
            : v.hasOwnProperty("red")
                ? rgba$1.transform(v)
                : hsla$1.transform(v);
    },
};

const colorRegex = /(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;

function test(v) {
    var _a, _b;
    return (isNaN(v) &&
        typeof v === "string" &&
        (((_a = v.match(floatRegex)) === null || _a === void 0 ? void 0 : _a.length) || 0) +
            (((_b = v.match(colorRegex)) === null || _b === void 0 ? void 0 : _b.length) || 0) >
            0);
}
const NUMBER_TOKEN = "number";
const COLOR_TOKEN = "color";
const VAR_TOKEN = "var";
const VAR_FUNCTION_TOKEN = "var(";
const SPLIT_TOKEN = "${}";
// this regex consists of the `singleCssVariableRegex|rgbHSLValueRegex|digitRegex`
const complexRegex = /var\s*\(\s*--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)|#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\)|-?(?:\d+(?:\.\d+)?|\.\d+)/giu;
function analyseComplexValue(value) {
    const originalValue = value.toString();
    const values = [];
    const indexes = {
        color: [],
        number: [],
        var: [],
    };
    const types = [];
    let i = 0;
    const tokenised = originalValue.replace(complexRegex, (parsedValue) => {
        if (color$1.test(parsedValue)) {
            indexes.color.push(i);
            types.push(COLOR_TOKEN);
            values.push(color$1.parse(parsedValue));
        }
        else if (parsedValue.startsWith(VAR_FUNCTION_TOKEN)) {
            indexes.var.push(i);
            types.push(VAR_TOKEN);
            values.push(parsedValue);
        }
        else {
            indexes.number.push(i);
            types.push(NUMBER_TOKEN);
            values.push(parseFloat(parsedValue));
        }
        ++i;
        return SPLIT_TOKEN;
    });
    const split = tokenised.split(SPLIT_TOKEN);
    return { values, split, indexes, types };
}
function parseComplexValue(v) {
    return analyseComplexValue(v).values;
}
function createTransformer(source) {
    const { split, types } = analyseComplexValue(source);
    const numSections = split.length;
    return (v) => {
        let output = "";
        for (let i = 0; i < numSections; i++) {
            output += split[i];
            if (v[i] !== undefined) {
                const type = types[i];
                if (type === NUMBER_TOKEN) {
                    output += sanitize(v[i]);
                }
                else if (type === COLOR_TOKEN) {
                    output += color$1.transform(v[i]);
                }
                else {
                    output += v[i];
                }
            }
        }
        return output;
    };
}
const convertNumbersToZero = (v) => typeof v === "number" ? 0 : v;
function getAnimatableNone$1(v) {
    const parsed = parseComplexValue(v);
    const transformer = createTransformer(v);
    return transformer(parsed.map(convertNumbersToZero));
}
const complex = {
    test,
    parse: parseComplexValue,
    createTransformer,
    getAnimatableNone: getAnimatableNone$1,
};

/**
 * Properties that should default to 1 or 100%
 */
const maxDefaults = new Set(["brightness", "contrast", "saturate", "opacity"]);
function applyDefaultFilter(v) {
    const [name, value] = v.slice(0, -1).split("(");
    if (name === "drop-shadow")
        return v;
    const [number] = value.match(floatRegex) || [];
    if (!number)
        return v;
    const unit = value.replace(number, "");
    let defaultValue = maxDefaults.has(name) ? 1 : 0;
    if (number !== value)
        defaultValue *= 100;
    return name + "(" + defaultValue + unit + ")";
}
const functionRegex = /\b([a-z-]*)\(.*?\)/gu;
const filter = {
    ...complex,
    getAnimatableNone: (v) => {
        const functions = v.match(functionRegex);
        return functions ? functions.map(applyDefaultFilter).join(" ") : v;
    },
};

const browserNumberValueTypes = {
    // Border props
    borderWidth: px,
    borderTopWidth: px,
    borderRightWidth: px,
    borderBottomWidth: px,
    borderLeftWidth: px,
    borderRadius: px,
    radius: px,
    borderTopLeftRadius: px,
    borderTopRightRadius: px,
    borderBottomRightRadius: px,
    borderBottomLeftRadius: px,
    // Positioning props
    width: px,
    maxWidth: px,
    height: px,
    maxHeight: px,
    top: px,
    right: px,
    bottom: px,
    left: px,
    // Spacing props
    padding: px,
    paddingTop: px,
    paddingRight: px,
    paddingBottom: px,
    paddingLeft: px,
    margin: px,
    marginTop: px,
    marginRight: px,
    marginBottom: px,
    marginLeft: px,
    // Misc
    backgroundPositionX: px,
    backgroundPositionY: px,
};

const transformValueTypes = {
    rotate: degrees$2,
    rotateX: degrees$2,
    rotateY: degrees$2,
    rotateZ: degrees$2,
    scale,
    scaleX: scale,
    scaleY: scale,
    scaleZ: scale,
    skew: degrees$2,
    skewX: degrees$2,
    skewY: degrees$2,
    distance: px,
    translateX: px,
    translateY: px,
    translateZ: px,
    x: px,
    y: px,
    z: px,
    perspective: px,
    transformPerspective: px,
    opacity: alpha,
    originX: progressPercentage,
    originY: progressPercentage,
    originZ: px,
};

const int = {
    ...number$1,
    transform: Math.round,
};

const numberValueTypes = {
    ...browserNumberValueTypes,
    ...transformValueTypes,
    zIndex: int,
    size: px,
    // SVG
    fillOpacity: alpha,
    strokeOpacity: alpha,
    numOctaves: int,
};

/**
 * A map of default value types for common values
 */
const defaultValueTypes = {
    ...numberValueTypes,
    // Color props
    color: color$1,
    backgroundColor: color$1,
    outlineColor: color$1,
    fill: color$1,
    stroke: color$1,
    // Border props
    borderColor: color$1,
    borderTopColor: color$1,
    borderRightColor: color$1,
    borderBottomColor: color$1,
    borderLeftColor: color$1,
    filter,
    WebkitFilter: filter,
};
/**
 * Gets the default ValueType for the provided value key
 */
const getDefaultValueType = (key) => defaultValueTypes[key];

function getAnimatableNone(key, value) {
    let defaultValueType = getDefaultValueType(key);
    if (defaultValueType !== filter)
        defaultValueType = complex;
    // If value is not recognised as animatable, ie "none", create an animatable version origin based on the target
    return defaultValueType.getAnimatableNone
        ? defaultValueType.getAnimatableNone(value)
        : undefined;
}

/**
 * If we encounter keyframes like "none" or "0" and we also have keyframes like
 * "#fff" or "200px 200px" we want to find a keyframe to serve as a template for
 * the "none" keyframes. In this case "#fff" or "200px 200px" - then these get turned into
 * zero equivalents, i.e. "#fff0" or "0px 0px".
 */
const invalidTemplates = new Set(["auto", "none", "0"]);
function makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name) {
    let i = 0;
    let animatableTemplate = undefined;
    while (i < unresolvedKeyframes.length && !animatableTemplate) {
        const keyframe = unresolvedKeyframes[i];
        if (typeof keyframe === "string" &&
            !invalidTemplates.has(keyframe) &&
            analyseComplexValue(keyframe).values.length) {
            animatableTemplate = unresolvedKeyframes[i];
        }
        i++;
    }
    if (animatableTemplate && name) {
        for (const noneIndex of noneKeyframeIndexes) {
            unresolvedKeyframes[noneIndex] = getAnimatableNone(name, animatableTemplate);
        }
    }
}

class DOMKeyframesResolver extends KeyframeResolver {
    constructor(unresolvedKeyframes, onComplete, name, motionValue, element) {
        super(unresolvedKeyframes, onComplete, name, motionValue, element, true);
    }
    readKeyframes() {
        const { unresolvedKeyframes, element, name } = this;
        if (!element || !element.current)
            return;
        super.readKeyframes();
        /**
         * If any keyframe is a CSS variable, we need to find its value by sampling the element
         */
        for (let i = 0; i < unresolvedKeyframes.length; i++) {
            let keyframe = unresolvedKeyframes[i];
            if (typeof keyframe === "string") {
                keyframe = keyframe.trim();
                if (isCSSVariableToken(keyframe)) {
                    const resolved = getVariableValue(keyframe, element.current);
                    if (resolved !== undefined) {
                        unresolvedKeyframes[i] = resolved;
                    }
                    if (i === unresolvedKeyframes.length - 1) {
                        this.finalKeyframe = keyframe;
                    }
                }
            }
        }
        /**
         * Resolve "none" values. We do this potentially twice - once before and once after measuring keyframes.
         * This could be seen as inefficient but it's a trade-off to avoid measurements in more situations, which
         * have a far bigger performance impact.
         */
        this.resolveNoneKeyframes();
        /**
         * Check to see if unit type has changed. If so schedule jobs that will
         * temporarily set styles to the destination keyframes.
         * Skip if we have more than two keyframes or this isn't a positional value.
         * TODO: We can throw if there are multiple keyframes and the value type changes.
         */
        if (!positionalKeys.has(name) || unresolvedKeyframes.length !== 2) {
            return;
        }
        const [origin, target] = unresolvedKeyframes;
        const originType = findDimensionValueType(origin);
        const targetType = findDimensionValueType(target);
        /**
         * Either we don't recognise these value types or we can animate between them.
         */
        if (originType === targetType)
            return;
        /**
         * If both values are numbers or pixels, we can animate between them by
         * converting them to numbers.
         */
        if (isNumOrPxType(originType) && isNumOrPxType(targetType)) {
            for (let i = 0; i < unresolvedKeyframes.length; i++) {
                const value = unresolvedKeyframes[i];
                if (typeof value === "string") {
                    unresolvedKeyframes[i] = parseFloat(value);
                }
            }
        }
        else {
            /**
             * Else, the only way to resolve this is by measuring the element.
             */
            this.needsMeasurement = true;
        }
    }
    resolveNoneKeyframes() {
        const { unresolvedKeyframes, name } = this;
        const noneKeyframeIndexes = [];
        for (let i = 0; i < unresolvedKeyframes.length; i++) {
            if (isNone(unresolvedKeyframes[i])) {
                noneKeyframeIndexes.push(i);
            }
        }
        if (noneKeyframeIndexes.length) {
            makeNoneKeyframesAnimatable(unresolvedKeyframes, noneKeyframeIndexes, name);
        }
    }
    measureInitialState() {
        const { element, unresolvedKeyframes, name } = this;
        if (!element || !element.current)
            return;
        if (name === "height") {
            this.suspendedScrollY = window.pageYOffset;
        }
        this.measuredOrigin = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));
        unresolvedKeyframes[0] = this.measuredOrigin;
        // Set final key frame to measure after next render
        const measureKeyframe = unresolvedKeyframes[unresolvedKeyframes.length - 1];
        if (measureKeyframe !== undefined) {
            element.getValue(name, measureKeyframe).jump(measureKeyframe, false);
        }
    }
    measureEndState() {
        var _a;
        const { element, name, unresolvedKeyframes } = this;
        if (!element || !element.current)
            return;
        const value = element.getValue(name);
        value && value.jump(this.measuredOrigin, false);
        const finalKeyframeIndex = unresolvedKeyframes.length - 1;
        const finalKeyframe = unresolvedKeyframes[finalKeyframeIndex];
        unresolvedKeyframes[finalKeyframeIndex] = positionalValues[name](element.measureViewportBox(), window.getComputedStyle(element.current));
        if (finalKeyframe !== null && this.finalKeyframe === undefined) {
            this.finalKeyframe = finalKeyframe;
        }
        // If we removed transform values, reapply them before the next render
        if ((_a = this.removedTransforms) === null || _a === void 0 ? void 0 : _a.length) {
            this.removedTransforms.forEach(([unsetTransformName, unsetTransformValue]) => {
                element
                    .getValue(unsetTransformName)
                    .set(unsetTransformValue);
            });
        }
        this.resolveNoneKeyframes();
    }
}

function isGenerator(type) {
    return typeof type === "function";
}

let now;
function clearTime() {
    now = undefined;
}
/**
 * An eventloop-synchronous alternative to performance.now().
 *
 * Ensures that time measurements remain consistent within a synchronous context.
 * Usually calling performance.now() twice within the same synchronous context
 * will return different values which isn't useful for animations when we're usually
 * trying to sync animations to the same frame.
 */
const time = {
    now: () => {
        if (now === undefined) {
            time.set(frameData.isProcessing || MotionGlobalConfig.useManualTiming
                ? frameData.timestamp
                : performance.now());
        }
        return now;
    },
    set: (newTime) => {
        now = newTime;
        queueMicrotask(clearTime);
    },
};

/**
 * Check if a value is animatable. Examples:
 *
 * ✅: 100, "100px", "#fff"
 * ❌: "block", "url(2.jpg)"
 * @param value
 *
 * @internal
 */
const isAnimatable = (value, name) => {
    // If the list of keys tat might be non-animatable grows, replace with Set
    if (name === "zIndex")
        return false;
    // If it's a number or a keyframes array, we can animate it. We might at some point
    // need to do a deep isAnimatable check of keyframes, or let Popmotion handle this,
    // but for now lets leave it like this for performance reasons
    if (typeof value === "number" || Array.isArray(value))
        return true;
    if (typeof value === "string" && // It's animatable if we have a string
        (complex.test(value) || value === "0") && // And it contains numbers and/or colors
        !value.startsWith("url(") // Unless it starts with "url("
    ) {
        return true;
    }
    return false;
};

function hasKeyframesChanged(keyframes) {
    const current = keyframes[0];
    if (keyframes.length === 1)
        return true;
    for (let i = 0; i < keyframes.length; i++) {
        if (keyframes[i] !== current)
            return true;
    }
}
function canAnimate(keyframes, name, type, velocity) {
    /**
     * Check if we're able to animate between the start and end keyframes,
     * and throw a warning if we're attempting to animate between one that's
     * animatable and another that isn't.
     */
    const originKeyframe = keyframes[0];
    if (originKeyframe === null)
        return false;
    /**
     * These aren't traditionally animatable but we do support them.
     * In future we could look into making this more generic or replacing
     * this function with mix() === mixImmediate
     */
    if (name === "display" || name === "visibility")
        return true;
    const targetKeyframe = keyframes[keyframes.length - 1];
    const isOriginAnimatable = isAnimatable(originKeyframe, name);
    const isTargetAnimatable = isAnimatable(targetKeyframe, name);
    warning(isOriginAnimatable === isTargetAnimatable, `You are trying to animate ${name} from "${originKeyframe}" to "${targetKeyframe}". ${originKeyframe} is not an animatable value - to enable this animation set ${originKeyframe} to a value animatable to ${targetKeyframe} via the \`style\` property.`);
    // Always skip if any of these are true
    if (!isOriginAnimatable || !isTargetAnimatable) {
        return false;
    }
    return (hasKeyframesChanged(keyframes) ||
        ((type === "spring" || isGenerator(type)) && velocity));
}

/**
 * Maximum time allowed between an animation being created and it being
 * resolved for us to use the latter as the start time.
 *
 * This is to ensure that while we prefer to "start" an animation as soon
 * as it's triggered, we also want to avoid a visual jump if there's a big delay
 * between these two moments.
 */
const MAX_RESOLVE_DELAY = 40;
class BaseAnimation {
    constructor({ autoplay = true, delay = 0, type = "keyframes", repeat = 0, repeatDelay = 0, repeatType = "loop", ...options }) {
        // Track whether the animation has been stopped. Stopped animations won't restart.
        this.isStopped = false;
        this.hasAttemptedResolve = false;
        this.createdAt = time.now();
        this.options = {
            autoplay,
            delay,
            type,
            repeat,
            repeatDelay,
            repeatType,
            ...options,
        };
        this.updateFinishedPromise();
    }
    /**
     * This method uses the createdAt and resolvedAt to calculate the
     * animation startTime. *Ideally*, we would use the createdAt time as t=0
     * as the following frame would then be the first frame of the animation in
     * progress, which would feel snappier.
     *
     * However, if there's a delay (main thread work) between the creation of
     * the animation and the first commited frame, we prefer to use resolvedAt
     * to avoid a sudden jump into the animation.
     */
    calcStartTime() {
        if (!this.resolvedAt)
            return this.createdAt;
        return this.resolvedAt - this.createdAt > MAX_RESOLVE_DELAY
            ? this.resolvedAt
            : this.createdAt;
    }
    /**
     * A getter for resolved data. If keyframes are not yet resolved, accessing
     * this.resolved will synchronously flush all pending keyframe resolvers.
     * This is a deoptimisation, but at its worst still batches read/writes.
     */
    get resolved() {
        if (!this._resolved && !this.hasAttemptedResolve) {
            flushKeyframeResolvers();
        }
        return this._resolved;
    }
    /**
     * A method to be called when the keyframes resolver completes. This method
     * will check if its possible to run the animation and, if not, skip it.
     * Otherwise, it will call initPlayback on the implementing class.
     */
    onKeyframesResolved(keyframes, finalKeyframe) {
        this.resolvedAt = time.now();
        this.hasAttemptedResolve = true;
        const { name, type, velocity, delay, onComplete, onUpdate, isGenerator, } = this.options;
        /**
         * If we can't animate this value with the resolved keyframes
         * then we should complete it immediately.
         */
        if (!isGenerator && !canAnimate(keyframes, name, type, velocity)) {
            // Finish immediately
            if (!delay) {
                onUpdate === null || onUpdate === void 0 ? void 0 : onUpdate(getFinalKeyframe(keyframes, this.options, finalKeyframe));
                onComplete === null || onComplete === void 0 ? void 0 : onComplete();
                this.resolveFinishedPromise();
                return;
            }
            // Finish after a delay
            else {
                this.options.duration = 0;
            }
        }
        const resolvedAnimation = this.initPlayback(keyframes, finalKeyframe);
        if (resolvedAnimation === false)
            return;
        this._resolved = {
            keyframes,
            finalKeyframe,
            ...resolvedAnimation,
        };
        this.onPostResolved();
    }
    onPostResolved() { }
    /**
     * Allows the returned animation to be awaited or promise-chained. Currently
     * resolves when the animation finishes at all but in a future update could/should
     * reject if its cancels.
     */
    then(resolve, reject) {
        return this.currentFinishedPromise.then(resolve, reject);
    }
    updateFinishedPromise() {
        this.currentFinishedPromise = new Promise((resolve) => {
            this.resolveFinishedPromise = resolve;
        });
    }
}

/*
  Convert velocity into velocity per second

  @param [number]: Unit per frame
  @param [number]: Frame duration in ms
*/
function velocityPerSecond(velocity, frameDuration) {
    return frameDuration ? velocity * (1000 / frameDuration) : 0;
}

const velocitySampleDuration = 5; // ms
function calcGeneratorVelocity(resolveValue, t, current) {
    const prevT = Math.max(t - velocitySampleDuration, 0);
    return velocityPerSecond(current - resolveValue(prevT), t - prevT);
}

const safeMin = 0.001;
const minDuration = 0.01;
const maxDuration$1 = 10.0;
const minDamping = 0.05;
const maxDamping = 1;
function findSpring({ duration = 800, bounce = 0.25, velocity = 0, mass = 1, }) {
    let envelope;
    let derivative;
    warning(duration <= secondsToMilliseconds(maxDuration$1), "Spring duration must be 10 seconds or less");
    let dampingRatio = 1 - bounce;
    /**
     * Restrict dampingRatio and duration to within acceptable ranges.
     */
    dampingRatio = clamp(minDamping, maxDamping, dampingRatio);
    duration = clamp(minDuration, maxDuration$1, millisecondsToSeconds(duration));
    if (dampingRatio < 1) {
        /**
         * Underdamped spring
         */
        envelope = (undampedFreq) => {
            const exponentialDecay = undampedFreq * dampingRatio;
            const delta = exponentialDecay * duration;
            const a = exponentialDecay - velocity;
            const b = calcAngularFreq(undampedFreq, dampingRatio);
            const c = Math.exp(-delta);
            return safeMin - (a / b) * c;
        };
        derivative = (undampedFreq) => {
            const exponentialDecay = undampedFreq * dampingRatio;
            const delta = exponentialDecay * duration;
            const d = delta * velocity + velocity;
            const e = Math.pow(dampingRatio, 2) * Math.pow(undampedFreq, 2) * duration;
            const f = Math.exp(-delta);
            const g = calcAngularFreq(Math.pow(undampedFreq, 2), dampingRatio);
            const factor = -envelope(undampedFreq) + safeMin > 0 ? -1 : 1;
            return (factor * ((d - e) * f)) / g;
        };
    }
    else {
        /**
         * Critically-damped spring
         */
        envelope = (undampedFreq) => {
            const a = Math.exp(-undampedFreq * duration);
            const b = (undampedFreq - velocity) * duration + 1;
            return -safeMin + a * b;
        };
        derivative = (undampedFreq) => {
            const a = Math.exp(-undampedFreq * duration);
            const b = (velocity - undampedFreq) * (duration * duration);
            return a * b;
        };
    }
    const initialGuess = 5 / duration;
    const undampedFreq = approximateRoot(envelope, derivative, initialGuess);
    duration = secondsToMilliseconds(duration);
    if (isNaN(undampedFreq)) {
        return {
            stiffness: 100,
            damping: 10,
            duration,
        };
    }
    else {
        const stiffness = Math.pow(undampedFreq, 2) * mass;
        return {
            stiffness,
            damping: dampingRatio * 2 * Math.sqrt(mass * stiffness),
            duration,
        };
    }
}
const rootIterations = 12;
function approximateRoot(envelope, derivative, initialGuess) {
    let result = initialGuess;
    for (let i = 1; i < rootIterations; i++) {
        result = result - envelope(result) / derivative(result);
    }
    return result;
}
function calcAngularFreq(undampedFreq, dampingRatio) {
    return undampedFreq * Math.sqrt(1 - dampingRatio * dampingRatio);
}

const durationKeys = ["duration", "bounce"];
const physicsKeys = ["stiffness", "damping", "mass"];
function isSpringType(options, keys) {
    return keys.some((key) => options[key] !== undefined);
}
function getSpringOptions(options) {
    let springOptions = {
        velocity: 0.0,
        stiffness: 100,
        damping: 10,
        mass: 1.0,
        isResolvedFromDuration: false,
        ...options,
    };
    // stiffness/damping/mass overrides duration/bounce
    if (!isSpringType(options, physicsKeys) &&
        isSpringType(options, durationKeys)) {
        const derived = findSpring(options);
        springOptions = {
            ...springOptions,
            ...derived,
            mass: 1.0,
        };
        springOptions.isResolvedFromDuration = true;
    }
    return springOptions;
}
function spring({ keyframes, restDelta, restSpeed, ...options }) {
    const origin = keyframes[0];
    const target = keyframes[keyframes.length - 1];
    /**
     * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator
     * to reduce GC during animation.
     */
    const state = { done: false, value: origin };
    const { stiffness, damping, mass, duration, velocity, isResolvedFromDuration, } = getSpringOptions({
        ...options,
        velocity: -millisecondsToSeconds(options.velocity || 0),
    });
    const initialVelocity = velocity || 0.0;
    const dampingRatio = damping / (2 * Math.sqrt(stiffness * mass));
    const initialDelta = target - origin;
    const undampedAngularFreq = millisecondsToSeconds(Math.sqrt(stiffness / mass));
    /**
     * If we're working on a granular scale, use smaller defaults for determining
     * when the spring is finished.
     *
     * These defaults have been selected emprically based on what strikes a good
     * ratio between feeling good and finishing as soon as changes are imperceptible.
     */
    const isGranularScale = Math.abs(initialDelta) < 5;
    restSpeed || (restSpeed = isGranularScale ? 0.01 : 2);
    restDelta || (restDelta = isGranularScale ? 0.005 : 0.5);
    let resolveSpring;
    if (dampingRatio < 1) {
        const angularFreq = calcAngularFreq(undampedAngularFreq, dampingRatio);
        // Underdamped spring
        resolveSpring = (t) => {
            const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
            return (target -
                envelope *
                    (((initialVelocity +
                        dampingRatio * undampedAngularFreq * initialDelta) /
                        angularFreq) *
                        Math.sin(angularFreq * t) +
                        initialDelta * Math.cos(angularFreq * t)));
        };
    }
    else if (dampingRatio === 1) {
        // Critically damped spring
        resolveSpring = (t) => target -
            Math.exp(-undampedAngularFreq * t) *
                (initialDelta +
                    (initialVelocity + undampedAngularFreq * initialDelta) * t);
    }
    else {
        // Overdamped spring
        const dampedAngularFreq = undampedAngularFreq * Math.sqrt(dampingRatio * dampingRatio - 1);
        resolveSpring = (t) => {
            const envelope = Math.exp(-dampingRatio * undampedAngularFreq * t);
            // When performing sinh or cosh values can hit Infinity so we cap them here
            const freqForT = Math.min(dampedAngularFreq * t, 300);
            return (target -
                (envelope *
                    ((initialVelocity +
                        dampingRatio * undampedAngularFreq * initialDelta) *
                        Math.sinh(freqForT) +
                        dampedAngularFreq *
                            initialDelta *
                            Math.cosh(freqForT))) /
                    dampedAngularFreq);
        };
    }
    return {
        calculatedDuration: isResolvedFromDuration ? duration || null : null,
        next: (t) => {
            const current = resolveSpring(t);
            if (!isResolvedFromDuration) {
                let currentVelocity = 0.0;
                /**
                 * We only need to calculate velocity for under-damped springs
                 * as over- and critically-damped springs can't overshoot, so
                 * checking only for displacement is enough.
                 */
                if (dampingRatio < 1) {
                    currentVelocity =
                        t === 0
                            ? secondsToMilliseconds(initialVelocity)
                            : calcGeneratorVelocity(resolveSpring, t, current);
                }
                const isBelowVelocityThreshold = Math.abs(currentVelocity) <= restSpeed;
                const isBelowDisplacementThreshold = Math.abs(target - current) <= restDelta;
                state.done =
                    isBelowVelocityThreshold && isBelowDisplacementThreshold;
            }
            else {
                state.done = t >= duration;
            }
            state.value = state.done ? target : current;
            return state;
        },
    };
}

function inertia({ keyframes, velocity = 0.0, power = 0.8, timeConstant = 325, bounceDamping = 10, bounceStiffness = 500, modifyTarget, min, max, restDelta = 0.5, restSpeed, }) {
    const origin = keyframes[0];
    const state = {
        done: false,
        value: origin,
    };
    const isOutOfBounds = (v) => (min !== undefined && v < min) || (max !== undefined && v > max);
    const nearestBoundary = (v) => {
        if (min === undefined)
            return max;
        if (max === undefined)
            return min;
        return Math.abs(min - v) < Math.abs(max - v) ? min : max;
    };
    let amplitude = power * velocity;
    const ideal = origin + amplitude;
    const target = modifyTarget === undefined ? ideal : modifyTarget(ideal);
    /**
     * If the target has changed we need to re-calculate the amplitude, otherwise
     * the animation will start from the wrong position.
     */
    if (target !== ideal)
        amplitude = target - origin;
    const calcDelta = (t) => -amplitude * Math.exp(-t / timeConstant);
    const calcLatest = (t) => target + calcDelta(t);
    const applyFriction = (t) => {
        const delta = calcDelta(t);
        const latest = calcLatest(t);
        state.done = Math.abs(delta) <= restDelta;
        state.value = state.done ? target : latest;
    };
    /**
     * Ideally this would resolve for t in a stateless way, we could
     * do that by always precalculating the animation but as we know
     * this will be done anyway we can assume that spring will
     * be discovered during that.
     */
    let timeReachedBoundary;
    let spring$1;
    const checkCatchBoundary = (t) => {
        if (!isOutOfBounds(state.value))
            return;
        timeReachedBoundary = t;
        spring$1 = spring({
            keyframes: [state.value, nearestBoundary(state.value)],
            velocity: calcGeneratorVelocity(calcLatest, t, state.value), // TODO: This should be passing * 1000
            damping: bounceDamping,
            stiffness: bounceStiffness,
            restDelta,
            restSpeed,
        });
    };
    checkCatchBoundary(0);
    return {
        calculatedDuration: null,
        next: (t) => {
            /**
             * We need to resolve the friction to figure out if we need a
             * spring but we don't want to do this twice per frame. So here
             * we flag if we updated for this frame and later if we did
             * we can skip doing it again.
             */
            let hasUpdatedFrame = false;
            if (!spring$1 && timeReachedBoundary === undefined) {
                hasUpdatedFrame = true;
                applyFriction(t);
                checkCatchBoundary(t);
            }
            /**
             * If we have a spring and the provided t is beyond the moment the friction
             * animation crossed the min/max boundary, use the spring.
             */
            if (timeReachedBoundary !== undefined && t >= timeReachedBoundary) {
                return spring$1.next(t - timeReachedBoundary);
            }
            else {
                !hasUpdatedFrame && applyFriction(t);
                return state;
            }
        },
    };
}

const easeIn = /*@__PURE__*/ cubicBezier(0.42, 0, 1, 1);
const easeOut = /*@__PURE__*/ cubicBezier(0, 0, 0.58, 1);
const easeInOut = /*@__PURE__*/ cubicBezier(0.42, 0, 0.58, 1);

const isEasingArray = (ease) => {
    return Array.isArray(ease) && typeof ease[0] !== "number";
};

const isBezierDefinition = (easing) => Array.isArray(easing) && typeof easing[0] === "number";

const easingLookup = {
    linear: noop$1,
    easeIn,
    easeInOut,
    easeOut,
    circIn,
    circInOut,
    circOut,
    backIn,
    backInOut,
    backOut,
    anticipate,
};
const easingDefinitionToFunction = (definition) => {
    if (isBezierDefinition(definition)) {
        // If cubic bezier definition, create bezier curve
        invariant(definition.length === 4, `Cubic bezier arrays must contain four numerical values.`);
        const [x1, y1, x2, y2] = definition;
        return cubicBezier(x1, y1, x2, y2);
    }
    else if (typeof definition === "string") {
        // Else lookup from table
        invariant(easingLookup[definition] !== undefined, `Invalid easing type '${definition}'`);
        return easingLookup[definition];
    }
    return definition;
};

/**
 * Pipe
 * Compose other transformers to run linearily
 * pipe(min(20), max(40))
 * @param  {...functions} transformers
 * @return {function}
 */
const combineFunctions = (a, b) => (v) => b(a(v));
const pipe = (...transformers) => transformers.reduce(combineFunctions);

/*
  Progress within given range

  Given a lower limit and an upper limit, we return the progress
  (expressed as a number 0-1) represented by the given value, and
  limit that progress to within 0-1.

  @param [number]: Lower limit
  @param [number]: Upper limit
  @param [number]: Value to find progress within given range
  @return [number]: Progress of value within range as expressed 0-1
*/
const progress = (from, to, value) => {
    const toFromDifference = to - from;
    return toFromDifference === 0 ? 1 : (value - from) / toFromDifference;
};

/*
  Value in range from progress

  Given a lower limit and an upper limit, we return the value within
  that range as expressed by progress (usually a number from 0 to 1)

  So progress = 0.5 would change

  from -------- to

  to

  from ---- to

  E.g. from = 10, to = 20, progress = 0.5 => 15

  @param [number]: Lower limit of range
  @param [number]: Upper limit of range
  @param [number]: The progress between lower and upper limits expressed 0-1
  @return [number]: Value as calculated from progress within range (not limited within range)
*/
const mixNumber$1 = (from, to, progress) => {
    return from + (to - from) * progress;
};

// Adapted from https://gist.github.com/mjackson/5311256
function hueToRgb(p, q, t) {
    if (t < 0)
        t += 1;
    if (t > 1)
        t -= 1;
    if (t < 1 / 6)
        return p + (q - p) * 6 * t;
    if (t < 1 / 2)
        return q;
    if (t < 2 / 3)
        return p + (q - p) * (2 / 3 - t) * 6;
    return p;
}
function hslaToRgba({ hue, saturation, lightness, alpha }) {
    hue /= 360;
    saturation /= 100;
    lightness /= 100;
    let red = 0;
    let green = 0;
    let blue = 0;
    if (!saturation) {
        red = green = blue = lightness;
    }
    else {
        const q = lightness < 0.5
            ? lightness * (1 + saturation)
            : lightness + saturation - lightness * saturation;
        const p = 2 * lightness - q;
        red = hueToRgb(p, q, hue + 1 / 3);
        green = hueToRgb(p, q, hue);
        blue = hueToRgb(p, q, hue - 1 / 3);
    }
    return {
        red: Math.round(red * 255),
        green: Math.round(green * 255),
        blue: Math.round(blue * 255),
        alpha,
    };
}

function mixImmediate(a, b) {
    return (p) => (p > 0 ? b : a);
}

// Linear color space blending
// Explained https://www.youtube.com/watch?v=LKnqECcg6Gw
// Demonstrated http://codepen.io/osublake/pen/xGVVaN
const mixLinearColor = (from, to, v) => {
    const fromExpo = from * from;
    const expo = v * (to * to - fromExpo) + fromExpo;
    return expo < 0 ? 0 : Math.sqrt(expo);
};
const colorTypes = [hex$1, rgba$1, hsla$1];
const getColorType = (v) => colorTypes.find((type) => type.test(v));
function asRGBA(color) {
    const type = getColorType(color);
    warning(Boolean(type), `'${color}' is not an animatable color. Use the equivalent color code instead.`);
    if (!Boolean(type))
        return false;
    let model = type.parse(color);
    if (type === hsla$1) {
        // TODO Remove this cast - needed since Framer Motion's stricter typing
        model = hslaToRgba(model);
    }
    return model;
}
const mixColor = (from, to) => {
    const fromRGBA = asRGBA(from);
    const toRGBA = asRGBA(to);
    if (!fromRGBA || !toRGBA) {
        return mixImmediate(from, to);
    }
    const blended = { ...fromRGBA };
    return (v) => {
        blended.red = mixLinearColor(fromRGBA.red, toRGBA.red, v);
        blended.green = mixLinearColor(fromRGBA.green, toRGBA.green, v);
        blended.blue = mixLinearColor(fromRGBA.blue, toRGBA.blue, v);
        blended.alpha = mixNumber$1(fromRGBA.alpha, toRGBA.alpha, v);
        return rgba$1.transform(blended);
    };
};

const invisibleValues = new Set(["none", "hidden"]);
/**
 * Returns a function that, when provided a progress value between 0 and 1,
 * will return the "none" or "hidden" string only when the progress is that of
 * the origin or target.
 */
function mixVisibility(origin, target) {
    if (invisibleValues.has(origin)) {
        return (p) => (p <= 0 ? origin : target);
    }
    else {
        return (p) => (p >= 1 ? target : origin);
    }
}

function mixNumber(a, b) {
    return (p) => mixNumber$1(a, b, p);
}
function getMixer(a) {
    if (typeof a === "number") {
        return mixNumber;
    }
    else if (typeof a === "string") {
        return isCSSVariableToken(a)
            ? mixImmediate
            : color$1.test(a)
                ? mixColor
                : mixComplex;
    }
    else if (Array.isArray(a)) {
        return mixArray;
    }
    else if (typeof a === "object") {
        return color$1.test(a) ? mixColor : mixObject;
    }
    return mixImmediate;
}
function mixArray(a, b) {
    const output = [...a];
    const numValues = output.length;
    const blendValue = a.map((v, i) => getMixer(v)(v, b[i]));
    return (p) => {
        for (let i = 0; i < numValues; i++) {
            output[i] = blendValue[i](p);
        }
        return output;
    };
}
function mixObject(a, b) {
    const output = { ...a, ...b };
    const blendValue = {};
    for (const key in output) {
        if (a[key] !== undefined && b[key] !== undefined) {
            blendValue[key] = getMixer(a[key])(a[key], b[key]);
        }
    }
    return (v) => {
        for (const key in blendValue) {
            output[key] = blendValue[key](v);
        }
        return output;
    };
}
function matchOrder(origin, target) {
    var _a;
    const orderedOrigin = [];
    const pointers = { color: 0, var: 0, number: 0 };
    for (let i = 0; i < target.values.length; i++) {
        const type = target.types[i];
        const originIndex = origin.indexes[type][pointers[type]];
        const originValue = (_a = origin.values[originIndex]) !== null && _a !== void 0 ? _a : 0;
        orderedOrigin[i] = originValue;
        pointers[type]++;
    }
    return orderedOrigin;
}
const mixComplex = (origin, target) => {
    const template = complex.createTransformer(target);
    const originStats = analyseComplexValue(origin);
    const targetStats = analyseComplexValue(target);
    const canInterpolate = originStats.indexes.var.length === targetStats.indexes.var.length &&
        originStats.indexes.color.length === targetStats.indexes.color.length &&
        originStats.indexes.number.length >= targetStats.indexes.number.length;
    if (canInterpolate) {
        if ((invisibleValues.has(origin) &&
            !targetStats.values.length) ||
            (invisibleValues.has(target) &&
                !originStats.values.length)) {
            return mixVisibility(origin, target);
        }
        return pipe(mixArray(matchOrder(originStats, targetStats), targetStats.values), template);
    }
    else {
        warning(true, `Complex values '${origin}' and '${target}' too different to mix. Ensure all colors are of the same type, and that each contains the same quantity of number and color values. Falling back to instant transition.`);
        return mixImmediate(origin, target);
    }
};

function mix(from, to, p) {
    if (typeof from === "number" &&
        typeof to === "number" &&
        typeof p === "number") {
        return mixNumber$1(from, to, p);
    }
    const mixer = getMixer(from);
    return mixer(from, to);
}

function createMixers(output, ease, customMixer) {
    const mixers = [];
    const mixerFactory = customMixer || mix;
    const numMixers = output.length - 1;
    for (let i = 0; i < numMixers; i++) {
        let mixer = mixerFactory(output[i], output[i + 1]);
        if (ease) {
            const easingFunction = Array.isArray(ease) ? ease[i] || noop$1 : ease;
            mixer = pipe(easingFunction, mixer);
        }
        mixers.push(mixer);
    }
    return mixers;
}
/**
 * Create a function that maps from a numerical input array to a generic output array.
 *
 * Accepts:
 *   - Numbers
 *   - Colors (hex, hsl, hsla, rgb, rgba)
 *   - Complex (combinations of one or more numbers or strings)
 *
 * ```jsx
 * const mixColor = interpolate([0, 1], ['#fff', '#000'])
 *
 * mixColor(0.5) // 'rgba(128, 128, 128, 1)'
 * ```
 *
 * TODO Revist this approach once we've moved to data models for values,
 * probably not needed to pregenerate mixer functions.
 *
 * @public
 */
function interpolate(input, output, { clamp: isClamp = true, ease, mixer } = {}) {
    const inputLength = input.length;
    invariant(inputLength === output.length, "Both input and output ranges must be the same length");
    /**
     * If we're only provided a single input, we can just make a function
     * that returns the output.
     */
    if (inputLength === 1)
        return () => output[0];
    if (inputLength === 2 && input[0] === input[1])
        return () => output[1];
    // If input runs highest -> lowest, reverse both arrays
    if (input[0] > input[inputLength - 1]) {
        input = [...input].reverse();
        output = [...output].reverse();
    }
    const mixers = createMixers(output, ease, mixer);
    const numMixers = mixers.length;
    const interpolator = (v) => {
        let i = 0;
        if (numMixers > 1) {
            for (; i < input.length - 2; i++) {
                if (v < input[i + 1])
                    break;
            }
        }
        const progressInRange = progress(input[i], input[i + 1], v);
        return mixers[i](progressInRange);
    };
    return isClamp
        ? (v) => interpolator(clamp(input[0], input[inputLength - 1], v))
        : interpolator;
}

function fillOffset(offset, remaining) {
    const min = offset[offset.length - 1];
    for (let i = 1; i <= remaining; i++) {
        const offsetProgress = progress(0, remaining, i);
        offset.push(mixNumber$1(min, 1, offsetProgress));
    }
}

function defaultOffset(arr) {
    const offset = [0];
    fillOffset(offset, arr.length - 1);
    return offset;
}

function convertOffsetToTimes(offset, duration) {
    return offset.map((o) => o * duration);
}

function defaultEasing(values, easing) {
    return values.map(() => easing || easeInOut).splice(0, values.length - 1);
}
function keyframes({ duration = 300, keyframes: keyframeValues, times, ease = "easeInOut", }) {
    /**
     * Easing functions can be externally defined as strings. Here we convert them
     * into actual functions.
     */
    const easingFunctions = isEasingArray(ease)
        ? ease.map(easingDefinitionToFunction)
        : easingDefinitionToFunction(ease);
    /**
     * This is the Iterator-spec return value. We ensure it's mutable rather than using a generator
     * to reduce GC during animation.
     */
    const state = {
        done: false,
        value: keyframeValues[0],
    };
    /**
     * Create a times array based on the provided 0-1 offsets
     */
    const absoluteTimes = convertOffsetToTimes(
    // Only use the provided offsets if they're the correct length
    // TODO Maybe we should warn here if there's a length mismatch
    times && times.length === keyframeValues.length
        ? times
        : defaultOffset(keyframeValues), duration);
    const mapTimeToKeyframe = interpolate(absoluteTimes, keyframeValues, {
        ease: Array.isArray(easingFunctions)
            ? easingFunctions
            : defaultEasing(keyframeValues, easingFunctions),
    });
    return {
        calculatedDuration: duration,
        next: (t) => {
            state.value = mapTimeToKeyframe(t);
            state.done = t >= duration;
            return state;
        },
    };
}

/**
 * Implement a practical max duration for keyframe generation
 * to prevent infinite loops
 */
const maxGeneratorDuration = 20000;
function calcGeneratorDuration(generator) {
    let duration = 0;
    const timeStep = 50;
    let state = generator.next(duration);
    while (!state.done && duration < maxGeneratorDuration) {
        duration += timeStep;
        state = generator.next(duration);
    }
    return duration >= maxGeneratorDuration ? Infinity : duration;
}

const frameloopDriver = (update) => {
    const passTimestamp = ({ timestamp }) => update(timestamp);
    return {
        start: () => frame.update(passTimestamp, true),
        stop: () => cancelFrame(passTimestamp),
        /**
         * If we're processing this frame we can use the
         * framelocked timestamp to keep things in sync.
         */
        now: () => (frameData.isProcessing ? frameData.timestamp : time.now()),
    };
};

const generators = {
    decay: inertia,
    inertia,
    tween: keyframes,
    keyframes: keyframes,
    spring,
};
const percentToProgress = (percent) => percent / 100;
/**
 * Animation that runs on the main thread. Designed to be WAAPI-spec in the subset of
 * features we expose publically. Mostly the compatibility is to ensure visual identity
 * between both WAAPI and main thread animations.
 */
class MainThreadAnimation extends BaseAnimation {
    constructor(options) {
        super(options);
        /**
         * The time at which the animation was paused.
         */
        this.holdTime = null;
        /**
         * The time at which the animation was cancelled.
         */
        this.cancelTime = null;
        /**
         * The current time of the animation.
         */
        this.currentTime = 0;
        /**
         * Playback speed as a factor. 0 would be stopped, -1 reverse and 2 double speed.
         */
        this.playbackSpeed = 1;
        /**
         * The state of the animation to apply when the animation is resolved. This
         * allows calls to the public API to control the animation before it is resolved,
         * without us having to resolve it first.
         */
        this.pendingPlayState = "running";
        /**
         * The time at which the animation was started.
         */
        this.startTime = null;
        this.state = "idle";
        /**
         * This method is bound to the instance to fix a pattern where
         * animation.stop is returned as a reference from a useEffect.
         */
        this.stop = () => {
            this.resolver.cancel();
            this.isStopped = true;
            if (this.state === "idle")
                return;
            this.teardown();
            const { onStop } = this.options;
            onStop && onStop();
        };
        const { name, motionValue, element, keyframes } = this.options;
        const KeyframeResolver$1 = (element === null || element === void 0 ? void 0 : element.KeyframeResolver) || KeyframeResolver;
        const onResolved = (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe);
        this.resolver = new KeyframeResolver$1(keyframes, onResolved, name, motionValue, element);
        this.resolver.scheduleResolve();
    }
    initPlayback(keyframes$1) {
        const { type = "keyframes", repeat = 0, repeatDelay = 0, repeatType, velocity = 0, } = this.options;
        const generatorFactory = isGenerator(type)
            ? type
            : generators[type] || keyframes;
        /**
         * If our generator doesn't support mixing numbers, we need to replace keyframes with
         * [0, 100] and then make a function that maps that to the actual keyframes.
         *
         * 100 is chosen instead of 1 as it works nicer with spring animations.
         */
        let mapPercentToKeyframes;
        let mirroredGenerator;
        if (generatorFactory !== keyframes &&
            typeof keyframes$1[0] !== "number") {
            if (process.env.NODE_ENV !== "production") {
                invariant(keyframes$1.length === 2, `Only two keyframes currently supported with spring and inertia animations. Trying to animate ${keyframes$1}`);
            }
            mapPercentToKeyframes = pipe(percentToProgress, mix(keyframes$1[0], keyframes$1[1]));
            keyframes$1 = [0, 100];
        }
        const generator = generatorFactory({ ...this.options, keyframes: keyframes$1 });
        /**
         * If we have a mirror repeat type we need to create a second generator that outputs the
         * mirrored (not reversed) animation and later ping pong between the two generators.
         */
        if (repeatType === "mirror") {
            mirroredGenerator = generatorFactory({
                ...this.options,
                keyframes: [...keyframes$1].reverse(),
                velocity: -velocity,
            });
        }
        /**
         * If duration is undefined and we have repeat options,
         * we need to calculate a duration from the generator.
         *
         * We set it to the generator itself to cache the duration.
         * Any timeline resolver will need to have already precalculated
         * the duration by this step.
         */
        if (generator.calculatedDuration === null) {
            generator.calculatedDuration = calcGeneratorDuration(generator);
        }
        const { calculatedDuration } = generator;
        const resolvedDuration = calculatedDuration + repeatDelay;
        const totalDuration = resolvedDuration * (repeat + 1) - repeatDelay;
        return {
            generator,
            mirroredGenerator,
            mapPercentToKeyframes,
            calculatedDuration,
            resolvedDuration,
            totalDuration,
        };
    }
    onPostResolved() {
        const { autoplay = true } = this.options;
        this.play();
        if (this.pendingPlayState === "paused" || !autoplay) {
            this.pause();
        }
        else {
            this.state = this.pendingPlayState;
        }
    }
    tick(timestamp, sample = false) {
        const { resolved } = this;
        // If the animations has failed to resolve, return the final keyframe.
        if (!resolved) {
            const { keyframes } = this.options;
            return { done: true, value: keyframes[keyframes.length - 1] };
        }
        const { finalKeyframe, generator, mirroredGenerator, mapPercentToKeyframes, keyframes, calculatedDuration, totalDuration, resolvedDuration, } = resolved;
        if (this.startTime === null)
            return generator.next(0);
        const { delay, repeat, repeatType, repeatDelay, onUpdate } = this.options;
        /**
         * requestAnimationFrame timestamps can come through as lower than
         * the startTime as set by performance.now(). Here we prevent this,
         * though in the future it could be possible to make setting startTime
         * a pending operation that gets resolved here.
         */
        if (this.speed > 0) {
            this.startTime = Math.min(this.startTime, timestamp);
        }
        else if (this.speed < 0) {
            this.startTime = Math.min(timestamp - totalDuration / this.speed, this.startTime);
        }
        // Update currentTime
        if (sample) {
            this.currentTime = timestamp;
        }
        else if (this.holdTime !== null) {
            this.currentTime = this.holdTime;
        }
        else {
            // Rounding the time because floating point arithmetic is not always accurate, e.g. 3000.367 - 1000.367 =
            // 2000.0000000000002. This is a problem when we are comparing the currentTime with the duration, for
            // example.
            this.currentTime =
                Math.round(timestamp - this.startTime) * this.speed;
        }
        // Rebase on delay
        const timeWithoutDelay = this.currentTime - delay * (this.speed >= 0 ? 1 : -1);
        const isInDelayPhase = this.speed >= 0
            ? timeWithoutDelay < 0
            : timeWithoutDelay > totalDuration;
        this.currentTime = Math.max(timeWithoutDelay, 0);
        // If this animation has finished, set the current time  to the total duration.
        if (this.state === "finished" && this.holdTime === null) {
            this.currentTime = totalDuration;
        }
        let elapsed = this.currentTime;
        let frameGenerator = generator;
        if (repeat) {
            /**
             * Get the current progress (0-1) of the animation. If t is >
             * than duration we'll get values like 2.5 (midway through the
             * third iteration)
             */
            const progress = Math.min(this.currentTime, totalDuration) / resolvedDuration;
            /**
             * Get the current iteration (0 indexed). For instance the floor of
             * 2.5 is 2.
             */
            let currentIteration = Math.floor(progress);
            /**
             * Get the current progress of the iteration by taking the remainder
             * so 2.5 is 0.5 through iteration 2
             */
            let iterationProgress = progress % 1.0;
            /**
             * If iteration progress is 1 we count that as the end
             * of the previous iteration.
             */
            if (!iterationProgress && progress >= 1) {
                iterationProgress = 1;
            }
            iterationProgress === 1 && currentIteration--;
            currentIteration = Math.min(currentIteration, repeat + 1);
            /**
             * Reverse progress if we're not running in "normal" direction
             */
            const isOddIteration = Boolean(currentIteration % 2);
            if (isOddIteration) {
                if (repeatType === "reverse") {
                    iterationProgress = 1 - iterationProgress;
                    if (repeatDelay) {
                        iterationProgress -= repeatDelay / resolvedDuration;
                    }
                }
                else if (repeatType === "mirror") {
                    frameGenerator = mirroredGenerator;
                }
            }
            elapsed = clamp(0, 1, iterationProgress) * resolvedDuration;
        }
        /**
         * If we're in negative time, set state as the initial keyframe.
         * This prevents delay: x, duration: 0 animations from finishing
         * instantly.
         */
        const state = isInDelayPhase
            ? { done: false, value: keyframes[0] }
            : frameGenerator.next(elapsed);
        if (mapPercentToKeyframes) {
            state.value = mapPercentToKeyframes(state.value);
        }
        let { done } = state;
        if (!isInDelayPhase && calculatedDuration !== null) {
            done =
                this.speed >= 0
                    ? this.currentTime >= totalDuration
                    : this.currentTime <= 0;
        }
        const isAnimationFinished = this.holdTime === null &&
            (this.state === "finished" || (this.state === "running" && done));
        if (isAnimationFinished && finalKeyframe !== undefined) {
            state.value = getFinalKeyframe(keyframes, this.options, finalKeyframe);
        }
        if (onUpdate) {
            onUpdate(state.value);
        }
        if (isAnimationFinished) {
            this.finish();
        }
        return state;
    }
    get duration() {
        const { resolved } = this;
        return resolved ? millisecondsToSeconds(resolved.calculatedDuration) : 0;
    }
    get time() {
        return millisecondsToSeconds(this.currentTime);
    }
    set time(newTime) {
        newTime = secondsToMilliseconds(newTime);
        this.currentTime = newTime;
        if (this.holdTime !== null || this.speed === 0) {
            this.holdTime = newTime;
        }
        else if (this.driver) {
            this.startTime = this.driver.now() - newTime / this.speed;
        }
    }
    get speed() {
        return this.playbackSpeed;
    }
    set speed(newSpeed) {
        const hasChanged = this.playbackSpeed !== newSpeed;
        this.playbackSpeed = newSpeed;
        if (hasChanged) {
            this.time = millisecondsToSeconds(this.currentTime);
        }
    }
    play() {
        if (!this.resolver.isScheduled) {
            this.resolver.resume();
        }
        if (!this._resolved) {
            this.pendingPlayState = "running";
            return;
        }
        if (this.isStopped)
            return;
        const { driver = frameloopDriver, onPlay, startTime } = this.options;
        if (!this.driver) {
            this.driver = driver((timestamp) => this.tick(timestamp));
        }
        onPlay && onPlay();
        const now = this.driver.now();
        if (this.holdTime !== null) {
            this.startTime = now - this.holdTime;
        }
        else if (!this.startTime) {
            this.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
        }
        else if (this.state === "finished") {
            this.startTime = now;
        }
        if (this.state === "finished") {
            this.updateFinishedPromise();
        }
        this.cancelTime = this.startTime;
        this.holdTime = null;
        /**
         * Set playState to running only after we've used it in
         * the previous logic.
         */
        this.state = "running";
        this.driver.start();
    }
    pause() {
        var _a;
        if (!this._resolved) {
            this.pendingPlayState = "paused";
            return;
        }
        this.state = "paused";
        this.holdTime = (_a = this.currentTime) !== null && _a !== void 0 ? _a : 0;
    }
    complete() {
        if (this.state !== "running") {
            this.play();
        }
        this.pendingPlayState = this.state = "finished";
        this.holdTime = null;
    }
    finish() {
        this.teardown();
        this.state = "finished";
        const { onComplete } = this.options;
        onComplete && onComplete();
    }
    cancel() {
        if (this.cancelTime !== null) {
            this.tick(this.cancelTime);
        }
        this.teardown();
        this.updateFinishedPromise();
    }
    teardown() {
        this.state = "idle";
        this.stopDriver();
        this.resolveFinishedPromise();
        this.updateFinishedPromise();
        this.startTime = this.cancelTime = null;
        this.resolver.cancel();
    }
    stopDriver() {
        if (!this.driver)
            return;
        this.driver.stop();
        this.driver = undefined;
    }
    sample(time) {
        this.startTime = 0;
        return this.tick(time, true);
    }
}

/**
 * A list of values that can be hardware-accelerated.
 */
const acceleratedValues = new Set([
    "opacity",
    "clipPath",
    "filter",
    "transform",
    // TODO: Can be accelerated but currently disabled until https://issues.chromium.org/issues/41491098 is resolved
    // or until we implement support for linear() easing.
    // "background-color"
]);

// Create a linear easing point for every 10 ms
const resolution = 10;
const generateLinearEasing = (easing, duration // as milliseconds
) => {
    let points = "";
    const numPoints = Math.max(Math.round(duration / resolution), 2);
    for (let i = 0; i < numPoints; i++) {
        points += easing(progress(0, numPoints - 1, i)) + ", ";
    }
    return `linear(${points.substring(0, points.length - 2)})`;
};

function memo(callback) {
    let result;
    return () => {
        if (result === undefined)
            result = callback();
        return result;
    };
}

/**
 * Add the ability for test suites to manually set support flags
 * to better test more environments.
 */
const supportsFlags = {
    linearEasing: undefined,
};

function memoSupports(callback, supportsFlag) {
    const memoized = memo(callback);
    return () => { var _a; return (_a = supportsFlags[supportsFlag]) !== null && _a !== void 0 ? _a : memoized(); };
}

const supportsLinearEasing = /*@__PURE__*/ memoSupports(() => {
    try {
        document
            .createElement("div")
            .animate({ opacity: 0 }, { easing: "linear(0, 1)" });
    }
    catch (e) {
        return false;
    }
    return true;
}, "linearEasing");

function isWaapiSupportedEasing(easing) {
    return Boolean((typeof easing === "function" && supportsLinearEasing()) ||
        !easing ||
        (typeof easing === "string" &&
            (easing in supportedWaapiEasing || supportsLinearEasing())) ||
        isBezierDefinition(easing) ||
        (Array.isArray(easing) && easing.every(isWaapiSupportedEasing)));
}
const cubicBezierAsString = ([a, b, c, d]) => `cubic-bezier(${a}, ${b}, ${c}, ${d})`;
const supportedWaapiEasing = {
    linear: "linear",
    ease: "ease",
    easeIn: "ease-in",
    easeOut: "ease-out",
    easeInOut: "ease-in-out",
    circIn: /*@__PURE__*/ cubicBezierAsString([0, 0.65, 0.55, 1]),
    circOut: /*@__PURE__*/ cubicBezierAsString([0.55, 0, 1, 0.45]),
    backIn: /*@__PURE__*/ cubicBezierAsString([0.31, 0.01, 0.66, -0.59]),
    backOut: /*@__PURE__*/ cubicBezierAsString([0.33, 1.53, 0.69, 0.99]),
};
function mapEasingToNativeEasing(easing, duration) {
    if (!easing) {
        return undefined;
    }
    else if (typeof easing === "function" && supportsLinearEasing()) {
        return generateLinearEasing(easing, duration);
    }
    else if (isBezierDefinition(easing)) {
        return cubicBezierAsString(easing);
    }
    else if (Array.isArray(easing)) {
        return easing.map((segmentEasing) => mapEasingToNativeEasing(segmentEasing, duration) ||
            supportedWaapiEasing.easeOut);
    }
    else {
        return supportedWaapiEasing[easing];
    }
}

function startWaapiAnimation(element, valueName, keyframes, { delay = 0, duration = 300, repeat = 0, repeatType = "loop", ease, times, } = {}) {
    const keyframeOptions = { [valueName]: keyframes };
    if (times)
        keyframeOptions.offset = times;
    const easing = mapEasingToNativeEasing(ease, duration);
    /**
     * If this is an easing array, apply to keyframes, not animation as a whole
     */
    if (Array.isArray(easing))
        keyframeOptions.easing = easing;
    return element.animate(keyframeOptions, {
        delay,
        duration,
        easing: !Array.isArray(easing) ? easing : "linear",
        fill: "both",
        iterations: repeat + 1,
        direction: repeatType === "reverse" ? "alternate" : "normal",
    });
}

function attachTimeline(animation, timeline) {
    animation.timeline = timeline;
    animation.onfinish = null;
}

const supportsWaapi = /*@__PURE__*/ memo(() => Object.hasOwnProperty.call(Element.prototype, "animate"));

/**
 * 10ms is chosen here as it strikes a balance between smooth
 * results (more than one keyframe per frame at 60fps) and
 * keyframe quantity.
 */
const sampleDelta = 10; //ms
/**
 * Implement a practical max duration for keyframe generation
 * to prevent infinite loops
 */
const maxDuration = 20000;
/**
 * Check if an animation can run natively via WAAPI or requires pregenerated keyframes.
 * WAAPI doesn't support spring or function easings so we run these as JS animation before
 * handing off.
 */
function requiresPregeneratedKeyframes(options) {
    return (isGenerator(options.type) ||
        options.type === "spring" ||
        !isWaapiSupportedEasing(options.ease));
}
function pregenerateKeyframes(keyframes, options) {
    /**
     * Create a main-thread animation to pregenerate keyframes.
     * We sample this at regular intervals to generate keyframes that we then
     * linearly interpolate between.
     */
    const sampleAnimation = new MainThreadAnimation({
        ...options,
        keyframes,
        repeat: 0,
        delay: 0,
        isGenerator: true,
    });
    let state = { done: false, value: keyframes[0] };
    const pregeneratedKeyframes = [];
    /**
     * Bail after 20 seconds of pre-generated keyframes as it's likely
     * we're heading for an infinite loop.
     */
    let t = 0;
    while (!state.done && t < maxDuration) {
        state = sampleAnimation.sample(t);
        pregeneratedKeyframes.push(state.value);
        t += sampleDelta;
    }
    return {
        times: undefined,
        keyframes: pregeneratedKeyframes,
        duration: t - sampleDelta,
        ease: "linear",
    };
}
const unsupportedEasingFunctions = {
    anticipate,
    backInOut,
    circInOut,
};
function isUnsupportedEase(key) {
    return key in unsupportedEasingFunctions;
}
class AcceleratedAnimation extends BaseAnimation {
    constructor(options) {
        super(options);
        const { name, motionValue, element, keyframes } = this.options;
        this.resolver = new DOMKeyframesResolver(keyframes, (resolvedKeyframes, finalKeyframe) => this.onKeyframesResolved(resolvedKeyframes, finalKeyframe), name, motionValue, element);
        this.resolver.scheduleResolve();
    }
    initPlayback(keyframes, finalKeyframe) {
        var _a;
        let { duration = 300, times, ease, type, motionValue, name, startTime, } = this.options;
        /**
         * If element has since been unmounted, return false to indicate
         * the animation failed to initialised.
         */
        if (!((_a = motionValue.owner) === null || _a === void 0 ? void 0 : _a.current)) {
            return false;
        }
        /**
         * If the user has provided an easing function name that isn't supported
         * by WAAPI (like "anticipate"), we need to provide the corressponding
         * function. This will later get converted to a linear() easing function.
         */
        if (typeof ease === "string" &&
            supportsLinearEasing() &&
            isUnsupportedEase(ease)) {
            ease = unsupportedEasingFunctions[ease];
        }
        /**
         * If this animation needs pre-generated keyframes then generate.
         */
        if (requiresPregeneratedKeyframes(this.options)) {
            const { onComplete, onUpdate, motionValue, element, ...options } = this.options;
            const pregeneratedAnimation = pregenerateKeyframes(keyframes, options);
            keyframes = pregeneratedAnimation.keyframes;
            // If this is a very short animation, ensure we have
            // at least two keyframes to animate between as older browsers
            // can't animate between a single keyframe.
            if (keyframes.length === 1) {
                keyframes[1] = keyframes[0];
            }
            duration = pregeneratedAnimation.duration;
            times = pregeneratedAnimation.times;
            ease = pregeneratedAnimation.ease;
            type = "keyframes";
        }
        const animation = startWaapiAnimation(motionValue.owner.current, name, keyframes, { ...this.options, duration, times, ease });
        // Override the browser calculated startTime with one synchronised to other JS
        // and WAAPI animations starting this event loop.
        animation.startTime = startTime !== null && startTime !== void 0 ? startTime : this.calcStartTime();
        if (this.pendingTimeline) {
            attachTimeline(animation, this.pendingTimeline);
            this.pendingTimeline = undefined;
        }
        else {
            /**
             * Prefer the `onfinish` prop as it's more widely supported than
             * the `finished` promise.
             *
             * Here, we synchronously set the provided MotionValue to the end
             * keyframe. If we didn't, when the WAAPI animation is finished it would
             * be removed from the element which would then revert to its old styles.
             */
            animation.onfinish = () => {
                const { onComplete } = this.options;
                motionValue.set(getFinalKeyframe(keyframes, this.options, finalKeyframe));
                onComplete && onComplete();
                this.cancel();
                this.resolveFinishedPromise();
            };
        }
        return {
            animation,
            duration,
            times,
            type,
            ease,
            keyframes: keyframes,
        };
    }
    get duration() {
        const { resolved } = this;
        if (!resolved)
            return 0;
        const { duration } = resolved;
        return millisecondsToSeconds(duration);
    }
    get time() {
        const { resolved } = this;
        if (!resolved)
            return 0;
        const { animation } = resolved;
        return millisecondsToSeconds(animation.currentTime || 0);
    }
    set time(newTime) {
        const { resolved } = this;
        if (!resolved)
            return;
        const { animation } = resolved;
        animation.currentTime = secondsToMilliseconds(newTime);
    }
    get speed() {
        const { resolved } = this;
        if (!resolved)
            return 1;
        const { animation } = resolved;
        return animation.playbackRate;
    }
    set speed(newSpeed) {
        const { resolved } = this;
        if (!resolved)
            return;
        const { animation } = resolved;
        animation.playbackRate = newSpeed;
    }
    get state() {
        const { resolved } = this;
        if (!resolved)
            return "idle";
        const { animation } = resolved;
        return animation.playState;
    }
    get startTime() {
        const { resolved } = this;
        if (!resolved)
            return null;
        const { animation } = resolved;
        // Coerce to number as TypeScript incorrectly types this
        // as CSSNumberish
        return animation.startTime;
    }
    /**
     * Replace the default DocumentTimeline with another AnimationTimeline.
     * Currently used for scroll animations.
     */
    attachTimeline(timeline) {
        if (!this._resolved) {
            this.pendingTimeline = timeline;
        }
        else {
            const { resolved } = this;
            if (!resolved)
                return noop$1;
            const { animation } = resolved;
            attachTimeline(animation, timeline);
        }
        return noop$1;
    }
    play() {
        if (this.isStopped)
            return;
        const { resolved } = this;
        if (!resolved)
            return;
        const { animation } = resolved;
        if (animation.playState === "finished") {
            this.updateFinishedPromise();
        }
        animation.play();
    }
    pause() {
        const { resolved } = this;
        if (!resolved)
            return;
        const { animation } = resolved;
        animation.pause();
    }
    stop() {
        this.resolver.cancel();
        this.isStopped = true;
        if (this.state === "idle")
            return;
        this.resolveFinishedPromise();
        this.updateFinishedPromise();
        const { resolved } = this;
        if (!resolved)
            return;
        const { animation, keyframes, duration, type, ease, times } = resolved;
        if (animation.playState === "idle" ||
            animation.playState === "finished") {
            return;
        }
        /**
         * WAAPI doesn't natively have any interruption capabilities.
         *
         * Rather than read commited styles back out of the DOM, we can
         * create a renderless JS animation and sample it twice to calculate
         * its current value, "previous" value, and therefore allow
         * Motion to calculate velocity for any subsequent animation.
         */
        if (this.time) {
            const { motionValue, onUpdate, onComplete, element, ...options } = this.options;
            const sampleAnimation = new MainThreadAnimation({
                ...options,
                keyframes,
                duration,
                type,
                ease,
                times,
                isGenerator: true,
            });
            const sampleTime = secondsToMilliseconds(this.time);
            motionValue.setWithVelocity(sampleAnimation.sample(sampleTime - sampleDelta).value, sampleAnimation.sample(sampleTime).value, sampleDelta);
        }
        const { onStop } = this.options;
        onStop && onStop();
        this.cancel();
    }
    complete() {
        const { resolved } = this;
        if (!resolved)
            return;
        resolved.animation.finish();
    }
    cancel() {
        const { resolved } = this;
        if (!resolved)
            return;
        resolved.animation.cancel();
    }
    static supports(options) {
        const { motionValue, name, repeatDelay, repeatType, damping, type } = options;
        return (supportsWaapi() &&
            name &&
            acceleratedValues.has(name) &&
            motionValue &&
            motionValue.owner &&
            motionValue.owner.current instanceof HTMLElement &&
            /**
             * If we're outputting values to onUpdate then we can't use WAAPI as there's
             * no way to read the value from WAAPI every frame.
             */
            !motionValue.owner.getProps().onUpdate &&
            !repeatDelay &&
            repeatType !== "mirror" &&
            damping !== 0 &&
            type !== "inertia");
    }
}

const supportsScrollTimeline = memo(() => window.ScrollTimeline !== undefined);

class GroupPlaybackControls {
    constructor(animations) {
        // Bound to accomodate common `return animation.stop` pattern
        this.stop = () => this.runAll("stop");
        this.animations = animations.filter(Boolean);
    }
    then(onResolve, onReject) {
        return Promise.all(this.animations).then(onResolve).catch(onReject);
    }
    /**
     * TODO: Filter out cancelled or stopped animations before returning
     */
    getAll(propName) {
        return this.animations[0][propName];
    }
    setAll(propName, newValue) {
        for (let i = 0; i < this.animations.length; i++) {
            this.animations[i][propName] = newValue;
        }
    }
    attachTimeline(timeline, fallback) {
        const subscriptions = this.animations.map((animation) => {
            if (supportsScrollTimeline() && animation.attachTimeline) {
                return animation.attachTimeline(timeline);
            }
            else {
                return fallback(animation);
            }
        });
        return () => {
            subscriptions.forEach((cancel, i) => {
                cancel && cancel();
                this.animations[i].stop();
            });
        };
    }
    get time() {
        return this.getAll("time");
    }
    set time(time) {
        this.setAll("time", time);
    }
    get speed() {
        return this.getAll("speed");
    }
    set speed(speed) {
        this.setAll("speed", speed);
    }
    get startTime() {
        return this.getAll("startTime");
    }
    get duration() {
        let max = 0;
        for (let i = 0; i < this.animations.length; i++) {
            max = Math.max(max, this.animations[i].duration);
        }
        return max;
    }
    runAll(methodName) {
        this.animations.forEach((controls) => controls[methodName]());
    }
    play() {
        this.runAll("play");
    }
    pause() {
        this.runAll("pause");
    }
    cancel() {
        this.runAll("cancel");
    }
    complete() {
        this.runAll("complete");
    }
}

/**
 * Decide whether a transition is defined on a given Transition.
 * This filters out orchestration options and returns true
 * if any options are left.
 */
function isTransitionDefined({ when, delay: _delay, delayChildren, staggerChildren, staggerDirection, repeat, repeatType, repeatDelay, from, elapsed, ...transition }) {
    return !!Object.keys(transition).length;
}

const animateMotionValue = (name, value, target, transition = {}, element, isHandoff) => (onComplete) => {
    const valueTransition = getValueTransition(transition, name) || {};
    /**
     * Most transition values are currently completely overwritten by value-specific
     * transitions. In the future it'd be nicer to blend these transitions. But for now
     * delay actually does inherit from the root transition if not value-specific.
     */
    const delay = valueTransition.delay || transition.delay || 0;
    /**
     * Elapsed isn't a public transition option but can be passed through from
     * optimized appear effects in milliseconds.
     */
    let { elapsed = 0 } = transition;
    elapsed = elapsed - secondsToMilliseconds(delay);
    let options = {
        keyframes: Array.isArray(target) ? target : [null, target],
        ease: "easeOut",
        velocity: value.getVelocity(),
        ...valueTransition,
        delay: -elapsed,
        onUpdate: (v) => {
            value.set(v);
            valueTransition.onUpdate && valueTransition.onUpdate(v);
        },
        onComplete: () => {
            onComplete();
            valueTransition.onComplete && valueTransition.onComplete();
        },
        name,
        motionValue: value,
        element: isHandoff ? undefined : element,
    };
    /**
     * If there's no transition defined for this value, we can generate
     * unqiue transition settings for this value.
     */
    if (!isTransitionDefined(valueTransition)) {
        options = {
            ...options,
            ...getDefaultTransition(name, options),
        };
    }
    /**
     * Both WAAPI and our internal animation functions use durations
     * as defined by milliseconds, while our external API defines them
     * as seconds.
     */
    if (options.duration) {
        options.duration = secondsToMilliseconds(options.duration);
    }
    if (options.repeatDelay) {
        options.repeatDelay = secondsToMilliseconds(options.repeatDelay);
    }
    if (options.from !== undefined) {
        options.keyframes[0] = options.from;
    }
    let shouldSkip = false;
    if (options.type === false ||
        (options.duration === 0 && !options.repeatDelay)) {
        options.duration = 0;
        if (options.delay === 0) {
            shouldSkip = true;
        }
    }
    /**
     * If we can or must skip creating the animation, and apply only
     * the final keyframe, do so. We also check once keyframes are resolved but
     * this early check prevents the need to create an animation at all.
     */
    if (shouldSkip && !isHandoff && value.get() !== undefined) {
        const finalKeyframe = getFinalKeyframe(options.keyframes, valueTransition);
        if (finalKeyframe !== undefined) {
            frame.update(() => {
                options.onUpdate(finalKeyframe);
                options.onComplete();
            });
            // We still want to return some animation controls here rather
            // than returning undefined
            return new GroupPlaybackControls([]);
        }
    }
    /**
     * Animate via WAAPI if possible. If this is a handoff animation, the optimised animation will be running via
     * WAAPI. Therefore, this animation must be JS to ensure it runs "under" the
     * optimised animation.
     */
    if (!isHandoff && AcceleratedAnimation.supports(options)) {
        return new AcceleratedAnimation(options);
    }
    else {
        return new MainThreadAnimation(options);
    }
};

const isCustomValue = (v) => {
    return Boolean(v && typeof v === "object" && v.mix && v.toValue);
};
const resolveFinalValueInKeyframes = (v) => {
    // TODO maybe throw if v.length - 1 is placeholder token?
    return isKeyframesTarget(v) ? v[v.length - 1] || 0 : v;
};

function addUniqueItem(arr, item) {
    if (arr.indexOf(item) === -1)
        arr.push(item);
}
function removeItem(arr, item) {
    const index = arr.indexOf(item);
    if (index > -1)
        arr.splice(index, 1);
}

class SubscriptionManager {
    constructor() {
        this.subscriptions = [];
    }
    add(handler) {
        addUniqueItem(this.subscriptions, handler);
        return () => removeItem(this.subscriptions, handler);
    }
    notify(a, b, c) {
        const numSubscriptions = this.subscriptions.length;
        if (!numSubscriptions)
            return;
        if (numSubscriptions === 1) {
            /**
             * If there's only a single handler we can just call it without invoking a loop.
             */
            this.subscriptions[0](a, b, c);
        }
        else {
            for (let i = 0; i < numSubscriptions; i++) {
                /**
                 * Check whether the handler exists before firing as it's possible
                 * the subscriptions were modified during this loop running.
                 */
                const handler = this.subscriptions[i];
                handler && handler(a, b, c);
            }
        }
    }
    getSize() {
        return this.subscriptions.length;
    }
    clear() {
        this.subscriptions.length = 0;
    }
}

/**
 * Maximum time between the value of two frames, beyond which we
 * assume the velocity has since been 0.
 */
const MAX_VELOCITY_DELTA = 30;
const isFloat = (value) => {
    return !isNaN(parseFloat(value));
};
/**
 * `MotionValue` is used to track the state and velocity of motion values.
 *
 * @public
 */
class MotionValue {
    /**
     * @param init - The initiating value
     * @param config - Optional configuration options
     *
     * -  `transformer`: A function to transform incoming values with.
     *
     * @internal
     */
    constructor(init, options = {}) {
        /**
         * This will be replaced by the build step with the latest version number.
         * When MotionValues are provided to motion components, warn if versions are mixed.
         */
        this.version = "11.11.11";
        /**
         * Tracks whether this value can output a velocity. Currently this is only true
         * if the value is numerical, but we might be able to widen the scope here and support
         * other value types.
         *
         * @internal
         */
        this.canTrackVelocity = null;
        /**
         * An object containing a SubscriptionManager for each active event.
         */
        this.events = {};
        this.updateAndNotify = (v, render = true) => {
            const currentTime = time.now();
            /**
             * If we're updating the value during another frame or eventloop
             * than the previous frame, then the we set the previous frame value
             * to current.
             */
            if (this.updatedAt !== currentTime) {
                this.setPrevFrameValue();
            }
            this.prev = this.current;
            this.setCurrent(v);
            // Update update subscribers
            if (this.current !== this.prev && this.events.change) {
                this.events.change.notify(this.current);
            }
            // Update render subscribers
            if (render && this.events.renderRequest) {
                this.events.renderRequest.notify(this.current);
            }
        };
        this.hasAnimated = false;
        this.setCurrent(init);
        this.owner = options.owner;
    }
    setCurrent(current) {
        this.current = current;
        this.updatedAt = time.now();
        if (this.canTrackVelocity === null && current !== undefined) {
            this.canTrackVelocity = isFloat(this.current);
        }
    }
    setPrevFrameValue(prevFrameValue = this.current) {
        this.prevFrameValue = prevFrameValue;
        this.prevUpdatedAt = this.updatedAt;
    }
    /**
     * Adds a function that will be notified when the `MotionValue` is updated.
     *
     * It returns a function that, when called, will cancel the subscription.
     *
     * When calling `onChange` inside a React component, it should be wrapped with the
     * `useEffect` hook. As it returns an unsubscribe function, this should be returned
     * from the `useEffect` function to ensure you don't add duplicate subscribers..
     *
     * ```jsx
     * export const MyComponent = () => {
     *   const x = useMotionValue(0)
     *   const y = useMotionValue(0)
     *   const opacity = useMotionValue(1)
     *
     *   useEffect(() => {
     *     function updateOpacity() {
     *       const maxXY = Math.max(x.get(), y.get())
     *       const newOpacity = transform(maxXY, [0, 100], [1, 0])
     *       opacity.set(newOpacity)
     *     }
     *
     *     const unsubscribeX = x.on("change", updateOpacity)
     *     const unsubscribeY = y.on("change", updateOpacity)
     *
     *     return () => {
     *       unsubscribeX()
     *       unsubscribeY()
     *     }
     *   }, [])
     *
     *   return <motion.div style={{ x }} />
     * }
     * ```
     *
     * @param subscriber - A function that receives the latest value.
     * @returns A function that, when called, will cancel this subscription.
     *
     * @deprecated
     */
    onChange(subscription) {
        if (process.env.NODE_ENV !== "production") {
            warnOnce(false, `value.onChange(callback) is deprecated. Switch to value.on("change", callback).`);
        }
        return this.on("change", subscription);
    }
    on(eventName, callback) {
        if (!this.events[eventName]) {
            this.events[eventName] = new SubscriptionManager();
        }
        const unsubscribe = this.events[eventName].add(callback);
        if (eventName === "change") {
            return () => {
                unsubscribe();
                /**
                 * If we have no more change listeners by the start
                 * of the next frame, stop active animations.
                 */
                frame.read(() => {
                    if (!this.events.change.getSize()) {
                        this.stop();
                    }
                });
            };
        }
        return unsubscribe;
    }
    clearListeners() {
        for (const eventManagers in this.events) {
            this.events[eventManagers].clear();
        }
    }
    /**
     * Attaches a passive effect to the `MotionValue`.
     *
     * @internal
     */
    attach(passiveEffect, stopPassiveEffect) {
        this.passiveEffect = passiveEffect;
        this.stopPassiveEffect = stopPassiveEffect;
    }
    /**
     * Sets the state of the `MotionValue`.
     *
     * @remarks
     *
     * ```jsx
     * const x = useMotionValue(0)
     * x.set(10)
     * ```
     *
     * @param latest - Latest value to set.
     * @param render - Whether to notify render subscribers. Defaults to `true`
     *
     * @public
     */
    set(v, render = true) {
        if (!render || !this.passiveEffect) {
            this.updateAndNotify(v, render);
        }
        else {
            this.passiveEffect(v, this.updateAndNotify);
        }
    }
    setWithVelocity(prev, current, delta) {
        this.set(current);
        this.prev = undefined;
        this.prevFrameValue = prev;
        this.prevUpdatedAt = this.updatedAt - delta;
    }
    /**
     * Set the state of the `MotionValue`, stopping any active animations,
     * effects, and resets velocity to `0`.
     */
    jump(v, endAnimation = true) {
        this.updateAndNotify(v);
        this.prev = v;
        this.prevUpdatedAt = this.prevFrameValue = undefined;
        endAnimation && this.stop();
        if (this.stopPassiveEffect)
            this.stopPassiveEffect();
    }
    /**
     * Returns the latest state of `MotionValue`
     *
     * @returns - The latest state of `MotionValue`
     *
     * @public
     */
    get() {
        return this.current;
    }
    /**
     * @public
     */
    getPrevious() {
        return this.prev;
    }
    /**
     * Returns the latest velocity of `MotionValue`
     *
     * @returns - The latest velocity of `MotionValue`. Returns `0` if the state is non-numerical.
     *
     * @public
     */
    getVelocity() {
        const currentTime = time.now();
        if (!this.canTrackVelocity ||
            this.prevFrameValue === undefined ||
            currentTime - this.updatedAt > MAX_VELOCITY_DELTA) {
            return 0;
        }
        const delta = Math.min(this.updatedAt - this.prevUpdatedAt, MAX_VELOCITY_DELTA);
        // Casts because of parseFloat's poor typing
        return velocityPerSecond(parseFloat(this.current) -
            parseFloat(this.prevFrameValue), delta);
    }
    /**
     * Registers a new animation to control this `MotionValue`. Only one
     * animation can drive a `MotionValue` at one time.
     *
     * ```jsx
     * value.start()
     * ```
     *
     * @param animation - A function that starts the provided animation
     *
     * @internal
     */
    start(startAnimation) {
        this.stop();
        return new Promise((resolve) => {
            this.hasAnimated = true;
            this.animation = startAnimation(resolve);
            if (this.events.animationStart) {
                this.events.animationStart.notify();
            }
        }).then(() => {
            if (this.events.animationComplete) {
                this.events.animationComplete.notify();
            }
            this.clearAnimation();
        });
    }
    /**
     * Stop the currently active animation.
     *
     * @public
     */
    stop() {
        if (this.animation) {
            this.animation.stop();
            if (this.events.animationCancel) {
                this.events.animationCancel.notify();
            }
        }
        this.clearAnimation();
    }
    /**
     * Returns `true` if this value is currently animating.
     *
     * @public
     */
    isAnimating() {
        return !!this.animation;
    }
    clearAnimation() {
        delete this.animation;
    }
    /**
     * Destroy and clean up subscribers to this `MotionValue`.
     *
     * The `MotionValue` hooks like `useMotionValue` and `useTransform` automatically
     * handle the lifecycle of the returned `MotionValue`, so this method is only necessary if you've manually
     * created a `MotionValue` via the `motionValue` function.
     *
     * @public
     */
    destroy() {
        this.clearListeners();
        this.stop();
        if (this.stopPassiveEffect) {
            this.stopPassiveEffect();
        }
    }
}
function motionValue(init, options) {
    return new MotionValue(init, options);
}

/**
 * Set VisualElement's MotionValue, creating a new MotionValue for it if
 * it doesn't exist.
 */
function setMotionValue(visualElement, key, value) {
    if (visualElement.hasValue(key)) {
        visualElement.getValue(key).set(value);
    }
    else {
        visualElement.addValue(key, motionValue(value));
    }
}
function setTarget(visualElement, definition) {
    const resolved = resolveVariant(visualElement, definition);
    let { transitionEnd = {}, transition = {}, ...target } = resolved || {};
    target = { ...target, ...transitionEnd };
    for (const key in target) {
        const value = resolveFinalValueInKeyframes(target[key]);
        setMotionValue(visualElement, key, value);
    }
}

/**
 * Convert camelCase to dash-case properties.
 */
const camelToDash = (str) => str.replace(/([a-z])([A-Z])/gu, "$1-$2").toLowerCase();

const optimizedAppearDataId = "framerAppearId";
const optimizedAppearDataAttribute = "data-" + camelToDash(optimizedAppearDataId);

function getOptimisedAppearId(visualElement) {
    return visualElement.props[optimizedAppearDataAttribute];
}

const isMotionValue = (value) => Boolean(value && value.getVelocity);

function isWillChangeMotionValue(value) {
    return Boolean(isMotionValue(value) && value.add);
}

function addValueToWillChange(visualElement, key) {
    const willChange = visualElement.getValue("willChange");
    /**
     * It could be that a user has set willChange to a regular MotionValue,
     * in which case we can't add the value to it.
     */
    if (isWillChangeMotionValue(willChange)) {
        return willChange.add(key);
    }
}

/**
 * Decide whether we should block this animation. Previously, we achieved this
 * just by checking whether the key was listed in protectedKeys, but this
 * posed problems if an animation was triggered by afterChildren and protectedKeys
 * had been set to true in the meantime.
 */
function shouldBlockAnimation({ protectedKeys, needsAnimating }, key) {
    const shouldBlock = protectedKeys.hasOwnProperty(key) && needsAnimating[key] !== true;
    needsAnimating[key] = false;
    return shouldBlock;
}
function animateTarget(visualElement, targetAndTransition, { delay = 0, transitionOverride, type } = {}) {
    var _a;
    let { transition = visualElement.getDefaultTransition(), transitionEnd, ...target } = targetAndTransition;
    if (transitionOverride)
        transition = transitionOverride;
    const animations = [];
    const animationTypeState = type &&
        visualElement.animationState &&
        visualElement.animationState.getState()[type];
    for (const key in target) {
        const value = visualElement.getValue(key, (_a = visualElement.latestValues[key]) !== null && _a !== void 0 ? _a : null);
        const valueTarget = target[key];
        if (valueTarget === undefined ||
            (animationTypeState &&
                shouldBlockAnimation(animationTypeState, key))) {
            continue;
        }
        const valueTransition = {
            delay,
            ...getValueTransition(transition || {}, key),
        };
        /**
         * If this is the first time a value is being animated, check
         * to see if we're handling off from an existing animation.
         */
        let isHandoff = false;
        if (window.MotionHandoffAnimation) {
            const appearId = getOptimisedAppearId(visualElement);
            if (appearId) {
                const startTime = window.MotionHandoffAnimation(appearId, key, frame);
                if (startTime !== null) {
                    valueTransition.startTime = startTime;
                    isHandoff = true;
                }
            }
        }
        addValueToWillChange(visualElement, key);
        value.start(animateMotionValue(key, value, valueTarget, visualElement.shouldReduceMotion && transformProps.has(key)
            ? { type: false }
            : valueTransition, visualElement, isHandoff));
        const animation = value.animation;
        if (animation) {
            animations.push(animation);
        }
    }
    if (transitionEnd) {
        Promise.all(animations).then(() => {
            frame.update(() => {
                transitionEnd && setTarget(visualElement, transitionEnd);
            });
        });
    }
    return animations;
}

function animateVariant(visualElement, variant, options = {}) {
    var _a;
    const resolved = resolveVariant(visualElement, variant, options.type === "exit"
        ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom
        : undefined);
    let { transition = visualElement.getDefaultTransition() || {} } = resolved || {};
    if (options.transitionOverride) {
        transition = options.transitionOverride;
    }
    /**
     * If we have a variant, create a callback that runs it as an animation.
     * Otherwise, we resolve a Promise immediately for a composable no-op.
     */
    const getAnimation = resolved
        ? () => Promise.all(animateTarget(visualElement, resolved, options))
        : () => Promise.resolve();
    /**
     * If we have children, create a callback that runs all their animations.
     * Otherwise, we resolve a Promise immediately for a composable no-op.
     */
    const getChildAnimations = visualElement.variantChildren && visualElement.variantChildren.size
        ? (forwardDelay = 0) => {
            const { delayChildren = 0, staggerChildren, staggerDirection, } = transition;
            return animateChildren(visualElement, variant, delayChildren + forwardDelay, staggerChildren, staggerDirection, options);
        }
        : () => Promise.resolve();
    /**
     * If the transition explicitly defines a "when" option, we need to resolve either
     * this animation or all children animations before playing the other.
     */
    const { when } = transition;
    if (when) {
        const [first, last] = when === "beforeChildren"
            ? [getAnimation, getChildAnimations]
            : [getChildAnimations, getAnimation];
        return first().then(() => last());
    }
    else {
        return Promise.all([getAnimation(), getChildAnimations(options.delay)]);
    }
}
function animateChildren(visualElement, variant, delayChildren = 0, staggerChildren = 0, staggerDirection = 1, options) {
    const animations = [];
    const maxStaggerDuration = (visualElement.variantChildren.size - 1) * staggerChildren;
    const generateStaggerDuration = staggerDirection === 1
        ? (i = 0) => i * staggerChildren
        : (i = 0) => maxStaggerDuration - i * staggerChildren;
    Array.from(visualElement.variantChildren)
        .sort(sortByTreeOrder)
        .forEach((child, i) => {
        child.notify("AnimationStart", variant);
        animations.push(animateVariant(child, variant, {
            ...options,
            delay: delayChildren + generateStaggerDuration(i),
        }).then(() => child.notify("AnimationComplete", variant)));
    });
    return Promise.all(animations);
}
function sortByTreeOrder(a, b) {
    return a.sortNodePosition(b);
}

function animateVisualElement(visualElement, definition, options = {}) {
    visualElement.notify("AnimationStart", definition);
    let animation;
    if (Array.isArray(definition)) {
        const animations = definition.map((variant) => animateVariant(visualElement, variant, options));
        animation = Promise.all(animations);
    }
    else if (typeof definition === "string") {
        animation = animateVariant(visualElement, definition, options);
    }
    else {
        const resolvedDefinition = typeof definition === "function"
            ? resolveVariant(visualElement, definition, options.custom)
            : definition;
        animation = Promise.all(animateTarget(visualElement, resolvedDefinition, options));
    }
    return animation.then(() => {
        visualElement.notify("AnimationComplete", definition);
    });
}

const numVariantProps = variantProps.length;
function getVariantContext(visualElement) {
    if (!visualElement)
        return undefined;
    if (!visualElement.isControllingVariants) {
        const context = visualElement.parent
            ? getVariantContext(visualElement.parent) || {}
            : {};
        if (visualElement.props.initial !== undefined) {
            context.initial = visualElement.props.initial;
        }
        return context;
    }
    const context = {};
    for (let i = 0; i < numVariantProps; i++) {
        const name = variantProps[i];
        const prop = visualElement.props[name];
        if (isVariantLabel(prop) || prop === false) {
            context[name] = prop;
        }
    }
    return context;
}

const reversePriorityOrder = [...variantPriorityOrder].reverse();
const numAnimationTypes = variantPriorityOrder.length;
function animateList(visualElement) {
    return (animations) => Promise.all(animations.map(({ animation, options }) => animateVisualElement(visualElement, animation, options)));
}
function createAnimationState(visualElement) {
    let animate = animateList(visualElement);
    let state = createState();
    let isInitialRender = true;
    /**
     * This function will be used to reduce the animation definitions for
     * each active animation type into an object of resolved values for it.
     */
    const buildResolvedTypeValues = (type) => (acc, definition) => {
        var _a;
        const resolved = resolveVariant(visualElement, definition, type === "exit"
            ? (_a = visualElement.presenceContext) === null || _a === void 0 ? void 0 : _a.custom
            : undefined);
        if (resolved) {
            const { transition, transitionEnd, ...target } = resolved;
            acc = { ...acc, ...target, ...transitionEnd };
        }
        return acc;
    };
    /**
     * This just allows us to inject mocked animation functions
     * @internal
     */
    function setAnimateFunction(makeAnimator) {
        animate = makeAnimator(visualElement);
    }
    /**
     * When we receive new props, we need to:
     * 1. Create a list of protected keys for each type. This is a directory of
     *    value keys that are currently being "handled" by types of a higher priority
     *    so that whenever an animation is played of a given type, these values are
     *    protected from being animated.
     * 2. Determine if an animation type needs animating.
     * 3. Determine if any values have been removed from a type and figure out
     *    what to animate those to.
     */
    function animateChanges(changedActiveType) {
        const { props } = visualElement;
        const context = getVariantContext(visualElement.parent) || {};
        /**
         * A list of animations that we'll build into as we iterate through the animation
         * types. This will get executed at the end of the function.
         */
        const animations = [];
        /**
         * Keep track of which values have been removed. Then, as we hit lower priority
         * animation types, we can check if they contain removed values and animate to that.
         */
        const removedKeys = new Set();
        /**
         * A dictionary of all encountered keys. This is an object to let us build into and
         * copy it without iteration. Each time we hit an animation type we set its protected
         * keys - the keys its not allowed to animate - to the latest version of this object.
         */
        let encounteredKeys = {};
        /**
         * If a variant has been removed at a given index, and this component is controlling
         * variant animations, we want to ensure lower-priority variants are forced to animate.
         */
        let removedVariantIndex = Infinity;
        /**
         * Iterate through all animation types in reverse priority order. For each, we want to
         * detect which values it's handling and whether or not they've changed (and therefore
         * need to be animated). If any values have been removed, we want to detect those in
         * lower priority props and flag for animation.
         */
        for (let i = 0; i < numAnimationTypes; i++) {
            const type = reversePriorityOrder[i];
            const typeState = state[type];
            const prop = props[type] !== undefined
                ? props[type]
                : context[type];
            const propIsVariant = isVariantLabel(prop);
            /**
             * If this type has *just* changed isActive status, set activeDelta
             * to that status. Otherwise set to null.
             */
            const activeDelta = type === changedActiveType ? typeState.isActive : null;
            if (activeDelta === false)
                removedVariantIndex = i;
            /**
             * If this prop is an inherited variant, rather than been set directly on the
             * component itself, we want to make sure we allow the parent to trigger animations.
             *
             * TODO: Can probably change this to a !isControllingVariants check
             */
            let isInherited = prop === context[type] &&
                prop !== props[type] &&
                propIsVariant;
            /**
             *
             */
            if (isInherited &&
                isInitialRender &&
                visualElement.manuallyAnimateOnMount) {
                isInherited = false;
            }
            /**
             * Set all encountered keys so far as the protected keys for this type. This will
             * be any key that has been animated or otherwise handled by active, higher-priortiy types.
             */
            typeState.protectedKeys = { ...encounteredKeys };
            // Check if we can skip analysing this prop early
            if (
            // If it isn't active and hasn't *just* been set as inactive
            (!typeState.isActive && activeDelta === null) ||
                // If we didn't and don't have any defined prop for this animation type
                (!prop && !typeState.prevProp) ||
                // Or if the prop doesn't define an animation
                isAnimationControls(prop) ||
                typeof prop === "boolean") {
                continue;
            }
            /**
             * As we go look through the values defined on this type, if we detect
             * a changed value or a value that was removed in a higher priority, we set
             * this to true and add this prop to the animation list.
             */
            const variantDidChange = checkVariantsDidChange(typeState.prevProp, prop);
            let shouldAnimateType = variantDidChange ||
                // If we're making this variant active, we want to always make it active
                (type === changedActiveType &&
                    typeState.isActive &&
                    !isInherited &&
                    propIsVariant) ||
                // If we removed a higher-priority variant (i is in reverse order)
                (i > removedVariantIndex && propIsVariant);
            let handledRemovedValues = false;
            /**
             * As animations can be set as variant lists, variants or target objects, we
             * coerce everything to an array if it isn't one already
             */
            const definitionList = Array.isArray(prop) ? prop : [prop];
            /**
             * Build an object of all the resolved values. We'll use this in the subsequent
             * animateChanges calls to determine whether a value has changed.
             */
            let resolvedValues = definitionList.reduce(buildResolvedTypeValues(type), {});
            if (activeDelta === false)
                resolvedValues = {};
            /**
             * Now we need to loop through all the keys in the prev prop and this prop,
             * and decide:
             * 1. If the value has changed, and needs animating
             * 2. If it has been removed, and needs adding to the removedKeys set
             * 3. If it has been removed in a higher priority type and needs animating
             * 4. If it hasn't been removed in a higher priority but hasn't changed, and
             *    needs adding to the type's protectedKeys list.
             */
            const { prevResolvedValues = {} } = typeState;
            const allKeys = {
                ...prevResolvedValues,
                ...resolvedValues,
            };
            const markToAnimate = (key) => {
                shouldAnimateType = true;
                if (removedKeys.has(key)) {
                    handledRemovedValues = true;
                    removedKeys.delete(key);
                }
                typeState.needsAnimating[key] = true;
                const motionValue = visualElement.getValue(key);
                if (motionValue)
                    motionValue.liveStyle = false;
            };
            for (const key in allKeys) {
                const next = resolvedValues[key];
                const prev = prevResolvedValues[key];
                // If we've already handled this we can just skip ahead
                if (encounteredKeys.hasOwnProperty(key))
                    continue;
                /**
                 * If the value has changed, we probably want to animate it.
                 */
                let valueHasChanged = false;
                if (isKeyframesTarget(next) && isKeyframesTarget(prev)) {
                    valueHasChanged = !shallowCompare(next, prev);
                }
                else {
                    valueHasChanged = next !== prev;
                }
                if (valueHasChanged) {
                    if (next !== undefined && next !== null) {
                        // If next is defined and doesn't equal prev, it needs animating
                        markToAnimate(key);
                    }
                    else {
                        // If it's undefined, it's been removed.
                        removedKeys.add(key);
                    }
                }
                else if (next !== undefined && removedKeys.has(key)) {
                    /**
                     * If next hasn't changed and it isn't undefined, we want to check if it's
                     * been removed by a higher priority
                     */
                    markToAnimate(key);
                }
                else {
                    /**
                     * If it hasn't changed, we add it to the list of protected values
                     * to ensure it doesn't get animated.
                     */
                    typeState.protectedKeys[key] = true;
                }
            }
            /**
             * Update the typeState so next time animateChanges is called we can compare the
             * latest prop and resolvedValues to these.
             */
            typeState.prevProp = prop;
            typeState.prevResolvedValues = resolvedValues;
            /**
             *
             */
            if (typeState.isActive) {
                encounteredKeys = { ...encounteredKeys, ...resolvedValues };
            }
            if (isInitialRender && visualElement.blockInitialAnimation) {
                shouldAnimateType = false;
            }
            /**
             * If this is an inherited prop we want to skip this animation
             * unless the inherited variants haven't changed on this render.
             */
            const willAnimateViaParent = isInherited && variantDidChange;
            const needsAnimating = !willAnimateViaParent || handledRemovedValues;
            if (shouldAnimateType && needsAnimating) {
                animations.push(...definitionList.map((animation) => ({
                    animation: animation,
                    options: { type },
                })));
            }
        }
        /**
         * If there are some removed value that haven't been dealt with,
         * we need to create a new animation that falls back either to the value
         * defined in the style prop, or the last read value.
         */
        if (removedKeys.size) {
            const fallbackAnimation = {};
            removedKeys.forEach((key) => {
                const fallbackTarget = visualElement.getBaseTarget(key);
                const motionValue = visualElement.getValue(key);
                if (motionValue)
                    motionValue.liveStyle = true;
                // @ts-expect-error - @mattgperry to figure if we should do something here
                fallbackAnimation[key] = fallbackTarget !== null && fallbackTarget !== void 0 ? fallbackTarget : null;
            });
            animations.push({ animation: fallbackAnimation });
        }
        let shouldAnimate = Boolean(animations.length);
        if (isInitialRender &&
            (props.initial === false || props.initial === props.animate) &&
            !visualElement.manuallyAnimateOnMount) {
            shouldAnimate = false;
        }
        isInitialRender = false;
        return shouldAnimate ? animate(animations) : Promise.resolve();
    }
    /**
     * Change whether a certain animation type is active.
     */
    function setActive(type, isActive) {
        var _a;
        // If the active state hasn't changed, we can safely do nothing here
        if (state[type].isActive === isActive)
            return Promise.resolve();
        // Propagate active change to children
        (_a = visualElement.variantChildren) === null || _a === void 0 ? void 0 : _a.forEach((child) => { var _a; return (_a = child.animationState) === null || _a === void 0 ? void 0 : _a.setActive(type, isActive); });
        state[type].isActive = isActive;
        const animations = animateChanges(type);
        for (const key in state) {
            state[key].protectedKeys = {};
        }
        return animations;
    }
    return {
        animateChanges,
        setActive,
        setAnimateFunction,
        getState: () => state,
        reset: () => {
            state = createState();
            isInitialRender = true;
        },
    };
}
function checkVariantsDidChange(prev, next) {
    if (typeof next === "string") {
        return next !== prev;
    }
    else if (Array.isArray(next)) {
        return !shallowCompare(next, prev);
    }
    return false;
}
function createTypeState(isActive = false) {
    return {
        isActive,
        protectedKeys: {},
        needsAnimating: {},
        prevResolvedValues: {},
    };
}
function createState() {
    return {
        animate: createTypeState(true),
        whileInView: createTypeState(),
        whileHover: createTypeState(),
        whileTap: createTypeState(),
        whileDrag: createTypeState(),
        whileFocus: createTypeState(),
        exit: createTypeState(),
    };
}

class Feature {
    constructor(node) {
        this.isMounted = false;
        this.node = node;
    }
    update() { }
}

class AnimationFeature extends Feature {
    /**
     * We dynamically generate the AnimationState manager as it contains a reference
     * to the underlying animation library. We only want to load that if we load this,
     * so people can optionally code split it out using the `m` component.
     */
    constructor(node) {
        super(node);
        node.animationState || (node.animationState = createAnimationState(node));
    }
    updateAnimationControlsSubscription() {
        const { animate } = this.node.getProps();
        if (isAnimationControls(animate)) {
            this.unmountControls = animate.subscribe(this.node);
        }
    }
    /**
     * Subscribe any provided AnimationControls to the component's VisualElement
     */
    mount() {
        this.updateAnimationControlsSubscription();
    }
    update() {
        const { animate } = this.node.getProps();
        const { animate: prevAnimate } = this.node.prevProps || {};
        if (animate !== prevAnimate) {
            this.updateAnimationControlsSubscription();
        }
    }
    unmount() {
        var _a;
        this.node.animationState.reset();
        (_a = this.unmountControls) === null || _a === void 0 ? void 0 : _a.call(this);
    }
}

let id$1 = 0;
class ExitAnimationFeature extends Feature {
    constructor() {
        super(...arguments);
        this.id = id$1++;
    }
    update() {
        if (!this.node.presenceContext)
            return;
        const { isPresent, onExitComplete } = this.node.presenceContext;
        const { isPresent: prevIsPresent } = this.node.prevPresenceContext || {};
        if (!this.node.animationState || isPresent === prevIsPresent) {
            return;
        }
        const exitAnimation = this.node.animationState.setActive("exit", !isPresent);
        if (onExitComplete && !isPresent) {
            exitAnimation.then(() => onExitComplete(this.id));
        }
    }
    mount() {
        const { register } = this.node.presenceContext || {};
        if (register) {
            this.unmount = register(this.id);
        }
    }
    unmount() { }
}

const animations = {
    animation: {
        Feature: AnimationFeature,
    },
    exit: {
        Feature: ExitAnimationFeature,
    },
};

const isPrimaryPointer = (event) => {
    if (event.pointerType === "mouse") {
        return typeof event.button !== "number" || event.button <= 0;
    }
    else {
        /**
         * isPrimary is true for all mice buttons, whereas every touch point
         * is regarded as its own input. So subsequent concurrent touch points
         * will be false.
         *
         * Specifically match against false here as incomplete versions of
         * PointerEvents in very old browser might have it set as undefined.
         */
        return event.isPrimary !== false;
    }
};

function extractEventInfo(event, pointType = "page") {
    return {
        point: {
            x: event[`${pointType}X`],
            y: event[`${pointType}Y`],
        },
    };
}
const addPointerInfo = (handler) => {
    return (event) => isPrimaryPointer(event) && handler(event, extractEventInfo(event));
};

function addDomEvent(target, eventName, handler, options = { passive: true }) {
    target.addEventListener(eventName, handler, options);
    return () => target.removeEventListener(eventName, handler);
}

function addPointerEvent(target, eventName, handler, options) {
    return addDomEvent(target, eventName, addPointerInfo(handler), options);
}

const distance = (a, b) => Math.abs(a - b);
function distance2D(a, b) {
    // Multi-dimensional
    const xDelta = distance(a.x, b.x);
    const yDelta = distance(a.y, b.y);
    return Math.sqrt(xDelta ** 2 + yDelta ** 2);
}

/**
 * @internal
 */
class PanSession {
    constructor(event, handlers, { transformPagePoint, contextWindow, dragSnapToOrigin = false } = {}) {
        /**
         * @internal
         */
        this.startEvent = null;
        /**
         * @internal
         */
        this.lastMoveEvent = null;
        /**
         * @internal
         */
        this.lastMoveEventInfo = null;
        /**
         * @internal
         */
        this.handlers = {};
        /**
         * @internal
         */
        this.contextWindow = window;
        this.updatePoint = () => {
            if (!(this.lastMoveEvent && this.lastMoveEventInfo))
                return;
            const info = getPanInfo(this.lastMoveEventInfo, this.history);
            const isPanStarted = this.startEvent !== null;
            // Only start panning if the offset is larger than 3 pixels. If we make it
            // any larger than this we'll want to reset the pointer history
            // on the first update to avoid visual snapping to the cursoe.
            const isDistancePastThreshold = distance2D(info.offset, { x: 0, y: 0 }) >= 3;
            if (!isPanStarted && !isDistancePastThreshold)
                return;
            const { point } = info;
            const { timestamp } = frameData;
            this.history.push({ ...point, timestamp });
            const { onStart, onMove } = this.handlers;
            if (!isPanStarted) {
                onStart && onStart(this.lastMoveEvent, info);
                this.startEvent = this.lastMoveEvent;
            }
            onMove && onMove(this.lastMoveEvent, info);
        };
        this.handlePointerMove = (event, info) => {
            this.lastMoveEvent = event;
            this.lastMoveEventInfo = transformPoint(info, this.transformPagePoint);
            // Throttle mouse move event to once per frame
            frame.update(this.updatePoint, true);
        };
        this.handlePointerUp = (event, info) => {
            this.end();
            const { onEnd, onSessionEnd, resumeAnimation } = this.handlers;
            if (this.dragSnapToOrigin)
                resumeAnimation && resumeAnimation();
            if (!(this.lastMoveEvent && this.lastMoveEventInfo))
                return;
            const panInfo = getPanInfo(event.type === "pointercancel"
                ? this.lastMoveEventInfo
                : transformPoint(info, this.transformPagePoint), this.history);
            if (this.startEvent && onEnd) {
                onEnd(event, panInfo);
            }
            onSessionEnd && onSessionEnd(event, panInfo);
        };
        // If we have more than one touch, don't start detecting this gesture
        if (!isPrimaryPointer(event))
            return;
        this.dragSnapToOrigin = dragSnapToOrigin;
        this.handlers = handlers;
        this.transformPagePoint = transformPagePoint;
        this.contextWindow = contextWindow || window;
        const info = extractEventInfo(event);
        const initialInfo = transformPoint(info, this.transformPagePoint);
        const { point } = initialInfo;
        const { timestamp } = frameData;
        this.history = [{ ...point, timestamp }];
        const { onSessionStart } = handlers;
        onSessionStart &&
            onSessionStart(event, getPanInfo(initialInfo, this.history));
        this.removeListeners = pipe(addPointerEvent(this.contextWindow, "pointermove", this.handlePointerMove), addPointerEvent(this.contextWindow, "pointerup", this.handlePointerUp), addPointerEvent(this.contextWindow, "pointercancel", this.handlePointerUp));
    }
    updateHandlers(handlers) {
        this.handlers = handlers;
    }
    end() {
        this.removeListeners && this.removeListeners();
        cancelFrame(this.updatePoint);
    }
}
function transformPoint(info, transformPagePoint) {
    return transformPagePoint ? { point: transformPagePoint(info.point) } : info;
}
function subtractPoint(a, b) {
    return { x: a.x - b.x, y: a.y - b.y };
}
function getPanInfo({ point }, history) {
    return {
        point,
        delta: subtractPoint(point, lastDevicePoint(history)),
        offset: subtractPoint(point, startDevicePoint(history)),
        velocity: getVelocity(history, 0.1),
    };
}
function startDevicePoint(history) {
    return history[0];
}
function lastDevicePoint(history) {
    return history[history.length - 1];
}
function getVelocity(history, timeDelta) {
    if (history.length < 2) {
        return { x: 0, y: 0 };
    }
    let i = history.length - 1;
    let timestampedPoint = null;
    const lastPoint = lastDevicePoint(history);
    while (i >= 0) {
        timestampedPoint = history[i];
        if (lastPoint.timestamp - timestampedPoint.timestamp >
            secondsToMilliseconds(timeDelta)) {
            break;
        }
        i--;
    }
    if (!timestampedPoint) {
        return { x: 0, y: 0 };
    }
    const time = millisecondsToSeconds(lastPoint.timestamp - timestampedPoint.timestamp);
    if (time === 0) {
        return { x: 0, y: 0 };
    }
    const currentVelocity = {
        x: (lastPoint.x - timestampedPoint.x) / time,
        y: (lastPoint.y - timestampedPoint.y) / time,
    };
    if (currentVelocity.x === Infinity) {
        currentVelocity.x = 0;
    }
    if (currentVelocity.y === Infinity) {
        currentVelocity.y = 0;
    }
    return currentVelocity;
}

function createLock(name) {
    let lock = null;
    return () => {
        const openLock = () => {
            lock = null;
        };
        if (lock === null) {
            lock = name;
            return openLock;
        }
        return false;
    };
}
const globalHorizontalLock = createLock("dragHorizontal");
const globalVerticalLock = createLock("dragVertical");
function getGlobalLock(drag) {
    let lock = false;
    if (drag === "y") {
        lock = globalVerticalLock();
    }
    else if (drag === "x") {
        lock = globalHorizontalLock();
    }
    else {
        const openHorizontal = globalHorizontalLock();
        const openVertical = globalVerticalLock();
        if (openHorizontal && openVertical) {
            lock = () => {
                openHorizontal();
                openVertical();
            };
        }
        else {
            // Release the locks because we don't use them
            if (openHorizontal)
                openHorizontal();
            if (openVertical)
                openVertical();
        }
    }
    return lock;
}
function isDragActive() {
    // Check the gesture lock - if we get it, it means no drag gesture is active
    // and we can safely fire the tap gesture.
    const openGestureLock = getGlobalLock(true);
    if (!openGestureLock)
        return true;
    openGestureLock();
    return false;
}

function isRefObject(ref) {
    return (ref &&
        typeof ref === "object" &&
        Object.prototype.hasOwnProperty.call(ref, "current"));
}

const SCALE_PRECISION = 0.0001;
const SCALE_MIN = 1 - SCALE_PRECISION;
const SCALE_MAX = 1 + SCALE_PRECISION;
const TRANSLATE_PRECISION = 0.01;
const TRANSLATE_MIN = 0 - TRANSLATE_PRECISION;
const TRANSLATE_MAX = 0 + TRANSLATE_PRECISION;
function calcLength(axis) {
    return axis.max - axis.min;
}
function isNear(value, target, maxDistance) {
    return Math.abs(value - target) <= maxDistance;
}
function calcAxisDelta(delta, source, target, origin = 0.5) {
    delta.origin = origin;
    delta.originPoint = mixNumber$1(source.min, source.max, delta.origin);
    delta.scale = calcLength(target) / calcLength(source);
    delta.translate =
        mixNumber$1(target.min, target.max, delta.origin) - delta.originPoint;
    if ((delta.scale >= SCALE_MIN && delta.scale <= SCALE_MAX) ||
        isNaN(delta.scale)) {
        delta.scale = 1.0;
    }
    if ((delta.translate >= TRANSLATE_MIN &&
        delta.translate <= TRANSLATE_MAX) ||
        isNaN(delta.translate)) {
        delta.translate = 0.0;
    }
}
function calcBoxDelta(delta, source, target, origin) {
    calcAxisDelta(delta.x, source.x, target.x, origin ? origin.originX : undefined);
    calcAxisDelta(delta.y, source.y, target.y, origin ? origin.originY : undefined);
}
function calcRelativeAxis(target, relative, parent) {
    target.min = parent.min + relative.min;
    target.max = target.min + calcLength(relative);
}
function calcRelativeBox(target, relative, parent) {
    calcRelativeAxis(target.x, relative.x, parent.x);
    calcRelativeAxis(target.y, relative.y, parent.y);
}
function calcRelativeAxisPosition(target, layout, parent) {
    target.min = layout.min - parent.min;
    target.max = target.min + calcLength(layout);
}
function calcRelativePosition(target, layout, parent) {
    calcRelativeAxisPosition(target.x, layout.x, parent.x);
    calcRelativeAxisPosition(target.y, layout.y, parent.y);
}

/**
 * Apply constraints to a point. These constraints are both physical along an
 * axis, and an elastic factor that determines how much to constrain the point
 * by if it does lie outside the defined parameters.
 */
function applyConstraints(point, { min, max }, elastic) {
    if (min !== undefined && point < min) {
        // If we have a min point defined, and this is outside of that, constrain
        point = elastic
            ? mixNumber$1(min, point, elastic.min)
            : Math.max(point, min);
    }
    else if (max !== undefined && point > max) {
        // If we have a max point defined, and this is outside of that, constrain
        point = elastic
            ? mixNumber$1(max, point, elastic.max)
            : Math.min(point, max);
    }
    return point;
}
/**
 * Calculate constraints in terms of the viewport when defined relatively to the
 * measured axis. This is measured from the nearest edge, so a max constraint of 200
 * on an axis with a max value of 300 would return a constraint of 500 - axis length
 */
function calcRelativeAxisConstraints(axis, min, max) {
    return {
        min: min !== undefined ? axis.min + min : undefined,
        max: max !== undefined
            ? axis.max + max - (axis.max - axis.min)
            : undefined,
    };
}
/**
 * Calculate constraints in terms of the viewport when
 * defined relatively to the measured bounding box.
 */
function calcRelativeConstraints(layoutBox, { top, left, bottom, right }) {
    return {
        x: calcRelativeAxisConstraints(layoutBox.x, left, right),
        y: calcRelativeAxisConstraints(layoutBox.y, top, bottom),
    };
}
/**
 * Calculate viewport constraints when defined as another viewport-relative axis
 */
function calcViewportAxisConstraints(layoutAxis, constraintsAxis) {
    let min = constraintsAxis.min - layoutAxis.min;
    let max = constraintsAxis.max - layoutAxis.max;
    // If the constraints axis is actually smaller than the layout axis then we can
    // flip the constraints
    if (constraintsAxis.max - constraintsAxis.min <
        layoutAxis.max - layoutAxis.min) {
        [min, max] = [max, min];
    }
    return { min, max };
}
/**
 * Calculate viewport constraints when defined as another viewport-relative box
 */
function calcViewportConstraints(layoutBox, constraintsBox) {
    return {
        x: calcViewportAxisConstraints(layoutBox.x, constraintsBox.x),
        y: calcViewportAxisConstraints(layoutBox.y, constraintsBox.y),
    };
}
/**
 * Calculate a transform origin relative to the source axis, between 0-1, that results
 * in an asthetically pleasing scale/transform needed to project from source to target.
 */
function calcOrigin$1(source, target) {
    let origin = 0.5;
    const sourceLength = calcLength(source);
    const targetLength = calcLength(target);
    if (targetLength > sourceLength) {
        origin = progress(target.min, target.max - sourceLength, source.min);
    }
    else if (sourceLength > targetLength) {
        origin = progress(source.min, source.max - targetLength, target.min);
    }
    return clamp(0, 1, origin);
}
/**
 * Rebase the calculated viewport constraints relative to the layout.min point.
 */
function rebaseAxisConstraints(layout, constraints) {
    const relativeConstraints = {};
    if (constraints.min !== undefined) {
        relativeConstraints.min = constraints.min - layout.min;
    }
    if (constraints.max !== undefined) {
        relativeConstraints.max = constraints.max - layout.min;
    }
    return relativeConstraints;
}
const defaultElastic = 0.35;
/**
 * Accepts a dragElastic prop and returns resolved elastic values for each axis.
 */
function resolveDragElastic(dragElastic = defaultElastic) {
    if (dragElastic === false) {
        dragElastic = 0;
    }
    else if (dragElastic === true) {
        dragElastic = defaultElastic;
    }
    return {
        x: resolveAxisElastic(dragElastic, "left", "right"),
        y: resolveAxisElastic(dragElastic, "top", "bottom"),
    };
}
function resolveAxisElastic(dragElastic, minLabel, maxLabel) {
    return {
        min: resolvePointElastic(dragElastic, minLabel),
        max: resolvePointElastic(dragElastic, maxLabel),
    };
}
function resolvePointElastic(dragElastic, label) {
    return typeof dragElastic === "number"
        ? dragElastic
        : dragElastic[label] || 0;
}

const createAxisDelta = () => ({
    translate: 0,
    scale: 1,
    origin: 0,
    originPoint: 0,
});
const createDelta = () => ({
    x: createAxisDelta(),
    y: createAxisDelta(),
});
const createAxis = () => ({ min: 0, max: 0 });
const createBox = () => ({
    x: createAxis(),
    y: createAxis(),
});

function eachAxis(callback) {
    return [callback("x"), callback("y")];
}

/**
 * Bounding boxes tend to be defined as top, left, right, bottom. For various operations
 * it's easier to consider each axis individually. This function returns a bounding box
 * as a map of single-axis min/max values.
 */
function convertBoundingBoxToBox({ top, left, right, bottom, }) {
    return {
        x: { min: left, max: right },
        y: { min: top, max: bottom },
    };
}
function convertBoxToBoundingBox({ x, y }) {
    return { top: y.min, right: x.max, bottom: y.max, left: x.min };
}
/**
 * Applies a TransformPoint function to a bounding box. TransformPoint is usually a function
 * provided by Framer to allow measured points to be corrected for device scaling. This is used
 * when measuring DOM elements and DOM event points.
 */
function transformBoxPoints(point, transformPoint) {
    if (!transformPoint)
        return point;
    const topLeft = transformPoint({ x: point.left, y: point.top });
    const bottomRight = transformPoint({ x: point.right, y: point.bottom });
    return {
        top: topLeft.y,
        left: topLeft.x,
        bottom: bottomRight.y,
        right: bottomRight.x,
    };
}

function isIdentityScale(scale) {
    return scale === undefined || scale === 1;
}
function hasScale({ scale, scaleX, scaleY }) {
    return (!isIdentityScale(scale) ||
        !isIdentityScale(scaleX) ||
        !isIdentityScale(scaleY));
}
function hasTransform(values) {
    return (hasScale(values) ||
        has2DTranslate(values) ||
        values.z ||
        values.rotate ||
        values.rotateX ||
        values.rotateY ||
        values.skewX ||
        values.skewY);
}
function has2DTranslate(values) {
    return is2DTranslate(values.x) || is2DTranslate(values.y);
}
function is2DTranslate(value) {
    return value && value !== "0%";
}

/**
 * Scales a point based on a factor and an originPoint
 */
function scalePoint(point, scale, originPoint) {
    const distanceFromOrigin = point - originPoint;
    const scaled = scale * distanceFromOrigin;
    return originPoint + scaled;
}
/**
 * Applies a translate/scale delta to a point
 */
function applyPointDelta(point, translate, scale, originPoint, boxScale) {
    if (boxScale !== undefined) {
        point = scalePoint(point, boxScale, originPoint);
    }
    return scalePoint(point, scale, originPoint) + translate;
}
/**
 * Applies a translate/scale delta to an axis
 */
function applyAxisDelta(axis, translate = 0, scale = 1, originPoint, boxScale) {
    axis.min = applyPointDelta(axis.min, translate, scale, originPoint, boxScale);
    axis.max = applyPointDelta(axis.max, translate, scale, originPoint, boxScale);
}
/**
 * Applies a translate/scale delta to a box
 */
function applyBoxDelta(box, { x, y }) {
    applyAxisDelta(box.x, x.translate, x.scale, x.originPoint);
    applyAxisDelta(box.y, y.translate, y.scale, y.originPoint);
}
const TREE_SCALE_SNAP_MIN = 0.999999999999;
const TREE_SCALE_SNAP_MAX = 1.0000000000001;
/**
 * Apply a tree of deltas to a box. We do this to calculate the effect of all the transforms
 * in a tree upon our box before then calculating how to project it into our desired viewport-relative box
 *
 * This is the final nested loop within updateLayoutDelta for future refactoring
 */
function applyTreeDeltas(box, treeScale, treePath, isSharedTransition = false) {
    const treeLength = treePath.length;
    if (!treeLength)
        return;
    // Reset the treeScale
    treeScale.x = treeScale.y = 1;
    let node;
    let delta;
    for (let i = 0; i < treeLength; i++) {
        node = treePath[i];
        delta = node.projectionDelta;
        /**
         * TODO: Prefer to remove this, but currently we have motion components with
         * display: contents in Framer.
         */
        const { visualElement } = node.options;
        if (visualElement &&
            visualElement.props.style &&
            visualElement.props.style.display === "contents") {
            continue;
        }
        if (isSharedTransition &&
            node.options.layoutScroll &&
            node.scroll &&
            node !== node.root) {
            transformBox(box, {
                x: -node.scroll.offset.x,
                y: -node.scroll.offset.y,
            });
        }
        if (delta) {
            // Incoporate each ancestor's scale into a culmulative treeScale for this component
            treeScale.x *= delta.x.scale;
            treeScale.y *= delta.y.scale;
            // Apply each ancestor's calculated delta into this component's recorded layout box
            applyBoxDelta(box, delta);
        }
        if (isSharedTransition && hasTransform(node.latestValues)) {
            transformBox(box, node.latestValues);
        }
    }
    /**
     * Snap tree scale back to 1 if it's within a non-perceivable threshold.
     * This will help reduce useless scales getting rendered.
     */
    if (treeScale.x < TREE_SCALE_SNAP_MAX &&
        treeScale.x > TREE_SCALE_SNAP_MIN) {
        treeScale.x = 1.0;
    }
    if (treeScale.y < TREE_SCALE_SNAP_MAX &&
        treeScale.y > TREE_SCALE_SNAP_MIN) {
        treeScale.y = 1.0;
    }
}
function translateAxis(axis, distance) {
    axis.min = axis.min + distance;
    axis.max = axis.max + distance;
}
/**
 * Apply a transform to an axis from the latest resolved motion values.
 * This function basically acts as a bridge between a flat motion value map
 * and applyAxisDelta
 */
function transformAxis(axis, axisTranslate, axisScale, boxScale, axisOrigin = 0.5) {
    const originPoint = mixNumber$1(axis.min, axis.max, axisOrigin);
    // Apply the axis delta to the final axis
    applyAxisDelta(axis, axisTranslate, axisScale, originPoint, boxScale);
}
/**
 * Apply a transform to a box from the latest resolved motion values.
 */
function transformBox(box, transform) {
    transformAxis(box.x, transform.x, transform.scaleX, transform.scale, transform.originX);
    transformAxis(box.y, transform.y, transform.scaleY, transform.scale, transform.originY);
}

function measureViewportBox(instance, transformPoint) {
    return convertBoundingBoxToBox(transformBoxPoints(instance.getBoundingClientRect(), transformPoint));
}
function measurePageBox(element, rootProjectionNode, transformPagePoint) {
    const viewportBox = measureViewportBox(element, transformPagePoint);
    const { scroll } = rootProjectionNode;
    if (scroll) {
        translateAxis(viewportBox.x, scroll.offset.x);
        translateAxis(viewportBox.y, scroll.offset.y);
    }
    return viewportBox;
}

// Fixes https://github.com/framer/motion/issues/2270
const getContextWindow = ({ current }) => {
    return current ? current.ownerDocument.defaultView : null;
};

const elementDragControls = new WeakMap();
/**
 *
 */
// let latestPointerEvent: PointerEvent
class VisualElementDragControls {
    constructor(visualElement) {
        // This is a reference to the global drag gesture lock, ensuring only one component
        // can "capture" the drag of one or both axes.
        // TODO: Look into moving this into pansession?
        this.openGlobalLock = null;
        this.isDragging = false;
        this.currentDirection = null;
        this.originPoint = { x: 0, y: 0 };
        /**
         * The permitted boundaries of travel, in pixels.
         */
        this.constraints = false;
        this.hasMutatedConstraints = false;
        /**
         * The per-axis resolved elastic values.
         */
        this.elastic = createBox();
        this.visualElement = visualElement;
    }
    start(originEvent, { snapToCursor = false } = {}) {
        /**
         * Don't start dragging if this component is exiting
         */
        const { presenceContext } = this.visualElement;
        if (presenceContext && presenceContext.isPresent === false)
            return;
        const onSessionStart = (event) => {
            const { dragSnapToOrigin } = this.getProps();
            // Stop or pause any animations on both axis values immediately. This allows the user to throw and catch
            // the component.
            dragSnapToOrigin ? this.pauseAnimation() : this.stopAnimation();
            if (snapToCursor) {
                this.snapToCursor(extractEventInfo(event, "page").point);
            }
        };
        const onStart = (event, info) => {
            // Attempt to grab the global drag gesture lock - maybe make this part of PanSession
            const { drag, dragPropagation, onDragStart } = this.getProps();
            if (drag && !dragPropagation) {
                if (this.openGlobalLock)
                    this.openGlobalLock();
                this.openGlobalLock = getGlobalLock(drag);
                // If we don 't have the lock, don't start dragging
                if (!this.openGlobalLock)
                    return;
            }
            this.isDragging = true;
            this.currentDirection = null;
            this.resolveConstraints();
            if (this.visualElement.projection) {
                this.visualElement.projection.isAnimationBlocked = true;
                this.visualElement.projection.target = undefined;
            }
            /**
             * Record gesture origin
             */
            eachAxis((axis) => {
                let current = this.getAxisMotionValue(axis).get() || 0;
                /**
                 * If the MotionValue is a percentage value convert to px
                 */
                if (percent.test(current)) {
                    const { projection } = this.visualElement;
                    if (projection && projection.layout) {
                        const measuredAxis = projection.layout.layoutBox[axis];
                        if (measuredAxis) {
                            const length = calcLength(measuredAxis);
                            current = length * (parseFloat(current) / 100);
                        }
                    }
                }
                this.originPoint[axis] = current;
            });
            // Fire onDragStart event
            if (onDragStart) {
                frame.postRender(() => onDragStart(event, info));
            }
            addValueToWillChange(this.visualElement, "transform");
            const { animationState } = this.visualElement;
            animationState && animationState.setActive("whileDrag", true);
        };
        const onMove = (event, info) => {
            // latestPointerEvent = event
            const { dragPropagation, dragDirectionLock, onDirectionLock, onDrag, } = this.getProps();
            // If we didn't successfully receive the gesture lock, early return.
            if (!dragPropagation && !this.openGlobalLock)
                return;
            const { offset } = info;
            // Attempt to detect drag direction if directionLock is true
            if (dragDirectionLock && this.currentDirection === null) {
                this.currentDirection = getCurrentDirection(offset);
                // If we've successfully set a direction, notify listener
                if (this.currentDirection !== null) {
                    onDirectionLock && onDirectionLock(this.currentDirection);
                }
                return;
            }
            // Update each point with the latest position
            this.updateAxis("x", info.point, offset);
            this.updateAxis("y", info.point, offset);
            /**
             * Ideally we would leave the renderer to fire naturally at the end of
             * this frame but if the element is about to change layout as the result
             * of a re-render we want to ensure the browser can read the latest
             * bounding box to ensure the pointer and element don't fall out of sync.
             */
            this.visualElement.render();
            /**
             * This must fire after the render call as it might trigger a state
             * change which itself might trigger a layout update.
             */
            onDrag && onDrag(event, info);
        };
        const onSessionEnd = (event, info) => this.stop(event, info);
        const resumeAnimation = () => eachAxis((axis) => {
            var _a;
            return this.getAnimationState(axis) === "paused" &&
                ((_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.play());
        });
        const { dragSnapToOrigin } = this.getProps();
        this.panSession = new PanSession(originEvent, {
            onSessionStart,
            onStart,
            onMove,
            onSessionEnd,
            resumeAnimation,
        }, {
            transformPagePoint: this.visualElement.getTransformPagePoint(),
            dragSnapToOrigin,
            contextWindow: getContextWindow(this.visualElement),
        });
    }
    stop(event, info) {
        const isDragging = this.isDragging;
        this.cancel();
        if (!isDragging)
            return;
        const { velocity } = info;
        this.startAnimation(velocity);
        const { onDragEnd } = this.getProps();
        if (onDragEnd) {
            frame.postRender(() => onDragEnd(event, info));
        }
    }
    cancel() {
        this.isDragging = false;
        const { projection, animationState } = this.visualElement;
        if (projection) {
            projection.isAnimationBlocked = false;
        }
        this.panSession && this.panSession.end();
        this.panSession = undefined;
        const { dragPropagation } = this.getProps();
        if (!dragPropagation && this.openGlobalLock) {
            this.openGlobalLock();
            this.openGlobalLock = null;
        }
        animationState && animationState.setActive("whileDrag", false);
    }
    updateAxis(axis, _point, offset) {
        const { drag } = this.getProps();
        // If we're not dragging this axis, do an early return.
        if (!offset || !shouldDrag(axis, drag, this.currentDirection))
            return;
        const axisValue = this.getAxisMotionValue(axis);
        let next = this.originPoint[axis] + offset[axis];
        // Apply constraints
        if (this.constraints && this.constraints[axis]) {
            next = applyConstraints(next, this.constraints[axis], this.elastic[axis]);
        }
        axisValue.set(next);
    }
    resolveConstraints() {
        var _a;
        const { dragConstraints, dragElastic } = this.getProps();
        const layout = this.visualElement.projection &&
            !this.visualElement.projection.layout
            ? this.visualElement.projection.measure(false)
            : (_a = this.visualElement.projection) === null || _a === void 0 ? void 0 : _a.layout;
        const prevConstraints = this.constraints;
        if (dragConstraints && isRefObject(dragConstraints)) {
            if (!this.constraints) {
                this.constraints = this.resolveRefConstraints();
            }
        }
        else {
            if (dragConstraints && layout) {
                this.constraints = calcRelativeConstraints(layout.layoutBox, dragConstraints);
            }
            else {
                this.constraints = false;
            }
        }
        this.elastic = resolveDragElastic(dragElastic);
        /**
         * If we're outputting to external MotionValues, we want to rebase the measured constraints
         * from viewport-relative to component-relative.
         */
        if (prevConstraints !== this.constraints &&
            layout &&
            this.constraints &&
            !this.hasMutatedConstraints) {
            eachAxis((axis) => {
                if (this.constraints !== false &&
                    this.getAxisMotionValue(axis)) {
                    this.constraints[axis] = rebaseAxisConstraints(layout.layoutBox[axis], this.constraints[axis]);
                }
            });
        }
    }
    resolveRefConstraints() {
        const { dragConstraints: constraints, onMeasureDragConstraints } = this.getProps();
        if (!constraints || !isRefObject(constraints))
            return false;
        const constraintsElement = constraints.current;
        invariant(constraintsElement !== null, "If `dragConstraints` is set as a React ref, that ref must be passed to another component's `ref` prop.");
        const { projection } = this.visualElement;
        // TODO
        if (!projection || !projection.layout)
            return false;
        const constraintsBox = measurePageBox(constraintsElement, projection.root, this.visualElement.getTransformPagePoint());
        let measuredConstraints = calcViewportConstraints(projection.layout.layoutBox, constraintsBox);
        /**
         * If there's an onMeasureDragConstraints listener we call it and
         * if different constraints are returned, set constraints to that
         */
        if (onMeasureDragConstraints) {
            const userConstraints = onMeasureDragConstraints(convertBoxToBoundingBox(measuredConstraints));
            this.hasMutatedConstraints = !!userConstraints;
            if (userConstraints) {
                measuredConstraints = convertBoundingBoxToBox(userConstraints);
            }
        }
        return measuredConstraints;
    }
    startAnimation(velocity) {
        const { drag, dragMomentum, dragElastic, dragTransition, dragSnapToOrigin, onDragTransitionEnd, } = this.getProps();
        const constraints = this.constraints || {};
        const momentumAnimations = eachAxis((axis) => {
            if (!shouldDrag(axis, drag, this.currentDirection)) {
                return;
            }
            let transition = (constraints && constraints[axis]) || {};
            if (dragSnapToOrigin)
                transition = { min: 0, max: 0 };
            /**
             * Overdamp the boundary spring if `dragElastic` is disabled. There's still a frame
             * of spring animations so we should look into adding a disable spring option to `inertia`.
             * We could do something here where we affect the `bounceStiffness` and `bounceDamping`
             * using the value of `dragElastic`.
             */
            const bounceStiffness = dragElastic ? 200 : 1000000;
            const bounceDamping = dragElastic ? 40 : 10000000;
            const inertia = {
                type: "inertia",
                velocity: dragMomentum ? velocity[axis] : 0,
                bounceStiffness,
                bounceDamping,
                timeConstant: 750,
                restDelta: 1,
                restSpeed: 10,
                ...dragTransition,
                ...transition,
            };
            // If we're not animating on an externally-provided `MotionValue` we can use the
            // component's animation controls which will handle interactions with whileHover (etc),
            // otherwise we just have to animate the `MotionValue` itself.
            return this.startAxisValueAnimation(axis, inertia);
        });
        // Run all animations and then resolve the new drag constraints.
        return Promise.all(momentumAnimations).then(onDragTransitionEnd);
    }
    startAxisValueAnimation(axis, transition) {
        const axisValue = this.getAxisMotionValue(axis);
        addValueToWillChange(this.visualElement, axis);
        return axisValue.start(animateMotionValue(axis, axisValue, 0, transition, this.visualElement, false));
    }
    stopAnimation() {
        eachAxis((axis) => this.getAxisMotionValue(axis).stop());
    }
    pauseAnimation() {
        eachAxis((axis) => { var _a; return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.pause(); });
    }
    getAnimationState(axis) {
        var _a;
        return (_a = this.getAxisMotionValue(axis).animation) === null || _a === void 0 ? void 0 : _a.state;
    }
    /**
     * Drag works differently depending on which props are provided.
     *
     * - If _dragX and _dragY are provided, we output the gesture delta directly to those motion values.
     * - Otherwise, we apply the delta to the x/y motion values.
     */
    getAxisMotionValue(axis) {
        const dragKey = `_drag${axis.toUpperCase()}`;
        const props = this.visualElement.getProps();
        const externalMotionValue = props[dragKey];
        return externalMotionValue
            ? externalMotionValue
            : this.visualElement.getValue(axis, (props.initial
                ? props.initial[axis]
                : undefined) || 0);
    }
    snapToCursor(point) {
        eachAxis((axis) => {
            const { drag } = this.getProps();
            // If we're not dragging this axis, do an early return.
            if (!shouldDrag(axis, drag, this.currentDirection))
                return;
            const { projection } = this.visualElement;
            const axisValue = this.getAxisMotionValue(axis);
            if (projection && projection.layout) {
                const { min, max } = projection.layout.layoutBox[axis];
                axisValue.set(point[axis] - mixNumber$1(min, max, 0.5));
            }
        });
    }
    /**
     * When the viewport resizes we want to check if the measured constraints
     * have changed and, if so, reposition the element within those new constraints
     * relative to where it was before the resize.
     */
    scalePositionWithinConstraints() {
        if (!this.visualElement.current)
            return;
        const { drag, dragConstraints } = this.getProps();
        const { projection } = this.visualElement;
        if (!isRefObject(dragConstraints) || !projection || !this.constraints)
            return;
        /**
         * Stop current animations as there can be visual glitching if we try to do
         * this mid-animation
         */
        this.stopAnimation();
        /**
         * Record the relative position of the dragged element relative to the
         * constraints box and save as a progress value.
         */
        const boxProgress = { x: 0, y: 0 };
        eachAxis((axis) => {
            const axisValue = this.getAxisMotionValue(axis);
            if (axisValue && this.constraints !== false) {
                const latest = axisValue.get();
                boxProgress[axis] = calcOrigin$1({ min: latest, max: latest }, this.constraints[axis]);
            }
        });
        /**
         * Update the layout of this element and resolve the latest drag constraints
         */
        const { transformTemplate } = this.visualElement.getProps();
        this.visualElement.current.style.transform = transformTemplate
            ? transformTemplate({}, "")
            : "none";
        projection.root && projection.root.updateScroll();
        projection.updateLayout();
        this.resolveConstraints();
        /**
         * For each axis, calculate the current progress of the layout axis
         * within the new constraints.
         */
        eachAxis((axis) => {
            if (!shouldDrag(axis, drag, null))
                return;
            /**
             * Calculate a new transform based on the previous box progress
             */
            const axisValue = this.getAxisMotionValue(axis);
            const { min, max } = this.constraints[axis];
            axisValue.set(mixNumber$1(min, max, boxProgress[axis]));
        });
    }
    addListeners() {
        if (!this.visualElement.current)
            return;
        elementDragControls.set(this.visualElement, this);
        const element = this.visualElement.current;
        /**
         * Attach a pointerdown event listener on this DOM element to initiate drag tracking.
         */
        const stopPointerListener = addPointerEvent(element, "pointerdown", (event) => {
            const { drag, dragListener = true } = this.getProps();
            drag && dragListener && this.start(event);
        });
        const measureDragConstraints = () => {
            const { dragConstraints } = this.getProps();
            if (isRefObject(dragConstraints) && dragConstraints.current) {
                this.constraints = this.resolveRefConstraints();
            }
        };
        const { projection } = this.visualElement;
        const stopMeasureLayoutListener = projection.addEventListener("measure", measureDragConstraints);
        if (projection && !projection.layout) {
            projection.root && projection.root.updateScroll();
            projection.updateLayout();
        }
        frame.read(measureDragConstraints);
        /**
         * Attach a window resize listener to scale the draggable target within its defined
         * constraints as the window resizes.
         */
        const stopResizeListener = addDomEvent(window, "resize", () => this.scalePositionWithinConstraints());
        /**
         * If the element's layout changes, calculate the delta and apply that to
         * the drag gesture's origin point.
         */
        const stopLayoutUpdateListener = projection.addEventListener("didUpdate", (({ delta, hasLayoutChanged }) => {
            if (this.isDragging && hasLayoutChanged) {
                eachAxis((axis) => {
                    const motionValue = this.getAxisMotionValue(axis);
                    if (!motionValue)
                        return;
                    this.originPoint[axis] += delta[axis].translate;
                    motionValue.set(motionValue.get() + delta[axis].translate);
                });
                this.visualElement.render();
            }
        }));
        return () => {
            stopResizeListener();
            stopPointerListener();
            stopMeasureLayoutListener();
            stopLayoutUpdateListener && stopLayoutUpdateListener();
        };
    }
    getProps() {
        const props = this.visualElement.getProps();
        const { drag = false, dragDirectionLock = false, dragPropagation = false, dragConstraints = false, dragElastic = defaultElastic, dragMomentum = true, } = props;
        return {
            ...props,
            drag,
            dragDirectionLock,
            dragPropagation,
            dragConstraints,
            dragElastic,
            dragMomentum,
        };
    }
}
function shouldDrag(direction, drag, currentDirection) {
    return ((drag === true || drag === direction) &&
        (currentDirection === null || currentDirection === direction));
}
/**
 * Based on an x/y offset determine the current drag direction. If both axis' offsets are lower
 * than the provided threshold, return `null`.
 *
 * @param offset - The x/y offset from origin.
 * @param lockThreshold - (Optional) - the minimum absolute offset before we can determine a drag direction.
 */
function getCurrentDirection(offset, lockThreshold = 10) {
    let direction = null;
    if (Math.abs(offset.y) > lockThreshold) {
        direction = "y";
    }
    else if (Math.abs(offset.x) > lockThreshold) {
        direction = "x";
    }
    return direction;
}

class DragGesture extends Feature {
    constructor(node) {
        super(node);
        this.removeGroupControls = noop$1;
        this.removeListeners = noop$1;
        this.controls = new VisualElementDragControls(node);
    }
    mount() {
        // If we've been provided a DragControls for manual control over the drag gesture,
        // subscribe this component to it on mount.
        const { dragControls } = this.node.getProps();
        if (dragControls) {
            this.removeGroupControls = dragControls.subscribe(this.controls);
        }
        this.removeListeners = this.controls.addListeners() || noop$1;
    }
    unmount() {
        this.removeGroupControls();
        this.removeListeners();
    }
}

const asyncHandler = (handler) => (event, info) => {
    if (handler) {
        frame.postRender(() => handler(event, info));
    }
};
class PanGesture extends Feature {
    constructor() {
        super(...arguments);
        this.removePointerDownListener = noop$1;
    }
    onPointerDown(pointerDownEvent) {
        this.session = new PanSession(pointerDownEvent, this.createPanHandlers(), {
            transformPagePoint: this.node.getTransformPagePoint(),
            contextWindow: getContextWindow(this.node),
        });
    }
    createPanHandlers() {
        const { onPanSessionStart, onPanStart, onPan, onPanEnd } = this.node.getProps();
        return {
            onSessionStart: asyncHandler(onPanSessionStart),
            onStart: asyncHandler(onPanStart),
            onMove: onPan,
            onEnd: (event, info) => {
                delete this.session;
                if (onPanEnd) {
                    frame.postRender(() => onPanEnd(event, info));
                }
            },
        };
    }
    mount() {
        this.removePointerDownListener = addPointerEvent(this.node.current, "pointerdown", (event) => this.onPointerDown(event));
    }
    update() {
        this.session && this.session.updateHandlers(this.createPanHandlers());
    }
    unmount() {
        this.removePointerDownListener();
        this.session && this.session.end();
    }
}

/**
 * @public
 */
const PresenceContext = createContext(null);

/**
 * When a component is the child of `AnimatePresence`, it can use `usePresence`
 * to access information about whether it's still present in the React tree.
 *
 * ```jsx
 * import { usePresence } from "framer-motion"
 *
 * export const Component = () => {
 *   const [isPresent, safeToRemove] = usePresence()
 *
 *   useEffect(() => {
 *     !isPresent && setTimeout(safeToRemove, 1000)
 *   }, [isPresent])
 *
 *   return <div />
 * }
 * ```
 *
 * If `isPresent` is `false`, it means that a component has been removed the tree, but
 * `AnimatePresence` won't really remove it until `safeToRemove` has been called.
 *
 * @public
 */
function usePresence() {
    const context = useContext(PresenceContext);
    if (context === null)
        return [true, null];
    const { isPresent, onExitComplete, register } = context;
    // It's safe to call the following hooks conditionally (after an early return) because the context will always
    // either be null or non-null for the lifespan of the component.
    const id = useId();
    useEffect(() => register(id), []);
    const safeToRemove = useCallback(() => onExitComplete && onExitComplete(id), [id, onExitComplete]);
    return !isPresent && onExitComplete ? [false, safeToRemove] : [true];
}

const LayoutGroupContext = createContext({});

/**
 * Internal, exported only for usage in Framer
 */
const SwitchLayoutGroupContext = createContext({});

/**
 * This should only ever be modified on the client otherwise it'll
 * persist through server requests. If we need instanced states we
 * could lazy-init via root.
 */
const globalProjectionState = {
    /**
     * Global flag as to whether the tree has animated since the last time
     * we resized the window
     */
    hasAnimatedSinceResize: true,
    /**
     * We set this to true once, on the first update. Any nodes added to the tree beyond that
     * update will be given a `data-projection-id` attribute.
     */
    hasEverUpdated: false,
};

function pixelsToPercent(pixels, axis) {
    if (axis.max === axis.min)
        return 0;
    return (pixels / (axis.max - axis.min)) * 100;
}
/**
 * We always correct borderRadius as a percentage rather than pixels to reduce paints.
 * For example, if you are projecting a box that is 100px wide with a 10px borderRadius
 * into a box that is 200px wide with a 20px borderRadius, that is actually a 10%
 * borderRadius in both states. If we animate between the two in pixels that will trigger
 * a paint each time. If we animate between the two in percentage we'll avoid a paint.
 */
const correctBorderRadius = {
    correct: (latest, node) => {
        if (!node.target)
            return latest;
        /**
         * If latest is a string, if it's a percentage we can return immediately as it's
         * going to be stretched appropriately. Otherwise, if it's a pixel, convert it to a number.
         */
        if (typeof latest === "string") {
            if (px.test(latest)) {
                latest = parseFloat(latest);
            }
            else {
                return latest;
            }
        }
        /**
         * If latest is a number, it's a pixel value. We use the current viewportBox to calculate that
         * pixel value as a percentage of each axis
         */
        const x = pixelsToPercent(latest, node.target.x);
        const y = pixelsToPercent(latest, node.target.y);
        return `${x}% ${y}%`;
    },
};

const correctBoxShadow = {
    correct: (latest, { treeScale, projectionDelta }) => {
        const original = latest;
        const shadow = complex.parse(latest);
        // TODO: Doesn't support multiple shadows
        if (shadow.length > 5)
            return original;
        const template = complex.createTransformer(latest);
        const offset = typeof shadow[0] !== "number" ? 1 : 0;
        // Calculate the overall context scale
        const xScale = projectionDelta.x.scale * treeScale.x;
        const yScale = projectionDelta.y.scale * treeScale.y;
        shadow[0 + offset] /= xScale;
        shadow[1 + offset] /= yScale;
        /**
         * Ideally we'd correct x and y scales individually, but because blur and
         * spread apply to both we have to take a scale average and apply that instead.
         * We could potentially improve the outcome of this by incorporating the ratio between
         * the two scales.
         */
        const averageScale = mixNumber$1(xScale, yScale, 0.5);
        // Blur
        if (typeof shadow[2 + offset] === "number")
            shadow[2 + offset] /= averageScale;
        // Spread
        if (typeof shadow[3 + offset] === "number")
            shadow[3 + offset] /= averageScale;
        return template(shadow);
    },
};

const scaleCorrectors = {};
function addScaleCorrector(correctors) {
    Object.assign(scaleCorrectors, correctors);
}

const { schedule: microtask, cancel: cancelMicrotask } = createRenderBatcher(queueMicrotask, false);

class MeasureLayoutWithContext extends Component {
    /**
     * This only mounts projection nodes for components that
     * need measuring, we might want to do it for all components
     * in order to incorporate transforms
     */
    componentDidMount() {
        const { visualElement, layoutGroup, switchLayoutGroup, layoutId } = this.props;
        const { projection } = visualElement;
        addScaleCorrector(defaultScaleCorrectors);
        if (projection) {
            if (layoutGroup.group)
                layoutGroup.group.add(projection);
            if (switchLayoutGroup && switchLayoutGroup.register && layoutId) {
                switchLayoutGroup.register(projection);
            }
            projection.root.didUpdate();
            projection.addEventListener("animationComplete", () => {
                this.safeToRemove();
            });
            projection.setOptions({
                ...projection.options,
                onExitComplete: () => this.safeToRemove(),
            });
        }
        globalProjectionState.hasEverUpdated = true;
    }
    getSnapshotBeforeUpdate(prevProps) {
        const { layoutDependency, visualElement, drag, isPresent } = this.props;
        const projection = visualElement.projection;
        if (!projection)
            return null;
        /**
         * TODO: We use this data in relegate to determine whether to
         * promote a previous element. There's no guarantee its presence data
         * will have updated by this point - if a bug like this arises it will
         * have to be that we markForRelegation and then find a new lead some other way,
         * perhaps in didUpdate
         */
        projection.isPresent = isPresent;
        if (drag ||
            prevProps.layoutDependency !== layoutDependency ||
            layoutDependency === undefined) {
            projection.willUpdate();
        }
        else {
            this.safeToRemove();
        }
        if (prevProps.isPresent !== isPresent) {
            if (isPresent) {
                projection.promote();
            }
            else if (!projection.relegate()) {
                /**
                 * If there's another stack member taking over from this one,
                 * it's in charge of the exit animation and therefore should
                 * be in charge of the safe to remove. Otherwise we call it here.
                 */
                frame.postRender(() => {
                    const stack = projection.getStack();
                    if (!stack || !stack.members.length) {
                        this.safeToRemove();
                    }
                });
            }
        }
        return null;
    }
    componentDidUpdate() {
        const { projection } = this.props.visualElement;
        if (projection) {
            projection.root.didUpdate();
            microtask.postRender(() => {
                if (!projection.currentAnimation && projection.isLead()) {
                    this.safeToRemove();
                }
            });
        }
    }
    componentWillUnmount() {
        const { visualElement, layoutGroup, switchLayoutGroup: promoteContext, } = this.props;
        const { projection } = visualElement;
        if (projection) {
            projection.scheduleCheckAfterUnmount();
            if (layoutGroup && layoutGroup.group)
                layoutGroup.group.remove(projection);
            if (promoteContext && promoteContext.deregister)
                promoteContext.deregister(projection);
        }
    }
    safeToRemove() {
        const { safeToRemove } = this.props;
        safeToRemove && safeToRemove();
    }
    render() {
        return null;
    }
}
function MeasureLayout(props) {
    const [isPresent, safeToRemove] = usePresence();
    const layoutGroup = useContext(LayoutGroupContext);
    return (jsx(MeasureLayoutWithContext, { ...props, layoutGroup: layoutGroup, switchLayoutGroup: useContext(SwitchLayoutGroupContext), isPresent: isPresent, safeToRemove: safeToRemove }));
}
const defaultScaleCorrectors = {
    borderRadius: {
        ...correctBorderRadius,
        applyTo: [
            "borderTopLeftRadius",
            "borderTopRightRadius",
            "borderBottomLeftRadius",
            "borderBottomRightRadius",
        ],
    },
    borderTopLeftRadius: correctBorderRadius,
    borderTopRightRadius: correctBorderRadius,
    borderBottomLeftRadius: correctBorderRadius,
    borderBottomRightRadius: correctBorderRadius,
    boxShadow: correctBoxShadow,
};

const borders = ["TopLeft", "TopRight", "BottomLeft", "BottomRight"];
const numBorders = borders.length;
const asNumber = (value) => typeof value === "string" ? parseFloat(value) : value;
const isPx = (value) => typeof value === "number" || px.test(value);
function mixValues(target, follow, lead, progress, shouldCrossfadeOpacity, isOnlyMember) {
    if (shouldCrossfadeOpacity) {
        target.opacity = mixNumber$1(0, 
        // TODO Reinstate this if only child
        lead.opacity !== undefined ? lead.opacity : 1, easeCrossfadeIn(progress));
        target.opacityExit = mixNumber$1(follow.opacity !== undefined ? follow.opacity : 1, 0, easeCrossfadeOut(progress));
    }
    else if (isOnlyMember) {
        target.opacity = mixNumber$1(follow.opacity !== undefined ? follow.opacity : 1, lead.opacity !== undefined ? lead.opacity : 1, progress);
    }
    /**
     * Mix border radius
     */
    for (let i = 0; i < numBorders; i++) {
        const borderLabel = `border${borders[i]}Radius`;
        let followRadius = getRadius(follow, borderLabel);
        let leadRadius = getRadius(lead, borderLabel);
        if (followRadius === undefined && leadRadius === undefined)
            continue;
        followRadius || (followRadius = 0);
        leadRadius || (leadRadius = 0);
        const canMix = followRadius === 0 ||
            leadRadius === 0 ||
            isPx(followRadius) === isPx(leadRadius);
        if (canMix) {
            target[borderLabel] = Math.max(mixNumber$1(asNumber(followRadius), asNumber(leadRadius), progress), 0);
            if (percent.test(leadRadius) || percent.test(followRadius)) {
                target[borderLabel] += "%";
            }
        }
        else {
            target[borderLabel] = leadRadius;
        }
    }
    /**
     * Mix rotation
     */
    if (follow.rotate || lead.rotate) {
        target.rotate = mixNumber$1(follow.rotate || 0, lead.rotate || 0, progress);
    }
}
function getRadius(values, radiusName) {
    return values[radiusName] !== undefined
        ? values[radiusName]
        : values.borderRadius;
}
// /**
//  * We only want to mix the background color if there's a follow element
//  * that we're not crossfading opacity between. For instance with switch
//  * AnimateSharedLayout animations, this helps the illusion of a continuous
//  * element being animated but also cuts down on the number of paints triggered
//  * for elements where opacity is doing that work for us.
//  */
// if (
//     !hasFollowElement &&
//     latestLeadValues.backgroundColor &&
//     latestFollowValues.backgroundColor
// ) {
//     /**
//      * This isn't ideal performance-wise as mixColor is creating a new function every frame.
//      * We could probably create a mixer that runs at the start of the animation but
//      * the idea behind the crossfader is that it runs dynamically between two potentially
//      * changing targets (ie opacity or borderRadius may be animating independently via variants)
//      */
//     leadState.backgroundColor = followState.backgroundColor = mixColor(
//         latestFollowValues.backgroundColor as string,
//         latestLeadValues.backgroundColor as string
//     )(p)
// }
const easeCrossfadeIn = /*@__PURE__*/ compress(0, 0.5, circOut);
const easeCrossfadeOut = /*@__PURE__*/ compress(0.5, 0.95, noop$1);
function compress(min, max, easing) {
    return (p) => {
        // Could replace ifs with clamp
        if (p < min)
            return 0;
        if (p > max)
            return 1;
        return easing(progress(min, max, p));
    };
}

/**
 * Reset an axis to the provided origin box.
 *
 * This is a mutative operation.
 */
function copyAxisInto(axis, originAxis) {
    axis.min = originAxis.min;
    axis.max = originAxis.max;
}
/**
 * Reset a box to the provided origin box.
 *
 * This is a mutative operation.
 */
function copyBoxInto(box, originBox) {
    copyAxisInto(box.x, originBox.x);
    copyAxisInto(box.y, originBox.y);
}
/**
 * Reset a delta to the provided origin box.
 *
 * This is a mutative operation.
 */
function copyAxisDeltaInto(delta, originDelta) {
    delta.translate = originDelta.translate;
    delta.scale = originDelta.scale;
    delta.originPoint = originDelta.originPoint;
    delta.origin = originDelta.origin;
}

/**
 * Remove a delta from a point. This is essentially the steps of applyPointDelta in reverse
 */
function removePointDelta(point, translate, scale, originPoint, boxScale) {
    point -= translate;
    point = scalePoint(point, 1 / scale, originPoint);
    if (boxScale !== undefined) {
        point = scalePoint(point, 1 / boxScale, originPoint);
    }
    return point;
}
/**
 * Remove a delta from an axis. This is essentially the steps of applyAxisDelta in reverse
 */
function removeAxisDelta(axis, translate = 0, scale = 1, origin = 0.5, boxScale, originAxis = axis, sourceAxis = axis) {
    if (percent.test(translate)) {
        translate = parseFloat(translate);
        const relativeProgress = mixNumber$1(sourceAxis.min, sourceAxis.max, translate / 100);
        translate = relativeProgress - sourceAxis.min;
    }
    if (typeof translate !== "number")
        return;
    let originPoint = mixNumber$1(originAxis.min, originAxis.max, origin);
    if (axis === originAxis)
        originPoint -= translate;
    axis.min = removePointDelta(axis.min, translate, scale, originPoint, boxScale);
    axis.max = removePointDelta(axis.max, translate, scale, originPoint, boxScale);
}
/**
 * Remove a transforms from an axis. This is essentially the steps of applyAxisTransforms in reverse
 * and acts as a bridge between motion values and removeAxisDelta
 */
function removeAxisTransforms(axis, transforms, [key, scaleKey, originKey], origin, sourceAxis) {
    removeAxisDelta(axis, transforms[key], transforms[scaleKey], transforms[originKey], transforms.scale, origin, sourceAxis);
}
/**
 * The names of the motion values we want to apply as translation, scale and origin.
 */
const xKeys = ["x", "scaleX", "originX"];
const yKeys = ["y", "scaleY", "originY"];
/**
 * Remove a transforms from an box. This is essentially the steps of applyAxisBox in reverse
 * and acts as a bridge between motion values and removeAxisDelta
 */
function removeBoxTransforms(box, transforms, originBox, sourceBox) {
    removeAxisTransforms(box.x, transforms, xKeys, originBox ? originBox.x : undefined, sourceBox ? sourceBox.x : undefined);
    removeAxisTransforms(box.y, transforms, yKeys, originBox ? originBox.y : undefined, sourceBox ? sourceBox.y : undefined);
}

function isAxisDeltaZero(delta) {
    return delta.translate === 0 && delta.scale === 1;
}
function isDeltaZero(delta) {
    return isAxisDeltaZero(delta.x) && isAxisDeltaZero(delta.y);
}
function axisEquals(a, b) {
    return a.min === b.min && a.max === b.max;
}
function boxEquals(a, b) {
    return axisEquals(a.x, b.x) && axisEquals(a.y, b.y);
}
function axisEqualsRounded(a, b) {
    return (Math.round(a.min) === Math.round(b.min) &&
        Math.round(a.max) === Math.round(b.max));
}
function boxEqualsRounded(a, b) {
    return axisEqualsRounded(a.x, b.x) && axisEqualsRounded(a.y, b.y);
}
function aspectRatio(box) {
    return calcLength(box.x) / calcLength(box.y);
}
function axisDeltaEquals(a, b) {
    return (a.translate === b.translate &&
        a.scale === b.scale &&
        a.originPoint === b.originPoint);
}

class NodeStack {
    constructor() {
        this.members = [];
    }
    add(node) {
        addUniqueItem(this.members, node);
        node.scheduleRender();
    }
    remove(node) {
        removeItem(this.members, node);
        if (node === this.prevLead) {
            this.prevLead = undefined;
        }
        if (node === this.lead) {
            const prevLead = this.members[this.members.length - 1];
            if (prevLead) {
                this.promote(prevLead);
            }
        }
    }
    relegate(node) {
        const indexOfNode = this.members.findIndex((member) => node === member);
        if (indexOfNode === 0)
            return false;
        /**
         * Find the next projection node that is present
         */
        let prevLead;
        for (let i = indexOfNode; i >= 0; i--) {
            const member = this.members[i];
            if (member.isPresent !== false) {
                prevLead = member;
                break;
            }
        }
        if (prevLead) {
            this.promote(prevLead);
            return true;
        }
        else {
            return false;
        }
    }
    promote(node, preserveFollowOpacity) {
        const prevLead = this.lead;
        if (node === prevLead)
            return;
        this.prevLead = prevLead;
        this.lead = node;
        node.show();
        if (prevLead) {
            prevLead.instance && prevLead.scheduleRender();
            node.scheduleRender();
            node.resumeFrom = prevLead;
            if (preserveFollowOpacity) {
                node.resumeFrom.preserveOpacity = true;
            }
            if (prevLead.snapshot) {
                node.snapshot = prevLead.snapshot;
                node.snapshot.latestValues =
                    prevLead.animationValues || prevLead.latestValues;
            }
            if (node.root && node.root.isUpdating) {
                node.isLayoutDirty = true;
            }
            const { crossfade } = node.options;
            if (crossfade === false) {
                prevLead.hide();
            }
            /**
             * TODO:
             *   - Test border radius when previous node was deleted
             *   - boxShadow mixing
             *   - Shared between element A in scrolled container and element B (scroll stays the same or changes)
             *   - Shared between element A in transformed container and element B (transform stays the same or changes)
             *   - Shared between element A in scrolled page and element B (scroll stays the same or changes)
             * ---
             *   - Crossfade opacity of root nodes
             *   - layoutId changes after animation
             *   - layoutId changes mid animation
             */
        }
    }
    exitAnimationComplete() {
        this.members.forEach((node) => {
            const { options, resumingFrom } = node;
            options.onExitComplete && options.onExitComplete();
            if (resumingFrom) {
                resumingFrom.options.onExitComplete &&
                    resumingFrom.options.onExitComplete();
            }
        });
    }
    scheduleRender() {
        this.members.forEach((node) => {
            node.instance && node.scheduleRender(false);
        });
    }
    /**
     * Clear any leads that have been removed this render to prevent them from being
     * used in future animations and to prevent memory leaks
     */
    removeLeadSnapshot() {
        if (this.lead && this.lead.snapshot) {
            this.lead.snapshot = undefined;
        }
    }
}

function buildProjectionTransform(delta, treeScale, latestTransform) {
    let transform = "";
    /**
     * The translations we use to calculate are always relative to the viewport coordinate space.
     * But when we apply scales, we also scale the coordinate space of an element and its children.
     * For instance if we have a treeScale (the culmination of all parent scales) of 0.5 and we need
     * to move an element 100 pixels, we actually need to move it 200 in within that scaled space.
     */
    const xTranslate = delta.x.translate / treeScale.x;
    const yTranslate = delta.y.translate / treeScale.y;
    const zTranslate = (latestTransform === null || latestTransform === void 0 ? void 0 : latestTransform.z) || 0;
    if (xTranslate || yTranslate || zTranslate) {
        transform = `translate3d(${xTranslate}px, ${yTranslate}px, ${zTranslate}px) `;
    }
    /**
     * Apply scale correction for the tree transform.
     * This will apply scale to the screen-orientated axes.
     */
    if (treeScale.x !== 1 || treeScale.y !== 1) {
        transform += `scale(${1 / treeScale.x}, ${1 / treeScale.y}) `;
    }
    if (latestTransform) {
        const { transformPerspective, rotate, rotateX, rotateY, skewX, skewY } = latestTransform;
        if (transformPerspective)
            transform = `perspective(${transformPerspective}px) ${transform}`;
        if (rotate)
            transform += `rotate(${rotate}deg) `;
        if (rotateX)
            transform += `rotateX(${rotateX}deg) `;
        if (rotateY)
            transform += `rotateY(${rotateY}deg) `;
        if (skewX)
            transform += `skewX(${skewX}deg) `;
        if (skewY)
            transform += `skewY(${skewY}deg) `;
    }
    /**
     * Apply scale to match the size of the element to the size we want it.
     * This will apply scale to the element-orientated axes.
     */
    const elementScaleX = delta.x.scale * treeScale.x;
    const elementScaleY = delta.y.scale * treeScale.y;
    if (elementScaleX !== 1 || elementScaleY !== 1) {
        transform += `scale(${elementScaleX}, ${elementScaleY})`;
    }
    return transform || "none";
}

const compareByDepth = (a, b) => a.depth - b.depth;

class FlatTree {
    constructor() {
        this.children = [];
        this.isDirty = false;
    }
    add(child) {
        addUniqueItem(this.children, child);
        this.isDirty = true;
    }
    remove(child) {
        removeItem(this.children, child);
        this.isDirty = true;
    }
    forEach(callback) {
        this.isDirty && this.children.sort(compareByDepth);
        this.isDirty = false;
        this.children.forEach(callback);
    }
}

/**
 * If the provided value is a MotionValue, this returns the actual value, otherwise just the value itself
 *
 * TODO: Remove and move to library
 */
function resolveMotionValue(value) {
    const unwrappedValue = isMotionValue(value) ? value.get() : value;
    return isCustomValue(unwrappedValue)
        ? unwrappedValue.toValue()
        : unwrappedValue;
}

/**
 * Timeout defined in ms
 */
function delay(callback, timeout) {
    const start = time.now();
    const checkElapsed = ({ timestamp }) => {
        const elapsed = timestamp - start;
        if (elapsed >= timeout) {
            cancelFrame(checkElapsed);
            callback(elapsed - timeout);
        }
    };
    frame.read(checkElapsed, true);
    return () => cancelFrame(checkElapsed);
}

function isSVGElement(element) {
    return element instanceof SVGElement && element.tagName !== "svg";
}

function animateSingleValue(value, keyframes, options) {
    const motionValue$1 = isMotionValue(value) ? value : motionValue(value);
    motionValue$1.start(animateMotionValue("", motionValue$1, keyframes, options));
    return motionValue$1.animation;
}

const metrics = {
    type: "projectionFrame",
    totalNodes: 0,
    resolvedTargetDeltas: 0,
    recalculatedProjection: 0,
};
const isDebug = typeof window !== "undefined" && window.MotionDebug !== undefined;
const transformAxes = ["", "X", "Y", "Z"];
const hiddenVisibility = { visibility: "hidden" };
/**
 * We use 1000 as the animation target as 0-1000 maps better to pixels than 0-1
 * which has a noticeable difference in spring animations
 */
const animationTarget = 1000;
let id = 0;
function resetDistortingTransform(key, visualElement, values, sharedAnimationValues) {
    const { latestValues } = visualElement;
    // Record the distorting transform and then temporarily set it to 0
    if (latestValues[key]) {
        values[key] = latestValues[key];
        visualElement.setStaticValue(key, 0);
        if (sharedAnimationValues) {
            sharedAnimationValues[key] = 0;
        }
    }
}
function cancelTreeOptimisedTransformAnimations(projectionNode) {
    projectionNode.hasCheckedOptimisedAppear = true;
    if (projectionNode.root === projectionNode)
        return;
    const { visualElement } = projectionNode.options;
    if (!visualElement)
        return;
    const appearId = getOptimisedAppearId(visualElement);
    if (window.MotionHasOptimisedAnimation(appearId, "transform")) {
        const { layout, layoutId } = projectionNode.options;
        window.MotionCancelOptimisedAnimation(appearId, "transform", frame, !(layout || layoutId));
    }
    const { parent } = projectionNode;
    if (parent && !parent.hasCheckedOptimisedAppear) {
        cancelTreeOptimisedTransformAnimations(parent);
    }
}
function createProjectionNode$1({ attachResizeListener, defaultParent, measureScroll, checkIsScrollRoot, resetTransform, }) {
    return class ProjectionNode {
        constructor(latestValues = {}, parent = defaultParent === null || defaultParent === void 0 ? void 0 : defaultParent()) {
            /**
             * A unique ID generated for every projection node.
             */
            this.id = id++;
            /**
             * An id that represents a unique session instigated by startUpdate.
             */
            this.animationId = 0;
            /**
             * A Set containing all this component's children. This is used to iterate
             * through the children.
             *
             * TODO: This could be faster to iterate as a flat array stored on the root node.
             */
            this.children = new Set();
            /**
             * Options for the node. We use this to configure what kind of layout animations
             * we should perform (if any).
             */
            this.options = {};
            /**
             * We use this to detect when its safe to shut down part of a projection tree.
             * We have to keep projecting children for scale correction and relative projection
             * until all their parents stop performing layout animations.
             */
            this.isTreeAnimating = false;
            this.isAnimationBlocked = false;
            /**
             * Flag to true if we think this layout has been changed. We can't always know this,
             * currently we set it to true every time a component renders, or if it has a layoutDependency
             * if that has changed between renders. Additionally, components can be grouped by LayoutGroup
             * and if one node is dirtied, they all are.
             */
            this.isLayoutDirty = false;
            /**
             * Flag to true if we think the projection calculations for this node needs
             * recalculating as a result of an updated transform or layout animation.
             */
            this.isProjectionDirty = false;
            /**
             * Flag to true if the layout *or* transform has changed. This then gets propagated
             * throughout the projection tree, forcing any element below to recalculate on the next frame.
             */
            this.isSharedProjectionDirty = false;
            /**
             * Flag transform dirty. This gets propagated throughout the whole tree but is only
             * respected by shared nodes.
             */
            this.isTransformDirty = false;
            /**
             * Block layout updates for instant layout transitions throughout the tree.
             */
            this.updateManuallyBlocked = false;
            this.updateBlockedByResize = false;
            /**
             * Set to true between the start of the first `willUpdate` call and the end of the `didUpdate`
             * call.
             */
            this.isUpdating = false;
            /**
             * If this is an SVG element we currently disable projection transforms
             */
            this.isSVG = false;
            /**
             * Flag to true (during promotion) if a node doing an instant layout transition needs to reset
             * its projection styles.
             */
            this.needsReset = false;
            /**
             * Flags whether this node should have its transform reset prior to measuring.
             */
            this.shouldResetTransform = false;
            /**
             * Store whether this node has been checked for optimised appear animations. As
             * effects fire bottom-up, and we want to look up the tree for appear animations,
             * this makes sure we only check each path once, stopping at nodes that
             * have already been checked.
             */
            this.hasCheckedOptimisedAppear = false;
            /**
             * An object representing the calculated contextual/accumulated/tree scale.
             * This will be used to scale calculcated projection transforms, as these are
             * calculated in screen-space but need to be scaled for elements to layoutly
             * make it to their calculated destinations.
             *
             * TODO: Lazy-init
             */
            this.treeScale = { x: 1, y: 1 };
            /**
             *
             */
            this.eventHandlers = new Map();
            this.hasTreeAnimated = false;
            // Note: Currently only running on root node
            this.updateScheduled = false;
            this.scheduleUpdate = () => this.update();
            this.projectionUpdateScheduled = false;
            this.checkUpdateFailed = () => {
                if (this.isUpdating) {
                    this.isUpdating = false;
                    this.clearAllSnapshots();
                }
            };
            /**
             * This is a multi-step process as shared nodes might be of different depths. Nodes
             * are sorted by depth order, so we need to resolve the entire tree before moving to
             * the next step.
             */
            this.updateProjection = () => {
                this.projectionUpdateScheduled = false;
                /**
                 * Reset debug counts. Manually resetting rather than creating a new
                 * object each frame.
                 */
                if (isDebug) {
                    metrics.totalNodes =
                        metrics.resolvedTargetDeltas =
                            metrics.recalculatedProjection =
                                0;
                }
                this.nodes.forEach(propagateDirtyNodes);
                this.nodes.forEach(resolveTargetDelta);
                this.nodes.forEach(calcProjection);
                this.nodes.forEach(cleanDirtyNodes);
                if (isDebug) {
                    window.MotionDebug.record(metrics);
                }
            };
            /**
             * Frame calculations
             */
            this.resolvedRelativeTargetAt = 0.0;
            this.hasProjected = false;
            this.isVisible = true;
            this.animationProgress = 0;
            /**
             * Shared layout
             */
            // TODO Only running on root node
            this.sharedNodes = new Map();
            this.latestValues = latestValues;
            this.root = parent ? parent.root || parent : this;
            this.path = parent ? [...parent.path, parent] : [];
            this.parent = parent;
            this.depth = parent ? parent.depth + 1 : 0;
            for (let i = 0; i < this.path.length; i++) {
                this.path[i].shouldResetTransform = true;
            }
            if (this.root === this)
                this.nodes = new FlatTree();
        }
        addEventListener(name, handler) {
            if (!this.eventHandlers.has(name)) {
                this.eventHandlers.set(name, new SubscriptionManager());
            }
            return this.eventHandlers.get(name).add(handler);
        }
        notifyListeners(name, ...args) {
            const subscriptionManager = this.eventHandlers.get(name);
            subscriptionManager && subscriptionManager.notify(...args);
        }
        hasListeners(name) {
            return this.eventHandlers.has(name);
        }
        /**
         * Lifecycles
         */
        mount(instance, isLayoutDirty = this.root.hasTreeAnimated) {
            if (this.instance)
                return;
            this.isSVG = isSVGElement(instance);
            this.instance = instance;
            const { layoutId, layout, visualElement } = this.options;
            if (visualElement && !visualElement.current) {
                visualElement.mount(instance);
            }
            this.root.nodes.add(this);
            this.parent && this.parent.children.add(this);
            if (isLayoutDirty && (layout || layoutId)) {
                this.isLayoutDirty = true;
            }
            if (attachResizeListener) {
                let cancelDelay;
                const resizeUnblockUpdate = () => (this.root.updateBlockedByResize = false);
                attachResizeListener(instance, () => {
                    this.root.updateBlockedByResize = true;
                    cancelDelay && cancelDelay();
                    cancelDelay = delay(resizeUnblockUpdate, 250);
                    if (globalProjectionState.hasAnimatedSinceResize) {
                        globalProjectionState.hasAnimatedSinceResize = false;
                        this.nodes.forEach(finishAnimation);
                    }
                });
            }
            if (layoutId) {
                this.root.registerSharedNode(layoutId, this);
            }
            // Only register the handler if it requires layout animation
            if (this.options.animate !== false &&
                visualElement &&
                (layoutId || layout)) {
                this.addEventListener("didUpdate", ({ delta, hasLayoutChanged, hasRelativeTargetChanged, layout: newLayout, }) => {
                    if (this.isTreeAnimationBlocked()) {
                        this.target = undefined;
                        this.relativeTarget = undefined;
                        return;
                    }
                    // TODO: Check here if an animation exists
                    const layoutTransition = this.options.transition ||
                        visualElement.getDefaultTransition() ||
                        defaultLayoutTransition;
                    const { onLayoutAnimationStart, onLayoutAnimationComplete, } = visualElement.getProps();
                    /**
                     * The target layout of the element might stay the same,
                     * but its position relative to its parent has changed.
                     */
                    const targetChanged = !this.targetLayout ||
                        !boxEqualsRounded(this.targetLayout, newLayout) ||
                        hasRelativeTargetChanged;
                    /**
                     * If the layout hasn't seemed to have changed, it might be that the
                     * element is visually in the same place in the document but its position
                     * relative to its parent has indeed changed. So here we check for that.
                     */
                    const hasOnlyRelativeTargetChanged = !hasLayoutChanged && hasRelativeTargetChanged;
                    if (this.options.layoutRoot ||
                        (this.resumeFrom && this.resumeFrom.instance) ||
                        hasOnlyRelativeTargetChanged ||
                        (hasLayoutChanged &&
                            (targetChanged || !this.currentAnimation))) {
                        if (this.resumeFrom) {
                            this.resumingFrom = this.resumeFrom;
                            this.resumingFrom.resumingFrom = undefined;
                        }
                        this.setAnimationOrigin(delta, hasOnlyRelativeTargetChanged);
                        const animationOptions = {
                            ...getValueTransition(layoutTransition, "layout"),
                            onPlay: onLayoutAnimationStart,
                            onComplete: onLayoutAnimationComplete,
                        };
                        if (visualElement.shouldReduceMotion ||
                            this.options.layoutRoot) {
                            animationOptions.delay = 0;
                            animationOptions.type = false;
                        }
                        this.startAnimation(animationOptions);
                    }
                    else {
                        /**
                         * If the layout hasn't changed and we have an animation that hasn't started yet,
                         * finish it immediately. Otherwise it will be animating from a location
                         * that was probably never commited to screen and look like a jumpy box.
                         */
                        if (!hasLayoutChanged) {
                            finishAnimation(this);
                        }
                        if (this.isLead() && this.options.onExitComplete) {
                            this.options.onExitComplete();
                        }
                    }
                    this.targetLayout = newLayout;
                });
            }
        }
        unmount() {
            this.options.layoutId && this.willUpdate();
            this.root.nodes.remove(this);
            const stack = this.getStack();
            stack && stack.remove(this);
            this.parent && this.parent.children.delete(this);
            this.instance = undefined;
            cancelFrame(this.updateProjection);
        }
        // only on the root
        blockUpdate() {
            this.updateManuallyBlocked = true;
        }
        unblockUpdate() {
            this.updateManuallyBlocked = false;
        }
        isUpdateBlocked() {
            return this.updateManuallyBlocked || this.updateBlockedByResize;
        }
        isTreeAnimationBlocked() {
            return (this.isAnimationBlocked ||
                (this.parent && this.parent.isTreeAnimationBlocked()) ||
                false);
        }
        // Note: currently only running on root node
        startUpdate() {
            if (this.isUpdateBlocked())
                return;
            this.isUpdating = true;
            this.nodes && this.nodes.forEach(resetSkewAndRotation);
            this.animationId++;
        }
        getTransformTemplate() {
            const { visualElement } = this.options;
            return visualElement && visualElement.getProps().transformTemplate;
        }
        willUpdate(shouldNotifyListeners = true) {
            this.root.hasTreeAnimated = true;
            if (this.root.isUpdateBlocked()) {
                this.options.onExitComplete && this.options.onExitComplete();
                return;
            }
            /**
             * If we're running optimised appear animations then these must be
             * cancelled before measuring the DOM. This is so we can measure
             * the true layout of the element rather than the WAAPI animation
             * which will be unaffected by the resetSkewAndRotate step.
             *
             * Note: This is a DOM write. Worst case scenario is this is sandwiched
             * between other snapshot reads which will cause unnecessary style recalculations.
             * This has to happen here though, as we don't yet know which nodes will need
             * snapshots in startUpdate(), but we only want to cancel optimised animations
             * if a layout animation measurement is actually going to be affected by them.
             */
            if (window.MotionCancelOptimisedAnimation &&
                !this.hasCheckedOptimisedAppear) {
                cancelTreeOptimisedTransformAnimations(this);
            }
            !this.root.isUpdating && this.root.startUpdate();
            if (this.isLayoutDirty)
                return;
            this.isLayoutDirty = true;
            for (let i = 0; i < this.path.length; i++) {
                const node = this.path[i];
                node.shouldResetTransform = true;
                node.updateScroll("snapshot");
                if (node.options.layoutRoot) {
                    node.willUpdate(false);
                }
            }
            const { layoutId, layout } = this.options;
            if (layoutId === undefined && !layout)
                return;
            const transformTemplate = this.getTransformTemplate();
            this.prevTransformTemplateValue = transformTemplate
                ? transformTemplate(this.latestValues, "")
                : undefined;
            this.updateSnapshot();
            shouldNotifyListeners && this.notifyListeners("willUpdate");
        }
        update() {
            this.updateScheduled = false;
            const updateWasBlocked = this.isUpdateBlocked();
            // When doing an instant transition, we skip the layout update,
            // but should still clean up the measurements so that the next
            // snapshot could be taken correctly.
            if (updateWasBlocked) {
                this.unblockUpdate();
                this.clearAllSnapshots();
                this.nodes.forEach(clearMeasurements);
                return;
            }
            if (!this.isUpdating) {
                this.nodes.forEach(clearIsLayoutDirty);
            }
            this.isUpdating = false;
            /**
             * Write
             */
            this.nodes.forEach(resetTransformStyle);
            /**
             * Read ==================
             */
            // Update layout measurements of updated children
            this.nodes.forEach(updateLayout);
            /**
             * Write
             */
            // Notify listeners that the layout is updated
            this.nodes.forEach(notifyLayoutUpdate);
            this.clearAllSnapshots();
            /**
             * Manually flush any pending updates. Ideally
             * we could leave this to the following requestAnimationFrame but this seems
             * to leave a flash of incorrectly styled content.
             */
            const now = time.now();
            frameData.delta = clamp(0, 1000 / 60, now - frameData.timestamp);
            frameData.timestamp = now;
            frameData.isProcessing = true;
            frameSteps.update.process(frameData);
            frameSteps.preRender.process(frameData);
            frameSteps.render.process(frameData);
            frameData.isProcessing = false;
        }
        didUpdate() {
            if (!this.updateScheduled) {
                this.updateScheduled = true;
                microtask.read(this.scheduleUpdate);
            }
        }
        clearAllSnapshots() {
            this.nodes.forEach(clearSnapshot);
            this.sharedNodes.forEach(removeLeadSnapshots);
        }
        scheduleUpdateProjection() {
            if (!this.projectionUpdateScheduled) {
                this.projectionUpdateScheduled = true;
                frame.preRender(this.updateProjection, false, true);
            }
        }
        scheduleCheckAfterUnmount() {
            /**
             * If the unmounting node is in a layoutGroup and did trigger a willUpdate,
             * we manually call didUpdate to give a chance to the siblings to animate.
             * Otherwise, cleanup all snapshots to prevents future nodes from reusing them.
             */
            frame.postRender(() => {
                if (this.isLayoutDirty) {
                    this.root.didUpdate();
                }
                else {
                    this.root.checkUpdateFailed();
                }
            });
        }
        /**
         * Update measurements
         */
        updateSnapshot() {
            if (this.snapshot || !this.instance)
                return;
            this.snapshot = this.measure();
        }
        updateLayout() {
            if (!this.instance)
                return;
            // TODO: Incorporate into a forwarded scroll offset
            this.updateScroll();
            if (!(this.options.alwaysMeasureLayout && this.isLead()) &&
                !this.isLayoutDirty) {
                return;
            }
            /**
             * When a node is mounted, it simply resumes from the prevLead's
             * snapshot instead of taking a new one, but the ancestors scroll
             * might have updated while the prevLead is unmounted. We need to
             * update the scroll again to make sure the layout we measure is
             * up to date.
             */
            if (this.resumeFrom && !this.resumeFrom.instance) {
                for (let i = 0; i < this.path.length; i++) {
                    const node = this.path[i];
                    node.updateScroll();
                }
            }
            const prevLayout = this.layout;
            this.layout = this.measure(false);
            this.layoutCorrected = createBox();
            this.isLayoutDirty = false;
            this.projectionDelta = undefined;
            this.notifyListeners("measure", this.layout.layoutBox);
            const { visualElement } = this.options;
            visualElement &&
                visualElement.notify("LayoutMeasure", this.layout.layoutBox, prevLayout ? prevLayout.layoutBox : undefined);
        }
        updateScroll(phase = "measure") {
            let needsMeasurement = Boolean(this.options.layoutScroll && this.instance);
            if (this.scroll &&
                this.scroll.animationId === this.root.animationId &&
                this.scroll.phase === phase) {
                needsMeasurement = false;
            }
            if (needsMeasurement) {
                const isRoot = checkIsScrollRoot(this.instance);
                this.scroll = {
                    animationId: this.root.animationId,
                    phase,
                    isRoot,
                    offset: measureScroll(this.instance),
                    wasRoot: this.scroll ? this.scroll.isRoot : isRoot,
                };
            }
        }
        resetTransform() {
            if (!resetTransform)
                return;
            const isResetRequested = this.isLayoutDirty ||
                this.shouldResetTransform ||
                this.options.alwaysMeasureLayout;
            const hasProjection = this.projectionDelta && !isDeltaZero(this.projectionDelta);
            const transformTemplate = this.getTransformTemplate();
            const transformTemplateValue = transformTemplate
                ? transformTemplate(this.latestValues, "")
                : undefined;
            const transformTemplateHasChanged = transformTemplateValue !== this.prevTransformTemplateValue;
            if (isResetRequested &&
                (hasProjection ||
                    hasTransform(this.latestValues) ||
                    transformTemplateHasChanged)) {
                resetTransform(this.instance, transformTemplateValue);
                this.shouldResetTransform = false;
                this.scheduleRender();
            }
        }
        measure(removeTransform = true) {
            const pageBox = this.measurePageBox();
            let layoutBox = this.removeElementScroll(pageBox);
            /**
             * Measurements taken during the pre-render stage
             * still have transforms applied so we remove them
             * via calculation.
             */
            if (removeTransform) {
                layoutBox = this.removeTransform(layoutBox);
            }
            roundBox(layoutBox);
            return {
                animationId: this.root.animationId,
                measuredBox: pageBox,
                layoutBox,
                latestValues: {},
                source: this.id,
            };
        }
        measurePageBox() {
            var _a;
            const { visualElement } = this.options;
            if (!visualElement)
                return createBox();
            const box = visualElement.measureViewportBox();
            const wasInScrollRoot = ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) || this.path.some(checkNodeWasScrollRoot);
            if (!wasInScrollRoot) {
                // Remove viewport scroll to give page-relative coordinates
                const { scroll } = this.root;
                if (scroll) {
                    translateAxis(box.x, scroll.offset.x);
                    translateAxis(box.y, scroll.offset.y);
                }
            }
            return box;
        }
        removeElementScroll(box) {
            var _a;
            const boxWithoutScroll = createBox();
            copyBoxInto(boxWithoutScroll, box);
            if ((_a = this.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot) {
                return boxWithoutScroll;
            }
            /**
             * Performance TODO: Keep a cumulative scroll offset down the tree
             * rather than loop back up the path.
             */
            for (let i = 0; i < this.path.length; i++) {
                const node = this.path[i];
                const { scroll, options } = node;
                if (node !== this.root && scroll && options.layoutScroll) {
                    /**
                     * If this is a new scroll root, we want to remove all previous scrolls
                     * from the viewport box.
                     */
                    if (scroll.wasRoot) {
                        copyBoxInto(boxWithoutScroll, box);
                    }
                    translateAxis(boxWithoutScroll.x, scroll.offset.x);
                    translateAxis(boxWithoutScroll.y, scroll.offset.y);
                }
            }
            return boxWithoutScroll;
        }
        applyTransform(box, transformOnly = false) {
            const withTransforms = createBox();
            copyBoxInto(withTransforms, box);
            for (let i = 0; i < this.path.length; i++) {
                const node = this.path[i];
                if (!transformOnly &&
                    node.options.layoutScroll &&
                    node.scroll &&
                    node !== node.root) {
                    transformBox(withTransforms, {
                        x: -node.scroll.offset.x,
                        y: -node.scroll.offset.y,
                    });
                }
                if (!hasTransform(node.latestValues))
                    continue;
                transformBox(withTransforms, node.latestValues);
            }
            if (hasTransform(this.latestValues)) {
                transformBox(withTransforms, this.latestValues);
            }
            return withTransforms;
        }
        removeTransform(box) {
            const boxWithoutTransform = createBox();
            copyBoxInto(boxWithoutTransform, box);
            for (let i = 0; i < this.path.length; i++) {
                const node = this.path[i];
                if (!node.instance)
                    continue;
                if (!hasTransform(node.latestValues))
                    continue;
                hasScale(node.latestValues) && node.updateSnapshot();
                const sourceBox = createBox();
                const nodeBox = node.measurePageBox();
                copyBoxInto(sourceBox, nodeBox);
                removeBoxTransforms(boxWithoutTransform, node.latestValues, node.snapshot ? node.snapshot.layoutBox : undefined, sourceBox);
            }
            if (hasTransform(this.latestValues)) {
                removeBoxTransforms(boxWithoutTransform, this.latestValues);
            }
            return boxWithoutTransform;
        }
        setTargetDelta(delta) {
            this.targetDelta = delta;
            this.root.scheduleUpdateProjection();
            this.isProjectionDirty = true;
        }
        setOptions(options) {
            this.options = {
                ...this.options,
                ...options,
                crossfade: options.crossfade !== undefined ? options.crossfade : true,
            };
        }
        clearMeasurements() {
            this.scroll = undefined;
            this.layout = undefined;
            this.snapshot = undefined;
            this.prevTransformTemplateValue = undefined;
            this.targetDelta = undefined;
            this.target = undefined;
            this.isLayoutDirty = false;
        }
        forceRelativeParentToResolveTarget() {
            if (!this.relativeParent)
                return;
            /**
             * If the parent target isn't up-to-date, force it to update.
             * This is an unfortunate de-optimisation as it means any updating relative
             * projection will cause all the relative parents to recalculate back
             * up the tree.
             */
            if (this.relativeParent.resolvedRelativeTargetAt !==
                frameData.timestamp) {
                this.relativeParent.resolveTargetDelta(true);
            }
        }
        resolveTargetDelta(forceRecalculation = false) {
            var _a;
            /**
             * Once the dirty status of nodes has been spread through the tree, we also
             * need to check if we have a shared node of a different depth that has itself
             * been dirtied.
             */
            const lead = this.getLead();
            this.isProjectionDirty || (this.isProjectionDirty = lead.isProjectionDirty);
            this.isTransformDirty || (this.isTransformDirty = lead.isTransformDirty);
            this.isSharedProjectionDirty || (this.isSharedProjectionDirty = lead.isSharedProjectionDirty);
            const isShared = Boolean(this.resumingFrom) || this !== lead;
            /**
             * We don't use transform for this step of processing so we don't
             * need to check whether any nodes have changed transform.
             */
            const canSkip = !(forceRecalculation ||
                (isShared && this.isSharedProjectionDirty) ||
                this.isProjectionDirty ||
                ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty) ||
                this.attemptToResolveRelativeTarget ||
                this.root.updateBlockedByResize);
            if (canSkip)
                return;
            const { layout, layoutId } = this.options;
            /**
             * If we have no layout, we can't perform projection, so early return
             */
            if (!this.layout || !(layout || layoutId))
                return;
            this.resolvedRelativeTargetAt = frameData.timestamp;
            /**
             * If we don't have a targetDelta but do have a layout, we can attempt to resolve
             * a relativeParent. This will allow a component to perform scale correction
             * even if no animation has started.
             */
            if (!this.targetDelta && !this.relativeTarget) {
                const relativeParent = this.getClosestProjectingParent();
                if (relativeParent &&
                    relativeParent.layout &&
                    this.animationProgress !== 1) {
                    this.relativeParent = relativeParent;
                    this.forceRelativeParentToResolveTarget();
                    this.relativeTarget = createBox();
                    this.relativeTargetOrigin = createBox();
                    calcRelativePosition(this.relativeTargetOrigin, this.layout.layoutBox, relativeParent.layout.layoutBox);
                    copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
                }
                else {
                    this.relativeParent = this.relativeTarget = undefined;
                }
            }
            /**
             * If we have no relative target or no target delta our target isn't valid
             * for this frame.
             */
            if (!this.relativeTarget && !this.targetDelta)
                return;
            /**
             * Lazy-init target data structure
             */
            if (!this.target) {
                this.target = createBox();
                this.targetWithTransforms = createBox();
            }
            /**
             * If we've got a relative box for this component, resolve it into a target relative to the parent.
             */
            if (this.relativeTarget &&
                this.relativeTargetOrigin &&
                this.relativeParent &&
                this.relativeParent.target) {
                this.forceRelativeParentToResolveTarget();
                calcRelativeBox(this.target, this.relativeTarget, this.relativeParent.target);
                /**
                 * If we've only got a targetDelta, resolve it into a target
                 */
            }
            else if (this.targetDelta) {
                if (Boolean(this.resumingFrom)) {
                    // TODO: This is creating a new object every frame
                    this.target = this.applyTransform(this.layout.layoutBox);
                }
                else {
                    copyBoxInto(this.target, this.layout.layoutBox);
                }
                applyBoxDelta(this.target, this.targetDelta);
            }
            else {
                /**
                 * If no target, use own layout as target
                 */
                copyBoxInto(this.target, this.layout.layoutBox);
            }
            /**
             * If we've been told to attempt to resolve a relative target, do so.
             */
            if (this.attemptToResolveRelativeTarget) {
                this.attemptToResolveRelativeTarget = false;
                const relativeParent = this.getClosestProjectingParent();
                if (relativeParent &&
                    Boolean(relativeParent.resumingFrom) ===
                        Boolean(this.resumingFrom) &&
                    !relativeParent.options.layoutScroll &&
                    relativeParent.target &&
                    this.animationProgress !== 1) {
                    this.relativeParent = relativeParent;
                    this.forceRelativeParentToResolveTarget();
                    this.relativeTarget = createBox();
                    this.relativeTargetOrigin = createBox();
                    calcRelativePosition(this.relativeTargetOrigin, this.target, relativeParent.target);
                    copyBoxInto(this.relativeTarget, this.relativeTargetOrigin);
                }
                else {
                    this.relativeParent = this.relativeTarget = undefined;
                }
            }
            /**
             * Increase debug counter for resolved target deltas
             */
            if (isDebug) {
                metrics.resolvedTargetDeltas++;
            }
        }
        getClosestProjectingParent() {
            if (!this.parent ||
                hasScale(this.parent.latestValues) ||
                has2DTranslate(this.parent.latestValues)) {
                return undefined;
            }
            if (this.parent.isProjecting()) {
                return this.parent;
            }
            else {
                return this.parent.getClosestProjectingParent();
            }
        }
        isProjecting() {
            return Boolean((this.relativeTarget ||
                this.targetDelta ||
                this.options.layoutRoot) &&
                this.layout);
        }
        calcProjection() {
            var _a;
            const lead = this.getLead();
            const isShared = Boolean(this.resumingFrom) || this !== lead;
            let canSkip = true;
            /**
             * If this is a normal layout animation and neither this node nor its nearest projecting
             * is dirty then we can't skip.
             */
            if (this.isProjectionDirty || ((_a = this.parent) === null || _a === void 0 ? void 0 : _a.isProjectionDirty)) {
                canSkip = false;
            }
            /**
             * If this is a shared layout animation and this node's shared projection is dirty then
             * we can't skip.
             */
            if (isShared &&
                (this.isSharedProjectionDirty || this.isTransformDirty)) {
                canSkip = false;
            }
            /**
             * If we have resolved the target this frame we must recalculate the
             * projection to ensure it visually represents the internal calculations.
             */
            if (this.resolvedRelativeTargetAt === frameData.timestamp) {
                canSkip = false;
            }
            if (canSkip)
                return;
            const { layout, layoutId } = this.options;
            /**
             * If this section of the tree isn't animating we can
             * delete our target sources for the following frame.
             */
            this.isTreeAnimating = Boolean((this.parent && this.parent.isTreeAnimating) ||
                this.currentAnimation ||
                this.pendingAnimation);
            if (!this.isTreeAnimating) {
                this.targetDelta = this.relativeTarget = undefined;
            }
            if (!this.layout || !(layout || layoutId))
                return;
            /**
             * Reset the corrected box with the latest values from box, as we're then going
             * to perform mutative operations on it.
             */
            copyBoxInto(this.layoutCorrected, this.layout.layoutBox);
            /**
             * Record previous tree scales before updating.
             */
            const prevTreeScaleX = this.treeScale.x;
            const prevTreeScaleY = this.treeScale.y;
            /**
             * Apply all the parent deltas to this box to produce the corrected box. This
             * is the layout box, as it will appear on screen as a result of the transforms of its parents.
             */
            applyTreeDeltas(this.layoutCorrected, this.treeScale, this.path, isShared);
            /**
             * If this layer needs to perform scale correction but doesn't have a target,
             * use the layout as the target.
             */
            if (lead.layout &&
                !lead.target &&
                (this.treeScale.x !== 1 || this.treeScale.y !== 1)) {
                lead.target = lead.layout.layoutBox;
                lead.targetWithTransforms = createBox();
            }
            const { target } = lead;
            if (!target) {
                /**
                 * If we don't have a target to project into, but we were previously
                 * projecting, we want to remove the stored transform and schedule
                 * a render to ensure the elements reflect the removed transform.
                 */
                if (this.prevProjectionDelta) {
                    this.createProjectionDeltas();
                    this.scheduleRender();
                }
                return;
            }
            if (!this.projectionDelta || !this.prevProjectionDelta) {
                this.createProjectionDeltas();
            }
            else {
                copyAxisDeltaInto(this.prevProjectionDelta.x, this.projectionDelta.x);
                copyAxisDeltaInto(this.prevProjectionDelta.y, this.projectionDelta.y);
            }
            /**
             * Update the delta between the corrected box and the target box before user-set transforms were applied.
             * This will allow us to calculate the corrected borderRadius and boxShadow to compensate
             * for our layout reprojection, but still allow them to be scaled correctly by the user.
             * It might be that to simplify this we may want to accept that user-set scale is also corrected
             * and we wouldn't have to keep and calc both deltas, OR we could support a user setting
             * to allow people to choose whether these styles are corrected based on just the
             * layout reprojection or the final bounding box.
             */
            calcBoxDelta(this.projectionDelta, this.layoutCorrected, target, this.latestValues);
            if (this.treeScale.x !== prevTreeScaleX ||
                this.treeScale.y !== prevTreeScaleY ||
                !axisDeltaEquals(this.projectionDelta.x, this.prevProjectionDelta.x) ||
                !axisDeltaEquals(this.projectionDelta.y, this.prevProjectionDelta.y)) {
                this.hasProjected = true;
                this.scheduleRender();
                this.notifyListeners("projectionUpdate", target);
            }
            /**
             * Increase debug counter for recalculated projections
             */
            if (isDebug) {
                metrics.recalculatedProjection++;
            }
        }
        hide() {
            this.isVisible = false;
            // TODO: Schedule render
        }
        show() {
            this.isVisible = true;
            // TODO: Schedule render
        }
        scheduleRender(notifyAll = true) {
            var _a;
            (_a = this.options.visualElement) === null || _a === void 0 ? void 0 : _a.scheduleRender();
            if (notifyAll) {
                const stack = this.getStack();
                stack && stack.scheduleRender();
            }
            if (this.resumingFrom && !this.resumingFrom.instance) {
                this.resumingFrom = undefined;
            }
        }
        createProjectionDeltas() {
            this.prevProjectionDelta = createDelta();
            this.projectionDelta = createDelta();
            this.projectionDeltaWithTransform = createDelta();
        }
        setAnimationOrigin(delta, hasOnlyRelativeTargetChanged = false) {
            const snapshot = this.snapshot;
            const snapshotLatestValues = snapshot
                ? snapshot.latestValues
                : {};
            const mixedValues = { ...this.latestValues };
            const targetDelta = createDelta();
            if (!this.relativeParent ||
                !this.relativeParent.options.layoutRoot) {
                this.relativeTarget = this.relativeTargetOrigin = undefined;
            }
            this.attemptToResolveRelativeTarget = !hasOnlyRelativeTargetChanged;
            const relativeLayout = createBox();
            const snapshotSource = snapshot ? snapshot.source : undefined;
            const layoutSource = this.layout ? this.layout.source : undefined;
            const isSharedLayoutAnimation = snapshotSource !== layoutSource;
            const stack = this.getStack();
            const isOnlyMember = !stack || stack.members.length <= 1;
            const shouldCrossfadeOpacity = Boolean(isSharedLayoutAnimation &&
                !isOnlyMember &&
                this.options.crossfade === true &&
                !this.path.some(hasOpacityCrossfade));
            this.animationProgress = 0;
            let prevRelativeTarget;
            this.mixTargetDelta = (latest) => {
                const progress = latest / 1000;
                mixAxisDelta(targetDelta.x, delta.x, progress);
                mixAxisDelta(targetDelta.y, delta.y, progress);
                this.setTargetDelta(targetDelta);
                if (this.relativeTarget &&
                    this.relativeTargetOrigin &&
                    this.layout &&
                    this.relativeParent &&
                    this.relativeParent.layout) {
                    calcRelativePosition(relativeLayout, this.layout.layoutBox, this.relativeParent.layout.layoutBox);
                    mixBox(this.relativeTarget, this.relativeTargetOrigin, relativeLayout, progress);
                    /**
                     * If this is an unchanged relative target we can consider the
                     * projection not dirty.
                     */
                    if (prevRelativeTarget &&
                        boxEquals(this.relativeTarget, prevRelativeTarget)) {
                        this.isProjectionDirty = false;
                    }
                    if (!prevRelativeTarget)
                        prevRelativeTarget = createBox();
                    copyBoxInto(prevRelativeTarget, this.relativeTarget);
                }
                if (isSharedLayoutAnimation) {
                    this.animationValues = mixedValues;
                    mixValues(mixedValues, snapshotLatestValues, this.latestValues, progress, shouldCrossfadeOpacity, isOnlyMember);
                }
                this.root.scheduleUpdateProjection();
                this.scheduleRender();
                this.animationProgress = progress;
            };
            this.mixTargetDelta(this.options.layoutRoot ? 1000 : 0);
        }
        startAnimation(options) {
            this.notifyListeners("animationStart");
            this.currentAnimation && this.currentAnimation.stop();
            if (this.resumingFrom && this.resumingFrom.currentAnimation) {
                this.resumingFrom.currentAnimation.stop();
            }
            if (this.pendingAnimation) {
                cancelFrame(this.pendingAnimation);
                this.pendingAnimation = undefined;
            }
            /**
             * Start the animation in the next frame to have a frame with progress 0,
             * where the target is the same as when the animation started, so we can
             * calculate the relative positions correctly for instant transitions.
             */
            this.pendingAnimation = frame.update(() => {
                globalProjectionState.hasAnimatedSinceResize = true;
                this.currentAnimation = animateSingleValue(0, animationTarget, {
                    ...options,
                    onUpdate: (latest) => {
                        this.mixTargetDelta(latest);
                        options.onUpdate && options.onUpdate(latest);
                    },
                    onComplete: () => {
                        options.onComplete && options.onComplete();
                        this.completeAnimation();
                    },
                });
                if (this.resumingFrom) {
                    this.resumingFrom.currentAnimation = this.currentAnimation;
                }
                this.pendingAnimation = undefined;
            });
        }
        completeAnimation() {
            if (this.resumingFrom) {
                this.resumingFrom.currentAnimation = undefined;
                this.resumingFrom.preserveOpacity = undefined;
            }
            const stack = this.getStack();
            stack && stack.exitAnimationComplete();
            this.resumingFrom =
                this.currentAnimation =
                    this.animationValues =
                        undefined;
            this.notifyListeners("animationComplete");
        }
        finishAnimation() {
            if (this.currentAnimation) {
                this.mixTargetDelta && this.mixTargetDelta(animationTarget);
                this.currentAnimation.stop();
            }
            this.completeAnimation();
        }
        applyTransformsToTarget() {
            const lead = this.getLead();
            let { targetWithTransforms, target, layout, latestValues } = lead;
            if (!targetWithTransforms || !target || !layout)
                return;
            /**
             * If we're only animating position, and this element isn't the lead element,
             * then instead of projecting into the lead box we instead want to calculate
             * a new target that aligns the two boxes but maintains the layout shape.
             */
            if (this !== lead &&
                this.layout &&
                layout &&
                shouldAnimatePositionOnly(this.options.animationType, this.layout.layoutBox, layout.layoutBox)) {
                target = this.target || createBox();
                const xLength = calcLength(this.layout.layoutBox.x);
                target.x.min = lead.target.x.min;
                target.x.max = target.x.min + xLength;
                const yLength = calcLength(this.layout.layoutBox.y);
                target.y.min = lead.target.y.min;
                target.y.max = target.y.min + yLength;
            }
            copyBoxInto(targetWithTransforms, target);
            /**
             * Apply the latest user-set transforms to the targetBox to produce the targetBoxFinal.
             * This is the final box that we will then project into by calculating a transform delta and
             * applying it to the corrected box.
             */
            transformBox(targetWithTransforms, latestValues);
            /**
             * Update the delta between the corrected box and the final target box, after
             * user-set transforms are applied to it. This will be used by the renderer to
             * create a transform style that will reproject the element from its layout layout
             * into the desired bounding box.
             */
            calcBoxDelta(this.projectionDeltaWithTransform, this.layoutCorrected, targetWithTransforms, latestValues);
        }
        registerSharedNode(layoutId, node) {
            if (!this.sharedNodes.has(layoutId)) {
                this.sharedNodes.set(layoutId, new NodeStack());
            }
            const stack = this.sharedNodes.get(layoutId);
            stack.add(node);
            const config = node.options.initialPromotionConfig;
            node.promote({
                transition: config ? config.transition : undefined,
                preserveFollowOpacity: config && config.shouldPreserveFollowOpacity
                    ? config.shouldPreserveFollowOpacity(node)
                    : undefined,
            });
        }
        isLead() {
            const stack = this.getStack();
            return stack ? stack.lead === this : true;
        }
        getLead() {
            var _a;
            const { layoutId } = this.options;
            return layoutId ? ((_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.lead) || this : this;
        }
        getPrevLead() {
            var _a;
            const { layoutId } = this.options;
            return layoutId ? (_a = this.getStack()) === null || _a === void 0 ? void 0 : _a.prevLead : undefined;
        }
        getStack() {
            const { layoutId } = this.options;
            if (layoutId)
                return this.root.sharedNodes.get(layoutId);
        }
        promote({ needsReset, transition, preserveFollowOpacity, } = {}) {
            const stack = this.getStack();
            if (stack)
                stack.promote(this, preserveFollowOpacity);
            if (needsReset) {
                this.projectionDelta = undefined;
                this.needsReset = true;
            }
            if (transition)
                this.setOptions({ transition });
        }
        relegate() {
            const stack = this.getStack();
            if (stack) {
                return stack.relegate(this);
            }
            else {
                return false;
            }
        }
        resetSkewAndRotation() {
            const { visualElement } = this.options;
            if (!visualElement)
                return;
            // If there's no detected skew or rotation values, we can early return without a forced render.
            let hasDistortingTransform = false;
            /**
             * An unrolled check for rotation values. Most elements don't have any rotation and
             * skipping the nested loop and new object creation is 50% faster.
             */
            const { latestValues } = visualElement;
            if (latestValues.z ||
                latestValues.rotate ||
                latestValues.rotateX ||
                latestValues.rotateY ||
                latestValues.rotateZ ||
                latestValues.skewX ||
                latestValues.skewY) {
                hasDistortingTransform = true;
            }
            // If there's no distorting values, we don't need to do any more.
            if (!hasDistortingTransform)
                return;
            const resetValues = {};
            if (latestValues.z) {
                resetDistortingTransform("z", visualElement, resetValues, this.animationValues);
            }
            // Check the skew and rotate value of all axes and reset to 0
            for (let i = 0; i < transformAxes.length; i++) {
                resetDistortingTransform(`rotate${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
                resetDistortingTransform(`skew${transformAxes[i]}`, visualElement, resetValues, this.animationValues);
            }
            // Force a render of this element to apply the transform with all skews and rotations
            // set to 0.
            visualElement.render();
            // Put back all the values we reset
            for (const key in resetValues) {
                visualElement.setStaticValue(key, resetValues[key]);
                if (this.animationValues) {
                    this.animationValues[key] = resetValues[key];
                }
            }
            // Schedule a render for the next frame. This ensures we won't visually
            // see the element with the reset rotate value applied.
            visualElement.scheduleRender();
        }
        getProjectionStyles(styleProp) {
            var _a, _b;
            if (!this.instance || this.isSVG)
                return undefined;
            if (!this.isVisible) {
                return hiddenVisibility;
            }
            const styles = {
                visibility: "",
            };
            const transformTemplate = this.getTransformTemplate();
            if (this.needsReset) {
                this.needsReset = false;
                styles.opacity = "";
                styles.pointerEvents =
                    resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
                styles.transform = transformTemplate
                    ? transformTemplate(this.latestValues, "")
                    : "none";
                return styles;
            }
            const lead = this.getLead();
            if (!this.projectionDelta || !this.layout || !lead.target) {
                const emptyStyles = {};
                if (this.options.layoutId) {
                    emptyStyles.opacity =
                        this.latestValues.opacity !== undefined
                            ? this.latestValues.opacity
                            : 1;
                    emptyStyles.pointerEvents =
                        resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || "";
                }
                if (this.hasProjected && !hasTransform(this.latestValues)) {
                    emptyStyles.transform = transformTemplate
                        ? transformTemplate({}, "")
                        : "none";
                    this.hasProjected = false;
                }
                return emptyStyles;
            }
            const valuesToRender = lead.animationValues || lead.latestValues;
            this.applyTransformsToTarget();
            styles.transform = buildProjectionTransform(this.projectionDeltaWithTransform, this.treeScale, valuesToRender);
            if (transformTemplate) {
                styles.transform = transformTemplate(valuesToRender, styles.transform);
            }
            const { x, y } = this.projectionDelta;
            styles.transformOrigin = `${x.origin * 100}% ${y.origin * 100}% 0`;
            if (lead.animationValues) {
                /**
                 * If the lead component is animating, assign this either the entering/leaving
                 * opacity
                 */
                styles.opacity =
                    lead === this
                        ? (_b = (_a = valuesToRender.opacity) !== null && _a !== void 0 ? _a : this.latestValues.opacity) !== null && _b !== void 0 ? _b : 1
                        : this.preserveOpacity
                            ? this.latestValues.opacity
                            : valuesToRender.opacityExit;
            }
            else {
                /**
                 * Or we're not animating at all, set the lead component to its layout
                 * opacity and other components to hidden.
                 */
                styles.opacity =
                    lead === this
                        ? valuesToRender.opacity !== undefined
                            ? valuesToRender.opacity
                            : ""
                        : valuesToRender.opacityExit !== undefined
                            ? valuesToRender.opacityExit
                            : 0;
            }
            /**
             * Apply scale correction
             */
            for (const key in scaleCorrectors) {
                if (valuesToRender[key] === undefined)
                    continue;
                const { correct, applyTo } = scaleCorrectors[key];
                /**
                 * Only apply scale correction to the value if we have an
                 * active projection transform. Otherwise these values become
                 * vulnerable to distortion if the element changes size without
                 * a corresponding layout animation.
                 */
                const corrected = styles.transform === "none"
                    ? valuesToRender[key]
                    : correct(valuesToRender[key], lead);
                if (applyTo) {
                    const num = applyTo.length;
                    for (let i = 0; i < num; i++) {
                        styles[applyTo[i]] = corrected;
                    }
                }
                else {
                    styles[key] = corrected;
                }
            }
            /**
             * Disable pointer events on follow components. This is to ensure
             * that if a follow component covers a lead component it doesn't block
             * pointer events on the lead.
             */
            if (this.options.layoutId) {
                styles.pointerEvents =
                    lead === this
                        ? resolveMotionValue(styleProp === null || styleProp === void 0 ? void 0 : styleProp.pointerEvents) || ""
                        : "none";
            }
            return styles;
        }
        clearSnapshot() {
            this.resumeFrom = this.snapshot = undefined;
        }
        // Only run on root
        resetTree() {
            this.root.nodes.forEach((node) => { var _a; return (_a = node.currentAnimation) === null || _a === void 0 ? void 0 : _a.stop(); });
            this.root.nodes.forEach(clearMeasurements);
            this.root.sharedNodes.clear();
        }
    };
}
function updateLayout(node) {
    node.updateLayout();
}
function notifyLayoutUpdate(node) {
    var _a;
    const snapshot = ((_a = node.resumeFrom) === null || _a === void 0 ? void 0 : _a.snapshot) || node.snapshot;
    if (node.isLead() &&
        node.layout &&
        snapshot &&
        node.hasListeners("didUpdate")) {
        const { layoutBox: layout, measuredBox: measuredLayout } = node.layout;
        const { animationType } = node.options;
        const isShared = snapshot.source !== node.layout.source;
        // TODO Maybe we want to also resize the layout snapshot so we don't trigger
        // animations for instance if layout="size" and an element has only changed position
        if (animationType === "size") {
            eachAxis((axis) => {
                const axisSnapshot = isShared
                    ? snapshot.measuredBox[axis]
                    : snapshot.layoutBox[axis];
                const length = calcLength(axisSnapshot);
                axisSnapshot.min = layout[axis].min;
                axisSnapshot.max = axisSnapshot.min + length;
            });
        }
        else if (shouldAnimatePositionOnly(animationType, snapshot.layoutBox, layout)) {
            eachAxis((axis) => {
                const axisSnapshot = isShared
                    ? snapshot.measuredBox[axis]
                    : snapshot.layoutBox[axis];
                const length = calcLength(layout[axis]);
                axisSnapshot.max = axisSnapshot.min + length;
                /**
                 * Ensure relative target gets resized and rerendererd
                 */
                if (node.relativeTarget && !node.currentAnimation) {
                    node.isProjectionDirty = true;
                    node.relativeTarget[axis].max =
                        node.relativeTarget[axis].min + length;
                }
            });
        }
        const layoutDelta = createDelta();
        calcBoxDelta(layoutDelta, layout, snapshot.layoutBox);
        const visualDelta = createDelta();
        if (isShared) {
            calcBoxDelta(visualDelta, node.applyTransform(measuredLayout, true), snapshot.measuredBox);
        }
        else {
            calcBoxDelta(visualDelta, layout, snapshot.layoutBox);
        }
        const hasLayoutChanged = !isDeltaZero(layoutDelta);
        let hasRelativeTargetChanged = false;
        if (!node.resumeFrom) {
            const relativeParent = node.getClosestProjectingParent();
            /**
             * If the relativeParent is itself resuming from a different element then
             * the relative snapshot is not relavent
             */
            if (relativeParent && !relativeParent.resumeFrom) {
                const { snapshot: parentSnapshot, layout: parentLayout } = relativeParent;
                if (parentSnapshot && parentLayout) {
                    const relativeSnapshot = createBox();
                    calcRelativePosition(relativeSnapshot, snapshot.layoutBox, parentSnapshot.layoutBox);
                    const relativeLayout = createBox();
                    calcRelativePosition(relativeLayout, layout, parentLayout.layoutBox);
                    if (!boxEqualsRounded(relativeSnapshot, relativeLayout)) {
                        hasRelativeTargetChanged = true;
                    }
                    if (relativeParent.options.layoutRoot) {
                        node.relativeTarget = relativeLayout;
                        node.relativeTargetOrigin = relativeSnapshot;
                        node.relativeParent = relativeParent;
                    }
                }
            }
        }
        node.notifyListeners("didUpdate", {
            layout,
            snapshot,
            delta: visualDelta,
            layoutDelta,
            hasLayoutChanged,
            hasRelativeTargetChanged,
        });
    }
    else if (node.isLead()) {
        const { onExitComplete } = node.options;
        onExitComplete && onExitComplete();
    }
    /**
     * Clearing transition
     * TODO: Investigate why this transition is being passed in as {type: false } from Framer
     * and why we need it at all
     */
    node.options.transition = undefined;
}
function propagateDirtyNodes(node) {
    /**
     * Increase debug counter for nodes encountered this frame
     */
    if (isDebug) {
        metrics.totalNodes++;
    }
    if (!node.parent)
        return;
    /**
     * If this node isn't projecting, propagate isProjectionDirty. It will have
     * no performance impact but it will allow the next child that *is* projecting
     * but *isn't* dirty to just check its parent to see if *any* ancestor needs
     * correcting.
     */
    if (!node.isProjecting()) {
        node.isProjectionDirty = node.parent.isProjectionDirty;
    }
    /**
     * Propagate isSharedProjectionDirty and isTransformDirty
     * throughout the whole tree. A future revision can take another look at
     * this but for safety we still recalcualte shared nodes.
     */
    node.isSharedProjectionDirty || (node.isSharedProjectionDirty = Boolean(node.isProjectionDirty ||
        node.parent.isProjectionDirty ||
        node.parent.isSharedProjectionDirty));
    node.isTransformDirty || (node.isTransformDirty = node.parent.isTransformDirty);
}
function cleanDirtyNodes(node) {
    node.isProjectionDirty =
        node.isSharedProjectionDirty =
            node.isTransformDirty =
                false;
}
function clearSnapshot(node) {
    node.clearSnapshot();
}
function clearMeasurements(node) {
    node.clearMeasurements();
}
function clearIsLayoutDirty(node) {
    node.isLayoutDirty = false;
}
function resetTransformStyle(node) {
    const { visualElement } = node.options;
    if (visualElement && visualElement.getProps().onBeforeLayoutMeasure) {
        visualElement.notify("BeforeLayoutMeasure");
    }
    node.resetTransform();
}
function finishAnimation(node) {
    node.finishAnimation();
    node.targetDelta = node.relativeTarget = node.target = undefined;
    node.isProjectionDirty = true;
}
function resolveTargetDelta(node) {
    node.resolveTargetDelta();
}
function calcProjection(node) {
    node.calcProjection();
}
function resetSkewAndRotation(node) {
    node.resetSkewAndRotation();
}
function removeLeadSnapshots(stack) {
    stack.removeLeadSnapshot();
}
function mixAxisDelta(output, delta, p) {
    output.translate = mixNumber$1(delta.translate, 0, p);
    output.scale = mixNumber$1(delta.scale, 1, p);
    output.origin = delta.origin;
    output.originPoint = delta.originPoint;
}
function mixAxis(output, from, to, p) {
    output.min = mixNumber$1(from.min, to.min, p);
    output.max = mixNumber$1(from.max, to.max, p);
}
function mixBox(output, from, to, p) {
    mixAxis(output.x, from.x, to.x, p);
    mixAxis(output.y, from.y, to.y, p);
}
function hasOpacityCrossfade(node) {
    return (node.animationValues && node.animationValues.opacityExit !== undefined);
}
const defaultLayoutTransition = {
    duration: 0.45,
    ease: [0.4, 0, 0.1, 1],
};
const userAgentContains = (string) => typeof navigator !== "undefined" &&
    navigator.userAgent &&
    navigator.userAgent.toLowerCase().includes(string);
/**
 * Measured bounding boxes must be rounded in Safari and
 * left untouched in Chrome, otherwise non-integer layouts within scaled-up elements
 * can appear to jump.
 */
const roundPoint = userAgentContains("applewebkit/") && !userAgentContains("chrome/")
    ? Math.round
    : noop$1;
function roundAxis(axis) {
    // Round to the nearest .5 pixels to support subpixel layouts
    axis.min = roundPoint(axis.min);
    axis.max = roundPoint(axis.max);
}
function roundBox(box) {
    roundAxis(box.x);
    roundAxis(box.y);
}
function shouldAnimatePositionOnly(animationType, snapshot, layout) {
    return (animationType === "position" ||
        (animationType === "preserve-aspect" &&
            !isNear(aspectRatio(snapshot), aspectRatio(layout), 0.2)));
}
function checkNodeWasScrollRoot(node) {
    var _a;
    return node !== node.root && ((_a = node.scroll) === null || _a === void 0 ? void 0 : _a.wasRoot);
}

const DocumentProjectionNode = createProjectionNode$1({
    attachResizeListener: (ref, notify) => addDomEvent(ref, "resize", notify),
    measureScroll: () => ({
        x: document.documentElement.scrollLeft || document.body.scrollLeft,
        y: document.documentElement.scrollTop || document.body.scrollTop,
    }),
    checkIsScrollRoot: () => true,
});

const rootProjectionNode = {
    current: undefined,
};
const HTMLProjectionNode = createProjectionNode$1({
    measureScroll: (instance) => ({
        x: instance.scrollLeft,
        y: instance.scrollTop,
    }),
    defaultParent: () => {
        if (!rootProjectionNode.current) {
            const documentNode = new DocumentProjectionNode({});
            documentNode.mount(window);
            documentNode.setOptions({ layoutScroll: true });
            rootProjectionNode.current = documentNode;
        }
        return rootProjectionNode.current;
    },
    resetTransform: (instance, value) => {
        instance.style.transform = value !== undefined ? value : "none";
    },
    checkIsScrollRoot: (instance) => Boolean(window.getComputedStyle(instance).position === "fixed"),
});

const drag = {
    pan: {
        Feature: PanGesture,
    },
    drag: {
        Feature: DragGesture,
        ProjectionNode: HTMLProjectionNode,
        MeasureLayout,
    },
};

function addHoverEvent(node, isActive) {
    const eventName = isActive ? "pointerenter" : "pointerleave";
    const callbackName = isActive ? "onHoverStart" : "onHoverEnd";
    const handleEvent = (event, info) => {
        if (event.pointerType === "touch" || isDragActive())
            return;
        const props = node.getProps();
        if (node.animationState && props.whileHover) {
            node.animationState.setActive("whileHover", isActive);
        }
        const callback = props[callbackName];
        if (callback) {
            frame.postRender(() => callback(event, info));
        }
    };
    return addPointerEvent(node.current, eventName, handleEvent, {
        passive: !node.getProps()[callbackName],
    });
}
class HoverGesture extends Feature {
    mount() {
        this.unmount = pipe(addHoverEvent(this.node, true), addHoverEvent(this.node, false));
    }
    unmount() { }
}

class FocusGesture extends Feature {
    constructor() {
        super(...arguments);
        this.isActive = false;
    }
    onFocus() {
        let isFocusVisible = false;
        /**
         * If this element doesn't match focus-visible then don't
         * apply whileHover. But, if matches throws that focus-visible
         * is not a valid selector then in that browser outline styles will be applied
         * to the element by default and we want to match that behaviour with whileFocus.
         */
        try {
            isFocusVisible = this.node.current.matches(":focus-visible");
        }
        catch (e) {
            isFocusVisible = true;
        }
        if (!isFocusVisible || !this.node.animationState)
            return;
        this.node.animationState.setActive("whileFocus", true);
        this.isActive = true;
    }
    onBlur() {
        if (!this.isActive || !this.node.animationState)
            return;
        this.node.animationState.setActive("whileFocus", false);
        this.isActive = false;
    }
    mount() {
        this.unmount = pipe(addDomEvent(this.node.current, "focus", () => this.onFocus()), addDomEvent(this.node.current, "blur", () => this.onBlur()));
    }
    unmount() { }
}

/**
 * Recursively traverse up the tree to check whether the provided child node
 * is the parent or a descendant of it.
 *
 * @param parent - Element to find
 * @param child - Element to test against parent
 */
const isNodeOrChild = (parent, child) => {
    if (!child) {
        return false;
    }
    else if (parent === child) {
        return true;
    }
    else {
        return isNodeOrChild(parent, child.parentElement);
    }
};

function fireSyntheticPointerEvent(name, handler) {
    if (!handler)
        return;
    const syntheticPointerEvent = new PointerEvent("pointer" + name);
    handler(syntheticPointerEvent, extractEventInfo(syntheticPointerEvent));
}
class PressGesture extends Feature {
    constructor() {
        super(...arguments);
        this.removeStartListeners = noop$1;
        this.removeEndListeners = noop$1;
        this.removeAccessibleListeners = noop$1;
        this.startPointerPress = (startEvent, startInfo) => {
            if (this.isPressing)
                return;
            this.removeEndListeners();
            const props = this.node.getProps();
            const endPointerPress = (endEvent, endInfo) => {
                if (!this.checkPressEnd())
                    return;
                const { onTap, onTapCancel, globalTapTarget } = this.node.getProps();
                /**
                 * We only count this as a tap gesture if the event.target is the same
                 * as, or a child of, this component's element
                 */
                const handler = !globalTapTarget &&
                    !isNodeOrChild(this.node.current, endEvent.target)
                    ? onTapCancel
                    : onTap;
                if (handler) {
                    frame.update(() => handler(endEvent, endInfo));
                }
            };
            const removePointerUpListener = addPointerEvent(window, "pointerup", endPointerPress, {
                passive: !(props.onTap || props["onPointerUp"]),
            });
            const removePointerCancelListener = addPointerEvent(window, "pointercancel", (cancelEvent, cancelInfo) => this.cancelPress(cancelEvent, cancelInfo), {
                passive: !(props.onTapCancel ||
                    props["onPointerCancel"]),
            });
            this.removeEndListeners = pipe(removePointerUpListener, removePointerCancelListener);
            this.startPress(startEvent, startInfo);
        };
        this.startAccessiblePress = () => {
            const handleKeydown = (keydownEvent) => {
                if (keydownEvent.key !== "Enter" || this.isPressing)
                    return;
                const handleKeyup = (keyupEvent) => {
                    if (keyupEvent.key !== "Enter" || !this.checkPressEnd())
                        return;
                    fireSyntheticPointerEvent("up", (event, info) => {
                        const { onTap } = this.node.getProps();
                        if (onTap) {
                            frame.postRender(() => onTap(event, info));
                        }
                    });
                };
                this.removeEndListeners();
                this.removeEndListeners = addDomEvent(this.node.current, "keyup", handleKeyup);
                fireSyntheticPointerEvent("down", (event, info) => {
                    this.startPress(event, info);
                });
            };
            const removeKeydownListener = addDomEvent(this.node.current, "keydown", handleKeydown);
            const handleBlur = () => {
                if (!this.isPressing)
                    return;
                fireSyntheticPointerEvent("cancel", (cancelEvent, cancelInfo) => this.cancelPress(cancelEvent, cancelInfo));
            };
            const removeBlurListener = addDomEvent(this.node.current, "blur", handleBlur);
            this.removeAccessibleListeners = pipe(removeKeydownListener, removeBlurListener);
        };
    }
    startPress(event, info) {
        this.isPressing = true;
        const { onTapStart, whileTap } = this.node.getProps();
        /**
         * Ensure we trigger animations before firing event callback
         */
        if (whileTap && this.node.animationState) {
            this.node.animationState.setActive("whileTap", true);
        }
        if (onTapStart) {
            frame.postRender(() => onTapStart(event, info));
        }
    }
    checkPressEnd() {
        this.removeEndListeners();
        this.isPressing = false;
        const props = this.node.getProps();
        if (props.whileTap && this.node.animationState) {
            this.node.animationState.setActive("whileTap", false);
        }
        return !isDragActive();
    }
    cancelPress(event, info) {
        if (!this.checkPressEnd())
            return;
        const { onTapCancel } = this.node.getProps();
        if (onTapCancel) {
            frame.postRender(() => onTapCancel(event, info));
        }
    }
    mount() {
        const props = this.node.getProps();
        const removePointerListener = addPointerEvent(props.globalTapTarget ? window : this.node.current, "pointerdown", this.startPointerPress, {
            passive: !(props.onTapStart ||
                props["onPointerStart"]),
        });
        const removeFocusListener = addDomEvent(this.node.current, "focus", this.startAccessiblePress);
        this.removeStartListeners = pipe(removePointerListener, removeFocusListener);
    }
    unmount() {
        this.removeStartListeners();
        this.removeEndListeners();
        this.removeAccessibleListeners();
    }
}

/**
 * Map an IntersectionHandler callback to an element. We only ever make one handler for one
 * element, so even though these handlers might all be triggered by different
 * observers, we can keep them in the same map.
 */
const observerCallbacks = new WeakMap();
/**
 * Multiple observers can be created for multiple element/document roots. Each with
 * different settings. So here we store dictionaries of observers to each root,
 * using serialised settings (threshold/margin) as lookup keys.
 */
const observers = new WeakMap();
const fireObserverCallback = (entry) => {
    const callback = observerCallbacks.get(entry.target);
    callback && callback(entry);
};
const fireAllObserverCallbacks = (entries) => {
    entries.forEach(fireObserverCallback);
};
function initIntersectionObserver({ root, ...options }) {
    const lookupRoot = root || document;
    /**
     * If we don't have an observer lookup map for this root, create one.
     */
    if (!observers.has(lookupRoot)) {
        observers.set(lookupRoot, {});
    }
    const rootObservers = observers.get(lookupRoot);
    const key = JSON.stringify(options);
    /**
     * If we don't have an observer for this combination of root and settings,
     * create one.
     */
    if (!rootObservers[key]) {
        rootObservers[key] = new IntersectionObserver(fireAllObserverCallbacks, { root, ...options });
    }
    return rootObservers[key];
}
function observeIntersection(element, options, callback) {
    const rootInteresectionObserver = initIntersectionObserver(options);
    observerCallbacks.set(element, callback);
    rootInteresectionObserver.observe(element);
    return () => {
        observerCallbacks.delete(element);
        rootInteresectionObserver.unobserve(element);
    };
}

const thresholdNames = {
    some: 0,
    all: 1,
};
class InViewFeature extends Feature {
    constructor() {
        super(...arguments);
        this.hasEnteredView = false;
        this.isInView = false;
    }
    startObserver() {
        this.unmount();
        const { viewport = {} } = this.node.getProps();
        const { root, margin: rootMargin, amount = "some", once } = viewport;
        const options = {
            root: root ? root.current : undefined,
            rootMargin,
            threshold: typeof amount === "number" ? amount : thresholdNames[amount],
        };
        const onIntersectionUpdate = (entry) => {
            const { isIntersecting } = entry;
            /**
             * If there's been no change in the viewport state, early return.
             */
            if (this.isInView === isIntersecting)
                return;
            this.isInView = isIntersecting;
            /**
             * Handle hasEnteredView. If this is only meant to run once, and
             * element isn't visible, early return. Otherwise set hasEnteredView to true.
             */
            if (once && !isIntersecting && this.hasEnteredView) {
                return;
            }
            else if (isIntersecting) {
                this.hasEnteredView = true;
            }
            if (this.node.animationState) {
                this.node.animationState.setActive("whileInView", isIntersecting);
            }
            /**
             * Use the latest committed props rather than the ones in scope
             * when this observer is created
             */
            const { onViewportEnter, onViewportLeave } = this.node.getProps();
            const callback = isIntersecting ? onViewportEnter : onViewportLeave;
            callback && callback(entry);
        };
        return observeIntersection(this.node.current, options, onIntersectionUpdate);
    }
    mount() {
        this.startObserver();
    }
    update() {
        if (typeof IntersectionObserver === "undefined")
            return;
        const { props, prevProps } = this.node;
        const hasOptionsChanged = ["amount", "margin", "root"].some(hasViewportOptionChanged(props, prevProps));
        if (hasOptionsChanged) {
            this.startObserver();
        }
    }
    unmount() { }
}
function hasViewportOptionChanged({ viewport = {} }, { viewport: prevViewport = {} } = {}) {
    return (name) => viewport[name] !== prevViewport[name];
}

const gestureAnimations = {
    inView: {
        Feature: InViewFeature,
    },
    tap: {
        Feature: PressGesture,
    },
    focus: {
        Feature: FocusGesture,
    },
    hover: {
        Feature: HoverGesture,
    },
};

const layout = {
    layout: {
        ProjectionNode: HTMLProjectionNode,
        MeasureLayout,
    },
};

/**
 * @public
 */
const MotionConfigContext = createContext({
    transformPagePoint: (p) => p,
    isStatic: false,
    reducedMotion: "never",
});

const MotionContext = createContext({});

const isBrowser = typeof window !== "undefined";

const useIsomorphicLayoutEffect = isBrowser ? useLayoutEffect : useEffect;

const LazyContext = createContext({ strict: false });

function useVisualElement(Component, visualState, props, createVisualElement, ProjectionNodeConstructor) {
    var _a, _b;
    const { visualElement: parent } = useContext(MotionContext);
    const lazyContext = useContext(LazyContext);
    const presenceContext = useContext(PresenceContext);
    const reducedMotionConfig = useContext(MotionConfigContext).reducedMotion;
    const visualElementRef = useRef();
    /**
     * If we haven't preloaded a renderer, check to see if we have one lazy-loaded
     */
    createVisualElement = createVisualElement || lazyContext.renderer;
    if (!visualElementRef.current && createVisualElement) {
        visualElementRef.current = createVisualElement(Component, {
            visualState,
            parent,
            props,
            presenceContext,
            blockInitialAnimation: presenceContext
                ? presenceContext.initial === false
                : false,
            reducedMotionConfig,
        });
    }
    const visualElement = visualElementRef.current;
    /**
     * Load Motion gesture and animation features. These are rendered as renderless
     * components so each feature can optionally make use of React lifecycle methods.
     */
    const initialLayoutGroupConfig = useContext(SwitchLayoutGroupContext);
    if (visualElement &&
        !visualElement.projection &&
        ProjectionNodeConstructor &&
        (visualElement.type === "html" || visualElement.type === "svg")) {
        createProjectionNode(visualElementRef.current, props, ProjectionNodeConstructor, initialLayoutGroupConfig);
    }
    const isMounted = useRef(false);
    useInsertionEffect(() => {
        /**
         * Check the component has already mounted before calling
         * `update` unnecessarily. This ensures we skip the initial update.
         */
        if (visualElement && isMounted.current) {
            visualElement.update(props, presenceContext);
        }
    });
    /**
     * Cache this value as we want to know whether HandoffAppearAnimations
     * was present on initial render - it will be deleted after this.
     */
    const optimisedAppearId = props[optimizedAppearDataAttribute];
    const wantsHandoff = useRef(Boolean(optimisedAppearId) &&
        !((_a = window.MotionHandoffIsComplete) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId)) &&
        ((_b = window.MotionHasOptimisedAnimation) === null || _b === void 0 ? void 0 : _b.call(window, optimisedAppearId)));
    useIsomorphicLayoutEffect(() => {
        if (!visualElement)
            return;
        isMounted.current = true;
        window.MotionIsMounted = true;
        visualElement.updateFeatures();
        microtask.render(visualElement.render);
        /**
         * Ideally this function would always run in a useEffect.
         *
         * However, if we have optimised appear animations to handoff from,
         * it needs to happen synchronously to ensure there's no flash of
         * incorrect styles in the event of a hydration error.
         *
         * So if we detect a situtation where optimised appear animations
         * are running, we use useLayoutEffect to trigger animations.
         */
        if (wantsHandoff.current && visualElement.animationState) {
            visualElement.animationState.animateChanges();
        }
    });
    useEffect(() => {
        if (!visualElement)
            return;
        if (!wantsHandoff.current && visualElement.animationState) {
            visualElement.animationState.animateChanges();
        }
        if (wantsHandoff.current) {
            // This ensures all future calls to animateChanges() in this component will run in useEffect
            queueMicrotask(() => {
                var _a;
                (_a = window.MotionHandoffMarkAsComplete) === null || _a === void 0 ? void 0 : _a.call(window, optimisedAppearId);
            });
            wantsHandoff.current = false;
        }
    });
    return visualElement;
}
function createProjectionNode(visualElement, props, ProjectionNodeConstructor, initialPromotionConfig) {
    const { layoutId, layout, drag, dragConstraints, layoutScroll, layoutRoot, } = props;
    visualElement.projection = new ProjectionNodeConstructor(visualElement.latestValues, props["data-framer-portal-id"]
        ? undefined
        : getClosestProjectingNode(visualElement.parent));
    visualElement.projection.setOptions({
        layoutId,
        layout,
        alwaysMeasureLayout: Boolean(drag) || (dragConstraints && isRefObject(dragConstraints)),
        visualElement,
        /**
         * TODO: Update options in an effect. This could be tricky as it'll be too late
         * to update by the time layout animations run.
         * We also need to fix this safeToRemove by linking it up to the one returned by usePresence,
         * ensuring it gets called if there's no potential layout animations.
         *
         */
        animationType: typeof layout === "string" ? layout : "both",
        initialPromotionConfig,
        layoutScroll,
        layoutRoot,
    });
}
function getClosestProjectingNode(visualElement) {
    if (!visualElement)
        return undefined;
    return visualElement.options.allowProjection !== false
        ? visualElement.projection
        : getClosestProjectingNode(visualElement.parent);
}

/**
 * Creates a ref function that, when called, hydrates the provided
 * external ref and VisualElement.
 */
function useMotionRef(visualState, visualElement, externalRef) {
    return useCallback((instance) => {
        instance && visualState.mount && visualState.mount(instance);
        if (visualElement) {
            if (instance) {
                visualElement.mount(instance);
            }
            else {
                visualElement.unmount();
            }
        }
        if (externalRef) {
            if (typeof externalRef === "function") {
                externalRef(instance);
            }
            else if (isRefObject(externalRef)) {
                externalRef.current = instance;
            }
        }
    }, 
    /**
     * Only pass a new ref callback to React if we've received a visual element
     * factory. Otherwise we'll be mounting/remounting every time externalRef
     * or other dependencies change.
     */
    [visualElement]);
}

function isControllingVariants(props) {
    return (isAnimationControls(props.animate) ||
        variantProps.some((name) => isVariantLabel(props[name])));
}
function isVariantNode(props) {
    return Boolean(isControllingVariants(props) || props.variants);
}

function getCurrentTreeVariants(props, context) {
    if (isControllingVariants(props)) {
        const { initial, animate } = props;
        return {
            initial: initial === false || isVariantLabel(initial)
                ? initial
                : undefined,
            animate: isVariantLabel(animate) ? animate : undefined,
        };
    }
    return props.inherit !== false ? context : {};
}

function useCreateMotionContext(props) {
    const { initial, animate } = getCurrentTreeVariants(props, useContext(MotionContext));
    return useMemo(() => ({ initial, animate }), [variantLabelsAsDependency(initial), variantLabelsAsDependency(animate)]);
}
function variantLabelsAsDependency(prop) {
    return Array.isArray(prop) ? prop.join(" ") : prop;
}

const featureProps = {
    animation: [
        "animate",
        "variants",
        "whileHover",
        "whileTap",
        "exit",
        "whileInView",
        "whileFocus",
        "whileDrag",
    ],
    exit: ["exit"],
    drag: ["drag", "dragControls"],
    focus: ["whileFocus"],
    hover: ["whileHover", "onHoverStart", "onHoverEnd"],
    tap: ["whileTap", "onTap", "onTapStart", "onTapCancel"],
    pan: ["onPan", "onPanStart", "onPanSessionStart", "onPanEnd"],
    inView: ["whileInView", "onViewportEnter", "onViewportLeave"],
    layout: ["layout", "layoutId"],
};
const featureDefinitions = {};
for (const key in featureProps) {
    featureDefinitions[key] = {
        isEnabled: (props) => featureProps[key].some((name) => !!props[name]),
    };
}

function loadFeatures(features) {
    for (const key in features) {
        featureDefinitions[key] = {
            ...featureDefinitions[key],
            ...features[key],
        };
    }
}

const motionComponentSymbol = Symbol.for("motionComponentSymbol");

/**
 * Create a `motion` component.
 *
 * This function accepts a Component argument, which can be either a string (ie "div"
 * for `motion.div`), or an actual React component.
 *
 * Alongside this is a config option which provides a way of rendering the provided
 * component "offline", or outside the React render cycle.
 */
function createRendererMotionComponent({ preloadedFeatures, createVisualElement, useRender, useVisualState, Component, }) {
    preloadedFeatures && loadFeatures(preloadedFeatures);
    function MotionComponent(props, externalRef) {
        /**
         * If we need to measure the element we load this functionality in a
         * separate class component in order to gain access to getSnapshotBeforeUpdate.
         */
        let MeasureLayout;
        const configAndProps = {
            ...useContext(MotionConfigContext),
            ...props,
            layoutId: useLayoutId(props),
        };
        const { isStatic } = configAndProps;
        const context = useCreateMotionContext(props);
        const visualState = useVisualState(props, isStatic);
        if (!isStatic && isBrowser) {
            useStrictMode(configAndProps, preloadedFeatures);
            const layoutProjection = getProjectionFunctionality(configAndProps);
            MeasureLayout = layoutProjection.MeasureLayout;
            /**
             * Create a VisualElement for this component. A VisualElement provides a common
             * interface to renderer-specific APIs (ie DOM/Three.js etc) as well as
             * providing a way of rendering to these APIs outside of the React render loop
             * for more performant animations and interactions
             */
            context.visualElement = useVisualElement(Component, visualState, configAndProps, createVisualElement, layoutProjection.ProjectionNode);
        }
        /**
         * The mount order and hierarchy is specific to ensure our element ref
         * is hydrated by the time features fire their effects.
         */
        return (jsxs(MotionContext.Provider, { value: context, children: [MeasureLayout && context.visualElement ? (jsx(MeasureLayout, { visualElement: context.visualElement, ...configAndProps })) : null, useRender(Component, props, useMotionRef(visualState, context.visualElement, externalRef), visualState, isStatic, context.visualElement)] }));
    }
    const ForwardRefMotionComponent = forwardRef(MotionComponent);
    ForwardRefMotionComponent[motionComponentSymbol] = Component;
    return ForwardRefMotionComponent;
}
function useLayoutId({ layoutId }) {
    const layoutGroupId = useContext(LayoutGroupContext).id;
    return layoutGroupId && layoutId !== undefined
        ? layoutGroupId + "-" + layoutId
        : layoutId;
}
function useStrictMode(configAndProps, preloadedFeatures) {
    const isStrict = useContext(LazyContext).strict;
    /**
     * If we're in development mode, check to make sure we're not rendering a motion component
     * as a child of LazyMotion, as this will break the file-size benefits of using it.
     */
    if (process.env.NODE_ENV !== "production" &&
        preloadedFeatures &&
        isStrict) {
        const strictMessage = "You have rendered a `motion` component within a `LazyMotion` component. This will break tree shaking. Import and render a `m` component instead.";
        configAndProps.ignoreStrict
            ? warning(false, strictMessage)
            : invariant(false, strictMessage);
    }
}
function getProjectionFunctionality(props) {
    const { drag, layout } = featureDefinitions;
    if (!drag && !layout)
        return {};
    const combined = { ...drag, ...layout };
    return {
        MeasureLayout: (drag === null || drag === void 0 ? void 0 : drag.isEnabled(props)) || (layout === null || layout === void 0 ? void 0 : layout.isEnabled(props))
            ? combined.MeasureLayout
            : undefined,
        ProjectionNode: combined.ProjectionNode,
    };
}

/**
 * We keep these listed separately as we use the lowercase tag names as part
 * of the runtime bundle to detect SVG components
 */
const lowercaseSVGElements = [
    "animate",
    "circle",
    "defs",
    "desc",
    "ellipse",
    "g",
    "image",
    "line",
    "filter",
    "marker",
    "mask",
    "metadata",
    "path",
    "pattern",
    "polygon",
    "polyline",
    "rect",
    "stop",
    "switch",
    "symbol",
    "svg",
    "text",
    "tspan",
    "use",
    "view",
];

function isSVGComponent(Component) {
    if (
    /**
     * If it's not a string, it's a custom React component. Currently we only support
     * HTML custom React components.
     */
    typeof Component !== "string" ||
        /**
         * If it contains a dash, the element is a custom HTML webcomponent.
         */
        Component.includes("-")) {
        return false;
    }
    else if (
    /**
     * If it's in our list of lowercase SVG tags, it's an SVG component
     */
    lowercaseSVGElements.indexOf(Component) > -1 ||
        /**
         * If it contains a capital letter, it's an SVG component
         */
        /[A-Z]/u.test(Component)) {
        return true;
    }
    return false;
}

function renderHTML(element, { style, vars }, styleProp, projection) {
    Object.assign(element.style, style, projection && projection.getProjectionStyles(styleProp));
    // Loop over any CSS variables and assign those.
    for (const key in vars) {
        element.style.setProperty(key, vars[key]);
    }
}

/**
 * A set of attribute names that are always read/written as camel case.
 */
const camelCaseAttributes = new Set([
    "baseFrequency",
    "diffuseConstant",
    "kernelMatrix",
    "kernelUnitLength",
    "keySplines",
    "keyTimes",
    "limitingConeAngle",
    "markerHeight",
    "markerWidth",
    "numOctaves",
    "targetX",
    "targetY",
    "surfaceScale",
    "specularConstant",
    "specularExponent",
    "stdDeviation",
    "tableValues",
    "viewBox",
    "gradientTransform",
    "pathLength",
    "startOffset",
    "textLength",
    "lengthAdjust",
]);

function renderSVG(element, renderState, _styleProp, projection) {
    renderHTML(element, renderState, undefined, projection);
    for (const key in renderState.attrs) {
        element.setAttribute(!camelCaseAttributes.has(key) ? camelToDash(key) : key, renderState.attrs[key]);
    }
}

function isForcedMotionValue(key, { layout, layoutId }) {
    return (transformProps.has(key) ||
        key.startsWith("origin") ||
        ((layout || layoutId !== undefined) &&
            (!!scaleCorrectors[key] || key === "opacity")));
}

function scrapeMotionValuesFromProps$1(props, prevProps, visualElement) {
    var _a;
    const { style } = props;
    const newValues = {};
    for (const key in style) {
        if (isMotionValue(style[key]) ||
            (prevProps.style &&
                isMotionValue(prevProps.style[key])) ||
            isForcedMotionValue(key, props) ||
            ((_a = visualElement === null || visualElement === void 0 ? void 0 : visualElement.getValue(key)) === null || _a === void 0 ? void 0 : _a.liveStyle) !== undefined) {
            newValues[key] = style[key];
        }
    }
    return newValues;
}

function scrapeMotionValuesFromProps(props, prevProps, visualElement) {
    const newValues = scrapeMotionValuesFromProps$1(props, prevProps, visualElement);
    for (const key in props) {
        if (isMotionValue(props[key]) ||
            isMotionValue(prevProps[key])) {
            const targetKey = transformPropOrder.indexOf(key) !== -1
                ? "attr" + key.charAt(0).toUpperCase() + key.substring(1)
                : key;
            newValues[targetKey] = props[key];
        }
    }
    return newValues;
}

/**
 * Creates a constant value over the lifecycle of a component.
 *
 * Even if `useMemo` is provided an empty array as its final argument, it doesn't offer
 * a guarantee that it won't re-run for performance reasons later on. By using `useConstant`
 * you can ensure that initialisers don't execute twice or more.
 */
function useConstant(init) {
    const ref = useRef(null);
    if (ref.current === null) {
        ref.current = init();
    }
    return ref.current;
}

function makeState({ scrapeMotionValuesFromProps, createRenderState, onMount, }, props, context, presenceContext) {
    const state = {
        latestValues: makeLatestValues(props, context, presenceContext, scrapeMotionValuesFromProps),
        renderState: createRenderState(),
    };
    if (onMount) {
        state.mount = (instance) => onMount(props, instance, state);
    }
    return state;
}
const makeUseVisualState = (config) => (props, isStatic) => {
    const context = useContext(MotionContext);
    const presenceContext = useContext(PresenceContext);
    const make = () => makeState(config, props, context, presenceContext);
    return isStatic ? make() : useConstant(make);
};
function makeLatestValues(props, context, presenceContext, scrapeMotionValues) {
    const values = {};
    const motionValues = scrapeMotionValues(props, {});
    for (const key in motionValues) {
        values[key] = resolveMotionValue(motionValues[key]);
    }
    let { initial, animate } = props;
    const isControllingVariants$1 = isControllingVariants(props);
    const isVariantNode$1 = isVariantNode(props);
    if (context &&
        isVariantNode$1 &&
        !isControllingVariants$1 &&
        props.inherit !== false) {
        if (initial === undefined)
            initial = context.initial;
        if (animate === undefined)
            animate = context.animate;
    }
    let isInitialAnimationBlocked = presenceContext
        ? presenceContext.initial === false
        : false;
    isInitialAnimationBlocked = isInitialAnimationBlocked || initial === false;
    const variantToSet = isInitialAnimationBlocked ? animate : initial;
    if (variantToSet &&
        typeof variantToSet !== "boolean" &&
        !isAnimationControls(variantToSet)) {
        const list = Array.isArray(variantToSet) ? variantToSet : [variantToSet];
        for (let i = 0; i < list.length; i++) {
            const resolved = resolveVariantFromProps(props, list[i]);
            if (resolved) {
                const { transitionEnd, transition, ...target } = resolved;
                for (const key in target) {
                    let valueTarget = target[key];
                    if (Array.isArray(valueTarget)) {
                        /**
                         * Take final keyframe if the initial animation is blocked because
                         * we want to initialise at the end of that blocked animation.
                         */
                        const index = isInitialAnimationBlocked
                            ? valueTarget.length - 1
                            : 0;
                        valueTarget = valueTarget[index];
                    }
                    if (valueTarget !== null) {
                        values[key] = valueTarget;
                    }
                }
                for (const key in transitionEnd) {
                    values[key] = transitionEnd[key];
                }
            }
        }
    }
    return values;
}

const createHtmlRenderState = () => ({
    style: {},
    transform: {},
    transformOrigin: {},
    vars: {},
});

const createSvgRenderState = () => ({
    ...createHtmlRenderState(),
    attrs: {},
});

/**
 * Provided a value and a ValueType, returns the value as that value type.
 */
const getValueAsType = (value, type) => {
    return type && typeof value === "number"
        ? type.transform(value)
        : value;
};

const translateAlias = {
    x: "translateX",
    y: "translateY",
    z: "translateZ",
    transformPerspective: "perspective",
};
const numTransforms = transformPropOrder.length;
/**
 * Build a CSS transform style from individual x/y/scale etc properties.
 *
 * This outputs with a default order of transforms/scales/rotations, this can be customised by
 * providing a transformTemplate function.
 */
function buildTransform(latestValues, transform, transformTemplate) {
    // The transform string we're going to build into.
    let transformString = "";
    let transformIsDefault = true;
    /**
     * Loop over all possible transforms in order, adding the ones that
     * are present to the transform string.
     */
    for (let i = 0; i < numTransforms; i++) {
        const key = transformPropOrder[i];
        const value = latestValues[key];
        if (value === undefined)
            continue;
        let valueIsDefault = true;
        if (typeof value === "number") {
            valueIsDefault = value === (key.startsWith("scale") ? 1 : 0);
        }
        else {
            valueIsDefault = parseFloat(value) === 0;
        }
        if (!valueIsDefault || transformTemplate) {
            const valueAsType = getValueAsType(value, numberValueTypes[key]);
            if (!valueIsDefault) {
                transformIsDefault = false;
                const transformName = translateAlias[key] || key;
                transformString += `${transformName}(${valueAsType}) `;
            }
            if (transformTemplate) {
                transform[key] = valueAsType;
            }
        }
    }
    transformString = transformString.trim();
    // If we have a custom `transform` template, pass our transform values and
    // generated transformString to that before returning
    if (transformTemplate) {
        transformString = transformTemplate(transform, transformIsDefault ? "" : transformString);
    }
    else if (transformIsDefault) {
        transformString = "none";
    }
    return transformString;
}

function buildHTMLStyles(state, latestValues, transformTemplate) {
    const { style, vars, transformOrigin } = state;
    // Track whether we encounter any transform or transformOrigin values.
    let hasTransform = false;
    let hasTransformOrigin = false;
    /**
     * Loop over all our latest animated values and decide whether to handle them
     * as a style or CSS variable.
     *
     * Transforms and transform origins are kept separately for further processing.
     */
    for (const key in latestValues) {
        const value = latestValues[key];
        if (transformProps.has(key)) {
            // If this is a transform, flag to enable further transform processing
            hasTransform = true;
            continue;
        }
        else if (isCSSVariableName(key)) {
            vars[key] = value;
            continue;
        }
        else {
            // Convert the value to its default value type, ie 0 -> "0px"
            const valueAsType = getValueAsType(value, numberValueTypes[key]);
            if (key.startsWith("origin")) {
                // If this is a transform origin, flag and enable further transform-origin processing
                hasTransformOrigin = true;
                transformOrigin[key] =
                    valueAsType;
            }
            else {
                style[key] = valueAsType;
            }
        }
    }
    if (!latestValues.transform) {
        if (hasTransform || transformTemplate) {
            style.transform = buildTransform(latestValues, state.transform, transformTemplate);
        }
        else if (style.transform) {
            /**
             * If we have previously created a transform but currently don't have any,
             * reset transform style to none.
             */
            style.transform = "none";
        }
    }
    /**
     * Build a transformOrigin style. Uses the same defaults as the browser for
     * undefined origins.
     */
    if (hasTransformOrigin) {
        const { originX = "50%", originY = "50%", originZ = 0, } = transformOrigin;
        style.transformOrigin = `${originX} ${originY} ${originZ}`;
    }
}

function calcOrigin(origin, offset, size) {
    return typeof origin === "string"
        ? origin
        : px.transform(offset + size * origin);
}
/**
 * The SVG transform origin defaults are different to CSS and is less intuitive,
 * so we use the measured dimensions of the SVG to reconcile these.
 */
function calcSVGTransformOrigin(dimensions, originX, originY) {
    const pxOriginX = calcOrigin(originX, dimensions.x, dimensions.width);
    const pxOriginY = calcOrigin(originY, dimensions.y, dimensions.height);
    return `${pxOriginX} ${pxOriginY}`;
}

const dashKeys = {
    offset: "stroke-dashoffset",
    array: "stroke-dasharray",
};
const camelKeys = {
    offset: "strokeDashoffset",
    array: "strokeDasharray",
};
/**
 * Build SVG path properties. Uses the path's measured length to convert
 * our custom pathLength, pathSpacing and pathOffset into stroke-dashoffset
 * and stroke-dasharray attributes.
 *
 * This function is mutative to reduce per-frame GC.
 */
function buildSVGPath(attrs, length, spacing = 1, offset = 0, useDashCase = true) {
    // Normalise path length by setting SVG attribute pathLength to 1
    attrs.pathLength = 1;
    // We use dash case when setting attributes directly to the DOM node and camel case
    // when defining props on a React component.
    const keys = useDashCase ? dashKeys : camelKeys;
    // Build the dash offset
    attrs[keys.offset] = px.transform(-offset);
    // Build the dash array
    const pathLength = px.transform(length);
    const pathSpacing = px.transform(spacing);
    attrs[keys.array] = `${pathLength} ${pathSpacing}`;
}

/**
 * Build SVG visual attrbutes, like cx and style.transform
 */
function buildSVGAttrs(state, { attrX, attrY, attrScale, originX, originY, pathLength, pathSpacing = 1, pathOffset = 0, 
// This is object creation, which we try to avoid per-frame.
...latest }, isSVGTag, transformTemplate) {
    buildHTMLStyles(state, latest, transformTemplate);
    /**
     * For svg tags we just want to make sure viewBox is animatable and treat all the styles
     * as normal HTML tags.
     */
    if (isSVGTag) {
        if (state.style.viewBox) {
            state.attrs.viewBox = state.style.viewBox;
        }
        return;
    }
    state.attrs = state.style;
    state.style = {};
    const { attrs, style, dimensions } = state;
    /**
     * However, we apply transforms as CSS transforms. So if we detect a transform we take it from attrs
     * and copy it into style.
     */
    if (attrs.transform) {
        if (dimensions)
            style.transform = attrs.transform;
        delete attrs.transform;
    }
    // Parse transformOrigin
    if (dimensions &&
        (originX !== undefined || originY !== undefined || style.transform)) {
        style.transformOrigin = calcSVGTransformOrigin(dimensions, originX !== undefined ? originX : 0.5, originY !== undefined ? originY : 0.5);
    }
    // Render attrX/attrY/attrScale as attributes
    if (attrX !== undefined)
        attrs.x = attrX;
    if (attrY !== undefined)
        attrs.y = attrY;
    if (attrScale !== undefined)
        attrs.scale = attrScale;
    // Build SVG path if one has been defined
    if (pathLength !== undefined) {
        buildSVGPath(attrs, pathLength, pathSpacing, pathOffset, false);
    }
}

const isSVGTag = (tag) => typeof tag === "string" && tag.toLowerCase() === "svg";

const svgMotionConfig = {
    useVisualState: makeUseVisualState({
        scrapeMotionValuesFromProps: scrapeMotionValuesFromProps,
        createRenderState: createSvgRenderState,
        onMount: (props, instance, { renderState, latestValues }) => {
            frame.read(() => {
                try {
                    renderState.dimensions =
                        typeof instance.getBBox ===
                            "function"
                            ? instance.getBBox()
                            : instance.getBoundingClientRect();
                }
                catch (e) {
                    // Most likely trying to measure an unrendered element under Firefox
                    renderState.dimensions = {
                        x: 0,
                        y: 0,
                        width: 0,
                        height: 0,
                    };
                }
            });
            frame.render(() => {
                buildSVGAttrs(renderState, latestValues, isSVGTag(instance.tagName), props.transformTemplate);
                renderSVG(instance, renderState);
            });
        },
    }),
};

const htmlMotionConfig = {
    useVisualState: makeUseVisualState({
        scrapeMotionValuesFromProps: scrapeMotionValuesFromProps$1,
        createRenderState: createHtmlRenderState,
    }),
};

function copyRawValuesOnly(target, source, props) {
    for (const key in source) {
        if (!isMotionValue(source[key]) && !isForcedMotionValue(key, props)) {
            target[key] = source[key];
        }
    }
}
function useInitialMotionValues({ transformTemplate }, visualState) {
    return useMemo(() => {
        const state = createHtmlRenderState();
        buildHTMLStyles(state, visualState, transformTemplate);
        return Object.assign({}, state.vars, state.style);
    }, [visualState]);
}
function useStyle(props, visualState) {
    const styleProp = props.style || {};
    const style = {};
    /**
     * Copy non-Motion Values straight into style
     */
    copyRawValuesOnly(style, styleProp, props);
    Object.assign(style, useInitialMotionValues(props, visualState));
    return style;
}
function useHTMLProps(props, visualState) {
    // The `any` isn't ideal but it is the type of createElement props argument
    const htmlProps = {};
    const style = useStyle(props, visualState);
    if (props.drag && props.dragListener !== false) {
        // Disable the ghost element when a user drags
        htmlProps.draggable = false;
        // Disable text selection
        style.userSelect =
            style.WebkitUserSelect =
                style.WebkitTouchCallout =
                    "none";
        // Disable scrolling on the draggable direction
        style.touchAction =
            props.drag === true
                ? "none"
                : `pan-${props.drag === "x" ? "y" : "x"}`;
    }
    if (props.tabIndex === undefined &&
        (props.onTap || props.onTapStart || props.whileTap)) {
        htmlProps.tabIndex = 0;
    }
    htmlProps.style = style;
    return htmlProps;
}

/**
 * A list of all valid MotionProps.
 *
 * @privateRemarks
 * This doesn't throw if a `MotionProp` name is missing - it should.
 */
const validMotionProps = new Set([
    "animate",
    "exit",
    "variants",
    "initial",
    "style",
    "values",
    "variants",
    "transition",
    "transformTemplate",
    "custom",
    "inherit",
    "onBeforeLayoutMeasure",
    "onAnimationStart",
    "onAnimationComplete",
    "onUpdate",
    "onDragStart",
    "onDrag",
    "onDragEnd",
    "onMeasureDragConstraints",
    "onDirectionLock",
    "onDragTransitionEnd",
    "_dragX",
    "_dragY",
    "onHoverStart",
    "onHoverEnd",
    "onViewportEnter",
    "onViewportLeave",
    "globalTapTarget",
    "ignoreStrict",
    "viewport",
]);
/**
 * Check whether a prop name is a valid `MotionProp` key.
 *
 * @param key - Name of the property to check
 * @returns `true` is key is a valid `MotionProp`.
 *
 * @public
 */
function isValidMotionProp(key) {
    return (key.startsWith("while") ||
        (key.startsWith("drag") && key !== "draggable") ||
        key.startsWith("layout") ||
        key.startsWith("onTap") ||
        key.startsWith("onPan") ||
        key.startsWith("onLayout") ||
        validMotionProps.has(key));
}

let shouldForward = (key) => !isValidMotionProp(key);
function loadExternalIsValidProp(isValidProp) {
    if (!isValidProp)
        return;
    // Explicitly filter our events
    shouldForward = (key) => key.startsWith("on") ? !isValidMotionProp(key) : isValidProp(key);
}
/**
 * Emotion and Styled Components both allow users to pass through arbitrary props to their components
 * to dynamically generate CSS. They both use the `@emotion/is-prop-valid` package to determine which
 * of these should be passed to the underlying DOM node.
 *
 * However, when styling a Motion component `styled(motion.div)`, both packages pass through *all* props
 * as it's seen as an arbitrary component rather than a DOM node. Motion only allows arbitrary props
 * passed through the `custom` prop so it doesn't *need* the payload or computational overhead of
 * `@emotion/is-prop-valid`, however to fix this problem we need to use it.
 *
 * By making it an optionalDependency we can offer this functionality only in the situations where it's
 * actually required.
 */
try {
    /**
     * We attempt to import this package but require won't be defined in esm environments, in that case
     * isPropValid will have to be provided via `MotionContext`. In a 6.0.0 this should probably be removed
     * in favour of explicit injection.
     */
    loadExternalIsValidProp(require("@emotion/is-prop-valid").default);
}
catch (_a) {
    // We don't need to actually do anything here - the fallback is the existing `isPropValid`.
}
function filterProps(props, isDom, forwardMotionProps) {
    const filteredProps = {};
    for (const key in props) {
        /**
         * values is considered a valid prop by Emotion, so if it's present
         * this will be rendered out to the DOM unless explicitly filtered.
         *
         * We check the type as it could be used with the `feColorMatrix`
         * element, which we support.
         */
        if (key === "values" && typeof props.values === "object")
            continue;
        if (shouldForward(key) ||
            (forwardMotionProps === true && isValidMotionProp(key)) ||
            (!isDom && !isValidMotionProp(key)) ||
            // If trying to use native HTML drag events, forward drag listeners
            (props["draggable"] &&
                key.startsWith("onDrag"))) {
            filteredProps[key] =
                props[key];
        }
    }
    return filteredProps;
}

function useSVGProps(props, visualState, _isStatic, Component) {
    const visualProps = useMemo(() => {
        const state = createSvgRenderState();
        buildSVGAttrs(state, visualState, isSVGTag(Component), props.transformTemplate);
        return {
            ...state.attrs,
            style: { ...state.style },
        };
    }, [visualState]);
    if (props.style) {
        const rawStyles = {};
        copyRawValuesOnly(rawStyles, props.style, props);
        visualProps.style = { ...rawStyles, ...visualProps.style };
    }
    return visualProps;
}

function createUseRender(forwardMotionProps = false) {
    const useRender = (Component, props, ref, { latestValues }, isStatic) => {
        const useVisualProps = isSVGComponent(Component)
            ? useSVGProps
            : useHTMLProps;
        const visualProps = useVisualProps(props, latestValues, isStatic, Component);
        const filteredProps = filterProps(props, typeof Component === "string", forwardMotionProps);
        const elementProps = Component !== Fragment$1
            ? { ...filteredProps, ...visualProps, ref }
            : {};
        /**
         * If component has been handed a motion value as its child,
         * memoise its initial value and render that. Subsequent updates
         * will be handled by the onChange handler
         */
        const { children } = props;
        const renderedChildren = useMemo(() => (isMotionValue(children) ? children.get() : children), [children]);
        return createElement(Component, {
            ...elementProps,
            children: renderedChildren,
        });
    };
    return useRender;
}

function createMotionComponentFactory(preloadedFeatures, createVisualElement) {
    return function createMotionComponent(Component, { forwardMotionProps } = { forwardMotionProps: false }) {
        const baseConfig = isSVGComponent(Component)
            ? svgMotionConfig
            : htmlMotionConfig;
        const config = {
            ...baseConfig,
            preloadedFeatures,
            useRender: createUseRender(forwardMotionProps),
            createVisualElement,
            Component,
        };
        return createRendererMotionComponent(config);
    };
}

// Does this device prefer reduced motion? Returns `null` server-side.
const prefersReducedMotion = { current: null };
const hasReducedMotionListener = { current: false };

function initPrefersReducedMotion() {
    hasReducedMotionListener.current = true;
    if (!isBrowser)
        return;
    if (window.matchMedia) {
        const motionMediaQuery = window.matchMedia("(prefers-reduced-motion)");
        const setReducedMotionPreferences = () => (prefersReducedMotion.current = motionMediaQuery.matches);
        motionMediaQuery.addListener(setReducedMotionPreferences);
        setReducedMotionPreferences();
    }
    else {
        prefersReducedMotion.current = false;
    }
}

function updateMotionValuesFromProps(element, next, prev) {
    for (const key in next) {
        const nextValue = next[key];
        const prevValue = prev[key];
        if (isMotionValue(nextValue)) {
            /**
             * If this is a motion value found in props or style, we want to add it
             * to our visual element's motion value map.
             */
            element.addValue(key, nextValue);
            /**
             * Check the version of the incoming motion value with this version
             * and warn against mismatches.
             */
            if (process.env.NODE_ENV === "development") {
                warnOnce(nextValue.version === "11.11.11", `Attempting to mix Framer Motion versions ${nextValue.version} with 11.11.11 may not work as expected.`);
            }
        }
        else if (isMotionValue(prevValue)) {
            /**
             * If we're swapping from a motion value to a static value,
             * create a new motion value from that
             */
            element.addValue(key, motionValue(nextValue, { owner: element }));
        }
        else if (prevValue !== nextValue) {
            /**
             * If this is a flat value that has changed, update the motion value
             * or create one if it doesn't exist. We only want to do this if we're
             * not handling the value with our animation state.
             */
            if (element.hasValue(key)) {
                const existingValue = element.getValue(key);
                if (existingValue.liveStyle === true) {
                    existingValue.jump(nextValue);
                }
                else if (!existingValue.hasAnimated) {
                    existingValue.set(nextValue);
                }
            }
            else {
                const latestValue = element.getStaticValue(key);
                element.addValue(key, motionValue(latestValue !== undefined ? latestValue : nextValue, { owner: element }));
            }
        }
    }
    // Handle removed values
    for (const key in prev) {
        if (next[key] === undefined)
            element.removeValue(key);
    }
    return next;
}

const visualElementStore = new WeakMap();

/**
 * A list of all ValueTypes
 */
const valueTypes = [...dimensionValueTypes, color$1, complex];
/**
 * Tests a value against the list of ValueTypes
 */
const findValueType = (v) => valueTypes.find(testValueType(v));

const propEventHandlers = [
    "AnimationStart",
    "AnimationComplete",
    "Update",
    "BeforeLayoutMeasure",
    "LayoutMeasure",
    "LayoutAnimationStart",
    "LayoutAnimationComplete",
];
/**
 * A VisualElement is an imperative abstraction around UI elements such as
 * HTMLElement, SVGElement, Three.Object3D etc.
 */
class VisualElement {
    /**
     * This method takes React props and returns found MotionValues. For example, HTML
     * MotionValues will be found within the style prop, whereas for Three.js within attribute arrays.
     *
     * This isn't an abstract method as it needs calling in the constructor, but it is
     * intended to be one.
     */
    scrapeMotionValuesFromProps(_props, _prevProps, _visualElement) {
        return {};
    }
    constructor({ parent, props, presenceContext, reducedMotionConfig, blockInitialAnimation, visualState, }, options = {}) {
        /**
         * A reference to the current underlying Instance, e.g. a HTMLElement
         * or Three.Mesh etc.
         */
        this.current = null;
        /**
         * A set containing references to this VisualElement's children.
         */
        this.children = new Set();
        /**
         * Determine what role this visual element should take in the variant tree.
         */
        this.isVariantNode = false;
        this.isControllingVariants = false;
        /**
         * Decides whether this VisualElement should animate in reduced motion
         * mode.
         *
         * TODO: This is currently set on every individual VisualElement but feels
         * like it could be set globally.
         */
        this.shouldReduceMotion = null;
        /**
         * A map of all motion values attached to this visual element. Motion
         * values are source of truth for any given animated value. A motion
         * value might be provided externally by the component via props.
         */
        this.values = new Map();
        this.KeyframeResolver = KeyframeResolver;
        /**
         * Cleanup functions for active features (hover/tap/exit etc)
         */
        this.features = {};
        /**
         * A map of every subscription that binds the provided or generated
         * motion values onChange listeners to this visual element.
         */
        this.valueSubscriptions = new Map();
        /**
         * A reference to the previously-provided motion values as returned
         * from scrapeMotionValuesFromProps. We use the keys in here to determine
         * if any motion values need to be removed after props are updated.
         */
        this.prevMotionValues = {};
        /**
         * An object containing a SubscriptionManager for each active event.
         */
        this.events = {};
        /**
         * An object containing an unsubscribe function for each prop event subscription.
         * For example, every "Update" event can have multiple subscribers via
         * VisualElement.on(), but only one of those can be defined via the onUpdate prop.
         */
        this.propEventSubscriptions = {};
        this.notifyUpdate = () => this.notify("Update", this.latestValues);
        this.render = () => {
            if (!this.current)
                return;
            this.triggerBuild();
            this.renderInstance(this.current, this.renderState, this.props.style, this.projection);
        };
        this.renderScheduledAt = 0.0;
        this.scheduleRender = () => {
            const now = time.now();
            if (this.renderScheduledAt < now) {
                this.renderScheduledAt = now;
                frame.render(this.render, false, true);
            }
        };
        const { latestValues, renderState } = visualState;
        this.latestValues = latestValues;
        this.baseTarget = { ...latestValues };
        this.initialValues = props.initial ? { ...latestValues } : {};
        this.renderState = renderState;
        this.parent = parent;
        this.props = props;
        this.presenceContext = presenceContext;
        this.depth = parent ? parent.depth + 1 : 0;
        this.reducedMotionConfig = reducedMotionConfig;
        this.options = options;
        this.blockInitialAnimation = Boolean(blockInitialAnimation);
        this.isControllingVariants = isControllingVariants(props);
        this.isVariantNode = isVariantNode(props);
        if (this.isVariantNode) {
            this.variantChildren = new Set();
        }
        this.manuallyAnimateOnMount = Boolean(parent && parent.current);
        /**
         * Any motion values that are provided to the element when created
         * aren't yet bound to the element, as this would technically be impure.
         * However, we iterate through the motion values and set them to the
         * initial values for this component.
         *
         * TODO: This is impure and we should look at changing this to run on mount.
         * Doing so will break some tests but this isn't necessarily a breaking change,
         * more a reflection of the test.
         */
        const { willChange, ...initialMotionValues } = this.scrapeMotionValuesFromProps(props, {}, this);
        for (const key in initialMotionValues) {
            const value = initialMotionValues[key];
            if (latestValues[key] !== undefined && isMotionValue(value)) {
                value.set(latestValues[key], false);
            }
        }
    }
    mount(instance) {
        this.current = instance;
        visualElementStore.set(instance, this);
        if (this.projection && !this.projection.instance) {
            this.projection.mount(instance);
        }
        if (this.parent && this.isVariantNode && !this.isControllingVariants) {
            this.removeFromVariantTree = this.parent.addVariantChild(this);
        }
        this.values.forEach((value, key) => this.bindToMotionValue(key, value));
        if (!hasReducedMotionListener.current) {
            initPrefersReducedMotion();
        }
        this.shouldReduceMotion =
            this.reducedMotionConfig === "never"
                ? false
                : this.reducedMotionConfig === "always"
                    ? true
                    : prefersReducedMotion.current;
        if (process.env.NODE_ENV !== "production") {
            warnOnce(this.shouldReduceMotion !== true, "You have Reduced Motion enabled on your device. Animations may not appear as expected.");
        }
        if (this.parent)
            this.parent.children.add(this);
        this.update(this.props, this.presenceContext);
    }
    unmount() {
        visualElementStore.delete(this.current);
        this.projection && this.projection.unmount();
        cancelFrame(this.notifyUpdate);
        cancelFrame(this.render);
        this.valueSubscriptions.forEach((remove) => remove());
        this.valueSubscriptions.clear();
        this.removeFromVariantTree && this.removeFromVariantTree();
        this.parent && this.parent.children.delete(this);
        for (const key in this.events) {
            this.events[key].clear();
        }
        for (const key in this.features) {
            const feature = this.features[key];
            if (feature) {
                feature.unmount();
                feature.isMounted = false;
            }
        }
        this.current = null;
    }
    bindToMotionValue(key, value) {
        if (this.valueSubscriptions.has(key)) {
            this.valueSubscriptions.get(key)();
        }
        const valueIsTransform = transformProps.has(key);
        const removeOnChange = value.on("change", (latestValue) => {
            this.latestValues[key] = latestValue;
            this.props.onUpdate && frame.preRender(this.notifyUpdate);
            if (valueIsTransform && this.projection) {
                this.projection.isTransformDirty = true;
            }
        });
        const removeOnRenderRequest = value.on("renderRequest", this.scheduleRender);
        let removeSyncCheck;
        if (window.MotionCheckAppearSync) {
            removeSyncCheck = window.MotionCheckAppearSync(this, key, value);
        }
        this.valueSubscriptions.set(key, () => {
            removeOnChange();
            removeOnRenderRequest();
            if (removeSyncCheck)
                removeSyncCheck();
            if (value.owner)
                value.stop();
        });
    }
    sortNodePosition(other) {
        /**
         * If these nodes aren't even of the same type we can't compare their depth.
         */
        if (!this.current ||
            !this.sortInstanceNodePosition ||
            this.type !== other.type) {
            return 0;
        }
        return this.sortInstanceNodePosition(this.current, other.current);
    }
    updateFeatures() {
        let key = "animation";
        for (key in featureDefinitions) {
            const featureDefinition = featureDefinitions[key];
            if (!featureDefinition)
                continue;
            const { isEnabled, Feature: FeatureConstructor } = featureDefinition;
            /**
             * If this feature is enabled but not active, make a new instance.
             */
            if (!this.features[key] &&
                FeatureConstructor &&
                isEnabled(this.props)) {
                this.features[key] = new FeatureConstructor(this);
            }
            /**
             * If we have a feature, mount or update it.
             */
            if (this.features[key]) {
                const feature = this.features[key];
                if (feature.isMounted) {
                    feature.update();
                }
                else {
                    feature.mount();
                    feature.isMounted = true;
                }
            }
        }
    }
    triggerBuild() {
        this.build(this.renderState, this.latestValues, this.props);
    }
    /**
     * Measure the current viewport box with or without transforms.
     * Only measures axis-aligned boxes, rotate and skew must be manually
     * removed with a re-render to work.
     */
    measureViewportBox() {
        return this.current
            ? this.measureInstanceViewportBox(this.current, this.props)
            : createBox();
    }
    getStaticValue(key) {
        return this.latestValues[key];
    }
    setStaticValue(key, value) {
        this.latestValues[key] = value;
    }
    /**
     * Update the provided props. Ensure any newly-added motion values are
     * added to our map, old ones removed, and listeners updated.
     */
    update(props, presenceContext) {
        if (props.transformTemplate || this.props.transformTemplate) {
            this.scheduleRender();
        }
        this.prevProps = this.props;
        this.props = props;
        this.prevPresenceContext = this.presenceContext;
        this.presenceContext = presenceContext;
        /**
         * Update prop event handlers ie onAnimationStart, onAnimationComplete
         */
        for (let i = 0; i < propEventHandlers.length; i++) {
            const key = propEventHandlers[i];
            if (this.propEventSubscriptions[key]) {
                this.propEventSubscriptions[key]();
                delete this.propEventSubscriptions[key];
            }
            const listenerName = ("on" + key);
            const listener = props[listenerName];
            if (listener) {
                this.propEventSubscriptions[key] = this.on(key, listener);
            }
        }
        this.prevMotionValues = updateMotionValuesFromProps(this, this.scrapeMotionValuesFromProps(props, this.prevProps, this), this.prevMotionValues);
        if (this.handleChildMotionValue) {
            this.handleChildMotionValue();
        }
    }
    getProps() {
        return this.props;
    }
    /**
     * Returns the variant definition with a given name.
     */
    getVariant(name) {
        return this.props.variants ? this.props.variants[name] : undefined;
    }
    /**
     * Returns the defined default transition on this component.
     */
    getDefaultTransition() {
        return this.props.transition;
    }
    getTransformPagePoint() {
        return this.props.transformPagePoint;
    }
    getClosestVariantNode() {
        return this.isVariantNode
            ? this
            : this.parent
                ? this.parent.getClosestVariantNode()
                : undefined;
    }
    /**
     * Add a child visual element to our set of children.
     */
    addVariantChild(child) {
        const closestVariantNode = this.getClosestVariantNode();
        if (closestVariantNode) {
            closestVariantNode.variantChildren &&
                closestVariantNode.variantChildren.add(child);
            return () => closestVariantNode.variantChildren.delete(child);
        }
    }
    /**
     * Add a motion value and bind it to this visual element.
     */
    addValue(key, value) {
        // Remove existing value if it exists
        const existingValue = this.values.get(key);
        if (value !== existingValue) {
            if (existingValue)
                this.removeValue(key);
            this.bindToMotionValue(key, value);
            this.values.set(key, value);
            this.latestValues[key] = value.get();
        }
    }
    /**
     * Remove a motion value and unbind any active subscriptions.
     */
    removeValue(key) {
        this.values.delete(key);
        const unsubscribe = this.valueSubscriptions.get(key);
        if (unsubscribe) {
            unsubscribe();
            this.valueSubscriptions.delete(key);
        }
        delete this.latestValues[key];
        this.removeValueFromRenderState(key, this.renderState);
    }
    /**
     * Check whether we have a motion value for this key
     */
    hasValue(key) {
        return this.values.has(key);
    }
    getValue(key, defaultValue) {
        if (this.props.values && this.props.values[key]) {
            return this.props.values[key];
        }
        let value = this.values.get(key);
        if (value === undefined && defaultValue !== undefined) {
            value = motionValue(defaultValue === null ? undefined : defaultValue, { owner: this });
            this.addValue(key, value);
        }
        return value;
    }
    /**
     * If we're trying to animate to a previously unencountered value,
     * we need to check for it in our state and as a last resort read it
     * directly from the instance (which might have performance implications).
     */
    readValue(key, target) {
        var _a;
        let value = this.latestValues[key] !== undefined || !this.current
            ? this.latestValues[key]
            : (_a = this.getBaseTargetFromProps(this.props, key)) !== null && _a !== void 0 ? _a : this.readValueFromInstance(this.current, key, this.options);
        if (value !== undefined && value !== null) {
            if (typeof value === "string" &&
                (isNumericalString(value) || isZeroValueString(value))) {
                // If this is a number read as a string, ie "0" or "200", convert it to a number
                value = parseFloat(value);
            }
            else if (!findValueType(value) && complex.test(target)) {
                value = getAnimatableNone(key, target);
            }
            this.setBaseTarget(key, isMotionValue(value) ? value.get() : value);
        }
        return isMotionValue(value) ? value.get() : value;
    }
    /**
     * Set the base target to later animate back to. This is currently
     * only hydrated on creation and when we first read a value.
     */
    setBaseTarget(key, value) {
        this.baseTarget[key] = value;
    }
    /**
     * Find the base target for a value thats been removed from all animation
     * props.
     */
    getBaseTarget(key) {
        var _a;
        const { initial } = this.props;
        let valueFromInitial;
        if (typeof initial === "string" || typeof initial === "object") {
            const variant = resolveVariantFromProps(this.props, initial, (_a = this.presenceContext) === null || _a === void 0 ? void 0 : _a.custom);
            if (variant) {
                valueFromInitial = variant[key];
            }
        }
        /**
         * If this value still exists in the current initial variant, read that.
         */
        if (initial && valueFromInitial !== undefined) {
            return valueFromInitial;
        }
        /**
         * Alternatively, if this VisualElement config has defined a getBaseTarget
         * so we can read the value from an alternative source, try that.
         */
        const target = this.getBaseTargetFromProps(this.props, key);
        if (target !== undefined && !isMotionValue(target))
            return target;
        /**
         * If the value was initially defined on initial, but it doesn't any more,
         * return undefined. Otherwise return the value as initially read from the DOM.
         */
        return this.initialValues[key] !== undefined &&
            valueFromInitial === undefined
            ? undefined
            : this.baseTarget[key];
    }
    on(eventName, callback) {
        if (!this.events[eventName]) {
            this.events[eventName] = new SubscriptionManager();
        }
        return this.events[eventName].add(callback);
    }
    notify(eventName, ...args) {
        if (this.events[eventName]) {
            this.events[eventName].notify(...args);
        }
    }
}

class DOMVisualElement extends VisualElement {
    constructor() {
        super(...arguments);
        this.KeyframeResolver = DOMKeyframesResolver;
    }
    sortInstanceNodePosition(a, b) {
        /**
         * compareDocumentPosition returns a bitmask, by using the bitwise &
         * we're returning true if 2 in that bitmask is set to true. 2 is set
         * to true if b preceeds a.
         */
        return a.compareDocumentPosition(b) & 2 ? 1 : -1;
    }
    getBaseTargetFromProps(props, key) {
        return props.style
            ? props.style[key]
            : undefined;
    }
    removeValueFromRenderState(key, { vars, style }) {
        delete vars[key];
        delete style[key];
    }
}

function getComputedStyle(element) {
    return window.getComputedStyle(element);
}
class HTMLVisualElement extends DOMVisualElement {
    constructor() {
        super(...arguments);
        this.type = "html";
        this.renderInstance = renderHTML;
    }
    readValueFromInstance(instance, key) {
        if (transformProps.has(key)) {
            const defaultType = getDefaultValueType(key);
            return defaultType ? defaultType.default || 0 : 0;
        }
        else {
            const computedStyle = getComputedStyle(instance);
            const value = (isCSSVariableName(key)
                ? computedStyle.getPropertyValue(key)
                : computedStyle[key]) || 0;
            return typeof value === "string" ? value.trim() : value;
        }
    }
    measureInstanceViewportBox(instance, { transformPagePoint }) {
        return measureViewportBox(instance, transformPagePoint);
    }
    build(renderState, latestValues, props) {
        buildHTMLStyles(renderState, latestValues, props.transformTemplate);
    }
    scrapeMotionValuesFromProps(props, prevProps, visualElement) {
        return scrapeMotionValuesFromProps$1(props, prevProps, visualElement);
    }
    handleChildMotionValue() {
        if (this.childSubscription) {
            this.childSubscription();
            delete this.childSubscription;
        }
        const { children } = this.props;
        if (isMotionValue(children)) {
            this.childSubscription = children.on("change", (latest) => {
                if (this.current)
                    this.current.textContent = `${latest}`;
            });
        }
    }
}

class SVGVisualElement extends DOMVisualElement {
    constructor() {
        super(...arguments);
        this.type = "svg";
        this.isSVGTag = false;
        this.measureInstanceViewportBox = createBox;
    }
    getBaseTargetFromProps(props, key) {
        return props[key];
    }
    readValueFromInstance(instance, key) {
        if (transformProps.has(key)) {
            const defaultType = getDefaultValueType(key);
            return defaultType ? defaultType.default || 0 : 0;
        }
        key = !camelCaseAttributes.has(key) ? camelToDash(key) : key;
        return instance.getAttribute(key);
    }
    scrapeMotionValuesFromProps(props, prevProps, visualElement) {
        return scrapeMotionValuesFromProps(props, prevProps, visualElement);
    }
    build(renderState, latestValues, props) {
        buildSVGAttrs(renderState, latestValues, this.isSVGTag, props.transformTemplate);
    }
    renderInstance(instance, renderState, styleProp, projection) {
        renderSVG(instance, renderState, styleProp, projection);
    }
    mount(instance) {
        this.isSVGTag = isSVGTag(instance.tagName);
        super.mount(instance);
    }
}

const createDomVisualElement = (Component, options) => {
    return isSVGComponent(Component)
        ? new SVGVisualElement(options)
        : new HTMLVisualElement(options, {
            allowProjection: Component !== Fragment$1,
        });
};

const createMotionComponent = /*@__PURE__*/ createMotionComponentFactory({
    ...animations,
    ...gestureAnimations,
    ...drag,
    ...layout,
}, createDomVisualElement);

const motion = /*@__PURE__*/ createDOMMotionComponentProxy(createMotionComponent);

function ascending(a, b) {
  return a == null || b == null ? NaN : a < b ? -1 : a > b ? 1 : a >= b ? 0 : NaN;
}

function descending(a, b) {
  return a == null || b == null ? NaN
    : b < a ? -1
    : b > a ? 1
    : b >= a ? 0
    : NaN;
}

function bisector(f) {
  let compare1, compare2, delta;

  // If an accessor is specified, promote it to a comparator. In this case we
  // can test whether the search value is (self-) comparable. We can’t do this
  // for a comparator (except for specific, known comparators) because we can’t
  // tell if the comparator is symmetric, and an asymmetric comparator can’t be
  // used to test whether a single value is comparable.
  if (f.length !== 2) {
    compare1 = ascending;
    compare2 = (d, x) => ascending(f(d), x);
    delta = (d, x) => f(d) - x;
  } else {
    compare1 = f === ascending || f === descending ? f : zero;
    compare2 = f;
    delta = f;
  }

  function left(a, x, lo = 0, hi = a.length) {
    if (lo < hi) {
      if (compare1(x, x) !== 0) return hi;
      do {
        const mid = (lo + hi) >>> 1;
        if (compare2(a[mid], x) < 0) lo = mid + 1;
        else hi = mid;
      } while (lo < hi);
    }
    return lo;
  }

  function right(a, x, lo = 0, hi = a.length) {
    if (lo < hi) {
      if (compare1(x, x) !== 0) return hi;
      do {
        const mid = (lo + hi) >>> 1;
        if (compare2(a[mid], x) <= 0) lo = mid + 1;
        else hi = mid;
      } while (lo < hi);
    }
    return lo;
  }

  function center(a, x, lo = 0, hi = a.length) {
    const i = left(a, x, lo, hi - 1);
    return i > lo && delta(a[i - 1], x) > -delta(a[i], x) ? i - 1 : i;
  }

  return {left, center, right};
}

function zero() {
  return 0;
}

function number(x) {
  return x === null ? NaN : +x;
}

const ascendingBisect = bisector(ascending);
const bisectRight = ascendingBisect.right;
bisector(number).center;

// https://github.com/python/cpython/blob/a74eea238f5baba15797e2e8b570d153bc8690a7/Modules/mathmodule.c#L1423
class Adder {
  constructor() {
    this._partials = new Float64Array(32);
    this._n = 0;
  }
  add(x) {
    const p = this._partials;
    let i = 0;
    for (let j = 0; j < this._n && j < 32; j++) {
      const y = p[j],
        hi = x + y,
        lo = Math.abs(x) < Math.abs(y) ? x - (hi - y) : y - (hi - x);
      if (lo) p[i++] = lo;
      x = hi;
    }
    p[i] = x;
    this._n = i + 1;
    return this;
  }
  valueOf() {
    const p = this._partials;
    let n = this._n, x, y, lo, hi = 0;
    if (n > 0) {
      hi = p[--n];
      while (n > 0) {
        x = hi;
        y = p[--n];
        hi = x + y;
        lo = y - (hi - x);
        if (lo) break;
      }
      if (n > 0 && ((lo < 0 && p[n - 1] < 0) || (lo > 0 && p[n - 1] > 0))) {
        y = lo * 2;
        x = hi + y;
        if (y == x - hi) hi = x;
      }
    }
    return hi;
  }
}

function* flatten(arrays) {
  for (const array of arrays) {
    yield* array;
  }
}

function merge(arrays) {
  return Array.from(flatten(arrays));
}

function initRange(domain, range) {
  switch (arguments.length) {
    case 0: break;
    case 1: this.range(domain); break;
    default: this.range(range).domain(domain); break;
  }
  return this;
}

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(channels) {
    return Object.assign(new this.constructor, this, channels);
  },
  displayable() {
    return this.rgb().displayable();
  },
  hex: color_formatHex, // Deprecated! Use color.formatHex.
  formatHex: color_formatHex,
  formatHex8: color_formatHex8,
  formatHsl: color_formatHsl,
  formatRgb: color_formatRgb,
  toString: color_formatRgb
});

function color_formatHex() {
  return this.rgb().formatHex();
}

function color_formatHex8() {
  return this.rgb().formatHex8();
}

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(k) {
    k = k == null ? brighter : Math.pow(brighter, k);
    return new Rgb(this.r * k, this.g * k, this.b * k, this.opacity);
  },
  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() {
    return this;
  },
  clamp() {
    return new Rgb(clampi(this.r), clampi(this.g), clampi(this.b), clampa(this.opacity));
  },
  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,
  formatHex8: rgb_formatHex8,
  formatRgb: rgb_formatRgb,
  toString: rgb_formatRgb
}));

function rgb_formatHex() {
  return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}`;
}

function rgb_formatHex8() {
  return `#${hex(this.r)}${hex(this.g)}${hex(this.b)}${hex((isNaN(this.opacity) ? 1 : this.opacity) * 255)}`;
}

function rgb_formatRgb() {
  const a = clampa(this.opacity);
  return `${a === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a === 1 ? ")" : `, ${a})`}`;
}

function clampa(opacity) {
  return isNaN(opacity) ? 1 : Math.max(0, Math.min(1, opacity));
}

function clampi(value) {
  return Math.max(0, Math.min(255, Math.round(value) || 0));
}

function hex(value) {
  value = clampi(value);
  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$1(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$1, extend(Color, {
  brighter(k) {
    k = k == null ? brighter : Math.pow(brighter, k);
    return new Hsl(this.h, this.s, this.l * k, this.opacity);
  },
  darker(k) {
    k = k == null ? darker : Math.pow(darker, k);
    return new Hsl(this.h, this.s, this.l * k, this.opacity);
  },
  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
    );
  },
  clamp() {
    return new Hsl(clamph(this.h), clampt(this.s), clampt(this.l), clampa(this.opacity));
  },
  displayable() {
    return (0 <= this.s && this.s <= 1 || isNaN(this.s))
        && (0 <= this.l && this.l <= 1)
        && (0 <= this.opacity && this.opacity <= 1);
  },
  formatHsl() {
    const a = clampa(this.opacity);
    return `${a === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a === 1 ? ")" : `, ${a})`}`;
  }
}));

function clamph(value) {
  value = (value || 0) % 360;
  return value < 0 ? value + 360 : value;
}

function clampt(value) {
  return Math.max(0, Math.min(1, value || 0));
}

/* 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;
}

const radians$1 = Math.PI / 180;
const degrees$1 = 180 / Math.PI;

// https://observablehq.com/@mbostock/lab-and-rgb
const K = 18,
    Xn = 0.96422,
    Yn = 1,
    Zn = 0.82521,
    t0$1 = 4 / 29,
    t1$1 = 6 / 29,
    t2 = 3 * t1$1 * t1$1,
    t3 = t1$1 * t1$1 * t1$1;

function labConvert(o) {
  if (o instanceof Lab) return new Lab(o.l, o.a, o.b, o.opacity);
  if (o instanceof Hcl) return hcl2lab(o);
  if (!(o instanceof Rgb)) o = rgbConvert(o);
  var r = rgb2lrgb(o.r),
      g = rgb2lrgb(o.g),
      b = rgb2lrgb(o.b),
      y = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x, z;
  if (r === g && g === b) x = z = y; else {
    x = xyz2lab((0.4360747 * r + 0.3850649 * g + 0.1430804 * b) / Xn);
    z = xyz2lab((0.0139322 * r + 0.0971045 * g + 0.7141733 * b) / Zn);
  }
  return new Lab(116 * y - 16, 500 * (x - y), 200 * (y - z), o.opacity);
}

function lab$1(l, a, b, opacity) {
  return arguments.length === 1 ? labConvert(l) : new Lab(l, a, b, opacity == null ? 1 : opacity);
}

function Lab(l, a, b, opacity) {
  this.l = +l;
  this.a = +a;
  this.b = +b;
  this.opacity = +opacity;
}

define(Lab, lab$1, extend(Color, {
  brighter(k) {
    return new Lab(this.l + K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  },
  darker(k) {
    return new Lab(this.l - K * (k == null ? 1 : k), this.a, this.b, this.opacity);
  },
  rgb() {
    var y = (this.l + 16) / 116,
        x = isNaN(this.a) ? y : y + this.a / 500,
        z = isNaN(this.b) ? y : y - this.b / 200;
    x = Xn * lab2xyz(x);
    y = Yn * lab2xyz(y);
    z = Zn * lab2xyz(z);
    return new Rgb(
      lrgb2rgb( 3.1338561 * x - 1.6168667 * y - 0.4906146 * z),
      lrgb2rgb(-0.9787684 * x + 1.9161415 * y + 0.0334540 * z),
      lrgb2rgb( 0.0719453 * x - 0.2289914 * y + 1.4052427 * z),
      this.opacity
    );
  }
}));

function xyz2lab(t) {
  return t > t3 ? Math.pow(t, 1 / 3) : t / t2 + t0$1;
}

function lab2xyz(t) {
  return t > t1$1 ? t * t * t : t2 * (t - t0$1);
}

function lrgb2rgb(x) {
  return 255 * (x <= 0.0031308 ? 12.92 * x : 1.055 * Math.pow(x, 1 / 2.4) - 0.055);
}

function rgb2lrgb(x) {
  return (x /= 255) <= 0.04045 ? x / 12.92 : Math.pow((x + 0.055) / 1.055, 2.4);
}

function hclConvert(o) {
  if (o instanceof Hcl) return new Hcl(o.h, o.c, o.l, o.opacity);
  if (!(o instanceof Lab)) o = labConvert(o);
  if (o.a === 0 && o.b === 0) return new Hcl(NaN, 0 < o.l && o.l < 100 ? 0 : NaN, o.l, o.opacity);
  var h = Math.atan2(o.b, o.a) * degrees$1;
  return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity);
}

function hcl$1(h, c, l, opacity) {
  return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c, l, opacity == null ? 1 : opacity);
}

function Hcl(h, c, l, opacity) {
  this.h = +h;
  this.c = +c;
  this.l = +l;
  this.opacity = +opacity;
}

function hcl2lab(o) {
  if (isNaN(o.h)) return new Lab(o.l, 0, 0, o.opacity);
  var h = o.h * radians$1;
  return new Lab(o.l, Math.cos(h) * o.c, Math.sin(h) * o.c, o.opacity);
}

define(Hcl, hcl$1, extend(Color, {
  brighter(k) {
    return new Hcl(this.h, this.c, this.l + K * (k == null ? 1 : k), this.opacity);
  },
  darker(k) {
    return new Hcl(this.h, this.c, this.l - K * (k == null ? 1 : k), this.opacity);
  },
  rgb() {
    return hcl2lab(this).rgb();
  }
}));

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) * degrees$1 - 120 : NaN;
  return new Cubehelix(h < 0 ? h + 360 : h, s, l, o.opacity);
}

function cubehelix$1(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$1, extend(Color, {
  brighter(k) {
    k = k == null ? brighter : Math.pow(brighter, k);
    return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
  },
  darker(k) {
    k = k == null ? darker : Math.pow(darker, k);
    return new Cubehelix(this.h, this.s, this.l * k, this.opacity);
  },
  rgb() {
    var h = isNaN(this.h) ? 0 : (this.h + 120) * radians$1,
        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
    );
  }
}));

var constant = x => () => x;

function linear(a, d) {
  return function(t) {
    return a + t * d;
  };
}

function exponential(a, b, y) {
  return a = Math.pow(a, y), b = Math.pow(b, y) - a, y = 1 / y, function(t) {
    return Math.pow(a + t * b, y);
  };
}

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 gamma(y) {
  return (y = +y) === 1 ? nogamma : function(a, b) {
    return b - a ? exponential(a, b, y) : constant(isNaN(a) ? b : a);
  };
}

function nogamma(a, b) {
  var d = b - a;
  return d ? linear(a, d) : constant(isNaN(a) ? b : a);
}

var interpolateRgb = (function rgbGamma(y) {
  var color = gamma(y);

  function rgb$1(start, end) {
    var r = color((start = rgb(start)).r, (end = rgb(end)).r),
        g = color(start.g, end.g),
        b = color(start.b, end.b),
        opacity = nogamma(start.opacity, end.opacity);
    return function(t) {
      start.r = r(t);
      start.g = g(t);
      start.b = b(t);
      start.opacity = opacity(t);
      return start + "";
    };
  }

  rgb$1.gamma = rgbGamma;

  return rgb$1;
})(1);

function interpolateRound(a, b) {
  return a = +a, b = +b, function(t) {
    return Math.round(a * (1 - t) + b * t);
  };
}

function hsl(hue) {
  return function(start, end) {
    var h = hue((start = hsl$1(start)).h, (end = hsl$1(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(t);
      start.opacity = opacity(t);
      return start + "";
    };
  }
}

var interpolateHsl = hsl(hue);
var hslLong = hsl(nogamma);

function lab(start, end) {
  var l = nogamma((start = lab$1(start)).l, (end = lab$1(end)).l),
      a = nogamma(start.a, end.a),
      b = nogamma(start.b, end.b),
      opacity = nogamma(start.opacity, end.opacity);
  return function(t) {
    start.l = l(t);
    start.a = a(t);
    start.b = b(t);
    start.opacity = opacity(t);
    return start + "";
  };
}

function hcl(hue) {
  return function(start, end) {
    var h = hue((start = hcl$1(start)).h, (end = hcl$1(end)).h),
        c = nogamma(start.c, end.c),
        l = nogamma(start.l, end.l),
        opacity = nogamma(start.opacity, end.opacity);
    return function(t) {
      start.h = h(t);
      start.c = c(t);
      start.l = l(t);
      start.opacity = opacity(t);
      return start + "";
    };
  }
}

var interpolateHcl = hcl(hue);
var hclLong = hcl(nogamma);

function cubehelix(hue) {
  return (function cubehelixGamma(y) {
    y = +y;

    function cubehelix(start, end) {
      var h = hue((start = cubehelix$1(start)).h, (end = cubehelix$1(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.gamma = cubehelixGamma;

    return cubehelix;
  })(1);
}

var interpolateCubehelix = cubehelix(hue);
var cubehelixLong = cubehelix(nogamma);

function threshold() {
  var domain = [0.5],
      range = [0, 1],
      unknown,
      n = 1;

  function scale(x) {
    return x != null && x <= x ? range[bisectRight(domain, x, 0, n)] : unknown;
  }

  scale.domain = function(_) {
    return arguments.length ? (domain = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : domain.slice();
  };

  scale.range = function(_) {
    return arguments.length ? (range = Array.from(_), n = Math.min(domain.length, range.length - 1), scale) : range.slice();
  };

  scale.invertExtent = function(y) {
    var i = range.indexOf(y);
    return [domain[i - 1], domain[i]];
  };

  scale.unknown = function(_) {
    return arguments.length ? (unknown = _, scale) : unknown;
  };

  scale.copy = function() {
    return threshold()
        .domain(domain)
        .range(range)
        .unknown(unknown);
  };

  return initRange.apply(scale, arguments);
}

const t0 = new Date, t1 = new Date;

function timeInterval(floori, offseti, count, field) {

  function interval(date) {
    return floori(date = arguments.length === 0 ? new Date : new Date(+date)), date;
  }

  interval.floor = (date) => {
    return floori(date = new Date(+date)), date;
  };

  interval.ceil = (date) => {
    return floori(date = new Date(date - 1)), offseti(date, 1), floori(date), date;
  };

  interval.round = (date) => {
    const d0 = interval(date), d1 = interval.ceil(date);
    return date - d0 < d1 - date ? d0 : d1;
  };

  interval.offset = (date, step) => {
    return offseti(date = new Date(+date), step == null ? 1 : Math.floor(step)), date;
  };

  interval.range = (start, stop, step) => {
    const range = [];
    start = interval.ceil(start);
    step = step == null ? 1 : Math.floor(step);
    if (!(start < stop) || !(step > 0)) return range; // also handles Invalid Date
    let previous;
    do range.push(previous = new Date(+start)), offseti(start, step), floori(start);
    while (previous < start && start < stop);
    return range;
  };

  interval.filter = (test) => {
    return timeInterval((date) => {
      if (date >= date) while (floori(date), !test(date)) date.setTime(date - 1);
    }, (date, step) => {
      if (date >= date) {
        if (step < 0) while (++step <= 0) {
          while (offseti(date, -1), !test(date)) {} // eslint-disable-line no-empty
        } else while (--step >= 0) {
          while (offseti(date, +1), !test(date)) {} // eslint-disable-line no-empty
        }
      }
    });
  };

  if (count) {
    interval.count = (start, end) => {
      t0.setTime(+start), t1.setTime(+end);
      floori(t0), floori(t1);
      return Math.floor(count(t0, t1));
    };

    interval.every = (step) => {
      step = Math.floor(step);
      return !isFinite(step) || !(step > 0) ? null
          : !(step > 1) ? interval
          : interval.filter(field
              ? (d) => field(d) % step === 0
              : (d) => interval.count(0, d) % step === 0);
    };
  }

  return interval;
}

const durationSecond = 1000;
const durationMinute = durationSecond * 60;
const durationHour = durationMinute * 60;
const durationDay = durationHour * 24;
const durationWeek = durationDay * 7;

const second = timeInterval((date) => {
  date.setTime(date - date.getMilliseconds());
}, (date, step) => {
  date.setTime(+date + step * durationSecond);
}, (start, end) => {
  return (end - start) / durationSecond;
}, (date) => {
  return date.getUTCSeconds();
});

second.range;

const timeMinute = timeInterval((date) => {
  date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond);
}, (date, step) => {
  date.setTime(+date + step * durationMinute);
}, (start, end) => {
  return (end - start) / durationMinute;
}, (date) => {
  return date.getMinutes();
});

timeMinute.range;

const utcMinute = timeInterval((date) => {
  date.setUTCSeconds(0, 0);
}, (date, step) => {
  date.setTime(+date + step * durationMinute);
}, (start, end) => {
  return (end - start) / durationMinute;
}, (date) => {
  return date.getUTCMinutes();
});

utcMinute.range;

const timeHour = timeInterval((date) => {
  date.setTime(date - date.getMilliseconds() - date.getSeconds() * durationSecond - date.getMinutes() * durationMinute);
}, (date, step) => {
  date.setTime(+date + step * durationHour);
}, (start, end) => {
  return (end - start) / durationHour;
}, (date) => {
  return date.getHours();
});

timeHour.range;

const utcHour = timeInterval((date) => {
  date.setUTCMinutes(0, 0, 0);
}, (date, step) => {
  date.setTime(+date + step * durationHour);
}, (start, end) => {
  return (end - start) / durationHour;
}, (date) => {
  return date.getUTCHours();
});

utcHour.range;

const timeDay = timeInterval(
  date => date.setHours(0, 0, 0, 0),
  (date, step) => date.setDate(date.getDate() + step),
  (start, end) => (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationDay,
  date => date.getDate() - 1
);

timeDay.range;

const utcDay = timeInterval((date) => {
  date.setUTCHours(0, 0, 0, 0);
}, (date, step) => {
  date.setUTCDate(date.getUTCDate() + step);
}, (start, end) => {
  return (end - start) / durationDay;
}, (date) => {
  return date.getUTCDate() - 1;
});

utcDay.range;

const unixDay = timeInterval((date) => {
  date.setUTCHours(0, 0, 0, 0);
}, (date, step) => {
  date.setUTCDate(date.getUTCDate() + step);
}, (start, end) => {
  return (end - start) / durationDay;
}, (date) => {
  return Math.floor(date / durationDay);
});

unixDay.range;

function timeWeekday(i) {
  return timeInterval((date) => {
    date.setDate(date.getDate() - (date.getDay() + 7 - i) % 7);
    date.setHours(0, 0, 0, 0);
  }, (date, step) => {
    date.setDate(date.getDate() + step * 7);
  }, (start, end) => {
    return (end - start - (end.getTimezoneOffset() - start.getTimezoneOffset()) * durationMinute) / durationWeek;
  });
}

const timeSunday = timeWeekday(0);
const timeMonday = timeWeekday(1);
const timeTuesday = timeWeekday(2);
const timeWednesday = timeWeekday(3);
const timeThursday = timeWeekday(4);
const timeFriday = timeWeekday(5);
const timeSaturday = timeWeekday(6);

timeSunday.range;
timeMonday.range;
timeTuesday.range;
timeWednesday.range;
timeThursday.range;
timeFriday.range;
timeSaturday.range;

function utcWeekday(i) {
  return timeInterval((date) => {
    date.setUTCDate(date.getUTCDate() - (date.getUTCDay() + 7 - i) % 7);
    date.setUTCHours(0, 0, 0, 0);
  }, (date, step) => {
    date.setUTCDate(date.getUTCDate() + step * 7);
  }, (start, end) => {
    return (end - start) / durationWeek;
  });
}

const utcSunday = utcWeekday(0);
const utcMonday = utcWeekday(1);
const utcTuesday = utcWeekday(2);
const utcWednesday = utcWeekday(3);
const utcThursday = utcWeekday(4);
const utcFriday = utcWeekday(5);
const utcSaturday = utcWeekday(6);

utcSunday.range;
utcMonday.range;
utcTuesday.range;
utcWednesday.range;
utcThursday.range;
utcFriday.range;
utcSaturday.range;

const timeMonth = timeInterval((date) => {
  date.setDate(1);
  date.setHours(0, 0, 0, 0);
}, (date, step) => {
  date.setMonth(date.getMonth() + step);
}, (start, end) => {
  return end.getMonth() - start.getMonth() + (end.getFullYear() - start.getFullYear()) * 12;
}, (date) => {
  return date.getMonth();
});

timeMonth.range;

const utcMonth = timeInterval((date) => {
  date.setUTCDate(1);
  date.setUTCHours(0, 0, 0, 0);
}, (date, step) => {
  date.setUTCMonth(date.getUTCMonth() + step);
}, (start, end) => {
  return end.getUTCMonth() - start.getUTCMonth() + (end.getUTCFullYear() - start.getUTCFullYear()) * 12;
}, (date) => {
  return date.getUTCMonth();
});

utcMonth.range;

const timeYear = timeInterval((date) => {
  date.setMonth(0, 1);
  date.setHours(0, 0, 0, 0);
}, (date, step) => {
  date.setFullYear(date.getFullYear() + step);
}, (start, end) => {
  return end.getFullYear() - start.getFullYear();
}, (date) => {
  return date.getFullYear();
});

// An optimized implementation for this simple case.
timeYear.every = (k) => {
  return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
    date.setFullYear(Math.floor(date.getFullYear() / k) * k);
    date.setMonth(0, 1);
    date.setHours(0, 0, 0, 0);
  }, (date, step) => {
    date.setFullYear(date.getFullYear() + step * k);
  });
};

timeYear.range;

const utcYear = timeInterval((date) => {
  date.setUTCMonth(0, 1);
  date.setUTCHours(0, 0, 0, 0);
}, (date, step) => {
  date.setUTCFullYear(date.getUTCFullYear() + step);
}, (start, end) => {
  return end.getUTCFullYear() - start.getUTCFullYear();
}, (date) => {
  return date.getUTCFullYear();
});

// An optimized implementation for this simple case.
utcYear.every = (k) => {
  return !isFinite(k = Math.floor(k)) || !(k > 0) ? null : timeInterval((date) => {
    date.setUTCFullYear(Math.floor(date.getUTCFullYear() / k) * k);
    date.setUTCMonth(0, 1);
    date.setUTCHours(0, 0, 0, 0);
  }, (date, step) => {
    date.setUTCFullYear(date.getUTCFullYear() + step * k);
  });
};

utcYear.range;

function applyDomain(scale, config) {
  if (config.domain) {
    if ('nice' in scale || 'quantiles' in scale) {
      // continuous input scales
      scale.domain(config.domain);
    } else if ('padding' in scale) {
      // point and band scales
      scale.domain(config.domain);
    } else {
      // ordinal and threshold scale
      scale.domain(config.domain);
    }
  }
}

function applyRange(scale, config) {
  if (config.range) {
    if ('padding' in scale) {
      // point and band scales
      scale.range(config.range);
    } else {
      // the rest
      scale.range(config.range);
    }
  }
}

function applyAlign(scale, config) {
  if ('align' in scale && 'align' in config && typeof config.align !== 'undefined') {
    scale.align(config.align);
  }
}

function applyBase(scale, config) {
  if ('base' in scale && 'base' in config && typeof config.base !== 'undefined') {
    scale.base(config.base);
  }
}

function applyClamp(scale, config) {
  if ('clamp' in scale && 'clamp' in config && typeof config.clamp !== 'undefined') {
    scale.clamp(config.clamp);
  }
}

function applyConstant(scale, config) {
  if ('constant' in scale && 'constant' in config && typeof config.constant !== 'undefined') {
    scale.constant(config.constant);
  }
}

function applyExponent(scale, config) {
  if ('exponent' in scale && 'exponent' in config && typeof config.exponent !== 'undefined') {
    scale.exponent(config.exponent);
  }
}

var interpolatorMap = {
  lab: lab,
  hcl: interpolateHcl,
  'hcl-long': hclLong,
  hsl: interpolateHsl,
  'hsl-long': hslLong,
  cubehelix: interpolateCubehelix,
  'cubehelix-long': cubehelixLong,
  rgb: interpolateRgb
};
function createColorInterpolator(interpolate) {
  switch (interpolate) {
    case 'lab':
    case 'hcl':
    case 'hcl-long':
    case 'hsl':
    case 'hsl-long':
    case 'cubehelix':
    case 'cubehelix-long':
    case 'rgb':
      return interpolatorMap[interpolate];
  }
  var type = interpolate.type,
    gamma = interpolate.gamma;
  var interpolator = interpolatorMap[type];
  return typeof gamma === 'undefined' ? interpolator : interpolator.gamma(gamma);
}

function applyInterpolate(scale, config) {
  if ('interpolate' in config && 'interpolate' in scale && typeof config.interpolate !== 'undefined') {
    var interpolator = createColorInterpolator(config.interpolate);
    scale.interpolate(interpolator);
  }
}

var TEST_TIME = new Date(Date.UTC(2020, 1, 2, 3, 4, 5));
var TEST_FORMAT = '%Y-%m-%d %H:%M';

/**
 * Check if the scale is UTC or Time scale
 * When local time is equal to UTC, always return true
 * @param scale time or utc scale
 */
function isUtcScale(scale) {
  // The only difference between time and utc scale is
  // whether the tick format function is utcFormat or timeFormat
  var output = scale.tickFormat(1, TEST_FORMAT)(TEST_TIME);
  return output === '2020-02-02 03:04';
}

var localTimeIntervals = {
  day: timeDay,
  hour: timeHour,
  minute: timeMinute,
  month: timeMonth,
  second: second,
  week: timeSunday,
  year: timeYear
};
var utcIntervals = {
  day: utcDay,
  hour: utcHour,
  minute: utcMinute,
  month: utcMonth,
  second: second,
  week: utcSunday,
  year: utcYear
};
function applyNice(scale, config) {
  if ('nice' in config && typeof config.nice !== 'undefined' && 'nice' in scale) {
    var nice = config.nice;
    if (typeof nice === 'boolean') {
      if (nice) {
        scale.nice();
      }
    } else if (typeof nice === 'number') {
      scale.nice(nice);
    } else {
      var timeScale = scale;
      var isUtc = isUtcScale(timeScale);
      if (typeof nice === 'string') {
        timeScale.nice(isUtc ? utcIntervals[nice] : localTimeIntervals[nice]);
      } else {
        var interval = nice.interval,
          step = nice.step;
        var parsedInterval = (isUtc ? utcIntervals[interval] : localTimeIntervals[interval]).every(step);
        if (parsedInterval != null) {
          timeScale.nice(parsedInterval);
        }
      }
    }
  }
}

function applyPadding(scale, config) {
  if ('padding' in scale && 'padding' in config && typeof config.padding !== 'undefined') {
    scale.padding(config.padding);
  }
  if ('paddingInner' in scale && 'paddingInner' in config && typeof config.paddingInner !== 'undefined') {
    scale.paddingInner(config.paddingInner);
  }
  if ('paddingOuter' in scale && 'paddingOuter' in config && typeof config.paddingOuter !== 'undefined') {
    scale.paddingOuter(config.paddingOuter);
  }
}

function applyReverse(scale, config) {
  if (config.reverse) {
    var reversedRange = scale.range().slice().reverse();
    if ('padding' in scale) {
      // point and band scales
      scale.range(reversedRange);
    } else {
      // the rest
      scale.range(reversedRange);
    }
  }
}

function applyRound(scale, config) {
  if ('round' in config && typeof config.round !== 'undefined') {
    if (config.round && 'interpolate' in config && typeof config.interpolate !== 'undefined') {
      console.warn("[visx/scale/applyRound] ignoring round: scale config contains round and interpolate. only applying interpolate. config:", config);
    } else if ('round' in scale) {
      // for point and band scales
      scale.round(config.round);
    } else if ('interpolate' in scale && config.round) {
      // for continuous output scales
      // setting config.round = true
      // is actually setting interpolator to interpolateRound
      // as these scales do not have scale.round() function
      scale.interpolate(interpolateRound);
    }
  }
}

function applyUnknown(scale, config) {
  if ('unknown' in scale && 'unknown' in config && typeof config.unknown !== 'undefined') {
    scale.unknown(config.unknown);
  }
}

function applyZero(scale, config) {
  if ('zero' in config && config.zero === true) {
    var domain = scale.domain();
    var a = domain[0],
      b = domain[1];
    var isDescending = b < a;
    var _ref = isDescending ? [b, a] : [a, b],
      min = _ref[0],
      max = _ref[1];
    var domainWithZero = [Math.min(0, min), Math.max(0, max)];
    scale.domain(isDescending ? domainWithZero.reverse() : domainWithZero);
  }
}

/**
 * List of all operators, in order of execution
 */
var ALL_OPERATORS = [
// domain => nice => zero
'domain', 'nice', 'zero',
// interpolate before round
'interpolate', 'round',
// set range then reverse
'range', 'reverse',
// Order does not matter for these operators
'align', 'base', 'clamp', 'constant', 'exponent', 'padding', 'unknown'];
// Use Record to enforce that all keys in OperatorType must exist.
var operators = {
  domain: applyDomain,
  nice: applyNice,
  zero: applyZero,
  interpolate: applyInterpolate,
  round: applyRound,
  align: applyAlign,
  base: applyBase,
  clamp: applyClamp,
  constant: applyConstant,
  exponent: applyExponent,
  padding: applyPadding,
  range: applyRange,
  reverse: applyReverse,
  unknown: applyUnknown
};
function scaleOperator() {
  for (var _len = arguments.length, ops = new Array(_len), _key = 0; _key < _len; _key++) {
    ops[_key] = arguments[_key];
  }
  var selection = new Set(ops);
  var selectedOps = ALL_OPERATORS.filter(function (o) {
    return selection.has(o);
  });
  return function applyOperators(scale, config) {
    if (typeof config !== 'undefined') {
      selectedOps.forEach(function (op) {
        operators[op](scale, config);
      });
    }
    return scale;
  };
}

var updateThresholdScale = scaleOperator('domain', 'range', 'reverse');
function createThresholdScale(config) {
  return updateThresholdScale(threshold(), config);
}

var _excluded$7 = ["tooltipOpen"];
function _objectWithoutPropertiesLoose$7(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function _extends$b() { _extends$b = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$b.apply(this, arguments); }
function useTooltip( /** Optional initial TooltipState. */
initialTooltipState) {
  var _useState = useState(_extends$b({
      tooltipOpen: false
    }, initialTooltipState)),
    tooltipState = _useState[0],
    setTooltipState = _useState[1];
  var showTooltip = useCallback(function (showArgs) {
    return setTooltipState(typeof showArgs === 'function' ? function (_ref) {
      _ref.tooltipOpen;
        var show = _objectWithoutPropertiesLoose$7(_ref, _excluded$7);
      return _extends$b({}, showArgs(show), {
        tooltipOpen: true
      });
    } : {
      tooltipOpen: true,
      tooltipLeft: showArgs.tooltipLeft,
      tooltipTop: showArgs.tooltipTop,
      tooltipData: showArgs.tooltipData
    });
  }, [setTooltipState]);
  var hideTooltip = useCallback(function () {
    return setTooltipState({
      tooltipOpen: false,
      tooltipLeft: undefined,
      tooltipTop: undefined,
      tooltipData: undefined
    });
  }, [setTooltipState]);
  return {
    tooltipOpen: tooltipState.tooltipOpen,
    tooltipLeft: tooltipState.tooltipLeft,
    tooltipTop: tooltipState.tooltipTop,
    tooltipData: tooltipState.tooltipData,
    updateTooltip: setTooltipState,
    showTooltip: showTooltip,
    hideTooltip: hideTooltip
  };
}

function getDefaultExportFromCjs (x) {
	return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
}

var propTypes = {exports: {}};

var reactIs = {exports: {}};

var reactIs_production_min = {};

/** @license React v16.13.1
 * react-is.production.min.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

var hasRequiredReactIs_production_min;

function requireReactIs_production_min () {
	if (hasRequiredReactIs_production_min) return reactIs_production_min;
	hasRequiredReactIs_production_min = 1;
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
	Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
	function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
	reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
	reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
	reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
	return reactIs_production_min;
}

var reactIs_development = {};

/** @license React v16.13.1
 * react-is.development.js
 *
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

var hasRequiredReactIs_development;

function requireReactIs_development () {
	if (hasRequiredReactIs_development) return reactIs_development;
	hasRequiredReactIs_development = 1;



	if (process.env.NODE_ENV !== "production") {
	  (function() {

	// The Symbol used to tag the ReactElement-like types. If there is no native Symbol
	// nor polyfill, then a plain number is used for performance.
	var hasSymbol = typeof Symbol === 'function' && Symbol.for;
	var REACT_ELEMENT_TYPE = hasSymbol ? Symbol.for('react.element') : 0xeac7;
	var REACT_PORTAL_TYPE = hasSymbol ? Symbol.for('react.portal') : 0xeaca;
	var REACT_FRAGMENT_TYPE = hasSymbol ? Symbol.for('react.fragment') : 0xeacb;
	var REACT_STRICT_MODE_TYPE = hasSymbol ? Symbol.for('react.strict_mode') : 0xeacc;
	var REACT_PROFILER_TYPE = hasSymbol ? Symbol.for('react.profiler') : 0xead2;
	var REACT_PROVIDER_TYPE = hasSymbol ? Symbol.for('react.provider') : 0xeacd;
	var REACT_CONTEXT_TYPE = hasSymbol ? Symbol.for('react.context') : 0xeace; // TODO: We don't use AsyncMode or ConcurrentMode anymore. They were temporary
	// (unstable) APIs that have been removed. Can we remove the symbols?

	var REACT_ASYNC_MODE_TYPE = hasSymbol ? Symbol.for('react.async_mode') : 0xeacf;
	var REACT_CONCURRENT_MODE_TYPE = hasSymbol ? Symbol.for('react.concurrent_mode') : 0xeacf;
	var REACT_FORWARD_REF_TYPE = hasSymbol ? Symbol.for('react.forward_ref') : 0xead0;
	var REACT_SUSPENSE_TYPE = hasSymbol ? Symbol.for('react.suspense') : 0xead1;
	var REACT_SUSPENSE_LIST_TYPE = hasSymbol ? Symbol.for('react.suspense_list') : 0xead8;
	var REACT_MEMO_TYPE = hasSymbol ? Symbol.for('react.memo') : 0xead3;
	var REACT_LAZY_TYPE = hasSymbol ? Symbol.for('react.lazy') : 0xead4;
	var REACT_BLOCK_TYPE = hasSymbol ? Symbol.for('react.block') : 0xead9;
	var REACT_FUNDAMENTAL_TYPE = hasSymbol ? Symbol.for('react.fundamental') : 0xead5;
	var REACT_RESPONDER_TYPE = hasSymbol ? Symbol.for('react.responder') : 0xead6;
	var REACT_SCOPE_TYPE = hasSymbol ? Symbol.for('react.scope') : 0xead7;

	function isValidElementType(type) {
	  return typeof type === 'string' || typeof type === 'function' || // Note: its typeof might be other than 'symbol' or 'number' if it's a polyfill.
	  type === REACT_FRAGMENT_TYPE || type === REACT_CONCURRENT_MODE_TYPE || type === REACT_PROFILER_TYPE || type === REACT_STRICT_MODE_TYPE || type === REACT_SUSPENSE_TYPE || type === REACT_SUSPENSE_LIST_TYPE || typeof type === 'object' && type !== null && (type.$$typeof === REACT_LAZY_TYPE || type.$$typeof === REACT_MEMO_TYPE || type.$$typeof === REACT_PROVIDER_TYPE || type.$$typeof === REACT_CONTEXT_TYPE || type.$$typeof === REACT_FORWARD_REF_TYPE || type.$$typeof === REACT_FUNDAMENTAL_TYPE || type.$$typeof === REACT_RESPONDER_TYPE || type.$$typeof === REACT_SCOPE_TYPE || type.$$typeof === REACT_BLOCK_TYPE);
	}

	function typeOf(object) {
	  if (typeof object === 'object' && object !== null) {
	    var $$typeof = object.$$typeof;

	    switch ($$typeof) {
	      case REACT_ELEMENT_TYPE:
	        var type = object.type;

	        switch (type) {
	          case REACT_ASYNC_MODE_TYPE:
	          case REACT_CONCURRENT_MODE_TYPE:
	          case REACT_FRAGMENT_TYPE:
	          case REACT_PROFILER_TYPE:
	          case REACT_STRICT_MODE_TYPE:
	          case REACT_SUSPENSE_TYPE:
	            return type;

	          default:
	            var $$typeofType = type && type.$$typeof;

	            switch ($$typeofType) {
	              case REACT_CONTEXT_TYPE:
	              case REACT_FORWARD_REF_TYPE:
	              case REACT_LAZY_TYPE:
	              case REACT_MEMO_TYPE:
	              case REACT_PROVIDER_TYPE:
	                return $$typeofType;

	              default:
	                return $$typeof;
	            }

	        }

	      case REACT_PORTAL_TYPE:
	        return $$typeof;
	    }
	  }

	  return undefined;
	} // AsyncMode is deprecated along with isAsyncMode

	var AsyncMode = REACT_ASYNC_MODE_TYPE;
	var ConcurrentMode = REACT_CONCURRENT_MODE_TYPE;
	var ContextConsumer = REACT_CONTEXT_TYPE;
	var ContextProvider = REACT_PROVIDER_TYPE;
	var Element = REACT_ELEMENT_TYPE;
	var ForwardRef = REACT_FORWARD_REF_TYPE;
	var Fragment = REACT_FRAGMENT_TYPE;
	var Lazy = REACT_LAZY_TYPE;
	var Memo = REACT_MEMO_TYPE;
	var Portal = REACT_PORTAL_TYPE;
	var Profiler = REACT_PROFILER_TYPE;
	var StrictMode = REACT_STRICT_MODE_TYPE;
	var Suspense = REACT_SUSPENSE_TYPE;
	var hasWarnedAboutDeprecatedIsAsyncMode = false; // AsyncMode should be deprecated

	function isAsyncMode(object) {
	  {
	    if (!hasWarnedAboutDeprecatedIsAsyncMode) {
	      hasWarnedAboutDeprecatedIsAsyncMode = true; // Using console['warn'] to evade Babel and ESLint

	      console['warn']('The ReactIs.isAsyncMode() alias has been deprecated, ' + 'and will be removed in React 17+. Update your code to use ' + 'ReactIs.isConcurrentMode() instead. It has the exact same API.');
	    }
	  }

	  return isConcurrentMode(object) || typeOf(object) === REACT_ASYNC_MODE_TYPE;
	}
	function isConcurrentMode(object) {
	  return typeOf(object) === REACT_CONCURRENT_MODE_TYPE;
	}
	function isContextConsumer(object) {
	  return typeOf(object) === REACT_CONTEXT_TYPE;
	}
	function isContextProvider(object) {
	  return typeOf(object) === REACT_PROVIDER_TYPE;
	}
	function isElement(object) {
	  return typeof object === 'object' && object !== null && object.$$typeof === REACT_ELEMENT_TYPE;
	}
	function isForwardRef(object) {
	  return typeOf(object) === REACT_FORWARD_REF_TYPE;
	}
	function isFragment(object) {
	  return typeOf(object) === REACT_FRAGMENT_TYPE;
	}
	function isLazy(object) {
	  return typeOf(object) === REACT_LAZY_TYPE;
	}
	function isMemo(object) {
	  return typeOf(object) === REACT_MEMO_TYPE;
	}
	function isPortal(object) {
	  return typeOf(object) === REACT_PORTAL_TYPE;
	}
	function isProfiler(object) {
	  return typeOf(object) === REACT_PROFILER_TYPE;
	}
	function isStrictMode(object) {
	  return typeOf(object) === REACT_STRICT_MODE_TYPE;
	}
	function isSuspense(object) {
	  return typeOf(object) === REACT_SUSPENSE_TYPE;
	}

	reactIs_development.AsyncMode = AsyncMode;
	reactIs_development.ConcurrentMode = ConcurrentMode;
	reactIs_development.ContextConsumer = ContextConsumer;
	reactIs_development.ContextProvider = ContextProvider;
	reactIs_development.Element = Element;
	reactIs_development.ForwardRef = ForwardRef;
	reactIs_development.Fragment = Fragment;
	reactIs_development.Lazy = Lazy;
	reactIs_development.Memo = Memo;
	reactIs_development.Portal = Portal;
	reactIs_development.Profiler = Profiler;
	reactIs_development.StrictMode = StrictMode;
	reactIs_development.Suspense = Suspense;
	reactIs_development.isAsyncMode = isAsyncMode;
	reactIs_development.isConcurrentMode = isConcurrentMode;
	reactIs_development.isContextConsumer = isContextConsumer;
	reactIs_development.isContextProvider = isContextProvider;
	reactIs_development.isElement = isElement;
	reactIs_development.isForwardRef = isForwardRef;
	reactIs_development.isFragment = isFragment;
	reactIs_development.isLazy = isLazy;
	reactIs_development.isMemo = isMemo;
	reactIs_development.isPortal = isPortal;
	reactIs_development.isProfiler = isProfiler;
	reactIs_development.isStrictMode = isStrictMode;
	reactIs_development.isSuspense = isSuspense;
	reactIs_development.isValidElementType = isValidElementType;
	reactIs_development.typeOf = typeOf;
	  })();
	}
	return reactIs_development;
}

var hasRequiredReactIs;

function requireReactIs () {
	if (hasRequiredReactIs) return reactIs.exports;
	hasRequiredReactIs = 1;

	if (process.env.NODE_ENV === 'production') {
	  reactIs.exports = requireReactIs_production_min();
	} else {
	  reactIs.exports = requireReactIs_development();
	}
	return reactIs.exports;
}

/*
object-assign
(c) Sindre Sorhus
@license MIT
*/

var objectAssign;
var hasRequiredObjectAssign;

function requireObjectAssign () {
	if (hasRequiredObjectAssign) return objectAssign;
	hasRequiredObjectAssign = 1;
	/* eslint-disable no-unused-vars */
	var getOwnPropertySymbols = Object.getOwnPropertySymbols;
	var hasOwnProperty = Object.prototype.hasOwnProperty;
	var propIsEnumerable = Object.prototype.propertyIsEnumerable;

	function toObject(val) {
		if (val === null || val === undefined) {
			throw new TypeError('Object.assign cannot be called with null or undefined');
		}

		return Object(val);
	}

	function shouldUseNative() {
		try {
			if (!Object.assign) {
				return false;
			}

			// Detect buggy property enumeration order in older V8 versions.

			// https://bugs.chromium.org/p/v8/issues/detail?id=4118
			var test1 = new String('abc');  // eslint-disable-line no-new-wrappers
			test1[5] = 'de';
			if (Object.getOwnPropertyNames(test1)[0] === '5') {
				return false;
			}

			// https://bugs.chromium.org/p/v8/issues/detail?id=3056
			var test2 = {};
			for (var i = 0; i < 10; i++) {
				test2['_' + String.fromCharCode(i)] = i;
			}
			var order2 = Object.getOwnPropertyNames(test2).map(function (n) {
				return test2[n];
			});
			if (order2.join('') !== '0123456789') {
				return false;
			}

			// https://bugs.chromium.org/p/v8/issues/detail?id=3056
			var test3 = {};
			'abcdefghijklmnopqrst'.split('').forEach(function (letter) {
				test3[letter] = letter;
			});
			if (Object.keys(Object.assign({}, test3)).join('') !==
					'abcdefghijklmnopqrst') {
				return false;
			}

			return true;
		} catch (err) {
			// We don't expect any of the above to throw, but better to be safe.
			return false;
		}
	}

	objectAssign = shouldUseNative() ? Object.assign : function (target, source) {
		var from;
		var to = toObject(target);
		var symbols;

		for (var s = 1; s < arguments.length; s++) {
			from = Object(arguments[s]);

			for (var key in from) {
				if (hasOwnProperty.call(from, key)) {
					to[key] = from[key];
				}
			}

			if (getOwnPropertySymbols) {
				symbols = getOwnPropertySymbols(from);
				for (var i = 0; i < symbols.length; i++) {
					if (propIsEnumerable.call(from, symbols[i])) {
						to[symbols[i]] = from[symbols[i]];
					}
				}
			}
		}

		return to;
	};
	return objectAssign;
}

/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

var ReactPropTypesSecret_1;
var hasRequiredReactPropTypesSecret;

function requireReactPropTypesSecret () {
	if (hasRequiredReactPropTypesSecret) return ReactPropTypesSecret_1;
	hasRequiredReactPropTypesSecret = 1;

	var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';

	ReactPropTypesSecret_1 = ReactPropTypesSecret;
	return ReactPropTypesSecret_1;
}

var has;
var hasRequiredHas;

function requireHas () {
	if (hasRequiredHas) return has;
	hasRequiredHas = 1;
	has = Function.call.bind(Object.prototype.hasOwnProperty);
	return has;
}

/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

var checkPropTypes_1;
var hasRequiredCheckPropTypes;

function requireCheckPropTypes () {
	if (hasRequiredCheckPropTypes) return checkPropTypes_1;
	hasRequiredCheckPropTypes = 1;

	var printWarning = function() {};

	if (process.env.NODE_ENV !== 'production') {
	  var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
	  var loggedTypeFailures = {};
	  var has = /*@__PURE__*/ requireHas();

	  printWarning = function(text) {
	    var message = 'Warning: ' + text;
	    if (typeof console !== 'undefined') {
	      console.error(message);
	    }
	    try {
	      // --- Welcome to debugging React ---
	      // This error was thrown as a convenience so that you can use this stack
	      // to find the callsite that caused this warning to fire.
	      throw new Error(message);
	    } catch (x) { /**/ }
	  };
	}

	/**
	 * Assert that the values match with the type specs.
	 * Error messages are memorized and will only be shown once.
	 *
	 * @param {object} typeSpecs Map of name to a ReactPropType
	 * @param {object} values Runtime values that need to be type-checked
	 * @param {string} location e.g. "prop", "context", "child context"
	 * @param {string} componentName Name of the component for error messages.
	 * @param {?Function} getStack Returns the component stack.
	 * @private
	 */
	function checkPropTypes(typeSpecs, values, location, componentName, getStack) {
	  if (process.env.NODE_ENV !== 'production') {
	    for (var typeSpecName in typeSpecs) {
	      if (has(typeSpecs, typeSpecName)) {
	        var error;
	        // Prop type validation may throw. In case they do, we don't want to
	        // fail the render phase where it didn't fail before. So we log it.
	        // After these have been cleaned up, we'll let them throw.
	        try {
	          // This is intentionally an invariant that gets caught. It's the same
	          // behavior as without this statement except with a better message.
	          if (typeof typeSpecs[typeSpecName] !== 'function') {
	            var err = Error(
	              (componentName || 'React class') + ': ' + location + ' type `' + typeSpecName + '` is invalid; ' +
	              'it must be a function, usually from the `prop-types` package, but received `' + typeof typeSpecs[typeSpecName] + '`.' +
	              'This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.'
	            );
	            err.name = 'Invariant Violation';
	            throw err;
	          }
	          error = typeSpecs[typeSpecName](values, typeSpecName, componentName, location, null, ReactPropTypesSecret);
	        } catch (ex) {
	          error = ex;
	        }
	        if (error && !(error instanceof Error)) {
	          printWarning(
	            (componentName || 'React class') + ': type specification of ' +
	            location + ' `' + typeSpecName + '` is invalid; the type checker ' +
	            'function must return `null` or an `Error` but returned a ' + typeof error + '. ' +
	            'You may have forgotten to pass an argument to the type checker ' +
	            'creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and ' +
	            'shape all require an argument).'
	          );
	        }
	        if (error instanceof Error && !(error.message in loggedTypeFailures)) {
	          // Only monitor this failure once because there tends to be a lot of the
	          // same error.
	          loggedTypeFailures[error.message] = true;

	          var stack = getStack ? getStack() : '';

	          printWarning(
	            'Failed ' + location + ' type: ' + error.message + (stack != null ? stack : '')
	          );
	        }
	      }
	    }
	  }
	}

	/**
	 * Resets warning cache when testing.
	 *
	 * @private
	 */
	checkPropTypes.resetWarningCache = function() {
	  if (process.env.NODE_ENV !== 'production') {
	    loggedTypeFailures = {};
	  }
	};

	checkPropTypes_1 = checkPropTypes;
	return checkPropTypes_1;
}

/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

var factoryWithTypeCheckers;
var hasRequiredFactoryWithTypeCheckers;

function requireFactoryWithTypeCheckers () {
	if (hasRequiredFactoryWithTypeCheckers) return factoryWithTypeCheckers;
	hasRequiredFactoryWithTypeCheckers = 1;

	var ReactIs = requireReactIs();
	var assign = requireObjectAssign();

	var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();
	var has = /*@__PURE__*/ requireHas();
	var checkPropTypes = /*@__PURE__*/ requireCheckPropTypes();

	var printWarning = function() {};

	if (process.env.NODE_ENV !== 'production') {
	  printWarning = function(text) {
	    var message = 'Warning: ' + text;
	    if (typeof console !== 'undefined') {
	      console.error(message);
	    }
	    try {
	      // --- Welcome to debugging React ---
	      // This error was thrown as a convenience so that you can use this stack
	      // to find the callsite that caused this warning to fire.
	      throw new Error(message);
	    } catch (x) {}
	  };
	}

	function emptyFunctionThatReturnsNull() {
	  return null;
	}

	factoryWithTypeCheckers = function(isValidElement, throwOnDirectAccess) {
	  /* global Symbol */
	  var ITERATOR_SYMBOL = typeof Symbol === 'function' && Symbol.iterator;
	  var FAUX_ITERATOR_SYMBOL = '@@iterator'; // Before Symbol spec.

	  /**
	   * Returns the iterator method function contained on the iterable object.
	   *
	   * Be sure to invoke the function with the iterable as context:
	   *
	   *     var iteratorFn = getIteratorFn(myIterable);
	   *     if (iteratorFn) {
	   *       var iterator = iteratorFn.call(myIterable);
	   *       ...
	   *     }
	   *
	   * @param {?object} maybeIterable
	   * @return {?function}
	   */
	  function getIteratorFn(maybeIterable) {
	    var iteratorFn = maybeIterable && (ITERATOR_SYMBOL && maybeIterable[ITERATOR_SYMBOL] || maybeIterable[FAUX_ITERATOR_SYMBOL]);
	    if (typeof iteratorFn === 'function') {
	      return iteratorFn;
	    }
	  }

	  /**
	   * Collection of methods that allow declaration and validation of props that are
	   * supplied to React components. Example usage:
	   *
	   *   var Props = require('ReactPropTypes');
	   *   var MyArticle = React.createClass({
	   *     propTypes: {
	   *       // An optional string prop named "description".
	   *       description: Props.string,
	   *
	   *       // A required enum prop named "category".
	   *       category: Props.oneOf(['News','Photos']).isRequired,
	   *
	   *       // A prop named "dialog" that requires an instance of Dialog.
	   *       dialog: Props.instanceOf(Dialog).isRequired
	   *     },
	   *     render: function() { ... }
	   *   });
	   *
	   * A more formal specification of how these methods are used:
	   *
	   *   type := array|bool|func|object|number|string|oneOf([...])|instanceOf(...)
	   *   decl := ReactPropTypes.{type}(.isRequired)?
	   *
	   * Each and every declaration produces a function with the same signature. This
	   * allows the creation of custom validation functions. For example:
	   *
	   *  var MyLink = React.createClass({
	   *    propTypes: {
	   *      // An optional string or URI prop named "href".
	   *      href: function(props, propName, componentName) {
	   *        var propValue = props[propName];
	   *        if (propValue != null && typeof propValue !== 'string' &&
	   *            !(propValue instanceof URI)) {
	   *          return new Error(
	   *            'Expected a string or an URI for ' + propName + ' in ' +
	   *            componentName
	   *          );
	   *        }
	   *      }
	   *    },
	   *    render: function() {...}
	   *  });
	   *
	   * @internal
	   */

	  var ANONYMOUS = '<<anonymous>>';

	  // Important!
	  // Keep this list in sync with production version in `./factoryWithThrowingShims.js`.
	  var ReactPropTypes = {
	    array: createPrimitiveTypeChecker('array'),
	    bigint: createPrimitiveTypeChecker('bigint'),
	    bool: createPrimitiveTypeChecker('boolean'),
	    func: createPrimitiveTypeChecker('function'),
	    number: createPrimitiveTypeChecker('number'),
	    object: createPrimitiveTypeChecker('object'),
	    string: createPrimitiveTypeChecker('string'),
	    symbol: createPrimitiveTypeChecker('symbol'),

	    any: createAnyTypeChecker(),
	    arrayOf: createArrayOfTypeChecker,
	    element: createElementTypeChecker(),
	    elementType: createElementTypeTypeChecker(),
	    instanceOf: createInstanceTypeChecker,
	    node: createNodeChecker(),
	    objectOf: createObjectOfTypeChecker,
	    oneOf: createEnumTypeChecker,
	    oneOfType: createUnionTypeChecker,
	    shape: createShapeTypeChecker,
	    exact: createStrictShapeTypeChecker,
	  };

	  /**
	   * inlined Object.is polyfill to avoid requiring consumers ship their own
	   * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
	   */
	  /*eslint-disable no-self-compare*/
	  function is(x, y) {
	    // SameValue algorithm
	    if (x === y) {
	      // Steps 1-5, 7-10
	      // Steps 6.b-6.e: +0 != -0
	      return x !== 0 || 1 / x === 1 / y;
	    } else {
	      // Step 6.a: NaN == NaN
	      return x !== x && y !== y;
	    }
	  }
	  /*eslint-enable no-self-compare*/

	  /**
	   * We use an Error-like object for backward compatibility as people may call
	   * PropTypes directly and inspect their output. However, we don't use real
	   * Errors anymore. We don't inspect their stack anyway, and creating them
	   * is prohibitively expensive if they are created too often, such as what
	   * happens in oneOfType() for any type before the one that matched.
	   */
	  function PropTypeError(message, data) {
	    this.message = message;
	    this.data = data && typeof data === 'object' ? data: {};
	    this.stack = '';
	  }
	  // Make `instanceof Error` still work for returned errors.
	  PropTypeError.prototype = Error.prototype;

	  function createChainableTypeChecker(validate) {
	    if (process.env.NODE_ENV !== 'production') {
	      var manualPropTypeCallCache = {};
	      var manualPropTypeWarningCount = 0;
	    }
	    function checkType(isRequired, props, propName, componentName, location, propFullName, secret) {
	      componentName = componentName || ANONYMOUS;
	      propFullName = propFullName || propName;

	      if (secret !== ReactPropTypesSecret) {
	        if (throwOnDirectAccess) {
	          // New behavior only for users of `prop-types` package
	          var err = new Error(
	            'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
	            'Use `PropTypes.checkPropTypes()` to call them. ' +
	            'Read more at http://fb.me/use-check-prop-types'
	          );
	          err.name = 'Invariant Violation';
	          throw err;
	        } else if (process.env.NODE_ENV !== 'production' && typeof console !== 'undefined') {
	          // Old behavior for people using React.PropTypes
	          var cacheKey = componentName + ':' + propName;
	          if (
	            !manualPropTypeCallCache[cacheKey] &&
	            // Avoid spamming the console because they are often not actionable except for lib authors
	            manualPropTypeWarningCount < 3
	          ) {
	            printWarning(
	              'You are manually calling a React.PropTypes validation ' +
	              'function for the `' + propFullName + '` prop on `' + componentName + '`. This is deprecated ' +
	              'and will throw in the standalone `prop-types` package. ' +
	              'You may be seeing this warning due to a third-party PropTypes ' +
	              'library. See https://fb.me/react-warning-dont-call-proptypes ' + 'for details.'
	            );
	            manualPropTypeCallCache[cacheKey] = true;
	            manualPropTypeWarningCount++;
	          }
	        }
	      }
	      if (props[propName] == null) {
	        if (isRequired) {
	          if (props[propName] === null) {
	            return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required ' + ('in `' + componentName + '`, but its value is `null`.'));
	          }
	          return new PropTypeError('The ' + location + ' `' + propFullName + '` is marked as required in ' + ('`' + componentName + '`, but its value is `undefined`.'));
	        }
	        return null;
	      } else {
	        return validate(props, propName, componentName, location, propFullName);
	      }
	    }

	    var chainedCheckType = checkType.bind(null, false);
	    chainedCheckType.isRequired = checkType.bind(null, true);

	    return chainedCheckType;
	  }

	  function createPrimitiveTypeChecker(expectedType) {
	    function validate(props, propName, componentName, location, propFullName, secret) {
	      var propValue = props[propName];
	      var propType = getPropType(propValue);
	      if (propType !== expectedType) {
	        // `propValue` being instance of, say, date/regexp, pass the 'object'
	        // check, but we can offer a more precise error message here rather than
	        // 'of type `object`'.
	        var preciseType = getPreciseType(propValue);

	        return new PropTypeError(
	          'Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + preciseType + '` supplied to `' + componentName + '`, expected ') + ('`' + expectedType + '`.'),
	          {expectedType: expectedType}
	        );
	      }
	      return null;
	    }
	    return createChainableTypeChecker(validate);
	  }

	  function createAnyTypeChecker() {
	    return createChainableTypeChecker(emptyFunctionThatReturnsNull);
	  }

	  function createArrayOfTypeChecker(typeChecker) {
	    function validate(props, propName, componentName, location, propFullName) {
	      if (typeof typeChecker !== 'function') {
	        return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside arrayOf.');
	      }
	      var propValue = props[propName];
	      if (!Array.isArray(propValue)) {
	        var propType = getPropType(propValue);
	        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an array.'));
	      }
	      for (var i = 0; i < propValue.length; i++) {
	        var error = typeChecker(propValue, i, componentName, location, propFullName + '[' + i + ']', ReactPropTypesSecret);
	        if (error instanceof Error) {
	          return error;
	        }
	      }
	      return null;
	    }
	    return createChainableTypeChecker(validate);
	  }

	  function createElementTypeChecker() {
	    function validate(props, propName, componentName, location, propFullName) {
	      var propValue = props[propName];
	      if (!isValidElement(propValue)) {
	        var propType = getPropType(propValue);
	        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement.'));
	      }
	      return null;
	    }
	    return createChainableTypeChecker(validate);
	  }

	  function createElementTypeTypeChecker() {
	    function validate(props, propName, componentName, location, propFullName) {
	      var propValue = props[propName];
	      if (!ReactIs.isValidElementType(propValue)) {
	        var propType = getPropType(propValue);
	        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected a single ReactElement type.'));
	      }
	      return null;
	    }
	    return createChainableTypeChecker(validate);
	  }

	  function createInstanceTypeChecker(expectedClass) {
	    function validate(props, propName, componentName, location, propFullName) {
	      if (!(props[propName] instanceof expectedClass)) {
	        var expectedClassName = expectedClass.name || ANONYMOUS;
	        var actualClassName = getClassName(props[propName]);
	        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + actualClassName + '` supplied to `' + componentName + '`, expected ') + ('instance of `' + expectedClassName + '`.'));
	      }
	      return null;
	    }
	    return createChainableTypeChecker(validate);
	  }

	  function createEnumTypeChecker(expectedValues) {
	    if (!Array.isArray(expectedValues)) {
	      if (process.env.NODE_ENV !== 'production') {
	        if (arguments.length > 1) {
	          printWarning(
	            'Invalid arguments supplied to oneOf, expected an array, got ' + arguments.length + ' arguments. ' +
	            'A common mistake is to write oneOf(x, y, z) instead of oneOf([x, y, z]).'
	          );
	        } else {
	          printWarning('Invalid argument supplied to oneOf, expected an array.');
	        }
	      }
	      return emptyFunctionThatReturnsNull;
	    }

	    function validate(props, propName, componentName, location, propFullName) {
	      var propValue = props[propName];
	      for (var i = 0; i < expectedValues.length; i++) {
	        if (is(propValue, expectedValues[i])) {
	          return null;
	        }
	      }

	      var valuesString = JSON.stringify(expectedValues, function replacer(key, value) {
	        var type = getPreciseType(value);
	        if (type === 'symbol') {
	          return String(value);
	        }
	        return value;
	      });
	      return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of value `' + String(propValue) + '` ' + ('supplied to `' + componentName + '`, expected one of ' + valuesString + '.'));
	    }
	    return createChainableTypeChecker(validate);
	  }

	  function createObjectOfTypeChecker(typeChecker) {
	    function validate(props, propName, componentName, location, propFullName) {
	      if (typeof typeChecker !== 'function') {
	        return new PropTypeError('Property `' + propFullName + '` of component `' + componentName + '` has invalid PropType notation inside objectOf.');
	      }
	      var propValue = props[propName];
	      var propType = getPropType(propValue);
	      if (propType !== 'object') {
	        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type ' + ('`' + propType + '` supplied to `' + componentName + '`, expected an object.'));
	      }
	      for (var key in propValue) {
	        if (has(propValue, key)) {
	          var error = typeChecker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
	          if (error instanceof Error) {
	            return error;
	          }
	        }
	      }
	      return null;
	    }
	    return createChainableTypeChecker(validate);
	  }

	  function createUnionTypeChecker(arrayOfTypeCheckers) {
	    if (!Array.isArray(arrayOfTypeCheckers)) {
	      process.env.NODE_ENV !== 'production' ? printWarning('Invalid argument supplied to oneOfType, expected an instance of array.') : void 0;
	      return emptyFunctionThatReturnsNull;
	    }

	    for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
	      var checker = arrayOfTypeCheckers[i];
	      if (typeof checker !== 'function') {
	        printWarning(
	          'Invalid argument supplied to oneOfType. Expected an array of check functions, but ' +
	          'received ' + getPostfixForTypeWarning(checker) + ' at index ' + i + '.'
	        );
	        return emptyFunctionThatReturnsNull;
	      }
	    }

	    function validate(props, propName, componentName, location, propFullName) {
	      var expectedTypes = [];
	      for (var i = 0; i < arrayOfTypeCheckers.length; i++) {
	        var checker = arrayOfTypeCheckers[i];
	        var checkerResult = checker(props, propName, componentName, location, propFullName, ReactPropTypesSecret);
	        if (checkerResult == null) {
	          return null;
	        }
	        if (checkerResult.data && has(checkerResult.data, 'expectedType')) {
	          expectedTypes.push(checkerResult.data.expectedType);
	        }
	      }
	      var expectedTypesMessage = (expectedTypes.length > 0) ? ', expected one of type [' + expectedTypes.join(', ') + ']': '';
	      return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`' + expectedTypesMessage + '.'));
	    }
	    return createChainableTypeChecker(validate);
	  }

	  function createNodeChecker() {
	    function validate(props, propName, componentName, location, propFullName) {
	      if (!isNode(props[propName])) {
	        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` supplied to ' + ('`' + componentName + '`, expected a ReactNode.'));
	      }
	      return null;
	    }
	    return createChainableTypeChecker(validate);
	  }

	  function invalidValidatorError(componentName, location, propFullName, key, type) {
	    return new PropTypeError(
	      (componentName || 'React class') + ': ' + location + ' type `' + propFullName + '.' + key + '` is invalid; ' +
	      'it must be a function, usually from the `prop-types` package, but received `' + type + '`.'
	    );
	  }

	  function createShapeTypeChecker(shapeTypes) {
	    function validate(props, propName, componentName, location, propFullName) {
	      var propValue = props[propName];
	      var propType = getPropType(propValue);
	      if (propType !== 'object') {
	        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
	      }
	      for (var key in shapeTypes) {
	        var checker = shapeTypes[key];
	        if (typeof checker !== 'function') {
	          return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
	        }
	        var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
	        if (error) {
	          return error;
	        }
	      }
	      return null;
	    }
	    return createChainableTypeChecker(validate);
	  }

	  function createStrictShapeTypeChecker(shapeTypes) {
	    function validate(props, propName, componentName, location, propFullName) {
	      var propValue = props[propName];
	      var propType = getPropType(propValue);
	      if (propType !== 'object') {
	        return new PropTypeError('Invalid ' + location + ' `' + propFullName + '` of type `' + propType + '` ' + ('supplied to `' + componentName + '`, expected `object`.'));
	      }
	      // We need to check all keys in case some are required but missing from props.
	      var allKeys = assign({}, props[propName], shapeTypes);
	      for (var key in allKeys) {
	        var checker = shapeTypes[key];
	        if (has(shapeTypes, key) && typeof checker !== 'function') {
	          return invalidValidatorError(componentName, location, propFullName, key, getPreciseType(checker));
	        }
	        if (!checker) {
	          return new PropTypeError(
	            'Invalid ' + location + ' `' + propFullName + '` key `' + key + '` supplied to `' + componentName + '`.' +
	            '\nBad object: ' + JSON.stringify(props[propName], null, '  ') +
	            '\nValid keys: ' + JSON.stringify(Object.keys(shapeTypes), null, '  ')
	          );
	        }
	        var error = checker(propValue, key, componentName, location, propFullName + '.' + key, ReactPropTypesSecret);
	        if (error) {
	          return error;
	        }
	      }
	      return null;
	    }

	    return createChainableTypeChecker(validate);
	  }

	  function isNode(propValue) {
	    switch (typeof propValue) {
	      case 'number':
	      case 'string':
	      case 'undefined':
	        return true;
	      case 'boolean':
	        return !propValue;
	      case 'object':
	        if (Array.isArray(propValue)) {
	          return propValue.every(isNode);
	        }
	        if (propValue === null || isValidElement(propValue)) {
	          return true;
	        }

	        var iteratorFn = getIteratorFn(propValue);
	        if (iteratorFn) {
	          var iterator = iteratorFn.call(propValue);
	          var step;
	          if (iteratorFn !== propValue.entries) {
	            while (!(step = iterator.next()).done) {
	              if (!isNode(step.value)) {
	                return false;
	              }
	            }
	          } else {
	            // Iterator will provide entry [k,v] tuples rather than values.
	            while (!(step = iterator.next()).done) {
	              var entry = step.value;
	              if (entry) {
	                if (!isNode(entry[1])) {
	                  return false;
	                }
	              }
	            }
	          }
	        } else {
	          return false;
	        }

	        return true;
	      default:
	        return false;
	    }
	  }

	  function isSymbol(propType, propValue) {
	    // Native Symbol.
	    if (propType === 'symbol') {
	      return true;
	    }

	    // falsy value can't be a Symbol
	    if (!propValue) {
	      return false;
	    }

	    // 19.4.3.5 Symbol.prototype[@@toStringTag] === 'Symbol'
	    if (propValue['@@toStringTag'] === 'Symbol') {
	      return true;
	    }

	    // Fallback for non-spec compliant Symbols which are polyfilled.
	    if (typeof Symbol === 'function' && propValue instanceof Symbol) {
	      return true;
	    }

	    return false;
	  }

	  // Equivalent of `typeof` but with special handling for array and regexp.
	  function getPropType(propValue) {
	    var propType = typeof propValue;
	    if (Array.isArray(propValue)) {
	      return 'array';
	    }
	    if (propValue instanceof RegExp) {
	      // Old webkits (at least until Android 4.0) return 'function' rather than
	      // 'object' for typeof a RegExp. We'll normalize this here so that /bla/
	      // passes PropTypes.object.
	      return 'object';
	    }
	    if (isSymbol(propType, propValue)) {
	      return 'symbol';
	    }
	    return propType;
	  }

	  // This handles more types than `getPropType`. Only used for error messages.
	  // See `createPrimitiveTypeChecker`.
	  function getPreciseType(propValue) {
	    if (typeof propValue === 'undefined' || propValue === null) {
	      return '' + propValue;
	    }
	    var propType = getPropType(propValue);
	    if (propType === 'object') {
	      if (propValue instanceof Date) {
	        return 'date';
	      } else if (propValue instanceof RegExp) {
	        return 'regexp';
	      }
	    }
	    return propType;
	  }

	  // Returns a string that is postfixed to a warning about an invalid type.
	  // For example, "undefined" or "of type array"
	  function getPostfixForTypeWarning(value) {
	    var type = getPreciseType(value);
	    switch (type) {
	      case 'array':
	      case 'object':
	        return 'an ' + type;
	      case 'boolean':
	      case 'date':
	      case 'regexp':
	        return 'a ' + type;
	      default:
	        return type;
	    }
	  }

	  // Returns class name of the object, if any.
	  function getClassName(propValue) {
	    if (!propValue.constructor || !propValue.constructor.name) {
	      return ANONYMOUS;
	    }
	    return propValue.constructor.name;
	  }

	  ReactPropTypes.checkPropTypes = checkPropTypes;
	  ReactPropTypes.resetWarningCache = checkPropTypes.resetWarningCache;
	  ReactPropTypes.PropTypes = ReactPropTypes;

	  return ReactPropTypes;
	};
	return factoryWithTypeCheckers;
}

/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

var factoryWithThrowingShims;
var hasRequiredFactoryWithThrowingShims;

function requireFactoryWithThrowingShims () {
	if (hasRequiredFactoryWithThrowingShims) return factoryWithThrowingShims;
	hasRequiredFactoryWithThrowingShims = 1;

	var ReactPropTypesSecret = /*@__PURE__*/ requireReactPropTypesSecret();

	function emptyFunction() {}
	function emptyFunctionWithReset() {}
	emptyFunctionWithReset.resetWarningCache = emptyFunction;

	factoryWithThrowingShims = function() {
	  function shim(props, propName, componentName, location, propFullName, secret) {
	    if (secret === ReactPropTypesSecret) {
	      // It is still safe when called from React.
	      return;
	    }
	    var err = new Error(
	      'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
	      'Use PropTypes.checkPropTypes() to call them. ' +
	      'Read more at http://fb.me/use-check-prop-types'
	    );
	    err.name = 'Invariant Violation';
	    throw err;
	  }	  shim.isRequired = shim;
	  function getShim() {
	    return shim;
	  }	  // Important!
	  // Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
	  var ReactPropTypes = {
	    array: shim,
	    bigint: shim,
	    bool: shim,
	    func: shim,
	    number: shim,
	    object: shim,
	    string: shim,
	    symbol: shim,

	    any: shim,
	    arrayOf: getShim,
	    element: shim,
	    elementType: shim,
	    instanceOf: getShim,
	    node: shim,
	    objectOf: getShim,
	    oneOf: getShim,
	    oneOfType: getShim,
	    shape: getShim,
	    exact: getShim,

	    checkPropTypes: emptyFunctionWithReset,
	    resetWarningCache: emptyFunction
	  };

	  ReactPropTypes.PropTypes = ReactPropTypes;

	  return ReactPropTypes;
	};
	return factoryWithThrowingShims;
}

/**
 * Copyright (c) 2013-present, Facebook, Inc.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

var hasRequiredPropTypes;

function requirePropTypes () {
	if (hasRequiredPropTypes) return propTypes.exports;
	hasRequiredPropTypes = 1;
	if (process.env.NODE_ENV !== 'production') {
	  var ReactIs = requireReactIs();

	  // By explicitly using `prop-types` you are opting into new development behavior.
	  // http://fb.me/prop-types-in-prod
	  var throwOnDirectAccess = true;
	  propTypes.exports = /*@__PURE__*/ requireFactoryWithTypeCheckers()(ReactIs.isElement, throwOnDirectAccess);
	} else {
	  // By explicitly using `prop-types` you are opting into new production behavior.
	  // http://fb.me/prop-types-in-prod
	  propTypes.exports = /*@__PURE__*/ requireFactoryWithThrowingShims()();
	}
	return propTypes.exports;
}

var propTypesExports = /*@__PURE__*/ requirePropTypes();
var _pt = /*@__PURE__*/getDefaultExportFromCjs(propTypesExports);

var classnames = {exports: {}};

/*!
	Copyright (c) 2018 Jed Watson.
	Licensed under the MIT License (MIT), see
	http://jedwatson.github.io/classnames
*/

var hasRequiredClassnames;

function requireClassnames () {
	if (hasRequiredClassnames) return classnames.exports;
	hasRequiredClassnames = 1;
	(function (module) {
		/* global define */

		(function () {

			var hasOwn = {}.hasOwnProperty;

			function classNames () {
				var classes = '';

				for (var i = 0; i < arguments.length; i++) {
					var arg = arguments[i];
					if (arg) {
						classes = appendClass(classes, parseValue(arg));
					}
				}

				return classes;
			}

			function parseValue (arg) {
				if (typeof arg === 'string' || typeof arg === 'number') {
					return arg;
				}

				if (typeof arg !== 'object') {
					return '';
				}

				if (Array.isArray(arg)) {
					return classNames.apply(null, arg);
				}

				if (arg.toString !== Object.prototype.toString && !arg.toString.toString().includes('[native code]')) {
					return arg.toString();
				}

				var classes = '';

				for (var key in arg) {
					if (hasOwn.call(arg, key) && arg[key]) {
						classes = appendClass(classes, key);
					}
				}

				return classes;
			}

			function appendClass (value, newClass) {
				if (!newClass) {
					return value;
				}
			
				if (value) {
					return value + ' ' + newClass;
				}
			
				return value + newClass;
			}

			if (module.exports) {
				classNames.default = classNames;
				module.exports = classNames;
			} else {
				window.classNames = classNames;
			}
		}()); 
	} (classnames));
	return classnames.exports;
}

var classnamesExports = requireClassnames();
var cx = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);

var _excluded$6 = ["className", "top", "left", "offsetLeft", "offsetTop", "style", "children", "unstyled", "applyPositionStyle"];
function _extends$a() { _extends$a = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$a.apply(this, arguments); }
function _objectWithoutPropertiesLoose$6(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var defaultStyles = {
  position: 'absolute',
  backgroundColor: 'white',
  color: '#666666',
  padding: '.3rem .5rem',
  borderRadius: '3px',
  fontSize: '14px',
  boxShadow: '0 1px 2px rgba(33,33,33,0.2)',
  lineHeight: '1em',
  pointerEvents: 'none'
};
var Tooltip = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
  var className = _ref.className,
    top = _ref.top,
    left = _ref.left,
    _ref$offsetLeft = _ref.offsetLeft,
    offsetLeft = _ref$offsetLeft === void 0 ? 10 : _ref$offsetLeft,
    _ref$offsetTop = _ref.offsetTop,
    offsetTop = _ref$offsetTop === void 0 ? 10 : _ref$offsetTop,
    _ref$style = _ref.style,
    style = _ref$style === void 0 ? defaultStyles : _ref$style,
    children = _ref.children,
    _ref$unstyled = _ref.unstyled,
    unstyled = _ref$unstyled === void 0 ? false : _ref$unstyled,
    _ref$applyPositionSty = _ref.applyPositionStyle,
    applyPositionStyle = _ref$applyPositionSty === void 0 ? false : _ref$applyPositionSty,
    restProps = _objectWithoutPropertiesLoose$6(_ref, _excluded$6);
  return /*#__PURE__*/React.createElement("div", _extends$a({
    ref: ref,
    className: cx('visx-tooltip', className),
    style: _extends$a({
      top: top == null || offsetTop == null ? top : top + offsetTop,
      left: left == null || offsetLeft == null ? left : left + offsetLeft
    }, applyPositionStyle && {
      position: 'absolute'
    }, !unstyled && style)
  }, restProps), children);
});
Tooltip.propTypes = {
  children: _pt.node,
  className: _pt.string,
  left: _pt.number,
  offsetLeft: _pt.number,
  offsetTop: _pt.number,
  top: _pt.number,
  applyPositionStyle: _pt.bool,
  unstyled: _pt.bool
};
Tooltip.displayName = 'Tooltip';

function _extends$9() { _extends$9 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$9.apply(this, arguments); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
var emptyRect = {
  top: 0,
  right: 0,
  bottom: 0,
  left: 0,
  width: 0,
  height: 0
};
function withBoundingRects(BaseComponent) {
  var _class;
  return _class = /*#__PURE__*/function (_React$PureComponent) {
    _inheritsLoose(WrappedComponent, _React$PureComponent);
    function WrappedComponent(props) {
      var _this;
      _this = _React$PureComponent.call(this, props) || this;
      _this.state = {
        rect: undefined,
        parentRect: undefined
      };
      _this.nodeRef = /*#__PURE__*/React.createRef();
      _this.getRects = _this.getRects.bind(_assertThisInitialized(_this));
      return _this;
    }
    var _proto = WrappedComponent.prototype;
    _proto.componentDidMount = function componentDidMount() {
      var _this$nodeRef,
        _this2 = this;
      this.node = (_this$nodeRef = this.nodeRef) != null && _this$nodeRef.current ? this.nodeRef.current : ReactDOM.findDOMNode(this);
      this.setState(function () {
        return _this2.getRects();
      });
    };
    _proto.getRects = function getRects() {
      if (!this.node) return this.state;
      var node = this.node;
      var parentNode = node.parentNode;
      var rect = node.getBoundingClientRect ? node.getBoundingClientRect() : emptyRect;
      var parentRect = parentNode != null && parentNode.getBoundingClientRect ? parentNode.getBoundingClientRect() : emptyRect;
      return {
        rect: rect,
        parentRect: parentRect
      };
    };
    _proto.render = function render() {
      return /*#__PURE__*/React.createElement(BaseComponent, _extends$9({
        nodeRef: this.nodeRef,
        getRects: this.getRects
      }, this.state, this.props));
    };
    return WrappedComponent;
  }(React.PureComponent), _class.displayName = "withBoundingRects(" + (BaseComponent.displayName || '') + ")", _class;
}

var TooltipPositionContext = /*#__PURE__*/createContext({
  isFlippedVertically: false,
  isFlippedHorizontally: false
});
var TooltipPositionProvider = TooltipPositionContext.Provider;
TooltipPositionContext.Consumer;

var _excluded$5 = ["children", "getRects", "left", "offsetLeft", "offsetTop", "parentRect", "rect", "style", "top", "unstyled", "nodeRef"];
function _extends$8() { _extends$8 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$8.apply(this, arguments); }
function _objectWithoutPropertiesLoose$5(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function TooltipWithBounds(_ref) {
  var children = _ref.children;
    _ref.getRects;
    var _ref$left = _ref.left,
    initialLeft = _ref$left === void 0 ? 0 : _ref$left,
    _ref$offsetLeft = _ref.offsetLeft,
    offsetLeft = _ref$offsetLeft === void 0 ? 10 : _ref$offsetLeft,
    _ref$offsetTop = _ref.offsetTop,
    offsetTop = _ref$offsetTop === void 0 ? 10 : _ref$offsetTop,
    parentBounds = _ref.parentRect,
    ownBounds = _ref.rect,
    _ref$style = _ref.style,
    style = _ref$style === void 0 ? defaultStyles : _ref$style,
    _ref$top = _ref.top,
    initialTop = _ref$top === void 0 ? 0 : _ref$top,
    _ref$unstyled = _ref.unstyled,
    unstyled = _ref$unstyled === void 0 ? false : _ref$unstyled,
    nodeRef = _ref.nodeRef,
    otherProps = _objectWithoutPropertiesLoose$5(_ref, _excluded$5);
  var transform;
  var placeTooltipLeft = false;
  var placeTooltipUp = false;
  if (ownBounds && parentBounds) {
    var left = initialLeft;
    var top = initialTop;
    if (parentBounds.width) {
      var rightPlacementClippedPx = left + offsetLeft + ownBounds.width - parentBounds.width;
      var leftPlacementClippedPx = ownBounds.width - left - offsetLeft;
      placeTooltipLeft = rightPlacementClippedPx > 0 && rightPlacementClippedPx > leftPlacementClippedPx;
    } else {
      var _rightPlacementClippedPx = left + offsetLeft + ownBounds.width - window.innerWidth;
      var _leftPlacementClippedPx = ownBounds.width - left - offsetLeft;
      placeTooltipLeft = _rightPlacementClippedPx > 0 && _rightPlacementClippedPx > _leftPlacementClippedPx;
    }
    if (parentBounds.height) {
      var bottomPlacementClippedPx = top + offsetTop + ownBounds.height - parentBounds.height;
      var topPlacementClippedPx = ownBounds.height - top - offsetTop;
      placeTooltipUp = bottomPlacementClippedPx > 0 && bottomPlacementClippedPx > topPlacementClippedPx;
    } else {
      placeTooltipUp = top + offsetTop + ownBounds.height > window.innerHeight;
    }
    left = placeTooltipLeft ? left - ownBounds.width - offsetLeft : left + offsetLeft;
    top = placeTooltipUp ? top - ownBounds.height - offsetTop : top + offsetTop;
    left = Math.round(left);
    top = Math.round(top);
    transform = "translate(" + left + "px, " + top + "px)";
  }
  return /*#__PURE__*/React.createElement(Tooltip, _extends$8({
    ref: nodeRef,
    style: _extends$8({
      left: 0,
      top: 0,
      transform: transform
    }, !unstyled && style)
  }, otherProps), /*#__PURE__*/React.createElement(TooltipPositionProvider, {
    value: {
      isFlippedVertically: !placeTooltipUp,
      isFlippedHorizontally: !placeTooltipLeft
    }
  }, children));
}
TooltipWithBounds.propTypes = {
  nodeRef: _pt.oneOfType([_pt.string, _pt.func, _pt.object])
};
var TooltipWithBounds$1 = withBoundingRects(TooltipWithBounds);

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 exp = Math.exp;
var log = Math.log;
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(object, stream) {
    streamGeometry(object.geometry, stream);
  },
  FeatureCollection: function(object, stream) {
    var features = object.features, i = -1, n = features.length;
    while (++i < n) streamGeometry(features[i].geometry, stream);
  }
};

var streamGeometryType = {
  Sphere: function(object, stream) {
    stream.sphere();
  },
  Point: function(object, stream) {
    object = object.coordinates;
    stream.point(object[0], object[1], object[2]);
  },
  MultiPoint: function(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(object, stream) {
    streamLine(object.coordinates, stream, 0);
  },
  MultiLineString: function(object, stream) {
    var coordinates = object.coordinates, i = -1, n = coordinates.length;
    while (++i < n) streamLine(coordinates[i], stream, 0);
  },
  Polygon: function(object, stream) {
    streamPolygon(object.coordinates, stream);
  },
  MultiPolygon: function(object, stream) {
    var coordinates = object.coordinates, i = -1, n = coordinates.length;
    while (++i < n) streamPolygon(coordinates[i], stream);
  },
  GeometryCollection: function(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) {
  if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;
  return [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) {
    lambda += deltaLambda;
    if (abs(lambda) > pi) lambda -= Math.round(lambda / tau) * tau;
    return [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;
}

// Generates a circle centered at [0°, 0°], with a given radius and precision.
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(x, y, m) {
      line.push([x, y, m]);
    },
    lineStart: function() {
      lines.push(line = []);
    },
    lineEnd: noop,
    rejoin: function() {
      if (lines.length > 1) lines.push(lines.pop().concat(lines.shift()));
    },
    result: function() {
      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;
}

function longitude(point) {
  return abs(point[0]) <= pi ? point[0] : 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;

  var sum = new Adder();

  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 < -epsilon2) ^ (winding & 1);
}

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() {
        clip.point = pointRing;
        clip.lineStart = ringStart;
        clip.lineEnd = ringEnd;
        segments = [];
        polygon = [];
      },
      polygonEnd: function() {
        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() {
        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() {
      stream.lineStart();
      clean = 1;
    },
    point: function(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() {
      stream.lineEnd();
      lambda0 = phi0 = NaN;
    },
    clean: function() {
      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() {
        v00 = v0 = false;
        clean = 1;
      },
      point: function(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() {
        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() {
        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 identity$1 = x => x;

var areaSum = new Adder(),
    areaRingSum = new Adder(),
    x00$2,
    y00$2,
    x0$3,
    y0$3;

var areaStream = {
  point: noop,
  lineStart: noop,
  lineEnd: noop,
  polygonStart: function() {
    areaStream.lineStart = areaRingStart;
    areaStream.lineEnd = areaRingEnd;
  },
  polygonEnd: function() {
    areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop;
    areaSum.add(abs(areaRingSum));
    areaRingSum = new Adder();
  },
  result: function() {
    var area = areaSum / 2;
    areaSum = new Adder();
    return area;
  }
};

function areaRingStart() {
  areaStream.point = areaPointFirst;
}

function areaPointFirst(x, y) {
  areaStream.point = areaPoint;
  x00$2 = x0$3 = x, y00$2 = y0$3 = y;
}

function areaPoint(x, y) {
  areaRingSum.add(y0$3 * x - x0$3 * y);
  x0$3 = x, y0$3 = y;
}

function areaRingEnd() {
  areaPoint(x00$2, y00$2);
}

var x0$2 = Infinity,
    y0$2 = x0$2,
    x1 = -x0$2,
    y1 = x1;

var boundsStream = {
  point: boundsPoint,
  lineStart: noop,
  lineEnd: noop,
  polygonStart: noop,
  polygonEnd: noop,
  result: function() {
    var bounds = [[x0$2, y0$2], [x1, y1]];
    x1 = y1 = -(y0$2 = x0$2 = Infinity);
    return bounds;
  }
};

function boundsPoint(x, y) {
  if (x < x0$2) x0$2 = x;
  if (x > x1) x1 = x;
  if (y < y0$2) y0$2 = y;
  if (y > y1) y1 = y;
}

// TODO Enforce positive area for exterior, negative area for interior?

var X0 = 0,
    Y0 = 0,
    Z0 = 0,
    X1 = 0,
    Y1 = 0,
    Z1 = 0,
    X2 = 0,
    Y2 = 0,
    Z2 = 0,
    x00$1,
    y00$1,
    x0$1,
    y0$1;

var centroidStream = {
  point: centroidPoint,
  lineStart: centroidLineStart,
  lineEnd: centroidLineEnd,
  polygonStart: function() {
    centroidStream.lineStart = centroidRingStart;
    centroidStream.lineEnd = centroidRingEnd;
  },
  polygonEnd: function() {
    centroidStream.point = centroidPoint;
    centroidStream.lineStart = centroidLineStart;
    centroidStream.lineEnd = centroidLineEnd;
  },
  result: function() {
    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$1 = x, y0$1 = y);
}

function centroidPointLine(x, y) {
  var dx = x - x0$1, dy = y - y0$1, z = sqrt(dx * dx + dy * dy);
  X1 += z * (x0$1 + x) / 2;
  Y1 += z * (y0$1 + y) / 2;
  Z1 += z;
  centroidPoint(x0$1 = x, y0$1 = 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$1 = x, y00$1 = y0$1 = y);
}

function centroidPointRing(x, y) {
  var dx = x - x0$1,
      dy = y - y0$1,
      z = sqrt(dx * dx + dy * dy);

  X1 += z * (x0$1 + x) / 2;
  Y1 += z * (y0$1 + y) / 2;
  Z1 += z;

  z = y0$1 * x - x0$1 * y;
  X2 += z * (x0$1 + x);
  Y2 += z * (y0$1 + y);
  Z2 += z * 3;
  centroidPoint(x0$1 = x, y0$1 = y);
}

function PathContext(context) {
  this._context = context;
}

PathContext.prototype = {
  _radius: 4.5,
  pointRadius: function(_) {
    return this._radius = _, this;
  },
  polygonStart: function() {
    this._line = 0;
  },
  polygonEnd: function() {
    this._line = NaN;
  },
  lineStart: function() {
    this._point = 0;
  },
  lineEnd: function() {
    if (this._line === 0) this._context.closePath();
    this._point = NaN;
  },
  point: function(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 = new Adder(),
    lengthRing,
    x00,
    y00,
    x0,
    y0;

var lengthStream = {
  point: noop,
  lineStart: function() {
    lengthStream.point = lengthPointFirst;
  },
  lineEnd: function() {
    if (lengthRing) lengthPoint(x00, y00);
    lengthStream.point = noop;
  },
  polygonStart: function() {
    lengthRing = true;
  },
  polygonEnd: function() {
    lengthRing = null;
  },
  result: function() {
    var length = +lengthSum;
    lengthSum = new Adder();
    return length;
  }
};

function lengthPointFirst(x, y) {
  lengthStream.point = lengthPoint;
  x00 = x0 = x, y00 = y0 = y;
}

function lengthPoint(x, y) {
  x0 -= x, y0 -= y;
  lengthSum.add(sqrt(x0 * x0 + y0 * y0));
  x0 = x, y0 = y;
}

// Simple caching for constant-radius points.
let cacheDigits, cacheAppend, cacheRadius, cacheCircle;

class PathString {
  constructor(digits) {
    this._append = digits == null ? append : appendRound(digits);
    this._radius = 4.5;
    this._ = "";
  }
  pointRadius(_) {
    this._radius = +_;
    return this;
  }
  polygonStart() {
    this._line = 0;
  }
  polygonEnd() {
    this._line = NaN;
  }
  lineStart() {
    this._point = 0;
  }
  lineEnd() {
    if (this._line === 0) this._ += "Z";
    this._point = NaN;
  }
  point(x, y) {
    switch (this._point) {
      case 0: {
        this._append`M${x},${y}`;
        this._point = 1;
        break;
      }
      case 1: {
        this._append`L${x},${y}`;
        break;
      }
      default: {
        this._append`M${x},${y}`;
        if (this._radius !== cacheRadius || this._append !== cacheAppend) {
          const r = this._radius;
          const s = this._;
          this._ = ""; // stash the old string so we can cache the circle path fragment
          this._append`m0,${r}a${r},${r} 0 1,1 0,${-2 * r}a${r},${r} 0 1,1 0,${2 * r}z`;
          cacheRadius = r;
          cacheAppend = this._append;
          cacheCircle = this._;
          this._ = s;
        }
        this._ += cacheCircle;
        break;
      }
    }
  }
  result() {
    const result = this._;
    this._ = "";
    return result.length ? result : null;
  }
}

function append(strings) {
  let i = 1;
  this._ += strings[0];
  for (const j = strings.length; i < j; ++i) {
    this._ += arguments[i] + strings[i];
  }
}

function appendRound(digits) {
  const d = Math.floor(digits);
  if (!(d >= 0)) throw new RangeError(`invalid digits: ${digits}`);
  if (d > 15) return append;
  if (d !== cacheDigits) {
    const k = 10 ** d;
    cacheDigits = d;
    cacheAppend = function append(strings) {
      let i = 1;
      this._ += strings[0];
      for (const j = strings.length; i < j; ++i) {
        this._ += Math.round(arguments[i] * k) / k + strings[i];
      }
    };
  }
  return cacheAppend;
}

function geoPath(projection, context) {
  let digits = 3,
      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));
    return lengthStream.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(_) {
    if (!arguments.length) return projection;
    projectionStream = _ == null ? (projection = null, identity$1) : (projection = _).stream;
    return path;
  };

  path.context = function(_) {
    if (!arguments.length) return context;
    contextStream = _ == null ? (context = null, new PathString(digits)) : 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;
  };

  path.digits = function(_) {
    if (!arguments.length) return digits;
    if (_ == null) digits = null;
    else {
      const d = Math.floor(_);
      if (!(d >= 0)) throw new RangeError(`invalid digits: ${_}`);
      digits = d;
    }
    if (context === null) contextStream = new PathString(digits);
    return path;
  };

  return path.projection(projection).digits(digits).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(x, y) { this.stream.point(x, y); },
  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(); }
};

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(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() { stream.polygonStart(); resampleStream.lineStart = ringStart; },
      polygonEnd: function() { 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(x, y) {
    this.stream.point(x * radians, y * radians);
  }
});

function transformRotate(rotate) {
  return transformer({
    point: function(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) {
  if (!alpha) return scaleTranslate(k, dx, dy, sx, sy);
  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$1, // 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$1) : 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 = scaleTranslateRotate(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 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();
}

var _excluded$4 = ["flexDirection", "alignItems", "margin", "display", "children"];
function _extends$7() { _extends$7 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$7.apply(this, arguments); }
function _objectWithoutPropertiesLoose$4(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function LegendItem(_ref) {
  var _ref$flexDirection = _ref.flexDirection,
    flexDirection = _ref$flexDirection === void 0 ? 'row' : _ref$flexDirection,
    _ref$alignItems = _ref.alignItems,
    alignItems = _ref$alignItems === void 0 ? 'center' : _ref$alignItems,
    _ref$margin = _ref.margin,
    margin = _ref$margin === void 0 ? '0' : _ref$margin,
    _ref$display = _ref.display,
    display = _ref$display === void 0 ? 'flex' : _ref$display,
    children = _ref.children,
    restProps = _objectWithoutPropertiesLoose$4(_ref, _excluded$4);
  return /*#__PURE__*/React.createElement("div", _extends$7({
    className: "visx-legend-item",
    style: {
      display: display,
      alignItems: alignItems,
      flexDirection: flexDirection,
      margin: margin
    }
  }, restProps), children);
}
LegendItem.propTypes = {
  alignItems: _pt.string,
  margin: _pt.oneOfType([_pt.string, _pt.number]),
  children: _pt.node,
  display: _pt.string
};

var _excluded$3 = ["flex", "label", "margin", "align", "children"];
function _extends$6() { _extends$6 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$6.apply(this, arguments); }
function _objectWithoutPropertiesLoose$3(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function LegendLabel(_ref) {
  var _ref$flex = _ref.flex,
    flex = _ref$flex === void 0 ? '1' : _ref$flex,
    label = _ref.label,
    _ref$margin = _ref.margin,
    margin = _ref$margin === void 0 ? '5px 0' : _ref$margin,
    _ref$align = _ref.align,
    align = _ref$align === void 0 ? 'left' : _ref$align,
    children = _ref.children,
    restProps = _objectWithoutPropertiesLoose$3(_ref, _excluded$3);
  return /*#__PURE__*/React.createElement("div", _extends$6({
    className: "visx-legend-label",
    style: {
      justifyContent: align,
      display: 'flex',
      flex: flex,
      margin: margin
    }
  }, restProps), children || label);
}
LegendLabel.propTypes = {
  align: _pt.string,
  label: _pt.node,
  flex: _pt.oneOfType([_pt.string, _pt.number]),
  margin: _pt.oneOfType([_pt.string, _pt.number]),
  children: _pt.node
};

function _extends$5() { _extends$5 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$5.apply(this, arguments); }
function ShapeRect(_ref) {
  var fill = _ref.fill,
    width = _ref.width,
    height = _ref.height,
    style = _ref.style;
  return /*#__PURE__*/React.createElement("div", {
    style: _extends$5({
      width: width,
      height: height,
      background: fill
    }, style)
  });
}
ShapeRect.propTypes = {
  fill: _pt.string,
  width: _pt.oneOfType([_pt.string, _pt.number]),
  height: _pt.oneOfType([_pt.string, _pt.number])
};

var _excluded$2 = ["top", "left", "transform", "className", "children", "innerRef"];
function _extends$4() { _extends$4 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$4.apply(this, arguments); }
function _objectWithoutPropertiesLoose$2(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
function Group(_ref) {
  var _ref$top = _ref.top,
    top = _ref$top === void 0 ? 0 : _ref$top,
    _ref$left = _ref.left,
    left = _ref$left === void 0 ? 0 : _ref$left,
    transform = _ref.transform,
    className = _ref.className,
    children = _ref.children,
    innerRef = _ref.innerRef,
    restProps = _objectWithoutPropertiesLoose$2(_ref, _excluded$2);
  return /*#__PURE__*/React.createElement("g", _extends$4({
    ref: innerRef,
    className: cx('visx-group', className),
    transform: transform || "translate(" + left + ", " + top + ")"
  }, restProps), children);
}
Group.propTypes = {
  top: _pt.number,
  left: _pt.number,
  transform: _pt.string,
  className: _pt.string,
  children: _pt.node,
  innerRef: _pt.oneOfType([_pt.string, _pt.func, _pt.object])
};

function ShapeCircle(_ref) {
  var fill = _ref.fill,
    width = _ref.width,
    height = _ref.height,
    style = _ref.style;
  var cleanWidth = typeof width === 'string' || typeof width === 'undefined' ? 0 : width;
  var cleanHeight = typeof height === 'string' || typeof height === 'undefined' ? 0 : height;
  var size = Math.max(cleanWidth, cleanHeight);
  var radius = size / 2;
  return /*#__PURE__*/React.createElement("svg", {
    width: size,
    height: size
  }, /*#__PURE__*/React.createElement(Group, {
    top: radius,
    left: radius
  }, /*#__PURE__*/React.createElement("circle", {
    r: radius,
    fill: fill,
    style: style
  })));
}
ShapeCircle.propTypes = {
  fill: _pt.string,
  width: _pt.oneOfType([_pt.string, _pt.number]),
  height: _pt.oneOfType([_pt.string, _pt.number])
};

function ShapeLine(_ref) {
  var fill = _ref.fill,
    width = _ref.width,
    height = _ref.height,
    style = _ref.style;
  var cleanHeight = typeof height === 'string' || typeof height === 'undefined' ? 0 : height;
  var lineThickness = typeof (style == null ? void 0 : style.strokeWidth) === 'number' ? style == null ? void 0 : style.strokeWidth : 2;
  return /*#__PURE__*/React.createElement("svg", {
    width: width,
    height: height
  }, /*#__PURE__*/React.createElement(Group, {
    top: cleanHeight / 2 - lineThickness / 2
  }, /*#__PURE__*/React.createElement("line", {
    x1: 0,
    x2: width,
    y1: 0,
    y2: 0,
    stroke: fill,
    strokeWidth: lineThickness,
    style: style
  })));
}
ShapeLine.propTypes = {
  fill: _pt.string,
  width: _pt.oneOfType([_pt.string, _pt.number]),
  height: _pt.oneOfType([_pt.string, _pt.number])
};

function _extends$3() { _extends$3 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$3.apply(this, arguments); }
var NO_OP = function NO_OP() {
  return undefined;
};
function renderShape(_ref) {
  var _ref$shape = _ref.shape,
    shape = _ref$shape === void 0 ? 'rect' : _ref$shape,
    _ref$fill = _ref.fill,
    fill = _ref$fill === void 0 ? NO_OP : _ref$fill,
    _ref$size = _ref.size,
    size = _ref$size === void 0 ? NO_OP : _ref$size,
    width = _ref.width,
    height = _ref.height,
    label = _ref.label,
    item = _ref.item,
    itemIndex = _ref.itemIndex,
    _ref$shapeStyle = _ref.shapeStyle,
    shapeStyle = _ref$shapeStyle === void 0 ? NO_OP : _ref$shapeStyle;
  var props = {
    width: width,
    height: height,
    item: item,
    itemIndex: itemIndex,
    label: label,
    fill: fill(_extends$3({}, label)),
    size: size(_extends$3({}, label)),
    style: shapeStyle(_extends$3({}, label))
  };
  if (typeof shape === 'string') {
    if (shape === 'circle') {
      return /*#__PURE__*/React.createElement(ShapeCircle, props);
    }
    if (shape === 'line') {
      return /*#__PURE__*/React.createElement(ShapeLine, props);
    }
    return /*#__PURE__*/React.createElement(ShapeRect, props);
  }
  if ( /*#__PURE__*/React.isValidElement(shape)) {
    return /*#__PURE__*/React.cloneElement(shape, props);
  }
  if (shape) {
    return /*#__PURE__*/React.createElement(shape, props);
  }
  return null;
}

function _extends$2() { _extends$2 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$2.apply(this, arguments); }
function LegendShape(_ref) {
  var _ref$shape = _ref.shape,
    shape = _ref$shape === void 0 ? ShapeRect : _ref$shape,
    width = _ref.width,
    height = _ref.height,
    margin = _ref.margin,
    label = _ref.label,
    item = _ref.item,
    itemIndex = _ref.itemIndex,
    fill = _ref.fill,
    size = _ref.size,
    shapeStyle = _ref.shapeStyle;
  return /*#__PURE__*/React.createElement("div", {
    className: "visx-legend-shape",
    style: {
      display: 'flex',
      width: size ? size(_extends$2({}, label)) : width,
      height: size ? size(_extends$2({}, label)) : height,
      margin: margin
    }
  }, renderShape({
    shape: shape,
    item: item,
    itemIndex: itemIndex,
    label: label,
    width: width,
    height: height,
    fill: fill,
    shapeStyle: shapeStyle
  }));
}
LegendShape.propTypes = {
  itemIndex: _pt.number.isRequired,
  margin: _pt.oneOfType([_pt.string, _pt.number]),
  width: _pt.oneOfType([_pt.string, _pt.number]),
  height: _pt.oneOfType([_pt.string, _pt.number])
};

/** Returns an object's value if defined, or the object. */
function valueOrIdentity(_) {
  if (_ && typeof _ === 'object' && 'value' in _ && typeof _.value !== 'undefined') return _.value;
  return _;
}

/** Returns an object's value if defined, or the object, coerced to a string. */
function valueOrIdentityString(_) {
  return String(valueOrIdentity(_));
}

/** Returns a function which takes a Datum and index as input, and returns a formatted label object. */
function labelTransformFactory(_ref) {
  var scale = _ref.scale,
    labelFormat = _ref.labelFormat;
  return function (d, i) {
    return {
      datum: d,
      index: i,
      text: "" + labelFormat(d, i),
      value: scale(d)
    };
  };
}

var _excluded$1 = ["className", "style", "scale", "shape", "domain", "fill", "size", "labelFormat", "labelTransform", "shapeWidth", "shapeHeight", "shapeMargin", "shapeStyle", "labelAlign", "labelFlex", "labelMargin", "itemMargin", "direction", "itemDirection", "legendLabelProps", "children"];
function _extends$1() { _extends$1 = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends$1.apply(this, arguments); }
function _objectWithoutPropertiesLoose$1(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
var defaultStyle = {
  display: 'flex'
};
function Legend(_ref) {
  var className = _ref.className,
    _ref$style = _ref.style,
    style = _ref$style === void 0 ? defaultStyle : _ref$style,
    scale = _ref.scale,
    shape = _ref.shape,
    inputDomain = _ref.domain,
    _ref$fill = _ref.fill,
    fill = _ref$fill === void 0 ? valueOrIdentityString : _ref$fill,
    _ref$size = _ref.size,
    size = _ref$size === void 0 ? valueOrIdentityString : _ref$size,
    _ref$labelFormat = _ref.labelFormat,
    labelFormat = _ref$labelFormat === void 0 ? valueOrIdentity : _ref$labelFormat,
    _ref$labelTransform = _ref.labelTransform,
    labelTransform = _ref$labelTransform === void 0 ? labelTransformFactory : _ref$labelTransform,
    _ref$shapeWidth = _ref.shapeWidth,
    shapeWidth = _ref$shapeWidth === void 0 ? 15 : _ref$shapeWidth,
    _ref$shapeHeight = _ref.shapeHeight,
    shapeHeight = _ref$shapeHeight === void 0 ? 15 : _ref$shapeHeight,
    _ref$shapeMargin = _ref.shapeMargin,
    shapeMargin = _ref$shapeMargin === void 0 ? '2px 4px 2px 0' : _ref$shapeMargin,
    shapeStyle = _ref.shapeStyle,
    _ref$labelAlign = _ref.labelAlign,
    labelAlign = _ref$labelAlign === void 0 ? 'left' : _ref$labelAlign,
    _ref$labelFlex = _ref.labelFlex,
    labelFlex = _ref$labelFlex === void 0 ? '1' : _ref$labelFlex,
    _ref$labelMargin = _ref.labelMargin,
    labelMargin = _ref$labelMargin === void 0 ? '0 4px' : _ref$labelMargin,
    _ref$itemMargin = _ref.itemMargin,
    itemMargin = _ref$itemMargin === void 0 ? '0' : _ref$itemMargin,
    _ref$direction = _ref.direction,
    direction = _ref$direction === void 0 ? 'column' : _ref$direction,
    _ref$itemDirection = _ref.itemDirection,
    itemDirection = _ref$itemDirection === void 0 ? 'row' : _ref$itemDirection,
    legendLabelProps = _ref.legendLabelProps,
    children = _ref.children,
    legendItemProps = _objectWithoutPropertiesLoose$1(_ref, _excluded$1);
  // `Scale extends ScaleType` constraint is tricky
  //  could consider removing `scale` altogether in the future and making `domain: Datum[]` required
  var domain = inputDomain || ('domain' in scale ? scale.domain() : []);
  var labelFormatter = labelTransform({
    scale: scale,
    labelFormat: labelFormat
  });
  var labels = domain.map(labelFormatter);
  if (children) return /*#__PURE__*/React.createElement(React.Fragment, null, children(labels));
  return /*#__PURE__*/React.createElement("div", {
    className: cx('visx-legend', className),
    style: _extends$1({}, style, {
      flexDirection: direction
    })
  }, labels.map(function (label, i) {
    return /*#__PURE__*/React.createElement(LegendItem, _extends$1({
      key: "legend-" + label.text + "-" + i,
      margin: itemMargin,
      flexDirection: itemDirection
    }, legendItemProps), /*#__PURE__*/React.createElement(LegendShape, {
      shape: shape,
      height: shapeHeight,
      width: shapeWidth,
      margin: shapeMargin,
      item: domain[i],
      itemIndex: i,
      label: label,
      fill: fill,
      size: size,
      shapeStyle: shapeStyle
    }), /*#__PURE__*/React.createElement(LegendLabel, _extends$1({
      label: label.text,
      flex: labelFlex,
      margin: labelMargin,
      align: labelAlign
    }, legendLabelProps)));
  }));
}
Legend.propTypes = {
  children: _pt.func,
  className: _pt.string,
  domain: _pt.array,
  shapeWidth: _pt.oneOfType([_pt.string, _pt.number]),
  shapeHeight: _pt.oneOfType([_pt.string, _pt.number]),
  shapeMargin: _pt.oneOfType([_pt.string, _pt.number]),
  labelAlign: _pt.string,
  labelFlex: _pt.oneOfType([_pt.string, _pt.number]),
  labelMargin: _pt.oneOfType([_pt.string, _pt.number]),
  itemMargin: _pt.oneOfType([_pt.string, _pt.number]),
  fill: _pt.func,
  size: _pt.func,
  shapeStyle: _pt.func
};

function identity(x) {
  return x;
}

var _excluded = ["scale", "domain", "labelFormat", "labelTransform", "labelDelimiter", "labelLower", "labelUpper"];
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }

// eslint-disable-next-line @typescript-eslint/no-explicit-any

var formatZero = function formatZero(label) {
  return label === 0 ? '0' : label || '';
};
/** Default transform implicitly assumes that Datum is of type number. */
function defaultTransform(_ref) {
  var labelDelimiter = _ref.labelDelimiter,
    labelLower = _ref.labelLower,
    labelUpper = _ref.labelUpper;
  return function (_ref2) {
    var scale = _ref2.scale,
      labelFormat = _ref2.labelFormat;
    var scaleRange = scale.range();
    return function (d, i) {
      var _ref3 = scaleRange.length >= i ? scale.invertExtent(scaleRange[i]) : [undefined, undefined],
        d0 = _ref3[0],
        d1 = _ref3[1];
      var delimiter = " " + labelDelimiter + " ";
      var text = '';
      var value;
      if (d0 == null && typeof d1 === 'number') {
        // lower threshold e.g., [undefined, number]
        delimiter = labelLower || delimiter;
        value = d1 - Math.abs(2 * d1 - 1); // guarantees a value smaller than the lower threshold
        text = "" + delimiter + formatZero(labelFormat(d1, i));
      } else if (d0 != null && d1 != null) {
        // threshold step
        value = d;
        text = "" + formatZero(labelFormat(d0, i)) + delimiter + formatZero(labelFormat(d1, i));
      } else if (typeof d0 === 'number' && d1 == null) {
        // upper threshold e.g., [number, undefined]
        delimiter = labelUpper || delimiter;
        value = d0 + Math.abs(2 * d0 + 1); // // guarantees a value larger than the upper threshold
        text = "" + delimiter + formatZero(labelFormat(d0, i));
      }
      return {
        extent: [d0, d1],
        value: scale(value),
        text: text,
        datum: d,
        index: i
      };
    };
  };
}
function Threshold(_ref4) {
  var scale = _ref4.scale,
    inputDomain = _ref4.domain,
    _ref4$labelFormat = _ref4.labelFormat,
    labelFormat = _ref4$labelFormat === void 0 ? identity : _ref4$labelFormat,
    inputLabelTransform = _ref4.labelTransform,
    _ref4$labelDelimiter = _ref4.labelDelimiter,
    labelDelimiter = _ref4$labelDelimiter === void 0 ? 'to' : _ref4$labelDelimiter,
    _ref4$labelLower = _ref4.labelLower,
    labelLower = _ref4$labelLower === void 0 ? 'Less than ' : _ref4$labelLower,
    _ref4$labelUpper = _ref4.labelUpper,
    labelUpper = _ref4$labelUpper === void 0 ? 'More than ' : _ref4$labelUpper,
    restProps = _objectWithoutPropertiesLoose(_ref4, _excluded);
  // d3 docs specify that for n values in a domain, there should be n+1 values in the range
  // https://github.com/d3/d3-scale#threshold_domain
  // therefore if a domain is not specified we transform the range into input values
  // because it should contain more elements

  var domain = inputDomain || scale.range().map(function (output) {
    return scale.invertExtent(output)[0];
  });
  var labelTransform = inputLabelTransform || defaultTransform({
    labelDelimiter: labelDelimiter,
    labelLower: labelLower,
    labelUpper: labelUpper
  });
  return /*#__PURE__*/React.createElement(Legend, _extends({
    scale: scale,
    domain: domain,
    labelFormat: labelFormat,
    labelTransform: labelTransform
  }, restProps));
}
Threshold.propTypes = {
  labelDelimiter: _pt.string,
  labelLower: _pt.string,
  labelUpper: _pt.string
};

function StatsMapLegend(_a) {
    var width = _a.width, height = _a.height, colorScale = _a.colorScale;
    return (jsx("div", { style: {
            position: 'absolute',
            bottom: 0,
            left: 0,
            width: width,
            height: height,
            display: 'flex',
            justifyContent: 'center',
            alignItems: 'center',
        }, children: jsx(Threshold, { scale: colorScale, children: function (labels) { return (jsx("div", { style: {
                    display: 'flex',
                    flexDirection: 'row',
                    gap: '1.2rem',
                }, children: labels.reverse().map(function (label, i) { return (jsxs(LegendItem, { children: [jsx("svg", { width: 18, height: 18, children: jsx("circle", { fill: label.value, r: 9, cx: 9, cy: 9 }) }), jsx(LegendLabel, { style: {
                                fontSize: '0.875rem',
                                marginLeft: '.5rem',
                            }, children: label.text })] }, "legend-quantile-".concat(i))); }) })); } }) }));
}

function StatsMapTitle(_a) {
    var width = _a.width, height = _a.height, title = _a.title;
    return (jsx("div", { style: {
            position: 'absolute',
            top: 0,
            left: 0,
            width: width,
            height: height,
            textAlign: 'center',
            fontSize: '1.25rem',
            fontWeight: 'bold',
            lineHeight: "".concat(height, "px"),
        }, children: title }));
}

function StatsMap(_a) {
    var topojsonFeatures = _a.topojsonFeatures, width = _a.width, height = _a.height, data = _a.data, valueName = _a.valueName, title = _a.title, _b = _a.nameAccessor, nameAccessor = _b === void 0 ? function (feature) { return feature.properties.name; } : _b, _c = _a.codeAccessor, codeAccessor = _c === void 0 ? function (feature) { return feature.properties.code; } : _c, _d = _a.hideTitle, hideTitle = _d === void 0 ? false : _d, _e = _a.hideLegend, hideLegend = _e === void 0 ? false : _e, _f = _a.mapStyle, mapStyle = _f === void 0 ? {} : _f, thresholdColors = _a.thresholdColors;
    var _g = useTooltip(), showTooltip = _g.showTooltip, hideTooltip = _g.hideTooltip, tooltipData = _g.tooltipData, tooltipLeft = _g.tooltipLeft, tooltipTop = _g.tooltipTop;
    var _h = mapStyle.padding, padding = _h === void 0 ? 10 : _h, _j = mapStyle.borderColor, borderColor = _j === void 0 ? '#ebf4f3' : _j, _k = mapStyle.defaultFillColor, defaultFillColor = _k === void 0 ? '#cbd5e1' : _k;
    // Adjust heights based on whether Title and Legend are hidden
    var titleHeight = hideTitle ? 0 : height * 0.1;
    var legendHeight = hideLegend ? 0 : height * 0.1;
    var mapHeight = height - titleHeight - legendHeight;
    // Create a projection for Ukraine using fitExtent
    var projection = useMemo(function () {
        var proj = geoMercator().fitExtent([
            [padding, padding],
            [width - padding, mapHeight - padding],
        ], {
            type: 'FeatureCollection',
            features: topojsonFeatures,
        });
        return proj;
    }, [width, mapHeight, padding]); // Added padding to dependencies
    // Create a path generator using the projection
    var pathGenerator = useMemo(function () { return geoPath().projection(projection); }, [
        projection,
    ]);
    var maxValue = useMemo(function () { return Math.max.apply(Math, Object.values(data)); }, [data]);
    // Default thresholds and colors if the user doesn't provide any
    var defaultThresholdColors = useMemo(function () {
        var stepSize = maxValue / 5;
        var defaultColors = ['#34d399', '#10b981', '#059669', '#047857', '#065f46'];
        return Array.from({ length: 5 }, function (_, i) { return ({
            threshold: Math.round((i + 1) * stepSize),
            color: defaultColors[i],
        }); });
    }, [maxValue]);
    var usedThresholdColors = thresholdColors || defaultThresholdColors;
    // Ensure thresholds are sorted in ascending order
    usedThresholdColors.sort(function (a, b) { return a.threshold - b.threshold; });
    // Extract thresholds and colors from the array
    var usedThresholds = usedThresholdColors.map(function (tc) { return tc.threshold; });
    var usedColors = usedThresholdColors.map(function (tc) { return tc.color; });
    // For scaleThreshold, the number of colors should be one more than the number of thresholds
    // Include a color for values below the first threshold
    var colorScale = useMemo(function () {
        return createThresholdScale()
            .domain(usedThresholds)
            .range(usedColors);
    }, [usedThresholds, usedColors]);
    var paths = useMemo(function () { return topojsonFeatures.map(function (feature) { return pathGenerator(feature); }); }, [pathGenerator]);
    if (width < 300)
        return null;
    return (jsxs(Fragment, { children: [jsxs("div", { style: {
                    position: 'relative',
                    width: width,
                    height: height,
                    overflow: 'hidden',
                }, children: [!hideTitle && (jsx(StatsMapTitle, { width: width, height: titleHeight, title: title })), jsx("div", { style: {
                            position: 'absolute',
                            top: titleHeight,
                            left: 0,
                            width: width,
                            height: mapHeight,
                        }, children: jsx("svg", { width: width, height: mapHeight, children: topojsonFeatures.map(function (feature, i) {
                                var name = nameAccessor(feature);
                                var code = codeAccessor(feature);
                                var value = data[code];
                                return (jsx(React.Fragment, { children: jsx(motion.path, { d: paths[i] || '', fill: colorScale(value) || defaultFillColor, stroke: borderColor, strokeWidth: 1, whileHover: {
                                            strokeWidth: 2,
                                            scale: 1.01,
                                        }, onMouseEnter: function (event) {
                                            var element = event.target;
                                            element.parentNode.appendChild(element);
                                        }, onMouseLeave: hideTooltip, onMouseMove: function (event) {
                                            var clientX = event.clientX, clientY = event.clientY;
                                            showTooltip({
                                                tooltipData: (jsxs("div", { style: {
                                                        padding: '4px',
                                                        display: 'flex',
                                                        flexDirection: 'row',
                                                        gap: '8px',
                                                    }, children: [jsx("svg", { width: 16, height: 16, children: jsx("circle", { fill: colorScale(value) || defaultFillColor, r: 8, cx: 8, cy: 8 }) }), name, ":\u00A0", value ? (jsxs(Fragment, { children: [value, " ", valueName] })) : (jsx(Fragment, { children: "\u0434\u0430\u043D\u0456 \u0432\u0456\u0434\u0441\u0443\u0442\u043D\u0456" }))] })),
                                                tooltipLeft: clientX + 10,
                                                tooltipTop: clientY + 10,
                                            });
                                        } }) }, "map-feature-".concat(i)));
                            }) }) }), !hideLegend && (jsx(StatsMapLegend, { width: width, height: legendHeight, colorScale: colorScale }))] }), tooltipData && (jsx(TooltipWithBounds$1, { top: tooltipTop, left: tooltipLeft, children: tooltipData }))] }));
}

var features = feature(topology, topology.objects.moldova).features;
function MDMap(props) {
    return (jsx(StatsMap, __assign({}, props, { topojsonFeatures: features, nameAccessor: function (f) { return f.properties.shapeName; }, codeAccessor: function (f) { return f.properties.shapeISO; } })));
}

// Helper function to convert raion names to codes
function getRaionCode(raionName) {
    var _a;
    var raionMapping = {
        "CA": ["cahul"],
        "GA": ["găgăuzia"],
        "TA": ["taraclia"],
        "CT": ["cantemir"],
        "BS": ["basarabeasca"],
        "LE": ["leova"],
        "CM": ["cimișlia"],
        "SV": ["ștefan vodă"],
        "BD": ["bender"],
        "CS": ["căușeni"],
        "HI": ["hîncești"],
        "IA": ["ialoveni"],
        "NI": ["nisporeni"],
        "CU": ["chișinău"],
        "AN": ["anenii noi"],
        "CR": ["criuleni"],
        "ST": ["strășeni"],
        "UN": ["ungheni"],
        "DU": ["dubăsari"],
        "CL": ["călărași"],
        "SN": ["transnistria"],
        "FA": ["fălești"],
        "OR": ["orhei"],
        "GL": ["glodeni"],
        "BA": ["bălți"],
        "TE": ["telenești"],
        "SI": ["sîngerei"],
        "RI": ["rîșcani"],
        "RE": ["rezina"],
        "SD": ["șoldănești"],
        "FL": ["florești"],
        "DR": ["drochia"],
        "ED": ["edineț"],
        "BR": ["briceni"],
        "SO": ["soroca"],
        "DO": ["dondușeni"],
        "OC": ["ocnița"],
    };
    var normalizedRaionName = raionName
        .toLowerCase()
        .replace(/[.,]/g, '') // Remove punctuation
        .replace(/\s*(region|raion)\s*/g, '')
        .trim();
    return ((_a = Object.entries(raionMapping)
        .find(function (_a) {
        var names = _a[1];
        return names.includes(normalizedRaionName);
    })) === null || _a === void 0 ? void 0 : _a[0]);
}

export { MDMap as default, getRaionCode };
//# sourceMappingURL=index.js.map