var __defProp = Object.defineProperty; var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value; var __publicField = (obj, key, value) => { __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value); return value; }; var commonjsGlobal = typeof globalThis !== "undefined" ? globalThis : typeof window !== "undefined" ? window : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : {}; function getAugmentedNamespace(n) { var f = n.default; if (typeof f == "function") { var a2 = function() { return f.apply(this, arguments); }; a2.prototype = f.prototype; } else a2 = {}; Object.defineProperty(a2, "__esModule", { value: true }); Object.keys(n).forEach(function(k2) { var d = Object.getOwnPropertyDescriptor(n, k2); Object.defineProperty(a2, k2, d.get ? d : { enumerable: true, get: function() { return n[k2]; } }); }); return a2; } function commonjsRequire(path2) { throw new Error('Could not dynamically require "' + path2 + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.'); } var moment_min = { exports: {} }; (function(module2, exports2) { !function(e, t) { module2.exports = t(); }(commonjsGlobal, function() { var H; function f() { return H.apply(null, arguments); } function a2(e3) { return e3 instanceof Array || "[object Array]" === Object.prototype.toString.call(e3); } function F(e3) { return null != e3 && "[object Object]" === Object.prototype.toString.call(e3); } function c2(e3, t4) { return Object.prototype.hasOwnProperty.call(e3, t4); } function L(e3) { if (Object.getOwnPropertyNames) return 0 === Object.getOwnPropertyNames(e3).length; for (var t4 in e3) if (c2(e3, t4)) return; return 1; } function o(e3) { return void 0 === e3; } function u2(e3) { return "number" == typeof e3 || "[object Number]" === Object.prototype.toString.call(e3); } function V(e3) { return e3 instanceof Date || "[object Date]" === Object.prototype.toString.call(e3); } function G(e3, t4) { for (var n2 = [], s3 = e3.length, i2 = 0; i2 < s3; ++i2) n2.push(t4(e3[i2], i2)); return n2; } function E2(e3, t4) { for (var n2 in t4) c2(t4, n2) && (e3[n2] = t4[n2]); return c2(t4, "toString") && (e3.toString = t4.toString), c2(t4, "valueOf") && (e3.valueOf = t4.valueOf), e3; } function l(e3, t4, n2, s3) { return Pt(e3, t4, n2, s3, true).utc(); } function m2(e3) { return null == e3._pf && (e3._pf = { empty: false, unusedTokens: [], unusedInput: [], overflow: -2, charsLeftOver: 0, nullInput: false, invalidEra: null, invalidMonth: null, invalidFormat: false, userInvalidated: false, iso: false, parsedDateParts: [], era: null, meridiem: null, rfc2822: false, weekdayMismatch: false }), e3._pf; } function A5(e3) { if (null == e3._isValid) { var t4 = m2(e3), n2 = j.call(t4.parsedDateParts, function(e4) { return null != e4; }), n2 = !isNaN(e3._d.getTime()) && t4.overflow < 0 && !t4.empty && !t4.invalidEra && !t4.invalidMonth && !t4.invalidWeekday && !t4.weekdayMismatch && !t4.nullInput && !t4.invalidFormat && !t4.userInvalidated && (!t4.meridiem || t4.meridiem && n2); if (e3._strict && (n2 = n2 && 0 === t4.charsLeftOver && 0 === t4.unusedTokens.length && void 0 === t4.bigHour), null != Object.isFrozen && Object.isFrozen(e3)) return n2; e3._isValid = n2; } return e3._isValid; } function I(e3) { var t4 = l(NaN); return null != e3 ? E2(m2(t4), e3) : m2(t4).userInvalidated = true, t4; } var j = Array.prototype.some || function(e3) { for (var t4 = Object(this), n2 = t4.length >>> 0, s3 = 0; s3 < n2; s3++) if (s3 in t4 && e3.call(this, t4[s3], s3, t4)) return true; return false; }, Z = f.momentProperties = [], z = false; function $(e3, t4) { var n2, s3, i2, r2 = Z.length; if (o(t4._isAMomentObject) || (e3._isAMomentObject = t4._isAMomentObject), o(t4._i) || (e3._i = t4._i), o(t4._f) || (e3._f = t4._f), o(t4._l) || (e3._l = t4._l), o(t4._strict) || (e3._strict = t4._strict), o(t4._tzm) || (e3._tzm = t4._tzm), o(t4._isUTC) || (e3._isUTC = t4._isUTC), o(t4._offset) || (e3._offset = t4._offset), o(t4._pf) || (e3._pf = m2(t4)), o(t4._locale) || (e3._locale = t4._locale), 0 < r2) for (n2 = 0; n2 < r2; n2++) o(i2 = t4[s3 = Z[n2]]) || (e3[s3] = i2); return e3; } function q(e3) { $(this, e3), this._d = new Date(null != e3._d ? e3._d.getTime() : NaN), this.isValid() || (this._d = new Date(NaN)), false === z && (z = true, f.updateOffset(this), z = false); } function h(e3) { return e3 instanceof q || null != e3 && null != e3._isAMomentObject; } function B2(e3) { false === f.suppressDeprecationWarnings && "undefined" != typeof console && console.warn && console.warn("Deprecation warning: " + e3); } function e(r2, a3) { var o2 = true; return E2(function() { if (null != f.deprecationHandler && f.deprecationHandler(null, r2), o2) { for (var e3, t4, n2 = [], s3 = arguments.length, i2 = 0; i2 < s3; i2++) { if (e3 = "", "object" == typeof arguments[i2]) { for (t4 in e3 += "\n[" + i2 + "] ", arguments[0]) c2(arguments[0], t4) && (e3 += t4 + ": " + arguments[0][t4] + ", "); e3 = e3.slice(0, -2); } else e3 = arguments[i2]; n2.push(e3); } B2(r2 + "\nArguments: " + Array.prototype.slice.call(n2).join("") + "\n" + new Error().stack), o2 = false; } return a3.apply(this, arguments); }, a3); } var J = {}; function Q(e3, t4) { null != f.deprecationHandler && f.deprecationHandler(e3, t4), J[e3] || (B2(t4), J[e3] = true); } function d(e3) { return "undefined" != typeof Function && e3 instanceof Function || "[object Function]" === Object.prototype.toString.call(e3); } function X3(e3, t4) { var n2, s3 = E2({}, e3); for (n2 in t4) c2(t4, n2) && (F(e3[n2]) && F(t4[n2]) ? (s3[n2] = {}, E2(s3[n2], e3[n2]), E2(s3[n2], t4[n2])) : null != t4[n2] ? s3[n2] = t4[n2] : delete s3[n2]); for (n2 in e3) c2(e3, n2) && !c2(t4, n2) && F(e3[n2]) && (s3[n2] = E2({}, s3[n2])); return s3; } function K2(e3) { null != e3 && this.set(e3); } f.suppressDeprecationWarnings = false, f.deprecationHandler = null; var ee = Object.keys || function(e3) { var t4, n2 = []; for (t4 in e3) c2(e3, t4) && n2.push(t4); return n2; }; function r(e3, t4, n2) { var s3 = "" + Math.abs(e3); return (0 <= e3 ? n2 ? "+" : "" : "-") + Math.pow(10, Math.max(0, t4 - s3.length)).toString().substr(1) + s3; } var te = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|Mo|MM?M?M?|Do|DDDo|DD?D?D?|ddd?d?|do?|w[o|w]?|W[o|W]?|Qo?|N{1,5}|YYYYYY|YYYYY|YYYY|YY|y{2,4}|yo?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g, ne = /(\[[^\[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})/g, se = {}, ie = {}; function s2(e3, t4, n2, s3) { var i2 = "string" == typeof s3 ? function() { return this[s3](); } : s3; e3 && (ie[e3] = i2), t4 && (ie[t4[0]] = function() { return r(i2.apply(this, arguments), t4[1], t4[2]); }), n2 && (ie[n2] = function() { return this.localeData().ordinal(i2.apply(this, arguments), e3); }); } function re2(e3, t4) { return e3.isValid() ? (t4 = ae(t4, e3.localeData()), se[t4] = se[t4] || function(s3) { for (var e4, i2 = s3.match(te), t5 = 0, r2 = i2.length; t5 < r2; t5++) ie[i2[t5]] ? i2[t5] = ie[i2[t5]] : i2[t5] = (e4 = i2[t5]).match(/\[[\s\S]/) ? e4.replace(/^\[|\]$/g, "") : e4.replace(/\\/g, ""); return function(e6) { for (var t6 = "", n2 = 0; n2 < r2; n2++) t6 += d(i2[n2]) ? i2[n2].call(e6, s3) : i2[n2]; return t6; }; }(t4), se[t4](e3)) : e3.localeData().invalidDate(); } function ae(e3, t4) { var n2 = 5; function s3(e4) { return t4.longDateFormat(e4) || e4; } for (ne.lastIndex = 0; 0 <= n2 && ne.test(e3); ) e3 = e3.replace(ne, s3), ne.lastIndex = 0, --n2; return e3; } var oe = {}; function t(e3, t4) { var n2 = e3.toLowerCase(); oe[n2] = oe[n2 + "s"] = oe[t4] = e3; } function _2(e3) { return "string" == typeof e3 ? oe[e3] || oe[e3.toLowerCase()] : void 0; } function ue(e3) { var t4, n2, s3 = {}; for (n2 in e3) c2(e3, n2) && (t4 = _2(n2)) && (s3[t4] = e3[n2]); return s3; } var le = {}; function n(e3, t4) { le[e3] = t4; } function he(e3) { return e3 % 4 == 0 && e3 % 100 != 0 || e3 % 400 == 0; } function y2(e3) { return e3 < 0 ? Math.ceil(e3) || 0 : Math.floor(e3); } function g(e3) { var e3 = +e3, t4 = 0; return t4 = 0 != e3 && isFinite(e3) ? y2(e3) : t4; } function de(t4, n2) { return function(e3) { return null != e3 ? (fe(this, t4, e3), f.updateOffset(this, n2), this) : ce(this, t4); }; } function ce(e3, t4) { return e3.isValid() ? e3._d["get" + (e3._isUTC ? "UTC" : "") + t4]() : NaN; } function fe(e3, t4, n2) { e3.isValid() && !isNaN(n2) && ("FullYear" === t4 && he(e3.year()) && 1 === e3.month() && 29 === e3.date() ? (n2 = g(n2), e3._d["set" + (e3._isUTC ? "UTC" : "") + t4](n2, e3.month(), We(n2, e3.month()))) : e3._d["set" + (e3._isUTC ? "UTC" : "") + t4](n2)); } var i = /\d/, w2 = /\d\d/, me = /\d{3}/, _e = /\d{4}/, ye = /[+-]?\d{6}/, p = /\d\d?/, ge = /\d\d\d\d?/, we = /\d\d\d\d\d\d?/, pe = /\d{1,3}/, ke = /\d{1,4}/, ve = /[+-]?\d{1,6}/, Me = /\d+/, De = /[+-]?\d+/, Se = /Z|[+-]\d\d:?\d\d/gi, Ye = /Z|[+-]\d\d(?::?\d\d)?/gi, k2 = /[0-9]{0,256}['a-z\u00A0-\u05FF\u0700-\uD7FF\uF900-\uFDCF\uFDF0-\uFF07\uFF10-\uFFEF]{1,256}|[\u0600-\u06FF\/]{1,256}(\s*?[\u0600-\u06FF]{1,256}){1,2}/i; function v(e3, n2, s3) { be[e3] = d(n2) ? n2 : function(e4, t4) { return e4 && s3 ? s3 : n2; }; } function Oe(e3, t4) { return c2(be, e3) ? be[e3](t4._strict, t4._locale) : new RegExp(M2(e3.replace("\\", "").replace(/\\(\[)|\\(\])|\[([^\]\[]*)\]|\\(.)/g, function(e4, t5, n2, s3, i2) { return t5 || n2 || s3 || i2; }))); } function M2(e3) { return e3.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); } var be = {}, xe = {}; function D2(e3, n2) { var t4, s3, i2 = n2; for ("string" == typeof e3 && (e3 = [e3]), u2(n2) && (i2 = function(e4, t5) { t5[n2] = g(e4); }), s3 = e3.length, t4 = 0; t4 < s3; t4++) xe[e3[t4]] = i2; } function Te(e3, i2) { D2(e3, function(e4, t4, n2, s3) { n2._w = n2._w || {}, i2(e4, n2._w, n2, s3); }); } var S, Y3 = 0, O = 1, b = 2, x2 = 3, T = 4, N = 5, Ne = 6, Pe = 7, Re = 8; function We(e3, t4) { if (isNaN(e3) || isNaN(t4)) return NaN; var n2 = (t4 % (n2 = 12) + n2) % n2; return e3 += (t4 - n2) / 12, 1 == n2 ? he(e3) ? 29 : 28 : 31 - n2 % 7 % 2; } S = Array.prototype.indexOf || function(e3) { for (var t4 = 0; t4 < this.length; ++t4) if (this[t4] === e3) return t4; return -1; }, s2("M", ["MM", 2], "Mo", function() { return this.month() + 1; }), s2("MMM", 0, 0, function(e3) { return this.localeData().monthsShort(this, e3); }), s2("MMMM", 0, 0, function(e3) { return this.localeData().months(this, e3); }), t("month", "M"), n("month", 8), v("M", p), v("MM", p, w2), v("MMM", function(e3, t4) { return t4.monthsShortRegex(e3); }), v("MMMM", function(e3, t4) { return t4.monthsRegex(e3); }), D2(["M", "MM"], function(e3, t4) { t4[O] = g(e3) - 1; }), D2(["MMM", "MMMM"], function(e3, t4, n2, s3) { s3 = n2._locale.monthsParse(e3, s3, n2._strict); null != s3 ? t4[O] = s3 : m2(n2).invalidMonth = e3; }); var Ce = "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), Ue = "Jan_Feb_Mar_Apr_May_Jun_Jul_Aug_Sep_Oct_Nov_Dec".split("_"), He = /D[oD]?(\[[^\[\]]*\]|\s)+MMMM?/, Fe = k2, Le = k2; function Ve(e3, t4) { var n2; if (e3.isValid()) { if ("string" == typeof t4) { if (/^\d+$/.test(t4)) t4 = g(t4); else if (!u2(t4 = e3.localeData().monthsParse(t4))) return; } n2 = Math.min(e3.date(), We(e3.year(), t4)), e3._d["set" + (e3._isUTC ? "UTC" : "") + "Month"](t4, n2); } } function Ge(e3) { return null != e3 ? (Ve(this, e3), f.updateOffset(this, true), this) : ce(this, "Month"); } function Ee() { function e3(e4, t5) { return t5.length - e4.length; } for (var t4, n2 = [], s3 = [], i2 = [], r2 = 0; r2 < 12; r2++) t4 = l([2e3, r2]), n2.push(this.monthsShort(t4, "")), s3.push(this.months(t4, "")), i2.push(this.months(t4, "")), i2.push(this.monthsShort(t4, "")); for (n2.sort(e3), s3.sort(e3), i2.sort(e3), r2 = 0; r2 < 12; r2++) n2[r2] = M2(n2[r2]), s3[r2] = M2(s3[r2]); for (r2 = 0; r2 < 24; r2++) i2[r2] = M2(i2[r2]); this._monthsRegex = new RegExp("^(" + i2.join("|") + ")", "i"), this._monthsShortRegex = this._monthsRegex, this._monthsStrictRegex = new RegExp("^(" + s3.join("|") + ")", "i"), this._monthsShortStrictRegex = new RegExp("^(" + n2.join("|") + ")", "i"); } function Ae(e3) { return he(e3) ? 366 : 365; } s2("Y", 0, 0, function() { var e3 = this.year(); return e3 <= 9999 ? r(e3, 4) : "+" + e3; }), s2(0, ["YY", 2], 0, function() { return this.year() % 100; }), s2(0, ["YYYY", 4], 0, "year"), s2(0, ["YYYYY", 5], 0, "year"), s2(0, ["YYYYYY", 6, true], 0, "year"), t("year", "y"), n("year", 1), v("Y", De), v("YY", p, w2), v("YYYY", ke, _e), v("YYYYY", ve, ye), v("YYYYYY", ve, ye), D2(["YYYYY", "YYYYYY"], Y3), D2("YYYY", function(e3, t4) { t4[Y3] = 2 === e3.length ? f.parseTwoDigitYear(e3) : g(e3); }), D2("YY", function(e3, t4) { t4[Y3] = f.parseTwoDigitYear(e3); }), D2("Y", function(e3, t4) { t4[Y3] = parseInt(e3, 10); }), f.parseTwoDigitYear = function(e3) { return g(e3) + (68 < g(e3) ? 1900 : 2e3); }; var Ie = de("FullYear", true); function je(e3, t4, n2, s3, i2, r2, a3) { var o2; return e3 < 100 && 0 <= e3 ? (o2 = new Date(e3 + 400, t4, n2, s3, i2, r2, a3), isFinite(o2.getFullYear()) && o2.setFullYear(e3)) : o2 = new Date(e3, t4, n2, s3, i2, r2, a3), o2; } function Ze(e3) { var t4; return e3 < 100 && 0 <= e3 ? ((t4 = Array.prototype.slice.call(arguments))[0] = e3 + 400, t4 = new Date(Date.UTC.apply(null, t4)), isFinite(t4.getUTCFullYear()) && t4.setUTCFullYear(e3)) : t4 = new Date(Date.UTC.apply(null, arguments)), t4; } function ze(e3, t4, n2) { n2 = 7 + t4 - n2; return n2 - (7 + Ze(e3, 0, n2).getUTCDay() - t4) % 7 - 1; } function $e(e3, t4, n2, s3, i2) { var r2, t4 = 1 + 7 * (t4 - 1) + (7 + n2 - s3) % 7 + ze(e3, s3, i2), n2 = t4 <= 0 ? Ae(r2 = e3 - 1) + t4 : t4 > Ae(e3) ? (r2 = e3 + 1, t4 - Ae(e3)) : (r2 = e3, t4); return { year: r2, dayOfYear: n2 }; } function qe(e3, t4, n2) { var s3, i2, r2 = ze(e3.year(), t4, n2), r2 = Math.floor((e3.dayOfYear() - r2 - 1) / 7) + 1; return r2 < 1 ? s3 = r2 + P(i2 = e3.year() - 1, t4, n2) : r2 > P(e3.year(), t4, n2) ? (s3 = r2 - P(e3.year(), t4, n2), i2 = e3.year() + 1) : (i2 = e3.year(), s3 = r2), { week: s3, year: i2 }; } function P(e3, t4, n2) { var s3 = ze(e3, t4, n2), t4 = ze(e3 + 1, t4, n2); return (Ae(e3) - s3 + t4) / 7; } s2("w", ["ww", 2], "wo", "week"), s2("W", ["WW", 2], "Wo", "isoWeek"), t("week", "w"), t("isoWeek", "W"), n("week", 5), n("isoWeek", 5), v("w", p), v("ww", p, w2), v("W", p), v("WW", p, w2), Te(["w", "ww", "W", "WW"], function(e3, t4, n2, s3) { t4[s3.substr(0, 1)] = g(e3); }); function Be(e3, t4) { return e3.slice(t4, 7).concat(e3.slice(0, t4)); } s2("d", 0, "do", "day"), s2("dd", 0, 0, function(e3) { return this.localeData().weekdaysMin(this, e3); }), s2("ddd", 0, 0, function(e3) { return this.localeData().weekdaysShort(this, e3); }), s2("dddd", 0, 0, function(e3) { return this.localeData().weekdays(this, e3); }), s2("e", 0, 0, "weekday"), s2("E", 0, 0, "isoWeekday"), t("day", "d"), t("weekday", "e"), t("isoWeekday", "E"), n("day", 11), n("weekday", 11), n("isoWeekday", 11), v("d", p), v("e", p), v("E", p), v("dd", function(e3, t4) { return t4.weekdaysMinRegex(e3); }), v("ddd", function(e3, t4) { return t4.weekdaysShortRegex(e3); }), v("dddd", function(e3, t4) { return t4.weekdaysRegex(e3); }), Te(["dd", "ddd", "dddd"], function(e3, t4, n2, s3) { s3 = n2._locale.weekdaysParse(e3, s3, n2._strict); null != s3 ? t4.d = s3 : m2(n2).invalidWeekday = e3; }), Te(["d", "e", "E"], function(e3, t4, n2, s3) { t4[s3] = g(e3); }); var Je = "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), Qe = "Sun_Mon_Tue_Wed_Thu_Fri_Sat".split("_"), Xe = "Su_Mo_Tu_We_Th_Fr_Sa".split("_"), Ke = k2, et = k2, tt = k2; function nt() { function e3(e4, t5) { return t5.length - e4.length; } for (var t4, n2, s3, i2 = [], r2 = [], a3 = [], o2 = [], u3 = 0; u3 < 7; u3++) s3 = l([2e3, 1]).day(u3), t4 = M2(this.weekdaysMin(s3, "")), n2 = M2(this.weekdaysShort(s3, "")), s3 = M2(this.weekdays(s3, "")), i2.push(t4), r2.push(n2), a3.push(s3), o2.push(t4), o2.push(n2), o2.push(s3); i2.sort(e3), r2.sort(e3), a3.sort(e3), o2.sort(e3), this._weekdaysRegex = new RegExp("^(" + o2.join("|") + ")", "i"), this._weekdaysShortRegex = this._weekdaysRegex, this._weekdaysMinRegex = this._weekdaysRegex, this._weekdaysStrictRegex = new RegExp("^(" + a3.join("|") + ")", "i"), this._weekdaysShortStrictRegex = new RegExp("^(" + r2.join("|") + ")", "i"), this._weekdaysMinStrictRegex = new RegExp("^(" + i2.join("|") + ")", "i"); } function st() { return this.hours() % 12 || 12; } function it(e3, t4) { s2(e3, 0, 0, function() { return this.localeData().meridiem(this.hours(), this.minutes(), t4); }); } function rt(e3, t4) { return t4._meridiemParse; } s2("H", ["HH", 2], 0, "hour"), s2("h", ["hh", 2], 0, st), s2("k", ["kk", 2], 0, function() { return this.hours() || 24; }), s2("hmm", 0, 0, function() { return "" + st.apply(this) + r(this.minutes(), 2); }), s2("hmmss", 0, 0, function() { return "" + st.apply(this) + r(this.minutes(), 2) + r(this.seconds(), 2); }), s2("Hmm", 0, 0, function() { return "" + this.hours() + r(this.minutes(), 2); }), s2("Hmmss", 0, 0, function() { return "" + this.hours() + r(this.minutes(), 2) + r(this.seconds(), 2); }), it("a", true), it("A", false), t("hour", "h"), n("hour", 13), v("a", rt), v("A", rt), v("H", p), v("h", p), v("k", p), v("HH", p, w2), v("hh", p, w2), v("kk", p, w2), v("hmm", ge), v("hmmss", we), v("Hmm", ge), v("Hmmss", we), D2(["H", "HH"], x2), D2(["k", "kk"], function(e3, t4, n2) { e3 = g(e3); t4[x2] = 24 === e3 ? 0 : e3; }), D2(["a", "A"], function(e3, t4, n2) { n2._isPm = n2._locale.isPM(e3), n2._meridiem = e3; }), D2(["h", "hh"], function(e3, t4, n2) { t4[x2] = g(e3), m2(n2).bigHour = true; }), D2("hmm", function(e3, t4, n2) { var s3 = e3.length - 2; t4[x2] = g(e3.substr(0, s3)), t4[T] = g(e3.substr(s3)), m2(n2).bigHour = true; }), D2("hmmss", function(e3, t4, n2) { var s3 = e3.length - 4, i2 = e3.length - 2; t4[x2] = g(e3.substr(0, s3)), t4[T] = g(e3.substr(s3, 2)), t4[N] = g(e3.substr(i2)), m2(n2).bigHour = true; }), D2("Hmm", function(e3, t4, n2) { var s3 = e3.length - 2; t4[x2] = g(e3.substr(0, s3)), t4[T] = g(e3.substr(s3)); }), D2("Hmmss", function(e3, t4, n2) { var s3 = e3.length - 4, i2 = e3.length - 2; t4[x2] = g(e3.substr(0, s3)), t4[T] = g(e3.substr(s3, 2)), t4[N] = g(e3.substr(i2)); }); k2 = de("Hours", true); var at, ot = { calendar: { sameDay: "[Today at] LT", nextDay: "[Tomorrow at] LT", nextWeek: "dddd [at] LT", lastDay: "[Yesterday at] LT", lastWeek: "[Last] dddd [at] LT", sameElse: "L" }, longDateFormat: { LTS: "h:mm:ss A", LT: "h:mm A", L: "MM/DD/YYYY", LL: "MMMM D, YYYY", LLL: "MMMM D, YYYY h:mm A", LLLL: "dddd, MMMM D, YYYY h:mm A" }, invalidDate: "Invalid date", ordinal: "%d", dayOfMonthOrdinalParse: /\d{1,2}/, relativeTime: { future: "in %s", past: "%s ago", s: "a few seconds", ss: "%d seconds", m: "a minute", mm: "%d minutes", h: "an hour", hh: "%d hours", d: "a day", dd: "%d days", w: "a week", ww: "%d weeks", M: "a month", MM: "%d months", y: "a year", yy: "%d years" }, months: Ce, monthsShort: Ue, week: { dow: 0, doy: 6 }, weekdays: Je, weekdaysMin: Xe, weekdaysShort: Qe, meridiemParse: /[ap]\.?m?\.?/i }, R = {}, ut = {}; function lt(e3) { return e3 && e3.toLowerCase().replace("_", "-"); } function ht(e3) { for (var t4, n2, s3, i2, r2 = 0; r2 < e3.length; ) { for (t4 = (i2 = lt(e3[r2]).split("-")).length, n2 = (n2 = lt(e3[r2 + 1])) ? n2.split("-") : null; 0 < t4; ) { if (s3 = dt(i2.slice(0, t4).join("-"))) return s3; if (n2 && n2.length >= t4 && function(e4, t5) { for (var n3 = Math.min(e4.length, t5.length), s4 = 0; s4 < n3; s4 += 1) if (e4[s4] !== t5[s4]) return s4; return n3; }(i2, n2) >= t4 - 1) break; t4--; } r2++; } return at; } function dt(t4) { var e3; if (void 0 === R[t4] && true && module2 && module2.exports && null != t4.match("^[^/\\\\]*$")) try { e3 = at._abbr, commonjsRequire("./locale/" + t4), ct(e3); } catch (e4) { R[t4] = null; } return R[t4]; } function ct(e3, t4) { return e3 && ((t4 = o(t4) ? mt(e3) : ft(e3, t4)) ? at = t4 : "undefined" != typeof console && console.warn && console.warn("Locale " + e3 + " not found. Did you forget to load it?")), at._abbr; } function ft(e3, t4) { if (null === t4) return delete R[e3], null; var n2, s3 = ot; if (t4.abbr = e3, null != R[e3]) Q("defineLocaleOverride", "use moment.updateLocale(localeName, config) to change an existing locale. moment.defineLocale(localeName, config) should only be used for creating a new locale See http://momentjs.com/guides/#/warnings/define-locale/ for more info."), s3 = R[e3]._config; else if (null != t4.parentLocale) if (null != R[t4.parentLocale]) s3 = R[t4.parentLocale]._config; else { if (null == (n2 = dt(t4.parentLocale))) return ut[t4.parentLocale] || (ut[t4.parentLocale] = []), ut[t4.parentLocale].push({ name: e3, config: t4 }), null; s3 = n2._config; } return R[e3] = new K2(X3(s3, t4)), ut[e3] && ut[e3].forEach(function(e4) { ft(e4.name, e4.config); }), ct(e3), R[e3]; } function mt(e3) { var t4; if (!(e3 = e3 && e3._locale && e3._locale._abbr ? e3._locale._abbr : e3)) return at; if (!a2(e3)) { if (t4 = dt(e3)) return t4; e3 = [e3]; } return ht(e3); } function _t(e3) { var t4 = e3._a; return t4 && -2 === m2(e3).overflow && (t4 = t4[O] < 0 || 11 < t4[O] ? O : t4[b] < 1 || t4[b] > We(t4[Y3], t4[O]) ? b : t4[x2] < 0 || 24 < t4[x2] || 24 === t4[x2] && (0 !== t4[T] || 0 !== t4[N] || 0 !== t4[Ne]) ? x2 : t4[T] < 0 || 59 < t4[T] ? T : t4[N] < 0 || 59 < t4[N] ? N : t4[Ne] < 0 || 999 < t4[Ne] ? Ne : -1, m2(e3)._overflowDayOfYear && (t4 < Y3 || b < t4) && (t4 = b), m2(e3)._overflowWeeks && -1 === t4 && (t4 = Pe), m2(e3)._overflowWeekday && -1 === t4 && (t4 = Re), m2(e3).overflow = t4), e3; } var yt = /^\s*((?:[+-]\d{6}|\d{4})-(?:\d\d-\d\d|W\d\d-\d|W\d\d|\d\d\d|\d\d))(?:(T| )(\d\d(?::\d\d(?::\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, gt = /^\s*((?:[+-]\d{6}|\d{4})(?:\d\d\d\d|W\d\d\d|W\d\d|\d\d\d|\d\d|))(?:(T| )(\d\d(?:\d\d(?:\d\d(?:[.,]\d+)?)?)?)([+-]\d\d(?::?\d\d)?|\s*Z)?)?$/, wt = /Z|[+-]\d\d(?::?\d\d)?/, pt = [["YYYYYY-MM-DD", /[+-]\d{6}-\d\d-\d\d/], ["YYYY-MM-DD", /\d{4}-\d\d-\d\d/], ["GGGG-[W]WW-E", /\d{4}-W\d\d-\d/], ["GGGG-[W]WW", /\d{4}-W\d\d/, false], ["YYYY-DDD", /\d{4}-\d{3}/], ["YYYY-MM", /\d{4}-\d\d/, false], ["YYYYYYMMDD", /[+-]\d{10}/], ["YYYYMMDD", /\d{8}/], ["GGGG[W]WWE", /\d{4}W\d{3}/], ["GGGG[W]WW", /\d{4}W\d{2}/, false], ["YYYYDDD", /\d{7}/], ["YYYYMM", /\d{6}/, false], ["YYYY", /\d{4}/, false]], kt = [["HH:mm:ss.SSSS", /\d\d:\d\d:\d\d\.\d+/], ["HH:mm:ss,SSSS", /\d\d:\d\d:\d\d,\d+/], ["HH:mm:ss", /\d\d:\d\d:\d\d/], ["HH:mm", /\d\d:\d\d/], ["HHmmss.SSSS", /\d\d\d\d\d\d\.\d+/], ["HHmmss,SSSS", /\d\d\d\d\d\d,\d+/], ["HHmmss", /\d\d\d\d\d\d/], ["HHmm", /\d\d\d\d/], ["HH", /\d\d/]], vt = /^\/?Date\((-?\d+)/i, Mt = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),?\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|([+-]\d{4}))$/, Dt = { UT: 0, GMT: 0, EDT: -240, EST: -300, CDT: -300, CST: -360, MDT: -360, MST: -420, PDT: -420, PST: -480 }; function St(e3) { var t4, n2, s3, i2, r2, a3, o2 = e3._i, u3 = yt.exec(o2) || gt.exec(o2), o2 = pt.length, l2 = kt.length; if (u3) { for (m2(e3).iso = true, t4 = 0, n2 = o2; t4 < n2; t4++) if (pt[t4][1].exec(u3[1])) { i2 = pt[t4][0], s3 = false !== pt[t4][2]; break; } if (null == i2) e3._isValid = false; else { if (u3[3]) { for (t4 = 0, n2 = l2; t4 < n2; t4++) if (kt[t4][1].exec(u3[3])) { r2 = (u3[2] || " ") + kt[t4][0]; break; } if (null == r2) return void (e3._isValid = false); } if (s3 || null == r2) { if (u3[4]) { if (!wt.exec(u3[4])) return void (e3._isValid = false); a3 = "Z"; } e3._f = i2 + (r2 || "") + (a3 || ""), Tt(e3); } else e3._isValid = false; } } else e3._isValid = false; } function Yt(e3, t4, n2, s3, i2, r2) { e3 = [function(e4) { e4 = parseInt(e4, 10); { if (e4 <= 49) return 2e3 + e4; if (e4 <= 999) return 1900 + e4; } return e4; }(e3), Ue.indexOf(t4), parseInt(n2, 10), parseInt(s3, 10), parseInt(i2, 10)]; return r2 && e3.push(parseInt(r2, 10)), e3; } function Ot(e3) { var t4, n2, s3, i2, r2 = Mt.exec(e3._i.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").replace(/^\s\s*/, "").replace(/\s\s*$/, "")); r2 ? (t4 = Yt(r2[4], r2[3], r2[2], r2[5], r2[6], r2[7]), n2 = r2[1], s3 = t4, i2 = e3, n2 && Qe.indexOf(n2) !== new Date(s3[0], s3[1], s3[2]).getDay() ? (m2(i2).weekdayMismatch = true, i2._isValid = false) : (e3._a = t4, e3._tzm = (n2 = r2[8], s3 = r2[9], i2 = r2[10], n2 ? Dt[n2] : s3 ? 0 : 60 * (((n2 = parseInt(i2, 10)) - (s3 = n2 % 100)) / 100) + s3), e3._d = Ze.apply(null, e3._a), e3._d.setUTCMinutes(e3._d.getUTCMinutes() - e3._tzm), m2(e3).rfc2822 = true)) : e3._isValid = false; } function bt(e3, t4, n2) { return null != e3 ? e3 : null != t4 ? t4 : n2; } function xt(e3) { var t4, n2, s3, i2, r2, a3, o2, u3, l2, h2, d2, c3 = []; if (!e3._d) { for (s3 = e3, i2 = new Date(f.now()), n2 = s3._useUTC ? [i2.getUTCFullYear(), i2.getUTCMonth(), i2.getUTCDate()] : [i2.getFullYear(), i2.getMonth(), i2.getDate()], e3._w && null == e3._a[b] && null == e3._a[O] && (null != (i2 = (s3 = e3)._w).GG || null != i2.W || null != i2.E ? (u3 = 1, l2 = 4, r2 = bt(i2.GG, s3._a[Y3], qe(W(), 1, 4).year), a3 = bt(i2.W, 1), ((o2 = bt(i2.E, 1)) < 1 || 7 < o2) && (h2 = true)) : (u3 = s3._locale._week.dow, l2 = s3._locale._week.doy, d2 = qe(W(), u3, l2), r2 = bt(i2.gg, s3._a[Y3], d2.year), a3 = bt(i2.w, d2.week), null != i2.d ? ((o2 = i2.d) < 0 || 6 < o2) && (h2 = true) : null != i2.e ? (o2 = i2.e + u3, (i2.e < 0 || 6 < i2.e) && (h2 = true)) : o2 = u3), a3 < 1 || a3 > P(r2, u3, l2) ? m2(s3)._overflowWeeks = true : null != h2 ? m2(s3)._overflowWeekday = true : (d2 = $e(r2, a3, o2, u3, l2), s3._a[Y3] = d2.year, s3._dayOfYear = d2.dayOfYear)), null != e3._dayOfYear && (i2 = bt(e3._a[Y3], n2[Y3]), (e3._dayOfYear > Ae(i2) || 0 === e3._dayOfYear) && (m2(e3)._overflowDayOfYear = true), h2 = Ze(i2, 0, e3._dayOfYear), e3._a[O] = h2.getUTCMonth(), e3._a[b] = h2.getUTCDate()), t4 = 0; t4 < 3 && null == e3._a[t4]; ++t4) e3._a[t4] = c3[t4] = n2[t4]; for (; t4 < 7; t4++) e3._a[t4] = c3[t4] = null == e3._a[t4] ? 2 === t4 ? 1 : 0 : e3._a[t4]; 24 === e3._a[x2] && 0 === e3._a[T] && 0 === e3._a[N] && 0 === e3._a[Ne] && (e3._nextDay = true, e3._a[x2] = 0), e3._d = (e3._useUTC ? Ze : je).apply(null, c3), r2 = e3._useUTC ? e3._d.getUTCDay() : e3._d.getDay(), null != e3._tzm && e3._d.setUTCMinutes(e3._d.getUTCMinutes() - e3._tzm), e3._nextDay && (e3._a[x2] = 24), e3._w && void 0 !== e3._w.d && e3._w.d !== r2 && (m2(e3).weekdayMismatch = true); } } function Tt(e3) { if (e3._f === f.ISO_8601) St(e3); else if (e3._f === f.RFC_2822) Ot(e3); else { e3._a = [], m2(e3).empty = true; for (var t4, n2, s3, i2, r2, a3 = "" + e3._i, o2 = a3.length, u3 = 0, l2 = ae(e3._f, e3._locale).match(te) || [], h2 = l2.length, d2 = 0; d2 < h2; d2++) n2 = l2[d2], (t4 = (a3.match(Oe(n2, e3)) || [])[0]) && (0 < (s3 = a3.substr(0, a3.indexOf(t4))).length && m2(e3).unusedInput.push(s3), a3 = a3.slice(a3.indexOf(t4) + t4.length), u3 += t4.length), ie[n2] ? (t4 ? m2(e3).empty = false : m2(e3).unusedTokens.push(n2), s3 = n2, r2 = e3, null != (i2 = t4) && c2(xe, s3) && xe[s3](i2, r2._a, r2, s3)) : e3._strict && !t4 && m2(e3).unusedTokens.push(n2); m2(e3).charsLeftOver = o2 - u3, 0 < a3.length && m2(e3).unusedInput.push(a3), e3._a[x2] <= 12 && true === m2(e3).bigHour && 0 < e3._a[x2] && (m2(e3).bigHour = void 0), m2(e3).parsedDateParts = e3._a.slice(0), m2(e3).meridiem = e3._meridiem, e3._a[x2] = function(e4, t5, n3) { if (null == n3) return t5; return null != e4.meridiemHour ? e4.meridiemHour(t5, n3) : null != e4.isPM ? ((e4 = e4.isPM(n3)) && t5 < 12 && (t5 += 12), t5 = e4 || 12 !== t5 ? t5 : 0) : t5; }(e3._locale, e3._a[x2], e3._meridiem), null !== (o2 = m2(e3).era) && (e3._a[Y3] = e3._locale.erasConvertYear(o2, e3._a[Y3])), xt(e3), _t(e3); } } function Nt(e3) { var t4, n2, s3, i2 = e3._i, r2 = e3._f; if (e3._locale = e3._locale || mt(e3._l), null === i2 || void 0 === r2 && "" === i2) return I({ nullInput: true }); if ("string" == typeof i2 && (e3._i = i2 = e3._locale.preparse(i2)), h(i2)) return new q(_t(i2)); if (V(i2)) e3._d = i2; else if (a2(r2)) !function(e4) { var t5, n3, s4, i3, r3, a3, o2 = false, u3 = e4._f.length; if (0 === u3) return m2(e4).invalidFormat = true, e4._d = new Date(NaN); for (i3 = 0; i3 < u3; i3++) r3 = 0, a3 = false, t5 = $({}, e4), null != e4._useUTC && (t5._useUTC = e4._useUTC), t5._f = e4._f[i3], Tt(t5), A5(t5) && (a3 = true), r3 = (r3 += m2(t5).charsLeftOver) + 10 * m2(t5).unusedTokens.length, m2(t5).score = r3, o2 ? r3 < s4 && (s4 = r3, n3 = t5) : (null == s4 || r3 < s4 || a3) && (s4 = r3, n3 = t5, a3 && (o2 = true)); E2(e4, n3 || t5); }(e3); else if (r2) Tt(e3); else if (o(r2 = (i2 = e3)._i)) i2._d = new Date(f.now()); else V(r2) ? i2._d = new Date(r2.valueOf()) : "string" == typeof r2 ? (n2 = i2, null !== (t4 = vt.exec(n2._i)) ? n2._d = new Date(+t4[1]) : (St(n2), false === n2._isValid && (delete n2._isValid, Ot(n2), false === n2._isValid && (delete n2._isValid, n2._strict ? n2._isValid = false : f.createFromInputFallback(n2))))) : a2(r2) ? (i2._a = G(r2.slice(0), function(e4) { return parseInt(e4, 10); }), xt(i2)) : F(r2) ? (t4 = i2)._d || (s3 = void 0 === (n2 = ue(t4._i)).day ? n2.date : n2.day, t4._a = G([n2.year, n2.month, s3, n2.hour, n2.minute, n2.second, n2.millisecond], function(e4) { return e4 && parseInt(e4, 10); }), xt(t4)) : u2(r2) ? i2._d = new Date(r2) : f.createFromInputFallback(i2); return A5(e3) || (e3._d = null), e3; } function Pt(e3, t4, n2, s3, i2) { var r2 = {}; return true !== t4 && false !== t4 || (s3 = t4, t4 = void 0), true !== n2 && false !== n2 || (s3 = n2, n2 = void 0), (F(e3) && L(e3) || a2(e3) && 0 === e3.length) && (e3 = void 0), r2._isAMomentObject = true, r2._useUTC = r2._isUTC = i2, r2._l = n2, r2._i = e3, r2._f = t4, r2._strict = s3, (i2 = new q(_t(Nt(i2 = r2))))._nextDay && (i2.add(1, "d"), i2._nextDay = void 0), i2; } function W(e3, t4, n2, s3) { return Pt(e3, t4, n2, s3, false); } f.createFromInputFallback = e("value provided is not in a recognized RFC2822 or ISO format. moment construction falls back to js Date(), which is not reliable across all browsers and versions. Non RFC2822/ISO date formats are discouraged. Please refer to http://momentjs.com/guides/#/warnings/js-date/ for more info.", function(e3) { e3._d = new Date(e3._i + (e3._useUTC ? " UTC" : "")); }), f.ISO_8601 = function() { }, f.RFC_2822 = function() { }; ge = e("moment().min is deprecated, use moment.max instead. http://momentjs.com/guides/#/warnings/min-max/", function() { var e3 = W.apply(null, arguments); return this.isValid() && e3.isValid() ? e3 < this ? this : e3 : I(); }), we = e("moment().max is deprecated, use moment.min instead. http://momentjs.com/guides/#/warnings/min-max/", function() { var e3 = W.apply(null, arguments); return this.isValid() && e3.isValid() ? this < e3 ? this : e3 : I(); }); function Rt(e3, t4) { var n2, s3; if (!(t4 = 1 === t4.length && a2(t4[0]) ? t4[0] : t4).length) return W(); for (n2 = t4[0], s3 = 1; s3 < t4.length; ++s3) t4[s3].isValid() && !t4[s3][e3](n2) || (n2 = t4[s3]); return n2; } var Wt = ["year", "quarter", "month", "week", "day", "hour", "minute", "second", "millisecond"]; function Ct(e3) { var e3 = ue(e3), t4 = e3.year || 0, n2 = e3.quarter || 0, s3 = e3.month || 0, i2 = e3.week || e3.isoWeek || 0, r2 = e3.day || 0, a3 = e3.hour || 0, o2 = e3.minute || 0, u3 = e3.second || 0, l2 = e3.millisecond || 0; this._isValid = function(e4) { var t5, n3, s4 = false, i3 = Wt.length; for (t5 in e4) if (c2(e4, t5) && (-1 === S.call(Wt, t5) || null != e4[t5] && isNaN(e4[t5]))) return false; for (n3 = 0; n3 < i3; ++n3) if (e4[Wt[n3]]) { if (s4) return false; parseFloat(e4[Wt[n3]]) !== g(e4[Wt[n3]]) && (s4 = true); } return true; }(e3), this._milliseconds = +l2 + 1e3 * u3 + 6e4 * o2 + 1e3 * a3 * 60 * 60, this._days = +r2 + 7 * i2, this._months = +s3 + 3 * n2 + 12 * t4, this._data = {}, this._locale = mt(), this._bubble(); } function Ut(e3) { return e3 instanceof Ct; } function Ht(e3) { return e3 < 0 ? -1 * Math.round(-1 * e3) : Math.round(e3); } function Ft(e3, n2) { s2(e3, 0, 0, function() { var e4 = this.utcOffset(), t4 = "+"; return e4 < 0 && (e4 = -e4, t4 = "-"), t4 + r(~~(e4 / 60), 2) + n2 + r(~~e4 % 60, 2); }); } Ft("Z", ":"), Ft("ZZ", ""), v("Z", Ye), v("ZZ", Ye), D2(["Z", "ZZ"], function(e3, t4, n2) { n2._useUTC = true, n2._tzm = Vt(Ye, e3); }); var Lt = /([\+\-]|\d\d)/gi; function Vt(e3, t4) { var t4 = (t4 || "").match(e3); return null === t4 ? null : 0 === (t4 = 60 * (e3 = ((t4[t4.length - 1] || []) + "").match(Lt) || ["-", 0, 0])[1] + g(e3[2])) ? 0 : "+" === e3[0] ? t4 : -t4; } function Gt(e3, t4) { var n2; return t4._isUTC ? (t4 = t4.clone(), n2 = (h(e3) || V(e3) ? e3 : W(e3)).valueOf() - t4.valueOf(), t4._d.setTime(t4._d.valueOf() + n2), f.updateOffset(t4, false), t4) : W(e3).local(); } function Et(e3) { return -Math.round(e3._d.getTimezoneOffset()); } function At() { return !!this.isValid() && (this._isUTC && 0 === this._offset); } f.updateOffset = function() { }; var It = /^(-|\+)?(?:(\d*)[. ])?(\d+):(\d+)(?::(\d+)(\.\d*)?)?$/, jt = /^(-|\+)?P(?:([-+]?[0-9,.]*)Y)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)W)?(?:([-+]?[0-9,.]*)D)?(?:T(?:([-+]?[0-9,.]*)H)?(?:([-+]?[0-9,.]*)M)?(?:([-+]?[0-9,.]*)S)?)?$/; function C3(e3, t4) { var n2, s3 = e3, i2 = null; return Ut(e3) ? s3 = { ms: e3._milliseconds, d: e3._days, M: e3._months } : u2(e3) || !isNaN(+e3) ? (s3 = {}, t4 ? s3[t4] = +e3 : s3.milliseconds = +e3) : (i2 = It.exec(e3)) ? (n2 = "-" === i2[1] ? -1 : 1, s3 = { y: 0, d: g(i2[b]) * n2, h: g(i2[x2]) * n2, m: g(i2[T]) * n2, s: g(i2[N]) * n2, ms: g(Ht(1e3 * i2[Ne])) * n2 }) : (i2 = jt.exec(e3)) ? (n2 = "-" === i2[1] ? -1 : 1, s3 = { y: Zt(i2[2], n2), M: Zt(i2[3], n2), w: Zt(i2[4], n2), d: Zt(i2[5], n2), h: Zt(i2[6], n2), m: Zt(i2[7], n2), s: Zt(i2[8], n2) }) : null == s3 ? s3 = {} : "object" == typeof s3 && ("from" in s3 || "to" in s3) && (t4 = function(e4, t5) { var n3; if (!e4.isValid() || !t5.isValid()) return { milliseconds: 0, months: 0 }; t5 = Gt(t5, e4), e4.isBefore(t5) ? n3 = zt(e4, t5) : ((n3 = zt(t5, e4)).milliseconds = -n3.milliseconds, n3.months = -n3.months); return n3; }(W(s3.from), W(s3.to)), (s3 = {}).ms = t4.milliseconds, s3.M = t4.months), i2 = new Ct(s3), Ut(e3) && c2(e3, "_locale") && (i2._locale = e3._locale), Ut(e3) && c2(e3, "_isValid") && (i2._isValid = e3._isValid), i2; } function Zt(e3, t4) { e3 = e3 && parseFloat(e3.replace(",", ".")); return (isNaN(e3) ? 0 : e3) * t4; } function zt(e3, t4) { var n2 = {}; return n2.months = t4.month() - e3.month() + 12 * (t4.year() - e3.year()), e3.clone().add(n2.months, "M").isAfter(t4) && --n2.months, n2.milliseconds = +t4 - +e3.clone().add(n2.months, "M"), n2; } function $t(s3, i2) { return function(e3, t4) { var n2; return null === t4 || isNaN(+t4) || (Q(i2, "moment()." + i2 + "(period, number) is deprecated. Please use moment()." + i2 + "(number, period). See http://momentjs.com/guides/#/warnings/add-inverted-param/ for more info."), n2 = e3, e3 = t4, t4 = n2), qt(this, C3(e3, t4), s3), this; }; } function qt(e3, t4, n2, s3) { var i2 = t4._milliseconds, r2 = Ht(t4._days), t4 = Ht(t4._months); e3.isValid() && (s3 = null == s3 || s3, t4 && Ve(e3, ce(e3, "Month") + t4 * n2), r2 && fe(e3, "Date", ce(e3, "Date") + r2 * n2), i2 && e3._d.setTime(e3._d.valueOf() + i2 * n2), s3 && f.updateOffset(e3, r2 || t4)); } C3.fn = Ct.prototype, C3.invalid = function() { return C3(NaN); }; Ce = $t(1, "add"), Je = $t(-1, "subtract"); function Bt(e3) { return "string" == typeof e3 || e3 instanceof String; } function Jt(e3) { return h(e3) || V(e3) || Bt(e3) || u2(e3) || function(t4) { var e4 = a2(t4), n2 = false; e4 && (n2 = 0 === t4.filter(function(e6) { return !u2(e6) && Bt(t4); }).length); return e4 && n2; }(e3) || function(e4) { var t4, n2, s3 = F(e4) && !L(e4), i2 = false, r2 = ["years", "year", "y", "months", "month", "M", "days", "day", "d", "dates", "date", "D", "hours", "hour", "h", "minutes", "minute", "m", "seconds", "second", "s", "milliseconds", "millisecond", "ms"], a3 = r2.length; for (t4 = 0; t4 < a3; t4 += 1) n2 = r2[t4], i2 = i2 || c2(e4, n2); return s3 && i2; }(e3) || null == e3; } function Qt(e3, t4) { if (e3.date() < t4.date()) return -Qt(t4, e3); var n2 = 12 * (t4.year() - e3.year()) + (t4.month() - e3.month()), s3 = e3.clone().add(n2, "months"), t4 = t4 - s3 < 0 ? (t4 - s3) / (s3 - e3.clone().add(n2 - 1, "months")) : (t4 - s3) / (e3.clone().add(1 + n2, "months") - s3); return -(n2 + t4) || 0; } function Xt(e3) { return void 0 === e3 ? this._locale._abbr : (null != (e3 = mt(e3)) && (this._locale = e3), this); } f.defaultFormat = "YYYY-MM-DDTHH:mm:ssZ", f.defaultFormatUtc = "YYYY-MM-DDTHH:mm:ss[Z]"; Xe = e("moment().lang() is deprecated. Instead, use moment().localeData() to get the language configuration. Use moment().locale() to change languages.", function(e3) { return void 0 === e3 ? this.localeData() : this.locale(e3); }); function Kt() { return this._locale; } var en = 126227808e5; function tn(e3, t4) { return (e3 % t4 + t4) % t4; } function nn(e3, t4, n2) { return e3 < 100 && 0 <= e3 ? new Date(e3 + 400, t4, n2) - en : new Date(e3, t4, n2).valueOf(); } function sn(e3, t4, n2) { return e3 < 100 && 0 <= e3 ? Date.UTC(e3 + 400, t4, n2) - en : Date.UTC(e3, t4, n2); } function rn(e3, t4) { return t4.erasAbbrRegex(e3); } function an() { for (var e3 = [], t4 = [], n2 = [], s3 = [], i2 = this.eras(), r2 = 0, a3 = i2.length; r2 < a3; ++r2) t4.push(M2(i2[r2].name)), e3.push(M2(i2[r2].abbr)), n2.push(M2(i2[r2].narrow)), s3.push(M2(i2[r2].name)), s3.push(M2(i2[r2].abbr)), s3.push(M2(i2[r2].narrow)); this._erasRegex = new RegExp("^(" + s3.join("|") + ")", "i"), this._erasNameRegex = new RegExp("^(" + t4.join("|") + ")", "i"), this._erasAbbrRegex = new RegExp("^(" + e3.join("|") + ")", "i"), this._erasNarrowRegex = new RegExp("^(" + n2.join("|") + ")", "i"); } function on(e3, t4) { s2(0, [e3, e3.length], 0, t4); } function un(e3, t4, n2, s3, i2) { var r2; return null == e3 ? qe(this, s3, i2).year : (r2 = P(e3, s3, i2), function(e4, t5, n3, s4, i3) { e4 = $e(e4, t5, n3, s4, i3), t5 = Ze(e4.year, 0, e4.dayOfYear); return this.year(t5.getUTCFullYear()), this.month(t5.getUTCMonth()), this.date(t5.getUTCDate()), this; }.call(this, e3, t4 = r2 < t4 ? r2 : t4, n2, s3, i2)); } s2("N", 0, 0, "eraAbbr"), s2("NN", 0, 0, "eraAbbr"), s2("NNN", 0, 0, "eraAbbr"), s2("NNNN", 0, 0, "eraName"), s2("NNNNN", 0, 0, "eraNarrow"), s2("y", ["y", 1], "yo", "eraYear"), s2("y", ["yy", 2], 0, "eraYear"), s2("y", ["yyy", 3], 0, "eraYear"), s2("y", ["yyyy", 4], 0, "eraYear"), v("N", rn), v("NN", rn), v("NNN", rn), v("NNNN", function(e3, t4) { return t4.erasNameRegex(e3); }), v("NNNNN", function(e3, t4) { return t4.erasNarrowRegex(e3); }), D2(["N", "NN", "NNN", "NNNN", "NNNNN"], function(e3, t4, n2, s3) { s3 = n2._locale.erasParse(e3, s3, n2._strict); s3 ? m2(n2).era = s3 : m2(n2).invalidEra = e3; }), v("y", Me), v("yy", Me), v("yyy", Me), v("yyyy", Me), v("yo", function(e3, t4) { return t4._eraYearOrdinalRegex || Me; }), D2(["y", "yy", "yyy", "yyyy"], Y3), D2(["yo"], function(e3, t4, n2, s3) { var i2; n2._locale._eraYearOrdinalRegex && (i2 = e3.match(n2._locale._eraYearOrdinalRegex)), n2._locale.eraYearOrdinalParse ? t4[Y3] = n2._locale.eraYearOrdinalParse(e3, i2) : t4[Y3] = parseInt(e3, 10); }), s2(0, ["gg", 2], 0, function() { return this.weekYear() % 100; }), s2(0, ["GG", 2], 0, function() { return this.isoWeekYear() % 100; }), on("gggg", "weekYear"), on("ggggg", "weekYear"), on("GGGG", "isoWeekYear"), on("GGGGG", "isoWeekYear"), t("weekYear", "gg"), t("isoWeekYear", "GG"), n("weekYear", 1), n("isoWeekYear", 1), v("G", De), v("g", De), v("GG", p, w2), v("gg", p, w2), v("GGGG", ke, _e), v("gggg", ke, _e), v("GGGGG", ve, ye), v("ggggg", ve, ye), Te(["gggg", "ggggg", "GGGG", "GGGGG"], function(e3, t4, n2, s3) { t4[s3.substr(0, 2)] = g(e3); }), Te(["gg", "GG"], function(e3, t4, n2, s3) { t4[s3] = f.parseTwoDigitYear(e3); }), s2("Q", 0, "Qo", "quarter"), t("quarter", "Q"), n("quarter", 7), v("Q", i), D2("Q", function(e3, t4) { t4[O] = 3 * (g(e3) - 1); }), s2("D", ["DD", 2], "Do", "date"), t("date", "D"), n("date", 9), v("D", p), v("DD", p, w2), v("Do", function(e3, t4) { return e3 ? t4._dayOfMonthOrdinalParse || t4._ordinalParse : t4._dayOfMonthOrdinalParseLenient; }), D2(["D", "DD"], b), D2("Do", function(e3, t4) { t4[b] = g(e3.match(p)[0]); }); ke = de("Date", true); s2("DDD", ["DDDD", 3], "DDDo", "dayOfYear"), t("dayOfYear", "DDD"), n("dayOfYear", 4), v("DDD", pe), v("DDDD", me), D2(["DDD", "DDDD"], function(e3, t4, n2) { n2._dayOfYear = g(e3); }), s2("m", ["mm", 2], 0, "minute"), t("minute", "m"), n("minute", 14), v("m", p), v("mm", p, w2), D2(["m", "mm"], T); var ln, _e = de("Minutes", false), ve = (s2("s", ["ss", 2], 0, "second"), t("second", "s"), n("second", 15), v("s", p), v("ss", p, w2), D2(["s", "ss"], N), de("Seconds", false)); for (s2("S", 0, 0, function() { return ~~(this.millisecond() / 100); }), s2(0, ["SS", 2], 0, function() { return ~~(this.millisecond() / 10); }), s2(0, ["SSS", 3], 0, "millisecond"), s2(0, ["SSSS", 4], 0, function() { return 10 * this.millisecond(); }), s2(0, ["SSSSS", 5], 0, function() { return 100 * this.millisecond(); }), s2(0, ["SSSSSS", 6], 0, function() { return 1e3 * this.millisecond(); }), s2(0, ["SSSSSSS", 7], 0, function() { return 1e4 * this.millisecond(); }), s2(0, ["SSSSSSSS", 8], 0, function() { return 1e5 * this.millisecond(); }), s2(0, ["SSSSSSSSS", 9], 0, function() { return 1e6 * this.millisecond(); }), t("millisecond", "ms"), n("millisecond", 16), v("S", pe, i), v("SS", pe, w2), v("SSS", pe, me), ln = "SSSS"; ln.length <= 9; ln += "S") v(ln, Me); function hn(e3, t4) { t4[Ne] = g(1e3 * ("0." + e3)); } for (ln = "S"; ln.length <= 9; ln += "S") D2(ln, hn); ye = de("Milliseconds", false), s2("z", 0, 0, "zoneAbbr"), s2("zz", 0, 0, "zoneName"); i = q.prototype; function dn(e3) { return e3; } i.add = Ce, i.calendar = function(e3, t4) { 1 === arguments.length && (arguments[0] ? Jt(arguments[0]) ? (e3 = arguments[0], t4 = void 0) : function(e4) { for (var t5 = F(e4) && !L(e4), n3 = false, s3 = ["sameDay", "nextDay", "lastDay", "nextWeek", "lastWeek", "sameElse"], i2 = 0; i2 < s3.length; i2 += 1) n3 = n3 || c2(e4, s3[i2]); return t5 && n3; }(arguments[0]) && (t4 = arguments[0], e3 = void 0) : t4 = e3 = void 0); var e3 = e3 || W(), n2 = Gt(e3, this).startOf("day"), n2 = f.calendarFormat(this, n2) || "sameElse", t4 = t4 && (d(t4[n2]) ? t4[n2].call(this, e3) : t4[n2]); return this.format(t4 || this.localeData().calendar(n2, this, W(e3))); }, i.clone = function() { return new q(this); }, i.diff = function(e3, t4, n2) { var s3, i2, r2; if (!this.isValid()) return NaN; if (!(s3 = Gt(e3, this)).isValid()) return NaN; switch (i2 = 6e4 * (s3.utcOffset() - this.utcOffset()), t4 = _2(t4)) { case "year": r2 = Qt(this, s3) / 12; break; case "month": r2 = Qt(this, s3); break; case "quarter": r2 = Qt(this, s3) / 3; break; case "second": r2 = (this - s3) / 1e3; break; case "minute": r2 = (this - s3) / 6e4; break; case "hour": r2 = (this - s3) / 36e5; break; case "day": r2 = (this - s3 - i2) / 864e5; break; case "week": r2 = (this - s3 - i2) / 6048e5; break; default: r2 = this - s3; } return n2 ? r2 : y2(r2); }, i.endOf = function(e3) { var t4, n2; if (void 0 === (e3 = _2(e3)) || "millisecond" === e3 || !this.isValid()) return this; switch (n2 = this._isUTC ? sn : nn, e3) { case "year": t4 = n2(this.year() + 1, 0, 1) - 1; break; case "quarter": t4 = n2(this.year(), this.month() - this.month() % 3 + 3, 1) - 1; break; case "month": t4 = n2(this.year(), this.month() + 1, 1) - 1; break; case "week": t4 = n2(this.year(), this.month(), this.date() - this.weekday() + 7) - 1; break; case "isoWeek": t4 = n2(this.year(), this.month(), this.date() - (this.isoWeekday() - 1) + 7) - 1; break; case "day": case "date": t4 = n2(this.year(), this.month(), this.date() + 1) - 1; break; case "hour": t4 = this._d.valueOf(), t4 += 36e5 - tn(t4 + (this._isUTC ? 0 : 6e4 * this.utcOffset()), 36e5) - 1; break; case "minute": t4 = this._d.valueOf(), t4 += 6e4 - tn(t4, 6e4) - 1; break; case "second": t4 = this._d.valueOf(), t4 += 1e3 - tn(t4, 1e3) - 1; break; } return this._d.setTime(t4), f.updateOffset(this, true), this; }, i.format = function(e3) { return e3 = e3 || (this.isUtc() ? f.defaultFormatUtc : f.defaultFormat), e3 = re2(this, e3), this.localeData().postformat(e3); }, i.from = function(e3, t4) { return this.isValid() && (h(e3) && e3.isValid() || W(e3).isValid()) ? C3({ to: this, from: e3 }).locale(this.locale()).humanize(!t4) : this.localeData().invalidDate(); }, i.fromNow = function(e3) { return this.from(W(), e3); }, i.to = function(e3, t4) { return this.isValid() && (h(e3) && e3.isValid() || W(e3).isValid()) ? C3({ from: this, to: e3 }).locale(this.locale()).humanize(!t4) : this.localeData().invalidDate(); }, i.toNow = function(e3) { return this.to(W(), e3); }, i.get = function(e3) { return d(this[e3 = _2(e3)]) ? this[e3]() : this; }, i.invalidAt = function() { return m2(this).overflow; }, i.isAfter = function(e3, t4) { return e3 = h(e3) ? e3 : W(e3), !(!this.isValid() || !e3.isValid()) && ("millisecond" === (t4 = _2(t4) || "millisecond") ? this.valueOf() > e3.valueOf() : e3.valueOf() < this.clone().startOf(t4).valueOf()); }, i.isBefore = function(e3, t4) { return e3 = h(e3) ? e3 : W(e3), !(!this.isValid() || !e3.isValid()) && ("millisecond" === (t4 = _2(t4) || "millisecond") ? this.valueOf() < e3.valueOf() : this.clone().endOf(t4).valueOf() < e3.valueOf()); }, i.isBetween = function(e3, t4, n2, s3) { return e3 = h(e3) ? e3 : W(e3), t4 = h(t4) ? t4 : W(t4), !!(this.isValid() && e3.isValid() && t4.isValid()) && (("(" === (s3 = s3 || "()")[0] ? this.isAfter(e3, n2) : !this.isBefore(e3, n2)) && (")" === s3[1] ? this.isBefore(t4, n2) : !this.isAfter(t4, n2))); }, i.isSame = function(e3, t4) { var e3 = h(e3) ? e3 : W(e3); return !(!this.isValid() || !e3.isValid()) && ("millisecond" === (t4 = _2(t4) || "millisecond") ? this.valueOf() === e3.valueOf() : (e3 = e3.valueOf(), this.clone().startOf(t4).valueOf() <= e3 && e3 <= this.clone().endOf(t4).valueOf())); }, i.isSameOrAfter = function(e3, t4) { return this.isSame(e3, t4) || this.isAfter(e3, t4); }, i.isSameOrBefore = function(e3, t4) { return this.isSame(e3, t4) || this.isBefore(e3, t4); }, i.isValid = function() { return A5(this); }, i.lang = Xe, i.locale = Xt, i.localeData = Kt, i.max = we, i.min = ge, i.parsingFlags = function() { return E2({}, m2(this)); }, i.set = function(e3, t4) { if ("object" == typeof e3) for (var n2 = function(e4) { var t5, n3 = []; for (t5 in e4) c2(e4, t5) && n3.push({ unit: t5, priority: le[t5] }); return n3.sort(function(e6, t6) { return e6.priority - t6.priority; }), n3; }(e3 = ue(e3)), s3 = n2.length, i2 = 0; i2 < s3; i2++) this[n2[i2].unit](e3[n2[i2].unit]); else if (d(this[e3 = _2(e3)])) return this[e3](t4); return this; }, i.startOf = function(e3) { var t4, n2; if (void 0 === (e3 = _2(e3)) || "millisecond" === e3 || !this.isValid()) return this; switch (n2 = this._isUTC ? sn : nn, e3) { case "year": t4 = n2(this.year(), 0, 1); break; case "quarter": t4 = n2(this.year(), this.month() - this.month() % 3, 1); break; case "month": t4 = n2(this.year(), this.month(), 1); break; case "week": t4 = n2(this.year(), this.month(), this.date() - this.weekday()); break; case "isoWeek": t4 = n2(this.year(), this.month(), this.date() - (this.isoWeekday() - 1)); break; case "day": case "date": t4 = n2(this.year(), this.month(), this.date()); break; case "hour": t4 = this._d.valueOf(), t4 -= tn(t4 + (this._isUTC ? 0 : 6e4 * this.utcOffset()), 36e5); break; case "minute": t4 = this._d.valueOf(), t4 -= tn(t4, 6e4); break; case "second": t4 = this._d.valueOf(), t4 -= tn(t4, 1e3); break; } return this._d.setTime(t4), f.updateOffset(this, true), this; }, i.subtract = Je, i.toArray = function() { var e3 = this; return [e3.year(), e3.month(), e3.date(), e3.hour(), e3.minute(), e3.second(), e3.millisecond()]; }, i.toObject = function() { var e3 = this; return { years: e3.year(), months: e3.month(), date: e3.date(), hours: e3.hours(), minutes: e3.minutes(), seconds: e3.seconds(), milliseconds: e3.milliseconds() }; }, i.toDate = function() { return new Date(this.valueOf()); }, i.toISOString = function(e3) { if (!this.isValid()) return null; var t4 = (e3 = true !== e3) ? this.clone().utc() : this; return t4.year() < 0 || 9999 < t4.year() ? re2(t4, e3 ? "YYYYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYYYY-MM-DD[T]HH:mm:ss.SSSZ") : d(Date.prototype.toISOString) ? e3 ? this.toDate().toISOString() : new Date(this.valueOf() + 60 * this.utcOffset() * 1e3).toISOString().replace("Z", re2(t4, "Z")) : re2(t4, e3 ? "YYYY-MM-DD[T]HH:mm:ss.SSS[Z]" : "YYYY-MM-DD[T]HH:mm:ss.SSSZ"); }, i.inspect = function() { if (!this.isValid()) return "moment.invalid(/* " + this._i + " */)"; var e3, t4 = "moment", n2 = ""; return this.isLocal() || (t4 = 0 === this.utcOffset() ? "moment.utc" : "moment.parseZone", n2 = "Z"), t4 = "[" + t4 + '("]', e3 = 0 <= this.year() && this.year() <= 9999 ? "YYYY" : "YYYYYY", this.format(t4 + e3 + "-MM-DD[T]HH:mm:ss.SSS" + (n2 + '[")]')); }, "undefined" != typeof Symbol && null != Symbol.for && (i[Symbol.for("nodejs.util.inspect.custom")] = function() { return "Moment<" + this.format() + ">"; }), i.toJSON = function() { return this.isValid() ? this.toISOString() : null; }, i.toString = function() { return this.clone().locale("en").format("ddd MMM DD YYYY HH:mm:ss [GMT]ZZ"); }, i.unix = function() { return Math.floor(this.valueOf() / 1e3); }, i.valueOf = function() { return this._d.valueOf() - 6e4 * (this._offset || 0); }, i.creationData = function() { return { input: this._i, format: this._f, locale: this._locale, isUTC: this._isUTC, strict: this._strict }; }, i.eraName = function() { for (var e3, t4 = this.localeData().eras(), n2 = 0, s3 = t4.length; n2 < s3; ++n2) { if (e3 = this.clone().startOf("day").valueOf(), t4[n2].since <= e3 && e3 <= t4[n2].until) return t4[n2].name; if (t4[n2].until <= e3 && e3 <= t4[n2].since) return t4[n2].name; } return ""; }, i.eraNarrow = function() { for (var e3, t4 = this.localeData().eras(), n2 = 0, s3 = t4.length; n2 < s3; ++n2) { if (e3 = this.clone().startOf("day").valueOf(), t4[n2].since <= e3 && e3 <= t4[n2].until) return t4[n2].narrow; if (t4[n2].until <= e3 && e3 <= t4[n2].since) return t4[n2].narrow; } return ""; }, i.eraAbbr = function() { for (var e3, t4 = this.localeData().eras(), n2 = 0, s3 = t4.length; n2 < s3; ++n2) { if (e3 = this.clone().startOf("day").valueOf(), t4[n2].since <= e3 && e3 <= t4[n2].until) return t4[n2].abbr; if (t4[n2].until <= e3 && e3 <= t4[n2].since) return t4[n2].abbr; } return ""; }, i.eraYear = function() { for (var e3, t4, n2 = this.localeData().eras(), s3 = 0, i2 = n2.length; s3 < i2; ++s3) if (e3 = n2[s3].since <= n2[s3].until ? 1 : -1, t4 = this.clone().startOf("day").valueOf(), n2[s3].since <= t4 && t4 <= n2[s3].until || n2[s3].until <= t4 && t4 <= n2[s3].since) return (this.year() - f(n2[s3].since).year()) * e3 + n2[s3].offset; return this.year(); }, i.year = Ie, i.isLeapYear = function() { return he(this.year()); }, i.weekYear = function(e3) { return un.call(this, e3, this.week(), this.weekday(), this.localeData()._week.dow, this.localeData()._week.doy); }, i.isoWeekYear = function(e3) { return un.call(this, e3, this.isoWeek(), this.isoWeekday(), 1, 4); }, i.quarter = i.quarters = function(e3) { return null == e3 ? Math.ceil((this.month() + 1) / 3) : this.month(3 * (e3 - 1) + this.month() % 3); }, i.month = Ge, i.daysInMonth = function() { return We(this.year(), this.month()); }, i.week = i.weeks = function(e3) { var t4 = this.localeData().week(this); return null == e3 ? t4 : this.add(7 * (e3 - t4), "d"); }, i.isoWeek = i.isoWeeks = function(e3) { var t4 = qe(this, 1, 4).week; return null == e3 ? t4 : this.add(7 * (e3 - t4), "d"); }, i.weeksInYear = function() { var e3 = this.localeData()._week; return P(this.year(), e3.dow, e3.doy); }, i.weeksInWeekYear = function() { var e3 = this.localeData()._week; return P(this.weekYear(), e3.dow, e3.doy); }, i.isoWeeksInYear = function() { return P(this.year(), 1, 4); }, i.isoWeeksInISOWeekYear = function() { return P(this.isoWeekYear(), 1, 4); }, i.date = ke, i.day = i.days = function(e3) { if (!this.isValid()) return null != e3 ? this : NaN; var t4, n2, s3 = this._isUTC ? this._d.getUTCDay() : this._d.getDay(); return null != e3 ? (t4 = e3, n2 = this.localeData(), e3 = "string" != typeof t4 ? t4 : isNaN(t4) ? "number" == typeof (t4 = n2.weekdaysParse(t4)) ? t4 : null : parseInt(t4, 10), this.add(e3 - s3, "d")) : s3; }, i.weekday = function(e3) { if (!this.isValid()) return null != e3 ? this : NaN; var t4 = (this.day() + 7 - this.localeData()._week.dow) % 7; return null == e3 ? t4 : this.add(e3 - t4, "d"); }, i.isoWeekday = function(e3) { return this.isValid() ? null != e3 ? (t4 = e3, n2 = this.localeData(), n2 = "string" == typeof t4 ? n2.weekdaysParse(t4) % 7 || 7 : isNaN(t4) ? null : t4, this.day(this.day() % 7 ? n2 : n2 - 7)) : this.day() || 7 : null != e3 ? this : NaN; var t4, n2; }, i.dayOfYear = function(e3) { var t4 = Math.round((this.clone().startOf("day") - this.clone().startOf("year")) / 864e5) + 1; return null == e3 ? t4 : this.add(e3 - t4, "d"); }, i.hour = i.hours = k2, i.minute = i.minutes = _e, i.second = i.seconds = ve, i.millisecond = i.milliseconds = ye, i.utcOffset = function(e3, t4, n2) { var s3, i2 = this._offset || 0; if (!this.isValid()) return null != e3 ? this : NaN; if (null == e3) return this._isUTC ? i2 : Et(this); if ("string" == typeof e3) { if (null === (e3 = Vt(Ye, e3))) return this; } else Math.abs(e3) < 16 && !n2 && (e3 *= 60); return !this._isUTC && t4 && (s3 = Et(this)), this._offset = e3, this._isUTC = true, null != s3 && this.add(s3, "m"), i2 !== e3 && (!t4 || this._changeInProgress ? qt(this, C3(e3 - i2, "m"), 1, false) : this._changeInProgress || (this._changeInProgress = true, f.updateOffset(this, true), this._changeInProgress = null)), this; }, i.utc = function(e3) { return this.utcOffset(0, e3); }, i.local = function(e3) { return this._isUTC && (this.utcOffset(0, e3), this._isUTC = false, e3 && this.subtract(Et(this), "m")), this; }, i.parseZone = function() { var e3; return null != this._tzm ? this.utcOffset(this._tzm, false, true) : "string" == typeof this._i && (null != (e3 = Vt(Se, this._i)) ? this.utcOffset(e3) : this.utcOffset(0, true)), this; }, i.hasAlignedHourOffset = function(e3) { return !!this.isValid() && (e3 = e3 ? W(e3).utcOffset() : 0, (this.utcOffset() - e3) % 60 == 0); }, i.isDST = function() { return this.utcOffset() > this.clone().month(0).utcOffset() || this.utcOffset() > this.clone().month(5).utcOffset(); }, i.isLocal = function() { return !!this.isValid() && !this._isUTC; }, i.isUtcOffset = function() { return !!this.isValid() && this._isUTC; }, i.isUtc = At, i.isUTC = At, i.zoneAbbr = function() { return this._isUTC ? "UTC" : ""; }, i.zoneName = function() { return this._isUTC ? "Coordinated Universal Time" : ""; }, i.dates = e("dates accessor is deprecated. Use date instead.", ke), i.months = e("months accessor is deprecated. Use month instead", Ge), i.years = e("years accessor is deprecated. Use year instead", Ie), i.zone = e("moment().zone is deprecated, use moment().utcOffset instead. http://momentjs.com/guides/#/warnings/zone/", function(e3, t4) { return null != e3 ? (this.utcOffset(e3 = "string" != typeof e3 ? -e3 : e3, t4), this) : -this.utcOffset(); }), i.isDSTShifted = e("isDSTShifted is deprecated. See http://momentjs.com/guides/#/warnings/dst-shifted/ for more information", function() { if (!o(this._isDSTShifted)) return this._isDSTShifted; var e3, t4 = {}; return $(t4, this), (t4 = Nt(t4))._a ? (e3 = (t4._isUTC ? l : W)(t4._a), this._isDSTShifted = this.isValid() && 0 < function(e4, t5, n2) { for (var s3 = Math.min(e4.length, t5.length), i2 = Math.abs(e4.length - t5.length), r2 = 0, a3 = 0; a3 < s3; a3++) (n2 && e4[a3] !== t5[a3] || !n2 && g(e4[a3]) !== g(t5[a3])) && r2++; return r2 + i2; }(t4._a, e3.toArray())) : this._isDSTShifted = false, this._isDSTShifted; }); w2 = K2.prototype; function cn(e3, t4, n2, s3) { var i2 = mt(), s3 = l().set(s3, t4); return i2[n2](s3, e3); } function fn(e3, t4, n2) { if (u2(e3) && (t4 = e3, e3 = void 0), e3 = e3 || "", null != t4) return cn(e3, t4, n2, "month"); for (var s3 = [], i2 = 0; i2 < 12; i2++) s3[i2] = cn(e3, i2, n2, "month"); return s3; } function mn(e3, t4, n2, s3) { t4 = ("boolean" == typeof e3 ? u2(t4) && (n2 = t4, t4 = void 0) : (t4 = e3, e3 = false, u2(n2 = t4) && (n2 = t4, t4 = void 0)), t4 || ""); var i2, r2 = mt(), a3 = e3 ? r2._week.dow : 0, o2 = []; if (null != n2) return cn(t4, (n2 + a3) % 7, s3, "day"); for (i2 = 0; i2 < 7; i2++) o2[i2] = cn(t4, (i2 + a3) % 7, s3, "day"); return o2; } w2.calendar = function(e3, t4, n2) { return d(e3 = this._calendar[e3] || this._calendar.sameElse) ? e3.call(t4, n2) : e3; }, w2.longDateFormat = function(e3) { var t4 = this._longDateFormat[e3], n2 = this._longDateFormat[e3.toUpperCase()]; return t4 || !n2 ? t4 : (this._longDateFormat[e3] = n2.match(te).map(function(e4) { return "MMMM" === e4 || "MM" === e4 || "DD" === e4 || "dddd" === e4 ? e4.slice(1) : e4; }).join(""), this._longDateFormat[e3]); }, w2.invalidDate = function() { return this._invalidDate; }, w2.ordinal = function(e3) { return this._ordinal.replace("%d", e3); }, w2.preparse = dn, w2.postformat = dn, w2.relativeTime = function(e3, t4, n2, s3) { var i2 = this._relativeTime[n2]; return d(i2) ? i2(e3, t4, n2, s3) : i2.replace(/%d/i, e3); }, w2.pastFuture = function(e3, t4) { return d(e3 = this._relativeTime[0 < e3 ? "future" : "past"]) ? e3(t4) : e3.replace(/%s/i, t4); }, w2.set = function(e3) { var t4, n2; for (n2 in e3) c2(e3, n2) && (d(t4 = e3[n2]) ? this[n2] = t4 : this["_" + n2] = t4); this._config = e3, this._dayOfMonthOrdinalParseLenient = new RegExp((this._dayOfMonthOrdinalParse.source || this._ordinalParse.source) + "|" + /\d{1,2}/.source); }, w2.eras = function(e3, t4) { for (var n2, s3 = this._eras || mt("en")._eras, i2 = 0, r2 = s3.length; i2 < r2; ++i2) { switch (typeof s3[i2].since) { case "string": n2 = f(s3[i2].since).startOf("day"), s3[i2].since = n2.valueOf(); break; } switch (typeof s3[i2].until) { case "undefined": s3[i2].until = 1 / 0; break; case "string": n2 = f(s3[i2].until).startOf("day").valueOf(), s3[i2].until = n2.valueOf(); break; } } return s3; }, w2.erasParse = function(e3, t4, n2) { var s3, i2, r2, a3, o2, u3 = this.eras(); for (e3 = e3.toUpperCase(), s3 = 0, i2 = u3.length; s3 < i2; ++s3) if (r2 = u3[s3].name.toUpperCase(), a3 = u3[s3].abbr.toUpperCase(), o2 = u3[s3].narrow.toUpperCase(), n2) switch (t4) { case "N": case "NN": case "NNN": if (a3 === e3) return u3[s3]; break; case "NNNN": if (r2 === e3) return u3[s3]; break; case "NNNNN": if (o2 === e3) return u3[s3]; break; } else if (0 <= [r2, a3, o2].indexOf(e3)) return u3[s3]; }, w2.erasConvertYear = function(e3, t4) { var n2 = e3.since <= e3.until ? 1 : -1; return void 0 === t4 ? f(e3.since).year() : f(e3.since).year() + (t4 - e3.offset) * n2; }, w2.erasAbbrRegex = function(e3) { return c2(this, "_erasAbbrRegex") || an.call(this), e3 ? this._erasAbbrRegex : this._erasRegex; }, w2.erasNameRegex = function(e3) { return c2(this, "_erasNameRegex") || an.call(this), e3 ? this._erasNameRegex : this._erasRegex; }, w2.erasNarrowRegex = function(e3) { return c2(this, "_erasNarrowRegex") || an.call(this), e3 ? this._erasNarrowRegex : this._erasRegex; }, w2.months = function(e3, t4) { return e3 ? (a2(this._months) ? this._months : this._months[(this._months.isFormat || He).test(t4) ? "format" : "standalone"])[e3.month()] : a2(this._months) ? this._months : this._months.standalone; }, w2.monthsShort = function(e3, t4) { return e3 ? (a2(this._monthsShort) ? this._monthsShort : this._monthsShort[He.test(t4) ? "format" : "standalone"])[e3.month()] : a2(this._monthsShort) ? this._monthsShort : this._monthsShort.standalone; }, w2.monthsParse = function(e3, t4, n2) { var s3, i2; if (this._monthsParseExact) return function(e4, t5, n3) { var s4, i3, r2, e4 = e4.toLocaleLowerCase(); if (!this._monthsParse) for (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = [], s4 = 0; s4 < 12; ++s4) r2 = l([2e3, s4]), this._shortMonthsParse[s4] = this.monthsShort(r2, "").toLocaleLowerCase(), this._longMonthsParse[s4] = this.months(r2, "").toLocaleLowerCase(); return n3 ? "MMM" === t5 ? -1 !== (i3 = S.call(this._shortMonthsParse, e4)) ? i3 : null : -1 !== (i3 = S.call(this._longMonthsParse, e4)) ? i3 : null : "MMM" === t5 ? -1 !== (i3 = S.call(this._shortMonthsParse, e4)) || -1 !== (i3 = S.call(this._longMonthsParse, e4)) ? i3 : null : -1 !== (i3 = S.call(this._longMonthsParse, e4)) || -1 !== (i3 = S.call(this._shortMonthsParse, e4)) ? i3 : null; }.call(this, e3, t4, n2); for (this._monthsParse || (this._monthsParse = [], this._longMonthsParse = [], this._shortMonthsParse = []), s3 = 0; s3 < 12; s3++) { if (i2 = l([2e3, s3]), n2 && !this._longMonthsParse[s3] && (this._longMonthsParse[s3] = new RegExp("^" + this.months(i2, "").replace(".", "") + "$", "i"), this._shortMonthsParse[s3] = new RegExp("^" + this.monthsShort(i2, "").replace(".", "") + "$", "i")), n2 || this._monthsParse[s3] || (i2 = "^" + this.months(i2, "") + "|^" + this.monthsShort(i2, ""), this._monthsParse[s3] = new RegExp(i2.replace(".", ""), "i")), n2 && "MMMM" === t4 && this._longMonthsParse[s3].test(e3)) return s3; if (n2 && "MMM" === t4 && this._shortMonthsParse[s3].test(e3)) return s3; if (!n2 && this._monthsParse[s3].test(e3)) return s3; } }, w2.monthsRegex = function(e3) { return this._monthsParseExact ? (c2(this, "_monthsRegex") || Ee.call(this), e3 ? this._monthsStrictRegex : this._monthsRegex) : (c2(this, "_monthsRegex") || (this._monthsRegex = Le), this._monthsStrictRegex && e3 ? this._monthsStrictRegex : this._monthsRegex); }, w2.monthsShortRegex = function(e3) { return this._monthsParseExact ? (c2(this, "_monthsRegex") || Ee.call(this), e3 ? this._monthsShortStrictRegex : this._monthsShortRegex) : (c2(this, "_monthsShortRegex") || (this._monthsShortRegex = Fe), this._monthsShortStrictRegex && e3 ? this._monthsShortStrictRegex : this._monthsShortRegex); }, w2.week = function(e3) { return qe(e3, this._week.dow, this._week.doy).week; }, w2.firstDayOfYear = function() { return this._week.doy; }, w2.firstDayOfWeek = function() { return this._week.dow; }, w2.weekdays = function(e3, t4) { return t4 = a2(this._weekdays) ? this._weekdays : this._weekdays[e3 && true !== e3 && this._weekdays.isFormat.test(t4) ? "format" : "standalone"], true === e3 ? Be(t4, this._week.dow) : e3 ? t4[e3.day()] : t4; }, w2.weekdaysMin = function(e3) { return true === e3 ? Be(this._weekdaysMin, this._week.dow) : e3 ? this._weekdaysMin[e3.day()] : this._weekdaysMin; }, w2.weekdaysShort = function(e3) { return true === e3 ? Be(this._weekdaysShort, this._week.dow) : e3 ? this._weekdaysShort[e3.day()] : this._weekdaysShort; }, w2.weekdaysParse = function(e3, t4, n2) { var s3, i2; if (this._weekdaysParseExact) return function(e4, t5, n3) { var s4, i3, r2, e4 = e4.toLocaleLowerCase(); if (!this._weekdaysParse) for (this._weekdaysParse = [], this._shortWeekdaysParse = [], this._minWeekdaysParse = [], s4 = 0; s4 < 7; ++s4) r2 = l([2e3, 1]).day(s4), this._minWeekdaysParse[s4] = this.weekdaysMin(r2, "").toLocaleLowerCase(), this._shortWeekdaysParse[s4] = this.weekdaysShort(r2, "").toLocaleLowerCase(), this._weekdaysParse[s4] = this.weekdays(r2, "").toLocaleLowerCase(); return n3 ? "dddd" === t5 ? -1 !== (i3 = S.call(this._weekdaysParse, e4)) ? i3 : null : "ddd" === t5 ? -1 !== (i3 = S.call(this._shortWeekdaysParse, e4)) ? i3 : null : -1 !== (i3 = S.call(this._minWeekdaysParse, e4)) ? i3 : null : "dddd" === t5 ? -1 !== (i3 = S.call(this._weekdaysParse, e4)) || -1 !== (i3 = S.call(this._shortWeekdaysParse, e4)) || -1 !== (i3 = S.call(this._minWeekdaysParse, e4)) ? i3 : null : "ddd" === t5 ? -1 !== (i3 = S.call(this._shortWeekdaysParse, e4)) || -1 !== (i3 = S.call(this._weekdaysParse, e4)) || -1 !== (i3 = S.call(this._minWeekdaysParse, e4)) ? i3 : null : -1 !== (i3 = S.call(this._minWeekdaysParse, e4)) || -1 !== (i3 = S.call(this._weekdaysParse, e4)) || -1 !== (i3 = S.call(this._shortWeekdaysParse, e4)) ? i3 : null; }.call(this, e3, t4, n2); for (this._weekdaysParse || (this._weekdaysParse = [], this._minWeekdaysParse = [], this._shortWeekdaysParse = [], this._fullWeekdaysParse = []), s3 = 0; s3 < 7; s3++) { if (i2 = l([2e3, 1]).day(s3), n2 && !this._fullWeekdaysParse[s3] && (this._fullWeekdaysParse[s3] = new RegExp("^" + this.weekdays(i2, "").replace(".", "\\.?") + "$", "i"), this._shortWeekdaysParse[s3] = new RegExp("^" + this.weekdaysShort(i2, "").replace(".", "\\.?") + "$", "i"), this._minWeekdaysParse[s3] = new RegExp("^" + this.weekdaysMin(i2, "").replace(".", "\\.?") + "$", "i")), this._weekdaysParse[s3] || (i2 = "^" + this.weekdays(i2, "") + "|^" + this.weekdaysShort(i2, "") + "|^" + this.weekdaysMin(i2, ""), this._weekdaysParse[s3] = new RegExp(i2.replace(".", ""), "i")), n2 && "dddd" === t4 && this._fullWeekdaysParse[s3].test(e3)) return s3; if (n2 && "ddd" === t4 && this._shortWeekdaysParse[s3].test(e3)) return s3; if (n2 && "dd" === t4 && this._minWeekdaysParse[s3].test(e3)) return s3; if (!n2 && this._weekdaysParse[s3].test(e3)) return s3; } }, w2.weekdaysRegex = function(e3) { return this._weekdaysParseExact ? (c2(this, "_weekdaysRegex") || nt.call(this), e3 ? this._weekdaysStrictRegex : this._weekdaysRegex) : (c2(this, "_weekdaysRegex") || (this._weekdaysRegex = Ke), this._weekdaysStrictRegex && e3 ? this._weekdaysStrictRegex : this._weekdaysRegex); }, w2.weekdaysShortRegex = function(e3) { return this._weekdaysParseExact ? (c2(this, "_weekdaysRegex") || nt.call(this), e3 ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex) : (c2(this, "_weekdaysShortRegex") || (this._weekdaysShortRegex = et), this._weekdaysShortStrictRegex && e3 ? this._weekdaysShortStrictRegex : this._weekdaysShortRegex); }, w2.weekdaysMinRegex = function(e3) { return this._weekdaysParseExact ? (c2(this, "_weekdaysRegex") || nt.call(this), e3 ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex) : (c2(this, "_weekdaysMinRegex") || (this._weekdaysMinRegex = tt), this._weekdaysMinStrictRegex && e3 ? this._weekdaysMinStrictRegex : this._weekdaysMinRegex); }, w2.isPM = function(e3) { return "p" === (e3 + "").toLowerCase().charAt(0); }, w2.meridiem = function(e3, t4, n2) { return 11 < e3 ? n2 ? "pm" : "PM" : n2 ? "am" : "AM"; }, ct("en", { eras: [{ since: "0001-01-01", until: 1 / 0, offset: 1, name: "Anno Domini", narrow: "AD", abbr: "AD" }, { since: "0000-12-31", until: -1 / 0, offset: 1, name: "Before Christ", narrow: "BC", abbr: "BC" }], dayOfMonthOrdinalParse: /\d{1,2}(th|st|nd|rd)/, ordinal: function(e3) { var t4 = e3 % 10; return e3 + (1 === g(e3 % 100 / 10) ? "th" : 1 == t4 ? "st" : 2 == t4 ? "nd" : 3 == t4 ? "rd" : "th"); } }), f.lang = e("moment.lang is deprecated. Use moment.locale instead.", ct), f.langData = e("moment.langData is deprecated. Use moment.localeData instead.", mt); var _n = Math.abs; function yn(e3, t4, n2, s3) { t4 = C3(t4, n2); return e3._milliseconds += s3 * t4._milliseconds, e3._days += s3 * t4._days, e3._months += s3 * t4._months, e3._bubble(); } function gn(e3) { return e3 < 0 ? Math.floor(e3) : Math.ceil(e3); } function wn(e3) { return 4800 * e3 / 146097; } function pn(e3) { return 146097 * e3 / 4800; } function kn(e3) { return function() { return this.as(e3); }; } pe = kn("ms"), me = kn("s"), Ce = kn("m"), we = kn("h"), ge = kn("d"), Je = kn("w"), k2 = kn("M"), _e = kn("Q"), ve = kn("y"); function vn(e3) { return function() { return this.isValid() ? this._data[e3] : NaN; }; } var ye = vn("milliseconds"), ke = vn("seconds"), Ie = vn("minutes"), w2 = vn("hours"), Mn = vn("days"), Dn = vn("months"), Sn = vn("years"); var Yn2 = Math.round, On = { ss: 44, s: 45, m: 45, h: 22, d: 26, w: null, M: 11 }; function bn(e3, t4, n2, s3) { var i2 = C3(e3).abs(), r2 = Yn2(i2.as("s")), a3 = Yn2(i2.as("m")), o2 = Yn2(i2.as("h")), u3 = Yn2(i2.as("d")), l2 = Yn2(i2.as("M")), h2 = Yn2(i2.as("w")), i2 = Yn2(i2.as("y")), r2 = (r2 <= n2.ss ? ["s", r2] : r2 < n2.s && ["ss", r2]) || a3 <= 1 && ["m"] || a3 < n2.m && ["mm", a3] || o2 <= 1 && ["h"] || o2 < n2.h && ["hh", o2] || u3 <= 1 && ["d"] || u3 < n2.d && ["dd", u3]; return (r2 = (r2 = null != n2.w ? r2 || h2 <= 1 && ["w"] || h2 < n2.w && ["ww", h2] : r2) || l2 <= 1 && ["M"] || l2 < n2.M && ["MM", l2] || i2 <= 1 && ["y"] || ["yy", i2])[2] = t4, r2[3] = 0 < +e3, r2[4] = s3, function(e4, t5, n3, s4, i3) { return i3.relativeTime(t5 || 1, !!n3, e4, s4); }.apply(null, r2); } var xn = Math.abs; function Tn(e3) { return (0 < e3) - (e3 < 0) || +e3; } function Nn() { if (!this.isValid()) return this.localeData().invalidDate(); var e3, t4, n2, s3, i2, r2, a3, o2 = xn(this._milliseconds) / 1e3, u3 = xn(this._days), l2 = xn(this._months), h2 = this.asSeconds(); return h2 ? (e3 = y2(o2 / 60), t4 = y2(e3 / 60), o2 %= 60, e3 %= 60, n2 = y2(l2 / 12), l2 %= 12, s3 = o2 ? o2.toFixed(3).replace(/\.?0+$/, "") : "", i2 = Tn(this._months) !== Tn(h2) ? "-" : "", r2 = Tn(this._days) !== Tn(h2) ? "-" : "", a3 = Tn(this._milliseconds) !== Tn(h2) ? "-" : "", (h2 < 0 ? "-" : "") + "P" + (n2 ? i2 + n2 + "Y" : "") + (l2 ? i2 + l2 + "M" : "") + (u3 ? r2 + u3 + "D" : "") + (t4 || e3 || o2 ? "T" : "") + (t4 ? a3 + t4 + "H" : "") + (e3 ? a3 + e3 + "M" : "") + (o2 ? a3 + s3 + "S" : "")) : "P0D"; } var U = Ct.prototype; return U.isValid = function() { return this._isValid; }, U.abs = function() { var e3 = this._data; return this._milliseconds = _n(this._milliseconds), this._days = _n(this._days), this._months = _n(this._months), e3.milliseconds = _n(e3.milliseconds), e3.seconds = _n(e3.seconds), e3.minutes = _n(e3.minutes), e3.hours = _n(e3.hours), e3.months = _n(e3.months), e3.years = _n(e3.years), this; }, U.add = function(e3, t4) { return yn(this, e3, t4, 1); }, U.subtract = function(e3, t4) { return yn(this, e3, t4, -1); }, U.as = function(e3) { if (!this.isValid()) return NaN; var t4, n2, s3 = this._milliseconds; if ("month" === (e3 = _2(e3)) || "quarter" === e3 || "year" === e3) switch (t4 = this._days + s3 / 864e5, n2 = this._months + wn(t4), e3) { case "month": return n2; case "quarter": return n2 / 3; case "year": return n2 / 12; } else switch (t4 = this._days + Math.round(pn(this._months)), e3) { case "week": return t4 / 7 + s3 / 6048e5; case "day": return t4 + s3 / 864e5; case "hour": return 24 * t4 + s3 / 36e5; case "minute": return 1440 * t4 + s3 / 6e4; case "second": return 86400 * t4 + s3 / 1e3; case "millisecond": return Math.floor(864e5 * t4) + s3; default: throw new Error("Unknown unit " + e3); } }, U.asMilliseconds = pe, U.asSeconds = me, U.asMinutes = Ce, U.asHours = we, U.asDays = ge, U.asWeeks = Je, U.asMonths = k2, U.asQuarters = _e, U.asYears = ve, U.valueOf = function() { return this.isValid() ? this._milliseconds + 864e5 * this._days + this._months % 12 * 2592e6 + 31536e6 * g(this._months / 12) : NaN; }, U._bubble = function() { var e3 = this._milliseconds, t4 = this._days, n2 = this._months, s3 = this._data; return 0 <= e3 && 0 <= t4 && 0 <= n2 || e3 <= 0 && t4 <= 0 && n2 <= 0 || (e3 += 864e5 * gn(pn(n2) + t4), n2 = t4 = 0), s3.milliseconds = e3 % 1e3, e3 = y2(e3 / 1e3), s3.seconds = e3 % 60, e3 = y2(e3 / 60), s3.minutes = e3 % 60, e3 = y2(e3 / 60), s3.hours = e3 % 24, t4 += y2(e3 / 24), n2 += e3 = y2(wn(t4)), t4 -= gn(pn(e3)), e3 = y2(n2 / 12), n2 %= 12, s3.days = t4, s3.months = n2, s3.years = e3, this; }, U.clone = function() { return C3(this); }, U.get = function(e3) { return e3 = _2(e3), this.isValid() ? this[e3 + "s"]() : NaN; }, U.milliseconds = ye, U.seconds = ke, U.minutes = Ie, U.hours = w2, U.days = Mn, U.weeks = function() { return y2(this.days() / 7); }, U.months = Dn, U.years = Sn, U.humanize = function(e3, t4) { if (!this.isValid()) return this.localeData().invalidDate(); var n2 = false, s3 = On; return "object" == typeof e3 && (t4 = e3, e3 = false), "boolean" == typeof e3 && (n2 = e3), "object" == typeof t4 && (s3 = Object.assign({}, On, t4), null != t4.s && null == t4.ss && (s3.ss = t4.s - 1)), e3 = this.localeData(), t4 = bn(this, !n2, s3, e3), n2 && (t4 = e3.pastFuture(+this, t4)), e3.postformat(t4); }, U.toISOString = Nn, U.toString = Nn, U.toJSON = Nn, U.locale = Xt, U.localeData = Kt, U.toIsoString = e("toIsoString() is deprecated. Please use toISOString() instead (notice the capitals)", Nn), U.lang = Xe, s2("X", 0, 0, "unix"), s2("x", 0, 0, "valueOf"), v("x", De), v("X", /[+-]?\d+(\.\d{1,3})?/), D2("X", function(e3, t4, n2) { n2._d = new Date(1e3 * parseFloat(e3)); }), D2("x", function(e3, t4, n2) { n2._d = new Date(g(e3)); }), f.version = "2.29.4", H = W, f.fn = i, f.min = function() { return Rt("isBefore", [].slice.call(arguments, 0)); }, f.max = function() { return Rt("isAfter", [].slice.call(arguments, 0)); }, f.now = function() { return Date.now ? Date.now() : +new Date(); }, f.utc = l, f.unix = function(e3) { return W(1e3 * e3); }, f.months = function(e3, t4) { return fn(e3, t4, "months"); }, f.isDate = V, f.locale = ct, f.invalid = I, f.duration = C3, f.isMoment = h, f.weekdays = function(e3, t4, n2) { return mn(e3, t4, n2, "weekdays"); }, f.parseZone = function() { return W.apply(null, arguments).parseZone(); }, f.localeData = mt, f.isDuration = Ut, f.monthsShort = function(e3, t4) { return fn(e3, t4, "monthsShort"); }, f.weekdaysMin = function(e3, t4, n2) { return mn(e3, t4, n2, "weekdaysMin"); }, f.defineLocale = ft, f.updateLocale = function(e3, t4) { var n2, s3; return null != t4 ? (s3 = ot, null != R[e3] && null != R[e3].parentLocale ? R[e3].set(X3(R[e3]._config, t4)) : (t4 = X3(s3 = null != (n2 = dt(e3)) ? n2._config : s3, t4), null == n2 && (t4.abbr = e3), (s3 = new K2(t4)).parentLocale = R[e3], R[e3] = s3), ct(e3)) : null != R[e3] && (null != R[e3].parentLocale ? (R[e3] = R[e3].parentLocale, e3 === ct() && ct(e3)) : null != R[e3] && delete R[e3]), R[e3]; }, f.locales = function() { return ee(R); }, f.weekdaysShort = function(e3, t4, n2) { return mn(e3, t4, n2, "weekdaysShort"); }, f.normalizeUnits = _2, f.relativeTimeRounding = function(e3) { return void 0 === e3 ? Yn2 : "function" == typeof e3 && (Yn2 = e3, true); }, f.relativeTimeThreshold = function(e3, t4) { return void 0 !== On[e3] && (void 0 === t4 ? On[e3] : (On[e3] = t4, "s" === e3 && (On.ss = t4 - 1), true)); }, f.calendarFormat = function(e3, t4) { return (e3 = e3.diff(t4, "days", true)) < -6 ? "sameElse" : e3 < -1 ? "lastWeek" : e3 < 0 ? "lastDay" : e3 < 1 ? "sameDay" : e3 < 2 ? "nextDay" : e3 < 7 ? "nextWeek" : "sameElse"; }, f.prototype = i, f.HTML5_FMT = { DATETIME_LOCAL: "YYYY-MM-DDTHH:mm", DATETIME_LOCAL_SECONDS: "YYYY-MM-DDTHH:mm:ss", DATETIME_LOCAL_MS: "YYYY-MM-DDTHH:mm:ss.SSS", DATE: "YYYY-MM-DD", TIME: "HH:mm", TIME_SECONDS: "HH:mm:ss", TIME_MS: "HH:mm:ss.SSS", WEEK: "GGGG-[W]WW", MONTH: "YYYY-MM" }, f; }); })(moment_min); const moment = moment_min.exports; const LEVELS = { trace: 0, debug: 1, info: 2, warn: 3, error: 4, fatal: 5 }; const log$3 = { trace: (..._args) => { }, debug: (..._args) => { }, info: (..._args) => { }, warn: (..._args) => { }, error: (..._args) => { }, fatal: (..._args) => { } }; const setLogLevel$1 = function(level = "fatal") { let numericLevel = LEVELS.fatal; if (typeof level === "string") { level = level.toLowerCase(); if (level in LEVELS) { numericLevel = LEVELS[level]; } } else if (typeof level === "number") { numericLevel = level; } log$3.trace = () => { }; log$3.debug = () => { }; log$3.info = () => { }; log$3.warn = () => { }; log$3.error = () => { }; log$3.fatal = () => { }; if (numericLevel <= LEVELS.fatal) { log$3.fatal = console.error ? console.error.bind(console, format$1("FATAL"), "color: orange") : console.log.bind(console, "\x1B[35m", format$1("FATAL")); } if (numericLevel <= LEVELS.error) { log$3.error = console.error ? console.error.bind(console, format$1("ERROR"), "color: orange") : console.log.bind(console, "\x1B[31m", format$1("ERROR")); } if (numericLevel <= LEVELS.warn) { log$3.warn = console.warn ? console.warn.bind(console, format$1("WARN"), "color: orange") : console.log.bind(console, `\x1B[33m`, format$1("WARN")); } if (numericLevel <= LEVELS.info) { log$3.info = console.info ? console.info.bind(console, format$1("INFO"), "color: lightblue") : console.log.bind(console, "\x1B[34m", format$1("INFO")); } if (numericLevel <= LEVELS.debug) { log$3.debug = console.debug ? console.debug.bind(console, format$1("DEBUG"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format$1("DEBUG")); } if (numericLevel <= LEVELS.trace) { log$3.trace = console.debug ? console.debug.bind(console, format$1("TRACE"), "color: lightgreen") : console.log.bind(console, "\x1B[32m", format$1("TRACE")); } }; const format$1 = (level) => { const time2 = moment().format("ss.SSS"); return `%c${time2} : ${level} : `; }; var dist$1 = {}; Object.defineProperty(dist$1, "__esModule", { value: true }); var sanitizeUrl_1 = dist$1.sanitizeUrl = void 0; var invalidProtocolRegex = /^([^\w]*)(javascript|data|vbscript)/im; var htmlEntitiesRegex = /&#(\w+)(^\w|;)?/g; var ctrlCharactersRegex = /[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/gim; var urlSchemeRegex = /^([^:]+):/gm; var relativeFirstCharacters = [".", "/"]; function isRelativeUrlWithoutProtocol(url) { return relativeFirstCharacters.indexOf(url[0]) > -1; } function decodeHtmlCharacters(str) { return str.replace(htmlEntitiesRegex, function(match, dec) { return String.fromCharCode(dec); }); } function sanitizeUrl(url) { var sanitizedUrl = decodeHtmlCharacters(url || "").replace(ctrlCharactersRegex, "").trim(); if (!sanitizedUrl) { return "about:blank"; } if (isRelativeUrlWithoutProtocol(sanitizedUrl)) { return sanitizedUrl; } var urlSchemeParseResults = sanitizedUrl.match(urlSchemeRegex); if (!urlSchemeParseResults) { return sanitizedUrl; } var urlScheme = urlSchemeParseResults[0]; if (invalidProtocolRegex.test(urlScheme)) { return "about:blank"; } return sanitizedUrl; } sanitizeUrl_1 = dist$1.sanitizeUrl = sanitizeUrl; function ascending$3(a2, b) { return a2 == null || b == null ? NaN : a2 < b ? -1 : a2 > b ? 1 : a2 >= b ? 0 : NaN; } function descending$2(a2, b) { return a2 == null || b == null ? NaN : b < a2 ? -1 : b > a2 ? 1 : b >= a2 ? 0 : NaN; } function bisector(f) { let compare1, compare2, delta; if (f.length !== 2) { compare1 = ascending$3; compare2 = (d, x2) => ascending$3(f(d), x2); delta = (d, x2) => f(d) - x2; } else { compare1 = f === ascending$3 || f === descending$2 ? f : zero$1; compare2 = f; delta = f; } function left2(a2, x2, lo = 0, hi = a2.length) { if (lo < hi) { if (compare1(x2, x2) !== 0) return hi; do { const mid = lo + hi >>> 1; if (compare2(a2[mid], x2) < 0) lo = mid + 1; else hi = mid; } while (lo < hi); } return lo; } function right2(a2, x2, lo = 0, hi = a2.length) { if (lo < hi) { if (compare1(x2, x2) !== 0) return hi; do { const mid = lo + hi >>> 1; if (compare2(a2[mid], x2) <= 0) lo = mid + 1; else hi = mid; } while (lo < hi); } return lo; } function center2(a2, x2, lo = 0, hi = a2.length) { const i = left2(a2, x2, lo, hi - 1); return i > lo && delta(a2[i - 1], x2) > -delta(a2[i], x2) ? i - 1 : i; } return { left: left2, center: center2, right: right2 }; } function zero$1() { return 0; } function number$3(x2) { return x2 === null ? NaN : +x2; } function* numbers(values, valueof) { if (valueof === void 0) { for (let value of values) { if (value != null && (value = +value) >= value) { yield value; } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { yield value; } } } } const ascendingBisect = bisector(ascending$3); const bisectRight = ascendingBisect.right; const bisectLeft = ascendingBisect.left; const bisectCenter = bisector(number$3).center; const bisect = bisectRight; function blur(values, r) { if (!((r = +r) >= 0)) throw new RangeError("invalid r"); let length2 = values.length; if (!((length2 = Math.floor(length2)) >= 0)) throw new RangeError("invalid length"); if (!length2 || !r) return values; const blur3 = blurf(r); const temp = values.slice(); blur3(values, temp, 0, length2, 1); blur3(temp, values, 0, length2, 1); blur3(values, temp, 0, length2, 1); return values; } const blur2 = Blur2(blurf); const blurImage = Blur2(blurfImage); function Blur2(blur3) { return function(data, rx, ry = rx) { if (!((rx = +rx) >= 0)) throw new RangeError("invalid rx"); if (!((ry = +ry) >= 0)) throw new RangeError("invalid ry"); let { data: values, width: width2, height: height2 } = data; if (!((width2 = Math.floor(width2)) >= 0)) throw new RangeError("invalid width"); if (!((height2 = Math.floor(height2 !== void 0 ? height2 : values.length / width2)) >= 0)) throw new RangeError("invalid height"); if (!width2 || !height2 || !rx && !ry) return data; const blurx = rx && blur3(rx); const blury = ry && blur3(ry); const temp = values.slice(); if (blurx && blury) { blurh(blurx, temp, values, width2, height2); blurh(blurx, values, temp, width2, height2); blurh(blurx, temp, values, width2, height2); blurv(blury, values, temp, width2, height2); blurv(blury, temp, values, width2, height2); blurv(blury, values, temp, width2, height2); } else if (blurx) { blurh(blurx, values, temp, width2, height2); blurh(blurx, temp, values, width2, height2); blurh(blurx, values, temp, width2, height2); } else if (blury) { blurv(blury, values, temp, width2, height2); blurv(blury, temp, values, width2, height2); blurv(blury, values, temp, width2, height2); } return data; }; } function blurh(blur3, T, S, w2, h) { for (let y2 = 0, n = w2 * h; y2 < n; ) { blur3(T, S, y2, y2 += w2, 1); } } function blurv(blur3, T, S, w2, h) { for (let x2 = 0, n = w2 * h; x2 < w2; ++x2) { blur3(T, S, x2, x2 + n, w2); } } function blurfImage(radius) { const blur3 = blurf(radius); return (T, S, start2, stop, step) => { start2 <<= 2, stop <<= 2, step <<= 2; blur3(T, S, start2 + 0, stop + 0, step); blur3(T, S, start2 + 1, stop + 1, step); blur3(T, S, start2 + 2, stop + 2, step); blur3(T, S, start2 + 3, stop + 3, step); }; } function blurf(radius) { const radius0 = Math.floor(radius); if (radius0 === radius) return bluri(radius); const t = radius - radius0; const w2 = 2 * radius + 1; return (T, S, start2, stop, step) => { if (!((stop -= step) >= start2)) return; let sum2 = radius0 * S[start2]; const s0 = step * radius0; const s1 = s0 + step; for (let i = start2, j = start2 + s0; i < j; i += step) { sum2 += S[Math.min(stop, i)]; } for (let i = start2, j = stop; i <= j; i += step) { sum2 += S[Math.min(stop, i + s0)]; T[i] = (sum2 + t * (S[Math.max(start2, i - s1)] + S[Math.min(stop, i + s1)])) / w2; sum2 -= S[Math.max(start2, i - s0)]; } }; } function bluri(radius) { const w2 = 2 * radius + 1; return (T, S, start2, stop, step) => { if (!((stop -= step) >= start2)) return; let sum2 = radius * S[start2]; const s2 = step * radius; for (let i = start2, j = start2 + s2; i < j; i += step) { sum2 += S[Math.min(stop, i)]; } for (let i = start2, j = stop; i <= j; i += step) { sum2 += S[Math.min(stop, i + s2)]; T[i] = sum2 / w2; sum2 -= S[Math.max(start2, i - s2)]; } }; } function count$1(values, valueof) { let count2 = 0; if (valueof === void 0) { for (let value of values) { if (value != null && (value = +value) >= value) { ++count2; } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { ++count2; } } } return count2; } function length$4(array2) { return array2.length | 0; } function empty$2(length2) { return !(length2 > 0); } function arrayify(values) { return typeof values !== "object" || "length" in values ? values : Array.from(values); } function reducer(reduce2) { return (values) => reduce2(...values); } function cross$3(...values) { const reduce2 = typeof values[values.length - 1] === "function" && reducer(values.pop()); values = values.map(arrayify); const lengths = values.map(length$4); const j = values.length - 1; const index2 = new Array(j + 1).fill(0); const product = []; if (j < 0 || lengths.some(empty$2)) return product; while (true) { product.push(index2.map((j2, i2) => values[i2][j2])); let i = j; while (++index2[i] === lengths[i]) { if (i === 0) return reduce2 ? product.map(reduce2) : product; index2[i--] = 0; } } } function cumsum(values, valueof) { var sum2 = 0, index2 = 0; return Float64Array.from(values, valueof === void 0 ? (v) => sum2 += +v || 0 : (v) => sum2 += +valueof(v, index2++, values) || 0); } function variance(values, valueof) { let count2 = 0; let delta; let mean2 = 0; let sum2 = 0; if (valueof === void 0) { for (let value of values) { if (value != null && (value = +value) >= value) { delta = value - mean2; mean2 += delta / ++count2; sum2 += delta * (value - mean2); } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { delta = value - mean2; mean2 += delta / ++count2; sum2 += delta * (value - mean2); } } } if (count2 > 1) return sum2 / (count2 - 1); } function deviation(values, valueof) { const v = variance(values, valueof); return v ? Math.sqrt(v) : v; } function extent$1(values, valueof) { let min2; let max2; if (valueof === void 0) { for (const value of values) { if (value != null) { if (min2 === void 0) { if (value >= value) min2 = max2 = value; } else { if (min2 > value) min2 = value; if (max2 < value) max2 = value; } } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null) { if (min2 === void 0) { if (value >= value) min2 = max2 = value; } else { if (min2 > value) min2 = value; if (max2 < value) max2 = value; } } } } return [min2, max2]; } class Adder { constructor() { this._partials = new Float64Array(32); this._n = 0; } add(x2) { const p = this._partials; let i = 0; for (let j = 0; j < this._n && j < 32; j++) { const y2 = p[j], hi = x2 + y2, lo = Math.abs(x2) < Math.abs(y2) ? x2 - (hi - y2) : y2 - (hi - x2); if (lo) p[i++] = lo; x2 = hi; } p[i] = x2; this._n = i + 1; return this; } valueOf() { const p = this._partials; let n = this._n, x2, y2, lo, hi = 0; if (n > 0) { hi = p[--n]; while (n > 0) { x2 = hi; y2 = p[--n]; hi = x2 + y2; lo = y2 - (hi - x2); if (lo) break; } if (n > 0 && (lo < 0 && p[n - 1] < 0 || lo > 0 && p[n - 1] > 0)) { y2 = lo * 2; x2 = hi + y2; if (y2 == x2 - hi) hi = x2; } } return hi; } } function fsum(values, valueof) { const adder = new Adder(); if (valueof === void 0) { for (let value of values) { if (value = +value) { adder.add(value); } } } else { let index2 = -1; for (let value of values) { if (value = +valueof(value, ++index2, values)) { adder.add(value); } } } return +adder; } function fcumsum(values, valueof) { const adder = new Adder(); let index2 = -1; return Float64Array.from( values, valueof === void 0 ? (v) => adder.add(+v || 0) : (v) => adder.add(+valueof(v, ++index2, values) || 0) ); } class InternMap extends Map { constructor(entries, key = keyof) { super(); Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } }); if (entries != null) for (const [key2, value] of entries) this.set(key2, value); } get(key) { return super.get(intern_get(this, key)); } has(key) { return super.has(intern_get(this, key)); } set(key, value) { return super.set(intern_set(this, key), value); } delete(key) { return super.delete(intern_delete(this, key)); } } class InternSet extends Set { constructor(values, key = keyof) { super(); Object.defineProperties(this, { _intern: { value: /* @__PURE__ */ new Map() }, _key: { value: key } }); if (values != null) for (const value of values) this.add(value); } has(value) { return super.has(intern_get(this, value)); } add(value) { return super.add(intern_set(this, value)); } delete(value) { return super.delete(intern_delete(this, value)); } } function intern_get({ _intern, _key }, value) { const key = _key(value); return _intern.has(key) ? _intern.get(key) : value; } function intern_set({ _intern, _key }, value) { const key = _key(value); if (_intern.has(key)) return _intern.get(key); _intern.set(key, value); return value; } function intern_delete({ _intern, _key }, value) { const key = _key(value); if (_intern.has(key)) { value = _intern.get(key); _intern.delete(key); } return value; } function keyof(value) { return value !== null && typeof value === "object" ? value.valueOf() : value; } function identity$9(x2) { return x2; } function group(values, ...keys) { return nest(values, identity$9, identity$9, keys); } function groups(values, ...keys) { return nest(values, Array.from, identity$9, keys); } function flatten$1(groups2, keys) { for (let i = 1, n = keys.length; i < n; ++i) { groups2 = groups2.flatMap((g) => g.pop().map(([key, value]) => [...g, key, value])); } return groups2; } function flatGroup(values, ...keys) { return flatten$1(groups(values, ...keys), keys); } function flatRollup(values, reduce2, ...keys) { return flatten$1(rollups(values, reduce2, ...keys), keys); } function rollup(values, reduce2, ...keys) { return nest(values, identity$9, reduce2, keys); } function rollups(values, reduce2, ...keys) { return nest(values, Array.from, reduce2, keys); } function index$4(values, ...keys) { return nest(values, identity$9, unique, keys); } function indexes(values, ...keys) { return nest(values, Array.from, unique, keys); } function unique(values) { if (values.length !== 1) throw new Error("duplicate key"); return values[0]; } function nest(values, map2, reduce2, keys) { return function regroup(values2, i) { if (i >= keys.length) return reduce2(values2); const groups2 = new InternMap(); const keyof2 = keys[i++]; let index2 = -1; for (const value of values2) { const key = keyof2(value, ++index2, values2); const group2 = groups2.get(key); if (group2) group2.push(value); else groups2.set(key, [value]); } for (const [key, values3] of groups2) { groups2.set(key, regroup(values3, i)); } return map2(groups2); }(values, 0); } function permute(source, keys) { return Array.from(keys, (key) => source[key]); } function sort(values, ...F) { if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); values = Array.from(values); let [f] = F; if (f && f.length !== 2 || F.length > 1) { const index2 = Uint32Array.from(values, (d, i) => i); if (F.length > 1) { F = F.map((f2) => values.map(f2)); index2.sort((i, j) => { for (const f2 of F) { const c2 = ascendingDefined(f2[i], f2[j]); if (c2) return c2; } }); } else { f = values.map(f); index2.sort((i, j) => ascendingDefined(f[i], f[j])); } return permute(values, index2); } return values.sort(compareDefined(f)); } function compareDefined(compare = ascending$3) { if (compare === ascending$3) return ascendingDefined; if (typeof compare !== "function") throw new TypeError("compare is not a function"); return (a2, b) => { const x2 = compare(a2, b); if (x2 || x2 === 0) return x2; return (compare(b, b) === 0) - (compare(a2, a2) === 0); }; } function ascendingDefined(a2, b) { return (a2 == null || !(a2 >= a2)) - (b == null || !(b >= b)) || (a2 < b ? -1 : a2 > b ? 1 : 0); } function groupSort(values, reduce2, key) { return (reduce2.length !== 2 ? sort(rollup(values, reduce2, key), ([ak, av], [bk2, bv]) => ascending$3(av, bv) || ascending$3(ak, bk2)) : sort(group(values, key), ([ak, av], [bk2, bv]) => reduce2(av, bv) || ascending$3(ak, bk2))).map(([key2]) => key2); } var array$5 = Array.prototype; var slice$4 = array$5.slice; function constant$b(x2) { return () => x2; } var e10 = Math.sqrt(50), e5 = Math.sqrt(10), e2 = Math.sqrt(2); function ticks(start2, stop, count2) { var reverse2, i = -1, n, ticks2, step; stop = +stop, start2 = +start2, count2 = +count2; if (start2 === stop && count2 > 0) return [start2]; if (reverse2 = stop < start2) n = start2, start2 = stop, stop = n; if ((step = tickIncrement(start2, stop, count2)) === 0 || !isFinite(step)) return []; if (step > 0) { let r0 = Math.round(start2 / step), r1 = Math.round(stop / step); if (r0 * step < start2) ++r0; if (r1 * step > stop) --r1; ticks2 = new Array(n = r1 - r0 + 1); while (++i < n) ticks2[i] = (r0 + i) * step; } else { step = -step; let r0 = Math.round(start2 * step), r1 = Math.round(stop * step); if (r0 / step < start2) ++r0; if (r1 / step > stop) --r1; ticks2 = new Array(n = r1 - r0 + 1); while (++i < n) ticks2[i] = (r0 + i) / step; } if (reverse2) ticks2.reverse(); return ticks2; } function tickIncrement(start2, stop, count2) { var step = (stop - start2) / Math.max(0, count2), power = Math.floor(Math.log(step) / Math.LN10), error = step / Math.pow(10, power); return power >= 0 ? (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1) * Math.pow(10, power) : -Math.pow(10, -power) / (error >= e10 ? 10 : error >= e5 ? 5 : error >= e2 ? 2 : 1); } function tickStep(start2, stop, count2) { var step0 = Math.abs(stop - start2) / Math.max(0, count2), step1 = Math.pow(10, Math.floor(Math.log(step0) / Math.LN10)), error = step0 / step1; if (error >= e10) step1 *= 10; else if (error >= e5) step1 *= 5; else if (error >= e2) step1 *= 2; return stop < start2 ? -step1 : step1; } function nice$1(start2, stop, count2) { let prestep; while (true) { const step = tickIncrement(start2, stop, count2); if (step === prestep || step === 0 || !isFinite(step)) { return [start2, stop]; } else if (step > 0) { start2 = Math.floor(start2 / step) * step; stop = Math.ceil(stop / step) * step; } else if (step < 0) { start2 = Math.ceil(start2 * step) / step; stop = Math.floor(stop * step) / step; } prestep = step; } } function thresholdSturges(values) { return Math.ceil(Math.log(count$1(values)) / Math.LN2) + 1; } function bin() { var value = identity$9, domain = extent$1, threshold2 = thresholdSturges; function histogram(data) { if (!Array.isArray(data)) data = Array.from(data); var i, n = data.length, x2, step, values = new Array(n); for (i = 0; i < n; ++i) { values[i] = value(data[i], i, data); } var xz = domain(values), x02 = xz[0], x12 = xz[1], tz = threshold2(values, x02, x12); if (!Array.isArray(tz)) { const max2 = x12, tn = +tz; if (domain === extent$1) [x02, x12] = nice$1(x02, x12, tn); tz = ticks(x02, x12, tn); if (tz[0] <= x02) step = tickIncrement(x02, x12, tn); if (tz[tz.length - 1] >= x12) { if (max2 >= x12 && domain === extent$1) { const step2 = tickIncrement(x02, x12, tn); if (isFinite(step2)) { if (step2 > 0) { x12 = (Math.floor(x12 / step2) + 1) * step2; } else if (step2 < 0) { x12 = (Math.ceil(x12 * -step2) + 1) / -step2; } } } else { tz.pop(); } } } var m2 = tz.length; while (tz[0] <= x02) tz.shift(), --m2; while (tz[m2 - 1] > x12) tz.pop(), --m2; var bins = new Array(m2 + 1), bin2; for (i = 0; i <= m2; ++i) { bin2 = bins[i] = []; bin2.x0 = i > 0 ? tz[i - 1] : x02; bin2.x1 = i < m2 ? tz[i] : x12; } if (isFinite(step)) { if (step > 0) { for (i = 0; i < n; ++i) { if ((x2 = values[i]) != null && x02 <= x2 && x2 <= x12) { bins[Math.min(m2, Math.floor((x2 - x02) / step))].push(data[i]); } } } else if (step < 0) { for (i = 0; i < n; ++i) { if ((x2 = values[i]) != null && x02 <= x2 && x2 <= x12) { const j = Math.floor((x02 - x2) * step); bins[Math.min(m2, j + (tz[j] <= x2))].push(data[i]); } } } } else { for (i = 0; i < n; ++i) { if ((x2 = values[i]) != null && x02 <= x2 && x2 <= x12) { bins[bisect(tz, x2, 0, m2)].push(data[i]); } } } return bins; } histogram.value = function(_2) { return arguments.length ? (value = typeof _2 === "function" ? _2 : constant$b(_2), histogram) : value; }; histogram.domain = function(_2) { return arguments.length ? (domain = typeof _2 === "function" ? _2 : constant$b([_2[0], _2[1]]), histogram) : domain; }; histogram.thresholds = function(_2) { return arguments.length ? (threshold2 = typeof _2 === "function" ? _2 : Array.isArray(_2) ? constant$b(slice$4.call(_2)) : constant$b(_2), histogram) : threshold2; }; return histogram; } function max$3(values, valueof) { let max2; if (valueof === void 0) { for (const value of values) { if (value != null && (max2 < value || max2 === void 0 && value >= value)) { max2 = value; } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (max2 < value || max2 === void 0 && value >= value)) { max2 = value; } } } return max2; } function maxIndex(values, valueof) { let max2; let maxIndex2 = -1; let index2 = -1; if (valueof === void 0) { for (const value of values) { ++index2; if (value != null && (max2 < value || max2 === void 0 && value >= value)) { max2 = value, maxIndex2 = index2; } } } else { for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (max2 < value || max2 === void 0 && value >= value)) { max2 = value, maxIndex2 = index2; } } } return maxIndex2; } function min$2(values, valueof) { let min2; if (valueof === void 0) { for (const value of values) { if (value != null && (min2 > value || min2 === void 0 && value >= value)) { min2 = value; } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (min2 > value || min2 === void 0 && value >= value)) { min2 = value; } } } return min2; } function minIndex(values, valueof) { let min2; let minIndex2 = -1; let index2 = -1; if (valueof === void 0) { for (const value of values) { ++index2; if (value != null && (min2 > value || min2 === void 0 && value >= value)) { min2 = value, minIndex2 = index2; } } } else { for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (min2 > value || min2 === void 0 && value >= value)) { min2 = value, minIndex2 = index2; } } } return minIndex2; } function quickselect(array2, k2, left2 = 0, right2 = array2.length - 1, compare) { compare = compare === void 0 ? ascendingDefined : compareDefined(compare); while (right2 > left2) { if (right2 - left2 > 600) { const n = right2 - left2 + 1; const m2 = k2 - left2 + 1; const z = Math.log(n); const s2 = 0.5 * Math.exp(2 * z / 3); const sd = 0.5 * Math.sqrt(z * s2 * (n - s2) / n) * (m2 - n / 2 < 0 ? -1 : 1); const newLeft = Math.max(left2, Math.floor(k2 - m2 * s2 / n + sd)); const newRight = Math.min(right2, Math.floor(k2 + (n - m2) * s2 / n + sd)); quickselect(array2, k2, newLeft, newRight, compare); } const t = array2[k2]; let i = left2; let j = right2; swap$1(array2, left2, k2); if (compare(array2[right2], t) > 0) swap$1(array2, left2, right2); while (i < j) { swap$1(array2, i, j), ++i, --j; while (compare(array2[i], t) < 0) ++i; while (compare(array2[j], t) > 0) --j; } if (compare(array2[left2], t) === 0) swap$1(array2, left2, j); else ++j, swap$1(array2, j, right2); if (j <= k2) left2 = j + 1; if (k2 <= j) right2 = j - 1; } return array2; } function swap$1(array2, i, j) { const t = array2[i]; array2[i] = array2[j]; array2[j] = t; } function greatest(values, compare = ascending$3) { let max2; let defined = false; if (compare.length === 1) { let maxValue; for (const element of values) { const value = compare(element); if (defined ? ascending$3(value, maxValue) > 0 : ascending$3(value, value) === 0) { max2 = element; maxValue = value; defined = true; } } } else { for (const value of values) { if (defined ? compare(value, max2) > 0 : compare(value, value) === 0) { max2 = value; defined = true; } } } return max2; } function quantile$1(values, p, valueof) { values = Float64Array.from(numbers(values, valueof)); if (!(n = values.length)) return; if ((p = +p) <= 0 || n < 2) return min$2(values); if (p >= 1) return max$3(values); var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = max$3(quickselect(values, i0).subarray(0, i0 + 1)), value1 = min$2(values.subarray(i0 + 1)); return value0 + (value1 - value0) * (i - i0); } function quantileSorted(values, p, valueof = number$3) { if (!(n = values.length)) return; if ((p = +p) <= 0 || n < 2) return +valueof(values[0], 0, values); if (p >= 1) return +valueof(values[n - 1], n - 1, values); var n, i = (n - 1) * p, i0 = Math.floor(i), value0 = +valueof(values[i0], i0, values), value1 = +valueof(values[i0 + 1], i0 + 1, values); return value0 + (value1 - value0) * (i - i0); } function quantileIndex(values, p, valueof) { values = Float64Array.from(numbers(values, valueof)); if (!(n = values.length)) return; if ((p = +p) <= 0 || n < 2) return minIndex(values); if (p >= 1) return maxIndex(values); var n, i = Math.floor((n - 1) * p), order = (i2, j) => ascendingDefined(values[i2], values[j]), index2 = quickselect(Uint32Array.from(values, (_2, i2) => i2), i, 0, n - 1, order); return greatest(index2.subarray(0, i + 1), (i2) => values[i2]); } function thresholdFreedmanDiaconis(values, min2, max2) { return Math.ceil((max2 - min2) / (2 * (quantile$1(values, 0.75) - quantile$1(values, 0.25)) * Math.pow(count$1(values), -1 / 3))); } function thresholdScott(values, min2, max2) { return Math.ceil((max2 - min2) * Math.cbrt(count$1(values)) / (3.49 * deviation(values))); } function mean(values, valueof) { let count2 = 0; let sum2 = 0; if (valueof === void 0) { for (let value of values) { if (value != null && (value = +value) >= value) { ++count2, sum2 += value; } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && (value = +value) >= value) { ++count2, sum2 += value; } } } if (count2) return sum2 / count2; } function median(values, valueof) { return quantile$1(values, 0.5, valueof); } function medianIndex(values, valueof) { return quantileIndex(values, 0.5, valueof); } function* flatten(arrays) { for (const array2 of arrays) { yield* array2; } } function merge$1(arrays) { return Array.from(flatten(arrays)); } function mode(values, valueof) { const counts = new InternMap(); if (valueof === void 0) { for (let value of values) { if (value != null && value >= value) { counts.set(value, (counts.get(value) || 0) + 1); } } } else { let index2 = -1; for (let value of values) { if ((value = valueof(value, ++index2, values)) != null && value >= value) { counts.set(value, (counts.get(value) || 0) + 1); } } } let modeValue; let modeCount = 0; for (const [value, count2] of counts) { if (count2 > modeCount) { modeCount = count2; modeValue = value; } } return modeValue; } function pairs(values, pairof = pair) { const pairs2 = []; let previous; let first = false; for (const value of values) { if (first) pairs2.push(pairof(previous, value)); previous = value; first = true; } return pairs2; } function pair(a2, b) { return [a2, b]; } function range$2(start2, stop, step) { start2 = +start2, stop = +stop, step = (n = arguments.length) < 2 ? (stop = start2, start2 = 0, 1) : n < 3 ? 1 : +step; var i = -1, n = Math.max(0, Math.ceil((stop - start2) / step)) | 0, range2 = new Array(n); while (++i < n) { range2[i] = start2 + i * step; } return range2; } function rank(values, valueof = ascending$3) { if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); let V = Array.from(values); const R = new Float64Array(V.length); if (valueof.length !== 2) V = V.map(valueof), valueof = ascending$3; const compareIndex = (i, j) => valueof(V[i], V[j]); let k2, r; Uint32Array.from(V, (_2, i) => i).sort(valueof === ascending$3 ? (i, j) => ascendingDefined(V[i], V[j]) : compareDefined(compareIndex)).forEach((j, i) => { const c2 = compareIndex(j, k2 === void 0 ? j : k2); if (c2 >= 0) { if (k2 === void 0 || c2 > 0) k2 = j, r = i; R[j] = r; } else { R[j] = NaN; } }); return R; } function least(values, compare = ascending$3) { let min2; let defined = false; if (compare.length === 1) { let minValue; for (const element of values) { const value = compare(element); if (defined ? ascending$3(value, minValue) < 0 : ascending$3(value, value) === 0) { min2 = element; minValue = value; defined = true; } } } else { for (const value of values) { if (defined ? compare(value, min2) < 0 : compare(value, value) === 0) { min2 = value; defined = true; } } } return min2; } function leastIndex(values, compare = ascending$3) { if (compare.length === 1) return minIndex(values, compare); let minValue; let min2 = -1; let index2 = -1; for (const value of values) { ++index2; if (min2 < 0 ? compare(value, value) === 0 : compare(value, minValue) < 0) { minValue = value; min2 = index2; } } return min2; } function greatestIndex(values, compare = ascending$3) { if (compare.length === 1) return maxIndex(values, compare); let maxValue; let max2 = -1; let index2 = -1; for (const value of values) { ++index2; if (max2 < 0 ? compare(value, value) === 0 : compare(value, maxValue) > 0) { maxValue = value; max2 = index2; } } return max2; } function scan(values, compare) { const index2 = leastIndex(values, compare); return index2 < 0 ? void 0 : index2; } const shuffle$1 = shuffler(Math.random); function shuffler(random2) { return function shuffle2(array2, i0 = 0, i1 = array2.length) { let m2 = i1 - (i0 = +i0); while (m2) { const i = random2() * m2-- | 0, t = array2[m2 + i0]; array2[m2 + i0] = array2[i + i0]; array2[i + i0] = t; } return array2; }; } function sum$2(values, valueof) { let sum2 = 0; if (valueof === void 0) { for (let value of values) { if (value = +value) { sum2 += value; } } } else { let index2 = -1; for (let value of values) { if (value = +valueof(value, ++index2, values)) { sum2 += value; } } } return sum2; } function transpose(matrix) { if (!(n = matrix.length)) return []; for (var i = -1, m2 = min$2(matrix, length$3), transpose2 = new Array(m2); ++i < m2; ) { for (var j = -1, n, row = transpose2[i] = new Array(n); ++j < n; ) { row[j] = matrix[j][i]; } } return transpose2; } function length$3(d) { return d.length; } function zip() { return transpose(arguments); } function every(values, test) { if (typeof test !== "function") throw new TypeError("test is not a function"); let index2 = -1; for (const value of values) { if (!test(value, ++index2, values)) { return false; } } return true; } function some(values, test) { if (typeof test !== "function") throw new TypeError("test is not a function"); let index2 = -1; for (const value of values) { if (test(value, ++index2, values)) { return true; } } return false; } function filter$1(values, test) { if (typeof test !== "function") throw new TypeError("test is not a function"); const array2 = []; let index2 = -1; for (const value of values) { if (test(value, ++index2, values)) { array2.push(value); } } return array2; } function map$1(values, mapper) { if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); if (typeof mapper !== "function") throw new TypeError("mapper is not a function"); return Array.from(values, (value, index2) => mapper(value, index2, values)); } function reduce(values, reducer2, value) { if (typeof reducer2 !== "function") throw new TypeError("reducer is not a function"); const iterator2 = values[Symbol.iterator](); let done, next2, index2 = -1; if (arguments.length < 3) { ({ done, value } = iterator2.next()); if (done) return; ++index2; } while ({ done, value: next2 } = iterator2.next(), !done) { value = reducer2(value, next2, ++index2, values); } return value; } function reverse$1(values) { if (typeof values[Symbol.iterator] !== "function") throw new TypeError("values is not iterable"); return Array.from(values).reverse(); } function difference(values, ...others) { values = new InternSet(values); for (const other of others) { for (const value of other) { values.delete(value); } } return values; } function disjoint(values, other) { const iterator2 = other[Symbol.iterator](), set2 = new InternSet(); for (const v of values) { if (set2.has(v)) return false; let value, done; while ({ value, done } = iterator2.next()) { if (done) break; if (Object.is(v, value)) return false; set2.add(value); } } return true; } function intersection$1(values, ...others) { values = new InternSet(values); others = others.map(set$2); out: for (const value of values) { for (const other of others) { if (!other.has(value)) { values.delete(value); continue out; } } } return values; } function set$2(values) { return values instanceof InternSet ? values : new InternSet(values); } function superset(values, other) { const iterator2 = values[Symbol.iterator](), set2 = /* @__PURE__ */ new Set(); for (const o of other) { const io = intern(o); if (set2.has(io)) continue; let value, done; while ({ value, done } = iterator2.next()) { if (done) return false; const ivalue = intern(value); set2.add(ivalue); if (Object.is(io, ivalue)) break; } } return true; } function intern(value) { return value !== null && typeof value === "object" ? value.valueOf() : value; } function subset(values, other) { return superset(other, values); } function union(...others) { const set2 = new InternSet(); for (const other of others) { for (const o of other) { set2.add(o); } } return set2; } function identity$8(x2) { return x2; } var top = 1, right = 2, bottom = 3, left = 4, epsilon$6 = 1e-6; function translateX(x2) { return "translate(" + x2 + ",0)"; } function translateY(y2) { return "translate(0," + y2 + ")"; } function number$2(scale) { return (d) => +scale(d); } function center$1(scale, offset) { offset = Math.max(0, scale.bandwidth() - offset * 2) / 2; if (scale.round()) offset = Math.round(offset); return (d) => +scale(d) + offset; } function entering() { return !this.__axis; } function axis(orient, scale) { var tickArguments = [], tickValues = null, tickFormat2 = null, tickSizeInner = 6, tickSizeOuter = 6, tickPadding = 3, offset = typeof window !== "undefined" && window.devicePixelRatio > 1 ? 0 : 0.5, k2 = orient === top || orient === left ? -1 : 1, x2 = orient === left || orient === right ? "x" : "y", transform2 = orient === top || orient === bottom ? translateX : translateY; function axis2(context) { var values = tickValues == null ? scale.ticks ? scale.ticks.apply(scale, tickArguments) : scale.domain() : tickValues, format2 = tickFormat2 == null ? scale.tickFormat ? scale.tickFormat.apply(scale, tickArguments) : identity$8 : tickFormat2, spacing = Math.max(tickSizeInner, 0) + tickPadding, range2 = scale.range(), range0 = +range2[0] + offset, range1 = +range2[range2.length - 1] + offset, position2 = (scale.bandwidth ? center$1 : number$2)(scale.copy(), offset), selection2 = context.selection ? context.selection() : context, path2 = selection2.selectAll(".domain").data([null]), tick = selection2.selectAll(".tick").data(values, scale).order(), tickExit = tick.exit(), tickEnter = tick.enter().append("g").attr("class", "tick"), line2 = tick.select("line"), text2 = tick.select("text"); path2 = path2.merge(path2.enter().insert("path", ".tick").attr("class", "domain").attr("stroke", "currentColor")); tick = tick.merge(tickEnter); line2 = line2.merge(tickEnter.append("line").attr("stroke", "currentColor").attr(x2 + "2", k2 * tickSizeInner)); text2 = text2.merge(tickEnter.append("text").attr("fill", "currentColor").attr(x2, k2 * spacing).attr("dy", orient === top ? "0em" : orient === bottom ? "0.71em" : "0.32em")); if (context !== selection2) { path2 = path2.transition(context); tick = tick.transition(context); line2 = line2.transition(context); text2 = text2.transition(context); tickExit = tickExit.transition(context).attr("opacity", epsilon$6).attr("transform", function(d) { return isFinite(d = position2(d)) ? transform2(d + offset) : this.getAttribute("transform"); }); tickEnter.attr("opacity", epsilon$6).attr("transform", function(d) { var p = this.parentNode.__axis; return transform2((p && isFinite(p = p(d)) ? p : position2(d)) + offset); }); } tickExit.remove(); path2.attr("d", orient === left || orient === right ? tickSizeOuter ? "M" + k2 * tickSizeOuter + "," + range0 + "H" + offset + "V" + range1 + "H" + k2 * tickSizeOuter : "M" + offset + "," + range0 + "V" + range1 : tickSizeOuter ? "M" + range0 + "," + k2 * tickSizeOuter + "V" + offset + "H" + range1 + "V" + k2 * tickSizeOuter : "M" + range0 + "," + offset + "H" + range1); tick.attr("opacity", 1).attr("transform", function(d) { return transform2(position2(d) + offset); }); line2.attr(x2 + "2", k2 * tickSizeInner); text2.attr(x2, k2 * spacing).text(format2); selection2.filter(entering).attr("fill", "none").attr("font-size", 10).attr("font-family", "sans-serif").attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle"); selection2.each(function() { this.__axis = position2; }); } axis2.scale = function(_2) { return arguments.length ? (scale = _2, axis2) : scale; }; axis2.ticks = function() { return tickArguments = Array.from(arguments), axis2; }; axis2.tickArguments = function(_2) { return arguments.length ? (tickArguments = _2 == null ? [] : Array.from(_2), axis2) : tickArguments.slice(); }; axis2.tickValues = function(_2) { return arguments.length ? (tickValues = _2 == null ? null : Array.from(_2), axis2) : tickValues && tickValues.slice(); }; axis2.tickFormat = function(_2) { return arguments.length ? (tickFormat2 = _2, axis2) : tickFormat2; }; axis2.tickSize = function(_2) { return arguments.length ? (tickSizeInner = tickSizeOuter = +_2, axis2) : tickSizeInner; }; axis2.tickSizeInner = function(_2) { return arguments.length ? (tickSizeInner = +_2, axis2) : tickSizeInner; }; axis2.tickSizeOuter = function(_2) { return arguments.length ? (tickSizeOuter = +_2, axis2) : tickSizeOuter; }; axis2.tickPadding = function(_2) { return arguments.length ? (tickPadding = +_2, axis2) : tickPadding; }; axis2.offset = function(_2) { return arguments.length ? (offset = +_2, axis2) : offset; }; return axis2; } function axisTop(scale) { return axis(top, scale); } function axisRight(scale) { return axis(right, scale); } function axisBottom(scale) { return axis(bottom, scale); } function axisLeft(scale) { return axis(left, scale); } var noop$3 = { value: () => { } }; function dispatch() { for (var i = 0, n = arguments.length, _2 = {}, t; i < n; ++i) { if (!(t = arguments[i] + "") || t in _2 || /[\s.]/.test(t)) throw new Error("illegal type: " + t); _2[t] = []; } return new Dispatch(_2); } function Dispatch(_2) { this._ = _2; } function parseTypenames$1(typenames, types2) { return typenames.trim().split(/^|\s+/).map(function(t) { var name2 = "", i = t.indexOf("."); if (i >= 0) name2 = t.slice(i + 1), t = t.slice(0, i); if (t && !types2.hasOwnProperty(t)) throw new Error("unknown type: " + t); return { type: t, name: name2 }; }); } Dispatch.prototype = dispatch.prototype = { constructor: Dispatch, on: function(typename, callback) { var _2 = this._, T = parseTypenames$1(typename + "", _2), t, i = -1, n = T.length; if (arguments.length < 2) { while (++i < n) if ((t = (typename = T[i]).type) && (t = get$1(_2[t], typename.name))) return t; return; } if (callback != null && typeof callback !== "function") throw new Error("invalid callback: " + callback); while (++i < n) { if (t = (typename = T[i]).type) _2[t] = set$1(_2[t], typename.name, callback); else if (callback == null) for (t in _2) _2[t] = set$1(_2[t], typename.name, null); } return this; }, copy: function() { var copy2 = {}, _2 = this._; for (var t in _2) copy2[t] = _2[t].slice(); return new Dispatch(copy2); }, call: function(type2, that) { if ((n = arguments.length - 2) > 0) for (var args = new Array(n), i = 0, n, t; i < n; ++i) args[i] = arguments[i + 2]; if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); for (t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); }, apply: function(type2, that, args) { if (!this._.hasOwnProperty(type2)) throw new Error("unknown type: " + type2); for (var t = this._[type2], i = 0, n = t.length; i < n; ++i) t[i].value.apply(that, args); } }; function get$1(type2, name2) { for (var i = 0, n = type2.length, c2; i < n; ++i) { if ((c2 = type2[i]).name === name2) { return c2.value; } } } function set$1(type2, name2, callback) { for (var i = 0, n = type2.length; i < n; ++i) { if (type2[i].name === name2) { type2[i] = noop$3, type2 = type2.slice(0, i).concat(type2.slice(i + 1)); break; } } if (callback != null) type2.push({ name: name2, value: callback }); return type2; } var xhtml = "http://www.w3.org/1999/xhtml"; const namespaces = { svg: "http://www.w3.org/2000/svg", xhtml, xlink: "http://www.w3.org/1999/xlink", xml: "http://www.w3.org/XML/1998/namespace", xmlns: "http://www.w3.org/2000/xmlns/" }; function namespace(name2) { var prefix = name2 += "", i = prefix.indexOf(":"); if (i >= 0 && (prefix = name2.slice(0, i)) !== "xmlns") name2 = name2.slice(i + 1); return namespaces.hasOwnProperty(prefix) ? { space: namespaces[prefix], local: name2 } : name2; } function creatorInherit(name2) { return function() { var document2 = this.ownerDocument, uri = this.namespaceURI; return uri === xhtml && document2.documentElement.namespaceURI === xhtml ? document2.createElement(name2) : document2.createElementNS(uri, name2); }; } function creatorFixed(fullname) { return function() { return this.ownerDocument.createElementNS(fullname.space, fullname.local); }; } function creator(name2) { var fullname = namespace(name2); return (fullname.local ? creatorFixed : creatorInherit)(fullname); } function none$2() { } function selector(selector2) { return selector2 == null ? none$2 : function() { return this.querySelector(selector2); }; } function selection_select(select2) { if (typeof select2 !== "function") select2 = selector(select2); for (var groups2 = this._groups, m2 = groups2.length, subgroups = new Array(m2), j = 0; j < m2; ++j) { for (var group2 = groups2[j], n = group2.length, subgroup = subgroups[j] = new Array(n), node2, subnode, i = 0; i < n; ++i) { if ((node2 = group2[i]) && (subnode = select2.call(node2, node2.__data__, i, group2))) { if ("__data__" in node2) subnode.__data__ = node2.__data__; subgroup[i] = subnode; } } } return new Selection$1(subgroups, this._parents); } function array$4(x2) { return x2 == null ? [] : Array.isArray(x2) ? x2 : Array.from(x2); } function empty$1() { return []; } function selectorAll(selector2) { return selector2 == null ? empty$1 : function() { return this.querySelectorAll(selector2); }; } function arrayAll(select2) { return function() { return array$4(select2.apply(this, arguments)); }; } function selection_selectAll(select2) { if (typeof select2 === "function") select2 = arrayAll(select2); else select2 = selectorAll(select2); for (var groups2 = this._groups, m2 = groups2.length, subgroups = [], parents2 = [], j = 0; j < m2; ++j) { for (var group2 = groups2[j], n = group2.length, node2, i = 0; i < n; ++i) { if (node2 = group2[i]) { subgroups.push(select2.call(node2, node2.__data__, i, group2)); parents2.push(node2); } } } return new Selection$1(subgroups, parents2); } function matcher(selector2) { return function() { return this.matches(selector2); }; } function childMatcher(selector2) { return function(node2) { return node2.matches(selector2); }; } var find$1 = Array.prototype.find; function childFind(match) { return function() { return find$1.call(this.children, match); }; } function childFirst() { return this.firstElementChild; } function selection_selectChild(match) { return this.select(match == null ? childFirst : childFind(typeof match === "function" ? match : childMatcher(match))); } var filter = Array.prototype.filter; function children() { return Array.from(this.children); } function childrenFilter(match) { return function() { return filter.call(this.children, match); }; } function selection_selectChildren(match) { return this.selectAll(match == null ? children : childrenFilter(typeof match === "function" ? match : childMatcher(match))); } function selection_filter(match) { if (typeof match !== "function") match = matcher(match); for (var groups2 = this._groups, m2 = groups2.length, subgroups = new Array(m2), j = 0; j < m2; ++j) { for (var group2 = groups2[j], n = group2.length, subgroup = subgroups[j] = [], node2, i = 0; i < n; ++i) { if ((node2 = group2[i]) && match.call(node2, node2.__data__, i, group2)) { subgroup.push(node2); } } } return new Selection$1(subgroups, this._parents); } function sparse(update) { return new Array(update.length); } function selection_enter() { return new Selection$1(this._enter || this._groups.map(sparse), this._parents); } function EnterNode(parent, datum2) { this.ownerDocument = parent.ownerDocument; this.namespaceURI = parent.namespaceURI; this._next = null; this._parent = parent; this.__data__ = datum2; } EnterNode.prototype = { constructor: EnterNode, appendChild: function(child) { return this._parent.insertBefore(child, this._next); }, insertBefore: function(child, next2) { return this._parent.insertBefore(child, next2); }, querySelector: function(selector2) { return this._parent.querySelector(selector2); }, querySelectorAll: function(selector2) { return this._parent.querySelectorAll(selector2); } }; function constant$a(x2) { return function() { return x2; }; } function bindIndex(parent, group2, enter, update, exit, data) { var i = 0, node2, groupLength = group2.length, dataLength = data.length; for (; i < dataLength; ++i) { if (node2 = group2[i]) { node2.__data__ = data[i]; update[i] = node2; } else { enter[i] = new EnterNode(parent, data[i]); } } for (; i < groupLength; ++i) { if (node2 = group2[i]) { exit[i] = node2; } } } function bindKey(parent, group2, enter, update, exit, data, key) { var i, node2, nodeByKeyValue = /* @__PURE__ */ new Map(), groupLength = group2.length, dataLength = data.length, keyValues = new Array(groupLength), keyValue; for (i = 0; i < groupLength; ++i) { if (node2 = group2[i]) { keyValues[i] = keyValue = key.call(node2, node2.__data__, i, group2) + ""; if (nodeByKeyValue.has(keyValue)) { exit[i] = node2; } else { nodeByKeyValue.set(keyValue, node2); } } } for (i = 0; i < dataLength; ++i) { keyValue = key.call(parent, data[i], i, data) + ""; if (node2 = nodeByKeyValue.get(keyValue)) { update[i] = node2; node2.__data__ = data[i]; nodeByKeyValue.delete(keyValue); } else { enter[i] = new EnterNode(parent, data[i]); } } for (i = 0; i < groupLength; ++i) { if ((node2 = group2[i]) && nodeByKeyValue.get(keyValues[i]) === node2) { exit[i] = node2; } } } function datum(node2) { return node2.__data__; } function selection_data(value, key) { if (!arguments.length) return Array.from(this, datum); var bind = key ? bindKey : bindIndex, parents2 = this._parents, groups2 = this._groups; if (typeof value !== "function") value = constant$a(value); for (var m2 = groups2.length, update = new Array(m2), enter = new Array(m2), exit = new Array(m2), j = 0; j < m2; ++j) { var parent = parents2[j], group2 = groups2[j], groupLength = group2.length, data = arraylike(value.call(parent, parent && parent.__data__, j, parents2)), dataLength = data.length, enterGroup = enter[j] = new Array(dataLength), updateGroup = update[j] = new Array(dataLength), exitGroup = exit[j] = new Array(groupLength); bind(parent, group2, enterGroup, updateGroup, exitGroup, data, key); for (var i0 = 0, i1 = 0, previous, next2; i0 < dataLength; ++i0) { if (previous = enterGroup[i0]) { if (i0 >= i1) i1 = i0 + 1; while (!(next2 = updateGroup[i1]) && ++i1 < dataLength) ; previous._next = next2 || null; } } } update = new Selection$1(update, parents2); update._enter = enter; update._exit = exit; return update; } function arraylike(data) { return typeof data === "object" && "length" in data ? data : Array.from(data); } function selection_exit() { return new Selection$1(this._exit || this._groups.map(sparse), this._parents); } function selection_join(onenter, onupdate, onexit) { var enter = this.enter(), update = this, exit = this.exit(); if (typeof onenter === "function") { enter = onenter(enter); if (enter) enter = enter.selection(); } else { enter = enter.append(onenter + ""); } if (onupdate != null) { update = onupdate(update); if (update) update = update.selection(); } if (onexit == null) exit.remove(); else onexit(exit); return enter && update ? enter.merge(update).order() : update; } function selection_merge(context) { var selection2 = context.selection ? context.selection() : context; for (var groups0 = this._groups, groups1 = selection2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m2; ++j) { for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge2 = merges[j] = new Array(n), node2, i = 0; i < n; ++i) { if (node2 = group0[i] || group1[i]) { merge2[i] = node2; } } } for (; j < m0; ++j) { merges[j] = groups0[j]; } return new Selection$1(merges, this._parents); } function selection_order() { for (var groups2 = this._groups, j = -1, m2 = groups2.length; ++j < m2; ) { for (var group2 = groups2[j], i = group2.length - 1, next2 = group2[i], node2; --i >= 0; ) { if (node2 = group2[i]) { if (next2 && node2.compareDocumentPosition(next2) ^ 4) next2.parentNode.insertBefore(node2, next2); next2 = node2; } } } return this; } function selection_sort(compare) { if (!compare) compare = ascending$2; function compareNode(a2, b) { return a2 && b ? compare(a2.__data__, b.__data__) : !a2 - !b; } for (var groups2 = this._groups, m2 = groups2.length, sortgroups = new Array(m2), j = 0; j < m2; ++j) { for (var group2 = groups2[j], n = group2.length, sortgroup = sortgroups[j] = new Array(n), node2, i = 0; i < n; ++i) { if (node2 = group2[i]) { sortgroup[i] = node2; } } sortgroup.sort(compareNode); } return new Selection$1(sortgroups, this._parents).order(); } function ascending$2(a2, b) { return a2 < b ? -1 : a2 > b ? 1 : a2 >= b ? 0 : NaN; } function selection_call() { var callback = arguments[0]; arguments[0] = this; callback.apply(null, arguments); return this; } function selection_nodes() { return Array.from(this); } function selection_node() { for (var groups2 = this._groups, j = 0, m2 = groups2.length; j < m2; ++j) { for (var group2 = groups2[j], i = 0, n = group2.length; i < n; ++i) { var node2 = group2[i]; if (node2) return node2; } } return null; } function selection_size() { let size = 0; for (const node2 of this) ++size; return size; } function selection_empty() { return !this.node(); } function selection_each(callback) { for (var groups2 = this._groups, j = 0, m2 = groups2.length; j < m2; ++j) { for (var group2 = groups2[j], i = 0, n = group2.length, node2; i < n; ++i) { if (node2 = group2[i]) callback.call(node2, node2.__data__, i, group2); } } return this; } function attrRemove$1(name2) { return function() { this.removeAttribute(name2); }; } function attrRemoveNS$1(fullname) { return function() { this.removeAttributeNS(fullname.space, fullname.local); }; } function attrConstant$1(name2, value) { return function() { this.setAttribute(name2, value); }; } function attrConstantNS$1(fullname, value) { return function() { this.setAttributeNS(fullname.space, fullname.local, value); }; } function attrFunction$1(name2, value) { return function() { var v = value.apply(this, arguments); if (v == null) this.removeAttribute(name2); else this.setAttribute(name2, v); }; } function attrFunctionNS$1(fullname, value) { return function() { var v = value.apply(this, arguments); if (v == null) this.removeAttributeNS(fullname.space, fullname.local); else this.setAttributeNS(fullname.space, fullname.local, v); }; } function selection_attr(name2, value) { var fullname = namespace(name2); if (arguments.length < 2) { var node2 = this.node(); return fullname.local ? node2.getAttributeNS(fullname.space, fullname.local) : node2.getAttribute(fullname); } return this.each((value == null ? fullname.local ? attrRemoveNS$1 : attrRemove$1 : typeof value === "function" ? fullname.local ? attrFunctionNS$1 : attrFunction$1 : fullname.local ? attrConstantNS$1 : attrConstant$1)(fullname, value)); } function defaultView(node2) { return node2.ownerDocument && node2.ownerDocument.defaultView || node2.document && node2 || node2.defaultView; } function styleRemove$1(name2) { return function() { this.style.removeProperty(name2); }; } function styleConstant$1(name2, value, priority) { return function() { this.style.setProperty(name2, value, priority); }; } function styleFunction$1(name2, value, priority) { return function() { var v = value.apply(this, arguments); if (v == null) this.style.removeProperty(name2); else this.style.setProperty(name2, v, priority); }; } function selection_style(name2, value, priority) { return arguments.length > 1 ? this.each((value == null ? styleRemove$1 : typeof value === "function" ? styleFunction$1 : styleConstant$1)(name2, value, priority == null ? "" : priority)) : styleValue(this.node(), name2); } function styleValue(node2, name2) { return node2.style.getPropertyValue(name2) || defaultView(node2).getComputedStyle(node2, null).getPropertyValue(name2); } function propertyRemove(name2) { return function() { delete this[name2]; }; } function propertyConstant(name2, value) { return function() { this[name2] = value; }; } function propertyFunction(name2, value) { return function() { var v = value.apply(this, arguments); if (v == null) delete this[name2]; else this[name2] = v; }; } function selection_property(name2, value) { return arguments.length > 1 ? this.each((value == null ? propertyRemove : typeof value === "function" ? propertyFunction : propertyConstant)(name2, value)) : this.node()[name2]; } function classArray(string) { return string.trim().split(/^|\s+/); } function classList(node2) { return node2.classList || new ClassList(node2); } function ClassList(node2) { this._node = node2; this._names = classArray(node2.getAttribute("class") || ""); } ClassList.prototype = { add: function(name2) { var i = this._names.indexOf(name2); if (i < 0) { this._names.push(name2); this._node.setAttribute("class", this._names.join(" ")); } }, remove: function(name2) { var i = this._names.indexOf(name2); if (i >= 0) { this._names.splice(i, 1); this._node.setAttribute("class", this._names.join(" ")); } }, contains: function(name2) { return this._names.indexOf(name2) >= 0; } }; function classedAdd(node2, names) { var list2 = classList(node2), i = -1, n = names.length; while (++i < n) list2.add(names[i]); } function classedRemove(node2, names) { var list2 = classList(node2), i = -1, n = names.length; while (++i < n) list2.remove(names[i]); } function classedTrue(names) { return function() { classedAdd(this, names); }; } function classedFalse(names) { return function() { classedRemove(this, names); }; } function classedFunction(names, value) { return function() { (value.apply(this, arguments) ? classedAdd : classedRemove)(this, names); }; } function selection_classed(name2, value) { var names = classArray(name2 + ""); if (arguments.length < 2) { var list2 = classList(this.node()), i = -1, n = names.length; while (++i < n) if (!list2.contains(names[i])) return false; return true; } return this.each((typeof value === "function" ? classedFunction : value ? classedTrue : classedFalse)(names, value)); } function textRemove() { this.textContent = ""; } function textConstant$1(value) { return function() { this.textContent = value; }; } function textFunction$1(value) { return function() { var v = value.apply(this, arguments); this.textContent = v == null ? "" : v; }; } function selection_text(value) { return arguments.length ? this.each(value == null ? textRemove : (typeof value === "function" ? textFunction$1 : textConstant$1)(value)) : this.node().textContent; } function htmlRemove() { this.innerHTML = ""; } function htmlConstant(value) { return function() { this.innerHTML = value; }; } function htmlFunction(value) { return function() { var v = value.apply(this, arguments); this.innerHTML = v == null ? "" : v; }; } function selection_html(value) { return arguments.length ? this.each(value == null ? htmlRemove : (typeof value === "function" ? htmlFunction : htmlConstant)(value)) : this.node().innerHTML; } function raise() { if (this.nextSibling) this.parentNode.appendChild(this); } function selection_raise() { return this.each(raise); } function lower() { if (this.previousSibling) this.parentNode.insertBefore(this, this.parentNode.firstChild); } function selection_lower() { return this.each(lower); } function selection_append(name2) { var create2 = typeof name2 === "function" ? name2 : creator(name2); return this.select(function() { return this.appendChild(create2.apply(this, arguments)); }); } function constantNull() { return null; } function selection_insert(name2, before) { var create2 = typeof name2 === "function" ? name2 : creator(name2), select2 = before == null ? constantNull : typeof before === "function" ? before : selector(before); return this.select(function() { return this.insertBefore(create2.apply(this, arguments), select2.apply(this, arguments) || null); }); } function remove() { var parent = this.parentNode; if (parent) parent.removeChild(this); } function selection_remove() { return this.each(remove); } function selection_cloneShallow() { var clone2 = this.cloneNode(false), parent = this.parentNode; return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2; } function selection_cloneDeep() { var clone2 = this.cloneNode(true), parent = this.parentNode; return parent ? parent.insertBefore(clone2, this.nextSibling) : clone2; } function selection_clone(deep) { return this.select(deep ? selection_cloneDeep : selection_cloneShallow); } function selection_datum(value) { return arguments.length ? this.property("__data__", value) : this.node().__data__; } function contextListener(listener) { return function(event) { listener.call(this, event, this.__data__); }; } function parseTypenames(typenames) { return typenames.trim().split(/^|\s+/).map(function(t) { var name2 = "", i = t.indexOf("."); if (i >= 0) name2 = t.slice(i + 1), t = t.slice(0, i); return { type: t, name: name2 }; }); } function onRemove(typename) { return function() { var on = this.__on; if (!on) return; for (var j = 0, i = -1, m2 = on.length, o; j < m2; ++j) { if (o = on[j], (!typename.type || o.type === typename.type) && o.name === typename.name) { this.removeEventListener(o.type, o.listener, o.options); } else { on[++i] = o; } } if (++i) on.length = i; else delete this.__on; }; } function onAdd(typename, value, options2) { return function() { var on = this.__on, o, listener = contextListener(value); if (on) for (var j = 0, m2 = on.length; j < m2; ++j) { if ((o = on[j]).type === typename.type && o.name === typename.name) { this.removeEventListener(o.type, o.listener, o.options); this.addEventListener(o.type, o.listener = listener, o.options = options2); o.value = value; return; } } this.addEventListener(typename.type, listener, options2); o = { type: typename.type, name: typename.name, value, listener, options: options2 }; if (!on) this.__on = [o]; else on.push(o); }; } function selection_on(typename, value, options2) { var typenames = parseTypenames(typename + ""), i, n = typenames.length, t; if (arguments.length < 2) { var on = this.node().__on; if (on) for (var j = 0, m2 = on.length, o; j < m2; ++j) { for (i = 0, o = on[j]; i < n; ++i) { if ((t = typenames[i]).type === o.type && t.name === o.name) { return o.value; } } } return; } on = value ? onAdd : onRemove; for (i = 0; i < n; ++i) this.each(on(typenames[i], value, options2)); return this; } function dispatchEvent(node2, type2, params) { var window2 = defaultView(node2), event = window2.CustomEvent; if (typeof event === "function") { event = new event(type2, params); } else { event = window2.document.createEvent("Event"); if (params) event.initEvent(type2, params.bubbles, params.cancelable), event.detail = params.detail; else event.initEvent(type2, false, false); } node2.dispatchEvent(event); } function dispatchConstant(type2, params) { return function() { return dispatchEvent(this, type2, params); }; } function dispatchFunction(type2, params) { return function() { return dispatchEvent(this, type2, params.apply(this, arguments)); }; } function selection_dispatch(type2, params) { return this.each((typeof params === "function" ? dispatchFunction : dispatchConstant)(type2, params)); } function* selection_iterator() { for (var groups2 = this._groups, j = 0, m2 = groups2.length; j < m2; ++j) { for (var group2 = groups2[j], i = 0, n = group2.length, node2; i < n; ++i) { if (node2 = group2[i]) yield node2; } } } var root$5 = [null]; function Selection$1(groups2, parents2) { this._groups = groups2; this._parents = parents2; } function selection() { return new Selection$1([[document.documentElement]], root$5); } function selection_selection() { return this; } Selection$1.prototype = selection.prototype = { constructor: Selection$1, select: selection_select, selectAll: selection_selectAll, selectChild: selection_selectChild, selectChildren: selection_selectChildren, filter: selection_filter, data: selection_data, enter: selection_enter, exit: selection_exit, join: selection_join, merge: selection_merge, selection: selection_selection, order: selection_order, sort: selection_sort, call: selection_call, nodes: selection_nodes, node: selection_node, size: selection_size, empty: selection_empty, each: selection_each, attr: selection_attr, style: selection_style, property: selection_property, classed: selection_classed, text: selection_text, html: selection_html, raise: selection_raise, lower: selection_lower, append: selection_append, insert: selection_insert, remove: selection_remove, clone: selection_clone, datum: selection_datum, on: selection_on, dispatch: selection_dispatch, [Symbol.iterator]: selection_iterator }; function select(selector2) { return typeof selector2 === "string" ? new Selection$1([[document.querySelector(selector2)]], [document.documentElement]) : new Selection$1([[selector2]], root$5); } function create$2(name2) { return select(creator(name2).call(document.documentElement)); } var nextId = 0; function local$1() { return new Local(); } function Local() { this._ = "@" + (++nextId).toString(36); } Local.prototype = local$1.prototype = { constructor: Local, get: function(node2) { var id2 = this._; while (!(id2 in node2)) if (!(node2 = node2.parentNode)) return; return node2[id2]; }, set: function(node2, value) { return node2[this._] = value; }, remove: function(node2) { return this._ in node2 && delete node2[this._]; }, toString: function() { return this._; } }; function sourceEvent(event) { let sourceEvent2; while (sourceEvent2 = event.sourceEvent) event = sourceEvent2; return event; } function pointer(event, node2) { event = sourceEvent(event); if (node2 === void 0) node2 = event.currentTarget; if (node2) { var svg2 = node2.ownerSVGElement || node2; if (svg2.createSVGPoint) { var point2 = svg2.createSVGPoint(); point2.x = event.clientX, point2.y = event.clientY; point2 = point2.matrixTransform(node2.getScreenCTM().inverse()); return [point2.x, point2.y]; } if (node2.getBoundingClientRect) { var rect2 = node2.getBoundingClientRect(); return [event.clientX - rect2.left - node2.clientLeft, event.clientY - rect2.top - node2.clientTop]; } } return [event.pageX, event.pageY]; } function pointers(events, node2) { if (events.target) { events = sourceEvent(events); if (node2 === void 0) node2 = events.currentTarget; events = events.touches || [events]; } return Array.from(events, (event) => pointer(event, node2)); } function selectAll(selector2) { return typeof selector2 === "string" ? new Selection$1([document.querySelectorAll(selector2)], [document.documentElement]) : new Selection$1([array$4(selector2)], root$5); } const nonpassive = { passive: false }; const nonpassivecapture = { capture: true, passive: false }; function nopropagation$2(event) { event.stopImmediatePropagation(); } function noevent$2(event) { event.preventDefault(); event.stopImmediatePropagation(); } function dragDisable(view) { var root2 = view.document.documentElement, selection2 = select(view).on("dragstart.drag", noevent$2, nonpassivecapture); if ("onselectstart" in root2) { selection2.on("selectstart.drag", noevent$2, nonpassivecapture); } else { root2.__noselect = root2.style.MozUserSelect; root2.style.MozUserSelect = "none"; } } function yesdrag(view, noclick) { var root2 = view.document.documentElement, selection2 = select(view).on("dragstart.drag", null); if (noclick) { selection2.on("click.drag", noevent$2, nonpassivecapture); setTimeout(function() { selection2.on("click.drag", null); }, 0); } if ("onselectstart" in root2) { selection2.on("selectstart.drag", null); } else { root2.style.MozUserSelect = root2.__noselect; delete root2.__noselect; } } const constant$9 = (x2) => () => x2; function DragEvent(type2, { sourceEvent: sourceEvent2, subject, target, identifier: identifier2, active: active2, x: x2, y: y2, dx, dy, dispatch: dispatch2 }) { Object.defineProperties(this, { type: { value: type2, enumerable: true, configurable: true }, sourceEvent: { value: sourceEvent2, enumerable: true, configurable: true }, subject: { value: subject, enumerable: true, configurable: true }, target: { value: target, enumerable: true, configurable: true }, identifier: { value: identifier2, enumerable: true, configurable: true }, active: { value: active2, enumerable: true, configurable: true }, x: { value: x2, enumerable: true, configurable: true }, y: { value: y2, enumerable: true, configurable: true }, dx: { value: dx, enumerable: true, configurable: true }, dy: { value: dy, enumerable: true, configurable: true }, _: { value: dispatch2 } }); } DragEvent.prototype.on = function() { var value = this._.on.apply(this._, arguments); return value === this._ ? this : value; }; function defaultFilter$2(event) { return !event.ctrlKey && !event.button; } function defaultContainer() { return this.parentNode; } function defaultSubject(event, d) { return d == null ? { x: event.x, y: event.y } : d; } function defaultTouchable$2() { return navigator.maxTouchPoints || "ontouchstart" in this; } function drag() { var filter2 = defaultFilter$2, container = defaultContainer, subject = defaultSubject, touchable = defaultTouchable$2, gestures = {}, listeners = dispatch("start", "drag", "end"), active2 = 0, mousedownx, mousedowny, mousemoving, touchending, clickDistance2 = 0; function drag2(selection2) { selection2.on("mousedown.drag", mousedowned).filter(touchable).on("touchstart.drag", touchstarted).on("touchmove.drag", touchmoved, nonpassive).on("touchend.drag touchcancel.drag", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); } function mousedowned(event, d) { if (touchending || !filter2.call(this, event, d)) return; var gesture = beforestart(this, container.call(this, event, d), event, d, "mouse"); if (!gesture) return; select(event.view).on("mousemove.drag", mousemoved, nonpassivecapture).on("mouseup.drag", mouseupped, nonpassivecapture); dragDisable(event.view); nopropagation$2(event); mousemoving = false; mousedownx = event.clientX; mousedowny = event.clientY; gesture("start", event); } function mousemoved(event) { noevent$2(event); if (!mousemoving) { var dx = event.clientX - mousedownx, dy = event.clientY - mousedowny; mousemoving = dx * dx + dy * dy > clickDistance2; } gestures.mouse("drag", event); } function mouseupped(event) { select(event.view).on("mousemove.drag mouseup.drag", null); yesdrag(event.view, mousemoving); noevent$2(event); gestures.mouse("end", event); } function touchstarted(event, d) { if (!filter2.call(this, event, d)) return; var touches = event.changedTouches, c2 = container.call(this, event, d), n = touches.length, i, gesture; for (i = 0; i < n; ++i) { if (gesture = beforestart(this, c2, event, d, touches[i].identifier, touches[i])) { nopropagation$2(event); gesture("start", event, touches[i]); } } } function touchmoved(event) { var touches = event.changedTouches, n = touches.length, i, gesture; for (i = 0; i < n; ++i) { if (gesture = gestures[touches[i].identifier]) { noevent$2(event); gesture("drag", event, touches[i]); } } } function touchended(event) { var touches = event.changedTouches, n = touches.length, i, gesture; if (touchending) clearTimeout(touchending); touchending = setTimeout(function() { touchending = null; }, 500); for (i = 0; i < n; ++i) { if (gesture = gestures[touches[i].identifier]) { nopropagation$2(event); gesture("end", event, touches[i]); } } } function beforestart(that, container2, event, d, identifier2, touch) { var dispatch2 = listeners.copy(), p = pointer(touch || event, container2), dx, dy, s2; if ((s2 = subject.call(that, new DragEvent("beforestart", { sourceEvent: event, target: drag2, identifier: identifier2, active: active2, x: p[0], y: p[1], dx: 0, dy: 0, dispatch: dispatch2 }), d)) == null) return; dx = s2.x - p[0] || 0; dy = s2.y - p[1] || 0; return function gesture(type2, event2, touch2) { var p02 = p, n; switch (type2) { case "start": gestures[identifier2] = gesture, n = active2++; break; case "end": delete gestures[identifier2], --active2; case "drag": p = pointer(touch2 || event2, container2), n = active2; break; } dispatch2.call( type2, that, new DragEvent(type2, { sourceEvent: event2, subject: s2, target: drag2, identifier: identifier2, active: n, x: p[0] + dx, y: p[1] + dy, dx: p[0] - p02[0], dy: p[1] - p02[1], dispatch: dispatch2 }), d ); }; } drag2.filter = function(_2) { return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant$9(!!_2), drag2) : filter2; }; drag2.container = function(_2) { return arguments.length ? (container = typeof _2 === "function" ? _2 : constant$9(_2), drag2) : container; }; drag2.subject = function(_2) { return arguments.length ? (subject = typeof _2 === "function" ? _2 : constant$9(_2), drag2) : subject; }; drag2.touchable = function(_2) { return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant$9(!!_2), drag2) : touchable; }; drag2.on = function() { var value = listeners.on.apply(listeners, arguments); return value === listeners ? drag2 : value; }; drag2.clickDistance = function(_2) { return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, drag2) : Math.sqrt(clickDistance2); }; return drag2; } 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$2() { } 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: 15792383, antiquewhite: 16444375, aqua: 65535, aquamarine: 8388564, azure: 15794175, beige: 16119260, bisque: 16770244, black: 0, blanchedalmond: 16772045, blue: 255, blueviolet: 9055202, brown: 10824234, burlywood: 14596231, cadetblue: 6266528, chartreuse: 8388352, chocolate: 13789470, coral: 16744272, cornflowerblue: 6591981, cornsilk: 16775388, crimson: 14423100, cyan: 65535, darkblue: 139, darkcyan: 35723, darkgoldenrod: 12092939, darkgray: 11119017, darkgreen: 25600, darkgrey: 11119017, darkkhaki: 12433259, darkmagenta: 9109643, darkolivegreen: 5597999, darkorange: 16747520, darkorchid: 10040012, darkred: 9109504, darksalmon: 15308410, darkseagreen: 9419919, darkslateblue: 4734347, darkslategray: 3100495, darkslategrey: 3100495, darkturquoise: 52945, darkviolet: 9699539, deeppink: 16716947, deepskyblue: 49151, dimgray: 6908265, dimgrey: 6908265, dodgerblue: 2003199, firebrick: 11674146, floralwhite: 16775920, forestgreen: 2263842, fuchsia: 16711935, gainsboro: 14474460, ghostwhite: 16316671, gold: 16766720, goldenrod: 14329120, gray: 8421504, green: 32768, greenyellow: 11403055, grey: 8421504, honeydew: 15794160, hotpink: 16738740, indianred: 13458524, indigo: 4915330, ivory: 16777200, khaki: 15787660, lavender: 15132410, lavenderblush: 16773365, lawngreen: 8190976, lemonchiffon: 16775885, lightblue: 11393254, lightcoral: 15761536, lightcyan: 14745599, lightgoldenrodyellow: 16448210, lightgray: 13882323, lightgreen: 9498256, lightgrey: 13882323, lightpink: 16758465, lightsalmon: 16752762, lightseagreen: 2142890, lightskyblue: 8900346, lightslategray: 7833753, lightslategrey: 7833753, lightsteelblue: 11584734, lightyellow: 16777184, lime: 65280, limegreen: 3329330, linen: 16445670, magenta: 16711935, maroon: 8388608, mediumaquamarine: 6737322, mediumblue: 205, mediumorchid: 12211667, mediumpurple: 9662683, mediumseagreen: 3978097, mediumslateblue: 8087790, mediumspringgreen: 64154, mediumturquoise: 4772300, mediumvioletred: 13047173, midnightblue: 1644912, mintcream: 16121850, mistyrose: 16770273, moccasin: 16770229, navajowhite: 16768685, navy: 128, oldlace: 16643558, olive: 8421376, olivedrab: 7048739, orange: 16753920, orangered: 16729344, orchid: 14315734, palegoldenrod: 15657130, palegreen: 10025880, paleturquoise: 11529966, palevioletred: 14381203, papayawhip: 16773077, peachpuff: 16767673, peru: 13468991, pink: 16761035, plum: 14524637, powderblue: 11591910, purple: 8388736, rebeccapurple: 6697881, red: 16711680, rosybrown: 12357519, royalblue: 4286945, saddlebrown: 9127187, salmon: 16416882, sandybrown: 16032864, seagreen: 3050327, seashell: 16774638, sienna: 10506797, silver: 12632256, skyblue: 8900331, slateblue: 6970061, slategray: 7372944, slategrey: 7372944, snow: 16775930, springgreen: 65407, steelblue: 4620980, tan: 13808780, teal: 32896, thistle: 14204888, tomato: 16737095, turquoise: 4251856, violet: 15631086, wheat: 16113331, white: 16777215, whitesmoke: 16119285, yellow: 16776960, yellowgreen: 10145074 }; define(Color$2, color, { copy(channels2) { return Object.assign(new this.constructor(), this, channels2); }, displayable() { return this.rgb().displayable(); }, hex: 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(format2) { var m2, l; format2 = (format2 + "").trim().toLowerCase(); return (m2 = reHex.exec(format2)) ? (l = m2[1].length, m2 = parseInt(m2[1], 16), l === 6 ? rgbn(m2) : l === 3 ? new Rgb(m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, (m2 & 15) << 4 | m2 & 15, 1) : l === 8 ? rgba$2(m2 >> 24 & 255, m2 >> 16 & 255, m2 >> 8 & 255, (m2 & 255) / 255) : l === 4 ? rgba$2(m2 >> 12 & 15 | m2 >> 8 & 240, m2 >> 8 & 15 | m2 >> 4 & 240, m2 >> 4 & 15 | m2 & 240, ((m2 & 15) << 4 | m2 & 15) / 255) : null) : (m2 = reRgbInteger.exec(format2)) ? new Rgb(m2[1], m2[2], m2[3], 1) : (m2 = reRgbPercent.exec(format2)) ? new Rgb(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, 1) : (m2 = reRgbaInteger.exec(format2)) ? rgba$2(m2[1], m2[2], m2[3], m2[4]) : (m2 = reRgbaPercent.exec(format2)) ? rgba$2(m2[1] * 255 / 100, m2[2] * 255 / 100, m2[3] * 255 / 100, m2[4]) : (m2 = reHslPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, 1) : (m2 = reHslaPercent.exec(format2)) ? hsla(m2[1], m2[2] / 100, m2[3] / 100, m2[4]) : named.hasOwnProperty(format2) ? rgbn(named[format2]) : format2 === "transparent" ? new Rgb(NaN, NaN, NaN, 0) : null; } function rgbn(n) { return new Rgb(n >> 16 & 255, n >> 8 & 255, n & 255, 1); } function rgba$2(r, g, b, a2) { if (a2 <= 0) r = g = b = NaN; return new Rgb(r, g, b, a2); } function rgbConvert(o) { if (!(o instanceof Color$2)) 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$2, { brighter(k2) { k2 = k2 == null ? brighter : Math.pow(brighter, k2); return new Rgb(this.r * k2, this.g * k2, this.b * k2, this.opacity); }, darker(k2) { k2 = k2 == null ? darker : Math.pow(darker, k2); return new Rgb(this.r * k2, this.g * k2, this.b * k2, 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, 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 a2 = clampa(this.opacity); return `${a2 === 1 ? "rgb(" : "rgba("}${clampi(this.r)}, ${clampi(this.g)}, ${clampi(this.b)}${a2 === 1 ? ")" : `, ${a2})`}`; } 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, s2, l, a2) { if (a2 <= 0) h = s2 = l = NaN; else if (l <= 0 || l >= 1) h = s2 = NaN; else if (s2 <= 0) h = NaN; return new Hsl(h, s2, l, a2); } function hslConvert(o) { if (o instanceof Hsl) return new Hsl(o.h, o.s, o.l, o.opacity); if (!(o instanceof Color$2)) 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, min2 = Math.min(r, g, b), max2 = Math.max(r, g, b), h = NaN, s2 = max2 - min2, l = (max2 + min2) / 2; if (s2) { if (r === max2) h = (g - b) / s2 + (g < b) * 6; else if (g === max2) h = (b - r) / s2 + 2; else h = (r - g) / s2 + 4; s2 /= l < 0.5 ? max2 + min2 : 2 - max2 - min2; h *= 60; } else { s2 = l > 0 && l < 1 ? 0 : h; } return new Hsl(h, s2, l, o.opacity); } function hsl$2(h, s2, l, opacity) { return arguments.length === 1 ? hslConvert(h) : new Hsl(h, s2, l, opacity == null ? 1 : opacity); } function Hsl(h, s2, l, opacity) { this.h = +h; this.s = +s2; this.l = +l; this.opacity = +opacity; } define(Hsl, hsl$2, extend(Color$2, { brighter(k2) { k2 = k2 == null ? brighter : Math.pow(brighter, k2); return new Hsl(this.h, this.s, this.l * k2, this.opacity); }, darker(k2) { k2 = k2 == null ? darker : Math.pow(darker, k2); return new Hsl(this.h, this.s, this.l * k2, this.opacity); }, rgb() { var h = this.h % 360 + (this.h < 0) * 360, s2 = isNaN(h) || isNaN(this.s) ? 0 : this.s, l = this.l, m2 = l + (l < 0.5 ? l : 1 - l) * s2, 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 a2 = clampa(this.opacity); return `${a2 === 1 ? "hsl(" : "hsla("}${clamph(this.h)}, ${clampt(this.s) * 100}%, ${clampt(this.l) * 100}%${a2 === 1 ? ")" : `, ${a2})`}`; } })); 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)); } 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$2 = 180 / Math.PI; 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), y2 = xyz2lab((0.2225045 * r + 0.7168786 * g + 0.0606169 * b) / Yn), x2, z; if (r === g && g === b) x2 = z = y2; else { x2 = 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 * y2 - 16, 500 * (x2 - y2), 200 * (y2 - z), o.opacity); } function gray(l, opacity) { return new Lab(l, 0, 0, opacity == null ? 1 : opacity); } function lab$1(l, a2, b, opacity) { return arguments.length === 1 ? labConvert(l) : new Lab(l, a2, b, opacity == null ? 1 : opacity); } function Lab(l, a2, b, opacity) { this.l = +l; this.a = +a2; this.b = +b; this.opacity = +opacity; } define(Lab, lab$1, extend(Color$2, { brighter(k2) { return new Lab(this.l + K * (k2 == null ? 1 : k2), this.a, this.b, this.opacity); }, darker(k2) { return new Lab(this.l - K * (k2 == null ? 1 : k2), this.a, this.b, this.opacity); }, rgb() { var y2 = (this.l + 16) / 116, x2 = isNaN(this.a) ? y2 : y2 + this.a / 500, z = isNaN(this.b) ? y2 : y2 - this.b / 200; x2 = Xn * lab2xyz(x2); y2 = Yn * lab2xyz(y2); z = Zn * lab2xyz(z); return new Rgb( lrgb2rgb(3.1338561 * x2 - 1.6168667 * y2 - 0.4906146 * z), lrgb2rgb(-0.9787684 * x2 + 1.9161415 * y2 + 0.033454 * z), lrgb2rgb(0.0719453 * x2 - 0.2289914 * y2 + 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(x2) { return 255 * (x2 <= 31308e-7 ? 12.92 * x2 : 1.055 * Math.pow(x2, 1 / 2.4) - 0.055); } function rgb2lrgb(x2) { return (x2 /= 255) <= 0.04045 ? x2 / 12.92 : Math.pow((x2 + 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$2; return new Hcl(h < 0 ? h + 360 : h, Math.sqrt(o.a * o.a + o.b * o.b), o.l, o.opacity); } function lch(l, c2, h, opacity) { return arguments.length === 1 ? hclConvert(l) : new Hcl(h, c2, l, opacity == null ? 1 : opacity); } function hcl$1(h, c2, l, opacity) { return arguments.length === 1 ? hclConvert(h) : new Hcl(h, c2, l, opacity == null ? 1 : opacity); } function Hcl(h, c2, l, opacity) { this.h = +h; this.c = +c2; 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$2, { brighter(k2) { return new Hcl(this.h, this.c, this.l + K * (k2 == null ? 1 : k2), this.opacity); }, darker(k2) { return new Hcl(this.h, this.c, this.l - K * (k2 == null ? 1 : k2), this.opacity); }, rgb() { return hcl2lab(this).rgb(); } })); var A = -0.14861, B$1 = 1.78277, C = -0.29227, D$1 = -0.90649, E = 1.97294, ED = E * D$1, EB = E * B$1, BC_DA = B$1 * C - D$1 * 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, k2 = (E * (g - l) - C * bl) / D$1, s2 = Math.sqrt(k2 * k2 + bl * bl) / (E * l * (1 - l)), h = s2 ? Math.atan2(k2, bl) * degrees$2 - 120 : NaN; return new Cubehelix(h < 0 ? h + 360 : h, s2, l, o.opacity); } function cubehelix$3(h, s2, l, opacity) { return arguments.length === 1 ? cubehelixConvert(h) : new Cubehelix(h, s2, l, opacity == null ? 1 : opacity); } function Cubehelix(h, s2, l, opacity) { this.h = +h; this.s = +s2; this.l = +l; this.opacity = +opacity; } define(Cubehelix, cubehelix$3, extend(Color$2, { brighter(k2) { k2 = k2 == null ? brighter : Math.pow(brighter, k2); return new Cubehelix(this.h, this.s, this.l * k2, this.opacity); }, darker(k2) { k2 = k2 == null ? darker : Math.pow(darker, k2); return new Cubehelix(this.h, this.s, this.l * k2, this.opacity); }, rgb() { var h = isNaN(this.h) ? 0 : (this.h + 120) * radians$1, l = +this.l, a2 = isNaN(this.s) ? 0 : this.s * l * (1 - l), cosh2 = Math.cos(h), sinh2 = Math.sin(h); return new Rgb( 255 * (l + a2 * (A * cosh2 + B$1 * sinh2)), 255 * (l + a2 * (C * cosh2 + D$1 * sinh2)), 255 * (l + a2 * (E * cosh2)), this.opacity ); } })); function basis(t12, v0, v1, v2, v3) { var t22 = t12 * t12, t32 = t22 * t12; return ((1 - 3 * t12 + 3 * t22 - t32) * v0 + (4 - 6 * t22 + 3 * t32) * v1 + (1 + 3 * t12 + 3 * t22 - 3 * t32) * v2 + t32 * v3) / 6; } function basis$1(values) { var n = values.length - 1; return function(t) { var i = t <= 0 ? t = 0 : t >= 1 ? (t = 1, n - 1) : Math.floor(t * n), v1 = values[i], v2 = values[i + 1], v0 = i > 0 ? values[i - 1] : 2 * v1 - v2, v3 = i < n - 1 ? values[i + 2] : 2 * v2 - v1; return basis((t - i / n) * n, v0, v1, v2, v3); }; } function basisClosed(values) { var n = values.length; return function(t) { var i = Math.floor(((t %= 1) < 0 ? ++t : t) * n), v0 = values[(i + n - 1) % n], v1 = values[i % n], v2 = values[(i + 1) % n], v3 = values[(i + 2) % n]; return basis((t - i / n) * n, v0, v1, v2, v3); }; } const constant$8 = (x2) => () => x2; function linear$2(a2, d) { return function(t) { return a2 + t * d; }; } function exponential$1(a2, b, y2) { return a2 = Math.pow(a2, y2), b = Math.pow(b, y2) - a2, y2 = 1 / y2, function(t) { return Math.pow(a2 + t * b, y2); }; } function hue$1(a2, b) { var d = b - a2; return d ? linear$2(a2, d > 180 || d < -180 ? d - 360 * Math.round(d / 360) : d) : constant$8(isNaN(a2) ? b : a2); } function gamma$1(y2) { return (y2 = +y2) === 1 ? nogamma : function(a2, b) { return b - a2 ? exponential$1(a2, b, y2) : constant$8(isNaN(a2) ? b : a2); }; } function nogamma(a2, b) { var d = b - a2; return d ? linear$2(a2, d) : constant$8(isNaN(a2) ? b : a2); } const interpolateRgb = function rgbGamma(y2) { var color2 = gamma$1(y2); function rgb$1(start2, end2) { var r = color2((start2 = rgb(start2)).r, (end2 = rgb(end2)).r), g = color2(start2.g, end2.g), b = color2(start2.b, end2.b), opacity = nogamma(start2.opacity, end2.opacity); return function(t) { start2.r = r(t); start2.g = g(t); start2.b = b(t); start2.opacity = opacity(t); return start2 + ""; }; } rgb$1.gamma = rgbGamma; return rgb$1; }(1); function rgbSpline(spline) { return function(colors2) { var n = colors2.length, r = new Array(n), g = new Array(n), b = new Array(n), i, color2; for (i = 0; i < n; ++i) { color2 = rgb(colors2[i]); r[i] = color2.r || 0; g[i] = color2.g || 0; b[i] = color2.b || 0; } r = spline(r); g = spline(g); b = spline(b); color2.opacity = 1; return function(t) { color2.r = r(t); color2.g = g(t); color2.b = b(t); return color2 + ""; }; }; } var rgbBasis = rgbSpline(basis$1); var rgbBasisClosed = rgbSpline(basisClosed); function numberArray(a2, b) { if (!b) b = []; var n = a2 ? Math.min(b.length, a2.length) : 0, c2 = b.slice(), i; return function(t) { for (i = 0; i < n; ++i) c2[i] = a2[i] * (1 - t) + b[i] * t; return c2; }; } function isNumberArray(x2) { return ArrayBuffer.isView(x2) && !(x2 instanceof DataView); } function array$3(a2, b) { return (isNumberArray(b) ? numberArray : genericArray)(a2, b); } function genericArray(a2, b) { var nb = b ? b.length : 0, na = a2 ? Math.min(nb, a2.length) : 0, x2 = new Array(na), c2 = new Array(nb), i; for (i = 0; i < na; ++i) x2[i] = interpolate$2(a2[i], b[i]); for (; i < nb; ++i) c2[i] = b[i]; return function(t) { for (i = 0; i < na; ++i) c2[i] = x2[i](t); return c2; }; } function date$1(a2, b) { var d = new Date(); return a2 = +a2, b = +b, function(t) { return d.setTime(a2 * (1 - t) + b * t), d; }; } function interpolateNumber(a2, b) { return a2 = +a2, b = +b, function(t) { return a2 * (1 - t) + b * t; }; } function object$1(a2, b) { var i = {}, c2 = {}, k2; if (a2 === null || typeof a2 !== "object") a2 = {}; if (b === null || typeof b !== "object") b = {}; for (k2 in b) { if (k2 in a2) { i[k2] = interpolate$2(a2[k2], b[k2]); } else { c2[k2] = b[k2]; } } return function(t) { for (k2 in i) c2[k2] = i[k2](t); return c2; }; } var reA = /[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g, reB = new RegExp(reA.source, "g"); function zero(b) { return function() { return b; }; } function one(b) { return function(t) { return b(t) + ""; }; } function interpolateString(a2, b) { var bi = reA.lastIndex = reB.lastIndex = 0, am, bm, bs, i = -1, s2 = [], q = []; a2 = a2 + "", b = b + ""; while ((am = reA.exec(a2)) && (bm = reB.exec(b))) { if ((bs = bm.index) > bi) { bs = b.slice(bi, bs); if (s2[i]) s2[i] += bs; else s2[++i] = bs; } if ((am = am[0]) === (bm = bm[0])) { if (s2[i]) s2[i] += bm; else s2[++i] = bm; } else { s2[++i] = null; q.push({ i, x: interpolateNumber(am, bm) }); } bi = reB.lastIndex; } if (bi < b.length) { bs = b.slice(bi); if (s2[i]) s2[i] += bs; else s2[++i] = bs; } return s2.length < 2 ? q[0] ? one(q[0].x) : zero(b) : (b = q.length, function(t) { for (var i2 = 0, o; i2 < b; ++i2) s2[(o = q[i2]).i] = o.x(t); return s2.join(""); }); } function interpolate$2(a2, b) { var t = typeof b, c2; return b == null || t === "boolean" ? constant$8(b) : (t === "number" ? interpolateNumber : t === "string" ? (c2 = color(b)) ? (b = c2, interpolateRgb) : interpolateString : b instanceof color ? interpolateRgb : b instanceof Date ? date$1 : isNumberArray(b) ? numberArray : Array.isArray(b) ? genericArray : typeof b.valueOf !== "function" && typeof b.toString !== "function" || isNaN(b) ? object$1 : interpolateNumber)(a2, b); } function discrete(range2) { var n = range2.length; return function(t) { return range2[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; }; } function hue(a2, b) { var i = hue$1(+a2, +b); return function(t) { var x2 = i(t); return x2 - 360 * Math.floor(x2 / 360); }; } function interpolateRound(a2, b) { return a2 = +a2, b = +b, function(t) { return Math.round(a2 * (1 - t) + b * t); }; } var degrees$1 = 180 / Math.PI; var identity$7 = { translateX: 0, translateY: 0, rotate: 0, skewX: 0, scaleX: 1, scaleY: 1 }; function decompose(a2, b, c2, d, e, f) { var scaleX, scaleY, skewX; if (scaleX = Math.sqrt(a2 * a2 + b * b)) a2 /= scaleX, b /= scaleX; if (skewX = a2 * c2 + b * d) c2 -= a2 * skewX, d -= b * skewX; if (scaleY = Math.sqrt(c2 * c2 + d * d)) c2 /= scaleY, d /= scaleY, skewX /= scaleY; if (a2 * d < b * c2) a2 = -a2, b = -b, skewX = -skewX, scaleX = -scaleX; return { translateX: e, translateY: f, rotate: Math.atan2(b, a2) * degrees$1, skewX: Math.atan(skewX) * degrees$1, scaleX, scaleY }; } var svgNode; function parseCss(value) { const m2 = new (typeof DOMMatrix === "function" ? DOMMatrix : WebKitCSSMatrix)(value + ""); return m2.isIdentity ? identity$7 : decompose(m2.a, m2.b, m2.c, m2.d, m2.e, m2.f); } function parseSvg(value) { if (value == null) return identity$7; if (!svgNode) svgNode = document.createElementNS("http://www.w3.org/2000/svg", "g"); svgNode.setAttribute("transform", value); if (!(value = svgNode.transform.baseVal.consolidate())) return identity$7; value = value.matrix; return decompose(value.a, value.b, value.c, value.d, value.e, value.f); } function interpolateTransform(parse2, pxComma, pxParen, degParen) { function pop(s2) { return s2.length ? s2.pop() + " " : ""; } function translate(xa, ya, xb, yb, s2, q) { if (xa !== xb || ya !== yb) { var i = s2.push("translate(", null, pxComma, null, pxParen); q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); } else if (xb || yb) { s2.push("translate(" + xb + pxComma + yb + pxParen); } } function rotate(a2, b, s2, q) { if (a2 !== b) { if (a2 - b > 180) b += 360; else if (b - a2 > 180) a2 += 360; q.push({ i: s2.push(pop(s2) + "rotate(", null, degParen) - 2, x: interpolateNumber(a2, b) }); } else if (b) { s2.push(pop(s2) + "rotate(" + b + degParen); } } function skewX(a2, b, s2, q) { if (a2 !== b) { q.push({ i: s2.push(pop(s2) + "skewX(", null, degParen) - 2, x: interpolateNumber(a2, b) }); } else if (b) { s2.push(pop(s2) + "skewX(" + b + degParen); } } function scale(xa, ya, xb, yb, s2, q) { if (xa !== xb || ya !== yb) { var i = s2.push(pop(s2) + "scale(", null, ",", null, ")"); q.push({ i: i - 4, x: interpolateNumber(xa, xb) }, { i: i - 2, x: interpolateNumber(ya, yb) }); } else if (xb !== 1 || yb !== 1) { s2.push(pop(s2) + "scale(" + xb + "," + yb + ")"); } } return function(a2, b) { var s2 = [], q = []; a2 = parse2(a2), b = parse2(b); translate(a2.translateX, a2.translateY, b.translateX, b.translateY, s2, q); rotate(a2.rotate, b.rotate, s2, q); skewX(a2.skewX, b.skewX, s2, q); scale(a2.scaleX, a2.scaleY, b.scaleX, b.scaleY, s2, q); a2 = b = null; return function(t) { var i = -1, n = q.length, o; while (++i < n) s2[(o = q[i]).i] = o.x(t); return s2.join(""); }; }; } var interpolateTransformCss = interpolateTransform(parseCss, "px, ", "px)", "deg)"); var interpolateTransformSvg = interpolateTransform(parseSvg, ", ", ")", ")"); var epsilon2$1 = 1e-12; function cosh(x2) { return ((x2 = Math.exp(x2)) + 1 / x2) / 2; } function sinh(x2) { return ((x2 = Math.exp(x2)) - 1 / x2) / 2; } function tanh(x2) { return ((x2 = Math.exp(2 * x2)) - 1) / (x2 + 1); } const interpolateZoom = function zoomRho(rho, rho2, rho4) { function zoom2(p02, p1) { var ux0 = p02[0], uy0 = p02[1], w0 = p02[2], ux1 = p1[0], uy1 = p1[1], w1 = p1[2], dx = ux1 - ux0, dy = uy1 - uy0, d2 = dx * dx + dy * dy, i, S; if (d2 < epsilon2$1) { S = Math.log(w1 / w0) / rho; i = function(t) { return [ ux0 + t * dx, uy0 + t * dy, w0 * Math.exp(rho * t * S) ]; }; } else { var d1 = Math.sqrt(d2), b02 = (w1 * w1 - w0 * w0 + rho4 * d2) / (2 * w0 * rho2 * d1), b12 = (w1 * w1 - w0 * w0 - rho4 * d2) / (2 * w1 * rho2 * d1), r0 = Math.log(Math.sqrt(b02 * b02 + 1) - b02), r1 = Math.log(Math.sqrt(b12 * b12 + 1) - b12); S = (r1 - r0) / rho; i = function(t) { var s2 = t * S, coshr0 = cosh(r0), u2 = w0 / (rho2 * d1) * (coshr0 * tanh(rho * s2 + r0) - sinh(r0)); return [ ux0 + u2 * dx, uy0 + u2 * dy, w0 * coshr0 / cosh(rho * s2 + r0) ]; }; } i.duration = S * 1e3 * rho / Math.SQRT2; return i; } zoom2.rho = function(_2) { var _1 = Math.max(1e-3, +_2), _22 = _1 * _1, _4 = _22 * _22; return zoomRho(_1, _22, _4); }; return zoom2; }(Math.SQRT2, 2, 4); function hsl(hue2) { return function(start2, end2) { var h = hue2((start2 = hsl$2(start2)).h, (end2 = hsl$2(end2)).h), s2 = nogamma(start2.s, end2.s), l = nogamma(start2.l, end2.l), opacity = nogamma(start2.opacity, end2.opacity); return function(t) { start2.h = h(t); start2.s = s2(t); start2.l = l(t); start2.opacity = opacity(t); return start2 + ""; }; }; } const hsl$1 = hsl(hue$1); var hslLong = hsl(nogamma); function lab(start2, end2) { var l = nogamma((start2 = lab$1(start2)).l, (end2 = lab$1(end2)).l), a2 = nogamma(start2.a, end2.a), b = nogamma(start2.b, end2.b), opacity = nogamma(start2.opacity, end2.opacity); return function(t) { start2.l = l(t); start2.a = a2(t); start2.b = b(t); start2.opacity = opacity(t); return start2 + ""; }; } function hcl(hue2) { return function(start2, end2) { var h = hue2((start2 = hcl$1(start2)).h, (end2 = hcl$1(end2)).h), c2 = nogamma(start2.c, end2.c), l = nogamma(start2.l, end2.l), opacity = nogamma(start2.opacity, end2.opacity); return function(t) { start2.h = h(t); start2.c = c2(t); start2.l = l(t); start2.opacity = opacity(t); return start2 + ""; }; }; } const interpolateHcl = hcl(hue$1); var hclLong = hcl(nogamma); function cubehelix$1(hue2) { return function cubehelixGamma(y2) { y2 = +y2; function cubehelix2(start2, end2) { var h = hue2((start2 = cubehelix$3(start2)).h, (end2 = cubehelix$3(end2)).h), s2 = nogamma(start2.s, end2.s), l = nogamma(start2.l, end2.l), opacity = nogamma(start2.opacity, end2.opacity); return function(t) { start2.h = h(t); start2.s = s2(t); start2.l = l(Math.pow(t, y2)); start2.opacity = opacity(t); return start2 + ""; }; } cubehelix2.gamma = cubehelixGamma; return cubehelix2; }(1); } const cubehelix$2 = cubehelix$1(hue$1); var cubehelixLong = cubehelix$1(nogamma); function piecewise(interpolate2, values) { if (values === void 0) values = interpolate2, interpolate2 = interpolate$2; var i = 0, n = values.length - 1, v = values[0], I = new Array(n < 0 ? 0 : n); while (i < n) I[i] = interpolate2(v, v = values[++i]); return function(t) { var i2 = Math.max(0, Math.min(n - 1, Math.floor(t *= n))); return I[i2](t - i2); }; } function quantize$1(interpolator, n) { var samples = new Array(n); for (var i = 0; i < n; ++i) samples[i] = interpolator(i / (n - 1)); return samples; } var frame = 0, timeout$1 = 0, interval$1 = 0, pokeDelay = 1e3, taskHead, taskTail, clockLast = 0, clockNow = 0, clockSkew = 0, clock = typeof performance === "object" && performance.now ? performance : Date, setFrame = typeof window === "object" && window.requestAnimationFrame ? window.requestAnimationFrame.bind(window) : function(f) { setTimeout(f, 17); }; function now() { return clockNow || (setFrame(clearNow), clockNow = clock.now() + clockSkew); } function clearNow() { clockNow = 0; } function Timer() { this._call = this._time = this._next = null; } Timer.prototype = timer.prototype = { constructor: Timer, restart: function(callback, delay, time2) { if (typeof callback !== "function") throw new TypeError("callback is not a function"); time2 = (time2 == null ? now() : +time2) + (delay == null ? 0 : +delay); if (!this._next && taskTail !== this) { if (taskTail) taskTail._next = this; else taskHead = this; taskTail = this; } this._call = callback; this._time = time2; sleep(); }, stop: function() { if (this._call) { this._call = null; this._time = Infinity; sleep(); } } }; function timer(callback, delay, time2) { var t = new Timer(); t.restart(callback, delay, time2); return t; } function timerFlush() { now(); ++frame; var t = taskHead, e; while (t) { if ((e = clockNow - t._time) >= 0) t._call.call(void 0, e); t = t._next; } --frame; } function wake() { clockNow = (clockLast = clock.now()) + clockSkew; frame = timeout$1 = 0; try { timerFlush(); } finally { frame = 0; nap(); clockNow = 0; } } function poke() { var now2 = clock.now(), delay = now2 - clockLast; if (delay > pokeDelay) clockSkew -= delay, clockLast = now2; } function nap() { var t02, t12 = taskHead, t22, time2 = Infinity; while (t12) { if (t12._call) { if (time2 > t12._time) time2 = t12._time; t02 = t12, t12 = t12._next; } else { t22 = t12._next, t12._next = null; t12 = t02 ? t02._next = t22 : taskHead = t22; } } taskTail = t02; sleep(time2); } function sleep(time2) { if (frame) return; if (timeout$1) timeout$1 = clearTimeout(timeout$1); var delay = time2 - clockNow; if (delay > 24) { if (time2 < Infinity) timeout$1 = setTimeout(wake, time2 - clock.now() - clockSkew); if (interval$1) interval$1 = clearInterval(interval$1); } else { if (!interval$1) clockLast = clock.now(), interval$1 = setInterval(poke, pokeDelay); frame = 1, setFrame(wake); } } function timeout(callback, delay, time2) { var t = new Timer(); delay = delay == null ? 0 : +delay; t.restart((elapsed) => { t.stop(); callback(elapsed + delay); }, delay, time2); return t; } function interval(callback, delay, time2) { var t = new Timer(), total = delay; if (delay == null) return t.restart(callback, delay, time2), t; t._restart = t.restart; t.restart = function(callback2, delay2, time3) { delay2 = +delay2, time3 = time3 == null ? now() : +time3; t._restart(function tick(elapsed) { elapsed += total; t._restart(tick, total += delay2, time3); callback2(elapsed); }, delay2, time3); }; t.restart(callback, delay, time2); return t; } var emptyOn = dispatch("start", "end", "cancel", "interrupt"); var emptyTween = []; var CREATED = 0; var SCHEDULED = 1; var STARTING = 2; var STARTED = 3; var RUNNING = 4; var ENDING = 5; var ENDED = 6; function schedule(node2, name2, id2, index2, group2, timing) { var schedules = node2.__transition; if (!schedules) node2.__transition = {}; else if (id2 in schedules) return; create$1(node2, id2, { name: name2, index: index2, group: group2, on: emptyOn, tween: emptyTween, time: timing.time, delay: timing.delay, duration: timing.duration, ease: timing.ease, timer: null, state: CREATED }); } function init$1(node2, id2) { var schedule2 = get(node2, id2); if (schedule2.state > CREATED) throw new Error("too late; already scheduled"); return schedule2; } function set(node2, id2) { var schedule2 = get(node2, id2); if (schedule2.state > STARTED) throw new Error("too late; already running"); return schedule2; } function get(node2, id2) { var schedule2 = node2.__transition; if (!schedule2 || !(schedule2 = schedule2[id2])) throw new Error("transition not found"); return schedule2; } function create$1(node2, id2, self2) { var schedules = node2.__transition, tween; schedules[id2] = self2; self2.timer = timer(schedule2, 0, self2.time); function schedule2(elapsed) { self2.state = SCHEDULED; self2.timer.restart(start2, self2.delay, self2.time); if (self2.delay <= elapsed) start2(elapsed - self2.delay); } function start2(elapsed) { var i, j, n, o; if (self2.state !== SCHEDULED) return stop(); for (i in schedules) { o = schedules[i]; if (o.name !== self2.name) continue; if (o.state === STARTED) return timeout(start2); if (o.state === RUNNING) { o.state = ENDED; o.timer.stop(); o.on.call("interrupt", node2, node2.__data__, o.index, o.group); delete schedules[i]; } else if (+i < id2) { o.state = ENDED; o.timer.stop(); o.on.call("cancel", node2, node2.__data__, o.index, o.group); delete schedules[i]; } } timeout(function() { if (self2.state === STARTED) { self2.state = RUNNING; self2.timer.restart(tick, self2.delay, self2.time); tick(elapsed); } }); self2.state = STARTING; self2.on.call("start", node2, node2.__data__, self2.index, self2.group); if (self2.state !== STARTING) return; self2.state = STARTED; tween = new Array(n = self2.tween.length); for (i = 0, j = -1; i < n; ++i) { if (o = self2.tween[i].value.call(node2, node2.__data__, self2.index, self2.group)) { tween[++j] = o; } } tween.length = j + 1; } function tick(elapsed) { var t = elapsed < self2.duration ? self2.ease.call(null, elapsed / self2.duration) : (self2.timer.restart(stop), self2.state = ENDING, 1), i = -1, n = tween.length; while (++i < n) { tween[i].call(node2, t); } if (self2.state === ENDING) { self2.on.call("end", node2, node2.__data__, self2.index, self2.group); stop(); } } function stop() { self2.state = ENDED; self2.timer.stop(); delete schedules[id2]; for (var i in schedules) return; delete node2.__transition; } } function interrupt(node2, name2) { var schedules = node2.__transition, schedule2, active2, empty2 = true, i; if (!schedules) return; name2 = name2 == null ? null : name2 + ""; for (i in schedules) { if ((schedule2 = schedules[i]).name !== name2) { empty2 = false; continue; } active2 = schedule2.state > STARTING && schedule2.state < ENDING; schedule2.state = ENDED; schedule2.timer.stop(); schedule2.on.call(active2 ? "interrupt" : "cancel", node2, node2.__data__, schedule2.index, schedule2.group); delete schedules[i]; } if (empty2) delete node2.__transition; } function selection_interrupt(name2) { return this.each(function() { interrupt(this, name2); }); } function tweenRemove(id2, name2) { var tween0, tween1; return function() { var schedule2 = set(this, id2), tween = schedule2.tween; if (tween !== tween0) { tween1 = tween0 = tween; for (var i = 0, n = tween1.length; i < n; ++i) { if (tween1[i].name === name2) { tween1 = tween1.slice(); tween1.splice(i, 1); break; } } } schedule2.tween = tween1; }; } function tweenFunction(id2, name2, value) { var tween0, tween1; if (typeof value !== "function") throw new Error(); return function() { var schedule2 = set(this, id2), tween = schedule2.tween; if (tween !== tween0) { tween1 = (tween0 = tween).slice(); for (var t = { name: name2, value }, i = 0, n = tween1.length; i < n; ++i) { if (tween1[i].name === name2) { tween1[i] = t; break; } } if (i === n) tween1.push(t); } schedule2.tween = tween1; }; } function transition_tween(name2, value) { var id2 = this._id; name2 += ""; if (arguments.length < 2) { var tween = get(this.node(), id2).tween; for (var i = 0, n = tween.length, t; i < n; ++i) { if ((t = tween[i]).name === name2) { return t.value; } } return null; } return this.each((value == null ? tweenRemove : tweenFunction)(id2, name2, value)); } function tweenValue(transition2, name2, value) { var id2 = transition2._id; transition2.each(function() { var schedule2 = set(this, id2); (schedule2.value || (schedule2.value = {}))[name2] = value.apply(this, arguments); }); return function(node2) { return get(node2, id2).value[name2]; }; } function interpolate$1(a2, b) { var c2; return (typeof b === "number" ? interpolateNumber : b instanceof color ? interpolateRgb : (c2 = color(b)) ? (b = c2, interpolateRgb) : interpolateString)(a2, b); } function attrRemove(name2) { return function() { this.removeAttribute(name2); }; } function attrRemoveNS(fullname) { return function() { this.removeAttributeNS(fullname.space, fullname.local); }; } function attrConstant(name2, interpolate2, value1) { var string00, string1 = value1 + "", interpolate0; return function() { var string0 = this.getAttribute(name2); return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, value1); }; } function attrConstantNS(fullname, interpolate2, value1) { var string00, string1 = value1 + "", interpolate0; return function() { var string0 = this.getAttributeNS(fullname.space, fullname.local); return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, value1); }; } function attrFunction(name2, interpolate2, value) { var string00, string10, interpolate0; return function() { var string0, value1 = value(this), string1; if (value1 == null) return void this.removeAttribute(name2); string0 = this.getAttribute(name2); string1 = value1 + ""; return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate2(string00 = string0, value1)); }; } function attrFunctionNS(fullname, interpolate2, value) { var string00, string10, interpolate0; return function() { var string0, value1 = value(this), string1; if (value1 == null) return void this.removeAttributeNS(fullname.space, fullname.local); string0 = this.getAttributeNS(fullname.space, fullname.local); string1 = value1 + ""; return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate2(string00 = string0, value1)); }; } function transition_attr(name2, value) { var fullname = namespace(name2), i = fullname === "transform" ? interpolateTransformSvg : interpolate$1; return this.attrTween(name2, typeof value === "function" ? (fullname.local ? attrFunctionNS : attrFunction)(fullname, i, tweenValue(this, "attr." + name2, value)) : value == null ? (fullname.local ? attrRemoveNS : attrRemove)(fullname) : (fullname.local ? attrConstantNS : attrConstant)(fullname, i, value)); } function attrInterpolate(name2, i) { return function(t) { this.setAttribute(name2, i.call(this, t)); }; } function attrInterpolateNS(fullname, i) { return function(t) { this.setAttributeNS(fullname.space, fullname.local, i.call(this, t)); }; } function attrTweenNS(fullname, value) { var t02, i0; function tween() { var i = value.apply(this, arguments); if (i !== i0) t02 = (i0 = i) && attrInterpolateNS(fullname, i); return t02; } tween._value = value; return tween; } function attrTween(name2, value) { var t02, i0; function tween() { var i = value.apply(this, arguments); if (i !== i0) t02 = (i0 = i) && attrInterpolate(name2, i); return t02; } tween._value = value; return tween; } function transition_attrTween(name2, value) { var key = "attr." + name2; if (arguments.length < 2) return (key = this.tween(key)) && key._value; if (value == null) return this.tween(key, null); if (typeof value !== "function") throw new Error(); var fullname = namespace(name2); return this.tween(key, (fullname.local ? attrTweenNS : attrTween)(fullname, value)); } function delayFunction(id2, value) { return function() { init$1(this, id2).delay = +value.apply(this, arguments); }; } function delayConstant(id2, value) { return value = +value, function() { init$1(this, id2).delay = value; }; } function transition_delay(value) { var id2 = this._id; return arguments.length ? this.each((typeof value === "function" ? delayFunction : delayConstant)(id2, value)) : get(this.node(), id2).delay; } function durationFunction(id2, value) { return function() { set(this, id2).duration = +value.apply(this, arguments); }; } function durationConstant(id2, value) { return value = +value, function() { set(this, id2).duration = value; }; } function transition_duration(value) { var id2 = this._id; return arguments.length ? this.each((typeof value === "function" ? durationFunction : durationConstant)(id2, value)) : get(this.node(), id2).duration; } function easeConstant(id2, value) { if (typeof value !== "function") throw new Error(); return function() { set(this, id2).ease = value; }; } function transition_ease(value) { var id2 = this._id; return arguments.length ? this.each(easeConstant(id2, value)) : get(this.node(), id2).ease; } function easeVarying(id2, value) { return function() { var v = value.apply(this, arguments); if (typeof v !== "function") throw new Error(); set(this, id2).ease = v; }; } function transition_easeVarying(value) { if (typeof value !== "function") throw new Error(); return this.each(easeVarying(this._id, value)); } function transition_filter(match) { if (typeof match !== "function") match = matcher(match); for (var groups2 = this._groups, m2 = groups2.length, subgroups = new Array(m2), j = 0; j < m2; ++j) { for (var group2 = groups2[j], n = group2.length, subgroup = subgroups[j] = [], node2, i = 0; i < n; ++i) { if ((node2 = group2[i]) && match.call(node2, node2.__data__, i, group2)) { subgroup.push(node2); } } } return new Transition(subgroups, this._parents, this._name, this._id); } function transition_merge(transition2) { if (transition2._id !== this._id) throw new Error(); for (var groups0 = this._groups, groups1 = transition2._groups, m0 = groups0.length, m1 = groups1.length, m2 = Math.min(m0, m1), merges = new Array(m0), j = 0; j < m2; ++j) { for (var group0 = groups0[j], group1 = groups1[j], n = group0.length, merge2 = merges[j] = new Array(n), node2, i = 0; i < n; ++i) { if (node2 = group0[i] || group1[i]) { merge2[i] = node2; } } } for (; j < m0; ++j) { merges[j] = groups0[j]; } return new Transition(merges, this._parents, this._name, this._id); } function start$1(name2) { return (name2 + "").trim().split(/^|\s+/).every(function(t) { var i = t.indexOf("."); if (i >= 0) t = t.slice(0, i); return !t || t === "start"; }); } function onFunction(id2, name2, listener) { var on0, on1, sit = start$1(name2) ? init$1 : set; return function() { var schedule2 = sit(this, id2), on = schedule2.on; if (on !== on0) (on1 = (on0 = on).copy()).on(name2, listener); schedule2.on = on1; }; } function transition_on(name2, listener) { var id2 = this._id; return arguments.length < 2 ? get(this.node(), id2).on.on(name2) : this.each(onFunction(id2, name2, listener)); } function removeFunction(id2) { return function() { var parent = this.parentNode; for (var i in this.__transition) if (+i !== id2) return; if (parent) parent.removeChild(this); }; } function transition_remove() { return this.on("end.remove", removeFunction(this._id)); } function transition_select(select2) { var name2 = this._name, id2 = this._id; if (typeof select2 !== "function") select2 = selector(select2); for (var groups2 = this._groups, m2 = groups2.length, subgroups = new Array(m2), j = 0; j < m2; ++j) { for (var group2 = groups2[j], n = group2.length, subgroup = subgroups[j] = new Array(n), node2, subnode, i = 0; i < n; ++i) { if ((node2 = group2[i]) && (subnode = select2.call(node2, node2.__data__, i, group2))) { if ("__data__" in node2) subnode.__data__ = node2.__data__; subgroup[i] = subnode; schedule(subgroup[i], name2, id2, i, subgroup, get(node2, id2)); } } } return new Transition(subgroups, this._parents, name2, id2); } function transition_selectAll(select2) { var name2 = this._name, id2 = this._id; if (typeof select2 !== "function") select2 = selectorAll(select2); for (var groups2 = this._groups, m2 = groups2.length, subgroups = [], parents2 = [], j = 0; j < m2; ++j) { for (var group2 = groups2[j], n = group2.length, node2, i = 0; i < n; ++i) { if (node2 = group2[i]) { for (var children2 = select2.call(node2, node2.__data__, i, group2), child, inherit2 = get(node2, id2), k2 = 0, l = children2.length; k2 < l; ++k2) { if (child = children2[k2]) { schedule(child, name2, id2, k2, children2, inherit2); } } subgroups.push(children2); parents2.push(node2); } } } return new Transition(subgroups, parents2, name2, id2); } var Selection = selection.prototype.constructor; function transition_selection() { return new Selection(this._groups, this._parents); } function styleNull(name2, interpolate2) { var string00, string10, interpolate0; return function() { var string0 = styleValue(this, name2), string1 = (this.style.removeProperty(name2), styleValue(this, name2)); return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, string10 = string1); }; } function styleRemove(name2) { return function() { this.style.removeProperty(name2); }; } function styleConstant(name2, interpolate2, value1) { var string00, string1 = value1 + "", interpolate0; return function() { var string0 = styleValue(this, name2); return string0 === string1 ? null : string0 === string00 ? interpolate0 : interpolate0 = interpolate2(string00 = string0, value1); }; } function styleFunction(name2, interpolate2, value) { var string00, string10, interpolate0; return function() { var string0 = styleValue(this, name2), value1 = value(this), string1 = value1 + ""; if (value1 == null) string1 = value1 = (this.style.removeProperty(name2), styleValue(this, name2)); return string0 === string1 ? null : string0 === string00 && string1 === string10 ? interpolate0 : (string10 = string1, interpolate0 = interpolate2(string00 = string0, value1)); }; } function styleMaybeRemove(id2, name2) { var on0, on1, listener0, key = "style." + name2, event = "end." + key, remove2; return function() { var schedule2 = set(this, id2), on = schedule2.on, listener = schedule2.value[key] == null ? remove2 || (remove2 = styleRemove(name2)) : void 0; if (on !== on0 || listener0 !== listener) (on1 = (on0 = on).copy()).on(event, listener0 = listener); schedule2.on = on1; }; } function transition_style(name2, value, priority) { var i = (name2 += "") === "transform" ? interpolateTransformCss : interpolate$1; return value == null ? this.styleTween(name2, styleNull(name2, i)).on("end.style." + name2, styleRemove(name2)) : typeof value === "function" ? this.styleTween(name2, styleFunction(name2, i, tweenValue(this, "style." + name2, value))).each(styleMaybeRemove(this._id, name2)) : this.styleTween(name2, styleConstant(name2, i, value), priority).on("end.style." + name2, null); } function styleInterpolate(name2, i, priority) { return function(t) { this.style.setProperty(name2, i.call(this, t), priority); }; } function styleTween(name2, value, priority) { var t, i0; function tween() { var i = value.apply(this, arguments); if (i !== i0) t = (i0 = i) && styleInterpolate(name2, i, priority); return t; } tween._value = value; return tween; } function transition_styleTween(name2, value, priority) { var key = "style." + (name2 += ""); if (arguments.length < 2) return (key = this.tween(key)) && key._value; if (value == null) return this.tween(key, null); if (typeof value !== "function") throw new Error(); return this.tween(key, styleTween(name2, value, priority == null ? "" : priority)); } function textConstant(value) { return function() { this.textContent = value; }; } function textFunction(value) { return function() { var value1 = value(this); this.textContent = value1 == null ? "" : value1; }; } function transition_text(value) { return this.tween("text", typeof value === "function" ? textFunction(tweenValue(this, "text", value)) : textConstant(value == null ? "" : value + "")); } function textInterpolate(i) { return function(t) { this.textContent = i.call(this, t); }; } function textTween(value) { var t02, i0; function tween() { var i = value.apply(this, arguments); if (i !== i0) t02 = (i0 = i) && textInterpolate(i); return t02; } tween._value = value; return tween; } function transition_textTween(value) { var key = "text"; if (arguments.length < 1) return (key = this.tween(key)) && key._value; if (value == null) return this.tween(key, null); if (typeof value !== "function") throw new Error(); return this.tween(key, textTween(value)); } function transition_transition() { var name2 = this._name, id0 = this._id, id1 = newId(); for (var groups2 = this._groups, m2 = groups2.length, j = 0; j < m2; ++j) { for (var group2 = groups2[j], n = group2.length, node2, i = 0; i < n; ++i) { if (node2 = group2[i]) { var inherit2 = get(node2, id0); schedule(node2, name2, id1, i, group2, { time: inherit2.time + inherit2.delay + inherit2.duration, delay: 0, duration: inherit2.duration, ease: inherit2.ease }); } } } return new Transition(groups2, this._parents, name2, id1); } function transition_end() { var on0, on1, that = this, id2 = that._id, size = that.size(); return new Promise(function(resolve, reject) { var cancel = { value: reject }, end2 = { value: function() { if (--size === 0) resolve(); } }; that.each(function() { var schedule2 = set(this, id2), on = schedule2.on; if (on !== on0) { on1 = (on0 = on).copy(); on1._.cancel.push(cancel); on1._.interrupt.push(cancel); on1._.end.push(end2); } schedule2.on = on1; }); if (size === 0) resolve(); }); } var id = 0; function Transition(groups2, parents2, name2, id2) { this._groups = groups2; this._parents = parents2; this._name = name2; this._id = id2; } function transition(name2) { return selection().transition(name2); } function newId() { return ++id; } var selection_prototype = selection.prototype; Transition.prototype = transition.prototype = { constructor: Transition, select: transition_select, selectAll: transition_selectAll, selectChild: selection_prototype.selectChild, selectChildren: selection_prototype.selectChildren, filter: transition_filter, merge: transition_merge, selection: transition_selection, transition: transition_transition, call: selection_prototype.call, nodes: selection_prototype.nodes, node: selection_prototype.node, size: selection_prototype.size, empty: selection_prototype.empty, each: selection_prototype.each, on: transition_on, attr: transition_attr, attrTween: transition_attrTween, style: transition_style, styleTween: transition_styleTween, text: transition_text, textTween: transition_textTween, remove: transition_remove, tween: transition_tween, delay: transition_delay, duration: transition_duration, ease: transition_ease, easeVarying: transition_easeVarying, end: transition_end, [Symbol.iterator]: selection_prototype[Symbol.iterator] }; const linear$1 = (t) => +t; function quadIn(t) { return t * t; } function quadOut(t) { return t * (2 - t); } function quadInOut(t) { return ((t *= 2) <= 1 ? t * t : --t * (2 - t) + 1) / 2; } function cubicIn(t) { return t * t * t; } function cubicOut(t) { return --t * t * t + 1; } function cubicInOut(t) { return ((t *= 2) <= 1 ? t * t * t : (t -= 2) * t * t + 2) / 2; } var exponent$1 = 3; var polyIn = function custom(e) { e = +e; function polyIn2(t) { return Math.pow(t, e); } polyIn2.exponent = custom; return polyIn2; }(exponent$1); var polyOut = function custom2(e) { e = +e; function polyOut2(t) { return 1 - Math.pow(1 - t, e); } polyOut2.exponent = custom2; return polyOut2; }(exponent$1); var polyInOut = function custom3(e) { e = +e; function polyInOut2(t) { return ((t *= 2) <= 1 ? Math.pow(t, e) : 2 - Math.pow(2 - t, e)) / 2; } polyInOut2.exponent = custom3; return polyInOut2; }(exponent$1); var pi$4 = Math.PI, halfPi$3 = pi$4 / 2; function sinIn(t) { return +t === 1 ? 1 : 1 - Math.cos(t * halfPi$3); } function sinOut(t) { return Math.sin(t * halfPi$3); } function sinInOut(t) { return (1 - Math.cos(pi$4 * t)) / 2; } function tpmt(x2) { return (Math.pow(2, -10 * x2) - 9765625e-10) * 1.0009775171065494; } function expIn(t) { return tpmt(1 - +t); } function expOut(t) { return 1 - tpmt(t); } function expInOut(t) { return ((t *= 2) <= 1 ? tpmt(1 - t) : 2 - tpmt(t - 1)) / 2; } function circleIn(t) { return 1 - Math.sqrt(1 - t * t); } function circleOut(t) { return Math.sqrt(1 - --t * t); } function circleInOut(t) { return ((t *= 2) <= 1 ? 1 - Math.sqrt(1 - t * t) : Math.sqrt(1 - (t -= 2) * t) + 1) / 2; } var b1 = 4 / 11, b2 = 6 / 11, b3 = 8 / 11, b4 = 3 / 4, b5 = 9 / 11, b6 = 10 / 11, b7 = 15 / 16, b8 = 21 / 22, b9 = 63 / 64, b0 = 1 / b1 / b1; function bounceIn(t) { return 1 - bounceOut(1 - t); } function bounceOut(t) { return (t = +t) < b1 ? b0 * t * t : t < b3 ? b0 * (t -= b2) * t + b4 : t < b6 ? b0 * (t -= b5) * t + b7 : b0 * (t -= b8) * t + b9; } function bounceInOut(t) { return ((t *= 2) <= 1 ? 1 - bounceOut(1 - t) : bounceOut(t - 1) + 1) / 2; } var overshoot = 1.70158; var backIn = function custom4(s2) { s2 = +s2; function backIn2(t) { return (t = +t) * t * (s2 * (t - 1) + t); } backIn2.overshoot = custom4; return backIn2; }(overshoot); var backOut = function custom5(s2) { s2 = +s2; function backOut2(t) { return --t * t * ((t + 1) * s2 + t) + 1; } backOut2.overshoot = custom5; return backOut2; }(overshoot); var backInOut = function custom6(s2) { s2 = +s2; function backInOut2(t) { return ((t *= 2) < 1 ? t * t * ((s2 + 1) * t - s2) : (t -= 2) * t * ((s2 + 1) * t + s2) + 2) / 2; } backInOut2.overshoot = custom6; return backInOut2; }(overshoot); var tau$5 = 2 * Math.PI, amplitude = 1, period = 0.3; var elasticIn = function custom7(a2, p) { var s2 = Math.asin(1 / (a2 = Math.max(1, a2))) * (p /= tau$5); function elasticIn2(t) { return a2 * tpmt(- --t) * Math.sin((s2 - t) / p); } elasticIn2.amplitude = function(a3) { return custom7(a3, p * tau$5); }; elasticIn2.period = function(p2) { return custom7(a2, p2); }; return elasticIn2; }(amplitude, period); var elasticOut = function custom8(a2, p) { var s2 = Math.asin(1 / (a2 = Math.max(1, a2))) * (p /= tau$5); function elasticOut2(t) { return 1 - a2 * tpmt(t = +t) * Math.sin((t + s2) / p); } elasticOut2.amplitude = function(a3) { return custom8(a3, p * tau$5); }; elasticOut2.period = function(p2) { return custom8(a2, p2); }; return elasticOut2; }(amplitude, period); var elasticInOut = function custom9(a2, p) { var s2 = Math.asin(1 / (a2 = Math.max(1, a2))) * (p /= tau$5); function elasticInOut2(t) { return ((t = t * 2 - 1) < 0 ? a2 * tpmt(-t) * Math.sin((s2 - t) / p) : 2 - a2 * tpmt(t) * Math.sin((s2 + t) / p)) / 2; } elasticInOut2.amplitude = function(a3) { return custom9(a3, p * tau$5); }; elasticInOut2.period = function(p2) { return custom9(a2, p2); }; return elasticInOut2; }(amplitude, period); var defaultTiming = { time: null, delay: 0, duration: 250, ease: cubicInOut }; function inherit(node2, id2) { var timing; while (!(timing = node2.__transition) || !(timing = timing[id2])) { if (!(node2 = node2.parentNode)) { throw new Error(`transition ${id2} not found`); } } return timing; } function selection_transition(name2) { var id2, timing; if (name2 instanceof Transition) { id2 = name2._id, name2 = name2._name; } else { id2 = newId(), (timing = defaultTiming).time = now(), name2 = name2 == null ? null : name2 + ""; } for (var groups2 = this._groups, m2 = groups2.length, j = 0; j < m2; ++j) { for (var group2 = groups2[j], n = group2.length, node2, i = 0; i < n; ++i) { if (node2 = group2[i]) { schedule(node2, name2, id2, i, group2, timing || inherit(node2, id2)); } } } return new Transition(groups2, this._parents, name2, id2); } selection.prototype.interrupt = selection_interrupt; selection.prototype.transition = selection_transition; var root$4 = [null]; function active(node2, name2) { var schedules = node2.__transition, schedule2, i; if (schedules) { name2 = name2 == null ? null : name2 + ""; for (i in schedules) { if ((schedule2 = schedules[i]).state > SCHEDULED && schedule2.name === name2) { return new Transition([[node2]], root$4, name2, +i); } } } return null; } const constant$7 = (x2) => () => x2; function BrushEvent(type2, { sourceEvent: sourceEvent2, target, selection: selection2, mode: mode2, dispatch: dispatch2 }) { Object.defineProperties(this, { type: { value: type2, enumerable: true, configurable: true }, sourceEvent: { value: sourceEvent2, enumerable: true, configurable: true }, target: { value: target, enumerable: true, configurable: true }, selection: { value: selection2, enumerable: true, configurable: true }, mode: { value: mode2, enumerable: true, configurable: true }, _: { value: dispatch2 } }); } function nopropagation$1(event) { event.stopImmediatePropagation(); } function noevent$1(event) { event.preventDefault(); event.stopImmediatePropagation(); } var MODE_DRAG = { name: "drag" }, MODE_SPACE = { name: "space" }, MODE_HANDLE = { name: "handle" }, MODE_CENTER = { name: "center" }; const { abs: abs$4, max: max$2, min: min$1 } = Math; function number1(e) { return [+e[0], +e[1]]; } function number2(e) { return [number1(e[0]), number1(e[1])]; } var X = { name: "x", handles: ["w", "e"].map(type$1), input: function(x2, e) { return x2 == null ? null : [[+x2[0], e[0][1]], [+x2[1], e[1][1]]]; }, output: function(xy) { return xy && [xy[0][0], xy[1][0]]; } }; var Y = { name: "y", handles: ["n", "s"].map(type$1), input: function(y2, e) { return y2 == null ? null : [[e[0][0], +y2[0]], [e[1][0], +y2[1]]]; }, output: function(xy) { return xy && [xy[0][1], xy[1][1]]; } }; var XY = { name: "xy", handles: ["n", "w", "e", "s", "nw", "ne", "sw", "se"].map(type$1), input: function(xy) { return xy == null ? null : number2(xy); }, output: function(xy) { return xy; } }; var cursors = { overlay: "crosshair", selection: "move", n: "ns-resize", e: "ew-resize", s: "ns-resize", w: "ew-resize", nw: "nwse-resize", ne: "nesw-resize", se: "nwse-resize", sw: "nesw-resize" }; var flipX = { e: "w", w: "e", nw: "ne", ne: "nw", se: "sw", sw: "se" }; var flipY = { n: "s", s: "n", nw: "sw", ne: "se", se: "ne", sw: "nw" }; var signsX = { overlay: 1, selection: 1, n: null, e: 1, s: null, w: -1, nw: -1, ne: 1, se: 1, sw: -1 }; var signsY = { overlay: 1, selection: 1, n: -1, e: null, s: 1, w: null, nw: -1, ne: -1, se: 1, sw: 1 }; function type$1(t) { return { type: t }; } function defaultFilter$1(event) { return !event.ctrlKey && !event.button; } function defaultExtent$1() { var svg2 = this.ownerSVGElement || this; if (svg2.hasAttribute("viewBox")) { svg2 = svg2.viewBox.baseVal; return [[svg2.x, svg2.y], [svg2.x + svg2.width, svg2.y + svg2.height]]; } return [[0, 0], [svg2.width.baseVal.value, svg2.height.baseVal.value]]; } function defaultTouchable$1() { return navigator.maxTouchPoints || "ontouchstart" in this; } function local(node2) { while (!node2.__brush) if (!(node2 = node2.parentNode)) return; return node2.__brush; } function empty(extent2) { return extent2[0][0] === extent2[1][0] || extent2[0][1] === extent2[1][1]; } function brushSelection(node2) { var state = node2.__brush; return state ? state.dim.output(state.selection) : null; } function brushX() { return brush$1(X); } function brushY() { return brush$1(Y); } function brush() { return brush$1(XY); } function brush$1(dim) { var extent2 = defaultExtent$1, filter2 = defaultFilter$1, touchable = defaultTouchable$1, keys = true, listeners = dispatch("start", "brush", "end"), handleSize = 6, touchending; function brush2(group2) { var overlay = group2.property("__brush", initialize2).selectAll(".overlay").data([type$1("overlay")]); overlay.enter().append("rect").attr("class", "overlay").attr("pointer-events", "all").attr("cursor", cursors.overlay).merge(overlay).each(function() { var extent3 = local(this).extent; select(this).attr("x", extent3[0][0]).attr("y", extent3[0][1]).attr("width", extent3[1][0] - extent3[0][0]).attr("height", extent3[1][1] - extent3[0][1]); }); group2.selectAll(".selection").data([type$1("selection")]).enter().append("rect").attr("class", "selection").attr("cursor", cursors.selection).attr("fill", "#777").attr("fill-opacity", 0.3).attr("stroke", "#fff").attr("shape-rendering", "crispEdges"); var handle = group2.selectAll(".handle").data(dim.handles, function(d) { return d.type; }); handle.exit().remove(); handle.enter().append("rect").attr("class", function(d) { return "handle handle--" + d.type; }).attr("cursor", function(d) { return cursors[d.type]; }); group2.each(redraw).attr("fill", "none").attr("pointer-events", "all").on("mousedown.brush", started).filter(touchable).on("touchstart.brush", started).on("touchmove.brush", touchmoved).on("touchend.brush touchcancel.brush", touchended).style("touch-action", "none").style("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); } brush2.move = function(group2, selection2, event) { if (group2.tween) { group2.on("start.brush", function(event2) { emitter(this, arguments).beforestart().start(event2); }).on("interrupt.brush end.brush", function(event2) { emitter(this, arguments).end(event2); }).tween("brush", function() { var that = this, state = that.__brush, emit = emitter(that, arguments), selection0 = state.selection, selection1 = dim.input(typeof selection2 === "function" ? selection2.apply(this, arguments) : selection2, state.extent), i = interpolate$2(selection0, selection1); function tween(t) { state.selection = t === 1 && selection1 === null ? null : i(t); redraw.call(that); emit.brush(); } return selection0 !== null && selection1 !== null ? tween : tween(1); }); } else { group2.each(function() { var that = this, args = arguments, state = that.__brush, selection1 = dim.input(typeof selection2 === "function" ? selection2.apply(that, args) : selection2, state.extent), emit = emitter(that, args).beforestart(); interrupt(that); state.selection = selection1 === null ? null : selection1; redraw.call(that); emit.start(event).brush(event).end(event); }); } }; brush2.clear = function(group2, event) { brush2.move(group2, null, event); }; function redraw() { var group2 = select(this), selection2 = local(this).selection; if (selection2) { group2.selectAll(".selection").style("display", null).attr("x", selection2[0][0]).attr("y", selection2[0][1]).attr("width", selection2[1][0] - selection2[0][0]).attr("height", selection2[1][1] - selection2[0][1]); group2.selectAll(".handle").style("display", null).attr("x", function(d) { return d.type[d.type.length - 1] === "e" ? selection2[1][0] - handleSize / 2 : selection2[0][0] - handleSize / 2; }).attr("y", function(d) { return d.type[0] === "s" ? selection2[1][1] - handleSize / 2 : selection2[0][1] - handleSize / 2; }).attr("width", function(d) { return d.type === "n" || d.type === "s" ? selection2[1][0] - selection2[0][0] + handleSize : handleSize; }).attr("height", function(d) { return d.type === "e" || d.type === "w" ? selection2[1][1] - selection2[0][1] + handleSize : handleSize; }); } else { group2.selectAll(".selection,.handle").style("display", "none").attr("x", null).attr("y", null).attr("width", null).attr("height", null); } } function emitter(that, args, clean) { var emit = that.__brush.emitter; return emit && (!clean || !emit.clean) ? emit : new Emitter(that, args, clean); } function Emitter(that, args, clean) { this.that = that; this.args = args; this.state = that.__brush; this.active = 0; this.clean = clean; } Emitter.prototype = { beforestart: function() { if (++this.active === 1) this.state.emitter = this, this.starting = true; return this; }, start: function(event, mode2) { if (this.starting) this.starting = false, this.emit("start", event, mode2); else this.emit("brush", event); return this; }, brush: function(event, mode2) { this.emit("brush", event, mode2); return this; }, end: function(event, mode2) { if (--this.active === 0) delete this.state.emitter, this.emit("end", event, mode2); return this; }, emit: function(type2, event, mode2) { var d = select(this.that).datum(); listeners.call( type2, this.that, new BrushEvent(type2, { sourceEvent: event, target: brush2, selection: dim.output(this.state.selection), mode: mode2, dispatch: listeners }), d ); } }; function started(event) { if (touchending && !event.touches) return; if (!filter2.apply(this, arguments)) return; var that = this, type2 = event.target.__data__.type, mode2 = (keys && event.metaKey ? type2 = "overlay" : type2) === "selection" ? MODE_DRAG : keys && event.altKey ? MODE_CENTER : MODE_HANDLE, signX = dim === Y ? null : signsX[type2], signY = dim === X ? null : signsY[type2], state = local(that), extent3 = state.extent, selection2 = state.selection, W = extent3[0][0], w0, w1, N = extent3[0][1], n0, n1, E2 = extent3[1][0], e0, e1, S = extent3[1][1], s0, s1, dx = 0, dy = 0, moving, shifting = signX && signY && keys && event.shiftKey, lockX, lockY, points = Array.from(event.touches || [event], (t) => { const i = t.identifier; t = pointer(t, that); t.point0 = t.slice(); t.identifier = i; return t; }); interrupt(that); var emit = emitter(that, arguments, true).beforestart(); if (type2 === "overlay") { if (selection2) moving = true; const pts = [points[0], points[1] || points[0]]; state.selection = selection2 = [[ w0 = dim === Y ? W : min$1(pts[0][0], pts[1][0]), n0 = dim === X ? N : min$1(pts[0][1], pts[1][1]) ], [ e0 = dim === Y ? E2 : max$2(pts[0][0], pts[1][0]), s0 = dim === X ? S : max$2(pts[0][1], pts[1][1]) ]]; if (points.length > 1) move(event); } else { w0 = selection2[0][0]; n0 = selection2[0][1]; e0 = selection2[1][0]; s0 = selection2[1][1]; } w1 = w0; n1 = n0; e1 = e0; s1 = s0; var group2 = select(that).attr("pointer-events", "none"); var overlay = group2.selectAll(".overlay").attr("cursor", cursors[type2]); if (event.touches) { emit.moved = moved; emit.ended = ended; } else { var view = select(event.view).on("mousemove.brush", moved, true).on("mouseup.brush", ended, true); if (keys) view.on("keydown.brush", keydowned, true).on("keyup.brush", keyupped, true); dragDisable(event.view); } redraw.call(that); emit.start(event, mode2.name); function moved(event2) { for (const p of event2.changedTouches || [event2]) { for (const d of points) if (d.identifier === p.identifier) d.cur = pointer(p, that); } if (shifting && !lockX && !lockY && points.length === 1) { const point2 = points[0]; if (abs$4(point2.cur[0] - point2[0]) > abs$4(point2.cur[1] - point2[1])) lockY = true; else lockX = true; } for (const point2 of points) if (point2.cur) point2[0] = point2.cur[0], point2[1] = point2.cur[1]; moving = true; noevent$1(event2); move(event2); } function move(event2) { const point2 = points[0], point0 = point2.point0; var t; dx = point2[0] - point0[0]; dy = point2[1] - point0[1]; switch (mode2) { case MODE_SPACE: case MODE_DRAG: { if (signX) dx = max$2(W - w0, min$1(E2 - e0, dx)), w1 = w0 + dx, e1 = e0 + dx; if (signY) dy = max$2(N - n0, min$1(S - s0, dy)), n1 = n0 + dy, s1 = s0 + dy; break; } case MODE_HANDLE: { if (points[1]) { if (signX) w1 = max$2(W, min$1(E2, points[0][0])), e1 = max$2(W, min$1(E2, points[1][0])), signX = 1; if (signY) n1 = max$2(N, min$1(S, points[0][1])), s1 = max$2(N, min$1(S, points[1][1])), signY = 1; } else { if (signX < 0) dx = max$2(W - w0, min$1(E2 - w0, dx)), w1 = w0 + dx, e1 = e0; else if (signX > 0) dx = max$2(W - e0, min$1(E2 - e0, dx)), w1 = w0, e1 = e0 + dx; if (signY < 0) dy = max$2(N - n0, min$1(S - n0, dy)), n1 = n0 + dy, s1 = s0; else if (signY > 0) dy = max$2(N - s0, min$1(S - s0, dy)), n1 = n0, s1 = s0 + dy; } break; } case MODE_CENTER: { if (signX) w1 = max$2(W, min$1(E2, w0 - dx * signX)), e1 = max$2(W, min$1(E2, e0 + dx * signX)); if (signY) n1 = max$2(N, min$1(S, n0 - dy * signY)), s1 = max$2(N, min$1(S, s0 + dy * signY)); break; } } if (e1 < w1) { signX *= -1; t = w0, w0 = e0, e0 = t; t = w1, w1 = e1, e1 = t; if (type2 in flipX) overlay.attr("cursor", cursors[type2 = flipX[type2]]); } if (s1 < n1) { signY *= -1; t = n0, n0 = s0, s0 = t; t = n1, n1 = s1, s1 = t; if (type2 in flipY) overlay.attr("cursor", cursors[type2 = flipY[type2]]); } if (state.selection) selection2 = state.selection; if (lockX) w1 = selection2[0][0], e1 = selection2[1][0]; if (lockY) n1 = selection2[0][1], s1 = selection2[1][1]; if (selection2[0][0] !== w1 || selection2[0][1] !== n1 || selection2[1][0] !== e1 || selection2[1][1] !== s1) { state.selection = [[w1, n1], [e1, s1]]; redraw.call(that); emit.brush(event2, mode2.name); } } function ended(event2) { nopropagation$1(event2); if (event2.touches) { if (event2.touches.length) return; if (touchending) clearTimeout(touchending); touchending = setTimeout(function() { touchending = null; }, 500); } else { yesdrag(event2.view, moving); view.on("keydown.brush keyup.brush mousemove.brush mouseup.brush", null); } group2.attr("pointer-events", "all"); overlay.attr("cursor", cursors.overlay); if (state.selection) selection2 = state.selection; if (empty(selection2)) state.selection = null, redraw.call(that); emit.end(event2, mode2.name); } function keydowned(event2) { switch (event2.keyCode) { case 16: { shifting = signX && signY; break; } case 18: { if (mode2 === MODE_HANDLE) { if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX; if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY; mode2 = MODE_CENTER; move(event2); } break; } case 32: { if (mode2 === MODE_HANDLE || mode2 === MODE_CENTER) { if (signX < 0) e0 = e1 - dx; else if (signX > 0) w0 = w1 - dx; if (signY < 0) s0 = s1 - dy; else if (signY > 0) n0 = n1 - dy; mode2 = MODE_SPACE; overlay.attr("cursor", cursors.selection); move(event2); } break; } default: return; } noevent$1(event2); } function keyupped(event2) { switch (event2.keyCode) { case 16: { if (shifting) { lockX = lockY = shifting = false; move(event2); } break; } case 18: { if (mode2 === MODE_CENTER) { if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1; if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1; mode2 = MODE_HANDLE; move(event2); } break; } case 32: { if (mode2 === MODE_SPACE) { if (event2.altKey) { if (signX) e0 = e1 - dx * signX, w0 = w1 + dx * signX; if (signY) s0 = s1 - dy * signY, n0 = n1 + dy * signY; mode2 = MODE_CENTER; } else { if (signX < 0) e0 = e1; else if (signX > 0) w0 = w1; if (signY < 0) s0 = s1; else if (signY > 0) n0 = n1; mode2 = MODE_HANDLE; } overlay.attr("cursor", cursors[type2]); move(event2); } break; } default: return; } noevent$1(event2); } } function touchmoved(event) { emitter(this, arguments).moved(event); } function touchended(event) { emitter(this, arguments).ended(event); } function initialize2() { var state = this.__brush || { selection: null }; state.extent = number2(extent2.apply(this, arguments)); state.dim = dim; return state; } brush2.extent = function(_2) { return arguments.length ? (extent2 = typeof _2 === "function" ? _2 : constant$7(number2(_2)), brush2) : extent2; }; brush2.filter = function(_2) { return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant$7(!!_2), brush2) : filter2; }; brush2.touchable = function(_2) { return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant$7(!!_2), brush2) : touchable; }; brush2.handleSize = function(_2) { return arguments.length ? (handleSize = +_2, brush2) : handleSize; }; brush2.keyModifiers = function(_2) { return arguments.length ? (keys = !!_2, brush2) : keys; }; brush2.on = function() { var value = listeners.on.apply(listeners, arguments); return value === listeners ? brush2 : value; }; return brush2; } var abs$3 = Math.abs; var cos$2 = Math.cos; var sin$2 = Math.sin; var pi$3 = Math.PI; var halfPi$2 = pi$3 / 2; var tau$4 = pi$3 * 2; var max$1 = Math.max; var epsilon$5 = 1e-12; function range$1(i, j) { return Array.from({ length: j - i }, (_2, k2) => i + k2); } function compareValue(compare) { return function(a2, b) { return compare( a2.source.value + a2.target.value, b.source.value + b.target.value ); }; } function chord() { return chord$1(false, false); } function chordTranspose() { return chord$1(false, true); } function chordDirected() { return chord$1(true, false); } function chord$1(directed, transpose2) { var padAngle = 0, sortGroups = null, sortSubgroups = null, sortChords = null; function chord2(matrix) { var n = matrix.length, groupSums = new Array(n), groupIndex = range$1(0, n), chords = new Array(n * n), groups2 = new Array(n), k2 = 0, dx; matrix = Float64Array.from({ length: n * n }, transpose2 ? (_2, i) => matrix[i % n][i / n | 0] : (_2, i) => matrix[i / n | 0][i % n]); for (let i = 0; i < n; ++i) { let x2 = 0; for (let j = 0; j < n; ++j) x2 += matrix[i * n + j] + directed * matrix[j * n + i]; k2 += groupSums[i] = x2; } k2 = max$1(0, tau$4 - padAngle * n) / k2; dx = k2 ? padAngle : tau$4 / n; { let x2 = 0; if (sortGroups) groupIndex.sort((a2, b) => sortGroups(groupSums[a2], groupSums[b])); for (const i of groupIndex) { const x02 = x2; if (directed) { const subgroupIndex = range$1(~n + 1, n).filter((j) => j < 0 ? matrix[~j * n + i] : matrix[i * n + j]); if (sortSubgroups) subgroupIndex.sort((a2, b) => sortSubgroups(a2 < 0 ? -matrix[~a2 * n + i] : matrix[i * n + a2], b < 0 ? -matrix[~b * n + i] : matrix[i * n + b])); for (const j of subgroupIndex) { if (j < 0) { const chord3 = chords[~j * n + i] || (chords[~j * n + i] = { source: null, target: null }); chord3.target = { index: i, startAngle: x2, endAngle: x2 += matrix[~j * n + i] * k2, value: matrix[~j * n + i] }; } else { const chord3 = chords[i * n + j] || (chords[i * n + j] = { source: null, target: null }); chord3.source = { index: i, startAngle: x2, endAngle: x2 += matrix[i * n + j] * k2, value: matrix[i * n + j] }; } } groups2[i] = { index: i, startAngle: x02, endAngle: x2, value: groupSums[i] }; } else { const subgroupIndex = range$1(0, n).filter((j) => matrix[i * n + j] || matrix[j * n + i]); if (sortSubgroups) subgroupIndex.sort((a2, b) => sortSubgroups(matrix[i * n + a2], matrix[i * n + b])); for (const j of subgroupIndex) { let chord3; if (i < j) { chord3 = chords[i * n + j] || (chords[i * n + j] = { source: null, target: null }); chord3.source = { index: i, startAngle: x2, endAngle: x2 += matrix[i * n + j] * k2, value: matrix[i * n + j] }; } else { chord3 = chords[j * n + i] || (chords[j * n + i] = { source: null, target: null }); chord3.target = { index: i, startAngle: x2, endAngle: x2 += matrix[i * n + j] * k2, value: matrix[i * n + j] }; if (i === j) chord3.source = chord3.target; } if (chord3.source && chord3.target && chord3.source.value < chord3.target.value) { const source = chord3.source; chord3.source = chord3.target; chord3.target = source; } } groups2[i] = { index: i, startAngle: x02, endAngle: x2, value: groupSums[i] }; } x2 += dx; } } chords = Object.values(chords); chords.groups = groups2; return sortChords ? chords.sort(sortChords) : chords; } chord2.padAngle = function(_2) { return arguments.length ? (padAngle = max$1(0, _2), chord2) : padAngle; }; chord2.sortGroups = function(_2) { return arguments.length ? (sortGroups = _2, chord2) : sortGroups; }; chord2.sortSubgroups = function(_2) { return arguments.length ? (sortSubgroups = _2, chord2) : sortSubgroups; }; chord2.sortChords = function(_2) { return arguments.length ? (_2 == null ? sortChords = null : (sortChords = compareValue(_2))._ = _2, chord2) : sortChords && sortChords._; }; return chord2; } const pi$2 = Math.PI, tau$3 = 2 * pi$2, epsilon$4 = 1e-6, tauEpsilon = tau$3 - epsilon$4; function Path$1() { this._x0 = this._y0 = this._x1 = this._y1 = null; this._ = ""; } function path() { return new Path$1(); } Path$1.prototype = path.prototype = { constructor: Path$1, moveTo: function(x2, y2) { this._ += "M" + (this._x0 = this._x1 = +x2) + "," + (this._y0 = this._y1 = +y2); }, closePath: function() { if (this._x1 !== null) { this._x1 = this._x0, this._y1 = this._y0; this._ += "Z"; } }, lineTo: function(x2, y2) { this._ += "L" + (this._x1 = +x2) + "," + (this._y1 = +y2); }, quadraticCurveTo: function(x12, y12, x2, y2) { this._ += "Q" + +x12 + "," + +y12 + "," + (this._x1 = +x2) + "," + (this._y1 = +y2); }, bezierCurveTo: function(x12, y12, x2, y2, x3, y3) { this._ += "C" + +x12 + "," + +y12 + "," + +x2 + "," + +y2 + "," + (this._x1 = +x3) + "," + (this._y1 = +y3); }, arcTo: function(x12, y12, x2, y2, r) { x12 = +x12, y12 = +y12, x2 = +x2, y2 = +y2, r = +r; var x02 = this._x1, y02 = this._y1, x21 = x2 - x12, y21 = y2 - y12, x01 = x02 - x12, y01 = y02 - y12, l01_2 = x01 * x01 + y01 * y01; if (r < 0) throw new Error("negative radius: " + r); if (this._x1 === null) { this._ += "M" + (this._x1 = x12) + "," + (this._y1 = y12); } else if (!(l01_2 > epsilon$4)) ; else if (!(Math.abs(y01 * x21 - y21 * x01) > epsilon$4) || !r) { this._ += "L" + (this._x1 = x12) + "," + (this._y1 = y12); } else { var x20 = x2 - x02, y20 = y2 - y02, l21_2 = x21 * x21 + y21 * y21, l20_2 = x20 * x20 + y20 * y20, l21 = Math.sqrt(l21_2), l01 = Math.sqrt(l01_2), l = r * Math.tan((pi$2 - Math.acos((l21_2 + l01_2 - l20_2) / (2 * l21 * l01))) / 2), t01 = l / l01, t21 = l / l21; if (Math.abs(t01 - 1) > epsilon$4) { this._ += "L" + (x12 + t01 * x01) + "," + (y12 + t01 * y01); } this._ += "A" + r + "," + r + ",0,0," + +(y01 * x20 > x01 * y20) + "," + (this._x1 = x12 + t21 * x21) + "," + (this._y1 = y12 + t21 * y21); } }, arc: function(x2, y2, r, a0, a1, ccw) { x2 = +x2, y2 = +y2, r = +r, ccw = !!ccw; var dx = r * Math.cos(a0), dy = r * Math.sin(a0), x02 = x2 + dx, y02 = y2 + dy, cw = 1 ^ ccw, da = ccw ? a0 - a1 : a1 - a0; if (r < 0) throw new Error("negative radius: " + r); if (this._x1 === null) { this._ += "M" + x02 + "," + y02; } else if (Math.abs(this._x1 - x02) > epsilon$4 || Math.abs(this._y1 - y02) > epsilon$4) { this._ += "L" + x02 + "," + y02; } if (!r) return; if (da < 0) da = da % tau$3 + tau$3; if (da > tauEpsilon) { this._ += "A" + r + "," + r + ",0,1," + cw + "," + (x2 - dx) + "," + (y2 - dy) + "A" + r + "," + r + ",0,1," + cw + "," + (this._x1 = x02) + "," + (this._y1 = y02); } else if (da > epsilon$4) { this._ += "A" + r + "," + r + ",0," + +(da >= pi$2) + "," + cw + "," + (this._x1 = x2 + r * Math.cos(a1)) + "," + (this._y1 = y2 + r * Math.sin(a1)); } }, rect: function(x2, y2, w2, h) { this._ += "M" + (this._x0 = this._x1 = +x2) + "," + (this._y0 = this._y1 = +y2) + "h" + +w2 + "v" + +h + "h" + -w2 + "Z"; }, toString: function() { return this._; } }; var slice$3 = Array.prototype.slice; function constant$6(x2) { return function() { return x2; }; } function defaultSource$1(d) { return d.source; } function defaultTarget(d) { return d.target; } function defaultRadius$1(d) { return d.radius; } function defaultStartAngle(d) { return d.startAngle; } function defaultEndAngle(d) { return d.endAngle; } function defaultPadAngle() { return 0; } function defaultArrowheadRadius() { return 10; } function ribbon(headRadius) { var source = defaultSource$1, target = defaultTarget, sourceRadius = defaultRadius$1, targetRadius = defaultRadius$1, startAngle = defaultStartAngle, endAngle = defaultEndAngle, padAngle = defaultPadAngle, context = null; function ribbon2() { var buffer2, s2 = source.apply(this, arguments), t = target.apply(this, arguments), ap = padAngle.apply(this, arguments) / 2, argv = slice$3.call(arguments), sr = +sourceRadius.apply(this, (argv[0] = s2, argv)), sa0 = startAngle.apply(this, argv) - halfPi$2, sa1 = endAngle.apply(this, argv) - halfPi$2, tr = +targetRadius.apply(this, (argv[0] = t, argv)), ta0 = startAngle.apply(this, argv) - halfPi$2, ta1 = endAngle.apply(this, argv) - halfPi$2; if (!context) context = buffer2 = path(); if (ap > epsilon$5) { if (abs$3(sa1 - sa0) > ap * 2 + epsilon$5) sa1 > sa0 ? (sa0 += ap, sa1 -= ap) : (sa0 -= ap, sa1 += ap); else sa0 = sa1 = (sa0 + sa1) / 2; if (abs$3(ta1 - ta0) > ap * 2 + epsilon$5) ta1 > ta0 ? (ta0 += ap, ta1 -= ap) : (ta0 -= ap, ta1 += ap); else ta0 = ta1 = (ta0 + ta1) / 2; } context.moveTo(sr * cos$2(sa0), sr * sin$2(sa0)); context.arc(0, 0, sr, sa0, sa1); if (sa0 !== ta0 || sa1 !== ta1) { if (headRadius) { var hr = +headRadius.apply(this, arguments), tr2 = tr - hr, ta2 = (ta0 + ta1) / 2; context.quadraticCurveTo(0, 0, tr2 * cos$2(ta0), tr2 * sin$2(ta0)); context.lineTo(tr * cos$2(ta2), tr * sin$2(ta2)); context.lineTo(tr2 * cos$2(ta1), tr2 * sin$2(ta1)); } else { context.quadraticCurveTo(0, 0, tr * cos$2(ta0), tr * sin$2(ta0)); context.arc(0, 0, tr, ta0, ta1); } } context.quadraticCurveTo(0, 0, sr * cos$2(sa0), sr * sin$2(sa0)); context.closePath(); if (buffer2) return context = null, buffer2 + "" || null; } if (headRadius) ribbon2.headRadius = function(_2) { return arguments.length ? (headRadius = typeof _2 === "function" ? _2 : constant$6(+_2), ribbon2) : headRadius; }; ribbon2.radius = function(_2) { return arguments.length ? (sourceRadius = targetRadius = typeof _2 === "function" ? _2 : constant$6(+_2), ribbon2) : sourceRadius; }; ribbon2.sourceRadius = function(_2) { return arguments.length ? (sourceRadius = typeof _2 === "function" ? _2 : constant$6(+_2), ribbon2) : sourceRadius; }; ribbon2.targetRadius = function(_2) { return arguments.length ? (targetRadius = typeof _2 === "function" ? _2 : constant$6(+_2), ribbon2) : targetRadius; }; ribbon2.startAngle = function(_2) { return arguments.length ? (startAngle = typeof _2 === "function" ? _2 : constant$6(+_2), ribbon2) : startAngle; }; ribbon2.endAngle = function(_2) { return arguments.length ? (endAngle = typeof _2 === "function" ? _2 : constant$6(+_2), ribbon2) : endAngle; }; ribbon2.padAngle = function(_2) { return arguments.length ? (padAngle = typeof _2 === "function" ? _2 : constant$6(+_2), ribbon2) : padAngle; }; ribbon2.source = function(_2) { return arguments.length ? (source = _2, ribbon2) : source; }; ribbon2.target = function(_2) { return arguments.length ? (target = _2, ribbon2) : target; }; ribbon2.context = function(_2) { return arguments.length ? (context = _2 == null ? null : _2, ribbon2) : context; }; return ribbon2; } function ribbon$1() { return ribbon(); } function ribbonArrow() { return ribbon(defaultArrowheadRadius); } var array$2 = Array.prototype; var slice$2 = array$2.slice; function ascending$1(a2, b) { return a2 - b; } function area$3(ring) { var i = 0, n = ring.length, area2 = ring[n - 1][1] * ring[0][0] - ring[n - 1][0] * ring[0][1]; while (++i < n) area2 += ring[i - 1][1] * ring[i][0] - ring[i - 1][0] * ring[i][1]; return area2; } const constant$5 = (x2) => () => x2; function contains$2(ring, hole) { var i = -1, n = hole.length, c2; while (++i < n) if (c2 = ringContains(ring, hole[i])) return c2; return 0; } function ringContains(ring, point2) { var x2 = point2[0], y2 = point2[1], contains2 = -1; for (var i = 0, n = ring.length, j = n - 1; i < n; j = i++) { var pi2 = ring[i], xi = pi2[0], yi = pi2[1], pj = ring[j], xj = pj[0], yj = pj[1]; if (segmentContains(pi2, pj, point2)) return 0; if (yi > y2 !== yj > y2 && x2 < (xj - xi) * (y2 - yi) / (yj - yi) + xi) contains2 = -contains2; } return contains2; } function segmentContains(a2, b, c2) { var i; return collinear$1(a2, b, c2) && within(a2[i = +(a2[0] === b[0])], c2[i], b[i]); } function collinear$1(a2, b, c2) { return (b[0] - a2[0]) * (c2[1] - a2[1]) === (c2[0] - a2[0]) * (b[1] - a2[1]); } function within(p, q, r) { return p <= q && q <= r || r <= q && q <= p; } function noop$2() { } var cases = [ [], [[[1, 1.5], [0.5, 1]]], [[[1.5, 1], [1, 1.5]]], [[[1.5, 1], [0.5, 1]]], [[[1, 0.5], [1.5, 1]]], [[[1, 1.5], [0.5, 1]], [[1, 0.5], [1.5, 1]]], [[[1, 0.5], [1, 1.5]]], [[[1, 0.5], [0.5, 1]]], [[[0.5, 1], [1, 0.5]]], [[[1, 1.5], [1, 0.5]]], [[[0.5, 1], [1, 0.5]], [[1.5, 1], [1, 1.5]]], [[[1.5, 1], [1, 0.5]]], [[[0.5, 1], [1.5, 1]]], [[[1, 1.5], [1.5, 1]]], [[[0.5, 1], [1, 1.5]]], [] ]; function Contours() { var dx = 1, dy = 1, threshold2 = thresholdSturges, smooth = smoothLinear; function contours(values) { var tz = threshold2(values); if (!Array.isArray(tz)) { const e = extent$1(values), ts = tickStep(e[0], e[1], tz); tz = ticks(Math.floor(e[0] / ts) * ts, Math.floor(e[1] / ts - 1) * ts, tz); } else { tz = tz.slice().sort(ascending$1); } return tz.map((value) => contour(values, value)); } function contour(values, value) { var polygons = [], holes = []; isorings(values, value, function(ring) { smooth(ring, values, value); if (area$3(ring) > 0) polygons.push([ring]); else holes.push(ring); }); holes.forEach(function(hole) { for (var i = 0, n = polygons.length, polygon; i < n; ++i) { if (contains$2((polygon = polygons[i])[0], hole) !== -1) { polygon.push(hole); return; } } }); return { type: "MultiPolygon", value, coordinates: polygons }; } function isorings(values, value, callback) { var fragmentByStart = new Array(), fragmentByEnd = new Array(), x2, y2, t02, t12, t22, t32; x2 = y2 = -1; t12 = values[0] >= value; cases[t12 << 1].forEach(stitch); while (++x2 < dx - 1) { t02 = t12, t12 = values[x2 + 1] >= value; cases[t02 | t12 << 1].forEach(stitch); } cases[t12 << 0].forEach(stitch); while (++y2 < dy - 1) { x2 = -1; t12 = values[y2 * dx + dx] >= value; t22 = values[y2 * dx] >= value; cases[t12 << 1 | t22 << 2].forEach(stitch); while (++x2 < dx - 1) { t02 = t12, t12 = values[y2 * dx + dx + x2 + 1] >= value; t32 = t22, t22 = values[y2 * dx + x2 + 1] >= value; cases[t02 | t12 << 1 | t22 << 2 | t32 << 3].forEach(stitch); } cases[t12 | t22 << 3].forEach(stitch); } x2 = -1; t22 = values[y2 * dx] >= value; cases[t22 << 2].forEach(stitch); while (++x2 < dx - 1) { t32 = t22, t22 = values[y2 * dx + x2 + 1] >= value; cases[t22 << 2 | t32 << 3].forEach(stitch); } cases[t22 << 3].forEach(stitch); function stitch(line2) { var start2 = [line2[0][0] + x2, line2[0][1] + y2], end2 = [line2[1][0] + x2, line2[1][1] + y2], startIndex = index2(start2), endIndex = index2(end2), f, g; if (f = fragmentByEnd[startIndex]) { if (g = fragmentByStart[endIndex]) { delete fragmentByEnd[f.end]; delete fragmentByStart[g.start]; if (f === g) { f.ring.push(end2); callback(f.ring); } else { fragmentByStart[f.start] = fragmentByEnd[g.end] = { start: f.start, end: g.end, ring: f.ring.concat(g.ring) }; } } else { delete fragmentByEnd[f.end]; f.ring.push(end2); fragmentByEnd[f.end = endIndex] = f; } } else if (f = fragmentByStart[endIndex]) { if (g = fragmentByEnd[startIndex]) { delete fragmentByStart[f.start]; delete fragmentByEnd[g.end]; if (f === g) { f.ring.push(end2); callback(f.ring); } else { fragmentByStart[g.start] = fragmentByEnd[f.end] = { start: g.start, end: f.end, ring: g.ring.concat(f.ring) }; } } else { delete fragmentByStart[f.start]; f.ring.unshift(start2); fragmentByStart[f.start = startIndex] = f; } } else { fragmentByStart[startIndex] = fragmentByEnd[endIndex] = { start: startIndex, end: endIndex, ring: [start2, end2] }; } } } function index2(point2) { return point2[0] * 2 + point2[1] * (dx + 1) * 4; } function smoothLinear(ring, values, value) { ring.forEach(function(point2) { var x2 = point2[0], y2 = point2[1], xt = x2 | 0, yt = y2 | 0, v0, v1 = values[yt * dx + xt]; if (x2 > 0 && x2 < dx && xt === x2) { v0 = values[yt * dx + xt - 1]; point2[0] = x2 + (value - v0) / (v1 - v0) - 0.5; } if (y2 > 0 && y2 < dy && yt === y2) { v0 = values[(yt - 1) * dx + xt]; point2[1] = y2 + (value - v0) / (v1 - v0) - 0.5; } }); } contours.contour = contour; contours.size = function(_2) { if (!arguments.length) return [dx, dy]; var _0 = Math.floor(_2[0]), _1 = Math.floor(_2[1]); if (!(_0 >= 0 && _1 >= 0)) throw new Error("invalid size"); return dx = _0, dy = _1, contours; }; contours.thresholds = function(_2) { return arguments.length ? (threshold2 = typeof _2 === "function" ? _2 : Array.isArray(_2) ? constant$5(slice$2.call(_2)) : constant$5(_2), contours) : threshold2; }; contours.smooth = function(_2) { return arguments.length ? (smooth = _2 ? smoothLinear : noop$2, contours) : smooth === smoothLinear; }; return contours; } function defaultX$1(d) { return d[0]; } function defaultY$1(d) { return d[1]; } function defaultWeight() { return 1; } function density() { var x2 = defaultX$1, y2 = defaultY$1, weight = defaultWeight, dx = 960, dy = 500, r = 20, k2 = 2, o = r * 3, n = dx + o * 2 >> k2, m2 = dy + o * 2 >> k2, threshold2 = constant$5(20); function grid(data) { var values = new Float32Array(n * m2), pow2k = Math.pow(2, -k2), i = -1; for (const d of data) { var xi = (x2(d, ++i, data) + o) * pow2k, yi = (y2(d, i, data) + o) * pow2k, wi = +weight(d, i, data); if (xi >= 0 && xi < n && yi >= 0 && yi < m2) { var x02 = Math.floor(xi), y02 = Math.floor(yi), xt = xi - x02 - 0.5, yt = yi - y02 - 0.5; values[x02 + y02 * n] += (1 - xt) * (1 - yt) * wi; values[x02 + 1 + y02 * n] += xt * (1 - yt) * wi; values[x02 + 1 + (y02 + 1) * n] += xt * yt * wi; values[x02 + (y02 + 1) * n] += (1 - xt) * yt * wi; } } blur2({ data: values, width: n, height: m2 }, r * pow2k); return values; } function density2(data) { var values = grid(data), tz = threshold2(values), pow4k = Math.pow(2, 2 * k2); if (!Array.isArray(tz)) { tz = ticks(Number.MIN_VALUE, max$3(values) / pow4k, tz); } return Contours().size([n, m2]).thresholds(tz.map((d) => d * pow4k))(values).map((c2, i) => (c2.value = +tz[i], transform2(c2))); } density2.contours = function(data) { var values = grid(data), contours = Contours().size([n, m2]), pow4k = Math.pow(2, 2 * k2), contour = (value) => { value = +value; var c2 = transform2(contours.contour(values, value * pow4k)); c2.value = value; return c2; }; Object.defineProperty(contour, "max", { get: () => max$3(values) / pow4k }); return contour; }; function transform2(geometry) { geometry.coordinates.forEach(transformPolygon); return geometry; } function transformPolygon(coordinates2) { coordinates2.forEach(transformRing); } function transformRing(coordinates2) { coordinates2.forEach(transformPoint); } function transformPoint(coordinates2) { coordinates2[0] = coordinates2[0] * Math.pow(2, k2) - o; coordinates2[1] = coordinates2[1] * Math.pow(2, k2) - o; } function resize() { o = r * 3; n = dx + o * 2 >> k2; m2 = dy + o * 2 >> k2; return density2; } density2.x = function(_2) { return arguments.length ? (x2 = typeof _2 === "function" ? _2 : constant$5(+_2), density2) : x2; }; density2.y = function(_2) { return arguments.length ? (y2 = typeof _2 === "function" ? _2 : constant$5(+_2), density2) : y2; }; density2.weight = function(_2) { return arguments.length ? (weight = typeof _2 === "function" ? _2 : constant$5(+_2), density2) : weight; }; density2.size = function(_2) { if (!arguments.length) return [dx, dy]; var _0 = +_2[0], _1 = +_2[1]; if (!(_0 >= 0 && _1 >= 0)) throw new Error("invalid size"); return dx = _0, dy = _1, resize(); }; density2.cellSize = function(_2) { if (!arguments.length) return 1 << k2; if (!((_2 = +_2) >= 1)) throw new Error("invalid cell size"); return k2 = Math.floor(Math.log(_2) / Math.LN2), resize(); }; density2.thresholds = function(_2) { return arguments.length ? (threshold2 = typeof _2 === "function" ? _2 : Array.isArray(_2) ? constant$5(slice$2.call(_2)) : constant$5(_2), density2) : threshold2; }; density2.bandwidth = function(_2) { if (!arguments.length) return Math.sqrt(r * (r + 1)); if (!((_2 = +_2) >= 0)) throw new Error("invalid bandwidth"); return r = (Math.sqrt(4 * _2 * _2 + 1) - 1) / 2, resize(); }; return density2; } const epsilon$3 = 11102230246251565e-32; const splitter = 134217729; const resulterrbound = (3 + 8 * epsilon$3) * epsilon$3; function sum$1(elen, e, flen, f, h) { let Q, Qnew, hh, bvirt; let enow = e[0]; let fnow = f[0]; let eindex = 0; let findex = 0; if (fnow > enow === fnow > -enow) { Q = enow; enow = e[++eindex]; } else { Q = fnow; fnow = f[++findex]; } let hindex = 0; if (eindex < elen && findex < flen) { if (fnow > enow === fnow > -enow) { Qnew = enow + Q; hh = Q - (Qnew - enow); enow = e[++eindex]; } else { Qnew = fnow + Q; hh = Q - (Qnew - fnow); fnow = f[++findex]; } Q = Qnew; if (hh !== 0) { h[hindex++] = hh; } while (eindex < elen && findex < flen) { if (fnow > enow === fnow > -enow) { Qnew = Q + enow; bvirt = Qnew - Q; hh = Q - (Qnew - bvirt) + (enow - bvirt); enow = e[++eindex]; } else { Qnew = Q + fnow; bvirt = Qnew - Q; hh = Q - (Qnew - bvirt) + (fnow - bvirt); fnow = f[++findex]; } Q = Qnew; if (hh !== 0) { h[hindex++] = hh; } } } while (eindex < elen) { Qnew = Q + enow; bvirt = Qnew - Q; hh = Q - (Qnew - bvirt) + (enow - bvirt); enow = e[++eindex]; Q = Qnew; if (hh !== 0) { h[hindex++] = hh; } } while (findex < flen) { Qnew = Q + fnow; bvirt = Qnew - Q; hh = Q - (Qnew - bvirt) + (fnow - bvirt); fnow = f[++findex]; Q = Qnew; if (hh !== 0) { h[hindex++] = hh; } } if (Q !== 0 || hindex === 0) { h[hindex++] = Q; } return hindex; } function estimate(elen, e) { let Q = e[0]; for (let i = 1; i < elen; i++) Q += e[i]; return Q; } function vec(n) { return new Float64Array(n); } const ccwerrboundA = (3 + 16 * epsilon$3) * epsilon$3; const ccwerrboundB = (2 + 12 * epsilon$3) * epsilon$3; const ccwerrboundC = (9 + 64 * epsilon$3) * epsilon$3 * epsilon$3; const B = vec(4); const C1 = vec(8); const C2 = vec(12); const D = vec(16); const u = vec(4); function orient2dadapt(ax, ay, bx, by, cx, cy, detsum) { let acxtail, acytail, bcxtail, bcytail; let bvirt, c2, ahi, alo, bhi, blo, _i, _j, _0, s1, s0, t12, t02, u3; const acx = ax - cx; const bcx = bx - cx; const acy = ay - cy; const bcy = by - cy; s1 = acx * bcy; c2 = splitter * acx; ahi = c2 - (c2 - acx); alo = acx - ahi; c2 = splitter * bcy; bhi = c2 - (c2 - bcy); blo = bcy - bhi; s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); t12 = acy * bcx; c2 = splitter * acy; ahi = c2 - (c2 - acy); alo = acy - ahi; c2 = splitter * bcx; bhi = c2 - (c2 - bcx); blo = bcx - bhi; t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); _i = s0 - t02; bvirt = s0 - _i; B[0] = s0 - (_i + bvirt) + (bvirt - t02); _j = s1 + _i; bvirt = _j - s1; _0 = s1 - (_j - bvirt) + (_i - bvirt); _i = _0 - t12; bvirt = _0 - _i; B[1] = _0 - (_i + bvirt) + (bvirt - t12); u3 = _j + _i; bvirt = u3 - _j; B[2] = _j - (u3 - bvirt) + (_i - bvirt); B[3] = u3; let det = estimate(4, B); let errbound = ccwerrboundB * detsum; if (det >= errbound || -det >= errbound) { return det; } bvirt = ax - acx; acxtail = ax - (acx + bvirt) + (bvirt - cx); bvirt = bx - bcx; bcxtail = bx - (bcx + bvirt) + (bvirt - cx); bvirt = ay - acy; acytail = ay - (acy + bvirt) + (bvirt - cy); bvirt = by - bcy; bcytail = by - (bcy + bvirt) + (bvirt - cy); if (acxtail === 0 && acytail === 0 && bcxtail === 0 && bcytail === 0) { return det; } errbound = ccwerrboundC * detsum + resulterrbound * Math.abs(det); det += acx * bcytail + bcy * acxtail - (acy * bcxtail + bcx * acytail); if (det >= errbound || -det >= errbound) return det; s1 = acxtail * bcy; c2 = splitter * acxtail; ahi = c2 - (c2 - acxtail); alo = acxtail - ahi; c2 = splitter * bcy; bhi = c2 - (c2 - bcy); blo = bcy - bhi; s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); t12 = acytail * bcx; c2 = splitter * acytail; ahi = c2 - (c2 - acytail); alo = acytail - ahi; c2 = splitter * bcx; bhi = c2 - (c2 - bcx); blo = bcx - bhi; t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); _i = s0 - t02; bvirt = s0 - _i; u[0] = s0 - (_i + bvirt) + (bvirt - t02); _j = s1 + _i; bvirt = _j - s1; _0 = s1 - (_j - bvirt) + (_i - bvirt); _i = _0 - t12; bvirt = _0 - _i; u[1] = _0 - (_i + bvirt) + (bvirt - t12); u3 = _j + _i; bvirt = u3 - _j; u[2] = _j - (u3 - bvirt) + (_i - bvirt); u[3] = u3; const C1len = sum$1(4, B, 4, u, C1); s1 = acx * bcytail; c2 = splitter * acx; ahi = c2 - (c2 - acx); alo = acx - ahi; c2 = splitter * bcytail; bhi = c2 - (c2 - bcytail); blo = bcytail - bhi; s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); t12 = acy * bcxtail; c2 = splitter * acy; ahi = c2 - (c2 - acy); alo = acy - ahi; c2 = splitter * bcxtail; bhi = c2 - (c2 - bcxtail); blo = bcxtail - bhi; t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); _i = s0 - t02; bvirt = s0 - _i; u[0] = s0 - (_i + bvirt) + (bvirt - t02); _j = s1 + _i; bvirt = _j - s1; _0 = s1 - (_j - bvirt) + (_i - bvirt); _i = _0 - t12; bvirt = _0 - _i; u[1] = _0 - (_i + bvirt) + (bvirt - t12); u3 = _j + _i; bvirt = u3 - _j; u[2] = _j - (u3 - bvirt) + (_i - bvirt); u[3] = u3; const C2len = sum$1(C1len, C1, 4, u, C2); s1 = acxtail * bcytail; c2 = splitter * acxtail; ahi = c2 - (c2 - acxtail); alo = acxtail - ahi; c2 = splitter * bcytail; bhi = c2 - (c2 - bcytail); blo = bcytail - bhi; s0 = alo * blo - (s1 - ahi * bhi - alo * bhi - ahi * blo); t12 = acytail * bcxtail; c2 = splitter * acytail; ahi = c2 - (c2 - acytail); alo = acytail - ahi; c2 = splitter * bcxtail; bhi = c2 - (c2 - bcxtail); blo = bcxtail - bhi; t02 = alo * blo - (t12 - ahi * bhi - alo * bhi - ahi * blo); _i = s0 - t02; bvirt = s0 - _i; u[0] = s0 - (_i + bvirt) + (bvirt - t02); _j = s1 + _i; bvirt = _j - s1; _0 = s1 - (_j - bvirt) + (_i - bvirt); _i = _0 - t12; bvirt = _0 - _i; u[1] = _0 - (_i + bvirt) + (bvirt - t12); u3 = _j + _i; bvirt = u3 - _j; u[2] = _j - (u3 - bvirt) + (_i - bvirt); u[3] = u3; const Dlen = sum$1(C2len, C2, 4, u, D); return D[Dlen - 1]; } function orient2d(ax, ay, bx, by, cx, cy) { const detleft = (ay - cy) * (bx - cx); const detright = (ax - cx) * (by - cy); const det = detleft - detright; if (detleft === 0 || detright === 0 || detleft > 0 !== detright > 0) return det; const detsum = Math.abs(detleft + detright); if (Math.abs(det) >= ccwerrboundA * detsum) return det; return -orient2dadapt(ax, ay, bx, by, cx, cy, detsum); } const EPSILON = Math.pow(2, -52); const EDGE_STACK = new Uint32Array(512); class Delaunator { static from(points, getX = defaultGetX, getY = defaultGetY) { const n = points.length; const coords = new Float64Array(n * 2); for (let i = 0; i < n; i++) { const p = points[i]; coords[2 * i] = getX(p); coords[2 * i + 1] = getY(p); } return new Delaunator(coords); } constructor(coords) { const n = coords.length >> 1; if (n > 0 && typeof coords[0] !== "number") throw new Error("Expected coords to contain numbers."); this.coords = coords; const maxTriangles = Math.max(2 * n - 5, 0); this._triangles = new Uint32Array(maxTriangles * 3); this._halfedges = new Int32Array(maxTriangles * 3); this._hashSize = Math.ceil(Math.sqrt(n)); this._hullPrev = new Uint32Array(n); this._hullNext = new Uint32Array(n); this._hullTri = new Uint32Array(n); this._hullHash = new Int32Array(this._hashSize).fill(-1); this._ids = new Uint32Array(n); this._dists = new Float64Array(n); this.update(); } update() { const { coords, _hullPrev: hullPrev, _hullNext: hullNext, _hullTri: hullTri, _hullHash: hullHash } = this; const n = coords.length >> 1; let minX = Infinity; let minY = Infinity; let maxX = -Infinity; let maxY2 = -Infinity; for (let i = 0; i < n; i++) { const x2 = coords[2 * i]; const y2 = coords[2 * i + 1]; if (x2 < minX) minX = x2; if (y2 < minY) minY = y2; if (x2 > maxX) maxX = x2; if (y2 > maxY2) maxY2 = y2; this._ids[i] = i; } const cx = (minX + maxX) / 2; const cy = (minY + maxY2) / 2; let minDist = Infinity; let i0, i1, i2; for (let i = 0; i < n; i++) { const d = dist(cx, cy, coords[2 * i], coords[2 * i + 1]); if (d < minDist) { i0 = i; minDist = d; } } const i0x = coords[2 * i0]; const i0y = coords[2 * i0 + 1]; minDist = Infinity; for (let i = 0; i < n; i++) { if (i === i0) continue; const d = dist(i0x, i0y, coords[2 * i], coords[2 * i + 1]); if (d < minDist && d > 0) { i1 = i; minDist = d; } } let i1x = coords[2 * i1]; let i1y = coords[2 * i1 + 1]; let minRadius = Infinity; for (let i = 0; i < n; i++) { if (i === i0 || i === i1) continue; const r = circumradius(i0x, i0y, i1x, i1y, coords[2 * i], coords[2 * i + 1]); if (r < minRadius) { i2 = i; minRadius = r; } } let i2x = coords[2 * i2]; let i2y = coords[2 * i2 + 1]; if (minRadius === Infinity) { for (let i = 0; i < n; i++) { this._dists[i] = coords[2 * i] - coords[0] || coords[2 * i + 1] - coords[1]; } quicksort(this._ids, this._dists, 0, n - 1); const hull2 = new Uint32Array(n); let j = 0; for (let i = 0, d0 = -Infinity; i < n; i++) { const id2 = this._ids[i]; if (this._dists[id2] > d0) { hull2[j++] = id2; d0 = this._dists[id2]; } } this.hull = hull2.subarray(0, j); this.triangles = new Uint32Array(0); this.halfedges = new Uint32Array(0); return; } if (orient2d(i0x, i0y, i1x, i1y, i2x, i2y) < 0) { const i = i1; const x2 = i1x; const y2 = i1y; i1 = i2; i1x = i2x; i1y = i2y; i2 = i; i2x = x2; i2y = y2; } const center2 = circumcenter(i0x, i0y, i1x, i1y, i2x, i2y); this._cx = center2.x; this._cy = center2.y; for (let i = 0; i < n; i++) { this._dists[i] = dist(coords[2 * i], coords[2 * i + 1], center2.x, center2.y); } quicksort(this._ids, this._dists, 0, n - 1); this._hullStart = i0; let hullSize = 3; hullNext[i0] = hullPrev[i2] = i1; hullNext[i1] = hullPrev[i0] = i2; hullNext[i2] = hullPrev[i1] = i0; hullTri[i0] = 0; hullTri[i1] = 1; hullTri[i2] = 2; hullHash.fill(-1); hullHash[this._hashKey(i0x, i0y)] = i0; hullHash[this._hashKey(i1x, i1y)] = i1; hullHash[this._hashKey(i2x, i2y)] = i2; this.trianglesLen = 0; this._addTriangle(i0, i1, i2, -1, -1, -1); for (let k2 = 0, xp, yp; k2 < this._ids.length; k2++) { const i = this._ids[k2]; const x2 = coords[2 * i]; const y2 = coords[2 * i + 1]; if (k2 > 0 && Math.abs(x2 - xp) <= EPSILON && Math.abs(y2 - yp) <= EPSILON) continue; xp = x2; yp = y2; if (i === i0 || i === i1 || i === i2) continue; let start2 = 0; for (let j = 0, key = this._hashKey(x2, y2); j < this._hashSize; j++) { start2 = hullHash[(key + j) % this._hashSize]; if (start2 !== -1 && start2 !== hullNext[start2]) break; } start2 = hullPrev[start2]; let e = start2, q; while (q = hullNext[e], orient2d(x2, y2, coords[2 * e], coords[2 * e + 1], coords[2 * q], coords[2 * q + 1]) >= 0) { e = q; if (e === start2) { e = -1; break; } } if (e === -1) continue; let t = this._addTriangle(e, i, hullNext[e], -1, -1, hullTri[e]); hullTri[i] = this._legalize(t + 2); hullTri[e] = t; hullSize++; let n2 = hullNext[e]; while (q = hullNext[n2], orient2d(x2, y2, coords[2 * n2], coords[2 * n2 + 1], coords[2 * q], coords[2 * q + 1]) < 0) { t = this._addTriangle(n2, i, q, hullTri[i], -1, hullTri[n2]); hullTri[i] = this._legalize(t + 2); hullNext[n2] = n2; hullSize--; n2 = q; } if (e === start2) { while (q = hullPrev[e], orient2d(x2, y2, coords[2 * q], coords[2 * q + 1], coords[2 * e], coords[2 * e + 1]) < 0) { t = this._addTriangle(q, i, e, -1, hullTri[e], hullTri[q]); this._legalize(t + 2); hullTri[q] = t; hullNext[e] = e; hullSize--; e = q; } } this._hullStart = hullPrev[i] = e; hullNext[e] = hullPrev[n2] = i; hullNext[i] = n2; hullHash[this._hashKey(x2, y2)] = i; hullHash[this._hashKey(coords[2 * e], coords[2 * e + 1])] = e; } this.hull = new Uint32Array(hullSize); for (let i = 0, e = this._hullStart; i < hullSize; i++) { this.hull[i] = e; e = hullNext[e]; } this.triangles = this._triangles.subarray(0, this.trianglesLen); this.halfedges = this._halfedges.subarray(0, this.trianglesLen); } _hashKey(x2, y2) { return Math.floor(pseudoAngle(x2 - this._cx, y2 - this._cy) * this._hashSize) % this._hashSize; } _legalize(a2) { const { _triangles: triangles, _halfedges: halfedges, coords } = this; let i = 0; let ar = 0; while (true) { const b = halfedges[a2]; const a0 = a2 - a2 % 3; ar = a0 + (a2 + 2) % 3; if (b === -1) { if (i === 0) break; a2 = EDGE_STACK[--i]; continue; } const b02 = b - b % 3; const al = a0 + (a2 + 1) % 3; const bl = b02 + (b + 2) % 3; const p02 = triangles[ar]; const pr = triangles[a2]; const pl = triangles[al]; const p1 = triangles[bl]; const illegal = inCircle( coords[2 * p02], coords[2 * p02 + 1], coords[2 * pr], coords[2 * pr + 1], coords[2 * pl], coords[2 * pl + 1], coords[2 * p1], coords[2 * p1 + 1] ); if (illegal) { triangles[a2] = p1; triangles[b] = p02; const hbl = halfedges[bl]; if (hbl === -1) { let e = this._hullStart; do { if (this._hullTri[e] === bl) { this._hullTri[e] = a2; break; } e = this._hullPrev[e]; } while (e !== this._hullStart); } this._link(a2, hbl); this._link(b, halfedges[ar]); this._link(ar, bl); const br = b02 + (b + 1) % 3; if (i < EDGE_STACK.length) { EDGE_STACK[i++] = br; } } else { if (i === 0) break; a2 = EDGE_STACK[--i]; } } return ar; } _link(a2, b) { this._halfedges[a2] = b; if (b !== -1) this._halfedges[b] = a2; } _addTriangle(i0, i1, i2, a2, b, c2) { const t = this.trianglesLen; this._triangles[t] = i0; this._triangles[t + 1] = i1; this._triangles[t + 2] = i2; this._link(t, a2); this._link(t + 1, b); this._link(t + 2, c2); this.trianglesLen += 3; return t; } } function pseudoAngle(dx, dy) { const p = dx / (Math.abs(dx) + Math.abs(dy)); return (dy > 0 ? 3 - p : 1 + p) / 4; } function dist(ax, ay, bx, by) { const dx = ax - bx; const dy = ay - by; return dx * dx + dy * dy; } function inCircle(ax, ay, bx, by, cx, cy, px, py) { const dx = ax - px; const dy = ay - py; const ex = bx - px; const ey = by - py; const fx = cx - px; const fy = cy - py; const ap = dx * dx + dy * dy; const bp = ex * ex + ey * ey; const cp = fx * fx + fy * fy; return dx * (ey * cp - bp * fy) - dy * (ex * cp - bp * fx) + ap * (ex * fy - ey * fx) < 0; } function circumradius(ax, ay, bx, by, cx, cy) { const dx = bx - ax; const dy = by - ay; const ex = cx - ax; const ey = cy - ay; const bl = dx * dx + dy * dy; const cl = ex * ex + ey * ey; const d = 0.5 / (dx * ey - dy * ex); const x2 = (ey * bl - dy * cl) * d; const y2 = (dx * cl - ex * bl) * d; return x2 * x2 + y2 * y2; } function circumcenter(ax, ay, bx, by, cx, cy) { const dx = bx - ax; const dy = by - ay; const ex = cx - ax; const ey = cy - ay; const bl = dx * dx + dy * dy; const cl = ex * ex + ey * ey; const d = 0.5 / (dx * ey - dy * ex); const x2 = ax + (ey * bl - dy * cl) * d; const y2 = ay + (dx * cl - ex * bl) * d; return { x: x2, y: y2 }; } function quicksort(ids, dists, left2, right2) { if (right2 - left2 <= 20) { for (let i = left2 + 1; i <= right2; i++) { const temp = ids[i]; const tempDist = dists[temp]; let j = i - 1; while (j >= left2 && dists[ids[j]] > tempDist) ids[j + 1] = ids[j--]; ids[j + 1] = temp; } } else { const median2 = left2 + right2 >> 1; let i = left2 + 1; let j = right2; swap(ids, median2, i); if (dists[ids[left2]] > dists[ids[right2]]) swap(ids, left2, right2); if (dists[ids[i]] > dists[ids[right2]]) swap(ids, i, right2); if (dists[ids[left2]] > dists[ids[i]]) swap(ids, left2, i); const temp = ids[i]; const tempDist = dists[temp]; while (true) { do i++; while (dists[ids[i]] < tempDist); do j--; while (dists[ids[j]] > tempDist); if (j < i) break; swap(ids, i, j); } ids[left2 + 1] = ids[j]; ids[j] = temp; if (right2 - i + 1 >= j - left2) { quicksort(ids, dists, i, right2); quicksort(ids, dists, left2, j - 1); } else { quicksort(ids, dists, left2, j - 1); quicksort(ids, dists, i, right2); } } } function swap(arr, i, j) { const tmp = arr[i]; arr[i] = arr[j]; arr[j] = tmp; } function defaultGetX(p) { return p[0]; } function defaultGetY(p) { return p[1]; } const epsilon$2 = 1e-6; class Path { constructor() { this._x0 = this._y0 = this._x1 = this._y1 = null; this._ = ""; } moveTo(x2, y2) { this._ += `M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}`; } closePath() { if (this._x1 !== null) { this._x1 = this._x0, this._y1 = this._y0; this._ += "Z"; } } lineTo(x2, y2) { this._ += `L${this._x1 = +x2},${this._y1 = +y2}`; } arc(x2, y2, r) { x2 = +x2, y2 = +y2, r = +r; const x02 = x2 + r; const y02 = y2; if (r < 0) throw new Error("negative radius"); if (this._x1 === null) this._ += `M${x02},${y02}`; else if (Math.abs(this._x1 - x02) > epsilon$2 || Math.abs(this._y1 - y02) > epsilon$2) this._ += "L" + x02 + "," + y02; if (!r) return; this._ += `A${r},${r},0,1,1,${x2 - r},${y2}A${r},${r},0,1,1,${this._x1 = x02},${this._y1 = y02}`; } rect(x2, y2, w2, h) { this._ += `M${this._x0 = this._x1 = +x2},${this._y0 = this._y1 = +y2}h${+w2}v${+h}h${-w2}Z`; } value() { return this._ || null; } } class Polygon { constructor() { this._ = []; } moveTo(x2, y2) { this._.push([x2, y2]); } closePath() { this._.push(this._[0].slice()); } lineTo(x2, y2) { this._.push([x2, y2]); } value() { return this._.length ? this._ : null; } } class Voronoi { constructor(delaunay, [xmin, ymin, xmax, ymax] = [0, 0, 960, 500]) { if (!((xmax = +xmax) >= (xmin = +xmin)) || !((ymax = +ymax) >= (ymin = +ymin))) throw new Error("invalid bounds"); this.delaunay = delaunay; this._circumcenters = new Float64Array(delaunay.points.length * 2); this.vectors = new Float64Array(delaunay.points.length * 2); this.xmax = xmax, this.xmin = xmin; this.ymax = ymax, this.ymin = ymin; this._init(); } update() { this.delaunay.update(); this._init(); return this; } _init() { const { delaunay: { points, hull: hull2, triangles }, vectors } = this; const circumcenters = this.circumcenters = this._circumcenters.subarray(0, triangles.length / 3 * 2); for (let i = 0, j = 0, n = triangles.length, x2, y2; i < n; i += 3, j += 2) { const t12 = triangles[i] * 2; const t22 = triangles[i + 1] * 2; const t32 = triangles[i + 2] * 2; const x13 = points[t12]; const y13 = points[t12 + 1]; const x22 = points[t22]; const y22 = points[t22 + 1]; const x3 = points[t32]; const y3 = points[t32 + 1]; const dx = x22 - x13; const dy = y22 - y13; const ex = x3 - x13; const ey = y3 - y13; const ab = (dx * ey - dy * ex) * 2; if (Math.abs(ab) < 1e-9) { let a2 = 1e9; const r = triangles[0] * 2; a2 *= Math.sign((points[r] - x13) * ey - (points[r + 1] - y13) * ex); x2 = (x13 + x3) / 2 - a2 * ey; y2 = (y13 + y3) / 2 + a2 * ex; } else { const d = 1 / ab; const bl = dx * dx + dy * dy; const cl = ex * ex + ey * ey; x2 = x13 + (ey * bl - dy * cl) * d; y2 = y13 + (dx * cl - ex * bl) * d; } circumcenters[j] = x2; circumcenters[j + 1] = y2; } let h = hull2[hull2.length - 1]; let p02, p1 = h * 4; let x02, x12 = points[2 * h]; let y02, y12 = points[2 * h + 1]; vectors.fill(0); for (let i = 0; i < hull2.length; ++i) { h = hull2[i]; p02 = p1, x02 = x12, y02 = y12; p1 = h * 4, x12 = points[2 * h], y12 = points[2 * h + 1]; vectors[p02 + 2] = vectors[p1] = y02 - y12; vectors[p02 + 3] = vectors[p1 + 1] = x12 - x02; } } render(context) { const buffer2 = context == null ? context = new Path() : void 0; const { delaunay: { halfedges, inedges, hull: hull2 }, circumcenters, vectors } = this; if (hull2.length <= 1) return null; for (let i = 0, n = halfedges.length; i < n; ++i) { const j = halfedges[i]; if (j < i) continue; const ti = Math.floor(i / 3) * 2; const tj = Math.floor(j / 3) * 2; const xi = circumcenters[ti]; const yi = circumcenters[ti + 1]; const xj = circumcenters[tj]; const yj = circumcenters[tj + 1]; this._renderSegment(xi, yi, xj, yj, context); } let h0, h1 = hull2[hull2.length - 1]; for (let i = 0; i < hull2.length; ++i) { h0 = h1, h1 = hull2[i]; const t = Math.floor(inedges[h1] / 3) * 2; const x2 = circumcenters[t]; const y2 = circumcenters[t + 1]; const v = h0 * 4; const p = this._project(x2, y2, vectors[v + 2], vectors[v + 3]); if (p) this._renderSegment(x2, y2, p[0], p[1], context); } return buffer2 && buffer2.value(); } renderBounds(context) { const buffer2 = context == null ? context = new Path() : void 0; context.rect(this.xmin, this.ymin, this.xmax - this.xmin, this.ymax - this.ymin); return buffer2 && buffer2.value(); } renderCell(i, context) { const buffer2 = context == null ? context = new Path() : void 0; const points = this._clip(i); if (points === null || !points.length) return; context.moveTo(points[0], points[1]); let n = points.length; while (points[0] === points[n - 2] && points[1] === points[n - 1] && n > 1) n -= 2; for (let i2 = 2; i2 < n; i2 += 2) { if (points[i2] !== points[i2 - 2] || points[i2 + 1] !== points[i2 - 1]) context.lineTo(points[i2], points[i2 + 1]); } context.closePath(); return buffer2 && buffer2.value(); } *cellPolygons() { const { delaunay: { points } } = this; for (let i = 0, n = points.length / 2; i < n; ++i) { const cell = this.cellPolygon(i); if (cell) cell.index = i, yield cell; } } cellPolygon(i) { const polygon = new Polygon(); this.renderCell(i, polygon); return polygon.value(); } _renderSegment(x02, y02, x12, y12, context) { let S; const c0 = this._regioncode(x02, y02); const c1 = this._regioncode(x12, y12); if (c0 === 0 && c1 === 0) { context.moveTo(x02, y02); context.lineTo(x12, y12); } else if (S = this._clipSegment(x02, y02, x12, y12, c0, c1)) { context.moveTo(S[0], S[1]); context.lineTo(S[2], S[3]); } } contains(i, x2, y2) { if ((x2 = +x2, x2 !== x2) || (y2 = +y2, y2 !== y2)) return false; return this.delaunay._step(i, x2, y2) === i; } *neighbors(i) { const ci = this._clip(i); if (ci) for (const j of this.delaunay.neighbors(i)) { const cj = this._clip(j); if (cj) loop: for (let ai = 0, li = ci.length; ai < li; ai += 2) { for (let aj = 0, lj = cj.length; aj < lj; aj += 2) { if (ci[ai] == cj[aj] && ci[ai + 1] == cj[aj + 1] && ci[(ai + 2) % li] == cj[(aj + lj - 2) % lj] && ci[(ai + 3) % li] == cj[(aj + lj - 1) % lj]) { yield j; break loop; } } } } } _cell(i) { const { circumcenters, delaunay: { inedges, halfedges, triangles } } = this; const e0 = inedges[i]; if (e0 === -1) return null; const points = []; let e = e0; do { const t = Math.floor(e / 3); points.push(circumcenters[t * 2], circumcenters[t * 2 + 1]); e = e % 3 === 2 ? e - 2 : e + 1; if (triangles[e] !== i) break; e = halfedges[e]; } while (e !== e0 && e !== -1); return points; } _clip(i) { if (i === 0 && this.delaunay.hull.length === 1) { return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; } const points = this._cell(i); if (points === null) return null; const { vectors: V } = this; const v = i * 4; return V[v] || V[v + 1] ? this._clipInfinite(i, points, V[v], V[v + 1], V[v + 2], V[v + 3]) : this._clipFinite(i, points); } _clipFinite(i, points) { const n = points.length; let P = null; let x02, y02, x12 = points[n - 2], y12 = points[n - 1]; let c0, c1 = this._regioncode(x12, y12); let e0, e1 = 0; for (let j = 0; j < n; j += 2) { x02 = x12, y02 = y12, x12 = points[j], y12 = points[j + 1]; c0 = c1, c1 = this._regioncode(x12, y12); if (c0 === 0 && c1 === 0) { e0 = e1, e1 = 0; if (P) P.push(x12, y12); else P = [x12, y12]; } else { let S, sx0, sy0, sx1, sy1; if (c0 === 0) { if ((S = this._clipSegment(x02, y02, x12, y12, c0, c1)) === null) continue; [sx0, sy0, sx1, sy1] = S; } else { if ((S = this._clipSegment(x12, y12, x02, y02, c1, c0)) === null) continue; [sx1, sy1, sx0, sy0] = S; e0 = e1, e1 = this._edgecode(sx0, sy0); if (e0 && e1) this._edge(i, e0, e1, P, P.length); if (P) P.push(sx0, sy0); else P = [sx0, sy0]; } e0 = e1, e1 = this._edgecode(sx1, sy1); if (e0 && e1) this._edge(i, e0, e1, P, P.length); if (P) P.push(sx1, sy1); else P = [sx1, sy1]; } } if (P) { e0 = e1, e1 = this._edgecode(P[0], P[1]); if (e0 && e1) this._edge(i, e0, e1, P, P.length); } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { return [this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax, this.xmin, this.ymin]; } return P; } _clipSegment(x02, y02, x12, y12, c0, c1) { while (true) { if (c0 === 0 && c1 === 0) return [x02, y02, x12, y12]; if (c0 & c1) return null; let x2, y2, c2 = c0 || c1; if (c2 & 8) x2 = x02 + (x12 - x02) * (this.ymax - y02) / (y12 - y02), y2 = this.ymax; else if (c2 & 4) x2 = x02 + (x12 - x02) * (this.ymin - y02) / (y12 - y02), y2 = this.ymin; else if (c2 & 2) y2 = y02 + (y12 - y02) * (this.xmax - x02) / (x12 - x02), x2 = this.xmax; else y2 = y02 + (y12 - y02) * (this.xmin - x02) / (x12 - x02), x2 = this.xmin; if (c0) x02 = x2, y02 = y2, c0 = this._regioncode(x02, y02); else x12 = x2, y12 = y2, c1 = this._regioncode(x12, y12); } } _clipInfinite(i, points, vx0, vy0, vxn, vyn) { let P = Array.from(points), p; if (p = this._project(P[0], P[1], vx0, vy0)) P.unshift(p[0], p[1]); if (p = this._project(P[P.length - 2], P[P.length - 1], vxn, vyn)) P.push(p[0], p[1]); if (P = this._clipFinite(i, P)) { for (let j = 0, n = P.length, c0, c1 = this._edgecode(P[n - 2], P[n - 1]); j < n; j += 2) { c0 = c1, c1 = this._edgecode(P[j], P[j + 1]); if (c0 && c1) j = this._edge(i, c0, c1, P, j), n = P.length; } } else if (this.contains(i, (this.xmin + this.xmax) / 2, (this.ymin + this.ymax) / 2)) { P = [this.xmin, this.ymin, this.xmax, this.ymin, this.xmax, this.ymax, this.xmin, this.ymax]; } return P; } _edge(i, e0, e1, P, j) { while (e0 !== e1) { let x2, y2; switch (e0) { case 5: e0 = 4; continue; case 4: e0 = 6, x2 = this.xmax, y2 = this.ymin; break; case 6: e0 = 2; continue; case 2: e0 = 10, x2 = this.xmax, y2 = this.ymax; break; case 10: e0 = 8; continue; case 8: e0 = 9, x2 = this.xmin, y2 = this.ymax; break; case 9: e0 = 1; continue; case 1: e0 = 5, x2 = this.xmin, y2 = this.ymin; break; } if ((P[j] !== x2 || P[j + 1] !== y2) && this.contains(i, x2, y2)) { P.splice(j, 0, x2, y2), j += 2; } } if (P.length > 4) { for (let i2 = 0; i2 < P.length; i2 += 2) { const j2 = (i2 + 2) % P.length, k2 = (i2 + 4) % P.length; if (P[i2] === P[j2] && P[j2] === P[k2] || P[i2 + 1] === P[j2 + 1] && P[j2 + 1] === P[k2 + 1]) P.splice(j2, 2), i2 -= 2; } } return j; } _project(x02, y02, vx, vy) { let t = Infinity, c2, x2, y2; if (vy < 0) { if (y02 <= this.ymin) return null; if ((c2 = (this.ymin - y02) / vy) < t) y2 = this.ymin, x2 = x02 + (t = c2) * vx; } else if (vy > 0) { if (y02 >= this.ymax) return null; if ((c2 = (this.ymax - y02) / vy) < t) y2 = this.ymax, x2 = x02 + (t = c2) * vx; } if (vx > 0) { if (x02 >= this.xmax) return null; if ((c2 = (this.xmax - x02) / vx) < t) x2 = this.xmax, y2 = y02 + (t = c2) * vy; } else if (vx < 0) { if (x02 <= this.xmin) return null; if ((c2 = (this.xmin - x02) / vx) < t) x2 = this.xmin, y2 = y02 + (t = c2) * vy; } return [x2, y2]; } _edgecode(x2, y2) { return (x2 === this.xmin ? 1 : x2 === this.xmax ? 2 : 0) | (y2 === this.ymin ? 4 : y2 === this.ymax ? 8 : 0); } _regioncode(x2, y2) { return (x2 < this.xmin ? 1 : x2 > this.xmax ? 2 : 0) | (y2 < this.ymin ? 4 : y2 > this.ymax ? 8 : 0); } } const tau$2 = 2 * Math.PI, pow$2 = Math.pow; function pointX(p) { return p[0]; } function pointY(p) { return p[1]; } function collinear(d) { const { triangles, coords } = d; for (let i = 0; i < triangles.length; i += 3) { const a2 = 2 * triangles[i], b = 2 * triangles[i + 1], c2 = 2 * triangles[i + 2], cross2 = (coords[c2] - coords[a2]) * (coords[b + 1] - coords[a2 + 1]) - (coords[b] - coords[a2]) * (coords[c2 + 1] - coords[a2 + 1]); if (cross2 > 1e-10) return false; } return true; } function jitter(x2, y2, r) { return [x2 + Math.sin(x2 + y2) * r, y2 + Math.cos(x2 - y2) * r]; } class Delaunay { static from(points, fx = pointX, fy = pointY, that) { return new Delaunay("length" in points ? flatArray(points, fx, fy, that) : Float64Array.from(flatIterable(points, fx, fy, that))); } constructor(points) { this._delaunator = new Delaunator(points); this.inedges = new Int32Array(points.length / 2); this._hullIndex = new Int32Array(points.length / 2); this.points = this._delaunator.coords; this._init(); } update() { this._delaunator.update(); this._init(); return this; } _init() { const d = this._delaunator, points = this.points; if (d.hull && d.hull.length > 2 && collinear(d)) { this.collinear = Int32Array.from({ length: points.length / 2 }, (_2, i) => i).sort((i, j) => points[2 * i] - points[2 * j] || points[2 * i + 1] - points[2 * j + 1]); const e = this.collinear[0], f = this.collinear[this.collinear.length - 1], bounds2 = [points[2 * e], points[2 * e + 1], points[2 * f], points[2 * f + 1]], r = 1e-8 * Math.hypot(bounds2[3] - bounds2[1], bounds2[2] - bounds2[0]); for (let i = 0, n = points.length / 2; i < n; ++i) { const p = jitter(points[2 * i], points[2 * i + 1], r); points[2 * i] = p[0]; points[2 * i + 1] = p[1]; } this._delaunator = new Delaunator(points); } else { delete this.collinear; } const halfedges = this.halfedges = this._delaunator.halfedges; const hull2 = this.hull = this._delaunator.hull; const triangles = this.triangles = this._delaunator.triangles; const inedges = this.inedges.fill(-1); const hullIndex = this._hullIndex.fill(-1); for (let e = 0, n = halfedges.length; e < n; ++e) { const p = triangles[e % 3 === 2 ? e - 2 : e + 1]; if (halfedges[e] === -1 || inedges[p] === -1) inedges[p] = e; } for (let i = 0, n = hull2.length; i < n; ++i) { hullIndex[hull2[i]] = i; } if (hull2.length <= 2 && hull2.length > 0) { this.triangles = new Int32Array(3).fill(-1); this.halfedges = new Int32Array(3).fill(-1); this.triangles[0] = hull2[0]; inedges[hull2[0]] = 1; if (hull2.length === 2) { inedges[hull2[1]] = 0; this.triangles[1] = hull2[1]; this.triangles[2] = hull2[1]; } } } voronoi(bounds2) { return new Voronoi(this, bounds2); } *neighbors(i) { const { inedges, hull: hull2, _hullIndex, halfedges, triangles, collinear: collinear2 } = this; if (collinear2) { const l = collinear2.indexOf(i); if (l > 0) yield collinear2[l - 1]; if (l < collinear2.length - 1) yield collinear2[l + 1]; return; } const e0 = inedges[i]; if (e0 === -1) return; let e = e0, p02 = -1; do { yield p02 = triangles[e]; e = e % 3 === 2 ? e - 2 : e + 1; if (triangles[e] !== i) return; e = halfedges[e]; if (e === -1) { const p = hull2[(_hullIndex[i] + 1) % hull2.length]; if (p !== p02) yield p; return; } } while (e !== e0); } find(x2, y2, i = 0) { if ((x2 = +x2, x2 !== x2) || (y2 = +y2, y2 !== y2)) return -1; const i0 = i; let c2; while ((c2 = this._step(i, x2, y2)) >= 0 && c2 !== i && c2 !== i0) i = c2; return c2; } _step(i, x2, y2) { const { inedges, hull: hull2, _hullIndex, halfedges, triangles, points } = this; if (inedges[i] === -1 || !points.length) return (i + 1) % (points.length >> 1); let c2 = i; let dc = pow$2(x2 - points[i * 2], 2) + pow$2(y2 - points[i * 2 + 1], 2); const e0 = inedges[i]; let e = e0; do { let t = triangles[e]; const dt = pow$2(x2 - points[t * 2], 2) + pow$2(y2 - points[t * 2 + 1], 2); if (dt < dc) dc = dt, c2 = t; e = e % 3 === 2 ? e - 2 : e + 1; if (triangles[e] !== i) break; e = halfedges[e]; if (e === -1) { e = hull2[(_hullIndex[i] + 1) % hull2.length]; if (e !== t) { if (pow$2(x2 - points[e * 2], 2) + pow$2(y2 - points[e * 2 + 1], 2) < dc) return e; } break; } } while (e !== e0); return c2; } render(context) { const buffer2 = context == null ? context = new Path() : void 0; const { points, halfedges, triangles } = this; for (let i = 0, n = halfedges.length; i < n; ++i) { const j = halfedges[i]; if (j < i) continue; const ti = triangles[i] * 2; const tj = triangles[j] * 2; context.moveTo(points[ti], points[ti + 1]); context.lineTo(points[tj], points[tj + 1]); } this.renderHull(context); return buffer2 && buffer2.value(); } renderPoints(context, r) { if (r === void 0 && (!context || typeof context.moveTo !== "function")) r = context, context = null; r = r == void 0 ? 2 : +r; const buffer2 = context == null ? context = new Path() : void 0; const { points } = this; for (let i = 0, n = points.length; i < n; i += 2) { const x2 = points[i], y2 = points[i + 1]; context.moveTo(x2 + r, y2); context.arc(x2, y2, r, 0, tau$2); } return buffer2 && buffer2.value(); } renderHull(context) { const buffer2 = context == null ? context = new Path() : void 0; const { hull: hull2, points } = this; const h = hull2[0] * 2, n = hull2.length; context.moveTo(points[h], points[h + 1]); for (let i = 1; i < n; ++i) { const h2 = 2 * hull2[i]; context.lineTo(points[h2], points[h2 + 1]); } context.closePath(); return buffer2 && buffer2.value(); } hullPolygon() { const polygon = new Polygon(); this.renderHull(polygon); return polygon.value(); } renderTriangle(i, context) { const buffer2 = context == null ? context = new Path() : void 0; const { points, triangles } = this; const t02 = triangles[i *= 3] * 2; const t12 = triangles[i + 1] * 2; const t22 = triangles[i + 2] * 2; context.moveTo(points[t02], points[t02 + 1]); context.lineTo(points[t12], points[t12 + 1]); context.lineTo(points[t22], points[t22 + 1]); context.closePath(); return buffer2 && buffer2.value(); } *trianglePolygons() { const { triangles } = this; for (let i = 0, n = triangles.length / 3; i < n; ++i) { yield this.trianglePolygon(i); } } trianglePolygon(i) { const polygon = new Polygon(); this.renderTriangle(i, polygon); return polygon.value(); } } function flatArray(points, fx, fy, that) { const n = points.length; const array2 = new Float64Array(n * 2); for (let i = 0; i < n; ++i) { const p = points[i]; array2[i * 2] = fx.call(that, p, i, points); array2[i * 2 + 1] = fy.call(that, p, i, points); } return array2; } function* flatIterable(points, fx, fy, that) { let i = 0; for (const p of points) { yield fx.call(that, p, i, points); yield fy.call(that, p, i, points); ++i; } } var EOL = {}, EOF = {}, QUOTE = 34, NEWLINE = 10, RETURN = 13; function objectConverter(columns) { return new Function("d", "return {" + columns.map(function(name2, i) { return JSON.stringify(name2) + ": d[" + i + '] || ""'; }).join(",") + "}"); } function customConverter(columns, f) { var object2 = objectConverter(columns); return function(row, i) { return f(object2(row), i, columns); }; } function inferColumns(rows) { var columnSet = /* @__PURE__ */ Object.create(null), columns = []; rows.forEach(function(row) { for (var column2 in row) { if (!(column2 in columnSet)) { columns.push(columnSet[column2] = column2); } } }); return columns; } function pad$1(value, width2) { var s2 = value + "", length2 = s2.length; return length2 < width2 ? new Array(width2 - length2 + 1).join(0) + s2 : s2; } function formatYear$1(year2) { return year2 < 0 ? "-" + pad$1(-year2, 6) : year2 > 9999 ? "+" + pad$1(year2, 6) : pad$1(year2, 4); } function formatDate(date2) { var hours2 = date2.getUTCHours(), minutes2 = date2.getUTCMinutes(), seconds2 = date2.getUTCSeconds(), milliseconds2 = date2.getUTCMilliseconds(); return isNaN(date2) ? "Invalid Date" : formatYear$1(date2.getUTCFullYear()) + "-" + pad$1(date2.getUTCMonth() + 1, 2) + "-" + pad$1(date2.getUTCDate(), 2) + (milliseconds2 ? "T" + pad$1(hours2, 2) + ":" + pad$1(minutes2, 2) + ":" + pad$1(seconds2, 2) + "." + pad$1(milliseconds2, 3) + "Z" : seconds2 ? "T" + pad$1(hours2, 2) + ":" + pad$1(minutes2, 2) + ":" + pad$1(seconds2, 2) + "Z" : minutes2 || hours2 ? "T" + pad$1(hours2, 2) + ":" + pad$1(minutes2, 2) + "Z" : ""); } function dsvFormat(delimiter2) { var reFormat = new RegExp('["' + delimiter2 + "\n\r]"), DELIMITER = delimiter2.charCodeAt(0); function parse2(text2, f) { var convert, columns, rows = parseRows(text2, function(row, i) { if (convert) return convert(row, i - 1); columns = row, convert = f ? customConverter(row, f) : objectConverter(row); }); rows.columns = columns || []; return rows; } function parseRows(text2, f) { var rows = [], N = text2.length, I = 0, n = 0, t, eof = N <= 0, eol = false; if (text2.charCodeAt(N - 1) === NEWLINE) --N; if (text2.charCodeAt(N - 1) === RETURN) --N; function token2() { if (eof) return EOF; if (eol) return eol = false, EOL; var i, j = I, c2; if (text2.charCodeAt(j) === QUOTE) { while (I++ < N && text2.charCodeAt(I) !== QUOTE || text2.charCodeAt(++I) === QUOTE) ; if ((i = I) >= N) eof = true; else if ((c2 = text2.charCodeAt(I++)) === NEWLINE) eol = true; else if (c2 === RETURN) { eol = true; if (text2.charCodeAt(I) === NEWLINE) ++I; } return text2.slice(j + 1, i - 1).replace(/""/g, '"'); } while (I < N) { if ((c2 = text2.charCodeAt(i = I++)) === NEWLINE) eol = true; else if (c2 === RETURN) { eol = true; if (text2.charCodeAt(I) === NEWLINE) ++I; } else if (c2 !== DELIMITER) continue; return text2.slice(j, i); } return eof = true, text2.slice(j, N); } while ((t = token2()) !== EOF) { var row = []; while (t !== EOL && t !== EOF) row.push(t), t = token2(); if (f && (row = f(row, n++)) == null) continue; rows.push(row); } return rows; } function preformatBody(rows, columns) { return rows.map(function(row) { return columns.map(function(column2) { return formatValue(row[column2]); }).join(delimiter2); }); } function format2(rows, columns) { if (columns == null) columns = inferColumns(rows); return [columns.map(formatValue).join(delimiter2)].concat(preformatBody(rows, columns)).join("\n"); } function formatBody(rows, columns) { if (columns == null) columns = inferColumns(rows); return preformatBody(rows, columns).join("\n"); } function formatRows(rows) { return rows.map(formatRow).join("\n"); } function formatRow(row) { return row.map(formatValue).join(delimiter2); } function formatValue(value) { return value == null ? "" : value instanceof Date ? formatDate(value) : reFormat.test(value += "") ? '"' + value.replace(/"/g, '""') + '"' : value; } return { parse: parse2, parseRows, format: format2, formatBody, formatRows, formatRow, formatValue }; } var csv$1 = dsvFormat(","); var csvParse = csv$1.parse; var csvParseRows = csv$1.parseRows; var csvFormat = csv$1.format; var csvFormatBody = csv$1.formatBody; var csvFormatRows = csv$1.formatRows; var csvFormatRow = csv$1.formatRow; var csvFormatValue = csv$1.formatValue; var tsv$1 = dsvFormat(" "); var tsvParse = tsv$1.parse; var tsvParseRows = tsv$1.parseRows; var tsvFormat = tsv$1.format; var tsvFormatBody = tsv$1.formatBody; var tsvFormatRows = tsv$1.formatRows; var tsvFormatRow = tsv$1.formatRow; var tsvFormatValue = tsv$1.formatValue; function autoType(object2) { for (var key in object2) { var value = object2[key].trim(), number3, m2; if (!value) value = null; else if (value === "true") value = true; else if (value === "false") value = false; else if (value === "NaN") value = NaN; else if (!isNaN(number3 = +value)) value = number3; else if (m2 = value.match(/^([-+]\d{2})?\d{4}(-\d{2}(-\d{2})?)?(T\d{2}:\d{2}(:\d{2}(\.\d{3})?)?(Z|[-+]\d{2}:\d{2})?)?$/)) { if (fixtz && !!m2[4] && !m2[7]) value = value.replace(/-/g, "/").replace(/T/, " "); value = new Date(value); } else continue; object2[key] = value; } return object2; } const fixtz = new Date("2019-01-01T00:00").getHours() || new Date("2019-07-01T00:00").getHours(); function responseBlob(response) { if (!response.ok) throw new Error(response.status + " " + response.statusText); return response.blob(); } function blob(input, init2) { return fetch(input, init2).then(responseBlob); } function responseArrayBuffer(response) { if (!response.ok) throw new Error(response.status + " " + response.statusText); return response.arrayBuffer(); } function buffer(input, init2) { return fetch(input, init2).then(responseArrayBuffer); } function responseText(response) { if (!response.ok) throw new Error(response.status + " " + response.statusText); return response.text(); } function text$1(input, init2) { return fetch(input, init2).then(responseText); } function dsvParse(parse2) { return function(input, init2, row) { if (arguments.length === 2 && typeof init2 === "function") row = init2, init2 = void 0; return text$1(input, init2).then(function(response) { return parse2(response, row); }); }; } function dsv(delimiter2, input, init2, row) { if (arguments.length === 3 && typeof init2 === "function") row = init2, init2 = void 0; var format2 = dsvFormat(delimiter2); return text$1(input, init2).then(function(response) { return format2.parse(response, row); }); } var csv = dsvParse(csvParse); var tsv = dsvParse(tsvParse); function image(input, init2) { return new Promise(function(resolve, reject) { var image2 = new Image(); for (var key in init2) image2[key] = init2[key]; image2.onerror = reject; image2.onload = function() { resolve(image2); }; image2.src = input; }); } function responseJson(response) { if (!response.ok) throw new Error(response.status + " " + response.statusText); if (response.status === 204 || response.status === 205) return; return response.json(); } function json$1(input, init2) { return fetch(input, init2).then(responseJson); } function parser$c(type2) { return (input, init2) => text$1(input, init2).then((text2) => new DOMParser().parseFromString(text2, type2)); } const xml$1 = parser$c("application/xml"); var html$2 = parser$c("text/html"); var svg$2 = parser$c("image/svg+xml"); function center(x2, y2) { var nodes, strength = 1; if (x2 == null) x2 = 0; if (y2 == null) y2 = 0; function force() { var i, n = nodes.length, node2, sx = 0, sy = 0; for (i = 0; i < n; ++i) { node2 = nodes[i], sx += node2.x, sy += node2.y; } for (sx = (sx / n - x2) * strength, sy = (sy / n - y2) * strength, i = 0; i < n; ++i) { node2 = nodes[i], node2.x -= sx, node2.y -= sy; } } force.initialize = function(_2) { nodes = _2; }; force.x = function(_2) { return arguments.length ? (x2 = +_2, force) : x2; }; force.y = function(_2) { return arguments.length ? (y2 = +_2, force) : y2; }; force.strength = function(_2) { return arguments.length ? (strength = +_2, force) : strength; }; return force; } function tree_add(d) { const x2 = +this._x.call(null, d), y2 = +this._y.call(null, d); return add(this.cover(x2, y2), x2, y2, d); } function add(tree2, x2, y2, d) { if (isNaN(x2) || isNaN(y2)) return tree2; var parent, node2 = tree2._root, leaf = { data: d }, x02 = tree2._x0, y02 = tree2._y0, x12 = tree2._x1, y12 = tree2._y1, xm, ym, xp, yp, right2, bottom2, i, j; if (!node2) return tree2._root = leaf, tree2; while (node2.length) { if (right2 = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; else x12 = xm; if (bottom2 = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; else y12 = ym; if (parent = node2, !(node2 = node2[i = bottom2 << 1 | right2])) return parent[i] = leaf, tree2; } xp = +tree2._x.call(null, node2.data); yp = +tree2._y.call(null, node2.data); if (x2 === xp && y2 === yp) return leaf.next = node2, parent ? parent[i] = leaf : tree2._root = leaf, tree2; do { parent = parent ? parent[i] = new Array(4) : tree2._root = new Array(4); if (right2 = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; else x12 = xm; if (bottom2 = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; else y12 = ym; } while ((i = bottom2 << 1 | right2) === (j = (yp >= ym) << 1 | xp >= xm)); return parent[j] = node2, parent[i] = leaf, tree2; } function addAll(data) { var d, i, n = data.length, x2, y2, xz = new Array(n), yz = new Array(n), x02 = Infinity, y02 = Infinity, x12 = -Infinity, y12 = -Infinity; for (i = 0; i < n; ++i) { if (isNaN(x2 = +this._x.call(null, d = data[i])) || isNaN(y2 = +this._y.call(null, d))) continue; xz[i] = x2; yz[i] = y2; if (x2 < x02) x02 = x2; if (x2 > x12) x12 = x2; if (y2 < y02) y02 = y2; if (y2 > y12) y12 = y2; } if (x02 > x12 || y02 > y12) return this; this.cover(x02, y02).cover(x12, y12); for (i = 0; i < n; ++i) { add(this, xz[i], yz[i], data[i]); } return this; } function tree_cover(x2, y2) { if (isNaN(x2 = +x2) || isNaN(y2 = +y2)) return this; var x02 = this._x0, y02 = this._y0, x12 = this._x1, y12 = this._y1; if (isNaN(x02)) { x12 = (x02 = Math.floor(x2)) + 1; y12 = (y02 = Math.floor(y2)) + 1; } else { var z = x12 - x02 || 1, node2 = this._root, parent, i; while (x02 > x2 || x2 >= x12 || y02 > y2 || y2 >= y12) { i = (y2 < y02) << 1 | x2 < x02; parent = new Array(4), parent[i] = node2, node2 = parent, z *= 2; switch (i) { case 0: x12 = x02 + z, y12 = y02 + z; break; case 1: x02 = x12 - z, y12 = y02 + z; break; case 2: x12 = x02 + z, y02 = y12 - z; break; case 3: x02 = x12 - z, y02 = y12 - z; break; } } if (this._root && this._root.length) this._root = node2; } this._x0 = x02; this._y0 = y02; this._x1 = x12; this._y1 = y12; return this; } function tree_data() { var data = []; this.visit(function(node2) { if (!node2.length) do data.push(node2.data); while (node2 = node2.next); }); return data; } function tree_extent(_2) { return arguments.length ? this.cover(+_2[0][0], +_2[0][1]).cover(+_2[1][0], +_2[1][1]) : isNaN(this._x0) ? void 0 : [[this._x0, this._y0], [this._x1, this._y1]]; } function Quad(node2, x02, y02, x12, y12) { this.node = node2; this.x0 = x02; this.y0 = y02; this.x1 = x12; this.y1 = y12; } function tree_find(x2, y2, radius) { var data, x02 = this._x0, y02 = this._y0, x12, y12, x22, y22, x3 = this._x1, y3 = this._y1, quads = [], node2 = this._root, q, i; if (node2) quads.push(new Quad(node2, x02, y02, x3, y3)); if (radius == null) radius = Infinity; else { x02 = x2 - radius, y02 = y2 - radius; x3 = x2 + radius, y3 = y2 + radius; radius *= radius; } while (q = quads.pop()) { if (!(node2 = q.node) || (x12 = q.x0) > x3 || (y12 = q.y0) > y3 || (x22 = q.x1) < x02 || (y22 = q.y1) < y02) continue; if (node2.length) { var xm = (x12 + x22) / 2, ym = (y12 + y22) / 2; quads.push( new Quad(node2[3], xm, ym, x22, y22), new Quad(node2[2], x12, ym, xm, y22), new Quad(node2[1], xm, y12, x22, ym), new Quad(node2[0], x12, y12, xm, ym) ); if (i = (y2 >= ym) << 1 | x2 >= xm) { q = quads[quads.length - 1]; quads[quads.length - 1] = quads[quads.length - 1 - i]; quads[quads.length - 1 - i] = q; } } else { var dx = x2 - +this._x.call(null, node2.data), dy = y2 - +this._y.call(null, node2.data), d2 = dx * dx + dy * dy; if (d2 < radius) { var d = Math.sqrt(radius = d2); x02 = x2 - d, y02 = y2 - d; x3 = x2 + d, y3 = y2 + d; data = node2.data; } } } return data; } function tree_remove(d) { if (isNaN(x2 = +this._x.call(null, d)) || isNaN(y2 = +this._y.call(null, d))) return this; var parent, node2 = this._root, retainer, previous, next2, x02 = this._x0, y02 = this._y0, x12 = this._x1, y12 = this._y1, x2, y2, xm, ym, right2, bottom2, i, j; if (!node2) return this; if (node2.length) while (true) { if (right2 = x2 >= (xm = (x02 + x12) / 2)) x02 = xm; else x12 = xm; if (bottom2 = y2 >= (ym = (y02 + y12) / 2)) y02 = ym; else y12 = ym; if (!(parent = node2, node2 = node2[i = bottom2 << 1 | right2])) return this; if (!node2.length) break; if (parent[i + 1 & 3] || parent[i + 2 & 3] || parent[i + 3 & 3]) retainer = parent, j = i; } while (node2.data !== d) if (!(previous = node2, node2 = node2.next)) return this; if (next2 = node2.next) delete node2.next; if (previous) return next2 ? previous.next = next2 : delete previous.next, this; if (!parent) return this._root = next2, this; next2 ? parent[i] = next2 : delete parent[i]; if ((node2 = parent[0] || parent[1] || parent[2] || parent[3]) && node2 === (parent[3] || parent[2] || parent[1] || parent[0]) && !node2.length) { if (retainer) retainer[j] = node2; else this._root = node2; } return this; } function removeAll(data) { for (var i = 0, n = data.length; i < n; ++i) this.remove(data[i]); return this; } function tree_root() { return this._root; } function tree_size() { var size = 0; this.visit(function(node2) { if (!node2.length) do ++size; while (node2 = node2.next); }); return size; } function tree_visit(callback) { var quads = [], q, node2 = this._root, child, x02, y02, x12, y12; if (node2) quads.push(new Quad(node2, this._x0, this._y0, this._x1, this._y1)); while (q = quads.pop()) { if (!callback(node2 = q.node, x02 = q.x0, y02 = q.y0, x12 = q.x1, y12 = q.y1) && node2.length) { var xm = (x02 + x12) / 2, ym = (y02 + y12) / 2; if (child = node2[3]) quads.push(new Quad(child, xm, ym, x12, y12)); if (child = node2[2]) quads.push(new Quad(child, x02, ym, xm, y12)); if (child = node2[1]) quads.push(new Quad(child, xm, y02, x12, ym)); if (child = node2[0]) quads.push(new Quad(child, x02, y02, xm, ym)); } } return this; } function tree_visitAfter(callback) { var quads = [], next2 = [], q; if (this._root) quads.push(new Quad(this._root, this._x0, this._y0, this._x1, this._y1)); while (q = quads.pop()) { var node2 = q.node; if (node2.length) { var child, x02 = q.x0, y02 = q.y0, x12 = q.x1, y12 = q.y1, xm = (x02 + x12) / 2, ym = (y02 + y12) / 2; if (child = node2[0]) quads.push(new Quad(child, x02, y02, xm, ym)); if (child = node2[1]) quads.push(new Quad(child, xm, y02, x12, ym)); if (child = node2[2]) quads.push(new Quad(child, x02, ym, xm, y12)); if (child = node2[3]) quads.push(new Quad(child, xm, ym, x12, y12)); } next2.push(q); } while (q = next2.pop()) { callback(q.node, q.x0, q.y0, q.x1, q.y1); } return this; } function defaultX(d) { return d[0]; } function tree_x(_2) { return arguments.length ? (this._x = _2, this) : this._x; } function defaultY(d) { return d[1]; } function tree_y(_2) { return arguments.length ? (this._y = _2, this) : this._y; } function quadtree(nodes, x2, y2) { var tree2 = new Quadtree(x2 == null ? defaultX : x2, y2 == null ? defaultY : y2, NaN, NaN, NaN, NaN); return nodes == null ? tree2 : tree2.addAll(nodes); } function Quadtree(x2, y2, x02, y02, x12, y12) { this._x = x2; this._y = y2; this._x0 = x02; this._y0 = y02; this._x1 = x12; this._y1 = y12; this._root = void 0; } function leaf_copy(leaf) { var copy2 = { data: leaf.data }, next2 = copy2; while (leaf = leaf.next) next2 = next2.next = { data: leaf.data }; return copy2; } var treeProto = quadtree.prototype = Quadtree.prototype; treeProto.copy = function() { var copy2 = new Quadtree(this._x, this._y, this._x0, this._y0, this._x1, this._y1), node2 = this._root, nodes, child; if (!node2) return copy2; if (!node2.length) return copy2._root = leaf_copy(node2), copy2; nodes = [{ source: node2, target: copy2._root = new Array(4) }]; while (node2 = nodes.pop()) { for (var i = 0; i < 4; ++i) { if (child = node2.source[i]) { if (child.length) nodes.push({ source: child, target: node2.target[i] = new Array(4) }); else node2.target[i] = leaf_copy(child); } } } return copy2; }; treeProto.add = tree_add; treeProto.addAll = addAll; treeProto.cover = tree_cover; treeProto.data = tree_data; treeProto.extent = tree_extent; treeProto.find = tree_find; treeProto.remove = tree_remove; treeProto.removeAll = removeAll; treeProto.root = tree_root; treeProto.size = tree_size; treeProto.visit = tree_visit; treeProto.visitAfter = tree_visitAfter; treeProto.x = tree_x; treeProto.y = tree_y; function constant$4(x2) { return function() { return x2; }; } function jiggle(random2) { return (random2() - 0.5) * 1e-6; } function x$4(d) { return d.x + d.vx; } function y$3(d) { return d.y + d.vy; } function collide(radius) { var nodes, radii, random2, strength = 1, iterations2 = 1; if (typeof radius !== "function") radius = constant$4(radius == null ? 1 : +radius); function force() { var i, n = nodes.length, tree2, node2, xi, yi, ri, ri2; for (var k2 = 0; k2 < iterations2; ++k2) { tree2 = quadtree(nodes, x$4, y$3).visitAfter(prepare); for (i = 0; i < n; ++i) { node2 = nodes[i]; ri = radii[node2.index], ri2 = ri * ri; xi = node2.x + node2.vx; yi = node2.y + node2.vy; tree2.visit(apply2); } } function apply2(quad, x02, y02, x12, y12) { var data = quad.data, rj = quad.r, r = ri + rj; if (data) { if (data.index > node2.index) { var x2 = xi - data.x - data.vx, y2 = yi - data.y - data.vy, l = x2 * x2 + y2 * y2; if (l < r * r) { if (x2 === 0) x2 = jiggle(random2), l += x2 * x2; if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; l = (r - (l = Math.sqrt(l))) / l * strength; node2.vx += (x2 *= l) * (r = (rj *= rj) / (ri2 + rj)); node2.vy += (y2 *= l) * r; data.vx -= x2 * (r = 1 - r); data.vy -= y2 * r; } } return; } return x02 > xi + r || x12 < xi - r || y02 > yi + r || y12 < yi - r; } } function prepare(quad) { if (quad.data) return quad.r = radii[quad.data.index]; for (var i = quad.r = 0; i < 4; ++i) { if (quad[i] && quad[i].r > quad.r) { quad.r = quad[i].r; } } } function initialize2() { if (!nodes) return; var i, n = nodes.length, node2; radii = new Array(n); for (i = 0; i < n; ++i) node2 = nodes[i], radii[node2.index] = +radius(node2, i, nodes); } force.initialize = function(_nodes, _random) { nodes = _nodes; random2 = _random; initialize2(); }; force.iterations = function(_2) { return arguments.length ? (iterations2 = +_2, force) : iterations2; }; force.strength = function(_2) { return arguments.length ? (strength = +_2, force) : strength; }; force.radius = function(_2) { return arguments.length ? (radius = typeof _2 === "function" ? _2 : constant$4(+_2), initialize2(), force) : radius; }; return force; } function index$3(d) { return d.index; } function find(nodeById, nodeId) { var node2 = nodeById.get(nodeId); if (!node2) throw new Error("node not found: " + nodeId); return node2; } function link$2(links2) { var id2 = index$3, strength = defaultStrength, strengths, distance2 = constant$4(30), distances, nodes, count2, bias, random2, iterations2 = 1; if (links2 == null) links2 = []; function defaultStrength(link2) { return 1 / Math.min(count2[link2.source.index], count2[link2.target.index]); } function force(alpha) { for (var k2 = 0, n = links2.length; k2 < iterations2; ++k2) { for (var i = 0, link2, source, target, x2, y2, l, b; i < n; ++i) { link2 = links2[i], source = link2.source, target = link2.target; x2 = target.x + target.vx - source.x - source.vx || jiggle(random2); y2 = target.y + target.vy - source.y - source.vy || jiggle(random2); l = Math.sqrt(x2 * x2 + y2 * y2); l = (l - distances[i]) / l * alpha * strengths[i]; x2 *= l, y2 *= l; target.vx -= x2 * (b = bias[i]); target.vy -= y2 * b; source.vx += x2 * (b = 1 - b); source.vy += y2 * b; } } } function initialize2() { if (!nodes) return; var i, n = nodes.length, m2 = links2.length, nodeById = new Map(nodes.map((d, i2) => [id2(d, i2, nodes), d])), link2; for (i = 0, count2 = new Array(n); i < m2; ++i) { link2 = links2[i], link2.index = i; if (typeof link2.source !== "object") link2.source = find(nodeById, link2.source); if (typeof link2.target !== "object") link2.target = find(nodeById, link2.target); count2[link2.source.index] = (count2[link2.source.index] || 0) + 1; count2[link2.target.index] = (count2[link2.target.index] || 0) + 1; } for (i = 0, bias = new Array(m2); i < m2; ++i) { link2 = links2[i], bias[i] = count2[link2.source.index] / (count2[link2.source.index] + count2[link2.target.index]); } strengths = new Array(m2), initializeStrength(); distances = new Array(m2), initializeDistance(); } function initializeStrength() { if (!nodes) return; for (var i = 0, n = links2.length; i < n; ++i) { strengths[i] = +strength(links2[i], i, links2); } } function initializeDistance() { if (!nodes) return; for (var i = 0, n = links2.length; i < n; ++i) { distances[i] = +distance2(links2[i], i, links2); } } force.initialize = function(_nodes, _random) { nodes = _nodes; random2 = _random; initialize2(); }; force.links = function(_2) { return arguments.length ? (links2 = _2, initialize2(), force) : links2; }; force.id = function(_2) { return arguments.length ? (id2 = _2, force) : id2; }; force.iterations = function(_2) { return arguments.length ? (iterations2 = +_2, force) : iterations2; }; force.strength = function(_2) { return arguments.length ? (strength = typeof _2 === "function" ? _2 : constant$4(+_2), initializeStrength(), force) : strength; }; force.distance = function(_2) { return arguments.length ? (distance2 = typeof _2 === "function" ? _2 : constant$4(+_2), initializeDistance(), force) : distance2; }; return force; } const a$2 = 1664525; const c$5 = 1013904223; const m$1 = 4294967296; function lcg$2() { let s2 = 1; return () => (s2 = (a$2 * s2 + c$5) % m$1) / m$1; } function x$3(d) { return d.x; } function y$2(d) { return d.y; } var initialRadius = 10, initialAngle = Math.PI * (3 - Math.sqrt(5)); function simulation(nodes) { var simulation2, alpha = 1, alphaMin = 1e-3, alphaDecay = 1 - Math.pow(alphaMin, 1 / 300), alphaTarget = 0, velocityDecay = 0.6, forces = /* @__PURE__ */ new Map(), stepper = timer(step), event = dispatch("tick", "end"), random2 = lcg$2(); if (nodes == null) nodes = []; function step() { tick(); event.call("tick", simulation2); if (alpha < alphaMin) { stepper.stop(); event.call("end", simulation2); } } function tick(iterations2) { var i, n = nodes.length, node2; if (iterations2 === void 0) iterations2 = 1; for (var k2 = 0; k2 < iterations2; ++k2) { alpha += (alphaTarget - alpha) * alphaDecay; forces.forEach(function(force) { force(alpha); }); for (i = 0; i < n; ++i) { node2 = nodes[i]; if (node2.fx == null) node2.x += node2.vx *= velocityDecay; else node2.x = node2.fx, node2.vx = 0; if (node2.fy == null) node2.y += node2.vy *= velocityDecay; else node2.y = node2.fy, node2.vy = 0; } } return simulation2; } function initializeNodes() { for (var i = 0, n = nodes.length, node2; i < n; ++i) { node2 = nodes[i], node2.index = i; if (node2.fx != null) node2.x = node2.fx; if (node2.fy != null) node2.y = node2.fy; if (isNaN(node2.x) || isNaN(node2.y)) { var radius = initialRadius * Math.sqrt(0.5 + i), angle2 = i * initialAngle; node2.x = radius * Math.cos(angle2); node2.y = radius * Math.sin(angle2); } if (isNaN(node2.vx) || isNaN(node2.vy)) { node2.vx = node2.vy = 0; } } } function initializeForce(force) { if (force.initialize) force.initialize(nodes, random2); return force; } initializeNodes(); return simulation2 = { tick, restart: function() { return stepper.restart(step), simulation2; }, stop: function() { return stepper.stop(), simulation2; }, nodes: function(_2) { return arguments.length ? (nodes = _2, initializeNodes(), forces.forEach(initializeForce), simulation2) : nodes; }, alpha: function(_2) { return arguments.length ? (alpha = +_2, simulation2) : alpha; }, alphaMin: function(_2) { return arguments.length ? (alphaMin = +_2, simulation2) : alphaMin; }, alphaDecay: function(_2) { return arguments.length ? (alphaDecay = +_2, simulation2) : +alphaDecay; }, alphaTarget: function(_2) { return arguments.length ? (alphaTarget = +_2, simulation2) : alphaTarget; }, velocityDecay: function(_2) { return arguments.length ? (velocityDecay = 1 - _2, simulation2) : 1 - velocityDecay; }, randomSource: function(_2) { return arguments.length ? (random2 = _2, forces.forEach(initializeForce), simulation2) : random2; }, force: function(name2, _2) { return arguments.length > 1 ? (_2 == null ? forces.delete(name2) : forces.set(name2, initializeForce(_2)), simulation2) : forces.get(name2); }, find: function(x2, y2, radius) { var i = 0, n = nodes.length, dx, dy, d2, node2, closest; if (radius == null) radius = Infinity; else radius *= radius; for (i = 0; i < n; ++i) { node2 = nodes[i]; dx = x2 - node2.x; dy = y2 - node2.y; d2 = dx * dx + dy * dy; if (d2 < radius) closest = node2, radius = d2; } return closest; }, on: function(name2, _2) { return arguments.length > 1 ? (event.on(name2, _2), simulation2) : event.on(name2); } }; } function manyBody() { var nodes, node2, random2, alpha, strength = constant$4(-30), strengths, distanceMin2 = 1, distanceMax2 = Infinity, theta2 = 0.81; function force(_2) { var i, n = nodes.length, tree2 = quadtree(nodes, x$3, y$2).visitAfter(accumulate); for (alpha = _2, i = 0; i < n; ++i) node2 = nodes[i], tree2.visit(apply2); } function initialize2() { if (!nodes) return; var i, n = nodes.length, node3; strengths = new Array(n); for (i = 0; i < n; ++i) node3 = nodes[i], strengths[node3.index] = +strength(node3, i, nodes); } function accumulate(quad) { var strength2 = 0, q, c2, weight = 0, x2, y2, i; if (quad.length) { for (x2 = y2 = i = 0; i < 4; ++i) { if ((q = quad[i]) && (c2 = Math.abs(q.value))) { strength2 += q.value, weight += c2, x2 += c2 * q.x, y2 += c2 * q.y; } } quad.x = x2 / weight; quad.y = y2 / weight; } else { q = quad; q.x = q.data.x; q.y = q.data.y; do strength2 += strengths[q.data.index]; while (q = q.next); } quad.value = strength2; } function apply2(quad, x12, _2, x2) { if (!quad.value) return true; var x3 = quad.x - node2.x, y2 = quad.y - node2.y, w2 = x2 - x12, l = x3 * x3 + y2 * y2; if (w2 * w2 / theta2 < l) { if (l < distanceMax2) { if (x3 === 0) x3 = jiggle(random2), l += x3 * x3; if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); node2.vx += x3 * quad.value * alpha / l; node2.vy += y2 * quad.value * alpha / l; } return true; } else if (quad.length || l >= distanceMax2) return; if (quad.data !== node2 || quad.next) { if (x3 === 0) x3 = jiggle(random2), l += x3 * x3; if (y2 === 0) y2 = jiggle(random2), l += y2 * y2; if (l < distanceMin2) l = Math.sqrt(distanceMin2 * l); } do if (quad.data !== node2) { w2 = strengths[quad.data.index] * alpha / l; node2.vx += x3 * w2; node2.vy += y2 * w2; } while (quad = quad.next); } force.initialize = function(_nodes, _random) { nodes = _nodes; random2 = _random; initialize2(); }; force.strength = function(_2) { return arguments.length ? (strength = typeof _2 === "function" ? _2 : constant$4(+_2), initialize2(), force) : strength; }; force.distanceMin = function(_2) { return arguments.length ? (distanceMin2 = _2 * _2, force) : Math.sqrt(distanceMin2); }; force.distanceMax = function(_2) { return arguments.length ? (distanceMax2 = _2 * _2, force) : Math.sqrt(distanceMax2); }; force.theta = function(_2) { return arguments.length ? (theta2 = _2 * _2, force) : Math.sqrt(theta2); }; return force; } function radial$1(radius, x2, y2) { var nodes, strength = constant$4(0.1), strengths, radiuses; if (typeof radius !== "function") radius = constant$4(+radius); if (x2 == null) x2 = 0; if (y2 == null) y2 = 0; function force(alpha) { for (var i = 0, n = nodes.length; i < n; ++i) { var node2 = nodes[i], dx = node2.x - x2 || 1e-6, dy = node2.y - y2 || 1e-6, r = Math.sqrt(dx * dx + dy * dy), k2 = (radiuses[i] - r) * strengths[i] * alpha / r; node2.vx += dx * k2; node2.vy += dy * k2; } } function initialize2() { if (!nodes) return; var i, n = nodes.length; strengths = new Array(n); radiuses = new Array(n); for (i = 0; i < n; ++i) { radiuses[i] = +radius(nodes[i], i, nodes); strengths[i] = isNaN(radiuses[i]) ? 0 : +strength(nodes[i], i, nodes); } } force.initialize = function(_2) { nodes = _2, initialize2(); }; force.strength = function(_2) { return arguments.length ? (strength = typeof _2 === "function" ? _2 : constant$4(+_2), initialize2(), force) : strength; }; force.radius = function(_2) { return arguments.length ? (radius = typeof _2 === "function" ? _2 : constant$4(+_2), initialize2(), force) : radius; }; force.x = function(_2) { return arguments.length ? (x2 = +_2, force) : x2; }; force.y = function(_2) { return arguments.length ? (y2 = +_2, force) : y2; }; return force; } function x$2(x2) { var strength = constant$4(0.1), nodes, strengths, xz; if (typeof x2 !== "function") x2 = constant$4(x2 == null ? 0 : +x2); function force(alpha) { for (var i = 0, n = nodes.length, node2; i < n; ++i) { node2 = nodes[i], node2.vx += (xz[i] - node2.x) * strengths[i] * alpha; } } function initialize2() { if (!nodes) return; var i, n = nodes.length; strengths = new Array(n); xz = new Array(n); for (i = 0; i < n; ++i) { strengths[i] = isNaN(xz[i] = +x2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); } } force.initialize = function(_2) { nodes = _2; initialize2(); }; force.strength = function(_2) { return arguments.length ? (strength = typeof _2 === "function" ? _2 : constant$4(+_2), initialize2(), force) : strength; }; force.x = function(_2) { return arguments.length ? (x2 = typeof _2 === "function" ? _2 : constant$4(+_2), initialize2(), force) : x2; }; return force; } function y$1(y2) { var strength = constant$4(0.1), nodes, strengths, yz; if (typeof y2 !== "function") y2 = constant$4(y2 == null ? 0 : +y2); function force(alpha) { for (var i = 0, n = nodes.length, node2; i < n; ++i) { node2 = nodes[i], node2.vy += (yz[i] - node2.y) * strengths[i] * alpha; } } function initialize2() { if (!nodes) return; var i, n = nodes.length; strengths = new Array(n); yz = new Array(n); for (i = 0; i < n; ++i) { strengths[i] = isNaN(yz[i] = +y2(nodes[i], i, nodes)) ? 0 : +strength(nodes[i], i, nodes); } } force.initialize = function(_2) { nodes = _2; initialize2(); }; force.strength = function(_2) { return arguments.length ? (strength = typeof _2 === "function" ? _2 : constant$4(+_2), initialize2(), force) : strength; }; force.y = function(_2) { return arguments.length ? (y2 = typeof _2 === "function" ? _2 : constant$4(+_2), initialize2(), force) : y2; }; return force; } function formatDecimal(x2) { return Math.abs(x2 = Math.round(x2)) >= 1e21 ? x2.toLocaleString("en").replace(/,/g, "") : x2.toString(10); } function formatDecimalParts(x2, p) { if ((i = (x2 = p ? x2.toExponential(p - 1) : x2.toExponential()).indexOf("e")) < 0) return null; var i, coefficient = x2.slice(0, i); return [ coefficient.length > 1 ? coefficient[0] + coefficient.slice(2) : coefficient, +x2.slice(i + 1) ]; } function exponent(x2) { return x2 = formatDecimalParts(Math.abs(x2)), x2 ? x2[1] : NaN; } function formatGroup(grouping, thousands) { return function(value, width2) { var i = value.length, t = [], j = 0, g = grouping[0], length2 = 0; while (i > 0 && g > 0) { if (length2 + g + 1 > width2) g = Math.max(1, width2 - length2); t.push(value.substring(i -= g, i + g)); if ((length2 += g + 1) > width2) break; g = grouping[j = (j + 1) % grouping.length]; } return t.reverse().join(thousands); }; } function formatNumerals(numerals) { return function(value) { return value.replace(/[0-9]/g, function(i) { return numerals[+i]; }); }; } var re = /^(?:(.)?([<>=^]))?([+\-( ])?([$#])?(0)?(\d+)?(,)?(\.\d+)?(~)?([a-z%])?$/i; function formatSpecifier(specifier) { if (!(match = re.exec(specifier))) throw new Error("invalid format: " + specifier); var match; return new FormatSpecifier({ fill: match[1], align: match[2], sign: match[3], symbol: match[4], zero: match[5], width: match[6], comma: match[7], precision: match[8] && match[8].slice(1), trim: match[9], type: match[10] }); } formatSpecifier.prototype = FormatSpecifier.prototype; function FormatSpecifier(specifier) { this.fill = specifier.fill === void 0 ? " " : specifier.fill + ""; this.align = specifier.align === void 0 ? ">" : specifier.align + ""; this.sign = specifier.sign === void 0 ? "-" : specifier.sign + ""; this.symbol = specifier.symbol === void 0 ? "" : specifier.symbol + ""; this.zero = !!specifier.zero; this.width = specifier.width === void 0 ? void 0 : +specifier.width; this.comma = !!specifier.comma; this.precision = specifier.precision === void 0 ? void 0 : +specifier.precision; this.trim = !!specifier.trim; this.type = specifier.type === void 0 ? "" : specifier.type + ""; } FormatSpecifier.prototype.toString = function() { return this.fill + this.align + this.sign + this.symbol + (this.zero ? "0" : "") + (this.width === void 0 ? "" : Math.max(1, this.width | 0)) + (this.comma ? "," : "") + (this.precision === void 0 ? "" : "." + Math.max(0, this.precision | 0)) + (this.trim ? "~" : "") + this.type; }; function formatTrim(s2) { out: for (var n = s2.length, i = 1, i0 = -1, i1; i < n; ++i) { switch (s2[i]) { case ".": i0 = i1 = i; break; case "0": if (i0 === 0) i0 = i; i1 = i; break; default: if (!+s2[i]) break out; if (i0 > 0) i0 = 0; break; } } return i0 > 0 ? s2.slice(0, i0) + s2.slice(i1 + 1) : s2; } var prefixExponent; function formatPrefixAuto(x2, p) { var d = formatDecimalParts(x2, p); if (!d) return x2 + ""; var coefficient = d[0], exponent2 = d[1], i = exponent2 - (prefixExponent = Math.max(-8, Math.min(8, Math.floor(exponent2 / 3))) * 3) + 1, n = coefficient.length; return i === n ? coefficient : i > n ? coefficient + new Array(i - n + 1).join("0") : i > 0 ? coefficient.slice(0, i) + "." + coefficient.slice(i) : "0." + new Array(1 - i).join("0") + formatDecimalParts(x2, Math.max(0, p + i - 1))[0]; } function formatRounded(x2, p) { var d = formatDecimalParts(x2, p); if (!d) return x2 + ""; var coefficient = d[0], exponent2 = d[1]; return exponent2 < 0 ? "0." + new Array(-exponent2).join("0") + coefficient : coefficient.length > exponent2 + 1 ? coefficient.slice(0, exponent2 + 1) + "." + coefficient.slice(exponent2 + 1) : coefficient + new Array(exponent2 - coefficient.length + 2).join("0"); } const formatTypes = { "%": (x2, p) => (x2 * 100).toFixed(p), "b": (x2) => Math.round(x2).toString(2), "c": (x2) => x2 + "", "d": formatDecimal, "e": (x2, p) => x2.toExponential(p), "f": (x2, p) => x2.toFixed(p), "g": (x2, p) => x2.toPrecision(p), "o": (x2) => Math.round(x2).toString(8), "p": (x2, p) => formatRounded(x2 * 100, p), "r": formatRounded, "s": formatPrefixAuto, "X": (x2) => Math.round(x2).toString(16).toUpperCase(), "x": (x2) => Math.round(x2).toString(16) }; function identity$6(x2) { return x2; } var map = Array.prototype.map, prefixes = ["y", "z", "a", "f", "p", "n", "\xB5", "m", "", "k", "M", "G", "T", "P", "E", "Z", "Y"]; function formatLocale$1(locale2) { var group2 = locale2.grouping === void 0 || locale2.thousands === void 0 ? identity$6 : formatGroup(map.call(locale2.grouping, Number), locale2.thousands + ""), currencyPrefix = locale2.currency === void 0 ? "" : locale2.currency[0] + "", currencySuffix = locale2.currency === void 0 ? "" : locale2.currency[1] + "", decimal = locale2.decimal === void 0 ? "." : locale2.decimal + "", numerals = locale2.numerals === void 0 ? identity$6 : formatNumerals(map.call(locale2.numerals, String)), percent = locale2.percent === void 0 ? "%" : locale2.percent + "", minus = locale2.minus === void 0 ? "\u2212" : locale2.minus + "", nan = locale2.nan === void 0 ? "NaN" : locale2.nan + ""; function newFormat(specifier) { specifier = formatSpecifier(specifier); var fill = specifier.fill, align = specifier.align, sign2 = specifier.sign, symbol = specifier.symbol, zero2 = specifier.zero, width2 = specifier.width, comma = specifier.comma, precision = specifier.precision, trim2 = specifier.trim, type2 = specifier.type; if (type2 === "n") comma = true, type2 = "g"; else if (!formatTypes[type2]) precision === void 0 && (precision = 12), trim2 = true, type2 = "g"; if (zero2 || fill === "0" && align === "=") zero2 = true, fill = "0", align = "="; var prefix = symbol === "$" ? currencyPrefix : symbol === "#" && /[boxX]/.test(type2) ? "0" + type2.toLowerCase() : "", suffix = symbol === "$" ? currencySuffix : /[%p]/.test(type2) ? percent : ""; var formatType = formatTypes[type2], maybeSuffix = /[defgprs%]/.test(type2); precision = precision === void 0 ? 6 : /[gprs]/.test(type2) ? Math.max(1, Math.min(21, precision)) : Math.max(0, Math.min(20, precision)); function format2(value) { var valuePrefix = prefix, valueSuffix = suffix, i, n, c2; if (type2 === "c") { valueSuffix = formatType(value) + valueSuffix; value = ""; } else { value = +value; var valueNegative = value < 0 || 1 / value < 0; value = isNaN(value) ? nan : formatType(Math.abs(value), precision); if (trim2) value = formatTrim(value); if (valueNegative && +value === 0 && sign2 !== "+") valueNegative = false; valuePrefix = (valueNegative ? sign2 === "(" ? sign2 : minus : sign2 === "-" || sign2 === "(" ? "" : sign2) + valuePrefix; valueSuffix = (type2 === "s" ? prefixes[8 + prefixExponent / 3] : "") + valueSuffix + (valueNegative && sign2 === "(" ? ")" : ""); if (maybeSuffix) { i = -1, n = value.length; while (++i < n) { if (c2 = value.charCodeAt(i), 48 > c2 || c2 > 57) { valueSuffix = (c2 === 46 ? decimal + value.slice(i + 1) : value.slice(i)) + valueSuffix; value = value.slice(0, i); break; } } } } if (comma && !zero2) value = group2(value, Infinity); var length2 = valuePrefix.length + value.length + valueSuffix.length, padding2 = length2 < width2 ? new Array(width2 - length2 + 1).join(fill) : ""; if (comma && zero2) value = group2(padding2 + value, padding2.length ? width2 - valueSuffix.length : Infinity), padding2 = ""; switch (align) { case "<": value = valuePrefix + value + valueSuffix + padding2; break; case "=": value = valuePrefix + padding2 + value + valueSuffix; break; case "^": value = padding2.slice(0, length2 = padding2.length >> 1) + valuePrefix + value + valueSuffix + padding2.slice(length2); break; default: value = padding2 + valuePrefix + value + valueSuffix; break; } return numerals(value); } format2.toString = function() { return specifier + ""; }; return format2; } function formatPrefix2(specifier, value) { var f = newFormat((specifier = formatSpecifier(specifier), specifier.type = "f", specifier)), e = Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3, k2 = Math.pow(10, -e), prefix = prefixes[8 + e / 3]; return function(value2) { return f(k2 * value2) + prefix; }; } return { format: newFormat, formatPrefix: formatPrefix2 }; } var locale$1; var format; var formatPrefix; defaultLocale$1({ thousands: ",", grouping: [3], currency: ["$", ""] }); function defaultLocale$1(definition) { locale$1 = formatLocale$1(definition); format = locale$1.format; formatPrefix = locale$1.formatPrefix; return locale$1; } function precisionFixed(step) { return Math.max(0, -exponent(Math.abs(step))); } function precisionPrefix(step, value) { return Math.max(0, Math.max(-8, Math.min(8, Math.floor(exponent(value) / 3))) * 3 - exponent(Math.abs(step))); } function precisionRound(step, max2) { step = Math.abs(step), max2 = Math.abs(max2) - step; return Math.max(0, exponent(max2) - exponent(step)) + 1; } var epsilon$1 = 1e-6; var epsilon2 = 1e-12; var pi$1 = Math.PI; var halfPi$1 = pi$1 / 2; var quarterPi = pi$1 / 4; var tau$1 = pi$1 * 2; var degrees = 180 / pi$1; var radians = pi$1 / 180; var abs$2 = Math.abs; var atan = Math.atan; var atan2$1 = Math.atan2; var cos$1 = Math.cos; var ceil = Math.ceil; var exp = Math.exp; var hypot = Math.hypot; var log$2 = Math.log; var pow$1 = Math.pow; var sin$1 = Math.sin; var sign$1 = Math.sign || function(x2) { return x2 > 0 ? 1 : x2 < 0 ? -1 : 0; }; var sqrt$2 = Math.sqrt; var tan = Math.tan; function acos$1(x2) { return x2 > 1 ? 0 : x2 < -1 ? pi$1 : Math.acos(x2); } function asin$1(x2) { return x2 > 1 ? halfPi$1 : x2 < -1 ? -halfPi$1 : Math.asin(x2); } function haversin(x2) { return (x2 = sin$1(x2 / 2)) * x2; } function noop$1() { } function streamGeometry(geometry, stream) { if (geometry && streamGeometryType.hasOwnProperty(geometry.type)) { streamGeometryType[geometry.type](geometry, stream); } } var streamObjectType = { Feature: function(object2, stream) { streamGeometry(object2.geometry, stream); }, FeatureCollection: function(object2, stream) { var features = object2.features, i = -1, n = features.length; while (++i < n) streamGeometry(features[i].geometry, stream); } }; var streamGeometryType = { Sphere: function(object2, stream) { stream.sphere(); }, Point: function(object2, stream) { object2 = object2.coordinates; stream.point(object2[0], object2[1], object2[2]); }, MultiPoint: function(object2, stream) { var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; while (++i < n) object2 = coordinates2[i], stream.point(object2[0], object2[1], object2[2]); }, LineString: function(object2, stream) { streamLine(object2.coordinates, stream, 0); }, MultiLineString: function(object2, stream) { var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; while (++i < n) streamLine(coordinates2[i], stream, 0); }, Polygon: function(object2, stream) { streamPolygon(object2.coordinates, stream); }, MultiPolygon: function(object2, stream) { var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; while (++i < n) streamPolygon(coordinates2[i], stream); }, GeometryCollection: function(object2, stream) { var geometries = object2.geometries, i = -1, n = geometries.length; while (++i < n) streamGeometry(geometries[i], stream); } }; function streamLine(coordinates2, stream, closed) { var i = -1, n = coordinates2.length - closed, coordinate; stream.lineStart(); while (++i < n) coordinate = coordinates2[i], stream.point(coordinate[0], coordinate[1], coordinate[2]); stream.lineEnd(); } function streamPolygon(coordinates2, stream) { var i = -1, n = coordinates2.length; stream.polygonStart(); while (++i < n) streamLine(coordinates2[i], stream, 1); stream.polygonEnd(); } function geoStream(object2, stream) { if (object2 && streamObjectType.hasOwnProperty(object2.type)) { streamObjectType[object2.type](object2, stream); } else { streamGeometry(object2, stream); } } var areaRingSum$1 = new Adder(); var areaSum$1 = new Adder(), lambda00$2, phi00$2, lambda0$2, cosPhi0$1, sinPhi0$1; var areaStream$1 = { point: noop$1, lineStart: noop$1, lineEnd: noop$1, polygonStart: function() { areaRingSum$1 = new Adder(); areaStream$1.lineStart = areaRingStart$1; areaStream$1.lineEnd = areaRingEnd$1; }, polygonEnd: function() { var areaRing = +areaRingSum$1; areaSum$1.add(areaRing < 0 ? tau$1 + areaRing : areaRing); this.lineStart = this.lineEnd = this.point = noop$1; }, sphere: function() { areaSum$1.add(tau$1); } }; function areaRingStart$1() { areaStream$1.point = areaPointFirst$1; } function areaRingEnd$1() { areaPoint$1(lambda00$2, phi00$2); } function areaPointFirst$1(lambda, phi2) { areaStream$1.point = areaPoint$1; lambda00$2 = lambda, phi00$2 = phi2; lambda *= radians, phi2 *= radians; lambda0$2 = lambda, cosPhi0$1 = cos$1(phi2 = phi2 / 2 + quarterPi), sinPhi0$1 = sin$1(phi2); } function areaPoint$1(lambda, phi2) { lambda *= radians, phi2 *= radians; phi2 = phi2 / 2 + quarterPi; var dLambda = lambda - lambda0$2, sdLambda = dLambda >= 0 ? 1 : -1, adLambda = sdLambda * dLambda, cosPhi = cos$1(phi2), sinPhi = sin$1(phi2), k2 = sinPhi0$1 * sinPhi, u2 = cosPhi0$1 * cosPhi + k2 * cos$1(adLambda), v = k2 * sdLambda * sin$1(adLambda); areaRingSum$1.add(atan2$1(v, u2)); lambda0$2 = lambda, cosPhi0$1 = cosPhi, sinPhi0$1 = sinPhi; } function area$2(object2) { areaSum$1 = new Adder(); geoStream(object2, areaStream$1); return areaSum$1 * 2; } function spherical(cartesian2) { return [atan2$1(cartesian2[1], cartesian2[0]), asin$1(cartesian2[2])]; } function cartesian(spherical2) { var lambda = spherical2[0], phi2 = spherical2[1], cosPhi = cos$1(phi2); return [cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi2)]; } function cartesianDot(a2, b) { return a2[0] * b[0] + a2[1] * b[1] + a2[2] * b[2]; } function cartesianCross(a2, b) { return [a2[1] * b[2] - a2[2] * b[1], a2[2] * b[0] - a2[0] * b[2], a2[0] * b[1] - a2[1] * b[0]]; } function cartesianAddInPlace(a2, b) { a2[0] += b[0], a2[1] += b[1], a2[2] += b[2]; } function cartesianScale(vector, k2) { return [vector[0] * k2, vector[1] * k2, vector[2] * k2]; } function cartesianNormalizeInPlace(d) { var l = sqrt$2(d[0] * d[0] + d[1] * d[1] + d[2] * d[2]); d[0] /= l, d[1] /= l, d[2] /= l; } var lambda0$1, phi0, lambda1, phi1, lambda2, lambda00$1, phi00$1, p0, deltaSum, ranges, range; var boundsStream$2 = { point: boundsPoint$1, lineStart: boundsLineStart, lineEnd: boundsLineEnd, polygonStart: function() { boundsStream$2.point = boundsRingPoint; boundsStream$2.lineStart = boundsRingStart; boundsStream$2.lineEnd = boundsRingEnd; deltaSum = new Adder(); areaStream$1.polygonStart(); }, polygonEnd: function() { areaStream$1.polygonEnd(); boundsStream$2.point = boundsPoint$1; boundsStream$2.lineStart = boundsLineStart; boundsStream$2.lineEnd = boundsLineEnd; if (areaRingSum$1 < 0) lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); else if (deltaSum > epsilon$1) phi1 = 90; else if (deltaSum < -epsilon$1) phi0 = -90; range[0] = lambda0$1, range[1] = lambda1; }, sphere: function() { lambda0$1 = -(lambda1 = 180), phi0 = -(phi1 = 90); } }; function boundsPoint$1(lambda, phi2) { ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); if (phi2 < phi0) phi0 = phi2; if (phi2 > phi1) phi1 = phi2; } function linePoint(lambda, phi2) { var p = cartesian([lambda * radians, phi2 * radians]); if (p0) { var normal2 = cartesianCross(p0, p), equatorial = [normal2[1], -normal2[0], 0], inflection = cartesianCross(equatorial, normal2); cartesianNormalizeInPlace(inflection); inflection = spherical(inflection); var delta = lambda - lambda2, sign2 = delta > 0 ? 1 : -1, lambdai = inflection[0] * degrees * sign2, phii, antimeridian = abs$2(delta) > 180; if (antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { phii = inflection[1] * degrees; if (phii > phi1) phi1 = phii; } else if (lambdai = (lambdai + 360) % 360 - 180, antimeridian ^ (sign2 * lambda2 < lambdai && lambdai < sign2 * lambda)) { phii = -inflection[1] * degrees; if (phii < phi0) phi0 = phii; } else { if (phi2 < phi0) phi0 = phi2; if (phi2 > phi1) phi1 = phi2; } if (antimeridian) { if (lambda < lambda2) { if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; } else { if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; } } else { if (lambda1 >= lambda0$1) { if (lambda < lambda0$1) lambda0$1 = lambda; if (lambda > lambda1) lambda1 = lambda; } else { if (lambda > lambda2) { if (angle(lambda0$1, lambda) > angle(lambda0$1, lambda1)) lambda1 = lambda; } else { if (angle(lambda, lambda1) > angle(lambda0$1, lambda1)) lambda0$1 = lambda; } } } } else { ranges.push(range = [lambda0$1 = lambda, lambda1 = lambda]); } if (phi2 < phi0) phi0 = phi2; if (phi2 > phi1) phi1 = phi2; p0 = p, lambda2 = lambda; } function boundsLineStart() { boundsStream$2.point = linePoint; } function boundsLineEnd() { range[0] = lambda0$1, range[1] = lambda1; boundsStream$2.point = boundsPoint$1; p0 = null; } function boundsRingPoint(lambda, phi2) { if (p0) { var delta = lambda - lambda2; deltaSum.add(abs$2(delta) > 180 ? delta + (delta > 0 ? 360 : -360) : delta); } else { lambda00$1 = lambda, phi00$1 = phi2; } areaStream$1.point(lambda, phi2); linePoint(lambda, phi2); } function boundsRingStart() { areaStream$1.lineStart(); } function boundsRingEnd() { boundsRingPoint(lambda00$1, phi00$1); areaStream$1.lineEnd(); if (abs$2(deltaSum) > epsilon$1) lambda0$1 = -(lambda1 = 180); range[0] = lambda0$1, range[1] = lambda1; p0 = null; } function angle(lambda02, lambda12) { return (lambda12 -= lambda02) < 0 ? lambda12 + 360 : lambda12; } function rangeCompare(a2, b) { return a2[0] - b[0]; } function rangeContains(range2, x2) { return range2[0] <= range2[1] ? range2[0] <= x2 && x2 <= range2[1] : x2 < range2[0] || range2[1] < x2; } function bounds$2(feature) { var i, n, a2, b, merged, deltaMax, delta; phi1 = lambda1 = -(lambda0$1 = phi0 = Infinity); ranges = []; geoStream(feature, boundsStream$2); if (n = ranges.length) { ranges.sort(rangeCompare); for (i = 1, a2 = ranges[0], merged = [a2]; i < n; ++i) { b = ranges[i]; if (rangeContains(a2, b[0]) || rangeContains(a2, b[1])) { if (angle(a2[0], b[1]) > angle(a2[0], a2[1])) a2[1] = b[1]; if (angle(b[0], a2[1]) > angle(a2[0], a2[1])) a2[0] = b[0]; } else { merged.push(a2 = b); } } for (deltaMax = -Infinity, n = merged.length - 1, i = 0, a2 = merged[n]; i <= n; a2 = b, ++i) { b = merged[i]; if ((delta = angle(a2[1], b[0])) > deltaMax) deltaMax = delta, lambda0$1 = b[0], lambda1 = a2[1]; } } ranges = range = null; return lambda0$1 === Infinity || phi0 === Infinity ? [[NaN, NaN], [NaN, NaN]] : [[lambda0$1, phi0], [lambda1, phi1]]; } var W0, W1, X0$1, Y0$1, Z0$1, X1$1, Y1$1, Z1$1, X2$1, Y2$1, Z2$1, lambda00, phi00, x0$4, y0$4, z0; var centroidStream$1 = { sphere: noop$1, point: centroidPoint$1, lineStart: centroidLineStart$1, lineEnd: centroidLineEnd$1, polygonStart: function() { centroidStream$1.lineStart = centroidRingStart$1; centroidStream$1.lineEnd = centroidRingEnd$1; }, polygonEnd: function() { centroidStream$1.lineStart = centroidLineStart$1; centroidStream$1.lineEnd = centroidLineEnd$1; } }; function centroidPoint$1(lambda, phi2) { lambda *= radians, phi2 *= radians; var cosPhi = cos$1(phi2); centroidPointCartesian(cosPhi * cos$1(lambda), cosPhi * sin$1(lambda), sin$1(phi2)); } function centroidPointCartesian(x2, y2, z) { ++W0; X0$1 += (x2 - X0$1) / W0; Y0$1 += (y2 - Y0$1) / W0; Z0$1 += (z - Z0$1) / W0; } function centroidLineStart$1() { centroidStream$1.point = centroidLinePointFirst; } function centroidLinePointFirst(lambda, phi2) { lambda *= radians, phi2 *= radians; var cosPhi = cos$1(phi2); x0$4 = cosPhi * cos$1(lambda); y0$4 = cosPhi * sin$1(lambda); z0 = sin$1(phi2); centroidStream$1.point = centroidLinePoint; centroidPointCartesian(x0$4, y0$4, z0); } function centroidLinePoint(lambda, phi2) { lambda *= radians, phi2 *= radians; var cosPhi = cos$1(phi2), x2 = cosPhi * cos$1(lambda), y2 = cosPhi * sin$1(lambda), z = sin$1(phi2), w2 = atan2$1(sqrt$2((w2 = y0$4 * z - z0 * y2) * w2 + (w2 = z0 * x2 - x0$4 * z) * w2 + (w2 = x0$4 * y2 - y0$4 * x2) * w2), x0$4 * x2 + y0$4 * y2 + z0 * z); W1 += w2; X1$1 += w2 * (x0$4 + (x0$4 = x2)); Y1$1 += w2 * (y0$4 + (y0$4 = y2)); Z1$1 += w2 * (z0 + (z0 = z)); centroidPointCartesian(x0$4, y0$4, z0); } function centroidLineEnd$1() { centroidStream$1.point = centroidPoint$1; } function centroidRingStart$1() { centroidStream$1.point = centroidRingPointFirst; } function centroidRingEnd$1() { centroidRingPoint(lambda00, phi00); centroidStream$1.point = centroidPoint$1; } function centroidRingPointFirst(lambda, phi2) { lambda00 = lambda, phi00 = phi2; lambda *= radians, phi2 *= radians; centroidStream$1.point = centroidRingPoint; var cosPhi = cos$1(phi2); x0$4 = cosPhi * cos$1(lambda); y0$4 = cosPhi * sin$1(lambda); z0 = sin$1(phi2); centroidPointCartesian(x0$4, y0$4, z0); } function centroidRingPoint(lambda, phi2) { lambda *= radians, phi2 *= radians; var cosPhi = cos$1(phi2), x2 = cosPhi * cos$1(lambda), y2 = cosPhi * sin$1(lambda), z = sin$1(phi2), cx = y0$4 * z - z0 * y2, cy = z0 * x2 - x0$4 * z, cz = x0$4 * y2 - y0$4 * x2, m2 = hypot(cx, cy, cz), w2 = asin$1(m2), v = m2 && -w2 / m2; X2$1.add(v * cx); Y2$1.add(v * cy); Z2$1.add(v * cz); W1 += w2; X1$1 += w2 * (x0$4 + (x0$4 = x2)); Y1$1 += w2 * (y0$4 + (y0$4 = y2)); Z1$1 += w2 * (z0 + (z0 = z)); centroidPointCartesian(x0$4, y0$4, z0); } function centroid$1(object2) { W0 = W1 = X0$1 = Y0$1 = Z0$1 = X1$1 = Y1$1 = Z1$1 = 0; X2$1 = new Adder(); Y2$1 = new Adder(); Z2$1 = new Adder(); geoStream(object2, centroidStream$1); var x2 = +X2$1, y2 = +Y2$1, z = +Z2$1, m2 = hypot(x2, y2, z); if (m2 < epsilon2) { x2 = X1$1, y2 = Y1$1, z = Z1$1; if (W1 < epsilon$1) x2 = X0$1, y2 = Y0$1, z = Z0$1; m2 = hypot(x2, y2, z); if (m2 < epsilon2) return [NaN, NaN]; } return [atan2$1(y2, x2) * degrees, asin$1(z / m2) * degrees]; } function constant$3(x2) { return function() { return x2; }; } function compose(a2, b) { function compose2(x2, y2) { return x2 = a2(x2, y2), b(x2[0], x2[1]); } if (a2.invert && b.invert) compose2.invert = function(x2, y2) { return x2 = b.invert(x2, y2), x2 && a2.invert(x2[0], x2[1]); }; return compose2; } function rotationIdentity(lambda, phi2) { return [abs$2(lambda) > pi$1 ? lambda + Math.round(-lambda / tau$1) * tau$1 : lambda, phi2]; } rotationIdentity.invert = rotationIdentity; function rotateRadians(deltaLambda, deltaPhi, deltaGamma) { return (deltaLambda %= tau$1) ? deltaPhi || deltaGamma ? compose(rotationLambda(deltaLambda), rotationPhiGamma(deltaPhi, deltaGamma)) : rotationLambda(deltaLambda) : deltaPhi || deltaGamma ? rotationPhiGamma(deltaPhi, deltaGamma) : rotationIdentity; } function forwardRotationLambda(deltaLambda) { return function(lambda, phi2) { return lambda += deltaLambda, [lambda > pi$1 ? lambda - tau$1 : lambda < -pi$1 ? lambda + tau$1 : lambda, phi2]; }; } function rotationLambda(deltaLambda) { var rotation2 = forwardRotationLambda(deltaLambda); rotation2.invert = forwardRotationLambda(-deltaLambda); return rotation2; } function rotationPhiGamma(deltaPhi, deltaGamma) { var cosDeltaPhi = cos$1(deltaPhi), sinDeltaPhi = sin$1(deltaPhi), cosDeltaGamma = cos$1(deltaGamma), sinDeltaGamma = sin$1(deltaGamma); function rotation2(lambda, phi2) { var cosPhi = cos$1(phi2), x2 = cos$1(lambda) * cosPhi, y2 = sin$1(lambda) * cosPhi, z = sin$1(phi2), k2 = z * cosDeltaPhi + x2 * sinDeltaPhi; return [ atan2$1(y2 * cosDeltaGamma - k2 * sinDeltaGamma, x2 * cosDeltaPhi - z * sinDeltaPhi), asin$1(k2 * cosDeltaGamma + y2 * sinDeltaGamma) ]; } rotation2.invert = function(lambda, phi2) { var cosPhi = cos$1(phi2), x2 = cos$1(lambda) * cosPhi, y2 = sin$1(lambda) * cosPhi, z = sin$1(phi2), k2 = z * cosDeltaGamma - y2 * sinDeltaGamma; return [ atan2$1(y2 * cosDeltaGamma + z * sinDeltaGamma, x2 * cosDeltaPhi + k2 * sinDeltaPhi), asin$1(k2 * cosDeltaPhi - x2 * sinDeltaPhi) ]; }; return rotation2; } function rotation(rotate) { rotate = rotateRadians(rotate[0] * radians, rotate[1] * radians, rotate.length > 2 ? rotate[2] * radians : 0); function forward(coordinates2) { coordinates2 = rotate(coordinates2[0] * radians, coordinates2[1] * radians); return coordinates2[0] *= degrees, coordinates2[1] *= degrees, coordinates2; } forward.invert = function(coordinates2) { coordinates2 = rotate.invert(coordinates2[0] * radians, coordinates2[1] * radians); return coordinates2[0] *= degrees, coordinates2[1] *= degrees, coordinates2; }; return forward; } function circleStream(stream, radius, delta, direction2, t02, t12) { if (!delta) return; var cosRadius = cos$1(radius), sinRadius = sin$1(radius), step = direction2 * delta; if (t02 == null) { t02 = radius + direction2 * tau$1; t12 = radius - step / 2; } else { t02 = circleRadius(cosRadius, t02); t12 = circleRadius(cosRadius, t12); if (direction2 > 0 ? t02 < t12 : t02 > t12) t02 += direction2 * tau$1; } for (var point2, t = t02; direction2 > 0 ? t > t12 : t < t12; t -= step) { point2 = spherical([cosRadius, -sinRadius * cos$1(t), -sinRadius * sin$1(t)]); stream.point(point2[0], point2[1]); } } function circleRadius(cosRadius, point2) { point2 = cartesian(point2), point2[0] -= cosRadius; cartesianNormalizeInPlace(point2); var radius = acos$1(-point2[1]); return ((-point2[2] < 0 ? -radius : radius) + tau$1 - epsilon$1) % tau$1; } function circle$4() { var center2 = constant$3([0, 0]), radius = constant$3(90), precision = constant$3(6), ring, rotate, stream = { point: point2 }; function point2(x2, y2) { ring.push(x2 = rotate(x2, y2)); x2[0] *= degrees, x2[1] *= degrees; } function circle2() { var c2 = center2.apply(this, arguments), r = radius.apply(this, arguments) * radians, p = precision.apply(this, arguments) * radians; ring = []; rotate = rotateRadians(-c2[0] * radians, -c2[1] * radians, 0).invert; circleStream(stream, r, p, 1); c2 = { type: "Polygon", coordinates: [ring] }; ring = rotate = null; return c2; } circle2.center = function(_2) { return arguments.length ? (center2 = typeof _2 === "function" ? _2 : constant$3([+_2[0], +_2[1]]), circle2) : center2; }; circle2.radius = function(_2) { return arguments.length ? (radius = typeof _2 === "function" ? _2 : constant$3(+_2), circle2) : radius; }; circle2.precision = function(_2) { return arguments.length ? (precision = typeof _2 === "function" ? _2 : constant$3(+_2), circle2) : precision; }; return circle2; } function clipBuffer() { var lines = [], line2; return { point: function(x2, y2, m2) { line2.push([x2, y2, m2]); }, lineStart: function() { lines.push(line2 = []); }, lineEnd: noop$1, rejoin: function() { if (lines.length > 1) lines.push(lines.pop().concat(lines.shift())); }, result: function() { var result = lines; lines = []; line2 = null; return result; } }; } function pointEqual(a2, b) { return abs$2(a2[0] - b[0]) < epsilon$1 && abs$2(a2[1] - b[1]) < epsilon$1; } function Intersection(point2, points, other, entry) { this.x = point2; this.z = points; this.o = other; this.e = entry; this.v = false; this.n = this.p = null; } function clipRejoin(segments, compareIntersection2, startInside, interpolate2, stream) { var subject = [], clip2 = [], i, n; segments.forEach(function(segment) { if ((n2 = segment.length - 1) <= 0) return; var n2, p02 = segment[0], p1 = segment[n2], x2; if (pointEqual(p02, p1)) { if (!p02[2] && !p1[2]) { stream.lineStart(); for (i = 0; i < n2; ++i) stream.point((p02 = segment[i])[0], p02[1]); stream.lineEnd(); return; } p1[0] += 2 * epsilon$1; } subject.push(x2 = new Intersection(p02, segment, null, true)); clip2.push(x2.o = new Intersection(p02, null, x2, false)); subject.push(x2 = new Intersection(p1, segment, null, false)); clip2.push(x2.o = new Intersection(p1, null, x2, true)); }); if (!subject.length) return; clip2.sort(compareIntersection2); link$1(subject); link$1(clip2); for (i = 0, n = clip2.length; i < n; ++i) { clip2[i].e = startInside = !startInside; } var start2 = subject[0], points, point2; while (1) { var current = start2, isSubject = true; while (current.v) if ((current = current.n) === start2) 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((point2 = points[i])[0], point2[1]); } else { interpolate2(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((point2 = points[i])[0], point2[1]); } else { interpolate2(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$1(array2) { if (!(n = array2.length)) return; var n, i = 0, a2 = array2[0], b; while (++i < n) { a2.n = b = array2[i]; b.p = a2; a2 = b; } a2.n = b = array2[0]; b.p = a2; } function longitude(point2) { return abs$2(point2[0]) <= pi$1 ? point2[0] : sign$1(point2[0]) * ((abs$2(point2[0]) + pi$1) % tau$1 - pi$1); } function polygonContains(polygon, point2) { var lambda = longitude(point2), phi2 = point2[1], sinPhi = sin$1(phi2), normal2 = [sin$1(lambda), -cos$1(lambda), 0], angle2 = 0, winding = 0; var sum2 = new Adder(); if (sinPhi === 1) phi2 = halfPi$1 + epsilon$1; else if (sinPhi === -1) phi2 = -halfPi$1 - epsilon$1; for (var i = 0, n = polygon.length; i < n; ++i) { if (!(m2 = (ring = polygon[i]).length)) continue; var ring, m2, point0 = ring[m2 - 1], lambda02 = longitude(point0), phi02 = point0[1] / 2 + quarterPi, sinPhi02 = sin$1(phi02), cosPhi02 = cos$1(phi02); for (var j = 0; j < m2; ++j, lambda02 = lambda12, sinPhi02 = sinPhi1, cosPhi02 = cosPhi1, point0 = point1) { var point1 = ring[j], lambda12 = longitude(point1), phi12 = point1[1] / 2 + quarterPi, sinPhi1 = sin$1(phi12), cosPhi1 = cos$1(phi12), delta = lambda12 - lambda02, sign2 = delta >= 0 ? 1 : -1, absDelta = sign2 * delta, antimeridian = absDelta > pi$1, k2 = sinPhi02 * sinPhi1; sum2.add(atan2$1(k2 * sign2 * sin$1(absDelta), cosPhi02 * cosPhi1 + k2 * cos$1(absDelta))); angle2 += antimeridian ? delta + sign2 * tau$1 : delta; if (antimeridian ^ lambda02 >= lambda ^ lambda12 >= lambda) { var arc = cartesianCross(cartesian(point0), cartesian(point1)); cartesianNormalizeInPlace(arc); var intersection2 = cartesianCross(normal2, arc); cartesianNormalizeInPlace(intersection2); var phiArc = (antimeridian ^ delta >= 0 ? -1 : 1) * asin$1(intersection2[2]); if (phi2 > phiArc || phi2 === phiArc && (arc[0] || arc[1])) { winding += antimeridian ^ delta >= 0 ? 1 : -1; } } } } return (angle2 < -epsilon$1 || angle2 < epsilon$1 && sum2 < -epsilon2) ^ winding & 1; } function clip(pointVisible, clipLine2, interpolate2, start2) { return function(sink) { var line2 = clipLine2(sink), ringBuffer = clipBuffer(), ringSink = clipLine2(ringBuffer), polygonStarted = false, polygon, segments, ring; var clip2 = { point: point2, lineStart, lineEnd, polygonStart: function() { clip2.point = pointRing; clip2.lineStart = ringStart; clip2.lineEnd = ringEnd; segments = []; polygon = []; }, polygonEnd: function() { clip2.point = point2; clip2.lineStart = lineStart; clip2.lineEnd = lineEnd; segments = merge$1(segments); var startInside = polygonContains(polygon, start2); if (segments.length) { if (!polygonStarted) sink.polygonStart(), polygonStarted = true; clipRejoin(segments, compareIntersection, startInside, interpolate2, sink); } else if (startInside) { if (!polygonStarted) sink.polygonStart(), polygonStarted = true; sink.lineStart(); interpolate2(null, null, 1, sink); sink.lineEnd(); } if (polygonStarted) sink.polygonEnd(), polygonStarted = false; segments = polygon = null; }, sphere: function() { sink.polygonStart(); sink.lineStart(); interpolate2(null, null, 1, sink); sink.lineEnd(); sink.polygonEnd(); } }; function point2(lambda, phi2) { if (pointVisible(lambda, phi2)) sink.point(lambda, phi2); } function pointLine(lambda, phi2) { line2.point(lambda, phi2); } function lineStart() { clip2.point = pointLine; line2.lineStart(); } function lineEnd() { clip2.point = point2; line2.lineEnd(); } function pointRing(lambda, phi2) { ring.push([lambda, phi2]); ringSink.point(lambda, phi2); } 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, m2, segment, point3; ring.pop(); polygon.push(ring); ring = null; if (!n) return; if (clean & 1) { segment = ringSegments[0]; if ((m2 = segment.length - 1) > 0) { if (!polygonStarted) sink.polygonStart(), polygonStarted = true; sink.lineStart(); for (i = 0; i < m2; ++i) sink.point((point3 = segment[i])[0], point3[1]); sink.lineEnd(); } return; } if (n > 1 && clean & 2) ringSegments.push(ringSegments.pop().concat(ringSegments.shift())); segments.push(ringSegments.filter(validSegment)); } return clip2; }; } function validSegment(segment) { return segment.length > 1; } function compareIntersection(a2, b) { return ((a2 = a2.x)[0] < 0 ? a2[1] - halfPi$1 - epsilon$1 : halfPi$1 - a2[1]) - ((b = b.x)[0] < 0 ? b[1] - halfPi$1 - epsilon$1 : halfPi$1 - b[1]); } const clipAntimeridian = clip( function() { return true; }, clipAntimeridianLine, clipAntimeridianInterpolate, [-pi$1, -halfPi$1] ); function clipAntimeridianLine(stream) { var lambda02 = NaN, phi02 = NaN, sign0 = NaN, clean; return { lineStart: function() { stream.lineStart(); clean = 1; }, point: function(lambda12, phi12) { var sign1 = lambda12 > 0 ? pi$1 : -pi$1, delta = abs$2(lambda12 - lambda02); if (abs$2(delta - pi$1) < epsilon$1) { stream.point(lambda02, phi02 = (phi02 + phi12) / 2 > 0 ? halfPi$1 : -halfPi$1); stream.point(sign0, phi02); stream.lineEnd(); stream.lineStart(); stream.point(sign1, phi02); stream.point(lambda12, phi02); clean = 0; } else if (sign0 !== sign1 && delta >= pi$1) { if (abs$2(lambda02 - sign0) < epsilon$1) lambda02 -= sign0 * epsilon$1; if (abs$2(lambda12 - sign1) < epsilon$1) lambda12 -= sign1 * epsilon$1; phi02 = clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12); stream.point(sign0, phi02); stream.lineEnd(); stream.lineStart(); stream.point(sign1, phi02); clean = 0; } stream.point(lambda02 = lambda12, phi02 = phi12); sign0 = sign1; }, lineEnd: function() { stream.lineEnd(); lambda02 = phi02 = NaN; }, clean: function() { return 2 - clean; } }; } function clipAntimeridianIntersect(lambda02, phi02, lambda12, phi12) { var cosPhi02, cosPhi1, sinLambda0Lambda1 = sin$1(lambda02 - lambda12); return abs$2(sinLambda0Lambda1) > epsilon$1 ? atan((sin$1(phi02) * (cosPhi1 = cos$1(phi12)) * sin$1(lambda12) - sin$1(phi12) * (cosPhi02 = cos$1(phi02)) * sin$1(lambda02)) / (cosPhi02 * cosPhi1 * sinLambda0Lambda1)) : (phi02 + phi12) / 2; } function clipAntimeridianInterpolate(from2, to, direction2, stream) { var phi2; if (from2 == null) { phi2 = direction2 * halfPi$1; stream.point(-pi$1, phi2); stream.point(0, phi2); stream.point(pi$1, phi2); stream.point(pi$1, 0); stream.point(pi$1, -phi2); stream.point(0, -phi2); stream.point(-pi$1, -phi2); stream.point(-pi$1, 0); stream.point(-pi$1, phi2); } else if (abs$2(from2[0] - to[0]) > epsilon$1) { var lambda = from2[0] < to[0] ? pi$1 : -pi$1; phi2 = direction2 * lambda / 2; stream.point(-lambda, phi2); stream.point(0, phi2); stream.point(lambda, phi2); } else { stream.point(to[0], to[1]); } } function clipCircle(radius) { var cr = cos$1(radius), delta = 6 * radians, smallRadius = cr > 0, notHemisphere = abs$2(cr) > epsilon$1; function interpolate2(from2, to, direction2, stream) { circleStream(stream, radius, delta, direction2, from2, to); } function visible(lambda, phi2) { return cos$1(lambda) * cos$1(phi2) > cr; } function clipLine2(stream) { var point0, c0, v0, v00, clean; return { lineStart: function() { v00 = v0 = false; clean = 1; }, point: function(lambda, phi2) { var point1 = [lambda, phi2], point2, v = visible(lambda, phi2), c2 = smallRadius ? v ? 0 : code(lambda, phi2) : v ? code(lambda + (lambda < 0 ? pi$1 : -pi$1), phi2) : 0; if (!point0 && (v00 = v0 = v)) stream.lineStart(); if (v !== v0) { point2 = intersect2(point0, point1); if (!point2 || pointEqual(point0, point2) || pointEqual(point1, point2)) point1[2] = 1; } if (v !== v0) { clean = 0; if (v) { stream.lineStart(); point2 = intersect2(point1, point0); stream.point(point2[0], point2[1]); } else { point2 = intersect2(point0, point1); stream.point(point2[0], point2[1], 2); stream.lineEnd(); } point0 = point2; } else if (notHemisphere && point0 && smallRadius ^ v) { var t; if (!(c2 & c0) && (t = intersect2(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 = c2; }, lineEnd: function() { if (v0) stream.lineEnd(); point0 = null; }, clean: function() { return clean | (v00 && v0) << 1; } }; } function intersect2(a2, b, two) { var pa = cartesian(a2), pb = cartesian(b); var n1 = [1, 0, 0], n2 = cartesianCross(pa, pb), n2n2 = cartesianDot(n2, n2), n1n2 = n2[0], determinant = n2n2 - n1n2 * n1n2; if (!determinant) return !two && a2; var c1 = cr * n2n2 / determinant, c2 = -cr * n1n2 / determinant, n1xn2 = cartesianCross(n1, n2), A5 = cartesianScale(n1, c1), B2 = cartesianScale(n2, c2); cartesianAddInPlace(A5, B2); var u2 = n1xn2, w2 = cartesianDot(A5, u2), uu = cartesianDot(u2, u2), t22 = w2 * w2 - uu * (cartesianDot(A5, A5) - 1); if (t22 < 0) return; var t = sqrt$2(t22), q = cartesianScale(u2, (-w2 - t) / uu); cartesianAddInPlace(q, A5); q = spherical(q); if (!two) return q; var lambda02 = a2[0], lambda12 = b[0], phi02 = a2[1], phi12 = b[1], z; if (lambda12 < lambda02) z = lambda02, lambda02 = lambda12, lambda12 = z; var delta2 = lambda12 - lambda02, polar = abs$2(delta2 - pi$1) < epsilon$1, meridian = polar || delta2 < epsilon$1; if (!polar && phi12 < phi02) z = phi02, phi02 = phi12, phi12 = z; if (meridian ? polar ? phi02 + phi12 > 0 ^ q[1] < (abs$2(q[0] - lambda02) < epsilon$1 ? phi02 : phi12) : phi02 <= q[1] && q[1] <= phi12 : delta2 > pi$1 ^ (lambda02 <= q[0] && q[0] <= lambda12)) { var q1 = cartesianScale(u2, (-w2 + t) / uu); cartesianAddInPlace(q1, A5); return [q, spherical(q1)]; } } function code(lambda, phi2) { var r = smallRadius ? radius : pi$1 - radius, code2 = 0; if (lambda < -r) code2 |= 1; else if (lambda > r) code2 |= 2; if (phi2 < -r) code2 |= 4; else if (phi2 > r) code2 |= 8; return code2; } return clip(visible, clipLine2, interpolate2, smallRadius ? [0, -radius] : [-pi$1, radius - pi$1]); } function clipLine(a2, b, x02, y02, x12, y12) { var ax = a2[0], ay = a2[1], bx = b[0], by = b[1], t02 = 0, t12 = 1, dx = bx - ax, dy = by - ay, r; r = x02 - ax; if (!dx && r > 0) return; r /= dx; if (dx < 0) { if (r < t02) return; if (r < t12) t12 = r; } else if (dx > 0) { if (r > t12) return; if (r > t02) t02 = r; } r = x12 - ax; if (!dx && r < 0) return; r /= dx; if (dx < 0) { if (r > t12) return; if (r > t02) t02 = r; } else if (dx > 0) { if (r < t02) return; if (r < t12) t12 = r; } r = y02 - ay; if (!dy && r > 0) return; r /= dy; if (dy < 0) { if (r < t02) return; if (r < t12) t12 = r; } else if (dy > 0) { if (r > t12) return; if (r > t02) t02 = r; } r = y12 - ay; if (!dy && r < 0) return; r /= dy; if (dy < 0) { if (r > t12) return; if (r > t02) t02 = r; } else if (dy > 0) { if (r < t02) return; if (r < t12) t12 = r; } if (t02 > 0) a2[0] = ax + t02 * dx, a2[1] = ay + t02 * dy; if (t12 < 1) b[0] = ax + t12 * dx, b[1] = ay + t12 * dy; return true; } var clipMax = 1e9, clipMin = -clipMax; function clipRectangle(x02, y02, x12, y12) { function visible(x2, y2) { return x02 <= x2 && x2 <= x12 && y02 <= y2 && y2 <= y12; } function interpolate2(from2, to, direction2, stream) { var a2 = 0, a1 = 0; if (from2 == null || (a2 = corner(from2, direction2)) !== (a1 = corner(to, direction2)) || comparePoint(from2, to) < 0 ^ direction2 > 0) { do stream.point(a2 === 0 || a2 === 3 ? x02 : x12, a2 > 1 ? y12 : y02); while ((a2 = (a2 + direction2 + 4) % 4) !== a1); } else { stream.point(to[0], to[1]); } } function corner(p, direction2) { return abs$2(p[0] - x02) < epsilon$1 ? direction2 > 0 ? 0 : 3 : abs$2(p[0] - x12) < epsilon$1 ? direction2 > 0 ? 2 : 1 : abs$2(p[1] - y02) < epsilon$1 ? direction2 > 0 ? 1 : 0 : direction2 > 0 ? 3 : 2; } function compareIntersection2(a2, b) { return comparePoint(a2.x, b.x); } function comparePoint(a2, b) { var ca = corner(a2, 1), cb = corner(b, 1); return ca !== cb ? ca - cb : ca === 0 ? b[1] - a2[1] : ca === 1 ? a2[0] - b[0] : ca === 2 ? a2[1] - b[1] : b[0] - a2[0]; } return function(stream) { var activeStream = stream, bufferStream = clipBuffer(), segments, polygon, ring, x__, y__, v__, x_, y_, v_, first, clean; var clipStream = { point: point2, lineStart, lineEnd, polygonStart, polygonEnd }; function point2(x2, y2) { if (visible(x2, y2)) activeStream.point(x2, y2); } function polygonInside() { var winding = 0; for (var i = 0, n = polygon.length; i < n; ++i) { for (var ring2 = polygon[i], j = 1, m2 = ring2.length, point3 = ring2[0], a0, a1, b02 = point3[0], b12 = point3[1]; j < m2; ++j) { a0 = b02, a1 = b12, point3 = ring2[j], b02 = point3[0], b12 = point3[1]; if (a1 <= y12) { if (b12 > y12 && (b02 - a0) * (y12 - a1) > (b12 - a1) * (x02 - a0)) ++winding; } else { if (b12 <= y12 && (b02 - a0) * (y12 - a1) < (b12 - a1) * (x02 - a0)) --winding; } } } return winding; } function polygonStart() { activeStream = bufferStream, segments = [], polygon = [], clean = true; } function polygonEnd() { var startInside = polygonInside(), cleanInside = clean && startInside, visible2 = (segments = merge$1(segments)).length; if (cleanInside || visible2) { stream.polygonStart(); if (cleanInside) { stream.lineStart(); interpolate2(null, null, 1, stream); stream.lineEnd(); } if (visible2) { clipRejoin(segments, compareIntersection2, startInside, interpolate2, stream); } stream.polygonEnd(); } activeStream = stream, segments = polygon = ring = null; } function lineStart() { clipStream.point = linePoint2; if (polygon) polygon.push(ring = []); first = true; v_ = false; x_ = y_ = NaN; } function lineEnd() { if (segments) { linePoint2(x__, y__); if (v__ && v_) bufferStream.rejoin(); segments.push(bufferStream.result()); } clipStream.point = point2; if (v_) activeStream.lineEnd(); } function linePoint2(x2, y2) { var v = visible(x2, y2); if (polygon) ring.push([x2, y2]); if (first) { x__ = x2, y__ = y2, v__ = v; first = false; if (v) { activeStream.lineStart(); activeStream.point(x2, y2); } } else { if (v && v_) activeStream.point(x2, y2); else { var a2 = [x_ = Math.max(clipMin, Math.min(clipMax, x_)), y_ = Math.max(clipMin, Math.min(clipMax, y_))], b = [x2 = Math.max(clipMin, Math.min(clipMax, x2)), y2 = Math.max(clipMin, Math.min(clipMax, y2))]; if (clipLine(a2, b, x02, y02, x12, y12)) { if (!v_) { activeStream.lineStart(); activeStream.point(a2[0], a2[1]); } activeStream.point(b[0], b[1]); if (!v) activeStream.lineEnd(); clean = false; } else if (v) { activeStream.lineStart(); activeStream.point(x2, y2); clean = false; } } } x_ = x2, y_ = y2, v_ = v; } return clipStream; }; } function extent() { var x02 = 0, y02 = 0, x12 = 960, y12 = 500, cache, cacheStream, clip2; return clip2 = { stream: function(stream) { return cache && cacheStream === stream ? cache : cache = clipRectangle(x02, y02, x12, y12)(cacheStream = stream); }, extent: function(_2) { return arguments.length ? (x02 = +_2[0][0], y02 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1], cache = cacheStream = null, clip2) : [[x02, y02], [x12, y12]]; } }; } var lengthSum$1, lambda0, sinPhi0, cosPhi0; var lengthStream$1 = { sphere: noop$1, point: noop$1, lineStart: lengthLineStart, lineEnd: noop$1, polygonStart: noop$1, polygonEnd: noop$1 }; function lengthLineStart() { lengthStream$1.point = lengthPointFirst$1; lengthStream$1.lineEnd = lengthLineEnd; } function lengthLineEnd() { lengthStream$1.point = lengthStream$1.lineEnd = noop$1; } function lengthPointFirst$1(lambda, phi2) { lambda *= radians, phi2 *= radians; lambda0 = lambda, sinPhi0 = sin$1(phi2), cosPhi0 = cos$1(phi2); lengthStream$1.point = lengthPoint$1; } function lengthPoint$1(lambda, phi2) { lambda *= radians, phi2 *= radians; var sinPhi = sin$1(phi2), cosPhi = cos$1(phi2), delta = abs$2(lambda - lambda0), cosDelta = cos$1(delta), sinDelta = sin$1(delta), x2 = cosPhi * sinDelta, y2 = cosPhi0 * sinPhi - sinPhi0 * cosPhi * cosDelta, z = sinPhi0 * sinPhi + cosPhi0 * cosPhi * cosDelta; lengthSum$1.add(atan2$1(sqrt$2(x2 * x2 + y2 * y2), z)); lambda0 = lambda, sinPhi0 = sinPhi, cosPhi0 = cosPhi; } function length$2(object2) { lengthSum$1 = new Adder(); geoStream(object2, lengthStream$1); return +lengthSum$1; } var coordinates = [null, null], object = { type: "LineString", coordinates }; function distance$1(a2, b) { coordinates[0] = a2; coordinates[1] = b; return length$2(object); } var containsObjectType = { Feature: function(object2, point2) { return containsGeometry(object2.geometry, point2); }, FeatureCollection: function(object2, point2) { var features = object2.features, i = -1, n = features.length; while (++i < n) if (containsGeometry(features[i].geometry, point2)) return true; return false; } }; var containsGeometryType = { Sphere: function() { return true; }, Point: function(object2, point2) { return containsPoint(object2.coordinates, point2); }, MultiPoint: function(object2, point2) { var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; while (++i < n) if (containsPoint(coordinates2[i], point2)) return true; return false; }, LineString: function(object2, point2) { return containsLine(object2.coordinates, point2); }, MultiLineString: function(object2, point2) { var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; while (++i < n) if (containsLine(coordinates2[i], point2)) return true; return false; }, Polygon: function(object2, point2) { return containsPolygon(object2.coordinates, point2); }, MultiPolygon: function(object2, point2) { var coordinates2 = object2.coordinates, i = -1, n = coordinates2.length; while (++i < n) if (containsPolygon(coordinates2[i], point2)) return true; return false; }, GeometryCollection: function(object2, point2) { var geometries = object2.geometries, i = -1, n = geometries.length; while (++i < n) if (containsGeometry(geometries[i], point2)) return true; return false; } }; function containsGeometry(geometry, point2) { return geometry && containsGeometryType.hasOwnProperty(geometry.type) ? containsGeometryType[geometry.type](geometry, point2) : false; } function containsPoint(coordinates2, point2) { return distance$1(coordinates2, point2) === 0; } function containsLine(coordinates2, point2) { var ao, bo, ab; for (var i = 0, n = coordinates2.length; i < n; i++) { bo = distance$1(coordinates2[i], point2); if (bo === 0) return true; if (i > 0) { ab = distance$1(coordinates2[i], coordinates2[i - 1]); if (ab > 0 && ao <= ab && bo <= ab && (ao + bo - ab) * (1 - Math.pow((ao - bo) / ab, 2)) < epsilon2 * ab) return true; } ao = bo; } return false; } function containsPolygon(coordinates2, point2) { return !!polygonContains(coordinates2.map(ringRadians), pointRadians(point2)); } function ringRadians(ring) { return ring = ring.map(pointRadians), ring.pop(), ring; } function pointRadians(point2) { return [point2[0] * radians, point2[1] * radians]; } function contains$1(object2, point2) { return (object2 && containsObjectType.hasOwnProperty(object2.type) ? containsObjectType[object2.type] : containsGeometry)(object2, point2); } function graticuleX(y02, y12, dy) { var y2 = range$2(y02, y12 - epsilon$1, dy).concat(y12); return function(x2) { return y2.map(function(y3) { return [x2, y3]; }); }; } function graticuleY(x02, x12, dx) { var x2 = range$2(x02, x12 - epsilon$1, dx).concat(x12); return function(y2) { return x2.map(function(x3) { return [x3, y2]; }); }; } function graticule() { var x12, x02, X12, X02, y12, y02, Y12, Y02, dx = 10, dy = dx, DX = 90, DY = 360, x2, y2, X3, Y3, precision = 2.5; function graticule2() { return { type: "MultiLineString", coordinates: lines() }; } function lines() { return range$2(ceil(X02 / DX) * DX, X12, DX).map(X3).concat(range$2(ceil(Y02 / DY) * DY, Y12, DY).map(Y3)).concat(range$2(ceil(x02 / dx) * dx, x12, dx).filter(function(x3) { return abs$2(x3 % DX) > epsilon$1; }).map(x2)).concat(range$2(ceil(y02 / dy) * dy, y12, dy).filter(function(y3) { return abs$2(y3 % DY) > epsilon$1; }).map(y2)); } graticule2.lines = function() { return lines().map(function(coordinates2) { return { type: "LineString", coordinates: coordinates2 }; }); }; graticule2.outline = function() { return { type: "Polygon", coordinates: [ X3(X02).concat( Y3(Y12).slice(1), X3(X12).reverse().slice(1), Y3(Y02).reverse().slice(1) ) ] }; }; graticule2.extent = function(_2) { if (!arguments.length) return graticule2.extentMinor(); return graticule2.extentMajor(_2).extentMinor(_2); }; graticule2.extentMajor = function(_2) { if (!arguments.length) return [[X02, Y02], [X12, Y12]]; X02 = +_2[0][0], X12 = +_2[1][0]; Y02 = +_2[0][1], Y12 = +_2[1][1]; if (X02 > X12) _2 = X02, X02 = X12, X12 = _2; if (Y02 > Y12) _2 = Y02, Y02 = Y12, Y12 = _2; return graticule2.precision(precision); }; graticule2.extentMinor = function(_2) { if (!arguments.length) return [[x02, y02], [x12, y12]]; x02 = +_2[0][0], x12 = +_2[1][0]; y02 = +_2[0][1], y12 = +_2[1][1]; if (x02 > x12) _2 = x02, x02 = x12, x12 = _2; if (y02 > y12) _2 = y02, y02 = y12, y12 = _2; return graticule2.precision(precision); }; graticule2.step = function(_2) { if (!arguments.length) return graticule2.stepMinor(); return graticule2.stepMajor(_2).stepMinor(_2); }; graticule2.stepMajor = function(_2) { if (!arguments.length) return [DX, DY]; DX = +_2[0], DY = +_2[1]; return graticule2; }; graticule2.stepMinor = function(_2) { if (!arguments.length) return [dx, dy]; dx = +_2[0], dy = +_2[1]; return graticule2; }; graticule2.precision = function(_2) { if (!arguments.length) return precision; precision = +_2; x2 = graticuleX(y02, y12, 90); y2 = graticuleY(x02, x12, precision); X3 = graticuleX(Y02, Y12, 90); Y3 = graticuleY(X02, X12, precision); return graticule2; }; return graticule2.extentMajor([[-180, -90 + epsilon$1], [180, 90 - epsilon$1]]).extentMinor([[-180, -80 - epsilon$1], [180, 80 + epsilon$1]]); } function graticule10() { return graticule()(); } function interpolate(a2, b) { var x02 = a2[0] * radians, y02 = a2[1] * radians, x12 = b[0] * radians, y12 = b[1] * radians, cy0 = cos$1(y02), sy0 = sin$1(y02), cy1 = cos$1(y12), sy1 = sin$1(y12), kx0 = cy0 * cos$1(x02), ky0 = cy0 * sin$1(x02), kx1 = cy1 * cos$1(x12), ky1 = cy1 * sin$1(x12), d = 2 * asin$1(sqrt$2(haversin(y12 - y02) + cy0 * cy1 * haversin(x12 - x02))), k2 = sin$1(d); var interpolate2 = d ? function(t) { var B2 = sin$1(t *= d) / k2, A5 = sin$1(d - t) / k2, x2 = A5 * kx0 + B2 * kx1, y2 = A5 * ky0 + B2 * ky1, z = A5 * sy0 + B2 * sy1; return [ atan2$1(y2, x2) * degrees, atan2$1(z, sqrt$2(x2 * x2 + y2 * y2)) * degrees ]; } : function() { return [x02 * degrees, y02 * degrees]; }; interpolate2.distance = d; return interpolate2; } const identity$5 = (x2) => x2; var areaSum = new Adder(), areaRingSum = new Adder(), x00$2, y00$2, x0$3, y0$3; var areaStream = { point: noop$1, lineStart: noop$1, lineEnd: noop$1, polygonStart: function() { areaStream.lineStart = areaRingStart; areaStream.lineEnd = areaRingEnd; }, polygonEnd: function() { areaStream.lineStart = areaStream.lineEnd = areaStream.point = noop$1; areaSum.add(abs$2(areaRingSum)); areaRingSum = new Adder(); }, result: function() { var area2 = areaSum / 2; areaSum = new Adder(); return area2; } }; function areaRingStart() { areaStream.point = areaPointFirst; } function areaPointFirst(x2, y2) { areaStream.point = areaPoint; x00$2 = x0$3 = x2, y00$2 = y0$3 = y2; } function areaPoint(x2, y2) { areaRingSum.add(y0$3 * x2 - x0$3 * y2); x0$3 = x2, y0$3 = y2; } function areaRingEnd() { areaPoint(x00$2, y00$2); } const pathArea = areaStream; var x0$2 = Infinity, y0$2 = x0$2, x1 = -x0$2, y1 = x1; var boundsStream = { point: boundsPoint, lineStart: noop$1, lineEnd: noop$1, polygonStart: noop$1, polygonEnd: noop$1, result: function() { var bounds2 = [[x0$2, y0$2], [x1, y1]]; x1 = y1 = -(y0$2 = x0$2 = Infinity); return bounds2; } }; function boundsPoint(x2, y2) { if (x2 < x0$2) x0$2 = x2; if (x2 > x1) x1 = x2; if (y2 < y0$2) y0$2 = y2; if (y2 > y1) y1 = y2; } const boundsStream$1 = boundsStream; 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 centroid2 = 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 centroid2; } }; function centroidPoint(x2, y2) { X0 += x2; Y0 += y2; ++Z0; } function centroidLineStart() { centroidStream.point = centroidPointFirstLine; } function centroidPointFirstLine(x2, y2) { centroidStream.point = centroidPointLine; centroidPoint(x0$1 = x2, y0$1 = y2); } function centroidPointLine(x2, y2) { var dx = x2 - x0$1, dy = y2 - y0$1, z = sqrt$2(dx * dx + dy * dy); X1 += z * (x0$1 + x2) / 2; Y1 += z * (y0$1 + y2) / 2; Z1 += z; centroidPoint(x0$1 = x2, y0$1 = y2); } function centroidLineEnd() { centroidStream.point = centroidPoint; } function centroidRingStart() { centroidStream.point = centroidPointFirstRing; } function centroidRingEnd() { centroidPointRing(x00$1, y00$1); } function centroidPointFirstRing(x2, y2) { centroidStream.point = centroidPointRing; centroidPoint(x00$1 = x0$1 = x2, y00$1 = y0$1 = y2); } function centroidPointRing(x2, y2) { var dx = x2 - x0$1, dy = y2 - y0$1, z = sqrt$2(dx * dx + dy * dy); X1 += z * (x0$1 + x2) / 2; Y1 += z * (y0$1 + y2) / 2; Z1 += z; z = y0$1 * x2 - x0$1 * y2; X2 += z * (x0$1 + x2); Y2 += z * (y0$1 + y2); Z2 += z * 3; centroidPoint(x0$1 = x2, y0$1 = y2); } const pathCentroid = centroidStream; function PathContext(context) { this._context = context; } PathContext.prototype = { _radius: 4.5, pointRadius: function(_2) { return this._radius = _2, 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(x2, y2) { switch (this._point) { case 0: { this._context.moveTo(x2, y2); this._point = 1; break; } case 1: { this._context.lineTo(x2, y2); break; } default: { this._context.moveTo(x2 + this._radius, y2); this._context.arc(x2, y2, this._radius, 0, tau$1); break; } } }, result: noop$1 }; var lengthSum = new Adder(), lengthRing, x00, y00, x0, y0; var lengthStream = { point: noop$1, lineStart: function() { lengthStream.point = lengthPointFirst; }, lineEnd: function() { if (lengthRing) lengthPoint(x00, y00); lengthStream.point = noop$1; }, polygonStart: function() { lengthRing = true; }, polygonEnd: function() { lengthRing = null; }, result: function() { var length2 = +lengthSum; lengthSum = new Adder(); return length2; } }; function lengthPointFirst(x2, y2) { lengthStream.point = lengthPoint; x00 = x0 = x2, y00 = y0 = y2; } function lengthPoint(x2, y2) { x0 -= x2, y0 -= y2; lengthSum.add(sqrt$2(x0 * x0 + y0 * y0)); x0 = x2, y0 = y2; } const pathMeasure = lengthStream; function PathString() { this._string = []; } PathString.prototype = { _radius: 4.5, _circle: circle$3(4.5), pointRadius: function(_2) { if ((_2 = +_2) !== this._radius) this._radius = _2, this._circle = null; return this; }, polygonStart: function() { this._line = 0; }, polygonEnd: function() { this._line = NaN; }, lineStart: function() { this._point = 0; }, lineEnd: function() { if (this._line === 0) this._string.push("Z"); this._point = NaN; }, point: function(x2, y2) { switch (this._point) { case 0: { this._string.push("M", x2, ",", y2); this._point = 1; break; } case 1: { this._string.push("L", x2, ",", y2); break; } default: { if (this._circle == null) this._circle = circle$3(this._radius); this._string.push("M", x2, ",", y2, this._circle); break; } } }, result: function() { if (this._string.length) { var result = this._string.join(""); this._string = []; return result; } else { return null; } } }; function circle$3(radius) { return "m0," + radius + "a" + radius + "," + radius + " 0 1,1 0," + -2 * radius + "a" + radius + "," + radius + " 0 1,1 0," + 2 * radius + "z"; } function index$2(projection2, context) { var pointRadius = 4.5, projectionStream, contextStream; function path2(object2) { if (object2) { if (typeof pointRadius === "function") contextStream.pointRadius(+pointRadius.apply(this, arguments)); geoStream(object2, projectionStream(contextStream)); } return contextStream.result(); } path2.area = function(object2) { geoStream(object2, projectionStream(pathArea)); return pathArea.result(); }; path2.measure = function(object2) { geoStream(object2, projectionStream(pathMeasure)); return pathMeasure.result(); }; path2.bounds = function(object2) { geoStream(object2, projectionStream(boundsStream$1)); return boundsStream$1.result(); }; path2.centroid = function(object2) { geoStream(object2, projectionStream(pathCentroid)); return pathCentroid.result(); }; path2.projection = function(_2) { return arguments.length ? (projectionStream = _2 == null ? (projection2 = null, identity$5) : (projection2 = _2).stream, path2) : projection2; }; path2.context = function(_2) { if (!arguments.length) return context; contextStream = _2 == null ? (context = null, new PathString()) : new PathContext(context = _2); if (typeof pointRadius !== "function") contextStream.pointRadius(pointRadius); return path2; }; path2.pointRadius = function(_2) { if (!arguments.length) return pointRadius; pointRadius = typeof _2 === "function" ? _2 : (contextStream.pointRadius(+_2), +_2); return path2; }; return path2.projection(projection2).context(context); } function transform$1(methods) { return { stream: transformer$3(methods) }; } function transformer$3(methods) { return function(stream) { var s2 = new TransformStream(); for (var key in methods) s2[key] = methods[key]; s2.stream = stream; return s2; }; } function TransformStream() { } TransformStream.prototype = { constructor: TransformStream, point: function(x2, y2) { this.stream.point(x2, y2); }, 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(projection2, fitBounds, object2) { var clip2 = projection2.clipExtent && projection2.clipExtent(); projection2.scale(150).translate([0, 0]); if (clip2 != null) projection2.clipExtent(null); geoStream(object2, projection2.stream(boundsStream$1)); fitBounds(boundsStream$1.result()); if (clip2 != null) projection2.clipExtent(clip2); return projection2; } function fitExtent(projection2, extent2, object2) { return fit(projection2, function(b) { var w2 = extent2[1][0] - extent2[0][0], h = extent2[1][1] - extent2[0][1], k2 = Math.min(w2 / (b[1][0] - b[0][0]), h / (b[1][1] - b[0][1])), x2 = +extent2[0][0] + (w2 - k2 * (b[1][0] + b[0][0])) / 2, y2 = +extent2[0][1] + (h - k2 * (b[1][1] + b[0][1])) / 2; projection2.scale(150 * k2).translate([x2, y2]); }, object2); } function fitSize(projection2, size, object2) { return fitExtent(projection2, [[0, 0], size], object2); } function fitWidth(projection2, width2, object2) { return fit(projection2, function(b) { var w2 = +width2, k2 = w2 / (b[1][0] - b[0][0]), x2 = (w2 - k2 * (b[1][0] + b[0][0])) / 2, y2 = -k2 * b[0][1]; projection2.scale(150 * k2).translate([x2, y2]); }, object2); } function fitHeight(projection2, height2, object2) { return fit(projection2, function(b) { var h = +height2, k2 = h / (b[1][1] - b[0][1]), x2 = -k2 * b[0][0], y2 = (h - k2 * (b[1][1] + b[0][1])) / 2; projection2.scale(150 * k2).translate([x2, y2]); }, object2); } var maxDepth = 16, cosMinDistance = cos$1(30 * radians); function resample(project, delta2) { return +delta2 ? resample$1(project, delta2) : resampleNone(project); } function resampleNone(project) { return transformer$3({ point: function(x2, y2) { x2 = project(x2, y2); this.stream.point(x2[0], x2[1]); } }); } function resample$1(project, delta2) { function resampleLineTo(x02, y02, lambda02, a0, b02, c0, x12, y12, lambda12, a1, b12, c1, depth, stream) { var dx = x12 - x02, dy = y12 - y02, d2 = dx * dx + dy * dy; if (d2 > 4 * delta2 && depth--) { var a2 = a0 + a1, b = b02 + b12, c2 = c0 + c1, m2 = sqrt$2(a2 * a2 + b * b + c2 * c2), phi2 = asin$1(c2 /= m2), lambda22 = abs$2(abs$2(c2) - 1) < epsilon$1 || abs$2(lambda02 - lambda12) < epsilon$1 ? (lambda02 + lambda12) / 2 : atan2$1(b, a2), p = project(lambda22, phi2), x2 = p[0], y2 = p[1], dx2 = x2 - x02, dy2 = y2 - y02, dz = dy * dx2 - dx * dy2; if (dz * dz / d2 > delta2 || abs$2((dx * dx2 + dy * dy2) / d2 - 0.5) > 0.3 || a0 * a1 + b02 * b12 + c0 * c1 < cosMinDistance) { resampleLineTo(x02, y02, lambda02, a0, b02, c0, x2, y2, lambda22, a2 /= m2, b /= m2, c2, depth, stream); stream.point(x2, y2); resampleLineTo(x2, y2, lambda22, a2, b, c2, x12, y12, lambda12, a1, b12, c1, depth, stream); } } } return function(stream) { var lambda002, x002, y002, a00, b00, c00, lambda02, x02, y02, a0, b02, c0; var resampleStream = { point: point2, lineStart, lineEnd, polygonStart: function() { stream.polygonStart(); resampleStream.lineStart = ringStart; }, polygonEnd: function() { stream.polygonEnd(); resampleStream.lineStart = lineStart; } }; function point2(x2, y2) { x2 = project(x2, y2); stream.point(x2[0], x2[1]); } function lineStart() { x02 = NaN; resampleStream.point = linePoint2; stream.lineStart(); } function linePoint2(lambda, phi2) { var c2 = cartesian([lambda, phi2]), p = project(lambda, phi2); resampleLineTo(x02, y02, lambda02, a0, b02, c0, x02 = p[0], y02 = p[1], lambda02 = lambda, a0 = c2[0], b02 = c2[1], c0 = c2[2], maxDepth, stream); stream.point(x02, y02); } function lineEnd() { resampleStream.point = point2; stream.lineEnd(); } function ringStart() { lineStart(); resampleStream.point = ringPoint; resampleStream.lineEnd = ringEnd; } function ringPoint(lambda, phi2) { linePoint2(lambda002 = lambda, phi2), x002 = x02, y002 = y02, a00 = a0, b00 = b02, c00 = c0; resampleStream.point = linePoint2; } function ringEnd() { resampleLineTo(x02, y02, lambda02, a0, b02, c0, x002, y002, lambda002, a00, b00, c00, maxDepth, stream); resampleStream.lineEnd = lineEnd; lineEnd(); } return resampleStream; }; } var transformRadians = transformer$3({ point: function(x2, y2) { this.stream.point(x2 * radians, y2 * radians); } }); function transformRotate(rotate) { return transformer$3({ point: function(x2, y2) { var r = rotate(x2, y2); return this.stream.point(r[0], r[1]); } }); } function scaleTranslate(k2, dx, dy, sx, sy) { function transform2(x2, y2) { x2 *= sx; y2 *= sy; return [dx + k2 * x2, dy - k2 * y2]; } transform2.invert = function(x2, y2) { return [(x2 - dx) / k2 * sx, (dy - y2) / k2 * sy]; }; return transform2; } function scaleTranslateRotate(k2, dx, dy, sx, sy, alpha) { if (!alpha) return scaleTranslate(k2, dx, dy, sx, sy); var cosAlpha = cos$1(alpha), sinAlpha = sin$1(alpha), a2 = cosAlpha * k2, b = sinAlpha * k2, ai = cosAlpha / k2, bi = sinAlpha / k2, ci = (sinAlpha * dy - cosAlpha * dx) / k2, fi = (sinAlpha * dx + cosAlpha * dy) / k2; function transform2(x2, y2) { x2 *= sx; y2 *= sy; return [a2 * x2 - b * y2 + dx, dy - b * x2 - a2 * y2]; } transform2.invert = function(x2, y2) { return [sx * (ai * x2 - bi * y2 + ci), sy * (fi - bi * x2 - ai * y2)]; }; return transform2; } function projection(project) { return projectionMutator(function() { return project; })(); } function projectionMutator(projectAt) { var project, k2 = 150, x2 = 480, y2 = 250, lambda = 0, phi2 = 0, deltaLambda = 0, deltaPhi = 0, deltaGamma = 0, rotate, alpha = 0, sx = 1, sy = 1, theta = null, preclip = clipAntimeridian, x02 = null, y02, x12, y12, postclip = identity$5, delta2 = 0.5, projectResample, projectTransform, projectRotateTransform, cache, cacheStream; function projection2(point2) { return projectRotateTransform(point2[0] * radians, point2[1] * radians); } function invert2(point2) { point2 = projectRotateTransform.invert(point2[0], point2[1]); return point2 && [point2[0] * degrees, point2[1] * degrees]; } projection2.stream = function(stream) { return cache && cacheStream === stream ? cache : cache = transformRadians(transformRotate(rotate)(preclip(projectResample(postclip(cacheStream = stream))))); }; projection2.preclip = function(_2) { return arguments.length ? (preclip = _2, theta = void 0, reset2()) : preclip; }; projection2.postclip = function(_2) { return arguments.length ? (postclip = _2, x02 = y02 = x12 = y12 = null, reset2()) : postclip; }; projection2.clipAngle = function(_2) { return arguments.length ? (preclip = +_2 ? clipCircle(theta = _2 * radians) : (theta = null, clipAntimeridian), reset2()) : theta * degrees; }; projection2.clipExtent = function(_2) { return arguments.length ? (postclip = _2 == null ? (x02 = y02 = x12 = y12 = null, identity$5) : clipRectangle(x02 = +_2[0][0], y02 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reset2()) : x02 == null ? null : [[x02, y02], [x12, y12]]; }; projection2.scale = function(_2) { return arguments.length ? (k2 = +_2, recenter()) : k2; }; projection2.translate = function(_2) { return arguments.length ? (x2 = +_2[0], y2 = +_2[1], recenter()) : [x2, y2]; }; projection2.center = function(_2) { return arguments.length ? (lambda = _2[0] % 360 * radians, phi2 = _2[1] % 360 * radians, recenter()) : [lambda * degrees, phi2 * degrees]; }; projection2.rotate = function(_2) { return arguments.length ? (deltaLambda = _2[0] % 360 * radians, deltaPhi = _2[1] % 360 * radians, deltaGamma = _2.length > 2 ? _2[2] % 360 * radians : 0, recenter()) : [deltaLambda * degrees, deltaPhi * degrees, deltaGamma * degrees]; }; projection2.angle = function(_2) { return arguments.length ? (alpha = _2 % 360 * radians, recenter()) : alpha * degrees; }; projection2.reflectX = function(_2) { return arguments.length ? (sx = _2 ? -1 : 1, recenter()) : sx < 0; }; projection2.reflectY = function(_2) { return arguments.length ? (sy = _2 ? -1 : 1, recenter()) : sy < 0; }; projection2.precision = function(_2) { return arguments.length ? (projectResample = resample(projectTransform, delta2 = _2 * _2), reset2()) : sqrt$2(delta2); }; projection2.fitExtent = function(extent2, object2) { return fitExtent(projection2, extent2, object2); }; projection2.fitSize = function(size, object2) { return fitSize(projection2, size, object2); }; projection2.fitWidth = function(width2, object2) { return fitWidth(projection2, width2, object2); }; projection2.fitHeight = function(height2, object2) { return fitHeight(projection2, height2, object2); }; function recenter() { var center2 = scaleTranslateRotate(k2, 0, 0, sx, sy, alpha).apply(null, project(lambda, phi2)), transform2 = scaleTranslateRotate(k2, x2 - center2[0], y2 - center2[1], sx, sy, alpha); rotate = rotateRadians(deltaLambda, deltaPhi, deltaGamma); projectTransform = compose(project, transform2); projectRotateTransform = compose(rotate, projectTransform); projectResample = resample(projectTransform, delta2); return reset2(); } function reset2() { cache = cacheStream = null; return projection2; } return function() { project = projectAt.apply(this, arguments); projection2.invert = project.invert && invert2; return recenter(); }; } function conicProjection(projectAt) { var phi02 = 0, phi12 = pi$1 / 3, m2 = projectionMutator(projectAt), p = m2(phi02, phi12); p.parallels = function(_2) { return arguments.length ? m2(phi02 = _2[0] * radians, phi12 = _2[1] * radians) : [phi02 * degrees, phi12 * degrees]; }; return p; } function cylindricalEqualAreaRaw(phi02) { var cosPhi02 = cos$1(phi02); function forward(lambda, phi2) { return [lambda * cosPhi02, sin$1(phi2) / cosPhi02]; } forward.invert = function(x2, y2) { return [x2 / cosPhi02, asin$1(y2 * cosPhi02)]; }; return forward; } function conicEqualAreaRaw(y02, y12) { var sy0 = sin$1(y02), n = (sy0 + sin$1(y12)) / 2; if (abs$2(n) < epsilon$1) return cylindricalEqualAreaRaw(y02); var c2 = 1 + sy0 * (2 * n - sy0), r0 = sqrt$2(c2) / n; function project(x2, y2) { var r = sqrt$2(c2 - 2 * n * sin$1(y2)) / n; return [r * sin$1(x2 *= n), r0 - r * cos$1(x2)]; } project.invert = function(x2, y2) { var r0y = r0 - y2, l = atan2$1(x2, abs$2(r0y)) * sign$1(r0y); if (r0y * n < 0) l -= pi$1 * sign$1(x2) * sign$1(r0y); return [l / n, asin$1((c2 - (x2 * x2 + r0y * r0y) * n * n) / (2 * n))]; }; return project; } function conicEqualArea() { return conicProjection(conicEqualAreaRaw).scale(155.424).center([0, 33.6442]); } function albers() { return conicEqualArea().parallels([29.5, 45.5]).scale(1070).translate([480, 250]).rotate([96, 0]).center([-0.6, 38.7]); } function multiplex(streams) { var n = streams.length; return { point: function(x2, y2) { var i = -1; while (++i < n) streams[i].point(x2, y2); }, sphere: function() { var i = -1; while (++i < n) streams[i].sphere(); }, lineStart: function() { var i = -1; while (++i < n) streams[i].lineStart(); }, lineEnd: function() { var i = -1; while (++i < n) streams[i].lineEnd(); }, polygonStart: function() { var i = -1; while (++i < n) streams[i].polygonStart(); }, polygonEnd: function() { var i = -1; while (++i < n) streams[i].polygonEnd(); } }; } function albersUsa() { var cache, cacheStream, lower48 = albers(), lower48Point, alaska = conicEqualArea().rotate([154, 0]).center([-2, 58.5]).parallels([55, 65]), alaskaPoint, hawaii = conicEqualArea().rotate([157, 0]).center([-3, 19.9]).parallels([8, 18]), hawaiiPoint, point2, pointStream = { point: function(x2, y2) { point2 = [x2, y2]; } }; function albersUsa2(coordinates2) { var x2 = coordinates2[0], y2 = coordinates2[1]; return point2 = null, (lower48Point.point(x2, y2), point2) || (alaskaPoint.point(x2, y2), point2) || (hawaiiPoint.point(x2, y2), point2); } albersUsa2.invert = function(coordinates2) { var k2 = lower48.scale(), t = lower48.translate(), x2 = (coordinates2[0] - t[0]) / k2, y2 = (coordinates2[1] - t[1]) / k2; return (y2 >= 0.12 && y2 < 0.234 && x2 >= -0.425 && x2 < -0.214 ? alaska : y2 >= 0.166 && y2 < 0.234 && x2 >= -0.214 && x2 < -0.115 ? hawaii : lower48).invert(coordinates2); }; albersUsa2.stream = function(stream) { return cache && cacheStream === stream ? cache : cache = multiplex([lower48.stream(cacheStream = stream), alaska.stream(stream), hawaii.stream(stream)]); }; albersUsa2.precision = function(_2) { if (!arguments.length) return lower48.precision(); lower48.precision(_2), alaska.precision(_2), hawaii.precision(_2); return reset2(); }; albersUsa2.scale = function(_2) { if (!arguments.length) return lower48.scale(); lower48.scale(_2), alaska.scale(_2 * 0.35), hawaii.scale(_2); return albersUsa2.translate(lower48.translate()); }; albersUsa2.translate = function(_2) { if (!arguments.length) return lower48.translate(); var k2 = lower48.scale(), x2 = +_2[0], y2 = +_2[1]; lower48Point = lower48.translate(_2).clipExtent([[x2 - 0.455 * k2, y2 - 0.238 * k2], [x2 + 0.455 * k2, y2 + 0.238 * k2]]).stream(pointStream); alaskaPoint = alaska.translate([x2 - 0.307 * k2, y2 + 0.201 * k2]).clipExtent([[x2 - 0.425 * k2 + epsilon$1, y2 + 0.12 * k2 + epsilon$1], [x2 - 0.214 * k2 - epsilon$1, y2 + 0.234 * k2 - epsilon$1]]).stream(pointStream); hawaiiPoint = hawaii.translate([x2 - 0.205 * k2, y2 + 0.212 * k2]).clipExtent([[x2 - 0.214 * k2 + epsilon$1, y2 + 0.166 * k2 + epsilon$1], [x2 - 0.115 * k2 - epsilon$1, y2 + 0.234 * k2 - epsilon$1]]).stream(pointStream); return reset2(); }; albersUsa2.fitExtent = function(extent2, object2) { return fitExtent(albersUsa2, extent2, object2); }; albersUsa2.fitSize = function(size, object2) { return fitSize(albersUsa2, size, object2); }; albersUsa2.fitWidth = function(width2, object2) { return fitWidth(albersUsa2, width2, object2); }; albersUsa2.fitHeight = function(height2, object2) { return fitHeight(albersUsa2, height2, object2); }; function reset2() { cache = cacheStream = null; return albersUsa2; } return albersUsa2.scale(1070); } function azimuthalRaw(scale) { return function(x2, y2) { var cx = cos$1(x2), cy = cos$1(y2), k2 = scale(cx * cy); if (k2 === Infinity) return [2, 0]; return [ k2 * cy * sin$1(x2), k2 * sin$1(y2) ]; }; } function azimuthalInvert(angle2) { return function(x2, y2) { var z = sqrt$2(x2 * x2 + y2 * y2), c2 = angle2(z), sc = sin$1(c2), cc = cos$1(c2); return [ atan2$1(x2 * sc, z * cc), asin$1(z && y2 * sc / z) ]; }; } var azimuthalEqualAreaRaw = azimuthalRaw(function(cxcy) { return sqrt$2(2 / (1 + cxcy)); }); azimuthalEqualAreaRaw.invert = azimuthalInvert(function(z) { return 2 * asin$1(z / 2); }); function azimuthalEqualArea() { return projection(azimuthalEqualAreaRaw).scale(124.75).clipAngle(180 - 1e-3); } var azimuthalEquidistantRaw = azimuthalRaw(function(c2) { return (c2 = acos$1(c2)) && c2 / sin$1(c2); }); azimuthalEquidistantRaw.invert = azimuthalInvert(function(z) { return z; }); function azimuthalEquidistant() { return projection(azimuthalEquidistantRaw).scale(79.4188).clipAngle(180 - 1e-3); } function mercatorRaw(lambda, phi2) { return [lambda, log$2(tan((halfPi$1 + phi2) / 2))]; } mercatorRaw.invert = function(x2, y2) { return [x2, 2 * atan(exp(y2)) - halfPi$1]; }; function mercator() { return mercatorProjection(mercatorRaw).scale(961 / tau$1); } function mercatorProjection(project) { var m2 = projection(project), center2 = m2.center, scale = m2.scale, translate = m2.translate, clipExtent = m2.clipExtent, x02 = null, y02, x12, y12; m2.scale = function(_2) { return arguments.length ? (scale(_2), reclip()) : scale(); }; m2.translate = function(_2) { return arguments.length ? (translate(_2), reclip()) : translate(); }; m2.center = function(_2) { return arguments.length ? (center2(_2), reclip()) : center2(); }; m2.clipExtent = function(_2) { return arguments.length ? (_2 == null ? x02 = y02 = x12 = y12 = null : (x02 = +_2[0][0], y02 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reclip()) : x02 == null ? null : [[x02, y02], [x12, y12]]; }; function reclip() { var k2 = pi$1 * scale(), t = m2(rotation(m2.rotate()).invert([0, 0])); return clipExtent(x02 == null ? [[t[0] - k2, t[1] - k2], [t[0] + k2, t[1] + k2]] : project === mercatorRaw ? [[Math.max(t[0] - k2, x02), y02], [Math.min(t[0] + k2, x12), y12]] : [[x02, Math.max(t[1] - k2, y02)], [x12, Math.min(t[1] + k2, y12)]]); } return reclip(); } function tany(y2) { return tan((halfPi$1 + y2) / 2); } function conicConformalRaw(y02, y12) { var cy0 = cos$1(y02), n = y02 === y12 ? sin$1(y02) : log$2(cy0 / cos$1(y12)) / log$2(tany(y12) / tany(y02)), f = cy0 * pow$1(tany(y02), n) / n; if (!n) return mercatorRaw; function project(x2, y2) { if (f > 0) { if (y2 < -halfPi$1 + epsilon$1) y2 = -halfPi$1 + epsilon$1; } else { if (y2 > halfPi$1 - epsilon$1) y2 = halfPi$1 - epsilon$1; } var r = f / pow$1(tany(y2), n); return [r * sin$1(n * x2), f - r * cos$1(n * x2)]; } project.invert = function(x2, y2) { var fy = f - y2, r = sign$1(n) * sqrt$2(x2 * x2 + fy * fy), l = atan2$1(x2, abs$2(fy)) * sign$1(fy); if (fy * n < 0) l -= pi$1 * sign$1(x2) * sign$1(fy); return [l / n, 2 * atan(pow$1(f / r, 1 / n)) - halfPi$1]; }; return project; } function conicConformal() { return conicProjection(conicConformalRaw).scale(109.5).parallels([30, 30]); } function equirectangularRaw(lambda, phi2) { return [lambda, phi2]; } equirectangularRaw.invert = equirectangularRaw; function equirectangular() { return projection(equirectangularRaw).scale(152.63); } function conicEquidistantRaw(y02, y12) { var cy0 = cos$1(y02), n = y02 === y12 ? sin$1(y02) : (cy0 - cos$1(y12)) / (y12 - y02), g = cy0 / n + y02; if (abs$2(n) < epsilon$1) return equirectangularRaw; function project(x2, y2) { var gy = g - y2, nx = n * x2; return [gy * sin$1(nx), g - gy * cos$1(nx)]; } project.invert = function(x2, y2) { var gy = g - y2, l = atan2$1(x2, abs$2(gy)) * sign$1(gy); if (gy * n < 0) l -= pi$1 * sign$1(x2) * sign$1(gy); return [l / n, g - sign$1(n) * sqrt$2(x2 * x2 + gy * gy)]; }; return project; } function conicEquidistant() { return conicProjection(conicEquidistantRaw).scale(131.154).center([0, 13.9389]); } var A1 = 1.340264, A2 = -0.081106, A3 = 893e-6, A4 = 3796e-6, M = sqrt$2(3) / 2, iterations = 12; function equalEarthRaw(lambda, phi2) { var l = asin$1(M * sin$1(phi2)), l2 = l * l, l6 = l2 * l2 * l2; return [ lambda * cos$1(l) / (M * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2))), l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) ]; } equalEarthRaw.invert = function(x2, y2) { var l = y2, l2 = l * l, l6 = l2 * l2 * l2; for (var i = 0, delta, fy, fpy; i < iterations; ++i) { fy = l * (A1 + A2 * l2 + l6 * (A3 + A4 * l2)) - y2; fpy = A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2); l -= delta = fy / fpy, l2 = l * l, l6 = l2 * l2 * l2; if (abs$2(delta) < epsilon2) break; } return [ M * x2 * (A1 + 3 * A2 * l2 + l6 * (7 * A3 + 9 * A4 * l2)) / cos$1(l), asin$1(sin$1(l) / M) ]; }; function equalEarth() { return projection(equalEarthRaw).scale(177.158); } function gnomonicRaw(x2, y2) { var cy = cos$1(y2), k2 = cos$1(x2) * cy; return [cy * sin$1(x2) / k2, sin$1(y2) / k2]; } gnomonicRaw.invert = azimuthalInvert(atan); function gnomonic() { return projection(gnomonicRaw).scale(144.049).clipAngle(60); } function identity$4() { var k2 = 1, tx = 0, ty = 0, sx = 1, sy = 1, alpha = 0, ca, sa, x02 = null, y02, x12, y12, kx2 = 1, ky2 = 1, transform2 = transformer$3({ point: function(x2, y2) { var p = projection2([x2, y2]); this.stream.point(p[0], p[1]); } }), postclip = identity$5, cache, cacheStream; function reset2() { kx2 = k2 * sx; ky2 = k2 * sy; cache = cacheStream = null; return projection2; } function projection2(p) { var x2 = p[0] * kx2, y2 = p[1] * ky2; if (alpha) { var t = y2 * ca - x2 * sa; x2 = x2 * ca + y2 * sa; y2 = t; } return [x2 + tx, y2 + ty]; } projection2.invert = function(p) { var x2 = p[0] - tx, y2 = p[1] - ty; if (alpha) { var t = y2 * ca + x2 * sa; x2 = x2 * ca - y2 * sa; y2 = t; } return [x2 / kx2, y2 / ky2]; }; projection2.stream = function(stream) { return cache && cacheStream === stream ? cache : cache = transform2(postclip(cacheStream = stream)); }; projection2.postclip = function(_2) { return arguments.length ? (postclip = _2, x02 = y02 = x12 = y12 = null, reset2()) : postclip; }; projection2.clipExtent = function(_2) { return arguments.length ? (postclip = _2 == null ? (x02 = y02 = x12 = y12 = null, identity$5) : clipRectangle(x02 = +_2[0][0], y02 = +_2[0][1], x12 = +_2[1][0], y12 = +_2[1][1]), reset2()) : x02 == null ? null : [[x02, y02], [x12, y12]]; }; projection2.scale = function(_2) { return arguments.length ? (k2 = +_2, reset2()) : k2; }; projection2.translate = function(_2) { return arguments.length ? (tx = +_2[0], ty = +_2[1], reset2()) : [tx, ty]; }; projection2.angle = function(_2) { return arguments.length ? (alpha = _2 % 360 * radians, sa = sin$1(alpha), ca = cos$1(alpha), reset2()) : alpha * degrees; }; projection2.reflectX = function(_2) { return arguments.length ? (sx = _2 ? -1 : 1, reset2()) : sx < 0; }; projection2.reflectY = function(_2) { return arguments.length ? (sy = _2 ? -1 : 1, reset2()) : sy < 0; }; projection2.fitExtent = function(extent2, object2) { return fitExtent(projection2, extent2, object2); }; projection2.fitSize = function(size, object2) { return fitSize(projection2, size, object2); }; projection2.fitWidth = function(width2, object2) { return fitWidth(projection2, width2, object2); }; projection2.fitHeight = function(height2, object2) { return fitHeight(projection2, height2, object2); }; return projection2; } function naturalEarth1Raw(lambda, phi2) { var phi22 = phi2 * phi2, phi4 = phi22 * phi22; return [ lambda * (0.8707 - 0.131979 * phi22 + phi4 * (-0.013791 + phi4 * (3971e-6 * phi22 - 1529e-6 * phi4))), phi2 * (1.007226 + phi22 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi22 - 5916e-6 * phi4))) ]; } naturalEarth1Raw.invert = function(x2, y2) { var phi2 = y2, i = 25, delta; do { var phi22 = phi2 * phi2, phi4 = phi22 * phi22; phi2 -= delta = (phi2 * (1.007226 + phi22 * (0.015085 + phi4 * (-0.044475 + 0.028874 * phi22 - 5916e-6 * phi4))) - y2) / (1.007226 + phi22 * (0.015085 * 3 + phi4 * (-0.044475 * 7 + 0.028874 * 9 * phi22 - 5916e-6 * 11 * phi4))); } while (abs$2(delta) > epsilon$1 && --i > 0); return [ x2 / (0.8707 + (phi22 = phi2 * phi2) * (-0.131979 + phi22 * (-0.013791 + phi22 * phi22 * phi22 * (3971e-6 - 1529e-6 * phi22)))), phi2 ]; }; function naturalEarth1() { return projection(naturalEarth1Raw).scale(175.295); } function orthographicRaw(x2, y2) { return [cos$1(y2) * sin$1(x2), sin$1(y2)]; } orthographicRaw.invert = azimuthalInvert(asin$1); function orthographic() { return projection(orthographicRaw).scale(249.5).clipAngle(90 + epsilon$1); } function stereographicRaw(x2, y2) { var cy = cos$1(y2), k2 = 1 + cos$1(x2) * cy; return [cy * sin$1(x2) / k2, sin$1(y2) / k2]; } stereographicRaw.invert = azimuthalInvert(function(z) { return 2 * atan(z); }); function stereographic() { return projection(stereographicRaw).scale(250).clipAngle(142); } function transverseMercatorRaw(lambda, phi2) { return [log$2(tan((halfPi$1 + phi2) / 2)), -lambda]; } transverseMercatorRaw.invert = function(x2, y2) { return [-y2, 2 * atan(exp(x2)) - halfPi$1]; }; function transverseMercator() { var m2 = mercatorProjection(transverseMercatorRaw), center2 = m2.center, rotate = m2.rotate; m2.center = function(_2) { return arguments.length ? center2([-_2[1], _2[0]]) : (_2 = center2(), [_2[1], -_2[0]]); }; m2.rotate = function(_2) { return arguments.length ? rotate([_2[0], _2[1], _2.length > 2 ? _2[2] + 90 : 90]) : (_2 = rotate(), [_2[0], _2[1], _2[2] - 90]); }; return rotate([0, 0, 90]).scale(159.155); } function defaultSeparation$1(a2, b) { return a2.parent === b.parent ? 1 : 2; } function meanX(children2) { return children2.reduce(meanXReduce, 0) / children2.length; } function meanXReduce(x2, c2) { return x2 + c2.x; } function maxY(children2) { return 1 + children2.reduce(maxYReduce, 0); } function maxYReduce(y2, c2) { return Math.max(y2, c2.y); } function leafLeft(node2) { var children2; while (children2 = node2.children) node2 = children2[0]; return node2; } function leafRight(node2) { var children2; while (children2 = node2.children) node2 = children2[children2.length - 1]; return node2; } function cluster() { var separation = defaultSeparation$1, dx = 1, dy = 1, nodeSize = false; function cluster2(root2) { var previousNode, x2 = 0; root2.eachAfter(function(node2) { var children2 = node2.children; if (children2) { node2.x = meanX(children2); node2.y = maxY(children2); } else { node2.x = previousNode ? x2 += separation(node2, previousNode) : 0; node2.y = 0; previousNode = node2; } }); var left2 = leafLeft(root2), right2 = leafRight(root2), x02 = left2.x - separation(left2, right2) / 2, x12 = right2.x + separation(right2, left2) / 2; return root2.eachAfter(nodeSize ? function(node2) { node2.x = (node2.x - root2.x) * dx; node2.y = (root2.y - node2.y) * dy; } : function(node2) { node2.x = (node2.x - x02) / (x12 - x02) * dx; node2.y = (1 - (root2.y ? node2.y / root2.y : 1)) * dy; }); } cluster2.separation = function(x2) { return arguments.length ? (separation = x2, cluster2) : separation; }; cluster2.size = function(x2) { return arguments.length ? (nodeSize = false, dx = +x2[0], dy = +x2[1], cluster2) : nodeSize ? null : [dx, dy]; }; cluster2.nodeSize = function(x2) { return arguments.length ? (nodeSize = true, dx = +x2[0], dy = +x2[1], cluster2) : nodeSize ? [dx, dy] : null; }; return cluster2; } function count(node2) { var sum2 = 0, children2 = node2.children, i = children2 && children2.length; if (!i) sum2 = 1; else while (--i >= 0) sum2 += children2[i].value; node2.value = sum2; } function node_count() { return this.eachAfter(count); } function node_each(callback, that) { let index2 = -1; for (const node2 of this) { callback.call(that, node2, ++index2, this); } return this; } function node_eachBefore(callback, that) { var node2 = this, nodes = [node2], children2, i, index2 = -1; while (node2 = nodes.pop()) { callback.call(that, node2, ++index2, this); if (children2 = node2.children) { for (i = children2.length - 1; i >= 0; --i) { nodes.push(children2[i]); } } } return this; } function node_eachAfter(callback, that) { var node2 = this, nodes = [node2], next2 = [], children2, i, n, index2 = -1; while (node2 = nodes.pop()) { next2.push(node2); if (children2 = node2.children) { for (i = 0, n = children2.length; i < n; ++i) { nodes.push(children2[i]); } } } while (node2 = next2.pop()) { callback.call(that, node2, ++index2, this); } return this; } function node_find(callback, that) { let index2 = -1; for (const node2 of this) { if (callback.call(that, node2, ++index2, this)) { return node2; } } } function node_sum(value) { return this.eachAfter(function(node2) { var sum2 = +value(node2.data) || 0, children2 = node2.children, i = children2 && children2.length; while (--i >= 0) sum2 += children2[i].value; node2.value = sum2; }); } function node_sort(compare) { return this.eachBefore(function(node2) { if (node2.children) { node2.children.sort(compare); } }); } function node_path(end2) { var start2 = this, ancestor = leastCommonAncestor(start2, end2), nodes = [start2]; while (start2 !== ancestor) { start2 = start2.parent; nodes.push(start2); } var k2 = nodes.length; while (end2 !== ancestor) { nodes.splice(k2, 0, end2); end2 = end2.parent; } return nodes; } function leastCommonAncestor(a2, b) { if (a2 === b) return a2; var aNodes = a2.ancestors(), bNodes = b.ancestors(), c2 = null; a2 = aNodes.pop(); b = bNodes.pop(); while (a2 === b) { c2 = a2; a2 = aNodes.pop(); b = bNodes.pop(); } return c2; } function node_ancestors() { var node2 = this, nodes = [node2]; while (node2 = node2.parent) { nodes.push(node2); } return nodes; } function node_descendants() { return Array.from(this); } function node_leaves() { var leaves = []; this.eachBefore(function(node2) { if (!node2.children) { leaves.push(node2); } }); return leaves; } function node_links() { var root2 = this, links2 = []; root2.each(function(node2) { if (node2 !== root2) { links2.push({ source: node2.parent, target: node2 }); } }); return links2; } function* node_iterator() { var node2 = this, current, next2 = [node2], children2, i, n; do { current = next2.reverse(), next2 = []; while (node2 = current.pop()) { yield node2; if (children2 = node2.children) { for (i = 0, n = children2.length; i < n; ++i) { next2.push(children2[i]); } } } } while (next2.length); } function hierarchy(data, children2) { if (data instanceof Map) { data = [void 0, data]; if (children2 === void 0) children2 = mapChildren; } else if (children2 === void 0) { children2 = objectChildren; } var root2 = new Node$1(data), node2, nodes = [root2], child, childs, i, n; while (node2 = nodes.pop()) { if ((childs = children2(node2.data)) && (n = (childs = Array.from(childs)).length)) { node2.children = childs; for (i = n - 1; i >= 0; --i) { nodes.push(child = childs[i] = new Node$1(childs[i])); child.parent = node2; child.depth = node2.depth + 1; } } } return root2.eachBefore(computeHeight); } function node_copy() { return hierarchy(this).eachBefore(copyData); } function objectChildren(d) { return d.children; } function mapChildren(d) { return Array.isArray(d) ? d[1] : null; } function copyData(node2) { if (node2.data.value !== void 0) node2.value = node2.data.value; node2.data = node2.data.data; } function computeHeight(node2) { var height2 = 0; do node2.height = height2; while ((node2 = node2.parent) && node2.height < ++height2); } function Node$1(data) { this.data = data; this.depth = this.height = 0; this.parent = null; } Node$1.prototype = hierarchy.prototype = { constructor: Node$1, count: node_count, each: node_each, eachAfter: node_eachAfter, eachBefore: node_eachBefore, find: node_find, sum: node_sum, sort: node_sort, path: node_path, ancestors: node_ancestors, descendants: node_descendants, leaves: node_leaves, links: node_links, copy: node_copy, [Symbol.iterator]: node_iterator }; function optional(f) { return f == null ? null : required(f); } function required(f) { if (typeof f !== "function") throw new Error(); return f; } function constantZero() { return 0; } function constant$2(x2) { return function() { return x2; }; } const a$1 = 1664525; const c$4 = 1013904223; const m = 4294967296; function lcg$1() { let s2 = 1; return () => (s2 = (a$1 * s2 + c$4) % m) / m; } function array$1(x2) { return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2); } function shuffle(array2, random2) { let m2 = array2.length, t, i; while (m2) { i = random2() * m2-- | 0; t = array2[m2]; array2[m2] = array2[i]; array2[i] = t; } return array2; } function enclose(circles) { return packEncloseRandom(circles, lcg$1()); } function packEncloseRandom(circles, random2) { var i = 0, n = (circles = shuffle(Array.from(circles), random2)).length, B2 = [], p, e; while (i < n) { p = circles[i]; if (e && enclosesWeak(e, p)) ++i; else e = encloseBasis(B2 = extendBasis(B2, p)), i = 0; } return e; } function extendBasis(B2, p) { var i, j; if (enclosesWeakAll(p, B2)) return [p]; for (i = 0; i < B2.length; ++i) { if (enclosesNot(p, B2[i]) && enclosesWeakAll(encloseBasis2(B2[i], p), B2)) { return [B2[i], p]; } } for (i = 0; i < B2.length - 1; ++i) { for (j = i + 1; j < B2.length; ++j) { if (enclosesNot(encloseBasis2(B2[i], B2[j]), p) && enclosesNot(encloseBasis2(B2[i], p), B2[j]) && enclosesNot(encloseBasis2(B2[j], p), B2[i]) && enclosesWeakAll(encloseBasis3(B2[i], B2[j], p), B2)) { return [B2[i], B2[j], p]; } } } throw new Error(); } function enclosesNot(a2, b) { var dr = a2.r - b.r, dx = b.x - a2.x, dy = b.y - a2.y; return dr < 0 || dr * dr < dx * dx + dy * dy; } function enclosesWeak(a2, b) { var dr = a2.r - b.r + Math.max(a2.r, b.r, 1) * 1e-9, dx = b.x - a2.x, dy = b.y - a2.y; return dr > 0 && dr * dr > dx * dx + dy * dy; } function enclosesWeakAll(a2, B2) { for (var i = 0; i < B2.length; ++i) { if (!enclosesWeak(a2, B2[i])) { return false; } } return true; } function encloseBasis(B2) { switch (B2.length) { case 1: return encloseBasis1(B2[0]); case 2: return encloseBasis2(B2[0], B2[1]); case 3: return encloseBasis3(B2[0], B2[1], B2[2]); } } function encloseBasis1(a2) { return { x: a2.x, y: a2.y, r: a2.r }; } function encloseBasis2(a2, b) { var x12 = a2.x, y12 = a2.y, r1 = a2.r, x2 = b.x, y2 = b.y, r2 = b.r, x21 = x2 - x12, y21 = y2 - y12, r21 = r2 - r1, l = Math.sqrt(x21 * x21 + y21 * y21); return { x: (x12 + x2 + x21 / l * r21) / 2, y: (y12 + y2 + y21 / l * r21) / 2, r: (l + r1 + r2) / 2 }; } function encloseBasis3(a2, b, c2) { var x12 = a2.x, y12 = a2.y, r1 = a2.r, x2 = b.x, y2 = b.y, r2 = b.r, x3 = c2.x, y3 = c2.y, r3 = c2.r, a22 = x12 - x2, a3 = x12 - x3, b22 = y12 - y2, b32 = y12 - y3, c22 = r2 - r1, c3 = r3 - r1, d1 = x12 * x12 + y12 * y12 - r1 * r1, d2 = d1 - x2 * x2 - y2 * y2 + r2 * r2, d32 = d1 - x3 * x3 - y3 * y3 + r3 * r3, ab = a3 * b22 - a22 * b32, xa = (b22 * d32 - b32 * d2) / (ab * 2) - x12, xb = (b32 * c22 - b22 * c3) / ab, ya = (a3 * d2 - a22 * d32) / (ab * 2) - y12, yb = (a22 * c3 - a3 * c22) / ab, A5 = xb * xb + yb * yb - 1, B2 = 2 * (r1 + xa * xb + ya * yb), C3 = xa * xa + ya * ya - r1 * r1, r = -(Math.abs(A5) > 1e-6 ? (B2 + Math.sqrt(B2 * B2 - 4 * A5 * C3)) / (2 * A5) : C3 / B2); return { x: x12 + xa + xb * r, y: y12 + ya + yb * r, r }; } function place(b, a2, c2) { var dx = b.x - a2.x, x2, a22, dy = b.y - a2.y, y2, b22, d2 = dx * dx + dy * dy; if (d2) { a22 = a2.r + c2.r, a22 *= a22; b22 = b.r + c2.r, b22 *= b22; if (a22 > b22) { x2 = (d2 + b22 - a22) / (2 * d2); y2 = Math.sqrt(Math.max(0, b22 / d2 - x2 * x2)); c2.x = b.x - x2 * dx - y2 * dy; c2.y = b.y - x2 * dy + y2 * dx; } else { x2 = (d2 + a22 - b22) / (2 * d2); y2 = Math.sqrt(Math.max(0, a22 / d2 - x2 * x2)); c2.x = a2.x + x2 * dx - y2 * dy; c2.y = a2.y + x2 * dy + y2 * dx; } } else { c2.x = a2.x + c2.r; c2.y = a2.y; } } function intersects(a2, b) { var dr = a2.r + b.r - 1e-6, dx = b.x - a2.x, dy = b.y - a2.y; return dr > 0 && dr * dr > dx * dx + dy * dy; } function score(node2) { var a2 = node2._, b = node2.next._, ab = a2.r + b.r, dx = (a2.x * b.r + b.x * a2.r) / ab, dy = (a2.y * b.r + b.y * a2.r) / ab; return dx * dx + dy * dy; } function Node(circle2) { this._ = circle2; this.next = null; this.previous = null; } function packSiblingsRandom(circles, random2) { if (!(n = (circles = array$1(circles)).length)) return 0; var a2, b, c2, n, aa, ca, i, j, k2, sj, sk; a2 = circles[0], a2.x = 0, a2.y = 0; if (!(n > 1)) return a2.r; b = circles[1], a2.x = -b.r, b.x = a2.r, b.y = 0; if (!(n > 2)) return a2.r + b.r; place(b, a2, c2 = circles[2]); a2 = new Node(a2), b = new Node(b), c2 = new Node(c2); a2.next = c2.previous = b; b.next = a2.previous = c2; c2.next = b.previous = a2; pack: for (i = 3; i < n; ++i) { place(a2._, b._, c2 = circles[i]), c2 = new Node(c2); j = b.next, k2 = a2.previous, sj = b._.r, sk = a2._.r; do { if (sj <= sk) { if (intersects(j._, c2._)) { b = j, a2.next = b, b.previous = a2, --i; continue pack; } sj += j._.r, j = j.next; } else { if (intersects(k2._, c2._)) { a2 = k2, a2.next = b, b.previous = a2, --i; continue pack; } sk += k2._.r, k2 = k2.previous; } } while (j !== k2.next); c2.previous = a2, c2.next = b, a2.next = b.previous = b = c2; aa = score(a2); while ((c2 = c2.next) !== b) { if ((ca = score(c2)) < aa) { a2 = c2, aa = ca; } } b = a2.next; } a2 = [b._], c2 = b; while ((c2 = c2.next) !== b) a2.push(c2._); c2 = packEncloseRandom(a2, random2); for (i = 0; i < n; ++i) a2 = circles[i], a2.x -= c2.x, a2.y -= c2.y; return c2.r; } function siblings(circles) { packSiblingsRandom(circles, lcg$1()); return circles; } function defaultRadius(d) { return Math.sqrt(d.value); } function index$1() { var radius = null, dx = 1, dy = 1, padding2 = constantZero; function pack(root2) { const random2 = lcg$1(); root2.x = dx / 2, root2.y = dy / 2; if (radius) { root2.eachBefore(radiusLeaf(radius)).eachAfter(packChildrenRandom(padding2, 0.5, random2)).eachBefore(translateChild(1)); } else { root2.eachBefore(radiusLeaf(defaultRadius)).eachAfter(packChildrenRandom(constantZero, 1, random2)).eachAfter(packChildrenRandom(padding2, root2.r / Math.min(dx, dy), random2)).eachBefore(translateChild(Math.min(dx, dy) / (2 * root2.r))); } return root2; } pack.radius = function(x2) { return arguments.length ? (radius = optional(x2), pack) : radius; }; pack.size = function(x2) { return arguments.length ? (dx = +x2[0], dy = +x2[1], pack) : [dx, dy]; }; pack.padding = function(x2) { return arguments.length ? (padding2 = typeof x2 === "function" ? x2 : constant$2(+x2), pack) : padding2; }; return pack; } function radiusLeaf(radius) { return function(node2) { if (!node2.children) { node2.r = Math.max(0, +radius(node2) || 0); } }; } function packChildrenRandom(padding2, k2, random2) { return function(node2) { if (children2 = node2.children) { var children2, i, n = children2.length, r = padding2(node2) * k2 || 0, e; if (r) for (i = 0; i < n; ++i) children2[i].r += r; e = packSiblingsRandom(children2, random2); if (r) for (i = 0; i < n; ++i) children2[i].r -= r; node2.r = e + r; } }; } function translateChild(k2) { return function(node2) { var parent = node2.parent; node2.r *= k2; if (parent) { node2.x = parent.x + k2 * node2.x; node2.y = parent.y + k2 * node2.y; } }; } function roundNode(node2) { node2.x0 = Math.round(node2.x0); node2.y0 = Math.round(node2.y0); node2.x1 = Math.round(node2.x1); node2.y1 = Math.round(node2.y1); } function treemapDice(parent, x02, y02, x12, y12) { var nodes = parent.children, node2, i = -1, n = nodes.length, k2 = parent.value && (x12 - x02) / parent.value; while (++i < n) { node2 = nodes[i], node2.y0 = y02, node2.y1 = y12; node2.x0 = x02, node2.x1 = x02 += node2.value * k2; } } function partition() { var dx = 1, dy = 1, padding2 = 0, round = false; function partition2(root2) { var n = root2.height + 1; root2.x0 = root2.y0 = padding2; root2.x1 = dx; root2.y1 = dy / n; root2.eachBefore(positionNode2(dy, n)); if (round) root2.eachBefore(roundNode); return root2; } function positionNode2(dy2, n) { return function(node2) { if (node2.children) { treemapDice(node2, node2.x0, dy2 * (node2.depth + 1) / n, node2.x1, dy2 * (node2.depth + 2) / n); } var x02 = node2.x0, y02 = node2.y0, x12 = node2.x1 - padding2, y12 = node2.y1 - padding2; if (x12 < x02) x02 = x12 = (x02 + x12) / 2; if (y12 < y02) y02 = y12 = (y02 + y12) / 2; node2.x0 = x02; node2.y0 = y02; node2.x1 = x12; node2.y1 = y12; }; } partition2.round = function(x2) { return arguments.length ? (round = !!x2, partition2) : round; }; partition2.size = function(x2) { return arguments.length ? (dx = +x2[0], dy = +x2[1], partition2) : [dx, dy]; }; partition2.padding = function(x2) { return arguments.length ? (padding2 = +x2, partition2) : padding2; }; return partition2; } var preroot = { depth: -1 }, ambiguous = {}, imputed = {}; function defaultId(d) { return d.id; } function defaultParentId(d) { return d.parentId; } function stratify() { var id2 = defaultId, parentId = defaultParentId, path2; function stratify2(data) { var nodes = Array.from(data), currentId = id2, currentParentId = parentId, n, d, i, root2, parent, node2, nodeId, nodeKey, nodeByKey = /* @__PURE__ */ new Map(); if (path2 != null) { const I = nodes.map((d2, i2) => normalize$2(path2(d2, i2, data))); const P = I.map(parentof); const S = new Set(I).add(""); for (const i2 of P) { if (!S.has(i2)) { S.add(i2); I.push(i2); P.push(parentof(i2)); nodes.push(imputed); } } currentId = (_2, i2) => I[i2]; currentParentId = (_2, i2) => P[i2]; } for (i = 0, n = nodes.length; i < n; ++i) { d = nodes[i], node2 = nodes[i] = new Node$1(d); if ((nodeId = currentId(d, i, data)) != null && (nodeId += "")) { nodeKey = node2.id = nodeId; nodeByKey.set(nodeKey, nodeByKey.has(nodeKey) ? ambiguous : node2); } if ((nodeId = currentParentId(d, i, data)) != null && (nodeId += "")) { node2.parent = nodeId; } } for (i = 0; i < n; ++i) { node2 = nodes[i]; if (nodeId = node2.parent) { parent = nodeByKey.get(nodeId); if (!parent) throw new Error("missing: " + nodeId); if (parent === ambiguous) throw new Error("ambiguous: " + nodeId); if (parent.children) parent.children.push(node2); else parent.children = [node2]; node2.parent = parent; } else { if (root2) throw new Error("multiple roots"); root2 = node2; } } if (!root2) throw new Error("no root"); if (path2 != null) { while (root2.data === imputed && root2.children.length === 1) { root2 = root2.children[0], --n; } for (let i2 = nodes.length - 1; i2 >= 0; --i2) { node2 = nodes[i2]; if (node2.data !== imputed) break; node2.data = null; } } root2.parent = preroot; root2.eachBefore(function(node3) { node3.depth = node3.parent.depth + 1; --n; }).eachBefore(computeHeight); root2.parent = null; if (n > 0) throw new Error("cycle"); return root2; } stratify2.id = function(x2) { return arguments.length ? (id2 = optional(x2), stratify2) : id2; }; stratify2.parentId = function(x2) { return arguments.length ? (parentId = optional(x2), stratify2) : parentId; }; stratify2.path = function(x2) { return arguments.length ? (path2 = optional(x2), stratify2) : path2; }; return stratify2; } function normalize$2(path2) { path2 = `${path2}`; let i = path2.length; if (slash(path2, i - 1) && !slash(path2, i - 2)) path2 = path2.slice(0, -1); return path2[0] === "/" ? path2 : `/${path2}`; } function parentof(path2) { let i = path2.length; if (i < 2) return ""; while (--i > 1) if (slash(path2, i)) break; return path2.slice(0, i); } function slash(path2, i) { if (path2[i] === "/") { let k2 = 0; while (i > 0 && path2[--i] === "\\") ++k2; if ((k2 & 1) === 0) return true; } return false; } function defaultSeparation(a2, b) { return a2.parent === b.parent ? 1 : 2; } function nextLeft(v) { var children2 = v.children; return children2 ? children2[0] : v.t; } function nextRight(v) { var children2 = v.children; return children2 ? children2[children2.length - 1] : v.t; } function moveSubtree(wm, wp, shift) { var change2 = shift / (wp.i - wm.i); wp.c -= change2; wp.s += shift; wm.c += change2; wp.z += shift; wp.m += shift; } function executeShifts(v) { var shift = 0, change2 = 0, children2 = v.children, i = children2.length, w2; while (--i >= 0) { w2 = children2[i]; w2.z += shift; w2.m += shift; shift += w2.s + (change2 += w2.c); } } function nextAncestor(vim, v, ancestor) { return vim.a.parent === v.parent ? vim.a : ancestor; } function TreeNode(node2, i) { this._ = node2; this.parent = null; this.children = null; this.A = null; this.a = this; this.z = 0; this.m = 0; this.c = 0; this.s = 0; this.t = null; this.i = i; } TreeNode.prototype = Object.create(Node$1.prototype); function treeRoot(root2) { var tree2 = new TreeNode(root2, 0), node2, nodes = [tree2], child, children2, i, n; while (node2 = nodes.pop()) { if (children2 = node2._.children) { node2.children = new Array(n = children2.length); for (i = n - 1; i >= 0; --i) { nodes.push(child = node2.children[i] = new TreeNode(children2[i], i)); child.parent = node2; } } } (tree2.parent = new TreeNode(null, 0)).children = [tree2]; return tree2; } function tree() { var separation = defaultSeparation, dx = 1, dy = 1, nodeSize = null; function tree2(root2) { var t = treeRoot(root2); t.eachAfter(firstWalk), t.parent.m = -t.z; t.eachBefore(secondWalk); if (nodeSize) root2.eachBefore(sizeNode); else { var left2 = root2, right2 = root2, bottom2 = root2; root2.eachBefore(function(node2) { if (node2.x < left2.x) left2 = node2; if (node2.x > right2.x) right2 = node2; if (node2.depth > bottom2.depth) bottom2 = node2; }); var s2 = left2 === right2 ? 1 : separation(left2, right2) / 2, tx = s2 - left2.x, kx2 = dx / (right2.x + s2 + tx), ky2 = dy / (bottom2.depth || 1); root2.eachBefore(function(node2) { node2.x = (node2.x + tx) * kx2; node2.y = node2.depth * ky2; }); } return root2; } function firstWalk(v) { var children2 = v.children, siblings2 = v.parent.children, w2 = v.i ? siblings2[v.i - 1] : null; if (children2) { executeShifts(v); var midpoint = (children2[0].z + children2[children2.length - 1].z) / 2; if (w2) { v.z = w2.z + separation(v._, w2._); v.m = v.z - midpoint; } else { v.z = midpoint; } } else if (w2) { v.z = w2.z + separation(v._, w2._); } v.parent.A = apportion(v, w2, v.parent.A || siblings2[0]); } function secondWalk(v) { v._.x = v.z + v.parent.m; v.m += v.parent.m; } function apportion(v, w2, ancestor) { if (w2) { var vip = v, vop = v, vim = w2, vom = vip.parent.children[0], sip = vip.m, sop = vop.m, sim = vim.m, som = vom.m, shift; while (vim = nextRight(vim), vip = nextLeft(vip), vim && vip) { vom = nextLeft(vom); vop = nextRight(vop); vop.a = v; shift = vim.z + sim - vip.z - sip + separation(vim._, vip._); if (shift > 0) { moveSubtree(nextAncestor(vim, v, ancestor), v, shift); sip += shift; sop += shift; } sim += vim.m; sip += vip.m; som += vom.m; sop += vop.m; } if (vim && !nextRight(vop)) { vop.t = vim; vop.m += sim - sop; } if (vip && !nextLeft(vom)) { vom.t = vip; vom.m += sip - som; ancestor = v; } } return ancestor; } function sizeNode(node2) { node2.x *= dx; node2.y = node2.depth * dy; } tree2.separation = function(x2) { return arguments.length ? (separation = x2, tree2) : separation; }; tree2.size = function(x2) { return arguments.length ? (nodeSize = false, dx = +x2[0], dy = +x2[1], tree2) : nodeSize ? null : [dx, dy]; }; tree2.nodeSize = function(x2) { return arguments.length ? (nodeSize = true, dx = +x2[0], dy = +x2[1], tree2) : nodeSize ? [dx, dy] : null; }; return tree2; } function treemapSlice(parent, x02, y02, x12, y12) { var nodes = parent.children, node2, i = -1, n = nodes.length, k2 = parent.value && (y12 - y02) / parent.value; while (++i < n) { node2 = nodes[i], node2.x0 = x02, node2.x1 = x12; node2.y0 = y02, node2.y1 = y02 += node2.value * k2; } } var phi = (1 + Math.sqrt(5)) / 2; function squarifyRatio(ratio, parent, x02, y02, x12, y12) { var rows = [], nodes = parent.children, row, nodeValue, i0 = 0, i1 = 0, n = nodes.length, dx, dy, value = parent.value, sumValue, minValue, maxValue, newRatio, minRatio, alpha, beta2; while (i0 < n) { dx = x12 - x02, dy = y12 - y02; do sumValue = nodes[i1++].value; while (!sumValue && i1 < n); minValue = maxValue = sumValue; alpha = Math.max(dy / dx, dx / dy) / (value * ratio); beta2 = sumValue * sumValue * alpha; minRatio = Math.max(maxValue / beta2, beta2 / minValue); for (; i1 < n; ++i1) { sumValue += nodeValue = nodes[i1].value; if (nodeValue < minValue) minValue = nodeValue; if (nodeValue > maxValue) maxValue = nodeValue; beta2 = sumValue * sumValue * alpha; newRatio = Math.max(maxValue / beta2, beta2 / minValue); if (newRatio > minRatio) { sumValue -= nodeValue; break; } minRatio = newRatio; } rows.push(row = { value: sumValue, dice: dx < dy, children: nodes.slice(i0, i1) }); if (row.dice) treemapDice(row, x02, y02, x12, value ? y02 += dy * sumValue / value : y12); else treemapSlice(row, x02, y02, value ? x02 += dx * sumValue / value : x12, y12); value -= sumValue, i0 = i1; } return rows; } const squarify = function custom10(ratio) { function squarify2(parent, x02, y02, x12, y12) { squarifyRatio(ratio, parent, x02, y02, x12, y12); } squarify2.ratio = function(x2) { return custom10((x2 = +x2) > 1 ? x2 : 1); }; return squarify2; }(phi); function index() { var tile = squarify, round = false, dx = 1, dy = 1, paddingStack = [0], paddingInner = constantZero, paddingTop = constantZero, paddingRight = constantZero, paddingBottom = constantZero, paddingLeft = constantZero; function treemap(root2) { root2.x0 = root2.y0 = 0; root2.x1 = dx; root2.y1 = dy; root2.eachBefore(positionNode2); paddingStack = [0]; if (round) root2.eachBefore(roundNode); return root2; } function positionNode2(node2) { var p = paddingStack[node2.depth], x02 = node2.x0 + p, y02 = node2.y0 + p, x12 = node2.x1 - p, y12 = node2.y1 - p; if (x12 < x02) x02 = x12 = (x02 + x12) / 2; if (y12 < y02) y02 = y12 = (y02 + y12) / 2; node2.x0 = x02; node2.y0 = y02; node2.x1 = x12; node2.y1 = y12; if (node2.children) { p = paddingStack[node2.depth + 1] = paddingInner(node2) / 2; x02 += paddingLeft(node2) - p; y02 += paddingTop(node2) - p; x12 -= paddingRight(node2) - p; y12 -= paddingBottom(node2) - p; if (x12 < x02) x02 = x12 = (x02 + x12) / 2; if (y12 < y02) y02 = y12 = (y02 + y12) / 2; tile(node2, x02, y02, x12, y12); } } treemap.round = function(x2) { return arguments.length ? (round = !!x2, treemap) : round; }; treemap.size = function(x2) { return arguments.length ? (dx = +x2[0], dy = +x2[1], treemap) : [dx, dy]; }; treemap.tile = function(x2) { return arguments.length ? (tile = required(x2), treemap) : tile; }; treemap.padding = function(x2) { return arguments.length ? treemap.paddingInner(x2).paddingOuter(x2) : treemap.paddingInner(); }; treemap.paddingInner = function(x2) { return arguments.length ? (paddingInner = typeof x2 === "function" ? x2 : constant$2(+x2), treemap) : paddingInner; }; treemap.paddingOuter = function(x2) { return arguments.length ? treemap.paddingTop(x2).paddingRight(x2).paddingBottom(x2).paddingLeft(x2) : treemap.paddingTop(); }; treemap.paddingTop = function(x2) { return arguments.length ? (paddingTop = typeof x2 === "function" ? x2 : constant$2(+x2), treemap) : paddingTop; }; treemap.paddingRight = function(x2) { return arguments.length ? (paddingRight = typeof x2 === "function" ? x2 : constant$2(+x2), treemap) : paddingRight; }; treemap.paddingBottom = function(x2) { return arguments.length ? (paddingBottom = typeof x2 === "function" ? x2 : constant$2(+x2), treemap) : paddingBottom; }; treemap.paddingLeft = function(x2) { return arguments.length ? (paddingLeft = typeof x2 === "function" ? x2 : constant$2(+x2), treemap) : paddingLeft; }; return treemap; } function binary(parent, x02, y02, x12, y12) { var nodes = parent.children, i, n = nodes.length, sum2, sums = new Array(n + 1); for (sums[0] = sum2 = i = 0; i < n; ++i) { sums[i + 1] = sum2 += nodes[i].value; } partition2(0, n, parent.value, x02, y02, x12, y12); function partition2(i2, j, value, x03, y03, x13, y13) { if (i2 >= j - 1) { var node2 = nodes[i2]; node2.x0 = x03, node2.y0 = y03; node2.x1 = x13, node2.y1 = y13; return; } var valueOffset = sums[i2], valueTarget = value / 2 + valueOffset, k2 = i2 + 1, hi = j - 1; while (k2 < hi) { var mid = k2 + hi >>> 1; if (sums[mid] < valueTarget) k2 = mid + 1; else hi = mid; } if (valueTarget - sums[k2 - 1] < sums[k2] - valueTarget && i2 + 1 < k2) --k2; var valueLeft = sums[k2] - valueOffset, valueRight = value - valueLeft; if (x13 - x03 > y13 - y03) { var xk = value ? (x03 * valueRight + x13 * valueLeft) / value : x13; partition2(i2, k2, valueLeft, x03, y03, xk, y13); partition2(k2, j, valueRight, xk, y03, x13, y13); } else { var yk = value ? (y03 * valueRight + y13 * valueLeft) / value : y13; partition2(i2, k2, valueLeft, x03, y03, x13, yk); partition2(k2, j, valueRight, x03, yk, x13, y13); } } } function sliceDice(parent, x02, y02, x12, y12) { (parent.depth & 1 ? treemapSlice : treemapDice)(parent, x02, y02, x12, y12); } const resquarify = function custom11(ratio) { function resquarify2(parent, x02, y02, x12, y12) { if ((rows = parent._squarify) && rows.ratio === ratio) { var rows, row, nodes, i, j = -1, n, m2 = rows.length, value = parent.value; while (++j < m2) { row = rows[j], nodes = row.children; for (i = row.value = 0, n = nodes.length; i < n; ++i) row.value += nodes[i].value; if (row.dice) treemapDice(row, x02, y02, x12, value ? y02 += (y12 - y02) * row.value / value : y12); else treemapSlice(row, x02, y02, value ? x02 += (x12 - x02) * row.value / value : x12, y12); value -= row.value; } } else { parent._squarify = rows = squarifyRatio(ratio, parent, x02, y02, x12, y12); rows.ratio = ratio; } } resquarify2.ratio = function(x2) { return custom11((x2 = +x2) > 1 ? x2 : 1); }; return resquarify2; }(phi); function area$1(polygon) { var i = -1, n = polygon.length, a2, b = polygon[n - 1], area2 = 0; while (++i < n) { a2 = b; b = polygon[i]; area2 += a2[1] * b[0] - a2[0] * b[1]; } return area2 / 2; } function centroid(polygon) { var i = -1, n = polygon.length, x2 = 0, y2 = 0, a2, b = polygon[n - 1], c2, k2 = 0; while (++i < n) { a2 = b; b = polygon[i]; k2 += c2 = a2[0] * b[1] - b[0] * a2[1]; x2 += (a2[0] + b[0]) * c2; y2 += (a2[1] + b[1]) * c2; } return k2 *= 3, [x2 / k2, y2 / k2]; } function cross$2(a2, b, c2) { return (b[0] - a2[0]) * (c2[1] - a2[1]) - (b[1] - a2[1]) * (c2[0] - a2[0]); } function lexicographicOrder(a2, b) { return a2[0] - b[0] || a2[1] - b[1]; } function computeUpperHullIndexes(points) { const n = points.length, indexes2 = [0, 1]; let size = 2, i; for (i = 2; i < n; ++i) { while (size > 1 && cross$2(points[indexes2[size - 2]], points[indexes2[size - 1]], points[i]) <= 0) --size; indexes2[size++] = i; } return indexes2.slice(0, size); } function hull(points) { if ((n = points.length) < 3) return null; var i, n, sortedPoints = new Array(n), flippedPoints = new Array(n); for (i = 0; i < n; ++i) sortedPoints[i] = [+points[i][0], +points[i][1], i]; sortedPoints.sort(lexicographicOrder); for (i = 0; i < n; ++i) flippedPoints[i] = [sortedPoints[i][0], -sortedPoints[i][1]]; var upperIndexes = computeUpperHullIndexes(sortedPoints), lowerIndexes = computeUpperHullIndexes(flippedPoints); var skipLeft = lowerIndexes[0] === upperIndexes[0], skipRight = lowerIndexes[lowerIndexes.length - 1] === upperIndexes[upperIndexes.length - 1], hull2 = []; for (i = upperIndexes.length - 1; i >= 0; --i) hull2.push(points[sortedPoints[upperIndexes[i]][2]]); for (i = +skipLeft; i < lowerIndexes.length - skipRight; ++i) hull2.push(points[sortedPoints[lowerIndexes[i]][2]]); return hull2; } function contains(polygon, point2) { var n = polygon.length, p = polygon[n - 1], x2 = point2[0], y2 = point2[1], x02 = p[0], y02 = p[1], x12, y12, inside = false; for (var i = 0; i < n; ++i) { p = polygon[i], x12 = p[0], y12 = p[1]; if (y12 > y2 !== y02 > y2 && x2 < (x02 - x12) * (y2 - y12) / (y02 - y12) + x12) inside = !inside; x02 = x12, y02 = y12; } return inside; } function length$1(polygon) { var i = -1, n = polygon.length, b = polygon[n - 1], xa, ya, xb = b[0], yb = b[1], perimeter = 0; while (++i < n) { xa = xb; ya = yb; b = polygon[i]; xb = b[0]; yb = b[1]; xa -= xb; ya -= yb; perimeter += Math.hypot(xa, ya); } return perimeter; } const defaultSource = Math.random; const uniform = function sourceRandomUniform(source) { function randomUniform(min2, max2) { min2 = min2 == null ? 0 : +min2; max2 = max2 == null ? 1 : +max2; if (arguments.length === 1) max2 = min2, min2 = 0; else max2 -= min2; return function() { return source() * max2 + min2; }; } randomUniform.source = sourceRandomUniform; return randomUniform; }(defaultSource); const int = function sourceRandomInt(source) { function randomInt(min2, max2) { if (arguments.length < 2) max2 = min2, min2 = 0; min2 = Math.floor(min2); max2 = Math.floor(max2) - min2; return function() { return Math.floor(source() * max2 + min2); }; } randomInt.source = sourceRandomInt; return randomInt; }(defaultSource); const normal = function sourceRandomNormal(source) { function randomNormal(mu, sigma) { var x2, r; mu = mu == null ? 0 : +mu; sigma = sigma == null ? 1 : +sigma; return function() { var y2; if (x2 != null) y2 = x2, x2 = null; else do { x2 = source() * 2 - 1; y2 = source() * 2 - 1; r = x2 * x2 + y2 * y2; } while (!r || r > 1); return mu + sigma * y2 * Math.sqrt(-2 * Math.log(r) / r); }; } randomNormal.source = sourceRandomNormal; return randomNormal; }(defaultSource); const logNormal = function sourceRandomLogNormal(source) { var N = normal.source(source); function randomLogNormal() { var randomNormal = N.apply(this, arguments); return function() { return Math.exp(randomNormal()); }; } randomLogNormal.source = sourceRandomLogNormal; return randomLogNormal; }(defaultSource); const irwinHall = function sourceRandomIrwinHall(source) { function randomIrwinHall(n) { if ((n = +n) <= 0) return () => 0; return function() { for (var sum2 = 0, i = n; i > 1; --i) sum2 += source(); return sum2 + i * source(); }; } randomIrwinHall.source = sourceRandomIrwinHall; return randomIrwinHall; }(defaultSource); const bates = function sourceRandomBates(source) { var I = irwinHall.source(source); function randomBates(n) { if ((n = +n) === 0) return source; var randomIrwinHall = I(n); return function() { return randomIrwinHall() / n; }; } randomBates.source = sourceRandomBates; return randomBates; }(defaultSource); const exponential = function sourceRandomExponential(source) { function randomExponential(lambda) { return function() { return -Math.log1p(-source()) / lambda; }; } randomExponential.source = sourceRandomExponential; return randomExponential; }(defaultSource); const pareto = function sourceRandomPareto(source) { function randomPareto(alpha) { if ((alpha = +alpha) < 0) throw new RangeError("invalid alpha"); alpha = 1 / -alpha; return function() { return Math.pow(1 - source(), alpha); }; } randomPareto.source = sourceRandomPareto; return randomPareto; }(defaultSource); const bernoulli = function sourceRandomBernoulli(source) { function randomBernoulli(p) { if ((p = +p) < 0 || p > 1) throw new RangeError("invalid p"); return function() { return Math.floor(source() + p); }; } randomBernoulli.source = sourceRandomBernoulli; return randomBernoulli; }(defaultSource); const geometric = function sourceRandomGeometric(source) { function randomGeometric(p) { if ((p = +p) < 0 || p > 1) throw new RangeError("invalid p"); if (p === 0) return () => Infinity; if (p === 1) return () => 1; p = Math.log1p(-p); return function() { return 1 + Math.floor(Math.log1p(-source()) / p); }; } randomGeometric.source = sourceRandomGeometric; return randomGeometric; }(defaultSource); const gamma = function sourceRandomGamma(source) { var randomNormal = normal.source(source)(); function randomGamma(k2, theta) { if ((k2 = +k2) < 0) throw new RangeError("invalid k"); if (k2 === 0) return () => 0; theta = theta == null ? 1 : +theta; if (k2 === 1) return () => -Math.log1p(-source()) * theta; var d = (k2 < 1 ? k2 + 1 : k2) - 1 / 3, c2 = 1 / (3 * Math.sqrt(d)), multiplier = k2 < 1 ? () => Math.pow(source(), 1 / k2) : () => 1; return function() { do { do { var x2 = randomNormal(), v = 1 + c2 * x2; } while (v <= 0); v *= v * v; var u2 = 1 - source(); } while (u2 >= 1 - 0.0331 * x2 * x2 * x2 * x2 && Math.log(u2) >= 0.5 * x2 * x2 + d * (1 - v + Math.log(v))); return d * v * multiplier() * theta; }; } randomGamma.source = sourceRandomGamma; return randomGamma; }(defaultSource); const beta = function sourceRandomBeta(source) { var G = gamma.source(source); function randomBeta(alpha, beta2) { var X3 = G(alpha), Y3 = G(beta2); return function() { var x2 = X3(); return x2 === 0 ? 0 : x2 / (x2 + Y3()); }; } randomBeta.source = sourceRandomBeta; return randomBeta; }(defaultSource); const binomial = function sourceRandomBinomial(source) { var G = geometric.source(source), B2 = beta.source(source); function randomBinomial(n, p) { n = +n; if ((p = +p) >= 1) return () => n; if (p <= 0) return () => 0; return function() { var acc = 0, nn = n, pp = p; while (nn * pp > 16 && nn * (1 - pp) > 16) { var i = Math.floor((nn + 1) * pp), y2 = B2(i, nn - i + 1)(); if (y2 <= pp) { acc += i; nn -= i; pp = (pp - y2) / (1 - y2); } else { nn = i - 1; pp /= y2; } } var sign2 = pp < 0.5, pFinal = sign2 ? pp : 1 - pp, g = G(pFinal); for (var s2 = g(), k2 = 0; s2 <= nn; ++k2) s2 += g(); return acc + (sign2 ? k2 : nn - k2); }; } randomBinomial.source = sourceRandomBinomial; return randomBinomial; }(defaultSource); const weibull = function sourceRandomWeibull(source) { function randomWeibull(k2, a2, b) { var outerFunc; if ((k2 = +k2) === 0) { outerFunc = (x2) => -Math.log(x2); } else { k2 = 1 / k2; outerFunc = (x2) => Math.pow(x2, k2); } a2 = a2 == null ? 0 : +a2; b = b == null ? 1 : +b; return function() { return a2 + b * outerFunc(-Math.log1p(-source())); }; } randomWeibull.source = sourceRandomWeibull; return randomWeibull; }(defaultSource); const cauchy = function sourceRandomCauchy(source) { function randomCauchy(a2, b) { a2 = a2 == null ? 0 : +a2; b = b == null ? 1 : +b; return function() { return a2 + b * Math.tan(Math.PI * source()); }; } randomCauchy.source = sourceRandomCauchy; return randomCauchy; }(defaultSource); const logistic = function sourceRandomLogistic(source) { function randomLogistic(a2, b) { a2 = a2 == null ? 0 : +a2; b = b == null ? 1 : +b; return function() { var u2 = source(); return a2 + b * Math.log(u2 / (1 - u2)); }; } randomLogistic.source = sourceRandomLogistic; return randomLogistic; }(defaultSource); const poisson = function sourceRandomPoisson(source) { var G = gamma.source(source), B2 = binomial.source(source); function randomPoisson(lambda) { return function() { var acc = 0, l = lambda; while (l > 16) { var n = Math.floor(0.875 * l), t = G(n)(); if (t > l) return acc + B2(n - 1, l / t)(); acc += n; l -= t; } for (var s2 = -Math.log1p(-source()), k2 = 0; s2 <= l; ++k2) s2 -= Math.log1p(-source()); return acc + k2; }; } randomPoisson.source = sourceRandomPoisson; return randomPoisson; }(defaultSource); const mul = 1664525; const inc = 1013904223; const eps = 1 / 4294967296; function lcg(seed = Math.random()) { let state = (0 <= seed && seed < 1 ? seed / eps : Math.abs(seed)) | 0; return () => (state = mul * state + inc | 0, eps * (state >>> 0)); } function initRange(domain, range2) { switch (arguments.length) { case 0: break; case 1: this.range(domain); break; default: this.range(range2).domain(domain); break; } return this; } function initInterpolator(domain, interpolator) { switch (arguments.length) { case 0: break; case 1: { if (typeof domain === "function") this.interpolator(domain); else this.range(domain); break; } default: { this.domain(domain); if (typeof interpolator === "function") this.interpolator(interpolator); else this.range(interpolator); break; } } return this; } const implicit = Symbol("implicit"); function ordinal() { var index2 = new InternMap(), domain = [], range2 = [], unknown = implicit; function scale(d) { let i = index2.get(d); if (i === void 0) { if (unknown !== implicit) return unknown; index2.set(d, i = domain.push(d) - 1); } return range2[i % range2.length]; } scale.domain = function(_2) { if (!arguments.length) return domain.slice(); domain = [], index2 = new InternMap(); for (const value of _2) { if (index2.has(value)) continue; index2.set(value, domain.push(value) - 1); } return scale; }; scale.range = function(_2) { return arguments.length ? (range2 = Array.from(_2), scale) : range2.slice(); }; scale.unknown = function(_2) { return arguments.length ? (unknown = _2, scale) : unknown; }; scale.copy = function() { return ordinal(domain, range2).unknown(unknown); }; initRange.apply(scale, arguments); return scale; } function band() { var scale = ordinal().unknown(void 0), domain = scale.domain, ordinalRange = scale.range, r0 = 0, r1 = 1, step, bandwidth, round = false, paddingInner = 0, paddingOuter = 0, align = 0.5; delete scale.unknown; function rescale() { var n = domain().length, reverse2 = r1 < r0, start2 = reverse2 ? r1 : r0, stop = reverse2 ? r0 : r1; step = (stop - start2) / Math.max(1, n - paddingInner + paddingOuter * 2); if (round) step = Math.floor(step); start2 += (stop - start2 - step * (n - paddingInner)) * align; bandwidth = step * (1 - paddingInner); if (round) start2 = Math.round(start2), bandwidth = Math.round(bandwidth); var values = range$2(n).map(function(i) { return start2 + step * i; }); return ordinalRange(reverse2 ? values.reverse() : values); } scale.domain = function(_2) { return arguments.length ? (domain(_2), rescale()) : domain(); }; scale.range = function(_2) { return arguments.length ? ([r0, r1] = _2, r0 = +r0, r1 = +r1, rescale()) : [r0, r1]; }; scale.rangeRound = function(_2) { return [r0, r1] = _2, r0 = +r0, r1 = +r1, round = true, rescale(); }; scale.bandwidth = function() { return bandwidth; }; scale.step = function() { return step; }; scale.round = function(_2) { return arguments.length ? (round = !!_2, rescale()) : round; }; scale.padding = function(_2) { return arguments.length ? (paddingInner = Math.min(1, paddingOuter = +_2), rescale()) : paddingInner; }; scale.paddingInner = function(_2) { return arguments.length ? (paddingInner = Math.min(1, _2), rescale()) : paddingInner; }; scale.paddingOuter = function(_2) { return arguments.length ? (paddingOuter = +_2, rescale()) : paddingOuter; }; scale.align = function(_2) { return arguments.length ? (align = Math.max(0, Math.min(1, _2)), rescale()) : align; }; scale.copy = function() { return band(domain(), [r0, r1]).round(round).paddingInner(paddingInner).paddingOuter(paddingOuter).align(align); }; return initRange.apply(rescale(), arguments); } function pointish(scale) { var copy2 = scale.copy; scale.padding = scale.paddingOuter; delete scale.paddingInner; delete scale.paddingOuter; scale.copy = function() { return pointish(copy2()); }; return scale; } function point$5() { return pointish(band.apply(null, arguments).paddingInner(1)); } function constants(x2) { return function() { return x2; }; } function number$1(x2) { return +x2; } var unit$1 = [0, 1]; function identity$3(x2) { return x2; } function normalize$1(a2, b) { return (b -= a2 = +a2) ? function(x2) { return (x2 - a2) / b; } : constants(isNaN(b) ? NaN : 0.5); } function clamper(a2, b) { var t; if (a2 > b) t = a2, a2 = b, b = t; return function(x2) { return Math.max(a2, Math.min(b, x2)); }; } function bimap(domain, range2, interpolate2) { var d0 = domain[0], d1 = domain[1], r0 = range2[0], r1 = range2[1]; if (d1 < d0) d0 = normalize$1(d1, d0), r0 = interpolate2(r1, r0); else d0 = normalize$1(d0, d1), r0 = interpolate2(r0, r1); return function(x2) { return r0(d0(x2)); }; } function polymap(domain, range2, interpolate2) { var j = Math.min(domain.length, range2.length) - 1, d = new Array(j), r = new Array(j), i = -1; if (domain[j] < domain[0]) { domain = domain.slice().reverse(); range2 = range2.slice().reverse(); } while (++i < j) { d[i] = normalize$1(domain[i], domain[i + 1]); r[i] = interpolate2(range2[i], range2[i + 1]); } return function(x2) { var i2 = bisect(domain, x2, 1, j) - 1; return r[i2](d[i2](x2)); }; } function copy$2(source, target) { return target.domain(source.domain()).range(source.range()).interpolate(source.interpolate()).clamp(source.clamp()).unknown(source.unknown()); } function transformer$2() { var domain = unit$1, range2 = unit$1, interpolate2 = interpolate$2, transform2, untransform, unknown, clamp = identity$3, piecewise2, output, input; function rescale() { var n = Math.min(domain.length, range2.length); if (clamp !== identity$3) clamp = clamper(domain[0], domain[n - 1]); piecewise2 = n > 2 ? polymap : bimap; output = input = null; return scale; } function scale(x2) { return x2 == null || isNaN(x2 = +x2) ? unknown : (output || (output = piecewise2(domain.map(transform2), range2, interpolate2)))(transform2(clamp(x2))); } scale.invert = function(y2) { return clamp(untransform((input || (input = piecewise2(range2, domain.map(transform2), interpolateNumber)))(y2))); }; scale.domain = function(_2) { return arguments.length ? (domain = Array.from(_2, number$1), rescale()) : domain.slice(); }; scale.range = function(_2) { return arguments.length ? (range2 = Array.from(_2), rescale()) : range2.slice(); }; scale.rangeRound = function(_2) { return range2 = Array.from(_2), interpolate2 = interpolateRound, rescale(); }; scale.clamp = function(_2) { return arguments.length ? (clamp = _2 ? true : identity$3, rescale()) : clamp !== identity$3; }; scale.interpolate = function(_2) { return arguments.length ? (interpolate2 = _2, rescale()) : interpolate2; }; scale.unknown = function(_2) { return arguments.length ? (unknown = _2, scale) : unknown; }; return function(t, u2) { transform2 = t, untransform = u2; return rescale(); }; } function continuous() { return transformer$2()(identity$3, identity$3); } function tickFormat(start2, stop, count2, specifier) { var step = tickStep(start2, stop, count2), precision; specifier = formatSpecifier(specifier == null ? ",f" : specifier); switch (specifier.type) { case "s": { var value = Math.max(Math.abs(start2), Math.abs(stop)); if (specifier.precision == null && !isNaN(precision = precisionPrefix(step, value))) specifier.precision = precision; return formatPrefix(specifier, value); } case "": case "e": case "g": case "p": case "r": { if (specifier.precision == null && !isNaN(precision = precisionRound(step, Math.max(Math.abs(start2), Math.abs(stop))))) specifier.precision = precision - (specifier.type === "e"); break; } case "f": case "%": { if (specifier.precision == null && !isNaN(precision = precisionFixed(step))) specifier.precision = precision - (specifier.type === "%") * 2; break; } } return format(specifier); } function linearish(scale) { var domain = scale.domain; scale.ticks = function(count2) { var d = domain(); return ticks(d[0], d[d.length - 1], count2 == null ? 10 : count2); }; scale.tickFormat = function(count2, specifier) { var d = domain(); return tickFormat(d[0], d[d.length - 1], count2 == null ? 10 : count2, specifier); }; scale.nice = function(count2) { if (count2 == null) count2 = 10; var d = domain(); var i0 = 0; var i1 = d.length - 1; var start2 = d[i0]; var stop = d[i1]; var prestep; var step; var maxIter = 10; if (stop < start2) { step = start2, start2 = stop, stop = step; step = i0, i0 = i1, i1 = step; } while (maxIter-- > 0) { step = tickIncrement(start2, stop, count2); if (step === prestep) { d[i0] = start2; d[i1] = stop; return domain(d); } else if (step > 0) { start2 = Math.floor(start2 / step) * step; stop = Math.ceil(stop / step) * step; } else if (step < 0) { start2 = Math.ceil(start2 * step) / step; stop = Math.floor(stop * step) / step; } else { break; } prestep = step; } return scale; }; return scale; } function linear() { var scale = continuous(); scale.copy = function() { return copy$2(scale, linear()); }; initRange.apply(scale, arguments); return linearish(scale); } function identity$2(domain) { var unknown; function scale(x2) { return x2 == null || isNaN(x2 = +x2) ? unknown : x2; } scale.invert = scale; scale.domain = scale.range = function(_2) { return arguments.length ? (domain = Array.from(_2, number$1), scale) : domain.slice(); }; scale.unknown = function(_2) { return arguments.length ? (unknown = _2, scale) : unknown; }; scale.copy = function() { return identity$2(domain).unknown(unknown); }; domain = arguments.length ? Array.from(domain, number$1) : [0, 1]; return linearish(scale); } function nice(domain, interval2) { domain = domain.slice(); var i0 = 0, i1 = domain.length - 1, x02 = domain[i0], x12 = domain[i1], t; if (x12 < x02) { t = i0, i0 = i1, i1 = t; t = x02, x02 = x12, x12 = t; } domain[i0] = interval2.floor(x02); domain[i1] = interval2.ceil(x12); return domain; } function transformLog(x2) { return Math.log(x2); } function transformExp(x2) { return Math.exp(x2); } function transformLogn(x2) { return -Math.log(-x2); } function transformExpn(x2) { return -Math.exp(-x2); } function pow10(x2) { return isFinite(x2) ? +("1e" + x2) : x2 < 0 ? 0 : x2; } function powp(base) { return base === 10 ? pow10 : base === Math.E ? Math.exp : (x2) => Math.pow(base, x2); } function logp(base) { return base === Math.E ? Math.log : base === 10 && Math.log10 || base === 2 && Math.log2 || (base = Math.log(base), (x2) => Math.log(x2) / base); } function reflect(f) { return (x2, k2) => -f(-x2, k2); } function loggish(transform2) { const scale = transform2(transformLog, transformExp); const domain = scale.domain; let base = 10; let logs; let pows; function rescale() { logs = logp(base), pows = powp(base); if (domain()[0] < 0) { logs = reflect(logs), pows = reflect(pows); transform2(transformLogn, transformExpn); } else { transform2(transformLog, transformExp); } return scale; } scale.base = function(_2) { return arguments.length ? (base = +_2, rescale()) : base; }; scale.domain = function(_2) { return arguments.length ? (domain(_2), rescale()) : domain(); }; scale.ticks = (count2) => { const d = domain(); let u2 = d[0]; let v = d[d.length - 1]; const r = v < u2; if (r) [u2, v] = [v, u2]; let i = logs(u2); let j = logs(v); let k2; let t; const n = count2 == null ? 10 : +count2; let z = []; if (!(base % 1) && j - i < n) { i = Math.floor(i), j = Math.ceil(j); if (u2 > 0) for (; i <= j; ++i) { for (k2 = 1; k2 < base; ++k2) { t = i < 0 ? k2 / pows(-i) : k2 * pows(i); if (t < u2) continue; if (t > v) break; z.push(t); } } else for (; i <= j; ++i) { for (k2 = base - 1; k2 >= 1; --k2) { t = i > 0 ? k2 / pows(-i) : k2 * pows(i); if (t < u2) continue; if (t > v) break; z.push(t); } } if (z.length * 2 < n) z = ticks(u2, v, n); } else { z = ticks(i, j, Math.min(j - i, n)).map(pows); } return r ? z.reverse() : z; }; scale.tickFormat = (count2, specifier) => { if (count2 == null) count2 = 10; if (specifier == null) specifier = base === 10 ? "s" : ","; if (typeof specifier !== "function") { if (!(base % 1) && (specifier = formatSpecifier(specifier)).precision == null) specifier.trim = true; specifier = format(specifier); } if (count2 === Infinity) return specifier; const k2 = Math.max(1, base * count2 / scale.ticks().length); return (d) => { let i = d / pows(Math.round(logs(d))); if (i * base < base - 0.5) i *= base; return i <= k2 ? specifier(d) : ""; }; }; scale.nice = () => { return domain(nice(domain(), { floor: (x2) => pows(Math.floor(logs(x2))), ceil: (x2) => pows(Math.ceil(logs(x2))) })); }; return scale; } function log$1() { const scale = loggish(transformer$2()).domain([1, 10]); scale.copy = () => copy$2(scale, log$1()).base(scale.base()); initRange.apply(scale, arguments); return scale; } function transformSymlog(c2) { return function(x2) { return Math.sign(x2) * Math.log1p(Math.abs(x2 / c2)); }; } function transformSymexp(c2) { return function(x2) { return Math.sign(x2) * Math.expm1(Math.abs(x2)) * c2; }; } function symlogish(transform2) { var c2 = 1, scale = transform2(transformSymlog(c2), transformSymexp(c2)); scale.constant = function(_2) { return arguments.length ? transform2(transformSymlog(c2 = +_2), transformSymexp(c2)) : c2; }; return linearish(scale); } function symlog() { var scale = symlogish(transformer$2()); scale.copy = function() { return copy$2(scale, symlog()).constant(scale.constant()); }; return initRange.apply(scale, arguments); } function transformPow(exponent2) { return function(x2) { return x2 < 0 ? -Math.pow(-x2, exponent2) : Math.pow(x2, exponent2); }; } function transformSqrt(x2) { return x2 < 0 ? -Math.sqrt(-x2) : Math.sqrt(x2); } function transformSquare(x2) { return x2 < 0 ? -x2 * x2 : x2 * x2; } function powish(transform2) { var scale = transform2(identity$3, identity$3), exponent2 = 1; function rescale() { return exponent2 === 1 ? transform2(identity$3, identity$3) : exponent2 === 0.5 ? transform2(transformSqrt, transformSquare) : transform2(transformPow(exponent2), transformPow(1 / exponent2)); } scale.exponent = function(_2) { return arguments.length ? (exponent2 = +_2, rescale()) : exponent2; }; return linearish(scale); } function pow() { var scale = powish(transformer$2()); scale.copy = function() { return copy$2(scale, pow()).exponent(scale.exponent()); }; initRange.apply(scale, arguments); return scale; } function sqrt$1() { return pow.apply(null, arguments).exponent(0.5); } function square$1(x2) { return Math.sign(x2) * x2 * x2; } function unsquare(x2) { return Math.sign(x2) * Math.sqrt(Math.abs(x2)); } function radial() { var squared = continuous(), range2 = [0, 1], round = false, unknown; function scale(x2) { var y2 = unsquare(squared(x2)); return isNaN(y2) ? unknown : round ? Math.round(y2) : y2; } scale.invert = function(y2) { return squared.invert(square$1(y2)); }; scale.domain = function(_2) { return arguments.length ? (squared.domain(_2), scale) : squared.domain(); }; scale.range = function(_2) { return arguments.length ? (squared.range((range2 = Array.from(_2, number$1)).map(square$1)), scale) : range2.slice(); }; scale.rangeRound = function(_2) { return scale.range(_2).round(true); }; scale.round = function(_2) { return arguments.length ? (round = !!_2, scale) : round; }; scale.clamp = function(_2) { return arguments.length ? (squared.clamp(_2), scale) : squared.clamp(); }; scale.unknown = function(_2) { return arguments.length ? (unknown = _2, scale) : unknown; }; scale.copy = function() { return radial(squared.domain(), range2).round(round).clamp(squared.clamp()).unknown(unknown); }; initRange.apply(scale, arguments); return linearish(scale); } function quantile() { var domain = [], range2 = [], thresholds = [], unknown; function rescale() { var i = 0, n = Math.max(1, range2.length); thresholds = new Array(n - 1); while (++i < n) thresholds[i - 1] = quantileSorted(domain, i / n); return scale; } function scale(x2) { return x2 == null || isNaN(x2 = +x2) ? unknown : range2[bisect(thresholds, x2)]; } scale.invertExtent = function(y2) { var i = range2.indexOf(y2); return i < 0 ? [NaN, NaN] : [ i > 0 ? thresholds[i - 1] : domain[0], i < thresholds.length ? thresholds[i] : domain[domain.length - 1] ]; }; scale.domain = function(_2) { if (!arguments.length) return domain.slice(); domain = []; for (let d of _2) if (d != null && !isNaN(d = +d)) domain.push(d); domain.sort(ascending$3); return rescale(); }; scale.range = function(_2) { return arguments.length ? (range2 = Array.from(_2), rescale()) : range2.slice(); }; scale.unknown = function(_2) { return arguments.length ? (unknown = _2, scale) : unknown; }; scale.quantiles = function() { return thresholds.slice(); }; scale.copy = function() { return quantile().domain(domain).range(range2).unknown(unknown); }; return initRange.apply(scale, arguments); } function quantize() { var x02 = 0, x12 = 1, n = 1, domain = [0.5], range2 = [0, 1], unknown; function scale(x2) { return x2 != null && x2 <= x2 ? range2[bisect(domain, x2, 0, n)] : unknown; } function rescale() { var i = -1; domain = new Array(n); while (++i < n) domain[i] = ((i + 1) * x12 - (i - n) * x02) / (n + 1); return scale; } scale.domain = function(_2) { return arguments.length ? ([x02, x12] = _2, x02 = +x02, x12 = +x12, rescale()) : [x02, x12]; }; scale.range = function(_2) { return arguments.length ? (n = (range2 = Array.from(_2)).length - 1, rescale()) : range2.slice(); }; scale.invertExtent = function(y2) { var i = range2.indexOf(y2); return i < 0 ? [NaN, NaN] : i < 1 ? [x02, domain[0]] : i >= n ? [domain[n - 1], x12] : [domain[i - 1], domain[i]]; }; scale.unknown = function(_2) { return arguments.length ? (unknown = _2, scale) : scale; }; scale.thresholds = function() { return domain.slice(); }; scale.copy = function() { return quantize().domain([x02, x12]).range(range2).unknown(unknown); }; return initRange.apply(linearish(scale), arguments); } function threshold() { var domain = [0.5], range2 = [0, 1], unknown, n = 1; function scale(x2) { return x2 != null && x2 <= x2 ? range2[bisect(domain, x2, 0, n)] : unknown; } scale.domain = function(_2) { return arguments.length ? (domain = Array.from(_2), n = Math.min(domain.length, range2.length - 1), scale) : domain.slice(); }; scale.range = function(_2) { return arguments.length ? (range2 = Array.from(_2), n = Math.min(domain.length, range2.length - 1), scale) : range2.slice(); }; scale.invertExtent = function(y2) { var i = range2.indexOf(y2); return [domain[i - 1], domain[i]]; }; scale.unknown = function(_2) { return arguments.length ? (unknown = _2, scale) : unknown; }; scale.copy = function() { return threshold().domain(domain).range(range2).unknown(unknown); }; return initRange.apply(scale, arguments); } var t0 = new Date(), t1 = new Date(); function newInterval(floori, offseti, count2, field) { function interval2(date2) { return floori(date2 = arguments.length === 0 ? new Date() : new Date(+date2)), date2; } interval2.floor = function(date2) { return floori(date2 = new Date(+date2)), date2; }; interval2.ceil = function(date2) { return floori(date2 = new Date(date2 - 1)), offseti(date2, 1), floori(date2), date2; }; interval2.round = function(date2) { var d0 = interval2(date2), d1 = interval2.ceil(date2); return date2 - d0 < d1 - date2 ? d0 : d1; }; interval2.offset = function(date2, step) { return offseti(date2 = new Date(+date2), step == null ? 1 : Math.floor(step)), date2; }; interval2.range = function(start2, stop, step) { var range2 = [], previous; start2 = interval2.ceil(start2); step = step == null ? 1 : Math.floor(step); if (!(start2 < stop) || !(step > 0)) return range2; do range2.push(previous = new Date(+start2)), offseti(start2, step), floori(start2); while (previous < start2 && start2 < stop); return range2; }; interval2.filter = function(test) { return newInterval(function(date2) { if (date2 >= date2) while (floori(date2), !test(date2)) date2.setTime(date2 - 1); }, function(date2, step) { if (date2 >= date2) { if (step < 0) while (++step <= 0) { while (offseti(date2, -1), !test(date2)) { } } else while (--step >= 0) { while (offseti(date2, 1), !test(date2)) { } } } }); }; if (count2) { interval2.count = function(start2, end2) { t0.setTime(+start2), t1.setTime(+end2); floori(t0), floori(t1); return Math.floor(count2(t0, t1)); }; interval2.every = function(step) { step = Math.floor(step); return !isFinite(step) || !(step > 0) ? null : !(step > 1) ? interval2 : interval2.filter(field ? function(d) { return field(d) % step === 0; } : function(d) { return interval2.count(0, d) % step === 0; }); }; } return interval2; } var millisecond = newInterval(function() { }, function(date2, step) { date2.setTime(+date2 + step); }, function(start2, end2) { return end2 - start2; }); millisecond.every = function(k2) { k2 = Math.floor(k2); if (!isFinite(k2) || !(k2 > 0)) return null; if (!(k2 > 1)) return millisecond; return newInterval(function(date2) { date2.setTime(Math.floor(date2 / k2) * k2); }, function(date2, step) { date2.setTime(+date2 + step * k2); }, function(start2, end2) { return (end2 - start2) / k2; }); }; const millisecond$1 = millisecond; var milliseconds = millisecond.range; const durationSecond = 1e3; const durationMinute = durationSecond * 60; const durationHour = durationMinute * 60; const durationDay = durationHour * 24; const durationWeek = durationDay * 7; const durationMonth = durationDay * 30; const durationYear = durationDay * 365; var second = newInterval(function(date2) { date2.setTime(date2 - date2.getMilliseconds()); }, function(date2, step) { date2.setTime(+date2 + step * durationSecond); }, function(start2, end2) { return (end2 - start2) / durationSecond; }, function(date2) { return date2.getUTCSeconds(); }); const utcSecond = second; var seconds = second.range; var minute = newInterval(function(date2) { date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond); }, function(date2, step) { date2.setTime(+date2 + step * durationMinute); }, function(start2, end2) { return (end2 - start2) / durationMinute; }, function(date2) { return date2.getMinutes(); }); const timeMinute = minute; var minutes = minute.range; var hour = newInterval(function(date2) { date2.setTime(date2 - date2.getMilliseconds() - date2.getSeconds() * durationSecond - date2.getMinutes() * durationMinute); }, function(date2, step) { date2.setTime(+date2 + step * durationHour); }, function(start2, end2) { return (end2 - start2) / durationHour; }, function(date2) { return date2.getHours(); }); const timeHour = hour; var hours = hour.range; var day = newInterval( (date2) => date2.setHours(0, 0, 0, 0), (date2, step) => date2.setDate(date2.getDate() + step), (start2, end2) => (end2 - start2 - (end2.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationDay, (date2) => date2.getDate() - 1 ); const timeDay = day; var days = day.range; function weekday(i) { return newInterval(function(date2) { date2.setDate(date2.getDate() - (date2.getDay() + 7 - i) % 7); date2.setHours(0, 0, 0, 0); }, function(date2, step) { date2.setDate(date2.getDate() + step * 7); }, function(start2, end2) { return (end2 - start2 - (end2.getTimezoneOffset() - start2.getTimezoneOffset()) * durationMinute) / durationWeek; }); } var sunday = weekday(0); var monday = weekday(1); var tuesday = weekday(2); var wednesday = weekday(3); var thursday = weekday(4); var friday = weekday(5); var saturday = weekday(6); var sundays = sunday.range; var mondays = monday.range; var tuesdays = tuesday.range; var wednesdays = wednesday.range; var thursdays = thursday.range; var fridays = friday.range; var saturdays = saturday.range; var month = newInterval(function(date2) { date2.setDate(1); date2.setHours(0, 0, 0, 0); }, function(date2, step) { date2.setMonth(date2.getMonth() + step); }, function(start2, end2) { return end2.getMonth() - start2.getMonth() + (end2.getFullYear() - start2.getFullYear()) * 12; }, function(date2) { return date2.getMonth(); }); const timeMonth = month; var months = month.range; var year = newInterval(function(date2) { date2.setMonth(0, 1); date2.setHours(0, 0, 0, 0); }, function(date2, step) { date2.setFullYear(date2.getFullYear() + step); }, function(start2, end2) { return end2.getFullYear() - start2.getFullYear(); }, function(date2) { return date2.getFullYear(); }); year.every = function(k2) { return !isFinite(k2 = Math.floor(k2)) || !(k2 > 0) ? null : newInterval(function(date2) { date2.setFullYear(Math.floor(date2.getFullYear() / k2) * k2); date2.setMonth(0, 1); date2.setHours(0, 0, 0, 0); }, function(date2, step) { date2.setFullYear(date2.getFullYear() + step * k2); }); }; const timeYear = year; var years = year.range; var utcMinute = newInterval(function(date2) { date2.setUTCSeconds(0, 0); }, function(date2, step) { date2.setTime(+date2 + step * durationMinute); }, function(start2, end2) { return (end2 - start2) / durationMinute; }, function(date2) { return date2.getUTCMinutes(); }); const utcMinute$1 = utcMinute; var utcMinutes = utcMinute.range; var utcHour = newInterval(function(date2) { date2.setUTCMinutes(0, 0, 0); }, function(date2, step) { date2.setTime(+date2 + step * durationHour); }, function(start2, end2) { return (end2 - start2) / durationHour; }, function(date2) { return date2.getUTCHours(); }); const utcHour$1 = utcHour; var utcHours = utcHour.range; var utcDay = newInterval(function(date2) { date2.setUTCHours(0, 0, 0, 0); }, function(date2, step) { date2.setUTCDate(date2.getUTCDate() + step); }, function(start2, end2) { return (end2 - start2) / durationDay; }, function(date2) { return date2.getUTCDate() - 1; }); const utcDay$1 = utcDay; var utcDays = utcDay.range; function utcWeekday(i) { return newInterval(function(date2) { date2.setUTCDate(date2.getUTCDate() - (date2.getUTCDay() + 7 - i) % 7); date2.setUTCHours(0, 0, 0, 0); }, function(date2, step) { date2.setUTCDate(date2.getUTCDate() + step * 7); }, function(start2, end2) { return (end2 - start2) / durationWeek; }); } var utcSunday = utcWeekday(0); var utcMonday = utcWeekday(1); var utcTuesday = utcWeekday(2); var utcWednesday = utcWeekday(3); var utcThursday = utcWeekday(4); var utcFriday = utcWeekday(5); var utcSaturday = utcWeekday(6); var utcSundays = utcSunday.range; var utcMondays = utcMonday.range; var utcTuesdays = utcTuesday.range; var utcWednesdays = utcWednesday.range; var utcThursdays = utcThursday.range; var utcFridays = utcFriday.range; var utcSaturdays = utcSaturday.range; var utcMonth = newInterval(function(date2) { date2.setUTCDate(1); date2.setUTCHours(0, 0, 0, 0); }, function(date2, step) { date2.setUTCMonth(date2.getUTCMonth() + step); }, function(start2, end2) { return end2.getUTCMonth() - start2.getUTCMonth() + (end2.getUTCFullYear() - start2.getUTCFullYear()) * 12; }, function(date2) { return date2.getUTCMonth(); }); const utcMonth$1 = utcMonth; var utcMonths = utcMonth.range; var utcYear = newInterval(function(date2) { date2.setUTCMonth(0, 1); date2.setUTCHours(0, 0, 0, 0); }, function(date2, step) { date2.setUTCFullYear(date2.getUTCFullYear() + step); }, function(start2, end2) { return end2.getUTCFullYear() - start2.getUTCFullYear(); }, function(date2) { return date2.getUTCFullYear(); }); utcYear.every = function(k2) { return !isFinite(k2 = Math.floor(k2)) || !(k2 > 0) ? null : newInterval(function(date2) { date2.setUTCFullYear(Math.floor(date2.getUTCFullYear() / k2) * k2); date2.setUTCMonth(0, 1); date2.setUTCHours(0, 0, 0, 0); }, function(date2, step) { date2.setUTCFullYear(date2.getUTCFullYear() + step * k2); }); }; const utcYear$1 = utcYear; var utcYears = utcYear.range; function ticker(year2, month2, week, day2, hour2, minute2) { const tickIntervals = [ [utcSecond, 1, durationSecond], [utcSecond, 5, 5 * durationSecond], [utcSecond, 15, 15 * durationSecond], [utcSecond, 30, 30 * durationSecond], [minute2, 1, durationMinute], [minute2, 5, 5 * durationMinute], [minute2, 15, 15 * durationMinute], [minute2, 30, 30 * durationMinute], [hour2, 1, durationHour], [hour2, 3, 3 * durationHour], [hour2, 6, 6 * durationHour], [hour2, 12, 12 * durationHour], [day2, 1, durationDay], [day2, 2, 2 * durationDay], [week, 1, durationWeek], [month2, 1, durationMonth], [month2, 3, 3 * durationMonth], [year2, 1, durationYear] ]; function ticks2(start2, stop, count2) { const reverse2 = stop < start2; if (reverse2) [start2, stop] = [stop, start2]; const interval2 = count2 && typeof count2.range === "function" ? count2 : tickInterval(start2, stop, count2); const ticks3 = interval2 ? interval2.range(start2, +stop + 1) : []; return reverse2 ? ticks3.reverse() : ticks3; } function tickInterval(start2, stop, count2) { const target = Math.abs(stop - start2) / count2; const i = bisector(([, , step2]) => step2).right(tickIntervals, target); if (i === tickIntervals.length) return year2.every(tickStep(start2 / durationYear, stop / durationYear, count2)); if (i === 0) return millisecond$1.every(Math.max(tickStep(start2, stop, count2), 1)); const [t, step] = tickIntervals[target / tickIntervals[i - 1][2] < tickIntervals[i][2] / target ? i - 1 : i]; return t.every(step); } return [ticks2, tickInterval]; } const [utcTicks, utcTickInterval] = ticker(utcYear$1, utcMonth$1, utcSunday, utcDay$1, utcHour$1, utcMinute$1); const [timeTicks, timeTickInterval] = ticker(timeYear, timeMonth, sunday, timeDay, timeHour, timeMinute); function localDate(d) { if (0 <= d.y && d.y < 100) { var date2 = new Date(-1, d.m, d.d, d.H, d.M, d.S, d.L); date2.setFullYear(d.y); return date2; } return new Date(d.y, d.m, d.d, d.H, d.M, d.S, d.L); } function utcDate(d) { if (0 <= d.y && d.y < 100) { var date2 = new Date(Date.UTC(-1, d.m, d.d, d.H, d.M, d.S, d.L)); date2.setUTCFullYear(d.y); return date2; } return new Date(Date.UTC(d.y, d.m, d.d, d.H, d.M, d.S, d.L)); } function newDate(y2, m2, d) { return { y: y2, m: m2, d, H: 0, M: 0, S: 0, L: 0 }; } function formatLocale(locale2) { var locale_dateTime = locale2.dateTime, locale_date = locale2.date, locale_time = locale2.time, locale_periods = locale2.periods, locale_weekdays = locale2.days, locale_shortWeekdays = locale2.shortDays, locale_months = locale2.months, locale_shortMonths = locale2.shortMonths; var periodRe = formatRe(locale_periods), periodLookup = formatLookup(locale_periods), weekdayRe = formatRe(locale_weekdays), weekdayLookup = formatLookup(locale_weekdays), shortWeekdayRe = formatRe(locale_shortWeekdays), shortWeekdayLookup = formatLookup(locale_shortWeekdays), monthRe = formatRe(locale_months), monthLookup = formatLookup(locale_months), shortMonthRe = formatRe(locale_shortMonths), shortMonthLookup = formatLookup(locale_shortMonths); var formats = { "a": formatShortWeekday, "A": formatWeekday, "b": formatShortMonth, "B": formatMonth, "c": null, "d": formatDayOfMonth, "e": formatDayOfMonth, "f": formatMicroseconds, "g": formatYearISO, "G": formatFullYearISO, "H": formatHour24, "I": formatHour12, "j": formatDayOfYear, "L": formatMilliseconds, "m": formatMonthNumber, "M": formatMinutes, "p": formatPeriod, "q": formatQuarter, "Q": formatUnixTimestamp, "s": formatUnixTimestampSeconds, "S": formatSeconds, "u": formatWeekdayNumberMonday, "U": formatWeekNumberSunday, "V": formatWeekNumberISO, "w": formatWeekdayNumberSunday, "W": formatWeekNumberMonday, "x": null, "X": null, "y": formatYear, "Y": formatFullYear, "Z": formatZone, "%": formatLiteralPercent }; var utcFormats = { "a": formatUTCShortWeekday, "A": formatUTCWeekday, "b": formatUTCShortMonth, "B": formatUTCMonth, "c": null, "d": formatUTCDayOfMonth, "e": formatUTCDayOfMonth, "f": formatUTCMicroseconds, "g": formatUTCYearISO, "G": formatUTCFullYearISO, "H": formatUTCHour24, "I": formatUTCHour12, "j": formatUTCDayOfYear, "L": formatUTCMilliseconds, "m": formatUTCMonthNumber, "M": formatUTCMinutes, "p": formatUTCPeriod, "q": formatUTCQuarter, "Q": formatUnixTimestamp, "s": formatUnixTimestampSeconds, "S": formatUTCSeconds, "u": formatUTCWeekdayNumberMonday, "U": formatUTCWeekNumberSunday, "V": formatUTCWeekNumberISO, "w": formatUTCWeekdayNumberSunday, "W": formatUTCWeekNumberMonday, "x": null, "X": null, "y": formatUTCYear, "Y": formatUTCFullYear, "Z": formatUTCZone, "%": formatLiteralPercent }; var parses = { "a": parseShortWeekday, "A": parseWeekday, "b": parseShortMonth, "B": parseMonth, "c": parseLocaleDateTime, "d": parseDayOfMonth, "e": parseDayOfMonth, "f": parseMicroseconds, "g": parseYear, "G": parseFullYear, "H": parseHour24, "I": parseHour24, "j": parseDayOfYear, "L": parseMilliseconds, "m": parseMonthNumber, "M": parseMinutes, "p": parsePeriod, "q": parseQuarter, "Q": parseUnixTimestamp, "s": parseUnixTimestampSeconds, "S": parseSeconds, "u": parseWeekdayNumberMonday, "U": parseWeekNumberSunday, "V": parseWeekNumberISO, "w": parseWeekdayNumberSunday, "W": parseWeekNumberMonday, "x": parseLocaleDate, "X": parseLocaleTime, "y": parseYear, "Y": parseFullYear, "Z": parseZone, "%": parseLiteralPercent }; formats.x = newFormat(locale_date, formats); formats.X = newFormat(locale_time, formats); formats.c = newFormat(locale_dateTime, formats); utcFormats.x = newFormat(locale_date, utcFormats); utcFormats.X = newFormat(locale_time, utcFormats); utcFormats.c = newFormat(locale_dateTime, utcFormats); function newFormat(specifier, formats2) { return function(date2) { var string = [], i = -1, j = 0, n = specifier.length, c2, pad2, format2; if (!(date2 instanceof Date)) date2 = new Date(+date2); while (++i < n) { if (specifier.charCodeAt(i) === 37) { string.push(specifier.slice(j, i)); if ((pad2 = pads[c2 = specifier.charAt(++i)]) != null) c2 = specifier.charAt(++i); else pad2 = c2 === "e" ? " " : "0"; if (format2 = formats2[c2]) c2 = format2(date2, pad2); string.push(c2); j = i + 1; } } string.push(specifier.slice(j, i)); return string.join(""); }; } function newParse(specifier, Z) { return function(string) { var d = newDate(1900, void 0, 1), i = parseSpecifier(d, specifier, string += "", 0), week, day2; if (i != string.length) return null; if ("Q" in d) return new Date(d.Q); if ("s" in d) return new Date(d.s * 1e3 + ("L" in d ? d.L : 0)); if (Z && !("Z" in d)) d.Z = 0; if ("p" in d) d.H = d.H % 12 + d.p * 12; if (d.m === void 0) d.m = "q" in d ? d.q : 0; if ("V" in d) { if (d.V < 1 || d.V > 53) return null; if (!("w" in d)) d.w = 1; if ("Z" in d) { week = utcDate(newDate(d.y, 0, 1)), day2 = week.getUTCDay(); week = day2 > 4 || day2 === 0 ? utcMonday.ceil(week) : utcMonday(week); week = utcDay$1.offset(week, (d.V - 1) * 7); d.y = week.getUTCFullYear(); d.m = week.getUTCMonth(); d.d = week.getUTCDate() + (d.w + 6) % 7; } else { week = localDate(newDate(d.y, 0, 1)), day2 = week.getDay(); week = day2 > 4 || day2 === 0 ? monday.ceil(week) : monday(week); week = timeDay.offset(week, (d.V - 1) * 7); d.y = week.getFullYear(); d.m = week.getMonth(); d.d = week.getDate() + (d.w + 6) % 7; } } else if ("W" in d || "U" in d) { if (!("w" in d)) d.w = "u" in d ? d.u % 7 : "W" in d ? 1 : 0; day2 = "Z" in d ? utcDate(newDate(d.y, 0, 1)).getUTCDay() : localDate(newDate(d.y, 0, 1)).getDay(); d.m = 0; d.d = "W" in d ? (d.w + 6) % 7 + d.W * 7 - (day2 + 5) % 7 : d.w + d.U * 7 - (day2 + 6) % 7; } if ("Z" in d) { d.H += d.Z / 100 | 0; d.M += d.Z % 100; return utcDate(d); } return localDate(d); }; } function parseSpecifier(d, specifier, string, j) { var i = 0, n = specifier.length, m2 = string.length, c2, parse2; while (i < n) { if (j >= m2) return -1; c2 = specifier.charCodeAt(i++); if (c2 === 37) { c2 = specifier.charAt(i++); parse2 = parses[c2 in pads ? specifier.charAt(i++) : c2]; if (!parse2 || (j = parse2(d, string, j)) < 0) return -1; } else if (c2 != string.charCodeAt(j++)) { return -1; } } return j; } function parsePeriod(d, string, i) { var n = periodRe.exec(string.slice(i)); return n ? (d.p = periodLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } function parseShortWeekday(d, string, i) { var n = shortWeekdayRe.exec(string.slice(i)); return n ? (d.w = shortWeekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } function parseWeekday(d, string, i) { var n = weekdayRe.exec(string.slice(i)); return n ? (d.w = weekdayLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } function parseShortMonth(d, string, i) { var n = shortMonthRe.exec(string.slice(i)); return n ? (d.m = shortMonthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } function parseMonth(d, string, i) { var n = monthRe.exec(string.slice(i)); return n ? (d.m = monthLookup.get(n[0].toLowerCase()), i + n[0].length) : -1; } function parseLocaleDateTime(d, string, i) { return parseSpecifier(d, locale_dateTime, string, i); } function parseLocaleDate(d, string, i) { return parseSpecifier(d, locale_date, string, i); } function parseLocaleTime(d, string, i) { return parseSpecifier(d, locale_time, string, i); } function formatShortWeekday(d) { return locale_shortWeekdays[d.getDay()]; } function formatWeekday(d) { return locale_weekdays[d.getDay()]; } function formatShortMonth(d) { return locale_shortMonths[d.getMonth()]; } function formatMonth(d) { return locale_months[d.getMonth()]; } function formatPeriod(d) { return locale_periods[+(d.getHours() >= 12)]; } function formatQuarter(d) { return 1 + ~~(d.getMonth() / 3); } function formatUTCShortWeekday(d) { return locale_shortWeekdays[d.getUTCDay()]; } function formatUTCWeekday(d) { return locale_weekdays[d.getUTCDay()]; } function formatUTCShortMonth(d) { return locale_shortMonths[d.getUTCMonth()]; } function formatUTCMonth(d) { return locale_months[d.getUTCMonth()]; } function formatUTCPeriod(d) { return locale_periods[+(d.getUTCHours() >= 12)]; } function formatUTCQuarter(d) { return 1 + ~~(d.getUTCMonth() / 3); } return { format: function(specifier) { var f = newFormat(specifier += "", formats); f.toString = function() { return specifier; }; return f; }, parse: function(specifier) { var p = newParse(specifier += "", false); p.toString = function() { return specifier; }; return p; }, utcFormat: function(specifier) { var f = newFormat(specifier += "", utcFormats); f.toString = function() { return specifier; }; return f; }, utcParse: function(specifier) { var p = newParse(specifier += "", true); p.toString = function() { return specifier; }; return p; } }; } var pads = { "-": "", "_": " ", "0": "0" }, numberRe = /^\s*\d+/, percentRe = /^%/, requoteRe = /[\\^$*+?|[\]().{}]/g; function pad(value, fill, width2) { var sign2 = value < 0 ? "-" : "", string = (sign2 ? -value : value) + "", length2 = string.length; return sign2 + (length2 < width2 ? new Array(width2 - length2 + 1).join(fill) + string : string); } function requote(s2) { return s2.replace(requoteRe, "\\$&"); } function formatRe(names) { return new RegExp("^(?:" + names.map(requote).join("|") + ")", "i"); } function formatLookup(names) { return new Map(names.map((name2, i) => [name2.toLowerCase(), i])); } function parseWeekdayNumberSunday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 1)); return n ? (d.w = +n[0], i + n[0].length) : -1; } function parseWeekdayNumberMonday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 1)); return n ? (d.u = +n[0], i + n[0].length) : -1; } function parseWeekNumberSunday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.U = +n[0], i + n[0].length) : -1; } function parseWeekNumberISO(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.V = +n[0], i + n[0].length) : -1; } function parseWeekNumberMonday(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.W = +n[0], i + n[0].length) : -1; } function parseFullYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 4)); return n ? (d.y = +n[0], i + n[0].length) : -1; } function parseYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.y = +n[0] + (+n[0] > 68 ? 1900 : 2e3), i + n[0].length) : -1; } function parseZone(d, string, i) { var n = /^(Z)|([+-]\d\d)(?::?(\d\d))?/.exec(string.slice(i, i + 6)); return n ? (d.Z = n[1] ? 0 : -(n[2] + (n[3] || "00")), i + n[0].length) : -1; } function parseQuarter(d, string, i) { var n = numberRe.exec(string.slice(i, i + 1)); return n ? (d.q = n[0] * 3 - 3, i + n[0].length) : -1; } function parseMonthNumber(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.m = n[0] - 1, i + n[0].length) : -1; } function parseDayOfMonth(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.d = +n[0], i + n[0].length) : -1; } function parseDayOfYear(d, string, i) { var n = numberRe.exec(string.slice(i, i + 3)); return n ? (d.m = 0, d.d = +n[0], i + n[0].length) : -1; } function parseHour24(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.H = +n[0], i + n[0].length) : -1; } function parseMinutes(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.M = +n[0], i + n[0].length) : -1; } function parseSeconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 2)); return n ? (d.S = +n[0], i + n[0].length) : -1; } function parseMilliseconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 3)); return n ? (d.L = +n[0], i + n[0].length) : -1; } function parseMicroseconds(d, string, i) { var n = numberRe.exec(string.slice(i, i + 6)); return n ? (d.L = Math.floor(n[0] / 1e3), i + n[0].length) : -1; } function parseLiteralPercent(d, string, i) { var n = percentRe.exec(string.slice(i, i + 1)); return n ? i + n[0].length : -1; } function parseUnixTimestamp(d, string, i) { var n = numberRe.exec(string.slice(i)); return n ? (d.Q = +n[0], i + n[0].length) : -1; } function parseUnixTimestampSeconds(d, string, i) { var n = numberRe.exec(string.slice(i)); return n ? (d.s = +n[0], i + n[0].length) : -1; } function formatDayOfMonth(d, p) { return pad(d.getDate(), p, 2); } function formatHour24(d, p) { return pad(d.getHours(), p, 2); } function formatHour12(d, p) { return pad(d.getHours() % 12 || 12, p, 2); } function formatDayOfYear(d, p) { return pad(1 + timeDay.count(timeYear(d), d), p, 3); } function formatMilliseconds(d, p) { return pad(d.getMilliseconds(), p, 3); } function formatMicroseconds(d, p) { return formatMilliseconds(d, p) + "000"; } function formatMonthNumber(d, p) { return pad(d.getMonth() + 1, p, 2); } function formatMinutes(d, p) { return pad(d.getMinutes(), p, 2); } function formatSeconds(d, p) { return pad(d.getSeconds(), p, 2); } function formatWeekdayNumberMonday(d) { var day2 = d.getDay(); return day2 === 0 ? 7 : day2; } function formatWeekNumberSunday(d, p) { return pad(sunday.count(timeYear(d) - 1, d), p, 2); } function dISO(d) { var day2 = d.getDay(); return day2 >= 4 || day2 === 0 ? thursday(d) : thursday.ceil(d); } function formatWeekNumberISO(d, p) { d = dISO(d); return pad(thursday.count(timeYear(d), d) + (timeYear(d).getDay() === 4), p, 2); } function formatWeekdayNumberSunday(d) { return d.getDay(); } function formatWeekNumberMonday(d, p) { return pad(monday.count(timeYear(d) - 1, d), p, 2); } function formatYear(d, p) { return pad(d.getFullYear() % 100, p, 2); } function formatYearISO(d, p) { d = dISO(d); return pad(d.getFullYear() % 100, p, 2); } function formatFullYear(d, p) { return pad(d.getFullYear() % 1e4, p, 4); } function formatFullYearISO(d, p) { var day2 = d.getDay(); d = day2 >= 4 || day2 === 0 ? thursday(d) : thursday.ceil(d); return pad(d.getFullYear() % 1e4, p, 4); } function formatZone(d) { var z = d.getTimezoneOffset(); return (z > 0 ? "-" : (z *= -1, "+")) + pad(z / 60 | 0, "0", 2) + pad(z % 60, "0", 2); } function formatUTCDayOfMonth(d, p) { return pad(d.getUTCDate(), p, 2); } function formatUTCHour24(d, p) { return pad(d.getUTCHours(), p, 2); } function formatUTCHour12(d, p) { return pad(d.getUTCHours() % 12 || 12, p, 2); } function formatUTCDayOfYear(d, p) { return pad(1 + utcDay$1.count(utcYear$1(d), d), p, 3); } function formatUTCMilliseconds(d, p) { return pad(d.getUTCMilliseconds(), p, 3); } function formatUTCMicroseconds(d, p) { return formatUTCMilliseconds(d, p) + "000"; } function formatUTCMonthNumber(d, p) { return pad(d.getUTCMonth() + 1, p, 2); } function formatUTCMinutes(d, p) { return pad(d.getUTCMinutes(), p, 2); } function formatUTCSeconds(d, p) { return pad(d.getUTCSeconds(), p, 2); } function formatUTCWeekdayNumberMonday(d) { var dow = d.getUTCDay(); return dow === 0 ? 7 : dow; } function formatUTCWeekNumberSunday(d, p) { return pad(utcSunday.count(utcYear$1(d) - 1, d), p, 2); } function UTCdISO(d) { var day2 = d.getUTCDay(); return day2 >= 4 || day2 === 0 ? utcThursday(d) : utcThursday.ceil(d); } function formatUTCWeekNumberISO(d, p) { d = UTCdISO(d); return pad(utcThursday.count(utcYear$1(d), d) + (utcYear$1(d).getUTCDay() === 4), p, 2); } function formatUTCWeekdayNumberSunday(d) { return d.getUTCDay(); } function formatUTCWeekNumberMonday(d, p) { return pad(utcMonday.count(utcYear$1(d) - 1, d), p, 2); } function formatUTCYear(d, p) { return pad(d.getUTCFullYear() % 100, p, 2); } function formatUTCYearISO(d, p) { d = UTCdISO(d); return pad(d.getUTCFullYear() % 100, p, 2); } function formatUTCFullYear(d, p) { return pad(d.getUTCFullYear() % 1e4, p, 4); } function formatUTCFullYearISO(d, p) { var day2 = d.getUTCDay(); d = day2 >= 4 || day2 === 0 ? utcThursday(d) : utcThursday.ceil(d); return pad(d.getUTCFullYear() % 1e4, p, 4); } function formatUTCZone() { return "+0000"; } function formatLiteralPercent() { return "%"; } function formatUnixTimestamp(d) { return +d; } function formatUnixTimestampSeconds(d) { return Math.floor(+d / 1e3); } var locale; var timeFormat; var timeParse; var utcFormat; var utcParse; defaultLocale({ dateTime: "%x, %X", date: "%-m/%-d/%Y", time: "%-I:%M:%S %p", periods: ["AM", "PM"], days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], shortDays: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], shortMonths: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"] }); function defaultLocale(definition) { locale = formatLocale(definition); timeFormat = locale.format; timeParse = locale.parse; utcFormat = locale.utcFormat; utcParse = locale.utcParse; return locale; } var isoSpecifier = "%Y-%m-%dT%H:%M:%S.%LZ"; function formatIsoNative(date2) { return date2.toISOString(); } var formatIso = Date.prototype.toISOString ? formatIsoNative : utcFormat(isoSpecifier); const formatIso$1 = formatIso; function parseIsoNative(string) { var date2 = new Date(string); return isNaN(date2) ? null : date2; } var parseIso = +new Date("2000-01-01T00:00:00.000Z") ? parseIsoNative : utcParse(isoSpecifier); const parseIso$1 = parseIso; function date(t) { return new Date(t); } function number(t) { return t instanceof Date ? +t : +new Date(+t); } function calendar(ticks2, tickInterval, year2, month2, week, day2, hour2, minute2, second2, format2) { var scale = continuous(), invert2 = scale.invert, domain = scale.domain; var formatMillisecond = format2(".%L"), formatSecond = format2(":%S"), formatMinute = format2("%I:%M"), formatHour = format2("%I %p"), formatDay = format2("%a %d"), formatWeek = format2("%b %d"), formatMonth = format2("%B"), formatYear2 = format2("%Y"); function tickFormat2(date2) { return (second2(date2) < date2 ? formatMillisecond : minute2(date2) < date2 ? formatSecond : hour2(date2) < date2 ? formatMinute : day2(date2) < date2 ? formatHour : month2(date2) < date2 ? week(date2) < date2 ? formatDay : formatWeek : year2(date2) < date2 ? formatMonth : formatYear2)(date2); } scale.invert = function(y2) { return new Date(invert2(y2)); }; scale.domain = function(_2) { return arguments.length ? domain(Array.from(_2, number)) : domain().map(date); }; scale.ticks = function(interval2) { var d = domain(); return ticks2(d[0], d[d.length - 1], interval2 == null ? 10 : interval2); }; scale.tickFormat = function(count2, specifier) { return specifier == null ? tickFormat2 : format2(specifier); }; scale.nice = function(interval2) { var d = domain(); if (!interval2 || typeof interval2.range !== "function") interval2 = tickInterval(d[0], d[d.length - 1], interval2 == null ? 10 : interval2); return interval2 ? domain(nice(d, interval2)) : scale; }; scale.copy = function() { return copy$2(scale, calendar(ticks2, tickInterval, year2, month2, week, day2, hour2, minute2, second2, format2)); }; return scale; } function time() { return initRange.apply(calendar(timeTicks, timeTickInterval, timeYear, timeMonth, sunday, timeDay, timeHour, timeMinute, utcSecond, timeFormat).domain([new Date(2e3, 0, 1), new Date(2e3, 0, 2)]), arguments); } function utcTime() { return initRange.apply(calendar(utcTicks, utcTickInterval, utcYear$1, utcMonth$1, utcSunday, utcDay$1, utcHour$1, utcMinute$1, utcSecond, utcFormat).domain([Date.UTC(2e3, 0, 1), Date.UTC(2e3, 0, 2)]), arguments); } function transformer$1() { var x02 = 0, x12 = 1, t02, t12, k10, transform2, interpolator = identity$3, clamp = false, unknown; function scale(x2) { return x2 == null || isNaN(x2 = +x2) ? unknown : interpolator(k10 === 0 ? 0.5 : (x2 = (transform2(x2) - t02) * k10, clamp ? Math.max(0, Math.min(1, x2)) : x2)); } scale.domain = function(_2) { return arguments.length ? ([x02, x12] = _2, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02), scale) : [x02, x12]; }; scale.clamp = function(_2) { return arguments.length ? (clamp = !!_2, scale) : clamp; }; scale.interpolator = function(_2) { return arguments.length ? (interpolator = _2, scale) : interpolator; }; function range2(interpolate2) { return function(_2) { var r0, r1; return arguments.length ? ([r0, r1] = _2, interpolator = interpolate2(r0, r1), scale) : [interpolator(0), interpolator(1)]; }; } scale.range = range2(interpolate$2); scale.rangeRound = range2(interpolateRound); scale.unknown = function(_2) { return arguments.length ? (unknown = _2, scale) : unknown; }; return function(t) { transform2 = t, t02 = t(x02), t12 = t(x12), k10 = t02 === t12 ? 0 : 1 / (t12 - t02); return scale; }; } function copy$1(source, target) { return target.domain(source.domain()).interpolator(source.interpolator()).clamp(source.clamp()).unknown(source.unknown()); } function sequential() { var scale = linearish(transformer$1()(identity$3)); scale.copy = function() { return copy$1(scale, sequential()); }; return initInterpolator.apply(scale, arguments); } function sequentialLog() { var scale = loggish(transformer$1()).domain([1, 10]); scale.copy = function() { return copy$1(scale, sequentialLog()).base(scale.base()); }; return initInterpolator.apply(scale, arguments); } function sequentialSymlog() { var scale = symlogish(transformer$1()); scale.copy = function() { return copy$1(scale, sequentialSymlog()).constant(scale.constant()); }; return initInterpolator.apply(scale, arguments); } function sequentialPow() { var scale = powish(transformer$1()); scale.copy = function() { return copy$1(scale, sequentialPow()).exponent(scale.exponent()); }; return initInterpolator.apply(scale, arguments); } function sequentialSqrt() { return sequentialPow.apply(null, arguments).exponent(0.5); } function sequentialQuantile() { var domain = [], interpolator = identity$3; function scale(x2) { if (x2 != null && !isNaN(x2 = +x2)) return interpolator((bisect(domain, x2, 1) - 1) / (domain.length - 1)); } scale.domain = function(_2) { if (!arguments.length) return domain.slice(); domain = []; for (let d of _2) if (d != null && !isNaN(d = +d)) domain.push(d); domain.sort(ascending$3); return scale; }; scale.interpolator = function(_2) { return arguments.length ? (interpolator = _2, scale) : interpolator; }; scale.range = function() { return domain.map((d, i) => interpolator(i / (domain.length - 1))); }; scale.quantiles = function(n) { return Array.from({ length: n + 1 }, (_2, i) => quantile$1(domain, i / n)); }; scale.copy = function() { return sequentialQuantile(interpolator).domain(domain); }; return initInterpolator.apply(scale, arguments); } function transformer() { var x02 = 0, x12 = 0.5, x2 = 1, s2 = 1, t02, t12, t22, k10, k21, interpolator = identity$3, transform2, clamp = false, unknown; function scale(x3) { return isNaN(x3 = +x3) ? unknown : (x3 = 0.5 + ((x3 = +transform2(x3)) - t12) * (s2 * x3 < s2 * t12 ? k10 : k21), interpolator(clamp ? Math.max(0, Math.min(1, x3)) : x3)); } scale.domain = function(_2) { return arguments.length ? ([x02, x12, x2] = _2, t02 = transform2(x02 = +x02), t12 = transform2(x12 = +x12), t22 = transform2(x2 = +x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s2 = t12 < t02 ? -1 : 1, scale) : [x02, x12, x2]; }; scale.clamp = function(_2) { return arguments.length ? (clamp = !!_2, scale) : clamp; }; scale.interpolator = function(_2) { return arguments.length ? (interpolator = _2, scale) : interpolator; }; function range2(interpolate2) { return function(_2) { var r0, r1, r2; return arguments.length ? ([r0, r1, r2] = _2, interpolator = piecewise(interpolate2, [r0, r1, r2]), scale) : [interpolator(0), interpolator(0.5), interpolator(1)]; }; } scale.range = range2(interpolate$2); scale.rangeRound = range2(interpolateRound); scale.unknown = function(_2) { return arguments.length ? (unknown = _2, scale) : unknown; }; return function(t) { transform2 = t, t02 = t(x02), t12 = t(x12), t22 = t(x2), k10 = t02 === t12 ? 0 : 0.5 / (t12 - t02), k21 = t12 === t22 ? 0 : 0.5 / (t22 - t12), s2 = t12 < t02 ? -1 : 1; return scale; }; } function diverging$1() { var scale = linearish(transformer()(identity$3)); scale.copy = function() { return copy$1(scale, diverging$1()); }; return initInterpolator.apply(scale, arguments); } function divergingLog() { var scale = loggish(transformer()).domain([0.1, 1, 10]); scale.copy = function() { return copy$1(scale, divergingLog()).base(scale.base()); }; return initInterpolator.apply(scale, arguments); } function divergingSymlog() { var scale = symlogish(transformer()); scale.copy = function() { return copy$1(scale, divergingSymlog()).constant(scale.constant()); }; return initInterpolator.apply(scale, arguments); } function divergingPow() { var scale = powish(transformer()); scale.copy = function() { return copy$1(scale, divergingPow()).exponent(scale.exponent()); }; return initInterpolator.apply(scale, arguments); } function divergingSqrt() { return divergingPow.apply(null, arguments).exponent(0.5); } function colors(specifier) { var n = specifier.length / 6 | 0, colors2 = new Array(n), i = 0; while (i < n) colors2[i] = "#" + specifier.slice(i * 6, ++i * 6); return colors2; } const category10 = colors("1f77b4ff7f0e2ca02cd627289467bd8c564be377c27f7f7fbcbd2217becf"); const Accent = colors("7fc97fbeaed4fdc086ffff99386cb0f0027fbf5b17666666"); const Dark2 = colors("1b9e77d95f027570b3e7298a66a61ee6ab02a6761d666666"); const Paired = colors("a6cee31f78b4b2df8a33a02cfb9a99e31a1cfdbf6fff7f00cab2d66a3d9affff99b15928"); const Pastel1 = colors("fbb4aeb3cde3ccebc5decbe4fed9a6ffffcce5d8bdfddaecf2f2f2"); const Pastel2 = colors("b3e2cdfdcdaccbd5e8f4cae4e6f5c9fff2aef1e2cccccccc"); const Set1 = colors("e41a1c377eb84daf4a984ea3ff7f00ffff33a65628f781bf999999"); const Set2 = colors("66c2a5fc8d628da0cbe78ac3a6d854ffd92fe5c494b3b3b3"); const Set3 = colors("8dd3c7ffffb3bebadafb807280b1d3fdb462b3de69fccde5d9d9d9bc80bdccebc5ffed6f"); const Tableau10 = colors("4e79a7f28e2ce1575976b7b259a14fedc949af7aa1ff9da79c755fbab0ab"); const ramp$1 = (scheme2) => rgbBasis(scheme2[scheme2.length - 1]); var scheme$q = new Array(3).concat( "d8b365f5f5f55ab4ac", "a6611adfc27d80cdc1018571", "a6611adfc27df5f5f580cdc1018571", "8c510ad8b365f6e8c3c7eae55ab4ac01665e", "8c510ad8b365f6e8c3f5f5f5c7eae55ab4ac01665e", "8c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e", "8c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e", "5430058c510abf812ddfc27df6e8c3c7eae580cdc135978f01665e003c30", "5430058c510abf812ddfc27df6e8c3f5f5f5c7eae580cdc135978f01665e003c30" ).map(colors); const BrBG = ramp$1(scheme$q); var scheme$p = new Array(3).concat( "af8dc3f7f7f77fbf7b", "7b3294c2a5cfa6dba0008837", "7b3294c2a5cff7f7f7a6dba0008837", "762a83af8dc3e7d4e8d9f0d37fbf7b1b7837", "762a83af8dc3e7d4e8f7f7f7d9f0d37fbf7b1b7837", "762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b7837", "762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b7837", "40004b762a839970abc2a5cfe7d4e8d9f0d3a6dba05aae611b783700441b", "40004b762a839970abc2a5cfe7d4e8f7f7f7d9f0d3a6dba05aae611b783700441b" ).map(colors); const PRGn = ramp$1(scheme$p); var scheme$o = new Array(3).concat( "e9a3c9f7f7f7a1d76a", "d01c8bf1b6dab8e1864dac26", "d01c8bf1b6daf7f7f7b8e1864dac26", "c51b7de9a3c9fde0efe6f5d0a1d76a4d9221", "c51b7de9a3c9fde0eff7f7f7e6f5d0a1d76a4d9221", "c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221", "c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221", "8e0152c51b7dde77aef1b6dafde0efe6f5d0b8e1867fbc414d9221276419", "8e0152c51b7dde77aef1b6dafde0eff7f7f7e6f5d0b8e1867fbc414d9221276419" ).map(colors); const PiYG = ramp$1(scheme$o); var scheme$n = new Array(3).concat( "998ec3f7f7f7f1a340", "5e3c99b2abd2fdb863e66101", "5e3c99b2abd2f7f7f7fdb863e66101", "542788998ec3d8daebfee0b6f1a340b35806", "542788998ec3d8daebf7f7f7fee0b6f1a340b35806", "5427888073acb2abd2d8daebfee0b6fdb863e08214b35806", "5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b35806", "2d004b5427888073acb2abd2d8daebfee0b6fdb863e08214b358067f3b08", "2d004b5427888073acb2abd2d8daebf7f7f7fee0b6fdb863e08214b358067f3b08" ).map(colors); const PuOr = ramp$1(scheme$n); var scheme$m = new Array(3).concat( "ef8a62f7f7f767a9cf", "ca0020f4a58292c5de0571b0", "ca0020f4a582f7f7f792c5de0571b0", "b2182bef8a62fddbc7d1e5f067a9cf2166ac", "b2182bef8a62fddbc7f7f7f7d1e5f067a9cf2166ac", "b2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac", "b2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac", "67001fb2182bd6604df4a582fddbc7d1e5f092c5de4393c32166ac053061", "67001fb2182bd6604df4a582fddbc7f7f7f7d1e5f092c5de4393c32166ac053061" ).map(colors); const RdBu = ramp$1(scheme$m); var scheme$l = new Array(3).concat( "ef8a62ffffff999999", "ca0020f4a582bababa404040", "ca0020f4a582ffffffbababa404040", "b2182bef8a62fddbc7e0e0e09999994d4d4d", "b2182bef8a62fddbc7ffffffe0e0e09999994d4d4d", "b2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d", "b2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d", "67001fb2182bd6604df4a582fddbc7e0e0e0bababa8787874d4d4d1a1a1a", "67001fb2182bd6604df4a582fddbc7ffffffe0e0e0bababa8787874d4d4d1a1a1a" ).map(colors); const RdGy = ramp$1(scheme$l); var scheme$k = new Array(3).concat( "fc8d59ffffbf91bfdb", "d7191cfdae61abd9e92c7bb6", "d7191cfdae61ffffbfabd9e92c7bb6", "d73027fc8d59fee090e0f3f891bfdb4575b4", "d73027fc8d59fee090ffffbfe0f3f891bfdb4575b4", "d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4", "d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4", "a50026d73027f46d43fdae61fee090e0f3f8abd9e974add14575b4313695", "a50026d73027f46d43fdae61fee090ffffbfe0f3f8abd9e974add14575b4313695" ).map(colors); const RdYlBu = ramp$1(scheme$k); var scheme$j = new Array(3).concat( "fc8d59ffffbf91cf60", "d7191cfdae61a6d96a1a9641", "d7191cfdae61ffffbfa6d96a1a9641", "d73027fc8d59fee08bd9ef8b91cf601a9850", "d73027fc8d59fee08bffffbfd9ef8b91cf601a9850", "d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850", "d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850", "a50026d73027f46d43fdae61fee08bd9ef8ba6d96a66bd631a9850006837", "a50026d73027f46d43fdae61fee08bffffbfd9ef8ba6d96a66bd631a9850006837" ).map(colors); const RdYlGn = ramp$1(scheme$j); var scheme$i = new Array(3).concat( "fc8d59ffffbf99d594", "d7191cfdae61abdda42b83ba", "d7191cfdae61ffffbfabdda42b83ba", "d53e4ffc8d59fee08be6f59899d5943288bd", "d53e4ffc8d59fee08bffffbfe6f59899d5943288bd", "d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd", "d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd", "9e0142d53e4ff46d43fdae61fee08be6f598abdda466c2a53288bd5e4fa2", "9e0142d53e4ff46d43fdae61fee08bffffbfe6f598abdda466c2a53288bd5e4fa2" ).map(colors); const Spectral = ramp$1(scheme$i); var scheme$h = new Array(3).concat( "e5f5f999d8c92ca25f", "edf8fbb2e2e266c2a4238b45", "edf8fbb2e2e266c2a42ca25f006d2c", "edf8fbccece699d8c966c2a42ca25f006d2c", "edf8fbccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45005824", "f7fcfde5f5f9ccece699d8c966c2a441ae76238b45006d2c00441b" ).map(colors); const BuGn = ramp$1(scheme$h); var scheme$g = new Array(3).concat( "e0ecf49ebcda8856a7", "edf8fbb3cde38c96c688419d", "edf8fbb3cde38c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68856a7810f7c", "edf8fbbfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d6e016b", "f7fcfde0ecf4bfd3e69ebcda8c96c68c6bb188419d810f7c4d004b" ).map(colors); const BuPu = ramp$1(scheme$g); var scheme$f = new Array(3).concat( "e0f3dba8ddb543a2ca", "f0f9e8bae4bc7bccc42b8cbe", "f0f9e8bae4bc7bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc443a2ca0868ac", "f0f9e8ccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe08589e", "f7fcf0e0f3dbccebc5a8ddb57bccc44eb3d32b8cbe0868ac084081" ).map(colors); const GnBu = ramp$1(scheme$f); var scheme$e = new Array(3).concat( "fee8c8fdbb84e34a33", "fef0d9fdcc8afc8d59d7301f", "fef0d9fdcc8afc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59e34a33b30000", "fef0d9fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301f990000", "fff7ecfee8c8fdd49efdbb84fc8d59ef6548d7301fb300007f0000" ).map(colors); const OrRd = ramp$1(scheme$e); var scheme$d = new Array(3).concat( "ece2f0a6bddb1c9099", "f6eff7bdc9e167a9cf02818a", "f6eff7bdc9e167a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf1c9099016c59", "f6eff7d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016450", "fff7fbece2f0d0d1e6a6bddb67a9cf3690c002818a016c59014636" ).map(colors); const PuBuGn = ramp$1(scheme$d); var scheme$c = new Array(3).concat( "ece7f2a6bddb2b8cbe", "f1eef6bdc9e174a9cf0570b0", "f1eef6bdc9e174a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf2b8cbe045a8d", "f1eef6d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0034e7b", "fff7fbece7f2d0d1e6a6bddb74a9cf3690c00570b0045a8d023858" ).map(colors); const PuBu = ramp$1(scheme$c); var scheme$b = new Array(3).concat( "e7e1efc994c7dd1c77", "f1eef6d7b5d8df65b0ce1256", "f1eef6d7b5d8df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0dd1c77980043", "f1eef6d4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125691003f", "f7f4f9e7e1efd4b9dac994c7df65b0e7298ace125698004367001f" ).map(colors); const PuRd = ramp$1(scheme$b); var scheme$a = new Array(3).concat( "fde0ddfa9fb5c51b8a", "feebe2fbb4b9f768a1ae017e", "feebe2fbb4b9f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1c51b8a7a0177", "feebe2fcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a0177", "fff7f3fde0ddfcc5c0fa9fb5f768a1dd3497ae017e7a017749006a" ).map(colors); const RdPu = ramp$1(scheme$a); var scheme$9 = new Array(3).concat( "edf8b17fcdbb2c7fb8", "ffffcca1dab441b6c4225ea8", "ffffcca1dab441b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c42c7fb8253494", "ffffccc7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea80c2c84", "ffffd9edf8b1c7e9b47fcdbb41b6c41d91c0225ea8253494081d58" ).map(colors); const YlGnBu = ramp$1(scheme$9); var scheme$8 = new Array(3).concat( "f7fcb9addd8e31a354", "ffffccc2e69978c679238443", "ffffccc2e69978c67931a354006837", "ffffccd9f0a3addd8e78c67931a354006837", "ffffccd9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443005a32", "ffffe5f7fcb9d9f0a3addd8e78c67941ab5d238443006837004529" ).map(colors); const YlGn = ramp$1(scheme$8); var scheme$7 = new Array(3).concat( "fff7bcfec44fd95f0e", "ffffd4fed98efe9929cc4c02", "ffffd4fed98efe9929d95f0e993404", "ffffd4fee391fec44ffe9929d95f0e993404", "ffffd4fee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c028c2d04", "ffffe5fff7bcfee391fec44ffe9929ec7014cc4c02993404662506" ).map(colors); const YlOrBr = ramp$1(scheme$7); var scheme$6 = new Array(3).concat( "ffeda0feb24cf03b20", "ffffb2fecc5cfd8d3ce31a1c", "ffffb2fecc5cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cf03b20bd0026", "ffffb2fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cb10026", "ffffccffeda0fed976feb24cfd8d3cfc4e2ae31a1cbd0026800026" ).map(colors); const YlOrRd = ramp$1(scheme$6); var scheme$5 = new Array(3).concat( "deebf79ecae13182bd", "eff3ffbdd7e76baed62171b5", "eff3ffbdd7e76baed63182bd08519c", "eff3ffc6dbef9ecae16baed63182bd08519c", "eff3ffc6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b5084594", "f7fbffdeebf7c6dbef9ecae16baed64292c62171b508519c08306b" ).map(colors); const Blues = ramp$1(scheme$5); var scheme$4 = new Array(3).concat( "e5f5e0a1d99b31a354", "edf8e9bae4b374c476238b45", "edf8e9bae4b374c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47631a354006d2c", "edf8e9c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45005a32", "f7fcf5e5f5e0c7e9c0a1d99b74c47641ab5d238b45006d2c00441b" ).map(colors); const Greens = ramp$1(scheme$4); var scheme$3 = new Array(3).concat( "f0f0f0bdbdbd636363", "f7f7f7cccccc969696525252", "f7f7f7cccccc969696636363252525", "f7f7f7d9d9d9bdbdbd969696636363252525", "f7f7f7d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525", "fffffff0f0f0d9d9d9bdbdbd969696737373525252252525000000" ).map(colors); const Greys = ramp$1(scheme$3); var scheme$2 = new Array(3).concat( "efedf5bcbddc756bb1", "f2f0f7cbc9e29e9ac86a51a3", "f2f0f7cbc9e29e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8756bb154278f", "f2f0f7dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a34a1486", "fcfbfdefedf5dadaebbcbddc9e9ac8807dba6a51a354278f3f007d" ).map(colors); const Purples = ramp$1(scheme$2); var scheme$1 = new Array(3).concat( "fee0d2fc9272de2d26", "fee5d9fcae91fb6a4acb181d", "fee5d9fcae91fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4ade2d26a50f15", "fee5d9fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181d99000d", "fff5f0fee0d2fcbba1fc9272fb6a4aef3b2ccb181da50f1567000d" ).map(colors); const Reds = ramp$1(scheme$1); var scheme = new Array(3).concat( "fee6cefdae6be6550d", "feeddefdbe85fd8d3cd94701", "feeddefdbe85fd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3ce6550da63603", "feeddefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d948018c2d04", "fff5ebfee6cefdd0a2fdae6bfd8d3cf16913d94801a636037f2704" ).map(colors); const Oranges = ramp$1(scheme); function cividis(t) { t = Math.max(0, Math.min(1, t)); return "rgb(" + Math.max(0, Math.min(255, Math.round(-4.54 - t * (35.34 - t * (2381.73 - t * (6402.7 - t * (7024.72 - t * 2710.57))))))) + ", " + Math.max(0, Math.min(255, Math.round(32.49 + t * (170.73 + t * (52.82 - t * (131.46 - t * (176.58 - t * 67.37))))))) + ", " + Math.max(0, Math.min(255, Math.round(81.24 + t * (442.36 - t * (2482.43 - t * (6167.24 - t * (6614.94 - t * 2475.67))))))) + ")"; } const cubehelix = cubehelixLong(cubehelix$3(300, 0.5, 0), cubehelix$3(-240, 0.5, 1)); var warm = cubehelixLong(cubehelix$3(-100, 0.75, 0.35), cubehelix$3(80, 1.5, 0.8)); var cool = cubehelixLong(cubehelix$3(260, 0.75, 0.35), cubehelix$3(80, 1.5, 0.8)); var c$3 = cubehelix$3(); function rainbow(t) { if (t < 0 || t > 1) t -= Math.floor(t); var ts = Math.abs(t - 0.5); c$3.h = 360 * t - 100; c$3.s = 1.5 - 1.5 * ts; c$3.l = 0.8 - 0.9 * ts; return c$3 + ""; } var c$2 = rgb(), pi_1_3 = Math.PI / 3, pi_2_3 = Math.PI * 2 / 3; function sinebow(t) { var x2; t = (0.5 - t) * Math.PI; c$2.r = 255 * (x2 = Math.sin(t)) * x2; c$2.g = 255 * (x2 = Math.sin(t + pi_1_3)) * x2; c$2.b = 255 * (x2 = Math.sin(t + pi_2_3)) * x2; return c$2 + ""; } function turbo(t) { t = Math.max(0, Math.min(1, t)); return "rgb(" + Math.max(0, Math.min(255, Math.round(34.61 + t * (1172.33 - t * (10793.56 - t * (33300.12 - t * (38394.49 - t * 14825.05))))))) + ", " + Math.max(0, Math.min(255, Math.round(23.31 + t * (557.33 + t * (1225.33 - t * (3574.96 - t * (1073.77 + t * 707.56))))))) + ", " + Math.max(0, Math.min(255, Math.round(27.2 + t * (3211.1 - t * (15327.97 - t * (27814 - t * (22569.18 - t * 6838.66))))))) + ")"; } function ramp(range2) { var n = range2.length; return function(t) { return range2[Math.max(0, Math.min(n - 1, Math.floor(t * n)))]; }; } const viridis = ramp(colors("44015444025645045745055946075a46085c460a5d460b5e470d60470e6147106347116447136548146748166848176948186a481a6c481b6d481c6e481d6f481f70482071482173482374482475482576482677482878482979472a7a472c7a472d7b472e7c472f7d46307e46327e46337f463480453581453781453882443983443a83443b84433d84433e85423f854240864241864142874144874045884046883f47883f48893e49893e4a893e4c8a3d4d8a3d4e8a3c4f8a3c508b3b518b3b528b3a538b3a548c39558c39568c38588c38598c375a8c375b8d365c8d365d8d355e8d355f8d34608d34618d33628d33638d32648e32658e31668e31678e31688e30698e306a8e2f6b8e2f6c8e2e6d8e2e6e8e2e6f8e2d708e2d718e2c718e2c728e2c738e2b748e2b758e2a768e2a778e2a788e29798e297a8e297b8e287c8e287d8e277e8e277f8e27808e26818e26828e26828e25838e25848e25858e24868e24878e23888e23898e238a8d228b8d228c8d228d8d218e8d218f8d21908d21918c20928c20928c20938c1f948c1f958b1f968b1f978b1f988b1f998a1f9a8a1e9b8a1e9c891e9d891f9e891f9f881fa0881fa1881fa1871fa28720a38620a48621a58521a68522a78522a88423a98324aa8325ab8225ac8226ad8127ad8128ae8029af7f2ab07f2cb17e2db27d2eb37c2fb47c31b57b32b67a34b67935b77937b87838b9773aba763bbb753dbc743fbc7340bd7242be7144bf7046c06f48c16e4ac16d4cc26c4ec36b50c46a52c56954c56856c66758c7655ac8645cc8635ec96260ca6063cb5f65cb5e67cc5c69cd5b6ccd5a6ece5870cf5773d05675d05477d1537ad1517cd2507fd34e81d34d84d44b86d54989d5488bd6468ed64590d74393d74195d84098d83e9bd93c9dd93ba0da39a2da37a5db36a8db34aadc32addc30b0dd2fb2dd2db5de2bb8de29bade28bddf26c0df25c2df23c5e021c8e020cae11fcde11dd0e11cd2e21bd5e21ad8e219dae319dde318dfe318e2e418e5e419e7e419eae51aece51befe51cf1e51df4e61ef6e620f8e621fbe723fde725")); var magma = ramp(colors("00000401000501010601010802010902020b02020d03030f03031204041405041606051806051a07061c08071e0907200a08220b09240c09260d0a290e0b2b100b2d110c2f120d31130d34140e36150e38160f3b180f3d19103f1a10421c10441d11471e114920114b21114e22115024125325125527125829115a2a115c2c115f2d11612f116331116533106734106936106b38106c390f6e3b0f703d0f713f0f72400f74420f75440f764510774710784910784a10794c117a4e117b4f127b51127c52137c54137d56147d57157e59157e5a167e5c167f5d177f5f187f601880621980641a80651a80671b80681c816a1c816b1d816d1d816e1e81701f81721f817320817521817621817822817922827b23827c23827e24828025828125818326818426818627818827818928818b29818c29818e2a81902a81912b81932b80942c80962c80982d80992d809b2e7f9c2e7f9e2f7fa02f7fa1307ea3307ea5317ea6317da8327daa337dab337cad347cae347bb0357bb2357bb3367ab5367ab73779b83779ba3878bc3978bd3977bf3a77c03a76c23b75c43c75c53c74c73d73c83e73ca3e72cc3f71cd4071cf4070d0416fd2426fd3436ed5446dd6456cd8456cd9466bdb476adc4869de4968df4a68e04c67e24d66e34e65e44f64e55064e75263e85362e95462ea5661eb5760ec5860ed5a5fee5b5eef5d5ef05f5ef1605df2625df2645cf3655cf4675cf4695cf56b5cf66c5cf66e5cf7705cf7725cf8745cf8765cf9785df9795df97b5dfa7d5efa7f5efa815ffb835ffb8560fb8761fc8961fc8a62fc8c63fc8e64fc9065fd9266fd9467fd9668fd9869fd9a6afd9b6bfe9d6cfe9f6dfea16efea36ffea571fea772fea973feaa74feac76feae77feb078feb27afeb47bfeb67cfeb77efeb97ffebb81febd82febf84fec185fec287fec488fec68afec88cfeca8dfecc8ffecd90fecf92fed194fed395fed597fed799fed89afdda9cfddc9efddea0fde0a1fde2a3fde3a5fde5a7fde7a9fde9aafdebacfcecaefceeb0fcf0b2fcf2b4fcf4b6fcf6b8fcf7b9fcf9bbfcfbbdfcfdbf")); var inferno = ramp(colors("00000401000501010601010802010a02020c02020e03021004031204031405041706041907051b08051d09061f0a07220b07240c08260d08290e092b10092d110a30120a32140b34150b37160b39180c3c190c3e1b0c411c0c431e0c451f0c48210c4a230c4c240c4f260c51280b53290b552b0b572d0b592f0a5b310a5c320a5e340a5f3609613809623909633b09643d09653e0966400a67420a68440a68450a69470b6a490b6a4a0c6b4c0c6b4d0d6c4f0d6c510e6c520e6d540f6d550f6d57106e59106e5a116e5c126e5d126e5f136e61136e62146e64156e65156e67166e69166e6a176e6c186e6d186e6f196e71196e721a6e741a6e751b6e771c6d781c6d7a1d6d7c1d6d7d1e6d7f1e6c801f6c82206c84206b85216b87216b88226a8a226a8c23698d23698f24699025689225689326679526679727669827669a28659b29649d29649f2a63a02a63a22b62a32c61a52c60a62d60a82e5fa92e5eab2f5ead305dae305cb0315bb1325ab3325ab43359b63458b73557b93556ba3655bc3754bd3853bf3952c03a51c13a50c33b4fc43c4ec63d4dc73e4cc83f4bca404acb4149cc4248ce4347cf4446d04545d24644d34743d44842d54a41d74b3fd84c3ed94d3dda4e3cdb503bdd513ade5238df5337e05536e15635e25734e35933e45a31e55c30e65d2fe75e2ee8602de9612bea632aeb6429eb6628ec6726ed6925ee6a24ef6c23ef6e21f06f20f1711ff1731df2741cf3761bf37819f47918f57b17f57d15f67e14f68013f78212f78410f8850ff8870ef8890cf98b0bf98c0af98e09fa9008fa9207fa9407fb9606fb9706fb9906fb9b06fb9d07fc9f07fca108fca309fca50afca60cfca80dfcaa0ffcac11fcae12fcb014fcb216fcb418fbb61afbb81dfbba1ffbbc21fbbe23fac026fac228fac42afac62df9c72ff9c932f9cb35f8cd37f8cf3af7d13df7d340f6d543f6d746f5d949f5db4cf4dd4ff4df53f4e156f3e35af3e55df2e661f2e865f2ea69f1ec6df1ed71f1ef75f1f179f2f27df2f482f3f586f3f68af4f88ef5f992f6fa96f8fb9af9fc9dfafda1fcffa4")); var plasma = ramp(colors("0d088710078813078916078a19068c1b068d1d068e20068f2206902406912605912805922a05932c05942e05952f059631059733059735049837049938049a3a049a3c049b3e049c3f049c41049d43039e44039e46039f48039f4903a04b03a14c02a14e02a25002a25102a35302a35502a45601a45801a45901a55b01a55c01a65e01a66001a66100a76300a76400a76600a76700a86900a86a00a86c00a86e00a86f00a87100a87201a87401a87501a87701a87801a87a02a87b02a87d03a87e03a88004a88104a78305a78405a78606a68707a68808a68a09a58b0aa58d0ba58e0ca48f0da4910ea3920fa39410a29511a19613a19814a099159f9a169f9c179e9d189d9e199da01a9ca11b9ba21d9aa31e9aa51f99a62098a72197a82296aa2395ab2494ac2694ad2793ae2892b02991b12a90b22b8fb32c8eb42e8db52f8cb6308bb7318ab83289ba3388bb3488bc3587bd3786be3885bf3984c03a83c13b82c23c81c33d80c43e7fc5407ec6417dc7427cc8437bc9447aca457acb4679cc4778cc4977cd4a76ce4b75cf4c74d04d73d14e72d24f71d35171d45270d5536fd5546ed6556dd7566cd8576bd9586ada5a6ada5b69db5c68dc5d67dd5e66de5f65de6164df6263e06363e16462e26561e26660e3685fe4695ee56a5de56b5de66c5ce76e5be76f5ae87059e97158e97257ea7457eb7556eb7655ec7754ed7953ed7a52ee7b51ef7c51ef7e50f07f4ff0804ef1814df1834cf2844bf3854bf3874af48849f48948f58b47f58c46f68d45f68f44f79044f79143f79342f89441f89540f9973ff9983ef99a3efa9b3dfa9c3cfa9e3bfb9f3afba139fba238fca338fca537fca636fca835fca934fdab33fdac33fdae32fdaf31fdb130fdb22ffdb42ffdb52efeb72dfeb82cfeba2cfebb2bfebd2afebe2afec029fdc229fdc328fdc527fdc627fdc827fdca26fdcb26fccd25fcce25fcd025fcd225fbd324fbd524fbd724fad824fada24f9dc24f9dd25f8df25f8e125f7e225f7e425f6e626f6e826f5e926f5eb27f4ed27f3ee27f3f027f2f227f1f426f1f525f0f724f0f921")); function constant$1(x2) { return function constant2() { return x2; }; } const abs$1 = Math.abs; const atan2 = Math.atan2; const cos = Math.cos; const max = Math.max; const min = Math.min; const sin = Math.sin; const sqrt = Math.sqrt; const epsilon = 1e-12; const pi = Math.PI; const halfPi = pi / 2; const tau = 2 * pi; function acos(x2) { return x2 > 1 ? 0 : x2 < -1 ? pi : Math.acos(x2); } function asin(x2) { return x2 >= 1 ? halfPi : x2 <= -1 ? -halfPi : Math.asin(x2); } function arcInnerRadius(d) { return d.innerRadius; } function arcOuterRadius(d) { return d.outerRadius; } function arcStartAngle(d) { return d.startAngle; } function arcEndAngle(d) { return d.endAngle; } function arcPadAngle(d) { return d && d.padAngle; } function intersect$2(x02, y02, x12, y12, x2, y2, x3, y3) { var x10 = x12 - x02, y10 = y12 - y02, x32 = x3 - x2, y32 = y3 - y2, t = y32 * x10 - x32 * y10; if (t * t < epsilon) return; t = (x32 * (y02 - y2) - y32 * (x02 - x2)) / t; return [x02 + t * x10, y02 + t * y10]; } function cornerTangents(x02, y02, x12, y12, r1, rc, cw) { var x01 = x02 - x12, y01 = y02 - y12, lo = (cw ? rc : -rc) / sqrt(x01 * x01 + y01 * y01), ox = lo * y01, oy = -lo * x01, x11 = x02 + ox, y11 = y02 + oy, x10 = x12 + ox, y10 = y12 + oy, x002 = (x11 + x10) / 2, y002 = (y11 + y10) / 2, dx = x10 - x11, dy = y10 - y11, d2 = dx * dx + dy * dy, r = r1 - rc, D2 = x11 * y10 - x10 * y11, d = (dy < 0 ? -1 : 1) * sqrt(max(0, r * r * d2 - D2 * D2)), cx0 = (D2 * dy - dx * d) / d2, cy0 = (-D2 * dx - dy * d) / d2, cx1 = (D2 * dy + dx * d) / d2, cy1 = (-D2 * dx + dy * d) / d2, dx0 = cx0 - x002, dy0 = cy0 - y002, dx1 = cx1 - x002, dy1 = cy1 - y002; if (dx0 * dx0 + dy0 * dy0 > dx1 * dx1 + dy1 * dy1) cx0 = cx1, cy0 = cy1; return { cx: cx0, cy: cy0, x01: -ox, y01: -oy, x11: cx0 * (r1 / r - 1), y11: cy0 * (r1 / r - 1) }; } function d3arc() { var innerRadius = arcInnerRadius, outerRadius = arcOuterRadius, cornerRadius = constant$1(0), padRadius = null, startAngle = arcStartAngle, endAngle = arcEndAngle, padAngle = arcPadAngle, context = null; function arc() { var buffer2, r, r0 = +innerRadius.apply(this, arguments), r1 = +outerRadius.apply(this, arguments), a0 = startAngle.apply(this, arguments) - halfPi, a1 = endAngle.apply(this, arguments) - halfPi, da = abs$1(a1 - a0), cw = a1 > a0; if (!context) context = buffer2 = path(); if (r1 < r0) r = r1, r1 = r0, r0 = r; if (!(r1 > epsilon)) context.moveTo(0, 0); else if (da > tau - epsilon) { context.moveTo(r1 * cos(a0), r1 * sin(a0)); context.arc(0, 0, r1, a0, a1, !cw); if (r0 > epsilon) { context.moveTo(r0 * cos(a1), r0 * sin(a1)); context.arc(0, 0, r0, a1, a0, cw); } } else { var a01 = a0, a11 = a1, a00 = a0, a10 = a1, da0 = da, da1 = da, ap = padAngle.apply(this, arguments) / 2, rp = ap > epsilon && (padRadius ? +padRadius.apply(this, arguments) : sqrt(r0 * r0 + r1 * r1)), rc = min(abs$1(r1 - r0) / 2, +cornerRadius.apply(this, arguments)), rc0 = rc, rc1 = rc, t02, t12; if (rp > epsilon) { var p02 = asin(rp / r0 * sin(ap)), p1 = asin(rp / r1 * sin(ap)); if ((da0 -= p02 * 2) > epsilon) p02 *= cw ? 1 : -1, a00 += p02, a10 -= p02; else da0 = 0, a00 = a10 = (a0 + a1) / 2; if ((da1 -= p1 * 2) > epsilon) p1 *= cw ? 1 : -1, a01 += p1, a11 -= p1; else da1 = 0, a01 = a11 = (a0 + a1) / 2; } var x01 = r1 * cos(a01), y01 = r1 * sin(a01), x10 = r0 * cos(a10), y10 = r0 * sin(a10); if (rc > epsilon) { var x11 = r1 * cos(a11), y11 = r1 * sin(a11), x002 = r0 * cos(a00), y002 = r0 * sin(a00), oc; if (da < pi && (oc = intersect$2(x01, y01, x002, y002, x11, y11, x10, y10))) { var ax = x01 - oc[0], ay = y01 - oc[1], bx = x11 - oc[0], by = y11 - oc[1], kc = 1 / sin(acos((ax * bx + ay * by) / (sqrt(ax * ax + ay * ay) * sqrt(bx * bx + by * by))) / 2), lc = sqrt(oc[0] * oc[0] + oc[1] * oc[1]); rc0 = min(rc, (r0 - lc) / (kc - 1)); rc1 = min(rc, (r1 - lc) / (kc + 1)); } } if (!(da1 > epsilon)) context.moveTo(x01, y01); else if (rc1 > epsilon) { t02 = cornerTangents(x002, y002, x01, y01, r1, rc1, cw); t12 = cornerTangents(x11, y11, x10, y10, r1, rc1, cw); context.moveTo(t02.cx + t02.x01, t02.cy + t02.y01); if (rc1 < rc) context.arc(t02.cx, t02.cy, rc1, atan2(t02.y01, t02.x01), atan2(t12.y01, t12.x01), !cw); else { context.arc(t02.cx, t02.cy, rc1, atan2(t02.y01, t02.x01), atan2(t02.y11, t02.x11), !cw); context.arc(0, 0, r1, atan2(t02.cy + t02.y11, t02.cx + t02.x11), atan2(t12.cy + t12.y11, t12.cx + t12.x11), !cw); context.arc(t12.cx, t12.cy, rc1, atan2(t12.y11, t12.x11), atan2(t12.y01, t12.x01), !cw); } } else context.moveTo(x01, y01), context.arc(0, 0, r1, a01, a11, !cw); if (!(r0 > epsilon) || !(da0 > epsilon)) context.lineTo(x10, y10); else if (rc0 > epsilon) { t02 = cornerTangents(x10, y10, x11, y11, r0, -rc0, cw); t12 = cornerTangents(x01, y01, x002, y002, r0, -rc0, cw); context.lineTo(t02.cx + t02.x01, t02.cy + t02.y01); if (rc0 < rc) context.arc(t02.cx, t02.cy, rc0, atan2(t02.y01, t02.x01), atan2(t12.y01, t12.x01), !cw); else { context.arc(t02.cx, t02.cy, rc0, atan2(t02.y01, t02.x01), atan2(t02.y11, t02.x11), !cw); context.arc(0, 0, r0, atan2(t02.cy + t02.y11, t02.cx + t02.x11), atan2(t12.cy + t12.y11, t12.cx + t12.x11), cw); context.arc(t12.cx, t12.cy, rc0, atan2(t12.y11, t12.x11), atan2(t12.y01, t12.x01), !cw); } } else context.arc(0, 0, r0, a10, a00, cw); } context.closePath(); if (buffer2) return context = null, buffer2 + "" || null; } arc.centroid = function() { var r = (+innerRadius.apply(this, arguments) + +outerRadius.apply(this, arguments)) / 2, a2 = (+startAngle.apply(this, arguments) + +endAngle.apply(this, arguments)) / 2 - pi / 2; return [cos(a2) * r, sin(a2) * r]; }; arc.innerRadius = function(_2) { return arguments.length ? (innerRadius = typeof _2 === "function" ? _2 : constant$1(+_2), arc) : innerRadius; }; arc.outerRadius = function(_2) { return arguments.length ? (outerRadius = typeof _2 === "function" ? _2 : constant$1(+_2), arc) : outerRadius; }; arc.cornerRadius = function(_2) { return arguments.length ? (cornerRadius = typeof _2 === "function" ? _2 : constant$1(+_2), arc) : cornerRadius; }; arc.padRadius = function(_2) { return arguments.length ? (padRadius = _2 == null ? null : typeof _2 === "function" ? _2 : constant$1(+_2), arc) : padRadius; }; arc.startAngle = function(_2) { return arguments.length ? (startAngle = typeof _2 === "function" ? _2 : constant$1(+_2), arc) : startAngle; }; arc.endAngle = function(_2) { return arguments.length ? (endAngle = typeof _2 === "function" ? _2 : constant$1(+_2), arc) : endAngle; }; arc.padAngle = function(_2) { return arguments.length ? (padAngle = typeof _2 === "function" ? _2 : constant$1(+_2), arc) : padAngle; }; arc.context = function(_2) { return arguments.length ? (context = _2 == null ? null : _2, arc) : context; }; return arc; } var slice$1 = Array.prototype.slice; function array(x2) { return typeof x2 === "object" && "length" in x2 ? x2 : Array.from(x2); } function Linear(context) { this._context = context; } Linear.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._point = 0; }, lineEnd: function() { if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); this._line = 1 - this._line; }, point: function(x2, y2) { x2 = +x2, y2 = +y2; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); break; case 1: this._point = 2; default: this._context.lineTo(x2, y2); break; } } }; function curveLinear(context) { return new Linear(context); } function x$1(p) { return p[0]; } function y(p) { return p[1]; } function line$1(x2, y$12) { var defined = constant$1(true), context = null, curve = curveLinear, output = null; x2 = typeof x2 === "function" ? x2 : x2 === void 0 ? x$1 : constant$1(x2); y$12 = typeof y$12 === "function" ? y$12 : y$12 === void 0 ? y : constant$1(y$12); function line2(data) { var i, n = (data = array(data)).length, d, defined0 = false, buffer2; if (context == null) output = curve(buffer2 = path()); for (i = 0; i <= n; ++i) { if (!(i < n && defined(d = data[i], i, data)) === defined0) { if (defined0 = !defined0) output.lineStart(); else output.lineEnd(); } if (defined0) output.point(+x2(d, i, data), +y$12(d, i, data)); } if (buffer2) return output = null, buffer2 + "" || null; } line2.x = function(_2) { return arguments.length ? (x2 = typeof _2 === "function" ? _2 : constant$1(+_2), line2) : x2; }; line2.y = function(_2) { return arguments.length ? (y$12 = typeof _2 === "function" ? _2 : constant$1(+_2), line2) : y$12; }; line2.defined = function(_2) { return arguments.length ? (defined = typeof _2 === "function" ? _2 : constant$1(!!_2), line2) : defined; }; line2.curve = function(_2) { return arguments.length ? (curve = _2, context != null && (output = curve(context)), line2) : curve; }; line2.context = function(_2) { return arguments.length ? (_2 == null ? context = output = null : output = curve(context = _2), line2) : context; }; return line2; } function area(x02, y02, y12) { var x12 = null, defined = constant$1(true), context = null, curve = curveLinear, output = null; x02 = typeof x02 === "function" ? x02 : x02 === void 0 ? x$1 : constant$1(+x02); y02 = typeof y02 === "function" ? y02 : y02 === void 0 ? constant$1(0) : constant$1(+y02); y12 = typeof y12 === "function" ? y12 : y12 === void 0 ? y : constant$1(+y12); function area2(data) { var i, j, k2, n = (data = array(data)).length, d, defined0 = false, buffer2, x0z = new Array(n), y0z = new Array(n); if (context == null) output = curve(buffer2 = path()); for (i = 0; i <= n; ++i) { if (!(i < n && defined(d = data[i], i, data)) === defined0) { if (defined0 = !defined0) { j = i; output.areaStart(); output.lineStart(); } else { output.lineEnd(); output.lineStart(); for (k2 = i - 1; k2 >= j; --k2) { output.point(x0z[k2], y0z[k2]); } output.lineEnd(); output.areaEnd(); } } if (defined0) { x0z[i] = +x02(d, i, data), y0z[i] = +y02(d, i, data); output.point(x12 ? +x12(d, i, data) : x0z[i], y12 ? +y12(d, i, data) : y0z[i]); } } if (buffer2) return output = null, buffer2 + "" || null; } function arealine() { return line$1().defined(defined).curve(curve).context(context); } area2.x = function(_2) { return arguments.length ? (x02 = typeof _2 === "function" ? _2 : constant$1(+_2), x12 = null, area2) : x02; }; area2.x0 = function(_2) { return arguments.length ? (x02 = typeof _2 === "function" ? _2 : constant$1(+_2), area2) : x02; }; area2.x1 = function(_2) { return arguments.length ? (x12 = _2 == null ? null : typeof _2 === "function" ? _2 : constant$1(+_2), area2) : x12; }; area2.y = function(_2) { return arguments.length ? (y02 = typeof _2 === "function" ? _2 : constant$1(+_2), y12 = null, area2) : y02; }; area2.y0 = function(_2) { return arguments.length ? (y02 = typeof _2 === "function" ? _2 : constant$1(+_2), area2) : y02; }; area2.y1 = function(_2) { return arguments.length ? (y12 = _2 == null ? null : typeof _2 === "function" ? _2 : constant$1(+_2), area2) : y12; }; area2.lineX0 = area2.lineY0 = function() { return arealine().x(x02).y(y02); }; area2.lineY1 = function() { return arealine().x(x02).y(y12); }; area2.lineX1 = function() { return arealine().x(x12).y(y02); }; area2.defined = function(_2) { return arguments.length ? (defined = typeof _2 === "function" ? _2 : constant$1(!!_2), area2) : defined; }; area2.curve = function(_2) { return arguments.length ? (curve = _2, context != null && (output = curve(context)), area2) : curve; }; area2.context = function(_2) { return arguments.length ? (_2 == null ? context = output = null : output = curve(context = _2), area2) : context; }; return area2; } function descending$1(a2, b) { return b < a2 ? -1 : b > a2 ? 1 : b >= a2 ? 0 : NaN; } function identity$1(d) { return d; } function d3pie() { var value = identity$1, sortValues = descending$1, sort2 = null, startAngle = constant$1(0), endAngle = constant$1(tau), padAngle = constant$1(0); function pie(data) { var i, n = (data = array(data)).length, j, k2, sum2 = 0, index2 = new Array(n), arcs = new Array(n), a0 = +startAngle.apply(this, arguments), da = Math.min(tau, Math.max(-tau, endAngle.apply(this, arguments) - a0)), a1, p = Math.min(Math.abs(da) / n, padAngle.apply(this, arguments)), pa = p * (da < 0 ? -1 : 1), v; for (i = 0; i < n; ++i) { if ((v = arcs[index2[i] = i] = +value(data[i], i, data)) > 0) { sum2 += v; } } if (sortValues != null) index2.sort(function(i2, j2) { return sortValues(arcs[i2], arcs[j2]); }); else if (sort2 != null) index2.sort(function(i2, j2) { return sort2(data[i2], data[j2]); }); for (i = 0, k2 = sum2 ? (da - n * pa) / sum2 : 0; i < n; ++i, a0 = a1) { j = index2[i], v = arcs[j], a1 = a0 + (v > 0 ? v * k2 : 0) + pa, arcs[j] = { data: data[j], index: i, value: v, startAngle: a0, endAngle: a1, padAngle: p }; } return arcs; } pie.value = function(_2) { return arguments.length ? (value = typeof _2 === "function" ? _2 : constant$1(+_2), pie) : value; }; pie.sortValues = function(_2) { return arguments.length ? (sortValues = _2, sort2 = null, pie) : sortValues; }; pie.sort = function(_2) { return arguments.length ? (sort2 = _2, sortValues = null, pie) : sort2; }; pie.startAngle = function(_2) { return arguments.length ? (startAngle = typeof _2 === "function" ? _2 : constant$1(+_2), pie) : startAngle; }; pie.endAngle = function(_2) { return arguments.length ? (endAngle = typeof _2 === "function" ? _2 : constant$1(+_2), pie) : endAngle; }; pie.padAngle = function(_2) { return arguments.length ? (padAngle = typeof _2 === "function" ? _2 : constant$1(+_2), pie) : padAngle; }; return pie; } var curveRadialLinear = curveRadial(curveLinear); function Radial(curve) { this._curve = curve; } Radial.prototype = { areaStart: function() { this._curve.areaStart(); }, areaEnd: function() { this._curve.areaEnd(); }, lineStart: function() { this._curve.lineStart(); }, lineEnd: function() { this._curve.lineEnd(); }, point: function(a2, r) { this._curve.point(r * Math.sin(a2), r * -Math.cos(a2)); } }; function curveRadial(curve) { function radial2(context) { return new Radial(curve(context)); } radial2._curve = curve; return radial2; } function lineRadial(l) { var c2 = l.curve; l.angle = l.x, delete l.x; l.radius = l.y, delete l.y; l.curve = function(_2) { return arguments.length ? c2(curveRadial(_2)) : c2()._curve; }; return l; } function lineRadial$1() { return lineRadial(line$1().curve(curveRadialLinear)); } function areaRadial() { var a2 = area().curve(curveRadialLinear), c2 = a2.curve, x02 = a2.lineX0, x12 = a2.lineX1, y02 = a2.lineY0, y12 = a2.lineY1; a2.angle = a2.x, delete a2.x; a2.startAngle = a2.x0, delete a2.x0; a2.endAngle = a2.x1, delete a2.x1; a2.radius = a2.y, delete a2.y; a2.innerRadius = a2.y0, delete a2.y0; a2.outerRadius = a2.y1, delete a2.y1; a2.lineStartAngle = function() { return lineRadial(x02()); }, delete a2.lineX0; a2.lineEndAngle = function() { return lineRadial(x12()); }, delete a2.lineX1; a2.lineInnerRadius = function() { return lineRadial(y02()); }, delete a2.lineY0; a2.lineOuterRadius = function() { return lineRadial(y12()); }, delete a2.lineY1; a2.curve = function(_2) { return arguments.length ? c2(curveRadial(_2)) : c2()._curve; }; return a2; } function pointRadial(x2, y2) { return [(y2 = +y2) * Math.cos(x2 -= Math.PI / 2), y2 * Math.sin(x2)]; } class Bump { constructor(context, x2) { this._context = context; this._x = x2; } areaStart() { this._line = 0; } areaEnd() { this._line = NaN; } lineStart() { this._point = 0; } lineEnd() { if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); this._line = 1 - this._line; } point(x2, y2) { x2 = +x2, y2 = +y2; switch (this._point) { case 0: { this._point = 1; if (this._line) this._context.lineTo(x2, y2); else this._context.moveTo(x2, y2); break; } case 1: this._point = 2; default: { if (this._x) this._context.bezierCurveTo(this._x0 = (this._x0 + x2) / 2, this._y0, this._x0, y2, x2, y2); else this._context.bezierCurveTo(this._x0, this._y0 = (this._y0 + y2) / 2, x2, this._y0, x2, y2); break; } } this._x0 = x2, this._y0 = y2; } } class BumpRadial { constructor(context) { this._context = context; } lineStart() { this._point = 0; } lineEnd() { } point(x2, y2) { x2 = +x2, y2 = +y2; if (this._point++ === 0) { this._x0 = x2, this._y0 = y2; } else { const p02 = pointRadial(this._x0, this._y0); const p1 = pointRadial(this._x0, this._y0 = (this._y0 + y2) / 2); const p2 = pointRadial(x2, this._y0); const p3 = pointRadial(x2, y2); this._context.moveTo(...p02); this._context.bezierCurveTo(...p1, ...p2, ...p3); } } } function bumpX(context) { return new Bump(context, true); } function bumpY(context) { return new Bump(context, false); } function bumpRadial(context) { return new BumpRadial(context); } function linkSource(d) { return d.source; } function linkTarget(d) { return d.target; } function link(curve) { let source = linkSource; let target = linkTarget; let x2 = x$1; let y$12 = y; let context = null; let output = null; function link2() { let buffer2; const argv = slice$1.call(arguments); const s2 = source.apply(this, argv); const t = target.apply(this, argv); if (context == null) output = curve(buffer2 = path()); output.lineStart(); argv[0] = s2, output.point(+x2.apply(this, argv), +y$12.apply(this, argv)); argv[0] = t, output.point(+x2.apply(this, argv), +y$12.apply(this, argv)); output.lineEnd(); if (buffer2) return output = null, buffer2 + "" || null; } link2.source = function(_2) { return arguments.length ? (source = _2, link2) : source; }; link2.target = function(_2) { return arguments.length ? (target = _2, link2) : target; }; link2.x = function(_2) { return arguments.length ? (x2 = typeof _2 === "function" ? _2 : constant$1(+_2), link2) : x2; }; link2.y = function(_2) { return arguments.length ? (y$12 = typeof _2 === "function" ? _2 : constant$1(+_2), link2) : y$12; }; link2.context = function(_2) { return arguments.length ? (_2 == null ? context = output = null : output = curve(context = _2), link2) : context; }; return link2; } function linkHorizontal() { return link(bumpX); } function linkVertical() { return link(bumpY); } function linkRadial() { const l = link(bumpRadial); l.angle = l.x, delete l.x; l.radius = l.y, delete l.y; return l; } const sqrt3$2 = sqrt(3); const asterisk = { draw(context, size) { const r = sqrt(size + min(size / 28, 0.75)) * 0.59436; const t = r / 2; const u2 = t * sqrt3$2; context.moveTo(0, r); context.lineTo(0, -r); context.moveTo(-u2, -t); context.lineTo(u2, t); context.moveTo(-u2, t); context.lineTo(u2, -t); } }; const circle$2 = { draw(context, size) { const r = sqrt(size / pi); context.moveTo(r, 0); context.arc(0, 0, r, 0, tau); } }; const cross$1 = { draw(context, size) { const r = sqrt(size / 5) / 2; context.moveTo(-3 * r, -r); context.lineTo(-r, -r); context.lineTo(-r, -3 * r); context.lineTo(r, -3 * r); context.lineTo(r, -r); context.lineTo(3 * r, -r); context.lineTo(3 * r, r); context.lineTo(r, r); context.lineTo(r, 3 * r); context.lineTo(-r, 3 * r); context.lineTo(-r, r); context.lineTo(-3 * r, r); context.closePath(); } }; const tan30 = sqrt(1 / 3); const tan30_2 = tan30 * 2; const diamond = { draw(context, size) { const y2 = sqrt(size / tan30_2); const x2 = y2 * tan30; context.moveTo(0, -y2); context.lineTo(x2, 0); context.lineTo(0, y2); context.lineTo(-x2, 0); context.closePath(); } }; const diamond2 = { draw(context, size) { const r = sqrt(size) * 0.62625; context.moveTo(0, -r); context.lineTo(r, 0); context.lineTo(0, r); context.lineTo(-r, 0); context.closePath(); } }; const plus = { draw(context, size) { const r = sqrt(size - min(size / 7, 2)) * 0.87559; context.moveTo(-r, 0); context.lineTo(r, 0); context.moveTo(0, r); context.lineTo(0, -r); } }; const square = { draw(context, size) { const w2 = sqrt(size); const x2 = -w2 / 2; context.rect(x2, x2, w2, w2); } }; const square2 = { draw(context, size) { const r = sqrt(size) * 0.4431; context.moveTo(r, r); context.lineTo(r, -r); context.lineTo(-r, -r); context.lineTo(-r, r); context.closePath(); } }; const ka = 0.8908130915292852; const kr = sin(pi / 10) / sin(7 * pi / 10); const kx = sin(tau / 10) * kr; const ky = -cos(tau / 10) * kr; const star = { draw(context, size) { const r = sqrt(size * ka); const x2 = kx * r; const y2 = ky * r; context.moveTo(0, -r); context.lineTo(x2, y2); for (let i = 1; i < 5; ++i) { const a2 = tau * i / 5; const c2 = cos(a2); const s2 = sin(a2); context.lineTo(s2 * r, -c2 * r); context.lineTo(c2 * x2 - s2 * y2, s2 * x2 + c2 * y2); } context.closePath(); } }; const sqrt3$1 = sqrt(3); const triangle = { draw(context, size) { const y2 = -sqrt(size / (sqrt3$1 * 3)); context.moveTo(0, y2 * 2); context.lineTo(-sqrt3$1 * y2, -y2); context.lineTo(sqrt3$1 * y2, -y2); context.closePath(); } }; const sqrt3 = sqrt(3); const triangle2 = { draw(context, size) { const s2 = sqrt(size) * 0.6824; const t = s2 / 2; const u2 = s2 * sqrt3 / 2; context.moveTo(0, -s2); context.lineTo(u2, t); context.lineTo(-u2, t); context.closePath(); } }; const c$1 = -0.5; const s = sqrt(3) / 2; const k = 1 / sqrt(12); const a = (k / 2 + 1) * 3; const wye = { draw(context, size) { const r = sqrt(size / a); const x02 = r / 2, y02 = r * k; const x12 = x02, y12 = r * k + r; const x2 = -x12, y2 = y12; context.moveTo(x02, y02); context.lineTo(x12, y12); context.lineTo(x2, y2); context.lineTo(c$1 * x02 - s * y02, s * x02 + c$1 * y02); context.lineTo(c$1 * x12 - s * y12, s * x12 + c$1 * y12); context.lineTo(c$1 * x2 - s * y2, s * x2 + c$1 * y2); context.lineTo(c$1 * x02 + s * y02, c$1 * y02 - s * x02); context.lineTo(c$1 * x12 + s * y12, c$1 * y12 - s * x12); context.lineTo(c$1 * x2 + s * y2, c$1 * y2 - s * x2); context.closePath(); } }; const x = { draw(context, size) { const r = sqrt(size - min(size / 6, 1.7)) * 0.6189; context.moveTo(-r, -r); context.lineTo(r, r); context.moveTo(-r, r); context.lineTo(r, -r); } }; const symbolsFill = [ circle$2, cross$1, diamond, square, star, triangle, wye ]; const symbolsStroke = [ circle$2, plus, x, triangle2, asterisk, square2, diamond2 ]; function Symbol$4(type2, size) { let context = null; type2 = typeof type2 === "function" ? type2 : constant$1(type2 || circle$2); size = typeof size === "function" ? size : constant$1(size === void 0 ? 64 : +size); function symbol() { let buffer2; if (!context) context = buffer2 = path(); type2.apply(this, arguments).draw(context, +size.apply(this, arguments)); if (buffer2) return context = null, buffer2 + "" || null; } symbol.type = function(_2) { return arguments.length ? (type2 = typeof _2 === "function" ? _2 : constant$1(_2), symbol) : type2; }; symbol.size = function(_2) { return arguments.length ? (size = typeof _2 === "function" ? _2 : constant$1(+_2), symbol) : size; }; symbol.context = function(_2) { return arguments.length ? (context = _2 == null ? null : _2, symbol) : context; }; return symbol; } function noop() { } function point$4(that, x2, y2) { that._context.bezierCurveTo( (2 * that._x0 + that._x1) / 3, (2 * that._y0 + that._y1) / 3, (that._x0 + 2 * that._x1) / 3, (that._y0 + 2 * that._y1) / 3, (that._x0 + 4 * that._x1 + x2) / 6, (that._y0 + 4 * that._y1 + y2) / 6 ); } function Basis(context) { this._context = context; } Basis.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._y0 = this._y1 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 3: point$4(this, this._x1, this._y1); case 2: this._context.lineTo(this._x1, this._y1); break; } if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); this._line = 1 - this._line; }, point: function(x2, y2) { x2 = +x2, y2 = +y2; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); break; case 1: this._point = 2; break; case 2: this._point = 3; this._context.lineTo((5 * this._x0 + this._x1) / 6, (5 * this._y0 + this._y1) / 6); default: point$4(this, x2, y2); break; } this._x0 = this._x1, this._x1 = x2; this._y0 = this._y1, this._y1 = y2; } }; function curveBasis(context) { return new Basis(context); } function BasisClosed(context) { this._context = context; } BasisClosed.prototype = { areaStart: noop, areaEnd: noop, lineStart: function() { this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x2, this._y2); this._context.closePath(); break; } case 2: { this._context.moveTo((this._x2 + 2 * this._x3) / 3, (this._y2 + 2 * this._y3) / 3); this._context.lineTo((this._x3 + 2 * this._x2) / 3, (this._y3 + 2 * this._y2) / 3); this._context.closePath(); break; } case 3: { this.point(this._x2, this._y2); this.point(this._x3, this._y3); this.point(this._x4, this._y4); break; } } }, point: function(x2, y2) { x2 = +x2, y2 = +y2; switch (this._point) { case 0: this._point = 1; this._x2 = x2, this._y2 = y2; break; case 1: this._point = 2; this._x3 = x2, this._y3 = y2; break; case 2: this._point = 3; this._x4 = x2, this._y4 = y2; this._context.moveTo((this._x0 + 4 * this._x1 + x2) / 6, (this._y0 + 4 * this._y1 + y2) / 6); break; default: point$4(this, x2, y2); break; } this._x0 = this._x1, this._x1 = x2; this._y0 = this._y1, this._y1 = y2; } }; function curveBasisClosed(context) { return new BasisClosed(context); } function BasisOpen(context) { this._context = context; } BasisOpen.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._y0 = this._y1 = NaN; this._point = 0; }, lineEnd: function() { if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); this._line = 1 - this._line; }, point: function(x2, y2) { x2 = +x2, y2 = +y2; switch (this._point) { case 0: this._point = 1; break; case 1: this._point = 2; break; case 2: this._point = 3; var x02 = (this._x0 + 4 * this._x1 + x2) / 6, y02 = (this._y0 + 4 * this._y1 + y2) / 6; this._line ? this._context.lineTo(x02, y02) : this._context.moveTo(x02, y02); break; case 3: this._point = 4; default: point$4(this, x2, y2); break; } this._x0 = this._x1, this._x1 = x2; this._y0 = this._y1, this._y1 = y2; } }; function curveBasisOpen(context) { return new BasisOpen(context); } function Bundle(context, beta2) { this._basis = new Basis(context); this._beta = beta2; } Bundle.prototype = { lineStart: function() { this._x = []; this._y = []; this._basis.lineStart(); }, lineEnd: function() { var x2 = this._x, y2 = this._y, j = x2.length - 1; if (j > 0) { var x02 = x2[0], y02 = y2[0], dx = x2[j] - x02, dy = y2[j] - y02, i = -1, t; while (++i <= j) { t = i / j; this._basis.point( this._beta * x2[i] + (1 - this._beta) * (x02 + t * dx), this._beta * y2[i] + (1 - this._beta) * (y02 + t * dy) ); } } this._x = this._y = null; this._basis.lineEnd(); }, point: function(x2, y2) { this._x.push(+x2); this._y.push(+y2); } }; const bundle = function custom12(beta2) { function bundle2(context) { return beta2 === 1 ? new Basis(context) : new Bundle(context, beta2); } bundle2.beta = function(beta3) { return custom12(+beta3); }; return bundle2; }(0.85); function point$3(that, x2, y2) { that._context.bezierCurveTo( that._x1 + that._k * (that._x2 - that._x0), that._y1 + that._k * (that._y2 - that._y0), that._x2 + that._k * (that._x1 - x2), that._y2 + that._k * (that._y1 - y2), that._x2, that._y2 ); } function Cardinal(context, tension) { this._context = context; this._k = (1 - tension) / 6; } Cardinal.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x2, this._y2); break; case 3: point$3(this, this._x1, this._y1); break; } if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); this._line = 1 - this._line; }, point: function(x2, y2) { x2 = +x2, y2 = +y2; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); break; case 1: this._point = 2; this._x1 = x2, this._y1 = y2; break; case 2: this._point = 3; default: point$3(this, x2, y2); break; } this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } }; const cardinal = function custom13(tension) { function cardinal2(context) { return new Cardinal(context, tension); } cardinal2.tension = function(tension2) { return custom13(+tension2); }; return cardinal2; }(0); function CardinalClosed(context, tension) { this._context = context; this._k = (1 - tension) / 6; } CardinalClosed.prototype = { areaStart: noop, areaEnd: noop, lineStart: function() { this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x3, this._y3); this._context.closePath(); break; } case 2: { this._context.lineTo(this._x3, this._y3); this._context.closePath(); break; } case 3: { this.point(this._x3, this._y3); this.point(this._x4, this._y4); this.point(this._x5, this._y5); break; } } }, point: function(x2, y2) { x2 = +x2, y2 = +y2; switch (this._point) { case 0: this._point = 1; this._x3 = x2, this._y3 = y2; break; case 1: this._point = 2; this._context.moveTo(this._x4 = x2, this._y4 = y2); break; case 2: this._point = 3; this._x5 = x2, this._y5 = y2; break; default: point$3(this, x2, y2); break; } this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } }; const cardinalClosed = function custom14(tension) { function cardinal2(context) { return new CardinalClosed(context, tension); } cardinal2.tension = function(tension2) { return custom14(+tension2); }; return cardinal2; }(0); function CardinalOpen(context, tension) { this._context = context; this._k = (1 - tension) / 6; } CardinalOpen.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._point = 0; }, lineEnd: function() { if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); this._line = 1 - this._line; }, point: function(x2, y2) { x2 = +x2, y2 = +y2; switch (this._point) { case 0: this._point = 1; break; case 1: this._point = 2; break; case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; case 3: this._point = 4; default: point$3(this, x2, y2); break; } this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } }; const cardinalOpen = function custom15(tension) { function cardinal2(context) { return new CardinalOpen(context, tension); } cardinal2.tension = function(tension2) { return custom15(+tension2); }; return cardinal2; }(0); function point$2(that, x2, y2) { var x12 = that._x1, y12 = that._y1, x22 = that._x2, y22 = that._y2; if (that._l01_a > epsilon) { var a2 = 2 * that._l01_2a + 3 * that._l01_a * that._l12_a + that._l12_2a, n = 3 * that._l01_a * (that._l01_a + that._l12_a); x12 = (x12 * a2 - that._x0 * that._l12_2a + that._x2 * that._l01_2a) / n; y12 = (y12 * a2 - that._y0 * that._l12_2a + that._y2 * that._l01_2a) / n; } if (that._l23_a > epsilon) { var b = 2 * that._l23_2a + 3 * that._l23_a * that._l12_a + that._l12_2a, m2 = 3 * that._l23_a * (that._l23_a + that._l12_a); x22 = (x22 * b + that._x1 * that._l23_2a - x2 * that._l12_2a) / m2; y22 = (y22 * b + that._y1 * that._l23_2a - y2 * that._l12_2a) / m2; } that._context.bezierCurveTo(x12, y12, x22, y22, that._x2, that._y2); } function CatmullRom(context, alpha) { this._context = context; this._alpha = alpha; } CatmullRom.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x2, this._y2); break; case 3: this.point(this._x2, this._y2); break; } if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); this._line = 1 - this._line; }, point: function(x2, y2) { x2 = +x2, y2 = +y2; if (this._point) { var x23 = this._x2 - x2, y23 = this._y2 - y2; this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); } switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); break; case 1: this._point = 2; break; case 2: this._point = 3; default: point$2(this, x2, y2); break; } this._l01_a = this._l12_a, this._l12_a = this._l23_a; this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } }; const catmullRom = function custom16(alpha) { function catmullRom2(context) { return alpha ? new CatmullRom(context, alpha) : new Cardinal(context, 0); } catmullRom2.alpha = function(alpha2) { return custom16(+alpha2); }; return catmullRom2; }(0.5); function CatmullRomClosed(context, alpha) { this._context = context; this._alpha = alpha; } CatmullRomClosed.prototype = { areaStart: noop, areaEnd: noop, lineStart: function() { this._x0 = this._x1 = this._x2 = this._x3 = this._x4 = this._x5 = this._y0 = this._y1 = this._y2 = this._y3 = this._y4 = this._y5 = NaN; this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { switch (this._point) { case 1: { this._context.moveTo(this._x3, this._y3); this._context.closePath(); break; } case 2: { this._context.lineTo(this._x3, this._y3); this._context.closePath(); break; } case 3: { this.point(this._x3, this._y3); this.point(this._x4, this._y4); this.point(this._x5, this._y5); break; } } }, point: function(x2, y2) { x2 = +x2, y2 = +y2; if (this._point) { var x23 = this._x2 - x2, y23 = this._y2 - y2; this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); } switch (this._point) { case 0: this._point = 1; this._x3 = x2, this._y3 = y2; break; case 1: this._point = 2; this._context.moveTo(this._x4 = x2, this._y4 = y2); break; case 2: this._point = 3; this._x5 = x2, this._y5 = y2; break; default: point$2(this, x2, y2); break; } this._l01_a = this._l12_a, this._l12_a = this._l23_a; this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } }; const catmullRomClosed = function custom17(alpha) { function catmullRom2(context) { return alpha ? new CatmullRomClosed(context, alpha) : new CardinalClosed(context, 0); } catmullRom2.alpha = function(alpha2) { return custom17(+alpha2); }; return catmullRom2; }(0.5); function CatmullRomOpen(context, alpha) { this._context = context; this._alpha = alpha; } CatmullRomOpen.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._x2 = this._y0 = this._y1 = this._y2 = NaN; this._l01_a = this._l12_a = this._l23_a = this._l01_2a = this._l12_2a = this._l23_2a = this._point = 0; }, lineEnd: function() { if (this._line || this._line !== 0 && this._point === 3) this._context.closePath(); this._line = 1 - this._line; }, point: function(x2, y2) { x2 = +x2, y2 = +y2; if (this._point) { var x23 = this._x2 - x2, y23 = this._y2 - y2; this._l23_a = Math.sqrt(this._l23_2a = Math.pow(x23 * x23 + y23 * y23, this._alpha)); } switch (this._point) { case 0: this._point = 1; break; case 1: this._point = 2; break; case 2: this._point = 3; this._line ? this._context.lineTo(this._x2, this._y2) : this._context.moveTo(this._x2, this._y2); break; case 3: this._point = 4; default: point$2(this, x2, y2); break; } this._l01_a = this._l12_a, this._l12_a = this._l23_a; this._l01_2a = this._l12_2a, this._l12_2a = this._l23_2a; this._x0 = this._x1, this._x1 = this._x2, this._x2 = x2; this._y0 = this._y1, this._y1 = this._y2, this._y2 = y2; } }; const catmullRomOpen = function custom18(alpha) { function catmullRom2(context) { return alpha ? new CatmullRomOpen(context, alpha) : new CardinalOpen(context, 0); } catmullRom2.alpha = function(alpha2) { return custom18(+alpha2); }; return catmullRom2; }(0.5); function LinearClosed(context) { this._context = context; } LinearClosed.prototype = { areaStart: noop, areaEnd: noop, lineStart: function() { this._point = 0; }, lineEnd: function() { if (this._point) this._context.closePath(); }, point: function(x2, y2) { x2 = +x2, y2 = +y2; if (this._point) this._context.lineTo(x2, y2); else this._point = 1, this._context.moveTo(x2, y2); } }; function curveLinearClosed(context) { return new LinearClosed(context); } function sign(x2) { return x2 < 0 ? -1 : 1; } function slope3(that, x2, y2) { var h0 = that._x1 - that._x0, h1 = x2 - that._x1, s0 = (that._y1 - that._y0) / (h0 || h1 < 0 && -0), s1 = (y2 - that._y1) / (h1 || h0 < 0 && -0), p = (s0 * h1 + s1 * h0) / (h0 + h1); return (sign(s0) + sign(s1)) * Math.min(Math.abs(s0), Math.abs(s1), 0.5 * Math.abs(p)) || 0; } function slope2(that, t) { var h = that._x1 - that._x0; return h ? (3 * (that._y1 - that._y0) / h - t) / 2 : t; } function point$1(that, t02, t12) { var x02 = that._x0, y02 = that._y0, x12 = that._x1, y12 = that._y1, dx = (x12 - x02) / 3; that._context.bezierCurveTo(x02 + dx, y02 + dx * t02, x12 - dx, y12 - dx * t12, x12, y12); } function MonotoneX(context) { this._context = context; } MonotoneX.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x0 = this._x1 = this._y0 = this._y1 = this._t0 = NaN; this._point = 0; }, lineEnd: function() { switch (this._point) { case 2: this._context.lineTo(this._x1, this._y1); break; case 3: point$1(this, this._t0, slope2(this, this._t0)); break; } if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); this._line = 1 - this._line; }, point: function(x2, y2) { var t12 = NaN; x2 = +x2, y2 = +y2; if (x2 === this._x1 && y2 === this._y1) return; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); break; case 1: this._point = 2; break; case 2: this._point = 3; point$1(this, slope2(this, t12 = slope3(this, x2, y2)), t12); break; default: point$1(this, this._t0, t12 = slope3(this, x2, y2)); break; } this._x0 = this._x1, this._x1 = x2; this._y0 = this._y1, this._y1 = y2; this._t0 = t12; } }; function MonotoneY(context) { this._context = new ReflectContext(context); } (MonotoneY.prototype = Object.create(MonotoneX.prototype)).point = function(x2, y2) { MonotoneX.prototype.point.call(this, y2, x2); }; function ReflectContext(context) { this._context = context; } ReflectContext.prototype = { moveTo: function(x2, y2) { this._context.moveTo(y2, x2); }, closePath: function() { this._context.closePath(); }, lineTo: function(x2, y2) { this._context.lineTo(y2, x2); }, bezierCurveTo: function(x12, y12, x2, y2, x3, y3) { this._context.bezierCurveTo(y12, x12, y2, x2, y3, x3); } }; function monotoneX(context) { return new MonotoneX(context); } function monotoneY(context) { return new MonotoneY(context); } function Natural(context) { this._context = context; } Natural.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x = []; this._y = []; }, lineEnd: function() { var x2 = this._x, y2 = this._y, n = x2.length; if (n) { this._line ? this._context.lineTo(x2[0], y2[0]) : this._context.moveTo(x2[0], y2[0]); if (n === 2) { this._context.lineTo(x2[1], y2[1]); } else { var px = controlPoints(x2), py = controlPoints(y2); for (var i0 = 0, i1 = 1; i1 < n; ++i0, ++i1) { this._context.bezierCurveTo(px[0][i0], py[0][i0], px[1][i0], py[1][i0], x2[i1], y2[i1]); } } } if (this._line || this._line !== 0 && n === 1) this._context.closePath(); this._line = 1 - this._line; this._x = this._y = null; }, point: function(x2, y2) { this._x.push(+x2); this._y.push(+y2); } }; function controlPoints(x2) { var i, n = x2.length - 1, m2, a2 = new Array(n), b = new Array(n), r = new Array(n); a2[0] = 0, b[0] = 2, r[0] = x2[0] + 2 * x2[1]; for (i = 1; i < n - 1; ++i) a2[i] = 1, b[i] = 4, r[i] = 4 * x2[i] + 2 * x2[i + 1]; a2[n - 1] = 2, b[n - 1] = 7, r[n - 1] = 8 * x2[n - 1] + x2[n]; for (i = 1; i < n; ++i) m2 = a2[i] / b[i - 1], b[i] -= m2, r[i] -= m2 * r[i - 1]; a2[n - 1] = r[n - 1] / b[n - 1]; for (i = n - 2; i >= 0; --i) a2[i] = (r[i] - a2[i + 1]) / b[i]; b[n - 1] = (x2[n] + a2[n - 1]) / 2; for (i = 0; i < n - 1; ++i) b[i] = 2 * x2[i + 1] - a2[i + 1]; return [a2, b]; } function curveNatural(context) { return new Natural(context); } function Step(context, t) { this._context = context; this._t = t; } Step.prototype = { areaStart: function() { this._line = 0; }, areaEnd: function() { this._line = NaN; }, lineStart: function() { this._x = this._y = NaN; this._point = 0; }, lineEnd: function() { if (0 < this._t && this._t < 1 && this._point === 2) this._context.lineTo(this._x, this._y); if (this._line || this._line !== 0 && this._point === 1) this._context.closePath(); if (this._line >= 0) this._t = 1 - this._t, this._line = 1 - this._line; }, point: function(x2, y2) { x2 = +x2, y2 = +y2; switch (this._point) { case 0: this._point = 1; this._line ? this._context.lineTo(x2, y2) : this._context.moveTo(x2, y2); break; case 1: this._point = 2; default: { if (this._t <= 0) { this._context.lineTo(this._x, y2); this._context.lineTo(x2, y2); } else { var x12 = this._x * (1 - this._t) + x2 * this._t; this._context.lineTo(x12, this._y); this._context.lineTo(x12, y2); } break; } } this._x = x2, this._y = y2; } }; function curveStep(context) { return new Step(context, 0.5); } function stepBefore(context) { return new Step(context, 0); } function stepAfter(context) { return new Step(context, 1); } function none$1(series, order) { if (!((n = series.length) > 1)) return; for (var i = 1, j, s0, s1 = series[order[0]], n, m2 = s1.length; i < n; ++i) { s0 = s1, s1 = series[order[i]]; for (j = 0; j < m2; ++j) { s1[j][1] += s1[j][0] = isNaN(s0[j][1]) ? s0[j][0] : s0[j][1]; } } } function none(series) { var n = series.length, o = new Array(n); while (--n >= 0) o[n] = n; return o; } function stackValue(d, key) { return d[key]; } function stackSeries(key) { const series = []; series.key = key; return series; } function stack() { var keys = constant$1([]), order = none, offset = none$1, value = stackValue; function stack2(data) { var sz = Array.from(keys.apply(this, arguments), stackSeries), i, n = sz.length, j = -1, oz; for (const d of data) { for (i = 0, ++j; i < n; ++i) { (sz[i][j] = [0, +value(d, sz[i].key, j, data)]).data = d; } } for (i = 0, oz = array(order(sz)); i < n; ++i) { sz[oz[i]].index = i; } offset(sz, oz); return sz; } stack2.keys = function(_2) { return arguments.length ? (keys = typeof _2 === "function" ? _2 : constant$1(Array.from(_2)), stack2) : keys; }; stack2.value = function(_2) { return arguments.length ? (value = typeof _2 === "function" ? _2 : constant$1(+_2), stack2) : value; }; stack2.order = function(_2) { return arguments.length ? (order = _2 == null ? none : typeof _2 === "function" ? _2 : constant$1(Array.from(_2)), stack2) : order; }; stack2.offset = function(_2) { return arguments.length ? (offset = _2 == null ? none$1 : _2, stack2) : offset; }; return stack2; } function expand(series, order) { if (!((n = series.length) > 0)) return; for (var i, n, j = 0, m2 = series[0].length, y2; j < m2; ++j) { for (y2 = i = 0; i < n; ++i) y2 += series[i][j][1] || 0; if (y2) for (i = 0; i < n; ++i) series[i][j][1] /= y2; } none$1(series, order); } function diverging(series, order) { if (!((n = series.length) > 0)) return; for (var i, j = 0, d, dy, yp, yn, n, m2 = series[order[0]].length; j < m2; ++j) { for (yp = yn = 0, i = 0; i < n; ++i) { if ((dy = (d = series[order[i]][j])[1] - d[0]) > 0) { d[0] = yp, d[1] = yp += dy; } else if (dy < 0) { d[1] = yn, d[0] = yn += dy; } else { d[0] = 0, d[1] = dy; } } } } function silhouette(series, order) { if (!((n = series.length) > 0)) return; for (var j = 0, s0 = series[order[0]], n, m2 = s0.length; j < m2; ++j) { for (var i = 0, y2 = 0; i < n; ++i) y2 += series[i][j][1] || 0; s0[j][1] += s0[j][0] = -y2 / 2; } none$1(series, order); } function wiggle(series, order) { if (!((n = series.length) > 0) || !((m2 = (s0 = series[order[0]]).length) > 0)) return; for (var y2 = 0, j = 1, s0, m2, n; j < m2; ++j) { for (var i = 0, s1 = 0, s2 = 0; i < n; ++i) { var si = series[order[i]], sij0 = si[j][1] || 0, sij1 = si[j - 1][1] || 0, s3 = (sij0 - sij1) / 2; for (var k2 = 0; k2 < i; ++k2) { var sk = series[order[k2]], skj0 = sk[j][1] || 0, skj1 = sk[j - 1][1] || 0; s3 += skj0 - skj1; } s1 += sij0, s2 += s3 * sij0; } s0[j - 1][1] += s0[j - 1][0] = y2; if (s1) y2 -= s2 / s1; } s0[j - 1][1] += s0[j - 1][0] = y2; none$1(series, order); } function appearance(series) { var peaks = series.map(peak); return none(series).sort(function(a2, b) { return peaks[a2] - peaks[b]; }); } function peak(series) { var i = -1, j = 0, n = series.length, vi, vj = -Infinity; while (++i < n) if ((vi = +series[i][1]) > vj) vj = vi, j = i; return j; } function ascending(series) { var sums = series.map(sum); return none(series).sort(function(a2, b) { return sums[a2] - sums[b]; }); } function sum(series) { var s2 = 0, i = -1, n = series.length, v; while (++i < n) if (v = +series[i][1]) s2 += v; return s2; } function descending(series) { return ascending(series).reverse(); } function insideOut(series) { var n = series.length, i, j, sums = series.map(sum), order = appearance(series), top2 = 0, bottom2 = 0, tops = [], bottoms = []; for (i = 0; i < n; ++i) { j = order[i]; if (top2 < bottom2) { top2 += sums[j]; tops.push(j); } else { bottom2 += sums[j]; bottoms.push(j); } } return bottoms.reverse().concat(tops); } function reverse(series) { return none(series).reverse(); } const constant = (x2) => () => x2; function ZoomEvent(type2, { sourceEvent: sourceEvent2, target, transform: transform2, dispatch: dispatch2 }) { Object.defineProperties(this, { type: { value: type2, enumerable: true, configurable: true }, sourceEvent: { value: sourceEvent2, enumerable: true, configurable: true }, target: { value: target, enumerable: true, configurable: true }, transform: { value: transform2, enumerable: true, configurable: true }, _: { value: dispatch2 } }); } function Transform(k2, x2, y2) { this.k = k2; this.x = x2; this.y = y2; } Transform.prototype = { constructor: Transform, scale: function(k2) { return k2 === 1 ? this : new Transform(this.k * k2, this.x, this.y); }, translate: function(x2, y2) { return x2 === 0 & y2 === 0 ? this : new Transform(this.k, this.x + this.k * x2, this.y + this.k * y2); }, apply: function(point2) { return [point2[0] * this.k + this.x, point2[1] * this.k + this.y]; }, applyX: function(x2) { return x2 * this.k + this.x; }, applyY: function(y2) { return y2 * this.k + this.y; }, invert: function(location2) { return [(location2[0] - this.x) / this.k, (location2[1] - this.y) / this.k]; }, invertX: function(x2) { return (x2 - this.x) / this.k; }, invertY: function(y2) { return (y2 - this.y) / this.k; }, rescaleX: function(x2) { return x2.copy().domain(x2.range().map(this.invertX, this).map(x2.invert, x2)); }, rescaleY: function(y2) { return y2.copy().domain(y2.range().map(this.invertY, this).map(y2.invert, y2)); }, toString: function() { return "translate(" + this.x + "," + this.y + ") scale(" + this.k + ")"; } }; var identity = new Transform(1, 0, 0); transform.prototype = Transform.prototype; function transform(node2) { while (!node2.__zoom) if (!(node2 = node2.parentNode)) return identity; return node2.__zoom; } function nopropagation(event) { event.stopImmediatePropagation(); } function noevent(event) { event.preventDefault(); event.stopImmediatePropagation(); } function defaultFilter(event) { return (!event.ctrlKey || event.type === "wheel") && !event.button; } function defaultExtent() { var e = this; if (e instanceof SVGElement) { e = e.ownerSVGElement || e; if (e.hasAttribute("viewBox")) { e = e.viewBox.baseVal; return [[e.x, e.y], [e.x + e.width, e.y + e.height]]; } return [[0, 0], [e.width.baseVal.value, e.height.baseVal.value]]; } return [[0, 0], [e.clientWidth, e.clientHeight]]; } function defaultTransform() { return this.__zoom || identity; } function defaultWheelDelta(event) { return -event.deltaY * (event.deltaMode === 1 ? 0.05 : event.deltaMode ? 1 : 2e-3) * (event.ctrlKey ? 10 : 1); } function defaultTouchable() { return navigator.maxTouchPoints || "ontouchstart" in this; } function defaultConstrain(transform2, extent2, translateExtent) { var dx0 = transform2.invertX(extent2[0][0]) - translateExtent[0][0], dx1 = transform2.invertX(extent2[1][0]) - translateExtent[1][0], dy0 = transform2.invertY(extent2[0][1]) - translateExtent[0][1], dy1 = transform2.invertY(extent2[1][1]) - translateExtent[1][1]; return transform2.translate( dx1 > dx0 ? (dx0 + dx1) / 2 : Math.min(0, dx0) || Math.max(0, dx1), dy1 > dy0 ? (dy0 + dy1) / 2 : Math.min(0, dy0) || Math.max(0, dy1) ); } function zoom() { var filter2 = defaultFilter, extent2 = defaultExtent, constrain = defaultConstrain, wheelDelta = defaultWheelDelta, touchable = defaultTouchable, scaleExtent = [0, Infinity], translateExtent = [[-Infinity, -Infinity], [Infinity, Infinity]], duration = 250, interpolate2 = interpolateZoom, listeners = dispatch("start", "zoom", "end"), touchstarting, touchfirst, touchending, touchDelay = 500, wheelDelay = 150, clickDistance2 = 0, tapDistance = 10; function zoom2(selection2) { selection2.property("__zoom", defaultTransform).on("wheel.zoom", wheeled, { passive: false }).on("mousedown.zoom", mousedowned).on("dblclick.zoom", dblclicked).filter(touchable).on("touchstart.zoom", touchstarted).on("touchmove.zoom", touchmoved).on("touchend.zoom touchcancel.zoom", touchended).style("-webkit-tap-highlight-color", "rgba(0,0,0,0)"); } zoom2.transform = function(collection, transform2, point2, event) { var selection2 = collection.selection ? collection.selection() : collection; selection2.property("__zoom", defaultTransform); if (collection !== selection2) { schedule2(collection, transform2, point2, event); } else { selection2.interrupt().each(function() { gesture(this, arguments).event(event).start().zoom(null, typeof transform2 === "function" ? transform2.apply(this, arguments) : transform2).end(); }); } }; zoom2.scaleBy = function(selection2, k2, p, event) { zoom2.scaleTo(selection2, function() { var k0 = this.__zoom.k, k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2; return k0 * k1; }, p, event); }; zoom2.scaleTo = function(selection2, k2, p, event) { zoom2.transform(selection2, function() { var e = extent2.apply(this, arguments), t02 = this.__zoom, p02 = p == null ? centroid2(e) : typeof p === "function" ? p.apply(this, arguments) : p, p1 = t02.invert(p02), k1 = typeof k2 === "function" ? k2.apply(this, arguments) : k2; return constrain(translate(scale(t02, k1), p02, p1), e, translateExtent); }, p, event); }; zoom2.translateBy = function(selection2, x2, y2, event) { zoom2.transform(selection2, function() { return constrain(this.__zoom.translate( typeof x2 === "function" ? x2.apply(this, arguments) : x2, typeof y2 === "function" ? y2.apply(this, arguments) : y2 ), extent2.apply(this, arguments), translateExtent); }, null, event); }; zoom2.translateTo = function(selection2, x2, y2, p, event) { zoom2.transform(selection2, function() { var e = extent2.apply(this, arguments), t = this.__zoom, p02 = p == null ? centroid2(e) : typeof p === "function" ? p.apply(this, arguments) : p; return constrain(identity.translate(p02[0], p02[1]).scale(t.k).translate( typeof x2 === "function" ? -x2.apply(this, arguments) : -x2, typeof y2 === "function" ? -y2.apply(this, arguments) : -y2 ), e, translateExtent); }, p, event); }; function scale(transform2, k2) { k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], k2)); return k2 === transform2.k ? transform2 : new Transform(k2, transform2.x, transform2.y); } function translate(transform2, p02, p1) { var x2 = p02[0] - p1[0] * transform2.k, y2 = p02[1] - p1[1] * transform2.k; return x2 === transform2.x && y2 === transform2.y ? transform2 : new Transform(transform2.k, x2, y2); } function centroid2(extent3) { return [(+extent3[0][0] + +extent3[1][0]) / 2, (+extent3[0][1] + +extent3[1][1]) / 2]; } function schedule2(transition2, transform2, point2, event) { transition2.on("start.zoom", function() { gesture(this, arguments).event(event).start(); }).on("interrupt.zoom end.zoom", function() { gesture(this, arguments).event(event).end(); }).tween("zoom", function() { var that = this, args = arguments, g = gesture(that, args).event(event), e = extent2.apply(that, args), p = point2 == null ? centroid2(e) : typeof point2 === "function" ? point2.apply(that, args) : point2, w2 = Math.max(e[1][0] - e[0][0], e[1][1] - e[0][1]), a2 = that.__zoom, b = typeof transform2 === "function" ? transform2.apply(that, args) : transform2, i = interpolate2(a2.invert(p).concat(w2 / a2.k), b.invert(p).concat(w2 / b.k)); return function(t) { if (t === 1) t = b; else { var l = i(t), k2 = w2 / l[2]; t = new Transform(k2, p[0] - l[0] * k2, p[1] - l[1] * k2); } g.zoom(null, t); }; }); } function gesture(that, args, clean) { return !clean && that.__zooming || new Gesture(that, args); } function Gesture(that, args) { this.that = that; this.args = args; this.active = 0; this.sourceEvent = null; this.extent = extent2.apply(that, args); this.taps = 0; } Gesture.prototype = { event: function(event) { if (event) this.sourceEvent = event; return this; }, start: function() { if (++this.active === 1) { this.that.__zooming = this; this.emit("start"); } return this; }, zoom: function(key, transform2) { if (this.mouse && key !== "mouse") this.mouse[1] = transform2.invert(this.mouse[0]); if (this.touch0 && key !== "touch") this.touch0[1] = transform2.invert(this.touch0[0]); if (this.touch1 && key !== "touch") this.touch1[1] = transform2.invert(this.touch1[0]); this.that.__zoom = transform2; this.emit("zoom"); return this; }, end: function() { if (--this.active === 0) { delete this.that.__zooming; this.emit("end"); } return this; }, emit: function(type2) { var d = select(this.that).datum(); listeners.call( type2, this.that, new ZoomEvent(type2, { sourceEvent: this.sourceEvent, target: zoom2, type: type2, transform: this.that.__zoom, dispatch: listeners }), d ); } }; function wheeled(event, ...args) { if (!filter2.apply(this, arguments)) return; var g = gesture(this, args).event(event), t = this.__zoom, k2 = Math.max(scaleExtent[0], Math.min(scaleExtent[1], t.k * Math.pow(2, wheelDelta.apply(this, arguments)))), p = pointer(event); if (g.wheel) { if (g.mouse[0][0] !== p[0] || g.mouse[0][1] !== p[1]) { g.mouse[1] = t.invert(g.mouse[0] = p); } clearTimeout(g.wheel); } else if (t.k === k2) return; else { g.mouse = [p, t.invert(p)]; interrupt(this); g.start(); } noevent(event); g.wheel = setTimeout(wheelidled, wheelDelay); g.zoom("mouse", constrain(translate(scale(t, k2), g.mouse[0], g.mouse[1]), g.extent, translateExtent)); function wheelidled() { g.wheel = null; g.end(); } } function mousedowned(event, ...args) { if (touchending || !filter2.apply(this, arguments)) return; var currentTarget = event.currentTarget, g = gesture(this, args, true).event(event), v = select(event.view).on("mousemove.zoom", mousemoved, true).on("mouseup.zoom", mouseupped, true), p = pointer(event, currentTarget), x02 = event.clientX, y02 = event.clientY; dragDisable(event.view); nopropagation(event); g.mouse = [p, this.__zoom.invert(p)]; interrupt(this); g.start(); function mousemoved(event2) { noevent(event2); if (!g.moved) { var dx = event2.clientX - x02, dy = event2.clientY - y02; g.moved = dx * dx + dy * dy > clickDistance2; } g.event(event2).zoom("mouse", constrain(translate(g.that.__zoom, g.mouse[0] = pointer(event2, currentTarget), g.mouse[1]), g.extent, translateExtent)); } function mouseupped(event2) { v.on("mousemove.zoom mouseup.zoom", null); yesdrag(event2.view, g.moved); noevent(event2); g.event(event2).end(); } } function dblclicked(event, ...args) { if (!filter2.apply(this, arguments)) return; var t02 = this.__zoom, p02 = pointer(event.changedTouches ? event.changedTouches[0] : event, this), p1 = t02.invert(p02), k1 = t02.k * (event.shiftKey ? 0.5 : 2), t12 = constrain(translate(scale(t02, k1), p02, p1), extent2.apply(this, args), translateExtent); noevent(event); if (duration > 0) select(this).transition().duration(duration).call(schedule2, t12, p02, event); else select(this).call(zoom2.transform, t12, p02, event); } function touchstarted(event, ...args) { if (!filter2.apply(this, arguments)) return; var touches = event.touches, n = touches.length, g = gesture(this, args, event.changedTouches.length === n).event(event), started, i, t, p; nopropagation(event); for (i = 0; i < n; ++i) { t = touches[i], p = pointer(t, this); p = [p, this.__zoom.invert(p), t.identifier]; if (!g.touch0) g.touch0 = p, started = true, g.taps = 1 + !!touchstarting; else if (!g.touch1 && g.touch0[2] !== p[2]) g.touch1 = p, g.taps = 0; } if (touchstarting) touchstarting = clearTimeout(touchstarting); if (started) { if (g.taps < 2) touchfirst = p[0], touchstarting = setTimeout(function() { touchstarting = null; }, touchDelay); interrupt(this); g.start(); } } function touchmoved(event, ...args) { if (!this.__zooming) return; var g = gesture(this, args).event(event), touches = event.changedTouches, n = touches.length, i, t, p, l; noevent(event); for (i = 0; i < n; ++i) { t = touches[i], p = pointer(t, this); if (g.touch0 && g.touch0[2] === t.identifier) g.touch0[0] = p; else if (g.touch1 && g.touch1[2] === t.identifier) g.touch1[0] = p; } t = g.that.__zoom; if (g.touch1) { var p02 = g.touch0[0], l0 = g.touch0[1], p1 = g.touch1[0], l1 = g.touch1[1], dp = (dp = p1[0] - p02[0]) * dp + (dp = p1[1] - p02[1]) * dp, dl = (dl = l1[0] - l0[0]) * dl + (dl = l1[1] - l0[1]) * dl; t = scale(t, Math.sqrt(dp / dl)); p = [(p02[0] + p1[0]) / 2, (p02[1] + p1[1]) / 2]; l = [(l0[0] + l1[0]) / 2, (l0[1] + l1[1]) / 2]; } else if (g.touch0) p = g.touch0[0], l = g.touch0[1]; else return; g.zoom("touch", constrain(translate(t, p, l), g.extent, translateExtent)); } function touchended(event, ...args) { if (!this.__zooming) return; var g = gesture(this, args).event(event), touches = event.changedTouches, n = touches.length, i, t; nopropagation(event); if (touchending) clearTimeout(touchending); touchending = setTimeout(function() { touchending = null; }, touchDelay); for (i = 0; i < n; ++i) { t = touches[i]; if (g.touch0 && g.touch0[2] === t.identifier) delete g.touch0; else if (g.touch1 && g.touch1[2] === t.identifier) delete g.touch1; } if (g.touch1 && !g.touch0) g.touch0 = g.touch1, delete g.touch1; if (g.touch0) g.touch0[1] = this.__zoom.invert(g.touch0[0]); else { g.end(); if (g.taps === 2) { t = pointer(t, this); if (Math.hypot(touchfirst[0] - t[0], touchfirst[1] - t[1]) < tapDistance) { var p = select(this).on("dblclick.zoom"); if (p) p.apply(this, arguments); } } } } zoom2.wheelDelta = function(_2) { return arguments.length ? (wheelDelta = typeof _2 === "function" ? _2 : constant(+_2), zoom2) : wheelDelta; }; zoom2.filter = function(_2) { return arguments.length ? (filter2 = typeof _2 === "function" ? _2 : constant(!!_2), zoom2) : filter2; }; zoom2.touchable = function(_2) { return arguments.length ? (touchable = typeof _2 === "function" ? _2 : constant(!!_2), zoom2) : touchable; }; zoom2.extent = function(_2) { return arguments.length ? (extent2 = typeof _2 === "function" ? _2 : constant([[+_2[0][0], +_2[0][1]], [+_2[1][0], +_2[1][1]]]), zoom2) : extent2; }; zoom2.scaleExtent = function(_2) { return arguments.length ? (scaleExtent[0] = +_2[0], scaleExtent[1] = +_2[1], zoom2) : [scaleExtent[0], scaleExtent[1]]; }; zoom2.translateExtent = function(_2) { return arguments.length ? (translateExtent[0][0] = +_2[0][0], translateExtent[1][0] = +_2[1][0], translateExtent[0][1] = +_2[0][1], translateExtent[1][1] = +_2[1][1], zoom2) : [[translateExtent[0][0], translateExtent[0][1]], [translateExtent[1][0], translateExtent[1][1]]]; }; zoom2.constrain = function(_2) { return arguments.length ? (constrain = _2, zoom2) : constrain; }; zoom2.duration = function(_2) { return arguments.length ? (duration = +_2, zoom2) : duration; }; zoom2.interpolate = function(_2) { return arguments.length ? (interpolate2 = _2, zoom2) : interpolate2; }; zoom2.on = function() { var value = listeners.on.apply(listeners, arguments); return value === listeners ? zoom2 : value; }; zoom2.clickDistance = function(_2) { return arguments.length ? (clickDistance2 = (_2 = +_2) * _2, zoom2) : Math.sqrt(clickDistance2); }; zoom2.tapDistance = function(_2) { return arguments.length ? (tapDistance = +_2, zoom2) : tapDistance; }; return zoom2; } const src = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({ __proto__: null, bisect, bisectRight, bisectLeft, bisectCenter, ascending: ascending$3, bisector, blur, blur2, blurImage, count: count$1, cross: cross$3, cumsum, descending: descending$2, deviation, extent: extent$1, Adder, fsum, fcumsum, group, flatGroup, flatRollup, groups, index: index$4, indexes, rollup, rollups, groupSort, bin, histogram: bin, thresholdFreedmanDiaconis, thresholdScott, thresholdSturges, max: max$3, maxIndex, mean, median, medianIndex, merge: merge$1, min: min$2, minIndex, mode, nice: nice$1, pairs, permute, quantile: quantile$1, quantileIndex, quantileSorted, quickselect, range: range$2, rank, least, leastIndex, greatest, greatestIndex, scan, shuffle: shuffle$1, shuffler, sum: sum$2, ticks, tickIncrement, tickStep, transpose, variance, zip, every, some, filter: filter$1, map: map$1, reduce, reverse: reverse$1, sort, difference, disjoint, intersection: intersection$1, subset, superset, union, InternMap, InternSet, axisTop, axisRight, axisBottom, axisLeft, brush, brushX, brushY, brushSelection, chord, chordTranspose, chordDirected, ribbon: ribbon$1, ribbonArrow, color, rgb, hsl: hsl$2, lab: lab$1, hcl: hcl$1, lch, gray, cubehelix: cubehelix$3, contours: Contours, contourDensity: density, Delaunay, Voronoi, dispatch, drag, dragDisable, dragEnable: yesdrag, dsvFormat, csvParse, csvParseRows, csvFormat, csvFormatBody, csvFormatRows, csvFormatRow, csvFormatValue, tsvParse, tsvParseRows, tsvFormat, tsvFormatBody, tsvFormatRows, tsvFormatRow, tsvFormatValue, autoType, easeLinear: linear$1, easeQuad: quadInOut, easeQuadIn: quadIn, easeQuadOut: quadOut, easeQuadInOut: quadInOut, easeCubic: cubicInOut, easeCubicIn: cubicIn, easeCubicOut: cubicOut, easeCubicInOut: cubicInOut, easePoly: polyInOut, easePolyIn: polyIn, easePolyOut: polyOut, easePolyInOut: polyInOut, easeSin: sinInOut, easeSinIn: sinIn, easeSinOut: sinOut, easeSinInOut: sinInOut, easeExp: expInOut, easeExpIn: expIn, easeExpOut: expOut, easeExpInOut: expInOut, easeCircle: circleInOut, easeCircleIn: circleIn, easeCircleOut: circleOut, easeCircleInOut: circleInOut, easeBounce: bounceOut, easeBounceIn: bounceIn, easeBounceOut: bounceOut, easeBounceInOut: bounceInOut, easeBack: backInOut, easeBackIn: backIn, easeBackOut: backOut, easeBackInOut: backInOut, easeElastic: elasticOut, easeElasticIn: elasticIn, easeElasticOut: elasticOut, easeElasticInOut: elasticInOut, blob, buffer, dsv, csv, tsv, image, json: json$1, text: text$1, xml: xml$1, html: html$2, svg: svg$2, forceCenter: center, forceCollide: collide, forceLink: link$2, forceManyBody: manyBody, forceRadial: radial$1, forceSimulation: simulation, forceX: x$2, forceY: y$1, formatDefaultLocale: defaultLocale$1, get format() { return format; }, get formatPrefix() { return formatPrefix; }, formatLocale: formatLocale$1, formatSpecifier, FormatSpecifier, precisionFixed, precisionPrefix, precisionRound, geoArea: area$2, geoBounds: bounds$2, geoCentroid: centroid$1, geoCircle: circle$4, geoClipAntimeridian: clipAntimeridian, geoClipCircle: clipCircle, geoClipExtent: extent, geoClipRectangle: clipRectangle, geoContains: contains$1, geoDistance: distance$1, geoGraticule: graticule, geoGraticule10: graticule10, geoInterpolate: interpolate, geoLength: length$2, geoPath: index$2, geoAlbers: albers, geoAlbersUsa: albersUsa, geoAzimuthalEqualArea: azimuthalEqualArea, geoAzimuthalEqualAreaRaw: azimuthalEqualAreaRaw, geoAzimuthalEquidistant: azimuthalEquidistant, geoAzimuthalEquidistantRaw: azimuthalEquidistantRaw, geoConicConformal: conicConformal, geoConicConformalRaw: conicConformalRaw, geoConicEqualArea: conicEqualArea, geoConicEqualAreaRaw: conicEqualAreaRaw, geoConicEquidistant: conicEquidistant, geoConicEquidistantRaw: conicEquidistantRaw, geoEqualEarth: equalEarth, geoEqualEarthRaw: equalEarthRaw, geoEquirectangular: equirectangular, geoEquirectangularRaw: equirectangularRaw, geoGnomonic: gnomonic, geoGnomonicRaw: gnomonicRaw, geoIdentity: identity$4, geoProjection: projection, geoProjectionMutator: projectionMutator, geoMercator: mercator, geoMercatorRaw: mercatorRaw, geoNaturalEarth1: naturalEarth1, geoNaturalEarth1Raw: naturalEarth1Raw, geoOrthographic: orthographic, geoOrthographicRaw: orthographicRaw, geoStereographic: stereographic, geoStereographicRaw: stereographicRaw, geoTransverseMercator: transverseMercator, geoTransverseMercatorRaw: transverseMercatorRaw, geoRotation: rotation, geoStream, geoTransform: transform$1, cluster, hierarchy, Node: Node$1, pack: index$1, packSiblings: siblings, packEnclose: enclose, partition, stratify, tree, treemap: index, treemapBinary: binary, treemapDice, treemapSlice, treemapSliceDice: sliceDice, treemapSquarify: squarify, treemapResquarify: resquarify, interpolate: interpolate$2, interpolateArray: array$3, interpolateBasis: basis$1, interpolateBasisClosed: basisClosed, interpolateDate: date$1, interpolateDiscrete: discrete, interpolateHue: hue, interpolateNumber, interpolateNumberArray: numberArray, interpolateObject: object$1, interpolateRound, interpolateString, interpolateTransformCss, interpolateTransformSvg, interpolateZoom, interpolateRgb, interpolateRgbBasis: rgbBasis, interpolateRgbBasisClosed: rgbBasisClosed, interpolateHsl: hsl$1, interpolateHslLong: hslLong, interpolateLab: lab, interpolateHcl, interpolateHclLong: hclLong, interpolateCubehelix: cubehelix$2, interpolateCubehelixLong: cubehelixLong, piecewise, quantize: quantize$1, path, polygonArea: area$1, polygonCentroid: centroid, polygonHull: hull, polygonContains: contains, polygonLength: length$1, quadtree, randomUniform: uniform, randomInt: int, randomNormal: normal, randomLogNormal: logNormal, randomBates: bates, randomIrwinHall: irwinHall, randomExponential: exponential, randomPareto: pareto, randomBernoulli: bernoulli, randomGeometric: geometric, randomBinomial: binomial, randomGamma: gamma, randomBeta: beta, randomWeibull: weibull, randomCauchy: cauchy, randomLogistic: logistic, randomPoisson: poisson, randomLcg: lcg, scaleBand: band, scalePoint: point$5, scaleIdentity: identity$2, scaleLinear: linear, scaleLog: log$1, scaleSymlog: symlog, scaleOrdinal: ordinal, scaleImplicit: implicit, scalePow: pow, scaleSqrt: sqrt$1, scaleRadial: radial, scaleQuantile: quantile, scaleQuantize: quantize, scaleThreshold: threshold, scaleTime: time, scaleUtc: utcTime, scaleSequential: sequential, scaleSequentialLog: sequentialLog, scaleSequentialPow: sequentialPow, scaleSequentialSqrt: sequentialSqrt, scaleSequentialSymlog: sequentialSymlog, scaleSequentialQuantile: sequentialQuantile, scaleDiverging: diverging$1, scaleDivergingLog: divergingLog, scaleDivergingPow: divergingPow, scaleDivergingSqrt: divergingSqrt, scaleDivergingSymlog: divergingSymlog, tickFormat, schemeCategory10: category10, schemeAccent: Accent, schemeDark2: Dark2, schemePaired: Paired, schemePastel1: Pastel1, schemePastel2: Pastel2, schemeSet1: Set1, schemeSet2: Set2, schemeSet3: Set3, schemeTableau10: Tableau10, interpolateBrBG: BrBG, schemeBrBG: scheme$q, interpolatePRGn: PRGn, schemePRGn: scheme$p, interpolatePiYG: PiYG, schemePiYG: scheme$o, interpolatePuOr: PuOr, schemePuOr: scheme$n, interpolateRdBu: RdBu, schemeRdBu: scheme$m, interpolateRdGy: RdGy, schemeRdGy: scheme$l, interpolateRdYlBu: RdYlBu, schemeRdYlBu: scheme$k, interpolateRdYlGn: RdYlGn, schemeRdYlGn: scheme$j, interpolateSpectral: Spectral, schemeSpectral: scheme$i, interpolateBuGn: BuGn, schemeBuGn: scheme$h, interpolateBuPu: BuPu, schemeBuPu: scheme$g, interpolateGnBu: GnBu, schemeGnBu: scheme$f, interpolateOrRd: OrRd, schemeOrRd: scheme$e, interpolatePuBuGn: PuBuGn, schemePuBuGn: scheme$d, interpolatePuBu: PuBu, schemePuBu: scheme$c, interpolatePuRd: PuRd, schemePuRd: scheme$b, interpolateRdPu: RdPu, schemeRdPu: scheme$a, interpolateYlGnBu: YlGnBu, schemeYlGnBu: scheme$9, interpolateYlGn: YlGn, schemeYlGn: scheme$8, interpolateYlOrBr: YlOrBr, schemeYlOrBr: scheme$7, interpolateYlOrRd: YlOrRd, schemeYlOrRd: scheme$6, interpolateBlues: Blues, schemeBlues: scheme$5, interpolateGreens: Greens, schemeGreens: scheme$4, interpolateGreys: Greys, schemeGreys: scheme$3, interpolatePurples: Purples, schemePurples: scheme$2, interpolateReds: Reds, schemeReds: scheme$1, interpolateOranges: Oranges, schemeOranges: scheme, interpolateCividis: cividis, interpolateCubehelixDefault: cubehelix, interpolateRainbow: rainbow, interpolateWarm: warm, interpolateCool: cool, interpolateSinebow: sinebow, interpolateTurbo: turbo, interpolateViridis: viridis, interpolateMagma: magma, interpolateInferno: inferno, interpolatePlasma: plasma, create: create$2, creator, local: local$1, matcher, namespace, namespaces, pointer, pointers, select, selectAll, selection, selector, selectorAll, style: styleValue, window: defaultView, arc: d3arc, area, line: line$1, pie: d3pie, areaRadial, radialArea: areaRadial, lineRadial: lineRadial$1, radialLine: lineRadial$1, pointRadial, link, linkHorizontal, linkVertical, linkRadial, symbol: Symbol$4, symbolsStroke, symbolsFill, symbols: symbolsFill, symbolAsterisk: asterisk, symbolCircle: circle$2, symbolCross: cross$1, symbolDiamond: diamond, symbolDiamond2: diamond2, symbolPlus: plus, symbolSquare: square, symbolSquare2: square2, symbolStar: star, symbolTriangle: triangle, symbolTriangle2: triangle2, symbolWye: wye, symbolX: x, curveBasisClosed, curveBasisOpen, curveBasis, curveBumpX: bumpX, curveBumpY: bumpY, curveBundle: bundle, curveCardinalClosed: cardinalClosed, curveCardinalOpen: cardinalOpen, curveCardinal: cardinal, curveCatmullRomClosed: catmullRomClosed, curveCatmullRomOpen: catmullRomOpen, curveCatmullRom: catmullRom, curveLinearClosed, curveLinear, curveMonotoneX: monotoneX, curveMonotoneY: monotoneY, curveNatural, curveStep, curveStepAfter: stepAfter, curveStepBefore: stepBefore, stack, stackOffsetExpand: expand, stackOffsetDiverging: diverging, stackOffsetNone: none$1, stackOffsetSilhouette: silhouette, stackOffsetWiggle: wiggle, stackOrderAppearance: appearance, stackOrderAscending: ascending, stackOrderDescending: descending, stackOrderInsideOut: insideOut, stackOrderNone: none, stackOrderReverse: reverse, timeInterval: newInterval, timeMillisecond: millisecond$1, timeMilliseconds: milliseconds, utcMillisecond: millisecond$1, utcMilliseconds: milliseconds, timeSecond: utcSecond, timeSeconds: seconds, utcSecond, utcSeconds: seconds, timeMinute, timeMinutes: minutes, timeHour, timeHours: hours, timeDay, timeDays: days, timeWeek: sunday, timeWeeks: sundays, timeSunday: sunday, timeSundays: sundays, timeMonday: monday, timeMondays: mondays, timeTuesday: tuesday, timeTuesdays: tuesdays, timeWednesday: wednesday, timeWednesdays: wednesdays, timeThursday: thursday, timeThursdays: thursdays, timeFriday: friday, timeFridays: fridays, timeSaturday: saturday, timeSaturdays: saturdays, timeMonth, timeMonths: months, timeYear, timeYears: years, utcMinute: utcMinute$1, utcMinutes, utcHour: utcHour$1, utcHours, utcDay: utcDay$1, utcDays, utcWeek: utcSunday, utcWeeks: utcSundays, utcSunday, utcSundays, utcMonday, utcMondays, utcTuesday, utcTuesdays, utcWednesday, utcWednesdays, utcThursday, utcThursdays, utcFriday, utcFridays, utcSaturday, utcSaturdays, utcMonth: utcMonth$1, utcMonths, utcYear: utcYear$1, utcYears, utcTicks, utcTickInterval, timeTicks, timeTickInterval, timeFormatDefaultLocale: defaultLocale, get timeFormat() { return timeFormat; }, get timeParse() { return timeParse; }, get utcFormat() { return utcFormat; }, get utcParse() { return utcParse; }, timeFormatLocale: formatLocale, isoFormat: formatIso$1, isoParse: parseIso$1, now, timer, timerFlush, timeout, interval, transition, active, interrupt, zoom, zoomTransform: transform, zoomIdentity: identity, ZoomTransform: Transform }, Symbol.toStringTag, { value: "Module" })); /*! @license DOMPurify 2.4.0 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/2.4.0/LICENSE */ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) { return typeof obj2; } : function(obj2) { return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2; }, _typeof(obj); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) { o2.__proto__ = p2; return o2; }; return _setPrototypeOf(o, p); } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() { })); return true; } catch (e) { return false; } } function _construct(Parent, args, Class) { if (_isNativeReflectConstruct()) { _construct = Reflect.construct; } else { _construct = function _construct2(Parent2, args2, Class2) { var a2 = [null]; a2.push.apply(a2, args2); var Constructor = Function.bind.apply(Parent2, a2); var instance = new Constructor(); if (Class2) _setPrototypeOf(instance, Class2.prototype); return instance; }; } return _construct.apply(null, arguments); } function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var hasOwnProperty$4 = Object.hasOwnProperty, setPrototypeOf = Object.setPrototypeOf, isFrozen = Object.isFrozen, getPrototypeOf = Object.getPrototypeOf, getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor; var freeze = Object.freeze, seal = Object.seal, create = Object.create; var _ref = typeof Reflect !== "undefined" && Reflect, apply$1 = _ref.apply, construct = _ref.construct; if (!apply$1) { apply$1 = function apply2(fun, thisValue, args) { return fun.apply(thisValue, args); }; } if (!freeze) { freeze = function freeze2(x2) { return x2; }; } if (!seal) { seal = function seal2(x2) { return x2; }; } if (!construct) { construct = function construct2(Func, args) { return _construct(Func, _toConsumableArray(args)); }; } var arrayForEach = unapply(Array.prototype.forEach); var arrayPop = unapply(Array.prototype.pop); var arrayPush = unapply(Array.prototype.push); var stringToLowerCase = unapply(String.prototype.toLowerCase); var stringMatch = unapply(String.prototype.match); var stringReplace = unapply(String.prototype.replace); var stringIndexOf = unapply(String.prototype.indexOf); var stringTrim = unapply(String.prototype.trim); var regExpTest = unapply(RegExp.prototype.test); var typeErrorCreate = unconstruct(TypeError); function unapply(func) { return function(thisArg) { for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } return apply$1(func, thisArg, args); }; } function unconstruct(func) { return function() { for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } return construct(func, args); }; } function addToSet(set2, array2, transformCaseFunc) { transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase; if (setPrototypeOf) { setPrototypeOf(set2, null); } var l = array2.length; while (l--) { var element = array2[l]; if (typeof element === "string") { var lcElement = transformCaseFunc(element); if (lcElement !== element) { if (!isFrozen(array2)) { array2[l] = lcElement; } element = lcElement; } } set2[element] = true; } return set2; } function clone$1(object2) { var newObject = create(null); var property; for (property in object2) { if (apply$1(hasOwnProperty$4, object2, [property])) { newObject[property] = object2[property]; } } return newObject; } function lookupGetter(object2, prop) { while (object2 !== null) { var desc = getOwnPropertyDescriptor(object2, prop); if (desc) { if (desc.get) { return unapply(desc.get); } if (typeof desc.value === "function") { return unapply(desc.value); } } object2 = getPrototypeOf(object2); } function fallbackValue(element) { console.warn("fallback value for", element); return null; } return fallbackValue; } var html$1 = freeze(["a", "abbr", "acronym", "address", "area", "article", "aside", "audio", "b", "bdi", "bdo", "big", "blink", "blockquote", "body", "br", "button", "canvas", "caption", "center", "cite", "code", "col", "colgroup", "content", "data", "datalist", "dd", "decorator", "del", "details", "dfn", "dialog", "dir", "div", "dl", "dt", "element", "em", "fieldset", "figcaption", "figure", "font", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "head", "header", "hgroup", "hr", "html", "i", "img", "input", "ins", "kbd", "label", "legend", "li", "main", "map", "mark", "marquee", "menu", "menuitem", "meter", "nav", "nobr", "ol", "optgroup", "option", "output", "p", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "section", "select", "shadow", "small", "source", "spacer", "span", "strike", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "template", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "tt", "u", "ul", "var", "video", "wbr"]); var svg$1 = freeze(["svg", "a", "altglyph", "altglyphdef", "altglyphitem", "animatecolor", "animatemotion", "animatetransform", "circle", "clippath", "defs", "desc", "ellipse", "filter", "font", "g", "glyph", "glyphref", "hkern", "image", "line", "lineargradient", "marker", "mask", "metadata", "mpath", "path", "pattern", "polygon", "polyline", "radialgradient", "rect", "stop", "style", "switch", "symbol", "text", "textpath", "title", "tref", "tspan", "view", "vkern"]); var svgFilters = freeze(["feBlend", "feColorMatrix", "feComponentTransfer", "feComposite", "feConvolveMatrix", "feDiffuseLighting", "feDisplacementMap", "feDistantLight", "feFlood", "feFuncA", "feFuncB", "feFuncG", "feFuncR", "feGaussianBlur", "feImage", "feMerge", "feMergeNode", "feMorphology", "feOffset", "fePointLight", "feSpecularLighting", "feSpotLight", "feTile", "feTurbulence"]); var svgDisallowed = freeze(["animate", "color-profile", "cursor", "discard", "fedropshadow", "font-face", "font-face-format", "font-face-name", "font-face-src", "font-face-uri", "foreignobject", "hatch", "hatchpath", "mesh", "meshgradient", "meshpatch", "meshrow", "missing-glyph", "script", "set", "solidcolor", "unknown", "use"]); var mathMl$1 = freeze(["math", "menclose", "merror", "mfenced", "mfrac", "mglyph", "mi", "mlabeledtr", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msup", "msubsup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover"]); var mathMlDisallowed = freeze(["maction", "maligngroup", "malignmark", "mlongdiv", "mscarries", "mscarry", "msgroup", "mstack", "msline", "msrow", "semantics", "annotation", "annotation-xml", "mprescripts", "none"]); var text = freeze(["#text"]); var html = freeze(["accept", "action", "align", "alt", "autocapitalize", "autocomplete", "autopictureinpicture", "autoplay", "background", "bgcolor", "border", "capture", "cellpadding", "cellspacing", "checked", "cite", "class", "clear", "color", "cols", "colspan", "controls", "controlslist", "coords", "crossorigin", "datetime", "decoding", "default", "dir", "disabled", "disablepictureinpicture", "disableremoteplayback", "download", "draggable", "enctype", "enterkeyhint", "face", "for", "headers", "height", "hidden", "high", "href", "hreflang", "id", "inputmode", "integrity", "ismap", "kind", "label", "lang", "list", "loading", "loop", "low", "max", "maxlength", "media", "method", "min", "minlength", "multiple", "muted", "name", "nonce", "noshade", "novalidate", "nowrap", "open", "optimum", "pattern", "placeholder", "playsinline", "poster", "preload", "pubdate", "radiogroup", "readonly", "rel", "required", "rev", "reversed", "role", "rows", "rowspan", "spellcheck", "scope", "selected", "shape", "size", "sizes", "span", "srclang", "start", "src", "srcset", "step", "style", "summary", "tabindex", "title", "translate", "type", "usemap", "valign", "value", "width", "xmlns", "slot"]); var svg = freeze(["accent-height", "accumulate", "additive", "alignment-baseline", "ascent", "attributename", "attributetype", "azimuth", "basefrequency", "baseline-shift", "begin", "bias", "by", "class", "clip", "clippathunits", "clip-path", "clip-rule", "color", "color-interpolation", "color-interpolation-filters", "color-profile", "color-rendering", "cx", "cy", "d", "dx", "dy", "diffuseconstant", "direction", "display", "divisor", "dur", "edgemode", "elevation", "end", "fill", "fill-opacity", "fill-rule", "filter", "filterunits", "flood-color", "flood-opacity", "font-family", "font-size", "font-size-adjust", "font-stretch", "font-style", "font-variant", "font-weight", "fx", "fy", "g1", "g2", "glyph-name", "glyphref", "gradientunits", "gradienttransform", "height", "href", "id", "image-rendering", "in", "in2", "k", "k1", "k2", "k3", "k4", "kerning", "keypoints", "keysplines", "keytimes", "lang", "lengthadjust", "letter-spacing", "kernelmatrix", "kernelunitlength", "lighting-color", "local", "marker-end", "marker-mid", "marker-start", "markerheight", "markerunits", "markerwidth", "maskcontentunits", "maskunits", "max", "mask", "media", "method", "mode", "min", "name", "numoctaves", "offset", "operator", "opacity", "order", "orient", "orientation", "origin", "overflow", "paint-order", "path", "pathlength", "patterncontentunits", "patterntransform", "patternunits", "points", "preservealpha", "preserveaspectratio", "primitiveunits", "r", "rx", "ry", "radius", "refx", "refy", "repeatcount", "repeatdur", "restart", "result", "rotate", "scale", "seed", "shape-rendering", "specularconstant", "specularexponent", "spreadmethod", "startoffset", "stddeviation", "stitchtiles", "stop-color", "stop-opacity", "stroke-dasharray", "stroke-dashoffset", "stroke-linecap", "stroke-linejoin", "stroke-miterlimit", "stroke-opacity", "stroke", "stroke-width", "style", "surfacescale", "systemlanguage", "tabindex", "targetx", "targety", "transform", "transform-origin", "text-anchor", "text-decoration", "text-rendering", "textlength", "type", "u1", "u2", "unicode", "values", "viewbox", "visibility", "version", "vert-adv-y", "vert-origin-x", "vert-origin-y", "width", "word-spacing", "wrap", "writing-mode", "xchannelselector", "ychannelselector", "x", "x1", "x2", "xmlns", "y", "y1", "y2", "z", "zoomandpan"]); var mathMl = freeze(["accent", "accentunder", "align", "bevelled", "close", "columnsalign", "columnlines", "columnspan", "denomalign", "depth", "dir", "display", "displaystyle", "encoding", "fence", "frame", "height", "href", "id", "largeop", "length", "linethickness", "lspace", "lquote", "mathbackground", "mathcolor", "mathsize", "mathvariant", "maxsize", "minsize", "movablelimits", "notation", "numalign", "open", "rowalign", "rowlines", "rowspacing", "rowspan", "rspace", "rquote", "scriptlevel", "scriptminsize", "scriptsizemultiplier", "selection", "separator", "separators", "stretchy", "subscriptshift", "supscriptshift", "symmetric", "voffset", "width", "xmlns"]); var xml = freeze(["xlink:href", "xml:id", "xlink:title", "xml:space", "xmlns:xlink"]); var MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); var ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm); var DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); var ARIA_ATTR = seal(/^aria-[\-\w]+$/); var IS_ALLOWED_URI = seal( /^(?:(?:(?:f|ht)tps?|mailto|tel|callto|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i ); var IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i); var ATTR_WHITESPACE = seal( /[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g ); var DOCTYPE_NAME = seal(/^html$/i); var getGlobal = function getGlobal2() { return typeof window === "undefined" ? null : window; }; var _createTrustedTypesPolicy = function _createTrustedTypesPolicy2(trustedTypes, document2) { if (_typeof(trustedTypes) !== "object" || typeof trustedTypes.createPolicy !== "function") { return null; } var suffix = null; var ATTR_NAME = "data-tt-policy-suffix"; if (document2.currentScript && document2.currentScript.hasAttribute(ATTR_NAME)) { suffix = document2.currentScript.getAttribute(ATTR_NAME); } var policyName = "dompurify" + (suffix ? "#" + suffix : ""); try { return trustedTypes.createPolicy(policyName, { createHTML: function createHTML(html2) { return html2; }, createScriptURL: function createScriptURL(scriptUrl) { return scriptUrl; } }); } catch (_2) { console.warn("TrustedTypes policy " + policyName + " could not be created."); return null; } }; function createDOMPurify() { var window2 = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : getGlobal(); var DOMPurify = function DOMPurify2(root2) { return createDOMPurify(root2); }; DOMPurify.version = "2.4.0"; DOMPurify.removed = []; if (!window2 || !window2.document || window2.document.nodeType !== 9) { DOMPurify.isSupported = false; return DOMPurify; } var originalDocument = window2.document; var document2 = window2.document; var DocumentFragment = window2.DocumentFragment, HTMLTemplateElement = window2.HTMLTemplateElement, Node2 = window2.Node, Element = window2.Element, NodeFilter = window2.NodeFilter, _window$NamedNodeMap = window2.NamedNodeMap, NamedNodeMap = _window$NamedNodeMap === void 0 ? window2.NamedNodeMap || window2.MozNamedAttrMap : _window$NamedNodeMap, HTMLFormElement = window2.HTMLFormElement, DOMParser2 = window2.DOMParser, trustedTypes = window2.trustedTypes; var ElementPrototype = Element.prototype; var cloneNode = lookupGetter(ElementPrototype, "cloneNode"); var getNextSibling = lookupGetter(ElementPrototype, "nextSibling"); var getChildNodes = lookupGetter(ElementPrototype, "childNodes"); var getParentNode = lookupGetter(ElementPrototype, "parentNode"); if (typeof HTMLTemplateElement === "function") { var template = document2.createElement("template"); if (template.content && template.content.ownerDocument) { document2 = template.content.ownerDocument; } } var trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument); var emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML("") : ""; var _document = document2, implementation = _document.implementation, createNodeIterator = _document.createNodeIterator, createDocumentFragment = _document.createDocumentFragment, getElementsByTagName = _document.getElementsByTagName; var importNode = originalDocument.importNode; var documentMode = {}; try { documentMode = clone$1(document2).documentMode ? document2.documentMode : {}; } catch (_2) { } var hooks = {}; DOMPurify.isSupported = typeof getParentNode === "function" && implementation && typeof implementation.createHTMLDocument !== "undefined" && documentMode !== 9; var MUSTACHE_EXPR$1 = MUSTACHE_EXPR, ERB_EXPR$1 = ERB_EXPR, DATA_ATTR$1 = DATA_ATTR, ARIA_ATTR$1 = ARIA_ATTR, IS_SCRIPT_OR_DATA$1 = IS_SCRIPT_OR_DATA, ATTR_WHITESPACE$1 = ATTR_WHITESPACE; var IS_ALLOWED_URI$1 = IS_ALLOWED_URI; var ALLOWED_TAGS = null; var DEFAULT_ALLOWED_TAGS = addToSet({}, [].concat(_toConsumableArray(html$1), _toConsumableArray(svg$1), _toConsumableArray(svgFilters), _toConsumableArray(mathMl$1), _toConsumableArray(text))); var ALLOWED_ATTR = null; var DEFAULT_ALLOWED_ATTR = addToSet({}, [].concat(_toConsumableArray(html), _toConsumableArray(svg), _toConsumableArray(mathMl), _toConsumableArray(xml))); var CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, { tagNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, attributeNameCheck: { writable: true, configurable: false, enumerable: true, value: null }, allowCustomizedBuiltInElements: { writable: true, configurable: false, enumerable: true, value: false } })); var FORBID_TAGS = null; var FORBID_ATTR = null; var ALLOW_ARIA_ATTR = true; var ALLOW_DATA_ATTR = true; var ALLOW_UNKNOWN_PROTOCOLS = false; var SAFE_FOR_TEMPLATES = false; var WHOLE_DOCUMENT = false; var SET_CONFIG = false; var FORCE_BODY = false; var RETURN_DOM = false; var RETURN_DOM_FRAGMENT = false; var RETURN_TRUSTED_TYPE = false; var SANITIZE_DOM = true; var SANITIZE_NAMED_PROPS = false; var SANITIZE_NAMED_PROPS_PREFIX = "user-content-"; var KEEP_CONTENT = true; var IN_PLACE = false; var USE_PROFILES = {}; var FORBID_CONTENTS = null; var DEFAULT_FORBID_CONTENTS = addToSet({}, ["annotation-xml", "audio", "colgroup", "desc", "foreignobject", "head", "iframe", "math", "mi", "mn", "mo", "ms", "mtext", "noembed", "noframes", "noscript", "plaintext", "script", "style", "svg", "template", "thead", "title", "video", "xmp"]); var DATA_URI_TAGS = null; var DEFAULT_DATA_URI_TAGS = addToSet({}, ["audio", "video", "img", "source", "image", "track"]); var URI_SAFE_ATTRIBUTES = null; var DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ["alt", "class", "for", "id", "label", "name", "pattern", "placeholder", "role", "summary", "title", "value", "style", "xmlns"]); var MATHML_NAMESPACE = "http://www.w3.org/1998/Math/MathML"; var SVG_NAMESPACE = "http://www.w3.org/2000/svg"; var HTML_NAMESPACE = "http://www.w3.org/1999/xhtml"; var NAMESPACE = HTML_NAMESPACE; var IS_EMPTY_INPUT = false; var PARSER_MEDIA_TYPE; var SUPPORTED_PARSER_MEDIA_TYPES = ["application/xhtml+xml", "text/html"]; var DEFAULT_PARSER_MEDIA_TYPE = "text/html"; var transformCaseFunc; var CONFIG = null; var formElement = document2.createElement("form"); var isRegexOrFunction = function isRegexOrFunction2(testValue) { return testValue instanceof RegExp || testValue instanceof Function; }; var _parseConfig = function _parseConfig2(cfg) { if (CONFIG && CONFIG === cfg) { return; } if (!cfg || _typeof(cfg) !== "object") { cfg = {}; } cfg = clone$1(cfg); PARSER_MEDIA_TYPE = SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; transformCaseFunc = PARSER_MEDIA_TYPE === "application/xhtml+xml" ? function(x2) { return x2; } : stringToLowerCase; ALLOWED_TAGS = "ALLOWED_TAGS" in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS; ALLOWED_ATTR = "ALLOWED_ATTR" in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR; URI_SAFE_ATTRIBUTES = "ADD_URI_SAFE_ATTR" in cfg ? addToSet( clone$1(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc ) : DEFAULT_URI_SAFE_ATTRIBUTES; DATA_URI_TAGS = "ADD_DATA_URI_TAGS" in cfg ? addToSet( clone$1(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc ) : DEFAULT_DATA_URI_TAGS; FORBID_CONTENTS = "FORBID_CONTENTS" in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS; FORBID_TAGS = "FORBID_TAGS" in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {}; FORBID_ATTR = "FORBID_ATTR" in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {}; USE_PROFILES = "USE_PROFILES" in cfg ? cfg.USE_PROFILES : false; ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; RETURN_DOM = cfg.RETURN_DOM || false; RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; FORCE_BODY = cfg.FORCE_BODY || false; SANITIZE_DOM = cfg.SANITIZE_DOM !== false; SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; KEEP_CONTENT = cfg.KEEP_CONTENT !== false; IN_PLACE = cfg.IN_PLACE || false; IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI$1; NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE; if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) { CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) { CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck; } if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === "boolean") { CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements; } if (SAFE_FOR_TEMPLATES) { ALLOW_DATA_ATTR = false; } if (RETURN_DOM_FRAGMENT) { RETURN_DOM = true; } if (USE_PROFILES) { ALLOWED_TAGS = addToSet({}, _toConsumableArray(text)); ALLOWED_ATTR = []; if (USE_PROFILES.html === true) { addToSet(ALLOWED_TAGS, html$1); addToSet(ALLOWED_ATTR, html); } if (USE_PROFILES.svg === true) { addToSet(ALLOWED_TAGS, svg$1); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.svgFilters === true) { addToSet(ALLOWED_TAGS, svgFilters); addToSet(ALLOWED_ATTR, svg); addToSet(ALLOWED_ATTR, xml); } if (USE_PROFILES.mathMl === true) { addToSet(ALLOWED_TAGS, mathMl$1); addToSet(ALLOWED_ATTR, mathMl); addToSet(ALLOWED_ATTR, xml); } } if (cfg.ADD_TAGS) { if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) { ALLOWED_TAGS = clone$1(ALLOWED_TAGS); } addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc); } if (cfg.ADD_ATTR) { if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) { ALLOWED_ATTR = clone$1(ALLOWED_ATTR); } addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc); } if (cfg.ADD_URI_SAFE_ATTR) { addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc); } if (cfg.FORBID_CONTENTS) { if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) { FORBID_CONTENTS = clone$1(FORBID_CONTENTS); } addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc); } if (KEEP_CONTENT) { ALLOWED_TAGS["#text"] = true; } if (WHOLE_DOCUMENT) { addToSet(ALLOWED_TAGS, ["html", "head", "body"]); } if (ALLOWED_TAGS.table) { addToSet(ALLOWED_TAGS, ["tbody"]); delete FORBID_TAGS.tbody; } if (freeze) { freeze(cfg); } CONFIG = cfg; }; var MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ["mi", "mo", "mn", "ms", "mtext"]); var HTML_INTEGRATION_POINTS = addToSet({}, ["foreignobject", "desc", "title", "annotation-xml"]); var COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ["title", "style", "font", "a", "script"]); var ALL_SVG_TAGS = addToSet({}, svg$1); addToSet(ALL_SVG_TAGS, svgFilters); addToSet(ALL_SVG_TAGS, svgDisallowed); var ALL_MATHML_TAGS = addToSet({}, mathMl$1); addToSet(ALL_MATHML_TAGS, mathMlDisallowed); var _checkValidNamespace = function _checkValidNamespace2(element) { var parent = getParentNode(element); if (!parent || !parent.tagName) { parent = { namespaceURI: HTML_NAMESPACE, tagName: "template" }; } var tagName = stringToLowerCase(element.tagName); var parentTagName = stringToLowerCase(parent.tagName); if (element.namespaceURI === SVG_NAMESPACE) { if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === "svg"; } if (parent.namespaceURI === MATHML_NAMESPACE) { return tagName === "svg" && (parentTagName === "annotation-xml" || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]); } return Boolean(ALL_SVG_TAGS[tagName]); } if (element.namespaceURI === MATHML_NAMESPACE) { if (parent.namespaceURI === HTML_NAMESPACE) { return tagName === "math"; } if (parent.namespaceURI === SVG_NAMESPACE) { return tagName === "math" && HTML_INTEGRATION_POINTS[parentTagName]; } return Boolean(ALL_MATHML_TAGS[tagName]); } if (element.namespaceURI === HTML_NAMESPACE) { if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) { return false; } if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) { return false; } return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]); } return false; }; var _forceRemove = function _forceRemove2(node2) { arrayPush(DOMPurify.removed, { element: node2 }); try { node2.parentNode.removeChild(node2); } catch (_2) { try { node2.outerHTML = emptyHTML; } catch (_3) { node2.remove(); } } }; var _removeAttribute = function _removeAttribute2(name2, node2) { try { arrayPush(DOMPurify.removed, { attribute: node2.getAttributeNode(name2), from: node2 }); } catch (_2) { arrayPush(DOMPurify.removed, { attribute: null, from: node2 }); } node2.removeAttribute(name2); if (name2 === "is" && !ALLOWED_ATTR[name2]) { if (RETURN_DOM || RETURN_DOM_FRAGMENT) { try { _forceRemove(node2); } catch (_2) { } } else { try { node2.setAttribute(name2, ""); } catch (_2) { } } } }; var _initDocument = function _initDocument2(dirty) { var doc; var leadingWhitespace; if (FORCE_BODY) { dirty = "" + dirty; } else { var matches = stringMatch(dirty, /^[\r\n\t ]+/); leadingWhitespace = matches && matches[0]; } if (PARSER_MEDIA_TYPE === "application/xhtml+xml") { dirty = '' + dirty + ""; } var dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty; if (NAMESPACE === HTML_NAMESPACE) { try { doc = new DOMParser2().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE); } catch (_2) { } } if (!doc || !doc.documentElement) { doc = implementation.createDocument(NAMESPACE, "template", null); try { doc.documentElement.innerHTML = IS_EMPTY_INPUT ? "" : dirtyPayload; } catch (_2) { } } var body = doc.body || doc.documentElement; if (dirty && leadingWhitespace) { body.insertBefore(document2.createTextNode(leadingWhitespace), body.childNodes[0] || null); } if (NAMESPACE === HTML_NAMESPACE) { return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? "html" : "body")[0]; } return WHOLE_DOCUMENT ? doc.documentElement : body; }; var _createIterator = function _createIterator2(root2) { return createNodeIterator.call( root2.ownerDocument || root2, root2, NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false ); }; var _isClobbered = function _isClobbered2(elm) { return elm instanceof HTMLFormElement && (typeof elm.nodeName !== "string" || typeof elm.textContent !== "string" || typeof elm.removeChild !== "function" || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== "function" || typeof elm.setAttribute !== "function" || typeof elm.namespaceURI !== "string" || typeof elm.insertBefore !== "function"); }; var _isNode = function _isNode2(object2) { return _typeof(Node2) === "object" ? object2 instanceof Node2 : object2 && _typeof(object2) === "object" && typeof object2.nodeType === "number" && typeof object2.nodeName === "string"; }; var _executeHook = function _executeHook2(entryPoint, currentNode, data) { if (!hooks[entryPoint]) { return; } arrayForEach(hooks[entryPoint], function(hook) { hook.call(DOMPurify, currentNode, data, CONFIG); }); }; var _sanitizeElements = function _sanitizeElements2(currentNode) { var content; _executeHook("beforeSanitizeElements", currentNode, null); if (_isClobbered(currentNode)) { _forceRemove(currentNode); return true; } if (regExpTest(/[\u0080-\uFFFF]/, currentNode.nodeName)) { _forceRemove(currentNode); return true; } var tagName = transformCaseFunc(currentNode.nodeName); _executeHook("uponSanitizeElement", currentNode, { tagName, allowedTags: ALLOWED_TAGS }); if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) { _forceRemove(currentNode); return true; } if (tagName === "select" && regExpTest(/